Commit graph

111 commits

Author SHA1 Message Date
Kovid Goyal
a2aa9b739d
Wayland CSD: Parse the titlebar font description once in glfw
Replace glfwGetSystemFont(), which returned a raw Pango font description
that was parsed separately in glfw and kitty, with glfwGetTitlebarFont()
that returns the parsed family, size and style. The parser now handles
font family lists, pixel sizes and the full set of Pango weight and style
names. A text scale less than one is now applied to the header height as
well. The FreeType context for the title font is released on exit and
failures to create it are not retried and reported on every redraw.
2026-10-30 09:03:46 +05:30
Manuel Villanueva
45282eef7d
Wayland: inherit GNOME titlebar preferences through the desktop portal 2026-10-29 15:35:48 -06:00
Manuel Villanueva
96976d85b6
Wayland: add opt-in built-in GNOME-style window decorations 2026-10-28 23:01:00 -06:00
rokokol
ee45ed2306 glfw: Report touch events
Add a touch callback that reports abstract touch events. The design
follows QTouchEvent and NSTouch. A sequence opens with GLFW_TOUCH_BEGIN,
goes on with GLFW_TOUCH_UPDATE and closes with GLFW_TOUCH_END or
GLFW_TOUCH_CANCEL. Each event carries every point that is down on the
window, with its id, its state and its position.

The Wayland backend binds wl_touch and collects the down, motion and up
events until the frame event. It then sends one event to each window
that has a changed point. A point belongs to the window it first
touched, because wl_touch gives its position relative to that surface.
A cancel from the compositor reaches only the windows that were told
that the sequence began. Touches on client-side decorations are not
reported.

glfw does not turn these events into mouse events. That is left to the
application.

Assisted-by: Claude Code:claude-opus-5-5 (mostly)
2026-09-26 15:05:51 +03:00
Kovid Goyal
36872d91bb
autoformat 2026-08-11 16:49:43 +05:30
Kovid Goyal
50c683e1a7
Merge PR #10307: Add remap_modifier option
Adds remap_modifier config option to present one modifier key to kitty
as another, as discussed in issue #1077. Resolves merge conflicts by
adopting master's formatting style (multi-line macros, pointer spacing)
while preserving all new PR functionality.

Co-Authored-By: Bjoern <bjohas@users.noreply.github.com>
2026-08-11 16:42:53 +05:30
bjohas
9d678fa9f2 Add remap_modifier to present one modifier key to kitty as another
remap_modifier <from> <to>

Repeatable and off by default. The declarations compose as a single
simultaneous permutation applied once per event, so

    remap_modifier ctrl super
    remap_modifier super ctrl

exchanges the two rather than collapsing to the identity. Only shift, alt,
ctrl, super, hyper and meta may be named; anything else is rejected with an
error. The last declaration for a given source wins.

The remap is applied to the modifier mask BEFORE the platform produces the
keysym and text - in glfw_xkb_update_modifiers() before xkb_state_update_mask()
on Linux, and in remap_cocoa_flags() before UCKeyTranslate() and
interpretKeyEvents: on macOS. Applying it to the finished event instead
desynchronises the modifiers from the text for any modifier that participates
in text production: shift on Linux, and Option on macOS, which produces text
natively unless macos_option_as_alt is set.

Because the GLFW modifiers are themselves derived from that state, this is
application wide: kitty's own shortcuts, kitty_mod and the bytes sent to the
child all see the remapped modifier, and every mapping in kitty.conf is written
in terms of the modifier a key becomes. X11 pointer events do not go through
xkb, so translateState() - which only ever sees button and DND events - gets
the same treatment; Wayland pointer events already carry xkb-derived modifiers.

A modifier key's own event has its identity remapped too, so a program using
the full keyboard protocol does not see ctrl reported together with LEFT_HYPER.
The press/release state fixup on Linux is given the remapped modifier rather
than the physical one, so press and release agree.

