Compare commits

..

17 Commits

Author SHA1 Message Date
Matthias Clasen de0c61754e Dump lookup statistics
Print out numbers of lookups, their size, and
the amount of sharing.

For widget-factory, the numbers are like this:
319 different lookups, 890 total, 18.5022 avg length

For the gtk-demo listbox example, the number are:
58 different lookups, 9742 total, 15.9997 avg length
2020-05-17 23:24:32 -04:00
Matthias Clasen 21a4fd1a5f Make GtkCssLookupValue refcounted 2020-05-17 22:59:27 -04:00
Matthias Clasen 498f816f1f Keep an empty lookup singleton
This is a simple optimization to avoid wasting a good
chunk of memory (~16k in widget-factory) on identical
structures. This is the one case that it easy to handle.
2020-05-17 22:59:27 -04:00
Matthias Clasen 343c80a609 css style: Use a linear sweep to compute values
We can again take advantage of the lookup values
being sorted, and only iterate through them once
to find all the values for a given group.
2020-05-17 22:52:55 -04:00
Matthias Clasen 8a5bb6cb5f lookup: Merge rulesets more efficiently
Keep lookups sorted, and take advantage of the fact
that the rulesets are sorted, too. We can merge them
in a linear sweep.
2020-05-17 22:52:55 -04:00
Matthias Clasen 05376fca63 css provider: Keep rulesets sorted
Keep each ruleset sorted by property id. This
will let us be faster when adding the rules to
a lookup later on.
2020-05-17 22:52:55 -04:00
Matthias Clasen a112c3ff45 Revamp lookup memory handling
Make GtkCssLookup keep an an array of pointers to the
PropertyValue structs in the rulesets, instead of copying
things. Then make GtkCssStaticStyle find sections in the
lookup, instead of keeping a separate array for those.
2020-05-17 22:52:55 -04:00
Matthias Clasen 91120d3f46 cssnode: Reused cached lookups
When we determine that the lookup won't change,
reuse the cached lookup by passing it to
to gtk_css_static_style_new_compute.
2020-05-17 22:52:55 -04:00
Matthias Clasen 37c299dfcb cssnode: Rearrange code a bit
Move all the cases of style updating into
gtk_css_node_create_style() and also fold
gtk_css_style_needs_recreation into this function.
2020-05-17 22:39:54 -04:00
Matthias Clasen 0c871dcab0 Pass a lookup to gtk_css_static_style_new_compute
Allow passing a lookup to gtk_css_static_style_new_compute
to bypass the matching and just resolve the style based
on that lookup.

Update all callers to pass NULL for now.
2020-05-17 22:39:45 -04:00
Matthias Clasen fa79e131e0 style: Cache the lookup
This is not used for anything yet.
2020-05-17 22:30:09 -04:00
Matthias Clasen e34d7d07b1 lookup: Don't store flat arrays
Most lookups have no or just a few values.
We can drastically reduce the amount of memory used for lookups,
and then we can afford to keep them around and avoid some lookups
in the future.
2020-05-17 22:30:09 -04:00
Matthias Clasen 6fb18b74b4 lookup: Add a getter
This will make it easier to change the internals
in the next commits.
2020-05-17 22:30:09 -04:00
Matthias Clasen acb5c2abef Make lookups refcounted
This will be useful when we share lookups.
2020-05-17 22:30:09 -04:00
Matthias Clasen bfa7f57a92 lookup: Loose the underscores
We are going to pretty much rewrite this in the
following commits. Take the opportunity to drop
the leading _ from the api.
2020-05-17 22:30:09 -04:00
Matthias Clasen bbad192209 Clean up some includes
gtkcsslookupprivate.h does not need to include
gtkcssstaticstyleprivate.h. Fix up the fallout
in gtkcsswidgetnode.c.
2020-05-17 22:30:07 -04:00
Matthias Clasen 1401a69faf perf test: Discard invalid runs
It turns out that we occasionally get a 0, which we
should just ignore to avoid skewing the numbers.

Also add a --verbose option which dumps all values
and makes debugging this sort of issue easier.
2020-05-17 22:29:30 -04:00
51 changed files with 1165 additions and 964 deletions
+4 -13
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,12 +29,6 @@ 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
@@ -52,13 +46,11 @@ Overview of Changes in GTK 3.98.4
* Remove gtk_dialog_run
* GDK:
- Wayland: Provide a builtin cursor of last resort
- Change the monitor api to use a GListModel
* Wayland:
- Provide a builtin cursor of last resort
* GSK:
- Don't include renderer-specific headers automatically
- GL: Fix nested rounded clips
* Introspection:
- Assorted annotation fixes
@@ -81,7 +73,6 @@ Overview of Changes in GTK 3.98.4
* Translation updates:
Chinese (Taiwan)
Esperanto
Japanese
Romanian
Spanish
Ukrainian
+1 -2
View File
@@ -3,5 +3,4 @@ executable('print-editor',
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags)
gui_app: true)
+1
View File
@@ -86,6 +86,7 @@ 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 setup --prefix /opt/gtk builddir
meson --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>-Ddebug=false</option>,
Unless GTK has been configured with <option>--enable-debug=no</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>
Unless GTK has been configured with <option>-Ddebug=false</option>,
If GTK has been configured with <option>--enable-debug=yes</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>
Unless GTK has been configured with <option>-Ddebug=false</option>,
If GTK has been configured with <option>--enable-debug=yes</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>
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.
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.
</para>
</formalpara>
+6 -5
View File
@@ -21,17 +21,18 @@ Wayland-specific aspects of using GTK
<para>
The GDK Wayland backend provides support for running GTK applications
under a Wayland compositor. To run your application in this way, select
the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
under the Wayland display server. To run your application in this way,
select the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
</para>
<para>
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."
Currently, the Wayland backend does not use any additional commandline
options or environment variables.
</para>
<para>
Currently, the Wayland backend does not use any additional environment variables.
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>.
</para>
</refsect1>
+62 -10
View File
@@ -25,19 +25,65 @@ 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>
@@ -45,8 +91,17 @@ If this variable is set, GTK doesn't use 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.
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.
</para>
</formalpara>
@@ -65,9 +120,7 @@ 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:
@@ -76,8 +129,7 @@ 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>
+34 -9
View File
@@ -20,16 +20,35 @@ X11-specific aspects of using GTK
<title>GTK for the X Window System</title>
<para>
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."
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."
</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>
@@ -110,9 +129,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>
@@ -120,11 +139,17 @@ 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>.
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</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>
+1 -2
View File
@@ -1,4 +1,3 @@
executable('exampleapp',
'exampleapp.c', 'exampleappwin.c', 'main.c',
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -4,5 +4,4 @@ app2_resources = gnome.compile_resources('exampleapp2_resources',
executable('exampleapp2',
'exampleapp.c', 'exampleappwin.c', 'main.c', app2_resources,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -4,5 +4,4 @@ app3_resources = gnome.compile_resources('exampleapp3_resources',
executable('exampleapp3',
'exampleapp.c', 'exampleappwin.c', 'main.c', app3_resources,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -4,5 +4,4 @@ app4_resources = gnome.compile_resources('exampleapp4_resources',
executable('exampleapp4',
'exampleapp.c', 'exampleappwin.c', 'main.c', app4_resources,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -6,5 +6,4 @@ app5_schemas = gnome.compile_schemas()
executable('exampleapp5',
'exampleapp.c', 'exampleappwin.c', 'main.c', app5_resources, app5_schemas,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -11,5 +11,4 @@ executable('exampleapp6',
'exampleappprefs.c',
app6_resources,
app6_schemas,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -11,5 +11,4 @@ executable('exampleapp7',
'exampleappprefs.c',
app7_resources,
app7_schemas,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -11,5 +11,4 @@ executable('exampleapp8',
'exampleappprefs.c',
app8_resources,
app8_schemas,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+1 -2
View File
@@ -11,5 +11,4 @@ executable('exampleapp9',
'exampleappprefs.c',
app9_resources,
app9_schemas,
dependencies: libgtk_dep,
c_args: common_cflags)
dependencies: libgtk_dep)
+7 -6
View File
@@ -188,11 +188,12 @@ text_buffer_changed_cb (GtkTextBuffer *buffer,
if (old_n < 3 && n == 3)
{
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);
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);
}
}
@@ -634,7 +635,7 @@ bloat_pad_class_init (BloatPadClass *class)
}
static BloatPad *
BloatPad *
bloat_pad_new (void)
{
BloatPad *bloat_pad;
+14 -2
View File
@@ -56,8 +56,6 @@ 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,
@@ -315,6 +313,18 @@ 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)
{
@@ -442,6 +452,8 @@ 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;
+21 -37
View File
@@ -71,7 +71,6 @@ enum
PROP_0,
PROP_COMPOSITED,
PROP_RGBA,
PROP_INPUT_SHAPES,
LAST_PROP
};
@@ -114,10 +113,6 @@ 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);
}
@@ -198,19 +193,6 @@ 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);
/**
@@ -340,7 +322,6 @@ gdk_display_init (GdkDisplay *display)
display->composited = TRUE;
display->rgba = TRUE;
display->input_shapes = TRUE;
}
static void
@@ -479,7 +460,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)
@@ -492,7 +473,7 @@ generate_grab_broken_event (GdkDisplay *display,
event = gdk_grab_broken_event_new (surface,
device,
NULL,
device,
grab_surface,
implicit);
@@ -1113,6 +1094,23 @@ 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
@@ -1127,21 +1125,7 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
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]);
return GDK_DISPLAY_GET_CLASS (display)->supports_input_shapes (display);
}
static GdkAppLaunchContext *
@@ -1515,7 +1499,7 @@ gdk_display_list_seats (GdkDisplay *display)
/**
* gdk_display_get_monitors:
* @self: a #GdkDisplay
* @display: a #GdkDisplay
*
* Gets the list of monitors associated with this display.
*
+4 -2
View File
@@ -65,8 +65,6 @@ 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);
@@ -89,6 +87,10 @@ 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);
+3 -4
View File
@@ -102,7 +102,6 @@ struct _GdkDisplay
#endif /* GDK_RENDERING_VULKAN */
guint rgba : 1;
guint composited : 1;
guint input_shapes : 1;
GdkDebugFlags debug_flags;
@@ -124,7 +123,9 @@ struct _GdkDisplayClass
gboolean (*has_pending) (GdkDisplay *display);
void (*queue_events) (GdkDisplay *display);
void (*make_default) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
gboolean (*supports_shapes) (GdkDisplay *display);
gboolean (*supports_input_shapes) (GdkDisplay *display);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
@@ -232,8 +233,6 @@ 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,11 +416,6 @@ 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, {
+10 -65
View File
@@ -380,64 +380,6 @@ 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)
{
@@ -591,13 +533,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0,
g_signal_accumulator_true_handled,
NULL,
gdk_surface_event_marshaller,
_gdk_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN,
1,
G_TYPE_POINTER);
GDK_TYPE_EVENT);
g_signal_set_va_marshaller (signals[EVENT],
G_OBJECT_CLASS_TYPE (object_class),
gdk_surface_event_marshallerv);
_gdk_marshal_BOOLEAN__POINTERv);
/**
* GdkSurface::enter-montor:
@@ -2100,14 +2042,17 @@ 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 region is typically used with RGBA surfaces.
* An input shape 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 region controls where the surface is
* and the input shape controls where the surface is
* “clickable”.
*
* Use gdk_display_support_input_shapes() to find out if
* a particular backend supports input regions.
* 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.
*/
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,
NULL,
device,
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, NULL, focus_in);
GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
}
+14
View File
@@ -848,6 +848,18 @@ 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)
{
@@ -1007,6 +1019,8 @@ 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,6 +622,23 @@ 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)
{
@@ -1063,6 +1080,9 @@ 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;
+2 -5
View File
@@ -1936,11 +1936,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
device = g_hash_table_lookup (device_manager->id_table,
GINT_TO_POINTER (xev->deviceid));
if (xev->sourceid != xev->deviceid)
source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid));
else
source_device = NULL;
source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid));
_gdk_device_manager_xi2_handle_focus (surface,
xev->event,
+15 -2
View File
@@ -1493,8 +1493,6 @@ 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;
@@ -2311,6 +2309,19 @@ 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
@@ -2934,6 +2945,8 @@ 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 (display_x11->have_shapes)
if (gdk_display_supports_shapes (display))
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, 1, ShapeBounding);
#ifdef ShapeInput
input_shape = NULL;
if (display_x11->have_input_shapes)
if (gdk_display_supports_input_shapes (display))
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, 1, ShapeInput);
-31
View File
@@ -106,8 +106,6 @@ 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.
@@ -151,9 +149,6 @@ _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;
@@ -454,9 +449,6 @@ 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));
@@ -5041,29 +5033,6 @@ 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)
{
+14 -19
View File
@@ -98,30 +98,25 @@ 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: 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
* @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: ...
*
* 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,7 +21,6 @@
#include "gtkcolorchooserprivate.h"
#include "gtkgesturelongpress.h"
#include "gtkgestureclick.h"
#include "gtkcolorutils.h"
#include "gtkorientable.h"
#include "gtkrangeprivate.h"
@@ -54,12 +53,6 @@ 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
@@ -167,12 +160,6 @@ 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");
}
@@ -269,18 +256,6 @@ 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 G_GNUC_NORETURN
static void
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 G_GNUC_NORETURN
static void
gtk_css_value_initial_free (GtkCssValue *value)
{
/* Can only happen if the unique value gets unreffed too often */
+254 -31
View File
@@ -24,53 +24,276 @@
#include "gtkprivatetypebuiltins.h"
#include "gtkprivate.h"
void
_gtk_css_lookup_init (GtkCssLookup *lookup)
GtkCssLookupValue *
gtk_css_lookup_value_new (guint id,
GtkCssValue *value,
GtkCssSection *section)
{
memset (lookup, 0, sizeof (*lookup));
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)
{
value->ref_count--;
if (value->ref_count == 0)
gtk_css_lookup_value_free (value);
}
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_destroy (GtkCssLookup *lookup)
gtk_css_lookup_register (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);
}
gboolean
_gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
guint id)
GtkCssLookup *
gtk_css_lookup_ref (GtkCssLookup *lookup)
{
gtk_internal_return_val_if_fail (lookup != NULL, FALSE);
gtk_internal_return_val_if_fail (lookup != NULL, NULL);
gtk_internal_return_val_if_fail (lookup->ref_count > 0, NULL);
return !_gtk_bitmask_get (lookup->set_values, id);
lookup->ref_count++;
return lookup;
}
/**
* _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
*
* 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_set (GtkCssLookup *lookup,
guint id,
GtkCssSection *section,
GtkCssValue *value)
gtk_css_lookup_unref (GtkCssLookup *lookup)
{
gtk_internal_return_if_fail (lookup != NULL);
gtk_internal_return_if_fail (value != NULL);
gtk_internal_return_if_fail (lookup->values[id].value == NULL);
gtk_internal_return_if_fail (lookup->ref_count > 0);
lookup->values[id].value = value;
lookup->values[id].section = section;
lookup->set_values = _gtk_bitmask_set (lookup->set_values, id, TRUE);
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
*
* Add the @values to @lookup for properties for which
* @lookup does not have a value yet.
*/
void
gtk_css_lookup_fill (GtkCssLookup *lookup,
GtkCssLookupValue **values,
guint n_values)
{
int i, j;
gtk_internal_return_if_fail (lookup != NULL);
gtk_internal_return_if_fail (values != 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;
}
+44 -12
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,30 +31,62 @@ G_BEGIN_DECLS
typedef struct _GtkCssLookup GtkCssLookup;
typedef struct {
GtkCssSection *section;
GtkCssValue *value;
int ref_count;
guint id;
GtkCssValue *value;
GtkCssSection *section;
} 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;
GtkCssLookupValue values[GTK_CSS_PROPERTY_N_PROPERTIES];
GPtrArray *values;
};
void _gtk_css_lookup_init (GtkCssLookup *lookup);
void _gtk_css_lookup_destroy (GtkCssLookup *lookup);
gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
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,
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__ */
+34 -40
View File
@@ -356,64 +356,61 @@ store_in_global_parent_cache (GtkCssNode *node,
}
static GtkCssStyle *
gtk_css_node_create_style (GtkCssNode *cssnode,
const GtkCountingBloomFilter *filter,
GtkCssChange change)
compute_style (GtkStyleProvider *provider,
const GtkCountingBloomFilter *filter,
GtkCssNode *cssnode,
GtkCssLookup *lookup,
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++;
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);
style = gtk_css_static_style_new_compute (provider, filter, cssnode, lookup, 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,
@@ -425,10 +422,7 @@ gtk_css_node_real_update_style (GtkCssNode *cssnode,
static_style = GTK_CSS_STYLE (gtk_css_style_get_static_style (style));
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);
new_static_style = gtk_css_node_create_style (cssnode, static_style, filter, change);
if (new_static_style != static_style || (change & GTK_CSS_CHANGE_ANIMATIONS))
{
+31 -63
View File
@@ -86,23 +86,16 @@ 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;
PropertyValue *styles;
GtkCssLookupValue **styles;
guint n_styles;
guint owns_styles : 1;
};
struct _GtkCssScanner
@@ -231,30 +224,23 @@ gtk_css_ruleset_init_copy (GtkCssRuleset *new,
GtkCssRuleset *ruleset,
GtkCssSelector *selector)
{
int i;
memcpy (new, ruleset, sizeof (GtkCssRuleset));
new->selector = selector;
/* First copy takes over ownership */
if (ruleset->owns_styles)
ruleset->owns_styles = FALSE;
for (i = 0; i < new->n_styles; i++)
gtk_css_lookup_value_ref (new->styles[i]);
}
static void
gtk_css_ruleset_clear (GtkCssRuleset *ruleset)
{
if (ruleset->owns_styles)
{
guint i;
int i;
for (i = 0; i < ruleset->n_styles; i++)
gtk_css_lookup_value_unref (ruleset->styles[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);
@@ -268,35 +254,30 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
GtkCssSection *section)
{
guint i;
guint id;
g_return_if_fail (ruleset->owns_styles || ruleset->n_styles == 0);
ruleset->owns_styles = TRUE;
id = _gtk_css_style_property_get_id (property);
for (i = 0; i < ruleset->n_styles; i++)
{
if (ruleset->styles[i].property == property)
if (ruleset->styles[i]->id > id)
break;
if (ruleset->styles[i]->id == id)
{
_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;
gtk_css_lookup_value_unref (ruleset->styles[i]);
ruleset->styles[i] = gtk_css_lookup_value_new (id, value, section);
return;
}
}
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[i].value = value;
if (gtk_keep_css_sections)
ruleset->styles[i].section = gtk_css_section_ref (section);
else
ruleset->styles[i].section = NULL;
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);
}
static void
@@ -457,7 +438,6 @@ 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];
@@ -479,19 +459,7 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
if (ruleset->styles == NULL)
continue;
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_css_lookup_fill (lookup, ruleset->styles, ruleset->n_styles);
}
gtk_array_free (&tree_rules_array, NULL);
@@ -1398,10 +1366,10 @@ compare_properties (gconstpointer a, gconstpointer b, gpointer style)
{
const guint *ua = a;
const guint *ub = b;
PropertyValue *styles = style;
GtkCssLookupValue **styles = style;
return strcmp (_gtk_style_property_get_name (GTK_STYLE_PROPERTY (styles[*ua].property)),
_gtk_style_property_get_name (GTK_STYLE_PROPERTY (styles[*ub].property)));
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))));
}
static void
@@ -1426,9 +1394,9 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
for (i = 0; i < ruleset->n_styles; i++)
{
PropertyValue *prop = &ruleset->styles[sorted[i]];
GtkCssLookupValue *prop = ruleset->styles[sorted[i]];
g_string_append (str, " ");
g_string_append (str, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop->property)));
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_css_value_print (prop->value, str);
g_string_append (str, ";\n");
+67 -59
View File
@@ -43,8 +43,7 @@ static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProvider *provider,
GtkCssStyle *parent_style,
guint id,
GtkCssValue *specified,
GtkCssSection *section);
GtkCssValue *specified);
static const int core_props[] = {
GTK_CSS_PROPERTY_COLOR,
@@ -199,19 +198,34 @@ gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
GtkCssLookup *lookup) \
{ \
GtkCssStyle *style = (GtkCssStyle *)sstyle; \
int i; \
int i, j; \
int n; \
\
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, \
lookup->values[id].value, \
lookup->values[id].section); \
value); \
} \
} \
static GtkBitmask * gtk_css_ ## NAME ## _values_mask; \
@@ -236,7 +250,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); \
}
@@ -298,15 +312,11 @@ 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);
if (sstyle->sections == NULL ||
id >= sstyle->sections->len)
return NULL;
return g_ptr_array_index (sstyle->sections, id);
return gtk_css_lookup_get_section (sstyle->lookup, id);
}
static void
@@ -314,11 +324,7 @@ gtk_css_static_style_dispose (GObject *object)
{
GtkCssStaticStyle *style = GTK_CSS_STATIC_STYLE (object);
if (style->sections)
{
g_ptr_array_unref (style->sections);
style->sections = NULL;
}
g_clear_pointer (&style->lookup, gtk_css_lookup_unref);
G_OBJECT_CLASS (gtk_css_static_style_parent_class)->dispose (object);
}
@@ -329,6 +335,8 @@ 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)
{
@@ -353,6 +361,8 @@ 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
@@ -360,13 +370,6 @@ 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)
@@ -379,8 +382,7 @@ gtk_css_take_value (GtkCssValue **variable,
static void
gtk_css_static_style_set_value (GtkCssStaticStyle *sstyle,
guint id,
GtkCssValue *value,
GtkCssSection *section)
GtkCssValue *value)
{
GtkCssStyle *style = (GtkCssStyle *)sstyle;
@@ -658,21 +660,6 @@ 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;
@@ -700,6 +687,7 @@ 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);
@@ -899,7 +887,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);
@@ -986,23 +974,38 @@ 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)
@@ -1010,13 +1013,11 @@ 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);
}
@@ -1031,8 +1032,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProvider *provider,
GtkCssStyle *parent_style,
guint id,
GtkCssValue *specified,
GtkCssSection *section)
GtkCssValue *specified)
{
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), section);
gtk_css_static_style_set_value (style, id, gtk_css_dimension_value_new (0, GTK_CSS_NUMBER));
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, section);
gtk_css_static_style_set_value (style, id, value);
}
GtkCssChange
@@ -1094,3 +1094,11 @@ 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;
}
+5 -3
View File
@@ -23,6 +23,7 @@
#include "gtk/gtkcssstyleprivate.h"
#include "gtk/gtkcountingbloomfilterprivate.h"
#include "gtk/gtkcsslookupprivate.h"
G_BEGIN_DECLS
@@ -40,9 +41,8 @@ struct _GtkCssStaticStyle
{
GtkCssStyle parent;
GPtrArray *sections; /* sections the values are defined in */
GtkCssChange change; /* change as returned by value lookup */
GtkCssChange change; /* change as returned by value lookup */
GtkCssLookup *lookup;
};
struct _GtkCssStaticStyleClass
@@ -56,8 +56,10 @@ 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,6 +25,7 @@
#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 G_GNUC_NORETURN
static void
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 G_GNUC_NORETURN
static void
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 G_GNUC_NORETURN
static void
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 G_GNUC_NORETURN
static void
gtk_never_trigger_finalize (GObject *gobject)
{
g_assert_not_reached ();
+5 -7
View File
@@ -1237,12 +1237,6 @@ 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; }
@@ -2403,12 +2397,16 @@ radiobutton {
&.text-button {
// this is for a nice focus on check and radios text
padding: 4px;
padding: 4px 2px;
}
}
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.4',
version: '3.98.3',
default_options: [
'buildtype=debugoptimized',
'warning_level=1',
+397 -415
View File
File diff suppressed because it is too large Load Diff
+51 -52
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-18 13:12+0000\n"
"PO-Revision-Date: 2020-05-18 17:02+0300\n"
"POT-Creation-Date: 2020-05-16 10:39+0000\n"
"PO-Revision-Date: 2020-05-16 17:51+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:431 gdk/gdksurface.c:432
#: gdk/gdkseat.c:201 gdk/gdksurface.c:428 gdk/gdksurface.c:429
#: 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,19 +195,14 @@ msgstr "Стан модифікатора"
msgid "The modifier state of the keyboard"
msgstr "Стан модифікатора клавіатури"
#: gdk/gdkdisplay.c:183 gdk/gdkdisplay.c:184
#: gdk/gdkdisplay.c:180 gdk/gdkdisplay.c:181
msgid "Composited"
msgstr "Складений"
#: gdk/gdkdisplay.c:196 gdk/gdkdisplay.c:197
#: gdk/gdkdisplay.c:193 gdk/gdkdisplay.c:194
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 "Типовий дисплей"
@@ -244,23 +239,23 @@ msgstr "Батьківське"
msgid "The parent surface"
msgstr "Батьківська поверхня"
#: gdk/gdkpopup.c:87 gtk/gtkpopover.c:1637
#: gdk/gdkpopup.c:87 gtk/gtkpopover.c:1703
msgid "Autohide"
msgstr "Автоприховування"
#: gdk/gdksurface.c:418 gdk/gdksurface.c:419 gtk/gtkwidget.c:1084
#: gdk/gdksurface.c:415 gdk/gdksurface.c:416 gtk/gtkwidget.c:1084
msgid "Cursor"
msgstr "Курсор"
#: gdk/gdksurface.c:438 gdk/gdksurface.c:439
#: gdk/gdksurface.c:435 gdk/gdksurface.c:436
msgid "Frame Clock"
msgstr "Годинник кадрів"
#: gdk/gdksurface.c:445 gdk/gdksurface.c:446
#: gdk/gdksurface.c:442 gdk/gdksurface.c:443
msgid "Mapped"
msgstr "Відображення"
#: gdk/gdktoplevel.c:103 gdk/gdktoplevel.c:104 gtk/gtkcssnode.c:617
#: gdk/gdktoplevel.c:101 gdk/gdktoplevel.c:102 gtk/gtkcssnode.c:617
#: gtk/gtkswitch.c:539
msgid "State"
msgstr "Стан"
@@ -752,17 +747,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:1665 gtk/gtkrevealer.c:354
#: gtk/gtkoverlay.c:319 gtk/gtkpopover.c:1731 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:591
#: gtk/gtkviewport.c:390 gtk/gtkwindow.c:970 gtk/gtkwindowhandle.c:578
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:1666 gtk/gtkrevealer.c:355
#: gtk/gtkoverlay.c:320 gtk/gtkpopover.c:1732 gtk/gtkrevealer.c:355
#: gtk/gtkscrolledwindow.c:760 gtk/gtksearchbar.c:317 gtk/gtkviewport.c:391
#: gtk/gtkwindow.c:971 gtk/gtkwindowhandle.c:592
#: gtk/gtkwindow.c:971 gtk/gtkwindowhandle.c:579
msgid "The child widget"
msgstr "Дочірній віджет"
@@ -2850,11 +2845,11 @@ msgstr "Мітка скасування"
msgid "The label on the cancel button"
msgstr "Мітка на кнопці скасування"
#: gtk/gtkfilechooserwidget.c:7642 gtk/gtkfilechooserwidget.c:7643
#: gtk/gtkfilechooserwidget.c:7639 gtk/gtkfilechooserwidget.c:7640
msgid "Search mode"
msgstr "Режим пошуку"
#: gtk/gtkfilechooserwidget.c:7649 gtk/gtkfilechooserwidget.c:7650
#: gtk/gtkfilechooserwidget.c:7646 gtk/gtkfilechooserwidget.c:7647
#: gtk/gtkshortcutsshortcut.c:634
msgid "Subtitle"
msgstr "Підзаголовок"
@@ -4052,7 +4047,7 @@ msgstr "Позначка меню"
msgid "The text of the menu widget"
msgstr "Текст віджета меню"
#: gtk/gtknotebook.c:605 gtk/gtkpaned.c:420 gtk/gtkpopover.c:1630
#: gtk/gtknotebook.c:605 gtk/gtkpaned.c:420 gtk/gtkpopover.c:1696
msgid "Position"
msgstr "Позиція"
@@ -4277,18 +4272,22 @@ 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 "Другий дочірній"
@@ -4332,19 +4331,19 @@ msgstr "Може стискатися"
msgid "Allow self to be smaller than contents"
msgstr "Дозволити віджету бути меншим за вміст"
#: gtk/gtkplacessidebar.c:4334
#: gtk/gtkplacessidebar.c:4336
msgid "Location to Select"
msgstr "Місце для позначення"
#: gtk/gtkplacessidebar.c:4335
#: gtk/gtkplacessidebar.c:4337
msgid "The location to highlight in the sidebar"
msgstr "Місце підсвічування на бічній панелі"
#: gtk/gtkplacessidebar.c:4340 gtk/gtkplacesview.c:2250
#: gtk/gtkplacessidebar.c:4342 gtk/gtkplacesview.c:2247
msgid "Open Flags"
msgstr "Прапорці відкривання"
#: gtk/gtkplacessidebar.c:4341 gtk/gtkplacesview.c:2251
#: gtk/gtkplacessidebar.c:4343 gtk/gtkplacesview.c:2248
msgid ""
"Modes in which the calling application can open locations selected in the "
"sidebar"
@@ -4352,70 +4351,70 @@ msgstr ""
"Режими, у яких програма виклику може відкривати адреси, які позначено на "
"бічній панелі"
#: gtk/gtkplacessidebar.c:4347
#: gtk/gtkplacessidebar.c:4349
msgid "Show recent files"
msgstr "Показувати нещодавні файли"
#: gtk/gtkplacessidebar.c:4348
#: gtk/gtkplacessidebar.c:4350
msgid "Whether the sidebar includes a builtin shortcut for recent files"
msgstr ""
"Визначає, чи містить бічна панель вбудований пункт для нещодавно "
"використаних файлів"
#: gtk/gtkplacessidebar.c:4353
#: gtk/gtkplacessidebar.c:4355
msgid "Show “Desktop”"
msgstr "Показувати «Стільниця»"
#: gtk/gtkplacessidebar.c:4354
#: gtk/gtkplacessidebar.c:4356
msgid "Whether the sidebar includes a builtin shortcut to the Desktop folder"
msgstr "Чи повинна бічна панель містити вбудований пункт теки стільниці"
#: gtk/gtkplacessidebar.c:4359
#: gtk/gtkplacessidebar.c:4361
msgid "Show “Enter Location”"
msgstr "Показувати «Введіть адресу»"
#: gtk/gtkplacessidebar.c:4360
#: gtk/gtkplacessidebar.c:4362
msgid ""
"Whether the sidebar includes a builtin shortcut to manually enter a location"
msgstr "Чи містить бічна панель вбудований пункт введення адреси вручну"
#: gtk/gtkplacessidebar.c:4365
#: gtk/gtkplacessidebar.c:4367
msgid "Show “Trash”"
msgstr "Показувати «Смітник»"
#: gtk/gtkplacessidebar.c:4366
#: gtk/gtkplacessidebar.c:4368
msgid "Whether the sidebar includes a builtin shortcut to the Trash location"
msgstr "Чи містить бічна панель вбудований пункт теки «Смітник»"
#: gtk/gtkplacessidebar.c:4371
#: gtk/gtkplacessidebar.c:4373
msgid "Show “Other locations”"
msgstr "Показувати «Інші місця»"
#: gtk/gtkplacessidebar.c:4372
#: gtk/gtkplacessidebar.c:4374
msgid "Whether the sidebar includes an item to show external locations"
msgstr "Чи містить бічна панель вбудований пункт зовнішніх місць"
#: gtk/gtkplacessidebar.c:4377
#: gtk/gtkplacessidebar.c:4379
msgid "Show “Starred Location”"
msgstr "Показувати «Позначене місце»"
#: gtk/gtkplacessidebar.c:4378
#: gtk/gtkplacessidebar.c:4380
msgid "Whether the sidebar includes an item to show starred files"
msgstr "Чи включає бічна панель елемент для показу позначених зірками файлів"
#: gtk/gtkplacesview.c:2236
#: gtk/gtkplacesview.c:2233
msgid "Loading"
msgstr "Завантаження"
#: gtk/gtkplacesview.c:2237
#: gtk/gtkplacesview.c:2234
msgid "Whether the view is loading locations"
msgstr "Чи показувати завантажувані місця"
#: gtk/gtkplacesview.c:2243
#: gtk/gtkplacesview.c:2240
msgid "Fetching networks"
msgstr "Отримання даних мереж"
#: gtk/gtkplacesview.c:2244
#: gtk/gtkplacesview.c:2241
msgid "Whether the view is fetching networks"
msgstr "Чи показувати отримання даних мереж"
@@ -4471,43 +4470,43 @@ msgstr "Файл, який представлено рядком, якщо та
msgid "Whether the row represents a network location"
msgstr "Чи показує рядок місце у мережі"
#: gtk/gtkpopover.c:1623
#: gtk/gtkpopover.c:1689
msgid "Pointing to"
msgstr "Вказує"
#: gtk/gtkpopover.c:1624
#: gtk/gtkpopover.c:1690
msgid "Rectangle the bubble window points to"
msgstr "Прямокутник, куди вказує вікно-бульбашка"
#: gtk/gtkpopover.c:1631
#: gtk/gtkpopover.c:1697
msgid "Position to place the bubble window"
msgstr "Позиція для розміщення вікна-бульбашки"
#: gtk/gtkpopover.c:1638
#: gtk/gtkpopover.c:1704
msgid "Whether to dismiss the popover on outside clicks"
msgstr "Чи слід закривати накладне меню при клацанні ззовні"
#: gtk/gtkpopover.c:1644 gtk/gtkwindow.c:956
#: gtk/gtkpopover.c:1710 gtk/gtkwindow.c:956
msgid "Default widget"
msgstr "Типовий віджет"
#: gtk/gtkpopover.c:1645 gtk/gtkwindow.c:957
#: gtk/gtkpopover.c:1711 gtk/gtkwindow.c:957
msgid "The default widget"
msgstr "Типовий віджет"
#: gtk/gtkpopover.c:1651
#: gtk/gtkpopover.c:1717
msgid "Has Arrow"
msgstr "Містить стрілку"
#: gtk/gtkpopover.c:1652
#: gtk/gtkpopover.c:1718
msgid "Whether to draw an arrow"
msgstr "Визначає, чи слід малювати стрілку"
#: gtk/gtkpopover.c:1658
#: gtk/gtkpopover.c:1724
msgid "Mnemonics visible"
msgstr "Мнемоніка видима"
#: gtk/gtkpopover.c:1659
#: gtk/gtkpopover.c:1725
msgid "Whether mnemonics are currently visible in this popover"
msgstr "Чи показано мнемоніку у цьому накладному меню"
+1
View File
@@ -23,6 +23,7 @@ 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',
'GDK_DEBUG=default-settings:misc',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
+13 -1
View File
@@ -46,6 +46,7 @@ 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" },
@@ -54,6 +55,7 @@ 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, }
};
@@ -204,6 +206,9 @@ 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])
@@ -212,7 +217,14 @@ main (int argc, char *argv[])
total += values[i];
}
g_print ("%d runs, min %g, max %g, avg %g\n",
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",
count,
MILLISECONDS (min),
MILLISECONDS (max),