mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 06:20:59 +00:00
gui changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3208 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e0de88c770
commit
ccfc67f353
9 changed files with 815 additions and 1151 deletions
|
@ -34,7 +34,7 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
||||||
#
|
#
|
||||||
# The list of subproject directories
|
# The list of subproject directories
|
||||||
#
|
#
|
||||||
SUBPROJECTS = Model Source Images Tools
|
SUBPROJECTS = Source Images Model Tools
|
||||||
|
|
||||||
-include GNUmakefile.preamble
|
-include GNUmakefile.preamble
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,9 @@
|
||||||
/* Getting the menu cells matrix */
|
/* Getting the menu cells matrix */
|
||||||
- (NSMenuMatrix*)menuCells;
|
- (NSMenuMatrix*)menuCells;
|
||||||
|
|
||||||
|
// non OS spec methods
|
||||||
|
- (void)_rightMouseDisplay;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -400,15 +400,10 @@ extern NSSize NSTokenSize;
|
||||||
- (void)encodeWithCoder:aCoder;
|
- (void)encodeWithCoder:aCoder;
|
||||||
- initWithCoder:aDecoder;
|
- initWithCoder:aDecoder;
|
||||||
|
|
||||||
/* Private methods */
|
//
|
||||||
- (void)_view:(NSView*)view needsFlushInRect:(NSRect)rect;
|
// Private methods
|
||||||
- (void)_setNeedsDisplay;
|
//
|
||||||
- (void)_setNeedsFlush;
|
|
||||||
- (BOOL)_needsFlush;
|
|
||||||
- (void)_collectFlushRectangles;
|
- (void)_collectFlushRectangles;
|
||||||
+ (BOOL)_flushWindows;
|
|
||||||
+ (void)_setNeedsFlushWindows:(BOOL)flag;
|
|
||||||
+ (BOOL)_needsFlushWindows;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -285,6 +285,21 @@ NSAutoreleasePool* pool;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NSRightMouseDown: // Right mouse down
|
||||||
|
{
|
||||||
|
static NSMenu *copyOfMainMenu = nil;
|
||||||
|
NSWindow *copyMenuWindow;
|
||||||
|
|
||||||
|
if(!copyOfMainMenu) // display the menu
|
||||||
|
copyOfMainMenu = [main_menu copy]; // under the mouse
|
||||||
|
copyMenuWindow = [copyOfMainMenu menuWindow];
|
||||||
|
[copyOfMainMenu _rightMouseDisplay];
|
||||||
|
[copyMenuWindow captureMouse:self];
|
||||||
|
[[copyOfMainMenu menuCells] mouseDown:theEvent];
|
||||||
|
[copyMenuWindow releaseMouse:self];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default: // pass all other events to
|
default: // pass all other events to
|
||||||
{ // the event's window
|
{ // the event's window
|
||||||
NSWindow* window = [theEvent window];
|
NSWindow* window = [theEvent window];
|
||||||
|
@ -326,28 +341,132 @@ NSAutoreleasePool* pool;
|
||||||
- (void)discardEventsMatchingMask:(unsigned int)mask
|
- (void)discardEventsMatchingMask:(unsigned int)mask
|
||||||
beforeEvent:(NSEvent *)lastEvent
|
beforeEvent:(NSEvent *)lastEvent
|
||||||
{
|
{
|
||||||
|
int i = 0, count;
|
||||||
|
NSEvent* event = nil;
|
||||||
|
BOOL match = NO;
|
||||||
|
|
||||||
|
count = [event_queue count];
|
||||||
|
event = [event_queue objectAtIndex:i];
|
||||||
|
while((event != lastEvent) && (i < count))
|
||||||
|
{
|
||||||
|
if (mask == NSAnyEventMask) // any event is a match
|
||||||
|
match = YES;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (event == null_event)
|
||||||
|
match = YES; // dump all null events
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch([event type])
|
||||||
|
{
|
||||||
|
case NSLeftMouseDown:
|
||||||
|
if (mask & NSLeftMouseDownMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSLeftMouseUp:
|
||||||
|
if (mask & NSLeftMouseUpMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSRightMouseDown:
|
||||||
|
if (mask & NSRightMouseDownMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSRightMouseUp:
|
||||||
|
if (mask & NSRightMouseUpMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSMouseMoved:
|
||||||
|
if (mask & NSMouseMovedMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSMouseEntered:
|
||||||
|
if (mask & NSMouseEnteredMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSMouseExited:
|
||||||
|
if (mask & NSMouseExitedMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSLeftMouseDragged:
|
||||||
|
if (mask & NSLeftMouseDraggedMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSRightMouseDragged:
|
||||||
|
if (mask & NSRightMouseDraggedMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSKeyDown:
|
||||||
|
if (mask & NSKeyDownMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSKeyUp:
|
||||||
|
if (mask & NSKeyUpMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSFlagsChanged:
|
||||||
|
if (mask & NSFlagsChangedMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSPeriodic:
|
||||||
|
if (mask & NSPeriodicMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSCursorUpdate:
|
||||||
|
if (mask & NSCursorUpdateMask)
|
||||||
|
match = YES;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
match = NO;
|
||||||
|
break;
|
||||||
|
} } } // remove event from
|
||||||
|
// the queue if it
|
||||||
|
if (match) // matched the mask
|
||||||
|
[event_queue removeObjectAtIndex:i];
|
||||||
|
event = [event_queue objectAtIndex:++i]; // get the next event
|
||||||
|
}; // in the queue
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSEvent*)_eventMatchingMask:(unsigned int)mask // return the next
|
- (NSEvent*)_eventMatchingMask:(unsigned int)mask dequeue:(BOOL)flag
|
||||||
{ // event in the queue
|
{
|
||||||
NSEvent* event; // which matches mask
|
NSEvent* event; // return the next
|
||||||
int i, count;
|
int i, count; // event in the queue
|
||||||
BOOL match = NO;
|
BOOL match = NO; // which matches mask
|
||||||
|
|
||||||
[self _nextEvent];
|
[self _nextEvent];
|
||||||
|
|
||||||
if ((count = [event_queue count])) // Get an event from
|
if ((count = [event_queue count])) // if queue contains
|
||||||
{ // the events queue
|
{ // events check them
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{ // Get next event from
|
||||||
event = [event_queue objectAtIndex:i];
|
event = [event_queue objectAtIndex:i]; // the events queue
|
||||||
|
|
||||||
if (mask == NSAnyEventMask) // any event is a match
|
if (mask == NSAnyEventMask) // the any event mask
|
||||||
match = YES;
|
match = YES; // matches all events
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (event == null_event) // do nothing if null
|
if (event == null_event) // do not send the null
|
||||||
match = NO; // event
|
{ // event
|
||||||
|
match = NO;
|
||||||
|
if(flag) // dequeue null event
|
||||||
|
{ // if flag is set
|
||||||
|
[event retain];
|
||||||
|
[event_queue removeObjectAtIndex:i];
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch([event type])
|
switch([event type])
|
||||||
|
@ -425,30 +544,30 @@ BOOL match = NO;
|
||||||
default:
|
default:
|
||||||
match = NO;
|
match = NO;
|
||||||
break;
|
break;
|
||||||
}
|
} } }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
{
|
{
|
||||||
[event retain];
|
if(flag) // dequeue the event if
|
||||||
[event_queue removeObjectAtIndex:i];
|
{ // flag is set
|
||||||
|
[event retain];
|
||||||
|
[event_queue removeObjectAtIndex:i];
|
||||||
|
}
|
||||||
ASSIGN(current_event, event);
|
ASSIGN(current_event, event);
|
||||||
|
|
||||||
return [event autorelease]; // return an event from
|
return event; // return an event from
|
||||||
} // the queue which
|
} // the queue which
|
||||||
} // matches the mask
|
} // matches the mask
|
||||||
}
|
}
|
||||||
|
// no event in the
|
||||||
return nil; // no event in the
|
return nil; // queue matches mask
|
||||||
} // queue matches mask
|
}
|
||||||
|
|
||||||
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask
|
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask
|
||||||
untilDate:(NSDate *)expiration
|
untilDate:(NSDate *)expiration
|
||||||
inMode:(NSString *)mode
|
inMode:(NSString *)mode
|
||||||
dequeue:(BOOL)flag
|
dequeue:(BOOL)flag
|
||||||
{
|
{
|
||||||
NSEventType type;
|
|
||||||
NSEvent *event;
|
NSEvent *event;
|
||||||
BOOL done = NO;
|
BOOL done = NO;
|
||||||
|
|
||||||
|
@ -457,7 +576,7 @@ BOOL done = NO;
|
||||||
else // of X motion events
|
else // of X motion events
|
||||||
inTrackingLoop = NO; // while not in a
|
inTrackingLoop = NO; // while not in a
|
||||||
// tracking loop
|
// tracking loop
|
||||||
if ((event = [self _eventMatchingMask:mask]))
|
if ((event = [self _eventMatchingMask:mask dequeue:flag]))
|
||||||
done = YES;
|
done = YES;
|
||||||
else
|
else
|
||||||
if (!expiration)
|
if (!expiration)
|
||||||
|
@ -473,7 +592,7 @@ BOOL done = NO;
|
||||||
limitDate = [[currentLoop limitDateForMode:mode] retain];
|
limitDate = [[currentLoop limitDateForMode:mode] retain];
|
||||||
originalLimitDate = limitDate;
|
originalLimitDate = limitDate;
|
||||||
|
|
||||||
if ((event = [self _eventMatchingMask:mask]))
|
if ((event = [self _eventMatchingMask:mask dequeue:flag]))
|
||||||
{
|
{
|
||||||
[limitDate release];
|
[limitDate release];
|
||||||
break;
|
break;
|
||||||
|
@ -487,15 +606,15 @@ BOOL done = NO;
|
||||||
[currentLoop runMode:mode beforeDate:limitDate];
|
[currentLoop runMode:mode beforeDate:limitDate];
|
||||||
[originalLimitDate release];
|
[originalLimitDate release];
|
||||||
|
|
||||||
if ((event = [self _eventMatchingMask:mask]))
|
if ((event = [self _eventMatchingMask:mask dequeue:flag]))
|
||||||
break;
|
break;
|
||||||
} // no need to unhide cursor
|
}
|
||||||
// while in a tracking loop
|
// no need to unhide cursor
|
||||||
if (event != null_event && (!inTrackingLoop)) // or if null event
|
if (!inTrackingLoop) // while in a tracking loop
|
||||||
{
|
{
|
||||||
if ([NSCursor isHiddenUntilMouseMoves]) // do so only if we should
|
if ([NSCursor isHiddenUntilMouseMoves]) // do so only if we should
|
||||||
{ // unhide when mouse moves
|
{ // unhide when mouse moves
|
||||||
type = [event type]; // and event is mouse event
|
NSEventType type = [event type]; // and event is mouse event
|
||||||
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|
||||||
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|
||||||
|| (type == NSMouseMoved))
|
|| (type == NSMouseMoved))
|
||||||
|
@ -761,8 +880,8 @@ NSArray *mi;
|
||||||
// Managing the Windows menu
|
// Managing the Windows menu
|
||||||
//
|
//
|
||||||
- (void)addWindowsItem:aWindow
|
- (void)addWindowsItem:aWindow
|
||||||
title:(NSString *)aString
|
title:(NSString *)aString
|
||||||
filename:(BOOL)isFilename
|
filename:(BOOL)isFilename
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -491,24 +491,19 @@ NSString* _string;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawInteriorWithFrame:(NSRect)cellFrame
|
- (void)drawInteriorWithFrame:(NSRect)cellFrame
|
||||||
inView:(NSView *)controlView
|
inView:(NSView *)controlView
|
||||||
{}
|
{ // implemented in back end
|
||||||
|
}
|
||||||
|
|
||||||
- (void)drawWithFrame:(NSRect)cellFrame
|
- (void)drawWithFrame:(NSRect)cellFrame
|
||||||
inView:(NSView *)controlView
|
inView:(NSView *)controlView
|
||||||
{
|
{ // implemented in back end
|
||||||
/* Mark the cell's frame rectangle as needing flush */
|
|
||||||
[[controlView window] _view:controlView needsFlushInRect:cellFrame];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)highlight:(BOOL)lit
|
- (void)highlight:(BOOL)lit
|
||||||
withFrame:(NSRect)cellFrame
|
withFrame:(NSRect)cellFrame
|
||||||
inView:(NSView *)controlView
|
inView:(NSView *)controlView
|
||||||
{
|
{ // implemented in back end
|
||||||
cell_highlighted = lit;
|
|
||||||
|
|
||||||
/* Mark the cell's frame rectangle as needing flush */
|
|
||||||
[[controlView window] _view:controlView needsFlushInRect:cellFrame];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isHighlighted
|
- (BOOL)isHighlighted
|
||||||
|
|
|
@ -147,6 +147,7 @@ static BOOL GNU_CONTEXT_SYNCHRONIZED = NO;
|
||||||
|
|
||||||
// Get current context for current thread
|
// Get current context for current thread
|
||||||
|
|
||||||
|
//if(current_thread)
|
||||||
current_context = [[current_thread threadDictionary] objectForKey: GNU_CONTEXT_THREAD_KEY];
|
current_context = [[current_thread threadDictionary] objectForKey: GNU_CONTEXT_THREAD_KEY];
|
||||||
|
|
||||||
// If not in dictionary then create one
|
// If not in dictionary then create one
|
||||||
|
|
|
@ -753,14 +753,21 @@ static Class menuCellClass = nil;
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// non OS spec methods
|
||||||
|
- (void)_rightMouseDisplay
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@end /* NSMenu */
|
@end /* NSMenu */
|
||||||
|
|
||||||
|
|
||||||
@implementation NSMenu (PrivateMethods2)
|
@implementation NSMenu (PrivateMethods2)
|
||||||
|
|
||||||
- (void)_menuChanged
|
- (void)_menuChanged
|
||||||
{
|
{
|
||||||
menuHasChanged = YES;
|
menuHasChanged = YES;
|
||||||
if (menuChangedMessagesEnabled)
|
if (menuChangedMessagesEnabled)
|
||||||
[self sizeToFit];
|
[self sizeToFit];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -796,11 +796,6 @@ NSView *current_view = nil;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_setNeedsFlush
|
|
||||||
{
|
|
||||||
[window _setNeedsFlush];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)display
|
- (void)display
|
||||||
{
|
{
|
||||||
if(!window) // do nothing if not in
|
if(!window) // do nothing if not in
|
||||||
|
@ -835,14 +830,13 @@ NSView *current_view = nil;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
if (!boundsMatrix || !frameMatrix)
|
if (!boundsMatrix || !frameMatrix)
|
||||||
NSLog (@"warning: %@ %p has not have the PS matrices setup!",
|
NSLog (@"warning: %@ %p does not have it's PS matrices configured!",
|
||||||
NSStringFromClass(isa), self);
|
NSStringFromClass(isa), self);
|
||||||
|
|
||||||
needs_display = NO;
|
needs_display = NO;
|
||||||
|
|
||||||
[self lockFocus];
|
[self lockFocus];
|
||||||
[self drawRect:rect];
|
[self drawRect:rect];
|
||||||
[window _setNeedsFlush];
|
|
||||||
[self unlockFocus];
|
[self unlockFocus];
|
||||||
// Tell subviews to display
|
// Tell subviews to display
|
||||||
for (i = 0, count = [sub_views count]; i < count; ++i)
|
for (i = 0, count = [sub_views count]; i < count; ++i)
|
||||||
|
@ -955,25 +949,25 @@ NSView* currentView; // of sibling subviews
|
||||||
|
|
||||||
- (void)setNeedsDisplay:(BOOL)flag
|
- (void)setNeedsDisplay:(BOOL)flag
|
||||||
{
|
{
|
||||||
needs_display = flag;
|
needs_display = flag;
|
||||||
if (needs_display) {
|
if (needs_display)
|
||||||
|
{
|
||||||
|
invalidatedRectangle = bounds;
|
||||||
|
[window setViewsNeedDisplay:YES];
|
||||||
|
|
||||||
invalidatedRectangle = bounds;
|
if (super_view)
|
||||||
[window _setNeedsDisplay];
|
[super_view _addSubviewForNeedingDisplay:self];
|
||||||
|
}
|
||||||
if (super_view)
|
|
||||||
[super_view _addSubviewForNeedingDisplay:self];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setNeedsDisplayInRect:(NSRect)rect
|
- (void)setNeedsDisplayInRect:(NSRect)rect
|
||||||
{
|
{
|
||||||
needs_display = YES;
|
needs_display = YES;
|
||||||
invalidatedRectangle = NSUnionRect (invalidatedRectangle, rect);
|
invalidatedRectangle = NSUnionRect (invalidatedRectangle, rect);
|
||||||
[window _setNeedsDisplay];
|
[window setViewsNeedDisplay:YES];
|
||||||
|
|
||||||
if (super_view)
|
if (super_view)
|
||||||
[super_view _addSubviewForNeedingDisplay:self];
|
[super_view _addSubviewForNeedingDisplay:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_recursivelyResetNeedsDisplayInAllViews
|
- (void)_recursivelyResetNeedsDisplayInAllViews
|
||||||
|
|
1650
Source/NSWindow.m
1650
Source/NSWindow.m
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue