<?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>Tue, 17 Jan 2012 00:24:06 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: devildrey33</title>
		<link>http://www.ypass.net/blog/2009/06/detecting-xlibs-keyboard-auto-repeat-functionality-and-how-to-fix-it/comment-page-1/#comment-1679</link>
		<dc:creator>devildrey33</dc:creator>
		<pubDate>Fri, 09 Sep 2011 02:31:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.ypass.net/blog/?p=234#comment-1679</guid>
		<description>I tryed the XEventsQueued solution, when i made the tests i press a key, move a mouse, and finaly release the key. This works fine for me in my ubuntu under virtual box.

This is my console test result :

OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnMouseMove(cX = 79, cY = 38)
OnMouseMove(cX = 79, cY = 39)
OnMouseMove(cX = 79, cY = 40)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnMouseMove(cX = 79, cY = 43)
OnMouseMove(cX = 79, cY = 44)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnMouseMove(cX = 78, cY = 44)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnMouseMove(cX = 77, cY = 44)
OnMouseMove(cX = 77, cY = 45)
OnMouseMove(cX = 76, cY = 45)
OnMouseMove(cX = 76, cY = 46)
OnMouseMove(cX = 75, cY = 46)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyPress  (KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)
OnKeyRelease(KeyCode = 0x0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)</description>
		<content:encoded><![CDATA[<p>I tryed the XEventsQueued solution, when i made the tests i press a key, move a mouse, and finaly release the key. This works fine for me in my ubuntu under virtual box.</p>
<p>This is my console test result :</p>
<p>OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnMouseMove(cX = 79, cY = 38)<br />
OnMouseMove(cX = 79, cY = 39)<br />
OnMouseMove(cX = 79, cY = 40)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnMouseMove(cX = 79, cY = 43)<br />
OnMouseMove(cX = 79, cY = 44)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnMouseMove(cX = 78, cY = 44)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnMouseMove(cX = 77, cY = 44)<br />
OnMouseMove(cX = 77, cY = 45)<br />
OnMouseMove(cX = 76, cY = 45)<br />
OnMouseMove(cX = 76, cY = 46)<br />
OnMouseMove(cX = 75, cY = 46)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyPress  (KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)<br />
OnKeyRelease(KeyCode = 0&#215;0026, AG = 0, C = 0, S = 0, CL = 0, NL = 1)</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-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>

