aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/devdraw
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2017-01-06 16:32:31 -0500
committerRuss Cox <rsc@swtch.com>2017-01-06 21:37:31 +0000
commit310ae03327a815e721166b64aa3af27b1cc8c2ff (patch)
tree3aaf93aaf66d29658ec8da82b3b09c1a6d941660 /src/cmd/devdraw
parent9e0d3750c543de49ccc43512cb3fbaa1f42f1648 (diff)
downloadplan9port-310ae03327a815e721166b64aa3af27b1cc8c2ff.tar.gz
plan9port-310ae03327a815e721166b64aa3af27b1cc8c2ff.tar.bz2
plan9port-310ae03327a815e721166b64aa3af27b1cc8c2ff.zip
all: fix or silence all INSTALL warnings on macOS
Should be a clean build now. Change-Id: Id3460371cb5e8d4071f8faa9c2aec870d213a067 Reviewed-on: https://plan9port-review.googlesource.com/2781 Reviewed-by: Russ Cox <rsc@swtch.com>
Diffstat (limited to 'src/cmd/devdraw')
-rw-r--r--src/cmd/devdraw/cocoa-screen.m140
-rw-r--r--src/cmd/devdraw/devdraw.c4
-rw-r--r--src/cmd/devdraw/macargv.m4
3 files changed, 85 insertions, 63 deletions
diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m
index 3607ab41..7aebae21 100644
--- a/src/cmd/devdraw/cocoa-screen.m
+++ b/src/cmd/devdraw/cocoa-screen.m
@@ -28,6 +28,30 @@
#include "bigarrow.h"
#include "glendapng.h"
+// Use non-deprecated names.
+#define NSKeyDown NSEventTypeKeyDown
+#define NSAlternateKeyMask NSEventModifierFlagOption
+#define NSCommandKeyMask NSEventModifierFlagCommand
+#define NSResizableWindowMask NSWindowStyleMaskResizable
+#define NSLeftMouseDown NSEventTypeLeftMouseDown
+#define NSLeftMouseUp NSEventTypeLeftMouseUp
+#define NSRightMouseDown NSEventTypeRightMouseDown
+#define NSRightMouseUp NSEventTypeRightMouseUp
+#define NSOtherMouseDown NSEventTypeOtherMouseDown
+#define NSOtherMouseUp NSEventTypeOtherMouseUp
+#define NSScrollWheel NSEventTypeScrollWheel
+#define NSMouseMoved NSEventTypeMouseMoved
+#define NSLeftMouseDragged NSEventTypeLeftMouseDragged
+#define NSRightMouseDragged NSEventTypeRightMouseDragged
+#define NSOtherMouseDragged NSEventTypeOtherMouseDragged
+#define NSCompositeCopy NSCompositingOperationCopy
+#define NSCompositeSourceIn NSCompositingOperationSourceIn
+#define NSFlagsChanged NSEventTypeFlagsChanged
+#define NSTitledWindowMask NSWindowStyleMaskTitled
+#define NSClosableWindowMask NSWindowStyleMaskClosable
+#define NSMiniaturizableWindowMask NSWindowStyleMaskMiniaturizable
+#define NSBorderlessWindowMask NSWindowStyleMaskBorderless
+
AUTOFRAMEWORK(Cocoa)
#define LOG if(0)NSLog
@@ -53,7 +77,9 @@ usage(void)
threadexitsall("usage");
}
-@interface appdelegate : NSObject @end
+@interface appdelegate : NSObject<NSApplicationDelegate,NSWindowDelegate> @end
+
+NSObject<NSApplicationDelegate,NSWindowDelegate> *myApp;
void
threadmain(int argc, char **argv)
@@ -97,7 +123,8 @@ threadmain(int argc, char **argv)
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
- [NSApp setDelegate:[appdelegate new]];
+ myApp = [appdelegate new];
+ [NSApp setDelegate:myApp];
[NSApp run];
}
@@ -402,7 +429,7 @@ makewin(char *s)
backing:NSBackingStoreBuffered defer:YES];
for(i=0; i<2; i++){
[win.ofs[i] setAcceptsMouseMovedEvents:YES];
- [win.ofs[i] setDelegate:[NSApp delegate]];
+ [win.ofs[i] setDelegate:myApp];
[win.ofs[i] setDisplaysWhenScreenProfileChanges:NO];
}
win.isofs = 0;
@@ -567,7 +594,7 @@ flushimg(NSRect rect)
rect = dilate(scalerect(rect, win.topointscale));
r.size.height -= Cornersize;
dr = NSIntersectionRect(r, rect);
- LOG(@"r %.0f %.0f", r.origin.x, r.origin.y, rect.size.width, rect.size.height);
+ LOG(@"r %.0f %.0f %.0f %.0f", r.origin.x, r.origin.y, rect.size.width, rect.size.height);
LOG(@"rect in points %f %f %.0f %.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
LOG(@"dr in points %f %f %.0f %.0f", dr.origin.x, dr.origin.y, dr.size.width, dr.size.height);
drawimg(dr, NSCompositeCopy);
@@ -792,52 +819,52 @@ static void updatecursor(void);
static int keycvt[] =
{
- [QZ_IBOOK_ENTER] '\n',
- [QZ_RETURN] '\n',
- [QZ_ESCAPE] 27,
- [QZ_BACKSPACE] '\b',
- [QZ_LALT] Kalt,
- [QZ_LCTRL] Kctl,
- [QZ_LSHIFT] Kshift,
- [QZ_F1] KF+1,
- [QZ_F2] KF+2,
- [QZ_F3] KF+3,
- [QZ_F4] KF+4,
- [QZ_F5] KF+5,
- [QZ_F6] KF+6,
- [QZ_F7] KF+7,
- [QZ_F8] KF+8,
- [QZ_F9] KF+9,
- [QZ_F10] KF+10,
- [QZ_F11] KF+11,
- [QZ_F12] KF+12,
- [QZ_INSERT] Kins,
- [QZ_DELETE] 0x7F,
- [QZ_HOME] Khome,
- [QZ_END] Kend,
- [QZ_KP_PLUS] '+',
- [QZ_KP_MINUS] '-',
- [QZ_TAB] '\t',
- [QZ_PAGEUP] Kpgup,
- [QZ_PAGEDOWN] Kpgdown,
- [QZ_UP] Kup,
- [QZ_DOWN] Kdown,
- [QZ_LEFT] Kleft,
- [QZ_RIGHT] Kright,
- [QZ_KP_MULTIPLY] '*',
- [QZ_KP_DIVIDE] '/',
- [QZ_KP_ENTER] '\n',
- [QZ_KP_PERIOD] '.',
- [QZ_KP0] '0',
- [QZ_KP1] '1',
- [QZ_KP2] '2',
- [QZ_KP3] '3',
- [QZ_KP4] '4',
- [QZ_KP5] '5',
- [QZ_KP6] '6',
- [QZ_KP7] '7',
- [QZ_KP8] '8',
- [QZ_KP9] '9',
+ [QZ_IBOOK_ENTER]= '\n',
+ [QZ_RETURN]= '\n',
+ [QZ_ESCAPE]= 27,
+ [QZ_BACKSPACE]= '\b',
+ [QZ_LALT]= Kalt,
+ [QZ_LCTRL]= Kctl,
+ [QZ_LSHIFT]= Kshift,
+ [QZ_F1]= KF+1,
+ [QZ_F2]= KF+2,
+ [QZ_F3]= KF+3,
+ [QZ_F4]= KF+4,
+ [QZ_F5]= KF+5,
+ [QZ_F6]= KF+6,
+ [QZ_F7]= KF+7,
+ [QZ_F8]= KF+8,
+ [QZ_F9]= KF+9,
+ [QZ_F10]= KF+10,
+ [QZ_F11]= KF+11,
+ [QZ_F12]= KF+12,
+ [QZ_INSERT]= Kins,
+ [QZ_DELETE]= 0x7F,
+ [QZ_HOME]= Khome,
+ [QZ_END]= Kend,
+ [QZ_KP_PLUS]= '+',
+ [QZ_KP_MINUS]= '-',
+ [QZ_TAB]= '\t',
+ [QZ_PAGEUP]= Kpgup,
+ [QZ_PAGEDOWN]= Kpgdown,
+ [QZ_UP]= Kup,
+ [QZ_DOWN]= Kdown,
+ [QZ_LEFT]= Kleft,
+ [QZ_RIGHT]= Kright,
+ [QZ_KP_MULTIPLY]= '*',
+ [QZ_KP_DIVIDE]= '/',
+ [QZ_KP_ENTER]= '\n',
+ [QZ_KP_PERIOD]= '.',
+ [QZ_KP0]= '0',
+ [QZ_KP1]= '1',
+ [QZ_KP2]= '2',
+ [QZ_KP3]= '3',
+ [QZ_KP4]= '4',
+ [QZ_KP5]= '5',
+ [QZ_KP6]= '6',
+ [QZ_KP7]= '7',
+ [QZ_KP8]= '8',
+ [QZ_KP9]= '9',
};
@interface apptext : NSTextView @end
@@ -1138,30 +1165,25 @@ sendmouse(void)
void
setmouse(Point p)
{
- static int first = 1;
NSPoint q;
NSRect r;
if([NSApp isActive]==0 && in.willactivate==0)
return;
- if(first){
- /* Try to move Acme's scrollbars without that! */
- CGSetLocalEventsSuppressionInterval(0);
- first = 0;
- }
if([WIN inLiveResize])
return;
in.mpos = scalepoint(NSMakePoint(p.x, p.y), win.topointscale); // race condition
q = [win.content convertPoint:in.mpos toView:nil];
- q = [WIN convertBaseToScreen:q];
+ q = [WIN convertRectToScreen:NSMakeRect(q.x, q.y, 0, 0)].origin;
r = [[[NSScreen screens] objectAtIndex:0] frame];
q.y = r.size.height - q.y; /* Quartz is top-left-based here */
CGWarpMouseCursorPosition(NSPointToCGPoint(q));
+ CGAssociateMouseAndMouseCursorPosition(true);
}
/*
@@ -1431,14 +1453,14 @@ makecursor(Cursor *c)
samplesPerPixel:2
hasAlpha:YES
isPlanar:YES
- colorSpaceName:NSDeviceBlackColorSpace
+ colorSpaceName:NSDeviceWhiteColorSpace
bytesPerRow:2
bitsPerPixel:1];
[r getBitmapDataPlanes:plane];
for(b=0; b<2*16; b++){
- plane[0][b] = c->set[b];
+ plane[0][b] = ~c->set[b];
plane[1][b] = c->clr[b];
}
p = NSMakePoint(-c->offset.x, -c->offset.y);
diff --git a/src/cmd/devdraw/devdraw.c b/src/cmd/devdraw/devdraw.c
index 2e3fd7a0..7f0bff21 100644
--- a/src/cmd/devdraw/devdraw.c
+++ b/src/cmd/devdraw/devdraw.c
@@ -727,10 +727,10 @@ drawcoord(uchar *p, uchar *maxp, int oldx, int *newx)
x |= *p++ << 7;
x |= *p++ << 15;
if(x & (1<<22))
- x |= ~0<<23;
+ x |= ~0U<<23;
}else{
if(b & 0x40)
- x |= ~0<<7;
+ x |= ~0U<<7;
x += oldx;
}
*newx = x;
diff --git a/src/cmd/devdraw/macargv.m b/src/cmd/devdraw/macargv.m
index ec5bf49f..8db56be7 100644
--- a/src/cmd/devdraw/macargv.m
+++ b/src/cmd/devdraw/macargv.m
@@ -7,7 +7,7 @@
AUTOFRAMEWORK(Foundation)
AUTOFRAMEWORK(Cocoa)
-@interface appdelegate : NSObject @end
+@interface appdelegate : NSObject<NSApplicationDelegate> @end
void
main(void)
@@ -16,7 +16,7 @@ main(void)
[NSAutoreleasePool new];
[NSApplication sharedApplication];
- NSObject *delegate = [appdelegate new];
+ NSObject<NSApplicationDelegate> *delegate = [appdelegate new];
[NSApp setDelegate:delegate];
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; /* Register a call-back for URL Events */