From 0dd7ebcba90752d3ad832586f0c1745660078a03 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 17 Feb 2003 15:11:03 +0000 Subject: [PATCH] add support for the openbox_restack_window message. use the state_add/remove/toggle values from otk::Property::atoms --- src/client.cc | 50 ++++++++++++++++++++++++++++++++++---------------- src/client.hh | 14 +++----------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/client.cc b/src/client.cc index 53a6d768..7ce9baaf 100644 --- a/src/client.cc +++ b/src/client.cc @@ -881,15 +881,16 @@ void Client::showhide() 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 @@ void Client::setState(StateAction action, long data1, long data2) 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 @@ void Client::setState(StateAction action, long data1, long data2) _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 @@ void Client::clientMessageHandler(const XClientMessageEvent &e) 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 @@ void Client::clientMessageHandler(const XClientMessageEvent &e) 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); } } diff --git a/src/client.hh b/src/client.hh index 932bac16..e18de3c9 100644 --- a/src/client.hh +++ b/src/client.hh @@ -152,12 +152,6 @@ public: //! 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 @@ private: 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 @@ private: 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 @@ BB @param window The window id that the Client class should handle 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. */ -- 2.44.0