- // XXX: run the CLICK guile hook
- printf("GUILE: CLICK: win %lx modifiers %ux button %ud time %lx",
- (long)win, modifiers, button, time);
+ // find the area of the window
+ XWindowAttributes attr;
+ if (!XGetWindowAttributes(otk::OBDisplay::display, e.window, &attr)) return;
+
+ // if not on the window any more, it isnt a CLICK
+ if (!(e.same_screen && e.x >= 0 && e.y >= 0 &&
+ e.x < attr.width && e.y < attr.height))
+ return;
+
+ // run the CLICK guile hook
+ python_callback(Action_Click, e.window,
+ (OBWidget::WidgetType)(w ? w->type():-1),
+ e.state, e.button, e.time);
+
+ if (e.time - _release.time < DOUBLECLICKDELAY &&
+ _release.win == e.window && _release.button == e.button) {
+
+ // run the DOUBLECLICK guile hook
+ python_callback(Action_DoubleClick, e.window,
+ (OBWidget::WidgetType)(w ? w->type():-1),
+ e.state, e.button, e.time);
+
+ // reset so you cant triple click for 2 doubleclicks
+ _release.win = 0;
+ _release.button = 0;
+ _release.time = 0;
+ } else {
+ // save the button release, might be part of a double click
+ _release.win = e.window;
+ _release.button = e.button;
+ _release.time = e.time;
+ }
+}