Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only Send NSWindowDidResizeNotification When Resizing, Not When Moving #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions AppKit/X11.backend/X11Display.m
Original file line number Diff line number Diff line change
Expand Up @@ -1216,11 +1216,16 @@ - (void) postXEvent: (XEvent *) ev {
NSLog(@"ReparentNotify");
break;

case ConfigureNotify:
case ConfigureNotify:;
// -[X11Window realFrame] is used instead of -[X11Window frame] because -[X11Window frame] is
// modified by -[X11Window setFrame], so if you resized using -[X11Window setFrame] it would only
// register as a window move
O2Rect oldFrame = [window realFrame];
[window frameChanged];
O2Rect newFrame = [window realFrame];
[delegate platformWindow: window
frameChanged: [window frame]
didSize: YES];
frameChanged: newFrame
didSize: !NSEqualSizes(newFrame.size, oldFrame.size)];
break;

case ConfigureRequest:
Expand Down
4 changes: 3 additions & 1 deletion AppKit/X11.backend/X11Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

NSMutableDictionary *_deviceDictionary;
O2Rect _frame;
O2Rect _realFrame;
NSUInteger _styleMask;
BOOL _mapped;
CGPoint _lastMotionPos;
Expand All @@ -54,7 +55,8 @@

+ (void) removeDecorationForWindow: (Window) w onDisplay: (Display *) dpy;
- (instancetype) initWithDelegate: (NSWindow *) delegate;
- (O2Rect) frame;
- (O2Rect) frame; // This frame is set by -[X11Window setFrame] and -[X11Window frameChanged]
- (O2Rect) realFrame; // This frame is only set by -[X11Window frameChanged]
- (Visual *) visual;
- (Drawable) drawable;
- (NSPoint) transformPoint: (NSPoint) pos;
Expand Down
5 changes: 5 additions & 0 deletions AppKit/X11.backend/X11Window.m
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ - (O2Rect) frame {
return [self transformFrame: _frame];
}

- (O2Rect) realFrame {
return [self transformFrame: _realFrame];
}

static int ignoreBadWindow(Display *display, XErrorEvent *errorEvent) {
if (errorEvent->error_code == BadWindow)
return 0;
Expand Down Expand Up @@ -674,6 +678,7 @@ - (void) frameChanged {

[self invalidateContextWithNewSize: rect.size];
_frame = rect;
_realFrame = _frame;
} @finally {
XSetErrorHandler(previousHandler);
}
Expand Down