From: 이상진 <lsj119@samsung.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 10 Feb 2010 14:35:07 +0000 (14:35 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 10 Feb 2010 14:35:07 +0000 (14:35 +0000)
Patch for rotate with resize

(fixed formatting a bit)

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@46046 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_evas/Ecore_Evas.h
src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_evas/ecore_evas_fb.c
src/lib/ecore_evas/ecore_evas_private.h
src/lib/ecore_evas/ecore_evas_win32.c
src/lib/ecore_evas/ecore_evas_x.c

index 4443d90..548840b 100644 (file)
@@ -279,6 +279,7 @@ EAPI void        ecore_evas_resize(Ecore_Evas *ee, int w, int h);
 EAPI void        ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
 EAPI void        ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
 EAPI void        ecore_evas_rotation_set(Ecore_Evas *ee, int rot);
+EAPI void        ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot);
 EAPI int         ecore_evas_rotation_get(const Ecore_Evas *ee);
 EAPI void        ecore_evas_shaped_set(Ecore_Evas *ee, int shaped);
 EAPI int         ecore_evas_shaped_get(const Ecore_Evas *ee);
index 1f06d1a..983239d 100644 (file)
@@ -1408,7 +1408,35 @@ ecore_evas_rotation_set(Ecore_Evas *ee, int rot)
    rot = rot % 360;
    while (rot < 0) rot += 360;
    while (rot >= 360) rot -= 360;
-   IFC(ee, fn_rotation_set) (ee, rot);
+   IFC(ee, fn_rotation_set) (ee, rot, 0);
+   /* make sure everything gets redrawn */
+   evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+   evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
+   IFE;
+}
+
+/**
+ * Set the rotation of an Ecore_Evas' window
+ *
+ * @param ee The Ecore_Evas
+ * @param rot the angle (in degrees) of rotation.
+ *
+ * The allowed values of @p rot depend on the engine being used. Most only
+ * allow multiples of 90.
+ */
+EAPI void
+ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+       ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                        "ecore_evas_rotation_set");
+       return;
+     }
+   rot = rot % 360;
+   while (rot < 0) rot += 360;
+   while (rot >= 360) rot -= 360;
+   IFC(ee, fn_rotation_set) (ee, rot, 1);
    /* make sure everything gets redrawn */
    evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
    evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
index d917ead..2d77889 100644 (file)
@@ -353,7 +353,7 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int
 }
 
 static void
-_ecore_evas_rotation_set(Ecore_Evas *ee, int rotation)
+_ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize)
 {
    Evas_Engine_Info_FB *einfo;
    int rot_dif;
index fb4f99b..e36f02d 100644 (file)
@@ -157,7 +157,7 @@ struct _Ecore_Evas_Engine_Func
    void        (*fn_managed_move) (Ecore_Evas *ee, int x, int y);
    void        (*fn_resize) (Ecore_Evas *ee, int w, int h);
    void        (*fn_move_resize) (Ecore_Evas *ee, int x, int y, int w, int h);
-   void        (*fn_rotation_set) (Ecore_Evas *ee, int rot);
+   void        (*fn_rotation_set) (Ecore_Evas *ee, int rot, int resize);
    void        (*fn_shaped_set) (Ecore_Evas *ee, int shaped);
    void        (*fn_show) (Ecore_Evas *ee);
    void        (*fn_hide) (Ecore_Evas *ee);
index bf99e7e..f264d63 100644 (file)
@@ -530,7 +530,7 @@ _ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation)
 }
 
 static void
-_ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation)
+_ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation, int resize)
 {
    INF("ecore evas rotation: %s", rotation ? "yes" : "no");
 
index eed9bcf..37aa24b 100644 (file)
@@ -1311,7 +1311,7 @@ _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
 }
 
 static void
-_ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation,
+_ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
                                    Evas_Engine_Info *einfo)
 {
    int rot_dif;
@@ -1324,18 +1324,39 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation,
        int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
 
        evas_engine_info_set(ee->evas, einfo);
-       if (!ee->prop.fullscreen)
-         {
-            ecore_x_window_resize(ee->prop.window, ee->h, ee->w);
-            ee->expecting_resize.w = ee->h;
-            ee->expecting_resize.h = ee->w;
-         }
+
+       if (!resize)
+          {
+             if (!ee->prop.fullscreen)
+               {
+                  ecore_x_window_resize(ee->prop.window, ee->h, ee->w);
+                  ee->expecting_resize.w = ee->h;
+                  ee->expecting_resize.h = ee->w;
+               }
+             else
+               {
+                  int w, h;
+                  
+                  ecore_x_window_size_get(ee->prop.window, &w, &h);
+                  ecore_x_window_resize(ee->prop.window, h, w);
+                  if ((rotation == 0) || (rotation == 180))
+                    {
+                       evas_output_size_set(ee->evas, ee->w, ee->h);
+                       evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
+                    }
+                  else
+                    {
+                       evas_output_size_set(ee->evas, ee->h, ee->w);
+                       evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
+                    }
+                  if (ee->func.fn_resize) ee->func.fn_resize(ee);
+               }
+          }
        else
-         {
+          {
             int w, h;
-
+             
             ecore_x_window_size_get(ee->prop.window, &w, &h);
-            ecore_x_window_resize(ee->prop.window, h, w);
             if ((rotation == 0) || (rotation == 180))
               {
                  evas_output_size_set(ee->evas, ee->w, ee->h);
@@ -1347,7 +1368,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation,
                  evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
               }
             if (ee->func.fn_resize) ee->func.fn_resize(ee);
-         }
+          }
        ecore_evas_size_min_get(ee, &minw, &minh);
        ecore_evas_size_max_get(ee, &maxw, &maxh);
        ecore_evas_size_base_get(ee, &basew, &baseh);
@@ -1376,7 +1397,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation,
 }
 
 static void
-_ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation)
+_ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
 {
    if (ee->rotation == rotation) return;
    if (!strcmp(ee->driver, "opengl_x11")) return;
@@ -1390,7 +1411,7 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation)
        if (!einfo) return;
        einfo->info.rotation = rotation;
        _ecore_evas_x_rotation_set_internal
-         (ee, rotation, (Evas_Engine_Info *)einfo);
+         (ee, rotation, resize, (Evas_Engine_Info *)einfo);
 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
      }
    else if (!strcmp(ee->driver,  "software_16_x11"))
@@ -1402,7 +1423,7 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation)
        if (!einfo) return;
        einfo->info.rotation = rotation;
        _ecore_evas_x_rotation_set_internal
-         (ee, rotation, (Evas_Engine_Info *)einfo);
+         (ee, rotation, resize, (Evas_Engine_Info *)einfo);
 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
      }
 }