Re: Determining XKeysyms



On Sun, Mar 09, 2003 at 05:46:58PM +0000, Bill Haneman wrote:

> You can try XStringToKeysym(), which works for any string that has a
> corresponding KeySym with the current keyboard driver.  For anything
> other than "exotic" multi-language cases this should work fine for
> Dasher, in terms of converting from strings to KeySyms.

Ok, that works nicely. My problem now is that the SendKeyEvent sends to 
the currently focussed window. I'm trying to deal with this with 
XSetInputFocus, but code something like this:

XSetInputFocus(XOpenDisplay(NULL),focuswindow,RevertToNone,CurrentTime); 
XGetInputFocus(XOpenDisplay(NULL),&testwindow,&i);
SPI_generateKeyboardEvent (XStringToKeysym(label.c_str()),"",SPI_KEY_SYM);

where focuswindow is the window that I want events to go to doesn't seem 
to work. I'd expect testwindow to be set to the same value as 
focuswindow - instead, it gets sent to whichever window is currently 
focussed in the window manager (Metacity in this case). As a result, my 
keypress ends up in the wrong window. Am I doing something obviously 
wrong here?

-- 
Matthew Garrett | mjg59 srcf ucam org



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