Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Handling Ph_WM_RESIZE in 6.4.1 (6.4.0): (13 Items)
   
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 ?
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



Attachment: Text winmail.dat 4.83 KB
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 ...
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;
Re: Handling Ph_WM_RESIZE in 6.4.1 (6.4.0)  
are you trying to write your own main loop?
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.
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



Attachment: Text winmail.dat 4.14 KB
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?
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.
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.
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.
Attachment: Text phresize.tar.gz 5.53 KB
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.
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 .... :-/