Mercurial > tablet-emu
comparison src/state.rs @ 17:0bce7fe96937
Add a client, copy of the GTK interface.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 26 Aug 2021 22:00:55 +0200 |
parents | 478cf2a7d577 |
children |
comparison
equal
deleted
inserted
replaced
16:478cf2a7d577 | 17:0bce7fe96937 |
---|---|
107 input_synchronize_new(SynchronizeKind::Report, 0), | 107 input_synchronize_new(SynchronizeKind::Report, 0), |
108 ])?; | 108 ])?; |
109 Ok(()) | 109 Ok(()) |
110 } | 110 } |
111 } | 111 } |
112 | |
113 pub struct FakeState { | |
114 width: f64, | |
115 height: f64, | |
116 selected_tool: Key, | |
117 pressed: bool, | |
118 } | |
119 | |
120 impl FakeState { | |
121 pub fn new() -> FakeState { | |
122 FakeState { | |
123 width: DEFAULT_WIDTH as f64, | |
124 height: DEFAULT_HEIGHT as f64, | |
125 selected_tool: Key::ButtonToolPen, | |
126 pressed: false, | |
127 } | |
128 } | |
129 | |
130 pub fn is_pressed(&self) -> bool { | |
131 self.pressed | |
132 } | |
133 | |
134 pub fn set_size(&mut self, width: i32, height: i32) { | |
135 self.width = width as f64; | |
136 self.height = height as f64; | |
137 } | |
138 | |
139 pub fn select_tool(&mut self, tool: Key) { | |
140 self.selected_tool = tool; | |
141 } | |
142 | |
143 pub fn press(&mut self, _x: f64, _y: f64) -> std::io::Result<()> { | |
144 self.pressed = true; | |
145 Ok(()) | |
146 } | |
147 | |
148 pub fn release(&mut self, _x: f64, _y: f64) -> std::io::Result<()> { | |
149 self.pressed = false; | |
150 Ok(()) | |
151 } | |
152 | |
153 pub fn motion(&mut self, _x: f64, _y: f64) -> std::io::Result<()> { | |
154 Ok(()) | |
155 } | |
156 } |