aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pugl/detail/mac.h2
-rw-r--r--pugl/detail/mac.m37
-rw-r--r--pugl/detail/mac_gl.m16
3 files changed, 30 insertions, 25 deletions
diff --git a/pugl/detail/mac.h b/pugl/detail/mac.h
index 5bc1a2e..9e34ae8 100644
--- a/pugl/detail/mac.h
+++ b/pugl/detail/mac.h
@@ -60,6 +60,6 @@ struct PuglInternalsImpl {
NSApplication* app;
PuglWrapperView* wrapperView;
NSView* drawView;
- id window;
+ PuglWindow* window;
uint32_t mods;
};
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index bd1fdcf..f8ab084 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -475,7 +475,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
(void)replacement;
[markedText release];
markedText = (
- [string isKindOfClass:[NSAttributedString class]]
+ [(NSObject*)string isKindOfClass:[NSAttributedString class]]
? [[NSMutableAttributedString alloc] initWithAttributedString:string]
: [[NSMutableAttributedString alloc] initWithString:string]);
}
@@ -511,7 +511,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
(void)range;
(void)actual;
- const NSRect frame = [(id)puglview bounds];
+ const NSRect frame = [self bounds];
return NSMakeRect(frame.origin.x, frame.origin.y, 0.0, 0.0);
}
@@ -527,8 +527,8 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
NSEvent* const event = [NSApp currentEvent];
NSString* const characters =
- ([string isKindOfClass:[NSAttributedString class]]
- ? [string string]
+ ([(NSObject*)string isKindOfClass:[NSAttributedString class]]
+ ? [(NSAttributedString*)string string]
: (NSString*)string);
const NSPoint wloc = [self eventLocation:event];
@@ -569,7 +569,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
{
const uint32_t mods = getModifiers(event);
PuglEventType type = PUGL_NOTHING;
- PuglKey special = 0;
+ PuglKey special = (PuglKey)0;
if ((mods & PUGL_MOD_SHIFT) != (puglview->impl->mods & PUGL_MOD_SHIFT)) {
type = mods & PUGL_MOD_SHIFT ? PUGL_KEY_PRESS : PUGL_KEY_RELEASE;
@@ -771,7 +771,7 @@ puglCreateWindow(PuglView* view, const char* title)
puglConstraint(impl->wrapperView, NSLayoutAttributeHeight, view->minHeight)];
// Create draw view to be rendered to
- int st = 0;
+ PuglStatus st = PUGL_SUCCESS;
if ((st = view->backend->configure(view)) ||
(st = view->backend->create(view))) {
return st;
@@ -804,7 +804,7 @@ puglCreateWindow(PuglView* view, const char* title)
style |= NSResizableWindowMask;
}
- id window = [[[PuglWindow alloc]
+ PuglWindow* window = [[[PuglWindow alloc]
initWithContentRect:frame
styleMask:style
backing:NSBackingStoreBuffered
@@ -963,8 +963,8 @@ PuglStatus puglSendEvent(PuglView* view, const PuglEvent* event)
windowNumber:window.windowNumber
context:nil
subtype:PUGL_CLIENT
- data1:event->client.data1
- data2:event->client.data2];
+ data1:(NSInteger)event->client.data1
+ data2:(NSInteger)event->client.data2];
[view->world->impl->app postEvent:nsevent atStart:false];
return PUGL_SUCCESS;
@@ -992,8 +992,8 @@ dispatchClientEvent(PuglWorld* world, NSEvent* ev)
if ([wrapper window] == win && NSPointInRect(loc, [wrapper frame])) {
const PuglEventClient event = {PUGL_CLIENT,
0,
- [ev data1],
- [ev data2]};
+ (uintptr_t)[ev data1],
+ (uintptr_t)[ev data2]};
puglDispatchEvent(view, (const PuglEvent*)&event);
}
@@ -1182,11 +1182,16 @@ puglSetClipboard(PuglView* const view,
return st;
}
- [pasteboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil]
- owner:nil];
+ NSString* nsString = [NSString stringWithUTF8String:str];
+ if (nsString) {
+ [pasteboard
+ declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil]
+ owner:nil];
- [pasteboard setString:[NSString stringWithUTF8String:str]
- forType:NSStringPboardType];
+ [pasteboard setString:nsString forType:NSStringPboardType];
- return PUGL_SUCCESS;
+ return PUGL_SUCCESS;
+ }
+
+ return PUGL_UNKNOWN_ERROR;
}
diff --git a/pugl/detail/mac_gl.m b/pugl/detail/mac_gl.m
index 54f0fdd..eda4371 100644
--- a/pugl/detail/mac_gl.m
+++ b/pugl/detail/mac_gl.m
@@ -39,14 +39,14 @@
- (id) initWithFrame:(NSRect)frame
{
- const bool compat = puglview->hints[PUGL_USE_COMPAT_PROFILE];
- const int samples = puglview->hints[PUGL_SAMPLES];
- const int major = puglview->hints[PUGL_CONTEXT_VERSION_MAJOR];
- const int profile = ((compat || major < 3)
- ? NSOpenGLProfileVersionLegacy
- : (major >= 4
- ? NSOpenGLProfileVersion4_1Core
- : NSOpenGLProfileVersion3_2Core));
+ const bool compat = puglview->hints[PUGL_USE_COMPAT_PROFILE];
+ const unsigned samples = (unsigned)puglview->hints[PUGL_SAMPLES];
+ const int major = puglview->hints[PUGL_CONTEXT_VERSION_MAJOR];
+ const unsigned profile = ((compat || major < 3)
+ ? NSOpenGLProfileVersionLegacy
+ : (major >= 4
+ ? NSOpenGLProfileVersion4_1Core
+ : NSOpenGLProfileVersion3_2Core));
NSOpenGLPixelFormatAttribute pixelAttribs[16] = {
NSOpenGLPFADoubleBuffer,