From 816ca3b8fb7ab1d8a3bb333c9546d9441a7a2fb7 Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Thu, 10 Feb 2011 22:16:07 +0000 Subject: [PATCH] Delay sending focus This results in less flickering when we get a storm of in/out events SVN revision: 56939 --- src/bin/e_grabinput.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/bin/e_grabinput.c b/src/bin/e_grabinput.c index 385f249ed..3bd75e138 100644 --- a/src/bin/e_grabinput.c +++ b/src/bin/e_grabinput.c @@ -1,6 +1,7 @@ #include "e.h" /* local subsystem functions */ +static void _e_grabinput_focus_job(void *data); static void _e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method); /* local subsystem globals */ @@ -8,6 +9,9 @@ static Ecore_X_Window grab_mouse_win = 0; static Ecore_X_Window grab_key_win = 0; static Ecore_X_Window focus_win = 0; static E_Focus_Method focus_method = E_FOCUS_METHOD_NO_INPUT; +static Ecore_X_Window do_focus_win = 0; +static E_Focus_Method do_focus_method = E_FOCUS_METHOD_NO_INPUT; +static Ecore_Job *focus_job = NULL; static double last_focus_time = 0.0; /* externally accessible functions */ @@ -98,7 +102,11 @@ e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method) } else { - _e_grabinput_focus(win, method); + do_focus_win = win; + do_focus_method = method; + if (!focus_job) + focus_job = ecore_job_add(_e_grabinput_focus_job, NULL); + //_e_grabinput_focus(win, method); } } @@ -109,6 +117,14 @@ e_grabinput_last_focus_time_get(void) } /* local subsystem functions */ +static void +_e_grabinput_focus_job(void *data __UNUSED__) +{ + focus_job = NULL; + _e_grabinput_focus(do_focus_win, do_focus_method); + do_focus_win = 0; +} + static void _e_grabinput_focus(Ecore_X_Window win, E_Focus_Method method) {