mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1196542 - share only windows with non-zero area. r=pkerr
This commit is contained in:
parent
5fad838bb7
commit
95eabf5454
@ -102,6 +102,18 @@ bool WindowCapturerMac::GetWindowList(WindowList* windows) {
|
||||
CFNumberRef window_layer = reinterpret_cast<CFNumberRef>(
|
||||
CFDictionaryGetValue(window, kCGWindowLayer));
|
||||
if (window_title && window_id && window_layer) {
|
||||
//Skip windows of zero area
|
||||
CFDictionaryRef bounds_ref = reinterpret_cast<CFDictionaryRef>(
|
||||
CFDictionaryGetValue(window,kCGWindowBounds));
|
||||
CGRect bounds_rect;
|
||||
if(!(bounds_ref) ||
|
||||
!(CGRectMakeWithDictionaryRepresentation(bounds_ref,&bounds_rect))){
|
||||
continue;
|
||||
}
|
||||
bounds_rect = CGRectStandardize(bounds_rect);
|
||||
if((bounds_rect.size.width <= 0) || (bounds_rect.size.height <= 0)){
|
||||
continue;
|
||||
}
|
||||
// Skip windows with layer=0 (menu, dock).
|
||||
int layer;
|
||||
CFNumberGetValue(window_layer, kCFNumberIntType, &layer);
|
||||
|
@ -70,6 +70,12 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
|
||||
// Skip windows when we failed to convert the title or it is empty.
|
||||
if (window.title.empty())
|
||||
return TRUE;
|
||||
// Skip windows of zero visible area, except IconicWindows
|
||||
RECT bounds;
|
||||
if(GetClientRect(hwnd,&bounds) && !IsIconic(hwnd)
|
||||
&& IsRectEmpty(&bounds)){
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
list->push_back(window);
|
||||
|
||||
|
@ -134,6 +134,16 @@ bool WindowCapturerLinux::GetWindowList(WindowList* windows) {
|
||||
if (app_window && !IsDesktopElement(app_window)) {
|
||||
Window w;
|
||||
w.id = app_window;
|
||||
|
||||
XWindowAttributes window_attr;
|
||||
if(!XGetWindowAttributes(display(),w.id,&window_attr)){
|
||||
LOG(LS_ERROR)<<"Bad request for attributes for window ID:"<<w.id;
|
||||
continue;
|
||||
}
|
||||
if((window_attr.width <= 0) || (window_attr.height <=0)){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (GetWindowTitle(app_window, &w.title))
|
||||
result.push_back(w);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user