summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-09-17 07:37:07 +0100
committerChris Michael <cp.michael@samsung.com>2013-09-17 07:41:08 +0100
commit70db3bff95afc1b28d3fbb0cc92cf3c626b8c8dc (patch)
treea7318c0bf1962bcf9083c9d58033f2443572dd1f
parent43fda7c835cc9ee4af9ba5e483730f9782a8a35a (diff)
Rework common rotation code to match X11 more closely.
NB: Part of Phab T359 fix. Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c118
1 files changed, 82 insertions, 36 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 378fe67cac..eee881c8a2 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
@@ -293,58 +293,79 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
293 293
294 wdata = ee->engine.data; 294 wdata = ee->engine.data;
295 295
296 /* calculate difference in rotation */
296 rot_dif = ee->rotation - rotation; 297 rot_dif = ee->rotation - rotation;
297 if (rot_dif < 0) rot_dif = -rot_dif; 298 if (rot_dif < 0) rot_dif = -rot_dif;
298 299
300 /* set ecore_wayland window rotation */
301 ecore_wl_window_rotation_set(wdata->win, rotation);
302
303 /* check if rotation is just a flip */
299 if (rot_dif != 180) 304 if (rot_dif != 180)
300 { 305 {
301 int minw, minh, maxw, maxh, basew, baseh, stepw, steph; 306 int minw, minh, maxw, maxh;
302 int ww, hh; 307 int basew, baseh, stepw, steph;
303 308
309 /* check if we are rotating with resize */
304 if (!resize) 310 if (!resize)
305 { 311 {
312 int fw, fh;
313
314 /* grab framespace width & height */
315 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
316
317 /* check for fullscreen */
306 if (!ee->prop.fullscreen) 318 if (!ee->prop.fullscreen)
307 { 319 {
308 int fw, fh; 320 /* resize the ecore_wayland window */
309 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 321 ecore_wl_window_resize(wdata->win,
322 ee->req.h + fw, ee->req.w + fh, 0);
323
324 /* resize the canvas */
325 evas_output_size_set(ee->evas, ee->req.h + fw,
326 ee->req.w + fh);
327 evas_output_viewport_set(ee->evas, 0, 0,
328 ee->req.h + fw, ee->req.w + fh);
329 }
330 else
331 {
332 /* resize the canvas based on rotation */
310 if ((rotation == 0) || (rotation == 180)) 333 if ((rotation == 0) || (rotation == 180))
311 { 334 {
312 ecore_wl_window_resize(wdata->win, ee->h + fw, ee->w + fh, 0); 335 /* resize the ecore_wayland window */
336 ecore_wl_window_resize(wdata->win,
337 ee->req.w, ee->req.h, 0);
338
339 /* resize the canvas */
340 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
341 evas_output_viewport_set(ee->evas, 0, 0,
342 ee->req.w, ee->req.h);
313 } 343 }
314 else 344 else
315 { 345 {
316 ecore_wl_window_resize(wdata->win, ee->h + fh, ee->w + fw, 0); 346 /* resize the ecore_wayland window */
317 } 347 ecore_wl_window_resize(wdata->win,
318 if ((ee->rotation == 0) || (ee->rotation == 180)) 348 ee->req.h, ee->req.w, 0);
319 { 349
320 evas_output_size_set(ee->evas, ee->w + fw, ee->h + fh); 350 /* resize the canvas */
321 evas_output_viewport_set(ee->evas, 0, 0, ee->w + fw, ee->h + fh); 351 evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
322 } 352 evas_output_viewport_set(ee->evas, 0, 0,
323 else 353 ee->req.h, ee->req.w);
324 {
325 evas_output_size_set(ee->evas, ee->h + fw, ee->w + fh);
326 evas_output_viewport_set(ee->evas, 0, 0, ee->h + fw, ee->w + fh);
327 } 354 }
328 } 355 }
356
357 /* call the ecore_evas' resize function */
358 if (ee->func.fn_resize) ee->func.fn_resize(ee);
359
360 /* add canvas damage */
361 if ((ee->rotation == 0) || (ee->rotation == 180))
362 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
329 else 363 else
330 {
331 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
332 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
333 if (ee->func.fn_resize) ee->func.fn_resize(ee);
334 }
335 if ((ee->rotation == 90) || (ee->rotation == 270))
336 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w); 364 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
337 else
338 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
339 ww = ee->h;
340 hh = ee->w;
341 ee->w = ww;
342 ee->h = hh;
343 ee->req.w = ww;
344 ee->req.h = hh;
345 } 365 }
346 else 366 else
347 { 367 {
368 /* resize the canvas based on rotation */
348 if ((rotation == 0) || (rotation == 180)) 369 if ((rotation == 0) || (rotation == 180))
349 { 370 {
350 evas_output_size_set(ee->evas, ee->w, ee->h); 371 evas_output_size_set(ee->evas, ee->w, ee->h);
@@ -355,35 +376,60 @@ _rotation_do(Ecore_Evas *ee, int rotation, int resize)
355 evas_output_size_set(ee->evas, ee->h, ee->w); 376 evas_output_size_set(ee->evas, ee->h, ee->w);
356 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); 377 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
357 } 378 }
379
380 /* call the ecore_evas' resize function */
358 if (ee->func.fn_resize) ee->func.fn_resize(ee); 381 if (ee->func.fn_resize) ee->func.fn_resize(ee);
359 if ((ee->rotation == 90) || (ee->rotation == 270)) 382
360 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); 383 /* add canvas damage */
361 else 384 if ((ee->rotation == 0) || (ee->rotation == 180))
362 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 385 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
386 else
387 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
363 } 388 }
389
390 /* get min, max, base, & step sizes */
364 ecore_evas_size_min_get(ee, &minw, &minh); 391 ecore_evas_size_min_get(ee, &minw, &minh);
365 ecore_evas_size_max_get(ee, &maxw, &maxh); 392 ecore_evas_size_max_get(ee, &maxw, &maxh);
366 ecore_evas_size_base_get(ee, &basew, &baseh); 393 ecore_evas_size_base_get(ee, &basew, &baseh);
367 ecore_evas_size_step_get(ee, &stepw, &steph); 394 ecore_evas_size_step_get(ee, &stepw, &steph);
395
396 /* record the current rotation of the ecore_evas */
368 ee->rotation = rotation; 397 ee->rotation = rotation;
398
399 /* reset min, max, base, & step sizes */
369 ecore_evas_size_min_set(ee, minh, minw); 400 ecore_evas_size_min_set(ee, minh, minw);
370 ecore_evas_size_max_set(ee, maxh, maxw); 401 ecore_evas_size_max_set(ee, maxh, maxw);
371 ecore_evas_size_base_set(ee, baseh, basew); 402 ecore_evas_size_base_set(ee, baseh, basew);
372 ecore_evas_size_step_set(ee, steph, stepw); 403 ecore_evas_size_step_set(ee, steph, stepw);
404
405 /* send a mouse_move process
406 *
407 * NB: Is This Really Needed ?? */
373 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, 408 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
374 ecore_loop_time_get()); 409 ecore_loop_time_get());
375 } 410 }
376 else 411 else
377 { 412 {
413 /* resize the ecore_wayland window */
414 ecore_wl_window_resize(wdata->win, ee->w, ee->h, 0);
415
416 /* record the current rotation of the ecore_evas */
378 ee->rotation = rotation; 417 ee->rotation = rotation;
418
419 /* send a mouse_move process
420 *
421 * NB: Is This Really Needed ?? */
379 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, 422 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
380 ecore_loop_time_get()); 423 ecore_loop_time_get());
424
425 /* call the ecore_evas' resize function */
381 if (ee->func.fn_resize) ee->func.fn_resize(ee); 426 if (ee->func.fn_resize) ee->func.fn_resize(ee);
382 427
383 if ((ee->rotation == 90) || (ee->rotation == 270)) 428 /* add canvas damage */
384 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); 429 if ((ee->rotation == 0) || (ee->rotation == 180))
385 else
386 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 430 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
431 else
432 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
387 } 433 }
388} 434}
389 435