<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Roland,</p>
    <p>While defining delAtom and calling XSetWMProtocls, you specifiy
      "display", and in your loop, you specify "pDisplay" ; is it the
      same display ?<br>
    </p>
    <div class="moz-cite-prefix">Le 19/01/2020 à 13:33, Roland Plüss a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:456a4ab3-f48f-ee42-532c-1560a07f9393@rptd.ch">
      <pre class="moz-quote-pre" wrap="">I'm finishing up my software for releasing but run into a big issue. If
I use window mode instead of full-screen mode the user should be able to
close the window using the X button. I can prevent this from happening
using this code:

Atom delAtom = XInternAtom( display, "WM_DELETE_WINDOW", False );
XSetWMProtocols( display, pWindow, &delAtom, 1 );

The window will not be destroyed when X is pressed so I think this
worked. The problem is though that I do not received ClientMessage and
thus I am unable to close the window. This is the event loop:

XEvent event;
while( XPending( pDisplay ) ){
   XNextEvent( pDisplay, &event );
   log("Event %d", event.type);
   switch( event.type ){
   ...
   case ClientMessage:
      log("Quit Request Received");
      break;
   }
}

Window is created like this:

#define BASIC_EVENT_MASK     ( StructureNotifyMask | ExposureMask |
PropertyChangeMask \
                             | EnterWindowMask | LeaveWindowMask |
KeyPressMask \
                             | KeyReleaseMask | KeymapStateMask |
FocusChangeMask )

#define NOT_PROPAGATE_MASK   ( KeyPressMask | KeyReleaseMask |
ButtonPressMask \
                             | ButtonReleaseMask | PointerMotionMask |
ButtonMotionMask )

XSetWindowAttributes swa;
swa.colormap = colMap;
swa.backing_store = NotUseful;
swa.border_pixel = 0;
swa.event_mask = BASIC_EVENT_MASK;
swa.do_not_propagate_mask = NOT_PROPAGATE_MASK;
swa.override_redirect = False;
swa.save_under = False;
swa.cursor = 0;
swa.bit_gravity = ForgetGravity;
swa.win_gravity = NorthWestGravity;

Any idea what else I need to do to get this working?

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:xorg@lists.x.org">xorg@lists.x.org</a>: X.Org support
Archives: <a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/archives/xorg">http://lists.freedesktop.org/archives/xorg</a>
Info: <a class="moz-txt-link-freetext" href="https://lists.x.org/mailman/listinfo/xorg">https://lists.x.org/mailman/listinfo/xorg</a>
Your subscription address: %(user_address)s
</pre>
    </blockquote>
  </body>
</html>