mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-30 22:13:54 +00:00
Merge pull request #684 from go-vgo/bitmap-pr
Add: export xClose main display function
This commit is contained in:
commit
0110b85d40
@ -457,6 +457,11 @@ func GetXDisplayName() string {
|
|||||||
return gname
|
return gname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CloseMainDisplay close the main X11 display
|
||||||
|
func CloseMainDisplay() {
|
||||||
|
C.close_main_display()
|
||||||
|
}
|
||||||
|
|
||||||
// Deprecated: use the ScaledF(),
|
// Deprecated: use the ScaledF(),
|
||||||
//
|
//
|
||||||
// ScaleX get the primary display horizontal DPI scale factor, drop
|
// ScaleX get the primary display horizontal DPI scale factor, drop
|
||||||
|
@ -79,6 +79,14 @@ char* get_XDisplay_name() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void close_main_display() {
|
||||||
|
#if defined(USE_X11)
|
||||||
|
XCloseMainDisplay();
|
||||||
|
#else
|
||||||
|
//
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t get_num_displays() {
|
uint32_t get_num_displays() {
|
||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
dispatch_semaphore_signal(semaphore);
|
dispatch_semaphore_signal(semaphore);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCDisplay* target = nil;
|
SCDisplay* target = nil;
|
||||||
for (SCDisplay *display in content.displays) {
|
for (SCDisplay *display in content.displays) {
|
||||||
if (display.displayID == id) {
|
if (display.displayID == id) {
|
||||||
@ -41,16 +42,18 @@
|
|||||||
config.sourceRect = diIntersectDisplayLocal;
|
config.sourceRect = diIntersectDisplayLocal;
|
||||||
config.width = diIntersectDisplayLocal.size.width;
|
config.width = diIntersectDisplayLocal.size.width;
|
||||||
config.height = diIntersectDisplayLocal.size.height;
|
config.height = diIntersectDisplayLocal.size.height;
|
||||||
|
|
||||||
[SCScreenshotManager captureImageWithFilter:filter
|
[SCScreenshotManager captureImageWithFilter:filter
|
||||||
configuration:config
|
configuration:config
|
||||||
completionHandler:^(CGImageRef img, NSError* error) {
|
completionHandler:^(CGImageRef img, NSError* error) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
image1 = CGImageCreateCopyWithColorSpace(img, colorSpace);
|
image1 = CGImageCreateCopyWithColorSpace(img, colorSpace);
|
||||||
}
|
}
|
||||||
dispatch_semaphore_signal(semaphore);
|
dispatch_semaphore_signal(semaphore);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||||
dispatch_release(semaphore);
|
dispatch_release(semaphore);
|
||||||
return image1;
|
return image1;
|
||||||
|
Loading…
Reference in New Issue
Block a user