From 71fedee85d47cfeed63e3223f44dd5da7c26b35b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 20:50:05 -0400 Subject: [PATCH] wayland: Use the new debug macros --- gdk/wayland/gdkclipboard-wayland.c | 51 ++-- gdk/wayland/gdkdevice-wayland.c | 359 +++++++++++++++-------------- gdk/wayland/gdkdisplay-wayland.c | 96 ++++---- gdk/wayland/gdkdrag-wayland.c | 36 +-- gdk/wayland/gdkdrop-wayland.c | 11 +- gdk/wayland/gdkkeys-wayland.c | 36 +-- gdk/wayland/gdkprimary-wayland.c | 52 +++-- gdk/wayland/gdksurface-wayland.c | 35 ++- 8 files changed, 362 insertions(+), 314 deletions(-) diff --git a/gdk/wayland/gdkclipboard-wayland.c b/gdk/wayland/gdkclipboard-wayland.c index 46d90d9ea4..2cca02e499 100644 --- a/gdk/wayland/gdkclipboard-wayland.c +++ b/gdk/wayland/gdkclipboard-wayland.c @@ -77,7 +77,8 @@ gdk_wayland_clipboard_data_source_target (void *data, struct wl_data_source *source, const char *mime_type) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: Huh? data_source.target() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.target() events?", data); } static void @@ -89,7 +90,8 @@ gdk_wayland_clipboard_write_done (GObject *clipboard, if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error)) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, g_message ("%p: failed to write stream: %s", clipboard, error->message)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, + "%p: failed to write stream: %s", clipboard, error->message); g_error_free (error); } } @@ -103,8 +105,9 @@ gdk_wayland_clipboard_data_source_send (void *data, GdkWaylandClipboard *cb = GDK_WAYLAND_CLIPBOARD (data); GOutputStream *stream; - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: data source send request for %s on fd %d", - source, mime_type, fd)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: data source send request for %s on fd %d", + source, mime_type, fd); mime_type = gdk_intern_mime_type (mime_type); stream = g_unix_output_stream_new (fd, TRUE); @@ -125,7 +128,8 @@ gdk_wayland_clipboard_data_source_cancelled (void *data, { GdkWaylandClipboard *cb = GDK_WAYLAND_CLIPBOARD (data); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: data source cancelled", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: data source cancelled", data); if (cb->source == source) { @@ -138,16 +142,16 @@ static void gdk_wayland_clipboard_data_source_dnd_drop_performed (void *data, struct wl_data_source *source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), - CLIPBOARD, g_message ("%p: Huh? data_source.dnd_drop_performed() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.dnd_drop_performed() events?", data); } static void gdk_wayland_clipboard_data_source_dnd_finished (void *data, struct wl_data_source *source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), - CLIPBOARD, g_message ("%p: Huh? data_source.dnd_finished() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.dnd_finished() events?", data); } static void @@ -155,8 +159,8 @@ gdk_wayland_clipboard_data_source_action (void *data, struct wl_data_source *source, uint32_t action) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), - CLIPBOARD, g_message ("%p: Huh? data_source.action() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.action() events?", data); } static const struct wl_data_source_listener data_source_listener = { @@ -221,9 +225,14 @@ gdk_wayland_clipboard_read_async (GdkClipboard *clipboard, g_task_set_priority (task, io_priority); g_task_set_source_tag (task, gdk_wayland_clipboard_read_async); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: read for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: read for %s", cb, s); + g_free (s); + } +#endif mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats); if (mime_type == NULL) { @@ -305,16 +314,22 @@ gdk_wayland_clipboard_claim_remote (GdkWaylandClipboard *cb, if (cb->source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, g_message ("%p: Ignoring clipboard offer for self", cb)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, + "%p: Ignoring clipboard offer for self", cb); gdk_content_formats_unref (formats); return; } gdk_wayland_clipboard_discard_offer (cb); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: remote clipboard claim for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: remote clipboard claim for %s", cb, s); + g_free (s); + } +#endif cb->offer_formats = formats; cb->offer = offer; diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 1cea5ab1ea..1e7bf8531f 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -83,7 +83,7 @@ #define BTN_STYLUS3 0x149 /* Linux 4.15 */ #endif -#define GDK_SEAT_NOTE(seat,type,action) GDK_DISPLAY_NOTE(gdk_seat_get_display (GDK_SEAT (seat)),type,action) +#define GDK_SEAT_DEBUG(seat,type,...) GDK_DISPLAY_DEBUG(gdk_seat_get_display (GDK_SEAT (seat)),type,__VA_ARGS__) typedef struct _GdkWaylandDevicePad GdkWaylandDevicePad; typedef struct _GdkWaylandDevicePadClass GdkWaylandDevicePadClass; @@ -1104,9 +1104,9 @@ data_offer_offer (void *data, if (seat->pending_offer != offer) { - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("%p: offer for unknown offer %p of %s", - seat, offer, type)); + GDK_SEAT_DEBUG (seat, EVENTS, + "%p: offer for unknown offer %p of %s", + seat, offer, type); return; } @@ -1180,9 +1180,9 @@ data_device_data_offer (void *data, { GdkWaylandSeat *seat = data; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device data offer, data device %p, offer %p", - data_device, offer)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device data offer, data device %p, offer %p", + data_device, offer); gdk_wayland_seat_discard_pending_offer (seat); @@ -1218,15 +1218,15 @@ data_device_enter (void *data, if (offer != seat->pending_offer) { - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("%p: enter event for unknown offer %p, expected %p", - seat, offer, seat->pending_offer)); + GDK_SEAT_DEBUG (seat, EVENTS, + "%p: enter event for unknown offer %p, expected %p", + seat, offer, seat->pending_offer); return; } - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device enter, data device %p serial %u, surface %p, x %f y %f, offer %p", - data_device, serial, surface, wl_fixed_to_double (x), wl_fixed_to_double (y), offer)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device enter, data device %p serial %u, surface %p, x %f y %f, offer %p", + data_device, serial, surface, wl_fixed_to_double (x), wl_fixed_to_double (y), offer); /* Update pointer state, so device state queries work during DnD */ seat->pointer_info.focus = g_object_ref (dest_surface); @@ -1270,8 +1270,8 @@ data_device_leave (void *data, { GdkWaylandSeat *seat = data; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device leave, data device %p", data_device)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device leave, data device %p", data_device); if (seat->drop == NULL) return; @@ -1296,9 +1296,9 @@ data_device_motion (void *data, GdkWaylandSeat *seat = data; int origin_x, origin_y; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device motion, data_device = %p, time = %d, x = %f, y = %f", - data_device, time, wl_fixed_to_double (x), wl_fixed_to_double (y))); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device motion, data_device = %p, time = %d, x = %f, y = %f", + data_device, time, wl_fixed_to_double (x), wl_fixed_to_double (y)); if (seat->drop == NULL) return; @@ -1323,8 +1323,8 @@ data_device_drop (void *data, GdkWaylandSeat *seat = data; int origin_x, origin_y; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device drop, data device %p", data_device)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device drop, data device %p", data_device); gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y); @@ -1561,9 +1561,9 @@ pointer_handle_enter (void *data, gdk_wayland_device_update_surface_cursor (seat->logical_pointer); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("enter, seat %p surface %p", - seat, seat->pointer_info.focus)); + GDK_SEAT_DEBUG (seat, EVENTS, + "enter, seat %p surface %p", + seat, seat->pointer_info.focus); if (display_wayland->seat_version < WL_POINTER_HAS_FRAME) gdk_wayland_seat_flush_frame_event (seat); @@ -1612,9 +1612,9 @@ pointer_handle_leave (void *data, gdk_wayland_device_update_surface_cursor (seat->logical_pointer); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("leave, seat %p surface %p", - seat, seat->pointer_info.focus)); + GDK_SEAT_DEBUG (seat, EVENTS, + "leave, seat %p surface %p", + seat, seat->pointer_info.focus); g_object_unref (seat->pointer_info.focus); seat->pointer_info.focus = NULL; @@ -1722,12 +1722,12 @@ pointer_handle_button (void *data, else seat->pointer_info.button_modifiers &= ~modifier; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("button %d %s, seat %p state %d", - gdk_button_event_get_button (event), - state ? "press" : "release", - seat, - gdk_event_get_modifier_state (event))); + GDK_SEAT_DEBUG (seat, EVENTS, + "button %d %s, seat %p state %d", + gdk_button_event_get_button (event), + state ? "press" : "release", + seat, + gdk_event_get_modifier_state (event)); if (display->seat_version < WL_POINTER_HAS_FRAME) gdk_wayland_seat_flush_frame_event (seat); @@ -1780,10 +1780,10 @@ pointer_handle_axis (void *data, seat->pointer_info.time = time; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("scroll, axis %s, value %f, seat %p", - get_axis_name (axis), wl_fixed_to_double (value), - seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "scroll, axis %s, value %f, seat %p", + get_axis_name (axis), wl_fixed_to_double (value), + seat); if (display->seat_version < WL_POINTER_HAS_FRAME) gdk_wayland_seat_flush_frame_event (seat); @@ -1795,8 +1795,7 @@ pointer_handle_frame (void *data, { GdkWaylandSeat *seat = data; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("frame, seat %p", seat)); + GDK_SEAT_DEBUG (seat, EVENTS, "frame, seat %p", seat); gdk_wayland_seat_flush_frame_event (seat); } @@ -1836,8 +1835,8 @@ pointer_handle_axis_source (void *data, pointer_frame->source = source; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("axis source %s, seat %p", get_axis_source_name (source), seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "axis source %s, seat %p", get_axis_source_name (source), seat); } static void @@ -1868,8 +1867,8 @@ pointer_handle_axis_stop (void *data, pointer_frame->is_scroll_stop = TRUE; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("axis %s stop, seat %p", get_axis_name (axis), seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "axis %s stop, seat %p", get_axis_name (axis), seat); } static void @@ -1896,9 +1895,9 @@ pointer_handle_axis_discrete (void *data, g_return_if_reached (); } - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("discrete scroll, axis %s, value %d, seat %p", - get_axis_name (axis), value, seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "discrete scroll, axis %s, value %d, seat %p", + get_axis_name (axis), value, seat); } static void @@ -1925,9 +1924,9 @@ pointer_handle_axis_value120 (void *data, g_return_if_reached (); } - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("value120 scroll, axis %s, value %d, seat %p", - get_axis_name (axis), value, seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "value120 scroll, axis %s, value %d, seat %p", + get_axis_name (axis), value, seat); } static int @@ -1984,7 +1983,8 @@ keyboard_handle_keymap (void *data, _gdk_wayland_keymap_update_from_fd (seat->keymap, format, fd, size); - GDK_DISPLAY_NOTE(seat->keymap->display, INPUT, +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (seat->keymap->display, INPUT)) { GString *s = g_string_new (""); struct xkb_keymap *xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (seat->keymap); @@ -1997,9 +1997,10 @@ keyboard_handle_keymap (void *data, g_string_append (s, "*"); g_string_append (s, xkb_keymap_layout_get_name (xkb_keymap, i)); } - g_print ("layouts: %s\n", s->str); + gdk_debug_message ("layouts: %s", s->str); g_string_free (s, TRUE); - }); + } +#endif g_signal_emit_by_name (seat->keymap, "keys-changed"); g_signal_emit_by_name (seat->keymap, "state-changed"); @@ -2044,9 +2045,9 @@ keyboard_handle_enter (void *data, seat->logical_keyboard, TRUE); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("focus in, seat %p surface %p", - seat, seat->keyboard_focus)); + GDK_SEAT_DEBUG (seat, EVENTS, + "focus in, seat %p surface %p", + seat, seat->keyboard_focus); _gdk_wayland_display_deliver_event (seat->display, event); } @@ -2080,9 +2081,9 @@ keyboard_handle_leave (void *data, seat->repeat_key = 0; seat->key_modifiers = 0; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("focus out, seat %p surface %p", - seat, gdk_event_get_surface (event))); + GDK_SEAT_DEBUG (seat, EVENTS, + "focus out, seat %p surface %p", + seat, gdk_event_get_surface (event)); _gdk_wayland_display_deliver_event (seat->display, event); } @@ -2208,18 +2209,18 @@ deliver_key_event (GdkWaylandSeat *seat, _gdk_wayland_display_deliver_event (seat->display, event); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("keyboard %s event%s, surface %p, code %d, sym %d, " - "mods 0x%x, consumed 0x%x, layout %d level %d", - (state ? "press" : "release"), - (from_key_repeat ? " (repeat)" : ""), - gdk_event_get_surface (event), - gdk_key_event_get_keycode (event), - gdk_key_event_get_keyval (event), - gdk_event_get_modifier_state (event), - gdk_key_event_get_consumed_modifiers (event), - gdk_key_event_get_layout (event), - gdk_key_event_get_level (event))); + GDK_SEAT_DEBUG (seat, EVENTS, + "keyboard %s event%s, surface %p, code %d, sym %d, " + "mods 0x%x, consumed 0x%x, layout %d level %d", + (state ? "press" : "release"), + (from_key_repeat ? " (repeat)" : ""), + gdk_event_get_surface (event), + gdk_key_event_get_keycode (event), + gdk_key_event_get_keyval (event), + gdk_event_get_modifier_state (event), + gdk_key_event_get_consumed_modifiers (event), + gdk_key_event_get_layout (event), + gdk_key_event_get_level (event)); if (!xkb_keymap_key_repeats (xkb_keymap, key)) return; @@ -2373,7 +2374,7 @@ keyboard_handle_modifiers (void *data, g_signal_emit_by_name (keymap, "state-changed"); if (layout != get_active_layout (keymap)) { - GDK_DISPLAY_NOTE(keymap->display, INPUT, g_print ("active layout now: %s\n", get_active_layout_name (keymap))); + GDK_DISPLAY_DEBUG (keymap->display, INPUT, "active layout now: %s", get_active_layout_name (keymap)); g_signal_emit_by_name (keymap, "keys-changed"); } @@ -2663,7 +2664,7 @@ touch_handle_cancel (void *data, g_hash_table_iter_remove (&iter); } - GDK_SEAT_NOTE (seat, EVENTS, g_message ("touch cancel")); + GDK_SEAT_DEBUG (seat, EVENTS, "touch cancel"); } static void @@ -3179,11 +3180,11 @@ seat_handle_capabilities (void *data, GdkWaylandSeat *seat = data; GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display); - GDK_SEAT_NOTE (seat, MISC, - g_message ("seat %p with %s%s%s", wl_seat, - (caps & WL_SEAT_CAPABILITY_POINTER) ? " pointer, " : "", - (caps & WL_SEAT_CAPABILITY_KEYBOARD) ? " keyboard, " : "", - (caps & WL_SEAT_CAPABILITY_TOUCH) ? " touch" : "")); + GDK_SEAT_DEBUG (seat, MISC, + "seat %p with %s%s%s", wl_seat, + (caps & WL_SEAT_CAPABILITY_POINTER) ? " pointer, " : "", + (caps & WL_SEAT_CAPABILITY_KEYBOARD) ? " keyboard, " : "", + (caps & WL_SEAT_CAPABILITY_TOUCH) ? " touch" : ""); if ((caps & WL_SEAT_CAPABILITY_POINTER) && !seat->wl_pointer) { @@ -3401,8 +3402,8 @@ seat_handle_name (void *data, const char *name) { /* We don't care about the name. */ - GDK_SEAT_NOTE (GDK_WAYLAND_SEAT (data), MISC, - g_message ("seat %p name %s", seat, name)); + GDK_SEAT_DEBUG (GDK_WAYLAND_SEAT (data), MISC, + "seat %p name %s", seat, name); } static const struct wl_seat_listener seat_listener = { @@ -3683,10 +3684,10 @@ tablet_tool_handle_proximity_in (void *data, gdk_wayland_surface_get_wl_output (surface)); pointer_surface_update_scale (tablet->logical_device); - GDK_SEAT_NOTE (tablet->seat, EVENTS, - g_message ("proximity in, seat %p surface %p tool %d", - tablet->seat, tablet->pointer_info.focus, - gdk_device_tool_get_tool_type (tool->tool))); + GDK_SEAT_DEBUG (tablet->seat, EVENTS, + "proximity in, seat %p surface %p tool %d", + tablet->seat, tablet->pointer_info.focus, + gdk_device_tool_get_tool_type (tool->tool)); } static void @@ -3700,9 +3701,9 @@ tablet_tool_handle_proximity_out (void *data, if (!tablet) return; - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("proximity out, seat %p, tool %d", tool->seat, - gdk_device_tool_get_tool_type (tool->tool))); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "proximity out, seat %p, tool %d", tool->seat, + gdk_device_tool_get_tool_type (tool->tool)); event = gdk_proximity_event_new (GDK_PROXIMITY_OUT, tablet->pointer_info.focus, @@ -3802,10 +3803,10 @@ tablet_tool_handle_motion (void *data, tablet->pointer_info.surface_x = wl_fixed_to_double (sx); tablet->pointer_info.surface_y = wl_fixed_to_double (sy); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet motion %f %f", - tablet->pointer_info.surface_x, - tablet->pointer_info.surface_y)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet motion %f %f", + tablet->pointer_info.surface_x, + tablet->pointer_info.surface_y); event = gdk_motion_event_new (tablet->pointer_info.focus, tablet->logical_device, @@ -3836,9 +3837,9 @@ tablet_tool_handle_pressure (void *data, _gdk_device_translate_axis (tablet->stylus_device, axis_index, pressure, &tablet->axes[GDK_AXIS_PRESSURE]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d pressure %d", - gdk_device_tool_get_tool_type (tool->tool), pressure)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d pressure %d", + gdk_device_tool_get_tool_type (tool->tool), pressure); } static void @@ -3858,9 +3859,9 @@ tablet_tool_handle_distance (void *data, _gdk_device_translate_axis (tablet->stylus_device, axis_index, distance, &tablet->axes[GDK_AXIS_DISTANCE]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d distance %d", - gdk_device_tool_get_tool_type (tool->tool), distance)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d distance %d", + gdk_device_tool_get_tool_type (tool->tool), distance); } static void @@ -3887,10 +3888,10 @@ tablet_tool_handle_tilt (void *data, wl_fixed_to_double (ytilt), &tablet->axes[GDK_AXIS_YTILT]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d tilt %f/%f", - gdk_device_tool_get_tool_type (tool->tool), - wl_fixed_to_double (xtilt), wl_fixed_to_double (ytilt))); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d tilt %f/%f", + gdk_device_tool_get_tool_type (tool->tool), + wl_fixed_to_double (xtilt), wl_fixed_to_double (ytilt)); } static void @@ -3947,10 +3948,10 @@ tablet_tool_handle_rotation (void *data, wl_fixed_to_double (degrees), &tablet->axes[GDK_AXIS_ROTATION]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d rotation %f", - gdk_device_tool_get_tool_type (tool->tool), - wl_fixed_to_double (degrees))); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d rotation %f", + gdk_device_tool_get_tool_type (tool->tool), + wl_fixed_to_double (degrees)); } static void @@ -3970,9 +3971,9 @@ tablet_tool_handle_slider (void *data, _gdk_device_translate_axis (tablet->stylus_device, axis_index, position, &tablet->axes[GDK_AXIS_SLIDER]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d slider %d", - gdk_device_tool_get_tool_type (tool->tool), position)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d slider %d", + gdk_device_tool_get_tool_type (tool->tool), position); } static void @@ -3991,9 +3992,9 @@ tablet_tool_handle_wheel (void *data, seat = GDK_WAYLAND_SEAT (tablet->seat); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet tool %d wheel %d/%d", - gdk_device_tool_get_tool_type (tool->tool), degrees, clicks)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet tool %d wheel %d/%d", + gdk_device_tool_get_tool_type (tool->tool), degrees, clicks); if (clicks == 0) return; @@ -4023,8 +4024,8 @@ tablet_tool_handle_frame (void *data, if (!tablet) return; - GDK_SEAT_NOTE (tablet->seat, EVENTS, - g_message ("tablet frame, time %d", time)); + GDK_SEAT_DEBUG (tablet->seat, EVENTS, + "tablet frame, time %d", time); frame_event = tablet->pointer_info.frame.event; @@ -4067,9 +4068,9 @@ tablet_pad_ring_handle_source (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad ring handle source, ring = %p source = %d", - wp_tablet_pad_ring, source)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad ring handle source, ring = %p source = %d", + wp_tablet_pad_ring, source); group->axis_tmp_info.source = source; } @@ -4081,9 +4082,9 @@ tablet_pad_ring_handle_angle (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad ring handle angle, ring = %p angle = %f", - wp_tablet_pad_ring, wl_fixed_to_double (angle))); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad ring handle angle, ring = %p angle = %f", + wp_tablet_pad_ring, wl_fixed_to_double (angle)); group->axis_tmp_info.value = wl_fixed_to_double (angle); } @@ -4094,8 +4095,8 @@ tablet_pad_ring_handle_stop (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad ring handle stop, ring = %p", wp_tablet_pad_ring)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad ring handle stop, ring = %p", wp_tablet_pad_ring); group->axis_tmp_info.is_stop = TRUE; } @@ -4110,8 +4111,8 @@ tablet_pad_ring_handle_frame (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat); GdkEvent *event; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring); event = gdk_pad_event_new_ring (seat->keyboard_focus, pad->device, @@ -4139,9 +4140,9 @@ tablet_pad_strip_handle_source (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad strip handle source, strip = %p source = %d", - wp_tablet_pad_strip, source)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad strip handle source, strip = %p source = %d", + wp_tablet_pad_strip, source); group->axis_tmp_info.source = source; } @@ -4153,9 +4154,9 @@ tablet_pad_strip_handle_position (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad strip handle position, strip = %p position = %d", - wp_tablet_pad_strip, position)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad strip handle position, strip = %p position = %d", + wp_tablet_pad_strip, position); group->axis_tmp_info.value = (double) position / 65535; } @@ -4166,9 +4167,9 @@ tablet_pad_strip_handle_stop (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad strip handle stop, strip = %p", - wp_tablet_pad_strip)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad strip handle stop, strip = %p", + wp_tablet_pad_strip); group->axis_tmp_info.is_stop = TRUE; } @@ -4183,9 +4184,9 @@ tablet_pad_strip_handle_frame (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat); GdkEvent *event; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet pad strip handle frame, strip = %p", - wp_tablet_pad_strip)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet pad strip handle frame, strip = %p", + wp_tablet_pad_strip); event = gdk_pad_event_new_strip (seat->keyboard_focus, pad->device, @@ -4214,9 +4215,9 @@ tablet_pad_group_handle_buttons (void *data, GdkWaylandTabletPadGroupData *group = data; uint32_t *p; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle buttons, pad group = %p, n_buttons = %" G_GSIZE_FORMAT, - wp_tablet_pad_group, buttons->size)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle buttons, pad group = %p, n_buttons = %" G_GSIZE_FORMAT, + wp_tablet_pad_group, buttons->size); wl_array_for_each (p, buttons) { @@ -4233,9 +4234,9 @@ tablet_pad_group_handle_ring (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle ring, pad group = %p, ring = %p", - wp_tablet_pad_group, wp_tablet_pad_ring)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle ring, pad group = %p, ring = %p", + wp_tablet_pad_group, wp_tablet_pad_ring); zwp_tablet_pad_ring_v2_add_listener (wp_tablet_pad_ring, &tablet_pad_ring_listener, group); @@ -4252,9 +4253,9 @@ tablet_pad_group_handle_strip (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle strip, pad group = %p, strip = %p", - wp_tablet_pad_group, wp_tablet_pad_strip)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle strip, pad group = %p, strip = %p", + wp_tablet_pad_group, wp_tablet_pad_strip); zwp_tablet_pad_strip_v2_add_listener (wp_tablet_pad_strip, &tablet_pad_strip_listener, group); @@ -4271,9 +4272,9 @@ tablet_pad_group_handle_modes (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle modes, pad group = %p, n_modes = %d", - wp_tablet_pad_group, modes)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle modes, pad group = %p, n_modes = %d", + wp_tablet_pad_group, modes); group->n_modes = modes; } @@ -4286,9 +4287,9 @@ tablet_pad_group_handle_done (void *data, GdkWaylandTabletPadGroupData *group = data; #endif - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle done, pad group = %p", - wp_tablet_pad_group)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle done, pad group = %p", + wp_tablet_pad_group); } static void @@ -4304,9 +4305,9 @@ tablet_pad_group_handle_mode (void *data, GdkEvent *event; guint n_group; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet pad group handle mode, pad group = %p, mode = %d", - wp_tablet_pad_group, mode)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet pad group handle mode, pad group = %p, mode = %d", + wp_tablet_pad_group, mode); group->mode_switch_serial = serial; group->current_mode = mode; @@ -4339,9 +4340,9 @@ tablet_pad_handle_group (void *data, GdkWaylandTabletPadData *pad = data; GdkWaylandTabletPadGroupData *group; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle group, pad group = %p, group = %p", - wp_tablet_pad_group, wp_tablet_pad_group)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle group, pad group = %p, group = %p", + wp_tablet_pad_group, wp_tablet_pad_group); group = g_new0 (GdkWaylandTabletPadGroupData, 1); group->wp_tablet_pad_group = wp_tablet_pad_group; @@ -4360,9 +4361,9 @@ tablet_pad_handle_path (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle path, pad = %p, path = %s", - wp_tablet_pad, path)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle path, pad = %p, path = %s", + wp_tablet_pad, path); pad->path = g_strdup (path); } @@ -4374,9 +4375,9 @@ tablet_pad_handle_buttons (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle buttons, pad = %p, n_buttons = %d", - wp_tablet_pad, buttons)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle buttons, pad = %p, n_buttons = %d", + wp_tablet_pad, buttons); pad->n_buttons = buttons; } @@ -4387,8 +4388,8 @@ tablet_pad_handle_done (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle done, pad = %p", wp_tablet_pad)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle done, pad = %p", wp_tablet_pad); pad->device = g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD, @@ -4414,9 +4415,9 @@ tablet_pad_handle_button (void *data, GdkEvent *event; int n_group; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle button, pad = %p, button = %d, state = %d", - wp_tablet_pad, button, state)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle button, pad = %p, button = %d, state = %d", + wp_tablet_pad, button, state); group = tablet_pad_lookup_button_group (pad, button); @@ -4452,9 +4453,9 @@ tablet_pad_handle_enter (void *data, GdkWaylandTabletPadData *pad = data; GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet); - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle enter, pad = %p, tablet = %p surface = %p", - wp_tablet_pad, wp_tablet, surface)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle enter, pad = %p, tablet = %p surface = %p", + wp_tablet_pad, wp_tablet, surface); /* Relate pad and tablet */ tablet->pads = g_list_prepend (tablet->pads, pad); @@ -4469,9 +4470,9 @@ tablet_pad_handle_leave (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle leave, pad = %p, surface = %p", - wp_tablet_pad, surface)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle leave, pad = %p, surface = %p", + wp_tablet_pad, surface); if (pad->current_tablet) { @@ -4486,8 +4487,8 @@ tablet_pad_handle_removed (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle removed, pad = %p", wp_tablet_pad)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle removed, pad = %p", wp_tablet_pad); /* Remove from the current tablet */ if (pad->current_tablet) @@ -4659,9 +4660,9 @@ pointer_surface_enter (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); GdkWaylandTabletData *tablet; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("pointer surface of seat %p entered output %p", - seat, output)); + GDK_SEAT_DEBUG (seat, EVENTS, + "pointer surface of seat %p entered output %p", + seat, output); tablet = gdk_wayland_seat_find_tablet (seat, device); @@ -4688,9 +4689,9 @@ pointer_surface_leave (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); GdkWaylandTabletData *tablet; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("pointer surface of seat %p left output %p", - seat, output)); + GDK_SEAT_DEBUG (seat, EVENTS, + "pointer surface of seat %p left output %p", + seat, output); tablet = gdk_wayland_seat_find_tablet (seat, device); diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 89982d76a5..ab185ad49a 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -130,8 +130,7 @@ xdg_wm_base_ping (void *data, struct xdg_wm_base *xdg_wm_base, uint32_t serial) { - GDK_NOTE (EVENTS, - g_message ("ping, shell %p, serial %u\n", xdg_wm_base, serial)); + GDK_DEBUG (EVENTS, "ping, shell %p, serial %u", xdg_wm_base, serial); xdg_wm_base_pong (xdg_wm_base, serial); } @@ -145,8 +144,8 @@ zxdg_shell_v6_ping (void *data, struct zxdg_shell_v6 *xdg_shell, uint32_t serial) { - GDK_DISPLAY_NOTE (GDK_DISPLAY (data), EVENTS, - g_message ("ping, shell %p, serial %u\n", xdg_shell, serial)); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), EVENTS, + "ping, shell %p, serial %u", xdg_shell, serial); zxdg_shell_v6_pong (xdg_shell, serial); } @@ -286,10 +285,12 @@ wl_shm_format (void *data, struct wl_shm *wl_shm, uint32_t format) { - GDK_NOTE (MISC, - char buf[10]; - g_message ("supported pixel format %s (0x%X)", get_format_name (format, buf), (guint) format); - ); +#ifdef G_ENABLE_DEBUG + char buf[10]; +#endif + + GDK_DEBUG (MISC, "supported pixel format %s (0x%X)", + get_format_name (format, buf), (guint) format); } static const struct wl_shm_listener wl_shm_listener = { @@ -302,13 +303,15 @@ server_decoration_manager_default_mode (void uint32_t mode) { g_assert (mode <= ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER); +#ifdef G_ENABLE_DEBUG const char *modes[] = { [ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE] = "none", [ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT] = "client", [ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER] = "server", }; +#endif GdkWaylandDisplay *display_wayland = data; - g_debug ("Compositor prefers decoration mode '%s'", modes[mode]); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), MISC, "Compositor prefers decoration mode '%s'", modes[mode]); display_wayland->server_decoration_mode = mode; } @@ -356,8 +359,7 @@ gdk_registry_handle_global (void *data, GdkWaylandDisplay *display_wayland = data; struct wl_output *output; - GDK_NOTE (MISC, - g_message ("add global %u, interface %s, version %u", id, interface, version)); + GDK_DEBUG (MISC, "add global %u, interface %s, version %u", id, interface, version); if (strcmp (interface, "wl_compositor") == 0) { @@ -511,7 +513,8 @@ gdk_registry_handle_global_remove (void *data, { GdkWaylandDisplay *display_wayland = data; - GDK_NOTE (MISC, g_message ("remove global %u", id)); + GDK_DEBUG (MISC, "remove global %u", id); + _gdk_wayland_display_remove_seat (display_wayland, id); gdk_wayland_display_remove_output (display_wayland, id); @@ -563,7 +566,7 @@ _gdk_wayland_display_open (const char *display_name) GdkDisplay *display; GdkWaylandDisplay *display_wayland; - GDK_NOTE (MISC, g_message ("opening display %s", display_name ? display_name : "")); + GDK_DEBUG (MISC, "opening display %s", display_name ? display_name : ""); /* If this variable is unset then wayland initialisation will surely * fail, logging a fatal error in the process. Save ourselves from @@ -2251,9 +2254,8 @@ gdk_wayland_display_init_xdg_output (GdkWaylandDisplay *self) { guint i, n; - GDK_NOTE (MISC, - g_message ("init xdg-output support, %d monitor(s) already present", - g_list_model_get_n_items (G_LIST_MODEL (self->monitors)))); + GDK_DEBUG (MISC, "init xdg-output support, %d monitor(s) already present", + g_list_model_get_n_items (G_LIST_MODEL (self->monitors))); n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors)); for (i = 0; i < n; i++) @@ -2296,11 +2298,10 @@ should_expect_xdg_output_done (GdkWaylandMonitor *monitor) static void apply_monitor_change (GdkWaylandMonitor *monitor) { - GDK_NOTE (MISC, - g_message ("monitor %d changed position %d %d, size %d %d", - monitor->id, - monitor->x, monitor->y, - monitor->width, monitor->height)); + GDK_DEBUG (MISC, "monitor %d changed position %d %d, size %d %d", + monitor->id, + monitor->x, monitor->y, + monitor->width, monitor->height); gdk_monitor_set_geometry (GDK_MONITOR (monitor), &(GdkRectangle) { @@ -2321,9 +2322,9 @@ xdg_output_handle_logical_position (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle logical position xdg-output %d, position %d %d", - monitor->id, x, y)); + GDK_DEBUG (MISC, "handle logical position xdg-output %d, position %d %d", + monitor->id, x, y); + monitor->x = x; monitor->y = y; } @@ -2336,9 +2337,9 @@ xdg_output_handle_logical_size (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle logical size xdg-output %d, size %d %d", - monitor->id, width, height)); + GDK_DEBUG (MISC, "handle logical size xdg-output %d, size %d %d", + monitor->id, width, height); + monitor->width = width; monitor->height = height; } @@ -2349,8 +2350,7 @@ xdg_output_handle_done (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle done xdg-output %d", monitor->id)); + GDK_DEBUG (MISC, "handle done xdg-output %d", monitor->id); monitor->xdg_output_done = TRUE; if (monitor->wl_output_done && should_expect_xdg_output_done (monitor)) @@ -2364,8 +2364,7 @@ xdg_output_handle_name (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle name xdg-output %d", monitor->id)); + GDK_DEBUG (MISC, "handle name xdg-output %d", monitor->id); monitor->name = g_strdup (name); } @@ -2375,11 +2374,8 @@ xdg_output_handle_description (void *data, struct zxdg_output_v1 *xdg_output, const char *description) { - GDK_NOTE (MISC, - { - GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - g_message ("handle description xdg-output %d", monitor->id); - }); + GDK_DEBUG (MISC, "handle description xdg-output %d", + ((GdkWaylandMonitor *)data)->id); } static const struct zxdg_output_v1_listener xdg_output_listener = { @@ -2396,8 +2392,7 @@ gdk_wayland_display_get_xdg_output (GdkWaylandMonitor *monitor) GdkDisplay *display = GDK_MONITOR (monitor)->display; GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); - GDK_NOTE (MISC, - g_message ("get xdg-output for monitor %d", monitor->id)); + GDK_DEBUG (MISC, "get xdg-output for monitor %d", monitor->id); monitor->xdg_output = zxdg_output_manager_v1_get_xdg_output (display_wayland->xdg_output_manager, @@ -2422,9 +2417,12 @@ output_handle_geometry (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; - GDK_NOTE (MISC, - g_message ("handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s, manufacturer %s, model %s, transform %s", - monitor->id, x, y, physical_width, physical_height, subpixel_to_string (subpixel), make, model, transform_to_string (transform))); + GDK_DEBUG (MISC, "handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s, manufacturer %s, model %s, transform %s", + monitor->id, x, y, + physical_width, physical_height, + subpixel_to_string (subpixel), + make, model, + transform_to_string (transform)); monitor->x = x; monitor->y = y; @@ -2457,8 +2455,7 @@ output_handle_done (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; - GDK_NOTE (MISC, - g_message ("handle done output %d", monitor->id)); + GDK_DEBUG (MISC, "handle done output %d", monitor->id); monitor->wl_output_done = TRUE; @@ -2477,8 +2474,7 @@ output_handle_scale (void *data, int width; int height; - GDK_NOTE (MISC, - g_message ("handle scale output %d, scale %d", monitor->id, scale)); + GDK_DEBUG (MISC, "handle scale output %d, scale %d", monitor->id, scale); gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry); previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor)); @@ -2510,9 +2506,8 @@ output_handle_mode (void *data, GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; int scale; - GDK_NOTE (MISC, - g_message ("handle mode output %d, size %d %d, rate %d", - monitor->id, width, height, refresh)); + GDK_DEBUG (MISC, "handle mode output %d, size %d %d, rate %d", + monitor->id, width, height, refresh); if ((flags & WL_OUTPUT_MODE_CURRENT) == 0) return; @@ -2552,9 +2547,8 @@ gdk_wayland_display_add_output (GdkWaylandDisplay *display_wayland, wl_output_add_listener (output, &output_listener, monitor); - GDK_NOTE (MISC, - g_message ("xdg_output_manager %p", - display_wayland->xdg_output_manager)); + GDK_DEBUG (MISC, "xdg_output_manager %p", + display_wayland->xdg_output_manager); if (display_has_xdg_output_support (display_wayland)) gdk_wayland_display_get_xdg_output (monitor); diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c index b8566572d0..b00769e907 100644 --- a/gdk/wayland/gdkdrag-wayland.c +++ b/gdk/wayland/gdkdrag-wayland.c @@ -217,9 +217,8 @@ data_source_target (void *data, struct wl_data_source *source, const char *mime_type) { - GDK_NOTE (EVENTS, - g_message ("data source target, source = %p, mime_type = %s", - source, mime_type)); + GDK_DEBUG (EVENTS, "data source target, source = %p, mime_type = %s", + source, mime_type); } static void @@ -231,7 +230,9 @@ gdk_wayland_drag_write_done (GObject *drag, if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error)) { - GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_message ("%p: failed to write stream: %s", drag, error->message)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (GDK_DRAG (drag)), DND, + "%p: failed to write stream: %s", drag, error->message); + g_error_free (error); } } @@ -245,8 +246,9 @@ data_source_send (void *data, GdkDrag *drag = data; GOutputStream *stream; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND, g_message ("%p: data source send request for %s on fd %d\n", - source, mime_type, fd)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), DND, + "%p: data source send request for %s on fd %d\n", + source, mime_type, fd); //mime_type = gdk_intern_mime_type (mime_type); mime_type = g_intern_string (mime_type); @@ -268,8 +270,8 @@ data_source_cancelled (void *data, { GdkDrag *drag = data; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS, - g_message ("data source cancelled, source = %p", source)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), EVENTS, + "data source cancelled, source = %p", source); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR); } @@ -302,9 +304,9 @@ data_source_action (void *data, { GdkDrag *drag = data; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS, - g_message ("data source action, source = %p action=%x", - source, action)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), EVENTS, + "data source action, source = %p action=%x", + source, action); gdk_drag_set_selected_action (drag, _wl_to_gdk_actions (action)); } @@ -338,10 +340,14 @@ gdk_wayland_drag_create_data_source (GdkDrag *drag) mimetypes = gdk_content_formats_get_mime_types (formats, &n_mimetypes); - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS, - {char *s = g_strjoinv (" ", (char **)mimetypes); - g_message ("create data source, mime types=%s", s); - g_free (s);}); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_drag_get_display (drag), EVENTS)) + { + char *s = g_strjoinv (" ", (char **)mimetypes); + gdk_debug_message ("create data source, mime types=%s", s); + g_free (s); + } +#endif wl_data_source_offer (drag_wayland->data_source, GDK_WAYLAND_LOCAL_DND_MIME_TYPE); for (i = 0; i < n_mimetypes; i++) diff --git a/gdk/wayland/gdkdrop-wayland.c b/gdk/wayland/gdkdrop-wayland.c index 8234096adb..c1391ba080 100644 --- a/gdk/wayland/gdkdrop-wayland.c +++ b/gdk/wayland/gdkdrop-wayland.c @@ -192,9 +192,14 @@ gdk_wayland_drop_read_async (GdkDrop *drop, g_task_set_priority (task, io_priority); g_task_set_source_tag (task, gdk_wayland_drop_read_async); - GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: read for %s", drop, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_drop_get_display (drop), DND)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: read for %s", drop, s); + g_free (s); + } +#endif mime_type = gdk_content_formats_match_mime_type (formats, gdk_drop_get_formats (drop)); if (mime_type == NULL) diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c index 35ac9e8262..7107fbe192 100644 --- a/gdk/wayland/gdkkeys-wayland.c +++ b/gdk/wayland/gdkkeys-wayland.c @@ -489,25 +489,32 @@ _gdk_wayland_keymap_new (GdkDisplay *display) return GDK_KEYMAP (keymap); } -#ifdef G_ENABLE_DEBUG static void -print_modifiers (struct xkb_keymap *keymap) +print_modifiers (GdkDisplay *display, + struct xkb_keymap *keymap) { +#ifdef G_ENABLE_DEBUG int i, j; uint32_t real; struct xkb_state *state; + GString *str; + + if (!GDK_DISPLAY_DEBUG_CHECK (display, INPUT)) + return; + + str = g_string_new (""); - g_print ("modifiers:\n"); + g_string_append (str, "modifiers:\n"); for (i = 0; i < xkb_keymap_num_mods (keymap); i++) - g_print ("%s ", xkb_keymap_mod_get_name (keymap, i)); - g_print ("\n\n"); + g_string_append_printf (str, "%s ", xkb_keymap_mod_get_name (keymap, i)); + g_string_append (str, "\n\n"); - g_print ("modifier mapping\n"); + g_string_append (str, "modifier mapping\n"); state = xkb_state_new (keymap); for (i = 0; i < 8; i++) { gboolean need_arrow = TRUE; - g_print ("%s ", xkb_keymap_mod_get_name (keymap, i)); + g_string_append_printf (str, "%s ", xkb_keymap_mod_get_name (keymap, i)); for (j = 8; j < xkb_keymap_num_mods (keymap); j++) { xkb_state_update_mask (state, 1 << j, 0, 0, 0, 0, 0); @@ -516,18 +523,21 @@ print_modifiers (struct xkb_keymap *keymap) { if (need_arrow) { - g_print ("-> "); + g_string_append (str, "-> "); need_arrow = FALSE; } - g_print ("%s ", xkb_keymap_mod_get_name (keymap, j)); + g_string_append_printf (str, "%s ", xkb_keymap_mod_get_name (keymap, j)); } } - g_print ("\n"); } + gdk_debug_message ("%s", str->str); + + g_string_free (str, TRUE); + xkb_state_unref (state); -} #endif +} void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, @@ -549,7 +559,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, return; } - GDK_DISPLAY_NOTE (keymap->display, INPUT, g_message ("keymap:\n%s", map_str)); + GDK_DISPLAY_DEBUG (keymap->display, INPUT, "keymap:\n%s", map_str); xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0); munmap (map_str, size); @@ -562,7 +572,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, return; } - GDK_DISPLAY_NOTE (keymap->display, INPUT, print_modifiers (xkb_keymap)); + print_modifiers (keymap->display, xkb_keymap); xkb_keymap_unref (keymap_wayland->xkb_keymap); keymap_wayland->xkb_keymap = xkb_keymap; diff --git a/gdk/wayland/gdkprimary-wayland.c b/gdk/wayland/gdkprimary-wayland.c index 7aa702bef8..f21dd2cc0e 100644 --- a/gdk/wayland/gdkprimary-wayland.c +++ b/gdk/wayland/gdkprimary-wayland.c @@ -99,7 +99,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb, if (cb->source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, g_message ("%p: Ignoring clipboard offer for self", cb)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, "%p: Ignoring clipboard offer for self", cb); gdk_content_formats_unref (formats); g_clear_pointer (&offer, zwp_primary_selection_offer_v1_destroy); return; @@ -107,9 +107,15 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb, gdk_wayland_primary_discard_offer (cb); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: remote clipboard claim for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: remote clipboard claim for %s", cb, s); + g_free (s); + } +#endif + cb->offer_formats = formats; cb->offer = offer; @@ -126,8 +132,9 @@ primary_offer_offer (void *data, if (cb->pending != offer) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_message ("%p: offer for unknown selection %p of %s", - cb, offer, type)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, + "%p: offer for unknown selection %p of %s", + cb, offer, type); return; } @@ -145,8 +152,9 @@ primary_selection_data_offer (void *data, { GdkWaylandPrimary *cb = data; - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_message ("%p: new primary offer %p", - cb, offer)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, + "%p: new primary offer %p", + cb, offer); gdk_wayland_primary_discard_pending (cb); @@ -174,8 +182,9 @@ primary_selection_selection (void *data, if (cb->pending != offer) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_message ("%p: ignoring unknown data offer %p", - cb, offer)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, + "%p: ignoring unknown data offer %p", + cb, offer); return; } @@ -200,7 +209,9 @@ gdk_wayland_primary_write_done (GObject *clipboard, if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error)) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), SELECTION, g_message ("%p: failed to write stream: %s", clipboard, error->message)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), SELECTION, + "%p: failed to write stream: %s", + clipboard, error->message); g_error_free (error); } } @@ -214,8 +225,9 @@ gdk_wayland_primary_data_source_send (void *da GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (data); GOutputStream *stream; - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), SELECTION, g_message ("%p: data source send request for %s on fd %d", - source, mime_type, fd)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), SELECTION, + "%p: data source send request for %s on fd %d", + source, mime_type, fd); mime_type = gdk_intern_mime_type (mime_type); stream = g_unix_output_stream_new (fd, TRUE); @@ -236,7 +248,8 @@ gdk_wayland_primary_data_source_cancelled (void { GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (data); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: data source cancelled", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: data source cancelled", data); if (cb->source == source) { @@ -307,9 +320,14 @@ gdk_wayland_primary_read_async (GdkClipboard *clipboard, g_task_set_priority (task, io_priority); g_task_set_source_tag (task, gdk_wayland_primary_read_async); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (clipboard), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: read for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (clipboard), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: read for %s", cb, s); + g_free (s); + } +#endif mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats); if (mime_type == NULL) { diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index d35ffb2299..86392923e5 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -553,7 +553,7 @@ frame_callback (void *data, GdkFrameTimings *timings; gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "frame event"); - GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", surface)); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface); wl_callback_destroy (callback); @@ -1345,8 +1345,8 @@ surface_enter (void *data, GdkDisplay *display = gdk_surface_get_display (surface); GdkMonitor *monitor; - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("surface enter, surface %p output %p", surface, output)); + GDK_DISPLAY_DEBUG(gdk_surface_get_display (surface), EVENTS, + "surface enter, surface %p output %p", surface, output); impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output); @@ -1366,8 +1366,8 @@ surface_leave (void *data, GdkDisplay *display = gdk_surface_get_display (surface); GdkMonitor *monitor; - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("surface leave, surface %p output %p", surface, output)); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "surface leave, surface %p output %p", surface, output); impl->display_server.outputs = g_slist_remove (impl->display_server.outputs, output); @@ -1594,13 +1594,13 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface) impl->next_layout.surface_geometry_dirty = TRUE; gdk_surface_request_layout (surface); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("configure, surface %p %dx%d,%s%s%s%s", - surface, width, height, - (new_state & GDK_TOPLEVEL_STATE_FULLSCREEN) ? " fullscreen" : "", - (new_state & GDK_TOPLEVEL_STATE_MAXIMIZED) ? " maximized" : "", - (new_state & GDK_TOPLEVEL_STATE_FOCUSED) ? " focused" : "", - (new_state & GDK_TOPLEVEL_STATE_TILED) ? " tiled" : "")); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "configure, surface %p %dx%d,%s%s%s%s", + surface, width, height, + (new_state & GDK_TOPLEVEL_STATE_FULLSCREEN) ? " fullscreen" : "", + (new_state & GDK_TOPLEVEL_STATE_MAXIMIZED) ? " maximized" : "", + (new_state & GDK_TOPLEVEL_STATE_FOCUSED) ? " focused" : "", + (new_state & GDK_TOPLEVEL_STATE_TILED) ? " tiled" : ""); gdk_surface_queue_state_change (surface, ~0 & ~new_state, new_state); @@ -1753,7 +1753,7 @@ gdk_wayland_surface_handle_close (GdkSurface *surface) display = gdk_surface_get_display (surface); - GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", surface)); + GDK_DISPLAY_DEBUG (display, EVENTS, "close %p", surface); event = gdk_delete_event_new (surface); @@ -2116,7 +2116,7 @@ xdg_popup_done (void *data, { GdkSurface *surface = GDK_SURFACE (data); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, g_message ("done %p", surface)); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, "done %p", surface); gdk_surface_hide (surface); } @@ -2129,8 +2129,8 @@ xdg_popup_repositioned (void *data, GdkSurface *surface = GDK_SURFACE (data); GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("repositioned %p", surface)); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "repositioned %p", surface); if (impl->popup_state != POPUP_STATE_WAITING_FOR_REPOSITIONED) { @@ -2167,8 +2167,7 @@ zxdg_popup_v6_done (void *data, { GdkSurface *surface = GDK_SURFACE (data); - GDK_NOTE (EVENTS, - g_message ("done %p", surface)); + GDK_DEBUG (EVENTS, "done %p", surface); gdk_surface_hide (surface); } -- 2.30.2