Commit Graph

34112 Commits

Author SHA1 Message Date
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
Matthias Clasen
5c594fc46a Merge branch 'WindowsPrintDriverPreferencesMaster' into 'master'
Fixed bug that prevented GTK from storing printer driver preferences in the…

See merge request GNOME/gtk!397
2020-02-06 13:07:13 +00:00
Matthias Clasen
b6e2699409 notebook: Update arrows when text direction changes
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/103
2020-02-06 07:13:10 -05: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
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
1cb575a138 icontheme: Remove some dead code 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
Benjamin Otte
fcb08a28bf stylecontext: Remove unused typedef 2020-02-05 04:03:43 +01:00
Timm Bäder
b75d408d6d css: Make some local variables const 2020-02-05 04:03:43 +01:00
Timm Bäder
98b42f6740 css: Remove unused function 2020-02-05 04:03:43 +01:00
Timm Bäder
416182a20d style context: Remove parent relationship
We don't have foreign drawing anymore, so we don't need this.
2020-02-05 04:03:43 +01:00
Benjamin Otte
31713ab5ef stylecontext: Remove gtk_style_context_new()
It's private now, no more foreign drawing of any sort.

To be fair, it was entirely useless without widget paths already.
2020-02-05 04:03:43 +01:00
Benjamin Otte
db9730b734 stylecontext: Remove the "changed" signal
Instead, always go directly to the GtkWidget::css_changed() call.
2020-02-05 04:03:43 +01:00
Benjamin Otte
546a748cd8 widget: Replace style-updated signal with css_changed vfunc
1. Rename the thing
2. Turn it from a signal to a vfunc
3. Pass the GtkCssStyleChange to it

We don't export any public API about the GtkCssStyleChange yet, it's
just a boring opaque struct.
2020-02-05 02:46:13 +01:00
Benjamin Otte
8722837e67 pathbar: Remove unneeded code
The icons here are GIcons, they don't depend on the theme.
2020-02-05 00:18:41 +01:00
Benjamin Otte
3177ac4270 cssnode: Remove redundant check
We assert that cssnode->parent is NULL, no need to check it again.
2020-02-04 23:24:50 +01:00
Timm Bäder
903af75fa1 widget: Skip not-drawable widgets in snapshot_child
Otherwise we transform the snapshot just to not do anything.
2020-02-04 17:53:15 +01:00
Matthias Clasen
6640881711 maplistmodel: Add an example to the docs 2020-02-04 17:51:01 +01:00
Matthias Clasen
3bb8b56ab3 treelistmodel: Small documentation tweaks 2020-02-04 17:51:01 +01:00
Benjamin Otte
a1635719fc widgetfocus: Remove unnecessary check
Mapped widgets are always realized.
2020-02-04 17:51:01 +01:00
Benjamin Otte
3cb150abbe widget: Remove _gtk_widget_is_drawable()
Use _gtk_widget_get_mapped() instead.

Drawable checked visible && mapped and mapped widgets are always
visible, so that was an unnecessary check.
2020-02-04 17:51:01 +01:00
Benjamin Otte
cc22987b1b Merge branch 'wip/otte/icontheme' into 'master'
Do simple icontheme API cleanups

See merge request GNOME/gtk!1378
2020-02-04 16:36:46 +00:00
Alexander Larsson
410541f82b Rename GtkIcon to GtkIconPaintable 2020-02-04 17:19:22 +01:00
Benjamin Otte
c91be540c3 tooltip: Don't css-validate
That's a job for toplevels now.

See 17ca95a161 for the same comit on
popovers.
2020-02-04 17:19:04 +01:00
Benjamin Otte
138de60ab2 icontheme: Remove GENERIC_FALLBACKS
Instead, rely on people passing fallbacks explicitly.

Alternatively, GThemedIcon provides the functionality to create
fallbacks, which is what GtkImage and the testsuite now use.
That method is slightly better, too, so the expected test results
have been updated accordingly.
2020-02-04 16:51:54 +01:00
Benjamin Otte
571021cbc1 icontheme: Pass fallbacks as optional argument to lookup_icon()
This way, we can remove gtk_icon_theme_choose_icon() completely.
2020-02-04 16:51:54 +01:00
Benjamin Otte
f7a5dd7b8b icontheme: Remove contexts
There is no way to query contexts or do anything useful with them.

So don't keep track of them and don't make them an argument in public
APIs with the docs saying "I don't know what to use here, maybe read
some spec somewhere".
2020-02-04 16:51:54 +01:00
Benjamin Otte
544cd1acfc icontheme: Clean up includes 2020-02-04 16:43:59 +01:00
Benjamin Otte
4b96ba592f icontheme: Remove gtk_icon_get_base_size() and gtk_icon_get_base_dir()
Those functions are unused and the documentation says "Returns some
random number that the icon theme creator chose" which does not seem at
all useful and an implementation detail.

So get rid of it.
2020-02-04 16:43:59 +01:00
Benjamin Otte
3bba52ed67 icontheme: Remove crayon APIs
We expose no API to get at any colors for drawing symbolics, so we
shouldn't have APIs to draw with them.

Apart from that, those APIs look like a box of crayons, not like an
icontheme.
2020-02-04 16:43:59 +01:00
Benjamin Otte
48b9791989 icontheme: Remove gtk_icon_theme_rescan_if_needed()
If the icon theme needs to be rescanned, it should just do it.
If it doesn't, there's no need for this function.

Ergo: Don't have the function.
2020-02-04 16:43:59 +01:00
Benjamin Otte
4c3363b8c2 icontheme: Remove NO_SVG and FORCE_SVG flags
If the icon theme loads SVGs or not is an implementation detail and
should not be exposed in public API.
2020-02-04 16:41:36 +01:00
Benjamin Otte
10023b5d6d icontheme: Remove GTK_ICON_LOOKUP_USE_BUILTIN
It's unused.
2020-02-04 16:41:36 +01:00
Benjamin Otte
bbbe39fb44 icontheme: Make text direction a lookup argument
Most users were just forgetting to set the proper flags.
And flags aren't the right way to set this anyway, it was just
acceptable as a workaround during GTK3 to not break API.
2020-02-04 16:41:36 +01:00
Benjamin Otte
b713b9f68d icontheme: Remove async APIs
Widgets would not use them properly. In fact, the only user was using
them wrong.

As icons are loaded async by default, this call isn't necessary.
2020-02-04 16:41:36 +01:00
Benjamin Otte
bfebc2b01a icontheme: Remove gtk_icon_theme_get_default()
The API encouraged wrong usage - most of the users were indeed wrong.

Use the correct version instead:
  gtk_icon_theme_get_for_display (gtk_widget_get_display ())
2020-02-04 16:41:36 +01:00
Matthias Clasen
b8ffe5b245 css: Fix the initial values optimization
Fix up the index computation. We have duplicate entries
in the type enum, so to go from one of the 'initial' types
to it corresponding type you subtract one, but to find
the size array entry for a type, you divide by 2.
2020-02-04 12:19:23 +01:00
Alexander Larsson
046de4ccbf icon-theme: Only have one copy of the icon flags enum
It turns out with the icon cache now using the virtual SYMBOLIC_PNG_SUFFIX
flag the two enums are now identical, so lets just use one of them, the
one GtkIconCache (so we move it to the header).
2020-02-04 09:35:20 +01:00
Matthias Clasen
ef7172dc1e emojichooser: Make public
This is a useful widget to have, and it has minimal api.

Not having it public forces apps to recreate a lot of
complicated machinery for not good reason, if they need
an Emoji chooser in a different context.
2020-02-03 12:49:36 +01:00
Alexander Larsson
308d434b57 GtkIconCache: Remove unused code
We're not really using the icon theme cache much anymore, as the
individual per-directory hashes are no longer used, so delete all the
unused code.
2020-02-03 12:49:32 +01:00
Alexander Larsson
e4170661b9 IconTheme: Make icon lookups faster
Traditionally the icon lookup for a theme has been:

lookup (icon_name, size):
  best_directory = NULL
  forearch theme
    foreach directory in theme
       if dir_size_matches (directory, size) && dir_has_icon (directory, icon-name)
         best_directory = chose_best_size_dir (best_directory, directory)

if best_directory
  return icon from best_directory

However, it turns out that there are a lot of subdirectories which have the same
size, as they differ only in the (essentially useless) "context" value. For example
the "16x16/apps" subdirectory is essentially the same as the "16x16/actions" one.

So, instead rathern than keeping all the directories as separate we store the
all the directories with the same size as a single entity (DirSize) and the
icon lookup in that DirSize looks up not only which suffix to use for that icon
but also which subdir it is in.

Additionally we keep a hashtable with all icon names that are
available in the entire theme (i.e. all DirSizes), which allows use
both to store each icon name only once, but also to do a quick
negative lookup and early exit in case we're looking up an icon that
doesn't exist. This is pretty common because we often look up sets of
icons like "image-png-symbolic", "image-png", "image", expecting some
to fail.

This brings down the time of the initial css validation from 20msec to 15msec for
me when running icon-factory.
2020-02-03 12:49:26 +01:00
Alexander Larsson
0a8d7603ea icon-cache: Add new function to list all the icons in a directory
This lists the icons in a particular director, with their flags in a
hashtable. We also convert from "icon.symbolic" + SUFFIX_PNG to
"icon" + SUFFIX_SYMBOLIC_PNG.
2020-02-03 12:49:26 +01:00
Rico Tzschichholz
4ab12ab755 Remove last GtkWidgetPath reference
See 49b47c9133
2020-02-03 10:51:50 +01:00
Matthias Clasen
621120d1d3 css: Fix an oversight in style change computation
Take the 'color == NULL means currentColor' trick into account
when computing the changes between two styles.
2020-02-02 16:41:14 +01:00
Matthias Clasen
27223f7956 Merge branch 'initial-style' into 'master'
Make it easy to recognize initial style values

See merge request GNOME/gtk!1375
2020-02-01 12:52:44 +00:00
Matthias Clasen
5faf977f66 border: Don't render initial borders
Add a fast exist for comon case that the border
values are unset.
2020-02-01 09:12:12 +01:00
Matthias Clasen
7fbb37a09f background: Don't render initial backgrounds
Add a fast exit for the common case that the background
values are unset.
2020-02-01 09:11:39 +01:00
Matthias Clasen
7027fc9ab6 Make it easy to recognize initial style values
Reuse the type field in GtkCssValues to make initial
style values easily recognizable.
2020-02-01 09:11:22 +01:00
Matthias Clasen
7479564972 modelbutton: Update a11y states
We took care to set the proper role on our accessible object,
but we forgot to update the state for check and radio button
roles.
2020-01-31 19:14:05 +01:00
Matthias Clasen
09612a1b3c filechooser: Remove debug spew 2020-01-31 16:55:01 +01:00
Matthias Clasen
79c8a16b8d Remove simple search engine 2020-01-31 16:52:27 +01:00
Matthias Clasen
6104c12392 Build fix for GtkCssValues 2020-01-31 11:40:06 +01:00
Matthias Clasen
f140b151e1 Merge branch 'meson-sassc-subproject' into 'master'
build: require sassc and drop generated .css files

See merge request GNOME/gtk!814
2020-01-31 07:26:48 +00:00
Matthias Clasen
a46f9af1c0 Remove primary monitor api
We only have implementations of this on X11 and Win32,
so make it available as backend api there.

Update all callers to use either the backend api, or
just monitor 0.
2020-01-30 21:33:37 +01:00
Christoph Reiter
4071e1e734 build: require sassc and drop generated .css files
Instead of requiring sassc to be installed add meson subprojects
which build libsass and sassc (currently both forks of mine, tested
under linux/mingw/msvc) when needed.

This allows us to drop the generated .css files and build scripts from git.

See #1502
2020-01-30 20:45:38 +01:00
Alexander Larsson
99c89d61e1 Merge branch 'icon-theme-rework' into 'master'
Rework icon themes

See merge request GNOME/gtk!1368
2020-01-30 17:30:10 +00:00
Alexander Larsson
09ef67afbc icon-theme: Add icon theme name in profiler mark 2020-01-30 18:22:11 +01:00
Alexander Larsson
d478ae1ef5 icon-theme: Avoid reentrancy issues while loading icon theme
In gtk_icon_theme_get_for_display() we were calling
gtk_icon_theme_set_display() which eventually (via the css machinery)
called back into gtk_icon_theme_get_for_display() which created a
second icon theme. We avoid this by setting the user-data earlier so
that the css machinery gets back the currently initializing theme
instead.
2020-01-30 18:19:56 +01:00
Alexander Larsson
b67d582230 GtkIconHelper: Preload icons for mapped widgets with higher priority
We look at whether a widget will be mapped (the actual state is not
yet set, so we can't rely on that at css validation time) and use
that to set the i/o priority of the async task.

This means that its likely that widgets that will be displayed soon
are loaded before those that are not yet going to be needed.
2020-01-30 15:41:24 +01:00
Alexander Larsson
498ab6ac6c IconHelper: Only preload icons once
This limits the amount of preloading we to, which can for instance
avoid trashing if the icon cache is full, and in general do less work
when its likely to be wasted such as when e.g. background-color for an
icon helper changes.
2020-01-30 15:17:59 +01:00
Alexander Larsson
c69327caa8 icon-theme: Show which icon loads are threaded in profile mark 2020-01-30 15:16:40 +01:00
Alexander Larsson
d1cd578d59 icon-theme: Add i/o priority to choose_icon_async()
This is set on the GTask and lower priority will be loaded before,
this can be used to prioritize some icons for preloading.
2020-01-30 15:15:08 +01:00
Alexander Larsson
5f8c2b52c6 indentation: fix various alignment issues
Most of these stem from the GtkIconInfo -> GtkIcon rename
2020-01-30 12:27:15 +01:00
Alexander Larsson
27799ba4f5 Remove final references to "icon info" with just "icon" 2020-01-30 10:53:43 +01:00
Alexander Larsson
2ec51b7010 icon-theme: Update the docs 2020-01-30 10:53:43 +01:00
Alexander Larsson
f7cd2a782b Fix warnings in gdk gir build
We now have graphene arguments in a gdk function, so add that to the
dependencies.
2020-01-30 10:53:43 +01:00
Alexander Larsson
ff0642bba6 icon-theme: Remove trailing whitespaces
Since everything is changing anyway lets just clean up all the
trailing whitespace issues in the whole file.
2020-01-30 10:53:43 +01:00
Alexander Larsson
b227a2f190 icon-theme: Use GtkSnapshot, not GdkSnapshot 2020-01-30 10:53:43 +01:00
Alexander Larsson
2b202129bb icon-theme: Fix indentation of matrix values 2020-01-30 10:53:43 +01:00
Alexander Larsson
d1c6d78ebb GtkImage: Preload icons during css validation
At the end of GtkImage css validation (during style-updated) when the
css properties (like the icon size) are valid we call _gtk_icon_helper_preload
which does an async icon theme lookup and load. This will happen on a thread
in parallel with the rest of the css machinery, and hopefully by the
time we need the icon it will be ready. If not we will block when we need
it, but during that blocking all the other icons will be loaded.

Testing widget-factory this changes the time of snapshot() from 31 to
25 msec, but on the other hand we also load a few more icons that we
didn't before causing the css validation phase to be about 8 msec slower.
This is because we're preloading all the images in the window, not only
the ones that are visible.

Unfortunately we still load a bunch of icons in snapshot(), from
GtkCssImageIconTheme, and ideally we should try to preload those also.
2020-01-30 10:53:43 +01:00
Alexander Larsson
6a8001fe7d icon-theme: Preload default icon themes in thread
This happens when we first get the theme for a display, or then the
icon theme setting changes.

This means we don't have to do this scan in the first snapshot
and can do the i/o it in parallel with other stuff. This moves
a 10msec block from the first snapshot cycle to early setup.
2020-01-30 10:53:43 +01:00
Alexander Larsson
ff3e022182 icon helper: Remove profiler mark
This was hitting every time we looked up an icon, and we already
log the actual load of the icon in the icon theme.
2020-01-30 10:53:43 +01:00
Alexander Larsson
d2f26b2f27 icon-theme: Improve profiler mark for icon loads
This adds the actual time it took to them as well as the icon size
and scale.
2020-01-30 10:53:43 +01:00
Alexander Larsson
55db9d07c5 icon-theme: Only add theme load profiler mark if we actually load theme 2020-01-30 10:53:43 +01:00
Alexander Larsson
1be932279c icon theme: Actually use scale in choose_icon_async() 2020-01-30 10:53:43 +01:00
Alexander Larsson
56ec748824 icon theme: Actually don't block in gtk_icon_theme_choose_icon_async()
If some other thread is lock the icon or icon theme locks they are likely
to do so for a long time, doing i/o. So, switch to trylock() for the
nonblocking part of _async(). This way we can return directly if the
result is available, but do a thread otherwise, never blocking the
calling (main) thread.
2020-01-30 10:53:43 +01:00
Alexander Larsson
1e6a82513b icon-theme: Clean up locking
Move the lru cache under the global cache lock to avoid some ABBA
style deadlocks when going from icon_theme->icon lock an icon->icon_theme.
We also move all the icon lock uses to a small part of code and make
sure that code never calls out or blocks with any locks held.

Rename the GtkIcon->cache_lock to texture_lock to avoid confusion withe
the global cache_lock.

Removed any mentions of threadsafety from the API docs, we don't
want apps to rely on this, but rather use it outselves internally.
2020-01-30 10:53:43 +01:00
Alexander Larsson
b087f9ca51 icon-theme: Drop the _for_scale() versions and always take scale 2020-01-30 10:53:43 +01:00
Alexander Larsson
e2f778602b icon-theme: Rename GtkIconInfo to GtkIcon 2020-01-30 10:53:43 +01:00
Alexander Larsson
6a15e9169d Rename GtkIcon widget to GtkBuiltinIcon
This is an internal widget whose name is not very important, and we
want to rename GtkIconInfo to GtkIcon, so lets rename this.
2020-01-30 10:53:33 +01:00
Matthias Clasen
cb60c1b83d builder: Add profiler marks for parsing
This is useful to understand what ui files take
long to load.
2020-01-30 10:04:38 +01:00
Matthias Clasen
ab69d43089 builder: Use a better name for templates
This name can show up in error messages or profiler
traces, so it is nice to provide some hint what
file we are dealing with.
<GtkFileChoser template> is a lot more helpful
than <input>.
2020-01-30 10:04:38 +01:00
Alexander Larsson
6af4b6a644 icon-theme: Drop all load() calls from GtkIconInfo
All users now either use it directly as a paintable or download
the texture to use the pixels.
2020-01-29 19:12:15 +01:00
Alexander Larsson
317b395f0f icon-theme: Drop loading_themes recursion check
This was added in 0b1c9b7cc2 to protect
against reentrancy from the theme-changed signal, but we only emit this
from an idle these days, so thats not necessary anymore, and the recursion
check was causing issues with the async operations where a different
thread loading the theme caused the calling thread to thing the
theme is valid.
2020-01-29 19:06:16 +01:00
Alexander Larsson
71b3b54215 icon-theme: Add async icon loader 2020-01-29 19:06:16 +01:00
Alexander Larsson
6ffb54f47f icon-theme: Add gtk_icon_info_download_colored_texture()
This is a way to get at recolored pixels and will replace all existing users
of _load_symbolic*()
2020-01-29 19:06:16 +01:00
Alexander Larsson
dbe021239f icons: Convert use of load() to download_texture() 2020-01-29 19:06:16 +01:00
Alexander Larsson
884e06ad37 icon theme: Add gtk_icon_info_download_texture() function
This returns a reference to the texture (if possible) and can be
used to get access to the pixels of the icon.
2020-01-29 19:06:16 +01:00
Alexander Larsson
53c542765f Add gtk_icon_info_snapshot_with_colors() and use instead of custom code 2020-01-29 19:06:16 +01:00
Alexander Larsson
c42977af04 Convert trivial users of icon theme loading to use info as paintable 2020-01-29 19:06:16 +01:00
Alexander Larsson
aefd8443de GtkIconHelper use GtkIconInfo as paintable 2020-01-29 19:06:16 +01:00
Alexander Larsson
b96ab7453b GtkIconInfo: Implement paintable
This makes GtkIconInfo directly implement paintable by loading
the icon as needed. This is done in a blocking fashion for now, but
could be made more async in the future.

It also means we can't return errors to the called, but I doubt
anyone actually does anything useful with them other than showing
nothing (which we already do).

This also changes a fringe behaviour for unthemed icons. They used to
be never scaled down, but that means we can't tell without i/o the
size of the paintable. Since this is the only case we can't know the
size i took an executive decision and removed that behaviour. I don't
think picking some arbitrary much larger than requested size is ever
right, nor do i think using GtkIconTheme with unthemed icons is overly
useful. If you want to display some random non-iconish image, use
GtkImage instead.
2020-01-29 19:06:16 +01:00
Alexander Larsson
3ac7e30455 icon theme: Make GtkIconInfo cached data threadsafe
Whenever this is accessed or updated we just grab a lock, thus
blocking on whoever is currenly updating it.
2020-01-29 19:06:16 +01:00
Alexander Larsson
aef67bd53a GtkIconTheme: Make the base GtkIconTheme threadsafe
This makes the core icon theme object threadsafe, however its
not yet very useful because the IconInfo objects are not threadsafe.
2020-01-29 19:06:16 +01:00
Matthias Clasen
5e95e15a03 animatedstyle: Fix the debug build
This wasn't caught by our ci.
2020-01-29 14:10:24 +01:00
Carlos Garnacho
aabb250741 Merge branch 'gtk-4-im-wayland-controller-focus-in' into 'master'
imwayland: Connect gtk_im_context_focus_in/out to GtkEventControllerKey

See merge request GNOME/gtk!1349
2020-01-29 11:22:11 +00:00
Matthias Clasen
b97054fc38 Merge branch 'css-style-split-2' into 'master'
css: Split styles into groups

See merge request GNOME/gtk!1362
2020-01-29 10:39:43 +00:00
Matthias Clasen
b859407620 Merge branch 'reset-with-click' into 'master'
Always emit reset for IM preedit with mouse click

Closes #1534

See merge request GNOME/gtk!460
2020-01-29 10:39:22 +00:00
Matthias Clasen
75c73ac3cd Merge branch 'robertroth/shortcuts-overlay-accel' into 'master'
Application: Do not reuse Ctrl+F1 for help-overlay

See merge request GNOME/gtk!307
2020-01-29 10:25:40 +00:00
Matthias Clasen
10e4c04e61 Use style values directly
Replace uses of gtk_css_style_get_value with direct access,
throughout the tree. We don't replace all uses, just those
where we are dealing with a fixed property. Be careful to
handle the currentColor special case for color properties.
2020-01-29 11:07:32 +01:00
Matthias Clasen
b378f566d7 Compute style change based on values structs
We can save some time here by comparing struct by
struct and avoiding individual values comparisons
as much as possible.
2020-01-29 11:07:32 +01:00
Matthias Clasen
5776d0dd99 css: Split styles into groups
Introduce refcounted structs for groups of related css properties,
and use them to store the style values. Both GtkCssStaticStyle and
GtkCssAnimatedStyle fill in the structs in GtkCssStyle, and we
can avoid vfuncs for value access, which should be much faster.
We can even start accessing style->core->color directly.
2020-01-29 11:07:32 +01:00
Matthias Clasen
c3421cea25 Silence a compiler warning 2020-01-29 10:44:25 +01:00
Timm Bäder
a7b34df6af widget: Add style class API
Add GtkWidget API for adding and removing style classes, as well as
checking whether a widget has a style class applied.

Everyone has to go through GtkStyleContext for this these days but with
GtkStyleContext eventually going away, it makse sense for GtkWidget to
have API for this.
2020-01-29 09:36:48 +01:00
Benjamin Otte
5e3cbff8d2 cssselector: Rework how we handle the bloom filter
Instead of foreaching through all the previous selectors every time we
bloom-filter, just bloom-filter the current element and return a special
value if that filter fails (FALSE). If that happens, don't try
filter-matching more nodes in the caller as we know it's an abort.
2020-01-29 04:20:47 +01:00
Benjamin Otte
c6158f1684 cssselector: Reorder functions
This just changes the order of functions in the source code in
preparation for the next commit.
2020-01-28 18:28:32 +01:00
Benjamin Otte
65050a1c81 css: Don't do the "all set" test
We have so many properties that it is basically impossible that all of
them are set and the time spent checking is higher than the time saved
if it does indeed happen.
2020-01-28 17:57:59 +01:00
Benjamin Otte
17ca95a161 popover: Do not validate the css node on show()
This was a good idea back in GTK3 when popovers were toplevels, but now
they're regular child widgets, so they should behave that way.

Also, with the introduction of the bloom filter, gtk_css_node_validate()
now assumes it's only called on root nodes, so assert that that is the
case.
2020-01-28 17:19:28 +01:00
Takao Fujiwara
5be14577d6 imwayland: Connect gtk_im_context_focus_in/out to GtkEventControllerKey
GtkEventControllerKey can handle GDK_FOCUS_CHANGE and call
gtk_im_context_focus_in/out directly.

https://gitlab.gnome.org/GNOME/gtk/issues/2390
2020-01-28 23:47:16 +09:00
Benjamin Otte
c7dca199ae selector: Rework iterating over subnodes
Instead of a foreach() function, introduce an iterator, so that the
caller can drive the iteration.

This allows doing stuff inbetween callbacks and avoids closures when
more than one data object should be passed.

As a side effect I even get a small, but noticeable performance
improvement in the 2-10% range depending on benchmark, I guess that's
because there's no function pointer passing going on anymore.
2020-01-28 04:32:15 +01:00
Benjamin Otte
5e4b102273 styleproperty: Remove ability to query properties
With gtk_style_context_get() gone, this is no longer used.
2020-01-28 02:58:02 +01:00
Benjamin Otte
632fab0ca7 stylecontext: Get rid of gtk_style_context_get()
... and replace all the calls to it with
gtk_style_context_peek_property().

All the calls are hacks that need to go away btw.
2020-01-28 02:58:02 +01:00
Benjamin Otte
afbff574f5 filechooser: Remove default size machinery
The FileChooser ToolKit (fctk) had its own machinery to handle default
sizes which was completely busted and trying to marshal random numbers
through the widget hierarchy that maybe made sense in 2012 but don't do
now.

Get rid of it, just keep the dialog's GSetting - which funnily enough
used to be written by the dialog but written by the widget.
But that's fctk for you.
2020-01-28 02:17:31 +01:00
Benjamin Otte
aff25212df cellrenderertoggle: size based on -gtk-icon-size
Instead of hardcoding 16px.
2020-01-28 02:17:03 +01:00
Benjamin Otte
18cb15a05a stylecontext: Remove gtk_style_context_get_section()
The inspectors gets values differently these days.
2020-01-28 02:17:03 +01:00
Benjamin Otte
6c8b65baf9 stylecontext: Remove GTK_STYLE_PROPERTY_* defines
They shouldn't be (and aren't) used anymore.
2020-01-28 02:17:03 +01:00
Benjamin Otte
495eaf31d4 css: Use the bloom filter for change matching
Instead of just doing radical change matching on the node itself, also
consider the parent nodes via the bloom filter.

