bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix: XGServerWindow.m, -windowDevice: (updated fix)


From: Georg Fleischmann
Subject: Re: Fix: XGServerWindow.m, -windowDevice: (updated fix)
Date: Fri, 14 Jun 2002 18:54:16 GMT

> Isn't the correct way to do this is to wait for a ConfigureNotify event
> with something like XWindowEvent?

No doubt, that's correct. But this means that there is a disorder in the calls  
of methods disregarding the event loop.

If I wait for a ConfigureNotify event in -devicewindow, the program hangs (as  
expected), because the method is not always called with a resize event pending. 
 
So, that's not the way to go.

The problematic call of -devicewindow comes as a result of [XGServerWindow  
-placewindow]. There is some code titled "Failsafe - if X hasn't told us ...".  
This sends a resize event to NSWindow and bypasses the X event loop.

If I remove the failsafe event, there appears a bunch of drawing problems. So,  
with my current overview, I don't see an easy solution to this problem.

If noone has a better idea I suggest to use the attached patch which now adds  
the usleep(1) to the old hack (That's even more safe as a single usleep).
I also added a FIXME with short information (as far as I understand the 
problem).

Georg



2002-06-14  Georg Fleischmann
        * back/Source/x11/XGServerWindow.m [XGServerWindow -windowDevice]:
        usleep(1) and FIXME added to hack



*** back/Source/x11/XGServerWindow.m.old        Tue Jun 11 20:46:25 2002
--- back/Source/x11/XGServerWindow.m    Fri Jun 14 20:42:25 2002
***************
*** 24,29 ****
--- 24,32 ----

  #include "config.h"
  #include <math.h>
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
  #include <Foundation/NSString.h>
  #include <Foundation/NSArray.h>
  #include <Foundation/NSValue.h>
***************
*** 1345,1358 ****
    XFlush (dpy);

    /* 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(dpy, window->ident, &window->root,
                     &x, &y, &width, &height,
                     &window->border, &window->depth);
--- 1348,1364 ----
    XFlush (dpy);

    /* hack:
!    * wait until the resize of window is finished (especially for NSMenu)
!    * FIXME: Actually this method shouldn't be called before the event
!    * loop gets a ConfigureNotify event.
!    * The problem is initiated by -placewindow which sends a failsafe event,
!    * to allow drawing before the return to the event loop.
     */
    {
      int       i = 0;
      do
        {
+       usleep(1);      // wait until X Server finished resizing the window
        XGetGeometry(dpy, window->ident, &window->root,
                     &x, &y, &width, &height,
                     &window->border, &window->depth);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]