Commit Graph

35078 Commits

Author SHA1 Message Date
Alexander Larsson
721c384f4f icon helper: Support scaled icons 2013-06-28 12:17:45 +02:00
Alexander Larsson
c00611ca32 icon factory: Support scaled icons
Dupport 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_pattern
which renders to a cairo_pattern_t which includes whatever scaling you
need for scaled icons.
2013-06-28 12:17:45 +02:00
Carlos Garnacho
a5698f6c06 icontheme: Add support for high resolution icons
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
2013-06-28 12:17:45 +02:00
Alexander Larsson
afb8f614f4 GtkIconHelper: render to cairo pattern rather than pixbuf for drawing
We render the source into a cairo_patter_t into a pixbuf so that
we can render it directly, rather than having to convert it every
time we render. We also specify the target window when creating
the cairo surface so that rendering can be faster.
2013-06-28 12:17:45 +02:00
Alexander Larsson
98481e95aa CellRendererPixbuf: Set the window on the icon helper
This lets us get scaled icons if needed.
2013-06-28 12:17:45 +02:00
Alexander Larsson
b85c053e28 spinbutton: set the window on the icon helper 2013-06-28 12:17:45 +02:00
Alexander Larsson
338f959bb5 entry: Set the window on the icon helper 2013-06-28 12:17:45 +02:00
Alexander Larsson
c3807bb122 GtkImage: Set the window on the gtkiconhelper 2013-06-28 12:17:45 +02:00
Alexander Larsson
a6e4f5f0c4 GtkIconHelper: Add set_window()
This is a hint on where the icon will be drawn. It
will allow us to pre-allocate cairo surfaces for the right
target.
2013-06-28 12:17:45 +02:00
Alexander Larsson
c64b269019 Use gdk_cairo_pixbuf_to_surface when possible
Rather than creating a surface and drawing to it.
2013-06-28 12:17:45 +02:00
Alexander Larsson
a543702beb stylecontext: add gtk_render_icon_pattern
This draws an icon from a cairo_pattern. 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.
2013-06-28 12:17:45 +02:00
Alexander Larsson
d9abadbcee gdk: Add gdk_cairo_pixbuf_to_surface 2013-06-28 12:17:45 +02:00
Alexander Larsson
e1ed8b50de gdk: add gdk_window_create_similar_image_surface
This lets us create image surfaces that render faster on specific windows.
It also supports creating scaled image surfaces.
2013-06-28 12:17:44 +02:00
Alexander Larsson
04e4814f4f Add GDK_DPI_SCALE env var
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.
2013-06-28 12:17:44 +02:00
Alexander Larsson
a15998db18 x11: Initial cut at supporting window scaling for X11
If you set GDK_SCALE=2 in the environment then all windows will be
scaled by 2. Its not an ideal solution as it doesn't handle
multi-monitors at different scales, and only affects gtk apps.
But it is a good starting points and will help a lot on HiDPI
laptops.
2013-06-28 12:17:38 +02:00
Alexander Larsson
42342d73b5 wayland: Support gdk_window_get_scale
We track the list of outputs each window is on, and set the
scale to the largest scale value of the outputs. Any time the scale
changes we also emit a configure event.
2013-06-28 12:11:58 +02:00
Alexander Larsson
25e9052610 wayland: Require wayland-client 1.1.90
This has the new methods required for buffer scaling.
2013-06-28 12:11:58 +02:00
Alexander Larsson
790f0cee51 wayland: Implement gdk_screen_get_monitor_scale()
We bind to the newer version of the wl_output which supports
the new done and scale events, and if we use this to get the
scale for each monitor (defaulting to 1 if not supported).
2013-06-28 12:11:58 +02:00
Alexander Larsson
26722dc1cb offscreenwindow: Handle window_scale
We create similar windows in the right way to get the
device scale right.
2013-06-28 12:11:58 +02:00
Alexander Larsson
78b774cc8e gdkwindow: Respect cairo surfaces with device scale
If a cairo_surface for a window has a device scale set we need
to respect this when creating a similar window. I.e. we want
to then automatically create a larger window which inherits
the scale from the original.

We also need to calculate a different device_offset if there
is a device_scale set.
2013-06-28 12:11:58 +02:00
Alexander Larsson
a95578e9e1 configure: Add buildtime check for cairo_surface_set_device_scale
We will need this for the window scale support, but its not yet
in a stable cairo release (or even on a master yet), so we make
this optional.
2013-06-28 12:11:58 +02:00
Alexander Larsson
d7abaae7bc pixel-cache: Refresh pixel cache on window scale factor changes. 2013-06-28 12:11:58 +02:00
Alexander Larsson
bb7e83399b Gtk: Use gdk_cairo_surface_create_similar 2013-06-28 12:11:57 +02:00
Alexander Larsson
6a98703c9a gdk: Add gdk_cairo_surface_create_similar
We track the window that each cairo surface is created for, which
allows us to use gdk_window_create_similar_surface() when creating
similar surfaces, even when you don't have access to the GdkWindow.
This will be extra important when we need to create larger surfaces
on HiDPI displays.
2013-06-28 12:11:57 +02:00
Michael Natterer
5931818450 gtk: add gtk_widget_get_scale_factor() 2013-06-28 12:11:57 +02:00
Michael Natterer
7c34f6221f quartz: Implement get_scale_factor() on screen and window
which return 1 normally and 2 on retina displays.
2013-06-28 12:11:57 +02:00
Michael Natterer
52d320e1a2 add gdk_screen_ and gdk_window_get_scale_factor()
These report the internal scaling factor, mapping from UI pixels
to hardware pixels.
2013-06-28 12:11:53 +02:00
William Jon McCann
b86588e9f5 Deprecate GtkImageMenuItem
Use GtkMenuItem for menus with only text or GMenu for those
with icons for "nouns" and just text for "verbs".
2013-06-27 18:48:46 -04:00
William Jon McCann
d741b7b873 Deprecate the gtk stock functions 2013-06-27 17:51:38 -04:00
William Jon McCann
a02f2c4291 Make ignored settings be set to false by default 2013-06-27 17:02:58 -04:00
Rico Tzschichholz
b5863f38a0 docs: Don't drop xml/gtkstock.xml 2013-06-27 21:14:07 +02:00
Emilio Pozuelo Monfort
f19c3896d0 menushell: don't activate a menu entry when opening a big menu
If a menu is opened and it doesn't fit entirely below or above
the menu bar, gtk+ will place it on top. The button release will
then activate the popup item that happens to appear under the
cursor. Avoid this by ignoring release events if they originated
in the parent menu bar and the duration of the press was too short.

https://bugzilla.gnome.org/show_bug.cgi?id=703069
2013-06-27 20:20:53 +02:00
Rico Tzschichholz
b39ce832ce build: Fix make dist 2013-06-27 19:43:47 +02:00
Emanuele Aina
4eddc00911 docs: Add GtkListBox functions to their section and fix links
https://bugzilla.gnome.org/show_bug.cgi?id=702981
2013-06-27 16:28:40 +02:00
William Jon McCann
6e028767d0 Fix default value of scrolled window placement-set property
To make the testsuite happy.
2013-06-26 22:07:00 -04:00
William Jon McCann
fbbcb5c01b Disable primary paste by default 2013-06-26 21:41:45 -04:00
William Jon McCann
8e69f87a46 Fixup some of the example widgets used in the docs 2013-06-26 21:35:40 -04:00
William Jon McCann
aef9dca9d5 Deprecate GtkIconFactory, GtkIconSet, GtkIconSource
We want to use GtkIconTheme instead. It is worth noting that
the parts that remain undeprecated are GtkIconSize and gtk_icon_size_lookup.
2013-06-26 20:02:27 -04:00
William Jon McCann
88177d8bd1 Don't use a GtkIconSet to pick the logo image
Just use the first pixbuf in the default list.
2013-06-26 18:48:03 -04:00
William Jon McCann
e779e04bc2 Deprecate and ignore gtk-icon-sizes setting
We don't have icons rendered at arbitrary sizes and we have better
APIs that aren't restricted to GtkIconSizes.
2013-06-26 18:04:27 -04:00
William Jon McCann
3e96625411 Remove the rest of gtk-touchscreen-mode 2013-06-26 15:35:47 -04:00
William Jon McCann
b101d465be Deprecate and ignore gtk-keynav-cursor-only and gtk-keynav-wrap-around 2013-06-26 15:33:10 -04:00
William Jon McCann
b26c74e5da Deprecate and ignore gtk-menu-bar-accel setting
Use 'F10' by default.
2013-06-26 14:21:44 -04:00
William Jon McCann
76936193d5 Deprecate and ignore gtk-menu popup and popdown delay settings
Just pick good defaults. The a11y team confirmed that they don't
rely on them.
2013-06-26 14:08:37 -04:00
William Jon McCann
e7b5be93b1 Deprecate and ignore gtk-scrolled-window-placement
Just use GTK_CORNER_TOP_LEFT and allow it to be changed with
gtk_scrolled_window_set_placement().
2013-06-26 13:06:12 -04:00
William Jon McCann
aa78c888eb Deprecate and ignore gtk-fallback-icon-theme
The standard icon themes have built in fallbacks.
2013-06-26 12:47:43 -04:00
William Jon McCann
b2e666bf8f Deprecate and ignore the cursor blink settings
And hardcode them to reasonable values.
2013-06-26 12:32:31 -04:00
William Jon McCann
2d79334bb0 Deprecate and ignore gtk-can-change-accels
It is disabled by default
2013-06-26 12:00:42 -04:00
William Jon McCann
7cfa7e6b72 Mark gtk-color-palette as deprecated
It is only used by the deprecated color selector widget.
2013-06-26 11:47:32 -04:00
William Jon McCann
7e3a494fac Deprecate and ignore gtk-enable-mnemonics and gtk-auto-mnemonics" properties
They are both enabled by default.
2013-06-26 11:16:12 -04:00