diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-07-14 18:43:06 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-07-14 18:43:00 -0400 |
commit | 3d4bb3851ce2e7144ee6981dfa7edee7ece171f7 (patch) | |
tree | 1732e529b65f62683503bfe816a19d0d9feb70d8 /src/lib/ecore_evas/ecore_evas.c | |
parent | bc3dc78a52bc72ea96d6ea58bb65fce230ec1e7a (diff) |
ecore-evas: make the window_get apis return null without errors on failure
the normal usage of these is something like
if (!strcmp(engine, my_engine))
win = window_get(ee);
which is a waste of effort since the window_get() functions all check
the engine interface internally
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_evas/ecore_evas.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index c3feb3fc28..6fde09b5e5 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c | |||
@@ -432,8 +432,8 @@ _ecore_evas_cursors_init(Ecore_Evas *ee) | |||
432 | return EINA_TRUE; | 432 | return EINA_TRUE; |
433 | } | 433 | } |
434 | 434 | ||
435 | EAPI Ecore_Evas_Interface * | 435 | static Ecore_Evas_Interface * |
436 | _ecore_evas_interface_get(const Ecore_Evas *ee, const char *iname) | 436 | _ecore_evas_interface_get_internal(const Ecore_Evas *ee, const char *iname, Eina_Bool cri) |
437 | { | 437 | { |
438 | Eina_List *l; | 438 | Eina_List *l; |
439 | Ecore_Evas_Interface *i; | 439 | Ecore_Evas_Interface *i; |
@@ -443,16 +443,23 @@ _ecore_evas_interface_get(const Ecore_Evas *ee, const char *iname) | |||
443 | 443 | ||
444 | EINA_LIST_FOREACH(ee->engine.ifaces, l, i) | 444 | EINA_LIST_FOREACH(ee->engine.ifaces, l, i) |
445 | { | 445 | { |
446 | if (!strcmp(i->name, iname)) | 446 | if (!strcmp(i->name, iname)) |
447 | return i; | 447 | return i; |
448 | } | 448 | } |
449 | 449 | ||
450 | CRI("Ecore_Evas %p (engine: %s) does not have interface '%s'", | 450 | if (cri) |
451 | ee, ee->driver, iname); | 451 | CRI("Ecore_Evas %p (engine: %s) does not have interface '%s'", |
452 | ee, ee->driver, iname); | ||
452 | 453 | ||
453 | return NULL; | 454 | return NULL; |
454 | } | 455 | } |
455 | 456 | ||
457 | EAPI Ecore_Evas_Interface * | ||
458 | _ecore_evas_interface_get(const Ecore_Evas *ee, const char *iname) | ||
459 | { | ||
460 | return _ecore_evas_interface_get_internal(ee, iname, 1); | ||
461 | } | ||
462 | |||
456 | /** | 463 | /** |
457 | * Query if a particular rendering engine target has support | 464 | * Query if a particular rendering engine target has support |
458 | * @param engine The engine to check support for | 465 | * @param engine The engine to check support for |
@@ -3831,8 +3838,8 @@ EAPI Ecore_X_Window | |||
3831 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee) | 3838 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee) |
3832 | { | 3839 | { |
3833 | Ecore_Evas_Interface_Software_X11 *iface; | 3840 | Ecore_Evas_Interface_Software_X11 *iface; |
3834 | iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11"); | 3841 | iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get_internal(ee, "software_x11", 0); |
3835 | EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0); | 3842 | if (!iface) return 0; |
3836 | 3843 | ||
3837 | return iface->window_get(ee); | 3844 | return iface->window_get(ee); |
3838 | } | 3845 | } |
@@ -3980,8 +3987,8 @@ EAPI Ecore_X_Window | |||
3980 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) | 3987 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) |
3981 | { | 3988 | { |
3982 | Ecore_Evas_Interface_Gl_X11 *iface; | 3989 | Ecore_Evas_Interface_Gl_X11 *iface; |
3983 | iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11"); | 3990 | iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get_internal(ee, "gl_x11", 0); |
3984 | EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0); | 3991 | if (!iface) return 0; |
3985 | 3992 | ||
3986 | return iface->window_get(ee); | 3993 | return iface->window_get(ee); |
3987 | } | 3994 | } |
@@ -4413,8 +4420,8 @@ EAPI Ecore_Wl_Window * | |||
4413 | ecore_evas_wayland_window_get(const Ecore_Evas *ee) | 4420 | ecore_evas_wayland_window_get(const Ecore_Evas *ee) |
4414 | { | 4421 | { |
4415 | Ecore_Evas_Interface_Wayland *iface; | 4422 | Ecore_Evas_Interface_Wayland *iface; |
4416 | iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland"); | 4423 | iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get_internal(ee, "wayland", 0); |
4417 | EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL); | 4424 | if (!iface) return NULL; |
4418 | 4425 | ||
4419 | return iface->window_get(ee); | 4426 | return iface->window_get(ee); |
4420 | } | 4427 | } |
@@ -4424,7 +4431,7 @@ ecore_evas_cocoa_window_get(const Ecore_Evas *ee) | |||
4424 | { | 4431 | { |
4425 | Ecore_Evas_Interface_Cocoa *iface; | 4432 | Ecore_Evas_Interface_Cocoa *iface; |
4426 | iface = (Ecore_Evas_Interface_Cocoa *)_ecore_evas_interface_get(ee, "opengl_cocoa"); | 4433 | iface = (Ecore_Evas_Interface_Cocoa *)_ecore_evas_interface_get(ee, "opengl_cocoa"); |
4427 | EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL); | 4434 | if (!iface) return NULL; |
4428 | return iface->window_get(ee); | 4435 | return iface->window_get(ee); |
4429 | } | 4436 | } |
4430 | 4437 | ||
@@ -4432,8 +4439,8 @@ EAPI Ecore_Wl2_Window * | |||
4432 | ecore_evas_wayland2_window_get(const Ecore_Evas *ee) | 4439 | ecore_evas_wayland2_window_get(const Ecore_Evas *ee) |
4433 | { | 4440 | { |
4434 | Ecore_Evas_Interface_Wayland *iface; | 4441 | Ecore_Evas_Interface_Wayland *iface; |
4435 | iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland"); | 4442 | iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get_internal(ee, "wayland", 0); |
4436 | EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL); | 4443 | if (!iface) return NULL; |
4437 | 4444 | ||
4438 | return iface->window2_get(ee); | 4445 | return iface->window2_get(ee); |
4439 | } | 4446 | } |
@@ -4535,7 +4542,7 @@ ecore_evas_win32_window_get(const Ecore_Evas *ee) | |||
4535 | { | 4542 | { |
4536 | Ecore_Evas_Interface_Win32 *iface; | 4543 | Ecore_Evas_Interface_Win32 *iface; |
4537 | iface = (Ecore_Evas_Interface_Win32 *)_ecore_evas_interface_get(ee, "win32"); | 4544 | iface = (Ecore_Evas_Interface_Win32 *)_ecore_evas_interface_get(ee, "win32"); |
4538 | EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL); | 4545 | if (!iface) return NULL; |
4539 | 4546 | ||
4540 | return iface->window_get(ee); | 4547 | return iface->window_get(ee); |
4541 | } | 4548 | } |