}
}
+/* Create a button event */
+XButtonEvent create_button_event(Display *display, Window win,
+ Window win_root, int pressed, int x, int y, int modifiers)
+{
+ XButtonEvent event;
+
+ event.display = display;
+ event.window = win;
+ event.root = win_root;
+ event.subwindow = None;
+ event.time = CurrentTime;
+ event.x = 1;
+ event.y = 1;
+ event.x_root = x;
+ event.y_root = y;
+ event.same_screen = True;
+ event.state = modifiers;
+ event.button = Button3;
+
+ if (pressed)
+ event.type = ButtonPress;
+ else
+ event.type = ButtonRelease;
+
+ return event;
+}
+
/* Processing of X events */
void ProcessXlibEvents(void)
{
* If no other button 1 events are received after the
* delay, then it is a single-click mouse event.
*/
+
+ printf("SingleClickCallback TEST()\n");
+
if (SingleClickCallback != NULL)
(*SingleClickCallback)();
* other tasks when no events are available.
*/
(void) XNextEvent(dockapp.display, &Event);
+
+ if (((Event.type == ButtonPress) || (Event.type == ButtonRelease)) &&
+ (Event.xbutton.button == Button3)) {
+ Status status;
+ XButtonEvent event;
+ XButtonEvent *ev;
+ Window parent;
+ Window root;
+ Window *children;
+ unsigned int nchildren;
+
+ ev = (XButtonEvent *)&Event;
+
+ XQueryTree(dockapp.display, dockapp.win, &root, &parent,
+ &children, &nchildren);
+
+ printf("Resend event to parent window\n");
+ printf(" Children = %d\n", nchildren);
+ printf(" X root = %d\n", ev->x_root);
+ printf(" X = %d\n", ev->x);
+
+ event = create_button_event(dockapp.display,
+ dockapp.win,
+ dockapp.root_win,
+ true,
+ ev->x_root, ev->y_root,
+ ButtonPressMask);
+
+ status = XSendEvent(event.display,
+ event.window,
+ true, ButtonPressMask,
+ (XEvent *)&event);
+ if (status == 0) {
+ char buf[256];
+
+ XGetErrorText(dockapp.display, status, buf,
+ sizeof(buf));
+ printf("Error: %s\n", buf);
+ }
+ }
+
switch (Event.type) {
case Expose:
/* Window was uncovered... */
/* Mouse LEFT button pressed. */
button1_pressed = true;
}
+ else if (Event.xbutton.button == Button2) {
+ printf("BOZO BOZO BUTTON2 BOZO BOZO\n");
+ }
break;
case ButtonRelease:
if (Event.xbutton.button == Button1) {