http://bugs.winehq.org/show_bug.cgi?id=10919
Summary: GetLargestConsoleWindowSize() should not return hard coded constants Product: Wine Version: 0.9.51. Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-console AssignedTo: wine-bugs@winehq.org ReportedBy: reijo.sund@helsinki.fi
Created an attachment (id=9840) --> (http://bugs.winehq.org/attachment.cgi?id=9840) sizepro.c - A source demonstrating the problem and a solution in terms of APIs
----------------------------------------------------------------------
MSDN library includes sample code for console applications (http://msdn2.microsoft.com/en-us/library/aa263818.aspx). The source is available at: http://www.helsinki.fi/~sund/console_vs6.zip . The source compiles easily with winelib after --cuiexe transformations with winemaker.
The examples 14 and 32 deal with the GetLargestConsoleWindowSize() function. The problem is that the current implementation in Wine returns hard coded constants (X=80, Y=24) for the maximum size. This causes problems for applications that have followed the conventions of sample code, because it "prevents" the resizing of console window to bigger than "maximum".
In principle, the window size could be changed manually by using properties dialog, but that is an "ugly" solution. Another "ugly" solution would be to change the hard coded constants to bigger values in Wine implementation.
A better solution would be to actually implement the required functionality. I have attached a source (sizepro.c, compiles with 'winegcc -o sizepro.exe sizepro.c') that demonstrates the problem and infers the maximum console window size in relation to current resolution and font.
I also tried to implement the corresponding functionality to Wine, and attached the source for the improved function (kernel32_console_ getlargestconsolewindowssize.c). That works fine for me, but I'm not sure whether it follows the conventions of Wine (or how to deal with strange __i386__ definitions without duplicating the code). So, I wonder if someone else more familiar with Wine development could check it out and derive an adequate patch.
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #1 from Reijo Sund reijo.sund@helsinki.fi 2007-12-28 06:19:25 --- Created an attachment (id=9841) --> (http://bugs.winehq.org/attachment.cgi?id=9841) A skeleton for a patch
http://bugs.winehq.org/show_bug.cgi?id=10919
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|_obsolete_console |kernel32
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #2 from Reijo Sund reijo.sund@helsinki.fi 2008-05-01 03:09:10 --- Created an attachment (id=12611) --> (http://bugs.winehq.org/attachment.cgi?id=12611) A proposed patch
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #3 from Reijo Sund reijo.sund@helsinki.fi 2008-05-02 10:35:48 --- Created an attachment (id=12641) --> (http://bugs.winehq.org/attachment.cgi?id=12641) An improved patch
See also: http://www.winehq.org/pipermail/wine-devel/2008-May/065348.html http://www.winehq.org/pipermail/wine-devel/2008-May/065352.html
http://bugs.winehq.org/show_bug.cgi?id=10919
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla.j.iansemail@spamgou | |rmet.com
--- Comment #4 from Juan Lang juan_lang@yahoo.com 2008-09-15 10:08:16 --- *** Bug 15293 has been marked as a duplicate of this bug. ***
http://bugs.winehq.org/show_bug.cgi?id=10919
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, testcase
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #5 from Ian Binnie bugzilla.j.iansemail@spamgourmet.com 2008-09-17 03:47:37 --- I thought it would be simple to write a function to replace GetLargestConsoleWindowSize.
This is similar to the code above, but using SystemParametersInfo(SPI_GETWORKAREA ...) to get the Work Area on primary monitor, excluding taskbar (This works under Windows.)
This works OK the first time it is called, but I noticed the calculated size of the largest possible console window keeps growing until it crashes.
It seems that Wine does not keep the font constant, but reduces the size. This can be also seen by attempting to modify the properties of the console.
I was running a test using wineconsole --backent=user
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #6 from Ian Binnie bugzilla.j.iansemail@spamgourmet.com 2008-09-17 03:49:08 --- Created an attachment (id=16138) --> (http://bugs.winehq.org/attachment.cgi?id=16138) CalculateConsoleMaxSize function
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #7 from Ian Binnie bugzilla.j.iansemail@spamgourmet.com 2008-09-18 23:01:52 --- In Windows (but not Wine) GetClientRect is always a multiple of Font size
This causes the calculated Font Size (ClientRect / ConsoleScreenBuffer) to vary in wineconsole.
GetClientRect(hWnd, &crt); // client area of console window in screen coordinates
It is a pity the XP API GetCurrentConsoleFont() GetConsoleFontSize() are not implemented.
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #8 from Austin English austinenglish@gmail.com 2009-03-30 12:41:31 --- Is this still an issue in current (1.1.18 or newer) wine?
http://bugs.winehq.org/show_bug.cgi?id=10919
Frédéric Delanoy frederic.delanoy@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |frederic.delanoy@gmail.com
--- Comment #9 from Frédéric Delanoy frederic.delanoy@gmail.com 2009-07-20 18:54:43 --- Still an issue in 1.1.26
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #10 from Austin English austinenglish@gmail.com 2010-04-30 15:32:17 --- Still present.
http://bugs.winehq.org/show_bug.cgi?id=10919
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Severity|normal |minor
--- Comment #11 from Austin English austinenglish@gmail.com 2011-08-08 20:09:13 CDT --- Still in 1.3.26.
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #12 from Austin English austinenglish@gmail.com 2012-08-22 17:24:04 CDT --- (In reply to comment #7)
It is a pity the XP API GetCurrentConsoleFont() GetConsoleFontSize() are not implemented.
FWIW, they're now stubs: http://source.winehq.org/git/wine.git/commitdiff/71d3d4f1bafbcec65ba165d28aa... http://source.winehq.org/git/wine.git/commitdiff/53d73559499f698efa9340f66ce...
http://bugs.winehq.org/show_bug.cgi?id=10919
anatoly techtonik techtonik@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |32089
http://bugs.winehq.org/show_bug.cgi?id=10919
anatoly techtonik techtonik@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |techtonik@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=10919
Hugh dasjournal1@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dasjournal1@gmail.com
--- Comment #13 from Hugh dasjournal1@gmail.com 2013-03-09 21:52:12 CST --- This is still a problem in 1.5.25.
The 'improved' patch fails to compile in this version.
Other areas of concern are:
* server/console.c (specifies window and buffer sizes) * programs/wineconsole/registry.c (specifies default window and buffer sizes for programs that haven't been run before).
http://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #14 from Hugh McMaster hughmcmaster@outlook.com 2013-09-30 03:06:38 CDT --- Created attachment 46145 --> http://bugs.winehq.org/attachment.cgi?id=46145 Allows GetLargestConsoleWindowSize() to function successfully
This patch allows GetLargestConsoleWindowSize() to return the correct constants based on a user's current screen resolution and wineconsole font size.
It also modifies wineconsole so that the maximum console window size cannot be exceeded. Scrollbars appear when a user wishes to use a screen buffer larger than the maximum window size.
I've tested this patch using three different console-based programs. Each has detected the maximum window size possible. Feedback and advice from testers/others is welcomed.
http://bugs.winehq.org/show_bug.cgi?id=10919
Sergey sohorev@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sohorev@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=10919
--- Comment #15 from Ken Sharp imwellcushtymelike@gmail.com --- Is this still an issue in Wine 1.7.45 or later?
https://bugs.winehq.org/show_bug.cgi?id=10919
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |super_man@post.com
--- Comment #16 from super_man@post.com --- Yes because the patch applies
patch -p1 <c.patch patching file dlls/kernel32/console.c Hunk #1 succeeded at 1357 (offset -7 lines). Hunk #2 succeeded at 1397 (offset -7 lines). Hunk #3 succeeded at 1417 (offset -7 lines). patching file programs/wineconsole/wineconsole.c Hunk #5 succeeded at 417 (offset 17 lines). Hunk #6 succeeded at 453 (offset 22 lines). Hunk #7 succeeded at 481 (offset 22 lines). Hunk #8 succeeded at 496 (offset 22 lines). Hunk #9 succeeded at 690 (offset 29 lines). Hunk #10 succeeded at 699 (offset 29 lines). Hunk #11 succeeded at 847 (offset 31 lines). patching file server/console.c Hunk #1 succeeded at 1635 (offset 17 lines). patching file server/protocol.def Hunk #1 succeeded at 1473 (offset 50 lines).
wine 1.7.50(git)
https://bugs.winehq.org/show_bug.cgi?id=10919
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |STAGED CC| |erich.e.hoover@wine-staging | |.com, michael@fds-team.de, | |sebastian@fds-team.de Staged patchset| |https://github.com/wine-com | |pholio/wine-staging/tree/ma | |ster/patches/kernel32-GetLa | |rgestConsoleWindowSize
https://bugs.winehq.org/show_bug.cgi?id=10919
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |dd6477966b2628995e0a9384b04 | |fee9658ef011b Status|STAGED |RESOLVED Resolution|--- |FIXED
--- Comment #17 from Sebastian Lackner sebastian@fds-team.de --- This is fixed with http://source.winehq.org/git/wine.git/commitdiff/dd6477966b2628995e0a9384b04....
If there are any remaining issues, please open a new bug report for it.
https://bugs.winehq.org/show_bug.cgi?id=10919
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #18 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.9.1.