[Gambas-user] SendKeys for gambas2 ?
José Luis Redrejo
jredrejo at ...626...
Thu Jul 12 14:41:27 CEST 2007
It's possible. A present for you: this small c program send "Caps Lock" when
it is on to assure that caps lock is not active. I don't remember the
details of the functions, as it's something I used almost 3 years, ago. But
you won't need to deal with 6000 linex of X11 reference, just look for the
functions I use here :
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
/*Para compilarlo:
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o xresetcapslock
xresetcapslock.c-lX11 -lXtst
*/
int main(void) {
unsigned int states;
Display* disp = XOpenDisplay( NULL );
if( disp == NULL )
return 1;
if (XkbGetIndicatorState (disp, XkbUseCoreKbd, &states) != Success)
return 2;
// printf("%i \n",states);
if (states == -31 || states == 1) {
XTestFakeKeyEvent( disp, XKeysymToKeycode( disp,
XK_Caps_Lock),
True, CurrentTime );
XTestFakeKeyEvent( disp, XKeysymToKeycode( disp,
XK_Caps_Lock),
False, CurrentTime );
}
XCloseDisplay( disp );
return 0;
}
//End of the program
Cheers
José L.
2007/7/12, Capodastro <capodastro at ...626...>:
>
> Is SendKeys possible under Linux?
> Hier a complete set of modules for every language and more, written
> and compiled in Java.
>
> http://sourceforge.net/project/showfiles.php?group_id=9364&package_id=9434&release_id=428656
>
> The alternative is dealing with the 6.000 pages of X11 reference, :)
> Who knows? Perhaps a day that would be also possible in gambas !?
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list