X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=71dca5f7da3dc702b0c3507b840c1ac1c42320c3;hb=064901801e8ceb7b07dbd0d27b4fecd600f7c766;hp=bb138d3dca77815f0766410e492776f7bf4be2fb;hpb=568744d572c68c164492096f2fbe2ea3ae291170;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index bb138d3d..71dca5f7 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -73,17 +73,17 @@ static gboolean menu_hide_delay_func(gpointer data); Time event_lasttime = 0; /*! The value of the mask for the NumLock modifier */ -unsigned int NumLockMask; +guint NumLockMask; /*! The value of the mask for the ScrollLock modifier */ -unsigned int ScrollLockMask; +guint ScrollLockMask; /*! The key codes for the modifier keys */ static XModifierKeymap *modmap; /*! Table of the constant modifier masks */ -static const int mask_table[] = { +static const gint mask_table[] = { ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; -static int mask_table_size; +static gint mask_table_size; static guint ignore_enter_focus = 0; @@ -92,7 +92,7 @@ static gboolean menu_can_hide; static ObClient *focus_in, *focus_out; #ifdef USE_SM -static void ice_handler(int fd, gpointer conn) +static void ice_handler(gint fd, gpointer conn) { Bool b; IceProcessMessages(conn, NULL, &b); @@ -249,7 +249,7 @@ static void event_set_lasttime(XEvent *e) static void event_hack_mods(XEvent *e) { KeyCode *kp; - int i, k; + gint i, k; switch (e->type) { case ButtonPress: @@ -344,24 +344,32 @@ static void event_done(gpointer data) frame_adjust_focus(focus_in->frame, TRUE); client_calc_layer(focus_in); } + + focus_hilite = focus_in; } if (focus_out) { if (focus_out == focus_client) focus_set_client(NULL); frame_adjust_focus(focus_out->frame, FALSE); client_calc_layer(focus_out); - } - focus_hilite = focus_in; + if (!focus_in) + focus_hilite = NULL; + } if (focus_client != last) { if (!focus_client) { Window w; - int r; + gint r; /* is focus anywhere valid? */ XGetInputFocus(ob_display, &w, &r); - if (!w || w == RootWindow(ob_display, ob_screen)) + +#ifdef DEBUG_FOCUS + ob_debug("Focus was found on 0x%x revert %d\n", w, r); +#endif + + if (!w || w == PointerRoot) focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); } last = focus_client; @@ -495,11 +503,11 @@ static void event_handle_root(XEvent *e) msgtype = e->xclient.message_type; if (msgtype == prop_atoms.net_current_desktop) { - unsigned int d = e->xclient.data.l[0]; + guint d = e->xclient.data.l[0]; if (d < screen_num_desktops) screen_set_desktop(d); } else if (msgtype == prop_atoms.net_number_of_desktops) { - unsigned int d = e->xclient.data.l[0]; + guint d = e->xclient.data.l[0]; if (d > 0) screen_set_num_desktops(d); } else if (msgtype == prop_atoms.net_showing_desktop) { @@ -558,7 +566,7 @@ static void event_handle_client(ObClient *client, XEvent *e) { XEvent ce; Atom msgtype; - int i=0; + gint i=0; ObFrameContext con; switch (e->type) { @@ -615,7 +623,8 @@ static void event_handle_client(ObClient *client, XEvent *e) e->xfocus.window, client->window, e->xfocus.mode, e->xfocus.detail); #endif - focus_out = client; + if (focus_hilite == client || focus_client == client) + focus_out = client; if (focus_in == client) focus_in = NULL; break; @@ -742,7 +751,7 @@ static void event_handle_client(ObClient *client, XEvent *e) if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight | CWX | CWY | CWBorderWidth)) { - int x, y, w, h; + gint x, y, w, h; ObCorner corner; if (e->xconfigurerequest.value_mask & CWBorderWidth) @@ -758,12 +767,12 @@ static void event_handle_client(ObClient *client, XEvent *e) e->xconfigurerequest.height : client->area.height; { - int newx = x; - int newy = y; - int fw = w + - client->frame->size.left + client->frame->size.right; - int fh = h + - client->frame->size.top + client->frame->size.bottom; + gint newx = x; + gint newy = y; + gint fw = w + + client->frame->size.left + client->frame->size.right; + gint fh = h + + client->frame->size.top + client->frame->size.bottom; client_find_onscreen(client, &newx, &newy, fw, fh, client_normal(client)); if (e->xconfigurerequest.value_mask & CWX) @@ -837,7 +846,10 @@ static void event_handle_client(ObClient *client, XEvent *e) case MapRequest: ob_debug("MapRequest for 0x%lx\n", client->window); if (!client->iconic) break; /* this normally doesn't happen, but if it - does, we don't want it! */ + does, we don't want it! + it can happen now when the window is on + another desktop, but we still don't + want it! */ client_activate(client, FALSE); break; case ClientMessage: @@ -926,8 +938,8 @@ static void event_handle_client(ObClient *client, XEvent *e) e->xclient.data.l[2]); } } else if (msgtype == prop_atoms.net_moveresize_window) { - int oldg = client->gravity; - int tmpg, x, y, w, h; + gint oldg = client->gravity; + gint tmpg, x, y, w, h; if (e->xclient.data.l[0] & 0xff) tmpg = e->xclient.data.l[0] & 0xff; @@ -953,12 +965,12 @@ static void event_handle_client(ObClient *client, XEvent *e) client->gravity = tmpg; { - int newx = x; - int newy = y; - int fw = w + - client->frame->size.left + client->frame->size.right; - int fh = h + - client->frame->size.top + client->frame->size.bottom; + gint newx = x; + gint newy = y; + gint fw = w + + client->frame->size.left + client->frame->size.right; + gint fh = h + + client->frame->size.top + client->frame->size.bottom; client_find_onscreen(client, &newx, &newy, fw, fh, client_normal(client)); if (e->xclient.data.l[0] & 1 << 8)