all repos — fluxbox @ 1a54fbc67d5ca8ef22deed2fffe749b9f99739b4

custom fork of the fluxbox windowmanager

move default window menu to ~/.fluxbox/windowmenu
Mark Tiefenbruck mark@fluxbox.org
commit

1a54fbc67d5ca8ef22deed2fffe749b9f99739b4

parent

e71892d99cbe99e2335aa6eb3771ffbb72c5303f

M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 1.1 +*08/06/20: + * Move default window menu to ~/.fluxbox/windowmenu (Mark) + configure.in data/Makefile.am data/windowmenu Screen.cc *08/06/08: * Add (urgent=yes|no) option to client patterns (Mark) ClientPattern.cc/hh
M configure.inconfigure.in

@@ -538,6 +538,14 @@ )

AC_SUBST(DEFAULT_MENU) AC_ARG_WITH( + windowmenu, + [ --with-windowmenu=path location windowmenu file (PREFIX/share/fluxbox/windowmenu)], + DEFAULT_WINDOWMENU=$with_windowmenu, + DEFAULT_WINDOWMENU=\$\(prefix\)/share/fluxbox/windowmenu +) +AC_SUBST(DEFAULT_WINDOWMENU) + +AC_ARG_WITH( style, [ --with-style=path style by default (PREFIX/share/fluxbox/styles/bloe)], DEFAULT_STYLE=$with_style,
M data/Makefile.amdata/Makefile.am

@@ -9,6 +9,7 @@ DEFAULT_KEYS = @DEFAULT_KEYS@

DEFAULT_APPS = @DEFAULT_APPS@ DEFAULT_OVERLAY = @DEFAULT_OVERLAY@ DEFAULT_INIT = @DEFAULT_INIT@ +DEFAULT_WINDOWMENU = @DEFAULT_WINDOWMENU@ SUBDIRS= styles CLEANFILES= menu menu.in menu.pre menu.bak init apps

@@ -19,7 +20,7 @@ all-local: menu init apps

install-pkgdataDATA: @echo "Installing menu file in $(DESTDIR)$(DEFAULT_MENU)" $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_MENU)) - $(INSTALL_DATA) menu $(DESTDIR)$(DEFAULT_MENU) + $(INSTALL_DATA) $(srcdir)/menu $(DESTDIR)$(DEFAULT_MENU) @echo "Installing keys file in $(DESTDIR)$(DEFAULT_KEYS)" $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_KEYS)) $(INSTALL_DATA) $(srcdir)/keys $(DESTDIR)$(DEFAULT_KEYS)

@@ -31,7 +32,10 @@ $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_OVERLAY))

$(INSTALL_DATA) $(srcdir)/overlay $(DESTDIR)$(DEFAULT_OVERLAY) @echo "Installing init file in $(DESTDIR)$(DEFAULT_INIT)" $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_INIT)) - $(INSTALL_DATA) init $(DESTDIR)$(DEFAULT_INIT) + $(INSTALL_DATA) $(srcdir)/init $(DESTDIR)$(DEFAULT_INIT) + @echo "Installing windowmenu file in $(DESTDIR)$(DEFAULT_WINDOWMENU)" + $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_WINDOWMENU)) + $(INSTALL_DATA) $(srcdir)/windowmenu $(DESTDIR)$(DEFAULT_WINDOWMENU) distclean-local: rm -f *\~
M src/Makefile.amsrc/Makefile.am

@@ -30,6 +30,7 @@ DEFAULT_KEYSFILE=@DEFAULT_KEYS@

DEFAULT_APPSFILE=@DEFAULT_APPS@ DEFAULT_OVERLAY=@DEFAULT_OVERLAY@ DEFAULT_INITFILE=@DEFAULT_INIT@ +DEFAULT_WINDOWMENU=@DEFAULT_WINDOWMENU@ PROGRAM_PREFIX=@program_prefix@ PROGRAM_SUFFIX=@program_suffix@

@@ -49,6 +50,7 @@ echo '#define DEFAULTKEYSFILE "$(DEFAULT_KEYSFILE)"'; \

