Ticket #4443 (new defect)

Opened 22 months ago

Last modified 22 months ago

TIOCSWINSZ ioctl loses extended pixel sizes (ws_xpixel, ws_ypixel) even when the underlying shell supports it

Reported by: arcivanov Owned by:
Priority: major Milestone: Future Releases
Component: mc-tty Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

$ mc --version
GNU Midnight Commander 4.8.28
Built with GLib 2.73.2
Built with S-Lang 2.3.2 with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With internationalization support
With multiple codepages support
With ext2fs attributes support
Virtual File Systems:

cpiofs, tarfs, sfs, extfs, ftpfs, fish

Data types:

char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

$ bash --version
GNU bash, version 5.2.15(1)-release (x86_64-redhat-linux-gnu)

Test script:

#!/usr/bin/env python3
import ctypes
import termios
import fcntl
from ctypes import Structure, c_ushort

class WinSize(Structure):
     _fields_ = [("ws_row", c_ushort),
                 ("ws_col", c_ushort),
                 ("ws_xpixel", c_ushort),
                 ("ws_ypixel", c_ushort)
                 ]

sz = WinSize()
fcntl.ioctl(0, termios.TIOCGWINSZ, sz)
print(sz.ws_row, sz.ws_col, sz.ws_xpixel, sz.ws_ypixel)

Running the above script with Python 3.10.9 with MC I get:

44 206 0 0

Exiting MC to the undelying shell I get:

44 206 1651 752

Change History

comment:1 Changed 22 months ago by andrew_b

  • Component changed from mc-core to mc-tty

comment:2 Changed 22 months ago by arcivanov

Forgot to say that this is running in Konsole 22.12.2, KDE Framework 5.102.0, Qt 5.15.8

comment:3 Changed 22 months ago by andrew_b

Neither SLang nor NCurses doesn't use ws_xpixel and ws_ypixel at all.

What we should do with size in pixels inside TUI program inside a terminal emulator?

Some related info can be found in https://bugzilla.gnome.org/show_bug.cgi?id=782576.

comment:4 Changed 22 months ago by arcivanov

notcurses, xterm, konsole, kitty support it.
The use case is related to raster graphics and animations in console, e.g. kitty.

The question here is whether the output of mc_tty should be consistent with that of the underlying console (konsole in my case).

My discovery of this issue was when I launched the app via mc and it didn't work, whereas without mc it did.

https://sw.kovidgoyal.net/kitty/graphics-protocol/#getting-the-window-size

Note: See TracTickets for help on using tickets.