Compare commits

..

21 Commits

Author SHA1 Message Date
Chun-wei Fan 3346d68311 build: Check for Meson 0.59.0+ for pre-VS2015 Update 2
Meson 0.59.0 added support for `link_whole:` for pre-Visual Studio 2015 Update
2, so clean things up a bit by just checking for and requiring people to
use Meson 0.59.0 if building with pre-Visual Studio 2015 Update 2.

This reverts commit 943559da67.
2021-07-30 23:37:33 +08:00
Matthias Clasen cc6ecc8b62 Merge branch 'source-static-name' into 'master'
Avoid copying static debug strings

See merge request GNOME/gtk!3789
2021-07-29 11:59:02 +00:00
Matthias Clasen 05eaffb9f2 ci: Collect tools test output
This should help understanding why some of them fail.
2021-07-28 22:42:46 -04:00
Matthias Clasen 67b568f464 testsuite: Set TEST_RESULT_DIR for tools tests 2021-07-28 22:42:46 -04:00
Matthias Clasen 19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Matthias Clasen db8b3419c2 Merge branch 'compose-parse-msvc' into 'master'
compose-parse.c: Include stdlib.h (fix build on Visual Studio)

See merge request GNOME/gtk!3794
2021-07-28 10:38:25 +00:00
Fabio Tomat 0f5ba5192a Update Friulian translation
(cherry picked from commit 16aa8dbad7)
2021-07-28 09:11:33 +00:00
Chun-wei Fan 108c423d70 compose-parse.c: Include stdlib.h
That is needed for exit(), and it may not have been included by the
other headers.
2021-07-28 15:18:36 +08:00
Emmanuele Bassi dded10a396 Merge branch 'gi-fix' into 'master'
gdk: add missing Since annotation

See merge request GNOME/gtk!3790
2021-07-27 17:38:28 +00:00
Marc-André Lureau 1b080826db gdk: add missing Since annotation
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-07-27 21:01:31 +04:00
Matthias Clasen 910f23ea19 Merge branch 'wip/otte/widgetfactory-dnd' into 'master'
Improve DND

See merge request GNOME/gtk!3785
2021-07-27 04:12:58 +00:00
Benjamin Otte f1b50baba1 widget-factory: Add images that support dnd
Just use the bottom left notebook for a GtkPicture with custom drag
source and drop target.
2021-07-27 04:40:57 +02:00
Matthias Clasen 4453597946 widget-factory: Some new backgrounds
Snowy wasn't ideal because of the aspect ratio.
Replace it by beach and nyc.
2021-07-27 04:40:42 +02:00
Benjamin Otte 192bfa10cb droptarget: Make formats construct-only writable
This way, it can be set in GtkBuilder.

Also make sure to only ever look at the GTypes set in the formats, as
GtkDropTarget cannot deal with mime types.
2021-07-27 04:28:04 +02:00
Benjamin Otte 0781429dc5 builder: Add support for GdkContentFormats 2021-07-27 04:28:04 +02:00
Benjamin Otte d760332f00 testsuite: Add contentformat tests 2021-07-27 04:28:04 +02:00
Benjamin Otte 131be5f2e8 contentformats: Add gdk_content_formats_parse() 2021-07-27 04:13:42 +02:00
Matthias Clasen 57a95c540c Merge branch 'matthiasc/for-master' into 'master'
ngl: Cosmetics

See merge request GNOME/gtk!3786
2021-07-26 18:21:56 +00:00
Matthias Clasen 09deb1d757 ngl: Cosmetics
Use the macro we already have to check that colors
are fully transparent.
2021-07-26 13:42:10 -04:00
Benjamin Otte 6a5d555f58 contentformats: Change the format of gdk_content_formats_to_string()
Now, we just print a whitespace-separated list of GTypes and mime types.

This makes this neat for 2 things:

1. Parsing it (see next commit)
2. Using it in GtkBuilder (see commits after that)

In particular, the common case of supporting a single GType (or mime
type) looks like just printing the GType (or mime type), which in
GtkBuilder looks like
<property name="formats">GdkTexture</property>
2021-07-26 02:28:49 +02:00
Benjamin Otte f5dc71021f dnd: Guard drags with a reference when finishing
Usually the "dnd-finished" signal will be used to unref the GdkDrag. In
those cases, we would lose the object, so that when we do the final
drag_drop_done() afterwards, we wouldn't have a remaining reference.

With the reference guard, this now works.
2021-07-26 02:18:54 +02:00
71 changed files with 4114 additions and 2591 deletions
+1
View File
@@ -57,6 +57,7 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/report*.xml"
- "${CI_PROJECT_DIR}/_build/report*.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

