Commit Graph

4716 Commits

Author SHA1 Message Date
Matthias Clasen
3dd5e88c07 xi2: Normalize scroll deltas
XI2 provides us with an increment for each scroll valuator,
and by dividing the delta by the increment, we obtain normalized
values in some abstract 'scroll unit'.

For mouse wheels, the evdev driver reports an increment of -1,
so doing this division fixes the inverted scrolling with wheels
that we've seen recently.
2012-03-04 19:12:27 -05:00
Matthias Clasen
0e07d6589e gdk: Don't drop the emulating_pointer flag
When manually copying touch events, we must not forget the
emulating_pointer flag.
2012-03-04 11:24:51 -05:00
Bastien Nocera
f3b899fc83 x11: Simplify XI2 mods state
https://bugzilla.gnome.org/show_bug.cgi?id=671070
2012-03-04 01:12:06 -05:00
Bastien Nocera
deea79f4e4 x11: Correct GroupSwitch mask
base | latched | locked is incorrect for the group mask,
and the clamping has already been applied.

https://bugzilla.gnome.org/show_bug.cgi?id=671070
2012-03-04 01:12:06 -05:00
Matthias Clasen
88ebe2285f gdk: Emulate motion events when requested
GtkRange was using GDK_POINTER_MOTION_MASK, and it was not
getting any emulated motion events, because we only translate
from GDK_BUTTON_MOTION_MASK to GDK_POINTER_MOTION_MASK, but not
the other way around, and emulated_mask only had
GDK_BUTTON_MOTION_MASK in it. Now we put GDK_POINTER_MOTION_MASK
in emulated_mask and successfully match for windows that
have GDK_POINTER_MOTION_MASK or any of the button motion masks
selected.

This fixes range sliders not following the finger and jumping
to the last position upon release.
2012-03-02 23:33:16 -05:00
Matthias Clasen
9687ac33b8 xi2: Add some more debug output about scroll devices 2012-03-02 23:02:57 -05:00
Mikael Magnusson
1c97003664 Iconification using _NET_WM_STATE_HIDDEN hint if supported by WM
If the Window Manager supports the _NET_WM_STATE_HIDDEN, we use it to use
the _NET_WM_STATE protocol when de-iconifying windows (iconification is
unchanged, via XIconifyWindow). Additionally, we no longer interpret all
UnmapNotify events for our window as the result of iconification.

(Based on patch by Tomas Frydrych <tf@linux.intel.com>)
2012-03-02 20:36:28 +01:00
Paolo Borelli
1a75eff9a9 Annotate gdk_window_get_frame_extents
"rect" is an output parameter
2012-03-02 18:58:03 +01:00
Matthias Clasen
482f04c89c xi2: add some debug output for smooth scroll events 2012-03-02 09:57:53 -05:00
Javier Jardón
962a5d8b8a Require XInput2.h in X11 backend
Also remove support for XInput.h
2012-03-02 12:52:12 +00:00
John Ralls
d859c921c5 Quartz: Fix incompatible types in assignment
NSEvent -scrollingDeltaX and -scrollingDeltaY aren't defined before
10.7, so objc assumes that they return a pointer. Trying to cast to a
float generates a compiler error.
2012-03-01 17:00:35 -08:00
Matthias Clasen
352fdc214a Fix build with XI2.x for x < 2 2012-03-01 16:45:23 -05:00
Carlos Garnacho
013da47a07 gdk,xi2: Ensure scroll valuators are reset on window/device switch
This is in order to avoid scrolling glitches as the device causing
scrolling to happen or the Window receiving the events changes.
2012-03-01 16:29:01 -05:00
Carlos Garnacho
147cdd8465 devicemanager,xi2: Implement smooth scrolling
XInput >= 2.1 allows for implementing smooth scrolling,
reporting the different scrolling axes as valuators.
Any change in those will be reported as GdkEventScroll
events with delta_x/y information.

the older kind of scroll events is still handled, and
emulated in devices able to provide smooth scrolling,
setting _gdk_event_set_pointer_emulated() in that case.
2012-03-01 16:28:58 -05:00
Carlos Garnacho
f941c78969 devicemanager,x11: Initialize event->scroll.delta_x/y to 0 on core events 2012-03-01 16:28:58 -05:00
Michael Natterer
d0b032e3be quartz: Implement smooth scrolling
nsevent scrollingDeltaX/Y (available on OSX >= Lion) is used to
provide the smooth scrolling values. In any case, old fashioned
events are still sent, setting _gdk_event_set_pointer_emulated()
if the event contains both smooth and non-smooth values.
2012-03-01 16:28:58 -05:00
Carlos Garnacho
77cbc98044 gdk: update csw event mask filter to handle smooth scroll
Events of type GDK_SCROLL will be received if the client side window
event mask has either GDK_SCROLL_MASK or GDK_SMOOTH_SCROLL_MASK.

