Commit Graph

17016 Commits

Author SHA1 Message Date
Rico Tzschichholz
73f3263e6c gtk: Add private headers to EXTRA_DIST
This got lost with 985881ffcc
2012-05-08 09:16:51 +02:00
Benjamin Otte
d736d06db8 iconview: Only compute item sizes in one place
Code was using different places to compute the icon size when layouting
and when doing size requests. This resulted in non-matching behavior in
obscure cases. And that lead to iconviews that were too small.
2012-05-08 03:58:23 +02:00
Benjamin Otte
e31fb77c22 iconview: Bring back per-row contexts
Apparently GtkCellAreaContext is broken enough to not allow multiple
allocations...
2012-05-08 03:58:23 +02:00
Benjamin Otte
e8eeb39d98 iconview: Move wrap width adjustment to size request code 2012-05-08 03:58:23 +02:00
Benjamin Otte
f51c9d4154 stylecontext: Make queue_invalidate() always work
Handle both the case where a widget is set and also the case where a
widget path is set.
2012-05-08 03:58:23 +02:00
Rui Matos
a0f155e839 immulticontext: Always check if the global context id changed
This makes sure that if the gtk-im-module setting changes we update
our internal state immediately on the next event whichever it is.

In particular this fixes the case of the gtk-im-module setting
changing while the user is typing and the slave context remaining the
same, effectively ignoring the setting change.

https://bugzilla.gnome.org/show_bug.cgi?id=675365
2012-05-08 00:35:30 +02:00
Cosimo Cecchi
a4d76439e6 infobar: set default border/spacing on action/content areas
Commit cdf473ec10 deprecated the style
properties associated with the container border width and box spacing of
the action and content areas, in favour of using
gtk_container_set_border_width() and gtk_box_set_spacing() on the
widgets themselves, but failed to initialize those values to the
defaults.
2012-05-07 18:06:32 -04:00
John Ralls
985881ffcc [Bug 675501] gtkquartz.h is not in the gtk+-3.5.2.tar.xz archive
Rearrange the gtk_private_h_sources so that they're all added to EXTRA_DIST instead of only the ones included in the current build.
2012-05-07 14:59:06 -07:00
John Ralls
b5bcdbc10f Rename gtkquartz-menu to gtkmodelmenu-quartz
Makes name consistent with other quartz-only modules and makes it clear that this works with the GMenuModel system rather than the older GtkMenu system.
2012-05-07 14:59:06 -07:00
Federico Mena Quintero
e00847b0d5 bgo#675421 - Set the wm_role on GtkFileChooserDialog
The window's role is 'GtkFileChooserDialog', so that window managers can match it
for positioning.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-05-07 15:42:32 -05:00
Benjamin Otte
5722f9ab0f sizerequest: Improve warning message
Actually print out the function we're warning about
2012-05-07 17:37:36 +02:00
Benjamin Otte
86cebc9b43 iconview: Fix negative natural size request on empty iconview 2012-05-07 17:19:10 +02:00
Benjamin Otte
e133c6cb71 iconview: Don't expand items to more than natural size
This ensures that items stay left-aligned instead of slowly expanding into
empty space when widening the iconview. It's also what the iconview did
pre-refactoring.

Note that for cases where natural width != minimum width, the cells
might still expand and shrink back.
2012-05-07 01:37:27 +02:00
Benjamin Otte
d20d7c54d3 iconview: Redo layouting 2012-05-07 00:12:26 +02:00
Benjamin Otte
b7385ffcab iconview: Respect item width in size requestr code 2012-05-07 00:12:26 +02:00
Benjamin Otte
d406bf96d4 iconview: Reduce complexity of sizing code
Always assume max-columns and min-rows. The old approach was kinda
insane.

As an example, try to write an algorithm that optimizes the minimum size
for infinite (take a reasonably large number like 2520) word-wrapped
Monospace text cells containing the text "XXXXX XXX XXX XXXXX" (keep in
mind that this is the easy problem, because it's assuming equal cell
renderers). There's 4 ways to reasonably lay out this text:
19 glyphs (19x1):
  XXXXX XXX XXX XXXXX
18 glyphs (9x2):
  XXXXX XXX
  XXX XXXXX
21 glyphs (7x3):
  XXXXX
  XXX XXX
  XXXXX
20 glyphs (5x4):
  XXXXX
  XXX
  XXX
  XXXXX
The best thing to do usually is using the 9x2 approach, but that's
neither the one using the natural nor the one using the minimum size.

As a side note, this does not include spacing and padding, which might
also influence the decision. Nor does it include height-for-width
considerations. Look at this table (numbers given in glyphs, not pixels,
as for pixel-sizes it gets even more interesting):
  given  best solution
  width  columns  sizing  glyphs per cell
   6      1       6x4           20
   7      1       7x3           21
   8      1       7x3           24
   9      1       9x2           18
  10      1/2     9x2/5x4       20
  11      1/2     9x2/5x4       22
  12      1/2     9x2/5x4       24
  13      1/2     9x2/5x4       26
  14      2       7x3           21
  15      3       5x4           20
  16      3       5x4           21.3
  17      3       5x4           22.7
  18      2       9x2           18
  19      1/2    19x1/8x2       19
  20      1/2/4  19x1/8x2/5x4   20
  21      1-4     any           21
  22      1-4     any           22
  23      1-4     any           23
  24      1-4     any           24
  25      5       5x4           20
  26      5       5x4           20.8
  27      3       9x2           18
  28      3       9x2           18.7
  29      3       9x2           19.3
  30      3/6     9x2/5x4       20

Now of course, nobody wants the number of columns to randomly change in
inexplicable ways while they enlarge or shrink an iconview, so we not
only have to optimize for smallest or other size measurements, but we
also have to optimize for "most pleasing to the eye".

And last but not least, I'd like to once again remind you - if you kept
up until now - that this discussion was for identically-sized cells
only.
2012-05-07 00:12:26 +02:00
Benjamin Otte
65ad492c24 iconview: Redo size requests
Instead of just returning the last allocated numbers, we now compute the
proper sizes from scratch. This is a bit less trivial, but it results in
proper height-for-width handling.
2012-05-07 00:12:26 +02:00
Benjamin Otte
63ddb3f2c7 iconview: Don't cache iters
This is a huge quest to remove all caching from GtkIconview to simplify
the code. As it turns out, iconview performance is a joke, so the caches
are kinda unnecessary.

