<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Detecting Xlib&#8217;s Keyboard Auto-repeat Functionality (and how to fix it)</title>
	<atom:link href="http://www.ypass.net/blog/2009/06/detecting-xlibs-keyboard-auto-repeat-functionality-and-how-to-fix-it/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ypass.net/blog/2009/06/detecting-xlibs-keyboard-auto-repeat-functionality-and-how-to-fix-it/</link>
	<description>Solaris, PHP, and Random Things</description>
	<lastBuildDate>Wed, 25 Aug 2010 19:21:37 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anon</title>
		<link>http://www.ypass.net/blog/2009/06/detecting-xlibs-keyboard-auto-repeat-functionality-and-how-to-fix-it/comment-page-1/#comment-1142</link>
		<dc:creator>Anon</dc:creator>
		<pubDate>Mon, 07 Dec 2009 22:48:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.ypass.net/blog/?p=234#comment-1142</guid>
		<description>Also, in response to your comment: &quot;There’s a hack on a Sun forum to peek into the next event in the event queue, but that doesn’t work reliably either, because it’s very possible that the next event will not be the corresponding KeyPress and/or the next event hasn’t even been queued yet.&quot;

If it&#039;s an auto-repeat, it will always be the next event. The X server is single threaded, and the events are placed into the queue at the same time. They may not have been read yet, but that is easily worked around.</description>
		<content:encoded><![CDATA[<p>Also, in response to your comment: &#8220;There’s a hack on a Sun forum to peek into the next event in the event queue, but that doesn’t work reliably either, because it’s very possible that the next event will not be the corresponding KeyPress and/or the next event hasn’t even been queued yet.&#8221;</p>
<p>If it&#8217;s an auto-repeat, it will always be the next event. The X server is single threaded, and the events are placed into the queue at the same time. They may not have been read yet, but that is easily worked around.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anon</title>
		<link>http://www.ypass.net/blog/2009/06/detecting-xlibs-keyboard-auto-repeat-functionality-and-how-to-fix-it/comment-page-1/#comment-1141</link>
		<dc:creator>Anon</dc:creator>
		<pubDate>Mon, 07 Dec 2009 22:28:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.ypass.net/blog/?p=234#comment-1141</guid>
		<description>XQueryKeymap does an XFlush, and thus has performance consequences. It&#039;s better simply to check to see if the next event following the release is the a press of the same key with the same timestamp. Like so:

	if (ev-&gt;type == KeyRelease &amp;&amp; XEventsQueued(dpy, QueuedAfterReading)) {
		XEvent nev;
		XPeekEvent(xdpy, &amp;nev);

		if (nev.type == KeyPress &amp;&amp; 
		    nev.xkey.time == ev-&gt;xkey.time &amp;&amp;
		    nev.xkey.keycode == e-&gt;xkey.keycode) {
			/* Key wasn&#039;t actually released */
                }
	}</description>
		<content:encoded><![CDATA[<p>XQueryKeymap does an XFlush, and thus has performance consequences. It&#8217;s better simply to check to see if the next event following the release is the a press of the same key with the same timestamp. Like so:</p>
<p>	if (ev-&gt;type == KeyRelease &amp;&amp; XEventsQueued(dpy, QueuedAfterReading)) {<br />
		XEvent nev;<br />
		XPeekEvent(xdpy, &amp;nev);</p>
<p>		if (nev.type == KeyPress &amp;&amp;<br />
		    nev.xkey.time == ev-&gt;xkey.time &amp;&amp;<br />
		    nev.xkey.keycode == e-&gt;xkey.keycode) {<br />
			/* Key wasn&#8217;t actually released */<br />
                }<br />
	}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
