3 次代码提交 fde7964d68 ... b610709e7f

作者 SHA1 备注 提交日期
  Zoe Knox b610709e7f Another missing include path for cross build 13 小时之前
  Zoe Knox 045b22fe6a Add include path for cross build 19 小时之前
  Zoe Knox 5979872afb Fix window frame/view synch while dragging 1 天之前

+ 2 - 0
CoreServices/WindowServer/Makefile

@@ -22,6 +22,8 @@ CFLAGS+=	-fobjc-arc -g -D__RAVYNOS__ -D__MACH__ -pthread \
 		-I${.CURDIR} -I${MAKEOBJDIR} -I${.CURDIR}/libinput/src \
 		-I${.CURDIR} -I${MAKEOBJDIR} -I${.CURDIR}/libinput/src \
 		-I${.CURDIR}/libinput/include -I${SRCTOP}/Frameworks \
 		-I${.CURDIR}/libinput/include -I${SRCTOP}/Frameworks \
 		-I${.CURDIR}/libxkbcommon/include -I${SRCTOP}/CoreServices \
 		-I${.CURDIR}/libxkbcommon/include -I${SRCTOP}/CoreServices \
+		-I${OBJTOP}/Frameworks/Foundation/Headers \
+		-I${SRCTOP}/gnu/lib/libobjc2
 
 
 LDFLAGS+=	-Wl,-R'$$ORIGIN/../Resources' -L${MAKEOBJDIR} \
 LDFLAGS+=	-Wl,-R'$$ORIGIN/../Resources' -L${MAKEOBJDIR} \
 		-L${OBJTOP}/Frameworks/Foundation/Foundation.framework \
 		-L${OBJTOP}/Frameworks/Foundation/Foundation.framework \

二进制
CoreServices/WindowServer/SneakySnek.png


+ 3 - 3
CoreServices/WindowServer/libinput/Makefile

@@ -30,7 +30,7 @@ SRCS=   libinput-version.h \
 	evdev-wheel.c \
 	evdev-wheel.c \
 	path-seat.c \
 	path-seat.c \
 	udev-seat.c \
 	udev-seat.c \
-	timer.c 
+	timer.c
 
 
 INCS=   include/valgrind/valgrind.h \
 INCS=   include/valgrind/valgrind.h \
 	include/linux/input.h \
 	include/linux/input.h \
@@ -67,7 +67,7 @@ WARNS=	        1
 CFLAGS+=	-I${.CURDIR}/src -I${.CURDIR}/include -I${MAKEOBJDIR}
 CFLAGS+=	-I${.CURDIR}/src -I${.CURDIR}/include -I${MAKEOBJDIR}
 CFLAGS+=        -I${.CURDIR}/../libevdev -I${.CURDIR}
 CFLAGS+=        -I${.CURDIR}/../libevdev -I${.CURDIR}
 CFLAGS+=        -I${OBJTOP}/tmp/usr/include/libepoll-shim
 CFLAGS+=        -I${OBJTOP}/tmp/usr/include/libepoll-shim
-CFLAGS+=	-I${SRCTOP}/lib/libudev -I${.CURDIR}/../mtdev/include
+CFLAGS+=	-I${SRCTOP}/lib/libudev-devd -I${.CURDIR}/../mtdev/include
 CFLAGS+=        -DHTTP_DOC_LINK=\"https://wayland.freedesktop.org/libinput/doc/${MAJOR}.${MINOR}.${MICRO}\"
 CFLAGS+=        -DHTTP_DOC_LINK=\"https://wayland.freedesktop.org/libinput/doc/${MAJOR}.${MINOR}.${MICRO}\"
 CFLAGS+=        -DLIBINPUT_QUIRKS_DIR=\"/System/Library/CoreServices/WindowServer.app/Contents/Resources\"
 CFLAGS+=        -DLIBINPUT_QUIRKS_DIR=\"/System/Library/CoreServices/WindowServer.app/Contents/Resources\"
 CFLAGS+=        -DLIBINPUT_QUIRKS_OVERRIDE_FILE=\"/System/Library/CoreServices/WindowServer.app/Contents/Resources/local-overrides.quirks\"
 CFLAGS+=        -DLIBINPUT_QUIRKS_OVERRIDE_FILE=\"/System/Library/CoreServices/WindowServer.app/Contents/Resources/local-overrides.quirks\"
