diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-02-16 15:54:23 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-02-16 15:54:23 +0000 |
| commit | e07ea8486556349ee0a312fd4c6bc0e5aa2de4f9 (patch) | |
| tree | a7fee435081975d9791e903f5fe0fdffa258448d /otk/button.cc | |
| parent | bbd9cb9928e5009ef6f3a91278ec6091343c9353 (diff) | |
only fire the clickHandler if the button is released with the cursor over it
Diffstat (limited to 'otk/button.cc')
| -rw-r--r-- | otk/button.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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) |
