--- "Philippe C.D. Robert" <[EMAIL PROTECTED]> wrote:
>while porting PC.app to use hardcoded UI instead of gmodels, I noticed that
>menus seem to be broken. I use the latest CVS stuff, and the menus are still
>gmodel based - could this be the reason? I have attached a small image that
>shows the misbehaviour.

I had the same problem and traced it down to the xgps backend a few days ago:

It has nothing to do with gmodels. It's a general problem of window drawing  
using the xgps backend. The xgps backend doesn't give the X Window system  
enough time to finish resizing before it starts drawing to the window. The  
problem only shows in Menus because Menus draw a lot of Windows in series.


In xgps/Source/SharedX/XGContextWindow.m,
[XGContextWindow -_updateWindowParameters:]
the window parameters for drawing (especially the width and height) are  
updated before X has finished the resizing of the window (started in  
-DPSplacewindow:)!

I tried XFlush() and XSync(), but both functions wouldn't wait as expected :-(

I have no clue about X, so what I did (in -_updateWindowParameters:) is get  
the window geometry in a loop, until the values actually changed. This works,  
but there should be a better solution.
There is another hack in [XGContextWindow DPSplacewindow:] which sends a  
resize notification to the NSWindow, in case X wouldn't send a notification.  
Maybe this would be the right place to wait for X.

Here is my patch (hack):


*** XGContextWindow.m   2000/05/05 21:15:16     1.60
--- XGContextWindow.m   2000/05/26 18:24:19
***************
*** 489,497 ****
      return;

    XFlush (XDPY);
!   XGetGeometry(XDPY, window->ident, &window->root,
               &x, &y, &width, &height,
               &window->border, &window->depth);
    window->xframe.size.width = width;
    window->xframe.size.height = height;

--- 489,513 ----
      return;

    XFlush (XDPY);
!
!   /* hack:
!    * wait until a resize of window is finished (especially for NSMenu)
!    * is there any way to wait until X finished it's stuff?
!    * XSync(), XFlush() doesn't do the job!
!    */
!   { int       i = 0;
!
!     do
!     {
!       XGetGeometry(XDPY, window->ident, &window->root,
               &x, &y, &width, &height,
               &window->border, &window->depth);
+     }
+     while( i++<10 && height != window->siz_hints.height );
+   }
    window->xframe.size.width = width;
    window->xframe.size.height = height;


---
Georg Fleischmann

vhf interservice
http://www.vhf.de

Reply via email to