From 9a4b1e0bb71cd991cd1d86d4fb432377ba4f4eab Mon Sep 17 00:00:00 2001 From: Illia Danko Date: Fri, 7 Oct 2016 23:58:41 +0300 Subject: Added functionality to disable display preselected tab window border --- src/core/prefs.c | 16 ++++++++++++ src/core/screen.c | 74 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 57 insertions(+), 33 deletions(-) (limited to 'src/core') diff --git a/src/core/prefs.c b/src/core/prefs.c index 2f3e9392..8dd1008a 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -117,6 +117,7 @@ static gboolean force_compositor_manager = FALSE; static gboolean compositing_manager = FALSE; static gboolean compositing_fast_alt_tab = FALSE; static gboolean resize_with_right_button = FALSE; +static gboolean show_tab_border = FALSE; static gboolean center_new_windows = FALSE; static gboolean force_fullscreen = TRUE; static gboolean side_by_side_tiling = FALSE; @@ -407,6 +408,12 @@ static MetaBoolPreference preferences_bool[] = &resize_with_right_button, FALSE, }, + { "show-tab-border", + KEY_GENERAL_SCHEMA, + META_PREF_SHOW_TAB_BORDER, + &show_tab_border, + FALSE, + }, { "center-new-windows", KEY_GENERAL_SCHEMA, META_PREF_CENTER_NEW_WINDOWS, @@ -1558,6 +1565,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_RESIZE_WITH_RIGHT_BUTTON: return "RESIZE_WITH_RIGHT_BUTTON"; + case META_PREF_SHOW_TAB_BORDER: + return "SHOW_TAB_BORDER"; + case META_PREF_FORCE_FULLSCREEN: return "FORCE_FULLSCREEN"; @@ -2245,6 +2255,12 @@ meta_prefs_get_mouse_button_menu (void) return resize_with_right_button ? 2: 3; } +gboolean +meta_prefs_show_tab_border(void) +{ + return show_tab_border; +} + gboolean meta_prefs_get_force_fullscreen (void) { diff --git a/src/core/screen.c b/src/core/screen.c index 3c1caf61..34016d51 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1273,6 +1273,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, GList *tmp; int len; int i; + gint border; if (screen->tab_popup) return; @@ -1289,6 +1290,8 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, entries[len].title = NULL; entries[len].icon = NULL; + border = meta_prefs_show_tab_border() ? BORDER_OUTLINE_TAB | + BORDER_OUTLINE_WINDOW : BORDER_OUTLINE_TAB; i = 0; tmp = tab_list; while (i < len) @@ -1353,38 +1356,43 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, * sides. On the top it should be the size of the south frame * edge. */ -#define OUTLINE_WIDTH 5 - /* Top side */ - if (!entries[i].hidden && - window->frame && window->frame->bottom_height > 0 && - window->frame->child_y >= window->frame->bottom_height) - entries[i].inner_rect.y = window->frame->bottom_height; - else - entries[i].inner_rect.y = OUTLINE_WIDTH; - - /* Bottom side */ - if (!entries[i].hidden && - window->frame && window->frame->bottom_height != 0) - entries[i].inner_rect.height = r.height - - entries[i].inner_rect.y - window->frame->bottom_height; - else - entries[i].inner_rect.height = r.height - - entries[i].inner_rect.y - OUTLINE_WIDTH; - - /* Left side */ - if (!entries[i].hidden && window->frame && window->frame->child_x != 0) - entries[i].inner_rect.x = window->frame->child_x; - else - entries[i].inner_rect.x = OUTLINE_WIDTH; + if (border & BORDER_OUTLINE_WINDOW) + { + const gint border_outline_width = 5; + + /* Top side */ + if (!entries[i].hidden && + window->frame && window->frame->bottom_height > 0 && + window->frame->child_y >= window->frame->bottom_height) + entries[i].inner_rect.y = window->frame->bottom_height; + else + entries[i].inner_rect.y = border_outline_width; + + /* Bottom side */ + if (!entries[i].hidden && + window->frame && window->frame->bottom_height != 0) + entries[i].inner_rect.height = r.height + - entries[i].inner_rect.y - window->frame->bottom_height; + else + entries[i].inner_rect.height = r.height + - entries[i].inner_rect.y - border_outline_width; + + /* Left side */ + if (!entries[i].hidden && window->frame && window->frame->child_x != 0) + entries[i].inner_rect.x = window->frame->child_x; + else + entries[i].inner_rect.x = border_outline_width; + + /* Right side */ + if (!entries[i].hidden && + window->frame && window->frame->right_width != 0) + entries[i].inner_rect.width = r.width + - entries[i].inner_rect.x - window->frame->right_width; + else + entries[i].inner_rect.width = r.width + - entries[i].inner_rect.x - border_outline_width; + } - /* Right side */ - if (!entries[i].hidden && - window->frame && window->frame->right_width != 0) - entries[i].inner_rect.width = r.width - - entries[i].inner_rect.x - window->frame->right_width; - else - entries[i].inner_rect.width = r.width - - entries[i].inner_rect.x - OUTLINE_WIDTH; ++i; tmp = tmp->next; @@ -1394,7 +1402,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, screen->number, len, 5, /* FIXME */ - TRUE); + border); for (i = 0; i < len; i++) g_object_unref (entries[i].icon); @@ -1466,7 +1474,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen) screen->number, len, layout.cols, - FALSE); + BORDER_OUTLINE_WORKSPACE); g_free (entries); meta_screen_free_workspace_layout (&layout); -- cgit v1.2.1