Commit Graph

16468 Commits

Author SHA1 Message Date
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
2ccf29f6b3 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 16:25:25 -05:00
Carlos Garnacho
518a579838 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 16:25:24 -05:00
Carlos Garnacho
535b4150fd 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 16:25:24 -05:00
Carlos Garnacho
0e8c2db131 settings: Deprecate gtk-touchscreen-mode
It's not used anywhere in GTK+ anymore.
2012-03-01 16:25:24 -05:00
Carlos Garnacho
6427fdb291 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 16:25:24 -05:00
Carlos Garnacho
87f6bb32ed 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 16:25:24 -05:00
Carlos Garnacho
24e9a19abe menushell: Remove gtk-touchscreen-mode usage
This usage in a keybinding signal is hardly related to touchscreens,
so just remove it.
2012-03-01 16:25:23 -05:00
Carlos Garnacho
5b08ececa2 menus: Remove gtk-touchscreen-mode from scrolling code
Scrolling is handled via ::captured-event dynamically, so remove
this now unused code.
2012-03-01 16:25:23 -05:00
Carlos Garnacho
c49fc433de 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 16:25:23 -05:00
Carlos Garnacho
47f9435e99 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 16:25:23 -05:00
Carlos Garnacho
5139617b91 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 16:25:22 -05:00
Carlos Garnacho
51189ae260 tooltips: Use the source device instead of gtk-touchscreen-mode
This makes tooltips behavior dynamic based on the interacting device.
2012-03-01 16:25:22 -05:00
Matthias Clasen
42c75d28b8 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 16:25:22 -05:00
Carlos Garcia Campos
f6393199be 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 16:25:21 -05:00
Carlos Garcia Campos
9f4bfff1b0 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 16:25:21 -05:00
Matthias Clasen
6c257040a5 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 16:25:21 -05:00
Matthias Clasen
680872815b gtk: Add a separate ::touch-event signal 2012-03-01 16:25:20 -05:00
Cosimo Cecchi
5495152e30 button: don't be active when holding the mouse button outside the bounds
GtkButton currently draws itself as active (pressed down) in case we're
pressing and holding the mouse pointer outside its bounds; this is
misleading though, since we won't activate the button unless the mouse
is released inside the button itself.
Fix this by only setting the ACTIVE state flag when the button is
actually pressed down.

https://bugzilla.gnome.org/show_bug.cgi?id=668141
2012-03-01 15:57:55 -05:00
Neil Roberts
6044dfc35b bitmask: Don't allocate memory for small bitmasks
Code taken more or less verbatim from CoglBitmask.
2012-03-01 15:10:36 +01:00
Benjamin Otte
27eb83a410 bitmask: Split bitmask code into two
This does nothing but turn all GtkBitmask functions into static inline
functions that call the gtk_allocated_bitmask_*() equivalent.

The implementation of the static functions has also been put into a
private header, to not scare people who want to see how things are
implemented.
2012-03-01 15:10:36 +01:00
Alexander Larsson
904cf36a5d bitmask: Allocate GtkBitmap data inline, not using GArray
This alone saves ~240k of GtkBitmap data after just starting up
nautilus.
2012-03-01 15:10:36 +01:00
Benjamin Otte
64425a28de bitmask: Make setters return a new value
(Actually, it's not a real 'new' value yet, but will be soon.

This is the first step to make bitmasks immutable.
2012-03-01 15:10:36 +01:00
Benjamin Otte
49571ccc30 css: Fix variable
And you'd think I'd test my code...
2012-03-01 13:46:11 +01:00
Benjamin Otte
4608278328 cssprovider: Redo styles as an array
Saves even more memory and avoids an extra copy during assigning.
2012-03-01 06:40:15 +01:00
Benjamin Otte
98f557b859 css: Fix fallout
.. from carelessly merging 85b1b9b778
2012-03-01 05:32:34 +01:00
Alexander Larsson
85b1b9b778 Don't use hashtables for storing css rule properties
This saves a lot of memory
2012-03-01 03:00:29 +01: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
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
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
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Javier Jardón
df1ff836a8 gtk/gtkapplication.c: Do not use gtk_dialog_run() 2012-02-27 17:06:11 +00:00
Paolo Borelli
f73ff748db Add a deprecation mark to draw_insertion_cursor
This function has been replaced with gtk_render_insertion_cursor, but we
forgot to mark it as deprecated.
2012-02-27 17:48:37 +01:00
Matthias Clasen
2c25bd85b8 gtk: Use versioned deprecations
This patch changes all uses of GDK_DEPRECATED(_FOR) in gtk headers
by the versioned variants, GDK_DEPRECATED_IN_3_x(_FOR). At the same
time, we add GDK_AVAILABLE_IN_3_x annotations for all API additions
in 3.2 and 3.4.
2012-02-27 07:11:43 -05:00
Matthias Clasen
939d6eabfa Correct Since: tag for gtk-application-prefer-dark-theme
This setting was available since 2.90.x, so give it a 3.0 tag.

https://bugzilla.gnome.org/show_bug.cgi?id=670832
2012-02-26 20:51:18 -05:00
Paolo Borelli
4a6658b0fa Set infobar css classes permanently
The message-type css classes must be in the widget context all the time,
not only when drawing, otherwise they are not propagated to the
children, for instance a label in the InfoBar must inherit the
color. Add a corresponding reftest.

https://bugzilla.gnome.org/show_bug.cgi?id=670555
2012-02-24 08:16:55 +01:00
Paolo Borelli
86ffa06f01 Init the InfoBar message_type to GTK_MESSAGE_OTHER
In this way the the code executed when the message_type property is set
to its default value (which is 0) gets actually run.
2012-02-24 08:13:47 +01: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
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
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