Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_screen_x11.cc |
| diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc |
| index 6ffd94a3c896909e26a399f93b380d9123bd01e7..da8e7a7303596ffe258eb4372142dabbaa59187d 100644 |
| --- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc |
| +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc |
| @@ -33,6 +33,11 @@ |
| namespace { |
| +const char* kAtomsToCache[] = { |
|
Lei Zhang
2016/04/21 22:45:31
const char* const, otherwise one can write: kAtoms
Tom (Use chromium acct)
2016/04/21 22:57:50
Done.
|
| + "_NET_WORKAREA", |
| + NULL |
|
Lei Zhang
2016/04/21 22:45:31
nullptr
Tom (Use chromium acct)
2016/04/21 22:57:50
Done.
|
| +}; |
| + |
| // The delay to perform configuration after RRNotify. See the comment |
| // in |Dispatch()|. |
| const int64_t kConfigureDelayMs = 500; |
| @@ -86,7 +91,8 @@ DesktopScreenX11::DesktopScreenX11() |
| : xdisplay_(gfx::GetXDisplay()), |
| x_root_window_(DefaultRootWindow(xdisplay_)), |
| has_xrandr_(false), |
| - xrandr_event_base_(0) { |
| + xrandr_event_base_(0), |
| + atom_cache_(xdisplay_, kAtomsToCache) { |
| // We only support 1.3+. There were library changes before this and we should |
| // use the new interface instead of the 1.2 one. |
| int randr_version_major = 0; |
| @@ -229,14 +235,18 @@ void DesktopScreenX11::RemoveObserver(gfx::DisplayObserver* observer) { |
| bool DesktopScreenX11::CanDispatchEvent(const ui::PlatformEvent& event) { |
| return event->type - xrandr_event_base_ == RRScreenChangeNotify || |
| - event->type - xrandr_event_base_ == RRNotify; |
| + event->type - xrandr_event_base_ == RRNotify || |
| + (event->type == PropertyNotify && |
| + event->xproperty.window == x_root_window_ && |
| + event->xproperty.atom == atom_cache_.GetAtom("_NET_WORKAREA")); |
| } |
| uint32_t DesktopScreenX11::DispatchEvent(const ui::PlatformEvent& event) { |
| if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { |
| // Pass the event through to xlib. |
| XRRUpdateConfiguration(event); |
| - } else if (event->type - xrandr_event_base_ == RRNotify) { |
| + } else if (event->type - xrandr_event_base_ == RRNotify || |
| + event->xproperty.atom == atom_cache_.GetAtom("_NET_WORKAREA")) { |
|
Elliot Glaysher
2016/04/21 22:43:05
XEvent is a giant union, not a struct. Check event
Tom (Use chromium acct)
2016/04/21 22:57:50
Done.
|
| // There's some sort of observer dispatch going on here, but I don't think |
| // it's the screen's? |
| if (configure_timer_.get() && configure_timer_->IsRunning()) { |
| @@ -272,7 +282,8 @@ DesktopScreenX11::DesktopScreenX11( |
| x_root_window_(DefaultRootWindow(xdisplay_)), |
| has_xrandr_(false), |
| xrandr_event_base_(0), |
| - displays_(test_displays) { |
| + displays_(test_displays), |
| + atom_cache_(xdisplay_, kAtomsToCache) { |
| } |
| std::vector<gfx::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() { |