Commit Graph

76 Commits

Author SHA1 Message Date
Carsten Haitzler 4ba44bd865 elm - be more robust in the face of null cnp obj and bad app code
someone decided passing a null obj to elm_cnp_selection_set from an app
is a good idea. it's not... but let's not crash 9nside efl if someone
does and instead survive and complain

@fix
2022-03-26 23:07:38 +00:00
Vincent Torri 287834b0da Fix TIFF file signature in big endian
Summary: see https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFF6.pdf page 13

Reviewers: raster, bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12258
2021-04-17 10:59:14 +01:00
Carsten Haitzler 5d058c98fd elm cnp - make matchers const and static too 2020-09-05 15:03:44 +01:00
Marcel Hollerbach f8ef50eaaa elm_cnp: adjust image type to real format
we should never say that we have image/png etc. if we do not have the
respective format. Otherwise we are just confusing the other client.

With this you can copy things from elm to thunderbird / libreoffice
writer / firefox / telegram / chromium.

Please note if you test this: Start *a new xorg session* it was
discovered that xorg clients tent to be totally confused if there was a
protocol error before, or some wrong mime type was delivered before,
thunderbird even likes to crash if this is not done.

This should at some point be extended to more image types.
2020-09-05 09:43:43 +02:00
Carsten Haitzler d54d4fb9c8 elm cnp/dnd - use right evas device enum for seat 2020-08-25 13:21:25 +01:00
Mike Blumenkrantz 0de64f2d91 elm/cnp: remove const from static function return
this makes no sense

../src/lib/elementary/elm_cnp.c:54:15: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
   54 | static inline const Elm_Sel_Format

Reviewed-by: Christopher Michael <devilhorns@comcast.net>
Differential Revision: https://phab.enlightenment.org/D11759
2020-04-27 12:03:57 -04:00
Taehyub Kim d43515d9dc elm_cnp: fix memory leaks
Summary:
In copy and paste logic, there are some memory leaks logic.
so fixed.
@fix

Reviewers: bu5hm4n, Jaehyun_Cho

Reviewed By: Jaehyun_Cho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11690
2020-04-13 15:16:05 +09:00
Marcel Hollerbach f4ed0d4f93 elm_cnp: move free call after the last usage
this is however pretty much irrelevant as only the pointer is used.
2020-03-09 17:10:39 +01:00
Marcel Hollerbach a491e95dea elm_cnp: free array when going out of scope
this was missing and indeed a memory leak.
2020-03-09 17:10:39 +01:00
Marcel Hollerbach 165f6f0ae2 rewrite efl cnp and dnd handling
the previous commits introduced a abstraction for drag in drop which can
be now used for this here. With this commit all the direct protocol
handling in efl.ui is removed, and only the ecore evas API is used.

Additionally, this lead to a giant refactor of how APIs do work. All
Efl.Ui. interfaces have been removed except Efl.Ui.Selection and
Efl.Ui.Dnd, these two have been restructored.
A small list of what is new:
- In general no function pointers are used anymore. They feel very
  uncompftable in bindings and in C. For us its a lot easier to just
listen to a event when a drop enters or leaves, there is no need to
register custom functions for that.
- Asynchronous data transphere is handled via futures, which proved to
  be more error safe.
- Formats and actions are handled as mime types / strings.
- 0 is the default seat if you do not know what else to take.
- Content is in general passes as a content container from eina, this
  also allows applications to pass custom types

The legacy dnd and cnp API is implemented based on that.
All cnp related things are in elm_cnp.c the dnd parts are in elm_dnd.c

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D11190
2020-03-08 10:59:40 +01:00
Thiep Ha e88bbaa1e3 cnp_dnd: make legacy APIs use new interfaces
Legacy APIs can uses efl_selection, efl_ui_dnd, efl_ui_dnd_container interfaces
with helper functions.
2018-01-11 17:56:24 +09:00
Jean-Philippe Andre 9cec14918c evas: Move evas_canvas.eo to legacy-only
This isn't meant to be installed. The canvas API in EO is based around
the interfaces Efl.Canvas and the widget Efl.Ui.Win. Anything else is
not EO (eg: ecore_evas, evas, ...)

Note: evas_canvas3d is the last remaining thing that is installed along
EO files, but those are all beta APIs.
2017-11-01 11:22:33 +09:00
Jean-Philippe Andre e9dffa723d win: Add Efl.Ui.Win_Inlined and remove parent2
Inlined windows are the only use case for parent2. We might as well want
to create a separate subclass for those special windows.

