gtk4.git
5 years agobuild: require sassc and drop generated .css files
Christoph Reiter [Fri, 3 May 2019 16:04:16 +0000 (18:04 +0200)]
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

5 years agoMerge branch 'icon-theme-rework' into 'master'
Alexander Larsson [Thu, 30 Jan 2020 17:30:10 +0000 (17:30 +0000)]
Merge branch 'icon-theme-rework' into 'master'

Rework icon themes

See merge request GNOME/gtk!1368

5 years agoicon-theme: Add icon theme name in profiler mark
Alexander Larsson [Thu, 30 Jan 2020 17:22:11 +0000 (18:22 +0100)]
icon-theme: Add icon theme name in profiler mark

5 years agoicon-theme: Avoid reentrancy issues while loading icon theme
Alexander Larsson [Thu, 30 Jan 2020 17:19:56 +0000 (18:19 +0100)]
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.

5 years agoGtkIconHelper: Preload icons for mapped widgets with higher priority
Alexander Larsson [Thu, 30 Jan 2020 14:41:24 +0000 (15:41 +0100)]
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.

5 years agoIconHelper: Only preload icons once
Alexander Larsson [Thu, 30 Jan 2020 14:17:59 +0000 (15:17 +0100)]
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.

5 years agoicon-theme: Show which icon loads are threaded in profile mark
Alexander Larsson [Thu, 30 Jan 2020 14:16:40 +0000 (15:16 +0100)]
icon-theme: Show which icon loads are threaded in profile mark

5 years agoicon-theme: Add i/o priority to choose_icon_async()
Alexander Larsson [Thu, 30 Jan 2020 14:15:08 +0000 (15:15 +0100)]
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.

5 years agoindentation: fix various alignment issues
Alexander Larsson [Thu, 30 Jan 2020 11:27:15 +0000 (12:27 +0100)]
indentation: fix various alignment issues

Most of these stem from the GtkIconInfo -> GtkIcon rename

5 years agoRemove final references to "icon info" with just "icon"
Alexander Larsson [Thu, 30 Jan 2020 09:52:09 +0000 (10:52 +0100)]
Remove final references to "icon info" with just "icon"

5 years agoicon-theme: Update the docs
Alexander Larsson [Thu, 30 Jan 2020 09:44:12 +0000 (10:44 +0100)]
icon-theme: Update the docs

5 years agoFix warnings in gdk gir build
Alexander Larsson [Thu, 30 Jan 2020 09:43:35 +0000 (10:43 +0100)]
Fix warnings in gdk gir build

We now have graphene arguments in a gdk function, so add that to the
dependencies.

5 years agoicon-theme: Remove trailing whitespaces
Alexander Larsson [Thu, 30 Jan 2020 08:12:36 +0000 (09:12 +0100)]
icon-theme: Remove trailing whitespaces

Since everything is changing anyway lets just clean up all the
trailing whitespace issues in the whole file.

5 years agoicon-theme: Use GtkSnapshot, not GdkSnapshot
Alexander Larsson [Thu, 30 Jan 2020 07:55:44 +0000 (08:55 +0100)]
icon-theme: Use GtkSnapshot, not GdkSnapshot

5 years agoicon-theme: Fix indentation of matrix values
Alexander Larsson [Thu, 30 Jan 2020 07:53:46 +0000 (08:53 +0100)]
icon-theme: Fix indentation of matrix values

5 years agoGtkImage: Preload icons during css validation
Alexander Larsson [Wed, 29 Jan 2020 17:10:13 +0000 (18:10 +0100)]
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.

5 years agoicon-theme: Preload default icon themes in thread
Alexander Larsson [Wed, 29 Jan 2020 10:38:05 +0000 (11:38 +0100)]
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.

5 years agoicon helper: Remove profiler mark
Alexander Larsson [Wed, 29 Jan 2020 13:56:13 +0000 (14:56 +0100)]
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.

5 years agoicon-theme: Improve profiler mark for icon loads
Alexander Larsson [Wed, 29 Jan 2020 10:33:30 +0000 (11:33 +0100)]
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.

