Commit Graph

16483 Commits

Author SHA1 Message Date
Benjamin Otte
ae1cd1b354 selector: Introduce gtk_css_selector_previous() 2012-03-02 02:17:09 +01:00
Benjamin Otte
35a0fb09ac css: Rewrite selectors
Previously we kept a Selector object for every "simple selector" (term
from CSS spec). Now we keep one for every match operation. So given the
selector
  ".a b:focus"
we will have 4 elements:
  - pseudoclass ":focus"
  - element "b"
  - match any desendant (the space)
  - class ".a"
Each of those is represented by a "selector class" which is basically
the collection of vfuncs for this selector.
2012-03-02 02:17:09 +01:00
Benjamin Otte
eb013767bb selector: Remove a misleading error message
Duplicate selectors are indeed fine and shouldn't cause errors.
You want to use them to up specificity.
2012-03-02 02:17:09 +01:00
Benjamin Otte
67d0b8195d css: Move selector parsing code into a custom function 2012-03-02 02:17:09 +01:00
John Ralls
b2a8e6ed04 Fix compile error from splitting bitmask code
GtkBitMask was typedef'd twice.
2012-03-01 16:26:38 -08:00
Matthias Clasen
6ecc1089f2 range: Use the correct size for scaling
When scaling the scroll delta, always use the 'large' dimension
of a range widget. When dx was 0, the code code accidentally
use the small dimension.
2012-03-01 16:29:01 -05:00
Carlos Garnacho
377eb396a3 scalebutton: Set GDK_SCROLL_MASK explicitly
selecting for button press/release doesn't suffice anymore to
get scroll events.
2012-03-01 16:29:01 -05:00
Carlos Garnacho
939ed582ec spinbutton: Set GDK_SCROLL_MASK explicitly
selecting for button press/release doesn't suffice anymore to
get scroll events.
2012-03-01 16:29:00 -05:00
Carlos Garnacho
2927218a26 calendar: Set GDK_SCROLL_MASK explicitly
selecting for button press/release doesn't suffice anymore to
get scroll events.
2012-03-01 16:29:00 -05:00
Carlos Garnacho
a5c394e901 menu: Handle smooth scrolling
event->scroll.delta_y will be used to scroll the menu contents,
GDK_SMOOTH_SCROLL_MASK has been set as well
2012-03-01 16:29:00 -05:00
Carlos Garnacho
f34a236814 viewport: set GDK_SMOOTH_SCROLL_MASK
This is so smooth scroll events are send/handled by the
parent GtkScrolledWindow if any.
2012-03-01 16:28:59 -05:00
Carlos Garnacho
faa1d9b8f8 treeview: set GDK_SMOOTH_SCROLL_MASK
This is so smooth scroll events are send/handled by the
parent GtkScrolledWindow if any.
2012-03-01 16:28:59 -05:00
Carlos Garnacho
76462df59f layout: set GDK_SMOOTH_SCROLL_MASK
This is so smooth scroll events are send/handled by the
parent GtkScrolledWindow if any.
2012-03-01 16:28:59 -05:00
Carlos Garnacho
7381a2788b iconview: set GDK_SMOOTH_SCROLL_MASK
This is so smooth scroll events are send/handled by the
parent GtkScrolledWindow if any.
2012-03-01 16:28:59 -05:00
Michael Natterer
2a72e7b7b8 gtk: Implement smooth scrolling in scrolledwindow/range
If delta_x/y information is provided in scroll events, use it
to modify the underlying adjustment in steps proportional to
the deltas provided.

If the child widget of a scrolledwindow doesn't set
GDK_SMOOTH_SCROLL_MASK, regular scroll events will be dispatched,
and still handled by these 2 widgets.
2012-03-01 16:28:58 -05:00
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