echo '#define DEFAULT_APPSFILE "$(DEFAULT_APPSFILE)"'; \ echo '#define DEFAULT_OVERLAY "$(DEFAULT_OVERLAY)"'; \ echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \ + echo '#define DEFAULT_WINDOWMENU "$(DEFAULT_WINDOWMENU)"'; \ echo '#define PROGRAM_PREFIX "$(PROGRAM_PREFIX:NONE=)"'; \ echo '#define PROGRAM_SUFFIX "$(PROGRAM_SUFFIX:NONE=)"'; \ echo 'std::string realProgramName(std::string name);'; \
M src/Screen.ccsrc/Screen.cc

@@ -278,7 +278,7 @@ decorate_transient(rm, true, scrname+".decorateTransient", altscrname+".DecorateTransient"),

default_deco(rm, "NORMAL", scrname+".defaultDeco", altscrname+".DefaultDeco"), rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"), - windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), + windowmenufile(rm, Fluxbox::instance()->getDefaultDataFilename("windowmenu"), scrname+".windowMenu", altscrname+".WindowMenu"), typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay", altscrname+".NoFocusWhileTypingDelay"), follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"), user_follow_model(rm, FOLLOW_ACTIVE_WINDOW, scrname+".userFollowModel", altscrname+".UserFollowModel"),

@@ -1523,32 +1523,18 @@ }

} +const std::string BScreen::windowMenuFilename() const { + if ((*resource.windowmenufile).empty()) + return Fluxbox::instance()->getDefaultDataFilename("windowmenu"); + return *resource.windowmenufile; +} + void BScreen::rereadWindowMenu() { m_windowmenu->removeAll(); if (!windowMenuFilename().empty()) MenuCreator::createFromFile(windowMenuFilename(), *m_windowmenu, m_windowmenu->reloadHelper()); - - if (m_windowmenu->numberOfItems() == 0) { - const char *defaults[] = { - "shade", - "stick", - "maximize", - "iconify", - "raise", - "lower", - "sendto", - "layer", - "alpha", - "extramenus", - "separator", - "close", - 0 - }; - for (unsigned int i=0; defaults[i]; ++i) - MenuCreator::createWindowMenuItem(defaults[i], "", *m_windowmenu); - } }
M src/Screen.hhsrc/Screen.hh

@@ -120,7 +120,7 @@ bool getMaxDisableResize() const { return *resource.max_disable_resize; }

bool doShowWindowPos() const { return *resource.show_window_pos; } bool decorateTransient() const { return *resource.decorate_transient; } const std::string &defaultDeco() const { return *resource.default_deco; } - const std::string &windowMenuFilename() const { return *resource.windowmenufile; } + const std::string windowMenuFilename() const; FbTk::ImageControl &imageControl() { return *m_image_control.get(); } // menus const FbMenu &rootMenu() const { return *m_rootmenu.get(); }
M src/Window.ccsrc/Window.cc

