remove no longer needed code
This commit is contained in:
parent
d457abdee4
commit
ba40bf5e6f
@ -20,13 +20,6 @@
|
|||||||
#define NSEventModifierFlagControl NSControlKeyMask
|
#define NSEventModifierFlagControl NSControlKeyMask
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface MenuDispatcher : NSObject
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MenuDispatcher
|
|
||||||
@end
|
|
||||||
|
|
||||||
static NSObject* menu_dispatcher = NULL;
|
|
||||||
static NSMenuItem* title_menu = NULL;
|
static NSMenuItem* title_menu = NULL;
|
||||||
|
|
||||||
static NSString*
|
static NSString*
|
||||||
@ -62,21 +55,9 @@ find_app_name(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PyObject*
|
void
|
||||||
cocoa_init(PyObject UNUSED *_self) {
|
cocoa_create_global_menu(void) {
|
||||||
// Press and Hold prevents some keys from emitting repeated characters
|
|
||||||
// See https://github.com/glfw/glfw/issues/1010
|
|
||||||
NSDictionary* defaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", nil];
|
|
||||||
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PyObject*
|
|
||||||
cocoa_create_global_menu(PyObject UNUSED *_self) {
|
|
||||||
if (menu_dispatcher != NULL) { Py_RETURN_NONE; }
|
|
||||||
NSString* app_name = find_app_name();
|
NSString* app_name = find_app_name();
|
||||||
menu_dispatcher = [[MenuDispatcher alloc] init];
|
|
||||||
NSMenu* bar = [[NSMenu alloc] init];
|
NSMenu* bar = [[NSMenu alloc] init];
|
||||||
[NSApp setMainMenu:bar];
|
[NSApp setMainMenu:bar];
|
||||||
|
|
||||||
@ -141,7 +122,6 @@ cocoa_create_global_menu(PyObject UNUSED *_self) {
|
|||||||
|
|
||||||
|
|
||||||
[bar release];
|
[bar release];
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -188,9 +168,7 @@ cocoa_get_lang(PyObject UNUSED *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef module_methods[] = {
|
static PyMethodDef module_methods[] = {
|
||||||
{"cocoa_get_lang", (PyCFunction)cocoa_get_lang, METH_NOARGS, ""}, \
|
{"cocoa_get_lang", (PyCFunction)cocoa_get_lang, METH_NOARGS, ""},
|
||||||
{"cocoa_create_global_menu", (PyCFunction)cocoa_create_global_menu, METH_NOARGS, ""}, \
|
|
||||||
{"cocoa_init", (PyCFunction)cocoa_init, METH_NOARGS, ""}, \
|
|
||||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include <structmember.h>
|
#include <structmember.h>
|
||||||
#include "glfw-wrapper.h"
|
#include "glfw-wrapper.h"
|
||||||
extern bool cocoa_make_window_resizable(void *w);
|
extern bool cocoa_make_window_resizable(void *w);
|
||||||
|
extern void cocoa_create_global_menu(void);
|
||||||
|
|
||||||
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
||||||
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
||||||
@ -243,6 +244,9 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
|||||||
PyObject *ret = PyObject_CallFunction(load_programs, NULL);
|
PyObject *ret = PyObject_CallFunction(load_programs, NULL);
|
||||||
if (ret == NULL) return NULL;
|
if (ret == NULL) return NULL;
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
|
#ifdef __APPLE__
|
||||||
|
cocoa_create_global_menu();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
OSWindow *w = add_os_window();
|
OSWindow *w = add_os_window();
|
||||||
|
|||||||
@ -38,11 +38,7 @@ def run_app(opts, args):
|
|||||||
w, h = initial_window_size(opts)
|
w, h = initial_window_size(opts)
|
||||||
window_id = create_os_window(w, h, args.cls, True, load_all_shaders)
|
window_id = create_os_window(w, h, args.cls, True, load_all_shaders)
|
||||||
startup_ctx = init_startup_notification(window_id)
|
startup_ctx = init_startup_notification(window_id)
|
||||||
if isosx:
|
if not iswayland and not isosx: # no window icons on wayland
|
||||||
from .fast_data_types import cocoa_create_global_menu, cocoa_init
|
|
||||||
cocoa_init()
|
|
||||||
cocoa_create_global_menu()
|
|
||||||
elif not iswayland: # no window icons on wayland
|
|
||||||
with open(logo_data_file, 'rb') as f:
|
with open(logo_data_file, 'rb') as f:
|
||||||
set_default_window_icon(f.read(), 256, 256)
|
set_default_window_icon(f.read(), 256, 256)
|
||||||
set_logical_dpi(*get_logical_dpi())
|
set_logical_dpi(*get_logical_dpi())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user