aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parente71892d99cbe99e2335aa6eb3771ffbb72c5303f (diff)
downloadfluxbox_pavel-1a54fbc67d5ca8ef22deed2fffe749b9f99739b4.zip
fluxbox_pavel-1a54fbc67d5ca8ef22deed2fffe749b9f99739b4.tar.bz2
move default window menu to ~/.fluxbox/windowmenu
Diffstat (limited to 'src')
-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
7 files changed, 36 insertions, 49 deletions
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