summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-01-13 11:35:26 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-01-13 11:33:36 -0500
commitd1bb23954fc312f8ee025c3a0b43a1d21708c33d (patch)
tree4f1ffc697d2a6c5b163fa1106b216014a6364d67
parent84f06597eca8e4132510773de20f09e256128a7f (diff)
break out code to set clients as transients for a parent
-rw-r--r--src/bin/e_client.c48
-rw-r--r--src/bin/e_client.h1
-rw-r--r--src/bin/e_comp_x.c30
3 files changed, 52 insertions, 27 deletions
diff --git a/src/bin/e_client.c b/src/bin/e_client.c
index e8b36032b..e42ccd86d 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)
5530 _e_client_layout_cb = cb; 5530 _e_client_layout_cb = cb;
5531} 5531}
5532 5532
5533////////////////////////////////////////////
5534
5535E_API void
5536e_client_parent_set(E_Client *ec, E_Client *parent)
5537{
5538 E_OBJECT_CHECK(ec);
5539 E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
5540 if (parent)
5541 {
5542 E_OBJECT_CHECK(parent);
5543 E_OBJECT_TYPE_CHECK(parent, E_CLIENT_TYPE);
5544 }
5545
5546 if (ec == parent)
5547 {
5548 ERR("refusing to set client as its own parent");
5549 return;
5550 }
5551
5552 if (parent && (parent->parent == ec))
5553 {
5554 ERR("refusing to set client as its parent's parent");
5555 return;
5556 }
5557
5558 if (ec->parent == parent) return;
5559
5560 /* If we already have a parent, remove it */
5561 if (ec->parent)
5562 {
5563 ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
5564 if (ec->parent->modal == ec) ec->parent->modal = NULL;
5565 ec->parent = NULL;
5566 }
5567 if (parent)
5568 {
5569 parent->transients = eina_list_append(parent->transients, ec);
5570 ec->parent = parent;
5571 }
5572 if (ec->parent && (!e_client_util_ignored_get(ec)))
5573 {
5574 evas_object_layer_set(ec->frame, ec->parent->layer);
5575
5576 if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
5577 (ec->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED)))
5578 ec->take_focus = 1;
5579 }
5580}
diff --git a/src/bin/e_client.h b/src/bin/e_client.h
index c5e369f40..545786878 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);
860 860
861YOLO E_API void e_client_focus_stack_set(Eina_List *l); 861YOLO E_API void e_client_focus_stack_set(Eina_List *l);
862 862
863E_API void e_client_parent_set(E_Client *ec, E_Client *parent);
863#include "e_client.x" 864#include "e_client.x"
864#endif 865#endif
diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
index 1bc886dd3..e906eb11a 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)
3826 ec->icccm.transient_for = ecore_x_icccm_transient_for_get(win); 3826 ec->icccm.transient_for = ecore_x_icccm_transient_for_get(win);
3827 if (ec->icccm.transient_for) 3827 if (ec->icccm.transient_for)
3828 ec_parent = _e_comp_x_client_find_by_window(ec->icccm.transient_for); 3828 ec_parent = _e_comp_x_client_find_by_window(ec->icccm.transient_for);
3829 /* If we already have a parent, remove it */
3830 if (ec->parent)
3831 {
3832 if (ec_parent != ec->parent)
3833 {
3834 ec->parent->transients = eina_list_remove(ec->parent->transients, ec);
3835 if (ec->parent->modal == ec) ec->parent->modal = NULL;
3836 ec->parent = NULL;
3837 }
3838 else
3839 ec_parent = NULL;
3840 }
3841 if ((ec_parent) && (ec_parent != ec) &&
3842 (eina_list_data_find(ec->transients, ec_parent) != ec_parent))
3843 {
3844 ec_parent->transients = eina_list_append(ec_parent->transients, ec);
3845 ec->parent = ec_parent;
3846 }
3847 if (ec->parent && (!e_client_util_ignored_get(ec)))
3848 {
3849 evas_object_layer_set(ec->frame, ec->parent->layer);
3850 if (ec->netwm.state.modal)
3851 _e_comp_x_client_modal_setup(ec);
3852 3829
3853 if (e_config->focus_setting == E_FOCUS_NEW_DIALOG || 3830 e_client_parent_set(ec, ec_parent);
3854 (ec->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED))) 3831 if (ec->parent && (!e_client_util_ignored_get(ec)) && ec->netwm.state.modal)
3855 ec->take_focus = 1; 3832 _e_comp_x_client_modal_setup(ec);
3856 }
3857 if ((ec_parent) && (ec->e.state.stack != ECORE_X_STACK_NONE)) 3833 if ((ec_parent) && (ec->e.state.stack != ECORE_X_STACK_NONE))
3858 { 3834 {
3859 E_Client *ec2; 3835 E_Client *ec2;