diff options
author | evktalo <evktalo@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-07-12 21:39:02 +0000 |
---|---|---|
committer | evktalo <evktalo@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-07-12 21:39:02 +0000 |
commit | 7abbab5a09326dc76dbb6301714ef1bef3c90c69 (patch) | |
tree | 13b48de1124f87192d86ef015a1b7e3564ed54b8 /crawl-ref/source/libw32c.cc | |
parent | db26ba941cd6487a138f11b8f974e302c52b7a43 (diff) | |
download | crawl-ref-7abbab5a09326dc76dbb6301714ef1bef3c90c69.tar.gz crawl-ref-7abbab5a09326dc76dbb6301714ef1bef3c90c69.zip |
Fix for BR#2820443: Crawl will now read and keep cursor size information from Windows when it starts. TODO: Make it respect changes to cursor size while running. Thanks to Darshan for all the pointers!
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10201 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libw32c.cc')
-rw-r--r-- | crawl-ref/source/libw32c.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc index 7e55786cdd..b5626f0c1b 100644 --- a/crawl-ref/source/libw32c.cc +++ b/crawl-ref/source/libw32c.cc @@ -81,6 +81,8 @@ static HANDLE inbuf = NULL; static HANDLE outbuf = NULL; static int current_color = -1; static bool cursor_is_enabled = false; +static CONSOLE_CURSOR_INFO initial_cci; +static bool have_initial_cci = false; // dirty line (sx,ex,y) static int chsx = 0, chex = 0, chy = -1; // cursor position (start at 0,0 --> 1,1) @@ -365,6 +367,10 @@ void init_libw32c(void) GetConsoleTitle( oldTitle, 78 ); SetConsoleTitle( CRAWL " " VERSION ); + // Use the initial Windows setting for cursor size if it exists. + // TODO: Respect changing cursor size manually while Crawl is running. + have_initial_cci = GetConsoleCursorInfo( outbuf, &initial_cci ); + #ifdef __MINGW32__ install_sighandlers(); #endif @@ -402,6 +408,7 @@ void init_libw32c(void) if (OutputCP != PREFERRED_CODEPAGE) SetConsoleOutputCP(PREFERRED_CODEPAGE); + } void deinit_libw32c(void) @@ -450,7 +457,9 @@ void _setcursortype_internal(bool curstype) if (curstype == cursor_is_enabled) return; - cci.dwSize = 5; + cci.dwSize = have_initial_cci && initial_cci.dwSize ? initial_cci.dwSize + : 5; + cci.bVisible = curstype? TRUE : FALSE; cursor_is_enabled = curstype; SetConsoleCursorInfo( outbuf, &cci ); |