Make dialogs that Metacity shows follow focus-stealing-prevention

2004-08-25  Elijah Newren  <newren@math.utah.edu>

	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 <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).
This commit is contained in:
Elijah Newren
2004-08-26 00:59:12 +00:00
committed by Elijah Newren
parent 07c406cad9
commit 044d8999a3
7 changed files with 133 additions and 31 deletions

View File

@ -38,6 +38,7 @@ static void meta_window_present_delete_dialog (MetaWindow *window);
static void
delete_ping_reply_func (MetaDisplay *display,
Window xwindow,
Time timestamp,
void *user_data)
{
meta_topic (META_DEBUG_PING,
@ -290,14 +291,16 @@ io_from_ping_dialog (GIOChannel *channel,
static void
delete_ping_timeout_func (MetaDisplay *display,
Window xwindow,
Time timestamp,
void *user_data)
{
MetaWindow *window = user_data;
GError *err;
int child_pid;
int outpipe;
char *argv[7];
char *argv[9];
char numbuf[32];
char timestampbuf[32];
char *window_id_str;
GIOChannel *channel;
@ -314,14 +317,17 @@ delete_ping_timeout_func (MetaDisplay *display,
window_id_str = g_strdup_printf ("0x%lx", window->xwindow);
sprintf (numbuf, "%d", window->screen->number);
sprintf (timestampbuf, "%lu", timestamp);
argv[0] = METACITY_LIBEXECDIR"/metacity-dialog";
argv[1] = "--screen";
argv[2] = numbuf;
argv[3] = "--kill-window-question";
argv[4] = window->title;
argv[5] = window_id_str;
argv[6] = NULL;
argv[3] = "--timestamp";
argv[4] = timestampbuf;
argv[5] = "--kill-window-question";
argv[6] = window->title;
argv[7] = window_id_str;
argv[8] = NULL;
err = NULL;
if (!g_spawn_async_with_pipes ("/",