summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-11-17 18:24:09 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-11-17 18:24:09 -0500
commitab3ab4feaa5ce437473f709a7b11e8e84b4d51f9 (patch)
tree52a6f9121fede7bacb1f3a034ec3bffa6d70e5e4 /src/lib/ecore_wayland
parent3b480804fc1a73edac6a7239ad329c9942ae2627 (diff)
ecore-wayland: rewrite maximize/fullscreen set functions for consistency
* use safety macros for win struct param (should be the case for all fns here) * sanitize bool params * enforce window state flag setting * correctly detect window state using window flag instead of type @fix ref T2841
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 47f41725c0..40c833e255 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -447,40 +447,34 @@ ecore_wl_window_raise(Ecore_Wl_Window *win)
447EAPI void 447EAPI void
448ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized) 448ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
449{ 449{
450 Eina_Bool prev;
451
450 LOGFN(__FILE__, __LINE__, __FUNCTION__); 452 LOGFN(__FILE__, __LINE__, __FUNCTION__);
451 453
452 if (!win) return; 454 EINA_SAFETY_ON_NULL_RETURN(win);
455 prev = ecore_wl_window_maximized_get(win);
453 456
454 if ((win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) == maximized) return; 457 maximized = !!maximized;
455 458
456 if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL) 459 if (prev == maximized) return;
460
461 if (maximized)
457 { 462 {
458 if (win->xdg_surface) 463 if (win->xdg_surface)
459 { 464 xdg_surface_set_maximized(win->xdg_surface);
460 xdg_surface_set_maximized(win->xdg_surface);
461 win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
462 }
463 else if (win->shell_surface) 465 else if (win->shell_surface)
464 { 466 wl_shell_surface_set_maximized(win->shell_surface, NULL);
465 wl_shell_surface_set_maximized(win->shell_surface, NULL); 467 win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
466 win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
467 }
468 } 468 }
469 else if (win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) 469 else
470 { 470 {
471 if (win->xdg_surface) 471 if (win->xdg_surface)
472 { 472 xdg_surface_unset_maximized(win->xdg_surface);
473 xdg_surface_unset_maximized(win->xdg_surface);
474 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
475 _ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
476 }
477 else if (win->shell_surface) 473 else if (win->shell_surface)
478 { 474 wl_shell_surface_set_toplevel(win->shell_surface);
479 wl_shell_surface_set_toplevel(win->shell_surface); 475 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
480 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
481 _ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
482 }
483 } 476 }
477 win->maximized = maximized;
484} 478}
485 479
486EAPI Eina_Bool 480EAPI Eina_Bool
@@ -496,10 +490,17 @@ ecore_wl_window_maximized_get(Ecore_Wl_Window *win)
496EAPI void 490EAPI void
497ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen) 491ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
498{ 492{
493 Eina_Bool prev;
494
499 LOGFN(__FILE__, __LINE__, __FUNCTION__); 495 LOGFN(__FILE__, __LINE__, __FUNCTION__);
500 496
501 if (!win) return; 497 EINA_SAFETY_ON_NULL_RETURN(win);
502 if ((win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN) == fullscreen) return; 498
499 prev = ecore_wl_window_fullscreen_get(win);
500
501 fullscreen = !!fullscreen;
502
503 if (prev == fullscreen) return;
503 if (fullscreen) 504 if (fullscreen)
504 { 505 {
505 win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN; 506 win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN;
@@ -520,8 +521,8 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
520 wl_shell_surface_set_toplevel(win->shell_surface); 521 wl_shell_surface_set_toplevel(win->shell_surface);
521 522
522 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL; 523 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
523 _ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
524 } 524 }
525 win->fullscreen = fullscreen;
525} 526}
526 527
527EAPI Eina_Bool 528EAPI Eina_Bool