Photon 2.0 bug?

The following example program sets the window size after the window is
realized. The window changes to the new size and then back to the old one
once the main loop starts. Only if I re-realize the widget, the new size
stays.
Markus


#include <Pt.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>


main(int argc, char *argv[])
{
PtWidget_t *window;

window = PtAppInit(0, 0, 0, 0, 0);

PhDim_t size;
size.w = 50;
size.h = 100;
PtSetResource(window, Pt_ARG_DIM, &size, 0);

PtRealizeWidget(window);

size.w = 100;
size.h = 50;
PtSetResource(window, Pt_ARG_DIM, &size, 0);

// Uncomment the following to make it work:
// PtReRealizeWidget(window);

sleep(1);

PtMainLoop();
}

Markus Loffler <loffler@ces.clemson.edu> wrote:

The following example program sets the window size after the window is
realized. The window changes to the new size and then back to the old one
once the main loop starts. Only if I re-realize the widget, the new size
stays.

This is a side-effect of how PtWindow negotiates its size and position
with the window manager – PWM gives the widget its position by sending
an event, and processing the event also sets the window’s size.

I hope to get rid of this limitation some day, but for now, the
recommended way of setting the size at startup is by doing it in a
WINDOW_OPENING callback. (There used to be problems with anchoring if
you tried to set the size before realizing the window. I’m not sure
whether those have been fixed or not…)

\

Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.