Dear all,

Now I create a thread to receive command from another a parent and run 
GrInjectKeyboardEvent function to inject a key as command the program to do 
show hide in process main loop.

In FLTK, I register the handler by


int handle(int e)
{

cout<<Fl::event_key()<<endl;
:
:
}
:
:

static void *commandHandler(void *p)
{
        int com;
        while(1)
        {
                if(mq->receive(&com))
                {
                }
                else
                {
                        break;
                }

                switch(com)
                {
                case 1://home


                        GrInjectKeyboardEvent(fl_xid(mw),'a', 0, 0, 1);
                        GrInjectKeyboardEvent(fl_xid(mw),'a', 0, 0, 0);
                        break;
                case 2:
                        GrInjectKeyboardEvent(fl_xid(mw),'b', 0, 0, 1);
                        GrInjectKeyboardEvent(fl_xid(mw),'b', 0, 0, 0);
                        break;
                }
        }
}


:
:
int main()
{
:
:
        Fl::add_handler(handle);
:
:
        pthread_t thread;
        pthread_create(&thread, NULL, commandHandler, mw);

        return Fl::run();

}

However, in the handle, I always read Fl::event_key() equal to 0.

I have tried to inject ascii keys a and b but they all results 0 in handle.

I do not know why, is it my fault?

BR,
Terry

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to