discomfitor pushed a commit to branch master.

http://git.enlightenment.org/enlightenment/modules/desksanity.git/commit/?id=6a21290dcd3dad4a495c0953dc93995b5eb4c229

commit 6a21290dcd3dad4a495c0953dc93995b5eb4c229
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Thu Nov 12 17:51:30 2015 -0500

    add handling for maintaining sticky windows with superkey
    
    manage sticky windows based on their last-used desk when flipping
---
 src/e_mod_main.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index 5dad574..449d653 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -16,6 +16,9 @@ static Eina_List *handlers;
 static Ecore_Timer *ds_key_focus_timeout;
 static Eina_List *ds_key_focus_desks;
 
+static Eina_Bool focus_last_focused_per_desktop;
+static unsigned int pending_flip;
+
 static void
 _ds_fade_end(Ecore_Cb cb, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *obj 
EINA_UNUSED)
 {
@@ -147,6 +150,23 @@ ds_key_focus(void)
                ds_key_focus_desks = eina_list_remove(ds_key_focus_desks, 
ec->desk);
                e_object_unref(E_OBJECT(ec->desk));
             }
+          if (!pending_flip)
+            focus_last_focused_per_desktop = 
e_config->focus_last_focused_per_desktop;
+          if (!ec->desk->visible)
+            {
+               e_config->focus_last_focused_per_desktop = 0;
+               pending_flip++;
+            }
+          if (ec->sticky)
+            {
+               E_Client *tec;
+
+               E_CLIENT_FOREACH(tec)
+                 if ((!tec->sticky) && (tec->desk == ec->desk)) break;
+               /* do not flip to a sticky window if there are no other windows 
on its desk */
+               if ((!tec) || (tec->desk != ec->desk)) continue;
+               e_desk_show(ec->desk);
+            }
           e_client_activate(ec, 1);
           break;
        }
@@ -178,6 +198,15 @@ ds_key(E_Object *obj EINA_UNUSED, const char *params 
EINA_UNUSED)
 }
 
 static Eina_Bool
+ds_desk_after_show(void *d EINA_UNUSED, int t EINA_UNUSED, 
E_Event_Desk_After_Show *ev EINA_UNUSED)
+{
+   if (pending_flip)
+     pending_flip--,
+     e_config->focus_last_focused_per_desktop = focus_last_focused_per_desktop;
+   return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
 ds_client_remove(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
 {
    ds_client_urgent_pop(ev->ec);
@@ -233,6 +262,7 @@ e_modapi_init(E_Module *m)
 
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_PROPERTY, ds_client_urgent, 
NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_REMOVE, ds_client_remove, 
NULL);
+   E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_AFTER_SHOW, 
ds_desk_after_show, NULL);
 
    act = e_action_add("ds_key");
    e_action_predef_name_set(D_("Desksanity"), D_("Manage Window Focus For 
Me"), "ds_key", NULL, NULL, 0);

-- 


Reply via email to