If we need caching, we can add it in a useful way later.
2012-05-07 00:12:26 +02:00
Benjamin Otte
ee91e272a8 iconview: Remove needless requirement
If we use
  &item->cell_area
instead of
  (GdkRectangle *) item
there is no need anymore to keep the cell_area as the first member of
the the item. And we cget compile-time checks for changes to the item
struct.
2012-05-07 00:12:26 +02:00
José Alburquerque
7604e2d418 gtk_entry_[get|set]_inner_border(): Clarify the deprecation docs. 2012-05-06 15:05:27 -04:00
Paolo Borelli
3b0cd0eb8a [socket]: fix gtk-doc warnings. 2012-05-06 12:37:59 +02:00
Cosimo Cecchi
e5f0e30843 themingengine: don't hardcode the slider lines in the theming engine
It's wrong to hardcode the slider lines here; those should be rendered
as an additional background layer using background-image if the theme
specifies so.

https://bugzilla.gnome.org/show_bug.cgi?id=652304
2012-05-04 16:47:24 -04:00
Cosimo Cecchi
5a8e2b5995 entry-completion: set size request on the toplevel window
Instead of setting it on the child scrolled window. This is needed
because the whole window's allocation must be equal to the one of the
entry (in case the popup-set-width property is TRUE); if we set the size
request on a children of the window, there might be other children with
borders/paddings in between the toplevel and the child we set the size
request too, which will break alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=672947
2012-05-04 15:43:29 -04:00
Cosimo Cecchi
644070b551 entry-completion: don't subtract entry borders from popup allocation
The completion popup should be aligned with the GtkEntry allocation, not
less than that.

https://bugzilla.gnome.org/show_bug.cgi?id=672947
2012-05-04 15:43:27 -04:00
Carlos Garcia Campos
a18f018d87 cellrenderertext: Add placeholder-text property
It works similar to placeholder text in a GtkEntry, if the cell renderer
is editable and it's empty, the placeholder text is displayed.
https://bugzilla.gnome.org/show_bug.cgi?id=645514
2012-05-03 23:35:34 -04:00
David King
2d10c8844e docs: Improve GtkMessageDialog description
Add mention of default setting of GtkWindow:skip-taskbar-hint.

https://bugzilla.gnome.org/show_bug.cgi?id=587873
2012-05-04 03:09:13 +01:00
David King
da1a90bcaf docs: Correct gtk_tree_row_reference_new() description
Remove the text that mentions listening to tree model signals, and
instead say that any changes are automatically propagated.

https://bugzilla.gnome.org/show_bug.cgi?id=478344
2012-05-04 03:04:58 +01:00
Bastien Nocera
c1f01eb929 Add support for disabling middle click paste
Adds a gtk-enable-primary-paste setting that is backed by
and X setting, and make GtkEntry and GtkTextView respect it.

https://bugzilla.gnome.org/show_bug.cgi?id=665243
2012-05-03 21:59:54 -04:00
Ryan Lortie
88c63903a5 printing: Rename GTK_UNIT_PIXEL to GTK_UNIT_NONE
...and document that many functions don't accept "none" as a unit.

https://bugzilla.gnome.org/show_bug.cgi?id=460908
2012-05-03 18:30:48 -07:00
Rui Matos
4d7c7ec32f window: Remove needless call to ensure_state_flag_backdrop() on map
This call was forcing needless work since gtk_window_map() already
does a gdk_window_show() which initially sets GDK_WINDOW_STATE_FOCUSED
that we then handle regularly on the widget's window state event
handler.

https://bugzilla.gnome.org/show_bug.cgi?id=673237
2012-05-03 17:24:05 -07:00
Cosimo Cecchi
b9eb02ebbe colorbutton: don't hardcode a 16px margin around the color sample
Since themes might want different paddings around the color sample
according to where it's being used, don't hardcode a 16px one here.
The theme can specify a padding to get the same effect.

Reported by Christian Persch <chpe@gnome.org>
2012-05-03 15:03:22 -04:00
Christian Persch
4b4ec4472c application: Fix build without x11 2012-05-03 18:47:58 +02:00
Christian Persch
ff66d0d8e5 application: Add unique IDs for GtkApplicationWindow
This will allow to refer to specific GtkApplicationWindows remotely by ID.

https://bugzilla.gnome.org/show_bug.cgi?id=674409
2012-05-03 17:45:46 +02:00
Emmanuele Bassi
824776cb02 fontsel: Add a deprecation note in the constructor docs
To match the compiler attribute, otherwise the introspection scanner
will not pick up the deprecation.
2012-05-03 08:07:13 +01:00
Chun-wei Fan
5f61f40601 Bug 670499-gtk/fallback-c89.c: Add fallback for nearbyint()
This adds a C89 implementation for nearbyint() as it is a function that
is only made available in C99.
2012-05-03 11:59:16 +08:00
Chun-wei Fan
2969db9993 Bug 670449-gtk/gtksettings.c: Fix build on Windows
On Windows, gtkwin32themeprivate.h is needed as
_gtk_win32_theme_get_default() is called on that platform to avoid C4013
warnings/errors (aka implicit declaration of ... for GCC folks).
2012-05-03 11:54:15 +08:00
Cosimo Cecchi
aeb5cb2caa pathbar: fix a copy/paste error from last commit
We need to update the child pointer to the current iterator when going
trough the button list.
2012-05-02 11:49:40 -04:00
Benjamin Otte
0743cef50d stylecontext: Disallow adding/removing GtkSettings style providers
Adding "system" providers like the GtkSettings object shouldn't be
allowed at all, so ensure that it indeed is not.
2012-05-02 17:04:49 +02:00
Benjamin Otte
01b75f19a6 pathbar: Only invalidate styles in allocate if stuff really changed
I still don't like queueing restyles in size_allocate(), but I can't
come up with a better mechanims for the way the pathbar works today.
2012-05-02 17:04:49 +02:00
Benjamin Otte
793748eadd debug: Add GTK_DEBUG=no-css-cache
See inline comments for what it does. Its main use is figuring out if
something has been caused by GTK's caching of CSS properties or if it's
a different problem.
2012-05-02 02:00:11 +02:00
Benjamin Otte
d22a632b54 window: Validate style context before first allocation
When we don't do that, we completely botch sizing popups. Not good.

