summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosep Torra <jtorra@oblong.com>2017-05-20 11:13:40 +0200
committerJosep Torra <jtorra@oblong.com>2017-05-20 11:37:27 +0200
commit7348ed5faa16b501fd5c6d5df03054e7417d940a (patch)
treefa4a0afd21e05c7e3f968439dcd932ed6b2b3812
parent4f713717de4f1900ec87b64a45ea348d96c52a54 (diff)
osxvideo: fix macOS 10.12 deprecation warnings
Add #defines to allow older versions of macOS to use the new constant names.
-rw-r--r--sys/osxvideo/cocoawindow.m18
-rw-r--r--sys/osxvideo/osxvideosink.m21
2 files changed, 28 insertions, 11 deletions
diff --git a/sys/osxvideo/cocoawindow.m b/sys/osxvideo/cocoawindow.m
index 71e1ca050..b833a8ac7 100644
--- a/sys/osxvideo/cocoawindow.m
+++ b/sys/osxvideo/cocoawindow.m
@@ -41,6 +41,14 @@
/* Debugging category */
#include <gst/gstinfo.h>
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
+#define NSEventTypeMouseMoved NSMouseMoved
+#define NSEventTypeLeftMouseDown NSLeftMouseDown
+#define NSEventTypeLeftMouseUp NSLeftMouseUp
+#define NSEventTypeRightMouseDown NSRightMouseDown
+#define NSEventTypeRightMouseUp NSRightMouseUp
+#endif
+
static
const gchar* gst_keycode_to_keyname(gint16 keycode)
{
@@ -736,15 +744,15 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
return;
switch ([event type]) {
- case NSMouseMoved:
+ case NSEventTypeMouseMoved:
button = 0;
break;
- case NSLeftMouseDown:
- case NSLeftMouseUp:
+ case NSEventTypeLeftMouseDown:
+ case NSEventTypeLeftMouseUp:
button = 1;
break;
- case NSRightMouseDown:
- case NSRightMouseUp:
+ case NSEventTypeRightMouseDown:
+ case NSEventTypeRightMouseUp:
button = 2;
break;
default:
diff --git a/sys/osxvideo/osxvideosink.m b/sys/osxvideo/osxvideosink.m
index 152c6e8e1..54725a2bc 100644
--- a/sys/osxvideo/osxvideosink.m
+++ b/sys/osxvideo/osxvideosink.m
@@ -82,6 +82,15 @@ static GCond _run_loop_cond;
static GstOSXVideoSinkClass *sink_class = NULL;
static GstVideoSinkClass *parent_class = NULL;
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
+#define NSEventMaskAny NSAnyEventMask
+#define NSWindowStyleMaskTitled NSTitledWindowMask
+#define NSWindowStyleMaskClosable NSClosableWindowMask
+#define NSWindowStyleMaskResizable NSResizableWindowMask
+#define NSWindowStyleMaskTexturedBackground NSTexturedBackgroundWindowMask
+#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
+#endif
+
/* Helper to trigger calls from the main thread */
static void
gst_osx_video_sink_call_from_main_thread(GstOSXVideoSink *osxvideosink,
@@ -114,7 +123,7 @@ run_ns_app_loop (void) {
pollTime = [NSDate distantFuture];
do {
- event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:pollTime
+ event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:pollTime
inMode:NSDefaultRunLoopMode dequeue:YES];
[NSApp sendEvent:event];
}
@@ -776,11 +785,11 @@ gst_osx_video_sink_get_type (void)
osxwindow->internal = TRUE;
- mask = NSTitledWindowMask |
- NSClosableWindowMask |
- NSResizableWindowMask |
- NSTexturedBackgroundWindowMask |
- NSMiniaturizableWindowMask;
+ mask = NSWindowStyleMaskTitled |
+ NSWindowStyleMaskClosable |
+ NSWindowStyleMaskResizable |
+ NSWindowStyleMaskTexturedBackground |
+ NSWindowStyleMaskMiniaturizable;
rect.origin.x = 100.0;
rect.origin.y = 100.0;