blob: d741759368be78e01c8e53a3a606f29ed35d4abf [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2010 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_LINUXWINDOWPICKER_H_
12#define WEBRTC_BASE_LINUXWINDOWPICKER_H_
13
jbauch555604a2016-04-26 03:13:22 -070014#include <memory>
15
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000016#include "webrtc/base/basictypes.h"
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000017#include "webrtc/base/windowpicker.h"
18
19// Avoid include <X11/Xlib.h>.
20struct _XDisplay;
21typedef unsigned long Window;
22
23namespace rtc {
24
25class XWindowEnumerator;
26
henrike@webrtc.orgfb1eb432014-08-15 14:44:13 +000027class X11WindowPicker : public WindowPicker {
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000028 public:
henrike@webrtc.orgfb1eb432014-08-15 14:44:13 +000029 X11WindowPicker();
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +000030 ~X11WindowPicker() override;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000031
32 static bool IsDesktopElement(_XDisplay* display, Window window);
33
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +000034 bool Init() override;
35 bool IsVisible(const WindowId& id) override;
36 bool MoveToFront(const WindowId& id) override;
37 bool GetWindowList(WindowDescriptionList* descriptions) override;
38 bool GetDesktopList(DesktopDescriptionList* descriptions) override;
39 bool GetDesktopDimensions(const DesktopId& id,
40 int* width,
41 int* height) override;
Peter Boström0c4e06b2015-10-07 12:23:21 +020042 uint8_t* GetWindowIcon(const WindowId& id, int* width, int* height);
43 uint8_t* GetWindowThumbnail(const WindowId& id, int width, int height);
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000044 int GetNumDesktops();
Peter Boström0c4e06b2015-10-07 12:23:21 +020045 uint8_t* GetDesktopThumbnail(const DesktopId& id, int width, int height);
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000046
47 private:
jbauch555604a2016-04-26 03:13:22 -070048 std::unique_ptr<XWindowEnumerator> enumerator_;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000049};
50
51} // namespace rtc
52
53#endif // WEBRTC_BASE_LINUXWINDOWPICKER_H_