aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ui/console.h12
-rw-r--r--ui/cocoa.m14
-rw-r--r--vl.c3
3 files changed, 13 insertions, 16 deletions
diff --git a/include/ui/console.h b/include/ui/console.h
index cb86e6a0dd..f8c462106a 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -444,18 +444,6 @@ void qemu_display_register(QemuDisplay *ui);
void qemu_display_early_init(DisplayOptions *opts);
void qemu_display_init(DisplayState *ds, DisplayOptions *opts);
-/* cocoa.m */
-#ifdef CONFIG_COCOA
-void cocoa_display_init(DisplayState *ds, DisplayOptions *opts);
-#else
-static inline void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
-{
- /* This must never be called if CONFIG_COCOA is disabled */
- error_report("Cocoa support is disabled");
- abort();
-}
-#endif
-
/* vnc.c */
void vnc_display_init(const char *id);
void vnc_display_open(const char *id, Error **errp);
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 90d9aa57ea..8b0dce90cb 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1683,7 +1683,7 @@ static void addRemovableDevicesMenuItems(void)
qapi_free_BlockInfoList(pointerToFree);
}
-void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
+static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
{
COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
@@ -1713,3 +1713,15 @@ void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
*/
addRemovableDevicesMenuItems();
}
+
+static QemuDisplay qemu_display_cocoa = {
+ .type = DISPLAY_TYPE_COCOA,
+ .init = cocoa_display_init,
+};
+
+static void register_cocoa(void)
+{
+ qemu_display_register(&qemu_display_cocoa);
+}
+
+type_init(register_cocoa);
diff --git a/vl.c b/vl.c
index 5b2410d564..377140ebd9 100644
--- a/vl.c
+++ b/vl.c
@@ -4667,9 +4667,6 @@ int main(int argc, char **argv, char **envp)
case DISPLAY_TYPE_CURSES:
curses_display_init(ds, &dpy);
break;
- case DISPLAY_TYPE_COCOA:
- cocoa_display_init(ds, &dpy);
- break;
default:
qemu_display_init(ds, &dpy);
break;