Commit Graph

30981 Commits

Author SHA1 Message Date
Carlos Garnacho
605c7e161b xi2: Handle touch events
GdkDeviceManagerXI2 now handles touch events.
TouchMotion events are translated to GDK_TOUCH_MOTION events,
TouchBegin/End events are translated to the newly introduced
GDK_TOUCH_PRESS/RELEASE events.
2012-02-24 03:24:09 -05:00
Carlos Garnacho
f16fdbc6e4 configure: Detect XInput 2.2 2012-02-24 03:24:09 -05:00
Carlos Garnacho
2dc59d153c 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-24 03:24:09 -05:00
Carlos Garnacho
936d3df7c7 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-24 03:24:08 -05:00
Carlos Garnacho
330a9bfbc3 menus: Don't popdown submenus on button release for touch devices
This is so submenus stay open as the parent menu item is
pressed/released, since the user would typically lift the
finger in order to select a submenu item.
2012-02-24 03:24:08 -05:00
Carlos Garnacho
59f7a3b5b4 settings: Deprecate gtk-touchscreen-mode
It's not used anywhere in GTK+ anymore.
2012-02-24 03:24:08 -05:00
Carlos Garnacho
bc1ee7bd0c range: Remove gtk-touchscreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already cater dynamically for the "don't prelight on touch devices"
usecase.
2012-02-24 03:24:08 -05:00
Carlos Garnacho
5b32261d5a togglebutton: Remove gtk-touchcreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already cater dynamically for the "don't prelight on touch devices"
usecase.
2012-02-24 03:24:07 -05:00
Carlos Garnacho
1d946085ec menushell: Remove gtk-touchscreen-mode usage
This usage in a keybinding signal is hardly related to touchscreens,
so just remove it.
2012-02-24 03:24:07 -05:00
Carlos Garnacho
23b9e1257b menus: Remove gtk-touchscreen-mode from scrolling code
Scrolling is handled via ::captured-event dynamically, so remove
this now unused code.
2012-02-24 03:24:07 -05:00
Carlos Garnacho
e040c8840e menus: Select the first item for touch devices
This was done through gtk-touchscreen-mode. Now it is handled
dynamically on the current event source device.
2012-02-24 03:24:07 -05:00
Carlos Garnacho
909100ef0e menus: 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-24 03:24:06 -05:00
Carlos Garnacho
b2b3154bb5 menus: 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-24 03:24:06 -05:00
Carlos Garnacho
1e7d9fb60d tooltips: Use the source device instead of gtk-touchscreen-mode
This makes tooltips behavior dynamic based on the interacting device.
2012-02-24 03:24:06 -05:00
Carlos Garnacho
b4f35b4183 scrolledwindow: Ensure the view snaps back when overshooting
Instead of just stopping the acceleration source ID, check whether
it is overshooting, and let it snap back if needed after ::grab-notify
and ::button-release-event.
2012-02-24 03:24:05 -05:00
Carlos Garnacho
bc5eacb185 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-24 03:24:05 -05:00
Carlos Garnacho
523fd1fafa 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-24 03:24:05 -05:00
Carlos Garnacho
5e2cb82209 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-24 03:24:05 -05:00
Carlos Garnacho
903fe8e892 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-24 03:24:04 -05:00
Carlos Garnacho
c64fd529c1 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-24 03:24:04 -05:00
Carlos Garnacho
1385eff197 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-24 03:24:04 -05:00
Carlos Garnacho
177c20bc6e 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-24 03:24:04 -05:00
Carlos Garnacho
193341c85d 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-24 03:24:03 -05:00
Carlos Garnacho
7f03de11ef 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-24 03:24:03 -05:00
Carlos Garnacho
6cfadef0a7 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-24 03:24:03 -05:00
Carlos Garnacho
7fb105e25e 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-24 03:24:03 -05:00
Carlos Garnacho
e5ff3129aa 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-24 03:24:02 -05:00
Carlos Garnacho
bf306a2424 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 will allow
the child to handle the events immediately.

