antognolli pushed a commit to branch master.

commit 97d06e5b3f4b658d60ef9ff2e3d1d81ce86cb3b3
Author: Rafael Antognolli <[email protected]>
Date:   Tue Apr 2 17:11:10 2013 -0300

    ecore/wayland: Fix screen geometry when it is rotated.
    
    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/examples/ecore/ecore_evas_window_sizes_example.c |  9 +++++++++
 src/lib/ecore_wayland/Ecore_Wayland.h                |  1 +
 src/lib/ecore_wayland/ecore_wl.c                     | 16 ++++++++++++++--
 src/lib/ecore_wayland/ecore_wl_output.c              |  3 ++-
 4 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/examples/ecore/ecore_evas_window_sizes_example.c 
b/src/examples/ecore/ecore_evas_window_sizes_example.c
index 5edd52a..a0777a5 100644
--- a/src/examples/ecore/ecore_evas_window_sizes_example.c
+++ b/src/examples/ecore/ecore_evas_window_sizes_example.c
@@ -36,6 +36,7 @@ static const char commands[] = \
   "\tx - impose a maximum size to the window\n"
   "\tb - impose a base size to the window\n"
   "\ts - impose a step size (different than 1 px) to the window\n"
+  "\tg - get the screen geometry\n"
   "\th - print help\n";
 
 /* to inform current window's size */
@@ -147,6 +148,14 @@ _on_keydown(void *data EINA_UNUSED,
           }
         return;
      }
+
+   if (strcmp(ev->keyname, "g") == 0) /* get screen geometry */
+     {
+        int x, y, w, h;
+        ecore_evas_screen_geometry_get(ee, &x, &y, &w, &h);
+        fprintf(stdout, "screen geometry: %d,%d, %dx%d\n", x, y, w, h);
+        return;
+     }
 }
 
 int
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h 
b/src/lib/ecore_wayland/Ecore_Wayland.h
index 250429e..372c984 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -129,6 +129,7 @@ struct _Ecore_Wl_Output
    struct wl_output *output;
    Eina_Rectangle allocation;
    int mw, mh;
+   int transform;
    struct wl_list link;
 
    void (*destroy) (Ecore_Wl_Output *output, void *data);
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index 82d8f86..5ebe3fa 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -213,8 +213,20 @@ ecore_wl_screen_size_get(int *w, int *h)
 
    if (!_ecore_wl_disp->output) return;
 
-   if (w) *w = _ecore_wl_disp->output->allocation.w;
-   if (h) *h = _ecore_wl_disp->output->allocation.h;
+   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;
+     }
 }
 
 /* @since 1.2 */
diff --git a/src/lib/ecore_wayland/ecore_wl_output.c 
b/src/lib/ecore_wayland/ecore_wl_output.c
index f0c59b4..46408d5 100644
--- a/src/lib/ecore_wayland/ecore_wl_output.c
+++ b/src/lib/ecore_wayland/ecore_wl_output.c
@@ -54,7 +54,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 
EINA_UNUSED, int x, int y, int w, int h, int subpixel EINA_UNUSED, const char 
*make EINA_UNUSED, const char *model EINA_UNUSED, int transform EINA_UNUSED)
+_ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output 
EINA_UNUSED, int x, int y, int w, int h, int subpixel EINA_UNUSED, const char 
*make EINA_UNUSED, const char *model EINA_UNUSED, int transform)
 {
    Ecore_Wl_Output *output;
 
@@ -65,6 +65,7 @@ _ecore_wl_output_cb_geometry(void *data, struct wl_output 
*wl_output EINA_UNUSED
    output->allocation.y = y;
    output->mw = w;
    output->mh = h;
+   output->transform = transform;
 }
 
 static void 

-- 

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html

Reply via email to