12.07.2015 Views

Xlib − C Language X Interface

Xlib − C Language X Interface

Xlib − C Language X Interface

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Xlib</strong> − C LibraryX11, Release 6.7 DRAFT16.2. Using Latin-1 Keyboard Event FunctionsChapter 13 describes internationalized text input facilities, but sometimes it is expedient to writean application that only deals with Latin-1 characters and ASCII controls, so <strong>Xlib</strong> provides a simplefunction for that purpose. XLookupString handles the standard modifier semanticsdescribed in section 12.7. This function does not use any ofthe input method facilities describedin chapter 13 and does not depend on the current locale.To map a key event to an ISO Latin-1 string, use XLookupString.int XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out)XKeyEvent *event_struct;char *buffer_return;int bytes_buffer;KeySym *keysym_return;XComposeStatus *status_in_out;event_structbuffer_returnbytes_bufferSpecifies the key event structure to be used. Youcan pass XKeyPressedEventor XKeyReleasedEvent.Returns the translated characters.Specifies the length of the buffer. Nomore than bytes_buffer of translation arereturned.keysym_return Returns the KeySym computed from the event if this argument is not NULL.status_in_outSpecifies or returns the XComposeStatus structure or NULL.The XLookupString function translates a key event to a KeySym and a string. The KeySym isobtained by using the standard interpretation of the Shift, Lock, group, and numlock modifiersas defined in the X Protocol specification. If the KeySym has been rebound (see XRebind-Keysym), the bound string will be stored in the buffer. Otherwise, the KeySym is mapped, ifpossible, to an ISO Latin-1 character or (if the Control modifier is on) to an ASCII control character,and that character is stored in the buffer. XLookupString returns the number of charactersthat are stored in the buffer.If present (non-NULL), the XComposeStatus structure records the state, which is private to<strong>Xlib</strong>, that needs preservation across calls to XLookupString to implement compose processing.The creation of XComposeStatus structures is implementation-dependent; a portable programmust pass NULL for this argument.XLookupString depends on the cached keyboard information mentioned in the previous section,so it is necessary to use XRefreshKeyboardMapping to keep this information up-to-date.To rebind the meaning of a KeySym for XLookupString, use XRebindKeysym.404

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!