From 28752718c594201210217ba1f6d240d7f9a374a6 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 7 Mar 2011 10:30:51 -0500 Subject: [PATCH] Remove meta_restart() / "mutter-message restart" meta_restart() was broken, in that it restarted mutter with what was left of argv after GOption and Clutter had possibly modified it. Rather than try to fix this, just remove it. https://bugzilla.gnome.org/show_bug.cgi?id=643959 --- src/core/display.c | 6 ----- src/core/main.c | 50 ++++---------------------------------- src/include/atomnames.h | 1 - src/include/main.h | 2 -- src/tools/mutter-message.c | 34 ++------------------------ 5 files changed, 7 insertions(+), 86 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index f49ffb888..5ee3e3a1a 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2524,12 +2524,6 @@ event_callback (XEvent *event, meta_workspace_focus_default_window (screen->active_workspace, NULL, timestamp); } } - else if (event->xclient.message_type == - display->atom__MUTTER_RESTART_MESSAGE) - { - meta_verbose ("Received restart request\n"); - meta_restart (); - } else if (event->xclient.message_type == display->atom__MUTTER_RELOAD_THEME_MESSAGE) { diff --git a/src/core/main.c b/src/core/main.c index 62790ccdb..970e83179 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -89,12 +89,6 @@ static MetaExitCode meta_exit_code = META_EXIT_SUCCESS; */ static GMainLoop *meta_main_loop = NULL; -/** - * If set, Mutter will spawn an identical copy of itself immediately - * before quitting. - */ -static gboolean meta_restart_after_quit = FALSE; - static void prefs_changed_callback (MetaPreference pref, gpointer data); @@ -697,36 +691,15 @@ main (int argc, char **argv) meta_finalize (); - if (meta_restart_after_quit) - { - GError *err; - - err = NULL; - if (!g_spawn_async (NULL, - argv, - NULL, - G_SPAWN_SEARCH_PATH, - NULL, - NULL, - NULL, - &err)) - { - meta_fatal (_("Failed to restart: %s\n"), - err->message); - g_error_free (err); /* not reached anyhow */ - meta_exit_code = META_EXIT_ERROR; - } - } - return meta_exit_code; } /** - * Stops Mutter. This tells the event loop to stop processing; it is rather - * dangerous to use this rather than meta_restart() because this will leave - * the user with no window manager. We generally do this only if, for example, - * the session manager asks us to; we assume the session manager knows what - * it's talking about. + * Stops Mutter. This tells the event loop to stop processing; it is + * rather dangerous to use this because this will leave the user with + * no window manager. We generally do this only if, for example, the + * session manager asks us to; we assume the session manager knows + * what it's talking about. * * \param code The success or failure code to return to the calling process. */ @@ -739,19 +712,6 @@ meta_quit (MetaExitCode code) g_main_loop_quit (meta_main_loop); } -/** - * Restarts Mutter. In practice, this tells the event loop to stop - * processing, having first set the meta_restart_after_quit flag which - * tells Mutter to spawn an identical copy of itself before quitting. - * This happens on receipt of a _MUTTER_RESTART_MESSAGE client event. - */ -void -meta_restart (void) -{ - meta_restart_after_quit = TRUE; - meta_quit (META_EXIT_SUCCESS); -} - /** * Called on pref changes. (One of several functions of its kind and purpose.) * diff --git a/src/include/atomnames.h b/src/include/atomnames.h index 01e099e37..012049624 100644 --- a/src/include/atomnames.h +++ b/src/include/atomnames.h @@ -54,7 +54,6 @@ item(WM_WINDOW_ROLE) item(UTF8_STRING) item(WM_ICON_SIZE) item(_KWM_WIN_ICON) -item(_MUTTER_RESTART_MESSAGE) item(_MUTTER_RELOAD_THEME_MESSAGE) item(_MUTTER_SET_KEYBINDINGS_MESSAGE) item(_MUTTER_TOGGLE_VERBOSE) diff --git a/src/include/main.h b/src/include/main.h index 043f9d77d..b0c8dc8ec 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -38,6 +38,4 @@ void meta_exit (MetaExitCode code); /* g_main_loop_quit() then fall out of main() */ void meta_quit (MetaExitCode code); -void meta_restart (void); - #endif diff --git a/src/tools/mutter-message.c b/src/tools/mutter-message.c index 4aed444ca..5b93597bc 100644 --- a/src/tools/mutter-message.c +++ b/src/tools/mutter-message.c @@ -31,34 +31,6 @@ static Display *display; -static void -send_restart (void) -{ - XEvent xev; - - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = True; - xev.xclient.display = display; - xev.xclient.window = gdk_x11_get_default_root_xwindow (); - xev.xclient.message_type = XInternAtom (display, - "_MUTTER_RESTART_MESSAGE", - False); - xev.xclient.format = 32; - xev.xclient.data.l[0] = 0; - xev.xclient.data.l[1] = 0; - xev.xclient.data.l[2] = 0; - - XSendEvent (display, - gdk_x11_get_default_root_xwindow (), - False, - SubstructureRedirectMask | SubstructureNotifyMask, - &xev); - - XFlush (display); - XSync (display, False); -} - static void send_reload_theme (void) { @@ -149,7 +121,7 @@ static void usage (void) { g_printerr (_("Usage: %s\n"), - "mutter-message (restart|reload-theme|enable-keybindings|disable-keybindings|toggle-verbose)"); + "mutter-message (reload-theme|enable-keybindings|disable-keybindings|toggle-verbose)"); exit (1); } @@ -165,9 +137,7 @@ main (int argc, char **argv) display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); - if (strcmp (argv[1], "restart") == 0) - send_restart (); - else if (strcmp (argv[1], "reload-theme") == 0) + if (strcmp (argv[1], "reload-theme") == 0) send_reload_theme (); else if (strcmp (argv[1], "enable-keybindings") == 0) send_set_keybindings (TRUE);