diff options
author | Hermet Park <hermetpark@gmail.com> | 2020-01-10 10:53:04 +0900 |
---|---|---|
committer | Hermet Park <hermetpark@gmail.com> | 2020-01-10 10:53:04 +0900 |
commit | fbda1a374b623625904f59936afe05088fbfc60b (patch) | |
tree | 119e6bbcd24260a148d8360d4215a4d701cfb8dd | |
parent | 9d398b1bdc30a2fab2f29a947eb4a91eaeffb130 (diff) | |
parent | 33c3cb3667be8ea2889998a10459d98fceba139f (diff) | |
download | efl-fbda1a374b623625904f59936afe05088fbfc60b.tar.gz |
Merge branch 'master' into devs/hermet/lottie
27 files changed, 874 insertions, 701 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 484708287c..7b65b5c418 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -452,9 +452,7 @@ typedef struct _Ecore_Wl2_Surface_Interface * @li @ref Ecore_Wl2_Display_Group * @li @ref Ecore_Wl2_Window_Group * @li @ref Ecore_Wl2_Output_Group - * @li @ref Ecore_Wl2_Dnd_Group * @li @ref Ecore_Wl2_Input_Group - * @li @ref Ecore_Wl2_Subsurface_Group */ /** @@ -1137,18 +1135,6 @@ EAPI void ecore_wl2_window_type_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_T EAPI Ecore_Wl2_Window_Type ecore_wl2_window_type_get(Ecore_Wl2_Window *window); /** - * Find the output that a given window is on - * - * @param window The window to find the output for - * - * @return An Ecore_Wl2_Output if found, or NULL otherwise - * - * @ingroup Ecore_Wl2_Window_Group - * @since 1.20 - */ -EAPI Ecore_Wl2_Output *ecore_wl2_window_output_find(Ecore_Wl2_Window *window); - -/** * Set if window rotation is supported by the window manager * * @param window @@ -1566,256 +1552,6 @@ EAPI void ecore_wl2_input_pointer_set(Ecore_Wl2_Input *input, struct wl_surface EAPI void ecore_wl2_input_cursor_from_name_set(Ecore_Wl2_Input *input, const char *cursor); /** - * @defgroup Ecore_Wl2_Dnd_Group Wayland Library Drag-n-Drop Functions - * @ingroup Ecore_Wl2_Group - * - * Functions that deal with creating, destroying, or interacting with - * Wayland Drag-n-Drop - */ - -/** - * Set the types which are supported by a possible drag and drop operation. - * This call initializes a data source and offeres the given mimetypes - * - * @param input the input where to add on the data source - * @param types a null-terminated array of mimetypes - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.17 - */ -EAPI void ecore_wl2_dnd_drag_types_set(Ecore_Wl2_Input *input, const char **types); - -/** - * Start a drag on the given input - * - * @param input the input to use - * @param window the window which is the origin of the drag operation - * @param drag_window the window which is used as window of the visible hint. - * - * @return The serial for the start_drag request - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.17 - */ -EAPI uint32_t ecore_wl2_dnd_drag_start(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, Ecore_Wl2_Window *drag_window); - -/** - * Call wl_data_source.set_actions on an existing source - * - * @param input the input to use - * - * @see ecore_wl2_dnd_drag_start for a more useful function. - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.20 - */ -EAPI void ecore_wl2_dnd_set_actions(Ecore_Wl2_Input *input); - -/** - * End a drag started by a call to ecore_wl2_dnd_drag_start - * - * @param input the input object on which the drag was started - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.17 - */ -EAPI void ecore_wl2_dnd_drag_end(Ecore_Wl2_Input *input); - -/** - * Get the offer which is currently resposible for the clipboard - * - * @param input the input object to use - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI Ecore_Wl2_Offer* ecore_wl2_dnd_selection_get(Ecore_Wl2_Input *input); - -/** - * Set the types which are available from this client - * Later the event ECORE_WL2_EVENT_DATA_SOURCE_SEND is emitted, - * where the caller of this api must write the data (encoded in the given mimetype) to the fd - * - * @param input the input to provice this types on - * @param types a null-terminated array of mimetypes supported by the client - * - * @return serial of request on success, 0 on failure - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.17 - */ -EAPI uint32_t ecore_wl2_dnd_selection_set(Ecore_Wl2_Input *input, const char **types); - -/** - * Clear the selection currently setted on this input. - * - * @param input the input to clear - * - * @return serial of request on success, 0 on failure - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.17 - */ -EAPI uint32_t ecore_wl2_dnd_selection_clear(Ecore_Wl2_Input *input); - -/** - * @defgroup Ecore_Wl2_Subsurface_Group Functions to manipulate subsurfaces. - * @ingroup Ecore_Wl2_Group - * - * Functions to manipulate wayland subsurfaces, using Ecore_Wl2_Subsurface. - * - * This API is intended to expose Wayland subsurface functionality, although it - * should not be necessary for most applications to use it, as soon as we have - * means to make Evas automatically switch Evas images to use subsurfaces. - * - * It can/should be used, for instance, when subsurfaces are needed to be not - * in sync with the main window surface. - */ - -/** - * Create and return a new subsurface. - * - * Create a new surface (and subsurface interface), with the parent surface - * being the one associated with the given @param win. - * - * The @param win must be visible, otherwise there will be no surface created - * for it yet. - * - * @return the allocated and initialized Ecore_Wl2_Subsurface object, or - * NULL on failure - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI Ecore_Wl2_Subsurface *ecore_wl2_subsurface_new(Ecore_Wl2_Window *window); - -/** - * Destroy the given subsurface, as well as the surface associated with it. - * - * @param subsurface the subsurface - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI void ecore_wl2_subsurface_del(Ecore_Wl2_Subsurface *subsurface); - -/** - * Get the wl_surface for this subsurface - * - * @param subsurface the subsurface - * - * @return the wl_surface associated with this subsurface, or NULL on failure - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI struct wl_surface *ecore_wl2_subsurface_surface_get(Ecore_Wl2_Subsurface *subsurface); - -/** - * Set the position of this subsurface, relative to its parent surface. - * If subsurface is defined and the x, y coordinates differ from the currently - * tracked position, this also schedules a sub-surface position change. - * - * @param subsurface the subsurface - * @param x coordinate in the parent surface - * @param y coordinate in the parent surface - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI void ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y); - -/** - * Get the position of this subsurface, relative to its parent surface. - * Coordinates will be returned in x and y if non-NULL. - * - * @param subsurface the subsurface - * @param x coordinate in the parent surface, or NULL to ignore - * @param y coordinate in the parent surface, or NULL to ignore - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI void ecore_wl2_subsurface_position_get(Ecore_Wl2_Subsurface *subsurface, int *x, int *y); - -/** - * Place subsurface on layer above a reference surface - * - * Moves the @param subsurface to just above the reference @param - * surface, changing the z-order. The reference @param surface must - * be either a sibling or parent surface, else a protocol error will - * be generated. - * - * @param subsurface the subsurface - * @param surface the sibling reference surface - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI void ecore_wl2_subsurface_place_above(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface); - -/** - * Place subsurface on layer below a reference surface - * - * See ecore_wl2_subsurface_place_above. - * - * @param subsurface the subsurface - * @param surface the sibling reference surface - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI void ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface); - -/** - * Enables or disables sub-surface synchronization - * - * When synchronization is enabled, surface commits on the subsurface - * will be cached and only applied when the parent surface's state is - * applied. This ensures atomic updates of the parent and all of its - * synchronized sub-surfaces. - * - * When synchronization is disabled, commits will apply to the pending - * state directly without caching, just like a normal wl_surface. If - * there are already cached events when this is set, those events are - * applied simultaneously with the desync event. - * - * Attempting to enable synchronization when the subsurface already - * thinks it's sync'd, or desync when it believes its desync'd, will - * be trivially ignored and will not generate a Wayland event. - * - * See Wayland's set_desync documentation for further details and - * exceptional cases. - * - * @param subsurface the subsurface - * @param sync true to enable synchronization, false to desynchronize - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI void ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync); - -/** - * Set an opaque region for the given subsurface. - * - * This is an optimization hint to the compositor to allow it avoid - * redrawing content unnecessarily. Note that marking transparent - * content as opaque will cause repaint artifacts. - * - * Use a 0x0 region size to unset the opaque region. - * - * @param subsurface the subsurface - * @param x coordinate in the parent surface - * @param y coordinate in the parent surface - * @param w width to set as opaque - * @param h height to set as opaque - * - * @ingroup Ecore_Wl2_Subsurface_Group - * @since 1.17 - */ -EAPI void ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h); - -/** * @defgroup Ecore_Wl2_Output_Group Wayland Library Output Functions * @ingroup Ecore_Wl2_Group * @@ -1864,136 +1600,6 @@ EAPI int ecore_wl2_output_transform_get(Ecore_Wl2_Output *output); EAPI int ecore_wl2_display_compositor_version_get(Ecore_Wl2_Display *disp); /** - * Get the actions available from the data source - * - * @param offer Offer object to use - * - * @return or´ed values from Ecore_Wl2_Drag_Action which are describing the available actions - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI Ecore_Wl2_Drag_Action ecore_wl2_offer_actions_get(Ecore_Wl2_Offer *offer); - -/** - * Set the actions which are supported by you - * - * @param offer Offer object to use - * @param actions A or´ed value of mutliple Ecore_Wl2_Drag_Action values - * @param action the preferred action out of the actions - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI void ecore_wl2_offer_actions_set(Ecore_Wl2_Offer *offer, Ecore_Wl2_Drag_Action actions, Ecore_Wl2_Drag_Action action); - -/** - * Get action which is set by either the data source or in the last call of actions_set - * - * @param offer Offer object to use - * - * @return the preferred action - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI Ecore_Wl2_Drag_Action ecore_wl2_offer_action_get(Ecore_Wl2_Offer *offer); - -/** - * Get the mime types which are given by the source - * - * @param offer the offer to query - * - * @return a eina array of strdup´ed strings, this array must NOT be changed or freed - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI Eina_Array* ecore_wl2_offer_mimes_get(Ecore_Wl2_Offer *offer); - -/** - * Set mimetypes you are accepting under this offer - * - * @param offer the offer to use - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI void ecore_wl2_offer_mimes_set(Ecore_Wl2_Offer *offer, Eina_Array *mimes); - -/** - * Accept a single mime type for an offer - * - * @param offer the offer to use - * @param mime_type the mime type - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.20 - */ -EAPI void ecore_wl2_offer_accept(Ecore_Wl2_Offer *offer, const char *mime_type); - -/** - * Request the data from this offer. - * The event ECORE_WL2_EVENT_OFFER_DATA_READY is called when the data is available. - * There offer will be not destroyed as long as requested data is not emitted by the event. - * - * @param offer the offer to use - * @param mime the mimetype to receive - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI void ecore_wl2_offer_receive(Ecore_Wl2_Offer *offer, char *mime); - -/** - * Request the data from this offer on an externally managed fd. - * The event ECORE_WL2_EVENT_OFFER_DATA_READY is called when the data is available. - * There offer will be not destroyed as long as requested data is not emitted by the event. - * - * @param offer the offer to use - * @param mime the mimetype to receive - * @param fd the fd to pass for receiving - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.20 - */ -EAPI void ecore_wl2_offer_proxy_receive(Ecore_Wl2_Offer *offer, const char *mime, int fd); - -/** - * End the use of a proxy received offer. This may invalidate the offer object - * - * @param offer the offer - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.20 - */ -EAPI void ecore_wl2_offer_proxy_receive_end(Ecore_Wl2_Offer *offer); - -/** - * Check if the given offer supports the given mimetype - * - * @param offer the offer to use - * @param mime the mimetype to check - * - * @return Returns true if the mimetype is supported by this offer, false if not - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI Eina_Bool ecore_wl2_offer_supports_mime(Ecore_Wl2_Offer *offer, const char *mime); - -/** - * Mark this offer as finished - * This will call the dnd_finished event on the source of the sender. - * - * @param offer the offer to use - * - * @ingroup Ecore_Wl2_Dnd_Group - * @since 1.19 - */ -EAPI void ecore_wl2_offer_finish(Ecore_Wl2_Offer *offer); - -/** * Disable session recovery for any further connections. Must be called * before connecting. This is irreversible and not intended for general * use. diff --git a/src/lib/ecore_wl2/ecore_wl2_internal.h b/src/lib/ecore_wl2/ecore_wl2_internal.h index cda98d6459..b464fb231f 100644 --- a/src/lib/ecore_wl2/ecore_wl2_internal.h +++ b/src/lib/ecore_wl2/ecore_wl2_internal.h @@ -125,6 +125,398 @@ EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool ico */ EAPI Eina_Bool ecore_wl2_window_pending_get(Ecore_Wl2_Window *window); +/** + * Find the output that a given window is on + * + * @param window The window to find the output for + * + * @return An Ecore_Wl2_Output if found, or NULL otherwise + * + * @ingroup Ecore_Wl2_Window_Group + * @since 1.20 + */ +EAPI Ecore_Wl2_Output *ecore_wl2_window_output_find(Ecore_Wl2_Window *window); + +/** + * @defgroup Ecore_Wl2_Dnd_Group Wayland Library Drag-n-Drop Functions + * @ingroup Ecore_Wl2_Group + * + * Functions that deal with creating, destroying, or interacting with + * Wayland Drag-n-Drop + */ + +/** + * Set the types which are supported by a possible drag and drop operation. + * This call initializes a data source and offeres the given mimetypes + * + * @param input the input where to add on the data source + * @param types a null-terminated array of mimetypes + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.17 + */ +EAPI void ecore_wl2_dnd_drag_types_set(Ecore_Wl2_Input *input, const char **types); + +/** + * Start a drag on the given input + * + * @param input the input to use + * @param window the window which is the origin of the drag operation + * @param drag_window the window which is used as window of the visible hint. + * + * @return The serial for the start_drag request + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.17 + */ +EAPI uint32_t ecore_wl2_dnd_drag_start(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, Ecore_Wl2_Window *drag_window); + +/** + * Call wl_data_source.set_actions on an existing source + * + * @param input the input to use + * + * @see ecore_wl2_dnd_drag_start for a more useful function. + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.20 + */ +EAPI void ecore_wl2_dnd_set_actions(Ecore_Wl2_Input *input); + +/** + * End a drag started by a call to ecore_wl2_dnd_drag_start + * + * @param input the input object on which the drag was started + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.17 + */ +EAPI void ecore_wl2_dnd_drag_end(Ecore_Wl2_Input *input); + +/** + * Get the offer which is currently resposible for the clipboard + * + * @param input the input object to use + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI Ecore_Wl2_Offer* ecore_wl2_dnd_selection_get(Ecore_Wl2_Input *input); + +/** + * Set the types which are available from this client + * Later the event ECORE_WL2_EVENT_DATA_SOURCE_SEND is emitted, + * where the caller of this api must write the data (encoded in the given mimetype) to the fd + * + * @param input the input to provice this types on + * @param types a null-terminated array of mimetypes supported by the client + * + * @return serial of request on success, 0 on failure + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.17 + */ +EAPI uint32_t ecore_wl2_dnd_selection_set(Ecore_Wl2_Input *input, const char **types); + +/** + * Clear the selection currently setted on this input. + * + * @param input the input to clear + * + * @return serial of request on success, 0 on failure + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.17 + */ +EAPI uint32_t ecore_wl2_dnd_selection_clear(Ecore_Wl2_Input *input); + +/** + * Get the actions available from the data source + * + * @param offer Offer object to use + * + * @return or´ed values from Ecore_Wl2_Drag_Action which are describing the available actions + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI Ecore_Wl2_Drag_Action ecore_wl2_offer_actions_get(Ecore_Wl2_Offer *offer); + +/** + * Set the actions which are supported by you + * + * @param offer Offer object to use + * @param actions A or´ed value of mutliple Ecore_Wl2_Drag_Action values + * @param action the preferred action out of the actions + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI void ecore_wl2_offer_actions_set(Ecore_Wl2_Offer *offer, Ecore_Wl2_Drag_Action actions, Ecore_Wl2_Drag_Action action); + +/** + * Get action which is set by either the data source or in the last call of actions_set + * + * @param offer Offer object to use + * + * @return the preferred action + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI Ecore_Wl2_Drag_Action ecore_wl2_offer_action_get(Ecore_Wl2_Offer *offer); + +/** + * Get the mime types which are given by the source + * + * @param offer the offer to query + * + * @return a eina array of strdup´ed strings, this array must NOT be changed or freed + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI Eina_Array* ecore_wl2_offer_mimes_get(Ecore_Wl2_Offer *offer); + +/** + * Set mimetypes you are accepting under this offer + * + * @param offer the offer to use + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI void ecore_wl2_offer_mimes_set(Ecore_Wl2_Offer *offer, Eina_Array *mimes); + +/** + * Accept a single mime type for an offer + * + * @param offer the offer to use + * @param mime_type the mime type + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.20 + */ +EAPI void ecore_wl2_offer_accept(Ecore_Wl2_Offer *offer, const char *mime_type); + +/** + * Request the data from this offer. + * The event ECORE_WL2_EVENT_OFFER_DATA_READY is called when the data is available. + * There offer will be not destroyed as long as requested data is not emitted by the event. + * + * @param offer the offer to use + * @param mime the mimetype to receive + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI void ecore_wl2_offer_receive(Ecore_Wl2_Offer *offer, char *mime); + +/** + * Request the data from this offer on an externally managed fd. + * The event ECORE_WL2_EVENT_OFFER_DATA_READY is called when the data is available. + * There offer will be not destroyed as long as requested data is not emitted by the event. + * + * @param offer the offer to use + * @param mime the mimetype to receive + * @param fd the fd to pass for receiving + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.20 + */ +EAPI void ecore_wl2_offer_proxy_receive(Ecore_Wl2_Offer *offer, const char *mime, int fd); + +/** + * End the use of a proxy received offer. This may invalidate the offer object + * + * @param offer the offer + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.20 + */ +EAPI void ecore_wl2_offer_proxy_receive_end(Ecore_Wl2_Offer *offer); + +/** + * Check if the given offer supports the given mimetype + * + * @param offer the offer to use + * @param mime the mimetype to check + * + * @return Returns true if the mimetype is supported by this offer, false if not + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI Eina_Bool ecore_wl2_offer_supports_mime(Ecore_Wl2_Offer *offer, const char *mime); + +/** + * Mark this offer as finished + * This will call the dnd_finished event on the source of the sender. + * + * @param offer the offer to use + * + * @ingroup Ecore_Wl2_Dnd_Group + * @since 1.19 + */ +EAPI void ecore_wl2_offer_finish(Ecore_Wl2_Offer *offer); + +/** + * @defgroup Ecore_Wl2_Subsurface_Group Functions to manipulate subsurfaces. + * @ingroup Ecore_Wl2_Group + * + * Functions to manipulate wayland subsurfaces, using Ecore_Wl2_Subsurface. + * + * This API is intended to expose Wayland subsurface functionality, although it + * should not be necessary for most applications to use it, as soon as we have + * means to make Evas automatically switch Evas images to use subsurfaces. + * + * It can/should be used, for instance, when subsurfaces are needed to be not + * in sync with the main window surface. + */ + +/** + * Create and return a new subsurface. + * + * Create a new surface (and subsurface interface), with the parent surface + * being the one associated with the given @param win. + * + * The @param win must be visible, otherwise there will be no surface created + * for it yet. + * + * @return the allocated and initialized Ecore_Wl2_Subsurface object, or + * NULL on failure + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI Ecore_Wl2_Subsurface *ecore_wl2_subsurface_new(Ecore_Wl2_Window *window); + +/** + * Destroy the given subsurface, as well as the surface associated with it. + * + * @param subsurface the subsurface + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI void ecore_wl2_subsurface_del(Ecore_Wl2_Subsurface *subsurface); + +/** + * Get the wl_surface for this subsurface + * + * @param subsurface the subsurface + * + * @return the wl_surface associated with this subsurface, or NULL on failure + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI struct wl_surface *ecore_wl2_subsurface_surface_get(Ecore_Wl2_Subsurface *subsurface); + +/** + * Set the position of this subsurface, relative to its parent surface. + * If subsurface is defined and the x, y coordinates differ from the currently + * tracked position, this also schedules a sub-surface position change. + * + * @param subsurface the subsurface + * @param x coordinate in the parent surface + * @param y coordinate in the parent surface + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI void ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y); + +/** + * Get the position of this subsurface, relative to its parent surface. + * Coordinates will be returned in x and y if non-NULL. + * + * @param subsurface the subsurface + * @param x coordinate in the parent surface, or NULL to ignore + * @param y coordinate in the parent surface, or NULL to ignore + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI void ecore_wl2_subsurface_position_get(Ecore_Wl2_Subsurface *subsurface, int *x, int *y); + +/** + * Place subsurface on layer above a reference surface + * + * Moves the @param subsurface to just above the reference @param + * surface, changing the z-order. The reference @param surface must + * be either a sibling or parent surface, else a protocol error will + * be generated. + * + * @param subsurface the subsurface + * @param surface the sibling reference surface + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI void ecore_wl2_subsurface_place_above(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface); + +/** + * Place subsurface on layer below a reference surface + * + * See ecore_wl2_subsurface_place_above. + * + * @param subsurface the subsurface + * @param surface the sibling reference surface + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI void ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface); + +/** + * Enables or disables sub-surface synchronization + * + * When synchronization is enabled, surface commits on the subsurface + * will be cached and only applied when the parent surface's state is + * applied. This ensures atomic updates of the parent and all of its + * synchronized sub-surfaces. + * + * When synchronization is disabled, commits will apply to the pending + * state directly without caching, just like a normal wl_surface. If + * there are already cached events when this is set, those events are + * applied simultaneously with the desync event. + * + * Attempting to enable synchronization when the subsurface already + * thinks it's sync'd, or desync when it believes its desync'd, will + * be trivially ignored and will not generate a Wayland event. + * + * See Wayland's set_desync documentation for further details and + * exceptional cases. + * + * @param subsurface the subsurface + * @param sync true to enable synchronization, false to desynchronize + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI void ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync); + +/** + * Set an opaque region for the given subsurface. + * + * This is an optimization hint to the compositor to allow it avoid + * redrawing content unnecessarily. Note that marking transparent + * content as opaque will cause repaint artifacts. + * + * Use a 0x0 region size to unset the opaque region. + * + * @param subsurface the subsurface + * @param x coordinate in the parent surface + * @param y coordinate in the parent surface + * @param w width to set as opaque + * @param h height to set as opaque + * + * @ingroup Ecore_Wl2_Subsurface_Group + * @since 1.17 + */ +EAPI void ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h); + # undef EAPI # define EAPI diff --git a/src/lib/efl/interfaces/efl_text_font_properties.eo b/src/lib/efl/interfaces/efl_text_font_properties.eo index 160b182803..71d8e3d5d9 100644 --- a/src/lib/efl/interfaces/efl_text_font_properties.eo +++ b/src/lib/efl/interfaces/efl_text_font_properties.eo @@ -1,50 +1,54 @@ import efl_gfx_types; enum @beta Efl.Text_Font_Weight { - [[Type of font weight.]] - normal, [[Normal font weight.]] - thin, [[Thin font weight.]] - ultralight, [[Ultralight font weight.]] - extralight, [[Extralight font weight.]] - light, [[Light font weight.]] - book, [[Book font weight.]] - medium, [[Medium font weight.]] - semibold, [[Semibold font weight.]] - bold, [[Bold font weight.]] - ultrabold, [[Ultrabold font weight.]] - extrabold, [[Extrabold font weight.]] - black, [[Black font weight.]] - extrablack, [[Extrablack font weight.]] + [[The weight of a particular font is the thickness of the character outlines relative to their height. + The given numerical values follow the TrueType scale (from 100 to 900) and are approximate. + It is up to each font to provide all of them.]] + normal, [[Normal font weight (400).]] + thin, [[Thin font weight (100).]] + ultralight, [[Ultralight font weight (200).]] + extralight, [[Extralight font weight (200).]] + light, [[Light font weight (300).]] + book, [[Book font weight (350).]] + medium, [[Medium font weight (500).]] + semibold, [[Semibold font weight (600).]] + bold, [[Bold font weight (700).]] + ultrabold, [[Ultrabold font weight (800).]] + extrabold, [[Extrabold font weight (800).]] + black, [[Black font weight (900).]] + extrablack, [[Extrablack font weight (950).]] } enum @beta Efl.Text_Font_Width { - [[Type of font width.]] - normal, [[Normal font width.]] + [[Font width relative to its height. + It is up to each font to provide all these widths.]] + normal, [[Normal font width.]] ultracondensed, [[Ultracondensed font width.]] extracondensed, [[Extracondensed font width.]] - condensed, [[Condensed font width.]] - semicondensed, [[Semicondensed font width.]] - semiexpanded, [[Semiexpanded font width.]] - expanded, [[Expanded font width.]] - extraexpanded, [[Extraexpanded font width.]] - ultraexpanded, [[Ultraexpanded font width.]] + condensed, [[Condensed font width.]] + semicondensed, [[Semicondensed font width.]] + semiexpanded, [[Semiexpanded font width.]] + expanded, [[Expanded font width.]] + extraexpanded, [[Extraexpanded font width.]] + ultraexpanded, [[Ultraexpanded font width.]] } enum @beta Efl.Text_Font_Slant { [[Type of font slant.]] - normal, [[Normal font slant.]] - oblique, [[Oblique font slant.]] - italic, [[Italic font slant.]] + normal, [[Normal font slant: Sets the text to the normal font (non-italicized).]] + oblique, [[Oblique font slant: Sets the text to use a simulated version of an italic font, + created by algorithmically slanting the normal version.]] + italic, [[Italic font slant: Sets the text to use the italic version of the font if available. + If not available, it will simulate italics with oblique instead.]] } enum @beta Efl.Text_Font_Bitmap_Scalable { - [[Scalable of bitmap fonts. - ]] - none = 0, [[Disable scalable feature for bitmap fonts.]] - color = (1 << 0), [[Enable scalable feature for color bitmap fonts.]] + [[When are bitmap fonts allowed to be scaled.]] + none = 0, [[Disable scaling for bitmap fonts.]] + color = (1 << 0), [[Enable scaling for color bitmap fonts.]] } interface @beta Efl.Text_Font_Properties { - [[Font settings for text. + [[Properties related to font handling. ]] c_prefix: efl_text; methods { @@ -72,9 +76,9 @@ interface @beta Efl.Text_Font_Properties { } @property font_size { - [[The font size for a given text object. + [[The font size to use, in points. - This property controls the font size of a text object. + If the specified @.font_family does not provide this particular size, it will be scaled. ]] set {} get {} @@ -112,7 +116,7 @@ interface @beta Efl.Text_Font_Properties { } @property font_weight { - [[Type of weight of the displayed font + [[Type of weight (e.g. bold or normal) of the displayed font Default is @Efl.Text_Font_Weight.normal. ]] @@ -122,7 +126,7 @@ interface @beta Efl.Text_Font_Properties { } @property font_slant { - [[Type of slant of the displayed font. + [[Type of slant (e.g. italic or normal) of the displayed font. Default is @Efl.Text_Font_Slant.normal. ]] @@ -132,7 +136,7 @@ interface @beta Efl.Text_Font_Properties { } @property font_width { - [[Type of width of the displayed font. + [[Type of width (e.g. condensed, expanded or normal) of the displayed font. Default is @Efl.Text_Font_Width.normal. ]] @@ -155,14 +159,14 @@ interface @beta Efl.Text_Font_Properties { } @property font_bitmap_scalable { - [[The bitmap fonts have fixed size glyphs for several available sizes. - Basically, it is not scalable. But, it needs to be scalable for some use cases. - (e.g. colorful emoji fonts) + [[Bitmap fonts have fixed size glyphs for several available sizes. + Other sizes need to be algorithmically scaled, resulting in blurry glyphs. + This property controls whether scaling of non-provided sizes is allowed. Default is @Efl.Text_Font_Bitmap_Scalable.none. ]] values { - scalable: Efl.Text_Font_Bitmap_Scalable; [[Scalable.]] + scalable: Efl.Text_Font_Bitmap_Scalable; [[When should bitmap fonts be scaled.]] } } } diff --git a/src/lib/efl/interfaces/efl_text_format.eo b/src/lib/efl/interfaces/efl_text_format.eo index 03a44295a5..14d80a107c 100644 --- a/src/lib/efl/interfaces/efl_text_format.eo +++ b/src/lib/efl/interfaces/efl_text_format.eo @@ -1,5 +1,5 @@ enum @beta Efl.Text_Format_Wrap { - [[Wrapping policy of the text.]] + [[Wrapping policy for the text.]] none, [[No wrapping.]] char, [[Wrap at character boundaries.]] word, [[Wrap at word boundaries.]] @@ -9,11 +9,11 @@ enum @beta Efl.Text_Format_Wrap { } enum @beta Efl.Text_Format_Horizontal_Alignment_Auto_Type { - [[Auto-horizontal alignment setting for the text (Left-To-Right or Right-To-Left).]] + [[Automatic horizontal alignment setting for the text (Left-To-Right or Right-To-Left).]] none, [[No auto-alignment rule: Horizontal Alignment is decided by @Efl.Text_Format.text_horizontal_align]] auto, [[Respects LTR/RTL (bidirectional) characters found inside the text content.]] locale, [[Respects the system's language settings.]] - end [[Text is placed at opposite side of LTR/RTL (bidirectional) settings.]] + opposite [[Text is placed at opposite side of LTR/RTL (bidirectional) settings.]] } interface @beta Efl.Text_Format { @@ -33,36 +33,42 @@ interface @beta Efl.Text_Format { ]] values { - value: double; [[Ellipsis value.]] + value: double; [[Position of the ellipsis inside the text, from $[0.0] to $[1.0].]] } } @property wrap { - [[Wrapping policy of the text. Requires @.multiline to be $true.]] + [[Wrapping policy for the text. + + When text does not fit the widget in a single line, it can be automatically wrapped at + character or word boundaries, for example. + + Requires @.multiline to be $true. + ]] values { - wrap: Efl.Text_Format_Wrap; [[Wrap mode.]] + wrap: Efl.Text_Format_Wrap; [[Wrapping policy.]] } } @property multiline { [[Enables text to span multiple lines. - + When $false, new-line characters are ignored and no text wrapping occurs. ]] values { - enabled: bool; [[$true if multiline is enabled.]] + enabled: bool; [[$true if multiple lines should be rendered.]] } } @property text_horizontal_align_auto_type { [[Specifies when the text's horizontal alignment should be set automatically.]] values { - value: Efl.Text_Format_Horizontal_Alignment_Auto_Type; [[Alignment type.]] + value: Efl.Text_Format_Horizontal_Alignment_Auto_Type; [[Automatic horizontal alignment type.]] } } @property text_horizontal_align { - [[Horizontal alignment of text. $[0.0] means "left" + [[Manual horizontal alignment of text. $[0.0] means "left" and $[1.0] means "right". Setting this value also sets @.text_horizontal_align_auto_type to @Efl.Text_Format_Horizontal_Alignment_Auto_Type.none. @@ -75,7 +81,7 @@ interface @beta Efl.Text_Format { } @property text_vertical_align { - [[Vertical alignment of text.$[0.0] means "top" + [[Vertical alignment of text. $[0.0] means "top" and $[1.0] means "bottom"]] values { value: double; [[Alignment value between $[0.0] and $[1.0].]] @@ -105,16 +111,16 @@ interface @beta Efl.Text_Format { } @property tab_stops { - [[Size of the tab character.]] + [[Size (in pixels) of the tab character.]] values { - value: int; [[Size in pixels.]] + value: int; [[Size in pixels, greater than 1.]] } } @property password { [[Enabling this causes all characters to be replaced by @.replacement_char. - + This is useful for password input boxes. ]] values @@ -124,13 +130,12 @@ interface @beta Efl.Text_Format { } @property replacement_char { - [[The character used to replace characters that can't be displayed + [[The character used to replace characters that can't be displayed. - Currently only used to replace characters if @.password - is enabled. + Only used to replace characters if @.password is enabled. ]] values { - repch: string; [[Replacement character]] + repch: string; [[Replacement character.]] } } } diff --git a/src/lib/efl/interfaces/efl_text_style.eo b/src/lib/efl/interfaces/efl_text_style.eo index a975ebdc96..bb168fd5dd 100644 --- a/src/lib/efl/interfaces/efl_text_style.eo +++ b/src/lib/efl/interfaces/efl_text_style.eo @@ -1,70 +1,80 @@ enum @beta Efl.Text_Style_Background_Type { - [[Whether to add a background colored rectangle (background) to each line of text or not.]] - none = 0, [[Do not use background.]] - solid_color, [[Use solid color background.]] - + [[Type of background to use behind each line of text.]] + none = 0, [[Do not use background.]] + solid_color, [[Use a solid-color rectangle as background. + Requires @Efl.Text_Style.text_background_color.]] } enum @beta Efl.Text_Style_Strikethrough_Type { [[Whether to add a strike-through decoration to the displayed text or not.]] none = 0, [[Do not use strike-through.]] - single, [[Strikethrough with a single line.]] - + single, [[Strike-through with a single line. + Requires @Efl.Text_Style.text_strikethrough_color.]] } enum @beta Efl.Text_Style_Effect_Type { [[Effect to apply to the displayed text.]] - none = 0, [[No effect.]] - - // colored with shadow_color - shadow, [[Shadow effect.]] - far_shadow, [[Far shadow effect.]] - soft_shadow, [[Soft shadow effect.]] - far_soft_shadow, [[Far and soft shadow effect.]] - // colored with glow_color - glow, [[Glow effect.]] - // colored with outline_color - outline, [[Outline effect.]] - soft_outline, [[Soft outline effect.]] - // colored with outline_color + shadow_color - outline_shadow, [[Outline + shadow effect.]] - outline_soft_shadow, [[Outline + soft shadow effect.]] + none = 0, [[No effect.]] + shadow, [[Shadow effect. + Uses @Efl.Text_Style.text_shadow_color and @Efl.Text_Style.text_shadow_direction.]] + far_shadow, [[Far shadow effect. + Uses @Efl.Text_Style.text_shadow_color and @Efl.Text_Style.text_shadow_direction.]] + soft_shadow, [[Soft shadow effect. + Uses @Efl.Text_Style.text_shadow_color and @Efl.Text_Style.text_shadow_direction.]] + far_soft_shadow, [[Far and soft shadow effect. + Uses @Efl.Text_Style.text_shadow_color and @Efl.Text_Style.text_shadow_direction.]] + glow, [[Glow effect. + Uses @Efl.Text_Style.text_glow_color and @Efl.Text_Style.text_secondary_glow_color.]] + outline, [[Outline effect. + Uses @Efl.Text_Style.text_outline_color.]] + soft_outline, [[Soft outline effect. + Uses @Efl.Text_Style.text_outline_color.]] + outline_shadow, [[Outline + shadow effect. + Uses @Efl.Text_Style.text_shadow_color, @Efl.Text_Style.text_shadow_direction and + @Efl.Text_Style.text_outline_color.]] + outline_soft_shadow, [[Outline + soft shadow effect. + Uses @Efl.Text_Style.text_shadow_color, @Efl.Text_Style.text_shadow_direction and + @Efl.Text_Style.text_outline_color.]] } enum @beta Efl.Text_Style_Shadow_Direction { - [[Direction of the shadow.]] + [[Direction of the shadow effect.]] bottom_right = 0, [[Shadow towards bottom right.]] - bottom, [[Shadow towards bottom.]] - bottom_left, [[Shadow towards bottom left.]] - left, [[Shadow towards left.]] - top_left, [[Shadow towards top left.]] - top, [[Shadow towards top.]] - top_right, [[Shadow towards top right.]] - right, [[Shadow towards right.]] + bottom, [[Shadow towards bottom.]] + bottom_left, [[Shadow towards bottom left.]] + left, [[Shadow towards left.]] + top_left, [[Shadow towards top left.]] + top, [[Shadow towards top.]] + top_right, [[Shadow towards top right.]] + right, [[Shadow towards right.]] } enum @beta Efl.Text_Style_Underline_Type { - [[Type of underline of the displayed text.]] + [[Type of underline for the displayed text.]] none = 0, [[Text without underline.]] - single, [[Underlined with a single line.]] - double, [[Underlined with a double line.]] - dashed, [[Underlined with a dashed line.]] + single, [[Underlined with a single line. + Requires @Efl.Text_Style.text_underline_color.]] + double, [[Underlined with a double line. + Requires @Efl.Text_Style.text_underline_color and @Efl.Text_Style.text_secondary_underline_color.]] + dashed, [[Underlined with a dashed line. + Requires @Efl.Text_Style.text_underline_dashed_color, @Efl.Text_Style.text_underline_dashed_width and + @Efl.Text_Style.text_underline_dashed_gap.]] } interface @beta Efl.Text_Style { [[Decorations to add to the text. - Decorations can be coloring, effects, underlines, strike-through etc. + Decorations include text color, glow, outline, underline, strike-through and shadows. ]] c_prefix: efl_text; methods { @property text_color { - [[Color of text, excluding decorations like, shadow, outline or glow.]] + [[Color of text, excluding all other decorations. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -75,7 +85,7 @@ interface @beta Efl.Text_Style { } @property text_background_type { - [[Enables rendering of a background rectangle behind each line of text.]] + [[Type of background to use behind each line of text.]] values { type: Efl.Text_Style_Background_Type; [[Background type.]] @@ -83,7 +93,7 @@ interface @beta Efl.Text_Style { } @property text_background_color { - [[Color of the background rectangle (backing) behind each line of text.]] + [[Color of the background behind each line of text. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -94,7 +104,7 @@ interface @beta Efl.Text_Style { } @property text_underline_type { - [[Underline style for the text.]] + [[Type of underline to use for the text.]] values { type: Efl.Text_Style_Underline_Type; [[Underline type.]] @@ -103,7 +113,7 @@ interface @beta Efl.Text_Style { @property text_underline_color { - [[Color of normal underline style.]] + [[Color of the primary underline. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -126,7 +136,7 @@ interface @beta Efl.Text_Style { @property text_underline_dashed_color { [[Color of the dashed underline. Only valid when @.text_underline_type is - @Efl.Text_Style_Underline_Type.dashed.]] + @Efl.Text_Style_Underline_Type.dashed. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -159,7 +169,7 @@ interface @beta Efl.Text_Style { @property text_secondary_underline_color { [[Color of the secondary underline. Only valid when @.text_underline_type is - @Efl.Text_Style_Underline_Type.double.]] + @Efl.Text_Style_Underline_Type.double. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -179,7 +189,7 @@ interface @beta Efl.Text_Style { @property text_strikethrough_color { - [[Color of the line striking through the text.]] + [[Color of the line striking through the text. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -198,7 +208,7 @@ interface @beta Efl.Text_Style { } @property text_outline_color { - [[Color of the text outline.]] + [[Color of the text outline. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -210,7 +220,7 @@ interface @beta Efl.Text_Style { @property text_shadow_direction { - [[Direction of shadow effect.]] + [[Direction of the shadow effect.]] values { type: Efl.Text_Style_Shadow_Direction; [[Shadow direction.]] @@ -219,7 +229,7 @@ interface @beta Efl.Text_Style { @property text_shadow_color { - [[Color of the shadow.]] + [[Color of the text shadow. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -231,7 +241,7 @@ interface @beta Efl.Text_Style { @property text_glow_color { - [[Color of the glow decoration.]] + [[Color of the text glow. By default it is invisible.]] values { r: ubyte; [[Red component.]] @@ -245,7 +255,8 @@ interface @beta Efl.Text_Style { { [[Color of the secondary glow decoration. This is the color of the inner glow (where it touches the text) which - gradually fades into @.text_glow_color as it reaches the edge. + gradually fades into @.text_glow_color as it reaches the outer edge. + By default it is invisible. ]] values { @@ -264,7 +275,7 @@ interface @beta Efl.Text_Style { ]] values { - code: string; [[Filter code]] + code: string; [[Filter code.]] } } } diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index 02406d1d21..d872a4a426 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c @@ -16,6 +16,7 @@ #include "Ecore_Evas.h" #include "Ecore_Wl2.h" +#include "ecore_wl2_internal.h" #include "Ecore_Input.h" #include "Evas_GL.h" diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c index 3212632532..54b29f2712 100644 --- a/src/lib/elementary/efl_ui_internal_text_interactive.c +++ b/src/lib/elementary/efl_ui_internal_text_interactive.c @@ -76,6 +76,12 @@ _text_filter_markup_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Inte const char *fmtpre, const char *fmtpost, Eina_Bool clearsel, Eina_Bool changeinfo); +static void +_cur_pos_copy(Efl_Text_Cursor *src, Efl_Text_Cursor *dest) +{ + efl_text_cursor_position_set(dest, efl_text_cursor_position_get(src)); +} + #ifdef HAVE_ECORE_IMF static void _preedit_clear(Efl_Ui_Internal_Text_Interactive_Data *en) @@ -523,12 +529,12 @@ _entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUS /* set preedit start cursor */ if (!en->preedit_start) en->preedit_start = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, en->preedit_start); + _cur_pos_copy(cur, en->preedit_start); /* set preedit end cursor */ if (!en->preedit_end) en->preedit_end = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, en->preedit_end); + _cur_pos_copy(cur, en->preedit_end); preedit_end_pos = efl_text_cursor_position_get(cur); @@ -752,8 +758,8 @@ _sel_init(Efl_Text_Cursor *c, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_I if (en->have_selection) return; - efl_text_cursor_copy(c, en->sel_start); - efl_text_cursor_copy(c, en->sel_end); + _cur_pos_copy(c, en->sel_start); + _cur_pos_copy(c, en->sel_end); en->have_selection = EINA_FALSE; if (en->selection) @@ -804,7 +810,7 @@ _sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive _sel_enable(c, o, en); if (efl_text_cursor_equal(c, en->sel_end)) return; - efl_text_cursor_copy(c, en->sel_end); + _cur_pos_copy(c, en->sel_end); _entry_imf_cursor_info_set(en); @@ -830,7 +836,7 @@ _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en { en->have_selection = EINA_FALSE; Eina_Bool b_value = en->have_selection; - efl_text_cursor_copy(en->sel_start, en->sel_end); + _cur_pos_copy(en->sel_start, en->sel_end); efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value); } } @@ -1024,9 +1030,9 @@ _key_down_sel_pre(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur, E { Eina_Bool sel_forward = efl_text_cursor_compare(en->sel_start, en->sel_end); if ((sel_forward && movement_forward) || (!sel_forward && !movement_forward)) - efl_text_cursor_copy(en->sel_end, cur); + _cur_pos_copy(en->sel_end, cur); else - efl_text_cursor_copy(en->sel_start, cur); + _cur_pos_copy(en->sel_start, cur); _sel_clear(obj, en); } } @@ -1207,7 +1213,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void // del to start of previous word Efl_Text_Cursor *tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(tc, cur); + _cur_pos_copy(tc, cur); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); @@ -1242,7 +1248,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void // del to end of next word Efl_Text_Cursor *tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(tc, cur); + _cur_pos_copy(tc, cur); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT); @@ -1484,7 +1490,7 @@ _cursor_char_coord_set(Efl_Canvas_Textblock *obj, Efl_Text_Cursor *cur, Evas_Coo Efl_Text_Cursor *tc; tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); evas_object_geometry_get(obj, &x, &y, NULL, NULL); cx = canvasx - x; cy = canvasy - y; @@ -1549,7 +1555,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN if (shift) { tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); if (efl_text_cursor_compare(cur, en->sel_start) < 0) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); else @@ -1562,7 +1568,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN en->selecting = EINA_FALSE; _sel_clear(obj, en); tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); _sel_init(cur, obj, en); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); @@ -1575,7 +1581,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN if (shift) { tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); if (efl_text_cursor_compare(cur, en->sel_start) < 0) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); else @@ -1591,7 +1597,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN en->selecting = EINA_FALSE; _sel_clear(obj, en); tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); _sel_init(cur, obj, en); efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); @@ -1650,7 +1656,7 @@ _mouse_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void if (en->select_allow) { - efl_text_cursor_copy(en->sel_end, cur); + _cur_pos_copy(en->sel_end, cur); } if (en->selecting) { @@ -1690,7 +1696,7 @@ _mouse_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, vo if (en->selecting) { tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); evas_object_geometry_get(obj, &x, &y, &w, &h); cx = ev->cur.canvas.x - x; cy = ev->cur.canvas.y - y; diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index 6852b50b40..fde6cca4c7 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -24,18 +24,23 @@ struct _Efl_Ui_Select_Model_Data Efl_Ui_Select_Model *last_model; Efl_Ui_Select_Mode selection; - - Eina_Bool none : 1; }; static void +_efl_ui_select_model_apply_last_model(Eo *obj, Efl_Ui_Select_Model_Data *pd, Eo *last_model) +{ + efl_replace(&pd->last_model, last_model); + efl_model_properties_changed(obj, "child.selected"); +} + +static void _efl_ui_select_model_child_removed(void *data, const Efl_Event *event) { Efl_Ui_Select_Model_Data *pd = data; Efl_Model_Children_Event *ev = event->info; if (ev->child == pd->last_model) - efl_replace(&pd->last_model, NULL); + _efl_ui_select_model_apply_last_model(event->object, pd, NULL); } static Eo* @@ -49,7 +54,6 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE); efl_event_callback_add(obj, EFL_MODEL_EVENT_CHILD_REMOVED, _efl_ui_select_model_child_removed, pd); - pd->none = EINA_TRUE; parent = efl_parent_get(obj); if (efl_isa(parent, EFL_UI_SELECT_MODEL_CLASS)) @@ -64,7 +68,6 @@ _efl_ui_select_model_efl_object_invalidate(Eo *obj, { efl_replace(&pd->fallback_model, NULL); efl_replace(&pd->last_model, NULL); - pd->none = EINA_TRUE; efl_invalidate(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS)); } @@ -75,7 +78,7 @@ _efl_ui_select_model_fallback(Efl_Ui_Select_Model_Data *pd) Eina_Value selected; if (!pd->parent) return; - if (!pd->parent->none) return; + if (!pd->parent->last_model) return; if (!pd->parent->fallback_model) return; // I think it only make sense to trigger the fallback on single mode if (pd->parent->selection != EFL_UI_SELECT_MODE_SINGLE) return; @@ -129,8 +132,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) if (selflag) { // select case - pd->none = EINA_FALSE; - efl_replace(&pd->last_model, child); + _efl_ui_select_model_apply_last_model(parent, pd, child); efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_SELECTED, child); } else @@ -139,8 +141,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) // There should only be one model which represent the same data at all in memory if (pd->last_model == child) // direct comparison of pointer is ok { - efl_replace(&pd->last_model, NULL); - pd->none = EINA_TRUE; + _efl_ui_select_model_apply_last_model(parent, pd, NULL); // Just in case we need to refill the fallback _efl_ui_select_model_fallback(pd); @@ -401,13 +402,12 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, { if (pd->parent->last_model == obj && !newflag) { - efl_replace(&pd->last_model, NULL); - pd->parent->none = EINA_TRUE; + _efl_ui_select_model_apply_last_model(efl_parent_get(obj), pd->parent, NULL); _efl_ui_select_model_fallback(pd); } } - else + else if (pd->parent->last_model) { Eo *parent; unsigned long selected = 0; @@ -431,6 +431,10 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, .error = _untangle_error, .free = _untangle_free); } + else + { + _efl_ui_select_model_apply_last_model(efl_parent_get(obj), pd->parent, obj); + } } return efl_future_then(efl_ref(obj), chain, @@ -450,10 +454,10 @@ _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_D // Last selected child if (eina_streq("child.selected", property)) { - if (pd->none) - return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE); - else if (pd->last_model) + if (pd->last_model) return eina_value_ulong_new(efl_composite_model_index_get(pd->last_model)); + else if (pd->fallback_model) + return eina_value_ulong_new(efl_composite_model_index_get(pd->fallback_model)); else // Nothing selected yet, try again later return eina_value_error_new(EAGAIN); } @@ -653,7 +657,7 @@ _efl_ui_select_model_efl_ui_single_selectable_fallback_selection_set(Eo *obj, efl_replace(&pd->fallback_model, fallback); - if (!pd->none) return ; + if (!pd->last_model) return ; // When we provide a fallback, we should use it! index = efl_model_property_get(fallback, EFL_COMPOSITE_MODEL_CHILD_INDEX); diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c index dd25e39419..728c060adb 100644 --- a/src/lib/elementary/efl_ui_textbox.c +++ b/src/lib/elementary/efl_ui_textbox.c @@ -89,7 +89,7 @@ struct _Efl_Ui_Textbox_Data Eina_Future *primary; Eina_Future *clipboard; } sel_future; - Eina_Bool sel_handler_enabled : 1; + Eina_Bool sel_handles_enabled : 1; Eina_Bool start_handler_down : 1; Eina_Bool start_handler_shown : 1; Eina_Bool end_handler_down : 1; @@ -259,7 +259,7 @@ _load_do(Evas_Object *obj) if (!sd->file) { - elm_object_text_set(obj, ""); + efl_text_set(obj, ""); return 0; } @@ -428,7 +428,7 @@ _update_selection_handler(Eo *obj) return; } - if (sd->sel_handler_enabled) + if (sd->sel_handles_enabled) { Eina_Rect rect; Eina_Position2D off; @@ -556,15 +556,13 @@ static void _dnd_enter_cb(void *data EINA_UNUSED, Evas_Object *obj) { - elm_object_focus_set(obj, EINA_TRUE); + efl_ui_focus_util_focus(obj); } static void _dnd_leave_cb(void *data EINA_UNUSED, - Evas_Object *obj) + Evas_Object *obj EINA_UNUSED) { - if (_elm_config->desktop_entry) - elm_object_focus_set(obj, EINA_FALSE); } static void @@ -820,7 +818,7 @@ _efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data if (efl_ui_focus_object_focus_get(obj)) { - evas_object_focus_set(sd->text_obj, EINA_TRUE); + efl_canvas_object_key_focus_set(sd->text_obj, EINA_TRUE); _edje_signal_emit(sd, "efl,action,focus", "efl"); @@ -834,7 +832,7 @@ _efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data Eo *sw = sd->text_obj; _edje_signal_emit(sd, "efl,action,unfocus", "efl"); - evas_object_focus_set(sw, EINA_FALSE); + efl_canvas_object_key_focus_set(sw, EINA_FALSE); if (top && top_is_win && efl_input_text_input_panel_autoshow_get(obj)) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); @@ -1886,7 +1884,7 @@ _efl_ui_textbox_efl_object_constructor(Eo *obj, Efl_Ui_Textbox_Data *sd) efl_text_interactive_selection_allowed_set(obj, EINA_TRUE); sd->drop_format = EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE; sd->last.scroll = EINA_SIZE2D(0, 0); - sd->sel_handler_enabled = EINA_FALSE; + sd->sel_handles_enabled = EINA_FALSE; return obj; } @@ -2089,16 +2087,16 @@ _efl_ui_textbox_selection_get(const Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED } EOLIAN static void -_efl_ui_textbox_selection_handler_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled) +_efl_ui_textbox_selection_handles_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled) { - if (sd->sel_handler_enabled == enabled) return; - sd->sel_handler_enabled = enabled; + if (sd->sel_handles_enabled == enabled) return; + sd->sel_handles_enabled = enabled; } EOLIAN static Eina_Bool -_efl_ui_textbox_selection_handler_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +_efl_ui_textbox_selection_handles_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) { - return sd->sel_handler_enabled; + return sd->sel_handles_enabled; } static void @@ -2110,16 +2108,10 @@ _efl_ui_textbox_entry_insert(Eo *obj, Efl_Ui_Textbox_Data *sd, const char *entry efl_canvas_group_change(obj); } -EOLIAN static void -_efl_ui_textbox_cursor_add(Eo *obj, Efl_Ui_Textbox_Data *pd, Efl_Text_Cursor *cursor) -{ - efl_text_cursor_text_object_set(cursor, pd->text_obj, obj); -} - EOLIAN static Efl_Text_Cursor * _efl_ui_textbox_cursor_create(Eo *obj, Efl_Ui_Textbox_Data *pd) { - Eo* cursor = efl_add(EFL_TEXT_CURSOR_CLASS, pd->text_obj); + Eo* cursor = efl_text_cursor_create(pd->text_obj);; efl_text_cursor_text_object_set(cursor, pd->text_obj, obj); return cursor; } @@ -2173,6 +2165,17 @@ _efl_ui_textbox_select_region_set(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED, efl_text_cursor_position_set(sel_end, end); } +static void +_efl_ui_textbox_select_region_get(Eo *obj, int *start, int *end) +{ + Efl_Text_Cursor *sel_start, *sel_end; + + efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end); + + if(start) *start = efl_text_cursor_position_get(sel_start); + if(end) *end = efl_text_cursor_position_get(sel_end); +} + EOLIAN static void _efl_ui_textbox_selection_cut(Eo *obj, Efl_Ui_Textbox_Data *sd) { @@ -2264,7 +2267,7 @@ EOLIAN static void _efl_ui_textbox_efl_file_unload(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED) { efl_file_unload(efl_super(obj, MY_CLASS)); - elm_object_text_set(obj, ""); + efl_text_set(obj, ""); } EOLIAN static Eina_Error @@ -2553,7 +2556,7 @@ _efl_ui_textbox_efl_access_text_access_selection_get(const Eo *obj, Efl_Ui_Textb { if (selection_number != 0) return; - elm_obj_entry_select_region_get(obj, start_offset, end_offset); + _efl_ui_textbox_select_region_get((Eo *)obj, start_offset, end_offset); } EOLIAN static Eina_Bool diff --git a/src/lib/elementary/efl_ui_textbox.eo b/src/lib/elementary/efl_ui_textbox.eo index b723c59e44..ce4ca09b24 100644 --- a/src/lib/elementary/efl_ui_textbox.eo +++ b/src/lib/elementary/efl_ui_textbox.eo @@ -6,7 +6,7 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click [[A flexible text widget which can be static (as a label) or editable by the user (as a text entry). It provides all sorts of editing facilities like automatic scrollbars, virtual keyboard, clipboard, configurable - context menus or autocapitalization, for example.]] + context menus or auto-capitalization, for example.]] methods { @property scrollable { [[Enable or disable scrolling in the widget. @@ -16,17 +16,19 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click set {} get {} values { - scroll: bool; [[$true to enable scrolling. Default is $false.]] + scroll: bool(false); [[$true to enable scrolling.]] } } @property context_menu_enabled { - [[This enables or disables the entry's contextual (longpress) menu.]] + [[This enables or disables the widget's contextual menu, typically + accessible through a long-press or a right-button click. + ]] set { } get { } values { - enabled: bool; [[If $true, the menu is enabled.]] + enabled: bool; [[$true to enable the contextual menu.]] } } @property cnp_mode { @@ -45,14 +47,15 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click format: Efl.Ui.Selection_Format; [[Format for copy & paste.]] } } - @property selection_handler_enabled { - [[This enables or disables the entry's selection handlers.]] + @property selection_handles_enabled { + [[This enables or disables the visual handles around selected text, + to allow simpler modification on touch screens.]] set { } get { } values { - enabled: bool; [[If $true, the selection handlers are enabled.]] + enabled: bool; [[$true to enable the selection handles.]] } } @@ -64,25 +67,18 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click item_factory: Efl.Canvas.Textblock_Factory; [[Factory to create items]] } } - cursor_add { - [[Add cursor that will manipulate and iterate content of the text object. - It is typically more convenient to obtain a cursor directly from the text object using @.cursor_create.]] - params { - cursor: Efl.Text.Cursor; [[Text cursor.]] - } - } cursor_create { [[Creates and returns a new cursor for the text.]] return: Efl.Text.Cursor @move; [[Text cursor.]] } selection_copy { - [[This executes a "copy" action on the selected text in the entry.]] + [[This executes a "copy" action on the selected text in the widget.]] } selection_paste { - [[This executes a "paste" action in the entry.]] + [[This executes a "paste" action in the widget.]] } selection_cut { - [[This executes a "cut" action on the selected text in the entry.]] + [[This executes a "cut" action on the selected text in the widget.]] } } implements { diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index ca3ab0620f..5aa18c3e62 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -8,6 +8,7 @@ # endif # ifdef HAVE_ELEMENTARY_WL2 # include <Ecore_Wl2.h> +# include "ecore_wl2_internal.h" # endif # ifdef HAVE_ELEMENTARY_DRM # include <Ecore_Drm2.h> diff --git a/src/lib/evas/canvas/efl_canvas_textblock.eo b/src/lib/evas/canvas/efl_canvas_textblock.eo index 72cd8a693e..8e9bee7dba 100644 --- a/src/lib/evas/canvas/efl_canvas_textblock.eo +++ b/src/lib/evas/canvas/efl_canvas_textblock.eo @@ -23,15 +23,6 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, is_empty: bool; [[$true if empty.]] } } - cursor_add { - [[Adds an existing cursor to the text object. - If the cursor already belonged to another text object it will be reassigned to the new one. - It is typically more convenient to obtain a cursor directly from the text object using @.cursor_create. - ]] - params { - cursor: Efl.Text.Cursor; [[The text cursor to use.]] - } - } cursor_create { [[Creates a new cursor and adds it to the text object. This cursor can be used to manipulate and iterate the content of the text object. @@ -149,8 +140,8 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, Requires $underline. See @Efl.Text_Style.text_underline_color. - - $secondary_underline_color: Color code for the secondary text underline (See bottom for the complete list of - supported codes). Only valid when $[underline=double]. + - $secondary_underline_color: Color code for the secondary text underline (See bottom for the complete list + of supported codes). Only valid when $[underline=double]. Default value is $[rgba(0,0,0,0)] meaning that secondary underline will not be rendered. See @Efl.Text_Style.text_secondary_underline_color. @@ -174,8 +165,8 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, Default value is $[rgba(0,0,0,0)] meaning that no glow will be rendered. See @Efl.Text_Style.text_glow_color. - - $secondary_glow_color: Color code for the secondary (inner) glow component of the text (See bottom for the complete - list of supported codes). Only valid when the $style attribute includes a glow. + - $secondary_glow_color: Color code for the secondary (inner) glow component of the text (See bottom for + the complete list of supported codes). Only valid when the $style attribute includes a glow. Default value is $[rgba(0,0,0,0)] meaning that only the primary $glow_color will be used. See @Efl.Text_Style.text_secondary_glow_color. @@ -257,37 +248,37 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, Examples: $[style=outline], $[style=shadow,bottom_right], $[style=outline_shadow,bottom]. See @Efl.Text_Style.text_effect_type and @Efl.Text_Style.text_shadow_direction. - - $tabstops: Size (in pixels) of the tab character. The value must be a number greater than one. + - $tab_stops: Size (in pixels) of the tab character. The value must be a number greater than one. Default value is $[32]. See @Efl.Text_Format.tab_stops. - - $linesize: Distance (in pixels) from the baseline of one line of text to the next. This is, a value of + - $line_size: Distance (in pixels) from the baseline of one line of text to the next. This is, a value of $[0] would render all lines on top of each other (However, this value will be ignored if it results in overlapping lines of text). - Setting this value sets $linerelsize to $[0%] (disables it). + Setting this value sets $line_rel_size to $[0%] (disables it). Default value is $[0]. - - $linerelsize: Distance (in percentage over the natural line height) from the baseline of one line of + - $line_rel_size: Distance (in percentage over the natural line height) from the baseline of one line of text to the next. A value of $[100%] does not have any impact, smaller values render lines closer together and bigger values render them further apart. - Setting this value sets $linesize to $[0] (disables it). + Setting this value sets $line_size to $[0] (disables it). Default value is $[0%]. - - $linegap: Additional empty space (in pixels) between the bottom of one line of text and the top of the - next. Setting this value sets $linerelgap to $[0%] (disables it). + - $line_gap: Additional empty space (in pixels) between the bottom of one line of text and the top of the + next. Setting this value sets $line_rel_gap to $[0%] (disables it). Default value is $[0]. See @Efl.Text_Format.line_gap. - - $linerelgap: Additional empty space (in percentage over the natural line height) between the bottom of + - $line_rel_gap: Additional empty space (in percentage over the natural line height) between the bottom of one line of text and the top of the next. - Setting this value sets $linegap to $[0] (disables it). + Setting this value sets $line_gap to $[0] (disables it). Default value is $[0%]. See @Efl.Text_Format.line_rel_gap. - - $linefill: An alternate way to specify the $linesize as a percentage of the canvas height. + - $line_fill: An alternate way to specify the $line_size as a percentage of the canvas height. A value of $[100%] means that a single line fills the canvas, whereas $[25%] means that 4 lines fit in the same height. - When both $linefill and $linesize are specified the one resulting in the smallest line size is used. + When both $line_fill and $line_size are specified the one resulting in the smallest line size is used. Default value is $[0]. - $ellipsis: Controls automatic addition of ellipsis "..." to replace text which cannot be shown. diff --git a/src/lib/evas/canvas/efl_canvas_textblock_internal.h b/src/lib/evas/canvas/efl_canvas_textblock_internal.h index a4f03fcef8..eb137455ea 100644 --- a/src/lib/evas/canvas/efl_canvas_textblock_internal.h +++ b/src/lib/evas/canvas/efl_canvas_textblock_internal.h @@ -294,6 +294,14 @@ EAPI void efl_text_cursor_text_object_set(Eo *cursor, Eo *canvas_text_obj, Eo *t /** + * Internally create instance of cursor object. + * + * @param parent the parent of the cursor object. + */ +EAPI Eo* efl_text_cursor_create(Eo *parent); + + +/** * Internally sets cursor handle(legacy textblock cursor) into cursor object. * * @param obj the cursor object. diff --git a/src/lib/evas/canvas/efl_text_cursor.c b/src/lib/evas/canvas/efl_text_cursor.c index eb699728b8..c0a6c627d9 100644 --- a/src/lib/evas/canvas/efl_text_cursor.c +++ b/src/lib/evas/canvas/efl_text_cursor.c @@ -1,6 +1,7 @@ #include "evas_common_private.h" #include "evas_private.h" #include "efl_canvas_textblock_internal.h" +#include "eo_internal.h" #define MY_CLASS EFL_TEXT_CURSOR_CLASS #define MY_CLASS_NAME "Efl.Text.Cursor" @@ -20,6 +21,8 @@ struct _Evas_Textblock_Selection_Iterator typedef struct _Evas_Textblock_Selection_Iterator Evas_Textblock_Selection_Iterator; +EFL_CLASS_SIMPLE_CLASS(efl_text_cursor, "efl_text_cursor", EFL_TEXT_CURSOR_CLASS) + EOLIAN static void _efl_text_cursor_position_set(Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, int position) { @@ -102,11 +105,15 @@ _efl_text_cursor_compare(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, co return evas_textblock_cursor_compare(pd->handle, efl_text_cursor_handle_get(dst)); } -EOLIAN static void -_efl_text_cursor_copy(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl_Text_Cursor *dst) +static void +_efl_text_cursor_copy(const Efl_Text_Cursor *obj, Efl_Text_Cursor *dst) { + Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS); + EINA_SAFETY_ON_NULL_RETURN(pd); + Efl_Text_Cursor_Data *pd_dest = efl_data_scope_safe_get(dst, MY_CLASS); EINA_SAFETY_ON_NULL_RETURN(pd_dest); + if (!pd->handle) return; Efl_Text_Cursor_Handle *handle = evas_object_textblock_cursor_new(pd->handle->obj); @@ -119,9 +126,9 @@ _efl_text_cursor_copy(const Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl_T EOLIAN static Efl_Text_Cursor * _efl_text_cursor_efl_duplicate_duplicate(const Eo *obj, Efl_Text_Cursor_Data *pd EINA_UNUSED) { - Efl_Text_Cursor *dup = efl_new(MY_CLASS); + Efl_Text_Cursor *dup = efl_text_cursor_create(efl_parent_get(obj)); - efl_text_cursor_copy(obj, dup); + _efl_text_cursor_copy(obj, dup); return dup; } @@ -436,6 +443,11 @@ efl_text_cursor_handle_get(const Eo *obj) return pd->handle; } +Eo* efl_text_cursor_create(Eo *parent) +{ + return efl_add(efl_text_cursor_realized_class_get(), parent); +} + void efl_text_cursor_text_object_set(Eo *cursor, Eo *canvas_text_obj, Eo *text_obj) { Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(cursor, MY_CLASS); diff --git a/src/lib/evas/canvas/efl_text_cursor.eo b/src/lib/evas/canvas/efl_text_cursor.eo index 70cfdfad21..00dcbd6e63 100644 --- a/src/lib/evas/canvas/efl_text_cursor.eo +++ b/src/lib/evas/canvas/efl_text_cursor.eo @@ -26,7 +26,7 @@ enum @beta Efl.Text.Cursor_Move_Type paragraph_prev [[Advances to the end of the previous paragraph.]] } -class @beta Efl.Text.Cursor extends Efl.Object implements Efl.Duplicate{ +abstract @beta Efl.Text.Cursor extends Efl.Object implements Efl.Duplicate{ [[Cursor API.]] c_prefix: efl_text_cursor; methods { @@ -112,13 +112,6 @@ class @beta Efl.Text.Cursor extends Efl.Object implements Efl.Duplicate{ return: int; [[Difference between cursors.]] } - copy @const { - [[Copy existing cursor to destination cursor, like position and cursor text object.]] - params { - dst: Efl.Text.Cursor; [[Destination Cursor.]] - } - } - move { [[Move the cursor.]] params { diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 93c7a4b5d5..f4d6cfb88f 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -1418,12 +1418,18 @@ static const char *strikethroughstr = NULL; static const char *backingstr = NULL; static const char *stylestr = NULL; static const char *tabstopsstr = NULL; +static const char *tab_stopsstr = NULL; static const char *linesizestr = NULL; +static const char *line_sizestr = NULL; static const char *linerelsizestr = NULL; +static const char *line_rel_sizestr = NULL; static const char *linegapstr = NULL; +static const char *line_gapstr = NULL; static const char *linerelgapstr = NULL; +static const char *line_rel_gapstr = NULL; static const char *itemstr = NULL; static const char *linefillstr = NULL; +static const char *line_fillstr = NULL; static const char *ellipsisstr = NULL; static const char *passwordstr = NULL; static const char *replacement_charstr = NULL; @@ -1607,12 +1613,18 @@ _format_command_init(void) backingstr = eina_stringshare_add("backing"); stylestr = eina_stringshare_add("style"); tabstopsstr = eina_stringshare_add("tabstops"); + tab_stopsstr = eina_stringshare_add("tab_stops"); linesizestr = eina_stringshare_add("linesize"); + line_sizestr = eina_stringshare_add("line_size"); linerelsizestr = eina_stringshare_add("linerelsize"); + line_rel_sizestr = eina_stringshare_add("line_rel_size"); linegapstr = eina_stringshare_add("linegap"); + line_gapstr = eina_stringshare_add("line_gap"); linerelgapstr = eina_stringshare_add("linerelgap"); + line_rel_gapstr = eina_stringshare_add("line_rel_gap"); itemstr = eina_stringshare_add("item"); linefillstr = eina_stringshare_add("linefill"); + line_fillstr = eina_stringshare_add("line_fill"); ellipsisstr = eina_stringshare_add("ellipsis"); passwordstr = eina_stringshare_add("password"); replacement_charstr = eina_stringshare_add("replacement_char"); @@ -1664,12 +1676,18 @@ _format_command_shutdown(void) eina_stringshare_del(backingstr); eina_stringshare_del(stylestr); eina_stringshare_del(tabstopsstr); + eina_stringshare_del(tab_stopsstr); eina_stringshare_del(linesizestr); + eina_stringshare_del(line_sizestr); eina_stringshare_del(linerelsizestr); + eina_stringshare_del(line_rel_sizestr); eina_stringshare_del(linegapstr); + eina_stringshare_del(line_gapstr); eina_stringshare_del(linerelgapstr); + eina_stringshare_del(line_rel_gapstr); eina_stringshare_del(itemstr); eina_stringshare_del(linefillstr); + eina_stringshare_del(line_fillstr); eina_stringshare_del(ellipsisstr); eina_stringshare_del(passwordstr); eina_stringshare_del(replacement_charstr); @@ -2524,7 +2542,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch if (*part2) _format_shadow_direction_set(fmt, part2, EINA_FALSE, NULL); } - else if (cmd == tabstopsstr) + else if (cmd == tabstopsstr || cmd == tab_stopsstr) { /** * @page evas_textblock_style_page Evas Textblock Style Options @@ -2540,7 +2558,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch fmt->tabstops = atoi(param); if (fmt->tabstops < 1) fmt->tabstops = 1; } - else if (cmd == linesizestr) + else if (cmd == linesizestr || cmd == line_sizestr) { /** * @page evas_textblock_style_page Evas Textblock Style Options @@ -2556,7 +2574,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch fmt->linesize = atoi(param); fmt->linerelsize = 0.0; } - else if (cmd == linerelsizestr) + else if (cmd == linerelsizestr || cmd == line_rel_sizestr) { /** * @page evas_textblock_style_page Evas Textblock Style Options @@ -2584,7 +2602,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch } } } - else if (cmd == linegapstr) + else if (cmd == linegapstr || cmd == line_gapstr) { /** * @page evas_textblock_style_page Evas Textblock Style Options @@ -2601,7 +2619,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch fmt->linegap = atoi(param); fmt->linerelgap = 0.0; } - else if (cmd == linerelgapstr) + else if (cmd == linerelgapstr || cmd == line_rel_gapstr) { /** * @page evas_textblock_style_page Evas Textblock Style Options @@ -2644,7 +2662,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch // itemstr == replacement object items in textblock - inline imges // for example } - else if (cmd == linefillstr) + else if (cmd == linefillstr || cmd == line_fillstr) { /** * @page evas_textblock_style_page Evas Textblock Style Options @@ -3329,7 +3347,7 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) PRINTF_APPEND_COLOR(underline_colorstr, fmt->color.underline.r, fmt->color.underline.g, fmt->color.underline.b, fmt->color.underline.a); - PRINTF_APPEND_COLOR(underline2_colorstr, fmt->color.underline2.r, fmt->color.underline2.g, + PRINTF_APPEND_COLOR(secondary_underline_colorstr, fmt->color.underline2.r, fmt->color.underline2.g, fmt->color.underline2.b, fmt->color.underline2.a); PRINTF_APPEND_COLOR(underline_dash_colorstr, fmt->color.underline_dash.r, fmt->color.underline_dash.g, @@ -3344,7 +3362,7 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) PRINTF_APPEND_COLOR(glow_colorstr, fmt->color.glow.r, fmt->color.glow.g, fmt->color.glow.b, fmt->color.glow.a); - PRINTF_APPEND_COLOR(glow2_colorstr, fmt->color.glow2.r, fmt->color.glow2.g, + PRINTF_APPEND_COLOR(secondary_glow_colorstr, fmt->color.glow2.r, fmt->color.glow2.g, fmt->color.glow2.b, fmt->color.glow2.a); PRINTF_APPEND_COLOR(backing_colorstr, fmt->color.backing.r, fmt->color.backing.g, @@ -3496,12 +3514,12 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) else PRINTF_APPEND_STR(stylestr, style_value_str_1); - PRINTF_APPEND_INT(tabstopsstr, fmt->tabstops); - PRINTF_APPEND_INT(linesizestr, fmt->linesize); - PRINTF_APPEND_PERCENT_FLOAT(linerelsizestr, (fmt->linerelsize*100)); - PRINTF_APPEND_INT(linegapstr, fmt->linegap); - PRINTF_APPEND_PERCENT_FLOAT(linerelgapstr, (fmt->linerelgap*100)); - PRINTF_APPEND_PERCENT_FLOAT(linefillstr, (fmt->linefill*100)); + PRINTF_APPEND_INT(tab_stopsstr, fmt->tabstops); + PRINTF_APPEND_INT(line_sizestr, fmt->linesize); + PRINTF_APPEND_PERCENT_FLOAT(line_rel_sizestr, (fmt->linerelsize*100)); + PRINTF_APPEND_INT(line_gapstr, fmt->linegap); + PRINTF_APPEND_PERCENT_FLOAT(line_rel_gapstr, (fmt->linerelgap*100)); + PRINTF_APPEND_PERCENT_FLOAT(line_fillstr, (fmt->linefill*100)); PRINTF_APPEND_FLOAT(ellipsisstr, fmt->ellipsis); PRINTF_APPEND_STR(passwordstr, (fmt->password == 0 ? "off" : "on")); @@ -8059,16 +8077,10 @@ _efl_canvas_textblock_all_styles_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Te return o->default_format.default_style_str; } -EOLIAN static void -_efl_canvas_textblock_cursor_add(Eo *obj, Efl_Canvas_Textblock_Data *pd EINA_UNUSED, Efl_Text_Cursor *cursor) -{ - efl_text_cursor_text_object_set(cursor, obj, obj); -} - EOLIAN static Efl_Text_Cursor * _efl_canvas_textblock_cursor_create(Eo *obj, Efl_Canvas_Textblock_Data *pd EINA_UNUSED) { - Eo* cursor = efl_add(EFL_TEXT_CURSOR_CLASS, obj); + Eo* cursor = efl_text_cursor_create(obj); efl_text_cursor_text_object_set(cursor, obj, obj); return cursor; } @@ -16781,7 +16793,7 @@ _efl_canvas_textblock_efl_text_format_text_horizontal_align_auto_type_set(Eo *ob { _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE); } - else if (type == EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_END) + else if (type == EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_OPPOSITE) { _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_END); } @@ -16799,7 +16811,7 @@ _efl_canvas_textblock_efl_text_format_text_horizontal_align_auto_type_get(const } else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_END) { - ret = EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_END; + ret = EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_OPPOSITE; } else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE) { diff --git a/src/lib/evas/gesture/efl_gesture_events.eo b/src/lib/evas/gesture/efl_gesture_events.eo index 5c907b9f3c..df0a473d0b 100644 --- a/src/lib/evas/gesture/efl_gesture_events.eo +++ b/src/lib/evas/gesture/efl_gesture_events.eo @@ -29,13 +29,13 @@ interface @beta Efl.Gesture.Events ]] gesture,momentum: Efl.Canvas.Gesture_Momentum; [[Emitted when a Momentum gesture has been detected. - A Momentum gesture consists of a quick displacement of the finger while touching the screen (or while - holding down a mouse button). + A Momentum gesture is any motion of the finger while touching the screen (or while + holding down a mouse button). This gesture is also known as swipe. ]] gesture,flick: Efl.Canvas.Gesture_Flick; [[Emitted when a Flick gesture has been detected. - A Flick gesture consists of a quick displacement of the finger while touching the screen (or while - holding down a mouse button) followed by a release before slowing down. + A Flick gesture consists of a quick motion of the finger while touching the screen (or while + holding down a mouse button) with the release occurring before slowing down. ]] gesture,zoom: Efl.Canvas.Gesture_Zoom; [[Emitted when a Zoom gesture has been detected. diff --git a/src/tests/ecore_wl2/ecore_wl2_test_display.c b/src/tests/ecore_wl2/ecore_wl2_test_display.c index 2f77d2705f..fcc560311d 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_display.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_display.c @@ -11,6 +11,12 @@ #include "ecore_wl2_suite.h" #include "ecore_wl2_tests_helpers.h" +static Ecore_Wl2_Display * +_display_setup(void) +{ + return ecore_wl2_display_create(NULL); +} + EFL_START_TEST(wl2_display_create) { Ecore_Wl2_Display *disp; @@ -185,7 +191,12 @@ EFL_START_TEST(wl2_display_input_find_by_name) disp = _display_connect(); ck_assert(disp != NULL); - input = ecore_wl2_display_input_find_by_name(disp, "default"); + /* NB: Enlightenment uses "seat0" here, but Weston uses "default" */ + if (getenv("E_START")) + input = ecore_wl2_display_input_find_by_name(disp, "seat0"); + else + input = ecore_wl2_display_input_find_by_name(disp, "default"); + ck_assert(input != NULL); } EFL_END_TEST diff --git a/src/tests/ecore_wl2/ecore_wl2_test_input.c b/src/tests/ecore_wl2/ecore_wl2_test_input.c index 98b9e9758e..db6cbf3ea5 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_input.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_input.c @@ -9,15 +9,7 @@ #include <Ecore_Wl2.h> #include "ecore_wl2_suite.h" - -static Ecore_Wl2_Display * -_display_connect(void) -{ - Ecore_Wl2_Display *disp; - - disp = ecore_wl2_display_connect(NULL); - return disp; -} +#include "ecore_wl2_tests_helpers.h" EFL_START_TEST(wl2_input_seat_get) { diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c index 611b36768c..ca843730af 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_window.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c @@ -9,19 +9,11 @@ #include <Ecore_Wl2.h> #include "ecore_wl2_suite.h" +#include "ecore_wl2_tests_helpers.h" #define WIDTH 480 #define HEIGHT 360 -static Ecore_Wl2_Display * -_display_connect(void) -{ - Ecore_Wl2_Display *disp; - - disp = ecore_wl2_display_connect(NULL); - return disp; -} - static Ecore_Wl2_Window * _window_create(Ecore_Wl2_Display *disp) { @@ -92,23 +84,6 @@ EFL_START_TEST(wl2_window_rotation) } EFL_END_TEST -EFL_START_TEST(wl2_window_output_find) -{ - Ecore_Wl2_Display *disp; - Ecore_Wl2_Window *win; - Ecore_Wl2_Output *out; - - disp = _display_connect(); - ck_assert(disp != NULL); - - win = _window_create(disp); - ck_assert(win != NULL); - - out = ecore_wl2_window_output_find(win); - ck_assert(out != NULL); -} -EFL_END_TEST - EFL_START_TEST(wl2_window_aux_hints_supported_get) { Ecore_Wl2_Display *disp; @@ -528,7 +503,6 @@ ecore_wl2_test_window(TCase *tc) tcase_add_test(tc, wl2_window_new); tcase_add_test(tc, wl2_window_surface_test); tcase_add_test(tc, wl2_window_rotation); - tcase_add_test(tc, wl2_window_output_find); if (getenv("E_START")) tcase_add_test(tc, wl2_window_aux_hints_supported_get); tcase_add_test(tc, wl2_window_display_get); diff --git a/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h b/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h index f897dc9123..257838f50c 100644 --- a/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h +++ b/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h @@ -4,21 +4,9 @@ # include <Ecore_Wl2.h> static Ecore_Wl2_Display * -_display_setup(void) -{ - Ecore_Wl2_Display *disp; - - disp = ecore_wl2_display_create(NULL); - return disp; -} - -static Ecore_Wl2_Display * _display_connect(void) { - Ecore_Wl2_Display *disp; - - disp = ecore_wl2_display_connect(NULL); - return disp; + return ecore_wl2_display_connect(NULL); } #endif diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c index 9234d68a2f..4b8dc0dbbb 100644 --- a/src/tests/elementary/efl_ui_suite.c +++ b/src/tests/elementary/efl_ui_suite.c @@ -38,6 +38,7 @@ static const Efl_Test_Case etc[] = { { "efl_ui_collection", efl_ui_test_item_container }, { "efl_ui_grid_container", efl_ui_test_grid_container }, { "efl_ui_list_container", efl_ui_test_list_container }, + { "efl_ui_collection_view", efl_ui_test_collection_view }, { "efl_ui_select_model", efl_ui_test_select_model }, { "efl_ui_view_model", efl_ui_test_view_model }, { "efl_ui_group_item", efl_ui_test_group_item }, diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h index cb83a00ce7..c63df11bfb 100644 --- a/src/tests/elementary/efl_ui_suite.h +++ b/src/tests/elementary/efl_ui_suite.h @@ -46,6 +46,7 @@ void efl_ui_test_spin_button(TCase *tc); void efl_ui_test_item_container(TCase *tc); void efl_ui_test_list_container(TCase *tc); void efl_ui_test_grid_container(TCase *tc); +void efl_ui_test_collection_view(TCase *tc); void efl_ui_test_config(TCase *tc); void efl_ui_test_popup(TCase *tc); void efl_ui_test_scroller(TCase *tc); diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c new file mode 100644 index 0000000000..d064203ffb --- /dev/null +++ b/src/tests/elementary/efl_ui_test_collection_view.c @@ -0,0 +1,158 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Efl_Ui.h> +#include "efl_ui_suite.h" + +#define NUM_ITEMS 50 + +static Efl_Model* +_make_model(Efl_Ui_Win *win) +{ + Eina_Value vi; + Efl_Generic_Model *model, *child; + unsigned int i; + + model = efl_add(EFL_GENERIC_MODEL_CLASS, win); + model = efl_add(EFL_UI_VIEW_MODEL_CLASS, model, + efl_ui_view_model_set(efl_added, model)); + eina_value_setup(&vi, EINA_VALUE_TYPE_INT); + + efl_ui_view_model_property_string_add(model, "relative", "Relative index ${child.index}", "WRONG", "WRONG"); + efl_ui_view_model_property_string_add(model, "title", "Initial index ${initial}", "WRONG", "WRONG"); + + + for (i = 0; i < (NUM_ITEMS); i++) + { + child = efl_model_child_add(model); + eina_value_set(&vi, i); + efl_model_property_set(child, "initial", &vi); + } + + eina_value_flush(&vi); + return model; +} + +static Eina_Value +_quit(Eo *obj, void *data EINA_UNUSED, const Eina_Value v) +{ + efl_loop_quit(efl_loop_get(obj), v); + return v; +} + +static Eina_Value +_children_get(Eo *obj EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v) +{ + Efl_Model *child; + Eina_Future **all; + unsigned int i, len; + + all = calloc(1 + 1, sizeof(Eina_Future*)); + if (!all) return eina_value_error_init(ENOMEM); + + EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) + { + Eina_Value *rel_val, *title_val; + char *relative, *title; + if (i != 5) continue; + rel_val = efl_model_property_get(child, "relative"); + title_val = efl_model_property_get(child, "title"); + relative = eina_value_to_string(rel_val); + title = eina_value_to_string(title_val); + + ck_assert(eina_streq(relative, "Relative index 5")); + ck_assert(eina_streq(title, "Initial index 5")); + free(relative); + free(title); + break; + } + return EINA_VALUE_EMPTY; +} + +EFL_START_TEST(test_efl_ui_collection_view_basic) +{ + Efl_Ui_Win *win; + Efl_Model *model; + Efl_Ui_List_View *lv; + Efl_Ui_Factory *fl; + Eina_Future *f; + int count_realize = 0; + int count_unrealize = 0; + + win = win_add(); + efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 100)); + + model = _make_model(win); + fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win, + efl_ui_property_bind(efl_added, "text", "title"), + efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS)); + + lv = efl_add(EFL_UI_LIST_VIEW_CLASS, win, + efl_ui_collection_view_factory_set(efl_added, fl), + efl_ui_view_model_set(efl_added, model), + efl_event_callback_add(efl_added, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, + (void*)event_callback_that_increments_an_int_when_called, &count_realize), + efl_event_callback_add(efl_added, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_UNREALIZED, + (void*)event_callback_that_increments_an_int_when_called, &count_unrealize) + ); + efl_content_set(win, lv); + + get_me_to_those_events(lv); + ck_assert_int_gt(count_realize, 0); + /* FIXME: this should eventually be eq(0) */ + ck_assert_int_gt(count_unrealize, 0); + + f = efl_model_children_slice_get(lv, 0, efl_model_children_count_get(lv)); + f = efl_future_then(lv, f, .success_type = EINA_VALUE_TYPE_ARRAY, .success = _children_get); + ecore_main_loop_iterate(); +} +EFL_END_TEST + +EFL_START_TEST(test_efl_ui_collection_view_select) +{ + Efl_Ui_Win *win; + Efl_Model *model; + Efl_Ui_List_View *lv; + Efl_Ui_Factory *fl; + Eina_Value *sel_val; + unsigned long sel = 10000; + + win = win_add(); + efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 100)); + + model = _make_model(win); + model = efl_add(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(), efl_ui_view_model_set(efl_added, model)); + fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win, + efl_ui_property_bind(efl_added, "text", "title"), + efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS)); + + lv = efl_add(EFL_UI_LIST_VIEW_CLASS, win, + efl_ui_collection_view_factory_set(efl_added, fl), + efl_ui_view_model_set(efl_added, model) + ); + efl_content_set(win, lv); + + get_me_to_those_events(lv); + + /* nothing selected yet */ + sel_val = efl_model_property_get(model, "child.selected"); + ck_assert(eina_value_type_get(sel_val) == EINA_VALUE_TYPE_ERROR); + + efl_future_then(model, efl_model_property_ready_get(model, "child.selected"), .success = _quit); + + click_object_at(lv, 50, 5); + ecore_main_loop_begin(); + + sel_val = efl_model_property_get(model, "child.selected"); + ck_assert(eina_value_type_get(sel_val) == EINA_VALUE_TYPE_ULONG); + ck_assert(eina_value_ulong_get(sel_val, &sel)); + ck_assert_int_eq(sel, 0); +} +EFL_END_TEST + +void efl_ui_test_collection_view(TCase *tc) +{ + tcase_add_test(tc, test_efl_ui_collection_view_basic); + tcase_add_test(tc, test_efl_ui_collection_view_select); +} diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c index 12d5e6e148..78259085a3 100644 --- a/src/tests/elementary/efl_ui_test_select_model.c +++ b/src/tests/elementary/efl_ui_test_select_model.c @@ -102,8 +102,11 @@ EFL_START_TEST(efl_test_select_model) model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(), efl_ui_view_model_set(efl_added, base_model)); ck_assert(!!model); - future = efl_model_property_set(model, "child.selected", eina_value_int_new(2)); + + future = efl_model_property_ready_get(model, "child.selected"); eina_future_then(future, _wait_propagate, NULL, NULL); + + efl_model_property_set(model, "child.selected", eina_value_int_new(2)); ecore_main_loop_begin(); future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model)); @@ -120,6 +123,8 @@ EFL_START_TEST(efl_test_select_model) EINA_ITERATOR_FOREACH(it, index) fail_if(*index == 2); eina_iterator_free(it); + + efl_model_property_set(model, "child.selected", eina_value_int_new(1)); } EFL_END_TEST diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build index 7c7c62fdac..c3e85d92ef 100644 --- a/src/tests/elementary/meson.build +++ b/src/tests/elementary/meson.build @@ -150,6 +150,7 @@ efl_ui_suite_src = [ 'efl_ui_test_slider.c', 'efl_ui_test_collection_common.c', 'efl_ui_test_collection.c', + 'efl_ui_test_collection_view.c', 'efl_ui_test_list_collection.c', 'efl_ui_test_grid_collection.c', 'efl_ui_test_position_manager_common.c', diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 261c12145c..b51f149174 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -4515,14 +4515,12 @@ EFL_START_TEST(efl_canvas_textblock_cursor) efl_text_cursor_line_number_set(cur_obj, 0); ck_assert_int_eq(efl_text_cursor_position_get(cur_obj), 0); - Eo * cursor1 = efl_add(EFL_TEXT_CURSOR_CLASS, txt); - pos = efl_text_cursor_position_get(cursor1); - ck_assert_int_eq(pos, -1); - efl_text_cursor_position_set(cursor1, 10); - pos = efl_text_cursor_position_get(cursor1); - ck_assert_int_eq(pos, -1); + Eo * cursor_temp = efl_duplicate(cur_obj); + ck_assert_ptr_ne(cursor_temp, NULL); + efl_del(cursor_temp); + cursor_temp = NULL; - efl_canvas_textblock_cursor_add(txt, cursor1); + Eo * cursor1 = efl_canvas_textblock_cursor_create(txt); efl_text_cursor_position_set(cursor1, 1); pos = efl_text_cursor_position_get(cursor1); ck_assert_int_eq(pos, 1); @@ -4633,13 +4631,12 @@ EFL_START_TEST(efl_canvas_textblock_cursor) ck_assert_int_eq(efl_text_cursor_position_get(cur_obj), 0); #endif - Eo *nCur = efl_add(EFL_TEXT_CURSOR_CLASS, txt), *nCur2 = efl_add(EFL_TEXT_CURSOR_CLASS, txt), *nCur3 = efl_add(EFL_TEXT_CURSOR_CLASS, txt); + Eo *nCur = efl_canvas_textblock_cursor_create(txt); + Eo *nCur2 = efl_canvas_textblock_cursor_create(txt); + Eo *nCur3 = efl_canvas_textblock_cursor_create(txt); efl_text_markup_set(txt, "Hello World<ps/>This is EFL<br/>Enlightenment"); efl_text_cursor_position_set(cur_obj, 0); - efl_text_cursor_copy(cur_obj, nCur); ck_assert_ptr_ne(nCur, NULL); - efl_text_cursor_copy(cur_obj, nCur2); - efl_text_cursor_copy(cur_obj, nCur3); ck_assert_ptr_ne(nCur2, NULL); ck_assert_ptr_ne(nCur3, NULL); @@ -4655,7 +4652,7 @@ EFL_START_TEST(efl_canvas_textblock_cursor) ck_assert(efl_text_cursor_move(nCur, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_NEXT)); ck_assert_int_lt(efl_text_cursor_compare(cur_obj, nCur), 0); ck_assert_int_gt(efl_text_cursor_compare(nCur, cur_obj), 0); - efl_text_cursor_copy(nCur, nCur2); + efl_text_cursor_position_set(nCur2, efl_text_cursor_position_get(nCur)); ck_assert_int_lt(efl_text_cursor_compare(cur_obj, nCur2), 0); ck_assert_int_gt(efl_text_cursor_compare(nCur2, cur_obj), 0); ck_assert(!efl_text_cursor_equal(nCur2, nCur3)); @@ -4896,7 +4893,7 @@ EFL_START_TEST(efl_canvas_textblock_style) // from functions fail_if(!strstr(style, "font_weight=extrabold")); - fail_if(!strstr(style, "tabstops=20")); + fail_if(!strstr(style, "tab_stops=20")); fail_if(!strstr(style, "color=rgba(144,225,53,255)")); fail_if(!strstr(style, "password=off")); efl_text_password_set(txt, EINA_TRUE); |