diff --git a/ChangeLog b/ChangeLog index 87406bd..1d51f30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2020-02-26 Sergii Stoian + + * Headers/x11/XGServerWindow.h (_gswindow_device_t): new structure + memeber was added - `osframe`. This member intended to hold cached frame + of windows in OpenStep coordinate system. This makes backend more + reliable to the cases when gui changes NSWindow's _frame ivar before + call to backend methods which make windows placement. + + * Source/x11/XGServerWindow.m (placewindow::): use `osframe` structure + member to decide if window change position or size. Removed usage of + temporary `frame` (used only for making desicion). + 2020-02-24 Sergii Stoian * Source/x11/XGServerWindow.m (placewindow::): use window->xframe diff --git a/Headers/x11/XGServerWindow.h b/Headers/x11/XGServerWindow.h index f9cad27..adca517 100644 --- a/Headers/x11/XGServerWindow.h +++ b/Headers/x11/XGServerWindow.h @@ -95,7 +95,8 @@ typedef struct _gswindow_device_t { int visibility; /* X visibility */ int wm_state; /* X WM state */ NSBackingStoreType type; /* Backing type */ - NSRect xframe; /* Window frame */ + NSRect xframe; /* Window frame in X11 coordinates */ + NSRect osframe; /* Window frame in OpenStep coordinates */ unsigned int buffer_width; /* Size in pixels of the current buffers. */ unsigned int buffer_height; diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index 81be6b0..46f29f6 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -3219,7 +3219,6 @@ swapColors(unsigned char *image_data, NSBitmapImageRep *rep) NSEvent *e; NSRect xVal; NSRect xHint; - NSRect frame; gswindow_device_t *window; NSWindow *nswin; BOOL resize = NO; @@ -3234,19 +3233,24 @@ swapColors(unsigned char *image_data, NSBitmapImageRep *rep) NSDebugLLog(@"XGTrace", @"DPSplacewindow: %@ : %d", NSStringFromRect(rect), win); - frame = [self _XFrameToOSFrame: window->xframe for: window]; - if (NSEqualRects(rect, frame) == YES) - return; - if (NSEqualSizes(rect.size, frame.size) == NO) + if (NSEqualRects(rect, window->osframe) == YES) + { + return; + } + + if (NSEqualSizes(rect.size, window->osframe.size) == NO) { resize = YES; move = YES; } - if (NSEqualPoints(rect.origin, frame.origin) == NO) + else if (NSEqualPoints(rect.origin, window->osframe.origin) == NO) { move = YES; } + // Cache OpenStep window frame for future comparison + window->osframe = rect; + /* Temporarily remove minimum and maximum window size hints to make * the window resizable programatically. */