| OLD | NEW | 
|     1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |     1 // Copyright (c) 2010 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/window_manager.h" |     5 #include "window_manager/window_manager.h" | 
|     6  |     6  | 
|     7 #include <cstring> |     7 #include <cstring> | 
|     8 #include <ctime> |     8 #include <ctime> | 
|     9 #include <list> |     9 #include <list> | 
|    10 #include <queue> |    10 #include <queue> | 
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   893     num_windows += layout_manager_->num_toplevels(); |   893     num_windows += layout_manager_->num_toplevels(); | 
|   894   return num_windows; |   894   return num_windows; | 
|   895 } |   895 } | 
|   896  |   896  | 
|   897 void WindowManager::DestroyLoginController() { |   897 void WindowManager::DestroyLoginController() { | 
|   898   event_loop_->PostTask( |   898   event_loop_->PostTask( | 
|   899       NewPermanentCallback( |   899       NewPermanentCallback( | 
|   900           this, &WindowManager::DestroyLoginControllerInternal)); |   900           this, &WindowManager::DestroyLoginControllerInternal)); | 
|   901 } |   901 } | 
|   902  |   902  | 
|   903 bool WindowManager::IsShuttingDown() const { |   903 bool WindowManager::IsSessionEnding() const { | 
|   904   if (!screen_locker_handler_.get()) |   904   if (!screen_locker_handler_.get()) | 
|   905     return false; |   905     return false; | 
|   906   return screen_locker_handler_->shutting_down(); |   906   return screen_locker_handler_->session_ending(); | 
|   907 } |   907 } | 
|   908  |   908  | 
|   909 bool WindowManager::GetManagerSelection( |   909 bool WindowManager::GetManagerSelection( | 
|   910     XAtom atom, XWindow manager_win, XTime timestamp) { |   910     XAtom atom, XWindow manager_win, XTime timestamp) { | 
|   911   // Find the current owner of the selection and select events on it so |   911   // Find the current owner of the selection and select events on it so | 
|   912   // we'll know when it's gone away. |   912   // we'll know when it's gone away. | 
|   913   XWindow current_manager = xconn_->GetSelectionOwner(atom); |   913   XWindow current_manager = xconn_->GetSelectionOwner(atom); | 
|   914   if (current_manager) |   914   if (current_manager) | 
|   915     xconn_->SelectInputOnWindow(current_manager, StructureNotifyMask, false); |   915     xconn_->SelectInputOnWindow(current_manager, StructureNotifyMask, false); | 
|   916  |   916  | 
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1640  |  1640  | 
|  1641 void WindowManager::HandleEnterNotify(const XEnterWindowEvent& e) { |  1641 void WindowManager::HandleEnterNotify(const XEnterWindowEvent& e) { | 
|  1642   DLOG(INFO) << "Handling enter notify for " << XidStr(e.window); |  1642   DLOG(INFO) << "Handling enter notify for " << XidStr(e.window); | 
|  1643   FOR_EACH_INTERESTED_EVENT_CONSUMER( |  1643   FOR_EACH_INTERESTED_EVENT_CONSUMER( | 
|  1644       window_event_consumers_, |  1644       window_event_consumers_, | 
|  1645       e.window, |  1645       e.window, | 
|  1646       HandlePointerEnter(e.window, e.x, e.y, e.x_root, e.y_root, e.time)); |  1646       HandlePointerEnter(e.window, e.x, e.y, e.x_root, e.y_root, e.time)); | 
|  1647 } |  1647 } | 
|  1648  |  1648  | 
|  1649 void WindowManager::HandleKeyPress(const XKeyEvent& e) { |  1649 void WindowManager::HandleKeyPress(const XKeyEvent& e) { | 
|  1650   // We grab the keyboard while shutting down; ignore any events that we get. |  1650   // We grab the keyboard while shutting down or signing out; ignore any events | 
|  1651   if (IsShuttingDown()) |  1651   // that we get. | 
 |  1652   if (IsSessionEnding()) | 
|  1652     return; |  1653     return; | 
|  1653   key_bindings_->HandleKeyPress(e.keycode, e.state, e.time); |  1654   key_bindings_->HandleKeyPress(e.keycode, e.state, e.time); | 
|  1654 } |  1655 } | 
|  1655  |  1656  | 
|  1656 void WindowManager::HandleKeyRelease(const XKeyEvent& e) { |  1657 void WindowManager::HandleKeyRelease(const XKeyEvent& e) { | 
|  1657   if (IsShuttingDown()) |  1658   if (IsSessionEnding()) | 
|  1658     return; |  1659     return; | 
|  1659   key_bindings_->HandleKeyRelease(e.keycode, e.state, e.time); |  1660   key_bindings_->HandleKeyRelease(e.keycode, e.state, e.time); | 
|  1660 } |  1661 } | 
|  1661  |  1662  | 
|  1662 void WindowManager::HandleLeaveNotify(const XLeaveWindowEvent& e) { |  1663 void WindowManager::HandleLeaveNotify(const XLeaveWindowEvent& e) { | 
|  1663   DLOG(INFO) << "Handling leave notify for " << XidStr(e.window); |  1664   DLOG(INFO) << "Handling leave notify for " << XidStr(e.window); | 
|  1664   FOR_EACH_INTERESTED_EVENT_CONSUMER( |  1665   FOR_EACH_INTERESTED_EVENT_CONSUMER( | 
|  1665       window_event_consumers_, |  1666       window_event_consumers_, | 
|  1666       e.window, |  1667       e.window, | 
|  1667       HandlePointerLeave(e.window, e.x, e.y, e.x_root, e.y_root, e.time)); |  1668       HandlePointerLeave(e.window, e.x, e.y, e.x_root, e.y_root, e.time)); | 
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2027   event_consumers_.erase(login_controller_.get()); |  2028   event_consumers_.erase(login_controller_.get()); | 
|  2028   login_controller_.reset(); |  2029   login_controller_.reset(); | 
|  2029 } |  2030 } | 
|  2030  |  2031  | 
|  2031 void WindowManager::PingChrome() { |  2032 void WindowManager::PingChrome() { | 
|  2032   chrome_watchdog_->SendPingToChrome(GetCurrentTimeFromServer(), |  2033   chrome_watchdog_->SendPingToChrome(GetCurrentTimeFromServer(), | 
|  2033                                      kPingChromeTimeoutMs); |  2034                                      kPingChromeTimeoutMs); | 
|  2034 } |  2035 } | 
|  2035  |  2036  | 
|  2036 }  // namespace window_manager |  2037 }  // namespace window_manager | 
| OLD | NEW |