Commit Graph

389 Commits

Author SHA1 Message Date
Timm Bäder
eeec6f8fb9 icontheme: Annotate return value as nullable 2019-09-09 17:36:26 +02:00
Timm Bäder
71339225eb icontheme: Remove gtk_icon_info_load_texture
It's the same as load_icon now.
2019-09-09 17:36:26 +02:00
Timm Bäder
590e70d4d1 icontheme: Return a paintable from gtk_icon_info_load_icon 2019-09-09 17:36:26 +02:00
Timm Bäder
fd16ac4d5e icontheme: Return paintables from more API 2019-09-09 17:36:26 +02:00
Timm Bäder
f3099afcc5 icontheme: Return textures from load_icon{,_for_scale} 2019-09-09 17:36:26 +02:00
Timm Bäder
e0fe2882ad icontheme: Don't try to scale pixbufs to same size 2019-09-09 17:36:26 +02:00
Timm Bäder
2ffbb37783 icontheme: Annotate return value of load_icon as nullable
It returns NULL in the error case.
2019-09-09 17:36:26 +02:00
Timm Bäder
6821fe0c13 icontheme: Add error argument to _load_texture
Loading an icon might fail.
2019-09-09 17:36:26 +02:00
Timm Bäder
a0947232fa icontheme: optimize icon_uri_is_symbolic as well 2019-09-09 17:36:26 +02:00
Timm Bäder
d98e05b91a icontheme: Save the min_suffix for the min_dir
We already have to compute that value in the loop before, so just save
it.
2019-09-09 17:36:26 +02:00
Timm Bäder
fa85f4fc2e icontheme: Remove use_builtin parameter from theme_lookup_icon
Unused.
2019-09-09 17:36:26 +02:00
Timm Bäder
44352b375e icontheme: Remove paramter from get_icon_suffix
Turns out nobody care about that one.
2019-09-09 17:36:26 +02:00
Timm Bäder
ebe88ea322 icontheme: Optimize icon_name_is_symbolic
We call this function *a lot* it's doing lots of unnecessary work inside
g_str_has_suffix. Get the icon name length only once instead and
open-code the suffix check.
2019-09-09 17:36:26 +02:00
Timm Bäder
6d77723fe0 gtkicontheme: Avoid a get_icon_flags call
We're only using the value of the first call at all if
symbolic_suffix & ICON_SUFFIX_PNG is FALSE.
2019-09-09 17:36:26 +02:00
Timm Bäder
c5ed51a188 icontheme: Remove outdated comment
It's not called css_fg anymore and it can't possibly be NULL since we
make sure before passing it here.
2019-09-09 17:36:25 +02:00
Дилян Палаузов
6ded38de2b Minor typos in the Documentation (a/an) 2019-08-25 12:52:46 +00:00
Jonas Ådahl
048957cd49 gtk/icon-theme: Handle lack of SVG loader gracefully
When loading a SVG icon from a gresource file only containing SVG icons,
but without having a SVG loader available in gdk-pixbuf, we would crash
when trying to eventually load the resource. Fix this by gracefully
handling this by simply failing to load the icon, while the first time
it happens, log a warning.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2084
2019-08-08 09:05:30 +02:00
Christian Hergert
f507a79056 marshallers: ensure g_cclosure_marshal_VOID__VOIDv is used
If we set c_marshaller manually, then g_signal_newv() will not setup a
va_marshaller for us. However, if we provide c_marshaller as NULL, it will
setup both the c_marshaller (to g_cclosure_marshal_VOID__VOID) and
va_marshaller (to g_cclosure_marshal_VOID__VOIDv) for us.
2019-05-29 13:22:31 -07:00
Matthias Clasen
96eefd49fa icon theme: Make final
Nobody should subclass GtkIconTheme or GtkIconInfo.
2019-05-26 15:33:10 -04:00
Matthias Clasen
4df2a4c82c icon theme: Remove fallbacks
We want to include all needed icons as resources,
so disable the fallbacks and see what comes up.
2019-02-12 17:34:43 -05:00
Emmanuele Bassi
25fd230327 gtk: Drop the "plus"
Source names should use "[gtk]" without the plus.
2019-02-05 11:26:20 +01:00
Luca Bacci
a52989842e Win32: Fix typo on compilation speedup macro define
There is a typo, the correct macro to define is WIN32_LEAN_AND_MEAN.
After this change <shellapi.h> must be included in order to use
ExtractIconExW().
2018-12-22 01:18:17 +01:00
Philip Chimento
284d909347 icontheme: Recolor <polygon> elements in SVGs too
Otherwise, it's possible to have a symbolic icon where some of the
shapes keep the #bebebe chroma key color.
2018-12-08 01:40:32 +00:00
Federico Mena Quintero
e5f9bf2e9b (#1471): base64-encode included SVGs to avoid mis-escaped characters
We wrap SVG data from icons within another SVG with extra styling
information.  The wrapped SVG may contain characters that cannot be
part of a data: URL (https://fetch.spec.whatwg.org/#data-urls).

Librsvg 2.45 got more strict in its parsing of data: URLs; whereas
previously it ignored '#' characters in them, now it considers them to
be the start of a fragment identifier, which is not allowed in data:
URLs anyway.

To avoid unallowed characters, we now create a data: URL with a
base-64 encoded SVG.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1471
2018-11-27 13:57:21 -06:00
Timm Bäder
797739198f icontheme: Stop exporting gtk_icon_info_new_for_file 2018-11-08 05:48:14 +01:00
Timm Bäder
0c017ff109 icontheme: Stop exporting gtk_icon_theme_color_symbolic_pixbuf 2018-11-08 05:48:14 +01:00
Timm Bäder
aad3686726 icontheme: Drop remaining emblem code 2018-11-08 05:48:14 +01:00
Timm Bäder
fe7a2635d0 icontheme: Don't reference nonexistent parameter in docs 2018-11-08 05:48:14 +01:00
Timm Bäder
2834b38d2c icontheme: Use a bit field in AsyncSymbolicData
176 -> 144 bytes
2018-11-08 05:48:14 +01:00
Timm Bäder
29563a33ba icontheme: Stop strdup'ing css colors when loading
... symbolic icons.
2018-11-08 05:48:10 +01:00
Jehan
04367acf9b gtk: also recolor circle and ellipse in symbolic SVG icons. 2018-06-23 00:35:17 +02:00
Jan Alexander Steffens (heftig)
1e06838c1c
icontheme: Keep dir_mtimes in order
Don't reverse the order each time we insert a theme. Reverse it only
once, after all themes have been loaded.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1115
2018-05-23 20:06:01 +02:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Benjamin Otte
af18796312 icontheme: Remove surface support
It's not used anymore.
2018-03-16 06:04:45 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
a379ddefc3 Remove leading underscore from private symbols
There's no need to do that any more, as only explicitly annotated
symbols are exported.
2018-02-01 16:05:58 +01:00
Emmanuele Bassi
e090c1f1a9 Rename gtkiconcache.h
The gtkiconcache.h header is private, so rename it to follow the naming
scheme for private headers.
2018-02-01 15:34:57 +01:00
Matthias Clasen
461d05f643 icon theme: Make logging per-display
As far as possible, for now. This needs some more
work to cover all locations.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c088d69f93 icon theme: Remove unused code
The deprecated api to add builtin icons was removed
a year ago, so we don't need the code anymore that deals
with looking up builtin icons.
2017-11-29 22:25:57 -05:00
Matthias Clasen
0d23606653 Drop gtk_icon_size_lookup
Add a new, private gtk_image_get_image_size to replace it, and
update the remaining callers in a suitable way.
2017-11-15 14:22:17 -05:00
Matthias Clasen
2301d8d90b enums: Change GtkIconSize values
The new values are the ones we intend to keep. The old ones had
duplicated meanings and nobody knew which one to take.
2017-11-15 14:22:17 -05:00
Matthias Clasen
724863c275 icontheme: Add a trailing / when enumerating resources
This avoids extra string copies in GResource.
2017-11-13 12:13:42 -05:00
Matthias Clasen
ec1ea0db04 icontheme: Append a / to the resource path
g_resources_enumerate_children expects the path to end
in a '/' (even though thats not stated in the docs), and
will copy it if that isn't the case. Avoid the copy
by putting  a '/' there to begin with.
2017-11-13 07:33:35 -05:00
Matthias Clasen
1da7dc890c Make the recoloring code more robust
Pass both width+height and scale, so we can handle the case
where width+height are zero and we are using the file, scaled.
2017-11-07 21:27:38 -05:00
Matthias Clasen
284fd36e5d Fix symbolic.svg rendering
With the shader approach to symbolic recoloring, we must
not recolor the svgs anymore as we're loading them. Instead,
load them the same way that gtk-encode-symbolic-svg does.

This fixes the rendering of large symbolic icons e.g. the
'no search results found' page in the file chooser.
2017-11-07 18:56:32 -05:00
Benjamin Otte
8d849458ac docs: You can't modify textures
So there's no need to tell people they must not do that.
2017-11-05 00:07:17 +01:00
Benjamin Otte
ca3c23662c GskTexture => GdkTexture
We want this thing to replace GdkPixbuf, so it has to live in GDK.
2017-11-04 00:07:13 +01:00
Benjamin Otte
3967072c66 docs: Fix up some places that still said screen instead of display 2017-10-31 08:25:37 +01:00
Benjamin Otte
ecd5b399a4 icontheme: Use GdkDisplay instead of GdkScreen 2017-10-31 03:05:55 +01:00