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;
|
||||
|
||||
MwBool pointerLocked;
|
||||
MwBool mouseMoved;
|
||||
}
|
||||
|
||||
+ (MilskoCocoa *)newWithParent:(MwLL)parent
|
||||
|
|
|
|||
|
|
@ -176,6 +176,21 @@ static NSPoint pointFlip(NSPoint point) {
|
|||
this->lastEvent = [this->application currentEvent];
|
||||
[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];
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +316,7 @@ static NSPoint pointFlip(NSPoint point) {
|
|||
- (void)getNextEvent {
|
||||
[self sendClipboardEvent];
|
||||
|
||||
if (self->pointerLocked && [self->window isMainWindow]) {
|
||||
if (self->pointerLocked && [self->window isMainWindow] && self->lastEvent) {
|
||||
struct CGPoint pos;
|
||||
pos.x = [window frame].origin.x + [window frame].size.width / 2;
|
||||
pos.y = [window frame].origin.y + [window frame].size.height / 2;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
@interface MacOpenGLWidget : NSObject {
|
||||
NSOpenGLPixelFormat *pixelFormat;
|
||||
NSOpenGLContext *glc;
|
||||
MilskoCocoa * _win;
|
||||
MilskoCocoa *_win;
|
||||
}
|
||||
|
||||
- (MacOpenGLWidget *)initWithWindow:(MilskoCocoa *)w;
|
||||
|
|
@ -31,8 +31,8 @@ static int create(MwWidget handle) {
|
|||
|
||||
printf("%d %d\n", width, height);
|
||||
|
||||
handle->internal = [[MacOpenGLWidget alloc]
|
||||
initWithWindow:handle->lowlevel->cocoa.real];
|
||||
handle->internal =
|
||||
[[MacOpenGLWidget alloc] initWithWindow:handle->lowlevel->cocoa.real];
|
||||
handle->lowlevel->common.copy_buffer = 0;
|
||||
|
||||
MwSetDefault(handle);
|
||||
|
|
@ -98,7 +98,6 @@ static void func_handler(MwWidget handle, const char *name, void *out,
|
|||
[self->glc makeCurrentContext];
|
||||
};
|
||||
- (void)swapBuffer {
|
||||
[self->_win forceRender];
|
||||
[self->glc flushBuffer];
|
||||
};
|
||||
- (void *)getProcAddressWithName:(const char *)name {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue