From 044d8999a33f2cc36de36e5ccd03cdadc89b368c Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Thu, 26 Aug 2004 00:59:12 +0000 Subject: Make dialogs that Metacity shows follow focus-stealing-prevention 2004-08-25 Elijah Newren Make dialogs that Metacity shows follow focus-stealing-prevention conventions. (fixes one issue in #149028; see comments 47-54) * src/delete.c (delete_ping_reply_func, delete_ping_timeout_func): Make callback functions take a timestamp arg, (delete_ping_timeout_func): pass the timestamp to metacity-dialog * src/display.c (meta_display_ping_timeout): add a timestamp to the call to the ping_timeout_func, (meta_display_ping_window, process_pong_message): add a timestamp to the call to the ping_reply_func * src/display.h (MetaWindowPingFunc typedef): add a timestamp to this function typedef * src/keybindings.c (error_on_command): require a timestamp and pass the timestamp on to metacity-dialog, (handle_run_command): pass a timestamp to error_on_command * src/metacity-dialog.c (copy_of_gdk_x11_window_set_user_time): new function (temporary; only for use while using gtk+-2.4), (kill_window_question, warn_about_no_sm_support, error_about_command): make these functions take a timestamp and call copy_of_gdk_x11_window_set_user_time, (main): require the first two args to the program to be "--timestamp " * src/session.c (warn_about_lame_clients_and_finish_inter): pass a timestamp of 0 to metacity-dialog to prevent focus (it's a popup not generated by and kind of user request). --- src/keybindings.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/keybindings.c') diff --git a/src/keybindings.c b/src/keybindings.c index 9039e96a..19316a2d 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -2486,12 +2486,14 @@ static void error_on_command (int command_index, const char *command, const char *message, - int screen_number) + int screen_number, + Time timestamp) { GError *err; - char *argv[8]; + char *argv[10]; char *key; char numbuf[32]; + char timestampbuf[32]; meta_warning ("Error on command %d \"%s\": %s\n", command_index, command, message); @@ -2499,15 +2501,18 @@ error_on_command (int command_index, key = meta_prefs_get_gconf_key_for_command (command_index); sprintf (numbuf, "%d", screen_number); + sprintf (timestampbuf, "%lu", timestamp); argv[0] = METACITY_LIBEXECDIR"/metacity-dialog"; argv[1] = "--screen"; argv[2] = numbuf; - argv[3] = "--command-failed-error"; - argv[4] = key; - argv[5] = (char*) (command ? command : ""); - argv[6] = (char*) message; - argv[7] = NULL; + argv[3] = "--timestamp"; + argv[4] = timestampbuf; + argv[5] = "--command-failed-error"; + argv[6] = key; + argv[7] = (char*) (command ? command : ""); + argv[8] = (char*) message; + argv[9] = NULL; err = NULL; if (!g_spawn_async_with_pipes ("/", @@ -2596,7 +2601,7 @@ handle_run_command (MetaDisplay *display, s = g_strdup_printf (_("No command %d has been defined.\n"), which + 1); - error_on_command (which, NULL, s, screen->number); + error_on_command (which, NULL, s, screen->number, event->xkey.time); g_free (s); return; @@ -2605,7 +2610,7 @@ handle_run_command (MetaDisplay *display, err = NULL; if (!meta_spawn_command_line_async_on_screen (command, screen, &err)) { - error_on_command (which, command, err->message, screen->number); + error_on_command (which, command, err->message, screen->number, event->xkey.time); g_error_free (err); } -- cgit v1.2.1