mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Use NSInteger for window ref number
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@40335 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
11bb0224cc
commit
969b489452
7 changed files with 151 additions and 47 deletions
|
@ -129,7 +129,7 @@
|
|||
timestamp: (NSTimeInterval)time
|
||||
toWindow: (NSInteger)dWindowNumber;
|
||||
- (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation
|
||||
windowRef: (int*)mouseWindowRef;
|
||||
windowRef: (NSInteger*)mouseWindowRef;
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -357,7 +357,7 @@ static GSDragView *sharedDragView = nil;
|
|||
set, if there is a native window, but no GNUstep window at this location.
|
||||
*/
|
||||
- (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation
|
||||
windowRef: (int*)mouseWindowRef
|
||||
windowRef: (NSInteger*)mouseWindowRef
|
||||
{
|
||||
NSInteger win;
|
||||
|
||||
|
@ -890,7 +890,7 @@ static GSDragView *sharedDragView = nil;
|
|||
//--- Store old values -----------------------------------------------------
|
||||
NSWindow *oldDestWindow = destWindow;
|
||||
BOOL oldDestExternal = destExternal;
|
||||
int mouseWindowRef;
|
||||
NSInteger mouseWindowRef;
|
||||
BOOL changeCursor = NO;
|
||||
|
||||
//--- Move drag image to the new position -----------------------------------
|
||||
|
|
|
@ -1608,7 +1608,7 @@ didStartElement: (NSString*)elementName
|
|||
|
||||
if (baseWritingDirection == nil)
|
||||
[paragraphStyle setBaseWritingDirection: NSWritingDirectionNaturalDirection];
|
||||
else if ([@"" isEqualToString: baseWritingDirection])
|
||||
else if ([@"leftToRight" isEqualToString: baseWritingDirection])
|
||||
[paragraphStyle setBaseWritingDirection: NSWritingDirectionLeftToRight];
|
||||
else if ([@"rightToLeft" isEqualToString: baseWritingDirection])
|
||||
[paragraphStyle setBaseWritingDirection: NSWritingDirectionRightToLeft];
|
||||
|
@ -2884,6 +2884,7 @@ didStartElement: (NSString*)elementName
|
|||
}
|
||||
else if ([@"NSPathSeparator" isEqualToString: key])
|
||||
{
|
||||
// This would allow to do system dependent path separator decoding...
|
||||
object = @"/";
|
||||
}
|
||||
else if ([key hasPrefix:@"NS"])
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
*/
|
||||
|
||||
#import "config.h"
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSDebug.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
#import "AppKit/NSClipView.h"
|
||||
#import "AppKit/NSCursor.h"
|
||||
|
@ -491,6 +493,9 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
*/
|
||||
- (BOOL) autoscroll: (NSEvent*)theEvent
|
||||
{
|
||||
static CGFloat ScrollingMargin = 15.0;
|
||||
|
||||
CGFloat scrollingMargin;
|
||||
NSPoint new;
|
||||
NSPoint delta;
|
||||
NSRect r;
|
||||
|
@ -500,22 +505,27 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
return NO;
|
||||
}
|
||||
|
||||
new = [_documentView convertPoint: [theEvent locationInWindow]
|
||||
fromView: nil];
|
||||
// Use defaults value if present...
|
||||
scrollingMargin = [[NSUserDefaults standardUserDefaults] floatForKey: @"GSAutoScrollingMargin"];
|
||||
if (scrollingMargin == 0) // otherwise use static coded default...
|
||||
scrollingMargin = ScrollingMargin;
|
||||
|
||||
new = [_documentView convertPoint: [theEvent locationInWindow]
|
||||
fromView: nil];
|
||||
|
||||
r = [self documentVisibleRect];
|
||||
|
||||
if (new.x < NSMinX(r))
|
||||
delta.x = new.x - NSMinX(r);
|
||||
else if (new.x > NSMaxX(r))
|
||||
delta.x = new.x - NSMaxX(r);
|
||||
if ((new.x > NSMinX(r)) && (new.x < NSMinX(r)+scrollingMargin))
|
||||
delta.x = (new.x - NSMinX(r)) - scrollingMargin;
|
||||
else if ((new.x > NSMaxX(r)-scrollingMargin) && (new.x < NSMaxX(r)))
|
||||
delta.x = scrollingMargin - (NSMaxX(r) - new.x);
|
||||
else
|
||||
delta.x = 0;
|
||||
|
||||
if (new.y < NSMinY(r))
|
||||
delta.y = new.y - NSMinY(r);
|
||||
else if (new.y > NSMaxY(r))
|
||||
delta.y = new.y - NSMaxY(r);
|
||||
if ((new.y > NSMinY(r)) && (new.y < NSMinY(r)+scrollingMargin))
|
||||
delta.y = (new.y - NSMinY(r)) - scrollingMargin;
|
||||
else if ((new.y > NSMaxY(r)-scrollingMargin) && (new.y < NSMaxY(r)))
|
||||
delta.y = scrollingMargin - (NSMaxY(r) - new.y);
|
||||
else
|
||||
delta.y = 0;
|
||||
|
||||
|
@ -523,6 +533,13 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
new.y = _bounds.origin.y + delta.y;
|
||||
|
||||
new = [self constrainScrollPoint: new];
|
||||
// NSWarnMLog(@"self: %@ theEventLocInWin: %@ docVisRect: %@ docPnt: %@ delta: %@ new: %@ equ: %ld", self,
|
||||
// NSStringFromPoint([theEvent locationInWindow]),
|
||||
// NSStringFromRect(r),
|
||||
// NSStringFromPoint([_documentView convertPoint: [theEvent locationInWindow] fromView: nil]),
|
||||
// NSStringFromPoint(delta),
|
||||
// NSStringFromPoint(new),
|
||||
// (long)(NSEqualPoints(new, _bounds.origin)));
|
||||
if (NSEqualPoints(new, _bounds.origin))
|
||||
return NO;
|
||||
|
||||
|
|
|
@ -3663,6 +3663,45 @@ static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
|
|||
return(NSCellHitNone);
|
||||
}
|
||||
|
||||
- (void)mouseEntered:(NSEvent *)event
|
||||
{
|
||||
NSWarnMLog(@"self: %@ event: %@", self, event);
|
||||
[super mouseEntered: event];
|
||||
}
|
||||
|
||||
- (void)mouseMoved:(NSEvent *)event
|
||||
{
|
||||
NSWarnMLog(@"self: %@ event: %@", self, event);
|
||||
[super mouseMoved: event];
|
||||
}
|
||||
|
||||
#if 0
|
||||
- (void)mouseDragged:(NSEvent *)event
|
||||
{
|
||||
// NSWarnMLog(@"self: %@ event: %@", self, event);
|
||||
NSPoint locInWin = [event locationInWindow];
|
||||
NSPoint locInView = [self convertPoint: locInWin toView: nil];
|
||||
NSRect bounds = [self bounds];
|
||||
NSRect frameTop = NSMakeRect(0, 0, bounds.size.width, 10);
|
||||
NSRect frameBot = NSMakeRect(0, NSMaxY(bounds), bounds.size.width, NSMaxY(bounds)-10);
|
||||
// NSWarnMLog(@"locInWin: %@ locInView: %@ bounds: %@ frameTop: %@ frameBot: %@",
|
||||
// NSStringFromPoint(locInWin),
|
||||
// NSStringFromPoint(locInView),
|
||||
// NSStringFromRect(bounds),
|
||||
// NSStringFromRect(frameTop),
|
||||
// NSStringFromRect(frameBot));
|
||||
//if (NSPointInRect(locInView, frameTop) || NSPointInRect(locInView, frameBot))
|
||||
[self autoscroll: event];
|
||||
[super mouseDragged: event];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)mouseExited:(NSEvent *)event
|
||||
{
|
||||
NSWarnMLog(@"self: %@ event: %@", self, event);
|
||||
[super mouseExited: event];
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent *)theEvent
|
||||
{
|
||||
NSPoint initialLocation = [theEvent locationInWindow];
|
||||
|
@ -3917,6 +3956,10 @@ static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
|
|||
|
||||
case NSLeftMouseDown:
|
||||
case NSLeftMouseDragged:
|
||||
NSWarnMLog(@"NSLeftMouseDown | NSLeftMouseDragged: dragOperationPossible: %ld mouseWin: %@ initLoc: %@",
|
||||
(long)dragOperationPossible,
|
||||
NSStringFromPoint(mouseLocationWin),
|
||||
NSStringFromPoint(initialLocation));
|
||||
if (fabs(mouseLocationWin.x - initialLocation.x) > 1
|
||||
|| fabs(mouseLocationWin.y - initialLocation.y) > 1)
|
||||
{
|
||||
|
@ -3938,6 +3981,7 @@ static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
|
|||
{
|
||||
if ([self _startDragOperationWithEvent: theEvent clickedRow:_clickedRow])
|
||||
{
|
||||
NSWarnMLog(@"_startDragOperationWithEvent");
|
||||
RELEASE(oldSelectedRows);
|
||||
IF_NO_GC(DESTROY(arp));
|
||||
return;
|
||||
|
@ -3954,6 +3998,7 @@ static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
|
|||
// mouse dragged within table
|
||||
if (startedPeriodicEvents == YES)
|
||||
{
|
||||
NSWarnMLog(@"stopPeriodicEvents");
|
||||
[NSEvent stopPeriodicEvents];
|
||||
startedPeriodicEvents = NO;
|
||||
}
|
||||
|
@ -4001,9 +4046,9 @@ static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
|
|||
else
|
||||
{
|
||||
// Mouse dragged out of the table
|
||||
NSTimeInterval period = computePeriod(mouseLocationWin,
|
||||
minYVisible,
|
||||
maxYVisible);
|
||||
NSTimeInterval period = computePeriod(mouseLocationWin,
|
||||
minYVisible,
|
||||
maxYVisible);
|
||||
|
||||
if (startedPeriodicEvents == YES)
|
||||
{
|
||||
|
@ -4016,6 +4061,7 @@ static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
|
|||
}
|
||||
/* Start periodic events */
|
||||
oldPeriod = period;
|
||||
NSWarnMLog(@"startPeriodicEvents: %f", oldPeriod);
|
||||
[NSEvent startPeriodicEventsAfterDelay: 0
|
||||
withPeriod: oldPeriod];
|
||||
startedPeriodicEvents = YES;
|
||||
|
@ -4026,6 +4072,7 @@ static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
|
|||
}
|
||||
break;
|
||||
case NSPeriodic:
|
||||
NSWarnMLog(@"NSPeriodic");
|
||||
if (mouseBelowView == YES)
|
||||
{
|
||||
if (currentRow == -1 && oldRow != -1)
|
||||
|
@ -6496,6 +6543,7 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
|
||||
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
|
||||
{
|
||||
NSWarnMLog(@"self: %@ sender: %@", self, sender);
|
||||
currentDropRow = -1;
|
||||
currentDropOperation = -1;
|
||||
oldDropRow = -1;
|
||||
|
@ -6507,6 +6555,7 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
|
||||
- (void) draggingExited: (id <NSDraggingInfo>) sender
|
||||
{
|
||||
NSWarnMLog(@"self: %@ sender: %@", self, sender);
|
||||
[self setNeedsDisplayInRect: oldDraggingRect];
|
||||
[self displayIfNeeded];
|
||||
}
|
||||
|
@ -6646,6 +6695,7 @@ view to drag. */
|
|||
NSDragOperation dragOperation = [sender draggingSourceOperationMask];
|
||||
BOOL isSameDropTargetThanBefore = (lastQuarterPosition == quarterPosition
|
||||
&& currentDragOperation == dragOperation);
|
||||
NSWarnMLog(@"self: %@ sender: %@", self, sender);
|
||||
|
||||
[self _scrollRowAtPointToVisible: p];
|
||||
|
||||
|
|
|
@ -5784,6 +5784,7 @@ other than copy/paste or dragging. */
|
|||
inMode: NSEventTrackingRunLoopMode
|
||||
dequeue: YES];
|
||||
}
|
||||
NSWarnMLog(@"currentEvent: %@", currentEvent);
|
||||
if (currentEvent && [currentEvent type] == NSLeftMouseUp)
|
||||
break;
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
#import "AppKit/NSWindowController.h"
|
||||
#import "AppKit/PSOperators.h"
|
||||
|
||||
#import "GNUstepGUI/GSDragView.h"
|
||||
#import "GNUstepGUI/GSTheme.h"
|
||||
#import "GNUstepGUI/GSTrackingRect.h"
|
||||
#import "GNUstepGUI/GSDisplayServer.h"
|
||||
|
@ -105,6 +106,7 @@ static GSToolTips *toolTipVisible = nil;
|
|||
static id<GSWindowDecorator> windowDecorator = nil;
|
||||
|
||||
|
||||
NSView *GSDragViewForEvent(NSView *wv, NSEvent *theEvent, id<NSDraggingInfo> dragInfo);
|
||||
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
|
||||
|
||||
@interface NSObject (DragInfoBackend)
|
||||
|
@ -3869,14 +3871,14 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
}
|
||||
}
|
||||
/* Activate the app *after* making the receiver key, as app
|
||||
activation tries to make the previous key window key.
|
||||
However, don't activate the app after a single click into
|
||||
the app icon or a miniwindow. This allows dragging app
|
||||
icons and miniwindows without unnecessarily switching
|
||||
applications (cf. Sect. 4 of the OpenStep UI Guidelines).
|
||||
*/
|
||||
activation tries to make the previous key window key.
|
||||
However, don't activate the app after a single click into
|
||||
the app icon or a miniwindow. This allows dragging app
|
||||
icons and miniwindows without unnecessarily switching
|
||||
applications (cf. Sect. 4 of the OpenStep UI Guidelines).
|
||||
*/
|
||||
if ((_styleMask & (NSIconWindowMask | NSMiniWindowMask)) == 0
|
||||
&& [NSApp isActive] == NO)
|
||||
&& [NSApp isActive] == NO)
|
||||
{
|
||||
v = nil;
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
|
@ -3928,10 +3930,10 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
[self mouseDown: theEvent];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugLLog(@"NSEvent", @"Discard (window closed) %@", theEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugLLog(@"NSEvent", @"Discard (window closed) %@", theEvent);
|
||||
}
|
||||
_lastPoint = [theEvent locationInWindow];
|
||||
break;
|
||||
}
|
||||
|
@ -3947,7 +3949,7 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
|
||||
case NSOtherMouseDown:
|
||||
v = [_wv hitTest: [theEvent locationInWindow]];
|
||||
ASSIGN(_lastOtherMouseDownView, v);
|
||||
ASSIGN(_lastOtherMouseDownView, v);
|
||||
[v otherMouseDown: theEvent];
|
||||
_lastPoint = [theEvent locationInWindow];
|
||||
break;
|
||||
|
@ -3963,7 +3965,7 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
|
||||
case NSRightMouseDown:
|
||||
v = [_wv hitTest: [theEvent locationInWindow]];
|
||||
ASSIGN(_lastRightMouseDownView, v);
|
||||
ASSIGN(_lastRightMouseDownView, v);
|
||||
[v rightMouseDown: theEvent];
|
||||
_lastPoint = [theEvent locationInWindow];
|
||||
break;
|
||||
|
@ -3984,11 +3986,28 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
switch (type)
|
||||
{
|
||||
case NSLeftMouseDragged:
|
||||
v = GSDragViewForEvent(_wv, theEvent, [GSServerForWindow(self) dragInfo]);
|
||||
#if 0
|
||||
NSWarnMLog(@"NSLeftMouseDragged %p - v: %@ _lastLeftMouseDownView: %@ eventLoc: %@", self,
|
||||
v, _lastLeftMouseDownView, NSStringFromPoint([theEvent locationInWindow]));
|
||||
#endif
|
||||
// Testplant-MAL-2015-07-08: keeping testplant branch code...
|
||||
if (_lastLeftMouseDownView)
|
||||
[_lastLeftMouseDownView mouseDragged: theEvent];
|
||||
#if 0
|
||||
if ([[GSDragView sharedDragView] isDragging] && v)
|
||||
{
|
||||
_lastLeftMouseDownView = v;
|
||||
[v mouseDragged: theEvent];
|
||||
}
|
||||
else
|
||||
[self mouseDragged: theEvent];
|
||||
#endif
|
||||
if (_lastLeftMouseDownView)
|
||||
{
|
||||
[_lastLeftMouseDownView mouseDragged: theEvent];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self mouseDragged: theEvent];
|
||||
}
|
||||
break;
|
||||
case NSOtherMouseDragged:
|
||||
[_lastOtherMouseDownView otherMouseDragged: theEvent];
|
||||
|
@ -4341,19 +4360,12 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
BOOL isEntry;
|
||||
|
||||
dragInfo = [GSServerForWindow(self) dragInfo];
|
||||
v = [_wv hitTest: [theEvent locationInWindow]];
|
||||
|
||||
while (v != nil)
|
||||
{
|
||||
if (v->_rFlags.has_draginfo != 0
|
||||
&& GSViewAcceptsDrag(v, dragInfo))
|
||||
break;
|
||||
v = [v superview];
|
||||
}
|
||||
v = GSDragViewForEvent(_wv, theEvent, dragInfo);
|
||||
if (v == nil)
|
||||
{
|
||||
v = _wv;
|
||||
}
|
||||
{
|
||||
v = _wv;
|
||||
}
|
||||
|
||||
if (_lastDragView == v)
|
||||
{
|
||||
isEntry = NO;
|
||||
|
@ -4391,7 +4403,15 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
{
|
||||
action = NSDragOperationNone;
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
// Support for autoscrolling...
|
||||
if ([theEvent subtype] == GSAppKitDraggingUpdate)
|
||||
{
|
||||
[v autoscroll: theEvent];
|
||||
}
|
||||
#endif
|
||||
|
||||
e = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: [theEvent locationInWindow]
|
||||
modifierFlags: 0
|
||||
|
@ -5932,6 +5952,21 @@ current key view.<br />
|
|||
|
||||
@end
|
||||
|
||||
NSView *GSDragViewForEvent(NSView *wv, NSEvent *theEvent, id<NSDraggingInfo> dragInfo)
|
||||
{
|
||||
NSView *v = [wv hitTest: [theEvent locationInWindow]];
|
||||
|
||||
while (v != nil)
|
||||
{
|
||||
if (v->_rFlags.has_draginfo != 0
|
||||
&& GSViewAcceptsDrag(v, dragInfo))
|
||||
break;
|
||||
v = [v superview];
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo)
|
||||
{
|
||||
NSPasteboard *pb = [dragInfo draggingPasteboard];
|
||||
|
|
Loading…
Reference in a new issue