add separate desklock key up handler to correctly handle caps lock on wayland
x11 modifier handling in events is broken: the modifier state is the state from before the event, meaning that pressing caps lock will never result in an event where the modifier is not set in the corresponding event wayland handles this more sensibly, though it should be detected on key up rather than key down fix T5737
This commit is contained in:
parent
a1e585862c
commit
91dc28967a
|
@ -152,6 +152,12 @@ static Eina_Bool
|
|||
_key_up(int ctx, Ecore_Event_Key *ev)
|
||||
{
|
||||
e_screensaver_notidle();
|
||||
if (e_desklock_state_get() && (ctx == E_BINDING_CONTEXT_MANAGER))
|
||||
{
|
||||
E_Desklock_Interface *iface = e_desklock_interface_current_get();
|
||||
if (iface && iface->key_up)
|
||||
return iface->key_up(ev);
|
||||
}
|
||||
if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root)) return ECORE_CALLBACK_PASS_ON;
|
||||
return ((!e_comp->screen) ||
|
||||
(!e_comp->screen->key_up) || (!e_comp->screen->key_up(ev))) &&
|
||||
|
|
|
@ -33,6 +33,7 @@ struct E_Desklock_Interface
|
|||
E_Desklock_Show_Cb show;
|
||||
E_Desklock_Hide_Cb hide;
|
||||
E_Desklock_Key_Cb key_down;
|
||||
E_Desklock_Key_Cb key_up;
|
||||
Eina_Bool active : 1; //interface is currently being used for locking
|
||||
};
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ static E_Desklock_Interface lokker_desklock_iface =
|
|||
.show = lokker_lock,
|
||||
.hide = lokker_unlock,
|
||||
.key_down = lokker_key_down,
|
||||
.key_up = lokker_key_up,
|
||||
};
|
||||
|
||||
E_API void *
|
||||
|
|
|
@ -28,4 +28,5 @@ EINTERN Eina_Bool lokker_lock(void);
|
|||
EINTERN void lokker_unlock(void);
|
||||
E_API E_Config_Dialog *e_int_config_lokker(Evas_Object *parent, const char *params EINA_UNUSED);
|
||||
EINTERN Eina_Bool lokker_key_down(Ecore_Event_Key*);
|
||||
EINTERN Eina_Bool lokker_key_up(Ecore_Event_Key*);
|
||||
#endif
|
||||
|
|
|
@ -723,17 +723,34 @@ _lokker_check_auth(void)
|
|||
}
|
||||
|
||||
EINTERN Eina_Bool
|
||||
lokker_key_down(Ecore_Event_Key *ev)
|
||||
lokker_key_up(Ecore_Event_Key *ev)
|
||||
{
|
||||
if (e_comp->comp_type == E_PIXMAP_TYPE_X) return ECORE_CALLBACK_DONE;
|
||||
if (!strcmp(ev->key, "Caps_Lock"))
|
||||
{
|
||||
if(ev->modifiers & ECORE_EVENT_LOCK_CAPS)
|
||||
_lokker_caps_hint_update("");
|
||||
else
|
||||
if ((ev->modifiers & ECORE_EVENT_LOCK_CAPS) == ECORE_EVENT_LOCK_CAPS)
|
||||
_lokker_caps_hint_update(_("Caps Lock is On"));
|
||||
else
|
||||
_lokker_caps_hint_update("");
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
||||
EINTERN Eina_Bool
|
||||
lokker_key_down(Ecore_Event_Key *ev)
|
||||
{
|
||||
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
||||
{
|
||||
if (!strcmp(ev->key, "Caps_Lock"))
|
||||
{
|
||||
if(ev->modifiers & ECORE_EVENT_LOCK_CAPS)
|
||||
_lokker_caps_hint_update("");
|
||||
else
|
||||
_lokker_caps_hint_update(_("Caps Lock is On"));
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
}
|
||||
if (edd->state == LOKKER_STATE_CHECKING) return ECORE_CALLBACK_DONE;
|
||||
|
||||
if (!strcmp(ev->key, "Escape"))
|
||||
|
|
Loading…
Reference in New Issue