Commit Graph

30984 Commits

Author SHA1 Message Date
Carlos Garnacho
0e560b397e xi2: Use GDK_SOURCE_TOUCH for multitouch devices
Any device with XITouchValuatorClassInfo classes qualify as
multitouch now.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
2a106a33d1 gdk: Update touch events to latest spec 2012-02-23 11:33:11 +01:00
Carlos Garnacho
f822b18c75 Add gdk_event_get_touch_id()
Just a helper function to get the touch ID from touch events, it
returns FALSE in any other case.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
8b5c7cee59 Make touch events go through csw/widget event handling.
In GtkWidget, touch events go through the same handler
than motion events, with the difference that touch_id
will have something meaningful there.

Touch events need to be explicitly selected, so if this
is enabled, the possibility of different motion streams
with different touch IDs must be handled in some way.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
a9794ecdb4 Handle TouchBegin/End events
These are translated into GDK_TOUCH_PRESS/RELEASE GdkEvents,
which use the GdkEventButton struct, a touch_id parameter
has been added there to cope with touches.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
d53281fca1 Add initial handling of TouchMotion events.
GdkDeviceManagerXI2 now handles TouchMotion and TouchMotionUnowned
events, which are translated to GDK_TOUCH_MOTION events.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
1ef7fc654d Add touch motion event type and mask.
These events' struct is the same than GdkEventMotion, which has been
added a touch_id parameter. The gdk_event_* functions have been modified
to also handle this event type.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
f61053ae28 configure: Detect XInput 2.1 2012-02-23 11:33:10 +01:00
Carlos Garnacho
8f695e4890 gdk,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-02-23 11:33:10 +01:00
Carlos Garnacho
41f2d3d046 gtk,range: Have slider jump to the pointer coordinates on touch devices
This widget is too narrow to make touch interaction tricky enough, so
don't add the penalty of having the slider run farther from the touch
coordinates if it happens to miss the slider.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
f48fdd2b43 gtk,scrolledwindow: Ensure the view snaps back when overshooting
Instead of just stopping the acceleration source ID, check whether
it's overshooting, and let it snap back if needed after ::grab-notify
and ::button-release-event
2012-02-23 11:33:10 +01:00
Carlos Garnacho
f17b2ebd30 gtk,scrolledwindow: set slower inverse acceleration on the overshoot area
This is so snapping back is more fluid and noticeable.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
fa949146bf gtk,scrolledwindow: Improve initial velocity calculation
Velocity calculation has been refactored out of the captured motion events
handler, and also has more tolerance defore determining that a drag is actually
still.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
4072f3d17c gtk,menu: Don't popdown submenus on button release for touch devices
This is so submenus stay open as the parent menu item is pressed/released,
as the user would typically lift the finger in order to select a submenu
item.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
e0c8166fc3 gtk,settings: Deprecate gtk-touchscreen-mode
It's not used anywhere in GTK+ anymore.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
fd801d7bad gtk,range: Remove gtk-touchscreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already catter dinamically for the "don't prelight on touch devices"
usecase.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
bc4bc67226 gtk,togglebutton: Remove gtk-touchcreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already catter dinamically for the "don't prelight on touch devices"
usecase.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
f5fdbcec28 gtk,menushell: Remove gtk-touchscreen-mode usage
This usage in a keybinding signal is hardly related to touchscreens,
so just remove it.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
18d7678a81 gtk,menu: Remove gtk-touchscreen-mode from scrolling code
scrolling is handled via ::captured-event dynamically, so remove
this now unused code.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
8c1e32f7bf gtk,menu: Select the first item for touch devices
This was done through gtk-touchscreen-mode, now is handled
dynamically on the current event source device.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
be789961fa gtk,menu: Implement scrolling through ::captured-event for touch devices
This makes overflown menus scrollable via direct manipulation. Once past
the threshold, the item below the pointer is unselected and scrolling
starts.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
ad13f09122 gtk,menu: handle item selection for touch devices dynamically
Instead of using gtk-touchscreen-mode, the behavior changes depending
on the source device in use.
2012-02-23 11:33:10 +01:00
Carlos Garnacho
7e20f16acb gtk,textview: Also cancel DnD on ::grab-notify
If is about to start when the drag device is grabbed
somewhere else, unset drag start x/y so DnD doesn't
happen anyway.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
4d1c137158 xi2: Get the effective group state by ORing the XIGroupState values 2012-02-23 11:33:09 +01:00
Carlos Garnacho
e3c4b012fe gdk: Ensure that GdkPointerWindowInfo is only generated for pointers 2012-02-23 11:33:09 +01:00
Carlos Garnacho
f970c3a827 gtk: Only set widget under device on non-virtual crossing events
_gtk_widget_set_device_window() is suppose to make accounting of
the topmost widget under the device at each time, so avoid setting
it on virtual crossing events as the device is already in another
window.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
4fbc3c9cbd gtk,scrolledwindow: capture crossing events when dragging
Also, instead of connecting 2 more times to ::captured-event,
have it all go through a single handler.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
09e15499c4 gtk,scrolledwindow: Add GtkKineticScrollingFlags
gtk_scrolled_window_set_kinetic_scrolling() now takes a set of flags,
GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS makes the "capture button
press and maybe replay later" vs "let button press go through, but
trust in ::grab-broken to undo things" an opt-in, by default that
flag is set, which is the most conservative approach.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
22809ca81a gtk,scrolledwindow: Grab only after starting drag
This is so the grab doesn't break the implicit grab on the
child widget's window, which avoids that the button press and
release are possibly sent to different windows, and after the
grab was actually broken.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
c9c26acf09 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_PRESS/RELEASE are handled, and those are sent
around button press/release. 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-02-23 11:33:09 +01:00
Carlos Garnacho
cbc677986e gdk: Keep track of the last slave device used
This last slave device (stored per master) is used to fill
in the missing slave device in synthesized crossing events
not directly caused by a device event (ie. due to configure
events or grabs)
2012-02-23 11:33:09 +01:00
Carlos Garnacho
59a54eaf95 gtk,tooltips: Use the source device instead of gtk-touchscreen-mode
This makes tooltips behavior dynamic based on the interacting device.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
bcd51482a6 gtk,scrolledwindow: Clamp early overshooting when snapping back
Fixes the situation where overshooting in scrolled windows with a
small viewport could end up overshooting right to the opposite
side, and then back again indefinitely.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
220b4130ec gtk: Handle motion hints for ::captured-event
Request automatically more motion events in behalf of
the original widget if it listens to motion hints. So
the capturing widget doesn't need to handle such
implementation details.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
37329a9596 gtk,scrolledwindow: capture motions until the kinetic scrolling cancellation
If the widget which events are captured listens to motion hints, there
are situations where neither the scrolled window or the child widget
request more motions.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
ad339cb823 gtk,scrolledwindow: Unset dragging device on ::grab-notify
The child widget may still call gtk_(device_)grab_add, which left
the scrolled window in an inconsistent state.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
bd2f0fe877 gtk,scrolledwindow: Rework physics behind kinetic scrolling
The maths being used didn't resemble much about velocities or
friction/deceleration, so reimplement it in terms of velocity
vectors and decelerations, measured in pixels/ms^2.

Overshooting is also handled within the deceleration effect,
turning into a constant acceleration vector in the opposite
direction so it returns elastically within the boundaries.
2012-02-23 11:33:09 +01:00
Carlos Garnacho
a0225f9d07 gtk,scrolledwindow: Implement overshooting
An extra GdkWindow has been added, this window is the parent
of the child widget, and is the one getting resized/moved when
overshooting.

The unclamped adjustments' values are also stored in
GtkScrolledWindowPrivate as a separate value, overshooting is
pretty specific to GtkScrolledWindow and it isn't worth to
expose API in GtkAlignment for this single purpose.

This method allows GtkScrollable children to be blissfully
unaware of overshooting, as otherwise they'd have to handle
rather odd adjustment values themselves.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
c4215d7231 gtk,scrolledwindow: Add window for overshooting
This window is the child widget's parent window, and will
be the one that's moved when overshooting.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
8a3e2b748c scrolledwindow: Handle nested scrolled windows in kinetic scrolling
The innermost scrolled window always gets to capture the events, all
scrolled windows above it just let the event go through. Ideally
reaching a limit on the innermost scrolled window would propagate
the dragging up the hierarchy in order to keep following the touch
coords, although that'd involve rather evil hacks just to cater
for broken UIs.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
c41d304e7f scrolledwindow: Use event times when calculating deceleration
Using g_get_current_time() isn't going to be realistic on lagging
events.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
fe43df2235 scrolledwindow: bypass kinetic scrolling if no scrollbars are shown 2012-02-23 11:33:08 +01:00
Carlos Garnacho
c1c6cd75aa scrolledwindow: Remove priv->event_window
It looks like a leftover from pre-captured-event iterations of
the patch, it is completely unnecessary now.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
be74ffe6f0 scrolledwindow: Don't use p-a-h for the "let event go through" timeout
Just use a timeout there, the press-and-hold feedback is undesirable
here.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
4c387f0252 scrolledwindow: Enable kinetic scrolling by default 2012-02-23 11:33:08 +01:00
Carlos Garnacho
f5acae5961 scrolledwindow: add another shortcut to bypass event capture
When clicked again close to the previous button press location
(assuming it had ~0 movement), the scrolled window wil allow
the child to handle the events immediately.

This is so the user doesn't have to wait to the p-a-h timeout
in order to operate on the scrolledwindow child.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
7b7abdfc71 scrolledwindow: Only do kinetic scrolling on touch devices
This is sort of meaningless on pointer devices, besides it implies
a different input event handling on child widgets that's unnecessary
there.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
00206c1a57 scrolledwindow: Don't crash on 0-sized motion buffer 2012-02-23 11:33:08 +01:00
Carlos Garnacho
3b34cfb873 entry: Handle ::grab-notify
Store the device, and unset private fields whenever the device
is shadowed by another GTK+ grab, so popping up menus while
selecting (i.e. press-and-hold) doesn't leave it in a confused
state.
2012-02-23 11:33:08 +01:00
Carlos Garnacho
ef4bc43ce5 tests: Update testkineticscrolling to use GtkGrid 2012-02-23 11:33:08 +01:00