diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-06-18 17:11:39 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-06-18 20:27:32 +0200 |
commit | 3c8cb83af5cbe85e6ab41ec1c0b41c5a29230d9e (patch) | |
tree | db8fbd3bf3c04216a9fc97011e8e00d3d0b21e03 | |
parent | 7fa29ea67e5202d4a3f6678445cef9bcad54aa79 (diff) | |
download | spice-3c8cb83af5cbe85e6ab41ec1c0b41c5a29230d9e.tar.gz spice-3c8cb83af5cbe85e6ab41ec1c0b41c5a29230d9e.tar.xz spice-3c8cb83af5cbe85e6ab41ec1c0b41c5a29230d9e.zip |
Make cursor data @as_ptr to avoid copying data
-rw-r--r-- | client/cursor_channel.cpp | 8 | ||||
-rw-r--r-- | client/cursor_channel.h | 2 | ||||
-rw-r--r-- | common/messages.h | 3 | ||||
-rw-r--r-- | spice.proto | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/client/cursor_channel.cpp b/client/cursor_channel.cpp index 26eb4c86..c973e9da 100644 --- a/client/cursor_channel.cpp +++ b/client/cursor_channel.cpp @@ -485,7 +485,7 @@ void CursorChannel::create_native_cursor(CursorData* cursor) cursor->set_opaque(native_cursor); } -void CursorChannel::set_cursor(SpiceCursor& red_cursor, int data_size, int x, int y, bool visible) +void CursorChannel::set_cursor(SpiceCursor& red_cursor, int x, int y, bool visible) { CursorData *cursor; @@ -497,7 +497,7 @@ void CursorChannel::set_cursor(SpiceCursor& red_cursor, int data_size, int x, in 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); + cursor = new CursorData(red_cursor, red_cursor.data_size); if (red_cursor.flags & SPICE_CURSOR_FLAGS_CACHE_ME) { ASSERT(red_cursor.header.unique); _cursor_cache.add(red_cursor.header.unique, cursor); @@ -560,7 +560,7 @@ void CursorChannel::handle_init(RedPeer::InMessage *message) attach_to_screen(get_client().get_application(), get_id()); remove_cursor(); _cursor_cache.clear(); - set_cursor(init->cursor, message->size() - sizeof(SpiceMsgCursorInit), init->position.x, + set_cursor(init->cursor, init->position.x, init->position.y, init->visible != 0); } @@ -574,7 +574,7 @@ void CursorChannel::handle_reset(RedPeer::InMessage *message) void CursorChannel::handle_cursor_set(RedPeer::InMessage* message) { SpiceMsgCursorSet* set = (SpiceMsgCursorSet*)message->data(); - set_cursor(set->cursor, message->size() - sizeof(SpiceMsgCursorSet), set->position.x, + set_cursor(set->cursor, set->position.x, set->position.y, set->visible != 0); } diff --git a/client/cursor_channel.h b/client/cursor_channel.h index 3d6218f3..c9e32b4d 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(SpiceCursor& red_cursor, int data_size, int x, int y, bool visible); + void set_cursor(SpiceCursor& red_cursor, int x, int y, bool visible); void remove_cursor(); virtual void copy_pixels(const QRegion& dest_region, RedDrawable& dest_dc); diff --git a/common/messages.h b/common/messages.h index f6c2aebd..2ba14bf2 100644 --- a/common/messages.h +++ b/common/messages.h @@ -173,7 +173,8 @@ typedef struct SpiceMsgcMainMouseModeRequest { typedef struct SpiceCursor { uint32_t flags; SpiceCursorHeader header; - uint8_t data[0]; + uint32_t data_size; + uint8_t *data; } SpiceCursor; typedef struct SpiceMsgDisplayMode { diff --git a/spice.proto b/spice.proto index 093c8087..6750d2d7 100644 --- a/spice.proto +++ b/spice.proto @@ -867,7 +867,7 @@ struct CursorHeader { struct Cursor { cursor_flags flags; CursorHeader header; - uint8 data[] @end; + uint8 data[] @end @as_ptr(data_size); }; channel CursorChannel : BaseChannel { |