From: Dana Jansens Date: Sun, 16 Feb 2003 15:54:23 +0000 (+0000) Subject: only fire the clickHandler if the button is released with the cursor over it X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=e07ea8486556349ee0a312fd4c6bc0e5aa2de4f9;p=chaz%2Fopenbox only fire the clickHandler if the button is released with the cursor over it --- diff --git a/otk/button.cc b/otk/button.cc index f068d5a5..313d8acf 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -38,8 +38,6 @@ void Button::release(unsigned int mouse_button) styleChanged(*RenderStyle::style(screen())); refresh(); - - clickHandler(_mouse_button); } void Button::buttonPressHandler(const XButtonEvent &e) @@ -51,7 +49,11 @@ void Button::buttonPressHandler(const XButtonEvent &e) void Button::buttonReleaseHandler(const XButtonEvent &e) { Widget::buttonReleaseHandler(e); + bool p = _pressed; release(e.button); + if (p && !_pressed && e.x > 0 && e.y > 0 && + e.x < area().width() && e.y < area().height()) + clickHandler(_mouse_button); } void Button::styleChanged(const RenderStyle &style)