From e07ea8486556349ee0a312fd4c6bc0e5aa2de4f9 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 16 Feb 2003 15:54:23 +0000 Subject: [PATCH] only fire the clickHandler if the button is released with the cursor over it --- otk/button.cc | 6 ++++-- 1 file 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) -- 2.45.2