Fixed COORD structure definition.

Fixed GetLargestConsoleWindowSize to not return a structure when
called from the Window binary.
This commit is contained in:
Alexandre Julliard 2000-05-03 17:48:21 +00:00
parent ba3e2abc99
commit f818d42fae
8 changed files with 65 additions and 65 deletions

View File

@ -30,6 +30,7 @@
#include <string.h>
#include "windef.h"
#include "wincon.h"
#include "debugger.h"
/*
@ -247,8 +248,8 @@ static void
TTYinfo(void)
{
COORD c = GetLargestConsoleWindowSize(GetStdHandle(STD_INPUT_HANDLE));
TTYwidth = c.x;
TTYrows = c.y;
TTYwidth = c.X;
TTYrows = c.Y;
}

View File

@ -12,6 +12,7 @@
#include "thread.h"
#include "process.h"
#include "wincon.h"
#include "wingdi.h"
#include "winuser.h"
@ -575,7 +576,7 @@ int DEBUG_main(int argc, char** argv)
COORD pos;
/* This is a hack: it forces creation of an xterm, not done by default */
pos.x = 0; pos.y = 1;
pos.X = 0; pos.Y = 1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

View File

@ -162,8 +162,8 @@ int VGA_SetAlphaMode(unsigned Xres,unsigned Yres)
/* the xterm is slow, so refresh only every 200ms (5fps) */
VGA_InstallTimer(200000);
siz.x = Xres;
siz.y = Yres;
siz.X = Xres;
siz.Y = Yres;
SetConsoleScreenBufferSize(VGA_AlphaConsole(),siz);
return 0;
}
@ -172,16 +172,16 @@ void VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres)
{
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(VGA_AlphaConsole(),&info);
if (Xres) *Xres=info.dwSize.x;
if (Yres) *Yres=info.dwSize.y;
if (Xres) *Xres=info.dwSize.X;
if (Yres) *Yres=info.dwSize.Y;
}
void VGA_SetCursorPos(unsigned X,unsigned Y)
{
COORD pos;
pos.x = X;
pos.y = Y;
pos.X = X;
pos.Y = Y;
SetConsoleCursorPosition(VGA_AlphaConsole(),pos);
}
@ -189,8 +189,8 @@ void VGA_GetCursorPos(unsigned*X,unsigned*Y)
{
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(VGA_AlphaConsole(),&info);
if (X) *X=info.dwCursorPosition.x;
if (Y) *Y=info.dwCursorPosition.y;
if (X) *X=info.dwCursorPosition.X;
if (Y) *Y=info.dwCursorPosition.Y;
}
/*** CONTROL ***/
@ -225,8 +225,8 @@ void CALLBACK VGA_Poll( ULONG_PTR arg )
VGA_GetAlphaMode(&Width,&Height);
dat = DOSMEM_MapDosToLinear(0xb8000);
siz.x = 80; siz.y = 1;
off.x = 0; off.y = 0;
siz.X = 80; siz.Y = 1;
off.X = 0; off.Y = 0;
/* copy from virtual VGA frame buffer to console */
for (Y=0; Y<Height; Y++) {
dest.Top=Y; dest.Bottom=Y;

View File

@ -11,12 +11,6 @@
extern "C" {
#endif
typedef struct tagCOORD {
INT16 x;
INT16 y;
} COORD, *LPCOORD;
/* Windows Exit Procedure flag values */
#define WEP_FREE_DLL 0
#define WEP_SYSTEM_EXIT 1
@ -1301,7 +1295,6 @@ DWORD WINAPI GetFullPathNameA(LPCSTR,DWORD,LPSTR,LPSTR*);
DWORD WINAPI GetFullPathNameW(LPCWSTR,DWORD,LPWSTR,LPWSTR*);
#define GetFullPathName WINELIB_NAME_AW(GetFullPathName)
BOOL WINAPI GetHandleInformation(HANDLE,LPDWORD);
COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
DWORD WINAPI GetLengthSid(PSID);
VOID WINAPI GetLocalTime(LPSYSTEMTIME);
DWORD WINAPI GetLogicalDrives(void);
@ -1425,9 +1418,6 @@ BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER);
BOOL WINAPI ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
BOOL WINAPI ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
#define ReadConsole WINELIB_NAME_AW(ReadConsole)
BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,
COORD,LPDWORD);
#define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
BOOL WINAPI ReadEventLogA(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *);
BOOL WINAPI ReadEventLogW(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *);
#define ReadEventLog WINELIB_NAME_AW(ReadEventLog)
@ -1450,7 +1440,6 @@ BOOL WINAPI SetCommMask(INT,DWORD);
BOOL WINAPI SetComputerNameA(LPCSTR);
BOOL WINAPI SetComputerNameW(LPCWSTR);
#define SetComputerName WINELIB_NAME_AW(SetComputerName)
BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
BOOL WINAPI SetConsoleMode(HANDLE,DWORD);
BOOL WINAPI SetConsoleTitleA(LPCSTR);
BOOL WINAPI SetConsoleTitleW(LPCWSTR);