Fixes remaining failing reftests
2012-05-02 02:00:11 +02:00
Cosimo Cecchi
fd549e432f cssshadow: plug a memory leak 2012-05-01 15:03:47 -04:00
Benjamin Otte
333a5b4307 cssshadow: Default fallback color is transparent
... not the current color. Fixes unresolvable.ui test.
2012-05-01 03:13:02 +02:00
Benjamin Otte
b4195cb408 cssmatcher: Handle case of empty widget path
This is tested by the stylecontext test, but doesn't appear in practice.
2012-05-01 03:13:02 +02:00
Benjamin Otte
6c63842e68 cssprovider: Actually match the state for style properties
Copy/paste error when refactoring.

Caught by stylecontext test.
2012-05-01 03:13:02 +02:00
Benjamin Otte
4531da17e4 gtk: Get rid of deprecation warnings 2012-05-01 03:13:01 +02:00
Benjamin Otte
de9ffc99c2 tests: Ifdef out unused code
The test using those functions was disabled in
b310ba29d0
2012-05-01 03:13:01 +02:00
Benjamin Otte
23907e1d53 build: Remove now-unused GTK_DISABLE_DEPRECATED undefs 2012-05-01 03:13:01 +02:00
Ryan Lortie
af71917015 GtkApplication: adjust to GApplication changes
GApplication now makes the session bus and object path available as a
public API on the application instance.  Use that instead of trying to
guess values for ourselves.

This causes this version of Gtk+ to depend on GLib 2.32.2, so bumping
version dependency accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=671249
2012-04-30 17:50:45 -04:00
Ryan Lortie
babd137e32 GtkApplication: fixes for NULL session bus
We currently have a couple of cases where GtkApplication assumes that
the session bus will be non-NULL causing critical error output or (in
the case of trying to publish menus) an infinite loop.

Three fixes:

 - if the session bus is NULL due to not having registered the
   GtkApplication yet then give a g_critical on the entry point to the
   menu setters instead of going into an infinite loop.  Document this.

 - check for NULL session bus even when calling the menu setters at the
   right time in order to prevent the infinite loop for
   non-programer-error cases (ie: because we had trouble connecting to
   the session bus)

 - check for NULL session bus when publishing the X11 properties on the
   GtkApplicationWindow and skip publishing them if we're not on the bus

https://bugzilla.gnome.org/show_bug.cgi?id=671249
2012-04-30 17:50:45 -04:00
Cosimo Cecchi
cdf473ec10 infobar: deprecate broken GtkInfoBar style properties
The way we use these style properties to set regular properties on
containers accessible from the public API is really just broken, and
could lead to undefined values for the spacing and border-width
container properties (since they could be set from public API and then
changed from under in a style_update handler from GTK).

Take this as an occasion to deprecate these style properties, which do
not make a lot of sense anyway, now that GtkInfoBar supports regular CSS
padding and border.
2012-04-30 17:14:44 -04:00
Owen W. Taylor
0aa989ae76 GtkPlug: fix handling of key events for different layouts
GtkPlug directly handles X KeyPress/Release events, instead of using
translation in GDK (which expects XI2 events for XI2). When this
was done, the handling of the group was stubbed out and never replaced.

Export gdk_keymap_x11_group_for_state() and gdk_keymap_x11_is_modifier()
so we can fill out the fields correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=675167
2012-04-30 16:35:10 -04:00
Paolo Borelli
2f81a58573 Fix info-bar reftest
InfoBar must take into account the border and padding when requesting
its allocation, since it is then drawing them. Besides, the border and
background should always be drawn, even when the message type is OTHER.
2012-04-30 21:53:17 +02:00
Paolo Borelli
03bf85ba07 Paint label background
Make GtkLabel respect background css properties.

https://bugzilla.gnome.org/show_bug.cgi?id=670743
2012-04-30 13:13:25 -04:00
Cosimo Cecchi
20f8dd2309 themingbackground: fix copy/paste typo
We need to fetch the area value for the origin, not for the clip.
2012-04-30 12:10:45 -04:00
Matthias Clasen
b310ba29d0 Disable configuration-dependent keymap tests for now
These need to be made independent of the xkb configuration somehow.
As things are now, they will either fail when run on a naked X
server in make check, or fail when run in my session.
2012-04-30 07:32:33 -04:00
William Jon McCann
ceb3fecd11 Migrate to XDG config dir for bookmarks
Will read from old location if new location isn't found but will
write it out to the new location.

https://bugzilla.gnome.org/show_bug.cgi?id=646631
2012-04-30 06:42:35 -04:00
William Jon McCann
f10176e49f Prefer xdg data directory to legacy .icons directory
https://bugzilla.gnome.org/show_bug.cgi?id=646631
2012-04-30 06:42:34 -04:00
William Jon McCann
9f5e580821 Try to load css themes from the XDG config directory first
Will fall back to previous locations.

https://bugzilla.gnome.org/show_bug.cgi?id=646631
2012-04-30 06:42:33 -04:00
William Jon McCann
bbb7b2987e Migrate to XDG config dir for custom papers
Will read from old location if new location isn't found but will
only write to the new location.

https://bugzilla.gnome.org/show_bug.cgi?id=646631
2012-04-30 06:42:31 -04:00
William Jon McCann
fa0d6127c3 Don't load binary modules from the home directory by default
We should rely on the module path environment variables being
set correctly for the architecture rather than load from .gtk-3.0

