소스 검색

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…
취소
저장