Commit Graph

60684 Commits

Author SHA1 Message Date
Alexander Larsson
904eecd1ed icon paintable: Replace get_filename and get_resource_path with get_file()
This returns a GFile which can represent both the above.
2020-02-10 12:33:17 +01:00
Alexander Larsson
344ad65031 Rename GTK_ICON_LOOKUP_LOAD_IN_THREAD to GTK_ICON_LOOKUP_PRELOAD 2020-02-10 11:43:47 +01:00
Alexander Larsson
14b3b684ef icontheme: Always return some icon name in get_icon_name() for lookup results
If you called gtk_icon_theme_lookup(), then always return some useful
icon name from gtk_icon_paintable_get_icon_name(), even if we picked
an unthemed icon.

Also rewrite the gtk_icon_paintable_get_icon_name() docs to make this
clearer.
2020-02-10 11:40:00 +01:00
Alexander Larsson
24fede0225 GtkIconHelper: Trigger preload when css sizes is valid
When the css is validated we know the css size, so we can
create the paintable at that point, and we do so passing the
LOAD_IN_THREAD flag.

This causes us to load most icons early on, in parallel instead of
during the first snapshot.
2020-02-07 17:26:22 +01:00
Alexander Larsson
e27413a9ed icon-theme: Add GTK_ICON_LOOKUP_LOAD_IN_THREAD flag
This causes lookup to trigger a thread that loads the icon texture.
2020-02-07 17:25:18 +01:00
Alexander Larsson
bdbafe63f9 icontheme: Optimize memory use and lookup speed by internalizing icon names
Instead of having the IconTheme have a hashtable that owns
individual strings and then IconThemeDirSize have a similar
hash (but with the strings owned by the other hash), we
have a consecutive memory chunks where we store the icon names
and then the hashtable has pointers into this.

This means we can avoid a bunch of individual strdup()s in a
way that is less fragmented and wastes less space. Additionally,
since we do an initial lookup anyway we have the internalized
icon name during lookup which means we can use g_direct_hash/equal
instead of g_str_hash/equal making the lookup faster too.
2020-02-07 12:00:52 +01:00
Alexander Larsson
2be29f982d Remove stray space 2020-02-07 08:44:46 +01:00
Alexander Larsson
79699cc20d Use G_OBJECT_TYPE_NAME instead of g_type_name_from_instance 2020-02-07 08:44:29 +01:00
Alexander Larsson
a772bf7517 Add gtk_icon_paintable_get_resource_path()
Also, return NULL from gtk_icon_paintable_get_filename() if the path
is really a resource path.
2020-02-06 17:47:57 +01:00
Alexander Larsson
57ecb2829a Add gtk_icon_paintable_get_icon_name()
This allows you to see which icon was actually chosen.
2020-02-06 17:47:57 +01:00
Alexander Larsson
d45d604df1 Remove gtk_icon_paintable_download_texture() public API
This allows us do do what we want internally, and anyway it didn't
really do what you'd expect anymore now that we do resizing during
rendering.
2020-02-06 17:47:57 +01:00
Alexander Larsson
6317fd3529 Replace last users of gtk_icon_paintable_download_texture ()
These now render the paintable to a cairo surface and convert that
to a texture. This is sort of a hack, but its only used in two
special cases internally and in two hacky test apps.
2020-02-06 17:47:56 +01:00
Alexander Larsson
8282698201 textview: Use paintables instead of textures, and fix the support
This changes gtk_text_buffer_insert_texture() to
gtk_text_buffer_insert_paintable() which is strictly more useful
(as textures are paintables). It also fixes the code to actually
support drawing the paintables (as well as tracking changes
to the paintables.
2020-02-06 17:47:56 +01:00
Alexander Larsson
fcc3c12919 gtk_css_style_snapshot_icon_paintable: Fix uninitialized memory access
We were reading the foreground color alpha even when we didn't read it.
2020-02-06 17:47:56 +01:00
Alexander Larsson
7c73f2fb02 GskPango: Allow specifying a custom shape snapshot handler
We will need this for GtkTextView to render the textures in it.
2020-02-06 17:47:56 +01:00
Alexander Larsson
6ff9f2198d GtkBuilder: Directly load the fallback missing image
No need for all this complexity with the icon theme, especially when
its now a lot more work to get the texture back. We can just load
the pixbuf.
2020-02-06 17:47:56 +01:00
Alexander Larsson
1c253f5dfa icontheme: Move IMAGE_MISSING_RESOURCE_PATH to (private) header
This way other code can use this resource too for fallbacks, avoing
having to go through the icon theme.
2020-02-06 17:47:56 +01:00
Alexander Larsson
a0533923fb icontheme: Handle GEmblemIcon in lookup_by_gicon() 2020-02-06 17:47:52 +01:00
Alexander Larsson
8788c76bd9 icon theme: Also never fail in gtk_icon_theme_lookup_by_gicon()
Similar to regular lookups, if the icon is some unknown type we return
a missing-image.
2020-02-06 10:26:15 +01:00
Alexander Larsson
6865744034 Remove unnecessary image-missing fallbacks
We now always return something from icon theme lookups, so no need to
do custom fallbacks.
2020-02-06 09:50:04 +01:00
Alexander Larsson
de02769a2f icon-theme: Don't pre-scale pixbufs in gtk_icon_theme_lookup_by_gicon
We do scaling during rendering now anyway.
2020-02-06 09:45:03 +01:00
Alexander Larsson
d69f7fd63e IconTheme: Never fail a lookup or icon load
If icon lookup fails or if loading it fails later, just always
fall back to the built in image-missing icon. Nobody is handling
missing icons in a sane way anyway.

If you *truly* need to handle missing icons, you need to manually
use gtk_icon_theme_has_icon().

While changing the loading code I also fixed an issue where it
was always passing "png" to pixbuf, now it also handles "xpm" if
that is the filename suffix.
2020-02-06 09:38:25 +01:00
Alexander Larsson
adccd1391e Support aspect=TRUE in _gdk_pixbuf_new_from_stream_at_scale
The icon theme test failed without this, and we *should* handle
it if we're accepting the argument.
2020-02-06 09:38:25 +01:00
Alexander Larsson
b529f77827 IconTheme: Simplify icon scaling
We had a pretty complex setup where we tried to avoid scaling up themes from dirs
that specified a size. However, not only was it very complex, but it didn't quite
work with window scales, because when using e.g. a size 32 directory for 16@2x
the dir size is wrong anyway. Additionally it turns out most code either picks
an existing icon size, or uses the FORCE_SIZE flags, so it doesn't seem
like a useful behaviour.

This change drops the FORCE_SIZE flags, and always scales
icons. Additionally it moves the scaling of the icon to rendering,
which seems more modern, and allows us to (later) share icons loaded
for different sizes that happened to use the same source file (at
different scales).

Note that this changes the behaviour of
gtk_icon_paintable_download_texture() is it now returns the unscaled
source icon. However, ignore thats, as I plan to remove this function
and replace it with a way to render a paintable to a cairo-surface
instead.
2020-02-06 09:38:25 +01:00
Alexander Larsson
021aaef824 GtkIconPaintable: Always recolor when snapshotting.
It never makes sense to paint a texture that needs recoloring. If
you call the regular snapshot on a symbolic texture we just use the
default recoloring colors.

To support this we also change gtk_css_style_snapshot_icon_paintable()
to call gtk_icon_paintable_snapshot_with_colors() for IconPaintables
so that we get the correct colors, and we make it not emit the color
matrix.

Since we now rely on the icon to do the recoloring we also drop the
recolor argument in gtk_icon_paintable_snapshot_with_colors() as its
not needed anymore.
2020-02-06 09:38:25 +01:00
Alexander Larsson
c691399a80 icontheme: Align function arguments 2020-02-06 09:38:25 +01:00
Matthias Clasen
2f369b6d7a Merge branch 'kill-simple-search' into 'master'
Remove simple search engine

See merge request GNOME/gtk!1393
2020-02-06 06:38:17 +00:00
Matthias Clasen
8703c7b7ac Merge branch 'better-test-isolation-2' into 'master'
Better test isolation

See merge request GNOME/gtk!1391
2020-02-06 04:53:07 +00:00
Matthias Clasen
e41e8072b1 css tests: Ignore ".csd" vs ".solid-csd"
It it hard to control which of the csd style classes we get,
since it depends on details of the X server or compositor.

Explicitly ignore this difference by replacing .solid-csd
with .csd in the output.
2020-02-05 23:35:39 -05:00
Matthias Clasen
d1bd1270c9 testsuite: Make tests run without a11y bus
Not having an a11y bus around causes warnings from
at-spi, which make tests fail. Explicitly ignore those
warnings.
2020-02-05 22:24:39 -05:00
Matthias Clasen
34cc68003c testsuite: Fix bloomfilter style tests
The results were expecting solid-csd, which is not what
we usually have.
2020-02-05 22:23:52 -05:00
Matthias Clasen
ac7dd02f8f Merge branch 'master.msvc' into 'master'
Fix building recent GTK master on Visual Studio

See merge request GNOME/gtk!1369
2020-02-05 18:26:22 +00:00
Matthias Clasen
9746b728ca Merge branch 'public-emojichooser' into 'master'
emojichooser: Make public

See merge request GNOME/gtk!1382
2020-02-05 18:04:42 +00:00
Benjamin Otte
0ad791277a Merge branch 'wip/otte/css' into 'master'
Some CSS cleanup

See merge request GNOME/gtk!1389
2020-02-05 14:04:12 +00:00
Matthias Clasen
54f6515005 emojichooser: Add profiler marks for loading
This is a long-running operation, and worth showing
in traces.
2020-02-05 06:28:39 -05:00
Matthias Clasen
25c25ba5c1 icontheme: Fix various memory leaks
Tasks need to be unreffed too.
2020-02-05 06:28:39 -05:00
Matthias Clasen
fac435ba98 widget: Fix a memory leak with class actions
This code was doing the wrong thing even if the parent class
doesn't have actions.
2020-02-05 06:28:39 -05:00
Matthias Clasen
b996b85504 Add a lib64 variant of gtk.supp 2020-02-05 06:28:39 -05:00
Matthias Clasen
1cb575a138 icontheme: Remove some dead code 2020-02-05 06:28:39 -05:00
Matthias Clasen
9a446f2041 frameclock: cosmetics
Redo the profiler marks for the frame clock signals
to look more uniform.
2020-02-05 06:28:39 -05:00
Matthias Clasen
9e6ae7acd8 gdk: Silence some compiler warnings
These cause unused variable warnings in release builds.
2020-02-05 06:28:39 -05:00
Matthias Clasen
955305a034 treestore: Silence compiler warnings
This was causing compiler warnings in release builds.
2020-02-05 01:01:47 -05:00
Matthias Clasen
b1d5de78e1 notebook: Don't trigger criticals in dispose
When we dismantle our children in dispose, we
trigger a11y children-changed signals which end
up calling back into the notebook. Handle this
without critical warnings.
2020-02-05 01:01:47 -05:00
Matthias Clasen
47c21a255f textview: Don't update action state in dispose
Only update the action state when we have a text buffer,
there is no need to do it otherwise, since we are going
to get a buffer before we get shown. This avoids triggering
the action state updates from finalize, which is a bad
time to be recreating the action muxer.
2020-02-05 01:01:47 -05:00
Matthias Clasen
005ea7a09d entry: Avoid criticals in dispose
The accessible gets properties of the entry, and
resetting the entry icons triggers accessible change
notification, so do that before we dismantle the entry
too far to respond to a g_object_get () call.
2020-02-05 01:01:47 -05:00
Matthias Clasen
ed6c0dc15c Don't export color picker functions
This is not public API, so it shouldn't be exported.
2020-02-05 01:01:47 -05:00
Matthias Clasen
1e6171a4a7 Read bookmarks async
Do not block the main thread while reading the bookmarks file.
This speeds up initial setup of a GtkPlacesSidebar.
2020-02-05 01:01:47 -05:00
Matthias Clasen
85ad943832 placessidebar: Change some initial property values
Giving these properties the initial value that the file
chooser wants for them avoids some calls to update_places
in the setup code.
2020-02-05 01:01:47 -05:00
Matthias Clasen
b7b251019e testperf: More flexible mark selection
Allow selecting marks not just by their name, but
also by the message detail.
2020-02-05 00:46:47 -05:00
Matthias Clasen
ed742f1d6c testperf: Allow measuring start time
This can be used e.g. to measure how long it takes us
to get the first frame on screen.
2020-02-05 00:46:39 -05:00