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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { | 163 uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { |
164 switch (event->type) { | 164 switch (event->type) { |
165 case PropertyNotify: { | 165 case PropertyNotify: { |
166 // Check for a change to the active window. | 166 // Check for a change to the active window. |
167 CHECK_EQ(x_root_window_, event->xproperty.window); | 167 CHECK_EQ(x_root_window_, event->xproperty.window); |
168 ::Atom active_window_atom = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW"); | 168 ::Atom active_window_atom = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW"); |
169 if (event->xproperty.atom == active_window_atom) { | 169 if (event->xproperty.atom == active_window_atom) { |
170 ::Window window; | 170 ::Window window; |
171 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && | 171 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && |
172 window) { | 172 window) { |
| 173 // Set focus to the modal dialog instead of the host window. |
| 174 DesktopWindowTreeHostX11* new_host = |
| 175 views::DesktopWindowTreeHostX11::GetHostForXID(window); |
| 176 if (new_host && new_host->GetModalDialog()) { |
| 177 XSetInputFocus(xdisplay_, new_host->GetModalDialog(), |
| 178 RevertToParent, CurrentTime); |
| 179 break; |
| 180 } |
| 181 |
173 OnActiveWindowChanged(window, ACTIVE); | 182 OnActiveWindowChanged(window, ACTIVE); |
174 } | 183 } |
175 } | 184 } |
176 break; | 185 break; |
177 } | 186 } |
178 | 187 |
179 case CreateNotify: | 188 case CreateNotify: |
180 OnWindowCreatedOrDestroyed(event->type, event->xcreatewindow.window); | 189 OnWindowCreatedOrDestroyed(event->type, event->xcreatewindow.window); |
181 break; | 190 break; |
182 case DestroyNotify: | 191 case DestroyNotify: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); | 248 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); |
240 } | 249 } |
241 | 250 |
242 if (event_type == DestroyNotify) { | 251 if (event_type == DestroyNotify) { |
243 // Notify the XForeignWindowManager that |window| has been destroyed. | 252 // Notify the XForeignWindowManager that |window| has been destroyed. |
244 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); | 253 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); |
245 } | 254 } |
246 } | 255 } |
247 | 256 |
248 } // namespace views | 257 } // namespace views |
OLD | NEW |