@@ -80,7 +80,7 @@ CFLAGS+=	-DHAVE_LIBEVDEV_DISABLE_PROPERTY -DHAVE_LIBWACOM=0 -DHAVE_DEBUG_GUI=0 -
 LDFLAGS+=	-L${OBJTOP}/CoreServices/WindowServer/mtdev -lmtdev
 LDFLAGS+=	-L${OBJTOP}/CoreServices/WindowServer/mtdev -lmtdev
 LDFLAGS+=	-L${OBJTOP}/CoreServices/WindowServer/libevdev -levdev
 LDFLAGS+=	-L${OBJTOP}/CoreServices/WindowServer/libevdev -levdev
 LDFLAGS+=	-L${OBJTOP}/tmp/usr/lib -lepoll-shim -ludev
 LDFLAGS+=	-L${OBJTOP}/tmp/usr/lib -lepoll-shim -ludev
-LDFLAGS+=	-L${MAKEOBJDIR} -linput-util -lquirks -lfilter -lm -lrt 
+LDFLAGS+=	-L${MAKEOBJDIR} -linput-util -lquirks -lfilter -lm -lrt
 LDFLAGS+=	-Wl,-R'$$ORIGIN/../Resources' -Wl,--version-script=${.CURDIR}/src/libinput.sym
 LDFLAGS+=	-Wl,-R'$$ORIGIN/../Resources' -Wl,--version-script=${.CURDIR}/src/libinput.sym
 
 
 GIT_SHA!=	cd ${.CURDIR}; git log -1 --pretty=format:%h
 GIT_SHA!=	cd ${.CURDIR}; git log -1 --pretty=format:%h

二进制
CoreServices/WindowServer/resizeCursor.png


+ 39 - 100
Frameworks/AppKit/NSWindow.m

@@ -755,7 +755,6 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
 }
 }
 
 
 -(void)_makeSureIsOnAScreen {
 -(void)_makeSureIsOnAScreen {
-#if 1
    if(_makeSureIsOnAScreen && [self isVisible] && ![self isMiniaturized]){
    if(_makeSureIsOnAScreen && [self isVisible] && ![self isMiniaturized]){
     NSRect   frame=_frame;
     NSRect   frame=_frame;
     NSArray *screens=[NSScreen screens];
     NSArray *screens=[NSScreen screens];
@@ -810,46 +809,6 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
        
        
     _makeSureIsOnAScreen=NO;
     _makeSureIsOnAScreen=NO;
    }
    }
-#else
-   if(_makeSureIsOnAScreen && [self isVisible] && ![self isMiniaturized]){
-    NSRect   frame=_frame;
-    NSArray *screens=[NSScreen screens];
-    int      i,count=[screens count];
-    NSRect   virtual=NSZeroRect;
-    BOOL     changed=NO;
-
-    for(i=0;i<count;i++){
-     NSRect screen=[[screens objectAtIndex:i] frame];
-
-     virtual=NSUnionRect(virtual,screen);
-    }
-
-    virtual=NSInsetRect(virtual,20,20);
-
-    if(NSMaxX(frame)<virtual.origin.x){
-     frame.origin.x=virtual.origin.x-frame.size.width;
-     changed=YES;
-    }
-    if(frame.origin.x>NSMaxX(virtual)){
-     frame.origin.x=NSMaxX(virtual);
-     changed=YES;
-    }
-
-    if(NSMaxY(frame)>NSMaxY(virtual)){
-     frame.origin.y=NSMaxY(virtual)-frame.size.height;
-     changed=YES;
-    }
-    if(NSMaxY(frame)<virtual.origin.y){
-     changed=YES;
-     frame.origin.y=virtual.origin.y-frame.size.height;
-    }
-
-    if(changed)
-     [self setFrame:frame display:YES];
-
-    _makeSureIsOnAScreen=NO;
-   }
-#endif
 }
 }
 
 
 -(void)setFrame:(NSRect)frame display:(BOOL)display {
 -(void)setFrame:(NSRect)frame display:(BOOL)display {
@@ -924,9 +883,11 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
         //CGLReleaseContext(_cglContext);
         //CGLReleaseContext(_cglContext);
         _cglContext = NULL;
         _cglContext = NULL;
         //[self createCGLContextObjIfNeeded];
         //[self createCGLContextObjIfNeeded];
+
     }
     }
 
 
     [self cgContext];
     [self cgContext];