https://bugzilla.gnome.org/show_bug.cgi?id=646631
2012-04-30 06:42:30 -04:00
Matthias Clasen
0c6d158373 GtkGrid: Add a note about overlapping children
https://bugzilla.gnome.org/show_bug.cgi?id=669989
2012-04-28 02:19:45 -04:00
Matthias Clasen
d44edc1f7d Revert "WIP: make GtkNotebook window-draggable"
This reverts commit b3a66c59ad.
2012-04-28 02:06:37 -04:00
Carlos Garnacho
676441398a treemodelsort: fix iter_previous so it can go back to the first item
It was getting the previous element, then checking whether it was the
first one, that has to be inverted so it doesn't stop on the second
item.

https://bugzilla.gnome.org/show_bug.cgi?id=674587
2012-04-28 02:01:16 -04:00
Diego Escalante Urrelo
b3a66c59ad WIP: make GtkNotebook window-draggable
https://bugzilla.gnome.org/show_bug.cgi?id=672427

https://bugzilla.gnome.org/show_bug.cgi?id=674587
2012-04-28 02:01:16 -04:00
Matthias Clasen
22eb687264 Add a 'fine adjustment' mode to ranges
Shift-click in the slider now starts a drag in 'fine adjustment'
mode, where we move the slider 10-times slower than the mouse.

This can be very helpful when scrolling through a very long document
or webpage, and moving the scrollbar even a single pixel already
jumps too far in the content.

https://bugzilla.gnome.org/show_bug.cgi?id=563688
2012-04-27 12:08:16 -04:00
Matthias Clasen
162614aab4 Change button bindings for range widgets around
It seems to be general consensus that button 1 should do the jumping,
so we now jump to the clicked position on primary button clicks and
page on secondary button clicks. Touch behaves like primary.

https://bugzilla.gnome.org/show_bug.cgi?id=563688
2012-04-27 12:08:15 -04:00
Debarshi Ray
1d5ba789d5 stylecontext: Add GTK_STYLE_CLASS_DIM_LABEL
Fixes: https://bugzilla.gnome.org/674468
2012-04-27 14:55:49 +02:00
Benjamin Otte
0cf3791c28 toolpalette: Configure adjustment properly
https://bugzilla.gnome.org/show_bug.cgi?id=673650
2012-04-27 03:33:57 +02:00
Benjamin Otte
145b59b4b1 toolpalette: Rename variable
The variable that holds the total size for all widget allocations
shouldn't be called page_start.
2012-04-27 03:28:22 +02:00
Cosimo Cecchi
271adacfad icontheme: search first in all themes if the requested icon is symbolic
Symbolic icons use a "-symbolic" suffix to distinguish themselves from
highcolor variants. Note that the dash character here has a different
meaning than the specificity level defined in the icon-naming-spec [1],
as it identifies a property of the icon itself.

Since they might be provided by a parent theme (e.g. the HighContrast theme
relies on the gnome icon theme for them), when we are looking up one we
should first escape the generic icon inheritance mechanism defined in the
icon-naming-spec [1], and privilege a symbolic icon, if it exists in a
parent theme, before applying the inheritance evaluation.

This fixes symbolic icons not working properly when used in the
HighContrast theme with the GTK_ICON_LOOKUP_GENERIC_FALLBACK flag set.

[1]
http://standards.freedesktop.org/icon-naming-spec/latest/ar01s03.html

https://bugzilla.gnome.org/show_bug.cgi?id=674806
2012-04-26 13:52:01 -04:00
Cosimo Cecchi
7e917e54a3 themingengine: simplify render_extension() default implementation
Avoid doing useless translations/rotations, since themes will most
likely set different CSS gradients using left/right/top/bottom style
classes, or use a plain color.

https://bugzilla.gnome.org/show_bug.cgi?id=674809
2012-04-26 13:50:20 -04:00
Cosimo Cecchi
d12fd1435a themingengine: render a frame in gtk_render_handle()
We already render a background there after all.

https://bugzilla.gnome.org/show_bug.cgi?id=674808
2012-04-26 13:45:24 -04:00
Cosimo Cecchi
5538552ebc spinbutton: port to GtkIconHelper
Instead of doing our own lookup for symbolic icons and rendering the
pixbuf, use GtkIconHelper as other widgets do, which saves a bunch of
code.

https://bugzilla.gnome.org/show_bug.cgi?id=674807
2012-04-26 13:35:54 -04:00
Matthias Clasen
87cd49371a Make page up/down work again in scrolled menus
This was broken since before GTK+ 3.0, when we replaced
a use of requisition by allocation. Fix this by using the
requisition height, that is already cached by the menu code.

The math is not quite right here; if you page all the way
down a long menu, you end up on the second-to-last menuitem.
But at least, page up/down let you move up and down the menu
again.
https://bugzilla.gnome.org/show_bug.cgi?id=668931
2012-04-24 23:34:12 -04:00
Giovanni Campagna
dee341fc35 StyleProviderPrivate: mark internal variable as static
Otherwise, it could conflict with other symbols with the same
name exported by a different shared library, with undefined
effects.

https://bugzilla.gnome.org/show_bug.cgi?id=674577
2012-04-23 19:16:14 +02:00
Matthias Clasen
9107074795 Beginning of keyhash tests
Not very interesting yet
2012-04-22 13:00:46 -04:00
Kristian Rietveld
89f166b542 quartz: fix coordinates for synthesized event
Of course, we must pass coordinates in the NSWindow coordinate system
when creating an NSEvent. This fixes drag icon positioning and makes
the icon slide back to the correct position when the drag is
canceled.
2012-04-22 17:38:52 +02:00
Matthias Clasen
aa3d30e256 Fix a cornercase of menu parsing
When a uimanager in a gtkbuilder file contains a menu,
the builder parser was getting confused.

https://bugzilla.gnome.org/show_bug.cgi?id=672789
2012-04-20 01:50:01 -04:00
Matthias Clasen
ffafe80f5b Cosmetic 2012-04-19 23:41:53 -04:00
Cosimo Cecchi
a94f4a4387 stylecontext: add a define for an OSD style class 2012-04-19 15:10:52 -04:00
Cosimo Cecchi
00440e32a4 stylecontext: reorder style classes defines
A couple of style classes defines ended up mixed with the region
defines.
2012-04-19 15:10:52 -04:00
Murray Cumming
d4c1b46a9e GtkAppplication docs: Fix small typo. 2012-04-19 09:26:00 +02:00
Cosimo Cecchi
0fc7c92235 messagedialog: also set GtkMisc alignment to zero for dialog labels
Setting xalign to START is not enough to make them left-aligned in every
case. This fixes a regression introduced in commit
cc0be1f949

