elm_win: Fix to check if frame_obj is created 26/113426/1
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Tue, 7 Feb 2017 04:38:15 +0000 (13:38 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Tue, 7 Feb 2017 11:45:07 +0000 (20:45 +0900)
Since frame_obj is not always created, check if frame_obj is created.

Only the compositor can handle the window & pointer position, call
ecore_evas_wayland_move with (0, 0) instead of x and y position of
frame_obj part.

This patch refers ea7bbfe47dc1df5f51725be05eadf7ebce1d8361 in upstream
(win: Factorize code for move_resize).

Change-Id: Idc3cc97a28c7a8f3ab15baf24bd3e70b24914629

src/lib/elm_win.c

index 19bb0bb8763d8c210f79cd1743737aac5bb3f894..f9569e44f4c127d55b7732ed8a8d152faa4debeb 100644 (file)
@@ -1372,7 +1372,7 @@ _elm_win_profile_update(Elm_Win_Data *sd)
 static void
 _elm_win_opaque_update(Elm_Win_Data *sd)
 {
-   int ox, oy, ow, oh;
+   int ox = 0, oy = 0, ow = 0, oh = 0;
 
    if (sd->fullscreen)
      {
@@ -1382,8 +1382,9 @@ _elm_win_opaque_update(Elm_Win_Data *sd)
         return;
      }
 
-   edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque",
-                                 &ox, &oy, &ow, &oh);
+   if (sd->frame_obj)
+     edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque",
+                                   &ox, &oy, &ow, &oh);
    ecore_wl_window_opaque_region_set(sd->wl.win, ox, oy, ow, oh);
    ecore_wl_window_update_location(sd->wl.win, sd->screen.x + ox, sd->screen.y + oy);
 }
@@ -1392,13 +1393,13 @@ _elm_win_opaque_update(Elm_Win_Data *sd)
 static void
 _elm_win_frame_obj_update(Elm_Win_Data *sd)
 {
-   int fx, fy, fw, fh;
-   int ox, oy, ow, oh;
+   int fx = 0, fy = 0, fw = 0, fh = 0;
+   int ox = 0, oy = 0, ow = 0, oh = 0;
 
 #ifdef HAVE_ELEMENTARY_WAYLAND
    sd->wl.opaque_dirty = 1;
 #endif
-   if (sd->fullscreen)
+   if (sd->fullscreen || !sd->frame_obj)
      {
         evas_output_framespace_set(sd->evas, 0, 0, 0, 0);
         return;
@@ -3482,6 +3483,8 @@ _elm_win_frame_maximized_state_update(Elm_Win_Data *sd, Eina_Bool maximized)
 {
    const char *emission;
 
+   if (!sd->frame_obj) return;
+
    if (maximized)
      emission = "elm,state,maximized";
    else
@@ -6417,12 +6420,17 @@ _elm_win_move_resize_start(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Elm_Win_Move_R
    i = sd->rot / 90;
    if (mode == ELM_WIN_MOVE_RESIZE_MOVE)
      {
-        int ox, oy;
-        sd->resizing = EINA_TRUE;
-        edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque",
-                                  &ox, &oy, NULL, NULL);
-        ecore_evas_wayland_move(sd->ee, ox, oy);
-        res = EINA_TRUE;
+        if (sd->wl.win)
+          {
+             sd->resizing = EINA_TRUE;
+             ecore_wl_window_pointer_set(sd->wl.win, NULL,
+                                         sd->pointer.hot_x, sd->pointer.hot_y);
+
+             /* Note: Not passing any X,Y position as those don't make sense, only
+              * the compositor can really handle the window & pointer position. */
+             ecore_evas_wayland_move(sd->ee, 0, 0);
+             res = EINA_TRUE;
+          }
      }
    else
      {