[WIP] Respect the default system click_interval

This commit is contained in:
Luflosi 2018-10-24 10:44:24 +02:00
parent 70c9c058e2
commit 382367506a
No known key found for this signature in database
GPG Key ID: 14140F703B7D8362
2 changed files with 16 additions and 1 deletions

View File

@ -267,6 +267,12 @@ cocoa_get_lang(PyObject UNUSED *self) {
return Py_BuildValue("s", [locale UTF8String]); return Py_BuildValue("s", [locale UTF8String]);
} }
static PyObject*
cocoa_get_double_click_interval(PyObject UNUSED *self) {
double interval = [NSEvent doubleClickInterval];
return Py_BuildValue("f", interval);
}
void void
cocoa_set_hide_from_tasks(void) { cocoa_set_hide_from_tasks(void) {
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory]; [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
@ -300,6 +306,7 @@ cocoa_set_titlebar_color(void *w, color_type titlebar_color)
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_get_double_click_interval", (PyCFunction)cocoa_get_double_click_interval, METH_NOARGS, ""},
{"cocoa_set_new_window_trigger", (PyCFunction)cocoa_set_new_window_trigger, METH_VARARGS, ""}, {"cocoa_set_new_window_trigger", (PyCFunction)cocoa_set_new_window_trigger, METH_VARARGS, ""},
{NULL, NULL, 0, NULL} /* Sentinel */ {NULL, NULL, 0, NULL} /* Sentinel */
}; };

View File

@ -399,7 +399,15 @@ Characters considered part of a word when double clicking. In addition to these
any character that is marked as an alpha-numeric character in the unicode any character that is marked as an alpha-numeric character in the unicode
database will be matched.''')) database will be matched.'''))
o('click_interval', 0.5, option_type=positive_float, long_text=_('''
def click_interval(x):
if x == 'system':
from .fast_data_types import cocoa_get_double_click_interval
return cocoa_get_double_click_interval()
return positive_float(x)
o('click_interval', 'system', option_type=click_interval, long_text=_('''
The interval between successive clicks to detect The interval between successive clicks to detect
double/triple clicks (in seconds)''')) double/triple clicks (in seconds)'''))