https://bugzilla.gnome.org/show_bug.cgi?id=674286
2012-04-18 14:42:57 -04:00
Cosimo Cecchi
eea0cb3a68 messagedialog: don't use gtk_widget_override_font()
Instead of overriding the font theme settings, just set the Pango
attributes we want on the label. This fixes message dialogs growing on
style_update after recent GTK+ changes.
2012-04-18 13:46:39 -04:00
Cosimo Cecchi
4118e13596 container: fix wrong branching logic
If the resize mode of the container was GTK_RESIZE_IMMEDIATE we would
also fall trough to the next case in the switch, and always throw an
assertion.
2012-04-18 12:12:32 -04:00
Benjamin Otte
04c85a5b3b container: Redo style validation handling
Instead of using 1 global queue for both resizes and style validation,
use 2 queues. This makes the code a lot simpler and fixes a bug where we
could accidentally stop restylying for very delayed restyles.
2012-04-17 08:59:23 +02:00
Benjamin Otte
17ccbe4843 container: needs_resize is a container flag, not a widget flag
The widget flag is alloc_needed, needs_resize is used for "is queued
into the container resize queue".
2012-04-17 08:59:23 +02:00
Benjamin Otte
53e714199a cssvalue: Remove GObject macros
GtkCssValue is not a GObject
2012-04-17 08:59:23 +02:00
Benjamin Otte
35e36b9fe5 stylecontext: Avoid style_context_save() calls
Introduce style_data_lookup_for_state() that does this.
2012-04-17 08:59:23 +02:00
Benjamin Otte
2179580c8e stylecontext: Pull all the animation code together
We now animate the core style information (see comment in
gtk_style_context_save()). A lot of widgets save + set custom style
classes/states during drawing and so can't be animated. It does work for
labels, menus and buttons though.
2012-04-17 08:59:23 +02:00
Benjamin Otte
632a84af8c stylecontext: Add GtkCssAnimatedValues
This is a GtkCssComputedValues subclass. So it's essentially a store for
computed CSS values. But it can be animated by advancing it to a certain
timestamp.
2012-04-17 08:59:23 +02:00
Benjamin Otte
9c57b96f56 animation: Add CSS transition object
This is an implementation of GtkStyleAnimation for CSS transitions.

Again, this doesn't do anything but store the data needed to do the
transition.
2012-04-17 08:59:23 +02:00
Benjamin Otte
7b7027c971 stylecontext: Add new class for animation handling
A StyleAnimation is an immutable object used to track the state of CSS
values. I'd have liked to make it fully immutable - ie not have the
timestamp in there - but couldn't find a place to sanely store the
timestamp.

This is an abstract base class. Implementations for this will be added
later (for both CSS3 transitions and animations, potentially for
animated images).

Actually aplying the information in this object will be done by a
different object commtted later.
2012-04-17 08:59:23 +02:00
Benjamin Otte
8b1385804e button: Remove _gtk_button_paint()
All buttons use the same paint function these days. States are managed
correctly so this was just leftovers from GTK 1 or GTK 2.
2012-04-17 08:59:23 +02:00
Benjamin Otte
d8b99d47ea menuitem: Don't set menubar style class randomly
a) We're not a menubar, you can match on the parent if you have to
b) It's not set while getting preferred sizes
2012-04-17 08:59:23 +02:00
Benjamin Otte
1d54e4e867 widget: Set .default class when widget is default
Don't just conditionally set it on buttons.
2012-04-17 08:59:22 +02:00
Benjamin Otte
60eff87d08 stylecontext: Shuffle around code
This has two goals:

1) Move invalidation code out of a nested if branch. Invalidation is
actually the most important thing this function does.

2) Have the changes bitmask available. It will needed for invalidate
calls to children later.
2012-04-17 08:59:22 +02:00
Benjamin Otte
42d2430498 stylecontext: Add style_info_set_data()
.. to take care of the refcounting properly.
2012-04-17 08:59:22 +02:00
Benjamin Otte
b8c72a0bdb stylecontext: Make StyleInfo keep the next pointer 2012-04-17 08:59:22 +02:00
Benjamin Otte
deefb64661 stylecontext: Make StyleData refcounted
This is needed for animations where we want to keep a custom StyleData
for animations.
2012-04-17 08:59:22 +02:00
Benjamin Otte
fe89e710ea stylecontext: Add public API to stop animations
... and use it.

Of course, there still are no animations, so we don't turn anything off
yet.
2012-04-17 08:59:22 +02:00
Benjamin Otte
a240808824 stylecontext: Add an animating framework
The design principles were:

- synchronized
If multiple style contexts are animating, they should all do an
animation step at the same time.

- degrades well
Even when there's thousands of style contexts all animating at the same
time, the animation steps don't starve the CPU. This is achieved by
making sure the timeout is really fast. It just sets a bunch of flags.

- no hidden bottlenecks
Turning animatability on or off on a style context is O(1).

So far it is unused.
2012-04-17 08:59:22 +02:00
Benjamin Otte
50fdb6a13f computedvalues: Split out a function 2012-04-17 08:59:22 +02:00
Benjamin Otte
b6594d1ac9 stylecontext: Don't queue a resize when none is needed 2012-04-17 08:59:22 +02:00
Benjamin Otte
97dc45f8a5 container: Split out a function 2012-04-17 08:59:22 +02:00
Benjamin Otte
090f30c559 container: Remove duplicated flag
GtkContainer::need_resize and GtkWidget::alloc_needed are the same
thing.
2012-04-17 08:59:22 +02:00
Benjamin Otte
8bda7442c8 container: Simplify code
This code should not have any functional changes and just be simpler.
2012-04-17 08:59:21 +02:00
Benjamin Otte
e2f89c0c6a stylecontext: Listen to the new changed signal 2012-04-17 08:59:21 +02:00
Benjamin Otte
6443baadb9 styleprovider: Make all implementors emit the new signal
... and listen to it in the cases where they use other style providers.
2012-04-17 08:59:21 +02:00
Benjamin Otte
74f4c6f6bd styleprovider: Add a private signal for when things change 2012-04-17 08:59:21 +02:00
Benjamin Otte
29fbfcb8f5 stylecontext: Pass time to style_context_validate()
This way, we can ensure that every style context uses the same timestamp
for whatever they do.
2012-04-17 08:59:21 +02:00
Benjamin Otte
aaedc7b67f stylecontext: Compute if things changed before invalidating
This is only a small performance boost by itself, but it's necessary
for animations, so we need it.

