Tiling2: Added untested support for sticky windows.
authorTom Hacohen <tom@stosb.com>
Thu, 16 Jan 2014 11:59:42 +0000 (11:59 +0000)
committerTom Hacohen <tom@stosb.com>
Fri, 21 Feb 2014 09:15:07 +0000 (09:15 +0000)
Just don't tile them.

src/modules/tiling/e_mod_config.c
src/modules/tiling/e_mod_tiling.c
src/modules/tiling/e_mod_tiling.h

index 7a6cf53..20b2d6d 100644 (file)
@@ -167,11 +167,11 @@ _basic_create_widgets(E_Config_Dialog      *cfd __UNUSED__,
     /* General settings */
     of = e_widget_framelist_add(evas, _("General"), 0);
     e_widget_framelist_object_append(of,
-      e_widget_check_add(evas, _("Tile dialog windows as well"),
-                         &cfdata->config.tile_dialogs));
-    e_widget_framelist_object_append(of,
       e_widget_check_add(evas, _("Show window titles"),
                          &cfdata->config.show_titles));
+    e_widget_framelist_object_append(of,
+      e_widget_check_add(evas, _("Tile dialog windows"),
+                         &cfdata->config.tile_dialogs));
     oc = e_widget_list_add(evas, false, true);
     e_widget_framelist_object_append(of, oc);
 
index 5a07d1d..e03a6d0 100644 (file)
@@ -509,6 +509,7 @@ _remove_client(E_Client *ec)
       }
 
     EINA_LIST_REMOVE(_G.tinfo->floating_windows, ec);
+    EINA_LIST_REMOVE(_G.tinfo->sticky_windows, ec);
 
     _reapply_tree();
 }
@@ -813,18 +814,37 @@ _uniconify_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *even
     return true;
 }
 
+static void
+toggle_sticky(E_Client *ec)
+{
+    if (!ec)
+        return;
+    if (!desk_should_tile_check(ec->desk))
+        return;
+
+    if (EINA_LIST_IS_IN(_G.tinfo->sticky_windows, ec)) {
+        EINA_LIST_REMOVE(_G.tinfo->sticky_windows, ec);
+
+        _add_client(ec);
+    } else {
+        _remove_client(ec);
+        _restore_client(ec);
+        EINA_LIST_APPEND(_G.tinfo->sticky_windows, ec);
+    }
+}
+
 static Eina_Bool
-_stick_hook(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
+_stick_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event)
 {
-    DBG("TODO");
-    return true;
+   toggle_sticky(event->ec);
+   return true;
 }
 
 static Eina_Bool
-_unstick_hook(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
+_unstick_hook(void *data __UNUSED__, int type __UNUSED__, E_Event_Client *event)
 {
-    DBG("TODO");
-    return true;
+   toggle_sticky(event->ec);
+   return true;
 }
 
 static Eina_Bool
index 2e9132c..e112a4d 100644 (file)
@@ -53,6 +53,8 @@ struct _Tiling_Info
 
     /* List of windows which were toggled floating */
     Eina_List *floating_windows;
+    /* List of sticky windows. */
+    Eina_List *sticky_windows;
 
     Window_Tree *tree;
 };