mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Update Smithay
This commit is contained in:
Generated
+2
-2
@@ -3522,7 +3522,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay"
|
name = "smithay"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/Smithay/smithay.git#b29ff8fdbfa3a15b777d36a7c5f19f86dfe5c94c"
|
source = "git+https://github.com/Smithay/smithay.git#bcab0754ee883ee3dbda145a3ee2b704ee2ee68d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"appendlist",
|
"appendlist",
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
@@ -3594,7 +3594,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay-drm-extras"
|
name = "smithay-drm-extras"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Smithay/smithay.git#b29ff8fdbfa3a15b777d36a7c5f19f86dfe5c94c"
|
source = "git+https://github.com/Smithay/smithay.git#bcab0754ee883ee3dbda145a3ee2b704ee2ee68d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"drm",
|
"drm",
|
||||||
"libdisplay-info",
|
"libdisplay-info",
|
||||||
|
|||||||
@@ -143,6 +143,15 @@ impl PointerConstraintsHandler for State {
|
|||||||
&self.niri.pointer_focus,
|
&self.niri.pointer_focus,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn cursor_position_hint(
|
||||||
|
&mut self,
|
||||||
|
_surface: &WlSurface,
|
||||||
|
_pointer: &PointerHandle<Self>,
|
||||||
|
_location: Point<f64, Logical>,
|
||||||
|
) {
|
||||||
|
// FIXME
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delegate_pointer_constraints!(State);
|
delegate_pointer_constraints!(State);
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ use smithay::wayland::shell::kde::decoration::{KdeDecorationHandler, KdeDecorati
|
|||||||
use smithay::wayland::shell::wlr_layer::{self, Layer};
|
use smithay::wayland::shell::wlr_layer::{self, Layer};
|
||||||
use smithay::wayland::shell::xdg::decoration::XdgDecorationHandler;
|
use smithay::wayland::shell::xdg::decoration::XdgDecorationHandler;
|
||||||
use smithay::wayland::shell::xdg::{
|
use smithay::wayland::shell::xdg::{
|
||||||
PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler,
|
PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState,
|
||||||
XdgShellState, XdgToplevelSurfaceData,
|
XdgToplevelSurfaceData,
|
||||||
};
|
};
|
||||||
use smithay::wayland::xdg_foreign::{XdgForeignHandler, XdgForeignState};
|
use smithay::wayland::xdg_foreign::{XdgForeignHandler, XdgForeignState};
|
||||||
use smithay::{
|
use smithay::{
|
||||||
@@ -261,7 +261,7 @@ impl XdgShellHandler for State {
|
|||||||
|
|
||||||
// A configure is required in response to this event. However, if an initial configure
|
// A configure is required in response to this event. However, if an initial configure
|
||||||
// wasn't sent, then we will send this as part of the initial configure later.
|
// wasn't sent, then we will send this as part of the initial configure later.
|
||||||
if initial_configure_sent(&surface) {
|
if surface.is_initial_configure_sent() {
|
||||||
surface.send_configure();
|
surface.send_configure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -552,7 +552,7 @@ impl XdgDecorationHandler for State {
|
|||||||
|
|
||||||
// A configure is required in response to this event. However, if an initial configure
|
// A configure is required in response to this event. However, if an initial configure
|
||||||
// wasn't sent, then we will send this as part of the initial configure later.
|
// wasn't sent, then we will send this as part of the initial configure later.
|
||||||
if initial_configure_sent(&toplevel) {
|
if toplevel.is_initial_configure_sent() {
|
||||||
toplevel.send_configure();
|
toplevel.send_configure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -565,7 +565,7 @@ impl XdgDecorationHandler for State {
|
|||||||
|
|
||||||
// A configure is required in response to this event. However, if an initial configure
|
// A configure is required in response to this event. However, if an initial configure
|
||||||
// wasn't sent, then we will send this as part of the initial configure later.
|
// wasn't sent, then we will send this as part of the initial configure later.
|
||||||
if initial_configure_sent(&toplevel) {
|
if toplevel.is_initial_configure_sent() {
|
||||||
toplevel.send_configure();
|
toplevel.send_configure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -620,18 +620,6 @@ impl XdgForeignHandler for State {
|
|||||||
}
|
}
|
||||||
delegate_xdg_foreign!(State);
|
delegate_xdg_foreign!(State);
|
||||||
|
|
||||||
fn initial_configure_sent(toplevel: &ToplevelSurface) -> bool {
|
|
||||||
with_states(toplevel.wl_surface(), |states| {
|
|
||||||
states
|
|
||||||
.data_map
|
|
||||||
.get::<XdgToplevelSurfaceData>()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.initial_configure_sent
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
pub fn send_initial_configure(&mut self, toplevel: &ToplevelSurface) {
|
pub fn send_initial_configure(&mut self, toplevel: &ToplevelSurface) {
|
||||||
let _span = tracy_client::span!("State::send_initial_configure");
|
let _span = tracy_client::span!("State::send_initial_configure");
|
||||||
@@ -788,16 +776,7 @@ impl State {
|
|||||||
if let Some(popup) = self.niri.popups.find_popup(surface) {
|
if let Some(popup) = self.niri.popups.find_popup(surface) {
|
||||||
match popup {
|
match popup {
|
||||||
PopupKind::Xdg(ref popup) => {
|
PopupKind::Xdg(ref popup) => {
|
||||||
let initial_configure_sent = with_states(surface, |states| {
|
if !popup.is_initial_configure_sent() {
|
||||||
states
|
|
||||||
.data_map
|
|
||||||
.get::<XdgPopupSurfaceData>()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.initial_configure_sent
|
|
||||||
});
|
|
||||||
if !initial_configure_sent {
|
|
||||||
if let Some(output) = self.output_for_popup(&PopupKind::Xdg(popup.clone()))
|
if let Some(output) = self.output_for_popup(&PopupKind::Xdg(popup.clone()))
|
||||||
{
|
{
|
||||||
let scale = output.current_scale();
|
let scale = output.current_scale();
|
||||||
|
|||||||
+10
-5
@@ -16,7 +16,6 @@ use futures_util::{select_biased, AsyncBufReadExt, AsyncWrite, AsyncWriteExt, Fu
|
|||||||
use niri_config::OutputName;
|
use niri_config::OutputName;
|
||||||
use niri_ipc::state::{EventStreamState, EventStreamStatePart as _};
|
use niri_ipc::state::{EventStreamState, EventStreamStatePart as _};
|
||||||
use niri_ipc::{Event, KeyboardLayouts, OutputConfigChanged, Reply, Request, Response, Workspace};
|
use niri_ipc::{Event, KeyboardLayouts, OutputConfigChanged, Reply, Request, Response, Workspace};
|
||||||
use smithay::input::keyboard::XkbContextHandler;
|
|
||||||
use smithay::reexports::calloop::generic::Generic;
|
use smithay::reexports::calloop::generic::Generic;
|
||||||
use smithay::reexports::calloop::{Interest, LoopHandle, Mode, PostAction};
|
use smithay::reexports::calloop::{Interest, LoopHandle, Mode, PostAction};
|
||||||
use smithay::reexports::rustix::fs::unlink;
|
use smithay::reexports::rustix::fs::unlink;
|
||||||
@@ -385,10 +384,13 @@ impl State {
|
|||||||
pub fn ipc_keyboard_layouts_changed(&mut self) {
|
pub fn ipc_keyboard_layouts_changed(&mut self) {
|
||||||
let keyboard = self.niri.seat.get_keyboard().unwrap();
|
let keyboard = self.niri.seat.get_keyboard().unwrap();
|
||||||
let keyboard_layouts = keyboard.with_xkb_state(self, |context| {
|
let keyboard_layouts = keyboard.with_xkb_state(self, |context| {
|
||||||
let layouts = context.keymap().layouts();
|
let xkb = context.xkb().lock().unwrap();
|
||||||
|
let layouts = xkb.layouts();
|
||||||
KeyboardLayouts {
|
KeyboardLayouts {
|
||||||
names: layouts.map(str::to_owned).collect(),
|
names: layouts
|
||||||
current_idx: context.active_layout().0 as u8,
|
.map(|layout| xkb.layout_name(layout).to_owned())
|
||||||
|
.collect(),
|
||||||
|
current_idx: xkb.active_layout().0 as u8,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -406,7 +408,10 @@ impl State {
|
|||||||
|
|
||||||
pub fn ipc_refresh_keyboard_layout_index(&mut self) {
|
pub fn ipc_refresh_keyboard_layout_index(&mut self) {
|
||||||
let keyboard = self.niri.seat.get_keyboard().unwrap();
|
let keyboard = self.niri.seat.get_keyboard().unwrap();
|
||||||
let idx = keyboard.with_xkb_state(self, |context| context.active_layout().0 as u8);
|
let idx = keyboard.with_xkb_state(self, |context| {
|
||||||
|
let xkb = context.xkb().lock().unwrap();
|
||||||
|
xkb.active_layout().0 as u8
|
||||||
|
});
|
||||||
|
|
||||||
let Some(server) = &self.niri.ipc_server else {
|
let Some(server) = &self.niri.ipc_server else {
|
||||||
return;
|
return;
|
||||||
|
|||||||
+10
-10
@@ -44,7 +44,7 @@ use smithay::desktop::{
|
|||||||
layer_map_for_output, LayerSurface, PopupGrab, PopupManager, PopupUngrabStrategy, Space,
|
layer_map_for_output, LayerSurface, PopupGrab, PopupManager, PopupUngrabStrategy, Space,
|
||||||
Window, WindowSurfaceType,
|
Window, WindowSurfaceType,
|
||||||
};
|
};
|
||||||
use smithay::input::keyboard::{Layout as KeyboardLayout, XkbContextHandler};
|
use smithay::input::keyboard::Layout as KeyboardLayout;
|
||||||
use smithay::input::pointer::{CursorIcon, CursorImageAttributes, CursorImageStatus, MotionEvent};
|
use smithay::input::pointer::{CursorIcon, CursorImageAttributes, CursorImageStatus, MotionEvent};
|
||||||
use smithay::input::{Seat, SeatState};
|
use smithay::input::{Seat, SeatState};
|
||||||
use smithay::output::{self, Output, OutputModeSource, PhysicalProperties, Subpixel};
|
use smithay::output::{self, Output, OutputModeSource, PhysicalProperties, Subpixel};
|
||||||
@@ -641,13 +641,13 @@ impl State {
|
|||||||
let Some(output) = self.niri.layout.active_output() else {
|
let Some(output) = self.niri.layout.active_output() else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
let monitor = self.niri.layout.monitor_for_output(&output).unwrap();
|
let monitor = self.niri.layout.monitor_for_output(output).unwrap();
|
||||||
|
|
||||||
let mut rv = false;
|
let mut rv = false;
|
||||||
let rect = monitor.active_tile_visual_rectangle();
|
let rect = monitor.active_tile_visual_rectangle();
|
||||||
|
|
||||||
if let Some(rect) = rect {
|
if let Some(rect) = rect {
|
||||||
let output_geo = self.niri.global_space.output_geometry(&output).unwrap();
|
let output_geo = self.niri.global_space.output_geometry(output).unwrap();
|
||||||
let mut rect = rect;
|
let mut rect = rect;
|
||||||
rect.loc += output_geo.loc.to_f64();
|
rect.loc += output_geo.loc.to_f64();
|
||||||
rv = self.move_cursor_to_rect(rect, mode);
|
rv = self.move_cursor_to_rect(rect, mode);
|
||||||
@@ -899,8 +899,10 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.niri.config.borrow().input.keyboard.track_layout == TrackLayout::Window {
|
if self.niri.config.borrow().input.keyboard.track_layout == TrackLayout::Window {
|
||||||
let current_layout =
|
let current_layout = keyboard.with_xkb_state(self, |context| {
|
||||||
keyboard.with_xkb_state(self, |context| context.active_layout());
|
let xkb = context.xkb().lock().unwrap();
|
||||||
|
xkb.active_layout()
|
||||||
|
});
|
||||||
|
|
||||||
let mut new_layout = current_layout;
|
let mut new_layout = current_layout;
|
||||||
// Store the currently active layout for the surface.
|
// Store the currently active layout for the surface.
|
||||||
@@ -2601,16 +2603,14 @@ impl Niri {
|
|||||||
let pointer_pos =
|
let pointer_pos =
|
||||||
(pointer_pos - hotspot.to_f64()).to_physical_precise_round(output_scale);
|
(pointer_pos - hotspot.to_f64()).to_physical_precise_round(output_scale);
|
||||||
|
|
||||||
let pointer_elements = render_elements_from_surface_tree(
|
render_elements_from_surface_tree(
|
||||||
renderer,
|
renderer,
|
||||||
&surface,
|
&surface,
|
||||||
pointer_pos,
|
pointer_pos,
|
||||||
output_scale,
|
output_scale,
|
||||||
1.,
|
1.,
|
||||||
Kind::Cursor,
|
Kind::Cursor,
|
||||||
);
|
)
|
||||||
|
|
||||||
pointer_elements
|
|
||||||
}
|
}
|
||||||
RenderCursor::Named {
|
RenderCursor::Named {
|
||||||
icon,
|
icon,
|
||||||
@@ -2760,7 +2760,7 @@ impl Niri {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let icon = if let CursorImageStatus::Named(icon) = cursor_image {
|
let icon = if let CursorImageStatus::Named(icon) = cursor_image {
|
||||||
icon.clone()
|
*icon
|
||||||
} else {
|
} else {
|
||||||
Default::default()
|
Default::default()
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user