Benchmark numbers for my Glade benchmark for interested people:
        GTK 3.4.0    last commit  this commit
Raleigh
  real  0m41.879s    0m10.176s    0m9.900s
  user  0m41.394s    0m9.895s     0m9.628s
  sys   0m0.111s     0m0.096s     0m0.102s

Adwaita                                        (*)
  real  0m51.049s    0m13.432s    0m14.848s    0m12.253s
  user  0m50.487s    0m13.034s    0m13.218s    0m11.927s
  sys   0m0.117s     0m0.151s     0m0.147s     0m0.107s

Ambiance (patched to not use private GTK APIs)
  real  0m52.167s    0m13.115s    0m13.117s    0m12.944s
  user  0m51.576s    0m12.739s    0m12.768s    0m12.651s
  sys   0m0.119s     0m0.137s     0m0.136s     0m0.118s

(*) Adwaita and unico currently use custom properties, and
_gtk_css_value_compare() for custom properties always returns FALSE,
which makes this optimization never trigger. So I modified
_gtk_css_value_compare() to return TRUE for these properties instead and
reran the benchmark. Those are the numbers.
2012-04-17 08:59:21 +02:00
Benjamin Otte
33f111a47c widget: Don't cache widget paths all the time
Add an internal API that allows GtkStyleContext to create a widget path
for the widget and with that bypassing gtk_widget_get_path() and that
  function caching the path.
2012-04-17 08:59:21 +02:00
Benjamin Otte
6ac754cdd1 stylecontext: Remove theming_engine cache variable
Instead, look up the variable upon use. This is more correct (for when
the engine changes due to save/restore() shenanigans.

And it removes code that doesn't use the standard code paths.
2012-04-17 08:59:21 +02:00
Benjamin Otte
3ddb104302 stylecontext: Split out a function 2012-04-17 08:59:20 +02:00
Benjamin Otte
2fec112422 styleproperty: Remove equal_func vfunc
Equality tests are done with _gtk_css_value_equal(). There is no need to
do it per-property, equal values will still be equal.

This essentially reverts 24f5d54329e028347bd76af42e86ed190c1229a2 and
92c7a7171e1240b6d961ee5b6f9ab6b596e98904.
2012-04-17 08:59:20 +02:00
Benjamin Otte
40283e7c27 cssvalue: Split out old value handling to new typed value
... and Make this new value be a real GValue, as we don't need to save
performance for these anymore (it's just used for custom properties).
And I'd rather have code work for all values then be optimized for no
reason.
2012-04-17 08:59:20 +02:00
Benjamin Otte
883c871be6 themingengine: Fix outline-width
It's a number, not an int.
2012-04-17 08:59:20 +02:00
Benjamin Otte
ba7141b92e shorthand: Fix border query functions
We haven't been using ints there for a while, I wonder why that never
blew up...
2012-04-17 08:59:20 +02:00
Benjamin Otte
0111b9d507 symboliccolor: Treat it as a CssValue
.. now that it is one.
2012-04-17 08:59:20 +02:00
Benjamin Otte
505fefbec7 cssprovider: Add an empty line when printing
... between the @define-color statements and the rules.
2012-04-17 08:59:20 +02:00
Benjamin Otte
51da8cb263 symboliccolor: Parse 'currentColor' everywhere 2012-04-17 08:59:20 +02:00
Benjamin Otte
83be7e5dbd symboliccolor: Pass the current color to the resolve function
This way, we can resolve things like
  mix (currentColor, &otherColor);
and therefore parse currentColor as a regular color.
2012-04-17 08:59:19 +02:00
Benjamin Otte
1223d53a82 cssparser: Move symbolic color parser to gtksymboliccolor.c 2012-04-17 08:59:19 +02:00
Benjamin Otte
7606fcb52e symboliccolor: Turn this into a GtkCssValue 2012-04-17 08:59:19 +02:00
Benjamin Otte
b403a1b550 css: Add a shorthand 'transition' property 2012-04-17 08:59:19 +02:00
Benjamin Otte
c3f46ab5c0 shorthand: Add ',' to value_is_done_parsing() 2012-04-17 08:59:19 +02:00
Benjamin Otte
04c5fdaca6 css: Remove old animation code
Deprecate public API where appropriate and make it no-ops.
Remove all calls to it.
Get rid of the 'transition' css property.

For now, this means spinners don't animate anymore.
2012-04-17 08:59:19 +02:00
Benjamin Otte
dcd54e20d1 css: Remove GtkCssNumber
It's completely replaced by GtkCssNumberValue now.
2012-04-17 08:59:19 +02:00
Benjamin Otte
1b69f1d7c2 linear-gradient: Convert from GtkCssNumber to GtkCssValue 2012-04-17 08:59:19 +02:00
Benjamin Otte
1170ecfd2e cssvalue: Convert border-image-width to border value 2012-04-17 08:59:19 +02:00
Benjamin Otte
56f79fecce cssvalue: Add a border value
.. and parse border-image-slice with it.
2012-04-17 08:59:18 +02:00
Benjamin Otte
cfc6462730 cssvalue: Add a cssvalue for background-size 2012-04-17 08:59:18 +02:00
Benjamin Otte
f785f7177c cssvalue: Add a custom value for repeats
In particular, that's background-repeat and border-image-repeat.

Also, fix up the border-image shorthand to allow any order.
2012-04-17 08:59:18 +02:00
Benjamin Otte
5377169ef3 cssvalue: Add a value for background-position 2012-04-17 08:59:18 +02:00
Benjamin Otte
aed7600425 cssvalue: Add a css value for engines 2012-04-17 08:59:18 +02:00
Benjamin Otte
4f63c1c7ca cssstyleproperty: Convert binding sets
Instead of keeping a custom GPtrArray, keep it as a GtkCssArrayValue of
GtkCssStringValue. This way, we gain equality comparisons and print
functions for free.
2012-04-17 08:59:18 +02:00
Benjamin Otte
edbc8e4f57 cssvalue: Add a value for border-radius corner properties
... and convert those properties to this value.
2012-04-17 08:59:18 +02:00
Benjamin Otte
05f2249d08 css: Make outline-offset a number property 2012-04-17 08:59:18 +02:00
Benjamin Otte
c366b5b8b7 shadow: Add equal and transition support
... and enable transitions for the shadow properties.
2012-04-17 08:59:18 +02:00
Benjamin Otte
ac6d61f6bb cssvalue: Add GtkCssShadowsValue
This is necessary because shadows get treated differently from other
lists when transitioning.
2012-04-17 08:59:18 +02:00
Benjamin Otte
b8ccda4140 shadow: Rewrite to store contents as values 2012-04-17 08:59:17 +02:00
Benjamin Otte
7bdcba189e shadow: Make color a GtkCssValue 2012-04-17 08:59:17 +02:00
Benjamin Otte
ca17270187 cssvalue: Make GtkCssShadowValue only hold one shadow
All the properties now are a GtkCssArrayValue of GtkCssSadowValue.
GtkCssArrayValue already does everything we want, so no need to
duplicate its funtionality.
2012-04-17 08:59:17 +02:00
Benjamin Otte
c5878e8f6f themingengine: Make _gtk_theming_engine_paint_spinner() args const 2012-04-17 08:59:17 +02:00
Benjamin Otte
b9ebe8c226 cssarrayvalue: Redo parsing arrays
Does 3 things:
1) Introduce a "none" array signleton
2) Get rid of memleaks in error paths
3) Reduce code in parse funcs
2012-04-17 08:59:17 +02:00
Benjamin Otte
580b5e4a83 stylecontext: Don't queue_resize() all the time
When a parent style context exists, there's no need to queue_resize() on
the widget, because the parent widget will call
gtk_style_context_validate() on us and _then_ we can call queue_resize()
if we have to.
2012-04-17 08:59:17 +02:00
Benjamin Otte
a8efb784d7 cssstyleproperty: Mark all animatable properties
Only the ones that can be animated are marked of course. So more work is
needed.
This is important for
  transition-property: all;