This means a radical change is now also one where the parent
name/id/classes change, but since that's considered a radical change on
the parent already, those things are slow anyway.

Improves the benchmark times for CSS validation during backdrop
transitions in widget-factory from 45ms to 35ms on my machine.
2020-01-28 02:17:03 +01:00
Benjamin Otte
ccdc3ee406 selector: Make :not() selectors not radical
:not() selectors cannot be radical because the bloomfilter only knows if
a value is set in any of the nodes, but cannot determine the opposite
(if a value is not set in at least one node), but that would be required
for:not() selectors.
However, this is very unlikely to happen in the real world, so it's not
worth optimizing.

Unfortunately, change tracking could know this, so by excluding the
:not() selectors from radical changes, the change tracking will now pick
them up. If that turns out to be a performance problem, we need to add a
special category for radical not filters, so change tracking and bloom
filters can deal with them.

The testcase demonstrating the problem in widget-factory has been
extrated and added.
2020-01-28 02:17:03 +01:00
Benjamin Otte
170130f1d9 css: Add fast-path for parent selector matching
Add a fast path for parent selector matching that uses a bloom filter to
quickly discard selectors that can't possibly match.

Keep in mind that we match using a bloom filter, so we might
accidentally include too many selectors when hash/bucket collisions
occur.
That's not a correctness problem though, because we'll do a real check
afterwards.

The idea for this change is taken from browsers, in particular WebKit.
2020-01-28 02:17:03 +01:00
Benjamin Otte
6aac56e144 cssnodedeclaration: C99-ify the code
zero-sized arrays are allowed now.
2020-01-28 02:17:03 +01:00
Benjamin Otte
2d5a8974b3 selector: Hash differently
This will be relevant for a bloom filter. And bloom filters want 12bit
hashes, so we try to produce hash values < 4096.
2020-01-28 02:17:03 +01:00
Benjamin Otte
146b921246 cssnode: Convert name + id from interned string to GQuark
The reason for this is simply that I want to get hash functions that
have their values close together, so they can fit in a smaller range
(the goal here is 12 bits). By using GQuark, we get consecutive numbers
starting with 1 (and applications have <1000 quarks usually), whereas
interned strings can be all over the place.

As a side effect we also save 64 bytes per declaration.
2020-01-28 02:17:03 +01:00
Benjamin Otte
8b93ea9238 css: Get rid of GtkCssMatcher 2020-01-28 02:17:02 +01:00
Benjamin Otte
aa7c5e96a6 css: Pass node through the lookup code
... instead of passing a matcher.

The matcher code is now local to the CssProvider/CssSelector machinery.
2020-01-28 02:17:02 +01:00
Benjamin Otte
1953bc92bc cssnode: Remove init_matcher() vfunc
It's unused.
2020-01-28 02:17:02 +01:00
Benjamin Otte
98eeee5bce cssnode: Remove ability to set GType as fallback name 2020-01-28 02:17:02 +01:00
Benjamin Otte
49b47c9133 Remove GtkWidgetPath
... and all associated demos and tests.
2020-01-28 02:17:02 +01:00
Benjamin Otte
af6128b3ab Remove gtkwidgetpath.h include where no longer needed 2020-01-28 02:17:02 +01:00
Benjamin Otte
496f3c17bd Revert "cssmatcher: Inline node values into matcher"
This reverts commit a75529f3c0.

It just complicates code and there are no performance numbers that would
warrant such a commit.
2020-01-28 02:17:02 +01:00
Benjamin Otte
c2d69643a8 css: Move utility function
The function was not selector-specific, so putting it with all the other
utility functions makes more sense.

Also use the utility function in the node declaration printing.
2020-01-28 02:17:02 +01:00
Matthias Clasen
d0aa79b5a1 textutil: Stop using GtkStyleContext
We can just use the css style directly.
2020-01-27 13:35:04 -05:00
Matthias Clasen
4b63523b1f gskpango: Don't free rgba's we don't own
We don't copy them anymore, so don't free them.
2020-01-27 13:35:04 -05:00
Matthias Clasen
997186f640 filechooser: Stop using gtk_style_context_get
Just go to the css style directly.
2020-01-27 12:52:24 -05:00
Timm Bäder
616a83fb53 popover: Fix an oversight in gap coord computation
This caused a border to show up between the popover arrow and the
contents.
2020-01-27 13:37:50 +01:00
Timm Bäder
baeadea342 calendar: Use widgets for the header
This is not meant to be a full GtkCalendar conversion to use widgets
instead of custom drawing, but we lost the arrows in the calendar header
when builtin icons were removed. Using proper button for the year/month
buttons brings them back.
2020-01-27 13:37:50 +01:00
Robert Ancell
b530c83d98 GtkFileFilter: Don't set the name from the GtkBuilder ID
Don't use the GtkBuilder ID for the filter name - this is an ID, not a human
readable name. The name can now be set with a property.
2020-01-27 16:01:54 +13:00
Robert Ancell
b83caec6b9 GtkFileFilter: Add a GObject property for the name
The name field was previously not a property, which meant you couldn't set in in
GtkBuilder as translatable.
2020-01-27 16:01:54 +13:00
Matthias Clasen
3cdde3fc4b css: Don't lose inset when computing shadows
This was showing up as reftest failures,
sporadically
2020-01-26 20:18:23 -05:00
Timm Bäder
a16e1cbf18 cssdimensionvalue: Remove an outdated comment
It's actually implemented in gtkcssdimensionvalue.c these days.
2020-01-26 18:21:07 +01:00
Timm Bäder
c7ea83cd82 cssboxes: Try to avoid doing work for rectangular boxes
Use the new gtk_css_dimension_value_is_zero() to check if we really need
to e.g. apply a border radius at all.
We compute css boxes a lot so this makes sense here, it especially shows
up during pick(), where we need the border box.
2020-01-26 18:21:07 +01:00
Timm Bäder
352c9ba42a dimensionvalue: Add gtk_css_{dimension,corner}_value_is_zero()
We can usually omit computations when the dimension value ends up being
zero anyway.
2020-01-26 18:21:07 +01:00
Timm Bäder
30b37dd7c5 widget: Restructure pick() a bit
Don't even invert transforms if we can do it easily ourselves. This also
fixes a small GtkTransform memory leak.
2020-01-26 18:21:07 +01:00
Timm Bäder
2e256986c3 renderbackground: Avoid unnecessary work in snapshot_background() 2020-01-26 18:21:07 +01:00
Timm Bäder
77e0d360ed Add pure and const annotations to various functions 2020-01-26 18:21:07 +01:00
Timm Bäder
942a93250a render: Remove gtk_render_background_get_clip 2020-01-26 18:21:07 +01:00
Timm Bäder
7ccd6597c3 Remove gtkutils{.c,private.h}
All but one functions are unused. Move the remaining one into
gtkmodules.c, its only caller.
2020-01-26 18:21:07 +01:00
Timm Bäder
355a417dba cssparser: make a few local variables const 2020-01-26 18:21:07 +01:00
Timm Bäder
36e3f4d902 cssprovider: Parse selectors without a GList
The maximum length of this list in Adwaita is 18, so use a generous
maximum length of 64 for the selector list of a ruleset.
2020-01-26 18:21:07 +01:00
Timm Bäder
69fe705d0d GtkCssImageUrl: Implement is_computed() 2020-01-26 18:21:07 +01:00
Timm Bäder
1a56a10fc1 cssimage: Add gtk_css_image_to_string()
In line with all the other _to_string() implementations
2020-01-26 18:21:07 +01:00
Timm Bäder
4287f0def4 window: Replace GtkStyleContext use to get surface transform
We have GtkCssBoxes for this these days.
2020-01-26 18:21:07 +01:00
Matthias Clasen
7bebc3e2b2 Revert "lookup stats"
This reverts commit 3d9e3390f1.
2020-01-25 23:49:33 -05:00
Matthias Clasen
b4e2df8fca Revert "css: Split style into groups"
This reverts commit 0df0de0b5d.
2020-01-25 23:49:17 -05:00
Matthias Clasen
0df0de0b5d css: Split style into groups 2020-01-25 23:47:02 -05:00
Matthias Clasen
53c22bf833 Adwaita: take out an unnecessary rule
The comment says setting caret-color to currentColor
shouldn't be necessary, and it is right.
2020-01-25 18:38:42 -05:00
Matthias Clasen
d8144ec497 Adwaita: drop the * 2020-01-25 18:20:40 -05:00
Matthias Clasen
3d9e3390f1 lookup stats 2020-01-25 18:20:26 -05:00
Matthias Clasen
03595f9567 Fix a scrollbar sizing issue
The recent Adwaita changes inadvertendly made scrollbars
resize on hover. Fix that, by reinstating some lost rules.
2020-01-25 15:05:14 -05:00
Matthias Clasen
64e026d0a9 Revert "Ensure icon themes are loaded with other themes"
This reverts commit 88d26b7549.

