From 925ea677ec2ac6ce17ab7c056097580f3e23fe67 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 11 Mar 2005 13:09:06 +0000 Subject: [PATCH] virtual roots is an option now (off by default) SVN revision: 13693 --- TODO | 1 + src/bin/e_border.c | 16 ++++++- src/bin/e_config.c | 1 + src/bin/e_config.h | 1 + src/bin/e_container.c | 67 +++++++++++++++++++++----- src/bin/e_error.c | 17 ++++++- src/bin/e_hints.c | 5 +- src/bin/e_init.c | 2 +- src/bin/e_main.c | 5 +- src/bin/e_manager.c | 106 ++++++++++++++++++++++++++++++++++++------ 10 files changed, 189 insertions(+), 32 deletions(-) diff --git a/TODO b/TODO index 767feacc7..4914e2b2d 100644 --- a/TODO +++ b/TODO @@ -29,6 +29,7 @@ Current freeze issues are: ISSUES: +* add "no vroot" option for manager and containers * consoldiate client lists - we have client lists for containers, zones, desks AND e_borders.c consolidate into 1 list that has all borders with their stacking and what desk they belong to (and thus zone and container) * focus newly created windows when appropriate (under mouse and focus follows mouse etc.) * focus issues in general diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 77028cb3e..90f41d47c 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -180,6 +180,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map) Ecore_X_Window_Attributes *att; Evas_List *list; E_Config_Binding *eb; + Ecore_X_Window mwin; unsigned int managed, desk[2]; int deskx, desky; @@ -192,6 +193,14 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map) bd->w = 1; bd->h = 1; bd->win = ecore_x_window_override_new(bd->container->win, 0, 0, bd->w, bd->h); + mwin = e_menu_grab_window_get(); + if (!mwin) mwin = e_init_window_get(); + if (mwin) + ecore_x_window_configure(bd->win, + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, + 0, 0, 0, 0, 0, + mwin, ECORE_X_WINDOW_STACK_BELOW); /* Bindings */ for (list = e_config->bindings; list; list = list->next) { @@ -568,6 +577,7 @@ e_border_raise(E_Border *bd) E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); _e_border_reorder_after(bd, NULL); mwin = e_menu_grab_window_get(); + if (!mwin) mwin = e_init_window_get(); if (!mwin) ecore_x_window_raise(bd->win); else @@ -584,7 +594,11 @@ e_border_lower(E_Border *bd) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); _e_border_reorder_before(bd, NULL); - ecore_x_window_lower(bd->win); + ecore_x_window_configure(bd->win, + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, + 0, 0, 0, 0, 0, + bd->container->bg_win, ECORE_X_WINDOW_STACK_ABOVE); } void diff --git a/src/bin/e_config.c b/src/bin/e_config.c index b933f5533..af1ac4b11 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -86,6 +86,7 @@ e_config_init(void) e_config->font_cache = 512; e_config->zone_desks_x_count = 1; e_config->zone_desks_y_count = 1; + e_config->use_virtual_roots = 0; { E_Config_Module *em; diff --git a/src/bin/e_config.h b/src/bin/e_config.h index cff4ff352..f494d74d5 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -61,6 +61,7 @@ struct _E_Config int font_cache; int zone_desks_x_count; int zone_desks_y_count; + int use_virtual_roots; Evas_List *modules; Evas_List *bindings; }; diff --git a/src/bin/e_container.c b/src/bin/e_container.c index ff5e1189c..c1f693f84 100644 --- a/src/bin/e_container.c +++ b/src/bin/e_container.c @@ -52,16 +52,36 @@ e_container_new(E_Manager *man) con->manager->containers = evas_list_append(con->manager->containers, con); con->w = con->manager->w; con->h = con->manager->h; - con->win = ecore_x_window_override_new(con->manager->win, con->x, con->y, con->w, con->h); - ecore_x_icccm_title_set(con->win, "Enlightenment Container"); + if (e_config->use_virtual_roots) + { + Ecore_X_Window mwin; + + con->win = ecore_x_window_override_new(con->manager->win, con->x, con->y, con->w, con->h); + ecore_x_icccm_title_set(con->win, "Enlightenment Container"); + mwin = e_menu_grab_window_get(); + if (!mwin) mwin = e_init_window_get(); + if (!mwin) + ecore_x_window_raise(con->win); + else + ecore_x_window_configure(con->win, + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, + 0, 0, 0, 0, 0, + mwin, ECORE_X_WINDOW_STACK_BELOW); + } + else + { + con->win = con->manager->win; + } con->bg_ecore_evas = ecore_evas_software_x11_new(NULL, con->win, 0, 0, con->w, con->h); + ecore_evas_override_set(con->bg_ecore_evas, 1); e_canvas_add(con->bg_ecore_evas); con->bg_evas = ecore_evas_get(con->bg_ecore_evas); con->bg_win = ecore_evas_software_x11_window_get(con->bg_ecore_evas); ecore_evas_name_class_set(con->bg_ecore_evas, "E", "Background_Window"); ecore_evas_title_set(con->bg_ecore_evas, "Enlightenment Background"); ecore_evas_avoid_damage_set(con->bg_ecore_evas, 1); - ecore_evas_show(con->bg_ecore_evas); + ecore_x_window_lower(con->bg_win); ecore_evas_callback_resize_set(con->bg_ecore_evas, _e_container_cb_bg_ecore_evas_resize); @@ -97,11 +117,13 @@ e_container_new(E_Manager *man) void e_container_show(E_Container *con) { - printf("Container show!\n"); E_OBJECT_CHECK(con); E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE); if (con->visible) return; - ecore_x_window_show(con->win); + ecore_evas_show(con->bg_ecore_evas); + ecore_x_window_lower(con->bg_win); + if (con->win != con->manager->win) + ecore_x_window_show(con->win); con->visible = 1; } @@ -111,7 +133,9 @@ e_container_hide(E_Container *con) E_OBJECT_CHECK(con); E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE); if (!con->visible) return; - ecore_x_window_hide(con->win); + ecore_evas_hide(con->bg_ecore_evas); + if (con->win != con->manager->win) + ecore_x_window_hide(con->win); con->visible = 0; } @@ -139,7 +163,8 @@ e_container_move(E_Container *con, int x, int y) if ((x == con->x) && (y == con->y)) return; con->x = x; con->y = y; - ecore_x_window_move(con->win, con->x, con->y); + if (con->win != con->manager->win) + ecore_x_window_move(con->win, con->x, con->y); evas_object_move(con->bg_blank_object, con->x, con->y); } @@ -151,7 +176,8 @@ e_container_resize(E_Container *con, int w, int h) if ((w == con->w) && (h == con->h)) return; con->w = w; con->h = h; - ecore_x_window_resize(con->win, con->w, con->h); + if (con->win != con->manager->win) + ecore_x_window_resize(con->win, con->w, con->h); ecore_evas_resize(con->bg_ecore_evas, con->w, con->h); evas_object_resize(con->bg_blank_object, con->w, con->h); } @@ -166,7 +192,8 @@ e_container_move_resize(E_Container *con, int x, int y, int w, int h) con->y = y; con->w = w; con->h = h; - ecore_x_window_move_resize(con->win, con->x, con->y, con->w, con->h); + if (con->win != con->manager->win) + ecore_x_window_move_resize(con->win, con->x, con->y, con->w, con->h); ecore_evas_resize(con->bg_ecore_evas, con->w, con->h); evas_object_move(con->bg_blank_object, con->x, con->y); evas_object_resize(con->bg_blank_object, con->w, con->h); @@ -177,7 +204,14 @@ e_container_raise(E_Container *con) { E_OBJECT_CHECK(con); E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE); - ecore_x_window_raise(con->win); + if (con->win != con->manager->win) + { + ecore_x_window_raise(con->win); + } + else + { + ecore_x_window_lower(con->bg_win); + } } void @@ -185,7 +219,12 @@ e_container_lower(E_Container *con) { E_OBJECT_CHECK(con); E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE); - ecore_x_window_lower(con->win); + if (con->win != con->manager->win) + ecore_x_window_lower(con->win); + else + { + ecore_x_window_lower(con->bg_win); + } } Evas_List * @@ -372,6 +411,7 @@ static void _e_container_free(E_Container *con) { Evas_List *l, *tmp; + if (con->gadman) e_object_del(E_OBJECT(con->gadman)); /* We can't use e_object_del here, because border adds a ref to itself * when it is removed, and the ref is never unref'ed */ @@ -390,7 +430,10 @@ _e_container_free(E_Container *con) con->manager->containers = evas_list_remove(con->manager->containers, con); e_canvas_del(con->bg_ecore_evas); ecore_evas_free(con->bg_ecore_evas); - ecore_x_window_del(con->win); + if (con->manager->win != con->win) + { + ecore_x_window_del(con->win); + } free(con); } diff --git a/src/bin/e_error.c b/src/bin/e_error.c index 7f218491f..895850034 100644 --- a/src/bin/e_error.c +++ b/src/bin/e_error.c @@ -299,7 +299,22 @@ e_error_message_manager_show(E_Manager *man, char *title, char *txt) o = evas_object_rectangle_add(e); evas_object_name_set(o, "allocated"); } - ecore_evas_show(ee); + { + Ecore_X_Window mwin, win; + + win = ecore_evas_software_x11_window_get(ee); + mwin = e_menu_grab_window_get(); + if (!mwin) mwin = e_init_window_get(); + if (!mwin) + ecore_x_window_raise(win); + else + ecore_x_window_configure(win, + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, + 0, 0, 0, 0, 0, + mwin, ECORE_X_WINDOW_STACK_BELOW); + ecore_evas_show(ee); + } } /* local subsystem functions */ diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index c0f7a94d3..aac659643 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -221,7 +221,10 @@ e_hints_desktop_config_set(void) { m = ml->data; ecore_x_netwm_desk_count_set(m->root, num); - ecore_x_netwm_desk_roots_set(m->root, num, vroots); + if (e_config->use_virtual_roots) + { + ecore_x_netwm_desk_roots_set(m->root, num, vroots); + } ecore_x_netwm_desk_workareas_set(m->root, num, areas); } free(vroots); diff --git a/src/bin/e_init.c b/src/bin/e_init.c index febd3fead..85e7c54e8 100644 --- a/src/bin/e_init.c +++ b/src/bin/e_init.c @@ -39,10 +39,10 @@ e_init_init(void) ecore_x_window_size_get(root, &w, &h); _e_init_ecore_evas = ecore_evas_software_x11_new(NULL, root, 0, 0, w, h); + ecore_evas_override_set(_e_init_ecore_evas, 1); e_canvas_add(_e_init_ecore_evas); _e_init_evas = ecore_evas_get(_e_init_ecore_evas); _e_init_win = ecore_evas_software_x11_window_get(_e_init_ecore_evas); - ecore_evas_override_set(_e_init_ecore_evas, 1); ecore_evas_name_class_set(_e_init_ecore_evas, "E", "Init_Window"); ecore_evas_title_set(_e_init_ecore_evas, "Enlightenment Init"); e_pointer_ecore_evas_set(_e_init_ecore_evas); diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 6b047c3f8..683fdd2df 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -533,7 +533,10 @@ _e_main_screens_init(void) if (con) { e_manager_manage_windows(man); - ecore_x_netwm_desk_roots_set(man->root, 1, &(con->win)); + if (e_config->use_virtual_roots) + { + ecore_x_netwm_desk_roots_set(man->root, 1, &(con->win)); + } e_container_show(con); } else diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c index 085ca196a..0c0e857b2 100644 --- a/src/bin/e_manager.c +++ b/src/bin/e_manager.c @@ -64,8 +64,27 @@ e_manager_new(Ecore_X_Window root) managers = evas_list_append(managers, man); man->root = root; ecore_x_window_size_get(man->root, &(man->w), &(man->h)); - man->win = ecore_x_window_override_new(man->root, man->x, man->y, man->w, man->h); - ecore_x_icccm_title_set(man->win, "Enlightenment Manager"); + if (e_config->use_virtual_roots) + { + Ecore_X_Window mwin; + + man->win = ecore_x_window_override_new(man->root, man->x, man->y, man->w, man->h); + ecore_x_icccm_title_set(man->win, "Enlightenment Manager"); + mwin = e_menu_grab_window_get(); + if (!mwin) mwin = e_init_window_get(); + if (!mwin) + ecore_x_window_raise(man->win); + else + ecore_x_window_configure(man->win, + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, + 0, 0, 0, 0, 0, + mwin, ECORE_X_WINDOW_STACK_BELOW); + } + else + { + man->win = man->root; + } h = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, _e_manager_cb_window_show_request, man); if (h) man->handlers = evas_list_append(man->handlers, h); h = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, _e_manager_cb_window_configure, man); @@ -163,22 +182,55 @@ e_manager_manage_windows(E_Manager *man) void e_manager_show(E_Manager *man) { + Evas_List *l; + E_OBJECT_CHECK(man); E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE); if (man->visible) return; - ecore_x_window_show(man->win); + for (l = man->containers; l; l = l->next) + { + E_Container *con; + + con = l->data; + e_container_show(con); + } + if (man->root != man->win) + { + Ecore_X_Window mwin; + + mwin = e_menu_grab_window_get(); + if (!mwin) mwin = e_init_window_get(); + if (!mwin) + ecore_x_window_raise(man->win); + else + ecore_x_window_configure(man->win, + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, + 0, 0, 0, 0, 0, + mwin, ECORE_X_WINDOW_STACK_BELOW); + ecore_x_window_show(man->win); + } ecore_x_window_focus(man->win); - e_init_show(); man->visible = 1; } void e_manager_hide(E_Manager *man) { + Evas_List *l; + E_OBJECT_CHECK(man); E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE); if (!man->visible) return; - ecore_x_window_hide(man->win); + for (l = man->containers; l; l = l->next) + { + E_Container *con; + + con = l->data; + e_container_hide(con); + } + if (man->root != man->win) + ecore_x_window_hide(man->win); man->visible = 0; } @@ -188,9 +240,12 @@ e_manager_move(E_Manager *man, int x, int y) E_OBJECT_CHECK(man); E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE); if ((x == man->x) && (y == man->y)) return; - man->x = x; - man->y = y; - ecore_x_window_move(man->win, man->x, man->y); + if (man->root != man->win) + { + man->x = x; + man->y = y; + ecore_x_window_move(man->win, man->x, man->y); + } } void @@ -203,7 +258,8 @@ e_manager_resize(E_Manager *man, int w, int h) if ((w == man->w) && (h == man->h)) return; man->w = w; man->h = h; - ecore_x_window_resize(man->win, man->w, man->h); + if (man->root != man->win) + ecore_x_window_resize(man->win, man->w, man->h); for (l = man->containers; l; l = l->next) { @@ -222,8 +278,11 @@ e_manager_move_resize(E_Manager *man, int x, int y, int w, int h) E_OBJECT_CHECK(man); E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE); if ((x == man->x) && (y == man->y) && (w == man->w) && (h == man->h)) return; - man->x = x; - man->y = y; + if (man->root != man->win) + { + man->x = x; + man->y = y; + } man->w = w; man->h = h; ecore_x_window_move_resize(man->win, man->x, man->y, man->w, man->h); @@ -242,8 +301,21 @@ e_manager_raise(E_Manager *man) { E_OBJECT_CHECK(man); E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE); - ecore_x_window_raise(man->win); - e_init_show(); + if (man->root != man->win) + { + Ecore_X_Window mwin; + + mwin = e_menu_grab_window_get(); + if (!mwin) mwin = e_init_window_get(); + if (!mwin) + ecore_x_window_raise(man->win); + else + ecore_x_window_configure(man->win, + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING | + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE, + 0, 0, 0, 0, 0, + mwin, ECORE_X_WINDOW_STACK_BELOW); + } } void @@ -251,7 +323,8 @@ e_manager_lower(E_Manager *man) { E_OBJECT_CHECK(man); E_OBJECT_TYPE_CHECK(man, E_MANAGER_TYPE); - ecore_x_window_lower(man->win); + if (man->root != man->win) + ecore_x_window_lower(man->win); } E_Container * @@ -304,7 +377,10 @@ _e_manager_free(E_Manager *man) l = l->next; e_object_del(E_OBJECT(tmp->data)); } - ecore_x_window_del(man->win); + if (man->root != man->win) + { + ecore_x_window_del(man->win); + } managers = evas_list_remove(managers, man); free(man); }