| 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..68417e5ea07da5b12bc945a2bcbd06d16687e6e7 100644
|
| --- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
| +++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
| @@ -8,20 +8,23 @@
|
| #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"
|
|
|
| namespace {
|
|
|
| -const char* kAtomsToCache[] = {
|
| +const char* const kAtomsToCache[] = {
|
| "_NET_ACTIVE_WINDOW",
|
| - NULL
|
| + "_NET_CURRENT_DESKTOP",
|
| + nullptr
|
| };
|
|
|
| // Our global instance. Deleted when our Env() is deleted.
|
| @@ -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)) {
|
| + std::string desktop_string = base::IntToString(desktop);
|
| + FOR_EACH_OBSERVER(display::DesktopObserver,
|
| + desktop_observer_list_.Get(),
|
| + OnWorkspaceChanged(desktop_string));
|
| + }
|
| }
|
| break;
|
| }
|
| -
|
| case CreateNotify:
|
| OnWindowCreatedOrDestroyed(event->type, event->xcreatewindow.window);
|
| break;
|
|
|