Commit Graph

60684 Commits

Author SHA1 Message Date
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
b9c880f58d testsuite: Remove the stylecontext test
Stylecontexts are on their way out and I'm removing API that the
testsuite was relying on, so remove the tests.

Put the useful parts of the tests elsewhere.
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
Benjamin Otte
3f7e409428 Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!1388
2020-02-04 17:48:58 +00: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
7e8d8218b9 Revert "Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()"
We're not in the business of adding Cairo APIs. That's Cairo's job.

Also, we don't need this API anywhere like the original commit claimed,
so there's no need to make it available in any way.

This reverts commit afa6cc2369.
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
Alexander Larsson
a1856c30d9 a11y tests: Ignore "active" flag on toplevel
All the a11y tests were failing for me with a window state diff
like this:

-  state: active enabled resizable sensitive showing visible
+  state: enabled resizable sensitive showing visible

I guess the windows in the CI always gets the focus, but not when
I run it here. Generally focus seems asynchronous and hard to rely
on so I just made the test ignore the active state on toplevels.
2020-02-04 15:01:48 +01:00
Alexander Larsson
008eb04125 tests: Initialize dbus before gtk
These days initilizing gtk may create a connection to the sesson bus,
so we have to initialize GTestDBus before initalizing gtk, or we'll
use the address of the "real" session bus (and remember that in the
global).

To further muck things up, g_test_dbus_up() resets important env
vars like DISPLAY and XDG_RUNTIME_DIR, which we have to re-set.
2020-02-04 14:13:33 +01:00
Alexander Larsson
85e59220a5 filechooser portal: Free portal proxy when bus connection closes
This was blocking the clean exit from the testdbus shutdown in
the defaultvalues test. The proxy was keeping the connection alive
which blocks g_test_dbus_down().
2020-02-04 14:08:10 +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
Matthias Clasen
4685fe1716 Merge branch 'faster-theme-lookup' into 'master'
Faster icon theme lookup

See merge request GNOME/gtk!1381
2020-02-04 10:51:27 +00: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
Alexander Larsson
a3be0ec5f0 Don't use xsettings or xft defaults in testsuite
This adds a GDK_DEBUG=default-settings flag which disables reads
from xsettings and Xft resources, and enables this for the testsuite.

This is one less way to get different testresults depending on the
environment. In particular, it was failing the css tests for me
due to getting the wrong font size because i have a different dpi.
2020-02-03 15:11:35 +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
Chun-wei Fan
f8d3845b1a meson/MSVC builds: Use -utf-8 where available
This avoids the build from erroring out on C4819 (Unicode handling issue in
Visual Studio compiler), notably when running on Chinese, Japanese and
Korean locales.

Also apply -D_USE_MATH_DEFINES, -FImsvc_recommended_pragmas.h and -utf-8 to
the C++ compiler options as well.
2020-02-03 17:55:09 +08:00
Rico Tzschichholz
4ab12ab755 Remove last GtkWidgetPath reference
See 49b47c9133
2020-02-03 10:51:50 +01:00
Chun-wei Fan
69ed4c90e5 demos/widget-factory/widget-factory.c: Include stdlib.h
Include it for exit().
2020-02-03 17:18:36 +08:00
Chun-wei Fan
f2915180a6 tests/testdnd2.c: Don't include unistd.h unconditionally
Instead, on Windows when it is not available, include io.h for close()
2020-02-03 17:18:36 +08:00
Matthias Clasen
e7f2833703 Merge branch 'wip/muktupavels/update-documentation' into 'master'
display-x11: don't mention gdk_monitor_is_primary in the docs

See merge request GNOME/gtk!1380
2020-02-03 08:15:30 +00:00
Alberts Muktupāvels
66af531ff3 display-x11: don't mention gdk_monitor_is_primary in the docs
https://gitlab.gnome.org/GNOME/gtk/merge_requests/1371#note_699272
2020-02-02 19:18:22 +02: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