-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resize problem #42
Comments
This example seems to work correctly with SDL2 and X11, and even with the VT and Windows GUI platforms in my fork. (I'm not currently at a machine where I can try Windows console mode.) So I suspect it's an issue specific to the Windows console platform. I initially couldn't compile with |
Yeah, this is specific to wincon. And yeah, it's a bug, but the bug seems to be on the OS side -- the reduced value is being returned directly by Windows. And I can't see how to work around it. The reduction factor isn't a constant 3, but rather, it's the width that the scroll bar would have, if there was a scroll bar. (You can see this by playing with the console's font size.) But so far, knowing that doesn't help me solve it. |
Have a question related. resize_term(100, 100); Doesnt seem to work , the window is not resized , function return -1 and i get a 24 80 window. Is this a bug ? |
No, it's intentional. Programmatic resizing is not implemented for X11. (I'm trying in vain to find documentation or discussion of this from years ago, but what I remember is that it was Very Strongly Discouraged for X11 apps to do this.) |
@aiafrasinei : note that it is implemented for SDL2, so you could just switch to that. |
Well, if you want to set the size before
(X11 only, requires |
Thank you for the info , ill use those command line options. |
I encountered this issue and actually it looks like Windows doesn't restore the console to the same size (the Window width is actually shrinking every time you restore the size). |
As I said: #42 (comment) |
You can work around it with the following logic:
This heuristic can be improved further by using the GetConsoleScreenBufferInfoEx(?) function to get the maximum size and then you can update the resize handler to detect if the window size is the maximium you queried. I implemented a similar workaround in ccmake and it seems to work great! |
In above code, I run it and press some key, then I get the size
(30, 120)
.After that I maximize the windows, I get the maximal size. Then I click to make window go back to normal size, I get(30, 117)
.By repeating this process(max then normal), maximal size is always the same, but width of normal size will decrease by 3 each time, i.e.
(30, 114), (30,111) ...
.Then window become smaller and smaller. Is it a bug?In my test, linux ncurses (not pdcurses) work so well that you need not to resize it manually because
getmaxyx
will get changed size.I build latest library in Win10 by mingw64
The text was updated successfully, but these errors were encountered: