Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Newer edit →
USpeak
(view source)
Revision as of 07:37, 28 March 2009
11 bytes added
,
07:37, 28 March 2009
no edit summary
Line 112:
Line 112:
This can be done via simple calls to the X11 Server. Here is a snippet of how that can be done.
This can be done via simple calls to the X11 Server. Here is a snippet of how that can be done.
−
<source lang=cpp>
+
<source lang=cpp>
−
// Get the currently focused window.
+
// Get the currently focused window.
−
XGetInputFocus(...);
+
XGetInputFocus(...);
−
// Create the event
+
// Create the event
−
XKeyEvent event = createKeyEvent(...);
+
XKeyEvent event = createKeyEvent(...);
−
// Send the KEYCODE. We can define these using XK_ constants
+
// Send the KEYCODE. We can define these using XK_ constants
−
XSendEvent(...);
+
XSendEvent(...);
−
// Resend the event to emulate the key release
+
// Resend the event to emulate the key release
−
event = createKeyEvent(...);
+
event = createKeyEvent(...);
−
XSendEvent(...);
+
XSendEvent(...);
−
</source>
+
</source>
Mavu
52
edits