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

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit 0e3b789fd214ea9a496803d2ce29321c0677ef93
Author: Alastair Poole <[email protected]>
AuthorDate: Wed Dec 2 07:01:18 2026 +0000

    e_comp_wl - keep minimized clients drawing for live previews
    
    A minimized xdg-shell client can stop drawing when it receives the
    suspended state. Clear that state while any live preview holds an
    iconic preview reference, and restore it when the last one closes.
    Schedule damage when the first reference is taken so a mapped
    minimized client can resume drawing.
    
    IBox and Tasks use the iconic preview reference to keep a live view
    active. Winlist also uses the shared frame mirror. Keep the mirror's
    existing behavior for all callers and notify the shell only for
    Wayland clients.
    
    Built with Wayland and tests enabled. Both xdg-shell preview tests
    passed 20 runs each. The v6 test failed to resume the minimized
    client in a build without the preview notification. The full run
    had 70 passes and four DMA-BUF skips. Both X11 iconify tests failed
    before minimizing, as on the clean baseline.
    
    Co-Authored-By: OpenAI Codex (GPT-6) <[email protected]>
---
 src/bin/e_comp_object.c                   |  10 ++
 src/bin/e_comp_wl.c                       |  30 ++++-
 src/bin/e_comp_wl.h                       |   1 +
 src/modules/wl_desktop_shell/e_mod_main.c |   5 +-
 src/modules/wl_desktop_shell/e_mod_main.h |   1 +
 src/modules/wl_desktop_shell/xdg.c        |  31 ++++-
 src/modules/wl_test/e_mod_main.c          |  49 ++++++-
 src/protocol/wl-test.xml                  |  12 +-
 src/tests/wayland/meson.build             |   3 +
 src/tests/wayland/test_client_preview.c   | 206 ++++++++++++++++++++++++++++++
 10 files changed, 335 insertions(+), 13 deletions(-)

diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c
index e2f931e46..d8ce13b9d 100644
--- a/src/bin/e_comp_object.c
+++ b/src/bin/e_comp_object.c
@@ -2833,6 +2833,11 @@ e_comp_object_iconic_preview_add(Evas_Object *obj)
        (!cw->deleted) && (!e_object_is_del(E_OBJECT(cw->ec))))
      evas_object_smart_callback_call(cw->smart_obj, "visibility_force", cw->ec);
    cw->iconic_preview_visible++;
+#ifdef HAVE_WAYLAND
+   if ((!e_pixmap_is_x(cw->ec->pixmap)) && (cw->iconic_preview_visible == 1) &&
+       (!cw->deleted) && (!e_object_is_del(E_OBJECT(cw->ec))))
+     evas_object_smart_callback_call(obj, "iconic_preview_changed", NULL);
+#endif
 }
 
 E_API void
@@ -2846,6 +2851,11 @@ e_comp_object_iconic_preview_del(Evas_Object *obj)
    if ((!cw->force_visible) && (!cw->iconic_preview_visible) &&
        (!cw->deleted) && (!e_object_is_del(E_OBJECT(cw->ec))))
      evas_object_smart_callback_call(cw->smart_obj, "visibility_normal", cw->ec);
+#ifdef HAVE_WAYLAND
+   if ((!e_pixmap_is_x(cw->ec->pixmap)) && (!cw->iconic_preview_visible) &&
+       (!cw->deleted) && (!e_object_is_del(E_OBJECT(cw->ec))))
+     evas_object_smart_callback_call(obj, "iconic_preview_changed", NULL);
+#endif
 }
 /////////////////////////////////////////////////////////
 
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 12a8afe38..dd9efaa76 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -1314,6 +1314,18 @@ _e_comp_wl_buffer_cb_destroy(struct wl_listener *listener, void *data EINA_UNUSE
      free(buffer);
 }
 
