Commit Graph

17762 Commits

Author SHA1 Message Date
Benjamin Otte
6b9b925add widget: Fix initial state flags for RTL 2012-12-29 02:33:14 +01:00
Benjamin Otte
3e979d911b widget: Fix state propagation code
Previously, with STATE_FLAGS_REPLACE we would unset _all_ the state
flags on children, not just the ones that do propagate. This caused the
RTL/LTR flags to get lost.
2012-12-29 02:24:27 +01:00
Benjamin Otte
b068b18c78 menu: Huh?
What was that code supposed to achieve? Why are we unsetting flags that
might be useful?
2012-12-29 02:07:09 +01:00
Benjamin Otte
cc986fdc1c widget: Remove underscore prefix from static function 2012-12-29 02:06:51 +01:00
Benjamin Otte
b39bb4400e progressbar: Store activity position as percentage
... instead of in absolute pixels.
2012-12-29 01:00:15 +01:00
Benjamin Otte
02b440b466 progressbar: Remove activity_step from private struct
It's only used locally, so use a local variable
2012-12-29 01:00:15 +01:00
Matthias Clasen
5adecf183b Move single-include guards inside include guards
gcc has optimizations for include guards that only work
if they are outermost in the the header.
https://bugzilla.gnome.org/show_bug.cgi?id=689810
2012-12-28 09:57:56 -05:00
Matthias Clasen
6bc2a2da48 Another trivial sorting fix 2012-12-27 12:15:05 -05:00
Matthias Clasen
38963870eb Rename gtkcolorswatchaccessible.h
Call it gtkcolorswatchaccessibleprivate.h. This matches what we're
doing for non-public widget headers in gtk/.
2012-12-27 12:11:12 -05:00
Matthias Clasen
12f9b81b1e Drop separate scrollbar accessible implementation
It didn't really add anything to the range accessible implementation.
2012-12-27 12:06:23 -05:00
Matthias Clasen
d198ea6296 Install gtk-a11y.h
We add a separate gtk-a11y.h single-include header for
them. This header will work much the same as gtkx.h. It
will be installed in /usr/include/gtk-3.0/gtk, but you
have to include it separately.
2012-12-27 12:05:03 -05:00
Matthias Clasen
5fa4232404 Install a11y headers
We install the headers for the a11y implementations in
/usr/include/gtk-3.0/gtk/a11y/.
2012-12-27 12:05:02 -05:00
Matthias Clasen
c3577c66e5 Add single-include guards to a11y headers
More preparation for installing these headers.
2012-12-27 12:05:02 -05:00
Matthias Clasen
07a00d5939 Fix inter-header includes
Since we are going to install these headers soon, we need
to make their mutual includes work in the installed location
as well. Also, avoid including individual gtk headers, to
avoid trouble with single-include guards.
2012-12-27 12:04:01 -05:00
Matthias Clasen
d2944ce633 More gail removal
Rename GailMisc to GtkMiscImpl.
2012-12-27 11:27:46 -05:00
Matthias Clasen
4cd806ff0c Rename and clean up gailutil 2012-12-27 11:27:45 -05:00
Matthias Clasen
651241b685 Some renaming
Move gail.h to gtkaccessibility.h, and libgail to libgtka11y.
2012-12-27 11:27:45 -05:00
Matthias Clasen
221ac71278 Cosmetics
Replace GAIL in top comments by 'GTK+ - accessibility implementations'.
2012-12-27 11:27:44 -05:00
Matthias Clasen
e4b5e94eb9 Make accessible implementations public
This commit exposes the get_type() functions and standard
headers for accessible implementations. This makes it possible
to derive from the GTK accessible implementations without
GType magic tricks. This is necessary, because we require the
a11y type hierarchy to be parallel to the widget type hierarchy.
So, if you derive a widget and need to adjust its a11y implementation,
you have to be able to derive its accessible implementation.

