Cache heights-for-range-of-widths instead of height for every width.
This patch optimizes window resizes by assuming that if a widget
has the same height at a width of 50 as with a width of 150, the
height for width 100 will also be the same.
The patch also further optimizes the cache allocator, now there
are 2 pointer arrays of up to a maximum of 5 requests, the arrays
will only be allocated if a request is ever made in that orientation
and the array will be sparse until each request is made (i.e. if a
label can only wrap to 3 lines, there will only be 3 out of a
possible 5 SizeRequest structures allocated to cache it).
Reduce memory consumption of the size request cache.
This patch makes contextual height-for-width request caching
optional (the contextual cache is not allocated for widgets that
report GTK_SIZE_REQUEST_CONSTANT_SIZE).
Added GTK_SIZE_REQUEST_CONSTANT_SIZE to GtkSizeRequestMode
The constant size request mode defines a request mode where
height-for-width geometry is unneeded, thus optimizing GTK+
by reducing the overall amount of requests that need to be
performed and cached while resizing an interface.
Florian Müllner [Fri, 25 Mar 2011 14:46:41 +0000 (15:46 +0100)]
window: Use settings from screen rather than default
gtk_settings_get_default() was used to monitor the
"gtk-application-prefers-dark-theme" setting, rather
than the GtkSettings object associated with the window's
screen.
Carlos Garnacho [Thu, 24 Mar 2011 23:31:46 +0000 (00:31 +0100)]
Ensure GtkWidget::style-updated is emitted before first size negociation
Fixes Bug 639584 - initial emission of GtkWidget:style-set is
not happening.
GtkWidget was filtering out ::style-updated (and ::style-set)
emissions until the widget was realized in order to avoid often
useless updates during widget construction and placing.
This is now done instead until the widget has a parent/screen,
which ensures the initial emission happen prior to the first
size negociation, while still filtering out all early emissions
during construction.
Matthias Clasen [Thu, 24 Mar 2011 16:44:03 +0000 (12:44 -0400)]
Make selectable labels work again
You can select something, but moving the focus somewhere else, or bringing up
the context menu makes the selection go away. This makes it impossible to
copy-paste the text.
The reason for this regression is that gtk_label_state_changed was sloppy and
assumed that it would only ever be called when a labels goes insensitive, which
is no longer the case.
The patch fixes things by explicitly checking if the widget is insensitive, and
only resetting the selection in that case, which is the same behaviour we have
for e.g. GtkEntry.
Cosimo Cecchi [Tue, 22 Mar 2011 18:35:23 +0000 (14:35 -0400)]
Revert "styleproperties: don't force replacing the font description"
It turns out the bug is more complicated than I originally understood.
Not replacing the font description fields while merging here makes it
impossible for application's CSS to override fonts.
Cosimo Cecchi [Mon, 21 Mar 2011 14:53:12 +0000 (10:53 -0400)]
themingengine: don't hardcode white to draw insensitive labels shadow
Use the background color instead.
I think the optimal solution would be delegating the shadow rendering to
the theme completely, and removing this in GtkThemingEngine, but for
now, this simple fix makes the dark variant more usable.
Florian Müllner [Sun, 20 Mar 2011 13:37:27 +0000 (14:37 +0100)]
window: Export theme variant to X11
The metacity theme format allows to use colors from the current
GTK+ theme in window decorations. Since GTK+ now gained support
for dark theme variants, window managers using that theme format
(metacity, mutter, compiz via gtk-window-decorator) should be able
to use colors from the correct variant; so in case a variant is
requested, export it in the _GTK_THEME_VARIANT property on
toplevel windows.
Cosimo Cecchi [Thu, 17 Mar 2011 22:27:03 +0000 (18:27 -0400)]
switch: fix boundaries for the switch motion
We were ignoring the focus ring padding, and we were incorrectly setting
handle_x to padding.left, while the draw handler already takes padding
into account while redrawing.
Bastien Nocera [Thu, 17 Mar 2011 17:59:46 +0000 (17:59 +0000)]
notebook: Don't set notebook style with hidden tabs
When tabs are not shown, and the notebook is used as a container,
we should not set the notebook style, otherwise the theme has no
way to know whether tabs are shown or not, and which colour to draw
the background.
Benjamin Otte [Thu, 17 Mar 2011 15:45:19 +0000 (16:45 +0100)]
widget: Don't override state data when recursing to children
Writing onto the passed-in GtkStateData could cause changes that would
propagate to siblings, as the data was not reset again.
By copying the data structure, this is avoided and the proper values are
passed to sibling widgets.
Cosimo Cecchi [Mon, 14 Mar 2011 22:21:47 +0000 (18:21 -0400)]
range: allow stepper-spacing > 0 and trough-under-steppers = TRUE
Commit 4bb3d6441439e4d99255a3a08b39da7100ced953 introduced a limitation
to GtkRange style properties; when stepper-spacing is > 0,
trough-under-steppers is automatically set to FALSE; this means that
setting a spacing between the steppers (e.g. the scrollbar buttons) and
the trough (i.e. the area over which the slider is free to move) would
make the buttons always get the full allocation on the !orientation
direction.
The rationale is without this limitation, you would get an area which
seems clickable, but it's actually not.
While this is true, and undesirable, for big stepper spacings, themes
that use trough-under-steppers (which is TRUE by default anyway),
might want to set smaller spacings to avoid drawing a double line between
the button and the slider borders.
To add confusion, the documentation got it flipped, i.e. it stated
setting a positive stepper-spacing would set trough-under-steppers to
TRUE (which would also make the behavior expected by commit 4bb3d6441439e4d99255a3a08b39da7100ced953 impossible).
I don't think hardcoding either of the two limitations is a good thing.
We should let themes handle this instead, and remove this limitation. If
you want the old behavior, you can manually set trough-under-steppers to
FALSE if you set a positive stepper-spacing in your theme.
Ensure that we're writing all the updates for a single rendering op
in one go without callbacks inbetween. That way some rendering will
be delayed, but the user will never see partial renderings.
Matthias Clasen [Sat, 12 Mar 2011 18:42:05 +0000 (13:42 -0500)]
GtkAboutDialog: keep toggle button state in sync
When hiding the dialog, we hide the credits/license parts, so
we need to update the toggle buttons controlling them.
https://bugzilla.gnome.org/show_bug.cgi?id=644355