Commit Graph

137 Commits

Author SHA1 Message Date
Wonki Kim b376391078 wl2_input: fix a problem that occurs in case of using both pointer/touch input devices
Summary:
if wl2_input logic gets a 'touch down' event from touch device,
input->focus.touch has set and it cause the logic handles every input as touch input
from that moment at _ecore_wl2_input_mouse_move_send function.
that is the reason why the patch(410c1f9587) has written for.

however, if there are multiple touch input devices,
clearing focus.touch variable without checking any conditions causes another problem.

I mean a case such as 'touch 1 down' -> 'touch 2 down' -> 'touch 1 up' -> 'touch 2 up'
at the moment 'touch 1 up' event executed, focus.touch would be cleared,
and 'touch 2 up' and following touch events will not be executed properly at the moment.

this patch counts a number of touch devices which are grabbing to clear focus.touch at proper time.

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8787
2019-04-30 11:27:25 -04:00
Wonki Kim 410c1f9587 ecore_wl2_input: fix a way it works when it has multiple input devices
Summary:
if there are multiple input devices, especially touch and mouse type devices simultaneous.
a logic can't recognize the current input device in _ecore_wl2_input_mouse_move_send function.
because focus.touch would not be cleared even touch actions from user has finished.

This patch clears input->focus.touch if users release their finger from touch device.

Reviewers: raster, eagleeye, devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8673
2019-04-22 07:06:58 -04:00
Carsten Haitzler c695dde8c3 ecore wl2 - remove pointless sntrcpys causing warnings
again pointless:

strcpy(dest, x); -> len - strlen(x); strncpy(dest, x, len);

code put in causing new warnings. this kind of "get rid of strcpy" is
actua;;y dangerous as it's more likely a mistake is made along the way
and bugs are added. strcpy's  should be reviewed and if ok - left
as-is. doing otherwise makes the code worse, not better and raises
risk. it now also produces warnings at compile time which creates
noise we just shouldnt' have.
2019-02-14 09:31:02 +00:00
Wonki Kim 33c4041950 ecore_wl2: replace strcpy with strncpy
Summary: this patch replaces a volnerable function with a safer one.

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7920
2019-02-13 10:43:23 -05:00
Wonki Kim 3bedc63315 ecore_wl2_input: update a timestamp whenever possible
Summary:
gettimeofday function returns a accumulated timestamp since around 1970 by the way,
a argument from server looks like a system uptime based timestamp
in some distribution such as tizen.

so that this patch appends a logic that updates a timestamp
inside Ecore_Wl2_Input* whenever possible to
prevent gettimeofday function from being called.

Reviewers: #reviewers, cedric, devilhorns

Reviewed By: #reviewers, devilhorns

Subscribers: devilhorns, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7766
2019-01-29 07:06:33 -05:00
Carsten Haitzler d52709eca6 ecore wl2 - fix wl touch handler struct to set extra cb fields
sape and orient were not set, set them to NULL with fixme's
2018-11-09 11:44:00 +00:00
Marcel Hollerbach bda4565d9c ecore_wl2&elput: correctly fill the key structure
Summary: the key structure has two fields key and keyname, those should be identical to the keystructures from x. the method xkb_keysym_to_utf8 however returns different values for keys like "minus" thus only relying on xkb_keysym_name files this issue.

Reviewers: eagleeye, devilhorns

Reviewed By: eagleeye

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6520
2018-07-10 14:44:36 -04:00
Derek Foreman 78f27a3eff ecore_wl2: Replace window ids with pointers
Summary:
There's no benefit to generating ids instead of just using the
Ecore_Wl2_Window pointer in events.

This has the added benefit of working around a really nasty hash collision
bug when multiple ecore_evas engines are used at once.

ref T7053
ref T6222

@beta_break
Depends on D6521

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Maniphest Tasks: T7053, T6222

Differential Revision: https://phab.enlightenment.org/D6522
2018-07-06 10:16:21 -04:00
Derek Foreman ed60eddff5 ecore_wl2: Fix window drag mouse eventing
Summary:
When a CSD button interaction under wayland leads to a compositor action
like move or resize, we essentially "give back" that button press to the
compositor, and it never sends us a mouse up for it.

We need to internally fire a mouse up event to fix up state so the client
doesn't think the mouse is still down.  Until now we've been doing this
by setting a flag when we start a move/resize and checking it at next
pointer enter for the window.

This leads to unsolvable races and wacky bookkeeping, and runs afoul of
the fact that we're not actually guaranteed a pointer enter immediately
after a move completes.  There is absolutely no way at all on wayland to
know if a move or resize operation has completed.

So, let's just fire the mouse up immediately on start of interaction,
which is raceless.

This fixes a years old bug where dragging a window might leave a stuck
mouse up, and allow hilighting text without drag after the window drag
completes.  (elementary-test -to "text editor" with multiple windows open
exhibits this bug)
Depends on D6127

