all repos — openbox @ 0dd7ebcba90752d3ad832586f0c1745660078a03

openbox fork - make it a bit more like ryudo

add support for the openbox_restack_window message.
use the state_add/remove/toggle values from otk::Property::atoms
Dana Jansens danakj@orodu.net
commit

0dd7ebcba90752d3ad832586f0c1745660078a03

parent

c15dced3b98ae77868a318cbc43dd34dee0c2178

2 files changed, 37 insertions(+), 27 deletions(-)

jump to
M src/client.ccsrc/client.cc

@@ -881,15 +881,16 @@ if (show) frame->show();

else frame->hide(); } -void Client::setState(StateAction action, long data1, long data2) +void Client::setState(Atom action, long data1, long data2) { bool shadestate = _shaded; bool fsstate = _fullscreen; bool maxh = _max_horz; bool maxv = _max_vert; - if (!(action == State_Add || action == State_Remove || - action == State_Toggle)) + if (!(action == otk::Property::atoms.net_wm_state_add || + action == otk::Property::atoms.net_wm_state_remove || + action == otk::Property::atoms.net_wm_state_toggle)) return; // an invalid action was passed to the client message, ignore it for (int i = 0; i < 2; ++i) {

@@ -898,28 +899,37 @@

if (! state) continue; // if toggling, then pick whether we're adding or removing - if (action == State_Toggle) { + if (action == otk::Property::atoms.net_wm_state_toggle) { if (state == otk::Property::atoms.net_wm_state_modal) - action = _modal ? State_Remove : State_Add; + action = _modal ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_maximized_vert) - action = _max_vert ? State_Remove : State_Add; + action = _max_vert ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_maximized_horz) - action = _max_horz ? State_Remove : State_Add; + action = _max_horz ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_shaded) - action = _shaded ? State_Remove : State_Add; + action = _shaded ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_skip_taskbar) - action = _skip_taskbar ? State_Remove : State_Add; + action = _skip_taskbar ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_skip_pager) - action = _skip_pager ? State_Remove : State_Add; + action = _skip_pager ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_fullscreen) - action = _fullscreen ? State_Remove : State_Add; + action = _fullscreen ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_above) - action = _above ? State_Remove : State_Add; + action = _above ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; else if (state == otk::Property::atoms.net_wm_state_below) - action = _below ? State_Remove : State_Add; + action = _below ? otk::Property::atoms.net_wm_state_remove : + otk::Property::atoms.net_wm_state_add; } - if (action == State_Add) { + if (action == otk::Property::atoms.net_wm_state_add) { if (state == otk::Property::atoms.net_wm_state_modal) { if (_modal) continue; _modal = true;

@@ -944,7 +954,7 @@ if (_below) continue;

_below = true; } - } else { // action == State_Remove + } else { // action == otk::Property::atoms.net_wm_state_remove if (state == otk::Property::atoms.net_wm_state_modal) { if (!_modal) continue; _modal = false;

@@ -1108,7 +1118,7 @@ (e.data.l[0] == 0 ? "Remove" : e.data.l[0] == 1 ? "Add" :

e.data.l[0] == 2 ? "Toggle" : "INVALID"), e.data.l[1], e.data.l[2], _window); #endif - setState((StateAction)e.data.l[0], e.data.l[1], e.data.l[2]); + setState(e.data.l[0], e.data.l[1], e.data.l[2]); } else if (e.message_type == otk::Property::atoms.net_close_window) { #ifdef DEBUG printf("net_close_window for 0x%lx\n", _window);

@@ -1140,6 +1150,14 @@ shade(false);

focus(); if (e.data.l[1]) openbox->screen(_screen)->raiseWindow(this); + } else if (e.message_type == otk::Property::atoms.openbox_restack_window) { +#ifdef DEBUG + printf("openbox_restack_window for 0x%lx\n", _window); +#endif + if (e.data.l[0] == 0) + openbox->screen(_screen)->raiseWindow(this); + else if (e.data.l[0] == 1) + openbox->screen(_screen)->lowerWindow(this); } }
M src/client.hhsrc/client.hh

@@ -152,12 +152,6 @@ };

//! Holds a bitmask of Client::Decoration values typedef unsigned char DecorationFlags; - //! Possible actions that can be made with the _NET_WM_STATE client message - enum StateAction { State_Remove = 0, //!< _NET_WM_STATE_REMOVE - State_Add, //!< _NET_WM_STATE_ADD - State_Toggle //!< _NET_WM_STATE_TOGGLE - }; - //! The event mask to grab on client windows static const long event_mask = PropertyChangeMask | FocusChangeMask | StructureNotifyMask;

@@ -385,7 +379,7 @@ use when updating the state post-mapping.<br>

Client::applyStartupState is used to do the same things during the mapping process. */ - void setState(StateAction action, long data1, long data2); + void setState(Atom action, long data1, long data2); //! Sends the window to the specified desktop void setDesktop(unsigned int desktop);

@@ -520,16 +514,14 @@ */

void applyStartupState(); public: -#ifndef SWIG //! Constructs a new Client object around a specified window id /*! -BB @param window The window id that the Client class should handle + @param window The window id that the Client class should handle @param screen The screen on which the window resides */ Client(int screen, Window window); //! Destroys the Client object virtual ~Client(); -#endif //! Returns the screen on which the clien resides inline int screen() const { return _screen; }

@@ -616,7 +608,7 @@ //! The window should not be displayed by pagers

inline bool skipPager() const { return _skip_pager; } //! The window should not be displayed by taskbars inline bool skipTaskbar() const { return _skip_taskbar; } - //! Returns if the window is shaded + //! Returns if the window is shaded /*! When the window is shaded, only its titlebar is visible. */