This change caused GtkShortcutWindow to not work anymore,
and we are fixing icon themes differently, anyway.
2020-01-25 14:32:01 -05:00
Matthias Clasen
ac902e697e popover: Stop using style context getters 2020-01-25 14:18:22 -05:00
Matthias Clasen
f1ff69963e drag icon: Stop using style context getters
Just go to the css node directly.
2020-01-25 14:18:22 -05:00
Matthias Clasen
731ae8f39e gskpango: Stop using style context getters
Just go to the css nodes directly.
2020-01-25 14:18:22 -05:00
Matthias Clasen
7da6fdc30e widget: Stop using style context internally 2020-01-25 11:05:27 -05:00
Matthias Clasen
1eec7362b9 Adwaita: Fix some entry styling
This was accidentally broken when parent selectors
were introduced here.
2020-01-24 21:01:42 -05:00
Matthias Clasen
a105256611 GtkSpinner: Pay attention to style changes
Make GtkIcon redraw and resize when style changes
require it.
2020-01-24 20:55:42 -05:00
Matthias Clasen
2ee04ee8ed GtkPaned: Pay attention to style changes
Make GtkPaned redraw and resize when style change
require it.
2020-01-24 20:55:42 -05:00
Matthias Clasen
6e358e2a49 GtkIcon: Pay attention to style changes
Make GtkIcon redraw and resize when style changes
require it.
2020-01-24 20:55:42 -05:00
Matthias Clasen
71ee4df357 css: Update affects flags for icons
We want to differentiate what requires recreating the
texture and what doesn't. In particular, the current
flags are not handling symbolic icons right.
2020-01-24 20:55:42 -05:00
Matthias Clasen
53bc1d60c4 Revert "css: Print selectors"
This reverts commit da5d524324.

And this one too. The commits are there, if people need this
kind of statistics again, they can just be cherry-picked.
2020-01-24 11:51:18 -05:00
Matthias Clasen
5b6b4f5075 Revert "css: Print out relative costs of selectors"
This reverts commit 5dcce0c0bd.

I forgot to ifdef a few things in here, so lets take this out
again.
2020-01-24 11:50:40 -05:00
Matthias Clasen
16654eeef4 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1348
2020-01-24 16:20:42 +00:00
Matthias Clasen
871959c88c Adwaita: Drop selection mode
This is not really a feature that GTK has; and it lets
us drop a significant amount of css.
2020-01-24 09:09:27 -05:00
Matthias Clasen
55d08d8400 Adwaita: Drop menu remnants
Menus are gone.
2020-01-24 09:09:27 -05:00
Matthias Clasen
5dcce0c0bd css: Print out relative costs of selectors
Count how often each tree node is visited, and print the number
at the end. This gives a good indication what selectors are costly
and should be avoided. #ifdefed out.
2020-01-24 09:09:08 -05:00
Matthias Clasen
975fe76a0e Adwaita: Remove a wildcard rule for tooltips
These rules are expensive, and don't seem to make
any difference for typical tooltip content.
2020-01-24 09:09:08 -05:00
Matthias Clasen
00be314feb Adwaita: Drop menuitem support
menuitems don't exist anymore.
2020-01-24 09:09:08 -05:00
Matthias Clasen
da5d524324 css: Print selectors
Add code that prints all the selectors when a theme
is loaded. #ifdefed out.
2020-01-24 09:08:52 -05:00
Timm Bäder
8e41fa2778 widget: Use gsk_transform_transform_point() in gtk_widget_pick()
This also covers the 2D_AFFINE case.
2020-01-24 06:19:16 +01:00
Timm Bäder
7855a98fd1 cssimageicontheme: Avoid copying colors 2020-01-24 06:08:39 +01:00
Timm Bäder
aea27b86c1 cssimagepaintable: Implement is_computed() 2020-01-24 06:08:39 +01:00
Timm Bäder
d4caf3d679 cssimagescaled: Implement is_computed() 2020-01-24 06:08:39 +01:00
Timm Bäder
d9652675ef cssimagerecolor: Implement is_computed() 2020-01-24 06:08:39 +01:00
Matthias Clasen
7e4feb092b colorbutton: Use a css name
This was the sole widget to show up as 'widget' in
the css tree.
2020-01-23 23:48:43 -05:00
Matthias Clasen
86aa011587 Adwaita: Use child selectors in many more places
These are much cheaper to match than descendent
selectors, so use them whenever we know the element
is a direct child.
2020-01-23 23:48:43 -05:00
Matthias Clasen
f9e613f8fd text: Don't compute invisible char in init
This causes us to create a pango layout and
validate the css style, a high-overhead
operation. Just do it when the entry is set
to be invisible.
2020-01-23 15:12:38 -05:00
Matthias Clasen
e13692c52f Fix Emoji completion
This was broken in various ways; Tabbing between pages
was causing segfaults, and using the hover state like
this does not work anymore, with hover now being completely
managed by GTK. Use focus instead, and also fix up the
style.
2020-01-23 14:07:09 -05:00
Matthias Clasen
cbed409f52 Replace .emoji with emoji for css 2020-01-23 14:07:09 -05:00
Matthias Clasen
0351f27af2 Adwaita: Drop .context-menu
We are not using it anymore, and yet fonts on a bold
textview are fine. So no need for this.
2020-01-23 14:07:09 -05:00
Matthias Clasen
f84ecf9cd2 Adwaita: Just use .menu, instead of .appmenu
No need for this one-off class, there's no other menus
that could show up here.
2020-01-23 14:07:09 -05:00
Matthias Clasen
f5865b125e Add profiler marks around css selector tree building
This is a big part of theme loading, and worth
showing in traces.
2020-01-23 10:29:22 -05:00
Matthias Clasen
3483c1a45b Adwaita: Remove .entry-tag class
Not used in GTK.
2020-01-23 00:14:49 -05:00
Matthias Clasen
5cc088128f Adwaita: Remove .rubberband class
All GTK widget are using a rubberband element now.
2020-01-23 00:13:54 -05:00
Matthias Clasen
c4548e9c7b Adwaita: Remove .location-bar class
Not used in GTK.
2020-01-23 00:08:53 -05:00
Matthias Clasen
5d6aeb4bf7 Adwaita: Remove gtkstyle-fallback 2020-01-23 00:04:41 -05:00
Matthias Clasen
560e03f962 Adwaita: Remove the .drag-icon class
This class was not used in GTK.
2020-01-22 23:57:30 -05:00
Matthias Clasen
c3f1ff7db4 pathbar: Use a css name insead of a style class
Use pathbar for GtkPathBar in css, instead of the
previous .path-bar. Update Adwaita to match.
2020-01-22 23:56:22 -05:00
Matthias Clasen
88d26b7549 Ensure icon themes are loaded with other themes
Trigger icon theme loading from the code in GtkApplication
where we set up the icon theme search path. This makes
it happen before the first frame.
2020-01-22 23:44:01 -05:00
Matthias Clasen
4ac8011126 icontheme: Add profiler marks around icon theme loading
This is happening during the first frame.
2020-01-22 23:44:01 -05:00
Matthias Clasen
9b29da93b6 iconhelper: Add profiler marks around icon loading
These mainly happen during the first frame, causing
it to be longer than 'normal' frames.
2020-01-22 23:44:01 -05:00
Matthias Clasen
0fe9643728 css: Add a profiler mark around theme loading
This is also time spent before the first frame.
2020-01-22 23:44:01 -05:00
Matthias Clasen
73a214d1a9 application: Add some profiler marks
Add marks around gtk_init and application startup
helps to understand where the time before the first
frame goes.
2020-01-22 23:44:01 -05:00
Matthias Clasen
278762f00a gtk: Clearer names for profiler marks
Naming matters. Don't be overly generic here.
2020-01-22 16:38:40 -05:00
Matthias Clasen
119457279b window: Rename a profiler mark
The "layout" name was already taken for the frame clock
phase by that name. Oops.
2020-01-22 15:12:03 -05:00
Matthias Clasen
95ed9de706 icontheme: Add profiler marks for loading icons
This helps to clearly identify the places where we
do IO, in profiler traces.
2020-01-22 15:12:03 -05:00
Jakub Steiner
feecfcab27 Adwaita: general typography classes
- many moons and some iterations later, these are the suggested
  general typographic styles. Already being referenced in apps like
  Banner Viewer (for now shipping custom definitions)

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1808
2020-01-22 12:02:51 +01:00
Matthias Clasen
5014b2a7fe widget: Add profiler marks
This gives high-level entries for the duration of
snapshotting and layout in the frame cycle.
2020-01-21 23:43:37 -05:00
Matthias Clasen
8cb375de11 window: Add a profiler mark around size allocation
This give a high-level entry for the duration of size allocation
in the frame cycle.
2020-01-21 23:43:01 -05:00
Matthias Clasen
7927bcf6c5 container: Remove an unnecessary check
GtkWindow implements GtkRoot, so we can avoid
treating them separately.
2020-01-21 23:19:24 -05:00
Matthias Clasen
820c9403e3 cssnode: Make the profiler support unconditional 2020-01-21 11:38:34 -05:00
Benjamin Otte
2a5a52dd4b selector: Add GtkSelectorCategory
This will make it easier to write more complex matching algorithms.
2020-01-21 16:59:37 +01:00
Benjamin Otte
e6a0a2f587 stylecontext: Remove excess gtk_css_node_invalidate() call
This call is not necessary, because gtk_css_node_set_parent() does the
right thing. (It probably hasn't been necessary for years, but I'm
not gonna try my luck on GTK3 at this stage.)

