From 1f516978527b223882c02d8c23834a0f30279dec Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 4 Feb 2010 18:04:26 +0100 Subject: Rename symbols that were changed in spice-protocol This is an automatic change using: $ find -name "*.[ch]" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames $ find -name "*.cpp" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames --- client/application.cpp | 70 +++++------ client/application.h | 4 +- client/canvas.cpp | 98 +++++++-------- client/canvas.h | 88 +++++++------- client/cursor.cpp | 32 ++--- client/cursor.h | 8 +- client/cursor_channel.cpp | 144 +++++++++++----------- client/cursor_channel.h | 6 +- client/display_channel.cpp | 250 +++++++++++++++++++-------------------- client/display_channel.h | 4 +- client/glz_decode_tmpl.c | 2 +- client/glz_decoder.cpp | 4 +- client/glz_decoder.h | 2 +- client/gui/gui.cpp | 44 +++---- client/gui/resource_provider.cpp | 4 +- client/gui/resource_provider.h | 4 +- client/gui/softrenderer.cpp | 16 +-- client/gui/softrenderer.h | 10 +- client/gui/softtexture.cpp | 6 +- client/gui/softtexture.h | 6 +- client/inputs_channel.cpp | 90 +++++++------- client/inputs_channel.h | 4 +- client/monitor.h | 4 +- client/pixels_source.h | 10 +- client/playback_channel.cpp | 78 ++++++------ client/record_channel.cpp | 64 +++++----- client/red_cairo_canvas.cpp | 32 ++--- client/red_cairo_canvas.h | 30 ++--- client/red_channel.cpp | 76 ++++++------ client/red_channel.h | 8 +- client/red_client.cpp | 122 +++++++++---------- client/red_client.h | 6 +- client/red_drawable.h | 12 +- client/red_gdi_canvas.cpp | 30 ++--- client/red_gdi_canvas.h | 28 ++--- client/red_gl_canvas.cpp | 30 ++--- client/red_gl_canvas.h | 28 ++--- client/red_peer.cpp | 8 +- client/red_peer.h | 6 +- client/red_pixmap.h | 2 +- client/red_pixmap_gl.h | 2 +- client/red_window.h | 22 ++-- client/screen.cpp | 24 ++-- client/screen.h | 24 ++-- client/screen_layer.cpp | 14 +-- client/screen_layer.h | 10 +- client/tunnel_channel.cpp | 144 +++++++++++----------- client/windows/pixels_source.cpp | 8 +- client/windows/platform.cpp | 32 ++--- client/windows/red_drawable.cpp | 12 +- client/windows/red_window.cpp | 50 ++++---- client/x11/pixels_source.cpp | 8 +- client/x11/platform.cpp | 208 ++++++++++++++++---------------- client/x11/red_drawable.cpp | 112 +++++++++--------- client/x11/red_pixmap_gl.cpp | 2 +- client/x11/red_window.cpp | 66 +++++------ client/x11/red_window_p.h | 2 +- 57 files changed, 1105 insertions(+), 1105 deletions(-) (limited to 'client') diff --git a/client/application.cpp b/client/application.cpp index 7655809d..cca7d434 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -154,9 +154,9 @@ private: private: AlphaImageFromRes _info_pixmap; AlphaImageFromRes _sticky_pixmap; - Point _info_pos; - Point _sticky_pos; - Rect _sticky_rect; + SpicePoint _info_pos; + SpicePoint _sticky_pos; + SpiceRect _sticky_rect; bool _sticky_on; RecurciveMutex _update_lock; }; @@ -172,7 +172,7 @@ InfoLayer::InfoLayer() void InfoLayer::draw_info(const QRegion& dest_region, RedDrawable& dest) { for (int i = 0; i < (int)dest_region.num_rects; i++) { - Rect* r = &dest_region.rects[i]; + SpiceRect* r = &dest_region.rects[i]; /* is rect inside sticky region or info region? */ if (_sticky_on && rect_intersects(*r, _sticky_rect)) { dest.blend_pixels(_sticky_pixmap, r->left - _sticky_pos.x, r->top - _sticky_pos.y, *r); @@ -194,9 +194,9 @@ void InfoLayer::set_info_mode() ASSERT(screen()); - Point size = _info_pixmap.get_size(); - Point screen_size = screen()->get_size(); - Rect r; + SpicePoint size = _info_pixmap.get_size(); + SpicePoint screen_size = screen()->get_size(); + SpiceRect r; r.left = (screen_size.x - size.x) / 2; r.right = r.left + size.x; @@ -211,8 +211,8 @@ void InfoLayer::set_info_mode() void InfoLayer::update_sticky_rect() { - Point size = _sticky_pixmap.get_size(); - Point screen_size = screen()->get_size(); + SpicePoint size = _sticky_pixmap.get_size(); + SpicePoint screen_size = screen()->get_size(); _sticky_pos.x = (screen_size.x - size.x) / 2; _sticky_pos.y = screen_size.y * 2 / 3; @@ -315,7 +315,7 @@ enum AppCommands { Application::Application() : ProcessLoop (this) , _client (*this) - , _enabled_channels (RED_CHANNEL_END, true) + , _enabled_channels (SPICE_END_CHANNEL, true) , _main_screen (NULL) , _active (false) , _full_screen (false) @@ -381,7 +381,7 @@ Application::Application() _gui_test_timer.reset(new TestTimer(*this)); activate_interval_timer(*_gui_test_timer, 1000 * 30); #endif - for (int i = RED_CHANNEL_MAIN; i < RED_CHANNEL_END; i++) { + for (int i = SPICE_CHANNEL_MAIN; i < SPICE_END_CHANNEL; i++) { _peer_con_opt[i] = RedPeer::ConnectionOptions::CON_OP_BOTH; } } @@ -579,10 +579,10 @@ RedScreen* Application::get_screen(int id) if (!(screen = _screens[id])) { Monitor* mon = find_monitor(id); - Point size; + SpicePoint size; if (_full_screen && mon) { - Point size = mon->get_size(); + SpicePoint size = mon->get_size(); } else { size.x = SCREEN_INIT_WIDTH; size.y = SCREEN_INIT_HEIGHT; @@ -1310,10 +1310,10 @@ void Application::prepare_monitors() if (_screens[i] && (mon = _screens[i]->get_monitor())) { if (_screens[i]->is_size_locked()) { - Point size = _screens[i]->get_size(); + SpicePoint size = _screens[i]->get_size(); mon->set_mode(size.x, size.y); } else { - Point size = mon->get_size(); + SpicePoint size = mon->get_size(); _screens[i]->resize(size.x, size.y); } } @@ -1644,13 +1644,13 @@ bool Application::set_channels_security(CmdLineParser& parser, bool on, char *va typedef std::map< std::string, int> ChannelsNamesMap; ChannelsNamesMap channels_names; - channels_names["main"] = RED_CHANNEL_MAIN; - channels_names["display"] = RED_CHANNEL_DISPLAY; - channels_names["inputs"] = RED_CHANNEL_INPUTS; - channels_names["cursor"] = RED_CHANNEL_CURSOR; - channels_names["playback"] = RED_CHANNEL_PLAYBACK; - channels_names["record"] = RED_CHANNEL_RECORD; - channels_names["tunnel"] = RED_CHANNEL_TUNNEL; + channels_names["main"] = SPICE_CHANNEL_MAIN; + channels_names["display"] = SPICE_CHANNEL_DISPLAY; + channels_names["inputs"] = SPICE_CHANNEL_INPUTS; + channels_names["cursor"] = SPICE_CHANNEL_CURSOR; + channels_names["playback"] = SPICE_CHANNEL_PLAYBACK; + channels_names["record"] = SPICE_CHANNEL_RECORD; + channels_names["tunnel"] = SPICE_CHANNEL_TUNNEL; if (!strcmp(val, "all")) { if ((val = parser.next_argument())) { @@ -1711,12 +1711,12 @@ bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char * { typedef std::map< std::string, int> ChannelsNamesMap; ChannelsNamesMap channels_names; - channels_names["display"] = RED_CHANNEL_DISPLAY; - channels_names["inputs"] = RED_CHANNEL_INPUTS; - channels_names["cursor"] = RED_CHANNEL_CURSOR; - channels_names["playback"] = RED_CHANNEL_PLAYBACK; - channels_names["record"] = RED_CHANNEL_RECORD; - channels_names["tunnel"] = RED_CHANNEL_TUNNEL; + channels_names["display"] = SPICE_CHANNEL_DISPLAY; + channels_names["inputs"] = SPICE_CHANNEL_INPUTS; + channels_names["cursor"] = SPICE_CHANNEL_CURSOR; + channels_names["playback"] = SPICE_CHANNEL_PLAYBACK; + channels_names["record"] = SPICE_CHANNEL_RECORD; + channels_names["tunnel"] = SPICE_CHANNEL_TUNNEL; if (!strcmp(val, "all")) { if ((val = parser.next_argument())) { @@ -1750,27 +1750,27 @@ void Application::on_cmd_line_invalid_arg(const char* arg0, const char* what, co void Application::register_channels() { - if (_enabled_channels[RED_CHANNEL_DISPLAY]) { + if (_enabled_channels[SPICE_CHANNEL_DISPLAY]) { _client.register_channel_factory(DisplayChannel::Factory()); } - if (_enabled_channels[RED_CHANNEL_CURSOR]) { + if (_enabled_channels[SPICE_CHANNEL_CURSOR]) { _client.register_channel_factory(CursorChannel::Factory()); } - if (_enabled_channels[RED_CHANNEL_INPUTS]) { + if (_enabled_channels[SPICE_CHANNEL_INPUTS]) { _client.register_channel_factory(InputsChannel::Factory()); } - if (_enabled_channels[RED_CHANNEL_PLAYBACK]) { + if (_enabled_channels[SPICE_CHANNEL_PLAYBACK]) { _client.register_channel_factory(PlaybackChannel::Factory()); } - if (_enabled_channels[RED_CHANNEL_RECORD]) { + if (_enabled_channels[SPICE_CHANNEL_RECORD]) { _client.register_channel_factory(RecordChannel::Factory()); } - if (_enabled_channels[RED_CHANNEL_TUNNEL]) { + if (_enabled_channels[SPICE_CHANNEL_TUNNEL]) { _client.register_channel_factory(TunnelChannel::Factory()); } } @@ -1833,7 +1833,7 @@ bool Application::process_cmd_line(int argc, char** argv) parser.add(SPICE_OPT_CANVAS_TYPE, "canvas-type", "set rendering canvas", "canvas_type", true); parser.set_multi(SPICE_OPT_CANVAS_TYPE, ','); - for (int i = RED_CHANNEL_MAIN; i < RED_CHANNEL_END; i++) { + for (int i = SPICE_CHANNEL_MAIN; i < SPICE_END_CHANNEL; i++) { _peer_con_opt[i] = RedPeer::ConnectionOptions::CON_OP_INVALID; } diff --git a/client/application.h b/client/application.h index 47cf29ef..b2a18d37 100644 --- a/client/application.h +++ b/client/application.h @@ -71,8 +71,8 @@ private: struct MonitorInfo { int depth; - Point size; - Point position; + SpicePoint size; + SpicePoint position; }; class MonitorsQuery: public SyncEvent { diff --git a/client/canvas.cpp b/client/canvas.cpp index 6ce2af2b..04b0ce67 100644 --- a/client/canvas.cpp +++ b/client/canvas.cpp @@ -40,70 +40,70 @@ inline void Canvas::access_test(void *ptr, size_t size) } } -void Canvas::localalize_ptr(ADDRESS* data) +void Canvas::localalize_ptr(SPICE_ADDRESS* data) { if (*data) { *data += _base; } } -void Canvas::localalize_image(ADDRESS* in_bitmap) +void Canvas::localalize_image(SPICE_ADDRESS* in_bitmap) { - ImageDescriptor* image; + SpiceImageDescriptor* image; ASSERT(*in_bitmap); localalize_ptr(in_bitmap); - image = (ImageDescriptor*)GET_ADDRESS(*in_bitmap); + image = (SpiceImageDescriptor*)SPICE_GET_ADDRESS(*in_bitmap); switch (image->type) { - case IMAGE_TYPE_BITMAP: { - BitmapImage *bitmap = (BitmapImage *)image; + case SPICE_IMAGE_TYPE_BITMAP: { + SpiceBitmapImage *bitmap = (SpiceBitmapImage *)image; localalize_ptr(&bitmap->bitmap.data); - if (bitmap->bitmap.palette && !(bitmap->bitmap.flags & BITMAP_PAL_FROM_CACHE)) { + if (bitmap->bitmap.palette && !(bitmap->bitmap.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { localalize_ptr(&bitmap->bitmap.palette); } break; } - case IMAGE_TYPE_LZ_PLT: { - LZ_PLTImage *lzImage = (LZ_PLTImage *)image; + case SPICE_IMAGE_TYPE_LZ_PLT: { + SpiceLZPLTImage *lzImage = (SpiceLZPLTImage *)image; ASSERT(lzImage->lz_plt.palette); - if (!(lzImage->lz_plt.flags & BITMAP_PAL_FROM_CACHE)) { + if (!(lzImage->lz_plt.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { localalize_ptr(&lzImage->lz_plt.palette); } break; } - case IMAGE_TYPE_LZ_RGB: - case IMAGE_TYPE_GLZ_RGB: - case IMAGE_TYPE_QUIC: + case SPICE_IMAGE_TYPE_LZ_RGB: + case SPICE_IMAGE_TYPE_GLZ_RGB: + case SPICE_IMAGE_TYPE_QUIC: break; - case IMAGE_TYPE_FROM_CACHE: + case SPICE_IMAGE_TYPE_FROM_CACHE: break; default: THROW("invalid image type %u", image->type); } } -void Canvas::localalize_brush(Brush& brush) +void Canvas::localalize_brush(SpiceBrush& brush) { - if (brush.type == BRUSH_TYPE_PATTERN) { + if (brush.type == SPICE_BRUSH_TYPE_PATTERN) { localalize_image(&brush.u.pattern.pat); } } -void Canvas::localalize_attr(LineAttr& attr) +void Canvas::localalize_attr(SpiceLineAttr& attr) { if (attr.style_nseg) { localalize_ptr(&attr.style); } } -void Canvas::localalize_mask(QMask& mask) +void Canvas::localalize_mask(SpiceQMask& mask) { if (mask.bitmap) { localalize_image(&mask.bitmap); } } -void Canvas::begin_draw(RedDrawBase& base, int size, size_t min_size) +void Canvas::begin_draw(SpiceMsgDisplayBase& base, int size, size_t min_size) { _base = (unsigned long)&base; _max = _base + size; @@ -112,101 +112,101 @@ void Canvas::begin_draw(RedDrawBase& base, int size, size_t min_size) localalize_ptr(&base.clip.data); } -void Canvas::draw_fill(RedFill& fill, int size) +void Canvas::draw_fill(SpiceMsgDisplayDrawFill& fill, int size) { - begin_draw(fill.base, size, sizeof(RedFill)); + begin_draw(fill.base, size, sizeof(SpiceMsgDisplayDrawFill)); localalize_brush(fill.data.brush); localalize_mask(fill.data.mask); draw_fill(&fill.base.box, &fill.base.clip, &fill.data); } -void Canvas::draw_text(RedText& text, int size) +void Canvas::draw_text(SpiceMsgDisplayDrawText& text, int size) { - begin_draw(text.base, size, sizeof(RedText)); + begin_draw(text.base, size, sizeof(SpiceMsgDisplayDrawText)); localalize_brush(text.data.fore_brush); localalize_brush(text.data.back_brush); localalize_ptr(&text.data.str); draw_text(&text.base.box, &text.base.clip, &text.data); } -void Canvas::draw_opaque(RedOpaque& opaque, int size) +void Canvas::draw_opaque(SpiceMsgDisplayDrawOpaque& opaque, int size) { - begin_draw(opaque.base, size, sizeof(RedOpaque)); + begin_draw(opaque.base, size, sizeof(SpiceMsgDisplayDrawOpaque)); localalize_brush(opaque.data.brush); localalize_image(&opaque.data.src_bitmap); localalize_mask(opaque.data.mask); draw_opaque(&opaque.base.box, &opaque.base.clip, &opaque.data); } -void Canvas::draw_copy(RedCopy& copy, int size) +void Canvas::draw_copy(SpiceMsgDisplayDrawCopy& copy, int size) { - begin_draw(copy.base, size, sizeof(RedCopy)); + begin_draw(copy.base, size, sizeof(SpiceMsgDisplayDrawCopy)); localalize_image(©.data.src_bitmap); localalize_mask(copy.data.mask); draw_copy(©.base.box, ©.base.clip, ©.data); } -void Canvas::draw_transparent(RedTransparent& transparent, int size) +void Canvas::draw_transparent(SpiceMsgDisplayDrawTransparent& transparent, int size) { - begin_draw(transparent.base, size, sizeof(RedTransparent)); + begin_draw(transparent.base, size, sizeof(SpiceMsgDisplayDrawTransparent)); localalize_image(&transparent.data.src_bitmap); draw_transparent(&transparent.base.box, &transparent.base.clip, &transparent.data); } -void Canvas::draw_alpha_blend(RedAlphaBlend& alpha_blend, int size) +void Canvas::draw_alpha_blend(SpiceMsgDisplayDrawAlphaBlend& alpha_blend, int size) { - begin_draw(alpha_blend.base, size, sizeof(RedAlphaBlend)); + begin_draw(alpha_blend.base, size, sizeof(SpiceMsgDisplayDrawAlphaBlend)); localalize_image(&alpha_blend.data.src_bitmap); draw_alpha_blend(&alpha_blend.base.box, &alpha_blend.base.clip, &alpha_blend.data); } -void Canvas::copy_bits(RedCopyBits& copy, int size) +void Canvas::copy_bits(SpiceMsgDisplayCopyBits& copy, int size) { - begin_draw(copy.base, size, sizeof(RedCopyBits)); + begin_draw(copy.base, size, sizeof(SpiceMsgDisplayCopyBits)); copy_bits(©.base.box, ©.base.clip, ©.src_pos); } -void Canvas::draw_blend(RedBlend& blend, int size) +void Canvas::draw_blend(SpiceMsgDisplayDrawBlend& blend, int size) { - begin_draw(blend.base, size, sizeof(RedBlend)); + begin_draw(blend.base, size, sizeof(SpiceMsgDisplayDrawBlend)); localalize_image(&blend.data.src_bitmap); localalize_mask(blend.data.mask); draw_blend(&blend.base.box, &blend.base.clip, &blend.data); } -void Canvas::draw_blackness(RedBlackness& blackness, int size) +void Canvas::draw_blackness(SpiceMsgDisplayDrawBlackness& blackness, int size) { - begin_draw(blackness.base, size, sizeof(RedBlackness)); + begin_draw(blackness.base, size, sizeof(SpiceMsgDisplayDrawBlackness)); localalize_mask(blackness.data.mask); draw_blackness(&blackness.base.box, &blackness.base.clip, &blackness.data); } -void Canvas::draw_whiteness(RedWhiteness& whiteness, int size) +void Canvas::draw_whiteness(SpiceMsgDisplayDrawWhiteness& whiteness, int size) { - begin_draw(whiteness.base, size, sizeof(RedWhiteness)); + begin_draw(whiteness.base, size, sizeof(SpiceMsgDisplayDrawWhiteness)); localalize_mask(whiteness.data.mask); draw_whiteness(&whiteness.base.box, &whiteness.base.clip, &whiteness.data); } -void Canvas::draw_invers(RedInvers& invers, int size) +void Canvas::draw_invers(SpiceMsgDisplayDrawInvers& invers, int size) { - begin_draw(invers.base, size, sizeof(RedInvers)); + begin_draw(invers.base, size, sizeof(SpiceMsgDisplayDrawInvers)); localalize_mask(invers.data.mask); draw_invers(&invers.base.box, &invers.base.clip, &invers.data); } -void Canvas::draw_rop3(RedRop3& rop3, int size) +void Canvas::draw_rop3(SpiceMsgDisplayDrawRop3& rop3, int size) { - begin_draw(rop3.base, size, sizeof(RedRop3)); + begin_draw(rop3.base, size, sizeof(SpiceMsgDisplayDrawRop3)); localalize_brush(rop3.data.brush); localalize_image(&rop3.data.src_bitmap); localalize_mask(rop3.data.mask); draw_rop3(&rop3.base.box, &rop3.base.clip, &rop3.data); } -void Canvas::draw_stroke(RedStroke& stroke, int size) +void Canvas::draw_stroke(SpiceMsgDisplayDrawStroke& stroke, int size) { - begin_draw(stroke.base, size, sizeof(RedStroke)); + begin_draw(stroke.base, size, sizeof(SpiceMsgDisplayDrawStroke)); localalize_brush(stroke.data.brush); localalize_ptr(&stroke.data.path); localalize_attr(stroke.data.attr); @@ -225,25 +225,25 @@ cairo_surface_t* Canvas::bits_cache_get(void *opaque, uint64_t id) return cache->get(id); } -void Canvas::palette_cache_put(void *opaque, Palette *palette) +void Canvas::palette_cache_put(void *opaque, SpicePalette *palette) { PaletteCache* cache = static_cast(opaque); AutoRef cached_palette(new CachedPalette(palette)); cache->add(palette->unique, *cached_palette); } -Palette* Canvas::palette_cache_get(void *opaque, uint64_t id) +SpicePalette* Canvas::palette_cache_get(void *opaque, uint64_t id) { PaletteCache* cache = static_cast(opaque); return cache->get(id)->palette(); } -void Canvas::palette_cache_release(Palette* palette) +void Canvas::palette_cache_release(SpicePalette* palette) { CachedPalette::unref(palette); } -void Canvas::glz_decode(void *opaque, uint8_t *data, Palette *plt, void *usr_data) +void Canvas::glz_decode(void *opaque, uint8_t *data, SpicePalette *plt, void *usr_data) { GlzDecoder* decoder = static_cast(opaque); decoder->decode(data, plt, usr_data); diff --git a/client/canvas.h b/client/canvas.h index f1fd9757..ed9d0e8a 100644 --- a/client/canvas.h +++ b/client/canvas.h @@ -56,13 +56,13 @@ typedef SharedCache PixmapCache; class CachedPalette { public: - CachedPalette(Palette* palette) + CachedPalette(SpicePalette* palette) : _refs(1) { - int size = sizeof(Palette) + palette->num_ents * sizeof(uint32_t); + int size = sizeof(SpicePalette) + palette->num_ents * sizeof(uint32_t); CachedPalette **ptr = (CachedPalette **)new uint8_t[size + sizeof(CachedPalette *)]; *ptr = this; - _palette = (Palette*)(ptr + 1); + _palette = (SpicePalette*)(ptr + 1); memcpy(_palette, palette, size); } @@ -79,13 +79,13 @@ public: } } - static void unref(Palette *pal) + static void unref(SpicePalette *pal) { CachedPalette **ptr = (CachedPalette **)pal; (*(ptr - 1))->unref(); } - Palette* palette() { return _palette;} + SpicePalette* palette() { return _palette;} private: ~CachedPalette() @@ -95,7 +95,7 @@ private: private: int _refs; - Palette* _palette; + SpicePalette* _palette; }; class PaletteCacheTreat { @@ -188,25 +188,25 @@ public: virtual void clear() = 0; - void draw_fill(RedFill& fill, int size); - void draw_text(RedText& text, int size); - void draw_opaque(RedOpaque& opaque, int size); - void draw_copy(RedCopy& copy, int size); - void draw_transparent(RedTransparent& transparent, int size); - void draw_alpha_blend(RedAlphaBlend& alpha_blend, int size); - void copy_bits(RedCopyBits& copy_bits, int size); - void draw_blend(RedBlend& blend, int size); - void draw_blackness(RedBlackness& blackness, int size); - void draw_whiteness(RedWhiteness& whiteness, int size); - void draw_invers(RedInvers& invers, int size); - void draw_rop3(RedRop3& rop3, int size); - void draw_stroke(RedStroke& stroke, int size); + void draw_fill(SpiceMsgDisplayDrawFill& fill, int size); + void draw_text(SpiceMsgDisplayDrawText& text, int size); + void draw_opaque(SpiceMsgDisplayDrawOpaque& opaque, int size); + void draw_copy(SpiceMsgDisplayDrawCopy& copy, int size); + void draw_transparent(SpiceMsgDisplayDrawTransparent& transparent, int size); + void draw_alpha_blend(SpiceMsgDisplayDrawAlphaBlend& alpha_blend, int size); + void copy_bits(SpiceMsgDisplayCopyBits& copy_bits, int size); + void draw_blend(SpiceMsgDisplayDrawBlend& blend, int size); + void draw_blackness(SpiceMsgDisplayDrawBlackness& blackness, int size); + void draw_whiteness(SpiceMsgDisplayDrawWhiteness& whiteness, int size); + void draw_invers(SpiceMsgDisplayDrawInvers& invers, int size); + void draw_rop3(SpiceMsgDisplayDrawRop3& rop3, int size); + void draw_stroke(SpiceMsgDisplayDrawStroke& stroke, int size); #ifdef WIN32 virtual void put_image(HDC dc, const PixmapHeader& image, - const Rect& dest, const QRegion* clip) = 0; + const SpiceRect& dest, const QRegion* clip) = 0; #else - virtual void put_image(const PixmapHeader& image, const Rect& dest, + virtual void put_image(const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip) = 0; #endif @@ -214,39 +214,39 @@ public: protected: virtual void set_access_params(unsigned long base, unsigned long max) = 0; - virtual void draw_fill(Rect *bbox, Clip *clip, Fill *fill) = 0; - virtual void draw_copy(Rect *bbox, Clip *clip, Copy *copy) = 0; - virtual void draw_opaque(Rect *bbox, Clip *clip, Opaque *opaque) = 0; - virtual void copy_bits(Rect *bbox, Clip *clip, Point *src_pos) = 0; - virtual void draw_text(Rect *bbox, Clip *clip, Text *text) = 0; - virtual void draw_stroke(Rect *bbox, Clip *clip, Stroke *stroke) = 0; - virtual void draw_rop3(Rect *bbox, Clip *clip, Rop3 *rop3) = 0; - virtual void draw_blend(Rect *bbox, Clip *clip, Blend *blend) = 0; - virtual void draw_blackness(Rect *bbox, Clip *clip, Blackness *blackness) = 0; - virtual void draw_whiteness(Rect *bbox, Clip *clip, Whiteness *whiteness) = 0; - virtual void draw_invers(Rect *bbox, Clip *clip, Invers *invers) = 0; - virtual void draw_transparent(Rect *bbox, Clip *clip, Transparent* transparent) = 0; - virtual void draw_alpha_blend(Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend) = 0; + virtual void draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) = 0; + virtual void draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) = 0; + virtual void draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) = 0; + virtual void copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) = 0; + virtual void draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text) = 0; + virtual void draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) = 0; + virtual void draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) = 0; + virtual void draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) = 0; + virtual void draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) = 0; + virtual void draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) = 0; + virtual void draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) = 0; + virtual void draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent) = 0; + virtual void draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend) = 0; PixmapCache& pixmap_cache() { return _pixmap_cache;} PaletteCache& palette_cache() { return _palette_cache;} static void bits_cache_put(void *opaque, uint64_t id, cairo_surface_t *surface); static cairo_surface_t* bits_cache_get(void *opaque, uint64_t id); - static void palette_cache_put(void *opaque, Palette *palette); - static Palette* palette_cache_get(void *opaque, uint64_t id); - static void palette_cache_release(Palette* palette); + static void palette_cache_put(void *opaque, SpicePalette *palette); + static SpicePalette* palette_cache_get(void *opaque, uint64_t id); + static void palette_cache_release(SpicePalette* palette); GlzDecoder& glz_decoder() {return _glz_decoder;} - static void glz_decode(void *opaque, uint8_t *data, Palette *plt, void *usr_data); + static void glz_decode(void *opaque, uint8_t *data, SpicePalette *plt, void *usr_data); private: void access_test(void* ptr, size_t size); - void localalize_ptr(ADDRESS* data); - void localalize_image(ADDRESS* in_bitmap); - void localalize_brush(Brush& brush); - void localalize_attr(LineAttr& attr); - void localalize_mask(QMask& mask); - void begin_draw(RedDrawBase& base, int size, size_t min_size); + void localalize_ptr(SPICE_ADDRESS* data); + void localalize_image(SPICE_ADDRESS* in_bitmap); + void localalize_brush(SpiceBrush& brush); + void localalize_attr(SpiceLineAttr& attr); + void localalize_mask(SpiceQMask& mask); + void begin_draw(SpiceMsgDisplayBase& base, int size, size_t min_size); private: PixmapCache& _pixmap_cache; diff --git a/client/cursor.cpp b/client/cursor.cpp index 9bf8e9a6..7babdb90 100644 --- a/client/cursor.cpp +++ b/client/cursor.cpp @@ -20,7 +20,7 @@ #include "utils.h" #include "debug.h" -CursorData::CursorData(RedCursor& cursor, int data_size) +CursorData::CursorData(SpiceCursor& cursor, int data_size) : _atomic (1) , _header (cursor.header) , _data (NULL) @@ -30,31 +30,31 @@ CursorData::CursorData(RedCursor& cursor, int data_size) int expected_size = 0; switch (cursor.header.type) { - case CURSOR_TYPE_ALPHA: + case SPICE_CURSOR_TYPE_ALPHA: expected_size = (_header.width << 2) * _header.height; break; - case CURSOR_TYPE_MONO: + case SPICE_CURSOR_TYPE_MONO: expected_size = (ALIGN(_header.width, 8) >> 2) * _header.height; break; - case CURSOR_TYPE_COLOR4: + case SPICE_CURSOR_TYPE_COLOR4: expected_size = (ALIGN(_header.width, 2) >> 1) * _header.height; expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height; expected_size += 16 * sizeof(uint32_t); break; - case CURSOR_TYPE_COLOR8: + case SPICE_CURSOR_TYPE_COLOR8: expected_size = _header.width * _header.height; expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height; expected_size += 256 * sizeof(uint32_t); break; - case CURSOR_TYPE_COLOR16: + case SPICE_CURSOR_TYPE_COLOR16: expected_size = (_header.width << 1) * _header.height; expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height; break; - case CURSOR_TYPE_COLOR24: + case SPICE_CURSOR_TYPE_COLOR24: expected_size = (_header.width * 3) * _header.height; expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height; break; - case CURSOR_TYPE_COLOR32: + case SPICE_CURSOR_TYPE_COLOR32: expected_size = (_header.width << 2) * _header.height; expected_size += (ALIGN(_header.width, 8) >> 3) * _header.height; break; @@ -84,26 +84,26 @@ CursorData::~CursorData() delete[] _data; } -int LocalCursor::get_size_bits(const CursorHeader& header, int& size) +int LocalCursor::get_size_bits(const SpiceCursorHeader& header, int& size) { switch (header.type) { - case CURSOR_TYPE_ALPHA: - case CURSOR_TYPE_COLOR32: + case SPICE_CURSOR_TYPE_ALPHA: + case SPICE_CURSOR_TYPE_COLOR32: size = (header.width << 2) * header.height; return 32; - case CURSOR_TYPE_MONO: + case SPICE_CURSOR_TYPE_MONO: size = (ALIGN(header.width, 8) >> 3) * header.height; return 1; - case CURSOR_TYPE_COLOR4: + case SPICE_CURSOR_TYPE_COLOR4: size = (ALIGN(header.width, 2) >> 1) * header.height; return 4; - case CURSOR_TYPE_COLOR8: + case SPICE_CURSOR_TYPE_COLOR8: size = header.width * header.height; return 8; - case CURSOR_TYPE_COLOR16: + case SPICE_CURSOR_TYPE_COLOR16: size = (header.width << 1) * header.height; return 16; - case CURSOR_TYPE_COLOR24: + case SPICE_CURSOR_TYPE_COLOR24: size = (header.width * 3) * header.height; return 24; default: diff --git a/client/cursor.h b/client/cursor.h index c964fd40..cc64c720 100644 --- a/client/cursor.h +++ b/client/cursor.h @@ -32,7 +32,7 @@ class LocalCursor; class CursorData { public: - CursorData(RedCursor& cursor, int data_size); + CursorData(SpiceCursor& cursor, int data_size); CursorData *ref() { ++_atomic; return this;} void unref() {if (--_atomic == 0) delete this;} @@ -40,7 +40,7 @@ public: CursorOpaque* get_opaque() { return _opaque;} void set_local(LocalCursor* local_cursor); LocalCursor* get_local() { return _local_cursor;} - const CursorHeader& header() const { return _header;} + const SpiceCursorHeader& header() const { return _header;} const uint8_t* data() const { return _data;} private: @@ -48,7 +48,7 @@ private: private: AtomicCount _atomic; - CursorHeader _header; + SpiceCursorHeader _header; uint8_t* _data; CursorOpaque* _opaque; LocalCursor* _local_cursor; @@ -63,7 +63,7 @@ public: void unref() { if (--_atomic == 0) delete this;} protected: - static int get_size_bits(const CursorHeader& header, int &size); + static int get_size_bits(const SpiceCursorHeader& header, int &size); private: AtomicCount _atomic; diff --git a/client/cursor_channel.cpp b/client/cursor_channel.cpp index 8a8fc658..30c52d9d 100644 --- a/client/cursor_channel.cpp +++ b/client/cursor_channel.cpp @@ -42,14 +42,14 @@ static inline uint8_t revers_bits(uint8_t byte) class NaitivCursor: public CursorOpaque { public: - virtual void draw(RedDrawable& dest, int x, int y, const Rect& area) = 0; + virtual void draw(RedDrawable& dest, int x, int y, const SpiceRect& area) = 0; }; class AlphaCursor: public NaitivCursor { public: - AlphaCursor(const CursorHeader& header, const uint8_t* data); + AlphaCursor(const SpiceCursorHeader& header, const uint8_t* data); - virtual void draw(RedDrawable& dest, int x, int y, const Rect& area); + virtual void draw(RedDrawable& dest, int x, int y, const SpiceRect& area); private: std::auto_ptr _pixmap; @@ -57,9 +57,9 @@ private: class MonoCursor: public NaitivCursor { public: - MonoCursor(const CursorHeader& header, const uint8_t* data); + MonoCursor(const SpiceCursorHeader& header, const uint8_t* data); - virtual void draw(RedDrawable& dest, int x, int y, const Rect& area); + virtual void draw(RedDrawable& dest, int x, int y, const SpiceRect& area); private: std::auto_ptr _pixmap; @@ -68,25 +68,25 @@ private: class UnsupportedCursor: public NaitivCursor { public: - UnsupportedCursor(const CursorHeader& header); - virtual void draw(RedDrawable& dest, int x, int y, const Rect& area); + UnsupportedCursor(const SpiceCursorHeader& header); + virtual void draw(RedDrawable& dest, int x, int y, const SpiceRect& area); private: int _hot_x; int _hot_y; }; -UnsupportedCursor::UnsupportedCursor(const CursorHeader& header) +UnsupportedCursor::UnsupportedCursor(const SpiceCursorHeader& header) : _hot_x (header.hot_spot_x) , _hot_y (header.hot_spot_y) { LOG_WARN("Unsupported cursor %hu", header.type); } -void UnsupportedCursor::draw(RedDrawable& dest, int x, int y, const Rect& area) +void UnsupportedCursor::draw(RedDrawable& dest, int x, int y, const SpiceRect& area) { - Rect dest_area; - Rect rect; + SpiceRect dest_area; + SpiceRect rect; dest_area.left = area.left; dest_area.right = area.right; @@ -110,7 +110,7 @@ void UnsupportedCursor::draw(RedDrawable& dest, int x, int y, const Rect& area) dest.frame_rect(rect, rgb32_make(0, 0, 0)); } -AlphaCursor::AlphaCursor(const CursorHeader& header, const uint8_t* data) +AlphaCursor::AlphaCursor(const SpiceCursorHeader& header, const uint8_t* data) : _pixmap (new RedPixmapCairo(header.width, header.height, RedPixmap::ARGB32, true, NULL, NULL)) { @@ -122,12 +122,12 @@ AlphaCursor::AlphaCursor(const CursorHeader& header, const uint8_t* data) } } -void AlphaCursor::draw(RedDrawable& dest, int x, int y, const Rect& area) +void AlphaCursor::draw(RedDrawable& dest, int x, int y, const SpiceRect& area) { dest.blend_pixels(*_pixmap, area.left - x, area.top - y, area); } -MonoCursor::MonoCursor(const CursorHeader& header, const uint8_t* data) +MonoCursor::MonoCursor(const SpiceCursorHeader& header, const uint8_t* data) : _pixmap (NULL) , _height (header.height) { @@ -154,7 +154,7 @@ MonoCursor::MonoCursor(const CursorHeader& header, const uint8_t* data) } } -void MonoCursor::draw(RedDrawable& dest, int x, int y, const Rect& area) +void MonoCursor::draw(RedDrawable& dest, int x, int y, const SpiceRect& area) { dest.combine_pixels(*_pixmap, area.left - x, area.top - y, area, RedDrawable::OP_AND); dest.combine_pixels(*_pixmap, area.left - x, area.top - y + _height, area, RedDrawable::OP_XOR); @@ -162,12 +162,12 @@ void MonoCursor::draw(RedDrawable& dest, int x, int y, const Rect& area) class ColorCursor: public NaitivCursor { public: - ColorCursor(const CursorHeader& header); + ColorCursor(const SpiceCursorHeader& header); - virtual void draw(RedDrawable& dest, int x, int y, const Rect& area); + virtual void draw(RedDrawable& dest, int x, int y, const SpiceRect& area); protected: - void init_pixels(const CursorHeader& header, const uint8_t* _pixels, const uint8_t *and_mask); + void init_pixels(const SpiceCursorHeader& header, const uint8_t* _pixels, const uint8_t *and_mask); virtual uint32_t get_pixel_color(const uint8_t *data, int row, int col) = 0; private: @@ -175,7 +175,7 @@ private: std::auto_ptr _invers; }; -ColorCursor::ColorCursor(const CursorHeader& header) +ColorCursor::ColorCursor(const SpiceCursorHeader& header) : _pixmap (new RedPixmapCairo(header.width, header.height, RedPixmap::ARGB32, true, NULL, NULL)) , _invers (NULL) @@ -185,7 +185,7 @@ ColorCursor::ColorCursor(const CursorHeader& header) true, pallete, NULL)); } -void ColorCursor::init_pixels(const CursorHeader& header, const uint8_t* pixels, +void ColorCursor::init_pixels(const SpiceCursorHeader& header, const uint8_t* pixels, const uint8_t *and_mask) { int mask_stride = ALIGN(header.width, 8) / 8; @@ -217,7 +217,7 @@ void ColorCursor::init_pixels(const CursorHeader& header, const uint8_t* pixels, } } -void ColorCursor::draw(RedDrawable& dest, int x, int y, const Rect& area) +void ColorCursor::draw(RedDrawable& dest, int x, int y, const SpiceRect& area) { dest.blend_pixels(*_pixmap, area.left - x, area.top - y, area); dest.combine_pixels(*_invers, area.left - x, area.top - y, area, RedDrawable::OP_XOR); @@ -225,7 +225,7 @@ void ColorCursor::draw(RedDrawable& dest, int x, int y, const Rect& area) class ColorCursor32: public ColorCursor { public: - ColorCursor32(const CursorHeader& header, const uint8_t* data) + ColorCursor32(const SpiceCursorHeader& header, const uint8_t* data) : ColorCursor(header) , _src_stride (header.width * sizeof(uint32_t)) { @@ -244,7 +244,7 @@ private: class ColorCursor16: public ColorCursor { public: - ColorCursor16(const CursorHeader& header, const uint8_t* data) + ColorCursor16(const SpiceCursorHeader& header, const uint8_t* data) : ColorCursor(header) , _src_stride (header.width * sizeof(uint16_t)) { @@ -264,7 +264,7 @@ private: class ColorCursor4: public ColorCursor { public: - ColorCursor4(const CursorHeader& header, const uint8_t* data) + ColorCursor4(const SpiceCursorHeader& header, const uint8_t* data) : ColorCursor(header) , _src_stride (ALIGN(header.width, 2) >> 1) , _palette ((uint32_t*)(data + _src_stride * header.height)) @@ -300,7 +300,7 @@ public: virtual bool operator() (RedChannel& channel) { - if (channel.get_type() != RED_CHANNEL_DISPLAY || + if (channel.get_type() != SPICE_CHANNEL_DISPLAY || channel.get_id() != _channel.get_id()) { return true; } @@ -350,14 +350,14 @@ private: CursorChannel& _channel; }; -class CursorHandler: public MessageHandlerImp { +class CursorHandler: public MessageHandlerImp { public: CursorHandler(CursorChannel& channel) - : MessageHandlerImp(channel) {} + : MessageHandlerImp(channel) {} }; CursorChannel::CursorChannel(RedClient& client, uint32_t id) - : RedChannel(client, RED_CHANNEL_CURSOR, id, new CursorHandler(*this)) + : RedChannel(client, SPICE_CHANNEL_CURSOR, id, new CursorHandler(*this)) , ScreenLayer(SCREEN_LAYER_CURSOR, false) , _cursor (NULL) , _cursor_visible (false) @@ -365,27 +365,27 @@ CursorChannel::CursorChannel(RedClient& client, uint32_t id) { CursorHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_MIGRATE, &CursorChannel::handle_migrate, 0); - handler->set_handler(RED_SET_ACK, &CursorChannel::handle_set_ack, sizeof(RedSetAck)); - handler->set_handler(RED_PING, &CursorChannel::handle_ping, sizeof(RedPing)); - handler->set_handler(RED_WAIT_FOR_CHANNELS, &CursorChannel::handle_wait_for_channels, - sizeof(RedWaitForChannels)); - handler->set_handler(RED_DISCONNECTING, &CursorChannel::handle_disconnect, - sizeof(RedDisconnect)); - handler->set_handler(RED_NOTIFY, &CursorChannel::handle_notify, sizeof(RedNotify)); - - handler->set_handler(RED_CURSOR_INIT, &CursorChannel::handle_init, sizeof(RedCursorInit)); - handler->set_handler(RED_CURSOR_RESET, &CursorChannel::handle_reset, 0); - handler->set_handler(RED_CURSOR_SET, &CursorChannel::handle_cursor_set, - sizeof(RedCursorSet)); - handler->set_handler(RED_CURSOR_MOVE, &CursorChannel::handle_cursor_move, - sizeof(RedCursorMove)); - handler->set_handler(RED_CURSOR_HIDE, &CursorChannel::handle_cursor_hide, 0); - handler->set_handler(RED_CURSOR_TRAIL, &CursorChannel::handle_cursor_trail, - sizeof(RedCursorTrail)); - handler->set_handler(RED_CURSOR_INVAL_ONE, &CursorChannel::handle_inval_one, - sizeof(RedInvalOne)); - handler->set_handler(RED_CURSOR_INVAL_ALL, &CursorChannel::handle_inval_all, 0); + handler->set_handler(SPICE_MSG_MIGRATE, &CursorChannel::handle_migrate, 0); + handler->set_handler(SPICE_MSG_SET_ACK, &CursorChannel::handle_set_ack, sizeof(SpiceMsgSetAck)); + handler->set_handler(SPICE_MSG_PING, &CursorChannel::handle_ping, sizeof(SpiceMsgPing)); + handler->set_handler(SPICE_MSG_WAIT_FOR_CHANNELS, &CursorChannel::handle_wait_for_channels, + sizeof(SpiceMsgWaitForChannels)); + handler->set_handler(SPICE_MSG_DISCONNECTING, &CursorChannel::handle_disconnect, + sizeof(SpiceMsgDisconnect)); + handler->set_handler(SPICE_MSG_NOTIFY, &CursorChannel::handle_notify, sizeof(SpiceMsgNotify)); + + handler->set_handler(SPICE_MSG_CURSOR_INIT, &CursorChannel::handle_init, sizeof(SpiceMsgCursorInit)); + handler->set_handler(SPICE_MSG_CURSOR_RESET, &CursorChannel::handle_reset, 0); + handler->set_handler(SPICE_MSG_CURSOR_SET, &CursorChannel::handle_cursor_set, + sizeof(SpiceMsgCursorSet)); + handler->set_handler(SPICE_MSG_CURSOR_MOVE, &CursorChannel::handle_cursor_move, + sizeof(SpiceMsgCursorMove)); + handler->set_handler(SPICE_MSG_CURSOR_HIDE, &CursorChannel::handle_cursor_hide, 0); + handler->set_handler(SPICE_MSG_CURSOR_TRAIL, &CursorChannel::handle_cursor_trail, + sizeof(SpiceMsgCursorTrail)); + handler->set_handler(SPICE_MSG_CURSOR_INVAL_ONE, &CursorChannel::handle_inval_one, + sizeof(SpiceMsgDisplayInvalOne)); + handler->set_handler(SPICE_MSG_CURSOR_INVAL_ALL, &CursorChannel::handle_inval_all, 0); } CursorChannel::~CursorChannel() @@ -456,25 +456,25 @@ void CursorChannel::create_native_cursor(CursorData* cursor) } switch (cursor->header().type) { - case CURSOR_TYPE_ALPHA: + case SPICE_CURSOR_TYPE_ALPHA: native_cursor = new AlphaCursor(cursor->header(), cursor->data()); break; - case CURSOR_TYPE_COLOR32: + case SPICE_CURSOR_TYPE_COLOR32: native_cursor = new ColorCursor32(cursor->header(), cursor->data()); break; - case CURSOR_TYPE_MONO: + case SPICE_CURSOR_TYPE_MONO: native_cursor = new MonoCursor(cursor->header(), cursor->data()); break; - case CURSOR_TYPE_COLOR4: + case SPICE_CURSOR_TYPE_COLOR4: native_cursor = new ColorCursor4(cursor->header(), cursor->data()); break; - case CURSOR_TYPE_COLOR8: + case SPICE_CURSOR_TYPE_COLOR8: native_cursor = new UnsupportedCursor(cursor->header()); break; - case CURSOR_TYPE_COLOR16: + case SPICE_CURSOR_TYPE_COLOR16: native_cursor = new ColorCursor16(cursor->header(), cursor->data()); break; - case CURSOR_TYPE_COLOR24: + case SPICE_CURSOR_TYPE_COLOR24: native_cursor = new UnsupportedCursor(cursor->header()); break; default: @@ -483,20 +483,20 @@ void CursorChannel::create_native_cursor(CursorData* cursor) cursor->set_opaque(native_cursor); } -void CursorChannel::set_cursor(RedCursor& red_cursor, int data_size, int x, int y, bool visible) +void CursorChannel::set_cursor(SpiceCursor& red_cursor, int data_size, int x, int y, bool visible) { CursorData *cursor; - if (red_cursor.flags & RED_CURSOR_NONE) { + if (red_cursor.flags & SPICE_CURSOR_FLAGS_NONE) { remove_cursor(); return; } - if (red_cursor.flags & RED_CURSOR_FROM_CACHE) { + if (red_cursor.flags & SPICE_CURSOR_FLAGS_FROM_CACHE) { cursor = _cursor_cache.get(red_cursor.header.unique); } else { cursor = new CursorData(red_cursor, data_size); - if (red_cursor.flags & RED_CURSOR_CACHE_ME) { + if (red_cursor.flags & SPICE_CURSOR_FLAGS_CACHE_ME) { ASSERT(red_cursor.header.unique); _cursor_cache.add(red_cursor.header.unique, cursor); } @@ -522,7 +522,7 @@ void CursorChannel::set_cursor(RedCursor& red_cursor, int data_size, int x, int update_display_cursor(); - if (get_client().get_mouse_mode() == RED_MOUSE_MODE_SERVER) { + if (get_client().get_mouse_mode() == SPICE_MOUSE_MODE_SERVER) { if (_cursor_visible) { set_rect_area(_cursor_rect); } else { @@ -554,11 +554,11 @@ void CursorChannel::detach_display() void CursorChannel::handle_init(RedPeer::InMessage *message) { - RedCursorInit *init = (RedCursorInit*)message->data(); + SpiceMsgCursorInit *init = (SpiceMsgCursorInit*)message->data(); attach_to_screen(get_client().get_application(), get_id()); remove_cursor(); _cursor_cache.clear(); - set_cursor(init->cursor, message->size() - sizeof(RedCursorInit), init->position.x, + set_cursor(init->cursor, message->size() - sizeof(SpiceMsgCursorInit), init->position.x, init->position.y, init->visible != 0); } @@ -571,14 +571,14 @@ void CursorChannel::handle_reset(RedPeer::InMessage *message) void CursorChannel::handle_cursor_set(RedPeer::InMessage* message) { - RedCursorSet* set = (RedCursorSet*)message->data(); - set_cursor(set->cursor, message->size() - sizeof(RedCursorSet), set->postition.x, + SpiceMsgCursorSet* set = (SpiceMsgCursorSet*)message->data(); + set_cursor(set->cursor, message->size() - sizeof(SpiceMsgCursorSet), set->postition.x, set->postition.y, set->visible != 0); } void CursorChannel::handle_cursor_move(RedPeer::InMessage* message) { - RedCursorMove* move = (RedCursorMove*)message->data(); + SpiceMsgCursorMove* move = (SpiceMsgCursorMove*)message->data(); if (!_cursor) { return; @@ -596,7 +596,7 @@ void CursorChannel::handle_cursor_move(RedPeer::InMessage* message) _cursor_rect.bottom += dy; lock.unlock(); - if (get_client().get_mouse_mode() == RED_MOUSE_MODE_SERVER) { + if (get_client().get_mouse_mode() == SPICE_MOUSE_MODE_SERVER) { set_rect_area(_cursor_rect); return; } @@ -611,20 +611,20 @@ void CursorChannel::handle_cursor_hide(RedPeer::InMessage* message) _cursor_visible = false; update_display_cursor(); - if (get_client().get_mouse_mode() == RED_MOUSE_MODE_SERVER) { + if (get_client().get_mouse_mode() == SPICE_MOUSE_MODE_SERVER) { clear_area(); } } void CursorChannel::handle_cursor_trail(RedPeer::InMessage* message) { - RedCursorTrail* trail = (RedCursorTrail*)message->data(); + SpiceMsgCursorTrail* trail = (SpiceMsgCursorTrail*)message->data(); DBG(0, "length %u frequency %u", trail->length, trail->frequency) } void CursorChannel::handle_inval_one(RedPeer::InMessage* message) { - RedInvalOne* inval = (RedInvalOne*)message->data(); + SpiceMsgDisplayInvalOne* inval = (SpiceMsgDisplayInvalOne*)message->data(); _cursor_cache.remove(inval->id); } @@ -637,7 +637,7 @@ void CursorChannel::on_mouse_mode_change() { Lock lock(_update_lock); - if (get_client().get_mouse_mode() == RED_MOUSE_MODE_CLIENT) { + if (get_client().get_mouse_mode() == SPICE_MOUSE_MODE_CLIENT) { clear_area(); return; } @@ -649,7 +649,7 @@ void CursorChannel::on_mouse_mode_change() class CursorFactory: public ChannelFactory { public: - CursorFactory() : ChannelFactory(RED_CHANNEL_CURSOR) {} + CursorFactory() : ChannelFactory(SPICE_CHANNEL_CURSOR) {} virtual RedChannel* construct(RedClient& client, uint32_t id) { return new CursorChannel(client, id); diff --git a/client/cursor_channel.h b/client/cursor_channel.h index 699d5197..5f5bdb17 100644 --- a/client/cursor_channel.h +++ b/client/cursor_channel.h @@ -63,7 +63,7 @@ private: static void create_native_cursor(CursorData* cursor); void update_display_cursor(); - void set_cursor(RedCursor& red_cursor, int data_size, int x, int y, bool visible); + void set_cursor(SpiceCursor& red_cursor, int data_size, int x, int y, bool visible); void remove_cursor(); virtual void copy_pixels(const QRegion& dest_region, RedDrawable& dest_dc); @@ -83,8 +83,8 @@ private: private: CursorCache _cursor_cache; CursorData* _cursor; - Point _hot_pos; - Rect _cursor_rect; + SpicePoint _hot_pos; + SpiceRect _cursor_rect; Mutex _update_lock; bool _cursor_visible; DisplayChannel* _display_channel; diff --git a/client/display_channel.cpp b/client/display_channel.cpp index 9d10bc7b..a60832aa 100644 --- a/client/display_channel.cpp +++ b/client/display_channel.cpp @@ -177,12 +177,12 @@ public: VideoStream(RedClient& client, Canvas& canvas, DisplayChannel& channel, uint32_t codec_type, bool top_down, uint32_t stream_width, uint32_t stream_height, uint32_t src_width, uint32_t src_height, - Rect* dest, int clip_type, uint32_t num_clip_rects, Rect* clip_rects); + SpiceRect* dest, int clip_type, uint32_t num_clip_rects, SpiceRect* clip_rects); ~VideoStream(); void push_data(uint32_t mm_time, uint32_t length, uint8_t* data, uint32_t ped_size); - void set_clip(int type, uint32_t num_clip_rects, Rect* clip_rects); - const Rect& get_dest() {return _dest;} + void set_clip(int type, uint32_t num_clip_rects, SpiceRect* clip_rects); + const SpiceRect& get_dest() {return _dest;} void handle_update_mark(uint64_t update_mark); uint32_t handle_timer_update(uint32_t now); @@ -208,7 +208,7 @@ private: int _stream_height; int _stride; bool _top_down; - Rect _dest; + SpiceRect _dest; QRegion _clip_region; QRegion* _clip; @@ -277,8 +277,8 @@ static int create_bitmap(HDC *dc, HBITMAP *prev_bitmap, VideoStream::VideoStream(RedClient& client, Canvas& canvas, DisplayChannel& channel, uint32_t codec_type, bool top_down, uint32_t stream_width, uint32_t stream_height, uint32_t src_width, uint32_t src_height, - Rect* dest, int clip_type, uint32_t num_clip_rects, - Rect* clip_rects) + SpiceRect* dest, int clip_type, uint32_t num_clip_rects, + SpiceRect* clip_rects) : _client (client) , _canvas (canvas) , _channel (channel) @@ -306,7 +306,7 @@ VideoStream::VideoStream(RedClient& client, Canvas& canvas, DisplayChannel& chan memset(_frames, 0, sizeof(_frames)); region_init(&_clip_region); switch (codec_type) { - case RED_VIDEO_CODEC_TYPE_MJPEG: + case SPICE_VIDEO_CODEC_TYPE_MJPEG: type = CODEC_ID_MJPEG; break; default: @@ -520,14 +520,14 @@ void VideoStream::push_data(uint32_t mm_time, uint32_t length, uint8_t* data, ui maintenance(); } -void VideoStream::set_clip(int type, uint32_t num_clip_rects, Rect* clip_rects) +void VideoStream::set_clip(int type, uint32_t num_clip_rects, SpiceRect* clip_rects) { - if (type == CLIP_TYPE_NONE) { + if (type == SPICE_CLIP_TYPE_NONE) { _clip = NULL; return; } - ASSERT(type == CLIP_TYPE_RECTS) + ASSERT(type == SPICE_CLIP_TYPE_RECTS) region_clear(&_clip_region); for (unsigned int i = 0; i < num_clip_rects; i++) { @@ -624,15 +624,15 @@ void ResetTimer::response(AbstractProcessLoop& events_loop) _client.deactivate_interval_timer(this); } -class DisplayHandler: public MessageHandlerImp { +class DisplayHandler: public MessageHandlerImp { public: DisplayHandler(DisplayChannel& channel) - : MessageHandlerImp(channel) {} + : MessageHandlerImp(channel) {} }; DisplayChannel::DisplayChannel(RedClient& client, uint32_t id, PixmapCache& pixmap_cache, GlzDecoderWindow& glz_window) - : RedChannel(client, RED_CHANNEL_DISPLAY, id, new DisplayHandler(*this), + : RedChannel(client, SPICE_CHANNEL_DISPLAY, id, new DisplayHandler(*this), Platform::PRIORITY_LOW) , ScreenLayer (SCREEN_LAYER_DISPLAY, true) , _canvas (NULL) @@ -655,37 +655,37 @@ DisplayChannel::DisplayChannel(RedClient& client, uint32_t id, { DisplayHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_MIGRATE, &DisplayChannel::handle_migrate, 0); - handler->set_handler(RED_SET_ACK, &DisplayChannel::handle_set_ack, sizeof(RedSetAck)); - handler->set_handler(RED_PING, &DisplayChannel::handle_ping, sizeof(RedPing)); - handler->set_handler(RED_WAIT_FOR_CHANNELS, &DisplayChannel::handle_wait_for_channels, - sizeof(RedWaitForChannels)); - handler->set_handler(RED_DISCONNECTING, &DisplayChannel::handle_disconnect, - sizeof(RedDisconnect)); - handler->set_handler(RED_NOTIFY, &DisplayChannel::handle_notify, sizeof(RedNotify)); + handler->set_handler(SPICE_MSG_MIGRATE, &DisplayChannel::handle_migrate, 0); + handler->set_handler(SPICE_MSG_SET_ACK, &DisplayChannel::handle_set_ack, sizeof(SpiceMsgSetAck)); + handler->set_handler(SPICE_MSG_PING, &DisplayChannel::handle_ping, sizeof(SpiceMsgPing)); + handler->set_handler(SPICE_MSG_WAIT_FOR_CHANNELS, &DisplayChannel::handle_wait_for_channels, + sizeof(SpiceMsgWaitForChannels)); + handler->set_handler(SPICE_MSG_DISCONNECTING, &DisplayChannel::handle_disconnect, + sizeof(SpiceMsgDisconnect)); + handler->set_handler(SPICE_MSG_NOTIFY, &DisplayChannel::handle_notify, sizeof(SpiceMsgNotify)); - handler->set_handler(RED_DISPLAY_MODE, &DisplayChannel::handle_mode, sizeof(RedMode)); - handler->set_handler(RED_DISPLAY_MARK, &DisplayChannel::handle_mark, 0); - handler->set_handler(RED_DISPLAY_RESET, &DisplayChannel::handle_reset, 0); + handler->set_handler(SPICE_MSG_DISPLAY_MODE, &DisplayChannel::handle_mode, sizeof(SpiceMsgDisplayMode)); + handler->set_handler(SPICE_MSG_DISPLAY_MARK, &DisplayChannel::handle_mark, 0); + handler->set_handler(SPICE_MSG_DISPLAY_RESET, &DisplayChannel::handle_reset, 0); - handler->set_handler(RED_DISPLAY_INVAL_LIST, + handler->set_handler(SPICE_MSG_DISPLAY_INVAL_LIST, &DisplayChannel::handle_inval_list, - sizeof(RedResorceList)); - handler->set_handler(RED_DISPLAY_INVAL_ALL_PIXMAPS, + sizeof(SpiceResorceList)); + handler->set_handler(SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS, &DisplayChannel::handle_inval_all_pixmaps, - sizeof(RedWaitForChannels)); - handler->set_handler(RED_DISPLAY_INVAL_PALETTE, - &DisplayChannel::handle_inval_palette, sizeof(RedInvalOne)); - handler->set_handler(RED_DISPLAY_INVAL_ALL_PALETTES, + sizeof(SpiceMsgWaitForChannels)); + handler->set_handler(SPICE_MSG_DISPLAY_INVAL_PALETTE, + &DisplayChannel::handle_inval_palette, sizeof(SpiceMsgDisplayInvalOne)); + handler->set_handler(SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES, &DisplayChannel::handle_inval_all_palettes, 0); - handler->set_handler(RED_DISPLAY_STREAM_CREATE, &DisplayChannel::handle_stream_create, - sizeof(RedStreamCreate)); - handler->set_handler(RED_DISPLAY_STREAM_CLIP, &DisplayChannel::handle_stream_clip, - sizeof(RedStreamClip)); - handler->set_handler(RED_DISPLAY_STREAM_DESTROY, &DisplayChannel::handle_stream_destroy, - sizeof(RedStreamDestroy)); - handler->set_handler(RED_DISPLAY_STREAM_DESTROY_ALL, + handler->set_handler(SPICE_MSG_DISPLAY_STREAM_CREATE, &DisplayChannel::handle_stream_create, + sizeof(SpiceMsgDisplayStreamCreate)); + handler->set_handler(SPICE_MSG_DISPLAY_STREAM_CLIP, &DisplayChannel::handle_stream_clip, + sizeof(SpiceMsgDisplayStreamClip)); + handler->set_handler(SPICE_MSG_DISPLAY_STREAM_DESTROY, &DisplayChannel::handle_stream_destroy, + sizeof(SpiceMsgDisplayStreamDestroy)); + handler->set_handler(SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL, &DisplayChannel::handle_stream_destroy_all, 0); get_process_loop().add_trigger(_streams_trigger); @@ -719,55 +719,55 @@ void DisplayChannel::set_draw_handlers() { DisplayHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_DISPLAY_COPY_BITS, &DisplayChannel::handle_copy_bits, - sizeof(RedCopyBits)); - - handler->set_handler(RED_DISPLAY_DRAW_FILL, &DisplayChannel::handle_draw_fill, - sizeof(RedFill)); - handler->set_handler(RED_DISPLAY_DRAW_OPAQUE, &DisplayChannel::handle_draw_opaque, - sizeof(RedOpaque)); - handler->set_handler(RED_DISPLAY_DRAW_COPY, &DisplayChannel::handle_draw_copy, - sizeof(RedCopy)); - handler->set_handler(RED_DISPLAY_DRAW_BLEND, &DisplayChannel::handle_draw_blend, - sizeof(RedBlend)); - handler->set_handler(RED_DISPLAY_DRAW_BLACKNESS, &DisplayChannel::handle_draw_blackness, - sizeof(RedBlackness)); - handler->set_handler(RED_DISPLAY_DRAW_WHITENESS, &DisplayChannel::handle_draw_whiteness, - sizeof(RedWhiteness)); - handler->set_handler(RED_DISPLAY_DRAW_INVERS, &DisplayChannel::handle_draw_invers, - sizeof(RedInvers)); - handler->set_handler(RED_DISPLAY_DRAW_ROP3, &DisplayChannel::handle_draw_rop3, - sizeof(RedRop3)); - handler->set_handler(RED_DISPLAY_DRAW_STROKE, &DisplayChannel::handle_draw_stroke, - sizeof(RedStroke)); - handler->set_handler(RED_DISPLAY_DRAW_TEXT, &DisplayChannel::handle_draw_text, - sizeof(RedText)); - handler->set_handler(RED_DISPLAY_DRAW_TRANSPARENT, - &DisplayChannel::handle_draw_transparent, sizeof(RedTransparent)); - handler->set_handler(RED_DISPLAY_DRAW_ALPHA_BLEND, - &DisplayChannel::handle_draw_alpha_blend, sizeof(RedAlphaBlend)); - handler->set_handler(RED_DISPLAY_STREAM_DATA, &DisplayChannel::handle_stream_data, - sizeof(RedStreamData)); + handler->set_handler(SPICE_MSG_DISPLAY_COPY_BITS, &DisplayChannel::handle_copy_bits, + sizeof(SpiceMsgDisplayCopyBits)); + + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_FILL, &DisplayChannel::handle_draw_fill, + sizeof(SpiceMsgDisplayDrawFill)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_OPAQUE, &DisplayChannel::handle_draw_opaque, + sizeof(SpiceMsgDisplayDrawOpaque)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_COPY, &DisplayChannel::handle_draw_copy, + sizeof(SpiceMsgDisplayDrawCopy)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_BLEND, &DisplayChannel::handle_draw_blend, + sizeof(SpiceMsgDisplayDrawBlend)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_BLACKNESS, &DisplayChannel::handle_draw_blackness, + sizeof(SpiceMsgDisplayDrawBlackness)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_WHITENESS, &DisplayChannel::handle_draw_whiteness, + sizeof(SpiceMsgDisplayDrawWhiteness)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_INVERS, &DisplayChannel::handle_draw_invers, + sizeof(SpiceMsgDisplayDrawInvers)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_ROP3, &DisplayChannel::handle_draw_rop3, + sizeof(SpiceMsgDisplayDrawRop3)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_STROKE, &DisplayChannel::handle_draw_stroke, + sizeof(SpiceMsgDisplayDrawStroke)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_TEXT, &DisplayChannel::handle_draw_text, + sizeof(SpiceMsgDisplayDrawText)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, + &DisplayChannel::handle_draw_transparent, sizeof(SpiceMsgDisplayDrawTransparent)); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, + &DisplayChannel::handle_draw_alpha_blend, sizeof(SpiceMsgDisplayDrawAlphaBlend)); + handler->set_handler(SPICE_MSG_DISPLAY_STREAM_DATA, &DisplayChannel::handle_stream_data, + sizeof(SpiceMsgDisplayStreamData)); } void DisplayChannel::clear_draw_handlers() { DisplayHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_DISPLAY_COPY_BITS, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_FILL, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_OPAQUE, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_COPY, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_BLEND, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_BLACKNESS, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_WHITENESS, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_INVERS, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_ROP3, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_STROKE, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_TEXT, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_TRANSPARENT, NULL, 0); - handler->set_handler(RED_DISPLAY_DRAW_ALPHA_BLEND, NULL, 0); - handler->set_handler(RED_DISPLAY_STREAM_DATA, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_COPY_BITS, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_FILL, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_OPAQUE, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_COPY, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_BLEND, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_BLACKNESS, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_WHITENESS, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_INVERS, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_ROP3, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_STROKE, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_TEXT, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, NULL, 0); + handler->set_handler(SPICE_MSG_DISPLAY_STREAM_DATA, NULL, 0); } void DisplayChannel::copy_pixels(const QRegion& dest_region, @@ -908,7 +908,7 @@ void DisplayChannel::on_mouse_button_release(int button, int buttons_state) { _buttons_state = buttons_state; if (_capture_mouse_mode) { - if (button == REDC_MOUSE_LBUTTON) { + if (button == SPICE_MOUSE_BUTTON_LEFT) { get_client().on_mouse_capture_trigger(*screen()); } return; @@ -1009,9 +1009,9 @@ public: virtual bool operator() (RedChannel& channel) { - if (channel.get_type() == RED_CHANNEL_CURSOR && channel.get_id() == _channel.get_id()) { + if (channel.get_type() == SPICE_CHANNEL_CURSOR && channel.get_id() == _channel.get_id()) { static_cast(channel).attach_display(&_channel); - } else if (channel.get_type() == RED_CHANNEL_INPUTS) { + } else if (channel.get_type() == SPICE_CHANNEL_INPUTS) { _channel.attach_inputs(&static_cast(channel)); } return false; @@ -1024,7 +1024,7 @@ public: virtual void response(AbstractProcessLoop& events_loop) { uint32_t mouse_mode = _channel.get_client().get_mouse_mode(); - _channel._capture_mouse_mode = (mouse_mode == RED_MOUSE_MODE_SERVER); + _channel._capture_mouse_mode = (mouse_mode == SPICE_MOUSE_MODE_SERVER); AttachChannels for_each_func(_channel); _channel.get_client().for_each_channel(for_each_func); } @@ -1046,7 +1046,7 @@ public: virtual bool operator() (RedChannel& channel) { - if (channel.get_type() == RED_CHANNEL_CURSOR && channel.get_id() == _channel.get_id()) { + if (channel.get_type() == SPICE_CHANNEL_CURSOR && channel.get_id() == _channel.get_id()) { static_cast(channel).detach_display(); return true; } @@ -1069,8 +1069,8 @@ private: void DisplayChannel::on_connect() { - Message* message = new Message(REDC_DISPLAY_INIT, sizeof(RedcDisplayInit)); - RedcDisplayInit* init = (RedcDisplayInit*)message->data(); + Message* message = new Message(SPICE_MSGC_DISPLAY_INIT, sizeof(SpiceMsgcDisplayInit)); + SpiceMsgcDisplayInit* init = (SpiceMsgcDisplayInit*)message->data(); init->pixmap_cache_id = 1; init->pixmap_cache_size = get_client().get_pixmap_cache_size(); init->glz_dictionary_id = 1; @@ -1230,7 +1230,7 @@ void DisplayChannel::create_canvas(const std::vector& canvas_types, int wid void DisplayChannel::handle_mode(RedPeer::InMessage* message) { - RedMode *mode = (RedMode *)message->data(); + SpiceMsgDisplayMode *mode = (SpiceMsgDisplayMode *)message->data(); _mark = false; attach_to_screen(get_client().get_application(), get_id()); @@ -1269,7 +1269,7 @@ void DisplayChannel::handle_mode(RedPeer::InMessage* message) void DisplayChannel::handle_mark(RedPeer::InMessage *message) { _mark = true; - Rect area; + SpiceRect area; area.top = area.left = 0; area.right = _x_res; area.bottom = _y_res; @@ -1300,7 +1300,7 @@ void DisplayChannel::handle_reset(RedPeer::InMessage *message) void DisplayChannel::handle_inval_list(RedPeer::InMessage* message) { - RedResorceList *inval_list = (RedResorceList *)message->data(); + SpiceResorceList *inval_list = (SpiceResorceList *)message->data(); if (message->size() < sizeof(*inval_list) + inval_list->count * sizeof(inval_list->resorces[0])) { @@ -1308,7 +1308,7 @@ void DisplayChannel::handle_inval_list(RedPeer::InMessage* message) } for (int i = 0; i < inval_list->count; i++) { - if (inval_list->resorces[i].type != RED_RES_TYPE_PIXMAP) { + if (inval_list->resorces[i].type != SPICE_RES_TYPE_PIXMAP) { THROW("invalid res type"); } @@ -1318,7 +1318,7 @@ void DisplayChannel::handle_inval_list(RedPeer::InMessage* message) void DisplayChannel::handle_inval_all_pixmaps(RedPeer::InMessage* message) { - RedWaitForChannels *wait = (RedWaitForChannels *)message->data(); + SpiceMsgWaitForChannels *wait = (SpiceMsgWaitForChannels *)message->data(); if (message->size() < sizeof(*wait) + wait->wait_count * sizeof(wait->wait_list[0])) { THROW("access violation"); } @@ -1328,7 +1328,7 @@ void DisplayChannel::handle_inval_all_pixmaps(RedPeer::InMessage* message) void DisplayChannel::handle_inval_palette(RedPeer::InMessage* message) { - RedInvalOne* inval = (RedInvalOne*)message->data(); + SpiceMsgDisplayInvalOne* inval = (SpiceMsgDisplayInvalOne*)message->data(); _palette_cache.remove(inval->id); } @@ -1337,35 +1337,35 @@ void DisplayChannel::handle_inval_all_palettes(RedPeer::InMessage* message) _palette_cache.clear(); } -void DisplayChannel::set_clip_rects(const Clip& clip, uint32_t& num_clip_rects, - Rect*& clip_rects, unsigned long addr_offset, +void DisplayChannel::set_clip_rects(const SpiceClip& clip, uint32_t& num_clip_rects, + SpiceRect*& clip_rects, unsigned long addr_offset, uint8_t *min, uint8_t *max) { switch (clip.type) { - case CLIP_TYPE_RECTS: { - uint32_t* n = (uint32_t*)GET_ADDRESS(clip.data + addr_offset); + case SPICE_CLIP_TYPE_RECTS: { + uint32_t* n = (uint32_t*)SPICE_GET_ADDRESS(clip.data + addr_offset); if (n < (uint32_t*)min || n + 1 > (uint32_t*)max) { THROW("access violation"); } num_clip_rects = *n; - clip_rects = (Rect *)(n + 1); - if (clip_rects + num_clip_rects > (Rect*)max) { + clip_rects = (SpiceRect *)(n + 1); + if (clip_rects + num_clip_rects > (SpiceRect*)max) { THROW("access violation"); } break; } - case CLIP_TYPE_NONE: + case SPICE_CLIP_TYPE_NONE: num_clip_rects = 0; clip_rects = NULL; break; - case CLIP_TYPE_PATH: + case SPICE_CLIP_TYPE_PATH: THROW("unexpected clip type"); } } void DisplayChannel::handle_stream_create(RedPeer::InMessage* message) { - RedStreamCreate* stream_create = (RedStreamCreate*)message->data(); + SpiceMsgDisplayStreamCreate* stream_create = (SpiceMsgDisplayStreamCreate*)message->data(); Lock lock(_streams_lock); if (_streams.size() <= stream_create->id) { @@ -1377,13 +1377,13 @@ void DisplayChannel::handle_stream_create(RedPeer::InMessage* message) } uint32_t num_clip_rects; - Rect* clip_rects; + SpiceRect* clip_rects; set_clip_rects(stream_create->clip, num_clip_rects, clip_rects, (unsigned long)message->data(), (uint8_t*)(stream_create + 1), message->data() + message->size()); _streams[stream_create->id] = new VideoStream(get_client(), *_canvas.get(), *this, stream_create->codec_type, - !!(stream_create->flags & STREAM_TOP_DOWN), + !!(stream_create->flags & SPICE_STREAM_FLAGS_TOP_DOWN), stream_create->stream_width, stream_create->stream_height, stream_create->src_width, @@ -1398,14 +1398,14 @@ void DisplayChannel::handle_stream_create(RedPeer::InMessage* message) void DisplayChannel::handle_stream_data(RedPeer::InMessage* message) { - RedStreamData* stream_data = (RedStreamData*)message->data(); + SpiceMsgDisplayStreamData* stream_data = (SpiceMsgDisplayStreamData*)message->data(); VideoStream* stream; if (stream_data->id >= _streams.size() || !(stream = _streams[stream_data->id])) { THROW("invalid stream"); } - if (message->size() < sizeof(RedStreamData) + stream_data->data_size + stream_data->ped_size) { + if (message->size() < sizeof(SpiceMsgDisplayStreamData) + stream_data->data_size + stream_data->ped_size) { THROW("access violation"); } @@ -1415,16 +1415,16 @@ void DisplayChannel::handle_stream_data(RedPeer::InMessage* message) void DisplayChannel::handle_stream_clip(RedPeer::InMessage* message) { - RedStreamClip* clip_data = (RedStreamClip*)message->data(); + SpiceMsgDisplayStreamClip* clip_data = (SpiceMsgDisplayStreamClip*)message->data(); VideoStream* stream; uint32_t num_clip_rects; - Rect* clip_rects; + SpiceRect* clip_rects; if (clip_data->id >= _streams.size() || !(stream = _streams[clip_data->id])) { THROW("invalid stream"); } - if (message->size() < sizeof(RedStreamClip)) { + if (message->size() < sizeof(SpiceMsgDisplayStreamClip)) { THROW("access violation"); } set_clip_rects(clip_data->clip, num_clip_rects, clip_rects, @@ -1436,7 +1436,7 @@ void DisplayChannel::handle_stream_clip(RedPeer::InMessage* message) void DisplayChannel::handle_stream_destroy(RedPeer::InMessage* message) { - RedStreamDestroy* stream_destroy = (RedStreamDestroy*)message->data(); + SpiceMsgDisplayStreamDestroy* stream_destroy = (SpiceMsgDisplayStreamDestroy*)message->data(); if (stream_destroy->id >= _streams.size() || !_streams[stream_destroy->id]) { THROW("invalid stream"); @@ -1477,7 +1477,7 @@ void DisplayChannel::handle_stream_destroy_all(RedPeer::InMessage* message) void DisplayChannel::handle_copy_bits(RedPeer::InMessage* message) { - RedCopyBits* copy_bits = (RedCopyBits*)message->data(); + SpiceMsgDisplayCopyBits* copy_bits = (SpiceMsgDisplayCopyBits*)message->data(); PRE_DRAW; _canvas->copy_bits(*copy_bits, message->size()); POST_DRAW; @@ -1486,73 +1486,73 @@ void DisplayChannel::handle_copy_bits(RedPeer::InMessage* message) void DisplayChannel::handle_draw_fill(RedPeer::InMessage* message) { - RedFill* fill = (RedFill*)message->data(); + SpiceMsgDisplayDrawFill* fill = (SpiceMsgDisplayDrawFill*)message->data(); DRAW(fill); } void DisplayChannel::handle_draw_opaque(RedPeer::InMessage* message) { - RedOpaque* opaque = (RedOpaque*)message->data(); + SpiceMsgDisplayDrawOpaque* opaque = (SpiceMsgDisplayDrawOpaque*)message->data(); DRAW(opaque); } void DisplayChannel::handle_draw_copy(RedPeer::InMessage* message) { - RedCopy* copy = (RedCopy*)message->data(); + SpiceMsgDisplayDrawCopy* copy = (SpiceMsgDisplayDrawCopy*)message->data(); DRAW(copy); } void DisplayChannel::handle_draw_blend(RedPeer::InMessage* message) { - RedBlend* blend = (RedBlend*)message->data(); + SpiceMsgDisplayDrawBlend* blend = (SpiceMsgDisplayDrawBlend*)message->data(); DRAW(blend); } void DisplayChannel::handle_draw_blackness(RedPeer::InMessage* message) { - RedBlackness* blackness = (RedBlackness*)message->data(); + SpiceMsgDisplayDrawBlackness* blackness = (SpiceMsgDisplayDrawBlackness*)message->data(); DRAW(blackness); } void DisplayChannel::handle_draw_whiteness(RedPeer::InMessage* message) { - RedWhiteness* whiteness = (RedWhiteness*)message->data(); + SpiceMsgDisplayDrawWhiteness* whiteness = (SpiceMsgDisplayDrawWhiteness*)message->data(); DRAW(whiteness); } void DisplayChannel::handle_draw_invers(RedPeer::InMessage* message) { - RedInvers* invers = (RedInvers*)message->data(); + SpiceMsgDisplayDrawInvers* invers = (SpiceMsgDisplayDrawInvers*)message->data(); DRAW(invers); } void DisplayChannel::handle_draw_rop3(RedPeer::InMessage* message) { - RedRop3* rop3 = (RedRop3*)message->data(); + SpiceMsgDisplayDrawRop3* rop3 = (SpiceMsgDisplayDrawRop3*)message->data(); DRAW(rop3); } void DisplayChannel::handle_draw_stroke(RedPeer::InMessage* message) { - RedStroke* stroke = (RedStroke*)message->data(); + SpiceMsgDisplayDrawStroke* stroke = (SpiceMsgDisplayDrawStroke*)message->data(); DRAW(stroke); } void DisplayChannel::handle_draw_text(RedPeer::InMessage* message) { - RedText* text = (RedText*)message->data(); + SpiceMsgDisplayDrawText* text = (SpiceMsgDisplayDrawText*)message->data(); DRAW(text); } void DisplayChannel::handle_draw_transparent(RedPeer::InMessage* message) { - RedTransparent* transparent = (RedTransparent*)message->data(); + SpiceMsgDisplayDrawTransparent* transparent = (SpiceMsgDisplayDrawTransparent*)message->data(); DRAW(transparent); } void DisplayChannel::handle_draw_alpha_blend(RedPeer::InMessage* message) { - RedAlphaBlend* alpha_blend = (RedAlphaBlend*)message->data(); + SpiceMsgDisplayDrawAlphaBlend* alpha_blend = (SpiceMsgDisplayDrawAlphaBlend*)message->data(); DRAW(alpha_blend); } @@ -1648,7 +1648,7 @@ void DisplayChannel::on_streams_trigger() class DisplayFactory: public ChannelFactory { public: - DisplayFactory() : ChannelFactory(RED_CHANNEL_DISPLAY) {} + DisplayFactory() : ChannelFactory(SPICE_CHANNEL_DISPLAY) {} virtual RedChannel* construct(RedClient& client, uint32_t id) { return new DisplayChannel(client, id, diff --git a/client/display_channel.h b/client/display_channel.h index e58be919..802898f5 100644 --- a/client/display_channel.h +++ b/client/display_channel.h @@ -166,7 +166,7 @@ private: void activate_streams_timer(); void stream_update_request(uint32_t update_time); - static void set_clip_rects(const Clip& clip, uint32_t& num_clip_rects, Rect*& clip_rects, + static void set_clip_rects(const SpiceClip& clip, uint32_t& num_clip_rects, SpiceRect*& clip_rects, unsigned long addr_offset, uint8_t *min, uint8_t *max); private: std::auto_ptr _canvas; @@ -197,7 +197,7 @@ private: bool _capture_mouse_mode; InputsChannel* _inputs_channel; - Point _pointer_pos; + SpicePoint _pointer_pos; int _buttons_state; std::vector _streams; diff --git a/client/glz_decode_tmpl.c b/client/glz_decode_tmpl.c index 6942b73c..2c5d6a3c 100644 --- a/client/glz_decode_tmpl.c +++ b/client/glz_decode_tmpl.c @@ -175,7 +175,7 @@ size should be in PIXEL */ static size_t FNAME(decode)(GlzDecoderWindow &window, uint8_t* in_buf, uint8_t *out_buf, int size, - DecodedImageWinId image_win_id, Palette *plt, + DecodedImageWinId image_win_id, SpicePalette *plt, GlzDecoderDebug &debug_calls) { uint8_t *ip = in_buf; diff --git a/client/glz_decoder.cpp b/client/glz_decoder.cpp index d5f5970d..0453aaae 100644 --- a/client/glz_decoder.cpp +++ b/client/glz_decoder.cpp @@ -188,7 +188,7 @@ typedef uint16_t rgb16_pixel_t; typedef size_t (*decode_function)(GlzDecoderWindow &window, uint8_t* in_buf, uint8_t *out_buf, int size, - DecodedImageWinId image_win_id, Palette *plt, + DecodedImageWinId image_win_id, SpicePalette *plt, GlzDecoderDebug &debug_calls); // ordered according to LZ_IMAGE_TYPE @@ -218,7 +218,7 @@ const decode_function DECODE_TO_SAME[] = { glz_rgb32_decode }; -void GlzDecoder::decode(uint8_t *data, Palette *palette, void *opaque_usr_info) +void GlzDecoder::decode(uint8_t *data, SpicePalette *palette, void *opaque_usr_info) { int out_size; DecodedImageWinId image_window_id; diff --git a/client/glz_decoder.h b/client/glz_decoder.h index 98c15754..87cb747c 100644 --- a/client/glz_decoder.h +++ b/client/glz_decoder.h @@ -55,7 +55,7 @@ public: virtual ~GlzDecoder(); /* Decodes the data and afterwards calls GlzDecodeHandler::handle_decoded_image */ - void decode(uint8_t *data, Palette *palette, void *opaque_usr_info); + void decode(uint8_t *data, SpicePalette *palette, void *opaque_usr_info); private: void decode_header(); diff --git a/client/gui/gui.cpp b/client/gui/gui.cpp index 4a63d5a9..885f7422 100644 --- a/client/gui/gui.cpp +++ b/client/gui/gui.cpp @@ -81,7 +81,7 @@ public: class MyListItem : public CEGUI::ListboxTextItem { public: - MyListItem (const CEGUI::String& text) + MyListItem (const CEGUI::SpiceString& text) : CEGUI::ListboxTextItem(text) { setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush"); @@ -257,7 +257,7 @@ private: class UndimInfo { public: - UndimInfo(const CEGUI::String& name, float alpha, bool inherits) + UndimInfo(const CEGUI::SpiceString& name, float alpha, bool inherits) : _name (name) , _alpha (alpha) , _inherits (inherits) @@ -275,7 +275,7 @@ private: } private: - CEGUI::String _name; + CEGUI::SpiceString _name; float _alpha; bool _inherits; @@ -736,7 +736,7 @@ ConnectingDialog::ConnectingDialog(GUI& gui) int y_pos = (MAIN_GUI_HEIGHT - CONNECTING_DIALOG_HEIGHT) / 2; set_win_pos(wnd, x_pos, y_pos); set_win_size(wnd, CONNECTING_DIALOG_WIDTH, CONNECTING_DIALOG_HEIGHT); - CEGUI::String text(res_get_string(STR_MESG_CONNECTING)); + CEGUI::SpiceString text(res_get_string(STR_MESG_CONNECTING)); wnd->setText(text + " " + application().get_host()); wnd->setProperty("HorzFormatting", "LeftAligned"); wnd->setProperty("VertFormatting", "TopAligned"); @@ -924,7 +924,7 @@ void GUI::init_cegui() _gui_system->setDefaultMouseCursor("TaharezLook", "MouseArrow"); _gui_system->setDefaultTooltip("TaharezLook/Tooltip"); - CEGUI::String font_name("DejaVuSans-10"); + CEGUI::SpiceString font_name("DejaVuSans-10"); CEGUI::Font* font; if (!CEGUI::FontManager::getSingleton().isFontPresent(font_name)) { @@ -991,7 +991,7 @@ void GUI::update_layer_area() clear_area(); return; } - Point screen_size = screen()->get_size(); + SpicePoint screen_size = screen()->get_size(); int dx = (screen_size.x - MAIN_GUI_WIDTH) / 2; int dy = (screen_size.y - MAIN_GUI_HEIGHT) / 2; @@ -1010,8 +1010,8 @@ void GUI::update_layer_area() continue; } - CEGUI::Rect area = child->getPixelRect(); - Rect r; + CEGUI::SpiceRect area = child->getPixelRect(); + SpiceRect r; r.left = (int)area.d_left + dx; r.right = (int)area.d_right + dx; r.top = (int)area.d_top + dy; @@ -1030,13 +1030,13 @@ void GUI::copy_pixels(const QRegion& dest_region, RedDrawable& dest) } for (int i = 0; i < (int)dest_region.num_rects; i++) { - Rect* r = &dest_region.rects[i]; + SpiceRect* r = &dest_region.rects[i]; _pixmap->copy_pixels(dest, r->left, r->top, *r); } _gui_system->renderGUI(); for (int i = 0; i < (int)dest_region.num_rects; i++) { - Rect* r = &dest_region.rects[i]; + SpiceRect* r = &dest_region.rects[i]; dest.copy_pixels(*_pixmap, r->left, r->top, *r); } } @@ -1145,23 +1145,23 @@ void GUI::on_mouse_button_press(int button, int buttons_state) { _app.set_key_handler(*this); switch (button) { - case REDC_MOUSE_LBUTTON: + case SPICE_MOUSE_BUTTON_LEFT: _gui_system->injectMouseButtonDown(CEGUI::LeftButton); break; - case REDC_MOUSE_MBUTTON: + case SPICE_MOUSE_BUTTON_MIDDLE: _gui_system->injectMouseButtonDown(CEGUI::MiddleButton); break; - case REDC_MOUSE_RBUTTON: + case SPICE_MOUSE_BUTTON_RIGHT: _gui_system->injectMouseButtonDown(CEGUI::RightButton); break; - case REDC_MOUSE_UBUTTON: + case SPICE_MOUSE_BUTTON_UP: _gui_system->injectMouseWheelChange(-1); break; - case REDC_MOUSE_DBUTTON: + case SPICE_MOUSE_BUTTON_DOWN: _gui_system->injectMouseWheelChange(1); break; default: - THROW("invalid RedButton %d", button); + THROW("invalid SpiceMouseButton %d", button); } conditional_update(); } @@ -1169,20 +1169,20 @@ void GUI::on_mouse_button_press(int button, int buttons_state) void GUI::on_mouse_button_release(int button, int buttons_state) { switch (button) { - case REDC_MOUSE_LBUTTON: + case SPICE_MOUSE_BUTTON_LEFT: _gui_system->injectMouseButtonUp(CEGUI::LeftButton); break; - case REDC_MOUSE_MBUTTON: + case SPICE_MOUSE_BUTTON_MIDDLE: _gui_system->injectMouseButtonUp(CEGUI::MiddleButton); break; - case REDC_MOUSE_RBUTTON: + case SPICE_MOUSE_BUTTON_RIGHT: _gui_system->injectMouseButtonUp(CEGUI::RightButton); break; - case REDC_MOUSE_UBUTTON: - case REDC_MOUSE_DBUTTON: + case SPICE_MOUSE_BUTTON_UP: + case SPICE_MOUSE_BUTTON_DOWN: break; default: - THROW("invalid RedButton %d", button); + THROW("invalid SpiceMouseButton %d", button); } conditional_update(); } diff --git a/client/gui/resource_provider.cpp b/client/gui/resource_provider.cpp index 47f86a43..b194ea9e 100644 --- a/client/gui/resource_provider.cpp +++ b/client/gui/resource_provider.cpp @@ -19,9 +19,9 @@ //{"; od -txC -v | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$d" //| sed -e"\$s/,$/};/") > .c -void CEGUIResourceProvider::loadRawDataContainer(const CEGUI::String &filename, +void CEGUIResourceProvider::loadRawDataContainer(const CEGUI::SpiceString &filename, CEGUI::RawDataContainer &output, - const CEGUI::String &resourceGroup) + const CEGUI::SpiceString &resourceGroup) { DBG(0, "%s", filename.c_str()); if (strcmp(filename.c_str(), "TaharezLook.scheme") == 0) { diff --git a/client/gui/resource_provider.h b/client/gui/resource_provider.h index 1443abe4..b418c4dd 100644 --- a/client/gui/resource_provider.h +++ b/client/gui/resource_provider.h @@ -5,9 +5,9 @@ class CEGUIResourceProvider: public CEGUI::ResourceProvider { public: - virtual void loadRawDataContainer(const CEGUI::String &filename, + virtual void loadRawDataContainer(const CEGUI::SpiceString &filename, CEGUI::RawDataContainer &output, - const CEGUI::String &resourceGroup); + const CEGUI::SpiceString &resourceGroup); virtual void unloadRawDataContainer(CEGUI::RawDataContainer& data); }; diff --git a/client/gui/softrenderer.cpp b/client/gui/softrenderer.cpp index 87fffb8b..ca69cce4 100644 --- a/client/gui/softrenderer.cpp +++ b/client/gui/softrenderer.cpp @@ -62,11 +62,11 @@ void SoftRenderer::setupImageCodec() _destroy_image_codec = destroyImageCodec; _image_codec = createImageCodec(); #else - String _default_codec_name(STRINGIZE(TGAImageCodec/*CEGUI_DEFAULT_IMAGE_CODEC*/)); + SpiceString _default_codec_name(STRINGIZE(TGAImageCodec/*CEGUI_DEFAULT_IMAGE_CODEC*/)); DynamicModule* module = NULL; try { - DynamicModule* module = new DynamicModule(String("CEGUI") + _default_codec_name); + DynamicModule* module = new DynamicModule(SpiceString("CEGUI") + _default_codec_name); _destroy_image_codec = (void(*)(ImageCodec*))module->getSymbolAddress("destroyImageCodec"); @@ -228,8 +228,8 @@ inline void SoftRenderer::setRGB(ColourI& dest, const colour& src) dest.a = uint8_t(src.getAlpha() * 255); } -void SoftRenderer::addQuad(const Rect& dest_rect, float z, const Texture* texture, - const Rect& texture_rect, const ColourRect& colours, +void SoftRenderer::addQuad(const SpiceRect& dest_rect, float z, const Texture* texture, + const SpiceRect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode) { if (dest_rect.d_right <= dest_rect.d_left || dest_rect.d_bottom <= dest_rect.d_top) { @@ -300,8 +300,8 @@ Texture* SoftRenderer::createTexture() return texture; } -Texture* SoftRenderer::createTexture(const String& filename, - const String& resourceGroup) +Texture* SoftRenderer::createTexture(const SpiceString& filename, + const SpiceString& resourceGroup) { SoftTexture* texture = new SoftTexture(this, filename, resourceGroup); _textures.push_back(texture); @@ -354,9 +354,9 @@ Size SoftRenderer::getSize() const return Size((float)_width, (float)_height); } -Rect SoftRenderer::getRect() const +SpiceRect SoftRenderer::getRect() const { - return Rect(0, 0, (float)_width, (float)_height); + return SpiceRect(0, 0, (float)_width, (float)_height); } uint SoftRenderer::getHorzScreenDPI() const diff --git a/client/gui/softrenderer.h b/client/gui/softrenderer.h index 9fc1a29e..1cab0a24 100644 --- a/client/gui/softrenderer.h +++ b/client/gui/softrenderer.h @@ -24,8 +24,8 @@ namespace CEGUI void reset_surface(uint8_t* surface, uint width, uint height, uint stride); - virtual void addQuad(const Rect& dest_rect, float z, const Texture* tex, - const Rect& texture_rect, const ColourRect& colours, + virtual void addQuad(const SpiceRect& dest_rect, float z, const Texture* tex, + const SpiceRect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode); virtual void doRender(); virtual void clearRenderList(); @@ -33,8 +33,8 @@ namespace CEGUI virtual bool isQueueingEnabled() const; virtual Texture* createTexture(); - virtual Texture* createTexture(const String& filename, - const String& resourceGroup); + virtual Texture* createTexture(const SpiceString& filename, + const SpiceString& resourceGroup); virtual Texture* createTexture(float size); virtual void destroyTexture(Texture* texture); virtual void destroyAllTextures(); @@ -43,7 +43,7 @@ namespace CEGUI virtual float getWidth() const; virtual float getHeight() const; virtual Size getSize() const; - virtual Rect getRect() const; + virtual SpiceRect getRect() const; virtual uint getHorzScreenDPI() const; virtual uint getVertScreenDPI() const; diff --git a/client/gui/softtexture.cpp b/client/gui/softtexture.cpp index 562edeab..983374ae 100644 --- a/client/gui/softtexture.cpp +++ b/client/gui/softtexture.cpp @@ -34,8 +34,8 @@ SoftTexture::SoftTexture(Renderer* owner, uint size) } -SoftTexture::SoftTexture(Renderer* owner, const String& filename, - const String& resourceGroup) +SoftTexture::SoftTexture(Renderer* owner, const SpiceString& filename, + const SpiceString& resourceGroup) : Texture (owner) , _surf (NULL) , _width (0) @@ -57,7 +57,7 @@ void SoftTexture::freeSurf() _surf = NULL; } -void SoftTexture::loadFromFile(const String& filename, const String& resourceGroup) +void SoftTexture::loadFromFile(const SpiceString& filename, const SpiceString& resourceGroup) { freeSurf(); SoftRenderer* renderer = static_cast(getRenderer()); diff --git a/client/gui/softtexture.h b/client/gui/softtexture.h index 37617f29..f3797d9a 100644 --- a/client/gui/softtexture.h +++ b/client/gui/softtexture.h @@ -13,14 +13,14 @@ namespace CEGUI public: SoftTexture(Renderer* owner); SoftTexture(Renderer* owner, uint size); - SoftTexture(Renderer* owner, const String& filename, - const String& resourceGroup); + SoftTexture(Renderer* owner, const SpiceString& filename, + const SpiceString& resourceGroup); virtual ~SoftTexture(); virtual ushort getWidth(void) const { return _width;} virtual ushort getHeight(void) const { return _height;} - virtual void loadFromFile(const String& filename, const String& resourceGroup); + virtual void loadFromFile(const SpiceString& filename, const SpiceString& resourceGroup); virtual void loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat); diff --git a/client/inputs_channel.cpp b/client/inputs_channel.cpp index 1f24ffcf..2fa1e0d4 100644 --- a/client/inputs_channel.cpp +++ b/client/inputs_channel.cpp @@ -38,7 +38,7 @@ public: virtual bool operator() (RedChannel& channel) { - if (channel.get_type() == RED_CHANNEL_DISPLAY) { + if (channel.get_type() == SPICE_CHANNEL_DISPLAY) { static_cast(channel).attach_inputs(&_channel); } return true; @@ -83,7 +83,7 @@ public: public: virtual bool operator() (RedChannel& channel) { - if (channel.get_type() == RED_CHANNEL_DISPLAY) { + if (channel.get_type() == SPICE_CHANNEL_DISPLAY) { static_cast(channel).detach_inputs(); } return true; @@ -114,7 +114,7 @@ private: MotionMessage::MotionMessage(InputsChannel& channel) : RedChannel::OutMessage() - , RedPeer::OutMessage(REDC_INPUTS_MOUSE_MOTION, sizeof(RedcMouseMotion)) + , RedPeer::OutMessage(SPICE_MSGC_INPUTS_MOUSE_MOTION, sizeof(SpiceMsgcMouseMotion)) , _channel (channel) { } @@ -126,7 +126,7 @@ void MotionMessage::release() RedPeer::OutMessage& MotionMessage::peer_message() { - _channel.set_motion_event(*(RedcMouseMotion*)data()); + _channel.set_motion_event(*(SpiceMsgcMouseMotion*)data()); return *this; } @@ -142,7 +142,7 @@ private: PositionMessage::PositionMessage(InputsChannel& channel) : RedChannel::OutMessage() - , RedPeer::OutMessage(REDC_INPUTS_MOUSE_POSITION, sizeof(RedcMousePosition)) + , RedPeer::OutMessage(SPICE_MSGC_INPUTS_MOUSE_POSITION, sizeof(SpiceMsgcMousePosition)) , _channel (channel) { } @@ -154,18 +154,18 @@ void PositionMessage::release() RedPeer::OutMessage& PositionMessage::peer_message() { - _channel.set_position_event(*(RedcMousePosition*)data()); + _channel.set_position_event(*(SpiceMsgcMousePosition*)data()); return *this; } -class InputsMessHandler: public MessageHandlerImp { +class InputsMessHandler: public MessageHandlerImp { public: InputsMessHandler(InputsChannel& channel) - : MessageHandlerImp(channel) {} + : MessageHandlerImp(channel) {} }; InputsChannel::InputsChannel(RedClient& client, uint32_t id) - : RedChannel(client, RED_CHANNEL_INPUTS, id, new InputsMessHandler(*this)) + : RedChannel(client, SPICE_CHANNEL_INPUTS, id, new InputsMessHandler(*this)) , _mouse_buttons_state (0) , _mouse_dx (0) , _mouse_dy (0) @@ -177,19 +177,19 @@ InputsChannel::InputsChannel(RedClient& client, uint32_t id) , _active_modifiers_event (false) { InputsMessHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_MIGRATE, &InputsChannel::handle_migrate, 0); - handler->set_handler(RED_SET_ACK, &InputsChannel::handle_set_ack, sizeof(RedSetAck)); - handler->set_handler(RED_PING, &InputsChannel::handle_ping, sizeof(RedPing)); - handler->set_handler(RED_WAIT_FOR_CHANNELS, &InputsChannel::handle_wait_for_channels, - sizeof(RedWaitForChannels)); - handler->set_handler(RED_DISCONNECTING, &InputsChannel::handle_disconnect, - sizeof(RedDisconnect)); - handler->set_handler(RED_NOTIFY, &InputsChannel::handle_notify, sizeof(RedNotify)); + handler->set_handler(SPICE_MSG_MIGRATE, &InputsChannel::handle_migrate, 0); + handler->set_handler(SPICE_MSG_SET_ACK, &InputsChannel::handle_set_ack, sizeof(SpiceMsgSetAck)); + handler->set_handler(SPICE_MSG_PING, &InputsChannel::handle_ping, sizeof(SpiceMsgPing)); + handler->set_handler(SPICE_MSG_WAIT_FOR_CHANNELS, &InputsChannel::handle_wait_for_channels, + sizeof(SpiceMsgWaitForChannels)); + handler->set_handler(SPICE_MSG_DISCONNECTING, &InputsChannel::handle_disconnect, + sizeof(SpiceMsgDisconnect)); + handler->set_handler(SPICE_MSG_NOTIFY, &InputsChannel::handle_notify, sizeof(SpiceMsgNotify)); - handler->set_handler(RED_INPUTS_INIT, &InputsChannel::handle_init, sizeof(RedInputsInit)); - handler->set_handler(RED_INPUTS_KEY_MODIFAIERS, &InputsChannel::handle_modifaiers, - sizeof(RedKeyModifiers)); - handler->set_handler(RED_INPUTS_MOUSE_MOTION_ACK, &InputsChannel::handle_motion_ack, 0); + handler->set_handler(SPICE_MSG_INPUTS_INIT, &InputsChannel::handle_init, sizeof(SpiceMsgInputsInit)); + handler->set_handler(SPICE_MSG_INPUTS_KEY_MODIFIERS, &InputsChannel::handle_modifaiers, + sizeof(SpiceMsgInputsKeyModifiers)); + handler->set_handler(SPICE_MSG_INPUTS_MOUSE_MOTION_ACK, &InputsChannel::handle_motion_ack, 0); } InputsChannel::~InputsChannel() @@ -212,7 +212,7 @@ void InputsChannel::on_disconnect() void InputsChannel::handle_init(RedPeer::InMessage* message) { - RedInputsInit* init = (RedInputsInit*)message->data(); + SpiceMsgInputsInit* init = (SpiceMsgInputsInit*)message->data(); _modifiers = init->keyboard_modifiers; AutoRef set_handler_event(new SetInputsHandlerEvent(*this)); get_client().push_event(*set_handler_event); @@ -220,7 +220,7 @@ void InputsChannel::handle_init(RedPeer::InMessage* message) void InputsChannel::handle_modifaiers(RedPeer::InMessage* message) { - RedKeyModifiers* init = (RedKeyModifiers*)message->data(); + SpiceMsgInputsKeyModifiers* init = (SpiceMsgInputsKeyModifiers*)message->data(); _modifiers = init->modifiers; Lock lock(_update_modifiers_lock); if (_active_modifiers_event) { @@ -234,20 +234,20 @@ void InputsChannel::handle_modifaiers(RedPeer::InMessage* message) void InputsChannel::handle_motion_ack(RedPeer::InMessage* message) { Lock lock(_motion_lock); - if (_motion_count < RED_MOTION_ACK_BUNCH) { + if (_motion_count < SPICE_INPUT_MOTION_ACK_BUNCH) { LOG_WARN("invalid motion count"); _motion_count = 0; } else { - _motion_count -= RED_MOTION_ACK_BUNCH; + _motion_count -= SPICE_INPUT_MOTION_ACK_BUNCH; } if (!_active_motion && (_mouse_dx || _mouse_dy || _display_id != -1)) { _active_motion = true; _motion_count++; switch (get_client().get_mouse_mode()) { - case RED_MOUSE_MODE_CLIENT: + case SPICE_MOUSE_MODE_CLIENT: post_message(new PositionMessage(*this)); break; - case RED_MOUSE_MODE_SERVER: + case SPICE_MOUSE_MODE_SERVER: post_message(new MotionMessage(*this)); break; default: @@ -256,7 +256,7 @@ void InputsChannel::handle_motion_ack(RedPeer::InMessage* message) } } -void InputsChannel::set_motion_event(RedcMouseMotion& motion) +void InputsChannel::set_motion_event(SpiceMsgcMouseMotion& motion) { Lock lock(_motion_lock); motion.buttons_state = _mouse_buttons_state; @@ -266,7 +266,7 @@ void InputsChannel::set_motion_event(RedcMouseMotion& motion) _active_motion = false; } -void InputsChannel::set_position_event(RedcMousePosition& position) +void InputsChannel::set_position_event(SpiceMsgcMousePosition& position) { Lock lock(_motion_lock); position.buttons_state = _mouse_buttons_state; @@ -284,7 +284,7 @@ void InputsChannel::on_mouse_motion(int dx, int dy, int buttons_state) _mouse_buttons_state = buttons_state; _mouse_dx += dx; _mouse_dy += dy; - if (!_active_motion && _motion_count < RED_MOTION_ACK_BUNCH * 2) { + if (!_active_motion && _motion_count < SPICE_INPUT_MOTION_ACK_BUNCH * 2) { _active_motion = true; _motion_count++; post_message(new MotionMessage(*this)); @@ -298,7 +298,7 @@ void InputsChannel::on_mouse_position(int x, int y, int buttons_state, int displ _mouse_x = x; _mouse_y = y; _display_id = display_id; - if (!_active_motion && _motion_count < RED_MOTION_ACK_BUNCH * 2) { + if (!_active_motion && _motion_count < SPICE_INPUT_MOTION_ACK_BUNCH * 2) { _active_motion = true; _motion_count++; post_message(new PositionMessage(*this)); @@ -314,8 +314,8 @@ void InputsChannel::on_mouse_down(int button, int buttons_state) { Message* message; - message = new Message(REDC_INPUTS_MOUSE_PRESS, sizeof(RedcMouseRelease)); - RedcMousePress* event = (RedcMousePress*)message->data(); + message = new Message(SPICE_MSGC_INPUTS_MOUSE_PRESS, sizeof(SpiceMsgcMouseRelease)); + SpiceMsgcMousePress* event = (SpiceMsgcMousePress*)message->data(); event->button = button; event->buttons_state = buttons_state; post_message(message); @@ -325,8 +325,8 @@ void InputsChannel::on_mouse_up(int button, int buttons_state) { Message* message; - message = new Message(REDC_INPUTS_MOUSE_RELEASE, sizeof(RedcMouseRelease)); - RedcMouseRelease* event = (RedcMouseRelease*)message->data(); + message = new Message(SPICE_MSGC_INPUTS_MOUSE_RELEASE, sizeof(SpiceMsgcMouseRelease)); + SpiceMsgcMouseRelease* event = (SpiceMsgcMouseRelease*)message->data(); event->button = button; event->buttons_state = buttons_state; post_message(message); @@ -352,8 +352,8 @@ void InputsChannel::on_key_down(RedKey key) return; } - Message* message = new Message(REDC_INPUTS_KEY_DOWN, sizeof(RedcKeyDown)); - RedcKeyDown* event = (RedcKeyDown*)message->data(); + Message* message = new Message(SPICE_MSGC_INPUTS_KEY_DOWN, sizeof(SpiceMsgcKeyDown)); + SpiceMsgcKeyDown* event = (SpiceMsgcKeyDown*)message->data(); event->code = scan_code; post_message(message); } @@ -366,8 +366,8 @@ void InputsChannel::on_key_up(RedKey key) return; } - Message* message = new Message(REDC_INPUTS_KEY_UP, sizeof(RedcKeyUp)); - RedcKeyUp* event = (RedcKeyUp*)message->data(); + Message* message = new Message(SPICE_MSGC_INPUTS_KEY_UP, sizeof(SpiceMsgcKeyUp)); + SpiceMsgcKeyUp* event = (SpiceMsgcKeyUp*)message->data(); event->code = scan_code; post_message(message); } @@ -376,15 +376,15 @@ void InputsChannel::set_local_modifiers() { unsigned int modifiers = 0; - if (_modifiers & RED_SCROLL_LOCK_MODIFIER) { + if (_modifiers & SPICE_SCROLL_LOCK_MODIFIER) { modifiers |= Platform::SCROLL_LOCK_MODIFIER; } - if (_modifiers & RED_NUM_LOCK_MODIFIER) { + if (_modifiers & SPICE_NUM_LOCK_MODIFIER) { modifiers |= Platform::NUM_LOCK_MODIFIER; } - if (_modifiers & RED_CAPS_LOCK_MODIFIER) { + if (_modifiers & SPICE_CAPS_LOCK_MODIFIER) { modifiers |= Platform::CAPS_LOCK_MODIFIER; } @@ -394,8 +394,8 @@ void InputsChannel::set_local_modifiers() void InputsChannel::on_focus_in() { #ifdef SYNC_REMOTH_MODIFIRES - Message* message = new Message(REDC_INPUTS_KEY_MODIFAIERS, sizeof(RedcKeyDown)); - RedcKeyModifiers* modifiers = (RedcKeyModifiers*)message->data(); + Message* message = new Message(SPICE_MSGC_INPUTS_KEY_MODIFIERS, sizeof(SpiceMsgcKeyDown)); + SpiceMsgcKeyModifiers* modifiers = (SpiceMsgcKeyModifiers*)message->data(); modifiers->modifiers = Platform::get_keyboard_lock_modifiers(); post_message(message); #else @@ -567,7 +567,7 @@ static InitGlobals init_globals; class InputsFactory: public ChannelFactory { public: - InputsFactory() : ChannelFactory(RED_CHANNEL_INPUTS) {} + InputsFactory() : ChannelFactory(SPICE_CHANNEL_INPUTS) {} virtual RedChannel* construct(RedClient& client, uint32_t id) { return new InputsChannel(client, id); diff --git a/client/inputs_channel.h b/client/inputs_channel.h index 66aea67a..f4f7ef84 100644 --- a/client/inputs_channel.h +++ b/client/inputs_channel.h @@ -45,8 +45,8 @@ protected: virtual void on_migrate(); private: - void set_motion_event(RedcMouseMotion& motion_event); - void set_position_event(RedcMousePosition& position_event); + void set_motion_event(SpiceMsgcMouseMotion& motion_event); + void set_position_event(SpiceMsgcMousePosition& position_event); void set_local_modifiers(); void handle_init(RedPeer::InMessage* message); diff --git a/client/monitor.h b/client/monitor.h index 7a4ba3f2..46b0a4e2 100644 --- a/client/monitor.h +++ b/client/monitor.h @@ -32,8 +32,8 @@ public: void set_mode(int width, int height); void restore(); virtual int get_depth() = 0; - virtual Point get_position() = 0; - virtual Point get_size() const = 0; + virtual SpicePoint get_position() = 0; + virtual SpicePoint get_size() const = 0; virtual bool is_out_of_sync() = 0; virtual int get_screen_id() = 0; diff --git a/client/pixels_source.h b/client/pixels_source.h index 2fe09eab..e2fe0604 100644 --- a/client/pixels_source.h +++ b/client/pixels_source.h @@ -27,15 +27,15 @@ public: PixelsSource(); virtual ~PixelsSource(); - virtual Point get_size() = 0; + virtual SpicePoint get_size() = 0; void set_origin(int x, int y) { _origin.x = x; _origin.y = y;} - const Point& get_origin() { return _origin;} + const SpicePoint& get_origin() { return _origin;} protected: const uint8_t* get_opaque() const { return _opaque;} private: - Point _origin; + SpicePoint _origin; uint8_t _opaque[PIXELES_SOURCE_OPAQUE_SIZE]; friend class RedDrawable; @@ -45,14 +45,14 @@ class ImageFromRes: public PixelsSource { public: ImageFromRes(int res_id); virtual ~ImageFromRes(); - virtual Point get_size(); + virtual SpicePoint get_size(); }; class AlphaImageFromRes: public PixelsSource { public: AlphaImageFromRes(int res_id); virtual ~AlphaImageFromRes(); - virtual Point get_size(); + virtual SpicePoint get_size(); }; #endif diff --git a/client/playback_channel.cpp b/client/playback_channel.cpp index fd20b0ac..c696512a 100644 --- a/client/playback_channel.cpp +++ b/client/playback_channel.cpp @@ -137,17 +137,17 @@ static void end_wave() #endif -class PlaybackHandler: public MessageHandlerImp { +class PlaybackHandler: public MessageHandlerImp { public: PlaybackHandler(PlaybackChannel& channel) - : MessageHandlerImp(channel) {} + : MessageHandlerImp(channel) {} }; PlaybackChannel::PlaybackChannel(RedClient& client, uint32_t id) - : RedChannel(client, RED_CHANNEL_PLAYBACK, id, new PlaybackHandler(*this), + : RedChannel(client, SPICE_CHANNEL_PLAYBACK, id, new PlaybackHandler(*this), Platform::PRIORITY_HIGH) , _wave_player (NULL) - , _mode (RED_AUDIO_DATA_MODE_INVALD) + , _mode (SPICE_AUDIO_DATA_MODE_INVALD) , _celt_mode (NULL) , _celt_decoder (NULL) , _playing (false) @@ -157,19 +157,19 @@ PlaybackChannel::PlaybackChannel(RedClient& client, uint32_t id) #endif PlaybackHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_MIGRATE, &PlaybackChannel::handle_migrate, 0); - handler->set_handler(RED_SET_ACK, &PlaybackChannel::handle_set_ack, sizeof(RedSetAck)); - handler->set_handler(RED_PING, &PlaybackChannel::handle_ping, sizeof(RedPing)); - handler->set_handler(RED_WAIT_FOR_CHANNELS, &PlaybackChannel::handle_wait_for_channels, - sizeof(RedWaitForChannels)); - handler->set_handler(RED_DISCONNECTING, &PlaybackChannel::handle_disconnect, - sizeof(RedDisconnect)); - handler->set_handler(RED_NOTIFY, &PlaybackChannel::handle_notify, sizeof(RedNotify)); + handler->set_handler(SPICE_MSG_MIGRATE, &PlaybackChannel::handle_migrate, 0); + handler->set_handler(SPICE_MSG_SET_ACK, &PlaybackChannel::handle_set_ack, sizeof(SpiceMsgSetAck)); + handler->set_handler(SPICE_MSG_PING, &PlaybackChannel::handle_ping, sizeof(SpiceMsgPing)); + handler->set_handler(SPICE_MSG_WAIT_FOR_CHANNELS, &PlaybackChannel::handle_wait_for_channels, + sizeof(SpiceMsgWaitForChannels)); + handler->set_handler(SPICE_MSG_DISCONNECTING, &PlaybackChannel::handle_disconnect, + sizeof(SpiceMsgDisconnect)); + handler->set_handler(SPICE_MSG_NOTIFY, &PlaybackChannel::handle_notify, sizeof(SpiceMsgNotify)); - handler->set_handler(RED_PLAYBACK_MODE, &PlaybackChannel::handle_mode, - sizeof(RedPlaybackMode)); + handler->set_handler(SPICE_MSG_PLAYBACK_MODE, &PlaybackChannel::handle_mode, + sizeof(SpiceMsgPlaybackMode)); - set_capability(RED_PLAYBACK_CAP_CELT_0_5_1); + set_capability(SPICE_PLAYBACK_CAP_CELT_0_5_1); } PlaybackChannel::~PlaybackChannel(void) @@ -194,10 +194,10 @@ void PlaybackChannel::set_data_handler() { PlaybackHandler* handler = static_cast(get_message_handler()); - if (_mode == RED_AUDIO_DATA_MODE_RAW) { - handler->set_handler(RED_PLAYBACK_DATA, &PlaybackChannel::handle_raw_data, 0); - } else if (_mode == RED_AUDIO_DATA_MODE_CELT_0_5_1) { - handler->set_handler(RED_PLAYBACK_DATA, &PlaybackChannel::handle_celt_data, 0); + if (_mode == SPICE_AUDIO_DATA_MODE_RAW) { + handler->set_handler(SPICE_MSG_PLAYBACK_DATA, &PlaybackChannel::handle_raw_data, 0); + } else if (_mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) { + handler->set_handler(SPICE_MSG_PLAYBACK_DATA, &PlaybackChannel::handle_celt_data, 0); } else { THROW("invalid mode"); } @@ -205,9 +205,9 @@ void PlaybackChannel::set_data_handler() void PlaybackChannel::handle_mode(RedPeer::InMessage* message) { - RedPlaybackMode* playbacke_mode = (RedPlaybackMode*)message->data(); - if (playbacke_mode->mode != RED_AUDIO_DATA_MODE_RAW && - playbacke_mode->mode != RED_AUDIO_DATA_MODE_CELT_0_5_1) { + SpiceMsgPlaybackMode* playbacke_mode = (SpiceMsgPlaybackMode*)message->data(); + if (playbacke_mode->mode != SPICE_AUDIO_DATA_MODE_RAW && + playbacke_mode->mode != SPICE_AUDIO_DATA_MODE_CELT_0_5_1) { THROW("invalid mode"); } @@ -218,8 +218,8 @@ void PlaybackChannel::handle_mode(RedPeer::InMessage* message) } PlaybackHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_PLAYBACK_START, &PlaybackChannel::handle_start, - sizeof(RedPlaybackStart)); + handler->set_handler(SPICE_MSG_PLAYBACK_START, &PlaybackChannel::handle_start, + sizeof(SpiceMsgPlaybackStart)); } void PlaybackChannel::null_handler(RedPeer::InMessage* message) @@ -230,19 +230,19 @@ void PlaybackChannel::disable() { PlaybackHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_PLAYBACK_START, &PlaybackChannel::null_handler, 0); - handler->set_handler(RED_PLAYBACK_STOP, &PlaybackChannel::null_handler, 0); - handler->set_handler(RED_PLAYBACK_MODE, &PlaybackChannel::null_handler, 0); - handler->set_handler(RED_PLAYBACK_DATA, &PlaybackChannel::null_handler, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_START, &PlaybackChannel::null_handler, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_STOP, &PlaybackChannel::null_handler, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_MODE, &PlaybackChannel::null_handler, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_DATA, &PlaybackChannel::null_handler, 0); } void PlaybackChannel::handle_start(RedPeer::InMessage* message) { PlaybackHandler* handler = static_cast(get_message_handler()); - RedPlaybackStart* start = (RedPlaybackStart*)message->data(); + SpiceMsgPlaybackStart* start = (SpiceMsgPlaybackStart*)message->data(); - handler->set_handler(RED_PLAYBACK_START, NULL, 0); - handler->set_handler(RED_PLAYBACK_STOP, &PlaybackChannel::handle_stop, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_START, NULL, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_STOP, &PlaybackChannel::handle_stop, 0); #ifdef WAVE_CAPTURE start_wave(); @@ -251,7 +251,7 @@ void PlaybackChannel::handle_start(RedPeer::InMessage* message) // for now support only one setting int celt_mode_err; - if (start->format != RED_AUDIO_FMT_S16) { + if (start->format != SPICE_AUDIO_FMT_S16) { THROW("unexpected format"); } int bits_per_sample = 16; @@ -285,10 +285,10 @@ void PlaybackChannel::handle_stop(RedPeer::InMessage* message) { PlaybackHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_PLAYBACK_STOP, NULL, 0); - handler->set_handler(RED_PLAYBACK_DATA, NULL, 0); - handler->set_handler(RED_PLAYBACK_START, &PlaybackChannel::handle_start, - sizeof(RedPlaybackStart)); + handler->set_handler(SPICE_MSG_PLAYBACK_STOP, NULL, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_DATA, NULL, 0); + handler->set_handler(SPICE_MSG_PLAYBACK_START, &PlaybackChannel::handle_start, + sizeof(SpiceMsgPlaybackStart)); #ifdef WAVE_CAPTURE end_wave(); @@ -299,7 +299,7 @@ void PlaybackChannel::handle_stop(RedPeer::InMessage* message) void PlaybackChannel::handle_raw_data(RedPeer::InMessage* message) { - RedPlaybackPacket* packet = (RedPlaybackPacket*)message->data(); + SpiceMsgPlaybackPacket* packet = (SpiceMsgPlaybackPacket*)message->data(); uint8_t* data = (uint8_t*)(packet + 1); uint32_t size = message->size() - sizeof(*packet); #ifdef WAVE_CAPTURE @@ -319,7 +319,7 @@ void PlaybackChannel::handle_raw_data(RedPeer::InMessage* message) void PlaybackChannel::handle_celt_data(RedPeer::InMessage* message) { - RedPlaybackPacket* packet = (RedPlaybackPacket*)message->data(); + SpiceMsgPlaybackPacket* packet = (SpiceMsgPlaybackPacket*)message->data(); uint8_t* data = (uint8_t*)(packet + 1); uint32_t size = message->size() - sizeof(*packet); celt_int16_t pcm[256 * 2]; @@ -339,7 +339,7 @@ void PlaybackChannel::handle_celt_data(RedPeer::InMessage* message) class PlaybackFactory: public ChannelFactory { public: - PlaybackFactory() : ChannelFactory(RED_CHANNEL_PLAYBACK) {} + PlaybackFactory() : ChannelFactory(SPICE_CHANNEL_PLAYBACK) {} virtual RedChannel* construct(RedClient& client, uint32_t id) { return new PlaybackChannel(client, id); diff --git a/client/record_channel.cpp b/client/record_channel.cpp index d905ff6e..ccf512c4 100644 --- a/client/record_channel.cpp +++ b/client/record_channel.cpp @@ -43,7 +43,7 @@ private: RecordSamplesMessage::RecordSamplesMessage(RecordChannel& channel) : _channel (channel) - , _massage (new Message(REDC_RECORD_DATA, sizeof(RedcRecordPacket) + 4096)) + , _massage (new Message(SPICE_MSGC_RECORD_DATA, sizeof(SpiceMsgcRecordPacket) + 4096)) { } @@ -57,18 +57,18 @@ void RecordSamplesMessage::release() _channel.release_message(this); } -int RecordChannel::data_mode = RED_AUDIO_DATA_MODE_CELT_0_5_1; +int RecordChannel::data_mode = SPICE_AUDIO_DATA_MODE_CELT_0_5_1; -class RecordHandler: public MessageHandlerImp { +class RecordHandler: public MessageHandlerImp { public: RecordHandler(RecordChannel& channel) - : MessageHandlerImp(channel) {} + : MessageHandlerImp(channel) {} }; RecordChannel::RecordChannel(RedClient& client, uint32_t id) - : RedChannel(client, RED_CHANNEL_RECORD, id, new RecordHandler(*this)) + : RedChannel(client, SPICE_CHANNEL_RECORD, id, new RecordHandler(*this)) , _wave_recorder (NULL) - , _mode (RED_AUDIO_DATA_MODE_INVALD) + , _mode (SPICE_AUDIO_DATA_MODE_INVALD) , _celt_mode (NULL) , _celt_encoder (NULL) { @@ -78,18 +78,18 @@ RecordChannel::RecordChannel(RedClient& client, uint32_t id) RecordHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_MIGRATE, &RecordChannel::handle_migrate, 0); - handler->set_handler(RED_SET_ACK, &RecordChannel::handle_set_ack, sizeof(RedSetAck)); - handler->set_handler(RED_PING, &RecordChannel::handle_ping, sizeof(RedPing)); - handler->set_handler(RED_WAIT_FOR_CHANNELS, &RecordChannel::handle_wait_for_channels, - sizeof(RedWaitForChannels)); - handler->set_handler(RED_DISCONNECTING, &RecordChannel::handle_disconnect, - sizeof(RedDisconnect)); - handler->set_handler(RED_NOTIFY, &RecordChannel::handle_notify, sizeof(RedNotify)); + handler->set_handler(SPICE_MSG_MIGRATE, &RecordChannel::handle_migrate, 0); + handler->set_handler(SPICE_MSG_SET_ACK, &RecordChannel::handle_set_ack, sizeof(SpiceMsgSetAck)); + handler->set_handler(SPICE_MSG_PING, &RecordChannel::handle_ping, sizeof(SpiceMsgPing)); + handler->set_handler(SPICE_MSG_WAIT_FOR_CHANNELS, &RecordChannel::handle_wait_for_channels, + sizeof(SpiceMsgWaitForChannels)); + handler->set_handler(SPICE_MSG_DISCONNECTING, &RecordChannel::handle_disconnect, + sizeof(SpiceMsgDisconnect)); + handler->set_handler(SPICE_MSG_NOTIFY, &RecordChannel::handle_notify, sizeof(SpiceMsgNotify)); - handler->set_handler(RED_RECORD_START, &RecordChannel::handle_start, sizeof(RedRecordStart)); + handler->set_handler(SPICE_MSG_RECORD_START, &RecordChannel::handle_start, sizeof(SpiceMsgRecordStart)); - set_capability(RED_RECORD_CAP_CELT_0_5_1); + set_capability(SPICE_RECORD_CAP_CELT_0_5_1); } RecordChannel::~RecordChannel(void) @@ -117,18 +117,18 @@ bool RecordChannel::abort(void) void RecordChannel::on_connect() { - Message* message = new Message(REDC_RECORD_MODE, sizeof(RedcRecordMode)); - RedcRecordMode *mode = (RedcRecordMode *)message->data(); + Message* message = new Message(SPICE_MSGC_RECORD_MODE, sizeof(SpiceMsgcRecordMode)); + SpiceMsgcRecordMode *mode = (SpiceMsgcRecordMode *)message->data(); mode->time = get_mm_time(); - mode->mode = _mode = test_capability(RED_RECORD_CAP_CELT_0_5_1) ? RecordChannel::data_mode : - RED_AUDIO_DATA_MODE_RAW; + mode->mode = _mode = test_capability(SPICE_RECORD_CAP_CELT_0_5_1) ? RecordChannel::data_mode : + SPICE_AUDIO_DATA_MODE_RAW; post_message(message); } void RecordChannel::send_start_mark() { - Message* message = new Message(REDC_RECORD_START_MARK, sizeof(RedcRecordStartMark)); - RedcRecordStartMark *start_mark = (RedcRecordStartMark *)message->data(); + Message* message = new Message(SPICE_MSGC_RECORD_START_MARK, sizeof(SpiceMsgcRecordStartMark)); + SpiceMsgcRecordStartMark *start_mark = (SpiceMsgcRecordStartMark *)message->data(); start_mark->time = get_mm_time(); post_message(message); } @@ -136,14 +136,14 @@ void RecordChannel::send_start_mark() void RecordChannel::handle_start(RedPeer::InMessage* message) { RecordHandler* handler = static_cast(get_message_handler()); - RedRecordStart* start = (RedRecordStart*)message->data(); + SpiceMsgRecordStart* start = (SpiceMsgRecordStart*)message->data(); - handler->set_handler(RED_RECORD_START, NULL, 0); - handler->set_handler(RED_RECORD_STOP, &RecordChannel::handle_stop, 0); + handler->set_handler(SPICE_MSG_RECORD_START, NULL, 0); + handler->set_handler(SPICE_MSG_RECORD_STOP, &RecordChannel::handle_stop, 0); ASSERT(!_wave_recorder && !_celt_mode && !_celt_encoder); // for now support only one setting - if (start->format != RED_AUDIO_FMT_S16) { + if (start->format != SPICE_AUDIO_FMT_S16) { THROW("unexpected format"); } @@ -176,8 +176,8 @@ void RecordChannel::handle_start(RedPeer::InMessage* message) void RecordChannel::handle_stop(RedPeer::InMessage* message) { RecordHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_RECORD_START, &RecordChannel::handle_start, sizeof(RedRecordStart)); - handler->set_handler(RED_RECORD_STOP, NULL, 0); + handler->set_handler(SPICE_MSG_RECORD_START, &RecordChannel::handle_start, sizeof(SpiceMsgRecordStart)); + handler->set_handler(SPICE_MSG_RECORD_STOP, NULL, 0); if (!_wave_recorder) { return; } @@ -244,7 +244,7 @@ void RecordChannel::push_frame(uint8_t *frame) uint8_t celt_buf[CELT_COMPRESSED_FRAME_BYTES]; int n; - if (_mode == RED_AUDIO_DATA_MODE_CELT_0_5_1) { + if (_mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) { n = celt051_encode(_celt_encoder, (celt_int16_t *)frame, NULL, celt_buf, CELT_COMPRESSED_FRAME_BYTES); if (n < 0) { @@ -255,8 +255,8 @@ void RecordChannel::push_frame(uint8_t *frame) n = _frame_bytes; } RedPeer::OutMessage& peer_message = message->peer_message(); - peer_message.resize(n + sizeof(RedcRecordPacket)); - RedcRecordPacket* packet = (RedcRecordPacket*)peer_message.data(); + peer_message.resize(n + sizeof(SpiceMsgcRecordPacket)); + SpiceMsgcRecordPacket* packet = (SpiceMsgcRecordPacket*)peer_message.data(); packet->time = get_mm_time(); memcpy(packet->data, frame, n); post_message(message); @@ -264,7 +264,7 @@ void RecordChannel::push_frame(uint8_t *frame) class RecordFactory: public ChannelFactory { public: - RecordFactory() : ChannelFactory(RED_CHANNEL_RECORD) {} + RecordFactory() : ChannelFactory(SPICE_CHANNEL_RECORD) {} virtual RedChannel* construct(RedClient& client, uint32_t id) { return new RecordChannel(client, id); diff --git a/client/red_cairo_canvas.cpp b/client/red_cairo_canvas.cpp index d565e493..08880ea9 100644 --- a/client/red_cairo_canvas.cpp +++ b/client/red_cairo_canvas.cpp @@ -69,7 +69,7 @@ void CCanvas::create_pixmap(int width, int height, RedWindow *win) void CCanvas::copy_pixels(const QRegion& region, RedDrawable& dest_dc) { for (int i = 0; i < (int)region.num_rects; i++) { - Rect* r = ®ion.rects[i]; + SpiceRect* r = ®ion.rects[i]; dest_dc.copy_pixels(*_pixmap, r->left, r->top, *r); } } @@ -113,80 +113,80 @@ void CCanvas::set_access_params(unsigned long base, unsigned long max) canvas_set_access_params(_canvas, base, max); } -void CCanvas::draw_fill(Rect *bbox, Clip *clip, Fill *fill) +void CCanvas::draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) { canvas_draw_fill(_canvas, bbox, clip, fill); } -void CCanvas::draw_text(Rect *bbox, Clip *clip, Text *text) +void CCanvas::draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text) { canvas_draw_text(_canvas, bbox, clip, text); } -void CCanvas::draw_opaque(Rect *bbox, Clip *clip, Opaque *opaque) +void CCanvas::draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) { canvas_draw_opaque(_canvas, bbox, clip, opaque); } -void CCanvas::draw_copy(Rect *bbox, Clip *clip, Copy *copy) +void CCanvas::draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) { canvas_draw_copy(_canvas, bbox, clip, copy); } -void CCanvas::draw_transparent(Rect *bbox, Clip *clip, Transparent* transparent) +void CCanvas::draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent) { canvas_draw_transparent(_canvas, bbox, clip, transparent); } -void CCanvas::draw_alpha_blend(Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend) +void CCanvas::draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend) { canvas_draw_alpha_blend(_canvas, bbox, clip, alpha_blend); } -void CCanvas::copy_bits(Rect *bbox, Clip *clip, Point *src_pos) +void CCanvas::copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) { canvas_copy_bits(_canvas, bbox, clip, src_pos); } -void CCanvas::draw_blend(Rect *bbox, Clip *clip, Blend *blend) +void CCanvas::draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) { canvas_draw_blend(_canvas, bbox, clip, blend); } -void CCanvas::draw_blackness(Rect *bbox, Clip *clip, Blackness *blackness) +void CCanvas::draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) { canvas_draw_blackness(_canvas, bbox, clip, blackness); } -void CCanvas::draw_whiteness(Rect *bbox, Clip *clip, Whiteness *whiteness) +void CCanvas::draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) { canvas_draw_whiteness(_canvas, bbox, clip, whiteness); } -void CCanvas::draw_invers(Rect *bbox, Clip *clip, Invers *invers) +void CCanvas::draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) { canvas_draw_invers(_canvas, bbox, clip, invers); } -void CCanvas::draw_rop3(Rect *bbox, Clip *clip, Rop3 *rop3) +void CCanvas::draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) { canvas_draw_rop3(_canvas, bbox, clip, rop3); } -void CCanvas::draw_stroke(Rect *bbox, Clip *clip, Stroke *stroke) +void CCanvas::draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) { canvas_draw_stroke(_canvas, bbox, clip, stroke); } #ifdef WIN32 -void CCanvas::put_image(HDC dc, const PixmapHeader& image, const Rect& dest, const QRegion* clip) +void CCanvas::put_image(HDC dc, const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip) { canvas_put_image(_canvas, dc, &dest, image.data, image.width, image.height, image.stride, clip); } #else -void CCanvas::put_image(const PixmapHeader& image, const Rect& dest, const QRegion* clip) +void CCanvas::put_image(const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip) { canvas_put_image(_canvas, &dest, image.data, image.width, image.height, image.stride, clip); diff --git a/client/red_cairo_canvas.h b/client/red_cairo_canvas.h index 43ee78a5..2bcb3a89 100644 --- a/client/red_cairo_canvas.h +++ b/client/red_cairo_canvas.h @@ -37,9 +37,9 @@ public: virtual void copy_pixels(const QRegion& region, RedDrawable& dc); #ifdef WIN32 virtual void put_image(HDC dc, const PixmapHeader& image, - const Rect& dest, const QRegion* clip); + const SpiceRect& dest, const QRegion* clip); #else - virtual void put_image(const PixmapHeader& image, const Rect& dest, + virtual void put_image(const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip); #endif @@ -47,19 +47,19 @@ public: protected: virtual void set_access_params(unsigned long base, unsigned long max); - virtual void draw_fill(Rect *bbox, Clip *clip, Fill *fill); - virtual void draw_copy(Rect *bbox, Clip *clip, Copy *copy); - virtual void draw_opaque(Rect *bbox, Clip *clip, Opaque *opaque); - virtual void copy_bits(Rect *bbox, Clip *clip, Point *src_pos); - virtual void draw_text(Rect *bbox, Clip *clip, Text *text); - virtual void draw_stroke(Rect *bbox, Clip *clip, Stroke *stroke); - virtual void draw_rop3(Rect *bbox, Clip *clip, Rop3 *rop3); - virtual void draw_blend(Rect *bbox, Clip *clip, Blend *blend); - virtual void draw_blackness(Rect *bbox, Clip *clip, Blackness *blackness); - virtual void draw_whiteness(Rect *bbox, Clip *clip, Whiteness *whiteness); - virtual void draw_invers(Rect *bbox, Clip *clip, Invers *invers); - virtual void draw_transparent(Rect *bbox, Clip *clip, Transparent* transparent); - virtual void draw_alpha_blend(Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend); + virtual void draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill); + virtual void draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy); + virtual void draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque); + virtual void copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos); + virtual void draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text); + virtual void draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke); + virtual void draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3); + virtual void draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend); + virtual void draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness); + virtual void draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness); + virtual void draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers); + virtual void draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent); + virtual void draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend); private: void create_pixmap(int width, int height, RedWindow *win); diff --git a/client/red_channel.cpp b/client/red_channel.cpp index 25e4e04d..e360d5f4 100644 --- a/client/red_channel.cpp +++ b/client/red_channel.cpp @@ -43,9 +43,9 @@ RedChannelBase::~RedChannelBase() void RedChannelBase::link(uint32_t connection_id, const std::string& password) { - RedLinkHeader header; - RedLinkMess link_mess; - RedLinkReply* reply; + SpiceLinkHeader header; + SpiceLinkMess link_mess; + SpiceLinkReply* reply; uint32_t link_res; uint32_t i; @@ -54,10 +54,10 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password) BIO *bioKey; RSA *rsa; - header.magic = RED_MAGIC; + header.magic = SPICE_MAGIC; header.size = sizeof(link_mess); - header.major_version = RED_VERSION_MAJOR; - header.minor_version = RED_VERSION_MINOR; + header.major_version = SPICE_VERSION_MAJOR; + header.minor_version = SPICE_VERSION_MINOR; link_mess.connection_id = connection_id; link_mess.channel_type = _type; link_mess.channel_id = _id; @@ -78,14 +78,14 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password) recive((uint8_t*)&header, sizeof(header)); - if (header.magic != RED_MAGIC) { + if (header.magic != SPICE_MAGIC) { THROW_ERR(SPICEC_ERROR_CODE_CONNECT_FAILED, "bad magic"); } - if (header.major_version != RED_VERSION_MAJOR) { + if (header.major_version != SPICE_VERSION_MAJOR) { THROW_ERR(SPICEC_ERROR_CODE_VERSION_MISMATCH, "version mismatch: expect %u got %u", - RED_VERSION_MAJOR, + SPICE_VERSION_MAJOR, header.major_version); } @@ -94,9 +94,9 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password) AutoArray reply_buf(new uint8_t[header.size]); recive(reply_buf.get(), header.size); - reply = (RedLinkReply *)reply_buf.get(); + reply = (SpiceLinkReply *)reply_buf.get(); - if (reply->error != RED_ERR_OK) { + if (reply->error != SPICE_LINK_ERR_OK) { THROW_ERR(SPICEC_ERROR_CODE_CONNECT_FAILED, "connect error %u", reply->error); } @@ -123,7 +123,7 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password) bioKey = BIO_new(BIO_s_mem()); if (bioKey != NULL) { - BIO_write(bioKey, reply->pub_key, RED_TICKET_PUBKEY_BYTES); + BIO_write(bioKey, reply->pub_key, SPICE_TICKET_PUBKEY_BYTES); pubkey = d2i_PUBKEY_bio(bioKey, NULL); rsa = pubkey->pkey.rsa; nRSASize = RSA_size(rsa); @@ -149,8 +149,8 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password) BIO_free(bioKey); recive((uint8_t*)&link_res, sizeof(link_res)); - if (link_res != RED_ERR_OK) { - int error_code = (link_res == RED_ERR_PERMISSION_DENIED) ? + if (link_res != SPICE_LINK_ERR_OK) { + int error_code = (link_res == SPICE_LINK_ERR_PERMISSION_DENIED) ? SPICEC_ERROR_CODE_CONNECT_FAILED : SPICEC_ERROR_CODE_CONNECT_FAILED; THROW_ERR(error_code, "connect failed %u", link_res); } @@ -253,7 +253,7 @@ RedChannel::RedChannel(RedClient& client, uint8_t type, uint8_t id, , _loop (this) , _send_trigger (*this) , _disconnect_stamp (0) - , _disconnect_reason (RED_ERR_OK) + , _disconnect_reason (SPICE_LINK_ERR_OK) { _loop.add_trigger(_send_trigger); _loop.add_trigger(_abort_trigger); @@ -506,7 +506,7 @@ void RedChannel::on_send_trigger() void RedChannel::on_message_recived() { if (_message_ack_count && !--_message_ack_count) { - post_message(new Message(REDC_ACK, 0)); + post_message(new Message(SPICE_MSGC_ACK, 0)); _message_ack_count = _message_ack_window; } } @@ -521,8 +521,8 @@ void RedChannel::on_message_complition(uint64_t serial) void RedChannel::recive_messages() { for (;;) { - uint32_t n = RedPeer::recive((uint8_t*)&_incomming_header, sizeof(RedDataHeader)); - if (n != sizeof(RedDataHeader)) { + uint32_t n = RedPeer::recive((uint8_t*)&_incomming_header, sizeof(SpiceDataHeader)); + if (n != sizeof(SpiceDataHeader)) { _incomming_header_pos = n; return; } @@ -558,8 +558,8 @@ void RedChannel::on_event() if (_incomming_header_pos) { _incomming_header_pos += RedPeer::recive(((uint8_t*)&_incomming_header) + _incomming_header_pos, - sizeof(RedDataHeader) - _incomming_header_pos); - if (_incomming_header_pos != sizeof(RedDataHeader)) { + sizeof(SpiceDataHeader) - _incomming_header_pos); + if (_incomming_header_pos != sizeof(SpiceDataHeader)) { return; } _incomming_header_pos = 0; @@ -604,7 +604,7 @@ void RedChannel::send_migrate_flush_mark() send(message.get()->peer_message()); } lock.unlock(); - std::auto_ptr message(new RedPeer::OutMessage(REDC_MIGRATE_FLUSH_MARK, 0)); + std::auto_ptr message(new RedPeer::OutMessage(SPICE_MSGC_MIGRATE_FLUSH_MARK, 0)); send(*message); } @@ -613,20 +613,20 @@ void RedChannel::handle_migrate(RedPeer::InMessage* message) DBG(0, "channel type %u id %u", get_type(), get_id()); _socket_in_loop = false; _loop.remove_socket(*this); - RedMigrate* migrate = (RedMigrate*)message->data(); - if (migrate->flags & RED_MIGRATE_NEED_FLUSH) { + SpiceMsgMigrate* migrate = (SpiceMsgMigrate*)message->data(); + if (migrate->flags & SPICE_MIGRATE_NEED_FLUSH) { send_migrate_flush_mark(); } AutoRef data_message; - if (migrate->flags & RED_MIGRATE_NEED_DATA_TRANSFER) { + if (migrate->flags & SPICE_MIGRATE_NEED_DATA_TRANSFER) { data_message.reset(recive()); } _client.migrate_channel(*this); - if (migrate->flags & RED_MIGRATE_NEED_DATA_TRANSFER) { - if ((*data_message)->type() != RED_MIGRATE_DATA) { - THROW("expect RED_MIGRATE_DATA"); + if (migrate->flags & SPICE_MIGRATE_NEED_DATA_TRANSFER) { + if ((*data_message)->type() != SPICE_MSG_MIGRATE_DATA) { + THROW("expect SPICE_MSG_MIGRATE_DATA"); } - std::auto_ptr message(new RedPeer::OutMessage(REDC_MIGRATE_DATA, + std::auto_ptr message(new RedPeer::OutMessage(SPICE_MSGC_MIGRATE_DATA, (*data_message)->size())); memcpy(message->data(), (*data_message)->data(), (*data_message)->size()); send(*message); @@ -640,31 +640,31 @@ void RedChannel::handle_migrate(RedPeer::InMessage* message) void RedChannel::handle_set_ack(RedPeer::InMessage* message) { - RedSetAck* ack = (RedSetAck*)message->data(); + SpiceMsgSetAck* ack = (SpiceMsgSetAck*)message->data(); _message_ack_window = _message_ack_count = ack->window; - Message *responce = new Message(REDC_ACK_SYNC, sizeof(uint32_t)); + Message *responce = new Message(SPICE_MSGC_ACK_SYNC, sizeof(uint32_t)); *(uint32_t *)responce->data() = ack->generation; post_message(responce); } void RedChannel::handle_ping(RedPeer::InMessage* message) { - RedPing *ping = (RedPing *)message->data(); - Message *pong = new Message(REDC_PONG, sizeof(RedPing)); - *(RedPing *)pong->data() = *ping; + SpiceMsgPing *ping = (SpiceMsgPing *)message->data(); + Message *pong = new Message(SPICE_MSGC_PONG, sizeof(SpiceMsgPing)); + *(SpiceMsgPing *)pong->data() = *ping; post_message(pong); } void RedChannel::handle_disconnect(RedPeer::InMessage* message) { - RedDisconnect *disconnect = (RedDisconnect *)message->data(); + SpiceMsgDisconnect *disconnect = (SpiceMsgDisconnect *)message->data(); _disconnect_stamp = disconnect->time_stamp; _disconnect_reason = disconnect->reason; } void RedChannel::handle_notify(RedPeer::InMessage* message) { - RedNotify *notify = (RedNotify *)message->data(); + SpiceMsgNotify *notify = (SpiceMsgNotify *)message->data(); const char *sevirity; const char *visibility; const char *message_str = ""; @@ -674,12 +674,12 @@ void RedChannel::handle_notify(RedPeer::InMessage* message) static const char* visibility_strings[] = {"!", "!!", "!!!"}; - if (notify->severty > RED_NOTIFY_SEVERITY_ERROR) { + if (notify->severty > SPICE_NOTIFY_SEVERITY_ERROR) { THROW("bad sevirity"); } sevirity = sevirity_strings[notify->severty]; - if (notify->visibilty > RED_NOTIFY_VISIBILITY_HIGH) { + if (notify->visibilty > SPICE_NOTIFY_VISIBILITY_HIGH) { THROW("bad visibilty"); } visibility = visibility_strings[notify->visibilty]; @@ -706,7 +706,7 @@ void RedChannel::handle_notify(RedPeer::InMessage* message) void RedChannel::handle_wait_for_channels(RedPeer::InMessage* message) { - RedWaitForChannels *wait = (RedWaitForChannels *)message->data(); + SpiceMsgWaitForChannels *wait = (SpiceMsgWaitForChannels *)message->data(); if (message->size() < sizeof(*wait) + wait->wait_count * sizeof(wait->wait_list[0])) { THROW("access violation"); } diff --git a/client/red_channel.h b/client/red_channel.h index 996aaf66..c20eac36 100644 --- a/client/red_channel.h +++ b/client/red_channel.h @@ -181,7 +181,7 @@ private: RedChannel::OutMessage* _outgoing_message; uint32_t _outgoing_pos; - RedDataHeader _incomming_header; + SpiceDataHeader _incomming_header; uint32_t _incomming_header_pos; RedPeer::CompundInMessage* _incomming_message; uint32_t _incomming_message_pos; @@ -270,10 +270,10 @@ void MessageHandlerImp::handle_message(RedPeer::Compu _handlers[message.type()].mess_size); } if (message.sub_list()) { - RedSubMessageList *sub_list; - sub_list = (RedSubMessageList *)(message.data() + message.sub_list()); + SpiceSubMessageList *sub_list; + sub_list = (SpiceSubMessageList *)(message.data() + message.sub_list()); for (int i = 0; i < sub_list->size; i++) { - RedSubMessage *sub = (RedSubMessage *)(message.data() + sub_list->sub_messages[i]); + SpicedSubMessage *sub = (SpicedSubMessage *)(message.data() + sub_list->sub_messages[i]); //todo: test size RedPeer::InMessage sub_message(sub->type, sub->size, (uint8_t *)(sub + 1)); (_obj.*_handlers[sub_message.type()].handler)(&sub_message); diff --git a/client/red_client.cpp b/client/red_client.cpp index 57ec3502..40c77677 100644 --- a/client/red_client.cpp +++ b/client/red_client.cpp @@ -49,7 +49,7 @@ public: virtual bool operator() (RedChannel& channel) { - if (channel.get_type() == RED_CHANNEL_DISPLAY) { + if (channel.get_type() == SPICE_CHANNEL_DISPLAY) { static_cast(channel).set_capture_mode(_capture_mode); } return true; @@ -61,7 +61,7 @@ public: virtual void response(AbstractProcessLoop& events_loop) { - bool capture_mode = _client.get_mouse_mode() == RED_MOUSE_MODE_SERVER; + bool capture_mode = _client.get_mouse_mode() == SPICE_MOUSE_MODE_SERVER; if (!capture_mode) { _client.get_application().release_mouse_capture(); } @@ -169,7 +169,7 @@ void Migrate::run() DBG(0, ""); try { - conn_type = _client.get_connection_options(RED_CHANNEL_MAIN); + conn_type = _client.get_connection_options(SPICE_CHANNEL_MAIN); RedPeer::ConnectionOptions con_opt(conn_type, _port, _sport, _auth_options); MigChannels::iterator iter = _channels.begin(); connection_id = _client.get_connection_id(); @@ -189,10 +189,10 @@ void Migrate::run() Lock lock(_lock); _cond.notify_one(); if (_connected) { - Message* message = new Message(REDC_MIGRATE_CONNECTED, 0); + Message* message = new Message(SPICE_MSGC_MAIN_MIGRATE_CONNECTED, 0); _client.post_message(message); } else { - Message* message = new Message(REDC_MIGRATE_CONNECT_ERROR, 0); + Message* message = new Message(SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR, 0); _client.post_message(message); } _running = false; @@ -205,13 +205,13 @@ void* Migrate::worker_main(void *data) return NULL; } -void Migrate::start(const RedMigrationBegin* migrate) +void Migrate::start(const SpiceMsgMainMigrationBegin* migrate) { DBG(0, ""); abort(); - if ((RED_VERSION_MAJOR == 1) && (_client.get_peer_minor() < 2)) { + if ((SPICE_VERSION_MAJOR == 1) && (_client.get_peer_minor() < 2)) { LOG_INFO("server minor version incompatible for destination authentication" - "(missing dest pubkey in RedMigrationBegin)"); + "(missing dest pubkey in SpiceMsgMainMigrationBegin)"); OldRedMigrationBegin* old_migrate = (OldRedMigrationBegin*)migrate; _host.assign(old_migrate->host); _port = old_migrate->port ? old_migrate->port : -1; @@ -291,18 +291,18 @@ void AgentTimer::response(AbstractProcessLoop& events_loop) THROW_ERR(SPICEC_ERROR_CODE_AGENT_TIMEOUT, "vdagent timeout"); } -class MainChannelLoop: public MessageHandlerImp { +class MainChannelLoop: public MessageHandlerImp { public: - MainChannelLoop(RedClient& client): MessageHandlerImp(client) {} + MainChannelLoop(RedClient& client): MessageHandlerImp(client) {} }; RedClient::RedClient(Application& application) - : RedChannel(*this, RED_CHANNEL_MAIN, 0, new MainChannelLoop(*this)) + : RedChannel(*this, SPICE_CHANNEL_MAIN, 0, new MainChannelLoop(*this)) , _application (application) , _port (-1) , _sport (-1) , _connection_id (0) - , _mouse_mode (RED_MOUSE_MODE_SERVER) + , _mouse_mode (SPICE_MOUSE_MODE_SERVER) , _notify_disconnect (false) , _auto_display_res (false) , _aborting (false) @@ -318,32 +318,32 @@ RedClient::RedClient(Application& application) { MainChannelLoop* message_loop = static_cast(get_message_handler()); - message_loop->set_handler(RED_MIGRATE, &RedClient::handle_migrate, 0); - message_loop->set_handler(RED_SET_ACK, &RedClient::handle_set_ack, sizeof(RedSetAck)); - message_loop->set_handler(RED_PING, &RedClient::handle_ping, sizeof(RedPing)); - message_loop->set_handler(RED_WAIT_FOR_CHANNELS, &RedClient::handle_wait_for_channels, - sizeof(RedWaitForChannels)); - message_loop->set_handler(RED_DISCONNECTING, &RedClient::handle_disconnect, - sizeof(RedDisconnect)); - message_loop->set_handler(RED_NOTIFY, &RedClient::handle_notify, sizeof(RedNotify)); - - message_loop->set_handler(RED_MIGRATE_BEGIN, &RedClient::handle_migrate_begin, - sizeof(RedMigrationBegin)); - message_loop->set_handler(RED_MIGRATE_CANCEL, &RedClient::handle_migrate_cancel, 0); - message_loop->set_handler(RED_INIT, &RedClient::handle_init, sizeof(RedInit)); - message_loop->set_handler(RED_CHANNELS_LIST, &RedClient::handle_channels, - sizeof(RedChannels)); - message_loop->set_handler(RED_MOUSE_MODE, &RedClient::handle_mouse_mode, - sizeof(RedMouseMode)); - message_loop->set_handler(RED_MULTI_MEDIA_TIME, &RedClient::handle_mm_time, - sizeof(RedMultiMediaTime)); - - message_loop->set_handler(RED_AGENT_CONNECTED, &RedClient::handle_agent_connected, 0); - message_loop->set_handler(RED_AGENT_DISCONNECTED, &RedClient::handle_agent_disconnected, - sizeof(RedAgentDisconnect)); - message_loop->set_handler(RED_AGENT_DATA, &RedClient::handle_agent_data, 0); - message_loop->set_handler(RED_AGENT_TOKEN, &RedClient::handle_agent_tokens, - sizeof(RedAgentTokens)); + message_loop->set_handler(SPICE_MSG_MIGRATE, &RedClient::handle_migrate, 0); + message_loop->set_handler(SPICE_MSG_SET_ACK, &RedClient::handle_set_ack, sizeof(SpiceMsgSetAck)); + message_loop->set_handler(SPICE_MSG_PING, &RedClient::handle_ping, sizeof(SpiceMsgPing)); + message_loop->set_handler(SPICE_MSG_WAIT_FOR_CHANNELS, &RedClient::handle_wait_for_channels, + sizeof(SpiceMsgWaitForChannels)); + message_loop->set_handler(SPICE_MSG_DISCONNECTING, &RedClient::handle_disconnect, + sizeof(SpiceMsgDisconnect)); + message_loop->set_handler(SPICE_MSG_NOTIFY, &RedClient::handle_notify, sizeof(SpiceMsgNotify)); + + message_loop->set_handler(SPICE_MSG_MAIN_MIGRATE_BEGIN, &RedClient::handle_migrate_begin, + sizeof(SpiceMsgMainMigrationBegin)); + message_loop->set_handler(SPICE_MSG_MAIN_MIGRATE_CANCEL, &RedClient::handle_migrate_cancel, 0); + message_loop->set_handler(SPICE_MSG_MAIN_INIT, &RedClient::handle_init, sizeof(SpiceMsgMainInit)); + message_loop->set_handler(SPICE_MSG_MAIN_CHANNELS_LIST, &RedClient::handle_channels, + sizeof(SpiceMsgChannels)); + message_loop->set_handler(SPICE_MSG_MAIN_MOUSE_MODE, &RedClient::handle_mouse_mode, + sizeof(SpiceMsgMainMouseMode)); + message_loop->set_handler(SPICE_MSG_MAIN_MULTI_MEDIA_TIME, &RedClient::handle_mm_time, + sizeof(SpiceMsgMainMultiMediaTime)); + + message_loop->set_handler(SPICE_MSG_MAIN_AGENT_CONNECTED, &RedClient::handle_agent_connected, 0); + message_loop->set_handler(SPICE_MSG_MAIN_AGENT_DISCONNECTED, &RedClient::handle_agent_disconnected, + sizeof(SpiceMsgMainAgentDisconnect)); + message_loop->set_handler(SPICE_MSG_MAIN_AGENT_DATA, &RedClient::handle_agent_data, 0); + message_loop->set_handler(SPICE_MSG_MAIN_AGENT_TOKEN, &RedClient::handle_agent_tokens, + sizeof(SpiceMsgMainAgentTokens)); start(); } @@ -385,7 +385,7 @@ void RedClient::on_connect() { AutoRef event(new ConnectedEvent()); push_event(*event); - _migrate.add_channel(new MigChannel(RED_CHANNEL_MAIN, 0, get_common_caps(), + _migrate.add_channel(new MigChannel(SPICE_CHANNEL_MAIN, 0, get_common_caps(), get_caps())); } @@ -525,7 +525,7 @@ bool RedClient::abort() void RedClient::handle_migrate_begin(RedPeer::InMessage* message) { DBG(0, ""); - RedMigrationBegin* migrate = (RedMigrationBegin*)message->data(); + SpiceMsgMainMigrationBegin* migrate = (SpiceMsgMainMigrationBegin*)message->data(); //add mig channels _migrate.start(migrate); } @@ -588,7 +588,7 @@ void RedClient::send_agent_monitors_config() } } - Message* message = new Message(REDC_AGENT_DATA,sizeof(VDAgentMessage) + + Message* message = new Message(SPICE_MSGC_MAIN_AGENT_DATA,sizeof(VDAgentMessage) + sizeof(VDAgentMonitorsConfig) + monitors.size() * sizeof(VDAgentMonConfig)); VDAgentMessage* msg = (VDAgentMessage*)message->data(); @@ -668,7 +668,7 @@ void RedClient::on_display_mode_change() Lock lock(_channels_lock); Channels::iterator iter = _channels.begin(); for (; iter != _channels.end(); ++iter) { - if ((*iter)->get_type() == RED_CHANNEL_DISPLAY) { + if ((*iter)->get_type() == SPICE_CHANNEL_DISPLAY) { ((DisplayChannel *)(*iter))->recreate_ogl_context(); } } @@ -682,7 +682,7 @@ void RedClient::set_mouse_mode(uint32_t supported_modes, uint32_t current_mode) Lock lock(_channels_lock); Channels::iterator iter = _channels.begin(); for (; iter != _channels.end(); ++iter) { - if ((*iter)->get_type() == RED_CHANNEL_CURSOR) { + if ((*iter)->get_type() == SPICE_CHANNEL_CURSOR) { ((CursorChannel *)(*iter))->on_mouse_mode_change(); } } @@ -690,17 +690,17 @@ void RedClient::set_mouse_mode(uint32_t supported_modes, uint32_t current_mode) push_event(*event); } // FIXME: use configured mouse mode (currently, use client mouse mode if supported by server) - if ((supported_modes & RED_MOUSE_MODE_CLIENT) && (current_mode != RED_MOUSE_MODE_CLIENT)) { - Message* message = new Message(REDC_MOUSE_MODE_REQUEST, sizeof(RedcMouseModeRequest)); - RedcMouseModeRequest* mouse_mode_request = (RedcMouseModeRequest*)message->data(); - mouse_mode_request->mode = RED_MOUSE_MODE_CLIENT; + if ((supported_modes & SPICE_MOUSE_MODE_CLIENT) && (current_mode != SPICE_MOUSE_MODE_CLIENT)) { + Message* message = new Message(SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST, sizeof(SpiceMsgcMainMouseModeRequest)); + SpiceMsgcMainMouseModeRequest* mouse_mode_request = (SpiceMsgcMainMouseModeRequest*)message->data(); + mouse_mode_request->mode = SPICE_MOUSE_MODE_CLIENT; post_message(message); } } void RedClient::handle_init(RedPeer::InMessage* message) { - RedInit *init = (RedInit *)message->data(); + SpiceMsgMainInit *init = (SpiceMsgMainInit *)message->data(); _connection_id = init->session_id; set_mm_time(init->multi_media_time); calc_pixmap_cach_and_glz_window_size(init->display_channels_hint, init->ram_hint); @@ -709,8 +709,8 @@ void RedClient::handle_init(RedPeer::InMessage* message) _agent_tokens = init->agent_tokens; _agent_connected = !!init->agent_connected; if (_agent_connected) { - Message* msg = new Message(REDC_AGENT_START, sizeof(RedcAgentStart)); - RedcAgentStart* agent_start = (RedcAgentStart *)msg->data(); + Message* msg = new Message(SPICE_MSGC_MAIN_AGENT_START, sizeof(SpiceMsgcMainAgentStart)); + SpiceMsgcMainAgentStart* agent_start = (SpiceMsgcMainAgentStart *)msg->data(); agent_start->num_tokens = ~0; post_message(msg); } @@ -720,14 +720,14 @@ void RedClient::handle_init(RedPeer::InMessage* message) send_agent_monitors_config(); } } else { - post_message(new Message(REDC_ATTACH_CHANNELS, 0)); + post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS, 0)); } } void RedClient::handle_channels(RedPeer::InMessage* message) { - RedChannels *init = (RedChannels *)message->data(); - RedChannelInit* channels = init->channels; + SpiceMsgChannels *init = (SpiceMsgChannels *)message->data(); + SpiceChannelId* channels = init->channels; for (unsigned int i = 0; i < init->num_of_channels; i++) { create_channel(channels[i].type, channels[i].id); } @@ -735,13 +735,13 @@ void RedClient::handle_channels(RedPeer::InMessage* message) void RedClient::handle_mouse_mode(RedPeer::InMessage* message) { - RedMouseMode *mouse_mode = (RedMouseMode *)message->data(); + SpiceMsgMainMouseMode *mouse_mode = (SpiceMsgMainMouseMode *)message->data(); set_mouse_mode(mouse_mode->supported_modes, mouse_mode->current_mode); } void RedClient::handle_mm_time(RedPeer::InMessage* message) { - RedMultiMediaTime *mm_time = (RedMultiMediaTime *)message->data(); + SpiceMsgMainMultiMediaTime *mm_time = (SpiceMsgMainMultiMediaTime *)message->data(); set_mm_time(mm_time->time); } @@ -749,8 +749,8 @@ void RedClient::handle_agent_connected(RedPeer::InMessage* message) { DBG(0, ""); _agent_connected = true; - Message* msg = new Message(REDC_AGENT_START, sizeof(RedcAgentStart)); - RedcAgentStart* agent_start = (RedcAgentStart *)msg->data(); + Message* msg = new Message(SPICE_MSGC_MAIN_AGENT_START, sizeof(SpiceMsgcMainAgentStart)); + SpiceMsgcMainAgentStart* agent_start = (SpiceMsgcMainAgentStart *)msg->data(); agent_start->num_tokens = ~0; post_message(msg); if (_auto_display_res && !_agent_mon_config_sent) { @@ -776,7 +776,7 @@ void RedClient::on_agent_reply(VDAgentReply* reply) } switch (reply->type) { case VD_AGENT_MONITORS_CONFIG: - post_message(new Message(REDC_ATTACH_CHANNELS, 0)); + post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS, 0)); _application.deactivate_interval_timer(*_agent_timer); break; default: @@ -830,7 +830,7 @@ void RedClient::handle_agent_data(RedPeer::InMessage* message) void RedClient::handle_agent_tokens(RedPeer::InMessage* message) { - RedAgentTokens *token = (RedAgentTokens *)message->data(); + SpiceMsgMainAgentTokens *token = (SpiceMsgMainAgentTokens *)message->data(); _agent_tokens += token->num_tokens; } @@ -847,10 +847,10 @@ void RedClient::get_sync_info(uint8_t channel_type, uint8_t channel_id, SyncInfo info.message_serial = &_sync_info[channel_type][channel_id]; } -void RedClient::wait_for_channels(int wait_list_size, RedWaitForChannel* wait_list) +void RedClient::wait_for_channels(int wait_list_size, SpiceWaitForChannel* wait_list) { for (int i = 0; i < wait_list_size; i++) { - if (wait_list[i].channel_type >= RED_CHANNEL_END) { + if (wait_list[i].channel_type >= SPICE_END_CHANNEL) { THROW("invalid channel type %u", wait_list[i].channel_type); } uint64_t& sync_cell = _sync_info[wait_list[i].channel_type][wait_list[i].channel_id]; diff --git a/client/red_client.h b/client/red_client.h index 7cc700eb..037896ac 100644 --- a/client/red_client.h +++ b/client/red_client.h @@ -50,7 +50,7 @@ public: Migrate(RedClient& client); ~Migrate(); - void start(const RedMigrationBegin* migrate); + void start(const SpiceMsgMainMigrationBegin* migrate); bool abort(); void add_channel(MigChannel* channel); void clear_channels(); @@ -156,7 +156,7 @@ public: RedPeer::ConnectionOptions::Type get_connection_options(uint32_t channel_type); RedPeer::HostAuthOptions& get_host_auth_options() { return _host_auth_opt;} void get_sync_info(uint8_t channel_type, uint8_t channel_id, SyncInfo& info); - void wait_for_channels(int wait_list_size, RedWaitForChannel* wait_list); + void wait_for_channels(int wait_list_size, SpiceWaitForChannel* wait_list); PixmapCache& get_pixmap_cache() {return _pixmap_cache;} uint64_t get_pixmap_cache_size() { return _pixmap_cache_size;} void on_display_mode_change(); @@ -235,7 +235,7 @@ private: uint64_t _pixmap_cache_size; Mutex _sync_lock; Condition _sync_condition; - uint64_t _sync_info[RED_CHANNEL_END][256]; + uint64_t _sync_info[SPICE_END_CHANNEL][256]; GlzDecoderWindowDebug _glz_debug; GlzDecoderWindow _glz_window; diff --git a/client/red_drawable.h b/client/red_drawable.h index eae2e0dd..d2b03f6c 100644 --- a/client/red_drawable.h +++ b/client/red_drawable.h @@ -53,13 +53,13 @@ public: OP_XOR, }; - void copy_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& dest); - void blend_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& dest); - void combine_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& dest, + void copy_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& dest); + void blend_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& dest); + void combine_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& dest, CombineOP op); - void fill_rect(const Rect& rect, rgb32_t color); - void frame_rect(const Rect& rect, rgb32_t color); - void erase_rect(const Rect& rect, rgb32_t color); + void fill_rect(const SpiceRect& rect, rgb32_t color); + void frame_rect(const SpiceRect& rect, rgb32_t color); + void erase_rect(const SpiceRect& rect, rgb32_t color); }; #endif diff --git a/client/red_gdi_canvas.cpp b/client/red_gdi_canvas.cpp index 68acd45d..8e50a066 100644 --- a/client/red_gdi_canvas.cpp +++ b/client/red_gdi_canvas.cpp @@ -65,7 +65,7 @@ void GDICanvas::create_pixmap(int width, int height) void GDICanvas::copy_pixels(const QRegion& region, RedDrawable& dest_dc) { for (int i = 0; i < (int)region.num_rects; i++) { - Rect* r = ®ion.rects[i]; + SpiceRect* r = ®ion.rects[i]; dest_dc.copy_pixels(*_pixmap, r->left, r->top, *r); } } @@ -96,72 +96,72 @@ void GDICanvas::set_access_params(unsigned long base, unsigned long max) gdi_canvas_set_access_params(_canvas, base, max); } -void GDICanvas::draw_fill(Rect *bbox, Clip *clip, Fill *fill) +void GDICanvas::draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) { gdi_canvas_draw_fill(_canvas, bbox, clip, fill); } -void GDICanvas::draw_text(Rect *bbox, Clip *clip, Text *text) +void GDICanvas::draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text) { gdi_canvas_draw_text(_canvas, bbox, clip, text); } -void GDICanvas::draw_opaque(Rect *bbox, Clip *clip, Opaque *opaque) +void GDICanvas::draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) { gdi_canvas_draw_opaque(_canvas, bbox, clip, opaque); } -void GDICanvas::draw_copy(Rect *bbox, Clip *clip, Copy *copy) +void GDICanvas::draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) { gdi_canvas_draw_copy(_canvas, bbox, clip, copy); } -void GDICanvas::draw_transparent(Rect *bbox, Clip *clip, Transparent* transparent) +void GDICanvas::draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent) { gdi_canvas_draw_transparent(_canvas, bbox, clip, transparent); } -void GDICanvas::draw_alpha_blend(Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend) +void GDICanvas::draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend) { gdi_canvas_draw_alpha_blend(_canvas, bbox, clip, alpha_blend); } -void GDICanvas::copy_bits(Rect *bbox, Clip *clip, Point *src_pos) +void GDICanvas::copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) { gdi_canvas_copy_bits(_canvas, bbox, clip, src_pos); } -void GDICanvas::draw_blend(Rect *bbox, Clip *clip, Blend *blend) +void GDICanvas::draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) { gdi_canvas_draw_blend(_canvas, bbox, clip, blend); } -void GDICanvas::draw_blackness(Rect *bbox, Clip *clip, Blackness *blackness) +void GDICanvas::draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) { gdi_canvas_draw_blackness(_canvas, bbox, clip, blackness); } -void GDICanvas::draw_whiteness(Rect *bbox, Clip *clip, Whiteness *whiteness) +void GDICanvas::draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) { gdi_canvas_draw_whiteness(_canvas, bbox, clip, whiteness); } -void GDICanvas::draw_invers(Rect *bbox, Clip *clip, Invers *invers) +void GDICanvas::draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) { gdi_canvas_draw_invers(_canvas, bbox, clip, invers); } -void GDICanvas::draw_rop3(Rect *bbox, Clip *clip, Rop3 *rop3) +void GDICanvas::draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) { gdi_canvas_draw_rop3(_canvas, bbox, clip, rop3); } -void GDICanvas::draw_stroke(Rect *bbox, Clip *clip, Stroke *stroke) +void GDICanvas::draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) { gdi_canvas_draw_stroke(_canvas, bbox, clip, stroke); } -void GDICanvas::put_image(HDC dc, const PixmapHeader& image, const Rect& dest, const QRegion* clip) +void GDICanvas::put_image(HDC dc, const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip) { gdi_canvas_put_image(_canvas, dc, &dest, image.data, image.width, image.height, image.stride, clip); diff --git a/client/red_gdi_canvas.h b/client/red_gdi_canvas.h index 7fc981e1..6f494340 100644 --- a/client/red_gdi_canvas.h +++ b/client/red_gdi_canvas.h @@ -37,26 +37,26 @@ public: virtual void copy_pixels(const QRegion& region, RedDrawable* dc, const PixmapHeader* pixmap); virtual void copy_pixels(const QRegion& region, RedDrawable& dc); - virtual void put_image(HDC dc, const PixmapHeader& image, const Rect& dest, + virtual void put_image(HDC dc, const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip); virtual CanvasType get_pixmap_type(); protected: virtual void set_access_params(unsigned long base, unsigned long max); - virtual void draw_fill(Rect *bbox, Clip *clip, Fill *fill); - virtual void draw_copy(Rect *bbox, Clip *clip, Copy *copy); - virtual void draw_opaque(Rect *bbox, Clip *clip, Opaque *opaque); - virtual void copy_bits(Rect *bbox, Clip *clip, Point *src_pos); - virtual void draw_text(Rect *bbox, Clip *clip, Text *text); - virtual void draw_stroke(Rect *bbox, Clip *clip, Stroke *stroke); - virtual void draw_rop3(Rect *bbox, Clip *clip, Rop3 *rop3); - virtual void draw_blend(Rect *bbox, Clip *clip, Blend *blend); - virtual void draw_blackness(Rect *bbox, Clip *clip, Blackness *blackness); - virtual void draw_whiteness(Rect *bbox, Clip *clip, Whiteness *whiteness); - virtual void draw_invers(Rect *bbox, Clip *clip, Invers *invers); - virtual void draw_transparent(Rect *bbox, Clip *clip, Transparent* transparent); - virtual void draw_alpha_blend(Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend); + virtual void draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill); + virtual void draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy); + virtual void draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque); + virtual void copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos); + virtual void draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text); + virtual void draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke); + virtual void draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3); + virtual void draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend); + virtual void draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness); + virtual void draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness); + virtual void draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers); + virtual void draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent); + virtual void draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend); private: void create_pixmap(int width, int height); diff --git a/client/red_gl_canvas.cpp b/client/red_gl_canvas.cpp index f08dd4dc..830de035 100644 --- a/client/red_gl_canvas.cpp +++ b/client/red_gl_canvas.cpp @@ -70,7 +70,7 @@ void GCanvas::create_pixmap(int width, int height, RedWindow *win, void GCanvas::copy_pixels(const QRegion& region, RedDrawable& dest_dc) { for (int i = 0; i < (int)region.num_rects; i++) { - Rect* r = ®ion.rects[i]; + SpiceRect* r = ®ion.rects[i]; dest_dc.copy_pixels(*_pixmap, r->left, r->top, *r); } } @@ -105,85 +105,85 @@ void GCanvas::set_access_params(unsigned long base, unsigned long max) gl_canvas_set_access_params(_canvas, base, max); } -void GCanvas::draw_fill(Rect *bbox, Clip *clip, Fill *fill) +void GCanvas::draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) { gl_canvas_draw_fill(_canvas, bbox, clip, fill); _pixmap->update_texture(bbox); } -void GCanvas::draw_text(Rect *bbox, Clip *clip, Text *text) +void GCanvas::draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text) { gl_canvas_draw_text(_canvas, bbox, clip, text); _pixmap->update_texture(bbox); } -void GCanvas::draw_opaque(Rect *bbox, Clip *clip, Opaque *opaque) +void GCanvas::draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) { gl_canvas_draw_opaque(_canvas, bbox, clip, opaque); _pixmap->update_texture(bbox); } -void GCanvas::draw_copy(Rect *bbox, Clip *clip, Copy *copy) +void GCanvas::draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) { gl_canvas_draw_copy(_canvas, bbox, clip, copy); _pixmap->update_texture(bbox); } -void GCanvas::draw_transparent(Rect *bbox, Clip *clip, Transparent* transparent) +void GCanvas::draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent) { gl_canvas_draw_transparent(_canvas, bbox, clip, transparent); _pixmap->update_texture(bbox); } -void GCanvas::draw_alpha_blend(Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend) +void GCanvas::draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend) { gl_canvas_draw_alpha_blend(_canvas, bbox, clip, alpha_blend); _pixmap->update_texture(bbox); } -void GCanvas::copy_bits(Rect *bbox, Clip *clip, Point *src_pos) +void GCanvas::copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) { gl_canvas_copy_pixels(_canvas, bbox, clip, src_pos); _pixmap->update_texture(bbox); } -void GCanvas::draw_blend(Rect *bbox, Clip *clip, Blend *blend) +void GCanvas::draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) { gl_canvas_draw_blend(_canvas, bbox, clip, blend); _pixmap->update_texture(bbox); } -void GCanvas::draw_blackness(Rect *bbox, Clip *clip, Blackness *blackness) +void GCanvas::draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) { gl_canvas_draw_blackness(_canvas, bbox, clip, blackness); _pixmap->update_texture(bbox); } -void GCanvas::draw_whiteness(Rect *bbox, Clip *clip, Whiteness *whiteness) +void GCanvas::draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) { gl_canvas_draw_whiteness(_canvas, bbox, clip, whiteness); _pixmap->update_texture(bbox); } -void GCanvas::draw_invers(Rect *bbox, Clip *clip, Invers *invers) +void GCanvas::draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) { gl_canvas_draw_invers(_canvas, bbox, clip, invers); _pixmap->update_texture(bbox); } -void GCanvas::draw_rop3(Rect *bbox, Clip *clip, Rop3 *rop3) +void GCanvas::draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) { gl_canvas_draw_rop3(_canvas, bbox, clip, rop3); _pixmap->update_texture(bbox); } -void GCanvas::draw_stroke(Rect *bbox, Clip *clip, Stroke *stroke) +void GCanvas::draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) { gl_canvas_draw_stroke(_canvas, bbox, clip, stroke); _pixmap->update_texture(bbox); } -void GCanvas::put_image(const PixmapHeader& image, const Rect& dest, +void GCanvas::put_image(const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip) { gl_canvas_put_image(_canvas, &dest, image.data, image.width, image.height, diff --git a/client/red_gl_canvas.h b/client/red_gl_canvas.h index 7763cf2b..918aa6c6 100644 --- a/client/red_gl_canvas.h +++ b/client/red_gl_canvas.h @@ -39,23 +39,23 @@ public: void copy_pixels(const QRegion& region, RedDrawable* dc, const PixmapHeader* pixmap); void copy_pixels(const QRegion& region, RedDrawable& dc); - void put_image(const PixmapHeader& image, const Rect& dest, + void put_image(const PixmapHeader& image, const SpiceRect& dest, const QRegion* clip); void set_access_params(unsigned long base, unsigned long max); - void draw_fill(Rect *bbox, Clip *clip, Fill *fill); - void draw_copy(Rect *bbox, Clip *clip, Copy *copy); - void draw_opaque(Rect *bbox, Clip *clip, Opaque *opaque); - void copy_bits(Rect *bbox, Clip *clip, Point *src_pos); - void draw_text(Rect *bbox, Clip *clip, Text *text); - void draw_stroke(Rect *bbox, Clip *clip, Stroke *stroke); - void draw_rop3(Rect *bbox, Clip *clip, Rop3 *rop3); - void draw_blend(Rect *bbox, Clip *clip, Blend *blend); - void draw_blackness(Rect *bbox, Clip *clip, Blackness *blackness); - void draw_whiteness(Rect *bbox, Clip *clip, Whiteness *whiteness); - void draw_invers(Rect *bbox, Clip *clip, Invers *invers); - void draw_transparent(Rect *bbox, Clip *clip, Transparent* transparent); - void draw_alpha_blend(Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend); + void draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill); + void draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy); + void draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque); + void copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos); + void draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text); + void draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke); + void draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3); + void draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend); + void draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness); + void draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness); + void draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers); + void draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent); + void draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend); virtual void textures_lost(); virtual CanvasType get_pixmap_type(); diff --git a/client/red_peer.cpp b/client/red_peer.cpp index 0fd60242..f12be5a6 100644 --- a/client/red_peer.cpp +++ b/client/red_peer.cpp @@ -658,10 +658,10 @@ uint32_t RedPeer::recive(uint8_t *buf, uint32_t size) RedPeer::CompundInMessage* RedPeer::recive() { - RedDataHeader header; + SpiceDataHeader header; AutoRef message; - recive((uint8_t*)&header, sizeof(RedDataHeader)); + recive((uint8_t*)&header, sizeof(SpiceDataHeader)); message.reset(new CompundInMessage(header.serial, header.type, header.size, header.sub_list)); recive((*message)->data(), (*message)->compund_size()); return message.release(); @@ -729,7 +729,7 @@ uint32_t RedPeer::send(RedPeer::OutMessage& message) } RedPeer::OutMessage::OutMessage(uint32_t type, uint32_t size) - : _data (new uint8_t[size + sizeof(RedDataHeader)]) + : _data (new uint8_t[size + sizeof(SpiceDataHeader)]) , _size (size) { header().type = type; @@ -751,7 +751,7 @@ void RedPeer::OutMessage::resize(uint32_t size) delete[] _data; _data = NULL; _size = 0; - _data = new uint8_t[size + sizeof(RedDataHeader)]; + _data = new uint8_t[size + sizeof(SpiceDataHeader)]; _size = size; header().type = type; header().size = size; diff --git a/client/red_peer.h b/client/red_peer.h index 8a4060df..8b10a5ec 100644 --- a/client/red_peer.h +++ b/client/red_peer.h @@ -196,12 +196,12 @@ public: OutMessage(uint32_t type, uint32_t size); virtual ~OutMessage(); - RedDataHeader& header() { return *(RedDataHeader *)_data;} - uint8_t* data() { return _data + sizeof(RedDataHeader);} + SpiceDataHeader& header() { return *(SpiceDataHeader *)_data;} + uint8_t* data() { return _data + sizeof(SpiceDataHeader);} void resize(uint32_t size); private: - uint32_t message_size() { return header().size + sizeof(RedDataHeader);} + uint32_t message_size() { return header().size + sizeof(SpiceDataHeader);} uint8_t* base() { return _data;} private: diff --git a/client/red_pixmap.h b/client/red_pixmap.h index 5b9ac09a..e09f0f71 100644 --- a/client/red_pixmap.h +++ b/client/red_pixmap.h @@ -32,7 +32,7 @@ public: rgb32_t* pallete); virtual ~RedPixmap(); - virtual Point get_size() { Point pt = {_width, _height}; return pt;} + virtual SpicePoint get_size() { SpicePoint pt = {_width, _height}; return pt;} int get_width() { return _width;} int get_height() { return _height;} diff --git a/client/red_pixmap_gl.h b/client/red_pixmap_gl.h index d86ddb47..1c0e4229 100644 --- a/client/red_pixmap_gl.h +++ b/client/red_pixmap_gl.h @@ -33,7 +33,7 @@ public: void textures_lost(); void touch_context(); - void update_texture(const Rect *bbox); + void update_texture(const SpiceRect *bbox); void pre_copy(); void past_copy(); ~RedPixmapGL(); diff --git a/client/red_window.h b/client/red_window.h index 377d99be..707b9027 100644 --- a/client/red_window.h +++ b/client/red_window.h @@ -57,9 +57,9 @@ public: TYPE_FULLSCREEN, }; void set_type(Type type) { _type = type;} - Point get_position(); - virtual Point get_size(); - bool get_mouse_anchor_point(Point& pt); + SpicePoint get_position(); + virtual SpicePoint get_size(); + bool get_mouse_anchor_point(SpicePoint& pt); void set_mouse_position(int x, int y); void set_cursor(LocalCursor* local_cursor); @@ -101,7 +101,7 @@ private: private: Listener& _listener; - Point _window_size; + SpicePoint _window_size; Type _type; LocalCursor* _local_cursor; bool _cursor_visible; @@ -115,13 +115,13 @@ private: class RedWindow::Listener { public: virtual ~Listener() {} - virtual void on_exposed_rect(const Rect& area) = 0; + virtual void on_exposed_rect(const SpiceRect& area) = 0; virtual void on_pointer_enter(int x, int y, unsigned int buttons_state) = 0; virtual void on_pointer_motion(int x, int y, unsigned int buttons_state) = 0; virtual void on_pointer_leave() = 0; - virtual void on_mouse_button_press(RedButton button, unsigned int buttons_state) = 0; - virtual void on_mouse_button_release(RedButton button, unsigned int buttons_state) = 0; + virtual void on_mouse_button_press(SpiceMouseButton button, unsigned int buttons_state) = 0; + virtual void on_mouse_button_release(SpiceMouseButton button, unsigned int buttons_state) = 0; virtual void on_key_press(RedKey key) = 0; virtual void on_key_release(RedKey key) = 0; @@ -140,18 +140,18 @@ public: }; /*class REGION { - void get_bbox(Rect& bbox) const; + void get_bbox(SpiceRect& bbox) const; bool contains_point(int x, int y) const; };*/ template -static bool find_anchor_point(const REGION& region, Point& pt) +static bool find_anchor_point(const REGION& region, SpicePoint& pt) { static const unsigned int lookup_size = 20; unsigned int width; unsigned int height; - Rect bbox; + SpiceRect bbox; region.get_bbox(bbox); width = bbox.right - bbox.left; @@ -173,7 +173,7 @@ static bool find_anchor_point(const REGION& region, Point& pt) continue; } - Rect r; + SpiceRect r; r.left = bbox.left + x - lookup_size / 2; r.right = r.left + lookup_size; r.top = bbox.top + y - lookup_size / 2; diff --git a/client/screen.cpp b/client/screen.cpp index 29b40bf6..9e6b04ee 100644 --- a/client/screen.cpp +++ b/client/screen.cpp @@ -289,7 +289,7 @@ void RedScreen::detach_layer(ScreenLayer& layer) void RedScreen::composit_to_screen(RedDrawable& win_dc, const QRegion& region) { for (int i = 0; i < (int)region.num_rects; i++) { - Rect* r = ®ion.rects[i]; + SpiceRect* r = ®ion.rects[i]; win_dc.copy_pixels(*_composit_area, r->left, r->top, *r); } } @@ -315,7 +315,7 @@ inline void RedScreen::begin_update(QRegion& direct_rgn, QRegion& composit_rgn, lock.unlock(); QRegion rect_rgn; - Rect r; + SpiceRect r; r.top = r.left = 0; r.right = _size.x; r.bottom = _size.y; @@ -445,7 +445,7 @@ void RedScreen::update() } } -bool RedScreen::_invalidate(const Rect& rect, bool urgent, uint64_t& update_mark) +bool RedScreen::_invalidate(const SpiceRect& rect, bool urgent, uint64_t& update_mark) { RecurciveLock lock(_update_lock); bool update_triger = !is_dirty() && (urgent || !_periodic_update); @@ -454,7 +454,7 @@ bool RedScreen::_invalidate(const Rect& rect, bool urgent, uint64_t& update_mark return update_triger; } -uint64_t RedScreen::invalidate(const Rect& rect, bool urgent) +uint64_t RedScreen::invalidate(const SpiceRect& rect, bool urgent) { uint64_t update_mark; if (_invalidate(rect, urgent, update_mark)) { @@ -474,8 +474,8 @@ uint64_t RedScreen::invalidate(const Rect& rect, bool urgent) void RedScreen::invalidate(const QRegion ®ion) { - Rect *r = region.rects; - Rect *end = r + region.num_rects; + SpiceRect *r = region.rects; + SpiceRect *end = r + region.num_rects; while (r != end) { invalidate(*r++, false); } @@ -631,7 +631,7 @@ void RedScreen::on_pointer_motion(int x, int y, unsigned int buttons_state) _pointer_layer->on_pointer_motion(x, y, buttons_state); } -void RedScreen::on_mouse_button_press(RedButton button, unsigned int buttons_state) +void RedScreen::on_mouse_button_press(SpiceMouseButton button, unsigned int buttons_state) { if (_mouse_captured) { _owner.on_mouse_down(button, buttons_state); @@ -645,7 +645,7 @@ void RedScreen::on_mouse_button_press(RedButton button, unsigned int buttons_sta _pointer_layer->on_mouse_button_press(button, buttons_state); } -void RedScreen::on_mouse_button_release(RedButton button, unsigned int buttons_state) +void RedScreen::on_mouse_button_release(SpiceMouseButton button, unsigned int buttons_state) { if (_mouse_captured) { _owner.on_mouse_up(button, buttons_state); @@ -770,8 +770,8 @@ void RedScreen::__show_full_screen() hide(); return; } - Point position = _monitor->get_position(); - Point monitor_size = _monitor->get_size(); + SpicePoint position = _monitor->get_position(); + SpicePoint monitor_size = _monitor->get_size(); _frame_area = false; region_clear(&_dirty_region); _window.set_type(RedWindow::TYPE_FULLSCREEN); @@ -807,7 +807,7 @@ void RedScreen::minimize() _window.minimize(); } -void RedScreen::position_full_screen(const Point& position) +void RedScreen::position_full_screen(const SpicePoint& position) { if (!_full_screen) { return; @@ -838,7 +838,7 @@ void RedScreen::external_show() _window.external_show(); } -void RedScreen::on_exposed_rect(const Rect& area) +void RedScreen::on_exposed_rect(const SpiceRect& area) { if (is_out_of_sync()) { _window.fill_rect(area, rgb32_make(0xff, 0xff, 0xff)); diff --git a/client/screen.h b/client/screen.h index c07d5419..7d29835a 100644 --- a/client/screen.h +++ b/client/screen.h @@ -62,13 +62,13 @@ public: void on_layer_changed(ScreenLayer& layer); void resize(int width, int height); void set_name(const std::wstring& name); - uint64_t invalidate(const Rect& rect, bool urgent); + uint64_t invalidate(const SpiceRect& rect, bool urgent); void invalidate(const QRegion ®ion); void capture_mouse(); void relase_mouse(); bool is_mouse_captured() { return _mouse_captured;} bool intercepts_sys_key() { return _key_interception;} - Point get_size() { return _size;} + SpicePoint get_size() { return _size;} bool has_monitor() { return _monitor != 0;} void lock_size(); void unlock_size(); @@ -82,7 +82,7 @@ public: void minimize(); void show(bool activate, RedScreen* pos); void show_full_screen(); - void position_full_screen(const Point& position); + void position_full_screen(const SpicePoint& position); void hide(); void show(); void activate(); @@ -118,7 +118,7 @@ private: bool is_out_of_sync() { return _out_of_sync;} void __show_full_screen(); - bool _invalidate(const Rect& rect, bool urgent, uint64_t& update_mark); + bool _invalidate(const SpiceRect& rect, bool urgent, uint64_t& update_mark); void begin_update(QRegion& direct_rgn, QRegion& composit_rgn, QRegion& frame_rgn); void update_composit(QRegion& composit_rgn); void draw_direct(RedDrawable& win_dc, QRegion& direct_rgn, QRegion& composit_rgn, @@ -133,13 +133,13 @@ private: ScreenLayer* find_pointer_layer(); bool update_pointer_layer(); - virtual void on_exposed_rect(const Rect& area); + virtual void on_exposed_rect(const SpiceRect& area); virtual void on_pointer_enter(int x, int y, unsigned int buttons_state); virtual void on_pointer_motion(int x, int y, unsigned int buttons_state); virtual void on_pointer_leave(); void on_mouse_motion(int x, int y, unsigned int buttons_state); - virtual void on_mouse_button_press(RedButton button, unsigned int buttons_state); - virtual void on_mouse_button_release(RedButton button, unsigned int buttons_state); + virtual void on_mouse_button_press(SpiceMouseButton button, unsigned int buttons_state); + virtual void on_mouse_button_release(SpiceMouseButton button, unsigned int buttons_state); virtual void on_key_press(RedKey key); virtual void on_key_release(RedKey key); @@ -178,10 +178,10 @@ private: RedDrawable* _composit_area; uint64_t _update_mark; - Point _size; - Point _origin; - Point _mouse_anchor_point; - Point _save_pos; + SpicePoint _size; + SpicePoint _origin; + SpicePoint _mouse_anchor_point; + SpicePoint _save_pos; Monitor* _monitor; LocalCursor* _default_cursor; @@ -195,7 +195,7 @@ private: Mutex _layer_changed_lock; bool _active_layer_change_event; bool _pointer_on_screen; - Point _pointer_pos; + SpicePoint _pointer_pos; unsigned int _mouse_botton_state; friend class LayerChangedEvent; diff --git a/client/screen_layer.cpp b/client/screen_layer.cpp index d4a4435f..af25211e 100644 --- a/client/screen_layer.cpp +++ b/client/screen_layer.cpp @@ -78,12 +78,12 @@ ScreenLayer::~ScreenLayer() region_destroy(&_composit_area); } -uint64_t ScreenLayer::invalidate_rect(const Rect& r, bool urgent) +uint64_t ScreenLayer::invalidate_rect(const SpiceRect& r, bool urgent) { return _screen->invalidate(r, urgent); } -uint64_t ScreenLayer::invalidate(const Rect& r, bool urgent) +uint64_t ScreenLayer::invalidate(const SpiceRect& r, bool urgent) { if (!_screen) { return 0; @@ -96,8 +96,8 @@ void ScreenLayer::invalidate(const QRegion& region) if (!_screen) { return; } - Rect *r = region.rects; - Rect *end = r + region.num_rects; + SpiceRect *r = region.rects; + SpiceRect *end = r + region.num_rects; while (r != end) { invalidate_rect(*r++, false); } @@ -133,7 +133,7 @@ void ScreenLayer::clear_area() notify_changed(); } -void ScreenLayer::set_rect_area(const Rect& r) +void ScreenLayer::set_rect_area(const SpiceRect& r) { Lock lock(_area_lock); invalidate(); @@ -152,14 +152,14 @@ void ScreenLayer::offset_area(int dx, int dy) notify_changed(); } -void ScreenLayer::add_rect_area(const Rect& r) +void ScreenLayer::add_rect_area(const SpiceRect& r) { Lock lock(_area_lock); region_add(&_area, &r); notify_changed(); } -void ScreenLayer::remove_rect_area(const Rect& r) +void ScreenLayer::remove_rect_area(const SpiceRect& r) { Lock lock(_area_lock); invalidate(); diff --git a/client/screen_layer.h b/client/screen_layer.h index 9b2ed7fa..4966ad4c 100644 --- a/client/screen_layer.h +++ b/client/screen_layer.h @@ -38,12 +38,12 @@ public: void set_area(const QRegion& area); void offset_area(int dx, int dy); void clear_area(); - void set_rect_area(const Rect& r); - void add_rect_area(const Rect& r); - void remove_rect_area(const Rect& r); + void set_rect_area(const SpiceRect& r); + void add_rect_area(const SpiceRect& r); + void remove_rect_area(const SpiceRect& r); void begin_update(QRegion& direct_rgn, QRegion& composit_rgn); void invalidate(); - uint64_t invalidate(const Rect& r, bool urgent = false); + uint64_t invalidate(const SpiceRect& r, bool urgent = false); void invalidate(const QRegion& r); bool contains_point(int x, int y); @@ -70,7 +70,7 @@ public: virtual void on_mouse_button_release(int button, int buttons_state) {} private: - uint64_t invalidate_rect(const Rect& r, bool urgent); + uint64_t invalidate_rect(const SpiceRect& r, bool urgent); void notify_changed(); private: diff --git a/client/tunnel_channel.cpp b/client/tunnel_channel.cpp index b6455a61..dd50933d 100644 --- a/client/tunnel_channel.cpp +++ b/client/tunnel_channel.cpp @@ -46,7 +46,7 @@ protected: private: int _refs; RedChannel::CompundInMessage& _full_msg; - RedTunnelSocketData* _sckt_msg; + SpiceMsgTunnelSocketData* _sckt_msg; uint32_t _buf_size; }; @@ -54,10 +54,10 @@ InSocketMessage::InSocketMessage(RedChannel::CompundInMessage& full_msg) : _refs (1) , _full_msg (full_msg) { - ASSERT(full_msg.type() == RED_TUNNEL_SOCKET_DATA); + ASSERT(full_msg.type() == SPICE_MSG_TUNNEL_SOCKET_DATA); _full_msg.ref(); - _sckt_msg = (RedTunnelSocketData*)(_full_msg.data()); - _buf_size = _full_msg.size() - sizeof(RedTunnelSocketData); + _sckt_msg = (SpiceMsgTunnelSocketData*)(_full_msg.data()); + _buf_size = _full_msg.size() - sizeof(SpiceMsgTunnelSocketData); } const uint8_t* InSocketMessage::data() @@ -115,7 +115,7 @@ std::list OutSocketMessage::_free_messages; uint32_t OutSocketMessage::_max_data_size; OutSocketMessage::OutSocketMessage() - : RedPeer::OutMessage(REDC_TUNNEL_SOCKET_DATA, sizeof(RedcTunnelSocketData) + _max_data_size) + : RedPeer::OutMessage(SPICE_MSGC_TUNNEL_SOCKET_DATA, sizeof(SpiceMsgcTunnelSocketData) + _max_data_size) , RedChannel::OutMessage() , ClientNetSocket::ReceiveBuffer() { @@ -123,12 +123,12 @@ OutSocketMessage::OutSocketMessage() uint8_t* OutSocketMessage::buf() { - return ((RedcTunnelSocketData*)RedPeer::OutMessage::data())->data; + return ((SpiceMsgcTunnelSocketData*)RedPeer::OutMessage::data())->data; } void OutSocketMessage::set_buf_size(uint32_t size) { - RedPeer::OutMessage::header().size = size + sizeof(RedcTunnelSocketData); + RedPeer::OutMessage::header().size = size + sizeof(SpiceMsgcTunnelSocketData); } void OutSocketMessage::release() @@ -219,14 +219,14 @@ TunnelChannel::TunnelSocket::TunnelSocket(uint16_t id, TunnelService& dst_servic { } -class TunnelHandler: public MessageHandlerImp { +class TunnelHandler: public MessageHandlerImp { public: TunnelHandler(TunnelChannel& channel) - : MessageHandlerImp(channel) {} + : MessageHandlerImp(channel) {} }; TunnelChannel::TunnelChannel(RedClient& client, uint32_t id) - : RedChannel(client, RED_CHANNEL_TUNNEL, id, new TunnelHandler(*this)) + : RedChannel(client, SPICE_CHANNEL_TUNNEL, id, new TunnelHandler(*this)) , _max_socket_data_size(0) , _service_id(0) , _service_group(0) @@ -236,29 +236,29 @@ TunnelChannel::TunnelChannel(RedClient& client, uint32_t id) { TunnelHandler* handler = static_cast(get_message_handler()); - handler->set_handler(RED_MIGRATE, &TunnelChannel::handle_migrate, 0); - handler->set_handler(RED_SET_ACK, &TunnelChannel::handle_set_ack, sizeof(RedSetAck)); - handler->set_handler(RED_PING, &TunnelChannel::handle_ping, sizeof(RedPing)); - handler->set_handler(RED_WAIT_FOR_CHANNELS, &TunnelChannel::handle_wait_for_channels, - sizeof(RedWaitForChannels)); - - handler->set_handler(RED_TUNNEL_INIT, - &TunnelChannel::handle_init, sizeof(RedTunnelInit)); - handler->set_handler(RED_TUNNEL_SERVICE_IP_MAP, - &TunnelChannel::handle_service_ip_map, sizeof(RedTunnelServiceIpMap)); - handler->set_handler(RED_TUNNEL_SOCKET_OPEN, - &TunnelChannel::handle_socket_open, sizeof(RedTunnelSocketOpen)); - handler->set_handler(RED_TUNNEL_SOCKET_CLOSE, - &TunnelChannel::handle_socket_close, sizeof(RedTunnelSocketClose)); - handler->set_handler(RED_TUNNEL_SOCKET_FIN, - &TunnelChannel::handle_socket_fin, sizeof(RedTunnelSocketFin)); - handler->set_handler(RED_TUNNEL_SOCKET_TOKEN, - &TunnelChannel::handle_socket_token, sizeof(RedTunnelSocketTokens)); - handler->set_handler(RED_TUNNEL_SOCKET_CLOSED_ACK, + handler->set_handler(SPICE_MSG_MIGRATE, &TunnelChannel::handle_migrate, 0); + handler->set_handler(SPICE_MSG_SET_ACK, &TunnelChannel::handle_set_ack, sizeof(SpiceMsgSetAck)); + handler->set_handler(SPICE_MSG_PING, &TunnelChannel::handle_ping, sizeof(SpiceMsgPing)); + handler->set_handler(SPICE_MSG_WAIT_FOR_CHANNELS, &TunnelChannel::handle_wait_for_channels, + sizeof(SpiceMsgWaitForChannels)); + + handler->set_handler(SPICE_MSG_TUNNEL_INIT, + &TunnelChannel::handle_init, sizeof(SpiceMsgTunnelInit)); + handler->set_handler(SPICE_MSG_TUNNEL_SERVICE_IP_MAP, + &TunnelChannel::handle_service_ip_map, sizeof(SpiceMsgTunnelServiceIpMap)); + handler->set_handler(SPICE_MSG_TUNNEL_SOCKET_OPEN, + &TunnelChannel::handle_socket_open, sizeof(SpiceMsgTunnelSocketOpen)); + handler->set_handler(SPICE_MSG_TUNNEL_SOCKET_CLOSE, + &TunnelChannel::handle_socket_close, sizeof(SpiceMsgTunnelSocketClose)); + handler->set_handler(SPICE_MSG_TUNNEL_SOCKET_FIN, + &TunnelChannel::handle_socket_fin, sizeof(SpiceMsgTunnelSocketFin)); + handler->set_handler(SPICE_MSG_TUNNEL_SOCKET_TOKEN, + &TunnelChannel::handle_socket_token, sizeof(SpiceMsgTunnelSocketTokens)); + handler->set_handler(SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK, &TunnelChannel::handle_socket_closed_ack, - sizeof(RedTunnelSocketClosedAck)); - handler->set_handler(RED_TUNNEL_SOCKET_DATA, - &TunnelChannel::handle_socket_data, sizeof(RedTunnelSocketData)); + sizeof(SpiceMsgTunnelSocketClosedAck)); + handler->set_handler(SPICE_MSG_TUNNEL_SOCKET_DATA, + &TunnelChannel::handle_socket_data, sizeof(SpiceMsgTunnelSocketData)); } TunnelChannel::~TunnelChannel() @@ -269,7 +269,7 @@ TunnelChannel::~TunnelChannel() void TunnelChannel::handle_init(RedPeer::InMessage* message) { - RedTunnelInit* init_msg = (RedTunnelInit*)message->data(); + SpiceMsgTunnelInit* init_msg = (SpiceMsgTunnelInit*)message->data(); _max_socket_data_size = init_msg->max_socket_data_size; OutSocketMessage::init(_max_socket_data_size); _sockets.resize(init_msg->max_num_of_sockets); @@ -281,29 +281,29 @@ void TunnelChannel::send_service(TunnelService& service) msg_size += service.name.length() + 1; msg_size += service.description.length() + 1; - if (service.type == RED_TUNNEL_SERVICE_TYPE_IPP) { - msg_size += sizeof(RedcTunnelAddPrintService) + sizeof(RedTunnelIPv4); - } else if (service.type == RED_TUNNEL_SERVICE_TYPE_GENERIC) { - msg_size += sizeof(RedcTunnelAddGenericService); + if (service.type == SPICE_TUNNEL_SERVICE_TYPE_IPP) { + msg_size += sizeof(SpiceMsgcTunnelAddPrintService) + sizeof(SpiceTunnelIPv4); + } else if (service.type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) { + msg_size += sizeof(SpiceMsgcTunnelAddGenericService); } else { THROW("%s: invalid service type", __FUNCTION__); } - Message* service_msg = new Message(REDC_TUNNEL_SERVICE_ADD, msg_size); - RedcTunnelAddGenericService* out_service = (RedcTunnelAddGenericService*)service_msg->data(); + Message* service_msg = new Message(SPICE_MSGC_TUNNEL_SERVICE_ADD, msg_size); + SpiceMsgcTunnelAddGenericService* out_service = (SpiceMsgcTunnelAddGenericService*)service_msg->data(); out_service->id = service.id; out_service->group = service.group; out_service->type = service.type; out_service->port = service.port; int cur_offset; - if (service.type == RED_TUNNEL_SERVICE_TYPE_IPP) { - cur_offset = sizeof(RedcTunnelAddPrintService); - ((RedcTunnelAddPrintService*)out_service)->ip.type = RED_TUNNEL_IP_TYPE_IPv4; - memcpy(((RedcTunnelAddPrintService*)out_service)->ip.data, &(service.ip.s_addr), - sizeof(RedTunnelIPv4)); - cur_offset += sizeof(RedTunnelIPv4); + if (service.type == SPICE_TUNNEL_SERVICE_TYPE_IPP) { + cur_offset = sizeof(SpiceMsgcTunnelAddPrintService); + ((SpiceMsgcTunnelAddPrintService*)out_service)->ip.type = SPICE_TUNNEL_IP_TYPE_IPv4; + memcpy(((SpiceMsgcTunnelAddPrintService*)out_service)->ip.data, &(service.ip.s_addr), + sizeof(SpiceTunnelIPv4)); + cur_offset += sizeof(SpiceTunnelIPv4); } else { - cur_offset = sizeof(RedcTunnelAddGenericService); + cur_offset = sizeof(SpiceMsgcTunnelAddGenericService); } out_service->name = cur_offset; @@ -322,16 +322,16 @@ void TunnelChannel::send_service(TunnelService& service) void TunnelChannel::handle_service_ip_map(RedPeer::InMessage* message) { - RedTunnelServiceIpMap* service_ip_msg = (RedTunnelServiceIpMap*)message->data(); + SpiceMsgTunnelServiceIpMap* service_ip_msg = (SpiceMsgTunnelServiceIpMap*)message->data(); TunnelService* service = find_service(service_ip_msg->service_id); if (!service) { THROW("%s: attempt to map non-existing service id=%d", __FUNCTION__, service_ip_msg->service_id); } - if (service_ip_msg->virtual_ip.type == RED_TUNNEL_IP_TYPE_IPv4) { + if (service_ip_msg->virtual_ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) { memcpy(&service->virtual_ip.s_addr, service_ip_msg->virtual_ip.data, - sizeof(RedTunnelIPv4)); + sizeof(SpiceTunnelIPv4)); } else { THROW("unexpected ip type %d", service_ip_msg->virtual_ip.type); } @@ -344,7 +344,7 @@ void TunnelChannel::handle_service_ip_map(RedPeer::InMessage* message) void TunnelChannel::handle_socket_open(RedPeer::InMessage* message) { - RedTunnelSocketOpen* open_msg = (RedTunnelSocketOpen*)message->data(); + SpiceMsgTunnelSocketOpen* open_msg = (SpiceMsgTunnelSocketOpen*)message->data(); TunnelSocket* sckt; Message* out_msg; @@ -363,15 +363,15 @@ void TunnelChannel::handle_socket_open(RedPeer::InMessage* message) if (sckt->connect(open_msg->tokens)) { _sockets[open_msg->connection_id] = sckt; - out_msg = new Message(REDC_TUNNEL_SOCKET_OPEN_ACK, sizeof(RedcTunnelSocketOpenAck)); + out_msg = new Message(SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK, sizeof(SpiceMsgcTunnelSocketOpenAck)); sckt->set_num_tokens(0); sckt->set_server_num_tokens(SOCKET_WINDOW_SIZE); - ((RedcTunnelSocketOpenAck*)out_msg->data())->connection_id = open_msg->connection_id; - ((RedcTunnelSocketOpenAck*)out_msg->data())->tokens = SOCKET_WINDOW_SIZE; + ((SpiceMsgcTunnelSocketOpenAck*)out_msg->data())->connection_id = open_msg->connection_id; + ((SpiceMsgcTunnelSocketOpenAck*)out_msg->data())->tokens = SOCKET_WINDOW_SIZE; } else { - out_msg = new Message(REDC_TUNNEL_SOCKET_OPEN_NACK, sizeof(RedcTunnelSocketOpenNack)); - ((RedcTunnelSocketOpenNack*)out_msg->data())->connection_id = open_msg->connection_id; + out_msg = new Message(SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK, sizeof(SpiceMsgcTunnelSocketOpenNack)); + ((SpiceMsgcTunnelSocketOpenNack*)out_msg->data())->connection_id = open_msg->connection_id; delete sckt; } @@ -380,7 +380,7 @@ void TunnelChannel::handle_socket_open(RedPeer::InMessage* message) void TunnelChannel::handle_socket_fin(RedPeer::InMessage* message) { - RedTunnelSocketFin* fin_msg = (RedTunnelSocketFin*)message->data(); + SpiceMsgTunnelSocketFin* fin_msg = (SpiceMsgTunnelSocketFin*)message->data(); TunnelSocket* sckt = _sockets[fin_msg->connection_id]; if (!sckt) { @@ -395,7 +395,7 @@ void TunnelChannel::handle_socket_fin(RedPeer::InMessage* message) void TunnelChannel::handle_socket_close(RedPeer::InMessage* message) { - RedTunnelSocketClose* close_msg = (RedTunnelSocketClose*)message->data(); + SpiceMsgTunnelSocketClose* close_msg = (SpiceMsgTunnelSocketClose*)message->data(); TunnelSocket* sckt = _sockets[close_msg->connection_id]; if (!sckt) { @@ -417,7 +417,7 @@ void TunnelChannel::handle_socket_close(RedPeer::InMessage* message) void TunnelChannel::handle_socket_closed_ack(RedPeer::InMessage* message) { - RedTunnelSocketClosedAck* close_ack_msg = (RedTunnelSocketClosedAck*)message->data(); + SpiceMsgTunnelSocketClosedAck* close_ack_msg = (SpiceMsgTunnelSocketClosedAck*)message->data(); TunnelSocket* sckt = _sockets[close_ack_msg->connection_id]; if (!sckt) { THROW("%s: close ack to connection that doesn't exist id=%d", __FUNCTION__, @@ -435,7 +435,7 @@ void TunnelChannel::handle_socket_closed_ack(RedPeer::InMessage* message) void TunnelChannel::handle_socket_data(RedPeer::InMessage* message) { - RedTunnelSocketData* send_msg = (RedTunnelSocketData*)message->data(); + SpiceMsgTunnelSocketData* send_msg = (SpiceMsgTunnelSocketData*)message->data(); TunnelSocket* sckt = _sockets[send_msg->connection_id]; if (!sckt) { @@ -466,7 +466,7 @@ void TunnelChannel::handle_socket_data(RedPeer::InMessage* message) void TunnelChannel::handle_socket_token(RedPeer::InMessage* message) { - RedTunnelSocketTokens* token_msg = (RedTunnelSocketTokens*)message->data(); + SpiceMsgTunnelSocketTokens* token_msg = (SpiceMsgTunnelSocketTokens*)message->data(); TunnelSocket* sckt = _sockets[token_msg->connection_id]; if (!sckt) { @@ -485,16 +485,16 @@ void TunnelChannel::on_socket_message_recv_done(ClientNetSocket& sckt, TunnelChannel::TunnelSocket* tunnel_sckt = static_cast(&sckt); OutSocketMessage* out_msg = static_cast(&buf); - ((RedcTunnelSocketData*)(out_msg->data()))->connection_id = tunnel_sckt->id(); + ((SpiceMsgcTunnelSocketData*)(out_msg->data()))->connection_id = tunnel_sckt->id(); post_message(out_msg); } void TunnelChannel::on_socket_fin_recv(ClientNetSocket& sckt) { TunnelChannel::TunnelSocket* tunnel_sckt = static_cast(&sckt); - Message* out_msg = new Message(REDC_TUNNEL_SOCKET_FIN, sizeof(RedcTunnelSocketFin)); + Message* out_msg = new Message(SPICE_MSGC_TUNNEL_SOCKET_FIN, sizeof(SpiceMsgcTunnelSocketFin)); DBG(0, "FIN from client coonection id=%d", tunnel_sckt->id()); - ((RedcTunnelSocketFin*)out_msg->data())->connection_id = tunnel_sckt->id(); + ((SpiceMsgcTunnelSocketFin*)out_msg->data())->connection_id = tunnel_sckt->id(); post_message(out_msg); } @@ -505,14 +505,14 @@ void TunnelChannel::on_socket_disconnect(ClientNetSocket& sckt) // close intiated by server -> needs ack if (tunnel_sckt->get_guest_closed()) { DBG(0, "send close ack connection_id=%d", tunnel_sckt->id()); - out_msg = new Message(REDC_TUNNEL_SOCKET_CLOSED_ACK, sizeof(RedcTunnelSocketClosedAck)); - ((RedcTunnelSocketClosedAck*)out_msg->data())->connection_id = tunnel_sckt->id(); + out_msg = new Message(SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK, sizeof(SpiceMsgcTunnelSocketClosedAck)); + ((SpiceMsgcTunnelSocketClosedAck*)out_msg->data())->connection_id = tunnel_sckt->id(); _sockets[tunnel_sckt->id()] = NULL; delete &sckt; } else { // close initiated by client DBG(0, "send close coonection_id=%d", tunnel_sckt->id()); - out_msg = new Message(REDC_TUNNEL_SOCKET_CLOSED, sizeof(RedcTunnelSocketClosed)); - ((RedcTunnelSocketClosed*)out_msg->data())->connection_id = tunnel_sckt->id(); + out_msg = new Message(SPICE_MSGC_TUNNEL_SOCKET_CLOSED, sizeof(SpiceMsgcTunnelSocketClosed)); + ((SpiceMsgcTunnelSocketClosed*)out_msg->data())->connection_id = tunnel_sckt->id(); } post_message(out_msg); @@ -525,8 +525,8 @@ void TunnelChannel::on_socket_message_send_done(ClientNetSocket& sckt) num_tokens++; if (num_tokens == SOCKET_TOKENS_TO_SEND) { - Message* out_msg = new Message(REDC_TUNNEL_SOCKET_TOKEN, sizeof(RedcTunnelSocketTokens)); - RedcTunnelSocketTokens* tokens_msg = (RedcTunnelSocketTokens*)out_msg->data(); + Message* out_msg = new Message(SPICE_MSGC_TUNNEL_SOCKET_TOKEN, sizeof(SpiceMsgcTunnelSocketTokens)); + SpiceMsgcTunnelSocketTokens* tokens_msg = (SpiceMsgcTunnelSocketTokens*)out_msg->data(); tokens_msg->connection_id = tunnel_sckt->id(); tokens_msg->num_tokens = num_tokens; post_message(out_msg); @@ -641,7 +641,7 @@ void TunnelChannel::add_service(TunnelConfigConnectionIfc& source, class TunnelFactory: public ChannelFactory { public: - TunnelFactory() : ChannelFactory(RED_CHANNEL_TUNNEL) {} + TunnelFactory() : ChannelFactory(SPICE_CHANNEL_TUNNEL) {} virtual RedChannel* construct(RedClient& client, uint32_t id) { return new TunnelChannel(client, id); @@ -823,9 +823,9 @@ void TunnelConfigConnectionIfc::handle_msg() THROW("unexpected service type length"); } if (msg[start_token] == '0') { - service_type = RED_TUNNEL_SERVICE_TYPE_GENERIC; + service_type = SPICE_TUNNEL_SERVICE_TYPE_GENERIC; } else if (msg[start_token] == '1') { - service_type = RED_TUNNEL_SERVICE_TYPE_IPP; + service_type = SPICE_TUNNEL_SERVICE_TYPE_IPP; } else { THROW("unexpected service type"); } 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; } diff --git a/client/x11/pixels_source.cpp b/client/x11/pixels_source.cpp index d8d8cb75..7b9ed05f 100644 --- a/client/x11/pixels_source.cpp +++ b/client/x11/pixels_source.cpp @@ -94,10 +94,10 @@ ImageFromRes::~ImageFromRes() delete ((PixelsSource_p*)get_opaque())->pixmap.x_image; } -Point ImageFromRes::get_size() +SpicePoint ImageFromRes::get_size() { XImage *image = ((PixelsSource_p*)get_opaque())->pixmap.x_image; - Point pt; + SpicePoint pt; pt.x = image->width; pt.y = image->height; return pt; @@ -118,10 +118,10 @@ AlphaImageFromRes::~AlphaImageFromRes() delete ((PixelsSource_p*)get_opaque())->pixmap.x_image; } -Point AlphaImageFromRes::get_size() +SpicePoint AlphaImageFromRes::get_size() { XImage *image = ((PixelsSource_p*)get_opaque())->pixmap.x_image; - Point pt; + SpicePoint pt; pt.x = image->width; pt.y = image->height; return pt; diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 6aab7992..a41488eb 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -478,12 +478,12 @@ public: void set_width(int width) {_width = width;} int get_height() const { return _height;} void set_height(int height) {_height = height;} - Point get_position() const {return _position;} + SpicePoint get_position() const {return _position;} private: Display* _display; int _screen; - Point _position; + SpicePoint _position; int _width; int _height; bool _broken; @@ -520,8 +520,8 @@ public: } virtual int get_depth() { return XPlatform::get_vinfo()[0]->depth;} - virtual Point get_position() { return XScreen::get_position();} - virtual Point get_size() const { Point pt = {get_width(), get_height()}; return pt;} + virtual SpicePoint get_position() { return XScreen::get_position();} + virtual SpicePoint get_size() const { SpicePoint pt = {get_width(), get_height()}; return pt;} virtual bool is_out_of_sync() { return _out_of_sync;} virtual int get_screen_id() { return get_screen();} @@ -544,8 +544,8 @@ public: void publish_monitors(MonitorsList& monitors); virtual int get_depth() { return XPlatform::get_vinfo()[0]->depth;} - virtual Point get_position() { return XScreen::get_position();} - virtual Point get_size() const { Point pt = {get_width(), get_height()}; return pt;} + virtual SpicePoint get_position() { return XScreen::get_position();} + virtual SpicePoint get_size() const { SpicePoint pt = {get_width(), get_height()}; return pt;} virtual bool is_out_of_sync() { return _out_of_sync;} virtual int get_screen_id() { return get_screen();} @@ -694,8 +694,8 @@ public: private: void set_size(int width, int height); void get_trans_size(int& width, int& hight); - Point get_trans_top_left(); - Point get_trans_bottom_right(); + SpicePoint get_trans_top_left(); + SpicePoint get_trans_bottom_right(); bool changed(); XMonitor* crtc_overlap_test(int x, int y, int width, int height); @@ -722,8 +722,8 @@ public: virtual ~XMonitor(); virtual int get_depth(); - virtual Point get_position(); - virtual Point get_size() const; + virtual SpicePoint get_position(); + virtual SpicePoint get_size() const; virtual bool is_out_of_sync(); virtual int get_screen_id() { return _container.get_screen();} @@ -733,8 +733,8 @@ public: void enable(); void set_mode(const XRRModeInfo& mode); - const Rect& get_prev_area(); - Rect& get_trans_area(); + const SpiceRect& get_prev_area(); + SpiceRect& get_trans_area(); void pin() { _pin_count++;} void unpin() { ASSERT(_pin_count > 0); _pin_count--;} bool is_pinned() {return !!_pin_count;} @@ -763,15 +763,15 @@ private: MultyMonScreen& _container; RRCrtc _crtc; XMonitorsList _clones; - Point _position; - Point _size; + SpicePoint _position; + SpicePoint _size; RRMode _mode; Rotation _rotation; int _noutput; RROutput* _outputs; - Point _saved_position; - Point _saved_size; + SpicePoint _saved_position; + SpicePoint _saved_size; RRMode _saved_mode; Rotation _saved_rotation; @@ -780,7 +780,7 @@ private: RedSubpixelOrder _subpixel_order; int _trans_depth; - Rect _trans_area[MAX_TRANS_DEPTH]; + SpiceRect _trans_area[MAX_TRANS_DEPTH]; int _pin_count; XMonitor* _pusher; }; @@ -852,8 +852,8 @@ XMonitor* MultyMonScreen::crtc_overlap_test(int x, int y, int width, int height) for (; iter != _monitors.end(); iter++) { XMonitor* mon = *iter; - Point pos = mon->get_position(); - Point size = mon->get_size(); + SpicePoint pos = mon->get_position(); + SpicePoint size = mon->get_size(); if (x == pos.x && y == pos.y && width == size.x && height == size.y) { return mon; @@ -949,28 +949,28 @@ void MultyMonScreen::restore() X_DEBUG_SYNC(get_display()); } -Point MultyMonScreen::get_trans_top_left() +SpicePoint MultyMonScreen::get_trans_top_left() { - Point position; + SpicePoint position; position.y = position.x = MAXINT; XMonitorsList::iterator iter = _monitors.begin(); for (; iter != _monitors.end(); iter++) { - Rect& area = (*iter)->get_trans_area(); + SpiceRect& area = (*iter)->get_trans_area(); position.x = MIN(position.x, area.left); position.y = MIN(position.y, area.top); } return position; } -Point MultyMonScreen::get_trans_bottom_right() +SpicePoint MultyMonScreen::get_trans_bottom_right() { - Point position; + SpicePoint position; position.y = position.x = MININT; XMonitorsList::iterator iter = _monitors.begin(); for (; iter != _monitors.end(); iter++) { - Rect& area = (*iter)->get_trans_area(); + SpiceRect& area = (*iter)->get_trans_area(); position.x = MAX(position.x, area.right); position.y = MAX(position.y, area.bottom); } @@ -980,7 +980,7 @@ Point MultyMonScreen::get_trans_bottom_right() void MultyMonScreen::get_trans_size(int& width, int& height) { ASSERT(get_trans_top_left().x == 0 && get_trans_top_left().y == 0); - Point bottom_right = get_trans_bottom_right(); + SpicePoint bottom_right = get_trans_bottom_right(); ASSERT(bottom_right.x > 0 && bottom_right.y > 0); width = bottom_right.x; height = bottom_right.y; @@ -989,17 +989,17 @@ void MultyMonScreen::get_trans_size(int& width, int& height) #endif /*class Variant { - static void get_area_in_front(const Rect& base, int size, Rect& area) - static int get_push_distance(const Rect& fix_area, const Rect& other) - static int get_head(const Rect& area) - static int get_tail(const Rect& area) - static void move_head(Rect& area, int delta) - static int get_pull_distance(const Rect& fix_area, const Rect& other) - static void offset(Rect& area, int delta) - static void shrink(Rect& area, int delta) - static int get_distance(const Rect& area, const Rect& other_area) - static bool is_on_tail(const Rect& area, const Rect& other_area) - static bool is_on_perpendiculars(const Rect& area, const Rect& other_area) + static void get_area_in_front(const SpiceRect& base, int size, SpiceRect& area) + static int get_push_distance(const SpiceRect& fix_area, const SpiceRect& other) + static int get_head(const SpiceRect& area) + static int get_tail(const SpiceRect& area) + static void move_head(SpiceRect& area, int delta) + static int get_pull_distance(const SpiceRect& fix_area, const SpiceRect& other) + static void offset(SpiceRect& area, int delta) + static void shrink(SpiceRect& area, int delta) + static int get_distance(const SpiceRect& area, const SpiceRect& other_area) + static bool is_on_tail(const SpiceRect& area, const SpiceRect& other_area) + static bool is_on_perpendiculars(const SpiceRect& area, const SpiceRect& other_area) }*/ #ifdef USE_XRANDR_1_2 @@ -1017,7 +1017,7 @@ typedef std::multiset PushLeftSet; class LeftVariant { public: - static void get_area_in_front(const Rect& base, int size, Rect& area) + static void get_area_in_front(const SpiceRect& base, int size, SpiceRect& area) { area.right = base.left; area.left = area.right - size; @@ -1025,55 +1025,55 @@ public: area.top = base.top; } - static int get_push_distance(const Rect& fix_area, const Rect& other) + static int get_push_distance(const SpiceRect& fix_area, const SpiceRect& other) { return other.right - fix_area.left; } - static int get_head(const Rect& area) + static int get_head(const SpiceRect& area) { return area.left; } - static int get_tail(const Rect& area) + static int get_tail(const SpiceRect& area) { return area.right; } - static void move_head(Rect& area, int delta) + static void move_head(SpiceRect& area, int delta) { area.left -= delta; ASSERT(area.right >= area.left); } - static int get_pull_distance(const Rect& fix_area, const Rect& other) + static int get_pull_distance(const SpiceRect& fix_area, const SpiceRect& other) { return other.left - fix_area.right; } - static void offset(Rect& area, int delta) + static void offset(SpiceRect& area, int delta) { rect_offset(area, -delta, 0); } - static void shrink(Rect& area, int delta) + static void shrink(SpiceRect& area, int delta) { area.right -= delta; ASSERT(area.right > area.left); } - static int get_distance(const Rect& area, const Rect& other_area) + static int get_distance(const SpiceRect& area, const SpiceRect& other_area) { return other_area.left - area.left; } - static bool is_on_tail(const Rect& area, const Rect& other_area) + static bool is_on_tail(const SpiceRect& area, const SpiceRect& other_area) { return area.right == other_area.left && other_area.top < area.bottom && other_area.bottom > area.top; } - static bool is_on_perpendiculars(const Rect& area, const Rect& other_area) + static bool is_on_perpendiculars(const SpiceRect& area, const SpiceRect& other_area) { return (other_area.bottom == area.top || other_area.top == area.bottom) && other_area.left < area.right && other_area.right > area.left; @@ -1093,7 +1093,7 @@ typedef std::multiset PushRightSet; class RightVariant { public: - static void get_area_in_front(const Rect& base, int size, Rect& area) + static void get_area_in_front(const SpiceRect& base, int size, SpiceRect& area) { area.left = base.right; area.right = area.left + size; @@ -1101,44 +1101,44 @@ public: area.bottom = base.bottom; } - static int get_push_distance(const Rect& fix_area, const Rect& other) + static int get_push_distance(const SpiceRect& fix_area, const SpiceRect& other) { return fix_area.right - other.left; } - static int get_head(const Rect& area) + static int get_head(const SpiceRect& area) { return area.right; } - static int get_tail(const Rect& area) + static int get_tail(const SpiceRect& area) { return area.left; } - static void move_head(Rect& area, int delta) + static void move_head(SpiceRect& area, int delta) { area.right += delta; ASSERT(area.right >= area.left); } - static int get_pull_distance(const Rect& fix_area, const Rect& other) + static int get_pull_distance(const SpiceRect& fix_area, const SpiceRect& other) { return fix_area.left - other.right; } - static void offset(Rect& area, int delta) + static void offset(SpiceRect& area, int delta) { rect_offset(area, delta, 0); } - static bool is_on_tail(const Rect& area, const Rect& other_area) + static bool is_on_tail(const SpiceRect& area, const SpiceRect& other_area) { return other_area.right == area.left && other_area.top < area.bottom && other_area.bottom > area.top; } - static bool is_on_perpendiculars(const Rect& area, const Rect& other_area) + static bool is_on_perpendiculars(const SpiceRect& area, const SpiceRect& other_area) { return (other_area.bottom == area.top || other_area.top == area.bottom) && other_area.left < area.right && other_area.right > area.left; @@ -1157,7 +1157,7 @@ typedef std::multiset PushTopSet; class TopVariant { public: - static void get_area_in_front(const Rect& base, int size, Rect& area) + static void get_area_in_front(const SpiceRect& base, int size, SpiceRect& area) { area.left = base.left; area.right = base.right; @@ -1165,55 +1165,55 @@ public: area.top = area.bottom - size; } - static int get_push_distance(const Rect& fix_area, const Rect& other) + static int get_push_distance(const SpiceRect& fix_area, const SpiceRect& other) { return other.bottom - fix_area.top; } - static int get_head(const Rect& area) + static int get_head(const SpiceRect& area) { return area.top; } - static int get_tail(const Rect& area) + static int get_tail(const SpiceRect& area) { return area.bottom; } - static void move_head(Rect& area, int delta) + static void move_head(SpiceRect& area, int delta) { area.top -= delta; ASSERT(area.bottom >= area.top); } - static int get_pull_distance(const Rect& fix_area, const Rect& other) + static int get_pull_distance(const SpiceRect& fix_area, const SpiceRect& other) { return other.top - fix_area.bottom; } - static void offset(Rect& area, int delta) + static void offset(SpiceRect& area, int delta) { rect_offset(area, 0, -delta); } - static void shrink(Rect& area, int delta) + static void shrink(SpiceRect& area, int delta) { area.bottom -= delta; ASSERT(area.bottom > area.top); } - static int get_distance(const Rect& area, const Rect& other_area) + static int get_distance(const SpiceRect& area, const SpiceRect& other_area) { return other_area.top - area.top; } - static bool is_on_tail(const Rect& area, const Rect& other_area) + static bool is_on_tail(const SpiceRect& area, const SpiceRect& other_area) { return area.bottom == other_area.top && other_area.left < area.right && other_area.right > area.left; } - static bool is_on_perpendiculars(const Rect& area, const Rect& other_area) + static bool is_on_perpendiculars(const SpiceRect& area, const SpiceRect& other_area) { return (other_area.right == area.left || other_area.left == area.right) && other_area.top < area.bottom && other_area.bottom > area.top; @@ -1233,7 +1233,7 @@ typedef std::multiset PushBottomSet; class BottomVariant { public: - static void get_area_in_front(const Rect& base, int size, Rect& area) + static void get_area_in_front(const SpiceRect& base, int size, SpiceRect& area) { area.left = base.left; area.right = base.right; @@ -1241,44 +1241,44 @@ public: area.bottom = area.top + size; } - static int get_push_distance(const Rect& fix_area, const Rect& other) + static int get_push_distance(const SpiceRect& fix_area, const SpiceRect& other) { return fix_area.bottom - other.top; } - static int get_head(const Rect& area) + static int get_head(const SpiceRect& area) { return area.bottom; } - static int get_tail(const Rect& area) + static int get_tail(const SpiceRect& area) { return area.top; } - static void move_head(Rect& area, int delta) + static void move_head(SpiceRect& area, int delta) { area.bottom += delta; ASSERT(area.bottom >= area.top); } - static int get_pull_distance(const Rect& fix_area, const Rect& other) + static int get_pull_distance(const SpiceRect& fix_area, const SpiceRect& other) { return fix_area.top - other.bottom; } - static void offset(Rect& area, int delta) + static void offset(SpiceRect& area, int delta) { rect_offset(area, 0, delta); } - static bool is_on_tail(const Rect& area, const Rect& other_area) + static bool is_on_tail(const SpiceRect& area, const SpiceRect& other_area) { return other_area.bottom == area.top && other_area.left < area.right && other_area.right > area.left; } - static bool is_on_perpendiculars(const Rect& area, const Rect& other_area) + static bool is_on_perpendiculars(const SpiceRect& area, const SpiceRect& other_area) { return (other_area.right == area.left || other_area.left == area.right) && other_area.top < area.bottom && other_area.bottom > area.top; @@ -1294,7 +1294,7 @@ static void bounce_back(XMonitor& monitor, const XMonitorsList& monitors, int he while (wait_for_me); for (XMonitorsList::const_iterator iter = monitors.begin(); iter != monitors.end(); iter++) { - Rect& area = (*iter)->get_trans_area(); + SpiceRect& area = (*iter)->get_trans_area(); if (Variant::get_tail(area) == head && (*iter)->get_pusher() == &monitor) { Variant::offset(area, -distance); bounce_back(**iter, monitors, Variant::get_head(area) + distance, distance); @@ -1318,13 +1318,13 @@ static int push(XMonitor& pusher, XMonitor& monitor, const XMonitorsList& monito sort.insert(*iter); } - Rect area_to_clear; + SpiceRect area_to_clear; Variant::get_area_in_front(monitor.get_trans_area(), delta, area_to_clear); SortListIter sort_iter = sort.begin(); for (; sort_iter != sort.end(); sort_iter++) { - const Rect& other_area = (*sort_iter)->get_trans_area(); + const SpiceRect& other_area = (*sort_iter)->get_trans_area(); if (rect_intersects(area_to_clear, other_area)) { int distance = Variant::get_push_distance(area_to_clear, other_area); @@ -1343,13 +1343,13 @@ static int push(XMonitor& pusher, XMonitor& monitor, const XMonitorsList& monito } Variant::offset(monitor.get_trans_area(), delta); - const Rect& area = monitor.get_prev_area(); + const SpiceRect& area = monitor.get_prev_area(); for (iter = monitors.begin(); iter != monitors.end(); iter++) { if ((*iter)->is_pinned()) { continue; } - const Rect& other_area = (*iter)->get_prev_area(); + const SpiceRect& other_area = (*iter)->get_prev_area(); if (Variant::is_on_perpendiculars(area, other_area)) { int current_distance = Variant::get_pull_distance(monitor.get_trans_area(), (*iter)->get_trans_area()); @@ -1371,10 +1371,10 @@ static int push(XMonitor& pusher, XMonitor& monitor, const XMonitorsList& monito template static void pin(XMonitor& monitor, const XMonitorsList& monitors) { - const Rect& area = monitor.get_trans_area(); + const SpiceRect& area = monitor.get_trans_area(); for (XMonitorsList::const_iterator iter = monitors.begin(); iter != monitors.end(); iter++) { - const Rect& other_area = (*iter)->get_trans_area(); + const SpiceRect& other_area = (*iter)->get_trans_area(); if ((*iter)->is_pinned()) { continue; } @@ -1402,10 +1402,10 @@ static void shrink(XMonitor& monitor, const XMonitorsList& monitors, int delta) sort.insert(*iter); } - const Rect area = monitor.get_trans_area(); + const SpiceRect area = monitor.get_trans_area(); Variant::shrink(monitor.get_trans_area(), delta); for (SortListIter sort_iter = sort.begin(); sort_iter != sort.end(); sort_iter++) { - const Rect& other_area = (*sort_iter)->get_trans_area(); + const SpiceRect& other_area = (*sort_iter)->get_trans_area(); if (Variant::is_on_perpendiculars(area, other_area)) { int distance = Variant::get_distance(area, other_area); if (distance > 0) { @@ -1433,11 +1433,11 @@ static void expand(XMonitor& monitor, const XMonitorsList& monitors, int delta) sort.insert(*iter); } - Rect area_to_clear; + SpiceRect area_to_clear; Variant::get_area_in_front(monitor.get_trans_area(), delta, area_to_clear); for (SortListIter sort_iter = sort.begin(); sort_iter != sort.end(); sort_iter++) { - const Rect& other_area = (*sort_iter)->get_trans_area(); + const SpiceRect& other_area = (*sort_iter)->get_trans_area(); if (rect_intersects(area_to_clear, other_area)) { int distance = Variant::get_push_distance(area_to_clear, other_area); @@ -1459,7 +1459,7 @@ bool MultyMonScreen::set_monitor_mode(XMonitor& monitor, const XRRModeInfo& mode return false; } - Point size = monitor.get_size(); + SpicePoint size = monitor.get_size(); int dx = mode_info.width - size.x; int dy = mode_info.height - size.y; @@ -1790,12 +1790,12 @@ int XMonitor::get_depth() return XPlatform::get_vinfo()[0]->depth; } -Point XMonitor::get_position() +SpicePoint XMonitor::get_position() { return _position; } -Point XMonitor::get_size() const +SpicePoint XMonitor::get_size() const { return _size; } @@ -1810,12 +1810,12 @@ void XMonitor::add_clone(XMonitor *clone) _clones.push_back(clone); } -const Rect& XMonitor::get_prev_area() +const SpiceRect& XMonitor::get_prev_area() { return _trans_area[_trans_depth - 1]; } -Rect& XMonitor::get_trans_area() +SpiceRect& XMonitor::get_trans_area() { return _trans_area[_trans_depth]; } @@ -2357,8 +2357,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(); Window root_window = RootWindow(x_display, DefaultScreen(x_display)); XWarpPointer(x_display, None, root_window, 0, 0, 0, 0, pos.x + size.x / 2, pos.y + size.y / 2); } @@ -2434,7 +2434,7 @@ static inline uint32_t get_pix_hack(int pix_index, int width) XLocalCursor::XLocalCursor(CursorData* cursor_data) { - const CursorHeader& header = cursor_data->header(); + const SpiceCursorHeader& header = cursor_data->header(); const uint8_t* data = cursor_data->data(); int cur_size = header.width * header.height; uint8_t pix_mask; @@ -2449,9 +2449,9 @@ XLocalCursor::XLocalCursor(CursorData* cursor_data) uint32_t* cur_data = new uint32_t[cur_size]; switch (header.type) { - case CURSOR_TYPE_ALPHA: + case SPICE_CURSOR_TYPE_ALPHA: break; - case CURSOR_TYPE_COLOR32: + case SPICE_CURSOR_TYPE_COLOR32: memcpy(cur_data, data, cur_size * sizeof(uint32_t)); for (i = 0; i < cur_size; i++) { pix_mask = get_pix_mask(data, size, i); @@ -2462,7 +2462,7 @@ XLocalCursor::XLocalCursor(CursorData* cursor_data) } } break; - case CURSOR_TYPE_COLOR16: + case SPICE_CURSOR_TYPE_COLOR16: for (i = 0; i < cur_size; i++) { pix_mask = get_pix_mask(data, size, i); pix = *((uint16_t*)data + i); @@ -2474,7 +2474,7 @@ XLocalCursor::XLocalCursor(CursorData* cursor_data) } } break; - case CURSOR_TYPE_MONO: + case SPICE_CURSOR_TYPE_MONO: for (i = 0; i < cur_size; i++) { pix_mask = get_pix_mask(data, 0, i); pix = get_pix_mask(data, size, i); @@ -2485,7 +2485,7 @@ XLocalCursor::XLocalCursor(CursorData* cursor_data) } } break; - case CURSOR_TYPE_COLOR4: + case SPICE_CURSOR_TYPE_COLOR4: for (i = 0; i < cur_size; i++) { pix_mask = get_pix_mask(data, size + (sizeof(uint32_t) << 4), i); int idx = (i & 1) ? (data[i >> 1] & 0x0f) : ((data[i >> 1] & 0xf0) >> 4); @@ -2497,8 +2497,8 @@ XLocalCursor::XLocalCursor(CursorData* cursor_data) } } 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 = XCreateFontCursor(x_display, XC_arrow); @@ -2510,7 +2510,7 @@ XLocalCursor::XLocalCursor(CursorData* cursor_data) memset(&image, 0, sizeof(image)); image.width = header.width; image.height = header.height; - image.data = (header.type == CURSOR_TYPE_ALPHA ? (char*)data : (char*)cur_data); + image.data = (header.type == SPICE_CURSOR_TYPE_ALPHA ? (char*)data : (char*)cur_data); image.byte_order = LSBFirst; image.bitmap_unit = 32; image.bitmap_bit_order = LSBFirst; diff --git a/client/x11/red_drawable.cpp b/client/x11/red_drawable.cpp index 4436152b..7485c94d 100644 --- a/client/x11/red_drawable.cpp +++ b/client/x11/red_drawable.cpp @@ -28,8 +28,8 @@ #include static inline void copy_to_gldrawable_from_gltexture(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -90,8 +90,8 @@ static inline void copy_to_gldrawable_from_gltexture(const RedDrawable_p* dest, } static inline void copy_to_gldrawable_from_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -134,8 +134,8 @@ static inline void copy_to_gldrawable_from_pixmap(const RedDrawable_p* dest, } static inline void copy_to_drawable_from_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -151,8 +151,8 @@ static inline void copy_to_drawable_from_drawable(const RedDrawable_p* dest, } static inline void copy_to_drawable_from_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -167,8 +167,8 @@ static inline void copy_to_drawable_from_pixmap(const RedDrawable_p* dest, } static inline void copy_to_drawable_from_shmdrawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -184,8 +184,8 @@ static inline void copy_to_drawable_from_shmdrawable(const RedDrawable_p* dest, } static inline void copy_to_x_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -205,8 +205,8 @@ static inline void copy_to_x_drawable(const RedDrawable_p* dest, } static inline void copy_to_gl_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -223,8 +223,8 @@ static inline void copy_to_gl_drawable(const RedDrawable_p* dest, } static inline void copy_to_pixmap_from_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -232,8 +232,8 @@ static inline void copy_to_pixmap_from_drawable(const RedDrawable_p* dest, } static inline void copy_to_pixmap_from_shmdrawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -252,8 +252,8 @@ static inline void copy_to_pixmap_from_shmdrawable(const RedDrawable_p* dest, } static inline void copy_to_pixmap_from_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -272,8 +272,8 @@ static inline void copy_to_pixmap_from_pixmap(const RedDrawable_p* dest, } static inline void copy_to_pixmap_from_gltexture(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -316,8 +316,8 @@ static inline void copy_to_pixmap_from_gltexture(const RedDrawable_p* dest, } static inline void copy_to_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -339,7 +339,7 @@ static inline void copy_to_pixmap(const RedDrawable_p* dest, } } -void RedDrawable::copy_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& area) +void RedDrawable::copy_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& area) { PixelsSource_p* source = (PixelsSource_p*)src.get_opaque(); RedDrawable_p* dest = (RedDrawable_p*)get_opaque(); @@ -361,8 +361,8 @@ void RedDrawable::copy_pixels(const PixelsSource& src, int src_x, int src_y, con } static inline void blend_to_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -370,8 +370,8 @@ static inline void blend_to_drawable(const RedDrawable_p* dest, } static inline void blend_to_pixmap_from_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -379,8 +379,8 @@ static inline void blend_to_pixmap_from_drawable(const RedDrawable_p* dest, } static inline void blend_to_pixmap_from_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -399,8 +399,8 @@ static inline void blend_to_pixmap_from_pixmap(const RedDrawable_p* dest, } static inline void blend_to_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y) { @@ -416,7 +416,7 @@ static inline void blend_to_pixmap(const RedDrawable_p* dest, } } -void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& area) +void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& area) { PixelsSource_p* source = (PixelsSource_p*)src.get_opaque(); RedDrawable_p* dest = (RedDrawable_p*)get_opaque(); @@ -434,8 +434,8 @@ void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, co } static inline void combine_to_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y, RedDrawable::CombineOP op) @@ -444,8 +444,8 @@ static inline void combine_to_drawable(const RedDrawable_p* dest, } static inline void combine_to_pixmap_from_drawable(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y, RedDrawable::CombineOP op) @@ -454,8 +454,8 @@ static inline void combine_to_pixmap_from_drawable(const RedDrawable_p* dest, } static inline void combine_to_pixmap_from_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y, RedDrawable::CombineOP op) @@ -499,8 +499,8 @@ static inline void combine_to_pixmap_from_pixmap(const RedDrawable_p* dest, } static inline void combine_to_pixmap(const RedDrawable_p* dest, - const Rect& area, - const Point& offset, + const SpiceRect& area, + const SpicePoint& offset, const PixelsSource_p* source, int src_x, int src_y, RedDrawable::CombineOP op) @@ -517,7 +517,7 @@ static inline void combine_to_pixmap(const RedDrawable_p* dest, } } -void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y, const Rect& area, +void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y, const SpiceRect& area, CombineOP op) { PixelsSource_p* source = (PixelsSource_p*)src.get_opaque(); @@ -536,13 +536,13 @@ void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y, } } -void RedDrawable::erase_rect(const Rect& area, rgb32_t color) +void RedDrawable::erase_rect(const SpiceRect& area, rgb32_t color) { LOG_WARN("not implemented"); } -static inline void fill_drawable(RedDrawable_p* dest, const Rect& area, rgb32_t color, - const Point& offset) +static inline void fill_drawable(RedDrawable_p* dest, const SpiceRect& area, rgb32_t color, + const SpicePoint& offset) { Drawable drawable = dest->source.x_drawable.drawable; GC gc = dest->source.x_drawable.gc; @@ -569,8 +569,8 @@ static inline void fill_drawable(RedDrawable_p* dest, const Rect& area, rgb32_t area.right - area.left, area.bottom - area.top); } -static inline void fill_gl_drawable(RedDrawable_p* dest, const Rect& area, rgb32_t color, - const Point& offset) +static inline void fill_gl_drawable(RedDrawable_p* dest, const SpiceRect& area, rgb32_t color, + const SpicePoint& offset) { int vertex_x1, vertex_x2; int vertex_y1, vertex_y2; @@ -603,8 +603,8 @@ static inline void fill_gl_drawable(RedDrawable_p* dest, const Rect& area, rgb32 glColor3f(1, 1, 1); } -static inline void fill_pixmap(RedDrawable_p* dest, const Rect& area, rgb32_t color, - const Point& offset) +static inline void fill_pixmap(RedDrawable_p* dest, const SpiceRect& area, rgb32_t color, + const SpicePoint& offset) { cairo_t* cairo = dest->cairo; @@ -619,7 +619,7 @@ static inline void fill_pixmap(RedDrawable_p* dest, const Rect& area, rgb32_t co cairo_fill(cairo); } -void RedDrawable::fill_rect(const Rect& area, rgb32_t color) +void RedDrawable::fill_rect(const SpiceRect& area, rgb32_t color) { RedDrawable_p* dest = (RedDrawable_p*)get_opaque(); switch (dest->source.type) { @@ -637,8 +637,8 @@ void RedDrawable::fill_rect(const Rect& area, rgb32_t color) } } -static inline void frame_drawable(RedDrawable_p* dest, const Rect& area, rgb32_t color, - const Point& offset) +static inline void frame_drawable(RedDrawable_p* dest, const SpiceRect& area, rgb32_t color, + const SpicePoint& offset) { Drawable drawable = dest->source.x_drawable.drawable; GC gc = dest->source.x_drawable.gc; @@ -665,8 +665,8 @@ static inline void frame_drawable(RedDrawable_p* dest, const Rect& area, rgb32_t area.right - area.left, area.bottom - area.top); } -static inline void frame_pixmap(RedDrawable_p* dest, const Rect& area, rgb32_t color, - const Point& offset) +static inline void frame_pixmap(RedDrawable_p* dest, const SpiceRect& area, rgb32_t color, + const SpicePoint& offset) { cairo_t* cairo = dest->cairo; @@ -682,7 +682,7 @@ static inline void frame_pixmap(RedDrawable_p* dest, const Rect& area, rgb32_t c cairo_stroke(cairo); } -void RedDrawable::frame_rect(const Rect& area, rgb32_t color) +void RedDrawable::frame_rect(const SpiceRect& area, rgb32_t color) { RedDrawable_p* dest = (RedDrawable_p*)get_opaque(); switch (dest->source.type) { diff --git a/client/x11/red_pixmap_gl.cpp b/client/x11/red_pixmap_gl.cpp index 886bb0b3..3ed5f73c 100644 --- a/client/x11/red_pixmap_gl.cpp +++ b/client/x11/red_pixmap_gl.cpp @@ -173,7 +173,7 @@ void RedPixmapGL::touch_context() GLC_ERROR_TEST_FLUSH; } -void RedPixmapGL::update_texture(const Rect *bbox) +void RedPixmapGL::update_texture(const SpiceRect *bbox) { RenderType rendertype; GLuint tex; diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp index 795a7bbd..14394982 100644 --- a/client/x11/red_window.cpp +++ b/client/x11/red_window.cpp @@ -672,37 +672,37 @@ static inline RedKey to_red_key_code(unsigned int keycode) static inline int to_red_buttons_state(unsigned int state) { - return ((state & Button1Mask) ? REDC_LBUTTON_MASK : 0) | - ((state & Button2Mask) ? REDC_MBUTTON_MASK : 0) | - ((state & Button3Mask) ? REDC_RBUTTON_MASK : 0); + return ((state & Button1Mask) ? SPICE_MOUSE_BUTTON_MASK_LEFT : 0) | + ((state & Button2Mask) ? SPICE_MOUSE_BUTTON_MASK_MIDDLE : 0) | + ((state & Button3Mask) ? SPICE_MOUSE_BUTTON_MASK_RIGHT : 0); } -static inline RedButton to_red_button(unsigned int botton, unsigned int& state, bool press) +static inline SpiceMouseButton to_red_button(unsigned int botton, unsigned int& state, bool press) { unsigned int mask = 0; - RedButton ret; + SpiceMouseButton ret; switch (botton) { case Button1: - mask = REDC_LBUTTON_MASK; - ret = REDC_MOUSE_LBUTTON; + mask = SPICE_MOUSE_BUTTON_MASK_LEFT; + ret = SPICE_MOUSE_BUTTON_LEFT; break; case Button2: - mask = REDC_MBUTTON_MASK; - ret = REDC_MOUSE_MBUTTON; + mask = SPICE_MOUSE_BUTTON_MASK_MIDDLE; + ret = SPICE_MOUSE_BUTTON_MIDDLE; break; case Button3: - mask = REDC_RBUTTON_MASK; - ret = REDC_MOUSE_RBUTTON; + mask = SPICE_MOUSE_BUTTON_MASK_RIGHT; + ret = SPICE_MOUSE_BUTTON_RIGHT; break; case Button4: - ret = REDC_MOUSE_UBUTTON; + ret = SPICE_MOUSE_BUTTON_UP; break; case Button5: - ret = REDC_MOUSE_DBUTTON; + ret = SPICE_MOUSE_BUTTON_DOWN; break; default: - ret = REDC_MOUSE_INVALID_BUTTON; + ret = SPICE_MOUSE_BUTTON_INVALID; } if (press) { state |= mask; @@ -766,10 +766,10 @@ void RedWindow_p::win_proc(XEvent& event) red_window = (RedWindow*)window_pointer; switch (event.type) { case MotionNotify: { - Point size = red_window->get_size(); + SpicePoint size = red_window->get_size(); if (event.xmotion.x >= 0 && event.xmotion.y >= 0 && event.xmotion.x < size.x && event.xmotion.y < size.y) { - Point origin = red_window->get_origin(); + SpicePoint origin = red_window->get_origin(); red_window->get_listener().on_pointer_motion(event.xmotion.x - origin.x, event.xmotion.y - origin.y, to_red_buttons_state(event.xmotion.state)); @@ -797,8 +797,8 @@ void RedWindow_p::win_proc(XEvent& event) } case ButtonPress: { unsigned int state = to_red_buttons_state(event.xbutton.state); - RedButton button = to_red_button(event.xbutton.button, state, true); - if (button == REDC_MOUSE_INVALID_BUTTON) { + SpiceMouseButton button = to_red_button(event.xbutton.button, state, true); + if (button == SPICE_MOUSE_BUTTON_INVALID) { DBG(0, "ButtonPress: invalid button %u", event.xbutton.button); break; } @@ -807,8 +807,8 @@ void RedWindow_p::win_proc(XEvent& event) } case ButtonRelease: { unsigned int state = to_red_buttons_state(event.xbutton.state); - RedButton button = to_red_button(event.xbutton.button, state, false); - if (button == REDC_MOUSE_INVALID_BUTTON) { + SpiceMouseButton button = to_red_button(event.xbutton.button, state, false); + if (button == SPICE_MOUSE_BUTTON_INVALID) { DBG(0, "ButtonRelease: invalid button %u", event.xbutton.button); break; } @@ -816,8 +816,8 @@ void RedWindow_p::win_proc(XEvent& event) break; } case Expose: { - Point origin; - Rect area; + SpicePoint origin; + SpiceRect area; origin = red_window->get_origin(); area.left = event.xexpose.x - origin.x; @@ -887,7 +887,7 @@ void RedWindow_p::win_proc(XEvent& event) break; case EnterNotify: if (!red_window->_ignore_pointer) { - Point origin = red_window->get_origin(); + SpicePoint origin = red_window->get_origin(); red_window->on_pointer_enter(event.xcrossing.x - origin.x, event.xcrossing.y - origin.y, to_red_buttons_state(event.xcrossing.state)); } else { @@ -1560,7 +1560,7 @@ void RedWindow::minimize() sync(); } -static bool __get_position(Window window, Point& pos) +static bool __get_position(Window window, SpicePoint& pos) { pos.x = pos.y = 0; for (;;) { @@ -1592,9 +1592,9 @@ static bool __get_position(Window window, Point& pos) return true; } -Point RedWindow::get_position() +SpicePoint RedWindow::get_position() { - Point pos; + SpicePoint pos; AutoXErrorHandler auto_error_handler; int get_position_retries = GET_POSITION_RETRIES; @@ -1719,17 +1719,17 @@ void RedWindow::set_mouse_position(int x, int y) XWarpPointer(x_display, None, _win, 0, 0, 0, 0, x + get_origin().x, y + get_origin().y); } -Point RedWindow::get_size() +SpicePoint RedWindow::get_size() { XWindowAttributes attrib; XGetWindowAttributes(x_display, _win, &attrib); - Point size; + SpicePoint size; size.x = attrib.width; size.y = attrib.height; return size; } -static void window_area_from_attributes(Rect& area, XWindowAttributes& attrib) +static void window_area_from_attributes(SpiceRect& area, XWindowAttributes& attrib) { area.left = attrib.x; area.right = area.left + attrib.width; @@ -1760,7 +1760,7 @@ static QRegion *get_visibale_region(Window window) return region; } - Rect window_area; + SpiceRect window_area; window_area_from_attributes(window_area, attrib); window_area.right -= window_area.left; window_area.bottom -= window_area.top; @@ -1830,7 +1830,7 @@ public: Region_p(QRegion* region) : _region (region) {} ~Region_p() { delete _region;} - void get_bbox(Rect& bbox) const + void get_bbox(SpiceRect& bbox) const { if (region_is_empty(_region)) { bbox.left = bbox.right = bbox.top = bbox.bottom = 0; @@ -1848,7 +1848,7 @@ private: QRegion* _region; }; -bool RedWindow::get_mouse_anchor_point(Point& pt) +bool RedWindow::get_mouse_anchor_point(SpicePoint& pt) { QRegion* vis_region; int vis_region_retries = GET_VIS_REGION_RETRIES; @@ -1869,7 +1869,7 @@ bool RedWindow::get_mouse_anchor_point(Point& pt) if (!find_anchor_point(region, pt)) { return false; } - Point position = get_position(); + SpicePoint position = get_position(); pt.x -= (position.x + get_origin().x); pt.y -= (position.y + get_origin().y); return true; diff --git a/client/x11/red_window_p.h b/client/x11/red_window_p.h index df306344..e630b618 100644 --- a/client/x11/red_window_p.h +++ b/client/x11/red_window_p.h @@ -58,7 +58,7 @@ protected: Cursor _invisible_cursor; bool _visibale; bool _expect_parent; - Point _show_pos; + SpicePoint _show_pos; GLXContext _glcont_copy; Icon* _icon; bool _focused; -- cgit