diff --git a/ChangeLog b/ChangeLog index a974695da8..f31696ffd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2006-01-16 Dan Williams + + * gnome/applet/applet.c + - (nmwa_show_vpn_login_banner_dialog, nmwa_show_vpn_failure_dialog, + nmwa_driver_notify, show_warning_dialog): fix up focus-stealing + prevention to realize window before trying to get server + time + + * gnome/applet/other-network-dialog.c + - (nmwa_other_network_dialog_run): fix up focus-stealing + prevention to realize window before trying to get server + time + + * gnome/applet/passphrase-dialog.c + - (nmi_passphrase_dialog_new): fix up focus-stealing + prevention to realize window before trying to get server + time + 2006-01-16 Robert Love Patch from Timo Hoenig msg != NULL, FALSE); @@ -406,11 +405,12 @@ static gboolean nmwa_show_vpn_failure_dialog (DialogCBData *cb_data) g_signal_connect (dialog, "response", G_CALLBACK (vpn_failure_dialog_close_cb), NULL); g_signal_connect (dialog, "close", G_CALLBACK (vpn_failure_dialog_close_cb), NULL); g_object_set_data (G_OBJECT (dialog), "data", cb_data); - gtk_widget_show_all (dialog); /* Bash focus-stealing prevention in the face */ - timestamp = gdk_x11_get_server_time (dialog->window); - gdk_x11_window_set_user_time (dialog->window, timestamp); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_widget_realize (dialog); + gdk_x11_window_set_user_time (dialog->window, gtk_get_current_event_time ()); + gtk_widget_show_all (dialog); return FALSE; } @@ -504,7 +504,6 @@ static void vpn_login_banner_dialog_close_cb (GtkWidget *dialog, gpointer user_d static gboolean nmwa_show_vpn_login_banner_dialog (char *message) { GtkWidget *dialog; - guint32 timestamp; g_return_val_if_fail (message != NULL, FALSE); @@ -512,11 +511,12 @@ static gboolean nmwa_show_vpn_login_banner_dialog (char *message) g_signal_connect (dialog, "response", G_CALLBACK (vpn_login_banner_dialog_close_cb), NULL); g_signal_connect (dialog, "close", G_CALLBACK (vpn_login_banner_dialog_close_cb), NULL); g_object_set_data (G_OBJECT (dialog), "message", message); - gtk_widget_show_all (dialog); /* Bash focus-stealing prevention in the face */ - timestamp = gdk_x11_get_server_time (dialog->window); - gdk_x11_window_set_user_time (dialog->window, timestamp); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_widget_realize (dialog); + gdk_x11_window_set_user_time (dialog->window, gtk_get_current_event_time ()); + gtk_widget_show_all (dialog); return FALSE; } @@ -739,7 +739,6 @@ gboolean nmwa_driver_notify (gpointer user_data) char * label_text = NULL; char * temp = NULL; GtkButton * button; - guint32 timestamp; g_return_val_if_fail (cb_data != NULL, FALSE); @@ -789,11 +788,11 @@ gboolean nmwa_driver_notify (gpointer user_data) button = GTK_BUTTON (glade_xml_get_widget (cb_data->xml, "ok_button")); g_signal_connect (G_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (nmwa_driver_notify_ok_cb), cb_data); - gtk_widget_show_all (GTK_WIDGET (dialog)); - /* Bash focus-stealing prevention in the face */ - timestamp = gdk_x11_get_server_time (dialog->window); - gdk_x11_window_set_user_time (dialog->window, timestamp); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_widget_realize (dialog); + gdk_x11_window_set_user_time (dialog->window, gtk_get_current_event_time ()); + gtk_widget_show_all (dialog); out: network_device_unref (cb_data->dev); @@ -1220,16 +1219,15 @@ static int nmwa_redraw_timeout (NMWirelessApplet *applet) static gboolean show_warning_dialog (char *mesg) { GtkWidget * dialog; - guint32 timestamp; dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, mesg, NULL); - gtk_widget_realize (dialog); /* Bash focus-stealing prevention in the face */ - timestamp = gdk_x11_get_server_time (dialog->window); - gdk_x11_window_set_user_time (dialog->window, timestamp); - + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_widget_realize (dialog); + gdk_x11_window_set_user_time (dialog->window, gtk_get_current_event_time ()); gtk_window_present (GTK_WINDOW (dialog)); + g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); g_free (mesg); diff --git a/gnome/applet/other-network-dialog.c b/gnome/applet/other-network-dialog.c index e2ee2be677..166a77b0b6 100644 --- a/gnome/applet/other-network-dialog.c +++ b/gnome/applet/other-network-dialog.c @@ -444,8 +444,8 @@ static void nmwa_ond_response_cb (GtkDialog *dialog, gint response, gpointer dat void nmwa_other_network_dialog_run (NMWirelessApplet *applet, gboolean create_network) { - GtkDialog * dialog; - GladeXML * xml; + GtkWidget * dialog; + GladeXML * xml; g_return_if_fail (applet != NULL); g_return_if_fail (applet->glade_file != NULL); @@ -456,9 +456,12 @@ void nmwa_other_network_dialog_run (NMWirelessApplet *applet, gboolean create_ne return; } - if (!(dialog = nmwa_ond_init (xml, applet, create_network))) + if (!(dialog = GTK_WIDGET (nmwa_ond_init (xml, applet, create_network)))) return; - - gtk_window_present (GTK_WINDOW (dialog)); g_signal_connect (dialog, "response", G_CALLBACK (nmwa_ond_response_cb), NULL); + + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_widget_realize (dialog); + gdk_x11_window_set_user_time (dialog->window, gtk_get_current_event_time ()); + gtk_window_present (GTK_WINDOW (dialog)); } diff --git a/gnome/applet/passphrase-dialog.c b/gnome/applet/passphrase-dialog.c index 5aedb2b557..32a06bac12 100644 --- a/gnome/applet/passphrase-dialog.c +++ b/gnome/applet/passphrase-dialog.c @@ -197,7 +197,6 @@ nmi_passphrase_dialog_new (NMWirelessApplet *applet, GtkComboBox * security_combo; const char * orig_label_text; char * new_label_text; - guint32 timestamp; guint32 caps; g_return_val_if_fail (applet != NULL, NULL); @@ -252,15 +251,10 @@ nmi_passphrase_dialog_new (NMWirelessApplet *applet, g_signal_connect (G_OBJECT (dialog), "response", GTK_SIGNAL_FUNC (nmi_passphrase_dialog_response_received), dialog); - /* - * Bash focus-stealing prevention in the face - * - * FIXME: - * Gdk-CRITICAL **: gdk_x11_get_server_time: assertion `GDK_IS_WINDOW (window)' failed - * Gdk-CRITICAL **: gdk_x11_window_set_user_time: assertion `GDK_IS_WINDOW (window)' failed - */ - timestamp = gdk_x11_get_server_time (dialog->window); - gdk_x11_window_set_user_time (dialog->window, timestamp); + /* Bash focus-stealing prevention in the face */ + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); + gtk_widget_realize (dialog); + gdk_x11_window_set_user_time (dialog->window, gtk_get_current_event_time ()); gtk_window_present (GTK_WINDOW (dialog)); return dialog;