Compare commits

...

5 Commits

Author SHA1 Message Date
Ivan Molodetskikh 75c79116a7 Bump version to 0.1.10-1
Uhh, apparently cargo doesn't like four-component versions.
2024-11-13 10:39:54 +03:00
Ivan Molodetskikh 4f44ef081f Guard against closed screenshot UI in its binds
They can trigger with closed screenshot UI via key repeat.
2024-11-13 10:24:21 +03:00
Ramses 4fc76b50d0 Unhide the pointer on scroll events (#797)
* Unhide the pointer on scroll events

Since we reset the surface under the pointer when we hide the pointer
(see update_pointer_contents), scroll events don't work when the pointer
is hidden.
So to make scrolling work, we make sure that we unhide the pointer when
a scrolling event occurs.

* Update src/input/mod.rs

---------

Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
2024-11-13 10:24:06 +03:00
Ivan Molodetskikh e1f065ac23 Start interactive move on Mod+Touch 2024-11-13 10:23:51 +03:00
Ivan Molodetskikh 7cc10ce1b5 Fix scrolling not working with missing mouse config 2024-11-13 10:23:44 +03:00
6 changed files with 64 additions and 21 deletions
Generated
+4 -4
View File
@@ -2390,7 +2390,7 @@ dependencies = [
[[package]] [[package]]
name = "niri" name = "niri"
version = "0.1.10" version = "0.1.10-1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"approx 0.5.1", "approx 0.5.1",
@@ -2444,7 +2444,7 @@ dependencies = [
[[package]] [[package]]
name = "niri-config" name = "niri-config"
version = "0.1.10" version = "0.1.10-1"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"csscolorparser", "csscolorparser",
@@ -2461,7 +2461,7 @@ dependencies = [
[[package]] [[package]]
name = "niri-ipc" name = "niri-ipc"
version = "0.1.10" version = "0.1.10-1"
dependencies = [ dependencies = [
"clap", "clap",
"schemars", "schemars",
@@ -2471,7 +2471,7 @@ dependencies = [
[[package]] [[package]]
name = "niri-visual-tests" name = "niri-visual-tests"
version = "0.1.10" version = "0.1.10-1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"gtk4", "gtk4",
+4 -4
View File
@@ -2,7 +2,7 @@
members = ["niri-visual-tests"] members = ["niri-visual-tests"]
[workspace.package] [workspace.package]
version = "0.1.10" version = "0.1.10-1"
description = "A scrollable-tiling Wayland compositor" description = "A scrollable-tiling Wayland compositor"
authors = ["Ivan Molodetskikh <yalterz@gmail.com>"] authors = ["Ivan Molodetskikh <yalterz@gmail.com>"]
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
@@ -64,8 +64,8 @@ keyframe = { version = "1.1.1", default-features = false }
libc = "0.2.162" libc = "0.2.162"
libdisplay-info = "0.1.0" libdisplay-info = "0.1.0"
log = { version = "0.4.22", features = ["max_level_trace", "release_max_level_debug"] } log = { version = "0.4.22", features = ["max_level_trace", "release_max_level_debug"] }
niri-config = { version = "0.1.10", path = "niri-config" } niri-config = { version = "0.1.10-1", path = "niri-config" }
niri-ipc = { version = "0.1.10", path = "niri-ipc", features = ["clap"] } niri-ipc = { version = "0.1.10-1", path = "niri-ipc", features = ["clap"] }
notify-rust = { version = "~4.10.0", optional = true } notify-rust = { version = "~4.10.0", optional = true }
ordered-float = "4.5.0" ordered-float = "4.5.0"
pango = { version = "0.20.4", features = ["v1_44"] } pango = { version = "0.20.4", features = ["v1_44"] }
@@ -139,7 +139,7 @@ lto = "thin"
debug = false debug = false
[package.metadata.generate-rpm] [package.metadata.generate-rpm]
version = "0.1.10" version = "0.1.10.1"
assets = [ assets = [
{ source = "target/release/niri", dest = "/usr/bin/", mode = "755" }, { source = "target/release/niri", dest = "/usr/bin/", mode = "755" },
{ source = "resources/niri-session", dest = "/usr/bin/", mode = "755" }, { source = "resources/niri-session", dest = "/usr/bin/", mode = "755" },
+1 -1
View File
@@ -12,7 +12,7 @@ bitflags.workspace = true
csscolorparser = "0.7.0" csscolorparser = "0.7.0"
knuffel = "3.2.0" knuffel = "3.2.0"
miette = "5.10.0" miette = "5.10.0"
niri-ipc = { version = "0.1.10", path = "../niri-ipc" } niri-ipc = { version = "0.1.10-1", path = "../niri-ipc" }
regex = "1.11.1" regex = "1.11.1"
smithay = { workspace = true, features = ["backend_libinput"] } smithay = { workspace = true, features = ["backend_libinput"] }
tracing.workspace = true tracing.workspace = true
+6 -6
View File
@@ -188,8 +188,8 @@ pub struct Touchpad {
pub disabled_on_external_mouse: bool, pub disabled_on_external_mouse: bool,
#[knuffel(child)] #[knuffel(child)]
pub middle_emulation: bool, pub middle_emulation: bool,
#[knuffel(child, unwrap(argument), default = FloatOrInt(1.0))] #[knuffel(child, unwrap(argument))]
pub scroll_factor: FloatOrInt<0, 100>, pub scroll_factor: Option<FloatOrInt<0, 100>>,
} }
#[derive(knuffel::Decode, Debug, Default, PartialEq)] #[derive(knuffel::Decode, Debug, Default, PartialEq)]
@@ -210,8 +210,8 @@ pub struct Mouse {
pub left_handed: bool, pub left_handed: bool,
#[knuffel(child)] #[knuffel(child)]
pub middle_emulation: bool, pub middle_emulation: bool,
#[knuffel(child, unwrap(argument), default = FloatOrInt(1.0))] #[knuffel(child, unwrap(argument))]
pub scroll_factor: FloatOrInt<0, 100>, pub scroll_factor: Option<FloatOrInt<0, 100>>,
} }
#[derive(knuffel::Decode, Debug, Default, PartialEq)] #[derive(knuffel::Decode, Debug, Default, PartialEq)]
@@ -3183,7 +3183,7 @@ mod tests {
left_handed: false, left_handed: false,
disabled_on_external_mouse: true, disabled_on_external_mouse: true,
middle_emulation: false, middle_emulation: false,
scroll_factor: FloatOrInt(0.9), scroll_factor: Some(FloatOrInt(0.9)),
}, },
mouse: Mouse { mouse: Mouse {
off: false, off: false,
@@ -3194,7 +3194,7 @@ mod tests {
scroll_button: Some(273), scroll_button: Some(273),
left_handed: false, left_handed: false,
middle_emulation: true, middle_emulation: true,
scroll_factor: FloatOrInt(0.2), scroll_factor: Some(FloatOrInt(0.2)),
}, },
trackpoint: Trackpoint { trackpoint: Trackpoint {
off: true, off: true,
+2 -2
View File
@@ -11,8 +11,8 @@ repository.workspace = true
adw = { version = "0.7.1", package = "libadwaita", features = ["v1_4"] } adw = { version = "0.7.1", package = "libadwaita", features = ["v1_4"] }
anyhow.workspace = true anyhow.workspace = true
gtk = { version = "0.9.3", package = "gtk4", features = ["v4_12"] } gtk = { version = "0.9.3", package = "gtk4", features = ["v4_12"] }
niri = { version = "0.1.10", path = ".." } niri = { version = "0.1.10-1", path = ".." }
niri-config = { version = "0.1.10", path = "../niri-config" } niri-config = { version = "0.1.10-1", path = "../niri-config" }
smithay.workspace = true smithay.workspace = true
tracing.workspace = true tracing.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true
+47 -4
View File
@@ -31,6 +31,7 @@ use smithay::input::SeatHandler;
use smithay::utils::{Logical, Point, Rectangle, Transform, SERIAL_COUNTER}; use smithay::utils::{Logical, Point, Rectangle, Transform, SERIAL_COUNTER};
use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint}; use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait}; use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
use touch_move_grab::TouchMoveGrab;
use self::move_grab::MoveGrab; use self::move_grab::MoveGrab;
use self::resize_grab::ResizeGrab; use self::resize_grab::ResizeGrab;
@@ -540,6 +541,10 @@ impl State {
} }
} }
Action::ConfirmScreenshot => { Action::ConfirmScreenshot => {
if !self.niri.screenshot_ui.is_open() {
return;
}
self.backend.with_primary_renderer(|renderer| { self.backend.with_primary_renderer(|renderer| {
match self.niri.screenshot_ui.capture(renderer) { match self.niri.screenshot_ui.capture(renderer) {
Ok((size, pixels)) => { Ok((size, pixels)) => {
@@ -560,6 +565,10 @@ impl State {
self.niri.queue_redraw_all(); self.niri.queue_redraw_all();
} }
Action::CancelScreenshot => { Action::CancelScreenshot => {
if !self.niri.screenshot_ui.is_open() {
return;
}
self.niri.screenshot_ui.close(); self.niri.screenshot_ui.close();
self.niri self.niri
.cursor_manager .cursor_manager
@@ -1743,6 +1752,12 @@ impl State {
fn on_pointer_axis<I: InputBackend>(&mut self, event: I::PointerAxisEvent) { fn on_pointer_axis<I: InputBackend>(&mut self, event: I::PointerAxisEvent) {
let source = event.source(); let source = event.source();
// We received an event for the regular pointer, so show it now. This is also needed for
// update_pointer_contents() below to return the real contents, necessary for the pointer
// axis event to reach the window.
self.niri.pointer_hidden = false;
self.niri.tablet_cursor_location = None;
let horizontal_amount_v120 = event.amount_v120(Axis::Horizontal); let horizontal_amount_v120 = event.amount_v120(Axis::Horizontal);
let vertical_amount_v120 = event.amount_v120(Axis::Vertical); let vertical_amount_v120 = event.amount_v120(Axis::Vertical);
@@ -1882,10 +1897,11 @@ impl State {
} }
let scroll_factor = match source { let scroll_factor = match source {
AxisSource::Wheel => self.niri.config.borrow().input.mouse.scroll_factor.0, AxisSource::Wheel => self.niri.config.borrow().input.mouse.scroll_factor,
AxisSource::Finger => self.niri.config.borrow().input.touchpad.scroll_factor.0, AxisSource::Finger => self.niri.config.borrow().input.touchpad.scroll_factor,
_ => 1.0, _ => None,
}; };
let scroll_factor = scroll_factor.map(|x| x.0).unwrap_or(1.);
let horizontal_amount = horizontal_amount.unwrap_or_else(|| { let horizontal_amount = horizontal_amount.unwrap_or_else(|| {
// Winit backend, discrete scrolling. // Winit backend, discrete scrolling.
@@ -2352,12 +2368,40 @@ impl State {
return; return;
}; };
let serial = SERIAL_COUNTER.next_serial();
let under = self.niri.contents_under(touch_location); let under = self.niri.contents_under(touch_location);
if !handle.is_grabbed() { if !handle.is_grabbed() {
if let Some(window) = under.window { if let Some(window) = under.window {
self.niri.layout.activate_window(&window); self.niri.layout.activate_window(&window);
// Check if we need to start an interactive move.
let mods = self.niri.seat.get_keyboard().unwrap().modifier_state();
let mod_down = match self.backend.mod_key() {
CompositorMod::Super => mods.logo,
CompositorMod::Alt => mods.alt,
};
if mod_down {
let (output, pos_within_output) =
self.niri.output_under(touch_location).unwrap();
let output = output.clone();
if self.niri.layout.interactive_move_begin(
window.clone(),
&output,
pos_within_output,
) {
let start_data = TouchGrabStartData {
focus: None,
slot: evt.slot(),
location: touch_location,
};
let grab = TouchMoveGrab::new(start_data, window.clone());
handle.set_grab(self, grab, serial);
}
}
// FIXME: granular. // FIXME: granular.
self.niri.queue_redraw_all(); self.niri.queue_redraw_all();
} else if let Some(output) = under.output { } else if let Some(output) = under.output {
@@ -2369,7 +2413,6 @@ impl State {
self.niri.focus_layer_surface_if_on_demand(under.layer); self.niri.focus_layer_surface_if_on_demand(under.layer);
}; };
let serial = SERIAL_COUNTER.next_serial();
handle.down( handle.down(
self, self,
under.surface, under.surface,