Commit Graph

16579 Commits

Author SHA1 Message Date
Javier Jardón
45f660ef75 Use GDK symbolic names for button numbers 2012-03-13 13:10:30 +00:00
Matthias Clasen
de115c3fd3 Avoid infinite recursion when removing a grab
https://bugzilla.gnome.org/show_bug.cgi?id=671819
2012-03-12 22:01:18 -04:00
Paolo Borelli
9ff75882c0 Explicitely mention -1 in the insert_with_values docs
-1 means "append". Spell it out like we do for ListStore docs.
2012-03-10 19:37:07 +01:00
Cosimo Cecchi
14e63a7370 scrolledwindow: take into account border/padding for junction
When the scrolled window has a frame (and the scrollbar is within the
bevel), we should take into account the CSS border/padding of the frame
and offset the scrollbars junction rendering with it.
2012-03-10 11:46:26 -05:00
Alexander Larsson
10d8c0621f win32: Fix text color on XP
Use a different base text color as the old one leads to
white on white on XP.
2012-03-09 16:43:00 +01:00
Alexander Larsson
f4a68dff88 Fix rendering of theme parts on Windows XP
It seems XP doesn't handle drawing non-alpha theme parts
on alpha destinations. We fix this by using alpha bitmaps only when
needed.

However this means any non-drawn area by the theme part is now draw
black, so we must take more care to only draw where the theme part draws,
so we find the theme part size when available.
2012-03-09 16:43:00 +01:00
Benjamin Otte
50e3f532b9 a11y: Only care about GtkOrientable::orientation
There are other widgets (like PanelToplevel) that aren't a GtkOrientable
but still have that property.
2012-03-09 13:23:05 +01:00
Benjamin Otte
5d57981184 widget: Set up signals after initializing style context
Otherwise, signals would be emitted on semi set up style context which
would then cause crashes when the signal handlers tried to use them.

https://bugzilla.gnome.org/show_bug.cgi?id=662023
2012-03-09 13:23:05 +01:00
Alexander Larsson
a253d4cfec Merge branch 'wip/cssvalue' 2012-03-08 17:33:18 +01:00
Alexander Larsson
ec65270c2c Add some more types to GtkCssValue
Seems these types were used in the parser tests, so we need to
handle them.
2012-03-08 16:49:13 +01:00
Alexander Larsson
1ceed037b2 Don't use GValue in GtkCssValue
We now have complete coverage in the GtkCssValue API for type
handling, so drop the GValue from internal storage and just create
new ones when needed.
2012-03-08 16:39:49 +01:00
Alexander Larsson
616cc5b96d Use GtkCssValue in symbolic color resolving
We now store the symbolic colors as a GtkCssValue which means that
we can reuse the color when resolving and storing the color in
the computed values in the style context.

Additionally we keep a last_resolved GtkCssValue cache in the
GtkSymbolicColor, and if resolving the color returns the same as
last time we reuse the old value. This further increases sharing
of Css Values.
2012-03-08 14:52:10 +01:00
Chun-wei Fan
4e5a8b822d gtkwidget.c: Use G_VA_COPY instead of va_copy()
va_copy() is not universally available, and we already have a G_VA_COPY
macro that emulates the behaviour of va_copy() when it's not available, or
simply calls va_copy() if it's there
2012-03-08 18:56:32 +08:00
Alexander Larsson
3cfd1d93dc Add singletons for small ints and numbers
These represents the majority of int values in use (thousands in use
in a simple app). There is no need to keep multiple instances of
these around.
2012-03-08 11:03:57 +01:00
Alexander Larsson
7603e6e473 css: Use GtkCssValues instead of GValue in the css machinery
Also, in places where we're computing a new CssValue based on an
old one, make sure that if nothing changes we're returning a reference
to the old one, rather than creating a new identical instance.
2012-03-08 11:03:57 +01:00
Alexander Larsson
0ece7a5de3 css: Add GtkCssValue, an immutable refcounted css value 2012-03-08 11:03:54 +01:00
Matthias Clasen
19e448146b colorchooser: Drop the ::response handler altogether
This makes it safe for users to destroy the dialog in response
to ::response.
2012-03-07 22:06:22 -05:00
Matthias Clasen
ad8bf6491c colorchooser: Do less in ::response
Some people destroy their widgets in ::response, so trying
to access dialog internals from the class handler that is
running afterwards has the potential to cause problems.
Instead, we can reset the ::show-editor property every
time we map the dialog.
2012-03-07 21:42:28 -05:00
Matthias Clasen
33004cb5e6 colorchooser: Fix default palette orientation
The switch from boolean to orientation failed to account
for the default palette.
2012-03-07 21:12:32 -05:00
Benjamin Otte
bea4ee0a2c css: Fix * selector to also match regions
Fixes css-match-region-matches-star.ui reftest.
2012-03-07 03:47:19 +01:00
Benjamin Otte
4d6a6be897 API: colorchooser: Use GtkOrientation for orientation
Unfortunately, this swaps the values from the previous state.
But it's definitely a nicer API.
2012-03-07 03:11:05 +01:00
Daniel Stone
134ef22a4e Add smooth-scroll to GtkTextView event mask
Without any extra supporting code, just adding GTK_SMOOTH_SCROLL_MASK to
the event mask for GtkTextView makes GEdit do the right thing and scroll
smoothly.  Lovely.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

https://bugzilla.gnome.org/show_bug.cgi?id=671488
2012-03-06 21:45:09 +01:00
Alexander Larsson
2422c44f8e Add custom va_marshallers in some places
This is a slight performance optimization in the common case.
2012-03-05 12:39:09 +01:00
Matthias Clasen
ab87579e3f scrolledwindow: Fix scroll event handling
Rewrite the code that deals with smooth scroll events to
be in terms of 'scroll units' as well.
2012-03-04 19:20:10 -05:00
Matthias Clasen
5714454a73 range: Straighten the wheel delta calculation
Scroll events report normalized deltas in terms of an abstract
'scroll unit' now, so our job is to determine a suitable scroll
unit here. Since we are changing the value of the adjustment,
the allocation of the widget does not factor into this at all.
2012-03-04 19:15:32 -05:00
Matthias Clasen
47c190a1b7 grid: Work harder for tight homogeneous allocation
When doing homogeneous allocation in the presence of
overlapping spanning children, we need to avoid uneven
line allocations, otherwise, the final homogenization
will blow up the size request of the grid.

https://bugzilla.gnome.org/show_bug.cgi?id=671170
2012-03-04 17:29:01 -05:00
Paolo Borelli
8adf311acd Free the resource file string. 2012-03-04 18:02:06 +01:00
Matthias Clasen
a986cb4a76 colorscale: Select for touch events
We use long touches to trigger the popup.
2012-03-04 11:24:51 -05:00
Matthias Clasen
7192f9668c colorplane: Select for touch events
We now use long touches to trigger the popup.
2012-03-04 11:24:51 -05:00
Matthias Clasen
ea57924dde gtk: Be more careful when ignoring touch events 2012-03-04 11:24:51 -05:00
Christian Persch
5a8dba7eac colorchooser: Allow removing the palettes again
https://bugzilla.gnome.org/show_bug.cgi?id=671057
2012-03-04 00:29:04 -05:00
Matthias Clasen
912ad3b698 Break out press-and-hold code as its own object
https://bugzilla.gnome.org/show_bug.cgi?id=671057
2012-03-04 00:29:04 -05:00
Benjamin Otte
0794143f41 iconview: Fix autoscroll
... when the iconview is not the only child in it's parent GdkWindow.
2012-03-03 21:18:12 +01:00
Benjamin Otte
861a9adbad celllayout: Remove unused include 2012-03-03 19:45:03 +01:00
Benjamin Otte
2353d60b8a types: Move GtkAdustment declaration to gtktypes.h
... and make all the headers to not include gtkadjustment.h anymore. Of
course, also include it in the source files instead.
2012-03-03 19:45:03 +01:00
Benjamin Otte
7844e8089c types: Clean up gtkwidget.h includes
In particular gtksettings.h and gtkstylecontext.h needed to be included
in lots of places now.

Also, I order the includes alphabetically in a bunch of headers.
2012-03-03 19:45:03 +01:00
Benjamin Otte
9e28aa9223 types: Move widget types into gtktypes.h 2012-03-03 19:45:03 +01:00
Benjamin Otte
29324c5131 gtk: Add gtktypes.h
So far, the files is empty.
2012-03-03 19:45:03 +01:00
Matthias Clasen
b43d00fa2a colorswatch: Support touch events
Support long press for customizing, and short press for
selecting/activating. This is simpler than the generic
press-and-hold support in the multitouch branch; we don't
display any feedback, and the timeout is currently hardcoded
to 1 second.
2012-03-03 01:48:55 -05:00
Matthias Clasen
ff37a04c96 pathbar: Fix scrolling
We need to select for scroll events on the buttons now, selecting
for button events no longer gives us scrolling as a side-effect.
2012-03-02 23:02:57 -05:00
Benjamin Otte
2d1d18b732 pathbar: Fix gcc warning 2012-03-03 04:09:28 +01:00
Cosimo Cecchi
e24fd5f463 image: handle PROP_STORAGE_TYPE in get_property()
Fallout from GtkIconHelper transition.
2012-03-02 12:48:52 -05:00
Murray Cumming
819cd055b5 GtkColorChooser: Correct the signal registration 2012-03-02 18:29:33 +01:00
Benjamin Otte
1d58bf4bef selector: Add sibling seletors
"a + b" and "a ~ b" selectors now work, provided the widget supports
siblings.
2012-03-02 02:17:10 +01:00
Benjamin Otte
89a2dc4db8 selector: Pass the sibling id around all the time
The reason for this will become apparent with the followup patches.
2012-03-02 02:17:10 +01:00
Benjamin Otte
0a5b42c4fc selector: Redo from list to array
Should save ~30% of memory
2012-03-02 02:17:09 +01:00
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
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