From eea1a9fef91686a511ae0a8590dbb6df02c26470 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 4 Oct 2011 17:53:54 -0400 Subject: Fix focus stealing for changing desktops/Use timestamp for user input events Change the logic for when to allow stealing focus across desktops. - It was possible to call event_time_after() with a CurrentTime in the old code. - It would disallow a user requested change which is crazy. - It would change desktops on you when a new window appeared but this is generally not desirable. event_source_time() is supposed to give the time which the user made things happen. we leave it at 0 for user-input events right now which means stuff like changing desktop doesn't save any timestamp at all. we should use the timestamp from x for user-generated events. --- openbox/event.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openbox/event.c') diff --git a/openbox/event.c b/openbox/event.c index 2dde1329..ba156da6 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -700,6 +700,8 @@ static void event_process(const XEvent *ec, gpointer data) static guint pressed = 0; static Window pressed_win = None; + event_sourcetime = event_curtime; + /* If the button press was on some non-root window, or was physically on the root window... */ if (window != obt_root(ob_screen) || @@ -726,6 +728,8 @@ static void event_process(const XEvent *ec, gpointer data) else if (e->type == KeyPress || e->type == KeyRelease || e->type == MotionNotify) { + event_sourcetime = event_curtime; + used = event_handle_user_input(client, e); if (prompt && !used) -- cgit v1.2.3