Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1285 - trunk/UserInterface
- Date: Tue, 13 Feb 2007 12:01:02 -0700 (MST)
Author: bigler
Date: Tue Feb 13 12:01:01 2007
New Revision: 1285
Modified:
trunk/UserInterface/XWindowUI.cc
trunk/UserInterface/XWindowUI.h
Log:
Catch the window close event and shut down the engine properly.
Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc (original)
+++ trunk/UserInterface/XWindowUI.cc Tue Feb 13 12:01:01 2007
@@ -148,6 +148,11 @@
for(int i=xpipe[1]+1; i<tmp_pipe[0];i++)
addConnection(i);
}
+
+ // Will create an atom if it doesn't exist
+ bool only_if_exists = false;
+ deleteWindow = XInternAtom( dpy, "WM_DELETE_WINDOW", only_if_exists);
+ // Probably check some error codes or something.
}
XWindowUI::~XWindowUI()
@@ -344,6 +349,8 @@
sh.flags = USPosition|USSize;
XSetWMProperties(dpy, window->window, &tp, &tp, 0, 0, &sh, 0, 0);
+ // The last arg is the number of atom &deleteWindow points to.
+ XSetWMProtocols(dpy, window->window, &deleteWindow, 1);
XMapWindow(dpy, window->window);
XHelper::Xlock.unlock();
@@ -958,6 +965,15 @@
break;
case Expose:
// cerr << "Expose event found.\n";
+ break;
+ case ClientMessage:
+ {
+ if (e.xclient.data.l[0] == deleteWindow) {
+ // cerr << "Delete window event caught\n";
+ // Takes three arguments that are simply ignored
+ quitkey(0,0,0);
+ }
+ } // case ClientMessage
break;
default:
cerr << "Unknown X event: " << e.type << '\n';
Modified: trunk/UserInterface/XWindowUI.h
==============================================================================
--- trunk/UserInterface/XWindowUI.h (original)
+++ trunk/UserInterface/XWindowUI.h Tue Feb 13 12:01:01 2007
@@ -108,6 +108,8 @@
Display* dpy;
vector<int> xfds;
int xpipe[2];
+ Atom deleteWindow; // Used to get notification the window was
+ // closed by the window manager.
CameraPath *path;
- [MANTA] r1285 - trunk/UserInterface, bigler, 02/13/2007
Archive powered by MHonArc 2.6.16.