Ref T5322
Ref T5363
2017-08-23 11:16:45 +09:00
Carsten Haitzler b2809026bb elm cnp - check if selbuf is null or not and skip copying if null
this should fix CID 1377536
2017-07-23 18:56:43 +09:00
Mike Blumenkrantz 804ce5f514 elm_cnp: fix selections for wl windows and FAKE wins
don't use hardcoded seat names and attempt to use wl protocol for
FAKE wins
2017-07-07 15:22:24 -04:00
Mike Blumenkrantz f052a2c02f elm_cnp: use local cnp when elm_cnp owns the selection
no need to use protocol to send an app's own selection to itself
2017-07-07 15:22:24 -04:00
Mike Blumenkrantz 5ffa2e7922 elm_cnp: mark x11 selection as lost when selection is lost in event
do not pretend that a widget maintains the selection when notified that
the selection has been lost

@fix
2017-07-07 15:22:23 -04:00
Jean-Philippe Andre a173efd0a9 cnp: Fix copy & paste in inwin inside wayland
Scenario:
  ELM_DISPLAY=wl elementary_test -to "Window Inline"

Copy & paste some stuff between entries inside the inwins and
also in a standard window.
2017-06-15 17:35:44 +09:00
Jean-Philippe Andre e4d47ed3a5 cnp: Avoid CRI message about wayland in X
Test scenario:
  elementary_test -to "Window Inline"
  Click on an entry, select some text (maybe with the keyboard)

There was a CRI message inside _ecore_evas_interface_get because
ecore_evas_wayland2_window_get() was called on an X11 ecore_evas
(not wayland).

The function was supposed to return NULL here.
2017-06-15 17:35:44 +09:00
Mike Blumenkrantz a6d9d3119e elm_cnp: use correct pointer when emitting ELM_CNP_EVENT_SELECTION_CHANGED
CID ???
2017-05-22 07:00:18 -04:00
Mike Blumenkrantz 2fe7878235 wayland: move pointer-related functions to ecore_wl2_input namespace
windows do not have pointers or cursors under wayland, seats do. due to
lack of multiseat support, most components simply use the "default" seat
with these functions, but this should make the corresponding code more
easily adaptable
2017-05-19 12:41:17 -04:00
Mike Blumenkrantz f289967927 elm_cnp: add elm_cnp_clipboard_selection_has_owner()
this already existed as an internal function which was improperly namespaced

@feature
2017-05-19 12:41:16 -04:00
Mike Blumenkrantz 0b2e15db0f elm_cnp: add event for selection change
@feature
2017-05-19 12:41:16 -04:00
Mike Blumenkrantz 31f98a6d81 elm_cnp: only attempt to manage wl selections which are created by elm_cnp
use serials of the selections and events to avoid mangling external selections
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 3b51b3047f elm_cnp: don't explicitly set wl window type when starting drag
this is no longer necessary
2017-05-12 12:08:24 -04:00
Bryce Harrington 13a9a508ce elm_cnp: Fix typo
Summary:
Removes extraneous 'or' in debug message due to change from commit
27375735.

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: bu5hm4n, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4859
2017-05-08 19:04:47 +02:00
Marcel Hollerbach 2737573501 elm_cnp: fixup behaviour
On touch devices there is the normal gesture to touch on the screen and
hold until the drag operation started.

For users of a mouse there is the gesture of just click and drag the
mouse away.

This commit changes the behaviour of the start based on the device that
sent the event
2017-05-05 20:53:06 +02:00
Derek Foreman 7359f0be6e elm_cnp: allocate space for null terminator in _wl_targets_converter
strcat needs room for a string terminator.
2017-02-28 17:23:03 -06:00
Daniel Zaoui 0f915ab497 DnD/Container: fix drag during animation
If the user icons are set but animation time is set to 0, the icons are
not deleted, resulting in ghosts images in the application.
Additionally, behavior was badly handled when animation time or timeout
before drag were set to 0.

@fix
2017-02-01 11:19:04 +02:00
Cedric BAIL 8f1c071d6a eina: rename EINA_{FLT,DBL}_CMP to EINA_{FLT,DBL}_EQ. 2017-01-06 15:58:46 -08:00
Cedric BAIL a07a267145 elementary: fix float comparison warning in c&p. 2016-12-20 16:39:30 -08:00
Daniel Zaoui 819c14c86f DnD: cancel drag if mouse moves too much
In the case of an entry inside a draggable gengrid, trying to select
text was always resulting in starting a DnD operation because mouse
coordinates were not checked.

Now we check that the mouse coords don't move more than a finger size.

@fix
2016-11-10 08:26:26 +02:00
Chris Michael a0cdbc9ec2 elementary: Fix call to offer_supports_mime function
As this function was misnamed in Ecore_Wl2, update the code here to
use the proper API function.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-10-17 10:43:43 -04:00
Chris Michael a8ba4c28fb elementary: Fix potential resource leak
If we fail to allocate memory for savedtypes.types here, then the
"known" array would end up leaking. Defer creation of 'known' array
until after savedtypes.types is allocated, this way we don't leak.

Fixes CID1363216

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-26 14:01:15 -04:00
Marcel Hollerbach fcfc9959c2 elm_cnp: handle format of a drop correctly
the format can also be the result of mutliple or´ed values.
The new code now also uses the same mimetypes to format type relation
than the selection code.

