devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=35febc367d9ce0266f400f52c6fadcfec8ccc4a3

commit 35febc367d9ce0266f400f52c6fadcfec8ccc4a3
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Wed Jul 27 13:31:13 2016 -0400

    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.mich...@samsung.com>
---
 src/bin/e_comp.h                |  4 ++++
 src/bin/e_comp_canvas.c         | 16 ++++++++++------
 src/modules/wl_drm/e_mod_main.c | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h
index c391993..571e1b2 100644
--- a/src/bin/e_comp.h
+++ b/src/bin/e_comp.h
@@ -70,6 +70,10 @@ typedef struct E_Comp_Screen_Iface
    void (*apply)(void);
    /* set dpms (on, standby, suspend, off) */
    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;
 
 struct _E_Comp
diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
index 7d077ab..0289b42 100644
--- a/src/bin/e_comp_canvas.c
+++ b/src/bin/e_comp_canvas.c
@@ -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;
      }
-   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
-          && !e_comp_wl_key_down(ev)
+       && !e_comp_wl_key_down(ev)
 #endif
-          ;
+         ;
 }
 
 static Eina_Bool
@@ -142,11 +144,13 @@ _key_up(int ctx, Ecore_Event_Key *ev)
 {
    e_screensaver_notidle();
    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
-          && !e_comp_wl_key_up(ev)
+       && !e_comp_wl_key_up(ev)
 #endif
-          ;
+         ;
 }
 
 static Eina_Bool
diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c
index 98f31a8..5f50f2d 100644
--- a/src/modules/wl_drm/e_mod_main.c
+++ b/src/modules/wl_drm/e_mod_main.c
@@ -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
 _drm2_read_pixels(E_Comp_Wl_Output *output, void *pixels)
 {
@@ -1143,6 +1178,8 @@ static E_Comp_Screen_Iface drmiface =
    .create = _drm2_randr_create,
    .apply = _drm2_randr_apply,
    .dpms = _drm2_dpms,
+   .key_down = _drm2_key_down,
+   .key_up = _drm2_key_up,
 #else
    .create = _drm_randr_create,
    .apply = _drm_randr_apply,

-- 


Reply via email to