--debug-input reports each remapped event.

Notes: on Wayland kitty only detects hyper and meta when
KITTY_WAYLAND_DETECT_MODIFIERS is set, so remapping to or from them has nothing
to act on there. On macOS hyper and meta have no Cocoa modifier flag, so a
remap onto them is left unapplied rather than silently dropping the modifier,
and interpretKeyEvents: is only approximately corrected because the event's
characters strings were computed by the OS from the physical flags; the
UCKeyTranslate() path, normally the one taken, is exact.

Generated option files and the glfw wrapper come from their generators.
2026-08-06 16:22:37 +01:00
Kovid Goyal
4c6467814b
autoformat c/objc code, using clang-format 2026-08-05 19:10:55 +05:30
copilot-swe-agent[bot]
9ef08fd865
glfw/input.c: fix dedup to swap duplicates to end instead of overwriting pointers
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/071dfd57-73e7-4daa-8d35-955bec8b1c4b

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-19 02:12:29 +00:00
copilot-swe-agent[bot]
1aaae286a8
glfw/input.c: remove duplicate mimetypes in _glfwInputDropEvent using verstable
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/2d7a111f-7d98-4cb0-b085-823736cbf5db

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-19 02:00:12 +00:00
Kovid Goyal
a061e0782e
Fix is_remote_client not being passed along 2026-05-14 13:48:18 +05:30
Kovid Goyal
6d4371f596
Properly pass source actions to drop events
Implemented for Wayland. Needs implementation for X11 and macOS
2026-05-14 11:07:52 +05:30
Kovid Goyal
c909809bb4
More work on DnD kitten 2026-05-13 08:25:14 +05:30
Kovid Goyal
dc55052f0c
Wayland: set drop accepted operations 2026-04-07 10:40:14 +05:30
copilot-swe-agent[bot]
2f33460864
Add operations==-3 cancel drag support to glfwStartDrag
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/eff7e2c8-ab7a-4967-95b5-e65631245701

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-02 07:14:36 +00:00
copilot-swe-agent[bot]
efe319f755
Send synthetic left button release after drag ends to fix stale mouse state
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/e3cf07a9-b3c0-4786-b264-a83b85f098ac
2026-03-26 14:16:44 +00:00
copilot-swe-agent[bot]
6b86e7db5d Extend glfwGetKeyboardRepeatDelay() to return both initial delay and repeat interval
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/bde9bf2e-a0dd-4ccd-8385-6a37be1e025f
2026-03-23 11:58:48 +00:00
copilot-swe-agent[bot]
998ee22ecb Add glfwGetKeyboardRepeatDelay() to the GLFW API for X11, Wayland and Cocoa
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/4765810b-ecf5-4348-ae3a-ff0ff481aaae
2026-03-23 11:46:35 +00:00
copilot-swe-agent[bot]
4706243380
Fix GLFW drop API to always present full original MIME type list to callbacks
Fixes #9633
2026-03-10 20:10:44 +05:30
Kovid Goyal
9f2a4ad2dd
Wayland: Implement ridiculous workaround for broken dnd
Wayland is *the worst* window system I have ever had the
displeasure of trying to support.
2026-02-22 16:24:46 +05:30
Kovid Goyal
b737eaad65
Cleanup previous PR
Use a single wl_surface for the drag icon. Whther it is attached to the
top level drag or not is determined based on availability.
2026-02-22 15:36:10 +05:30
Kovid Goyal
531fb3e1b1
Change drag thumbnail when in detach/move modes 2026-02-22 13:09:56 +05:30
Kovid Goyal
6506ce1e91
API to change image for drag in progress 2026-02-22 09:10:26 +05:30
Kovid Goyal
a2b7a0cd6d
Port Cocoa drag source backend to new API 2026-02-18 11:20:17 +05:30
Kovid Goyal
e5eb63fcd0
Refactor drag source API to be async
Wayland implementation done. Other two backends remain.
2026-02-17 13:07:55 +05:30
Kovid Goyal
5db41c7ba4
Remove remaining code for the old drop API
X11 and cocoa need to be ported to the new API
2026-02-08 22:05:14 +05:30
Kovid Goyal
3cf24afdc0
Refactor drop API and implement it on Wayland 2026-02-08 22:05:14 +05:30
copilot-swe-agent[bot]
7ca6fd66f8
Fix self drag not working under Wayland
Fixes #9483
2026-02-07 15:10:54 +05:30
copilot-swe-agent[bot]
5ea35cbbfc
Refactor drag API to make it asynchronous
Fixes #9477
2026-02-07 08:59:34 +05:30
Kovid Goyal
9a2ddc887b
Cleanup new chunked drop code and use it in kitty
Currently the chunking is useful but it will become useful for a future
drag and drop TUI protocol
2026-02-04 20:34:10 +05:30
copilot-swe-agent[bot]
ed5eb8f45c
Allow reading dropped data in chunks
Fixes #9470
2026-02-04 14:18:28 +05:30
copilot-swe-agent[bot]
fac4420804
Simplify new drag/drop API
Fixes #9466
2026-02-03 22:02:51 +05:30
copilot-swe-agent[bot]
9b35c1b535
Allow changing drag acceptance asynchronously
Fixes #9465
2026-02-03 14:43:44 +05:30
copilot-swe-agent[bot]
6744183027
Accept drags based on mime types in drag event callback
Fixes #9456
2026-02-02 21:30:25 +05:30
copilot-swe-agent[bot]
fa6c76d3e3
Add a GLFW API to support starting drag operations
Fixes #9454
Fixes #9455
2026-02-02 20:49:00 +05:30
Kovid Goyal
ba3af8f2c3
Refactor GLFW scroll event callback to use a proper event struct 2025-12-31 23:40:34 +05:30
Kovid Goyal
6f689f3221
Work on keyboard grabbing functionality 2025-05-18 11:37:11 +05:30
Kovid Goyal
b34a88065b
Wire up clipboard lost events 2025-03-12 09:26:36 +05:30
Kovid Goyal
27df509206
Nicer fix for enter event mouse tracking
Send an explicit mouse event to child when pointer enters window instead
of relying on GLFW to send a cursor position update event.
2025-03-04 11:29:29 +05:30
Kovid Goyal
ac6c652a4d
Fix #8398 2025-03-04 09:49:34 +05:30
Kovid Goyal
754288557d
Track initial color scheme preference read on Linux 2024-11-07 10:38:13 +05:30
Kovid Goyal
1bffe89b5d
Wayland GNOME: titlebar color now follows system theme
When GNOME system theme is default, the color matches the background
color. When it is dark it is dark.
2024-04-04 21:52:56 +05:30
Kovid Goyal
45b408a78b
Allow setting arbitrary mime types 2022-09-09 11:14:12 +05:30
Kovid Goyal
d17a6cd3a3
Get reading from clipboard working 2022-09-08 12:45:34 +05:30
Kovid Goyal
7e1380cc0d
Start work on giving GLFW a proper clipboard API 2022-09-08 12:45:34 +05:30
Kovid Goyal
d04d4444af
implement primary selection api on cocoa as stubs, can be useful for #5357 2022-08-06 12:59:15 +05:30
Kovid Goyal
ca4840717b
macOS: Fix using shortcuts from the global menu bar as subsequent key presses in a multi key mapping not working
Fixes #4519
2022-01-15 13:56:18 +05:30
Kovid Goyal
bd288bd18f
Linux: Fix release event for the final key in a compose sequence not being reported. Fixes #4285 2021-11-29 19:26:16 +05:30
Kovid Goyal
c989a7198b
Add support for the keypad Begin key
Fixes #3468
2021-04-11 07:58:27 +05:30
Ravi R Kiran
953253de99 Implementation of hyper and meta 2021-03-30 14:23:17 -05:00