mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:00:48 +00:00
gui changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3172 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8b6da0e300
commit
93f36cdf77
3 changed files with 66 additions and 35 deletions
|
@ -63,7 +63,6 @@ extern NSString *NSEventTrackingRunLoopMode;
|
||||||
// Attributes
|
// Attributes
|
||||||
NSMutableArray *window_list;
|
NSMutableArray *window_list;
|
||||||
NSMutableArray *event_queue;
|
NSMutableArray *event_queue;
|
||||||
NSMutableArray *recycled_event_queue;
|
|
||||||
NSEvent *current_event;
|
NSEvent *current_event;
|
||||||
id key_window;
|
id key_window;
|
||||||
id main_window;
|
id main_window;
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
// Class variables
|
// Class variables
|
||||||
//
|
//
|
||||||
static BOOL gnustep_gui_app_is_in_dealloc;
|
static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
static NSEvent *gnustep_gui_null_event;
|
static NSEvent *null_event;
|
||||||
static id NSApp;
|
static id NSApp;
|
||||||
|
|
||||||
#define ASSIGN(a, b) [b retain]; \
|
#define ASSIGN(a, b) [b retain]; \
|
||||||
|
@ -115,9 +115,8 @@ static id NSApp;
|
||||||
windows_need_update = YES;
|
windows_need_update = YES;
|
||||||
|
|
||||||
event_queue = [NSMutableArray new]; // allocate event queue
|
event_queue = [NSMutableArray new]; // allocate event queue
|
||||||
recycled_event_queue = [NSMutableArray new]; // alloc recycle queue
|
|
||||||
current_event = [NSEvent new]; // no current event
|
current_event = [NSEvent new]; // no current event
|
||||||
gnustep_gui_null_event = [NSEvent new]; // create a NULL event
|
null_event = [NSEvent new]; // create dummy event
|
||||||
|
|
||||||
[self setNextResponder:NULL]; // We are the end of
|
[self setNextResponder:NULL]; // We are the end of
|
||||||
// the responder chain
|
// the responder chain
|
||||||
|
@ -171,7 +170,6 @@ NSString* mainModelFile;
|
||||||
|
|
||||||
[window_list release];
|
[window_list release];
|
||||||
[event_queue release];
|
[event_queue release];
|
||||||
[recycled_event_queue release];
|
|
||||||
[current_event release];
|
[current_event release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -262,7 +260,7 @@ NSAutoreleasePool* pool;
|
||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)theEvent
|
- (void)sendEvent:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
if (theEvent == gnustep_gui_null_event) // Don't send null event
|
if (theEvent == null_event) // Don't send null event
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Not sending the Null Event\n");
|
NSDebugLog(@"Not sending the Null Event\n");
|
||||||
return;
|
return;
|
||||||
|
@ -348,7 +346,7 @@ BOOL match = NO;
|
||||||
match = YES;
|
match = YES;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (event == gnustep_gui_null_event) // do nothing if null
|
if (event == null_event) // do nothing if null
|
||||||
match = NO; // event
|
match = NO; // event
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -459,7 +457,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]))
|
||||||
done = YES;
|
done = YES;
|
||||||
else
|
else
|
||||||
if (!expiration)
|
if (!expiration)
|
||||||
|
@ -475,7 +473,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]))
|
||||||
{
|
{
|
||||||
[limitDate release];
|
[limitDate release];
|
||||||
break;
|
break;
|
||||||
|
@ -489,12 +487,11 @@ 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]))
|
||||||
break;
|
break;
|
||||||
} // no need to unhide cursor
|
} // no need to unhide cursor
|
||||||
// while in a tracking loop
|
// while in a tracking loop
|
||||||
if (event != gnustep_gui_null_event && // or if event is the null
|
if (event != null_event && (!inTrackingLoop)) // or if null event
|
||||||
(!inTrackingLoop)) // event
|
|
||||||
{
|
{
|
||||||
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
|
||||||
|
@ -689,7 +686,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
- (NSArray *)windows
|
- (NSArray *)windows
|
||||||
{
|
{
|
||||||
return window_list;
|
return window_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSWindow *)windowWithWindowNumber:(int)windowNum
|
- (NSWindow *)windowWithWindowNumber:(int)windowNum
|
||||||
|
@ -815,8 +812,8 @@ int i;
|
||||||
|
|
||||||
- (void)setWindowsMenu:aMenu
|
- (void)setWindowsMenu:aMenu
|
||||||
{
|
{
|
||||||
// if (windows_menu)
|
if (windows_menu)
|
||||||
// [windows_menu setSubmenu:aMenu];
|
[windows_menu setSubmenu:aMenu];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateWindowsItem:aWindow
|
- (void)updateWindowsItem:aWindow
|
||||||
|
@ -825,8 +822,10 @@ int i;
|
||||||
|
|
||||||
- (NSMenu *)windowsMenu
|
- (NSMenu *)windowsMenu
|
||||||
{
|
{
|
||||||
// return [windows_menu submenu];
|
if(windows_menu)
|
||||||
return nil;
|
return [windows_menu submenu];
|
||||||
|
else
|
||||||
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -866,9 +865,12 @@ int i;
|
||||||
//
|
//
|
||||||
- (void)terminate:sender
|
- (void)terminate:sender
|
||||||
{
|
{
|
||||||
if ([self applicationShouldTerminate:sender])
|
if ([self applicationShouldTerminate:self])
|
||||||
|
{ // app should end run loop
|
||||||
app_should_quit = YES;
|
app_should_quit = YES;
|
||||||
}
|
[event_queue addObject: null_event]; // add dummy event to queue
|
||||||
|
} // to assure loop cycles
|
||||||
|
} // at least one more time
|
||||||
|
|
||||||
- delegate // Assigning a delegate
|
- delegate // Assigning a delegate
|
||||||
{
|
{
|
||||||
|
@ -1056,12 +1058,12 @@ BOOL result = YES;
|
||||||
|
|
||||||
+ (void)setNullEvent:(NSEvent *)e
|
+ (void)setNullEvent:(NSEvent *)e
|
||||||
{
|
{
|
||||||
ASSIGN(gnustep_gui_null_event, e);
|
ASSIGN(null_event, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSEvent *)getNullEvent;
|
+ (NSEvent *)getNullEvent;
|
||||||
{ // return the class
|
{ // return the class
|
||||||
return gnustep_gui_null_event; // dummy event
|
return null_event; // dummy event
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_nextEvent // get next event
|
- (void)_nextEvent // get next event
|
||||||
|
|
|
@ -50,10 +50,10 @@
|
||||||
#include <AppKit/PSMatrix.h>
|
#include <AppKit/PSMatrix.h>
|
||||||
#include <AppKit/NSWindowView.h>
|
#include <AppKit/NSWindowView.h>
|
||||||
|
|
||||||
#define ASSIGN(variable, value) \
|
#define ASSIGN(a, b) [b retain]; \
|
||||||
[value retain]; \
|
[a release]; \
|
||||||
[variable release]; \
|
a = b;
|
||||||
variable = value;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// NSWindow implementation
|
// NSWindow implementation
|
||||||
|
@ -124,8 +124,8 @@ static BOOL _needsFlushWindows = YES;
|
||||||
int style;
|
int style;
|
||||||
|
|
||||||
NSDebugLog(@"NSWindow -init\n");
|
NSDebugLog(@"NSWindow -init\n");
|
||||||
|
// default style
|
||||||
style = NSTitledWindowMask | NSClosableWindowMask
|
style = NSTitledWindowMask | NSClosableWindowMask // mask
|
||||||
| NSMiniaturizableWindowMask | NSResizableWindowMask;
|
| NSMiniaturizableWindowMask | NSResizableWindowMask;
|
||||||
|
|
||||||
return [self initWithContentRect:NSZeroRect
|
return [self initWithContentRect:NSZeroRect
|
||||||
|
@ -871,12 +871,16 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
//
|
//
|
||||||
- (void)close
|
- (void)close
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
// Notify delegate
|
||||||
// Notify our delegate
|
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
||||||
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
[self orderOut:self];
|
||||||
|
visible = NO;
|
||||||
[self performClose:self];
|
// if app has no
|
||||||
|
if(![[NSApplication sharedApplication] mainMenu]) // menu terminate
|
||||||
|
[[NSApplication sharedApplication] terminate:self];
|
||||||
|
else // otherwise just
|
||||||
|
[self autorelease]; // release self
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)deminiaturize:sender
|
- (void)deminiaturize:sender
|
||||||
|
@ -916,9 +920,35 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
[nc postNotificationName: NSWindowDidMiniaturizeNotification object: self];
|
[nc postNotificationName: NSWindowDidMiniaturizeNotification object: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)performClose:sender
|
- (void)performClose:sender
|
||||||
{
|
{
|
||||||
visible = NO;
|
if([self styleMask] & NSClosableWindowMask)
|
||||||
|
{ // self must have a close
|
||||||
|
NSBeep(); // button in order to be
|
||||||
|
return; // closed
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([delegate respondsToSelector:@selector(windowShouldClose:)])
|
||||||
|
{ // if delegate responds to
|
||||||
|
if(![delegate windowShouldClose:self]) // windowShouldClose query
|
||||||
|
{ // it to see if it's ok to
|
||||||
|
NSBeep(); // close the window
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ([self respondsToSelector:@selector(windowShouldClose:)])
|
||||||
|
{ // else if self responds to
|
||||||
|
if(![self windowShouldClose:self]) // windowShouldClose query
|
||||||
|
{ // self to see if it's ok
|
||||||
|
NSBeep(); // to close self
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[self close]; // it's ok to close self
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)performMiniaturize:sender
|
- (void)performMiniaturize:sender
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue