diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-09-22 21:34:04 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-09-23 18:11:48 -0400 |
commit | ce4c2154f4c4ab5a4fa8b45896354ed18a580bb2 (patch) | |
tree | b2038c94fb397fabc2da86a6b8ed15f1aa609933 /gdk | |
parent | 71fedee85d47cfeed63e3223f44dd5da7c26b35b (diff) | |
download | gtk+-ce4c2154f4c4ab5a4fa8b45896354ed18a580bb2.tar.gz |
x11: Use the new debug macros
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/x11/gdkclipboard-x11.c | 136 | ||||
-rw-r--r-- | gdk/x11/gdkdevicemanager-x11.c | 5 | ||||
-rw-r--r-- | gdk/x11/gdkdevicemanager-xi2.c | 155 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 138 | ||||
-rw-r--r-- | gdk/x11/gdkdrag-x11.c | 69 | ||||
-rw-r--r-- | gdk/x11/gdkdrop-x11.c | 47 | ||||
-rw-r--r-- | gdk/x11/gdkglcontext-glx.c | 63 | ||||
-rw-r--r-- | gdk/x11/gdkselectioninputstream-x11.c | 70 | ||||
-rw-r--r-- | gdk/x11/gdkselectionoutputstream-x11.c | 131 | ||||
-rw-r--r-- | gdk/x11/xsettings-client.c | 16 |
10 files changed, 437 insertions, 393 deletions
diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c index f634536b3f..b81755481c 100644 --- a/gdk/x11/gdkclipboard-x11.c +++ b/gdk/x11/gdkclipboard-x11.c @@ -65,15 +65,24 @@ print_atoms (GdkX11Clipboard *cb, const Atom *atoms, gsize n_atoms) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, { +#ifdef G_ENABLE_DEBUG + GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); + + if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD)) + { gsize i; - GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); + GString *str; - g_printerr ("%s: %s [ ", cb->selection, prefix); + str = g_string_new (""); + g_string_append_printf (str, "%s: %s [ ", cb->selection, prefix); for (i = 0; i < n_atoms; i++) - g_printerr ("%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); - g_printerr (" ]\n"); - }); + g_string_append_printf (str, "%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); + g_string_append (str, " ]"); + + gdk_debug_message ("%s", str->str); + g_string_free (str, TRUE); + } +#endif } static void @@ -85,9 +94,7 @@ gdk_x11_clipboard_default_output_closed (GObject *stream, if (!g_output_stream_close_finish (G_OUTPUT_STREAM (stream), result, &error)) { - GDK_NOTE (CLIPBOARD, - g_printerr ("-------: failed to close stream: %s\n", - error->message)); + GDK_DEBUG (CLIPBOARD, "-------: failed to close stream: %s", error->message); g_error_free (error); } @@ -104,9 +111,9 @@ gdk_x11_clipboard_default_output_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_printerr ("%s: failed to write stream: %s\n", - GDK_X11_CLIPBOARD (clipboard)->selection, error->message)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, + "%s: failed to write stream: %s", + GDK_X11_CLIPBOARD (clipboard)->selection, error->message); g_error_free (error); } @@ -289,8 +296,8 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, bytes = g_input_stream_read_bytes_finish (stream, res, &error); if (bytes == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: error reading TARGETS: %s\n", cb->selection, error->message)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: error reading TARGETS: %s\n", cb->selection, error->message); g_error_free (error); g_object_unref (stream); g_object_unref (cb); @@ -321,7 +328,14 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, formats = gdk_x11_clipboard_formats_from_atoms (display, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes) / sizeof (Atom)); - GDK_DISPLAY_NOTE (display, CLIPBOARD, char *s = gdk_content_formats_to_string (formats); g_printerr ("%s: got formats: %s\n", cb->selection, s); g_free (s)); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%s: got formats: %s", cb->selection, s); + g_free (s); + } +#endif /* union with previously loaded formats */ formats = gdk_content_formats_union (formats, gdk_clipboard_get_formats (GDK_CLIPBOARD (cb))); @@ -353,15 +367,15 @@ gdk_x11_clipboard_request_targets_got_stream (GObject *source, stream = gdk_x11_selection_input_stream_new_finish (result, &type, &format, &error); if (stream == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: can't request TARGETS: %s\n", cb->selection, error->message)); + GDK_DISPLAY_DEBUG(display, CLIPBOARD, "%s: can't request TARGETS: %s", cb->selection, error->message); g_object_unref (cb); g_error_free (error); return; } else if (g_strcmp0 (type, "ATOM") != 0 || format != 32) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 32\n", - cb->selection, type ? type : "NULL", format)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 32", + cb->selection, type ? type : "NULL", format); g_input_stream_close (stream, NULL, NULL); g_object_unref (stream); g_object_unref (cb); @@ -423,13 +437,13 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, if (xevent->xselectionclear.time < cb->timestamp) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: ignoring SelectionClear with too old timestamp (%lu vs %lu)\n", - cb->selection, xevent->xselectionclear.time, cb->timestamp)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: ignoring SelectionClear with too old timestamp (%lu vs %lu)", + cb->selection, xevent->xselectionclear.time, cb->timestamp); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: got SelectionClear\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: got SelectionClear", cb->selection); gdk_x11_clipboard_claim_remote (cb, xevent->xselectionclear.time); return TRUE; @@ -446,13 +460,13 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, /* We already received a selectionNotify before */ if (cb->store_task == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionNotify for nonexisting task?!\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionNotify for nonexisting task?!", cb->selection); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionNotify for store task\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionNotify for store task", cb->selection); if (xevent->xselection.property != None) g_task_return_boolean (cb->store_task, TRUE); @@ -482,21 +496,21 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, if (!gdk_clipboard_is_local (GDK_CLIPBOARD (cb))) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionRequest for %s @ %s even though we don't own the selection, huh?\n", - cb->selection, target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionRequest for %s @ %s even though we don't own the selection, huh?", + cb->selection, target, property); return TRUE; } if (xevent->xselectionrequest.requestor == None) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionRequest for %s @ %s with NULL window, ignoring\n", - cb->selection, target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionRequest for %s @ %s with NULL window, ignoring", + cb->selection, target, property); return TRUE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionRequest for %s @ %s\n", cb->selection, target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionRequest for %s @ %s", cb->selection, target, property); gdk_x11_selection_output_streams_create (display, gdk_clipboard_get_formats (GDK_CLIPBOARD (cb)), @@ -522,21 +536,21 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, if (sn->selection_timestamp < cb->timestamp) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: Ignoring XFixesSelectionNotify with too old timestamp (%lu vs %lu)\n", - cb->selection, sn->selection_timestamp, cb->timestamp)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: Ignoring XFixesSelectionNotify with too old timestamp (%lu vs %lu)", + cb->selection, sn->selection_timestamp, cb->timestamp); return FALSE; } if (sn->owner == GDK_X11_DISPLAY (display)->leader_window) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: Ignoring XFixesSelectionNotify for ourselves\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: Ignoring XFixesSelectionNotify for ourselves", cb->selection); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: Received XFixesSelectionNotify, claiming selection\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: Received XFixesSelectionNotify, claiming selection", cb->selection); gdk_x11_clipboard_claim_remote (cb, sn->selection_timestamp); } @@ -580,7 +594,7 @@ gdk_x11_clipboard_claim (GdkClipboard *clipboard, if (XGetSelectionOwner (xdisplay, cb->xselection) != xwindow) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: failed XSetSelectionOwner()\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: failed XSetSelectionOwner()", cb->selection); return FALSE; } } @@ -590,7 +604,7 @@ gdk_x11_clipboard_claim (GdkClipboard *clipboard, } cb->timestamp = time; - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: claimed via XSetSelectionOwner()\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: claimed via XSetSelectionOwner()", cb->selection); } return GDK_CLIPBOARD_CLASS (gdk_x11_clipboard_parent_class)->claim (clipboard, formats, local, content); @@ -616,7 +630,7 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, /* clipboard managers don't work on anything but the clipbpoard selection */ if (!g_str_equal (cb->selection, "CLIPBOARD")) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: can only store on CLIPBOARD\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: can only store on CLIPBOARD", cb->selection); GDK_CLIPBOARD_CLASS (gdk_x11_clipboard_parent_class)->store_async (clipboard, io_priority, cancellable, @@ -634,9 +648,9 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, if (XGetSelectionOwner (xdisplay, clipboard_manager) == None) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: XGetSelectionOwner (CLIPBOARD_MANAGER) returned None, aborting.\n", - cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: XGetSelectionOwner (CLIPBOARD_MANAGER) returned None, aborting.", + cb->selection); g_task_return_new_error (cb->store_task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("Cannot store clipboard. No clipboard manager is active.")); g_clear_object (&cb->store_task); @@ -646,7 +660,7 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, content = gdk_clipboard_get_content (clipboard); if (content == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: storing empty clipboard: SUCCESS!\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: storing empty clipboard: SUCCESS!", cb->selection); g_task_return_boolean (cb->store_task, TRUE); g_clear_object (&cb->store_task); return; @@ -678,8 +692,8 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, error = gdk_x11_display_error_trap_pop (display); if (error != Success) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: X error during ConvertSelection() while storing selection: %d\n", cb->selection, error)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: X error during ConvertSelection() while storing selection: %d", cb->selection, error); } g_free (atoms); @@ -718,9 +732,9 @@ gdk_x11_clipboard_read_got_stream (GObject *source, { GdkX11Clipboard *cb = GDK_X11_CLIPBOARD (g_task_get_source_object (task)); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD(cb)), CLIPBOARD, - g_printerr ("%s: reading %s failed, trying %s next\n", - cb->selection, (char *) targets->data, (char *) next->data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD(cb)), CLIPBOARD, + "%s: reading %s failed, trying %s next\n", + cb->selection, (char *) targets->data, (char *) next->data); targets->next = NULL; g_task_set_task_data (task, next, (GDestroyNotify) g_slist_free); gdk_x11_selection_input_stream_new_async (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), @@ -749,9 +763,9 @@ gdk_x11_clipboard_read_got_stream (GObject *source, { g_assert (special_targets[i].mime_type != NULL); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, - g_printerr ("%s: reading with converter from %s to %s\n", - cb->selection, mime_type, special_targets[i].mime_type)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, + "%s: reading with converter from %s to %s", + cb->selection, mime_type, special_targets[i].mime_type); mime_type = g_intern_string (special_targets[i].mime_type); g_task_set_task_data (task, g_slist_prepend (NULL, (gpointer) mime_type), (GDestroyNotify) g_slist_free); stream = special_targets[i].convert (cb, stream, type, format); @@ -759,8 +773,8 @@ gdk_x11_clipboard_read_got_stream (GObject *source, } } - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, - g_printerr ("%s: reading clipboard as %s now\n", cb->selection, mime_type)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, + "%s: reading clipboard as %s now", cb->selection, mime_type); g_task_return_pointer (task, stream, g_object_unref); } @@ -792,9 +806,9 @@ gdk_x11_clipboard_read_async (GdkClipboard *clipboard, return; } - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (clipboard), CLIPBOARD, - g_printerr ("%s: new read for %s (%u other options)\n", - cb->selection, (char *) targets->data, g_slist_length (targets->next))); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (clipboard), CLIPBOARD, + "%s: new read for %s (%u other options)", + cb->selection, (char *) targets->data, g_slist_length (targets->next)); gdk_x11_selection_input_stream_new_async (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), cb->selection, targets->data, diff --git a/gdk/x11/gdkdevicemanager-x11.c b/gdk/x11/gdkdevicemanager-x11.c index 27a7d2007b..d67ac13d6e 100644 --- a/gdk/x11/gdkdevicemanager-x11.c +++ b/gdk/x11/gdkdevicemanager-x11.c @@ -47,9 +47,8 @@ _gdk_x11_device_manager_new (GdkDisplay *display) { GdkX11DeviceManagerXI2 *device_manager_xi2; - GDK_DISPLAY_NOTE (display, INPUT, - g_message ("Creating XI2 (version %d.%d) device manager", - major, minor)); + GDK_DISPLAY_DEBUG (display, INPUT, "Creating XI2 (version %d.%d) device manager", + major, minor); device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2, "display", display, diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 87482bff6a..c8b8452507 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -226,7 +226,8 @@ translate_valuator_class (GdkDisplay *display, } _gdk_device_add_axis (device, use, min, max, resolution); - GDK_DISPLAY_NOTE (display, INPUT, +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, INPUT)) { const char *label; @@ -235,8 +236,9 @@ translate_valuator_class (GdkDisplay *display, else label = NULL; - g_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)"); - }); + gdk_debug_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)"); + } +#endif } static void @@ -281,13 +283,12 @@ translate_device_classes (GdkDisplay *display, else direction = GDK_SCROLL_RIGHT; - GDK_DISPLAY_NOTE (display, INPUT, - g_message ("\n\tscroll valuator %d: %s, increment %f", - scroll_info->number, - scroll_info->scroll_type == XIScrollTypeVertical - ? "vertical" - : "horizontal", - scroll_info->increment)); + GDK_DISPLAY_DEBUG (display, INPUT, "\n\tscroll valuator %d: %s, increment %f", + scroll_info->number, + scroll_info->scroll_type == XIScrollTypeVertical + ? "vertical" + : "horizontal", + scroll_info->increment); _gdk_x11_device_xi2_add_scroll_valuator (GDK_X11_DEVICE_XI2 (device), scroll_info->number, @@ -520,17 +521,19 @@ create_device (GdkX11DeviceManagerXI2 *device_manager, break; } - GDK_DISPLAY_NOTE (display, INPUT, - ({ - const char *type_names[] = { "logical", "physical", "floating" }; - const char *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" }; - g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d", +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, INPUT)) + { + const char *type_names[] = { "logical", "physical", "floating" }; + const char *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" }; + gdk_debug_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d", dev->name, type_names[type], source_names[input_source], dev->use == XIMasterPointer, num_touches); - })); + } +#endif if (dev->use != XIMasterKeyboard && dev->use != XIMasterPointer) @@ -1372,11 +1375,11 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface, g_return_if_fail (GDK_IS_DEVICE (device)); g_return_if_fail (source_device == NULL || GDK_IS_DEVICE (source_device)); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s", - GDK_SURFACE_XID (surface), - notify_details[detail], - notify_modes[mode])); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "focus out:\t\twindow: %ld, detail: %s, mode: %s", + GDK_SURFACE_XID (surface), + notify_details[detail], + notify_modes[mode]); toplevel = _gdk_x11_surface_get_toplevel (surface); @@ -1525,16 +1528,16 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, GdkTranslatedKey translated; GdkTranslatedKey no_lock; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("key %s:\twindow %ld\n" - "\tdevice:%u\n" - "\tsource device:%u\n" - "\tkey number: %u\n", - (ev->evtype == XI_KeyPress) ? "press" : "release", - xev->event, - xev->deviceid, - xev->sourceid, - xev->detail)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "key %s:\twindow %ld\n" + "\tdevice:%u\n" + "\tsource device:%u\n" + "\tkey number: %u\n", + (ev->evtype == XI_KeyPress) ? "press" : "release", + xev->event, + xev->deviceid, + xev->sourceid, + xev->detail); state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group); @@ -1608,18 +1611,18 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, { XIDeviceEvent *xev = (XIDeviceEvent *) ev; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("button %s:\twindow %ld\n" - "\tdevice:%u\n" - "\tsource device:%u\n" - "\tbutton number: %u\n" - "\tx,y: %.2f %.2f", - (ev->evtype == XI_ButtonPress) ? "press" : "release", - xev->event, - xev->deviceid, - xev->sourceid, - xev->detail, - xev->event_x, xev->event_y)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "button %s:\twindow %ld\n" + "\tdevice:%u\n" + "\tsource device:%u\n" + "\tbutton number: %u\n" + "\tx,y: %.2f %.2f", + (ev->evtype == XI_ButtonPress) ? "press" : "release", + xev->event, + xev->deviceid, + xev->sourceid, + xev->detail, + xev->event_x, xev->event_y); #ifdef XINPUT_2_2 if (xev->flags & XIPointerEmulated) @@ -1732,10 +1735,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, GdkModifierType state; GdkScrollDirection direction; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas: %f %f", + GDK_DISPLAY_DEBUG (display, EVENTS, + "smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas: %f %f", xev->deviceid, xev->sourceid, - xev->event, delta_x, delta_y)); + xev->event, delta_x, delta_y); state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group); @@ -1815,12 +1818,12 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, double x, y; double *axes; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("touch %s:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", - ev->evtype == XI_TouchBegin ? "begin" : "end", - xev->event, - xev->detail, - xev->flags & XITouchEmulatingPointer ? "true" : "false")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "touch %s:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", + ev->evtype == XI_TouchBegin ? "begin" : "end", + xev->event, + xev->detail, + xev->flags & XITouchEmulatingPointer ? "true" : "false"); device = g_hash_table_lookup (device_manager->id_table, GUINT_TO_POINTER (xev->deviceid)); @@ -1866,11 +1869,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, double x, y; double *axes; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("touch update:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", - xev->event, - xev->detail, - xev->flags & XITouchEmulatingPointer ? "true" : "false")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "touch update:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", + xev->event, + xev->detail, + xev->flags & XITouchEmulatingPointer ? "true" : "false"); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); @@ -1931,12 +1934,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, } #endif - GDK_NOTE (EVENTS, - g_message ("pinch gesture %s:\twindow %ld\n\tfinger_count: %u%s", - event_name, - xev->event, - xev->detail, - xev->flags & XIGesturePinchEventCancelled ? "\n\tcancelled" : "")); + GDK_DEBUG (EVENTS, "pinch gesture %s:\twindow %ld\n\tfinger_count: %u%s", + event_name, + xev->event, + xev->detail, + xev->flags & XIGesturePinchEventCancelled ? "\n\tcancelled" : ""); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); @@ -1992,12 +1994,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, } #endif - GDK_NOTE (EVENTS, - g_message ("swipe gesture %s:\twindow %ld\n\tfinger_count: %u%s", - event_name, - xev->event, - xev->detail, - xev->flags & XIGestureSwipeEventCancelled ? "\n\tcancelled" : "")); + GDK_DEBUG (EVENTS, "swipe gesture %s:\twindow %ld\n\tfinger_count: %u%s", + event_name, + xev->event, + xev->detail, + xev->flags & XIGestureSwipeEventCancelled ? "\n\tcancelled" : ""); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); @@ -2031,14 +2032,14 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, XIEnterEvent *xev = (XIEnterEvent *) ev; GdkModifierType state; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("%s notify:\twindow %ld\n\tsubwindow:%ld\n" - "\tdevice: %u\n\tsource device: %u\n" - "\tnotify type: %u\n\tcrossing mode: %u", - (ev->evtype == XI_Enter) ? "enter" : "leave", - xev->event, xev->child, - xev->deviceid, xev->sourceid, - xev->detail, xev->mode)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "%s notify:\twindow %ld\n\tsubwindow:%ld\n" + "\tdevice: %u\n\tsource device: %u\n" + "\tnotify type: %u\n\tcrossing mode: %u", + (ev->evtype == XI_Enter) ? "enter" : "leave", + xev->event, xev->child, + xev->deviceid, xev->sourceid, + xev->detail, xev->mode); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 84a45dc814..cfa0e3474e 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -680,17 +680,17 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, switch (xevent->type) { case KeymapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, g_message ("keymap notify")); + GDK_DISPLAY_DEBUG (display, EVENTS, "keymap notify"); /* Not currently handled */ break; case Expose: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d", - xevent->xexpose.window, xevent->xexpose.count, - xevent->xexpose.x, xevent->xexpose.y, - xevent->xexpose.width, xevent->xexpose.height)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d", + xevent->xexpose.window, xevent->xexpose.count, + xevent->xexpose.x, xevent->xexpose.y, + xevent->xexpose.width, xevent->xexpose.height); if (surface == NULL) break; @@ -718,9 +718,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, GdkRectangle expose_rect; int x2, y2; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("graphics expose:\tdrawable: %ld", - xevent->xgraphicsexpose.drawable)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "graphics expose:\tdrawable: %ld", + xevent->xgraphicsexpose.drawable); if (surface == NULL) break; @@ -763,23 +763,23 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case CreateNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("create notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d parent: %ld ovr: %d", - xevent->xcreatewindow.window, - xevent->xcreatewindow.x, - xevent->xcreatewindow.y, - xevent->xcreatewindow.width, - xevent->xcreatewindow.height, - xevent->xcreatewindow.border_width, - xevent->xcreatewindow.parent, - xevent->xcreatewindow.override_redirect)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "create notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d parent: %ld ovr: %d", + xevent->xcreatewindow.window, + xevent->xcreatewindow.x, + xevent->xcreatewindow.y, + xevent->xcreatewindow.width, + xevent->xcreatewindow.height, + xevent->xcreatewindow.border_width, + xevent->xcreatewindow.parent, + xevent->xcreatewindow.override_redirect); /* not really handled */ break; case DestroyNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("destroy notify:\twindow: %ld", - xevent->xdestroywindow.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "destroy notify:\twindow: %ld", + xevent->xdestroywindow.window); if (surface) event = gdk_delete_event_new (surface); @@ -790,9 +790,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case UnmapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("unmap notify:\t\twindow: %ld", - xevent->xmap.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "unmap notify:\t\twindow: %ld", + xevent->xmap.window); if (surface) { @@ -833,9 +833,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case MapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("map notify:\t\twindow: %ld", - xevent->xmap.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "map notify:\t\twindow: %ld", + xevent->xmap.window); if (surface) { @@ -858,29 +858,29 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case ReparentNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("reparent notify:\twindow: %ld x,y: %d %d parent: %ld ovr: %d", - xevent->xreparent.window, - xevent->xreparent.x, - xevent->xreparent.y, - xevent->xreparent.parent, - xevent->xreparent.override_redirect)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "reparent notify:\twindow: %ld x,y: %d %d parent: %ld ovr: %d", + xevent->xreparent.window, + xevent->xreparent.x, + xevent->xreparent.y, + xevent->xreparent.parent, + xevent->xreparent.override_redirect); /* Not currently handled */ break; case ConfigureNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d%s", - xevent->xconfigure.window, - xevent->xconfigure.x, - xevent->xconfigure.y, - xevent->xconfigure.width, - xevent->xconfigure.height, - xevent->xconfigure.border_width, - xevent->xconfigure.above, - xevent->xconfigure.override_redirect, - !surface ? " (discarding)" : "")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d%s", + xevent->xconfigure.window, + xevent->xconfigure.x, + xevent->xconfigure.y, + xevent->xconfigure.width, + xevent->xconfigure.height, + xevent->xconfigure.border_width, + xevent->xconfigure.above, + xevent->xconfigure.override_redirect, + !surface ? " (discarding)" : ""); if (_gdk_x11_display_is_root_window (display, xevent->xconfigure.window)) { _gdk_x11_screen_size_changed (x11_screen, xevent); @@ -980,13 +980,13 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case PropertyNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("property notify:\twindow: %ld, atom(%ld): %s%s%s", - xevent->xproperty.window, - xevent->xproperty.atom, - "\"", - gdk_x11_get_xatom_name_for_display (display, xevent->xproperty.atom), - "\"")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "property notify:\twindow: %ld, atom(%ld): %s%s%s", + xevent->xproperty.window, + xevent->xproperty.atom, + "\"", + gdk_x11_get_xatom_name_for_display (display, xevent->xproperty.atom), + "\""); if (surface == NULL) break; @@ -1009,24 +1009,23 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case ColormapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("colormap notify:\twindow: %ld", - xevent->xcolormap.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "colormap notify:\twindow: %ld", + xevent->xcolormap.window); /* Not currently handled */ break; case ClientMessage: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("client message:\twindow: %ld", - xevent->xclient.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "client message:\twindow: %ld", + xevent->xclient.window); /* Not currently handled */ break; case MappingNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("mapping notify")); + GDK_DISPLAY_DEBUG (display, EVENTS, "mapping notify"); /* Let XLib know that there is a new keyboard mapping. */ @@ -1244,9 +1243,9 @@ _gdk_wm_protocols_filter (const XEvent *xevent, * the event is passed along to the program, * which should then destroy the window. */ - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("delete window:\t\twindow: %ld", - xevent->xclient.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "delete window:\t\twindow: %ld", + xevent->xclient.window); *event = gdk_delete_event_new (win); @@ -1592,11 +1591,12 @@ gdk_x11_display_open (const char *display_name) True, &detectable_autorepeat_supported); - GDK_NOTE (MISC, g_message ("Detectable autorepeat %s.", - detectable_autorepeat_supported ? - "supported" : "not supported")); - - display_x11->have_xkb_autorepeat = detectable_autorepeat_supported; + GDK_DEBUG (MISC, "Detectable autorepeat %s.", + detectable_autorepeat_supported + ? "supported" + : "not supported"); + + display_x11->have_xkb_autorepeat = detectable_autorepeat_supported; } } } diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index 7e7904904b..2e1a2870ee 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -844,9 +844,9 @@ gdk_x11_drag_handle_status (GdkDisplay *display, drag = gdk_x11_drag_find (display, xevent->xclient.window, dest_surface); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndStatus: dest_surface: %#x action: %ld", - dest_surface, action)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndStatus: dest_surface: %#x action: %ld", + dest_surface, action); if (drag) { @@ -856,8 +856,8 @@ gdk_x11_drag_handle_status (GdkDisplay *display, if (!(action != 0) != !(flags & 1)) { - GDK_DISPLAY_NOTE (display, DND, - g_warning ("Received status event with flags not corresponding to action!")); + GDK_DISPLAY_DEBUG (display, DND, + "Received status event with flags not corresponding to action!"); action = 0; } @@ -876,8 +876,8 @@ gdk_x11_drag_handle_finished (GdkDisplay *display, drag = gdk_x11_drag_find (display, xevent->xclient.window, dest_surface); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndFinished: dest_surface: %#x", dest_surface)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndFinished: dest_surface: %#x", dest_surface); if (drag) { @@ -977,9 +977,9 @@ send_client_message_async_cb (Window window, GdkX11Drag *drag_x11 = data; GdkDrag *drag = data; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND, - g_message ("Got async callback for #%lx, success = %d", - window, success)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), DND, + "Got async callback for #%lx, success = %d", + window, success); /* On failure, we immediately continue with the protocol * so we don't end up blocking for a timeout @@ -1061,9 +1061,9 @@ xdnd_send_enter (GdkX11Drag *drag_x11) xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; - GDK_DISPLAY_NOTE (display, DND, - g_message ("Sending enter source window %#lx XDND protocol version %d\n", - GDK_SURFACE_XID (drag_x11->ipc_surface), drag_x11->version)); + GDK_DISPLAY_DEBUG (display, DND, + "Sending enter source window %#lx XDND protocol version %d\n", + GDK_SURFACE_XID (drag_x11->ipc_surface), drag_x11->version); formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); formats = gdk_content_formats_union_serialize_mime_types (formats); @@ -1195,8 +1195,8 @@ xdnd_check_dest (GdkDisplay *display, } else { - GDK_DISPLAY_NOTE (display, DND, - g_warning ("Invalid XdndProxy property on window %ld", win)); + GDK_DISPLAY_DEBUG (display, DND, + "Invalid XdndProxy property on window %ld", win); } XFree (proxy_data); @@ -1220,8 +1220,8 @@ xdnd_check_dest (GdkDisplay *display, } else { - GDK_DISPLAY_NOTE (display, DND, - g_warning ("Invalid XdndAware property on window %ld", win)); + GDK_DISPLAY_DEBUG (display, DND, + "Invalid XdndAware property on window %ld", win); } XFree (version); @@ -1286,20 +1286,20 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display, { *protocol = GDK_DRAG_PROTO_XDND; *version = 5; - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering local Xdnd window %#x\n", (guint) xid)); + GDK_DISPLAY_DEBUG (display, DND, "Entering local Xdnd window %#x", (guint) xid); return xid; } else if (_gdk_x11_display_is_root_window (display, xid)) { *protocol = GDK_DRAG_PROTO_ROOTWIN; - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering root window\n")); + GDK_DISPLAY_DEBUG (display, DND, "Entering root window"); return xid; } } else if ((retval = xdnd_check_dest (display, xid, version))) { *protocol = GDK_DRAG_PROTO_XDND; - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering Xdnd window %#x\n", (guint) xid)); + GDK_DISPLAY_DEBUG (display, DND, "Entering Xdnd window %#x", (guint) xid); return retval; } else @@ -1312,7 +1312,7 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display, if (rootwin) { - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering root window\n")); + GDK_DISPLAY_DEBUG (display, DND, "Entering root window"); *protocol = GDK_DRAG_PROTO_ROOTWIN; return xid; } @@ -1621,9 +1621,7 @@ gdk_x11_drag_default_output_closed (GObject *stream, if (!g_output_stream_close_finish (G_OUTPUT_STREAM (stream), result, &error)) { - GDK_NOTE (DND, - g_printerr ("failed to close stream: %s\n", - error->message)); + GDK_DEBUG (DND, "failed to close stream: %s", error->message); g_error_free (error); } @@ -1640,7 +1638,7 @@ gdk_x11_drag_default_output_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_printerr ("failed to write stream: %s\n", error->message)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (GDK_DRAG (drag)), DND, "failed to write stream: %s", error->message); g_error_free (error); } @@ -1689,12 +1687,13 @@ gdk_x11_drag_xevent (GdkDisplay *display, if (xevent->xselectionclear.time < x11_drag->timestamp) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("ignoring SelectionClear with too old timestamp (%lu vs %lu)\n", - xevent->xselectionclear.time, x11_drag->timestamp)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "ignoring SelectionClear with too old timestamp (%lu vs %lu)", + xevent->xselectionclear.time, x11_drag->timestamp); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionClear, aborting DND\n")); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "got SelectionClear, aborting DND"); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR); return TRUE; @@ -1718,13 +1717,15 @@ gdk_x11_drag_xevent (GdkDisplay *display, if (xevent->xselectionrequest.requestor == None) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s with NULL window, ignoring\n", - target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "got SelectionRequest for %s @ %s with NULL window, ignoring", + target, property); return TRUE; } - - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s\n", - target, property)); + + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "got SelectionRequest for %s @ %s", + target, property); formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); formats = gdk_content_formats_union_serialize_mime_types (formats); @@ -2080,7 +2081,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface, x11_drag->timestamp); if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection) != GDK_SURFACE_XID (x11_drag->ipc_surface)) { - GDK_DISPLAY_NOTE (display, DND, g_printerr ("failed XSetSelectionOwner() on \"XdndSelection\", aborting DND\n")); + GDK_DISPLAY_DEBUG (display, DND, "failed XSetSelectionOwner() on \"XdndSelection\", aborting DND"); g_object_unref (drag); return NULL; } diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c index 05b07ca990..33a2afb83c 100644 --- a/gdk/x11/gdkdrop-x11.c +++ b/gdk/x11/gdkdrop-x11.c @@ -165,8 +165,9 @@ gdk_x11_drop_read_got_stream (GObject *source, { GdkDrop *drop = GDK_DROP (g_task_get_source_object (task)); - GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, g_printerr ("reading %s failed, trying %s next\n", - (char *) targets->data, (char *) next->data)); + GDK_DISPLAY_DEBUG (gdk_drop_get_display (drop), DND, + "reading %s failed, trying %s next", + (char *) targets->data, (char *) next->data); targets->next = NULL; g_task_set_task_data (task, next, (GDestroyNotify) g_slist_free); gdk_x11_selection_input_stream_new_async (gdk_drop_get_display (drop), @@ -202,8 +203,9 @@ gdk_x11_drop_read_got_stream (GObject *source, } } - GDK_NOTE (DND, g_printerr ("reading DND as %s now\n", - (const char *)((GSList *) g_task_get_task_data (task))->data)); + GDK_DISPLAY_DEBUG (gdk_drop_get_display (drop), DND, + "reading DND as %s now", + (const char *)((GSList *) g_task_get_task_data (task))->data); g_task_return_pointer (task, stream, g_object_unref); } @@ -234,8 +236,9 @@ gdk_x11_drop_read_async (GdkDrop *drop, return; } - GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, g_printerr ("new read for %s (%u other options)\n", - (char *) targets->data, g_slist_length (targets->next))); + GDK_DISPLAY_DEBUG (gdk_drop_get_display (drop), DND, + "new read for %s (%u other options)", + (char *) targets->data, g_slist_length (targets->next)); gdk_x11_selection_input_stream_new_async (gdk_drop_get_display (drop), "XdndSelection", targets->data, @@ -495,14 +498,14 @@ xdnd_enter_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndEnter: source_window: %#lx, version: %#x", - source_window, version)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndEnter: source_window: %#lx, version: %#x", + source_window, version); if (version < 3) { /* Old source ignore */ - GDK_DISPLAY_NOTE (display, DND, g_message ("Ignored old XdndEnter message")); + GDK_DISPLAY_DEBUG (display, DND, "Ignored old XdndEnter message"); return TRUE; } @@ -607,9 +610,9 @@ xdnd_leave_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndLeave: source_window: %#lx", - source_window)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndLeave: source_window: %#lx", + source_window); if ((display_x11->current_drop != NULL) && (GDK_X11_DROP (display_x11->current_drop)->source_window == source_window)) @@ -641,9 +644,9 @@ xdnd_position_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndPosition: source_window: %#lx position: (%d, %d) time: %d action: %ld", - source_window, x_root, y_root, time, action)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndPosition: source_window: %#lx position: (%d, %d) time: %d action: %ld", + source_window, x_root, y_root, time, action); drop = display_x11->current_drop; drop_x11 = GDK_X11_DROP (drop); @@ -688,9 +691,9 @@ xdnd_drop_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndDrop: source_window: %#lx time: %d", - source_window, time)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndDrop: source_window: %#lx time: %d", + source_window, time); drop = display_x11->current_drop; drop_x11 = GDK_X11_DROP (drop); @@ -745,14 +748,10 @@ gdk_x11_drop_do_nothing (Window window, gboolean success, gpointer data) { -#ifdef G_ENABLE_DEBUG - GdkDisplay *display = data; - if (!success) { - GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", window)); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), DND, "Send event to %lx failed", window); } -#endif } static void diff --git a/gdk/x11/gdkglcontext-glx.c b/gdk/x11/gdkglcontext-glx.c index 2033e42902..717426cf68 100644 --- a/gdk/x11/gdkglcontext-glx.c +++ b/gdk/x11/gdkglcontext-glx.c @@ -137,11 +137,11 @@ gdk_x11_gl_context_glx_end_frame (GdkDrawContext *draw_context, drawable = gdk_x11_surface_get_glx_drawable (surface); - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Flushing GLX buffers for drawable %lu (window: %lu), frame sync: %s", - (unsigned long) drawable, - (unsigned long) gdk_x11_surface_get_xid (surface), - self->do_frame_sync ? "yes" : "no")); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Flushing GLX buffers for drawable %lu (window: %lu), frame sync: %s", + (unsigned long) drawable, + (unsigned long) gdk_x11_surface_get_xid (surface), + self->do_frame_sync ? "yes" : "no"); gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "x11", "swap buffers"); @@ -228,9 +228,9 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context, surface = GDK_X11_DISPLAY (display)->leader_gdk_surface; drawable = gdk_x11_surface_get_glx_drawable (surface); - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Making GLX context %p current to drawable %lu", - context, (unsigned long) drawable)); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Making GLX context %p current to drawable %lu", + context, (unsigned long) drawable); if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context)) return FALSE; @@ -506,13 +506,13 @@ gdk_x11_context_create_glx_context (GdkGLContext *context, context_attribs[i++] = None; g_assert (i < N_GLX_ATTRS); - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Creating GLX context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)", - major, minor, - debug_bit ? "yes" : "no", - compat_bit ? "yes" : "no", - legacy ? "yes" : "no", - api == GDK_GL_API_GLES ? "yes" : "no")); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Creating GLX context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)", + major, minor, + debug_bit ? "yes" : "no", + compat_bit ? "yes" : "no", + legacy ? "yes" : "no", + api == GDK_GL_API_GLES ? "yes" : "no"); if (share != NULL) share_glx = GDK_X11_GL_CONTEXT_GLX (share); @@ -539,13 +539,12 @@ gdk_x11_context_create_glx_context (GdkGLContext *context, if (gdk_x11_display_error_trap_pop (display) || ctx == NULL) return 0; - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Realized GLX context[%p], %s, version: %d.%d", - context_glx->glx_context, - glXIsDirect (dpy, context_glx->glx_context) ? "direct" : "indirect", - display_x11->glx_version / 10, - - display_x11->glx_version % 10)); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Realized GLX context[%p], %s, version: %d.%d", + context_glx->glx_context, + glXIsDirect (dpy, context_glx->glx_context) ? "direct" : "indirect", + display_x11->glx_version / 10, + display_x11->glx_version % 10); context_glx->glx_context = ctx; gdk_gl_context_set_is_legacy (context, legacy); @@ -660,7 +659,7 @@ gdk_x11_gl_context_glx_dispose (GObject *gobject) if (glXGetCurrentContext () == context_glx->glx_context) glXMakeContextCurrent (dpy, None, None, NULL); - GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Destroying GLX context")); + GDK_DISPLAY_DEBUG (display, OPENGL, "Destroying GLX context"); glXDestroyContext (dpy, context_glx->glx_context); context_glx->glx_context = NULL; } @@ -771,7 +770,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, { if (best_features < WITH_MULTISAMPLING) { - GDK_NOTE (OPENGL, g_message ("Best GLX config is %u for visual 0x%lX with multisampling", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "Best GLX config is %u for visual 0x%lX with multisampling", i, visinfo->visualid); best_features = WITH_MULTISAMPLING; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -786,7 +785,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, { if (best_features < WITH_STENCIL_AND_DEPTH_BUFFER) { - GDK_NOTE (OPENGL, g_message ("Best GLX config is %u for visual 0x%lX with a stencil or depth buffer", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "Best GLX config is %u for visual 0x%lX with a stencil or depth buffer", i, visinfo->visualid); best_features = WITH_STENCIL_AND_DEPTH_BUFFER; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -800,7 +799,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, { if (best_features < NO_ALPHA_VISUAL) { - GDK_NOTE (OPENGL, g_message ("Best GLX config is %u for visual 0x%lX with no RGBA Visual", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "Best GLX config is %u for visual 0x%lX with no RGBA Visual", i, visinfo->visualid); best_features = NO_ALPHA_VISUAL; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -810,7 +809,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, continue; } - GDK_NOTE (OPENGL, g_message ("GLX config %u for visual 0x%lX is the perfect choice", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "GLX config %u for visual 0x%lX is the perfect choice", i, visinfo->visualid); best_features = PERFECT; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -966,8 +965,8 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11, if (!gdk_x11_display_create_glx_config (display_x11, out_visual, out_depth, error)) return FALSE; - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("GLX version %d.%d found\n" + GDK_DISPLAY_DEBUG (display, OPENGL, + "GLX version %d.%d found\n" " - Vendor: %s\n" " - Checked extensions:\n" "\t* GLX_ARB_create_context_profile: %s\n" @@ -976,8 +975,8 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11, "\t* GLX_EXT_texture_from_pixmap: %s\n" "\t* GLX_SGI_video_sync: %s\n" "\t* GLX_EXT_buffer_age: %s\n" - "\t* GLX_OML_sync_control: %s" - "\t* GLX_ARB_multisample: %s" + "\t* GLX_OML_sync_control: %s\n" + "\t* GLX_ARB_multisample: %s\n" "\t* GLX_EXT_visual_rating: %s", display_x11->glx_version / 10, display_x11->glx_version % 10, @@ -990,7 +989,7 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11, display_x11->has_glx_buffer_age ? "yes" : "no", display_x11->has_glx_sync_control ? "yes" : "no", display_x11->has_glx_multisample ? "yes" : "no", - display_x11->has_glx_visual_rating ? "yes" : "no")); + display_x11->has_glx_visual_rating ? "yes" : "no"); return TRUE; } diff --git a/gdk/x11/gdkselectioninputstream-x11.c b/gdk/x11/gdkselectioninputstream-x11.c index 6e10867abd..2f2ed7d6e8 100644 --- a/gdk/x11/gdkselectioninputstream-x11.c +++ b/gdk/x11/gdkselectioninputstream-x11.c @@ -135,9 +135,10 @@ gdk_x11_selection_input_stream_flush (GdkX11SelectionInputStream *stream) return; written = gdk_x11_selection_input_stream_fill_buffer (stream, priv->pending_data, priv->pending_size); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: finishing read of %zd/%zu bytes\n", - priv->selection, priv->target, - written, priv->pending_size)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: finishing read of %zd/%zu bytes", + priv->selection, priv->target, + written, priv->pending_size); g_task_return_int (priv->pending_task, written); g_clear_object (&priv->pending_task); @@ -153,8 +154,9 @@ gdk_x11_selection_input_stream_complete (GdkX11SelectionInputStream *stream) if (priv->complete) return; - GDK_NOTE (SELECTION, g_printerr ("%s:%s: transfer complete\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: transfer complete", + priv->selection, priv->target); priv->complete = TRUE; g_async_queue_push (priv->chunks, g_bytes_new (NULL, 0)); @@ -181,13 +183,13 @@ gdk_x11_selection_input_stream_read (GInputStream *input_stream, #endif gssize written; - GDK_NOTE (SELECTION, g_printerr ("%s:%s: starting sync read of %zu bytes\n", - priv->selection, priv->target, - count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: starting sync read of %zu bytes", + priv->selection, priv->target, count); written = gdk_x11_selection_input_stream_fill_buffer (stream, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: finishing sync read of %zd/%zu bytes\n", - priv->selection, priv->target, - written, count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: finishing sync read of %zd/%zu bytes", + priv->selection, priv->target, written, count); return written; } @@ -221,9 +223,9 @@ gdk_x11_selection_input_stream_read_async (GInputStream *input_stream, gssize size; size = gdk_x11_selection_input_stream_fill_buffer (stream, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: async read of %zd/%zu bytes\n", - priv->selection, priv->target, - size, count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: async read of %zd/%zu bytes", + priv->selection, priv->target, size, count); g_task_return_int (task, size); g_object_unref (task); } @@ -232,9 +234,9 @@ gdk_x11_selection_input_stream_read_async (GInputStream *input_stream, priv->pending_data = buffer; priv->pending_size = count; priv->pending_task = task; - GDK_NOTE (SELECTION, g_printerr ("%s:%s: async read of %zu bytes pending\n", - priv->selection, priv->target, - count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: async read of %zu bytes pending", + priv->selection, priv->target, count); } } @@ -410,23 +412,26 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, bytes = get_selection_property (xdisplay, xwindow, xevent->xproperty.atom, &type, &format); if (bytes == NULL) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify erroring out of INCR\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify erroring out of INCR", + priv->selection, priv->target); /* error, should we signal one? */ gdk_x11_selection_input_stream_complete (stream); } else if (g_bytes_get_size (bytes) == 0 || type == None) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify ending INCR\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify ending INCR", + priv->selection, priv->target); g_bytes_unref (bytes); gdk_x11_selection_input_stream_complete (stream); } else { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify during INCR with %zu bytes\n", - priv->selection, priv->target, - g_bytes_get_size (bytes))); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify during INCR with %zu bytes", + priv->selection, priv->target, + g_bytes_get_size (bytes)); g_async_queue_push (priv->chunks, bytes); gdk_x11_selection_input_stream_flush (stream); } @@ -449,7 +454,9 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, g_task_get_source_tag (priv->pending_task) != gdk_x11_selection_input_stream_new_async) return FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got SelectionNotify\n", priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got SelectionNotify", + priv->selection, priv->target); task = priv->pending_task; priv->pending_task = NULL; @@ -470,7 +477,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, g_task_return_pointer (task, g_object_ref (stream), g_object_unref); if (bytes == NULL) - { + { gdk_x11_selection_input_stream_complete (stream); } else @@ -479,15 +486,18 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, { /* The remainder of the selection will come through PropertyNotify events on xwindow */ - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n", priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: initiating INCR transfer", + priv->selection, priv->target); priv->incr = TRUE; gdk_x11_selection_input_stream_flush (stream); } else { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: reading %zu bytes\n", - priv->selection, priv->target, - g_bytes_get_size (bytes))); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: reading %zu bytes", + priv->selection, priv->target, + g_bytes_get_size (bytes)); g_async_queue_push (priv->chunks, bytes); gdk_x11_selection_input_stream_complete (stream); diff --git a/gdk/x11/gdkselectionoutputstream-x11.c b/gdk/x11/gdkselectionoutputstream-x11.c index da77d5db82..d81d995fc9 100644 --- a/gdk/x11/gdkselectionoutputstream-x11.c +++ b/gdk/x11/gdkselectionoutputstream-x11.c @@ -118,17 +118,19 @@ gdk_x11_pending_selection_notify_send (GdkX11PendingSelectionNotify *notify, notify->n_pending--; if (notify->n_pending) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: not sending SelectionNotify yet, %zu streams still pending\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), - notify->n_pending)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: not sending SelectionNotify yet, %zu streams still pending", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), + notify->n_pending); return; } - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: sending SelectionNotify reporting %s\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), - success ? "success" : "failure")); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: sending SelectionNotify reporting %s", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), + success ? "success" : "failure"); if (!success) notify->xevent.property = None; @@ -138,19 +140,21 @@ gdk_x11_pending_selection_notify_send (GdkX11PendingSelectionNotify *notify, if (XSendEvent (xdisplay, notify->xevent.requestor, False, NoEventMask, (XEvent*) ¬ify->xevent) == 0) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: failed to XSendEvent()\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target))); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: failed to XSendEvent()", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target)); } XSync (xdisplay, False); error = gdk_x11_display_error_trap_pop (display); if (error != Success) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: X error during write: %d\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), - error)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: X error during write: %d", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), + error); } gdk_x11_pending_selection_notify_free (notify); @@ -254,8 +258,9 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre XWindowAttributes attrs; priv->incr = TRUE; - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: initiating INCR transfer", + priv->selection, priv->target); XGetWindowAttributes (xdisplay, priv->xwindow, @@ -284,8 +289,9 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre PropModeReplace, priv->data->data, n_elements); - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: wrote %zu/%u bytes\n", - priv->selection, priv->target, n_elements * element_size, priv->data->len)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: wrote %zu/%u bytes", + priv->selection, priv->target, n_elements * element_size, priv->data->len); g_byte_array_remove_range (priv->data, 0, n_elements * element_size); if (priv->data->len < element_size) priv->flush_requested = FALSE; @@ -308,8 +314,9 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre error = gdk_x11_display_error_trap_pop (priv->display); if (error != Success) { - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: X error during write: %d\n", - priv->selection, priv->target, error)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: X error during write: %d", + priv->selection, priv->target, error); } if (priv->pending_task) @@ -344,8 +351,9 @@ gdk_x11_selection_output_stream_write (GOutputStream *output_stream, g_mutex_lock (&priv->mutex); g_byte_array_append (priv->data, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: wrote %zu bytes, %u total now\n", - priv->selection, priv->target, count, priv->data->len)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: wrote %zu bytes, %u total now", + priv->selection, priv->target, count, priv->data->len); g_mutex_unlock (&priv->mutex); g_main_context_invoke (NULL, gdk_x11_selection_output_stream_invoke_flush, stream); @@ -377,8 +385,9 @@ gdk_x11_selection_output_stream_write_async (GOutputStream *output_stream g_mutex_lock (&priv->mutex); g_byte_array_append (priv->data, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: async wrote %zu bytes, %u total now\n", - priv->selection, priv->target, count, priv->data->len)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: async wrote %zu bytes, %u total now", + priv->selection, priv->target, count, priv->data->len); g_mutex_unlock (&priv->mutex); if (!gdk_x11_selection_output_stream_needs_flush (stream)) @@ -428,8 +437,9 @@ gdk_x11_selection_output_request_flush (GdkX11SelectionOutputStream *stream) needs_flush = gdk_x11_selection_output_stream_needs_flush_unlocked (stream); g_mutex_unlock (&priv->mutex); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: requested flush%s\n", - priv->selection, priv->target, needs_flush ?"" : ", but not needed")); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: requested flush%s", + priv->selection, priv->target, needs_flush ?"" : ", but not needed"); return needs_flush; } @@ -511,8 +521,9 @@ gdk_x11_selection_output_stream_finalize (GObject *object) /* not sending a notify is terrible */ g_assert (priv->notify == NULL); - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: finalizing\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: finalizing", + priv->selection, priv->target); GDK_X11_DISPLAY (priv->display)->streams = g_slist_remove (GDK_X11_DISPLAY (priv->display)->streams, stream); g_signal_handlers_disconnect_by_func (priv->display, gdk_x11_selection_output_stream_xevent, @@ -580,8 +591,9 @@ gdk_x11_selection_output_stream_xevent (GdkDisplay *display, xevent->xproperty.state != PropertyDelete) return FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify Delete during INCR\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify Delete during INCR", + priv->selection, priv->target); priv->delete_pending = FALSE; if (gdk_x11_selection_output_stream_needs_flush (stream) && gdk_x11_selection_output_stream_can_flush (stream)) @@ -641,16 +653,20 @@ print_atoms (GdkDisplay *display, const Atom *atoms, gsize n_atoms) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - gsize i; - - g_printerr ("%s: %s [ ", selection, prefix); - for (i = 0; i < n_atoms; i++) - { - g_printerr ("%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); - } - g_printerr (" ]\n"); - ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD)) + { + GString *str; + + str = g_string_new (""); + g_string_append_printf (str, "%s: %s [ ", selection, prefix); + for (gsize i = 0; i < n_atoms; i++) + g_string_append_printf (str, "%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); + g_string_append (str, " ]"); + gdk_debug_message ("%s", str->str); + g_string_free (str, TRUE); + } +#endif } static void @@ -663,8 +679,8 @@ handle_targets_done (GObject *stream, if (!g_output_stream_write_all_finish (G_OUTPUT_STREAM (stream), result, &bytes_written, &error)) { - GDK_NOTE (CLIPBOARD, g_printerr ("---: failed to send targets after %zu bytes: %s\n", - bytes_written, error->message)); + GDK_DEBUG (CLIPBOARD, "---: failed to send targets after %zu bytes: %s", + bytes_written, error->message); g_error_free (error); } @@ -710,8 +726,8 @@ handle_timestamp_done (GObject *stream, if (!g_output_stream_write_all_finish (G_OUTPUT_STREAM (stream), result, &bytes_written, &error)) { - GDK_NOTE (CLIPBOARD, g_printerr ("---: failed to send timestamp after %zu bytes: %s\n", - bytes_written, error->message)); + GDK_DEBUG (CLIPBOARD, "---: failed to send timestamp after %zu bytes: %s", + bytes_written, error->message); g_error_free (error); } @@ -873,14 +889,16 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, &n_atoms, &nbytes, (guchar **) &atoms); if (error != Success) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: XGetProperty() during MULTIPLE failed with %d\n", - selection, error)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: XGetProperty() during MULTIPLE failed with %d", + selection, error); } else if (prop_format != 32 || prop_type != gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR")) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: XGetProperty() type/format should be ATOM_PAIR/32 but is %s/%d\n", - selection, gdk_x11_get_xatom_name_for_display (display, prop_type), prop_format)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: XGetProperty() type/format should be ATOM_PAIR/32 but is %s/%d", + selection, gdk_x11_get_xatom_name_for_display (display, prop_type), prop_format); } else if (n_atoms < 2) { @@ -893,8 +911,9 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, print_atoms (display, selection, "MULTIPLE request", atoms, n_atoms); if (n_atoms % 2) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: Number of atoms is uneven at %lu, ignoring last element\n", - selection, n_atoms)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: Number of atoms is uneven at %lu, ignoring last element", + selection, n_atoms); n_atoms &= ~1; } @@ -907,15 +926,17 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, if (atoms[2 * i] == None || atoms[2 * i + 1] == None) { success = FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: None not allowed as atom in MULTIPLE request\n", - selection)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: None not allowed as atom in MULTIPLE request", + selection); gdk_x11_pending_selection_notify_send (notify, display, FALSE); } else if (atoms[2 * i] == gdk_x11_get_xatom_by_name_for_display (display, "MULTIPLE")) { success = FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: MULTIPLE as target in MULTIPLE request would cause recursion\n", - selection)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: MULTIPLE as target in MULTIPLE request would cause recursion", + selection); gdk_x11_pending_selection_notify_send (notify, display, FALSE); } else diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index f92649782d..2e8bd45c74 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -271,8 +271,8 @@ parse_settings (unsigned char *data, !fetch_card32 (&buffer, &n_entries)) goto out; - GDK_NOTE (SETTINGS, g_message ("reading %lu settings (serial %lu byte order %u)", - (unsigned long)n_entries, (unsigned long)serial, buffer.byte_order)); + GDK_DEBUG (SETTINGS, "reading %lu settings (serial %lu byte order %u)", + (unsigned long)n_entries, (unsigned long)serial, buffer.byte_order); for (i = 0; i < n_entries; i++) { @@ -303,7 +303,7 @@ parse_settings (unsigned char *data, g_value_init (value, G_TYPE_INT); g_value_set_int (value, (gint32) v_int); - GDK_NOTE (SETTINGS, g_message (" %s = %d", x_name, (gint32) v_int)); + GDK_DEBUG (SETTINGS, " %s = %d", x_name, (gint32) v_int); break; case XSETTINGS_TYPE_STRING: { @@ -317,7 +317,7 @@ parse_settings (unsigned char *data, g_value_init (value, G_TYPE_STRING); g_value_take_string (value, s); - GDK_NOTE (SETTINGS, g_message (" %s = \"%s\"", x_name, s)); + GDK_DEBUG (SETTINGS, " %s = \"%s\"", x_name, s); } break; case XSETTINGS_TYPE_COLOR: @@ -340,12 +340,12 @@ parse_settings (unsigned char *data, g_value_init (value, GDK_TYPE_RGBA); g_value_set_boxed (value, &rgba); - GDK_NOTE (SETTINGS, g_message (" %s = #%02X%02X%02X%02X", x_name, alpha,red, green, blue)); + GDK_DEBUG (SETTINGS, " %s = #%02X%02X%02X%02X", x_name, alpha,red, green, blue); } break; default: /* Quietly ignore unknown types */ - GDK_NOTE (SETTINGS, g_message (" %s = ignored (unknown type %u)", x_name, type)); + GDK_DEBUG (SETTINGS, " %s = ignored (unknown type %u)", x_name, type); break; } @@ -355,12 +355,12 @@ parse_settings (unsigned char *data, if (gdk_name == NULL) { - GDK_NOTE (SETTINGS, g_message (" ==> unknown to GTK")); + GDK_DEBUG (SETTINGS, " ==> unknown to GTK"); free_value (value); } else { - GDK_NOTE (SETTINGS, g_message (" ==> storing as '%s'", gdk_name)); + GDK_DEBUG (SETTINGS, " ==> storing as '%s'", gdk_name); if (settings == NULL) settings = g_hash_table_new_full (g_str_hash, g_str_equal, |