Comments (10)
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 ncurses
because that library lacks is_termresized()
. Replacing
if (is_termresized())
with
if( ch == KEY_RESIZE)
enabled it to compile, whereupon I found (as Bruce did) that it worked correctly.
from pdcurses.
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.
from pdcurses.
Have a question related.
Im using x11 implementation, ubuntu 18.04:
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 ?
from pdcurses.
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.)
from pdcurses.
@aiafrasinei : note that it is implemented for SDL2, so you could just switch to that.
Alternatively, you can "borrow" a few lines of code from here :
https://github.com/Bill-Gray/PDCurses/blob/master/x11/pdcscrn.c#L58
With this, you can call PDC_resize_screen
before initscr
to specify a desired initial window size. Note that you still can't programmatically resize the window after initscr
is called. For that, your options are SDL or (if you use my fork) VT.
William, your comment about resizing being Very Strongly Discouraged in X11 interests me. I haven't done it, solely because it looked unreasonably difficult (at least to a non-X11-knowledgeable person).
Oddly, ncurses (at least on my Xubuntu 18.04 system with xterm) lacks programmatic resizing, though it seems to me it would be simple enough to add it, as I did in the VT platform. Perhaps Thomas Dickey (author of ncurses) also thinks programmatic resizing in X is VSD.
from pdcurses.
Well, if you want to set the size before initscr()
, you can just use X resources, or even the command line, e.g.:
./appname -cols 90 -lines 30
(X11 only, requires Xinitscr(argc, argv)
instead of initscr()
.) For SDL, you can set the environment variables PDC_COLS and PDC_LINES. (Or you can manually create the SDL window, as in sdltest.c.)
from pdcurses.
Thank you for the info , ill use those command line options.
from pdcurses.
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).
from pdcurses.
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)
from pdcurses.
You can work around it with the following logic:
- On init, get screen buffer size and save it
- On resize to bigger, set flag
- On resize to smaller, check flag
- If the flag is set, restore the original buffer size
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!
from pdcurses.
Related Issues (20)
- Is it normal that several styles don't work correctly in PowerShell? HOT 7
- Enabling support for showing window after process put to sleep (SDL2) HOT 4
- SDL_GetError() returns "Parameter 'src' is invalid" after call to initscr() for sdl2 HOT 2
- ncurses compat: add WACS_D_LRCORNER and other double line drawings
- SDL2 port missing support for PDC_PRESERVE_SCREEN HOT 4
- WinCon, endwin() kills QuickEdit/InsertMode options and more.. HOT 8
- touchoverlap() un-touches parts of lines HOT 1
- addition of vt port from Bill-Gray HOT 1
- additional gitpod config
- No rule to make target '../common/libobjs.mif'. Stop. HOT 5
- Unable to get mouse position when hovering HOT 9
- SDL2 build fails for Mac/Linux in Github HOT 2
- When resizing the SDL2 window, the surface isn't refreshed
- Build failure when building PDcurses DLL library for Window console HOT 1
- Debugging? HOT 1
- printw.c - for Unicode? HOT 3
- wresize doesn't return ERR if the window size requested is too big HOT 3
- Unable to initialize soft label keys HOT 2
- missing escapes in configure script HOT 1
- Scrolling and inserting/deleting lines
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdcurses.