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::cell::Cell;
|
|
|
|
|
use std::sync::{Arc, Mutex};
|
|
|
|
|
|
2022-04-12 19:10:46 +02:00
|
|
|
use sctk::reexports::client::protocol::wl_compositor::WlCompositor;
|
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 sctk::reexports::client::protocol::wl_output::WlOutput;
|
2021-08-17 07:59:57 +03:00
|
|
|
use sctk::reexports::client::Attached;
|
|
|
|
|
use sctk::reexports::protocols::staging::xdg_activation::v1::client::xdg_activation_token_v1;
|
|
|
|
|
use sctk::reexports::protocols::staging::xdg_activation::v1::client::xdg_activation_v1::XdgActivationV1;
|
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-17 07:59:57 +03:00
|
|
|
use sctk::environment::Environment;
|
2022-05-20 02:09:23 +02:00
|
|
|
use sctk::window::{Decorations, Window};
|
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 crate::dpi::{LogicalPosition, LogicalSize};
|
|
|
|
|
|
2022-05-07 05:29:25 +03:00
|
|
|
use crate::event::{Ime, WindowEvent};
|
2021-08-17 07:59:57 +03:00
|
|
|
use crate::platform_impl::wayland;
|
|
|
|
|
use crate::platform_impl::wayland::env::WinitEnv;
|
2022-05-07 05:29:25 +03:00
|
|
|
use crate::platform_impl::wayland::event_loop::{EventSink, 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
|
|
|
use crate::platform_impl::wayland::seat::pointer::WinitPointer;
|
|
|
|
|
use crate::platform_impl::wayland::seat::text_input::TextInputHandler;
|
|
|
|
|
use crate::platform_impl::wayland::WindowId;
|
2022-05-20 02:09:23 +02:00
|
|
|
use crate::window::{CursorIcon, Theme, UserAttentionType};
|
|
|
|
|
|
|
|
|
|
use super::WinitFrame;
|
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
|
|
|
|
|
|
|
|
/// A request to SCTK window from Winit window.
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum WindowRequest {
|
|
|
|
|
/// Set fullscreen.
|
|
|
|
|
///
|
|
|
|
|
/// Passing `None` will set it on the current monitor.
|
|
|
|
|
Fullscreen(Option<WlOutput>),
|
|
|
|
|
|
|
|
|
|
/// Unset fullscreen.
|
|
|
|
|
UnsetFullscreen,
|
|
|
|
|
|
|
|
|
|
/// Show cursor for the certain window or not.
|
|
|
|
|
ShowCursor(bool),
|
|
|
|
|
|
|
|
|
|
/// Change the cursor icon.
|
|
|
|
|
NewCursorIcon(CursorIcon),
|
|
|
|
|
|
|
|
|
|
/// Grab cursor.
|
|
|
|
|
GrabCursor(bool),
|
|
|
|
|
|
2021-03-07 10:43:23 +01:00
|
|
|
/// Drag window.
|
|
|
|
|
DragWindow,
|
|
|
|
|
|
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
|
|
|
/// Maximize the window.
|
|
|
|
|
Maximize(bool),
|
|
|
|
|
|
|
|
|
|
/// Minimize the window.
|
|
|
|
|
Minimize,
|
|
|
|
|
|
|
|
|
|
/// Request decorations change.
|
|
|
|
|
Decorate(bool),
|
|
|
|
|
|
2022-05-20 02:09:23 +02:00
|
|
|
/// Request decorations change.
|
|
|
|
|
CsdThemeVariant(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
|
|
|
/// Make the window resizeable.
|
|
|
|
|
Resizeable(bool),
|
|
|
|
|
|
|
|
|
|
/// Set the title for window.
|
|
|
|
|
Title(String),
|
|
|
|
|
|
|
|
|
|
/// Min size.
|
|
|
|
|
MinSize(Option<LogicalSize<u32>>),
|
|
|
|
|
|
|
|
|
|
/// Max size.
|
|
|
|
|
MaxSize(Option<LogicalSize<u32>>),
|
|
|
|
|
|
|
|
|
|
/// New frame size.
|
|
|
|
|
FrameSize(LogicalSize<u32>),
|
|
|
|
|
|
|
|
|
|
/// Set IME window position.
|
2022-05-07 05:29:25 +03:00
|
|
|
ImePosition(LogicalPosition<u32>),
|
|
|
|
|
|
|
|
|
|
/// Enable IME on the given window.
|
|
|
|
|
AllowIme(bool),
|
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-17 07:59:57 +03:00
|
|
|
/// Request Attention.
|
|
|
|
|
///
|
|
|
|
|
/// `None` unsets the attention request.
|
|
|
|
|
Attention(Option<UserAttentionType>),
|
|
|
|
|
|
2022-04-12 19:10:46 +02:00
|
|
|
/// Passthrough mouse input to underlying windows.
|
|
|
|
|
PassthroughMouseInput(bool),
|
|
|
|
|
|
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
|
|
|
/// Redraw was requested.
|
|
|
|
|
Redraw,
|
|
|
|
|
|
|
|
|
|
/// Window should be closed.
|
|
|
|
|
Close,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Pending update to a window from SCTK window.
|
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
|
|
|
pub struct WindowUpdate {
|
|
|
|
|
/// New window size.
|
|
|
|
|
pub size: Option<LogicalSize<u32>>,
|
|
|
|
|
|
|
|
|
|
/// New scale factor.
|
|
|
|
|
pub scale_factor: Option<i32>,
|
|
|
|
|
|
|
|
|
|
/// Whether `redraw` was requested.
|
|
|
|
|
pub redraw_requested: bool,
|
|
|
|
|
|
|
|
|
|
/// Wether the frame should be refreshed.
|
|
|
|
|
pub refresh_frame: bool,
|
|
|
|
|
|
|
|
|
|
/// Close the window.
|
|
|
|
|
pub close_window: bool,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl WindowUpdate {
|
|
|
|
|
pub fn new() -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
size: None,
|
|
|
|
|
scale_factor: None,
|
|
|
|
|
redraw_requested: false,
|
|
|
|
|
refresh_frame: false,
|
|
|
|
|
close_window: false,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn take(&mut self) -> Self {
|
|
|
|
|
let size = self.size.take();
|
|
|
|
|
let scale_factor = self.scale_factor.take();
|
|
|
|
|
|
|
|
|
|
let redraw_requested = self.redraw_requested;
|
|
|
|
|
self.redraw_requested = false;
|
|
|
|
|
|
|
|
|
|
let refresh_frame = self.refresh_frame;
|
|
|
|
|
self.refresh_frame = false;
|
|
|
|
|
|
|
|
|
|
let close_window = self.close_window;
|
|
|
|
|
self.close_window = false;
|
|
|
|
|
|
|
|
|
|
Self {
|
|
|
|
|
size,
|
|
|
|
|
scale_factor,
|
|
|
|
|
redraw_requested,
|
|
|
|
|
refresh_frame,
|
|
|
|
|
close_window,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A handle to perform operations on SCTK window
|
|
|
|
|
/// and react to events.
|
|
|
|
|
pub struct WindowHandle {
|
|
|
|
|
/// An actual window.
|
2022-05-20 02:09:23 +02:00
|
|
|
pub window: Window<WinitFrame>,
|
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
|
|
|
|
|
|
|
|
/// The current size of the window.
|
|
|
|
|
pub size: Arc<Mutex<LogicalSize<u32>>>,
|
|
|
|
|
|
|
|
|
|
/// A pending requests to SCTK window.
|
|
|
|
|
pub pending_window_requests: Arc<Mutex<Vec<WindowRequest>>>,
|
|
|
|
|
|
|
|
|
|
/// Current cursor icon.
|
|
|
|
|
pub cursor_icon: Cell<CursorIcon>,
|
|
|
|
|
|
2022-04-24 23:35:18 +03:00
|
|
|
/// Whether the window is resizable.
|
|
|
|
|
pub is_resizable: Cell<bool>,
|
|
|
|
|
|
2022-05-07 05:29:25 +03:00
|
|
|
/// Allow IME events for that window.
|
|
|
|
|
pub ime_allowed: Cell<bool>,
|
|
|
|
|
|
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
|
|
|
/// Visible cursor or not.
|
|
|
|
|
cursor_visible: Cell<bool>,
|
|
|
|
|
|
|
|
|
|
/// Cursor confined to the surface.
|
|
|
|
|
confined: Cell<bool>,
|
|
|
|
|
|
|
|
|
|
/// Pointers over the current surface.
|
|
|
|
|
pointers: Vec<WinitPointer>,
|
|
|
|
|
|
|
|
|
|
/// Text inputs on the current surface.
|
|
|
|
|
text_inputs: Vec<TextInputHandler>,
|
2021-08-17 07:59:57 +03:00
|
|
|
|
|
|
|
|
/// XdgActivation object.
|
|
|
|
|
xdg_activation: Option<Attached<XdgActivationV1>>,
|
|
|
|
|
|
|
|
|
|
/// Indicator whether user attention is requested.
|
|
|
|
|
attention_requested: Cell<bool>,
|
2022-04-12 19:10:46 +02:00
|
|
|
|
|
|
|
|
/// Compositor
|
|
|
|
|
compositor: Attached<WlCompositor>,
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl WindowHandle {
|
|
|
|
|
pub fn new(
|
2021-08-17 07:59:57 +03:00
|
|
|
env: &Environment<WinitEnv>,
|
2022-05-20 02:09:23 +02:00
|
|
|
window: Window<WinitFrame>,
|
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
|
|
|
size: Arc<Mutex<LogicalSize<u32>>>,
|
|
|
|
|
pending_window_requests: Arc<Mutex<Vec<WindowRequest>>>,
|
|
|
|
|
) -> Self {
|
2021-08-17 07:59:57 +03:00
|
|
|
let xdg_activation = env.get_global::<XdgActivationV1>();
|
2022-04-12 19:10:46 +02:00
|
|
|
// Unwrap is safe, since we can't create window without compositor anyway and won't be
|
|
|
|
|
// here.
|
|
|
|
|
let compositor = env.get_global::<WlCompositor>().unwrap();
|
2021-08-17 07:59:57 +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
|
|
|
Self {
|
|
|
|
|
window,
|
|
|
|
|
size,
|
|
|
|
|
pending_window_requests,
|
|
|
|
|
cursor_icon: Cell::new(CursorIcon::Default),
|
2022-04-24 23:35:18 +03:00
|
|
|
is_resizable: Cell::new(true),
|
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
|
|
|
confined: Cell::new(false),
|
|
|
|
|
cursor_visible: Cell::new(true),
|
|
|
|
|
pointers: Vec::new(),
|
|
|
|
|
text_inputs: Vec::new(),
|
2021-08-17 07:59:57 +03:00
|
|
|
xdg_activation,
|
|
|
|
|
attention_requested: Cell::new(false),
|
2022-04-12 19:10:46 +02:00
|
|
|
compositor,
|
2022-05-07 05:29:25 +03:00
|
|
|
ime_allowed: Cell::new(false),
|
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 fn set_cursor_grab(&self, grab: bool) {
|
|
|
|
|
// The new requested state matches the current confine status, return.
|
|
|
|
|
if self.confined.get() == grab {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.confined.replace(grab);
|
|
|
|
|
|
|
|
|
|
for pointer in self.pointers.iter() {
|
|
|
|
|
if self.confined.get() {
|
|
|
|
|
let surface = self.window.surface();
|
2021-08-15 22:31:59 +03:00
|
|
|
pointer.confine(surface);
|
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
|
|
|
} else {
|
|
|
|
|
pointer.unconfine();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-17 07:59:57 +03:00
|
|
|
pub fn set_user_attention(&self, request_type: Option<UserAttentionType>) {
|
|
|
|
|
let xdg_activation = match self.xdg_activation.as_ref() {
|
|
|
|
|
None => return,
|
|
|
|
|
Some(xdg_activation) => xdg_activation,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Urgency is only removed by the compositor and there's no need to raise urgency when it
|
|
|
|
|
// was already raised.
|
|
|
|
|
if request_type.is_none() || self.attention_requested.get() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let xdg_activation_token = xdg_activation.get_activation_token();
|
|
|
|
|
let surface = self.window.surface();
|
|
|
|
|
let window_id = wayland::make_wid(surface);
|
|
|
|
|
let xdg_activation = xdg_activation.clone();
|
|
|
|
|
|
|
|
|
|
xdg_activation_token.quick_assign(move |xdg_token, event, mut dispatch_data| {
|
|
|
|
|
let token = match event {
|
|
|
|
|
xdg_activation_token_v1::Event::Done { token } => token,
|
|
|
|
|
_ => return,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let winit_state = dispatch_data.get::<WinitState>().unwrap();
|
|
|
|
|
let window_handle = match winit_state.window_map.get_mut(&window_id) {
|
|
|
|
|
Some(window_handle) => window_handle,
|
|
|
|
|
None => return,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let surface = window_handle.window.surface();
|
|
|
|
|
xdg_activation.activate(token, surface);
|
|
|
|
|
|
|
|
|
|
// Mark that attention request was done and drop the token.
|
|
|
|
|
window_handle.attention_requested.replace(false);
|
|
|
|
|
xdg_token.destroy();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
xdg_activation_token.set_surface(surface);
|
|
|
|
|
xdg_activation_token.commit();
|
|
|
|
|
self.attention_requested.replace(true);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
/// Pointer appeared over the window.
|
|
|
|
|
pub fn pointer_entered(&mut self, pointer: WinitPointer) {
|
|
|
|
|
let position = self.pointers.iter().position(|p| *p == pointer);
|
|
|
|
|
|
|
|
|
|
if position.is_none() {
|
|
|
|
|
if self.confined.get() {
|
|
|
|
|
let surface = self.window.surface();
|
2021-08-15 22:31:59 +03:00
|
|
|
pointer.confine(surface);
|
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
|
|
|
}
|
|
|
|
|
self.pointers.push(pointer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply the current cursor style.
|
|
|
|
|
self.set_cursor_visible(self.cursor_visible.get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Pointer left the window.
|
|
|
|
|
pub fn pointer_left(&mut self, pointer: WinitPointer) {
|
|
|
|
|
let position = self.pointers.iter().position(|p| *p == pointer);
|
|
|
|
|
|
|
|
|
|
if let Some(position) = position {
|
|
|
|
|
let pointer = self.pointers.remove(position);
|
|
|
|
|
|
|
|
|
|
// Drop the confined pointer.
|
|
|
|
|
if self.confined.get() {
|
|
|
|
|
pointer.unconfine();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn text_input_entered(&mut self, text_input: TextInputHandler) {
|
2021-08-15 22:31:59 +03:00
|
|
|
if !self.text_inputs.iter().any(|t| *t == text_input) {
|
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
|
|
|
self.text_inputs.push(text_input);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn text_input_left(&mut self, text_input: TextInputHandler) {
|
|
|
|
|
if let Some(position) = self.text_inputs.iter().position(|t| *t == text_input) {
|
|
|
|
|
self.text_inputs.remove(position);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn set_ime_position(&self, position: LogicalPosition<u32>) {
|
|
|
|
|
// XXX This won't fly unless user will have a way to request IME window per seat, since
|
|
|
|
|
// the ime windows will be overlapping, but winit doesn't expose API to specify for
|
|
|
|
|
// which seat we're setting IME position.
|
|
|
|
|
let (x, y) = (position.x as i32, position.y as i32);
|
|
|
|
|
for text_input in self.text_inputs.iter() {
|
|
|
|
|
text_input.set_ime_position(x, y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-12 19:10:46 +02:00
|
|
|
pub fn passthrough_mouse_input(&self, passthrough_mouse_input: bool) {
|
|
|
|
|
if passthrough_mouse_input {
|
|
|
|
|
let region = self.compositor.create_region();
|
|
|
|
|
region.add(0, 0, 0, 0);
|
|
|
|
|
self.window
|
|
|
|
|
.surface()
|
|
|
|
|
.set_input_region(Some(®ion.detach()));
|
|
|
|
|
region.destroy();
|
|
|
|
|
} else {
|
|
|
|
|
// Using `None` results in the entire window being clickable.
|
|
|
|
|
self.window.surface().set_input_region(None);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-07 05:29:25 +03:00
|
|
|
pub fn set_ime_allowed(&self, allowed: bool, event_sink: &mut EventSink) {
|
|
|
|
|
if self.ime_allowed.get() == allowed {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.ime_allowed.replace(allowed);
|
|
|
|
|
let window_id = wayland::make_wid(self.window.surface());
|
|
|
|
|
|
|
|
|
|
for text_input in self.text_inputs.iter() {
|
|
|
|
|
text_input.set_input_allowed(allowed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let event = if allowed {
|
|
|
|
|
WindowEvent::Ime(Ime::Enabled)
|
|
|
|
|
} else {
|
|
|
|
|
WindowEvent::Ime(Ime::Disabled)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
event_sink.push_window_event(event, window_id);
|
|
|
|
|
}
|
|
|
|
|
|
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 fn set_cursor_visible(&self, visible: bool) {
|
|
|
|
|
self.cursor_visible.replace(visible);
|
|
|
|
|
let cursor_icon = match visible {
|
|
|
|
|
true => Some(self.cursor_icon.get()),
|
|
|
|
|
false => None,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for pointer in self.pointers.iter() {
|
|
|
|
|
pointer.set_cursor(cursor_icon)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn set_cursor_icon(&self, cursor_icon: CursorIcon) {
|
|
|
|
|
self.cursor_icon.replace(cursor_icon);
|
|
|
|
|
|
|
|
|
|
if !self.cursor_visible.get() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for pointer in self.pointers.iter() {
|
|
|
|
|
pointer.set_cursor(Some(cursor_icon));
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-07 10:43:23 +01:00
|
|
|
|
|
|
|
|
pub fn drag_window(&self) {
|
|
|
|
|
for pointer in self.pointers.iter() {
|
|
|
|
|
pointer.drag_window(&self.window);
|
|
|
|
|
}
|
|
|
|
|
}
|
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]
|
|
|
|
|
pub fn handle_window_requests(winit_state: &mut WinitState) {
|
|
|
|
|
let window_map = &mut winit_state.window_map;
|
|
|
|
|
let window_updates = &mut winit_state.window_updates;
|
|
|
|
|
let mut windows_to_close: Vec<WindowId> = Vec::new();
|
|
|
|
|
|
|
|
|
|
// Process the rest of the events.
|
|
|
|
|
for (window_id, window_handle) in window_map.iter_mut() {
|
|
|
|
|
let mut requests = window_handle.pending_window_requests.lock().unwrap();
|
|
|
|
|
for request in requests.drain(..) {
|
|
|
|
|
match request {
|
|
|
|
|
WindowRequest::Fullscreen(fullscreen) => {
|
|
|
|
|
window_handle.window.set_fullscreen(fullscreen.as_ref());
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::UnsetFullscreen => {
|
|
|
|
|
window_handle.window.unset_fullscreen();
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::ShowCursor(show_cursor) => {
|
|
|
|
|
window_handle.set_cursor_visible(show_cursor);
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::NewCursorIcon(cursor_icon) => {
|
|
|
|
|
window_handle.set_cursor_icon(cursor_icon);
|
|
|
|
|
}
|
2022-05-07 05:29:25 +03:00
|
|
|
WindowRequest::ImePosition(position) => {
|
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
|
|
|
window_handle.set_ime_position(position);
|
|
|
|
|
}
|
2022-05-07 05:29:25 +03:00
|
|
|
WindowRequest::AllowIme(allow) => {
|
|
|
|
|
let event_sink = &mut winit_state.event_sink;
|
|
|
|
|
window_handle.set_ime_allowed(allow, event_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
|
|
|
WindowRequest::GrabCursor(grab) => {
|
|
|
|
|
window_handle.set_cursor_grab(grab);
|
|
|
|
|
}
|
2021-03-07 10:43:23 +01:00
|
|
|
WindowRequest::DragWindow => {
|
|
|
|
|
window_handle.drag_window();
|
|
|
|
|
}
|
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
|
|
|
WindowRequest::Maximize(maximize) => {
|
|
|
|
|
if maximize {
|
|
|
|
|
window_handle.window.set_maximized();
|
|
|
|
|
} else {
|
|
|
|
|
window_handle.window.unset_maximized();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::Minimize => {
|
|
|
|
|
window_handle.window.set_minimized();
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::Decorate(decorate) => {
|
|
|
|
|
let decorations = match decorate {
|
|
|
|
|
true => Decorations::FollowServer,
|
|
|
|
|
false => Decorations::None,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window_handle.window.set_decorate(decorations);
|
|
|
|
|
|
|
|
|
|
// We should refresh the frame to apply decorations change.
|
2021-08-15 22:31:59 +03:00
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
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
|
|
|
window_update.refresh_frame = true;
|
|
|
|
|
}
|
2022-05-20 02:09:23 +02:00
|
|
|
#[cfg(feature = "sctk-adwaita")]
|
|
|
|
|
WindowRequest::CsdThemeVariant(theme) => {
|
|
|
|
|
window_handle.window.set_frame_config(theme.into());
|
|
|
|
|
|
|
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
|
|
|
|
window_update.refresh_frame = true;
|
|
|
|
|
}
|
|
|
|
|
#[cfg(not(feature = "sctk-adwaita"))]
|
|
|
|
|
WindowRequest::CsdThemeVariant(_) => {}
|
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
|
|
|
WindowRequest::Resizeable(resizeable) => {
|
|
|
|
|
window_handle.window.set_resizable(resizeable);
|
|
|
|
|
|
|
|
|
|
// We should refresh the frame to update button state.
|
2021-08-15 22:31:59 +03:00
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
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
|
|
|
window_update.refresh_frame = true;
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::Title(title) => {
|
|
|
|
|
window_handle.window.set_title(title);
|
|
|
|
|
|
|
|
|
|
// We should refresh the frame to draw new title.
|
2021-08-15 22:31:59 +03:00
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
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
|
|
|
window_update.refresh_frame = true;
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::MinSize(size) => {
|
|
|
|
|
let size = size.map(|size| (size.width, size.height));
|
|
|
|
|
window_handle.window.set_min_size(size);
|
|
|
|
|
|
2021-08-15 22:31:59 +03:00
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
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
|
|
|
window_update.redraw_requested = true;
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::MaxSize(size) => {
|
|
|
|
|
let size = size.map(|size| (size.width, size.height));
|
|
|
|
|
window_handle.window.set_max_size(size);
|
|
|
|
|
|
2021-08-15 22:31:59 +03:00
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
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
|
|
|
window_update.redraw_requested = true;
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::FrameSize(size) => {
|
2022-04-24 23:35:18 +03:00
|
|
|
if !window_handle.is_resizable.get() {
|
|
|
|
|
// On Wayland non-resizable window is achieved by setting both min and max
|
|
|
|
|
// size of the window to the same value.
|
|
|
|
|
let size = Some((size.width, size.height));
|
|
|
|
|
window_handle.window.set_max_size(size);
|
|
|
|
|
window_handle.window.set_min_size(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
|
|
|
window_handle.window.resize(size.width, size.height);
|
|
|
|
|
|
|
|
|
|
// We should refresh the frame after resize.
|
2021-08-15 22:31:59 +03:00
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
2022-04-12 19:10:46 +02:00
|
|
|
window_update.refresh_frame = true;
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::PassthroughMouseInput(passthrough) => {
|
|
|
|
|
window_handle.passthrough_mouse_input(passthrough);
|
|
|
|
|
|
|
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
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
|
|
|
window_update.refresh_frame = true;
|
|
|
|
|
}
|
2021-08-17 07:59:57 +03:00
|
|
|
WindowRequest::Attention(request_type) => {
|
|
|
|
|
window_handle.set_user_attention(request_type);
|
|
|
|
|
}
|
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
|
|
|
WindowRequest::Redraw => {
|
2021-08-15 22:31:59 +03:00
|
|
|
let window_update = window_updates.get_mut(window_id).unwrap();
|
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
|
|
|
window_update.redraw_requested = true;
|
|
|
|
|
}
|
|
|
|
|
WindowRequest::Close => {
|
|
|
|
|
// The window was requested to be closed.
|
|
|
|
|
windows_to_close.push(*window_id);
|
|
|
|
|
|
|
|
|
|
// Send event that the window was destroyed.
|
|
|
|
|
let event_sink = &mut winit_state.event_sink;
|
|
|
|
|
event_sink.push_window_event(WindowEvent::Destroyed, *window_id);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Close the windows.
|
|
|
|
|
for window in windows_to_close {
|
|
|
|
|
let _ = window_map.remove(&window);
|
|
|
|
|
let _ = window_updates.remove(&window);
|
|
|
|
|
}
|
|
|
|
|
}
|