Commit Graph

60 Commits

Author SHA1 Message Date
Mike Blumenkrantz f6964f50e3 ecore-wl2: add function for accepting a single mime type
@feature
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 9f69882211 ecore-wl2: do not offer a null mime first in ecore_wl2_offer_mimes_set()
this seems to have been done to account for the case where no mimes were
passed, but sending null in this way is bad behavior for a client. the
spec indicates that null should be sent only when no mimes are accepted

@fix
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 2e5251b364 ecore-wl2: add events for changes in keymap, selection, and kbd repeat rate
@feature
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz d119fdded9 ecore-wl2: add 'cancelled' to Ecore_Wl2_Event_Data_Source_End
it's impossible to know the result of a drag operation without this
member
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 05fd3771e7 ecore-wl2: add display object to all events
this is required in order to determine which connection an event originated
from
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 4f2a8b8679 ecore-wl2: add seat id to most events
seat id is required in order to handle multiseat environments
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 37ff7b43f1 ecore-wl2: emit serials in selection-related events
these allow apps to match the serial of their selection to the related
event in order to avoid mangling selections from other components
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz d51252a69e ecore-wl2: change selection setting apis to return the serial of the request
in the case where multiple places in an app may be handling selections, this
is necessary in order to manage the selections accurately

@feature
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 5869767355 ecore-wl2: remove ERR when trying to find the focused window id
this can trigger in the case where a selection transfer occurs and
no input resource has received an enter (e.g., the window is not focused)

@fix
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 44f22a250e ecore-wl2: split data offers into selection and drag
these are distinct objects and can coexist simultaneously; a drag
source should not overwrite an existing selection source

@fix
2017-05-12 12:08:25 -04:00
Jean-Philippe Andre a33815eeef ecore wl2: Fix compilation 2017-04-21 10:08:52 +09:00
Derek Foreman f45b63edbd ecore_wl2: Don't crash when drag and drop is unsupported by compositor
Check for presence of data device manager so we don't crash if it's not
there.
2017-04-20 14:41:54 -05:00
Chris Michael 79815ea851 ecore-wl2: Fix typo in API function name
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-10-17 10:43:27 -04:00
Marcel Hollerbach 174f355446 ecore_wl2: fix array overflow
fixes CID 1363215
2016-09-26 13:17:24 +02:00
Marcel Hollerbach 203b7a8fc6 ecore_wl2: support parallel receiving of different mimetypes
The mimetypes are now populated with the event and the data.

This also fixes CID 1363217
2016-09-26 13:17:24 +02:00
Marcel Hollerbach 296446b878 ecore_wl2: fix null dereference issue
if we dont get the userdata of a offer something in the protocol went
very very bad, we should not emit there a error, just return.

Also if we are getting a null offer we should dereference the nulled out
offer object.

This fixes CID 1363214
2016-09-26 13:17:24 +02:00
Marcel Hollerbach d8e6fb7820 ecore_wl2: utilize the event window_ids
if a dnd operation enters a surface the window_id is clear, so a offer
is always specific to a window. If we have a source we try to fetch the
id from the focus/prevfocus or keyboardfocus.

This fixes dropping into a efl app which never got focus before.
2016-09-24 19:18:21 +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
Marcel Hollerbach 7d6fd10523 ecore_wl2: save action of data source in seperated field
the drag.source is only available if the drag is happing inside the same
client.

So for the case there are two efl apps (A,B) , where A started the dnd and
the B is currently entered by the dnd, then A has the data source, and B
has the offer, if B sets a action on the offer A tried to set it on a
field which does not exist there, this fixes that. It saves the action
to a undepended field.
2016-09-23 11:14:41 +02:00
Stefan Schmidt 7d443f30e2 ecore_wl2: dnd: fix leak of event resource when not used
In the else branch the allocated event is never used. Make sure we free the
resource before returning.

CID: 1357753
2016-07-19 14:52:28 +02:00
Marcel Hollerbach 67917c27fe ecore_wl2: clear out read_data and len
they are passed to the event struct, and later freed in there.
2016-07-13 17:52:46 +02:00
Chris Michael 5fc4b971dc ecore-wl2: Fix issue of misleading 'if' statement
Gcc reports that this 'if' statement is misleading due to indentation.
We should only be sending the 'finish' call if the dnd version
supports it, however we should always be sending 'destroy'

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-07-11 11:56:17 -04:00
Marcel Hollerbach f0325fc190 ecore_wl2: Make offer destroy more secure
Check if it is NULL and NULL after each destroy call
2016-07-11 11:02:52 +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 63e88bdcfa ecore_wl2: only destroy source when not needed anymore.
Otherwise we are destroying the source before getting dnd_finished or
cancled events, which is a problem.
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
Marcel Hollerbach cf5a79ea60 ecore_wl2: delay the destruction of the offer or do it in the read 2016-07-11 11:02:52 +02:00
Chris Michael 7496df08aa ecore-wl2: Fix error handling for bad fd
If we end up failing to get the fd from ecore_main_fd_handler_fd_get,
then we should just bail out of this function and try again later.

Fixes Coverity CID1357213

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-07-03 18:23:45 -04:00
Chris Michael 183a611cde ecore-wl2: Fix uninitialized variable
Coverity reports that len is used un-init here, so let's give it a
value at declaration time

Fixes Coverity CID1357214

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-07-02 07:17:23 -04:00
Chris Michael 79277d1cb4 ecore-wl2: Fix issue of passing negative number to close() and read()
We should be checking the return value of ecore_main_fd_handler_fd_get
calls as they can return a negative number...which cannot be passed to
the close() or read() functions.