because it'll just animate all the properties that can be.
2012-04-17 08:59:17 +02:00
Benjamin Otte
ed45a3c2f0 cssstyleproperty: Add _gtk_css_style_property_is_animated() 2012-04-17 08:59:17 +02:00
Benjamin Otte
9e4341f730 css: Move enum to the only source file using it 2012-04-17 08:59:17 +02:00
Benjamin Otte
e597f4d6a9 cssvalue: Add transition support for images 2012-04-17 08:59:16 +02:00
Benjamin Otte
d853a8f2f7 cssimage: Add GtkCssImageCrossFade
Supports the cross-fade() css notation the way the old CSS3 specs did.

The main reason for adding it is supporting image transitions though.
2012-04-17 08:59:16 +02:00
Benjamin Otte
8ad8a4febf cssvalue: Add _gtk_css_value_to_string()
This is a tiny wrapper around _gtk_css_value_print().
It's intended for usage in gdb and printf debugging.
2012-04-17 08:59:16 +02:00
Benjamin Otte
41ce29767c cssstyleproperty: Add transition properties 2012-04-17 08:59:16 +02:00
Benjamin Otte
7511109103 cssvalue: Add GtkCssEaseValue
This is supposed to hold the transition-easing-function and
animation-easing-function values.
2012-04-17 08:59:16 +02:00
Benjamin Otte
2ff47ed26d cssvalue: Add a GtkCssValue for idents 2012-04-17 08:59:16 +02:00
Benjamin Otte
662d6787f3 css: Add <time> type to css number stuff 2012-04-17 08:59:16 +02:00
Benjamin Otte
68b7d3e410 computedvalues: Fix signage error 2012-04-17 08:59:16 +02:00
Benjamin Otte
a360e77a7b css: Remove _gtk_css_computed_values_get_value_by_name()
Now that we use an enum for the IDs, we don't need that function
anymore.
2012-04-17 08:59:16 +02:00
Benjamin Otte
31565139ba stylecontext: Convert _gtk_style_context_peek_property()
Take the property id instead of the name.
2012-04-17 08:59:15 +02:00
Benjamin Otte
5d8789680e css: Add an enum for all the style properties
So instead of using
  _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY
        (_gtk_style_property_lookup ("name")))
one can now use
  GTK_CSS_PROPERTY_NAME

Esaier, eh?
2012-04-17 08:59:15 +02:00
Benjamin Otte
1a9dfab825 cssvalue: Add _gtk_css_value_transition()
Returns a value that transitions between start and end or %NULL if the
values cannot be transitioned.

So far, all implementations but numbers and rgba return NULL.
2012-04-17 08:59:15 +02:00
Benjamin Otte
bf92f2f7ac cssvalue: Do a hacky conversion of font-size to a number value
Just store the value as px for now.

The font-size property needs a complete makeover anyway.
2012-04-17 08:59:15 +02:00
Benjamin Otte
ad05604b3e cssvalue: Convert 'font-family'
It's now a CssArrayValue filled with CssStringValue
2012-04-17 08:59:15 +02:00
Benjamin Otte
7c75611bc2 cssvalue: Add a custom value for strings 2012-04-17 08:59:15 +02:00
Benjamin Otte
0cce3520d3 cssprovider: Store widget style value as string
There's no need to turn it into a GtkCssValue, it's always a string.
2012-04-17 08:59:15 +02:00
Benjamin Otte
4ba9be5b97 cssvalue: Add GtkCssArea to the enum values
... and get rid of its GType.

This makes it non-queryable using gtk_style_context_get() but it used to
be a private struct anyway.
2012-04-17 08:59:15 +02:00
Benjamin Otte
8e17f9c233 switch: Set ACTIVE state flag with is_active property 2012-04-17 08:59:15 +02:00
Benjamin Otte
40982eabbb stylecontext: Keep the main style data around until revalidation 2012-04-17 08:59:15 +02:00
Benjamin Otte
751187aa0c stylecontext: Keep per-styleinfo data
Instead of having one global data structure, keep it per style info.
This means that we can do special tricks on the "global" style data.
2012-04-17 08:59:14 +02:00
Benjamin Otte
a737adadf8 stylecontext: Make style_data_lookup() not take a state anymore
Instead, use the current state of the style context.
2012-04-17 08:59:14 +02:00
Benjamin Otte
8c49cd97a7 cssvalue: Add a cssvalue for images 2012-04-17 08:59:14 +02:00
Benjamin Otte
d63b11e56b cssvalue: Add enum values for the pango enums
And fix the parser to conform to the CSS spec while at it.
2012-04-17 08:59:14 +02:00
Benjamin Otte
b65d17dda8 cssvalue: Make border styles be their own value
... and add them via gtkcssenumvalue.[ch] which will be used for all
enums.
2012-04-17 08:59:14 +02:00
Benjamin Otte
58b6d492b8 cssvalue: Add a custom RGBA value
Note: custom CSS properties still use the default GtkCssValue and always
will.
So there is a difference in css values used between those, even though
they both carry a GdkRGBA payload.
2012-04-17 08:59:14 +02:00
Benjamin Otte
dcec7a5529 cssstyleproperty: Make assign_value a vfunc 2012-04-17 08:59:14 +02:00
Benjamin Otte
81dfc2776e customproperty: Implement assign vfunc
I'm going to overwrite the GtkCssStyleProperty one, so better keep this
one.
2012-04-17 08:59:14 +02:00
Benjamin Otte
645309e98b shadow: Also rename files 2012-04-17 08:59:14 +02:00
Benjamin Otte
ec5c77a552 shadow: Rename to GtkCssShadowValue
I don't want to confuse css values with other stuff, so there.
2012-04-17 08:59:13 +02:00
Benjamin Otte
da40ba431d cssvalue: Remove unused function 2012-04-17 08:59:13 +02:00
Benjamin Otte
96948576bd shadow: Move parse function into GtkShadow
This way, we have less public API.
And gtkcssstylepropertyimpl.c looks less scary (only 1624 lines now).
2012-04-17 08:59:13 +02:00
Benjamin Otte
ccd443796c shadow: Make this a GtkCssValue 2012-04-17 08:59:13 +02:00
Benjamin Otte
38ac68790e shadow: Remove _gtk_shadow_get_resolved()
It's unused
2012-04-17 08:59:13 +02:00
Benjamin Otte
ca4a080c8a stylepropertyimpl: Make shadows unqueryable
Normal APIs couldn't use GtkShadow anyway as the type was private.
2012-04-17 08:59:13 +02:00
Benjamin Otte
281d094b42 theming: Use peek_property() calls to query shadows 2012-04-17 08:59:13 +02:00
Benjamin Otte
a33df2d1d6 cssvalue: Split number values into their own class 2012-04-17 08:59:13 +02:00
Benjamin Otte
f7c0c7677b cssstyleproperty: Make query func a vfunc
This will be needed soon.
2012-04-17 08:59:13 +02:00
Benjamin Otte
6ef76f4a92 customproperty: Add our own query_value function
I'm about to change the CssStyleProperty one, so better copy things
here.
2012-04-17 08:59:13 +02:00
Benjamin Otte
c8e57d63ec cssstyelproperty: Rempove specified-type and computed-type props
This removes the necessity to keep a GType associated with style
properties and code can now make use of GtkCssValue completely.
2012-04-17 08:59:13 +02:00
Benjamin Otte
75a5f04352 styleproperty: Remove default parse function
... and assert every style property brings its own.
2012-04-17 08:59:13 +02:00
Benjamin Otte
a5d001b2ba stylepropertyimpl: Add remaining parse functions 2012-04-17 08:59:12 +02:00
Benjamin Otte
0fdc287339 styleproperty: Simplify compute_value function
The compute_value fallback path is only needed for custom properties,
the real style properties have custom compute functions if they need
them already.
2012-04-17 08:59:12 +02:00
Benjamin Otte
7fbc583b88 css: Move shadow parse/print/compute funcs
They don't belong in the style funcs, as those are for custom
properties, and the shadow type is private.
2012-04-17 08:59:12 +02:00
Benjamin Otte
dd144c2bad stylepropertyimpl: Add parse funcs for enums 2012-04-17 08:59:12 +02:00
Benjamin Otte
86a387f571 stylepropertyimpl: Add color parsing function
This is in preparation for removing the specified type and computed type
properties from GtkCssStyleProperty, which is in preparation for really
using GtkCssValue classes and not GTypes.
2012-04-17 08:59:12 +02:00
Benjamin Otte
b5fc484c99 customproperty: Don't rely on querying style property
This way, we can remove type madness from GtkCssStyleProperty later.
2012-04-17 08:59:12 +02:00
Benjamin Otte
bc9060a591 styleproperty: Make gtk_style_property_register() not be valist
Instead, make the caller create a GtkCssValue in advance.
2012-04-17 08:59:12 +02:00
Benjamin Otte
ffe50c3b67 cssvalue: Add _gtk_css_value_equal()
For now, we return FALSE for all default css values, so this is not very
useful.

I also think of this as an optimization equal, not a guaranteed equal,
because we don't even have a notion of what "equal" means.

For example, for background-repeat, "repeat, repeat" and "repeat"
are functionally equivalent. But the cssvalue has no idea that it's used
for background-repeat.
As a more complicated example, "repeat, no-repeat" and "repeat" are
equal to what one sees as long as there's only one image listed
background-image-source. But once you start transition'ing to an image
with 2 sources, it's different...
2012-04-17 08:59:12 +02:00
Benjamin Otte
b0e764000f cssparser: Use _gtk_css_parser_error_full() 2012-04-17 08:59:12 +02:00