From caf3fbb9826536a671211af6e8fc6d2e55c44a66 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Fri, 21 Jan 2022 16:21:09 -0400 Subject: [PATCH] Fixed CI build --- base/win32.h | 4 ++-- screen/screengrab_c.h | 4 ++-- window/pub.h | 21 +++++++++++++-------- window/win_sys.h | 4 ++-- window/window.h | 7 ++----- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/base/win32.h b/base/win32.h index d5b458e..d4e2485 100644 --- a/base/win32.h +++ b/base/win32.h @@ -1,8 +1,8 @@ #if defined(IS_WINDOWS) - bool CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { uint32_t *count = (uint32_t*)dwData; (*count)++; - return true; + return TRUE; } typedef struct{ diff --git a/screen/screengrab_c.h b/screen/screengrab_c.h index 32367b5..7464c8d 100644 --- a/screen/screengrab_c.h +++ b/screen/screengrab_c.h @@ -52,7 +52,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id) #elif defined(USE_X11) MMBitmapRef bitmap; Display *display; - if display_id == -1 { + if (display_id == -1) { display = XOpenDisplay(NULL); } else { display = XGetMainDisplay(); @@ -92,7 +92,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id) bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biClrImportant = 0; - if display_id == -1 { + if (display_id == -1) { screen = GetDC(NULL); /* Get entire screen */ } else { screen = GetDC((HWND) display_id); diff --git a/window/pub.h b/window/pub.h index a30d52f..eee39b4 100644 --- a/window/pub.h +++ b/window/pub.h @@ -9,10 +9,15 @@ // except according to those terms. // #include "../base/os.h" +#if defined(IS_MACOSX) + #include +#elif defined(USE_X11) + #include +#endif #ifdef RobotGo_64 - typedef int64 intptr; - typedef uint64 uintptr; + typedef int64_t intptr; + typedef uint64_t uintptr; #else typedef int32_t intptr; typedef uint32_t uintptr; // Unsigned pointer integer @@ -177,7 +182,7 @@ typedef struct _Bounds Bounds; } // Functions - static void* GetWindowProperty(MData win, Atom atom, uint32* items) { + static void* GetWindowProperty(MData win, Atom atom, uint32_t* items) { // Property variables Atom type; int format; unsigned long nItems; @@ -253,15 +258,15 @@ typedef struct _Bounds Bounds; Bounds frame; // Retrieve frame bounds if (WM_EXTENTS != None) { - long* result; uint32 nItems = 0; + long* result; uint32_t nItems = 0; // Get the window extents property result = (long*) GetWindowProperty(win, WM_EXTENTS, &nItems); if (result != NULL) { if (nItems == 4) { - frame.X = (int32) result[0]; - frame.Y = (int32) result[2]; - frame.W = (int32) result[0] + (int32) result[1]; - frame.H = (int32) result[2] + (int32) result[3]; + frame.X = (int32_t) result[0]; + frame.Y = (int32_t) result[2]; + frame.W = (int32_t) result[0] + (int32_t) result[1]; + frame.H = (int32_t) result[2] + (int32_t) result[3]; } XFree(result); diff --git a/window/win_sys.h b/window/win_sys.h index 3710eb9..236d3ae 100644 --- a/window/win_sys.h +++ b/window/win_sys.h @@ -164,7 +164,7 @@ Bounds get_bounds(uintptr pid, uintptr isHwnd){ #endif } -Bounds get_client(uintptr pid, uintptr isHwnd){ +Bounds get_client(uintptr pid, uintptr isHwnd) { // Check if the window is valid Bounds bounds; if (!IsValid()) { return bounds; } @@ -183,7 +183,7 @@ Bounds get_client(uintptr pid, uintptr isHwnd){ Window root, parent; Window* children; unsigned int count; - int32 x = 0, y = 0; + int32_t x = 0, y = 0; // Check if the window is the root XQueryTree(rDisplay, win.XWin, diff --git a/window/window.h b/window/window.h index 83bd7b7..6ff4935 100644 --- a/window/window.h +++ b/window/window.h @@ -10,9 +10,6 @@ // #include "../base/os.h" #include "pub.h" -#if defined(IS_MACOSX) - #include -#endif bool setHandle(uintptr handle); bool IsValid(); @@ -447,7 +444,7 @@ MData GetActive(void) { // Attempt to get the foreground window multiple times in case MData result; - uint8 times = 0; + uint8_t times = 0; while (++times < 20) { HWND handle; handle = GetForegroundWindow(); @@ -626,7 +623,7 @@ int32_t WGetPID(void) { // Check result and convert it if (result == NULL) { return 0; } - int32 pid = (int32) *result; + int32_t pid = (int32_t) *result; XFree(result); return pid; #elif defined(IS_WINDOWS)