@@ -2154,11 +2154,11 @@ /**

Show the window menu at pos mx, my */ void FluxboxWindow::showMenu(int menu_x, int menu_y) { - // move menu directly under titlebar + menu().reloadHelper()->checkReload(); int head = screen().getHead(menu_x, menu_y); - // but not off the screen + // move menu directly under titlebar but not off the screen if (menu_y < static_cast<signed>(screen().maxTop(head))) menu_y = screen().maxTop(head); else if (menu_y + menu().height() >= screen().maxBottom(head))

@@ -3648,7 +3648,7 @@ const FbTk::FbWindow &FluxboxWindow::fbWindow() const {

return frame().window(); } -FbTk::Menu &FluxboxWindow::menu() { +FbMenu &FluxboxWindow::menu() { return screen().windowMenu(); }

@@ -3660,7 +3660,7 @@ const FbTk::PixmapWithMask &FluxboxWindow::icon() const {

return (m_client ? m_client->icon() : m_icon); } -const FbTk::Menu &FluxboxWindow::menu() const { +const FbMenu &FluxboxWindow::menu() const { return screen().windowMenu(); }
M src/Window.hhsrc/Window.hh

@@ -47,13 +47,13 @@ class FbWinFrameTheme;

class BScreen; class FbWinFrame; class FocusControl; +class FbMenu; namespace FbTk { class TextButton; class MenuTheme; class ImageControl; class XLayer; -class Menu; } /// Creates the window frame and handles any window event for it

@@ -439,8 +439,8 @@

FbTk::FbWindow &fbWindow(); const FbTk::FbWindow &fbWindow() const; - FbTk::Menu &menu(); - const FbTk::Menu &menu() const; + FbMenu &menu(); + const FbMenu &menu() const; const FbTk::FbWindow &parent() const { return m_parent; } FbTk::FbWindow &parent() { return m_parent; }
M src/fluxbox.ccsrc/fluxbox.cc

@@ -522,16 +522,15 @@ */

void Fluxbox::setupConfigFiles() { bool create_init = false, create_keys = false, create_menu = false, - create_apps = false, create_overlay = false; + create_apps = false, create_overlay = false, create_windowmenu = false; - string dirname = getenv("HOME") + string("/.") + m_RC_PATH + "/"; - string init_file, keys_file, menu_file, slitlist_file, apps_file, - overlay_file; - init_file = dirname + m_RC_INIT_FILE; - keys_file = dirname + "keys"; - menu_file = dirname + "menu"; - apps_file = dirname + "apps"; - overlay_file = dirname + "overlay"; + string dirname = getDefaultDataFilename(""); + string init_file = getDefaultDataFilename(m_RC_INIT_FILE); + string keys_file = getDefaultDataFilename("keys"); + string menu_file = getDefaultDataFilename("menu"); + string apps_file = getDefaultDataFilename("apps"); + string overlay_file = getDefaultDataFilename("overlay"); + string windowmenu_file = getDefaultDataFilename("windowmenu"); struct stat buf;

@@ -549,6 +548,8 @@ if (stat(apps_file.c_str(), &buf))

create_apps = true; if (stat(overlay_file.c_str(), &buf)) create_overlay = true; + if (stat(windowmenu_file.c_str(), &buf)) + create_windowmenu = true; } else { #ifdef DEBUG

@@ -589,6 +590,9 @@

// copy init file if (create_init) FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str()); + + if (create_windowmenu) + FbTk::FileUtil::copyFile(DEFAULT_WINDOWMENU, windowmenu_file.c_str()); #define CONFIG_VERSION 8 FbTk::Resource<int> config_version(m_resourcemanager, 0,

@@ -1319,18 +1323,14 @@ }

/// @return filename of resource file string Fluxbox::getRcFilename() { - - if (m_rc_file.empty()) { // set default filename - string defaultfile(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + m_RC_INIT_FILE); - return defaultfile; - } - + if (m_rc_file.empty()) + return getDefaultDataFilename(m_RC_INIT_FILE); return m_rc_file; } /// Provides default filename of data file -void Fluxbox::getDefaultDataFilename(const char *name, string &filename) const { - filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name); +string Fluxbox::getDefaultDataFilename(const char *name) const { + return (getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name); } /// loads resources

@@ -1359,8 +1359,7 @@

if (!m_rc_slitlistfile->empty()) { *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); } else { - string filename; - getDefaultDataFilename("slitlist", filename); + string filename = getDefaultDataFilename("slitlist"); m_rc_slitlistfile.setFromString(filename.c_str()); }
M src/fluxbox.hhsrc/fluxbox.hh

@@ -175,7 +175,7 @@ const ScreenList screenList() const { return m_screen_list; }

bool haveShape() const { return m_have_shape; } int shapeEventbase() const { return m_shape_eventbase; } - void getDefaultDataFilename(const char *name, std::string &) const; + std::string getDefaultDataFilename(const char *name) const; // screen mouse was in at last key event BScreen *mouseScreen() { return m_mousescreen; } // screen of window that last key event (i.e. focused window) went to