[3ddesktop-dev] Re: Losing keyboard focus problem


Wow!  That is great!  With that information I am able to 
pretty consistently reproduce.  It seems to happen also esp.
when I move the mouse at keypress time.

I spent a little time last nite trying different things
with XGrabKeyboard and XGrabPointer.  The GrabModeSync
has the effect of blocking the keyboard or pointer events
(depending on which arg) until the program ends and that 
is not at all what we want.  So its something else but
good suggestion.

I have hope that we'll get to the bottom of this now 
that I can consistently reproduce it.

thanks!
--brad



Jeff Buck wrote:

> 
> OK, I think I've found a way to make it easier for others to
> duplicate the lost keyboard focus problem.. I think it does have
> something to do with the speed of the computer/video/imlib or something.
> 
> On my box at work (which never had troubles before) I started having the
> same issues with it after I had fried all my configs in a software
> update.  What I figure out though, was that if I turned up texturesize
> setting, then the problem went away. 
> 
> At texturesize=512, I have yet to see the problem.
> At texturesize=256, I see the problem intermittently.
> At texturesize=128, I see the problem very frequently.
> 
> I'm thinking that turning down the texture size simulates a faster
> machine/video for the purposes of duplicating the problem. It hopefully
> also gives a good clue as to exactly when focus gets lost as well.
> 
> I've still never managed to get into the code to try and figure anything
> out, but with my skill level in C, that's probably for the better.
> 
> And it does seem to be related to how quickly you're baning away at the
> keyboard also.
> 
> ...time passes...
> 
> Finally.. with more testing, I can duplacate it (almost) every time.
> I use CTRL-TAB to run 3ddesk. If my texturesize is set to 128, and
> I hold down CTRL, then tap TAB, but don't release CTRL immediately, then
> I've almost always lost keyboard focus. Maybe the grab fails because
> there's already a key down? Why the delay for a larger texturesize would
> prevent that from being a problem I'm not sure (keyrepeat??), but when 
> I have texturesize set to 512, then it doesn't seem to matter how long 
> I hold down CTRL, it works correctly every time anyway. When it's set
> to texturesize=128, I can still almost always avoid the problem by 
> releasing CTRL and TAB very quickly.
> 
> Very strange. I hope these clues help.
> 
> ...time passes...
> 
> OK, Looking at the code a bit, and the man pages a touch, I'll venture
> a clueless guess or two. Unfortunately, I've spent more time than I
> actually have playing with this, and I don't have the proper headers on
> my box right now to actually try a compile.
> 
> Guess #1. Maybe doing something like "if (XGrabKeyboard(..))" or 
> while (!(XGrabKeyboard(...)) might help... but admittedly, is probably
> not the correct solution.
> 
> Guess #2. 
> Maybe something like this:
> XGrabKeyboard(display, win, True, GrabModeAsync, GrabModeSync,
> CurrentTime);
> 
> instead of: 
> 
> XGrabKeyboard(display, win, True, GrabModeAsync, GrabModeAsync,
> CurrentTime);
> 
> ..but I'm also not really sure I understand what's different about
> GrabModeAsync vs GrabModeSync properly, but it sounds like Sync 
> might be better for this.. 
> 
> -Jeff
> 
> 
> -- 
> Nothing is as simple as it seems at first
>   Or as hopeless as it seems in the middle
>     Or as finished as it seems in the end
> 
> 
> 
> 
> 
> 


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

Other related posts: