Compare commits

..

33 Commits

Author SHA1 Message Date
Matthias Clasen 2bf8faf2a0 x11: Don't pass the same device twice when creating events
I did not expect XI2, where this slave device idea
originated, to do this. But it does.
2020-05-19 16:42:33 -04:00
Matthias Clasen 391472870f events: Enforce that source device must be a slave
We were allowing backends too much leeway to create
nonsense events. Enforce that the device is NULL or
a master device, and the source device is NULL or a
slave device.
2020-05-19 15:59:15 -04:00
Matthias Clasen 76666a4204 wayland: Don't generate events with master devices as source
When emulating crossing or focus events, don't pass the
same device as master and slave. It is only one, not the
other.
2020-05-19 15:58:01 -04:00
Matthias Clasen 5053c6fcec display: Don't pass a master device as source event
When generating grab-broken events, don't pass the same
device as master and slave. It is only one, not the other.
2020-05-19 15:57:18 -04:00
Matthias Clasen edf85cb1b3 docs: Refresh the build and backend sections
Remove some outdated information from the sections
about building and about particular backends.
2020-05-19 15:19:53 -04:00
Matthias Clasen 841e9b3f0e Merge branch 'x11-shortcuts-inhibit-fix' into 'master'
x11: update inhibit shortcuts on grab broken

See merge request GNOME/gtk!1590
2020-05-19 14:06:25 +00:00
Olivier Fourdan 93f9138c9b x11: update inhibit shortcuts on grab broken
On X11, shortcuts inhibition is emulated using a grab on the keyboard.

So if another widget ungrabs the keyboard behind our back (for example
when a popup window is dismissed) that effectively disables the effects
of the shortcut inhibition on the surface and we need to update the
shortcut inhibition status accordingly.

Check for "grab-broken" events on the surface and clear existing
shortcuts inhibition for the matching seat, so that the client can be
notified and may decide to re-enable shortcut inhibition if desired.
2020-05-19 14:51:25 +02:00
Emmanuele Bassi 1ace77b923 Merge branch 'ebassi/surface-event' into 'master'
Use the right types for the GdkSurface::event arguments

See merge request GNOME/gtk!1936
2020-05-19 12:14:17 +00:00
Emmanuele Bassi dd4d6930b5 Use the right types for the GdkSurface::event arguments
We pass the GdkEvent as a pointer, because the autogenerated marshallers
don't know how to handle GTypeInstance-derived classes.

Since the GValue box that we use in the marshaller passes the GdkEvent
instance as is, we also need to acquire a reference before invoking the
closure, and release it afterwards, to ensure that the GdkEvent instance
survices the invocation.
2020-05-19 12:21:22 +01:00
Matthias Clasen 7fc2d9adc0 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #2739 and #2760

See merge request GNOME/gtk!1934
2020-05-19 02:47:03 +00:00
Matthias Clasen 17dd32da88 testsuite: Remove obsolete test from list
The test was removed in 97d0e8c6e0, but I neglected
to remove the test files from meson.build.

Fixes: #2760
2020-05-18 21:49:34 -04:00
Matthias Clasen ec2aac5b61 gsk: Document blend modes
Add some information about blend modes, mostly taken
from the css compositing spec.

Fixes: #2739
2020-05-18 18:21:39 -04:00
Matthias Clasen 15f7d2a27d 3.98.4 2020-05-18 16:38:11 -04:00
Matthias Clasen 3dafdcbab0 testsuite: Remove GDK_DEBUG=misc
This snuck in by accident in recent ci setup
changes, and breaks the test runs by adding
stray output.
2020-05-18 16:38:11 -04:00
Matthias Clasen 383fa6b0b0 Merge branch 'matthiasc/for-master' into 'master'
colorscale: Bring back the right-click on slider

See merge request GNOME/gtk!1933
2020-05-18 16:46:12 +00:00
Matthias Clasen f637ab57f1 colorscale: Bring back the right-click on slider
This was lost when we converted the color editor to actions.
2020-05-18 11:31:42 -04:00
Emmanuele Bassi 615b4d8c65 Merge branch 'ebassi/ci-fix' into 'master'
docs: Fix the argument name to match

See merge request GNOME/gtk!1930
2020-05-18 15:10:38 +00:00
Jakub Steiner 9be5c7b0c8 Merge branch 'theme-aligned-combo-labels' into 'master'
Adwaita: Align combo menu labels with the combo button label

See merge request GNOME/gtk!1928
2020-05-18 14:04:19 +00:00
Yuri Chornoivan 670b102553 Update Ukrainian translation 2020-05-18 14:03:41 +00:00
Emmanuele Bassi 9bd9a11de4 docs: Fix the argument name to match
Both gtk-doc and g-i require the name of the argument of a function to
match in the declaration, definition, and gtk-doc stanza.
2020-05-18 14:55:25 +01:00
Jakub Steiner ec26e4f6b4 Merge branch 'theme-checkbutton-padding' into 'master'
Adwaita: Tweak padding in checkbutton & radiobutton

Closes #2697

See merge request GNOME/gtk!1927
2020-05-18 13:12:15 +00:00
nana-4 538ab75002 Adwaita: Align combo menu labels with the combo button label
Apply the same left and right padding to the combo menu items as the
combo button.
2020-05-18 21:52:00 +09:00
nana-4 1c99dbc70e Adwaita: Tweak padding in checkbutton & radiobutton
Since we can now use border-spacing in checkbutton and radiobutton,
we don't need the margin in check and radio for spacing anymore.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2697
2020-05-18 20:29:23 +09:00
Timm Bäder afd56517d1 bloatpad: Avoid a few theoretical compiler warnings 2020-05-18 11:30:08 +02:00
Timm Bäder 3c7ba21a6a Add G_GNUC_NORETURN to functions that never return 2020-05-18 11:30:08 +02:00
Timm Bäder 4b655ecd36 examples: Add common_cflags to executables 2020-05-18 11:30:08 +02:00
Daniel Mustieles 028942c8c3 Updated Spanish translation 2020-05-18 10:15:03 +02:00
Matthias Clasen 55b171c986 Merge branch 'shape-apis' into 'master'
Shape apis

