Commit Graph

31019 Commits

Author SHA1 Message Date
Carlos Garnacho
22c4b27fec 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 15:18:25 -05:00
Carlos Garnacho
8e9f616697 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 15:18:23 -05:00
Carlos Garnacho
07b38f4658 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 15:03:01 -05:00
Carlos Garnacho
16c6d9ce94 gdk: Don't change window_under_pointer for pure touch events
Only touch events that emulate the pointer do change it.
2012-03-01 15:03:01 -05:00
Carlos Garnacho
5d10309214 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-03-01 15:03:01 -05:00
Carlos Garnacho
f18d8370f9 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-03-01 15:03:01 -05:00
Carlos Garnacho
bfa2d55030 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-03-01 15:03:00 -05:00
Carlos Garnacho
b7fbb544dc settings: Deprecate gtk-touchscreen-mode
It's not used anywhere in GTK+ anymore.
2012-03-01 15:03:00 -05:00
Carlos Garnacho
592ae129c3 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-03-01 15:03:00 -05:00
Carlos Garnacho
cab579a11f 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-03-01 15:03:00 -05:00
Carlos Garnacho
bcf6d9d924 menushell: Remove gtk-touchscreen-mode usage
This usage in a keybinding signal is hardly related to touchscreens,
so just remove it.
2012-03-01 15:03:00 -05:00
Carlos Garnacho
8f4fd88528 menus: Remove gtk-touchscreen-mode from scrolling code
Scrolling is handled via ::captured-event dynamically, so remove
this now unused code.
2012-03-01 15:02:59 -05:00
Carlos Garnacho
cb09e7d38b 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-03-01 15:02:59 -05:00
Carlos Garnacho
e4c52a8038 menus: Implement scrolling through event capture 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-03-01 15:02:59 -05:00
Carlos Garnacho
73093655e5 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-03-01 15:02:58 -05:00
Carlos Garnacho
c569438e53 tooltips: Use the source device instead of gtk-touchscreen-mode
This makes tooltips behavior dynamic based on the interacting device.
2012-03-01 15:02:58 -05:00
Carlos Garcia Campos
0c61976c74 tests: Add new test for kinetic scrolling 2012-03-01 15:02:58 -05:00
Carlos Garcia Campos
6dc8f5b840 tests: Add checkbox to enable kinetic scrolling in scrolled window test 2012-03-01 15:02:58 -05:00
Matthias Clasen
139a27a96f viewport: select for touch events
This makes kinetic scrolling work with viewports where the
content does not otherwise select for button or touch events,
such as testscrolledwindow's label.
2012-03-01 15:02:57 -05:00
Carlos Garcia Campos
6840d3eda0 scrolledwindow: 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.

If the scrolling doesn't start after a long press, the scrolling is
cancelled and events are handled by child widgets normally.

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.

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-03-01 15:02:57 -05:00
Carlos Garnacho
4ff34b7ca3 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 15:02:57 -05:00
Carlos Garcia Campos
edebccd1ad gtk: Add a way to do event capture
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
 and then back up. The second phase is using the existing
::event signal, the new capture phase is using a private
API instead of a public signal for now.

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

We automatically request 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.

