[mutter/wip/exalm/focused-appearance: 2/3] workspace: Add meta_workspace_get_default_focus_window()
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/exalm/focused-appearance: 2/3] workspace: Add meta_workspace_get_default_focus_window()
- Date: Thu, 12 Aug 2021 17:49:45 +0000 (UTC)
commit 7afefbbb6143f4c071033baec202f604f506b0f5
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sat Oct 12 23:55:01 2019 +0500
workspace: Add meta_workspace_get_default_focus_window()
Each workspace has a window that will be focused when switching to that
workspace. Add a function to retrieve that window.
This is only relevant for click-to-focus focus mode, since with the two
other modes no window will be focused upon switching, and will only gain
focus when hovered.
This will be used in the next commit to make this window appear focused.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
src/core/workspace-private.h | 1 +
src/core/workspace.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
---
diff --git a/src/core/workspace-private.h b/src/core/workspace-private.h
index a58b2347d7..f0d896f6cd 100644
--- a/src/core/workspace-private.h
+++ b/src/core/workspace-private.h
@@ -92,6 +92,7 @@ GList* meta_workspace_get_onscreen_region (MetaWorkspace *workspace);
GList * meta_workspace_get_onmonitor_region (MetaWorkspace *workspace,
MetaLogicalMonitor *logical_monitor);
+MetaWindow * meta_workspace_get_default_focus_window (MetaWorkspace *workspace);
void meta_workspace_focus_default_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
guint32 timestamp);
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 321d3efb0a..564c5589de 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -1284,6 +1284,20 @@ meta_workspace_get_name (MetaWorkspace *workspace)
return meta_prefs_get_workspace_name (meta_workspace_index (workspace));
}
+MetaWindow *
+meta_workspace_get_default_focus_window (MetaWorkspace *workspace)
+{
+ if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK)
+ {
+ return meta_stack_get_default_focus_window (workspace->display->stack,
+ workspace, NULL);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
void
meta_workspace_focus_default_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]