2023-04-19 00:56:29 +03:00
|
|
|
//! The event-loop routines.
|
|
|
|
|
|
2023-09-07 08:25:04 +02:00
|
|
|
use std::cell::{Cell, RefCell};
|
2021-08-15 22:31:59 +03:00
|
|
|
use std::io::Result as IOResult;
|
2022-08-12 11:54:02 +04:00
|
|
|
use std::mem;
|
2023-10-15 20:31:29 +04:00
|
|
|
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
|
2023-04-19 00:56:29 +03:00
|
|
|
use std::sync::atomic::Ordering;
|
2023-07-31 00:39:01 +04:00
|
|
|
use std::sync::{Arc, Mutex};
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
use std::time::{Duration, Instant};
|
|
|
|
|
|
2023-10-15 06:49:57 +04:00
|
|
|
use sctk::reexports::calloop_wayland_source::WaylandSource;
|
|
|
|
|
use sctk::reexports::client::{globals, Connection, QueueHandle};
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2024-05-20 20:27:36 +04:00
|
|
|
use crate::application::ApplicationHandler;
|
2024-02-03 07:27:17 +04:00
|
|
|
use crate::cursor::OnlyCursorImage;
|
2023-12-29 21:28:06 +04:00
|
|
|
use crate::dpi::LogicalSize;
|
2024-09-06 17:20:11 +03:00
|
|
|
use crate::error::{EventLoopError, OsError, RequestError};
|
2024-09-04 15:04:48 +02:00
|
|
|
use crate::event::{Event, StartCause, SurfaceSizeWriter, WindowEvent};
|
2024-01-31 17:29:59 +04:00
|
|
|
use crate::event_loop::{ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents};
|
2023-06-18 12:40:03 +01:00
|
|
|
use crate::platform::pump_events::PumpStatus;
|
|
|
|
|
use crate::platform_impl::platform::min_timeout;
|
2024-09-06 17:20:11 +03:00
|
|
|
use crate::platform_impl::PlatformCustomCursor;
|
2024-08-06 21:02:53 +03:00
|
|
|
use crate::window::{CustomCursor as RootCustomCursor, CustomCursorSource, Theme};
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
|
|
|
|
mod proxy;
|
2023-04-19 00:56:29 +03:00
|
|
|
pub mod sink;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
|
|
|
|
pub use proxy::EventLoopProxy;
|
2023-04-19 00:56:29 +03:00
|
|
|
use sink::EventSink;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
use super::state::{WindowCompositorUpdate, WinitState};
|
2023-06-22 09:12:47 +04:00
|
|
|
use super::window::state::FrameCallbackState;
|
2024-09-06 17:20:11 +03:00
|
|
|
use super::{logical_to_physical_rounded, DeviceId, WindowId};
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
type WaylandDispatcher = calloop::Dispatcher<'static, WaylandSource<WinitState>, WinitState>;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
/// The Wayland event loop.
|
2024-06-24 13:04:55 +03:00
|
|
|
pub struct EventLoop {
|
2023-10-03 23:24:42 +02:00
|
|
|
/// Has `run` or `run_on_demand` been called or a call to `pump_events` that starts the loop
|
2023-06-18 12:40:03 +01:00
|
|
|
loop_running: bool,
|
|
|
|
|
|
|
|
|
|
buffer_sink: EventSink,
|
|
|
|
|
compositor_updates: Vec<WindowCompositorUpdate>,
|
|
|
|
|
window_ids: Vec<WindowId>,
|
|
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
/// The Wayland dispatcher to has raw access to the queue when needed, such as
|
|
|
|
|
/// when creating a new window.
|
|
|
|
|
wayland_dispatcher: WaylandDispatcher,
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
/// Connection to the wayland server.
|
|
|
|
|
connection: Connection,
|
2022-07-21 22:22:36 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
/// Event loop window target.
|
2024-08-06 21:02:53 +03:00
|
|
|
active_event_loop: ActiveEventLoop,
|
2022-08-12 11:54:02 +04:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
// XXX drop after everything else, just to be safe.
|
|
|
|
|
/// Calloop's event loop.
|
2021-08-15 22:31:59 +03:00
|
|
|
event_loop: calloop::EventLoop<'static, WinitState>,
|
2023-04-19 00:56:29 +03:00
|
|
|
}
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2024-06-24 13:04:55 +03:00
|
|
|
impl EventLoop {
|
|
|
|
|
pub fn new() -> Result<EventLoop, EventLoopError> {
|
2024-09-06 17:20:11 +03:00
|
|
|
let connection = Connection::connect_to_env().map_err(|err| os_error!(err))?;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-08-13 23:20:09 +04:00
|
|
|
let (globals, mut event_queue) =
|
2024-09-06 17:20:11 +03:00
|
|
|
globals::registry_queue_init(&connection).map_err(|err| os_error!(err))?;
|
2023-04-19 00:56:29 +03:00
|
|
|
let queue_handle = event_queue.handle();
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-08-13 23:20:09 +04:00
|
|
|
let event_loop =
|
2024-09-06 17:20:11 +03:00
|
|
|
calloop::EventLoop::<WinitState>::try_new().map_err(|err| os_error!(err))?;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2024-09-06 17:20:11 +03:00
|
|
|
let mut winit_state = WinitState::new(&globals, &queue_handle, event_loop.handle())?;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
// NOTE: do a roundtrip after binding the globals to prevent potential
|
|
|
|
|
// races with the server.
|
2024-09-06 17:20:11 +03:00
|
|
|
event_queue.roundtrip(&mut winit_state).map_err(|err| os_error!(err))?;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
// Register Wayland source.
|
2023-10-15 06:49:57 +04:00
|
|
|
let wayland_source = WaylandSource::new(connection.clone(), event_queue);
|
2021-08-15 22:31:59 +03:00
|
|
|
let wayland_dispatcher =
|
2023-08-06 01:09:59 +04:00
|
|
|
calloop::Dispatcher::new(wayland_source, |_, queue, winit_state: &mut WinitState| {
|
|
|
|
|
let result = queue.dispatch_pending(winit_state);
|
|
|
|
|
if result.is_ok()
|
|
|
|
|
&& (!winit_state.events_sink.is_empty()
|
|
|
|
|
|| !winit_state.window_compositor_updates.is_empty())
|
|
|
|
|
{
|
|
|
|
|
winit_state.dispatched_events = true;
|
|
|
|
|
}
|
|
|
|
|
result
|
2021-08-15 22:31:59 +03:00
|
|
|
});
|
|
|
|
|
|
2024-09-06 17:20:11 +03:00
|
|
|
event_loop
|
|
|
|
|
.handle()
|
|
|
|
|
.register_dispatcher(wayland_dispatcher.clone())
|
|
|
|
|
.map_err(|err| os_error!(err))?;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
// Setup the user proxy.
|
2024-06-24 13:04:55 +03:00
|
|
|
let (ping, ping_source) = calloop::ping::make_ping().unwrap();
|
2024-09-06 17:20:11 +03:00
|
|
|
event_loop
|
2023-08-13 23:20:09 +04:00
|
|
|
.handle()
|
2024-06-24 13:04:55 +03:00
|
|
|
.insert_source(ping_source, move |_, _, winit_state: &mut WinitState| {
|
|
|
|
|
winit_state.dispatched_events = true;
|
|
|
|
|
winit_state.proxy_wake_up = true;
|
2023-08-13 23:20:09 +04:00
|
|
|
})
|
2024-09-06 17:20:11 +03:00
|
|
|
.map_err(|err| os_error!(err))?;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
|
|
|
|
// An event's loop awakener to wake up for window events from winit's windows.
|
2024-09-06 17:20:11 +03:00
|
|
|
let (event_loop_awakener, event_loop_awakener_source) =
|
|
|
|
|
calloop::ping::make_ping().map_err(|err| os_error!(err))?;
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2024-09-06 17:20:11 +03:00
|
|
|
event_loop
|
2023-08-13 23:20:09 +04:00
|
|
|
.handle()
|
|
|
|
|
.insert_source(event_loop_awakener_source, move |_, _, winit_state: &mut WinitState| {
|
|
|
|
|
// Mark that we have something to dispatch.
|
|
|
|
|
winit_state.dispatched_events = true;
|
|
|
|
|
})
|
2024-09-06 17:20:11 +03:00
|
|
|
.map_err(|err| os_error!(err))?;
|
2023-08-13 23:20:09 +04:00
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
let active_event_loop = ActiveEventLoop {
|
2023-04-19 00:56:29 +03:00
|
|
|
connection: connection.clone(),
|
2021-08-15 22:31:59 +03:00
|
|
|
wayland_dispatcher: wayland_dispatcher.clone(),
|
2023-04-19 00:56:29 +03:00
|
|
|
event_loop_awakener,
|
2024-06-29 17:19:09 +02:00
|
|
|
event_loop_proxy: EventLoopProxy::new(ping),
|
2023-04-19 00:56:29 +03:00
|
|
|
queue_handle,
|
2023-09-07 08:25:04 +02:00
|
|
|
control_flow: Cell::new(ControlFlow::default()),
|
|
|
|
|
exit: Cell::new(None),
|
2023-04-19 00:56:29 +03:00
|
|
|
state: RefCell::new(winit_state),
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let event_loop = Self {
|
2023-06-18 12:40:03 +01:00
|
|
|
loop_running: false,
|
|
|
|
|
compositor_updates: Vec::new(),
|
|
|
|
|
buffer_sink: EventSink::default(),
|
|
|
|
|
window_ids: Vec::new(),
|
2023-04-19 00:56:29 +03:00
|
|
|
connection,
|
2021-08-15 22:31:59 +03:00
|
|
|
wayland_dispatcher,
|
2023-04-19 00:56:29 +03:00
|
|
|
event_loop,
|
2024-08-06 21:02:53 +03:00
|
|
|
active_event_loop,
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Ok(event_loop)
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-11 15:38:09 +02:00
|
|
|
pub fn run_app<A: ApplicationHandler>(mut self, app: A) -> Result<(), EventLoopError> {
|
2024-05-20 20:27:36 +04:00
|
|
|
self.run_app_on_demand(app)
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 13:04:55 +03:00
|
|
|
pub fn run_app_on_demand<A: ApplicationHandler>(
|
2024-05-20 20:27:36 +04:00
|
|
|
&mut self,
|
2024-07-11 15:38:09 +02:00
|
|
|
mut app: A,
|
2024-05-20 20:27:36 +04:00
|
|
|
) -> Result<(), EventLoopError> {
|
2024-08-06 21:02:53 +03:00
|
|
|
self.active_event_loop.clear_exit();
|
2023-07-04 22:53:17 +01:00
|
|
|
let exit = loop {
|
2024-07-11 15:38:09 +02:00
|
|
|
match self.pump_app_events(None, &mut app) {
|
2023-06-18 12:40:03 +01:00
|
|
|
PumpStatus::Exit(0) => {
|
|
|
|
|
break Ok(());
|
|
|
|
|
},
|
|
|
|
|
PumpStatus::Exit(code) => {
|
2023-08-13 23:20:09 +04:00
|
|
|
break Err(EventLoopError::ExitFailure(code));
|
2023-06-18 12:40:03 +01:00
|
|
|
},
|
|
|
|
|
_ => {
|
|
|
|
|
continue;
|
|
|
|
|
},
|
|
|
|
|
}
|
2023-07-04 22:53:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Applications aren't allowed to carry windows between separate
|
2023-10-03 23:24:42 +02:00
|
|
|
// `run_on_demand` calls but if they have only just dropped their
|
2023-07-04 22:53:17 +01:00
|
|
|
// windows we need to make sure those last requests are sent to the
|
|
|
|
|
// compositor.
|
2023-08-13 23:20:09 +04:00
|
|
|
let _ = self.roundtrip().map_err(EventLoopError::Os);
|
2023-07-04 22:53:17 +01:00
|
|
|
|
|
|
|
|
exit
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2024-06-24 13:04:55 +03:00
|
|
|
pub fn pump_app_events<A: ApplicationHandler>(
|
2024-05-20 20:27:36 +04:00
|
|
|
&mut self,
|
|
|
|
|
timeout: Option<Duration>,
|
2024-07-11 15:38:09 +02:00
|
|
|
mut app: A,
|
2024-05-20 20:27:36 +04:00
|
|
|
) -> PumpStatus {
|
2023-06-18 12:40:03 +01:00
|
|
|
if !self.loop_running {
|
|
|
|
|
self.loop_running = true;
|
|
|
|
|
|
|
|
|
|
// Run the initial loop iteration.
|
2024-07-11 15:38:09 +02:00
|
|
|
self.single_iteration(&mut app, StartCause::Init);
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Consider the possibility that the `StartCause::Init` iteration could
|
|
|
|
|
// request to Exit.
|
2023-09-07 08:25:04 +02:00
|
|
|
if !self.exiting() {
|
2024-07-11 15:38:09 +02:00
|
|
|
self.poll_events_with_timeout(timeout, &mut app);
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
2023-09-07 08:25:04 +02:00
|
|
|
if let Some(code) = self.exit_code() {
|
2023-06-18 12:40:03 +01:00
|
|
|
self.loop_running = false;
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
app.exiting(&self.active_event_loop);
|
2023-06-18 12:40:03 +01:00
|
|
|
|
|
|
|
|
PumpStatus::Exit(code)
|
|
|
|
|
} else {
|
|
|
|
|
PumpStatus::Continue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-11 15:38:09 +02:00
|
|
|
fn poll_events_with_timeout<A: ApplicationHandler>(
|
2024-05-20 20:27:36 +04:00
|
|
|
&mut self,
|
|
|
|
|
mut timeout: Option<Duration>,
|
|
|
|
|
app: &mut A,
|
|
|
|
|
) {
|
2023-08-06 01:09:59 +04:00
|
|
|
let cause = loop {
|
|
|
|
|
let start = Instant::now();
|
|
|
|
|
|
2023-10-15 06:49:57 +04:00
|
|
|
timeout = {
|
2023-09-07 08:25:04 +02:00
|
|
|
let control_flow_timeout = match self.control_flow() {
|
2023-08-06 01:09:59 +04:00
|
|
|
ControlFlow::Wait => None,
|
|
|
|
|
ControlFlow::Poll => Some(Duration::ZERO),
|
|
|
|
|
ControlFlow::WaitUntil(wait_deadline) => {
|
|
|
|
|
Some(wait_deadline.saturating_duration_since(start))
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
min_timeout(control_flow_timeout, timeout)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// NOTE Ideally we should flush as the last thing we do before polling
|
|
|
|
|
// to wait for events, and this should be done by the calloop
|
|
|
|
|
// WaylandSource but we currently need to flush writes manually.
|
2023-10-15 06:49:57 +04:00
|
|
|
//
|
|
|
|
|
// Checking for flush error is essential to perform an exit with error, since
|
|
|
|
|
// once we have a protocol error, we could get stuck retrying...
|
|
|
|
|
if self.connection.flush().is_err() {
|
|
|
|
|
self.set_exit_code(1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-08-06 01:09:59 +04:00
|
|
|
|
|
|
|
|
if let Err(error) = self.loop_dispatch(timeout) {
|
|
|
|
|
// NOTE We exit on errors from dispatches, since if we've got protocol error
|
|
|
|
|
// libwayland-client/wayland-rs will inform us anyway, but crashing downstream is
|
|
|
|
|
// not really an option. Instead we inform that the event loop got
|
|
|
|
|
// destroyed. We may communicate an error that something was
|
|
|
|
|
// terminated, but winit doesn't provide us with an API to do that
|
|
|
|
|
// via some event. Still, we set the exit code to the error's OS
|
|
|
|
|
// error code, or to 1 if not possible.
|
|
|
|
|
let exit_code = error.raw_os_error().unwrap_or(1);
|
2023-09-07 08:25:04 +02:00
|
|
|
self.set_exit_code(exit_code);
|
2023-08-06 01:09:59 +04:00
|
|
|
return;
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
2022-03-11 18:15:33 +03:00
|
|
|
|
2023-08-06 01:09:59 +04:00
|
|
|
// NB: `StartCause::Init` is handled as a special case and doesn't need
|
|
|
|
|
// to be considered here
|
2023-09-07 08:25:04 +02:00
|
|
|
let cause = match self.control_flow() {
|
2023-08-06 01:09:59 +04:00
|
|
|
ControlFlow::Poll => StartCause::Poll,
|
|
|
|
|
ControlFlow::Wait => StartCause::WaitCancelled { start, requested_resume: None },
|
|
|
|
|
ControlFlow::WaitUntil(deadline) => {
|
|
|
|
|
if Instant::now() < deadline {
|
|
|
|
|
StartCause::WaitCancelled { start, requested_resume: Some(deadline) }
|
|
|
|
|
} else {
|
|
|
|
|
StartCause::ResumeTimeReached { start, requested_resume: deadline }
|
|
|
|
|
}
|
2022-03-11 18:15:33 +03:00
|
|
|
},
|
2023-06-18 12:40:03 +01:00
|
|
|
};
|
2022-03-11 18:15:33 +03:00
|
|
|
|
2023-08-06 01:09:59 +04:00
|
|
|
// Reduce spurious wake-ups.
|
|
|
|
|
let dispatched_events = self.with_state(|state| state.dispatched_events);
|
|
|
|
|
if matches!(cause, StartCause::WaitCancelled { .. }) && !dispatched_events {
|
|
|
|
|
continue;
|
2022-03-11 18:15:33 +03:00
|
|
|
}
|
2023-08-06 01:09:59 +04:00
|
|
|
|
|
|
|
|
break cause;
|
2023-06-18 12:40:03 +01:00
|
|
|
};
|
|
|
|
|
|
2024-05-20 20:27:36 +04:00
|
|
|
self.single_iteration(app, cause);
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-24 13:04:55 +03:00
|
|
|
fn single_iteration<A: ApplicationHandler>(&mut self, app: &mut A, cause: StartCause) {
|
2023-06-18 12:40:03 +01:00
|
|
|
// NOTE currently just indented to simplify the diff
|
|
|
|
|
|
|
|
|
|
// We retain these grow-only scratch buffers as part of the EventLoop
|
|
|
|
|
// for the sake of avoiding lots of reallocs. We take them here to avoid
|
|
|
|
|
// trying to mutably borrow `self` more than once and we swap them back
|
|
|
|
|
// when finished.
|
|
|
|
|
let mut compositor_updates = std::mem::take(&mut self.compositor_updates);
|
|
|
|
|
let mut buffer_sink = std::mem::take(&mut self.buffer_sink);
|
|
|
|
|
let mut window_ids = std::mem::take(&mut self.window_ids);
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
app.new_events(&self.active_event_loop, cause);
|
2023-06-18 12:40:03 +01:00
|
|
|
|
2024-06-30 00:41:57 +02:00
|
|
|
// NB: For consistency all platforms must call `can_create_surfaces` even though Wayland
|
|
|
|
|
// applications don't themselves have a formal surface destroy/create lifecycle.
|
2023-06-18 12:40:03 +01:00
|
|
|
if cause == StartCause::Init {
|
2024-08-06 21:02:53 +03:00
|
|
|
app.can_create_surfaces(&self.active_event_loop);
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-24 13:04:55 +03:00
|
|
|
// Indicate user wake up.
|
|
|
|
|
if self.with_state(|state| mem::take(&mut state.proxy_wake_up)) {
|
2024-08-06 21:02:53 +03:00
|
|
|
app.proxy_wake_up(&self.active_event_loop);
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drain the pending compositor updates.
|
|
|
|
|
self.with_state(|state| compositor_updates.append(&mut state.window_compositor_updates));
|
|
|
|
|
|
|
|
|
|
for mut compositor_update in compositor_updates.drain(..) {
|
|
|
|
|
let window_id = compositor_update.window_id;
|
2023-12-29 21:28:06 +04:00
|
|
|
if compositor_update.scale_changed {
|
|
|
|
|
let (physical_size, scale_factor) = self.with_state(|state| {
|
2023-06-18 12:40:03 +01:00
|
|
|
let windows = state.windows.get_mut();
|
2023-12-29 21:28:06 +04:00
|
|
|
let window = windows.get(&window_id).unwrap().lock().unwrap();
|
|
|
|
|
let scale_factor = window.scale_factor();
|
2024-09-04 15:04:48 +02:00
|
|
|
let size = logical_to_physical_rounded(window.surface_size(), scale_factor);
|
2023-12-29 21:28:06 +04:00
|
|
|
(size, scale_factor)
|
2023-06-18 12:40:03 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Stash the old window size.
|
|
|
|
|
let old_physical_size = physical_size;
|
2022-03-11 18:15:33 +03:00
|
|
|
|
2024-09-04 15:04:48 +02:00
|
|
|
let new_surface_size = Arc::new(Mutex::new(physical_size));
|
2024-05-20 20:27:36 +04:00
|
|
|
let root_window_id = crate::window::WindowId(window_id);
|
|
|
|
|
let event = WindowEvent::ScaleFactorChanged {
|
|
|
|
|
scale_factor,
|
2024-09-04 15:04:48 +02:00
|
|
|
surface_size_writer: SurfaceSizeWriter::new(Arc::downgrade(&new_surface_size)),
|
2024-05-20 20:27:36 +04:00
|
|
|
};
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
app.window_event(&self.active_event_loop, root_window_id, event);
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2024-09-04 15:04:48 +02:00
|
|
|
let physical_size = *new_surface_size.lock().unwrap();
|
|
|
|
|
drop(new_surface_size);
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-06-18 12:40:03 +01:00
|
|
|
// Resize the window when user altered the size.
|
|
|
|
|
if old_physical_size != physical_size {
|
|
|
|
|
self.with_state(|state| {
|
2023-04-19 00:56:29 +03:00
|
|
|
let windows = state.windows.get_mut();
|
|
|
|
|
let mut window = windows.get(&window_id).unwrap().lock().unwrap();
|
2023-12-29 21:28:06 +04:00
|
|
|
|
|
|
|
|
let new_logical_size: LogicalSize<f64> =
|
|
|
|
|
physical_size.to_logical(scale_factor);
|
2024-09-04 15:04:48 +02:00
|
|
|
window.request_surface_size(new_logical_size.into());
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
});
|
|
|
|
|
|
2023-12-29 21:28:06 +04:00
|
|
|
// Make it queue resize.
|
|
|
|
|
compositor_update.resized = true;
|
|
|
|
|
}
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
2023-04-19 00:56:29 +03:00
|
|
|
|
2024-01-03 21:49:11 +04:00
|
|
|
// NOTE: Rescale changed the physical size which winit operates in, thus we should
|
|
|
|
|
// resize.
|
|
|
|
|
if compositor_update.resized || compositor_update.scale_changed {
|
2023-06-18 12:40:03 +01:00
|
|
|
let physical_size = self.with_state(|state| {
|
|
|
|
|
let windows = state.windows.get_mut();
|
|
|
|
|
let window = windows.get(&window_id).unwrap().lock().unwrap();
|
2023-04-19 00:56:29 +03:00
|
|
|
|
2023-06-18 12:40:03 +01:00
|
|
|
let scale_factor = window.scale_factor();
|
2024-09-04 15:04:48 +02:00
|
|
|
let size = logical_to_physical_rounded(window.surface_size(), scale_factor);
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-06-18 12:40:03 +01:00
|
|
|
// Mark the window as needed a redraw.
|
|
|
|
|
state
|
|
|
|
|
.window_requests
|
|
|
|
|
.get_mut()
|
|
|
|
|
.get_mut(&window_id)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.redraw_requested
|
|
|
|
|
.store(true, Ordering::Relaxed);
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-12-29 21:28:06 +04:00
|
|
|
size
|
2023-06-18 12:40:03 +01:00
|
|
|
});
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2024-05-20 20:27:36 +04:00
|
|
|
let window_id = crate::window::WindowId(window_id);
|
2024-09-04 15:04:48 +02:00
|
|
|
let event = WindowEvent::SurfaceResized(physical_size);
|
2024-08-06 21:02:53 +03:00
|
|
|
app.window_event(&self.active_event_loop, window_id, event);
|
2023-04-19 00:56:29 +03:00
|
|
|
}
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-06-18 12:40:03 +01:00
|
|
|
if compositor_update.close_window {
|
2024-05-20 20:27:36 +04:00
|
|
|
let window_id = crate::window::WindowId(window_id);
|
2024-08-06 21:02:53 +03:00
|
|
|
app.window_event(&self.active_event_loop, window_id, WindowEvent::CloseRequested);
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
}
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Push the events directly from the window.
|
|
|
|
|
self.with_state(|state| {
|
|
|
|
|
buffer_sink.append(&mut state.window_events_sink.lock().unwrap());
|
|
|
|
|
});
|
|
|
|
|
for event in buffer_sink.drain() {
|
2024-05-20 20:27:36 +04:00
|
|
|
match event {
|
|
|
|
|
Event::WindowEvent { window_id, event } => {
|
2024-08-06 21:02:53 +03:00
|
|
|
app.window_event(&self.active_event_loop, window_id, event)
|
2024-05-20 20:27:36 +04:00
|
|
|
},
|
|
|
|
|
Event::DeviceEvent { device_id, event } => {
|
2024-08-06 21:02:53 +03:00
|
|
|
app.device_event(&self.active_event_loop, device_id, event)
|
2024-05-20 20:27:36 +04:00
|
|
|
},
|
|
|
|
|
_ => unreachable!("event which is neither device nor window event."),
|
|
|
|
|
}
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle non-synthetic events.
|
|
|
|
|
self.with_state(|state| {
|
|
|
|
|
buffer_sink.append(&mut state.events_sink);
|
|
|
|
|
});
|
|
|
|
|
for event in buffer_sink.drain() {
|
2024-05-20 20:27:36 +04:00
|
|
|
match event {
|
|
|
|
|
Event::WindowEvent { window_id, event } => {
|
2024-08-06 21:02:53 +03:00
|
|
|
app.window_event(&self.active_event_loop, window_id, event)
|
2024-05-20 20:27:36 +04:00
|
|
|
},
|
|
|
|
|
Event::DeviceEvent { device_id, event } => {
|
2024-08-06 21:02:53 +03:00
|
|
|
app.device_event(&self.active_event_loop, device_id, event)
|
2024-05-20 20:27:36 +04:00
|
|
|
},
|
|
|
|
|
_ => unreachable!("event which is neither device nor window event."),
|
|
|
|
|
}
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Collect the window ids
|
|
|
|
|
self.with_state(|state| {
|
|
|
|
|
window_ids.extend(state.window_requests.get_mut().keys());
|
|
|
|
|
});
|
|
|
|
|
|
2024-02-14 00:48:52 +04:00
|
|
|
for window_id in window_ids.iter() {
|
2023-12-22 19:56:52 +04:00
|
|
|
let event = self.with_state(|state| {
|
2023-06-18 12:40:03 +01:00
|
|
|
let window_requests = state.window_requests.get_mut();
|
2024-02-14 00:48:52 +04:00
|
|
|
if window_requests.get(window_id).unwrap().take_closed() {
|
|
|
|
|
mem::drop(window_requests.remove(window_id));
|
|
|
|
|
mem::drop(state.windows.get_mut().remove(window_id));
|
2023-12-22 19:56:52 +04:00
|
|
|
return Some(WindowEvent::Destroyed);
|
|
|
|
|
}
|
2023-06-22 09:12:47 +04:00
|
|
|
|
2023-12-22 19:56:52 +04:00
|
|
|
let mut window =
|
2024-02-14 00:48:52 +04:00
|
|
|
state.windows.get_mut().get_mut(window_id).unwrap().lock().unwrap();
|
2023-06-22 09:12:47 +04:00
|
|
|
|
2023-12-22 19:56:52 +04:00
|
|
|
if window.frame_callback_state() == FrameCallbackState::Requested {
|
|
|
|
|
return None;
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
2023-12-22 19:56:52 +04:00
|
|
|
|
|
|
|
|
// Reset the frame callbacks state.
|
|
|
|
|
window.frame_callback_reset();
|
|
|
|
|
let mut redraw_requested =
|
|
|
|
|
window_requests.get(window_id).unwrap().take_redraw_requested();
|
|
|
|
|
|
|
|
|
|
// Redraw the frame while at it.
|
|
|
|
|
redraw_requested |= window.refresh_frame();
|
|
|
|
|
|
|
|
|
|
redraw_requested.then_some(WindowEvent::RedrawRequested)
|
2022-08-12 11:54:02 +04:00
|
|
|
});
|
|
|
|
|
|
2023-12-22 19:56:52 +04:00
|
|
|
if let Some(event) = event {
|
2024-05-20 20:27:36 +04:00
|
|
|
let window_id = crate::window::WindowId(*window_id);
|
2024-08-06 21:02:53 +03:00
|
|
|
app.window_event(&self.active_event_loop, window_id, event);
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
}
|
2023-06-18 12:40:03 +01:00
|
|
|
}
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-08-06 01:09:59 +04:00
|
|
|
// Reset the hint that we've dispatched events.
|
|
|
|
|
self.with_state(|state| {
|
|
|
|
|
state.dispatched_events = false;
|
|
|
|
|
});
|
|
|
|
|
|
2023-07-28 17:37:56 +01:00
|
|
|
// This is always the last event we dispatch before poll again
|
2024-08-06 21:02:53 +03:00
|
|
|
app.about_to_wait(&self.active_event_loop);
|
2023-09-07 08:25:04 +02:00
|
|
|
|
2024-02-14 00:48:52 +04:00
|
|
|
// Update the window frames and schedule redraws.
|
|
|
|
|
let mut wake_up = false;
|
|
|
|
|
for window_id in window_ids.drain(..) {
|
|
|
|
|
wake_up |= self.with_state(|state| match state.windows.get_mut().get_mut(&window_id) {
|
|
|
|
|
Some(window) => {
|
|
|
|
|
let refresh = window.lock().unwrap().refresh_frame();
|
|
|
|
|
if refresh {
|
|
|
|
|
state
|
|
|
|
|
.window_requests
|
|
|
|
|
.get_mut()
|
|
|
|
|
.get_mut(&window_id)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.redraw_requested
|
|
|
|
|
.store(true, Ordering::Relaxed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
refresh
|
|
|
|
|
},
|
|
|
|
|
None => false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Wakeup event loop if needed.
|
|
|
|
|
//
|
|
|
|
|
// If the user draws from the `AboutToWait` this is likely not required, however
|
|
|
|
|
// we can't do much about it.
|
|
|
|
|
if wake_up {
|
2024-08-06 21:02:53 +03:00
|
|
|
self.active_event_loop.event_loop_awakener.ping();
|
2024-02-14 00:48:52 +04:00
|
|
|
}
|
|
|
|
|
|
2023-06-18 12:40:03 +01:00
|
|
|
std::mem::swap(&mut self.compositor_updates, &mut compositor_updates);
|
|
|
|
|
std::mem::swap(&mut self.buffer_sink, &mut buffer_sink);
|
|
|
|
|
std::mem::swap(&mut self.window_ids, &mut window_ids);
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[inline]
|
2024-08-06 21:02:53 +03:00
|
|
|
pub fn window_target(&self) -> &dyn RootActiveEventLoop {
|
|
|
|
|
&self.active_event_loop
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
}
|
|
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
fn with_state<'a, U: 'a, F: FnOnce(&'a mut WinitState) -> U>(&'a mut self, callback: F) -> U {
|
2024-08-06 21:02:53 +03:00
|
|
|
let state = self.active_event_loop.state.get_mut();
|
2023-04-19 00:56:29 +03:00
|
|
|
callback(state)
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
}
|
|
|
|
|
|
2021-08-15 22:31:59 +03:00
|
|
|
fn loop_dispatch<D: Into<Option<std::time::Duration>>>(&mut self, timeout: D) -> IOResult<()> {
|
2024-08-06 21:02:53 +03:00
|
|
|
let state = &mut self.active_event_loop.state.get_mut();
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
self.event_loop.dispatch(timeout, state).map_err(|error| {
|
2024-02-25 19:20:39 -08:00
|
|
|
tracing::error!("Error dispatching event loop: {}", error);
|
2023-04-19 00:56:29 +03:00
|
|
|
error.into()
|
|
|
|
|
})
|
|
|
|
|
}
|
2023-07-04 22:53:17 +01:00
|
|
|
|
2024-09-06 17:20:11 +03:00
|
|
|
fn roundtrip(&mut self) -> Result<usize, OsError> {
|
2024-08-06 21:02:53 +03:00
|
|
|
let state = &mut self.active_event_loop.state.get_mut();
|
2023-07-04 22:53:17 +01:00
|
|
|
|
|
|
|
|
let mut wayland_source = self.wayland_dispatcher.as_source_mut();
|
|
|
|
|
let event_queue = wayland_source.queue();
|
2024-09-06 17:20:11 +03:00
|
|
|
event_queue.roundtrip(state).map_err(|err| os_error!(err))
|
2023-07-04 22:53:17 +01:00
|
|
|
}
|
2023-09-07 08:25:04 +02:00
|
|
|
|
|
|
|
|
fn control_flow(&self) -> ControlFlow {
|
2024-08-06 21:02:53 +03:00
|
|
|
self.active_event_loop.control_flow()
|
2023-09-07 08:25:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn exiting(&self) -> bool {
|
2024-08-06 21:02:53 +03:00
|
|
|
self.active_event_loop.exiting()
|
2023-09-07 08:25:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn set_exit_code(&self, code: i32) {
|
2024-08-06 21:02:53 +03:00
|
|
|
self.active_event_loop.set_exit_code(code)
|
2023-09-07 08:25:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn exit_code(&self) -> Option<i32> {
|
2024-08-06 21:02:53 +03:00
|
|
|
self.active_event_loop.exit_code()
|
2023-09-07 08:25:04 +02:00
|
|
|
}
|
2023-04-19 00:56:29 +03:00
|
|
|
}
|
|
|
|
|
|
2024-06-24 13:04:55 +03:00
|
|
|
impl AsFd for EventLoop {
|
2023-10-15 20:31:29 +04:00
|
|
|
fn as_fd(&self) -> BorrowedFd<'_> {
|
|
|
|
|
self.event_loop.as_fd()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 13:04:55 +03:00
|
|
|
impl AsRawFd for EventLoop {
|
2023-10-15 20:31:29 +04:00
|
|
|
fn as_raw_fd(&self) -> RawFd {
|
|
|
|
|
self.event_loop.as_raw_fd()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 17:29:59 +04:00
|
|
|
pub struct ActiveEventLoop {
|
2024-06-29 17:19:09 +02:00
|
|
|
/// Event loop proxy
|
|
|
|
|
event_loop_proxy: EventLoopProxy,
|
|
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
/// The event loop wakeup source.
|
|
|
|
|
pub event_loop_awakener: calloop::ping::Ping,
|
|
|
|
|
|
|
|
|
|
/// The main queue used by the event loop.
|
|
|
|
|
pub queue_handle: QueueHandle<WinitState>,
|
|
|
|
|
|
2023-09-07 08:25:04 +02:00
|
|
|
/// The application's latest control_flow state
|
|
|
|
|
pub(crate) control_flow: Cell<ControlFlow>,
|
|
|
|
|
|
|
|
|
|
/// The application's exit state.
|
|
|
|
|
pub(crate) exit: Cell<Option<i32>>,
|
|
|
|
|
|
2023-04-19 00:56:29 +03:00
|
|
|
// TODO remove that RefCell once we can pass `&mut` in `Window::new`.
|
|
|
|
|
/// Winit state.
|
|
|
|
|
pub state: RefCell<WinitState>,
|
|
|
|
|
|
|
|
|
|
/// Dispatcher of Wayland events.
|
|
|
|
|
pub wayland_dispatcher: WaylandDispatcher,
|
|
|
|
|
|
|
|
|
|
/// Connection to the wayland server.
|
|
|
|
|
pub connection: Connection,
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
impl RootActiveEventLoop for ActiveEventLoop {
|
|
|
|
|
fn create_proxy(&self) -> crate::event_loop::EventLoopProxy {
|
|
|
|
|
crate::event_loop::EventLoopProxy {
|
|
|
|
|
event_loop_proxy: crate::platform_impl::EventLoopProxy::Wayland(
|
|
|
|
|
self.event_loop_proxy.clone(),
|
|
|
|
|
),
|
|
|
|
|
}
|
2024-06-29 17:19:09 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
fn set_control_flow(&self, control_flow: ControlFlow) {
|
2023-12-22 20:00:20 +04:00
|
|
|
self.control_flow.set(control_flow)
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
fn control_flow(&self) -> ControlFlow {
|
2023-12-22 20:00:20 +04:00
|
|
|
self.control_flow.get()
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
fn exit(&self) {
|
2023-12-22 20:00:20 +04:00
|
|
|
self.exit.set(Some(0))
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
fn exiting(&self) -> bool {
|
2023-12-22 20:00:20 +04:00
|
|
|
self.exit.get().is_some()
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-01 23:14:16 +02:00
|
|
|
#[inline]
|
2024-08-06 21:02:53 +03:00
|
|
|
fn listen_device_events(&self, _allowed: DeviceEvents) {}
|
2023-09-01 23:14:16 +02:00
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
fn create_custom_cursor(
|
2024-08-06 18:57:03 +02:00
|
|
|
&self,
|
|
|
|
|
cursor: CustomCursorSource,
|
2024-09-06 17:20:11 +03:00
|
|
|
) -> Result<RootCustomCursor, RequestError> {
|
2024-08-06 18:57:03 +02:00
|
|
|
Ok(RootCustomCursor {
|
2024-02-03 07:27:17 +04:00
|
|
|
inner: PlatformCustomCursor::Wayland(OnlyCursorImage(Arc::from(cursor.inner.0))),
|
2024-08-06 18:57:03 +02:00
|
|
|
})
|
2024-02-03 07:27:17 +04:00
|
|
|
}
|
|
|
|
|
|
2023-10-14 19:07:39 -07:00
|
|
|
#[inline]
|
2024-08-06 21:02:53 +03:00
|
|
|
fn system_theme(&self) -> Option<Theme> {
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn create_window(
|
2023-10-14 19:07:39 -07:00
|
|
|
&self,
|
2024-08-06 21:02:53 +03:00
|
|
|
window_attributes: crate::window::WindowAttributes,
|
2024-09-06 17:20:11 +03:00
|
|
|
) -> Result<Box<dyn crate::window::Window>, RequestError> {
|
2024-08-06 21:02:53 +03:00
|
|
|
let window = crate::platform_impl::wayland::Window::new(self, window_attributes)?;
|
2024-08-23 23:40:27 +03:00
|
|
|
Ok(Box::new(window))
|
2024-08-06 21:02:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn available_monitors(&self) -> Box<dyn Iterator<Item = crate::monitor::MonitorHandle>> {
|
|
|
|
|
Box::new(
|
|
|
|
|
self.state
|
|
|
|
|
.borrow()
|
|
|
|
|
.output_state
|
|
|
|
|
.outputs()
|
|
|
|
|
.map(crate::platform_impl::wayland::output::MonitorHandle::new)
|
|
|
|
|
.map(crate::platform_impl::MonitorHandle::Wayland)
|
|
|
|
|
.map(|inner| crate::monitor::MonitorHandle { inner }),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn primary_monitor(&self) -> Option<crate::monitor::MonitorHandle> {
|
|
|
|
|
// There's no primary monitor on Wayland.
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn owned_display_handle(&self) -> crate::event_loop::OwnedDisplayHandle {
|
|
|
|
|
crate::event_loop::OwnedDisplayHandle {
|
|
|
|
|
platform: crate::platform_impl::OwnedDisplayHandle::Wayland(self.connection.clone()),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "rwh_06")]
|
|
|
|
|
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
|
|
|
|
self
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ActiveEventLoop {
|
|
|
|
|
fn clear_exit(&self) {
|
|
|
|
|
self.exit.set(None)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn set_exit_code(&self, code: i32) {
|
|
|
|
|
self.exit.set(Some(code))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn exit_code(&self) -> Option<i32> {
|
|
|
|
|
self.exit.get()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "rwh_06")]
|
|
|
|
|
impl rwh_06::HasDisplayHandle for ActiveEventLoop {
|
|
|
|
|
fn display_handle(&self) -> Result<rwh_06::DisplayHandle<'_>, rwh_06::HandleError> {
|
2023-10-14 19:07:39 -07:00
|
|
|
use sctk::reexports::client::Proxy;
|
|
|
|
|
|
2024-08-06 21:02:53 +03:00
|
|
|
let raw = rwh_06::WaylandDisplayHandle::new({
|
2023-10-14 19:07:39 -07:00
|
|
|
let ptr = self.connection.display().id().as_ptr();
|
|
|
|
|
std::ptr::NonNull::new(ptr as *mut _).expect("wl_display should never be null")
|
2024-08-06 21:02:53 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Ok(unsafe { rwh_06::DisplayHandle::borrow_raw(raw.into()) })
|
Update SCTK to 0.11.0
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
2020-09-29 00:11:43 +03:00
|
|
|
}
|
|
|
|
|
}
|