Re: Getting keyboard state.



On Sat, Jan 13, 2001 at 04:43:26PM +0700, Maxim Koshelev wrote:
Havoc Pennington wrote:


Maintaining the state is much more correct, the get_pointer() solution
is a giant race condition.

Race conditions must be checked only in multithreaded programs where more
than one thread work with gtk...

NO! See Havoc's previous post...

Consider the following situation:

* Key pressed, without shift. Event generated and sent to X server.
* [... time passes whilst your GTK program does complicated processing]
* User finishes pressing key. [...time passes...]. User presses shift.
* [... time passes ... ]
* GTK+ program now reads key event, which was a key being pressed
  _without_ shift. You call get_pointer(...) and get shift being
  pressed. WRONG ANSWER!

Phil

-- 
  Philip Kendall <pak ast cam ac uk>
  http://www.srcf.ucam.org/~pak21/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]