discomfitor pushed a commit to branch master.

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

commit d1bb23954fc312f8ee025c3a0b43a1d21708c33d
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Fri Jan 13 11:35:26 2017 -0500

    break out code to set clients as transients for a parent
---
 src/bin/e_client.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/bin/e_client.h |  1 +
 src/bin/e_comp_x.c | 30 +++---------------------------
 3 files changed, 52 insertions(+), 27 deletions(-)

diff --git a/src/bin/e_client.c b/src/bin/e_client.c
index e8b3603..e42ccd8 100644
--- a/src/bin/e_client.c
+++ b/src/bin/e_client.c
@@ -5530,3 +5530,51 @@ e_client_layout_cb_set(E_Client_Layout_Cb cb)
    _e_client_layout_cb = cb;
 }
 
+////////////////////////////////////////////
+
+E_API void
+e_client_parent_set(E_Client *ec, E_Client *parent)
+{
+   E_OBJECT_CHECK(ec);
+   E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
+   if (parent)
+     {
+        E_OBJECT_CHECK(parent);
+        E_OBJECT_TYPE_CHECK(parent, E_CLIENT_TYPE);
+     }
+
+   if (ec == parent)
+     {
+        ERR("refusing to set client as its own parent");
+        return;
+     }
+
+   if (parent && (parent->parent == ec))
+     {
+        ERR("refusing to set client as its parent's parent");
+        return;
+     }
+
+   if (ec->parent == parent) return;
+
+   /* If we already have a parent, remove it */
+   if (ec->parent)
+     {
+        ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
+        if (ec->parent->modal == ec) ec->parent->modal = NULL;
+        ec->parent = NULL;
+     }
+   if (parent)
+     {
+        parent->transients = eina_list_append(parent->transients, ec);
+        ec->parent = parent;
+     }
+   if (ec->parent && (!e_client_util_ignored_get(ec)))
+     {
+        evas_object_layer_set(ec->frame, ec->parent->layer);
+
+        if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
+            (ec->parent->focused && (e_config->focus_setting == 
E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
+          ec->take_focus = 1;
+     }
+}
diff --git a/src/bin/e_client.h b/src/bin/e_client.h
index c5e369f..5457868 100644
--- a/src/bin/e_client.h
+++ b/src/bin/e_client.h
@@ -860,5 +860,6 @@ E_API Eina_Bool  e_client_stack_urgent_get(E_Client *ec);
 
 YOLO E_API void e_client_focus_stack_set(Eina_List *l);
 
+E_API void e_client_parent_set(E_Client *ec, E_Client *parent);
 #include "e_client.x"
 #endif
diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
index 1bc886d..e906eb1 100644
--- a/src/bin/e_comp_x.c
+++ b/src/bin/e_comp_x.c
@@ -3826,34 +3826,10 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, 
E_Client *ec)
         ec->icccm.transient_for = ecore_x_icccm_transient_for_get(win);
         if (ec->icccm.transient_for)
           ec_parent = _e_comp_x_client_find_by_window(ec->icccm.transient_for);
-        /* If we already have a parent, remove it */
-        if (ec->parent)
-          {
-             if (ec_parent != ec->parent)
-               {
-                  ec->parent->transients = 
eina_list_remove(ec->parent->transients, ec);
-                  if (ec->parent->modal == ec) ec->parent->modal = NULL;
-                  ec->parent = NULL;
-               }
-             else
-               ec_parent = NULL;
-          }
-        if ((ec_parent) && (ec_parent != ec) &&
-            (eina_list_data_find(ec->transients, ec_parent) != ec_parent))
-          {
-             ec_parent->transients = eina_list_append(ec_parent->transients, 
ec);
-             ec->parent = ec_parent;
-          }
-        if (ec->parent && (!e_client_util_ignored_get(ec)))
-          {
-             evas_object_layer_set(ec->frame, ec->parent->layer);
-             if (ec->netwm.state.modal)
-               _e_comp_x_client_modal_setup(ec);
 
-             if (e_config->focus_setting == E_FOCUS_NEW_DIALOG ||
-                 (ec->parent->focused && (e_config->focus_setting == 
E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
-               ec->take_focus = 1;
-          }
+        e_client_parent_set(ec, ec_parent);
+        if (ec->parent && (!e_client_util_ignored_get(ec)) && 
ec->netwm.state.modal)
+          _e_comp_x_client_modal_setup(ec);
         if ((ec_parent) && (ec->e.state.stack != ECORE_X_STACK_NONE))
           {
              E_Client *ec2;

-- 


Reply via email to