mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Optimisations etc
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4100 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5eb0a2e7a0
commit
7f8efd6908
5 changed files with 54 additions and 12 deletions
|
@ -1,3 +1,11 @@
|
|||
Mon Apr 19 14:54:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSApplication.m: Link in dummy function to ensure that
|
||||
NSStringDrawing catagories are linked when using static libs.
|
||||
* Source/NSStringDrawing.m: Add dummy function to force link.
|
||||
* Source/NSEvent.m: Faster thread access.
|
||||
* Source/NSGraphicsContext.m: ditto.
|
||||
|
||||
Sun Apr 18 6:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
Added all improvements from mgstep.
|
||||
|
|
|
@ -107,13 +107,24 @@ NSApplication *NSApp = nil;
|
|||
{
|
||||
if (self == [NSApplication class])
|
||||
{
|
||||
/*
|
||||
* Dummy functions to fool linker into linking files that contain
|
||||
* only catagories - static libraries seem to have problems here.
|
||||
*/
|
||||
extern void GSStringDrawingDummyFunction();
|
||||
|
||||
GSStringDrawingDummyFunction();
|
||||
|
||||
NSDebugLog(@"Initialize NSApplication class\n");
|
||||
// Initial version
|
||||
[self setVersion:1];
|
||||
// So the application knows
|
||||
gnustep_gui_app_is_in_dealloc = NO; // it's within dealloc and
|
||||
} // can prevent -release
|
||||
} // loops.
|
||||
[self setVersion: 1];
|
||||
|
||||
/*
|
||||
* So the application knows it's within dealloc and
|
||||
* can prevent -release loops
|
||||
*/
|
||||
gnustep_gui_app_is_in_dealloc = NO;
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSApplication *)sharedApplication
|
||||
{ // If the global application does
|
||||
|
|
|
@ -43,6 +43,14 @@
|
|||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSGraphicsContext.h>
|
||||
|
||||
/*
|
||||
* gstep-base has a faster mechanism to get the current thread.
|
||||
*/
|
||||
#ifndef GNUSTEP_BASE_LIBRARY
|
||||
#define GSCurrentThread() [NSThread currentThread]
|
||||
#define GSCurrentThreadDictionary() [[NSThread currentThread] threadDictionary]
|
||||
#endif
|
||||
|
||||
@implementation NSEvent
|
||||
|
||||
// Class variables
|
||||
|
@ -192,14 +200,14 @@ static NSString *timerKey = @"NSEventTimersKey";
|
|||
withPeriod: (NSTimeInterval)periodSeconds
|
||||
{
|
||||
NSTimer *timer;
|
||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
NSDebugLog (@"startPeriodicEventsAfterDelay: withPeriod: ");
|
||||
|
||||
if ([dict objectForKey: timerKey])
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Periodic events are already being generated for "
|
||||
@"this thread %x", [NSThread currentThread]];
|
||||
@"this thread %x", GSCurrentThread()];
|
||||
|
||||
// If the delay time is 0 then register a timer immediately. Otherwise
|
||||
// register a timer with no repeat that when fired registers the real timer
|
||||
|
@ -243,7 +251,7 @@ static NSString *timerKey = @"NSEventTimersKey";
|
|||
+ (void) _registerRealTimer: (NSTimer*)timer
|
||||
{
|
||||
NSTimer* realTimer;
|
||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
NSDebugLog (@"_registerRealTimer: ");
|
||||
|
||||
|
@ -260,7 +268,7 @@ static NSString *timerKey = @"NSEventTimersKey";
|
|||
+ (void) stopPeriodicEvents
|
||||
{
|
||||
NSTimer* timer;
|
||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
NSDebugLog (@"stopPeriodicEvents");
|
||||
timer = [dict objectForKey: timerKey];
|
||||
|
|
|
@ -95,16 +95,23 @@ static NSString *NSGraphicsContextThredKey = @"NSGraphicsContextThredKey";
|
|||
return ctxt;
|
||||
}
|
||||
|
||||
/*
|
||||
* gstep-base has a faster mechanism to get the current thread.
|
||||
*/
|
||||
#ifndef GNUSTEP_BASE_LIBRARY
|
||||
#define GSCurrentThreadDictionary() [[NSThread currentThread] threadDictionary]
|
||||
#endif
|
||||
|
||||
+ (void) setCurrentContext: (NSGraphicsContext *)context
|
||||
{
|
||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
[dict setObject: context forKey: NSGraphicsContextThredKey];
|
||||
}
|
||||
|
||||
+ (NSGraphicsContext *) currentContext
|
||||
{
|
||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
||||
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||
|
||||
return (NSGraphicsContext*) [dict objectForKey: NSGraphicsContextThredKey];
|
||||
}
|
||||
|
|
|
@ -31,6 +31,14 @@
|
|||
#include <AppKit/NSStringDrawing.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
/*
|
||||
* A function called by NSApplication to ensure that this file is linked
|
||||
* when it should be.
|
||||
*/
|
||||
void
|
||||
GSStringDrawingDummyFunction()
|
||||
{
|
||||
}
|
||||
|
||||
static NSCharacterSet *whitespace;
|
||||
static NSCharacterSet *newlines;
|
||||
|
|
Loading…
Reference in a new issue