1
0
Fork 0

1:46.3.1-2: Add mr3252 & Unify the shell tray icon fixes

Signed-off-by: Mingi Sung <sungmg@saltyming.net>
This commit is contained in:
Mingi Sung 2024-07-02 17:49:24 +09:00
parent e6564141d8
commit 88505d9c59
Signed by: sungmg
GPG key ID: 41BAFD6FFD8036C5
9 changed files with 617 additions and 484 deletions

View file

@ -1,7 +1,7 @@
pkgbase = gnome-shell-performance
pkgdesc = Next generation desktop shell | Attempts to improve performances with non-upstreamed merge-requests and frequent stable branch resync
pkgver = 46.3.1
pkgrel = 1
pkgrel = 2
epoch = 1
url = https://wiki.gnome.org/Projects/GnomeShell
arch = x86_64
@ -38,25 +38,16 @@ pkgbase = gnome-shell-performance
depends = upower
source = git+https://gitlab.gnome.org/GNOME/gnome-shell.git#commit=52fd93196c1c61b34a571c9d7940fda22576e1c1
source = git+https://gitlab.gnome.org/GNOME/libgnome-volume-control.git#commit=5f9768a2eac29c1ed56f1fbb449a77a3523683b6
source = build-Add-explicit-dependency-on-Xfixes.patch
source = shell-tray-icon-Trigger-a-relayout-when-the-underneath-xe.patch
source = shell-tray-icon-Use-available-space-when-that-s-defined.patch
source = tray-na-xembed-Destroy-socket-window-when-ending-the-embe.patch
source = tray-na-xembed-Use-XShape-to-remove-input-on-socket-windo.patch
source = mr3252.patch
source = fix-tray-offscreen-xwindows.patch
sha256sums = 51302aa72f160948e2e45f8de6978666b268e18ddbc88f377a075e2309651076
sha256sums = 587319b45ff7d989635aed0c3bd9ef834d6e53ae46788cb6ba083d42d7e63855
sha256sums = 512e3116ae9eea5b9d36092cd05074da86d37c911144f3d66df95da0d2d60353
sha256sums = a3eda616996980f6f27c58c6b0d9c0d51094e7ad9c52f809a2a7f8eac9a2fbd9
sha256sums = 612dcb05347295893771396c8cfb993ec66871f04b9b6b93e188369cb12bdf2c
sha256sums = fcfec78b92f027e73958cc3e4b740d38db719b8185c79b040571a297d42056b1
sha256sums = 9c51c48b3b7c6e5851630eb74289ab7897abca9226a89075a8b225fda2bda255
sha256sums = 29abd82509db22abb4ce1b3318c9d7bf6cc23ba28d0c222412c273d784eacf1d
sha256sums = 065daaadcb037ebe4a449bc82a74d078243ec9a6f82e2c015d6ebcb7d95ee622
b2sums = 1ab8d447e52f554634dc5d80628615e2628c2e9ee2f37c5c7b01cadf33c160f64c9fdd04a1fbe1b0bbc619d7128a5364ca650398c844e505d0783d4be5b223d6
b2sums = e31ae379039dfc345e8032f7b9803a59ded075fc52457ba1553276d3031e7025d9304a7f2167a01be2d54c5e121bae00a2824a9c5ccbf926865d0b24520bb053
b2sums = bcd22b41f9ed65db461bab3460954b15345c3f72fb4da99cae702627d69bef25c8689464cb3ac37ef23b38ea90b18cf2486a947aa9f8dae4f69915367ee3db16
b2sums = f8e7d2e5e7717b8610d53393dab97e0af181d8eed3d95988357347f57864e88f5339ce67f22ccef86d30d19c8a03b02e5938bc23c23db37f41e67482a133c3b4
b2sums = d13b586f9be8e4088f8cefa3c63e4e1143f8b7206a8c05fc4646dbdf2e931260da531ad2d2393c47e85e7a6f64dd76b36ea9884ce16246246bf116c657f90163
b2sums = f054d5dd341c45ed2accf06f3755096fb1e96aca04106fcda725115eee8e7c8dfc5b27e4ecd93df020524988a9559a25a052b2fa16d7ec48c178a4329ab7932a
b2sums = be45ea9d9c793ed9ba7f7cdbdaefc13868619db0502d73ba1ed3a3f2dd8b40d72c42facbce9598245fc802ad042e785a4515b6ea04015104eec88a0035cf8129
b2sums = bacf1db67096ebd3690de2d0a01ee1b0ba1ea3094c7539eff05e398acc230164724b3c872e468ad992409501fb027026bfad35e387be150e4dafd6be81a68841
b2sums = 2d923a01c48b2ea5c25fe10e40cd81e8ed49c0adc0660211b1211529a5b98040dd0ae1a406e6f250b051e7db6d47e00a1ba7e9540cd5aecc466b92ee3d2aed4e
pkgname = gnome-shell-performance
groups = gnome

View file

