diff --git a/src/lib/elementary/elm_win.c b/src/lib/elementary/elm_win.c index 0dd09b8d8c..c7c6694e6f 100644 --- a/src/lib/elementary/elm_win.c +++ b/src/lib/elementary/elm_win.c @@ -4113,13 +4113,6 @@ _elm_win_noblank_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd) return pd->noblank; } -EOLIAN static void * -_elm_win_trap_data_get(Eo *obj EINA_UNUSED, Elm_Win_Data *pd) -{ - return pd->trap_data; -} - - EAPI Evas_Object * elm_win_util_standard_add(const char *name, const char *title) { @@ -4366,18 +4359,6 @@ _elm_win_activate(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) TRAP(sd, activate); } -EOLIAN static void -_elm_win_lower(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) -{ - TRAP(sd, lower); -} - -EOLIAN static void -_elm_win_raise(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) -{ - TRAP(sd, raise); -} - EOLIAN static void _elm_win_center(Eo *obj, Elm_Win_Data *sd, Eina_Bool h, Eina_Bool v) { @@ -4474,21 +4455,6 @@ _elm_win_alpha_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) return EINA_FALSE; } -EOLIAN static void -_elm_win_override_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool override) -{ - TRAP(sd, override_set, override); -#ifdef HAVE_ELEMENTARY_X - _elm_win_xwin_update(sd); -#endif -} - -EOLIAN static Eina_Bool -_elm_win_override_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) -{ - return ecore_evas_override_get(sd->ee); -} - EOLIAN static void _elm_win_fullscreen_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Eina_Bool fullscreen) { @@ -5567,102 +5533,6 @@ _elm_win_socket_listen(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, const char *svcnam return EINA_TRUE; } -/* windowing specific calls - shall we do this differently? */ - -EOLIAN static Ecore_X_Window -_elm_win_xwindow_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) -{ -#ifdef HAVE_ELEMENTARY_X - if (sd->x.xwin) return sd->x.xwin; - if (sd->parent) return elm_win_xwindow_get(sd->parent); -#endif - return 0; -} - -EAPI Ecore_Wl2_Window * -elm_win_wl_window_get(const Evas_Object *obj) -{ - ELM_WIN_CHECK(obj) NULL; - ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL); - const char *engine_name = ecore_evas_engine_name_get(sd->ee); - - if (!(engine_name && - ((!strcmp(engine_name, ELM_WAYLAND_SHM)) || - (!strcmp(engine_name, ELM_WAYLAND_EGL))))) - return NULL; - - if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY)) - { - Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - return _elm_ee_wlwin_get(ee); - } - - Ecore_Wl2_Window *ret = NULL; - ret = elm_obj_win_wl_window_get((Eo *) obj); - return ret; -} - -EOLIAN static Ecore_Cocoa_Window * -_elm_win_cocoa_window_get(Eo *obj, - Elm_Win_Data *sd) -{ - const char *engine_name = ecore_evas_engine_name_get(sd->ee); - if (!engine_name) return NULL; - if (strcmp(engine_name, "gl_cocoa") != 0 && - strcmp(engine_name, "opengl_cocoa") != 0) - return NULL; - - Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - return _elm_ee_cocoa_win_get(ee); -} - -EOLIAN static Ecore_Wl2_Window* -_elm_win_wl_window_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) -{ -#if HAVE_ELEMENTARY_WL2 - if (sd->wl.win) return sd->wl.win; - if (sd->parent) return elm_win_wl_window_get(sd->parent); -#else - (void)sd; -#endif - return NULL; -} - -EAPI Ecore_Win32_Window * -elm_win_win32_window_get(const Evas_Object *obj) -{ - ELM_WIN_CHECK(obj) NULL; - ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL); - const char *engine_name = ecore_evas_engine_name_get(sd->ee); - - if (!(engine_name && - ((!strcmp(engine_name, ELM_SOFTWARE_WIN32)) || - (!strcmp(engine_name, ELM_SOFTWARE_DDRAW))))) - return NULL; - - if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY)) - { - Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - return _elm_ee_win32win_get(ee); - } - - Ecore_Win32_Window *ret = NULL; - ret = elm_obj_win_win32_window_get((Eo *) obj); - return ret; -} - -EOLIAN static Ecore_Win32_Window * -_elm_win_win32_window_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) -{ -#if HAVE_ELEMENTARY_WIN32 - if (sd->win32.win) return sd->win32.win; - if (sd->parent) return elm_win_win32_window_get(sd->parent); -#else - (void)sd; -#endif - return NULL; -} - EAPI Eina_Bool elm_win_trap_set(const Elm_Win_Trap *t) { @@ -5941,4 +5811,140 @@ elm_win_resize_object_del(Eo *obj, Evas_Object *subobj) efl_pack_unpack(obj, subobj); } +/* windowing specific calls - shall we do this differently? */ + +EAPI Ecore_X_Window +elm_win_xwindow_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) 0; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0); + +#ifdef HAVE_ELEMENTARY_X + if (sd->x.xwin) return sd->x.xwin; + if (sd->parent) return elm_win_xwindow_get(sd->parent); +#endif + return 0; +} + +EAPI Ecore_Wl2_Window * +elm_win_wl_window_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) NULL; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL); + const char *engine_name = ecore_evas_engine_name_get(sd->ee); + + if (!(engine_name && + ((!strcmp(engine_name, ELM_WAYLAND_SHM)) || + (!strcmp(engine_name, ELM_WAYLAND_EGL))))) + return NULL; + + if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY)) + { + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + return _elm_ee_wlwin_get(ee); + } + + Ecore_Wl2_Window *ret = NULL; + +#if HAVE_ELEMENTARY_WL2 + if (sd->wl.win) ret = sd->wl.win; + if (sd->parent) ret = elm_win_wl_window_get(sd->parent); +#endif + + return ret; +} + +EAPI Ecore_Cocoa_Window * +elm_win_cocoa_window_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) NULL; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL); + + const char *engine_name = ecore_evas_engine_name_get(sd->ee); + if (!engine_name) return NULL; + if (strcmp(engine_name, "gl_cocoa") != 0 && + strcmp(engine_name, "opengl_cocoa") != 0) + return NULL; + + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + return _elm_ee_cocoa_win_get(ee); +} + +EAPI Ecore_Win32_Window * +elm_win_win32_window_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) NULL; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL); + + const char *engine_name = ecore_evas_engine_name_get(sd->ee); + + if (!(engine_name && + ((!strcmp(engine_name, ELM_SOFTWARE_WIN32)) || + (!strcmp(engine_name, ELM_SOFTWARE_DDRAW))))) + return NULL; + + if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY)) + { + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + return _elm_ee_win32win_get(ee); + } + + Ecore_Win32_Window *ret = NULL; + +#if HAVE_ELEMENTARY_WIN32 + if (sd->win32.win) ret = sd->win32.win; + if (sd->parent) ret = elm_win_win32_window_get(sd->parent); +#endif + + return ret; +} + +EAPI void * +elm_win_trap_data_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) NULL; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL); + + return sd->trap_data; +} + +EAPI void +elm_win_override_set(Evas_Object *obj, Eina_Bool override) +{ + ELM_WIN_CHECK(obj); + ELM_WIN_DATA_GET_OR_RETURN(obj, sd); + + TRAP(sd, override_set, override); +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwin_update(sd); +#endif +} + +EAPI Eina_Bool +elm_win_override_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) EINA_FALSE; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE); + + return ecore_evas_override_get(sd->ee); +} + +EAPI void +elm_win_lower(Evas_Object *obj) +{ + ELM_WIN_CHECK(obj); + ELM_WIN_DATA_GET_OR_RETURN(obj, sd); + + TRAP(sd, lower); +} + +EAPI void +elm_win_raise(Evas_Object *obj) +{ + ELM_WIN_CHECK(obj); + ELM_WIN_DATA_GET_OR_RETURN(obj, sd); + + TRAP(sd, raise); +} + #include "elm_win.eo.c" diff --git a/src/lib/elementary/elm_win.eo b/src/lib/elementary/elm_win.eo index b3e5a3de88..69f81d2567 100644 --- a/src/lib/elementary/elm_win.eo +++ b/src/lib/elementary/elm_win.eo @@ -32,7 +32,7 @@ enum Elm.Win.Type utility, [[A persistent utility window, like a toolbox or palette.]] splash, [[Splash window for a starting up application.]] dropdown_menu, [[The window is a dropdown menu, as when an entry in a - menubar is clicked. Typically used with @Elm.Win.override.set. + menubar is clicked. This hint exists for completion only, as the EFL way of implementing a menu would not normally use a separate window for its contents.]] @@ -40,8 +40,7 @@ enum Elm.Win.Type right-clicking an object.]] tooltip, [[The window is a tooltip. A short piece of explanatory text that typically appear after the mouse cursor hovers over an object - for a while. Typically used with @Elm.Win.override.set and also - not very commonly used in the EFL.]] + for a while. Typically not very commonly used in the EFL.]] notification, [[A notification window, like a warning about battery life or a new E-Mail received.]] combo, [[A window holding the contents of a combo box. Not usually used in @@ -228,29 +227,6 @@ class Elm.Win (Elm.Widget, Elm.Interface_Atspi_Window, itself when closed.]] } } - @property override { - set { - [[Set the override state of a window. - - A window with $override set to true will not be managed by the - Window Manager. This means that no decorations of any kind - will be shown for it, moving and resizing must be handled - by the application, as well as the window visibility. - - This should not be used for normal windows, and even for not - so normal ones, it should only be used when there's a good - reason and with a lot of care. Mishandling override windows - may result situations that disrupt the normal workflow of - the end user. - ]] - } - get { - [[Get the override state of a window.]] - } - values { - override: bool; [[If true, the window is overridden.]] - } - } @property iconified { set { [[Set the iconified state of a window.]] @@ -933,12 +909,6 @@ class Elm.Win (Elm.Widget, Elm.Interface_Atspi_Window, return: bool; } } - @property xwindow { - get { - [[Get the Ecore_X_Window of an Evas_Object.]] - return: Ecore_X_Window; - } - } @property focus { get { [[Get whether a window has focus.]] @@ -962,32 +932,6 @@ class Elm.Win (Elm.Widget, Elm.Interface_Atspi_Window, return: Evas.Object *; [[The Main Menu of the window ($null on error).]] } } - @property wl_window { - get { - [[Get the Ecore_Wl2_Window of an Evas_Object.]] - return: Ecore_Wl2_Window *; [[The Ecore_Wl2_Window of $obj.]] - legacy: null; - } - } - @property cocoa_window { - get { - [[Get the Ecore_Cocoa_Window of an Evas.Object. - - @since 1.17 - ]] - return: Ecore_Cocoa_Window *; [[The Ecore_Cocoa_Window of $obj.]] - } - } - @property win32_window { - get { - [[Get the Ecore_Win32_Window of an Evas_Object - - @since 1.17 - ]] - return: Ecore_Win32_Window *; [[The Ecore_Win32_Window of $obj.]] - legacy: null; - } - } @property window_id { get { [[Get the Ecore_Window of an Evas_Object @@ -1101,17 +1045,6 @@ class Elm.Win (Elm.Widget, Elm.Interface_Atspi_Window, noblank: bool; [[If true, the window is set to noblank.]] } } - @property trap_data { - get { - [[Get the trap data associated with a window. - - @since 1.12 - ]] - } - values { - trap_data: void *; [[The trap data of the window.]] - } - } @property fake_canvas @protected { set { [[Internal. Used to completent the fake window type.]] @@ -1172,26 +1105,6 @@ class Elm.Win (Elm.Widget, Elm.Interface_Atspi_Window, window will be the active one after it. ]] } - raise { - [[Raise a window object. - - Places the window pointed by $obj at the top of the stack, so - that it's not covered by any other window. - - If @.override.set is not set, the Window Manager may ignore this - request. - ]] - } - lower { - [[Lower a window object. - - Places the window pointed by $obj at the bottom of the stack, - so that no other window is covered by it. - - If @.override.set is not set, the Window Manager may ignore this - request. - ]] - } center { [[Center a window on its screen diff --git a/src/lib/elementary/elm_win_legacy.h b/src/lib/elementary/elm_win_legacy.h index 91fd833bef..cd063968aa 100644 --- a/src/lib/elementary/elm_win_legacy.h +++ b/src/lib/elementary/elm_win_legacy.h @@ -286,3 +286,120 @@ EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj); * @ingroup Elm_Win */ EAPI void elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj); + +/** Get the Ecore_X_Window of an Evas_Object. + * + * @ingroup Elm_Win + */ +EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj); + +/** + * @brief Get the Ecore_Wl2_Window of an Evas_Object. + * + * @return The Ecore_Wl2_Window of @c obj. + * + * @ingroup Elm_Win + */ +EAPI Ecore_Wl2_Window *elm_win_wl_window_get(const Evas_Object *obj); + + +/** + * @brief Get the Ecore_Win32_Window of an Evas_Object + * + * @return The Ecore_Win32_Window of @c obj. + * + * @since 1.17 + * + * @ingroup Elm_Win + */ +EAPI Ecore_Win32_Window *elm_win_win32_window_get(const Evas_Object *obj); + +/** + * @brief Get the Ecore_Cocoa_Window of an Evas.Object. + * + * @return The Ecore_Cocoa_Window of @c obj. + * + * @since 1.17 + * + * @ingroup Elm_Win + */ +EAPI Ecore_Cocoa_Window *elm_win_cocoa_window_get(const Evas_Object *obj); + +/** + * @brief Get the Ecore_Window of an Evas_Object + * + * When Elementary is using a Wayland engine, this function will return the + * surface id of the elm window's surface. + * + * @return The Ecore_Window of an Evas_Object. + * + * @since 1.8 + * + * @ingroup Elm_Win + */ +EAPI Ecore_Window elm_win_window_id_get(const Evas_Object *obj); + +/** + * @brief Get the trap data associated with a window. + * + * @return The trap data of the window. + * + * @since 1.12 + * + * @ingroup Elm_Win + */ +EAPI void *elm_win_trap_data_get(const Evas_Object *obj); + +/** + * @brief Set the override state of a window. + * + * A window with @c override set to true will not be managed by the Window + * Manager. This means that no decorations of any kind will be shown for it, + * moving and resizing must be handled by the application, as well as the + * window visibility. + * + * This should not be used for normal windows, and even for not so normal ones, + * it should only be used when there's a good reason and with a lot of care. + * Mishandling override windows may result situations that disrupt the normal + * workflow of the end user. + * + * @param[in] override If true, the window is overridden. + * + * @ingroup Elm_Win + */ +EAPI void elm_win_override_set(Evas_Object *obj, Eina_Bool override); + +/** + * @brief Get the override state of a window. + * + * @return If true, the window is overridden. + * + * @ingroup Elm_Win + */ +EAPI Eina_Bool elm_win_override_get(const Evas_Object *obj); + +/** + * @brief Raise a window object. + * + * Places the window pointed by @c obj at the top of the stack, so that it's + * not covered by any other window. + * + * If @ref elm_win_override_set is not set, the Window Manager may ignore this + * request. + * + * @ingroup Elm_Win + */ +EAPI void elm_win_raise(Evas_Object *obj); + +/** + * @brief Lower a window object. + * + * Places the window pointed by @c obj at the bottom of the stack, so that no + * other window is covered by it. + * + * If @ref elm_win_override_set is not set, the Window Manager may ignore this + * request. + * + * @ingroup Elm_Win + */ +EAPI void elm_win_lower(Evas_Object *obj);