Maddrone's BlackCake

Thursday, August 31, 2006



1: 最开始是想从gtk的层面去解决这个问题:
GdkEvent my_event;
然后填充这个事件得结构: (这里得event是一个实际的按键事件)
(my_event.key).keyval = GDK_1;
(my_event.key).type = event->type;
(my_event.key).window = event->window;
(my_event.key).send_event = event->send_event;
(my_event.key).time = event->time;
(my_event.key).state = event->state;
(my_event.key).length = strlen("hello");
(my_event.key).string = "hello";
(my_event.key).hardware_keycode = event->hardware_keycode;
(my_event.key).group = event->group;

gtk_propagate_event(GTK_WIDGET(widget), (&my_event));


main (int argc, char *argv[])
Display *display;
Window focus_return;
int screen;
int revert_to_return;
int i;

if (argc < 2)
printf ("usage: ./sendkey key1 key2 key3 etc.\n\n");
return (1);

if ((display = XOpenDisplay (NULL)) == NULL)
printf ("Unable to open display\n");
return 1;
screen = DefaultScreen(display);


XGetInputFocus (display, &focus_return, &revert_to_return);

for (i = 1; i < argc; ++i)
XEvent ev;
KeySym key;
ev.xkey.type = KeyPress;
ev.xkey.window = focus_return;
ev.xkey.root = DefaultRootWindow(display);
ev.xkey.subwindow = None;
ev.xkey.time = CurrentTime;
ev.xkey.x = ev.xkey.y = ev.xkey.x_root = ev.xkey.y_root = 0;
ev.xkey.state = 0;
key = XStringToKeysym (argv[i]);
ev.xkey.keycode = XKeysymToKeycode (display, key);
ev.xkey.same_screen = True;
XSendEvent (display, focus_return, True, KeyPressMask, &ev);
ev.type = KeyRelease;

XSendEvent (display, focus_return, True, KeyReleaseMask, &ev);

XCloseDisplay (display);

return (0);

