mirror of
https://github.com/gnustep/libs-back.git
synced 2025-05-13 16:51:05 +00:00
Add hack to wait a while for visibility events when checking style offsets.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23626 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9b0cac8c46
commit
f21f913f53
2 changed files with 48 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2006-09-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/x11/XGServerWindow.m: Add more debug for checking style
|
||||||
|
offsets. Wait for up to a second for visibility events in case
|
||||||
|
XSync() does not work to ensure we receive them.
|
||||||
|
|
||||||
2006-09-25 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-09-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Headers/x11/XGGeneric.h: Extra fielkd to flag when style offsets
|
* Headers/x11/XGGeneric.h: Extra fielkd to flag when style offsets
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
|
#include <Foundation/NSThread.h>
|
||||||
#include <AppKit/DPSOperators.h>
|
#include <AppKit/DPSOperators.h>
|
||||||
#include <AppKit/NSApplication.h>
|
#include <AppKit/NSApplication.h>
|
||||||
#include <AppKit/NSCursor.h>
|
#include <AppKit/NSCursor.h>
|
||||||
|
@ -580,7 +581,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
||||||
window->xwn_attrs.save_under = False;
|
window->xwn_attrs.save_under = False;
|
||||||
window->xwn_attrs.override_redirect = False;
|
window->xwn_attrs.override_redirect = False;
|
||||||
window->map_state = IsUnmapped;
|
window->map_state = IsUnmapped;
|
||||||
window->visibility = -1;
|
window->visibility = 2;
|
||||||
|
|
||||||
// Create an X GC for the content view set it's colors
|
// Create an X GC for the content view set it's colors
|
||||||
values.foreground = window->xwn_attrs.background_pixel;
|
values.foreground = window->xwn_attrs.background_pixel;
|
||||||
|
@ -690,13 +691,48 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
||||||
[self orderwindow: NSWindowAbove : 0 : window->number];
|
[self orderwindow: NSWindowAbove : 0 : window->number];
|
||||||
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while (XPending(dpy) > 0)
|
while (XPending(dpy) > 0 || window->visibility > 1)
|
||||||
{
|
{
|
||||||
|
if (XPending(dpy) == 0)
|
||||||
|
{
|
||||||
|
NSDate *until;
|
||||||
|
|
||||||
|
/* In theory, after executing XSync() all events resulting from
|
||||||
|
* our window creation and ordering front should be available in
|
||||||
|
* the X event queue. However, it's possible that a window manager
|
||||||
|
* could send soime events after the XSync() has been satisfied,
|
||||||
|
* so if we have not received a visibility notification we can wait
|
||||||
|
* for up to a second for more events.
|
||||||
|
*/
|
||||||
|
until = [NSDate dateWithTimeIntervalSinceNow: 1.0];
|
||||||
|
while (XPending(dpy) == 0 && [until timeIntervalSinceNow] > 0.0)
|
||||||
|
{
|
||||||
|
CREATE_AUTORELEASE_POOL(pool);
|
||||||
|
|
||||||
|
[NSThread sleepUntilDate:
|
||||||
|
[NSDate dateWithTimeIntervalSinceNow: 0.01]];
|
||||||
|
DESTROY(pool);
|
||||||
|
}
|
||||||
|
if (XPending(dpy) == 0)
|
||||||
|
{
|
||||||
|
NSLog(@"Waited for a second, but the X system never"
|
||||||
|
@" made the window visible");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
XNextEvent(dpy, &xEvent);
|
XNextEvent(dpy, &xEvent);
|
||||||
NSDebugLLog(@"Offset", @"Testing ... event %d window %d\n",
|
NSDebugLLog(@"Offset", @"Testing ... event %d window %d\n",
|
||||||
xEvent.type, xEvent.xany.window);
|
xEvent.type, xEvent.xany.window);
|
||||||
|
if (xEvent.xany.window != window->ident)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (xEvent.type)
|
switch (xEvent.type)
|
||||||
{
|
{
|
||||||
|
case VisibilityNotify:
|
||||||
|
window->visibility = xEvent.xvisibility.state;
|
||||||
|
break;
|
||||||
|
|
||||||
case ReparentNotify:
|
case ReparentNotify:
|
||||||
NSDebugLLog(@"Offset", @"%d ReparentNotify - offset %d %d\n",
|
NSDebugLLog(@"Offset", @"%d ReparentNotify - offset %d %d\n",
|
||||||
xEvent.xreparent.window, xEvent.xreparent.x,
|
xEvent.xreparent.window, xEvent.xreparent.x,
|
||||||
|
@ -820,6 +856,10 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
||||||
XNextEvent(dpy, &xEvent);
|
XNextEvent(dpy, &xEvent);
|
||||||
NSDebugLLog(@"Offset", @"Destroying ... event %d window %d\n",
|
NSDebugLLog(@"Offset", @"Destroying ... event %d window %d\n",
|
||||||
xEvent.type, xEvent.xany.window);
|
xEvent.type, xEvent.xany.window);
|
||||||
|
if (xEvent.xany.window != window->ident)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (generic.offsets[style].known == NO)
|
if (generic.offsets[style].known == NO)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue