summaryrefslogtreecommitdiff
path: root/include/yasl/native/cocoa.h
blob: 2d2d4323eabc9c6196c7a8c4972a1cc2cbf37c94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/** @file Borrowed cocoa handles for an initialized, connected surface. */
#ifndef YASL_NATIVE_COCOA_H
#define YASL_NATIVE_COCOA_H
#include "yasl/yasl.h"
#ifdef __OBJC__
@class NSApplication;
@class NSWindow;
@class NSView;
#else
typedef struct objc_object NSApplication;
typedef struct objc_object NSWindow;
typedef struct objc_object NSView;
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct yasl_cocoa_handles {
    NSApplication *application;
    NSWindow *window;
    NSView *view;
};
/** Owner thread only. Returns -ENOTSUP for another backend and -ENOTCONN
 * while disconnected. Clears out on failure. Handles expire on display loss
 * or surface destruction; query again after DISPLAY_RESTORED. Never destroy
 * borrowed objects or dispatch/close the connection independently. */
YASL_API int yasl_cocoa_get_native(const yasl_surface *surface, struct yasl_cocoa_handles *out);
#ifdef __cplusplus
}
#endif
#endif