This code is usually called the first time
gtk_widget_get_style_context() is called on a widget and its style
context gets create. At that point however, the css nodes are in the
right place already, so no invalidation should happen.
2020-01-21 14:49:25 +01:00
Benjamin Otte
631ea5caac Merge branch 'otte/for-master' into 'master'
Otte/for master

See merge request GNOME/gtk!1333
2020-01-21 12:09:26 +00:00
Benjamin Otte
d59784f7c7 win32: Don't save/restore the context for querying the font
Use the font in the current state.
2020-01-21 12:48:20 +01:00
Benjamin Otte
193eb5b0dd widget: Remove gtk_widget_get_path() 2020-01-21 12:47:16 +01:00
Benjamin Otte
6a1adf6f1a cssnode: Remove unused widget path vfuncs 2020-01-21 12:47:16 +01:00
Benjamin Otte
563ad2db1b containter: Remove gtk_container_get_path_for_child() 2020-01-21 12:47:16 +01:00
Benjamin Otte
c85d9a3259 stylecontext: Change semantics of gtk_style_context_get_path()
Widget contexts now return NULL here. A non-NULL result requires a
previous call to gtk_style_context_set_path()
2020-01-21 12:47:16 +01:00
Benjamin Otte
b9c81b1b94 widget: Initialize cssnode name asap
That way, it's correct in subclass's init functions.
2020-01-21 12:47:16 +01:00
Matthias Clasen
a38ba91e35 Add some static assertions
Add assertions that ensure the relationships between
css property IDs that we rely on are preserved.
2020-01-20 22:54:26 -05:00
Matthias Clasen
a350c2452a Add profiler support for css validation
Push numbers about css validation and style creation
to sysprof.
2020-01-20 21:55:16 -05:00
Benjamin Otte
025902b9fb textview: Make cursor work when blinking is disabled 2020-01-21 01:42:00 +01:00
Matthias Clasen
7e2e92a87e cssselector: Inline a few things 2020-01-19 15:56:54 -05:00
Matthias Clasen
be4d42507c style cascade: Remove some pointless casts
The casts and checks in gtkstylecascade.c are leftovers
from when we had GtkStyleProviderPrivate, and no longer
serve any purpose.
2020-01-19 15:56:54 -05:00
Matthias Clasen
6e88ccf7fb pick: Take advantage of transform categories
Transform categories let us easily avoid doing matrix math
when we can just do a simple translation.
2020-01-19 15:56:54 -05:00
Matthias Clasen
cec4c15f05 Refactor gtk_widget_pick
Split this into a recursive part and a public
entry point. This lets us avoid some duplicate
checks.
2020-01-19 15:56:54 -05:00
Matthias Clasen
95f00c6071 css: Redo the pseudoclass selectors
There is no need to duplicate the classes, we can make
do with a single class for all the states.
2020-01-18 23:06:25 -05:00
Matthias Clasen
55cfeccfd2 css: Go back to clearing out selectors
Now that we use the selector tree for change computation
again, we don't need the ruleset selectors anymore.
Bring back the code that cleans them out.
2020-01-18 23:06:25 -05:00
Matthias Clasen
a463dccd81 Refine the selector tree printing
Also show which tree nodes have exact matches.
2020-01-18 14:32:55 -05:00