mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 23:57:59 +01:00

Bug: webrtc:10138 Change-Id: Icc25a2a277a9608701aaddd546882366739991ca Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127898 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27227}
56 lines
2.3 KiB
C++
56 lines
2.3 KiB
C++
/*
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_LIST_UTILS_H_
|
|
#define MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_LIST_UTILS_H_
|
|
|
|
#include <X11/X.h>
|
|
#include <X11/Xlib.h>
|
|
#include <stdint.h>
|
|
|
|
#include "api/function_view.h"
|
|
#include "modules/desktop_capture/desktop_geometry.h"
|
|
#include "modules/desktop_capture/linux/x_atom_cache.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// Synchronously iterates all on-screen windows in |cache|.display() in
|
|
// decreasing z-order and sends them one-by-one to |on_window| function before
|
|
// GetWindowList() returns. If |on_window| returns false, this function ignores
|
|
// other windows and returns immediately. GetWindowList() returns false if
|
|
// native APIs failed. If multiple screens are attached to the |display|, this
|
|
// function returns false only when native APIs failed on all screens. Menus,
|
|
// panels and minimized windows will be ignored.
|
|
bool GetWindowList(XAtomCache* cache,
|
|
rtc::FunctionView<bool(::Window)> on_window);
|
|
|
|
// Returns WM_STATE property of the |window|. This function returns
|
|
// WithdrawnState if the |window| is missing.
|
|
int32_t GetWindowState(XAtomCache* cache, ::Window window);
|
|
|
|
// Returns the rectangle of the |window| in the coordinates of |display|. This
|
|
// function returns false if native APIs failed. If |attributes| is provided, it
|
|
// will be filled with the attributes of |window|. The |rect| is in system
|
|
// coordinate, i.e. the primary monitor always starts from (0, 0).
|
|
bool GetWindowRect(::Display* display,
|
|
::Window window,
|
|
DesktopRect* rect,
|
|
XWindowAttributes* attributes = nullptr);
|
|
|
|
// Creates a DesktopRect from |attributes|.
|
|
template <typename T>
|
|
DesktopRect DesktopRectFromXAttributes(const T& attributes) {
|
|
return DesktopRect::MakeXYWH(attributes.x, attributes.y, attributes.width,
|
|
attributes.height);
|
|
}
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_DESKTOP_CAPTURE_LINUX_WINDOW_LIST_UTILS_H_
|