Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: ui/views/widget/desktop_aura/desktop_screen_x11.cc

Issue 1907103002: X11: Handle change notify for _NET_WORKAREA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update window geometry when the WM tells us our work area has changed. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_screen_x11.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9ccbe0ad190ce1f14ab4762588303091002c2a10 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* const kAtomsToCache[] = {
+ "_NET_WORKAREA",
+ nullptr
+};
+
// 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,19 @@ 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->type == PropertyNotify &&
+ event->xproperty.atom == atom_cache_.GetAtom("_NET_WORKAREA"))) {
// 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 +283,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() {
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_screen_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698