forked from enlightenment/efl
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.
This commit is contained in:
parent
1cb5a8f63a
commit
97d06e5b3f
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -213,9 +213,21 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* @since 1.2 */
|
||||
EAPI void
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue