This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch up/x11-iconify-flake
in repository enlightenment.

View the commit online.

commit a8a1d66ac550cfacd2155c0736e1c4a0a4b4c883
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 15:39:48 2026 -0600

    e_comp_x - keep WM_STATE when a managed window changes its WM_HINTS
    
    WM_HINTS' initial_state tells the window manager which state to map a
    window in. Once the window is mapped, WM_STATE is the window manager's
    to set (ICCCM 4.1.3.1 and 4.1.4). E read initial_state again on every
    WM_HINTS change and stored it as the window's current state.
    
    Elementary updates WM_HINTS to Iconic, then sends WM_CHANGE_STATE to be
    minimised. When E read the hint first, the window looked Iconic
    already, the request was dropped as redundant, and the window stayed on
    screen in WM_STATE Normal. Both are queued back to back, so this only
    happened when E was slow to get to the request: x11-iconify and
    x11-iconify-2heads failed about one full test run in four.
    
    The state is now only read from WM_HINTS for a new window. The branch
    that showed a managed window whose hint turned Normal could only run
    for such a change, and goes.
    
    e_comp_x.c also handles Xwayland windows under Wayland.
    
    x11-iconify now sets the Iconic hint itself, lets E read it, and then
    asks to be minimised, which fails every time without this. With every
    CPU kept busy, x11-iconify and x11-iconify-2heads had failed 3 times in
    4 runs; with this they passed 20 runs out of 20.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/bin/e_comp_x.c           |  9 +++++----
 src/tests/x11/test_iconify.c | 27 ++++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
index 00aabe0ae..1ecca9124 100644
--- a/src/bin/e_comp_x.c
+++ b/src/bin/e_comp_x.c
@@ -3943,6 +3943,10 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec)
                was_here = 0;
              // if we managed this before, then use WM_STATE not initial state
              if (was_here) ec->icccm.state = ecore_x_icccm_state_get(win);
+             /* WM_HINTS' state is the one to map a window in: once it is
+              * mapped, WM_STATE is E's. Elementary sets it to Iconic before
+              * asking to be minimised with WM_CHANGE_STATE. */
+             if (!ec->new_client) ec->icccm.state = state;
              if (ec->new_client)
                {
                   /* clients may unset iconic state when no wm is present */
@@ -3958,10 +3962,7 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec)
                   else
                     {
                        ec->visible = 1;
-                       ec->changes.visible = ec->new_client;
-                       if ((!ec->new_client) &&
-                         (ec->icccm.state == ECORE_X_WINDOW_STATE_HINT_NORMAL))
-                         evas_object_show(ec->frame);
+                       ec->changes.visible = 1;
                     }
                }
              ec->icccm.accepts_focus = accepts_focus;
diff --git a/src/tests/x11/test_iconify.c b/src/tests/x11/test_iconify.c
index 4df630769..d208a639c 100644
--- a/src/tests/x11/test_iconify.c
+++ b/src/tests/x11/test_iconify.c
@@ -1,8 +1,9 @@
 /* Minimise a window, as a client asks with ICCCM's WM_CHANGE_STATE: it
  * must end up Iconic and gone from the screen, whether it is asked once
- * the window is shown or while E is still showing it. What is on the
- * screen is read back from the root window, where E composites, with each
- * window filled with a colour nothing else on the screen has.
+ * the window is shown, while E is still showing it, or after E has read
+ * WM_HINTS saying Iconic, as elementary sets them before asking. What is
+ * on the screen is read back from the root window, where E composites,
+ * with each window filled with a colour nothing else on the screen has.
  *
  * Getting the window back is not tested here: elementary asks for it with
  * _NET_ACTIVE_WINDOW, which the test profile's activation policy ignores,
@@ -100,13 +101,19 @@ _expect_iconic(Evas_Object *win, int x, int y, const char *what)
 int
 main(int argc, char **argv)
 {
-   Evas_Object *shown, *showing;
-   int px, py, qx, qy;
+   Evas_Object *shown, *showing, *hinted;
+   Ecore_X_Window hinted_win;
+   int px, py, qx, qy, hx, hy;
 
    xtk_init(argc, argv, "test-x11-iconify");
    shown = _marked_window_add(50, 50, "iconify once shown");
    evas_object_show(shown);
+   hinted = _marked_window_add(50, 350, "iconify with an iconic hint");
+   evas_object_show(hinted);
    xtk_settle(1.0);
+   xtk_content_point(hinted, W / 2, H / 2, &hx, &hy);
+   if (_screen_pixel(hx, hy) != MARK)
+     xtk_fail("the hinted window is not on the screen before minimising");
    xtk_content_point(shown, W / 2, H / 2, &px, &py);
    if (_screen_pixel(px, py) != MARK)
      xtk_fail("the window is not on the screen before minimising: 0x%06x",
@@ -119,8 +126,18 @@ main(int argc, char **argv)
    _expect_iconic(shown, px, py, "once shown");
    _expect_iconic(showing, qx, qy, "while being shown");
 
+   /* WM_HINTS' state only says how to map a window. */
+   hinted_win = elm_win_xwindow_get(hinted);
+   ecore_x_icccm_hints_set(hinted_win, EINA_TRUE, ECORE_X_WINDOW_STATE_HINT_ICONIC,
+                           0, 0, 0, 0, EINA_FALSE);
+   xtk_settle(1.0);
+   ecore_x_icccm_iconic_request_send(hinted_win, ecore_x_window_root_first_get());
+   xtk_settle(3.0);
+   _expect_iconic(hinted, hx, hy, "after its hint said Iconic");
+
    printf("test-x11-iconify: ok\n");
    evas_object_del(showing);
+   evas_object_del(hinted);
    xtk_shutdown(shown);
    return 0;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to