Hi,
atm, ecore_x_window_del() just wraps XDestroyWindow().
The attached patch makes ecore_x_window_del() only call XDestroyWindow()
if the client doesn't have the WM_DELETE_REQUEST protocol set.
If it does, a delete request message is sent.
The code works just fine for me, but I don't know whether we want this
"smart" behaviour.
Can I commit this or do we want to keep ecore_x_window_del() the way it
is?
--
Regards,
Tilman
Index: ecore_x_window.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window.c,v
retrieving revision 1.21
diff -u -r1.21 ecore_x_window.c
--- ecore_x_window.c 12 Aug 2004 11:29:18 -0000 1.21
+++ ecore_x_window.c 22 Aug 2004 22:34:45 -0000
@@ -239,7 +239,35 @@
void
ecore_x_window_del(Ecore_X_Window win)
{
- XDestroyWindow(_ecore_x_disp, win);
+ XEvent xev;
+ int s;
+
+ /* sorry sir, deleting the root window doesn't sound like
+ * a smart idea.
+ */
+ if (!win)
+ return;
+
+ /* does the window want to get a delete request or do we
+ * send it to nirvana right away?
+ */
+ s = ecore_x_window_prop_protocol_isset (win,
+ ECORE_X_WM_PROTOCOL_DELETE_REQUEST);
+
+ if (!s) {
+ XDestroyWindow(_ecore_x_disp, win);
+ return;
+ }
+
+ xev.xclient.type = ClientMessage;
+ xev.xclient.display = _ecore_x_disp;
+ xev.xclient.window = win;
+ xev.xclient.message_type = _ecore_x_atom_wm_protocols;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = _ecore_x_atom_wm_delete_window;
+ xev.xclient.data.l[1] = CurrentTime;
+
+ XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
}
/**