Tk Source Code

View Ticket
Login
Ticket UUID: 9ce8a6125edfa93e5bb1f161c148a1c8c0495df7
Title: Wayland branch: interned atoms get the numbers of predefined atoms, CLIPBOARD is the same as PRIMARY
Type: Bug Version: wayland
Submitter: serhiy.storchaka Created on: 2026-10-14 19:42:44
Subsystem: (unused) Assigned To: aku
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-10-22 17:22:38
Resolution: Fixed Closed By: serhiy.storchaka
    Closed on: 2026-10-14 19:55:37
Description:

On the wayland branch ([b5ff45d7dc]), the emulated XInternAtom() in wayland/tkWaylandXlib.c returns a counter starting at 1. But Tk reserves 1 to XA_LAST_PREDEFINED for the predefined atoms (tkAtom.c), so the first atoms interned by Tk get their numbers:

% winfo atom PRIMARY
1
% winfo atom CLIPBOARD
1
% winfo atomname 1
CLIPBOARD

The PRIMARY and CLIPBOARD selections are mixed up: errors talk about the "MULTIPLE" selection instead of PRIMARY, and select-5.x, entry-3.50, entry-5.6, spinbox-3.50, spinbox-5.6, listbox-4.5, text-14.16, winfo-2.6 and winfo-2.7 fail.

Proposed fix in branch wayland-atom-numbers, [901935aed7]: the counter starts after XA_LAST_PREDEFINED, as in xlib/xutil.c (Windows, macOS). These 13 tests then pass under headless sway.

User Comments: serhiy.storchaka added on 2026-10-14 19:55:37:

Thanks. Merged into wayland in [ebec425140].


kevin_walzer added on 2026-10-14 19:51:24:
Confirming that the spinbox and listbox tests in question now pass. Please commit. Thank you.