Merge branch 'system_double_click_interval' of https://github.com/Luflosi/kitty
This commit is contained in:
commit
3ed9d9a069
@ -38,6 +38,8 @@ Changelog
|
|||||||
- macOS: Fix incorrect text sizes calculated when using an external display
|
- macOS: Fix incorrect text sizes calculated when using an external display
|
||||||
that is set to mirror the main display (:iss:`1056`)
|
that is set to mirror the main display (:iss:`1056`)
|
||||||
|
|
||||||
|
- macOS: Use the system default double click interval (:pull:`1090`)
|
||||||
|
|
||||||
- Linux: Fix match rules used as aliases in Fontconfig configuration not being
|
- Linux: Fix match rules used as aliases in Fontconfig configuration not being
|
||||||
respected (:iss:`1085`)
|
respected (:iss:`1085`)
|
||||||
|
|
||||||
|
|||||||
@ -1583,6 +1583,11 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||||||
*yscale = (float) (pixels.size.height / points.size.height);
|
*yscale = (float) (pixels.size.height / points.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
return [NSEvent doubleClickInterval];
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
[window->ns.object miniaturize:nil];
|
[window->ns.object miniaturize:nil];
|
||||||
|
|||||||
26
glfw/glfw3.h
vendored
26
glfw/glfw3.h
vendored
@ -2930,6 +2930,32 @@ GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
|
GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
|
||||||
|
|
||||||
|
/*! @brief Returns the double click time interval.
|
||||||
|
*
|
||||||
|
* This function returns the maximum time between clicks to count as a
|
||||||
|
* double click.
|
||||||
|
*
|
||||||
|
* The double click interval is a positive finite number greater than zero,
|
||||||
|
* where zero means that no click is ever recognized as a double click. If the
|
||||||
|
* system does not support a double click interval, this function always returns one half.
|
||||||
|
*
|
||||||
|
* @return The double click interval.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_ERROR.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref double_click
|
||||||
|
* @sa @ref click_interval
|
||||||
|
* @sa @ref double_click_interval
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup window
|
||||||
|
*/
|
||||||
|
GLFWAPI double glfwGetDoubleClickInterval(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Returns the opacity of the whole window.
|
/*! @brief Returns the opacity of the whole window.
|
||||||
*
|
*
|
||||||
* This function returns the opacity of the window, including any decorations.
|
* This function returns the opacity of the window, including any decorations.
|
||||||
|
|||||||
1
glfw/internal.h
vendored
1
glfw/internal.h
vendored
@ -653,6 +653,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
|||||||
int* right, int* bottom);
|
int* right, int* bottom);
|
||||||
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
||||||
float* xscale, float* yscale);
|
float* xscale, float* yscale);
|
||||||
|
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window);
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window);
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window);
|
||||||
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
|
||||||
void _glfwPlatformMaximizeWindow(_GLFWwindow* window);
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window);
|
||||||
|
|||||||
5
glfw/null_window.c
vendored
5
glfw/null_window.c
vendored
@ -148,6 +148,11 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||||||
*yscale = 1.f;
|
*yscale = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
5
glfw/win32_window.c
vendored
5
glfw/win32_window.c
vendored
@ -1602,6 +1602,11 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||||||
_glfwGetMonitorContentScaleWin32(handle, xscale, yscale);
|
_glfwGetMonitorContentScaleWin32(handle, xscale, yscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
ShowWindow(window->win32.handle, SW_MINIMIZE);
|
ShowWindow(window->win32.handle, SW_MINIMIZE);
|
||||||
|
|||||||
9
glfw/window.c
vendored
9
glfw/window.c
vendored
@ -721,6 +721,15 @@ GLFWAPI void glfwGetWindowContentScale(GLFWwindow* handle,
|
|||||||
_glfwPlatformGetWindowContentScale(window, xscale, yscale);
|
_glfwPlatformGetWindowContentScale(window, xscale, yscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI double glfwGetDoubleClickInterval(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(0.5f);
|
||||||
|
return _glfwPlatformGetDoubleClickInterval(window);
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle)
|
GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|||||||
5
glfw/wl_window.c
vendored
5
glfw/wl_window.c
vendored
@ -1091,6 +1091,11 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||||||
*yscale = (float) window->wl.scale;
|
*yscale = (float) window->wl.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (_glfw.wl.wmBase)
|
if (_glfw.wl.wmBase)
|
||||||
|
|||||||
5
glfw/x11_window.c
vendored
5
glfw/x11_window.c
vendored
@ -2108,6 +2108,11 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||||||
*yscale = _glfw.x11.contentScaleY;
|
*yscale = _glfw.x11.contentScaleY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double _glfwPlatformGetDoubleClickInterval(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->x11.overrideRedirect)
|
if (window->x11.overrideRedirect)
|
||||||
|
|||||||
@ -399,9 +399,9 @@ 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=_('''
|
o('click_interval', -1.0, option_type=float, 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)'''))
|
Negative numbers will use the system default instead, if available, or fallback to 0.5.'''))
|
||||||
|
|
||||||
o('mouse_hide_wait', 3.0, option_type=positive_float, long_text=_('''
|
o('mouse_hide_wait', 3.0, option_type=positive_float, long_text=_('''
|
||||||
Hide mouse cursor after the specified number of seconds
|
Hide mouse cursor after the specified number of seconds
|
||||||
|
|||||||
3
kitty/glfw-wrapper.c
generated
3
kitty/glfw-wrapper.c
generated
@ -131,6 +131,9 @@ load_glfw(const char* path) {
|
|||||||
*(void **) (&glfwGetWindowContentScale_impl) = dlsym(handle, "glfwGetWindowContentScale");
|
*(void **) (&glfwGetWindowContentScale_impl) = dlsym(handle, "glfwGetWindowContentScale");
|
||||||
if (glfwGetWindowContentScale_impl == NULL) fail("Failed to load glfw function glfwGetWindowContentScale with error: %s", dlerror());
|
if (glfwGetWindowContentScale_impl == NULL) fail("Failed to load glfw function glfwGetWindowContentScale with error: %s", dlerror());
|
||||||
|
|
||||||
|
*(void **) (&glfwGetDoubleClickInterval_impl) = dlsym(handle, "glfwGetDoubleClickInterval");
|
||||||
|
if (glfwGetDoubleClickInterval_impl == NULL) fail("Failed to load glfw function glfwGetDoubleClickInterval with error: %s", dlerror());
|
||||||
|
|
||||||
*(void **) (&glfwGetWindowOpacity_impl) = dlsym(handle, "glfwGetWindowOpacity");
|
*(void **) (&glfwGetWindowOpacity_impl) = dlsym(handle, "glfwGetWindowOpacity");
|
||||||
if (glfwGetWindowOpacity_impl == NULL) fail("Failed to load glfw function glfwGetWindowOpacity with error: %s", dlerror());
|
if (glfwGetWindowOpacity_impl == NULL) fail("Failed to load glfw function glfwGetWindowOpacity with error: %s", dlerror());
|
||||||
|
|
||||||
|
|||||||
4
kitty/glfw-wrapper.h
generated
4
kitty/glfw-wrapper.h
generated
@ -1544,6 +1544,10 @@ typedef void (*glfwGetWindowContentScale_func)(GLFWwindow*, float*, float*);
|
|||||||
glfwGetWindowContentScale_func glfwGetWindowContentScale_impl;
|
glfwGetWindowContentScale_func glfwGetWindowContentScale_impl;
|
||||||
#define glfwGetWindowContentScale glfwGetWindowContentScale_impl
|
#define glfwGetWindowContentScale glfwGetWindowContentScale_impl
|
||||||
|
|
||||||
|
typedef double (*glfwGetDoubleClickInterval_func)(GLFWwindow*);
|
||||||
|
glfwGetDoubleClickInterval_func glfwGetDoubleClickInterval_impl;
|
||||||
|
#define glfwGetDoubleClickInterval glfwGetDoubleClickInterval_impl
|
||||||
|
|
||||||
typedef float (*glfwGetWindowOpacity_func)(GLFWwindow*);
|
typedef float (*glfwGetWindowOpacity_func)(GLFWwindow*);
|
||||||
glfwGetWindowOpacity_func glfwGetWindowOpacity_impl;
|
glfwGetWindowOpacity_func glfwGetWindowOpacity_impl;
|
||||||
#define glfwGetWindowOpacity glfwGetWindowOpacity_impl
|
#define glfwGetWindowOpacity glfwGetWindowOpacity_impl
|
||||||
|
|||||||
@ -545,6 +545,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
|||||||
}}
|
}}
|
||||||
CC(standard, IBEAM); CC(click, HAND); CC(arrow, ARROW);
|
CC(standard, IBEAM); CC(click, HAND); CC(arrow, ARROW);
|
||||||
#undef CC
|
#undef CC
|
||||||
|
if (OPT(click_interval) < 0) OPT(click_interval) = glfwGetDoubleClickInterval(glfw_window);
|
||||||
is_first_window = false;
|
is_first_window = false;
|
||||||
}
|
}
|
||||||
OSWindow *w = add_os_window();
|
OSWindow *w = add_os_window();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user