Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: webrtc/modules/desktop_capture/window_capturer_x11.cc

Issue 2989233002: windowCapture: return 1x1 frame to minimized winodw on Linux. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/window_capturer_x11.cc
diff --git a/webrtc/modules/desktop_capture/window_capturer_x11.cc b/webrtc/modules/desktop_capture/window_capturer_x11.cc
index ffe8a3ab9b463ac2ad10b7bc8590f6bdedac5e40..62c258ae85440b9a4609d0eb6be1ffc85d92a7ba 100644
--- a/webrtc/modules/desktop_capture/window_capturer_x11.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_x11.cc
@@ -111,6 +111,9 @@ class WindowCapturerLinux : public DesktopCapturer,
// Returns window title for the specified X |window|.
bool GetWindowTitle(::Window window, std::string* title);
+ // Return WM_STATE property of the |window|.
+ int32_t GetWindowState(::Window window);
+
Callback* callback_ = nullptr;
rtc::scoped_refptr<SharedXDisplay> x_display_;
@@ -286,6 +289,14 @@ void WindowCapturerLinux::CaptureFrame() {
return;
}
+ if (GetWindowState(selected_window_) == IconicState) {
+ // Window is in minimized. Return a 1x1 frame as same as OSX/Win does.
+ std::unique_ptr<DesktopFrame> frame(
+ new BasicDesktopFrame(DesktopSize(1, 1)));
+ callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
+ return;
+ }
+
std::unique_ptr<DesktopFrame> frame(
new BasicDesktopFrame(x_server_pixel_buffer_.window_size()));
@@ -317,13 +328,7 @@ bool WindowCapturerLinux::HandleXEvent(const XEvent& event) {
}
::Window WindowCapturerLinux::GetApplicationWindow(::Window window) {
- // Get WM_STATE property of the window.
- XWindowProperty<uint32_t> window_state(display(), window, wm_state_atom_);
-
- // WM_STATE is considered to be set to WithdrawnState when it missing.
- int32_t state = window_state.is_valid() ?
- *window_state.data() : WithdrawnState;
-
+ int32_t state = GetWindowState(window);
if (state == NormalState) {
// Window has WM_STATE==NormalState. Return it.
return window;
@@ -418,6 +423,14 @@ bool WindowCapturerLinux::GetWindowTitle(::Window window, std::string* title) {
return result;
}
+int32_t WindowCapturerLinux::GetWindowState(::Window window) {
+ // Get WM_STATE property of the window.
+ XWindowProperty<uint32_t> window_state(display(), window, wm_state_atom_);
+
+ // WM_STATE is considered to be set to WithdrawnState when it missing.
+ return window_state.is_valid() ? *window_state.data() : WithdrawnState;
+}
+
} // namespace
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698