We are not making event capture part of the public API for 3.4,
which is why there is no ::captured-event signal.
2012-03-01 15:02:57 -05:00
Matthias Clasen
b411a7e9fc gtk: translate unhandled touch events to button events
We don't want to fallback for 'random' touch sequences, since
that could lead to all kinds of pairedness and other violations.
Since the X server already tells us what touch events it would
have used for emulating pointer events, we just use that information
here.
2012-03-01 15:02:56 -05:00
Matthias Clasen
a74b3356b3 gtk: Add a separate ::touch-event signal 2012-03-01 15:02:56 -05:00
Matthias Clasen
3d1550be51 gdk: Add some debug output for touch events and devices 2012-03-01 15:02:56 -05:00
Matthias Clasen
4276ff89b9 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 02:12:22 -05:00
Carlos Garnacho
2a2fe61d46 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 02:12:16 -05:00
Carlos Garnacho
5b01c7e691 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 01:34:02 -05:00
Carlos Garnacho
73fc7c7fe5 gdk: Add GdkEventSequence
GdkEventSequence is an opaque pointer type that is used
to identify sequences of touch events that belong together.
2012-03-01 01:19:24 -05:00
Matthias Clasen
d4c7234e70 xi2: Use the new device types for touch-capable devices
Any device with a XITouchClassInfo with num_touches > 0
qualifies as multitouch.
2012-02-29 22:28:19 -05:00
Matthias Clasen
f6c2d05cfe 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-02-29 22:23:00 -05:00
Carlos Garnacho
884a52fa7f configure: Detect XInput 2.2 2012-02-29 21:28:13 -05:00
Carlos Garnacho
51293f7137 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-29 21:15:25 -05:00
Cosimo Cecchi
cb316cb2a8 tests: add a test for GtkOverlay position style classes
https://bugzilla.gnome.org/show_bug.cgi?id=669342
2012-02-29 12:33:46 -05:00
Cosimo Cecchi
d1aa797be3 overlay: add left/right/top/bottom style classes to overlay children
When we're allocating children of GtkOverlay, compare their allocation
with the overlay one, and set left/right/top/bottom style classes if the
overlaid widget touches one or more of the overlay edges.

https://bugzilla.gnome.org/show_bug.cgi?id=669342
2012-02-29 12:28:24 -05:00
Cosimo Cecchi
170e8712e9 overlay: do not to set uninitialized values in the main allocation
gtk_widget_translate_coordinates() can fail in case the widget is not
realized or there's no common ancestor. Don't use the x/y values
returned by that method in that case, since their value is undefined.
2012-02-29 12:26:02 -05:00
Cosimo Cecchi
421d27c858 overlay: factor out gtk_overlay_get_main_widget_allocation
This will be used later in a subsequent commit.
2012-02-29 12:26:00 -05:00
Cosimo Cecchi
c7ad567863 scrolledwindow: draw a box in the junction between the two scrollbars
If there's a junction between the two scrollbars (i.e. they're both
visible), draw a background with a style class there, so the theme can
style it.

https://bugzilla.gnome.org/show_bug.cgi?id=669335
2012-02-29 10:25:00 -05:00
Cosimo Cecchi
1411020a8b stylecontext: add a "scrollbars-junction" style class
It will be used in the following commit.

https://bugzilla.gnome.org/show_bug.cgi?id=669335
2012-02-29 10:25:00 -05:00
Daniel Mustieles
02d69b1500 Updated Spanish translation 2012-02-29 14:11:30 +01:00
Jonh Wendell
e6f6605d0d Updated Brazilian Portuguese translation 2012-02-29 09:33:45 -03:00
Rob Bradford
7cc3eb04ec menu: Deactivate the menu if the GdkWindow is withdrawn
If the display server or GDK hides the window - fire the "deactivate" signal
to ensure that the internal state is consistent.

This patch also ensures that the "deactivate" signal will not be fired for a
menu that is not active.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=670881
2012-02-29 12:18:30 +00:00
Daniel Nylander
5badf835e9 Updated Swedish translation 2012-02-29 08:21:38 +01:00
Daniel Nylander
2b31137c65 Updated Swedish translation 2012-02-29 08:06:50 +01:00
Jonh Wendell
6b8a8b9ec4 Updated Brazilian Portuguese translation 2012-02-28 17:45:35 -03:00
Cosimo Cecchi
ab605e11bf cellrendereraccel: override get_preferred_width, not get_size
Since GtkCellRendererText moved to WFH requests, our get_size
implementation is ignored. We should override get_preferred_width
instead. This fixes the accel renderer being clipped to a wrong size
when trying to edit its shortcut.
2012-02-28 15:06:33 -05:00
Cosimo Cecchi
a77eba5de4 cellrendereraccel: override background on the event box, not the label
Since that's what renders the background. Otherwise the event box will
get the regular window background and will look bad.
2012-02-28 15:06:33 -05:00
Tommi Vainikainen
7542567553 Fix typo in Finnish translation 2012-02-28 07:39:37 +02: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
Rob Bradford
bdca0520e6 wayland: Store the device that does a grab for a window on the window
This allows us to get the device if we need to make the window a popup. This
relies on the side effect that GTK calls into GDK to take a grab before the
popup window is shown.
2012-02-27 17:15:12 +00:00