Can't see window contents using phindows

I’m working on application that is using a custom UI engine. The application initializes Photon using PtInit and creates a Photon window (PtCreateWidget) and an image (PhCreateImage). The image buffer is used by the UI engine for rendering. When the app needs to update the window, it uses PgDrawPhImage. Everything works correctly when I run the application directly on the target system.

When I try and run the application from a remote Windows system using phindows, the app window gets created correctly but the contents of the window is never shown. My diagnostic output shows that the app is running correctly and is receiving input.

Does anyone have any idea why my window contents aren’t visible when using phindows?

Are you updating the tag value (checksum) of the PhImage_t

I tried updating the image_tag field with the results of PtCRC on the image buffer before each call to PgDrawPhImage, but that didn’t seem to have any affect.

I’m was also experimenting with the argument to PtInit instead of using a NULL to see what would happen and I found that if I used “/dev/photon” that my app window would appear on the target system display instead of in my phindows session and that the windows contents are visible. I also noticed that a phindows connection causes a /dev/phXXXX device to be created so I tried using that as the argument to PtInit. That seems to work the same as passing in a NULL; the window appears in the phindows session with no visible contents.

I’m thinking that it’s something simple that I’m missing, but haven’t been able to figure it out by searching the docs so far.

IIRC you can’t use shared memory with images and phindows. In your routines that initiate memory allocation make sure to not use shared mem allocate routines. This is for QNX 4, I don’t know if the same restriction applies for QNX6

I was using shared memory for the image, but I get the same behavior if I don’t use shared memory. I am using QNX6.

My initialization code is:

if (PtInit(NULL) == -1)
printf(“Error initializing widget library\n”);

dim.w = PW_UI_OSD_WIDTH;

PtSetArg(&args[0], Pt_ARG_WINDOW_TITLE, “Demo”, 0);
PtSetArg(&args[1], Pt_ARG_DIM, &dim, 0);
PtSetArg(&args[2], Pt_ARG_MINIMUM_DIM, &dim, 0);
PtSetArg(&args[3], Pt_ARG_MAXIMUM_DIM, &dim, 0);
PtSetArg(&args[4], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);

if ((window = PtCreateWidget(PtWindow, Pt_NO_PARENT, 5, args)) == NULL)
printf(“Error creating window\n”);

sImage = PhCreateImage(NULL,


And my window update code is:

pos.x = 0;
pos.y = 0;
sImage->image_tag = PtCRC(sImage->image, PW_UI_OSD_WIDTH *
result = PgDrawPhImage(&pos, sImage, 0);

My window displays properly on the target system, just not when using phindows.

I was able to work with QNX support to figure out what was happening. Following is the information I received from support:

What you’re seeing is a bug in Phindows. You can work around it by manually specifying a clipping that is smaller than the default Photon space. Example code to be placed before the image draw is as follows:

PhRect_t area;

area.ul.x = -5000;
area.ul.y = -5000; = 5000; = 5000;
PgSetClipping(1, &area);

That being said, you can avoid the problem altogether by changing how you’re working with the PtRaw widget. There’s an example in the Photon Programmer’s Guide, under Raw Drawing and Animation. It describes how to use a PtRaw widget with a draw function. When implemented, any part of the application that damages a part of the screen and needs it redrawn just has to call PtDamageExtent(). Photon will take care of calling the draw function with clipping rectangles already set up.

If all you want to do is display an image, a raw draw function is not needed. Instead you can write code that creates a PtLabel widget of type Pt_IMAGE, set the image as the label’s Pt_ARG_LABEL_DATA and create the label as a child of the PtWindow.

Either method above will result in proper clipping rectangles passed to Phindows which will resolve the bug.

Once I added the setting of the clipping area, the app window contents started showing up via phindows.