mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
update code style
This commit is contained in:
parent
35f5016d33
commit
15233120e0
@ -15,8 +15,8 @@
|
||||
// #include "../MMBitmap_c.h"
|
||||
|
||||
void padHex(MMRGBHex color, char* hex){
|
||||
//Length needs to be 7 because snprintf includes a terminating null.
|
||||
//Use %06x to pad hex value with leading 0s.
|
||||
// Length needs to be 7 because snprintf includes a terminating null.
|
||||
// Use %06x to pad hex value with leading 0s.
|
||||
snprintf(hex, 7, "%06x", color);
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,7 @@
|
||||
// #include "../base/xdisplay_c.h"
|
||||
#endif
|
||||
|
||||
MMSize getMainDisplaySize(void)
|
||||
{
|
||||
MMSize getMainDisplaySize(void){
|
||||
#if defined(IS_MACOSX)
|
||||
CGDirectDisplayID displayID = CGMainDisplayID();
|
||||
return MMSizeMake(CGDisplayPixelsWide(displayID),
|
||||
@ -26,8 +25,7 @@ MMSize getMainDisplaySize(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool pointVisibleOnMainDisplay(MMPoint point)
|
||||
{
|
||||
bool pointVisibleOnMainDisplay(MMPoint point){
|
||||
MMSize displaySize = getMainDisplaySize();
|
||||
return point.x < displaySize.width && point.y < displaySize.height;
|
||||
}
|
||||
|
@ -17,8 +17,7 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
MMBitmapRef copyMMBitmapFromDisplayInRect(MMRect rect)
|
||||
{
|
||||
MMBitmapRef copyMMBitmapFromDisplayInRect(MMRect rect){
|
||||
#if defined(IS_MACOSX)
|
||||
|
||||
MMBitmapRef bitmap = NULL;
|
||||
|
@ -37,7 +37,7 @@ void aWindow();
|
||||
|
||||
#if defined(IS_MACOSX)
|
||||
|
||||
static Boolean (*gAXIsProcessTrustedWithOptions) (CFDictionaryRef);
|
||||
static Boolean(*gAXIsProcessTrustedWithOptions) (CFDictionaryRef);
|
||||
|
||||
static CFStringRef* gkAXTrustedCheckOptionPrompt;
|
||||
|
||||
@ -57,7 +57,7 @@ void aWindow();
|
||||
CFRelease(wlist);
|
||||
|
||||
// Check whether the resulting array is populated
|
||||
if (info != NULL && CFArrayGetCount (info) > 0){
|
||||
if (info != NULL && CFArrayGetCount(info) > 0){
|
||||
// Retrieve description from info array
|
||||
CFDictionaryRef desc = (CFDictionaryRef)CFArrayGetValueAtIndex(info, 0);
|
||||
|
||||
@ -104,7 +104,7 @@ void aWindow();
|
||||
// Check results
|
||||
if (temp == win){
|
||||
// Retain element
|
||||
CFRetain (element);
|
||||
CFRetain(element);
|
||||
result = element;
|
||||
break;
|
||||
}
|
||||
@ -129,12 +129,12 @@ void aWindow();
|
||||
void XDismissErrors (void){
|
||||
Display *rDisplay = XOpenDisplay(NULL);
|
||||
// Save old handler and dismiss errors
|
||||
mOld = XSetErrorHandler (XHandleError);
|
||||
mOld = XSetErrorHandler(XHandleError);
|
||||
// Flush output buffer
|
||||
XSync (rDisplay, False);
|
||||
XSync(rDisplay, False);
|
||||
|
||||
// Reinstate old handler
|
||||
XSetErrorHandler (mOld);
|
||||
XSetErrorHandler(mOld);
|
||||
}
|
||||
|
||||
// Definitions
|
||||
@ -576,7 +576,7 @@ void SetActive(const MData win){
|
||||
!= kAXErrorSuccess){
|
||||
pid_t pid = 0;
|
||||
// Attempt to retrieve the PID of the window
|
||||
if (AXUIElementGetPid (win.AxID, &pid)
|
||||
if (AXUIElementGetPid(win.AxID, &pid)
|
||||
!= kAXErrorSuccess || !pid) {return;}
|
||||
|
||||
// Ignore deprecated warnings
|
||||
@ -589,7 +589,7 @@ void SetActive(const MData win){
|
||||
|
||||
ProcessSerialNumber psn;
|
||||
// Attempt to retrieve the process psn
|
||||
if (GetProcessForPID (pid, &psn) == 0){
|
||||
if (GetProcessForPID(pid, &psn) == 0){
|
||||
// Gracefully activate process
|
||||
SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
|
||||
}
|
||||
@ -609,8 +609,7 @@ void SetActive(const MData win){
|
||||
if (WM_ACTIVE != None){
|
||||
// Retrieve the screen number
|
||||
XWindowAttributes attr = { 0 };
|
||||
XGetWindowAttributes (rDisplay,
|
||||
win.XWin, &attr);
|
||||
XGetWindowAttributes(rDisplay, win.XWin, &attr);
|
||||
int s = XScreenNumberOfScreen(attr.screen);
|
||||
|
||||
// Prepare an event
|
||||
@ -676,7 +675,7 @@ MData GetActive(void){
|
||||
|
||||
CGWindowID win = 0;
|
||||
// Use undocumented API to get WID
|
||||
if (_AXUIElementGetWindow (element, &win)
|
||||
if (_AXUIElementGetWindow(element, &win)
|
||||
== kAXErrorSuccess && win){
|
||||
// Manually set internals
|
||||
result.CgID = win;
|
||||
@ -763,8 +762,8 @@ void SetTopMost(bool state){
|
||||
#elif defined(USE_X11)
|
||||
|
||||
// Ignore X errors
|
||||
// XDismissErrors ();
|
||||
// SetState (mData.XWin, STATE_TOPMOST, state);
|
||||
// XDismissErrors();
|
||||
// SetState(mData.XWin, STATE_TOPMOST, state);
|
||||
|
||||
#elif defined(IS_WINDOWS)
|
||||
|
||||
@ -817,7 +816,7 @@ char *GetTitle(){
|
||||
CFStringRef data = NULL;
|
||||
|
||||
// Determine the current title of the window
|
||||
if (AXUIElementCopyAttributeValue (mData.AxID,
|
||||
if (AXUIElementCopyAttributeValue(mData.AxID,
|
||||
kAXTitleAttribute, (CFTypeRef*) &data)
|
||||
== kAXErrorSuccess && data != NULL){
|
||||
char conv[512];
|
||||
@ -872,7 +871,7 @@ char *GetTitle(){
|
||||
(mData.HWnd, mData.Title, 512) > 0 ? mData.Title : "";
|
||||
// return GetWindowText
|
||||
// (mData.HWnd, name, 512) > 0 ?
|
||||
// _UTF8Encode (name) : "null";
|
||||
// _UTF8Encode(name) : "null";
|
||||
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user