mirror of
https://github.com/reactos/reactos.git
synced 2025-08-13 15:15:51 +00:00
[KERNEL32-CONSRV]
- Implement GetLargestConsoleWindowSize (and add a DPRINT to see what happens when Far 1.65 is launched). - Implement SetConsoleWindowInfo in kernel32 and pre-implement its CONSRV counterpart. svn path=/branches/ros-csrss/; revision=58726
This commit is contained in:
parent
2358a3210f
commit
d070d323fb
8 changed files with 229 additions and 35 deletions
|
@ -52,6 +52,8 @@ CSR_API(SrvGetConsoleHardwareState);
|
|||
CSR_API(SrvSetConsoleHardwareState);
|
||||
CSR_API(SrvGetConsoleDisplayMode);
|
||||
CSR_API(SrvSetConsoleDisplayMode);
|
||||
CSR_API(SrvGetLargestConsoleWindowSize);
|
||||
CSR_API(SrvSetConsoleWindowInfo);
|
||||
CSR_API(SrvGetConsoleWindow);
|
||||
CSR_API(SrvSetConsoleIcon);
|
||||
CSR_API(SrvGetConsoleCP);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#define ConioResizeTerminal(Console) (Console)->TermIFace.Vtbl->ResizeTerminal((Console))
|
||||
#define ConioProcessKeyCallback(Console, Msg, KeyStateMenu, ShiftState, VirtualKeyCode, Down) \
|
||||
(Console)->TermIFace.Vtbl->ProcessKeyCallback((Console), (Msg), (KeyStateMenu), (ShiftState), (VirtualKeyCode), (Down))
|
||||
#define ConioGetLargestConsoleWindowSize(Console, pSize) \
|
||||
(Console)->TermIFace.Vtbl->GetLargestConsoleWindowSize((Console), (pSize))
|
||||
#define ConioGetConsoleWindowHandle(Console) \
|
||||
(Console)->TermIFace.Vtbl->GetConsoleWindowHandle((Console))
|
||||
#define ConioRefreshInternalInfo(Console) \
|
||||
|
|
|
@ -1261,10 +1261,10 @@ CSR_API(SrvGetConsoleHardwareState)
|
|||
PCONSOLE Console;
|
||||
|
||||
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||
HardwareStateRequest->OutputHandle,
|
||||
&Buff,
|
||||
GENERIC_READ,
|
||||
TRUE);
|
||||
HardwareStateRequest->OutputHandle,
|
||||
&Buff,
|
||||
GENERIC_READ,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to get console handle in SrvGetConsoleHardwareState\n");
|
||||
|
@ -1286,10 +1286,10 @@ CSR_API(SrvSetConsoleHardwareState)
|
|||
PCONSOLE Console;
|
||||
|
||||
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||
HardwareStateRequest->OutputHandle,
|
||||
&Buff,
|
||||
GENERIC_WRITE,
|
||||
TRUE);
|
||||
HardwareStateRequest->OutputHandle,
|
||||
&Buff,
|
||||
GENERIC_WRITE,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to get console handle in SrvSetConsoleHardwareState\n");
|
||||
|
@ -1365,6 +1365,87 @@ CSR_API(SrvSetConsoleDisplayMode)
|
|||
return Status;
|
||||
}
|
||||
|
||||
CSR_API(SrvGetLargestConsoleWindowSize)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PCONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetLargestWindowSizeRequest;
|
||||
PCONSOLE_SCREEN_BUFFER Buff;
|
||||
PCONSOLE Console;
|
||||
|
||||
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||
GetLargestWindowSizeRequest->OutputHandle,
|
||||
&Buff,
|
||||
GENERIC_READ,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
Console = Buff->Header.Console;
|
||||
ConioGetLargestConsoleWindowSize(Console, &GetLargestWindowSizeRequest->Size);
|
||||
|
||||
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(SrvSetConsoleWindowInfo)
|
||||
{
|
||||
#if 0
|
||||
NTSTATUS Status;
|
||||
#endif
|
||||
PCONSOLE_SETWINDOWINFO SetWindowInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetWindowInfoRequest;
|
||||
#if 0
|
||||
PCONSOLE_SCREEN_BUFFER Buff;
|
||||
PCONSOLE Console;
|
||||
#endif
|
||||
SMALL_RECT WindowRect = SetWindowInfoRequest->WindowRect;
|
||||
|
||||
#if 0
|
||||
Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
|
||||
SetWindowInfoRequest->OutputHandle,
|
||||
&Buff,
|
||||
GENERIC_READ,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
Console = Buff->Header.Console;
|
||||
|
||||
if (SetWindowInfoRequest->Absolute == FALSE)
|
||||
{
|
||||
/* Relative positions given. Transform them to absolute ones */
|
||||
WindowRect.Left += Buff->ShowX;
|
||||
WindowRect.Top += Buff->ShowY;
|
||||
WindowRect.Right += Buff->ShowX + Console->ConsoleSize.X - 1;
|
||||
WindowRect.Bottom += Buff->ShowY + Console->ConsoleSize.Y - 1;
|
||||
}
|
||||
|
||||
if ( (WindowRect.Left < 0) || (WindowRect.Top < 0) ||
|
||||
(WindowRect.Right > ScreenBufferSize.X) ||
|
||||
(WindowRect.Bottom > ScreenBufferSize.Y) ||
|
||||
(WindowRect.Right <= WindowRect.Left) ||
|
||||
(WindowRect.Bottom <= WindowRect.Top) )
|
||||
{
|
||||
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Buff->ShowX = WindowRect.Left;
|
||||
Buff->ShowY = WindowRect.Top;
|
||||
|
||||
// These two lines are frontend-specific.
|
||||
Console->ConsoleSize.X = WindowRect.Right - WindowRect.Left + 1;
|
||||
Console->ConsoleSize.Y = WindowRect.Bottom - WindowRect.Top + 1;
|
||||
|
||||
// ConioGetLargestConsoleWindowSize(Console, &GetLargestWindowSizeRequest->Size);
|
||||
|
||||
ConSrvReleaseScreenBuffer(Buff, TRUE);
|
||||
return STATUS_SUCCESS;
|
||||
#else
|
||||
DPRINT1("SrvSetConsoleWindowInfo(0x%08x, %d, {L%d, T%d, R%d, B%d}) UNIMPLEMENTED\n",
|
||||
SetWindowInfoRequest->OutputHandle, SetWindowInfoRequest->Absolute,
|
||||
WindowRect.Left, WindowRect.Top, WindowRect.Right, WindowRect.Bottom);
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
CSR_API(SrvGetConsoleWindow)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
@ -1375,8 +1456,8 @@ CSR_API(SrvGetConsoleWindow)
|
|||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
GetWindowRequest->WindowHandle = ConioGetConsoleWindowHandle(Console);
|
||||
ConSrvReleaseConsole(Console, TRUE);
|
||||
|
||||
ConSrvReleaseConsole(Console, TRUE);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1394,7 +1475,6 @@ CSR_API(SrvSetConsoleIcon)
|
|||
: STATUS_UNSUCCESSFUL);
|
||||
|
||||
ConSrvReleaseConsole(Console, TRUE);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -1326,7 +1326,7 @@ GuiConsoleGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo)
|
|||
|
||||
if (!ConSrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
|
||||
|
||||
windx = CONGUI_MIN_WIDTH * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE));
|
||||
windx = CONGUI_MIN_WIDTH * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE));
|
||||
windy = CONGUI_MIN_HEIGHT * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION);
|
||||
|
||||
minMaxInfo->ptMinTrackSize.x = windx;
|
||||
|
@ -2321,6 +2321,39 @@ GuiGetConsoleWindowHandle(PCONSOLE Console)
|
|||
return GuiData->hWindow;
|
||||
}
|
||||
|
||||
static VOID WINAPI
|
||||
GuiGetLargestConsoleWindowSize(PCONSOLE Console, PCOORD pSize)
|
||||
{
|
||||
PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
|
||||
HWND hDesktop;
|
||||
RECT desktop;
|
||||
LONG width, height;
|
||||
|
||||
if (!pSize) return;
|
||||
|
||||
/*
|
||||
* This is one solution. Surely better solutions exist :
|
||||
* http://stackoverflow.com/questions/4631292/how-detect-current-screen-resolution
|
||||
* http://www.clearevo.com/blog/programming/2011/08/30/windows_c_c++_-_get_monitor_display_screen_size_in_pixels.html
|
||||
*/
|
||||
hDesktop = GetDesktopWindow();
|
||||
if (!hDesktop) return;
|
||||
|
||||
GetWindowRect(hDesktop, &desktop);
|
||||
|
||||
width = desktop.right;
|
||||
height = desktop.bottom;
|
||||
|
||||
width -= (2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)));
|
||||
height -= (2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION));
|
||||
|
||||
if (width < 0) width = 0;
|
||||
if (height < 0) height = 0;
|
||||
|
||||
pSize->X = (SHORT)(width / GuiData->CharWidth );
|
||||
pSize->Y = (SHORT)(height / GuiData->CharHeight);
|
||||
}
|
||||
|
||||
static FRONTEND_VTBL GuiVtbl =
|
||||
{
|
||||
GuiCleanupConsole,
|
||||
|
@ -2335,7 +2368,8 @@ static FRONTEND_VTBL GuiVtbl =
|
|||
GuiRefreshInternalInfo,
|
||||
GuiChangeTitle,
|
||||
GuiChangeIcon,
|
||||
GuiGetConsoleWindowHandle
|
||||
GuiGetConsoleWindowHandle,
|
||||
GuiGetLargestConsoleWindowSize
|
||||
};
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
|
|
|
@ -125,6 +125,8 @@ typedef struct _FRONTEND_VTBL
|
|||
BOOL (WINAPI *ChangeIcon)(struct _CONSOLE* Console,
|
||||
HICON hWindowIcon);
|
||||
HWND (WINAPI *GetConsoleWindowHandle)(struct _CONSOLE* Console);
|
||||
VOID (WINAPI *GetLargestConsoleWindowSize)(struct _CONSOLE* Console,
|
||||
PCOORD pSize);
|
||||
|
||||
} FRONTEND_VTBL, *PFRONTEND_VTBL;
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@ PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber - CONSRV_FIR
|
|||
SrvSetConsoleMode,
|
||||
SrvSetConsoleActiveScreenBuffer,
|
||||
SrvFlushConsoleInputBuffer,
|
||||
// SrvGetLargestConsoleWindowSize,
|
||||
SrvGetLargestConsoleWindowSize,
|
||||
SrvSetConsoleScreenBufferSize,
|
||||
SrvSetConsoleCursorPosition,
|
||||
SrvSetConsoleCursorInfo,
|
||||
// SrvSetConsoleWindowInfo,
|
||||
SrvSetConsoleWindowInfo,
|
||||
SrvScrollConsoleScreenBuffer,
|
||||
SrvSetConsoleTextAttribute,
|
||||
// SrvSetConsoleFont,
|
||||
|
@ -138,11 +138,11 @@ BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber - CONSRV_FIRST_API
|
|||
FALSE, // SrvSetConsoleMode,
|
||||
FALSE, // SrvSetConsoleActiveScreenBuffer,
|
||||
FALSE, // SrvFlushConsoleInputBuffer,
|
||||
// FALSE, // SrvGetLargestConsoleWindowSize,
|
||||
FALSE, // SrvGetLargestConsoleWindowSize,
|
||||
FALSE, // SrvSetConsoleScreenBufferSize,
|
||||
FALSE, // SrvSetConsoleCursorPosition,
|
||||
FALSE, // SrvSetConsoleCursorInfo,
|
||||
// FALSE, // SrvSetConsoleWindowInfo,
|
||||
FALSE, // SrvSetConsoleWindowInfo,
|
||||
FALSE, // SrvScrollConsoleScreenBuffer,
|
||||
FALSE, // SrvSetConsoleTextAttribute,
|
||||
// FALSE, // SrvSetConsoleFont,
|
||||
|
@ -229,11 +229,11 @@ PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber - CONSRV_FIRST_API_NUMBER]
|
|||
"SetConsoleMode",
|
||||
"SetConsoleActiveScreenBuffer",
|
||||
"FlushConsoleInputBuffer",
|
||||
// "GetLargestConsoleWindowSize",
|
||||
"GetLargestConsoleWindowSize",
|
||||
"SetConsoleScreenBufferSize",
|
||||
"SetConsoleCursorPosition",
|
||||
"SetConsoleCursorInfo",
|
||||
// "SetConsoleWindowInfo",
|
||||
"SetConsoleWindowInfo",
|
||||
"ScrollConsoleScreenBuffer",
|
||||
"SetConsoleTextAttribute",
|
||||
// "SetConsoleFont",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue