RE: gtk-app-devel-list Digest, Vol 10, Issue 51




Marc Santhoff's application sounds very much like what I'm trying to do.

My status 24 hours later:

I am receiving events over a socket, translating them to key events.

I insert the events with gdk_event_put()  both the GDK_KEY_PRESS and
GDK_KEY_RELEASE
events!

I had to grab the keyboard in order to get the events to be reflected
immediately.  Before I added the keyboard grab, it took an enter/leave
of the mouse to see things happen.

So far, the events don't get directed to my application unless it has
focus.  I haven't added a grab-focus yet (which one??).

I think the XTest approach sounds reasonable also, but I'm going to head
down this path for a while.

Thanks everybody!



-----Original Message-----
Message: 3
Date: Thu, 24 Feb 2005 13:39:04 +0100
From: Marc Santhoff <M Santhoff t-online de>
Subject: Re: GTK app with no keyboard/mouse
To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
Message-ID: <1109248744 272 8 camel zaphod das netz>
Content-Type: text/plain

Am Do, den 24.02.2005 schrieb Olexiy Avramchenko um 10:10:
Marc Santhoff wrote:
According to some postings on this list, some people tried to 
synthesize GDK events from their code and failed.

What exactly did you try to do ? I use gdk_event_put to simulate
keyboard events from GIOChannel that reads data from keyboard on
serial 
port. Works well (maybe my case is just simplier?).

Nothing, it's already done. ;) But I appreciate your help.

At the start of this project I had to decide for one method of:

- getting events from a USB controller sending key-like events on a
generic device
- write some code for setting up the contoller and sending commands to
it
- translate the key-like events into real key events and propagate them
to my program

I decided to use XTest because it was the simplest thing to use and I
have one central point of translation (custom keycodes have to be
mangled, table driven translation). One more cause is to have an option
for steering other X11 programmes than my own GTK thingy.

Btw. I'm using GTK+1.2 and will continue doing so. The hardware running
the prog is somewhat weak, so I have to be careful in pulling in more
ressources.

But I would in fact like to see a piece of code synthesizing key events
(and mouse movements) from arbitrary sources like a GIOChannel. Maybe
the hardware or some decisions change in the future...



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]