| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" | 5 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/dpms.h> | 9 #include <X11/extensions/dpms.h> |
| 10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 void NativeDisplayDelegateX11::UngrabServer() { | 189 void NativeDisplayDelegateX11::UngrabServer() { |
| 190 CHECK(screen_) << "Server not grabbed"; | 190 CHECK(screen_) << "Server not grabbed"; |
| 191 XRRFreeScreenResources(screen_); | 191 XRRFreeScreenResources(screen_); |
| 192 screen_ = NULL; | 192 screen_ = NULL; |
| 193 XUngrabServer(display_); | 193 XUngrabServer(display_); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void NativeDisplayDelegateX11::SyncWithServer() { XSync(display_, 0); } | 196 void NativeDisplayDelegateX11::SyncWithServer() { XSync(display_, 0); } |
| 197 | 197 |
| 198 void NativeDisplayDelegateX11::SetBackgroundColor(uint32 color_argb) { | 198 void NativeDisplayDelegateX11::SetBackgroundColor(uint32_t color_argb) { |
| 199 // Configuring CRTCs/Framebuffer clears the boot screen image. Set the | 199 // Configuring CRTCs/Framebuffer clears the boot screen image. Set the |
| 200 // same background color while configuring the display to minimize the | 200 // same background color while configuring the display to minimize the |
| 201 // duration of black screen at boot time. The background is filled with | 201 // duration of black screen at boot time. The background is filled with |
| 202 // black later in ash::DisplayManager. crbug.com/171050. | 202 // black later in ash::DisplayManager. crbug.com/171050. |
| 203 XSetWindowAttributes swa = {0}; | 203 XSetWindowAttributes swa = {0}; |
| 204 XColor color; | 204 XColor color; |
| 205 Colormap colormap = DefaultColormap(display_, 0); | 205 Colormap colormap = DefaultColormap(display_, 0); |
| 206 // XColor uses 16 bits per color. | 206 // XColor uses 16 bits per color. |
| 207 color.red = (color_argb & 0x00FF0000) >> 8; | 207 color.red = (color_argb & 0x00FF0000) >> 8; |
| 208 color.green = (color_argb & 0x0000FF00); | 208 color.green = (color_argb & 0x0000FF00); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 | 339 |
| 340 DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( | 340 DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( |
| 341 RROutput id, | 341 RROutput id, |
| 342 XRROutputInfo* info, | 342 XRROutputInfo* info, |
| 343 RRCrtc* last_used_crtc, | 343 RRCrtc* last_used_crtc, |
| 344 int index) { | 344 int index) { |
| 345 int64_t display_id = 0; | 345 int64_t display_id = 0; |
| 346 bool has_display_id = GetDisplayId( | 346 bool has_display_id = GetDisplayId( |
| 347 id, static_cast<uint8>(index), &display_id); | 347 id, static_cast<uint8_t>(index), &display_id); |
| 348 | 348 |
| 349 OutputType type = GetOutputTypeFromName(info->name); | 349 OutputType type = GetOutputTypeFromName(info->name); |
| 350 if (type == OUTPUT_TYPE_UNKNOWN) | 350 if (type == OUTPUT_TYPE_UNKNOWN) |
| 351 LOG(ERROR) << "Unknown link type: " << info->name; | 351 LOG(ERROR) << "Unknown link type: " << info->name; |
| 352 | 352 |
| 353 // Use the index as a valid display ID even if the internal | 353 // Use the index as a valid display ID even if the internal |
| 354 // display doesn't have valid EDID because the index | 354 // display doesn't have valid EDID because the index |
| 355 // will never change. | 355 // will never change. |
| 356 if (!has_display_id) { | 356 if (!has_display_id) { |
| 357 if (type == OUTPUT_TYPE_INTERNAL) | 357 if (type == OUTPUT_TYPE_INTERNAL) |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 643 |
| 644 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) { | 644 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) { |
| 645 observers_.AddObserver(observer); | 645 observers_.AddObserver(observer); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) { | 648 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) { |
| 649 observers_.RemoveObserver(observer); | 649 observers_.RemoveObserver(observer); |
| 650 } | 650 } |
| 651 | 651 |
| 652 } // namespace ui | 652 } // namespace ui |
| OLD | NEW |