William M. Derby Jr. <derbyw@derbtronics.com> wrote:
On 10 Jan 2001 16:16:26 GMT, Norbert Black <> nblack@qnx.com> > wrote:
Frankly the “INPUTGROUP” thing is a bit of a
mystery to me – what exactly is its purpose?
Erm… You know, I should know… I know
that an “input group” is a collection of physical
mouse/keyboard/touchscreen/whatever associated with a single
user. By grouping them, we allow for screening (lightbulb goes
on) - on where the events are coming from. D’oh!
You know, you could filter based on the input_group member of the
event. Remote connections can be forced into a new input group
(phditto takes a -i, for instance)…
This doesn’t quite wok out.
I know this is a typo, but I have this bizarre vision of you
competing in the “Iron Chef” competition, software category…
if you start phditto with a -i for an
input group that doesn’t exist – it just complains that it doesn’t
exist and refuses to start up… I then tries the -u option which is
supposed to create a new input group and… The “-u” option
appears broken. It doesn’t create the second pointer on my system as
the documentation states – matter of fact it seems to have no effect
at all…
sigh Garry? Anybody? As I may have said before, I’m out on
the edge of my experience base here…
With that in mind I have created a variartion of the PhRegionOpen
example which puts region up and draws rectangles which follow the
mouse as it moves over the region. I have created the “filter” region
on the dev side and actually have the thing working.
Well done, that man.
The example will
handle key and pointer events (ESC exits) and the color of the
rectangle will change delpending if you are local or remote.
There are some odd quirks though…
- The filter region must specify a region rect. but as long as the
rect in non-zero the size doesn’t matter - i.e.; you get all PTR and
KBD events…
Don’t ask me, boss. Hopefully the real expert in this will
finally get back from Las Vegas soon…
- You must register for RAW events and you must NOT make the region
OPAQUE to the RAW events. (i.e. suddenly ALL input is gobbled up and
you must use another node to terminate the program.)
Yep – that I’d expect. That’s OPAQUE by definition, right?
No event goes past a region that is OPAQUE to it.
My Idea was to change the input_group field of the event and re-emit
it- but I don’t seem to be able to re-emit the event and have it do
anything…is there some trick to re-emiting a raw event?
Souldn’t be? Here’s a bit of sample code that emits a raw key
event directly at the device region:
***************** begins *******************************
int keyname;
PhEvent_t event;
PhRawKeyEvent_t data;
PhRect_t rect;
sleep(3); /* give time for user to change focus */
memset( &event, 0, sizeof( event ) );
memset( &data, 0, sizeof( data ) );
event.type = Ph_EV_RAW;
event.subtype = Ph_EV_RAW_KEY;
event.emitter.rid = Ph_DEV_RID;
event.collector.rid = Ph_DEV_RID;
event.flags = Ph_EVENT_DIRECT;
event.input_group = get_input_group( NULL );
event.data_len = sizeof( data );
event.num_rects = 1;
/* the event’s rectangle covers the entire event space, saves us from
finding out the extent of the collector’s region */
rect.ul.x = rect.ul.y = SHRT_MIN;
rect.lr.x = rect.lr.y = SHRT_MAX;
keyname = ApName( widget );
/* Pk_* macros are from /usr/include/photon/PkKeyDef.h /
if( keyname <= ABN_base_btn_key0 )
{
/ set data.key_cap as a value from Pk_0 to Pk_9 */
data.key_cap = (ApName( widget ) - ABN_base_btn_key1) + 1;
if( data.key_cap == 10 )
data.key_cap = 0;
data.key_cap += Pk_0;
}
else if ( keyname == ABN_base_btn_keyF1 )
{
data.key_cap = Pk_F1;
}
data.key_sym = data.key_cap;
data.key_mods = 0;
/* emit key down */
data.key_flags = Pk_KF_Sym_Valid | Pk_KF_Cap_Valid | Pk_KF_Key_Down;
PhEventEmit( &event, &rect, &data );
/* emit key up */
data.key_flags |= ~(Pk_KF_Key_Down | Pk_KF_Sym_Valid );
PhEventEmit( &event, &rect, &data );
****************** ends ********************************
This is Photon 2.0 code, by the way. Note in particular that you
must not have Pk_KF_Sym_Valid set on the key up, otherwise you
will seem to get two key events.
Because this didn’t work I came up with the following: Leave the
region Opaque which means you will recieve 2 events for each
actual event. The first is the raw event and the second is cooked one.
Hmmmmm. This sounds fishy. Are you sure that you have your
region between the Device region and the region owned by phrelay?
The former is supposed to eat all the raw key and ptr. events
once they reach it.
- For some reason I get the local (Input) KBD and PTR events and
phrelay KBD events but do NOT get phrelay PTR events – this is really
bizarre… To get my stuff to work I had to make the remote/local flag
always reset to REMOTE so that when cooked messages showed up with no
corresponding raw event they would be handled correctly…
Any clues here?
Symptom of what, I do not know.
I put my example on my FTP site if you want to try it
Thanks, but I’m probably not going to get a chance today. (Heck,
I shouldn’t really be typing this… )
Let us know how all of this shakes out, and maybe I can catch a
later iteration?
Norbert Black
QSSL Training Services