From 660af0f497d3a3a900d6f7b820c565868ed41bfc Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Sun, 13 Oct 2024 11:22:42 -0400 Subject: [PATCH] Improve screenshot logging, fix debug mode. The --verbose flag wasn't working. --- src/screenshot.c | 12 ++++++++++++ src/xdg-desktop-portal-xapp.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/screenshot.c b/src/screenshot.c index ae9b66d..eaaa5b5 100644 --- a/src/screenshot.c +++ b/src/screenshot.c @@ -52,6 +52,8 @@ send_response (ScreenshotHandle *handle) if (handle->request->exported) request_unexport (handle->request); + g_debug ("Sending screenshot/pickcolor response"); + if (strcmp (handle->retval, "url") == 0) { GVariantBuilder opt_builder; @@ -137,6 +139,8 @@ cinnamon_color_pick_done (GObject *source, handle->response = 2; } + g_debug ("ColorPicker returned: %f %f %f", handle->red, handle->green, handle->blue); + handle->response = 0; send_response (handle); @@ -203,6 +207,8 @@ construct_filename (void) // saved to. The placeholder is a timestamp, e.g. "2017-05-21 12-24-03". filename = g_strdup_printf ("%s/Screenshot from %s.png", pic_dir, timestamp); + g_debug ("Saving screenshot to %s", filename); + g_free (timestamp); g_date_time_unref (datetime); @@ -225,6 +231,8 @@ handle_pick_color (XdpImplScreenshot *object, sender = g_dbus_method_invocation_get_sender (invocation); request = request_new (sender, arg_app_id, arg_handle); + g_debug ("Got new PickColor request from '%s'", sender); + handle = g_new0 (ScreenshotHandle, 1); handle->impl = object; handle->invocation = invocation; @@ -278,6 +286,8 @@ handle_screenshot (XdpImplScreenshot *object, GSubprocess *proc; GError *error = NULL; + g_debug ("Using xfce4-screenshooter to handle screenshot"); + const gchar *argv[] = { "xfce4-screenshooter", "-f", @@ -300,6 +310,7 @@ handle_screenshot (XdpImplScreenshot *object, else if (CINNAMON_MODE) { + g_debug ("Calling Cinnamon to handle screenshot"); org_gnome_shell_screenshot_call_screenshot (cinnamon, FALSE, TRUE, @@ -311,6 +322,7 @@ handle_screenshot (XdpImplScreenshot *object, else { // mate + g_debug ("Screenshot not supported in MATE"); handle->response = 2; send_response (handle); } diff --git a/src/xdg-desktop-portal-xapp.c b/src/xdg-desktop-portal-xapp.c index 8f65797..2e8e6d2 100644 --- a/src/xdg-desktop-portal-xapp.c +++ b/src/xdg-desktop-portal-xapp.c @@ -240,7 +240,7 @@ main (int argc, char *argv[]) g_set_printerr_handler (printerr_handler); if (opt_verbose) - g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL); g_set_prgname ("xdg-desktop-portal-xapp");