View File

@ -1,8 +1,6 @@
#ifndef __WINE_WINCON_H
#define __WINE_WINCON_H
#include "winbase.h" /* for COORD */
#define CTRL_C_EVENT 0
#define CTRL_BREAK_EVENT 1
#define CTRL_CLOSE_EVENT 2
@ -38,20 +36,18 @@ typedef struct _CONSOLE_CURSOR_INFO {
BOOL bVisible; /* Visibility of cursor */
} CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
/*
typedef struct tagCOORD
{
INT16 x;
INT16 y;
} COORD,*LPCOORD;
*/
SHORT X;
SHORT Y;
} COORD, *LPCOORD;
typedef struct tagSMALL_RECT
{
INT16 Left;
INT16 Top;
INT16 Right;
INT16 Bottom;
SHORT Left;
SHORT Top;
SHORT Right;
SHORT Bottom;
} SMALL_RECT,*LPSMALL_RECT;
typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
@ -141,6 +137,12 @@ typedef struct tagINPUT_RECORD
#define MENU_EVENT 0x08
#define FOCUS_EVENT 0x10
COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
#define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, LPSMALL_RECT lpWriteRegion);
BOOL WINAPI WriteConsoleOutputW( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, LPSMALL_RECT lpWriteRegion);
#define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
@ -171,7 +173,6 @@ BOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput,
BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,
LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
BOOL WINAPI SetConsoleCursorPosition(HANDLE hConsoleOutput, COORD dwCursorPosition);
BOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput,
COORD dwSize);

View File

@ -354,7 +354,7 @@ import ntdll.dll
336 stdcall GetHandleInformation(long ptr) GetHandleInformation
337 stub GetLSCallbackTarget
338 stub GetLSCallbackTemplate
339 stdcall GetLargestConsoleWindowSize(long) GetLargestConsoleWindowSize
339 stdcall GetLargestConsoleWindowSize(long) WIN32_GetLargestConsoleWindowSize
340 stdcall GetLastError() GetLastError
341 stdcall GetLocalTime(ptr) GetLocalTime
342 stdcall GetLocaleInfoA(long long ptr long) GetLocaleInfoA

View File

@ -25,6 +25,7 @@
#include <unistd.h>
#include "winnt.h"
#include "winbase.h"
#include "wincon.h"
#include "handle.h"

View File