Reviewers: zmike, cedric

Reviewed By: zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6128
2018-05-08 13:26:46 -05:00
Derek Foreman f78ff5f445 ecore_wl2: Remove ecore_wl2_input_grab/ungrab
Summary:
These should never be called, so they shouldn't be API.

This kind of internal state fiddling should happen implicitly in the
API that need it.

@beta_break
Depends on D6126

Reviewers: zmike, cedric

Reviewed By: zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6127
2018-05-08 13:26:42 -05:00
Derek Foreman 77f946a92c elm_win: Remove move stop callback
Summary:
This is only fired to trigger a cursor set under wayland, but that cursor
set should be done unconditionally on mouse in.

However, mouse in was being discarded because mouse out was being deferred
when the window was "grabbed" for moving.

If instead we just let the mouse out occur as it should, the cursor
is properly updated on mouse in.
Depends on D6118

Reviewers: zmike, cedric

Reviewed By: zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6119
2018-05-08 13:25:54 -05:00
Derek Foreman 94ddefc6fb ecore_wl2: Send a mouse-up event on reentry after client initiated resize
Apparently when we initiate a client side move in ecore_wl2 we flag that
and send a mouse-up immediately on the next pointer enter.

Do the same for resize.

At some point this might need to be revisited, we should probably be
sending a "cancel" at the start of client initiated move/resize instead
of an up at the end?

Fix T6422
2018-03-20 14:30:39 -05:00
Cedric Bail 012bcff80c ecore_wl2: cleanup input code to string logic to reduce compiler warning and useless memory access. 2018-03-07 10:51:46 -08:00
Chris Michael 59a689faa4 ecore-wl2: Check for valid string before passing to strlen()
As strlen() cannot accept NULL (segfaults), we should check for valid
key, keyname, and compose strings here before passing to strlen().

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-03-07 09:50:58 -05:00
Chris Michael a1bb9b313f ecore-wl2: Reduce calls to strlen
Small patch to reduce calls to strlen when sending key events. This
patch is loosely based on Phab D5567

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-03-07 09:37:25 -05:00
Mike Blumenkrantz d555c6c903 ecore-wl2: correctly translate spacebar keyname into key events
fix T6620

@fix
2018-01-22 13:04:15 -05:00
Derek Foreman 520821e432 wayland: Reduce number of unneccessary display flushes
b48781aa6c fixed multiple bugs where the
display wasn't flushed correctly, however it was a little overzealous.

Some of the flushes were added after calls that only updated internal
state, some in internal functions in which the caller was already going
to flush, and some were after wayland protocol calls that are double
buffered anyway and won't do anything until a following commit.

Also, I've removes at least one long standing flush where the recently
added flush is in a better location than the original.
2018-01-19 12:40:40 -06:00
Mike Blumenkrantz b48781aa6c wayland: always flush client display when protocol sends are pending
in the case where a connection was not actively rendering, there was nothing
which would trigger a display flush, leading to applications potentially
deadlocking

@fix
2018-01-17 17:06:13 -05:00
Mike Blumenkrantz 91f513f77d ecore-wl2: normalize axis event values
this is value * 10 from the compositor, so /= 10 to get real value

fix T5427

@fix
2017-08-25 14:48:11 -04:00
Mike Blumenkrantz dc073c1ea3 wayland: fix num/caps lock handling in events
locks are not the same as modifiers, and the corresponding event flag must
be set based on whichever value(s) are set instead of yolo mixing and matching

@fix

ref T5737
2017-08-18 15:24:37 -04:00
Mike Blumenkrantz aae4d21b63 ecore-wl2: handle null offer drags more effectively
this is valid and refers to an offer with no types; a leave event
with no enter is a protocol error, however

fix T5770

@fix
2017-07-24 08:30:05 -04:00
Chris Michael 1e694114d8 ecore-wl2: Formatting fixes
NB: No functional changes

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-07-10 13:10:01 -04:00
Chris Michael 0c6aae1516 ecore-wl2: Add event handlers even if no data device manager exists
If we have no data device manager present, we would still like to
receive events when input devices get added or removed so these
handlers should be setup before we return from this function.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-07-10 13:02:43 -04:00
Chris Michael ff22abc4be ecore-wl2: Rename internal function
As we are in the Ecore_Wl2 library, lets use a function name that
reflects this.

NB: No functional changes

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-07-10 13:02:02 -04:00
Chris Michael 52f35fde0c ecore-wl2: Fix issue(s) of setting wrong event device
As we may have both a pointer and touch device on a given system, we
need to accurately set event->device when sending mouse move, wheel,
down, and up events. Previous code here would always try to find a
mouse device first which could potentially end up setting the wrong
event->device (if a touch device also existed).

