1 /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3    Copyright (C) 2009 Red Hat, Inc.
4 
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef CURSOR_CHANNEL_H_
20 #define CURSOR_CHANNEL_H_
21 
22 #include "common-graphics-channel.h"
23 #include "red-parse-qxl.h"
24 #include "dispatcher.h"
25 
26 #include "push-visibility.h"
27 
28 struct RedCursorPipeItem;
29 
30 /**
31  * This type it's a RedChannel class which implement cursor (mouse)
32  * movements.
33  */
34 struct CursorChannel final: public CommonGraphicsChannel
35 {
36     CursorChannel(RedsState *reds, uint32_t id,
37                   SpiceCoreInterfaceInternal *core=nullptr, Dispatcher *dispatcher=nullptr);
38     ~CursorChannel();
39     void reset();
40     void do_init();
41     void process_cmd(RedCursorCmd *cursor_cmd);
42     void set_mouse_mode(uint32_t mode);
43     void on_connect(RedClient *client, RedStream *stream, int migration,
44                     RedChannelCapabilities *caps) override;
45 
46     red::shared_ptr<RedCursorPipeItem> item;
47     bool cursor_visible = true;
48     SpicePoint16 cursor_position;
49     uint16_t cursor_trail_length;
50     uint16_t cursor_trail_frequency;
51     uint32_t mouse_mode = SPICE_MOUSE_MODE_SERVER;
52 };
53 
54 
55 /**
56  * Create CursorChannel.
57  * Since CursorChannel is intended to be run in a separate thread,
58  * the function accepts a dispatcher parameter to allows some
59  * operations to be executed in the channel thread.
60  */
61 red::shared_ptr<CursorChannel> cursor_channel_new(RedsState *server, int id,
62                                                   SpiceCoreInterfaceInternal *core,
63                                                   Dispatcher *dispatcher);
64 
65 #include "pop-visibility.h"
66 
67 #endif /* CURSOR_CHANNEL_H_ */
68