forked from enlightenment/enlightenment
add desklock interface handler for key press
key presses during desklock should only be received by the lock implementation and not by any other handler. this ensures that nothing unexpected can happen with focus and simplifies overall key handling
This commit is contained in:
parent
ac2c9a220f
commit
203507fa22
|
@ -106,6 +106,12 @@ static Eina_Bool
|
|||
_key_down(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_down)
|
||||
return iface->key_down(ev);
|
||||
}
|
||||
if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (ev->event_window != e_comp->root))
|
||||
{
|
||||
E_Client *ec;
|
||||
|
|
|
@ -147,6 +147,12 @@ e_desklock_interface_append(E_Desklock_Interface *iface)
|
|||
}
|
||||
}
|
||||
|
||||
EINTERN E_Desklock_Interface *
|
||||
e_desklock_interface_current_get(void)
|
||||
{
|
||||
return current_iface;
|
||||
}
|
||||
|
||||
E_API void
|
||||
e_desklock_interface_remove(E_Desklock_Interface *iface)
|
||||
{
|
||||
|
|
|
@ -25,11 +25,14 @@ typedef struct E_Desklock_Interface E_Desklock_Interface;
|
|||
#ifndef E_DESKLOCK_H
|
||||
#define E_DESKLOCK_H
|
||||
|
||||
typedef Eina_Bool (*E_Desklock_Key_Cb)(Ecore_Event_Key*);
|
||||
|
||||
struct E_Desklock_Interface
|
||||
{
|
||||
const char *name;
|
||||
E_Desklock_Show_Cb show;
|
||||
E_Desklock_Hide_Cb hide;
|
||||
E_Desklock_Key_Cb key_down;
|
||||
Eina_Bool active : 1; //interface is currently being used for locking
|
||||
};
|
||||
|
||||
|
@ -50,6 +53,7 @@ E_API Eina_Bool e_desklock_state_get(void);
|
|||
|
||||
E_API void e_desklock_interface_append(E_Desklock_Interface *iface);
|
||||
E_API void e_desklock_interface_remove(E_Desklock_Interface *iface);
|
||||
EINTERN E_Desklock_Interface *e_desklock_interface_current_get(void);
|
||||
E_API Eina_Stringshare *e_desklock_user_wallpaper_get(E_Zone *zone);
|
||||
E_API void e_desklock_show_hook_add(E_Desklock_Show_Cb cb);
|
||||
E_API void e_desklock_show_hook_del(E_Desklock_Show_Cb cb);
|
||||
|
|
|
@ -7,7 +7,8 @@ static E_Desklock_Interface lokker_desklock_iface =
|
|||
{
|
||||
.name = "lokker",
|
||||
.show = lokker_lock,
|
||||
.hide = lokker_unlock
|
||||
.hide = lokker_unlock,
|
||||
.key_down = lokker_key_down,
|
||||
};
|
||||
|
||||
E_API void *
|
||||
|
|
|
@ -27,4 +27,5 @@ typedef enum
|
|||
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*);
|
||||
#endif
|
||||
|
|
|
@ -722,11 +722,9 @@ _lokker_check_auth(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_lokker_cb_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
EINTERN Eina_Bool
|
||||
lokker_key_down(Ecore_Event_Key *ev)
|
||||
{
|
||||
Ecore_Event_Key *ev = event;
|
||||
|
||||
if (!strcmp(ev->key, "Caps_Lock"))
|
||||
{
|
||||
if(ev->modifiers & ECORE_EVENT_LOCK_CAPS)
|
||||
|
@ -829,7 +827,6 @@ lokker_lock(void)
|
|||
total_zone_num = eina_list_count(e_comp->zones);
|
||||
|
||||
/* handlers */
|
||||
E_LIST_HANDLER_APPEND(edd->handlers, ECORE_EVENT_KEY_DOWN, _lokker_cb_key_down, NULL);
|
||||
E_LIST_HANDLER_APPEND(edd->handlers, E_EVENT_ZONE_ADD, _lokker_cb_zone_add, NULL);
|
||||
E_LIST_HANDLER_APPEND(edd->handlers, E_EVENT_ZONE_DEL, _lokker_cb_zone_del, NULL);
|
||||
E_LIST_HANDLER_APPEND(edd->handlers, E_EVENT_ZONE_MOVE_RESIZE, _lokker_cb_zone_move_resize, NULL);
|
||||
|
|
Loading…
Reference in New Issue