forge
Explore
Log in

Don't you dare go Hollow

Init from smallvil

Browse files at this commit

ad3c3f8cefd38d2bf26b466d8e34eccde3bca443Ivan MolodetskikhRoot commit (no parents)
.gitignoreadded+1 -0
@@ -0,0 +1 @@
1+/target
Cargo.lockadded+1591 -0
@@ -0,0 +1,1591 @@
1+# This file is automatically @generated by Cargo.
2+# It is not intended for manual editing.
3+version = 3
4+
5+[[package]]
6+name = "aho-corasick"
7+version = "1.0.2"
8+source = "registry+https://github.com/rust-lang/crates.io-index"
9+checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
10+dependencies = [
11+ "memchr",
12+]
13+
14+[[package]]
15+name = "android-activity"
16+version = "0.4.3"
17+source = "registry+https://github.com/rust-lang/crates.io-index"
18+checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0"
19+dependencies = [
20+ "android-properties",
21+ "bitflags 1.3.2",
22+ "cc",
23+ "jni-sys",
24+ "libc",
25+ "log",
26+ "ndk",
27+ "ndk-context",
28+ "ndk-sys",
29+ "num_enum 0.6.1",
30+]
31+
32+[[package]]
33+name = "android-properties"
34+version = "0.2.2"
35+source = "registry+https://github.com/rust-lang/crates.io-index"
36+checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
37+
38+[[package]]
39+name = "appendlist"
40+version = "1.4.0"
41+source = "registry+https://github.com/rust-lang/crates.io-index"
42+checksum = "e149dc73cd30538307e7ffa2acd3d2221148eaeed4871f246657b1c3eaa1cbd2"
43+
44+[[package]]
45+name = "approx"
46+version = "0.4.0"
47+source = "registry+https://github.com/rust-lang/crates.io-index"
48+checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
49+dependencies = [
50+ "num-traits",
51+]
52+
53+[[package]]
54+name = "autocfg"
55+version = "1.1.0"
56+source = "registry+https://github.com/rust-lang/crates.io-index"
57+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
58+
59+[[package]]
60+name = "bitflags"
61+version = "1.3.2"
62+source = "registry+https://github.com/rust-lang/crates.io-index"
63+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
64+
65+[[package]]
66+name = "bitflags"
67+version = "2.3.3"
68+source = "registry+https://github.com/rust-lang/crates.io-index"
69+checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
70+
71+[[package]]
72+name = "block-sys"
73+version = "0.1.0-beta.1"
74+source = "registry+https://github.com/rust-lang/crates.io-index"
75+checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146"
76+dependencies = [
77+ "objc-sys",
78+]
79+
80+[[package]]
81+name = "block2"
82+version = "0.2.0-alpha.6"
83+source = "registry+https://github.com/rust-lang/crates.io-index"
84+checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42"
85+dependencies = [
86+ "block-sys",
87+ "objc2-encode",
88+]
89+
90+[[package]]
91+name = "bumpalo"
92+version = "3.13.0"
93+source = "registry+https://github.com/rust-lang/crates.io-index"
94+checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
95+
96+[[package]]
97+name = "calloop"
98+version = "0.10.6"
99+source = "registry+https://github.com/rust-lang/crates.io-index"
100+checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8"
101+dependencies = [
102+ "bitflags 1.3.2",
103+ "log",
104+ "nix 0.25.1",
105+ "slotmap",
106+ "thiserror",
107+ "vec_map",
108+]
109+
110+[[package]]
111+name = "cc"
112+version = "1.0.82"
113+source = "registry+https://github.com/rust-lang/crates.io-index"
114+checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01"
115+dependencies = [
116+ "jobserver",
117+ "libc",
118+]
119+
120+[[package]]
121+name = "cfg-if"
122+version = "1.0.0"
123+source = "registry+https://github.com/rust-lang/crates.io-index"
124+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
125+
126+[[package]]
127+name = "cfg_aliases"
128+version = "0.1.1"
129+source = "registry+https://github.com/rust-lang/crates.io-index"
130+checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
131+
132+[[package]]
133+name = "cgmath"
134+version = "0.18.0"
135+source = "registry+https://github.com/rust-lang/crates.io-index"
136+checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317"
137+dependencies = [
138+ "approx",
139+ "num-traits",
140+]
141+
142+[[package]]
143+name = "core-foundation"
144+version = "0.9.3"
145+source = "registry+https://github.com/rust-lang/crates.io-index"
146+checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
147+dependencies = [
148+ "core-foundation-sys",
149+ "libc",
150+]
151+
152+[[package]]
153+name = "core-foundation-sys"
154+version = "0.8.4"
155+source = "registry+https://github.com/rust-lang/crates.io-index"
156+checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
157+
158+[[package]]
159+name = "core-graphics"
160+version = "0.22.3"
161+source = "registry+https://github.com/rust-lang/crates.io-index"
162+checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
163+dependencies = [
164+ "bitflags 1.3.2",
165+ "core-foundation",
166+ "core-graphics-types",
167+ "foreign-types",
168+ "libc",
169+]
170+
171+[[package]]
172+name = "core-graphics-types"
173+version = "0.1.2"
174+source = "registry+https://github.com/rust-lang/crates.io-index"
175+checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33"
176+dependencies = [
177+ "bitflags 1.3.2",
178+ "core-foundation",
179+ "libc",
180+]
181+
182+[[package]]
183+name = "dispatch"
184+version = "0.2.0"
185+source = "registry+https://github.com/rust-lang/crates.io-index"
186+checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
187+
188+[[package]]
189+name = "dlib"
190+version = "0.5.2"
191+source = "registry+https://github.com/rust-lang/crates.io-index"
192+checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
193+dependencies = [
194+ "libloading",
195+]
196+
197+[[package]]
198+name = "downcast-rs"
199+version = "1.2.0"
200+source = "registry+https://github.com/rust-lang/crates.io-index"
201+checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
202+
203+[[package]]
204+name = "drm-fourcc"
205+version = "2.2.0"
206+source = "registry+https://github.com/rust-lang/crates.io-index"
207+checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4"
208+
209+[[package]]
210+name = "equivalent"
211+version = "1.0.1"
212+source = "registry+https://github.com/rust-lang/crates.io-index"
213+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
214+
215+[[package]]
216+name = "errno"
217+version = "0.3.2"
218+source = "registry+https://github.com/rust-lang/crates.io-index"
219+checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
220+dependencies = [
221+ "errno-dragonfly",
222+ "libc",
223+ "windows-sys 0.48.0",
224+]
225+
226+[[package]]
227+name = "errno-dragonfly"
228+version = "0.1.2"
229+source = "registry+https://github.com/rust-lang/crates.io-index"
230+checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
231+dependencies = [
232+ "cc",
233+ "libc",
234+]
235+
236+[[package]]
237+name = "fastrand"
238+version = "2.0.0"
239+source = "registry+https://github.com/rust-lang/crates.io-index"
240+checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
241+
242+[[package]]
243+name = "foreign-types"
244+version = "0.3.2"
245+source = "registry+https://github.com/rust-lang/crates.io-index"
246+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
247+dependencies = [
248+ "foreign-types-shared",
249+]
250+
251+[[package]]
252+name = "foreign-types-shared"
253+version = "0.1.1"
254+source = "registry+https://github.com/rust-lang/crates.io-index"
255+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
256+
257+[[package]]
258+name = "getrandom"
259+version = "0.2.10"
260+source = "registry+https://github.com/rust-lang/crates.io-index"
261+checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
262+dependencies = [
263+ "cfg-if",
264+ "libc",
265+ "wasi",
266+]
267+
268+[[package]]
269+name = "gl_generator"
270+version = "0.14.0"
271+source = "registry+https://github.com/rust-lang/crates.io-index"
272+checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"
273+dependencies = [
274+ "khronos_api",
275+ "log",
276+ "xml-rs",
277+]
278+
279+[[package]]
280+name = "hashbrown"
281+version = "0.12.3"
282+source = "registry+https://github.com/rust-lang/crates.io-index"
283+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
284+
285+[[package]]
286+name = "hashbrown"
287+version = "0.14.0"
288+source = "registry+https://github.com/rust-lang/crates.io-index"
289+checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
290+
291+[[package]]
292+name = "hermit-abi"
293+version = "0.3.2"
294+source = "registry+https://github.com/rust-lang/crates.io-index"
295+checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
296+
297+[[package]]
298+name = "indexmap"
299+version = "1.9.3"
300+source = "registry+https://github.com/rust-lang/crates.io-index"
301+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
302+dependencies = [
303+ "autocfg",
304+ "hashbrown 0.12.3",
305+]
306+
307+[[package]]
308+name = "indexmap"
309+version = "2.0.0"
310+source = "registry+https://github.com/rust-lang/crates.io-index"
311+checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
312+dependencies = [
313+ "equivalent",
314+ "hashbrown 0.14.0",
315+]
316+
317+[[package]]
318+name = "instant"
319+version = "0.1.12"
320+source = "registry+https://github.com/rust-lang/crates.io-index"
321+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
322+dependencies = [
323+ "cfg-if",
324+ "js-sys",
325+ "wasm-bindgen",
326+ "web-sys",
327+]
328+
329+[[package]]
330+name = "io-lifetimes"
331+version = "1.0.11"
332+source = "registry+https://github.com/rust-lang/crates.io-index"
333+checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
334+dependencies = [
335+ "hermit-abi",
336+ "libc",
337+ "windows-sys 0.48.0",
338+]
339+
340+[[package]]
341+name = "jni-sys"
342+version = "0.3.0"
343+source = "registry+https://github.com/rust-lang/crates.io-index"
344+checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
345+
346+[[package]]
347+name = "jobserver"
348+version = "0.1.26"
349+source = "registry+https://github.com/rust-lang/crates.io-index"
350+checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2"
351+dependencies = [
352+ "libc",
353+]
354+
355+[[package]]
356+name = "js-sys"
357+version = "0.3.64"
358+source = "registry+https://github.com/rust-lang/crates.io-index"
359+checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
360+dependencies = [
361+ "wasm-bindgen",
362+]
363+
364+[[package]]
365+name = "khronos_api"
366+version = "3.1.0"
367+source = "registry+https://github.com/rust-lang/crates.io-index"
368+checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
369+
370+[[package]]
371+name = "lazy_static"
372+version = "1.4.0"
373+source = "registry+https://github.com/rust-lang/crates.io-index"
374+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
375+
376+[[package]]
377+name = "libc"
378+version = "0.2.147"
379+source = "registry+https://github.com/rust-lang/crates.io-index"
380+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
381+
382+[[package]]
383+name = "libloading"
384+version = "0.8.0"
385+source = "registry+https://github.com/rust-lang/crates.io-index"
386+checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb"
387+dependencies = [
388+ "cfg-if",
389+ "windows-sys 0.48.0",
390+]
391+
392+[[package]]
393+name = "linux-raw-sys"
394+version = "0.4.5"
395+source = "registry+https://github.com/rust-lang/crates.io-index"
396+checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
397+
398+[[package]]
399+name = "log"
400+version = "0.4.19"
401+source = "registry+https://github.com/rust-lang/crates.io-index"
402+checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
403+
404+[[package]]
405+name = "matchers"
406+version = "0.1.0"
407+source = "registry+https://github.com/rust-lang/crates.io-index"
408+checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
409+dependencies = [
410+ "regex-automata 0.1.10",
411+]
412+
413+[[package]]
414+name = "memchr"
415+version = "2.5.0"
416+source = "registry+https://github.com/rust-lang/crates.io-index"
417+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
418+
419+[[package]]
420+name = "memmap2"
421+version = "0.5.10"
422+source = "registry+https://github.com/rust-lang/crates.io-index"
423+checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327"
424+dependencies = [
425+ "libc",
426+]
427+
428+[[package]]
429+name = "memmap2"
430+version = "0.7.1"
431+source = "registry+https://github.com/rust-lang/crates.io-index"
432+checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6"
433+dependencies = [
434+ "libc",
435+]
436+
437+[[package]]
438+name = "memoffset"
439+version = "0.6.5"
440+source = "registry+https://github.com/rust-lang/crates.io-index"
441+checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
442+dependencies = [
443+ "autocfg",
444+]
445+
446+[[package]]
447+name = "memoffset"
448+version = "0.7.1"
449+source = "registry+https://github.com/rust-lang/crates.io-index"
450+checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
451+dependencies = [
452+ "autocfg",
453+]
454+
455+[[package]]
456+name = "minimal-lexical"
457+version = "0.2.1"
458+source = "registry+https://github.com/rust-lang/crates.io-index"
459+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
460+
461+[[package]]
462+name = "mio"
463+version = "0.8.8"
464+source = "registry+https://github.com/rust-lang/crates.io-index"
465+checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
466+dependencies = [
467+ "libc",
468+ "log",
469+ "wasi",
470+ "windows-sys 0.48.0",
471+]
472+
473+[[package]]
474+name = "ndk"
475+version = "0.7.0"
476+source = "registry+https://github.com/rust-lang/crates.io-index"
477+checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0"
478+dependencies = [
479+ "bitflags 1.3.2",
480+ "jni-sys",
481+ "ndk-sys",
482+ "num_enum 0.5.11",
483+ "raw-window-handle",
484+ "thiserror",
485+]
486+
487+[[package]]
488+name = "ndk-context"
489+version = "0.1.1"
490+source = "registry+https://github.com/rust-lang/crates.io-index"
491+checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
492+
493+[[package]]
494+name = "ndk-sys"
495+version = "0.4.1+23.1.7779620"
496+source = "registry+https://github.com/rust-lang/crates.io-index"
497+checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3"
498+dependencies = [
499+ "jni-sys",
500+]
501+
502+[[package]]
503+name = "niri"
504+version = "0.1.0"
505+dependencies = [
506+ "bitflags 2.3.3",
507+ "smithay",
508+ "tracing-subscriber",
509+]
510+
511+[[package]]
512+name = "nix"
513+version = "0.24.3"
514+source = "registry+https://github.com/rust-lang/crates.io-index"
515+checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
516+dependencies = [
517+ "bitflags 1.3.2",
518+ "cfg-if",
519+ "libc",
520+ "memoffset 0.6.5",
521+]
522+
523+[[package]]
524+name = "nix"
525+version = "0.25.1"
526+source = "registry+https://github.com/rust-lang/crates.io-index"
527+checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
528+dependencies = [
529+ "autocfg",
530+ "bitflags 1.3.2",
531+ "cfg-if",
532+ "libc",
533+ "memoffset 0.6.5",
534+]
535+
536+[[package]]
537+name = "nix"
538+version = "0.26.2"
539+source = "registry+https://github.com/rust-lang/crates.io-index"
540+checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
541+dependencies = [
542+ "bitflags 1.3.2",
543+ "cfg-if",
544+ "libc",
545+ "memoffset 0.7.1",
546+ "pin-utils",
547+ "static_assertions",
548+]
549+
550+[[package]]
551+name = "nom"
552+version = "7.1.3"
553+source = "registry+https://github.com/rust-lang/crates.io-index"
554+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
555+dependencies = [
556+ "memchr",
557+ "minimal-lexical",
558+]
559+
560+[[package]]
561+name = "nu-ansi-term"
562+version = "0.46.0"
563+source = "registry+https://github.com/rust-lang/crates.io-index"
564+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
565+dependencies = [
566+ "overload",
567+ "winapi",
568+]
569+
570+[[package]]
571+name = "num-traits"
572+version = "0.2.16"
573+source = "registry+https://github.com/rust-lang/crates.io-index"
574+checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
575+dependencies = [
576+ "autocfg",
577+]
578+
579+[[package]]
580+name = "num_enum"
581+version = "0.5.11"
582+source = "registry+https://github.com/rust-lang/crates.io-index"
583+checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9"
584+dependencies = [
585+ "num_enum_derive 0.5.11",
586+]
587+
588+[[package]]
589+name = "num_enum"
590+version = "0.6.1"
591+source = "registry+https://github.com/rust-lang/crates.io-index"
592+checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1"
593+dependencies = [
594+ "num_enum_derive 0.6.1",
595+]
596+
597+[[package]]
598+name = "num_enum_derive"
599+version = "0.5.11"
600+source = "registry+https://github.com/rust-lang/crates.io-index"
601+checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799"
602+dependencies = [
603+ "proc-macro-crate",
604+ "proc-macro2",
605+ "quote",
606+ "syn 1.0.109",
607+]
608+
609+[[package]]
610+name = "num_enum_derive"
611+version = "0.6.1"
612+source = "registry+https://github.com/rust-lang/crates.io-index"
613+checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6"
614+dependencies = [
615+ "proc-macro-crate",
616+ "proc-macro2",
617+ "quote",
618+ "syn 2.0.28",
619+]
620+
621+[[package]]
622+name = "objc-sys"
623+version = "0.2.0-beta.2"
624+source = "registry+https://github.com/rust-lang/crates.io-index"
625+checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7"
626+
627+[[package]]
628+name = "objc2"
629+version = "0.3.0-beta.3.patch-leaks.3"
630+source = "registry+https://github.com/rust-lang/crates.io-index"
631+checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468"
632+dependencies = [
633+ "block2",
634+ "objc-sys",
635+ "objc2-encode",
636+]
637+
638+[[package]]
639+name = "objc2-encode"
640+version = "2.0.0-pre.2"
641+source = "registry+https://github.com/rust-lang/crates.io-index"
642+checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512"
643+dependencies = [
644+ "objc-sys",
645+]
646+
647+[[package]]
648+name = "once_cell"
649+version = "1.18.0"
650+source = "registry+https://github.com/rust-lang/crates.io-index"
651+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
652+
653+[[package]]
654+name = "orbclient"
655+version = "0.3.46"
656+source = "registry+https://github.com/rust-lang/crates.io-index"
657+checksum = "8378ac0dfbd4e7895f2d2c1f1345cab3836910baf3a300b000d04250f0c8428f"
658+dependencies = [
659+ "redox_syscall",
660+]
661+
662+[[package]]
663+name = "overload"
664+version = "0.1.1"
665+source = "registry+https://github.com/rust-lang/crates.io-index"
666+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
667+
668+[[package]]
669+name = "percent-encoding"
670+version = "2.3.0"
671+source = "registry+https://github.com/rust-lang/crates.io-index"
672+checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
673+
674+[[package]]
675+name = "pin-project-lite"
676+version = "0.2.11"
677+source = "registry+https://github.com/rust-lang/crates.io-index"
678+checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c"
679+
680+[[package]]
681+name = "pin-utils"
682+version = "0.1.0"
683+source = "registry+https://github.com/rust-lang/crates.io-index"
684+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
685+
686+[[package]]
687+name = "pkg-config"
688+version = "0.3.27"
689+source = "registry+https://github.com/rust-lang/crates.io-index"
690+checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
691+
692+[[package]]
693+name = "ppv-lite86"
694+version = "0.2.17"
695+source = "registry+https://github.com/rust-lang/crates.io-index"
696+checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
697+
698+[[package]]
699+name = "proc-macro-crate"
700+version = "1.3.1"
701+source = "registry+https://github.com/rust-lang/crates.io-index"
702+checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
703+dependencies = [
704+ "once_cell",
705+ "toml_edit",
706+]
707+
708+[[package]]
709+name = "proc-macro2"
710+version = "1.0.66"
711+source = "registry+https://github.com/rust-lang/crates.io-index"
712+checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
713+dependencies = [
714+ "unicode-ident",
715+]
716+
717+[[package]]
718+name = "profiling"
719+version = "1.0.9"
720+source = "registry+https://github.com/rust-lang/crates.io-index"
721+checksum = "46b2164ebdb1dfeec5e337be164292351e11daf63a05174c6776b2f47460f0c9"
722+dependencies = [
723+ "profiling-procmacros",
724+]
725+
726+[[package]]
727+name = "profiling-procmacros"
728+version = "1.0.9"
729+source = "registry+https://github.com/rust-lang/crates.io-index"
730+checksum = "097bf8b99121dfb8c75eed54dfbdbdb1d53e372c53d2353e8a15aad2a479249d"
731+dependencies = [
732+ "quote",
733+ "syn 2.0.28",
734+]
735+
736+[[package]]
737+name = "quick-xml"
738+version = "0.28.2"
739+source = "registry+https://github.com/rust-lang/crates.io-index"
740+checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
741+dependencies = [
742+ "memchr",
743+]
744+
745+[[package]]
746+name = "quote"
747+version = "1.0.32"
748+source = "registry+https://github.com/rust-lang/crates.io-index"
749+checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
750+dependencies = [
751+ "proc-macro2",
752+]
753+
754+[[package]]
755+name = "rand"
756+version = "0.8.5"
757+source = "registry+https://github.com/rust-lang/crates.io-index"
758+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
759+dependencies = [
760+ "libc",
761+ "rand_chacha",
762+ "rand_core",
763+]
764+
765+[[package]]
766+name = "rand_chacha"
767+version = "0.3.1"
768+source = "registry+https://github.com/rust-lang/crates.io-index"
769+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
770+dependencies = [
771+ "ppv-lite86",
772+ "rand_core",
773+]
774+
775+[[package]]
776+name = "rand_core"
777+version = "0.6.4"
778+source = "registry+https://github.com/rust-lang/crates.io-index"
779+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
780+dependencies = [
781+ "getrandom",
782+]
783+
784+[[package]]
785+name = "raw-window-handle"
786+version = "0.5.2"
787+source = "registry+https://github.com/rust-lang/crates.io-index"
788+checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
789+
790+[[package]]
791+name = "redox_syscall"
792+version = "0.3.5"
793+source = "registry+https://github.com/rust-lang/crates.io-index"
794+checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
795+dependencies = [
796+ "bitflags 1.3.2",
797+]
798+
799+[[package]]
800+name = "regex"
801+version = "1.9.3"
802+source = "registry+https://github.com/rust-lang/crates.io-index"
803+checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a"
804+dependencies = [
805+ "aho-corasick",
806+ "memchr",
807+ "regex-automata 0.3.6",
808+ "regex-syntax 0.7.4",
809+]
810+
811+[[package]]
812+name = "regex-automata"
813+version = "0.1.10"
814+source = "registry+https://github.com/rust-lang/crates.io-index"
815+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
816+dependencies = [
817+ "regex-syntax 0.6.29",
818+]
819+
820+[[package]]
821+name = "regex-automata"
822+version = "0.3.6"
823+source = "registry+https://github.com/rust-lang/crates.io-index"
824+checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69"
825+dependencies = [
826+ "aho-corasick",
827+ "memchr",
828+ "regex-syntax 0.7.4",
829+]
830+
831+[[package]]
832+name = "regex-syntax"
833+version = "0.6.29"
834+source = "registry+https://github.com/rust-lang/crates.io-index"
835+checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
836+
837+[[package]]
838+name = "regex-syntax"
839+version = "0.7.4"
840+source = "registry+https://github.com/rust-lang/crates.io-index"
841+checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
842+
843+[[package]]
844+name = "rustix"
845+version = "0.38.7"
846+source = "registry+https://github.com/rust-lang/crates.io-index"
847+checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399"
848+dependencies = [
849+ "bitflags 2.3.3",
850+ "errno",
851+ "libc",
852+ "linux-raw-sys",
853+ "windows-sys 0.48.0",
854+]
855+
856+[[package]]
857+name = "scan_fmt"
858+version = "0.2.6"
859+source = "registry+https://github.com/rust-lang/crates.io-index"
860+checksum = "0b53b0a5db882a8e2fdaae0a43f7b39e7e9082389e978398bdf223a55b581248"
861+
862+[[package]]
863+name = "scoped-tls"
864+version = "1.0.1"
865+source = "registry+https://github.com/rust-lang/crates.io-index"
866+checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
867+
868+[[package]]
869+name = "sharded-slab"
870+version = "0.1.4"
871+source = "registry+https://github.com/rust-lang/crates.io-index"
872+checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
873+dependencies = [
874+ "lazy_static",
875+]
876+
877+[[package]]
878+name = "slotmap"
879+version = "1.0.6"
880+source = "registry+https://github.com/rust-lang/crates.io-index"
881+checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342"
882+dependencies = [
883+ "version_check",
884+]
885+
886+[[package]]
887+name = "smallvec"
888+version = "1.11.0"
889+source = "registry+https://github.com/rust-lang/crates.io-index"
890+checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
891+
892+[[package]]
893+name = "smithay"
894+version = "0.3.0"
895+source = "git+https://github.com/Smithay/smithay#02ccc8ca17fbc655d2247124fe628d276cb5179a"
896+dependencies = [
897+ "appendlist",
898+ "bitflags 2.3.3",
899+ "calloop",
900+ "cgmath",
901+ "downcast-rs",
902+ "drm-fourcc",
903+ "gl_generator",
904+ "indexmap 1.9.3",
905+ "lazy_static",
906+ "libc",
907+ "libloading",
908+ "nix 0.26.2",
909+ "once_cell",
910+ "profiling",
911+ "rand",
912+ "scan_fmt",
913+ "tempfile",
914+ "thiserror",
915+ "tracing",
916+ "wayland-egl",
917+ "wayland-protocols 0.30.1",
918+ "wayland-protocols-misc",
919+ "wayland-protocols-wlr",
920+ "wayland-server",
921+ "winit",
922+ "xkbcommon",
923+]
924+
925+[[package]]
926+name = "smithay-client-toolkit"
927+version = "0.16.0"
928+source = "registry+https://github.com/rust-lang/crates.io-index"
929+checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454"
930+dependencies = [
931+ "bitflags 1.3.2",
932+ "calloop",
933+ "dlib",
934+ "lazy_static",
935+ "log",
936+ "memmap2 0.5.10",
937+ "nix 0.24.3",
938+ "pkg-config",
939+ "wayland-client",
940+ "wayland-cursor",
941+ "wayland-protocols 0.29.5",
942+]
943+
944+[[package]]
945+name = "static_assertions"
946+version = "1.1.0"
947+source = "registry+https://github.com/rust-lang/crates.io-index"
948+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
949+
950+[[package]]
951+name = "syn"
952+version = "1.0.109"
953+source = "registry+https://github.com/rust-lang/crates.io-index"
954+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
955+dependencies = [
956+ "proc-macro2",
957+ "quote",
958+ "unicode-ident",
959+]
960+
961+[[package]]
962+name = "syn"
963+version = "2.0.28"
964+source = "registry+https://github.com/rust-lang/crates.io-index"
965+checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
966+dependencies = [
967+ "proc-macro2",
968+ "quote",
969+ "unicode-ident",
970+]
971+
972+[[package]]
973+name = "tempfile"
974+version = "3.7.1"
975+source = "registry+https://github.com/rust-lang/crates.io-index"
976+checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651"
977+dependencies = [
978+ "cfg-if",
979+ "fastrand",
980+ "redox_syscall",
981+ "rustix",
982+ "windows-sys 0.48.0",
983+]
984+
985+[[package]]
986+name = "thiserror"
987+version = "1.0.44"
988+source = "registry+https://github.com/rust-lang/crates.io-index"
989+checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
990+dependencies = [
991+ "thiserror-impl",
992+]
993+
994+[[package]]
995+name = "thiserror-impl"
996+version = "1.0.44"
997+source = "registry+https://github.com/rust-lang/crates.io-index"
998+checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
999+dependencies = [
1000+ "proc-macro2",
1001+ "quote",
1002+ "syn 2.0.28",
1003+]
1004+
1005+[[package]]
1006+name = "thread_local"
1007+version = "1.1.7"
1008+source = "registry+https://github.com/rust-lang/crates.io-index"
1009+checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
1010+dependencies = [
1011+ "cfg-if",
1012+ "once_cell",
1013+]
1014+
1015+[[package]]
1016+name = "toml_datetime"
1017+version = "0.6.3"
1018+source = "registry+https://github.com/rust-lang/crates.io-index"
1019+checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
1020+
1021+[[package]]
1022+name = "toml_edit"
1023+version = "0.19.14"
1024+source = "registry+https://github.com/rust-lang/crates.io-index"
1025+checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a"
1026+dependencies = [
1027+ "indexmap 2.0.0",
1028+ "toml_datetime",
1029+ "winnow",
1030+]
1031+
1032+[[package]]
1033+name = "tracing"
1034+version = "0.1.37"
1035+source = "registry+https://github.com/rust-lang/crates.io-index"
1036+checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
1037+dependencies = [
1038+ "cfg-if",
1039+ "pin-project-lite",
1040+ "tracing-attributes",
1041+ "tracing-core",
1042+]
1043+
1044+[[package]]
1045+name = "tracing-attributes"
1046+version = "0.1.26"
1047+source = "registry+https://github.com/rust-lang/crates.io-index"
1048+checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
1049+dependencies = [
1050+ "proc-macro2",
1051+ "quote",
1052+ "syn 2.0.28",
1053+]
1054+
1055+[[package]]
1056+name = "tracing-core"
1057+version = "0.1.31"
1058+source = "registry+https://github.com/rust-lang/crates.io-index"
1059+checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
1060+dependencies = [
1061+ "once_cell",
1062+ "valuable",
1063+]
1064+
1065+[[package]]
1066+name = "tracing-log"
1067+version = "0.1.3"
1068+source = "registry+https://github.com/rust-lang/crates.io-index"
1069+checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
1070+dependencies = [
1071+ "lazy_static",
1072+ "log",
1073+ "tracing-core",
1074+]
1075+
1076+[[package]]
1077+name = "tracing-subscriber"
1078+version = "0.3.17"
1079+source = "registry+https://github.com/rust-lang/crates.io-index"
1080+checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
1081+dependencies = [
1082+ "matchers",
1083+ "nu-ansi-term",
1084+ "once_cell",
1085+ "regex",
1086+ "sharded-slab",
1087+ "smallvec",
1088+ "thread_local",
1089+ "tracing",
1090+ "tracing-core",
1091+ "tracing-log",
1092+]
1093+
1094+[[package]]
1095+name = "unicode-ident"
1096+version = "1.0.11"
1097+source = "registry+https://github.com/rust-lang/crates.io-index"
1098+checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
1099+
1100+[[package]]
1101+name = "valuable"
1102+version = "0.1.0"
1103+source = "registry+https://github.com/rust-lang/crates.io-index"
1104+checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
1105+
1106+[[package]]
1107+name = "vec_map"
1108+version = "0.8.2"
1109+source = "registry+https://github.com/rust-lang/crates.io-index"
1110+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
1111+
1112+[[package]]
1113+name = "version_check"
1114+version = "0.9.4"
1115+source = "registry+https://github.com/rust-lang/crates.io-index"
1116+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
1117+
1118+[[package]]
1119+name = "wasi"
1120+version = "0.11.0+wasi-snapshot-preview1"
1121+source = "registry+https://github.com/rust-lang/crates.io-index"
1122+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
1123+
1124+[[package]]
1125+name = "wasm-bindgen"
1126+version = "0.2.87"
1127+source = "registry+https://github.com/rust-lang/crates.io-index"
1128+checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
1129+dependencies = [
1130+ "cfg-if",
1131+ "wasm-bindgen-macro",
1132+]
1133+
1134+[[package]]
1135+name = "wasm-bindgen-backend"
1136+version = "0.2.87"
1137+source = "registry+https://github.com/rust-lang/crates.io-index"
1138+checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
1139+dependencies = [
1140+ "bumpalo",
1141+ "log",
1142+ "once_cell",
1143+ "proc-macro2",
1144+ "quote",
1145+ "syn 2.0.28",
1146+ "wasm-bindgen-shared",
1147+]
1148+
1149+[[package]]
1150+name = "wasm-bindgen-macro"
1151+version = "0.2.87"
1152+source = "registry+https://github.com/rust-lang/crates.io-index"
1153+checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
1154+dependencies = [
1155+ "quote",
1156+ "wasm-bindgen-macro-support",
1157+]
1158+
1159+[[package]]
1160+name = "wasm-bindgen-macro-support"
1161+version = "0.2.87"
1162+source = "registry+https://github.com/rust-lang/crates.io-index"
1163+checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
1164+dependencies = [
1165+ "proc-macro2",
1166+ "quote",
1167+ "syn 2.0.28",
1168+ "wasm-bindgen-backend",
1169+ "wasm-bindgen-shared",
1170+]
1171+
1172+[[package]]
1173+name = "wasm-bindgen-shared"
1174+version = "0.2.87"
1175+source = "registry+https://github.com/rust-lang/crates.io-index"
1176+checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
1177+
1178+[[package]]
1179+name = "wayland-backend"
1180+version = "0.1.2"
1181+source = "registry+https://github.com/rust-lang/crates.io-index"
1182+checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8"
1183+dependencies = [
1184+ "cc",
1185+ "downcast-rs",
1186+ "io-lifetimes",
1187+ "nix 0.26.2",
1188+ "scoped-tls",
1189+ "smallvec",
1190+ "wayland-sys 0.30.1",
1191+]
1192+
1193+[[package]]
1194+name = "wayland-client"
1195+version = "0.29.5"
1196+source = "registry+https://github.com/rust-lang/crates.io-index"
1197+checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715"
1198+dependencies = [
1199+ "bitflags 1.3.2",
1200+ "downcast-rs",
1201+ "libc",
1202+ "nix 0.24.3",
1203+ "scoped-tls",
1204+ "wayland-commons",
1205+ "wayland-scanner 0.29.5",
1206+ "wayland-sys 0.29.5",
1207+]
1208+
1209+[[package]]
1210+name = "wayland-commons"
1211+version = "0.29.5"
1212+source = "registry+https://github.com/rust-lang/crates.io-index"
1213+checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
1214+dependencies = [
1215+ "nix 0.24.3",
1216+ "once_cell",
1217+ "smallvec",
1218+ "wayland-sys 0.29.5",
1219+]
1220+
1221+[[package]]
1222+name = "wayland-cursor"
1223+version = "0.29.5"
1224+source = "registry+https://github.com/rust-lang/crates.io-index"
1225+checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
1226+dependencies = [
1227+ "nix 0.24.3",
1228+ "wayland-client",
1229+ "xcursor",
1230+]
1231+
1232+[[package]]
1233+name = "wayland-egl"
1234+version = "0.30.0"
1235+source = "registry+https://github.com/rust-lang/crates.io-index"
1236+checksum = "1187695fe81c3153c3163f9d2953149f638c5d7dbc6fe988914ca3f4961e28ed"
1237+dependencies = [
1238+ "wayland-backend",
1239+ "wayland-sys 0.30.1",
1240+]
1241+
1242+[[package]]
1243+name = "wayland-protocols"
1244+version = "0.29.5"
1245+source = "registry+https://github.com/rust-lang/crates.io-index"
1246+checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6"
1247+dependencies = [
1248+ "bitflags 1.3.2",
1249+ "wayland-client",
1250+ "wayland-commons",
1251+ "wayland-scanner 0.29.5",
1252+]
1253+
1254+[[package]]
1255+name = "wayland-protocols"
1256+version = "0.30.1"
1257+source = "registry+https://github.com/rust-lang/crates.io-index"
1258+checksum = "3b28101e5ca94f70461a6c2d610f76d85ad223d042dd76585ab23d3422dd9b4d"
1259+dependencies = [
1260+ "bitflags 1.3.2",
1261+ "wayland-backend",
1262+ "wayland-scanner 0.30.1",
1263+ "wayland-server",
1264+]
1265+
1266+[[package]]
1267+name = "wayland-protocols-misc"
1268+version = "0.1.0"
1269+source = "registry+https://github.com/rust-lang/crates.io-index"
1270+checksum = "897d4e99645e1ed9245e9e6b5efa78828d2b23b661016d63d55251243d812f8b"
1271+dependencies = [
1272+ "bitflags 1.3.2",
1273+ "wayland-backend",
1274+ "wayland-protocols 0.30.1",
1275+ "wayland-scanner 0.30.1",
1276+ "wayland-server",
1277+]
1278+
1279+[[package]]
1280+name = "wayland-protocols-wlr"
1281+version = "0.1.0"
1282+source = "registry+https://github.com/rust-lang/crates.io-index"
1283+checksum = "fce991093320e4a6a525876e6b629ab24da25f9baef0c2e0080ad173ec89588a"
1284+dependencies = [
1285+ "bitflags 1.3.2",
1286+ "wayland-backend",
1287+ "wayland-protocols 0.30.1",
1288+ "wayland-scanner 0.30.1",
1289+ "wayland-server",
1290+]
1291+
1292+[[package]]
1293+name = "wayland-scanner"
1294+version = "0.29.5"
1295+source = "registry+https://github.com/rust-lang/crates.io-index"
1296+checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53"
1297+dependencies = [
1298+ "proc-macro2",
1299+ "quote",
1300+ "xml-rs",
1301+]
1302+
1303+[[package]]
1304+name = "wayland-scanner"
1305+version = "0.30.1"
1306+source = "registry+https://github.com/rust-lang/crates.io-index"
1307+checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e"
1308+dependencies = [
1309+ "proc-macro2",
1310+ "quick-xml",
1311+ "quote",
1312+]
1313+
1314+[[package]]
1315+name = "wayland-server"
1316+version = "0.30.1"
1317+source = "registry+https://github.com/rust-lang/crates.io-index"
1318+checksum = "9c43c28096fe1d49fff7d1079404fdd0f669cd1a5b00c615bdfe71bb1884d23a"
1319+dependencies = [
1320+ "bitflags 1.3.2",
1321+ "downcast-rs",
1322+ "io-lifetimes",
1323+ "nix 0.26.2",
1324+ "wayland-backend",
1325+ "wayland-scanner 0.30.1",
1326+]
1327+
1328+[[package]]
1329+name = "wayland-sys"
1330+version = "0.29.5"
1331+source = "registry+https://github.com/rust-lang/crates.io-index"
1332+checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4"
1333+dependencies = [
1334+ "dlib",
1335+ "lazy_static",
1336+ "pkg-config",
1337+]
1338+
1339+[[package]]
1340+name = "wayland-sys"
1341+version = "0.30.1"
1342+source = "registry+https://github.com/rust-lang/crates.io-index"
1343+checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06"
1344+dependencies = [
1345+ "dlib",
1346+ "log",
1347+ "pkg-config",
1348+]
1349+
1350+[[package]]
1351+name = "web-sys"
1352+version = "0.3.64"
1353+source = "registry+https://github.com/rust-lang/crates.io-index"
1354+checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
1355+dependencies = [
1356+ "js-sys",
1357+ "wasm-bindgen",
1358+]
1359+
1360+[[package]]
1361+name = "winapi"
1362+version = "0.3.9"
1363+source = "registry+https://github.com/rust-lang/crates.io-index"
1364+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1365+dependencies = [
1366+ "winapi-i686-pc-windows-gnu",
1367+ "winapi-x86_64-pc-windows-gnu",
1368+]
1369+
1370+[[package]]
1371+name = "winapi-i686-pc-windows-gnu"
1372+version = "0.4.0"
1373+source = "registry+https://github.com/rust-lang/crates.io-index"
1374+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1375+
1376+[[package]]
1377+name = "winapi-x86_64-pc-windows-gnu"
1378+version = "0.4.0"
1379+source = "registry+https://github.com/rust-lang/crates.io-index"
1380+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1381+
1382+[[package]]
1383+name = "windows-sys"
1384+version = "0.45.0"
1385+source = "registry+https://github.com/rust-lang/crates.io-index"
1386+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
1387+dependencies = [
1388+ "windows-targets 0.42.2",
1389+]
1390+
1391+[[package]]
1392+name = "windows-sys"
1393+version = "0.48.0"
1394+source = "registry+https://github.com/rust-lang/crates.io-index"
1395+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
1396+dependencies = [
1397+ "windows-targets 0.48.1",
1398+]
1399+
1400+[[package]]
1401+name = "windows-targets"
1402+version = "0.42.2"
1403+source = "registry+https://github.com/rust-lang/crates.io-index"
1404+checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
1405+dependencies = [
1406+ "windows_aarch64_gnullvm 0.42.2",
1407+ "windows_aarch64_msvc 0.42.2",
1408+ "windows_i686_gnu 0.42.2",
1409+ "windows_i686_msvc 0.42.2",
1410+ "windows_x86_64_gnu 0.42.2",
1411+ "windows_x86_64_gnullvm 0.42.2",
1412+ "windows_x86_64_msvc 0.42.2",
1413+]
1414+
1415+[[package]]
1416+name = "windows-targets"
1417+version = "0.48.1"
1418+source = "registry+https://github.com/rust-lang/crates.io-index"
1419+checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
1420+dependencies = [
1421+ "windows_aarch64_gnullvm 0.48.0",
1422+ "windows_aarch64_msvc 0.48.0",
1423+ "windows_i686_gnu 0.48.0",
1424+ "windows_i686_msvc 0.48.0",
1425+ "windows_x86_64_gnu 0.48.0",
1426+ "windows_x86_64_gnullvm 0.48.0",
1427+ "windows_x86_64_msvc 0.48.0",
1428+]
1429+
1430+[[package]]
1431+name = "windows_aarch64_gnullvm"
1432+version = "0.42.2"
1433+source = "registry+https://github.com/rust-lang/crates.io-index"
1434+checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
1435+
1436+[[package]]
1437+name = "windows_aarch64_gnullvm"
1438+version = "0.48.0"
1439+source = "registry+https://github.com/rust-lang/crates.io-index"
1440+checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
1441+
1442+[[package]]
1443+name = "windows_aarch64_msvc"
1444+version = "0.42.2"
1445+source = "registry+https://github.com/rust-lang/crates.io-index"
1446+checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
1447+
1448+[[package]]
1449+name = "windows_aarch64_msvc"
1450+version = "0.48.0"
1451+source = "registry+https://github.com/rust-lang/crates.io-index"
1452+checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
1453+
1454+[[package]]
1455+name = "windows_i686_gnu"
1456+version = "0.42.2"
1457+source = "registry+https://github.com/rust-lang/crates.io-index"
1458+checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
1459+
1460+[[package]]
1461+name = "windows_i686_gnu"
1462+version = "0.48.0"
1463+source = "registry+https://github.com/rust-lang/crates.io-index"
1464+checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
1465+
1466+[[package]]
1467+name = "windows_i686_msvc"
1468+version = "0.42.2"
1469+source = "registry+https://github.com/rust-lang/crates.io-index"
1470+checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
1471+
1472+[[package]]
1473+name = "windows_i686_msvc"
1474+version = "0.48.0"
1475+source = "registry+https://github.com/rust-lang/crates.io-index"
1476+checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
1477+
1478+[[package]]
1479+name = "windows_x86_64_gnu"
1480+version = "0.42.2"
1481+source = "registry+https://github.com/rust-lang/crates.io-index"
1482+checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
1483+
1484+[[package]]
1485+name = "windows_x86_64_gnu"
1486+version = "0.48.0"
1487+source = "registry+https://github.com/rust-lang/crates.io-index"
1488+checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
1489+
1490+[[package]]
1491+name = "windows_x86_64_gnullvm"
1492+version = "0.42.2"
1493+source = "registry+https://github.com/rust-lang/crates.io-index"
1494+checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
1495+
1496+[[package]]
1497+name = "windows_x86_64_gnullvm"
1498+version = "0.48.0"
1499+source = "registry+https://github.com/rust-lang/crates.io-index"
1500+checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
1501+
1502+[[package]]
1503+name = "windows_x86_64_msvc"
1504+version = "0.42.2"
1505+source = "registry+https://github.com/rust-lang/crates.io-index"
1506+checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
1507+
1508+[[package]]
1509+name = "windows_x86_64_msvc"
1510+version = "0.48.0"
1511+source = "registry+https://github.com/rust-lang/crates.io-index"
1512+checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
1513+
1514+[[package]]
1515+name = "winit"
1516+version = "0.28.6"
1517+source = "registry+https://github.com/rust-lang/crates.io-index"
1518+checksum = "866db3f712fffba75d31bf0cdecf357c8aeafd158c5b7ab51dba2a2b2d47f196"
1519+dependencies = [
1520+ "android-activity",
1521+ "bitflags 1.3.2",
1522+ "cfg_aliases",
1523+ "core-foundation",
1524+ "core-graphics",
1525+ "dispatch",
1526+ "instant",
1527+ "libc",
1528+ "log",
1529+ "mio",
1530+ "ndk",
1531+ "objc2",
1532+ "once_cell",
1533+ "orbclient",
1534+ "percent-encoding",
1535+ "raw-window-handle",
1536+ "redox_syscall",
1537+ "smithay-client-toolkit",
1538+ "wasm-bindgen",
1539+ "wayland-client",
1540+ "wayland-commons",
1541+ "wayland-protocols 0.29.5",
1542+ "wayland-scanner 0.29.5",
1543+ "web-sys",
1544+ "windows-sys 0.45.0",
1545+ "x11-dl",
1546+]
1547+
1548+[[package]]
1549+name = "winnow"
1550+version = "0.5.4"
1551+source = "registry+https://github.com/rust-lang/crates.io-index"
1552+checksum = "acaaa1190073b2b101e15083c38ee8ec891b5e05cbee516521e94ec008f61e64"
1553+dependencies = [
1554+ "memchr",
1555+]
1556+
1557+[[package]]
1558+name = "x11-dl"
1559+version = "2.21.0"
1560+source = "registry+https://github.com/rust-lang/crates.io-index"
1561+checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"
1562+dependencies = [
1563+ "libc",
1564+ "once_cell",
1565+ "pkg-config",
1566+]
1567+
1568+[[package]]
1569+name = "xcursor"
1570+version = "0.3.4"
1571+source = "registry+https://github.com/rust-lang/crates.io-index"
1572+checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7"
1573+dependencies = [
1574+ "nom",
1575+]
1576+
1577+[[package]]
1578+name = "xkbcommon"
1579+version = "0.5.1"
1580+source = "registry+https://github.com/rust-lang/crates.io-index"
1581+checksum = "52db25b599e92bf6e3904134618728eeb7b49a5a4f38f107f92399bb9c496b88"
1582+dependencies = [
1583+ "libc",
1584+ "memmap2 0.7.1",
1585+]
1586+
1587+[[package]]
1588+name = "xml-rs"
1589+version = "0.8.16"
1590+source = "registry+https://github.com/rust-lang/crates.io-index"
1591+checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1"
Cargo.tomladded+17 -0
@@ -0,0 +1,17 @@
1+[package]
2+name = "niri"
3+version = "0.1.0"
4+edition = "2021"
5+
6+[dependencies]
7+tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
8+bitflags = "2.2.1"
9+
10+[dependencies.smithay]
11+git = "https://github.com/Smithay/smithay"
12+default-features = false
13+features = [
14+ "backend_winit",
15+ "wayland_frontend",
16+ "desktop",
17+]
src/grabs/mod.rsadded+5 -0
@@ -0,0 +1,5 @@
1+pub mod move_grab;
2+pub use move_grab::MoveSurfaceGrab;
3+
4+pub mod resize_grab;
5+pub use resize_grab::ResizeSurfaceGrab;
src/grabs/move_grab.rsadded+75 -0
@@ -0,0 +1,75 @@
1+use crate::Smallvil;
2+use smithay::{
3+ desktop::Window,
4+ input::pointer::{
5+ AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
6+ PointerInnerHandle, RelativeMotionEvent,
7+ },
8+ reexports::wayland_server::protocol::wl_surface::WlSurface,
9+ utils::{Logical, Point},
10+};
11+
12+pub struct MoveSurfaceGrab {
13+ pub start_data: PointerGrabStartData<Smallvil>,
14+ pub window: Window,
15+ pub initial_window_location: Point<i32, Logical>,
16+}
17+
18+impl PointerGrab<Smallvil> for MoveSurfaceGrab {
19+ fn motion(
20+ &mut self,
21+ data: &mut Smallvil,
22+ handle: &mut PointerInnerHandle<'_, Smallvil>,
23+ _focus: Option<(WlSurface, Point<i32, Logical>)>,
24+ event: &MotionEvent,
25+ ) {
26+ // While the grab is active, no client has pointer focus
27+ handle.motion(data, None, event);
28+
29+ let delta = event.location - self.start_data.location;
30+ let new_location = self.initial_window_location.to_f64() + delta;
31+ data.space
32+ .map_element(self.window.clone(), new_location.to_i32_round(), true);
33+ }
34+
35+ fn relative_motion(
36+ &mut self,
37+ data: &mut Smallvil,
38+ handle: &mut PointerInnerHandle<'_, Smallvil>,
39+ focus: Option<(WlSurface, Point<i32, Logical>)>,
40+ event: &RelativeMotionEvent,
41+ ) {
42+ handle.relative_motion(data, focus, event);
43+ }
44+
45+ fn button(
46+ &mut self,
47+ data: &mut Smallvil,
48+ handle: &mut PointerInnerHandle<'_, Smallvil>,
49+ event: &ButtonEvent,
50+ ) {
51+ handle.button(data, event);
52+
53+ // The button is a button code as defined in the
54+ // Linux kernel's linux/input-event-codes.h header file, e.g. BTN_LEFT.
55+ const BTN_LEFT: u32 = 0x110;
56+
57+ if !handle.current_pressed().contains(&BTN_LEFT) {
58+ // No more buttons are pressed, release the grab.
59+ handle.unset_grab(data, event.serial, event.time);
60+ }
61+ }
62+
63+ fn axis(
64+ &mut self,
65+ data: &mut Smallvil,
66+ handle: &mut PointerInnerHandle<'_, Smallvil>,
67+ details: AxisFrame,
68+ ) {
69+ handle.axis(data, details)
70+ }
71+
72+ fn start_data(&self) -> &PointerGrabStartData<Smallvil> {
73+ &self.start_data
74+ }
75+}
src/grabs/resize_grab.rsadded+278 -0
@@ -0,0 +1,278 @@
1+use crate::Smallvil;
2+use smithay::{
3+ desktop::{Space, Window},
4+ input::pointer::{
5+ AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
6+ PointerInnerHandle, RelativeMotionEvent,
7+ },
8+ reexports::{
9+ wayland_protocols::xdg::shell::server::xdg_toplevel, wayland_server::protocol::wl_surface::WlSurface,
10+ },
11+ utils::{Logical, Point, Rectangle, Size},
12+ wayland::{compositor, shell::xdg::SurfaceCachedState},
13+};
14+use std::cell::RefCell;
15+
16+bitflags::bitflags! {
17+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
18+ pub struct ResizeEdge: u32 {
19+ const TOP = 0b0001;
20+ const BOTTOM = 0b0010;
21+ const LEFT = 0b0100;
22+ const RIGHT = 0b1000;
23+
24+ const TOP_LEFT = Self::TOP.bits() | Self::LEFT.bits();
25+ const BOTTOM_LEFT = Self::BOTTOM.bits() | Self::LEFT.bits();
26+
27+ const TOP_RIGHT = Self::TOP.bits() | Self::RIGHT.bits();
28+ const BOTTOM_RIGHT = Self::BOTTOM.bits() | Self::RIGHT.bits();
29+ }
30+}
31+
32+impl From<xdg_toplevel::ResizeEdge> for ResizeEdge {
33+ #[inline]
34+ fn from(x: xdg_toplevel::ResizeEdge) -> Self {
35+ Self::from_bits(x as u32).unwrap()
36+ }
37+}
38+
39+pub struct ResizeSurfaceGrab {
40+ start_data: PointerGrabStartData<Smallvil>,
41+ window: Window,
42+
43+ edges: ResizeEdge,
44+
45+ initial_rect: Rectangle<i32, Logical>,
46+ last_window_size: Size<i32, Logical>,
47+}
48+
49+impl ResizeSurfaceGrab {
50+ pub fn start(
51+ start_data: PointerGrabStartData<Smallvil>,
52+ window: Window,
53+ edges: ResizeEdge,
54+ initial_window_rect: Rectangle<i32, Logical>,
55+ ) -> Self {
56+ let initial_rect = initial_window_rect;
57+
58+ ResizeSurfaceState::with(window.toplevel().wl_surface(), |state| {
59+ *state = ResizeSurfaceState::Resizing { edges, initial_rect };
60+ });
61+
62+ Self {
63+ start_data,
64+ window,
65+ edges,
66+ initial_rect,
67+ last_window_size: initial_rect.size,
68+ }
69+ }
70+}
71+
72+impl PointerGrab<Smallvil> for ResizeSurfaceGrab {
73+ fn motion(
74+ &mut self,
75+ data: &mut Smallvil,
76+ handle: &mut PointerInnerHandle<'_, Smallvil>,
77+ _focus: Option<(WlSurface, Point<i32, Logical>)>,
78+ event: &MotionEvent,
79+ ) {
80+ // While the grab is active, no client has pointer focus
81+ handle.motion(data, None, event);
82+
83+ let mut delta = event.location - self.start_data.location;
84+
85+ let mut new_window_width = self.initial_rect.size.w;
86+ let mut new_window_height = self.initial_rect.size.h;
87+
88+ if self.edges.intersects(ResizeEdge::LEFT | ResizeEdge::RIGHT) {
89+ if self.edges.intersects(ResizeEdge::LEFT) {
90+ delta.x = -delta.x;
91+ }
92+
93+ new_window_width = (self.initial_rect.size.w as f64 + delta.x) as i32;
94+ }
95+
96+ if self.edges.intersects(ResizeEdge::TOP | ResizeEdge::BOTTOM) {
97+ if self.edges.intersects(ResizeEdge::TOP) {
98+ delta.y = -delta.y;
99+ }
100+
101+ new_window_height = (self.initial_rect.size.h as f64 + delta.y) as i32;
102+ }
103+
104+ let (min_size, max_size) = compositor::with_states(self.window.toplevel().wl_surface(), |states| {
105+ let data = states.cached_state.current::<SurfaceCachedState>();
106+ (data.min_size, data.max_size)
107+ });
108+
109+ let min_width = min_size.w.max(1);
110+ let min_height = min_size.h.max(1);
111+
112+ let max_width = (max_size.w == 0).then(i32::max_value).unwrap_or(max_size.w);
113+ let max_height = (max_size.h == 0).then(i32::max_value).unwrap_or(max_size.h);
114+
115+ self.last_window_size = Size::from((
116+ new_window_width.max(min_width).min(max_width),
117+ new_window_height.max(min_height).min(max_height),
118+ ));
119+
120+ let xdg = self.window.toplevel();
121+ xdg.with_pending_state(|state| {
122+ state.states.set(xdg_toplevel::State::Resizing);
123+ state.size = Some(self.last_window_size);
124+ });
125+
126+ xdg.send_pending_configure();
127+ }
128+
129+ fn relative_motion(
130+ &mut self,
131+ data: &mut Smallvil,
132+ handle: &mut PointerInnerHandle<'_, Smallvil>,
133+ focus: Option<(WlSurface, Point<i32, Logical>)>,
134+ event: &RelativeMotionEvent,
135+ ) {
136+ handle.relative_motion(data, focus, event);
137+ }
138+
139+ fn button(
140+ &mut self,
141+ data: &mut Smallvil,
142+ handle: &mut PointerInnerHandle<'_, Smallvil>,
143+ event: &ButtonEvent,
144+ ) {
145+ handle.button(data, event);
146+
147+ // The button is a button code as defined in the
148+ // Linux kernel's linux/input-event-codes.h header file, e.g. BTN_LEFT.
149+ const BTN_LEFT: u32 = 0x110;
150+
151+ if !handle.current_pressed().contains(&BTN_LEFT) {
152+ // No more buttons are pressed, release the grab.
153+ handle.unset_grab(data, event.serial, event.time);
154+
155+ let xdg = self.window.toplevel();
156+ xdg.with_pending_state(|state| {
157+ state.states.unset(xdg_toplevel::State::Resizing);
158+ state.size = Some(self.last_window_size);
159+ });
160+
161+ xdg.send_pending_configure();
162+
163+ ResizeSurfaceState::with(xdg.wl_surface(), |state| {
164+ *state = ResizeSurfaceState::WaitingForLastCommit {
165+ edges: self.edges,
166+ initial_rect: self.initial_rect,
167+ };
168+ });
169+ }
170+ }
171+
172+ fn axis(
173+ &mut self,
174+ data: &mut Smallvil,
175+ handle: &mut PointerInnerHandle<'_, Smallvil>,
176+ details: AxisFrame,
177+ ) {
178+ handle.axis(data, details)
179+ }
180+
181+ fn start_data(&self) -> &PointerGrabStartData<Smallvil> {
182+ &self.start_data
183+ }
184+}
185+
186+/// State of the resize operation.
187+///
188+/// It is stored inside of WlSurface,
189+/// and can be accessed using [`ResizeSurfaceState::with`]
190+#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
191+enum ResizeSurfaceState {
192+ #[default]
193+ Idle,
194+ Resizing {
195+ edges: ResizeEdge,
196+ /// The initial window size and location.
197+ initial_rect: Rectangle<i32, Logical>,
198+ },
199+ /// Resize is done, we are now waiting for last commit, to do the final move
200+ WaitingForLastCommit {
201+ edges: ResizeEdge,
202+ /// The initial window size and location.
203+ initial_rect: Rectangle<i32, Logical>,
204+ },
205+}
206+
207+impl ResizeSurfaceState {
208+ fn with<F, T>(surface: &WlSurface, cb: F) -> T
209+ where
210+ F: FnOnce(&mut Self) -> T,
211+ {
212+ compositor::with_states(surface, |states| {
213+ states.data_map.insert_if_missing(RefCell::<Self>::default);
214+ let state = states.data_map.get::<RefCell<Self>>().unwrap();
215+
216+ cb(&mut state.borrow_mut())
217+ })
218+ }
219+
220+ fn commit(&mut self) -> Option<(ResizeEdge, Rectangle<i32, Logical>)> {
221+ match *self {
222+ Self::Resizing { edges, initial_rect } => Some((edges, initial_rect)),
223+ Self::WaitingForLastCommit { edges, initial_rect } => {
224+ // The resize is done, let's go back to idle
225+ *self = Self::Idle;
226+
227+ Some((edges, initial_rect))
228+ }
229+ Self::Idle => None,
230+ }
231+ }
232+}
233+
234+/// Should be called on `WlSurface::commit`
235+pub fn handle_commit(space: &mut Space<Window>, surface: &WlSurface) -> Option<()> {
236+ let window = space
237+ .elements()
238+ .find(|w| w.toplevel().wl_surface() == surface)
239+ .cloned()?;
240+
241+ let mut window_loc = space.element_location(&window)?;
242+ let geometry = window.geometry();
243+
244+ let new_loc: Point<Option<i32>, Logical> = ResizeSurfaceState::with(surface, |state| {
245+ state
246+ .commit()
247+ .and_then(|(edges, initial_rect)| {
248+ // If the window is being resized by top or left, its location must be adjusted
249+ // accordingly.
250+ edges.intersects(ResizeEdge::TOP_LEFT).then(|| {
251+ let new_x = edges
252+ .intersects(ResizeEdge::LEFT)
253+ .then_some(initial_rect.loc.x + (initial_rect.size.w - geometry.size.w));
254+
255+ let new_y = edges
256+ .intersects(ResizeEdge::TOP)
257+ .then_some(initial_rect.loc.y + (initial_rect.size.h - geometry.size.h));
258+
259+ (new_x, new_y).into()
260+ })
261+ })
262+ .unwrap_or_default()
263+ });
264+
265+ if let Some(new_x) = new_loc.x {
266+ window_loc.x = new_x;
267+ }
268+ if let Some(new_y) = new_loc.y {
269+ window_loc.y = new_y;
270+ }
271+
272+ if new_loc.x.is_some() || new_loc.y.is_some() {
273+ // If TOP or LEFT side of the window got resized, we have to move it
274+ space.map_element(window, window_loc, false);
275+ }
276+
277+ Some(())
278+}
src/handlers/compositor.rsadded+57 -0
@@ -0,0 +1,57 @@
1+use crate::{grabs::resize_grab, state::ClientState, Smallvil};
2+use smithay::{
3+ backend::renderer::utils::on_commit_buffer_handler,
4+ delegate_compositor, delegate_shm,
5+ reexports::wayland_server::{
6+ protocol::{wl_buffer, wl_surface::WlSurface},
7+ Client,
8+ },
9+ wayland::{
10+ buffer::BufferHandler,
11+ compositor::{
12+ get_parent, is_sync_subsurface, CompositorClientState, CompositorHandler, CompositorState,
13+ },
14+ shm::{ShmHandler, ShmState},
15+ },
16+};
17+
18+use super::xdg_shell;
19+
20+impl CompositorHandler for Smallvil {
21+ fn compositor_state(&mut self) -> &mut CompositorState {
22+ &mut self.compositor_state
23+ }
24+
25+ fn client_compositor_state<'a>(&self, client: &'a Client) -> &'a CompositorClientState {
26+ &client.get_data::<ClientState>().unwrap().compositor_state
27+ }
28+
29+ fn commit(&mut self, surface: &WlSurface) {
30+ on_commit_buffer_handler::<Self>(surface);
31+ if !is_sync_subsurface(surface) {
32+ let mut root = surface.clone();
33+ while let Some(parent) = get_parent(&root) {
34+ root = parent;
35+ }
36+ if let Some(window) = self.space.elements().find(|w| w.toplevel().wl_surface() == &root) {
37+ window.on_commit();
38+ }
39+ };
40+
41+ xdg_shell::handle_commit(&self.space, surface);
42+ resize_grab::handle_commit(&mut self.space, surface);
43+ }
44+}
45+
46+impl BufferHandler for Smallvil {
47+ fn buffer_destroyed(&mut self, _buffer: &wl_buffer::WlBuffer) {}
48+}
49+
50+impl ShmHandler for Smallvil {
51+ fn shm_state(&self) -> &ShmState {
52+ &self.shm_state
53+ }
54+}
55+
56+delegate_compositor!(Smallvil);
57+delegate_shm!(Smallvil);
src/handlers/mod.rsadded+54 -0
@@ -0,0 +1,54 @@
1+mod compositor;
2+mod xdg_shell;
3+
4+use crate::Smallvil;
5+
6+//
7+// Wl Seat
8+//
9+
10+use smithay::input::{SeatHandler, SeatState};
11+use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
12+use smithay::wayland::data_device::{ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler};
13+use smithay::{delegate_data_device, delegate_output, delegate_seat};
14+
15+impl SeatHandler for Smallvil {
16+ type KeyboardFocus = WlSurface;
17+ type PointerFocus = WlSurface;
18+
19+ fn seat_state(&mut self) -> &mut SeatState<Smallvil> {
20+ &mut self.seat_state
21+ }
22+
23+ fn cursor_image(
24+ &mut self,
25+ _seat: &smithay::input::Seat<Self>,
26+ _image: smithay::input::pointer::CursorImageStatus,
27+ ) {
28+ }
29+ fn focus_changed(&mut self, _seat: &smithay::input::Seat<Self>, _focused: Option<&WlSurface>) {}
30+}
31+
32+delegate_seat!(Smallvil);
33+
34+//
35+// Wl Data Device
36+//
37+
38+impl DataDeviceHandler for Smallvil {
39+ type SelectionUserData = ();
40+ fn data_device_state(&self) -> &smithay::wayland::data_device::DataDeviceState {
41+ &self.data_device_state
42+ }
43+}
44+
45+impl ClientDndGrabHandler for Smallvil {}
46+impl ServerDndGrabHandler for Smallvil {}
47+
48+delegate_data_device!(Smallvil);
49+
50+//
51+// Wl Output & Xdg Output
52+//
53+
54+delegate_output!(Smallvil);
src/handlers/xdg_shell.rsadded+163 -0
@@ -0,0 +1,163 @@
1+use smithay::{
2+ delegate_xdg_shell,
3+ desktop::{Space, Window},
4+ input::{
5+ pointer::{Focus, GrabStartData as PointerGrabStartData},
6+ Seat,
7+ },
8+ reexports::{
9+ wayland_protocols::xdg::shell::server::xdg_toplevel,
10+ wayland_server::{
11+ protocol::{wl_seat, wl_surface::WlSurface},
12+ Resource,
13+ },
14+ },
15+ utils::{Rectangle, Serial},
16+ wayland::{
17+ compositor::with_states,
18+ shell::xdg::{
19+ PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState,
20+ XdgToplevelSurfaceData,
21+ },
22+ },
23+};
24+
25+use crate::{
26+ grabs::{MoveSurfaceGrab, ResizeSurfaceGrab},
27+ Smallvil,
28+};
29+
30+impl XdgShellHandler for Smallvil {
31+ fn xdg_shell_state(&mut self) -> &mut XdgShellState {
32+ &mut self.xdg_shell_state
33+ }
34+
35+ fn new_toplevel(&mut self, surface: ToplevelSurface) {
36+ let window = Window::new(surface);
37+ self.space.map_element(window, (0, 0), false);
38+ }
39+
40+ fn new_popup(&mut self, _surface: PopupSurface, _positioner: PositionerState) {
41+ // TODO: Popup handling using PopupManager
42+ }
43+
44+ fn move_request(&mut self, surface: ToplevelSurface, seat: wl_seat::WlSeat, serial: Serial) {
45+ let seat = Seat::from_resource(&seat).unwrap();
46+
47+ let wl_surface = surface.wl_surface();
48+
49+ if let Some(start_data) = check_grab(&seat, wl_surface, serial) {
50+ let pointer = seat.get_pointer().unwrap();
51+
52+ let window = self
53+ .space
54+ .elements()
55+ .find(|w| w.toplevel().wl_surface() == wl_surface)
56+ .unwrap()
57+ .clone();
58+ let initial_window_location = self.space.element_location(&window).unwrap();
59+
60+ let grab = MoveSurfaceGrab {
61+ start_data,
62+ window,
63+ initial_window_location,
64+ };
65+
66+ pointer.set_grab(self, grab, serial, Focus::Clear);
67+ }
68+ }
69+
70+ fn resize_request(
71+ &mut self,
72+ surface: ToplevelSurface,
73+ seat: wl_seat::WlSeat,
74+ serial: Serial,
75+ edges: xdg_toplevel::ResizeEdge,
76+ ) {
77+ let seat = Seat::from_resource(&seat).unwrap();
78+
79+ let wl_surface = surface.wl_surface();
80+
81+ if let Some(start_data) = check_grab(&seat, wl_surface, serial) {
82+ let pointer = seat.get_pointer().unwrap();
83+
84+ let window = self
85+ .space
86+ .elements()
87+ .find(|w| w.toplevel().wl_surface() == wl_surface)
88+ .unwrap()
89+ .clone();
90+ let initial_window_location = self.space.element_location(&window).unwrap();
91+ let initial_window_size = window.geometry().size;
92+
93+ surface.with_pending_state(|state| {
94+ state.states.set(xdg_toplevel::State::Resizing);
95+ });
96+
97+ surface.send_pending_configure();
98+
99+ let grab = ResizeSurfaceGrab::start(
100+ start_data,
101+ window,
102+ edges.into(),
103+ Rectangle::from_loc_and_size(initial_window_location, initial_window_size),
104+ );
105+
106+ pointer.set_grab(self, grab, serial, Focus::Clear);
107+ }
108+ }
109+
110+ fn grab(&mut self, _surface: PopupSurface, _seat: wl_seat::WlSeat, _serial: Serial) {
111+ // TODO popup grabs
112+ }
113+}
114+
115+// Xdg Shell
116+delegate_xdg_shell!(Smallvil);
117+
118+fn check_grab(
119+ seat: &Seat<Smallvil>,
120+ surface: &WlSurface,
121+ serial: Serial,
122+) -> Option<PointerGrabStartData<Smallvil>> {
123+ let pointer = seat.get_pointer()?;
124+
125+ // Check that this surface has a click grab.
126+ if !pointer.has_grab(serial) {
127+ return None;
128+ }
129+
130+ let start_data = pointer.grab_start_data()?;
131+
132+ let (focus, _) = start_data.focus.as_ref()?;
133+ // If the focus was for a different surface, ignore the request.
134+ if !focus.id().same_client_as(&surface.id()) {
135+ return None;
136+ }
137+
138+ Some(start_data)
139+}
140+
141+/// Should be called on `WlSurface::commit`
142+pub fn handle_commit(space: &Space<Window>, surface: &WlSurface) -> Option<()> {
143+ let window = space
144+ .elements()
145+ .find(|w| w.toplevel().wl_surface() == surface)
146+ .cloned()?;
147+
148+ let initial_configure_sent = with_states(surface, |states| {
149+ states
150+ .data_map
151+ .get::<XdgToplevelSurfaceData>()
152+ .unwrap()
153+ .lock()
154+ .unwrap()
155+ .initial_configure_sent
156+ });
157+
158+ if !initial_configure_sent {
159+ window.toplevel().send_configure();
160+ }
161+
162+ Some(())
163+}
src/input.rsadded+131 -0
@@ -0,0 +1,131 @@
1+use smithay::{
2+ backend::input::{
3+ AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent,
4+ KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent,
5+ },
6+ input::{
7+ keyboard::FilterResult,
8+ pointer::{AxisFrame, ButtonEvent, MotionEvent},
9+ },
10+ reexports::wayland_server::protocol::wl_surface::WlSurface,
11+ utils::SERIAL_COUNTER,
12+};
13+
14+use crate::state::Smallvil;
15+
16+impl Smallvil {
17+ pub fn process_input_event<I: InputBackend>(&mut self, event: InputEvent<I>) {
18+ match event {
19+ InputEvent::Keyboard { event, .. } => {
20+ let serial = SERIAL_COUNTER.next_serial();
21+ let time = Event::time_msec(&event);
22+
23+ self.seat.get_keyboard().unwrap().input::<(), _>(
24+ self,
25+ event.key_code(),
26+ event.state(),
27+ serial,
28+ time,
29+ |_, _, _| FilterResult::Forward,
30+ );
31+ }
32+ InputEvent::PointerMotion { .. } => {}
33+ InputEvent::PointerMotionAbsolute { event, .. } => {
34+ let output = self.space.outputs().next().unwrap();
35+
36+ let output_geo = self.space.output_geometry(output).unwrap();
37+
38+ let pos = event.position_transformed(output_geo.size) + output_geo.loc.to_f64();
39+
40+ let serial = SERIAL_COUNTER.next_serial();
41+
42+ let pointer = self.seat.get_pointer().unwrap();
43+
44+ let under = self.surface_under_pointer(&pointer);
45+
46+ pointer.motion(
47+ self,
48+ under,
49+ &MotionEvent {
50+ location: pos,
51+ serial,
52+ time: event.time_msec(),
53+ },
54+ );
55+ }
56+ InputEvent::PointerButton { event, .. } => {
57+ let pointer = self.seat.get_pointer().unwrap();
58+ let keyboard = self.seat.get_keyboard().unwrap();
59+
60+ let serial = SERIAL_COUNTER.next_serial();
61+
62+ let button = event.button_code();
63+
64+ let button_state = event.state();
65+
66+ if ButtonState::Pressed == button_state && !pointer.is_grabbed() {
67+ if let Some((window, _loc)) = self
68+ .space
69+ .element_under(pointer.current_location())
70+ .map(|(w, l)| (w.clone(), l))
71+ {
72+ self.space.raise_element(&window, true);
73+ keyboard.set_focus(self, Some(window.toplevel().wl_surface().clone()), serial);
74+ self.space.elements().for_each(|window| {
75+ window.toplevel().send_pending_configure();
76+ });
77+ } else {
78+ self.space.elements().for_each(|window| {
79+ window.set_activated(false);
80+ window.toplevel().send_pending_configure();
81+ });
82+ keyboard.set_focus(self, Option::<WlSurface>::None, serial);
83+ }
84+ };
85+
86+ pointer.button(
87+ self,
88+ &ButtonEvent {
89+ button,
90+ state: button_state,
91+ serial,
92+ time: event.time_msec(),
93+ },
94+ );
95+ }
96+ InputEvent::PointerAxis { event, .. } => {
97+ let source = event.source();
98+
99+ let horizontal_amount = event
100+ .amount(Axis::Horizontal)
101+ .unwrap_or_else(|| event.amount_discrete(Axis::Horizontal).unwrap() * 3.0);
102+ let vertical_amount = event
103+ .amount(Axis::Vertical)
104+ .unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap() * 3.0);
105+ let horizontal_amount_discrete = event.amount_discrete(Axis::Horizontal);
106+ let vertical_amount_discrete = event.amount_discrete(Axis::Vertical);
107+
108+ let mut frame = AxisFrame::new(event.time_msec()).source(source);
109+ if horizontal_amount != 0.0 {
110+ frame = frame.value(Axis::Horizontal, horizontal_amount);
111+ if let Some(discrete) = horizontal_amount_discrete {
112+ frame = frame.discrete(Axis::Horizontal, discrete as i32);
113+ }
114+ } else if source == AxisSource::Finger {
115+ frame = frame.stop(Axis::Horizontal);
116+ }
117+ if vertical_amount != 0.0 {
118+ frame = frame.value(Axis::Vertical, vertical_amount);
119+ if let Some(discrete) = vertical_amount_discrete {
120+ frame = frame.discrete(Axis::Vertical, discrete as i32);
121+ }
122+ } else if source == AxisSource::Finger {
123+ frame = frame.stop(Axis::Vertical);
124+ }
125+
126+ self.seat.get_pointer().unwrap().axis(self, frame);
127+ }
128+ _ => {}
129+ }
130+ }
131+}
src/main.rsadded+52 -0
@@ -0,0 +1,52 @@
1+#![allow(irrefutable_let_patterns)]
2+
3+mod handlers;
4+
5+mod grabs;
6+mod input;
7+mod state;
8+mod winit;
9+
10+use smithay::reexports::{calloop::EventLoop, wayland_server::Display};
11+pub use state::Smallvil;
12+
13+pub struct CalloopData {
14+ state: Smallvil,
15+ display: Display<Smallvil>,
16+}
17+
18+fn main() -> Result<(), Box<dyn std::error::Error>> {
19+ if let Ok(env_filter) = tracing_subscriber::EnvFilter::try_from_default_env() {
20+ tracing_subscriber::fmt().with_env_filter(env_filter).init();
21+ } else {
22+ tracing_subscriber::fmt().init();
23+ }
24+
25+ let mut event_loop: EventLoop<CalloopData> = EventLoop::try_new()?;
26+
27+ let mut display: Display<Smallvil> = Display::new()?;
28+ let state = Smallvil::new(&mut event_loop, &mut display);
29+
30+ let mut data = CalloopData { state, display };
31+
32+ crate::winit::init_winit(&mut event_loop, &mut data)?;
33+
34+ let mut args = std::env::args().skip(1);
35+ let flag = args.next();
36+ let arg = args.next();
37+
38+ match (flag.as_deref(), arg) {
39+ (Some("-c") | Some("--command"), Some(command)) => {
40+ std::process::Command::new(command).spawn().ok();
41+ }
42+ _ => {
43+ std::process::Command::new("weston-terminal").spawn().ok();
44+ }
45+ }
46+
47+ event_loop.run(None, &mut data, move |_| {
48+ // Smallvil is running
49+ })?;
50+
51+ Ok(())
52+}
src/state.rsadded+164 -0
@@ -0,0 +1,164 @@
1+use std::{ffi::OsString, os::unix::io::AsRawFd, sync::Arc};
2+
3+use smithay::{
4+ desktop::{Space, Window, WindowSurfaceType},
5+ input::{pointer::PointerHandle, Seat, SeatState},
6+ reexports::{
7+ calloop::{generic::Generic, EventLoop, Interest, LoopSignal, Mode, PostAction},
8+ wayland_server::{
9+ backend::{ClientData, ClientId, DisconnectReason},
10+ protocol::wl_surface::WlSurface,
11+ Display,
12+ },
13+ },
14+ utils::{Logical, Point},
15+ wayland::{
16+ compositor::{CompositorClientState, CompositorState},
17+ data_device::DataDeviceState,
18+ output::OutputManagerState,
19+ shell::xdg::XdgShellState,
20+ shm::ShmState,
21+ socket::ListeningSocketSource,
22+ },
23+};
24+
25+use crate::CalloopData;
26+
27+pub struct Smallvil {
28+ pub start_time: std::time::Instant,
29+ pub socket_name: OsString,
30+
31+ pub space: Space<Window>,
32+ pub loop_signal: LoopSignal,
33+
34+ // Smithay State
35+ pub compositor_state: CompositorState,
36+ pub xdg_shell_state: XdgShellState,
37+ pub shm_state: ShmState,
38+ pub output_manager_state: OutputManagerState,
39+ pub seat_state: SeatState<Smallvil>,
40+ pub data_device_state: DataDeviceState,
41+
42+ pub seat: Seat<Self>,
43+}
44+
45+impl Smallvil {
46+ pub fn new(event_loop: &mut EventLoop<CalloopData>, display: &mut Display<Self>) -> Self {
47+ let start_time = std::time::Instant::now();
48+
49+ let dh = display.handle();
50+
51+ let compositor_state = CompositorState::new::<Self>(&dh);
52+ let xdg_shell_state = XdgShellState::new::<Self>(&dh);
53+ let shm_state = ShmState::new::<Self>(&dh, vec![]);
54+ let output_manager_state = OutputManagerState::new_with_xdg_output::<Self>(&dh);
55+ let mut seat_state = SeatState::new();
56+ let data_device_state = DataDeviceState::new::<Self>(&dh);
57+
58+ // A seat is a group of keyboards, pointer and touch devices.
59+ // A seat typically has a pointer and maintains a keyboard focus and a pointer focus.
60+ let mut seat: Seat<Self> = seat_state.new_wl_seat(&dh, "winit");
61+
62+ // Notify clients that we have a keyboard, for the sake of the example we assume that keyboard is always present.
63+ // You may want to track keyboard hot-plug in real compositor.
64+ seat.add_keyboard(Default::default(), 200, 200).unwrap();
65+
66+ // Notify clients that we have a pointer (mouse)
67+ // Here we assume that there is always pointer plugged in
68+ seat.add_pointer();
69+
70+ // A space represents a two-dimensional plane. Windows and Outputs can be mapped onto it.
71+ //
72+ // Windows get a position and stacking order through mapping.
73+ // Outputs become views of a part of the Space and can be rendered via Space::render_output.
74+ let space = Space::default();
75+
76+ let socket_name = Self::init_wayland_listener(display, event_loop);
77+
78+ // Get the loop signal, used to stop the event loop
79+ let loop_signal = event_loop.get_signal();
80+
81+ Self {
82+ start_time,
83+
84+ space,
85+ loop_signal,
86+ socket_name,
87+
88+ compositor_state,
89+ xdg_shell_state,
90+ shm_state,
91+ output_manager_state,
92+ seat_state,
93+ data_device_state,
94+ seat,
95+ }
96+ }
97+
98+ fn init_wayland_listener(
99+ display: &mut Display<Smallvil>,
100+ event_loop: &mut EventLoop<CalloopData>,
101+ ) -> OsString {
102+ // Creates a new listening socket, automatically choosing the next available `wayland` socket name.
103+ let listening_socket = ListeningSocketSource::new_auto().unwrap();
104+
105+ // Get the name of the listening socket.
106+ // Clients will connect to this socket.
107+ let socket_name = listening_socket.socket_name().to_os_string();
108+
109+ let handle = event_loop.handle();
110+
111+ event_loop
112+ .handle()
113+ .insert_source(listening_socket, move |client_stream, _, state| {
114+ // Inside the callback, you should insert the client into the display.
115+ //
116+ // You may also associate some data with the client when inserting the client.
117+ state
118+ .display
119+ .handle()
120+ .insert_client(client_stream, Arc::new(ClientState::default()))
121+ .unwrap();
122+ })
123+ .expect("Failed to init the wayland event source.");
124+
125+ // You also need to add the display itself to the event loop, so that client events will be processed by wayland-server.
126+ handle
127+ .insert_source(
128+ Generic::new(
129+ display.backend().poll_fd().as_raw_fd(),
130+ Interest::READ,
131+ Mode::Level,
132+ ),
133+ |_, _, state| {
134+ state.display.dispatch_clients(&mut state.state).unwrap();
135+ Ok(PostAction::Continue)
136+ },
137+ )
138+ .unwrap();
139+
140+ socket_name
141+ }
142+
143+ pub fn surface_under_pointer(
144+ &self,
145+ pointer: &PointerHandle<Self>,
146+ ) -> Option<(WlSurface, Point<i32, Logical>)> {
147+ let pos = pointer.current_location();
148+ self.space.element_under(pos).and_then(|(window, location)| {
149+ window
150+ .surface_under(pos - location.to_f64(), WindowSurfaceType::ALL)
151+ .map(|(s, p)| (s, p + location))
152+ })
153+ }
154+}
155+
156+#[derive(Default)]
157+pub struct ClientState {
158+ pub compositor_state: CompositorClientState,
159+}
160+
161+impl ClientData for ClientState {
162+ fn initialized(&self, _client_id: ClientId) {}
163+ fn disconnected(&self, _client_id: ClientId, _reason: DisconnectReason) {}
164+}
src/winit.rsadded+139 -0
@@ -0,0 +1,139 @@
1+use std::time::Duration;
2+
3+use smithay::{
4+ backend::{
5+ renderer::{
6+ damage::OutputDamageTracker, element::surface::WaylandSurfaceRenderElement, gles::GlesRenderer,
7+ },
8+ winit::{self, WinitError, WinitEvent, WinitEventLoop, WinitGraphicsBackend},
9+ },
10+ output::{Mode, Output, PhysicalProperties, Subpixel},
11+ reexports::calloop::{
12+ timer::{TimeoutAction, Timer},
13+ EventLoop,
14+ },
15+ utils::{Rectangle, Transform},
16+};
17+
18+use crate::{CalloopData, Smallvil};
19+
20+pub fn init_winit(
21+ event_loop: &mut EventLoop<CalloopData>,
22+ data: &mut CalloopData,
23+) -> Result<(), Box<dyn std::error::Error>> {
24+ let display = &mut data.display;
25+ let state = &mut data.state;
26+
27+ let (mut backend, mut winit) = winit::init()?;
28+
29+ let mode = Mode {
30+ size: backend.window_size().physical_size,
31+ refresh: 60_000,
32+ };
33+
34+ let output = Output::new(
35+ "winit".to_string(),
36+ PhysicalProperties {
37+ size: (0, 0).into(),
38+ subpixel: Subpixel::Unknown,
39+ make: "Smithay".into(),
40+ model: "Winit".into(),
41+ },
42+ );
43+ let _global = output.create_global::<Smallvil>(&display.handle());
44+ output.change_current_state(Some(mode), Some(Transform::Flipped180), None, Some((0, 0).into()));
45+ output.set_preferred(mode);
46+
47+ state.space.map_output(&output, (0, 0));
48+
49+ let mut damage_tracker = OutputDamageTracker::from_output(&output);
50+
51+ std::env::set_var("WAYLAND_DISPLAY", &state.socket_name);
52+
53+ let mut full_redraw = 0u8;
54+
55+ let timer = Timer::immediate();
56+ event_loop.handle().insert_source(timer, move |_, _, data| {
57+ winit_dispatch(
58+ &mut backend,
59+ &mut winit,
60+ data,
61+ &output,
62+ &mut damage_tracker,
63+ &mut full_redraw,
64+ )
65+ .unwrap();
66+ TimeoutAction::ToDuration(Duration::from_millis(16))
67+ })?;
68+
69+ Ok(())
70+}
71+
72+pub fn winit_dispatch(
73+ backend: &mut WinitGraphicsBackend<GlesRenderer>,
74+ winit: &mut WinitEventLoop,
75+ data: &mut CalloopData,
76+ output: &Output,
77+ damage_tracker: &mut OutputDamageTracker,
78+ full_redraw: &mut u8,
79+) -> Result<(), Box<dyn std::error::Error>> {
80+ let display = &mut data.display;
81+ let state = &mut data.state;
82+
83+ let res = winit.dispatch_new_events(|event| match event {
84+ WinitEvent::Resized { size, .. } => {
85+ output.change_current_state(
86+ Some(Mode {
87+ size,
88+ refresh: 60_000,
89+ }),
90+ None,
91+ None,
92+ None,
93+ );
94+ }
95+ WinitEvent::Input(event) => state.process_input_event(event),
96+ _ => (),
97+ });
98+
99+ if let Err(WinitError::WindowClosed) = res {
100+ // Stop the loop
101+ state.loop_signal.stop();
102+
103+ return Ok(());
104+ } else {
105+ res?;
106+ }
107+
108+ *full_redraw = full_redraw.saturating_sub(1);
109+
110+ let size = backend.window_size().physical_size;
111+ let damage = Rectangle::from_loc_and_size((0, 0), size);
112+
113+ backend.bind()?;
114+ smithay::desktop::space::render_output::<_, WaylandSurfaceRenderElement<GlesRenderer>, _, _>(
115+ output,
116+ backend.renderer(),
117+ 1.0,
118+ 0,
119+ [&state.space],
120+ &[],
121+ damage_tracker,
122+ [0.1, 0.1, 0.1, 1.0],
123+ )?;
124+ backend.submit(Some(&[damage]))?;
125+
126+ state.space.elements().for_each(|window| {
127+ window.send_frame(
128+ output,
129+ state.start_time.elapsed(),
130+ Some(Duration::ZERO),
131+ |_, _| Some(output.clone()),
132+ )
133+ });
134+
135+ state.space.refresh();
136+ display.flush_clients()?;
137+
138+ Ok(())
139+}