Commit Graph

189 Commits

Author SHA1 Message Date
Alexander Larsson
5e04549548 Render background image if set for checks and options
The default theme engine draws a fallback check/radio image, but
doesn't let you replace this. We now check if a background image
is set and if so render that instead of the default fallbacks.
2011-11-17 12:30:09 +01:00
Alexander Larsson
2cf3ff956a Actually pass in a StylePropertyContext when getting images
This is in preparation for getting size-dependent results back
with the win32 themes.
2011-11-17 12:27:23 +01:00
Alexander Larsson
c09148ca09 Add GtkStylePropertyContext and use it in when getting style properties
At the toplevel we have _gtk_theming_engine_get, which lets us pass
in a property context with (atm) the size to get the property for.
Then there is a lot of plumbing to push this down into the lower
layers of the style property code until finally hitting
the property resolvers.

I need this because I will be adding a property resolver for win32
theme parts, and they render differently depending on the size
(i.e. they don't scale linearly). The idea is that the code
to get the background properties will pass in the final size
and we will resolve the theme part specification to that particular
size.

If the old non-context calls are used we just hardcode a size
of 100x100.
2011-11-17 12:27:22 +01:00
Cosimo Cecchi
f9d16f3923 themingengine: set the cairo extend to PAD when we're stretching bg
This avoids artifacts around the borders due to bilinear filtering cairo
applies to the surface pattern when stretching it.

https://bugzilla.gnome.org/show_bug.cgi?id=663522
2011-11-08 12:41:28 -05:00
Marc-André Lureau
3b436eec6d css: start background-repeat
By default, a background image is stretched. Instead, it is worth to
have a tiled background.

This patch allows background surfaces to be repeated or not, and should
be compatible with future extensions and CSS.

https://bugzilla.gnome.org/show_bug.cgi?id=663522
2011-11-08 11:10:44 -05:00
Michael Natterer
2688ccdbc4 gtk: clean up the private horror
- add gtkmodulesprivate.h and move stuff there from gtkprivate.h
- add gtkprivate.c and move stuff there from gtkmain.c
- add gtkwin32.c and move stuff there from gtkmain.c
- don't redefine GTK_DATADIR and friends in gtkprivate.h
- have _gtk_get_datadir() and friends on all platforms
- remove the horrid hacks where gtkprivate.h can't be included,
  or must be included later due to redefinition of the compile-time
  directories
2011-10-22 23:53:55 +02:00
Cosimo Cecchi
39f0a60792 themingengine: remove unused variable 2011-09-06 15:01:09 -04:00
Cosimo Cecchi
f5e758bd60 themingengine: remove xthickness FIXME from gtk_render_line() code
The gtk_render_line() code has a FIXME (coming from the 2.x migration I
suppose) about using xthickness, and it actually hardcodes two lines of
different color instead of drawing a single one.
Since we don't support xthickness anymore, make gtk_render_line() do
what it says, i.e. just draw an 1px line colored with the current
color.

https://bugzilla.gnome.org/show_bug.cgi?id=657963
2011-09-02 15:11:53 -04:00
Benjamin Otte
47635a2434 themingengine: Return NULL for nonexistant theming engines
his also makes the function conform to its documentation.
2011-07-21 02:43:54 +02:00
Benjamin Otte
b0b287f7b5 themingengine: Use the default way of indicating privates 2011-07-21 02:43:54 +02:00
Florian Müllner
7741f5a09a theming-engine: Adjust register_property() to recent glib change
GParamSpec now uses an intern'ed string for 'name', so the code
in gtk_theming_engine_register_property() which prefixes the name
with a namespace has to be adjusted.

https://bugzilla.gnome.org/show_bug.cgi?id=654695
2011-07-15 20:50:26 +02:00
Cosimo Cecchi
af77ba78bb themingengine: shrink the background size to the padding-box
This fixes a regression introduced by this commit [1] that causes
background to draw beyond the padding-box, which breaks rounded corners,
(in addition to not being compliant with what CSS does by default).

[1] http://git.gnome.org/browse/gtk+/commit/?id=c56700ca3029a9ab1362009bff35f2a70e432c02

https://bugzilla.gnome.org/show_bug.cgi?id=652618
2011-06-15 11:03:56 -04:00
Xan Lopez
b47c7405f2 themingengine: plug a couple of leaks 2011-06-15 14:13:20 +02:00
Benjamin Otte
a471b4b198 themingengine: Improve handling of different colors
We don't want to have different colors cause seams, so we try very hard
to render them at the same time.
2011-06-13 15:01:52 +02:00
Benjamin Otte
407b3f2cde themingengine: Implement support for multiple border colors
Also use this support to implement inset and outset border styles
without cheats.
2011-06-13 15:01:52 +02:00
Benjamin Otte
4f649e10fa themingengine: Add magic to draw inset/outset properly
Use a bunch of tricks to get inset/outset right with a small amount of
code. In particular, fix the hidden sides causing artifacts.

Included is a bunch of code comments explaining what we actually do.
2011-06-12 23:00:25 +02:00
Benjamin Otte
cd4c527451 themingengine: Reduce border to 0 on hidden sides
Fixes drawing of expanders.
2011-06-12 23:00:25 +02:00
Benjamin Otte
8b0bffc3a2 themingengine: Fix inset/outset drawing 2011-06-12 23:00:24 +02:00
Cosimo Cecchi
61c253a132 themingengine: set the right coordinates for the rounded box rect 2011-06-11 13:32:15 -04:00
Benjamin Otte
b196abe8be themingengine: Render inset box shadow on top of backgrounds 2011-06-11 09:29:43 +02:00
Benjamin Otte
40dfcfcbc4 themingengine: Draw border with GtkRoundedBox 2011-06-11 09:29:43 +02:00
Benjamin Otte
459278c5e1 themingengine: Use GtkRoundedBox for drawing backgrounds 2011-06-11 09:29:42 +02:00
Benjamin Otte
48814c8d1e themingengine: Do pattern merging smarter
Create an intermdiate surface and fill() with it later. Instead of doing
clip + paint twice.
2011-06-11 09:29:42 +02:00
Benjamin Otte
d8033c3796 themingengine: Get rid of extra variables
Now that we don't change the width/height anymore, we can keep using it
for scaling he background.
2011-06-11 09:29:42 +02:00
Benjamin Otte
117b50dd21 themingengine: remove unused variable 2011-06-11 09:29:42 +02:00
Benjamin Otte
c56700ca30 themingengine: background applies to full border
The code was attempting to only apply it to half of the border. But
according to CSS, the background area by default is the full border box.
2011-06-11 02:08:28 +02:00
Benjamin Otte
06642cab56 themingengine: Remove unnecessary optimization
Code is likely as fast or faster without it, and this saves code.
2011-06-11 02:04:17 +02:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Cosimo Cecchi
1208f2bde0 shadow: render icon-shadow for spinners 2011-06-09 23:17:09 +02:00
Cosimo Cecchi
0cd810ff7c themingengine: use cairo image surfaces to render state effects
This makes the code cleaner and allows this to be re-used in a
pixbuf-less future.
2011-06-09 23:17:09 +02:00
Cosimo Cecchi
2446aef0ea themingengine: add gtk_theming_engine_render_icon()
Renders a pixbuf in the provided rectangle, applying effects such as
'icon-shadow'.
2011-06-09 23:17:09 +02:00
Benjamin Otte
88026c5073 themingengine: Don't modify pattern
Instead, scale/unscale the cairo_t.
2011-06-09 05:51:54 +02:00
Cosimo Cecchi
9976530fe0 border-image: change Gtk9Slice to GtkBorderImage
It's a similar private type, which is much more powerful, and respects
the CSS rendering specification for border-image.

https://bugzilla.gnome.org/show_bug.cgi?id=651194
2011-06-09 05:51:53 +02:00
Benjamin Otte
8f6efd00e7 themingengine: Improve junction handling code
As junctions just modify the border radius and we now have a per-corner
border-radius, we can just set the border-radius to 0 for those corners
and get the same effect.
2011-06-02 02:03:52 +02:00
Benjamin Otte
91602cca6e themingengine: Add support for the border-radii 2011-06-02 02:03:51 +02:00
Benjamin Otte
962ecc6fa5 shadow: Redo shadow implementation for rotations
The shadows went bonkers when the labels were rotated
2011-05-22 05:56:12 +02:00
Benjamin Otte
ec34c4bd83 themingeninge: Handle translations properly
We want to keep the location of where to render, but transform th
context by the pango transform.
2011-05-22 05:56:12 +02:00
Cosimo Cecchi
8c65d9181d themingengine: use the text-shadow property to render text shadow
This also avoids hardcoding a shadow for insensitive text in the engine,
as it can now be applied from the theme directly.

https://bugzilla.gnome.org/show_bug.cgi?id=649314
2011-05-20 18:49:54 -04:00
Benjamin Otte
5084739756 themingengine: Set current point to 0,0 when rendering rotated layout
Otherwise the layout may move to who-knows-where
2011-05-12 23:40:26 +02:00
Cosimo Cecchi
6261b8434f themingengine: don't set a line width before saving the cairo context
https://bugzilla.gnome.org/show_bug.cgi?id=647086
2011-04-08 20:34:00 -04:00
Carlos Garnacho
ae22476931 theming: Implement non-uniform border-width in the theming engine.
The border-width CSS parameter takes up to 4 values, but it was
being ignored by the theming engine until now.
2011-03-29 19:39:34 +02:00
Carlos Garnacho
6834bace95 theming: Avoid boxed struct copies throughout the default engine 2011-03-29 19:39:22 +02:00
Cosimo Cecchi
1876823ef0 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.

https://bugzilla.gnome.org/show_bug.cgi?id=645405
2011-03-21 11:00:53 -04:00
Carlos Garcia Campos
21558ae67f themingengine: Use render_background_internal() to render handle background
Instead of using always the background color. This fixes handles that
have a background image like gnome-panel applets in a transparent
panel.

https://bugzilla.gnome.org/show_bug.cgi?id=644570
2011-03-12 20:32:42 -05:00
Benjamin Otte
8b17b16d63 theme: Fix spinner for inactive state.
Previously, the inactive state caused the spinner's solid line to be
drawn to the right. Now it's drawn to the top instead, which makes the
inactive state look more natural.
2011-03-05 15:03:56 +01:00
Benjamin Otte
9b8fbe5b72 theme: Make spinner animation turn clockwise 2011-03-05 15:03:56 +01:00
Benjamin Otte
2482847ecf theme: Make spinner steps count forward, not backward
This makes the spinner roate the right way again.
2011-03-05 15:03:56 +01:00
Benjamin Otte
de3616d52c theme: Make spinner drawing start with the solid line
Previously, for i == 0, we were drawing the translucent line first.
However, people reading the code would always assume the solid line is
indicated by the current step. So make the code do that.

Note that the spinner now rotates in the wrong direction. This will be
fixed in a future commit.
2011-03-05 15:03:56 +01:00
Benjamin Otte
41b5a6a900 theme: Compute scale values once
Use a local variable to store the xscale and yscale, so that it's only
computed once.
Makes it easier to do the changes I'm about to do.
2011-03-05 15:03:56 +01:00
Benjamin Otte
8c8dda6a6b theme: Do general cairo setup in one place
Also remove wrong comment.
2011-03-05 15:03:56 +01:00