See merge request GNOME/gtk!1925
2020-05-18 04:26:01 +00:00
Chun-wei Fan a4416e389a print-editor demo: Fix linking on Visual Studio
We need to pass in '/entry:mainCRTStartup' as we did for the other demo
programs that have 'gui_app: true' in their Meson build settings.
2020-05-18 11:35:52 +08:00
Matthias Clasen d6818475d7 gdk: Simplify gdk_display_supports_input_shapes
Make this a display property, and do away with
the vfunc in favor of a private setter, to match
how we handle other display characteristics.
2020-05-17 22:05:24 -04:00
Matthias Clasen 287c40276a gdk: Drop gdk_display_supports_shapes
The apis to set shapes on surfaces are gone,
so there is no point in providing this information
on GdkDisplay.
2020-05-17 21:52:15 -04:00
Matthias Clasen 5916ae5ec4 x11: Avoid some frontend api use
We can just use our backend information directly.
2020-05-17 21:47:22 -04:00
Matthias Clasen 03829e191e docs: Tweak docs for gdk_surface_set_input_region 2020-05-17 21:46:54 -04:00
51 changed files with 962 additions and 1163 deletions
+13 -4
View File
@@ -3,9 +3,9 @@ Overview of Changes in GTK 3.98.4
* Themes
- Refine menu styling
- Add public colors to HighContrast
- Fix scale borders in HighContrast
- Tweak visible focus behavior
- HighConstrast: Add public colors
- HighContrast: Fix scale borders
* CSS:
- Drop the nonstandard -gtk-icon-theme property
@@ -29,6 +29,12 @@ Overview of Changes in GTK 3.98.4
- Drop the homogeneous property
- Add a use-underline property to stack pages
* GtkScale:
- Make area around the trough clickable
* GtkScrolledWindow:
- Fix kinetic scrolling
* GtkTreeView:
- Break reference cycles in unroot
@@ -46,11 +52,13 @@ Overview of Changes in GTK 3.98.4
* Remove gtk_dialog_run
* Wayland:
- Provide a builtin cursor of last resort
* GDK:
- Wayland: Provide a builtin cursor of last resort
- Change the monitor api to use a GListModel
* GSK:
- Don't include renderer-specific headers automatically
- GL: Fix nested rounded clips
* Introspection:
- Assorted annotation fixes
@@ -73,6 +81,7 @@ Overview of Changes in GTK 3.98.4
* Translation updates:
Chinese (Taiwan)
Esperanto
Japanese
Romanian
Spanish
Ukrainian
+2 -1
View File
@@ -3,4 +3,5 @@ executable('print-editor',
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true)
gui_app: true,
link_args: extra_demo_ldflags)
-1
View File
@@ -86,7 +86,6 @@ gdk_display_has_pending
gdk_display_is_rgba
gdk_display_is_composited
gdk_display_get_default_group
gdk_display_supports_shapes
gdk_display_supports_input_shapes
gdk_display_get_app_launch_context
gdk_display_notify_startup_complete
+1 -1
View File
@@ -47,7 +47,7 @@ How to compile GTK itself
</para>
<informalexample>
<programlisting>
meson --prefix /opt/gtk builddir
meson setup --prefix /opt/gtk builddir
</programlisting>
</informalexample>
<para>
+8 -8
View File
@@ -36,7 +36,7 @@ additional environment variables.
<title><envar>GTK_DEBUG</envar></title>
<para>
Unless GTK has been configured with <option>--enable-debug=no</option>,
Unless GTK has been configured with <option>-Ddebug=false</option>,
this variable can be set to a list of debug options, which cause GTK
to print out different types of debugging information.
<variablelist>
@@ -237,7 +237,7 @@ nevertheless.
<title><envar>GDK_DEBUG</envar></title>
<para>
If GTK has been configured with <option>--enable-debug=yes</option>,
Unless GTK has been configured with <option>-Ddebug=false</option>,
this variable can be set to a list of debug options, which cause GDK
to print out different types of debugging information.
<variablelist>
@@ -327,7 +327,7 @@ nevertheless.
<title><envar>GSK_DEBUG</envar></title>
<para>
If GTK has been configured with <option>--enable-debug=yes</option>,
Unless GTK has been configured with <option>-Ddebug=false</option>,
this variable can be set to a list of debug options, which cause GSK
to print out different types of debugging information.
<variablelist>
@@ -432,11 +432,11 @@ nevertheless.
</varlistentry>
</variablelist>
Since 3.10, this environment variable can contain a comma-separated list
of backend names, which are tried in order. The list may also contain
a *, which means: try all remaining backends. The special value "help" can
be used to make GDK print out a list of all available backends.
For more information about selecting backends, see the gdk_display_manager_get() function.
This environment variable can contain a comma-separated list of backend names,
which are tried in order. The list may also contain a *, which means: try all
remaining backends. The special value "help" can be used to make GDK print out
a list of all available backends. For more information about selecting backends,
see the gdk_display_manager_get() function.
</para>
</formalpara>
+5 -6
View File
@@ -21,18 +21,17 @@ Wayland-specific aspects of using GTK
<para>
The GDK Wayland backend provides support for running GTK applications
under the Wayland display server. To run your application in this way,
select the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
under a Wayland compositor. To run your application in this way, select
the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
</para>
<para>
Currently, the Wayland backend does not use any additional commandline
options or environment variables.
On UNIX, the Wayland backend is enabled by default, so you don't need to
do anything special when compiling it, and everything should "just work."
</para>
<para>
For up-to-date information about the current status of this backend, see
the <ulink url="https://wiki.gnome.org/Initiatives/Wayland/GTK%2B">project page</ulink>.
Currently, the Wayland backend does not use any additional environment variables.
</para>
</refsect1>
+10 -62
View File
@@ -25,65 +25,19 @@ on top of the Win32 API. When compiling GTK on Windows, this backend is
the default.
</para>
<refsect2 id="win32-cmdline">
<title>Windows-specific commandline options</title>
<para>
The Windows GDK backend can be influenced with some
additional command line arguments.
</para>
<formalpara>
<title><systemitem>--sync</systemitem></title>
<para>
Don't batch GDI requests. This might be a marginally useful option for
debugging.
</para>
</formalpara>
<formalpara>
<title><systemitem>--no-wintab</systemitem>,
<systemitem>--ignore-wintab</systemitem></title>
<para>
Don't use the Wintab API for tablet support.
</para>
</formalpara>
<formalpara>
<title><systemitem>--use-wintab</systemitem></title>
<para>
Use the Wintab API for tablet support. This is the default.
</para>
</formalpara>
<formalpara>
<title><systemitem>--max-colors <replaceable>number</replaceable></systemitem></title>
<para>
In 256 color mode, restrict the size of the color palette to
the specified number of colors. This option is obsolete.
</para>
</formalpara>
</refsect2>
<refsect2 id="win32-envar">
<title>Windows-specific environment variables</title>
<para>
The Win32 GDK backend can be influenced with some
additional environment variables.
The Win32 GDK backend can be influenced with some additional environment
variables.
</para>
<formalpara>
<title><envar>GDK_IGNORE_WINTAB</envar></title>
<para>
If this variable is set, GTK doesn't use
the Wintab API for tablet support.
If this variable is set, GTK doesn't use the Wintab API for tablet support.
</para>
</formalpara>
@@ -91,17 +45,8 @@ the Wintab API for tablet support.
<title><envar>GDK_USE_WINTAB</envar></title>
<para>
If this variable is set, GTK uses the Wintab API for
tablet support. This is the default.
</para>
</formalpara>
<formalpara>
<title><envar>GDK_WIN32_MAX_COLORS</envar></title>
<para>
Specifies the size of the color palette used
in 256 color mode.
If this variable is set, GTK uses the Wintab API for tablet support.
This is the default.
</para>
</formalpara>
@@ -120,7 +65,9 @@ When any other cursor theme is used, GTK will prefer cursors from that theme,
falling back to Windows cursors and built-in X cursors.
</para>
<para>
Theme can be changed by setting <literal>gtk-cursor-theme-name</literal> GTK setting. Users can override GTK settings in the <filename>settings.ini</filename> file or at runtime in the GTK Inspector.
Theme can be changed by setting <literal>gtk-cursor-theme-name</literal> GTK
setting. Users can override GTK settings in the <filename>settings.ini</filename>
file or at runtime in the GTK Inspector.
</para>
<para>
Themes are loaded from normal Windows variants of the XDG locations:
@@ -129,7 +76,8 @@ Themes are loaded from normal Windows variants of the XDG locations:
<filename>RUNTIME_PREFIX/share/icons/THEME/cursors</filename>.
</para>
<para>
The <literal>gtk-cursor-theme-size</literal> setting is ignored, GTK will use the cursor size that Windows tells it to use.
The <literal>gtk-cursor-theme-size</literal> setting is ignored, GTK will use
the cursor size that Windows tells it to use.
</para>
</refsect2>
+9 -34
View File
@@ -20,35 +20,16 @@ X11-specific aspects of using GTK
<title>GTK for the X Window System</title>
<para>
On UNIX, the X backend is the default build for GTK.
So you don't need to do anything special when compiling it,
and everything should "just work."
On UNIX, the X backend is enabled by default, so you don't need to do anything
special when compiling it, and everything should "just work."
</para>
<para>
To mix low-level Xlib routines into a GTK program,
see <link linkend="gdk-X-Window-System-Interaction">GDK X Window
System interaction</link> in the GDK manual.
To mix low-level Xlib routines into a GTK program, see
<link linkend="gdk-X-Window-System-Interaction">GDK X Window System
interaction</link> in the GDK manual.
</para>
<refsect2 id="x11-cmdline">
<title>X11-specific commandline options</title>
<para>
The X backend understands some additional command line arguments.
</para>
<formalpara>
<title><systemitem>--display <replaceable>display</replaceable></systemitem></title>
<para>
The name of the X display to open instead of the one specified
in the <envar>DISPLAY</envar> environment variable.
</para>
</formalpara>
</refsect2>
<refsect2 id="x11-envar">
<title>X11-specific environment variables</title>
@@ -129,9 +110,9 @@ The window manager is in charge of rendering the frame or borders
around windows; it also has final say on the size of each window,
and window states such as minimized, maximized, and so forth.
On Windows and MacOS the application handles most of this.
On X11, if you wish to modify the window's state, or
change its frame, you must ask the window manager to do so on your
behalf, using an established <ulink
On X11, if you wish to modify the window's state, or change its frame,
you must ask the window manager to do so on your behalf, using an
established <ulink
url="http://www.freedesktop.org/standards/">convention</ulink>.
</para>
@@ -139,17 +120,11 @@ url="http://www.freedesktop.org/standards/">convention</ulink>.
GTK has functions for asking the window manager to do various things;
see for example <link
linkend="gtk-window-minimize">gtk_window_minimize()</link> or <link
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</link>.
linkend="gtk-window-maximize">gtk_window_maximize()</link>.
Keep in mind that most window managers <emphasis>will</emphasis> ignore
certain requests from time to time, in the interests of good user interface.
</para>
<!--
May also want to explain DESKTOP_STARTUP_ID here.
http://www.freedesktop.org/Standards/startup-notification-spec
-->
</refsect2>
</refsect1>
+2 -1
View File
@@ -1,3 +1,4 @@
executable('exampleapp',
'exampleapp.c', 'exampleappwin.c', 'main.c',
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -4,4 +4,5 @@ app2_resources = gnome.compile_resources('exampleapp2_resources',
executable('exampleapp2',
'exampleapp.c', 'exampleappwin.c', 'main.c', app2_resources,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -4,4 +4,5 @@ app3_resources = gnome.compile_resources('exampleapp3_resources',
executable('exampleapp3',
'exampleapp.c', 'exampleappwin.c', 'main.c', app3_resources,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -4,4 +4,5 @@ app4_resources = gnome.compile_resources('exampleapp4_resources',
executable('exampleapp4',
'exampleapp.c', 'exampleappwin.c', 'main.c', app4_resources,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -6,4 +6,5 @@ app5_schemas = gnome.compile_schemas()
executable('exampleapp5',
'exampleapp.c', 'exampleappwin.c', 'main.c', app5_resources, app5_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp6',
'exampleappprefs.c',
app6_resources,
app6_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp7',
'exampleappprefs.c',
app7_resources,
app7_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp8',
'exampleappprefs.c',
app8_resources,
app8_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+2 -1
View File
@@ -11,4 +11,5 @@ executable('exampleapp9',
'exampleappprefs.c',
app9_resources,
app9_schemas,
dependencies: libgtk_dep)
dependencies: libgtk_dep,
c_args: common_cflags)
+6 -7
View File
@@ -188,12 +188,11 @@ text_buffer_changed_cb (GtkTextBuffer *buffer,
if (old_n < 3 && n == 3)
{
GNotification *n;
n = g_notification_new ("Three lines of text");
g_notification_set_body (n, "Keep up the good work!");
g_notification_add_button (n, "Start over", "app.clear-all");
g_application_send_notification (G_APPLICATION (app), "three-lines", n);
g_object_unref (n);
GNotification *notification = g_notification_new ("Three lines of text");
g_notification_set_body (notification, "Keep up the good work!");
g_notification_add_button (notification, "Start over", "app.clear-all");
g_application_send_notification (G_APPLICATION (app), "three-lines", notification);
g_object_unref (notification);
}
}
@@ -635,7 +634,7 @@ bloat_pad_class_init (BloatPadClass *class)
}
BloatPad *
static BloatPad *
bloat_pad_new (void)
{
BloatPad *bloat_pad;
+2 -14
View File
@@ -56,6 +56,8 @@ G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
static void
gdk_broadway_display_init (GdkBroadwayDisplay *display)
{
gdk_display_set_input_shapes (GDK_DISPLAY (display), FALSE);
display->id_ht = g_hash_table_new (NULL, NULL);
display->monitor = g_object_new (GDK_TYPE_BROADWAY_MONITOR,
@@ -313,18 +315,6 @@ gdk_broadway_display_notify_startup_complete (GdkDisplay *display,
{
}
static gboolean
gdk_broadway_display_supports_shapes (GdkDisplay *display)
{
return FALSE;
}
static gboolean
gdk_broadway_display_supports_input_shapes (GdkDisplay *display)
{
return FALSE;
}
static gulong
gdk_broadway_display_get_next_serial (GdkDisplay *display)
{
@@ -452,8 +442,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->has_pending = gdk_broadway_display_has_pending;
display_class->queue_events = _gdk_broadway_display_queue_events;
display_class->get_default_group = gdk_broadway_display_get_default_group;
display_class->supports_shapes = gdk_broadway_display_supports_shapes;
display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes;
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
+37 -21
View File
@@ -71,6 +71,7 @@ enum
PROP_0,
PROP_COMPOSITED,
PROP_RGBA,
PROP_INPUT_SHAPES,
LAST_PROP
};
@@ -113,6 +114,10 @@ gdk_display_get_property (GObject *object,
g_value_set_boolean (value, gdk_display_is_rgba (display));
break;
case PROP_INPUT_SHAPES:
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -193,6 +198,19 @@ gdk_display_class_init (GdkDisplayClass *class)
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDisplay:input-shapes:
*
* %TRUE if the display supports input shapes. See
* gdk_display_supports_input_shapes() for details.
*/
props[PROP_INPUT_SHAPES] =
g_param_spec_boolean ("input-shapes",
P_("Input shapes"),
P_("Input shapes"),
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, props);
/**
@@ -322,6 +340,7 @@ gdk_display_init (GdkDisplay *display)
display->composited = TRUE;
display->rgba = TRUE;
display->input_shapes = TRUE;
}
static void
@@ -460,7 +479,7 @@ gdk_display_put_event (GdkDisplay *display,
static void
generate_grab_broken_event (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *surface,
GdkDevice *device,
gboolean implicit,
GdkSurface *grab_surface)
@@ -473,7 +492,7 @@ generate_grab_broken_event (GdkDisplay *display,
event = gdk_grab_broken_event_new (surface,
device,
device,
NULL,
grab_surface,
implicit);
@@ -1094,23 +1113,6 @@ gdk_display_get_primary_clipboard (GdkDisplay *display)
return display->primary_clipboard;
}
/**
* gdk_display_supports_shapes:
* @display: a #GdkDisplay
*
* Returns %TRUE if gdk_surface_shape_combine_mask() can
* be used to create shaped windows on @display.
*
* Returns: %TRUE if shaped windows are supported
*/
gboolean
gdk_display_supports_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_shapes (display);
}
/**
* gdk_display_supports_input_shapes:
* @display: a #GdkDisplay
@@ -1125,7 +1127,21 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return GDK_DISPLAY_GET_CLASS (display)->supports_input_shapes (display);
return display->input_shapes;
}
void
gdk_display_set_input_shapes (GdkDisplay *display,
gboolean input_shapes)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
if (display->input_shapes == input_shapes)
return;
display->input_shapes = input_shapes;
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_INPUT_SHAPES]);
}
static GdkAppLaunchContext *
@@ -1499,7 +1515,7 @@ gdk_display_list_seats (GdkDisplay *display)
/**
* gdk_display_get_monitors:
* @display: a #GdkDisplay
* @self: a #GdkDisplay
*
* Gets the list of monitors associated with this display.
*
+2 -4
View File
@@ -65,6 +65,8 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_display_is_composited (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_is_rgba (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkEvent* gdk_display_get_event (GdkDisplay *display);
@@ -87,10 +89,6 @@ GdkClipboard * gdk_display_get_clipboard (GdkDisplay
GDK_AVAILABLE_IN_ALL
GdkClipboard * gdk_display_get_primary_clipboard (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_supports_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gdk_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id);
+4 -3
View File
@@ -102,6 +102,7 @@ struct _GdkDisplay
#endif /* GDK_RENDERING_VULKAN */
guint rgba : 1;
guint composited : 1;
guint input_shapes : 1;
GdkDebugFlags debug_flags;
@@ -123,9 +124,7 @@ struct _GdkDisplayClass
gboolean (*has_pending) (GdkDisplay *display);
void (*queue_events) (GdkDisplay *display);
void (*make_default) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
gboolean (*supports_shapes) (GdkDisplay *display);
gboolean (*supports_input_shapes) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
@@ -233,6 +232,8 @@ void gdk_display_set_rgba (GdkDisplay *display
gboolean rgba);
void gdk_display_set_composited (GdkDisplay *display,
gboolean composited);
void gdk_display_set_input_shapes (GdkDisplay *display,
gboolean input_shapes);
void gdk_display_add_seat (GdkDisplay *display,
GdkSeat *seat);
+5
View File
@@ -416,6 +416,11 @@ gdk_event_alloc (GdkEventType event_type,
g_assert (event_type >= GDK_DELETE && event_type < GDK_EVENT_LAST);
g_assert (gdk_event_types[event_type] != G_TYPE_INVALID);
g_assert (device == NULL ||
gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
g_assert (source_device == NULL ||
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE);
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
GDK_NOTE (EVENTS, {
+65 -10
View File
@@ -380,6 +380,64 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
*out_final_rect = final_rect;
}
/* Since GdkEvent is a GTypeInstance, GValue can only store it as a pointer,
* and GClosure does not know how to handle its memory management. To avoid
* the event going away in the middle of the signal emission, we provide a
* marshaller that keeps the event alive for the duration of the closure.
*/
static void
gdk_surface_event_marshaller (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data)
{
GdkEvent *event = g_value_get_pointer (&param_values[1]);
gdk_event_ref (event);
_gdk_marshal_BOOLEAN__POINTER (closure,
return_value,
n_param_values,
param_values,
invocation_hint,
marshal_data);
gdk_event_unref (event);
}
static void
gdk_surface_event_marshallerv (GClosure *closure,
GValue *return_value,
gpointer instance,
va_list args,
gpointer marshal_data,
int n_params,
GType *param_types)
{
va_list args_copy;
GdkEvent *event;
G_VA_COPY (args_copy, args);
event = va_arg (args_copy, gpointer);
gdk_event_ref (event);
_gdk_marshal_BOOLEAN__POINTERv (closure,
return_value,
instance,
args,
marshal_data,
n_params,
param_types);
gdk_event_unref (event);
va_end (args_copy);
}
static void
gdk_surface_init (GdkSurface *surface)
{
@@ -533,13 +591,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0,
g_signal_accumulator_true_handled,
NULL,
_gdk_marshal_BOOLEAN__POINTER,
gdk_surface_event_marshaller,
G_TYPE_BOOLEAN,
1,
GDK_TYPE_EVENT);
G_TYPE_POINTER);
g_signal_set_va_marshaller (signals[EVENT],
G_OBJECT_CLASS_TYPE (object_class),
_gdk_marshal_BOOLEAN__POINTERv);
gdk_surface_event_marshallerv);
/**
* GdkSurface::enter-montor:
@@ -2042,17 +2100,14 @@ gdk_surface_get_root_coords (GdkSurface *surface,
* corresponds to an unset bit in the mask will be passed on the
* surface below @surface.
*
* An input shape is typically used with RGBA surfaces.
* An input region is typically used with RGBA surfaces.
* The alpha channel of the surface defines which pixels are
* invisible and allows for nicely antialiased borders,
* and the input shape controls where the surface is
* and the input region controls where the surface is
* “clickable”.
*
* On the X11 platform, this requires version 1.1 of the
* shape extension.
*
* On the Win32 platform, this functionality is not present and the
* function does nothing.
* Use gdk_display_support_input_shapes() to find out if
* a particular backend supports input regions.
*/
void
gdk_surface_set_input_region (GdkSurface *surface,
+2 -2
View File
@@ -592,7 +592,7 @@ emulate_crossing (GdkSurface *surface,
event = gdk_crossing_event_new (type,
surface,
device,
device,
NULL,
time_,
state,
x, y,
@@ -633,7 +633,7 @@ emulate_focus (GdkSurface *surface,
gboolean focus_in,
guint32 time_)
{
GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
GdkEvent *event = gdk_focus_event_new (surface, device, NULL, focus_in);
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
}
-14
View File
@@ -848,18 +848,6 @@ gdk_wayland_display_get_default_group (GdkDisplay *display)
return NULL;
}
static gboolean
gdk_wayland_display_supports_shapes (GdkDisplay *display)
{
return FALSE;
}
static gboolean
gdk_wayland_display_supports_input_shapes (GdkDisplay *display)
{
return TRUE;
}
static gulong
gdk_wayland_display_get_next_serial (GdkDisplay *display)
{
@@ -1019,8 +1007,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->has_pending = gdk_wayland_display_has_pending;
display_class->queue_events = _gdk_wayland_display_queue_events;
display_class->get_default_group = gdk_wayland_display_get_default_group;
display_class->supports_shapes = gdk_wayland_display_supports_shapes;
display_class->supports_input_shapes = gdk_wayland_display_supports_input_shapes;
display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context;
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
-20
View File
@@ -622,23 +622,6 @@ gdk_win32_display_get_default_group (GdkDisplay *display)
return NULL;
}
static gboolean
gdk_win32_display_supports_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return TRUE;
}
static gboolean
gdk_win32_display_supports_input_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
/* Partially supported, see WM_NCHITTEST handler. */
return TRUE;
}
static void
gdk_win32_display_beep (GdkDisplay *display)
{
@@ -1080,9 +1063,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->queue_events = _gdk_win32_display_queue_events;
display_class->get_default_group = gdk_win32_display_get_default_group;
display_class->supports_shapes = gdk_win32_display_supports_shapes;
display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
display_class->get_next_serial = gdk_win32_display_get_next_serial;
+5 -2
View File
@@ -1936,8 +1936,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
device = g_hash_table_lookup (device_manager->id_table,
GINT_TO_POINTER (xev->deviceid));
source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid));
if (xev->sourceid != xev->deviceid)
source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid));
else
source_device = NULL;
_gdk_device_manager_xi2_handle_focus (surface,
xev->event,
+2 -15
View File
@@ -1493,6 +1493,8 @@ gdk_x11_display_open (const gchar *display_name)
#endif
}
gdk_display_set_input_shapes (display, display_x11->have_input_shapes);
display_x11->trusted_client = TRUE;
{
Window root, child;
@@ -2309,19 +2311,6 @@ gdk_x11_display_get_user_time (GdkDisplay *display)
return GDK_X11_DISPLAY (display)->user_time;
}
static gboolean
gdk_x11_display_supports_shapes (GdkDisplay *display)
{
return GDK_X11_DISPLAY (display)->have_shapes;
}
static gboolean
gdk_x11_display_supports_input_shapes (GdkDisplay *display)
{
return GDK_X11_DISPLAY (display)->have_input_shapes;
}
/**
* gdk_x11_display_get_startup_notification_id:
* @display: (type GdkX11Display): a #GdkDisplay
@@ -2945,8 +2934,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->has_pending = gdk_x11_display_has_pending;
display_class->queue_events = _gdk_x11_display_queue_events;
display_class->get_default_group = gdk_x11_display_get_default_group;
display_class->supports_shapes = gdk_x11_display_supports_shapes;
display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes;
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
display_class->get_next_serial = gdk_x11_display_get_next_serial;
+2 -2
View File
@@ -665,12 +665,12 @@ is_pointer_within_shape (GdkDisplay *display,
cairo_region_t *input_shape;
child->shape = NULL;
if (gdk_display_supports_shapes (display))
if (display_x11->have_shapes)
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, 1, ShapeBounding);
#ifdef ShapeInput
input_shape = NULL;
if (gdk_display_supports_input_shapes (display))
if (display_x11->have_input_shapes)
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, 1, ShapeInput);
+31
View File
@@ -106,6 +106,8 @@ static void set_wm_name (GdkDisplay *display,
const gchar *name);
static void move_to_current_desktop (GdkSurface *surface);
static void gdk_x11_toplevel_state_callback (GdkSurface *surface);
static gboolean gdk_x11_toplevel_event_callback (GdkSurface *surface,
GdkEvent *gdk_event);
/* Return whether time1 is considered later than time2 as far as xserver
* time is concerned. Accounts for wraparound.
@@ -149,6 +151,9 @@ _gdk_x11_surface_get_toplevel (GdkSurface *surface)
g_signal_connect (surface, "notify::state",
G_CALLBACK (gdk_x11_toplevel_state_callback),
NULL);
g_signal_connect (surface, "event",
G_CALLBACK (gdk_x11_toplevel_event_callback),
NULL);
}
return impl->toplevel;
@@ -449,6 +454,9 @@ gdk_x11_surface_finalize (GObject *object)
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
gdk_x11_toplevel_state_callback,
NULL);
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
gdk_x11_toplevel_event_callback,
NULL);
_gdk_x11_surface_grab_check_destroy (GDK_SURFACE (impl));
@@ -5033,6 +5041,29 @@ gdk_x11_toplevel_state_callback (GdkSurface *surface)
gdk_x11_toplevel_restore_system_shortcuts (GDK_TOPLEVEL (surface));
}
static gboolean
gdk_x11_toplevel_event_callback (GdkSurface *surface,
GdkEvent *gdk_event)
{
GdkSeat *gdk_seat;
if (!surface->shortcuts_inhibited)
return FALSE;
if (gdk_event_get_event_type (gdk_event) != GDK_GRAB_BROKEN)
return FALSE;
gdk_seat = gdk_surface_get_seat_from_event (surface, gdk_event);
if (gdk_seat != surface->current_shortcuts_inhibited_seat)
return FALSE;
surface->current_shortcuts_inhibited_seat = NULL;
surface->shortcuts_inhibited = FALSE;
g_object_notify (G_OBJECT (surface), "shortcuts-inhibited");
return FALSE;
}
static void
gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface)
{
+19 -14
View File
@@ -98,25 +98,30 @@ typedef enum {
* @GSK_BLEND_MODE_DEFAULT: The default blend mode, which specifies no blending
* @GSK_BLEND_MODE_MULTIPLY: The source color is multiplied by the destination
* and replaces the destination
* @GSK_BLEND_MODE_SCREEN: ...
* @GSK_BLEND_MODE_OVERLAY: ...
* @GSK_BLEND_MODE_DARKEN: ...
* @GSK_BLEND_MODE_LIGHTEN: ...
* @GSK_BLEND_MODE_COLOR_DODGE: ...
* @GSK_BLEND_MODE_COLOR_BURN: ...
* @GSK_BLEND_MODE_HARD_LIGHT: ...
* @GSK_BLEND_MODE_SOFT_LIGHT: ...
* @GSK_BLEND_MODE_DIFFERENCE: ...
* @GSK_BLEND_MODE_EXCLUSION: ...
* @GSK_BLEND_MODE_COLOR: ...
* @GSK_BLEND_MODE_HUE: ...
* @GSK_BLEND_MODE_SATURATION: ...
* @GSK_BLEND_MODE_LUMINOSITY: ...
* @GSK_BLEND_MODE_SCREEN: Multiplies the complements of the destination and source
* color values, then complements the result.
* @GSK_BLEND_MODE_OVERLAY: Multiplies or screens the colors, depending on the
* destination color value. This is the inverse of hard-list
* @GSK_BLEND_MODE_DARKEN: Selects the darker of the destination and source colors
* @GSK_BLEND_MODE_LIGHTEN: Selects the lighter of the destination and source colors
* @GSK_BLEND_MODE_COLOR_DODGE: Brightens the destination color to reflect the source color
* @GSK_BLEND_MODE_COLOR_BURN: Darkens the destination color to reflect the source color
* @GSK_BLEND_MODE_HARD_LIGHT: Multiplies or screens the colors, depending on the source color value
* @GSK_BLEND_MODE_SOFT_LIGHT: Darkens or lightens the colors, depending on the source color value
* @GSK_BLEND_MODE_DIFFERENCE: Subtracts the darker of the two constituent colors from the lighter color
* @GSK_BLEND_MODE_EXCLUSION: Produces an effect similar to that of the difference mode but lower in contrast
* @GSK_BLEND_MODE_COLOR: Creates a color with the hue and saturation of the source color and the luminosity of the destination color
* @GSK_BLEND_MODE_HUE: Creates a color with the hue of the source color and the saturation and luminosity of the destination color
* @GSK_BLEND_MODE_SATURATION: Creates a color with the saturation of the source color and the hue and luminosity of the destination color
* @GSK_BLEND_MODE_LUMINOSITY: Creates a color with the luminosity of the source color and the hue and saturation of the destination color
*
* The blend modes available for render nodes.
*
* The implementation of each blend mode is deferred to the
* rendering pipeline.
*
* See https://www.w3.org/TR/compositing-1/#blending for more information
* on blending and blend modes.
*/
typedef enum {
GSK_BLEND_MODE_DEFAULT = 0,
+25
View File
@@ -21,6 +21,7 @@
#include "gtkcolorchooserprivate.h"
#include "gtkgesturelongpress.h"
#include "gtkgestureclick.h"
#include "gtkcolorutils.h"
#include "gtkorientable.h"
#include "gtkrangeprivate.h"
@@ -53,6 +54,12 @@ static void hold_action (GtkGestureLongPress *gesture,
gdouble y,
GtkWidget *scale);
static void click_action (GtkGestureClick *gesture,
guint n_presses,
double x,
double y,
GtkWidget *scale);
G_DEFINE_TYPE_WITH_PRIVATE (GtkColorScale, gtk_color_scale, GTK_TYPE_SCALE)
void
@@ -160,6 +167,12 @@ gtk_color_scale_init (GtkColorScale *scale)
GTK_PHASE_TARGET);
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed",
G_CALLBACK (click_action), scale);
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
gtk_widget_add_css_class (GTK_WIDGET (scale), "color");
}
@@ -256,6 +269,18 @@ hold_action (GtkGestureLongPress *gesture,
"s", gtk_widget_get_name (scale));
}
static void
click_action (GtkGestureClick *gesture,
guint n_presses,
double x,
double y,
GtkWidget *scale)
{
gtk_widget_activate_action (scale,
"color.edit",
"s", gtk_widget_get_name (scale));
}
static void
scale_finalize (GObject *object)
{
+1 -1
View File
@@ -26,7 +26,7 @@ struct _GtkCssValue {
GTK_CSS_VALUE_BASE
};
static void
static void G_GNUC_NORETURN
gtk_css_value_inherit_free (GtkCssValue *value)
{
/* Can only happen if the unique value gets unreffed too often */
+1 -1
View File
@@ -30,7 +30,7 @@ struct _GtkCssValue {
GTK_CSS_VALUE_BASE
};
static void
static void G_GNUC_NORETURN
gtk_css_value_initial_free (GtkCssValue *value)
{
/* Can only happen if the unique value gets unreffed too often */
+29 -252
View File
@@ -24,276 +24,53 @@
#include "gtkprivatetypebuiltins.h"
#include "gtkprivate.h"
GtkCssLookupValue *
gtk_css_lookup_value_new (guint id,
GtkCssValue *value,
GtkCssSection *section)
{
GtkCssLookupValue *v;
v = g_new0 (GtkCssLookupValue, 1);
v->ref_count = 1;
v->id = id;
v->value = _gtk_css_value_ref (value);
if (section)
v->section = gtk_css_section_ref (section);
return v;
}
static void
gtk_css_lookup_value_free (GtkCssLookupValue *value)
{
_gtk_css_value_unref (value->value);
if (value->section)
gtk_css_section_unref (value->section);
g_free (value);
}
GtkCssLookupValue *
gtk_css_lookup_value_ref (GtkCssLookupValue *value)
{
value->ref_count++;
return value;
}
void
gtk_css_lookup_value_unref (GtkCssLookupValue *value)
_gtk_css_lookup_init (GtkCssLookup *lookup)
{
value->ref_count--;
if (value->ref_count == 0)
gtk_css_lookup_value_free (value);
}
memset (lookup, 0, sizeof (*lookup));
static GHashTable *lookups;
static gboolean
gtk_css_lookup_equal (gconstpointer p1,
gconstpointer p2)
{
const GtkCssLookup *l1 = p1;
const GtkCssLookup *l2 = p2;
int i;
if (!_gtk_bitmask_equals (l1->set_values, l2->set_values))
return FALSE;
if (l1->values == NULL && l2->values == NULL)
return TRUE;
if (l1->values == NULL || l2->values == NULL)
return FALSE;
if (l1->values->len != l2->values->len)
return FALSE;
for (i = 0; i < l1->values->len; i++)
{
GtkCssLookupValue *v1 = g_ptr_array_index (l1->values, i);
GtkCssLookupValue *v2 = g_ptr_array_index (l2->values, i);
if (!_gtk_css_value_equal (v1->value, v2->value))
return FALSE;
}
return TRUE;
}
static guint
gtk_css_lookup_hash (gconstpointer data)
{
const GtkCssLookup *l = data;
int i;
guint h;
if (l->values == NULL)
return 0;
h = 0;
for (i = 0; i < l->values->len; i++)
{
GtkCssLookupValue *v = g_ptr_array_index (l->values, i);
char *s = _gtk_css_value_to_string (v->value);
h += g_str_hash (s);
g_free (s);
}
return h;
}
static gboolean
dump_lookups (gpointer data)
{
GHashTableIter iter;
GtkCssLookup *key;
gpointer value;
int total = 0;
int length = 0;
g_hash_table_iter_init (&iter, lookups);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, (gpointer *)&value))
{
total += GPOINTER_TO_INT (value);
length += GPOINTER_TO_INT (value) * key->values->len;
}
g_print ("lookup stats:\n");
g_print ("\t%d different lookups, %d total, %g avg length\n",
g_hash_table_size (lookups),
total,
length / (1.0 * total));
g_hash_table_iter_init (&iter, lookups);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, (gpointer *)&value))
g_print ("\t%d\t%d\n", GPOINTER_TO_INT (value), key->values->len);
g_print ("\n");
return G_SOURCE_CONTINUE;
}
GtkCssLookup *
gtk_css_lookup_new (void)
{
GtkCssLookup *lookup = g_new0 (GtkCssLookup, 1);
lookup->ref_count = 1;
lookup->set_values = _gtk_bitmask_new ();
if (!lookups)
{
lookups = g_hash_table_new (gtk_css_lookup_hash, gtk_css_lookup_equal);
g_timeout_add (1000, dump_lookups, NULL);
}
return lookup;
}
void
gtk_css_lookup_register (GtkCssLookup *lookup)
_gtk_css_lookup_destroy (GtkCssLookup *lookup)
{
gint count;
count = GPOINTER_TO_INT (g_hash_table_lookup (lookups, lookup));
count++;
if (count == 1)
gtk_css_lookup_ref (lookup);
g_hash_table_insert (lookups, lookup, GINT_TO_POINTER (count));
}
static void
gtk_css_lookup_unregister (GtkCssLookup *lookup)
{
gint count;
count = GPOINTER_TO_INT (g_hash_table_lookup (lookups, lookup));
g_assert (count > 0);
if (count == 1)
g_hash_table_remove (lookups, lookup);
else
{
count--;
g_hash_table_insert (lookups, lookup, GINT_TO_POINTER (count));
}
}
static void
gtk_css_lookup_free (GtkCssLookup *lookup)
{
gtk_css_lookup_unregister (lookup);
_gtk_bitmask_free (lookup->set_values);
if (lookup->values)
g_ptr_array_unref (lookup->values);
g_free (lookup);
}
GtkCssLookup *
gtk_css_lookup_ref (GtkCssLookup *lookup)
gboolean
_gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
guint id)
{
gtk_internal_return_val_if_fail (lookup != NULL, NULL);
gtk_internal_return_val_if_fail (lookup->ref_count > 0, NULL);
gtk_internal_return_val_if_fail (lookup != NULL, FALSE);
lookup->ref_count++;
return lookup;
return !_gtk_bitmask_get (lookup->set_values, id);
}
void
gtk_css_lookup_unref (GtkCssLookup *lookup)
{
gtk_internal_return_if_fail (lookup != NULL);
gtk_internal_return_if_fail (lookup->ref_count > 0);
lookup->ref_count--;
if (lookup->ref_count == 1 &&
GPOINTER_TO_INT (g_hash_table_lookup (lookups, lookup)) == 1)
lookup->ref_count--;
if (lookup->ref_count == 0)
gtk_css_lookup_free (lookup);
}
/*
* gtk_css_lookup_fill:
* @lookup: the #GtkCssLookup to populate
* @values: array of values to place into unpopulated slots in @lookup
* @n_values: the length of @values
/**
* _gtk_css_lookup_set:
* @lookup: the lookup
* @id: id of the property to set, see _gtk_style_property_get_id()
* @section: (allow-none): The @section the value was defined in or %NULL
* @value: the cascading value to use
*
* Add the @values to @lookup for properties for which
* @lookup does not have a value yet.
*/
* Sets the @value for a given @id. No value may have been set for @id
* before. See _gtk_css_lookup_is_missing(). This function is used to
* set the winning declaration of a lookup. Note that for performance
* reasons @value and @section are not copied. It is your responsibility
* to ensure they are kept alive until _gtk_css_lookup_free() is called.
**/
void
gtk_css_lookup_fill (GtkCssLookup *lookup,
GtkCssLookupValue **values,
guint n_values)
_gtk_css_lookup_set (GtkCssLookup *lookup,
guint id,
GtkCssSection *section,
GtkCssValue *value)
{
int i, j;
gtk_internal_return_if_fail (lookup != NULL);
gtk_internal_return_if_fail (values != NULL);
gtk_internal_return_if_fail (value != NULL);
gtk_internal_return_if_fail (lookup->values[id].value == NULL);
if (!lookup->values)
lookup->values = g_ptr_array_new_full (MAX (16, n_values),
(GDestroyNotify)gtk_css_lookup_value_unref);
for (i = 0, j = 0; j < n_values; j++, i++)
{
GtkCssLookupValue *v = NULL;
for (; i < lookup->values->len; i++)
{
v = g_ptr_array_index (lookup->values, i);
if (v->id >= values[j]->id)
break;
}
if (i == lookup->values->len || v->id > values[j]->id)
{
g_ptr_array_insert (lookup->values, i, gtk_css_lookup_value_ref (values[j]));
lookup->set_values = _gtk_bitmask_set (lookup->set_values, values[j]->id, TRUE);
}
}
}
GtkCssSection *
gtk_css_lookup_get_section (GtkCssLookup *lookup,
guint id)
{
if (_gtk_bitmask_get (lookup->set_values, id))
{
int i;
for (i = 0; i < lookup->values->len; i++)
{
GtkCssLookupValue *value = g_ptr_array_index (lookup->values, i);
if (value->id == id)
return value->section;
}
}
return NULL;
lookup->values[id].value = value;
lookup->values[id].section = section;
lookup->set_values = _gtk_bitmask_set (lookup->set_values, id, TRUE);
}
+12 -44
View File
@@ -21,9 +21,9 @@
#include <glib-object.h>
#include "gtk/gtkbitmaskprivate.h"
#include "gtk/gtkcssstaticstyleprivate.h"
#include "gtk/css/gtkcsssection.h"
#include "gtk/gtkcssvalueprivate.h"
G_BEGIN_DECLS
@@ -31,62 +31,30 @@ G_BEGIN_DECLS
typedef struct _GtkCssLookup GtkCssLookup;
typedef struct {
int ref_count;
guint id;
GtkCssValue *value;
GtkCssSection *section;
GtkCssSection *section;
GtkCssValue *value;
} GtkCssLookupValue;
GtkCssLookupValue * gtk_css_lookup_value_new (guint id,
GtkCssValue *value,
GtkCssSection *section);
GtkCssLookupValue * gtk_css_lookup_value_ref (GtkCssLookupValue *value);
void gtk_css_lookup_value_unref (GtkCssLookupValue *value);
struct _GtkCssLookup {
int ref_count;
GtkBitmask *set_values;
GPtrArray *values;
GtkCssLookupValue values[GTK_CSS_PROPERTY_N_PROPERTIES];
};
GtkCssLookup * gtk_css_lookup_new (void);
GtkCssLookup * gtk_css_lookup_ref (GtkCssLookup *lookup);
void gtk_css_lookup_unref (GtkCssLookup *lookup);
void gtk_css_lookup_fill (GtkCssLookup *lookup,
GtkCssLookupValue **values,
guint n_values);
GtkCssSection * gtk_css_lookup_get_section (GtkCssLookup *lookup,
void _gtk_css_lookup_init (GtkCssLookup *lookup);
void _gtk_css_lookup_destroy (GtkCssLookup *lookup);
gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
guint id);
void _gtk_css_lookup_set (GtkCssLookup *lookup,
guint id,
GtkCssSection *section,
GtkCssValue *value);
static inline const GtkBitmask *
gtk_css_lookup_get_set_values (const GtkCssLookup *lookup)
_gtk_css_lookup_get_set_values (const GtkCssLookup *lookup)
{
return lookup->set_values;
}
static inline GtkCssLookupValue *
gtk_css_lookup_get (GtkCssLookup *lookup,
guint id)
{
if (_gtk_bitmask_get (lookup->set_values, id))
{
int i;
for (i = 0; i < lookup->values->len; i++)
{
GtkCssLookupValue *value = g_ptr_array_index (lookup->values, i);
if (value->id == id)
return value;
}
}
return NULL;
}
void gtk_css_lookup_register (GtkCssLookup *lookup);
G_END_DECLS
#endif /* __GTK_CSS_LOOKUP_PRIVATE_H__ */
+40 -34
View File
@@ -356,61 +356,64 @@ store_in_global_parent_cache (GtkCssNode *node,
}
static GtkCssStyle *
compute_style (GtkStyleProvider *provider,
const GtkCountingBloomFilter *filter,
GtkCssNode *cssnode,
GtkCssLookup *lookup,
GtkCssChange change)
gtk_css_node_create_style (GtkCssNode *cssnode,
const GtkCountingBloomFilter *filter,
GtkCssChange change)
{
const GtkCssNodeDeclaration *decl;
GtkCssStyle *style;
GtkCssChange style_change;
decl = gtk_css_node_get_declaration (cssnode);
style = lookup_in_global_parent_cache (cssnode, decl);
if (style)
return g_object_ref (style);
created_styles++;
style = gtk_css_static_style_new_compute (provider, filter, cssnode, lookup, change);
if (change & GTK_CSS_CHANGE_NEEDS_RECOMPUTE)
{
/* Need to recompute the change flags */
style_change = 0;
}
else
{
style_change = gtk_css_static_style_get_change (gtk_css_style_get_static_style (cssnode->style));
}
style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode),
filter,
cssnode,
style_change);
store_in_global_parent_cache (cssnode, decl, style);
return style;
}
static GtkCssStyle *
gtk_css_node_create_style (GtkCssNode *cssnode,
GtkCssStyle *style,
const GtkCountingBloomFilter *filter,
GtkCssChange change)
{
GtkCssStyle *new_style;
GtkCssChange style_change;
GtkCssLookup *lookup;
GtkStyleProvider *provider;
provider = gtk_css_node_get_style_provider (cssnode);
style_change = gtk_css_static_style_get_change (GTK_CSS_STATIC_STYLE (style));
lookup = gtk_css_static_style_get_lookup (GTK_CSS_STATIC_STYLE (style));
if (change & (GTK_CSS_RADICAL_CHANGE & ~GTK_CSS_CHANGE_PARENT_STYLE))
new_style = compute_style (provider, filter, cssnode, NULL, 0);
else if (change & style_change)
new_style = compute_style (provider, filter, cssnode, NULL, style_change);
else if (change & GTK_CSS_CHANGE_PARENT_STYLE)
new_style = compute_style (provider, filter, cssnode, lookup, style_change);
else
new_style = g_object_ref (style);
return new_style;
}
static gboolean
should_create_transitions (GtkCssChange change)
{
return (change & GTK_CSS_CHANGE_ANIMATIONS) == 0;
}
static gboolean
gtk_css_style_needs_recreation (GtkCssStyle *style,
GtkCssChange change)
{
gtk_internal_return_val_if_fail (GTK_IS_CSS_STATIC_STYLE (style), TRUE);
/* Try to avoid invalidating if we can */
if (change & GTK_CSS_RADICAL_CHANGE)
return TRUE;
if (gtk_css_static_style_get_change (GTK_CSS_STATIC_STYLE (style)) & change)
return TRUE;
else
return FALSE;
}
static GtkCssStyle *
gtk_css_node_real_update_style (GtkCssNode *cssnode,
const GtkCountingBloomFilter *filter,
@@ -422,7 +425,10 @@ gtk_css_node_real_update_style (GtkCssNode *cssnode,
static_style = GTK_CSS_STYLE (gtk_css_style_get_static_style (style));
new_static_style = gtk_css_node_create_style (cssnode, static_style, filter, change);
if (gtk_css_style_needs_recreation (static_style, change))
new_static_style = gtk_css_node_create_style (cssnode, filter, change);
else
new_static_style = g_object_ref (static_style);
if (new_static_style != static_style || (change & GTK_CSS_CHANGE_ANIMATIONS))
{
+63 -31
View File
@@ -86,16 +86,23 @@ struct _GtkCssProviderClass
typedef struct GtkCssRuleset GtkCssRuleset;
typedef struct _GtkCssScanner GtkCssScanner;
typedef struct _PropertyValue PropertyValue;
typedef enum ParserScope ParserScope;
typedef enum ParserSymbol ParserSymbol;
struct _PropertyValue {
GtkCssStyleProperty *property;
GtkCssValue *value;
GtkCssSection *section;
};
struct GtkCssRuleset
{
GtkCssSelector *selector;
GtkCssSelectorTree *selector_match;
GtkCssLookupValue **styles;
PropertyValue *styles;
guint n_styles;
guint owns_styles : 1;
};
struct _GtkCssScanner
@@ -224,23 +231,30 @@ gtk_css_ruleset_init_copy (GtkCssRuleset *new,
GtkCssRuleset *ruleset,
GtkCssSelector *selector)
{
int i;
memcpy (new, ruleset, sizeof (GtkCssRuleset));
new->selector = selector;
for (i = 0; i < new->n_styles; i++)
gtk_css_lookup_value_ref (new->styles[i]);
/* First copy takes over ownership */
if (ruleset->owns_styles)
ruleset->owns_styles = FALSE;
}
static void
gtk_css_ruleset_clear (GtkCssRuleset *ruleset)
{
int i;
for (i = 0; i < ruleset->n_styles; i++)
gtk_css_lookup_value_unref (ruleset->styles[i]);
if (ruleset->owns_styles)
{
guint i;
for (i = 0; i < ruleset->n_styles; i++)
{
_gtk_css_value_unref (ruleset->styles[i].value);
ruleset->styles[i].value = NULL;
if (ruleset->styles[i].section)
gtk_css_section_unref (ruleset->styles[i].section);
}
g_free (ruleset->styles);
}
if (ruleset->selector)
_gtk_css_selector_free (ruleset->selector);
@@ -254,30 +268,35 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
GtkCssSection *section)
{
guint i;
guint id;
id = _gtk_css_style_property_get_id (property);
g_return_if_fail (ruleset->owns_styles || ruleset->n_styles == 0);
ruleset->owns_styles = TRUE;
for (i = 0; i < ruleset->n_styles; i++)
{
if (ruleset->styles[i]->id > id)
break;
if (ruleset->styles[i]->id == id)
if (ruleset->styles[i].property == property)
{
gtk_css_lookup_value_unref (ruleset->styles[i]);
ruleset->styles[i] = gtk_css_lookup_value_new (id, value, section);
return;
_gtk_css_value_unref (ruleset->styles[i].value);
ruleset->styles[i].value = NULL;
if (ruleset->styles[i].section)
gtk_css_section_unref (ruleset->styles[i].section);
break;
}
}
if (i == ruleset->n_styles)
{
ruleset->n_styles++;
ruleset->styles = g_realloc (ruleset->styles, ruleset->n_styles * sizeof (PropertyValue));
ruleset->styles[i].value = NULL;
ruleset->styles[i].property = property;
}
ruleset->styles = g_realloc (ruleset->styles, (ruleset->n_styles + 1) * sizeof (GtkCssLookupValue *));
if (i < ruleset->n_styles)
memmove (&ruleset->styles[i + 1], &ruleset->styles[i], (ruleset->n_styles - i) * sizeof (GtkCssLookupValue *));
ruleset->n_styles++;
ruleset->styles[i] = gtk_css_lookup_value_new (id, value, section);
ruleset->styles[i].value = value;
if (gtk_keep_css_sections)
ruleset->styles[i].section = gtk_css_section_ref (section);
else
ruleset->styles[i].section = NULL;
}
static void
@@ -438,6 +457,7 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
GtkCssProviderPrivate *priv = gtk_css_provider_get_instance_private (css_provider);
GtkCssRuleset *ruleset;
guint j;
int i;
GtkArray tree_rules_array;
GtkCssRuleset *rules_stack[32];
@@ -459,7 +479,19 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
if (ruleset->styles == NULL)
continue;
gtk_css_lookup_fill (lookup, ruleset->styles, ruleset->n_styles);
for (j = 0; j < ruleset->n_styles; j++)
{
GtkCssStyleProperty *prop = ruleset->styles[j].property;
guint id = _gtk_css_style_property_get_id (prop);
if (!_gtk_css_lookup_is_missing (lookup, id))
continue;
_gtk_css_lookup_set (lookup,
id,
ruleset->styles[j].section,
ruleset->styles[j].value);
}
}
gtk_array_free (&tree_rules_array, NULL);
@@ -1366,10 +1398,10 @@ compare_properties (gconstpointer a, gconstpointer b, gpointer style)
{
const guint *ua = a;
const guint *ub = b;
GtkCssLookupValue **styles = style;
PropertyValue *styles = style;
return strcmp (_gtk_style_property_get_name (GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (styles[*ua]->id))),
_gtk_style_property_get_name (GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (styles[*ub]->id))));
return strcmp (_gtk_style_property_get_name (GTK_STYLE_PROPERTY (styles[*ua].property)),
_gtk_style_property_get_name (GTK_STYLE_PROPERTY (styles[*ub].property)));
}
static void
@@ -1394,9 +1426,9 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
for (i = 0; i < ruleset->n_styles; i++)
{
GtkCssLookupValue *prop = ruleset->styles[sorted[i]];
PropertyValue *prop = &ruleset->styles[sorted[i]];
g_string_append (str, " ");
g_string_append (str, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (prop->id))));
g_string_append (str, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop->property)));
g_string_append (str, ": ");
_gtk_css_value_print (prop->value, str);
g_string_append (str, ";\n");
+59 -67
View File
@@ -43,7 +43,8 @@ static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProvider *provider,
GtkCssStyle *parent_style,
guint id,
GtkCssValue *specified);
GtkCssValue *specified,
GtkCssSection *section);
static const int core_props[] = {
GTK_CSS_PROPERTY_COLOR,
@@ -198,34 +199,19 @@ gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
GtkCssLookup *lookup) \
{ \
GtkCssStyle *style = (GtkCssStyle *)sstyle; \
int i, j; \
int n; \
int i; \
\
style->NAME = (GtkCss ## TYPE ## Values *)gtk_css_values_new (GTK_CSS_ ## ENUM ## _VALUES); \
\
n = lookup->values ? lookup->values->len : 0; \
j = 0; \
for (i = 0; i < G_N_ELEMENTS (NAME ## _props); i++) \
{ \
guint id = NAME ## _props[i]; \
GtkCssValue *value = NULL; \
for (; j < n; j++) \
{ \
GtkCssLookupValue *v = g_ptr_array_index (lookup->values, j); \
if (v->id > id) \
break; \
if (v->id == id) \
{ \
value = v->value; \
break; \
} \
} \
\
gtk_css_static_style_compute_value (sstyle, \
provider, \
parent_style, \
id, \
value); \
lookup->values[id].value, \
lookup->values[id].section); \
} \
} \
static GtkBitmask * gtk_css_ ## NAME ## _values_mask; \
@@ -250,7 +236,7 @@ gtk_css_ ## NAME ## _values_init (void) \
static inline gboolean \
gtk_css_ ## NAME ## _values_unset (const GtkCssLookup *lookup) \
{ \
const GtkBitmask *set_values = gtk_css_lookup_get_set_values (lookup); \
const GtkBitmask *set_values = _gtk_css_lookup_get_set_values (lookup); \
return !_gtk_bitmask_intersects (set_values, gtk_css_ ## NAME ## _values_mask); \
}
@@ -312,11 +298,15 @@ G_DEFINE_TYPE (GtkCssStaticStyle, gtk_css_static_style, GTK_TYPE_CSS_STYLE)
static GtkCssSection *
gtk_css_static_style_get_section (GtkCssStyle *style,
guint id)
guint id)
{
GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style);
return gtk_css_lookup_get_section (sstyle->lookup, id);
if (sstyle->sections == NULL ||
id >= sstyle->sections->len)
return NULL;
return g_ptr_array_index (sstyle->sections, id);
}
static void
@@ -324,7 +314,11 @@ gtk_css_static_style_dispose (GObject *object)
{
GtkCssStaticStyle *style = GTK_CSS_STATIC_STYLE (object);
g_clear_pointer (&style->lookup, gtk_css_lookup_unref);
if (style->sections)
{
g_ptr_array_unref (style->sections);
style->sections = NULL;
}
G_OBJECT_CLASS (gtk_css_static_style_parent_class)->dispose (object);
}
@@ -335,8 +329,6 @@ gtk_css_static_style_get_static_style (GtkCssStyle *style)
return (GtkCssStaticStyle *)style;
}
static GtkCssLookup *the_empty_lookup;
static void
gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
{
@@ -361,8 +353,6 @@ gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
gtk_css_other_values_init ();
verify_style_groups ();
the_empty_lookup = gtk_css_lookup_new ();
}
static void
@@ -370,6 +360,13 @@ gtk_css_static_style_init (GtkCssStaticStyle *style)
{
}
static void
maybe_unref_section (gpointer section)
{
if (section)
gtk_css_section_unref (section);
}
static inline void
gtk_css_take_value (GtkCssValue **variable,
GtkCssValue *value)
@@ -382,7 +379,8 @@ gtk_css_take_value (GtkCssValue **variable,
static void
gtk_css_static_style_set_value (GtkCssStaticStyle *sstyle,
guint id,
GtkCssValue *value)
GtkCssValue *value,
GtkCssSection *section)
{
GtkCssStyle *style = (GtkCssStyle *)sstyle;
@@ -660,6 +658,21 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *sstyle,
g_assert_not_reached ();
break;
}
if (sstyle->sections && sstyle->sections->len > id && g_ptr_array_index (sstyle->sections, id))
{
gtk_css_section_unref (g_ptr_array_index (sstyle->sections, id));
g_ptr_array_index (sstyle->sections, id) = NULL;
}
if (section)
{
if (sstyle->sections == NULL)
sstyle->sections = g_ptr_array_new_with_free_func (maybe_unref_section);
if (sstyle->sections->len <= id)
g_ptr_array_set_size (sstyle->sections, id + 1);
g_ptr_array_index (sstyle->sections, id) = gtk_css_section_ref (section);
}
}
static GtkCssStyle *default_style;
@@ -687,7 +700,6 @@ gtk_css_static_style_get_default (void)
default_style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER (settings),
&filter,
NULL,
NULL,
0);
g_object_set_data_full (G_OBJECT (settings), I_("gtk-default-style"),
default_style, clear_default_style);
@@ -887,7 +899,7 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
if (_gtk_bitmask_is_empty (gtk_css_lookup_get_set_values (lookup)))
if (_gtk_bitmask_is_empty (_gtk_css_lookup_get_set_values (lookup)))
{
style->background = (GtkCssBackgroundValues *)gtk_css_values_ref (gtk_css_background_initial_values);
style->border = (GtkCssBorderValues *)gtk_css_values_ref (gtk_css_border_initial_values);
@@ -974,38 +986,23 @@ GtkCssStyle *
gtk_css_static_style_new_compute (GtkStyleProvider *provider,
const GtkCountingBloomFilter *filter,
GtkCssNode *node,
GtkCssLookup *lookup,
GtkCssChange change)
{
GtkCssStaticStyle *result;
GtkCssLookup lookup;
GtkCssNode *parent;
_gtk_css_lookup_init (&lookup);
if (node)
gtk_style_provider_lookup (provider,
filter,
node,
&lookup,
change == 0 ? &change : NULL);
result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
if (lookup != NULL && change != 0)
{
gtk_css_lookup_ref (lookup);
}
else
{
lookup = gtk_css_lookup_new ();
if (node)
gtk_style_provider_lookup (provider,
filter,
node,
lookup,
change == 0 ? &change : NULL);
gtk_css_lookup_register (lookup);
if (_gtk_bitmask_is_empty (gtk_css_lookup_get_set_values (lookup)))
{
gtk_css_lookup_unref (lookup);
lookup = gtk_css_lookup_ref (the_empty_lookup);
}
}
result->lookup = lookup;
result->change = change;
if (node)
@@ -1013,11 +1010,13 @@ gtk_css_static_style_new_compute (GtkStyleProvider *provider,
else
parent = NULL;
gtk_css_lookup_resolve (lookup,
gtk_css_lookup_resolve (&lookup,
provider,
result,
parent ? gtk_css_node_get_style (parent) : NULL);
_gtk_css_lookup_destroy (&lookup);
return GTK_CSS_STYLE (result);
}
@@ -1032,7 +1031,8 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProvider *provider,
GtkCssStyle *parent_style,
guint id,
GtkCssValue *specified)
GtkCssValue *specified,
GtkCssSection *section)
{
GtkCssValue *value;
GtkBorderStyle border_style;
@@ -1055,7 +1055,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
border_style = _gtk_css_border_style_value_get (gtk_css_style_get_value ((GtkCssStyle *)style, id - 1));
if (border_style == GTK_BORDER_STYLE_NONE || border_style == GTK_BORDER_STYLE_HIDDEN)
{
gtk_css_static_style_set_value (style, id, gtk_css_dimension_value_new (0, GTK_CSS_NUMBER));
gtk_css_static_style_set_value (style, id, gtk_css_dimension_value_new (0, GTK_CSS_NUMBER), section);
return;
}
break;
@@ -1084,7 +1084,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
value = _gtk_css_initial_value_new_compute (id, provider, (GtkCssStyle *)style, parent_style);
}
gtk_css_static_style_set_value (style, id, value);
gtk_css_static_style_set_value (style, id, value, section);
}
GtkCssChange
@@ -1094,11 +1094,3 @@ gtk_css_static_style_get_change (GtkCssStaticStyle *style)
return style->change;
}
GtkCssLookup *
gtk_css_static_style_get_lookup (GtkCssStaticStyle *style)
{
g_return_val_if_fail (GTK_IS_CSS_STATIC_STYLE (style), NULL);
return style->lookup;
}
+3 -5
View File
@@ -23,7 +23,6 @@
#include "gtk/gtkcssstyleprivate.h"
#include "gtk/gtkcountingbloomfilterprivate.h"
#include "gtk/gtkcsslookupprivate.h"
G_BEGIN_DECLS
@@ -41,8 +40,9 @@ struct _GtkCssStaticStyle
{
GtkCssStyle parent;
GtkCssChange change; /* change as returned by value lookup */
GtkCssLookup *lookup;
GPtrArray *sections; /* sections the values are defined in */
GtkCssChange change; /* change as returned by value lookup */
};
struct _GtkCssStaticStyleClass
@@ -56,10 +56,8 @@ GtkCssStyle * gtk_css_static_style_get_default (void);
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProvider *provider,
const GtkCountingBloomFilter *filter,
GtkCssNode *node,
GtkCssLookup *lookup,
GtkCssChange change);
GtkCssChange gtk_css_static_style_get_change (GtkCssStaticStyle *style);
GtkCssLookup * gtk_css_static_style_get_lookup (GtkCssStaticStyle *style);
G_END_DECLS
-1
View File
@@ -25,7 +25,6 @@
#include "gtkstylecontextprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"
#include "gtkcssstaticstyleprivate.h"
G_DEFINE_TYPE (GtkCssWidgetNode, gtk_css_widget_node, GTK_TYPE_CSS_NODE)
+3 -3
View File
@@ -266,7 +266,7 @@ struct _GtkNothingActionClass
G_DEFINE_TYPE (GtkNothingAction, gtk_nothing_action, GTK_TYPE_SHORTCUT_ACTION)
static void
static void G_GNUC_NORETURN
gtk_nothing_action_finalize (GObject *gobject)
{
g_assert_not_reached ();
@@ -438,7 +438,7 @@ struct _GtkActivateActionClass
G_DEFINE_TYPE (GtkActivateAction, gtk_activate_action, GTK_TYPE_SHORTCUT_ACTION)
static void
static void G_GNUC_NORETURN
gtk_activate_action_finalize (GObject *gobject)
{
g_assert_not_reached ();
@@ -513,7 +513,7 @@ struct _GtkMnemonicActionClass
G_DEFINE_TYPE (GtkMnemonicAction, gtk_mnemonic_action, GTK_TYPE_SHORTCUT_ACTION)
static void
static void G_GNUC_NORETURN
gtk_mnemonic_action_finalize (GObject *gobject)
{
g_assert_not_reached ();
+1 -1
View File
@@ -401,7 +401,7 @@ struct _GtkNeverTriggerClass
G_DEFINE_TYPE (GtkNeverTrigger, gtk_never_trigger, GTK_TYPE_SHORTCUT_TRIGGER)
static void
static void G_GNUC_NORETURN
gtk_never_trigger_finalize (GObject *gobject)
{
g_assert_not_reached ();
+7 -5
View File
@@ -1237,6 +1237,12 @@ combobox {
min-width: 16px;
}
// align menu labels with the button label
> popover.menu > contents modelbutton {
padding-left: 9px;
padding-right: 9px;
}
&.linked {
button:nth-child(2) {
&:dir(ltr) { @extend %linked_not_left; }
@@ -2397,16 +2403,12 @@ radiobutton {
&.text-button {
// this is for a nice focus on check and radios text
padding: 4px 2px;
padding: 4px;
}
}
check,
radio {
margin: 0 4px;
&:only-child { margin: 0; }
min-height: 14px;
min-width: 14px;
border: 1px solid;
+1 -1
View File
@@ -1,5 +1,5 @@
project('gtk', 'c',
version: '3.98.3',
version: '3.98.4',
default_options: [
'buildtype=debugoptimized',
'warning_level=1',
+415 -397
View File
File diff suppressed because it is too large Load Diff
+52 -51
View File
@@ -9,8 +9,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gtk+ 2.4.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-16 10:39+0000\n"
"PO-Revision-Date: 2020-05-16 17:51+0300\n"
"POT-Creation-Date: 2020-05-18 13:12+0000\n"
"PO-Revision-Date: 2020-05-18 17:02+0300\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <kde-i18n-uk@kde.org>\n"
"Language: uk\n"
@@ -22,7 +22,7 @@ msgstr ""
"X-Generator: Lokalize 20.07.70\n"
#: gdk/gdkapplaunchcontext.c:133 gdk/gdkdrawcontext.c:155 gdk/gdkseat.c:200
#: gdk/gdkseat.c:201 gdk/gdksurface.c:428 gdk/gdksurface.c:429
#: gdk/gdkseat.c:201 gdk/gdksurface.c:431 gdk/gdksurface.c:432
#: gdk/win32/gdkcursor-win32.c:234 gtk/gtkicontheme.c:990
#: gtk/gtkicontheme.c:991 gtk/gtkmountoperation.c:190 gtk/gtkstylecontext.c:145
#: gtk/gtkwindow.c:878
@@ -195,14 +195,19 @@ msgstr "Стан модифікатора"
msgid "The modifier state of the keyboard"
msgstr "Стан модифікатора клавіатури"
#: gdk/gdkdisplay.c:180 gdk/gdkdisplay.c:181
#: gdk/gdkdisplay.c:183 gdk/gdkdisplay.c:184
msgid "Composited"
msgstr "Складений"
#: gdk/gdkdisplay.c:193 gdk/gdkdisplay.c:194
#: gdk/gdkdisplay.c:196 gdk/gdkdisplay.c:197
msgid "RGBA"
msgstr "RGBA"
#: gdk/gdkdisplay.c:209 gdk/gdkdisplay.c:210
#| msgid "Input source"
msgid "Input shapes"
msgstr "Вхідні форми"
#: gdk/gdkdisplaymanager.c:167
msgid "Default Display"
msgstr "Типовий дисплей"
@@ -239,23 +244,23 @@ msgstr "Батьківське"
msgid "The parent surface"
msgstr "Батьківська поверхня"
#: gdk/gdkpopup.c:87 gtk/gtkpopover.c:1703
#: gdk/gdkpopup.c:87 gtk/gtkpopover.c:1637
msgid "Autohide"
msgstr "Автоприховування"
#: gdk/gdksurface.c:415 gdk/gdksurface.c:416 gtk/gtkwidget.c:1084
#: gdk/gdksurface.c:418 gdk/gdksurface.c:419 gtk/gtkwidget.c:1084
msgid "Cursor"
msgstr "Курсор"
#: gdk/gdksurface.c:435 gdk/gdksurface.c:436
#: gdk/gdksurface.c:438 gdk/gdksurface.c:439
msgid "Frame Clock"
msgstr "Годинник кадрів"
#: gdk/gdksurface.c:442 gdk/gdksurface.c:443
#: gdk/gdksurface.c:445 gdk/gdksurface.c:446
msgid "Mapped"
msgstr "Відображення"
#: gdk/gdktoplevel.c:101 gdk/gdktoplevel.c:102 gtk/gtkcssnode.c:617
#: gdk/gdktoplevel.c:103 gdk/gdktoplevel.c:104 gtk/gtkcssnode.c:617
#: gtk/gtkswitch.c:539
msgid "State"
msgstr "Стан"
@@ -747,17 +752,17 @@ msgstr ""
#: gtk/gtkaspectframe.c:166 gtk/gtkbutton.c:253 gtk/gtkcombobox.c:784
#: gtk/gtkdragicon.c:372 gtk/gtkexpander.c:366 gtk/gtkflowbox.c:513
#: gtk/gtkframe.c:190 gtk/gtklistbox.c:3455 gtk/gtknotebook.c:570
#: gtk/gtkoverlay.c:319 gtk/gtkpopover.c:1731 gtk/gtkrevealer.c:354
#: gtk/gtkoverlay.c:319 gtk/gtkpopover.c:1665 gtk/gtkrevealer.c:354
#: gtk/gtkscrolledwindow.c:759 gtk/gtksearchbar.c:316 gtk/gtkstack.c:381
#: gtk/gtkviewport.c:390 gtk/gtkwindow.c:970 gtk/gtkwindowhandle.c:578
#: gtk/gtkviewport.c:390 gtk/gtkwindow.c:970 gtk/gtkwindowhandle.c:591
msgid "Child"
msgstr "Вкладений елемент"
#: gtk/gtkaspectframe.c:167 gtk/gtkbutton.c:254 gtk/gtkexpander.c:367
#: gtk/gtkflowbox.c:514 gtk/gtkframe.c:191 gtk/gtklistbox.c:3456
#: gtk/gtkoverlay.c:320 gtk/gtkpopover.c:1732 gtk/gtkrevealer.c:355
#: gtk/gtkoverlay.c:320 gtk/gtkpopover.c:1666 gtk/gtkrevealer.c:355
#: gtk/gtkscrolledwindow.c:760 gtk/gtksearchbar.c:317 gtk/gtkviewport.c:391
#: gtk/gtkwindow.c:971 gtk/gtkwindowhandle.c:579
#: gtk/gtkwindow.c:971 gtk/gtkwindowhandle.c:592
msgid "The child widget"
msgstr "Дочірній віджет"
@@ -2845,11 +2850,11 @@ msgstr "Мітка скасування"
msgid "The label on the cancel button"
msgstr "Мітка на кнопці скасування"
#: gtk/gtkfilechooserwidget.c:7639 gtk/gtkfilechooserwidget.c:7640
#: gtk/gtkfilechooserwidget.c:7642 gtk/gtkfilechooserwidget.c:7643
msgid "Search mode"
msgstr "Режим пошуку"
#: gtk/gtkfilechooserwidget.c:7646 gtk/gtkfilechooserwidget.c:7647
#: gtk/gtkfilechooserwidget.c:7649 gtk/gtkfilechooserwidget.c:7650
#: gtk/gtkshortcutsshortcut.c:634
msgid "Subtitle"
msgstr "Підзаголовок"
@@ -4047,7 +4052,7 @@ msgstr "Позначка меню"
msgid "The text of the menu widget"
msgstr "Текст віджета меню"
#: gtk/gtknotebook.c:605 gtk/gtkpaned.c:420 gtk/gtkpopover.c:1696
#: gtk/gtknotebook.c:605 gtk/gtkpaned.c:420 gtk/gtkpopover.c:1630
msgid "Position"
msgstr "Позиція"
@@ -4272,22 +4277,18 @@ msgstr ""
"розмір, який він вимагає"
#: gtk/gtkpaned.c:528
#| msgid "Resize first child"
msgid "First child"
msgstr "Перший дочірній"
#: gtk/gtkpaned.c:529
#| msgid "Resize first child"
msgid "The first child"
msgstr "Перший дочірній"
#: gtk/gtkpaned.c:535
#| msgid "Shrink second child"
msgid "Second child"
msgstr "Другий дочірній"
#: gtk/gtkpaned.c:536
#| msgid "Resize second child"
msgid "The second child"
msgstr "Другий дочірній"
@@ -4331,19 +4332,19 @@ msgstr "Може стискатися"
msgid "Allow self to be smaller than contents"
msgstr "Дозволити віджету бути меншим за вміст"
#: gtk/gtkplacessidebar.c:4336
#: gtk/gtkplacessidebar.c:4334
msgid "Location to Select"
msgstr "Місце для позначення"
#: gtk/gtkplacessidebar.c:4337
#: gtk/gtkplacessidebar.c:4335
msgid "The location to highlight in the sidebar"
msgstr "Місце підсвічування на бічній панелі"
#: gtk/gtkplacessidebar.c:4342 gtk/gtkplacesview.c:2247
#: gtk/gtkplacessidebar.c:4340 gtk/gtkplacesview.c:2250
msgid "Open Flags"
msgstr "Прапорці відкривання"
#: gtk/gtkplacessidebar.c:4343 gtk/gtkplacesview.c:2248
#: gtk/gtkplacessidebar.c:4341 gtk/gtkplacesview.c:2251
msgid ""
"Modes in which the calling application can open locations selected in the "
"sidebar"
@@ -4351,70 +4352,70 @@ msgstr ""
"Режими, у яких програма виклику може відкривати адреси, які позначено на "
"бічній панелі"
#: gtk/gtkplacessidebar.c:4349
#: gtk/gtkplacessidebar.c:4347
msgid "Show recent files"
msgstr "Показувати нещодавні файли"
#: gtk/gtkplacessidebar.c:4350
#: gtk/gtkplacessidebar.c:4348
msgid "Whether the sidebar includes a builtin shortcut for recent files"
msgstr ""
"Визначає, чи містить бічна панель вбудований пункт для нещодавно "
"використаних файлів"
#: gtk/gtkplacessidebar.c:4355
#: gtk/gtkplacessidebar.c:4353
msgid "Show “Desktop”"
msgstr "Показувати «Стільниця»"
#: gtk/gtkplacessidebar.c:4356
#: gtk/gtkplacessidebar.c:4354
msgid "Whether the sidebar includes a builtin shortcut to the Desktop folder"
msgstr "Чи повинна бічна панель містити вбудований пункт теки стільниці"
#: gtk/gtkplacessidebar.c:4361
#: gtk/gtkplacessidebar.c:4359
msgid "Show “Enter Location”"
msgstr "Показувати «Введіть адресу»"
#: gtk/gtkplacessidebar.c:4362
#: gtk/gtkplacessidebar.c:4360
msgid ""
"Whether the sidebar includes a builtin shortcut to manually enter a location"
msgstr "Чи містить бічна панель вбудований пункт введення адреси вручну"
#: gtk/gtkplacessidebar.c:4367
#: gtk/gtkplacessidebar.c:4365
msgid "Show “Trash”"
msgstr "Показувати «Смітник»"
#: gtk/gtkplacessidebar.c:4368
#: gtk/gtkplacessidebar.c:4366
msgid "Whether the sidebar includes a builtin shortcut to the Trash location"
msgstr "Чи містить бічна панель вбудований пункт теки «Смітник»"
#: gtk/gtkplacessidebar.c:4373
#: gtk/gtkplacessidebar.c:4371
msgid "Show “Other locations”"
msgstr "Показувати «Інші місця»"
#: gtk/gtkplacessidebar.c:4374
#: gtk/gtkplacessidebar.c:4372
msgid "Whether the sidebar includes an item to show external locations"
msgstr "Чи містить бічна панель вбудований пункт зовнішніх місць"
#: gtk/gtkplacessidebar.c:4379
#: gtk/gtkplacessidebar.c:4377
msgid "Show “Starred Location”"
msgstr "Показувати «Позначене місце»"
#: gtk/gtkplacessidebar.c:4380
#: gtk/gtkplacessidebar.c:4378
msgid "Whether the sidebar includes an item to show starred files"
msgstr "Чи включає бічна панель елемент для показу позначених зірками файлів"
#: gtk/gtkplacesview.c:2233
#: gtk/gtkplacesview.c:2236
msgid "Loading"
msgstr "Завантаження"
#: gtk/gtkplacesview.c:2234
#: gtk/gtkplacesview.c:2237
msgid "Whether the view is loading locations"
msgstr "Чи показувати завантажувані місця"
#: gtk/gtkplacesview.c:2240
#: gtk/gtkplacesview.c:2243
msgid "Fetching networks"
msgstr "Отримання даних мереж"
#: gtk/gtkplacesview.c:2241
#: gtk/gtkplacesview.c:2244
msgid "Whether the view is fetching networks"
msgstr "Чи показувати отримання даних мереж"
@@ -4470,43 +4471,43 @@ msgstr "Файл, який представлено рядком, якщо та
msgid "Whether the row represents a network location"
msgstr "Чи показує рядок місце у мережі"
#: gtk/gtkpopover.c:1689
#: gtk/gtkpopover.c:1623
msgid "Pointing to"
msgstr "Вказує"
#: gtk/gtkpopover.c:1690
#: gtk/gtkpopover.c:1624
msgid "Rectangle the bubble window points to"
msgstr "Прямокутник, куди вказує вікно-бульбашка"
#: gtk/gtkpopover.c:1697
#: gtk/gtkpopover.c:1631
msgid "Position to place the bubble window"
msgstr "Позиція для розміщення вікна-бульбашки"
#: gtk/gtkpopover.c:1704
#: gtk/gtkpopover.c:1638
msgid "Whether to dismiss the popover on outside clicks"
msgstr "Чи слід закривати накладне меню при клацанні ззовні"
#: gtk/gtkpopover.c:1710 gtk/gtkwindow.c:956
#: gtk/gtkpopover.c:1644 gtk/gtkwindow.c:956
msgid "Default widget"
msgstr "Типовий віджет"
#: gtk/gtkpopover.c:1711 gtk/gtkwindow.c:957
#: gtk/gtkpopover.c:1645 gtk/gtkwindow.c:957
msgid "The default widget"
msgstr "Типовий віджет"
#: gtk/gtkpopover.c:1717
#: gtk/gtkpopover.c:1651
msgid "Has Arrow"
msgstr "Містить стрілку"
#: gtk/gtkpopover.c:1718
#: gtk/gtkpopover.c:1652
msgid "Whether to draw an arrow"
msgstr "Визначає, чи слід малювати стрілку"
#: gtk/gtkpopover.c:1724
#: gtk/gtkpopover.c:1658
msgid "Mnemonics visible"
msgstr "Мнемоніка видима"
#: gtk/gtkpopover.c:1725
#: gtk/gtkpopover.c:1659
msgid "Whether mnemonics are currently visible in this popover"
msgstr "Чи показано мнемоніку у цьому накладному меню"
-1
View File
@@ -23,7 +23,6 @@ test_data = [
'test2.css', 'test2.ui', 'test2.nodes',
'test3.css', 'test3.ui', 'test3.nodes',
'test4.css', 'test4.ui', 'test4.nodes',
'test5.css', 'test5.ui', 'test5.nodes',
]
if get_option('install-tests')
+1 -1
View File
@@ -9,7 +9,7 @@ diff = find_program('diff', required: true)
common_env = [
'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GDK_DEBUG=default-settings:misc',
'GDK_DEBUG=default-settings',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
+1 -13
View File
@@ -46,7 +46,6 @@ static char *opt_detail;
static char *opt_name;
static char *opt_output;
static gboolean opt_start_time;
static gboolean opt_verbose;
static GOptionEntry options[] = {
{ "mark", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &opt_mark, "Name of the mark", "NAME" },
@@ -55,7 +54,6 @@ static GOptionEntry options[] = {
{ "runs", '0', G_OPTION_FLAG_NONE, G_OPTION_ARG_INT, &opt_rep, "Number of runs", "COUNT" },
{ "name", '0', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &opt_name, "Name of this test", "NAME" },
{ "output", '0', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &opt_output, "Directory to save syscap files", "DIRECTORY" },
{ "verbose", '0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_verbose, "Verbose output", NULL },
{ NULL, }
};
@@ -206,9 +204,6 @@ main (int argc, char *argv[])
/* Ignore the first run, to avoid cache effects */
for (i = 1; i < opt_rep; i++)
{
if (values[i] == 0)
continue;
if (min > values[i])
min = values[i];
if (max < values[i])
@@ -217,14 +212,7 @@ main (int argc, char *argv[])
total += values[i];
}
if (opt_verbose)
{
for (i = 1; i < opt_rep; i++)
g_print ("%g ", MILLISECONDS (values[i]));
g_print ("\n");
}
g_print ("%d runs counted, min %g, max %g, avg %g\n",
g_print ("%d runs, min %g, max %g, avg %g\n",
count,
MILLISECONDS (min),
MILLISECONDS (max),