summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-02-04 18:04:26 +0100
committerAlexander Larsson <alexl@redhat.com>2010-02-04 18:49:00 +0100
commit1f516978527b223882c02d8c23834a0f30279dec (patch)
tree7472bb21b145c2c586a3ad7aebb7bd136cef9e70
parentc1694fb51bb29d3cbd03f679372339f9e8f29803 (diff)
downloadspice-1f516978527b223882c02d8c23834a0f30279dec.tar.gz
spice-1f516978527b223882c02d8c23834a0f30279dec.tar.xz
spice-1f516978527b223882c02d8c23834a0f30279dec.zip
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
-rw-r--r--client/application.cpp70
-rw-r--r--client/application.h4
-rw-r--r--client/canvas.cpp98
-rw-r--r--client/canvas.h88
-rw-r--r--client/cursor.cpp32
-rw-r--r--client/cursor.h8
-rw-r--r--client/cursor_channel.cpp144
-rw-r--r--client/cursor_channel.h6
-rw-r--r--client/display_channel.cpp250
-rw-r--r--client/display_channel.h4
-rw-r--r--client/glz_decode_tmpl.c2
-rw-r--r--client/glz_decoder.cpp4
-rw-r--r--client/glz_decoder.h2
-rw-r--r--client/gui/gui.cpp44
-rw-r--r--client/gui/resource_provider.cpp4
-rw-r--r--client/gui/resource_provider.h4
-rw-r--r--client/gui/softrenderer.cpp16
-rw-r--r--client/gui/softrenderer.h10
-rw-r--r--client/gui/softtexture.cpp6
-rw-r--r--client/gui/softtexture.h6
-rw-r--r--client/inputs_channel.cpp90
-rw-r--r--client/inputs_channel.h4
-rw-r--r--client/monitor.h4
-rw-r--r--client/pixels_source.h10
-rw-r--r--client/playback_channel.cpp78
-rw-r--r--client/record_channel.cpp64
-rw-r--r--client/red_cairo_canvas.cpp32
-rw-r--r--client/red_cairo_canvas.h30
-rw-r--r--client/red_channel.cpp76
-rw-r--r--client/red_channel.h8
-rw-r--r--client/red_client.cpp122
-rw-r--r--client/red_client.h6
-rw-r--r--client/red_drawable.h12
-rw-r--r--client/red_gdi_canvas.cpp30
-rw-r--r--client/red_gdi_canvas.h28
-rw-r--r--client/red_gl_canvas.cpp30
-rw-r--r--client/red_gl_canvas.h28
-rw-r--r--client/red_peer.cpp8
-rw-r--r--client/red_peer.h6
-rw-r--r--client/red_pixmap.h2
-rw-r--r--client/red_pixmap_gl.h2
-rw-r--r--client/red_window.h22
-rw-r--r--client/screen.cpp24
-rw-r--r--client/screen.h24
-rw-r--r--client/screen_layer.cpp14
-rw-r--r--client/screen_layer.h10
-rw-r--r--client/tunnel_channel.cpp144
-rw-r--r--client/windows/pixels_source.cpp8
-rw-r--r--client/windows/platform.cpp32
-rw-r--r--client/windows/red_drawable.cpp12
-rw-r--r--client/windows/red_window.cpp50
-rw-r--r--client/x11/pixels_source.cpp8
-rw-r--r--client/x11/platform.cpp208
-rw-r--r--client/x11/red_drawable.cpp112
-rw-r--r--client/x11/red_pixmap_gl.cpp2
-rw-r--r--client/x11/red_window.cpp66
-rw-r--r--client/x11/red_window_p.h2
-rw-r--r--common/cairo_canvas.c336
-rw-r--r--common/cairo_canvas.h36
-rw-r--r--common/canvas_base.c232
-rw-r--r--common/canvas_base.h8
-rw-r--r--common/gdi_canvas.c234
-rw-r--r--common/gdi_canvas.h30
-rw-r--r--common/gl_canvas.c146
-rw-r--r--common/gl_canvas.h32
-rw-r--r--common/lz.c4
-rw-r--r--common/lz.h2
-rw-r--r--common/rect.h28
-rw-r--r--common/region.c112
-rw-r--r--common/region.h10
-rw-r--r--common/rop3.c24
-rw-r--r--common/rop3.h6
-rw-r--r--server/red_channel.c16
-rw-r--r--server/red_channel.h22
-rw-r--r--server/red_client_cache.h4
-rw-r--r--server/red_client_shared_cache.h8
-rw-r--r--server/red_dispatcher.c4
-rw-r--r--server/red_tunnel_worker.c224
-rw-r--r--server/red_worker.c792
-rw-r--r--server/red_yuv.h4
-rw-r--r--server/reds.c472
-rw-r--r--server/snd_worker.c138
-rw-r--r--server/vd_interface.h2
-rw-r--r--tools/reds_stat.c24
84 files changed, 2580 insertions, 2580 deletions
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(&copy.data.src_bitmap);
localalize_mask(copy.data.mask);
draw_copy(&copy.base.box, &copy.base.clip, &copy.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(&copy.base.box, &copy.base.clip, &copy.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<PaletteCache*>(opaque);
AutoRef<CachedPalette> 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<PaletteCache*>(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<GlzDecoder*>(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<cairo_surface_t, PixmapCacheTreat, 1024> 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<RedPixmap> _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<RedPixmap> _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<RedPixmap> _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<CursorChannel, RED_CURSOR_MESSAGES_END> {
+class CursorHandler: public MessageHandlerImp<CursorChannel, SPICE_MSG_END_CURSOR> {
public:
CursorHandler(CursorChannel& channel)
- : MessageHandlerImp<CursorChannel, RED_CURSOR_MESSAGES_END>(channel) {}
+ : MessageHandlerImp<CursorChannel, SPICE_MSG_END_CURSOR>(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<CursorHandler*>(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<DisplayChannel, RED_DISPLAY_MESSAGES_END> {
+class DisplayHandler: public MessageHandlerImp<DisplayChannel, SPICE_MSG_END_DISPLAY> {
public:
DisplayHandler(DisplayChannel& channel)
- : MessageHandlerImp<DisplayChannel, RED_DISPLAY_MESSAGES_END>(channel) {}
+ : MessageHandlerImp<DisplayChannel, SPICE_MSG_END_DISPLAY>(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<DisplayHandler*>(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<DisplayHandler*>(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<DisplayHandler*>(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<CursorChannel&>(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<InputsChannel&>(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<CursorChannel&>(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<int>& 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> _canvas;
@@ -197,7 +197,7 @@ private:
bool _capture_mouse_mode;
InputsChannel* _inputs_channel;
- Point _pointer_pos;
+ SpicePoint _pointer_pos;
int _buttons_state;
std::vector<VideoStream*> _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 <in file name> | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$d"
//| sed -e"\$s/,$/};/") > <out file name>.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<SoftRenderer*>(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<DisplayChannel&>(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<DisplayChannel&>(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<InputsChannel, RED_INPUTS_MESSAGES_END> {
+class InputsMessHandler: public MessageHandlerImp<InputsChannel, SPICE_MSG_END_INPUTS> {
public:
InputsMessHandler(InputsChannel& channel)
- : MessageHandlerImp<InputsChannel, RED_INPUTS_MESSAGES_END>(channel) {}
+ : MessageHandlerImp<InputsChannel, SPICE_MSG_END_INPUTS>(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<InputsMessHandler*>(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<SetInputsHandlerEvent> 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<PlaybackChannel, RED_PLAYBACK_MESSAGES_END> {
+class PlaybackHandler: public MessageHandlerImp<PlaybackChannel, SPICE_MSG_END_PLAYBACK> {
public:
PlaybackHandler(PlaybackChannel& channel)
- : MessageHandlerImp<PlaybackChannel, RED_PLAYBACK_MESSAGES_END>(channel) {}
+ : MessageHandlerImp<PlaybackChannel, SPICE_MSG_END_PLAYBACK>(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<PlaybackHandler*>(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<PlaybackHandler*>(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<PlaybackHandler*>(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<PlaybackHandler*>(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<PlaybackHandler*>(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<PlaybackHandler*>(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<RecordChannel, REDC_RECORD_MESSAGES_END> {
+class RecordHandler: public MessageHandlerImp<RecordChannel, SPICE_MSGC_END_RECORD> {
public:
RecordHandler(RecordChannel& channel)
- : MessageHandlerImp<RecordChannel, REDC_RECORD_MESSAGES_END>(channel) {}
+ : MessageHandlerImp<RecordChannel, SPICE_MSGC_END_RECORD>(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<RecordHandler*>(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<RecordHandler*>(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<RecordHandler*>(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 = &region.rects[i];
+ SpiceRect* r = &region.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<uint8_t> 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<RedPeer::OutMessage> message(new RedPeer::OutMessage(REDC_MIGRATE_FLUSH_MARK, 0));
+ std::auto_ptr<RedPeer::OutMessage> 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<CompundInMessage> 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<RedPeer::OutMessage> message(new RedPeer::OutMessage(REDC_MIGRATE_DATA,
+ std::auto_ptr<RedPeer::OutMessage> 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<HandlerClass, end_message>::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<DisplayChannel&>(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<RedClient, RED_MESSAGES_END> {
+class MainChannelLoop: public MessageHandlerImp<RedClient, SPICE_MSG_END_MAIN> {
public:
- MainChannelLoop(RedClient& client): MessageHandlerImp<RedClient, RED_MESSAGES_END>(client) {}
+ MainChannelLoop(RedClient& client): MessageHandlerImp<RedClient, SPICE_MSG_END_MAIN>(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<MainChannelLoop*>(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<ConnectedEvent> 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 = &region.rects[i];
+ SpiceRect* r = &region.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 = &region.rects[i];
+ SpiceRect* r = &region.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<CompundInMessage> 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 <class REGION>
-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 = &region.rects[i];
+ SpiceRect* r = &region.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 &region)
{
- 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 &region);
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*> 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<TunnelChannel, RED_TUNNEL_MESSAGES_END> {
+class TunnelHandler: public MessageHandlerImp<TunnelChannel, SPICE_MSG_END_TUNNEL> {
public:
TunnelHandler(TunnelChannel& channel)
- : MessageHandlerImp<TunnelChannel, RED_TUNNEL_MESSAGES_END>(channel) {}
+ : MessageHandlerImp<TunnelChannel, SPICE_MSG_END_TUNNEL>(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<TunnelHandler*>(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<TunnelChannel::TunnelSocket*>(&sckt);
OutSocketMessage* out_msg = static_cast<OutSocketMessage*>(&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<TunnelChannel::TunnelSocket*>(&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<XMonitor*, SortRightToLeft> 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<XMonitor*, SortLeftToRight> 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<XMonitor*, SortBottomToTop> 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<XMonitor*, SortTopToBottom> 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<Variant>(**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 <class Variant>
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 <GL/glext.h>
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;
diff --git a/common/cairo_canvas.c b/common/cairo_canvas.c
index e8f177bb..1a4993da 100644
--- a/common/cairo_canvas.c
+++ b/common/cairo_canvas.c
@@ -35,26 +35,26 @@ static void canvas_set_path(CairoCanvas *canvas, void *addr)
access_test(&canvas->base, data_size, sizeof(uint32_t));
uint32_t more = *data_size;
- PathSeg* seg = (PathSeg*)(data_size + 1);
+ SpicePathSeg* seg = (SpicePathSeg*)(data_size + 1);
do {
- access_test(&canvas->base, seg, sizeof(PathSeg));
+ access_test(&canvas->base, seg, sizeof(SpicePathSeg));
uint32_t flags = seg->flags;
- PointFix* point = (PointFix*)seg->data;
- PointFix* end_point = point + seg->count;
+ SpicePointFix* point = (SpicePointFix*)seg->data;
+ SpicePointFix* end_point = point + seg->count;
access_test(&canvas->base, point, (unsigned long)end_point - (unsigned long)point);
ASSERT(point < end_point);
more -= ((unsigned long)end_point - (unsigned long)seg);
- seg = (PathSeg*)end_point;
+ seg = (SpicePathSeg*)end_point;
- if (flags & PATH_BEGIN) {
+ if (flags & SPICE_PATH_BEGIN) {
cairo_new_sub_path(cairo);
cairo_move_to(cairo, fix_to_double(point->x), fix_to_double(point->y));
point++;
}
- if (flags & PATH_BEZIER) {
+ if (flags & SPICE_PATH_BEZIER) {
ASSERT((point - end_point) % 3 == 0);
for (; point + 2 < end_point; point += 3) {
cairo_curve_to(cairo,
@@ -67,8 +67,8 @@ static void canvas_set_path(CairoCanvas *canvas, void *addr)
cairo_line_to(cairo, fix_to_double(point->x), fix_to_double(point->y));
}
}
- if (flags & PATH_END) {
- if (flags & PATH_CLOSE) {
+ if (flags & SPICE_PATH_END) {
+ if (flags & SPICE_PATH_CLOSE) {
cairo_close_path(cairo);
}
cairo_new_sub_path(cairo);
@@ -76,19 +76,19 @@ static void canvas_set_path(CairoCanvas *canvas, void *addr)
} while (more);
}
-static void canvas_clip(CairoCanvas *canvas, Clip *clip)
+static void canvas_clip(CairoCanvas *canvas, SpiceClip *clip)
{
cairo_t *cairo = canvas->cairo;
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
break;
- case CLIP_TYPE_RECTS: {
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ case SPICE_CLIP_TYPE_RECTS: {
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
for (; now < end; now++) {
@@ -98,8 +98,8 @@ static void canvas_clip(CairoCanvas *canvas, Clip *clip)
cairo_clip(cairo);
break;
}
- case CLIP_TYPE_PATH:
- canvas_set_path(canvas, GET_ADDRESS(clip->data));
+ case SPICE_CLIP_TYPE_PATH:
+ canvas_set_path(canvas, SPICE_GET_ADDRESS(clip->data));
cairo_clip(cairo);
break;
default:
@@ -110,11 +110,11 @@ static void canvas_clip(CairoCanvas *canvas, Clip *clip)
static inline cairo_line_cap_t canvas_line_cap_to_cairo(int end_style)
{
switch (end_style) {
- case LINE_CAP_ROUND:
+ case SPICE_LINE_CAP_ROUND:
return CAIRO_LINE_CAP_ROUND;
- case LINE_CAP_SQUARE:
+ case SPICE_LINE_CAP_SQUARE:
return CAIRO_LINE_CAP_SQUARE;
- case LINE_CAP_BUTT:
+ case SPICE_LINE_CAP_BUTT:
return CAIRO_LINE_CAP_BUTT;
default:
CANVAS_ERROR("bad end style %d", end_style);
@@ -124,18 +124,18 @@ static inline cairo_line_cap_t canvas_line_cap_to_cairo(int end_style)
static inline cairo_line_join_t canvas_line_join_to_cairo(int join_style)
{
switch (join_style) {
- case LINE_JOIN_ROUND:
+ case SPICE_LINE_JOIN_ROUND:
return CAIRO_LINE_JOIN_ROUND;
- case LINE_JOIN_BEVEL:
+ case SPICE_LINE_JOIN_BEVEL:
return CAIRO_LINE_JOIN_BEVEL;
- case LINE_JOIN_MITER:
+ case SPICE_LINE_JOIN_MITER:
return CAIRO_LINE_JOIN_MITER;
default:
CANVAS_ERROR("bad join style %d", join_style);
}
}
-static void canvas_set_line_attr_no_dash(CairoCanvas *canvas, LineAttr *attr)
+static void canvas_set_line_attr_no_dash(CairoCanvas *canvas, SpiceLineAttr *attr)
{
cairo_t *cairo = canvas->cairo;
@@ -146,9 +146,9 @@ static void canvas_set_line_attr_no_dash(CairoCanvas *canvas, LineAttr *attr)
cairo_set_dash(cairo, NULL, 0, 0);
}
-static void canvas_set_dash(CairoCanvas *canvas, UINT8 nseg, ADDRESS addr, int start_is_gap)
+static void canvas_set_dash(CairoCanvas *canvas, UINT8 nseg, SPICE_ADDRESS addr, int start_is_gap)
{
- FIXED28_4* style = (FIXED28_4*)GET_ADDRESS(addr);
+ SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
double offset = 0;
double *local_style;
int i;
@@ -222,7 +222,7 @@ static inline void canvas_invers_16bpp(uint8_t *dest, int dest_stride, uint8_t *
}
static inline void canvas_invers_8bpp(uint8_t *dest, int dest_stride, uint8_t *src, int src_stride,
- int width, uint8_t *end, Palette *palette)
+ int width, uint8_t *end, SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -242,7 +242,7 @@ static inline void canvas_invers_8bpp(uint8_t *dest, int dest_stride, uint8_t *s
static inline void canvas_invers_4bpp_be(uint8_t* dest, int dest_stride, uint8_t* src,
int src_stride, int width, uint8_t* end,
- Palette *palette)
+ SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -267,7 +267,7 @@ static inline void canvas_invers_4bpp_be(uint8_t* dest, int dest_stride, uint8_t
static inline void canvas_invers_1bpp_be(uint8_t* dest, int dest_stride, uint8_t* src,
int src_stride, int width, uint8_t* end,
- Palette *palette)
+ SpicePalette *palette)
{
uint32_t fore_color;
uint32_t back_color;
@@ -293,10 +293,10 @@ static inline void canvas_invers_1bpp_be(uint8_t* dest, int dest_stride, uint8_t
}
}
-static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bitmap* bitmap,
- Palette *palette)
+static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, SpiceBitmap* bitmap,
+ SpicePalette *palette)
{
- uint8_t* src = (uint8_t *)GET_ADDRESS(bitmap->data);
+ uint8_t* src = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
int src_stride;
uint8_t* end;
uint8_t* dest;
@@ -307,7 +307,7 @@ static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bit
end = src + (bitmap->y * src_stride);
access_test(&canvas->base, src, bitmap->y * src_stride);
- cairo_surface = cairo_image_surface_create((bitmap->format == BITMAP_FMT_RGBA) ?
+ cairo_surface = cairo_image_surface_create((bitmap->format == SPICE_BITMAP_FMT_RGBA) ?
CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24,
bitmap->x, bitmap->y);
if (cairo_surface_status(cairo_surface) != CAIRO_STATUS_SUCCESS) {
@@ -317,29 +317,29 @@ static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bit
dest = cairo_image_surface_get_data(cairo_surface);
dest_stride = cairo_image_surface_get_stride(cairo_surface);
- if (!(bitmap->flags & BITMAP_TOP_DOWN)) {
+ if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
ASSERT(bitmap->y > 0);
dest += dest_stride * (bitmap->y - 1);
dest_stride = -dest_stride;
}
switch (bitmap->format) {
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA:
canvas_invers_32bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
canvas_invers_24bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
canvas_invers_16bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
canvas_invers_8bpp(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_BE:
canvas_invers_4bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
canvas_invers_1bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
}
@@ -349,22 +349,22 @@ static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bit
#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE)
#ifndef CAIRO_CANVAS_CACHE
-static Palette *canvas_get_palette(CairoCanvas *canvas, Bitmap *bitmap)
+static SpicePalette *canvas_get_palette(CairoCanvas *canvas, SpiceBitmap *bitmap)
{
- Palette *local_palette;
- Palette *palette;
+ SpicePalette *local_palette;
+ SpicePalette *palette;
int size;
if (!bitmap->palette) {
return NULL;
}
- palette = (Palette *)GET_ADDRESS(bitmap->palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette);
if (canvas->base.color_shift != 5) {
return palette;
}
- size = sizeof(Palette) + (palette->num_ents << 2);
+ size = sizeof(SpicePalette) + (palette->num_ents << 2);
local_palette = malloc(size);
memcpy(local_palette, palette, size);
canvas_localize_palette(&canvas->base, palette);
@@ -372,9 +372,9 @@ static Palette *canvas_get_palette(CairoCanvas *canvas, Bitmap *bitmap)
return local_palette;
}
-static void free_palette(Bitmap *bitmap, Palette *palette)
+static void free_palette(SpiceBitmap *bitmap, SpicePalette *palette)
{
- if (!palette || palette == GET_ADDRESS(bitmap->palette)) {
+ if (!palette || palette == SPICE_GET_ADDRESS(bitmap->palette)) {
return;
}
free(palette);
@@ -382,20 +382,20 @@ static void free_palette(Bitmap *bitmap, Palette *palette)
#endif
-static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
cairo_surface_t *surface;
cairo_surface_t *invers = NULL;
- access_test(&canvas->base, descriptor, sizeof(ImageDescriptor));
+ access_test(&canvas->base, descriptor, sizeof(SpiceImageDescriptor));
- int cache_me = descriptor->flags & IMAGE_CACHE_ME;
+ int cache_me = descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME;
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(&canvas->base, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(&canvas->base, descriptor, sizeof(SpiceQUICImage));
if (cache_me) {
surface = canvas_get_quic(&canvas->base, image, 0);
} else {
@@ -404,8 +404,8 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
break;
}
#ifdef CAIRO_CANVAS_NO_CHUNKS
- case IMAGE_TYPE_LZ_PLT: {
- access_test(&canvas->base, descriptor, sizeof(LZ_PLTImage));
+ case SPICE_IMAGE_TYPE_LZ_PLT: {
+ access_test(&canvas->base, descriptor, sizeof(SpiceLZPLTImage));
LZImage *image = (LZImage *)descriptor;
if (cache_me) {
surface = canvas_get_lz(&canvas->base, image, 0);
@@ -414,8 +414,8 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
}
break;
}
- case IMAGE_TYPE_LZ_RGB: {
- access_test(&canvas->base, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_LZ_RGB: {
+ access_test(&canvas->base, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
if (cache_me) {
surface = canvas_get_lz(&canvas->base, image, 0);
@@ -426,19 +426,19 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
}
#endif
#ifdef USE_GLZ
- case IMAGE_TYPE_GLZ_RGB: {
- access_test(&canvas->base, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_GLZ_RGB: {
+ access_test(&canvas->base, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_glz(&canvas->base, image);
break;
}
#endif
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
surface = canvas->base.bits_cache_get(canvas->base.bits_cache_opaque, descriptor->id);
break;
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(&canvas->base, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(&canvas->base, descriptor, sizeof(SpiceBitmapImage));
if (cache_me) {
surface = canvas_get_bits(&canvas->base, &bitmap->bitmap);
} else {
@@ -448,7 +448,7 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
bitmap->bitmap.palette,
bitmap->bitmap.flags));
#else
- Palette *palette = canvas_get_palette(canvas, &bitmap->bitmap);
+ SpicePalette *palette = canvas_get_palette(canvas, &bitmap->bitmap);
surface = canvas_bitmap_to_invers_surface(canvas, &bitmap->bitmap, palette);
free_palette(&bitmap->bitmap, palette);
return surface;
@@ -471,17 +471,17 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
#else
-static cairo_surface_t *canvas_get_invers(CairoCanvas *canvas, Bitmap *bitmap)
+static cairo_surface_t *canvas_get_invers(CairoCanvas *canvas, SpiceBitmap *bitmap)
{
- Palette *palette;
+ SpicePalette *palette;
if (!bitmap->palette) {
return canvas_bitmap_to_invers_surface(canvas, bitmap, NULL);
}
- palette = (Palette *)GET_ADDRESS(bitmap->palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette);
if (canvas->color_shift == 5) {
- int size = sizeof(Palette) + (palette->num_ents << 2);
- Palette *local_palette = malloc(size);
+ int size = sizeof(SpicePalette) + (palette->num_ents << 2);
+ SpicePalette *local_palette = malloc(size);
cairo_surface_t* surface;
memcpy(local_palette, palette, size);
@@ -494,21 +494,21 @@ static cairo_surface_t *canvas_get_invers(CairoCanvas *canvas, Bitmap *bitmap)
}
}
-static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(canvas, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceQUICImage));
return canvas_get_quic(canvas, image, 1);
}
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
return canvas_get_invers(canvas, &bitmap->bitmap);
}
default:
@@ -518,7 +518,7 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
#endif
-static cairo_surface_t* canvas_surface_from_self(CairoCanvas *canvas, Point *pos,
+static cairo_surface_t* canvas_surface_from_self(CairoCanvas *canvas, SpicePoint *pos,
int32_t width, int32_t heigth)
{
cairo_surface_t *surface;
@@ -547,10 +547,10 @@ static cairo_surface_t* canvas_surface_from_self(CairoCanvas *canvas, Point *pos
return surface;
}
-static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, Brush *brush, uint32_t invers)
+static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, SpiceBrush *brush, uint32_t invers)
{
switch (brush->type) {
- case BRUSH_TYPE_SOLID: {
+ case SPICE_BRUSH_TYPE_SOLID: {
uint32_t color = (invers) ? ~brush->u.color : brush->u.color;
double r, g, b;
@@ -561,7 +561,7 @@ static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, Brush *brush, uint
r = (double)(color & canvas->base.color_mask) / canvas->base.color_mask;
return cairo_pattern_create_rgb(r, g, b);
}
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
cairo_surface_t* surface;
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
@@ -583,7 +583,7 @@ static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, Brush *brush, uint
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
return pattern;
}
- case BRUSH_TYPE_NONE:
+ case SPICE_BRUSH_TYPE_NONE:
return NULL;
default:
CANVAS_ERROR("invalid brush type");
@@ -604,13 +604,13 @@ static inline int canvas_set_ropd_operator(cairo_t *cairo, uint16_t rop_decripto
{
cairo_operator_t cairo_op;
- if (rop_decriptor & ROPD_OP_PUT) {
+ if (rop_decriptor & SPICE_ROPD_OP_PUT) {
cairo_op = CAIRO_OPERATOR_RASTER_COPY;
- } else if (rop_decriptor & ROPD_OP_XOR) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_XOR) {
cairo_op = CAIRO_OPERATOR_RASTER_XOR;
- } else if (rop_decriptor & ROPD_OP_OR) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_OR) {
cairo_op = CAIRO_OPERATOR_RASTER_OR;
- } else if (rop_decriptor & ROPD_OP_AND) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_AND) {
cairo_op = CAIRO_OPERATOR_RASTER_AND;
} else {
return 0;
@@ -625,16 +625,16 @@ static void canvas_draw_with_pattern(CairoCanvas *canvas, cairo_pattern_t *patte
{
cairo_t *cairo = canvas->cairo;
- if (rop_decriptor & ROPD_OP_BLACKNESS) {
+ if (rop_decriptor & SPICE_ROPD_OP_BLACKNESS) {
cairo_set_source_rgb(cairo, 0, 0, 0);
draw_method(data);
- } else if (rop_decriptor & ROPD_OP_WHITENESS) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_WHITENESS) {
cairo_set_source_rgb(cairo, 1, 1, 1);
draw_method(data);
- } else if (rop_decriptor & ROPD_OP_INVERS) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_INVERS) {
__canvas_draw_invers(canvas, draw_method, data);
} else {
- if (rop_decriptor & ROPD_INVERS_DEST) {
+ if (rop_decriptor & SPICE_ROPD_INVERS_DEST) {
__canvas_draw_invers(canvas, draw_method, data);
}
@@ -644,23 +644,23 @@ static void canvas_draw_with_pattern(CairoCanvas *canvas, cairo_pattern_t *patte
draw_method(data);
}
- if (rop_decriptor & ROPD_INVERS_RES) {
+ if (rop_decriptor & SPICE_ROPD_INVERS_RES) {
__canvas_draw_invers(canvas, draw_method, data);
}
}
}
-static inline void canvas_draw(CairoCanvas *canvas, Brush *brush, uint16_t rop_decriptor,
+static inline void canvas_draw(CairoCanvas *canvas, SpiceBrush *brush, uint16_t rop_decriptor,
DrawMethod draw_method, void *data)
{
- cairo_pattern_t *pattern = canvas_get_brush(canvas, brush, rop_decriptor & ROPD_INVERS_BRUSH);
+ cairo_pattern_t *pattern = canvas_get_brush(canvas, brush, rop_decriptor & SPICE_ROPD_INVERS_BRUSH);
canvas_draw_with_pattern(canvas, pattern, rop_decriptor, draw_method, data);
if (pattern) {
cairo_pattern_destroy(pattern);
}
}
-static cairo_pattern_t *canvas_get_mask_pattern(CairoCanvas *canvas, QMask *mask, int x, int y)
+static cairo_pattern_t *canvas_get_mask_pattern(CairoCanvas *canvas, SpiceQMask *mask, int x, int y)
{
cairo_surface_t *surface;
cairo_pattern_t *pattern;
@@ -692,7 +692,7 @@ static void __draw_mask(void *data)
cairo_mask(((DrawMaskData *)data)->cairo, ((DrawMaskData *)data)->mask);
}
-void canvas_draw_fill(CairoCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
+void canvas_draw_fill(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill)
{
DrawMaskData draw_data;
draw_data.cairo = canvas->cairo;
@@ -715,8 +715,8 @@ void canvas_draw_fill(CairoCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
cairo_restore(draw_data.cairo);
}
-static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src_bitmap,
- const Rect *src, const Rect *dest, int invers,
+static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, SPICE_ADDRESS src_bitmap,
+ const SpiceRect *src, const SpiceRect *dest, int invers,
int scale_mode)
{
cairo_pattern_t *pattern;
@@ -724,7 +724,7 @@ static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src
cairo_matrix_t matrix;
ASSERT(src_bitmap);
- ASSERT(scale_mode == IMAGE_SCALE_INTERPOLATE || scale_mode == IMAGE_SCALE_NEAREST);
+ ASSERT(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST);
if (invers) {
surface = canvas_get_invers_image(canvas, src_bitmap);
} else {
@@ -745,7 +745,7 @@ static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src
sy = (double)(src->bottom - src->top) / (dest->bottom - dest->top);
cairo_matrix_init_scale(&matrix, sx, sy);
- cairo_pattern_set_filter(pattern, (scale_mode == IMAGE_SCALE_NEAREST) ?
+ cairo_pattern_set_filter(pattern, (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?
CAIRO_FILTER_NEAREST : CAIRO_FILTER_GOOD);
cairo_matrix_translate(&matrix, src->left / sx - dest->left, src->top / sy - dest->top);
@@ -757,7 +757,7 @@ static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src
return pattern;
}
-void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
+void canvas_draw_copy(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *pattern;
@@ -767,7 +767,7 @@ void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, copy->src_bitmap, &copy->src_area, bbox,
- copy->rop_decriptor & ROPD_INVERS_SRC, copy->scale_mode);
+ copy->rop_decriptor & SPICE_ROPD_INVERS_SRC, copy->scale_mode);
cairo_set_source(cairo, pattern);
cairo_pattern_destroy(pattern);
cairo_set_operator(cairo, CAIRO_OPERATOR_RASTER_COPY);
@@ -787,11 +787,11 @@ void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
}
#ifdef WIN32
-void canvas_put_image(CairoCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *_src_data,
+void canvas_put_image(CairoCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *_src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
#else
-void canvas_put_image(CairoCanvas *canvas, const Rect *dest, const uint8_t *_src_data,
+void canvas_put_image(CairoCanvas *canvas, const SpiceRect *dest, const uint8_t *_src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
#endif
@@ -807,8 +807,8 @@ void canvas_put_image(CairoCanvas *canvas, const Rect *dest, const uint8_t *_src
cairo_save(cairo);
if (clip) {
- const Rect *now = clip->rects;
- const Rect *end = clip->rects + clip->num_rects;
+ const SpiceRect *now = clip->rects;
+ const SpiceRect *end = clip->rects + clip->num_rects;
for (; now < end; now++) {
cairo_rectangle(cairo, now->left, now->top, now->right - now->left,
now->bottom - now->top);
@@ -927,7 +927,7 @@ static cairo_surface_t *canvas_surf_to_color_maks_invers(cairo_surface_t *surfac
return mask;
}
-void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transparent* transparent)
+void canvas_draw_transparent(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *pattern;
@@ -946,7 +946,7 @@ void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transp
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, transparent->src_bitmap, &transparent->src_area, bbox,
- 0, IMAGE_SCALE_NEAREST);
+ 0, SPICE_IMAGE_SCALE_MODE_NEAREST);
if (cairo_pattern_get_surface(pattern, &surface) != CAIRO_STATUS_SUCCESS) {
CANVAS_ERROR("surfase from pattern pattern failed");
}
@@ -970,7 +970,7 @@ void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transp
cairo_restore(cairo);
}
-void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend)
+void canvas_draw_alpha_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *pattern;
@@ -985,7 +985,7 @@ void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaB
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, alpha_blend->src_bitmap, &alpha_blend->src_area, bbox,
- 0, IMAGE_SCALE_INTERPOLATE);
+ 0, SPICE_IMAGE_SCALE_MODE_INTERPOLATE);
cairo_set_source(cairo, pattern);
cairo_pattern_destroy(pattern);
cairo_set_operator(cairo, CAIRO_OPERATOR_ATOP);
@@ -994,7 +994,7 @@ void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaB
cairo_restore(cairo);
}
-void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque)
+void canvas_draw_opaque(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque)
{
cairo_pattern_t *pattern;
DrawMaskData draw_data;
@@ -1005,7 +1005,7 @@ void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, opaque->src_bitmap, &opaque->src_area, bbox,
- opaque->rop_decriptor & ROPD_INVERS_SRC, opaque->scale_mode);
+ opaque->rop_decriptor & SPICE_ROPD_INVERS_SRC, opaque->scale_mode);
cairo_set_source(draw_data.cairo, pattern);
cairo_pattern_destroy(pattern);
cairo_set_operator(draw_data.cairo, CAIRO_OPERATOR_RASTER_COPY);
@@ -1031,7 +1031,7 @@ void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
cairo_restore(draw_data.cairo);
}
-void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend)
+void canvas_draw_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
{
cairo_pattern_t *pattern;
DrawMaskData mask_data;
@@ -1042,7 +1042,7 @@ void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, blend->src_bitmap, &blend->src_area, bbox,
- blend->rop_decriptor & ROPD_INVERS_SRC, blend->scale_mode);
+ blend->rop_decriptor & SPICE_ROPD_INVERS_SRC, blend->scale_mode);
if ((mask_data.mask = canvas_get_mask_pattern(canvas, &blend->mask, bbox->left, bbox->top))) {
cairo_rectangle(mask_data.cairo,
@@ -1065,8 +1065,8 @@ void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend
cairo_restore(mask_data.cairo);
}
-static inline void canvas_fill_common(CairoCanvas *canvas, Rect *bbox, Clip *clip,
- QMask *qxl_mask)
+static inline void canvas_fill_common(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip,
+ SpiceQMask *qxl_mask)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *mask;
@@ -1088,7 +1088,7 @@ static inline void canvas_fill_common(CairoCanvas *canvas, Rect *bbox, Clip *cli
}
}
-void canvas_draw_blackness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness)
+void canvas_draw_blackness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
@@ -1097,7 +1097,7 @@ void canvas_draw_blackness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blacknes
cairo_restore(cairo);
}
-void canvas_draw_whiteness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness)
+void canvas_draw_whiteness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
@@ -1106,7 +1106,7 @@ void canvas_draw_whiteness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Whitenes
cairo_restore(cairo);
}
-void canvas_draw_invers(CairoCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers)
+void canvas_draw_invers(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
@@ -1116,18 +1116,18 @@ void canvas_draw_invers(CairoCanvas *canvas, Rect *bbox, Clip *clip, Invers *inv
cairo_restore(cairo);
}
-void canvas_draw_rop3(CairoCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
+void canvas_draw_rop3(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *mask;
cairo_surface_t *d;
cairo_surface_t *s;
- Point pos;
+ SpicePoint pos;
int width;
int heigth;
double x_pos;
double y_pos;
- Point src_pos;
+ SpicePoint src_pos;
cairo_save(cairo);
canvas_clip(canvas, clip);
@@ -1156,9 +1156,9 @@ void canvas_draw_rop3(CairoCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
cairo_image_surface_get_height(s) - src_pos.y < heigth) {
CANVAS_ERROR("bad src bitmap size");
}
- if (rop3->brush.type == BRUSH_TYPE_PATTERN) {
+ if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
cairo_surface_t *p = canvas_get_image(&canvas->base, rop3->brush.u.pattern.pat);
- Point pat_pos;
+ SpicePoint pat_pos;
pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % cairo_image_surface_get_width(p);
pat_pos.y = (bbox->top - rop3->brush.u.pattern.pos.y) % cairo_image_surface_get_height(p);
@@ -1239,8 +1239,8 @@ static inline void __canvas_copy_bits_right(uint8_t *data, const int stride,
}
}
-static inline void __canvas_copy_rect_bits(uint8_t *data, const int stride, Rect *dest_rect,
- Point *src_pos)
+static inline void __canvas_copy_rect_bits(uint8_t *data, const int stride, SpiceRect *dest_rect,
+ SpicePoint *src_pos)
{
if (dest_rect->top > src_pos->y) {
__canvas_copy_bits_down(data, stride, src_pos->x, src_pos->y,
@@ -1260,11 +1260,11 @@ static inline void __canvas_copy_rect_bits(uint8_t *data, const int stride, Rect
}
}
-static inline void canvas_copy_fix_clip_area(const Rect *dest,
- const Point *src_pos,
- const Rect *now,
- Point *ret_pos,
- Rect *ret_dest)
+static inline void canvas_copy_fix_clip_area(const SpiceRect *dest,
+ const SpicePoint *src_pos,
+ const SpiceRect *now,
+ SpicePoint *ret_pos,
+ SpiceRect *ret_dest)
{
*ret_dest = *now;
rect_sect(ret_dest, dest);
@@ -1272,21 +1272,21 @@ static inline void canvas_copy_fix_clip_area(const Rect *dest,
ret_pos->y = src_pos->y + (ret_dest->top - dest->top);
}
-static inline void __canvas_copy_region_bits(uint8_t *data, int stride, Rect *dest_rect,
- Point *src_pos, QRegion *region)
+static inline void __canvas_copy_region_bits(uint8_t *data, int stride, SpiceRect *dest_rect,
+ SpicePoint *src_pos, QRegion *region)
{
- Rect curr_area;
- Point curr_pos;
- Rect *now;
- Rect *end;
+ SpiceRect curr_area;
+ SpicePoint curr_pos;
+ SpiceRect *now;
+ SpiceRect *end;
if (dest_rect->top > src_pos->y) {
end = region->rects - 1;
now = end + region->num_rects;
if (dest_rect->left < src_pos->x) {
for (; now > end; now--) {
- Rect *line_end = now;
- Rect *line_pos;
+ SpiceRect *line_end = now;
+ SpiceRect *line_pos;
while (now - 1 > end && now->top == now[-1].top) {
now--;
@@ -1314,8 +1314,8 @@ static inline void __canvas_copy_region_bits(uint8_t *data, int stride, Rect *de
end = now + region->num_rects;
if (dest_rect->left > src_pos->x) {
for (; now < end; now++) {
- Rect *line_end = now;
- Rect *line_pos;
+ SpiceRect *line_end = now;
+ SpiceRect *line_pos;
while (now + 1 < end && now->top == now[1].top) {
now++;
@@ -1353,7 +1353,7 @@ static inline void __canvas_copy_region_bits(uint8_t *data, int stride, Rect *de
#endif
-void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos)
+void canvas_copy_bits(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos)
{
cairo_t *cairo = canvas->cairo;
cairo_surface_t *surface;
@@ -1363,20 +1363,20 @@ void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_po
cairo_save(cairo);
#ifdef FAST_COPY_BITS
switch (clip->type) {
- case CLIP_TYPE_NONE: {
+ case SPICE_CLIP_TYPE_NONE: {
surface = cairo_get_target(cairo);
__canvas_copy_rect_bits(cairo_image_surface_get_data(surface),
cairo_image_surface_get_stride(surface),
bbox, src_pos);
break;
}
- case CLIP_TYPE_RECTS: {
+ case SPICE_CLIP_TYPE_RECTS: {
surface = cairo_get_target(cairo);
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
uint8_t *data = cairo_image_surface_get_data(surface);
int stride = cairo_image_surface_get_stride(surface);
@@ -1410,13 +1410,13 @@ void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_po
cairo_restore(cairo);
}
-static void canvas_draw_raster_str(CairoCanvas *canvas, String *str, int bpp,
- Brush *brush, uint16_t rop_decriptor)
+static void canvas_draw_raster_str(CairoCanvas *canvas, SpiceString *str, int bpp,
+ SpiceBrush *brush, uint16_t rop_decriptor)
{
cairo_surface_t *str_mask;
DrawMaskData draw_data;
cairo_matrix_t matrix;
- Point pos;
+ SpicePoint pos;
str_mask = canvas_get_str_mask(&canvas->base, str, bpp, &pos);
draw_data.cairo = canvas->cairo;
@@ -1433,14 +1433,14 @@ static void canvas_draw_raster_str(CairoCanvas *canvas, String *str, int bpp,
cairo_surface_destroy(str_mask);
}
-static void canvas_draw_vector_str(CairoCanvas *canvas, String *str, Brush *brush,
+static void canvas_draw_vector_str(CairoCanvas *canvas, SpiceString *str, SpiceBrush *brush,
uint16_t rop_decriptor)
{
- VectotGlyph *glyph = (VectotGlyph *)str->data;
+ SpiceVectorGlyph *glyph = (SpiceVectorGlyph *)str->data;
int i;
for (i = 0; i < str->length; i++) {
- VectotGlyph *next_glyph = canvas_next_vector_glyph(glyph);
+ SpiceVectorGlyph *next_glyph = canvas_next_vector_glyph(glyph);
access_test(&canvas->base, glyph, (uint8_t *)next_glyph - (uint8_t *)glyph);
canvas_set_path(canvas, glyph->data);
glyph = next_glyph;
@@ -1449,10 +1449,10 @@ static void canvas_draw_vector_str(CairoCanvas *canvas, String *str, Brush *brus
cairo_new_path(canvas->cairo);
}
-void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
+void canvas_draw_text(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text)
{
cairo_t *cairo = canvas->cairo;
- String *str;
+ SpiceString *str;
cairo_save(cairo);
canvas_clip(canvas, clip);
@@ -1466,13 +1466,13 @@ void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
(DrawMethod)cairo_fill_preserve, cairo);
cairo_new_path(cairo);
}
- str = (String *)GET_ADDRESS(text->str);
+ str = (SpiceString *)SPICE_GET_ADDRESS(text->str);
- if (str->flags & STRING_RASTER_A1) {
+ if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) {
canvas_draw_raster_str(canvas, str, 1, &text->fore_brush, text->fore_mode);
- } else if (str->flags & STRING_RASTER_A4) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) {
canvas_draw_raster_str(canvas, str, 4, &text->fore_brush, text->fore_mode);
- } else if (str->flags & STRING_RASTER_A8) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
WARN("untested path A8 glyphs, doing nothing");
if (0) {
canvas_draw_raster_str(canvas, str, 8, &text->fore_brush, text->fore_mode);
@@ -1486,7 +1486,7 @@ void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
cairo_restore(cairo);
}
-void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke)
+void canvas_draw_stroke(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
{
cairo_t *cairo = canvas->cairo;
@@ -1494,12 +1494,12 @@ void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *str
canvas_clip(canvas, clip);
canvas_set_line_attr_no_dash(canvas, &stroke->attr);
- canvas_set_path(canvas, GET_ADDRESS(stroke->path));
- if (stroke->attr.flags & LINE_ATTR_STYLED) {
+ canvas_set_path(canvas, SPICE_GET_ADDRESS(stroke->path));
+ if (stroke->attr.flags & SPICE_LINE_ATTR_STYLED) {
canvas_draw(canvas, &stroke->brush, stroke->back_mode,
(DrawMethod)cairo_stroke_preserve, cairo);
canvas_set_dash(canvas, stroke->attr.style_nseg, stroke->attr.style,
- !!(stroke->attr.flags & LINE_ATTR_STARTGAP));
+ !!(stroke->attr.flags & SPICE_LINE_ATTR_STARTGAP));
}
canvas_draw(canvas, &stroke->brush, stroke->fore_mode, (DrawMethod)cairo_stroke_preserve,
cairo);
@@ -1507,7 +1507,7 @@ void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *str
cairo_restore(cairo);
}
-void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area)
+void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area)
{
cairo_t *cairo = canvas->cairo;
cairo_surface_t* surface;
@@ -1527,14 +1527,14 @@ void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const
}
}
-void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, Rect *clip_rects)
+void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, SpiceRect *clip_rects)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
if (n_clip_rects) {
- Rect *end = clip_rects + n_clip_rects;
+ SpiceRect *end = clip_rects + n_clip_rects;
for (; clip_rects < end; clip_rects++) {
cairo_rectangle(cairo,
clip_rects->left,
diff --git a/common/cairo_canvas.h b/common/cairo_canvas.h
index d144b35d..da4d229e 100644
--- a/common/cairo_canvas.h
+++ b/common/cairo_canvas.h
@@ -27,33 +27,33 @@
typedef struct CairoCanvas CairoCanvas;
-void canvas_draw_fill(CairoCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill);
-void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy);
-void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text);
-void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-void canvas_draw_rop3(CairoCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend);
-void canvas_draw_blackness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-void canvas_draw_whiteness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-void canvas_draw_invers(CairoCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers);
-void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transparent* transparent);
-void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend);
+void canvas_draw_fill(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+void canvas_draw_copy(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+void canvas_draw_opaque(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+void canvas_copy_bits(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+void canvas_draw_text(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
+void canvas_draw_stroke(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+void canvas_draw_rop3(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+void canvas_draw_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+void canvas_draw_blackness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+void canvas_draw_whiteness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+void canvas_draw_invers(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+void canvas_draw_transparent(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent);
+void canvas_draw_alpha_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend);
#ifdef WIN32
-void canvas_put_image(CairoCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *src_data,
+void canvas_put_image(CairoCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
#else
-void canvas_put_image(CairoCanvas *canvas, const Rect *dest, const uint8_t *src_data,
+void canvas_put_image(CairoCanvas *canvas, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
#endif
void canvas_clear(CairoCanvas *canvas);
-void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area);
-void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, Rect *clip_rects);
+void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area);
+void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, SpiceRect *clip_rects);
void canvas_group_end(CairoCanvas *canvas);
-void canvas_set_addr_delta(CairoCanvas *canvas, ADDRESS delta);
+void canvas_set_addr_delta(CairoCanvas *canvas, SPICE_ADDRESS delta);
#ifdef CAIRO_CANVAS_ACCESS_TEST
void canvas_set_access_params(CairoCanvas *canvas, unsigned long base, unsigned long max);
#endif
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 2b8148d7..e4055933 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -79,10 +79,10 @@ typedef struct __declspec (align(1)) LZImage {
#else
typedef struct __attribute__ ((__packed__)) LZImage {
#endif
- ImageDescriptor descriptor;
+ SpiceImageDescriptor descriptor;
union {
- LZ_RGBData lz_rgb;
- LZ_PLTData lz_plt;
+ SpiceLZRGBData lz_rgb;
+ SpiceLZPLTData lz_plt;
};
} LZImage;
@@ -93,7 +93,7 @@ static const cairo_user_data_key_t invers_data_type = {0};
extern mutex_t cairo_surface_user_data_mutex;
#endif
-static inline double fix_to_double(FIXED28_4 fixed)
+static inline double fix_to_double(SPICE_FIXED28_4 fixed)
{
return (double)(fixed & 0x0f) / 0x0f + (fixed >> 4);
}
@@ -150,7 +150,7 @@ typedef struct QuicData {
QuicContext *quic;
jmp_buf jmp_env;
#ifndef CAIRO_CANVAS_NO_CHUNKS
- ADDRESS next;
+ SPICE_ADDRESS next;
get_virt_fn_t get_virt;
void *get_virt_opaque;
validate_virt_fn_t validate_virt;
@@ -200,8 +200,8 @@ typedef struct CanvasBase {
typedef struct ATTR_PACKED DataChunk {
UINT32 size;
- ADDRESS prev;
- ADDRESS next;
+ SPICE_ADDRESS prev;
+ SPICE_ADDRESS next;
UINT8 data[0];
} DataChunk;
@@ -214,7 +214,7 @@ typedef struct ATTR_PACKED DataChunk {
#endif
-static inline void canvas_localize_palette(CanvasBase *canvas, Palette *palette)
+static inline void canvas_localize_palette(CanvasBase *canvas, SpicePalette *palette)
{
if (canvas->color_shift == 5) {
UINT32 *now = palette->ents;
@@ -229,7 +229,7 @@ static inline void canvas_localize_palette(CanvasBase *canvas, Palette *palette)
#ifdef DEBUG_DUMP_COMPRESS
static void dump_surface(cairo_surface_t *surface, int cache);
#endif
-static cairo_surface_t *canvas_get_quic(CanvasBase *canvas, QUICImage *image, int invers)
+static cairo_surface_t *canvas_get_quic(CanvasBase *canvas, SpiceQUICImage *image, int invers)
{
cairo_surface_t *surface = NULL;
QuicData *quic_data = &canvas->quic_data;
@@ -360,7 +360,7 @@ static inline void canvas_copy_16bpp(uint8_t* dest, int dest_stride, uint8_t* sr
}
static inline void canvas_copy_8bpp(uint8_t *dest, int dest_stride, uint8_t *src, int src_stride,
- int width, uint8_t *end, Palette *palette)
+ int width, uint8_t *end, SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -379,7 +379,7 @@ static inline void canvas_copy_8bpp(uint8_t *dest, int dest_stride, uint8_t *src
}
static inline void canvas_copy_4bpp_be(uint8_t* dest, int dest_stride, uint8_t* src, int src_stride,
- int width, uint8_t* end, Palette *palette)
+ int width, uint8_t* end, SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -403,7 +403,7 @@ static inline void canvas_copy_4bpp_be(uint8_t* dest, int dest_stride, uint8_t*
}
static inline void canvas_copy_1bpp_be(uint8_t* dest, int dest_stride, uint8_t* src, int src_stride,
- int width, uint8_t* end, Palette *palette)
+ int width, uint8_t* end, SpicePalette *palette)
{
uint32_t fore_color;
uint32_t back_color;
@@ -429,10 +429,10 @@ static inline void canvas_copy_1bpp_be(uint8_t* dest, int dest_stride, uint8_t*
}
}
-static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bitmap,
- Palette *palette)
+static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, SpiceBitmap* bitmap,
+ SpicePalette *palette)
{
- uint8_t* src = (uint8_t *)GET_ADDRESS(bitmap->data);
+ uint8_t* src = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
int src_stride;
uint8_t* end;
uint8_t* dest;
@@ -447,7 +447,7 @@ static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bit
#ifdef WIN32
canvas->dc,
#endif
- (bitmap->format == BITMAP_FMT_RGBA) ? CAIRO_FORMAT_ARGB32 :
+ (bitmap->format == SPICE_BITMAP_FMT_RGBA) ? CAIRO_FORMAT_ARGB32 :
CAIRO_FORMAT_RGB24,
bitmap->x, bitmap->y, FALSE);
if (cairo_surface_status(cairo_surface) != CAIRO_STATUS_SUCCESS) {
@@ -456,30 +456,30 @@ static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bit
}
dest = cairo_image_surface_get_data(cairo_surface);
dest_stride = cairo_image_surface_get_stride(cairo_surface);
- if (!(bitmap->flags & BITMAP_TOP_DOWN)) {
+ if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
ASSERT(bitmap->y > 0);
dest += dest_stride * ((int)bitmap->y - 1);
dest_stride = -dest_stride;
}
switch (bitmap->format) {
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA:
canvas_copy_32bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
canvas_copy_24bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
canvas_copy_16bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
canvas_copy_8bpp(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_BE:
canvas_copy_4bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
canvas_copy_1bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
}
@@ -488,23 +488,23 @@ static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bit
#ifdef CAIRO_CANVAS_CACHE
-static inline Palette *canvas_get_palett(CanvasBase *canvas, ADDRESS base_palette, uint8_t flags)
+static inline SpicePalette *canvas_get_palett(CanvasBase *canvas, SPICE_ADDRESS base_palette, uint8_t flags)
{
- Palette *palette;
+ SpicePalette *palette;
if (!base_palette) {
return NULL;
}
- if (flags & BITMAP_PAL_FROM_CACHE) {
+ if (flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE) {
palette = canvas->palette_cache_get(canvas->palette_cache_opaque, base_palette);
- } else if (flags & BITMAP_PAL_CACHE_ME) {
- palette = (Palette *)GET_ADDRESS(base_palette);
- access_test(canvas, palette, sizeof(Palette));
- access_test(canvas, palette, sizeof(Palette) + palette->num_ents * sizeof(uint32_t));
+ } else if (flags & SPICE_BITMAP_FLAGS_PAL_CACHE_ME) {
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(base_palette);
+ access_test(canvas, palette, sizeof(SpicePalette));
+ access_test(canvas, palette, sizeof(SpicePalette) + palette->num_ents * sizeof(uint32_t));
canvas_localize_palette(canvas, palette);
canvas->palette_cache_put(canvas->palette_cache_opaque, palette);
} else {
- palette = (Palette *)GET_ADDRESS(base_palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(base_palette);
canvas_localize_palette(canvas, palette);
}
return palette;
@@ -518,7 +518,7 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
uint8_t *decomp_buf = NULL;
uint8_t *src;
LzImageType type;
- Palette *palette;
+ SpicePalette *palette;
int alpha;
int n_comp_pixels;
int width;
@@ -533,11 +533,11 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
CANVAS_ERROR("lz error, %s", lz_data->message_buf);
}
- if (image->descriptor.type == IMAGE_TYPE_LZ_RGB) {
+ if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB) {
comp_buf = image->lz_rgb.data;
comp_size = image->lz_rgb.data_size;
palette = NULL;
- } else if (image->descriptor.type == IMAGE_TYPE_LZ_PLT) {
+ } else if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) {
comp_buf = image->lz_plt.data;
comp_size = image->lz_plt.data_size;
palette = canvas_get_palett(canvas, image->lz_plt.palette, image->lz_plt.flags);
@@ -569,7 +569,7 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
ASSERT(width == image->descriptor.width);
ASSERT(height == image->descriptor.height);
- ASSERT((image->descriptor.type == IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height));
+ ASSERT((image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height));
#ifdef WIN32
lz_data->decode_data.dc = canvas->dc;
#endif
@@ -612,7 +612,7 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
// same byte sequence can be transformed to different RGB pixels by different plts)
static cairo_surface_t *canvas_get_glz(CanvasBase *canvas, LZImage *image)
{
- ASSERT(image->descriptor.type == IMAGE_TYPE_GLZ_RGB);
+ ASSERT(image->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB);
#ifdef WIN32
canvas->glz_data.decode_data.dc = canvas->dc;
#endif
@@ -625,9 +625,9 @@ static cairo_surface_t *canvas_get_glz(CanvasBase *canvas, LZImage *image)
//#define DEBUG_DUMP_BITMAP
#ifdef DEBUG_DUMP_BITMAP
-static void dump_bitmap(Bitmap *bitmap, Palette *palette)
+static void dump_bitmap(SpiceBitmap *bitmap, SpicePalette *palette)
{
- uint8_t* data = (uint8_t *)GET_ADDRESS(bitmap->data);
+ uint8_t* data = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
static uint32_t file_id = 0;
uint32_t i, j;
char file_str[200];
@@ -662,10 +662,10 @@ static void dump_bitmap(Bitmap *bitmap, Palette *palette)
#endif
-static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
+static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap)
{
cairo_surface_t* surface;
- Palette *palette;
+ SpicePalette *palette;
palette = canvas_get_palett(canvas, bitmap->palette, bitmap->flags);
#ifdef DEBUG_DUMP_BITMAP
@@ -676,7 +676,7 @@ static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
surface = canvas_bitmap_to_surface(canvas, bitmap, palette);
- if (palette && (bitmap->flags & BITMAP_PAL_FROM_CACHE)) {
+ if (palette && (bitmap->flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) {
canvas->palette_cache_release(palette);
}
@@ -686,17 +686,17 @@ static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
#else
-static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
+static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap)
{
- Palette *palette;
+ SpicePalette *palette;
if (!bitmap->palette) {
return canvas_bitmap_to_surface(canvas, bitmap, NULL);
}
- palette = (Palette *)GET_ADDRESS(bitmap->palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette);
if (canvas->color_shift == 5) {
- int size = sizeof(Palette) + (palette->num_ents << 2);
- Palette *local_palette = malloc(size);
+ int size = sizeof(SpicePalette) + (palette->num_ents << 2);
+ SpicePalette *local_palette = malloc(size);
cairo_surface_t* surface;
memcpy(local_palette, palette, size);
@@ -773,49 +773,49 @@ static void __release_surface(void *inv_surf)
//#define DEBUG_LZ
-static cairo_surface_t *canvas_get_image(CanvasBase *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_image(CanvasBase *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
cairo_surface_t *surface;
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
#ifdef DEBUG_LZ
LOG_DEBUG("canvas_get_image image type: " << (int)descriptor->type);
#endif
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(canvas, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceQUICImage));
surface = canvas_get_quic(canvas, image, 0);
break;
}
#ifdef CAIRO_CANVAS_NO_CHUNKS
- case IMAGE_TYPE_LZ_PLT: {
- access_test(canvas, descriptor, sizeof(LZ_PLTImage));
+ case SPICE_IMAGE_TYPE_LZ_PLT: {
+ access_test(canvas, descriptor, sizeof(SpiceLZPLTImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_lz(canvas, image, 0);
break;
}
- case IMAGE_TYPE_LZ_RGB: {
- access_test(canvas, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_LZ_RGB: {
+ access_test(canvas, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_lz(canvas, image, 0);
break;
}
#endif
#ifdef USE_GLZ
- case IMAGE_TYPE_GLZ_RGB: {
- access_test(canvas, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_GLZ_RGB: {
+ access_test(canvas, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_glz(canvas, image);
break;
}
#endif
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
return canvas->bits_cache_get(canvas->bits_cache_opaque, descriptor->id);
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
surface = canvas_get_bits(canvas, &bitmap->bitmap);
break;
}
@@ -823,12 +823,12 @@ static cairo_surface_t *canvas_get_image(CanvasBase *canvas, ADDRESS addr)
CANVAS_ERROR("invalid image type");
}
- if (descriptor->flags & IMAGE_CACHE_ME) {
+ if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME) {
canvas->bits_cache_put(canvas->bits_cache_opaque, descriptor->id, surface);
#ifdef DEBUG_DUMP_SURFACE
dump_surface(surface, 1);
#endif
- } else if (descriptor->type != IMAGE_TYPE_FROM_CACHE) {
+ } else if (descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE) {
#ifdef DEBUG_DUMP_SURFACE
dump_surface(surface, 0);
#endif
@@ -838,21 +838,21 @@ static cairo_surface_t *canvas_get_image(CanvasBase *canvas, ADDRESS addr)
#else
-static cairo_surface_t *canvas_get_image(CairoCanvas *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_image(CairoCanvas *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(canvas, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceQUICImage));
return canvas_get_quic(canvas, image, 0);
}
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
return canvas_get_bits(canvas, &bitmap->bitmap);
}
default:
@@ -875,7 +875,7 @@ static inline uint8_t revers_bits(uint8_t byte)
return ret;
}
-static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitmap, int invers)
+static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* bitmap, int invers)
{
cairo_surface_t *surface;
uint8_t *src_line;
@@ -895,7 +895,7 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
cairo_status_to_string(cairo_surface_status(surface)));
}
- src_line = (uint8_t *)GET_ADDRESS(bitmap->data);
+ src_line = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
src_stride = bitmap->stride;
end_line = src_line + (bitmap->y * src_stride);
access_test(canvas, src_line, end_line - src_line);
@@ -904,9 +904,9 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
dest_stride = cairo_image_surface_get_stride(surface);
dest_line = cairo_image_surface_get_data(surface);
#if defined(GL_CANVAS)
- if ((bitmap->flags & BITMAP_TOP_DOWN)) {
+ if ((bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
#else
- if (!(bitmap->flags & BITMAP_TOP_DOWN)) {
+ if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
#endif
ASSERT(bitmap->y > 0);
dest_line += dest_stride * ((int)bitmap->y - 1);
@@ -916,9 +916,9 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
if (invers) {
switch (bitmap->format) {
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#else
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
uint8_t *dest = dest_line;
@@ -930,9 +930,9 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
}
break;
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#else
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
uint8_t *dest = dest_line;
@@ -951,18 +951,18 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
} else {
switch (bitmap->format) {
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#else
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
memcpy(dest_line, src_line, line_size);
}
break;
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#else
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
uint8_t *dest = dest_line;
@@ -1092,9 +1092,9 @@ static inline cairo_surface_t* canvas_handle_inverse_user_data(cairo_surface_t*
return inv_surf;
}
-static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, QMask *mask)
+static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask)
{
- ImageDescriptor *descriptor;
+ SpiceImageDescriptor *descriptor;
cairo_surface_t *surface;
int need_invers;
int is_invers;
@@ -1104,26 +1104,26 @@ static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, QMask *mask)
return NULL;
}
- descriptor = (ImageDescriptor *)GET_ADDRESS(mask->bitmap);
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
- need_invers = mask->flags & MASK_INVERS;
+ descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(mask->bitmap);
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
+ need_invers = mask->flags & SPICE_MASK_FLAGS_INVERS;
#ifdef CAIRO_CANVAS_CACHE
- cache_me = descriptor->flags & IMAGE_CACHE_ME;
+ cache_me = descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME;
#else
cache_me = 0;
#endif
switch (descriptor->type) {
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
is_invers = need_invers && !cache_me;
surface = canvas_get_bitmap_mask(canvas, &bitmap->bitmap, is_invers);
break;
}
#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE)
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
surface = canvas->bits_cache_get(canvas->bits_cache_opaque, descriptor->id);
is_invers = 0;
break;
@@ -1149,13 +1149,13 @@ static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, QMask *mask)
return surface;
}
-static inline RasterGlyph *canvas_next_raster_glyph(const RasterGlyph *glyph, int bpp)
+static inline SpiceRasterGlyph *canvas_next_raster_glyph(const SpiceRasterGlyph *glyph, int bpp)
{
- return (RasterGlyph *)((uint8_t *)(glyph + 1) +
+ return (SpiceRasterGlyph *)((uint8_t *)(glyph + 1) +
(ALIGN(glyph->width * bpp, 8) * glyph->height >> 3));
}
-static inline void canvas_raster_glyph_box(const RasterGlyph *glyph, Rect *r)
+static inline void canvas_raster_glyph_box(const SpiceRasterGlyph *glyph, SpiceRect *r)
{
ASSERT(r);
r->top = glyph->render_pos.y + glyph->glyph_origin.y;
@@ -1222,15 +1222,15 @@ static inline void canvas_put_bits(uint8_t *dest, int dest_offset, uint8_t *src,
}
}
-static void canvas_put_glyph_bits(RasterGlyph *glyph, int bpp, uint8_t *dest, int dest_stride,
- Rect *bounds)
+static void canvas_put_glyph_bits(SpiceRasterGlyph *glyph, int bpp, uint8_t *dest, int dest_stride,
+ SpiceRect *bounds)
{
- Rect glyph_box;
+ SpiceRect glyph_box;
uint8_t *src;
int lines;
int width;
- //todo: support STRING_RASTER_TOP_DOWN
+ //todo: support SPICE_STRING_FLAGS_RASTER_TOP_DOWN
canvas_raster_glyph_box(glyph, &glyph_box);
ASSERT(glyph_box.top >= bounds->top && glyph_box.bottom <= bounds->bottom);
ASSERT(glyph_box.left >= bounds->left && glyph_box.right <= bounds->right);
@@ -1298,11 +1298,11 @@ static void canvas_put_glyph_bits(RasterGlyph *glyph, int bpp, uint8_t *dest, in
}
}
-static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int bpp, Point *pos)
+static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, SpiceString *str, int bpp, SpicePoint *pos)
{
- RasterGlyph *glyph = (RasterGlyph *)str->data;
- RasterGlyph *next_glyph;
- Rect bounds;
+ SpiceRasterGlyph *glyph = (SpiceRasterGlyph *)str->data;
+ SpiceRasterGlyph *next_glyph;
+ SpiceRect bounds;
cairo_surface_t *str_mask;
uint8_t *dest;
int dest_stride;
@@ -1310,16 +1310,16 @@ static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int
ASSERT(str->length > 0);
- access_test(canvas, glyph, sizeof(RasterGlyph));
+ access_test(canvas, glyph, sizeof(SpiceRasterGlyph));
next_glyph = canvas_next_raster_glyph(glyph, bpp);
access_test(canvas, glyph, (uint8_t*)next_glyph - (uint8_t*)glyph);
canvas_raster_glyph_box(glyph, &bounds);
for (i = 1; i < str->length; i++) {
- Rect glyph_box;
+ SpiceRect glyph_box;
glyph = next_glyph;
- access_test(canvas, glyph, sizeof(RasterGlyph));
+ access_test(canvas, glyph, sizeof(SpiceRasterGlyph));
next_glyph = canvas_next_raster_glyph(glyph, bpp);
access_test(canvas, glyph, (uint8_t*)next_glyph - (uint8_t*)glyph);
canvas_raster_glyph_box(glyph, &glyph_box);
@@ -1335,7 +1335,7 @@ static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int
}
dest = cairo_image_surface_get_data(str_mask);
dest_stride = cairo_image_surface_get_stride(str_mask);
- glyph = (RasterGlyph *)str->data;
+ glyph = (SpiceRasterGlyph *)str->data;
for (i = 0; i < str->length; i++) {
#if defined(GL_CANVAS)
canvas_put_glyph_bits(glyph, bpp, dest + (bounds.bottom - bounds.top - 1) * dest_stride,
@@ -1351,12 +1351,12 @@ static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int
return str_mask;
}
-static inline VectotGlyph *canvas_next_vector_glyph(const VectotGlyph *glyph)
+static inline SpiceVectorGlyph *canvas_next_vector_glyph(const SpiceVectorGlyph *glyph)
{
- return (VectotGlyph *)((uint8_t *)(glyph + 1) + glyph->data_size);
+ return (SpiceVectorGlyph *)((uint8_t *)(glyph + 1) + glyph->data_size);
}
-static cairo_surface_t *canvas_scale_surface(cairo_surface_t *src, const Rect *src_area, int width,
+static cairo_surface_t *canvas_scale_surface(cairo_surface_t *src, const SpiceRect *src_area, int width,
int hight, int scale_mode)
{
cairo_t *cairo;
@@ -1389,8 +1389,8 @@ static cairo_surface_t *canvas_scale_surface(cairo_surface_t *src, const Rect *s
cairo_matrix_scale(&matrix, sx, sy);
cairo_pattern_set_matrix(pattern, &matrix);
- ASSERT(scale_mode == IMAGE_SCALE_INTERPOLATE || scale_mode == IMAGE_SCALE_NEAREST);
- cairo_pattern_set_filter(pattern, (scale_mode == IMAGE_SCALE_NEAREST) ?
+ ASSERT(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST);
+ cairo_pattern_set_filter(pattern, (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?
CAIRO_FILTER_NEAREST : CAIRO_FILTER_GOOD);
cairo_set_source(cairo, pattern);
diff --git a/common/canvas_base.h b/common/canvas_base.h
index 36529bd5..8a574e2a 100644
--- a/common/canvas_base.h
+++ b/common/canvas_base.h
@@ -28,13 +28,13 @@ typedef void (*bits_cache_put_fn_t)(void *bits_cache_opaque, uint64_t id, cairo_
typedef cairo_surface_t *(*bits_cache_get_fn_t)(void *bits_cache_opaque, uint64_t id);
#endif
#ifdef CAIRO_CANVAS_CACHE
-typedef void (*palette_cache_put_fn_t)(void *palette_cache_opaque, Palette *palette);
-typedef Palette *(*palette_cache_get_fn_t)(void *palette_cache_opaque, uint64_t id);
-typedef void (*palette_cache_release_fn_t)(Palette *palette);
+typedef void (*palette_cache_put_fn_t)(void *palette_cache_opaque, SpicePalette *palette);
+typedef SpicePalette *(*palette_cache_get_fn_t)(void *palette_cache_opaque, uint64_t id);
+typedef void (*palette_cache_release_fn_t)(SpicePalette *palette);
#endif
typedef void (*glz_decode_fn_t)(void *glz_decoder_opaque, uint8_t *data,
- Palette *plt, void *usr_data);
+ SpicePalette *plt, void *usr_data);
#ifndef CAIRO_CANVAS_NO_CHUNKS
typedef void *(*get_virt_fn_t)(void *get_virt_opaque, unsigned long addr, uint32_t add_size);
typedef void (*validate_virt_fn_t)(void *validate_virt_opaque, unsigned long virt,
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index 9c7e6693..b60bef2a 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -35,7 +35,7 @@ struct GdiCanvas {
struct BitmapData {
HBITMAP hbitmap;
HBITMAP prev_hbitmap;
- Point pos;
+ SpicePoint pos;
uint8_t flags;
HDC dc;
int cache;
@@ -321,20 +321,20 @@ static void set_path(GdiCanvas *canvas, void *addr)
access_test(&canvas->base, data_size, sizeof(uint32_t));
uint32_t more = *data_size;
- PathSeg* seg = (PathSeg*)(data_size + 1);
+ SpicePathSeg* seg = (SpicePathSeg*)(data_size + 1);
do {
- access_test(&canvas->base, seg, sizeof(PathSeg));
+ access_test(&canvas->base, seg, sizeof(SpicePathSeg));
uint32_t flags = seg->flags;
- PointFix* point = (PointFix*)seg->data;
- PointFix* end_point = point + seg->count;
+ SpicePointFix* point = (SpicePointFix*)seg->data;
+ SpicePointFix* end_point = point + seg->count;
access_test(&canvas->base, point, (unsigned long)end_point - (unsigned long)point);
ASSERT(point < end_point);
more -= ((unsigned long)end_point - (unsigned long)seg);
- seg = (PathSeg*)end_point;
+ seg = (SpicePathSeg*)end_point;
- if (flags & PATH_BEGIN) {
+ if (flags & SPICE_PATH_BEGIN) {
BeginPath(canvas->dc);
if (!MoveToEx(canvas->dc, (int)fix_to_double(point->x), (int)fix_to_double(point->y),
NULL)) {
@@ -344,7 +344,7 @@ static void set_path(GdiCanvas *canvas, void *addr)
point++;
}
- if (flags & PATH_BEZIER) {
+ if (flags & SPICE_PATH_BEZIER) {
ASSERT((point - end_point) % 3 == 0);
for (; point + 2 < end_point; point += 3) {
POINT points[3];
@@ -369,9 +369,9 @@ static void set_path(GdiCanvas *canvas, void *addr)
}
}
- if (flags & PATH_END) {
+ if (flags & SPICE_PATH_END) {
- if (flags & PATH_CLOSE) {
+ if (flags & SPICE_PATH_CLOSE) {
if (!CloseFigure(canvas->dc)) {
CANVAS_ERROR("CloseFigure failed");
}
@@ -387,29 +387,29 @@ static void set_path(GdiCanvas *canvas, void *addr)
static void set_scale_mode(GdiCanvas *canvas, uint8_t scale_mode)
{
- if (scale_mode == IMAGE_SCALE_INTERPOLATE) {
+ if (scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE) {
SetStretchBltMode(canvas->dc, HALFTONE);
- } else if (scale_mode == IMAGE_SCALE_NEAREST) {
+ } else if (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) {
SetStretchBltMode(canvas->dc, COLORONCOLOR);
} else {
CANVAS_ERROR("Unknown ScaleMode");
}
}
-static void set_clip(GdiCanvas *canvas, Clip *clip)
+static void set_clip(GdiCanvas *canvas, SpiceClip *clip)
{
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
if (SelectClipRgn(canvas->dc, NULL) == ERROR) {
CANVAS_ERROR("SelectClipRgn failed");
}
break;
- case CLIP_TYPE_RECTS: {
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ case SPICE_CLIP_TYPE_RECTS: {
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
if (now < end) {
@@ -443,8 +443,8 @@ static void set_clip(GdiCanvas *canvas, Clip *clip)
}
break;
}
- case CLIP_TYPE_PATH:
- set_path(canvas, GET_ADDRESS(clip->data));
+ case SPICE_CLIP_TYPE_PATH:
+ set_path(canvas, SPICE_GET_ADDRESS(clip->data));
if (SelectClipPath(canvas->dc, RGN_COPY) == ERROR) {
CANVAS_ERROR("Unable to SelectClipPath");
}
@@ -631,17 +631,17 @@ static inline COLORREF get_color_ref(GdiCanvas *canvas, uint32_t color)
return RGB(r, g, b);
}
-static HBRUSH get_brush(GdiCanvas *canvas, Brush *brush)
+static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush)
{
HBRUSH hbrush;
switch (brush->type) {
- case BRUSH_TYPE_SOLID:
+ case SPICE_BRUSH_TYPE_SOLID:
if (!(hbrush = CreateSolidBrush(get_color_ref(canvas, brush->u.color)))) {
CANVAS_ERROR("CreateSolidBrush failed");
}
return hbrush;
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
GdiImage image;
HBRUSH hbrush;
cairo_surface_t *surface;
@@ -666,7 +666,7 @@ static HBRUSH get_brush(GdiCanvas *canvas, Brush *brush)
cairo_surface_destroy(surface);
return hbrush;
}
- case BRUSH_TYPE_NONE:
+ case SPICE_BRUSH_TYPE_NONE:
return NULL;
default:
CANVAS_ERROR("invalid brush type");
@@ -674,13 +674,13 @@ static HBRUSH get_brush(GdiCanvas *canvas, Brush *brush)
}
}
-static HBRUSH set_brush(HDC dc, HBRUSH hbrush, Brush *brush)
+static HBRUSH set_brush(HDC dc, HBRUSH hbrush, SpiceBrush *brush)
{
switch (brush->type) {
- case BRUSH_TYPE_SOLID: {
+ case SPICE_BRUSH_TYPE_SOLID: {
return (HBRUSH)SelectObject(dc, hbrush);
}
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
HBRUSH prev_hbrush;
prev_hbrush = (HBRUSH)SelectObject(dc, hbrush);
if (!SetBrushOrgEx(dc, brush->u.pattern.pos.x, brush->u.pattern.pos.y, NULL)) {
@@ -711,13 +711,13 @@ uint8_t calc_rop3(uint16_t rop3_bits, int brush)
uint8_t rop3_brush = _rop3_brush;
uint8_t rop3_src_brush;
- if (rop3_bits & ROPD_INVERS_SRC) {
+ if (rop3_bits & SPICE_ROPD_INVERS_SRC) {
rop3_src = ~rop3_src;
}
- if (rop3_bits & ROPD_INVERS_BRUSH) {
+ if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) {
rop3_brush = ~rop3_brush;
}
- if (rop3_bits & ROPD_INVERS_DEST) {
+ if (rop3_bits & SPICE_ROPD_INVERS_DEST) {
rop3_dest = ~rop3_dest;
}
@@ -727,24 +727,24 @@ uint8_t calc_rop3(uint16_t rop3_bits, int brush)
rop3_src_brush = rop3_src;
}
- if (rop3_bits & ROPD_OP_PUT) {
+ if (rop3_bits & SPICE_ROPD_OP_PUT) {
rop3 = rop3_src_brush;
}
- if (rop3_bits & ROPD_OP_OR) {
+ if (rop3_bits & SPICE_ROPD_OP_OR) {
rop3 = rop3_src_brush | rop3_dest;
}
- if (rop3_bits & ROPD_OP_AND) {
+ if (rop3_bits & SPICE_ROPD_OP_AND) {
rop3 = rop3_src_brush & rop3_dest;
}
- if (rop3_bits & ROPD_OP_XOR) {
+ if (rop3_bits & SPICE_ROPD_OP_XOR) {
rop3 = rop3_src_brush ^ rop3_dest;
}
- if (rop3_bits & ROPD_INVERS_RES) {
+ if (rop3_bits & SPICE_ROPD_INVERS_RES) {
rop3 = ~rop3_dest;
}
- if (rop3_bits & ROPD_OP_BLACKNESS || rop3_bits & ROPD_OP_WHITENESS ||
- rop3_bits & ROPD_OP_INVERS) {
+ if (rop3_bits & SPICE_ROPD_OP_BLACKNESS || rop3_bits & SPICE_ROPD_OP_WHITENESS ||
+ rop3_bits & SPICE_ROPD_OP_INVERS) {
CANVAS_ERROR("invalid rop3 type");
}
return rop3;
@@ -756,27 +756,27 @@ uint8_t calc_rop3_src_brush(uint16_t rop3_bits)
uint8_t rop3_src = _rop3_src;
uint8_t rop3_brush = _rop3_brush;
- if (rop3_bits & ROPD_INVERS_SRC) {
+ if (rop3_bits & SPICE_ROPD_INVERS_SRC) {
rop3_src = ~rop3_src;
}
- if (rop3_bits & ROPD_INVERS_BRUSH) {
+ if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) {
rop3_brush = ~rop3_brush;
}
- if (rop3_bits & ROPD_OP_OR) {
+ if (rop3_bits & SPICE_ROPD_OP_OR) {
rop3 = rop3_src | rop3_brush;
}
- if (rop3_bits & ROPD_OP_AND) {
+ if (rop3_bits & SPICE_ROPD_OP_AND) {
rop3 = rop3_src & rop3_brush;
}
- if (rop3_bits & ROPD_OP_XOR) {
+ if (rop3_bits & SPICE_ROPD_OP_XOR) {
rop3 = rop3_src ^ rop3_brush;
}
return rop3;
}
-static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct QMask *mask)
+static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct SpiceQMask *mask)
{
cairo_surface_t *surface;
struct BitmapData bitmap;
@@ -810,7 +810,7 @@ static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct QMask
return bitmap;
}
-static void gdi_draw_bitmap(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_bitmap(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
HDC src_dc, struct BitmapData *bitmapmask, uint32_t rop3_val)
{
uint32_t rast_oper;
@@ -843,7 +843,7 @@ static void gdi_draw_bitmap(HDC dest_dc, const Rect *src, const Rect *dest,
}
}
-static void gdi_draw_bitmap_redrop(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_bitmap_redrop(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
HDC src_dc, struct BitmapData *bitmapmask,
uint16_t rop, int brush)
{
@@ -861,12 +861,12 @@ static void free_mask(struct BitmapData *bitmap)
}
static void draw_str_mask_bitmap(struct GdiCanvas *canvas,
- String *str, int n, Rect *dest,
- Rect *src, Brush *brush)
+ SpiceString *str, int n, SpiceRect *dest,
+ SpiceRect *src, SpiceBrush *brush)
{
cairo_surface_t *surface;
struct BitmapData bitmap;
- Point pos;
+ SpicePoint pos;
int dest_stride;
uint8_t *bitmap_data;
HBRUSH prev_hbrush;
@@ -941,7 +941,7 @@ static void draw_str_mask_bitmap(struct GdiCanvas *canvas,
free_mask(&bitmap);
}
-static void gdi_draw_image(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_image(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
const uint8_t *bitmap_data, int bit_stride, int bit_width,
int bit_height, struct BitmapData *bitmapmask, uint16_t rop,
int rotate)
@@ -958,7 +958,7 @@ static void gdi_draw_image(HDC dest_dc, const Rect *src, const Rect *dest,
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-static void gdi_draw_image_rop3(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_image_rop3(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
const uint8_t *bitmap_data, int bit_stride, int bit_width,
int bit_height, struct BitmapData *bitmapmask, uint8_t rop3,
int rotate)
@@ -975,7 +975,7 @@ static void gdi_draw_image_rop3(HDC dest_dc, const Rect *src, const Rect *dest,
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-void gdi_canvas_draw_fill(GdiCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
+void gdi_canvas_draw_fill(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill)
{
HBRUSH prev_hbrush;
HBRUSH brush;
@@ -991,13 +991,13 @@ void gdi_canvas_draw_fill(GdiCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
set_clip(canvas, clip);
prev_hbrush = set_brush(canvas->dc, brush, &fill->brush);
gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask,
- fill->rop_decriptor, fill->brush.type != BRUSH_TYPE_NONE);
+ fill->rop_decriptor, fill->brush.type != SPICE_BRUSH_TYPE_NONE);
free_mask(&bitmapmask);
unset_brush(canvas->dc, prev_hbrush);
}
-void gdi_canvas_draw_copy(GdiCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
+void gdi_canvas_draw_copy(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1035,18 +1035,18 @@ void gdi_canvas_draw_copy(GdiCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
cairo_surface_destroy(surface);
}
-void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *src_data,
+void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
{
- Rect src;
+ SpiceRect src;
src.top = 0;
src.bottom = src_height;
src.left = 0;
src.right = src_width;
Lock lock(*canvas->lock);
- set_scale_mode(canvas, IMAGE_SCALE_NEAREST);
+ set_scale_mode(canvas, SPICE_IMAGE_SCALE_MODE_NEAREST);
if (clip) {
if (clip->num_rects == 0) {
return;
@@ -1090,15 +1090,15 @@ void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const Rect *dest, const uin
if (dc) {
gdi_draw_bitmap_redrop(canvas->dc, &src, dest, dc,
- NULL, ROPD_OP_PUT, 0);
+ NULL, SPICE_ROPD_OP_PUT, 0);
} else {
gdi_draw_image(canvas->dc, &src, dest, src_data,
- src_stride, src_width, src_height, NULL, ROPD_OP_PUT, 0);
+ src_stride, src_width, src_height, NULL, SPICE_ROPD_OP_PUT, 0);
}
}
-static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const Rect *src,
- const Rect *dest, HDC src_dc, uint32_t color)
+static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src,
+ const SpiceRect *dest, HDC src_dc, uint32_t color)
{
TransparentBlt(dest_dc, dest->left, dest->top, dest->right - dest->left,
dest->bottom - dest->top, src_dc, src->left, src->top,
@@ -1106,8 +1106,8 @@ static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const Re
RGB(((uint8_t*)&color)[2], ((uint8_t*)&color)[1], ((uint8_t*)&color)[0]));
}
-static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const Rect *src,
- const Rect *dest, const uint8_t *bitmap_data,
+static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src,
+ const SpiceRect *dest, const uint8_t *bitmap_data,
int bit_stride, int bit_width, int bit_height,
uint32_t color, int rotate)
{
@@ -1123,8 +1123,8 @@ static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const Rec
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-void gdi_canvas_draw_transparent(GdiCanvas *canvas, Rect *bbox, Clip *clip,
- Transparent* transparent)
+void gdi_canvas_draw_transparent(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip,
+ SpiceTransparent* transparent)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1156,7 +1156,7 @@ void gdi_canvas_draw_transparent(GdiCanvas *canvas, Rect *bbox, Clip *clip,
cairo_surface_destroy(surface);
}
-static void gdi_draw_bitmap_alpha(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_bitmap_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
HDC src_dc, uint8_t alpha, int use_bitmap_alpha)
{
BLENDFUNCTION bf;
@@ -1178,7 +1178,7 @@ static void gdi_draw_bitmap_alpha(HDC dest_dc, const Rect *src, const Rect *dest
}
}
-static void gdi_draw_image_alpha(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_image_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
const uint8_t *bitmap_data, int bit_stride,
int bit_width, int bit_height, uint8_t alpha,
int rotate, int use_bitmap_alpha)
@@ -1195,7 +1195,7 @@ static void gdi_draw_image_alpha(HDC dest_dc, const Rect *src, const Rect *dest,
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend)
+void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1229,7 +1229,7 @@ void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Alph
cairo_surface_destroy(surface);
}
-void gdi_canvas_draw_opaque(GdiCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque)
+void gdi_canvas_draw_opaque(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1274,7 +1274,7 @@ void gdi_canvas_draw_opaque(GdiCanvas *canvas, Rect *bbox, Clip *clip, Opaque *o
cairo_surface_destroy(surface);
}
-void gdi_canvas_draw_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend)
+void gdi_canvas_draw_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1311,7 +1311,7 @@ void gdi_canvas_draw_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blend *ble
cairo_surface_destroy(surface);
}
-void gdi_canvas_draw_blackness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness)
+void gdi_canvas_draw_blackness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
{
struct BitmapData bitmapmask;
@@ -1324,7 +1324,7 @@ void gdi_canvas_draw_blackness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blackn
free_mask(&bitmapmask);
}
-void gdi_canvas_draw_invers(GdiCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers)
+void gdi_canvas_draw_invers(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers)
{
struct BitmapData bitmapmask;
@@ -1337,7 +1337,7 @@ void gdi_canvas_draw_invers(GdiCanvas *canvas, Rect *bbox, Clip *clip, Invers *i
free_mask(&bitmapmask);
}
-void gdi_canvas_draw_whiteness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness)
+void gdi_canvas_draw_whiteness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness)
{
struct BitmapData bitmapmask;
@@ -1350,7 +1350,7 @@ void gdi_canvas_draw_whiteness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Whiten
free_mask(&bitmapmask);
}
-void gdi_canvas_draw_rop3(GdiCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
+void gdi_canvas_draw_rop3(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1392,7 +1392,7 @@ void gdi_canvas_draw_rop3(GdiCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
cairo_surface_destroy(surface);
}
-void gdi_canvas_copy_bits(GdiCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos)
+void gdi_canvas_copy_bits(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos)
{
Lock lock(*canvas->lock);
@@ -1402,9 +1402,9 @@ void gdi_canvas_copy_bits(GdiCanvas *canvas, Rect *bbox, Clip *clip, Point *src_
bbox->bottom - bbox->top, canvas->dc, src_pos->x, src_pos->y, SRCCOPY);
}
-void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
+void gdi_canvas_draw_text(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text)
{
- String *str;
+ SpiceString *str;
Lock lock(*canvas->lock);
set_clip(canvas, clip);
@@ -1422,23 +1422,23 @@ void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
unset_brush(canvas->dc, prev_hbrush);
}
- str = (String *)GET_ADDRESS(text->str);
+ str = (SpiceString *)SPICE_GET_ADDRESS(text->str);
- if (str->flags & STRING_RASTER_A1) {
- Rect dest;
- Rect src;
+ if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) {
+ SpiceRect dest;
+ SpiceRect src;
draw_str_mask_bitmap(canvas, str, 1, &dest, &src, &text->fore_brush);
- } else if (str->flags & STRING_RASTER_A4) {
- Rect dest;
- Rect src;
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) {
+ SpiceRect dest;
+ SpiceRect src;
draw_str_mask_bitmap(canvas, str, 4, &dest, &src, &text->fore_brush);
- } else if (str->flags & STRING_RASTER_A8) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
WARN("untested path A8 glyphs, doing nothing");
if (0) {
- Rect dest;
- Rect src;
+ SpiceRect dest;
+ SpiceRect src;
draw_str_mask_bitmap(canvas, str, 8, &dest, &src, &text->fore_brush);
}
@@ -1452,11 +1452,11 @@ void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
static int get_join_style(uint8_t join_style)
{
switch (join_style) {
- case LINE_JOIN_ROUND:
+ case SPICE_LINE_JOIN_ROUND:
return PS_JOIN_ROUND;
- case LINE_JOIN_BEVEL:
+ case SPICE_LINE_JOIN_BEVEL:
return PS_JOIN_BEVEL;
- case LINE_JOIN_MITER:
+ case SPICE_LINE_JOIN_MITER:
return PS_JOIN_MITER;
default:
CANVAS_ERROR("bad join style %d", join_style);
@@ -1466,20 +1466,20 @@ static int get_join_style(uint8_t join_style)
static int get_cap(int end_style)
{
switch (end_style) {
- case LINE_CAP_ROUND:
+ case SPICE_LINE_CAP_ROUND:
return PS_ENDCAP_ROUND;
- case LINE_CAP_SQUARE:
+ case SPICE_LINE_CAP_SQUARE:
return PS_ENDCAP_SQUARE;
- case LINE_CAP_BUTT:
+ case SPICE_LINE_CAP_BUTT:
return PS_ENDCAP_FLAT;
default:
CANVAS_ERROR("bad end style %d", end_style);
}
}
-static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, UINT8 nseg, ADDRESS addr, int start_is_gap)
+static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, UINT8 nseg, SPICE_ADDRESS addr, int start_is_gap)
{
- FIXED28_4* style = (FIXED28_4*)GET_ADDRESS(addr);
+ SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
double offset = 0;
uint32_t *local_style;
int i;
@@ -1508,7 +1508,7 @@ static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, UINT8 nseg, ADDRESS addr,
return local_style;
}
-void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke)
+void gdi_canvas_draw_stroke(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
{
HPEN hpen;
HPEN prev_hpen;
@@ -1518,7 +1518,7 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
uint32_t *user_style = NULL;
cairo_surface_t *surface = NULL;
- if (stroke->brush.type == BRUSH_TYPE_PATTERN) {
+ if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
surface = canvas_get_image(&canvas->base, stroke->brush.u.pattern.pat);
}
@@ -1526,49 +1526,49 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
set_clip(canvas, clip);
switch (stroke->fore_mode) {
- case ROPD_OP_WHITENESS:
+ case SPICE_ROPD_OP_WHITENESS:
SetROP2(canvas->dc, R2_WHITE); //0
break;
- case ROPD_OP_BLACKNESS:
+ case SPICE_ROPD_OP_BLACKNESS:
SetROP2(canvas->dc, R2_BLACK); //1
break;
- case ROPD_OP_INVERS:
+ case SPICE_ROPD_OP_INVERS:
SetROP2(canvas->dc, R2_NOT); //Dn
break;
- case ROPD_OP_PUT:
+ case SPICE_ROPD_OP_PUT:
SetROP2(canvas->dc, R2_COPYPEN); //P
break;
- case ROPD_OP_OR:
+ case SPICE_ROPD_OP_OR:
SetROP2(canvas->dc, R2_MERGEPEN); //DPo
break;
- case ROPD_OP_XOR:
+ case SPICE_ROPD_OP_XOR:
SetROP2(canvas->dc, R2_XORPEN); //DPx
break;
- case ROPD_OP_AND:
+ case SPICE_ROPD_OP_AND:
SetROP2(canvas->dc, R2_MASKPEN); //DPa
break;
- case ROPD_INVERS_BRUSH | ROPD_OP_PUT: //Pn
+ case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_PUT: //Pn
SetROP2(canvas->dc, R2_NOTCOPYPEN);
break;
- case ROPD_OP_XOR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES:
SetROP2(canvas->dc, R2_NOTXORPEN); //DPxn
break;
- case ROPD_OP_OR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES:
SetROP2(canvas->dc, R2_NOTMERGEPEN); //DPon
break;
- case ROPD_OP_AND | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES:
SetROP2(canvas->dc, R2_NOTMASKPEN); //DPan
break;
- case ROPD_INVERS_DEST | ROPD_OP_AND:
+ case SPICE_ROPD_INVERS_DEST | SPICE_ROPD_OP_AND:
SetROP2(canvas->dc, R2_MASKPENNOT); //PDna
break;
- case ROPD_INVERS_BRUSH | ROPD_OP_AND:
+ case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_AND:
SetROP2(canvas->dc, R2_MASKNOTPEN); //DPna
break;
- case ROPD_OP_OR | ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH:
SetROP2(canvas->dc, R2_MERGENOTPEN); //DPno
break;
- case ROPD_OP_OR | ROPD_INVERS_DEST:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST:
SetROP2(canvas->dc, R2_MERGEPENNOT); //PDno
break;
default:
@@ -1576,11 +1576,11 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
}
- if (stroke->brush.type == BRUSH_TYPE_SOLID) {
+ if (stroke->brush.type == SPICE_BRUSH_TYPE_SOLID) {
logbrush.lbStyle = BS_SOLID | DIB_RGB_COLORS;
logbrush.lbHatch = 0;
logbrush.lbColor = get_color_ref(canvas, stroke->brush.u.color);
- } else if (stroke->brush.type == BRUSH_TYPE_PATTERN) {
+ } else if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
#if 0
struct {
BITMAPINFO inf;
@@ -1639,10 +1639,10 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
SetMiterLimit(canvas->dc, (FLOAT)fix_to_double(stroke->attr.miter_limit), &old_miter);
#endif
- if (stroke->attr.flags & LINE_ATTR_STYLED) {
+ if (stroke->attr.flags & SPICE_LINE_ATTR_STYLED) {
user_style = gdi_get_userstyle(canvas, stroke->attr.style_nseg,
stroke->attr.style,
- !!(stroke->attr.flags & LINE_ATTR_STARTGAP));
+ !!(stroke->attr.flags & SPICE_LINE_ATTR_STARTGAP));
hpen = ExtCreatePen(PS_GEOMETRIC | ps_join | line_cap | PS_USERSTYLE,
(uint32_t)fix_to_double(stroke->attr.width),
&logbrush, stroke->attr.style_nseg, (DWORD *)user_style);
@@ -1653,7 +1653,7 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
}
prev_hpen = (HPEN)SelectObject(canvas->dc, hpen);
- set_path(canvas, GET_ADDRESS(stroke->path));
+ set_path(canvas, SPICE_GET_ADDRESS(stroke->path));
StrokePath(canvas->dc);
@@ -1661,7 +1661,7 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
DeleteObject(hpen);
#if 0
- if (stroke->brush.type == BRUSH_TYPE_PATTERN) {
+ if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
GlobalFree((HGLOBAL)logbrush.lbHatch);
}
#endif
diff --git a/common/gdi_canvas.h b/common/gdi_canvas.h
index 02669c6a..0f518508 100644
--- a/common/gdi_canvas.h
+++ b/common/gdi_canvas.h
@@ -34,21 +34,21 @@ typedef struct {
uint8_t *pixels;
} GdiImage;
-void gdi_canvas_draw_fill(GdiCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill);
-void gdi_canvas_draw_copy(GdiCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy);
-void gdi_canvas_draw_opaque(GdiCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-void gdi_canvas_copy_bits(GdiCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text);
-void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-void gdi_canvas_draw_rop3(GdiCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-void gdi_canvas_draw_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend);
-void gdi_canvas_draw_blackness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-void gdi_canvas_draw_whiteness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-void gdi_canvas_draw_invers(GdiCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers);
-void gdi_canvas_draw_transparent(GdiCanvas *canvas, Rect *bbox, Clip *clip,
- Transparent* transparent);
-void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend);
-void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *src_data,
+void gdi_canvas_draw_fill(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+void gdi_canvas_draw_copy(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+void gdi_canvas_draw_opaque(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+void gdi_canvas_copy_bits(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+void gdi_canvas_draw_text(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
+void gdi_canvas_draw_stroke(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+void gdi_canvas_draw_rop3(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+void gdi_canvas_draw_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+void gdi_canvas_draw_blackness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+void gdi_canvas_draw_whiteness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+void gdi_canvas_draw_invers(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+void gdi_canvas_draw_transparent(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip,
+ SpiceTransparent* transparent);
+void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend);
+void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
void gdi_canvas_clear(GdiCanvas *canvas);
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index 73c3c517..eaf1e91e 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -116,25 +116,25 @@ static GLCPath get_path(GLCanvas *canvas, void *addr)
access_test(&canvas->base, data_size, sizeof(uint32_t));
uint32_t more = *data_size;
- PathSeg* seg = (PathSeg*)(data_size + 1);
+ SpicePathSeg* seg = (SpicePathSeg*)(data_size + 1);
do {
- access_test(&canvas->base, seg, sizeof(PathSeg));
+ access_test(&canvas->base, seg, sizeof(SpicePathSeg));
uint32_t flags = seg->flags;
- PointFix* point = (PointFix*)seg->data;
- PointFix* end_point = point + seg->count;
+ SpicePointFix* point = (SpicePointFix*)seg->data;
+ SpicePointFix* end_point = point + seg->count;
access_test(&canvas->base, point, (unsigned long)end_point - (unsigned long)point);
ASSERT(point < end_point);
more -= ((unsigned long)end_point - (unsigned long)seg);
- seg = (PathSeg*)end_point;
+ seg = (SpicePathSeg*)end_point;
- if (flags & PATH_BEGIN) {
+ if (flags & SPICE_PATH_BEGIN) {
glc_path_move_to(path, fix_to_double(point->x), fix_to_double(point->y));
point++;
}
- if (flags & PATH_BEZIER) {
+ if (flags & SPICE_PATH_BEZIER) {
ASSERT((point - end_point) % 3 == 0);
for (; point + 2 < end_point; point += 3) {
glc_path_curve_to(path,
@@ -147,8 +147,8 @@ static GLCPath get_path(GLCanvas *canvas, void *addr)
glc_path_line_to(path, fix_to_double(point->x), fix_to_double(point->y));
}
}
- if (flags & PATH_END) {
- if (flags & PATH_CLOSE) {
+ if (flags & SPICE_PATH_END) {
+ if (flags & SPICE_PATH_CLOSE) {
glc_path_close(path);
}
}
@@ -164,19 +164,19 @@ static GLCPath get_path(GLCanvas *canvas, void *addr)
(dest)->height = (src)->bottom - (src)->top; \
}
-static void set_clip(GLCanvas *canvas, Rect *bbox, Clip *clip)
+static void set_clip(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip)
{
GLCRect rect;
glc_clip_reset(canvas->glc);
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
break;
- case CLIP_TYPE_RECTS: {
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ case SPICE_CLIP_TYPE_RECTS: {
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
if (*n == 0) {
@@ -195,8 +195,8 @@ static void set_clip(GLCanvas *canvas, Rect *bbox, Clip *clip)
}
break;
}
- case CLIP_TYPE_PATH: {
- GLCPath path = get_path(canvas, GET_ADDRESS(clip->data));
+ case SPICE_CLIP_TYPE_PATH: {
+ GLCPath path = get_path(canvas, SPICE_GET_ADDRESS(clip->data));
glc_clip_path(canvas->glc, path, GLC_CLIP_OP_SET);
glc_path_destroy(path);
break;
@@ -206,7 +206,7 @@ static void set_clip(GLCanvas *canvas, Rect *bbox, Clip *clip)
}
}
-static void set_mask(GLCanvas *canvas, QMask *mask, int x, int y)
+static void set_mask(GLCanvas *canvas, SpiceQMask *mask, int x, int y)
{
cairo_surface_t *surface;
@@ -246,10 +246,10 @@ static inline void surface_to_image(GLCanvas *canvas, cairo_surface_t *surface,
}
}
-static void set_brush(GLCanvas *canvas, Brush *brush)
+static void set_brush(GLCanvas *canvas, SpiceBrush *brush)
{
switch (brush->type) {
- case BRUSH_TYPE_SOLID: {
+ case SPICE_BRUSH_TYPE_SOLID: {
uint32_t color = brush->u.color;
double r, g, b;
@@ -261,7 +261,7 @@ static void set_brush(GLCanvas *canvas, Brush *brush)
glc_set_rgb(canvas->glc, r, g, b);
break;
}
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
GLCImage image;
GLCPattern pattern;
cairo_surface_t *surface;
@@ -275,7 +275,7 @@ static void set_brush(GLCanvas *canvas, Brush *brush)
glc_set_pattern(canvas->glc, pattern);
glc_pattern_destroy(pattern);
}
- case BRUSH_TYPE_NONE:
+ case SPICE_BRUSH_TYPE_NONE:
return;
default:
CANVAS_ERROR("invalid brush type");
@@ -287,52 +287,52 @@ static void set_op(GLCanvas *canvas, UINT16 rop_decriptor)
GLCOp op;
switch (rop_decriptor) {
- case ROPD_OP_PUT:
+ case SPICE_ROPD_OP_PUT:
op = GLC_OP_COPY;
break;
- case ROPD_OP_XOR:
+ case SPICE_ROPD_OP_XOR:
op = GLC_OP_XOR;
break;
- case ROPD_OP_BLACKNESS:
+ case SPICE_ROPD_OP_BLACKNESS:
op = GLC_OP_CLEAR;
break;
- case ROPD_OP_WHITENESS:
+ case SPICE_ROPD_OP_WHITENESS:
op = GLC_OP_SET;
break;
- case ROPD_OP_PUT | ROPD_INVERS_BRUSH:
- case ROPD_OP_PUT | ROPD_INVERS_SRC:
+ case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_SRC:
op = GLC_OP_COPY_INVERTED;
break;
- case ROPD_OP_INVERS:
+ case SPICE_ROPD_OP_INVERS:
op = GLC_OP_INVERT;
break;
- case ROPD_OP_AND:
+ case SPICE_ROPD_OP_AND:
op = GLC_OP_AND;
break;
- case ROPD_OP_AND | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES:
op = GLC_OP_NAND;
break;
- case ROPD_OP_OR:
+ case SPICE_ROPD_OP_OR:
op = GLC_OP_OR;
break;
- case ROPD_OP_OR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES:
op = GLC_OP_NOR;
break;
- case ROPD_OP_XOR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES:
op = GLC_OP_EQUIV;
break;
- case ROPD_OP_AND | ROPD_INVERS_DEST:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_DEST:
op = GLC_OP_AND_REVERSE;
break;
- case ROPD_OP_AND | ROPD_INVERS_BRUSH:
- case ROPD_OP_AND | ROPD_INVERS_SRC:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_SRC:
op = GLC_OP_AND_INVERTED;
break;
- case ROPD_OP_OR | ROPD_INVERS_DEST:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST:
op = GLC_OP_OR_REVERSE;
break;
- case ROPD_OP_OR | ROPD_INVERS_BRUSH:
- case ROPD_OP_OR | ROPD_INVERS_SRC:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_SRC:
op = GLC_OP_OR_INVERTED;
break;
default:
@@ -342,7 +342,7 @@ static void set_op(GLCanvas *canvas, UINT16 rop_decriptor)
glc_set_op(canvas->glc, op);
}
-void gl_canvas_draw_fill(GLCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
+void gl_canvas_draw_fill(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill)
{
GLCRect rect;
set_clip(canvas, bbox, clip);
@@ -355,7 +355,7 @@ void gl_canvas_draw_fill(GLCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
glc_flush(canvas->glc);
}
-void gl_canvas_draw_copy(GLCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
+void gl_canvas_draw_copy(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -377,7 +377,7 @@ void gl_canvas_draw_copy(GLCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
glc_flush(canvas->glc);
}
-void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque)
+void gl_canvas_draw_opaque(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -388,7 +388,7 @@ void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
set_clip(canvas, bbox, clip);
set_mask(canvas, &opaque->mask, bbox->left, bbox->top);
- glc_set_op(canvas->glc, (opaque->rop_decriptor & ROPD_INVERS_SRC) ? GLC_OP_COPY_INVERTED :
+ glc_set_op(canvas->glc, (opaque->rop_decriptor & SPICE_ROPD_INVERS_SRC) ? GLC_OP_COPY_INVERTED :
GLC_OP_COPY);
surface = canvas_get_image(&canvas->base, opaque->src_bitmap);
surface_to_image(canvas, surface, &image, 0);
@@ -398,14 +398,14 @@ void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
cairo_surface_destroy(surface);
set_brush(canvas, &opaque->brush);
- set_op(canvas, opaque->rop_decriptor & ~ROPD_INVERS_SRC);
+ set_op(canvas, opaque->rop_decriptor & ~SPICE_ROPD_INVERS_SRC);
SET_GLC_RECT(&fill_rect, bbox);
glc_fill_rect(canvas->glc, &fill_rect);
glc_flush(canvas->glc);
}
-void gl_canvas_draw_alpha_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd *alpha_blend)
+void gl_canvas_draw_alpha_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd *alpha_blend)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -426,7 +426,7 @@ void gl_canvas_draw_alpha_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, AlphaB
glc_flush(canvas->glc);
}
-void gl_canvas_draw_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend)
+void gl_canvas_draw_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -447,7 +447,7 @@ void gl_canvas_draw_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend
glc_flush(canvas->glc);
}
-void gl_canvas_draw_transparent(GLCanvas *canvas, Rect *bbox, Clip *clip, Transparent *transparent)
+void gl_canvas_draw_transparent(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent *transparent)
{
cairo_surface_t *surface;
cairo_surface_t *trans_surf;
@@ -474,7 +474,7 @@ void gl_canvas_draw_transparent(GLCanvas *canvas, Rect *bbox, Clip *clip, Transp
glc_flush(canvas->glc);
}
-static inline void fill_common(GLCanvas *canvas, Rect *bbox, Clip *clip, QMask * mask, GLCOp op)
+static inline void fill_common(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceQMask * mask, GLCOp op)
{
GLCRect rect;
@@ -485,27 +485,27 @@ static inline void fill_common(GLCanvas *canvas, Rect *bbox, Clip *clip, QMask *
glc_fill_rect(canvas->glc, &rect);
}
-void gl_canvas_draw_whiteness(GLCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness)
+void gl_canvas_draw_whiteness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness)
{
fill_common(canvas, bbox, clip, &whiteness->mask, GLC_OP_SET);
}
-void gl_canvas_draw_blackness(GLCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness)
+void gl_canvas_draw_blackness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
{
fill_common(canvas, bbox, clip, &blackness->mask, GLC_OP_CLEAR);
}
-void gl_canvas_draw_invers(GLCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers)
+void gl_canvas_draw_invers(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers)
{
fill_common(canvas, bbox, clip, &invers->mask, GLC_OP_INVERT);
}
-void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
+void gl_canvas_draw_rop3(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3)
{
cairo_surface_t *d;
cairo_surface_t *s;
GLCImage image;
- Point src_pos;
+ SpicePoint src_pos;
uint8_t *data_opp;
int src_stride;
@@ -561,9 +561,9 @@ void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
CANVAS_ERROR("bad src bitmap size");
}
- if (rop3->brush.type == BRUSH_TYPE_PATTERN) {
+ if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
cairo_surface_t *p = canvas_get_image(&canvas->base, rop3->brush.u.pattern.pat);
- Point pat_pos;
+ SpicePoint pat_pos;
pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % cairo_image_surface_get_width(p);
@@ -601,7 +601,7 @@ void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
cairo_surface_destroy(d);
}
-void gl_canvas_draw_stroke(GLCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke)
+void gl_canvas_draw_stroke(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
{
GLCPath path;
@@ -610,20 +610,20 @@ void gl_canvas_draw_stroke(GLCanvas *canvas, Rect *bbox, Clip *clip, Stroke *str
set_op(canvas, stroke->fore_mode);
set_brush(canvas, &stroke->brush);
- if (stroke->attr.flags & LINE_ATTR_STYLED) {
- WARN("LINE_ATTR_STYLED");
+ if (stroke->attr.flags & SPICE_LINE_ATTR_STYLED) {
+ WARN("SPICE_LINE_ATTR_STYLED");
}
glc_set_line_width(canvas->glc, fix_to_double(stroke->attr.width));
- path = get_path(canvas, GET_ADDRESS(stroke->path));
+ path = get_path(canvas, SPICE_GET_ADDRESS(stroke->path));
glc_stroke_path(canvas->glc, path);
glc_path_destroy(path);
}
-void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
+void gl_canvas_draw_text(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text)
{
GLCRect rect;
- String *str;
+ SpiceString *str;
set_clip(canvas, bbox, clip);
glc_clear_mask(canvas->glc, GLC_MASK_A);
@@ -635,11 +635,11 @@ void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
glc_fill_rect(canvas->glc, &rect);
}
- str = (String *)GET_ADDRESS(text->str);
+ str = (SpiceString *)SPICE_GET_ADDRESS(text->str);
set_brush(canvas, &text->fore_brush);
set_op(canvas, text->fore_mode);
- if (str->flags & STRING_RASTER_A1) {
- Point pos;
+ if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) {
+ SpicePoint pos;
cairo_surface_t *mask = canvas_get_str_mask(&canvas->base, str, 1, &pos);
_glc_fill_mask(canvas->glc, pos.x, pos.y,
cairo_image_surface_get_width(mask),
@@ -647,8 +647,8 @@ void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
cairo_image_surface_get_stride(mask),
cairo_image_surface_get_data(mask));
cairo_surface_destroy(mask);
- } else if (str->flags & STRING_RASTER_A4) {
- Point pos;
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) {
+ SpicePoint pos;
cairo_surface_t *mask = canvas_get_str_mask(&canvas->base, str, 4, &pos);
glc_fill_alpha(canvas->glc, pos.x, pos.y,
cairo_image_surface_get_width(mask),
@@ -657,10 +657,10 @@ void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
cairo_image_surface_get_data(mask));
cairo_surface_destroy(mask);
- } else if (str->flags & STRING_RASTER_A8) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
WARN("untested path A8 glyphs, doing nothing");
if (0) {
- Point pos;
+ SpicePoint pos;
cairo_surface_t *mask = canvas_get_str_mask(&canvas->base, str, 8, &pos);
glc_fill_alpha(canvas->glc, pos.x, pos.y,
cairo_image_surface_get_width(mask),
@@ -684,7 +684,7 @@ void gl_canvas_clear(GLCanvas *canvas)
glc_flush(canvas->glc);
}
-void gl_canvas_copy_pixels(GLCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos)
+void gl_canvas_copy_pixels(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos)
{
set_clip(canvas, bbox, clip);
glc_clear_mask(canvas->glc, GLC_MASK_A);
@@ -693,7 +693,7 @@ void gl_canvas_copy_pixels(GLCanvas *canvas, Rect *bbox, Clip *clip, Point *src_
bbox->right - bbox->left, bbox->bottom - bbox->top);
}
-void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area)
+void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area)
{
GLCImage image;
@@ -706,7 +706,7 @@ void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, con
glc_read_pixels(canvas->glc, area->left, area->top, &image);
}
-void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const Rect *rects)
+void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const SpiceRect *rects)
{
GLCRect *glc_rects = (GLCRect *)malloc(num_rect * sizeof(GLCRect));
GLCRect *now = glc_rects;
@@ -720,7 +720,7 @@ void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const Rect *rects)
free(glc_rects);
}
-void gl_canvas_put_image(GLCanvas *canvas, const Rect *dest, const uint8_t *src_data,
+void gl_canvas_put_image(GLCanvas *canvas, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
{
diff --git a/common/gl_canvas.h b/common/gl_canvas.h
index 2e3dd7c2..177c99d0 100644
--- a/common/gl_canvas.h
+++ b/common/gl_canvas.h
@@ -22,29 +22,29 @@
typedef struct GLCanvas GLCanvas;
-void gl_canvas_draw_fill(GLCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill);
-void gl_canvas_draw_copy(GLCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy);
-void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-void gl_canvas_draw_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend);
-void gl_canvas_draw_alpha_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd *alpha_blend);
-void gl_canvas_draw_transparent(GLCanvas *canvas, Rect *bbox, Clip *clip, Transparent *transparent);
-void gl_canvas_draw_whiteness(GLCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-void gl_canvas_draw_blackness(GLCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-void gl_canvas_draw_invers(GLCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers);
-void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-void gl_canvas_draw_stroke(GLCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text);
+void gl_canvas_draw_fill(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+void gl_canvas_draw_copy(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+void gl_canvas_draw_opaque(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+void gl_canvas_draw_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+void gl_canvas_draw_alpha_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd *alpha_blend);
+void gl_canvas_draw_transparent(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent *transparent);
+void gl_canvas_draw_whiteness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+void gl_canvas_draw_blackness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+void gl_canvas_draw_invers(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+void gl_canvas_draw_rop3(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+void gl_canvas_draw_stroke(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+void gl_canvas_draw_text(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
-void gl_canvas_copy_pixels(GLCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area);
+void gl_canvas_copy_pixels(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area);
-void gl_canvas_put_image(GLCanvas *canvas, const Rect *dest, const uint8_t *src_data,
+void gl_canvas_put_image(GLCanvas *canvas, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
void gl_canvas_clear(GLCanvas *canvas);
-void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const Rect *rects);
+void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const SpiceRect *rects);
void gl_canvas_clear_top_mask(GLCanvas *canvas);
#ifdef CAIRO_CANVAS_ACCESS_TEST
diff --git a/common/lz.c b/common/lz.c
index eac44af6..e0e112ec 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -77,7 +77,7 @@ typedef struct Encoder {
LzUsrContext *usr;
LzImageType type;
- const Palette *palette; // for decoding images with palettes to rgb
+ const SpicePalette *palette; // for decoding images with palettes to rgb
int stride; // stride is in bytes. For rgb must be equal to
// width*bytes_per_pix.
// For palettes stride can be bigger than width/pixels_per_byte by 1 only if
@@ -577,7 +577,7 @@ int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_do
*/
void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes,
LzImageType *out_type, int *out_width, int *out_height,
- int *out_n_pixels, int *out_top_down, const Palette *palette)
+ int *out_n_pixels, int *out_top_down, const SpicePalette *palette)
{
Encoder *encoder = (Encoder *)lz;
uint8_t *io_ptr_end = io_ptr + num_io_bytes;
diff --git a/common/lz.h b/common/lz.h
index 074f633b..3fe1b4c8 100644
--- a/common/lz.h
+++ b/common/lz.h
@@ -52,7 +52,7 @@ int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_do
*/
void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes,
LzImageType *out_type, int *out_width, int *out_height,
- int *out_n_pixels, int *out_top_down, const Palette *palette);
+ int *out_n_pixels, int *out_top_down, const SpicePalette *palette);
/*
to_type = the image output type.
diff --git a/common/rect.h b/common/rect.h
index 569b530a..d109cc97 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -23,7 +23,7 @@
#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
-static inline void rect_sect(Rect* r, const Rect* bounds)
+static inline void rect_sect(SpiceRect* r, const SpiceRect* bounds)
{
r->left = MAX(r->left, bounds->left);
r->right = MIN(r->right, bounds->right);
@@ -34,7 +34,7 @@ static inline void rect_sect(Rect* r, const Rect* bounds)
r->bottom = MAX(r->top, r->bottom);
}
-static inline void rect_offset(Rect* r, int dx, int dy)
+static inline void rect_offset(SpiceRect* r, int dx, int dy)
{
r->left += dx;
r->right += dx;
@@ -42,24 +42,24 @@ static inline void rect_offset(Rect* r, int dx, int dy)
r->bottom += dy;
}
-static inline int rect_is_empty(const Rect* r)
+static inline int rect_is_empty(const SpiceRect* r)
{
return r->top == r->bottom || r->left == r->right;
}
-static inline int rect_intersects(const Rect* r1, const Rect* r2)
+static inline int rect_intersects(const SpiceRect* r1, const SpiceRect* r2)
{
return r1->left < r2->right && r1->right > r2->left &&
r1->top < r2->bottom && r1->bottom > r2->top;
}
-static inline int rect_is_equal(const Rect *r1, const Rect *r2)
+static inline int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2)
{
return r1->top == r2->top && r1->left == r2->left &&
r1->bottom == r2->bottom && r1->right == r2->right;
}
-static inline void rect_union(Rect *dest, const Rect *r)
+static inline void rect_union(SpiceRect *dest, const SpiceRect *r)
{
dest->top = MIN(dest->top, r->top);
dest->left = MIN(dest->left, r->left);
@@ -67,7 +67,7 @@ static inline void rect_union(Rect *dest, const Rect *r)
dest->right = MAX(dest->right, r->right);
}
-static inline int rect_is_same_size(const Rect *r1, const Rect *r2)
+static inline int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2)
{
return r1->right - r1->left == r2->right - r2->left &&
r1->bottom - r1->top == r2->bottom - r2->top;
@@ -75,37 +75,37 @@ static inline int rect_is_same_size(const Rect *r1, const Rect *r2)
#ifdef __cplusplus
-static inline void rect_sect(Rect& r, const Rect& bounds)
+static inline void rect_sect(SpiceRect& r, const SpiceRect& bounds)
{
rect_sect(&r, &bounds);
}
-static inline void rect_offset(Rect& r, int dx, int dy)
+static inline void rect_offset(SpiceRect& r, int dx, int dy)
{
rect_offset(&r, dx, dy);
}
-static inline int rect_is_empty(const Rect& r)
+static inline int rect_is_empty(const SpiceRect& r)
{
return rect_is_empty(&r);
}
-static inline int rect_intersects(const Rect& r1, const Rect& r2)
+static inline int rect_intersects(const SpiceRect& r1, const SpiceRect& r2)
{
return rect_intersects(&r1, &r2);
}
-static inline int rect_is_equal(const Rect& r1, const Rect& r2)
+static inline int rect_is_equal(const SpiceRect& r1, const SpiceRect& r2)
{
return rect_is_equal(&r1, &r2);
}
-static inline void rect_union(Rect& dest, const Rect& r)
+static inline void rect_union(SpiceRect& dest, const SpiceRect& r)
{
rect_union(&dest, &r);
}
-static inline int rect_is_same_size(const Rect& r1, const Rect& r2)
+static inline int rect_is_same_size(const SpiceRect& r1, const SpiceRect& r2)
{
return rect_is_same_size(&r1, &r2);
}
diff --git a/common/region.c b/common/region.c
index d1d7f4a0..f0bb614f 100644
--- a/common/region.c
+++ b/common/region.c
@@ -42,7 +42,7 @@
#define REGION_IS_VALID(region) TRUE
#endif
-static int rect_is_valid(const Rect *r)
+static int rect_is_valid(const SpiceRect *r)
{
if (r->top > r->bottom || r->left > r->right) {
printf("%s: invalid rect\n", __FUNCTION__);
@@ -52,7 +52,7 @@ static int rect_is_valid(const Rect *r)
}
#ifdef REGION_TEST
-static void rect_set(Rect *r, int32_t top, int32_t left, int32_t bottom, int32_t right)
+static void rect_set(SpiceRect *r, int32_t top, int32_t left, int32_t bottom, int32_t right)
{
r->top = top;
r->left = left;
@@ -97,10 +97,10 @@ void region_clone(QRegion *dest, const QRegion *src)
dest->rects = dest->buf;
dest->rects_size = RECTS_BUF_SIZE;
} else {
- dest->rects = (Rect *)malloc(sizeof(Rect) * dest->num_rects);
+ dest->rects = (SpiceRect *)malloc(sizeof(SpiceRect) * dest->num_rects);
dest->rects_size = dest->num_rects;
}
- memcpy(dest->rects, src->rects, dest->num_rects * sizeof(Rect));
+ memcpy(dest->rects, src->rects, dest->num_rects * sizeof(SpiceRect));
ASSERT(REGION_IS_VALID(src));
ASSERT(REGION_IS_VALID(dest));
}
@@ -109,7 +109,7 @@ int region_is_valid(const QRegion *rgn)
{
if (rgn->num_rects) {
uint32_t i;
- Rect bbox;
+ SpiceRect bbox;
if (!rect_is_valid(&rgn->bbox)) {
return FALSE;
@@ -119,14 +119,14 @@ int region_is_valid(const QRegion *rgn)
return FALSE;
}
for (i = 1; i < rgn->num_rects; i++) {
- Rect *r;
+ SpiceRect *r;
r = &rgn->rects[i];
if (!rect_is_valid(r) || rect_is_empty(r)) {
return FALSE;
}
- Rect *priv = r - 1;
+ SpiceRect *priv = r - 1;
if (r->top < priv->top) {
return FALSE;
} else if (r->top == priv->top) {
@@ -249,11 +249,11 @@ int region_is_equal(const QRegion *rgn1, const QRegion *rgn2)
#endif
typedef struct RgnOpCtx {
- Rect *now;
- Rect *end;
- Rect *scan_line;
- Rect r;
- Rect split;
+ SpiceRect *now;
+ SpiceRect *end;
+ SpiceRect *scan_line;
+ SpiceRect r;
+ SpiceRect split;
#ifdef REGION_USE_IMPROVED
int abort;
#endif
@@ -266,8 +266,8 @@ static inline int op_ctx_is_valid(RgnOpCtx *ctx)
static void op_context_next(RgnOpCtx *ctx)
{
- Rect *now;
- Rect *next;
+ SpiceRect *now;
+ SpiceRect *next;
ASSERT(op_ctx_is_valid(ctx));
now = ctx->now;
@@ -298,7 +298,7 @@ static void op_context_next(RgnOpCtx *ctx)
ctx->now = next;
}
-static void op_context_init(RgnOpCtx *ctx, uint32_t num_rects, Rect *rects)
+static void op_context_init(RgnOpCtx *ctx, uint32_t num_rects, SpiceRect *rects)
{
ctx->scan_line = ctx->now = rects;
ctx->end = ctx->now + num_rects;
@@ -334,17 +334,17 @@ static inline void op_ctx_split(RgnOpCtx *ctx, int32_t h_line)
ctx->r.bottom = h_line;
}
-static void region_steal_rects(QRegion *rgn, uint32_t *num_rects, Rect **rects)
+static void region_steal_rects(QRegion *rgn, uint32_t *num_rects, SpiceRect **rects)
{
ASSERT(REGION_IS_VALID(rgn));
if ((*num_rects = rgn->num_rects)) {
if (rgn->rects == rgn->buf) {
- *rects = (Rect *)malloc(sizeof(Rect) * rgn->num_rects);
- memcpy(*rects, rgn->rects, sizeof(Rect) * rgn->num_rects);
+ *rects = (SpiceRect *)malloc(sizeof(SpiceRect) * rgn->num_rects);
+ memcpy(*rects, rgn->rects, sizeof(SpiceRect) * rgn->num_rects);
} else {
*rects = rgn->rects;
#ifdef ALLOC_ON_STEAL
- rgn->rects = (Rect *)malloc(sizeof(Rect) * rgn->num_rects);
+ rgn->rects = (SpiceRect *)malloc(sizeof(SpiceRect) * rgn->num_rects);
rgn->rects_size = rgn->num_rects;
rgn->num_rects = 0;
return;
@@ -359,14 +359,14 @@ static void region_steal_rects(QRegion *rgn, uint32_t *num_rects, Rect **rects)
typedef struct JoinContext {
QRegion *rgn;
- Rect *line0;
- Rect *line1;
- Rect *end;
+ SpiceRect *line0;
+ SpiceRect *line1;
+ SpiceRect *end;
} JoinContext;
-static inline Rect *__get_line(QRegion *rgn, Rect *pos)
+static inline SpiceRect *__get_line(QRegion *rgn, SpiceRect *pos)
{
- Rect *end = rgn->rects + rgn->num_rects;
+ SpiceRect *end = rgn->rects + rgn->num_rects;
if (pos < end) {
int32_t line_top = pos->top;
@@ -394,8 +394,8 @@ static inline int region_join_next(JoinContext *context)
static inline void region_join_join(JoinContext *context)
{
- Rect *pos_0 = context->line0;
- Rect *pos_1 = context->line1;
+ SpiceRect *pos_0 = context->line0;
+ SpiceRect *pos_1 = context->line1;
int32_t bottom;
QRegion *rgn;
@@ -441,7 +441,7 @@ static inline void region_join(QRegion *rgn)
ASSERT(REGION_IS_VALID(rgn));
}
-static void region_push_rect(QRegion *rgn, Rect *r)
+static void region_push_rect(QRegion *rgn, SpiceRect *r)
{
ASSERT(REGION_IS_VALID(rgn));
ASSERT(rect_is_valid(r));
@@ -450,7 +450,7 @@ static void region_push_rect(QRegion *rgn, Rect *r)
rgn->rects[0] = rgn->bbox = *r;
return;
} else {
- Rect *priv = &rgn->rects[rgn->num_rects - 1];
+ SpiceRect *priv = &rgn->rects[rgn->num_rects - 1];
if (priv->top == r->top && priv->right == r->left) {
ASSERT(priv->bottom == r->bottom);
@@ -459,10 +459,10 @@ static void region_push_rect(QRegion *rgn, Rect *r)
return;
}
if (rgn->rects_size == rgn->num_rects) {
- Rect *old = rgn->rects;
+ SpiceRect *old = rgn->rects;
rgn->rects_size = rgn->rects_size * 2;
- rgn->rects = (Rect *)malloc(sizeof(Rect) * rgn->rects_size);
- memcpy(rgn->rects, old, sizeof(Rect) * rgn->num_rects);
+ rgn->rects = (SpiceRect *)malloc(sizeof(SpiceRect) * rgn->rects_size);
+ memcpy(rgn->rects, old, sizeof(SpiceRect) * rgn->num_rects);
if (old != rgn->buf) {
free(old);
}
@@ -474,10 +474,10 @@ static void region_push_rect(QRegion *rgn, Rect *r)
#ifdef REGION_USE_IMPROVED
-static Rect *op_context_find_area_below(RgnOpCtx *ctx, int32_t val)
+static SpiceRect *op_context_find_area_below(RgnOpCtx *ctx, int32_t val)
{
- Rect *start = ctx->now;
- Rect *end = ctx->end;
+ SpiceRect *start = ctx->now;
+ SpiceRect *end = ctx->end;
while (start != end) {
int pos = (end - start) / 2;
@@ -492,7 +492,7 @@ static Rect *op_context_find_area_below(RgnOpCtx *ctx, int32_t val)
static int op_context_skip_v(RgnOpCtx *ctx, int32_t top)
{
- Rect *end = op_context_find_area_below(ctx, top);
+ SpiceRect *end = op_context_find_area_below(ctx, top);
if (end != ctx->now) {
ctx->now = ctx->scan_line = end;
if (ctx->now == ctx->end) {
@@ -505,13 +505,13 @@ static int op_context_skip_v(RgnOpCtx *ctx, int32_t top)
return FALSE;
}
-typedef void (*op_callback_t)(RgnOpCtx *context, Rect *, Rect *);
+typedef void (*op_callback_t)(RgnOpCtx *context, SpiceRect *, SpiceRect *);
static void op_context_skip(RgnOpCtx *self, RgnOpCtx *other, op_callback_t on_self,
op_callback_t on_other)
{
- Rect *save1 = self->now;
- Rect *save2 = other->now;
+ SpiceRect *save1 = self->now;
+ SpiceRect *save2 = other->now;
int more;
do {
op_context_skip_v(self, other->r.top);
@@ -606,7 +606,7 @@ typedef struct SelfOpCtx {
QRegion *rgn;
} SelfOpCtx;
-static void add_rects(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void add_rects(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
SelfOpCtx *self_ctx = (SelfOpCtx *)ctx;
for (; now < end; now++) {
@@ -620,7 +620,7 @@ static void region_op(QRegion *rgn, const QRegion *other_rgn, op_callback_t on_s
SelfOpCtx self;
RgnOpCtx other;
uint32_t num_rects;
- Rect *rects;
+ SpiceRect *rects;
region_steal_rects(rgn, &num_rects, &rects);
op_context_init(&self.ctx, num_rects, rects);
@@ -665,7 +665,7 @@ typedef struct TestOpCtx {
} TestOpCtx;
-static void region_test_on_self(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void region_test_on_self(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
TestOpCtx *test_ctx = (TestOpCtx *)ctx;
test_ctx->result |= REGION_TEST_LEFT_EXCLUSIVE;
@@ -675,7 +675,7 @@ static void region_test_on_self(RgnOpCtx *ctx, Rect *now, Rect *end)
}
}
-static void region_test_on_other(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void region_test_on_other(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
TestOpCtx *test_ctx = (TestOpCtx *)ctx;
test_ctx->result |= REGION_TEST_RIGHT_EXCLUSIVE;
@@ -685,7 +685,7 @@ static void region_test_on_other(RgnOpCtx *ctx, Rect *now, Rect *end)
}
}
-static void region_test_on_both(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void region_test_on_both(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
TestOpCtx *test_ctx = (TestOpCtx *)ctx;
test_ctx->result |= REGION_TEST_SHARED;
@@ -715,7 +715,7 @@ int region_test(const QRegion *rgn, const QRegion *other_rgn, int query)
#define RIGION_OP_ADD_OTHER (1 << 1)
#define RIGION_OP_ADD_COMMON (1 << 2)
-static inline void region_on_self(QRegion *rgn, Rect *r, uint32_t op)
+static inline void region_on_self(QRegion *rgn, SpiceRect *r, uint32_t op)
{
ASSERT(REGION_IS_VALID(rgn));
if (op & RIGION_OP_ADD_SELF) {
@@ -723,7 +723,7 @@ static inline void region_on_self(QRegion *rgn, Rect *r, uint32_t op)
}
}
-static inline void region_on_other(QRegion *rgn, Rect *r, uint32_t op)
+static inline void region_on_other(QRegion *rgn, SpiceRect *r, uint32_t op)
{
ASSERT(REGION_IS_VALID(rgn));
if (op & RIGION_OP_ADD_OTHER) {
@@ -731,7 +731,7 @@ static inline void region_on_other(QRegion *rgn, Rect *r, uint32_t op)
}
}
-static inline void region_on_both(QRegion *rgn, Rect *r, uint32_t op)
+static inline void region_on_both(QRegion *rgn, SpiceRect *r, uint32_t op)
{
ASSERT(REGION_IS_VALID(rgn));
if (op & RIGION_OP_ADD_COMMON) {
@@ -744,7 +744,7 @@ static void region_op(QRegion *rgn, const QRegion *other_rgn, uint32_t op)
RgnOpCtx self;
RgnOpCtx other;
uint32_t num_rects;
- Rect *rects;
+ SpiceRect *rects;
ASSERT(REGION_IS_VALID(rgn));
ASSERT(REGION_IS_VALID(other_rgn));
@@ -809,8 +809,8 @@ void region_exclude(QRegion *rgn, const QRegion *other_rgn)
void region_offset(QRegion *rgn, int32_t dx, int32_t dy)
{
- Rect *now;
- Rect *end;
+ SpiceRect *now;
+ SpiceRect *end;
ASSERT(REGION_IS_VALID(rgn));
if (region_is_empty(rgn)) {
return;
@@ -823,7 +823,7 @@ void region_offset(QRegion *rgn, int32_t dx, int32_t dy)
}
}
-void region_add(QRegion *rgn, const Rect *r)
+void region_add(QRegion *rgn, const SpiceRect *r)
{
ASSERT(REGION_IS_VALID(rgn));
ASSERT(rect_is_valid(r));
@@ -842,7 +842,7 @@ void region_add(QRegion *rgn, const Rect *r)
}
}
-void region_remove(QRegion *rgn, const Rect *r)
+void region_remove(QRegion *rgn, const SpiceRect *r)
{
ASSERT(REGION_IS_VALID(rgn));
ASSERT(rect_is_valid(r));
@@ -934,7 +934,7 @@ int region_contains_point(const QRegion *rgn, int32_t x, int32_t y)
if (region_is_empty(rgn)) {
return FALSE;
}
- Rect point;
+ SpiceRect point;
point.left = x;
point.right = point.left + 1;
point.top = y;
@@ -944,8 +944,8 @@ int region_contains_point(const QRegion *rgn, int32_t x, int32_t y)
return FALSE;
}
- Rect* now = rgn->rects;
- Rect* end = now + rgn->num_rects;
+ SpiceRect* now = rgn->rects;
+ SpiceRect* end = now + rgn->num_rects;
for (; now < end; now++) {
if (rect_intersects(now, &point)) {
@@ -990,8 +990,8 @@ int main(void)
QRegion *r1 = &_r1;
QRegion *r2 = &_r2;
QRegion *r3 = &_r3;
- Rect _r;
- Rect *r = &_r;
+ SpiceRect _r;
+ SpiceRect *r = &_r;
int expected[5];
region_init(r1);
diff --git a/common/region.h b/common/region.h
index 29a58223..73f8ed9d 100644
--- a/common/region.h
+++ b/common/region.h
@@ -27,10 +27,10 @@
typedef struct QRegion {
uint32_t num_rects;
- Rect bbox;
- Rect *rects;
+ SpiceRect bbox;
+ SpiceRect *rects;
uint32_t rects_size;
- Rect buf[RECTS_BUF_SIZE];
+ SpiceRect buf[RECTS_BUF_SIZE];
} QRegion;
#ifdef REGION_USE_IMPROVED
@@ -64,8 +64,8 @@ void region_and(QRegion *rgn, const QRegion *other_rgn);
void region_xor(QRegion *rgn, const QRegion *other_rgn);
void region_exclude(QRegion *rgn, const QRegion *other_rgn);
-void region_add(QRegion *rgn, const Rect *r);
-void region_remove(QRegion *rgn, const Rect *r);
+void region_add(QRegion *rgn, const SpiceRect *r);
+void region_remove(QRegion *rgn, const SpiceRect *r);
void region_offset(QRegion *rgn, int32_t dx, int32_t dy);
diff --git a/common/rop3.c b/common/rop3.c
index 08f9cad3..6d2efa2b 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -24,11 +24,11 @@
#endif
typedef void (*rop3_with_pattern_handler_t)(cairo_surface_t *d, cairo_surface_t *s,
- Point *src_pos, cairo_surface_t *p,
- Point *pat_pos);
+ SpicePoint *src_pos, cairo_surface_t *p,
+ SpicePoint *pat_pos);
typedef void (*rop3_with_color_handler_t)(cairo_surface_t *d, cairo_surface_t *s,
- Point *src_pos, uint32_t rgb);
+ SpicePoint *src_pos, uint32_t rgb);
typedef void (*rop3_test_handler_t)();
@@ -40,13 +40,13 @@ static rop3_test_handler_t rop3_test_handlers[ROP3_NUM_OPS];
static void default_rop3_with_pattern_handler(cairo_surface_t *d, cairo_surface_t *s,
- Point *src_pos, cairo_surface_t *p,
- Point *pat_pos)
+ SpicePoint *src_pos, cairo_surface_t *p,
+ SpicePoint *pat_pos)
{
WARN("not implemented 0x%x");
}
-static void default_rop3_withe_color_handler(cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
+static void default_rop3_withe_color_handler(cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
uint32_t rgb)
{
WARN("not implemented 0x%x");
@@ -57,8 +57,8 @@ static void default_rop3_test_handler()
}
#define ROP3_HANDLERS(name, formula, index) \
-static void rop3_handle_p_##name(cairo_surface_t *d, cairo_surface_t *s, Point *src_pos, \
- cairo_surface_t *p, Point *pat_pos) \
+static void rop3_handle_p_##name(cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos, \
+ cairo_surface_t *p, SpicePoint *pat_pos) \
{ \
int width = cairo_image_surface_get_width(d); \
int height = cairo_image_surface_get_height(d); \
@@ -94,7 +94,7 @@ static void rop3_handle_p_##name(cairo_surface_t *d, cairo_surface_t *s, Point *
} \
} \
\
-static void rop3_handle_c_##name(cairo_surface_t *d, cairo_surface_t *s, Point *src_pos, \
+static void rop3_handle_c_##name(cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos, \
uint32_t rgb) \
{ \
int width = cairo_image_surface_get_width(d); \
@@ -599,13 +599,13 @@ void rop3_init()
}
}
-void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
- cairo_surface_t *p, Point *pat_pos)
+void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
+ cairo_surface_t *p, SpicePoint *pat_pos)
{
rop3_with_pattern_handlers[rop3](d, s, src_pos, p, pat_pos);
}
-void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
+void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
uint32_t rgb)
{
rop3_with_color_handlers[rop3](d, s, src_pos, rgb);
diff --git a/common/rop3.h b/common/rop3.h
index fcf86423..31cbcdaa 100644
--- a/common/rop3.h
+++ b/common/rop3.h
@@ -23,9 +23,9 @@
#include "draw.h"
#include "cairo.h"
-void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
- cairo_surface_t *p, Point *pat_pos);
-void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
+void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
+ cairo_surface_t *p, SpicePoint *pat_pos);
+void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
uint32_t rgb);
void rop3_init();
diff --git a/server/red_channel.c b/server/red_channel.c
index 48ace448..d8ea49dc 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -72,17 +72,17 @@ static void red_peer_handle_incoming(RedsStreamContext *peer, IncomingHandler *h
for (;;) {
int ret_handle;
- if (handler->header_pos < sizeof(RedDataHeader)) {
+ if (handler->header_pos < sizeof(SpiceDataHeader)) {
bytes_read = red_peer_receive(peer,
((uint8_t *)&handler->header) + handler->header_pos,
- sizeof(RedDataHeader) - handler->header_pos);
+ sizeof(SpiceDataHeader) - handler->header_pos);
if (bytes_read == -1) {
handler->on_error(handler->opaque);
return;
}
handler->header_pos += bytes_read;
- if (handler->header_pos != sizeof(RedDataHeader)) {
+ if (handler->header_pos != sizeof(SpiceDataHeader)) {
return;
}
}
@@ -328,17 +328,17 @@ void red_channel_init_outgoing_messages_window(RedChannel *channel)
red_channel_push(channel);
}
-int red_channel_handle_message(RedChannel *channel, RedDataHeader *header, uint8_t *msg)
+int red_channel_handle_message(RedChannel *channel, SpiceDataHeader *header, uint8_t *msg)
{
switch (header->type) {
- case REDC_ACK_SYNC:
+ case SPICE_MSGC_ACK_SYNC:
if (header->size != sizeof(uint32_t)) {
red_printf("bad message size");
return FALSE;
}
channel->ack_data.client_generation = *(uint32_t *)(msg);
break;
- case REDC_ACK:
+ case SPICE_MSGC_ACK:
if (channel->ack_data.client_generation == channel->ack_data.generation) {
channel->ack_data.messages_window -= CLIENT_ACK_WINDOW;
red_channel_push(channel);
@@ -377,7 +377,7 @@ void red_channel_reset_send_data(RedChannel *channel)
channel->send_data.header.size = 0;
channel->send_data.header.sub_list = 0;
++channel->send_data.header.serial;
- __red_channel_add_buf(channel, (void *)&channel->send_data.header, sizeof(RedDataHeader));
+ __red_channel_add_buf(channel, (void *)&channel->send_data.header, sizeof(SpiceDataHeader));
}
void red_channel_init_send_data(RedChannel *channel, uint16_t msg_type, PipeItem *item)
@@ -408,7 +408,7 @@ static void red_channel_send(RedChannel *channel)
void red_channel_begin_send_massage(RedChannel *channel)
{
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
channel->ack_data.messages_window++;
red_channel_send(channel);
}
diff --git a/server/red_channel.h b/server/red_channel.h
index 1096ba70..8c8518c4 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -36,15 +36,15 @@
At the final stage, this interface shouldn't be exposed. Only RedChannel will use it. */
typedef int (*handle_message_proc)(void *opaque,
- RedDataHeader *header, uint8_t *msg);
-typedef uint8_t *(*alloc_msg_recv_buf_proc)(void *opaque, RedDataHeader *msg_header);
+ SpiceDataHeader *header, uint8_t *msg);
+typedef uint8_t *(*alloc_msg_recv_buf_proc)(void *opaque, SpiceDataHeader *msg_header);
typedef void (*release_msg_recv_buf_proc)(void *opaque,
- RedDataHeader *msg_header, uint8_t *msg);
+ SpiceDataHeader *msg_header, uint8_t *msg);
typedef void (*on_incoming_error_proc)(void *opaque);
typedef struct IncomingHandler {
void *opaque;
- RedDataHeader header;
+ SpiceDataHeader header;
uint32_t header_pos;
uint8_t *msg; // data of the msg following the header. allocated by alloc_msg_buf.
uint32_t msg_pos;
@@ -88,11 +88,11 @@ typedef struct PipeItem {
typedef struct RedChannel RedChannel;
typedef uint8_t *(*channel_alloc_msg_recv_buf_proc)(RedChannel *channel,
- RedDataHeader *msg_header);
+ SpiceDataHeader *msg_header);
typedef int (*channel_handle_message_proc)(RedChannel *channel,
- RedDataHeader *header, uint8_t *msg);
+ SpiceDataHeader *header, uint8_t *msg);
typedef void (*channel_release_msg_recv_buf_proc)(RedChannel *channel,
- RedDataHeader *msg_header, uint8_t *msg);
+ SpiceDataHeader *msg_header, uint8_t *msg);
typedef void (*channel_disconnect_proc)(RedChannel *channel);
typedef int (*channel_configure_socket_proc)(RedChannel *channel);
typedef void (*channel_send_pipe_item_proc)(RedChannel *channel, PipeItem *item);
@@ -115,10 +115,10 @@ struct RedChannel {
uint32_t pipe_size;
struct {
- RedDataHeader header;
+ SpiceDataHeader header;
union {
- RedSetAck ack;
- RedMigrate migrate;
+ SpiceMsgSetAck ack;
+ SpiceMsgMigrate migrate;
} u;
uint32_t n_bufs;
BufDescriptor bufs[MAX_SEND_BUFS];
@@ -158,7 +158,7 @@ void red_channel_shutdown(RedChannel *channel);
void red_channel_init_outgoing_messages_window(RedChannel *channel);
/* handles general channel msgs from the client */
-int red_channel_handle_message(RedChannel *channel, RedDataHeader *header, uint8_t *msg);
+int red_channel_handle_message(RedChannel *channel, SpiceDataHeader *header, uint8_t *msg);
/* when preparing send_data: should call reset, then init and then add_buf per buffer that is
being sent */
diff --git a/server/red_client_cache.h b/server/red_client_cache.h
index c7b40e2f..3db0ce9c 100644
--- a/server/red_client_cache.h
+++ b/server/red_client_cache.h
@@ -20,7 +20,7 @@
#define CACHE_NAME cursor_cache
#define CACHE_HASH_KEY CURSOR_CACHE_HASH_KEY
#define CACHE_HASH_SIZE CURSOR_CACHE_HASH_SIZE
-#define CACHE_INVAL_TYPE RED_CURSOR_INVAL_ONE
+#define CACHE_INVAL_TYPE SPICE_MSG_CURSOR_INVAL_ONE
#define FUNC_NAME(name) red_cursor_cache_##name
#define VAR_NAME(name) cursor_cache_##name
#define CHANNEL CursorChannel
@@ -30,7 +30,7 @@
#define CACHE_NAME palette_cache
#define CACHE_HASH_KEY PALETTE_CACHE_HASH_KEY
#define CACHE_HASH_SIZE PALETTE_CACHE_HASH_SIZE
-#define CACHE_INVAL_TYPE RED_DISPLAY_INVAL_PALETTE
+#define CACHE_INVAL_TYPE SPICE_MSG_DISPLAY_INVAL_PALETTE
#define FUNC_NAME(name) red_palette_cache_##name
#define VAR_NAME(name) palette_cache_##name
#define CHANNEL DisplayChannel
diff --git a/server/red_client_shared_cache.h b/server/red_client_shared_cache.h
index 1d3c4528..141f1b11 100644
--- a/server/red_client_shared_cache.h
+++ b/server/red_client_shared_cache.h
@@ -27,7 +27,7 @@
#define PRIVATE_FUNC_NAME(name) __pixmap_cache_##name
#define CHANNEL DisplayChannel
#define CACH_GENERATION pixmap_cache_generation
-#define INVAL_ALL_VERB RED_DISPLAY_INVAL_ALL_PIXMAPS
+#define INVAL_ALL_VERB SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS
#else
#error "no cache type."
@@ -112,7 +112,7 @@ static int FUNC_NAME(add)(CACHE *cache, uint64_t id, uint32_t size, CHANNEL *cha
cache->items--;
cache->available += tail->size;
cache->sync[channel->base.id] = serial;
- display_channel_push_release(channel, RED_RES_TYPE_PIXMAP, tail->id, tail->sync);
+ display_channel_push_release(channel, SPICE_RES_TYPE_PIXMAP, tail->id, tail->sync);
free(tail);
}
++cache->items;
@@ -149,7 +149,7 @@ static void PRIVATE_FUNC_NAME(clear)(CACHE *cache)
cache->items = 0;
}
-static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, RedWaitForChannels* sync_data)
+static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, SpiceMsgWaitForChannels* sync_data)
{
uint8_t wait_count;
uint64_t serial;
@@ -167,7 +167,7 @@ static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, RedWaitForChannels*
wait_count = 0;
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
if (cache->sync[i] && i != channel->base.id) {
- sync_data->wait_list[wait_count].channel_type = RED_CHANNEL_DISPLAY;
+ sync_data->wait_list[wait_count].channel_type = SPICE_CHANNEL_DISPLAY;
sync_data->wait_list[wait_count].channel_id = i;
sync_data->wait_list[wait_count++].message_serial = cache->sync[i];
}
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index e35aba35..d829805e 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -543,7 +543,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
red_error("reds channel malloc failed");
}
memset(reds_channel, 0, sizeof(Channel));
- reds_channel->type = RED_CHANNEL_DISPLAY;
+ reds_channel->type = SPICE_CHANNEL_DISPLAY;
reds_channel->id = qxl_interface->base.id;
reds_channel->link = red_dispatcher_set_peer;
reds_channel->shutdown = red_dispatcher_shutdown_peer;
@@ -555,7 +555,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
red_error("reds channel malloc failed");
}
memset(cursor_channel, 0, sizeof(Channel));
- cursor_channel->type = RED_CHANNEL_CURSOR;
+ cursor_channel->type = SPICE_CHANNEL_CURSOR;
cursor_channel->id = qxl_interface->base.id;
cursor_channel->link = red_dispatcher_set_cursor_peer;
cursor_channel->shutdown = red_dispatcher_shutdown_cursor_peer;
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index e4cb2172..a2a4eca2 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -115,8 +115,8 @@ typedef struct RedSocketRawSndBuf {
/* data received from the client */
typedef struct RedSocketRawRcvBuf {
RawTunneledBuffer base;
- uint8_t buf[MAX_SOCKET_DATA_SIZE + sizeof(RedcTunnelSocketData)];
- RedcTunnelSocketData *msg_info;
+ uint8_t buf[MAX_SOCKET_DATA_SIZE + sizeof(SpiceMsgcTunnelSocketData)];
+ SpiceMsgcTunnelSocketData *msg_info;
} RedSocketRawRcvBuf;
typedef struct ReadyTunneledChunk ReadyTunneledChunk;
@@ -276,7 +276,7 @@ struct RedSocket {
uint32_t mig_client_status_msg; // the last status change msg that was received from
//the client during migration, and thus was unhandled.
// It is 0 if the status didn't change during migration
- uint32_t mig_open_ack_tokens; // if REDC_TUNNEL_SOCKET_OPEN_ACK was received during
+ uint32_t mig_open_ack_tokens; // if SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK was received during
// migration, we store the tokens we received in the
// msg.
};
@@ -492,14 +492,14 @@ struct TunnelChannel {
struct {
union {
- RedTunnelInit init;
- RedTunnelServiceIpMap service_ip;
- RedTunnelSocketOpen socket_open;
- RedTunnelSocketFin socket_fin;
- RedTunnelSocketClose socket_close;
- RedTunnelSocketClosedAck socket_close_ack;
- RedTunnelSocketData socket_data;
- RedTunnelSocketTokens socket_token;
+ SpiceMsgTunnelInit init;
+ SpiceMsgTunnelServiceIpMap service_ip;
+ SpiceMsgTunnelSocketOpen socket_open;
+ SpiceMsgTunnelSocketFin socket_fin;
+ SpiceMsgTunnelSocketClose socket_close;
+ SpiceMsgTunnelSocketClosedAck socket_close_ack;
+ SpiceMsgTunnelSocketData socket_data;
+ SpiceMsgTunnelSocketTokens socket_token;
TunnelMigrateData migrate_data;
} u;
} send_data;
@@ -712,7 +712,7 @@ static inline RedSocketRawRcvBuf *__tunnel_worker_alloc_socket_rcv_buf(TunnelWor
red_error("malloc of send buf failed");
}
}
- ret->msg_info = (RedcTunnelSocketData *)ret->buf;
+ ret->msg_info = (SpiceMsgcTunnelSocketData *)ret->buf;
ret->base.usr_opaque = NULL;
ret->base.data = ret->msg_info->data;
ret->base.size = 0;
@@ -953,7 +953,7 @@ static TunneledBufferProcessQueue *tunnel_socket_alloc_simple_print_request_proc
RedSocket *sckt)
{
return __tunnel_socket_alloc_simple_process_queue(sckt,
- RED_TUNNEL_SERVICE_TYPE_IPP,
+ SPICE_TUNNEL_SERVICE_TYPE_IPP,
PROCESS_DIRECTION_TYPE_REQUEST);
}
@@ -961,7 +961,7 @@ static TunneledBufferProcessQueue *tunnel_socket_alloc_simple_print_reply_proces
RedSocket *sckt)
{
return __tunnel_socket_alloc_simple_process_queue(sckt,
- RED_TUNNEL_SERVICE_TYPE_IPP,
+ SPICE_TUNNEL_SERVICE_TYPE_IPP,
PROCESS_DIRECTION_TYPE_REPLY);
}
@@ -1015,7 +1015,7 @@ void *red_tunnel_attach(CoreInterface *core_interface, NetWireInterface *vlan_in
worker->null_interface.worker = worker;
- worker->channel_interface.type = RED_CHANNEL_TUNNEL;
+ worker->channel_interface.type = SPICE_CHANNEL_TUNNEL;
worker->channel_interface.id = 0;
worker->channel_interface.link = handle_tunnel_channel_link;
worker->channel_interface.shutdown = handle_tunnel_channel_shutdown;
@@ -1110,7 +1110,7 @@ static inline TunnelService *__tunnel_worker_add_service(TunnelWorker *worker, u
}
static TunnelService *tunnel_worker_add_service(TunnelWorker *worker, uint32_t size,
- RedcTunnelAddGenericService *redc_service)
+ SpiceMsgcTunnelAddGenericService *redc_service)
{
return __tunnel_worker_add_service(worker, size, redc_service->type,
redc_service->id, redc_service->group,
@@ -1136,7 +1136,7 @@ static void tunnel_worker_free_print_service(TunnelWorker *worker, TunnelPrintSe
}
static TunnelPrintService *tunnel_worker_add_print_service(TunnelWorker *worker,
- RedcTunnelAddPrintService *redc_service)
+ SpiceMsgcTunnelAddPrintService *redc_service)
{
TunnelPrintService *service;
@@ -1147,8 +1147,8 @@ static TunnelPrintService *tunnel_worker_add_print_service(TunnelWorker *worker,
return NULL;
}
- if (redc_service->ip.type == RED_TUNNEL_IP_TYPE_IPv4) {
- memcpy(service->ip, redc_service->ip.data, sizeof(RedTunnelIPv4));
+ if (redc_service->ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) {
+ memcpy(service->ip, redc_service->ip.data, sizeof(SpiceTunnelIPv4));
} else {
red_printf("unexpected ip type=%d", redc_service->ip.type);
tunnel_worker_free_print_service(worker, service);
@@ -1162,14 +1162,14 @@ static TunnelPrintService *tunnel_worker_add_print_service(TunnelWorker *worker,
}
static int tunnel_channel_handle_service_add(TunnelChannel *channel,
- RedcTunnelAddGenericService *service_msg)
+ SpiceMsgcTunnelAddGenericService *service_msg)
{
TunnelService *out_service = NULL;
- if (service_msg->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ if (service_msg->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
out_service = &tunnel_worker_add_print_service(channel->worker,
- (RedcTunnelAddPrintService *)
+ (SpiceMsgcTunnelAddPrintService *)
service_msg)->base;
- } else if (service_msg->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ } else if (service_msg->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
out_service = tunnel_worker_add_service(channel->worker, sizeof(TunnelService),
service_msg);
} else {
@@ -1214,9 +1214,9 @@ static inline void tunnel_worker_clear_routed_network(TunnelWorker *worker)
{
while (!ring_is_empty(&worker->services)) {
TunnelService *service = (TunnelService *)ring_get_head(&worker->services);
- if (service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
tunnel_worker_free_service(worker, service);
- } else if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
tunnel_worker_free_print_service(worker, (TunnelPrintService *)service);
} else {
red_error("unexpected service type");
@@ -1429,13 +1429,13 @@ static int tunnel_channel_handle_socket_connect_ack(TunnelChannel *channel, RedS
red_printf("TUNNEL_DBG");
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_OPEN_ACK;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK;
sckt->mig_open_ack_tokens = tokens;
return TRUE;
}
if (sckt->client_status != CLIENT_SCKT_STATUS_WAIT_OPEN) {
- red_printf("unexpected REDC_TUNNEL_SOCKET_OPEN_ACK status=%d", sckt->client_status);
+ red_printf("unexpected SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK status=%d", sckt->client_status);
return FALSE;
}
sckt->client_status = CLIENT_SCKT_STATUS_OPEN;
@@ -1462,12 +1462,12 @@ static int tunnel_channel_handle_socket_connect_nack(TunnelChannel *channel, Red
PRINT_SCKT(sckt);
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_OPEN_NACK;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK;
return TRUE;
}
if (sckt->client_status != CLIENT_SCKT_STATUS_WAIT_OPEN) {
- red_printf("unexpected REDC_TUNNEL_SOCKET_OPEN_NACK status=%d", sckt->client_status);
+ red_printf("unexpected SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK status=%d", sckt->client_status);
return FALSE;
}
sckt->client_status = CLIENT_SCKT_STATUS_CLOSED;
@@ -1487,12 +1487,12 @@ static int tunnel_channel_handle_socket_fin(TunnelChannel *channel, RedSocket *s
PRINT_SCKT(sckt);
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_FIN;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_FIN;
return TRUE;
}
if (sckt->client_status != CLIENT_SCKT_STATUS_OPEN) {
- red_printf("unexpected REDC_TUNNEL_SOCKET_FIN status=%d", sckt->client_status);
+ red_printf("unexpected SPICE_MSGC_TUNNEL_SOCKET_FIN status=%d", sckt->client_status);
return FALSE;
}
sckt->client_status = CLIENT_SCKT_STATUS_SHUTDOWN_SEND;
@@ -1525,7 +1525,7 @@ static int tunnel_channel_handle_socket_closed(TunnelChannel *channel, RedSocket
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_CLOSED;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_CLOSED;
return TRUE;
}
@@ -1571,7 +1571,7 @@ static int tunnel_channel_handle_socket_closed_ack(TunnelChannel *channel, RedSo
PRINT_SCKT(sckt);
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_CLOSED_ACK;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK;
return TRUE;
}
@@ -1583,7 +1583,7 @@ static int tunnel_channel_handle_socket_closed_ack(TunnelChannel *channel, RedSo
}
if (sckt->slirp_status != SLIRP_SCKT_STATUS_CLOSED) {
- red_printf("unexcpected REDC_TUNNEL_SOCKET_CLOSED_ACK slirp_status=%d",
+ red_printf("unexcpected SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK slirp_status=%d",
sckt->slirp_status);
return FALSE;
}
@@ -1597,7 +1597,7 @@ static int tunnel_channel_handle_socket_receive_data(TunnelChannel *channel, Red
{
if ((sckt->client_status == CLIENT_SCKT_STATUS_SHUTDOWN_SEND) ||
(sckt->client_status == CLIENT_SCKT_STATUS_CLOSED)) {
- red_printf("unexcpected REDC_TUNNEL_SOCKET_DATA clinet_status=%d",
+ red_printf("unexcpected SPICE_MSGC_TUNNEL_SOCKET_DATA clinet_status=%d",
sckt->client_status);
return FALSE;
}
@@ -1641,7 +1641,7 @@ static inline int __client_socket_can_receive(RedSocket *sckt)
}
static int tunnel_channel_handle_socket_token(TunnelChannel *channel, RedSocket *sckt,
- RedcTunnelSocketTokens *message)
+ SpiceMsgcTunnelSocketTokens *message)
{
sckt->out_data.num_tokens += message->num_tokens;
@@ -1655,13 +1655,13 @@ static int tunnel_channel_handle_socket_token(TunnelChannel *channel, RedSocket
return TRUE;
}
-static uint8_t *tunnel_channel_alloc_msg_rcv_buf(RedChannel *channel, RedDataHeader *msg_header)
+static uint8_t *tunnel_channel_alloc_msg_rcv_buf(RedChannel *channel, SpiceDataHeader *msg_header)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
- if (msg_header->type == REDC_TUNNEL_SOCKET_DATA) {
+ if (msg_header->type == SPICE_MSGC_TUNNEL_SOCKET_DATA) {
return (__tunnel_worker_alloc_socket_rcv_buf(tunnel_channel->worker)->buf);
- } else if ((msg_header->type == REDC_MIGRATE_DATA) ||
- (msg_header->type == REDC_TUNNEL_SERVICE_ADD)) {
+ } else if ((msg_header->type == SPICE_MSGC_MIGRATE_DATA) ||
+ (msg_header->type == SPICE_MSGC_TUNNEL_SERVICE_ADD)) {
uint8_t *ret = malloc(msg_header->size);
if (!ret) {
red_error("failed allocating");
@@ -1673,11 +1673,11 @@ static uint8_t *tunnel_channel_alloc_msg_rcv_buf(RedChannel *channel, RedDataHea
}
// called by the receive routine of the channel, before the buffer was assigned to a socket
-static void tunnel_channel_release_msg_rcv_buf(RedChannel *channel, RedDataHeader *msg_header,
+static void tunnel_channel_release_msg_rcv_buf(RedChannel *channel, SpiceDataHeader *msg_header,
uint8_t *msg)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
- if (msg_header->type == REDC_TUNNEL_SOCKET_DATA) {
+ if (msg_header->type == SPICE_MSGC_TUNNEL_SOCKET_DATA) {
ASSERT(!(CONTAINEROF(msg, RedSocketRawRcvBuf, buf)->base.usr_opaque));
__tunnel_worker_free_socket_rcv_buf(tunnel_channel->worker,
CONTAINEROF(msg, RedSocketRawRcvBuf, buf));
@@ -1690,9 +1690,9 @@ static void __tunnel_channel_fill_service_migrate_item(TunnelChannel *channel,
{
migrate_item->service = service;
TunnelMigrateService *general_data;
- if (service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
general_data = &migrate_item->u.generic_service;
- } else if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
general_data = &migrate_item->u.print_service.base;
memcpy(migrate_item->u.print_service.ip, ((TunnelPrintService *)service)->ip, 4);
} else {
@@ -1728,8 +1728,8 @@ static void __tunnel_channel_fill_socket_migrate_item(TunnelChannel *channel, Re
// checking if there is a need to save the queues
if ((sckt->client_status != CLIENT_SCKT_STATUS_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED_ACK)) {
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED) &&
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK)) {
mig_sckt->out_data.process_queue_size =
sckt->out_data.process_queue->get_migrate_data_proc(sckt->out_data.process_queue,
&migrate_item->out_process_queue);
@@ -1976,9 +1976,9 @@ static void tunnel_channel_restore_migrated_service(TunnelChannel *channel,
int service_size;
TunnelService *service;
struct in_addr virt_ip;
- if (mig_service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (mig_service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
service_size = sizeof(TunnelService);
- } else if (mig_service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (mig_service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
service_size = sizeof(TunnelPrintService);
} else {
SET_TUNNEL_ERROR(channel, "unexpected service type");
@@ -1996,7 +1996,7 @@ static void tunnel_channel_restore_migrated_service(TunnelChannel *channel,
return;
}
- if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
TunnelMigratePrintService *mig_print_service = (TunnelMigratePrintService *)mig_service;
TunnelPrintService *print_service = (TunnelPrintService *)service;
@@ -2098,14 +2098,14 @@ static void tunnel_channel_restore_socket_state(TunnelChannel *channel, RedSocke
switch (sckt->mig_client_status_msg) {
case 0:
break;
- case REDC_TUNNEL_SOCKET_OPEN_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK:
ret = tunnel_channel_handle_socket_connect_ack(channel, sckt,
sckt->mig_open_ack_tokens);
break;
- case REDC_TUNNEL_SOCKET_OPEN_NACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK:
ret = tunnel_channel_handle_socket_connect_nack(channel, sckt);
break;
- case REDC_TUNNEL_SOCKET_FIN:
+ case SPICE_MSGC_TUNNEL_SOCKET_FIN:
if (sckt->client_status == CLIENT_SCKT_STATUS_WAIT_OPEN) {
ret = tunnel_channel_handle_socket_connect_ack(channel, sckt,
sckt->mig_open_ack_tokens);
@@ -2114,7 +2114,7 @@ static void tunnel_channel_restore_socket_state(TunnelChannel *channel, RedSocke
ret = tunnel_channel_handle_socket_fin(channel, sckt);
}
break;
- case REDC_TUNNEL_SOCKET_CLOSED:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED:
// can't just send nack since we need to send close ack to client
if (sckt->client_status == CLIENT_SCKT_STATUS_WAIT_OPEN) {
ret = tunnel_channel_handle_socket_connect_ack(channel, sckt,
@@ -2123,7 +2123,7 @@ static void tunnel_channel_restore_socket_state(TunnelChannel *channel, RedSocke
ret = ret & tunnel_channel_handle_socket_closed(channel, sckt);
break;
- case REDC_TUNNEL_SOCKET_CLOSED_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK:
ret = tunnel_channel_handle_socket_closed_ack(channel, sckt);
break;
default:
@@ -2259,24 +2259,24 @@ error:
}
// msg was allocated by tunnel_channel_alloc_msg_rcv_buf
-static int tunnel_channel_handle_message(RedChannel *channel, RedDataHeader *header, uint8_t *msg)
+static int tunnel_channel_handle_message(RedChannel *channel, SpiceDataHeader *header, uint8_t *msg)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
RedSocket *sckt = NULL;
// retrieve the sckt
switch (header->type) {
- case REDC_MIGRATE_FLUSH_MARK:
- case REDC_MIGRATE_DATA:
- case REDC_TUNNEL_SERVICE_ADD:
- case REDC_TUNNEL_SERVICE_REMOVE:
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
+ case SPICE_MSGC_MIGRATE_DATA:
+ case SPICE_MSGC_TUNNEL_SERVICE_ADD:
+ case SPICE_MSGC_TUNNEL_SERVICE_REMOVE:
break;
- case REDC_TUNNEL_SOCKET_OPEN_ACK:
- case REDC_TUNNEL_SOCKET_OPEN_NACK:
- case REDC_TUNNEL_SOCKET_DATA:
- case REDC_TUNNEL_SOCKET_FIN:
- case REDC_TUNNEL_SOCKET_CLOSED:
- case REDC_TUNNEL_SOCKET_CLOSED_ACK:
- case REDC_TUNNEL_SOCKET_TOKEN:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_DATA:
+ case SPICE_MSGC_TUNNEL_SOCKET_FIN:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_TOKEN:
// the first field in these messages is connection id
sckt = tunnel_channel->worker->sockets + (*((uint16_t *)msg));
if (!sckt->allocated) {
@@ -2289,73 +2289,73 @@ static int tunnel_channel_handle_message(RedChannel *channel, RedDataHeader *hea
}
switch (header->type) {
- case REDC_TUNNEL_SERVICE_ADD:
- if (header->size < sizeof(RedcTunnelAddGenericService)) {
+ case SPICE_MSGC_TUNNEL_SERVICE_ADD:
+ if (header->size < sizeof(SpiceMsgcTunnelAddGenericService)) {
red_printf("bad message size");
free(msg);
return FALSE;
}
return tunnel_channel_handle_service_add(tunnel_channel,
- (RedcTunnelAddGenericService *)msg);
- case REDC_TUNNEL_SERVICE_REMOVE:
+ (SpiceMsgcTunnelAddGenericService *)msg);
+ case SPICE_MSGC_TUNNEL_SERVICE_REMOVE:
red_printf("REDC_TUNNEL_REMOVE_SERVICE not supported yet");
return FALSE;
- case REDC_TUNNEL_SOCKET_OPEN_ACK:
- if (header->size != sizeof(RedcTunnelSocketOpenAck)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketOpenAck)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_connect_ack(tunnel_channel, sckt,
- ((RedcTunnelSocketOpenAck *)msg)->tokens);
+ ((SpiceMsgcTunnelSocketOpenAck *)msg)->tokens);
- case REDC_TUNNEL_SOCKET_OPEN_NACK:
- if (header->size != sizeof(RedcTunnelSocketOpenNack)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketOpenNack)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_connect_nack(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_DATA:
+ case SPICE_MSGC_TUNNEL_SOCKET_DATA:
{
- if (header->size < sizeof(RedcTunnelSocketData)) {
+ if (header->size < sizeof(SpiceMsgcTunnelSocketData)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_receive_data(tunnel_channel, sckt,
CONTAINEROF(msg, RedSocketRawRcvBuf, buf),
- header->size - sizeof(RedcTunnelSocketData));
+ header->size - sizeof(SpiceMsgcTunnelSocketData));
}
- case REDC_TUNNEL_SOCKET_FIN:
- if (header->size != sizeof(RedcTunnelSocketFin)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_FIN:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketFin)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_fin(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_CLOSED:
- if (header->size != sizeof(RedcTunnelSocketClosed)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketClosed)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_closed(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_CLOSED_ACK:
- if (header->size != sizeof(RedcTunnelSocketClosedAck)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketClosedAck)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_closed_ack(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_TOKEN:
- if (header->size != sizeof(RedcTunnelSocketTokens)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_TOKEN:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketTokens)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_token(tunnel_channel, sckt,
- (RedcTunnelSocketTokens *)msg);
- case REDC_MIGRATE_FLUSH_MARK:
+ (SpiceMsgcTunnelSocketTokens *)msg);
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
return tunnel_channel_handle_migrate_mark(tunnel_channel);
- case REDC_MIGRATE_DATA:
+ case SPICE_MSGC_MIGRATE_DATA:
if (header->size < sizeof(TunnelMigrateData)) {
red_printf("bad message size");
free(msg);
@@ -2379,8 +2379,8 @@ static void tunnel_channel_send_set_ack(TunnelChannel *channel, PipeItem *item)
channel->base.send_data.u.ack.generation = ++channel->base.ack_data.generation;
channel->base.send_data.u.ack.window = CLIENT_ACK_WINDOW;
- red_channel_init_send_data(&channel->base, RED_SET_ACK, item);
- red_channel_add_buf(&channel->base, &channel->base.send_data.u.ack, sizeof(RedSetAck));
+ red_channel_init_send_data(&channel->base, SPICE_MSG_SET_ACK, item);
+ red_channel_add_buf(&channel->base, &channel->base.send_data.u.ack, sizeof(SpiceMsgSetAck));
red_channel_begin_send_massage(&channel->base);
}
@@ -2388,11 +2388,11 @@ static void tunnel_channel_send_set_ack(TunnelChannel *channel, PipeItem *item)
static void tunnel_channel_send_migrate(TunnelChannel *channel, PipeItem *item)
{
ASSERT(channel);
- channel->base.send_data.u.migrate.flags = RED_MIGRATE_NEED_FLUSH |
- RED_MIGRATE_NEED_DATA_TRANSFER;
+ channel->base.send_data.u.migrate.flags = SPICE_MIGRATE_NEED_FLUSH |
+ SPICE_MIGRATE_NEED_DATA_TRANSFER;
channel->expect_migrate_mark = TRUE;
- red_channel_init_send_data(&channel->base, RED_MIGRATE, item);
- red_channel_add_buf(&channel->base, &channel->base.send_data.u.migrate, sizeof(RedMigrate));
+ red_channel_init_send_data(&channel->base, SPICE_MSG_MIGRATE, item);
+ red_channel_add_buf(&channel->base, &channel->base.send_data.u.migrate, sizeof(SpiceMsgMigrate));
red_channel_begin_send_massage(&channel->base);
}
@@ -2438,12 +2438,12 @@ static int __tunnel_channel_send_service_migrate_data(TunnelChannel *channel,
int cur_offset = offset;
TunnelMigrateService *generic_data;
- if (service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
generic_data = &item->u.generic_service;
red_channel_add_buf(&channel->base, &item->u.generic_service,
sizeof(item->u.generic_service));
cur_offset += sizeof(item->u.generic_service);
- } else if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
generic_data = &item->u.print_service.base;
red_channel_add_buf(&channel->base, &item->u.print_service,
sizeof(item->u.print_service));
@@ -2474,8 +2474,8 @@ static int __tunnel_channel_send_socket_migrate_data(TunnelChannel *channel,
cur_offset += sizeof(*mig_sckt);
if ((sckt->client_status != CLIENT_SCKT_STATUS_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED_ACK)) {
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED) &&
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK)) {
mig_sckt->out_data.process_buf = cur_offset;
mig_sckt->out_data.process_buf_size =
__tunnel_channel_send_process_bufs_migrate_data(channel,
@@ -2541,7 +2541,7 @@ static void tunnel_channel_send_migrate_data(TunnelChannel *channel, PipeItem *i
migrate_data->magic = TUNNEL_MIGRATE_DATA_MAGIC;
migrate_data->version = TUNNEL_MIGRATE_DATA_VERSION;
migrate_data->message_serial = red_channel_get_message_serial(&channel->base);
- red_channel_init_send_data(&channel->base, RED_MIGRATE_DATA, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_MIGRATE_DATA, item);
red_channel_add_buf(&channel->base, migrate_data, sizeof(*migrate_data));
migrate_data->slirp_state = data_buf_offset;
@@ -2583,8 +2583,8 @@ static void tunnel_channel_send_init(TunnelChannel *channel, PipeItem *item)
channel->send_data.u.init.max_socket_data_size = MAX_SOCKET_DATA_SIZE;
channel->send_data.u.init.max_num_of_sockets = MAX_SOCKETS_NUM;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_INIT, item);
- red_channel_add_buf(&channel->base, &channel->send_data.u.init, sizeof(RedTunnelInit));
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_INIT, item);
+ red_channel_add_buf(&channel->base, &channel->send_data.u.init, sizeof(SpiceMsgTunnelInit));
red_channel_begin_send_massage(&channel->base);
}
@@ -2594,12 +2594,12 @@ static void tunnel_channel_send_service_ip_map(TunnelChannel *channel, PipeItem
TunnelService *service = CONTAINEROF(item, TunnelService, pipe_item);
channel->send_data.u.service_ip.service_id = service->id;
- channel->send_data.u.service_ip.virtual_ip.type = RED_TUNNEL_IP_TYPE_IPv4;
+ channel->send_data.u.service_ip.virtual_ip.type = SPICE_TUNNEL_IP_TYPE_IPv4;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SERVICE_IP_MAP, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SERVICE_IP_MAP, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.service_ip,
- sizeof(RedTunnelServiceIpMap));
- red_channel_add_buf(&channel->base, &service->virt_ip.s_addr, sizeof(RedTunnelIPv4));
+ sizeof(SpiceMsgTunnelServiceIpMap));
+ red_channel_add_buf(&channel->base, &service->virt_ip.s_addr, sizeof(SpiceTunnelIPv4));
red_channel_begin_send_massage(&channel->base);
}
@@ -2614,7 +2614,7 @@ static void tunnel_channel_send_socket_open(TunnelChannel *channel, PipeItem *it
sckt->in_data.client_total_num_tokens = SOCKET_WINDOW_SIZE;
sckt->in_data.num_tokens = 0;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_OPEN, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_OPEN, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_open,
sizeof(channel->send_data.u.socket_open));
@@ -2639,7 +2639,7 @@ static void tunnel_channel_send_socket_fin(TunnelChannel *channel, PipeItem *ite
channel->send_data.u.socket_fin.connection_id = sckt->connection_id;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_FIN, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_FIN, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_fin,
sizeof(channel->send_data.u.socket_fin));
@@ -2671,7 +2671,7 @@ static void tunnel_channel_send_socket_close(TunnelChannel *channel, PipeItem *i
channel->send_data.u.socket_close.connection_id = sckt->connection_id;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_CLOSE, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_CLOSE, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_close,
sizeof(channel->send_data.u.socket_close));
@@ -2690,7 +2690,7 @@ static void tunnel_channel_send_socket_closed_ack(TunnelChannel *channel, PipeIt
channel->send_data.u.socket_close_ack.connection_id = sckt->connection_id;
// pipe item is null because we free the sckt.
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_CLOSED_ACK, NULL);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK, NULL);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_close_ack,
sizeof(channel->send_data.u.socket_close_ack));
@@ -2727,7 +2727,7 @@ static void tunnel_channel_send_socket_token(TunnelChannel *channel, PipeItem *i
sckt->in_data.client_total_num_tokens += channel->send_data.u.socket_token.num_tokens;
ASSERT(sckt->in_data.client_total_num_tokens <= SOCKET_WINDOW_SIZE);
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_TOKEN, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_TOKEN, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_token,
sizeof(channel->send_data.u.socket_token));
@@ -2757,7 +2757,7 @@ static void tunnel_channel_send_socket_out_data(TunnelChannel *channel, PipeItem
channel->send_data.u.socket_data.connection_id = sckt->connection_id;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_DATA, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_DATA, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_data,
sizeof(channel->send_data.u.socket_data));
pushed_bufs_num++;
diff --git a/server/red_worker.c b/server/red_worker.c
index 572b3224..9d6c08e5 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -295,9 +295,9 @@ typedef struct CursorItem {
typedef struct LocalCursor {
CursorItem base;
- Point16 position;
+ SpicePoint16 position;
uint32_t data_size;
- RedCursor red_cursor;
+ SpiceCursor red_cursor;
} LocalCursor;
#define MAX_SEND_BUFS 20
@@ -331,7 +331,7 @@ typedef struct RedChannel RedChannel;
typedef void (*disconnect_channel_proc)(RedChannel *channel);
typedef void (*hold_item_proc)(void *item);
typedef void (*release_item_proc)(RedChannel *channel, void *item);
-typedef int (*handle_message_proc)(RedChannel *channel, RedDataHeader *message);
+typedef int (*handle_message_proc)(RedChannel *channel, SpiceDataHeader *message);
struct RedChannel {
EventListener listener;
@@ -350,9 +350,9 @@ struct RedChannel {
struct {
int blocked;
- RedDataHeader header;
+ SpiceDataHeader header;
union {
- RedSetAck ack;
+ SpiceMsgSetAck ack;
} u;
uint32_t n_bufs;
BufDescriptor bufs[MAX_SEND_BUFS];
@@ -363,7 +363,7 @@ struct RedChannel {
struct {
uint8_t buf[RECIVE_BUF_SIZE];
- RedDataHeader *message;
+ SpiceDataHeader *message;
uint8_t *now;
uint8_t *end;
} recive_data;
@@ -380,7 +380,7 @@ struct RedChannel {
typedef struct ImageItem {
PipeItem link;
int refs;
- Point pos;
+ SpicePoint pos;
int width;
int height;
int stride;
@@ -398,7 +398,7 @@ struct Stream {
red_time_t last_time;
int width;
int height;
- Rect dest_area;
+ SpiceRect dest_area;
#endif
int top_down;
Stream *next;
@@ -442,12 +442,12 @@ static const int BITMAP_FMT_IS_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1};
static const int BITMAP_FMP_BYTES_PER_PIXEL[] = {0, 0, 0, 0, 0, 1, 2, 3, 4, 4};
typedef struct __attribute__ ((__packed__)) RedImage {
- ImageDescriptor descriptor;
+ SpiceImageDescriptor descriptor;
union { // variable length
- Bitmap bitmap;
- QUICData quic;
- LZ_RGBData lz_rgb;
- LZ_PLTData lz_plt;
+ SpiceBitmap bitmap;
+ SpiceQUICData quic;
+ SpiceLZRGBData lz_rgb;
+ SpiceLZPLTData lz_plt;
};
} RedImage;
@@ -499,13 +499,13 @@ typedef struct __attribute__ ((__packed__)) DisplayChannelMigrateData {
} DisplayChannelMigrateData;
typedef struct WaitForChannels {
- RedWaitForChannels header;
- RedWaitForChannel buf[MAX_CACHE_CLIENTS];
+ SpiceMsgWaitForChannels header;
+ SpiceWaitForChannel buf[MAX_CACHE_CLIENTS];
} WaitForChannels;
typedef struct FreeList {
int res_size;
- RedResorceList *res;
+ SpiceResorceList *res;
uint64_t sync[MAX_CACHE_CLIENTS];
WaitForChannels wait;
} FreeList;
@@ -524,7 +524,7 @@ typedef struct {
jmp_buf jmp_env;
union {
struct {
- ADDRESS next;
+ SPICE_ADDRESS next;
uint32_t stride;
uint32_t group_id;
@@ -629,30 +629,30 @@ struct DisplayChannel {
struct {
union {
- RedFill fill;
- RedOpaque opaque;
- RedCopy copy;
- RedTransparent transparent;
- RedAlphaBlend alpha_blend;
- RedCopyBits copy_bits;
- RedBlend blend;
- RedRop3 rop3;
- RedBlackness blackness;
- RedWhiteness whiteness;
- RedInvers invers;
- RedStroke stroke;
- RedText text;
- RedMode mode;
- RedInvalOne inval_one;
+ SpiceMsgDisplayDrawFill fill;
+ SpiceMsgDisplayDrawOpaque opaque;
+ SpiceMsgDisplayDrawCopy copy;
+ SpiceMsgDisplayDrawTransparent transparent;
+ SpiceMsgDisplayDrawAlphaBlend alpha_blend;
+ SpiceMsgDisplayCopyBits copy_bits;
+ SpiceMsgDisplayDrawBlend blend;
+ SpiceMsgDisplayDrawRop3 rop3;
+ SpiceMsgDisplayDrawBlackness blackness;
+ SpiceMsgDisplayDrawWhiteness whiteness;
+ SpiceMsgDisplayDrawInvers invers;
+ SpiceMsgDisplayDrawStroke stroke;
+ SpiceMsgDisplayDrawText text;
+ SpiceMsgDisplayMode mode;
+ SpiceMsgDisplayInvalOne inval_one;
WaitForChannels wait;
struct {
- RedStreamCreate message;
+ SpiceMsgDisplayStreamCreate message;
uint32_t num_rects;
} stream_create;
- RedStreamClip stream_clip;
- RedStreamData stream_data;
- RedStreamDestroy stream_destroy;
- RedMigrate migrate;
+ SpiceMsgDisplayStreamClip stream_clip;
+ SpiceMsgDisplayStreamData stream_data;
+ SpiceMsgDisplayStreamDestroy stream_destroy;
+ SpiceMsgMigrate migrate;
DisplayChannelMigrateData migrate_data;
} u;
@@ -666,10 +666,10 @@ struct DisplayChannel {
RedCompressBuf *used_compress_bufs;
struct {
- RedSubMessageList sub_list;
+ SpiceSubMessageList sub_list;
uint32_t sub_messages[DISPLAY_MAX_SUB_MESSAGES];
} sub_list;
- RedSubMessage sub_header[DISPLAY_MAX_SUB_MESSAGES];
+ SpicedSubMessage sub_header[DISPLAY_MAX_SUB_MESSAGES];
FreeList free_list;
} send_data;
@@ -697,12 +697,12 @@ typedef struct CursorChannel {
struct {
union {
- RedCursorInit cursor_init;
- RedCursorSet cursor_set;
- RedCursorMove cursor_move;
- RedCursorTrail cursor_trail;
- RedInvalOne inval_one;
- RedMigrate migrate;
+ SpiceMsgCursorInit cursor_init;
+ SpiceMsgCursorSet cursor_set;
+ SpiceMsgCursorMove cursor_move;
+ SpiceMsgCursorTrail cursor_trail;
+ SpiceMsgDisplayInvalOne inval_one;
+ SpiceMsgMigrate migrate;
} u;
} send_data;
#ifdef RED_STATISTICS
@@ -828,23 +828,23 @@ typedef struct UpgradeItem {
QRegion region;
} UpgradeItem;
-typedef void (*draw_fill_t)(void *canvas, Rect *bbox, Clip *clip, Fill *fill);
-typedef void (*draw_copy_t)(void *canvas, Rect *bbox, Clip *clip, Copy *copy);
-typedef void (*draw_opaque_t)(void *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-typedef void (*copy_bits_t)(void *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-typedef void (*draw_text_t)(void *canvas, Rect *bbox, Clip *clip, Text *text);
-typedef void (*draw_stroke_t)(void *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-typedef void (*draw_rop3_t)(void *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-typedef void (*draw_blend_t)(void *canvas, Rect *bbox, Clip *clip, Blend *blend);
-typedef void (*draw_blackness_t)(void *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-typedef void (*draw_whiteness_t)(void *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-typedef void (*draw_invers_t)(void *canvas, Rect *bbox, Clip *clip, Invers *invers);
-typedef void (*draw_transparent_t)(void *canvas, Rect *bbox, Clip *clip, Transparent* transparent);
-typedef void (*draw_alpha_blend_t)(void *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend);
-typedef void (*read_pixels_t)(void *canvas, uint8_t *dest, int dest_stride, const Rect *area);
-typedef void (*set_top_mask_t)(void *canvas, int num_rect, const Rect *rects);
+typedef void (*draw_fill_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+typedef void (*draw_copy_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+typedef void (*draw_opaque_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+typedef void (*copy_bits_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+typedef void (*draw_text_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
+typedef void (*draw_stroke_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+typedef void (*draw_rop3_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+typedef void (*draw_blend_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+typedef void (*draw_blackness_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+typedef void (*draw_whiteness_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+typedef void (*draw_invers_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+typedef void (*draw_transparent_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent);
+typedef void (*draw_alpha_blend_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend);
+typedef void (*read_pixels_t)(void *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area);
+typedef void (*set_top_mask_t)(void *canvas, int num_rect, const SpiceRect *rects);
typedef void (*clear_top_mask_t)(void *canvas);
-typedef void (*validate_area_t)(void *canvas, int32_t stride, uint8_t *line_0, const Rect *area);
+typedef void (*validate_area_t)(void *canvas, int32_t stride, uint8_t *line_0, const SpiceRect *area);
typedef void (*destroy_t)(void *canvas);
typedef struct DrawFuncs {
@@ -891,7 +891,7 @@ typedef struct ItemTrace {
int last_gradual_frame;
int width;
int height;
- Rect dest_area;
+ SpiceRect dest_area;
} ItemTrace;
#define TRACE_ITEMS_SHIFT 3
@@ -943,7 +943,7 @@ typedef struct RedWorker {
CursorItem *cursor;
int cursor_visible;
- Point16 cursor_position;
+ SpicePoint16 cursor_position;
uint16_t cursor_trail_length;
uint16_t cursor_trail_frequency;
@@ -1017,7 +1017,7 @@ static void display_channel_push(RedWorker *worker);
#define red_draw_drawable(worker, item)
#else
static void red_draw_drawable(RedWorker *worker, Drawable *item);
-static void red_update_area(RedWorker *worker, const Rect *area);
+static void red_update_area(RedWorker *worker, const SpiceRect *area);
#endif
static void red_release_cursor(RedWorker *worker, CursorItem *cursor);
static inline void release_drawable(RedWorker *worker, Drawable *item);
@@ -1039,11 +1039,11 @@ static void red_display_release_stream_clip(DisplayChannel* channel, StreamClipI
static int red_display_free_some_independent_glz_drawables(DisplayChannel *channel);
static void red_display_free_glz_drawable(DisplayChannel *channel, RedGlzDrawable *drawable);
static void reset_rate(StreamAgent *stream_agent);
-static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_id);
-static inline int _stride_is_extra(Bitmap *bitmap);
+static int _bitmap_is_gradual(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id);
+static inline int _stride_is_extra(SpiceBitmap *bitmap);
#ifdef DUMP_BITMAP
-static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id);
+static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id);
#endif
#ifdef COMPRESS_STAT
@@ -1644,7 +1644,7 @@ static inline void red_add_item_trace(RedWorker *worker, Drawable *item)
trace->frames_count = item->frames_count;
trace->gradual_frames_count = item->gradual_frames_count;
trace->last_gradual_frame = item->last_gradual_frame;
- Rect* src_area = &item->qxl_drawable->u.copy.src_area;
+ SpiceRect* src_area = &item->qxl_drawable->u.copy.src_area;
trace->width = src_area->right - src_area->left;
trace->height = src_area->bottom - src_area->top;
trace->dest_area = item->qxl_drawable->bbox;
@@ -2118,7 +2118,7 @@ static inline void __current_add_drawable(RedWorker *worker, Drawable *drawable,
#ifdef USE_EXCLUDE_RGN
-static int is_equal_path(RedWorker *worker, ADDRESS p1, ADDRESS p2, uint32_t group_id1,
+static int is_equal_path(RedWorker *worker, SPICE_ADDRESS p1, SPICE_ADDRESS p2, uint32_t group_id1,
uint32_t group_id2)
{
QXLPath *path1;
@@ -2181,13 +2181,13 @@ static int is_equal_path(RedWorker *worker, ADDRESS p1, ADDRESS p2, uint32_t gro
}
// partial imp
-static int is_equal_brush(Brush *b1, Brush *b2)
+static int is_equal_brush(SpiceBrush *b1, SpiceBrush *b2)
{
- return b1->type == b2->type && b1->type == BRUSH_TYPE_SOLID && b1->u.color == b1->u.color;
+ return b1->type == b2->type && b1->type == SPICE_BRUSH_TYPE_SOLID && b1->u.color == b1->u.color;
}
// partial imp
-static int is_equal_line_attr(LineAttr *a1, LineAttr *a2)
+static int is_equal_line_attr(SpiceLineAttr *a1, SpiceLineAttr *a2)
{
return a1->flags == a2->flags && a1->join_style == a2->join_style &&
a1->end_style == a2->end_style && a1->style_nseg == a2->style_nseg &&
@@ -2195,7 +2195,7 @@ static int is_equal_line_attr(LineAttr *a1, LineAttr *a2)
a1->style_nseg == 0;
}
-static inline int rect_is_equal(const Rect *r1, const Rect *r2)
+static inline int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2)
{
return r1->top == r2->top && r1->left == r2->left &&
r1->bottom == r2->bottom && r1->right == r2->right;
@@ -2293,11 +2293,11 @@ static void push_stream_clip_by_drawable(DisplayChannel* channel, StreamAgent *a
PANIC("alloc failed");
}
- if (drawable->qxl_drawable->clip.type == CLIP_TYPE_NONE) {
+ if (drawable->qxl_drawable->clip.type == SPICE_CLIP_TYPE_NONE) {
region_init(&item->region);
- item->clip_type = CLIP_TYPE_NONE;
+ item->clip_type = SPICE_CLIP_TYPE_NONE;
} else {
- item->clip_type = CLIP_TYPE_RECTS;
+ item->clip_type = SPICE_CLIP_TYPE_RECTS;
region_clone(&item->region, &drawable->tree_item.base.rgn);
}
red_pipe_add((RedChannel*)channel, (PipeItem *)item);
@@ -2309,7 +2309,7 @@ static void push_stream_clip(DisplayChannel* channel, StreamAgent *agent)
if (!item) {
PANIC("alloc failed");
}
- item->clip_type = CLIP_TYPE_RECTS;
+ item->clip_type = SPICE_CLIP_TYPE_RECTS;
region_clone(&item->region, &agent->vis_region);
red_pipe_add((RedChannel*)channel, (PipeItem *)item);
}
@@ -2641,7 +2641,7 @@ static void red_create_stream(RedWorker *worker, Drawable *drawable)
Stream *stream;
AVFrame *frame;
uint8_t* frame_buf;
- Rect* src_rect;
+ SpiceRect* src_rect;
int stream_width;
int stream_height;
int pict_size;
@@ -2694,7 +2694,7 @@ static void red_create_stream(RedWorker *worker, Drawable *drawable)
stream->frame_buf_end = frame_buf + pict_size;
QXLImage *qxl_image = (QXLImage *)get_virt(worker, drawable->qxl_drawable->u.copy.src_bitmap,
sizeof(QXLImage), drawable->group_id);
- stream->top_down = !!(qxl_image->bitmap.flags & BITMAP_TOP_DOWN);
+ stream->top_down = !!(qxl_image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN);
drawable->stream = stream;
if (worker->display_channel) {
@@ -2770,7 +2770,7 @@ static inline int __red_is_next_stream_frame(RedWorker *worker,
const Drawable *candidate,
const int other_src_width,
const int other_src_height,
- const Rect *other_dest,
+ const SpiceRect *other_dest,
const red_time_t other_time,
const Stream *stream)
{
@@ -2787,7 +2787,7 @@ static inline int __red_is_next_stream_frame(RedWorker *worker,
return FALSE;
}
- Rect* candidate_src = &qxl_drawable->u.copy.src_area;
+ SpiceRect* candidate_src = &qxl_drawable->u.copy.src_area;
if (candidate_src->right - candidate_src->left != other_src_width ||
candidate_src->bottom - candidate_src->top != other_src_height) {
return FALSE;
@@ -2796,7 +2796,7 @@ static inline int __red_is_next_stream_frame(RedWorker *worker,
if (stream) {
QXLImage *qxl_image = (QXLImage *)get_virt(worker, qxl_drawable->u.copy.src_bitmap,
sizeof(QXLImage), candidate->group_id);
- if (stream->top_down != !!(qxl_image->bitmap.flags & BITMAP_TOP_DOWN)) {
+ if (stream->top_down != !!(qxl_image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
return FALSE;
}
}
@@ -2810,7 +2810,7 @@ static inline int red_is_next_stream_frame(RedWorker *worker, const Drawable *ca
return FALSE;
}
- Rect* prev_src = &prev->qxl_drawable->u.copy.src_area;
+ SpiceRect* prev_src = &prev->qxl_drawable->u.copy.src_area;
return __red_is_next_stream_frame(worker, candidate, prev_src->right - prev_src->left,
prev_src->bottom - prev_src->top,
&prev->qxl_drawable->bbox, prev->creation_time,
@@ -2844,19 +2844,19 @@ static inline int red_is_next_stream_frame(RedWorker *worker, Drawable *candidat
return FALSE;
}
- if (qxl_drawable->u.copy.rop_decriptor != ROPD_OP_PUT ||
- prev_qxl_drawable->u.copy.rop_decriptor != ROPD_OP_PUT) {
+ if (qxl_drawable->u.copy.rop_decriptor != SPICE_ROPD_OP_PUT ||
+ prev_qxl_drawable->u.copy.rop_decriptor != SPICE_ROPD_OP_PUT) {
return FALSE;
}
qxl_image = (QXLImage *)get_virt(worker, qxl_drawable->u.copy.src_bitmap, sizeof(QXLImage),
candidate->group_id);
- if (qxl_image->descriptor.type != IMAGE_TYPE_BITMAP) {
+ if (qxl_image->descriptor.type != SPICE_IMAGE_TYPE_BITMAP) {
return FALSE;
}
- if (prev->stream && prev->stream->top_down != !!(qxl_image->bitmap.flags & BITMAP_TOP_DOWN)) {
+ if (prev->stream && prev->stream->top_down != !!(qxl_image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
return FALSE;
}
@@ -3382,22 +3382,22 @@ static inline int red_current_add(RedWorker *worker, Drawable *drawable)
#endif
-static void add_clip_rects(RedWorker *worker, QRegion *rgn, PHYSICAL data, uint32_t group_id)
+static void add_clip_rects(RedWorker *worker, QRegion *rgn, QXLPHYSICAL data, uint32_t group_id)
{
while (data) {
QXLDataChunk *chunk;
- Rect *now;
- Rect *end;
+ SpiceRect *now;
+ SpiceRect *end;
uint32_t data_size;
chunk = (QXLDataChunk *)get_virt(worker, data, sizeof(QXLDataChunk), group_id);
data_size = chunk->data_size;
validate_virt(worker, (unsigned long)chunk->data, get_memslot_id(worker, data), data_size,
group_id);
- now = (Rect *)chunk->data;
- end = now + data_size / sizeof(Rect);
+ now = (SpiceRect *)chunk->data;
+ end = now + data_size / sizeof(SpiceRect);
for (; now < end; now++) {
- Rect* r = (Rect *)now;
+ SpiceRect* r = (SpiceRect *)now;
ASSERT(now->top == r->top && now->left == r->left &&
now->bottom == r->bottom && now->right == r->right);
@@ -3410,7 +3410,7 @@ static void add_clip_rects(RedWorker *worker, QRegion *rgn, PHYSICAL data, uint3
}
}
-static inline Shadow *__new_shadow(RedWorker *worker, Drawable *item, Point *delta)
+static inline Shadow *__new_shadow(RedWorker *worker, Drawable *item, SpicePoint *delta)
{
if (!delta->x && !delta->y) {
return NULL;
@@ -3435,7 +3435,7 @@ static inline Shadow *__new_shadow(RedWorker *worker, Drawable *item, Point *del
return shadow;
}
-static inline int red_current_add_with_shadow(RedWorker *worker, Drawable *item, Point *delta)
+static inline int red_current_add_with_shadow(RedWorker *worker, Drawable *item, SpicePoint *delta)
{
#ifdef RED_WORKER_STAT
stat_time_t start_time = stat_now();
@@ -3497,13 +3497,13 @@ static inline void red_update_streamable(RedWorker *worker, Drawable *drawable,
if (drawable->tree_item.effect != QXL_EFFECT_OPAQUE ||
qxl_drawable->type != QXL_DRAW_COPY ||
- qxl_drawable->u.copy.rop_decriptor != ROPD_OP_PUT) {
+ qxl_drawable->u.copy.rop_decriptor != SPICE_ROPD_OP_PUT) {
return;
}
qxl_image = (QXLImage *)get_virt(worker, qxl_drawable->u.copy.src_bitmap, sizeof(QXLImage),
drawable->group_id);
- if (qxl_image->descriptor.type != IMAGE_TYPE_BITMAP) {
+ if (qxl_image->descriptor.type != SPICE_IMAGE_TYPE_BITMAP) {
return;
}
@@ -3518,7 +3518,7 @@ static inline int red_current_add_qxl(RedWorker *worker, Drawable *drawable,
int ret;
if (has_shadow(qxl_drawable)) {
- Point delta;
+ SpicePoint delta;
#ifdef RED_WORKER_STAT
++worker->add_with_shadow_count;
@@ -3559,7 +3559,7 @@ static inline int red_current_add_qxl(RedWorker *worker, Drawable *drawable,
return ret;
}
-static void red_get_area(RedWorker *worker, const Rect *area, uint8_t *dest, int dest_stride,
+static void red_get_area(RedWorker *worker, const SpiceRect *area, uint8_t *dest, int dest_stride,
int update)
{
if (update) {
@@ -3591,17 +3591,17 @@ static inline int red_handle_self_bitmap(RedWorker *worker, Drawable *drawable)
}
dest = (uint8_t *)(image + 1);
- image->descriptor.type = IMAGE_TYPE_BITMAP;
+ image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
image->descriptor.flags = 0;
QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_RED, ++worker->bits_unique);
image->bitmap.flags = QXL_BITMAP_DIRECT | (worker->surface.context.top_down ?
QXL_BITMAP_TOP_DOWN : 0);
- image->bitmap.format = BITMAP_FMT_32BIT;
+ image->bitmap.format = SPICE_BITMAP_FMT_32BIT;
image->bitmap.stride = dest_stride;
image->descriptor.width = image->bitmap.x = width;
image->descriptor.height = image->bitmap.y = height;
- image->bitmap.data = (PHYSICAL)dest;
+ image->bitmap.data = (QXLPHYSICAL)dest;
image->bitmap.palette = 0;
red_get_area(worker, &drawable->qxl_drawable->self_bitmap_area, dest, dest_stride, TRUE);
@@ -3677,14 +3677,14 @@ static inline void red_process_drawable(RedWorker *worker, QXLDrawable *drawable
drawable->bbox.top, drawable->bbox.left, drawable->bbox.bottom, drawable->bbox.right);
#endif
- if (drawable->clip.type == CLIP_TYPE_RECTS) {
+ if (drawable->clip.type == SPICE_CLIP_TYPE_RECTS) {
QRegion rgn;
region_init(&rgn);
add_clip_rects(worker, &rgn, drawable->clip.data + OFFSETOF(QXLClipRects, chunk), group_id);
region_and(&item->tree_item.base.rgn, &rgn);
region_destroy(&rgn);
- } else if (drawable->clip.type == CLIP_TYPE_PATH) {
+ } else if (drawable->clip.type == SPICE_CLIP_TYPE_PATH) {
item->tree_item.effect = QXL_EFFECT_BLEND;
#ifdef PIPE_DEBUG
printf("TEST: DRAWABLE: QXL_CLIP_TYPE_PATH\n");
@@ -3714,7 +3714,7 @@ static inline void red_process_drawable(RedWorker *worker, QXLDrawable *drawable
release_drawable(worker, item);
}
-static void localize_path(RedWorker *worker, PHYSICAL *in_path, uint32_t group_id)
+static void localize_path(RedWorker *worker, QXLPHYSICAL *in_path, uint32_t group_id)
{
QXLPath *path;
uint8_t *data;
@@ -3726,7 +3726,7 @@ static void localize_path(RedWorker *worker, PHYSICAL *in_path, uint32_t group_i
path = (QXLPath *)get_virt(worker, *in_path, sizeof(QXLPath), group_id);
data = malloc(sizeof(UINT32) + path->data_size);
ASSERT(data);
- *in_path = (PHYSICAL)data;
+ *in_path = (QXLPHYSICAL)data;
*(UINT32 *)data = path->data_size;
data += sizeof(UINT32);
chunk = &path->chunk;
@@ -3740,18 +3740,18 @@ static void localize_path(RedWorker *worker, PHYSICAL *in_path, uint32_t group_i
} while (chunk);
}
-static void unlocalize_path(PHYSICAL *path)
+static void unlocalize_path(QXLPHYSICAL *path)
{
ASSERT(path && *path);
free((void *)*path);
*path = 0;
}
-static void localize_str(RedWorker *worker, PHYSICAL *in_str, uint32_t group_id)
+static void localize_str(RedWorker *worker, QXLPHYSICAL *in_str, uint32_t group_id)
{
QXLString *qxl_str = (QXLString *)get_virt(worker, *in_str, sizeof(QXLString), group_id);
QXLDataChunk *chunk;
- String *str;
+ SpiceString *str;
uint8_t *dest;
uint32_t data_size;
int memslot_id = get_memslot_id(worker, *in_str);
@@ -3759,13 +3759,13 @@ static void localize_str(RedWorker *worker, PHYSICAL *in_str, uint32_t group_id)
ASSERT(in_str);
str = malloc(sizeof(UINT32) + qxl_str->data_size);
ASSERT(str);
- *in_str = (PHYSICAL)str;
+ *in_str = (QXLPHYSICAL)str;
str->length = qxl_str->length;
str->flags = qxl_str->flags;
dest = str->data;
chunk = &qxl_str->chunk;
for (;;) {
- PHYSICAL next_chunk;
+ QXLPHYSICAL next_chunk;
data_size = chunk->data_size;
validate_virt(worker, (unsigned long)chunk->data, memslot_id, data_size, group_id);
@@ -3780,19 +3780,19 @@ static void localize_str(RedWorker *worker, PHYSICAL *in_str, uint32_t group_id)
}
}
-static void unlocalize_str(PHYSICAL *str)
+static void unlocalize_str(QXLPHYSICAL *str)
{
ASSERT(str && *str);
free((void *)*str);
*str = 0;
}
-static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
+static void localize_clip(RedWorker *worker, SpiceClip *clip, uint32_t group_id)
{
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
return;
- case CLIP_TYPE_RECTS: {
+ case SPICE_CLIP_TYPE_RECTS: {
QXLClipRects *clip_rects;
QXLDataChunk *chunk;
int memslot_id = get_memslot_id(worker, clip->data);
@@ -3801,9 +3801,9 @@ static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
clip_rects = (QXLClipRects *)get_virt(worker, clip->data, sizeof(QXLClipRects), group_id);
chunk = &clip_rects->chunk;
ASSERT(clip->data);
- data = malloc(sizeof(UINT32) + clip_rects->num_rects * sizeof(Rect));
+ data = malloc(sizeof(UINT32) + clip_rects->num_rects * sizeof(SpiceRect));
ASSERT(data);
- clip->data = (PHYSICAL)data;
+ clip->data = (QXLPHYSICAL)data;
*(UINT32 *)(data) = clip_rects->num_rects;
data += sizeof(UINT32);
do {
@@ -3817,7 +3817,7 @@ static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
} while (chunk);
break;
}
- case CLIP_TYPE_PATH:
+ case SPICE_CLIP_TYPE_PATH:
localize_path(worker, &clip->data, group_id);
break;
default:
@@ -3825,16 +3825,16 @@ static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
}
}
-static void unlocalize_clip(Clip *clip)
+static void unlocalize_clip(SpiceClip *clip)
{
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
return;
- case CLIP_TYPE_RECTS:
+ case SPICE_CLIP_TYPE_RECTS:
free((void *)clip->data);
clip->data = 0;
break;
- case CLIP_TYPE_PATH:
+ case SPICE_CLIP_TYPE_PATH:
unlocalize_path(&clip->data);
break;
default:
@@ -3978,7 +3978,7 @@ static void image_cache_eaging(ImageCache *cache)
#endif
}
-static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t group_id)
+static void localize_bitmap(RedWorker *worker, QXLPHYSICAL *in_bitmap, uint32_t group_id)
{
QXLImage *image;
QXLImage *local_image;
@@ -3987,39 +3987,39 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
image = (QXLImage *)get_virt(worker, *in_bitmap, sizeof(QXLImage), group_id);
local_image = (QXLImage *)alloc_local_image(worker);
*local_image = *image;
- *in_bitmap = (PHYSICAL)local_image;
+ *in_bitmap = (QXLPHYSICAL)local_image;
local_image->descriptor.flags = 0;
if (image_cache_hit(&worker->image_cache, local_image->descriptor.id)) {
- local_image->descriptor.type = IMAGE_TYPE_FROM_CACHE;
+ local_image->descriptor.type = SPICE_IMAGE_TYPE_FROM_CACHE;
return;
}
switch (local_image->descriptor.type) {
- case IMAGE_TYPE_QUIC: {
+ case SPICE_IMAGE_TYPE_QUIC: {
QXLDataChunk **chanks_head;
#ifdef IMAGE_CACHE_AGE
- local_image->descriptor.flags |= IMAGE_CACHE_ME;
+ local_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
#else
if (local_image->descriptor.width * local_image->descriptor.height >= 640 * 480) {
- local_image->descriptor.flags |= IMAGE_CACHE_ME;
+ local_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
}
#endif
chanks_head = (QXLDataChunk **)local_image->quic.data;
*chanks_head = (QXLDataChunk *)image->quic.data;
break;
}
- case IMAGE_TYPE_BITMAP:
+ case SPICE_IMAGE_TYPE_BITMAP:
if (image->bitmap.flags & QXL_BITMAP_DIRECT) {
- local_image->bitmap.data = (PHYSICAL)get_virt(worker, image->bitmap.data,
+ local_image->bitmap.data = (QXLPHYSICAL)get_virt(worker, image->bitmap.data,
image->bitmap.stride * image->bitmap.y,
group_id);
} else {
- PHYSICAL src_data;
+ QXLPHYSICAL src_data;
int size = image->bitmap.y * image->bitmap.stride;
uint8_t *data = malloc(size);
ASSERT(data);
- local_image->bitmap.data = (PHYSICAL)data;
+ local_image->bitmap.data = (QXLPHYSICAL)data;
src_data = image->bitmap.data;
while (size) {
@@ -4043,12 +4043,12 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
if (local_image->bitmap.palette) {
uint16_t num_ents;
uint32_t *ents;
- Palette *tmp_palette;
- Palette *shadow_palette;
+ SpicePalette *tmp_palette;
+ SpicePalette *shadow_palette;
int slot_id = get_memslot_id(worker, local_image->bitmap.palette);
- tmp_palette = (Palette *)get_virt(worker, local_image->bitmap.palette,
- sizeof(Palette), group_id);
+ tmp_palette = (SpicePalette *)get_virt(worker, local_image->bitmap.palette,
+ sizeof(SpicePalette), group_id);
num_ents = tmp_palette->num_ents;
ents = tmp_palette->ents;
@@ -4056,17 +4056,17 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
validate_virt(worker, (unsigned long)ents, slot_id, (num_ents * sizeof(uint32_t)),
group_id);
- shadow_palette = (Palette *)malloc(sizeof(Palette) + num_ents * sizeof(uint32_t) +
- sizeof(PHYSICAL));
+ shadow_palette = (SpicePalette *)malloc(sizeof(SpicePalette) + num_ents * sizeof(uint32_t) +
+ sizeof(QXLPHYSICAL));
if (!shadow_palette) {
- PANIC("Palette malloc failed");
+ PANIC("SpicePalette malloc failed");
}
memcpy(shadow_palette->ents, ents, num_ents * sizeof(uint32_t));
shadow_palette->num_ents = num_ents;
shadow_palette->unique = tmp_palette->unique;
- local_image->bitmap.palette = (ADDRESS)shadow_palette;
+ local_image->bitmap.palette = (SPICE_ADDRESS)shadow_palette;
}
break;
default:
@@ -4074,7 +4074,7 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
}
}
-static void unlocalize_bitmap(PHYSICAL *bitmap)
+static void unlocalize_bitmap(QXLPHYSICAL *bitmap)
{
QXLImage *image;
@@ -4083,7 +4083,7 @@ static void unlocalize_bitmap(PHYSICAL *bitmap)
*bitmap = 0;
switch (image->descriptor.type) {
- case IMAGE_TYPE_BITMAP:
+ case SPICE_IMAGE_TYPE_BITMAP:
if (!(image->bitmap.flags & QXL_BITMAP_DIRECT)) {
free((void *)image->bitmap.data);
}
@@ -4091,8 +4091,8 @@ static void unlocalize_bitmap(PHYSICAL *bitmap)
free((void *)image->bitmap.palette);
}
break;
- case IMAGE_TYPE_QUIC:
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_QUIC:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
*bitmap = 0;
break;
default:
@@ -4100,35 +4100,35 @@ static void unlocalize_bitmap(PHYSICAL *bitmap)
}
}
-static void localize_brush(RedWorker *worker, Brush *brush, uint32_t group_id)
+static void localize_brush(RedWorker *worker, SpiceBrush *brush, uint32_t group_id)
{
- if (brush->type == BRUSH_TYPE_PATTERN) {
+ if (brush->type == SPICE_BRUSH_TYPE_PATTERN) {
localize_bitmap(worker, &brush->u.pattern.pat, group_id);
}
}
-static void unlocalize_brush(Brush *brush)
+static void unlocalize_brush(SpiceBrush *brush)
{
- if (brush->type == BRUSH_TYPE_PATTERN) {
+ if (brush->type == SPICE_BRUSH_TYPE_PATTERN) {
unlocalize_bitmap(&brush->u.pattern.pat);
}
}
-static void localize_mask(RedWorker *worker, QMask *mask, uint32_t group_id)
+static void localize_mask(RedWorker *worker, SpiceQMask *mask, uint32_t group_id)
{
if (mask->bitmap) {
localize_bitmap(worker, &mask->bitmap, group_id);
}
}
-static void unlocalize_mask(QMask *mask)
+static void unlocalize_mask(SpiceQMask *mask)
{
if (mask->bitmap) {
unlocalize_bitmap(&mask->bitmap);
}
}
-static void localize_attr(RedWorker *worker, LineAttr *attr, uint32_t group_id)
+static void localize_attr(RedWorker *worker, SpiceLineAttr *attr, uint32_t group_id)
{
if (attr->style_nseg) {
uint8_t *buf;
@@ -4140,11 +4140,11 @@ static void localize_attr(RedWorker *worker, LineAttr *attr, uint32_t group_id)
data = malloc(attr->style_nseg * sizeof(uint32_t));
ASSERT(data);
memcpy(data, buf, attr->style_nseg * sizeof(uint32_t));
- attr->style = (PHYSICAL)data;
+ attr->style = (QXLPHYSICAL)data;
}
}
-static void unlocalize_attr(LineAttr *attr)
+static void unlocalize_attr(SpiceLineAttr *attr)
{
if (attr->style_nseg) {
free((void *)attr->style);
@@ -4154,7 +4154,7 @@ static void unlocalize_attr(LineAttr *attr)
static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
{
- Clip clip = drawable->qxl_drawable->clip;
+ SpiceClip clip = drawable->qxl_drawable->clip;
worker->local_images_pos = 0;
image_cache_eaging(&worker->image_cache);
@@ -4164,7 +4164,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
localize_clip(worker, &clip, drawable->group_id);
switch (drawable->qxl_drawable->type) {
case QXL_DRAW_FILL: {
- Fill fill = drawable->qxl_drawable->u.fill;
+ SpiceFill fill = drawable->qxl_drawable->u.fill;
localize_brush(worker, &fill.brush, drawable->group_id);
localize_mask(worker, &fill.mask, drawable->group_id);
worker->draw_funcs.draw_fill(worker->surface.context.canvas, &drawable->qxl_drawable->bbox,
@@ -4173,7 +4173,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_OPAQUE: {
- Opaque opaque = drawable->qxl_drawable->u.opaque;
+ SpiceOpaque opaque = drawable->qxl_drawable->u.opaque;
localize_brush(worker, &opaque.brush, drawable->group_id);
localize_bitmap(worker, &opaque.src_bitmap, drawable->group_id);
localize_mask(worker, &opaque.mask, drawable->group_id);
@@ -4185,7 +4185,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_COPY: {
- Copy copy = drawable->qxl_drawable->u.copy;
+ SpiceCopy copy = drawable->qxl_drawable->u.copy;
localize_bitmap(worker, &copy.src_bitmap, drawable->group_id);
localize_mask(worker, &copy.mask, drawable->group_id);
worker->draw_funcs.draw_copy(worker->surface.context.canvas, &drawable->qxl_drawable->bbox,
@@ -4195,7 +4195,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_TRANSPARENT: {
- Transparent transparent = drawable->qxl_drawable->u.transparent;
+ SpiceTransparent transparent = drawable->qxl_drawable->u.transparent;
localize_bitmap(worker, &transparent.src_bitmap, drawable->group_id);
worker->draw_funcs.draw_transparent(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &transparent);
@@ -4203,7 +4203,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_ALPHA_BLEND: {
- AlphaBlnd alpha_blend = drawable->qxl_drawable->u.alpha_blend;
+ SpiceAlphaBlnd alpha_blend = drawable->qxl_drawable->u.alpha_blend;
localize_bitmap(worker, &alpha_blend.src_bitmap, drawable->group_id);
worker->draw_funcs.draw_alpha_blend(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &alpha_blend);
@@ -4216,7 +4216,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_BLEND: {
- Blend blend = drawable->qxl_drawable->u.blend;
+ SpiceBlend blend = drawable->qxl_drawable->u.blend;
localize_bitmap(worker, &blend.src_bitmap, drawable->group_id);
localize_mask(worker, &blend.mask, drawable->group_id);
worker->draw_funcs.draw_blend(worker->surface.context.canvas, &drawable->qxl_drawable->bbox,
@@ -4226,7 +4226,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_BLACKNESS: {
- Blackness blackness = drawable->qxl_drawable->u.blackness;
+ SpiceBlackness blackness = drawable->qxl_drawable->u.blackness;
localize_mask(worker, &blackness.mask, drawable->group_id);
worker->draw_funcs.draw_blackness(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &blackness);
@@ -4234,7 +4234,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_WHITENESS: {
- Whiteness whiteness = drawable->qxl_drawable->u.whiteness;
+ SpiceWhiteness whiteness = drawable->qxl_drawable->u.whiteness;
localize_mask(worker, &whiteness.mask, drawable->group_id);
worker->draw_funcs.draw_whiteness(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &whiteness);
@@ -4242,7 +4242,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_INVERS: {
- Invers invers = drawable->qxl_drawable->u.invers;
+ SpiceInvers invers = drawable->qxl_drawable->u.invers;
localize_mask(worker, &invers.mask, drawable->group_id);
worker->draw_funcs.draw_invers(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &invers);
@@ -4250,7 +4250,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_ROP3: {
- Rop3 rop3 = drawable->qxl_drawable->u.rop3;
+ SpiceRop3 rop3 = drawable->qxl_drawable->u.rop3;
localize_brush(worker, &rop3.brush, drawable->group_id);
localize_bitmap(worker, &rop3.src_bitmap, drawable->group_id);
localize_mask(worker, &rop3.mask, drawable->group_id);
@@ -4261,7 +4261,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_STROKE: {
- Stroke stroke = drawable->qxl_drawable->u.stroke;
+ SpiceStroke stroke = drawable->qxl_drawable->u.stroke;
localize_brush(worker, &stroke.brush, drawable->group_id);
localize_path(worker, &stroke.path, drawable->group_id);
localize_attr(worker, &stroke.attr, drawable->group_id);
@@ -4273,7 +4273,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_TEXT: {
- Text text = drawable->qxl_drawable->u.text;
+ SpiceText text = drawable->qxl_drawable->u.text;
localize_brush(worker, &text.fore_brush, drawable->group_id);
localize_brush(worker, &text.back_brush, drawable->group_id);
localize_str(worker, &text.str, drawable->group_id);
@@ -4355,7 +4355,7 @@ static inline void __red_collect_for_update(RedWorker *worker, Ring *ring, RingI
}
}
-static void red_update_area(RedWorker *worker, const Rect *area)
+static void red_update_area(RedWorker *worker, const SpiceRect *area)
{
Ring *ring = &worker->current;
RingItem *ring_item;
@@ -4390,7 +4390,7 @@ static void red_update_area(RedWorker *worker, const Rect *area)
#else
-static void red_update_area(RedWorker *worker, const Rect *area)
+static void red_update_area(RedWorker *worker, const SpiceRect *area)
{
Ring *ring = &worker->current_list;
RingItem *ring_item = ring;
@@ -4533,7 +4533,7 @@ void qxl_process_cursor(RedWorker *worker, QXLCursorCmd *cursor_cmd, uint32_t gr
red_error("invalid cursor command %u", cursor_cmd->type);
}
- if (worker->cursor_channel && (worker->mouse_mode == RED_MOUSE_MODE_SERVER ||
+ if (worker->cursor_channel && (worker->mouse_mode == SPICE_MOUSE_MODE_SERVER ||
cursor_cmd->type != QXL_CURSOR_MOVE || cursor_show)) {
red_pipe_add(&worker->cursor_channel->base, &item->pipe_data);
} else {
@@ -4684,7 +4684,7 @@ static void red_add_screen_image(RedWorker *worker)
{
ImageItem *item;
int stride;
- Rect area;
+ SpiceRect area;
if (!worker->display_channel || !worker->surface.context.canvas) {
return;
@@ -4734,7 +4734,7 @@ static void add_buf(RedChannel *channel, uint32_t type, void *data, uint32_t siz
channel->send_data.header.size += size;
}
-static void fill_path(DisplayChannel *display_channel, PHYSICAL *in_path, uint32_t group_id)
+static void fill_path(DisplayChannel *display_channel, QXLPHYSICAL *in_path, uint32_t group_id)
{
RedWorker *worker;
RedChannel *channel = &display_channel->base;
@@ -4748,7 +4748,7 @@ static void fill_path(DisplayChannel *display_channel, PHYSICAL *in_path, uint32
add_buf(channel, BUF_TYPE_CHUNK, &path->chunk, path->data_size, memslot_id, group_id);
}
-static void fill_str(DisplayChannel *display_channel, PHYSICAL *in_str, uint32_t group_id)
+static void fill_str(DisplayChannel *display_channel, QXLPHYSICAL *in_str, uint32_t group_id)
{
RedWorker *worker;
RedChannel *channel = &display_channel->base;
@@ -4762,7 +4762,7 @@ static void fill_str(DisplayChannel *display_channel, PHYSICAL *in_str, uint32_t
add_buf(channel, BUF_TYPE_CHUNK, &str->chunk, str->data_size, memslot_id, group_id);
}
-static inline void fill_rects_clip(RedChannel *channel, PHYSICAL *in_clip, uint32_t group_id)
+static inline void fill_rects_clip(RedChannel *channel, QXLPHYSICAL *in_clip, uint32_t group_id)
{
RedWorker *worker = channel->worker;
QXLClipRects *clip;
@@ -4772,11 +4772,11 @@ static inline void fill_rects_clip(RedChannel *channel, PHYSICAL *in_clip, uint3
clip = (QXLClipRects *)get_virt(worker, *in_clip, sizeof(QXLClipRects), group_id);
*in_clip = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, &clip->num_rects, sizeof(UINT32), 0, 0);
- add_buf(channel, BUF_TYPE_CHUNK, &clip->chunk, clip->num_rects * sizeof(Rect), memslot_id,
+ add_buf(channel, BUF_TYPE_CHUNK, &clip->chunk, clip->num_rects * sizeof(SpiceRect), memslot_id,
group_id);
}
-static void fill_base(DisplayChannel *display_channel, RedDrawBase *base, Drawable *drawable,
+static void fill_base(DisplayChannel *display_channel, SpiceMsgDisplayBase *base, Drawable *drawable,
uint32_t size)
{
RedChannel *channel = &display_channel->base;
@@ -4784,9 +4784,9 @@ static void fill_base(DisplayChannel *display_channel, RedDrawBase *base, Drawab
base->box = drawable->qxl_drawable->bbox;
base->clip = drawable->qxl_drawable->clip;
- if (base->clip.type == CLIP_TYPE_RECTS) {
+ if (base->clip.type == SPICE_CLIP_TYPE_RECTS) {
fill_rects_clip(channel, &base->clip.data, drawable->group_id);
- } else if (base->clip.type == CLIP_TYPE_PATH) {
+ } else if (base->clip.type == SPICE_CLIP_TYPE_PATH) {
fill_path(display_channel, &base->clip.data, drawable->group_id);
}
}
@@ -4798,30 +4798,30 @@ static inline RedImage *alloc_image(DisplayChannel *display_channel)
}
/* io_palette is relative address of the palette*/
-static inline void fill_palette(DisplayChannel *display_channel, ADDRESS *io_palette, UINT8 *flags,
+static inline void fill_palette(DisplayChannel *display_channel, SPICE_ADDRESS *io_palette, UINT8 *flags,
uint32_t group_id)
{
RedChannel *channel = &display_channel->base;
RedWorker *worker = channel->worker;
- Palette *palette;
+ SpicePalette *palette;
if (!(*io_palette)) {
return;
}
- palette = (Palette *)get_virt(worker, *io_palette, sizeof(Palette), group_id);
+ palette = (SpicePalette *)get_virt(worker, *io_palette, sizeof(SpicePalette), group_id);
if (palette->unique) {
if (red_palette_cache_find(display_channel, palette->unique)) {
- *flags |= BITMAP_PAL_FROM_CACHE;
+ *flags |= SPICE_BITMAP_FLAGS_PAL_FROM_CACHE;
*io_palette = palette->unique;
return;
}
if (red_palette_cache_add(display_channel, palette->unique, 1)) {
- *flags |= BITMAP_PAL_CACHE_ME;
+ *flags |= SPICE_BITMAP_FLAGS_PAL_CACHE_ME;
}
}
*io_palette = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, palette,
- sizeof(Palette) + palette->num_ents * sizeof(UINT32), 0, 0);
+ sizeof(SpicePalette) + palette->num_ents * sizeof(UINT32), 0, 0);
}
static inline RedCompressBuf *red_display_alloc_compress_buf(DisplayChannel *display_channel)
@@ -5425,7 +5425,7 @@ typedef uint16_t rgb16_pixel_t;
#define GRADUAL_SCORE_RGB16_TH 0
// assumes that stride doesn't overflow
-static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
+static int _bitmap_is_gradual(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id)
{
double score = 0.0;
int num_samples = 0;
@@ -5437,20 +5437,20 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
x = bitmap->x;
y = bitmap->y;
switch (bitmap->format) {
- case BITMAP_FMT_16BIT: {
+ case SPICE_BITMAP_FMT_16BIT: {
uint8_t *lines = (uint8_t*)get_virt(worker, bitmap->data, x * y *
sizeof(rgb16_pixel_t), group_id);
compute_lines_gradual_score_rgb16((rgb16_pixel_t*)lines, x, y, &score, &num_samples);
break;
}
- case BITMAP_FMT_24BIT: {
+ case SPICE_BITMAP_FMT_24BIT: {
uint8_t *lines = (uint8_t*)get_virt(worker, bitmap->data, x * y *
sizeof(rgb24_pixel_t), group_id);
compute_lines_gradual_score_rgb24((rgb24_pixel_t*)lines, x, y, &score, &num_samples);
break;
}
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA: {
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA: {
uint8_t *lines = (uint8_t*)get_virt(worker, bitmap->data, x * y *
sizeof(rgb32_pixel_t), group_id);
compute_lines_gradual_score_rgb32((rgb32_pixel_t*)lines, x, y, &score, &num_samples);
@@ -5465,7 +5465,7 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
double chunk_score = 0.0;
int chunk_num_samples = 0;
uint32_t x;
- ADDRESS relative_address = bitmap->data;
+ SPICE_ADDRESS relative_address = bitmap->data;
while (relative_address) {
chunk = (QXLDataChunk *)get_virt(worker, relative_address, sizeof(QXLDataChunk),
@@ -5473,22 +5473,22 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
num_lines = chunk->data_size / bitmap->stride;
x = bitmap->x;
switch (bitmap->format) {
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
validate_virt(worker, (unsigned long)chunk->data,
get_memslot_id(worker, relative_address),
sizeof(rgb16_pixel_t) * x * num_lines, group_id);
compute_lines_gradual_score_rgb16((rgb16_pixel_t*)chunk->data, x, num_lines,
&chunk_score, &chunk_num_samples);
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
validate_virt(worker, (unsigned long)chunk->data,
get_memslot_id(worker, relative_address),
sizeof(rgb24_pixel_t) * x * num_lines, group_id);
compute_lines_gradual_score_rgb24((rgb24_pixel_t*)chunk->data, x, num_lines,
&chunk_score, &chunk_num_samples);
break;
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA:
validate_virt(worker, (unsigned long)chunk->data,
get_memslot_id(worker, relative_address),
sizeof(rgb32_pixel_t) * x * num_lines, group_id);
@@ -5509,29 +5509,29 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
ASSERT(num_samples);
score /= num_samples;
- if (bitmap->format == BITMAP_FMT_16BIT) {
+ if (bitmap->format == SPICE_BITMAP_FMT_16BIT) {
return (score < GRADUAL_SCORE_RGB16_TH);
} else {
return (score < GRADUAL_SCORE_RGB24_TH);
}
}
-static inline int _stride_is_extra(Bitmap *bitmap)
+static inline int _stride_is_extra(SpiceBitmap *bitmap)
{
ASSERT(bitmap);
if (BITMAP_FMT_IS_RGB[bitmap->format]) {
return ((bitmap->x * BITMAP_FMP_BYTES_PER_PIXEL[bitmap->format]) < bitmap->stride);
} else {
switch (bitmap->format) {
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
return (bitmap->x < bitmap->stride);
- case BITMAP_FMT_4BIT_BE:
- case BITMAP_FMT_4BIT_LE: {
+ case SPICE_BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_LE: {
int bytes_width = ALIGN(bitmap->x, 2) >> 1;
return bytes_width < bitmap->stride;
}
- case BITMAP_FMT_1BIT_BE:
- case BITMAP_FMT_1BIT_LE: {
+ case SPICE_BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_LE: {
int bytes_width = ALIGN(bitmap->x, 8) >> 3;
return bytes_width < bitmap->stride;
}
@@ -5558,13 +5558,13 @@ typedef struct compress_send_data_t {
uint32_t raw_size;
void* comp_buf;
uint32_t comp_buf_size;
- ADDRESS *plt_ptr;
+ SPICE_ADDRESS *plt_ptr;
UINT8 *flags_ptr;
} compress_send_data_t;
static inline int red_glz_compress_image(DisplayChannel *display_channel,
- RedImage *dest, Bitmap *src, Drawable *drawable,
+ RedImage *dest, SpiceBitmap *src, Drawable *drawable,
compress_send_data_t* o_comp_data)
{
RedWorker *worker = (RedWorker *)display_channel->base.worker;
@@ -5617,10 +5617,10 @@ static inline int red_glz_compress_image(DisplayChannel *display_channel,
glz_drawable_instance,
&glz_drawable_instance->glz_instance);
- dest->descriptor.type = IMAGE_TYPE_GLZ_RGB;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_GLZ_RGB;
dest->lz_rgb.data_size = size;
- o_comp_data->raw_size = sizeof(LZ_RGBImage);
+ o_comp_data->raw_size = sizeof(SpiceLZRGBImage);
o_comp_data->comp_buf = glz_data->data.bufs_head;
o_comp_data->comp_buf_size = size;
o_comp_data->plt_ptr = NULL;
@@ -5632,7 +5632,7 @@ static inline int red_glz_compress_image(DisplayChannel *display_channel,
}
static inline int red_lz_compress_image(DisplayChannel *display_channel,
- RedImage *dest, Bitmap *src,
+ RedImage *dest, SpiceBitmap *src,
compress_send_data_t* o_comp_data, uint32_t group_id)
{
RedWorker *worker = display_channel->base.worker;
@@ -5692,21 +5692,21 @@ static inline int red_lz_compress_image(DisplayChannel *display_channel,
}
if (BITMAP_FMT_IS_RGB[src->format]) {
- dest->descriptor.type = IMAGE_TYPE_LZ_RGB;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_LZ_RGB;
dest->lz_rgb.data_size = size;
- o_comp_data->raw_size = sizeof(LZ_RGBImage);
+ o_comp_data->raw_size = sizeof(SpiceLZRGBImage);
o_comp_data->comp_buf = lz_data->data.bufs_head;
o_comp_data->comp_buf_size = size;
o_comp_data->plt_ptr = NULL;
o_comp_data->flags_ptr = NULL;
} else {
- dest->descriptor.type = IMAGE_TYPE_LZ_PLT;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_LZ_PLT;
dest->lz_plt.data_size = size;
- dest->lz_plt.flags = src->flags & BITMAP_TOP_DOWN;
+ dest->lz_plt.flags = src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN;
dest->lz_plt.palette = src->palette;
- o_comp_data->raw_size = sizeof(LZ_PLTImage);
+ o_comp_data->raw_size = sizeof(SpiceLZPLTImage);
o_comp_data->comp_buf = lz_data->data.bufs_head;
o_comp_data->comp_buf_size = size;
o_comp_data->plt_ptr = &(dest->lz_plt.palette);
@@ -5718,7 +5718,7 @@ static inline int red_lz_compress_image(DisplayChannel *display_channel,
}
static inline int red_quic_compress_image(DisplayChannel *display_channel, RedImage *dest,
- Bitmap *src, compress_send_data_t* o_comp_data,
+ SpiceBitmap *src, compress_send_data_t* o_comp_data,
uint32_t group_id)
{
RedWorker *worker = display_channel->base.worker;
@@ -5732,16 +5732,16 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
#endif
switch (src->format) {
- case BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_32BIT:
type = QUIC_IMAGE_TYPE_RGB32;
break;
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_RGBA:
type = QUIC_IMAGE_TYPE_RGBA;
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
type = QUIC_IMAGE_TYPE_RGB16;
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
type = QUIC_IMAGE_TYPE_RGB24;
break;
default:
@@ -5824,7 +5824,7 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
quic_data->usr.more_lines = quic_usr_more_lines;
stride = src->stride;
} else {
- ADDRESS prev_addr = src->data;
+ SPICE_ADDRESS prev_addr = src->data;
QXLDataChunk *chunk = (QXLDataChunk *)get_virt(worker, src->data,
sizeof(QXLDataChunk), group_id);
while (chunk->next_chunk) {
@@ -5833,7 +5833,7 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
group_id);
ASSERT(chunk->prev_chunk);
}
- quic_data->data.u.lines_data.next = (ADDRESS)prev_addr -
+ quic_data->data.u.lines_data.next = (SPICE_ADDRESS)prev_addr -
get_virt_delta(worker,
get_memslot_id(worker, src->data),
group_id);
@@ -5850,10 +5850,10 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
longjmp(quic_data->data.jmp_env, 1);
}
- dest->descriptor.type = IMAGE_TYPE_QUIC;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_QUIC;
dest->quic.data_size = size << 2;
- o_comp_data->raw_size = sizeof(QUICImage);
+ o_comp_data->raw_size = sizeof(SpiceQUICImage);
o_comp_data->comp_buf = quic_data->data.bufs_head;
o_comp_data->comp_buf_size = size << 2;
o_comp_data->plt_ptr = NULL;
@@ -5867,7 +5867,7 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
#define MIN_SIZE_TO_COMPRESS 54
#define MIN_DIMENSION_TO_QUIC 3
static inline int red_compress_image(DisplayChannel *display_channel,
- RedImage *dest, Bitmap *src, Drawable *drawable,
+ RedImage *dest, SpiceBitmap *src, Drawable *drawable,
compress_send_data_t* o_comp_data)
{
image_compression_t image_compression = display_channel->base.worker->image_compression;
@@ -5971,19 +5971,19 @@ static inline void red_display_add_image_to_pixmap_cache(DisplayChannel *display
if (pixmap_cache_add(display_channel->pixmap_cache, qxl_image->descriptor.id,
qxl_image->descriptor.width * qxl_image->descriptor.height,
display_channel)) {
- io_image->descriptor.flags |= IMAGE_CACHE_ME;
+ io_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
stat_inc_counter(display_channel->add_to_cache_counter, 1);
}
}
- if (!(io_image->descriptor.flags & IMAGE_CACHE_ME)) {
+ if (!(io_image->descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME)) {
stat_inc_counter(display_channel->non_cache_counter, 1);
}
}
/* if the number of times fill_bits can be called per one qxl_drawable increases -
MAX_LZ_DRAWABLE_INSTANCES must be increased as well */
-static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Drawable *drawable)
+static void fill_bits(DisplayChannel *display_channel, QXLPHYSICAL *in_bitmap, Drawable *drawable)
{
RedChannel *channel = &display_channel->base;
RedWorker *worker = channel->worker;
@@ -6009,15 +6009,15 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
if ((qxl_image->descriptor.flags & QXL_IMAGE_CACHE)) {
if (pixmap_cache_hit(display_channel->pixmap_cache, image->descriptor.id,
display_channel)) {
- image->descriptor.type = IMAGE_TYPE_FROM_CACHE;
- add_buf(channel, BUF_TYPE_RAW, image, sizeof(ImageDescriptor), 0, 0);
+ image->descriptor.type = SPICE_IMAGE_TYPE_FROM_CACHE;
+ add_buf(channel, BUF_TYPE_RAW, image, sizeof(SpiceImageDescriptor), 0, 0);
stat_inc_counter(display_channel->cache_hits_counter, 1);
return;
}
}
switch (qxl_image->descriptor.type) {
- case IMAGE_TYPE_BITMAP:
+ case SPICE_IMAGE_TYPE_BITMAP:
#ifdef DUMP_BITMAP
dump_bitmap(display_channel->base.worker, &qxl_image->bitmap, drawable->group_id);
#endif
@@ -6028,7 +6028,7 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
drawable, &comp_send_data)) {
uint32_t y;
uint32_t stride;
- ADDRESS image_data;
+ SPICE_ADDRESS image_data;
red_display_add_image_to_pixmap_cache(display_channel, qxl_image, image);
@@ -6036,9 +6036,9 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
y = image->bitmap.y;
stride = image->bitmap.stride;
image_data = image->bitmap.data;
- image->bitmap.flags = image->bitmap.flags & BITMAP_TOP_DOWN;
+ image->bitmap.flags = image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN;
- add_buf(channel, BUF_TYPE_RAW, image, sizeof(BitmapImage), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, image, sizeof(SpiceBitmapImage), 0, 0);
fill_palette(display_channel, &(image->bitmap.palette), &(image->bitmap.flags),
drawable->group_id);
image->bitmap.data = channel->send_data.header.size;
@@ -6064,10 +6064,10 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
}
}
break;
- case IMAGE_TYPE_QUIC:
+ case SPICE_IMAGE_TYPE_QUIC:
red_display_add_image_to_pixmap_cache(display_channel, qxl_image, image);
image->quic = qxl_image->quic;
- add_buf(channel, BUF_TYPE_RAW, image, sizeof(QUICImage), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, image, sizeof(SpiceQUICImage), 0, 0);
add_buf(channel, BUF_TYPE_CHUNK, qxl_image->quic.data, qxl_image->quic.data_size,
memslot_id, drawable->group_id);
break;
@@ -6076,14 +6076,14 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
}
}
-static void fill_brush(DisplayChannel *display_channel, Brush *brush, Drawable *drawable)
+static void fill_brush(DisplayChannel *display_channel, SpiceBrush *brush, Drawable *drawable)
{
- if (brush->type == BRUSH_TYPE_PATTERN) {
+ if (brush->type == SPICE_BRUSH_TYPE_PATTERN) {
fill_bits(display_channel, &brush->u.pattern.pat, drawable);
}
}
-static void fill_mask(DisplayChannel *display_channel, QMask *mask, Drawable *drawable)
+static void fill_mask(DisplayChannel *display_channel, SpiceQMask *mask, Drawable *drawable)
{
if (mask->bitmap) {
if (display_channel->base.worker->image_compression != IMAGE_COMPRESS_OFF) {
@@ -6097,7 +6097,7 @@ static void fill_mask(DisplayChannel *display_channel, QMask *mask, Drawable *dr
}
}
-static void fill_attr(DisplayChannel *display_channel, LineAttr *attr, uint32_t group_id)
+static void fill_attr(DisplayChannel *display_channel, SpiceLineAttr *attr, uint32_t group_id)
{
if (attr->style_nseg) {
RedChannel *channel = &display_channel->base;
@@ -6109,12 +6109,12 @@ static void fill_attr(DisplayChannel *display_channel, LineAttr *attr, uint32_t
}
}
-static void fill_cursor(CursorChannel *cursor_channel, RedCursor *red_cursor, CursorItem *cursor)
+static void fill_cursor(CursorChannel *cursor_channel, SpiceCursor *red_cursor, CursorItem *cursor)
{
RedChannel *channel = &cursor_channel->base;
if (!cursor) {
- red_cursor->flags = RED_CURSOR_NONE;
+ red_cursor->flags = SPICE_CURSOR_FLAGS_NONE;
return;
}
@@ -6130,11 +6130,11 @@ static void fill_cursor(CursorChannel *cursor_channel, RedCursor *red_cursor, Cu
if (red_cursor->header.unique) {
if (red_cursor_cache_find(cursor_channel, red_cursor->header.unique)) {
- red_cursor->flags |= RED_CURSOR_FROM_CACHE;
+ red_cursor->flags |= SPICE_CURSOR_FLAGS_FROM_CACHE;
return;
}
if (red_cursor_cache_add(cursor_channel, red_cursor->header.unique, 1)) {
- red_cursor->flags |= RED_CURSOR_CACHE_ME;
+ red_cursor->flags |= SPICE_CURSOR_FLAGS_CACHE_ME;
}
}
@@ -6160,7 +6160,7 @@ static inline void red_channel_reset_send_data(RedChannel *channel)
channel->send_data.header.sub_list = 0;
++channel->send_data.header.serial;
channel->send_data.bufs[0].type = BUF_TYPE_RAW;
- channel->send_data.bufs[0].size = sizeof(RedDataHeader);
+ channel->send_data.bufs[0].size = sizeof(SpiceDataHeader);
channel->send_data.bufs[0].data = (void *)&channel->send_data.header;
}
@@ -6181,99 +6181,99 @@ static inline void red_send_qxl_drawable(RedWorker *worker, DisplayChannel *disp
RedChannel *channel = &display_channel->base;
switch (drawable->type) {
case QXL_DRAW_FILL:
- channel->send_data.header.type = RED_DISPLAY_DRAW_FILL;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_FILL;
fill_base(display_channel, &display_channel->send_data.u.fill.base, item,
- sizeof(RedFill));
+ sizeof(SpiceMsgDisplayDrawFill));
display_channel->send_data.u.fill.data = drawable->u.fill;
fill_brush(display_channel, &display_channel->send_data.u.fill.data.brush, item);
fill_mask(display_channel, &display_channel->send_data.u.fill.data.mask, item);
break;
case QXL_DRAW_OPAQUE:
- channel->send_data.header.type = RED_DISPLAY_DRAW_OPAQUE;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_OPAQUE;
fill_base(display_channel, &display_channel->send_data.u.opaque.base, item,
- sizeof(RedOpaque));
+ sizeof(SpiceMsgDisplayDrawOpaque));
display_channel->send_data.u.opaque.data = drawable->u.opaque;
fill_bits(display_channel, &display_channel->send_data.u.opaque.data.src_bitmap, item);
fill_brush(display_channel, &display_channel->send_data.u.opaque.data.brush, item);
fill_mask(display_channel, &display_channel->send_data.u.opaque.data.mask, item);
break;
case QXL_DRAW_COPY:
- channel->send_data.header.type = RED_DISPLAY_DRAW_COPY;
- fill_base(display_channel, &display_channel->send_data.u.copy.base, item, sizeof(RedCopy));
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_COPY;
+ fill_base(display_channel, &display_channel->send_data.u.copy.base, item, sizeof(SpiceMsgDisplayDrawCopy));
display_channel->send_data.u.copy.data = drawable->u.copy;
fill_bits(display_channel, &display_channel->send_data.u.copy.data.src_bitmap, item);
fill_mask(display_channel, &display_channel->send_data.u.copy.data.mask, item);
break;
case QXL_DRAW_TRANSPARENT:
- channel->send_data.header.type = RED_DISPLAY_DRAW_TRANSPARENT;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_TRANSPARENT;
fill_base(display_channel, &display_channel->send_data.u.transparent.base, item,
- sizeof(RedTransparent));
+ sizeof(SpiceMsgDisplayDrawTransparent));
display_channel->send_data.u.transparent.data = drawable->u.transparent;
fill_bits(display_channel, &display_channel->send_data.u.transparent.data.src_bitmap, item);
break;
case QXL_DRAW_ALPHA_BLEND:
- channel->send_data.header.type = RED_DISPLAY_DRAW_ALPHA_BLEND;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND;
fill_base(display_channel, &display_channel->send_data.u.alpha_blend.base, item,
- sizeof(RedAlphaBlend));
+ sizeof(SpiceMsgDisplayDrawAlphaBlend));
display_channel->send_data.u.alpha_blend.data = drawable->u.alpha_blend;
fill_bits(display_channel, &display_channel->send_data.u.alpha_blend.data.src_bitmap, item);
break;
case QXL_COPY_BITS:
- channel->send_data.header.type = RED_DISPLAY_COPY_BITS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_COPY_BITS;
fill_base(display_channel, &display_channel->send_data.u.copy_bits.base, item,
- sizeof(RedCopyBits));
+ sizeof(SpiceMsgDisplayCopyBits));
display_channel->send_data.u.copy_bits.src_pos = drawable->u.copy_bits.src_pos;
break;
case QXL_DRAW_BLEND:
- channel->send_data.header.type = RED_DISPLAY_DRAW_BLEND;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_BLEND;
fill_base(display_channel, &display_channel->send_data.u.blend.base, item,
- sizeof(RedBlend));
+ sizeof(SpiceMsgDisplayDrawBlend));
display_channel->send_data.u.blend.data = drawable->u.blend;
fill_bits(display_channel, &display_channel->send_data.u.blend.data.src_bitmap, item);
fill_mask(display_channel, &display_channel->send_data.u.blend.data.mask, item);
break;
case QXL_DRAW_BLACKNESS:
- channel->send_data.header.type = RED_DISPLAY_DRAW_BLACKNESS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_BLACKNESS;
fill_base(display_channel, &display_channel->send_data.u.blackness.base, item,
- sizeof(RedBlackness));
+ sizeof(SpiceMsgDisplayDrawBlackness));
display_channel->send_data.u.blackness.data = drawable->u.blackness;
fill_mask(display_channel, &display_channel->send_data.u.blackness.data.mask, item);
break;
case QXL_DRAW_WHITENESS:
- channel->send_data.header.type = RED_DISPLAY_DRAW_WHITENESS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_WHITENESS;
fill_base(display_channel, &display_channel->send_data.u.whiteness.base, item,
- sizeof(RedWhiteness));
+ sizeof(SpiceMsgDisplayDrawWhiteness));
display_channel->send_data.u.whiteness.data = drawable->u.whiteness;
fill_mask(display_channel, &display_channel->send_data.u.whiteness.data.mask, item);
break;
case QXL_DRAW_INVERS:
- channel->send_data.header.type = RED_DISPLAY_DRAW_INVERS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_INVERS;
fill_base(display_channel, &display_channel->send_data.u.invers.base, item,
- sizeof(RedInvers));
+ sizeof(SpiceMsgDisplayDrawInvers));
display_channel->send_data.u.invers.data = drawable->u.invers;
fill_mask(display_channel, &display_channel->send_data.u.invers.data.mask, item);
break;
case QXL_DRAW_ROP3:
- channel->send_data.header.type = RED_DISPLAY_DRAW_ROP3;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_ROP3;
fill_base(display_channel, &display_channel->send_data.u.rop3.base, item,
- sizeof(RedRop3));
+ sizeof(SpiceMsgDisplayDrawRop3));
display_channel->send_data.u.rop3.data = drawable->u.rop3;
fill_bits(display_channel, &display_channel->send_data.u.rop3.data.src_bitmap, item);
fill_brush(display_channel, &display_channel->send_data.u.rop3.data.brush, item);
fill_mask(display_channel, &display_channel->send_data.u.rop3.data.mask, item);
break;
case QXL_DRAW_STROKE:
- channel->send_data.header.type = RED_DISPLAY_DRAW_STROKE;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_STROKE;
fill_base(display_channel, &display_channel->send_data.u.stroke.base, item,
- sizeof(RedStroke));
+ sizeof(SpiceMsgDisplayDrawStroke));
display_channel->send_data.u.stroke.data = drawable->u.stroke;
fill_path(display_channel, &display_channel->send_data.u.stroke.data.path, item->group_id);
fill_attr(display_channel, &display_channel->send_data.u.stroke.data.attr, item->group_id);
fill_brush(display_channel, &display_channel->send_data.u.stroke.data.brush, item);
break;
case QXL_DRAW_TEXT:
- channel->send_data.header.type = RED_DISPLAY_DRAW_TEXT;
- fill_base(display_channel, &display_channel->send_data.u.text.base, item, sizeof(RedText));
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_TEXT;
+ fill_base(display_channel, &display_channel->send_data.u.text.base, item, sizeof(SpiceMsgDisplayDrawText));
display_channel->send_data.u.text.data = drawable->u.text;
fill_brush(display_channel, &display_channel->send_data.u.text.data.fore_brush, item);
fill_brush(display_channel, &display_channel->send_data.u.text.data.back_brush, item);
@@ -6443,14 +6443,14 @@ static void display_channel_push_release(DisplayChannel *channel, uint8_t type,
}
if (free_list->res->count == free_list->res_size) {
- RedResorceList *new_list;
- new_list = malloc(sizeof(*new_list) + free_list->res_size * sizeof(RedResorceID) * 2);
+ SpiceResorceList *new_list;
+ new_list = malloc(sizeof(*new_list) + free_list->res_size * sizeof(SpiceResorceID) * 2);
if (!new_list) {
PANIC("malloc failed");
}
new_list->count = free_list->res->count;
memcpy(new_list->resorces, free_list->res->resorces,
- new_list->count * sizeof(RedResorceID));
+ new_list->count * sizeof(SpiceResorceID));
free(free_list->res);
free_list->res = new_list;
free_list->res_size *= 2;
@@ -6461,7 +6461,7 @@ static void display_channel_push_release(DisplayChannel *channel, uint8_t type,
static inline void red_begin_send_massage(RedChannel *channel, void *item)
{
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
channel->messages_window++;
red_send_data(channel, item);
}
@@ -6478,19 +6478,19 @@ static inline void display_begin_send_massage(DisplayChannel *channel, void *ite
channel->base.send_data.header.sub_list = channel->base.send_data.header.size;
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
if (i != channel->base.id && free_list->sync[i] != 0) {
- free_list->wait.header.wait_list[sync_count].channel_type = RED_CHANNEL_DISPLAY;
+ free_list->wait.header.wait_list[sync_count].channel_type = SPICE_CHANNEL_DISPLAY;
free_list->wait.header.wait_list[sync_count].channel_id = i;
free_list->wait.header.wait_list[sync_count++].message_serial = free_list->sync[i];
}
}
- RedSubMessageList *sub_list = &channel->send_data.sub_list.sub_list;
- RedSubMessage *sub_header = channel->send_data.sub_header;
+ SpiceSubMessageList *sub_list = &channel->send_data.sub_list.sub_list;
+ SpicedSubMessage *sub_header = channel->send_data.sub_header;
if (sync_count) {
sub_list->size = 2;
add_buf((RedChannel*)channel, BUF_TYPE_RAW, sub_list,
sizeof(*sub_list) + 2 * sizeof(sub_list->sub_messages[0]), 0, 0);
sub_list->sub_messages[0] = channel->base.send_data.header.size;
- sub_header[0].type = RED_WAIT_FOR_CHANNELS;
+ sub_header[0].type = SPICE_MSG_WAIT_FOR_CHANNELS;
sub_header[0].size = sizeof(free_list->wait.header) +
sync_count * sizeof(free_list->wait.buf[0]);
add_buf((RedChannel*)channel, BUF_TYPE_RAW, sub_header, sizeof(*sub_header), 0, 0);
@@ -6506,7 +6506,7 @@ static inline void display_begin_send_massage(DisplayChannel *channel, void *ite
sub_list->sub_messages[0] = channel->base.send_data.header.size;
sub_index = 0;
}
- sub_header[sub_index].type = RED_DISPLAY_INVAL_LIST;
+ sub_header[sub_index].type = SPICE_MSG_DISPLAY_INVAL_LIST;
sub_header[sub_index].size = sizeof(*free_list->res) + free_list->res->count *
sizeof(free_list->res->resorces[0]);
add_buf((RedChannel*)channel, BUF_TYPE_RAW, &sub_header[sub_index], sizeof(*sub_header), 0,
@@ -6600,7 +6600,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
qxl_image = (QXLImage *)get_virt(worker, drawable->qxl_drawable->u.copy.src_bitmap,
sizeof(QXLImage), drawable->group_id);
- if (qxl_image->descriptor.type != IMAGE_TYPE_BITMAP ||
+ if (qxl_image->descriptor.type != SPICE_IMAGE_TYPE_BITMAP ||
(qxl_image->bitmap.flags & QXL_BITMAP_DIRECT)) {
return FALSE;
}
@@ -6615,7 +6615,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
data = qxl_image->bitmap.data;
switch (qxl_image->bitmap.format) {
- case BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_32BIT:
if (!red_rgb_to_yuv420_32bpp(worker, &drawable->qxl_drawable->u.copy.src_area,
&qxl_image->bitmap, stream->av_frame,
get_virt_delta(worker, data, drawable->group_id),
@@ -6624,7 +6624,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
return FALSE;
}
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
if (!red_rgb_to_yuv420_16bpp(worker, &drawable->qxl_drawable->u.copy.src_area,
&qxl_image->bitmap, stream->av_frame,
get_virt_delta(worker, data, drawable->group_id),
@@ -6633,7 +6633,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
return FALSE;
}
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
if (!red_rgb_to_yuv420_24bpp(worker, &drawable->qxl_drawable->u.copy.src_area,
&qxl_image->bitmap, stream->av_frame,
get_virt_delta(worker, data, drawable->group_id),
@@ -6709,9 +6709,9 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
break;
}
#endif
- channel->send_data.header.type = RED_DISPLAY_STREAM_DATA;
- RedStreamData* stream_data = &display_channel->send_data.u.stream_data;
- add_buf(channel, BUF_TYPE_RAW, stream_data, sizeof(RedStreamData), 0, 0);
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_DATA;
+ SpiceMsgDisplayStreamData* stream_data = &display_channel->send_data.u.stream_data;
+ add_buf(channel, BUF_TYPE_RAW, stream_data, sizeof(SpiceMsgDisplayStreamData), 0, 0);
add_buf(channel, BUF_TYPE_RAW, display_channel->send_data.stream_outbuf,
n + FF_INPUT_BUFFER_PADDING_SIZE, 0, 0);
@@ -6750,12 +6750,12 @@ static void red_send_mode(DisplayChannel *display_channel)
}
channel = &display_channel->base;
- channel->send_data.header.type = RED_DISPLAY_MODE;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_MODE;
display_channel->send_data.u.mode.x_res = worker->surface.context.width;
display_channel->send_data.u.mode.y_res = worker->surface.context.height;
display_channel->send_data.u.mode.bits = worker->surface.context.depth;
- add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.mode, sizeof(RedMode), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.mode, sizeof(SpiceMsgDisplayMode), 0, 0);
display_begin_send_massage(display_channel, NULL);
}
@@ -6763,12 +6763,12 @@ static void red_send_mode(DisplayChannel *display_channel)
static void red_send_set_ack(RedChannel *channel)
{
ASSERT(channel);
- channel->send_data.header.type = RED_SET_ACK;
+ channel->send_data.header.type = SPICE_MSG_SET_ACK;
channel->send_data.u.ack.generation = ++channel->ack_generation;
channel->send_data.u.ack.window = channel->client_ack_window;
channel->messages_window = 0;
- add_buf(channel, BUF_TYPE_RAW, &channel->send_data.u.ack, sizeof(RedSetAck), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, &channel->send_data.u.ack, sizeof(SpiceMsgSetAck), 0, 0);
red_begin_send_massage(channel, NULL);
}
@@ -6787,14 +6787,14 @@ static inline void display_send_verb(DisplayChannel *channel, uint16_t verb)
}
static inline void __red_send_inval(RedChannel *channel, CacheItem *cach_item,
- RedInvalOne *inval_one)
+ SpiceMsgDisplayInvalOne *inval_one)
{
channel->send_data.header.type = cach_item->inval_type;
inval_one->id = *(uint64_t *)&cach_item->id;
add_buf(channel, BUF_TYPE_RAW, inval_one, sizeof(*inval_one), 0, 0);
}
-static void red_send_inval(RedChannel *channel, CacheItem *cach_item, RedInvalOne *inval_one)
+static void red_send_inval(RedChannel *channel, CacheItem *cach_item, SpiceMsgDisplayInvalOne *inval_one)
{
__red_send_inval(channel, cach_item, inval_one);
red_begin_send_massage(channel, NULL);
@@ -6809,9 +6809,9 @@ static void red_display_send_inval(DisplayChannel *display_channel, CacheItem *c
static void display_channel_send_migrate(DisplayChannel *display_channel)
{
- display_channel->base.send_data.header.type = RED_MIGRATE;
- display_channel->send_data.u.migrate.flags = RED_MIGRATE_NEED_FLUSH |
- RED_MIGRATE_NEED_DATA_TRANSFER;
+ display_channel->base.send_data.header.type = SPICE_MSG_MIGRATE;
+ display_channel->send_data.u.migrate.flags = SPICE_MIGRATE_NEED_FLUSH |
+ SPICE_MIGRATE_NEED_DATA_TRANSFER;
add_buf((RedChannel*)display_channel, BUF_TYPE_RAW, &display_channel->send_data.u.migrate,
sizeof(display_channel->send_data.u.migrate), 0, 0);
display_channel->expect_migrate_mark = TRUE;
@@ -6822,7 +6822,7 @@ static void display_channel_send_migrate_data(DisplayChannel *display_channel)
{
DisplayChannelMigrateData* display_data;
- display_channel->base.send_data.header.type = RED_MIGRATE_DATA;
+ display_channel->base.send_data.header.type = SPICE_MSG_MIGRATE_DATA;
ASSERT(display_channel->pixmap_cache);
display_data = &display_channel->send_data.u.migrate_data;
display_data->magic = DISPLAY_MIGRATE_DATA_MAGIC;
@@ -6851,11 +6851,11 @@ static void display_channel_send_migrate_data(DisplayChannel *display_channel)
static void display_channel_pixmap_sync(DisplayChannel *display_channel)
{
- RedWaitForChannels *wait;
+ SpiceMsgWaitForChannels *wait;
PixmapCache *pixmap_cache;
- display_channel->base.send_data.header.type = RED_WAIT_FOR_CHANNELS;
+ display_channel->base.send_data.header.type = SPICE_MSG_WAIT_FOR_CHANNELS;
wait = &display_channel->send_data.u.wait.header;
pixmap_cache = display_channel->pixmap_cache;
@@ -6863,7 +6863,7 @@ static void display_channel_pixmap_sync(DisplayChannel *display_channel)
pthread_mutex_lock(&pixmap_cache->lock);
wait->wait_count = 1;
- wait->wait_list[0].channel_type = RED_CHANNEL_DISPLAY;
+ wait->wait_list[0].channel_type = SPICE_CHANNEL_DISPLAY;
wait->wait_list[0].channel_id = pixmap_cache->generation_initiator.client;
wait->wait_list[0].message_serial = pixmap_cache->generation_initiator.message;
display_channel->pixmap_cache_generation = pixmap_cache->generation;
@@ -6878,9 +6878,9 @@ static void display_channel_pixmap_sync(DisplayChannel *display_channel)
static void display_channel_reset_cache(DisplayChannel *display_channel)
{
- RedWaitForChannels *wait = &display_channel->send_data.u.wait.header;
+ SpiceMsgWaitForChannels *wait = &display_channel->send_data.u.wait.header;
- display_channel->base.send_data.header.type = RED_DISPLAY_INVAL_ALL_PIXMAPS;
+ display_channel->base.send_data.header.type = SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS;
pixmap_cache_reset(display_channel->pixmap_cache, display_channel, wait);
add_buf((RedChannel *)display_channel, BUF_TYPE_RAW, wait,
@@ -6893,7 +6893,7 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
RedChannel *channel;
RedImage *red_image;
RedWorker *worker;
- Bitmap bitmap;
+ SpiceBitmap bitmap;
ASSERT(display_channel && item);
channel = &display_channel->base;
@@ -6903,30 +6903,30 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
ASSERT(red_image);
QXL_SET_IMAGE_ID(red_image, QXL_IMAGE_GROUP_RED, ++worker->bits_unique);
- red_image->descriptor.type = IMAGE_TYPE_BITMAP;
+ red_image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
red_image->descriptor.flags = 0;
red_image->descriptor.width = item->width;
red_image->descriptor.height = item->height;
- bitmap.format = BITMAP_FMT_32BIT;
+ bitmap.format = SPICE_BITMAP_FMT_32BIT;
bitmap.flags = QXL_BITMAP_DIRECT;
bitmap.flags |= item->top_down ? QXL_BITMAP_TOP_DOWN : 0;
bitmap.x = item->width;
bitmap.y = item->height;
bitmap.stride = item->stride;
bitmap.palette = 0;
- bitmap.data = (ADDRESS)item->data;
+ bitmap.data = (SPICE_ADDRESS)item->data;
- channel->send_data.header.type = RED_DISPLAY_DRAW_COPY;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_COPY;
- add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.copy, sizeof(RedCopy), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.copy, sizeof(SpiceMsgDisplayDrawCopy), 0, 0);
display_channel->send_data.u.copy.base.box.left = item->pos.x;
display_channel->send_data.u.copy.base.box.top = item->pos.y;
display_channel->send_data.u.copy.base.box.right = item->pos.x + bitmap.x;
display_channel->send_data.u.copy.base.box.bottom = item->pos.y + bitmap.y;
- display_channel->send_data.u.copy.base.clip.type = CLIP_TYPE_NONE;
+ display_channel->send_data.u.copy.base.clip.type = SPICE_CLIP_TYPE_NONE;
display_channel->send_data.u.copy.base.clip.data = 0;
- display_channel->send_data.u.copy.data.rop_decriptor = ROPD_OP_PUT;
+ display_channel->send_data.u.copy.data.rop_decriptor = SPICE_ROPD_OP_PUT;
display_channel->send_data.u.copy.data.src_area.left = 0;
display_channel->send_data.u.copy.data.src_area.top = 0;
display_channel->send_data.u.copy.data.src_area.right = bitmap.x;
@@ -6943,10 +6943,10 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
add_buf(channel, BUF_TYPE_COMPRESS_BUF, comp_send_data.comp_buf,
comp_send_data.comp_buf_size, 0, 0);
} else {
- red_image->descriptor.type = IMAGE_TYPE_BITMAP;
+ red_image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
red_image->bitmap = bitmap;
red_image->bitmap.flags &= ~QXL_BITMAP_DIRECT;
- add_buf(channel, BUF_TYPE_RAW, red_image, sizeof(BitmapImage), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, red_image, sizeof(SpiceBitmapImage), 0, 0);
red_image->bitmap.data = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, item->data, bitmap.y * bitmap.stride, 0, 0);
}
@@ -6957,24 +6957,24 @@ static void red_display_send_upgrade(DisplayChannel *display_channel, UpgradeIte
{
RedChannel *channel;
QXLDrawable *qxl_drawable;
- RedCopy *copy = &display_channel->send_data.u.copy;
+ SpiceMsgDisplayDrawCopy *copy = &display_channel->send_data.u.copy;
ASSERT(display_channel && item && item->drawable);
channel = &display_channel->base;
- channel->send_data.header.type = RED_DISPLAY_DRAW_COPY;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_COPY;
qxl_drawable = item->drawable->qxl_drawable;
ASSERT(qxl_drawable->type == QXL_DRAW_COPY);
- ASSERT(qxl_drawable->u.copy.rop_decriptor == ROPD_OP_PUT);
+ ASSERT(qxl_drawable->u.copy.rop_decriptor == SPICE_ROPD_OP_PUT);
ASSERT(qxl_drawable->u.copy.mask.bitmap == 0);
- add_buf(channel, BUF_TYPE_RAW, copy, sizeof(RedCopy), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, copy, sizeof(SpiceMsgDisplayDrawCopy), 0, 0);
copy->base.box = qxl_drawable->bbox;
- copy->base.clip.type = CLIP_TYPE_RECTS;
+ copy->base.clip.type = SPICE_CLIP_TYPE_RECTS;
copy->base.clip.data = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, &item->region.num_rects, sizeof(uint32_t), 0, 0);
- add_buf(channel, BUF_TYPE_RAW, item->region.rects, sizeof(Rect) * item->region.num_rects, 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, item->region.rects, sizeof(SpiceRect) * item->region.num_rects, 0, 0);
copy->data = qxl_drawable->u.copy;
fill_bits(display_channel, &copy->data.src_bitmap, item->drawable);
@@ -6988,11 +6988,11 @@ static void red_display_send_stream_start(DisplayChannel *display_channel, Strea
agent->lats_send_time = 0;
ASSERT(stream);
- channel->send_data.header.type = RED_DISPLAY_STREAM_CREATE;
- RedStreamCreate *stream_create = &display_channel->send_data.u.stream_create.message;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_CREATE;
+ SpiceMsgDisplayStreamCreate *stream_create = &display_channel->send_data.u.stream_create.message;
stream_create->id = agent - display_channel->stream_agents;
- stream_create->flags = stream->top_down ? STREAM_TOP_DOWN : 0;
- stream_create->codec_type = RED_VIDEO_CODEC_TYPE_MJPEG;
+ stream_create->flags = stream->top_down ? SPICE_STREAM_FLAGS_TOP_DOWN : 0;
+ stream_create->codec_type = SPICE_VIDEO_CODEC_TYPE_MJPEG;
stream_create->src_width = stream->width;
stream_create->src_height = stream->height;
@@ -7004,14 +7004,14 @@ static void red_display_send_stream_start(DisplayChannel *display_channel, Strea
if (stream->current) {
QXLDrawable *qxl_drawable = stream->current->qxl_drawable;
stream_create->clip = qxl_drawable->clip;
- if (qxl_drawable->clip.type == CLIP_TYPE_RECTS) {
+ if (qxl_drawable->clip.type == SPICE_CLIP_TYPE_RECTS) {
fill_rects_clip(channel, &stream_create->clip.data, stream->current->group_id);
} else {
- ASSERT(qxl_drawable->clip.type == CLIP_TYPE_NONE);
+ ASSERT(qxl_drawable->clip.type == SPICE_CLIP_TYPE_NONE);
}
display_begin_send_massage(display_channel, &stream->current->pipe_item);
} else {
- stream_create->clip.type = CLIP_TYPE_RECTS;
+ stream_create->clip.type = SPICE_CLIP_TYPE_RECTS;
stream_create->clip.data = channel->send_data.header.size;
display_channel->send_data.u.stream_create.num_rects = 0;
add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.stream_create.num_rects,
@@ -7030,18 +7030,18 @@ static void red_display_send_stream_clip(DisplayChannel *display_channel,
ASSERT(stream);
- channel->send_data.header.type = RED_DISPLAY_STREAM_CLIP;
- RedStreamClip *stream_clip = &display_channel->send_data.u.stream_clip;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_CLIP;
+ SpiceMsgDisplayStreamClip *stream_clip = &display_channel->send_data.u.stream_clip;
add_buf(channel, BUF_TYPE_RAW, stream_clip, sizeof(*stream_clip), 0, 0);
stream_clip->id = agent - display_channel->stream_agents;
- if ((stream_clip->clip.type = item->clip_type) == CLIP_TYPE_NONE) {
+ if ((stream_clip->clip.type = item->clip_type) == SPICE_CLIP_TYPE_NONE) {
stream_clip->clip.data = 0;
} else {
- ASSERT(stream_clip->clip.type == CLIP_TYPE_RECTS);
+ ASSERT(stream_clip->clip.type == SPICE_CLIP_TYPE_RECTS);
stream_clip->clip.data = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, &item->region.num_rects, sizeof(uint32_t), 0, 0);
add_buf(channel, BUF_TYPE_RAW, item->region.rects,
- item->region.num_rects * sizeof(Rect), 0, 0);
+ item->region.num_rects * sizeof(SpiceRect), 0, 0);
}
display_begin_send_massage(display_channel, item);
}
@@ -7049,10 +7049,10 @@ static void red_display_send_stream_clip(DisplayChannel *display_channel,
static void red_display_send_stream_end(DisplayChannel *display_channel, StreamAgent* agent)
{
RedChannel *channel = &display_channel->base;
- channel->send_data.header.type = RED_DISPLAY_STREAM_DESTROY;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_DESTROY;
display_channel->send_data.u.stream_destroy.id = agent - display_channel->stream_agents;
add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.stream_destroy,
- sizeof(RedStreamDestroy), 0, 0);
+ sizeof(SpiceMsgDisplayStreamDestroy), 0, 0);
display_begin_send_massage(display_channel, NULL);
}
@@ -7069,12 +7069,12 @@ static void red_send_cursor_init(CursorChannel *channel)
worker = channel->base.worker;
- channel->base.send_data.header.type = RED_CURSOR_INIT;
+ channel->base.send_data.header.type = SPICE_MSG_CURSOR_INIT;
channel->send_data.u.cursor_init.visible = worker->cursor_visible;
channel->send_data.u.cursor_init.position = worker->cursor_position;
channel->send_data.u.cursor_init.trail_length = worker->cursor_trail_length;
channel->send_data.u.cursor_init.trail_frequency = worker->cursor_trail_frequency;
- add_buf(&channel->base, BUF_TYPE_RAW, &channel->send_data.u.cursor_init, sizeof(RedCursorInit),
+ add_buf(&channel->base, BUF_TYPE_RAW, &channel->send_data.u.cursor_init, sizeof(SpiceMsgCursorInit),
0, 0);
fill_cursor(channel, &channel->send_data.u.cursor_init.cursor, worker->cursor);
@@ -7089,11 +7089,11 @@ static void red_send_local_cursor(CursorChannel *cursor_channel, LocalCursor *cu
ASSERT(cursor_channel);
channel = &cursor_channel->base;
- channel->send_data.header.type = RED_CURSOR_SET;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_SET;
cursor_channel->send_data.u.cursor_set.postition = cursor->position;
cursor_channel->send_data.u.cursor_set.visible = channel->worker->cursor_visible;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_set,
- sizeof(RedCursorSet), 0, 0);
+ sizeof(SpiceMsgCursorSet), 0, 0);
fill_cursor(cursor_channel, &cursor_channel->send_data.u.cursor_set.cursor, &cursor->base);
red_begin_send_massage(channel, cursor);
@@ -7103,7 +7103,7 @@ static void red_send_local_cursor(CursorChannel *cursor_channel, LocalCursor *cu
static void cursor_channel_send_migrate(CursorChannel *cursor_channel)
{
- cursor_channel->base.send_data.header.type = RED_MIGRATE;
+ cursor_channel->base.send_data.header.type = SPICE_MSG_MIGRATE;
cursor_channel->send_data.u.migrate.flags = 0;
add_buf((RedChannel*)cursor_channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.migrate,
sizeof(cursor_channel->send_data.u.migrate), 0, 0);
@@ -7122,28 +7122,28 @@ static void red_send_cursor(CursorChannel *cursor_channel, CursorItem *cursor)
cmd = cursor->qxl_cursor;
switch (cmd->type) {
case QXL_CURSOR_MOVE:
- channel->send_data.header.type = RED_CURSOR_MOVE;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_MOVE;
cursor_channel->send_data.u.cursor_move.postition = cmd->u.position;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_move,
- sizeof(RedCursorMove), 0, 0);
+ sizeof(SpiceMsgCursorMove), 0, 0);
break;
case QXL_CURSOR_SET:
- channel->send_data.header.type = RED_CURSOR_SET;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_SET;
cursor_channel->send_data.u.cursor_set.postition = cmd->u.set.position;
cursor_channel->send_data.u.cursor_set.visible = channel->worker->cursor_visible;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_set,
- sizeof(RedCursorSet), 0, 0);
+ sizeof(SpiceMsgCursorSet), 0, 0);
fill_cursor(cursor_channel, &cursor_channel->send_data.u.cursor_set.cursor, cursor);
break;
case QXL_CURSOR_HIDE:
- channel->send_data.header.type = RED_CURSOR_HIDE;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_HIDE;
break;
case QXL_CURSOR_TRAIL:
- channel->send_data.header.type = RED_CURSOR_TRAIL;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_TRAIL;
cursor_channel->send_data.u.cursor_trail.length = cmd->u.trail.length;
cursor_channel->send_data.u.cursor_trail.frequency = cmd->u.trail.frequency;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_trail,
- sizeof(RedCursorTrail), 0, 0);
+ sizeof(SpiceMsgCursorTrail), 0, 0);
break;
default:
red_error("bad cursor command %d", cmd->type);
@@ -7248,7 +7248,7 @@ static void display_channel_push(RedWorker *worker)
break;
case PIPE_ITEM_TYPE_INVAL_PALLET_CACHE:
red_reset_palette_cache(display_channel);
- red_send_verb((RedChannel *)display_channel, RED_DISPLAY_INVAL_ALL_PALETTES);
+ red_send_verb((RedChannel *)display_channel, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
free(pipe_item);
break;
default:
@@ -7297,7 +7297,7 @@ static void cursor_channel_push(RedWorker *worker)
break;
case PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
red_reset_cursor_cache(cursor_channel);
- red_send_verb((RedChannel *)cursor_channel, RED_CURSOR_INVAL_ALL);
+ red_send_verb((RedChannel *)cursor_channel, SPICE_MSG_CURSOR_INVAL_ALL);
free(pipe_item);
break;
default:
@@ -7424,7 +7424,7 @@ static void red_disconnect_display(RedChannel *channel)
static void red_migrate_display(RedWorker *worker)
{
if (worker->display_channel) {
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_STREAM_DESTROY_ALL);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
red_pipe_add_type(&worker->display_channel->base, PIPE_ITEM_TYPE_MIGRATE);
}
}
@@ -7442,7 +7442,7 @@ static void destroy_cairo_canvas(CairoCanvas *canvas)
cairo_destroy(cairo);
}
-static void validate_area_nop(void *canvas, int32_t stride, uint8_t *line_0, const Rect *area)
+static void validate_area_nop(void *canvas, int32_t stride, uint8_t *line_0, const SpiceRect *area)
{
}
@@ -7507,7 +7507,7 @@ static void destroy_gl_canvas(GLCanvas *canvas)
oglctx_destroy(ctx);
}
-static void gl_validate_area(GLCanvas *canvas, int32_t stride, uint8_t *line_0, const Rect *area)
+static void gl_validate_area(GLCanvas *canvas, int32_t stride, uint8_t *line_0, const SpiceRect *area)
{
int h;
@@ -7791,28 +7791,28 @@ static void on_new_display_channel(RedWorker *worker)
push_new_mode(worker);
red_add_screen_image(worker);
if (channel_is_connected(&display_channel->base)) {
- red_pipe_add_verb(&display_channel->base, RED_DISPLAY_MARK);
+ red_pipe_add_verb(&display_channel->base, SPICE_MSG_DISPLAY_MARK);
red_disply_start_streams(display_channel);
}
}
}
-static int channel_handle_message(RedChannel *channel, RedDataHeader *message)
+static int channel_handle_message(RedChannel *channel, SpiceDataHeader *message)
{
switch (message->type) {
- case REDC_ACK_SYNC:
+ case SPICE_MSGC_ACK_SYNC:
if (message->size != sizeof(uint32_t)) {
red_printf("bad message size");
return FALSE;
}
channel->client_ack_generation = *(uint32_t *)(message + 1);
break;
- case REDC_ACK:
+ case SPICE_MSGC_ACK:
if (channel->client_ack_generation == channel->ack_generation) {
channel->messages_window -= channel->client_ack_window;
}
break;
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("invalid message type %u", message->type);
@@ -8017,14 +8017,14 @@ static void red_release_pixmap_cache(DisplayChannel *channel)
free(cache);
}
-static int display_channel_init_cache(DisplayChannel *channel, RedcDisplayInit *init_info)
+static int display_channel_init_cache(DisplayChannel *channel, SpiceMsgcDisplayInit *init_info)
{
ASSERT(!channel->pixmap_cache);
return !!(channel->pixmap_cache = red_get_pixmap_cache(init_info->pixmap_cache_id,
init_info->pixmap_cache_size));
}
-static int display_channel_init_glz_dictionary(DisplayChannel *channel, RedcDisplayInit *init_info)
+static int display_channel_init_glz_dictionary(DisplayChannel *channel, SpiceMsgcDisplayInit *init_info)
{
ASSERT(!channel->glz_dict);
ring_init(&channel->glz_drawables);
@@ -8035,7 +8035,7 @@ static int display_channel_init_glz_dictionary(DisplayChannel *channel, RedcDisp
init_info->glz_dictionary_window_size));
}
-static int display_channel_init(DisplayChannel *channel, RedcDisplayInit *init_info)
+static int display_channel_init(DisplayChannel *channel, SpiceMsgcDisplayInit *init_info)
{
return (display_channel_init_cache(channel, init_info) &&
display_channel_init_glz_dictionary(channel, init_info));
@@ -8064,7 +8064,7 @@ static int display_channel_handle_migrate_mark(DisplayChannel *channel)
return TRUE;
}
-static int display_channel_handle_migrate_data(DisplayChannel *channel, RedDataHeader *message)
+static int display_channel_handle_migrate_data(DisplayChannel *channel, SpiceDataHeader *message)
{
DisplayChannelMigrateData *migrate_data;
int i;
@@ -8115,23 +8115,23 @@ static int display_channel_handle_migrate_data(DisplayChannel *channel, RedDataH
return TRUE;
}
-static int display_channel_handle_message(RedChannel *channel, RedDataHeader *message)
+static int display_channel_handle_message(RedChannel *channel, SpiceDataHeader *message)
{
switch (message->type) {
- case REDC_DISPLAY_INIT:
- if (message->size != sizeof(RedcDisplayInit)) {
+ case SPICE_MSGC_DISPLAY_INIT:
+ if (message->size != sizeof(SpiceMsgcDisplayInit)) {
red_printf("bad message size");
return FALSE;
}
if (!((DisplayChannel *)channel)->expect_init) {
- red_printf("unexpected REDC_DISPLAY_INIT");
+ red_printf("unexpected SPICE_MSGC_DISPLAY_INIT");
return FALSE;
}
((DisplayChannel *)channel)->expect_init = FALSE;
- return display_channel_init((DisplayChannel *)channel, (RedcDisplayInit *)(message + 1));
- case REDC_MIGRATE_FLUSH_MARK:
+ return display_channel_init((DisplayChannel *)channel, (SpiceMsgcDisplayInit *)(message + 1));
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
return display_channel_handle_migrate_mark((DisplayChannel *)channel);
- case REDC_MIGRATE_DATA:
+ case SPICE_MSGC_MIGRATE_DATA:
return display_channel_handle_migrate_data((DisplayChannel *)channel, message);
default:
return channel_handle_message(channel, message);
@@ -8167,28 +8167,28 @@ static void red_receive(RedChannel *channel)
} else {
channel->recive_data.now += n;
for (;;) {
- RedDataHeader *message = channel->recive_data.message;
+ SpiceDataHeader *message = channel->recive_data.message;
n = channel->recive_data.now - (uint8_t *)message;
- if (n < sizeof(RedDataHeader) ||
- n < sizeof(RedDataHeader) + message->size) {
+ if (n < sizeof(SpiceDataHeader) ||
+ n < sizeof(SpiceDataHeader) + message->size) {
break;
}
if (!channel->handle_message(channel, message)) {
channel->disconnect(channel);
return;
}
- channel->recive_data.message = (RedDataHeader *)((uint8_t *)message +
- sizeof(RedDataHeader) +
+ channel->recive_data.message = (SpiceDataHeader *)((uint8_t *)message +
+ sizeof(SpiceDataHeader) +
message->size);
}
if (channel->recive_data.now == (uint8_t *)channel->recive_data.message) {
channel->recive_data.now = channel->recive_data.buf;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
} else if (channel->recive_data.now == channel->recive_data.end) {
memcpy(channel->recive_data.buf, channel->recive_data.message, n);
channel->recive_data.now = channel->recive_data.buf + n;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
}
}
}
@@ -8241,7 +8241,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, RedsStreamContext
channel->client_ack_window = IS_LOW_BANDWIDTH() ? WIDE_CLIENT_ACK_WINDOW :
NARROW_CLIENT_ACK_WINDOW;
channel->client_ack_generation = ~0;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
channel->recive_data.now = channel->recive_data.buf;
channel->recive_data.end = channel->recive_data.buf + sizeof(channel->recive_data.buf);
ring_init(&channel->pipe);
@@ -8361,9 +8361,9 @@ static void handle_new_display_channel(RedWorker *worker, RedsStreamContext *pee
worker->display_channel = display_channel;
- if (!(display_channel->send_data.free_list.res = malloc(sizeof(RedResorceList) +
+ if (!(display_channel->send_data.free_list.res = malloc(sizeof(SpiceResorceList) +
DISPLAY_FREE_LIST_DEFAULT_SIZE *
- sizeof(RedResorceID)))) {
+ sizeof(SpiceResorceID)))) {
PANIC("free list alloc failed");
}
display_channel->send_data.free_list.res_size = DISPLAY_FREE_LIST_DEFAULT_SIZE;
@@ -8447,11 +8447,11 @@ static void red_connect_cursor(RedWorker *worker, RedsStreamContext *peer, int m
typedef struct __attribute__ ((__packed__)) CursorData {
uint32_t visible;
- Point16 position;
+ SpicePoint16 position;
uint16_t trail_length;
uint16_t trail_frequency;
uint32_t data_size;
- RedCursor _cursor;
+ SpiceCursor _cursor;
} CursorData;
static void red_save_cursor(RedWorker *worker)
@@ -8464,7 +8464,7 @@ static void red_save_cursor(RedWorker *worker)
ASSERT(worker->cursor->type == CURSOR_TYPE_LOCAL);
local = (LocalCursor *)worker->cursor;
- size = sizeof(CursorData) + sizeof(RedCursor) + local->data_size;
+ size = sizeof(CursorData) + sizeof(SpiceCursor) + local->data_size;
cursor_data = malloc(size);
ASSERT(cursor_data);
@@ -8478,7 +8478,7 @@ static void red_save_cursor(RedWorker *worker)
worker->qxl->set_save_data(worker->qxl, cursor_data, size);
}
-static LocalCursor *_new_local_cursor(CursorHeader *header, int data_size, Point16 position)
+static LocalCursor *_new_local_cursor(SpiceCursorHeader *header, int data_size, SpicePoint16 position)
{
LocalCursor *local;
@@ -8686,16 +8686,16 @@ static inline void handle_dev_destroy_surfaces(RedWorker *worker)
if (worker->cursor_channel) {
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!worker->cursor_channel->base.migrate) {
- red_pipe_add_verb(&worker->cursor_channel->base, RED_CURSOR_RESET);
+ red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
}
ASSERT(!worker->cursor_channel->base.send_data.item);
}
if (worker->display_channel) {
red_pipe_add_type(&worker->display_channel->base, PIPE_ITEM_TYPE_INVAL_PALLET_CACHE);
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_STREAM_DESTROY_ALL);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
if (!worker->display_channel->base.migrate) {
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_RESET);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_RESET);
}
}
@@ -8735,7 +8735,7 @@ static inline void handle_dev_create_primary_surface(RedWorker *worker)
if (worker->display_channel) {
red_pipe_add_type(&worker->display_channel->base, PIPE_ITEM_TYPE_MODE);
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_MARK);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_MARK);
display_channel_push(worker);
}
@@ -8765,7 +8765,7 @@ static inline void handle_dev_destroy_primary_surface(RedWorker *worker)
if (worker->cursor_channel) {
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!worker->cursor_channel->base.migrate) {
- red_pipe_add_verb(&worker->cursor_channel->base, RED_CURSOR_RESET);
+ red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
}
ASSERT(!worker->cursor_channel->base.send_data.item);
}
@@ -8844,7 +8844,7 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
if (worker->cursor_channel) {
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!worker->cursor_channel->base.migrate) {
- red_pipe_add_verb(&worker->cursor_channel->base, RED_CURSOR_RESET);
+ red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
}
ASSERT(!worker->cursor_channel->base.send_data.item);
@@ -9040,7 +9040,7 @@ static void red_init(RedWorker *worker, WorkerInitData *init_data)
worker->num_renderers = init_data->num_renderers;
memcpy(worker->renderers, init_data->renderers, sizeof(worker->renderers));
worker->renderer = RED_RENDERER_INVALID;
- worker->mouse_mode = RED_MOUSE_MODE_SERVER;
+ worker->mouse_mode = SPICE_MOUSE_MODE_SERVER;
worker->image_compression = init_data->image_compression;
worker->streaming_video = init_data->streaming_video;
ring_init(&worker->current_list);
@@ -9089,7 +9089,7 @@ void *red_worker_main(void *arg)
red_printf("begin");
ASSERT(MAX_PIPE_SIZE > WIDE_CLIENT_ACK_WINDOW &&
MAX_PIPE_SIZE > NARROW_CLIENT_ACK_WINDOW); //ensure wakeup by ack message
- ASSERT(QXL_BITMAP_TOP_DOWN == BITMAP_TOP_DOWN);
+ ASSERT(QXL_BITMAP_TOP_DOWN == SPICE_BITMAP_FLAGS_TOP_DOWN);
#if defined(RED_WORKER_STAT) || defined(COMPRESS_STAT)
if (pthread_getcpuclockid(pthread_self(), &clock_id)) {
@@ -9157,7 +9157,7 @@ void *red_worker_main(void *arg)
#ifdef DUMP_BITMAP
#include <stdio.h>
-static void dump_palette(FILE *f, Palette* plt)
+static void dump_palette(FILE *f, SpicePalette* plt)
{
int i;
for (i = 0; i < plt->num_ents; i++) {
@@ -9181,14 +9181,14 @@ static void dump_line(FILE *f, uint8_t* line, uint16_t n_pixel_bits, int width,
#define RAM_PATH "/tmp/tmpfs"
-static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
+static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id)
{
static uint32_t file_id = 0;
char file_str[200];
int rgb = TRUE;
uint16_t n_pixel_bits;
- Palette *plt = NULL;
+ SpicePalette *plt = NULL;
uint32_t id;
int row_size;
uint32_t file_size;
@@ -9201,30 +9201,30 @@ static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
FILE *f;
switch (bitmap->format) {
- case BITMAP_FMT_1BIT_BE:
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
rgb = FALSE;
n_pixel_bits = 1;
break;
- case BITMAP_FMT_4BIT_BE:
- case BITMAP_FMT_4BIT_LE:
+ case SPICE_BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_LE:
rgb = FALSE;
n_pixel_bits = 4;
break;
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
rgb = FALSE;
n_pixel_bits = 8;
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
n_pixel_bits = 16;
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
n_pixel_bits = 24;
break;
- case BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_32BIT:
n_pixel_bits = 32;
break;
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_RGBA:
n_pixel_bits = 32;
alpha = 1;
break;
@@ -9236,7 +9236,7 @@ static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
if (!bitmap->palette) {
return; // dont dump masks.
}
- plt = (Palette *)get_virt(worker, bitmap->palette, sizeof(Palette), group_id);
+ plt = (SpicePalette *)get_virt(worker, bitmap->palette, sizeof(SpicePalette), group_id);
}
row_size = (((bitmap->x * n_pixel_bits) + 31) / 32) * 4;
bitmap_data_offset = header_size;
@@ -9301,7 +9301,7 @@ static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
} else {
QXLDataChunk *chunk = NULL;
int num_lines;
- ADDRESS relative_address = bitmap->data;
+ SPICE_ADDRESS relative_address = bitmap->data;
while (relative_address) {
int i;
diff --git a/server/red_yuv.h b/server/red_yuv.h
index 85597475..756717d5 100644
--- a/server/red_yuv.h
+++ b/server/red_yuv.h
@@ -83,8 +83,8 @@ static inline void FUNC_NAME(red_rgb_to_yuv420_line)(const uint8_t* line0, const
}
}
-static inline int FUNC_NAME(red_rgb_to_yuv420)(RedWorker *worker, const Rect *src,
- const Bitmap *image, AVFrame *frame,
+static inline int FUNC_NAME(red_rgb_to_yuv420)(RedWorker *worker, const SpiceRect *src,
+ const SpiceBitmap *image, AVFrame *frame,
long phys_delta, int memslot_id, int id,
Stream *stream, uint32_t group_id)
{
diff --git a/server/reds.c b/server/reds.c
index fb26901a..bb71ae74 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -97,7 +97,7 @@ static void openssl_init();
// approximate max recive message size
#define RECIVE_BUF_SIZE \
- (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * RED_AGENT_MAX_DATA_SIZE)
+ (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE)
#define SEND_BUF_SIZE 4096
@@ -110,7 +110,7 @@ typedef struct IncomingHandler {
int shut;
uint8_t buf[RECIVE_BUF_SIZE];
uint32_t end_pos;
- void (*handle_message)(void *opaque, RedDataHeader *message);
+ void (*handle_message)(void *opaque, SpiceDataHeader *message);
} IncomingHandler;
typedef struct OutgoingHandler {
@@ -123,7 +123,7 @@ typedef struct OutgoingHandler {
} OutgoingHandler;
typedef struct TicketAuthentication {
- char password[RED_MAX_PASSWORD_LENGTH];
+ char password[SPICE_MAX_PASSWORD_LENGTH];
time_t expiration_time;
} TicketAuthentication;
@@ -133,7 +133,7 @@ typedef struct TicketInfo {
RSA *rsa;
int rsa_size;
BIGNUM *bn;
- RedLinkEncryptedTicket encrypted_ticket;
+ SpiceLinkEncryptedTicket encrypted_ticket;
} TicketInfo;
typedef struct MonitorMode {
@@ -151,8 +151,8 @@ struct RedsOutItem {
typedef struct VDIReadBuf {
RedsOutItem out_item;
int len;
- RedDataHeader header;
- uint8_t data[RED_AGENT_MAX_DATA_SIZE];
+ SpiceDataHeader header;
+ uint8_t data[SPICE_AGENT_MAX_DATA_SIZE];
} VDIReadBuf;
enum {
@@ -226,7 +226,7 @@ enum NetTestStage {
#ifdef RED_STATISTICS
#define REDS_MAX_STAT_NODES 100
-#define REDS_STAT_SHM_SIZE (sizeof(RedsStat) + REDS_MAX_STAT_NODES * sizeof(StatNode))
+#define REDS_STAT_SHM_SIZE (sizeof(SpiceStat) + REDS_MAX_STAT_NODES * sizeof(SpiceStatNode))
typedef struct RedsStatValue {
uint32_t value;
@@ -270,7 +270,7 @@ typedef struct RedsState {
#ifdef RED_STATISTICS
char *stat_shm_name;
- RedsStat *stat;
+ SpiceStat *stat;
pthread_mutex_t stat_lock;
RedsStatValue roundtrip_stat;
VDObjectRef ping_timer;
@@ -300,8 +300,8 @@ typedef struct AsyncRead {
typedef struct RedLinkInfo {
RedsStreamContext *peer;
AsyncRead asyc_read;
- RedLinkHeader link_header;
- RedLinkMess *link_mess;
+ SpiceLinkHeader link_header;
+ SpiceLinkMess *link_mess;
int mess_pos;
TicketInfo tiTicketing;
} RedLinkInfo;
@@ -317,7 +317,7 @@ struct __attribute__ ((__packed__)) VDIPortBuf {
typedef struct __attribute__ ((__packed__)) VDAgentExtBuf {
VDIPortBuf base;
- uint8_t buf[RED_AGENT_MAX_DATA_SIZE];
+ uint8_t buf[SPICE_AGENT_MAX_DATA_SIZE];
VDIChunkHeader migrate_overflow;
} VDAgentExtBuf;
@@ -352,8 +352,8 @@ struct ChannelSecurityOptions {
typedef struct PingItem {
RedsOutItem base;
- RedDataHeader header;
- RedPing ping;
+ SpiceDataHeader header;
+ SpiceMsgPing ping;
int size;
} PingItem;
@@ -617,11 +617,11 @@ static struct iovec *reds_iovec_skip(struct iovec vec[], int skip, int *vec_size
static void print_stat_tree(uint32_t node_index, int depth)
{
- StatNode *node = &reds->stat->nodes[node_index];
+ SpiceStatNode *node = &reds->stat->nodes[node_index];
- if ((node->flags & STAT_NODE_MASK_SHOW) == STAT_NODE_MASK_SHOW) {
+ if ((node->flags & SPICE_STAT_NODE_MASK_SHOW) == SPICE_STAT_NODE_MASK_SHOW) {
core->term_printf(core, "%*s%s", depth * STAT_TAB_LEN, "", node->name);
- if (node->flags & STAT_NODE_FLAG_VALUE) {
+ if (node->flags & SPICE_STAT_NODE_FLAG_VALUE) {
core->term_printf(core, ":%*s%llu\n",
(STAT_VALUE_TABS - depth) * STAT_TAB_LEN - strlen(node->name) - 1, "",
node->value);
@@ -645,12 +645,12 @@ static void do_info_statistics()
static void do_reset_statistics()
{
- StatNode *node;
+ SpiceStatNode *node;
int i;
for (i = 0; i <= REDS_MAX_STAT_NODES; i++) {
node = &reds->stat->nodes[i];
- if (node->flags & STAT_NODE_FLAG_VALUE) {
+ if (node->flags & SPICE_STAT_NODE_FLAG_VALUE) {
node->value = 0;
}
}
@@ -668,11 +668,11 @@ static void do_reset_statistics_2(const VDICmdArg* args)
void insert_stat_node(StatNodeRef parent, StatNodeRef ref)
{
- StatNode *node = &reds->stat->nodes[ref];
+ SpiceStatNode *node = &reds->stat->nodes[ref];
uint32_t pos = INVALID_STAT_REF;
uint32_t node_index;
uint32_t *head;
- StatNode *n;
+ SpiceStatNode *n;
node->first_child_index = INVALID_STAT_REF;
head = (parent == INVALID_STAT_REF ? &reds->stat->root_index :
@@ -696,7 +696,7 @@ void insert_stat_node(StatNodeRef parent, StatNodeRef ref)
StatNodeRef stat_add_node(StatNodeRef parent, const char *name, int visible)
{
StatNodeRef ref;
- StatNode *node;
+ SpiceStatNode *node;
ASSERT(name && strlen(name) > 0);
if (strlen(name) >= sizeof(node->name)) {
@@ -722,23 +722,23 @@ StatNodeRef stat_add_node(StatNodeRef parent, const char *name, int visible)
reds->stat->num_of_nodes++;
for (ref = 0; ref <= REDS_MAX_STAT_NODES; ref++) {
node = &reds->stat->nodes[ref];
- if (!(node->flags & STAT_NODE_FLAG_ENABLED)) {
+ if (!(node->flags & SPICE_STAT_NODE_FLAG_ENABLED)) {
break;
}
}
- ASSERT(!(node->flags & STAT_NODE_FLAG_ENABLED));
+ ASSERT(!(node->flags & SPICE_STAT_NODE_FLAG_ENABLED));
node->value = 0;
- node->flags = STAT_NODE_FLAG_ENABLED | (visible ? STAT_NODE_FLAG_VISIBLE : 0);
+ node->flags = SPICE_STAT_NODE_FLAG_ENABLED | (visible ? SPICE_STAT_NODE_FLAG_VISIBLE : 0);
strncpy(node->name, name, sizeof(node->name));
insert_stat_node(parent, ref);
pthread_mutex_unlock(&reds->stat_lock);
return ref;
}
-void stat_remove(StatNode *node)
+void stat_remove(SpiceStatNode *node)
{
pthread_mutex_lock(&reds->stat_lock);
- node->flags &= ~STAT_NODE_FLAG_ENABLED;
+ node->flags &= ~SPICE_STAT_NODE_FLAG_ENABLED;
reds->stat->generation++;
reds->stat->num_of_nodes--;
pthread_mutex_unlock(&reds->stat_lock);
@@ -752,19 +752,19 @@ void stat_remove_node(StatNodeRef ref)
uint64_t *stat_add_counter(StatNodeRef parent, const char *name, int visible)
{
StatNodeRef ref = stat_add_node(parent, name, visible);
- StatNode *node;
+ SpiceStatNode *node;
if (ref == INVALID_STAT_REF) {
return NULL;
}
node = &reds->stat->nodes[ref];
- node->flags |= STAT_NODE_FLAG_VALUE;
+ node->flags |= SPICE_STAT_NODE_FLAG_VALUE;
return &node->value;
}
void stat_remove_counter(uint64_t *counter)
{
- stat_remove((StatNode *)(counter - offsetof(StatNode, value)));
+ stat_remove((SpiceStatNode *)(counter - offsetof(SpiceStatNode, value)));
}
static void reds_update_stat_value(RedsStatValue* stat_value, uint32_t value)
@@ -926,7 +926,7 @@ static int handle_incoming(RedsStreamContext *peer, IncomingHandler *handler)
uint8_t *buf = handler->buf;
uint32_t pos = handler->end_pos;
uint8_t *end = buf + pos;
- RedDataHeader *header;
+ SpiceDataHeader *header;
int n;
n = peer->cb_read(peer->ctx, buf + pos, RECIVE_BUF_SIZE - pos);
if (n <= 0) {
@@ -947,9 +947,9 @@ static int handle_incoming(RedsStreamContext *peer, IncomingHandler *handler)
} else {
pos += n;
end = buf + pos;
- while (buf + sizeof(RedDataHeader) <= end &&
- buf + sizeof(RedDataHeader) + (header = (RedDataHeader *)buf)->size <= end) {
- buf += sizeof(RedDataHeader) + header->size;
+ while (buf + sizeof(SpiceDataHeader) <= end &&
+ buf + sizeof(SpiceDataHeader) + (header = (SpiceDataHeader *)buf)->size <= end) {
+ buf += sizeof(SpiceDataHeader) + header->size;
handler->handle_message(handler->opaque, header);
if (handler->shut) {
@@ -1036,7 +1036,7 @@ static int outgoing_write(RedsStreamContext *peer, OutgoingHandler *handler, voi
typedef struct SimpleOutItem {
RedsOutItem base;
- RedDataHeader header;
+ SpiceDataHeader header;
uint8_t data[0];
} SimpleOutItem;
@@ -1087,19 +1087,19 @@ static void reds_push_pipe_item(RedsOutItem *item)
static void reds_send_channels()
{
- RedChannels* channels_info;
+ SpiceMsgChannels* channels_info;
SimpleOutItem *item;
int message_size;
Channel *channel;
int i;
- message_size = sizeof(RedChannels) + reds->num_of_channels * sizeof(RedChannelInit);
- if (!(item = new_simple_out_item(RED_CHANNELS_LIST, message_size))) {
+ message_size = sizeof(SpiceMsgChannels) + reds->num_of_channels * sizeof(SpiceChannelId);
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_CHANNELS_LIST, message_size))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- channels_info = (RedChannels *)item->data;
+ channels_info = (SpiceMsgChannels *)item->data;
channels_info->num_of_channels = reds->num_of_channels;
channel = reds->channels;
@@ -1151,7 +1151,7 @@ static int send_ping(int size)
item->base.release = reds_free_ping_item;
item->header.serial = ++reds->serial;
- item->header.type = RED_PING;
+ item->header.type = SPICE_MSG_PING;
item->header.size = sizeof(item->ping) + size;
item->header.sub_list = 0;
@@ -1237,22 +1237,22 @@ static void do_info_rtt_client()
static void reds_send_mouse_mode()
{
- RedMouseMode *mouse_mode;
+ SpiceMsgMainMouseMode *mouse_mode;
SimpleOutItem *item;
if (!reds->peer) {
return;
}
- if (!(item = new_simple_out_item(RED_MOUSE_MODE, sizeof(RedMouseMode)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_MOUSE_MODE, sizeof(SpiceMsgMainMouseMode)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- mouse_mode = (RedMouseMode *)item->data;
- mouse_mode->supported_modes = RED_MOUSE_MODE_SERVER;
+ mouse_mode = (SpiceMsgMainMouseMode *)item->data;
+ mouse_mode->supported_modes = SPICE_MOUSE_MODE_SERVER;
if (reds->is_client_mouse_allowed) {
- mouse_mode->supported_modes |= RED_MOUSE_MODE_CLIENT;
+ mouse_mode->supported_modes |= SPICE_MOUSE_MODE_CLIENT;
}
mouse_mode->current_mode = reds->mouse_mode;
reds_push_pipe_item(&item->base);
@@ -1280,8 +1280,8 @@ static void reds_update_mouse_mode()
return;
}
reds->is_client_mouse_allowed = allowed;
- if (reds->mouse_mode == RED_MOUSE_MODE_CLIENT && !allowed) {
- reds_set_mouse_mode(RED_MOUSE_MODE_SERVER);
+ if (reds->mouse_mode == SPICE_MOUSE_MODE_CLIENT && !allowed) {
+ reds_set_mouse_mode(SPICE_MOUSE_MODE_SERVER);
return;
}
reds_send_mouse_mode();
@@ -1290,7 +1290,7 @@ static void reds_update_mouse_mode()
static void reds_send_agent_connected()
{
SimpleOutItem *item;
- if (!(item = new_simple_out_item(RED_AGENT_CONNECTED, 0))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_AGENT_CONNECTED, 0))) {
PANIC("alloc item failed");
}
reds_push_pipe_item(&item->base);
@@ -1298,14 +1298,14 @@ static void reds_send_agent_connected()
static void reds_send_agent_disconnected()
{
- RedAgentDisconnect *disconnect;
+ SpiceMsgMainAgentDisconnect *disconnect;
SimpleOutItem *item;
- if (!(item = new_simple_out_item(RED_AGENT_DISCONNECTED, sizeof(RedAgentDisconnect)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_AGENT_DISCONNECTED, sizeof(SpiceMsgMainAgentDisconnect)))) {
PANIC("alloc item failed");
}
- disconnect = (RedAgentDisconnect *)item->data;
- disconnect->error_code = RED_ERR_OK;
+ disconnect = (SpiceMsgMainAgentDisconnect *)item->data;
+ disconnect->error_code = SPICE_LINK_ERR_OK;
reds_push_pipe_item(&item->base);
}
@@ -1334,19 +1334,19 @@ static void reds_agent_remove()
static void reds_send_tokens()
{
- RedAgentTokens *tokens;
+ SpiceMsgMainAgentTokens *tokens;
SimpleOutItem *item;
if (!reds->peer) {
return;
}
- if (!(item = new_simple_out_item(RED_AGENT_TOKEN, sizeof(RedAgentTokens)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_AGENT_TOKEN, sizeof(SpiceMsgMainAgentTokens)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- tokens = (RedAgentTokens *)item->data;
+ tokens = (SpiceMsgMainAgentTokens *)item->data;
tokens->num_tokens = reds->agent_state.num_tokens;
reds->agent_state.num_client_tokens += tokens->num_tokens;
ASSERT(reds->agent_state.num_client_tokens <= REDS_AGENT_WINDOW_SIZE);
@@ -1545,7 +1545,7 @@ typedef struct WriteQueueInfo {
typedef struct SendMainMigrateItem {
RedsOutItem base;
- RedDataHeader header;
+ SpiceDataHeader header;
MainMigrateData data;
WriteQueueInfo queue_info[REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES];
} SendMainMigrateItem;
@@ -1562,7 +1562,7 @@ static void main_channel_send_migrate_data_item(RedsOutItem *in_item, struct iov
vec = vec_start;
item->header.serial = ++reds->serial;
- item->header.type = RED_MIGRATE_DATA;
+ item->header.type = SPICE_MSG_MIGRATE_DATA;
item->header.size = sizeof(item->data);
item->header.sub_list = 0;
@@ -1713,7 +1713,7 @@ static int main_channel_restore_vdi_read_state(MainMigrateData *data, uint8_t **
buff = state->current_read_buf = (VDIReadBuf *)ring_item;
buff->len = data->read_buf_len;
n = buff->len - state->recive_len;
- if (buff->len > RED_AGENT_MAX_DATA_SIZE || n > RED_AGENT_MAX_DATA_SIZE) {
+ if (buff->len > SPICE_AGENT_MAX_DATA_SIZE || n > SPICE_AGENT_MAX_DATA_SIZE) {
red_printf("bad read position");
reds_disconnect();
return FALSE;
@@ -1863,23 +1863,23 @@ static void main_channel_recive_migrate_data(MainMigrateData *data, uint8_t *end
ASSERT(state->num_client_tokens + state->num_tokens == REDS_AGENT_WINDOW_SIZE);
}
-static void reds_main_handle_message(void *opaque, RedDataHeader *message)
+static void reds_main_handle_message(void *opaque, SpiceDataHeader *message)
{
switch (message->type) {
- case REDC_AGENT_START: {
- RedcAgentTokens *agent_start;
+ case SPICE_MSGC_MAIN_AGENT_START: {
+ SpiceMsgcMainAgentTokens *agent_start;
red_printf("agent start");
if (!reds->peer) {
return;
}
- agent_start = (RedcAgentTokens *)(message + 1);
+ agent_start = (SpiceMsgcMainAgentTokens *)(message + 1);
reds->agent_state.client_agent_started = TRUE;
reds->agent_state.send_tokens = agent_start->num_tokens;
read_from_vdi_port();
break;
}
- case REDC_AGENT_DATA: {
+ case SPICE_MSGC_MAIN_AGENT_DATA: {
RingItem *ring_item;
VDAgentExtBuf *buf;
@@ -1896,12 +1896,12 @@ static void reds_main_handle_message(void *opaque, RedDataHeader *message)
}
if (!reds->agent_state.client_agent_started) {
- red_printf("REDC_AGENT_DATA race");
+ red_printf("SPICE_MSGC_MAIN_AGENT_DATA race");
add_token();
break;
}
- if (message->size > RED_AGENT_MAX_DATA_SIZE) {
+ if (message->size > SPICE_AGENT_MAX_DATA_SIZE) {
red_printf("invalid agent message");
reds_disconnect();
break;
@@ -1922,53 +1922,53 @@ static void reds_main_handle_message(void *opaque, RedDataHeader *message)
write_to_vdi_port();
break;
}
- case REDC_AGENT_TOKEN: {
- RedcAgentTokens *token;
+ case SPICE_MSGC_MAIN_AGENT_TOKEN: {
+ SpiceMsgcMainAgentTokens *token;
if (!reds->agent_state.client_agent_started) {
- red_printf("REDC_AGENT_TOKEN race");
+ red_printf("SPICE_MSGC_MAIN_AGENT_TOKEN race");
break;
}
- token = (RedcAgentTokens *)(message + 1);
+ token = (SpiceMsgcMainAgentTokens *)(message + 1);
reds->agent_state.send_tokens += token->num_tokens;
read_from_vdi_port();
break;
}
- case REDC_ATTACH_CHANNELS:
+ case SPICE_MSGC_MAIN_ATTACH_CHANNELS:
reds_send_channels();
break;
- case REDC_MIGRATE_CONNECTED:
+ case SPICE_MSGC_MAIN_MIGRATE_CONNECTED:
red_printf("connected");
if (reds->mig_wait_connect) {
reds_mig_cleanup();
}
break;
- case REDC_MIGRATE_CONNECT_ERROR:
+ case SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR:
red_printf("mig connect error");
if (reds->mig_wait_connect) {
reds_mig_cleanup();
}
break;
- case REDC_MOUSE_MODE_REQUEST: {
- switch (((RedcMouseModeRequest *)(message + 1))->mode) {
- case RED_MOUSE_MODE_CLIENT:
+ case SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST: {
+ switch (((SpiceMsgcMainMouseModeRequest *)(message + 1))->mode) {
+ case SPICE_MOUSE_MODE_CLIENT:
if (reds->is_client_mouse_allowed) {
- reds_set_mouse_mode(RED_MOUSE_MODE_CLIENT);
+ reds_set_mouse_mode(SPICE_MOUSE_MODE_CLIENT);
} else {
red_printf("client mouse is disabled");
}
break;
- case RED_MOUSE_MODE_SERVER:
- reds_set_mouse_mode(RED_MOUSE_MODE_SERVER);
+ case SPICE_MOUSE_MODE_SERVER:
+ reds_set_mouse_mode(SPICE_MOUSE_MODE_SERVER);
break;
default:
red_printf("unsupported mouse mode");
}
break;
}
- case REDC_PONG: {
- RedPing *ping = (RedPing *)(message + 1);
+ case SPICE_MSGC_PONG: {
+ SpiceMsgPing *ping = (SpiceMsgPing *)(message + 1);
uint64_t roundtrip;
struct timespec ts;
@@ -2017,16 +2017,16 @@ static void reds_main_handle_message(void *opaque, RedDataHeader *message)
#endif
break;
}
- case REDC_MIGRATE_FLUSH_MARK:
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
main_channel_push_migrate_data_item();
break;
- case REDC_MIGRATE_DATA:
+ case SPICE_MSGC_MIGRATE_DATA:
main_channel_recive_migrate_data((MainMigrateData *)(message + 1),
(uint8_t *)(message + 1) + message->size);
reds->mig_target = FALSE;
while (write_to_vdi_port() || read_from_vdi_port());
break;
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("unexpected type %d", message->type);
@@ -2126,19 +2126,19 @@ static int sync_write(RedsStreamContext *peer, void *in_buf, size_t n)
static int reds_send_link_ack(RedLinkInfo *link)
{
- RedLinkHeader header;
- RedLinkReply ack;
+ SpiceLinkHeader header;
+ SpiceLinkReply ack;
Channel *channel;
BUF_MEM *bmBuf;
BIO *bio;
int ret;
- header.magic = RED_MAGIC;
+ header.magic = SPICE_MAGIC;
header.size = sizeof(ack);
- header.major_version = RED_VERSION_MAJOR;
- header.minor_version = RED_VERSION_MINOR;
+ header.major_version = SPICE_VERSION_MAJOR;
+ header.minor_version = SPICE_VERSION_MINOR;
- ack.error = RED_ERR_OK;
+ ack.error = SPICE_LINK_ERR_OK;
if ((channel = reds_find_channel(link->link_mess->channel_type, 0))) {
ack.num_common_caps = channel->num_common_caps;
@@ -2148,7 +2148,7 @@ static int reds_send_link_ack(RedLinkInfo *link)
ack.num_common_caps = 0;
ack.num_channel_caps = 0;
}
- ack.caps_offset = sizeof(RedLinkReply);
+ ack.caps_offset = sizeof(SpiceLinkReply);
if (!(link->tiTicketing.rsa = RSA_new())) {
red_printf("RSA nes failed");
@@ -2160,7 +2160,7 @@ static int reds_send_link_ack(RedLinkInfo *link)
return FALSE;
}
- RSA_generate_key_ex(link->tiTicketing.rsa, RED_TICKET_KEY_PAIR_LENGTH, link->tiTicketing.bn,
+ RSA_generate_key_ex(link->tiTicketing.rsa, SPICE_TICKET_KEY_PAIR_LENGTH, link->tiTicketing.bn,
NULL);
link->tiTicketing.rsa_size = RSA_size(link->tiTicketing.rsa);
@@ -2181,13 +2181,13 @@ static int reds_send_link_ack(RedLinkInfo *link)
static int reds_send_link_error(RedLinkInfo *link, uint32_t error)
{
- RedLinkHeader header;
- RedLinkReply reply;
+ SpiceLinkHeader header;
+ SpiceLinkReply reply;
- header.magic = RED_MAGIC;
+ header.magic = SPICE_MAGIC;
header.size = sizeof(reply);
- header.major_version = RED_VERSION_MAJOR;
- header.minor_version = RED_VERSION_MINOR;
+ header.major_version = SPICE_VERSION_MAJOR;
+ header.minor_version = SPICE_VERSION_MINOR;
memset(&reply, 0, sizeof(reply));
reply.error = error;
return sync_write(link->peer, &header, sizeof(header)) && sync_write(link->peer, &reply,
@@ -2228,7 +2228,7 @@ static void reds_handle_main_link(RedLinkInfo *link)
reds_disconnect();
if (!link->link_mess->connection_id) {
- reds_send_link_result(link, RED_ERR_OK);
+ reds_send_link_result(link, SPICE_LINK_ERR_OK);
while((connection_id = rand()) == 0);
reds->agent_state.num_tokens = 0;
reds->agent_state.send_tokens = 0;
@@ -2236,11 +2236,11 @@ static void reds_handle_main_link(RedLinkInfo *link)
reds->mig_target = FALSE;
} else {
if (link->link_mess->connection_id != reds->link_id) {
- reds_send_link_result(link, RED_ERR_BAD_CONNECTION_ID);
+ reds_send_link_result(link, SPICE_LINK_ERR_BAD_CONNECTION_ID);
reds_release_link(link);
return;
}
- reds_send_link_result(link, RED_ERR_OK);
+ reds_send_link_result(link, SPICE_LINK_ERR_OK);
connection_id = link->link_mess->connection_id;
reds->mig_target = TRUE;
}
@@ -2270,20 +2270,20 @@ static void reds_handle_main_link(RedLinkInfo *link)
if (!reds->mig_target) {
SimpleOutItem *item;
- RedInit *init;
+ SpiceMsgMainInit *init;
- if (!(item = new_simple_out_item(RED_INIT, sizeof(RedInit)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_INIT, sizeof(SpiceMsgMainInit)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- init = (RedInit *)item->data;
+ init = (SpiceMsgMainInit *)item->data;
init->session_id = connection_id;
init->display_channels_hint = red_dispatcher_count();
init->current_mouse_mode = reds->mouse_mode;
- init->supported_mouse_modes = RED_MOUSE_MODE_SERVER;
+ init->supported_mouse_modes = SPICE_MOUSE_MODE_SERVER;
if (reds->is_client_mouse_allowed) {
- init->supported_mouse_modes |= RED_MOUSE_MODE_CLIENT;
+ init->supported_mouse_modes |= SPICE_MOUSE_MODE_CLIENT;
}
init->agent_connected = !!vdagent;
init->agent_tokens = REDS_AGENT_WINDOW_SIZE;
@@ -2296,14 +2296,14 @@ static void reds_handle_main_link(RedLinkInfo *link)
}
#define RED_MOUSE_STATE_TO_LOCAL(state) \
- ((state & REDC_LBUTTON_MASK) | \
- ((state & REDC_MBUTTON_MASK) << 1) | \
- ((state & REDC_RBUTTON_MASK) >> 1))
+ ((state & SPICE_MOUSE_BUTTON_MASK_LEFT) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_MIDDLE) << 1) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_RIGHT) >> 1))
#define RED_MOUSE_BUTTON_STATE_TO_AGENT(state) \
- (((state & REDC_LBUTTON_MASK) ? VD_AGENT_LBUTTON_MASK : 0) | \
- ((state & REDC_MBUTTON_MASK) ? VD_AGENT_MBUTTON_MASK : 0) | \
- ((state & REDC_RBUTTON_MASK) ? VD_AGENT_RBUTTON_MASK : 0))
+ (((state & SPICE_MOUSE_BUTTON_MASK_LEFT) ? VD_AGENT_LBUTTON_MASK : 0) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_MIDDLE) ? VD_AGENT_MBUTTON_MASK : 0) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_RIGHT) ? VD_AGENT_RBUTTON_MASK : 0))
static void activate_modifiers_watch()
{
@@ -2318,21 +2318,21 @@ static void push_key_scan(uint8_t scan)
keyboard->push_scan_freg(keyboard, scan);
}
-static void inputs_handle_input(void *opaque, RedDataHeader *header)
+static void inputs_handle_input(void *opaque, SpiceDataHeader *header)
{
InputsState *state = (InputsState *)opaque;
uint8_t *buf = (uint8_t *)(header + 1);
switch (header->type) {
- case REDC_INPUTS_KEY_DOWN: {
- RedcKeyDown *key_up = (RedcKeyDown *)buf;
+ case SPICE_MSGC_INPUTS_KEY_DOWN: {
+ SpiceMsgcKeyDown *key_up = (SpiceMsgcKeyDown *)buf;
if (key_up->code == CAPS_LOCK_SCAN_CODE || key_up->code == NUM_LOCK_SCAN_CODE ||
key_up->code == SCROLL_LOCK_SCAN_CODE) {
activate_modifiers_watch();
}
}
- case REDC_INPUTS_KEY_UP: {
- RedcKeyDown *key_down = (RedcKeyDown *)buf;
+ case SPICE_MSGC_INPUTS_KEY_UP: {
+ SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf;
uint8_t *now = (uint8_t *)&key_down->code;
uint8_t *end = now + sizeof(key_down->code);
for (; now < end && *now; now++) {
@@ -2340,45 +2340,45 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
}
break;
}
- case REDC_INPUTS_MOUSE_MOTION: {
- RedcMouseMotion *mouse_motion = (RedcMouseMotion *)buf;
+ case SPICE_MSGC_INPUTS_MOUSE_MOTION: {
+ SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *)buf;
- if (++state->motion_count % RED_MOTION_ACK_BUNCH == 0) {
- RedDataHeader header;
+ if (++state->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0) {
+ SpiceDataHeader header;
header.serial = ++state->serial;
- header.type = RED_INPUTS_MOUSE_MOTION_ACK;
+ header.type = SPICE_MSG_INPUTS_MOUSE_MOTION_ACK;
header.size = 0;
header.sub_list = 0;
- if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(RedDataHeader))
+ if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(SpiceDataHeader))
!= OUTGOING_OK) {
red_printf("motion ack failed");
reds_disconnect();
}
}
- if (mouse && reds->mouse_mode == RED_MOUSE_MODE_SERVER) {
+ if (mouse && reds->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
mouse->moution(mouse, mouse_motion->dx, mouse_motion->dy, 0,
RED_MOUSE_STATE_TO_LOCAL(mouse_motion->buttons_state));
}
break;
}
- case REDC_INPUTS_MOUSE_POSITION: {
- RedcMousePosition *pos = (RedcMousePosition *)buf;
+ case SPICE_MSGC_INPUTS_MOUSE_POSITION: {
+ SpiceMsgcMousePosition *pos = (SpiceMsgcMousePosition *)buf;
- if (++state->motion_count % RED_MOTION_ACK_BUNCH == 0) {
- RedDataHeader header;
+ if (++state->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0) {
+ SpiceDataHeader header;
header.serial = ++state->serial;
- header.type = RED_INPUTS_MOUSE_MOTION_ACK;
+ header.type = SPICE_MSG_INPUTS_MOUSE_MOTION_ACK;
header.size = 0;
header.sub_list = 0;
- if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(RedDataHeader))
+ if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(SpiceDataHeader))
!= OUTGOING_OK) {
red_printf("position ack failed");
reds_disconnect();
}
}
- if (reds->mouse_mode != RED_MOUSE_MODE_CLIENT) {
+ if (reds->mouse_mode != SPICE_MOUSE_MODE_CLIENT) {
break;
}
ASSERT((agent_mouse && vdagent) || tablet);
@@ -2394,15 +2394,15 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
reds_handle_agent_mouse_event();
break;
}
- case REDC_INPUTS_MOUSE_PRESS: {
- RedcMousePress *mouse_press = (RedcMousePress *)buf;
+ case SPICE_MSGC_INPUTS_MOUSE_PRESS: {
+ SpiceMsgcMousePress *mouse_press = (SpiceMsgcMousePress *)buf;
int dz = 0;
- if (mouse_press->button == REDC_MOUSE_UBUTTON) {
+ if (mouse_press->button == SPICE_MOUSE_BUTTON_UP) {
dz = -1;
- } else if (mouse_press->button == REDC_MOUSE_DBUTTON) {
+ } else if (mouse_press->button == SPICE_MOUSE_BUTTON_DOWN) {
dz = 1;
}
- if (reds->mouse_mode == RED_MOUSE_MODE_CLIENT) {
+ if (reds->mouse_mode == SPICE_MOUSE_MODE_CLIENT) {
if (agent_mouse && vdagent) {
reds->inputs_state->mouse_state.buttons =
RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_press->buttons_state) |
@@ -2417,9 +2417,9 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
}
break;
}
- case REDC_INPUTS_MOUSE_RELEASE: {
- RedcMouseRelease *mouse_release = (RedcMouseRelease *)buf;
- if (reds->mouse_mode == RED_MOUSE_MODE_CLIENT) {
+ case SPICE_MSGC_INPUTS_MOUSE_RELEASE: {
+ SpiceMsgcMouseRelease *mouse_release = (SpiceMsgcMouseRelease *)buf;
+ if (reds->mouse_mode == SPICE_MOUSE_MODE_CLIENT) {
if (agent_mouse && vdagent) {
reds->inputs_state->mouse_state.buttons =
RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_release->buttons_state);
@@ -2432,29 +2432,29 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
}
break;
}
- case REDC_INPUTS_KEY_MODIFAIERS: {
- RedcKeyModifiers *modifiers = (RedcKeyModifiers *)buf;
+ case SPICE_MSGC_INPUTS_KEY_MODIFIERS: {
+ SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *)buf;
if (!keyboard) {
break;
}
uint8_t leds = keyboard->get_leds(keyboard);
- if ((modifiers->modifiers & RED_SCROLL_LOCK_MODIFIER) !=
- (leds & RED_SCROLL_LOCK_MODIFIER)) {
+ if ((modifiers->modifiers & SPICE_SCROLL_LOCK_MODIFIER) !=
+ (leds & SPICE_SCROLL_LOCK_MODIFIER)) {
push_key_scan(SCROLL_LOCK_SCAN_CODE);
push_key_scan(SCROLL_LOCK_SCAN_CODE | 0x80);
}
- if ((modifiers->modifiers & RED_NUM_LOCK_MODIFIER) != (leds & RED_NUM_LOCK_MODIFIER)) {
+ if ((modifiers->modifiers & SPICE_NUM_LOCK_MODIFIER) != (leds & SPICE_NUM_LOCK_MODIFIER)) {
push_key_scan(NUM_LOCK_SCAN_CODE);
push_key_scan(NUM_LOCK_SCAN_CODE | 0x80);
}
- if ((modifiers->modifiers & RED_CAPS_LOCK_MODIFIER) != (leds & RED_CAPS_LOCK_MODIFIER)) {
+ if ((modifiers->modifiers & SPICE_CAPS_LOCK_MODIFIER) != (leds & SPICE_CAPS_LOCK_MODIFIER)) {
push_key_scan(CAPS_LOCK_SCAN_CODE);
push_key_scan(CAPS_LOCK_SCAN_CODE | 0x80);
}
activate_modifiers_watch();
break;
}
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("unexpected type %d", header->type);
@@ -2522,12 +2522,12 @@ static void inputs_shutdown(Channel *channel)
static void inputs_migrate(Channel *channel)
{
InputsState *state = (InputsState *)channel->data;
- RedDataHeader header;
- RedMigrate migrate;
+ SpiceDataHeader header;
+ SpiceMsgMigrate migrate;
red_printf("");
header.serial = ++state->serial;
- header.type = RED_MIGRATE;
+ header.type = SPICE_MSG_MIGRATE;
header.size = sizeof(migrate);
header.sub_list = 0;
migrate.flags = 0;
@@ -2600,17 +2600,17 @@ static void inputs_link(Channel *channel, RedsStreamContext *peer, int migration
reds->inputs_state = inputs_state;
core->set_file_handlers(core, peer->socket, inputs_read, NULL, inputs_state);
- RedDataHeader header;
- RedInputsInit inputs_init;
+ SpiceDataHeader header;
+ SpiceMsgInputsInit inputs_init;
header.serial = ++inputs_state->serial;
- header.type = RED_INPUTS_INIT;
- header.size = sizeof(RedInputsInit);
+ header.type = SPICE_MSG_INPUTS_INIT;
+ header.size = sizeof(SpiceMsgInputsInit);
header.sub_list = 0;
inputs_init.keyboard_modifiers = keyboard ? keyboard->get_leds(keyboard) : 0;
if (outgoing_write(inputs_state->peer, &inputs_state->out_handler, &header,
- sizeof(RedDataHeader)) != OUTGOING_OK ||
+ sizeof(SpiceDataHeader)) != OUTGOING_OK ||
outgoing_write(inputs_state->peer, &inputs_state->out_handler, &inputs_init,
- sizeof(RedInputsInit)) != OUTGOING_OK) {
+ sizeof(SpiceMsgInputsInit)) != OUTGOING_OK) {
red_printf("failed to send modifiers state");
reds_disconnect();
}
@@ -2618,24 +2618,24 @@ static void inputs_link(Channel *channel, RedsStreamContext *peer, int migration
static void reds_send_keyborad_modifiers(uint8_t modifiers)
{
- Channel *channel = reds_find_channel(RED_CHANNEL_INPUTS, 0);
+ Channel *channel = reds_find_channel(SPICE_CHANNEL_INPUTS, 0);
InputsState *state;
if (!channel || !(state = (InputsState *)channel->data)) {
return;
}
ASSERT(state->peer);
- RedDataHeader header;
- RedKeyModifiers key_modifiers;
+ SpiceDataHeader header;
+ SpiceMsgInputsKeyModifiers key_modifiers;
header.serial = ++state->serial;
- header.type = RED_INPUTS_KEY_MODIFAIERS;
- header.size = sizeof(RedKeyModifiers);
+ header.type = SPICE_MSG_INPUTS_KEY_MODIFIERS;
+ header.size = sizeof(SpiceMsgInputsKeyModifiers);
header.sub_list = 0;
key_modifiers.modifiers = modifiers;
- if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(RedDataHeader))
+ if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(SpiceDataHeader))
!= OUTGOING_OK ||
- outgoing_write(state->peer, &state->out_handler, &key_modifiers, sizeof(RedKeyModifiers))
+ outgoing_write(state->peer, &state->out_handler, &key_modifiers, sizeof(SpiceMsgInputsKeyModifiers))
!= OUTGOING_OK) {
red_printf("failed to send modifiers state");
reds_disconnect();
@@ -2666,7 +2666,7 @@ static void inputs_init()
red_error("alloc inputs chanel failed");
}
memset(channel, 0, sizeof(Channel));
- channel->type = RED_CHANNEL_INPUTS;
+ channel->type = SPICE_CHANNEL_INPUTS;
channel->link = inputs_link;
channel->shutdown = inputs_shutdown;
channel->migrate = inputs_migrate;
@@ -2677,45 +2677,45 @@ static void reds_handle_other_links(RedLinkInfo *link)
{
Channel *channel;
RedsStreamContext *peer;
- RedLinkMess *link_mess;
+ SpiceLinkMess *link_mess;
uint32_t *caps;
link_mess = link->link_mess;
if (!reds->link_id || reds->link_id != link_mess->connection_id) {
- reds_send_link_result(link, RED_ERR_BAD_CONNECTION_ID);
+ reds_send_link_result(link, SPICE_LINK_ERR_BAD_CONNECTION_ID);
reds_release_link(link);
return;
}
if (!(channel = reds_find_channel(link_mess->channel_type,
link_mess->channel_id))) {
- reds_send_link_result(link, RED_ERR_CHANNEL_NOT_AVAILABLE);
+ reds_send_link_result(link, SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE);
reds_release_link(link);
return;
}
- reds_send_link_result(link, RED_ERR_OK);
+ reds_send_link_result(link, SPICE_LINK_ERR_OK);
reds_show_new_channel(link);
- if (link_mess->channel_type == RED_CHANNEL_INPUTS && !link->peer->ssl) {
+ if (link_mess->channel_type == SPICE_CHANNEL_INPUTS && !link->peer->ssl) {
SimpleOutItem *item;
- RedNotify *notify;
+ SpiceMsgNotify *notify;
char *mess = "keybord channel is unsecure";
const int mess_len = strlen(mess);
LOG_MESSAGE(VD_LOG_WARN, "%s", mess);
- if (!(item = new_simple_out_item(RED_NOTIFY, sizeof(RedNotify) + mess_len + 1))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_NOTIFY, sizeof(SpiceMsgNotify) + mess_len + 1))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- notify = (RedNotify *)item->data;
+ notify = (SpiceMsgNotify *)item->data;
notify->time_stamp = get_time_stamp();
- notify->severty = RED_NOTIFY_SEVERITY_WARN;
- notify->visibilty = RED_NOTIFY_VISIBILITY_HIGH;
- notify->what = RED_WARN_GENERAL;
+ notify->severty = SPICE_NOTIFY_SEVERITY_WARN;
+ notify->visibilty = SPICE_NOTIFY_VISIBILITY_HIGH;
+ notify->what = SPICE_WARN_GENERAL;
notify->message_len = mess_len;
memcpy(notify->message, mess, mess_len + 1);
reds_push_pipe_item(&item->base);
@@ -2733,7 +2733,7 @@ static void reds_handle_other_links(RedLinkInfo *link)
static void reds_handle_ticket(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
- char password[RED_MAX_PASSWORD_LENGTH];
+ char password[SPICE_MAX_PASSWORD_LENGTH];
time_t ltime;
//todo: use monotonic time
@@ -2747,21 +2747,21 @@ static void reds_handle_ticket(void *opaque)
char *actual_sever_pass = link->link_mess->connection_id ? reds->taTicket.password :
taTicket.password;
if (strlen(actual_sever_pass) == 0) {
- reds_send_link_result(link, RED_ERR_PERMISSION_DENIED);
+ reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
red_printf("Ticketing is enabled, but no password is set. "
"please set a ticket first");
reds_release_link(link);
return;
}
- if (expired || strncmp(password, actual_sever_pass, RED_MAX_PASSWORD_LENGTH) != 0) {
- reds_send_link_result(link, RED_ERR_PERMISSION_DENIED);
+ if (expired || strncmp(password, actual_sever_pass, SPICE_MAX_PASSWORD_LENGTH) != 0) {
+ reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
LOG_MESSAGE(VD_LOG_WARN, "bad connection password or time expired");
reds_release_link(link);
return;
}
}
- if (link->link_mess->channel_type == RED_CHANNEL_MAIN) {
+ if (link->link_mess->channel_type == SPICE_CHANNEL_MAIN) {
reds_handle_main_link(link);
} else {
reds_handle_other_links(link);
@@ -2829,14 +2829,14 @@ static int reds_security_check(RedLinkInfo *link)
static void reds_handle_read_link_done(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
- RedLinkMess *link_mess = link->link_mess;
+ SpiceLinkMess *link_mess = link->link_mess;
AsyncRead *obj = &link->asyc_read;
uint32_t num_caps = link_mess->num_common_caps + link_mess->num_channel_caps;
if (num_caps && (num_caps * sizeof(uint32_t) + link_mess->caps_offset >
link->link_header.size ||
link_mess->caps_offset < sizeof(*link_mess))) {
- reds_send_link_error(link, RED_ERR_INVALID_DATA);
+ reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
reds_release_link(link);
return;
}
@@ -2846,12 +2846,12 @@ static void reds_handle_read_link_done(void *opaque)
LOG_MESSAGE(VD_LOG_INFO, "channels of type %d should connect only over "
"a non secure link", link_mess->channel_type);
red_printf("spice channels %d should not be encrypted", link_mess->channel_type);
- reds_send_link_error(link, RED_ERR_NEED_UNSECURED);
+ reds_send_link_error(link, SPICE_LINK_ERR_NEED_UNSECURED);
} else {
LOG_MESSAGE(VD_LOG_INFO, "channels of type %d should connect only over "
"a secure link", link_mess->channel_type);
red_printf("spice channels %d should be encrypted", link_mess->channel_type);
- reds_send_link_error(link, RED_ERR_NEED_SECURED);
+ reds_send_link_error(link, SPICE_LINK_ERR_NEED_SECURED);
}
reds_release_link(link);
return;
@@ -2885,25 +2885,25 @@ static void reds_handle_link_error(void *opaque, int err)
static void reds_handle_read_header_done(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
- RedLinkHeader *header = &link->link_header;
+ SpiceLinkHeader *header = &link->link_header;
AsyncRead *obj = &link->asyc_read;
- if (header->magic != RED_MAGIC) {
- reds_send_link_error(link, RED_ERR_INVALID_MAGIC);
+ if (header->magic != SPICE_MAGIC) {
+ reds_send_link_error(link, SPICE_LINK_ERR_INVALID_MAGIC);
LOG_MESSAGE(VD_LOG_ERROR, "bad magic %u", header->magic);
reds_release_link(link);
return;
}
- if (header->major_version != RED_VERSION_MAJOR) {
+ if (header->major_version != SPICE_VERSION_MAJOR) {
if (header->major_version > 0) {
- reds_send_link_error(link, RED_ERR_VERSION_MISMATCH);
+ reds_send_link_error(link, SPICE_LINK_ERR_VERSION_MISMATCH);
}
LOG_MESSAGE(VD_LOG_INFO, "version mismatch client %u.%u server %u.%u",
header->major_version,
header->minor_version,
- RED_VERSION_MAJOR,
- RED_VERSION_MINOR);
+ SPICE_VERSION_MAJOR,
+ SPICE_VERSION_MINOR);
red_printf("version mismatch");
reds_release_link(link);
@@ -2912,8 +2912,8 @@ static void reds_handle_read_header_done(void *opaque)
reds->peer_minor_version = header->minor_version;
- if (header->size < sizeof(RedLinkMess)) {
- reds_send_link_error(link, RED_ERR_INVALID_DATA);
+ if (header->size < sizeof(SpiceLinkMess)) {
+ reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
red_printf("bad size %u", header->size);
reds_release_link(link);
return;
@@ -2937,7 +2937,7 @@ static void reds_handle_new_link(RedLinkInfo *link)
obj->opaque = link;
obj->peer = link->peer;
obj->now = (uint8_t *)&link->link_header;
- obj->end = (uint8_t *)((RedLinkHeader *)&link->link_header + 1);
+ obj->end = (uint8_t *)((SpiceLinkHeader *)&link->link_header + 1);
obj->active_file_handlers = FALSE;
obj->done = reds_handle_read_header_done;
obj->error = reds_handle_link_error;
@@ -3853,27 +3853,27 @@ static int set_channels_security(const char *channels, uint32_t security)
break;
case CHANNEL_NAME_MAIN:
specific++;
- set_one_channel_security(RED_CHANNEL_MAIN, security);
+ set_one_channel_security(SPICE_CHANNEL_MAIN, security);
break;
case CHANNEL_NAME_DISPLAY:
specific++;
- set_one_channel_security(RED_CHANNEL_DISPLAY, security);
+ set_one_channel_security(SPICE_CHANNEL_DISPLAY, security);
break;
case CHANNEL_NAME_INPUTS:
specific++;
- set_one_channel_security(RED_CHANNEL_INPUTS, security);
+ set_one_channel_security(SPICE_CHANNEL_INPUTS, security);
break;
case CHANNEL_NAME_CURSOR:
specific++;
- set_one_channel_security(RED_CHANNEL_CURSOR, security);
+ set_one_channel_security(SPICE_CHANNEL_CURSOR, security);
break;
case CHANNEL_NAME_PLAYBACK:
specific++;
- set_one_channel_security(RED_CHANNEL_PLAYBACK, security);
+ set_one_channel_security(SPICE_CHANNEL_PLAYBACK, security);
break;
case CHANNEL_NAME_RECORD:
specific++;
- set_one_channel_security(RED_CHANNEL_RECORD, security);
+ set_one_channel_security(SPICE_CHANNEL_RECORD, security);
break;
default:
goto error;
@@ -4172,7 +4172,7 @@ typedef struct RedsMigSpice {
RedsMigWrite write;
RedsMigRead read;
- char pub_key[RED_TICKET_PUBKEY_BYTES];
+ char pub_key[SPICE_TICKET_PUBKEY_BYTES];
uint32_t mig_key;
char *local_args;
@@ -4294,27 +4294,27 @@ static void reds_mig_read(void *data)
static void reds_mig_continue(RedsMigSpice *s)
{
- RedMigrationBegin *migrate;
+ SpiceMsgMainMigrationBegin *migrate;
SimpleOutItem *item;
int host_len;
red_printf("");
core->set_file_handlers(core, s->fd, NULL, NULL, NULL);
host_len = strlen(s->host) + 1;
- item = new_simple_out_item(RED_MIGRATE_BEGIN,
- sizeof(RedMigrationBegin) + host_len + s->cert_pub_key_len);
+ item = new_simple_out_item(SPICE_MSG_MAIN_MIGRATE_BEGIN,
+ sizeof(SpiceMsgMainMigrationBegin) + host_len + s->cert_pub_key_len);
if (!(item)) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- migrate = (RedMigrationBegin *)item->data;
+ migrate = (SpiceMsgMainMigrationBegin *)item->data;
migrate->port = s->port;
migrate->sport = s->sport;
- migrate->host_offset = sizeof(RedMigrationBegin);
+ migrate->host_offset = sizeof(SpiceMsgMainMigrationBegin);
migrate->host_size = host_len;
migrate->pub_key_type = s->cert_pub_key_type;
- migrate->pub_key_offset = sizeof(RedMigrationBegin) + host_len;
+ migrate->pub_key_offset = sizeof(SpiceMsgMainMigrationBegin) + host_len;
migrate->pub_key_size = s->cert_pub_key_len;
memcpy((uint8_t*)(migrate) + migrate->host_offset , s->host, host_len);
memcpy((uint8_t*)(migrate) + migrate->pub_key_offset, s->cert_pub_key, s->cert_pub_key_len);
@@ -4359,7 +4359,7 @@ static void reds_mig_send_ticket(RedsMigSpice *s)
bio_key = BIO_new(BIO_s_mem());
if (bio_key != NULL) {
- BIO_write(bio_key, s->read.buf, RED_TICKET_PUBKEY_BYTES);
+ BIO_write(bio_key, s->read.buf, SPICE_TICKET_PUBKEY_BYTES);
pubkey = d2i_PUBKEY_bio(bio_key, NULL);
rsa = pubkey->pkey.rsa;
rsa_size = RSA_size(rsa);
@@ -4393,7 +4393,7 @@ static void reds_mig_receive_cert_public_key(RedsMigSpice *s)
memcpy(s->cert_pub_key, s->read.buf, s->cert_pub_key_len);
- s->read.size = RED_TICKET_PUBKEY_BYTES;
+ s->read.size = SPICE_TICKET_PUBKEY_BYTES;
s->read.end_pos = 0;
s->read.handle_data = reds_mig_send_ticket;
@@ -4418,7 +4418,7 @@ static void reds_mig_receive_cert_public_key_info(RedsMigSpice *s)
s->read.handle_data = reds_mig_receive_cert_public_key;
} else {
s->cert_pub_key = NULL;
- s->read.size = RED_TICKET_PUBKEY_BYTES;
+ s->read.size = SPICE_TICKET_PUBKEY_BYTES;
s->read.end_pos = 0;
s->read.handle_data = reds_mig_send_ticket;
}
@@ -4514,9 +4514,9 @@ static void reds_mig_started(void *opaque, const char *in_args)
goto error;
}
- if ((RED_VERSION_MAJOR == 1) && (reds->peer_minor_version < 2)) {
+ if ((SPICE_VERSION_MAJOR == 1) && (reds->peer_minor_version < 2)) {
red_printf("minor version mismatch client %u server %u",
- reds->peer_minor_version, RED_VERSION_MINOR);
+ reds->peer_minor_version, SPICE_VERSION_MINOR);
goto error;
}
@@ -4633,18 +4633,18 @@ static void reds_mig_finished(void *opaque, int completed)
if (completed) {
Channel *channel;
- RedMigrate *migrate;
+ SpiceMsgMigrate *migrate;
reds->mig_wait_disconnect = TRUE;
core->arm_timer(core, reds->mig_timer, MIGRATE_TIMEOUT);
- if (!(item = new_simple_out_item(RED_MIGRATE, sizeof(RedMigrate)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MIGRATE, sizeof(SpiceMsgMigrate)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- migrate = (RedMigrate *)item->data;
- migrate->flags = RED_MIGRATE_NEED_FLUSH | RED_MIGRATE_NEED_DATA_TRANSFER;
+ migrate = (SpiceMsgMigrate *)item->data;
+ migrate->flags = SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER;
reds_push_pipe_item(&item->base);
channel = reds->channels;
while (channel) {
@@ -4652,7 +4652,7 @@ static void reds_mig_finished(void *opaque, int completed)
channel = channel->next;
}
} else {
- if (!(item = new_simple_out_item(RED_MIGRATE_CANCEL, 0))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_MIGRATE_CANCEL, 0))) {
red_printf("alloc item failed");
reds_disconnect();
return;
@@ -4733,7 +4733,7 @@ static void reds_mig_send_cert_public_key(int fd)
RedsMigCertPubKeyInfo pub_key_info_msg;
if (spice_secure_port == -1) {
- pub_key_info_msg.type = RED_PUBKEY_TYPE_INVALID;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_INVALID;
pub_key_info_msg.len = 0;
reds_mig_write_all(fd, &pub_key_info_msg, sizeof(pub_key_info_msg), "cert public key info");
return;
@@ -4762,31 +4762,31 @@ static void reds_mig_send_cert_public_key(int fd)
switch(pub_key->type) {
case EVP_PKEY_RSA:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_RSA;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_RSA;
break;
case EVP_PKEY_RSA2:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_RSA2;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_RSA2;
break;
case EVP_PKEY_DSA:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA;
break;
case EVP_PKEY_DSA1:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA1;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA1;
break;
case EVP_PKEY_DSA2:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA2;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA2;
break;
case EVP_PKEY_DSA3:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA3;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA3;
break;
case EVP_PKEY_DSA4:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA4;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA4;
break;
case EVP_PKEY_DH:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DH;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DH;
break;
case EVP_PKEY_EC:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_EC;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_EC;
break;
default:
red_error("invalid public key type");
@@ -4804,7 +4804,7 @@ static void reds_mig_send_cert_public_key(int fd)
static void reds_mig_recv(void *opaque, int fd)
{
uint32_t ack_message = *(uint32_t *)"ack_";
- char password[RED_MAX_PASSWORD_LENGTH];
+ char password[SPICE_MAX_PASSWORD_LENGTH];
RedsMigSpiceMessage mig_message;
unsigned long f4 = RSA_F4;
TicketInfo ticketing_info;
@@ -4856,7 +4856,7 @@ static void reds_mig_recv(void *opaque, int fd)
red_error("OpenSSL RSA alloc failed");
}
- RSA_generate_key_ex(ticketing_info.rsa, RED_TICKET_KEY_PAIR_LENGTH, ticketing_info.bn, NULL);
+ RSA_generate_key_ex(ticketing_info.rsa, SPICE_TICKET_KEY_PAIR_LENGTH, ticketing_info.bn, NULL);
ticketing_info.rsa_size = RSA_size(ticketing_info.rsa);
if (!(bio = BIO_new(BIO_s_mem()))) {
@@ -4866,7 +4866,7 @@ static void reds_mig_recv(void *opaque, int fd)
i2d_RSA_PUBKEY_bio(bio, ticketing_info.rsa);
BIO_get_mem_ptr(bio, &buff);
- reds_mig_write_all(fd, buff->data, RED_TICKET_PUBKEY_BYTES, "publick key");
+ reds_mig_write_all(fd, buff->data, SPICE_TICKET_PUBKEY_BYTES, "publick key");
reds_mig_read_all(fd, ticketing_info.encrypted_ticket.encrypted_data, ticketing_info.rsa_size,
"ticket");
@@ -4910,7 +4910,7 @@ void reds_update_mm_timer(uint32_t mm_time)
void reds_enable_mm_timer()
{
- RedMultiMediaTime *time_mes;
+ SpiceMsgMainMultiMediaTime *time_mes;
SimpleOutItem *item;
core->arm_timer(core, reds->mm_timer, MM_TIMER_GRANULARITY_MS);
@@ -4918,12 +4918,12 @@ void reds_enable_mm_timer()
return;
}
- if (!(item = new_simple_out_item(RED_MULTI_MEDIA_TIME, sizeof(RedMultiMediaTime)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_MULTI_MEDIA_TIME, sizeof(SpiceMsgMainMultiMediaTime)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- time_mes = (RedMultiMediaTime *)item->data;
+ time_mes = (SpiceMsgMainMultiMediaTime *)item->data;
time_mes->time = reds_get_mm_time() - MM_TIME_DELTA;
reds_push_pipe_item(&item->base);
}
@@ -5375,7 +5375,7 @@ static void init_vd_agent_resources()
memset(buf, 0, sizeof(*buf));
buf->out_item.prepare = reds_prepare_read_buf;
buf->out_item.release = reds_release_read_buf;
- buf->header.type = RED_AGENT_DATA;
+ buf->header.type = SPICE_MSG_MAIN_AGENT_DATA;
buf->header.sub_list = 0;
ring_item_init(&buf->out_item.link);
ring_add(&reds->agent_state.read_bufs, &buf->out_item.link);
@@ -5431,13 +5431,13 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
core->register_change_notifiers(core, &reds, interface_change_notifier);
#ifdef RED_STATISTICS
- int shm_name_len = strlen(REDS_STAT_SHM_NAME) + 20;
+ int shm_name_len = strlen(SPICE_STAT_SHM_NAME) + 20;
int fd;
if (!(reds->stat_shm_name = (char *)malloc(shm_name_len))) {
red_error("stat_shm_name alloc failed");
}
- snprintf(reds->stat_shm_name, shm_name_len, REDS_STAT_SHM_NAME, getpid());
+ snprintf(reds->stat_shm_name, shm_name_len, SPICE_STAT_SHM_NAME, getpid());
if ((fd = shm_open(reds->stat_shm_name, O_CREAT | O_RDWR, 0444)) == -1) {
red_error("statistics shm_open failed, %s", strerror(errno));
}
@@ -5445,12 +5445,12 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
red_error("statistics ftruncate failed, %s", strerror(errno));
}
reds->stat = mmap(NULL, REDS_STAT_SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (reds->stat == (RedsStat *)MAP_FAILED) {
+ if (reds->stat == (SpiceStat *)MAP_FAILED) {
red_error("statistics mmap failed, %s", strerror(errno));
}
memset(reds->stat, 0, REDS_STAT_SHM_SIZE);
- reds->stat->magic = REDS_STAT_MAGIC;
- reds->stat->version = REDS_STAT_VERSION;
+ reds->stat->magic = SPICE_STAT_MAGIC;
+ reds->stat->version = SPICE_STAT_VERSION;
reds->stat->root_index = INVALID_STAT_REF;
if (pthread_mutex_init(&reds->stat_lock, NULL)) {
red_error("mutex init failed");
@@ -5472,7 +5472,7 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
}
inputs_init();
- reds->mouse_mode = RED_MOUSE_MODE_SERVER;
+ reds->mouse_mode = SPICE_MOUSE_MODE_SERVER;
atexit(reds_exit);
}
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 8cfabaef..3046bd1b 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -68,7 +68,7 @@ typedef struct BufDescriptor {
typedef struct SndChannel SndChannel;
typedef void (*send_messages_proc)(void *in_channel);
-typedef int (*handle_message_proc)(SndChannel *channel, RedDataHeader *message);
+typedef int (*handle_message_proc)(SndChannel *channel, SpiceDataHeader *message);
typedef void (*on_message_done_proc)(SndChannel *channel);
typedef void (*cleanup_channel_proc)(SndChannel *channel);
@@ -90,7 +90,7 @@ struct SndChannel {
uint32_t ack_messages;
struct {
- RedDataHeader header;
+ SpiceDataHeader header;
uint32_t n_bufs;
BufDescriptor bufs[MAX_SEND_BUFS];
@@ -100,7 +100,7 @@ struct SndChannel {
struct {
uint8_t buf[RECIVE_BUF_SIZE];
- RedDataHeader *message;
+ SpiceDataHeader *message;
uint8_t *now;
uint8_t *end;
} recive_data;
@@ -132,9 +132,9 @@ typedef struct PlaybackChannel {
uint32_t mode;
struct {
union {
- RedPlaybackMode mode;
- RedPlaybackStart start;
- RedMigrate migrate;
+ SpiceMsgPlaybackMode mode;
+ SpiceMsgPlaybackStart start;
+ SpiceMsgMigrate migrate;
uint8_t celt_buf[CELT_COMPRESSED_FRAME_BYTES];
} u;
} send_data;
@@ -158,8 +158,8 @@ typedef struct __attribute__ ((__packed__)) RecordMigrateData {
} RecordMigrateData;
typedef struct __attribute__ ((__packed__)) RecordMigrateMessage {
- RedMigrate migrate;
- RedDataHeader header;
+ SpiceMsgMigrate migrate;
+ SpiceDataHeader header;
RecordMigrateData data;
} RecordMigrateMessage;
@@ -178,14 +178,14 @@ typedef struct RecordChannel {
uint32_t celt_buf[FRAME_SIZE];
struct {
union {
- RedRecordStart start;
+ SpiceMsgRecordStart start;
RecordMigrateMessage migrate;
} u;
} send_data;
} RecordChannel;
static SndWorker *workers = NULL;
-static uint32_t playback_compression = RED_AUDIO_DATA_MODE_CELT_0_5_1;
+static uint32_t playback_compression = SPICE_AUDIO_DATA_MODE_CELT_0_5_1;
static void snd_receive(void* data);
@@ -323,9 +323,9 @@ static int snd_send_data(SndChannel *channel)
return TRUE;
}
-static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader *message)
+static int snd_record_handle_write(RecordChannel *record_channel, SpiceDataHeader *message)
{
- RedcRecordPacket *packet;
+ SpiceMsgcRecordPacket *packet;
uint32_t write_pos;
uint32_t* data;
uint32_t size;
@@ -336,10 +336,10 @@ static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader
return FALSE;
}
- packet = (RedcRecordPacket *)(message + 1);
+ packet = (SpiceMsgcRecordPacket *)(message + 1);
size = message->size - sizeof(*packet);
- if (record_channel->mode == RED_AUDIO_DATA_MODE_CELT_0_5_1) {
+ if (record_channel->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
int celt_err = celt051_decode(record_channel->celt_decoder, packet->data, size,
(celt_int16_t *)record_channel->celt_buf);
if (celt_err != CELT_OK) {
@@ -348,7 +348,7 @@ static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader
}
data = record_channel->celt_buf;
size = FRAME_SIZE;
- } else if (record_channel->mode == RED_AUDIO_DATA_MODE_RAW) {
+ } else if (record_channel->mode == SPICE_AUDIO_DATA_MODE_RAW) {
data = (uint32_t *)packet->data;
size = size >> 2;
size = MIN(size, RECORD_SAMPLES_SIZE);
@@ -373,14 +373,14 @@ static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader
return TRUE;
}
-static int snd_playback_handle_message(SndChannel *channel, RedDataHeader *message)
+static int snd_playback_handle_message(SndChannel *channel, SpiceDataHeader *message)
{
if (!channel) {
return FALSE;
}
switch (message->type) {
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("invalid message type %u", message->type);
@@ -389,7 +389,7 @@ static int snd_playback_handle_message(SndChannel *channel, RedDataHeader *messa
return TRUE;
}
-static int snd_record_handle_message(SndChannel *channel, RedDataHeader *message)
+static int snd_record_handle_message(SndChannel *channel, SpiceDataHeader *message)
{
RecordChannel *record_channel = (RecordChannel *)channel;
@@ -397,26 +397,26 @@ static int snd_record_handle_message(SndChannel *channel, RedDataHeader *message
return FALSE;
}
switch (message->type) {
- case REDC_RECORD_DATA:
+ case SPICE_MSGC_RECORD_DATA:
return snd_record_handle_write((RecordChannel *)channel, message);
- case REDC_RECORD_MODE: {
- RedcRecordMode *mode = (RedcRecordMode *)(message + 1);
+ case SPICE_MSGC_RECORD_MODE: {
+ SpiceMsgcRecordMode *mode = (SpiceMsgcRecordMode *)(message + 1);
record_channel->mode = mode->mode;
record_channel->mode_time = mode->time;
- if (record_channel->mode != RED_AUDIO_DATA_MODE_CELT_0_5_1 &&
- record_channel->mode != RED_AUDIO_DATA_MODE_RAW) {
+ if (record_channel->mode != SPICE_AUDIO_DATA_MODE_CELT_0_5_1 &&
+ record_channel->mode != SPICE_AUDIO_DATA_MODE_RAW) {
red_printf("unsupported mode");
}
break;
}
- case REDC_RECORD_START_MARK: {
- RedcRecordStartMark *mark = (RedcRecordStartMark *)(message + 1);
+ case SPICE_MSGC_RECORD_START_MARK: {
+ SpiceMsgcRecordStartMark *mark = (SpiceMsgcRecordStartMark *)(message + 1);
record_channel->start_time = mark->time;
break;
}
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
- case REDC_MIGRATE_DATA: {
+ case SPICE_MSGC_MIGRATE_DATA: {
RecordMigrateData* mig_data = (RecordMigrateData *)(message + 1);
if (mig_data->version != RECORD_MIG_VERSION) {
red_printf("invalid mig version");
@@ -467,26 +467,26 @@ static void snd_receive(void* data)
} else {
channel->recive_data.now += n;
for (;;) {
- RedDataHeader *message = channel->recive_data.message;
+ SpiceDataHeader *message = channel->recive_data.message;
n = channel->recive_data.now - (uint8_t *)message;
- if (n < sizeof(RedDataHeader) || n < sizeof(RedDataHeader) + message->size) {
+ if (n < sizeof(SpiceDataHeader) || n < sizeof(SpiceDataHeader) + message->size) {
break;
}
if (!channel->handle_message(channel, message)) {
snd_disconnect_channel(channel);
return;
}
- channel->recive_data.message = (RedDataHeader *)((uint8_t *)message +
- sizeof(RedDataHeader) +
+ channel->recive_data.message = (SpiceDataHeader *)((uint8_t *)message +
+ sizeof(SpiceDataHeader) +
message->size);
}
if (channel->recive_data.now == (uint8_t *)channel->recive_data.message) {
channel->recive_data.now = channel->recive_data.buf;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
} else if (channel->recive_data.now == channel->recive_data.end) {
memcpy(channel->recive_data.buf, channel->recive_data.message, n);
channel->recive_data.now = channel->recive_data.buf + n;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
}
}
}
@@ -518,27 +518,27 @@ static inline int snd_reset_send_data(SndChannel *channel, uint16_t verb)
channel->send_data.header.size = 0;
channel->send_data.header.type = verb;
++channel->send_data.header.serial;
- __snd_add_buf(channel, &channel->send_data.header, sizeof(RedDataHeader));
+ __snd_add_buf(channel, &channel->send_data.header, sizeof(SpiceDataHeader));
return TRUE;
}
static int snd_playback_send_migrate(PlaybackChannel *channel)
{
- if (!snd_reset_send_data((SndChannel *)channel, RED_MIGRATE)) {
+ if (!snd_reset_send_data((SndChannel *)channel, SPICE_MSG_MIGRATE)) {
return FALSE;
}
channel->send_data.u.migrate.flags = 0;
snd_add_buf((SndChannel *)channel, &channel->send_data.u.migrate,
sizeof(channel->send_data.u.migrate));
- channel->base.send_data.size = channel->base.send_data.header.size + sizeof(RedDataHeader);
+ channel->base.send_data.size = channel->base.send_data.header.size + sizeof(SpiceDataHeader);
return snd_send_data((SndChannel *)channel);
}
static int snd_playback_send_start(PlaybackChannel *playback_channel)
{
SndChannel *channel = (SndChannel *)playback_channel;
- RedPlaybackStart *start;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_START)) {
+ SpiceMsgPlaybackStart *start;
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_START)) {
return FALSE;
}
@@ -546,21 +546,21 @@ static int snd_playback_send_start(PlaybackChannel *playback_channel)
start->channels = VD_INTERFACE_PLAYBACK_CHAN;
start->frequency = VD_INTERFACE_PLAYBACK_FREQ;
ASSERT(VD_INTERFACE_PLAYBACK_FMT == VD_INTERFACE_AUDIO_FMT_S16);
- start->format = RED_AUDIO_FMT_S16;
+ start->format = SPICE_AUDIO_FMT_S16;
start->time = reds_get_mm_time();
snd_add_buf(channel, start, sizeof(*start));
- channel->send_data.size = sizeof(RedDataHeader) + sizeof(*start);
+ channel->send_data.size = sizeof(SpiceDataHeader) + sizeof(*start);
return snd_send_data(channel);
}
static int snd_playback_send_stop(PlaybackChannel *playback_channel)
{
SndChannel *channel = (SndChannel *)playback_channel;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_STOP)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_STOP)) {
return FALSE;
}
- channel->send_data.size = sizeof(RedDataHeader);
+ channel->send_data.size = sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -578,8 +578,8 @@ static int snd_playback_send_ctl(PlaybackChannel *playback_channel)
static int snd_record_send_start(RecordChannel *record_channel)
{
SndChannel *channel = (SndChannel *)record_channel;
- RedRecordStart *start;
- if (!snd_reset_send_data(channel, RED_RECORD_START)) {
+ SpiceMsgRecordStart *start;
+ if (!snd_reset_send_data(channel, SPICE_MSG_RECORD_START)) {
return FALSE;
}
@@ -587,20 +587,20 @@ static int snd_record_send_start(RecordChannel *record_channel)
start->channels = VD_INTERFACE_RECORD_CHAN;
start->frequency = VD_INTERFACE_RECORD_FREQ;
ASSERT(VD_INTERFACE_RECORD_FMT == VD_INTERFACE_AUDIO_FMT_S16);
- start->format = RED_AUDIO_FMT_S16;
+ start->format = SPICE_AUDIO_FMT_S16;
snd_add_buf(channel, start, sizeof(*start));
- channel->send_data.size = sizeof(RedDataHeader) + sizeof(*start);
+ channel->send_data.size = sizeof(SpiceDataHeader) + sizeof(*start);
return snd_send_data(channel);
}
static int snd_record_send_stop(RecordChannel *record_channel)
{
SndChannel *channel = (SndChannel *)record_channel;
- if (!snd_reset_send_data(channel, RED_RECORD_STOP)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_RECORD_STOP)) {
return FALSE;
}
- channel->send_data.size = sizeof(RedDataHeader);
+ channel->send_data.size = sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -620,13 +620,13 @@ static int snd_record_send_migrate(RecordChannel *record_channel)
SndChannel *channel = (SndChannel *)record_channel;
RecordMigrateMessage* migrate;
- if (!snd_reset_send_data(channel, RED_MIGRATE)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_MIGRATE)) {
return FALSE;
}
migrate = &record_channel->send_data.u.migrate;
- migrate->migrate.flags = RED_MIGRATE_NEED_DATA_TRANSFER;
- migrate->header.type = RED_MIGRATE_DATA;
+ migrate->migrate.flags = SPICE_MIGRATE_NEED_DATA_TRANSFER;
+ migrate->header.type = SPICE_MSG_MIGRATE_DATA;
migrate->header.size = sizeof(RecordMigrateData);
migrate->header.serial = ++channel->send_data.header.serial;
migrate->header.sub_list = 0;
@@ -638,7 +638,7 @@ static int snd_record_send_migrate(RecordChannel *record_channel)
migrate->data.mode_time = record_channel->mode_time;
snd_add_buf(channel, migrate, sizeof(*migrate));
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
channel->send_data.header.size -= sizeof(migrate->header);
channel->send_data.header.size -= sizeof(migrate->data);
return snd_send_data(channel);
@@ -649,13 +649,13 @@ static int snd_playback_send_write(PlaybackChannel *playback_channel)
SndChannel *channel = (SndChannel *)playback_channel;
AudioFrame *frame;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_DATA)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_DATA)) {
return FALSE;
}
frame = playback_channel->in_progress;
snd_add_buf(channel, &frame->time, sizeof(frame->time));
- if (playback_channel->mode == RED_AUDIO_DATA_MODE_CELT_0_5_1) {
+ if (playback_channel->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
int n = celt051_encode(playback_channel->celt_encoder, (celt_int16_t *)frame->samples, NULL,
playback_channel->send_data.u.celt_buf, CELT_COMPRESSED_FRAME_BYTES);
if (n < 0) {
@@ -668,7 +668,7 @@ static int snd_playback_send_write(PlaybackChannel *playback_channel)
snd_add_buf(channel, frame->samples, sizeof(frame->samples));
}
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -676,9 +676,9 @@ static int snd_playback_send_write(PlaybackChannel *playback_channel)
static int playback_send_mode(PlaybackChannel *playback_channel)
{
SndChannel *channel = (SndChannel *)playback_channel;
- RedPlaybackMode *mode;
+ SpiceMsgPlaybackMode *mode;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_MODE)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_MODE)) {
return FALSE;
}
mode = &playback_channel->send_data.u.mode;
@@ -686,7 +686,7 @@ static int playback_send_mode(PlaybackChannel *playback_channel)
mode->mode = playback_channel->mode;
snd_add_buf(channel, mode, sizeof(*mode));
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -802,7 +802,7 @@ static SndChannel *__new_channel(SndWorker *worker, int size, RedsStreamContext
memset(channel, 0, size);
channel->peer = peer;
channel->worker = worker;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
channel->recive_data.now = channel->recive_data.buf;
channel->recive_data.end = channel->recive_data.buf + sizeof(channel->recive_data.buf);
@@ -989,9 +989,9 @@ static void snd_set_playback_peer(Channel *channel, RedsStreamContext *peer, int
playback_channel->plug.put_frame = snd_playback_put_frame;
playback_channel->celt_mode = celt_mode;
playback_channel->celt_encoder = celt_encoder;
- playback_channel->celt_allowed = num_caps > 0 && (caps[0] & (1 << RED_PLAYBACK_CAP_CELT_0_5_1));
+ playback_channel->celt_allowed = num_caps > 0 && (caps[0] & (1 << SPICE_PLAYBACK_CAP_CELT_0_5_1));
playback_channel->mode = playback_channel->celt_allowed ? playback_compression :
- RED_AUDIO_DATA_MODE_RAW;
+ SPICE_AUDIO_DATA_MODE_RAW;
on_new_playback_channel(worker);
snd_playback_send(worker->connection);
@@ -1205,7 +1205,7 @@ void snd_attach_playback(PlaybackInterface *interface)
red_error("playback channel malloc failed");
}
memset(playback_worker, 0, sizeof(*playback_worker));
- playback_worker->base.type = RED_CHANNEL_PLAYBACK;
+ playback_worker->base.type = SPICE_CHANNEL_PLAYBACK;
playback_worker->base.link = snd_set_playback_peer;
playback_worker->base.shutdown = snd_shutdown;
playback_worker->base.migrate = snd_playback_migrate;
@@ -1216,7 +1216,7 @@ void snd_attach_playback(PlaybackInterface *interface)
if (!(playback_worker->base.caps = malloc(sizeof(uint32_t)))) {
PANIC("malloc failed");
}
- playback_worker->base.caps[0] = (1 << RED_PLAYBACK_CAP_CELT_0_5_1);
+ playback_worker->base.caps[0] = (1 << SPICE_PLAYBACK_CAP_CELT_0_5_1);
add_worker(playback_worker);
reds_register_channel(&playback_worker->base);
@@ -1230,7 +1230,7 @@ void snd_attach_record(RecordInterface *interface)
}
memset(record_worker, 0, sizeof(*record_worker));
- record_worker->base.type = RED_CHANNEL_RECORD;
+ record_worker->base.type = SPICE_CHANNEL_RECORD;
record_worker->base.link = snd_set_record_peer;
record_worker->base.shutdown = snd_shutdown;
record_worker->base.migrate = snd_record_migrate;
@@ -1242,7 +1242,7 @@ void snd_attach_record(RecordInterface *interface)
if (!(record_worker->base.caps = malloc(sizeof(uint32_t)))) {
PANIC("malloc failed");
}
- record_worker->base.caps[0] = (1 << RED_RECORD_CAP_CELT_0_5_1);
+ record_worker->base.caps[0] = (1 << SPICE_RECORD_CAP_CELT_0_5_1);
add_worker(record_worker);
reds_register_channel(&record_worker->base);
}
@@ -1277,12 +1277,12 @@ void snd_set_playback_compression(int on)
{
SndWorker *now = workers;
- playback_compression = on ? RED_AUDIO_DATA_MODE_CELT_0_5_1 : RED_AUDIO_DATA_MODE_RAW;
+ playback_compression = on ? SPICE_AUDIO_DATA_MODE_CELT_0_5_1 : SPICE_AUDIO_DATA_MODE_RAW;
for (; now; now = now->next) {
- if (now->base.type == RED_CHANNEL_PLAYBACK && now->connection) {
+ if (now->base.type == SPICE_CHANNEL_PLAYBACK && now->connection) {
PlaybackChannel* playback = (PlaybackChannel*)now->connection;
if (!playback->celt_allowed) {
- ASSERT(playback->mode == RED_AUDIO_DATA_MODE_RAW);
+ ASSERT(playback->mode == SPICE_AUDIO_DATA_MODE_RAW);
continue;
}
if (playback->mode != playback_compression) {
@@ -1295,6 +1295,6 @@ void snd_set_playback_compression(int on)
int snd_get_playback_compression()
{
- return (playback_compression == RED_AUDIO_DATA_MODE_RAW) ? FALSE : TRUE;
+ return (playback_compression == SPICE_AUDIO_DATA_MODE_RAW) ? FALSE : TRUE;
}
diff --git a/server/vd_interface.h b/server/vd_interface.h
index 3adbf7e6..674fae00 100644
--- a/server/vd_interface.h
+++ b/server/vd_interface.h
@@ -196,7 +196,7 @@ struct QXLInterface {
void (*release_resource)(QXLInterface *qxl, struct QXLReleaseInfoExt release_info);
int (*get_cursor_command)(QXLInterface *qxl, struct QXLCommandExt *cmd);
int (*req_cursor_notification)(QXLInterface *qxl);
- const struct Rect *(*get_update_area)(QXLInterface *qxl);
+ const struct SpiceRect *(*get_update_area)(QXLInterface *qxl);
void (*notify_update)(QXLInterface *qxl, uint32_t update_id);
void (*set_save_data)(QXLInterface *qxl, void *data, int size);
void *(*get_save_data)(QXLInterface *qxl);
diff --git a/tools/reds_stat.c b/tools/reds_stat.c
index 76541579..f77d8db0 100644
--- a/tools/reds_stat.c
+++ b/tools/reds_stat.c
@@ -29,17 +29,17 @@
#define VALUE_TABS 7
#define INVALID_STAT_REF (~(uint32_t)0)
-static RedsStat *reds_stat = NULL;
+static SpiceStat *reds_stat = NULL;
static uint64_t *values = NULL;
void print_stat_tree(int32_t node_index, int depth)
{
- StatNode *node = &reds_stat->nodes[node_index];
+ SpiceStatNode *node = &reds_stat->nodes[node_index];
int i;
- if ((node->flags & STAT_NODE_MASK_SHOW) == STAT_NODE_MASK_SHOW) {
+ if ((node->flags & SPICE_STAT_NODE_MASK_SHOW) == SPICE_STAT_NODE_MASK_SHOW) {
printf("%*s%s", depth * TAB_LEN, "", node->name);
- if (node->flags & STAT_NODE_FLAG_VALUE) {
+ if (node->flags & SPICE_STAT_NODE_FLAG_VALUE) {
printf(":%*s%llu (%llu)\n", (VALUE_TABS - depth) * TAB_LEN - strlen(node->name) - 1, "",
node->value, node->value - values[node_index]);
values[node_index] = node->value;
@@ -71,28 +71,28 @@ int main(int argc, char **argv)
printf("usage: reds_stat [qemu_pid] (e.g. `pgrep qemu`)\n");
return -1;
}
- shm_name_len = strlen(REDS_STAT_SHM_NAME) + strlen(argv[1]);
+ shm_name_len = strlen(SPICE_STAT_SHM_NAME) + strlen(argv[1]);
if (!(shm_name = (char *)malloc(shm_name_len))) {
perror("malloc");
return -1;
}
- snprintf(shm_name, shm_name_len, REDS_STAT_SHM_NAME, kvm_pid);
+ snprintf(shm_name, shm_name_len, SPICE_STAT_SHM_NAME, kvm_pid);
if ((fd = shm_open(shm_name, O_RDONLY, 0444)) == -1) {
perror("shm_open");
free(shm_name);
return -1;
}
- shm_size = sizeof(RedsStat);
+ shm_size = sizeof(SpiceStat);
reds_stat = mmap(NULL, shm_size, PROT_READ, MAP_SHARED, fd, 0);
- if (reds_stat == (RedsStat *)MAP_FAILED) {
+ if (reds_stat == (SpiceStat *)MAP_FAILED) {
perror("mmap");
goto error1;
}
- if (reds_stat->magic != REDS_STAT_MAGIC) {
+ if (reds_stat->magic != SPICE_STAT_MAGIC) {
printf("bad magic %u\n", reds_stat->magic);
goto error2;
}
- if (reds_stat->version != REDS_STAT_VERSION) {
+ if (reds_stat->version != SPICE_STAT_VERSION) {
printf("bad version %u\n", reds_stat->version);
goto error2;
}
@@ -102,9 +102,9 @@ int main(int argc, char **argv)
if (num_of_nodes != reds_stat->num_of_nodes) {
num_of_nodes = reds_stat->num_of_nodes;
shm_old_size = shm_size;
- shm_size = sizeof(RedsStat) + num_of_nodes * sizeof(StatNode);
+ shm_size = sizeof(SpiceStat) + num_of_nodes * sizeof(SpiceStatNode);
reds_stat = mremap(reds_stat, shm_old_size, shm_size, MREMAP_MAYMOVE);
- if (reds_stat == (RedsStat *)MAP_FAILED) {
+ if (reds_stat == (SpiceStat *)MAP_FAILED) {
perror("mremap");
goto error3;
}