X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=97f01fb6f3d305424c055a21c196ac75d022761c;hb=c90da6da781932c2d178bfb7e39ec1d5003543b7;hp=a7ed67fdab9664cddc32e8973e0b19666f3b0396;hpb=1aa0bc66eb45ba466d1d071d0e6c13631331e091;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index a7ed67fd..97f01fb6 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -8,6 +8,8 @@ #include "screen.h" #include "frame.h" #include "menu.h" +#include "keyboard.h" +#include "mouse.h" #include "framerender.h" #include "focus.h" #include "moveresize.h" @@ -223,32 +225,38 @@ static Window event_get_window(XEvent *e) static void event_set_lasttime(XEvent *e) { + Time t = 0; + /* grab the lasttime and hack up the state */ switch (e->type) { case ButtonPress: case ButtonRelease: - event_lasttime = e->xbutton.time; + t = e->xbutton.time; break; case KeyPress: - event_lasttime = e->xkey.time; + t = e->xkey.time; break; case KeyRelease: - event_lasttime = e->xkey.time; + t = e->xkey.time; break; case MotionNotify: - event_lasttime = e->xmotion.time; + t = e->xmotion.time; break; case PropertyNotify: - event_lasttime = e->xproperty.time; + t = e->xproperty.time; break; case EnterNotify: case LeaveNotify: - event_lasttime = e->xcrossing.time; + t = e->xcrossing.time; break; default: - event_lasttime = CurrentTime; + /* if more event types are anticipated, get their timestamp + explicitly */ break; } + + if (t > event_lasttime) + event_lasttime = t; } #define STRIP_MODS(s) \ @@ -535,13 +543,23 @@ static void event_process(XEvent *e) } /* user input (action-bound) events */ - /* if (e->type == ButtonPress || e->type == ButtonRelease || - e->type == MotionNotify) - mouse_event(e, client); - else if (e->type == KeyPress || e->type == KeyRelease) - ; - */ + e->type == MotionNotify || e->type == KeyPress || + e->type == KeyRelease) + { + ObFrameContext context; + + context = frame_context(client, e->xany.window); + + if (!keyboard_process_interactive_grab(e, &client, &context)) { + + if (e->type == ButtonPress || e->type == ButtonRelease || + e->type == MotionNotify) + mouse_event(client, context, e); + else if (e->type == KeyPress) + keyboard_event(client, e); + } + } /* dispatch the event to registered handlers */ dispatch_x(e, client); @@ -780,7 +798,11 @@ static void event_handle_client(ObClient *client, XEvent *e) { int newx = x; int newy = y; - client_find_onscreen(client, &newx, &newy, w, h, TRUE); + int fw = w + + client->frame->size.left + client->frame->size.right; + int fh = h + + client->frame->size.top + client->frame->size.bottom; + client_find_onscreen(client, &newx, &newy, fw, fh, TRUE); if (e->xconfigurerequest.value_mask & CWX) x = newx; if (e->xconfigurerequest.value_mask & CWY) @@ -979,7 +1001,11 @@ static void event_handle_client(ObClient *client, XEvent *e) { int newx = x; int newy = y; - client_find_onscreen(client, &newx, &newy, w, h, TRUE); + int fw = w + + client->frame->size.left + client->frame->size.right; + int fh = h + + client->frame->size.top + client->frame->size.bottom; + client_find_onscreen(client, &newx, &newy, fw, fh, TRUE); if (e->xclient.data.l[0] & 1 << 8) x = newx; if (e->xclient.data.l[0] & 1 << 9) @@ -1136,7 +1162,7 @@ static void find_max_fd() (gpointer)&tmpmax); max_fd = MAX(x_fd, tmpmax); #ifdef USE_SM - max_fd = MAX(ice_fd, tmpmax); + max_fd = MAX(ice_fd, max_fd); #endif }