move grabinput focus fix timer to be X-only

This commit is contained in:
Mike Blumenkrantz 2015-01-22 15:29:23 -05:00
parent 5735f7a2e7
commit 5e5a533a6d
1 changed files with 10 additions and 8 deletions

View File

@ -1,7 +1,6 @@
#include "e.h" #include "e.h"
/* local subsystem functions */ /* local subsystem functions */
static Eina_Bool _e_grabinput_focus_check(void *data);
static void _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method); static void _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method);
static void _e_grabinput_focus(Ecore_Window win, E_Focus_Method method); static void _e_grabinput_focus(Ecore_Window win, E_Focus_Method method);
@ -13,7 +12,9 @@ static E_Focus_Method focus_method = E_FOCUS_METHOD_NO_INPUT;
static double last_focus_time = 0.0; static double last_focus_time = 0.0;
static Ecore_Window focus_fix_win = 0; static Ecore_Window focus_fix_win = 0;
#ifndef HAVE_WAYLAND_ONLY
static Ecore_Timer *focus_fix_timer = NULL; static Ecore_Timer *focus_fix_timer = NULL;
#endif
static E_Focus_Method focus_fix_method = E_FOCUS_METHOD_NO_INPUT; static E_Focus_Method focus_fix_method = E_FOCUS_METHOD_NO_INPUT;
/* externally accessible functions */ /* externally accessible functions */
@ -26,11 +27,9 @@ e_grabinput_init(void)
EINTERN int EINTERN int
e_grabinput_shutdown(void) e_grabinput_shutdown(void)
{ {
if (focus_fix_timer) #ifndef HAVE_WAYLAND_ONLY
{ E_FREE_FUNC(focus_fix_timer, ecore_timer_del);
ecore_timer_del(focus_fix_timer); #endif
focus_fix_timer = NULL;
}
return 1; return 1;
} }
@ -152,19 +151,19 @@ e_grabinput_key_win_get(void)
return grab_key_win; return grab_key_win;
} }
#ifndef HAVE_WAYLAND_ONLY
static Eina_Bool static Eina_Bool
_e_grabinput_focus_check(void *data __UNUSED__) _e_grabinput_focus_check(void *data __UNUSED__)
{ {
#ifndef HAVE_WAYLAND_ONLY
if (ecore_x_window_focus_get() != focus_fix_win) if (ecore_x_window_focus_get() != focus_fix_win)
{ {
/* fprintf(stderr, "foc do 2\n"); */ /* fprintf(stderr, "foc do 2\n"); */
_e_grabinput_focus_do(focus_fix_win, focus_fix_method); _e_grabinput_focus_do(focus_fix_win, focus_fix_method);
} }
#endif
focus_fix_timer = NULL; focus_fix_timer = NULL;
return EINA_FALSE; return EINA_FALSE;
} }
#endif
static void static void
_e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method) _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
@ -210,7 +209,10 @@ _e_grabinput_focus(Ecore_Window win, E_Focus_Method method)
/* fprintf(stderr, "foc do 1\n"); */ /* fprintf(stderr, "foc do 1\n"); */
_e_grabinput_focus_do(win, method); _e_grabinput_focus_do(win, method);
last_focus_time = ecore_loop_time_get(); last_focus_time = ecore_loop_time_get();
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return;
if (focus_fix_timer) ecore_timer_del(focus_fix_timer); if (focus_fix_timer) ecore_timer_del(focus_fix_timer);
focus_fix_timer = ecore_timer_add(0.2, _e_grabinput_focus_check, NULL); focus_fix_timer = ecore_timer_add(0.2, _e_grabinput_focus_check, NULL);
#endif
} }