5 years agoicon-theme: Only add theme load profiler mark if we actually load theme
Alexander Larsson [Tue, 28 Jan 2020 16:08:52 +0000 (17:08 +0100)]
icon-theme: Only add theme load profiler mark if we actually load theme

5 years agoicon theme: Actually use scale in choose_icon_async()
Alexander Larsson [Wed, 29 Jan 2020 16:07:22 +0000 (17:07 +0100)]
icon theme: Actually use scale in choose_icon_async()

5 years agoicon theme: Actually don't block in gtk_icon_theme_choose_icon_async()
Alexander Larsson [Wed, 29 Jan 2020 15:42:35 +0000 (16:42 +0100)]
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.

5 years agoicon-theme: Clean up locking
Alexander Larsson [Wed, 29 Jan 2020 10:08:02 +0000 (11:08 +0100)]
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.

5 years agoicon-theme: Drop the _for_scale() versions and always take scale
Alexander Larsson [Tue, 28 Jan 2020 15:14:52 +0000 (16:14 +0100)]
icon-theme: Drop the _for_scale() versions and always take scale

5 years agoicon-theme: Rename GtkIconInfo to GtkIcon
Alexander Larsson [Tue, 28 Jan 2020 14:43:51 +0000 (15:43 +0100)]
icon-theme: Rename GtkIconInfo to GtkIcon

5 years agoRename GtkIcon widget to GtkBuiltinIcon
Alexander Larsson [Tue, 28 Jan 2020 14:03:42 +0000 (15:03 +0100)]
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.

5 years agoprofiler: Exit gracefully on SIGTERM
Matthias Clasen [Wed, 29 Jan 2020 15:55:44 +0000 (16:55 +0100)]
profiler: Exit gracefully on SIGTERM

This is nice, since it lets me quickly launch a test app
and terminate it with Ctrl-C and still produce a usable
sysprof trace.

5 years agobuilder: Add profiler marks for parsing
Matthias Clasen [Wed, 29 Jan 2020 14:49:56 +0000 (15:49 +0100)]
builder: Add profiler marks for parsing

This is useful to understand what ui files take
long to load.

5 years agobuilder: Use a better name for templates
Matthias Clasen [Wed, 29 Jan 2020 14:48:31 +0000 (15:48 +0100)]
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>.

5 years agoicon-theme: Drop all load() calls from GtkIconInfo
Alexander Larsson [Tue, 28 Jan 2020 13:54:18 +0000 (14:54 +0100)]
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.

5 years agoicon-theme: Use gtk_icon_theme_choose_icon_async in tests
Alexander Larsson [Tue, 28 Jan 2020 13:38:53 +0000 (14:38 +0100)]
icon-theme: Use gtk_icon_theme_choose_icon_async in tests

5 years agoicon-theme: Drop loading_themes recursion check
Alexander Larsson [Tue, 28 Jan 2020 13:35:17 +0000 (14:35 +0100)]
icon-theme: Drop loading_themes recursion check

This was added in 0b1c9b7cc26d293477a6823a40d3e1feebbd6df7 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.

5 years agoicon-theme: Add async icon loader
Alexander Larsson [Tue, 28 Jan 2020 12:47:59 +0000 (13:47 +0100)]
icon-theme: Add async icon loader

5 years agotests: Use gtk_icon_info_download_colored_texture instead of load_symbolic
Alexander Larsson [Tue, 28 Jan 2020 11:40:14 +0000 (12:40 +0100)]
tests: Use gtk_icon_info_download_colored_texture instead of load_symbolic

5 years agoicon-theme: Add gtk_icon_info_download_colored_texture()
Alexander Larsson [Tue, 28 Jan 2020 11:06:55 +0000 (12:06 +0100)]
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*()

5 years agoBreak out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()
Alexander Larsson [Tue, 28 Jan 2020 10:42:24 +0000 (11:42 +0100)]
Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()

This is useful in some parts of the icon theme APIs.

5 years agoicons: Convert use of load() to download_texture()
Alexander Larsson [Tue, 28 Jan 2020 09:30:01 +0000 (10:30 +0100)]
icons: Convert use of load() to download_texture()

5 years agoicon theme: Add gtk_icon_info_download_texture() function
Alexander Larsson [Tue, 28 Jan 2020 07:34:14 +0000 (08:34 +0100)]
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.

5 years agoAdd gtk_icon_info_snapshot_with_colors() and use instead of custom code
Alexander Larsson [Mon, 27 Jan 2020 15:42:38 +0000 (16:42 +0100)]
Add gtk_icon_info_snapshot_with_colors() and use instead of custom code

5 years agoConvert trivial users of icon theme loading to use info as paintable
Alexander Larsson [Mon, 27 Jan 2020 14:40:58 +0000 (15:40 +0100)]
Convert trivial users of icon theme loading to use info as paintable

5 years agoGtkIconHelper use GtkIconInfo as paintable
Alexander Larsson [Mon, 27 Jan 2020 13:05:00 +0000 (14:05 +0100)]
GtkIconHelper use GtkIconInfo as paintable

5 years agoGtkIconInfo: Implement paintable
Alexander Larsson [Mon, 27 Jan 2020 12:59:34 +0000 (13:59 +0100)]
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.

5 years agoicon theme: Make GtkIconInfo cached data threadsafe
Alexander Larsson [Fri, 24 Jan 2020 16:46:57 +0000 (17:46 +0100)]
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.

5 years agoGtkIconTheme: Make the base GtkIconTheme threadsafe
Alexander Larsson [Fri, 24 Jan 2020 15:22:26 +0000 (16:22 +0100)]
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.

5 years agoUpdate POTFILES.skip
Piotr Drąg [Wed, 29 Jan 2020 16:20:23 +0000 (17:20 +0100)]
Update POTFILES.skip

5 years agoMerge branch 'wip/muktupavels/work-areas' into 'master'
Emmanuele Bassi [Wed, 29 Jan 2020 13:38:31 +0000 (13:38 +0000)]
Merge branch 'wip/muktupavels/work-areas' into 'master'

per-monitor work areas

Closes #1086 and #980

See merge request GNOME/gtk!1300

5 years agoanimatedstyle: Fix the debug build
Matthias Clasen [Wed, 29 Jan 2020 13:02:30 +0000 (14:02 +0100)]
animatedstyle: Fix the debug build

This wasn't caught by our ci.

5 years agox11: add support for _GTK_WORKAREAS_Dn
Alberts Muktupāvels [Sun, 12 Jan 2020 22:38:12 +0000 (00:38 +0200)]
x11: add support for _GTK_WORKAREAS_Dn

If window manager supports _GTK_WORKAREAS use per-monitor work areas.

https://mail.gnome.org/archives/wm-spec-list/2018-December/msg00000.html
https://gitlab.freedesktop.org/xdg/xdg-specs/merge_requests/22

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1300

5 years agoMerge branch 'gtk-4-im-wayland-controller-focus-in' into 'master'
Carlos Garnacho [Wed, 29 Jan 2020 11:22:11 +0000 (11:22 +0000)]
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

5 years agoMerge branch 'gdk-device-leak-fix' into 'master'
Matthias Clasen [Wed, 29 Jan 2020 10:44:42 +0000 (10:44 +0000)]
Merge branch 'gdk-device-leak-fix' into 'master'

GdkDevice leak fix

See merge request GNOME/gtk!1358

5 years agoMerge branch 'css-style-split-2' into 'master'
Matthias Clasen [Wed, 29 Jan 2020 10:39:43 +0000 (10:39 +0000)]
Merge branch 'css-style-split-2' into 'master'

css: Split styles into groups

See merge request GNOME/gtk!1362

5 years agoMerge branch 'reset-with-click' into 'master'
Matthias Clasen [Wed, 29 Jan 2020 10:39:22 +0000 (10:39 +0000)]
Merge branch 'reset-with-click' into 'master'

Always emit reset for IM preedit with mouse click

Closes #1534

See merge request GNOME/gtk!460

5 years agoMerge branch 'robertroth/shortcuts-overlay-accel' into 'master'
Matthias Clasen [Wed, 29 Jan 2020 10:25:40 +0000 (10:25 +0000)]
Merge branch 'robertroth/shortcuts-overlay-accel' into 'master'

Application: Do not reuse Ctrl+F1 for help-overlay

See merge request GNOME/gtk!307

5 years agoUse style values directly
Matthias Clasen [Tue, 28 Jan 2020 07:38:25 +0000 (07:38 +0000)]
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.

5 years agoCompute style change based on values structs
Matthias Clasen [Tue, 28 Jan 2020 17:13:37 +0000 (18:13 +0100)]
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.

5 years agocss: Split styles into groups
Matthias Clasen [Sun, 26 Jan 2020 04:16:06 +0000 (23:16 -0500)]
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.

5 years agoperformance test: Produce better numbers
Matthias Clasen [Wed, 29 Jan 2020 10:05:24 +0000 (11:05 +0100)]
performance test: Produce better numbers

Try to isolate the test runs from each other in the
eyes of the kernel scheduler, by sleeping a bit. And
ignore the first run, to avoid cache effects.

5 years agoMerge branch 'wip/baedert/widget-add-style-class' into 'master'
Matthias Clasen [Wed, 29 Jan 2020 09:46:36 +0000 (09:46 +0000)]
Merge branch 'wip/baedert/widget-add-style-class' into 'master'

widget: Add style class API

See merge request GNOME/gtk!1366

5 years agoSilence a compiler warning
Matthias Clasen [Wed, 29 Jan 2020 09:44:25 +0000 (10:44 +0100)]
Silence a compiler warning

5 years agoMerge branch 'gtk-doc-ci' into 'master'
Emmanuele Bassi [Wed, 29 Jan 2020 09:11:15 +0000 (09:11 +0000)]
Merge branch 'gtk-doc-ci' into 'master'

Publish the API reference

See merge request GNOME/gtk!1367

5 years agoRemove reftests from expected-fail list
Emmanuele Bassi [Wed, 29 Jan 2020 09:02:02 +0000 (10:02 +0100)]
Remove reftests from expected-fail list

With an updated version of the base CI image it seems some tests that
were failing have started to pass again.

5 years agoci: Deploy the API reference on our GitLab pages
Emmanuele Bassi [Wed, 29 Jan 2020 08:16:57 +0000 (09:16 +0100)]
ci: Deploy the API reference on our GitLab pages

Now that we can build gtk-doc as a sub-project, we can go back to
publishing the API reference for the master branch every time we
build it.

5 years agoci: Update the version of Meson in the CI image
Emmanuele Bassi [Tue, 28 Jan 2020 15:52:42 +0000 (16:52 +0100)]
ci: Update the version of Meson in the CI image

We need at least 0.52.1 to be able to use gtk-doc as a sub-project.

5 years agoAdd gtk-doc as a subproject
Emmanuele Bassi [Tue, 28 Jan 2020 15:50:53 +0000 (16:50 +0100)]
Add gtk-doc as a subproject

We rely on a specific minimum version of gtk-doc to be able to build the
GTK API reference for the new API. In order to be able to use gtk-doc as
a subproject, though, we need to use a recent version of Meson.

5 years agowidget: Add style class API
Timm Bäder [Wed, 29 Jan 2020 07:33:41 +0000 (08:33 +0100)]
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.

5 years agoMerge branch 'fix-doc-typo' into 'master'
Timm Bäder [Wed, 29 Jan 2020 07:49:13 +0000 (07:49 +0000)]
Merge branch 'fix-doc-typo' into 'master'

Fix a doc typo

See merge request GNOME/gtk!1364

5 years agoMerge branch 'wip/otte/for-master' into 'master'
Benjamin Otte [Wed, 29 Jan 2020 04:35:56 +0000 (04:35 +0000)]
Merge branch 'wip/otte/for-master' into 'master'

Wip/otte/for master

See merge request GNOME/gtk!1365

5 years agocssselector: Rework how we handle the bloom filter
Benjamin Otte [Wed, 29 Jan 2020 03:20:47 +0000 (04:20 +0100)]
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.

5 years agoFix a doc typo
Luca Bacci [Tue, 28 Jan 2020 20:42:03 +0000 (20:42 +0000)]
Fix a doc typo

5 years agocssselector: Reorder functions
Benjamin Otte [Tue, 28 Jan 2020 17:28:32 +0000 (18:28 +0100)]
cssselector: Reorder functions

This just changes the order of functions in the source code in
preparation for the next commit.

5 years agocss: Don't do the "all set" test
Benjamin Otte [Tue, 28 Jan 2020 16:49:37 +0000 (17:49 +0100)]
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.

5 years agoMerge branch 'wip/otte/for-master' into 'master'
Benjamin Otte [Tue, 28 Jan 2020 16:43:33 +0000 (16:43 +0000)]
Merge branch 'wip/otte/for-master' into 'master'

popover: Do not validate the css node on show()

See merge request GNOME/gtk!1363

5 years agopopover: Do not validate the css node on show()
Benjamin Otte [Tue, 28 Jan 2020 16:15:04 +0000 (17:15 +0100)]
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.

5 years agoimwayland: Connect gtk_im_context_focus_in/out to GtkEventControllerKey
Takao Fujiwara [Tue, 28 Jan 2020 14:47:16 +0000 (23:47 +0900)]
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

5 years agoMerge branch 'wip/otte/css' into 'master'
Benjamin Otte [Tue, 28 Jan 2020 03:56:49 +0000 (03:56 +0000)]
Merge branch 'wip/otte/css' into 'master'

selector: Rework iterating over subnodes

See merge request GNOME/gtk!1361

5 years agoselector: Rework iterating over subnodes
Benjamin Otte [Tue, 28 Jan 2020 02:53:48 +0000 (03:53 +0100)]
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.

5 years agoMerge branch 'wip/otte/css' into 'master'
Benjamin Otte [Tue, 28 Jan 2020 02:47:25 +0000 (02:47 +0000)]
Merge branch 'wip/otte/css' into 'master'

CSS improvements

See merge request GNOME/gtk!1360

5 years agostyleproperty: Remove ability to query properties
Benjamin Otte [Mon, 27 Jan 2020 23:46:43 +0000 (00:46 +0100)]
styleproperty: Remove ability to query properties

With gtk_style_context_get() gone, this is no longer used.

5 years agostylecontext: Get rid of gtk_style_context_get()
Benjamin Otte [Mon, 27 Jan 2020 23:27:36 +0000 (00:27 +0100)]
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.

5 years agotestcalendar: Don't do dumb stuff with font sizes.
Benjamin Otte [Mon, 27 Jan 2020 22:04:15 +0000 (23:04 +0100)]
testcalendar: Don't do dumb stuff with font sizes.

If you want to test font stuff, it's 2020 and we have an inspector.

5 years agofilechooser: Remove default size machinery
Benjamin Otte [Mon, 27 Jan 2020 21:58:15 +0000 (22:58 +0100)]
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.

5 years agocellrenderertoggle: size based on -gtk-icon-size
Benjamin Otte [Mon, 27 Jan 2020 16:13:04 +0000 (17:13 +0100)]
cellrenderertoggle: size based on -gtk-icon-size

Instead of hardcoding 16px.

5 years agostylecontext: Remove gtk_style_context_get_section()
Benjamin Otte [Mon, 27 Jan 2020 15:13:25 +0000 (16:13 +0100)]
stylecontext: Remove gtk_style_context_get_section()

The inspectors gets values differently these days.

5 years agostylecontext: Remove GTK_STYLE_PROPERTY_* defines
Benjamin Otte [Mon, 27 Jan 2020 14:07:37 +0000 (15:07 +0100)]
stylecontext: Remove GTK_STYLE_PROPERTY_* defines

They shouldn't be (and aren't) used anymore.

5 years agocss: Use the bloom filter for change matching
Benjamin Otte [Mon, 27 Jan 2020 02:26:39 +0000 (03:26 +0100)]
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.

5 years agoselector: Make :not() selectors not radical
Benjamin Otte [Mon, 27 Jan 2020 01:49:36 +0000 (02:49 +0100)]
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.

5 years agotestsuite: Improve diff_with_file() function
Benjamin Otte [Mon, 27 Jan 2020 01:15:06 +0000 (02:15 +0100)]
testsuite: Improve diff_with_file() function

Properly handle diff(1) failing.

In this particular case, the test passed a NULL input file to the diff
(that was fixed, too) and then diff only found one input file and
aborted.

But without this fix, we'd also not catch other abortion reasons for
diff() - as long as it exited in any way, we were happy.

5 years agocss: Add fast-path for parent selector matching
Benjamin Otte [Sun, 26 Jan 2020 03:37:17 +0000 (04:37 +0100)]
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.

5 years agocssnodedeclaration: C99-ify the code
Benjamin Otte [Sun, 26 Jan 2020 03:17:17 +0000 (04:17 +0100)]
cssnodedeclaration: C99-ify the code

zero-sized arrays are allowed now.

5 years agoselector: Hash differently
Benjamin Otte [Fri, 24 Jan 2020 16:56:53 +0000 (17:56 +0100)]
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.

5 years agocssnode: Convert name + id from interned string to GQuark
Benjamin Otte [Thu, 23 Jan 2020 23:43:26 +0000 (00:43 +0100)]
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.

5 years agocss: Get rid of GtkCssMatcher
Benjamin Otte [Thu, 23 Jan 2020 02:34:25 +0000 (03:34 +0100)]
css: Get rid of GtkCssMatcher

5 years agocss: Pass node through the lookup code
Benjamin Otte [Thu, 23 Jan 2020 01:42:01 +0000 (02:42 +0100)]
css: Pass node through the lookup code

... instead of passing a matcher.

The matcher code is now local to the CssProvider/CssSelector machinery.

5 years agocssnode: Remove init_matcher() vfunc
Benjamin Otte [Thu, 23 Jan 2020 01:28:46 +0000 (02:28 +0100)]
cssnode: Remove init_matcher() vfunc

It's unused.

5 years agocssnode: Remove ability to set GType as fallback name
Benjamin Otte [Thu, 23 Jan 2020 01:22:30 +0000 (02:22 +0100)]
cssnode: Remove ability to set GType as fallback name

5 years agoRemove GtkWidgetPath
Benjamin Otte [Wed, 22 Jan 2020 23:45:27 +0000 (00:45 +0100)]
Remove GtkWidgetPath

... and all associated demos and tests.

5 years agoRemove gtkwidgetpath.h include where no longer needed
Benjamin Otte [Wed, 22 Jan 2020 23:45:01 +0000 (00:45 +0100)]
Remove gtkwidgetpath.h include where no longer needed

5 years agoRevert "cssmatcher: Inline node values into matcher"
Benjamin Otte [Wed, 22 Jan 2020 21:49:27 +0000 (22:49 +0100)]
Revert "cssmatcher: Inline node values into matcher"

This reverts commit a75529f3c00736856fa20f19e920614be5a48fbb.

It just complicates code and there are no performance numbers that would
warrant such a commit.

5 years agocss: Move utility function
Benjamin Otte [Mon, 27 Jan 2020 02:44:05 +0000 (03:44 +0100)]
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.

5 years agogdk/x11: Properly unref removed device in XI2 device manager
Sebastian Keller [Mon, 27 Jan 2020 00:02:29 +0000 (01:02 +0100)]
gdk/x11: Properly unref removed device in XI2 device manager

When a device is added, there are two references to it by the device
manager, the initial one and the one used for the id_table. Removing a
device only removed the reference added by the id_table resulting in the
GdkDevice being leaked.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1358