From 598cd8a7fd5ab42c95ced857757fc5bf4c1c5eef Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 4 Apr 2002 14:23:30 +0000 Subject: added toggleDecoration and setDecoration functions --- src/Window.cc | 153 +++++++++++++++++++++++++++------------------------------- src/Window.hh | 15 ++++-- 2 files changed, 82 insertions(+), 86 deletions(-) diff --git a/src/Window.cc b/src/Window.cc index a6689cb..8ed85ff 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.38 2002/04/04 13:19:10 fluxgen Exp $ +// $Id: Window.cc,v 1.39 2002/04/04 14:23:30 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -1689,12 +1689,13 @@ void FluxboxWindow::getBlackboxHints(void) { Fluxbox *fluxbox = Fluxbox::instance(); if (XGetWindowProperty(display, client.window, - fluxbox->getFluxboxHintsAtom(), 0, - PropBlackboxHintsElements, false, - fluxbox->getFluxboxHintsAtom(), &atom_return, - &format, &num, &len, - (unsigned char **) &client.blackbox_hint) == Success && - client.blackbox_hint) + fluxbox->getFluxboxHintsAtom(), 0, + PropBlackboxHintsElements, False, + fluxbox->getFluxboxHintsAtom(), &atom_return, + &format, &num, &len, + (unsigned char **) &client.blackbox_hint) == Success && + client.blackbox_hint) { + if (num == PropBlackboxHintsElements) { if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_SHADED) shaded = (client.blackbox_hint->attrib & BaseDisplay::ATTRIB_SHADED); @@ -1716,46 +1717,11 @@ void FluxboxWindow::getBlackboxHints(void) { if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_DECORATION) { - switch (client.blackbox_hint->decoration) { - case BaseDisplay::DECOR_NONE: - decorations.titlebar = decorations.border = decorations.handle = - decorations.iconify = decorations.maximize = - decorations.menu = decorations.tab = false; //tab is also a decor - functions.resize = functions.move = functions.iconify = - functions.maximize = false; - - break; - - default: - case BaseDisplay::DECOR_NORMAL: - decorations.titlebar = decorations.border = decorations.handle = - decorations.iconify = decorations.maximize = - decorations.menu = true; - functions.resize = functions.move = functions.iconify = - functions.maximize = true; - - break; - - case BaseDisplay::DECOR_TINY: - decorations.titlebar = decorations.iconify = decorations.menu = - functions.move = functions.iconify = true; - decorations.border = decorations.handle = decorations.maximize = - functions.resize = functions.maximize = false; - - break; - - case BaseDisplay::DECOR_TOOL: - decorations.titlebar = decorations.menu = functions.move = true; - decorations.iconify = decorations.border = decorations.handle = - decorations.maximize = functions.resize = functions.maximize = - functions.iconify = false; - - break; - } - - reconfigure(); + old_decoration = static_cast(client.blackbox_hint->decoration); + setDecoration(old_decoration); } } + } } @@ -3466,6 +3432,61 @@ void FluxboxWindow::shapeEvent(XShapeEvent *) { #endif // SHAPE +void FluxboxWindow::setDecoration(Decoration decoration) { + + switch (decoration) { + case DECOR_NONE: + decorations.titlebar = decorations.border = decorations.handle = + decorations.iconify = decorations.maximize = + decorations.menu = decorations.tab = false; //tab is also a decor + functions.resize = functions.move = functions.iconify = + functions.maximize = false; + break; + + default: + case DECOR_NORMAL: + decorations.titlebar = decorations.border = decorations.handle = + decorations.iconify = decorations.maximize = + decorations.menu = true; + functions.resize = functions.move = functions.iconify = + functions.maximize = true; + XMapSubwindows(display, frame.window); + XMapWindow(display, frame.window); + + break; + + case DECOR_TINY: + decorations.titlebar = decorations.iconify = decorations.menu = + functions.move = functions.iconify = true; + decorations.border = decorations.handle = decorations.maximize = + functions.resize = functions.maximize = false; + XMapSubwindows(display, frame.window); + XMapWindow(display, frame.window); + break; + + case DECOR_TOOL: + decorations.titlebar = decorations.menu = functions.move = true; + decorations.iconify = decorations.border = decorations.handle = + decorations.maximize = functions.resize = functions.maximize = + functions.iconify = false; + decorate(); + break; + } + + reconfigure(); + +} + +void FluxboxWindow::toggleDecoration() { + static bool decor = false; + if (!decor) { + setDecoration(DECOR_NONE); + decor = true; + } else { + setDecoration(old_decoration); + decor = false; + } +} bool FluxboxWindow::validateClient(void) { XSync(display, false); @@ -3586,6 +3607,7 @@ void FluxboxWindow::stopResizing(Window win) { XUngrabPointer(display, CurrentTime); } + void FluxboxWindow::restore(void) { XChangeSaveSet(display, client.window, SetModeDelete); XSelectInput(display, client.window, NoEventMask); @@ -3652,45 +3674,10 @@ void FluxboxWindow::changeBlackboxHints(BaseDisplay::BlackboxHints *net) { } if (net->flags & BaseDisplay::ATTRIB_DECORATION) { - switch (net->decoration) { - case BaseDisplay::DECOR_NONE: - decorations.titlebar = decorations.border = decorations.handle = - decorations.iconify = decorations.maximize = - decorations.menu = decorations.tab = false; //tab is also a decor - functions.resize = functions.move = functions.iconify = - functions.maximize = false; - - break; - - default: - case BaseDisplay::DECOR_NORMAL: - decorations.titlebar = decorations.border = decorations.handle = - decorations.iconify = decorations.maximize = - decorations.menu = true; - functions.resize = functions.move = functions.iconify = - functions.maximize = true; - - break; - - case BaseDisplay::DECOR_TINY: - decorations.titlebar = decorations.iconify = decorations.menu = - functions.move = functions.iconify = true; - decorations.border = decorations.handle = decorations.maximize = - functions.resize = functions.maximize = false; - - break; - - case BaseDisplay::DECOR_TOOL: - decorations.titlebar = decorations.menu = functions.move = true; - decorations.iconify = decorations.border = decorations.handle = - decorations.maximize = functions.resize = functions.maximize = - functions.iconify = false; - - break; - } - - reconfigure(); + old_decoration = static_cast(net->decoration); + setDecoration(old_decoration); } + } diff --git a/src/Window.hh b/src/Window.hh index 7d61873..4611385 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.16 2002/04/04 13:19:10 fluxgen Exp $ +// $Id: Window.hh,v 1.17 2002/04/04 14:23:30 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -117,6 +117,9 @@ public: LAYER_TOP = 0x08 }; + enum Decoration {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL}; + + FluxboxWindow(Window, BScreen * = 0); virtual ~FluxboxWindow(void); @@ -197,6 +200,9 @@ public: void propertyNotifyEvent(Atom); void exposeEvent(XExposeEvent *); void configureRequestEvent(XConfigureRequestEvent *); + + void setDecoration(Decoration decoration); + void toggleDecoration(); static void showError(FluxboxWindow::Error error); @@ -235,6 +241,7 @@ private: unsigned int workspace_number; unsigned long current_state; WinLayer m_layer; + Decoration old_decoration; struct _client { FluxboxWindow *transient_for, // which window are we a transient for? @@ -256,7 +263,7 @@ private: struct _decorations { bool titlebar, handle, border, iconify, - maximize, close, menu, sticky, shade, tab; + maximize, close, menu, sticky, shade, tab; } decorations; struct _functions { @@ -309,7 +316,9 @@ private: void startMoving(Window win); void stopMoving(); void startResizing(XMotionEvent *me, bool left); - void stopResizing(Window win=0); + void stopResizing(Window win=0); + + #ifdef GNOME void updateGnomeAtoms(); -- cgit v0.11.2