|
4 | 4 |
|
5 | 5 | use gdk;
|
6 | 6 | use gdk_x11_sys;
|
7 |
| -use glib::object::Cast; |
8 |
| -use glib::object::IsA; |
9 | 7 | use glib::object::ObjectType as ObjectType_;
|
10 | 8 | use glib::translate::*;
|
11 | 9 | use glib::StaticType;
|
12 |
| -use glib::ToValue; |
13 | 10 | use glib::Value;
|
14 | 11 | use gobject_sys;
|
15 | 12 | use std::fmt;
|
@@ -39,116 +36,6 @@ impl X11DeviceXI2 {
|
39 | 36 | }
|
40 | 37 | }
|
41 | 38 |
|
42 |
| -#[derive(Clone, Default)] |
43 |
| -pub struct X11DeviceXI2Builder { |
44 |
| - device_id: Option<i32>, |
45 |
| - device_manager: Option<gdk::DeviceManager>, |
46 |
| - display: Option<gdk::Display>, |
47 |
| - has_cursor: Option<bool>, |
48 |
| - //input-mode: /*Unknown type*/, |
49 |
| - //input-source: /*Unknown type*/, |
50 |
| - name: Option<String>, |
51 |
| - #[cfg(any(feature = "v3_20", feature = "dox"))] |
52 |
| - num_touches: Option<u32>, |
53 |
| - #[cfg(any(feature = "v3_16", feature = "dox"))] |
54 |
| - product_id: Option<String>, |
55 |
| - //seat: /*Unknown type*/, |
56 |
| - //type: /*Unknown type*/, |
57 |
| - #[cfg(any(feature = "v3_16", feature = "dox"))] |
58 |
| - vendor_id: Option<String>, |
59 |
| -} |
60 |
| - |
61 |
| -impl X11DeviceXI2Builder { |
62 |
| - pub fn new() -> Self { |
63 |
| - Self::default() |
64 |
| - } |
65 |
| - |
66 |
| - pub fn build(self) -> X11DeviceXI2 { |
67 |
| - let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; |
68 |
| - if let Some(ref device_id) = self.device_id { |
69 |
| - properties.push(("device-id", device_id)); |
70 |
| - } |
71 |
| - if let Some(ref device_manager) = self.device_manager { |
72 |
| - properties.push(("device-manager", device_manager)); |
73 |
| - } |
74 |
| - if let Some(ref display) = self.display { |
75 |
| - properties.push(("display", display)); |
76 |
| - } |
77 |
| - if let Some(ref has_cursor) = self.has_cursor { |
78 |
| - properties.push(("has-cursor", has_cursor)); |
79 |
| - } |
80 |
| - if let Some(ref name) = self.name { |
81 |
| - properties.push(("name", name)); |
82 |
| - } |
83 |
| - #[cfg(any(feature = "v3_20", feature = "dox"))] |
84 |
| - { |
85 |
| - if let Some(ref num_touches) = self.num_touches { |
86 |
| - properties.push(("num-touches", num_touches)); |
87 |
| - } |
88 |
| - } |
89 |
| - #[cfg(any(feature = "v3_16", feature = "dox"))] |
90 |
| - { |
91 |
| - if let Some(ref product_id) = self.product_id { |
92 |
| - properties.push(("product-id", product_id)); |
93 |
| - } |
94 |
| - } |
95 |
| - #[cfg(any(feature = "v3_16", feature = "dox"))] |
96 |
| - { |
97 |
| - if let Some(ref vendor_id) = self.vendor_id { |
98 |
| - properties.push(("vendor-id", vendor_id)); |
99 |
| - } |
100 |
| - } |
101 |
| - let ret = glib::Object::new(X11DeviceXI2::static_type(), &properties) |
102 |
| - .expect("object new") |
103 |
| - .downcast::<X11DeviceXI2>() |
104 |
| - .expect("downcast"); |
105 |
| - ret |
106 |
| - } |
107 |
| - |
108 |
| - pub fn device_id(mut self, device_id: i32) -> Self { |
109 |
| - self.device_id = Some(device_id); |
110 |
| - self |
111 |
| - } |
112 |
| - |
113 |
| - pub fn device_manager<P: IsA<gdk::DeviceManager>>(mut self, device_manager: &P) -> Self { |
114 |
| - self.device_manager = Some(device_manager.clone().upcast()); |
115 |
| - self |
116 |
| - } |
117 |
| - |
118 |
| - pub fn display<P: IsA<gdk::Display>>(mut self, display: &P) -> Self { |
119 |
| - self.display = Some(display.clone().upcast()); |
120 |
| - self |
121 |
| - } |
122 |
| - |
123 |
| - pub fn has_cursor(mut self, has_cursor: bool) -> Self { |
124 |
| - self.has_cursor = Some(has_cursor); |
125 |
| - self |
126 |
| - } |
127 |
| - |
128 |
| - pub fn name(mut self, name: &str) -> Self { |
129 |
| - self.name = Some(name.to_string()); |
130 |
| - self |
131 |
| - } |
132 |
| - |
133 |
| - #[cfg(any(feature = "v3_20", feature = "dox"))] |
134 |
| - pub fn num_touches(mut self, num_touches: u32) -> Self { |
135 |
| - self.num_touches = Some(num_touches); |
136 |
| - self |
137 |
| - } |
138 |
| - |
139 |
| - #[cfg(any(feature = "v3_16", feature = "dox"))] |
140 |
| - pub fn product_id(mut self, product_id: &str) -> Self { |
141 |
| - self.product_id = Some(product_id.to_string()); |
142 |
| - self |
143 |
| - } |
144 |
| - |
145 |
| - #[cfg(any(feature = "v3_16", feature = "dox"))] |
146 |
| - pub fn vendor_id(mut self, vendor_id: &str) -> Self { |
147 |
| - self.vendor_id = Some(vendor_id.to_string()); |
148 |
| - self |
149 |
| - } |
150 |
| -} |
151 |
| - |
152 | 39 | impl fmt::Display for X11DeviceXI2 {
|
153 | 40 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
154 | 41 | write!(f, "X11DeviceXI2")
|
|
0 commit comments