Fix mouse actions not working when caps lock or num lock are engaged

Fixes #3859
This commit is contained in:
Kovid Goyal
2021-07-24 07:06:46 +05:30
parent b9033d721c
commit e7bfb04047
3 changed files with 7 additions and 4 deletions

View File

@@ -60,6 +60,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Allow leading or trailing spaces in :opt:`tab_activity_symbol` - Allow leading or trailing spaces in :opt:`tab_activity_symbol`
- Fix mouse actions not working when caps lock or num lock are engaged
(:iss:`3859`)
- macOS: Fix automatic detection of bold/italic faces for fonts that - macOS: Fix automatic detection of bold/italic faces for fonts that
use the family name as the full face name of the regular font not working use the family name as the full face name of the regular font not working
(:iss:`3861`) (:iss:`3861`)

View File

@@ -6,15 +6,14 @@ from typing import Optional, Union
from .conf.utils import KeyAction from .conf.utils import KeyAction
from .fast_data_types import ( from .fast_data_types import (
GLFW_MOD_ALT, GLFW_MOD_CAPS_LOCK, GLFW_MOD_CONTROL, GLFW_MOD_HYPER, GLFW_MOD_ALT, GLFW_MOD_CONTROL, GLFW_MOD_HYPER, GLFW_MOD_META,
GLFW_MOD_META, GLFW_MOD_NUM_LOCK, GLFW_MOD_SHIFT, GLFW_MOD_SUPER, KeyEvent GLFW_MOD_SHIFT, GLFW_MOD_SUPER, KeyEvent
) )
from .options.utils import KeyMap, SequenceMap, SubSequenceMap from .options.utils import KeyMap, SequenceMap, SubSequenceMap
from .types import SingleKey from .types import SingleKey
from .typing import ScreenType from .typing import ScreenType
mod_mask = GLFW_MOD_ALT | GLFW_MOD_CONTROL | GLFW_MOD_SHIFT | GLFW_MOD_SUPER | GLFW_MOD_META | GLFW_MOD_HYPER mod_mask = GLFW_MOD_ALT | GLFW_MOD_CONTROL | GLFW_MOD_SHIFT | GLFW_MOD_SUPER | GLFW_MOD_META | GLFW_MOD_HYPER
lock_mask = GLFW_MOD_NUM_LOCK | GLFW_MOD_CAPS_LOCK
def keyboard_mode_name(screen: ScreenType) -> str: def keyboard_mode_name(screen: ScreenType) -> str:

View File

@@ -33,7 +33,7 @@ from .fast_data_types import (
set_titlebar_color, set_window_padding, set_window_render_data, set_titlebar_color, set_window_padding, set_window_render_data,
update_window_title, update_window_visibility, viewport_for_window update_window_title, update_window_visibility, viewport_for_window
) )
from .keys import keyboard_mode_name from .keys import keyboard_mode_name, mod_mask
from .notify import NotificationCommand, handle_notification_cmd from .notify import NotificationCommand, handle_notification_cmd
from .options.types import Options from .options.types import Options
from .rgb import to_color from .rgb import to_color
@@ -570,6 +570,7 @@ class Window:
get_boss().child_monitor.set_iutf8_winid(self.id, on) get_boss().child_monitor.set_iutf8_winid(self.id, on)
def on_mouse_event(self, event: Dict[str, Any]) -> bool: def on_mouse_event(self, event: Dict[str, Any]) -> bool:
event['mods'] = event.get('mods', 0) & mod_mask
ev = MouseEvent(**event) ev = MouseEvent(**event)
self.current_mouse_event_button = ev.button self.current_mouse_event_button = ev.button
action = get_options().mousemap.get(ev) action = get_options().mousemap.get(ev)