X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=9faf9403e6f4a6d328e6f056377eb9cebb8636f1;hb=9d6e3907650f4bc05ebf147aeec92573d7b88758;hp=2c13ceda2617088903d5829987d0f4355e90f299;hpb=4d50b21835d7dd00ecc40efd64c5573d7e048500;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 2c13ceda..9faf9403 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -86,7 +86,12 @@ static gboolean menu_hide_delay_func(gpointer data); (e)->xfocus.detail == NotifyAncestor || \ (e)->xfocus.detail > NotifyNonlinearVirtual) -Time event_lasttime = 0; +/* The most recent time at which an event with a timestamp occured. */ +static Time event_lasttime = 0; +/* The time for the current event being processed + (it's the event_lasttime for events without times, if this is a bug then + use CurrentTime instead, but it seems ok) */ +Time event_curtime = CurrentTime; /*! The value of the mask for the NumLock modifier */ guint NumLockMask; @@ -251,8 +256,14 @@ static void event_set_lasttime(XEvent *e) break; } - if (t > event_lasttime) + if (t > event_lasttime) { event_lasttime = t; + event_curtime = event_lasttime; + } else if (t == 0) { + event_curtime = event_lasttime; + } else { + event_curtime = t; + } } #define STRIP_MODS(s) \ @@ -568,7 +579,7 @@ static void event_handle_root(XEvent *e) switch(e->type) { case SelectionClear: ob_debug("Another WM has requested to replace us. Exiting.\n"); - ob_exit(0); + ob_exit_replace(); break; case ClientMessage: @@ -585,6 +596,11 @@ static void event_handle_root(XEvent *e) screen_set_num_desktops(d); } else if (msgtype == prop_atoms.net_showing_desktop) { screen_show_desktop(e->xclient.data.l[0] != 0); + } else if (msgtype == prop_atoms.ob_control) { + if (e->xclient.data.l[0] == 1) + ob_reconfigure(); + else if (e->xclient.data.l[0] == 2) + ob_restart(); } break; case PropertyNotify: @@ -842,8 +858,13 @@ static void event_handle_client(ObClient *client, XEvent *e) client->frame->size.left + client->frame->size.right; gint fh = h + client->frame->size.top + client->frame->size.bottom; + /* make this rude for size-only changes but not for position + changes.. */ + gboolean moving = ((e->xconfigurerequest.value_mask & CWX) || + (e->xconfigurerequest.value_mask & CWY)); + client_find_onscreen(client, &newx, &newy, fw, fh, - client_normal(client)); + !moving); if (e->xconfigurerequest.value_mask & CWX) x = newx; if (e->xconfigurerequest.value_mask & CWY) @@ -919,7 +940,7 @@ static void event_handle_client(ObClient *client, XEvent *e) it can happen now when the window is on another desktop, but we still don't want it! */ - client_activate(client, FALSE); + client_activate(client, FALSE, TRUE); break; case ClientMessage: /* validate cuz we query stuff off the client here */ @@ -973,8 +994,15 @@ static void event_handle_client(ObClient *client, XEvent *e) ob_debug("net_close_window for 0x%lx\n", client->window); client_close(client); } else if (msgtype == prop_atoms.net_active_window) { - ob_debug("net_active_window for 0x%lx\n", client->window); - client_activate(client, FALSE); + ob_debug("net_active_window for 0x%lx source=%s\n", + client->window, + (e->xclient.data.l[0] == 0 ? "unknown" : + (e->xclient.data.l[0] == 1 ? "application" : + (e->xclient.data.l[0] == 2 ? "user" : "INVALID")))); + /* XXX make use of data.l[1] and [2] ! */ + client_activate(client, FALSE, + (e->xclient.data.l[0] == 0 || + e->xclient.data.l[0] == 2)); } else if (msgtype == prop_atoms.net_wm_moveresize) { ob_debug("net_wm_moveresize for 0x%lx\n", client->window); if ((Atom)e->xclient.data.l[2] == @@ -1082,11 +1110,8 @@ static void event_handle_client(ObClient *client, XEvent *e) b == prop_atoms.wm_icon_name)) { continue; } - if ((a == prop_atoms.net_wm_icon || - a == prop_atoms.kwm_win_icon) - && - (b == prop_atoms.net_wm_icon || - b == prop_atoms.kwm_win_icon)) + if (a == prop_atoms.net_wm_icon && + b == prop_atoms.net_wm_icon) continue; XPutBackEvent(ob_display, &ce); @@ -1120,10 +1145,12 @@ static void event_handle_client(ObClient *client, XEvent *e) else if (msgtype == prop_atoms.net_wm_strut) { client_update_strut(client); } - else if (msgtype == prop_atoms.net_wm_icon || - msgtype == prop_atoms.kwm_win_icon) { + else if (msgtype == prop_atoms.net_wm_icon) { client_update_icons(client); } + else if (msgtype == prop_atoms.net_wm_user_time) { + client_update_user_time(client, TRUE); + } else if (msgtype == prop_atoms.sm_client_id) { client_update_sm_client_id(client); } @@ -1287,7 +1314,8 @@ static gboolean focus_delay_func(gpointer data) static void focus_delay_client_dest(ObClient *client, gpointer data) { - ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, client, TRUE); + ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, + client, TRUE); } static void event_client_dest(ObClient *client, gpointer data)