Re: blocking window manager from closing window



On Thu, 20 Jan 2005 19:10:36 +0000
marcodev comcast net wrote:
I have the following destroy signal connected to the top level window
of my app: g_signal_connect(G_OBJECT(top_level_window), "destroy",
                           (GCallback) destroy_window, NULL);
The callback then looks like this:
void
destroy                                (gpointer         user_data)
{
   // Gracefully exit the program
   GET_WINDOW_SIZE(top_level_window, &WIDTH,
                                       &HEIGHT);
   GET_PANE_POSITIONS(top_level_window, &V_PANE_POS,
                                       &H_PANE_POS);
..........
   gtk_main_quit();
}
The problem is that if the window is closed by clicking the window
manager's X button then the window closes before the destroy signal is
emmited and the calls to GET_WINDOW_SIZE() and GET_PANE_POSITIONS()
can't get the parameters for the window. Is there a way to slow down
or stop the WM momentarily?

Try connecting to the top-level window's "delete_event" signal instead;
this signal is emitted when the WM 'X' button is clicked, but before the
window is removed from the screen.

For more info, see the gtk tutorial:
http://www.gtk.org/tutorial/ch-gettingstarted.html

HTH
JV
-- 
BOFH Excuse #318:

Your EMAIL is now being delivered by the USPS.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]