views:

37

answers:

1

Hi Experts,

I am trying to create GtkDialog with system wide Modal property i.e. when the dialog is opened no other window should get focus. There is an option for making it modal using GtkDialogFlag but that is not system wide modal.

Please I need your help urgently.

Kind Regards, -Durgesh O Mishra

A: 

This is an utterly horrible idea, but you can override the "focus-out-event" handler for your window and have it call gtk_window_present.

Something like gksu does:

static gboolean
focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
{
  gtk_window_present (GTK_WINDOW(widget));
  return TRUE;
}

//in your initialization code for your window...
/* make sure that our window will always have the focus */
g_signal_connect (G_OBJECT(mywindow), "focus-out-event",
          G_CALLBACK(focus_out_cb), NULL);

This hopefully has the added benefit of if your application does freeze, the signal for focus-out-event will probably not be handled. I'm not sure how GTK does UI threading though, but I think this should be true.

Ken Simon