aboutsummaryrefslogtreecommitdiffstats
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
parentecore-wayland: return only the relevant state value for maximize/fullscreen (diff)
downloadefl-ab3ab4feaa5ce437473f709a7b11e8e84b4d51f9.tar.gz
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 https://phab.enlightenment.org/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)
EAPI void
ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
{
+ Eina_Bool prev;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+ prev = ecore_wl_window_maximized_get(win);
- if ((win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) == maximized) return;
+ maximized = !!maximized;
- if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL)
+ if (prev == maximized) return;
+
+ if (maximized)
{
if (win->xdg_surface)
- {
- xdg_surface_set_maximized(win->xdg_surface);
- win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
- }
+ xdg_surface_set_maximized(win->xdg_surface);
else if (win->shell_surface)
- {
- wl_shell_surface_set_maximized(win->shell_surface, NULL);
- win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
- }
+ wl_shell_surface_set_maximized(win->shell_surface, NULL);
+ win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
}
- else if (win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED)
+ else
{
if (win->xdg_surface)
- {
- xdg_surface_unset_maximized(win->xdg_surface);
- win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
- _ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
- }
+ xdg_surface_unset_maximized(win->xdg_surface);
else if (win->shell_surface)
- {
- wl_shell_surface_set_toplevel(win->shell_surface);
- win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
- _ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
- }
+ wl_shell_surface_set_toplevel(win->shell_surface);
+ win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
}
+ win->maximized = maximized;
}
EAPI Eina_Bool
@@ -496,10 +490,17 @@ ecore_wl_window_maximized_get(Ecore_Wl_Window *win)
EAPI void
ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
{
+ Eina_Bool prev;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
- if ((win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN) == fullscreen) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
+ prev = ecore_wl_window_fullscreen_get(win);
+
+ fullscreen = !!fullscreen;
+
+ if (prev == fullscreen) return;
if (fullscreen)
{
win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN;
@@ -520,8 +521,8 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
wl_shell_surface_set_toplevel(win->shell_surface);
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
- _ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 0);
}
+ win->fullscreen = fullscreen;
}
EAPI Eina_Bool