diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/root_window.cc | 1 | ||||
-rw-r--r-- | ui/base/x/x11_util.cc | 10 | ||||
-rw-r--r-- | ui/base/x/x11_util.h | 8 | ||||
-rw-r--r-- | ui/gfx/display.cc | 14 | ||||
-rw-r--r-- | ui/gfx/display.h | 10 |
5 files changed, 34 insertions, 9 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 7ff474f..7305ca7 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -196,7 +196,6 @@ gfx::Size RootWindow::GetHostSize() const { } void RootWindow::SetHostBounds(const gfx::Rect& bounds_in_pixel) { - DCHECK(!bounds_in_pixel.IsEmpty()); DispatchHeldMouseMove(); host_->SetBounds(bounds_in_pixel); synthesize_mouse_move_ = false; diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc index ad59097..cb57e09 100644 --- a/ui/base/x/x11_util.cc +++ b/ui/base/x/x11_util.cc @@ -1488,6 +1488,16 @@ bool ParseOutputOverscanFlag(const unsigned char* prop, return false; } +std::vector<std::string> GetDisplayNames(const std::vector<XID>& output_ids) { + std::vector<std::string> names; + for (size_t i = 0; i < output_ids.size(); ++i) { + std::string display_name; + if (GetOutputDeviceData(output_ids[i], NULL, NULL, &display_name)) + names.push_back(display_name); + } + return names; +} + std::vector<std::string> GetOutputNames(const std::vector<XID>& output_ids) { std::vector<std::string> names; Display* display = GetXDisplay(); diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h index 1169f87..377dd41 100644 --- a/ui/base/x/x11_util.h +++ b/ui/base/x/x11_util.h @@ -303,9 +303,13 @@ UI_EXPORT bool ParseOutputOverscanFlag(const unsigned char* prop, unsigned long nitems, bool* flag); -// Gets the name of outputs given by |output_ids|. +// Gets the names of the all displays physically connected to the system. +UI_EXPORT std::vector<std::string> GetDisplayNames( + const std::vector<XID>& output_id); + +// Gets the name of outputs given by |output_id|. UI_EXPORT std::vector<std::string> GetOutputNames( - const std::vector<XID>& output_ids); + const std::vector<XID>& output_id); enum WindowManagerName { WM_UNKNOWN, diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc index 73f33b3..7aa1241 100644 --- a/ui/gfx/display.cc +++ b/ui/gfx/display.cc @@ -11,7 +11,6 @@ #include "ui/base/ui_base_switches.h" #include "ui/base/win/dpi.h" #include "ui/gfx/insets.h" -#include "ui/gfx/point_f.h" #include "ui/gfx/size_conversions.h" namespace gfx { @@ -104,19 +103,22 @@ void Display::SetScaleAndBounds( device_scale_factor_ = device_scale_factor; } device_scale_factor_ = std::max(1.0f, device_scale_factor_); +#if defined(USE_AURA) + bounds_in_pixel_ = bounds_in_pixel; +#endif bounds_ = gfx::Rect(gfx::ToFlooredSize( gfx::ScaleSize(bounds_in_pixel.size(), 1.0f / device_scale_factor_))); UpdateWorkAreaFromInsets(insets); } void Display::SetSize(const gfx::Size& size_in_pixel) { - gfx::Point origin = bounds_.origin(); + SetScaleAndBounds( + device_scale_factor_, #if defined(USE_AURA) - gfx::PointF origin_f = origin; - origin_f.Scale(device_scale_factor_); - origin.SetPoint(origin_f.x(), origin_f.y()); + gfx::Rect(bounds_in_pixel_.origin(), size_in_pixel)); +#else + gfx::Rect(bounds_.origin(), size_in_pixel)); #endif - SetScaleAndBounds(device_scale_factor_, gfx::Rect(origin, size_in_pixel)); } void Display::UpdateWorkAreaFromInsets(const gfx::Insets& insets) { diff --git a/ui/gfx/display.h b/ui/gfx/display.h index 81963f2..4df69b7 100644 --- a/ui/gfx/display.h +++ b/ui/gfx/display.h @@ -88,6 +88,13 @@ class UI_EXPORT Display { // Returns the display's size in pixel coordinates. gfx::Size GetSizeInPixel() const; +#if defined(USE_AURA) + // TODO(oshima|skuhne): Eliminate the use of bounds_in_pixel in events_x.cc + // and remove bounds_in_pixel from gfx::Display. + // Returns the display's bounds in pixel coordinates. + const Rect& bounds_in_pixel() const { return bounds_in_pixel_; } +#endif + // Returns a string representation of the display; std::string ToString() const; @@ -107,6 +114,9 @@ class UI_EXPORT Display { int64 id_; Rect bounds_; Rect work_area_; +#if defined(USE_AURA) + Rect bounds_in_pixel_; +#endif float device_scale_factor_; }; |