| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" | 5 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
| 14 #include "ui/base/x/x11_menu_list.h" | 14 #include "ui/base/x/x11_menu_list.h" |
| 15 #include "ui/base/x/x11_util.h" | |
| 16 #include "ui/base/x/x11_window_event_manager.h" | 15 #include "ui/base/x/x11_window_event_manager.h" |
| 17 #include "ui/events/platform/platform_event_source.h" | 16 #include "ui/events/platform/platform_event_source.h" |
| 17 #include "ui/gfx/x/x11_atom_cache.h" |
| 18 #include "ui/gfx/x/x11_error_tracker.h" | 18 #include "ui/gfx/x/x11_error_tracker.h" |
| 19 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 19 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Our global instance. Deleted when our Env() is deleted. | 23 // Our global instance. Deleted when our Env() is deleted. |
| 24 views::X11DesktopHandler* g_handler = NULL; | 24 views::X11DesktopHandler* g_handler = NULL; |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 bool X11DesktopHandler::CanDispatchEvent(const ui::PlatformEvent& event) { | 84 bool X11DesktopHandler::CanDispatchEvent(const ui::PlatformEvent& event) { |
| 85 return event->type == CreateNotify || event->type == DestroyNotify || | 85 return event->type == CreateNotify || event->type == DestroyNotify || |
| 86 (event->type == PropertyNotify && | 86 (event->type == PropertyNotify && |
| 87 event->xproperty.window == x_root_window_); | 87 event->xproperty.window == x_root_window_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { | 90 uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { |
| 91 switch (event->type) { | 91 switch (event->type) { |
| 92 case PropertyNotify: { | 92 case PropertyNotify: { |
| 93 if (event->xproperty.atom == ui::GetAtom("_NET_CURRENT_DESKTOP")) { | 93 if (event->xproperty.atom == gfx::GetAtom("_NET_CURRENT_DESKTOP")) { |
| 94 if (UpdateWorkspace()) { | 94 if (UpdateWorkspace()) { |
| 95 for (views::X11DesktopHandlerObserver& observer : observers_) | 95 for (views::X11DesktopHandlerObserver& observer : observers_) |
| 96 observer.OnWorkspaceChanged(workspace_); | 96 observer.OnWorkspaceChanged(workspace_); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 break; | 99 break; |
| 100 } | 100 } |
| 101 case CreateNotify: | 101 case CreateNotify: |
| 102 OnWindowCreatedOrDestroyed(event->type, event->xcreatewindow.window); | 102 OnWindowCreatedOrDestroyed(event->type, event->xcreatewindow.window); |
| 103 break; | 103 break; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 132 // The window might be destroyed if the message pump did not get a chance to | 132 // The window might be destroyed if the message pump did not get a chance to |
| 133 // run but we can safely ignore the X error. | 133 // run but we can safely ignore the X error. |
| 134 gfx::X11ErrorTracker error_tracker; | 134 gfx::X11ErrorTracker error_tracker; |
| 135 ui::XMenuList::GetInstance()->MaybeRegisterMenu(window); | 135 ui::XMenuList::GetInstance()->MaybeRegisterMenu(window); |
| 136 } else { | 136 } else { |
| 137 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); | 137 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace views | 141 } // namespace views |
| OLD | NEW |