Mike Gorchak
|
Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Mike Gorchak
04/29/2009 10:25 AM
post28351
|
Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
The window has been initialized using these flags:
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_APP_DEF_MANAGED);
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_BACKDROP | Ph_WM_TOFRONT | Ph_WM_COLLAPSE |
Ph_WM_FFRONT | Ph_WM_FOCUS | Ph_WM_HELP | Ph_WM_HIDE | Ph_WM_MAX | Ph_WM_MENU | Ph_WM_MOVE | Ph_WM_RESIZE |
Ph_WM_RESTORE | Ph_WM_TASKBAR | Ph_WM_TOBACK);
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_CLOSE | Ph_WM_HELP);
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_CLOSE | Ph_WM_COLLAPSE | Ph_WM_FOCUS |
Ph_WM_MAX | Ph_WM_MOVE | Ph_WM_RESIZE | Ph_WM_RESTORE | Ph_WM_HIDE);
I can't catch Ph_WM_RESIZE event with these parameters because this event is not emitted after window resize.
When Ph_WM_RESIZE is removed from Pt_ARG_WINDOW_MANAGED_FLAGS flags, the Ph_WM_RESIZE is emitted, but as far as I can
know I need manually resize window and change its position if resize event is not managed by WM.
Pt_ARG_POS resource can be changed without any problem, window changes its position, but Pt_ARG_DIM resource settings
are ignored by PtWindow widget. In 6.3.2 behavior was different.
My thoughts was about maximum/minimum widget dimension setting problem, by I set:
winsize.w=0;
winsize.h=0;
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_WIDTH, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_WIDTH, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MAXIMUM_DIM, &winsize, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MINIMUM_DIM, &winsize, 0);
This doesn't helps me to resize window widget. And later:
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_WIDTH, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_WIDTH, 0, 0);
winsize.w=65536;
winsize.h=65536;
PtSetArg(&winargs[winargc++], Pt_ARG_MAXIMUM_DIM, &winsize, 0);
winsize.w=0;
winsize.h=0;
PtSetArg(&winargs[winargc++], Pt_ARG_MINIMUM_DIM, &winsize, 0);
This doesn't work too.
What am I missed ?
P.S. Documentation doesn't have nothing about Pt_ARG_MINIMUM_DIM/Pt_ARG_MAXIMUM_DIM default value 0,0 behavior. What 0,
0 does ? Is it the same as in the Pt_ARG_MAX_WIDTH/Pt_ARG_MAX_HEIGHT ?
|
|
|
Derek Leach
|
RE: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Derek Leach
04/30/2009 3:56 AM
post28411
|
RE: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
What about the Pt_CB_RESIZE callback? Does this work at all?
________________________________
From: Mike Gorchak [mailto:community-noreply@qnx.com]
Sent: Wed 29/04/2009 10:25 AM
To: photon-graphics
Subject: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
The window has been initialized using these flags:
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_APP_DEF_MANAGED);
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_BACKDROP | Ph_WM_TOFRONT | Ph_WM_COLLAPSE |
Ph_WM_FFRONT | Ph_WM_FOCUS | Ph_WM_HELP | Ph_WM_HIDE | Ph_WM_MAX | Ph_WM_MENU | Ph_WM_MOVE | Ph_WM_RESIZE |
Ph_WM_RESTORE | Ph_WM_TASKBAR | Ph_WM_TOBACK);
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_CLOSE | Ph_WM_HELP);
PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_CLOSE | Ph_WM_COLLAPSE | Ph_WM_FOCUS |
Ph_WM_MAX | Ph_WM_MOVE | Ph_WM_RESIZE | Ph_WM_RESTORE | Ph_WM_HIDE);
I can't catch Ph_WM_RESIZE event with these parameters because this event is not emitted after window resize.
When Ph_WM_RESIZE is removed from Pt_ARG_WINDOW_MANAGED_FLAGS flags, the Ph_WM_RESIZE is emitted, but as far as I can
know I need manually resize window and change its position if resize event is not managed by WM.
Pt_ARG_POS resource can be changed without any problem, window changes its position, but Pt_ARG_DIM resource settings
are ignored by PtWindow widget. In 6.3.2 behavior was different.
My thoughts was about maximum/minimum widget dimension setting problem, by I set:
winsize.w=0;
winsize.h=0;
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_WIDTH, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_WIDTH, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MAXIMUM_DIM, &winsize, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MINIMUM_DIM, &winsize, 0);
This doesn't helps me to resize window widget. And later:
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MAX_WIDTH, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_HEIGHT, 0, 0);
PtSetArg(&winargs[winargc++], Pt_ARG_MIN_WIDTH, 0, 0);
winsize.w=65536;
winsize.h=65536;
PtSetArg(&winargs[winargc++], Pt_ARG_MAXIMUM_DIM, &winsize, 0);
winsize.w=0;
winsize.h=0;
PtSetArg(&winargs[winargc++], Pt_ARG_MINIMUM_DIM, &winsize, 0);
This doesn't work too.
What am I missed ?
P.S. Documentation doesn't have nothing about Pt_ARG_MINIMUM_DIM/Pt_ARG_MAXIMUM_DIM default value 0,0 behavior. What 0,
0 does ? Is it the same as in the Pt_ARG_MAX_WIDTH/Pt_ARG_MAX_HEIGHT ?
_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post28351
|
|
|
Mike Gorchak
|
Re: RE: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Mike Gorchak
04/30/2009 7:39 AM
post28423
|
Re: RE: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
I'm not using callback, I use PhPeekEvent to collect window events. So I can't say works this callback or not ...
|
|
|
Derek Leach
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Derek Leach
04/30/2009 7:50 AM
post28425
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
About width/height vs. dim, they are the same ...
case Pt_ARG_MAX_HEIGHT:
1003 if( window->max_height == (short)arg->value )
1004 break;
1005 widget->max_dim.h = window->max_height = max((short)arg->value, ((short)arg->value > 0 ) ? window->min_height
: SHRT_MAX );
1006 if (widget->area.size.h > widget->max_dim.h ) {
1007 widget->area.size.h = widget->max_dim.h;
1008 widget->flags |= Pt_WIDGET_RESIZE;
1009 PtInvalidateCanvas(widget);
1010 }
1011 PtWindowSetInfo( Ph_WM_SET_FRAME_ATTRIB, widget );
1012 break;
1013 case Pt_ARG_MAX_WIDTH:
1014 if( window->max_width == (short)arg->value )
1015 break;
1016 widget->max_dim.w = window->max_width = max((short)arg->value, ((short)arg->value > 0 ) ? window->min_width :
SHRT_MAX );
1017 if (widget->area.size.w > widget->max_dim.w ) {
1018 widget->area.size.w = widget->max_dim.w;
1019 widget->flags |= Pt_WIDGET_RESIZE;
1020 PtInvalidateCanvas(widget);
1021 }
1022 PtWindowSetInfo( Ph_WM_SET_FRAME_ATTRIB, widget );
1023 break;
|
|
|
Derek Leach
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Derek Leach
04/30/2009 8:12 AM
post28427
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
are you trying to write your own main loop?
|
|
|
Mike Gorchak
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Mike Gorchak
04/30/2009 8:24 AM
post28429
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
> are you trying to write your own main loop?
Yes, it is not a complex task, except resize issues in 6.4.x.
|
|
|
Derek Leach
|
RE: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Derek Leach
04/30/2009 8:32 AM
post28430
|
RE: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
I am not sure, but I think it was a "bug" in 632, it was processing events even though they were not "managed", I am not
sure how to force pwm to redraw/resize the window ... what happens if you:
received the Ph_WM_RESIZE:
enqueue a "resize" message for processing outside your main loop.
when messages are done, then:
flip on the managed bit, and damage the window
Hopefully some other Photon guys can clarify ... :)
-Derek
________________________________
From: Mike Gorchak [mailto:community-noreply@qnx.com]
Sent: Thu 30/04/2009 8:24 AM
To: photon-graphics
Subject: Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
> are you trying to write your own main loop?
Yes, it is not a complex task, except resize issues in 6.4.x.
_______________________________________________
Photon microGUI
http://community.qnx.com/sf/go/post28429
|
|
|
Misha Nefedov
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Misha Nefedov
04/30/2009 9:35 AM
post28441
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
Mike, could you post your sample app, so I can quickly try it on my end?
|
|
|
Mike Gorchak
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Mike Gorchak
04/30/2009 3:17 PM
post28472
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
Ok. It is SDL 1.3, I'll commit all necessary changes to SVN this weekend and you can checkout it using "svn checkout
http://svn.libsdl.org/trunk/SDL" . I'll post a message here when all my changes will be in SVN.
|
|
|
Misha Nefedov
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Misha Nefedov
04/30/2009 3:37 PM
post28473
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
I would like to get a small sample that demostrates just this problem.
|
|
|
Mike Gorchak
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Mike Gorchak
05/04/2009 5:54 AM
post28588
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
> I would like to get a small sample that demostrates just this problem.
Ok, this is an example.
|
|
|
Misha Nefedov
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Misha Nefedov
05/04/2009 10:27 AM
post28622
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
The bug is in the sample code. The code uses the winsize dim for these resources:
Pt_ARG_MAXIMUM_DIM, Pt_ARG_MINIMUM_DIM and Pt_ARG_DIM.
By the time the PtCreateWidget() is called the winsize is set to 640x480, so all of these resources will be tried to be
set to 640x480. When trying to resize the window, the size is constrained to 640x480 as expected.
|
|
|
Mike Gorchak
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
|
Mike Gorchak
05/04/2009 11:40 AM
post28634
|
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)
> The bug is in the sample code. The code uses the winsize dim for these
> resources:
> Pt_ARG_MAXIMUM_DIM, Pt_ARG_MINIMUM_DIM and Pt_ARG_DIM.
> By the time the PtCreateWidget() is called the winsize is set to 640x480, so
> all of these resources will be tried to be set to 640x480. When trying to
> resize the window, the size is constrained to 640x480 as expected.
Thanks for the help. Stupid bug .... :-/
|
|
|
|