ecore/wayland: Fix screen geometry when it is rotated. 71/3271/1
authorRafael Antognolli <rafael.antognolli@linux.intel.com>
Wed, 3 Apr 2013 02:45:10 +0000 (23:45 -0300)
committerRafael Antognolli <rafael.antognolli@linux.intel.com>
Wed, 3 Apr 2013 16:57:33 +0000 (13:57 -0300)
Width and height should be swapped when the screen is rotated by 90 or
270 degrees.

Additionally, add a command to the ecore_evas_window_sizes_example which
returns the screen geometry.

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl.c
src/lib/ecore_wayland/ecore_wl_output.c

index c080715..9e43649 100644 (file)
@@ -116,6 +116,7 @@ struct _Ecore_Wl_Output
    Ecore_Wl_Display *display;
    struct wl_output *output;
    Eina_Rectangle allocation;
+   int transform;
    int mw, mh;
    struct wl_list link;
 
index 02d1db2..4be95fe 100644 (file)
@@ -307,6 +307,22 @@ ecore_wl_screen_size_get(int *w, int *h)
 
    if (!_ecore_wl_disp->output) return;
 
+   switch (_ecore_wl_disp->output->transform)
+     {
+      case WL_OUTPUT_TRANSFORM_90:
+      case WL_OUTPUT_TRANSFORM_270:
+      case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+      case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+         /* Swap width and height */
+         if (w) *w = _ecore_wl_disp->output->allocation.h;
+         if (h) *h = _ecore_wl_disp->output->allocation.w;
+         break;
+      default:
+         if (w) *w = _ecore_wl_disp->output->allocation.w;
+         if (h) *h = _ecore_wl_disp->output->allocation.h;
+     }
+
+
    if (w) *w = _ecore_wl_disp->output->allocation.w;
    if (h) *h = _ecore_wl_disp->output->allocation.h;
 }
index 020af7b..f8fe5a9 100644 (file)
@@ -80,7 +80,7 @@ _ecore_wl_output_del(Ecore_Wl_Output *output)
 
 /* local functions */
 static void 
-_ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output __UNUSED__, int x, int y, int w, int h, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__, int transform __UNUSED__)
+_ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output __UNUSED__, int x, int y, int w, int h, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__, int transform)
 {
    Ecore_Wl_Output *output;
 
@@ -91,6 +91,7 @@ _ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output __UNUSED__,
    output->allocation.y = y;
    output->mw = w;
    output->mh = h;
+   output->transform = transform;
 }
 
 static void