Rework common rotation code to match X11 more closely.

NB: Part of Phab T359 fix.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-09-17 07:37:07 +01:00
parent 43fda7c835
commit 70db3bff95
1 changed files with 86 additions and 40 deletions

View File

@ -293,58 +293,79 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
wdata = ee->engine.data; wdata = ee->engine.data;
/* calculate difference in rotation */
rot_dif = ee->rotation - rotation; rot_dif = ee->rotation - rotation;
if (rot_dif < 0) rot_dif = -rot_dif; if (rot_dif < 0) rot_dif = -rot_dif;
/* set ecore_wayland window rotation */
ecore_wl_window_rotation_set(wdata->win, rotation);
/* check if rotation is just a flip */
if (rot_dif != 180) if (rot_dif != 180)
{ {
int minw, minh, maxw, maxh, basew, baseh, stepw, steph; int minw, minh, maxw, maxh;
int ww, hh; int basew, baseh, stepw, steph;
/* check if we are rotating with resize */
if (!resize) if (!resize)
{ {
int fw, fh;
/* grab framespace width & height */
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
/* check for fullscreen */
if (!ee->prop.fullscreen) if (!ee->prop.fullscreen)
{ {
int fw, fh; /* resize the ecore_wayland window */
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); ecore_wl_window_resize(wdata->win,
if ((rotation == 0) || (rotation == 180)) ee->req.h + fw, ee->req.w + fh, 0);
{
ecore_wl_window_resize(wdata->win, ee->h + fw, ee->w + fh, 0); /* resize the canvas */
} evas_output_size_set(ee->evas, ee->req.h + fw,
else ee->req.w + fh);
{ evas_output_viewport_set(ee->evas, 0, 0,
ecore_wl_window_resize(wdata->win, ee->h + fh, ee->w + fw, 0); ee->req.h + fw, ee->req.w + fh);
}
if ((ee->rotation == 0) || (ee->rotation == 180))
{
evas_output_size_set(ee->evas, ee->w + fw, ee->h + fh);
evas_output_viewport_set(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
}
else
{
evas_output_size_set(ee->evas, ee->h + fw, ee->w + fh);
evas_output_viewport_set(ee->evas, 0, 0, ee->h + fw, ee->w + fh);
}
} }
else else
{ {
evas_output_size_set(ee->evas, ee->req.w, ee->req.h); /* resize the canvas based on rotation */
evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h); if ((rotation == 0) || (rotation == 180))
if (ee->func.fn_resize) ee->func.fn_resize(ee); {
/* resize the ecore_wayland window */
ecore_wl_window_resize(wdata->win,
ee->req.w, ee->req.h, 0);
/* resize the canvas */
evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
evas_output_viewport_set(ee->evas, 0, 0,
ee->req.w, ee->req.h);
}
else
{
/* resize the ecore_wayland window */
ecore_wl_window_resize(wdata->win,
ee->req.h, ee->req.w, 0);
/* resize the canvas */
evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
evas_output_viewport_set(ee->evas, 0, 0,
ee->req.h, ee->req.w);
}
} }
if ((ee->rotation == 90) || (ee->rotation == 270))
evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w); /* call the ecore_evas' resize function */
else if (ee->func.fn_resize) ee->func.fn_resize(ee);
/* add canvas damage */
if ((ee->rotation == 0) || (ee->rotation == 180))
evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
ww = ee->h; else
hh = ee->w; evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
ee->w = ww;
ee->h = hh;
ee->req.w = ww;
ee->req.h = hh;
} }
else else
{ {
/* resize the canvas based on rotation */
if ((rotation == 0) || (rotation == 180)) if ((rotation == 0) || (rotation == 180))
{ {
evas_output_size_set(ee->evas, ee->w, ee->h); evas_output_size_set(ee->evas, ee->w, ee->h);
@ -355,35 +376,60 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
evas_output_size_set(ee->evas, ee->h, ee->w); evas_output_size_set(ee->evas, ee->h, ee->w);
evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
} }
/* call the ecore_evas' resize function */
if (ee->func.fn_resize) ee->func.fn_resize(ee); if (ee->func.fn_resize) ee->func.fn_resize(ee);
if ((ee->rotation == 90) || (ee->rotation == 270))
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); /* add canvas damage */
else if ((ee->rotation == 0) || (ee->rotation == 180))
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
else
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
} }
/* get min, max, base, & step sizes */
ecore_evas_size_min_get(ee, &minw, &minh); ecore_evas_size_min_get(ee, &minw, &minh);
ecore_evas_size_max_get(ee, &maxw, &maxh); ecore_evas_size_max_get(ee, &maxw, &maxh);
ecore_evas_size_base_get(ee, &basew, &baseh); ecore_evas_size_base_get(ee, &basew, &baseh);
ecore_evas_size_step_get(ee, &stepw, &steph); ecore_evas_size_step_get(ee, &stepw, &steph);
/* record the current rotation of the ecore_evas */
ee->rotation = rotation; ee->rotation = rotation;
/* reset min, max, base, & step sizes */
ecore_evas_size_min_set(ee, minh, minw); ecore_evas_size_min_set(ee, minh, minw);
ecore_evas_size_max_set(ee, maxh, maxw); ecore_evas_size_max_set(ee, maxh, maxw);
ecore_evas_size_base_set(ee, baseh, basew); ecore_evas_size_base_set(ee, baseh, basew);
ecore_evas_size_step_set(ee, steph, stepw); ecore_evas_size_step_set(ee, steph, stepw);
/* send a mouse_move process
*
* NB: Is This Really Needed ?? */
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_loop_time_get()); ecore_loop_time_get());
} }
else else
{ {
/* resize the ecore_wayland window */
ecore_wl_window_resize(wdata->win, ee->w, ee->h, 0);
/* record the current rotation of the ecore_evas */
ee->rotation = rotation; ee->rotation = rotation;
/* send a mouse_move process
*
* NB: Is This Really Needed ?? */
_ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
ecore_loop_time_get()); ecore_loop_time_get());
/* call the ecore_evas' resize function */
if (ee->func.fn_resize) ee->func.fn_resize(ee); if (ee->func.fn_resize) ee->func.fn_resize(ee);
if ((ee->rotation == 90) || (ee->rotation == 270)) /* add canvas damage */
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); if ((ee->rotation == 0) || (ee->rotation == 180))
else
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
else
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
} }
} }