Author: janderwald Date: Wed Jul 12 20:48:58 2006 New Revision: 23028
URL: http://svn.reactos.org/svn/reactos?rev=23028&view=rev Log: * set FontName array to max of LF_FACESIZE * read WindowSize from registry * create GUI_CONSOLE_DATA directly in GuiInitConsole * wait untill GuiWindow has been created (needed for synchronization with variable window sizes)
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/conio.c trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/conio.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win3... ============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/conio.c (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/conio.c Wed Jul 12 20:48:58 2006 @@ -114,6 +114,7 @@ Buffer->MaxY = Console->Size.Y; Buffer->ShowX = 0; Buffer->ShowY = 0; + //FIXME Buffer->Buffer = HeapAlloc(Win32CsrApiHeap, 0, Buffer->MaxX * Buffer->MaxY * 2); if (NULL == Buffer->Buffer) { @@ -146,6 +147,7 @@ Console->Title.MaximumLength = Console->Title.Length = 0; Console->Title.Buffer = NULL;
+ //FIXME RtlCreateUnicodeString(&Console->Title, L"Command Prompt");
Console->Header.ReferenceCount = 0; @@ -3022,7 +3024,8 @@
Record->Echoed = FALSE; Record->Fake = FALSE; - Record->InputEvent = *InputRecord++; + //Record->InputEvent = *InputRecord++; + memcpy(&Record->InputEvent, &InputRecord[i], sizeof(INPUT_RECORD)); if (KEY_EVENT == Record->InputEvent.EventType) { /* FIXME - convert from unicode to ascii!! */
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win3... ============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c Wed Jul 12 20:48:58 2006 @@ -31,7 +31,8 @@ POINT SelectionStart; BOOL MouseDown; HMODULE ConsoleLibrary; - WCHAR FontName[128]; + HANDLE hGuiInitEvent; + WCHAR FontName[LF_FACESIZE]; DWORD FontSize; DWORD FontWeight; DWORD CursorSize; @@ -39,6 +40,7 @@ DWORD FullScreen; DWORD QuickEdit; DWORD InsertMode; + DWORD WindowSize; } GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA;
#ifndef WM_APP @@ -270,6 +272,10 @@ { GuiData->HistoryNoDup = Value; } + else if (!wcscmp(szValueName, L"WindowSize")) + { + GuiData->WindowSize = Value; + } else if (!wcscmp(szValueName, L"FullScreen")) { GuiData->FullScreen = Value; @@ -293,6 +299,7 @@
wcscpy(GuiData->FontName, L"Bitstream Vera Sans Mono"); GuiData->FontSize = 0x0008000C; // font is 8x12 + GuiData->WindowSize = 0x00190050; // default window size is 25x80 GuiData->FontWeight = FW_NORMAL; GuiData->CursorSize = 0; GuiData->HistoryNoDup = FALSE; @@ -308,16 +315,13 @@ { RECT Rect; PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE) Create->lpCreateParams; - PGUI_CONSOLE_DATA GuiData; + PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Console->PrivateData; HDC Dc; HFONT OldFont; TEXTMETRICW Metrics; PCSRSS_PROCESS_DATA ProcessData; HKEY hKey;
- GuiData = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, - sizeof(GUI_CONSOLE_DATA) + - (Console->Size.X + 1) * sizeof(WCHAR)); if (NULL == GuiData) { DPRINT1("GuiConsoleNcCreate: HeapAlloc failed\n"); @@ -335,9 +339,13 @@ } }
+ Console->Size.X = LOWORD(GuiData->WindowSize); + Console->Size.Y = HIWORD(GuiData->WindowSize); + InitializeCriticalSection(&GuiData->Lock);
- GuiData->LineBuffer = (PWCHAR)(GuiData + 1); + GuiData->LineBuffer = (PWCHAR)HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, + Console->Size.X * sizeof(WCHAR));
GuiData->Font = CreateFontW(LOWORD(GuiData->FontSize), 0, //HIWORD(GuiData->FontSize), @@ -396,7 +404,7 @@ GuiData->ForceCursorOff = FALSE;
GuiData->Selection.left = -1; - + DPRINT("Console %p GuiData %p\n", Console, GuiData); Console->PrivateData = GuiData; SetWindowLongPtrW(hWnd, GWL_USERDATA, (DWORD_PTR) Console);
@@ -409,6 +417,7 @@ Rect.bottom - Rect.top, FALSE);
SetTimer(hWnd, 1, CURSOR_BLINK_TIME, NULL); + SetEvent(GuiData->hGuiInitEvent);
return (BOOL) DefWindowProcW(hWnd, WM_NCCREATE, 0, (LPARAM) Create); } @@ -1487,6 +1496,7 @@ { HANDLE GraphicsStartupEvent; HANDLE ThreadHandle; + PGUI_CONSOLE_DATA GuiData;
if (! ConsInitialized) { @@ -1499,8 +1509,6 @@ }
Console->Vtbl = &GuiVtbl; - Console->Size.X = 80; - Console->Size.Y = 25; if (NULL == NotifyWnd) { GraphicsStartupEvent = CreateEventW(NULL, FALSE, FALSE, NULL); @@ -1533,8 +1541,31 @@ return STATUS_UNSUCCESSFUL; } } - - PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, 0, (LPARAM) Console); + GuiData = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, + sizeof(GUI_CONSOLE_DATA)); + if (!GuiData) + { + DPRINT1("Win32Csr: Failed to create GUI_CONSOLE_DATA\n"); + return STATUS_UNSUCCESSFUL; + } + + Console->PrivateData = (PVOID) GuiData; + /* + * we need to wait untill the GUI has been fully initialized + * to retrieve custom settings i.e. WindowSize etc.. + * Ideally we could use SendNotifyMessage for this but its not + * yet implemented. + * + */ + GuiData->hGuiInitEvent = CreateEventW(NULL, FALSE, FALSE, NULL); + /* create console */ + PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, 0, (LPARAM) Console); + + /* wait untill initialization has finished */ + WaitForSingleObject(GuiData->hGuiInitEvent, INFINITE); + DPRINT("received event Console %p GuiData %p X %d Y %d\n", Console, Console->PrivateData, Console->Size.X, Console->Size.Y); + CloseHandle(GuiData->hGuiInitEvent); + GuiData->hGuiInitEvent = NULL;
return STATUS_SUCCESS; }