From 0e0d80159e8644491facec81daadc46c5beefabf Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 13 Apr 2021 18:05:59 +0100 Subject: [PATCH] fix restarts with windows with hideen state win hints this fixes the previous commit 42cc4e8c16f7cd70130560a2b7daf802ee0457ed ith retarts and windows on other desktops --- src/bin/e_atoms.c | 5 ++++- src/bin/e_atoms.h | 1 + src/bin/e_hints.c | 16 ++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/bin/e_atoms.c b/src/bin/e_atoms.c index a1f58ebad..501904132 100644 --- a/src/bin/e_atoms.c +++ b/src/bin/e_atoms.c @@ -14,6 +14,7 @@ E_API Ecore_X_Atom E_ATOM_WINDOW_STATE_CENTERED = 0; E_API Ecore_X_Atom E_ATOM_DESKTOP_FILE = 0; E_API Ecore_X_Atom E_ATOM_ZONE_GEOMETRY = 0; E_API Ecore_X_Atom WL_SURFACE_ID = 0; +E_API Ecore_X_Atom E_ATOM_E_WAS_HERE = 0; #endif /* externally accessible functions */ @@ -33,7 +34,8 @@ e_atoms_init(void) "__E_ATOM_WINDOW_STATE_CENTERED", "__E_ATOM_DESKTOP_FILE", "E_ZONE_GEOMETRY", - "WL_SURFACE_ID" + "WL_SURFACE_ID", + "__E_ATOM_E_WAS_HERE", }; Ecore_X_Atom atoms[EINA_C_ARRAY_LENGTH(atom_names)]; @@ -50,6 +52,7 @@ e_atoms_init(void) E_ATOM_DESKTOP_FILE = atoms[9]; E_ATOM_ZONE_GEOMETRY = atoms[10]; WL_SURFACE_ID = atoms[11]; + E_ATOM_E_WAS_HERE = atoms[12]; #endif return 1; } diff --git a/src/bin/e_atoms.h b/src/bin/e_atoms.h index a22ff657d..7de69f7bc 100644 --- a/src/bin/e_atoms.h +++ b/src/bin/e_atoms.h @@ -25,6 +25,7 @@ extern E_API Ecore_X_Atom E_ATOM_WINDOW_STATE_CENTERED; extern E_API Ecore_X_Atom E_ATOM_ZONE_GEOMETRY; extern E_API Ecore_X_Atom WL_SURFACE_ID; +extern E_API Ecore_X_Atom E_ATOM_E_WAS_HERE; EINTERN int e_atoms_init(void); EINTERN int e_atoms_shutdown(void); diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index ca9d9a6ae..a7f010096 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -1014,7 +1014,7 @@ e_hints_window_state_get(E_Client *ec) #ifdef HAVE_WAYLAND_ONLY (void)ec; #else - unsigned int i, num; + unsigned int i, num, was_here = 0; Ecore_X_Window_State *state; if (!e_client_has_xwindow(ec)) return; @@ -1029,6 +1029,17 @@ e_hints_window_state_get(E_Client *ec) ec->netwm.state.fullscreen = 0; ec->netwm.state.stacking = 0; + if (ecore_x_window_prop_card32_get(e_client_util_win_get(ec), + E_ATOM_E_WAS_HERE, + &was_here, 1) != 1) + { + unsigned int val = 1; + + was_here = 0; + ecore_x_window_prop_card32_set(e_client_util_win_get(ec), + E_ATOM_E_WAS_HERE, + &val, 1); + } ecore_x_netwm_window_state_get(e_client_util_win_get(ec), &state, &num); if (state) { @@ -1069,7 +1080,8 @@ e_hints_window_state_get(E_Client *ec) break; case ECORE_X_WINDOW_STATE_HIDDEN: - ec->netwm.state.hidden = 1; + if (!was_here) + ec->netwm.state.hidden = 1; break; case ECORE_X_WINDOW_STATE_FULLSCREEN: