added "Hide Toolbar" option.
This commit is contained in:
parent
b0f8eab0e6
commit
5377e3fde1
6 changed files with 66 additions and 14 deletions
|
@ -16,6 +16,8 @@ $ #FocusNew
|
|||
# Focus New Windows
|
||||
$ #FocusLast
|
||||
# Focus Window on Workspace Change
|
||||
$ #HideToolbar
|
||||
# Hide Toolbar
|
||||
$ #ClickToFocus
|
||||
# Click to Focus
|
||||
$ #SloppyFocus
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue