From 0f2a33cc9ce6f0dd5836739a5f7129def25c517f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 2 Apr 2020 15:59:20 +0200 Subject: [PATCH] tests/test-client: Add line breaks to warning messages When toying with the test client to try to reproduce issues (e.g. writing commands on stdin to create and manipulate windows), when you write a command incorrectly you'll get a warning printed to standard out. The problem, however, is that it doesn't include a line break in the end, meaning when you type the correct command, it won't be on a new line. Fix this minor annoyance by adding line breaks to all warning messages. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1171 --- src/tests/test-client.c | 84 ++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/tests/test-client.c b/src/tests/test-client.c index 3bb2a9a02..5687204bf 100644 --- a/src/tests/test-client.c +++ b/src/tests/test-client.c @@ -48,7 +48,7 @@ window_export_handle_cb (GdkWindow *window, if (!gdk_wayland_window_set_transient_for_exported (gdk_window, (gchar *) handle_str)) - g_print ("Fail to set transient_for exported window handle %s", handle_str); + g_print ("Fail to set transient_for exported window handle %s\n", handle_str); gdk_window_set_modal_hint (gdk_window, TRUE); } @@ -57,7 +57,7 @@ lookup_window (const char *window_id) { GtkWidget *window = g_hash_table_lookup (windows, window_id); if (!window) - g_print ("Window %s doesn't exist", window_id); + g_print ("Window %s doesn't exist\n", window_id); return window; } @@ -251,14 +251,14 @@ process_line (const char *line) if (!g_shell_parse_argv (line, &argc, &argv, &error)) { - g_print ("error parsing command: %s", error->message); + g_print ("error parsing command: %s\n", error->message); g_error_free (error); return; } if (argc < 1) { - g_print ("Empty command"); + g_print ("Empty command\n"); goto out; } @@ -268,13 +268,13 @@ process_line (const char *line) if (argc < 2) { - g_print ("usage: create [override|csd]"); + g_print ("usage: create [override|csd]\n"); goto out; } if (g_hash_table_lookup (windows, argv[1])) { - g_print ("window %s already exists", argv[1]); + g_print ("window %s already exists\n", argv[1]); goto out; } @@ -290,7 +290,7 @@ process_line (const char *line) if (override && csd) { - g_print ("override and csd keywords are exclusie"); + g_print ("override and csd keywords are exclusive\n"); goto out; } @@ -334,21 +334,21 @@ process_line (const char *line) { if (argc != 3) { - g_print ("usage: set_parent "); + g_print ("usage: set_parent \n"); goto out; } GtkWidget *window = lookup_window (argv[1]); if (!window) { - g_print ("unknown window %s", argv[1]); + g_print ("unknown window %s\n", argv[1]); goto out; } GtkWidget *parent_window = lookup_window (argv[2]); if (!parent_window) { - g_print ("unknown parent window %s", argv[2]); + g_print ("unknown parent window %s\n", argv[2]); goto out; } @@ -359,21 +359,21 @@ process_line (const char *line) { if (argc != 3) { - g_print ("usage: set_parent_exported "); + g_print ("usage: set_parent_exported \n"); goto out; } GtkWidget *window = lookup_window (argv[1]); if (!window) { - g_print ("unknown window %s", argv[1]); + g_print ("unknown window %s\n", argv[1]); goto out; } GtkWidget *parent_window = lookup_window (argv[2]); if (!parent_window) { - g_print ("unknown parent window %s", argv[2]); + g_print ("unknown parent window %s\n", argv[2]); goto out; } @@ -382,27 +382,27 @@ process_line (const char *line) window_export_handle_cb, window, NULL)) - g_print ("Fail to export handle for window id %s", argv[2]); + g_print ("Fail to export handle for window id %s\n", argv[2]); } else if (strcmp (argv[0], "accept_focus") == 0) { if (argc != 3) { - g_print ("usage: %s [true|false]", argv[0]); + g_print ("usage: %s [true|false]\n", argv[0]); goto out; } GtkWidget *window = lookup_window (argv[1]); if (!window) { - g_print ("unknown window %s", argv[1]); + g_print ("unknown window %s\n", argv[1]); goto out; } if (!wayland && window_has_x11_event_handler (window, handle_take_focus)) { - g_print ("Impossible to use %s for windows accepting take focus", + g_print ("Impossible to use %s for windows accepting take focus\n", argv[1]); goto out; } @@ -414,26 +414,26 @@ process_line (const char *line) { if (argc != 3) { - g_print ("usage: %s [true|false]", argv[0]); + g_print ("usage: %s [true|false]\n", argv[0]); goto out; } GtkWidget *window = lookup_window (argv[1]); if (!window) { - g_print ("unknown window %s", argv[1]); + g_print ("unknown window %s\n", argv[1]); goto out; } if (wayland) { - g_print ("%s not supported under wayland", argv[0]); + g_print ("%s not supported under wayland\n", argv[0]); goto out; } if (window_has_x11_event_handler (window, handle_take_focus)) { - g_print ("Impossible to change %s for windows accepting take focus", + g_print ("Impossible to change %s for windows accepting take focus\n", argv[1]); goto out; } @@ -473,32 +473,32 @@ process_line (const char *line) { if (argc != 3) { - g_print ("usage: %s [true|false]", argv[0]); + g_print ("usage: %s [true|false]\n", argv[0]); goto out; } GtkWidget *window = lookup_window (argv[1]); if (!window) { - g_print ("unknown window %s", argv[1]); + g_print ("unknown window %s\n", argv[1]); goto out; } if (wayland) { - g_print ("%s not supported under wayland", argv[0]); + g_print ("%s not supported under wayland\n", argv[0]); goto out; } if (gtk_window_get_accept_focus (GTK_WINDOW (window))) { - g_print ("%s not supported for input windows", argv[0]); + g_print ("%s not supported for input windows\n", argv[0]); goto out; } if (!g_object_get_qdata (G_OBJECT (window), can_take_focus_quark)) { - g_print ("%s not supported for windows with no WM_TAKE_FOCUS set", + g_print ("%s not supported for windows with no WM_TAKE_FOCUS set\n", argv[0]); goto out; } @@ -512,7 +512,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: show "); + g_print ("usage: show \n"); goto out; } @@ -527,7 +527,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: hide "); + g_print ("usage: hide \n"); goto out; } @@ -541,7 +541,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: activate "); + g_print ("usage: activate \n"); goto out; } @@ -555,7 +555,7 @@ process_line (const char *line) { if (argc != 4) { - g_print ("usage: resize "); + g_print ("usage: resize \n"); goto out; } @@ -571,7 +571,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: raise "); + g_print ("usage: raise \n"); goto out; } @@ -585,7 +585,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: lower "); + g_print ("usage: lower \n"); goto out; } @@ -599,7 +599,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: destroy "); + g_print ("usage: destroy \n"); goto out; } @@ -614,7 +614,7 @@ process_line (const char *line) { if (argc != 1) { - g_print ("usage: destroy_all"); + g_print ("usage: destroy_all\n"); goto out; } @@ -631,7 +631,7 @@ process_line (const char *line) { if (argc != 1) { - g_print ("usage: sync"); + g_print ("usage: sync\n"); goto out; } @@ -644,13 +644,13 @@ process_line (const char *line) if (argc != 3) { - g_print ("usage: set_counter "); + g_print ("usage: set_counter \n"); goto out; } if (wayland) { - g_print ("usage: set_counter can only be used for X11"); + g_print ("usage: set_counter can only be used for X11\n"); goto out; } @@ -666,7 +666,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: minimize "); + g_print ("usage: minimize \n"); goto out; } @@ -680,7 +680,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: unminimize "); + g_print ("usage: unminimize \n"); goto out; } @@ -694,7 +694,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: maximize "); + g_print ("usage: maximize \n"); goto out; } @@ -708,7 +708,7 @@ process_line (const char *line) { if (argc != 2) { - g_print ("usage: unmaximize "); + g_print ("usage: unmaximize \n"); goto out; } @@ -720,7 +720,7 @@ process_line (const char *line) } else { - g_print ("Unknown command %s", argv[0]); + g_print ("Unknown command %s\n", argv[0]); goto out; }