remove no longer needed code
This commit is contained in:
parent
d457abdee4
commit
ba40bf5e6f
@ -20,13 +20,6 @@
|
||||
#define NSEventModifierFlagControl NSControlKeyMask
|
||||
#endif
|
||||
|
||||
@interface MenuDispatcher : NSObject
|
||||
@end
|
||||
|
||||
@implementation MenuDispatcher
|
||||
@end
|
||||
|
||||
static NSObject* menu_dispatcher = NULL;
|
||||
static NSMenuItem* title_menu = NULL;
|
||||
|
||||
static NSString*
|
||||
@ -62,21 +55,9 @@ find_app_name(void) {
|
||||
}
|
||||
|
||||
|
||||
PyObject*
|
||||
cocoa_init(PyObject UNUSED *_self) {
|
||||
// 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; }
|
||||
void
|
||||
cocoa_create_global_menu(void) {
|
||||
NSString* app_name = find_app_name();
|
||||
menu_dispatcher = [[MenuDispatcher alloc] init];
|
||||
NSMenu* bar = [[NSMenu alloc] init];
|
||||
[NSApp setMainMenu:bar];
|
||||
|
||||
@ -141,7 +122,6 @@ cocoa_create_global_menu(PyObject UNUSED *_self) {
|
||||
|
||||
|
||||
[bar release];
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -188,9 +168,7 @@ cocoa_get_lang(PyObject UNUSED *self) {
|
||||
}
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"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, ""}, \
|
||||
{"cocoa_get_lang", (PyCFunction)cocoa_get_lang, METH_NOARGS, ""},
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include <structmember.h>
|
||||
#include "glfw-wrapper.h"
|
||||
extern bool cocoa_make_window_resizable(void *w);
|
||||
extern void cocoa_create_global_menu(void);
|
||||
|
||||
#if GLFW_KEY_LAST >= 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);
|
||||
if (ret == NULL) return NULL;
|
||||
Py_DECREF(ret);
|
||||
#ifdef __APPLE__
|
||||
cocoa_create_global_menu();
|
||||
#endif
|
||||
}
|
||||
|
||||
OSWindow *w = add_os_window();
|
||||
|
||||
@ -38,11 +38,7 @@ def run_app(opts, args):
|
||||
w, h = initial_window_size(opts)
|
||||
window_id = create_os_window(w, h, args.cls, True, load_all_shaders)
|
||||
startup_ctx = init_startup_notification(window_id)
|
||||
if isosx:
|
||||
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
|
||||
if not iswayland and not isosx: # no window icons on wayland
|
||||
with open(logo_data_file, 'rb') as f:
|
||||
set_default_window_icon(f.read(), 256, 256)
|
||||
set_logical_dpi(*get_logical_dpi())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user