-
Notifications
You must be signed in to change notification settings - Fork 913
/
Copy pathgoWindow.h
69 lines (62 loc) · 1.89 KB
/
goWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright 2016 The go-vgo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#include "alert_c.h"
#include "window.h"
#include "win_sys.h"
void min_window(uintptr pid, bool state, int8_t isPid){
#if defined(IS_MACOSX)
// return 0;
AXUIElementRef axID = AXUIElementCreateApplication(pid);
AXUIElementSetAttributeValue(axID, kAXMinimizedAttribute,
state ? kCFBooleanTrue : kCFBooleanFalse);
#elif defined(USE_X11)
// Ignore X errors
XDismissErrors();
// SetState((Window)pid, STATE_MINIMIZE, state);
#elif defined(IS_WINDOWS)
HWND hwnd = getHwnd(pid, isPid);
win_min(hwnd, state);
#endif
}
void max_window(uintptr pid, bool state, int8_t isPid){
#if defined(IS_MACOSX)
// return 0;
#elif defined(USE_X11)
XDismissErrors();
// SetState((Window)pid, STATE_MINIMIZE, false);
// SetState((Window)pid, STATE_MAXIMIZE, state);
#elif defined(IS_WINDOWS)
HWND hwnd = getHwnd(pid, isPid);
win_max(hwnd, state);
#endif
}
uintptr get_handle(){
MData mData = get_active();
#if defined(IS_MACOSX)
return (uintptr)mData.CgID;
#elif defined(USE_X11)
return (uintptr)mData.XWin;
#elif defined(IS_WINDOWS)
return (uintptr)mData.HWnd;
#endif
}
uintptr b_get_handle() {
#if defined(IS_MACOSX)
return (uintptr)pub_mData.CgID;
#elif defined(USE_X11)
return (uintptr)pub_mData.XWin;
#elif defined(IS_WINDOWS)
return (uintptr)pub_mData.HWnd;
#endif
}
void active_PID(uintptr pid, int8_t isPid){
MData win = set_handle_pid(pid, isPid);
set_active(win);
}