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 #ifndef WINDOW_MANAGER_WM_IPC_H_ | 5 #ifndef WINDOW_MANAGER_WM_IPC_H_ |
6 #define WINDOW_MANAGER_WM_IPC_H_ | 6 #define WINDOW_MANAGER_WM_IPC_H_ |
7 | 7 |
8 #include <gdk/gdk.h> // for GdkEventClient | 8 #include <gdk/gdk.h> // for GdkEventClient |
9 extern "C" { | 9 extern "C" { |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 WindowType type, | 85 WindowType type, |
86 const std::vector<int>* params); | 86 const std::vector<int>* params); |
87 | 87 |
88 // Messages are sent via ClientMessageEvents that have 'message_type' set | 88 // Messages are sent via ClientMessageEvents that have 'message_type' set |
89 // to _CHROME_WM_MESSAGE, 'format' set to 32 (that is, 32-bit values), | 89 // to _CHROME_WM_MESSAGE, 'format' set to 32 (that is, 32-bit values), |
90 // and l[0] set to a value from the MessageType enum. The remaining four | 90 // and l[0] set to a value from the MessageType enum. The remaining four |
91 // values in the 'l' array contain data specific to the type of message | 91 // values in the 'l' array contain data specific to the type of message |
92 // being sent. | 92 // being sent. |
93 struct Message { | 93 struct Message { |
94 public: | 94 public: |
| 95 // NOTE: Don't remove values from this enum; it is shared between |
| 96 // Chrome and the window manager. |
95 enum Type { | 97 enum Type { |
96 UNKNOWN = 0, | 98 UNKNOWN = 0, |
97 | 99 |
98 // Notify Chrome when a floating tab has entered or left a tab | 100 // Notify Chrome when a floating tab has entered or left a tab |
99 // summary window. Sent to the summary window. | 101 // summary window. Sent to the summary window. |
100 // param[0]: X ID of the floating tab window | 102 // param[0]: X ID of the floating tab window |
101 // param[1]: state (0 means left, 1 means entered or currently in) | 103 // param[1]: state (0 means left, 1 means entered or currently in) |
102 // param[2]: X coordinate relative to summary window | 104 // param[2]: X coordinate relative to summary window |
103 // param[3]: Y coordinate | 105 // param[3]: Y coordinate |
104 CHROME_NOTIFY_FLOATING_TAB_OVER_TAB_SUMMARY, | 106 CHROME_NOTIFY_FLOATING_TAB_OVER_TAB_SUMMARY, |
(...skipping 13 matching lines...) Expand all Loading... |
118 CHROME_SET_TAB_SUMMARY_VISIBILITY, | 120 CHROME_SET_TAB_SUMMARY_VISIBILITY, |
119 | 121 |
120 // Tell the WM to collapse or expand a panel. | 122 // Tell the WM to collapse or expand a panel. |
121 // param[0]: X ID of the panel window | 123 // param[0]: X ID of the panel window |
122 // param[1]: desired state (0 means collapsed, 1 means expanded) | 124 // param[1]: desired state (0 means collapsed, 1 means expanded) |
123 WM_SET_PANEL_STATE, | 125 WM_SET_PANEL_STATE, |
124 | 126 |
125 // Notify Chrome that the panel state has changed. Sent to the panel | 127 // Notify Chrome that the panel state has changed. Sent to the panel |
126 // window. | 128 // window. |
127 // param[0]: new state (0 means collapsed, 1 means expanded) | 129 // param[0]: new state (0 means collapsed, 1 means expanded) |
128 // TODO: Get rid of this; Chrome can just watch for changes to the | 130 // TODO: Deprecate this; Chrome can just watch for changes to the |
129 // _CHROME_STATE property to get the same information. | 131 // _CHROME_STATE property to get the same information. |
130 CHROME_NOTIFY_PANEL_STATE, | 132 CHROME_NOTIFY_PANEL_STATE, |
131 | 133 |
132 // Instruct the WM to move a floating tab. The passed-in position is | 134 // Instruct the WM to move a floating tab. The passed-in position is |
133 // that of the cursor; the tab's composited window is displaced based | 135 // that of the cursor; the tab's composited window is displaced based |
134 // on the cursor's offset from the upper-left corner of the tab at | 136 // on the cursor's offset from the upper-left corner of the tab at |
135 // the start of the drag. | 137 // the start of the drag. |
136 // param[0]: X ID of the floating tab window | 138 // param[0]: X ID of the floating tab window |
137 // param[1]: X coordinate to which the tab should be moved | 139 // param[1]: X coordinate to which the tab should be moved |
138 // param[2]: Y coordinate | 140 // param[2]: Y coordinate |
139 WM_MOVE_FLOATING_TAB, | 141 WM_MOVE_FLOATING_TAB, |
140 | 142 |
141 // Instruct the WM to move a panel. | 143 // Notify the WM that a panel has been dragged. |
142 // param[0]: X ID of the panel window | 144 // param[0]: X ID of the panel's content window |
143 // param[1]: X coordinate to which the panel should be moved | 145 // param[1]: X coordinate to which the upper-right corner of the |
144 // param[2]: Y coordinate | 146 // panel's titlebar window was dragged |
145 WM_MOVE_PANEL, | 147 // param[2]: Y coordinate to which the upper-right corner of the |
| 148 // panel's titlebar window was dragged |
| 149 // Note: The point given is actually that of one pixel to the right |
| 150 // of the upper-right corner of the titlebar window. For example, a |
| 151 // no-op move message for a 10-pixel wide titlebar whose upper-left |
| 152 // point is at (0, 0) would contain the X and Y paremeters (10, 0): |
| 153 // in other words, the position of the titlebar's upper-left point |
| 154 // plus its width. This is intended to make both the Chrome and WM |
| 155 // side of things simpler and to avoid some easy-to-make off-by-one |
| 156 // errors. |
| 157 WM_NOTIFY_PANEL_DRAGGED, |
146 | 158 |
147 // Notify the WM that the panel drag is complete (that is, the mouse | 159 // Notify the WM that the panel drag is complete (that is, the mouse |
148 // button has been released). | 160 // button has been released). |
149 // param[0]: X ID of the panel window | 161 // param[0]: X ID of the panel's content window |
150 WM_NOTIFY_PANEL_DRAG_COMPLETE, | 162 WM_NOTIFY_PANEL_DRAG_COMPLETE, |
151 | 163 |
152 // Instruct the WM to focus a window (either top-level or a panel). | 164 // Instruct the WM to focus a window (either top-level or a panel). |
153 // This is used when a tab is clicked in a tab overview window, or | 165 // This is used when a tab is clicked in a tab overview window, or |
154 // when the user clicks on a panel's titlebar to expand it. | 166 // when the user clicks on a panel's titlebar to expand it. |
155 // param[0]: X ID of the window to focus | 167 // param[0]: X ID of the window to focus |
156 WM_FOCUS_WINDOW, | 168 WM_FOCUS_WINDOW, |
157 | 169 |
158 // Notify Chrome that the layout mode (for example, overview or | 170 // Notify Chrome that the layout mode (for example, overview or |
159 // focused) has changed. | 171 // focused) has changed. |
160 // param[0]: new mode (0 means focused, 1 means overview) | 172 // param[0]: new mode (0 means focused, 1 means overview) |
161 CHROME_NOTIFY_LAYOUT_MODE, | 173 CHROME_NOTIFY_LAYOUT_MODE, |
162 | 174 |
163 // Instruct the WM to enter overview mode. | 175 // Instruct the WM to enter overview mode. |
164 // param[0]: X ID of the window show the tab overview for. | 176 // param[0]: X ID of the window to show the tab overview for. |
165 WM_SWITCH_TO_OVERVIEW_MODE, | 177 WM_SWITCH_TO_OVERVIEW_MODE, |
166 | 178 |
| 179 // Let the WM know which version of this file Chrome is using. It's |
| 180 // difficult to make changes synchronously to Chrome and the WM (our |
| 181 // build scripts can use a locally-built Chromium, the latest one |
| 182 // from the buildbot, or an older hardcoded version), so it's useful |
| 183 // to be able to maintain compatibility in the WM with versions of |
| 184 // Chrome that exhibit older behavior. |
| 185 // |
| 186 // Chrome should send a message to the WM at startup containing the |
| 187 // latest version from the list below. For backwards compatibility, |
| 188 // the WM assumes version 0 if it doesn't receive a message. Here |
| 189 // are the changes that have been made in successive versions of the |
| 190 // protocol: |
| 191 // |
| 192 // 1: WM_NOTIFY_PANEL_DRAGGED contains the position of the |
| 193 // upper-right, rather than upper-left, corner of of the titlebar |
| 194 // window |
| 195 // |
| 196 // TODO: The latest version should be hardcoded in this file once the |
| 197 // file is being shared between Chrome and the WM so Chrome can just |
| 198 // pull it from there. Better yet, the message could be sent |
| 199 // automatically in WmIpc's c'tor. |
| 200 // |
| 201 // param[0]: version of this protocol currently supported |
| 202 WM_NOTIFY_IPC_VERSION, |
| 203 |
167 kNumTypes, | 204 kNumTypes, |
168 }; | 205 }; |
169 | 206 |
170 Message() { | 207 Message() { |
171 Init(UNKNOWN); | 208 Init(UNKNOWN); |
172 } | 209 } |
173 Message(Type type) { | 210 Message(Type type) { |
174 Init(type); | 211 Init(type); |
175 } | 212 } |
176 | 213 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 270 |
234 // Window used for sending messages to the window manager. | 271 // Window used for sending messages to the window manager. |
235 XWindow wm_window_; | 272 XWindow wm_window_; |
236 | 273 |
237 DISALLOW_COPY_AND_ASSIGN(WmIpc); | 274 DISALLOW_COPY_AND_ASSIGN(WmIpc); |
238 }; | 275 }; |
239 | 276 |
240 } // namespace window_manager | 277 } // namespace window_manager |
241 | 278 |
242 #endif // WINDOW_MANAGER_WM_IPC_H_ | 279 #endif // WINDOW_MANAGER_WM_IPC_H_ |
OLD | NEW |