[metacity/wip/muktupavels/issue-26: 1/4] display: replace IN_TAB_CHAIN macro with an inline function
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity/wip/muktupavels/issue-26: 1/4] display: replace IN_TAB_CHAIN macro with an inline function
- Date: Sun, 9 Oct 2022 15:25:09 +0000 (UTC)
commit 1f35fd7466dd103e1edf1075c8272777149675be
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Oct 8 22:13:42 2022 +0300
display: replace IN_TAB_CHAIN macro with an inline function
src/core/display.c | 55 +++++++++++++++++++++++++++++++++++++----------
src/core/window-private.h | 9 --------
2 files changed, 44 insertions(+), 20 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index ce903273..4168a828 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4570,9 +4570,42 @@ get_focussed_group (MetaDisplay *display)
return NULL;
}
-#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
- || ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \
- || ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focussed_group(w->display))))
+static inline gboolean
+in_normal_tab_chain_type (MetaWindow *window)
+{
+ return window->type != META_WINDOW_DOCK &&
+ window->type != META_WINDOW_DESKTOP;
+}
+
+static inline gboolean
+in_tab_chain (MetaWindow *window,
+ MetaTabList type)
+{
+ if (!meta_window_is_focusable (window))
+ return FALSE;
+
+ if (type == META_TAB_LIST_NORMAL)
+ {
+ if (in_normal_tab_chain_type (window) && !window->skip_taskbar)
+ return TRUE;
+ }
+ else if (type == META_TAB_LIST_DOCKS)
+ {
+ if (!in_normal_tab_chain_type (window) || window->skip_taskbar)
+ return TRUE;
+ }
+ else if (type == META_TAB_LIST_GROUP)
+ {
+ MetaGroup *group;
+
+ group = get_focussed_group (window->display);
+
+ if (group == NULL || meta_window_get_group (window) == group)
+ return TRUE;
+ }
+
+ return FALSE;
+}
static MetaWindow*
find_tab_forward (MetaDisplay *display,
@@ -4596,7 +4629,7 @@ find_tab_forward (MetaDisplay *display,
MetaWindow *window = tmp->data;
if (window->screen == screen &&
- IN_TAB_CHAIN (window, type))
+ in_tab_chain (window, type))
return window;
tmp = tmp->next;
@@ -4607,7 +4640,7 @@ find_tab_forward (MetaDisplay *display,
{
MetaWindow *window = tmp->data;
- if (IN_TAB_CHAIN (window, type))
+ if (in_tab_chain (window, type))
return window;
tmp = tmp->next;
@@ -4637,7 +4670,7 @@ find_tab_backward (MetaDisplay *display,
MetaWindow *window = tmp->data;
if (window->screen == screen &&
- IN_TAB_CHAIN (window, type))
+ in_tab_chain (window, type))
return window;
tmp = tmp->prev;
@@ -4648,7 +4681,7 @@ find_tab_backward (MetaDisplay *display,
{
MetaWindow *window = tmp->data;
- if (IN_TAB_CHAIN (window, type))
+ if (in_tab_chain (window, type))
return window;
tmp = tmp->prev;
@@ -4681,7 +4714,7 @@ meta_display_get_tab_list (MetaDisplay *display,
if (!window->minimized &&
window->screen == screen &&
- IN_TAB_CHAIN (window, type))
+ in_tab_chain (window, type))
tab_list = g_list_prepend (tab_list, window);
tmp = tmp->next;
@@ -4698,7 +4731,7 @@ meta_display_get_tab_list (MetaDisplay *display,
if (window->minimized &&
window->screen == screen &&
- IN_TAB_CHAIN (window, type))
+ in_tab_chain (window, type))
tab_list = g_list_prepend (tab_list, window);
tmp = tmp->next;
@@ -4722,7 +4755,7 @@ meta_display_get_tab_list (MetaDisplay *display,
/* Check to see if it demands attention */
if (l_window->wm_state_demands_attention &&
l_window->workspace!=workspace &&
- IN_TAB_CHAIN (l_window, type))
+ in_tab_chain (l_window, type))
{
/* if it does, add it to the popup */
tab_list = g_list_prepend (tab_list, l_window);
@@ -4799,7 +4832,7 @@ meta_display_get_tab_current (MetaDisplay *display,
if (window != NULL &&
window->screen == screen &&
- IN_TAB_CHAIN (window, type) &&
+ in_tab_chain (window, type) &&
(workspace == NULL ||
meta_window_located_on_workspace (window, workspace)))
return window;
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 61cef633..61d7e511 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -633,15 +633,6 @@ void meta_window_get_current_tile_area (MetaWindow *window,
gboolean meta_window_same_application (MetaWindow *window,
MetaWindow *other_window);
-#define META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE(w) \
- ((w)->type != META_WINDOW_DOCK && (w)->type != META_WINDOW_DESKTOP)
-#define META_WINDOW_IN_NORMAL_TAB_CHAIN(w) \
- (((w)->input || (w)->take_focus ) && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) && (!(w)->skip_taskbar))
-#define META_WINDOW_IN_DOCK_TAB_CHAIN(w) \
- (((w)->input || (w)->take_focus) && (! META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w) || (w)->skip_taskbar))
-#define META_WINDOW_IN_GROUP_TAB_CHAIN(w, g) \
- (((w)->input || (w)->take_focus) && (!g || meta_window_get_group(w)==g))
-
void meta_window_refresh_resize_popup (MetaWindow *window);
void meta_window_free_delete_dialog (MetaWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]