瀏覽代碼

Release displays not enclosed by the window

cocoa_capture_displays it captures all displays enclosed by the
window_rect. If a set of displays were captured, but the configuration of
what monitors to use changed, a second call would only add to the set
of captured displays. Therefore, if the user enabled
FullScreenAllMonitors (all displays captured) and then disabled it (only
one display captured) they would get into a state were monitors not used
for the VNC session still were captured (which on macOS for example,
results in displays being unusable for other things).

This has now been fixed, resulting in monitors outside the window_rect
not being unnecessarily captured.
tags/v1.11.90
Hugo Lundin 2 年之前
父節點
當前提交
f4423b410c
共有 2 個檔案被更改,包括 28 行新增19 行删除
  1. 5
    0
      vncviewer/DesktopWindow.cxx
  2. 23
    19
      vncviewer/cocoa.mm

+ 5
- 0
vncviewer/DesktopWindow.cxx 查看文件

@@ -608,6 +608,11 @@ void DesktopWindow::resize(int x, int y, int w, int h)

repositionWidgets();
}

// Some systems require a grab after the window size has been changed.
// Otherwise they might hold on to displays, resulting in them being unusable.
if (fullscreen_active() && fullscreenSystemKeys)
grabKeyboard();
}



+ 23
- 19
vncviewer/cocoa.mm 查看文件

@@ -56,34 +56,38 @@ int cocoa_capture_displays(Fl_Window *win)

nsw = (NSWindow*)fl_xid(win);

if (!captured) {
CGDisplayCount count;
CGDirectDisplayID displays[16];
CGDisplayCount count;
CGDirectDisplayID displays[16];

int sx, sy, sw, sh;
rfb::Rect windows_rect, screen_rect;
int sx, sy, sw, sh;
rfb::Rect windows_rect, screen_rect;

windows_rect.setXYWH(win->x(), win->y(), win->w(), win->h());
windows_rect.setXYWH(win->x(), win->y(), win->w(), win->h());

if (CGGetActiveDisplayList(16, displays, &count) != kCGErrorSuccess)
return 1;
if (CGGetActiveDisplayList(16, displays, &count) != kCGErrorSuccess)
return 1;

if (count != (unsigned)Fl::screen_count())
return 1;
if (count != (unsigned)Fl::screen_count())
return 1;

for (int i = 0; i < Fl::screen_count(); i++) {
Fl::screen_xywh(sx, sy, sw, sh, i);
for (int i = 0; i < Fl::screen_count(); i++) {
Fl::screen_xywh(sx, sy, sw, sh, i);

screen_rect.setXYWH(sx, sy, sw, sh);
if (screen_rect.enclosed_by(windows_rect)) {
if (CGDisplayCapture(displays[i]) != kCGErrorSuccess)
return 1;
}
}
screen_rect.setXYWH(sx, sy, sw, sh);
if (screen_rect.enclosed_by(windows_rect)) {
if (CGDisplayCapture(displays[i]) != kCGErrorSuccess)
return 1;

captured = true;
} else {
// A display might have been captured with the previous
// monitor selection. In that case we don't want to keep
// it when its no longer inside the window_rect.
CGDisplayRelease(displays[i]);
}
}

captured = true;

if ([nsw level] == CGShieldingWindowLevel())
return 0;


Loading…
取消
儲存