add key_up and key_down methods to sreen interface
This patch adds new methods to the screen interface that we can use inside wl_drm to determine if a key event is eaten or not. This fixes an issue where VT-Switching would not work if an application was on the screen (E-Wayland). Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
454f66906f
commit
35febc367d
|
@ -70,6 +70,10 @@ typedef struct E_Comp_Screen_Iface
|
||||||
void (*apply)(void);
|
void (*apply)(void);
|
||||||
/* set dpms (on, standby, suspend, off) */
|
/* set dpms (on, standby, suspend, off) */
|
||||||
void (*dpms)(int);
|
void (*dpms)(int);
|
||||||
|
/* is key event eaten */
|
||||||
|
Eina_Bool (*key_down)(Ecore_Event_Key *ev);
|
||||||
|
/* is key event eaten */
|
||||||
|
Eina_Bool (*key_up)(Ecore_Event_Key *ev);
|
||||||
} E_Comp_Screen_Iface;
|
} E_Comp_Screen_Iface;
|
||||||
|
|
||||||
struct _E_Comp
|
struct _E_Comp
|
||||||
|
|
|
@ -118,11 +118,13 @@ _key_down(int ctx, Ecore_Event_Key *ev)
|
||||||
*/
|
*/
|
||||||
if ((!ec) || (ev->event_window != e_comp->ee_win)) return ECORE_CALLBACK_RENEW;
|
if ((!ec) || (ev->event_window != e_comp->ee_win)) return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
return !e_bindings_key_down_event_handle(ctx, E_OBJECT(e_comp), ev)
|
return ((!e_comp->screen) ||
|
||||||
|
(!e_comp->screen->key_down) || (!e_comp->screen->key_down(ev))) &&
|
||||||
|
!e_bindings_key_down_event_handle(ctx, E_OBJECT(e_comp), ev)
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
&& !e_comp_wl_key_down(ev)
|
&& !e_comp_wl_key_down(ev)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -142,11 +144,13 @@ _key_up(int ctx, Ecore_Event_Key *ev)
|
||||||
{
|
{
|
||||||
e_screensaver_notidle();
|
e_screensaver_notidle();
|
||||||
if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root)) return ECORE_CALLBACK_PASS_ON;
|
if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root)) return ECORE_CALLBACK_PASS_ON;
|
||||||
return !e_bindings_key_up_event_handle(ctx, E_OBJECT(e_comp), ev)
|
return ((!e_comp->screen) ||
|
||||||
|
(!e_comp->screen->key_up) || (!e_comp->screen->key_up(ev))) &&
|
||||||
|
!e_bindings_key_up_event_handle(ctx, E_OBJECT(e_comp), ev)
|
||||||
#ifdef HAVE_WAYLAND
|
#ifdef HAVE_WAYLAND
|
||||||
&& !e_comp_wl_key_up(ev)
|
&& !e_comp_wl_key_up(ev)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
|
|
@ -736,6 +736,41 @@ _drm2_dpms(int set)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_drm2_key_down(Ecore_Event_Key *ev)
|
||||||
|
{
|
||||||
|
int code;
|
||||||
|
|
||||||
|
code = (ev->keycode - 8);
|
||||||
|
|
||||||
|
if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
|
||||||
|
((ev->modifiers & ECORE_EVENT_MODIFIER_ALT) ||
|
||||||
|
(ev->modifiers & ECORE_EVENT_MODIFIER_ALTGR)) &&
|
||||||
|
(code >= KEY_F1) && (code <= KEY_F8))
|
||||||
|
{
|
||||||
|
Ecore_Drm2_Device *dev;
|
||||||
|
int vt;
|
||||||
|
|
||||||
|
vt = (code - KEY_F1 + 1);
|
||||||
|
|
||||||
|
dev = ecore_evas_data_get(e_comp->ee, "device");
|
||||||
|
if (dev)
|
||||||
|
{
|
||||||
|
ecore_drm2_device_vt_set(dev, vt);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_drm2_key_up(Ecore_Event_Key *ev)
|
||||||
|
{
|
||||||
|
(void)ev;
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_drm2_read_pixels(E_Comp_Wl_Output *output, void *pixels)
|
_drm2_read_pixels(E_Comp_Wl_Output *output, void *pixels)
|
||||||
{
|
{
|
||||||
|
@ -1143,6 +1178,8 @@ static E_Comp_Screen_Iface drmiface =
|
||||||
.create = _drm2_randr_create,
|
.create = _drm2_randr_create,
|
||||||
.apply = _drm2_randr_apply,
|
.apply = _drm2_randr_apply,
|
||||||
.dpms = _drm2_dpms,
|
.dpms = _drm2_dpms,
|
||||||
|
.key_down = _drm2_key_down,
|
||||||
|
.key_up = _drm2_key_up,
|
||||||
#else
|
#else
|
||||||
.create = _drm_randr_create,
|
.create = _drm_randr_create,
|
||||||
.apply = _drm_randr_apply,
|
.apply = _drm_randr_apply,
|
||||||
|
|
Loading…
Reference in New Issue