rust-winit-Update-smithay-client-toolkit.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. From 0d2889d03fd7b97ef8e1753f998e57e8a116c8e6 Mon Sep 17 00:00:00 2001
  2. From: Kirill Chibisov <contact@kchibisov.com>
  3. Date: Sun, 19 Jun 2022 09:56:12 +0300
  4. Subject: [PATCH] Bump smithay-client-toolkit to v0.16.0
  5. Upstream: <https://github.com/rust-windowing/winit/pull/2342/>
  6. Without this patch, rust-winit doesn't build against the new
  7. rust-smithay-client-toolkit. Rebased for use in Guix.
  8. ---
  9. .../linux/wayland/event_loop/mod.rs | 4 ++-
  10. .../linux/wayland/seat/keyboard/mod.rs | 25 ++++---------------
  11. 2 files changed, 8 insertions(+), 21 deletions(-)
  12. diff --git a/src/platform_impl/linux/wayland/event_loop/mod.rs b/src/platform_impl/linux/wayland/event_loop/mod.rs
  13. index 0f879ea2d9..b2948a9b15 100644
  14. --- a/src/platform_impl/linux/wayland/event_loop/mod.rs
  15. +++ b/src/platform_impl/linux/wayland/event_loop/mod.rs
  16. @@ -538,6 +538,8 @@ impl<T: 'static> EventLoop<T> {
  17. _ => unreachable!(),
  18. };
  19. - self.event_loop.dispatch(timeout, state)
  20. + self.event_loop
  21. + .dispatch(timeout, state)
  22. + .map_err(|error| error.into())
  23. }
  24. }
  25. diff --git a/src/platform_impl/linux/wayland/seat/keyboard/mod.rs b/src/platform_impl/linux/wayland/seat/keyboard/mod.rs
  26. index c6e0ad456e..262a014bac 100644
  27. --- a/src/platform_impl/linux/wayland/seat/keyboard/mod.rs
  28. +++ b/src/platform_impl/linux/wayland/seat/keyboard/mod.rs
  29. @@ -7,7 +7,7 @@ use sctk::reexports::client::protocol::wl_keyboard::WlKeyboard;
  30. use sctk::reexports::client::protocol::wl_seat::WlSeat;
  31. use sctk::reexports::client::Attached;
  32. -use sctk::reexports::calloop::{LoopHandle, RegistrationToken};
  33. +use sctk::reexports::calloop::LoopHandle;
  34. use sctk::seat::keyboard;
  35. @@ -20,12 +20,6 @@ mod keymap;
  36. pub(crate) struct Keyboard {
  37. pub keyboard: WlKeyboard,
  38. -
  39. - /// The source for repeat keys.
  40. - pub repeat_token: Option<RegistrationToken>,
  41. -
  42. - /// LoopHandle to drop `RepeatSource`, when dropping the keyboard.
  43. - pub loop_handle: LoopHandle<'static, WinitState>,
  44. }
  45. impl Keyboard {
  46. @@ -35,7 +29,7 @@ impl Keyboard {
  47. modifiers_state: Rc<RefCell<ModifiersState>>,
  48. ) -> Option<Self> {
  49. let mut inner = KeyboardInner::new(modifiers_state);
  50. - let keyboard_data = keyboard::map_keyboard_repeat(
  51. + let keyboard = keyboard::map_keyboard_repeat(
  52. loop_handle.clone(),
  53. seat,
  54. None,
  55. @@ -44,15 +38,10 @@ impl Keyboard {
  56. let winit_state = dispatch_data.get::<WinitState>().unwrap();
  57. handlers::handle_keyboard(event, &mut inner, winit_state);
  58. },
  59. - );
  60. -
  61. - let (keyboard, repeat_token) = keyboard_data.ok()?;
  62. + )
  63. + .ok()?;
  64. - Some(Self {
  65. - keyboard,
  66. - loop_handle,
  67. - repeat_token: Some(repeat_token),
  68. - })
  69. + Some(Self { keyboard })
  70. }
  71. }
  72. @@ -61,10 +50,6 @@ impl Drop for Keyboard {
  73. if self.keyboard.as_ref().version() >= 3 {
  74. self.keyboard.release();
  75. }
  76. -
  77. - if let Some(repeat_token) = self.repeat_token.take() {
  78. - self.loop_handle.remove(repeat_token);
  79. - }
  80. }
  81. }