mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 15:01:55 +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
527a13c7a6
commit
72c314b902
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>
|
Sun Apr 18 6:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
Added all improvements from mgstep.
|
Added all improvements from mgstep.
|
||||||
|
|
|
@ -107,13 +107,24 @@ NSApplication *NSApp = nil;
|
||||||
{
|
{
|
||||||
if (self == [NSApplication class])
|
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");
|
NSDebugLog(@"Initialize NSApplication class\n");
|
||||||
// Initial version
|
[self setVersion: 1];
|
||||||
[self setVersion:1];
|
|
||||||
// So the application knows
|
/*
|
||||||
gnustep_gui_app_is_in_dealloc = NO; // it's within dealloc and
|
* So the application knows it's within dealloc and
|
||||||
} // can prevent -release
|
* can prevent -release loops
|
||||||
} // loops.
|
*/
|
||||||
|
gnustep_gui_app_is_in_dealloc = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSApplication *)sharedApplication
|
+ (NSApplication *)sharedApplication
|
||||||
{ // If the global application does
|
{ // If the global application does
|
||||||
|
|
|
@ -43,6 +43,14 @@
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
#include <AppKit/NSGraphicsContext.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
|
@implementation NSEvent
|
||||||
|
|
||||||
// Class variables
|
// Class variables
|
||||||
|
@ -192,14 +200,14 @@ static NSString *timerKey = @"NSEventTimersKey";
|
||||||
withPeriod: (NSTimeInterval)periodSeconds
|
withPeriod: (NSTimeInterval)periodSeconds
|
||||||
{
|
{
|
||||||
NSTimer *timer;
|
NSTimer *timer;
|
||||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||||
|
|
||||||
NSDebugLog (@"startPeriodicEventsAfterDelay: withPeriod: ");
|
NSDebugLog (@"startPeriodicEventsAfterDelay: withPeriod: ");
|
||||||
|
|
||||||
if ([dict objectForKey: timerKey])
|
if ([dict objectForKey: timerKey])
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Periodic events are already being generated for "
|
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
|
// 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
|
// 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
|
+ (void) _registerRealTimer: (NSTimer*)timer
|
||||||
{
|
{
|
||||||
NSTimer* realTimer;
|
NSTimer* realTimer;
|
||||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||||
|
|
||||||
NSDebugLog (@"_registerRealTimer: ");
|
NSDebugLog (@"_registerRealTimer: ");
|
||||||
|
|
||||||
|
@ -260,7 +268,7 @@ static NSString *timerKey = @"NSEventTimersKey";
|
||||||
+ (void) stopPeriodicEvents
|
+ (void) stopPeriodicEvents
|
||||||
{
|
{
|
||||||
NSTimer* timer;
|
NSTimer* timer;
|
||||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||||
|
|
||||||
NSDebugLog (@"stopPeriodicEvents");
|
NSDebugLog (@"stopPeriodicEvents");
|
||||||
timer = [dict objectForKey: timerKey];
|
timer = [dict objectForKey: timerKey];
|
||||||
|
|
|
@ -95,16 +95,23 @@ static NSString *NSGraphicsContextThredKey = @"NSGraphicsContextThredKey";
|
||||||
return ctxt;
|
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
|
+ (void) setCurrentContext: (NSGraphicsContext *)context
|
||||||
{
|
{
|
||||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||||
|
|
||||||
[dict setObject: context forKey: NSGraphicsContextThredKey];
|
[dict setObject: context forKey: NSGraphicsContextThredKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSGraphicsContext *) currentContext
|
+ (NSGraphicsContext *) currentContext
|
||||||
{
|
{
|
||||||
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
NSMutableDictionary *dict = GSCurrentThreadDictionary();
|
||||||
|
|
||||||
return (NSGraphicsContext*) [dict objectForKey: NSGraphicsContextThredKey];
|
return (NSGraphicsContext*) [dict objectForKey: NSGraphicsContextThredKey];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,14 @@
|
||||||
#include <AppKit/NSStringDrawing.h>
|
#include <AppKit/NSStringDrawing.h>
|
||||||
#include <AppKit/AppKit.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 *whitespace;
|
||||||
static NSCharacterSet *newlines;
|
static NSCharacterSet *newlines;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue