start making e_grabinput work for wayland (nb: not finished yet)

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-01-29 09:54:43 -05:00
parent b42e70c73a
commit a889f55c34
1 changed files with 50 additions and 5 deletions

View File

@ -41,6 +41,9 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
ecore_x_pointer_ungrab();
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
#endif
grab_mouse_win = 0;
}
@ -49,7 +52,11 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
ecore_x_keyboard_ungrab();
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
#endif
grab_key_win = 0;
focus_win = 0;
}
@ -65,6 +72,14 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
ret = ecore_x_pointer_grab(mouse_win);
if (!ret) return 0;
}
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
Ecore_Wl_Window *wl_win;
if ((wl_win = ecore_wl_window_find(mouse_win)))
ecore_wl_input_grab(ecore_wl_input_get(), mouse_win, 0);
}
#endif
grab_mouse_win = mouse_win;
}
@ -86,6 +101,14 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
return 0;
}
}
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
Ecore_Wl_Window *wl_win;
if ((wl_win = ecore_wl_window_find(key_win)))
ecore_wl_input_grab(ecore_wl_input_get(), key_win, 0);
}
#endif
grab_key_win = key_win;
}
@ -103,7 +126,11 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
ecore_x_pointer_ungrab();
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
#endif
grab_mouse_win = 0;
}
if (key_win == grab_key_win)
@ -111,7 +138,11 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
ecore_x_keyboard_ungrab();
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
#endif
grab_key_win = 0;
if (focus_win != 0)
{
@ -126,7 +157,6 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win)
EAPI void
e_grabinput_focus(Ecore_Window win, E_Focus_Method method)
{
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return;
if (grab_key_win != 0)
{
/* fprintf(stderr, "while grabbed focus changed to %x\n", win); */
@ -175,6 +205,10 @@ _e_grabinput_focus_check(void *data __UNUSED__)
static void
_e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
{
#ifdef HAVE_WAYLAND_ONLY
Ecore_Wl_Window *wl_win;
#endif
/* fprintf(stderr, "focus to %x method %i\n", win, method); */
switch (method)
{
@ -185,27 +219,39 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
#ifndef HAVE_WAYLAND_ONLY
ecore_x_window_focus_at_time(win, ecore_x_current_time_get());
ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get());
#else
if ((wl_win = ecore_wl_window_find(key_win)))
{
/* FIXME: Need to add an ecore_wl_window_focus function */
}
#endif
break;
case E_FOCUS_METHOD_GLOBALLY_ACTIVE:
#ifndef HAVE_WAYLAND_ONLY
ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get());
#else
if ((wl_win = ecore_wl_window_find(key_win)))
{
/* FIXME: Need to add an ecore_wl_window_focus function */
}
#endif
break;
case E_FOCUS_METHOD_PASSIVE:
#ifndef HAVE_WAYLAND_ONLY
ecore_x_window_focus_at_time(win, ecore_x_current_time_get());
#else
if ((wl_win = ecore_wl_window_find(key_win)))
{
/* FIXME: Need to add an ecore_wl_window_focus function */
}
#endif
break;
default:
break;
}
#ifdef HAVE_WAYLAND_ONLY
(void)win;
#endif
}
static void
@ -222,4 +268,3 @@ _e_grabinput_focus(Ecore_Window win, E_Focus_Method method)
focus_fix_timer = ecore_timer_add(0.2, _e_grabinput_focus_check, NULL);
#endif
}