This is so the user doesn't have to wait to the press-and-hold
timeout in order to operate on the scrolledwindow child.
2012-02-24 03:24:02 -05:00
Matthias Clasen
f6600be559 scrolledwindow: Allow selections and DND when kinetic scrolling is on
If the scrolling doesn't start after a long press, the scrolling is
cancelled and events are handled by child widgets normally.
2012-02-24 03:24:02 -05:00
Carlos Garcia Campos
66cb43da67 tests: Add new test for kinetic scrolling 2012-02-24 03:24:02 -05:00
Carlos Garcia Campos
fcf2bd816c test: Add checkbox to enable/disable kinetic scrolling in scrolled window test 2012-02-24 03:24:01 -05:00
Carlos Garcia Campos
bef9f5c6c4 scrolledwindow: Initial kinetic scrolling support
Kinetic scrolling is only done on touch devices, since it is
sort of meaningless on pointer devices, besides it implies
a different input event handling on child widgets that is
unnecessary there.
2012-02-24 03:24:01 -05:00
Carlos Garcia Campos
31cad1bb81 Add GtkWidget::captured-event signal
This patch adds a capture phase to GTK+'s event propagation
model. Events are first propagated from the toplevel (or the
grab widget, if a grab is in place) down to the target widget
using the new ::captured-event signal, and then back up, using
the existing ::event signal.

This mechanism can be used in many places where we currently
have to prevent child widgets from getting events by putting
an input-only window over them. It will also be used to implement
kinetic scrolling in subsequent patches.

http://bugzilla.gnome.org/show_bug.cgi?id=641836
2012-02-24 03:24:01 -05:00
Carlos Garnacho
e0c442a4e8 gdk: 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-24 03:24:01 -05:00
Carlos Garnacho
b5469d783c gdk: Add GDK_SOURCE_TOUCH
This device source applies to touch capable devices, most
notably touchscreens.
2012-02-24 03:24:00 -05:00
Carlos Garnacho
1c45afaf95 textview: Set background on the widget's window
The widget window is usually covered by the bin_window.
Its background color will become relevant when we introduce
kinetic scrolling with overshooting.
2012-02-23 22:29:31 -05:00
Carlos Garnacho
72f86d6bfb iconview: Set background on the widget's window
The widget window is usually covered by the bin_window.
Its background color will become relevant when we introduce
kinetic scrolling with overshooting.
2012-02-23 22:28:32 -05:00
Carlos Garnacho
3fb69a0cae treeview: Set background on the widget's window
The widget window is usually covered by the bin_window.
Its background color will become relevant when we introduce
kinetic scrolling with overshooting.
2012-02-23 22:26:52 -05:00
Matthias Clasen
ec25699f05 Clean up whitespace in _gdk_window_got_event
At the same time, fix an uninitialized warning.
2012-02-23 22:20:07 -05:00
Carlos Garnacho
c15d23ab5b gdk: Ensure that GdkPointerWindowInfo is only generated for pointers 2012-02-23 22:11:17 -05:00
Carlos Garnacho
18e4a3a4a1 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 22:02:28 -05:00
Matthias Clasen
5e67d61ff4 Fix an uninitialized variable warning 2012-02-23 20:01:06 -05:00
Matthias Clasen
e283ea80d6 GtkTimeline: un-doc-commentify
This is all private api, no need to confuse gtk-doc with
doc comments for this.
2012-02-23 17:52:05 -05:00
Carlos Garcia Campos
168ebb83be timeline: Add _gtk_timeline_get_elapsed_time()
To get the time in milliseconds since the last frame
2012-02-23 17:49:33 -05:00
Carlos Garnacho
170b391e74 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 avoid the extra GTK+ grab here.
2012-02-23 16:47:06 -05:00
Carlos Garnacho
ce23d52592 textview: Also cancel DnD on ::grab-notify
If a drag operation is about to start when the drag
device is grabbed somewhere else, unset drag start x/y,
otherwise the drag will start anyway.
2012-02-23 16:46:08 -05:00
Carlos Garnacho
3ccf4e0896 xi2: Get the effective group state by ORing the XIGroupState values 2012-02-23 16:46:00 -05:00
Carlos Garnacho
5b014bfdfb 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
that are not directly caused by a device event (ie due to
configure events or grabs).
2012-02-23 16:45:29 -05:00
Carlos Garnacho
367cc4fc0f 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 the entry in a
confused state.
2012-02-23 16:45:06 -05:00
Michael Natterer
d95b5308ea quartz: implement GdkScreen::get_monitor_workarea() 2012-02-23 15:34:46 +01:00