forked from pyrite-dev/milsko
mac: mouse fixing, somewwhat. also just always send events for a bit
This commit is contained in:
parent
8f379e9751
commit
d3c30bf6d3
3 changed files with 20 additions and 5 deletions
|
|
@ -110,6 +110,7 @@
|
||||||
NSCursor *cursor;
|
NSCursor *cursor;
|
||||||
|
|
||||||
MwBool pointerLocked;
|
MwBool pointerLocked;
|
||||||
|
MwBool mouseMoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (MilskoCocoa *)newWithParent:(MwLL)parent
|
+ (MilskoCocoa *)newWithParent:(MwLL)parent
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,21 @@ static NSPoint pointFlip(NSPoint point) {
|
||||||
this->lastEvent = [this->application currentEvent];
|
this->lastEvent = [this->application currentEvent];
|
||||||
[this eventProcess:this->lastEvent];
|
[this eventProcess:this->lastEvent];
|
||||||
|
|
||||||
|
if (this->_forceRender) {
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined
|
||||||
|
location:NSMakePoint(0, 0)
|
||||||
|
modifierFlags:0
|
||||||
|
timestamp:0
|
||||||
|
windowNumber:0
|
||||||
|
context:nil
|
||||||
|
subtype:0
|
||||||
|
data1:0
|
||||||
|
data2:0];
|
||||||
|
[NSApp postEvent:event atStart:YES];
|
||||||
|
[pool release];
|
||||||
|
}
|
||||||
|
|
||||||
[[NSApplication sharedApplication] stop:nil];
|
[[NSApplication sharedApplication] stop:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,7 +316,7 @@ static NSPoint pointFlip(NSPoint point) {
|
||||||
- (void)getNextEvent {
|
- (void)getNextEvent {
|
||||||
[self sendClipboardEvent];
|
[self sendClipboardEvent];
|
||||||
|
|
||||||
if (self->pointerLocked && [self->window isMainWindow]) {
|
if (self->pointerLocked && [self->window isMainWindow] && self->lastEvent) {
|
||||||
struct CGPoint pos;
|
struct CGPoint pos;
|
||||||
pos.x = [window frame].origin.x + [window frame].size.width / 2;
|
pos.x = [window frame].origin.x + [window frame].size.width / 2;
|
||||||
pos.y = [window frame].origin.y + [window frame].size.height / 2;
|
pos.y = [window frame].origin.y + [window frame].size.height / 2;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
@interface MacOpenGLWidget : NSObject {
|
@interface MacOpenGLWidget : NSObject {
|
||||||
NSOpenGLPixelFormat *pixelFormat;
|
NSOpenGLPixelFormat *pixelFormat;
|
||||||
NSOpenGLContext *glc;
|
NSOpenGLContext *glc;
|
||||||
MilskoCocoa * _win;
|
MilskoCocoa *_win;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MacOpenGLWidget *)initWithWindow:(MilskoCocoa *)w;
|
- (MacOpenGLWidget *)initWithWindow:(MilskoCocoa *)w;
|
||||||
|
|
@ -31,8 +31,8 @@ static int create(MwWidget handle) {
|
||||||
|
|
||||||
printf("%d %d\n", width, height);
|
printf("%d %d\n", width, height);
|
||||||
|
|
||||||
handle->internal = [[MacOpenGLWidget alloc]
|
handle->internal =
|
||||||
initWithWindow:handle->lowlevel->cocoa.real];
|
[[MacOpenGLWidget alloc] initWithWindow:handle->lowlevel->cocoa.real];
|
||||||
handle->lowlevel->common.copy_buffer = 0;
|
handle->lowlevel->common.copy_buffer = 0;
|
||||||
|
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
@ -98,7 +98,6 @@ static void func_handler(MwWidget handle, const char *name, void *out,
|
||||||
[self->glc makeCurrentContext];
|
[self->glc makeCurrentContext];
|
||||||
};
|
};
|
||||||
- (void)swapBuffer {
|
- (void)swapBuffer {
|
||||||
[self->_win forceRender];
|
|
||||||
[self->glc flushBuffer];
|
[self->glc flushBuffer];
|
||||||
};
|
};
|
||||||
- (void *)getProcAddressWithName:(const char *)name {
|
- (void *)getProcAddressWithName:(const char *)name {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue