summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2022-10-08 22:13:42 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2022-10-22 11:14:53 +0000
commit094248b9063af9d54743dea881600728be8ebef8 (patch)
treedb9876cf0ff1de6d630ec6602430c8df68d17b12
parent978fd94f1e5856c4b69d77f62b34a4bb5a57647e (diff)
downloadmetacity-094248b9063af9d54743dea881600728be8ebef8.tar.gz
display: replace IN_TAB_CHAIN macro with an inline function
-rw-r--r--src/core/display.c55
-rw-r--r--src/core/window-private.h9
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);