Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ui/views/widget/desktop_aura/x11_desktop_handler.cc

Issue 173803002: Redesigns the text input focus handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 void X11DesktopHandler::OnActiveWindowChanged(::Window xid) { 181 void X11DesktopHandler::OnActiveWindowChanged(::Window xid) {
182 if (current_window_ == xid) 182 if (current_window_ == xid)
183 return; 183 return;
184 DesktopWindowTreeHostX11* old_host = 184 DesktopWindowTreeHostX11* old_host =
185 views::DesktopWindowTreeHostX11::GetHostForXID(current_window_); 185 views::DesktopWindowTreeHostX11::GetHostForXID(current_window_);
186 if (old_host) 186 if (old_host)
187 old_host->HandleNativeWidgetActivationChanged(false); 187 old_host->HandleNativeWidgetActivationChanged(false);
188 188
189 // Set a new window id. This effectively changes the active widget to the new
msw 2014/03/11 23:24:39 nit: consider "Update the current window ID to eff
Yuki 2014/03/12 09:13:15 Done.
190 // window.
191 current_window_ = xid;
192
189 DesktopWindowTreeHostX11* new_host = 193 DesktopWindowTreeHostX11* new_host =
190 views::DesktopWindowTreeHostX11::GetHostForXID(xid); 194 views::DesktopWindowTreeHostX11::GetHostForXID(xid);
191 if (new_host) 195 if (new_host)
192 new_host->HandleNativeWidgetActivationChanged(true); 196 new_host->HandleNativeWidgetActivationChanged(true);
193
194 current_window_ = xid;
195 } 197 }
196 198
197 ::Window X11DesktopHandler::GetNextToActivateInStack( 199 ::Window X11DesktopHandler::GetNextToActivateInStack(
198 const std::vector< ::Window >& windows) { 200 const std::vector< ::Window >& windows) {
199 DCHECK(current_window_); 201 DCHECK(current_window_);
200 202
201 // We start by doing a fast forward in the stack to find the active window. 203 // We start by doing a fast forward in the stack to find the active window.
202 std::vector< ::Window >::const_iterator it = 204 std::vector< ::Window >::const_iterator it =
203 std::find(windows.begin(), windows.end(), current_window_); 205 std::find(windows.begin(), windows.end(), current_window_);
204 206
(...skipping 25 matching lines...) Expand all
230 return *it; 232 return *it;
231 } 233 }
232 234
233 // If we reached that point, that means we have not found an appropriate 235 // If we reached that point, that means we have not found an appropriate
234 // window to activate. There is nothing we can do about it and the caller 236 // window to activate. There is nothing we can do about it and the caller
235 // should take care of doing the right thing. 237 // should take care of doing the right thing.
236 return 0; 238 return 0;
237 } 239 }
238 240
239 } // namespace views 241 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698