summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-11-15 08:11:09 +0000
committerChris Michael <cp.michael@samsung.com>2013-11-15 08:11:09 +0000
commite28d54d3e46b434334e316fe27c341f454cfca21 (patch)
treec448c5bbf6bde27f05149eb38c96bbe043ffb0bb /src
parentbc6711b229bc1e49353eb4badc60c66a1b2c4198 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c109
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c85
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c86
3 files changed, 52 insertions, 228 deletions
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index d4fac80b85..53bc074cc7 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -204,30 +204,6 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
204 ee->prop.maximized = ecore_wl_window_maximized_get(wdata->win); 204 ee->prop.maximized = ecore_wl_window_maximized_get(wdata->win);
205 ee->prop.fullscreen = ecore_wl_window_fullscreen_get(wdata->win); 205 ee->prop.fullscreen = ecore_wl_window_fullscreen_get(wdata->win);
206 206
207 if ((prev_max != ee->prop.maximized) ||
208 (prev_full != ee->prop.fullscreen))
209 {
210 _ecore_evas_wl_common_state_update(ee);
211
212 if (prev_full != ee->prop.fullscreen)
213 _ecore_evas_wl_common_border_update(ee);
214 }
215
216 if (ee->prop.fullscreen)
217 {
218 _ecore_evas_wl_common_move(ee, ev->x, ev->y);
219 ee->engine.func->fn_resize(ee, ev->w, ev->h);
220
221 return ECORE_CALLBACK_PASS_ON;
222 }
223
224 if ((ee->x != ev->x) || (ee->y != ev->y))
225 {
226 ee->req.x = ev->x;
227 ee->req.y = ev->y;
228 if (ee->func.fn_move) ee->func.fn_move(ee);
229 }
230
231 nw = ev->w; 207 nw = ev->w;
232 nh = ev->h; 208 nh = ev->h;
233 209
@@ -238,50 +214,40 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
238 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 214 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
239 if ((ee->rotation == 90) || (ee->rotation == 270)) 215 if ((ee->rotation == 90) || (ee->rotation == 270))
240 { 216 {
241 if (!ee->prop.maximized) nw = ev->w - fh; 217 nw = ev->w - fh;
242 nh = ev->h - fw; 218 nh = ev->h - fw;
243 } 219 }
244 else 220 else
245 { 221 {
246 if (!ee->prop.maximized) nw = ev->w - fw; 222 nw = ev->w - fw;
247 nh = ev->h - fh; 223 nh = ev->h - fh;
248 } 224 }
249 } 225 }
250 226
251 if (ee->prop.min.w > nw) nw = ee->prop.min.w; 227 if (prev_full != ee->prop.fullscreen)
252 else if (nw > ee->prop.max.w) nw = ee->prop.max.w; 228 _ecore_evas_wl_common_border_update(ee);
253 if (ee->prop.min.h > nh) nh = ee->prop.min.h;
254 else if (nh > ee->prop.max.h) nh = ee->prop.max.h;
255 229
256 if ((ee->w != nw) || (ee->h != nh)) 230 if (ee->prop.fullscreen)
257 { 231 {
258 ee->req.w = nw; 232 _ecore_evas_wl_common_move(ee, ev->x, ev->y);
259 ee->req.h = nh; 233 _ecore_evas_wl_common_resize(ee, nw, nh);
260 ee->w = nw;
261 ee->h = nh;
262 if (ee->func.fn_resize) ee->func.fn_resize(ee);
263
264 if ((ee->rotation == 90) || (ee->rotation == 270))
265 {
266 evas_output_size_set(ee->evas, ev->h, ev->w);
267 evas_output_viewport_set(ee->evas, 0, 0, ev->h, ev->w);
268 }
269 else
270 {
271 evas_output_size_set(ee->evas, ev->w, ev->h);
272 evas_output_viewport_set(ee->evas, 0, 0, ev->w, ev->h);
273 }
274 234
275 if (wdata->frame) 235 if (prev_full != ee->prop.fullscreen)
276 evas_object_resize(wdata->frame, ev->w, ev->h); 236 _ecore_evas_wl_common_state_update(ee);
277 237
278 if (wdata->win) 238 return ECORE_CALLBACK_PASS_ON;
279 {
280 _ecore_evas_wayland_resize_edge_set(ee, ev->edges);
281 ecore_wl_window_update_size(wdata->win, ev->w, ev->h);
282 }
283 } 239 }
284 240
241 if ((ee->x != ev->x) || (ee->y != ev->y))
242 _ecore_evas_wl_common_move(ee, ev->x, ev->y);
243
244 if ((ee->w != ev->w) || (ee->h != ev->h))
245 _ecore_evas_wl_common_resize(ee, nw, nh);
246
247 if ((prev_max != ee->prop.maximized) ||
248 (prev_full != ee->prop.fullscreen))
249 _ecore_evas_wl_common_state_update(ee);
250
285 return ECORE_CALLBACK_PASS_ON; 251 return ECORE_CALLBACK_PASS_ON;
286} 252}
287 253
@@ -533,6 +499,8 @@ void
533_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h) 499_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
534{ 500{
535 Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data; 501 Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
502 int orig_w, orig_h;
503 int ow, oh;
536 504
537 LOGFN(__FILE__, __LINE__, __FUNCTION__); 505 LOGFN(__FILE__, __LINE__, __FUNCTION__);
538 506
@@ -541,6 +509,8 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
541 509
542 ee->req.w = w; 510 ee->req.w = w;
543 ee->req.h = h; 511 ee->req.h = h;
512 orig_w = w;
513 orig_h = h;
544 514
545 if (!ee->prop.fullscreen) 515 if (!ee->prop.fullscreen)
546 { 516 {
@@ -551,15 +521,27 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
551 if (ee->prop.min.h > h) h = ee->prop.min.h; 521 if (ee->prop.min.h > h) h = ee->prop.min.h;
552 else if (h > ee->prop.max.h) h = ee->prop.max.h; 522 else if (h > ee->prop.max.h) h = ee->prop.max.h;
553 523
524 orig_w = w;
525 orig_h = h;
526
554 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 527 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
555 w += fw; 528 if ((ee->rotation == 90) || (ee->rotation == 270))
556 h += fh; 529 {
530 w += fh;
531 h += fw;
532 }
533 else
534 {
535 w += fw;
536 h += fh;
537 }
557 } 538 }
558 539
559 if ((ee->w != w) || (ee->h != h)) 540 evas_output_size_get(ee->evas, &ow, &oh);
541 if ((ow != w) || (oh != h))
560 { 542 {
561 ee->w = w; 543 ee->w = orig_w;
562 ee->h = h; 544 ee->h = orig_h;
563 545
564 if ((ee->rotation == 90) || (ee->rotation == 270)) 546 if ((ee->rotation == 90) || (ee->rotation == 270))
565 { 547 {
@@ -583,6 +565,11 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
583 565
584 if (wdata->frame) 566 if (wdata->frame)
585 evas_object_resize(wdata->frame, w, h); 567 evas_object_resize(wdata->frame, w, h);
568
569 /* if (wdata->win) */
570 /* ecore_wl_window_update_size(wdata->win, w, h); */
571
572 if (ee->func.fn_resize) ee->func.fn_resize(ee);
586 } 573 }
587} 574}
588 575
@@ -1118,7 +1105,7 @@ _ecore_evas_wl_common_maximized_set(Ecore_Evas *ee, int max)
1118 if (ee->prop.maximized == max) return; 1105 if (ee->prop.maximized == max) return;
1119 wdata = ee->engine.data; 1106 wdata = ee->engine.data;
1120 ecore_wl_window_maximized_set(wdata->win, max); 1107 ecore_wl_window_maximized_set(wdata->win, max);
1121 _ecore_evas_wl_common_state_update(ee); 1108// _ecore_evas_wl_common_state_update(ee);
1122} 1109}
1123 1110
1124void 1111void
@@ -1132,7 +1119,7 @@ _ecore_evas_wl_common_fullscreen_set(Ecore_Evas *ee, int full)
1132 if (ee->prop.fullscreen == full) return; 1119 if (ee->prop.fullscreen == full) return;
1133 wdata = ee->engine.data; 1120 wdata = ee->engine.data;
1134 ecore_wl_window_fullscreen_set(wdata->win, full); 1121 ecore_wl_window_fullscreen_set(wdata->win, full);
1135 _ecore_evas_wl_common_state_update(ee); 1122// _ecore_evas_wl_common_state_update(ee);
1136} 1123}
1137 1124
1138void 1125void
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index 442937d85e..c150d6aa03 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -9,7 +9,6 @@
9# include <Evas_Engine_Wayland_Egl.h> 9# include <Evas_Engine_Wayland_Egl.h>
10 10
11/* local function prototypes */ 11/* local function prototypes */
12static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
13static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h); 12static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
14static void _ecore_evas_wl_show(Ecore_Evas *ee); 13static void _ecore_evas_wl_show(Ecore_Evas *ee);
15static void _ecore_evas_wl_hide(Ecore_Evas *ee); 14static void _ecore_evas_wl_hide(Ecore_Evas *ee);
@@ -36,7 +35,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
36 NULL, // post_render_set 35 NULL, // post_render_set
37 _ecore_evas_wl_common_move, 36 _ecore_evas_wl_common_move,
38 NULL, // managed_move 37 NULL, // managed_move
39 _ecore_evas_wl_resize, 38 _ecore_evas_wl_common_resize,
40 _ecore_evas_wl_move_resize, 39 _ecore_evas_wl_move_resize,
41 _ecore_evas_wl_rotation_set, 40 _ecore_evas_wl_rotation_set,
42 NULL, // shaped_set 41 NULL, // shaped_set
@@ -252,86 +251,6 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
252} 251}
253 252
254static void 253static void
255_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
256{
257 Ecore_Evas_Engine_Wl_Data *wdata;
258 LOGFN(__FILE__, __LINE__, __FUNCTION__);
259 int orig_w, orig_h;
260 int ow, oh;
261
262 if (!ee) return;
263 if (w < 1) w = 1;
264 if (h < 1) h = 1;
265
266 ee->req.w = w;
267 ee->req.h = h;
268 orig_w = w;
269 orig_h = h;
270
271 wdata = ee->engine.data;
272
273 if (!ee->prop.fullscreen)
274 {
275 int fw = 0, fh = 0;
276
277 if (ee->prop.min.w > w) w = ee->prop.min.w;
278 else if (w > ee->prop.max.w) w = ee->prop.max.w;
279 if (ee->prop.min.h > h) h = ee->prop.min.h;
280 else if (h > ee->prop.max.h) h = ee->prop.max.h;
281
282 orig_w = w;
283 orig_h = h;
284
285 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
286 if ((ee->rotation == 90) || (ee->rotation == 270))
287 {
288 w += fh;
289 h += fw;
290 }
291 else
292 {
293 w += fw;
294 h += fh;
295 }
296 }
297
298 evas_output_size_get(ee->evas, &ow, &oh);
299 if ((ow != w) || (oh != h))
300 {
301 ee->w = orig_w;
302 ee->h = orig_h;
303
304 if ((ee->rotation == 90) || (ee->rotation == 270))
305 {
306 evas_output_size_set(ee->evas, h, w);
307 evas_output_viewport_set(ee->evas, 0, 0, h, w);
308 }
309 else
310 {
311 evas_output_size_set(ee->evas, w, h);
312 evas_output_viewport_set(ee->evas, 0, 0, w, h);
313 }
314
315 if (ee->prop.avoid_damage)
316 {
317 int pdam = 0;
318
319 pdam = ecore_evas_avoid_damage_get(ee);
320 ecore_evas_avoid_damage_set(ee, 0);
321 ecore_evas_avoid_damage_set(ee, pdam);
322 }
323
324 if (wdata->frame)
325 evas_object_resize(wdata->frame, w, h);
326
327 if (wdata->win)
328 ecore_wl_window_update_size(wdata->win, w, h);
329
330 if (ee->func.fn_resize) ee->func.fn_resize(ee);
331 }
332}
333
334static void
335_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) 254_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
336{ 255{
337 LOGFN(__FILE__, __LINE__, __FUNCTION__); 256 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -340,7 +259,7 @@ _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
340 if ((ee->x != x) || (ee->y != y)) 259 if ((ee->x != x) || (ee->y != y))
341 _ecore_evas_wl_common_move(ee, x, y); 260 _ecore_evas_wl_common_move(ee, x, y);
342 if ((ee->w != w) || (ee->h != h)) 261 if ((ee->w != w) || (ee->h != h))
343 _ecore_evas_wl_resize(ee, w, h); 262 _ecore_evas_wl_common_resize(ee, w, h);
344} 263}
345 264
346static void 265static void
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index cfdd33c20c..b4539470c7 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -9,7 +9,6 @@
9# include <sys/mman.h> 9# include <sys/mman.h>
10 10
11/* local function prototypes */ 11/* local function prototypes */
12static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
13static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h); 12static void _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
14static void _ecore_evas_wl_show(Ecore_Evas *ee); 13static void _ecore_evas_wl_show(Ecore_Evas *ee);
15static void _ecore_evas_wl_hide(Ecore_Evas *ee); 14static void _ecore_evas_wl_hide(Ecore_Evas *ee);
@@ -36,7 +35,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
36 NULL, // post_render_set 35 NULL, // post_render_set
37 _ecore_evas_wl_common_move, 36 _ecore_evas_wl_common_move,
38 NULL, // managed_move 37 NULL, // managed_move
39 _ecore_evas_wl_resize, 38 _ecore_evas_wl_common_resize,
40 _ecore_evas_wl_move_resize, 39 _ecore_evas_wl_move_resize,
41 _ecore_evas_wl_rotation_set, 40 _ecore_evas_wl_rotation_set,
42 NULL, // shaped_set 41 NULL, // shaped_set
@@ -245,87 +244,6 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
245} 244}
246 245
247static void 246static void
248_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
249{
250 Ecore_Evas_Engine_Wl_Data *wdata;
251 int orig_w, orig_h;
252 int ow, oh;
253
254 LOGFN(__FILE__, __LINE__, __FUNCTION__);
255
256 if (!ee) return;
257 if (w < 1) w = 1;
258 if (h < 1) h = 1;
259
260 ee->req.w = w;
261 ee->req.h = h;
262 orig_w = w;
263 orig_h = h;
264
265 wdata = ee->engine.data;
266
267 if (!ee->prop.fullscreen)
268 {
269 int fw = 0, fh = 0;
270
271 if (ee->prop.min.w > w) w = ee->prop.min.w;
272 else if (w > ee->prop.max.w) w = ee->prop.max.w;
273 if (ee->prop.min.h > h) h = ee->prop.min.h;
274 else if (h > ee->prop.max.h) h = ee->prop.max.h;
275
276 orig_w = w;
277 orig_h = h;
278
279 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
280 if ((ee->rotation == 90) || (ee->rotation == 270))
281 {
282 w += fh;
283 h += fw;
284 }
285 else
286 {
287 w += fw;
288 h += fh;
289 }
290 }
291
292 evas_output_size_get(ee->evas, &ow, &oh);
293 if ((ow != w) || (oh != h))
294 {
295 ee->w = orig_w;
296 ee->h = orig_h;
297
298 if ((ee->rotation == 90) || (ee->rotation == 270))
299 {
300 evas_output_size_set(ee->evas, h, w);
301 evas_output_viewport_set(ee->evas, 0, 0, h, w);
302 }
303 else
304 {
305 evas_output_size_set(ee->evas, w, h);
306 evas_output_viewport_set(ee->evas, 0, 0, w, h);
307 }
308
309 if (ee->prop.avoid_damage)
310 {
311 int pdam = 0;
312
313 pdam = ecore_evas_avoid_damage_get(ee);
314 ecore_evas_avoid_damage_set(ee, 0);
315 ecore_evas_avoid_damage_set(ee, pdam);
316 }
317
318 if (wdata->frame)
319 evas_object_resize(wdata->frame, w, h);
320
321 if (wdata->win)
322 ecore_wl_window_update_size(wdata->win, w, h);
323
324 if (ee->func.fn_resize) ee->func.fn_resize(ee);
325 }
326}
327
328static void
329_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) 247_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
330{ 248{
331 LOGFN(__FILE__, __LINE__, __FUNCTION__); 249 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -334,7 +252,7 @@ _ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
334 if ((ee->x != x) || (ee->y != y)) 252 if ((ee->x != x) || (ee->y != y))
335 _ecore_evas_wl_common_move(ee, x, y); 253 _ecore_evas_wl_common_move(ee, x, y);
336 if ((ee->w != w) || (ee->h != h)) 254 if ((ee->w != w) || (ee->h != h))
337 _ecore_evas_wl_resize(ee, w, h); 255 _ecore_evas_wl_common_resize(ee, w, h);
338} 256}
339 257
340static void 258static void