diff options
Diffstat (limited to 'client/windows')
-rw-r--r-- | client/windows/pixels_source.cpp | 8 | ||||
-rw-r--r-- | client/windows/platform.cpp | 32 | ||||
-rw-r--r-- | client/windows/red_drawable.cpp | 12 | ||||
-rw-r--r-- | client/windows/red_window.cpp | 50 |
4 files changed, 51 insertions, 51 deletions
diff --git a/client/windows/pixels_source.cpp b/client/windows/pixels_source.cpp index 6d210f09..178b88fd 100644 --- a/client/windows/pixels_source.cpp +++ b/client/windows/pixels_source.cpp @@ -23,10 +23,10 @@ #include "debug.h" -static Point get_bitmap_size(HDC dc) +static SpicePoint get_bitmap_size(HDC dc) { BITMAP bitmap_info; - Point size; + SpicePoint size; GetObject(GetCurrentObject(dc, OBJ_BITMAP), sizeof(bitmap_info), &bitmap_info); @@ -74,7 +74,7 @@ ImageFromRes::~ImageFromRes() } } -Point ImageFromRes::get_size() +SpicePoint ImageFromRes::get_size() { ResImage_p* p_data = (ResImage_p*)get_opaque(); Lock lock(*p_data->source_p._mutex); @@ -99,7 +99,7 @@ AlphaImageFromRes::~AlphaImageFromRes() } } -Point AlphaImageFromRes::get_size() +SpicePoint AlphaImageFromRes::get_size() { ResImage_p* p_data = (ResImage_p*)get_opaque(); Lock lock(*p_data->source_p._mutex); diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index c364b35d..5b31798c 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -233,8 +233,8 @@ public: WinMonitor(int id, const wchar_t* name, const wchar_t* string); virtual int get_depth() { return _depth;} - virtual Point get_position(); - virtual Point get_size() const { Point size = {_width, _height}; return size;} + virtual SpicePoint get_position(); + virtual SpicePoint get_size() const { SpicePoint size = {_width, _height}; return size;} virtual bool is_out_of_sync() { return _out_of_sync;} virtual int get_screen_id() { return 0;} @@ -252,7 +252,7 @@ private: std::wstring _dev_name; std::wstring _dev_string; bool _active; - Point _position; + SpicePoint _position; int _width; int _height; int _depth; @@ -287,7 +287,7 @@ void WinMonitor::update_position() _depth = mode.dmBitsPerPel; } -Point WinMonitor::get_position() +SpicePoint WinMonitor::get_position() { update_position(); return _position; @@ -546,8 +546,8 @@ void Platform::reset_cursor_pos() if (!primary_monitor) { return; } - Point pos = primary_monitor->get_position(); - Point size = primary_monitor->get_size(); + SpicePoint pos = primary_monitor->get_position(); + SpicePoint size = primary_monitor->get_size(); SetCursorPos(pos.x + size.x / 2, pos.y + size.y / 2); } @@ -572,14 +572,14 @@ private: WinLocalCursor::WinLocalCursor(CursorData* cursor_data) : _shared (false) { - const CursorHeader& header = cursor_data->header(); + const SpiceCursorHeader& header = cursor_data->header(); const uint8_t* data = cursor_data->data(); int cur_size; int bits = get_size_bits(header, cur_size); if (!bits) { THROW("invalid curosr type"); } - if (header.type == CURSOR_TYPE_MONO) { + if (header.type == SPICE_CURSOR_TYPE_MONO) { _handle = CreateCursor(NULL, header.hot_spot_x, header.hot_spot_y, header.width, header.height, data, data + cur_size); return; @@ -592,9 +592,9 @@ WinLocalCursor::WinLocalCursor(CursorData* cursor_data) HDC hdc = GetDC(NULL); switch (header.type) { - case CURSOR_TYPE_ALPHA: - case CURSOR_TYPE_COLOR32: - case CURSOR_TYPE_COLOR16: { + case SPICE_CURSOR_TYPE_ALPHA: + case SPICE_CURSOR_TYPE_COLOR32: + case SPICE_CURSOR_TYPE_COLOR16: { BITMAPV5HEADER bmp_hdr; ZeroMemory(&bmp_hdr, sizeof(bmp_hdr)); bmp_hdr.bV5Size = sizeof(bmp_hdr); @@ -612,7 +612,7 @@ WinLocalCursor::WinLocalCursor(CursorData* cursor_data) bmp_hdr.bV5GreenMask = 0x000003E0; bmp_hdr.bV5BlueMask = 0x0000001F; } - if (header.type == CURSOR_TYPE_ALPHA) { + if (header.type == SPICE_CURSOR_TYPE_ALPHA) { bmp_hdr.bV5AlphaMask = 0xFF000000; } void* bmp_pixels = NULL; @@ -620,11 +620,11 @@ WinLocalCursor::WinLocalCursor(CursorData* cursor_data) NULL, 0); memcpy(bmp_pixels, data, cur_size); icon.hbmMask = CreateBitmap(header.width, header.height, 1, 1, - (header.type == CURSOR_TYPE_ALPHA) ? NULL : + (header.type == SPICE_CURSOR_TYPE_ALPHA) ? NULL : (CONST VOID *)(data + cur_size)); break; } - case CURSOR_TYPE_COLOR4: { + case SPICE_CURSOR_TYPE_COLOR4: { BITMAPINFO* bmp_info; bmp_info = (BITMAPINFO *)new uint8_t[sizeof(BITMAPINFO) + (sizeof(RGBQUAD) << bits)]; ZeroMemory(bmp_info, sizeof(BITMAPINFO)); @@ -642,8 +642,8 @@ WinLocalCursor::WinLocalCursor(CursorData* cursor_data) delete[] (uint8_t *)bmp_info; break; } - case CURSOR_TYPE_COLOR24: - case CURSOR_TYPE_COLOR8: + case SPICE_CURSOR_TYPE_COLOR24: + case SPICE_CURSOR_TYPE_COLOR8: default: LOG_WARN("unsupported cursor type %d", header.type); _handle = LoadCursor(NULL, IDC_ARROW); diff --git a/client/windows/red_drawable.cpp b/client/windows/red_drawable.cpp index 13d4a21e..cac7299e 100644 --- a/client/windows/red_drawable.cpp +++ b/client/windows/red_drawable.cpp @@ -23,7 +23,7 @@ static const uint64_t lock_timout = 1000 * 1000 * 10; /*10ms*/ -void RedDrawable::copy_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& dest) +void RedDrawable::copy_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& dest) { PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque(); PixelsSource_p* src_p_data = (PixelsSource_p*)src.get_opaque(); @@ -42,7 +42,7 @@ void RedDrawable::copy_pixels(const PixelsSource& src, int src_x, int src_y, con } } -void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& dest) +void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& dest) { static BLENDFUNCTION blend_func = { AC_SRC_OVER, 0, 0xff, AC_SRC_ALPHA}; @@ -63,7 +63,7 @@ void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, co } } -void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& dest, +void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& dest, CombineOP op) { DWORD rop; @@ -97,7 +97,7 @@ void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y, } } -void RedDrawable::erase_rect(const Rect& rect, rgb32_t color) +void RedDrawable::erase_rect(const SpiceRect& rect, rgb32_t color) { RECT r; r.left = rect.left + _origin.x; @@ -110,7 +110,7 @@ void RedDrawable::erase_rect(const Rect& rect, rgb32_t color) FillRect(dest_p_data->dc, &r, (HBRUSH)GetStockObject(BLACK_BRUSH)); } -void RedDrawable::fill_rect(const Rect& rect, rgb32_t color) +void RedDrawable::fill_rect(const SpiceRect& rect, rgb32_t color) { RECT r; r.left = rect.left + _origin.x; @@ -130,7 +130,7 @@ void RedDrawable::fill_rect(const Rect& rect, rgb32_t color) DeleteObject(brush); } -void RedDrawable::frame_rect(const Rect& rect, rgb32_t color) +void RedDrawable::frame_rect(const SpiceRect& rect, rgb32_t color) { RECT r; r.left = rect.left + _origin.x; diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp index 2d415d1e..a2522d9f 100644 --- a/client/windows/red_window.cpp +++ b/client/windows/red_window.cpp @@ -44,9 +44,9 @@ static LRESULT CALLBACK MessageFilterProc(int nCode, WPARAM wParam, LPARAM lPara static inline int to_red_mouse_state(WPARAM wParam) { - return ((wParam & MK_LBUTTON) ? REDC_LBUTTON_MASK : 0) | - ((wParam & MK_MBUTTON) ? REDC_MBUTTON_MASK : 0) | - ((wParam & MK_RBUTTON) ? REDC_RBUTTON_MASK : 0); + return ((wParam & MK_LBUTTON) ? SPICE_MOUSE_BUTTON_MASK_LEFT : 0) | + ((wParam & MK_MBUTTON) ? SPICE_MOUSE_BUTTON_MASK_MIDDLE : 0) | + ((wParam & MK_RBUTTON) ? SPICE_MOUSE_BUTTON_MASK_RIGHT : 0); } static inline RedKey translate_key(int virtual_key, uint32_t scan, bool escape) @@ -146,8 +146,8 @@ LRESULT CALLBACK RedWindow_p::WindowProc(HWND hWnd, UINT message, WPARAM wParam, HDC hdc; hdc = BeginPaint(hWnd, &ps); - Point origin = window->get_origin(); - Rect r; + SpicePoint origin = window->get_origin(); + SpiceRect r; r.left = ps.rcPaint.left - origin.x; r.top = ps.rcPaint.top - origin.y; r.right = ps.rcPaint.right - origin.x; @@ -157,7 +157,7 @@ LRESULT CALLBACK RedWindow_p::WindowProc(HWND hWnd, UINT message, WPARAM wParam, break; } case WM_MOUSEMOVE: { - Point origin = window->get_origin(); + SpicePoint origin = window->get_origin(); int x = LOWORD(lParam) - origin.x; int y = HIWORD(lParam) - origin.y; unsigned int buttons_state = to_red_mouse_state(wParam); @@ -178,39 +178,39 @@ LRESULT CALLBACK RedWindow_p::WindowProc(HWND hWnd, UINT message, WPARAM wParam, window->on_focus_out(); break; case WM_LBUTTONDOWN: - window->get_listener().on_mouse_button_press(REDC_MOUSE_LBUTTON, + window->get_listener().on_mouse_button_press(SPICE_MOUSE_BUTTON_LEFT, to_red_mouse_state(wParam)); break; case WM_LBUTTONUP: - window->get_listener().on_mouse_button_release(REDC_MOUSE_LBUTTON, + window->get_listener().on_mouse_button_release(SPICE_MOUSE_BUTTON_LEFT, to_red_mouse_state(wParam)); break; case WM_RBUTTONDOWN: - window->get_listener().on_mouse_button_press(REDC_MOUSE_RBUTTON, + window->get_listener().on_mouse_button_press(SPICE_MOUSE_BUTTON_RIGHT, to_red_mouse_state(wParam)); break; case WM_RBUTTONUP: - window->get_listener().on_mouse_button_release(REDC_MOUSE_RBUTTON, + window->get_listener().on_mouse_button_release(SPICE_MOUSE_BUTTON_RIGHT, to_red_mouse_state(wParam)); break; case WM_MBUTTONDOWN: - window->get_listener().on_mouse_button_press(REDC_MOUSE_MBUTTON, + window->get_listener().on_mouse_button_press(SPICE_MOUSE_BUTTON_MIDDLE, to_red_mouse_state(wParam)); break; case WM_MBUTTONUP: - window->get_listener().on_mouse_button_release(REDC_MOUSE_MBUTTON, + window->get_listener().on_mouse_button_release(SPICE_MOUSE_BUTTON_MIDDLE, to_red_mouse_state(wParam)); break; case WM_MOUSEWHEEL: if (HIWORD(wParam) & 0x8000) { - window->get_listener().on_mouse_button_press(REDC_MOUSE_DBUTTON, + window->get_listener().on_mouse_button_press(SPICE_MOUSE_BUTTON_DOWN, to_red_mouse_state(wParam)); - window->get_listener().on_mouse_button_release(REDC_MOUSE_DBUTTON, + window->get_listener().on_mouse_button_release(SPICE_MOUSE_BUTTON_DOWN, to_red_mouse_state(wParam)); } else { - window->get_listener().on_mouse_button_press(REDC_MOUSE_UBUTTON, + window->get_listener().on_mouse_button_press(SPICE_MOUSE_BUTTON_UP, to_red_mouse_state(wParam)); - window->get_listener().on_mouse_button_release(REDC_MOUSE_UBUTTON, + window->get_listener().on_mouse_button_release(SPICE_MOUSE_BUTTON_UP, to_red_mouse_state(wParam)); } break; @@ -369,7 +369,7 @@ void RedWindow_p::on_pos_changing(RedWindow& red_window) if (_minimized || IsIconic(_win)) { return; } - Point pos = red_window.get_position(); + SpicePoint pos = red_window.get_position(); _x = pos.x; _y = pos.y; _valid_pos = true; @@ -529,7 +529,7 @@ void RedWindow::hide() ShowWindow(_win, SW_HIDE); } -static void client_to_window_size(HWND win, int width, int height, Point& win_size, +static void client_to_window_size(HWND win, int width, int height, SpicePoint& win_size, RedWindow::Type type) { RECT area; @@ -593,7 +593,7 @@ public: Region_p(HRGN region) : _region (region) {} ~Region_p() {} - void get_bbox(Rect& bbox) const + void get_bbox(SpiceRect& bbox) const { RECT box; @@ -615,13 +615,13 @@ private: HRGN _region; }; -bool RedWindow::get_mouse_anchor_point(Point& pt) +bool RedWindow::get_mouse_anchor_point(SpicePoint& pt) { AutoGDIObject region(CreateRectRgn(0, 0, 0, 0)); WindowDC win_dc(_win); GetRandomRgn(*win_dc, (HRGN)region.get(), SYSRGN); - Point anchor; + SpicePoint anchor; Region_p region_p((HRGN)region.get()); if (!find_anchor_point(region_p, anchor)) { return false; @@ -686,9 +686,9 @@ void RedWindow::show_cursor() } } -Point RedWindow::get_position() +SpicePoint RedWindow::get_position() { - Point position; + SpicePoint position; if (_minimized || IsIconic(_win)) { if (_valid_pos) { position.x = _x; @@ -705,11 +705,11 @@ Point RedWindow::get_position() return position; } -Point RedWindow::get_size() +SpicePoint RedWindow::get_size() { RECT client_rect; GetClientRect(_win, &client_rect); - Point pt = {client_rect.right - client_rect.left, client_rect.bottom - client_rect.top}; + SpicePoint pt = {client_rect.right - client_rect.left, client_rect.bottom - client_rect.top}; return pt; } |