aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-11-18 12:19:17 -0500
committerChris Michael <cp.michael@samsung.com>2015-11-18 12:19:17 -0500
commit35b4794c4afd1c2ffc865a90068b26d36e72def9 (patch)
treec0325e3b2dc227b8a5314f6195d3165386901ed7 /src/lib/ecore_wayland
parenteolian: add eolian_type_aliased_base_get (diff)
downloadefl-35b4794c4afd1c2ffc865a90068b26d36e72def9.tar.gz
ecore-wayland: Add EINA_SAFETY checks to window functions
This adds EINA_SAFETY returns for all public facing ecore_wl_window functions. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c93
1 files changed, 58 insertions, 35 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 40c833e255..389cebceae 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -237,7 +237,7 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
eina_hash_del(_windows, _ecore_wl_window_id_str_get(win->id), win);
@@ -286,7 +286,7 @@ ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
input = win->keyboard_device;
ecore_wl_window_update_location(win, x, y);
@@ -315,7 +315,7 @@ ecore_wl_window_resize(Ecore_Wl_Window *win, int w EINA_UNUSED, int h EINA_UNUSE
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
input = win->keyboard_device;
@@ -342,7 +342,8 @@ ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
if (win->surface) wl_surface_damage(win->surface, x, y, w, h);
}
@@ -351,7 +352,7 @@ ecore_wl_window_commit(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
if ((win->surface))// && (win->has_buffer))
wl_surface_commit(win->surface);
@@ -362,7 +363,7 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
switch (win->buffer_type)
{
@@ -391,7 +392,8 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
+
if (win->surface) return win->surface;
if (_ecore_wl_disp->wl.session_recovery)
session_recovery_add_listener(_ecore_wl_disp->wl.session_recovery, &_ecore_session_recovery_listener, win);
@@ -418,7 +420,7 @@ ecore_wl_window_hide(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface);
win->xdg_surface = NULL;
@@ -438,7 +440,8 @@ ecore_wl_window_raise(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
/* FIXME: This should raise the xdg surface also */
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
@@ -482,7 +485,7 @@ ecore_wl_window_maximized_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
return win->maximized;
}
@@ -530,7 +533,7 @@ ecore_wl_window_fullscreen_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
return win->fullscreen;
}
@@ -540,7 +543,8 @@ ecore_wl_window_transparent_set(Ecore_Wl_Window *win, Eina_Bool transparent)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
win->transparent = transparent;
if (!win->transparent)
ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
@@ -554,7 +558,7 @@ ecore_wl_window_alpha_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
return win->alpha;
}
@@ -564,7 +568,8 @@ ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
win->alpha = alpha;
if (!win->alpha)
ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
@@ -578,7 +583,7 @@ ecore_wl_window_transparent_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
return win->transparent;
}
@@ -588,7 +593,8 @@ ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
win->allocation.w = w;
win->allocation.h = h;
if ((!ecore_wl_window_maximized_get(win)) && (!win->fullscreen))
@@ -608,7 +614,8 @@ ecore_wl_window_update_location(Ecore_Wl_Window *win, int x, int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
win->allocation.x = x;
win->allocation.y = y;
@@ -623,7 +630,8 @@ ecore_wl_window_surface_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
+
return win->surface;
}
@@ -633,7 +641,8 @@ ecore_wl_window_shell_surface_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
+
return win->shell_surface;
}
@@ -643,7 +652,8 @@ ecore_wl_window_xdg_surface_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
+
return win->xdg_surface;
}
@@ -662,7 +672,8 @@ ecore_wl_window_type_set(Ecore_Wl_Window *win, Ecore_Wl_Window_Type type)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
win->type = type;
}
@@ -673,7 +684,7 @@ ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, in
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
win->pointer.surface = surface;
win->pointer.hot_x = hot_x;
@@ -691,7 +702,7 @@ ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char *cursor_na
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
win->pointer.set = EINA_FALSE;
@@ -711,7 +722,7 @@ ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
win->pointer.set = EINA_FALSE;
@@ -725,6 +736,8 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
win->parent = parent;
}
@@ -737,7 +750,7 @@ ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
if (iconified)
{
@@ -776,7 +789,8 @@ ecore_wl_window_iconified_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
+
return win->minimized;
}
@@ -787,6 +801,8 @@ ecore_wl_window_surface_find(struct wl_surface *surface)
Ecore_Wl_Window *win = NULL;
void *data;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
+
itr = eina_hash_iterator_data_new(_windows);
while (eina_iterator_next(itr, &data))
{
@@ -808,7 +824,7 @@ ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
win->input.x = x;
win->input.y = y;
@@ -851,7 +867,7 @@ ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
win->opaque.x = x;
win->opaque.y = y;
@@ -889,7 +905,8 @@ ecore_wl_window_rotation_set(Ecore_Wl_Window *win, int rotation)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
win->rotation = rotation;
}
@@ -899,7 +916,8 @@ ecore_wl_window_rotation_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return 0;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
+
return win->rotation;
}
@@ -909,7 +927,8 @@ ecore_wl_window_id_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return 0;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
+
return win->id;
}
@@ -919,7 +938,8 @@ ecore_wl_window_surface_id_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return 0;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
+
return win->surface_id;
}
@@ -929,7 +949,8 @@ ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
eina_stringshare_replace(&win->title, title);
if ((win->xdg_surface) && (win->title))
@@ -944,7 +965,8 @@ ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return;
+ EINA_SAFETY_ON_NULL_RETURN(win);
+
eina_stringshare_replace(&win->class_name, class_name);
if ((win->xdg_surface) && (win->class_name))
@@ -960,7 +982,8 @@ ecore_wl_window_keyboard_get(Ecore_Wl_Window *win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) return 0;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
+
return win->keyboard_device;
}