forked from enlightenment/efl
Unify ecore_evas resize code across both shm and egl engines.
This reduces code duplication for ecore_evas resize routines inside wayland engines by using a common _ecore_evas_wl_common_resize function as the resize code for both engines was the same anyway. Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
bc6711b229
commit
e28d54d3e4
|
@ -204,30 +204,6 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
|
||||||
ee->prop.maximized = ecore_wl_window_maximized_get(wdata->win);
|
ee->prop.maximized = ecore_wl_window_maximized_get(wdata->win);
|
||||||
ee->prop.fullscreen = ecore_wl_window_fullscreen_get(wdata->win);
|
ee->prop.fullscreen = ecore_wl_window_fullscreen_get(wdata->win);
|
||||||
|
|
||||||
if ((prev_max != ee->prop.maximized) ||
|
|
||||||
(prev_full != ee->prop.fullscreen))
|
|
||||||
{
|
|
||||||
_ecore_evas_wl_common_state_update(ee);
|
|
||||||
|
|
||||||
if (prev_full != ee->prop.fullscreen)
|
|
||||||
_ecore_evas_wl_common_border_update(ee);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ee->prop.fullscreen)
|
|
||||||
{
|
|
||||||
_ecore_evas_wl_common_move(ee, ev->x, ev->y);
|
|
||||||
ee->engine.func->fn_resize(ee, ev->w, ev->h);
|
|
||||||
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ee->x != ev->x) || (ee->y != ev->y))
|
|
||||||
{
|
|
||||||
ee->req.x = ev->x;
|
|
||||||
ee->req.y = ev->y;
|
|
||||||
if (ee->func.fn_move) ee->func.fn_move(ee);
|
|
||||||
}
|
|
||||||
|
|
||||||
nw = ev->w;
|
nw = ev->w;
|
||||||
nh = ev->h;
|
nh = ev->h;
|
||||||
|
|
||||||
|
@ -238,50 +214,40 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
|
||||||
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
||||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
if ((ee->rotation == 90) || (ee->rotation == 270))
|
||||||
{
|
{
|
||||||
if (!ee->prop.maximized) nw = ev->w - fh;
|
nw = ev->w - fh;
|
||||||
nh = ev->h - fw;
|
nh = ev->h - fw;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!ee->prop.maximized) nw = ev->w - fw;
|
nw = ev->w - fw;
|
||||||
nh = ev->h - fh;
|
nh = ev->h - fh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ee->prop.min.w > nw) nw = ee->prop.min.w;
|
if (prev_full != ee->prop.fullscreen)
|
||||||
else if (nw > ee->prop.max.w) nw = ee->prop.max.w;
|
_ecore_evas_wl_common_border_update(ee);
|
||||||
if (ee->prop.min.h > nh) nh = ee->prop.min.h;
|
|
||||||
else if (nh > ee->prop.max.h) nh = ee->prop.max.h;
|
|
||||||
|
|
||||||
if ((ee->w != nw) || (ee->h != nh))
|
if (ee->prop.fullscreen)
|
||||||
{
|
{
|
||||||
ee->req.w = nw;
|
_ecore_evas_wl_common_move(ee, ev->x, ev->y);
|
||||||
ee->req.h = nh;
|
_ecore_evas_wl_common_resize(ee, nw, nh);
|
||||||
ee->w = nw;
|
|
||||||
ee->h = nh;
|
|
||||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
||||||
|
|
||||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
if (prev_full != ee->prop.fullscreen)
|
||||||
{
|
_ecore_evas_wl_common_state_update(ee);
|
||||||
evas_output_size_set(ee->evas, ev->h, ev->w);
|
|
||||||
evas_output_viewport_set(ee->evas, 0, 0, ev->h, ev->w);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_output_size_set(ee->evas, ev->w, ev->h);
|
|
||||||
evas_output_viewport_set(ee->evas, 0, 0, ev->w, ev->h);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wdata->frame)
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
evas_object_resize(wdata->frame, ev->w, ev->h);
|
|
||||||
|
|
||||||
if (wdata->win)
|
|
||||||
{
|
|
||||||
_ecore_evas_wayland_resize_edge_set(ee, ev->edges);
|
|
||||||
ecore_wl_window_update_size(wdata->win, ev->w, ev->h);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((ee->x != ev->x) || (ee->y != ev->y))
|
||||||
|
_ecore_evas_wl_common_move(ee, ev->x, ev->y);
|
||||||
|
|
||||||
|
if ((ee->w != ev->w) || (ee->h != ev->h))
|
||||||
|
_ecore_evas_wl_common_resize(ee, nw, nh);
|
||||||
|
|
||||||
|
if ((prev_max != ee->prop.maximized) ||
|
||||||
|
(prev_full != ee->prop.fullscreen))
|
||||||
|
_ecore_evas_wl_common_state_update(ee);
|
||||||
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +499,8 @@ void
|
||||||
_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
||||||
{
|
{
|
||||||
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
||||||
|
int orig_w, orig_h;
|
||||||
|
int ow, oh;
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
|
@ -541,6 +509,8 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
||||||
|
|
||||||
ee->req.w = w;
|
ee->req.w = w;
|
||||||
ee->req.h = h;
|
ee->req.h = h;
|
||||||
|
orig_w = w;
|
||||||
|
orig_h = h;
|
||||||
|
|
||||||
if (!ee->prop.fullscreen)
|
if (!ee->prop.fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -551,15 +521,27 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
||||||
if (ee->prop.min.h > h) h = ee->prop.min.h;
|
if (ee->prop.min.h > h) h = ee->prop.min.h;
|
||||||
else if (h > ee->prop.max.h) h = ee->prop.max.h;
|
else if (h > ee->prop.max.h) h = ee->prop.max.h;
|
||||||
|
|
||||||
|
orig_w = w;
|
||||||
|
orig_h = h;
|
||||||
|
|
||||||
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
||||||
w += fw;
|
if ((ee->rotation == 90) || (ee->rotation == 270))
|
||||||
h += fh;
|
{
|
||||||
|
w += fh;
|
||||||
|
h += fw;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
w += fw;
|
||||||
|
h += fh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ee->w != w) || (ee->h != h))
|
evas_output_size_get(ee->evas, &ow, &oh);
|
||||||
|
if ((ow != w) || (oh != h))
|
||||||
{
|
{
|
||||||
ee->w = w;
|
ee->w = orig_w;
|
||||||
ee->h = h;
|
ee->h = orig_h;
|
||||||
|
|
||||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
if ((ee->rotation == 90) || (ee->rotation == 270))
|
||||||
{
|
{
|
||||||
|
@ -583,6 +565,11 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
||||||
|
|
||||||
if (wdata->frame)
|
if (wdata->frame)
|
||||||
evas_object_resize(wdata->frame, w, h);
|
evas_object_resize(wdata->frame, w, h);
|
||||||
|
|
||||||
|
/* if (wdata->win) */
|
||||||
|
/* ecore_wl_window_update_size(wdata->win, w, h); */
|
||||||
|
|
||||||
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1118,7 +1105,7 @@ _ecore_evas_wl_common_maximized_set(Ecore_Evas *ee, int max)
|
||||||
if (ee->prop.maximized == max) return;
|
if (ee->prop.maximized == max) return;
|
||||||
wdata = ee->engine.data;
|
wdata = ee->engine.data;
|
||||||
ecore_wl_window_maximized_set(wdata->win, max);
|
ecore_wl_window_maximized_set(wdata->win, max);
|
||||||
_ecore_evas_wl_common_state_update(ee);
|
// _ecore_evas_wl_common_state_update(ee);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1132,7 +1119,7 @@ _ecore_evas_wl_common_fullscreen_set(Ecore_Evas *ee, int full)
|
||||||
if (ee->prop.fullscreen == full) return;
|
if (ee->prop.fullscreen == full) return;
|
||||||
wdata = ee->engine.data;
|
wdata = ee->engine.data;
|
||||||
ecore_wl_window_fullscreen_set(wdata->win, full);
|
ecore_wl_window_fullscreen_set(wdata->win, full);
|
||||||
_ecore_evas_wl_common_state_update(ee);
|
// _ecore_evas_wl_common_state_update(ee);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
# include <Evas_Engine_Wayland_Egl.h>
|
# include <Evas_Engine_Wayland_Egl.h>
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
|
|
||||||
static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
|
static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
|
||||||
static void _ecore_evas_wl_show(Ecore_Evas *ee);
|
static void _ecore_evas_wl_show(Ecore_Evas *ee);
|
||||||
static void _ecore_evas_wl_hide(Ecore_Evas *ee);
|
static void _ecore_evas_wl_hide(Ecore_Evas *ee);
|
||||||
|
@ -36,7 +35,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
|
||||||
NULL, // post_render_set
|
NULL, // post_render_set
|
||||||
_ecore_evas_wl_common_move,
|
_ecore_evas_wl_common_move,
|
||||||
NULL, // managed_move
|
NULL, // managed_move
|
||||||
_ecore_evas_wl_resize,
|
_ecore_evas_wl_common_resize,
|
||||||
_ecore_evas_wl_move_resize,
|
_ecore_evas_wl_move_resize,
|
||||||
_ecore_evas_wl_rotation_set,
|
_ecore_evas_wl_rotation_set,
|
||||||
NULL, // shaped_set
|
NULL, // shaped_set
|
||||||
|
@ -251,86 +250,6 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
|
|
||||||
{
|
|
||||||
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
||||||
int orig_w, orig_h;
|
|
||||||
int ow, oh;
|
|
||||||
|
|
||||||
if (!ee) return;
|
|
||||||
if (w < 1) w = 1;
|
|
||||||
if (h < 1) h = 1;
|
|
||||||
|
|
||||||
ee->req.w = w;
|
|
||||||
ee->req.h = h;
|
|
||||||
orig_w = w;
|
|
||||||
orig_h = h;
|
|
||||||
|
|
||||||
wdata = ee->engine.data;
|
|
||||||
|
|
||||||
if (!ee->prop.fullscreen)
|
|
||||||
{
|
|
||||||
int fw = 0, fh = 0;
|
|
||||||
|
|
||||||
if (ee->prop.min.w > w) w = ee->prop.min.w;
|
|
||||||
else if (w > ee->prop.max.w) w = ee->prop.max.w;
|
|
||||||
if (ee->prop.min.h > h) h = ee->prop.min.h;
|
|
||||||
else if (h > ee->prop.max.h) h = ee->prop.max.h;
|
|
||||||
|
|
||||||
orig_w = w;
|
|
||||||
orig_h = h;
|
|
||||||
|
|
||||||
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
||||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
|
||||||
{
|
|
||||||
w += fh;
|
|
||||||
h += fw;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w += fw;
|
|
||||||
h += fh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
evas_output_size_get(ee->evas, &ow, &oh);
|
|
||||||
if ((ow != w) || (oh != h))
|
|
||||||
{
|
|
||||||
ee->w = orig_w;
|
|
||||||
ee->h = orig_h;
|
|
||||||
|
|
||||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
|
||||||
{
|
|
||||||
evas_output_size_set(ee->evas, h, w);
|
|
||||||
evas_output_viewport_set(ee->evas, 0, 0, h, w);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_output_size_set(ee->evas, w, h);
|
|
||||||
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ee->prop.avoid_damage)
|
|
||||||
{
|
|
||||||
int pdam = 0;
|
|
||||||
|
|
||||||
pdam = ecore_evas_avoid_damage_get(ee);
|
|
||||||
ecore_evas_avoid_damage_set(ee, 0);
|
|
||||||
ecore_evas_avoid_damage_set(ee, pdam);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wdata->frame)
|
|
||||||
evas_object_resize(wdata->frame, w, h);
|
|
||||||
|
|
||||||
if (wdata->win)
|
|
||||||
ecore_wl_window_update_size(wdata->win, w, h);
|
|
||||||
|
|
||||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -340,7 +259,7 @@ _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
||||||
if ((ee->x != x) || (ee->y != y))
|
if ((ee->x != x) || (ee->y != y))
|
||||||
_ecore_evas_wl_common_move(ee, x, y);
|
_ecore_evas_wl_common_move(ee, x, y);
|
||||||
if ((ee->w != w) || (ee->h != h))
|
if ((ee->w != w) || (ee->h != h))
|
||||||
_ecore_evas_wl_resize(ee, w, h);
|
_ecore_evas_wl_common_resize(ee, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
|
|
||||||
static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
|
static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
|
||||||
static void _ecore_evas_wl_show(Ecore_Evas *ee);
|
static void _ecore_evas_wl_show(Ecore_Evas *ee);
|
||||||
static void _ecore_evas_wl_hide(Ecore_Evas *ee);
|
static void _ecore_evas_wl_hide(Ecore_Evas *ee);
|
||||||
|
@ -36,7 +35,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
|
||||||
NULL, // post_render_set
|
NULL, // post_render_set
|
||||||
_ecore_evas_wl_common_move,
|
_ecore_evas_wl_common_move,
|
||||||
NULL, // managed_move
|
NULL, // managed_move
|
||||||
_ecore_evas_wl_resize,
|
_ecore_evas_wl_common_resize,
|
||||||
_ecore_evas_wl_move_resize,
|
_ecore_evas_wl_move_resize,
|
||||||
_ecore_evas_wl_rotation_set,
|
_ecore_evas_wl_rotation_set,
|
||||||
NULL, // shaped_set
|
NULL, // shaped_set
|
||||||
|
@ -244,87 +243,6 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
|
|
||||||
{
|
|
||||||
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
||||||
int orig_w, orig_h;
|
|
||||||
int ow, oh;
|
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
||||||
|
|
||||||
if (!ee) return;
|
|
||||||
if (w < 1) w = 1;
|
|
||||||
if (h < 1) h = 1;
|
|
||||||
|
|
||||||
ee->req.w = w;
|
|
||||||
ee->req.h = h;
|
|
||||||
orig_w = w;
|
|
||||||
orig_h = h;
|
|
||||||
|
|
||||||
wdata = ee->engine.data;
|
|
||||||
|
|
||||||
if (!ee->prop.fullscreen)
|
|
||||||
{
|
|
||||||
int fw = 0, fh = 0;
|
|
||||||
|
|
||||||
if (ee->prop.min.w > w) w = ee->prop.min.w;
|
|
||||||
else if (w > ee->prop.max.w) w = ee->prop.max.w;
|
|
||||||
if (ee->prop.min.h > h) h = ee->prop.min.h;
|
|
||||||
else if (h > ee->prop.max.h) h = ee->prop.max.h;
|
|
||||||
|
|
||||||
orig_w = w;
|
|
||||||
orig_h = h;
|
|
||||||
|
|
||||||
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
||||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
|
||||||
{
|
|
||||||
w += fh;
|
|
||||||
h += fw;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w += fw;
|
|
||||||
h += fh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
evas_output_size_get(ee->evas, &ow, &oh);
|
|
||||||
if ((ow != w) || (oh != h))
|
|
||||||
{
|
|
||||||
ee->w = orig_w;
|
|
||||||
ee->h = orig_h;
|
|
||||||
|
|
||||||
if ((ee->rotation == 90) || (ee->rotation == 270))
|
|
||||||
{
|
|
||||||
evas_output_size_set(ee->evas, h, w);
|
|
||||||
evas_output_viewport_set(ee->evas, 0, 0, h, w);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_output_size_set(ee->evas, w, h);
|
|
||||||
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ee->prop.avoid_damage)
|
|
||||||
{
|
|
||||||
int pdam = 0;
|
|
||||||
|
|
||||||
pdam = ecore_evas_avoid_damage_get(ee);
|
|
||||||
ecore_evas_avoid_damage_set(ee, 0);
|
|
||||||
ecore_evas_avoid_damage_set(ee, pdam);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wdata->frame)
|
|
||||||
evas_object_resize(wdata->frame, w, h);
|
|
||||||
|
|
||||||
if (wdata->win)
|
|
||||||
ecore_wl_window_update_size(wdata->win, w, h);
|
|
||||||
|
|
||||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -334,7 +252,7 @@ _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
||||||
if ((ee->x != x) || (ee->y != y))
|
if ((ee->x != x) || (ee->y != y))
|
||||||
_ecore_evas_wl_common_move(ee, x, y);
|
_ecore_evas_wl_common_move(ee, x, y);
|
||||||
if ((ee->w != w) || (ee->h != h))
|
if ((ee->w != w) || (ee->h != h))
|
||||||
_ecore_evas_wl_resize(ee, w, h);
|
_ecore_evas_wl_common_resize(ee, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue