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 #ifndef WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ | 5 #ifndef WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ |
6 #define WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ | 6 #define WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <tr1/memory> | 12 #include <tr1/memory> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 extern "C" { | 16 extern "C" { |
17 #include <X11/Xlib.h> | 17 #include <X11/Xlib.h> |
18 } | 18 } |
19 | 19 |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "window_manager/callback.h" | 21 #include "window_manager/callback.h" |
22 #include "window_manager/geometry.h" | 22 #include "window_manager/geometry.h" |
| 23 #include "window_manager/math_types.h" |
23 #include "window_manager/x11/x_connection.h" | 24 #include "window_manager/x11/x_connection.h" |
24 | 25 |
25 namespace window_manager { | 26 namespace window_manager { |
26 | 27 |
27 // This is a fake implementation of a connection to an X server. | 28 // This is a fake implementation of a connection to an X server. |
28 class MockXConnection : public XConnection { | 29 class MockXConnection : public XConnection { |
29 public: | 30 public: |
30 static const int kDisplayWidth; | 31 static const int kDisplayWidth; |
31 static const int kDisplayHeight; | 32 static const int kDisplayHeight; |
32 static const XID kTransparentCursor; | 33 static const XID kTransparentCursor; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 virtual void DestroySyncCounterAlarm(XID alarm_id); | 175 virtual void DestroySyncCounterAlarm(XID alarm_id); |
175 virtual bool SetDetectableKeyboardAutoRepeat(bool detectable) { | 176 virtual bool SetDetectableKeyboardAutoRepeat(bool detectable) { |
176 using_detectable_keyboard_auto_repeat_ = detectable; | 177 using_detectable_keyboard_auto_repeat_ = detectable; |
177 return true; | 178 return true; |
178 } | 179 } |
179 virtual bool QueryKeyboardState(std::vector<uint8_t>* keycodes_out) { | 180 virtual bool QueryKeyboardState(std::vector<uint8_t>* keycodes_out) { |
180 return true; | 181 return true; |
181 } | 182 } |
182 virtual bool QueryPointerPosition(Point* absolute_pos_out); | 183 virtual bool QueryPointerPosition(Point* absolute_pos_out); |
183 virtual bool SetWindowBackgroundPixmap(XWindow xid, XPixmap pixmap); | 184 virtual bool SetWindowBackgroundPixmap(XWindow xid, XPixmap pixmap); |
| 185 virtual bool RenderQueryExtension() { |
| 186 return true; |
| 187 } |
| 188 virtual XPixmap CreatePixmapFromContainer(const ImageContainer* container) { |
| 189 return 0; |
| 190 } |
| 191 virtual XPicture RenderCreatePicture(Drawable drawable, int depth) { |
| 192 return 0; |
| 193 } |
| 194 virtual void RenderComposite(bool blend, XPicture src, XPicture mask, |
| 195 XPicture dst, Point srcpos, Point maskpos, |
| 196 Matrix4 transform, Size size) {} |
| 197 virtual void RenderFreePicture(XPicture pict) {} |
| 198 virtual void RenderFillRectangle(XPicture dst, float red, float green, |
| 199 float blue, Point pos, Size size) {} |
| 200 |
184 // End XConnection methods. | 201 // End XConnection methods. |
185 | 202 |
186 // Testing-specific code. | 203 // Testing-specific code. |
187 struct WindowInfo { | 204 struct WindowInfo { |
188 WindowInfo(XWindow xid, XWindow parent); | 205 WindowInfo(XWindow xid, XWindow parent); |
189 | 206 |
190 // Information about a button grab installed on this window. | 207 // Information about a button grab installed on this window. |
191 struct ButtonGrabInfo { | 208 struct ButtonGrabInfo { |
192 ButtonGrabInfo() : event_mask(0), synchronous(false) {} | 209 ButtonGrabInfo() : event_mask(0), synchronous(false) {} |
193 ButtonGrabInfo(int event_mask, bool synchronous) | 210 ButtonGrabInfo(int event_mask, bool synchronous) |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // Alarms that have been registered to watch Sync extension counters. | 551 // Alarms that have been registered to watch Sync extension counters. |
535 std::map<XID, std::tr1::shared_ptr<SyncCounterAlarmInfo> > | 552 std::map<XID, std::tr1::shared_ptr<SyncCounterAlarmInfo> > |
536 sync_counter_alarms_; | 553 sync_counter_alarms_; |
537 | 554 |
538 DISALLOW_COPY_AND_ASSIGN(MockXConnection); | 555 DISALLOW_COPY_AND_ASSIGN(MockXConnection); |
539 }; | 556 }; |
540 | 557 |
541 } // namespace window_manager | 558 } // namespace window_manager |
542 | 559 |
543 #endif // WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ | 560 #endif // WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ |
OLD | NEW |