This patch fixes the issue by comparing the window used for the event
to our focused windows (either mouse or touch) and setting the proper
event->device based on that.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-20 11:59:36 -04:00
Bryce Harrington e1fbde9e5b elput: fix sp. usefull
Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4935

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-06-05 12:04:43 -07:00
Mike Blumenkrantz c60fbea89f ecore-wl2: add null checks for xkb compose pointers
somehow these can fail to be created
2017-06-02 18:23:42 -04:00
Mike Blumenkrantz d61453be22 ecore-wl2: do not unref non-matching input device upon removal
this is how you avoid crashing

@fix
2017-06-02 18:23:42 -04:00
Mike Blumenkrantz fbe5ff0104 ecore-wl2: implement compose keys
@feature

ref T5006
2017-05-26 16:27:42 -04:00
Mike Blumenkrantz d1c35171c1 ecore-wl2: add weston copyright notice to ecore_wl2_input.c
this file contains code copied from weston
2017-05-26 16:27:42 -04:00
Mike Blumenkrantz 771d8803dd ecore-wl2: block key->string translation when appropriate
copied from libX11.

I don't understand what's going on here but this fixes input bugs such
as, e.g., holding ctrl and pressing shift affecting cursor position in
terminology

@fix
2017-05-19 13:17:31 -04:00
Mike Blumenkrantz 2b2367b6ff ecore-wl2: add copyright info to code copied from libX11
this code has been slightly modified, but it was originally taken without
attribution from libX11/src/KeyBind.c

ref 08c804f5bb

@fix
2017-05-19 13:17:30 -04:00
Mike Blumenkrantz f4ad162eef ecore-wl2: remove ecore_wl2_window_input_get()
this function does not make sense within the context of wayland and seats,
since a surface does not own and is not owned by a seat, nor is there a 1:1
association between surfaces and seats
2017-05-19 13:17:30 -04:00
Mike Blumenkrantz 7caf3b88ce ecore-wl2: add ecore_wl2_window_popup_input_set()
this is a function for explicitly setting the seat which will be used
for popup grabs

@feature
2017-05-19 12:41:17 -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 55cfc97455 wayland: send focus in/out events when receiving/losing keyboard focus
since this is typically what efl defines as "focus"

@fix
2017-05-19 12:41:17 -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 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 1a7279f72e ecore-wl2: add const to internal function param 2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 7c9e3d2dbd ecore-wl2: add some accessors for useful Ecore_Wl2_Input struct members
@feature
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
Mike Blumenkrantz 8afe0a7a6c ecore-wl2: store names for inputs and add api for retrieving name
@feature
2017-05-12 12:08:25 -04:00
Mike Blumenkrantz 6fc8ea3c4b ecore-wl2: add checks for a valid display object in ecore_wl2_input fns
no display = invalid object, so this needs checking
2017-05-12 12:08:25 -04:00
Derek Foreman e1ffb46a0e ecore_wl2: Remove wl_shell client support
We're never going to encounter a compositor without at least xdg v5
support, so remove wl_shell support.
2017-03-09 12:21:08 -06:00
Chris Michael 4d62761759 ecore-wl2: Support sending focus for wl_shell
wl_shell does not use a surface state for activation, so we still need
to send the focus in/out for that based on keyboard enter/leave.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-02-08 12:30:10 -05:00
Chris Michael 4b2188103d ecore-wl2: Don't send focus in/out events based on keyboard enter/leave
We should not be sending focus events based on keyboard behaviour, but
rather send them according to xdg shell activate status. This makes
our focus behaviour more "standards" compliant.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-02-08 11:54:07 -05:00
Chris Michael 2e0dc2a1f9 ecore-wl2: Add function to get touch device
When we are sending input events, if we have no pointer device then we
should be setting ev->dev to a touch device (as touch events are
treated as pointer events inside EFL).

NB: This allows EFL clients to get touch events in Enlightenment.
There are still some small hiccups here (can't close terminology by
pressing the 'x' in the corner, cannot scroll elm_test srollbar, etc).

Likely EFL needs to change wrt all this...perhaps adding events for
touch that are separate from pointer ?...

ref T5094

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-01-17 12:31:01 -05:00
Derek Foreman 120063ad76 ecore_wl2: Prevent use after free on input deletion
Window structs keep inputs around, so we should sweep through them
and NULL out any stale ones on a delete.
2017-01-05 13:40:31 -06:00
Derek Foreman 8328d4db89 ecore_wl2: Remove the rest of the cursor frame callback
Oops, I made a clean spot, now I need to clean up the rest of this.

ref 641dfab516
2017-01-05 13:40:31 -06:00
Derek Foreman 641dfab516 wayland: Fix cursor surface frame calls
The common code was skipping frame callback when no shell surface was
present - cursors aren't shell surfaces.

Add the frame callback to the common path and remove the bespoke callback
from the cursor code.
2017-01-03 16:40:21 -06:00