@ -10,8 +10,8 @@
### PACKAGE OPTIONS
## MERGE REQUESTS SELECTION
# Merge Requests List: ()
_merge_requests_to_use=()
# Merge Requests List: ('3252')
_merge_requests_to_use=('3252')
## Disable building the DOCS package (Enabled if not set)
# Remember to unset this variable when producing .SRCINFO
@ -30,7 +30,7 @@ else
pkgname=(gnome-shell-performance gnome-shell-performance-docs)
fi
pkgver=46.3.1
pkgrel=1
pkgrel=2
epoch=1
pkgdesc="Next generation desktop shell | Attempts to improve performances with non-upstreamed merge-requests and frequent stable branch resync"
url="https://wiki.gnome.org/Projects/GnomeShell"
@ -80,26 +80,17 @@ _commit=52fd93196c1c61b34a571c9d7940fda22576e1c1 # tags/46.3.1^0
source=(
"git+https://gitlab.gnome.org/GNOME/gnome-shell.git#commit=$_commit"
"git+https://gitlab.gnome.org/GNOME/libgnome-volume-control.git#commit=5f9768a2eac29c1ed56f1fbb449a77a3523683b6"
"build-Add-explicit-dependency-on-Xfixes.patch"
"shell-tray-icon-Trigger-a-relayout-when-the-underneath-xe.patch"
"shell-tray-icon-Use-available-space-when-that-s-defined.patch"
"tray-na-xembed-Destroy-socket-window-when-ending-the-embe.patch"
"tray-na-xembed-Use-XShape-to-remove-input-on-socket-windo.patch"
'mr3252.patch'
'fix-tray-offscreen-xwindows.patch'
)
sha256sums=('51302aa72f160948e2e45f8de6978666b268e18ddbc88f377a075e2309651076'
'587319b45ff7d989635aed0c3bd9ef834d6e53ae46788cb6ba083d42d7e63855'
'512e3116ae9eea5b9d36092cd05074da86d37c911144f3d66df95da0d2d60353'
'a3eda616996980f6f27c58c6b0d9c0d51094e7ad9c52f809a2a7f8eac9a2fbd9'
'612dcb05347295893771396c8cfb993ec66871f04b9b6b93e188369cb12bdf2c'
'fcfec78b92f027e73958cc3e4b740d38db719b8185c79b040571a297d42056b1'
'9c51c48b3b7c6e5851630eb74289ab7897abca9226a89075a8b225fda2bda255')
'29abd82509db22abb4ce1b3318c9d7bf6cc23ba28d0c222412c273d784eacf1d'
'065daaadcb037ebe4a449bc82a74d078243ec9a6f82e2c015d6ebcb7d95ee622')
b2sums=('1ab8d447e52f554634dc5d80628615e2628c2e9ee2f37c5c7b01cadf33c160f64c9fdd04a1fbe1b0bbc619d7128a5364ca650398c844e505d0783d4be5b223d6'
'e31ae379039dfc345e8032f7b9803a59ded075fc52457ba1553276d3031e7025d9304a7f2167a01be2d54c5e121bae00a2824a9c5ccbf926865d0b24520bb053'
'bcd22b41f9ed65db461bab3460954b15345c3f72fb4da99cae702627d69bef25c8689464cb3ac37ef23b38ea90b18cf2486a947aa9f8dae4f69915367ee3db16'
'f8e7d2e5e7717b8610d53393dab97e0af181d8eed3d95988357347f57864e88f5339ce67f22ccef86d30d19c8a03b02e5938bc23c23db37f41e67482a133c3b4'
'd13b586f9be8e4088f8cefa3c63e4e1143f8b7206a8c05fc4646dbdf2e931260da531ad2d2393c47e85e7a6f64dd76b36ea9884ce16246246bf116c657f90163'
'f054d5dd341c45ed2accf06f3755096fb1e96aca04106fcda725115eee8e7c8dfc5b27e4ecd93df020524988a9559a25a052b2fa16d7ec48c178a4329ab7932a'
'be45ea9d9c793ed9ba7f7cdbdaefc13868619db0502d73ba1ed3a3f2dd8b40d72c42facbce9598245fc802ad042e785a4515b6ea04015104eec88a0035cf8129')
'bacf1db67096ebd3690de2d0a01ee1b0ba1ea3094c7539eff05e398acc230164724b3c872e468ad992409501fb027026bfad35e387be150e4dafd6be81a68841'
'2d923a01c48b2ea5c25fe10e40cd81e8ed49c0adc0660211b1211529a5b98040dd0ae1a406e6f250b051e7db6d47e00a1ba7e9540cd5aecc466b92ee3d2aed4e')
pkgver() {
cd $_pkgname
@ -110,23 +101,23 @@ pick_mr() {
for mr in "${_merge_requests_to_use[@]}"; do
if [ "$1" = "$mr" ]; then
if [ "$2" = "merge" ] || [ -z "$2" ]; then
echo "Downloading then Merging $1..."
msg2 "Downloading then Merging $1..."
curl -O "https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/$mr.diff"
git apply "$mr.diff"
elif [ "$3" = "revert" ]; then
echo "Reverting $1..."
msg2 "Reverting $1..."
git revert "$2" --no-commit
elif [ "$3" = "patch" ]; then
if [ -e ../"$2" ]; then
echo "Patching with $2..."
msg2 "Patching with $2..."
patch -Np1 -i ../"$2"
else
echo "Downloading $mr as $2 then patching..."
msg2 "Downloading $mr as $2 then patching..."
curl -O "https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/$mr.diff" -o "$2"
patch -Np1 -i "$2"
fi
else
echo "ERROR: wrong argument given: $2"
msg2 "ERROR: wrong argument given: $2"
fi
break
fi
@ -147,12 +138,8 @@ prepare() {
# https://github.com/ubuntu/gnome-shell-extension-appindicator/issues/439
# https://bugs.launchpad.net/ubuntu/+source/gnome-shell-extension-appindicator/+bug/2012388
msg2 "Patching with the shell tray icon patches..."
patch -Np1 -i ../build-Add-explicit-dependency-on-Xfixes.patch
patch -Np1 -i ../shell-tray-icon-Trigger-a-relayout-when-the-underneath-xe.patch
patch -Np1 -i ../shell-tray-icon-Use-available-space-when-that-s-defined.patch
patch -Np1 -i ../tray-na-xembed-Destroy-socket-window-when-ending-the-embe.patch
patch -Np1 -i ../tray-na-xembed-Use-XShape-to-remove-input-on-socket-windo.patch
msg2 "Applying the shell tray icon patches..."
patch -Np1 -i ../fix-tray-offscreen-xwindows.patch
# git remote add verde https://gitlab.gnome.org/verdre/gnome-shell.git || true
# git fetch verde
@ -184,6 +171,18 @@ prepare() {
# 4. Merged: MR approved and it changes commited to master.
#
# Generally, a MR status oscillate between 2 and 3 and then becomes 4.
# Title: st/theme-node: Forget properties cache on theme changes
# Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
# URL: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3252
# Type: 3
# Status: 2
# Comment: Closes:
# https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7339
# https://github.com/micheleg/dash-to-dock/issues/2243
# https://github.com/micheleg/dash-to-dock/issues/2179
pick_mr '3252' 'mr3252.patch' 'patch'
}
build() {

View file

@ -1,40 +0,0 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 22:33:43 +0200
Subject: build: Add explicit dependency on Xfixes
We use the xfixes extensions in tray icons but we rely on the dependency
brought to us from other libraries as mutter but let's make it explicit
(cherry picked from commit f0c5033b3ccd02a081dd18ac21d0b673474fe14f)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
---
meson.build | 1 +
src/tray/meson.build | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 30864ce..ac166d5 100644
--- a/meson.build
+++ b/meson.build
@@ -91,6 +91,7 @@ polkit_dep = dependency('polkit-agent-1', version: polkit_req)
startup_dep = dependency('libstartup-notification-1.0', version: startup_req)
ibus_dep = dependency('ibus-1.0', version: ibus_req)
x11_dep = dependency('x11')
+xfixes_dep = dependency('xfixes')
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
gnome_desktop_dep = dependency('gnome-desktop-4', version: gnome_desktop_req)
diff --git a/src/tray/meson.build b/src/tray/meson.build
index 1a86bcb..2fc73f3 100644
--- a/src/tray/meson.build
+++ b/src/tray/meson.build
@@ -9,6 +9,6 @@ tray_sources = [
libtray = static_library('tray', tray_sources,
c_args: ['-DG_LOG_DOMAIN="notification_area"'],
- dependencies: [mutter_dep, mtk_dep],
+ dependencies: [mutter_dep, mtk_dep, xfixes_dep],
include_directories: conf_inc
)

View file

@ -0,0 +1,470 @@
From 5b269c78afa74eabd3dcd9b479c4aa9f7a0f4f2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 22:33:43 +0200
Subject: [PATCH 1/5] build: Add explicit dependency on Xfixes
We use the xfixes extensions in tray icons but we rely on the dependency
brought to us from other libraries as mutter but let's make it explicit
(cherry picked from commit f0c5033b3ccd02a081dd18ac21d0b673474fe14f)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
---
meson.build | 1 +
src/tray/meson.build | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 923a5228e..a9837fcda 100644
--- a/meson.build
+++ b/meson.build
@@ -88,6 +88,7 @@ mutter_dep = dependency(libmutter_pc, version: mutter_req)
polkit_dep = dependency('polkit-agent-1', version: polkit_req)
ibus_dep = dependency('ibus-1.0', version: ibus_req)
x11_dep = dependency('x11')
+xfixes_dep = dependency('xfixes')
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
gnome_desktop_dep = dependency('gnome-desktop-4', version: gnome_desktop_req)
diff --git a/src/tray/meson.build b/src/tray/meson.build
index 1a86bcbab..2fc73f3a4 100644
--- a/src/tray/meson.build
+++ b/src/tray/meson.build
@@ -9,6 +9,6 @@ tray_sources = [
libtray = static_library('tray', tray_sources,
c_args: ['-DG_LOG_DOMAIN="notification_area"'],
- dependencies: [mutter_dep, mtk_dep],
+ dependencies: [mutter_dep, mtk_dep, xfixes_dep],
include_directories: conf_inc
)
--
2.45.2
From 7dffc838ea6b137dbd80b0c4a5e0028b7ec59079 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 04:20:42 +0200
Subject: [PATCH 2/5] shell-tray-icon: Trigger a relayout when the underneath
xembeded size changes
(cherry picked from commit 8ebb71d9fdb8990e4e9731cc7662dbf704ce42a8)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
---
src/shell-tray-icon.c | 4 ++++
src/tray/na-xembed.c | 18 ++++++++++++++++++
src/tray/na-xembed.h | 1 +
3 files changed, 23 insertions(+)
diff --git a/src/shell-tray-icon.c b/src/shell-tray-icon.c
index 3eee5f5bf..1ec2239f8 100644
--- a/src/shell-tray-icon.c
+++ b/src/shell-tray-icon.c
@@ -261,6 +261,10 @@ shell_tray_icon_set_child (ShellTrayIcon *tray_icon,
"window-created",
G_CALLBACK (shell_tray_icon_window_created_cb),
tray_icon);
+
+ g_signal_connect_object (tray_child, "reconfigured",
+ G_CALLBACK (clutter_actor_queue_relayout),
+ tray_icon, G_CONNECT_SWAPPED);
}
/*
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index 59b1071b8..378a411f9 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -88,6 +88,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (NaXembed, na_xembed, G_TYPE_OBJECT)
enum {
PLUG_ADDED,
PLUG_REMOVED,
+ RECONFIGURED,
LAST_SIGNAL
};
@@ -524,6 +525,15 @@ xembed_filter_func (MetaX11Display *x11_display,
}
break;
}
+ case ConfigureNotify:
+ {
+ XConfigureEvent *xce = &xevent->xconfigure;
+
+ if (xce->window == priv->socket_window)
+ g_signal_emit (xembed, signals[RECONFIGURED], 0);
+
+ break;
+ }
case DestroyNotify:
{
XDestroyWindowEvent *xdwe = &xevent->xdestroywindow;
@@ -718,6 +728,14 @@ na_xembed_class_init (NaXembedClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
+ signals[RECONFIGURED] =
+ g_signal_new ("reconfigured",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NaXembedClass, reconfigured),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
+
props[PROP_X11_DISPLAY] =
g_param_spec_object ("x11-display",
"x11-display",
diff --git a/src/tray/na-xembed.h b/src/tray/na-xembed.h
index ea8f9f44c..730c2cb3a 100644
--- a/src/tray/na-xembed.h
+++ b/src/tray/na-xembed.h
@@ -36,6 +36,7 @@ struct _NaXembedClass
void (* plug_added) (NaXembed *xembed);
void (* plug_removed) (NaXembed *xembed);
+ void (* reconfigured) (NaXembed *xembed);
};
MetaX11Display * na_xembed_get_x11_display (NaXembed *xembed);
--
2.45.2
From b4fb27cbdc2be7a9d6e408a4332c8eecbb0c3b9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 04:18:50 +0200
Subject: [PATCH 3/5] shell-tray-icon: Use available space when that's defined
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7613
(cherry picked from commit b10bfe1f9ce2b7794103f54bcf249f935678b5f7)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
---
src/shell-tray-icon.c | 4 ++++
src/tray/na-xembed.c | 29 +++++++++++++++++++++++++++++
src/tray/na-xembed.h | 4 ++++
3 files changed, 37 insertions(+)
diff --git a/src/shell-tray-icon.c b/src/shell-tray-icon.c
index 1ec2239f8..ddf40dde3 100644
--- a/src/shell-tray-icon.c
+++ b/src/shell-tray-icon.c
@@ -185,6 +185,10 @@ shell_tray_icon_allocate (ClutterActor *actor,
CLUTTER_ACTOR_CLASS (shell_tray_icon_parent_class)->allocate (actor, box);
+ na_xembed_set_available_size (NA_XEMBED (tray_icon->tray_child),
+ roundf (clutter_actor_box_get_width (box)),
+ roundf (clutter_actor_box_get_height (box)));
+
/* Find the actor's new coordinates in terms of the stage.
*/
clutter_actor_get_transformed_position (actor, &wx, &wy);
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index 378a411f9..e7c4b330a 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -42,6 +42,8 @@ struct _NaXembedPrivate
int request_height;
int current_width;
int current_height;
+ int available_width;
+ int available_height;
int resize_count;
int xembed_version;
@@ -141,6 +143,8 @@ na_xembed_end_embedding (NaXembed *xembed)
priv->current_width = 0;
priv->current_height = 0;
priv->resize_count = 0;
+ priv->available_width = -1;
+ priv->available_height = -1;
g_clear_handle_id (&priv->resize_id, g_source_remove);
}
@@ -186,6 +190,11 @@ na_xembed_synchronize_size (NaXembed *xembed)
width = priv->request_width;
height = priv->request_height;
+ if (priv->available_width >= 0)
+ width = priv->available_width;
+ if (priv->available_height >= 0)
+ height = priv->available_height;
+
XMoveResizeWindow (xdisplay,
priv->socket_window,
x, y,
@@ -750,6 +759,10 @@ na_xembed_class_init (NaXembedClass *klass)
static void
na_xembed_init (NaXembed *xembed)
{
+ NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+
+ priv->available_width = -1;
+ priv->available_height = -1;
}
void
@@ -814,6 +827,22 @@ na_xembed_get_size (NaXembed *xembed,
*height = priv->request_height;
}
+void
+na_xembed_set_available_size (NaXembed *xembed,
+ int width,
+ int height)
+{
+ NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+
+ if (priv->available_width == width && priv->available_height == height)
+ return;
+
+ priv->available_width = width;
+ priv->available_height = height;
+
+ na_xembed_resize (xembed);
+}
+
void
na_xembed_get_root_position (NaXembed *xembed,
int *x,
diff --git a/src/tray/na-xembed.h b/src/tray/na-xembed.h
index 730c2cb3a..a5a4faede 100644
--- a/src/tray/na-xembed.h
+++ b/src/tray/na-xembed.h
@@ -60,6 +60,10 @@ void na_xembed_get_size (NaXembed *xembed,
int *width,
int *height);
+void na_xembed_set_available_size (NaXembed *xembed,
+ int width,
+ int height);
+
void na_xembed_set_background_color (NaXembed *xembed,
const ClutterColor *color);
--
2.45.2
From e6956f9b437156940f0baff6b413f2a2d98fd530 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 05:56:48 +0200
Subject: [PATCH 4/5] tray/na-xembed: Destroy socket window when ending the
embedding
Currently when embedding a tray icon is ended we are leaving the X11
socket window around as we don't really destroy it, while we're just
listening for its child destruction.
So, when embedding is ending we need to make sure that:
- If the plug window is still alive, move it back to its old parent
(normally that's the root window, but we query for it, to be sure)
- If the plug window has been already destroyed or reparented (by us or
by something else), we've to just destroy the socket window
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7614
(cherry picked from commit 50a6e1e3ceb18e52f87534507ccd49884d7f53eb)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
---
src/tray/na-xembed.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index e7c4b330a..17ce31541 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -35,6 +35,7 @@ struct _NaXembedPrivate
MetaX11Display *x11_display;
Window socket_window;
Window plug_window;
+ Window old_parent;
int root_x;
int root_y;
@@ -139,7 +140,22 @@ na_xembed_end_embedding (NaXembed *xembed)
{
NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+ if (priv->socket_window)
+ {
+ Display *xdisplay = meta_x11_display_get_xdisplay (priv->x11_display);
+
+ if (priv->plug_window && priv->old_parent)
+ XReparentWindow (xdisplay,
+ priv->plug_window,
+ priv->old_parent,
+ 0, 0);
+
+ XDestroyWindow (xdisplay, priv->socket_window);
+ priv->socket_window = None;
+ }
+
priv->plug_window = None;
+ priv->old_parent = None;
priv->current_width = 0;
priv->current_height = 0;
priv->resize_count = 0;
@@ -413,6 +429,18 @@ na_xembed_add_window (NaXembed *xembed,
&socket_attrs);
XUnmapWindow (xdisplay, priv->plug_window); /* Shouldn't actually be necessary for XEMBED, but just in case */
+
+ if (!priv->old_parent)
+ {
+ g_autofree Window *children = NULL;
+ unsigned int n_children;
+ Window root;
+
+ if (!XQueryTree (xdisplay, priv->plug_window, &root, &priv->old_parent,
+ &children, &n_children))
+ priv->old_parent = meta_x11_display_get_xroot (priv->x11_display);
+ }
+
XReparentWindow (xdisplay,
priv->plug_window,
priv->socket_window,
@@ -550,10 +578,14 @@ xembed_filter_func (MetaX11Display *x11_display,
/* Note that we get destroy notifies both from SubstructureNotify on
* our window and StructureNotify on socket->plug_window
*/
+ if (priv->socket_window && xdwe->window == priv->socket_window)
+ priv->socket_window = None;
+
if (priv->plug_window && (xdwe->window == priv->plug_window))
{
g_object_ref (xembed);
g_signal_emit (xembed, signals[PLUG_REMOVED], 0);
+ priv->plug_window = None;
na_xembed_end_embedding (xembed);
g_object_unref (xembed);
}
@@ -618,6 +650,7 @@ xembed_filter_func (MetaX11Display *x11_display,
{
g_object_ref (xembed);
g_signal_emit (xembed, signals[PLUG_REMOVED], 0);
+ priv->old_parent = None;
na_xembed_end_embedding (xembed);
g_object_unref (xembed);
}
@@ -683,7 +716,7 @@ na_xembed_finalize (GObject *object)
if (priv->x11_display && priv->event_func_id)
meta_x11_display_remove_event_func (priv->x11_display, priv->event_func_id);
- if (priv->plug_window)
+ if (priv->plug_window || priv->socket_window)
na_xembed_end_embedding (xembed);
G_OBJECT_CLASS (na_xembed_parent_class)->finalize (object);
--
2.45.2
From 156b235bd28085739318ec50cc532062206c3a18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 22:34:58 +0200
Subject: [PATCH 5/5] tray/na-xembed: Use XShape to remove input on socket
window
We don't want this window to take any input as, a part from blocking the
events on the shell representation itself, they may potentially make the
plugged window to do anything with the event is processing (such as
showing tooltips). And we don't want this since we only want to send to
those windows only the synthetic events that we explicitly control.
This was already the case before of commit ab60902058 but a similar
approach was not replicated, leading to input events being fully
processed from tray icons plugs.
It requires adding an explicit build dependency on Xext, but this is
something that mutter already depends on so not really a new dependency
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7613
(cherry picked from commit 075f9d72459d08a711feca3dc3c51a14c5f73bdc)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
---
meson.build | 1 +
src/tray/meson.build | 2 +-
src/tray/na-xembed.c | 15 +++++++++++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index a9837fcda..3147edaf4 100644
--- a/meson.build
+++ b/meson.build
@@ -88,6 +88,7 @@ mutter_dep = dependency(libmutter_pc, version: mutter_req)
polkit_dep = dependency('polkit-agent-1', version: polkit_req)
ibus_dep = dependency('ibus-1.0', version: ibus_req)
x11_dep = dependency('x11')
+xext_dep = dependency('xext')
xfixes_dep = dependency('xfixes')
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
gnome_desktop_dep = dependency('gnome-desktop-4', version: gnome_desktop_req)
diff --git a/src/tray/meson.build b/src/tray/meson.build
index 2fc73f3a4..c91e94044 100644
--- a/src/tray/meson.build
+++ b/src/tray/meson.build
@@ -9,6 +9,6 @@ tray_sources = [
libtray = static_library('tray', tray_sources,
c_args: ['-DG_LOG_DOMAIN="notification_area"'],
- dependencies: [mutter_dep, mtk_dep, xfixes_dep],
+ dependencies: [mutter_dep, mtk_dep, xfixes_dep, xext_dep],
include_directories: conf_inc
)
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index 17ce31541..1d179af87 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -24,6 +24,7 @@
#include "na-xembed.h"
#include <mtk/mtk-x11.h>
+#include <X11/extensions/shape.h>
#include <X11/extensions/Xfixes.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -388,6 +389,7 @@ na_xembed_add_window (NaXembed *xembed,
{
XSetWindowAttributes socket_attrs;
XWindowAttributes plug_attrs;
+ int shape_major, shape_minor;
int result;
result = XGetWindowAttributes (xdisplay, priv->plug_window, &plug_attrs);
@@ -445,6 +447,19 @@ na_xembed_add_window (NaXembed *xembed,
priv->plug_window,
priv->socket_window,
0, 0);
+
+ /* Set an empty input shape on the window so that the socket does not
+ * get any input. Without this we the tray may still get events and for
+ * example show tooltips on hover which we don't want.
+ * This is the quickest way to achieve this, without having to deal these
+ * windows with specific code in mutter.
+ */
+ if (XShapeQueryExtension (xdisplay, &shape_major, &shape_minor))
+ {
+ XShapeSelectInput (xdisplay, priv->socket_window, NoEventMask);
+ XShapeCombineRectangles (xdisplay, priv->socket_window, ShapeInput,
+ 0, 0, NULL, 0, ShapeSet, 0);
+ }
}
priv->have_size = FALSE;
--
2.45.2

112
mr3252.patch Normal file
View file

@ -0,0 +1,112 @@
From 2599c432efdc16a4e4fe04fa7ac7a87ce6df8975 Mon Sep 17 00:00:00 2001
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Thu, 28 Mar 2024 14:45:26 +0800
Subject: [PATCH 1/2] st/theme-node: Forget properties cache before unref'ing
the theme
Which the properties point into.
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
---
src/st/st-theme-node.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index 51e6d2174..b471ad72b 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -102,6 +102,7 @@ st_theme_node_dispose (GObject *gobject)
st_theme_node_paint_state_free (&node->cached_state);
+ maybe_free_properties (node);
g_clear_object (&node->theme);
G_OBJECT_CLASS (st_theme_node_parent_class)->dispose (gobject);
@@ -117,8 +118,6 @@ st_theme_node_finalize (GObject *object)
g_strfreev (node->pseudo_classes);
g_free (node->inline_style);
- maybe_free_properties (node);
-
g_clear_pointer (&node->font_desc, pango_font_description_free);
g_clear_pointer (&node->box_shadow, st_shadow_unref);
--
2.45.2
From ebbebd4af1d6f3c2a2958ddd978220ac7d4c1771 Mon Sep 17 00:00:00 2001
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Thu, 28 Mar 2024 14:58:54 +0800
Subject: [PATCH 2/2] st/theme-node: Forget properties cache on stylesheet
change
To avoid `node->properties` pointing to freed memory after each
`st_theme_unload_stylesheet`, flush the cache that is `node->properties`.
They will be reloaded as soon as they are required by `ensure_properties`.
And yes `node->stylesheets_changed_id` already existed, but was unused.
Why not just fix Croco? Croco does not use proper reference counting
everywhere it should, and retrofitting it would be difficult due to the
recursive nature of `CRDeclaration`.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7339
... but mostly reported in
https://github.com/micheleg/dash-to-dock/issues/2179 and its duplicates.
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
---
src/st/st-theme-node-private.h | 2 +-
src/st/st-theme-node.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/st/st-theme-node-private.h b/src/st/st-theme-node-private.h
index 02eb95e52..b8028925e 100644
--- a/src/st/st-theme-node-private.h
+++ b/src/st/st-theme-node-private.h
@@ -105,7 +105,7 @@ struct _StThemeNode {
int box_shadow_min_width;
int box_shadow_min_height;
- guint stylesheets_changed_id;
+ gulong stylesheets_changed_id;
CoglTexture *border_slices_texture;
CoglPipeline *border_slices_pipeline;
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index b471ad72b..31b27583c 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -75,6 +75,10 @@ maybe_free_properties (StThemeNode *node)
cr_declaration_destroy (node->inline_properties);
node->inline_properties = NULL;
}
+
+ g_clear_signal_handler (&node->stylesheets_changed_id, node->theme);
+
+ node->properties_computed = FALSE;
}
static void
@@ -472,6 +476,16 @@ ensure_properties (StThemeNode *node)
node->n_properties = properties->len;
node->properties = (CRDeclaration **)g_ptr_array_free (properties, FALSE);
}
+
+ if (!node->stylesheets_changed_id)
+ {
+ node->stylesheets_changed_id =
+ g_signal_connect_object (node->theme,
+ "custom-stylesheets-changed",
+ G_CALLBACK (maybe_free_properties),
+ G_OBJECT (node),
+ G_CONNECT_SWAPPED);
+ }
}
}
--
2.45.2

View file

@ -1,85 +0,0 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 04:20:42 +0200
Subject: shell-tray-icon: Trigger a relayout when the underneath xembeded
size changes
(cherry picked from commit 8ebb71d9fdb8990e4e9731cc7662dbf704ce42a8)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
---
src/shell-tray-icon.c | 4 ++++
src/tray/na-xembed.c | 18 ++++++++++++++++++
src/tray/na-xembed.h | 1 +
3 files changed, 23 insertions(+)
diff --git a/src/shell-tray-icon.c b/src/shell-tray-icon.c
index e1ff1cd..ddf40dd 100644
--- a/src/shell-tray-icon.c
+++ b/src/shell-tray-icon.c
@@ -265,6 +265,10 @@ shell_tray_icon_set_child (ShellTrayIcon *tray_icon,
"window-created",
G_CALLBACK (shell_tray_icon_window_created_cb),
tray_icon);
+
+ g_signal_connect_object (tray_child, "reconfigured",
+ G_CALLBACK (clutter_actor_queue_relayout),
+ tray_icon, G_CONNECT_SWAPPED);
}
/*
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index 447c1cb..873d193 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -91,6 +91,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (NaXembed, na_xembed, G_TYPE_OBJECT)
enum {
PLUG_ADDED,
PLUG_REMOVED,
+ RECONFIGURED,
LAST_SIGNAL
};
@@ -548,6 +549,15 @@ xembed_filter_func (MetaX11Display *x11_display,
}
break;
}
+ case ConfigureNotify:
+ {
+ XConfigureEvent *xce = &xevent->xconfigure;
+
+ if (xce->window == priv->socket_window)
+ g_signal_emit (xembed, signals[RECONFIGURED], 0);
+
+ break;
+ }
case DestroyNotify:
{
XDestroyWindowEvent *xdwe = &xevent->xdestroywindow;
@@ -742,6 +752,14 @@ na_xembed_class_init (NaXembedClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
+ signals[RECONFIGURED] =
+ g_signal_new ("reconfigured",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NaXembedClass, reconfigured),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
+
props[PROP_X11_DISPLAY] =
g_param_spec_object ("x11-display",
"x11-display",
diff --git a/src/tray/na-xembed.h b/src/tray/na-xembed.h
index 751da97..a5a4fae 100644
--- a/src/tray/na-xembed.h
+++ b/src/tray/na-xembed.h
@@ -36,6 +36,7 @@ struct _NaXembedClass
void (* plug_added) (NaXembed *xembed);
void (* plug_removed) (NaXembed *xembed);
+ void (* reconfigured) (NaXembed *xembed);
};
MetaX11Display * na_xembed_get_x11_display (NaXembed *xembed);

View file

@ -1,113 +0,0 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 04:18:50 +0200
Subject: shell-tray-icon: Use available space when that's defined
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7613
(cherry picked from commit b10bfe1f9ce2b7794103f54bcf249f935678b5f7)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
---
src/shell-tray-icon.c | 4 ++++
src/tray/na-xembed.c | 29 +++++++++++++++++++++++++++++
src/tray/na-xembed.h | 4 ++++
3 files changed, 37 insertions(+)
diff --git a/src/shell-tray-icon.c b/src/shell-tray-icon.c
index 3eee5f5..e1ff1cd 100644
--- a/src/shell-tray-icon.c
+++ b/src/shell-tray-icon.c
@@ -185,6 +185,10 @@ shell_tray_icon_allocate (ClutterActor *actor,
CLUTTER_ACTOR_CLASS (shell_tray_icon_parent_class)->allocate (actor, box);
+ na_xembed_set_available_size (NA_XEMBED (tray_icon->tray_child),
+ roundf (clutter_actor_box_get_width (box)),
+ roundf (clutter_actor_box_get_height (box)));
+
/* Find the actor's new coordinates in terms of the stage.
*/
clutter_actor_get_transformed_position (actor, &wx, &wy);
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index 69690f1..447c1cb 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -43,6 +43,8 @@ struct _NaXembedPrivate
int request_height;
int current_width;
int current_height;
+ int available_width;
+ int available_height;
int resize_count;
int xembed_version;
@@ -141,6 +143,8 @@ na_xembed_end_embedding (NaXembed *xembed)
priv->current_width = 0;
priv->current_height = 0;
priv->resize_count = 0;
+ priv->available_width = -1;
+ priv->available_height = -1;
g_clear_handle_id (&priv->resize_id, g_source_remove);
}
@@ -186,6 +190,11 @@ na_xembed_synchronize_size (NaXembed *xembed)
width = priv->request_width;
height = priv->request_height;
+ if (priv->available_width >= 0)
+ width = priv->available_width;
+ if (priv->available_height >= 0)
+ height = priv->available_height;
+
XMoveResizeWindow (xdisplay,
priv->socket_window,
x, y,
@@ -747,6 +756,10 @@ na_xembed_class_init (NaXembedClass *klass)
static void
na_xembed_init (NaXembed *xembed)
{
+ NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+
+ priv->available_width = -1;
+ priv->available_height = -1;
}
void
@@ -811,6 +824,22 @@ na_xembed_get_size (NaXembed *xembed,
*height = priv->request_height;
}
+void
+na_xembed_set_available_size (NaXembed *xembed,
+ int width,
+ int height)
+{
+ NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+
+ if (priv->available_width == width && priv->available_height == height)
+ return;
+
+ priv->available_width = width;
+ priv->available_height = height;
+
+ na_xembed_resize (xembed);
+}
+
void
na_xembed_get_root_position (NaXembed *xembed,
int *x,
diff --git a/src/tray/na-xembed.h b/src/tray/na-xembed.h
index ea8f9f4..751da97 100644
--- a/src/tray/na-xembed.h
+++ b/src/tray/na-xembed.h
@@ -59,6 +59,10 @@ void na_xembed_get_size (NaXembed *xembed,
int *width,
int *height);
+void na_xembed_set_available_size (NaXembed *xembed,
+ int width,
+ int height);
+
void na_xembed_set_background_color (NaXembed *xembed,
const ClutterColor *color);

View file

@ -1,109 +0,0 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 05:56:48 +0200
Subject: tray/na-xembed: Destroy socket window when ending the embedding
Currently when embedding a tray icon is ended we are leaving the X11
socket window around as we don't really destroy it, while we're just
listening for its child destruction.
So, when embedding is ending we need to make sure that:
- If the plug window is still alive, move it back to its old parent
(normally that's the root window, but we query for it, to be sure)
- If the plug window has been already destroyed or reparented (by us or
by something else), we've to just destroy the socket window
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7614
(cherry picked from commit 50a6e1e3ceb18e52f87534507ccd49884d7f53eb)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
---
src/tray/na-xembed.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index 873d193..1d179af 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -36,6 +36,7 @@ struct _NaXembedPrivate
MetaX11Display *x11_display;
Window socket_window;
Window plug_window;
+ Window old_parent;
int root_x;
int root_y;
@@ -140,7 +141,22 @@ na_xembed_end_embedding (NaXembed *xembed)
{
NaXembedPrivate *priv = na_xembed_get_instance_private (xembed);
+ if (priv->socket_window)
+ {
+ Display *xdisplay = meta_x11_display_get_xdisplay (priv->x11_display);
+
+ if (priv->plug_window && priv->old_parent)
+ XReparentWindow (xdisplay,
+ priv->plug_window,
+ priv->old_parent,
+ 0, 0);
+
+ XDestroyWindow (xdisplay, priv->socket_window);
+ priv->socket_window = None;
+ }
+
priv->plug_window = None;
+ priv->old_parent = None;
priv->current_width = 0;
priv->current_height = 0;
priv->resize_count = 0;
@@ -415,6 +431,18 @@ na_xembed_add_window (NaXembed *xembed,
&socket_attrs);
XUnmapWindow (xdisplay, priv->plug_window); /* Shouldn't actually be necessary for XEMBED, but just in case */
+
+ if (!priv->old_parent)
+ {
+ g_autofree Window *children = NULL;
+ unsigned int n_children;
+ Window root;
+
+ if (!XQueryTree (xdisplay, priv->plug_window, &root, &priv->old_parent,
+ &children, &n_children))
+ priv->old_parent = meta_x11_display_get_xroot (priv->x11_display);
+ }
+
XReparentWindow (xdisplay,
priv->plug_window,
priv->socket_window,
@@ -565,10 +593,14 @@ xembed_filter_func (MetaX11Display *x11_display,
/* Note that we get destroy notifies both from SubstructureNotify on
* our window and StructureNotify on socket->plug_window
*/
+ if (priv->socket_window && xdwe->window == priv->socket_window)
+ priv->socket_window = None;
+
if (priv->plug_window && (xdwe->window == priv->plug_window))
{
g_object_ref (xembed);
g_signal_emit (xembed, signals[PLUG_REMOVED], 0);
+ priv->plug_window = None;
na_xembed_end_embedding (xembed);
g_object_unref (xembed);
}
@@ -633,6 +665,7 @@ xembed_filter_func (MetaX11Display *x11_display,
{
g_object_ref (xembed);
g_signal_emit (xembed, signals[PLUG_REMOVED], 0);
+ priv->old_parent = None;
na_xembed_end_embedding (xembed);
g_object_unref (xembed);
}
@@ -698,7 +731,7 @@ na_xembed_finalize (GObject *object)
if (priv->x11_display && priv->event_func_id)
meta_x11_display_remove_event_func (priv->x11_display, priv->event_func_id);
- if (priv->plug_window)
+ if (priv->plug_window || priv->socket_window)
na_xembed_end_embedding (xembed);
G_OBJECT_CLASS (na_xembed_parent_class)->finalize (object);

View file

@ -1,92 +0,0 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 1 May 2024 22:34:58 +0200
Subject: tray/na-xembed: Use XShape to remove input on socket window
We don't want this window to take any input as, a part from blocking the
events on the shell representation itself, they may potentially make the
plugged window to do anything with the event is processing (such as
showing tooltips). And we don't want this since we only want to send to
those windows only the synthetic events that we explicitly control.
This was already the case before of commit ab60902058 but a similar
approach was not replicated, leading to input events being fully
processed from tray icons plugs.
It requires adding an explicit build dependency on Xext, but this is
something that mutter already depends on so not really a new dependency
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7613
(cherry picked from commit 075f9d72459d08a711feca3dc3c51a14c5f73bdc)
Origin: https://gitlab.gnome.org/3v1n0/gnome-shell/-/commits/tray-offscreen-xwindows
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2012388
---
meson.build | 1 +
src/tray/meson.build | 2 +-
src/tray/na-xembed.c | 15 +++++++++++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index ac166d5..f85e358 100644
--- a/meson.build
+++ b/meson.build
@@ -91,6 +91,7 @@ polkit_dep = dependency('polkit-agent-1', version: polkit_req)
startup_dep = dependency('libstartup-notification-1.0', version: startup_req)
ibus_dep = dependency('ibus-1.0', version: ibus_req)
x11_dep = dependency('x11')
+xext_dep = dependency('xext')
xfixes_dep = dependency('xfixes')
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
gnome_desktop_dep = dependency('gnome-desktop-4', version: gnome_desktop_req)
diff --git a/src/tray/meson.build b/src/tray/meson.build
index 2fc73f3..c91e940 100644
--- a/src/tray/meson.build
+++ b/src/tray/meson.build
@@ -9,6 +9,6 @@ tray_sources = [
libtray = static_library('tray', tray_sources,
c_args: ['-DG_LOG_DOMAIN="notification_area"'],
- dependencies: [mutter_dep, mtk_dep, xfixes_dep],
+ dependencies: [mutter_dep, mtk_dep, xfixes_dep, xext_dep],
include_directories: conf_inc
)
diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c
index 59b1071..69690f1 100644
--- a/src/tray/na-xembed.c
+++ b/src/tray/na-xembed.c
@@ -24,6 +24,7 @@
#include "na-xembed.h"
#include <mtk/mtk-x11.h>
+#include <X11/extensions/shape.h>
#include <X11/extensions/Xfixes.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -362,6 +363,7 @@ na_xembed_add_window (NaXembed *xembed,
{
XSetWindowAttributes socket_attrs;
XWindowAttributes plug_attrs;
+ int shape_major, shape_minor;
int result;
result = XGetWindowAttributes (xdisplay, priv->plug_window, &plug_attrs);
@@ -407,6 +409,19 @@ na_xembed_add_window (NaXembed *xembed,
priv->plug_window,
priv->socket_window,
0, 0);
+
+ /* Set an empty input shape on the window so that the socket does not
+ * get any input. Without this we the tray may still get events and for
+ * example show tooltips on hover which we don't want.
+ * This is the quickest way to achieve this, without having to deal these
+ * windows with specific code in mutter.
+ */
+ if (XShapeQueryExtension (xdisplay, &shape_major, &shape_minor))
+ {
+ XShapeSelectInput (xdisplay, priv->socket_window, NoEventMask);
+ XShapeCombineRectangles (xdisplay, priv->socket_window, ShapeInput,
+ 0, 0, NULL, 0, ShapeSet, 0);
+ }
}
priv->have_size = FALSE;