+static void
+_e_comp_wl_iconic_preview_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
+{
+   E_Client *ec = data;
+
+   if ((!ec->iconic) || (!ec->comp_data) || (!ec->comp_data->mapped)) return;
+   if (ec->comp_data->shell.surface && ec->comp_data->shell.suspension_update)
+     ec->comp_data->shell.suspension_update(ec->comp_data->shell.surface);
+   if (e_comp_object_iconic_preview_visibility_check(obj))
+     e_comp_object_damage(obj, 0, 0, ec->client.w, ec->client.h);
+}
+
 static void
 _e_comp_wl_client_evas_init(E_Client *ec)
 {
@@ -1327,6 +1339,8 @@ _e_comp_wl_client_evas_init(E_Client *ec)
 
    evas_object_smart_callback_add(ec->frame, "post_render",
                                   _e_comp_wl_evas_cb_post_render, ec);
+   evas_object_smart_callback_add(ec->frame, "iconic_preview_changed",
+                                  _e_comp_wl_iconic_preview_changed, ec);
 
    /* setup input callbacks */
    evas_object_smart_callback_add(ec->frame, "mouse_in",
@@ -3877,13 +3891,19 @@ end:
 }
 
 static Eina_Bool
-_e_comp_wl_cb_uniconify(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+_e_comp_wl_cb_iconic_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
    E_Event_Client *ev = event;
    E_Client *ec = ev->ec;
 
-   if (ec->comp_data->need_xdg_configure)
-      ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, 0, 0, 0);
+   if ((!ec->comp_data) || (!ec->comp_data->shell.surface) ||
+       e_object_is_del(E_OBJECT(ec)))
+     return ECORE_CALLBACK_PASS_ON;
+   if ((!ec->iconic) && ec->comp_data->need_xdg_configure &&
+       ec->comp_data->shell.configure_send)
+     _e_comp_wl_configure_send(ec, 0, EINA_FALSE);
+   else if (ec->comp_data->mapped && ec->comp_data->shell.suspension_update)
+     ec->comp_data->shell.suspension_update(ec->comp_data->shell.surface);
    return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -3947,8 +3967,10 @@ e_comp_wl_init(void)
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ZONE_SET,
                          _e_comp_wl_cb_client_zone_set, NULL);
 
+   E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ICONIFY,
+                         _e_comp_wl_cb_iconic_changed, NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_UNICONIFY,
-                         _e_comp_wl_cb_uniconify, NULL);
+                         _e_comp_wl_cb_iconic_changed, NULL);
 
    /* add hooks to catch e_client events */
    e_client_hook_add(E_CLIENT_HOOK_NEW_CLIENT, _e_comp_wl_client_cb_new, NULL);
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index e6e93d3b1..953237a93 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -387,6 +387,7 @@ struct _E_Comp_Wl_Client_Data
         /* shell surface resource */
         struct wl_resource *surface;
 
+        void (*suspension_update)(struct wl_resource *resource);
         void (*configure_send)(struct wl_resource *resource, uint32_t edges, int32_t width, int32_t height);
         void (*configure)(struct wl_resource *resource, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
         void (*ping)(struct wl_resource *resource);
diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c
index 787945bc9..2af1bac33 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.c
+++ b/src/modules/wl_desktop_shell/e_mod_main.c
@@ -29,7 +29,10 @@ e_shell_surface_destroy(struct wl_resource *resource)
 
 
    if (resource == ec->comp_data->shell.surface)
-     ec->comp_data->shell.surface = NULL;
+     {
+        ec->comp_data->shell.surface = NULL;
+        ec->comp_data->shell.suspension_update = NULL;
+     }
    shd = ec->comp_data->shell.data;
    if (shd)
      {
diff --git a/src/modules/wl_desktop_shell/e_mod_main.h b/src/modules/wl_desktop_shell/e_mod_main.h
index 4144a903b..d94b3a74d 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.h
+++ b/src/modules/wl_desktop_shell/e_mod_main.h
@@ -41,6 +41,7 @@ struct E_Shell_Data
    Eina_Bool fullscreen E_BITFIELD;
    Eina_Bool maximized E_BITFIELD;
    Eina_Bool activated E_BITFIELD;
+   Eina_Bool suspended E_BITFIELD;
 };
 
 #endif
diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index c4b58a837..b094fa522 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -484,6 +484,14 @@ _e_xdg_toplevel_configure_bounds_send(struct wl_resource *resource, E_Client *ec
    xdg_toplevel_send_configure_bounds(resource, zw / scale, zh / scale);
 }
 
+static Eina_Bool
+_e_xdg_toplevel_suspended_get(struct wl_resource *resource, E_Client *ec)
+{
+   return ec->iconic &&
+     (wl_resource_get_version(resource) >= XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION) &&
+     (!e_comp_object_iconic_preview_visibility_check(ec->frame));
+}
+
 static void
 _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullscreen, Eina_Bool maximized, uint32_t edges, int32_t width, int32_t height)
 {
@@ -492,7 +500,7 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
    E_Client *focused, *ec;
    E_Shell_Data *shd;
    State pending = 0;
-   Eina_Bool activated = EINA_FALSE;
+   Eina_Bool suspended, activated = EINA_FALSE;
 
    if (!(ec = wl_resource_get_user_data(resource)))
      {
@@ -519,6 +527,7 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
           } while (focused && (!activated));
      }
    shd = ec->comp_data->shell.data;
+   suspended = _e_xdg_toplevel_suspended_get(resource, ec);
    /* 0x0 lets the client choose its size, and would take back a size it was
     * given but has not drawn yet: the latest configure wins. */
    if (shd->size_serial && (!width) && (!height))
@@ -529,7 +538,8 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
        (shd->edges == edges) && (shd->width == width) && (shd->height == height) &&
        (shd->fullscreen == fullscreen) &&
        (shd->maximized == maximized) &&
-       (shd->activated == activated)) return;
+       (shd->activated == activated) &&
+       (shd->suspended == suspended)) return;
    //L("CONFIGURE %dx%d | max(%d) | full(%d)", width, height, maximized, fullscreen);
    shd->edges = edges;
    shd->width = width;
@@ -551,6 +561,7 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
      }
    shd->maximized = maximized;
    shd->activated = activated;
+   shd->suspended = suspended;
    wl_array_init(&states);
 
    if (fullscreen)
@@ -578,10 +589,7 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
      _e_xdg_surface_state_add(resource, &states, XDG_TOPLEVEL_STATE_RESIZING);
    if (activated)
      _e_xdg_surface_state_add(resource, &states, XDG_TOPLEVEL_STATE_ACTIVATED);
-   /* Suspended lets the client stop drawing altogether, so it is only
-    * said when E is sure nothing shows the window: when it is iconic. */
-   if (ec->iconic &&
-       (wl_resource_get_version(resource) >= XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION))
+   if (suspended)
      _e_xdg_surface_state_add(resource, &states, XDG_TOPLEVEL_STATE_SUSPENDED);
 
    _e_xdg_toplevel_configure_bounds_send(resource, ec);
@@ -637,6 +645,16 @@ _e_xdg_shell_surface_configure_send(struct wl_resource *resource, uint32_t edges
    _xdg_shell_surface_send_configure(resource, ec->fullscreen, !!ec->maximized || ec->comp_data->max, edges, width, height);
 }
 
+static void
+_e_xdg_toplevel_suspension_update(struct wl_resource *resource)
+{
+   E_Client *ec = wl_resource_get_user_data(resource);
+   E_Shell_Data *shd = ec->comp_data->shell.data;
+
+   if (shd->suspended != _e_xdg_toplevel_suspended_get(resource, ec))
+     _e_xdg_shell_surface_configure_send(resource, shd->edges, 0, 0);
+}
+
 static void
 _e_xdg_popup_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
 {
@@ -1660,6 +1678,7 @@ _e_xdg_surface_cb_toplevel_get(struct wl_client *client EINA_UNUSED, struct wl_r
    e_object_ref(E_OBJECT(ec));
 
    cdata->shell.configure_send = _e_xdg_shell_surface_configure_send;
+   cdata->shell.suspension_update = _e_xdg_toplevel_suspension_update;
    cdata->shell.configure = _e_xdg_shell_surface_configure;
    cdata->shell.map = _e_xdg_shell_surface_map;
    cdata->shell.unmap = _e_xdg_shell_surface_unmap;
diff --git a/src/modules/wl_test/e_mod_main.c b/src/modules/wl_test/e_mod_main.c
index ad360f009..021124c2f 100644
--- a/src/modules/wl_test/e_mod_main.c
+++ b/src/modules/wl_test/e_mod_main.c
@@ -708,6 +708,49 @@ _wl_test_cb_get_format_alpha(struct wl_client *client EINA_UNUSED, struct wl_res
                              e_pixmap_format_has_alpha(format));
 }
 
+static void
+_wl_test_preview_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+                     void *event EINA_UNUSED)
+{
+   E_Client *ec = data;
+
+   if (ec->frame) e_comp_object_iconic_preview_del(ec->frame);
+   e_object_unref(E_OBJECT(ec));
+}
+
+static void
+_wl_test_cb_client_preview(struct wl_client *client EINA_UNUSED, struct wl_resource *resource,
+                           uint32_t id, uint32_t live, int32_t x, int32_t y)
+{
+   Evas_Object *preview;
+   E_Client *ec;
+
+   preview = wl_resource_get_user_data(resource);
+   if (preview) evas_object_del(preview);
+   wl_resource_set_user_data(resource, NULL);
+   if (!id) return;
+   ec = _wl_test_client_by_id(resource, id);
+   if (!ec) return;
+
+   if (live) e_comp_object_iconic_preview_add(ec->frame);
+   preview = e_comp_object_util_frame_mirror_add(ec->frame);
+   if (!preview)
+     {
+        if (live) e_comp_object_iconic_preview_del(ec->frame);
+        return;
+     }
+   if (live)
+     {
+        e_object_ref(E_OBJECT(ec));
+        evas_object_event_callback_add(preview, EVAS_CALLBACK_DEL, _wl_test_preview_del, ec);
+     }
+
+   evas_object_geometry_set(preview, x, y, ec->w, ec->h);
+   evas_object_layer_set(preview, E_LAYER_MAX - 1);
+   evas_object_show(preview);
+   wl_resource_set_user_data(resource, preview);
+}
+
 static const struct wl_test_interface _wl_test_implementation =
 {
    _wl_test_cb_destroy,
@@ -735,11 +778,15 @@ static const struct wl_test_interface _wl_test_implementation =
    _wl_test_cb_output_scale_set,
    _wl_test_cb_output_remove,
    _wl_test_cb_get_format_alpha,
+   _wl_test_cb_client_preview,
 };
 
 static void
 _wl_test_cb_unbind(struct wl_resource *resource)
 {
+   Evas_Object *preview = wl_resource_get_user_data(resource);
+
+   if (preview) evas_object_del(preview);
    _pending_syncs = eina_list_remove(_pending_syncs, resource);
 }
 
@@ -768,7 +815,7 @@ e_modapi_init(E_Module *m)
         return NULL;
      }
 
-   _wl_test_global = wl_global_create(e_comp_wl->wl.disp, &wl_test_interface, 12,
+   _wl_test_global = wl_global_create(e_comp_wl->wl.disp, &wl_test_interface, 13,
                                      NULL, _wl_test_cb_bind);
    if (!_wl_test_global)
      {
diff --git a/src/protocol/wl-test.xml b/src/protocol/wl-test.xml
index 87e22d7c7..4abf43fc7 100644
--- a/src/protocol/wl-test.xml
+++ b/src/protocol/wl-test.xml
@@ -23,7 +23,7 @@
     DEALINGS IN THE SOFTWARE.
   </copyright>
 
-  <interface name="wl_test" version="12">
+  <interface name="wl_test" version="13">
     <description summary="private interface for the compositor test suite">
       A back door into the compositor for its own test suite. It exposes
       internal state and synthesises input, so it is only built with
@@ -395,5 +395,15 @@
       <arg name="format" type="uint"/>
       <arg name="alpha" type="uint" summary="1 if blended, 0 if opaque"/>
     </event>
+    <request name="client_preview" since="13">
+      <description summary="show or remove a minimized window preview">
+        Replaces the preview associated with this wl_test resource.
+        A zero client id removes it. A live preview keeps the window updating.
+      </description>
+      <arg name="client_id" type="uint"/>
+      <arg name="live" type="uint"/>
+      <arg name="x" type="int"/>
+      <arg name="y" type="int"/>
+    </request>
   </interface>
 </protocol>
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index ced6ad90d..7e047d545 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -66,6 +66,9 @@ wl_protocol_tests = [
   ['xdg-defunct-surfaces', 'test_xdg_defunct.c'],
   ['client-list', 'test_client_list.c'],
   ['client-action', 'test_client_action.c'],
+  ['client-preview', 'test_client_preview.c'],
+  ['client-preview-xdg-v5', 'test_client_preview.c',
+   {'E_TEST_PREVIEW_XDG_V5': '1'}],
   ['no-dialogs', 'test_no_dialogs.c'],
   ['xdg-foreign', 'test_xdg_foreign.c'],
   ['xdg-foreign-v2', 'test_xdg_foreign_v2.c'],
diff --git a/src/tests/wayland/test_client_preview.c b/src/tests/wayland/test_client_preview.c
new file mode 100644
index 000000000..8ba3c98e1
--- /dev/null
+++ b/src/tests/wayland/test_client_preview.c
@@ -0,0 +1,206 @@
+/* A minimized window keeps updating only while its live preview is shown.
+ * A frame mirror also updates when another preview keeps the client active. */
+#include <stdint.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "e_wl_testkit.h"
+#include "single-pixel-buffer-v1-client-protocol.h"
+#include "viewporter-client-protocol.h"
+
+#define APP_ID "e.test.client-preview"
+#define SUSPENDED (1u << XDG_TOPLEVEL_STATE_SUSPENDED)
+#define RED 0xffff0000u
+#define GREEN 0xff00ff00u
+#define X 20
+#define Y 20
+#define W 200
+#define H 100
+
+static uint32_t pixel;
+static unsigned int states;
+static int configured, frame_done;
+
+static void
+_pixel(void *data __attribute__((unused)), struct wl_test *tester __attribute__((unused)),
+       int32_t x __attribute__((unused)), int32_t y __attribute__((unused)), uint32_t argb)
+{
+   pixel = argb;
+}
+
+static void
+_frame_done(void *data __attribute__((unused)), struct wl_callback *callback,
+            uint32_t time __attribute__((unused)))
+{
+   frame_done = 1;
+   wl_callback_destroy(callback);
+}
+
+static void
+_surface_configure(void *data __attribute__((unused)), struct xdg_surface *surface,
+                   uint32_t serial)
+{
+   xdg_surface_ack_configure(surface, serial);
+   configured = 1;
+}
+
+static void
+_toplevel_configure(void *data __attribute__((unused)),
+                    struct xdg_toplevel *top __attribute__((unused)),
+                    int32_t w __attribute__((unused)), int32_t h __attribute__((unused)),
+                    struct wl_array *array)
+{
+   uint32_t *state;
+
+   states = 0;
+   wl_array_for_each(state, array)
+     if (*state < 32) states |= 1u << *state;
+}
+
+static void
+_configure_bounds(void *data __attribute__((unused)),
+                  struct xdg_toplevel *top __attribute__((unused)),
+                  int32_t w __attribute__((unused)), int32_t h __attribute__((unused)))
+{
+}
+
+static void
+_wm_capabilities(void *data __attribute__((unused)),
+                 struct xdg_toplevel *top __attribute__((unused)),
+                 struct wl_array *capabilities __attribute__((unused)))
+{
+}
+
+static void
+_ping(void *data __attribute__((unused)), struct xdg_wm_base *shell, uint32_t serial)
+{
+   xdg_wm_base_pong(shell, serial);
+}
+
+static const struct xdg_wm_base_listener _shell_listener = { _ping };
+static const struct xdg_surface_listener _surface_listener = { _surface_configure };
+static const struct xdg_toplevel_listener _toplevel_listener = {
+   .configure = _toplevel_configure,
+   .configure_bounds = _configure_bounds,
+   .wm_capabilities = _wm_capabilities,
+};
+
+static const struct wl_test_listener _tester_listener = { .pixel = _pixel };
+static const struct wl_callback_listener _frame_listener = { _frame_done };
+
+static void
+_expect_pixel(Tk *tk, struct wl_test *tester, int x, uint32_t expected)
+{
+   time_t deadline = time(NULL) + TK_WAIT_SECONDS;
+
+   do
+     {
+        wl_test_get_pixel(tester, x + W / 2, Y + H / 2);
+        tk_sync(tk);
+        if (pixel == expected) return;
+     }
+   while (time(NULL) < deadline);
+   tk_fail(tk, "preview at x=%d drew %#x, expected %#x", x, pixel, expected);
+}
+
+static void
+_paint(struct wl_surface *surface, struct wl_buffer *buffer)
+{
+   wl_surface_attach(surface, buffer, 0, 0);
+   wl_surface_damage_buffer(surface, 0, 0, 1, 1);
+   wl_surface_commit(surface);
+}
+
+int
+main(void)
+{
+   struct wp_single_pixel_buffer_manager_v1 *manager;
+   struct wp_viewporter *viewporter;
+   struct wp_viewport *viewport;
+   struct wl_test *mirror, *live;
+   struct wl_surface *surface;
+   struct wl_buffer *red, *green;
+   struct wl_callback *callback;
+   struct xdg_wm_base *shell;
+   struct xdg_surface *xdg_surface;
+   struct xdg_toplevel *top;
+   Tk *tk;
+   unsigned int id;
+   int legacy = getenv("E_TEST_PREVIEW_XDG_V5") != NULL;
+
+   tk = tk_connect("test-client-preview");
+   mirror = tk_bind(tk, &wl_test_interface, 13);
+   live = tk_bind(tk, &wl_test_interface, 13);
+   manager = tk_bind(tk, &wp_single_pixel_buffer_manager_v1_interface, 1);
+   viewporter = tk_bind(tk, &wp_viewporter_interface, 1);
+   if ((!mirror) || (!live) || (!manager) || (!viewporter))
+     tk_fail(tk, "missing preview or buffer protocols");
+   wl_test_add_listener(mirror, &_tester_listener, NULL);
+   wl_test_add_listener(live, &_tester_listener, NULL);
+   shell = tk_wm_base(tk);
+   if (legacy)
+     {
+        shell = tk_bind(tk, &xdg_wm_base_interface, 5);
+        if (!shell) tk_fail(tk, "cannot bind xdg_wm_base version 5");
+        xdg_wm_base_add_listener(shell, &_shell_listener, NULL);
+     }
+   surface = tk_surface_new(tk);
+   xdg_surface = xdg_wm_base_get_xdg_surface(shell, surface);
+   xdg_surface_add_listener(xdg_surface, &_surface_listener, NULL);
+   top = xdg_surface_get_toplevel(xdg_surface);
+   xdg_toplevel_add_listener(top, &_toplevel_listener, NULL);
+   xdg_toplevel_set_app_id(top, APP_ID);
+   wl_surface_commit(surface);
+   while (!configured)
+     if (wl_display_dispatch(tk_display(tk)) < 0)
+       tk_fail(tk, "disconnected waiting for the initial configure");
+   viewport = wp_viewporter_get_viewport(viewporter, surface);
+   wp_viewport_set_destination(viewport, W, H);
+   red = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer
+     (manager, UINT32_MAX, 0, 0, UINT32_MAX);
+   green = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer
+     (manager, 0, UINT32_MAX, 0, UINT32_MAX);
+   _paint(surface, red);
+   tk_settle(tk);
+   id = tk_expect(tk, APP_ID)->id;
+   tk_pointer_warp(tk, 800, 600);
+
+   tk_action(tk, id, "window_iconic_toggle", NULL);
+   tk_settle(tk);
+   if (!!(states & SUSPENDED) == legacy)
+     tk_fail(tk, "unexpected suspension state after minimizing");
+
+   wl_test_client_preview(mirror, id, 0, X, Y);
+   _expect_pixel(tk, mirror, X, RED);
+   wl_test_client_preview(live, id, 1, X + W, Y);
+   tk_settle(tk);
+   if (states & SUSPENDED)
+     tk_fail(tk, "live preview did not resume the minimized window");
+   _expect_pixel(tk, live, X + W, RED);
+
+   callback = wl_surface_frame(surface);
+   wl_callback_add_listener(callback, &_frame_listener, NULL);
+   _paint(surface, green);
+   _expect_pixel(tk, live, X + W, GREEN);
+   _expect_pixel(tk, mirror, X, GREEN);
+   if (!frame_done)
+     tk_fail(tk, "no frame callback while the live preview was drawn");
+
+   wl_test_client_preview(mirror, id, 1, X, Y);
+   wl_test_client_preview(live, 0, 0, 0, 0);
+   tk_settle(tk);
+   if (states & SUSPENDED)
+     tk_fail(tk, "window suspended while a live preview remained");
+
+   wl_test_client_preview(mirror, 0, 0, 0, 0);
+   tk_settle(tk);
+   if (!!(states & SUSPENDED) == legacy)
+     tk_fail(tk, "unexpected suspension state after closing the live preview");
+   tk_action(tk, id, "window_iconic_toggle", NULL);
+   tk_settle(tk);
+   if (states & SUSPENDED)
+     tk_fail(tk, "restored window stayed suspended");
+
+   tk_disconnect(tk);
+   return 0;
+}

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

Reply via email to