all repos — openbox @ f89831466220b6219a15fa3e670149191055ba5a

openbox fork - make it a bit more like ryudo

buttons press!
Dana Jansens danakj@orodu.net
commit

f89831466220b6219a15fa3e670149191055ba5a

parent

c88451f0c1e2586a5a06babb69b060bf808c9148

2 files changed, 61 insertions(+), 1 deletions(-)

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

@@ -58,7 +58,8 @@ _max_press(false),

_desk_press(false), _iconify_press(false), _icon_press(false), - _close_press(false) + _close_press(false), + _press_button(0) { assert(client);

@@ -153,6 +154,60 @@ {

if (_visible) { _visible = false; XUnmapWindow(**otk::display, _frame); + } +} + +void Frame::buttonPressHandler(const XButtonEvent &e) +{ + if (_press_button) return; + _press_button = e.button; + + if (e.window == _max) { + _max_press = true; + renderMax(); + } + if (e.window == _close) { + _close_press = true; + renderClose(); + } + if (e.window == _desk) { + _desk_press = true; + renderDesk(); + } + if (e.window == _iconify) { + _iconify_press = true; + renderIconify(); + } + if (e.window == _icon) { + _icon_press = true; + renderIcon(); + } +} + +void Frame::buttonReleaseHandler(const XButtonEvent &e) +{ + if (e.button != _press_button) return; + _press_button = 0; + + if (e.window == _max) { + _max_press = false; + renderMax(); + } + if (e.window == _close) { + _close_press = false; + renderClose(); + } + if (e.window == _desk) { + _desk_press = false; + renderDesk(); + } + if (e.window == _iconify) { + _iconify_press = false; + renderIconify(); + } + if (e.window == _icon) { + _icon_press = false; + renderIcon(); } }
M src/frame.hhsrc/frame.hh

@@ -94,11 +94,13 @@ otk::Surface *_icon_sur;

otk::Surface *_close_sur; std::string _layout; // layout of the titlebar + bool _max_press; bool _desk_press; bool _iconify_press; bool _icon_press; bool _close_press; + unsigned int _press_button; // mouse button that started the press FrameGeometry geom;

@@ -167,6 +169,9 @@ //! Shows the frame

void show(); //! Hides the frame void hide(); + + void buttonPressHandler(const XButtonEvent &e); + void buttonReleaseHandler(const XButtonEvent &e); //! Returns the MouseContext for the given window id /*!