ecore-wl2: add ecore_wl2_window_popup_input_set()

this is a function for explicitly setting the seat which will be used
for popup grabs

@feature
This commit is contained in:
Mike Blumenkrantz 2017-05-17 16:02:53 -04:00
parent 2fe7878235
commit 7caf3b88ce
4 changed files with 22 additions and 17 deletions

View File

@ -1490,6 +1490,18 @@ EAPI void ecore_wl2_session_recovery_disable(void);
* @since 1.20
*/
EAPI Eina_Bool ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window);
/**
* @brief Set the seat for a popup window to be used with grab
* @param window The window
* @param input The seat
*
* Use this function for desktop shell requests involving popup grabs which require
* a seat for the grab.
*
* @since 1.20
*/
EAPI void ecore_wl2_window_popup_input_set(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input);
# endif
# undef EAPI

View File

@ -1567,7 +1567,7 @@ _ecore_wl2_input_del(Ecore_Wl2_Input *input)
eina_inlist_remove(display->inputs, EINA_INLIST_GET(input));
EINA_INLIST_FOREACH(display->windows, window)
if (window->input == input) window->input = NULL;
if (window->grab == input) window->grab = NULL;
eina_stringshare_replace(&input->name, NULL);
free(input);

View File

@ -140,6 +140,7 @@ struct _Ecore_Wl2_Window
Ecore_Wl2_Input *input;
Ecore_Wl2_Window *parent;
Ecore_Wl2_Input *grab;
int id, rotation, surface_id;
const char *title;

View File

@ -61,7 +61,7 @@ _xdg_popup_cb_done(void *data, struct xdg_popup *xdg_popup EINA_UNUSED)
win = data;
if (!win) return;
_ecore_wl2_input_ungrab(win->input);
if (win->grab) _ecore_wl2_input_ungrab(win->grab);
}
static const struct xdg_popup_listener _xdg_popup_listener =
@ -241,7 +241,7 @@ _zxdg_popup_cb_done(void *data, struct zxdg_popup_v6 *zxdg_popup EINA_UNUSED)
win = data;
if (!win) return;
_ecore_wl2_input_ungrab(win->input);
if (win->grab) _ecore_wl2_input_ungrab(win->grab);
}
static const struct zxdg_popup_v6_listener _zxdg_popup_listener =
@ -279,7 +279,7 @@ _ecore_wl2_window_zxdg_popup_create(Ecore_Wl2_Window *win)
}
zxdg_positioner_v6_destroy(pos);
zxdg_popup_v6_grab(win->zxdg_popup, win->input->wl.seat,
zxdg_popup_v6_grab(win->zxdg_popup, win->grab->wl.seat,
wl_display_get_serial(win->display->wl.display));
zxdg_popup_v6_set_user_data(win->zxdg_popup, win);
zxdg_popup_v6_add_listener(win->zxdg_popup, &_zxdg_popup_listener, win);
@ -296,16 +296,6 @@ _ecore_wl2_window_type_set(Ecore_Wl2_Window *win)
{
case ECORE_WL2_WINDOW_TYPE_MENU:
{
Ecore_Wl2_Input *input;
input = win->input;
if ((!input) && (win->parent))
{
input = win->parent->input;
}
if ((!input) || (!input->wl.seat)) return;
if (win->zxdg_surface)
_ecore_wl2_window_zxdg_popup_create(win);
else if (win->xdg_surface)
@ -313,7 +303,7 @@ _ecore_wl2_window_type_set(Ecore_Wl2_Window *win)
win->xdg_popup =
xdg_shell_get_xdg_popup(win->display->wl.xdg_shell,
win->surface, win->parent->surface,
input->wl.seat,
win->grab->wl.seat,
wl_display_get_serial(win->display->wl.display),
win->geometry.x, win->geometry.y);
if (!win->xdg_popup)
@ -1150,10 +1140,12 @@ ecore_wl2_window_type_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_Type type)
}
EAPI void
ecore_wl2_window_type_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_Type type)
ecore_wl2_window_popup_input_set(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
{
EINA_SAFETY_ON_NULL_RETURN(window);
window->type = type;
EINA_SAFETY_ON_NULL_RETURN(input);
EINA_SAFETY_ON_TRUE_RETURN(window->type != ECORE_WL2_WINDOW_TYPE_MENU);
window->grab = input;
}
EAPI Ecore_Wl2_Display *