mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Fixed CI build
This commit is contained in:
parent
481fbb72a5
commit
caf3fbb982
@ -1,8 +1,8 @@
|
|||||||
#if defined(IS_WINDOWS)
|
#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;
|
uint32_t *count = (uint32_t*)dwData;
|
||||||
(*count)++;
|
(*count)++;
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
@ -52,7 +52,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id)
|
|||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
MMBitmapRef bitmap;
|
MMBitmapRef bitmap;
|
||||||
Display *display;
|
Display *display;
|
||||||
if display_id == -1 {
|
if (display_id == -1) {
|
||||||
display = XOpenDisplay(NULL);
|
display = XOpenDisplay(NULL);
|
||||||
} else {
|
} else {
|
||||||
display = XGetMainDisplay();
|
display = XGetMainDisplay();
|
||||||
@ -92,7 +92,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id)
|
|||||||
bi.bmiHeader.biClrUsed = 0;
|
bi.bmiHeader.biClrUsed = 0;
|
||||||
bi.bmiHeader.biClrImportant = 0;
|
bi.bmiHeader.biClrImportant = 0;
|
||||||
|
|
||||||
if display_id == -1 {
|
if (display_id == -1) {
|
||||||
screen = GetDC(NULL); /* Get entire screen */
|
screen = GetDC(NULL); /* Get entire screen */
|
||||||
} else {
|
} else {
|
||||||
screen = GetDC((HWND) display_id);
|
screen = GetDC((HWND) display_id);
|
||||||
|
21
window/pub.h
21
window/pub.h
@ -9,10 +9,15 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// #include "../base/os.h"
|
// #include "../base/os.h"
|
||||||
|
#if defined(IS_MACOSX)
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#elif defined(USE_X11)
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RobotGo_64
|
#ifdef RobotGo_64
|
||||||
typedef int64 intptr;
|
typedef int64_t intptr;
|
||||||
typedef uint64 uintptr;
|
typedef uint64_t uintptr;
|
||||||
#else
|
#else
|
||||||
typedef int32_t intptr;
|
typedef int32_t intptr;
|
||||||
typedef uint32_t uintptr; // Unsigned pointer integer
|
typedef uint32_t uintptr; // Unsigned pointer integer
|
||||||
@ -177,7 +182,7 @@ typedef struct _Bounds Bounds;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
static void* GetWindowProperty(MData win, Atom atom, uint32* items) {
|
static void* GetWindowProperty(MData win, Atom atom, uint32_t* items) {
|
||||||
// Property variables
|
// Property variables
|
||||||
Atom type; int format;
|
Atom type; int format;
|
||||||
unsigned long nItems;
|
unsigned long nItems;
|
||||||
@ -253,15 +258,15 @@ typedef struct _Bounds Bounds;
|
|||||||
Bounds frame;
|
Bounds frame;
|
||||||
// Retrieve frame bounds
|
// Retrieve frame bounds
|
||||||
if (WM_EXTENTS != None) {
|
if (WM_EXTENTS != None) {
|
||||||
long* result; uint32 nItems = 0;
|
long* result; uint32_t nItems = 0;
|
||||||
// Get the window extents property
|
// Get the window extents property
|
||||||
result = (long*) GetWindowProperty(win, WM_EXTENTS, &nItems);
|
result = (long*) GetWindowProperty(win, WM_EXTENTS, &nItems);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
if (nItems == 4) {
|
if (nItems == 4) {
|
||||||
frame.X = (int32) result[0];
|
frame.X = (int32_t) result[0];
|
||||||
frame.Y = (int32) result[2];
|
frame.Y = (int32_t) result[2];
|
||||||
frame.W = (int32) result[0] + (int32) result[1];
|
frame.W = (int32_t) result[0] + (int32_t) result[1];
|
||||||
frame.H = (int32) result[2] + (int32) result[3];
|
frame.H = (int32_t) result[2] + (int32_t) result[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree(result);
|
XFree(result);
|
||||||
|
@ -164,7 +164,7 @@ Bounds get_bounds(uintptr pid, uintptr isHwnd){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Bounds get_client(uintptr pid, uintptr isHwnd){
|
Bounds get_client(uintptr pid, uintptr isHwnd) {
|
||||||
// Check if the window is valid
|
// Check if the window is valid
|
||||||
Bounds bounds;
|
Bounds bounds;
|
||||||
if (!IsValid()) { return bounds; }
|
if (!IsValid()) { return bounds; }
|
||||||
@ -183,7 +183,7 @@ Bounds get_client(uintptr pid, uintptr isHwnd){
|
|||||||
Window root, parent;
|
Window root, parent;
|
||||||
Window* children;
|
Window* children;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
int32 x = 0, y = 0;
|
int32_t x = 0, y = 0;
|
||||||
|
|
||||||
// Check if the window is the root
|
// Check if the window is the root
|
||||||
XQueryTree(rDisplay, win.XWin,
|
XQueryTree(rDisplay, win.XWin,
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
// #include "../base/os.h"
|
// #include "../base/os.h"
|
||||||
#include "pub.h"
|
#include "pub.h"
|
||||||
#if defined(IS_MACOSX)
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool setHandle(uintptr handle);
|
bool setHandle(uintptr handle);
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
@ -447,7 +444,7 @@ MData GetActive(void) {
|
|||||||
// Attempt to get the foreground window multiple times in case
|
// Attempt to get the foreground window multiple times in case
|
||||||
MData result;
|
MData result;
|
||||||
|
|
||||||
uint8 times = 0;
|
uint8_t times = 0;
|
||||||
while (++times < 20) {
|
while (++times < 20) {
|
||||||
HWND handle;
|
HWND handle;
|
||||||
handle = GetForegroundWindow();
|
handle = GetForegroundWindow();
|
||||||
@ -626,7 +623,7 @@ int32_t WGetPID(void) {
|
|||||||
// Check result and convert it
|
// Check result and convert it
|
||||||
if (result == NULL) { return 0; }
|
if (result == NULL) { return 0; }
|
||||||
|
|
||||||
int32 pid = (int32) *result;
|
int32_t pid = (int32_t) *result;
|
||||||
XFree(result);
|
XFree(result);
|
||||||
return pid;
|
return pid;
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
|
Loading…
Reference in New Issue
Block a user