This commit probably exposes more than is absolutely necessary,
it also exposes accessibles of widgets that are unlikely candidates
for deriving from.
2012-12-27 11:23:22 -05:00
Matthias Clasen
853b5e5fa2 Trivial sorting fix 2012-12-27 01:50:54 -05:00
Paolo Borelli
70a5718b15 Paint GtkFrame background correctly when there is a label 2012-12-23 16:35:55 +01:00
Benjamin Otte
308971cc2e roundedbox: Fix copy-paste error
y coordinates don't care about the right value, they want bottom.
2012-12-21 19:47:40 +01:00
Cosimo Cecchi
81fa183b79 aboutdialog: ensure the credits page uses the "view" style class
Since not every theme renders a background for a GtkViewport (and
Adwaita master doesn't), ensure the grid+viewport we use to emulate a
text view here uses the "view" style class.
2012-12-21 17:55:26 +01:00
Paolo Borelli
751a330ad8 Paint GtkFrame background
It already paints the css border, so let's make it also honor css
background. This is needed to have a box of a different color around
some widgets (e.g. latest gnome-clocks design)
2012-12-21 13:53:02 +01:00
Benjamin Otte
cf712c462d combobox: Don't special-case RTL child positions anymore
If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl)
  {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
2012-12-18 18:25:42 +01:00
Benjamin Otte
821a675013 toolbar: Don't special-case RTL toolbar child positions anymore
If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl)
  {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
2012-12-18 18:25:42 +01:00
Benjamin Otte
6f86e57c4f box: Don't special-case RTL hbox child positions anymore
If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl) {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
2012-12-18 18:25:42 +01:00
Benjamin Otte
52768ee6ec stylecontext: Deprecate direction property
...  and the functions implementing it. Also deprecate the direction
getter on GtkThemingEngine.
2012-12-18 18:25:42 +01:00
Benjamin Otte
a73cc55e02 stylecontext: Use state flags for direction
... instead of using a custom direction member.

And with that, GtkWidget doesn't need to call
gtk_style_context_set_direction() anymore.
2012-12-18 18:25:42 +01:00
Benjamin Otte
1bf3de223a widget: Set state flags for direction 2012-12-18 18:25:42 +01:00
Benjamin Otte
f239edaf9c css: Parse and print the new state flags 2012-12-18 18:25:41 +01:00
Benjamin Otte
26186c74c6 API: Add state flags for RTL and LTR
See http://www.whatwg.org/specs/web-apps/current-work/#pseudo-classes
for the rationale.
2012-12-18 18:25:41 +01:00
Matthias Clasen
f229945dab NotebookPageAccessible: Implement selectable/selected states
The automatic handling for this was removed from atk, so
we need to do it ourselves here.
2012-12-17 23:59:23 -05:00
Matthias Clasen
5bee1a994f GtkMenuItemAccessible: implement selectable/selected states
The automatic handling for this was removed in atk, so
we need to do it ourselves now.
2012-12-17 23:58:24 -05:00
Matthias Clasen
df1d331713 update_type_references: Deal with type_refs_ht being NULL
This can apparently happen, and it was breaking make check
on my system, by causing it to throw  a critical out of
g_hash_table_iter_init from here.
2012-12-17 22:45:08 -05:00
Matthias Clasen
099a2b04a2 Fix up gtk_builder_expose_object addition
It needs an AVAILABLE_IN annotation in the header, and it
needs to be added to the symbols list.
2012-12-17 22:19:46 -05:00
Michael Natterer
597dc649e1 quartz: make setting_same_owner member of GtkClipboardOwner @public
to fix the build, thanks to parafin for the patch.
(cherry picked from commit e3e055f855)
2012-12-17 22:22:21 +01:00
Benjamin Otte
5e12aafacd stylecontext: Fix gtk_style_context_set_background()
This function is just a sophisitcated optimization.

If we know the GDK window's background will be opaque, we mark it as
opaque. This is so GDK can do all the optimizations it does for opaque
windows and be fast.

This is mainly used when scrolling.

The previous code didn't get this right, in particular it didn't enforce
a transparent background when it knew the background was not opaque.
2012-12-17 17:47:20 +01:00
Benjamin Otte
f770e9ac1e menushell: Remove unused variable
Introduced in 531d0dc32a. Welcome to the
club of people not using -Werror Stéphane.
2012-12-17 17:21:07 +01:00
Stéphane Démurget
531d0dc32a gtkmenushell: Fix an endless loop on focus cycle
This is a simple fallout from sealing gtkmenushell, which only appears
when F10 or Shift-F10 is used in a submenu.

https://bugzilla.gnome.org/show_bug.cgi?id=690266
2012-12-17 16:02:54 +01:00
Michael Natterer
343f1706bd gtk: fix scrolling in modal dialogs when event_widget is insensitive
When checking for modal grabs in gtk_main_do_event(), forward
GDK_SCROLL events to event_widget, even if it is insensitive.
2012-12-14 15:53:29 +01:00
Cosimo Cecchi
17a3325b2d cssstyleproperty: remove unused variable 2012-12-13 21:54:50 -05:00
Cosimo Cecchi
3782cf77c3 a11y: fix uninitialized variables compiler warning
The code path where we update the tooltip text property doesn't set
the state and value variables, and so doesn't need to call
notify_state_change().
Return early, and move the if block at the beginning of the function for
clarity.
2012-12-13 21:52:51 -05:00
Alexander Larsson
444a92d6d8 IconHelper: Avoid warnings for non-existing stock ids
There are some registred stock ids like gtk-discards that have no icons,
and you could also pass a non-registred stock id. Both of these means
gtk_style_context_lookup_icon_set returns NULL, which causes
a critical in gtk_icon_set_render_icon_pixbuf.

We avoid this by just making these render as EMPTY.
2012-12-13 10:11:00 +01:00
Alexander Larsson
0cb714fe62 Use GTK_RESIZE_PARENT resize_mode for GtkViewport
We used to use GTK_RESIZE_QUEUE, but that is problematic for e.g
a GtkScrolledWindow with NEVER scroll policies, as size changes
in ancestors will never get propagated to the scrolled window, causing
it to not have the correct size.

This is a slight performance hit, but in practice its not bound to be
problematic. In typical UIs there is only a single "large" GtkScrolledWindow
visible at a time, so a size requeust propagating out of such a window
will only hit the smaller amount of widgetry outside the scrolled window,
and additionally all such widgets will have their size request caches
still valid.

https://bugzilla.gnome.org/show_bug.cgi?id=690099
2012-12-12 15:03:24 +01:00
Matthias Clasen
ea479e6bb9 Trivial whitespace fix 2012-12-11 21:30:40 -05:00
Alexander Larsson
1c05915f51 overlay: Fix child window position/size on realize
We don't get an automatic queue resize on realize anymore, which
was papering over this bug where we did not set the child window
size/position at realize time.
2012-12-11 15:41:50 +01:00
John Ralls
796ae50064 Fix compilation on MacOSX Tiger
NSInteger isn't defined until MacOSX Leopard, so in the 3 files that
use it, include ../gdk/quartz/gdkquartz.h which provides a typedef when
needed.
2012-12-10 16:51:31 -08:00
Juan Pablo Ugarte
a3e4fa3809 Added new function gtk_builder_expose_object() based on the original work by
Marco Diego Aurélio Mesquita on bug #447972
2012-12-10 14:53:53 -03:00
Alexander Larsson
d8fae21b1c css: Avoid looking up the GtkCssStyleProperty class a lot
Instead of constantly looking up the class we just stash it away in
class_init.
2012-12-10 14:49:51 +01:00
Alexander Larsson
a1ee2b7b82 css: Speed up name matching
We use the new g_type_get_type_registration_serial() so that we can
cache and properly invalidate the result of g_type_from_name().

This bumps the glib requirement to 2.35.3 to get the new function.

https://bugzilla.gnome.org/show_bug.cgi?id=689847
2012-12-10 12:57:10 +01:00
Alexander Larsson
089eafb468 css: Clean up tree_match implementations
A bunch of repeated code is broken out into the helper
gtk_css_selector_tree_match_previous().
2012-12-10 12:28:44 +01:00
Alexander Larsson
eb4667b6e1 css: Do get_change directly on the tree without matching first
Rather than first collecting matches and then getting the change
for them we do the change collection directly on the tree. This
is about twice as fast.
2012-12-10 12:11:02 +01:00
Alexander Larsson
03c626bb15 css: Factor out some of the position matching code 2012-12-10 12:11:02 +01:00
Mario Sanchez Prada
57e1e0de94 Add missing NULL-check in GtkEntryAccessible
Only call to atk_object_set_name if gtk_entry_get_icon_name() is not NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=689923
2012-12-09 11:52:11 +01:00
Colin Walters
549a0af12b Fix build by un-translating org.gtk.Settings.FileChooser
At the moment, gtk+ doesn't depend on intltool, which is the program
that knows how to translate schemas.  Attempting to translate them
causes a build failure, so for now, let's leave them in en_US.

https://bugzilla.gnome.org/show_bug.cgi?id=689584
2012-12-07 14:05:58 -05:00
Timothy Arceri
f1532993eb Add summary and description to "show-hidden" key
https://bugzilla.gnome.org/show_bug.cgi?id=689584
2012-12-07 11:57:45 -06:00
Cosimo Cecchi
26ea8e710a scale: render scale mark lines with separator style class
So that the theme can distinguish them from the mark text.
2012-12-07 11:41:03 -05:00
Cosimo Cecchi
b855e91f7a build: fix some GCC warnings 2012-12-07 11:35:06 -05:00
Michael Natterer
9d31a04d12 quartz: fix crash in the recent clipboard "fix", and really fix it
We must not release the GtkClipboardOwner in pasteboardChangedOwner
becaue we don't own a reference to ourselves (NSPasteboard does).
Instead, release the owner right after setting it, transferring
ownership to NSPasteboard

Also, fix repeated setting of the same owner by keeping the
owner around in GtkCLipboard, and re-use it if "user_data"
doesn't change. To avoid clipboard_unset()ting our own contents
in the process, add an ugly "setting_same_owner" boolean to
GtkClipboardOwner, set it during re-setting the same owner,
and avoid calling clipboard_unset() from pasteboardChangedOwner
if it's TRUE.
(cherry picked from commit 4a8df7a33c)
2012-12-07 12:30:15 +01:00
Jasper St. Pierre
34318b9163 gtkcssselector: Fix build
destroy vs. free strikes again
2012-12-06 17:48:15 -05:00
Jasper St. Pierre
736ccb6ce1 gtkcssselector: Don't leak the hash table
We should probably free the memory we allocate. Sounds like a winning
strategy.
2012-12-06 17:39:09 -05:00
Alexander Larsson
4ca293e006 treeview: Don't invalidate whole tree unless needed
We currently invalidate the whole tree every time the style state
changes in the tree view. The primary reason for this is to catch
default font changes as that may affect text cell renderers. But
cell renderers could *potentially* also read other style properties
(although that seems weird and unlikely).

We handle this by invalidating only when some state that affects sizes
is changed. This includes all the font properties.
2012-12-06 22:28:11 +01:00
Alexander Larsson
fd964ca178 textview: Only clear the layout in style_update if the font actually changes 2012-12-06 21:16:19 +01:00
Alexander Larsson
6dfee46cdb css: Add _gtk_css_style_property_affects_font
This checks if a style_update affects the font.
2012-12-06 21:14:02 +01:00
Alexander Larsson
e6de45964d entry: No need to reset layouts on style_updated
With pango handling changes to the PangoLayout there now is no
style changes that can affect the layout for the entry, so we don't
have to reset the layout whenever the style is updated.
2012-12-06 19:54:05 +01:00
Alexander Larsson
bf35c2f044 GtkLabel: Rely on the new pango support for context change tracking
Now that Pango tracks changes to the context automatically there is
no need to do it manually in e.g. style-updated or direction-changed,
in fact the only case we have to care about is when we re-create
the PangoContext due to a screen change, so we only have to clear
the layouts in GtkLabel in screen-changed.

This means we're not clearing all the layouts whenever the state changes,
which happens to every widget when the window is unfocused, which helps
performance a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=340066
2012-12-06 19:54:05 +01:00
Benjamin Otte
9ae9649188 stylecontext: Deprecate gtk_style_context_get_font()
This is for a very simple reason: The getter is returning a const value
and the font isn't const anymore. So we need to store the font
description somewhere but we can't reuse it as it's changing all the
time (yay animations, yay inherited values). Sucks.

So keep the hack in here but deprecate the function.
2012-12-06 02:57:19 +01:00
Benjamin Otte
82a6106920 switch: Remove hack to change text size
The same effect can now be achieved via
  .switch { font-size: smaller; }
so there is no need to hardcode things.
2012-12-06 02:57:18 +01:00
Benjamin Otte
1b1f4da5c7 gtk: Query font size directly
... instead of calling gtk_style_context_get_font() and then
pango_font_description_get_size().
2012-12-06 02:57:18 +01:00
Benjamin Otte
055b5d83d5 gtk: Use gtk_style_context_get()
... instead of soon-to-be-deprecated gtk_style_context_get_font().
2012-12-06 02:57:18 +01:00
Benjamin Otte
7747910b9d gtk: Use context's font
Instead of using gtk_style_context_get_font() in
pango_context_get_metrics(), use pango_context_get_font_description().
The context contains the font description we are about to use after all.
2012-12-06 02:57:18 +01:00
Benjamin Otte
fbbb66ae7d aboutdialog: Add text tag to get small text
This is to get rid of gtk_widget_override_font() and
gtk_style_context_get_font().

FIXME: This should probably be done by the theme somehow?
2012-12-06 02:57:18 +01:00
Benjamin Otte
732e89e4f3 stylecontext: Always recompute font
This is necessary  because values in a GtkCssComputedValues can change
now. So if the font-size is inherited or animated, the cached value will
be outdated.

Fixes the fontchooser preview not updating.
2012-12-06 02:57:18 +01:00
Jasper St. Pierre
7ee5e7af70 treemodelfilter: Make the constructor binding friendly
This means reffing the root in the set property implementation,
rather than in the constructor. We don't need to unref the root
on set, as it's a CONSTRUCT_ONLY property.

https://bugzilla.gnome.org/show_bug.cgi?id=680065
2012-12-05 13:43:19 -05:00
Alexander Larsson
cd016ef8e3 Revert "Don't queue resize for hidden widgets without a size group"
This seems to break redraw of the middle pane in glade.

This reverts commit faaae520c9.
2012-12-04 21:30:04 +01:00
Alexander Larsson
d3377e9d7a Don't unnecessarily queue resize in GtkWindow.style_updated
GtkWindow always queues a resize on style updates if there is
a grip, because it may have been the grip size style properties
that changed. However, even if it *were*, and it likely wasn't
that would not affect the windows size request, so no need
to queue a resize.
2012-12-04 21:24:24 +01:00
Alexander Larsson
faaae520c9 Don't queue resize for hidden widgets without a size group
queue_resize basically tells the parent widget that it may need
to pick a different size/layout. However, for a hidden child widget
that should never be needed. It may be that the widget is in a
sizegroup that has ignore_hidden == FALSE though, so it may
affect the size group calculations.

However, if a widget is not visible and not in a size group then
its safe to avoid the resize, as the widget will be resized on
becoming visible anyway.

This avoids a lot of size allocation for hidden things like menus
and tooltips.
2012-12-04 20:16:44 +01:00
Alexander Larsson
47714f55ee css: Avoid queue_resize in _gtk_widget_style_context_invalidated
We've already emitted style_updated, and the handler for that queues
a resize if necessary.
2012-12-04 20:16:44 +01:00
Alexander Larsson
c3e9112f7f css: Avoid allocations in gtk_css_value_array_compute
Almost all array computations lead to no changes (99% in nautilus)
so we avoid the upfront allocation and delay it until we know its
needed. This drops the allocate/free from the profile.
2012-12-04 20:16:44 +01:00
Alexander Larsson
7ec33e63c0 css: Start array allocation with a better size
All computed values will compute all normal properties at least, so
we might as well allocate these upfront, which leads to a lot less
reallocations.
2012-12-04 20:16:44 +01:00
Alexander Larsson
afc1a143a4 css: Use internal return_if_fail in some commonly called code
These are internal apis, and any external issues should have been
caught by checks at public API points. We use the internal checks
here because these checks show up in a non-neglible way on profiles.
2012-12-04 20:16:44 +01:00
Alexander Larsson
5833b8495e Add internal versions of g_return_[val_]_if_fail
These are only enabled on debug=yes, so not by default
in released tarballs.
2012-12-04 20:16:44 +01:00
Alexander Larsson
c1e9d46c64 css: Return 0 as change for the GtkSettingsStyleProvider 2012-12-04 19:56:18 +01:00
Michael Natterer
f08fc12741 Bug 626499 - GtkClipboard unnotified on change of OS X pasteboard owner
pasteboardChangedOwner is not called as reliably as we'd want to get it,
so keep track of [pasteboard changeCount] and drop clipboard ownership
when a change happened. Also better unset the clipboard content redundantly
in a few places rather than missing one, and reorder the code in
gtk_clipboard_set_contents() so that the new aggressive unsetting
won't unset the clipboard under our feet when we call
[pasteboard declareTypes].
(cherry picked from commit f2b74db5dc)
2012-12-04 14:42:08 +01:00
Pierre-Yves Luyten
c74d79bb55 Ensure GtkColorButton has a dialog when adding a palette
https://bugzilla.gnome.org/show_bug.cgi?id=132333
2012-12-03 23:46:18 +01:00
Kalev Lember
907447c72d gtkroundedbox: Fix a compiler warning
Use the correct enum type.
2012-12-02 19:47:54 +01:00
Benjamin Otte
1460487635 css: Fix order of enum
We switched around the order in gtkcssenumvalue.h, we need to switch
this order, too. Otherwise the parsing code will go bonkers.
2012-12-01 18:01:39 +01:00
Benjamin Otte
1688403ae6 cssvalue: Fix the scaling factors for 'smaller' and 'larger'
They were reversed. Looks like a bad case of copy/paste failure.
2012-12-01 16:27:45 +01:00
Benjamin Otte
5942099f00 cssvalue: Parse font sizes properly
As the last CSS property, font-size now is a proper number (when it's
not a keyword).
2012-12-01 16:27:45 +01:00
Benjamin Otte
891a4ab347 cssvalue: Change order of values
This is necessary so that the (rather stupid) parsing code doesn't parse
"small" and then is happy when it should instead parse "smaller".
2012-12-01 16:27:45 +01:00
Benjamin Otte
a23bc88557 css: Fix dependencies for font lookup
'larger' and 'smaller' depend on the parent value. D'oh.
2012-12-01 16:27:28 +01:00
Kalev Lember
1a61e1ea23 gtkliststore: Add explicit braces to avoid dangling else
Otherwise the following else becomes attached to the wrong if.
2012-12-01 14:02:50 +01:00
Benjamin Otte
0d9d576172 css: Add more features to font-size code
We now support the keywords (like xx-small, medium, larger, smaller...)
and I've changed the default value to be "medium".

This required some shuffling of the "get default font size" code. But
all is well now.
2012-12-01 14:00:24 +01:00
Benjamin Otte
1dd3ee6b59 css: Move default font handling
The default font is no longer handled like a custom style sheet that
overrides everything, but as the initial value. This is the same
behavior as in web browsers.

And it allows the theme to actually use the 'font-family' and
'font-size' properties. Of course, a well behaved theme will respect the
setting as much as possible and for example use relative font sizes
(which aren't yet supported, but will be soon).
2012-12-01 01:49:06 +01:00
Benjamin Otte
3ff7f1fd43 style: Add _gtk_style_provider_private_get_settings()
This gives a GtkSettings object for resolving system-dependant things -
like the default font family and font size.
No code does this yet, but we have an API.

Only GtkSettings implements this.
2012-12-01 01:24:12 +01:00
Benjamin Otte
41f8ba3c35 settings: Implement StyleProvider interface without StyleProperties
I want to deprecate GtkStyleProperties.
2012-12-01 00:56:12 +01:00
Benjamin Otte
fe61e6b3fe settings: Never override some font properties
According to the CSS specification, everything but font-size and
font-family are defined by CSS. So we don't override them anymore.
2012-12-01 00:18:01 +01:00
Benjamin Otte
be53513954 API: Deprecate functions to register custom CSS properties
We should slowly transition code to using the GTK-provided CSS. So here
we go.
2012-11-30 22:45:20 +01:00
Benjamin Otte
fc67f0d4f8 stylecontext: Remove unused private functions 2012-11-30 22:41:22 +01:00
Benjamin Otte
0c12a6ffcb cssstyleproperty: Don't mark border width properties as NO_RESIZE
I was to overeager when marking properties in
66d22f101d apparently.
2012-11-30 20:41:58 +01:00
Benjamin Otte
35362337ec widget: Optimize away unndeeded redraws
If only styles were updated that don't require resizes, don't queue one.
2012-11-30 20:40:18 +01:00
Benjamin Otte
8560ff88cd styleproperty: Add _gtk_css_style_property_changes_affect_size()
This gives fast access to the question of wether a style update requires
a resize.
2012-11-30 20:37:46 +01:00
Benjamin Otte
e0586e3680 stylecontext: Expose a function to get at the current changes 2012-11-30 20:36:57 +01:00
Benjamin Otte
66d22f101d styleproperty: Mark properties as not needing resizes 2012-11-30 20:10:23 +01:00
Benjamin Otte
a5770cef36 styleproperty: Add an affects-size property
This property will be used to avoid gtk_widget_queue_resize() calls in
favor of gtk_widget_queue_draw().
2012-11-30 20:10:23 +01:00
Benjamin Otte
4ccb8e5d33 stylecontext: Pass a bitmask to the changed values 2012-11-30 20:10:23 +01:00
Alexander Larsson
3c279b1492 icon cache: Fix double free
The symbolic icon cache code free crashed with a double free
due to a missing ->next in the loop.
2012-11-30 16:19:13 +01:00
Michael Natterer
9eea724e3b gtk: convert keyvals to unicode before committing to the imcontext
(cherry picked from commit 1eb0d98d73)
2012-11-30 15:10:51 +01:00
Michael Natterer
f619f91a8f gtk: add more OSX special casing for the deadacute and deaddoubleacute keys
So " plus foo prduces foo-with-diaereses and ' plus c produces
c-with-cedilla.
(cherry picked from commit c0102b3089)
2012-11-30 15:09:46 +01:00
Alexander Larsson
3c421db473 css: Allocate the css tree in a single chunk
This gives us several advantages:

* Smaller struct on 64bit (32bit indexes vs 64bit pointers)
* Less overhead for allocation
* Less fragmentation
2012-11-30 14:53:30 +01:00
Alexander Larsson
2dbeabdc58 css: Fix leak of lists while building tree 2012-11-30 14:53:30 +01:00
Alexander Larsson
528e6032ae css: Add accessor functions for traversing css tree
This will let us later change how the tree is stored
2012-11-30 14:53:30 +01:00
Alexander Larsson
42716cb60f css: Add const to _gtk_css_selector_tree_match_all arg 2012-11-30 14:53:30 +01:00
Alexander Larsson
d69c6fff7a css: Don't keep around linear selectors
Now we use the selector tree everywhere, so there is no need to
keep around the linear selectors unless we're using them to
verify the tree correctness, so free them.
2012-11-30 14:53:30 +01:00
Alexander Larsson
c10a0962cf css: Remove gtk_css_ruleset_matches
This is only not needed anymore, and only the VERIFY_TREE code
should access ->selector.
2012-11-30 14:53:30 +01:00
Alexander Larsson
fd4712590a css: Use tree for gtk_css_provider_get_style_property 2012-11-30 14:53:30 +01:00
Alexander Larsson
9b989a1427 css: Implement ruleset_get_change() with the tree
We traverse the tree on the matches instead of using
the linear selectors.
2012-11-30 14:53:30 +01:00
Alexander Larsson
146b6f3a93 css: Ensure the tree built is always the same
We add some "artificial" ordering to the otherwise unordered
tree nodes. This means the tree will be the same every time for the
same input. This is good because e.g. tree order affects the
reordering of the simple selectors, which may affect how
css providers are printed, which need to be consistent for
the css tests to work.
2012-11-30 14:53:30 +01:00
Alexander Larsson
3d5e8f98ec css: Use the tree to print css selectors 2012-11-30 14:53:30 +01:00
Alexander Larsson
6bec577771 css: Track the tree selector matches 2012-11-30 14:53:30 +01:00
Alexander Larsson
f678827918 css: Fix type of GtkCssSelectorRuleSetInfo match
The old type was a leftover from a previous version.
2012-11-30 14:53:30 +01:00
Alexander Larsson
6b85db7555 css: Track parent in the css tree nodes
This way we can reconstruct matched css rules
2012-11-30 14:53:30 +01:00
Alexander Larsson
69feabd139 css: Better tree match verification 2012-11-30 14:53:30 +01:00
Alexander Larsson
0ede06d229 css: Fix up position with region tree matching
This was using the wrong result in case of a match (results from
the position, not the region. Also, the descendant checks were
wrong.
2012-11-30 14:53:30 +01:00
Alexander Larsson
d6932dd823 css: Don't reorder some selectors when building selector tree
When building the tree we generally reorder the selectors inside
the same simple selector in order to pick a good first selector
to balance the tree better. However, some kinds of selectors
can't really be reordered, even thought they are simple.

This is since the matching code for some types handle
the existance of a directly preceeding selector differently:

 REGION and ANY selectors look for a DESCENDANT previous
 POSITION selector look for a REGION previous
2012-11-30 14:53:30 +01:00
Alexander Larsson
63cb467e06 css: Fixed typo in PRINT_TREE debug code 2012-11-30 14:53:30 +01:00
Alexander Larsson
1bfa6593c8 css: Create and use a tree for css selector matching 2012-11-30 14:53:30 +01:00
Alexander Larsson
daefb12a23 css: Add GtkCssSelectorTree creation and matching
From a set of GtkCssSelectors and the rulesets they match to
we create a large decision tree that lets us efficitently match
against all the rules and return the set of matched rulesets.

The tree is created such that at each level we pick the initial rule[1]
in all the considered selectors for that level and use put the
one that is in most selectors in the node. All selectors matching that
are put in the previous part of the tree.
2012-11-30 14:53:29 +01:00
Alexander Larsson
16f2b20f96 css: Add _gtk_css_matcher_matches_any()
This returns true if the matcher matches *anything*. We need
to check this later, because such matchers are dangerous in loops
that iterate over all parents/siblings since such loops would not
terminate.
2012-11-30 14:53:29 +01:00
Alexander Larsson
3b4040d619 css: Track which selectors are "simple" 2012-11-30 14:53:29 +01:00
Alexander Larsson
cfdc68db5c Reuse rendered symbolic icons
With the previous commit all loads of the same icon will share a single
GtkIconInfo, which typicallty means the pixbuf is shared via Info->pixbuf.

However, atm we don't share symbolic icons, which causes these to be re-read
and re-parsed every time. This is especially bad if the icon is used many times
in some form of list. So, we cache the pixbufs and reuse them.

https://bugzilla.gnome.org/show_bug.cgi?id=689081
2012-11-30 11:33:26 +01:00
Alexander Larsson
92e904a257 Cache GtkIconInfo
In order to avoid loading and keeping around the same icon multiple times
we keep a cache of all outstanding GtkIconInfo objects for a given theme.

Additionally we return to the app not the normal pixbuf from the info,
but rather a proxy copy of it sharing the same data, but no extra
reference. This allows us to track when the app is no longer using
the pixbuf, and we can thus ensure that the GtkIconInfo in the cache
stays around for at least as long as the pixbuf is alive.

When the app unrefs the pixbuf we put the Info on a short LRU list
to keep it alive a bit longer, in case the app needs it in a short
while.

https://bugzilla.gnome.org/show_bug.cgi?id=689081
2012-11-30 11:33:26 +01:00
Matthias Clasen
e75860e466 Add a missing va_end call
va_copy must be matched with va_end.
2012-11-29 23:18:49 -05:00
Matthias Clasen
5b9c687595 Avoid unreachable code
Reestablish an else that went missing in commit 5ff328d2. Without
it, the return is reached unconditionally, and the code behind
it is dead.
2012-11-29 23:10:40 -05:00
Matthias Clasen
b3b83545c4 Don't return prematurely
This code was clearly meant to return _after_ the loop.
Don't put the return inside the loop body, then.
2012-11-29 23:10:35 -05:00
Matthias Clasen
c5c7323942 GtkAboutDialog: Initialize a variable
Coverity complains about it being uninitialized, otherwise.
2012-11-29 23:10:34 -05:00
Matthias Clasen
52af9aede6 GtkNotebook: Clarify a switch statement
We were intentionally falling through here, this commit
just adds comments to make that explicit.
2012-11-29 23:10:34 -05:00
Matthias Clasen
4557e4d7a5 GtkCellAccessible: Add missing break statements
This switch was entirely breakless. Amazing accessibility code,
found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
9ba32fec6e GtkExpander: Clarify a nested switch
This code confused Coverity into thinking we were falling through,
when we were not. Add a few explicit breaks to clear that up.
2012-11-29 23:10:34 -05:00
Matthias Clasen
6400eeba35 Add a forgotten break in render_border
The GTK_BORDER_STYLE_DOUBLE case was clearly not meant to
fall through to the subsequent cases, yet it did.
Found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
a7ed598d37 GtkIconViewAccessible: Fix a copy-paste error
Don't access vadjustment after checking hadjustment for
not being NULL. Found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
3519226c5a GtkActionHelper: Fix a copy-paste error
The code clearly meant to reset action->active here.

This was found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
bf26d46cb2 gtk_css_value_bg_size_equal: actually compare contain values
Due to a copy-paste error, the code failed to compare the
contain members of value1 and value2.

This was found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
ce6f43a522 Don't check the same crossing mode twice
This was broken since commit b2aaa94 in 2008. Its commit message
clearly states that the intention was to check for GTK_GRAB,
GTK_UNGRAB and STATE_CHANGED. Lets do that, then.

This was found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
5230cfe805 GtkLabel: Fix a pointless expression
Clearly, what was meant here was that we create a new attribute
list if either of the input attribute lists are non-NULL.
This was found by Coverity.
2012-11-29 23:10:34 -05:00
Timothy Arceri
50acce4074 In the file chooser, use a proper apostrophe rather than a prime mark (tick mark)
https://bugzilla.gnome.org/show_bug.cgi?id=689012
2012-11-29 11:34:29 -06:00
Benjamin Otte
4d0ca91c72 menuitem: Remove unused variables 2012-11-28 21:15:05 +01:00
Marcus Kraßmann
7f3595a6be cssparser: Don't detect /*/ as a comment 2012-11-28 21:11:48 +01:00
Cosimo Cecchi
ea415cd350 menubar: deprecate internal-padding style property
https://bugzilla.gnome.org/show_bug.cgi?id=689168
2012-11-28 10:09:16 -05:00