| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const WindowT& id() const { return id_; } | 62 const WindowT& id() const { return id_; } |
| 63 bool IsValid() const { return id_ != 0; } | 63 bool IsValid() const { return id_ != 0; } |
| 64 bool Equals(const WindowId& other) const { | 64 bool Equals(const WindowId& other) const { |
| 65 return id_ == other.id(); | 65 return id_ == other.id(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 WindowT id_; | 69 WindowT id_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class DesktopId { | |
| 73 public: | |
| 74 // Define DesktopT for each platform. | |
| 75 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) | |
| 76 typedef Window DesktopT; | |
| 77 #elif defined(WEBRTC_WIN) | |
| 78 typedef HMONITOR DesktopT; | |
| 79 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) | |
| 80 typedef CGDirectDisplayID DesktopT; | |
| 81 #else | |
| 82 typedef unsigned int DesktopT; | |
| 83 #endif | |
| 84 | |
| 85 static DesktopId Cast(int id, int index) { | |
| 86 #if defined(WEBRTC_WIN) | |
| 87 return DesktopId(reinterpret_cast<DesktopId::DesktopT>(id), index); | |
| 88 #else | |
| 89 return DesktopId(static_cast<DesktopId::DesktopT>(id), index); | |
| 90 #endif | |
| 91 } | |
| 92 | |
| 93 DesktopId() : id_(0), index_(-1) {} | |
| 94 DesktopId(const DesktopT& id, int index) // NOLINT | |
| 95 : id_(id), index_(index) { | |
| 96 } | |
| 97 const DesktopT& id() const { return id_; } | |
| 98 int index() const { return index_; } | |
| 99 bool IsValid() const { return index_ != -1; } | |
| 100 bool Equals(const DesktopId& other) const { | |
| 101 return id_ == other.id() && index_ == other.index(); | |
| 102 } | |
| 103 | |
| 104 private: | |
| 105 // Id is the platform specific desktop identifier. | |
| 106 DesktopT id_; | |
| 107 // Index is the desktop index as enumerated by each platform. | |
| 108 // Desktop capturer typically takes the index instead of id. | |
| 109 int index_; | |
| 110 }; | |
| 111 | |
| 112 // Window event types. | |
| 113 enum WindowEvent { | |
| 114 WE_RESIZE = 0, | |
| 115 WE_CLOSE = 1, | |
| 116 WE_MINIMIZE = 2, | |
| 117 WE_RESTORE = 3, | |
| 118 }; | |
| 119 | |
| 120 inline std::string ToString(const WindowId& window) { | 72 inline std::string ToString(const WindowId& window) { |
| 121 return ToString(window.id()); | 73 return ToString(window.id()); |
| 122 } | 74 } |
| 123 | 75 |
| 124 } // namespace rtc | 76 } // namespace rtc |
| 125 | 77 |
| 126 #endif // WEBRTC_BASE_WINDOW_H_ | 78 #endif // WEBRTC_BASE_WINDOW_H_ |
| OLD | NEW |