Compare commits
No commits in common. 'i9c-beta' and 'c9' have entirely different histories.
@ -0,0 +1,26 @@
|
||||
From 088644fb1773b64ca45dec497589517e1774eac1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Tue, 27 Aug 2024 11:33:14 +0200
|
||||
Subject: [PATCH 1/5] display: Make cgroup constructor local
|
||||
|
||||
This silences a warning about a missing function declaration.
|
||||
---
|
||||
src/core/display.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/display.c b/src/core/display.c
|
||||
index 4c9038e627..97f591a876 100644
|
||||
--- a/src/core/display.c
|
||||
+++ b/src/core/display.c
|
||||
@@ -1619,7 +1619,7 @@ extract_app_id_from_cgroup (const char *cgroup)
|
||||
return g_steal_pointer (&app_id);
|
||||
}
|
||||
|
||||
-MetaCGroup*
|
||||
+static MetaCGroup*
|
||||
meta_cgroup_new (const char *path)
|
||||
{
|
||||
MetaCGroup *cgroup;
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 0fe26e5b6d1e6f03a99623edf6a6f4c6caa2e142 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||
Date: Tue, 15 Oct 2024 14:56:33 +0200
|
||||
Subject: [PATCH 1/2] wayland/wl-shell: Make sure created window has a proper
|
||||
size
|
||||
|
||||
The wl_shell_window construction is a bit messy, and was not properly
|
||||
resizing when a window was created after a buffer was attached. This,
|
||||
when the window was the dummy window in wl-paste, caused a SIGFPE as the
|
||||
window was incorrectly assumed to be 0x0, i.e. size being 0.
|
||||
---
|
||||
src/wayland/meta-wayland-wl-shell.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c
|
||||
index 964c185b23..51d88cea2b 100644
|
||||
--- a/src/wayland/meta-wayland-wl-shell.c
|
||||
+++ b/src/wayland/meta-wayland-wl-shell.c
|
||||
@@ -481,7 +481,7 @@ sync_wl_shell_parent_relationship (MetaWaylandSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
+static MetaWindow *
|
||||
create_wl_shell_surface_window (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandWlShellSurface *wl_shell_surface =
|
||||
@@ -513,6 +513,8 @@ create_wl_shell_surface_window (MetaWaylandSurface *surface)
|
||||
if (meta_wayland_surface_get_window (child))
|
||||
sync_wl_shell_parent_relationship (child, surface);
|
||||
}
|
||||
+
|
||||
+ return window;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -597,7 +599,7 @@ wl_shell_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
* convenient for us. */
|
||||
if (surface->buffer_ref->buffer && !window)
|
||||
{
|
||||
- create_wl_shell_surface_window (surface);
|
||||
+ window = create_wl_shell_surface_window (surface);
|
||||
}
|
||||
else if (!surface->buffer_ref->buffer && window)
|
||||
{
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 37b4b8dd63851e97b507008fe1028a259c0419c7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Tue, 27 Aug 2024 11:33:22 +0200
|
||||
Subject: [PATCH 2/5] display: Also set window cgroup on cgroup creation
|
||||
|
||||
We'd register the cgroup for a window twice, because the firs time
|
||||
didn't update the MetaWindow::cgroup pointer. This meant the cgroups
|
||||
were never removed.
|
||||
---
|
||||
src/core/display.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/core/display.c b/src/core/display.c
|
||||
index 97f591a876..e99e787fbe 100644
|
||||
--- a/src/core/display.c
|
||||
+++ b/src/core/display.c
|
||||
@@ -1704,6 +1704,7 @@ meta_display_register_cgroup (MetaDisplay *display,
|
||||
|
||||
cgroup = meta_cgroup_new (path);
|
||||
g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||
+ window->cgroup = cgroup;
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
@ -0,0 +1,24 @@
|
||||
From e434615ed1d4ba506e0282ad5cdc94303310c682 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||
Date: Wed, 16 Oct 2024 14:26:28 +0200
|
||||
Subject: [PATCH 2/2] window: Avoid SIGFPE on bogus window size
|
||||
|
||||
---
|
||||
src/core/window.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/core/window.c b/src/core/window.c
|
||||
index 512ef9312f..142aa0eca1 100644
|
||||
--- a/src/core/window.c
|
||||
+++ b/src/core/window.c
|
||||
@@ -2393,6 +2393,7 @@ window_would_mostly_be_covered_by_always_above_window (MetaWindow *window)
|
||||
}
|
||||
|
||||
window_area = window->rect.width * window->rect.height;
|
||||
+ g_return_val_if_fail (window_area > 0, FALSE);
|
||||
|
||||
cairo_region_intersect_rectangle (region, &window->rect);
|
||||
intersection_area = calculate_region_area (region);
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
@ -0,0 +1,36 @@
|
||||
From dd887dcf4770309fca127217660c5142a463e2c1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Tue, 27 Aug 2024 11:33:23 +0200
|
||||
Subject: [PATCH 3/5] window: Unregister cgroup on unmanage()
|
||||
|
||||
This means any potential reference held by gjs will not hold the cgroup
|
||||
alive longer than necessary.
|
||||
---
|
||||
src/core/window.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/window.c b/src/core/window.c
|
||||
index 142aa0eca1..272d664965 100644
|
||||
--- a/src/core/window.c
|
||||
+++ b/src/core/window.c
|
||||
@@ -339,8 +339,6 @@ meta_window_finalize (GObject *object)
|
||||
g_free (window->sm_client_id);
|
||||
g_free (window->wm_client_machine);
|
||||
|
||||
- meta_display_unregister_cgroup (window->display, window);
|
||||
-
|
||||
g_free (window->startup_id);
|
||||
g_free (window->role);
|
||||
g_free (window->res_class);
|
||||
@@ -1467,6 +1465,8 @@ meta_window_unmanage (MetaWindow *window,
|
||||
meta_verbose ("Unmanaging %s", window->desc);
|
||||
window->unmanaging = TRUE;
|
||||
|
||||
+ meta_display_unregister_cgroup (window->display, window);
|
||||
+
|
||||
g_clear_handle_id (&window->unmanage_idle_id, g_source_remove);
|
||||
|
||||
g_signal_emit (window, window_signals[UNMANAGING], 0);
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 6cdfc8abe25fccfd06cac99ae82c0f2acbbdb7c2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||
Date: Thu, 17 Oct 2024 11:49:26 +0200
|
||||
Subject: [PATCH 4/5] window: Don't use cgroup workspace if there already is
|
||||
one
|
||||
|
||||
This fixes a re-entry issue where calling 'meta_window_activate()'
|
||||
assumed it'd activate on the current workspace.
|
||||
---
|
||||
src/core/window.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/window.c b/src/core/window.c
|
||||
index 272d664965..8ad8e5c4c4 100644
|
||||
--- a/src/core/window.c
|
||||
+++ b/src/core/window.c
|
||||
@@ -3812,7 +3812,9 @@ meta_window_activate_full (MetaWindow *window,
|
||||
if (workspace == NULL)
|
||||
{
|
||||
meta_window_read_cgroup (window);
|
||||
- if (window->cgroup &&
|
||||
+ if (!window->workspace &&
|
||||
+ !window->on_all_workspaces &&
|
||||
+ window->cgroup &&
|
||||
window->cgroup->last_active_workspace != NULL &&
|
||||
!window->cgroup->has_startup_sequence &&
|
||||
(!window->cgroup->app_info ||
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
@ -0,0 +1,166 @@
|
||||
From 50d0355bda637a2b214e14c23e767e80066c1084 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||
Date: Fri, 18 Oct 2024 13:23:01 +0200
|
||||
Subject: [PATCH 5/5] cgroup: Get app info from gnome-shell when possible
|
||||
|
||||
Using cgroups alone for getting the app-id is flawed, as there are many
|
||||
situations where the cgroup isn't set up properly, e.g. opening via
|
||||
xdg-open or equivalent. gnome-shell already has a system for associating
|
||||
windows with apps, so reuse this for the cgroup app info.
|
||||
---
|
||||
src/core/display-private.h | 2 ++
|
||||
src/core/display.c | 56 +++++++++++++++++++++++++++++++-------
|
||||
src/core/window.c | 6 ++++
|
||||
3 files changed, 54 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/core/display-private.h b/src/core/display-private.h
|
||||
index 3c7e0898bf..9836e560b3 100644
|
||||
--- a/src/core/display-private.h
|
||||
+++ b/src/core/display-private.h
|
||||
@@ -304,6 +304,8 @@ gboolean meta_cgroup_unref (MetaCGroup *cgroup);
|
||||
void meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||
MetaWorkspace *workspace,
|
||||
guint32 timestamp);
|
||||
+void meta_cgroup_update_app_info (MetaCGroup *cgroup,
|
||||
+ MetaWindow *window);
|
||||
|
||||
/* A "stack id" is a XID or a stamp */
|
||||
#define META_STACK_ID_IS_X11(id) ((id) < G_GUINT64_CONSTANT(0x100000000))
|
||||
diff --git a/src/core/display.c b/src/core/display.c
|
||||
index e99e787fbe..637bc006d8 100644
|
||||
--- a/src/core/display.c
|
||||
+++ b/src/core/display.c
|
||||
@@ -162,6 +162,7 @@ enum
|
||||
WORKAREAS_CHANGED,
|
||||
CLOSING,
|
||||
INIT_XSERVER,
|
||||
+ FIND_APP_INFO,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -515,6 +516,12 @@ meta_display_class_init (MetaDisplayClass *klass)
|
||||
0, g_signal_accumulator_first_wins,
|
||||
NULL, NULL,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_TASK);
|
||||
+ display_signals[FIND_APP_INFO] =
|
||||
+ g_signal_new ("find-app-info",
|
||||
+ G_TYPE_FROM_CLASS (klass),
|
||||
+ G_SIGNAL_RUN_LAST,
|
||||
+ 0, NULL, NULL, NULL,
|
||||
+ G_TYPE_DESKTOP_APP_INFO, 1, META_TYPE_WINDOW);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_COMPOSITOR_MODIFIERS,
|
||||
@@ -1620,25 +1627,32 @@ extract_app_id_from_cgroup (const char *cgroup)
|
||||
}
|
||||
|
||||
static MetaCGroup*
|
||||
-meta_cgroup_new (const char *path)
|
||||
+meta_cgroup_new (const char *path,
|
||||
+ GAppInfo *app_info)
|
||||
{
|
||||
MetaCGroup *cgroup;
|
||||
- g_autofree char *app_id = NULL;
|
||||
|
||||
cgroup = g_new0 (MetaCGroup, 1);
|
||||
cgroup->path = g_file_new_for_path (path);
|
||||
g_ref_count_init (&cgroup->ref_count);
|
||||
|
||||
- app_id = extract_app_id_from_cgroup (path);
|
||||
-
|
||||
- if (app_id)
|
||||
+ if (!app_info)
|
||||
{
|
||||
- g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||
+ g_autofree char *app_id = NULL;
|
||||
|
||||
- app_info = g_desktop_app_info_new (app_id);
|
||||
+ app_id = extract_app_id_from_cgroup (path);
|
||||
+ if (app_id)
|
||||
+ {
|
||||
+ GDesktopAppInfo *desktop_app_info;
|
||||
|
||||
- if (app_info)
|
||||
- cgroup->app_info = G_APP_INFO (g_steal_pointer (&app_info));
|
||||
+ desktop_app_info = g_desktop_app_info_new (app_id);
|
||||
+ if (desktop_app_info)
|
||||
+ cgroup->app_info = G_APP_INFO (desktop_app_info);
|
||||
+ }
|
||||
+ }
|
||||
+ else if (app_info)
|
||||
+ {
|
||||
+ cgroup->app_info = g_object_ref (app_info);
|
||||
}
|
||||
|
||||
return cgroup;
|
||||
@@ -1687,12 +1701,30 @@ meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||
(gpointer *) &cgroup->last_active_workspace);
|
||||
}
|
||||
|
||||
+void
|
||||
+meta_cgroup_update_app_info (MetaCGroup *cgroup,
|
||||
+ MetaWindow *window)
|
||||
+{
|
||||
+ g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||
+
|
||||
+ g_signal_emit (window->display,
|
||||
+ display_signals[FIND_APP_INFO], 0,
|
||||
+ window, &app_info);
|
||||
+
|
||||
+ if (app_info)
|
||||
+ {
|
||||
+ g_clear_object (&cgroup->app_info);
|
||||
+ cgroup->app_info = G_APP_INFO (g_steal_pointer (&app_info));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
meta_display_register_cgroup (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
const char *path)
|
||||
{
|
||||
MetaCGroup *cgroup;
|
||||
+ g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||
|
||||
cgroup = g_hash_table_lookup (display->cgroups, path);
|
||||
|
||||
@@ -1702,7 +1734,11 @@ meta_display_register_cgroup (MetaDisplay *display,
|
||||
return;
|
||||
}
|
||||
|
||||
- cgroup = meta_cgroup_new (path);
|
||||
+ g_signal_emit (display,
|
||||
+ display_signals[FIND_APP_INFO], 0,
|
||||
+ window, &app_info);
|
||||
+
|
||||
+ cgroup = meta_cgroup_new (path, app_info ? G_APP_INFO (app_info) : NULL);
|
||||
g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||
window->cgroup = cgroup;
|
||||
}
|
||||
diff --git a/src/core/window.c b/src/core/window.c
|
||||
index 8ad8e5c4c4..6de815839f 100644
|
||||
--- a/src/core/window.c
|
||||
+++ b/src/core/window.c
|
||||
@@ -8131,6 +8131,9 @@ meta_window_set_wm_class (MetaWindow *window,
|
||||
window->res_class = g_strdup (wm_class);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_WM_CLASS]);
|
||||
+
|
||||
+ if (window->cgroup)
|
||||
+ meta_cgroup_update_app_info (window->cgroup, window);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -8169,6 +8172,9 @@ meta_window_set_gtk_dbus_properties (MetaWindow *window,
|
||||
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_GTK_WINDOW_OBJECT_PATH]);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (window));
|
||||
+
|
||||
+ if (window->cgroup)
|
||||
+ meta_cgroup_update_app_info (window->cgroup, window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
Loading…
Reference in new issue