Mercurial > tablet-emu
annotate src/main.rs @ 12:d43c31aff57c
Split uinput helpers into another module.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 01 Nov 2020 16:01:00 +0100 |
parents | 0193041f01d4 |
children | 97e543f50f62 |
rev | line source |
---|---|
6
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
1 // Tablet emulator, for people who don’t own one |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
2 // Copyright © 2020 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
3 // |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
4 // This program is free software: you can redistribute it and/or modify |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
5 // it under the terms of the GNU Affero General Public License as published by |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
6 // the Free Software Foundation, either version 3 of the License, or |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
7 // (at your option) any later version. |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
8 // |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
9 // This program is distributed in the hope that it will be useful, |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
12 // GNU Affero General Public License for more details. |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
13 // |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
14 // You should have received a copy of the GNU Affero General Public License |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
15 // along with this program. If not, see <https://www.gnu.org/licenses/>. |
dd10331549c6
Add a license file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
16 |
0 | 17 use gio::prelude::*; |
9
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
18 use glib::clone; |
0 | 19 use gtk::prelude::*; |
20 | |
21 use std::env::args; | |
22 use std::io::ErrorKind; | |
11
0193041f01d4
Split State into another module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
10
diff
changeset
|
23 use std::sync::Arc; |
12
d43c31aff57c
Split uinput helpers into another module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
11
diff
changeset
|
24 use input_linux::Key; |
0 | 25 |
12
d43c31aff57c
Split uinput helpers into another module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
11
diff
changeset
|
26 mod uinput; |
11
0193041f01d4
Split State into another module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
10
diff
changeset
|
27 mod state; |
0193041f01d4
Split State into another module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
10
diff
changeset
|
28 use state::State; |
0193041f01d4
Split State into another module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
10
diff
changeset
|
29 |
0 | 30 const WIDTH: i32 = 320; |
31 const HEIGHT: i32 = 180; | |
32 | |
33 const MAX_X: i32 = 69920; | |
34 const MAX_Y: i32 = 39980; | |
35 | |
9
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
36 fn build_main_menu(application: >k::Application) { |
5
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
37 let quit = gio::SimpleAction::new("quit", None); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
38 application.set_accels_for_action("app.quit", &["<Control>q"]); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
39 application.add_action(&quit); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
40 quit.connect_activate(clone!(@weak application => move |_, _| application.quit())); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
41 |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
42 let about = gio::SimpleAction::new("about", None); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
43 application.add_action(&about); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
44 about.connect_activate(|_, _| { |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
45 let about = gtk::AboutDialog::new(); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
46 about.set_program_name("TabletEmu"); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
47 about.set_logo_icon_name(Some("input-tablet")); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
48 about.set_website(Some("https://hg.linkmauve.fr/tablet-emu")); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
49 about.set_version(Some("0.1")); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
50 about.set_license_type(gtk::License::Agpl30); |
7
9c3e2d2efaa8
Add my copyright in the about dialog.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
6
diff
changeset
|
51 about.set_copyright(Some("© 2020 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>")); |
5
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
52 about.run(); |
9
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
53 unsafe { |
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
54 about.destroy(); |
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
55 } |
5
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
56 }); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
57 |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
58 let menu = gio::Menu::new(); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
59 { |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
60 let file = gio::Menu::new(); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
61 file.append(Some("_Quit"), Some("app.quit")); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
62 menu.append_submenu(Some("_File"), &file); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
63 } |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
64 { |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
65 let help = gio::Menu::new(); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
66 help.append(Some("_About"), Some("app.about")); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
67 menu.append_submenu(Some("_Help"), &help); |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
68 } |
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
69 application.set_menubar(Some(&menu)); |
9
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
70 } |
5
cdbf3a2c9af8
Add a very simple menu.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
4
diff
changeset
|
71 |
9
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
72 fn build_ui(application: >k::Application) { |
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
73 build_main_menu(application); |
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
74 |
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
75 let state = match State::new() { |
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
76 Ok(state) => state, |
0 | 77 Err(err) => { |
78 match err.kind() { | |
79 ErrorKind::NotFound => { | |
80 eprintln!("Couldn’t find /dev/uinput: {}", err); | |
81 eprintln!("Maybe you forgot to `modprobe uinput`?"); | |
82 } | |
83 ErrorKind::PermissionDenied => { | |
84 eprintln!("Couldn’t open /dev/uinput for writing: {}", err); | |
85 eprintln!("Maybe you aren’t allowed to create input devices?"); | |
86 } | |
87 _ => eprintln!("Couldn’t open /dev/uinput for writing: {}", err), | |
88 } | |
9
d1972fc49a5b
Reorganise the code a bit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
89 std::process::exit(1); |
0 | 90 } |
91 }; | |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
92 |
0 | 93 let window = gtk::ApplicationWindow::new(application); |
94 window.set_title("tablet-emu"); | |
95 window.set_position(gtk::WindowPosition::Center); | |
96 | |
97 let hbox = gtk::Box::new(gtk::Orientation::Horizontal, 0); | |
98 let tools_box = gtk::Box::new(gtk::Orientation::Vertical, 0); | |
99 | |
4
2e074d185151
Simplify tool buttons.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
3
diff
changeset
|
100 macro_rules! impl_tool { |
2e074d185151
Simplify tool buttons.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
3
diff
changeset
|
101 ($tool:tt) => { |
8
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
102 let tool = gtk::Button::with_mnemonic($tool); |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
103 let state_weak = Arc::downgrade(&state); |
4
2e074d185151
Simplify tool buttons.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
3
diff
changeset
|
104 tool.connect_clicked(move |b| { |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
105 let state = state_weak.upgrade().unwrap(); |
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
106 let mut state = state.lock().unwrap(); |
10
06d77bb94a50
Move more state handling inside of State.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
9
diff
changeset
|
107 let tool = match b.get_label().unwrap().as_str() { |
8
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
108 "_Pen" => Key::ButtonToolPen, |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
109 "_Rubber" => Key::ButtonToolRubber, |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
110 "_Brush" => Key::ButtonToolBrush, |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
111 "P_encil" => Key::ButtonToolPencil, |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
112 "_Airbrush" => Key::ButtonToolAirbrush, |
2
39f87ef69b2a
Add support for selecting tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
1
diff
changeset
|
113 _ => unreachable!(), |
39f87ef69b2a
Add support for selecting tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
1
diff
changeset
|
114 }; |
10
06d77bb94a50
Move more state handling inside of State.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
9
diff
changeset
|
115 state.select_tool(tool); |
0 | 116 }); |
4
2e074d185151
Simplify tool buttons.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
3
diff
changeset
|
117 tools_box.add(&tool); |
0 | 118 }; |
119 }; | |
8
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
120 impl_tool!("_Pen"); |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
121 impl_tool!("_Rubber"); |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
122 impl_tool!("_Brush"); |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
123 impl_tool!("P_encil"); |
51a6c86d3141
Add mnemonic to all current tools.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
124 impl_tool!("_Airbrush"); |
0 | 125 |
126 let drawing_area = gtk::DrawingArea::new(); | |
127 drawing_area.set_size_request(WIDTH, HEIGHT); | |
128 drawing_area.set_hexpand(true); | |
129 drawing_area.set_events( | |
130 gdk::EventMask::BUTTON_PRESS_MASK | |
131 | gdk::EventMask::BUTTON_RELEASE_MASK | |
132 | gdk::EventMask::POINTER_MOTION_MASK, | |
133 ); | |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
134 let state_weak = Arc::downgrade(&state); |
0 | 135 drawing_area.connect_configure_event(move |_, event| { |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
136 let state = state_weak.upgrade().unwrap(); |
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
137 let mut state = state.lock().unwrap(); |
11
0193041f01d4
Split State into another module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
10
diff
changeset
|
138 state.set_size(event.get_size()); |
0 | 139 true |
140 }); | |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
141 let state_weak = Arc::downgrade(&state); |
0 | 142 drawing_area.connect_button_press_event(move |_, event| { |
143 if event.get_button() != 1 { | |
144 return Inhibit(false); | |
145 } | |
146 | |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
147 let state = state_weak.upgrade().unwrap(); |
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
148 let mut state = state.lock().unwrap(); |
0 | 149 let (x, y) = event.get_position(); |
10
06d77bb94a50
Move more state handling inside of State.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
9
diff
changeset
|
150 state.press(x, y).unwrap(); |
0 | 151 Inhibit(false) |
152 }); | |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
153 let state_weak = Arc::downgrade(&state); |
0 | 154 drawing_area.connect_button_release_event(move |_, event| { |
155 if event.get_button() != 1 { | |
156 return Inhibit(false); | |
157 } | |
158 | |
3
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
159 let state = state_weak.upgrade().unwrap(); |
72e63d6a3f8a
Simplify state handling into a single struct.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
2
diff
changeset
|
160 let mut state = state.lock().unwrap(); |
0 | 161 let (x, y) = event.get_position(); |
10
06d77bb94a50
Move more state handling inside of State.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
9
diff
changeset
|
162 state.release(x, y).unwrap(); |
0 | 163 Inhibit(false) |
164 }); | |
165 drawing_area.connect_motion_notify_event(move |_, event| { | |
10
06d77bb94a50
Move more state handling inside of State.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
9
diff
changeset
|
166 let mut state = state.lock().unwrap(); |
0 | 167 let (x, y) = event.get_position(); |
10
06d77bb94a50
Move more state handling inside of State.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
9
diff
changeset
|
168 state.motion(x, y).unwrap(); |
0 | 169 Inhibit(false) |
170 }); | |
171 drawing_area.connect_draw(move |_, ctx| { | |
172 //println!("drawing {}", drawing_area); | |
173 ctx.set_source_rgb(1., 0., 0.); | |
174 ctx.set_operator(cairo::Operator::Screen); | |
175 ctx.paint(); | |
176 Inhibit(false) | |
177 }); | |
178 | |
179 hbox.add(&tools_box); | |
180 hbox.add(&drawing_area); | |
181 | |
182 window.add(&hbox); | |
183 | |
184 window.show_all(); | |
185 } | |
186 | |
187 fn main() { | |
188 let application = gtk::Application::new( | |
189 Some("fr.linkmauve.TabletEmu"), | |
190 gio::ApplicationFlags::empty(), | |
191 ) | |
192 .expect("Initialisation failed…"); | |
193 application.connect_activate(build_ui); | |
194 application.run(&args().collect::<Vec<_>>()); | |
195 } |