@ -208,8 +208,8 @@ CONSOLE_string_to_IR( HANDLE hConsoleInput,unsigned char *buf,int len) {
*/
if (k<len-3) {
ir.EventType = MOUSE_EVENT;
ir.Event.MouseEvent.dwMousePosition.x = buf[k+2]-'!';
ir.Event.MouseEvent.dwMousePosition.y = buf[k+3]-'!';
ir.Event.MouseEvent.dwMousePosition.X = buf[k+2]-'!';
ir.Event.MouseEvent.dwMousePosition.Y = buf[k+3]-'!';
if (buf[k+1]=='#')
ir.Event.MouseEvent.dwButtonState = 0;
else
@ -408,17 +408,17 @@ HANDLE WINAPI CreateConsoleScreenBuffer( DWORD dwDesiredAccess,
BOOL WINAPI GetConsoleScreenBufferInfo( HANDLE hConsoleOutput,
LPCONSOLE_SCREEN_BUFFER_INFO csbi )
{
csbi->dwSize.x = 80;
csbi->dwSize.y = 24;
csbi->dwCursorPosition.x = 0;
csbi->dwCursorPosition.y = 0;
csbi->dwSize.X = 80;
csbi->dwSize.Y = 24;
csbi->dwCursorPosition.X = 0;
csbi->dwCursorPosition.Y = 0;
csbi->wAttributes = 0;
csbi->srWindow.Left = 0;
csbi->srWindow.Right = 79;
csbi->srWindow.Top = 0;
csbi->srWindow.Bottom = 23;
csbi->dwMaximumWindowSize.x = 80;
csbi->dwMaximumWindowSize.y = 24;
csbi->dwMaximumWindowSize.X = 80;
csbi->dwMaximumWindowSize.Y = 24;
return TRUE;
}
@ -444,11 +444,18 @@ BOOL WINAPI SetConsoleActiveScreenBuffer(
COORD WINAPI GetLargestConsoleWindowSize( HANDLE hConsoleOutput )
{
COORD c;
c.x = 80;
c.y = 24;
c.X = 80;
c.Y = 24;
return c;
}
/* gcc doesn't return structures the same way as dwords */
DWORD WINAPI WIN32_GetLargestConsoleWindowSize( HANDLE hConsoleOutput )
{
COORD c = GetLargestConsoleWindowSize( hConsoleOutput );
return *(DWORD *)&c;
}
/***********************************************************************
* FreeConsole (KERNEL32.267)
*/
@ -747,8 +754,8 @@ BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput,
};
CONSOLE_make_complex(hConsoleOutput);
buffer = HeapAlloc(GetProcessHeap(),0,curbufsize);
offbase = (dwBufferCoord.y - 1) * dwBufferSize.x +
(dwBufferCoord.x - lpWriteRegion->Left);
offbase = (dwBufferCoord.Y - 1) * dwBufferSize.X +
(dwBufferCoord.X - lpWriteRegion->Left);
TRACE("orig rect top = %d, bottom=%d, left=%d, right=%d\n",
lpWriteRegion->Top,
@ -762,9 +769,9 @@ BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput,
/* Step 1. Make (Bottom,Right) offset of intersection with
Screen Buffer */
lpWriteRegion->Bottom = min(lpWriteRegion->Bottom, csbi.dwSize.y-1) -
lpWriteRegion->Bottom = min(lpWriteRegion->Bottom, csbi.dwSize.Y-1) -
lpWriteRegion->Top;
lpWriteRegion->Right = min(lpWriteRegion->Right, csbi.dwSize.x-1) -
lpWriteRegion->Right = min(lpWriteRegion->Right, csbi.dwSize.X-1) -
lpWriteRegion->Left;
/* Step 2. If either offset is negative, then no action
@ -788,10 +795,10 @@ BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput,
}
/* Step 3. Intersect with source rectangle */
lpWriteRegion->Bottom = lpWriteRegion->Top - dwBufferCoord.y +
min(lpWriteRegion->Bottom + dwBufferCoord.y, dwBufferSize.y-1);
lpWriteRegion->Right = lpWriteRegion->Left - dwBufferCoord.x +
min(lpWriteRegion->Right + dwBufferCoord.x, dwBufferSize.x-1);
lpWriteRegion->Bottom = lpWriteRegion->Top - dwBufferCoord.Y +
min(lpWriteRegion->Bottom + dwBufferCoord.Y, dwBufferSize.Y-1);
lpWriteRegion->Right = lpWriteRegion->Left - dwBufferCoord.X +
min(lpWriteRegion->Right + dwBufferCoord.X, dwBufferSize.X-1);
TRACE("clipped rect top = %d, bottom=%d, left=%d,right=%d\n",
lpWriteRegion->Top,
@ -816,7 +823,7 @@ BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput,
/* Now do the real processing and move the characters */
for (i=lpWriteRegion->Top;i<=lpWriteRegion->Bottom;i++) {
offbase += dwBufferSize.x;
offbase += dwBufferSize.X;
sprintf(sbuf,"%c[%d;%dH",27,i+1,lpWriteRegion->Left+1);
SADD(sbuf);
for (j=lpWriteRegion->Left;j<=lpWriteRegion->Right;j++) {
@ -1136,17 +1143,17 @@ BOOL WINAPI SetConsoleCursorPosition( HANDLE hcon, COORD pos )
DWORD xlen;
/* make console complex only if we change lines, not just in the line */
if (pos.y)
if (pos.Y)
CONSOLE_make_complex(hcon);
TRACE("%d (%dx%d)\n", hcon, pos.x , pos.y );
TRACE("%d (%dx%d)\n", hcon, pos.X , pos.Y );
/* x are columns, y rows */
if (pos.y)
if (pos.Y)
/* full screen cursor absolute positioning */
sprintf(xbuf,"%c[%d;%dH", 0x1B, pos.y+1, pos.x+1);
sprintf(xbuf,"%c[%d;%dH", 0x1B, pos.Y+1, pos.X+1);
else
/* relative cursor positioning in line (\r to go to 0) */
sprintf(xbuf,"\r%c[%dC", 0x1B, pos.x);
sprintf(xbuf,"\r%c[%dC", 0x1B, pos.X);
/* FIXME: store internal if we start using own console buffers */
WriteFile(hcon,xbuf,strlen(xbuf),&xlen,NULL);
return TRUE;
@ -1293,7 +1300,7 @@ BOOL WINAPI SetConsoleTextAttribute(HANDLE hConsoleOutput,WORD wAttr)
BOOL WINAPI SetConsoleScreenBufferSize( HANDLE hConsoleOutput,
COORD dwSize )
{
FIXME("(%d,%dx%d): stub\n",hConsoleOutput,dwSize.x,dwSize.y);
FIXME("(%d,%dx%d): stub\n",hConsoleOutput,dwSize.X,dwSize.Y);
return TRUE;
}
@ -1383,7 +1390,7 @@ BOOL WINAPI FillConsoleOutputAttribute( HANDLE hConsoleOutput,
LPDWORD lpNumAttrsWritten)
{
FIXME("(%d,%d,%ld,%dx%d,%p): stub\n", hConsoleOutput,
wAttribute,nLength,dwCoord.x,dwCoord.y,lpNumAttrsWritten);
wAttribute,nLength,dwCoord.X,dwCoord.Y,lpNumAttrsWritten);
*lpNumAttrsWritten = nLength;
return TRUE;
}
@ -1398,7 +1405,7 @@ BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE hConsoleOutput,
LPSTR lpstr, DWORD dword, COORD coord, LPDWORD lpdword)
{
FIXME("(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput,lpstr,
dword,coord.x,coord.y,lpdword);
dword,coord.X,coord.Y,lpdword);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
@ -1415,7 +1422,7 @@ BOOL WINAPI ScrollConsoleScreenBufferA( HANDLE hConsoleOutput,
COORD dwDestOrigin, LPCHAR_INFO lpFill)
{
FIXME("(%d,%p,%p,%dx%d,%p): stub\n", hConsoleOutput,lpScrollRect,
lpClipRect,dwDestOrigin.x,dwDestOrigin.y,lpFill);
lpClipRect,dwDestOrigin.X,dwDestOrigin.Y,lpFill);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}