Some code:<div><br></div><div>This is called by thread B, window is the rood win id, eventMask is XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT</div><div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">JNIEXPORT void JNICALL</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">Java_org_fusion_x11_nativeHelpers_NativeCalls_nativePropagateEvent(JNIEnv *env,</font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">                </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">jclass class, jlong display, jlong window, jlong eventMask) {</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">const uint32_t values[] = { eventMask };</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">xcb_void_cookie_t cookie = xcb_configure_window(</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">                        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">(xcb_connection_t*) display, (xcb_window_t) window,</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">                        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">XCB_CW_EVENT_MASK, values);</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">xcb_generic_error_t *error = xcb_request_check((xcb_connection_t*) display,</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">                        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">cookie);</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">checkError(error);</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">xcb_flush((xcb_connection_t*) display);</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">}</font></div></div><div><br></div><div><br></div><div><br></div><div>This is called from thread A inside a loop, received events are immediately placed on a queue and read by thread B for further handling.</div>
<div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">JNIEXPORT void JNICALL</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">Java_org_fusion_x11_nativeHelpers_NativeCalls_nativeGetNextEvent(JNIEnv *env,</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">                </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">jclass class, jlong display, jobject resultByteBuffer) {</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">xcb_flush((xcb_connection_t*) display);</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">xcb_generic_event_t *ev = xcb_wait_for_event((xcb_connection_t*) display);</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">char* resultBuffer = initResultHandling(env, &amp;resultByteBuffer);</font></div>
<div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        </font></span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">writeToBuffer(0, resultBuffer, ev, sizeof(xcb_generic_event_t));</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">}</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br>
</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">Because thread B handles the events and thread A runs in a tight loop, all requests to the X server by thread B end with a flush.</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">Am I perhaps doing something wrong when setting the event mask?</font></div>
<br><div class="gmail_quote">On Mon, Apr 19, 2010 at 4:54 PM, Ian Osgood <span dir="ltr">&lt;<a href="mailto:iano@quirkster.com">iano@quirkster.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
On Apr 18, 2010, at 1:31 PM, Erik De Rijcke wrote:<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt; I have a fairly large program with a small part accessing xcb. It basically does the following:<br>
&gt;<br>
&gt; thread A: open a display; spawn thread b; listen for events.<br>
&gt; thread B: set event mask (substructure redirect mask on root window)<br>
&gt;<br>
&gt; What seems to happen is that thread A never gets any configure request events nor map requests. However when I replicate this exact code with Xlib with build in xcb backend, thread A does receive events.<br>
&gt;<br>
&gt; I&#39;m guessing only the thread that sets the mask gets the events, is there a way to tell xcb to deliver the events to thread A or is this a possible bug?<br>
</div></div><div class="im">&gt; _______________________________________________<br>
&gt; Xcb mailing list<br>
&gt; <a href="mailto:Xcb@lists.freedesktop.org">Xcb@lists.freedesktop.org</a><br>
&gt; <a href="http://lists.freedesktop.org/mailman/listinfo/xcb" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xcb</a><br>
<br>
</div>One sanity check...  In your XCB code, are you calling xcb_flush() after every sequence of xcb commands that you expect to generate events?  One big difference between Xlib&#39;s XNextEvent and XCB&#39;s xcb_wait_for_event is the lack of an hidden flush.<br>

<br>
Further answers will only come if you post code.<br>
<font color="#888888"><br>
Ian<br>
</font></blockquote></div><br></div>