1 // -*- mode: C++; indent-tabs-mode: nil; -*-
4 # include "../config.h"
13 const unsigned int OBActions::DOUBLECLICKDELAY = 300;
15 OBActions::OBActions()
16 : _button(0), _enter_win(0)
19 // XXX: load a configuration out of somewhere
24 OBActions::~OBActions()
29 void OBActions::buttonPressHandler(const XButtonEvent &e)
31 // XXX: run the PRESS guile hook
32 printf("GUILE: PRESS: win %lx modifiers %u button %u time %lx\n",
33 (long)e.window, e.state, e.button, e.time);
35 if (_button) return; // won't count toward CLICK events
41 void OBActions::buttonReleaseHandler(const XButtonEvent &e)
43 // XXX: run the RELEASE guile hook
44 printf("GUILE: RELEASE: win %lx modifiers %u button %u time %lx\n",
45 (long)e.window, e.state, e.button, e.time);
47 // not for the button we're watching?
48 if (_button != e.button) return;
52 // find the area of the window
53 XWindowAttributes attr;
54 if (!XGetWindowAttributes(otk::OBDisplay::display, e.window, &attr)) return;
56 // if not on the window any more, it isnt a CLICK
57 if (!(e.same_screen && e.x >= 0 && e.y >= 0 &&
58 e.x < attr.width && e.y < attr.height))
61 // XXX: run the CLICK guile hook
62 printf("GUILE: CLICK: win %lx modifiers %u button %u time %lx\n",
63 (long)e.window, e.state, e.button, e.time);
65 if (e.time - _release.time < DOUBLECLICKDELAY &&
66 _release.win == e.window && _release.button == e.button) {
68 // XXX: run the DOUBLECLICK guile hook
69 printf("GUILE: DOUBLECLICK: win %lx modifiers %u button %u time %lx\n",
70 (long)e.window, e.state, e.button, e.time);
72 // reset so you cant triple click for 2 doubleclicks
77 // save the button release, might be part of a double click
78 _release.win = e.window;
79 _release.button = e.button;
80 _release.time = e.time;
85 void OBActions::enter(Window win, unsigned int modifiers)
90 // XXX: run the ENTER guile hook
91 printf("GUILE: ENTER: win %lx modifiers %u\n", (long)win, modifiers);
96 void OBActions::leave(unsigned int modifiers)
99 // XXX: run the LEAVE guile hook
100 printf("GUILE: LEAVE: win %lx modifiers %u\n", (long)_enter_win, modifiers);
106 void OBActions::drag(Window win, otk::Point delta, unsigned int modifiers,
107 unsigned int button, Time time)
109 (void)win;(void)delta;(void)modifiers;(void)button;(void)time;
111 // XXX: some guile shit...
115 void OBActions::key(Window win, unsigned int modifiers, unsigned int keycode)
117 (void)win;(void)modifiers;(void)keycode;
119 // XXX: some guile shit...