blob: f00b2be57469e88a2dcfc45ad525b6490903cca9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*
Listens to NSViewGlobalFrameDidChangeNotification
This notification is sent whenever an NSView that has an attached NSSurface changes size or changes screens (thus potentially changing graphics hardware drivers.)
*/
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <AppKit/NSView.h>
#import <OpenGL/OpenGL.h>
#import <OpenGL/gl.h>
//#define DEBUG_GL_LOCKS
#ifdef DEBUG_GL_LOCKS
#define LOCK_GL(func, line) [ContextUpdater lockInFunction:func atLine:line];
#define UNLOCK_GL(func, line) [ContextUpdater unlockInFunction:func atLine:line];
#else
#define LOCK_GL(func, line) [ContextUpdater lock];
#define UNLOCK_GL(func, line) [ContextUpdater unlock];
#endif
@interface ContextUpdater : NSObject
{
@protected
pthread_mutex_t resourceLock;
NSView * view;
NSRect viewRect;
NSOpenGLContext *ctx;
BOOL viewUpdated;
}
- (id) initWithContext:(NSOpenGLContext *)context view: (NSView *)nsView;
- (void) update:(NSNotification *)notification;
- (BOOL) needsUpdate;
@end
|