Commit Graph

31002 Commits

Author SHA1 Message Date
Carlos Garnacho
7f4156dc1b treeview: Set background on the widget's window
The widget window is usually covered by the bin_window,
this is just necessary so the parent scrolled window
picks the right color for drawing the overshoot area.
2012-02-23 13:21:34 +01:00
Carlos Garnacho
49daf22cf1 scrolledwindow: Use the child widget's window bg color for the overshoot area
This makes the overshoot area seamless, if the child plays along.
2012-02-23 13:21:34 +01:00
Carlos Garnacho
0f03962185 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-02-23 13:21:34 +01:00
Carlos Garnacho
9c5952d2d1 gdk,devicemanager: Mark touch events emulating the pointer as such 2012-02-23 13:21:34 +01:00
Carlos Garnacho
6b131275db 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-02-23 13:21:34 +01:00
Carlos Garnacho
394780b1ab 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-02-23 13:21:34 +01:00
Carlos Garnacho
fd92dd886e gtk,button: Handle touch events
Touch events don't generate crossing events themselves, so
do not rely on these to determine whether the button release
happened within the event window.
2012-02-23 13:21:34 +01:00
Carlos Garnacho
30d1b48c45 gtk,range: Don't perform a GTK+ grab
The implicit grab on priv->event_window already warrants that this
widget is the only one getting events while the button is pressed,
so don't spare the GTK+ grab here.
2012-02-23 11:33:12 +01:00
Carlos Garnacho
1f3ffa1d6e gtk: rewrite touch events wrt the window group too
Likewise to pointer events, have touch events during a device
grab with owner_events=TRUE be delivered normally as long as
the widget pertains to the same window group.
2012-02-23 11:33:12 +01:00
Carlos Garnacho
f9527c790e gdk,csw: 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, and all touches would be automatically
removed from every touch cluster.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
46ad55332a gdk,display: 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-02-23 11:33:11 +01:00
Carlos Garnacho
789e5895ff gdk,csw: Don't change window_under_pointer for pure touch events
Only touch events that emulate the pointer do change it.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
fc38d348ba gdk,xi2: set pointer emulated flags on events with XIPointerEmulated 2012-02-23 11:33:11 +01:00
Carlos Garnacho
cd90a5efe4 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-02-23 11:33:11 +01:00
Carlos Garnacho
21ed41e9f9 gdk,xi2: Set GDK_BUTTON1_MASK on touch events
GTK+ handles both touch and pointer events through the same
event handlers, so enable this modifier on touch events to
avoid much special casing.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
129f7d4366 gdk,xi2: Only enable multitouch if the server reports XI2.2
This enables multitouch-enabled GTK+ to run on older X servers.
2012-02-23 11:33:11 +01:00
Carlos Garnacho
9b4d179d63 gdk,xi2: Update to latest XInput2.2 spec 2012-02-23 11:33:11 +01:00
Carlos Garnacho
a76a953d47 gdk: Add gdk_event_get_touch_area()
If given an event coming from a touch devices,
this functions will read the MT major/minor/orientation
axes and return a cairo_region_t with the touch shape.
2012-02-23 11:33:11 +01:00
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