This fixes dragging onto a container with multiple formats.
Spotted by ApBBB while dragging from ephoto to terminology.

This also fixes T3320
2016-09-24 19:07:22 +02:00
Marcel Hollerbach 0e0d0179c3 elm_cnp: refactor selection_get callbacks
before the format was not passed correctly, now the format is passed
correctly to the callback.

Also if a dnd operation was started while a cnp receive call was
going on (this happend because weston-editor failed to close the fd, so
EOF was never sent), then elm_cnp would behave wrong, since the
requestwidget, action, format would be different.
2016-09-23 11:15:14 +02:00
Marcel Hollerbach 57d97b4df9 elm_cnp: handle actions probebly
ecore_wl2 passes the action which should be performed, this action is
now converted and passed to the action of the elm callback.
2016-09-23 11:15:14 +02:00
Marcel Hollerbach 5884bba096 ecore_wl2: introduce offer api
This commits adds api to deal with wayland offers.
It also ports elm_cnp to use the new api.

The selection_get and dnd_drag_get calls are replaced by simply receive
data from the offer.

The Offer object is now also emitted in every Enter,Motion,Drop and
Leave event, so a potential user can prefetch data and display it.
To finish a dnd operation positiv, the user has to call the finish call
before the offer is destroyed
2016-09-23 11:15:14 +02:00
Tom Hacohen d5e321466e Efl object: Rename Eo_Event -> Efl_Event.
This is the last step of the Eo renaming efforts.
2016-08-30 13:34:10 +01:00
Tom Hacohen e65aae994e Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Tom Hacohen c662934be8 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Carsten Haitzler 4b145afcfe elm cnp windows - remove unused vars 2016-07-26 16:49:03 +09:00
Carsten Haitzler b3d40d393e elm cnp win32 - do one side at least of unix newlines to windows newln
this PARTLY addresses T3556 ... this handles our own conversion of
makrup to string then to a windows newlined string. this half. i wrote
the conversion code for the other way but it's unused as i am unsure
where exactly to plug in it. following the cnp code makes me not sure
where it goes so for now - not there, but ready to go.

to be clear. out API is unix text. utf8 strings at our api with UNIX
newlines. that is our api. that is the text we accept and produce. if
you deal with another file or interface that does not provide this
then the job of conversion is AT THAT POINT. eg elm_cnp.c has to do
this. as would file loads of text files (and saves) etc. - anything
else like forgivingly handling anything at the api level makes it
totally unclear what our api is and what should go in and come out.

to be portable we have to define what it is and the most portable
thing to do is at the api level within a process we define one and
only one format. UNIX \n format.

@fix - partial
2016-07-26 16:44:10 +09:00
Marcel Hollerbach d2926f74ff elm_cnp: use defined charset before falling back to default
the chance is very high that some glyphs are not fitting into the
default (US-ASCII) so better falling back here on specified utf8.

@ref T3972
2016-07-14 13:58:26 +02:00
Marcel Hollerbach 75bb8060b3 ecore_wl2: split of cnp_selection_data_ready and
dnd_selection_data_ready

before there was the case that both handlers are called even if just dnd
data arrived.
2016-07-11 11:02:52 +02:00
Marcel Hollerbach c300678391 ecore_wl2: buffer reading of the data
Otherwise callbacks can go out even if the selection data is not ready
to read.
2016-07-11 11:02:52 +02:00
Carsten Haitzler 4bc6ba4ff0 elm cnp - wl - fix memory leak
fix memory leak specified in CID 1357160 , 1357159 , 1357158 , 1357157
2016-07-08 16:00:29 +09:00
Jean-Philippe Andre 85d45ee9b1 elm: Fix cnp crash on WL
See D4144.

Original author: @slotus.lee

SEG_FAULT happens when the object which has selection is deleted,
and new selection is done at another object.
Reason: loss_cb is not removed when the object which has selection is deleted.
When new selection is set for new object, the loss_cb is called for deleted
object. As result, SEG_FAULT happens.
This issue was also happened in X11 (https://phab.enlightenment.org/D2763)

Test plan:
(on wayland environment) Run elementary test, open Entry, do selection,
close Entry window, open Entry one more time, do selection.
2016-07-08 14:34:26 +09:00
Artem Popov 71a0573187 Elementary: cnp - check on NULL data in elm_drag_start
Summary:
check on NULL add in wayland elm_drag_start API
@fix

Test Plan: Call elm_grag_start with data = NULL under wayland

Reviewers: zmike, NikaWhite, jpeg

Reviewed By: NikaWhite, jpeg

Subscribers: bu5hm4n, myoungwoon, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4119
2016-07-04 11:01:05 +09:00
Chris Michael dce25efef4 elementary: Fix explicit null dereference
This patch fixes an issue reported by coverity where 'type' variable
could be null and passing null to strcmp is not good ;)

Fixes Coverity CID1357147

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-30 10:59:28 -04:00