Added a runtime option for hiding the toolbar totally. Will be cleaner
later. Stay tuned.
This commit is contained in:
parent
88d43795b1
commit
29fff5f56f
8 changed files with 71 additions and 22 deletions
|
@ -1,6 +1,8 @@
|
|||
Changelog for Openbox:
|
||||
|
||||
1.0.0:
|
||||
* added a runtime option for hiding the toolbar. (Scott Moynes)
|
||||
|
||||
* made shaded windows edge-snap correctly to the
|
||||
bottom for their size instead for their unshaded
|
||||
size. (Ben Jansens)
|
||||
|
|
|
@ -38,3 +38,5 @@ $ #TopBottom
|
|||
# Top to Bottom
|
||||
$ #BottomTop
|
||||
# Bottom to Top
|
||||
$ #HideToolbar
|
||||
# Hide Toolbar
|
||||
|
|
|
@ -59,6 +59,8 @@ Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr)
|
|||
"Focus New Windows"), 4);
|
||||
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuFocusLast,
|
||||
"Focus Last Window on Workspace"), 5);
|
||||
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuHideToolbar,
|
||||
"Hide toolbar"), 6);
|
||||
update();
|
||||
|
||||
setItemSelected(2, screen.getImageControl()->doDither());
|
||||
|
@ -66,6 +68,7 @@ Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr)
|
|||
setItemSelected(4, screen.doFullMax());
|
||||
setItemSelected(5, screen.doFocusNew());
|
||||
setItemSelected(6, screen.doFocusLast());
|
||||
setItemSelected(7, screen.doToolbarHide());
|
||||
}
|
||||
|
||||
Configmenu::~Configmenu(void) {
|
||||
|
@ -115,10 +118,15 @@ void Configmenu::itemSelected(int button, int index) {
|
|||
}
|
||||
|
||||
case 5: { // focus last window on workspace
|
||||
screen.saveFocusLast((! screen.doFocusLast()));
|
||||
screen.saveFocusLast(!(screen.doFocusLast()));
|
||||
setItemSelected(index, screen.doFocusLast());
|
||||
break;
|
||||
}
|
||||
case 6:{ //toggle toolbar hide
|
||||
screen.saveToolbarHide(!(screen.doToolbarHide()));
|
||||
setItemSelected(index, screen.doToolbarHide());
|
||||
break;
|
||||
}
|
||||
} // switch
|
||||
}
|
||||
|
||||
|
|
|
@ -2257,10 +2257,20 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void BScreen::hideGeometry(void) {
|
||||
if (geom_visible) {
|
||||
XUnmapWindow(getBaseDisplay().getXDisplay(), geom_window);
|
||||
geom_visible = False;
|
||||
}
|
||||
}
|
||||
|
||||
void BScreen::saveToolbarHide(Bool b){
|
||||
resource.toolbar_total_hide = b;
|
||||
if (toolbar != NULL){
|
||||
if (b)
|
||||
toolbar->unMapToolbar();
|
||||
else
|
||||
toolbar->mapToolbar();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ private:
|
|||
|
||||
Bool toolbar_on_top, toolbar_auto_hide, sloppy_focus, auto_raise,
|
||||
auto_edge_balance, image_dither, ordered_dither, opaque_move, full_max,
|
||||
focus_new, focus_last;
|
||||
focus_new, focus_last, toolbar_total_hide;
|
||||
BColor border_color;
|
||||
obResource styleconfig;
|
||||
|
||||
|
@ -182,6 +182,8 @@ public:
|
|||
{ return resource.toolbar_on_top; }
|
||||
inline const Bool &doToolbarAutoHide(void) const
|
||||
{ return resource.toolbar_auto_hide; }
|
||||
inline const Bool &doToolbarHide(void) const
|
||||
{return resource.toolbar_total_hide;}
|
||||
inline const Bool &isSloppyFocus(void) const
|
||||
{ return resource.sloppy_focus; }
|
||||
inline const Bool &isRootColormapInstalled(void) const
|
||||
|
@ -289,7 +291,6 @@ public:
|
|||
inline void saveFocusNew(Bool f) { resource.focus_new = f; }
|
||||
inline void saveFocusLast(Bool f) { resource.focus_last = f; }
|
||||
inline void iconUpdate(void) { iconmenu->update(); }
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
inline char *getStrftimeFormat(void) { return resource.strftime_format; }
|
||||
void saveStrftimeFormat(const char *);
|
||||
|
@ -328,7 +329,7 @@ public:
|
|||
void showPosition(int, int);
|
||||
void showGeometry(unsigned int, unsigned int);
|
||||
void hideGeometry(void);
|
||||
|
||||
void saveToolbarHide( Bool b);
|
||||
void updateNetizenCurrentWorkspace(void);
|
||||
void updateNetizenWorkspaceCount(void);
|
||||
void updateNetizenWindowFocus(void);
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#ifdef STDC_HEADERS
|
||||
# include <string.h>
|
||||
#endif // HAVE_STRING_H
|
||||
#endif // STDC_HEADERS
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
# include <stdio.h>
|
||||
|
@ -148,15 +148,24 @@ Toolbar::Toolbar(BScreen &scrn) : screen(scrn), openbox(scrn.getOpenbox()) {
|
|||
frame.pbutton = None;
|
||||
|
||||
reconfigure();
|
||||
|
||||
XMapSubwindows(display, frame.window);
|
||||
XMapWindow(display, frame.window);
|
||||
mapToolbar();
|
||||
}
|
||||
|
||||
inline void Toolbar::mapToolbar(){
|
||||
if(!screen.doToolbarHide()){
|
||||
do_hide=false;//not hidden, so windows should not maximize over the toolbar
|
||||
XMapSubwindows(display, frame.window);
|
||||
XMapWindow(display, frame.window);
|
||||
}else
|
||||
do_hide=true;
|
||||
}
|
||||
inline void Toolbar::unMapToolbar(){
|
||||
do_hide=true; //hidden so we can maximize over the toolbar
|
||||
XUnmapWindow(display, frame.window);
|
||||
}
|
||||
|
||||
Toolbar::~Toolbar(void) {
|
||||
XUnmapWindow(display, frame.window);
|
||||
|
||||
unMapToolbar();
|
||||
if (frame.base) image_ctrl->removeImage(frame.base);
|
||||
if (frame.label) image_ctrl->removeImage(frame.label);
|
||||
if (frame.wlabel) image_ctrl->removeImage(frame.wlabel);
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
class Toolbar : public TimeoutHandler {
|
||||
private:
|
||||
Bool on_top, editing, hidden, do_auto_hide;
|
||||
Bool on_top, editing, hidden, do_auto_hide, do_hide;
|
||||
Display *display;
|
||||
|
||||
struct frame {
|
||||
|
@ -117,12 +117,16 @@ public:
|
|||
|
||||
inline const unsigned int &getWidth(void) const { return frame.width; }
|
||||
inline const unsigned int &getHeight(void) const { return frame.height; }
|
||||
inline const unsigned int &getExposedHeight(void) const
|
||||
{ return ((do_auto_hide) ? frame.bevel_w : frame.height); }
|
||||
inline const unsigned int getExposedHeight(void) const {
|
||||
if (do_hide) return 0;
|
||||
else if (do_auto_hide) return frame.bevel_w;
|
||||
else return frame.height;
|
||||
}
|
||||
|
||||
inline const int &getX(void) const
|
||||
{ return ((hidden) ? frame.x_hidden : frame.x); }
|
||||
inline const int &getY(void) const
|
||||
{ return ((hidden) ? frame.y_hidden : frame.y); }
|
||||
inline const int getY(void) const
|
||||
{ return ((hidden || do_hide) ? frame.y_hidden : frame.y); }
|
||||
|
||||
void buttonPressEvent(XButtonEvent *);
|
||||
void buttonReleaseEvent(XButtonEvent *);
|
||||
|
@ -139,7 +143,8 @@ public:
|
|||
void redrawNextWindowButton(Bool = False, Bool = False);
|
||||
void edit(void);
|
||||
void reconfigure(void);
|
||||
|
||||
void mapToolbar(void);
|
||||
void unMapToolbar(void);
|
||||
#ifdef HAVE_STRFTIME
|
||||
void checkClock(Bool = False);
|
||||
#else // HAVE_STRFTIME
|
||||
|
|
|
@ -1072,6 +1072,11 @@ void Openbox::save_rc(void) {
|
|||
config.setValue(rc_string, screen->getToolbar()->doAutoHide() ?
|
||||
"True" : "False");
|
||||
|
||||
sprintf(rc_string, "session.screen%d.toolbar.hide", screen_number);
|
||||
config.setValue(rc_string, screen->doToolbarHide() ?
|
||||
"True" : "False");
|
||||
|
||||
|
||||
switch (screen->getToolbarPlacement()) {
|
||||
case Toolbar::TopLeft: placement = "TopLeft"; break;
|
||||
case Toolbar::BottomLeft: placement = "BottomLeft"; break;
|
||||
|
@ -1328,6 +1333,13 @@ void Openbox::load_rc(BScreen *screen) {
|
|||
else
|
||||
screen->saveToolbarOnTop(False);
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.toolbar.hide", screen_number);
|
||||
sprintf(class_lookup, "Session.Screen%d.Toolbar.Hide", screen_number);
|
||||
if (config.getValue(name_lookup, class_lookup, b))
|
||||
screen->saveToolbarHide((Bool)b);
|
||||
else
|
||||
screen->saveToolbarHide(False);
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.toolbar.autoHide", screen_number);
|
||||
sprintf(class_lookup, "Session.Screen%d.Toolbar.autoHide", screen_number);
|
||||
if (config.getValue(name_lookup, class_lookup, b))
|
||||
|
|
Loading…
Reference in a new issue