devilhorns pushed a commit to branch devs/devilhorns/wayland.

commit 574d02dcd45e16303bcc1ff39034182bb3fe9362
Author: Chris Michael <[email protected]>
Date:   Mon Mar 11 10:15:24 2013 +0000

    Add a shell surface activate function that sends focus to a client and
    notifies the compositor.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/modules/wl_shell/e_mod_main.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/modules/wl_shell/e_mod_main.c 
b/src/modules/wl_shell/e_mod_main.c
index 6500713..6596d36 100644
--- a/src/modules/wl_shell/e_mod_main.c
+++ b/src/modules/wl_shell/e_mod_main.c
@@ -9,6 +9,7 @@ static void _e_wl_shell_cb_bind(struct wl_client *client, void 
*data, unsigned i
 static void _e_wl_shell_cb_bind_desktop(struct wl_client *client, void *data, 
unsigned int version EINA_UNUSED, unsigned int id);
 static void _e_wl_shell_cb_unbind_desktop(struct wl_resource *resource);
 
+static void _e_wl_shell_surface_activate(E_Wayland_Surface *ews, 
E_Wayland_Input *input);
 static void _e_wl_shell_surface_map(E_Wayland_Surface *ews, int x, int y, int 
w, int h);
 static void _e_wl_shell_surface_ping(E_Wayland_Surface *ews, unsigned int 
serial);
 static int _e_wl_shell_surface_ping_cb_timeout(void *data);
@@ -191,10 +192,23 @@ _e_wl_shell_cb_unbind_desktop(struct wl_resource 
*resource)
 }
 
 static void 
+_e_wl_shell_surface_activate(E_Wayland_Surface *ews, E_Wayland_Input *input)
+{
+   if (input->wl.seat.keyboard)
+     {
+        wl_keyboard_set_focus(input->wl.seat.keyboard, &ews->wl.surface);
+        wl_data_device_set_keyboard_focus(&input->wl.seat);
+     }
+
+   wl_signal_emit(&_e_wl_comp->wl.signals.activate, ews);
+}
+
+static void 
 _e_wl_shell_surface_map(E_Wayland_Surface *ews, int x, int y, int w, int h)
 {
    /* E_Wayland_Shell_Surface *ewss = NULL; */
    E_Wayland_Shell_Surface_Type type = E_WAYLAND_SHELL_SURFACE_NONE;
+   E_Wayland_Input *seat = NULL;
 
    SLOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -250,7 +264,14 @@ _e_wl_shell_surface_map(E_Wayland_Surface *ews, int x, int 
y, int w, int h)
         /* TODO: activate. Hmmm, this basically emits an activate signal to 
          * the compositor (passing the surface). Since we do not really use 
          * an activate signal, we'll need another method here */
-        if (ews->win) e_win_show(ews->win);
+        if (ews->win) 
+          {
+             e_win_show(ews->win);
+             ews->mapped = EINA_TRUE;
+
+             wl_list_for_each(seat, &_e_wl_comp->wl.lists.seat, wl.link)
+               _e_wl_shell_surface_activate(ews, seat);
+          }
 
         /* restack */
         break;

-- 

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev

Reply via email to