| 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, |
| 195 XPicture src, |
| 196 XPicture mask, |
| 197 XPicture dst, |
| 198 const Point& srcpos, |
| 199 const Point& maskpos, |
| 200 const Matrix4& transform, |
| 201 const Size& size) {} |
| 202 virtual bool RenderFreePicture(XPicture pict) {return true;} |
| 203 virtual void RenderFillRectangle(XPicture dst, |
| 204 float red, |
| 205 float green, |
| 206 float blue, |
| 207 const Point& pos, |
| 208 const Size& size) {} |
| 209 |
| 184 // End XConnection methods. | 210 // End XConnection methods. |
| 185 | 211 |
| 186 // Testing-specific code. | 212 // Testing-specific code. |
| 187 struct WindowInfo { | 213 struct WindowInfo { |
| 188 WindowInfo(XWindow xid, XWindow parent); | 214 WindowInfo(XWindow xid, XWindow parent); |
| 189 | 215 |
| 190 // Information about a button grab installed on this window. | 216 // Information about a button grab installed on this window. |
| 191 struct ButtonGrabInfo { | 217 struct ButtonGrabInfo { |
| 192 ButtonGrabInfo() : event_mask(0), synchronous(false) {} | 218 ButtonGrabInfo() : event_mask(0), synchronous(false) {} |
| 193 ButtonGrabInfo(int event_mask, bool synchronous) | 219 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. | 560 // Alarms that have been registered to watch Sync extension counters. |
| 535 std::map<XID, std::tr1::shared_ptr<SyncCounterAlarmInfo> > | 561 std::map<XID, std::tr1::shared_ptr<SyncCounterAlarmInfo> > |
| 536 sync_counter_alarms_; | 562 sync_counter_alarms_; |
| 537 | 563 |
| 538 DISALLOW_COPY_AND_ASSIGN(MockXConnection); | 564 DISALLOW_COPY_AND_ASSIGN(MockXConnection); |
| 539 }; | 565 }; |
| 540 | 566 |
| 541 } // namespace window_manager | 567 } // namespace window_manager |
| 542 | 568 |
| 543 #endif // WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ | 569 #endif // WINDOW_MANAGER_X11_MOCK_X_CONNECTION_H_ |
| OLD | NEW |