The pixel information obtained by TIOCGWINSZ is incorrect. #22547

Closed
opened 2026-01-31 08:16:19 +00:00 by claunia · 3 comments
Owner

Originally created by @mikoto2000 on GitHub (Nov 14, 2024).

Windows Terminal version

1.22.2912.0

Windows build number

10.0.22631.0

Other Software

My application.

termsize.c:

#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>

void main() {
  struct winsize ws;
  int fd = open("/dev/tty", O_RDONLY);
  if(fd == -1) {
    fprintf(stderr, "Can't open tty");
    return;
  }
  int ret = ioctl(fd, TIOCGWINSZ, &ws);
  close(fd);
  fprintf(stderr, "cols %d rows %d, xpixel %d, ypixel %d.\n", ws.ws_col, ws.ws_row, ws.ws_xpixel, ws.ws_ypixel);
}

Steps to reproduce

  1. Run gcc termsize.c -o termsize && ./termsize
  2. Output stderr cols 163 rows 60, xpixel 0, ypixel 0. † xpixel and ypixel is fixed value zero.

(I was recommended to ask here in the comments at https://github.com/microsoft/WSL/issues/12265, so I am asking here as well.)

Expected Behavior

Output xpixel and ypixel is correct value.

Actual Behavior

Output xpixel and ypixel is fixed value zero.

Originally created by @mikoto2000 on GitHub (Nov 14, 2024). ### Windows Terminal version 1.22.2912.0 ### Windows build number 10.0.22631.0 ### Other Software My application. termsize.c: ```c #include <fcntl.h> #include <termios.h> #include <stdio.h> #include <unistd.h> #include <sys/ioctl.h> void main() { struct winsize ws; int fd = open("/dev/tty", O_RDONLY); if(fd == -1) { fprintf(stderr, "Can't open tty"); return; } int ret = ioctl(fd, TIOCGWINSZ, &ws); close(fd); fprintf(stderr, "cols %d rows %d, xpixel %d, ypixel %d.\n", ws.ws_col, ws.ws_row, ws.ws_xpixel, ws.ws_ypixel); } ``` ### Steps to reproduce 1. Run `gcc termsize.c -o termsize && ./termsize` 2. Output stderr `cols 163 rows 60, xpixel 0, ypixel 0.` † xpixel and ypixel is fixed value zero. (I was recommended to ask here in the comments at https://github.com/microsoft/WSL/issues/12265, so I am asking here as well.) ### Expected Behavior Output xpixel and ypixel is correct value. ### Actual Behavior Output xpixel and ypixel is fixed value zero.
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 08:16:19 +00:00
Author
Owner

@similar-issues-ai[bot] commented on GitHub (Nov 14, 2024):

We've found some similar issues:

  • #8581 , similarity score: 81%

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@similar-issues-ai[bot] commented on GitHub (Nov 14, 2024): We've found some similar issues: - #8581 , similarity score: 81% If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue. > Note: You can give me feedback by 👍 or 👎 this comment.
Author
Owner

@carlos-zamora commented on GitHub (Nov 20, 2024):

Thanks for filing! We're going to mark this as a /dup of #8581

@carlos-zamora commented on GitHub (Nov 20, 2024): Thanks for filing! We're going to mark this as a /dup of #8581
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Nov 20, 2024):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Nov 20, 2024): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22547