diff options
Diffstat (limited to 'gdk')
45 files changed, 348 insertions, 273 deletions
diff --git a/gdk/broadway/client.html b/gdk/broadway/client.html index 42b5c45f01..a2954c1f31 100644 --- a/gdk/broadway/client.html +++ b/gdk/broadway/client.html @@ -10,6 +10,6 @@ body { overflow: hidden; } <script type="text/javascript" src="broadway.js"></script> </head> -<body onload="connect()"> +<body onload="connect()" onclick="if (!document.hasFocus() && window.topElement !== window.self) { window.focus(); }"> </body> </html> diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c index a752420410..56e9684112 100644 --- a/gdk/broadway/gdksurface-broadway.c +++ b/gdk/broadway/gdksurface-broadway.c @@ -116,7 +116,7 @@ queue_flush (GdkSurface *surface) if (flush_id == 0) { flush_id = g_idle_add (flush_idle, NULL); - g_source_set_name_by_id (flush_id, "[gtk+] flush_idle"); + g_source_set_name_by_id (flush_id, "[gtk] flush_idle"); } } diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h index 0c83002bfc..551ecac9aa 100644 --- a/gdk/gdk-private.h +++ b/gdk/gdk-private.h @@ -36,4 +36,8 @@ gboolean gdk_should_use_portal (void); const gchar * gdk_get_startup_notification_id (void); +PangoDirection gdk_unichar_direction (gunichar ch); +PangoDirection gdk_find_base_dir (const char *text, + int len); + #endif /* __GDK__PRIVATE_H__ */ @@ -40,6 +40,8 @@ #include <string.h> #include <stdlib.h> +#include <fribidi.h> + /** * SECTION:general @@ -343,3 +345,45 @@ gdk_should_use_portal (void) * management for you. */ +PangoDirection +gdk_unichar_direction (gunichar ch) +{ + FriBidiCharType fribidi_ch_type; + + G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar)); + + fribidi_ch_type = fribidi_get_bidi_type (ch); + + if (!FRIBIDI_IS_STRONG (fribidi_ch_type)) + return PANGO_DIRECTION_NEUTRAL; + else if (FRIBIDI_IS_RTL (fribidi_ch_type)) + return PANGO_DIRECTION_RTL; + else + return PANGO_DIRECTION_LTR; +} + +PangoDirection +gdk_find_base_dir (const gchar *text, + gint length) +{ + PangoDirection dir = PANGO_DIRECTION_NEUTRAL; + const gchar *p; + + g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL); + + p = text; + while ((length < 0 || p < text + length) && *p) + { + gunichar wc = g_utf8_get_char (p); + + dir = gdk_unichar_direction (wc); + + if (dir != PANGO_DIRECTION_NEUTRAL) + break; + + p = g_utf8_next_char (p); + } + + return dir; +} + diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index ec8df56bd9..81e9d8aff8 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -363,6 +363,8 @@ gdk_display_init (GdkDisplay *display) display->pointers_info = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) free_pointer_info); + g_queue_init (&display->queued_events); + display->debug_flags = _gdk_debug_flags; display->composited = TRUE; @@ -376,9 +378,7 @@ gdk_display_dispose (GObject *object) _gdk_display_manager_remove_display (gdk_display_manager_get (), display); - g_list_free_full (display->queued_events, (GDestroyNotify) g_object_unref); - display->queued_events = NULL; - display->queued_tail = NULL; + g_queue_clear (&display->queued_events); G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object); } diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index 12bdd4ecd1..986a18b575 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -74,8 +74,7 @@ struct _GdkDisplay { GObject parent_instance; - GList *queued_events; - GList *queued_tail; + GQueue queued_events; guint event_pause_count; /* How many times events are blocked */ diff --git a/gdk/gdkenumtypes.c.template b/gdk/gdkenumtypes.c.template index dcafd8d251..5237d549ab 100644 --- a/gdk/gdkenumtypes.c.template +++ b/gdk/gdkenumtypes.c.template @@ -5,7 +5,7 @@ /*** END file-header ***/ /*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ +/* enumerations from "@basename@" */ /*** END file-production ***/ /*** BEGIN value-header ***/ diff --git a/gdk/gdkenumtypes.h.template b/gdk/gdkenumtypes.h.template index 0bc4a71033..d6f62480bc 100644 --- a/gdk/gdkenumtypes.h.template +++ b/gdk/gdkenumtypes.h.template @@ -14,7 +14,7 @@ G_BEGIN_DECLS /*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ +/* enumerations from "@basename@" */ /*** END file-production ***/ /*** BEGIN value-header ***/ diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 35558f68b0..bbdf0305ed 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -64,14 +64,6 @@ * of related touch events. */ -typedef struct _GdkIOClosure GdkIOClosure; - -struct _GdkIOClosure -{ - GDestroyNotify notify; - gpointer data; -}; - /* Private variable declarations */ @@ -79,8 +71,6 @@ static GdkEventFunc _gdk_event_func = NULL; /* Callback for events */ static gpointer _gdk_event_data = NULL; static GDestroyNotify _gdk_event_notify = NULL; -static GQuark quark_event_user_data = 0; - static void gdk_event_constructed (GObject *object); static void gdk_event_finalize (GObject *object); @@ -158,8 +148,6 @@ gdk_event_class_init (GdkEventClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_properties (object_class, N_PROPS, event_props); - - quark_event_user_data = g_quark_from_static_string ("gdk-event-user-data"); } void @@ -197,7 +185,7 @@ _gdk_event_queue_find_first (GdkDisplay *display) gboolean paused = display->event_pause_count > 0; - tmp_list = display->queued_events; + tmp_list = g_queue_peek_head_link (&display->queued_events); while (tmp_list) { GdkEvent *event = tmp_list->data; @@ -233,14 +221,9 @@ GList * _gdk_event_queue_append (GdkDisplay *display, GdkEvent *event) { - display->queued_tail = g_list_append (display->queued_tail, event); - - if (!display->queued_events) - display->queued_events = display->queued_tail; - else - display->queued_tail = display->queued_tail->next; + g_queue_push_tail (&display->queued_events, event); - return display->queued_tail; + return g_queue_peek_tail_link (&display->queued_events); } /** @@ -251,22 +234,18 @@ _gdk_event_queue_append (GdkDisplay *display, * * Appends an event after the specified event, or if it isn’t in * the queue, onto the tail of the event queue. - * - * Returns: the newly appended list node. */ -GList* +void _gdk_event_queue_insert_after (GdkDisplay *display, GdkEvent *sibling, GdkEvent *event) { - GList *prev = g_list_find (display->queued_events, sibling); - if (prev && prev->next) - { - display->queued_events = g_list_insert_before (display->queued_events, prev->next, event); - return prev->next; - } + GList *prev = g_queue_find (&display->queued_events, sibling); + + if (prev) + g_queue_insert_after (&display->queued_events, prev, event); else - return _gdk_event_queue_append (display, event); + g_queue_push_tail (&display->queued_events, event); } /** @@ -280,19 +259,17 @@ _gdk_event_queue_insert_after (GdkDisplay *display, * * Returns: the newly prepended list node. */ -GList* +void _gdk_event_queue_insert_before (GdkDisplay *display, GdkEvent *sibling, GdkEvent *event) { - GList *next = g_list_find (display->queued_events, sibling); + GList *next = g_queue_find (&display->queued_events, sibling); + if (next) - { - display->queued_events = g_list_insert_before (display->queued_events, next, event); - return next->prev; - } + g_queue_insert_before (&display->queued_events, next, event); else - return _gdk_event_queue_append (display, event); + g_queue_push_head (&display->queued_events, event); } @@ -307,15 +284,7 @@ void _gdk_event_queue_remove_link (GdkDisplay *display, GList *node) { - if (node->prev) - node->prev->next = node->next; - else - display->queued_events = node->next; - - if (node->next) - node->next->prev = node->prev; - else - display->queued_tail = node->prev; + g_queue_unlink (&display->queued_events, node); } /** @@ -380,7 +349,7 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display) /* If the last N events in the event queue are motion notify * events for the same surface, drop all but the last */ - tmp_list = display->queued_tail; + tmp_list = g_queue_peek_tail_link (&display->queued_events); while (tmp_list) { @@ -421,14 +390,12 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display) gdk_event_push_history (last_motion, pending_motions->data); g_object_unref (pending_motions->data); - display->queued_events = g_list_delete_link (display->queued_events, - pending_motions); + g_queue_delete_link (&display->queued_events, pending_motions); pending_motions = next; } - if (pending_motions && - pending_motions == display->queued_events && - pending_motions == display->queued_tail) + if (g_queue_get_length (&display->queued_events) == 1 && + g_queue_peek_head_link (&display->queued_events) == pending_motions) { GdkFrameClock *clock = gdk_surface_get_frame_clock (pending_motion_surface); if (clock) /* might be NULL if surface was destroyed */ @@ -441,7 +408,7 @@ _gdk_event_queue_flush (GdkDisplay *display) { GList *tmp_list; - for (tmp_list = display->queued_events; tmp_list; tmp_list = tmp_list->next) + for (tmp_list = display->queued_events.head; tmp_list; tmp_list = tmp_list->next) { GdkEvent *event = tmp_list->data; event->any.flags |= GDK_EVENT_FLUSHED; @@ -626,8 +593,8 @@ gdk_event_copy (const GdkEvent *event) g_object_ref (new_event->any.device); if (new_event->any.source_device) g_object_ref (new_event->any.source_device); - - gdk_event_set_user_data (new_event, gdk_event_get_user_data (event)); + if (new_event->any.user_data) + g_object_ref (new_event->any.user_data); switch ((guint) event->any.type) { @@ -737,6 +704,7 @@ gdk_event_finalize (GObject *object) g_clear_object (&event->any.device); g_clear_object (&event->any.source_device); + g_clear_object (&event->any.user_data); G_OBJECT_CLASS (gdk_event_parent_class)->finalize (object); } @@ -1968,22 +1936,13 @@ void gdk_event_set_user_data (GdkEvent *event, GObject *user_data) { - if (user_data) - { - g_object_set_qdata_full (G_OBJECT (event), quark_event_user_data, - g_object_ref (user_data), - g_object_unref); - } - else - { - g_object_steal_qdata (G_OBJECT (event), quark_event_user_data); - } + g_set_object (&event->any.user_data, user_data); } GObject * gdk_event_get_user_data (const GdkEvent *event) { - return g_object_get_qdata (G_OBJECT (event), quark_event_user_data); + return event->any.user_data; } /** diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h index 8ec949c606..f904d8b2de 100644 --- a/gdk/gdkevents.h +++ b/gdk/gdkevents.h @@ -54,7 +54,7 @@ G_BEGIN_DECLS #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT) /** - * GDK_PRIORITY_REDRAW: + * GDK_PRIORITY_REDRAW: (value 120) * * This is the priority that the idle handler processing surface updates * is given in the @@ -485,10 +485,6 @@ GDK_AVAILABLE_IN_ALL gboolean gdk_event_get_pointer_emulated (GdkEvent *event); GDK_AVAILABLE_IN_ALL -void gdk_event_set_user_data (GdkEvent *event, - GObject *user_data); - -GDK_AVAILABLE_IN_ALL gboolean gdk_event_is_sent (const GdkEvent *event); GDK_AVAILABLE_IN_ALL diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h index e7e9cac515..b81faba589 100644 --- a/gdk/gdkeventsprivate.h +++ b/gdk/gdkeventsprivate.h @@ -61,6 +61,7 @@ struct _GdkEventAny GdkDevice *device; GdkDevice *source_device; GdkDisplay *display; + GObject *user_data; }; /* @@ -631,4 +632,8 @@ union _GdkEvent GdkEventPadGroupMode pad_group_mode; }; +void gdk_event_set_user_data (GdkEvent *event, + GObject *user_data); + + #endif /* __GDK_EVENTS_PRIVATE_H__ */ diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c index e848a21d5a..a561503138 100644 --- a/gdk/gdkframeclock.c +++ b/gdk/gdkframeclock.c @@ -440,8 +440,8 @@ _gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock) * for the current frame or a recent frame. The #GdkFrameTimings * object may not yet be complete: see gdk_frame_timings_get_complete(). * - * Returns: (nullable): the #GdkFrameTimings object for the specified - * frame, or %NULL if it is not available. See + * Returns: (nullable) (transfer none): the #GdkFrameTimings object for + * the specified frame, or %NULL if it is not available. See * gdk_frame_clock_get_history_start(). */ GdkFrameTimings * @@ -472,10 +472,10 @@ gdk_frame_clock_get_timings (GdkFrameClock *frame_clock, * * Gets the frame timings for the current frame. * - * Returns: (nullable): the #GdkFrameTimings for the frame currently - * being processed, or even no frame is being processed, for the - * previous frame. Before any frames have been processed, returns - * %NULL. + * Returns: (nullable) (transfer none): the #GdkFrameTimings for the + * frame currently being processed, or even no frame is being + * processed, for the previous frame. Before any frames have been + * processed, returns %NULL. */ GdkFrameTimings * gdk_frame_clock_get_current_timings (GdkFrameClock *frame_clock) diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c index 911680fffd..0da209cf88 100644 --- a/gdk/gdkframeclockidle.c +++ b/gdk/gdkframeclockidle.c @@ -243,7 +243,7 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle) 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"); + g_source_set_name_by_id (priv->flush_idle_id, "[gtk] gdk_frame_clock_flush_idle"); } if (!priv->in_paint_idle && @@ -254,7 +254,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"); + g_source_set_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle"); } } } diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c index 618aa45f4c..5688513528 100644 --- a/gdk/gdkgltexture.c +++ b/gdk/gdkgltexture.c @@ -91,10 +91,10 @@ gdk_gl_texture_download (GdkTexture *texture, } else { - GdkSurface *surface; + GdkSurface *gl_surface; - surface = gdk_gl_context_get_surface (self->context); - gdk_cairo_draw_from_gl (cr, surface, self->id, GL_TEXTURE, 1, + gl_surface = gdk_gl_context_get_surface (self->context); + gdk_cairo_draw_from_gl (cr, gl_surface, self->id, GL_TEXTURE, 1, area->x, area->y, area->width, area->height); } @@ -189,7 +189,7 @@ gdk_gl_texture_release (GdkGLTexture *self) * * Note that the GL texture must not be modified until @destroy is called, * which will happen when the GdkTexture object is finalized, or due to - * an explicit call of gdk_texture_release_gl(). + * an explicit call of gdk_gl_texture_release(). * * Return value: (transfer full): A newly-created #GdkTexture */ diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index f64f38dd4b..30429e931a 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -233,10 +233,10 @@ void _gdk_event_queue_remove_link (GdkDisplay *display, GList *node); GList* _gdk_event_queue_append (GdkDisplay *display, GdkEvent *event); -GList* _gdk_event_queue_insert_after (GdkDisplay *display, +void _gdk_event_queue_insert_after (GdkDisplay *display, GdkEvent *after_event, GdkEvent *event); -GList* _gdk_event_queue_insert_before(GdkDisplay *display, +void _gdk_event_queue_insert_before(GdkDisplay *display, GdkEvent *after_event, GdkEvent *event); @@ -351,7 +351,6 @@ void gdk_synthesize_surface_state (GdkSurface *surface, GdkSurfaceState unset_flags, GdkSurfaceState set_flags); - G_END_DECLS #endif /* __GDK_INTERNALS_H__ */ diff --git a/gdk/gdkkeysyms-update.pl b/gdk/gdkkeysyms-update.pl index 7bf9314fdf..25d527e6cf 100755 --- a/gdk/gdkkeysyms-update.pl +++ b/gdk/gdkkeysyms-update.pl @@ -1,15 +1,15 @@ #!/usr/bin/env perl -# Updates http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms.h from upstream (X.org 7.x), -# from http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h +# Updates https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms.h from upstream (X.org 7.x), +# from https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h # # Author : Simos Xenitellis <simos at gnome dot org>. # Author : Bastien Nocera <hadess@hadess.net> # Version : 1.2 # -# Input : http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h -# Input : http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h -# Output : http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms.h +# Input : https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h +# Input : https://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h +# Output : https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms.h # # Notes : It downloads keysymdef.h from the Internet, if not found locally, # Notes : and creates an updated gdkkeysyms.h @@ -53,7 +53,7 @@ else # Source: http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h die "Could not open file keysymdef.h: $!\n" unless open(IN_KEYSYMDEF, "<:utf8", "keysymdef.h"); -# Output: gtk+/gdk/gdkkeysyms.h +# Output: gtk/gdk/gdkkeysyms.h die "Could not open file gdkkeysyms.h: $!\n" unless open(OUT_GDKKEYSYMS, ">:utf8", "gdkkeysyms.h"); my $LICENSE_HEADER= <<EOF; @@ -82,7 +82,7 @@ print OUT_GDKKEYSYMS $LICENSE_HEADER; print OUT_GDKKEYSYMS<<EOF; /* - * File auto-generated from script http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms-update.pl + * File auto-generated from script https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms-update.pl * using the input file * http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h * and diff --git a/gdk/gdkkeysyms.h b/gdk/gdkkeysyms.h index d2d6d07d7c..88fd1289f7 100644 --- a/gdk/gdkkeysyms.h +++ b/gdk/gdkkeysyms.h @@ -18,7 +18,7 @@ /* - * File auto-generated from script http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms-update.pl + * File auto-generated from script https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms-update.pl * using the input file * http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h * and diff --git a/gdk/gdkpaintable.c b/gdk/gdkpaintable.c index 5e3904e73c..8e808b4913 100644 --- a/gdk/gdkpaintable.c +++ b/gdk/gdkpaintable.c @@ -38,10 +38,9 @@ void gtk_snapshot_pop (GdkSnapshot * #GdkPaintable is a simple interface used by GDK and GDK to represent * objects that can be painted anywhere at any size without requiring any * sort of layout. The interface is inspired by similar concepts elsewhere, - * such as #ClutterContent, <ulink - * linkend="https://www.w3.org/TR/css-images-4/#paint-source">HTML/CSS Paint - * Sources</ulink> or <ulink linkend="https://www.w3.org/TR/SVG2/pservers.html"> - * SVG Paint Servers</ulink>. + * such as [ClutterContent](https://developer.gnome.org/clutter/stable/ClutterContent.html), + * [HTML/CSS Paint Sources](https://www.w3.org/TR/css-images-4/#paint-source), + * or [SVG Paint Servers](https://www.w3.org/TR/SVG2/pservers.html). * * A #GdkPaintable can be snapshot at any time and size using * gdk_paintable_snapshot(). How the paintable interprets that size and if it diff --git a/gdk/gdkrgba.c b/gdk/gdkrgba.c index de1c594337..8e36523dc2 100644 --- a/gdk/gdkrgba.c +++ b/gdk/gdkrgba.c @@ -175,7 +175,7 @@ parse_rgb_value (const gchar *str, * - A RGBA color in the form “rgba(r,g,b,a)” * * Where “r”, “g”, “b” and “a” are respectively the red, green, blue and - * alpha color values. In the last two cases, r g and b are either integers + * alpha color values. In the last two cases, “r”, “g”, and “b” are either integers * in the range 0 to 255 or percentage values in the range 0% to 100%, and * a is a floating point value in the range 0 to 1. * @@ -353,18 +353,18 @@ gdk_rgba_equal (gconstpointer p1, * @rgba: a #GdkRGBA * * Returns a textual specification of @rgba in the form - * `rgb (r, g, b)` or - * `rgba (r, g, b, a)`, + * `rgb(r,g,b)` or + * `rgba(r g,b,a)`, * where “r”, “g”, “b” and “a” represent the red, green, - * blue and alpha values respectively. r, g, and b are - * represented as integers in the range 0 to 255, and a - * is represented as floating point value in the range 0 to 1. + * blue and alpha values respectively. “r”, “g”, and “b” are + * represented as integers in the range 0 to 255, and “a” + * is represented as a floating point value in the range 0 to 1. * - * These string forms are string forms those supported by + * These string forms are string forms that are supported by * the CSS3 colors module, and can be parsed by gdk_rgba_parse(). * * Note that this string representation may lose some - * precision, since r, g and b are represented as 8-bit + * precision, since “r”, “g” and “b” are represented as 8-bit * integers. If this is a concern, you should use a * different representation. * diff --git a/gdk/gdkseat.c b/gdk/gdkseat.c index aa120f298b..6edd383206 100644 --- a/gdk/gdkseat.c +++ b/gdk/gdkseat.c @@ -434,14 +434,15 @@ gdk_seat_tool_removed (GdkSeat *seat, GdkDeviceTool * gdk_seat_get_tool (GdkSeat *seat, - guint64 serial) + guint64 serial, + guint64 hw_id) { GdkSeatClass *seat_class; g_return_val_if_fail (GDK_IS_SEAT (seat), NULL); seat_class = GDK_SEAT_GET_CLASS (seat); - return seat_class->get_tool (seat, serial); + return seat_class->get_tool (seat, serial, hw_id); } /** diff --git a/gdk/gdkseatdefault.c b/gdk/gdkseatdefault.c index 2de1c36c5f..14dbb75f97 100644 --- a/gdk/gdkseatdefault.c +++ b/gdk/gdkseatdefault.c @@ -282,7 +282,8 @@ gdk_seat_default_get_slaves (GdkSeat *seat, static GdkDeviceTool * gdk_seat_default_get_tool (GdkSeat *seat, - guint64 serial) + guint64 serial, + guint64 hw_id) { GdkSeatDefaultPrivate *priv; GdkDeviceTool *tool; @@ -297,7 +298,7 @@ gdk_seat_default_get_tool (GdkSeat *seat, { tool = g_ptr_array_index (priv->tools, i); - if (tool->serial == serial) + if (tool->serial == serial && tool->hw_id == hw_id) return tool; } @@ -457,8 +458,7 @@ gdk_seat_default_remove_tool (GdkSeatDefault *seat, priv = gdk_seat_default_get_instance_private (seat); - if (tool != gdk_seat_get_tool (GDK_SEAT (seat), - gdk_device_tool_get_serial (tool))) + if (tool != gdk_seat_get_tool (GDK_SEAT (seat), tool->serial, tool->hw_id)) return; g_signal_emit_by_name (seat, "tool-removed", tool); diff --git a/gdk/gdkseatprivate.h b/gdk/gdkseatprivate.h index 97127dbfae..eaeecec8ff 100644 --- a/gdk/gdkseatprivate.h +++ b/gdk/gdkseatprivate.h @@ -57,7 +57,8 @@ struct _GdkSeatClass GdkSeatCapabilities capabilities); GdkDeviceTool * (* get_tool) (GdkSeat *seat, - guint64 serial); + guint64 serial, + guint64 tool_id); GList * (* get_master_pointers) (GdkSeat *seat, GdkSeatCapabilities capabilities); }; @@ -74,6 +75,7 @@ void gdk_seat_tool_removed (GdkSeat *seat, GdkDeviceTool * gdk_seat_get_tool (GdkSeat *seat, - guint64 serial); + guint64 serial, + guint64 hw_id); #endif /* __GDK_SEAT_PRIVATE_H__ */ diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 3aebd5717d..28a135ad06 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -786,12 +786,12 @@ gdk_display_create_vulkan_device (GdkDisplay *display, else { gint64 device_idx; - GError *error = NULL; + GError *error2 = NULL; - if (!g_ascii_string_to_signed (override, 10, 0, G_MAXINT, &device_idx, &error)) + if (!g_ascii_string_to_signed (override, 10, 0, G_MAXINT, &device_idx, &error2)) { - g_warning ("Failed to parse %s: %s", "GDK_VULKAN_DEVICE", error->message); - g_error_free (error); + g_warning ("Failed to parse %s: %s", "GDK_VULKAN_DEVICE", error2->message); + g_error_free (error2); device_idx = -1; } diff --git a/gdk/meson.build b/gdk/meson.build index 2ed2585f0f..44170dbae8 100644 --- a/gdk/meson.build +++ b/gdk/meson.build @@ -169,6 +169,7 @@ gdk_deps = [ pixbuf_dep, cairo_dep, pango_dep, + fribidi_dep, cairogobj_dep, glib_dep, gobject_dep, diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c index 303c603fcc..c1ab58518c 100644 --- a/gdk/quartz/gdkscreen-quartz.c +++ b/gdk/quartz/gdkscreen-quartz.c @@ -263,7 +263,7 @@ display_reconfiguration_callback (CGDirectDisplayID display, if (!screen->screen_changed_id) { screen->screen_changed_id = g_idle_add (screen_changed_idle, screen); - g_source_set_name_by_id (screen->screen_changed_id, "[gtk+] screen_changed_idle"); + g_source_set_name_by_id (screen->screen_changed_id, "[gtk] screen_changed_idle"); } } } diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index f991f55ff3..f1dab93f1b 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -466,7 +466,7 @@ 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"); + g_source_set_name_by_id (id, "[gtk] gdk_wayland_device_update_surface_cursor"); pointer->cursor_timeout_id = id; } else @@ -2173,7 +2173,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"); + g_source_set_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat"); } static void diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 0c870d8722..777b90b7ef 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -64,8 +64,7 @@ * * The functions in this section are specific to the GDK Wayland backend. * To use them, you need to include the `<gdk/gdkwayland.h>` header and use - * the Wayland-specific pkg-config files to build your application (either - * `gdk-wayland-3.0` or `gtk+-wayland-3.0`). + * the Wayland-specific pkg-config `gtk4-wayland` file to build your application. * * To make your code compile with other GDK backends, guard backend-specific * calls by an ifdef as follows. Since GDK may be built with multiple @@ -1789,7 +1788,7 @@ init_settings (GdkDisplay *display) { GVariant *ret; GError *error = NULL; - const char *schema; + const char *schema_str; GVariant *val; GVariantIter *iter; const char *patterns[] = { "org.gnome.*", NULL }; @@ -1829,7 +1828,7 @@ init_settings (GdkDisplay *display) g_variant_get (ret, "(a{sa{sv}})", &iter); - while (g_variant_iter_loop (iter, "{s@a{sv}}", &schema, &val)) + while (g_variant_iter_loop (iter, "{s@a{sv}}", &schema_str, &val)) { GVariantIter *iter2 = g_variant_iter_new (val); const char *key; @@ -1837,17 +1836,17 @@ init_settings (GdkDisplay *display) while (g_variant_iter_loop (iter2, "{sv}", &key, &v)) { - TranslationEntry *entry = find_translation_entry_by_schema (schema, key); + TranslationEntry *entry = find_translation_entry_by_schema (schema_str, key); if (entry) { char *a = g_variant_print (v, FALSE); - g_debug ("Using portal setting for %s %s: %s\n", schema, key, a); + g_debug ("Using portal setting for %s %s: %s\n", schema_str, key, a); g_free (a); apply_portal_setting (entry, v, display); } else { - g_debug ("Ignoring portal setting for %s %s", schema, key); + g_debug ("Ignoring portal setting for %s %s", schema_str, key); } } g_variant_iter_free (iter2); diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c index cad938f5f0..b1992057a0 100644 --- a/gdk/wayland/gdkkeys-wayland.c +++ b/gdk/wayland/gdkkeys-wayland.c @@ -31,12 +31,13 @@ #include <limits.h> #include <errno.h> #include <sys/mman.h> +#include <fribidi.h> #include "gdk.h" #include "gdkwayland.h" #include "gdkprivate-wayland.h" -#include "gdkinternals.h" +#include "gdk-private.h" #include "gdkkeysprivate.h" #include <xkbcommon/xkbcommon.h> @@ -303,9 +304,9 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap, state |= GDK_SUPER_MASK; if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper"))) state |= GDK_HYPER_MASK; - /* Gtk+ treats MOD1 as a synonym for Alt, and does not expect it to + /* GTK treats MOD1 as a synonym for Alt, and does not expect it to * be mapped around, so we should avoid adding GDK_META_MASK if MOD1 - * is already included to avoid confusing gtk+ and applications that + * is already included to avoid confusing GTK and applications that * rely on that behavior. */ if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Meta")) && @@ -499,7 +500,7 @@ update_direction (GdkWaylandKeymap *keymap) { PangoDirection dir; - dir = pango_unichar_direction (xkb_keysym_to_utf32 (syms[sym])); + dir = gdk_unichar_direction (xkb_keysym_to_utf32 (syms[sym])); switch (dir) { case PANGO_DIRECTION_RTL: diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c index 78cf1ba892..e45fc42e9c 100644 --- a/gdk/win32/gdkclipdrop-win32.c +++ b/gdk/win32/gdkclipdrop-win32.c @@ -1655,7 +1655,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 3); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG); fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG); @@ -1665,14 +1665,10 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG); g_array_append_val (comp, fmt); - fmt.w32format = CF_DIB; - fmt.transmute = TRUE; - g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 4); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_JPEG); fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG); @@ -1682,17 +1678,10 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF); g_array_append_val (comp, fmt); - fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG); - fmt.transmute = TRUE; - g_array_append_val (comp, fmt); - - fmt.w32format = CF_DIB; - g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 4); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_GIF); fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF); @@ -1702,13 +1691,6 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF); g_array_append_val (comp, fmt); - fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG); - fmt.transmute = TRUE; - g_array_append_val (comp, fmt); - - fmt.w32format = CF_DIB; - g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); @@ -1771,7 +1753,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) g_hash_table_replace (win32_clipdrop->compatibility_contentformats, GINT_TO_POINTER (CF_UNICODETEXT), comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 3); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG); fmt.transmute = FALSE; @@ -1781,14 +1763,10 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG); g_array_append_val (comp, fmt); - fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP); - fmt.transmute = TRUE; - g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_contentformats, GINT_TO_POINTER (_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG)), comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 4); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF); fmt.transmute = FALSE; @@ -1798,17 +1776,10 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_JPEG); g_array_append_val (comp, fmt); - fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG); - fmt.transmute = TRUE; - g_array_append_val (comp, fmt); - - fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP); - g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_contentformats, GINT_TO_POINTER (_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF)), comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 4); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF); fmt.transmute = FALSE; @@ -1818,17 +1789,10 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_GIF); g_array_append_val (comp, fmt); - fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG); - fmt.transmute = TRUE; - g_array_append_val (comp, fmt); - - fmt.contentformat = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP); - g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_contentformats, GINT_TO_POINTER (_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF)), comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 3); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.w32format = CF_DIB; fmt.transmute = FALSE; @@ -1842,7 +1806,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) g_hash_table_replace (win32_clipdrop->compatibility_contentformats, GINT_TO_POINTER (CF_DIB), comp); - comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 3); + comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); fmt.w32format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST); fmt.transmute = FALSE; diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c index 5af6304124..d0593a0863 100644 --- a/gdk/win32/gdkdrag-win32.c +++ b/gdk/win32/gdkdrag-win32.c @@ -2190,7 +2190,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"); + g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout"); } static gboolean diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index ed31ba5b51..712115072a 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -2717,25 +2717,11 @@ gdk_event_translate (MSG *msg, if (msg->message == WM_MOUSEWHEEL) { - UINT lines_multiplier = 3; event->scroll.delta_y = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / (gdouble) WHEEL_DELTA; - /* -1 means that we should scroll in screens, not lines. - * Right now GDK doesn't support that. - */ - if (SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &lines_multiplier, 0) && - lines_multiplier != (UINT) -1) - event->scroll.delta_y *= (gdouble) lines_multiplier; } else if (msg->message == WM_MOUSEHWHEEL) { - UINT chars_multiplier = 3; event->scroll.delta_x = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / (gdouble) WHEEL_DELTA; - /* There doesn't seem to be any indication that - * h-scroll has an equivalent of the "screen" mode, - * indicated by multiplier being (UINT) -1. - */ - if (SystemParametersInfo (SPI_GETWHEELSCROLLCHARS, 0, &chars_multiplier, 0)) - event->scroll.delta_x *= (gdouble) chars_multiplier; } /* Positive delta scrolls up, not down, see API documentation for WM_MOUSEWHEEL message. diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index be37ef7d0c..630d6ec356 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -27,12 +27,39 @@ #include <string.h> #include <stdlib.h> #include <glib/gprintf.h> +#include <pango/pangowin32.h> #include "gdkproperty.h" #include "gdkdisplayprivate.h" #include "gdkprivate-win32.h" #include "gdkwin32.h" +static gchar* +_get_system_font_name (HDC hdc) +{ + NONCLIENTMETRICSW ncm; + PangoFontDescription *font_desc; + gchar *result, *font_desc_string; + int logpixelsy; + gint font_size; + + ncm.cbSize = sizeof(NONCLIENTMETRICSW); + if (!SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0)) + return NULL; + + logpixelsy = GetDeviceCaps (hdc, LOGPIXELSY); + font_desc = pango_win32_font_description_from_logfontw (&ncm.lfMessageFont); + font_desc_string = pango_font_description_to_string (font_desc); + pango_font_description_free (font_desc); + + /* https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/ns-wingdi-taglogfonta */ + font_size = -MulDiv (ncm.lfMessageFont.lfHeight, 72, logpixelsy); + result = g_strdup_printf ("%s %d", font_desc_string, font_size); + g_free (font_desc_string); + + return result; +} + /* For reference, from gdk/x11/gdksettings.c: @@ -124,60 +151,65 @@ _gdk_win32_get_setting (const gchar *name, g_value_set_boolean (value, TRUE); return TRUE; } + else if (strcmp ("gtk-xft-hinting", name) == 0) + { + GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name)); + g_value_set_int (value, 1); + return TRUE; + } + else if (strcmp ("gtk-xft-antialias", name) == 0) + { + GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name)); + g_value_set_int (value, 1); + return TRUE; + } + else if (strcmp ("gtk-xft-hintstyle", name) == 0) + { + g_value_set_static_string (value, "hintfull"); + GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %s\n", name, g_value_get_string (value))); + return TRUE; + } + else if (strcmp ("gtk-xft-rgba", name) == 0) + { + unsigned int orientation = 0; + if (SystemParametersInfoW (SPI_GETFONTSMOOTHINGORIENTATION, 0, &orientation, 0)) + { + if (orientation == FE_FONTSMOOTHINGORIENTATIONRGB) + g_value_set_static_string (value, "rgb"); + else if (orientation == FE_FONTSMOOTHINGORIENTATIONBGR) + g_value_set_static_string (value, "bgr"); + else + g_value_set_static_string (value, "none"); + } + else + g_value_set_static_string (value, "none"); + + GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %s\n", name, g_value_get_string (value))); + return TRUE; + } else if (strcmp ("gtk-font-name", name) == 0) { - NONCLIENTMETRICS ncm; - CPINFOEX cpinfoex_default, cpinfoex_curr_thread; - OSVERSIONINFO info; - BOOL result_default, result_curr_thread; - - info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - - /* TODO: Fallback to using Pango on Windows 8 and later, - * as this method of handling gtk-font-name does not work - * well there, where garbled text will be displayed for texts - * that are not supported by the default menu font. Look for - * whether there is a better solution for this on Windows 8 and - * later - */ - if (!GetVersionEx (&info) || - info.dwMajorVersion > 6 || - (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2)) - return FALSE; - - /* check whether the system default ANSI codepage matches the - * ANSI code page of the running thread. If so, continue, otherwise - * fall back to using Pango to handle gtk-font-name - */ - result_default = GetCPInfoEx (CP_ACP, 0, &cpinfoex_default); - result_curr_thread = GetCPInfoEx (CP_THREAD_ACP, 0, &cpinfoex_curr_thread); - - if (!result_default || - !result_curr_thread || - cpinfoex_default.CodePage != cpinfoex_curr_thread.CodePage) - return FALSE; - - ncm.cbSize = sizeof(NONCLIENTMETRICS); - if (SystemParametersInfo (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, FALSE)) + gchar *font_name = _get_system_font_name (_gdk_display_hdc); + + if (font_name) { - /* Pango finally uses GetDeviceCaps to scale, we use simple - * approximation here. - */ - int nHeight = (0 > ncm.lfMenuFont.lfHeight ? - 3 * ncm.lfMenuFont.lfHeight / 4 : 10); - if (OUT_STRING_PRECIS == ncm.lfMenuFont.lfOutPrecision) - GDK_NOTE(MISC, g_print("gdk_display_get_setting(%s) : ignoring bitmap font '%s'\n", - name, ncm.lfMenuFont.lfFaceName)); - else if (ncm.lfMenuFont.lfFaceName && strlen(ncm.lfMenuFont.lfFaceName) > 0 && - /* Avoid issues like those described in bug #135098 */ - g_utf8_validate (ncm.lfMenuFont.lfFaceName, -1, NULL)) + /* The pango font fallback list got fixed during 1.43, before that + * using anything but "Segoe UI" would lead to a poor glyph coverage */ + if (pango_version_check (1, 43, 0) != NULL && + g_ascii_strncasecmp (font_name, "Segoe UI", strlen ("Segoe UI")) != 0) { - char *s = g_strdup_printf ("%s %d", ncm.lfMenuFont.lfFaceName, nHeight); - GDK_NOTE(MISC, g_print("gdk_display_get_setting(%s) : %s\n", name, s)); - g_value_set_string (value, s); - - g_free(s); - return TRUE; + g_free (font_name); + return FALSE; } + + GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, font_name)); + g_value_take_string (value, font_name); + return TRUE; + } + else + { + g_warning ("gdk_screen_get_setting: Detecting the system font failed"); + return FALSE; } } else if (strcmp ("gtk-im-module", name) == 0) diff --git a/gdk/win32/meson.build b/gdk/win32/meson.build index 534772b495..f96fc6b394 100644 --- a/gdk/win32/meson.build +++ b/gdk/win32/meson.build @@ -45,6 +45,7 @@ install_headers(gdk_win32_public_headers, subdir: 'gtk-4.0/gdk/win32/') install_headers('gdkwin32.h', subdir: 'gtk-4.0/gdk/') gdk_win32_deps = [ # FIXME + pangowin32_dep ] libgdk_win32 = static_library('gdk-win32', diff --git a/gdk/x11/gdkapplaunchcontext-x11.c b/gdk/x11/gdkapplaunchcontext-x11.c index bc66023fd6..58e8f380ef 100644 --- a/gdk/x11/gdkapplaunchcontext-x11.c +++ b/gdk/x11/gdkapplaunchcontext-x11.c @@ -216,7 +216,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"); + g_source_set_name_by_id (std->timeout_id, "[gtk] startup_timeout"); } /* always remove this one, but we may have reinstalled another one. */ @@ -253,7 +253,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"); + g_source_set_name_by_id (data->timeout_id, "[gtk] startup_timeout"); } } diff --git a/gdk/x11/gdkasync.c b/gdk/x11/gdkasync.c index bf5f242b73..fc4d94eaf5 100644 --- a/gdk/x11/gdkasync.c +++ b/gdk/x11/gdkasync.c @@ -175,7 +175,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"); + g_source_set_name_by_id (id, "[gtk] callback_idle"); } DeqAsyncHandler(state->dpy, &state->async); @@ -711,7 +711,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"); + g_source_set_name_by_id (id, "[gtk] roundtrip_callback_idle"); } DeqAsyncHandler(state->dpy, &state->async); diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c index 55d0440e1e..aeea1af1fe 100644 --- a/gdk/x11/gdkclipboard-x11.c +++ b/gdk/x11/gdkclipboard-x11.c @@ -259,10 +259,11 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, GBytes *bytes; GError *error = NULL; + display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); + bytes = g_input_stream_read_bytes_finish (stream, res, &error); if (bytes == NULL) { - GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: error reading TARGETS: %s\n", cb->selection, error->message)); g_error_free (error); @@ -292,7 +293,6 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes) / sizeof (Atom)); - display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); formats = gdk_x11_clipboard_formats_from_atoms (display, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes) / sizeof (Atom)); diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 86ea47faa5..01d51d3d3a 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -40,6 +40,23 @@ #include <string.h> +static const char *wacom_type_atoms[] = { + "STYLUS", + "CURSOR", + "ERASER", + "PAD", + "TOUCH" +}; +#define N_WACOM_TYPE_ATOMS G_N_ELEMENTS (wacom_type_atoms) + +enum { + WACOM_TYPE_STYLUS, + WACOM_TYPE_CURSOR, + WACOM_TYPE_ERASER, + WACOM_TYPE_PAD, + WACOM_TYPE_TOUCH, +}; + struct _GdkX11DeviceManagerXI2 { GdkX11DeviceManagerCore parent_object; @@ -999,6 +1016,66 @@ device_get_tool_serial_and_id (GdkDevice *device, return TRUE; } +static GdkDeviceToolType +device_get_tool_type (GdkDevice *device) +{ + GdkDisplay *display; + gulong nitems, bytes_after; + guint32 *data; + int rc, format; + Atom type; + Atom device_type; + Atom types[N_WACOM_TYPE_ATOMS]; + GdkDeviceToolType tool_type = GDK_DEVICE_TOOL_TYPE_UNKNOWN; + + display = gdk_device_get_display (device); + gdk_x11_display_error_trap_push (display); + + rc = XIGetProperty (GDK_DISPLAY_XDISPLAY (display), + gdk_x11_device_get_id (device), + gdk_x11_get_xatom_by_name_for_display (display, "Wacom Tool Type"), + 0, 1, False, XA_ATOM, &type, &format, &nitems, &bytes_after, + (guchar **) &data); + gdk_x11_display_error_trap_pop_ignored (display); + + if (rc != Success) + return GDK_DEVICE_TOOL_TYPE_UNKNOWN; + + if (type != XA_ATOM || format != 32 || nitems != 1) + { + XFree (data); + return GDK_DEVICE_TOOL_TYPE_UNKNOWN; + } + + device_type = *data; + XFree (data); + + if (device_type == 0) + return GDK_DEVICE_TOOL_TYPE_UNKNOWN; + + gdk_x11_display_error_trap_push (display); + rc = XInternAtoms (GDK_DISPLAY_XDISPLAY (display), + (char **) wacom_type_atoms, + N_WACOM_TYPE_ATOMS, + False, + types); + gdk_x11_display_error_trap_pop_ignored (display); + + if (rc == 0) + return GDK_DEVICE_TOOL_TYPE_UNKNOWN; + + if (device_type == types[WACOM_TYPE_STYLUS]) + tool_type = GDK_DEVICE_TOOL_TYPE_PEN; + else if (device_type == types[WACOM_TYPE_CURSOR]) + tool_type = GDK_DEVICE_TOOL_TYPE_MOUSE; + else if (device_type == types[WACOM_TYPE_ERASER]) + tool_type = GDK_DEVICE_TOOL_TYPE_ERASER; + else if (device_type == types[WACOM_TYPE_TOUCH]) + tool_type = GDK_DEVICE_TOOL_TYPE_UNKNOWN; + + return tool_type; +} + static void handle_property_change (GdkX11DeviceManagerXI2 *device_manager, XIPropertyEvent *ev) @@ -1019,13 +1096,18 @@ handle_property_change (GdkX11DeviceManagerXI2 *device_manager, device_get_tool_serial_and_id (device, &serial_id, &tool_id)) { seat = gdk_device_get_seat (device); - tool = gdk_seat_get_tool (seat, serial_id); + tool = gdk_seat_get_tool (seat, serial_id, tool_id); if (!tool && serial_id > 0) { - tool = gdk_device_tool_new (serial_id, tool_id, - GDK_DEVICE_TOOL_TYPE_UNKNOWN, 0); - gdk_seat_default_add_tool (GDK_SEAT_DEFAULT (seat), tool); + GdkDeviceToolType tool_type; + + tool_type = device_get_tool_type (device); + if (tool_type != GDK_DEVICE_TOOL_TYPE_UNKNOWN) + { + tool = gdk_device_tool_new (serial_id, tool_id, tool_type, 0); + gdk_seat_default_add_tool (GDK_SEAT_DEFAULT (seat), tool); + } } } diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 848e41f68c..ca1237e703 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1600,7 +1600,7 @@ gdk_x11_display_open (const gchar *display_name) if (!gdk_running_in_sandbox ()) { /* if sandboxed, we're likely in a pid namespace and would only confuse the wm with this */ - pid_t pid = getpid (); + long pid = getpid (); XChangeProperty (display_x11->xdisplay, display_x11->leader_window, gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"), diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index 6e72ba890c..57fff0c696 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -1917,7 +1917,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"); + g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout"); } static gboolean diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c index 6a71b55cf3..050695bf9c 100644 --- a/gdk/x11/gdkdrop-x11.c +++ b/gdk/x11/gdkdrop-x11.c @@ -375,14 +375,14 @@ gdk_x11_drop_read_actions (GdkDrop *drop) if (GDK_DISPLAY_DEBUG_CHECK (display, DND)) { GString *action_str = g_string_new (NULL); - GdkDragAction actions = gdk_drop_get_actions (drop); - if (actions & GDK_ACTION_MOVE) + GdkDragAction drop_actions = gdk_drop_get_actions (drop); + if (drop_actions & GDK_ACTION_MOVE) g_string_append(action_str, "MOVE "); - if (actions & GDK_ACTION_COPY) + if (drop_actions & GDK_ACTION_COPY) g_string_append(action_str, "COPY "); - if (actions & GDK_ACTION_LINK) + if (drop_actions & GDK_ACTION_LINK) g_string_append(action_str, "LINK "); - if (actions & GDK_ACTION_ASK) + if (drop_actions & GDK_ACTION_ASK) g_string_append(action_str, "ASK "); g_message("Xdnd actions = %s", action_str->str); diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c index be54e66e18..4c27ac3472 100644 --- a/gdk/x11/gdkkeys-x11.c +++ b/gdk/x11/gdkkeys-x11.c @@ -29,6 +29,7 @@ #include "gdkkeysyms.h" #include "gdkprivate-x11.h" #include "gdkdisplay-x11.h" +#include "gdk-private.h" #include <stdio.h> #include <stdlib.h> @@ -480,7 +481,7 @@ get_direction (XkbDescRec *xkb, { gint level = 0; KeySym sym = XkbKeySymEntry (xkb, code, level, group); - PangoDirection dir = pango_unichar_direction (gdk_keyval_to_unicode (sym)); + PangoDirection dir = gdk_unichar_direction (gdk_keyval_to_unicode (sym)); switch (dir) { diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 4fe1d36b19..cce0cbb7d8 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -53,8 +53,7 @@ * * The functions in this section are specific to the GDK X11 backend. * To use them, you need to include the `<gdk/gdkx.h>` header and use - * the X11-specific pkg-config files to build your application (either - * `gdk-x11-3.0` or `gtk+-x11-3.0`). + * the X11-specific pkg-config file `gtk4-x11` to build your application. * * To make your code compile with other GDK backends, guard backend-specific * calls by an ifdef as follows. Since GDK may be built with multiple diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index f83df090e8..70a10dbc33 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -676,7 +676,7 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed) for (i = 0; i < x11_display->monitors->len; i++) { - GdkX11Monitor *monitor = x11_display->monitors->pdata[i]; + monitor = x11_display->monitors->pdata[i]; monitor->add = FALSE; monitor->remove = TRUE; } @@ -720,7 +720,7 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed) for (i = x11_display->monitors->len - 1; i >= 0; i--) { - GdkX11Monitor *monitor = x11_display->monitors->pdata[i]; + monitor = x11_display->monitors->pdata[i]; if (monitor->add) { gdk_display_monitor_added (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor)); diff --git a/gdk/x11/gdkselectionoutputstream-x11.c b/gdk/x11/gdkselectionoutputstream-x11.c index 5f35cdf6be..c43e513ab3 100644 --- a/gdk/x11/gdkselectionoutputstream-x11.c +++ b/gdk/x11/gdkselectionoutputstream-x11.c @@ -869,7 +869,6 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, gpointer user_data) { const char *mime_type, *selection, *target, *property; - gsize i; selection = gdk_x11_get_xatom_name_for_display (display, xselection); target = gdk_x11_get_xatom_name_for_display (display, xtarget); @@ -991,6 +990,8 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, } else { + gsize i; + for (i = 0; i < G_N_ELEMENTS (special_targets); i++) { if (g_str_equal (target, special_targets[i].x_target) && diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index 29b6dae9f7..a8a8140b2e 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -746,7 +746,7 @@ setup_toplevel_window (GdkSurface *surface, if (!gdk_running_in_sandbox ()) { /* if sandboxed, we're likely in a pid namespace and would only confuse the wm with this */ - pid_t pid = getpid (); + long pid = getpid (); XChangeProperty (xdisplay, xid, gdk_x11_get_xatom_by_name_for_display (x11_screen->display, "_NET_WM_PID"), XA_CARDINAL, 32, |