fix ToggleDecor for fullscreen and decorationless windows, plus some other cleanup
markt markt
10 files changed,
39 insertions(+),
30 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,5 +1,9 @@
(Format: Year/Month/Day) Changes for 1.0.0: +*07/07/24: + * Don't allow ToggleDecor with fullscreen windows, and make it show + decorations for windows that don't have a titlebar by default (Mark) + Window.cc/hh *07/07/08: * Clean up state and workspace window properties on client close (Mark) Ewmh.cc Gnome.cc/hh
M
src/FbCommands.cc
→
src/FbCommands.cc
@@ -152,7 +152,7 @@ sprintf(intbuff, "%d", screen_num);
// get shell path from the environment // this process exits immediately, so we don't have to worry about memleaks - char *shell = getenv("SHELL"); + const char *shell = getenv("SHELL"); if (!shell) shell = "/bin/sh";
M
src/FbTk/ImageImlib2.cc
→
src/FbTk/ImageImlib2.cc
@@ -52,7 +52,7 @@ imlib_set_cache_size(2048 * 1024);
// TODO: this are the potential candidates, // choose only sane ones. open for discussion - static char* format_list[] = { + static const char* format_list[] = { "PNG", // pngloader "JPEG", "JPG", "JFI", "JFIF", // jpegloader // "TIFF", "TIF", // tiffloader@@ -67,7 +67,7 @@ // "GZ", // gzloader
NULL }; - char** format = NULL; + const char** format = NULL; for(format = format_list; *format != NULL; format++) { Image::registerType(*format, *this); }
M
src/FbTk/KeyUtil.cc
→
src/FbTk/KeyUtil.cc
@@ -34,7 +34,7 @@
namespace { struct t_modlist{ - char *str; + const char *str; unsigned int mask; bool operator == (const char *modstr) const { return (strcasecmp(str, modstr) == 0 && mask !=0);
M
src/MenuCreator.cc
→
src/MenuCreator.cc
@@ -524,7 +524,7 @@
menu->disableTitle(); // not titlebar if (screen->windowMenuFilename().empty() || ! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) { - char *default_menu[] = { + const char *default_menu[] = { "shade", "stick", "maximize",
M
src/Window.cc
→
src/Window.cc
@@ -262,7 +262,6 @@ m_last_move_x(0), m_last_move_y(0),
m_last_resize_h(1), m_last_resize_w(1), m_workspace_number(0), m_current_state(0), - m_old_decoration(DECOR_NORMAL), m_old_decoration_mask(0), m_client(&client), m_toggled_decos(false),@@ -1243,8 +1242,7 @@ if (hint->flags & ATTRIB_STACK)
m_workspace_number = hint->stack; if (hint->flags & ATTRIB_DECORATION) { - m_old_decoration = static_cast<Decoration>(hint->decoration); - setDecoration(m_old_decoration, false); + setDecoration(static_cast<Decoration>(hint->decoration), false); } }@@ -1577,8 +1575,10 @@ shade();
frame().setUseShape(false); - m_old_decoration_mask = decorationMask(); - m_old_layernum =layerNum(); + if (!m_toggled_decos) + m_old_decoration_mask = decorationMask(); + + m_old_layernum = layerNum(); m_old_pos_x = frame().x(); m_old_pos_y = frame().y(); m_old_width = frame().width();@@ -1609,8 +1609,14 @@ } else if (!flag && isFullscreen()) {
fullscreen = false; - setDecorationMask(m_old_decoration_mask); frame().setUseShape(!m_shaped); + if (m_toggled_decos) { + if (m_old_decoration_mask & DECORM_TITLEBAR) + setDecoration(DECOR_NONE); + else + setDecoration(DECOR_NORMAL); + } else + setDecorationMask(m_old_decoration_mask); // ensure we apply the sizehints here, otherwise some // apps (eg xterm) end up a little bit .. crappy (visually)@@ -1624,7 +1630,6 @@
moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); moveToLayer(m_old_layernum); - m_old_decoration_mask = 0; m_old_layernum = ::Layer::NORMAL; stateSig().notify();@@ -3205,22 +3210,20 @@ }
void FluxboxWindow::toggleDecoration() { //don't toggle decor if the window is shaded - if (isShaded()) + if (isShaded() || isFullscreen()) return; - m_toggled_decos= true; + m_toggled_decos = !m_toggled_decos; - if (decorations.enabled) { //remove decorations - decorations.enabled = false; - setDecoration(DECOR_NONE); - } else { //revert back to old decoration - decorations.enabled = true; - if (m_old_decoration == DECOR_NONE) { // make sure something happens + if (m_toggled_decos) { + m_old_decoration_mask = decorationMask(); + if (decorations.titlebar) + setDecoration(DECOR_NONE); + else setDecoration(DECOR_NORMAL); - } else { - setDecoration(m_old_decoration); - } - } + } else + setDecorationMask(m_old_decoration_mask); + } unsigned int FluxboxWindow::decorationMask() const {@@ -3866,8 +3869,7 @@ }
} if (net.flags & ATTRIB_DECORATION) { - m_old_decoration = static_cast<Decoration>(net.decoration); - setDecoration(m_old_decoration); + setDecoration(static_cast<Decoration>(net.decoration)); } }
M
src/Window.hh
→
src/Window.hh
@@ -538,7 +538,6 @@
unsigned int m_workspace_number; unsigned long m_current_state; // NormalState | IconicState | Withdrawn - Decoration m_old_decoration; unsigned int m_old_decoration_mask; ClientList m_clientlist;
M
src/fluxbox.cc
→
src/fluxbox.cc
@@ -1448,7 +1448,7 @@ return m_rc_file;
} /// Provides default filename of data file -void Fluxbox::getDefaultDataFilename(char *name, string &filename) { +void Fluxbox::getDefaultDataFilename(const char *name, string &filename) { filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name); }
M
src/fluxbox.hh
→
src/fluxbox.hh
@@ -196,7 +196,7 @@ /// @return whether the timestamps on the menu changed
bool menuTimestampsChanged() const; bool haveShape() const { return m_have_shape; } int shapeEventbase() const { return m_shape_eventbase; } - void getDefaultDataFilename(char *name, std::string &); + void getDefaultDataFilename(const char *name, std::string &); // screen mouse was in at last key event BScreen *mouseScreen() { return m_mousescreen; } // screen of window that last key event (i.e. focused window) went to
M
src/main.cc
→
src/main.cc
@@ -321,9 +321,13 @@
FbTk::FbStringUtil::shutdown(); if (restarting) { + const char *shell = getenv("SHELL"); + if (!shell) + shell = "/bin/sh"; + const char *arg = restart_argument.c_str(); if (arg) { - execlp(arg, arg, (char *) NULL); + execlp(shell, shell, "-c", arg, (char *) NULL); perror(arg); }