Other code assumes that the widget has a window if it is realized.
Since we might trigger such code indirectly from gtk_window_realize,
don't mark the window as realized before we've registered its window.
Since we now do all drawing propagation on the cairo_t (rather than
exposing multiple independent times on the GdkWindows) we no longer
need the opacity 0.999 hack.
We render the source into a cairo_surface_t so that we can render it
with cairo directly, rather than having to convert it from a pixbuf
every time. We also specify the target window when creating the cairo
surface so that rendering can be faster.
Using cairo surfaces also allows us to seamlessly support window scales.
We also add a GTK_IMAGE_SURFACE source type.
Support scales when falling back to loading icons from the
icon theme.
In order to actually render scaled icons we add
gtk_icon_set_render_icon_surface which renders to a cairo_surface_t
which includes whatever scaling you need for scaled icons.
This draws an icon from a cairo_surface. We want to use this more rather
than render_icon as this means we can skip the pixbuf to surface
conversion (including allocation and alpha premultiplication) at
render time, plus we can use create_similar_image which may allow
faster rendering.
An optional OutputScale integer key has been added to index.theme
subdirs description, so icon themes may provide icons that are
more suitable to render at a (typically 2x) integer upscaled
resolution. This way it is possible to make eg. a 16x16@2x icon has a
real size of 32x32, but contains a similar level of detail to the
16x16 icon so things don't look any more cluttered on high-dpi
screens.
The pixbuf lookup has changed so it prefers a minimal scale change
that yields the minimal real size difference, so if looking up for
a 16x16 icon at 2x, it would first prefer 16x16@2x, then 32x32, and
then any other icon that's closest to match
There is now *_for_scale() variants for all GtkIconTheme ways
to directly or indirectly fetch a GdkPixbuf.
This is based on code by Carlos Garnacho with changes by Alexander
Larsson
We need to be able to compute different GtkCssImage values
depending on the scale, and we need this at compute time so that
we don't need to read any images other than the scale in used (to
e.g. calculate the image size). GtkStyleProviderPrivate is shared
for all style contexts, so its not right.
This is very useful for hidpi where the dpi is scaled to make
non-dpi aware apps larger. In that case a dpi aware gtk+ using
GDK_SCALE will be getting huge fonts. You can the set GDK_DPI_SCALE
to compensate for this.
Group the buttons on each side in a box, and give them different
style classes, so themes can differentiate (this is partially a
workaround for limitations in our css selectors). The boxes also
let us add a margin below the buttons, without affecting the
allocation of the buttons themselves.