From ef1710f5e78a21a9f3977d719ecbafff1bee76b8 Mon Sep 17 00:00:00 2001 From: Adam Fedor Date: Tue, 25 Jun 2002 03:45:42 +0000 Subject: [PATCH] Use usleep not loop to wait for resize git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@13965 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/x11/XGServerWindow.m | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 252e675..c406351 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-06-24 Adam Fedor + + * Source/x11/XGServerWindow.m ([XGServer -windowdevice:]): Use + usleep instead of loop to wait for resize (rewritten + patch from georg@vhf.de). + Sat Jun 22 14:28:28 2002 Nicola Pero * Source/gsc/GSGState.m ([-DPScurrentpoint::]): Use -invert, not diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index 6a0e641..485f544 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -37,6 +37,10 @@ #include #include +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef HAVE_WRASTER_H #include "wraster.h" #else @@ -1344,21 +1348,22 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, XFlush (dpy); + XGetGeometry(dpy, window->ident, &window->root, + &x, &y, &width, &height, + &window->border, &window->depth); /* 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); - } - while( i++<10 && height != window->siz_hints.height ); - } + if (height != window->siz_hints.height) + { + usleep(1); + XGetGeometry(dpy, window->ident, &window->root, + &x, &y, &width, &height, + &window->border, &window->depth); + } + window->xframe.size.width = width; window->xframe.size.height = height;