[3/13] wineconsole and kernel32: set GetLargestConsoleWindowSize based on screen resolution

Hugh McMaster hugh.mcmaster at masterindexing.com
Wed Apr 10 07:25:32 CDT 2013


Eric Pouech wrote: 

>to exchange information 
>between wineconsole and kernel is not the right thing to do the correct way is to:
>- enhance the wine server protocol to grab max win size in kernel32 
>from wine server

I've been able to achieve this.

/***********************************************************************
 *            GetLargestConsoleWindowSize_helper
 */
COORD GetLargestConsoleWindowSize_helper(HANDLE hConsoleOutput)
{
    int screen_width = 0, screen_height = 0;
    COORD fontsize, max_console;

    SERVER_START_REQ( get_desktop_workarea )
    {
        if(!wine_server_call_err( req ))
        {
            screen_width = reply->screen_x;
            screen_height = reply->screen_y;
        }
    }
    SERVER_END_REQ;

    fontsize = GetConsoleFontSize(hConsoleOutput, 0);

    max_console.X = (screen_width / fontsize.X) - 6;
    max_console.Y = (screen_height / fontsize.Y) - 5;

    if (max_console.X < 0 || max_console.Y < 0)
    {
        max_console.X = 80;
        max_console.Y = 25;
    }
    return max_console;
}

>- enhance wineconsole to set the max wine size into wine server

I'm not really sure how to do this.  I thought this code might work in programs/wineconsole/wineconsole.c:

RECT workarea;
/* Send desktop workarea to server */
SystemParametersInfoA(SPI_GETWORKAREA, 0, &workarea, 0);
    
SERVER_START_REQ( get_desktop_workarea )
{
    if(!wine_server_call_err( req ))
    {
        req->spi_workarea = workarea;
    }
}
SERVER_END_REQ;

Unfortunately, while Wine compiles perfectly with the other changes to the server (see attached files), no proper values are returned (only zero).
By setting hardcoded constants in server/window.c, I have tested GetLargestConsoleWindowSize, where all functions work as expected.

Any advice on sending data to the server would be appreciated.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: console.c.txt
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130410/9dfb8ce1/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: protocol.def.txt
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130410/9dfb8ce1/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: server_protocol.h.txt
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130410/9dfb8ce1/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: window.c.txt
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130410/9dfb8ce1/attachment-0003.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wineconsole.c.txt
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130410/9dfb8ce1/attachment-0004.txt>


More information about the wine-devel mailing list