GDK_BUTTON_PRESS_MASK has been removed from type_masks[GDK_SCROLL]
as that bit is often set for other-than-scrolling purposes, and
yet have the window receive scroll events. In GTK+, this forces
non-smooth events bubbling, even if the widgets above want smooth
events, and legitimately set GDK_[SMOOTH_]SCROLL_MASK.
2012-03-01 16:28:57 -05:00
Carlos Garnacho
b177bd92aa gdk: Filter out either smooth or non-smooth event depending on the evmask
If a device provides both smooth and non-smooth events, the latter will be
flagged with _gdk_event_set_pointer_emulated() so the client side window
receives one or the other. If a device is only able to deliver non-smooth
events, those will be sent, so both direction/deltas may need to be handled.
2012-03-01 16:28:57 -05:00
Carlos Garnacho
4b1e16cac6 gdk: Add GDK_SMOOTH_SCROLL_MASK
By setting this event, a GdkWindow will receive scroll events
that provide delta values.
2012-03-01 16:28:57 -05:00
Michael Natterer
c41b52b4f6 gdk: transfer event->scroll.delta_x/y through csw 2012-03-01 16:28:57 -05:00
Carlos Garnacho
f47e470e58 gdk: deal with GDK_SMOOTH_SCROLL events as not having a direction
gdk_event_get_scroll_direction() will return FALSE on these, so
gdk_event_get_scroll_deltas() has to be used to retrieve dx/dy
2012-03-01 16:28:57 -05:00
Michael Natterer
0efbbc6435 gdk: Add delta_x/y to scroll events
gdk_event_get_scroll_deltas() can be used to retrieve those
values on smooth scroll events.
2012-03-01 16:28:56 -05:00
Carlos Garnacho
7b48a3c0bd gdk: Add GDK_SCROLL_SMOOTH to GdkScrollDirection
This value will be used for smooth scroll events, as they'll
express the scrolling direction in terms of dx/dy.
2012-03-01 16:28:56 -05:00
Carlos Garnacho
28e7d3c148 gdk: Get the right event window for pointer emulated events
get_event_window() just checked on GDK_TOUCH_MASK, including for emulated
pointer events, so at the very least those should also match evmasks with
no touch events whatsoever
2012-03-01 16:25:28 -05:00
Carlos Garnacho
0bb2e6f264 gdk: Set correct GdkModifierType on pointer emulated events 2012-03-01 16:25:27 -05:00
Carlos Garnacho
fcbcac0ca3 gdk: translate correctly from touch events into emulated pointer events 2012-03-01 16:25:27 -05:00
Matthias Clasen
11fdf1667c gdk: Don't treat touch events as button events
One more place where we assumed that touch events have a button
field.
2012-03-01 16:25:27 -05:00
Matthias Clasen
3880b12196 gdk: Use the last alive grab in order to get the event window
If an active grab kicks in on a different window, _gdk_display_has_device_grab()
would still find the former implicit grab for the window below the pointer, thus
sending events to an unrelated place.
2012-03-01 16:25:27 -05:00
Carlos Garnacho
9c6f71bfc7 gdk: Don't mutate pointer events to touch events just because a grab says so
If a grab with GDK_TOUCH_MASK kicks in due to a touch sequence emulating pointer
events, don't mutate the sequence into emitting touch events right away.
2012-03-01 16:25:27 -05:00
Carlos Garnacho
5942fee240 gdk: Let implicit touch grabs coexist with an implicit pointer grab
Create the backing GdkTouchGrabInfo for touches even if the pointer
emulating touch sequence is already holding an implicit grab on a
window that didn't select for touch events.
2012-03-01 16:25:26 -05:00
Carlos Garnacho
b897ba0cd8 gdk: Don't fully destroy the implicit touch grab on ::grab-broken
the backing GdkTouchGrabInfo will be needed if the overriding device
grab finishes before the touch does in order to send events back to
the implicit grab window. Instead, wait until the touch is physically
finished before removing the matching GdkTouchGrabInfo
2012-03-01 16:25:26 -05:00
Carlos Garnacho
6efe116715 gdk: Listen to touch events by default on the native window
GDK will only receive touch events when dealing with a multitouch
device, so these must be transformed to pointer events if the
client-side window receiving the event doesn't listen to touch
events, and the touch sequence the event is from does emulate
the pointer.

If a sequence emulates pointer events, it will result in a
button-press, N motions with GDK_BUTTON1_MASK set and a
button-release event, and it will deliver crossing events
as specified by the current device grab.
2012-03-01 16:25:26 -05:00
Carlos Garnacho
0a80c26cdf gdk: Only trigger motion hints machinery on motion events
Touch events have no need for it, plus the concept behind
gdk_event_request_motions() doesn't wrap around multiple
touches within a device.
2012-03-01 16:25:26 -05:00
Carlos Garnacho
2f2774b7a9 gdk: Have touch grabs behave like the implicit grab wrt crossing events
These are equivalent to an implicit grab (with !owner_events), so
if the touch leaves or enters the grab window, the other window
won't receive the corresponding counter-event.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
c72a77b04c gdk: handle implicit touch grabs
If the touch sequence happens on a window with GDK_TOUCH_MASK set,
a GdkTouchGrabInfo is created to back it up. Else a device grab is
only created if the sequence emulates the pointer.

If both a device and a touch grab are present on a window, the later
of them both is obeyed, Any grab on the device happening after a
touch grab generates grab-broken on all the windows an implicit
touch grab was going on.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
b5cfdf2db4 gdk: Add internal API to deal with touch implicit grabs
The necessary information about a touch implicit grab is stored in
GdkTouchGrabInfo structs, these are meant to be transient to the
touch sequence.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
b5de12debd gdk: Don't change window_under_pointer for pure touch events
Only touch events that emulate the pointer do change it.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
8689921b90 gdk: Generate crossing events around touch devices' press/release
Anytime a touch device interacts, the crossing events generation
will change to a touch mode where only events with mode
GDK_CROSSING_TOUCH_BEGIN/END are handled, and those are sent
around touch begin/end. Those are virtual as the master
device may still stay on the window.

Whenever there is a switch of slave device (the user starts
using another non-touch device), a crossing event with mode
GDK_CROSSING_DEVICE_SWITCH may generated if needed, and the normal
crossing event handling is resumed.
2012-03-01 16:25:21 -05:00
Matthias Clasen
e5f7725fe0 gdk: Add some debug output for touch events and devices 2012-03-01 16:25:20 -05:00
Matthias Clasen
f7b7cc22e6 xi2: Translate touch events
Translate XI_TouchBegin/Update/End to GDK_TOUCH_BEGIN/UPDATE/END
events.

At the same time,
set pointer-emulated flags on button events with XIPointerEmulated
and on touch events emulating the pointer.
2012-03-01 16:25:20 -05:00
Carlos Garnacho
7f35708cee gdk: Add touch event types and mask
This commit introduces GDK_TOUCH_BEGIN/UPDATE/END/CANCEL
and a separate GdkEventTouch struct that they use. This
is closer to the touch event API of other platforms and
matches the xi2 events closely, too.
2012-03-01 16:25:20 -05:00
Carlos Garnacho
a490d2ebda gdk: Add internal API to set "pointer emulated" flag on events
This flag will be used for non-pointer events that are emulated
from eg. touch events, or pointer events being emulated.
2012-03-01 16:25:19 -05:00
Carlos Garnacho
bc8401d1ed gdk: Add GdkEventSequence
GdkEventSequence is an opaque pointer type that is used
to identify sequences of touch events that belong together.
2012-03-01 16:25:13 -05:00
Matthias Clasen
734c9056c6 xi2: Use the new device types for touch-capable devices
Any device with a XITouchClassInfo with num_touches > 0
qualifies as multitouch.
2012-03-01 16:19:57 -05:00
Matthias Clasen
7844f935b5 gdk: Add device types for touch-capable devices
We introduce GDK_SOURCE_TOUCHSCREEN and GDK_SOURCE_TOUCHPAD
for direct and indirect touch devices, respecively. These
correspond to XIDirectTouch and XIDependentTouch in XI2.
2012-03-01 16:19:57 -05:00
Carlos Garnacho
43a38de785 configure: Detect XInput 2.2 2012-03-01 16:19:57 -05:00
Carlos Garnacho
fbb0d8e546 xi2: Add major/minor properties to XI2 device manager
This may be used to turn on/off the features that are added to
new XInput2 revisions.
2012-03-01 16:19:57 -05:00
Alexander Larsson
fd0450b4e7 Fix up rendering of non-double-buffered overlays
My previous fix for this broke the progress bar in epiphany. This fix
makes it work again, and keeps the gimp bug fixed.

Basically, whenever we do a non-double-buffered rendering we have to
flush the entire window as it might be drawn outside the double
buffering machinery.
2012-03-01 14:14:33 +01:00
Benjamin Otte
6861bb8efc x11: Mark unused variables as such
We cannot get rid of the variables because they are assigned in a macro
inside Xlib. And this causes a warning in the xlib from Fedora 17
onwards.
2012-03-01 05:32:34 +01:00
Rob Bradford
8db9ba9e43 wayland: Categorise menus, popups and combo boxes as Wayland popup windows
Once we've made them popup windows we must also implement the popup_done event
handler on the shell surface listener. The best we can currently do is to hide
the window. This will then signal up to GTK which could then deactivate the
appropriate menu (see https://bugzilla.gnome.org/show_bug.cgi?id=670881)
2012-02-27 17:15:12 +00:00