grab wl shell surface geom and use for adjusting resize operations upstream/0.19.99
authorMike Blumenkrantz <zmike@osg.samsung.com>
Tue, 3 Mar 2015 21:48:25 +0000 (16:48 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Tue, 3 Mar 2015 21:48:25 +0000 (16:48 -0500)
I think this still may not be 100% perfect,
but it's more like 95% perfect now instead of 50%

src/bin/e_comp_wl.c
src/bin/e_comp_wl.h
src/modules/wl_desktop_shell/e_mod_main.c

index a386a6f..bd96b99 100644 (file)
@@ -507,38 +507,51 @@ _e_comp_wl_evas_cb_resize(void *data, Evas_Object *obj EINA_UNUSED, void *event
    if (!ec->comp_data->shell.configure_send) return;
    if (e_client_util_resizing_get(ec))
      {
-        int x, y;
+        int x, y, ax, ay;
 
         x = ec->mouse.last_down[ec->moveinfo.down.button - 1].w;
         y = ec->mouse.last_down[ec->moveinfo.down.button - 1].h;
+        if (ec->comp_data->shell.window.w && ec->comp_data->shell.window.h)
+          {
+             ax = ec->client.w - ec->comp_data->shell.window.w;
+             ay = ec->client.h - ec->comp_data->shell.window.h;
+          }
+        else
+          ax = ay = 0;
 
         switch (ec->resize_mode)
           {
            case E_POINTER_RESIZE_TL:
            case E_POINTER_RESIZE_L:
            case E_POINTER_RESIZE_BL:
-             x += ec->mouse.last_down[ec->moveinfo.down.button - 1].mx - ec->mouse.current.mx;
+             x += ec->mouse.last_down[ec->moveinfo.down.button - 1].mx -
+               ec->mouse.current.mx - ec->comp_data->shell.window.x;
              break;
            case E_POINTER_RESIZE_TR:
            case E_POINTER_RESIZE_R:
            case E_POINTER_RESIZE_BR:
-             x += ec->mouse.current.mx - ec->mouse.last_down[ec->moveinfo.down.button - 1].mx;
+             x += ec->mouse.current.mx - ec->mouse.last_down[ec->moveinfo.down.button - 1].mx -
+               ec->comp_data->shell.window.x;
              break;
-           default: break;
+           default:
+             x -= ax;
           }
         switch (ec->resize_mode)
           {
            case E_POINTER_RESIZE_TL:
            case E_POINTER_RESIZE_T:
            case E_POINTER_RESIZE_TR:
-             y += ec->mouse.last_down[ec->moveinfo.down.button - 1].my - ec->mouse.current.my;
+             y += ec->mouse.last_down[ec->moveinfo.down.button - 1].my -
+               ec->mouse.current.my - ec->comp_data->shell.window.y;
              break;
            case E_POINTER_RESIZE_BL:
            case E_POINTER_RESIZE_B:
            case E_POINTER_RESIZE_BR:
-             y += ec->mouse.current.my - ec->mouse.last_down[ec->moveinfo.down.button - 1].my;
+             y += ec->mouse.current.my - ec->mouse.last_down[ec->moveinfo.down.button - 1].my -
+               ec->comp_data->shell.window.y;
              break;
-           default: break;
+           default:
+             y -= ay;
           }
         ec->comp_data->shell.configure_send(ec->comp_data->shell.surface,
                                  ec->comp->wl_comp_data->resize.edges,
@@ -1062,7 +1075,6 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
              ec->new_client = EINA_TRUE;
           }
      }
-
    state->sx = 0;
    state->sy = 0;
    state->new_attach = EINA_FALSE;
index c7e2f04..715afae 100644 (file)
@@ -240,6 +240,7 @@ struct _E_Comp_Wl_Client_Data
         void (*ping)(struct wl_resource *resource);
         void (*map)(struct wl_resource *resource);
         void (*unmap)(struct wl_resource *resource);
+        Eina_Rectangle window;
      } shell;
 
    E_Comp_Wl_Buffer_Ref buffer_ref;
index a70267a..9ced6fd 100644 (file)
@@ -870,21 +870,19 @@ _e_xdg_shell_surface_cb_ack_configure(struct wl_client *client EINA_UNUSED, stru
 }
 
 static void
-_e_xdg_shell_surface_cb_window_geometry_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, int32_t x EINA_UNUSED, int32_t y EINA_UNUSED, int32_t w EINA_UNUSED, int32_t h EINA_UNUSED)
+_e_xdg_shell_surface_cb_window_geometry_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t x, int32_t y, int32_t w, int32_t h)
 {
-   /* E_Client *ec; */
+   E_Client *ec;
 
-   /* get the client for this resource */
-   /* if (!(ec = wl_resource_get_user_data(resource))) */
-   /*   { */
-   /*      wl_resource_post_error(resource,  */
-   /*                             WL_DISPLAY_ERROR_INVALID_OBJECT,  */
-   /*                             "No Client For Shell Surface"); */
-   /*      return; */
-   /*   } */
-
-   /* DBG("XDG_SHELL: Window Geom Set: %d \t%d %d, %d %d",  */
-   /*     wl_resource_get_id(resource), x, y, w, h); */
+   ec = wl_resource_get_user_data(resource);
+   if (!ec)
+     {
+        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                                "No Client For Shell Surface");
+        return;
+     }
+   EINA_RECTANGLE_SET(&ec->comp_data->shell.window, x, y, w, h);
+   //DBG("XDG_SHELL: Window Geom Set: %d \t%d %d, %d %d", wl_resource_get_id(resource), x, y, w, h);
 }
 
 static void