Commit Graph

79 Commits

Author SHA1 Message Date
Carsten Haitzler 877fde5eaa e comp wl - fix warning for uninit var
actually code path wouldn't care, but this silences a warning

@fix
2022-05-18 13:03:48 +01:00
Carsten Haitzler c9356a3f8c wl drag start - check source ptr consistently
fix CID 1403926
2019-08-06 19:11:24 +01:00
Carsten Haitzler 490e532aa3 comp wl - fix check of source mime types
we dont always assume it's there.

fix CID 1403939
2019-08-06 18:45:58 +01:00
Carsten Haitzler 33ef4bc881 e comp wl - remove dead code
listener might maybe be null, but offer - never.

fix CID 1403945
2019-08-06 18:39:48 +01:00
Mike Blumenkrantz 02ea045ca7 cancel wl selections after removing destroy listener
cancel may destroy the selection source, resulting in invalid access

==10735== Invalid write of size 8
==10735==    at 0x87C8095: wl_list_remove (wayland-util.c:56)
==10735==    by 0x2EE745: _e_comp_wl_data_device_selection_set (e_comp_wl_data.c:506)
==10735==    by 0x2EF241: _e_comp_wl_data_device_cb_selection_set (e_comp_wl_data.c:714)
==10735==    by 0x1021F037: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==10735==    by 0x1021EA99: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==10735==    by 0x87C70C0: wl_closure_invoke (connection.c:935)
==10735==    by 0x87C13C8: wl_client_connection_data (wayland-server.c:406)
==10735==    by 0x87C4483: wl_event_source_fd_dispatch (event-loop.c:90)
==10735==    by 0x87C4DE4: wl_event_loop_dispatch (event-loop.c:423)
==10735==    by 0x85AE346: _cb_create_data (ecore_wl2_display.c:399)
==10735==    by 0x946857A: _ecore_call_fd_cb (ecore_private.h:347)
==10735==    by 0x946AE51: _ecore_main_fd_handlers_call (ecore_main.c:2015)
==10735==    by 0x946B823: _ecore_main_loop_iterate_internal (ecore_main.c:2403)
==10735==    by 0x946935E: ecore_main_loop_begin (ecore_main.c:1308)
==10735==    by 0x151139: main (e_main.c:1088)
==10735==  Address 0x222ca980 is 16 bytes inside a block of size 136 free'd
==10735==    at 0x4C2CE1B: free (vg_replace_malloc.c:530)
==10735==    by 0x2F076F: e_comp_wl_clipboard_source_unref (e_comp_wl_data.c:1291)
==10735==    by 0x214C6A09: _xwayland_send_cancelled (dnd.c:149)
==10735==    by 0x2EE71D: _e_comp_wl_data_device_selection_set (e_comp_wl_data.c:504)
==10735==    by 0x2EF241: _e_comp_wl_data_device_cb_selection_set (e_comp_wl_data.c:714)
==10735==    by 0x1021F037: ffi_call_unix64 (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==10735==    by 0x1021EA99: ffi_call (in /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4)
==10735==    by 0x87C70C0: wl_closure_invoke (connection.c:935)
==10735==    by 0x87C13C8: wl_client_connection_data (wayland-server.c:406)
==10735==    by 0x87C4483: wl_event_source_fd_dispatch (event-loop.c:90)
==10735==    by 0x87C4DE4: wl_event_loop_dispatch (event-loop.c:423)
==10735==    by 0x85AE346: _cb_create_data (ecore_wl2_display.c:399)
==10735==    by 0x946857A: _ecore_call_fd_cb (ecore_private.h:347)
==10735==    by 0x946AE51: _ecore_main_fd_handlers_call (ecore_main.c:2015)
==10735==    by 0x946B823: _ecore_main_loop_iterate_internal (ecore_main.c:2403)
==10735==    by 0x946935E: ecore_main_loop_begin (ecore_main.c:1308)
==10735==    by 0x151139: main (e_main.c:1088)
==10735==  Block was alloc'd at
==10735==    at 0x4C2DC05: calloc (vg_replace_malloc.c:711)
==10735==    by 0x2F0520: e_comp_wl_clipboard_source_create (e_comp_wl_data.c:1231)
==10735==    by 0x214C71C9: _xwl_selection_notify (dnd.c:286)
==10735==    by 0x946130C: _ecore_call_handler_cb (ecore_private.h:331)
==10735==    by 0x94626BC: _ecore_event_call (ecore_events.c:629)
==10735==    by 0x946B83E: _ecore_main_loop_iterate_internal (ecore_main.c:2408)
==10735==    by 0x946935E: ecore_main_loop_begin (ecore_main.c:1308)
==10735==    by 0x151139: main (e_main.c:1088)
2017-10-20 13:40:20 -04:00
Mike Blumenkrantz 160d6b91a0 null wl clipboard+selection source pointers when destroying clipboard source
fix T6242
2017-10-20 13:40:20 -04:00
Mike Blumenkrantz b24b68df77 set null input regions for surfaces upon calling set_cursor or start_drag
these surfaces have no input region according to spec
2017-10-20 13:40:20 -04:00
Mike Blumenkrantz 04ef45f55d add special case for xwl-originating drags to set dnd actions
there are no protocol methods received for setting actions, so fill them
in from the xwl source
2017-07-28 15:44:55 -04:00
Mike Blumenkrantz def1b28174 save xwindow of x11 selection owner, not client
gtk uses non-application xwindows for managing selections, so this would always
fail when bridging selections from gtk apps
2017-07-28 15:44:55 -04:00
Mike Blumenkrantz ad56e78872 only store the compositor's own data manager resource to e_comp_wl->mgr.resource 2017-07-14 18:40:50 -04:00
Mike Blumenkrantz 4d92808e65 use kbd focus resource's client instead of "focused" client in data device 2017-07-07 16:26:28 -04:00
Mike Blumenkrantz 84e9118c9f don't reject internal wl selections based on serial value 2017-07-07 16:26:28 -04:00
Mike Blumenkrantz 9df31011c8 unset wl selection target client if that client is deleted
the frame deletion callback would trigger far too late, allowing
crashes to occur if the selection target client exited between the
time of the drop event and the selection send event
2017-05-12 12:08:37 -04:00
Mike Blumenkrantz 2c7e91d38f make e_comp_wl->ptr.x/y ints and fix usage to be consistent
sometimes these were treated as ints and sometimes wl_fixed
2017-02-24 14:15:38 -05:00
Mike Blumenkrantz 75ff919036 more correctly handle dnd completion for wl
* always send cancel when drag is !accepted
* always null e_comp_wl->drag_source
2017-02-10 17:24:13 -05:00
Mike Blumenkrantz b568e7abb1 simplify _e_comp_wl_data_device_drag_finished() slightly 2017-02-10 17:24:13 -05:00
Mike Blumenkrantz 1f7bd4b83d move wl data device focus-change handling to data device leave() fn
leave() is always called before enter(), meaning that this will handle
window1 -> window2 as well as window1 -> null
2017-02-10 17:24:13 -05:00
Mike Blumenkrantz 989b0cd096 fix selective disabling of -Wunused-parameter under clang in copied weston code
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2017-01-06 12:57:33 -05:00
Marcel Hollerbach 10b753bf75 e_dnd: move the ungrab to the object free
otherwise there are cases where the ungrabbing is not executing, and
blocking input.
2016-08-04 16:38:51 +02:00
Marcel Hollerbach 180abefc0c e_comp_wl: destroy e_drag when source disappears
Otherwise we are expecting a running dnd later, and accessing invalid
memory.
2016-08-03 11:35:47 +02:00
Marcel Hollerbach fde72ce193 e_comp_data: NULL out source once it is freed
Otherwise the pointer is removed when the next drag starts, so this
makes debugging dnd problems easier.
2016-07-13 18:09:34 +02:00
Mike Blumenkrantz 54e6da6576 only update wl dnd actions when applying focus 2016-04-21 13:55:23 -04:00
Mike Blumenkrantz aefa7d3795 always update wl dnd offer actions 2016-04-21 13:55:23 -04:00
Mike Blumenkrantz fc759b1f0c more accurately reject wl selection setting based on whether serial is invalid
copycopycopycopy
2016-04-20 12:38:08 -04:00
Mike Blumenkrantz 9dd36ff01c apply formatting rules to e_comp_wl_data.c 2016-04-19 17:38:22 -04:00
Mike Blumenkrantz bfd204be71 update wl dnd/clipboard support to v3 of protocol
this code is mostly copied from weston:
78d4bf9a3ec990dceee23fd53962a69891352a0e
9c93179023fe894e417ccd20533d72d672d976fc
b288988e831cee3deb7f8bb1a3f440c86230dd9f
4061e2b67e62d5d2a635f0b87098f331082e8145

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

ref T3455
2016-04-19 17:34:58 -04:00
Mike Blumenkrantz 33e23c7364 add copyright headers (MIT) from weston to e_comp_wl_data
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-19 17:27:17 -04:00
Derek Foreman 79a770b638 wayland: Stop E from consuming all CPU as soon as a selection is made
Clipboard fds from clients are regular files, which shouldn't be passed
to fd_handler_add.  Using the wrong add function causes epoll to return
immediately and we end up running idle handlers and burning cpu.

Reviewed-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2016-03-31 14:26:02 -04:00
Derek Foreman 6007a51f17 wayland: Don't leak a clipboard source if adding fd handler fails
Reviewed-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2016-03-31 14:25:35 -04:00
Mike Blumenkrantz 510d05d8d3 remove wl selection hacks from f0ba92d39e
https://gfycat.com/ChiefDeafeningGull
2016-03-17 15:18:48 -04:00
Chris Michael 5b8d133d76 add prototype functions for missing wl_data_source interface
As we require wayland 1.10 now, there were missing functions for the
wl_data_source interface. This patch just adds placeholders for those
missing functions until we can implement them

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-03-01 10:52:50 -05:00
Chris Michael 0275987d69 add prototype functions for missing wl_data_offer interface
As we require wayland 1.10 now, there were missing functions for
wl_data_offer interface. This patch just adds placeholders for those
missing functions until we can implement them

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-03-01 10:27:13 -05:00
Derek Foreman 3304ea7b6c Remove inappropriate usage of %m
Summary:
printf %m stringifies and prints errno.  This is actually hugely confusing
if used in error messages after failures that don't set errno.

You may get "Success", or you may get an errno that was harmless ages
ago.

Some of the functions followed by %m have only some error paths that
set errno, or make multiple system calls that can set errno
independently - knowing the errno at failure time is unlikely to be
useful in these cases.

Reviewers: devilhorns, zmike

Reviewed By: zmike

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3571
2016-01-14 12:41:47 -05:00
Chris Michael 21e6d0a145 Fix formatting
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-09 13:16:48 -05:00
Mike Blumenkrantz 3f13b6889d replace existing usage of x/wl_comp_data with corresponding globals 2015-08-13 16:05:57 -04:00
Mike Blumenkrantz 4956fe3304 delete data device resources from hash using client
fixes crash when currently-entered wl surface is destroyed
2015-08-13 14:21:56 -04:00
Chris Michael 2f1d32a081 enlightenment: Replace old comp_type conditionals
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-08-13 10:31:54 -04:00
Mike Blumenkrantz 7f3d59f6f2 init null wl mime types array when new type is offered 2015-08-12 18:42:42 -04:00
Mike Blumenkrantz ecffe370d1 convert E_Comp_Wl_Data_Source->mime_types to Eina_Array
this data struct fits the usage of the data more effectively
2015-08-12 17:39:15 -04:00
Mike Blumenkrantz 442d63d8d6 track button mask for all drags, only end drag when mask has depopulated
previously, beginning a drag with the left button, then pressing and
releasing another button would result in the drag terminating without
the original button being released
2015-08-12 15:39:42 -04:00
Mike Blumenkrantz 11e374ce13 only create fd handler for wl clipboard data source if fd is passed 2015-08-11 16:04:36 -04:00
Mike Blumenkrantz ebc6c0ee35 don't remove wl data source listener when xwl owns the selection
crash-- since xwl has no listener
2015-08-11 16:04:36 -04:00
Mike Blumenkrantz 335f9c4324 finish off x11<->wl clipboard support
a lot of this functionality is reused from dnd. basic selection owner
management in x11 and slapping bytes down a pipe to the wl client;
a bit laggy when pasting to wl clients sometimes, need to spend more time
debugging that...

 #Kansas
2015-08-10 18:59:03 -04:00
Mike Blumenkrantz 0ee67a1e52 make e_comp_wl_data_device_keyboard_focus_set() external 2015-08-10 18:59:03 -04:00
Mike Blumenkrantz 495a14ea17 make wl clipboard source create/unref external 2015-08-10 18:59:02 -04:00
Mike Blumenkrantz 0a690c7d17 don't crash in wl compositor when data resource is destroyed in multiple listeners 2015-08-10 18:59:02 -04:00
Mike Blumenkrantz bf4c5452f3 track xwl clipboard owner 2015-08-10 18:59:02 -04:00
Mike Blumenkrantz 2e000a45dc use current ecore-x time when setting selection owner for xwl dnd operations
according to icccm spec, it is not recommented to use currenttime here
2015-08-10 18:59:02 -04:00
Mike Blumenkrantz 8e211f1950 implement wl->x11 dnd operations
seems to work fine, large selection data (ref T2330) still untested
2015-08-07 21:07:34 -04:00
Mike Blumenkrantz 5bde1a8648 implement x11->wayland dnd operations
still a little rough, but the basics are functional. works by showing
the x11 compositor selection window, which has rects to exclude geometries
of xwl clients, for getting x11 xdnd events, and then manually sending
all the related client messages in order to inform the x11 client that
enlightenment is, in fact, an extremely credible xdnd drop site and not
a rogue compositor which will mangle/destroy the dnd data.

still render crashes after the operation completes, so possibly not the
most useful thing to be using now
2015-08-06 19:31:20 -04:00