Rect->bottom = (SmallRect->Bottom + 1 - Buffer->ViewOrigin.Y) * HeightUnit;
}
-static VOID NTAPI
-GuiDrawRegion(IN OUT PFRONTEND This,
- SMALL_RECT* Region);
+static VOID
+DrawRegion(PGUI_CONSOLE_DATA GuiData,
+ SMALL_RECT* Region)
+{
+ RECT RegionRect;
+
+ SmallRectToRect(GuiData, &RegionRect, Region);
+ /* Do not erase the background: it speeds up redrawing and reduce flickering */
+ InvalidateRect(GuiData->hWindow, &RegionRect, FALSE);
+ /**UpdateWindow(GuiData->hWindow);**/
+}
+
VOID
-GuiInvalidateCell(IN OUT PFRONTEND This, SHORT x, SHORT y)
+InvalidateCell(PGUI_CONSOLE_DATA GuiData,
+ SHORT x, SHORT y)
{
SMALL_RECT CellRect = { x, y, x, y };
- GuiDrawRegion(This, &CellRect);
+ DrawRegion(GuiData, &CellRect);
}
PCONSOLE Console = GuiData->Console;
RECT rcWnd;
+ DPRINT("PM_CREATE_CONSOLE -- creating window\n");
+
NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE,
GUI_CONWND_CLASS,
Console->Title.Buffer,
WindowCount++;
SetWindowLongW(hWnd, GWL_USERDATA, WindowCount);
- DPRINT("Set icons via PM_CREATE_CONSOLE\n");
- if (GuiData->hIcon == NULL)
- {
- DPRINT("Not really /o\\...\n");
- GuiData->hIcon = ghDefaultIcon;
- GuiData->hIconSm = ghDefaultIconSm;
- }
- else if (GuiData->hIcon != ghDefaultIcon)
- {
- DPRINT("Yes \\o/\n");
- SendMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG, (LPARAM)GuiData->hIcon);
- SendMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm);
- }
+ //
+ // FIXME: TODO: Move everything there into conwnd.c!OnNcCreate()
+ //
/* Retrieve our real position */
+ // See conwnd.c!OnMove()
GetWindowRect(GuiData->hWindow, &rcWnd);
GuiData->GuiInfo.WindowOrigin.x = rcWnd.left;
GuiData->GuiInfo.WindowOrigin.y = rcWnd.top;
/* Move and resize the window to the user's values */
/* CAN WE DEADLOCK ?? */
- GuiConsoleMoveWindow(GuiData);
+ GuiConsoleMoveWindow(GuiData); // FIXME: This MUST be done via the CreateWindowExW call.
SendMessageW(GuiData->hWindow, PM_RESIZE_TERMINAL, 0, 0);
/* Switch to full-screen mode if necessary */
+ // FIXME: Move elsewhere, it cause misdrawings of the window.
if (GuiData->GuiInfo.FullScreen) SwitchFullScreen(GuiData, TRUE);
+ DPRINT("PM_CREATE_CONSOLE -- showing window\n");
// ShowWindow(NewWindow, (int)wParam);
ShowWindowAsync(NewWindow, (int)wParam);
DPRINT("Window showed\n");
DPRINT1("CONSRV: Failed to create GUI_CONSOLE_DATA\n");
return STATUS_UNSUCCESSFUL;
}
- /* HACK */ Console->TermIFace.Data = (PVOID)GuiData; /* HACK */
+ ///// /* HACK */ Console->TermIFace.Data = (PVOID)GuiData; /* HACK */
GuiData->Console = Console;
GuiData->ActiveBuffer = Console->ActiveBuffer;
GuiData->hWindow = NULL;
&hIconSm,
1);
DPRINT("hIcon = 0x%p ; hIconSm = 0x%p\n", hIcon, hIconSm);
- if (hIcon != NULL)
- {
- DPRINT("Effectively set the icons\n");
- GuiData->hIcon = hIcon;
- GuiData->hIconSm = hIconSm;
- }
+ if (hIcon != NULL) GuiData->hIcon = hIcon;
+ if (hIconSm != NULL) GuiData->hIconSm = hIconSm;
}
+ ASSERT(GuiData->hIcon && GuiData->hIconSm);
/* Mouse is shown by default with its default cursor shape */
GuiData->hCursor = ghDefaultCursor;
/* There is no user-reserved menu id range by default */
GuiData->CmdIdLow = GuiData->CmdIdHigh = 0;
+ /* Initialize the selection */
+ RtlZeroMemory(&GuiData->Selection, sizeof(CONSOLE_SELECTION_INFO));
+ GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION;
+
/*
* We need to wait until the GUI has been fully initialized
* to retrieve custom settings i.e. WindowSize etc...
SMALL_RECT* Region)
{
PGUI_CONSOLE_DATA GuiData = This->Data;
- RECT RegionRect;
-
- SmallRectToRect(GuiData, &RegionRect, Region);
- /* Do not erase the background: it speeds up redrawing and reduce flickering */
- InvalidateRect(GuiData->hWindow, &RegionRect, FALSE);
- /**UpdateWindow(GuiData->hWindow);**/
+ DrawRegion(GuiData, Region);
}
static VOID NTAPI
SW_INVALIDATE);
}
- GuiDrawRegion(This, Region);
+ DrawRegion(GuiData, Region);
if (CursorStartX < Region->Left || Region->Right < CursorStartX
|| CursorStartY < Region->Top || Region->Bottom < CursorStartY)
{
- GuiInvalidateCell(This, CursorStartX, CursorStartY);
+ InvalidateCell(GuiData, CursorStartX, CursorStartY);
}
CursorEndX = Buff->CursorPosition.X;
|| CursorEndY < Region->Top || Region->Bottom < CursorEndY)
&& (CursorEndX != CursorStartX || CursorEndY != CursorStartY))
{
- GuiInvalidateCell(This, CursorEndX, CursorEndY);
+ InvalidateCell(GuiData, CursorEndX, CursorEndY);
}
// HACK!!
if (GuiData->ActiveBuffer == Buff)
{
- GuiInvalidateCell(This, Buff->CursorPosition.X, Buff->CursorPosition.Y);
+ InvalidateCell(GuiData, Buff->CursorPosition.X, Buff->CursorPosition.Y);
}
return TRUE;
if (GuiData->ActiveBuffer == Buff)
{
/* Redraw char at old position (remove cursor) */
- GuiInvalidateCell(This, OldCursorX, OldCursorY);
+ InvalidateCell(GuiData, OldCursorX, OldCursorY);
/* Redraw char at new position (show cursor) */
- GuiInvalidateCell(This, Buff->CursorPosition.X, Buff->CursorPosition.Y);
+ InvalidateCell(GuiData, Buff->CursorPosition.X, Buff->CursorPosition.Y);
}
return TRUE;
GuiData->hIconSm = hIconSm;
DPRINT("Set icons in GuiChangeIcon\n");
- PostMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG, (LPARAM)GuiData->hIcon);
+ PostMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG , (LPARAM)GuiData->hIcon );
PostMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm);
}
pSize->Y = (SHORT)(height / (int)HeightUnit) /* HACK */ + 1;
}
+static BOOL NTAPI
+GuiGetSelectionInfo(IN OUT PFRONTEND This,
+ PCONSOLE_SELECTION_INFO pSelectionInfo)
+{
+ PGUI_CONSOLE_DATA GuiData = This->Data;
+
+ if (pSelectionInfo == NULL) return FALSE;
+
+ ZeroMemory(pSelectionInfo, sizeof(CONSOLE_SELECTION_INFO));
+ if (GuiData->Selection.dwFlags != CONSOLE_NO_SELECTION)
+ RtlCopyMemory(pSelectionInfo, &GuiData->Selection, sizeof(CONSOLE_SELECTION_INFO));
+
+ return TRUE;
+}
+
static BOOL NTAPI
GuiSetPalette(IN OUT PFRONTEND This,
HPALETTE PaletteHandle,
GuiChangeIcon,
GuiGetConsoleWindowHandle,
GuiGetLargestConsoleWindowSize,
+ GuiGetSelectionInfo,
GuiSetPalette,
GuiGetDisplayMode,
GuiSetDisplayMode,