discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=91dc28967ac405534eaac8b49803b819a8ec73e8

commit 91dc28967ac405534eaac8b49803b819a8ec73e8
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Aug 18 15:52:52 2017 -0400

    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
---
 src/bin/e_comp_canvas.c         |  6 ++++++
 src/bin/e_desklock.h            |  1 +
 src/modules/lokker/e_mod_main.c |  1 +
 src/modules/lokker/e_mod_main.h |  1 +
 src/modules/lokker/lokker.c     | 25 +++++++++++++++++++++----
 5 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
index 36dcbf05d..ccf3d4116 100644
--- a/src/bin/e_comp_canvas.c
+++ b/src/bin/e_comp_canvas.c
@@ -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))) &&
diff --git a/src/bin/e_desklock.h b/src/bin/e_desklock.h
index a25f9a50c..5f6289553 100644
--- a/src/bin/e_desklock.h
+++ b/src/bin/e_desklock.h
@@ -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
 };
 
diff --git a/src/modules/lokker/e_mod_main.c b/src/modules/lokker/e_mod_main.c
index 18fc250ce..fe1902083 100644
--- a/src/modules/lokker/e_mod_main.c
+++ b/src/modules/lokker/e_mod_main.c
@@ -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 *
diff --git a/src/modules/lokker/e_mod_main.h b/src/modules/lokker/e_mod_main.h
index 0ce0619f4..68832c0c6 100644
--- a/src/modules/lokker/e_mod_main.h
+++ b/src/modules/lokker/e_mod_main.h
@@ -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
diff --git a/src/modules/lokker/lokker.c b/src/modules/lokker/lokker.c
index cdec4d1db..9806264fa 100644
--- a/src/modules/lokker/lokker.c
+++ b/src/modules/lokker/lokker.c
@@ -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"))

-- 


Reply via email to