From 1f08a037944048031cdff4a7d1256e74300775f0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 9 Oct 2024 07:35:21 -0700
Subject: [PATCH] Switched drag-n-drop logging to trace level
The logging is extremely verbose and covers the entire data exchange process, which is more suited to the trace level.
---
src/video/cocoa/SDL_cocoawindow.m | 10 +++---
src/video/wayland/SDL_waylanddatamanager.c | 4 +--
src/video/wayland/SDL_waylandevents.c | 38 +++++++++++-----------
3 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index d70c681c88cdf..2504d9677f0fa 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -199,7 +199,7 @@ - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
{
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". [SDL] In performDragOperation, draggingSourceOperationMask %lx, "
"expected Generic %lx, others Copy %lx, Link %lx, Private %lx, Move %lx, Delete %lx\n",
(unsigned long)[sender draggingSourceOperationMask],
@@ -210,7 +210,7 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
(unsigned long)NSDragOperationMove,
(unsigned long)NSDragOperationDelete);
if ([sender draggingPasteboard]) {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". [SDL] In performDragOperation, valid draggingPasteboard, "
"name [%s] '%s', changeCount %ld\n",
[[[[sender draggingPasteboard] name] className] UTF8String],
@@ -229,7 +229,7 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
for (NSString *supportedType in [pasteboard types]) {
NSString *typeString = [pasteboard stringForType:supportedType];
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". [SDL] In performDragOperation, Pasteboard type '%s', stringForType (%lu) '%s'\n",
[[supportedType description] UTF8String],
(unsigned long)[[typeString description] length],
@@ -281,7 +281,7 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
}
}
}
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". [SDL] In performDragOperation, desiredType '%s', "
"Submitting DropFile as (%lu) '%s'\n",
[[desiredType description] UTF8String],
@@ -296,7 +296,7 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
char *saveptr = NULL;
char *token = SDL_strtok_r(buffer, "\r\n", &saveptr);
while (token) {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". [SDL] In performDragOperation, desiredType '%s', "
"Submitting DropText as (%lu) '%s'\n",
[[desiredType description] UTF8String],
diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c
index dc04af5b5c8e9..6ab25f5cab845 100644
--- a/src/video/wayland/SDL_waylanddatamanager.c
+++ b/src/video/wayland/SDL_waylanddatamanager.c
@@ -381,7 +381,7 @@ void *Wayland_data_offer_receive(SDL_WaylandDataOffer *offer,
}
close(pipefd[0]);
}
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In Wayland_data_offer_receive for '%s', buffer (%ld) at %p\n",
mime_type, *length, buffer);
return buffer;
@@ -417,7 +417,7 @@ void *Wayland_primary_selection_offer_receive(SDL_WaylandPrimarySelectionOffer *
}
close(pipefd[0]);
}
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In Wayland_primary_selection_offer_receive for '%s', buffer (%ld) at %p\n",
mime_type, *length, buffer);
return buffer;
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 9e8f7677fbea3..816fa0a7c2dbf 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -1991,7 +1991,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *wl_data_of
{
SDL_WaylandDataOffer *offer = data;
Wayland_data_offer_add_mime(offer, mime_type);
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_offer_listener . data_offer_handle_offer on data_offer 0x%08x for MIME '%s'\n",
(wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1),
mime_type);
@@ -2000,7 +2000,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *wl_data_of
static void data_offer_handle_source_actions(void *data, struct wl_data_offer *wl_data_offer,
uint32_t source_actions)
{
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_offer_listener . data_offer_handle_source_actions on data_offer 0x%08x for Source Actions '%d'\n",
(wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1),
source_actions);
@@ -2009,7 +2009,7 @@ static void data_offer_handle_source_actions(void *data, struct wl_data_offer *w
static void data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_offer,
uint32_t dnd_action)
{
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_offer_listener . data_offer_handle_actions on data_offer 0x%08x for DND Actions '%d'\n",
(wl_data_offer ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)wl_data_offer) : -1),
dnd_action);
@@ -2026,7 +2026,7 @@ static void primary_selection_offer_handle_offer(void *data, struct zwp_primary_
{
SDL_WaylandPrimarySelectionOffer *offer = data;
Wayland_primary_selection_offer_add_mime(offer, mime_type);
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In zwp_primary_selection_offer_v1_listener . primary_selection_offer_handle_offer on primary_selection_offer 0x%08x for MIME '%s'\n",
(zwp_primary_selection_offer_v1 ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)zwp_primary_selection_offer_v1) : -1),
mime_type);
@@ -2046,7 +2046,7 @@ static void data_device_handle_data_offer(void *data, struct wl_data_device *wl_
WAYLAND_wl_list_init(&(data_offer->mimes));
wl_data_offer_set_user_data(id, data_offer);
wl_data_offer_add_listener(id, &data_offer_listener, data_offer);
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_data_offer on data_offer 0x%08x\n",
(id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1));
}
@@ -2104,25 +2104,25 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_
const float dx = (float)wl_fixed_to_double(x);
const float dy = (float)wl_fixed_to_double(y);
SDL_SendDropPosition(data_device->dnd_window, dx, dy);
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d into window %d for serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)id),
wl_fixed_to_int(x), wl_fixed_to_int(y), SDL_GetWindowID(data_device->dnd_window), serial);
} else {
data_device->dnd_window = NULL;
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)id),
wl_fixed_to_int(x), wl_fixed_to_int(y), serial);
}
} else {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)id),
wl_fixed_to_int(x), wl_fixed_to_int(y), serial);
}
} else {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_enter on data_offer 0x%08x at %d x %d for serial %d\n",
-1, wl_fixed_to_int(x), wl_fixed_to_int(y), serial);
}
@@ -2134,12 +2134,12 @@ static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_
if (data_device->drag_offer) {
if (data_device->dnd_window) {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x from window %d for serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer),
SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial);
} else {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer),
data_device->drag_serial);
@@ -2147,7 +2147,7 @@ static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_
Wayland_data_offer_destroy(data_device->drag_offer);
data_device->drag_offer = NULL;
} else {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_leave on data_offer 0x%08x for serial %d\n",
-1, -1);
}
@@ -2169,13 +2169,13 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data
* hammer the DBus interface hundreds or even thousands of times per second.
*/
SDL_SendDropPosition(data_device->dnd_window, dx, dy);
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d in window %d serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer),
wl_fixed_to_int(x), wl_fixed_to_int(y),
SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial);
} else {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_motion on data_offer 0x%08x at %d x %d serial %d\n",
-1, wl_fixed_to_int(x), wl_fixed_to_int(y), -1);
}
@@ -2186,7 +2186,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
SDL_WaylandDataDevice *data_device = data;
if (data_device->drag_offer && data_device->dnd_window && (data_device->has_mime_file || data_device->has_mime_text)) {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x in window %d serial %d\n",
WAYLAND_wl_proxy_get_id((struct wl_proxy *)data_device->drag_offer->offer),
SDL_GetWindowID(data_device->dnd_window), data_device->drag_serial);
@@ -2268,7 +2268,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
wl_data_offer_finish(data_device->drag_offer->offer);
}
} else {
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In wl_data_device_listener . data_device_handle_drop on data_offer 0x%08x serial %d\n",
-1, -1);
}
@@ -2321,7 +2321,7 @@ static void data_device_handle_selection(void *data, struct wl_data_device *wl_d
offer = wl_data_offer_get_user_data(id);
}
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In data_device_listener . data_device_handle_selection on data_offer 0x%08x\n",
(id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1));
if (data_device->selection_offer != offer) {
@@ -2352,7 +2352,7 @@ static void primary_selection_device_handle_offer(void *data, struct zwp_primary
zwp_primary_selection_offer_v1_set_user_data(id, primary_selection_offer);
zwp_primary_selection_offer_v1_add_listener(id, &primary_selection_offer_listener, primary_selection_offer);
}
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In zwp_primary_selection_device_v1_listener . primary_selection_device_handle_offer on primary_selection_offer 0x%08x\n",
(id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1));
}
@@ -2371,7 +2371,7 @@ static void primary_selection_device_handle_selection(void *data, struct zwp_pri
Wayland_primary_selection_offer_destroy(primary_selection_device->selection_offer);
primary_selection_device->selection_offer = offer;
}
- SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
+ SDL_LogTrace(SDL_LOG_CATEGORY_INPUT,
". In zwp_primary_selection_device_v1_listener . primary_selection_device_handle_selection on primary_selection_offer 0x%08x\n",
(id ? WAYLAND_wl_proxy_get_id((struct wl_proxy *)id) : -1));