How To Put a Transparent Windoiw in Front of Application

Our Photon application has many layers of popup and dialog windows, with
timers, proxies and all other QNX4 stuff. We don’t run PWM at runtime
environment. But we need some hotkeys that can be invoked at anytime, on any
windows. If I attach these hotkeys to all windows, it’s so tedious and not
clean for later changes. So I am thinking about put a transparent widget in
front all windows.

The transparent window will only catch these hotkey events, and pass on all
other events to responsible parties. I tried many different ways to build
the transparent window, but still can’t get what I want. Anyone has ideas on
this? Please help.

-Jim Nie

Previously, jim_nie wrote in qdn.public.qnx4.photon:

Our Photon application has many layers of popup and dialog windows, with
timers, proxies and all other QNX4 stuff. We don’t run PWM at runtime
environment. But we need some hotkeys that can be invoked at anytime, on any
windows. If I attach these hotkeys to all windows, it’s so tedious and not
clean for later changes. So I am thinking about put a transparent widget in
front all windows.

The transparent window will only catch these hotkey events, and pass on all
other events to responsible parties. I tried many different ways to build
the transparent window, but still can’t get what I want. Anyone has ideas on
this? Please help.

I had to do almost the exact same thing. In my case, I was trying to determine if the user’s (application-level) login had expired. Here’s some code:

In the realization function for my base window:


PtArg_t args[12];
PhArea_t area;
int nargs = 0;
PhRegion_t region;

area.pos.x= 0;
area.pos.y= 0;
area.size.w= SHRT_MAX;
area.size.h= SHRT_MAX;

PtSetArg( &args[nargs++], Pt_ARG_AREA, &area, 0 );

PtSetArg( &args[nargs++], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_PARENT, 0, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_INPUT_GROUP,
cbinfo->event->input_group, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_SENSE, ~0,
Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE );

PtSetArg( &args[nargs++], Pt_ARG_REGION_INFRONT, Ph_DEV_RID, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_FLAGS, ~0, Ph_FORCE_FRONT );
PtSetArg( &args[nargs++], Pt_ARG_REGION_FIELDS, ~0,
Ph_REGION_ORIGIN | Ph_REGION_RECT | Ph_REGION_EV_SENSE
| Ph_REGION_PARENT | Ph_REGION_FLAGS );

PtSetParentWidget( NULL );
Base_Region_Wgt= PtCreateWidget( PtRegion, NULL, nargs, args );
PtSetParentWidget( ABW_base );

PtAddEventHandler( Base_Region_Wgt, Ph_EV_BUT_PRESS, base_region_cb, NULL );
PtRealizeWidget( Base_Region_Wgt );


This creates a big, transparent region in front of everything else. The function base_region_cb() gets called every time the screen/mouse button is pressed. For my application, it just records the time that the event occurred.

This code has been hacked many times… I hope it makes sense…

  • Pete

Thanks for you sample, it’s very helpfull!
-Jim Nie

“Pete D.” <peted@ifspurity.com> wrote in message
news:Voyager.010220144105.163A@node1…

Previously, jim_nie wrote in qdn.public.qnx4.photon:
Our Photon application has many layers of popup and dialog windows, with
timers, proxies and all other QNX4 stuff. We don’t run PWM at runtime
environment. But we need some hotkeys that can be invoked at anytime, on
any
windows. If I attach these hotkeys to all windows, it’s so tedious and
not
clean for later changes. So I am thinking about put a transparent widget
in
front all windows.

The transparent window will only catch these hotkey events, and pass on
all
other events to responsible parties. I tried many different ways to
build
the transparent window, but still can’t get what I want. Anyone has
ideas on
this? Please help.

I had to do almost the exact same thing. In my case, I was trying to
determine if the user’s (application-level) login had expired. Here’s some

code:

In the realization function for my base window:


PtArg_t args[12];
PhArea_t area;
int nargs = 0;
PhRegion_t region;

area.pos.x= 0;
area.pos.y= 0;
area.size.w= SHRT_MAX;
area.size.h= SHRT_MAX;

PtSetArg( &args[nargs++], Pt_ARG_AREA, &area, 0 );

PtSetArg( &args[nargs++], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_PARENT, 0, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_INPUT_GROUP,
cbinfo->event->input_group, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_SENSE, ~0,
Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE );

PtSetArg( &args[nargs++], Pt_ARG_REGION_INFRONT, Ph_DEV_RID, 0 );

PtSetArg( &args[nargs++], Pt_ARG_REGION_FLAGS, ~0, Ph_FORCE_FRONT );
PtSetArg( &args[nargs++], Pt_ARG_REGION_FIELDS, ~0,
Ph_REGION_ORIGIN | Ph_REGION_RECT | Ph_REGION_EV_SENSE
| Ph_REGION_PARENT | Ph_REGION_FLAGS );

PtSetParentWidget( NULL );
Base_Region_Wgt= PtCreateWidget( PtRegion, NULL, nargs, args );
PtSetParentWidget( ABW_base );

PtAddEventHandler( Base_Region_Wgt, Ph_EV_BUT_PRESS, base_region_cb,
NULL );
PtRealizeWidget( Base_Region_Wgt );


This creates a big, transparent region in front of everything else.
The function base_region_cb() gets called every time the screen/mouse button

is pressed. For my application, it just records the time that the event
occurred.

This code has been hacked many times… I hope it makes sense…

  • Pete

    \