+
 #if 0
 #if 0
     if(snapshot) {
     if(snapshot) {
         [_context drawImage:snapshot inRect:NSMakeRect(0,0,oldSize.width,oldSize.height)];
         [_context drawImage:snapshot inRect:NSMakeRect(0,0,oldSize.width,oldSize.height)];
@@ -935,17 +896,14 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
 #endif
 #endif
 
 
     //CGLSurfaceResize(_cglContext, size.width, size.height);
     //CGLSurfaceResize(_cglContext, size.width, size.height);
-    [_threadToContext performSelectorOnMainThread:@selector(removeAllObjects) withObject:nil waitUntilDone:YES];
 }
 }
 
 
--(void) invalidateContextsWithNewSize:(NSSize)size
-{
+-(void)invalidateContextsWithNewSize:(NSSize)size {
     [self invalidateContextsWithNewSize:size forceRebuild:NO];
     [self invalidateContextsWithNewSize:size forceRebuild:NO];
 }
 }
 
 
--(void) invalidate
-{
-    [_delegate platformWindowDidInvalidateCGContext:self];
+-(void)invalidate {
+    [_threadToContext removeAllObjects];
 }
 }
 
 
 
 
@@ -954,32 +912,41 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
 }
 }
 
 
 -(void)setFrame:(NSRect)newFrame display:(BOOL)display animate:(BOOL)animate tellWS:(BOOL)tellWS {
 -(void)setFrame:(NSRect)newFrame display:(BOOL)display animate:(BOOL)animate tellWS:(BOOL)tellWS {
+    if (NSEqualSizes([self minSize], NSMakeSize(0, 0)) == NO) {
+       newFrame.size.width = MAX(NSWidth(newFrame), [self minSize].width);
+       newFrame.size.height = MAX(NSHeight(newFrame), [self minSize].height);
+    }
+
+    if (NSEqualSizes([self maxSize], NSMakeSize(FLT_MAX, FLT_MAX)) == NO) {
+       newFrame.size.width = MIN(NSWidth(newFrame), [self maxSize].width);
+       newFrame.size.height = MIN(NSHeight(newFrame), [self maxSize].height);
+    }
+
     BOOL didSize=NSEqualSizes(newFrame.size,_frame.size)?NO:YES;
     BOOL didSize=NSEqualSizes(newFrame.size,_frame.size)?NO:YES;
     BOOL didMove=NSEqualPoints(newFrame.origin,_frame.origin)?NO:YES;
     BOOL didMove=NSEqualPoints(newFrame.origin,_frame.origin)?NO:YES;
    
    
     _frame=newFrame;
     _frame=newFrame;
     _makeSureIsOnAScreen=YES;
     _makeSureIsOnAScreen=YES;
 
 
-    [_backgroundView setFrameSize:_frame.size];
-
-    [self invalidateContextsWithNewSize:_frame.size];
-    if(tellWS)
-        [self _updateWSState];
-    
-    if(didSize)
+    if(didSize) {
+        [_backgroundView setFrameSize:_frame.size];
+        [_backgroundView setNeedsDisplay:YES];
+        [self invalidateContextsWithNewSize:_frame.size];
         [self resetCursorRects];
         [self resetCursorRects];
-    
-    if(didSize)
+        [self saveFrameUsingName:_autosaveFrameName];
         [self postNotificationName:NSWindowDidResizeNotification];
         [self postNotificationName:NSWindowDidResizeNotification];
-    
-    if(didMove)
+    }
+
+    if(didMove) {
+        [self saveFrameUsingName:_autosaveFrameName];
         [self postNotificationName:NSWindowDidMoveNotification];
         [self postNotificationName:NSWindowDidMoveNotification];
+    }
 
 
     // If you setFrame:display:YES before rearranging views with only setFrame:
     // If you setFrame:display:YES before rearranging views with only setFrame:
     // calls (which do not mark the view for display) Cocoa will properly
     // calls (which do not mark the view for display) Cocoa will properly
     // redisplay the views So, doing a hard display right here is not the right
     // redisplay the views So, doing a hard display right here is not the right
     // thing to do, delay it 
     // thing to do, delay it 
- 
+
     if(display)
     if(display)
         [_backgroundView setNeedsDisplay:YES];
         [_backgroundView setNeedsDisplay:YES];
 
 
@@ -990,6 +957,13 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
 
 
         [self _animateWithContext:context];
         [self _animateWithContext:context];
     }
     }
+   
+    [self _setSheetOriginAndFront];
+    [_childWindows makeObjectsPerformSelector:@selector(_parentWindowDidChangeFrame:) withObject:self];
+    [_drawers makeObjectsPerformSelector:@selector(parentWindowDidChangeFrame:) withObject:self];
+
+    if(tellWS)
+        [self _updateWSState];
 }
 }
 
 
 -(void)setContentSize:(NSSize)size {
 -(void)setContentSize:(NSSize)size {
@@ -2875,44 +2849,6 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
    [NSApp updateWindows];
    [NSApp updateWindows];
 }
 }
 
 
--(void)platformWindow:(CGWindow *)window frameChanged:(NSRect)frame didSize:(BOOL)didSize {
-    // Don't allow the platform window changes to violate our window size limits (if we have them)
-    // Windows (for example) likes to make the platform window very small so it fits in the task bar...
-    if (NSEqualSizes([self minSize], NSMakeSize(0, 0)) == NO) {
-       frame.size.width = MAX(NSWidth(frame), [self minSize].width);
-       frame.size.height = MAX(NSHeight(frame), [self minSize].height);
-    }
-
-    if (NSEqualSizes([self maxSize], NSMakeSize(FLT_MAX, FLT_MAX)) == NO) {
-       frame.size.width = MIN(NSWidth(frame), [self maxSize].width);
-       frame.size.height = MIN(NSHeight(frame), [self maxSize].height);
-    }
-
-    // We don't want the miniaturized frame.
-   if(![self isMiniaturized])
-    _frame=frame;
-   
-   _makeSureIsOnAScreen=YES;
-
-   [self _setSheetOriginAndFront];
-   [_childWindows makeObjectsPerformSelector:@selector(_parentWindowDidChangeFrame:) withObject:self];
-   [_drawers makeObjectsPerformSelector:@selector(parentWindowDidChangeFrame:) withObject:self];
-
-   if (didSize) {
-    // Don't redraw everything unless we really have to
-    [_backgroundView setFrameSize:_frame.size];
-    [_backgroundView setNeedsDisplay:YES];
-    [self resetCursorRects];
-    [self saveFrameUsingName:_autosaveFrameName];
-    [self postNotificationName:NSWindowDidResizeNotification];
-   }
-   else
-   {
-    [self saveFrameUsingName:_autosaveFrameName];
-    [self postNotificationName:NSWindowDidMoveNotification];
-   }
-}
-
 -(void)platformWindowExitMove:(CGWindow *)window {
 -(void)platformWindowExitMove:(CGWindow *)window {
    [self _setSheetOriginAndFront];
    [self _setSheetOriginAndFront];
    [_childWindows makeObjectsPerformSelector:@selector(_parentWindowDidExitMove:) withObject:self];
    [_childWindows makeObjectsPerformSelector:@selector(_parentWindowDidExitMove:) withObject:self];
@@ -3247,7 +3183,8 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
 -(void)processStateUpdate:(struct wsRPCWindow *)data {
 -(void)processStateUpdate:(struct wsRPCWindow *)data {
     switch(data->state) {
     switch(data->state) {
         case NORMAL:
         case NORMAL:
-            [self _setVisible:YES];
+            if(!_isVisible)
+                [self _setVisible:YES];
             if([self isMiniaturized])
             if([self isMiniaturized])
                 [self deminiaturize:self];
                 [self deminiaturize:self];
             if([self isZoomed])
             if([self isZoomed])
@@ -3262,7 +3199,8 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
                 [self miniaturize:self];
                 [self miniaturize:self];
             break;
             break;
         case HIDDEN:
         case HIDDEN:
-            [self _setVisible:NO];
+            if(_isVisible)
+                [self _setVisible:NO];
             break;
             break;
         case CLOSED:
         case CLOSED:
             [self performClose:self];
             [self performClose:self];
@@ -3273,7 +3211,8 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
 
 
     if(_styleMask != data->style)
     if(_styleMask != data->style)
         [self setStyleMask:data->style];
         [self setStyleMask:data->style];
-    [self setFrame:geom display:YES animate:NO tellWS:NO];
+    if(!NSEqualPoints(geom.origin, _frame.origin) || !NSEqualSizes(geom.size, _frame.size))
+        [self setFrame:geom display:NO animate:NO tellWS:NO];
 }
 }
 
 
 -(void)addEntriesToDeviceDictionary:(NSDictionary *)entries {
 -(void)addEntriesToDeviceDictionary:(NSDictionary *)entries {