| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 ScreenDrawerLinux::ScreenDrawerLinux() { | 78 ScreenDrawerLinux::ScreenDrawerLinux() { |
| 79 display_ = SharedXDisplay::CreateDefault(); | 79 display_ = SharedXDisplay::CreateDefault(); |
| 80 RTC_CHECK(display_.get()); | 80 RTC_CHECK(display_.get()); |
| 81 screen_num_ = DefaultScreen(display_->display()); | 81 screen_num_ = DefaultScreen(display_->display()); |
| 82 XWindowAttributes root_attributes; | 82 XWindowAttributes root_attributes; |
| 83 if (!XGetWindowAttributes(display_->display(), | 83 if (!XGetWindowAttributes(display_->display(), |
| 84 RootWindow(display_->display(), screen_num_), | 84 RootWindow(display_->display(), screen_num_), |
| 85 &root_attributes)) { | 85 &root_attributes)) { |
| 86 RTC_DCHECK(false) << "Failed to get root window size."; | 86 RTC_NOTREACHED() << "Failed to get root window size."; |
| 87 } | 87 } |
| 88 window_ = XCreateSimpleWindow( | 88 window_ = XCreateSimpleWindow( |
| 89 display_->display(), RootWindow(display_->display(), screen_num_), 0, 0, | 89 display_->display(), RootWindow(display_->display(), screen_num_), 0, 0, |
| 90 root_attributes.width, root_attributes.height, 0, | 90 root_attributes.width, root_attributes.height, 0, |
| 91 BlackPixel(display_->display(), screen_num_), | 91 BlackPixel(display_->display(), screen_num_), |
| 92 BlackPixel(display_->display(), screen_num_)); | 92 BlackPixel(display_->display(), screen_num_)); |
| 93 XSelectInput(display_->display(), window_, StructureNotifyMask); | 93 XSelectInput(display_->display(), window_, StructureNotifyMask); |
| 94 XMapWindow(display_->display(), window_); | 94 XMapWindow(display_->display(), window_); |
| 95 while (true) { | 95 while (true) { |
| 96 XEvent event; | 96 XEvent event; |
| 97 XNextEvent(display_->display(), &event); | 97 XNextEvent(display_->display(), &event); |
| 98 if (event.type == MapNotify) { | 98 if (event.type == MapNotify) { |
| 99 break; | 99 break; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 XFlush(display_->display()); | 102 XFlush(display_->display()); |
| 103 Window child; | 103 Window child; |
| 104 int x, y; | 104 int x, y; |
| 105 if (!XTranslateCoordinates(display_->display(), window_, | 105 if (!XTranslateCoordinates(display_->display(), window_, |
| 106 RootWindow(display_->display(), screen_num_), 0, 0, | 106 RootWindow(display_->display(), screen_num_), 0, 0, |
| 107 &x, &y, &child)) { | 107 &x, &y, &child)) { |
| 108 RTC_DCHECK(false) << "Failed to get window position."; | 108 RTC_NOTREACHED() << "Failed to get window position."; |
| 109 } | 109 } |
| 110 // Some window manager does not allow a window to cover two or more monitors. | 110 // Some window manager does not allow a window to cover two or more monitors. |
| 111 // So if the window is on the first monitor of a two-monitor system, the | 111 // So if the window is on the first monitor of a two-monitor system, the |
| 112 // second half won't be able to show up without changing configurations of WM, | 112 // second half won't be able to show up without changing configurations of WM, |
| 113 // and its DrawableRegion() is not accurate. | 113 // and its DrawableRegion() is not accurate. |
| 114 rect_ = DesktopRect::MakeLTRB(x, y, root_attributes.width, | 114 rect_ = DesktopRect::MakeLTRB(x, y, root_attributes.width, |
| 115 root_attributes.height); | 115 root_attributes.height); |
| 116 context_ = DefaultGC(display_->display(), screen_num_); | 116 context_ = DefaultGC(display_->display(), screen_num_); |
| 117 colormap_ = DefaultColormap(display_->display(), screen_num_); | 117 colormap_ = DefaultColormap(display_->display(), screen_num_); |
| 118 BringToFront(); | 118 BringToFront(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 // static | 193 // static |
| 194 std::unique_ptr<ScreenDrawer> ScreenDrawer::Create() { | 194 std::unique_ptr<ScreenDrawer> ScreenDrawer::Create() { |
| 195 if (SharedXDisplay::CreateDefault().get()) { | 195 if (SharedXDisplay::CreateDefault().get()) { |
| 196 return std::unique_ptr<ScreenDrawer>(new ScreenDrawerLinux()); | 196 return std::unique_ptr<ScreenDrawer>(new ScreenDrawerLinux()); |
| 197 } | 197 } |
| 198 return nullptr; | 198 return nullptr; |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace webrtc | 201 } // namespace webrtc |
| OLD | NEW |