Add an option to hide the window title bar on macOS

Fixes #84
This commit is contained in:
Kovid Goyal
2017-06-03 09:57:29 +05:30
parent 96d2567815
commit 836724709e
5 changed files with 22 additions and 7 deletions

View File

@@ -15,9 +15,13 @@
PyObject*
cocoa_hide_titlebar(PyObject UNUSED *self, PyObject *window_id) {
NSView *native_view = (NSView*)PyLong_AsVoidPtr(window_id);
NSWindow* window = [native_view window];
[window setStyleMask:
[window styleMask] & ~NSWindowStyleMaskTitled];
NSWindow *window = (NSWindow*)PyLong_AsVoidPtr(window_id);
@try {
[window setStyleMask:
[window styleMask] & ~NSWindowStyleMaskTitled];
} @catch (NSException *e) {
return PyErr_Format(PyExc_ValueError, "Failed to set style mask: %s: %s", [[e name] UTF8String], [[e reason] UTF8String]);
}
Py_RETURN_NONE;
}