discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=63af4ea865106938866b50b187057e7100c141d7

commit 63af4ea865106938866b50b187057e7100c141d7
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Apr 8 16:08:32 2016 -0400

    buffer server-side (un)maximize commands to ensure synchronization in 
wayland
    
    maximize is client-initiated and compositor-enforced in wayland, meaning 
that a
    maximize should only be acted upon in the compositor after the client has
    acknowledged that it has transitioned into the maximized state (likely 
removing
    part of its csd region) and has resized itself to match the expected 
maximize
    size
    
    fix T3297
---
 src/bin/e_comp_wl.c                       | 57 +++++++++++++++++++++++++++++--
 src/bin/e_comp_wl.h                       |  3 ++
 src/modules/wl_desktop_shell/e_mod_main.c |  6 ++--
 3 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index c1617b6..8fdfcd03 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -595,12 +595,61 @@ _e_comp_wl_evas_cb_move(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_U
 }
 
 static void
-_e_comp_wl_evas_cb_maximize_pre(void *data, Evas_Object *obj EINA_UNUSED, void 
*event_info EINA_UNUSED)
+_e_comp_wl_evas_cb_unmaximize_pre(void *data, Evas_Object *obj EINA_UNUSED, 
void *event_info)
 {
    E_Client *ec = data;
+   E_Maximize *max = event_info;
 
-   if (!e_object_is_del(E_OBJECT(ec)))
+   if (e_object_is_del(E_OBJECT(ec))) return;
+   if (ec->comp_data->in_commit)
      ec->comp_data->maximizing = 1;
+   else if (!e_client_has_xwindow(ec))
+     {
+        int w, h, ew, eh;
+        unsigned int pmax = ec->maximized;
+        ec->comp_data->max = *max;
+        if ((!e_config->window_maximize_animate) || 
ec->maximize_anims_disabled)
+          {
+             e_client_unmaximize_geometry_get(ec, *max, NULL, NULL, &w, &h);
+             ew = ec->w, eh = ec->h;
+             ec->w = w, ec->h = h;
+          }
+        ec->maximized = 0;
+        _e_comp_wl_configure_send(ec, 0);
+        if ((!e_config->window_maximize_animate) || 
ec->maximize_anims_disabled)
+          ec->w = ew, ec->h = eh;
+        ec->maximized = pmax;
+        *max = 0;
+     }
+}
+
+static void
+_e_comp_wl_evas_cb_maximize_pre(void *data, Evas_Object *obj EINA_UNUSED, void 
*event_info)
+{
+   E_Client *ec = data;
+   E_Maximize *max = event_info;
+
+   if (e_object_is_del(E_OBJECT(ec))) return;
+   if (ec->comp_data->in_commit)
+     ec->comp_data->maximizing = 1;
+   else if (!e_client_has_xwindow(ec))
+     {
+        int w, h, ew, eh;
+        unsigned int pmax = ec->maximized;
+        ec->comp_data->max = *max;
+        if ((!e_config->window_maximize_animate) || 
ec->maximize_anims_disabled)
+          {
+             e_client_maximize_geometry_get(ec, *max, NULL, NULL, &w, &h);
+             ew = ec->w, eh = ec->h;
+             ec->w = w, ec->h = h;
+          }
+        ec->maximized = *max;
+        _e_comp_wl_configure_send(ec, 0);
+        if ((!e_config->window_maximize_animate) || 
ec->maximize_anims_disabled)
+          ec->w = ew, ec->h = eh;
+        ec->maximized = pmax;
+        *max = 0;
+     }
 }
 
 static void
@@ -812,7 +861,7 @@ _e_comp_wl_client_evas_init(E_Client *ec)
         evas_object_smart_callback_add(ec->frame, "maximize_pre",
                                        _e_comp_wl_evas_cb_maximize_pre, ec);
         evas_object_smart_callback_add(ec->frame, "unmaximize_pre",
-                                       _e_comp_wl_evas_cb_maximize_pre, ec);
+                                       _e_comp_wl_evas_cb_unmaximize_pre, ec);
         evas_object_smart_callback_add(ec->frame, "maximize_done",
                                        _e_comp_wl_evas_cb_maximize_done, ec);
         evas_object_smart_callback_add(ec->frame, "unmaximize_done",
@@ -1061,6 +1110,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, 
E_Comp_Wl_Surface_State *state)
      first = !e_pixmap_usable_get(e_comp_x_client_pixmap_get(ec));
 #endif
 
+   ec->comp_data->in_commit = 1;
    if (ec->ignored && (ec->comp_data->shell.surface || ec->internal))
      {
         EC_CHANGED(ec);
@@ -1283,6 +1333,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, 
E_Comp_Wl_Surface_State *state)
         /* clear input tiler */
         eina_tiler_clear(state->input);
      }
+   ec->comp_data->in_commit = 0;
 }
 
 static void
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index 98044e9..100c1e7 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -309,6 +309,8 @@ struct _E_Comp_Wl_Client_Data
      {
         int32_t x, y;
      } popup;
+
+   E_Maximize max;
 #ifndef HAVE_WAYLAND_ONLY
    E_Pixmap *xwayland_pixmap;
    E_Comp_X_Client_Data *xwayland_data;
@@ -323,6 +325,7 @@ struct _E_Comp_Wl_Client_Data
    Eina_Bool cursor : 1;
    Eina_Bool moved : 1;
    Eina_Bool maximizing : 1;
+   Eina_Bool in_commit : 1;
 };
 
 struct _E_Comp_Wl_Output
diff --git a/src/modules/wl_desktop_shell/e_mod_main.c 
b/src/modules/wl_desktop_shell/e_mod_main.c
index ba385a7..99d1f96 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.c
+++ b/src/modules/wl_desktop_shell/e_mod_main.c
@@ -989,6 +989,7 @@ _e_xdg_shell_surface_cb_maximized_unset(struct wl_client 
*client EINA_UNUSED, st
      }
 
    if (ec->lock_user_maximize) return;
+   ec->comp_data->max = (e_config->maximize_policy & E_MAXIMIZE_TYPE) | 
E_MAXIMIZE_BOTH;
    if (e_config->window_maximize_animate)
      w = ec->w, h = ec->h;
    else
@@ -1046,8 +1047,9 @@ _e_xdg_shell_surface_cb_minimized_set(struct wl_client 
*client EINA_UNUSED, stru
         return;
      }
 
-   if (!ec->lock_user_iconify)
-     ec->comp_data->shell.set.minimize = 1;
+   if (ec->lock_user_iconify) return;
+   ec->comp_data->shell.set.minimize = 1;
+   ec->comp_data->max = (e_config->maximize_policy & E_MAXIMIZE_TYPE) | 
E_MAXIMIZE_BOTH;
 }
 
 static const struct xdg_surface_interface _e_xdg_surface_interface =

-- 


Reply via email to