aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeppe Skov <jsskov92@gmail.com>2023-02-28 23:17:00 +0100
committerJeppe Skov <jsskov92@gmail.com>2023-02-28 23:18:10 +0100
commitffc592c7cfd61425b3377ea0ac544c8117732046 (patch)
tree770a3d9db1ee3e50f831e77b41ab88479995a2d8
parent3567c006e6683d989805c078db48a95a901d9e72 (diff)
Added missing Windows functions for console manipulation
This commit adds several missing types and functions to the Windows implementation to enable manipulation of console windows. The types added include 'SMALL_RECT', 'CONSOLE_SCREEN_BUFFER_INFO', and 'PCONSOLE_SCREEN_BUFFER_INFO'. The functions added include 'GetConsoleScreenBufferInfo', 'SetConsoleScreenBufferSize', and 'SetConsoleWindowInfo'. These functions were necessary to properly manage the console window.
-rw-r--r--core/sys/windows/kernel32.odin3
-rw-r--r--core/sys/windows/types.odin18
2 files changed, 21 insertions, 0 deletions
diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin
index f736696e1..5f09dda3c 100644
--- a/core/sys/windows/kernel32.odin
+++ b/core/sys/windows/kernel32.odin
@@ -370,6 +370,9 @@ foreign kernel32 {
GenerateConsoleCtrlEvent :: proc(dwCtrlEvent: DWORD, dwProcessGroupId: DWORD) -> BOOL ---
FreeConsole :: proc() -> BOOL ---
GetConsoleWindow :: proc() -> HWND ---
+ GetConsoleScreenBufferInfo :: proc(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: PCONSOLE_SCREEN_BUFFER_INFO) -> BOOL ---
+ SetConsoleScreenBufferSize :: proc(hConsoleOutput: HANDLE, dwSize: COORD) -> BOOL ---
+ SetConsoleWindowInfo :: proc(hConsoleOutput: HANDLE, bAbsolute : BOOL, lpConsoleWindow: ^SMALL_RECT) -> BOOL ---
GetDiskFreeSpaceExW :: proc(
lpDirectoryName: LPCWSTR,
diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin
index 1d5bdaf04..10a2e20a7 100644
--- a/core/sys/windows/types.odin
+++ b/core/sys/windows/types.odin
@@ -3884,3 +3884,21 @@ COORD :: struct {
X: SHORT,
Y: SHORT,
}
+
+SMALL_RECT :: struct {
+ Left: SHORT,
+ Top: SHORT,
+ Right: SHORT,
+ Bottom: SHORT,
+}
+
+CONSOLE_SCREEN_BUFFER_INFO :: struct {
+ dwSize: COORD,
+ dwCursorPosition: COORD,
+ wAttributes: WORD,
+ srWindow: SMALL_RECT,
+ dwMaximumWindowSize: COORD,
+}
+
+
+PCONSOLE_SCREEN_BUFFER_INFO :: ^CONSOLE_SCREEN_BUFFER_INFO \ No newline at end of file