| 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 <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include <cerrno> | 9 #include <cerrno> |
| 10 #include <cstdio> | 10 #include <cstdio> |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 // - Regular non-override-redirect windows' configuration calls are | 1211 // - Regular non-override-redirect windows' configuration calls are |
| 1212 // passed to us as ConfigureRequest events, so we would've already | 1212 // passed to us as ConfigureRequest events, so we would've already |
| 1213 // updated both their X and composited configuration in | 1213 // updated both their X and composited configuration in |
| 1214 // HandleConfigureRequest(). We don't need to do anything here. | 1214 // HandleConfigureRequest(). We don't need to do anything here. |
| 1215 // - For both types of window, we may have decided to move or resize the | 1215 // - For both types of window, we may have decided to move or resize the |
| 1216 // window ourselves earlier through a direct call to Window::Move() or | 1216 // window ourselves earlier through a direct call to Window::Move() or |
| 1217 // Resize(). In that case, we would've already updated their | 1217 // Resize(). In that case, we would've already updated their |
| 1218 // composited position (or at least started the animation) then. | 1218 // composited position (or at least started the animation) then. |
| 1219 | 1219 |
| 1220 if (win->override_redirect()) { | 1220 if (win->override_redirect()) { |
| 1221 // TODO: This possibly isn't really correct. We'll get this | |
| 1222 // notification if we were the ones who moved this window (which I | |
| 1223 // guess we shouldn't be doing, since it's override-redirect), so this | |
| 1224 // will effectively cancel out whatever animation we previously | |
| 1225 // started. | |
| 1226 win->MoveComposited(e.x, e.y, 0); | 1221 win->MoveComposited(e.x, e.y, 0); |
| 1227 | |
| 1228 win->SaveClientPosition(e.x, e.y); | 1222 win->SaveClientPosition(e.x, e.y); |
| 1229 win->SaveClientSize(e.width, e.height); | 1223 win->SaveClientSize(e.width, e.height); |
| 1230 | 1224 |
| 1231 // When we see a stacking change for an override-redirect window, we | 1225 // When we see a stacking change for an override-redirect window, we |
| 1232 // attempt to restack its actor correspondingly. If we don't have an | 1226 // attempt to restack its actor correspondingly. If we don't have an |
| 1233 // actor for the X window directly under it, we walk down the stack | 1227 // actor for the X window directly under it, we walk down the stack |
| 1234 // until we find one. This is primarily needed for things like | 1228 // until we find one. |
| 1235 // xscreensaver in don't-use-the-MIT-screensaver-extension mode -- when | |
| 1236 // it activates and raises its screensaver window, we need to make sure | |
| 1237 // that it ends up on top of all other override-redirect windows. | |
| 1238 // TODO: We should do something similar for non-override-redirect | |
| 1239 // windows as well, but it's a) less critical there, since we already | |
| 1240 // restack their composited windows ourselves when we restack the | |
| 1241 // client windows, and b) tricky, because we also need to stack | |
| 1242 // compositing actors that aren't tied to X windows (e.g. the panel | |
| 1243 // bar, shadows, etc.). | |
| 1244 XWindow above_xid = e.above; | 1229 XWindow above_xid = e.above; |
| 1245 while (above_xid) { | 1230 while (above_xid) { |
| 1246 Window* above_win = GetWindow(above_xid); | 1231 Window* above_win = GetWindow(above_xid); |
| 1247 if (above_win) { | 1232 Compositor::Actor* above_actor = |
| 1233 above_win ? above_win->actor() : |
| 1234 stacking_manager_->GetActorIfLayerXid(above_xid); |
| 1235 |
| 1236 if (above_actor) { |
| 1248 DLOG(INFO) << "Stacking override-redirect window " << win->xid_str() | 1237 DLOG(INFO) << "Stacking override-redirect window " << win->xid_str() |
| 1249 << "'s above " << above_win->xid_str() << "'s actor"; | 1238 << "'s actor above window " << XidStr(above_xid) << "'s"; |
| 1250 win->StackCompositedAbove(above_win->actor(), NULL, false); | 1239 win->StackCompositedAbove(above_actor, NULL, false); |
| 1251 break; | 1240 break; |
| 1252 } | 1241 } |
| 1253 const XWindow* above_ptr = stacked_xids_->GetUnder(above_xid); | 1242 const XWindow* above_ptr = stacked_xids_->GetUnder(above_xid); |
| 1254 above_xid = above_ptr ? *above_ptr : 0; | 1243 above_xid = above_ptr ? *above_ptr : 0; |
| 1255 } | 1244 } |
| 1256 } else { | 1245 } else { |
| 1257 if (restacked) { | 1246 if (restacked) { |
| 1258 // _NET_CLIENT_LIST_STACKING only includes managed (i.e. | 1247 // _NET_CLIENT_LIST_STACKING only includes managed (i.e. |
| 1259 // non-override-redirect) windows, so we only update it when a | 1248 // non-override-redirect) windows, so we only update it when a |
| 1260 // managed window's stacking position changed. | 1249 // managed window's stacking position changed. |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 return i->first; | 1622 return i->first; |
| 1634 } | 1623 } |
| 1635 return 0; | 1624 return 0; |
| 1636 } | 1625 } |
| 1637 | 1626 |
| 1638 void WindowManager::SendNotifySyskeyMessage(chromeos::WmIpcSystemKey key) { | 1627 void WindowManager::SendNotifySyskeyMessage(chromeos::WmIpcSystemKey key) { |
| 1639 WmIpc::Message msg(chromeos::WM_IPC_MESSAGE_CHROME_NOTIFY_SYSKEY_PRESSED); | 1628 WmIpc::Message msg(chromeos::WM_IPC_MESSAGE_CHROME_NOTIFY_SYSKEY_PRESSED); |
| 1640 msg.set_param(0, key); | 1629 msg.set_param(0, key); |
| 1641 const XWindow chrome_window = GetArbitraryChromeWindow(); | 1630 const XWindow chrome_window = GetArbitraryChromeWindow(); |
| 1642 if (chrome_window) { | 1631 if (chrome_window) { |
| 1632 DLOG(INFO) << "Sending syskey notification with param " << key; |
| 1643 wm_ipc()->SendMessage(chrome_window, msg); | 1633 wm_ipc()->SendMessage(chrome_window, msg); |
| 1644 LOG(INFO) << "Syskey notification sent, param(0)=" << key; | |
| 1645 } else { | 1634 } else { |
| 1646 LOG(WARNING) << "Not sending syskey notification: " | 1635 LOG(WARNING) << "Not sending syskey notification: " |
| 1647 << "Chrome currently doesn't have any windows open."; | 1636 << "Chrome currently doesn't have any windows open."; |
| 1648 } | 1637 } |
| 1649 } | 1638 } |
| 1650 | 1639 |
| 1651 void WindowManager::ToggleHotkeyOverlay() { | 1640 void WindowManager::ToggleHotkeyOverlay() { |
| 1652 Compositor::Actor* group = hotkey_overlay_->group(); | 1641 Compositor::Actor* group = hotkey_overlay_->group(); |
| 1653 showing_hotkey_overlay_ = !showing_hotkey_overlay_; | 1642 showing_hotkey_overlay_ = !showing_hotkey_overlay_; |
| 1654 if (showing_hotkey_overlay_) { | 1643 if (showing_hotkey_overlay_) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 } | 1688 } |
| 1700 } | 1689 } |
| 1701 | 1690 |
| 1702 void WindowManager::QueryKeyboardState() { | 1691 void WindowManager::QueryKeyboardState() { |
| 1703 vector<uint8_t> keycodes; | 1692 vector<uint8_t> keycodes; |
| 1704 xconn_->QueryKeyboardState(&keycodes); | 1693 xconn_->QueryKeyboardState(&keycodes); |
| 1705 hotkey_overlay_->HandleKeyboardState(keycodes); | 1694 hotkey_overlay_->HandleKeyboardState(keycodes); |
| 1706 } | 1695 } |
| 1707 | 1696 |
| 1708 } // namespace window_manager | 1697 } // namespace window_manager |
| OLD | NEW |