x11: Replace meta_warning() with g_warning()

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4005>
This commit is contained in:
Jonas Ådahl 2024-09-09 16:26:06 +02:00 committed by Marge Bot
parent f44bf9fa40
commit 66c7b05991
6 changed files with 50 additions and 46 deletions

View File

@ -924,7 +924,7 @@ make_shadow (MetaShadow *shadow,
if (error) if (error)
{ {
meta_warning ("Failed to allocate shadow texture: %s", error->message); g_warning ("Failed to allocate shadow texture: %s", error->message);
g_error_free (error); g_error_free (error);
} }

View File

@ -366,9 +366,11 @@ meta_x11_display_dispose (GObject *object)
mtk_x11_error_trap_push (x11_display->xdisplay); mtk_x11_error_trap_push (x11_display->xdisplay);
XSelectInput (x11_display->xdisplay, x11_display->xroot, 0); XSelectInput (x11_display->xdisplay, x11_display->xroot, 0);
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success) if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
meta_warning ("Could not release screen %d on display \"%s\"", {
DefaultScreen (x11_display->xdisplay), g_warning ("Could not release screen %d on display \"%s\"",
x11_display->name); DefaultScreen (x11_display->xdisplay),
x11_display->name);
}
x11_display->xroot = None; x11_display->xroot = None;
} }
@ -647,7 +649,7 @@ init_x11_bell (MetaX11Display *x11_display)
NULL, NULL)) NULL, NULL))
{ {
x11_display->xkb_base_event_type = -1; x11_display->xkb_base_event_type = -1;
meta_warning ("could not find XKB extension."); g_warning ("Could not find XKB extension.");
} }
else else
{ {
@ -853,8 +855,10 @@ take_manager_selection (MetaX11Display *x11_display,
} }
else else
{ {
meta_warning (_("Display “%s” already has a window manager; try using the --replace option to replace the current window manager."), g_warning (_("Display “%s” already has a window manager; "
x11_display->name); "try using the --replace option to replace "
"the current window manager."),
x11_display->name);
return None; return None;
} }
} }
@ -868,7 +872,8 @@ take_manager_selection (MetaX11Display *x11_display,
if (XGetSelectionOwner (x11_display->xdisplay, manager_atom) != new_owner) if (XGetSelectionOwner (x11_display->xdisplay, manager_atom) != new_owner)
{ {
meta_warning ("Could not acquire selection: %s", XGetAtomName (x11_display->xdisplay, manager_atom)); g_warning ("Could not acquire selection: %s",
XGetAtomName (x11_display->xdisplay, manager_atom));
return None; return None;
} }
@ -1234,11 +1239,9 @@ open_x_display (MetaDisplay *display,
if (xdisplay == NULL) if (xdisplay == NULL)
{ {
meta_warning (_("Failed to open X Window System display “%s”"),
xdisplay_name);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to open X11 display"); _("Failed to open X Window System display “%s”"),
xdisplay_name);
return NULL; return NULL;
} }
@ -1469,11 +1472,9 @@ meta_x11_display_new (MetaDisplay *display,
*/ */
if (xroot == None) if (xroot == None)
{ {
meta_warning (_("Screen %d on display “%s” is invalid"),
number, XDisplayName (NULL));
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to open default X11 screen"); _("Screen %d on display “%s” is invalid"),
number, XDisplayName (NULL));
XFlush (xdisplay); XFlush (xdisplay);
XCloseDisplay (xdisplay); XCloseDisplay (xdisplay);

View File

@ -909,15 +909,15 @@ save_state (MetaContext *context)
if (mkdir (mutter_dir, 0700) < 0 && if (mkdir (mutter_dir, 0700) < 0 &&
errno != EEXIST) errno != EEXIST)
{ {
meta_warning ("Could not create directory '%s': %s", g_warning ("Could not create directory '%s': %s",
mutter_dir, g_strerror (errno)); mutter_dir, g_strerror (errno));
} }
if (mkdir (session_dir, 0700) < 0 && if (mkdir (session_dir, 0700) < 0 &&
errno != EEXIST) errno != EEXIST)
{ {
meta_warning ("Could not create directory '%s': %s", g_warning ("Could not create directory '%s': %s",
session_dir, g_strerror (errno)); session_dir, g_strerror (errno));
} }
meta_topic (META_DEBUG_SM, "Saving session to '%s'", full_save_file ()); meta_topic (META_DEBUG_SM, "Saving session to '%s'", full_save_file ());
@ -926,8 +926,8 @@ save_state (MetaContext *context)
if (outfile == NULL) if (outfile == NULL)
{ {
meta_warning ("Could not open session file '%s' for writing: %s", g_warning ("Could not open session file '%s' for writing: %s",
full_save_file (), g_strerror (errno)); full_save_file (), g_strerror (errno));
goto out; goto out;
} }
@ -1072,13 +1072,13 @@ save_state (MetaContext *context)
/* FIXME need a dialog for this */ /* FIXME need a dialog for this */
if (ferror (outfile)) if (ferror (outfile))
{ {
meta_warning ("Error writing session file '%s': %s", g_warning ("Error writing session file '%s': %s",
full_save_file (), g_strerror (errno)); full_save_file (), g_strerror (errno));
} }
if (fclose (outfile)) if (fclose (outfile))
{ {
meta_warning ("Error closing session file '%s': %s", g_warning ("Error closing session file '%s': %s",
full_save_file (), g_strerror (errno)); full_save_file (), g_strerror (errno));
} }
} }
@ -1185,8 +1185,8 @@ load_state (const char *previous_save_file)
error: error:
meta_warning ("Failed to parse saved session file: %s", g_warning ("Failed to parse saved session file: %s",
error->message); error->message);
g_error_free (error); g_error_free (error);
if (parse_data.info) if (parse_data.info)

View File

@ -242,8 +242,8 @@ complain_about_broken_client (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) gboolean initial)
{ {
meta_warning ("Broken client! Window %s changed client leader window or SM client ID", g_warning ("Window %s changed client leader window or SM client ID",
window->desc); window->desc);
} }
static void static void

View File

@ -4300,9 +4300,9 @@ meta_window_x11_recalc_window_type (MetaWindow *window)
priv->type_atom); priv->type_atom);
mtk_x11_error_trap_pop (x11_display->xdisplay); mtk_x11_error_trap_pop (x11_display->xdisplay);
meta_warning ("Unrecognized type atom [%s] set for %s ", g_warning ("Unrecognized type atom [%s] set for %s ",
atom_name ? atom_name : "unknown", atom_name ? atom_name : "unknown",
window->desc); window->desc);
if (atom_name) if (atom_name)
XFree (atom_name); XFree (atom_name);

View File

@ -155,14 +155,17 @@ validate_or_free_results (GetPropertyResults *results,
if (res_name == NULL) if (res_name == NULL)
res_name = "unknown"; res_name = "unknown";
meta_warning ("Window 0x%lx has property %s that was expected to have type %s format %d and actually has type %s format %d n_items %d. This is most likely an application bug, not a window manager bug. The window has title=\"%s\" class=\"%s\" name=\"%s\"", g_warning ("Window 0x%lx has property %s that was expected to have type %s "
results->xwindow, "format %d and actually has type %s format %d n_items %d. "
prop_name ? prop_name : "(bad atom)", "This is most likely an application bug, not a window manager bug. "
expected_name ? expected_name : "(bad atom)", "The window has title=\"%s\" class=\"%s\" name=\"%s\"",
expected_format, results->xwindow,
type_name ? type_name : "(bad atom)", prop_name ? prop_name : "(bad atom)",
results->format, (int) results->n_items, expected_name ? expected_name : "(bad atom)",
title, res_class, res_name); expected_format,
type_name ? type_name : "(bad atom)",
results->format, (int) results->n_items,
title, res_class, res_name);
meta_XFree (type_name); meta_XFree (type_name);
meta_XFree (expected_name); meta_XFree (expected_name);
@ -368,8 +371,8 @@ utf8_string_from_results (GetPropertyResults *results,
char *name; char *name;
name = XGetAtomName (results->x11_display->xdisplay, results->xatom); name = XGetAtomName (results->x11_display->xdisplay, results->xatom);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8", g_warning ("Property %s on window 0x%lx contained invalid UTF-8",
name, results->xwindow); name, results->xwindow);
meta_XFree (name); meta_XFree (name);
g_free (results->prop); g_free (results->prop);
results->prop = NULL; results->prop = NULL;
@ -435,8 +438,8 @@ utf8_list_from_results (GetPropertyResults *results,
mtk_x11_error_trap_push (results->x11_display->xdisplay); mtk_x11_error_trap_push (results->x11_display->xdisplay);
name = XGetAtomName (results->x11_display->xdisplay, results->xatom); name = XGetAtomName (results->x11_display->xdisplay, results->xatom);
mtk_x11_error_trap_pop (results->x11_display->xdisplay); mtk_x11_error_trap_pop (results->x11_display->xdisplay);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8 for item %d in the list", g_warning ("Property %s on window 0x%lx contained invalid UTF-8 for item %d in the list",
name, results->xwindow, i); name, results->xwindow, i);
meta_XFree (name); meta_XFree (name);
g_free (results->prop); g_free (results->prop);
results->prop = NULL; results->prop = NULL;
@ -628,8 +631,8 @@ text_property_to_utf8 (GetPropertyResults *results,
mtk_x11_error_trap_push (results->x11_display->xdisplay); mtk_x11_error_trap_push (results->x11_display->xdisplay);
name = XGetAtomName (results->x11_display->xdisplay, results->xatom); name = XGetAtomName (results->x11_display->xdisplay, results->xatom);
mtk_x11_error_trap_pop (results->x11_display->xdisplay); mtk_x11_error_trap_pop (results->x11_display->xdisplay);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8", g_warning ("Property %s on window 0x%lx contained invalid UTF-8",
name, results->xwindow); name, results->xwindow);
meta_XFree (name); meta_XFree (name);
goto out; goto out;