OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/wm_ipc.h" | 5 #include "chrome/browser/chromeos/wm_ipc.h" |
6 | 6 |
7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
8 extern "C" { | 8 extern "C" { |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 } | 10 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 WindowType type, | 77 WindowType type, |
78 const std::vector<int>* params) { | 78 const std::vector<int>* params) { |
79 std::vector<int> values; | 79 std::vector<int> values; |
80 values.push_back(type); | 80 values.push_back(type); |
81 if (params) | 81 if (params) |
82 values.insert(values.end(), params->begin(), params->end()); | 82 values.insert(values.end(), params->begin(), params->end()); |
83 return SetIntProperty(x11_util::GetX11WindowFromGtkWidget(widget), | 83 return SetIntProperty(x11_util::GetX11WindowFromGtkWidget(widget), |
84 type_to_atom_[ATOM_CHROME_WINDOW_TYPE], values); | 84 type_to_atom_[ATOM_CHROME_WINDOW_TYPE], values); |
85 } | 85 } |
86 | 86 |
87 WmIpc::WindowType WmIpc::GetWindowType(GtkWidget* widget) { | 87 WmIpc::WindowType WmIpc::GetWindowType(GtkWidget* widget, |
88 int type; | 88 std::vector<int>* params) { |
89 if (x11_util::GetIntProperty( | 89 std::vector<int> properties; |
| 90 if (x11_util::GetIntArrayProperty( |
90 x11_util::GetX11WindowFromGtkWidget(widget), | 91 x11_util::GetX11WindowFromGtkWidget(widget), |
91 atom_to_string_[type_to_atom_[ATOM_CHROME_WINDOW_TYPE]], | 92 atom_to_string_[type_to_atom_[ATOM_CHROME_WINDOW_TYPE]], |
92 &type)) { | 93 &properties)) { |
| 94 int type = properties.front(); |
| 95 if (params) { |
| 96 params->clear(); |
| 97 params->insert(params->begin(), properties.begin() + 1, properties.end()); |
| 98 } |
93 return static_cast<WindowType>(type); | 99 return static_cast<WindowType>(type); |
94 } else { | 100 } else { |
95 return WINDOW_TYPE_UNKNOWN; | 101 return WINDOW_TYPE_UNKNOWN; |
96 } | 102 } |
97 } | 103 } |
98 | 104 |
99 void WmIpc::SendMessage(const Message& msg) { | 105 void WmIpc::SendMessage(const Message& msg) { |
100 XEvent e; | 106 XEvent e; |
101 e.xclient.type = ClientMessage; | 107 e.xclient.type = ClientMessage; |
102 e.xclient.window = wm_; | 108 e.xclient.window = wm_; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // Let the window manager know which version of the IPC messages we support. | 253 // Let the window manager know which version of the IPC messages we support. |
248 Message msg(Message::WM_NOTIFY_IPC_VERSION); | 254 Message msg(Message::WM_NOTIFY_IPC_VERSION); |
249 // TODO: The version number is the latest listed in wm_ipc.h -- | 255 // TODO: The version number is the latest listed in wm_ipc.h -- |
250 // ideally, once this header is shared between Chrome and the Chrome OS window | 256 // ideally, once this header is shared between Chrome and the Chrome OS window |
251 // manager, we'll just define the version statically in the header. | 257 // manager, we'll just define the version statically in the header. |
252 msg.set_param(0, 1); | 258 msg.set_param(0, 1); |
253 SendMessage(msg); | 259 SendMessage(msg); |
254 } | 260 } |
255 | 261 |
256 } // namespace chromeos | 262 } // namespace chromeos |
OLD | NEW |