Chromium Code Reviews| Index: ui/views/widget/desktop_aura/x11_desktop_handler.cc |
| diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.cc b/ui/views/widget/desktop_aura/x11_desktop_handler.cc |
| index 8ec4b1e7b9aceada7c3a5562ee9c3b3fd966acb5..fbcaf4a779ae8a447cb512aa59fa4d33272c7834 100644 |
| --- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc |
| +++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc |
| @@ -8,11 +8,13 @@ |
| #include <X11/Xlib.h> |
| #include "base/message_loop/message_loop.h" |
| +#include "base/strings/string_number_conversions.h" |
| #include "ui/aura/env.h" |
| #include "ui/aura/window_event_dispatcher.h" |
| #include "ui/base/x/x11_foreign_window_manager.h" |
| #include "ui/base/x/x11_menu_list.h" |
| #include "ui/base/x/x11_util.h" |
| +#include "ui/display/desktop_observer.h" |
| #include "ui/events/platform/platform_event_source.h" |
| #include "ui/gfx/x/x11_error_tracker.h" |
| #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| @@ -21,6 +23,7 @@ namespace { |
| const char* kAtomsToCache[] = { |
|
Lei Zhang
2016/06/29 18:30:53
BTW, please make this: const char* const
Tom (Use chromium acct)
2016/06/29 20:16:05
Done.
|
| "_NET_ACTIVE_WINDOW", |
| + "_NET_CURRENT_DESKTOP", |
| NULL |
| }; |
| @@ -184,10 +187,7 @@ bool X11DesktopHandler::CanDispatchEvent(const ui::PlatformEvent& event) { |
| uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { |
| switch (event->type) { |
| case PropertyNotify: { |
| - // Check for a change to the active window. |
| - CHECK_EQ(x_root_window_, event->xproperty.window); |
| - ::Atom active_window_atom = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW"); |
| - if (event->xproperty.atom == active_window_atom) { |
| + if (event->xproperty.atom == atom_cache_.GetAtom("_NET_ACTIVE_WINDOW")) { |
| ::Window window; |
| if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && |
| window) { |
| @@ -196,10 +196,18 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { |
| } else { |
| x_active_window_ = None; |
| } |
| + } else if (event->xproperty.atom == |
| + atom_cache_.GetAtom("_NET_CURRENT_DESKTOP")) { |
| + int desktop; |
| + if (ui::GetCurrentDesktop(&desktop)) { |
| + const std::string desktop_string = base::IntToString(desktop); |
| + FOR_EACH_OBSERVER(display::DesktopObserver, |
| + display::g_desktop_observer_list, |
| + OnWorkspaceChanged(desktop_string)); |
| + } |
| } |
| break; |
| } |
| - |
| case CreateNotify: |
| OnWindowCreatedOrDestroyed(event->type, event->xcreatewindow.window); |
| break; |