From: Dana Jansens Date: Mon, 27 May 2002 05:06:04 +0000 (+0000) Subject: added "Hide Toolbar" option. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=5377e3fde108da56894185716d47c3058032b97f;p=chaz%2Fopenbox added "Hide Toolbar" option. --- diff --git a/nls/C/Configmenu.m b/nls/C/Configmenu.m index 7fef82da..5459d773 100644 --- a/nls/C/Configmenu.m +++ b/nls/C/Configmenu.m @@ -16,6 +16,8 @@ $ #FocusNew # Focus New Windows $ #FocusLast # Focus Window on Workspace Change +$ #HideToolbar +# Hide Toolbar $ #ClickToFocus # Click to Focus $ #SloppyFocus diff --git a/src/Configmenu.cc b/src/Configmenu.cc index 89f93f9b..6d1bbed2 100644 --- a/src/Configmenu.cc +++ b/src/Configmenu.cc @@ -53,6 +53,8 @@ Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) { "Focus New Windows"), 4); insert(i18n(ConfigmenuSet, ConfigmenuFocusLast, "Focus Last Window on Workspace"), 5); + insert(i18n(ConfigmenuSet, ConfigmenuHideToolbar, + "Hide Toolbar"), 6); update(); setValues(); } @@ -64,6 +66,7 @@ void Configmenu::setValues(void) { setItemSelected(4, getScreen()->doFullMax()); setItemSelected(5, getScreen()->doFocusNew()); setItemSelected(6, getScreen()->doFocusLast()); + setItemSelected(7, getScreen()->doHideToolbar()); } @@ -110,6 +113,12 @@ void Configmenu::itemSelected(int button, unsigned int index) { setItemSelected(index, getScreen()->doFocusLast()); break; } + + case 6: { // hide toolbar + getScreen()->saveHideToolbar((! getScreen()->doHideToolbar())); + setItemSelected(index, getScreen()->doHideToolbar()); + break; + } } // switch } diff --git a/src/Screen.cc b/src/Screen.cc index 919ea9b6..e744ab4c 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -408,6 +408,16 @@ void BScreen::saveFocusLast(bool f) { } +void BScreen::saveHideToolbar(bool h) { + resource.hide_toolbar = h; + if (resource.hide_toolbar) + toolbar->unmapToolbar(); + else + toolbar->mapToolbar(); + config->setValue(screenstr + "hideToolbar", resource.hide_toolbar); +} + + void BScreen::saveWorkspaces(unsigned int w) { resource.workspaces = w; config->setValue(screenstr + "workspaces", resource.workspaces); @@ -493,6 +503,7 @@ void BScreen::save_rc(void) { saveFullMax(resource.full_max); saveFocusNew(resource.focus_new); saveFocusLast(resource.focus_last); + saveHideToolbar(resource.hide_toolbar); saveWorkspaces(resource.workspaces); savePlacementPolicy(resource.placement_policy); saveEdgeSnapThreshold(resource.edge_snap_threshold); @@ -529,6 +540,9 @@ void BScreen::load_rc(void) { if (! config->getValue(screenstr + "opaqueMove", resource.opaque_move)) resource.opaque_move = false; + if (! config->getValue(screenstr + "hideToolbar", resource.hide_toolbar)) + resource.hide_toolbar = false; + if (! config->getValue(screenstr + "imageDither", b)) b = true; image_control->setDither(b); diff --git a/src/Screen.hh b/src/Screen.hh index cb28dea0..34cc633a 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -150,7 +150,8 @@ private: MenuStyle mstyle; bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither, - opaque_move, full_max, focus_new, focus_last, click_raise; + opaque_move, full_max, focus_new, focus_last, click_raise, + hide_toolbar; BColor border_color; unsigned int workspaces; @@ -212,6 +213,7 @@ public: inline bool doFullMax(void) const { return resource.full_max; } inline bool doFocusNew(void) const { return resource.focus_new; } inline bool doFocusLast(void) const { return resource.focus_last; } + inline bool doHideToolbar(void) const { return resource.hide_toolbar; } inline const GC &getOpGC(void) const { return opGC; } @@ -268,6 +270,7 @@ public: void saveFullMax(bool f); void saveFocusNew(bool f); void saveFocusLast(bool f); + void saveHideToolbar(bool h); inline void iconUpdate(void) { iconmenu->update(); } #ifdef HAVE_STRFTIME diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 5ff333ad..447e0d03 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -161,14 +161,12 @@ Toolbar::Toolbar(BScreen *scrn) { screen->addStrut(&strut); reconfigure(); - - XMapSubwindows(display, frame.window); - XMapWindow(display, frame.window); + mapToolbar(); } Toolbar::~Toolbar(void) { - XUnmapWindow(display, frame.window); + unmapToolbar(); if (frame.base) screen->getImageControl()->removeImage(frame.base); if (frame.label) screen->getImageControl()->removeImage(frame.label); @@ -198,6 +196,25 @@ Toolbar::~Toolbar(void) { } +void Toolbar::mapToolbar() { + if (!screen->doHideToolbar()) { + //not hidden, so windows should not maximize over the toolbar + XMapSubwindows(display, frame.window); + XMapWindow(display, frame.window); + } + updateStrut(); +} + + +void Toolbar::unmapToolbar() { + if (toolbarmenu->isVisible()) + toolbarmenu->hide(); + //hidden so we can maximize over the toolbar + XUnmapWindow(display, frame.window); + updateStrut(); +} + + void Toolbar::saveOnTop(bool b) { on_top = b; config->setValue(toolbarstr + "onTop", on_top); @@ -511,14 +528,16 @@ void Toolbar::updateStrut(void) { // left and right are always 0 strut.top = strut.bottom = 0; - switch(placement) { - case TopLeft: - case TopCenter: - case TopRight: - strut.top = getExposedHeight() + (screen->getBorderWidth() * 2); - break; - default: - strut.bottom = getExposedHeight() + (screen->getBorderWidth() * 2); + if (! screen->doHideToolbar()) { + switch(placement) { + case TopLeft: + case TopCenter: + case TopRight: + strut.top = getExposedHeight() + (screen->getBorderWidth() * 2); + break; + default: + strut.bottom = getExposedHeight() + (screen->getBorderWidth() * 2); + } } screen->updateAvailableArea(); diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 31b35e7d..f9dd5481 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -155,13 +155,18 @@ public: void save_rc(void); void load_rc(void); + void mapToolbar(void); + void unmapToolbar(void); + inline Window getWindowID(void) const { return frame.window; } inline const Rect& getRect(void) const { return frame.rect; } inline unsigned int getWidth(void) const { return frame.rect.width(); } inline unsigned int getHeight(void) const { return frame.rect.height(); } inline unsigned int getExposedHeight(void) const - { return ((do_auto_hide) ? frame.bevel_w : frame.rect.height()); } + { return (screen->doHideToolbar() ? 0 : + ((do_auto_hide) ? frame.bevel_w : + frame.rect.height())); } inline int getX(void) const { return ((hidden) ? frame.x_hidden : frame.rect.x()); } inline int getY(void) const