]> Dogcows Code - chaz/openbox/commitdiff
only fire the clickHandler if the button is released with the cursor over it
authorDana Jansens <danakj@orodu.net>
Sun, 16 Feb 2003 15:54:23 +0000 (15:54 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 16 Feb 2003 15:54:23 +0000 (15:54 +0000)
otk/button.cc

index f068d5a5edd03a38cde7a3432df9a7cb24c73b03..313d8acfcf52751e0b56162444763cba6a84ec4b 100644 (file)
@@ -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)
This page took 0.024488 seconds and 4 git commands to generate.