aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-06-20 03:48:26 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-06-20 03:48:26 (GMT)
commit1a54fbc67d5ca8ef22deed2fffe749b9f99739b4 (patch)
tree7d355643f0108b83b15f1086d7e871a769a70fa5
parente71892d99cbe99e2335aa6eb3771ffbb72c5303f (diff)
downloadfluxbox-1a54fbc67d5ca8ef22deed2fffe749b9f99739b4.zip
fluxbox-1a54fbc67d5ca8ef22deed2fffe749b9f99739b4.tar.bz2
move default window menu to ~/.fluxbox/windowmenu
-rw-r--r--ChangeLog3
-rw-r--r--configure.in8
-rw-r--r--data/Makefile.am8
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Screen.cc28
-rw-r--r--src/Screen.hh2
-rw-r--r--src/Window.cc8
-rw-r--r--src/Window.hh6
-rw-r--r--src/fluxbox.cc37
-rw-r--r--src/fluxbox.hh2
10 files changed, 53 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index d754d00..32138a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1 2Changes for 1.1
3*08/06/20:
4 * Move default window menu to ~/.fluxbox/windowmenu (Mark)
5 configure.in data/Makefile.am data/windowmenu Screen.cc
3*08/06/08: 6*08/06/08:
4 * Add (urgent=yes|no) option to client patterns (Mark) 7 * Add (urgent=yes|no) option to client patterns (Mark)
5 ClientPattern.cc/hh 8 ClientPattern.cc/hh
diff --git a/configure.in b/configure.in
index 90f020f..c778ab1 100644
--- a/configure.in
+++ b/configure.in
@@ -538,6 +538,14 @@ AC_ARG_WITH(
538AC_SUBST(DEFAULT_MENU) 538AC_SUBST(DEFAULT_MENU)
539 539
540AC_ARG_WITH( 540AC_ARG_WITH(
541 windowmenu,
542 [ --with-windowmenu=path location windowmenu file (PREFIX/share/fluxbox/windowmenu)],
543 DEFAULT_WINDOWMENU=$with_windowmenu,
544 DEFAULT_WINDOWMENU=\$\(prefix\)/share/fluxbox/windowmenu
545)
546AC_SUBST(DEFAULT_WINDOWMENU)
547
548AC_ARG_WITH(
541 style, 549 style,
542 [ --with-style=path style by default (PREFIX/share/fluxbox/styles/bloe)], 550 [ --with-style=path style by default (PREFIX/share/fluxbox/styles/bloe)],
543 DEFAULT_STYLE=$with_style, 551 DEFAULT_STYLE=$with_style,
diff --git a/data/Makefile.am b/data/Makefile.am
index 4dde80c..e921afa 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -9,6 +9,7 @@ DEFAULT_KEYS = @DEFAULT_KEYS@
9DEFAULT_APPS = @DEFAULT_APPS@ 9DEFAULT_APPS = @DEFAULT_APPS@
10DEFAULT_OVERLAY = @DEFAULT_OVERLAY@ 10DEFAULT_OVERLAY = @DEFAULT_OVERLAY@
11DEFAULT_INIT = @DEFAULT_INIT@ 11DEFAULT_INIT = @DEFAULT_INIT@
12DEFAULT_WINDOWMENU = @DEFAULT_WINDOWMENU@
12 13
13SUBDIRS= styles 14SUBDIRS= styles
14CLEANFILES= menu menu.in menu.pre menu.bak init apps 15CLEANFILES= menu menu.in menu.pre menu.bak init apps
@@ -19,7 +20,7 @@ all-local: menu init apps
19install-pkgdataDATA: 20install-pkgdataDATA:
20 @echo "Installing menu file in $(DESTDIR)$(DEFAULT_MENU)" 21 @echo "Installing menu file in $(DESTDIR)$(DEFAULT_MENU)"
21 $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_MENU)) 22 $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_MENU))
22 $(INSTALL_DATA) menu $(DESTDIR)$(DEFAULT_MENU) 23 $(INSTALL_DATA) $(srcdir)/menu $(DESTDIR)$(DEFAULT_MENU)
23 @echo "Installing keys file in $(DESTDIR)$(DEFAULT_KEYS)" 24 @echo "Installing keys file in $(DESTDIR)$(DEFAULT_KEYS)"
24 $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_KEYS)) 25 $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_KEYS))
25 $(INSTALL_DATA) $(srcdir)/keys $(DESTDIR)$(DEFAULT_KEYS) 26 $(INSTALL_DATA) $(srcdir)/keys $(DESTDIR)$(DEFAULT_KEYS)
@@ -31,7 +32,10 @@ install-pkgdataDATA:
31 $(INSTALL_DATA) $(srcdir)/overlay $(DESTDIR)$(DEFAULT_OVERLAY) 32 $(INSTALL_DATA) $(srcdir)/overlay $(DESTDIR)$(DEFAULT_OVERLAY)
32 @echo "Installing init file in $(DESTDIR)$(DEFAULT_INIT)" 33 @echo "Installing init file in $(DESTDIR)$(DEFAULT_INIT)"
33 $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_INIT)) 34 $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_INIT))
34 $(INSTALL_DATA) init $(DESTDIR)$(DEFAULT_INIT) 35 $(INSTALL_DATA) $(srcdir)/init $(DESTDIR)$(DEFAULT_INIT)
36 @echo "Installing windowmenu file in $(DESTDIR)$(DEFAULT_WINDOWMENU)"
37 $(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_WINDOWMENU))
38 $(INSTALL_DATA) $(srcdir)/windowmenu $(DESTDIR)$(DEFAULT_WINDOWMENU)
35 39
36distclean-local: 40distclean-local:
37 rm -f *\~ 41 rm -f *\~
diff --git a/src/Makefile.am b/src/Makefile.am
index 337b99c..b53af38 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,6 +30,7 @@ DEFAULT_KEYSFILE=@DEFAULT_KEYS@
30DEFAULT_APPSFILE=@DEFAULT_APPS@ 30DEFAULT_APPSFILE=@DEFAULT_APPS@
31DEFAULT_OVERLAY=@DEFAULT_OVERLAY@ 31DEFAULT_OVERLAY=@DEFAULT_OVERLAY@
32DEFAULT_INITFILE=@DEFAULT_INIT@ 32DEFAULT_INITFILE=@DEFAULT_INIT@
33DEFAULT_WINDOWMENU=@DEFAULT_WINDOWMENU@
33PROGRAM_PREFIX=@program_prefix@ 34PROGRAM_PREFIX=@program_prefix@
34PROGRAM_SUFFIX=@program_suffix@ 35PROGRAM_SUFFIX=@program_suffix@
35 36
@@ -49,6 +50,7 @@ defaults.hh: Makefile
49 echo '#define DEFAULT_APPSFILE "$(DEFAULT_APPSFILE)"'; \ 50 echo '#define DEFAULT_APPSFILE "$(DEFAULT_APPSFILE)"'; \
50 echo '#define DEFAULT_OVERLAY "$(DEFAULT_OVERLAY)"'; \ 51 echo '#define DEFAULT_OVERLAY "$(DEFAULT_OVERLAY)"'; \
51 echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \ 52 echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \
53 echo '#define DEFAULT_WINDOWMENU "$(DEFAULT_WINDOWMENU)"'; \
52 echo '#define PROGRAM_PREFIX "$(PROGRAM_PREFIX:NONE=)"'; \ 54 echo '#define PROGRAM_PREFIX "$(PROGRAM_PREFIX:NONE=)"'; \
53 echo '#define PROGRAM_SUFFIX "$(PROGRAM_SUFFIX:NONE=)"'; \ 55 echo '#define PROGRAM_SUFFIX "$(PROGRAM_SUFFIX:NONE=)"'; \
54 echo 'std::string realProgramName(std::string name);'; \ 56 echo 'std::string realProgramName(std::string name);'; \
diff --git a/src/Screen.cc b/src/Screen.cc
index 1525db6..869fb30 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -278,7 +278,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
278 default_deco(rm, "NORMAL", scrname+".defaultDeco", altscrname+".DefaultDeco"), 278 default_deco(rm, "NORMAL", scrname+".defaultDeco", altscrname+".DefaultDeco"),
279 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), 279 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"),
280 tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"), 280 tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"),
281 windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), 281 windowmenufile(rm, Fluxbox::instance()->getDefaultDataFilename("windowmenu"), scrname+".windowMenu", altscrname+".WindowMenu"),
282 typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay", altscrname+".NoFocusWhileTypingDelay"), 282 typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay", altscrname+".NoFocusWhileTypingDelay"),
283 follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"), 283 follow_model(rm, IGNORE_OTHER_WORKSPACES, scrname+".followModel", altscrname+".followModel"),
284 user_follow_model(rm, FOLLOW_ACTIVE_WINDOW, scrname+".userFollowModel", altscrname+".UserFollowModel"), 284 user_follow_model(rm, FOLLOW_ACTIVE_WINDOW, scrname+".userFollowModel", altscrname+".UserFollowModel"),
@@ -1523,6 +1523,12 @@ void BScreen::rereadMenu() {
1523 1523
1524} 1524}
1525 1525
1526const std::string BScreen::windowMenuFilename() const {
1527 if ((*resource.windowmenufile).empty())
1528 return Fluxbox::instance()->getDefaultDataFilename("windowmenu");
1529 return *resource.windowmenufile;
1530}
1531
1526void BScreen::rereadWindowMenu() { 1532void BScreen::rereadWindowMenu() {
1527 1533
1528 m_windowmenu->removeAll(); 1534 m_windowmenu->removeAll();
@@ -1530,26 +1536,6 @@ void BScreen::rereadWindowMenu() {
1530 MenuCreator::createFromFile(windowMenuFilename(), *m_windowmenu, 1536 MenuCreator::createFromFile(windowMenuFilename(), *m_windowmenu,
1531 m_windowmenu->reloadHelper()); 1537 m_windowmenu->reloadHelper());
1532 1538
1533 if (m_windowmenu->numberOfItems() == 0) {
1534 const char *defaults[] = {
1535 "shade",
1536 "stick",
1537 "maximize",
1538 "iconify",
1539 "raise",
1540 "lower",
1541 "sendto",
1542 "layer",
1543 "alpha",
1544 "extramenus",
1545 "separator",
1546 "close",
1547 0
1548 };
1549 for (unsigned int i=0; defaults[i]; ++i)
1550 MenuCreator::createWindowMenuItem(defaults[i], "", *m_windowmenu);
1551 }
1552
1553} 1539}
1554 1540
1555void BScreen::addConfigMenu(const FbTk::FbString &label, FbTk::Menu &menu) { 1541void BScreen::addConfigMenu(const FbTk::FbString &label, FbTk::Menu &menu) {
diff --git a/src/Screen.hh b/src/Screen.hh
index 57c41b6..3283710 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -120,7 +120,7 @@ public:
120 bool doShowWindowPos() const { return *resource.show_window_pos; } 120 bool doShowWindowPos() const { return *resource.show_window_pos; }
121 bool decorateTransient() const { return *resource.decorate_transient; } 121 bool decorateTransient() const { return *resource.decorate_transient; }
122 const std::string &defaultDeco() const { return *resource.default_deco; } 122 const std::string &defaultDeco() const { return *resource.default_deco; }
123 const std::string &windowMenuFilename() const { return *resource.windowmenufile; } 123 const std::string windowMenuFilename() const;
124 FbTk::ImageControl &imageControl() { return *m_image_control.get(); } 124 FbTk::ImageControl &imageControl() { return *m_image_control.get(); }
125 // menus 125 // menus
126 const FbMenu &rootMenu() const { return *m_rootmenu.get(); } 126 const FbMenu &rootMenu() const { return *m_rootmenu.get(); }
diff --git a/src/Window.cc b/src/Window.cc
index 56c6f95..2f06603 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2154,11 +2154,11 @@ void FluxboxWindow::restoreAttributes() {
2154 Show the window menu at pos mx, my 2154 Show the window menu at pos mx, my
2155*/ 2155*/
2156void FluxboxWindow::showMenu(int menu_x, int menu_y) { 2156void FluxboxWindow::showMenu(int menu_x, int menu_y) {
2157 // move menu directly under titlebar 2157 menu().reloadHelper()->checkReload();
2158 2158
2159 int head = screen().getHead(menu_x, menu_y); 2159 int head = screen().getHead(menu_x, menu_y);
2160 2160
2161 // but not off the screen 2161 // move menu directly under titlebar but not off the screen
2162 if (menu_y < static_cast<signed>(screen().maxTop(head))) 2162 if (menu_y < static_cast<signed>(screen().maxTop(head)))
2163 menu_y = screen().maxTop(head); 2163 menu_y = screen().maxTop(head);
2164 else if (menu_y + menu().height() >= screen().maxBottom(head)) 2164 else if (menu_y + menu().height() >= screen().maxBottom(head))
@@ -3648,7 +3648,7 @@ const FbTk::FbWindow &FluxboxWindow::fbWindow() const {
3648 return frame().window(); 3648 return frame().window();
3649} 3649}
3650 3650
3651FbTk::Menu &FluxboxWindow::menu() { 3651FbMenu &FluxboxWindow::menu() {
3652 return screen().windowMenu(); 3652 return screen().windowMenu();
3653} 3653}
3654 3654
@@ -3660,7 +3660,7 @@ const FbTk::PixmapWithMask &FluxboxWindow::icon() const {
3660 return (m_client ? m_client->icon() : m_icon); 3660 return (m_client ? m_client->icon() : m_icon);
3661} 3661}
3662 3662
3663const FbTk::Menu &FluxboxWindow::menu() const { 3663const FbMenu &FluxboxWindow::menu() const {
3664 return screen().windowMenu(); 3664 return screen().windowMenu();
3665} 3665}
3666 3666
diff --git a/src/Window.hh b/src/Window.hh
index 3da2fb1..e7d2270 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -47,13 +47,13 @@ class FbWinFrameTheme;
47class BScreen; 47class BScreen;
48class FbWinFrame; 48class FbWinFrame;
49class FocusControl; 49class FocusControl;
50class FbMenu;
50 51
51namespace FbTk { 52namespace FbTk {
52class TextButton; 53class TextButton;
53class MenuTheme; 54class MenuTheme;
54class ImageControl; 55class ImageControl;
55class XLayer; 56class XLayer;
56class Menu;
57} 57}
58 58
59/// Creates the window frame and handles any window event for it 59/// Creates the window frame and handles any window event for it
@@ -439,8 +439,8 @@ public:
439 FbTk::FbWindow &fbWindow(); 439 FbTk::FbWindow &fbWindow();
440 const FbTk::FbWindow &fbWindow() const; 440 const FbTk::FbWindow &fbWindow() const;
441 441
442 FbTk::Menu &menu(); 442 FbMenu &menu();
443 const FbTk::Menu &menu() const; 443 const FbMenu &menu() const;
444 444
445 const FbTk::FbWindow &parent() const { return m_parent; } 445 const FbTk::FbWindow &parent() const { return m_parent; }
446 FbTk::FbWindow &parent() { return m_parent; } 446 FbTk::FbWindow &parent() { return m_parent; }
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index ec8537c..ae27828 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -522,16 +522,15 @@ void Fluxbox::ungrab() {
522void Fluxbox::setupConfigFiles() { 522void Fluxbox::setupConfigFiles() {
523 523
524 bool create_init = false, create_keys = false, create_menu = false, 524 bool create_init = false, create_keys = false, create_menu = false,
525 create_apps = false, create_overlay = false; 525 create_apps = false, create_overlay = false, create_windowmenu = false;
526 526
527 string dirname = getenv("HOME") + string("/.") + m_RC_PATH + "/"; 527 string dirname = getDefaultDataFilename("");
528 string init_file, keys_file, menu_file, slitlist_file, apps_file, 528 string init_file = getDefaultDataFilename(m_RC_INIT_FILE);
529 overlay_file; 529 string keys_file = getDefaultDataFilename("keys");
530 init_file = dirname + m_RC_INIT_FILE; 530 string menu_file = getDefaultDataFilename("menu");
531 keys_file = dirname + "keys"; 531 string apps_file = getDefaultDataFilename("apps");
532 menu_file = dirname + "menu"; 532 string overlay_file = getDefaultDataFilename("overlay");
533 apps_file = dirname + "apps"; 533 string windowmenu_file = getDefaultDataFilename("windowmenu");
534 overlay_file = dirname + "overlay";
535 534
536 struct stat buf; 535 struct stat buf;
537 536
@@ -549,6 +548,8 @@ void Fluxbox::setupConfigFiles() {
549 create_apps = true; 548 create_apps = true;
550 if (stat(overlay_file.c_str(), &buf)) 549 if (stat(overlay_file.c_str(), &buf))
551 create_overlay = true; 550 create_overlay = true;
551 if (stat(windowmenu_file.c_str(), &buf))
552 create_windowmenu = true;
552 553
553 } else { 554 } else {
554#ifdef DEBUG 555#ifdef DEBUG
@@ -590,6 +591,9 @@ void Fluxbox::setupConfigFiles() {
590 if (create_init) 591 if (create_init)
591 FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str()); 592 FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str());
592 593
594 if (create_windowmenu)
595 FbTk::FileUtil::copyFile(DEFAULT_WINDOWMENU, windowmenu_file.c_str());
596
593#define CONFIG_VERSION 8 597#define CONFIG_VERSION 8
594 FbTk::Resource<int> config_version(m_resourcemanager, 0, 598 FbTk::Resource<int> config_version(m_resourcemanager, 0,
595 "session.configVersion", "Session.ConfigVersion"); 599 "session.configVersion", "Session.ConfigVersion");
@@ -1319,18 +1323,14 @@ void Fluxbox::save_rc() {
1319 1323
1320/// @return filename of resource file 1324/// @return filename of resource file
1321string Fluxbox::getRcFilename() { 1325string Fluxbox::getRcFilename() {
1322 1326 if (m_rc_file.empty())
1323 if (m_rc_file.empty()) { // set default filename 1327 return getDefaultDataFilename(m_RC_INIT_FILE);
1324 string defaultfile(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + m_RC_INIT_FILE);
1325 return defaultfile;
1326 }
1327
1328 return m_rc_file; 1328 return m_rc_file;
1329} 1329}
1330 1330
1331/// Provides default filename of data file 1331/// Provides default filename of data file
1332void Fluxbox::getDefaultDataFilename(const char *name, string &filename) const { 1332string Fluxbox::getDefaultDataFilename(const char *name) const {
1333 filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name); 1333 return (getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name);
1334} 1334}
1335 1335
1336/// loads resources 1336/// loads resources
@@ -1359,8 +1359,7 @@ void Fluxbox::load_rc() {
1359 if (!m_rc_slitlistfile->empty()) { 1359 if (!m_rc_slitlistfile->empty()) {
1360 *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); 1360 *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile);
1361 } else { 1361 } else {
1362 string filename; 1362 string filename = getDefaultDataFilename("slitlist");
1363 getDefaultDataFilename("slitlist", filename);
1364 m_rc_slitlistfile.setFromString(filename.c_str()); 1363 m_rc_slitlistfile.setFromString(filename.c_str());
1365 } 1364 }
1366 1365
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index fc86125..fcbd368 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -175,7 +175,7 @@ public:
175 175
176 bool haveShape() const { return m_have_shape; } 176 bool haveShape() const { return m_have_shape; }
177 int shapeEventbase() const { return m_shape_eventbase; } 177 int shapeEventbase() const { return m_shape_eventbase; }
178 void getDefaultDataFilename(const char *name, std::string &) const; 178 std::string getDefaultDataFilename(const char *name) const;
179 // screen mouse was in at last key event 179 // screen mouse was in at last key event
180 BScreen *mouseScreen() { return m_mousescreen; } 180 BScreen *mouseScreen() { return m_mousescreen; }
181 // screen of window that last key event (i.e. focused window) went to 181 // screen of window that last key event (i.e. focused window) went to