Fixes Coverity CID1357152 and CID1357153

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-30 11:09:11 -04:00
Chris Michael 35f76fe8a8 ecore-wl2: Check the return value of ecore_main_fd_handler_fd_get
This patch fixes an issue where ecore_main_fd_handler_fd_get could be
returning a negative number and passing that to close() which cannot
accept negative numbers.

Fixes Coverity CID1357152

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-30 11:05:14 -04:00
Chris Michael bbdb4e5a53 ecore-wl2: Fix formatting
NB: No functional changes

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-29 13:08:26 -04:00
Marcel Hollerbach 5ce3c4a049 ecore_wl2: Fix dnd breakage when focus leaves window
Summary:
If dnd in the same window is activated, the focus goes away from the
ecore_wl2 window to the dnd window, after that focus.pointer is NULL.
After focus.pointer is NULL ev->win of all the events will be 0 which
breaks dnd-motions, drop and end.

With prev_pointer beeing the last focused window, we can simply set this
window as event window. After that dnd with jesus works perfectly.

@fix

Reviewers: devilhorns

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4093
2016-06-27 11:32:18 -04:00
Mike Blumenkrantz 37ed59474e Revert "elm cnp/Wl: Remove duplicated data receive callback"
This reverts commit f5d10f1961.

this breaks pasting into efl applications on wayland

fix T3455
2016-05-10 13:23:05 -04:00
Thiep Ha f5d10f1961 elm cnp/Wl: Remove duplicated data receive callback
If we do drag & drop and then do copy & paste, both _wl_selection_receive
and _wl_dnd_receive are called for one action (dnd or cnp). It is reduntdant.
We only need one data received callback to handle two cases dnd and cnp.
2016-05-03 17:13:47 +00:00
Thiep Ha aa0ace21d7 ecore wayland: add selection type
We have copy & paste and drag & drop selection types, but we cannot
distinguish between these two types when requesters receive data
from data ready event.
This patch adds a new enum to help selection requesters distinguish
between two selection types and have suitable actions for each type.
2016-05-03 17:13:47 +00:00
Mike Blumenkrantz 49302010f4 ecore-wl2: preserve data selection source after receiving the selection
this is copied from weston, except all the code which is supposed to be of
struct type "offer" has been renamed "source" and then reused in the same way
that weston uses "offer" in order to maximize reader confusion

deleting the source here is invalid since the selection only changes in the
corresponding callback from the wayland interface
2016-04-25 16:15:59 -04:00
Mike Blumenkrantz 7da4d8a4ae ecore-wl2: isolate regular selection requests from dnd-specific code
fix T3455
2016-04-22 11:32:08 -04:00
Mike Blumenkrantz d36c931fac ecore-wl2: more dnd v3 updates
ref d34b5958051c87fe491e358b24e9f25238fda10f

 #gladthiswasabetaapi
2016-04-21 13:58:45 -04:00
Mike Blumenkrantz 74ed3fbe74 ecore-wl2: use fd handler for receiving selection data
not sure what trac ticket was referenced here, but probably the issue was
not using ecore_main_fd_handler_file_add()
2016-04-21 13:58:45 -04:00
Mike Blumenkrantz 46666de75d ecore-wl2: return some copied code back to its original state
this will make future rebases easier
2016-04-21 13:58:45 -04:00
Mike Blumenkrantz 19239b9251 ecore-wl2: update wl dnd/clipboard support to v3 of protocol
this code is mostly copied from weston:
78d4bf9a3ec990dceee23fd53962a69891352a0e
9c93179023fe894e417ccd20533d72d672d976fc

credit to Carlos Garnacho <carlosg@gnome.org> as original author

fix T3455

@feature
2016-04-21 13:58:45 -04:00
Mike Blumenkrantz 1f6746cedb ecore-wl2: correct the name and type of some function params 2016-04-21 13:58:45 -04:00
Mike Blumenkrantz ad9ae67e46 ecore-wl(2): add copyright headers (MIT) from weston
these files were created containing code which was very obviously copied from
weston. when copying code, copyright headers must also be copied in order to
comply with licenses.
2016-04-20 08:47:01 -04:00
Derek Foreman 943f2df006 ecore_drm/ecore_wl2: logging: remove errant usage of %m
Summary:
printf %m stringifies and prints errno.  I've tried to remove its use
anywhere that the immediately preceding function might not set errno
or is a complicated function for which knowing errno doesn't really
give any useful information.

I've left a few of the drmMode calls because they're just wrappers
around ioctl, which legitimately sets errno.

@fix

Reviewers: zmike, devilhorns

Reviewed By: zmike, devilhorns

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3572
2016-01-14 13:06:02 -05:00
Chris Michael 0f49297c18 ecore-wl2: Fix dnd to function when source window and target window
are same

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-03 12:02:40 -05:00
Chris Michael a084891013 ecore-wl2: Cleanup dnd drag and selection sources when we delete an
input

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-03 12:02:40 -05:00
Chris Michael e0f7c7a648 ecore-wl2: Finish off internal dnd code to actually send events
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-03 12:02:40 -05:00
Chris Michael 26db25b5ff ecore-wl2: Add API function to clear a dnd selection
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-03 12:02:40 -05:00
Chris Michael e44f85cc3c ecore-wl2: Add API function to return if a dnd selection exists
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-03 12:02:40 -05:00