Tk Source Code

Timeline
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

50 most recent check-ins

2026-10-15
10:04
Better: make use of memcpy() Leaf check-in: 3939c8d2f3 user: jan.nijtmans tags: bug-b2de5886c6
10:01
Wayland: every WaylandFont, in every NanoVG context (one per toplevel), loaded all the files of its fallback stack into NanoVG under its own names, and NanoVG never frees fonts, so every new font size cost tens of megabytes. Read each font file once per process and give NanoVG that data, and name the NanoVG fonts after their data, so that fonts with the same faces share them. Also load the right face of a font collection. Leaf check-in: b3d2a5eb77 user: serhiy.storchaka tags: wayland-shared-font-data
10:01
Wayland: with TK_WHOLE_WORDS, Tk_MeasureCharsInContext() broke a line after a space or tab, including its width, so the white space at the end of a wrapped line was counted. Follow X11: a word ends before the first white space after a non-space, any white space counts, and TK_PARTIAL_OK is checked first. Leaf check-in: 03534cee01 user: serhiy.storchaka tags: wayland-word-break
10:01
Wayland: symbols with the Emoji property but text presentation (such as U+2603) were shaped with the emoji face even if it did not have them, and then got the missing glyph of the primary face. Use the emoji face only if it has the characters, otherwise a face which has them. Leaf check-in: 74d3a670e5 user: serhiy.storchaka tags: wayland-text-symbol-face
10:01
Wayland: the shaper skipped the replacement character U+FFFD together with the control characters, so it was not displayed and had no width, and the byte offsets of the following characters were shifted. Shape it as any other character. Leaf check-in: f08646ccc2 user: serhiy.storchaka tags: wayland-shape-replacement-char
10:01
Wayland: make toplevels at least 180 pixels wide only if the compositor does not offer server-side decorations (zxdg_decoration_manager_v1). The minimum is needed with decorations drawn by the client (libdecor with GNOME Shell), but with sway or KWin it made narrower windows impossible. Leaf check-in: 9834a8e827 user: serhiy.storchaka tags: wayland-min-width-csd-only
10:00
Wayland: the default -spacing2 of text widgets was 3 (changed in 54e1f847f5 together with the DPI detection) instead of 0 as on all other platforms, so wrapped lines had 3 extra pixels between their display lines. Restore 0. Leaf check-in: 39c52e0db6 user: serhiy.storchaka tags: wayland-text-spacing2
09:55
Fix [b2de5886c6]: Remove misleading comment. Initialize most of ColorTable in one go check-in: 47acbe2ae9 user: jan.nijtmans tags: bug-b2de5886c6
09:08
Wayland: the message queues of send were never removed. TkpCloseDisplay() did not call TkSendCleanup(), as on X11, so every process left its queue, and after nine of them no Tk process of the user could create its queue (RLIMIT_MSGQUEUE) and send did not work. Call it, and make TkSendCleanup() remove the queue only if it was created, and only once (it closed descriptor 0 otherwise). Also remove the queues of processes which no longer run (killed or crashed) when initializing send, and do not print "mq_unlink: No such file or directory" when a reply queue which was not created is removed after a failed send. Leaf check-in: 32dfb30384 user: serhiy.storchaka tags: wayland-send-queue-cleanup
08:59
Missing test constraint testxfocus Leaf check-in: 3535a651c0 user: jan.nijtmans tags: trunk, main
08:50
Wayland: implement the wm subcommands which were stubs, following X11. wm client, colormapwindows, command, focusmodel (passive by default), group, iconbitmap, iconmask, iconname, iconposition and iconwindow store and return their values; wm frame returns the window id; wm iconphoto checks the images and wm iconbadge calls ::tk::icons::IconBadge. wm transient records the container, and the transient follows its state (unless withdrawn explicitly) and is not mapped for the first time while the container is not. raise and lower of a toplevel record the stacking order, which wm stackorder reports, since the compositor does not tell it; transients are kept above their container. Withdrawing or iconifying a toplevel generates UnmapNotify. wm iconify and deiconify check override-redirect, transients and icon windows; before the first map, wm deiconify only changes the state and wm state reports it, and wm geometry reports the size of the window. A bad geometry specifier is an error, wm maxsize is applied when resizing, the errors of wm aspect and grid are those of Tk, and wm protocol checks the number of arguments. Leaf check-in: 41a83bec32 user: serhiy.storchaka tags: wayland-wm-commands
08:07
Wayland: the usage messages of the wm subcommands were "pathName minsize ?width height?" instead of "wm minsize window ?width height?", and "wm minsize" without a window gave "wm minsize window ?arg ...?" instead of "wm option window ?arg ...?" (52 tests of wm.test failed). Use the messages of Tk. Leaf check-in: 0540233d4a user: serhiy.storchaka tags: wayland-wm-usage-messages
08:07
Wayland: when the geometry update was pending only as the timer which waits for the window to be shown (started by TkWmMapWindow()), WmUpdateGeom() did not schedule it at idle, so "wm minsize" after mapping a toplevel was not applied by "update" (wm-minsize-2.1 and wm-minsize-2.5 failed depending on the preceding tests). Schedule it at idle in this case too. Leaf check-in: 218d5c2b68 user: serhiy.storchaka tags: wayland-geometry-idle-update
08:07
Wayland: XGetImage() of a window read the pixels with glReadPixels() at the window coordinates without binding the backing framebuffer of the toplevel, without the offset of a child window in it and without flipping y, and stored the RGBA bytes, which the callers decode with XGetPixel() and the masks of the visual, so red and blue were swapped (testpixel returned wrong colors). Read from the framebuffer of the toplevel or pixmap at the right place and store the pixels in the format of the visual. Leaf check-in: e35c149c81 user: serhiy.storchaka tags: wayland-getimage-pixels
08:07
Wayland: the font ascent and descent were computed with stbtt_ScaleForPixelHeight(), so that ascent + descent equals the pixel size, but fontstash draws the text with the pixel size as the em size, so the metrics were too small for fonts like Noto Sans (linespace 13 instead of 18 at -13). Use stbtt_ScaleForMappingEmToPixels(), and round up, as Xft does. Leaf check-in: 59acb68293 user: serhiy.storchaka tags: wayland-font-metrics-em
08:07
Wayland: TkSelGetSelection() returned TCL_OK without a result, so "selection get" returned "" when no window of the application owned the selection. Return the error "... selection doesn't exist or form ... not defined", as on the other platforms (and as its comment says). Leaf check-in: 485543691b user: serhiy.storchaka tags: wayland-selection-get-error
08:07
Wayland: the replacement of "selection" for the CLIPBOARD selection did not work as in Tk. "selection own -selection CLIPBOARD" without a window took the ownership instead of returning the owner; record the owner window and its -command, and run the command when the window loses the selection. "selection clear" did not accept a window argument. "selection handle" was ignored; store the handlers per window and type, and call them in chunks of 4000 from "selection get", and list their types in TARGETS. Usage errors named tcl_selection instead of selection. Leaf check-in: 760b3c3bee user: serhiy.storchaka tags: wayland-selection-clipboard
08:07
Wayland: library/tk.tcl called "tk appname tk" during initialization, so every application (on all platforms of the branch) was named "tk", "tk #2", ..., whatever -name or the script name was. Remove it. TkWaylandSyncAppId() now keeps the Wayland app_id "tk" while the application has its default name (possibly with a " #N" suffix), so the icon of tk.desktop is still used, and uses the name set with -name or "tk appname" otherwise. Leaf check-in: 19662a2bb6 user: serhiy.storchaka tags: wayland-default-appname
07:46
Fix [220892]: focus changes forgotten during grab check-in: 5587d9602d user: jan.nijtmans tags: trunk, main
07:29
Fix [853398ffff]: unixEmbed-5.1 failed sporadically check-in: cf6996f47a user: jan.nijtmans tags: trunk, main
07:27
Fix [a4c72a]: errors when a menu is destroyed while it is posted check-in: 6037383fb5 user: jan.nijtmans tags: trunk, main
07:21
Fix [7c5162]: panedwindow misbehaving when resizing window check-in: 94e351aaef user: jan.nijtmans tags: trunk, main
07:10
Fix [873655ffff]: missing <Leave> event when posting cascade menus check-in: 44e2460267 user: jan.nijtmans tags: trunk, main
07:07
Wayland: TkWaylandSyncAppId() also called Tk_MainWindow() without saving the interpreter state first, so the error of a failed main window creation was still replaced by "this isn't a Tk application". Save the state before the call. Leaf check-in: bc17ca9448 user: serhiy.storchaka tags: wayland-create-error-result
07:06
Wayland: XCreateColormap() returned 0 (None), which means failure, so "toplevel .t -colormap new" failed with an empty error message. Return a new nonzero value each time, as on macOS. Leaf check-in: 6a2cbefc7e user: serhiy.storchaka tags: wayland-new-colormap
07:06
Wayland: "wm manage" and "wm forget" were not implemented, and were refused for windows which are not toplevels ("window isn't a top-level window"), so wm-forget-1.5 hung on the dialog of the background error. Implement them as on macOS: "wm manage" makes the frame a toplevel with its own GLFW window, "wm forget" destroys it and makes the frame a child again. Allocate the private data of a window in one function, which also no longer clears the DString it has just initialized. Leaf check-in: 5d6c00386e user: serhiy.storchaka tags: wayland-wm-manage
07:06
Wayland: "send" to an application in another process did not report an error in that application: the reply carried only the result, and a stale errno could turn a success into an error. Send also errorInfo and errorCode with an error result, return the code of the remote command, check ETIMEDOUT only when the receive failed, and free the reply strings. Leaf check-in: bde6cf29c2 user: serhiy.storchaka tags: wayland-send-errors
07:06
Wayland: a resize could be undone by a late configure event. The compositor (sway) answers a commit of a new window size with a configure event carrying that size, and GLFW resizes the window to it. If the client resized the window again before the answer arrived, the answer restored the previous size, so "wm geometry" and size requests were sometimes lost (pack-8.6, canvas-6.5 and panedwindow-11.4 failed depending on the preceding tests). Make a roundtrip to the compositor before each resize, so that such answers arrive before it. Leaf check-in: cea49789c7 user: serhiy.storchaka tags: wayland-stale-configure
07:06
Wayland: window creation compared the window with Tk_MainWindow(interp), which sets the error result "this isn't a Tk application" when the application is not registered. If the creation of a main window failed (for example "load {} Tk" into a safe interpreter, which needs embedding), this replaced the real error message. Compare with mainPtr->winPtr instead. check-in: 5adc160ebf user: serhiy.storchaka tags: wayland-create-error-result
07:06
Wayland: Tk_MeasureCharsInContext() measured each character up to the right edge of its glyph (maxx), not up to its advance, so the characters of a fixed-width font had different widths ("M" 9 pixels and "i" 8 pixels in Courier -12 instead of 7). Measure up to the start of the next character, or the advance of the range for the last one. Leaf check-in: f37ff6e766 user: serhiy.storchaka tags: wayland-measure-advance
07:06
Wayland: a font could be measured and drawn with the glyphs of another font. The NanoVG font names are built from the address of the WaylandFont and its generation, and a new WaylandFont starts from generation 1, so a font allocated at the address of a freed one got its name, and nvgFindFont() returned the freed font's typeface (textDisp.test measured Courier -12 as 10 pixels wide). Take the generation from a global counter. Leaf check-in: b779ae2d79 user: serhiy.storchaka tags: wayland-font-name-reuse
07:06
Wayland: the color names were not parsed as in the rest of Tk. A hex color was accepted with invalid digits after the valid ones ("#abz", "#12345g"), because sscanf("%x") stops at the first other character; #RRRGGGBBB was not accepted; and a name with spaces, such as "alice blue", was rejected. Check that all characters are hex digits, accept 9 digits, and let a space match the start of a word in the color table, as in xlib/xcolors.c. Leaf check-in: 45fbe0d794 user: serhiy.storchaka tags: wayland-color-parsing
05:52
Wayland: a direct call of UpdateGeometryInfo() (e.g. by TkWmMapWindow()) while its timer was pending lost the timer, which then fired after the window was destroyed (wm.test crashed in wm-transient-8.1). Delete the pending timer instead, and always cancel the idle call and the timer in TkWmDeadWindow(). Leaf check-in: 1d0bf5bb12 user: serhiy.storchaka tags: wayland-lost-geometry-timer
04:38
Wayland: Tk_MeasureCharsInContext() laid out the whole range even with a limit, so measuring a long wrapped line in a text widget was quadratic in its length (textDisp-33.3 took about a minute). Lay out only a prefix of the range which can fit, growing it while all of it fits. Leaf check-in: 5d6d530621 user: serhiy.storchaka tags: wayland-measure-prefix
04:33
Wayland: the redraw scheduled by TkpPostTearoffMenu() was not cancelled when the menu was destroyed, and then used the freed menu (menu.test crashed). Cancel it in TkpDestroyMenu(). Leaf check-in: 4871ac60b1 user: serhiy.storchaka tags: wayland-menu-idle-uaf
04:33
Wayland: the idle callback which creates the standard named fonts was not cancelled when the application was deleted, and then used the freed TkMainInfo (winfo.test crashed). Cancel it when the main window is destroyed. Remove TkWaylandCancelNamedFontIdle(), which was never called. Leaf check-in: 52c46b2820 user: serhiy.storchaka tags: wayland-font-idle-uaf
04:33
Wayland: a toplevel was not resized before it got the focus for the first time, which a compositor need not give (headless sway never does), so it did not follow the size requested by its content (focusTcl.test hung). Wait instead until GLFW reports the window as visible, after the compositor has configured it. A size set with "wm geometry" now also overrides the size requested by the content, as on X11. Leaf check-in: eee56669ce user: serhiy.storchaka tags: wayland-resize-before-focus
03:42
Fix a few glitches noticed by Nicolas Bats. Leaf check-in: 35dfe22f2d user: culler tags: tip_765
00:53
Merge bug fixes from Wayland Leaf check-in: 1841d6c4e8 user: kevin_walzer tags: wayland_test
2026-10-14
21:53
Duplicate TkpInitKeymapInfo() call in tkWinX.c Leaf check-in: 2bcc74166e user: jan.nijtmans tags: core-9-0-branch
21:52
Duplicate TkpInitKeymapInfo() call in tkWinX.c check-in: a5c499e47c user: jan.nijtmans tags: trunk, main
21:30
Fix [1474465]: focus test failures check-in: e03750c851 user: jan.nijtmans tags: trunk, main
21:23
Fix [726351]: the size hints of a toplevel ignore its menubar check-in: d1a642ba4b user: jan.nijtmans tags: core-9-0-branch
21:22
Fix [726351]: the size hints of a toplevel ignore its menubar check-in: b278695b2b user: jan.nijtmans tags: trunk, main
21:07
Rebase to trunk Leaf check-in: f532ecf39d user: jan.nijtmans tags: x11-nonlatin-shortcuts, core-x11-nonlatin-shortcuts
20:24
Merge wayland-initial-geometry: fix [041f2f1131], "wm geometry WxH" before a toplevel was mapped was ignored. Leaf check-in: 4bcd53fbf9 user: serhiy.storchaka tags: wayland
20:24
Merge wayland-container-id: fix [86dbc4064a], use after free of the container of a subwindow. check-in: bab7d255e2 user: serhiy.storchaka tags: wayland
19:55
Merge wayland-atom-numbers: fix [9ce8a6125e], interned atoms got the numbers of predefined atoms. check-in: ebec425140 user: serhiy.storchaka tags: wayland
19:51
Wayland: use after free of the container of a subwindow (crash in pack.test after pack-15.5). The window whose clipping rectangles include a subwindow was kept as a pointer, which dangled once that window was destroyed: with pack -in it is not the parent of the subwindow. Keep its window ID instead, and look it up with TkWaylandGetContainer, which finds no destroyed window. Closed-Leaf check-in: 0fd5f0011a user: serhiy.storchaka tags: wayland-container-id
19:47
Wayland: a size set with "wm geometry" before a toplevel was mapped was ignored. The GLFW window was created at the requested size, and the geometry update which would apply the set size waits for the first focus, which a compositor need not give (headless sway never does). The window is now created at the set size, and ConfigureNotify no longer resets it. Closed-Leaf check-in: 0df8b09326 user: serhiy.storchaka tags: wayland-initial-geometry