region parent

hi

i have two separate photon applications. i want to set the base window of
first application as parent of the second application base window.

In second application i have used PhRegionQuery with basewindow rid, to
get region details of the application. then i am setting the parent member
of the region, to base window Rid of first application. after this i am
calling PhRegionChange for setting the region information.
but this is terminating my application.


what is corrent method for setting the parent of the window to another
application window ?
do i have to set all the regions of the application as child of the parent?
or is it ok if only the window is as child of the parent and window manager
region of the application is left as it is ?

can anybody help me in this…

thanks in advance

sameer

sam <seto@vsnl.com> wrote:

i have two separate photon applications. i want to set the base window of
first application as parent of the second application base window.

The short answer is that the PtWindow widget doesn’t support that. It
might be possible if you wrote your own window widget class. But I’m
afraid it would be rather tricky.

It would be much easier and safer to have one application own both
windows and the other application create a PtRegion inside of one of the
windows. You’d have to come up with a way to pass things like key
events and size changes from the window to the PtRegion.

If you don’t mind using an officially unsupported mechanism, you could
try the PtClient and PtServer widgets – they will do most of the above
for you. They’re only documented in QNX 6, but they exist in Photon
1.14 and don’t differ much from what the QNX6 docs say.

In second application i have used PhRegionQuery with basewindow rid, to
get region details of the application. then i am setting the parent member
of the region, to base window Rid of first application. after this i am
calling PhRegionChange for setting the region information.
but this is terminating my application.

In general, PhRegionChange() is not a good way of modifying a window.
It talks directly to Photon, without telling the window manager that
you’ve changed something, which can produce all sorts of confusion. And
in this case, you’d be pulling the window out of its frame and
reparenting it into the other window’s frame, which is not what you
wanted to do anyway.

PhWindowChange() is a better way because it actually asks the window
manager to do the change; but if you do that behind the library’s back,
there’s still a good chance that you’re changing something that the
library may rely on (and in general, there’s no documented way to make
sure that you’re not). And pwm won’t reparent an existing window anyway
– normally when you reparent a widget, the library unrealizes and then
realizes it, which is implemented by destroing the region or window and
then creating a new one.

what is corrent method for setting the parent of the window to another
application window ?

There is no officially supported way of doing that,

do i have to set all the regions of the application as child of the parent?
or is it ok if only the window is as child of the parent and window manager
region of the application is left as it is ?

Reparenting regions won’t help. From the point of view of regions, the
idea of one window being the parent of another doesn’t really exist.
Every window region is the child of its window frame region, and all the
frame regions have the same parent.

hi Wojtek Lerch,

thank you for your quick and detail response,

my basic problem is i have two separate applications, first application
starts second application for specific task. then user can close the
second application. user has no knowledge that he interacting with 2
separate applications.
now, as 2 applications are separate if i click on first application it
comes in front of second application. first application covers full screen
and second covers only part of screen. this makes second application
disapprear from the screen.
i can not use FFRONT for the second application.

how can i avoid second application screen going behind the first
application ?

i did not get the following part :

the other application create a PtRegion inside of one of the
windows.
can you please give some details about how this is done ?

thank you for your support

sameer

sam <seto@vsnl.com> wrote:

hi Wojtek Lerch,

thank you for your quick and detail response,

my basic problem is i have two separate applications, first application
starts second application for specific task. then user can close the
second application. user has no knowledge that he interacting with 2
separate applications.
now, as 2 applications are separate if i click on first application it
comes in front of second application. first application covers full screen
and second covers only part of screen. this makes second application
disapprear from the screen.
i can not use FFRONT for the second application.

how can i avoid second application screen going behind the first
application ?

I think if you set the Ph_WM_TOFRONT flag in Pt_ARG_WINDOW_MANAGED_FLAGS
of the first window, and perhaps Ph_WM_TOBACK in the second window, it
should cover most (if not all) scenarios… Additionally, it might make
sense to block the first window.

i did not get the following part :
the other application create a PtRegion inside of one of the
windows.
can you please give some details about how this is done ?

App 1 creates window 2 as the child of its window 2, and passes its rid
to app 2. (Since app 1 spawns app 2, it can give it the rid in a
command-line argument.)

App 2 creates a PtRegion and sets its parent (Pt_ARG_REGION_PARENT) to
the rid obtained from app 2.

App 2 puts all of its widgets inside the PtRegion. The easiest way to do
by using a PhAB picture module, and calling ApCreateModule().