1/*
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
14#include "webrtc/base/basictypes.h"
15#include "webrtc/base/scoped_ptr.h"
16#include "webrtc/base/windowpicker.h"
17
18// Avoid include <X11/Xlib.h>.
19struct _XDisplay;
20typedef unsigned long Window;
21
22namespace rtc {
23
24class XWindowEnumerator;
25
26class X11WindowPicker : public WindowPicker {
27 public:
28  X11WindowPicker();
29  ~X11WindowPicker() override;
30
31  static bool IsDesktopElement(_XDisplay* display, Window window);
32
33  bool Init() override;
34  bool IsVisible(const WindowId& id) override;
35  bool MoveToFront(const WindowId& id) override;
36  bool GetWindowList(WindowDescriptionList* descriptions) override;
37  bool GetDesktopList(DesktopDescriptionList* descriptions) override;
38  bool GetDesktopDimensions(const DesktopId& id,
39                            int* width,
40                            int* height) override;
41  uint8_t* GetWindowIcon(const WindowId& id, int* width, int* height);
42  uint8_t* GetWindowThumbnail(const WindowId& id, int width, int height);
43  int GetNumDesktops();
44  uint8_t* GetDesktopThumbnail(const DesktopId& id, int width, int height);
45
46 private:
47  scoped_ptr<XWindowEnumerator> enumerator_;
48};
49
50}  // namespace rtc
51
52#endif  // WEBRTC_BASE_LINUXWINDOWPICKER_H_
53