<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Lucien,</p>
    <p>Depends what you call the same display. The window is created in
      the render thread while event looping is done in the main thread.
      In both places XOpenDisplay(getenv("DISPLAY")) is called. Is this
      not the same display? If not how can I "attach" them together?
      It's a requirement that the render thread creates the window while
      the main thread has to handle the event loop (to my knowledge only
      this works).</p>
    <div class="moz-cite-prefix">On 1/19/20 2:43 PM, Lucien Gentis
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:6b704e91-db08-64c3-ff65-f2b6aa7dd3e5@univ-lorraine.fr">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <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" moz-do-not-send="true">xorg@lists.x.org</a>: X.Org support
Archives: <a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/archives/xorg" moz-do-not-send="true">http://lists.freedesktop.org/archives/xorg</a>
Info: <a class="moz-txt-link-freetext" href="https://lists.x.org/mailman/listinfo/xorg" moz-do-not-send="true">https://lists.x.org/mailman/listinfo/xorg</a>
Your subscription address: %(user_address)s
</pre>
      </blockquote>
      <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>
    <br>
    <div class="moz-signature">-- <br>
      Mit freundlichen Grüssen<br>
      Plüss Roland<br>
      <br>
      Leader und Head Programmer<br>
      - Game: Epsylon ( <a class="moz-txt-link-freetext" href="http://www.indiedb.com/games/epsylon">http://www.indiedb.com/games/epsylon</a> )<br>
      - Game Engine: Drag[en]gine (
      <a class="moz-txt-link-freetext" href="http://www.indiedb.com/engines/dragengine">http://www.indiedb.com/engines/dragengine</a> ,
      <a class="moz-txt-link-freetext" href="http://dragengine.rptd.ch/wiki">http://dragengine.rptd.ch/wiki</a> )<br>
      - Sowie verschiedene Blender Export-Skripts und Game-Tools
    </div>
  </body>
</html>