mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Disable cocoa's window tabbing and special menu items
This commit is contained in:
parent
08081eaebb
commit
39d08d70fa
@ -872,6 +872,8 @@ class Application(QApplication):
|
||||
QApplication.setDesktopFileName(override_program_name)
|
||||
QApplication.setAttribute(Qt.AA_ShareOpenGLContexts, True) # needed for webengine
|
||||
QApplication.__init__(self, qargs)
|
||||
if isosx:
|
||||
plugins['cocoa'][0].disable_cocoa_ui_elements()
|
||||
self.setAttribute(Qt.AA_UseHighDpiPixmaps)
|
||||
self.setAttribute(Qt.AA_SynthesizeTouchForUnhandledMouseEvents, False)
|
||||
try:
|
||||
|
@ -5,10 +5,29 @@
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <AppKit/NSWindow.h>
|
||||
#import <Availability.h>
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <string.h>
|
||||
|
||||
void
|
||||
disable_window_tabbing(void) {
|
||||
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
|
||||
NSWindow.allowsAutomaticWindowTabbing = NO;
|
||||
}
|
||||
|
||||
void
|
||||
remove_cocoa_menu_items(void) {
|
||||
// Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu
|
||||
// items from the "Edit" menu
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"];
|
||||
|
||||
// Remove (don't have) the "Enter Full Screen" menu item from the "View" menu
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
|
||||
}
|
||||
|
||||
void
|
||||
activate_cocoa_multithreading(void) {
|
||||
if (![NSThread isMultiThreaded]) [[NSThread new] start];
|
||||
|
@ -11,6 +11,8 @@ extern double cocoa_cursor_blink_time(void);
|
||||
extern void cocoa_send_notification(const char *identitifer, const char *title, const char *subtitle, const char *informativeText, const char* path_to_image);
|
||||
extern const char* cocoa_send2trash(const char *utf8_path);
|
||||
extern void activate_cocoa_multithreading(void);
|
||||
extern void disable_window_tabbing(void);
|
||||
extern void remove_cocoa_menu_items(void);
|
||||
|
||||
static PyObject *notification_activated_callback = NULL;
|
||||
|
||||
@ -70,11 +72,23 @@ enable_cocoa_multithreading(PyObject *self, PyObject *args) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
disable_cocoa_ui_elements(PyObject *self, PyObject *args) {
|
||||
PyObject *tabbing = Py_True, *menu_items = Py_True;
|
||||
if (!PyArg_ParseTuple(args, "|OO", &tabbing, &menu_items)) return NULL;
|
||||
if (PyObject_IsTrue(tabbing)) disable_window_tabbing();
|
||||
if (PyObject_IsTrue(menu_items) remove_cocoa_menu_items();
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"cursor_blink_time", (PyCFunction)cursor_blink_time, METH_NOARGS, ""},
|
||||
{"enable_cocoa_multithreading", (PyCFunction)enable_cocoa_multithreading, METH_NOARGS, ""},
|
||||
{"set_notification_activated_callback", (PyCFunction)set_notification_activated_callback, METH_O, ""},
|
||||
{"send_notification", (PyCFunction)send_notification, METH_VARARGS, ""},
|
||||
{"disable_cocoa_ui_elements", (PyCFunction)disable_cocoa_ui_elements, METH_VARARGS, ""},
|
||||
{"send2trash", (PyCFunction)send2trash, METH_VARARGS, ""},
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user