+34 -1
View File
@@ -696,6 +696,37 @@ on_range_to_changed (GtkSpinButton *to)
gtk_spin_button_set_value (from, v2);
}
static GdkContentProvider *
on_picture_drag_prepare (GtkDragSource *source,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, gtk_picture_get_paintable (GTK_PICTURE (picture)));
}
static gboolean
on_picture_drop (GtkDropTarget *dest,
const GValue *value,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
GdkPaintable *paintable;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
paintable = g_value_get_object (value);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
return TRUE;
}
static void
info_bar_response (GtkWidget *infobar, int response_id)
{
@@ -1182,7 +1213,7 @@ populate_flowbox (GtkWidget *flowbox)
GtkWidget *child;
int i;
const char *resources[] = {
"sunset.jpg", "snowy.jpg", "portland-rose.jpg"
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
};
if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (flowbox), "populated")))
@@ -2040,6 +2071,8 @@ activate (GApplication *app)
"on_page_combo_changed", (GCallback)on_page_combo_changed,
"on_range_from_changed", (GCallback)on_range_from_changed,
"on_range_to_changed", (GCallback)on_range_to_changed,
"on_picture_drag_prepare", (GCallback)on_picture_drag_prepare,
"on_picture_drop", (GCallback)on_picture_drop,
"tab_close_cb", (GCallback)tab_close_cb,
"increase_icon_size", (GCallback)increase_icon_size,
"decrease_icon_size", (GCallback)decrease_icon_size,
@@ -115,7 +115,8 @@
<gresource prefix="/org/gtk/WidgetFactory4">
<file>gtk-logo.webm</file>
<file>sunset.jpg</file>
<file>snowy.jpg</file>
<file>portland-rose.jpg</file>
<file>nyc.jpg</file>
<file>beach.jpg</file>
</gresource>
</gresources>
+46 -8
View File
@@ -1251,8 +1251,21 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box6">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1265,8 +1278,21 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box7">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1278,10 +1304,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkNotebookPage">
<property name="position">2</property>
<property name="child">
<object class="GtkBox" id="box8">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1299,7 +1337,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box9">
<object class="GtkBox" id="box8">
<property name="orientation">vertical</property>
</object>
</property>
+2 -1
View File
@@ -33,6 +33,7 @@
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include <gdk/gdktextureprivate.h>
#include "gdk-private.h"
#include <glib.h>
#include <glib/gprintf.h>
@@ -463,7 +464,7 @@ gdk_broadway_display_flush_in_idle (GdkDisplay *display)
if (broadway_display->idle_flush_id == 0)
{
broadway_display->idle_flush_id = g_idle_add (flush_idle, g_object_ref (display));
g_source_set_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
gdk_source_set_static_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
}
}
+7
View File
@@ -57,4 +57,11 @@ guint gdk_parse_debug_var (const char *variable,
# define g_memdup2(mem,size) g_memdup((mem),(size))
#endif
void gdk_source_set_static_name_by_id (guint tag,
const char *name);
#if !GLIB_CHECK_VERSION(2, 69, 1)
#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
#endif
#endif /* __GDK__PRIVATE_H__ */
+14
View File
@@ -414,3 +414,17 @@ gdk_find_base_dir (const char *text,
return dir;
}
void
gdk_source_set_static_name_by_id (guint tag,
const char *name)
{
GSource *source;
g_return_if_fail (tag > 0);
source = g_main_context_find_source_by_id (NULL, tag);
if (source == NULL)
return;
g_source_set_static_name (source, name);
}
+76 -8
View File
@@ -179,6 +179,76 @@ gdk_content_formats_new_for_gtype (GType type)
return gdk_content_formats_new_take (data, 1, NULL, 0);
}
/**
* gdk_content_formats_parse:
* @string: the string to parse
*
* Parses the given @string into `GdkContentFormats` and
* returns the formats.
*
* Strings printed via [method@Gdk.ContentFormats.to_string]
* can be read in again successfully using this function.
*
* If @string does not describe valid content formats, %NULL
* is returned.
*
* Returns: (nullable): the content formats if @string is valid
*
* Since: 4.4
*/
GdkContentFormats *
gdk_content_formats_parse (const char *string)
{
GdkContentFormatsBuilder *builder;
char **split;
gsize i;
g_return_val_if_fail (string != NULL, NULL);
split = g_strsplit_set (string, "\t\n\f\r ", -1); /* same as g_ascii_isspace() */
builder = gdk_content_formats_builder_new ();
/* first the GTypes */
for (i = 0; split[i] != NULL; i++)
{
GType type;
if (split[i][0] == 0)
continue;
type = g_type_from_name (split[i]);
if (type != 0)
gdk_content_formats_builder_add_gtype (builder, type);
else
break;
}
/* then the mime types */
for (; split[i] != NULL; i++)
{
const char *mime_type;
if (split[i][0] == 0)
continue;
mime_type = gdk_intern_mime_type (split[i]);
if (mime_type)
gdk_content_formats_builder_add_mime_type (builder, mime_type);
else
break;
}
if (split[i] != NULL)
{
g_strfreev (split);
gdk_content_formats_builder_unref (builder);
return NULL;
}
g_strfreev (split);
return gdk_content_formats_builder_free_to_formats (builder);
}
/**
* gdk_content_formats_ref:
* @formats: a `GdkContentFormats`
@@ -227,10 +297,8 @@ gdk_content_formats_unref (GdkContentFormats *formats)
*
* Prints the given @formats into a string for human consumption.
*
* This is meant for debugging and logging.
*
* The form of the representation may change at any time and is
* not guaranteed to stay identical.
* The result of this function can later be parsed with
* [func@Gdk.ContentFormats.parse].
*/
void
gdk_content_formats_print (GdkContentFormats *formats,
@@ -241,20 +309,18 @@ gdk_content_formats_print (GdkContentFormats *formats,
g_return_if_fail (formats != NULL);
g_return_if_fail (string != NULL);
g_string_append (string, "{ ");
for (i = 0; i < formats->n_gtypes; i++)
{
if (i > 0)
g_string_append (string, ", ");
g_string_append (string, " ");
g_string_append (string, g_type_name (formats->gtypes[i]));
}
for (i = 0; i < formats->n_mime_types; i++)
{
if (i > 0 || formats->n_gtypes > 0)
g_string_append (string, ", ");
g_string_append (string, " ");
g_string_append (string, formats->mime_types[i]);
}
g_string_append (string, " }");
}
/**
@@ -263,6 +329,8 @@ gdk_content_formats_print (GdkContentFormats *formats,
*
* Prints the given @formats into a human-readable string.
*
* The resulting string can be parsed with [func@Gdk.ContentFormats.parse].
*
* This is a small wrapper around [method@Gdk.ContentFormats.print]
* to help when debugging.
*
+2
View File
@@ -40,6 +40,8 @@ GdkContentFormats * gdk_content_formats_new (const char
guint n_mime_types);
GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_content_formats_new_for_gtype (GType type);
GDK_AVAILABLE_IN_4_4
GdkContentFormats * gdk_content_formats_parse (const char *string);
GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_content_formats_ref (GdkContentFormats *formats);
GDK_AVAILABLE_IN_ALL
+6 -2
View File
@@ -29,6 +29,7 @@
#include "gdkinternals.h"
#include "gdkframeclockprivate.h"
#include "gdk.h"
#include "gdk-private.h"
#include "gdkprofilerprivate.h"
#ifdef G_OS_WIN32
@@ -307,12 +308,15 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
{
GSource *source;
priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
min_interval,
gdk_frame_clock_flush_idle,
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
g_source_set_name_by_id (priv->flush_idle_id, "[gtk] gdk_frame_clock_flush_idle");
source = g_main_context_find_source_by_id (NULL, priv->flush_idle_id);
g_source_set_static_name (source, "[gtk] gdk_frame_clock_flush_idle");
}
if (!priv->in_paint_idle &&
@@ -324,7 +328,7 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
gdk_frame_clock_paint_idle,
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
g_source_set_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
gdk_source_set_static_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
}
}
}
+2
View File
@@ -856,6 +856,8 @@ gdk_gl_context_set_is_legacy (GdkGLContext *context,
* is not, this function will return %FALSE.
*
* Returns: %TRUE if the two GL contexts are compatible.
*
* Since: 4.4
*/
gboolean
gdk_gl_context_is_shared (GdkGLContext *self,
+1 -1
View File
@@ -197,7 +197,7 @@ gdk_display_link_source_new (void)
gdk_display_link_source_frame_cb,
source);
g_source_set_name (source, "[gdk] quartz frame clock");
g_source_set_static_name (source, "[gdk] quartz frame clock");
return source;
}
+4 -1
View File
@@ -21,6 +21,7 @@
#include "gdkdeviceprivate.h"
#include "gdkintl.h"
#include "gdk-private.h"
#include "gdkmacosdevice-private.h"
#include "gdkmacoscursor-private.h"
@@ -161,7 +162,7 @@ gdk_macos_drag_drop_done (GdkDrag *drag,
gdk_macos_zoomback_timeout,
zb,
(GDestroyNotify) gdk_macos_zoomback_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
g_object_unref (drag);
}
@@ -242,9 +243,11 @@ gdk_macos_drag_drop_performed (GdkDrag *drag,
g_assert (GDK_IS_MACOS_DRAG (self));
g_object_ref (self);
drag_ungrab (self);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, TRUE);
g_object_unref (self);
}
static void
+1 -1
View File
@@ -1063,7 +1063,7 @@ _gdk_macos_event_source_new (GdkMacosDisplay *display)
event_poll_fd.fd = -1;
source = g_source_new (&event_funcs, sizeof (GdkMacosEventSource));
g_source_set_name (source, "GDK Quartz event source");
g_source_set_static_name (source, "GDK Quartz event source");
g_source_add_poll (source, &event_poll_fd);
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
g_source_set_can_recurse (source, TRUE);
+4 -2
View File
@@ -460,6 +460,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
pointer->cursor_timeout_id == 0)
{
guint id;
GSource *source;
gdk_wayland_pointer_stop_cursor_animation (pointer);
@@ -467,7 +468,8 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
id = g_timeout_add (next_image_delay,
(GSourceFunc) gdk_wayland_device_update_surface_cursor,
device);
g_source_set_name_by_id (id, "[gtk] gdk_wayland_device_update_surface_cursor");
source = g_main_context_find_source_by_id (NULL, id);
g_source_set_static_name (source, "[gtk] gdk_wayland_device_update_surface_cursor");
pointer->cursor_timeout_id = id;
}
else
@@ -2218,7 +2220,7 @@ deliver_key_event (GdkWaylandSeat *seat,
timeout = (seat->repeat_deadline - now) / 1000L;
seat->repeat_timer = g_timeout_add (timeout, keyboard_repeat, seat);
g_source_set_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
gdk_source_set_static_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
}
static void
+2
View File
@@ -290,8 +290,10 @@ data_source_dnd_finished (void *data,
{
GdkDrag *drag = data;
g_object_ref (drag);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, TRUE);
g_object_unref (drag);
}
static void
+3 -1
View File
@@ -27,6 +27,8 @@
#include "config.h"
#include <string.h>
#include "gdk-private.h"
#include <io.h>
#include <fcntl.h>
#include <math.h>
@@ -2196,7 +2198,7 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
}
static gboolean
+2 -1
View File
@@ -61,6 +61,7 @@
#include "gdkdisplay-win32.h"
//#include "gdkselection-win32.h"
#include "gdkdragprivate.h"
#include "gdk-private.h"
#include <windowsx.h>
@@ -502,7 +503,7 @@ _gdk_events_init (GdkDisplay *display)
#endif
source = g_source_new (&event_funcs, sizeof (GdkWin32EventSource));
g_source_set_name (source, "GDK Win32 event source");
g_source_set_static_name (source, "GDK Win32 event source");
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
event_source = (GdkWin32EventSource *)source;
+3 -2
View File
@@ -25,6 +25,7 @@
#include "gdkintl.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdk-private.h"
#include <glib.h>
#ifdef HAVE_DESKTOPAPPINFO
@@ -219,7 +220,7 @@ startup_timeout (void *data)
std->timeout_id = 0;
else {
std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
g_source_set_name_by_id (std->timeout_id, "[gtk] startup_timeout");
gdk_source_set_static_name_by_id (std->timeout_id, "[gtk] startup_timeout");
}
/* always remove this one, but we may have reinstalled another one. */
@@ -256,7 +257,7 @@ add_startup_timeout (GdkX11Screen *screen,
if (data->timeout_id == 0) {
data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
startup_timeout, data);
g_source_set_name_by_id (data->timeout_id, "[gtk] startup_timeout");
gdk_source_set_static_name_by_id (data->timeout_id, "[gtk] startup_timeout");
}
}
+3 -2
View File
@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
#include "gdkasync.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdk-private.h"
#include <X11/Xlibint.h>
@@ -171,7 +172,7 @@ send_event_handler (Display *dpy,
{
guint id;
id = g_idle_add (callback_idle, state);
g_source_set_name_by_id (id, "[gtk] callback_idle");
gdk_source_set_static_name_by_id (id, "[gtk] callback_idle");
}
DeqAsyncHandler(state->dpy, &state->async);
@@ -707,7 +708,7 @@ roundtrip_handler (Display *dpy,
{
guint id;
id = g_idle_add (roundtrip_callback_idle, state);
g_source_set_name_by_id (id, "[gtk] roundtrip_callback_idle");
gdk_source_set_static_name_by_id (id, "[gtk] roundtrip_callback_idle");
}
DeqAsyncHandler(state->dpy, &state->async);
+3 -1
View File
@@ -884,8 +884,10 @@ gdk_x11_drag_handle_finished (GdkDisplay *display,
if (drag_x11->version == 5)
drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
g_object_ref (drag);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, !drag_x11->drop_failed);
g_object_unref (drag);
}
}
@@ -1862,7 +1864,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
g_object_unref (drag);
}
+2 -2
View File
@@ -1397,7 +1397,7 @@ gsk_ngl_render_job_visit_color_node (GskNglRenderJob *job,
GskNglCommandBatch *batch;
rgba = gsk_color_node_get_color (node);
if (gdk_rgba_is_clear (rgba))
if (RGBA_IS_CLEAR (rgba))
return;
rgba_to_half (rgba, color);
@@ -2869,7 +2869,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
*/
if (force_color || !gsk_text_node_has_color_glyphs (node))
{
if (gdk_rgba_is_clear (color))
if (RGBA_IS_CLEAR (color))
return;
rgba_to_half (color, c);
+2 -1
View File
@@ -30,6 +30,7 @@
#include "gtkdebug.h"
#include "gtkwindow.h"
#include "gtkprivate.h"
#include "a11y/atspi/atspi-accessible.h"
#include "a11y/atspi/atspi-application.h"
@@ -612,7 +613,7 @@ gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
return;
self->register_id = g_idle_add (root_register, self);
g_source_set_name_by_id (self->register_id, "[gtk] ATSPI root registration");
gdk_source_set_static_name_by_id (self->register_id, "[gtk] ATSPI root registration");
}
void
+1
View File
@@ -1,6 +1,7 @@
#include <gtk/gtk.h>
#include "gtk/gtkcomposetable.h"
#include <locale.h>
#include <stdlib.h>
/* This program reads a Compose file and generates files with sequences,
* character data, and definitions for the builtin compose table of GTK.
+17
View File
@@ -2242,6 +2242,23 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
ret = FALSE;
}
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_CONTENT_FORMATS))
{
GdkContentFormats *formats;
formats = gdk_content_formats_parse (string);
if (formats)
g_value_take_boxed (value, formats);
else
{
g_set_error (error,
GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_INVALID_VALUE,
"Could not parse GdkContentFormats '%s'",
string);
ret = FALSE;
}
}
else if (G_VALUE_HOLDS (value, GSK_TYPE_TRANSFORM))
{
GskTransform *transform;
+1 -1
View File
@@ -791,7 +791,7 @@ gtk_real_button_activate (GtkButton *button)
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
{
priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
g_source_set_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
gdk_source_set_static_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
gtk_widget_add_css_class (GTK_WIDGET (button), "keyboard-activating");
priv->button_down = TRUE;
+16 -5
View File
@@ -344,7 +344,7 @@ gtk_drop_target_accept (GtkDropTarget *self,
if (self->formats == NULL)
return TRUE;
return gdk_content_formats_match (self->formats, gdk_drop_get_formats (drop));
return gdk_content_formats_match_gtype (self->formats, gdk_drop_get_formats (drop)) != G_TYPE_INVALID;
}
static GdkDragAction
@@ -544,6 +544,12 @@ gtk_drop_target_set_property (GObject *object,
gtk_drop_target_set_actions (self, g_value_get_flags (value));
break;
case PROP_FORMATS:
self->formats = g_value_dup_boxed (value);
if (self->formats == NULL)
self->formats = gdk_content_formats_new (NULL, 0);
break;
case PROP_PRELOAD:
gtk_drop_target_set_preload (self, g_value_get_boolean (value));
break;
@@ -661,7 +667,7 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
P_("Formats"),
P_("The supported formats"),
GDK_TYPE_CONTENT_FORMATS,
GTK_PARAM_READABLE);
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
/**
* GtkDropTarget:preload: (attributes org.gtk.Property.get=gtk_drop_target_get_preload org.gtk.Property.set=gtk_drop_target_set_preload)
@@ -843,7 +849,6 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
static void
gtk_drop_target_init (GtkDropTarget *self)
{
self->formats = gdk_content_formats_new (NULL, 0);
}
/**
@@ -864,13 +869,19 @@ gtk_drop_target_new (GType type,
GdkDragAction actions)
{
GtkDropTarget *result;
GdkContentFormats *formats;
if (type != G_TYPE_INVALID)
formats = gdk_content_formats_new_for_gtype (type);
else
formats = NULL;
result = g_object_new (GTK_TYPE_DROP_TARGET,
"formats", formats,
"actions", actions,
NULL);
if (type != G_TYPE_INVALID)
gtk_drop_target_set_gtypes (result, &type, 1);
g_clear_pointer (&formats, gdk_content_formats_unref);
return result;
}
+1 -1
View File
@@ -1016,7 +1016,7 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
populate_recent_section (chooser);
chooser->populate_idle = g_idle_add (populate_emoji_chooser, chooser);
g_source_set_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
gdk_source_set_static_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
}
static void
+2 -2
View File
@@ -1982,7 +1982,7 @@ gtk_entry_completion_changed (GtkWidget *widget,
g_timeout_add (COMPLETION_TIMEOUT,
gtk_entry_completion_timeout,
completion);
g_source_set_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
gdk_source_set_static_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
}
static gboolean
@@ -2048,7 +2048,7 @@ completion_inserted_text_callback (GtkEntryBuffer *buffer,
g_cclosure_new_object (G_CALLBACK (check_completion_callback),
G_OBJECT (completion)));
g_source_attach (completion->check_completion_idle, NULL);
g_source_set_name (completion->check_completion_idle, "[gtk] check_completion_callback");
g_source_set_static_name (completion->check_completion_idle, "[gtk] check_completion_callback");
}
}
+1 -1
View File
@@ -244,7 +244,7 @@ gtk_expander_drag_enter (GtkDropControllerMotion *motion,
if (!expander->expanded && !expander->expand_timer)
{
expander->expand_timer = g_timeout_add (TIMEOUT_EXPAND, (GSourceFunc) expand_timeout, expander);
g_source_set_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
gdk_source_set_static_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
}
}
+2 -2
View File
@@ -2234,7 +2234,7 @@ location_entry_changed_cb (GtkEditable *editable,
impl->location_changed_id = g_timeout_add (LOCATION_CHANGED_TIMEOUT,
location_changed_timeout_cb,
impl);
g_source_set_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
gdk_source_set_static_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
}
}
@@ -3822,7 +3822,7 @@ load_setup_timer (GtkFileChooserWidget *impl)
g_assert (impl->load_state != LOAD_PRELOAD);
impl->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
g_source_set_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
gdk_source_set_static_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
impl->load_state = LOAD_PRELOAD;
}
+2 -1
View File
@@ -30,6 +30,7 @@
#include "gtktreednd.h"
#include "gtktreemodel.h"
#include "gtkfilter.h"
#include "gtkprivate.h"
/*** Structure: how GtkFileSystemModel works
*
@@ -1095,7 +1096,7 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da
thaw_func,
model,
NULL);
g_source_set_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
gdk_source_set_static_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
}
for (walk = files; walk; walk = walk->next)
+1 -1
View File
@@ -267,7 +267,7 @@ gtk_filter_list_model_start_filtering (GtkFilterListModel *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PENDING]);
g_assert (self->pending_cb == 0);
self->pending_cb = g_idle_add (gtk_filter_list_model_run_filter_cb, self);
g_source_set_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
gdk_source_set_static_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
}
static void
+1 -1
View File
@@ -146,7 +146,7 @@ _gtk_gesture_click_update_timeout (GtkGestureClick *gesture)
g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL);
priv->double_click_timeout_id = g_timeout_add (double_click_time, _double_click_timeout_cb, gesture);
g_source_set_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
gdk_source_set_static_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
}
static gboolean
+1 -1
View File
@@ -150,7 +150,7 @@ gtk_gesture_long_press_begin (GtkGesture *gesture,
gtk_gesture_get_point (gesture, sequence,
&priv->initial_x, &priv->initial_y);
priv->timeout_id = g_timeout_add (delay, _gtk_gesture_long_press_timeout, gesture);
g_source_set_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
gdk_source_set_static_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
}
static void
+1 -1
View File
@@ -1342,7 +1342,7 @@ queue_theme_changed (GtkIconTheme *self)
theme_changed_idle__mainthread_unlocked,
gtk_icon_theme_ref_ref (self->ref),
(GDestroyNotify)gtk_icon_theme_ref_unref);
g_source_set_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
gdk_source_set_static_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
}
}
+2 -2
View File
@@ -1831,7 +1831,7 @@ gtk_icon_view_motion (GtkEventController *controller,
if (icon_view->priv->scroll_timeout_id == 0) {
icon_view->priv->scroll_timeout_id = g_timeout_add (30, rubberband_scroll_timeout, icon_view);
g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] rubberband_scroll_timeout");
gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] rubberband_scroll_timeout");
}
}
else
@@ -6065,7 +6065,7 @@ gtk_icon_view_drag_motion (GtkDropTargetAsync *dest,
if (icon_view->priv->scroll_timeout_id == 0)
{
icon_view->priv->scroll_timeout_id = g_timeout_add (50, drag_scroll_timeout, icon_view);
g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
}
if (target == GTK_TYPE_TREE_ROW_DATA)
+1 -1
View File
@@ -868,7 +868,7 @@ gtk_main_sync (void)
store.store_loop = g_main_loop_new (NULL, TRUE);
store.timeout_id = g_timeout_add_seconds (10, (GSourceFunc) sync_timed_out_cb, &store);
g_source_set_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
gdk_source_set_static_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
if (g_main_loop_is_running (store.store_loop))
g_main_loop_run (store.store_loop);
+2 -1
View File
@@ -34,6 +34,7 @@
#include "gtkbuiltiniconprivate.h"
#include "gtkgizmoprivate.h"
#include "gtkbinlayout.h"
#include "gtkprivate.h"
typedef GtkBoxClass GtkMenuSectionBoxClass;
@@ -175,7 +176,7 @@ gtk_menu_section_box_schedule_separator_sync (GtkMenuSectionBox *box)
box->separator_sync_idle = g_idle_add_full (G_PRIORITY_HIGH_IDLE, /* before resize... */
gtk_menu_section_box_handle_sync_separators,
box, NULL);
g_source_set_name_by_id (box->separator_sync_idle, "[gtk] menu section box handle sync separators");
gdk_source_set_static_name_by_id (box->separator_sync_idle, "[gtk] menu section box handle sync separators");
}
}
+2 -1
View File
@@ -46,6 +46,7 @@
#include "gtkshortcutcontroller.h"
#include "gtkshortcut.h"
#include "gtkaccessibleprivate.h"
#include "gtkprivate.h"
/*< private >
* GtkModelButton:
@@ -1363,7 +1364,7 @@ start_open (GtkModelButton *button)
return;
button->open_timeout = g_timeout_add (OPEN_TIMEOUT, open_submenu, button);
g_source_set_name_by_id (button->open_timeout, "[gtk] open_submenu");
gdk_source_set_static_name_by_id (button->open_timeout, "[gtk] open_submenu");
}
static void
+4 -4
View File
@@ -3052,7 +3052,7 @@ gtk_notebook_motion (GtkEventController *controller,
notebook->dnd_timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
scroll_notebook_timer,
notebook);
g_source_set_name_by_id (notebook->dnd_timer, "[gtk] scroll_notebook_timer");
gdk_source_set_static_name_by_id (notebook->dnd_timer, "[gtk] scroll_notebook_timer");
}
}
else
@@ -4018,7 +4018,7 @@ gtk_notebook_tab_drop_enter (GtkEventController *controller,
notebook->switch_page = page;
notebook->switch_page_timer = g_timeout_add (TIMEOUT_EXPAND, gtk_notebook_switch_page_timeout, notebook);
g_source_set_name_by_id (notebook->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
gdk_source_set_static_name_by_id (notebook->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
}
static void
@@ -4189,7 +4189,7 @@ gtk_notebook_timer (GtkNotebook *notebook)
notebook->timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
(GSourceFunc) gtk_notebook_timer,
notebook);
g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
gdk_source_set_static_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
}
else
retval = TRUE;
@@ -4206,7 +4206,7 @@ gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
notebook->timer = g_timeout_add (TIMEOUT_INITIAL,
(GSourceFunc) gtk_notebook_timer,
notebook);
g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
gdk_source_set_static_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
notebook->need_timer = TRUE;
}
}
+1 -1
View File
@@ -715,7 +715,7 @@ gtk_popover_schedule_mnemonics_visible (GtkPopover *popover)
priv->mnemonics_display_timeout_id =
g_timeout_add (MNEMONICS_DELAY, schedule_mnemonics_visible_cb, popover);
g_source_set_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] popover_schedule_mnemonics_visible_cb");
gdk_source_set_static_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] popover_schedule_mnemonics_visible_cb");
}
static void
+2 -2
View File
@@ -539,7 +539,7 @@ win32_poll_status_timeout (GtkPrintOperation *op)
op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
g_source_set_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
gdk_source_set_static_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
}
g_object_unref (op);
return FALSE;
@@ -583,7 +583,7 @@ win32_end_run (GtkPrintOperation *op,
op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
g_source_set_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
gdk_source_set_static_name_by_id (op_win32->timeout_id, "[gtk] win32_poll_status_timeout");
}
else
/* Dunno what happened, pretend its finished */
+3 -3
View File
@@ -631,7 +631,7 @@ preview_ready (GtkPrintOperationPreview *preview,
preview_print_idle,
pop,
preview_print_idle_done);
g_source_set_name_by_id (id, "[gtk] preview_print_idle");
gdk_source_set_static_name_by_id (id, "[gtk] preview_print_idle");
}
@@ -2895,7 +2895,7 @@ print_pages (GtkPrintOperation *op,
g_timeout_add (SHOW_PROGRESS_TIME,
(GSourceFunc) show_progress_timeout,
data);
g_source_set_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout");
gdk_source_set_static_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout");
data->progress = progress;
}
@@ -2964,7 +2964,7 @@ print_pages (GtkPrintOperation *op,
print_pages_idle,
data,
print_pages_idle_done);
g_source_set_name_by_id (priv->print_pages_idle_id, "[gtk] print_pages_idle");
gdk_source_set_static_name_by_id (priv->print_pages_idle_id, "[gtk] print_pages_idle");
/* Recursive main loop to make sure we don't exit on sync operations */
if (priv->is_sync)
+1 -1
View File
@@ -1803,7 +1803,7 @@ schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
return;
dialog->mark_conflicts_id = g_idle_add (mark_conflicts_callback, dialog);
g_source_set_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback");
gdk_source_set_static_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback");
}
static void
+2 -2
View File
@@ -2758,7 +2758,7 @@ initial_timeout (gpointer data)
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
priv->timer->timeout_id = g_timeout_add (TIMEOUT_REPEAT, second_timeout, range);
g_source_set_name_by_id (priv->timer->timeout_id, "[gtk] second_timeout");
gdk_source_set_static_name_by_id (priv->timer->timeout_id, "[gtk] second_timeout");
return G_SOURCE_REMOVE;
}
@@ -2774,7 +2774,7 @@ gtk_range_add_step_timer (GtkRange *range,
priv->timer = g_new (GtkRangeStepTimer, 1);
priv->timer->timeout_id = g_timeout_add (TIMEOUT_INITIAL, initial_timeout, range);
g_source_set_name_by_id (priv->timer->timeout_id, "[gtk] initial_timeout");
gdk_source_set_static_name_by_id (priv->timer->timeout_id, "[gtk] initial_timeout");
priv->timer->step = step;
gtk_range_scroll (range, priv->timer->step);
+1 -1
View File
@@ -1388,7 +1388,7 @@ gtk_recent_manager_changed (GtkRecentManager *manager)
if (manager->priv->changed_timeout == 0)
{
manager->priv->changed_timeout = g_timeout_add (250, emit_manager_changed, manager);
g_source_set_name_by_id (manager->priv->changed_timeout, "[gtk] emit_manager_changed");
gdk_source_set_static_name_by_id (manager->priv->changed_timeout, "[gtk] emit_manager_changed");
}
else
{
+4 -4
View File
@@ -1216,7 +1216,7 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
else if (indicator_close && !on_other_scrollbar)
{
indicator->over_timeout_id = g_timeout_add (30, enable_over_timeout_cb, indicator);
g_source_set_name_by_id (indicator->over_timeout_id, "[gtk] enable_over_timeout_cb");
gdk_source_set_static_name_by_id (indicator->over_timeout_id, "[gtk] enable_over_timeout_cb");
}
else
indicator_set_over (indicator, FALSE);
@@ -1412,8 +1412,8 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
{
priv->scroll_events_overshoot_id =
g_timeout_add (50, start_scroll_deceleration_cb, scrolled_window);
g_source_set_name_by_id (priv->scroll_events_overshoot_id,
"[gtk] start_scroll_deceleration_cb");
gdk_source_set_static_name_by_id (priv->scroll_events_overshoot_id,
"[gtk] start_scroll_deceleration_cb");
}
}
@@ -3638,7 +3638,7 @@ indicator_set_fade (Indicator *indicator,
if (visible && indicator->conceil_timer == 0)
{
indicator->conceil_timer = g_timeout_add (INDICATOR_FADE_OUT_TIME, maybe_hide_indicator, indicator);
g_source_set_name_by_id (indicator->conceil_timer, "[gtk] maybe_hide_indicator");
gdk_source_set_static_name_by_id (indicator->conceil_timer, "[gtk] maybe_hide_indicator");
}
if (!visible && indicator->conceil_timer != 0)
{
+1 -1
View File
@@ -126,7 +126,7 @@ gtk_search_engine_model_start (GtkSearchEngine *engine)
return;
model->idle = g_idle_add (do_search, engine);
g_source_set_name_by_id (model->idle, "[gtk] gtk_search_engine_model_start");
gdk_source_set_static_name_by_id (model->idle, "[gtk] gtk_search_engine_model_start");
}
static void
+1 -1
View File
@@ -519,7 +519,7 @@ reset_timeout (GtkSearchEntry *entry)
entry->delayed_changed_id = g_timeout_add (DELAYED_TIMEOUT_ID,
gtk_search_entry_changed_timeout_cb,
entry);
g_source_set_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
gdk_source_set_static_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
}
static void
+2 -2
View File
@@ -906,7 +906,7 @@ start_spinning (GtkSpinButton *spin,
spin->timer = g_timeout_add (TIMEOUT_INITIAL,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin);
g_source_set_name_by_id (spin->timer, "[gtk] gtk_spin_button_timer");
gdk_source_set_static_name_by_id (spin->timer, "[gtk] gtk_spin_button_timer");
}
gtk_spin_button_real_spin (spin, click_child == spin->up_button ? step : -step);
}
@@ -1318,7 +1318,7 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
spin_button->timer = g_timeout_add (TIMEOUT_REPEAT,
(GSourceFunc) gtk_spin_button_timer,
spin_button);
g_source_set_name_by_id (spin_button->timer, "[gtk] gtk_spin_button_timer");
gdk_source_set_static_name_by_id (spin_button->timer, "[gtk] gtk_spin_button_timer");
}
else
{
+1 -1
View File
@@ -245,7 +245,7 @@ gtk_stack_switcher_drag_enter (GtkDropControllerMotion *motion,
guint switch_timer = g_timeout_add (TIMEOUT_EXPAND,
gtk_stack_switcher_switch_timeout,
button);
g_source_set_name_by_id (switch_timer, "[gtk] gtk_stack_switcher_switch_timeout");
gdk_source_set_static_name_by_id (switch_timer, "[gtk] gtk_stack_switcher_switch_timeout");
g_object_set_data_full (G_OBJECT (button), "-gtk-switch-timer", GUINT_TO_POINTER (switch_timer), clear_timer);
}
}
+2 -2
View File
@@ -3636,7 +3636,7 @@ buffer_inserted_text (GtkEntryBuffer *buffer,
password_hint->source_id = g_timeout_add (password_hint_timeout,
(GSourceFunc)gtk_text_remove_password_hint,
self);
g_source_set_name_by_id (password_hint->source_id, "[gtk] gtk_text_remove_password_hint");
gdk_source_set_static_name_by_id (password_hint->source_id, "[gtk] gtk_text_remove_password_hint");
}
}
}
@@ -6285,7 +6285,7 @@ gtk_text_selection_bubble_popup_set (GtkText *self)
priv->selection_bubble_timeout_id =
g_timeout_add (50, gtk_text_selection_bubble_popup_show, self);
g_source_set_name_by_id (priv->selection_bubble_timeout_id, "[gtk] gtk_text_selection_bubble_popup_cb");
gdk_source_set_static_name_by_id (priv->selection_bubble_timeout_id, "[gtk] gtk_text_selection_bubble_popup_cb");
}
static void
+2 -1
View File
@@ -23,6 +23,7 @@
#include "gtktextbufferprivate.h"
#include "gtktextiterprivate.h"
#include "gtktextlinedisplaycacheprivate.h"
#include "gtkprivate.h"
#define DEFAULT_MRU_SIZE 250
#define BLOW_CACHE_TIMEOUT_SEC 20
@@ -141,7 +142,7 @@ gtk_text_line_display_cache_delay_eviction (GtkTextLineDisplayCache *cache)
gtk_text_line_display_cache_blow_cb,
cache);
cache->evict_source = g_main_context_find_source_by_id (NULL, tag);
g_source_set_name (cache->evict_source, "[gtk+] gtk_text_line_display_cache_blow_cb");
g_source_set_static_name (cache->evict_source, "[gtk+] gtk_text_line_display_cache_blow_cb");
}
}
+6 -6
View File
@@ -763,7 +763,7 @@ gtk_text_view_drop_scroll_motion (GtkDropControllerMotion *motion,
if (!priv->scroll_timeout)
{
priv->scroll_timeout = g_timeout_add (100, gtk_text_view_drop_motion_scroll_timeout, self);
g_source_set_name_by_id (priv->scroll_timeout, "[gtk] gtk_text_view_drop_motion_scroll_timeout");
gdk_source_set_static_name_by_id (priv->scroll_timeout, "[gtk] gtk_text_view_drop_motion_scroll_timeout");
}
}
@@ -2944,7 +2944,7 @@ queue_update_im_spot_location (GtkTextView *text_view)
do_update_im_spot_location,
text_view,
NULL);
g_source_set_name_by_id (priv->im_spot_idle, "[gtk] do_update_im_spot_location");
gdk_source_set_static_name_by_id (priv->im_spot_idle, "[gtk] do_update_im_spot_location");
}
}
@@ -4821,7 +4821,7 @@ gtk_text_view_invalidate (GtkTextView *text_view)
if (!priv->first_validate_idle)
{
priv->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
g_source_set_name_by_id (priv->first_validate_idle, "[gtk] first_validate_callback");
gdk_source_set_static_name_by_id (priv->first_validate_idle, "[gtk] first_validate_callback");
DV (g_print (G_STRLOC": adding first validate idle %d\n",
priv->first_validate_idle));
}
@@ -4829,7 +4829,7 @@ gtk_text_view_invalidate (GtkTextView *text_view)
if (!priv->incremental_validate_idle)
{
priv->incremental_validate_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
g_source_set_name_by_id (priv->incremental_validate_idle, "[gtk] incremental_validate_callback");
gdk_source_set_static_name_by_id (priv->incremental_validate_idle, "[gtk] incremental_validate_callback");
DV (g_print (G_STRLOC": adding incremental validate idle %d\n",
priv->incremental_validate_idle));
}
@@ -7458,7 +7458,7 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
g_source_remove (text_view->priv->scroll_timeout);
text_view->priv->scroll_timeout = g_timeout_add (50, selection_scan_timeout, text_view);
g_source_set_name_by_id (text_view->priv->scroll_timeout, "[gtk] selection_scan_timeout");
gdk_source_set_static_name_by_id (text_view->priv->scroll_timeout, "[gtk] selection_scan_timeout");
gtk_text_view_selection_bubble_popup_unset (text_view);
@@ -9099,7 +9099,7 @@ gtk_text_view_selection_bubble_popup_set (GtkTextView *text_view)
g_source_remove (priv->selection_bubble_timeout_id);
priv->selection_bubble_timeout_id = g_timeout_add (50, gtk_text_view_selection_bubble_popup_show, text_view);
g_source_set_name_by_id (priv->selection_bubble_timeout_id, "[gtk] gtk_text_view_selection_bubble_popup_cb");
gdk_source_set_static_name_by_id (priv->selection_bubble_timeout_id, "[gtk] gtk_text_view_selection_bubble_popup_cb");
}
/* Child GdkSurfaces */
+3 -2
View File
@@ -34,6 +34,7 @@
#include "gtkwindowprivate.h"
#include "gtkwidgetprivate.h"
#include "gtknative.h"
#include "gtkprivate.h"
/**
* GtkTooltip:
@@ -789,7 +790,7 @@ gtk_tooltip_hide_tooltip (GtkTooltip *tooltip)
tooltip_browse_mode_expired,
g_object_ref (tooltip),
g_object_unref);
g_source_set_name_by_id (tooltip->browse_mode_timeout_id, "[gtk] tooltip_browse_mode_expired");
gdk_source_set_static_name_by_id (tooltip->browse_mode_timeout_id, "[gtk] tooltip_browse_mode_expired");
}
if (tooltip->window)
@@ -841,7 +842,7 @@ gtk_tooltip_start_delay (GdkDisplay *display)
tooltip_popup_timeout,
g_object_ref (display),
g_object_unref);
g_source_set_name_by_id (tooltip->timeout_id, "[gtk] tooltip_popup_timeout");
gdk_source_set_static_name_by_id (tooltip->timeout_id, "[gtk] tooltip_popup_timeout");
}
void
+2 -1
View File
@@ -29,6 +29,7 @@
#include "gtkgestureclick.h"
#include "gtkintl.h"
#include "gtktreelistmodel.h"
#include "gtkprivate.h"
/**
* GtkTreeExpander:
@@ -648,7 +649,7 @@ gtk_tree_expander_drag_enter (GtkDropControllerMotion *motion,
!self->expand_timer)
{
self->expand_timer = g_timeout_add (TIMEOUT_EXPAND, (GSourceFunc) gtk_tree_expander_expand_timeout, self);
g_source_set_name_by_id (self->expand_timer, "[gtk] gtk_tree_expander_expand_timeout");
gdk_source_set_static_name_by_id (self->expand_timer, "[gtk] gtk_tree_expander_expand_timeout");
}
}
+10 -10
View File
@@ -3467,7 +3467,7 @@ do_prelight (GtkTreeView *tree_view,
{
priv->auto_expand_timeout =
g_timeout_add (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
g_source_set_name_by_id (priv->auto_expand_timeout, "[gtk] auto_expand_timeout");
gdk_source_set_static_name_by_id (priv->auto_expand_timeout, "[gtk] auto_expand_timeout");
}
}
@@ -6413,7 +6413,7 @@ install_presize_handler (GtkTreeView *tree_view)
{
priv->validate_rows_timer =
g_idle_add_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows, tree_view, NULL);
g_source_set_name_by_id (priv->validate_rows_timer, "[gtk] validate_rows");
gdk_source_set_static_name_by_id (priv->validate_rows_timer, "[gtk] validate_rows");
}
}
@@ -6446,7 +6446,7 @@ install_scroll_sync_handler (GtkTreeView *tree_view)
{
priv->scroll_sync_timer =
g_idle_add_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
g_source_set_name_by_id (priv->scroll_sync_timer, "[gtk] scroll_sync_handler");
gdk_source_set_static_name_by_id (priv->scroll_sync_timer, "[gtk] scroll_sync_handler");
}
}
@@ -6752,7 +6752,7 @@ add_scroll_timeout (GtkTreeView *tree_view)
if (priv->scroll_timeout == 0)
{
priv->scroll_timeout = g_timeout_add (150, scroll_row_timeout, tree_view);
g_source_set_name_by_id (priv->scroll_timeout, "[gtk] scroll_row_timeout");
gdk_source_set_static_name_by_id (priv->scroll_timeout, "[gtk] scroll_row_timeout");
}
}
@@ -7240,7 +7240,7 @@ gtk_tree_view_drag_motion (GtkDropTargetAsync *dest,
{
priv->open_dest_timeout =
g_timeout_add (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
g_source_set_name_by_id (priv->open_dest_timeout, "[gtk] open_row_timeout");
gdk_source_set_static_name_by_id (priv->open_dest_timeout, "[gtk] open_row_timeout");
}
else
{
@@ -10130,7 +10130,7 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
/* search first matching iter */
gtk_tree_view_search_init (priv->search_entry, tree_view);
@@ -13616,7 +13616,7 @@ gtk_tree_view_search_preedit_changed (GtkText *text,
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
}
}
@@ -13690,7 +13690,7 @@ gtk_tree_view_search_scroll_event (GtkWidget *widget,
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
}
return GDK_EVENT_STOP;
@@ -13766,7 +13766,7 @@ gtk_tree_view_search_key_pressed (GtkEventControllerKey *key,
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
}
if (!retval)
@@ -14024,7 +14024,7 @@ gtk_tree_view_search_init (GtkWidget *entry,
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
g_source_set_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
gdk_source_set_static_name_by_id (priv->typeselect_flush_timeout, "[gtk] gtk_tree_view_search_entry_flush_timeout");
}
if (*text == '\0')
+2 -2
View File
@@ -2391,7 +2391,7 @@ _gtk_window_notify_keys_changed (GtkWindow *window)
if (!priv->keys_changed_handler)
{
priv->keys_changed_handler = g_idle_add (handle_keys_changed, window);
g_source_set_name_by_id (priv->keys_changed_handler, "[gtk] handle_keys_changed");
gdk_source_set_static_name_by_id (priv->keys_changed_handler, "[gtk] handle_keys_changed");
}
}
@@ -5964,7 +5964,7 @@ _gtk_window_schedule_mnemonics_visible (GtkWindow *window)
priv->mnemonics_display_timeout_id =
g_timeout_add (MNEMONICS_DELAY, schedule_mnemonics_visible_cb, window);
g_source_set_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] schedule_mnemonics_visible_cb");
gdk_source_set_static_name_by_id (priv->mnemonics_display_timeout_id, "[gtk] schedule_mnemonics_visible_cb");
}
/**
+1 -18
View File
@@ -1117,28 +1117,11 @@ libgtk_static = static_library('gtk',
link_with: [libgtk_css, libgdk, libgsk ],
)
# `link_whole:` is actually only supported on Visual Studio 2015 Update 2
# or later via the linker flag `/WHOLEARCHIVE:<static_lib>`, so we need
# to work around it for Visual Studio 2013. Note that all needed static
# libs are required so that we grab the object files from each of them to
# link the final GTK DLL.
whole_archives = []
gtk4_objs = []
if cc.get_id() == 'msvc' and cc.version().split('.').get(0) < '19'
foreach target : [ libgtk_static, libgtk_css, libgdk, libgdk_win32, libgsk, libgsk_f16c ]
gtk4_objs += target.extract_all_objects(recursive: false)
endforeach
else
whole_archives = [libgtk_static, libgtk_css, libgdk, libgsk ]
endif
libgtk = shared_library('gtk-4',
c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgtk_css_dep, libgdk_dep, libgsk_dep],
link_whole: whole_archives,
objects: gtk4_objs,
link_whole: [libgtk_static, libgtk_css, libgdk, libgsk ],
link_args: common_ldflags,
soversion: gtk_soversion,
version: gtk_library_version,
+3
View File
@@ -243,6 +243,9 @@ endif
# Compiler flags
if cc.get_id() == 'msvc'
if cc.version().version_compare('<19.00.23918') and meson.version().version_compare('<0.59.0')
error('Meson 0.59.0 or later is required for building with pre-Visual Studio 2015 Update 2')
endif
# Compiler options taken from msvc_recommended_pragmas.h
# in GLib, based on _Win32_Programming_ by Rector and Newcomer
test_cflags = [
+2 -1
View File
@@ -56,6 +56,7 @@
#include "gtkcupssecretsutils.h"
#include <gtkprintutils.h>
#include "gtkprivate.h"
#ifdef HAVE_COLORD
#include <colord.h>
@@ -1690,7 +1691,7 @@ cups_request_execute (GtkPrintBackendCups *print_backend,
dispatch = (GtkPrintCupsDispatchWatch *) g_source_new (&_cups_dispatch_watch_funcs,
sizeof (GtkPrintCupsDispatchWatch));
g_source_set_name (&dispatch->source, "GTK CUPS backend");
g_source_set_static_name (&dispatch->source, "GTK CUPS backend");
GTK_NOTE (PRINTING,
g_print ("CUPS Backend: %s <source %p> - Executing cups request on server '%s' and resource '%s'\n", G_STRFUNC, dispatch, request->server, request->resource));
+3568 -2387
View File
File diff suppressed because it is too large Load Diff
+204 -77
View File
@@ -1,116 +1,243 @@
#include <gdk/gdk.h>
#include <stdlib.h>
#include <gtk/gtk.h>
static GType
string_type (void)
{
return G_TYPE_STRING;
}
static struct {
GType (* type_func) (void);
const char *mime_type;
} possible_types[] = {
/* GTypes go here */
{ string_type, NULL },
{ gdk_file_list_get_type, NULL },
{ gdk_rgba_get_type, NULL },
{ gdk_texture_get_type, NULL },
/* mime types go here */
{ NULL, "text/plain" },
{ NULL, "text/plain;charset=utf-8" },
{ NULL, "image/png" },
{ NULL, "image/jpeg" },
{ NULL, "application/x-color" },
};
#define assert_printf(...) G_STMT_START{ \
char *_s = g_strdup_printf (__VA_ARGS__); \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, _s); \
g_free (_s); \
}G_STMT_END
#define assert_formats_subset(a, b) G_STMT_START{ \
const GType *_gtypes; \
const char * const *_mime_types; \
gsize _i, _n; \
\
_gtypes = gdk_content_formats_get_gtypes (a, &_n); \
for (_i = 0; _i < _n; _i++) \
{ \
if (!gdk_content_formats_contain_gtype (b, _gtypes[_i])) \
assert_printf (#a "" #b ": does not contain GType %s", g_type_name (_gtypes[_i])); \
} \
\
_mime_types = gdk_content_formats_get_mime_types (a, &_n); \
for (_i = 0; _i < _n; _i++) \
{ \
if (!gdk_content_formats_contain_mime_type (b, _mime_types[_i])) \
assert_printf (#a "" #b ": does not contain mime type %s", _mime_types[_i]); \
} \
}G_STMT_END
#define assert_formats_equal(a, b) G_STMT_START{\
assert_formats_subset(a, b); \
assert_formats_subset(b, a); \
}G_STMT_END
static GdkContentFormats *
create_random_content_formats (void)
{
GdkContentFormatsBuilder *builder;
gsize i, n;
n = g_test_rand_int_range (0, G_N_ELEMENTS (possible_types));
builder = gdk_content_formats_builder_new ();
for (i = 0; i < n; i++)
{
gsize j = g_random_int_range (0, G_N_ELEMENTS (possible_types));
if (possible_types[j].type_func)
gdk_content_formats_builder_add_gtype (builder, possible_types[j].type_func ());
else if (possible_types[j].mime_type)
gdk_content_formats_builder_add_mime_type (builder, possible_types[j].mime_type);
else
g_assert_not_reached ();
}
return gdk_content_formats_builder_free_to_formats (builder);
}
static void
test_contentformats_parse (void)
test_print_and_parse (void)
{
struct {
const char *test;
const char *output;
} tests[] = {
{ "", "" },
{ "text/plain;charset=utf8", "text/plain;charset=utf8" },
{ "text/plain GdkRGBA", "GdkRGBA text/plain" },
{ "text/plain\nGdkRGBA", "GdkRGBA text/plain" },
{ "text/plain\t\nGdkRGBA", "GdkRGBA text/plain" },
{ "UUU", NULL },
{ "GdkFileList", "GdkFileList" },
};
GdkContentFormats *before, *parsed;
char *string_before, *string_parsed;
gsize i;
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
for (i = 0; i < 100; i++)
{
GdkContentFormats *formats;
char *s;
before = create_random_content_formats ();
string_before = gdk_content_formats_to_string (before);
formats = gdk_content_formats_parse (tests[i].test);
if (tests[i].output == NULL)
{
g_assert_null (formats);
continue;
}
parsed = gdk_content_formats_parse (string_before);
g_assert (parsed);
assert_formats_equal (before, parsed);
s = gdk_content_formats_to_string (formats);
string_parsed = gdk_content_formats_to_string (parsed);
g_assert_cmpstr (string_before, ==, string_parsed);
g_assert_cmpstr (s, ==, tests[i].output);
gdk_content_formats_unref (formats);
g_free (s);
formats = gdk_content_formats_parse (tests[i].output);
s = gdk_content_formats_to_string (formats);
g_assert_cmpstr (s, ==, tests[i].output);
gdk_content_formats_unref (formats);
g_free (s);
g_free (string_parsed);
g_free (string_before);
gdk_content_formats_unref (parsed);
gdk_content_formats_unref (before);
}
}
static void
test_contentformats_types (void)
test_union (void)
{
GdkContentFormats *formats;
const char *const *mimetypes;
gsize n_types;
const GType *gtypes;
GdkContentFormatsBuilder *builder;
GdkContentFormats *a, *b, *ab, *ab2;
gsize i;
formats = gdk_content_formats_parse ("text/plain GdkFileList application/x-color GdkRGBA");
for (i = 0; i < 100; i++)
{
a = create_random_content_formats ();
b = create_random_content_formats ();
g_assert_nonnull (formats);
ab = gdk_content_formats_union (gdk_content_formats_ref (a), b);
assert_formats_subset (a, ab);
assert_formats_subset (b, ab);
mimetypes = gdk_content_formats_get_mime_types (formats, &n_types);
g_assert_true (n_types == 2);
g_assert_cmpstr (mimetypes[0], ==, "text/plain");
g_assert_cmpstr (mimetypes[1], ==, "application/x-color");
ab2 = gdk_content_formats_union (gdk_content_formats_ref (a), ab);
assert_formats_equal (ab, ab2);
gdk_content_formats_unref (ab2);
gtypes = gdk_content_formats_get_gtypes (formats, &n_types);
g_assert_true (n_types == 2);
g_assert_true (gtypes[0] == GDK_TYPE_FILE_LIST);
g_assert_true (gtypes[1] == GDK_TYPE_RGBA);
builder = gdk_content_formats_builder_new ();
gdk_content_formats_builder_add_formats (builder, a);
gdk_content_formats_builder_add_formats (builder, b);
ab2 = gdk_content_formats_builder_free_to_formats (builder);
assert_formats_equal (ab, ab2);
gdk_content_formats_unref (ab2);
gdk_content_formats_unref (formats);
gdk_content_formats_unref (ab);
gdk_content_formats_unref (a);
gdk_content_formats_unref (b);
}
}
static void
test_contentformats_union (void)
append_separator (GString *string)
{
GdkContentFormats *formats;
GdkContentFormats *formats2;
const char *const *mimetypes;
gsize n_types;
const GType *gtypes;
static const char *separators = "\t\n\f\r ";
formats = gdk_content_formats_parse ("text/plain application/x-color");
formats2 = gdk_content_formats_parse ("GdkFileList GdkRGBA");
do {
g_string_append_c (string, separators[g_test_rand_int_range (0, strlen (separators))]);
} while (g_test_rand_bit ());
}
formats = gdk_content_formats_union (formats, formats2);
static char *
fuzzy_print (GdkContentFormats *formats)
{
GString *string;
const GType *types;
const char * const *mime_types;
gsize i, n;
string = g_string_new ("");
g_assert_nonnull (formats);
types = gdk_content_formats_get_gtypes (formats, &n);
for (i = 0; i < n; i++)
{
if (string->len || g_test_rand_bit ())
append_separator (string);
g_string_append (string, g_type_name (types[i]));
}
mimetypes = gdk_content_formats_get_mime_types (formats, &n_types);
g_assert_true (n_types == 2);
g_assert_cmpstr (mimetypes[0], ==, "text/plain");
g_assert_cmpstr (mimetypes[1], ==, "application/x-color");
mime_types = gdk_content_formats_get_mime_types (formats, &n);
for (i = 0; i < n; i++)
{
if (string->len || g_test_rand_bit ())
append_separator (string);
g_string_append (string, mime_types[i]);
}
gtypes = gdk_content_formats_get_gtypes (formats, &n_types);
g_assert_true (n_types == 2);
g_assert_true (gtypes[0] == GDK_TYPE_FILE_LIST);
g_assert_true (gtypes[1] == GDK_TYPE_RGBA);
if (g_test_rand_bit ())
append_separator (string);
gdk_content_formats_unref (formats2);
gdk_content_formats_unref (formats);
return g_string_free (string, FALSE);
}
static void
test_parse (void)
{
gsize i;
for (i = 0; i < 100; i++)
{
GdkContentFormats *formats, *parsed;
char *fuzzy;
formats = create_random_content_formats ();
fuzzy = fuzzy_print (formats);
parsed = gdk_content_formats_parse (fuzzy);
assert_formats_equal (formats, parsed);
g_free (fuzzy);
gdk_content_formats_unref (parsed);
gdk_content_formats_unref (formats);
}
}
static void
test_parse_fail (void)
{
static const char *failures[] = {
"GtkNonexistingType",
"text/plain TypeAfterMime",
"notamimetype",
"image/png stillnotamimetype",
};
gsize i;
for (i = 0; i < G_N_ELEMENTS (failures); i++)
{
g_assert_null (gdk_content_formats_parse (failures[i]));
}
}
int
main (int argc, char *argv[])
{
gsize i;
(g_test_init) (&argc, &argv, NULL);
g_type_ensure (GDK_TYPE_RGBA);
g_type_ensure (GDK_TYPE_FILE_LIST);
gtk_init ();
g_test_add_func ("/contentformats/parse", test_contentformats_parse);
g_test_add_func ("/contentformats/types", test_contentformats_types);
g_test_add_func ("/contentformats/union", test_contentformats_union);
/* Ensure all the types we care about to exist */
for (i = 0; i < G_N_ELEMENTS(possible_types); i++)
{
if (possible_types[i].type_func)
g_type_ensure (possible_types[i].type_func ());
}
g_test_add_func ("/contentformats/parse", test_parse);
g_test_add_func ("/contentformats/parse_fail", test_parse_fail);
g_test_add_func ("/contentformats/print_and_parse", test_print_and_parse);
g_test_add_func ("/contentformats/union", test_union);
return g_test_run ();
}
+1
View File
@@ -23,6 +23,7 @@ if bash.found()
workdir: meson.current_build_dir(),
protocol: 'tap',
env: [
'TEST_RESULT_DIR=@0@'.format(join_paths(meson.current_build_dir(), 'output')),
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GTK_A11Y=test',
+3 -1
View File
@@ -2,7 +2,9 @@
GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool}
TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data-3to4
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify-3to4
mkdir -p "$TEST_RESULT_DIR"
shopt -s nullglob
TESTS=( "$TEST_DATA_DIR"/*.ui )
+3 -1
View File
@@ -2,7 +2,9 @@
GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool}
TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify
mkdir -p "$TEST_RESULT_DIR"
shopt -s nullglob
TESTS=( "$TEST_DATA_DIR"/*.ui )
+3 -1
View File
@@ -2,7 +2,9 @@
GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool}
TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/validate-data
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/validate
mkdir -p "$TEST_RESULT_DIR"
shopt -s nullglob
TESTS=( "$TEST_DATA_DIR"/*.ui )