From 761c3a807b29cf211f7b58315d6a67b92d0aa2e2 Mon Sep 17 00:00:00 2001 From: Ilya Matthew Kuvarzin Date: Mon, 22 Jul 2024 12:29:18 +0200 Subject: [PATCH] Fix: Prevent RemoteAPP window minimization on desktop switch in Gnome - Modified xf_event_PropertyNotify in xf_event.c to check for Gnome session before minimizing the window - Added the session check logic in a new function IsGnome placed in xf_utils - This resolves the issue where RemoteAPP windows were unintentionally minimized when switching desktops in Gnome - Ensured minimal impact on other window managers --- client/X11/xf_event.c | 5 ++++- client/X11/xf_utils.c | 8 ++++++++ client/X11/xf_utils.h | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index ac8ebd1f8..993988d54 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -23,6 +23,8 @@ #include #include +#include + #include #include @@ -35,6 +37,7 @@ #include "xf_input.h" #include "xf_gfx.h" #include "xf_graphics.h" +#include "xf_utils.h" #include "xf_event.h" @@ -982,7 +985,7 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event, if (status) { /* If the window is in the iconic state */ - if (((UINT32)*prop == 3)) + if (((UINT32)*prop == 3) && !IsGnome()) { minimized = TRUE; if (appWindow) diff --git a/client/X11/xf_utils.c b/client/X11/xf_utils.c index b68a73dc1..7240abbb9 100644 --- a/client/X11/xf_utils.c +++ b/client/X11/xf_utils.c @@ -18,7 +18,9 @@ * limitations under the License. */ +#include #include +#include #include "xf_utils.h" @@ -150,3 +152,9 @@ int LogDynAndXGetWindowProperty_ex(wLog* log, const char* file, const char* fkt, actual_type_return, actual_format_return, nitems_return, bytes_after_return, prop_return); } + +BOOL IsGnome(void) +{ + char* env = getenv("DESKTOP_SESSION"); + return (env != NULL && strcmp(env, "gnome") == 0); +} diff --git a/client/X11/xf_utils.h b/client/X11/xf_utils.h index 40dc2a27a..95d849ebd 100644 --- a/client/X11/xf_utils.h +++ b/client/X11/xf_utils.h @@ -20,6 +20,7 @@ #pragma once #include +#include #include @@ -89,3 +90,5 @@ int LogTagAndXConvertSelection_ex(const char* tag, const char* file, const char* int LogDynAndXConvertSelection_ex(wLog* log, const char* file, const char* fkt, size_t line, Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time); + +BOOL IsGnome(void);