Re: Zinf doesn't respond to X delete window messages.

David Vrabel <[email protected]>
Newsgroups gmane.comp.audio.zinf.devel
Message-ID <[email protected]>
David Vrabel wrote:
> 
> Zinf doesn't appear to capture and handle correctly X delete window
> messages (such as you'd get if you clicked on the window manager
> provided close button or via a taskbar or similar).

Attached is a patch (against fairly recent CVS) which fixes this.

David Vrabel
zinf-delete-event.patch (text/plain, 1.2 KB)
Index: ui/zinf/unix/src/GTKWindow.cpp
===================================================================
RCS file: /cvsroot/zinf/zinf/ui/zinf/unix/src/GTKWindow.cpp,v
retrieving revision 1.6
diff -u -b -B -w -p -r1.6 GTKWindow.cpp
--- ui/zinf/unix/src/GTKWindow.cpp	13 Feb 2003 12:21:37 -0000	1.6
+++ ui/zinf/unix/src/GTKWindow.cpp	24 Jun 2003 19:49:01 -0000
@@ -132,6 +132,17 @@ void leave_notify(GtkWidget *w, GdkEvent
     ui->m_pMindMeldMutex->Release();
     gdk_threads_enter();
 }
+
+bool delete_window(GtkWidget *w, GdkEventCrossing *e, GTKWindow *ui)
+{
+    string oControl("Quit");
+    gdk_threads_leave();
+    ui->m_theme->HandleControlMessage(oControl, CM_Pressed);
+    gdk_threads_enter();
+
+    return true;
+}
+
 void mymusic_pop(GTKWindow *p, guint action, GtkWidget *w)
 {
     string oControl("MyMusic");
@@ -284,6 +295,8 @@ Error GTKWindow::Run(Pos &oPos)
                        GTK_SIGNAL_FUNC(enter_notify), this);
     gtk_signal_connect(GTK_OBJECT(mainWindow), "leave_notify_event",
                        GTK_SIGNAL_FUNC(leave_notify), this);
+    gtk_signal_connect(GTK_OBJECT(mainWindow), "delete_event",
+                       GTK_SIGNAL_FUNC(delete_window), this);
 
     iMaxX = gdk_screen_width();
     iMaxY = gdk_screen_height();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.