summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-11 07:59:45 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-11 08:01:45 +0900
commit4213973d434e3a84968860359cfd5f7dde9c01e2 (patch)
tree33b618078f32e32713b36a69bc9dcebce5282358
parentf9b51245e87a2da6a00fd96fff358439d0b72532 (diff)
elm win - fix invalid use of elm engine config per window
lots of code unsing ENGINE_COMPARE where it should get the engine from the ecore_evas directly - it happened to work as we happened to have apps that have windows only for x11, or wayland etc, but not both in an app. this was wrong, so remove the engine compare macro and do it properly. no laziness.
-rw-r--r--src/lib/elm_win.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 2ffef6948..f75c15bed 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -96,7 +96,6 @@ static const Elm_Win_Trap *trap = NULL;
96 } 96 }
97 97
98#define ENGINE_GET() (_elm_preferred_engine ? _elm_preferred_engine : (_elm_config->engine ? _elm_config->engine : "")) 98#define ENGINE_GET() (_elm_preferred_engine ? _elm_preferred_engine : (_elm_config->engine ? _elm_config->engine : ""))
99#define ENGINE_COMPARE(name) (!strcmp(ENGINE_GET(), name))
100 99
101typedef struct _Elm_Win_Data Elm_Win_Data; 100typedef struct _Elm_Win_Data Elm_Win_Data;
102 101
@@ -338,14 +337,8 @@ _win_noblank_eval(void)
338 337
339 if (!change) return; 338 if (!change) return;
340 339
341 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) || 340 if (noblanks > 0) ecore_x_screensaver_supend();
342 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) || 341 else ecore_x_screensaver_resume();
343 ENGINE_COMPARE(ELM_XRENDER_X11) || ENGINE_COMPARE(ELM_OPENGL_X11) ||
344 ENGINE_COMPARE(ELM_OPENGL_COCOA) || ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
345 {
346 if (noblanks > 0) ecore_x_screensaver_supend();
347 else ecore_x_screensaver_resume();
348 }
349#endif 342#endif
350#ifdef HAVE_ELEMENTARY_WAYLAND 343#ifdef HAVE_ELEMENTARY_WAYLAND
351 // XXX: no wl implementation of this yet - maybe higher up at prop level 344 // XXX: no wl implementation of this yet - maybe higher up at prop level
@@ -3264,8 +3257,7 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t
3264#endif 3257#endif
3265 3258
3266#ifdef HAVE_ELEMENTARY_WAYLAND 3259#ifdef HAVE_ELEMENTARY_WAYLAND
3267 if ((ENGINE_COMPARE(ELM_WAYLAND_SHM)) || (ENGINE_COMPARE(ELM_WAYLAND_EGL))) 3260 _elm_win_wlwindow_get(sd);
3268 _elm_win_wlwindow_get(sd);
3269#endif 3261#endif
3270 3262
3271 if ((_elm_config->bgpixmap) 3263 if ((_elm_config->bgpixmap)
@@ -3622,12 +3614,10 @@ _elm_win_center(Eo *obj, Elm_Win_Data *sd, Eina_Bool h, Eina_Bool v)
3622EOLIAN static void 3614EOLIAN static void
3623_elm_win_borderless_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool borderless) 3615_elm_win_borderless_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool borderless)
3624{ 3616{
3625 Eina_Bool need_frame = EINA_FALSE;
3626
3627 const char *engine_name = ecore_evas_engine_name_get(sd->ee); 3617 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
3628 need_frame = engine_name && 3618 Eina_Bool need_frame = engine_name &&
3629 ((!strcmp(engine_name, ELM_WAYLAND_SHM)) || 3619 ((!strcmp(engine_name, ELM_WAYLAND_SHM)) ||
3630 (!strcmp(engine_name, ELM_WAYLAND_EGL))); 3620 (!strcmp(engine_name, ELM_WAYLAND_EGL)));
3631 3621
3632 if (need_frame) 3622 if (need_frame)
3633 need_frame = !sd->fullscreen; 3623 need_frame = !sd->fullscreen;
@@ -3736,9 +3726,11 @@ _elm_win_override_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
3736EOLIAN static void 3726EOLIAN static void
3737_elm_win_fullscreen_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool fullscreen) 3727_elm_win_fullscreen_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool fullscreen)
3738{ 3728{
3729 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
3739 // YYY: handle if sd->img_obj 3730 // YYY: handle if sd->img_obj
3740 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) || 3731 if (engine_name &&
3741 ENGINE_COMPARE(ELM_DRM)) 3732 ((!strcmp(engine_name, ELM_SOFTWARE_FB)) ||
3733 (!strcmp(engine_name, ELM_DRM))))
3742 { 3734 {
3743 // these engines... can ONLY be fullscreen 3735 // these engines... can ONLY be fullscreen
3744 return; 3736 return;
@@ -3746,13 +3738,9 @@ _elm_win_fullscreen_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool fullscr
3746 else 3738 else
3747 { 3739 {
3748// sd->fullscreen = fullscreen; 3740// sd->fullscreen = fullscreen;
3749 3741 Eina_Bool need_frame = engine_name &&
3750 Eina_Bool need_frame = EINA_FALSE; 3742 ((!strcmp(engine_name, ELM_WAYLAND_SHM)) ||
3751 3743 (!strcmp(engine_name, ELM_WAYLAND_EGL)));
3752 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
3753 need_frame = engine_name &&
3754 ((!strcmp(engine_name, ELM_WAYLAND_SHM)) ||
3755 (!strcmp(engine_name, ELM_WAYLAND_EGL)));
3756 3744
3757 if (need_frame) 3745 if (need_frame)
3758 need_frame = !ecore_evas_borderless_get(sd->ee); 3746 need_frame = !ecore_evas_borderless_get(sd->ee);
@@ -3781,7 +3769,7 @@ _elm_win_fullscreen_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool fullscr
3781EOLIAN static Eina_Bool 3769EOLIAN static Eina_Bool
3782_elm_win_fullscreen_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) 3770_elm_win_fullscreen_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
3783{ 3771{
3784 const char* engine_name = ecore_evas_engine_name_get(sd->ee); 3772 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
3785 3773
3786 if (engine_name && 3774 if (engine_name &&
3787 ((!strcmp(engine_name, ELM_SOFTWARE_FB)) || 3775 ((!strcmp(engine_name, ELM_SOFTWARE_FB)) ||
@@ -4766,10 +4754,13 @@ _elm_win_xwindow_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
4766EAPI Ecore_Wl_Window * 4754EAPI Ecore_Wl_Window *
4767elm_win_wl_window_get(const Evas_Object *obj) 4755elm_win_wl_window_get(const Evas_Object *obj)
4768{ 4756{
4769 if (!obj) return NULL; 4757 ELM_WIN_CHECK(obj) NULL;
4758 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
4759 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
4770 4760
4771 if ((!ENGINE_COMPARE(ELM_WAYLAND_SHM)) && 4761 if (!(engine_name &&
4772 (!ENGINE_COMPARE(ELM_WAYLAND_EGL))) 4762 ((!strcmp(engine_name, ELM_WAYLAND_SHM)) ||
4763 (!strcmp(engine_name, ELM_WAYLAND_EGL)))))
4773 return NULL; 4764 return NULL;
4774 4765
4775 if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY)) 4766 if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY))
@@ -4778,7 +4769,6 @@ elm_win_wl_window_get(const Evas_Object *obj)
4778 return _elm_ee_wlwin_get(ee); 4769 return _elm_ee_wlwin_get(ee);
4779 } 4770 }
4780 4771
4781 ELM_WIN_CHECK(obj) NULL;
4782 Ecore_Wl_Window *ret = NULL; 4772 Ecore_Wl_Window *ret = NULL;
4783 eo_do((Eo *) obj, ret = elm_obj_win_wl_window_get()); 4773 eo_do((Eo *) obj, ret = elm_obj_win_wl_window_get());
4784 return ret; 4774 return ret;
@@ -4847,7 +4837,11 @@ elm_win_floating_mode_get(const Evas_Object *obj)
4847EOLIAN static Ecore_Window 4837EOLIAN static Ecore_Window
4848_elm_win_window_id_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) 4838_elm_win_window_id_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
4849{ 4839{
4850 if ((ENGINE_COMPARE(ELM_WAYLAND_SHM)) || (ENGINE_COMPARE(ELM_WAYLAND_EGL))) 4840 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
4841
4842 if ((engine_name &&
4843 ((!strcmp(engine_name, ELM_WAYLAND_SHM)) ||
4844 (!strcmp(engine_name, ELM_WAYLAND_EGL)))))
4851 { 4845 {
4852#if HAVE_ELEMENTARY_WAYLAND 4846#if HAVE_ELEMENTARY_WAYLAND
4853 if (sd->wl.win) return (Ecore_Window)ecore_wl_window_surface_id_get(sd->wl.win); 4847 if (sd->wl.win) return (Ecore_Window)ecore_wl_window_surface_id_get(sd->wl.win);
@@ -4861,7 +4855,9 @@ _elm_win_window_id_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
4861 } 4855 }
4862#endif 4856#endif
4863 } 4857 }
4864 else 4858 else if ((engine_name &&
4859 ((!strcmp(engine_name, ELM_SOFTWARE_X11)) ||
4860 (!strcmp(engine_name, ELM_OPENGL_X11)))))
4865 { 4861 {
4866#ifdef HAVE_ELEMENTARY_X 4862#ifdef HAVE_ELEMENTARY_X
4867 _internal_elm_win_xwindow_get(sd); 4863 _internal_elm_win_xwindow_get(sd);