OLD | NEW |
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/window_manager.h" | 5 #include "window_manager/window_manager.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 extern "C" { | 9 extern "C" { |
10 #include <gdk/gdkx.h> | 10 #include <gdk/gdkx.h> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 stage_(NULL), | 155 stage_(NULL), |
156 background_(NULL), | 156 background_(NULL), |
157 stage_xid_(None), | 157 stage_xid_(None), |
158 overlay_xid_(None), | 158 overlay_xid_(None), |
159 background_xid_(None), | 159 background_xid_(None), |
160 stacking_manager_(NULL), | 160 stacking_manager_(NULL), |
161 mapped_xids_(new Stacker<XWindow>), | 161 mapped_xids_(new Stacker<XWindow>), |
162 stacked_xids_(new Stacker<XWindow>), | 162 stacked_xids_(new Stacker<XWindow>), |
163 active_window_xid_(None), | 163 active_window_xid_(None), |
164 query_keyboard_state_timer_(0), | 164 query_keyboard_state_timer_(0), |
165 showing_hotkey_overlay_(false) { | 165 showing_hotkey_overlay_(false), |
| 166 wm_ipc_version_(0) { |
166 CHECK(xconn_); | 167 CHECK(xconn_); |
167 CHECK(clutter_); | 168 CHECK(clutter_); |
168 } | 169 } |
169 | 170 |
170 WindowManager::~WindowManager() { | 171 WindowManager::~WindowManager() { |
171 if (wm_xid_) | 172 if (wm_xid_) |
172 xconn_->DestroyWindow(wm_xid_); | 173 xconn_->DestroyWindow(wm_xid_); |
173 if (background_xid_) | 174 if (background_xid_) |
174 xconn_->DestroyWindow(background_xid_); | 175 xconn_->DestroyWindow(background_xid_); |
175 } | 176 } |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 } | 811 } |
811 return false; | 812 return false; |
812 } | 813 } |
813 | 814 |
814 bool WindowManager::HandleClientMessage(const XClientMessageEvent& e) { | 815 bool WindowManager::HandleClientMessage(const XClientMessageEvent& e) { |
815 VLOG(2) << "Handling client message for window " << XidStr(e.window) | 816 VLOG(2) << "Handling client message for window " << XidStr(e.window) |
816 << " with type " << XidStr(e.message_type) << " (" | 817 << " with type " << XidStr(e.message_type) << " (" |
817 << GetXAtomName(e.message_type) << ") and format " << e.format; | 818 << GetXAtomName(e.message_type) << ") and format " << e.format; |
818 WmIpc::Message msg; | 819 WmIpc::Message msg; |
819 if (wm_ipc_->GetMessage(e, &msg)) { | 820 if (wm_ipc_->GetMessage(e, &msg)) { |
| 821 if (msg.type() == WmIpc::Message::WM_NOTIFY_IPC_VERSION) { |
| 822 wm_ipc_version_ = msg.param(0); |
| 823 LOG(INFO) << "Got WM_NOTIFY_IPC_VERSION message saying that Chrome is " |
| 824 << "using version " << wm_ipc_version_; |
| 825 return true; |
| 826 } |
820 for (std::set<EventConsumer*>::iterator it = event_consumers_.begin(); | 827 for (std::set<EventConsumer*>::iterator it = event_consumers_.begin(); |
821 it != event_consumers_.end(); ++it) { | 828 it != event_consumers_.end(); ++it) { |
822 if ((*it)->HandleChromeMessage(msg)) | 829 if ((*it)->HandleChromeMessage(msg)) |
823 return true; | 830 return true; |
824 } | 831 } |
825 LOG(WARNING) << "Ignoring unhandled WM message of type " | 832 LOG(WARNING) << "Ignoring unhandled WM message of type " |
826 << XidStr(msg.type()); | 833 << XidStr(msg.type()); |
827 } else { | 834 } else { |
828 for (std::set<EventConsumer*>::iterator it = event_consumers_.begin(); | 835 for (std::set<EventConsumer*>::iterator it = event_consumers_.begin(); |
829 it != event_consumers_.end(); ++it) { | 836 it != event_consumers_.end(); ++it) { |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 // TODO: Display the message onscreen. | 1473 // TODO: Display the message onscreen. |
1467 } | 1474 } |
1468 | 1475 |
1469 void WindowManager::QueryKeyboardState() { | 1476 void WindowManager::QueryKeyboardState() { |
1470 std::vector<uint8_t> keycodes; | 1477 std::vector<uint8_t> keycodes; |
1471 xconn_->QueryKeyboardState(&keycodes); | 1478 xconn_->QueryKeyboardState(&keycodes); |
1472 hotkey_overlay_->HandleKeyboardState(keycodes); | 1479 hotkey_overlay_->HandleKeyboardState(keycodes); |
1473 } | 1480 } |
1474 | 1481 |
1475 } // namespace window_manager | 1482 } // namespace window_manager |
OLD | NEW |