| 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" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // There is nothing else that we can do. Pretend that we have been | 129 // There is nothing else that we can do. Pretend that we have been |
| 130 // deactivated and ignore keyboard input in DesktopWindowTreeHostX11. | 130 // deactivated and ignore keyboard input in DesktopWindowTreeHostX11. |
| 131 OnActiveWindowChanged(window, NOT_ACTIVE); | 131 OnActiveWindowChanged(window, NOT_ACTIVE); |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool X11DesktopHandler::IsActiveWindow(::Window window) const { | 134 bool X11DesktopHandler::IsActiveWindow(::Window window) const { |
| 135 return window == current_window_ && current_window_active_state_ == ACTIVE; | 135 return window == current_window_ && current_window_active_state_ == ACTIVE; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void X11DesktopHandler::ProcessXEvent(XEvent* event) { | 138 void X11DesktopHandler::ProcessXEvent(XEvent* event) { |
| 139 // Ignore focus events in modes other than NotifyNormal (i.e. NotifyGrab), as |
| 140 // they are always sent when the pointer is over our window, even if the |
| 141 // input focus is in a different window. |
| 142 if (event->xfocus.mode != NotifyNormal) |
| 143 return; |
| 144 |
| 139 switch (event->type) { | 145 switch (event->type) { |
| 140 case FocusIn: | 146 case FocusIn: |
| 141 if (current_window_ != event->xfocus.window) | 147 if (current_window_ != event->xfocus.window) |
| 142 OnActiveWindowChanged(event->xfocus.window, ACTIVE); | 148 OnActiveWindowChanged(event->xfocus.window, ACTIVE); |
| 143 break; | 149 break; |
| 144 case FocusOut: | 150 case FocusOut: |
| 145 if (current_window_ == event->xfocus.window) | 151 if (current_window_ == event->xfocus.window) |
| 146 OnActiveWindowChanged(None, NOT_ACTIVE); | 152 OnActiveWindowChanged(None, NOT_ACTIVE); |
| 147 break; | 153 break; |
| 148 default: | 154 default: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); | 241 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); |
| 236 } | 242 } |
| 237 | 243 |
| 238 if (event_type == DestroyNotify) { | 244 if (event_type == DestroyNotify) { |
| 239 // Notify the XForeignWindowManager that |window| has been destroyed. | 245 // Notify the XForeignWindowManager that |window| has been destroyed. |
| 240 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); | 246 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); |
| 241 } | 247 } |
| 242 } | 248 } |
| 243 | 249 |
| 244 } // namespace views | 250 } // namespace views |
| OLD | NEW |