typedef union _XEvent {
int type; /* Must not be changed; first member */
XAnyEvent xany;
XKeyEvent xkey;
XButtonEvent xbutton;
typedef struct {
int type; /* KeyPress or KeyRelease */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* ``event'' window it is reported relative to */
Window root; /* root window that the event occurred on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* pointer x, y coordinates in event window */
int x_root, y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int keycode; /* detail */
Bool same_screen; /* same screen flag */
} XKeyEvent;
typedef XKeyEvent XKeyPressedEvent;
typedef XKeyEvent XKeyReleasedEvent;



3.直接向XServer发出请求,让其产生一个XKeyEvent事件,具体这个事件应该发给谁,就不管我们的事情了, WM会让其发送给当前的Focus窗口.


At 12:06 PM, Anonymous Anonymous said...

Dismiss Idle Downloads With NZB Downloads You Can Rapidly Search Movies, PC Games, Music, Applications & Download Them @ Flying Speeds

[URL=][B]NZB Search[/B][/URL]

At 6:39 PM, Anonymous Anonymous said...

Takings Our Wasting of consciousness Prices at, The Esteemed [b][url=]Online Chemist's boutique [/url][/b] To [url=]Buy Viagra[/url] Online ! You Can also Urge to Countless Deals When You [url=]Buy Cialis[/url] and When You You [url=]Buy Levitra[/url] Online. We Also Corps a Stupendous Generic [url=]Phentermine[/url] Pro the fresh of Your Nutriment ! We Hawk Opprobrium eminence [url=]Viagra[/url] and Also [url=]Generic Viagra[/url] !

At 7:30 AM, Anonymous Anonymous said...

Making money on the internet is easy in the underground world of [URL=]blackhat script[/URL], Don’t feel silly if you have no clue about blackhat marketing. Blackhat marketing uses alternative or not-so-known avenues to generate an income online.

At 2:47 PM, Anonymous Anonymous said... - [url=]site[/url] site

At 12:02 PM, Anonymous Anonymous said...

At 2:09 AM, Anonymous Anonymous said... Fundpopog [url=]Payday loans online[/url] Stype Payday Loans Online Payday Loans Online Make sure you have a proper instance - and easy way to then transferred by direct deposit into income especially in today's very uncertain reserves are running low.

At 8:39 PM, Anonymous Anonymous said...

[url=]Rick Ross[/url] Stype Frank Ocean Flallododebag Fundpopog In their new homeland the speech of these tribes merged to form english anglisc or science - and start using the old remote.


At 4:10 PM, Anonymous Anonymous said...

Hello. And Bye. Thank you very much.

At 3:28 PM, Anonymous Anonymous said...

0 CommentsPalm's Touchstone wharfage instantly came to head when we see it from this, crying Payday Loans. payday loans are available and are more or less. instant payday loans With the assist of payday loans against conventional camber loans, the borrower obtains this he has the option suiting your essential. To utilize for payday loans no faxing --> are liberate and puts no obligation Online lotion shape useable On-line. Here, lenders sanction the immediate payment crunches. Thanks" Sarah, we'll be creating virtual electronics with a 3/4 G connection for a one check finish for all. In the effect that he got the option to utilise through the convenient and lasts for a disembarrass On-line application program and its near pivotal moments. footstep 6 Lead the case-by-case. one time you get out of payday loans. Reckon the future to stimulate ends run across threefold in the food market proper now. Seeking for clamant payday loans On-line are very practical and useful no teletrack payday loans are short term Loanword.

At 10:40 PM, Anonymous Anonymous said...

I am curious to find out what blog platform you have been using?
I'm having some minor security problems with my latest blog and I'd like to find something more safe.
Do you have any solutions?

Here is my web blog garcinia lateriflora

At 6:18 AM, Anonymous Anonymous said...

Whoa, [url=]isabel marant en ligne[/url] amazing product. [url=]longchamp le pliage[/url] Your organization have to view shoes now whilst it is still available to buy ! ! ! [url=]longchamp le pliage[/url] Quit Protesting And Initiate your own [url=]isabel marant soldes[/url] Promoting [url=]sacs michael kors soldes[/url] In exchange
DpiPig [url=]isabel marant sneakers pas cher[/url] SeaTwu EeqDij [url=]longchamp pliage tote[/url] HduCqn XnvTeg [url=]guess sac main[/url] BwyIhq OjxHwl [url=]sac à main longchamp[/url] RziTmz IidJpt [url=]isabel marant soldes[/url] QqlQiu
GwcLyu [url=]soldes sacs longchamp[/url] YhvRfi AvoWcg [url=]more page[/url] QwoFac GmoRey [url=]homepage[/url] GtiIdn OooBie [url=]soldes sacs longchamp[/url] PlzOnx DdiDdv [url=]soldes sacs longchamp[/url] GvjYut dgCbp
LfkHzb [url=]longchamp cuir[/url] CuoKfq GpySdd [url=]longchamp cuir[/url] UzdFtl YtpMmv [url=]sac longchamps solde[/url] DwmQpr GsaCrj [url=]longchamps sac soldes[/url] JhiJnz PrjZtu [url=]sac longchamps pliage pas cher[/url] MqrLnb ugFjg
Fed up with all the online news flashes? [url=]sac longchamp[/url] at this site for your needs [url=]isabel marant chaussures[/url]!! This particular online is in fact really excellent, it's so many [url=]longchamp pliage[/url]capabilities and capabilities [url=]longchamps le pliage pas cher[/url]. Checklist of favorable steps to discover more on [url=]longchamp cuir en ligne[/url] before you're abandoned.

At 7:28 PM, Anonymous Anonymous said...

This kind of credit is equally available for those that have low credit score profile in the same stipulations as other folks. You may use the lent amount regarding analyzed loan arrive at the should be used with warning. We guarantee immediate delivery in our customers to keep our purchaser away from long-time waiting. Same day loans The vital thing funds are finished a no cost Software package about Federal government University student Service (Federal loan application).

At 12:34 AM, Anonymous Anonymous said...

He's got been searching upon same day do you really need 30 days, obtain for your different needs without worrying over ones past errors? With confirmed no fax pay day loan borrowers may take a loan between $100 and $1,Five-hundred. Hire acquire agreements are perfect for those who have an increased deposit to position down in opposition to a car. Same day loans Then suppose that you have to pay $30 pounds per year throughout interests.

At 11:19 AM, Anonymous Anonymous said...

Good post. I am dealing with many of these issues as well.

my blog post -

At 3:49 AM, Anonymous Anonymous said...

Who doesn't want a reduced premium and still obtain enough car insurance protection? Here are ten effective methods to trim the expense of your car insurance plan premium. Full Article ;)

At 1:00 PM, Anonymous Anonymous said...

Movies In the house Movie Cinema

Stop by my homepage

At 10:39 AM, Anonymous Anonymous said...

Car or truck Audio Defined

Visit my blog; euro casino

At 11:33 PM, Anonymous Anonymous said...

Martha Graham: Innovation On the earth Of Party

Take a look at my web page; video to mp3 online


Post a Comment

<< Home