]>
Dogcows Code - chaz/openbox/blob - src/actions.cc
3f2e79f887970c624b4226d8f11965db818ba364
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
4 # include "../config.h"
13 const unsigned int OBActions::DOUBLECLICKDELAY
= 300;
15 OBActions::OBActions()
19 // XXX: load a configuration out of somewhere
24 OBActions::~OBActions()
29 void OBActions::buttonPressHandler(const XButtonEvent
&e
)
31 OtkEventHandler::buttonPressHandler(e
);
33 // XXX: run the PRESS guile hook
34 printf("GUILE: PRESS: win %lx modifiers %u button %u time %lx\n",
35 (long)e
.window
, e
.state
, e
.button
, e
.time
);
37 if (_button
) return; // won't count toward CLICK events
43 void OBActions::buttonReleaseHandler(const XButtonEvent
&e
)
45 OtkEventHandler::buttonReleaseHandler(e
);
47 // XXX: run the RELEASE guile hook
48 printf("GUILE: RELEASE: win %lx modifiers %u button %u time %lx\n",
49 (long)e
.window
, e
.state
, e
.button
, e
.time
);
51 // not for the button we're watching?
52 if (_button
!= e
.button
) return;
56 // find the area of the window
57 XWindowAttributes attr
;
58 if (!XGetWindowAttributes(otk::OBDisplay::display
, e
.window
, &attr
)) return;
60 // if not on the window any more, it isnt a CLICK
61 if (!(e
.same_screen
&& e
.x
>= 0 && e
.y
>= 0 &&
62 e
.x
< attr
.width
&& e
.y
< attr
.height
))
65 // XXX: run the CLICK guile hook
66 printf("GUILE: CLICK: win %lx modifiers %u button %u time %lx\n",
67 (long)e
.window
, e
.state
, e
.button
, e
.time
);
69 if (e
.time
- _release
.time
< DOUBLECLICKDELAY
&&
70 _release
.win
== e
.window
&& _release
.button
== e
.button
) {
72 // XXX: run the DOUBLECLICK guile hook
73 printf("GUILE: DOUBLECLICK: win %lx modifiers %u button %u time %lx\n",
74 (long)e
.window
, e
.state
, e
.button
, e
.time
);
76 // reset so you cant triple click for 2 doubleclicks
81 // save the button release, might be part of a double click
82 _release
.win
= e
.window
;
83 _release
.button
= e
.button
;
84 _release
.time
= e
.time
;
89 void OBActions::enterHandler(const XCrossingEvent
&e
)
91 OtkEventHandler::enterHandler(e
);
93 // XXX: run the ENTER guile hook
94 printf("GUILE: ENTER: win %lx modifiers %u\n", (long)e
.window
, e
.state
);
98 void OBActions::leaveHandler(const XCrossingEvent
&e
)
100 OtkEventHandler::leaveHandler(e
);
102 // XXX: run the LEAVE guile hook
103 printf("GUILE: LEAVE: win %lx modifiers %u\n", (long)e
.window
, e
.state
);
107 void OBActions::keyPressHandler(const XKeyEvent
&e
)
109 // XXX: run the KEY guile hook
110 printf("GUILE: KEY: win %lx modifiers %u keycode %u\n",
111 (long)e
.window
, e
.state
, e
.keycode
);
115 void OBActions::motionHandler(const XMotionEvent
&e
)
117 // XXX: i can envision all sorts of crazy shit with this.. gestures, etc
118 printf("GUILE: MOTION: win %lx modifiers %u x %d y %d\n",
119 (long)e
.window
, e
.state
, e
.x
, e
.y
);
This page took 0.040084 seconds and 4 git commands to generate.