changeset 2088:e555a2491c8c

clean up fltk form button callbacks (allows Space to trigger) I would still like Enter to work as well, but I haven't looked into whether that would be nicely trivial -- and I still don't know whether I'm the only user who expects Enter to trigger buttons.
author corvid <corvid@lavabit.com>
date Sun, 12 Jun 2011 16:48:45 +0000
parents ea7b25dcf495
children 8c0772fac825
files dw/fltkui.cc
diffstat 1 files changed, 2 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkui.cc	Sun Jun 12 15:49:32 2011 +0000
+++ b/dw/fltkui.cc	Sun Jun 12 16:48:45 2011 +0000
@@ -298,10 +298,7 @@
 void FltkLabelButtonResource::widgetCallback (Fl_Widget *widget,
                                               void *data)
 {
-   if ((widget->when () & FL_WHEN_RELEASE) &&
-       ((Fl::event_key() == FL_Enter) ||
-        (Fl::event_button() == FL_LEFT_MOUSE ||
-         Fl::event_button() == FL_MIDDLE_MOUSE))) {
+   if (!Fl::event_button3()) {
       FltkLabelButtonResource *lbr = (FltkLabelButtonResource*) data;
       dw::core::EventButton event;
       setButtonEvent(&event);
@@ -346,17 +343,12 @@
 {
    FltkComplexButtonResource *res = (FltkComplexButtonResource*)data;
 
-   if (widget->when() == FL_WHEN_RELEASE &&
-       ((Fl::event_key() == FL_Enter) ||
-        (Fl::event_button() == FL_LEFT_MOUSE ||
-         Fl::event_button() == FL_MIDDLE_MOUSE))) {
+   if (!Fl::event_button3()) {
       res->click_x = Fl::event_x();
       res->click_y = Fl::event_y();
       dw::core::EventButton event;
       setButtonEvent(&event);
       res->emitClicked(&event);
-   } else {
-      ((FltkViewBase*)res->flatView)->handle(Fl::event());
    }
 }