Commit Graph

213 Commits

Author SHA1 Message Date
Benjamin Otte
a63ff72406 css: Convert border-radius to GtkCssNumber
We can do % now, wohoo!
2012-02-02 03:14:00 +01:00
Benjamin Otte
82c2dad178 themingengine: Add a private function to query lengths 2012-02-02 03:14:00 +01:00
Benjamin Otte
7a00a95508 themingengine: Move border-image handling into render_frame_internal()
This fixes 2 bugs:
1) extensions didn't get border images
2) border-images caused outlines to not be drawn
2012-01-09 18:38:00 +01:00
Benjamin Otte
c15839f4be themingengine: Implement outline support 2012-01-09 18:38:00 +01:00
Benjamin Otte
68cfb80631 themingengine: Split out the border drawing function 2012-01-09 18:38:00 +01:00
Benjamin Otte
1b9e15485e themingengine: Implement 'dotted' and 'dashed' 2012-01-09 18:38:00 +01:00
Benjamin Otte
998055c835 css: Introduce GtkCssSide
... and use it.

This is basically an encoding of the order of sides in CSS. So when
parsing things, this is the way we parse things in.
2012-01-09 18:37:59 +01:00
Benjamin Otte
9e8e9a77b7 themingengine: Implement ridge and groove 2012-01-09 18:37:59 +01:00
Benjamin Otte
4ce34a8e13 themingengine: Redo color handling
Don't work on malloc()ed colors. Instead, use an array on the heap. This
makes it easier to copy the array.
2012-01-09 18:37:59 +01:00
Benjamin Otte
d21e7506e7 themingengine: Refactor drawing code
... and implement 'double' border-style as proof-of-concept.
2012-01-09 18:37:59 +01:00
Paolo Borelli
b8aea82743 Use the border-style subproperties for drawing
Use the newly introduced per-side property to draw frames.
2012-01-09 18:37:59 +01:00
Benjamin Otte
066f3be659 themingengine: Remove an optimization
We optimize the case later on, so no need to do it here.
2012-01-09 18:37:58 +01:00
Benjamin Otte
fce45757cb borderimage: Change memory management
Making it a on-stack object simplifies things a lot.
2012-01-09 18:37:58 +01:00
Benjamin Otte
84bc280440 borderimage: Add _gtk_border_image_new_for_context()
and use it.
2012-01-09 18:37:57 +01:00
Benjamin Otte
53b4fd69db themingengine: Add _gtk_theming_engine_peek_property()
This is useful for getting at computed values and allows accessing
images before the code autoconverts them to a cairo pattern.
2012-01-09 18:37:57 +01:00
Benjamin Otte
9181282d88 style: Remove GtkStylePropertyContext again
We need to solve this differently. I have no idea yet how, but I'll
invent something later.

This only affects win32 theming and that's broken anyway.
2012-01-09 18:37:56 +01:00
Benjamin Otte
8ab426e6d5 themingengine: Don't use GtkBorderRadius struct
use GtkBorderCornerRadius instead. Also, don't do NULL checks anymore,
the property is guaranteed to never return NULL.
2012-01-09 18:37:54 +01:00
Benjamin Otte
73a632a4ae css: Handle custom properties in a custom object
This way we can also get rid of the hack where we required modifying the
pspec after creation, as the name is now a separate property.
2012-01-09 18:37:53 +01:00
Cosimo Cecchi
a7f3a9ff74 themingengine: split a GtkThemingBackground object
Allows easier modification and general sanity of the CSS background
rendering code.
2011-12-12 12:46:52 +01:00
Cosimo Cecchi
ae60f00ba4 themingengine: fix a typo 2011-11-29 10:52:03 -05:00
Cosimo Cecchi
41b56d87e7 themingengine: move code to make switch-case more clear
Code is more readable with the default case as the last one in the
switch block.
2011-11-29 10:52:02 -05:00
Alexander Larsson
eb44036346 Support border-image in theme_engine_render_frame_gap
This is similar to the normal frame rendering, but has a clip
region applied for the gap.
2011-11-28 10:05:29 +01:00
Alexander Larsson
75642d3af2 css: Always draw the bg color under the bg image 2011-11-25 16:14:20 +01:00
Alexander Larsson
8411f1a279 Implement background-clip and background-origin 2011-11-25 16:14:19 +01:00
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