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

Side by Side Diff: src/platform/window_manager/layout_manager.cc

Issue 506026: wm: Make _NET_ACTIVE_WINDOW contain transient windows. (Closed)
Patch Set: Created 11 years 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
« no previous file with comments | « no previous file | src/platform/window_manager/layout_manager_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 "window_manager/layout_manager.h" 5 #include "window_manager/layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <tr1/memory> 9 #include <tr1/memory>
10 extern "C" { 10 extern "C" {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (win->transient_for_xid() != None) { 281 if (win->transient_for_xid() != None) {
282 ToplevelWindow* toplevel_owner = 282 ToplevelWindow* toplevel_owner =
283 GetToplevelWindowByXid(win->transient_for_xid()); 283 GetToplevelWindowByXid(win->transient_for_xid());
284 if (toplevel_owner) { 284 if (toplevel_owner) {
285 transient_to_toplevel_[win->xid()] = toplevel_owner; 285 transient_to_toplevel_[win->xid()] = toplevel_owner;
286 toplevel_owner->AddTransientWindow(win); 286 toplevel_owner->AddTransientWindow(win);
287 287
288 if (mode_ == MODE_ACTIVE && 288 if (mode_ == MODE_ACTIVE &&
289 active_toplevel_ != NULL && 289 active_toplevel_ != NULL &&
290 active_toplevel_->IsWindowOrTransientFocused()) { 290 active_toplevel_->IsWindowOrTransientFocused()) {
291 // The _NET_ACTIVE_WINDOW property should already refer to
292 // 'active_toplevel_', since it previously had the focus.
293 active_toplevel_->TakeFocus(wm_->GetCurrentTimeFromServer()); 291 active_toplevel_->TakeFocus(wm_->GetCurrentTimeFromServer());
294 } 292 }
295 break; 293 break;
296 } else { 294 } else {
297 LOG(WARNING) << "Ignoring " << win->xid_str() 295 LOG(WARNING) << "Ignoring " << win->xid_str()
298 << "'s WM_TRANSIENT_FOR hint of " 296 << "'s WM_TRANSIENT_FOR hint of "
299 << XidStr(win->transient_for_xid()) 297 << XidStr(win->transient_for_xid())
300 << ", which isn't a toplevel window"; 298 << ", which isn't a toplevel window";
301 // Continue on and treat the transient as a toplevel window. 299 // Continue on and treat the transient as a toplevel window.
302 } 300 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 ToplevelWindow* toplevel = GetToplevelWindowOwningTransientWindow(*win); 483 ToplevelWindow* toplevel = GetToplevelWindowOwningTransientWindow(*win);
486 if (!toplevel) 484 if (!toplevel)
487 toplevel = GetToplevelWindowByWindow(*win); 485 toplevel = GetToplevelWindowByWindow(*win);
488 486
489 // If this is neither a toplevel nor transient window, we don't care 487 // If this is neither a toplevel nor transient window, we don't care
490 // about the focus change. 488 // about the focus change.
491 if (!toplevel) 489 if (!toplevel)
492 return false; 490 return false;
493 toplevel->HandleFocusChange(win, focus_in); 491 toplevel->HandleFocusChange(win, focus_in);
494 492
495 // When a transient window gets the focus, we say that its owner is the 493 // Announce that the new window is the "active" window (in the
496 // "active" window (in the _NET_ACTIVE_WINDOW sense). 494 // _NET_ACTIVE_WINDOW sense), regardless of whether it's a toplevel
495 // window or a transient.
497 if (focus_in) 496 if (focus_in)
498 wm_->SetActiveWindowProperty(toplevel->win()->xid()); 497 wm_->SetActiveWindowProperty(win->xid());
499 498
500 return true; 499 return true;
501 } 500 }
502 501
503 bool LayoutManager::HandleChromeMessage(const WmIpc::Message& msg) { 502 bool LayoutManager::HandleChromeMessage(const WmIpc::Message& msg) {
504 switch (msg.type()) { 503 switch (msg.type()) {
505 case WmIpc::Message::WM_MOVE_FLOATING_TAB: { 504 case WmIpc::Message::WM_MOVE_FLOATING_TAB: {
506 XWindow xid = msg.param(0); 505 XWindow xid = msg.param(0);
507 int x = msg.param(1); 506 int x = msg.param(1);
508 int y = msg.param(2); 507 int y = msg.param(2);
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 } 1694 }
1696 1695
1697 void LayoutManager::SendDeleteRequestToActiveWindow() { 1696 void LayoutManager::SendDeleteRequestToActiveWindow() {
1698 // TODO: If there's a focused transient window, the message should get 1697 // TODO: If there's a focused transient window, the message should get
1699 // sent to it instead. 1698 // sent to it instead.
1700 if (mode_ == MODE_ACTIVE && active_toplevel_) 1699 if (mode_ == MODE_ACTIVE && active_toplevel_)
1701 active_toplevel_->win()->SendDeleteRequest(wm_->GetCurrentTimeFromServer()); 1700 active_toplevel_->win()->SendDeleteRequest(wm_->GetCurrentTimeFromServer());
1702 } 1701 }
1703 1702
1704 } // namespace chromeos 1703 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | src/platform/window_manager/layout_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698