Merge branch '1171' into '1.17'
Release 1.17.1 See merge request World/Phosh/squeekboard!542
This commit is contained in:
@ -74,6 +74,7 @@ build_deb:arm64:
|
|||||||
|
|
||||||
build_deb:future:
|
build_deb:future:
|
||||||
image: debian:sid
|
image: debian:sid
|
||||||
|
allow_failure: true
|
||||||
tags:
|
tags:
|
||||||
- aarch64
|
- aarch64
|
||||||
stage: build
|
stage: build
|
||||||
|
|||||||
@ -29,4 +29,4 @@ features = ["v3_22"]
|
|||||||
|
|
||||||
[dependencies.gtk-sys]
|
[dependencies.gtk-sys]
|
||||||
version = "0.9"
|
version = "0.9"
|
||||||
features = ["v3_22"]
|
features = ["v3_22"]
|
||||||
4
Cargo.deps.online
Normal file
4
Cargo.deps.online
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Dependencies which are only used with online, crates.io builds.
|
||||||
|
[patch.crates-io]
|
||||||
|
# Dependency was yanked, but gio 0.7 needs it.
|
||||||
|
fragile = { git = "https://source.puri.sm/dorota.czaplejewicz/fragile.git", tag = "0.3.0" }
|
||||||
1
debian/cargo/config
vendored
1
debian/cargo/config
vendored
@ -9,4 +9,3 @@ replace-with = 'vendored-sources'
|
|||||||
|
|
||||||
[source.vendored-sources]
|
[source.vendored-sources]
|
||||||
directory = '/usr/share/cargo/registry'
|
directory = '/usr/share/cargo/registry'
|
||||||
|
|
||||||
|
|||||||
15
debian/changelog
vendored
15
debian/changelog
vendored
@ -1,3 +1,18 @@
|
|||||||
|
squeekboard (1.17.1-1) experimental; urgency=medium
|
||||||
|
|
||||||
|
[ Dorota Czaplejewicz ]
|
||||||
|
* build: Replace missing crates.io dependency with Purism-hosted one
|
||||||
|
* ci: Allow failure on sid
|
||||||
|
* panel: Use scaling to set height
|
||||||
|
|
||||||
|
[ William Wold ]
|
||||||
|
* Do not reset pending state on zwp_input_method_v2.done
|
||||||
|
|
||||||
|
[ Arnaud Ferraris ]
|
||||||
|
* state: fix "wide mode" detection in portrait orientation
|
||||||
|
|
||||||
|
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 05 Apr 2022 13:32:53 +0000
|
||||||
|
|
||||||
squeekboard (1.17.0-1) experimental; urgency=medium
|
squeekboard (1.17.0-1) experimental; urgency=medium
|
||||||
|
|
||||||
[ Dorota Czaplejewicz ]
|
[ Dorota Czaplejewicz ]
|
||||||
|
|||||||
2
debian/rules
vendored
2
debian/rules
vendored
@ -38,6 +38,6 @@ endif
|
|||||||
# causing Cargo to refuse to build with a crates.io copy
|
# causing Cargo to refuse to build with a crates.io copy
|
||||||
override_dh_auto_configure:
|
override_dh_auto_configure:
|
||||||
[ ! -f Cargo.lock ] || rm Cargo.lock
|
[ ! -f Cargo.lock ] || rm Cargo.lock
|
||||||
dh_auto_configure -- -Dnewer=$(newer)
|
dh_auto_configure -- -Dnewer=$(newer) -Donline=false
|
||||||
|
|
||||||
override_dh_autoreconf:
|
override_dh_autoreconf:
|
||||||
|
|||||||
14
meson.build
14
meson.build
@ -1,7 +1,7 @@
|
|||||||
project(
|
project(
|
||||||
'squeekboard',
|
'squeekboard',
|
||||||
'c', 'rust',
|
'c', 'rust',
|
||||||
version: '1.17.0',
|
version: '1.17.1',
|
||||||
license: 'GPLv3',
|
license: 'GPLv3',
|
||||||
meson_version: '>=0.51.0',
|
meson_version: '>=0.51.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
@ -96,19 +96,23 @@ cargo_toml_base = configure_file(
|
|||||||
configuration: path_data,
|
configuration: path_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cargo_patch = []
|
||||||
cargo_deps = files('Cargo.deps')
|
|
||||||
|
|
||||||
if get_option('newer') == true
|
if get_option('newer') == true
|
||||||
cargo_build_flags += ['--features', 'glib_v0_14']
|
cargo_build_flags += ['--features', 'glib_v0_14']
|
||||||
cargo_deps = files('Cargo.deps.newer')
|
cargo_deps = files('Cargo.deps.newer')
|
||||||
|
else
|
||||||
|
cargo_deps = files('Cargo.deps')
|
||||||
|
if get_option('online') == true
|
||||||
|
cargo_patch = [files('Cargo.deps.online')]
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cat = find_program('cat')
|
cat = find_program('cat')
|
||||||
cargo_toml = custom_target(
|
cargo_toml = custom_target(
|
||||||
'Cargo.toml',
|
'Cargo.toml',
|
||||||
output: 'Cargo.toml',
|
output: 'Cargo.toml',
|
||||||
command: [cat, cargo_toml_base, cargo_deps],
|
command: [cat, cargo_toml_base, cargo_deps] + cargo_patch,
|
||||||
capture: true,
|
capture: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,10 @@ option('newer',
|
|||||||
type: 'boolean', value: false,
|
type: 'boolean', value: false,
|
||||||
description: 'Build with dependencies newer than those of Byzantium')
|
description: 'Build with dependencies newer than those of Byzantium')
|
||||||
|
|
||||||
|
option('online',
|
||||||
|
type: 'boolean', value: true,
|
||||||
|
description: 'Pull packages from the internet while building, as opposed to a local regstry.')
|
||||||
|
|
||||||
option('strict',
|
option('strict',
|
||||||
type: 'boolean', value: true,
|
type: 'boolean', value: true,
|
||||||
description: 'Turn more warnings into errors')
|
description: 'Turn more warnings into errors')
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use crate::main::PixelSize;
|
||||||
use crate::outputs::OutputId;
|
use crate::outputs::OutputId;
|
||||||
|
|
||||||
/// The keyboard should hide after this has elapsed to prevent flickering.
|
/// The keyboard should hide after this has elapsed to prevent flickering.
|
||||||
@ -16,7 +17,7 @@ pub const HIDING_TIMEOUT: Duration = Duration::from_millis(200);
|
|||||||
pub enum Outcome {
|
pub enum Outcome {
|
||||||
Visible {
|
Visible {
|
||||||
output: OutputId,
|
output: OutputId,
|
||||||
height: u32,
|
height: PixelSize,
|
||||||
},
|
},
|
||||||
Hidden,
|
Hidden,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,11 +154,6 @@ pub mod c {
|
|||||||
let imservice = check_imservice(imservice, im).unwrap();
|
let imservice = check_imservice(imservice, im).unwrap();
|
||||||
|
|
||||||
imservice.current = imservice.pending.clone();
|
imservice.current = imservice.pending.clone();
|
||||||
imservice.pending = IMProtocolState {
|
|
||||||
active: imservice.current.active,
|
|
||||||
..IMProtocolState::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
imservice.serial += Wrapping(1u32);
|
imservice.serial += Wrapping(1u32);
|
||||||
imservice.send_event();
|
imservice.send_event();
|
||||||
}
|
}
|
||||||
|
|||||||
28
src/main.rs
28
src/main.rs
@ -75,7 +75,7 @@ mod c {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#[allow(improper_ctypes)]
|
#[allow(improper_ctypes)]
|
||||||
fn init_wayland(wayland: *mut Wayland);
|
fn init_wayland(wayland: *mut Wayland);
|
||||||
fn server_context_service_update_keyboard(service: *const UIManager, output: WlOutput, height: u32);
|
fn server_context_service_update_keyboard(service: *const UIManager, output: WlOutput, scaled_height: u32);
|
||||||
fn server_context_service_real_hide_keyboard(service: *const UIManager);
|
fn server_context_service_real_hide_keyboard(service: *const UIManager);
|
||||||
fn server_context_service_set_hint_purpose(service: *const UIManager, hint: u32, purpose: u32);
|
fn server_context_service_set_hint_purpose(service: *const UIManager, hint: u32, purpose: u32);
|
||||||
// This should probably only get called from the gtk main loop,
|
// This should probably only get called from the gtk main loop,
|
||||||
@ -151,7 +151,7 @@ mod c {
|
|||||||
) {
|
) {
|
||||||
match msg.panel_visibility {
|
match msg.panel_visibility {
|
||||||
Some(PanelCommand::Show { output, height }) => unsafe {
|
Some(PanelCommand::Show { output, height }) => unsafe {
|
||||||
server_context_service_update_keyboard(ui_manager, output.0, height);
|
server_context_service_update_keyboard(ui_manager, output.0, height.as_scaled_ceiling());
|
||||||
},
|
},
|
||||||
Some(PanelCommand::Hide) => unsafe {
|
Some(PanelCommand::Hide) => unsafe {
|
||||||
server_context_service_real_hide_keyboard(ui_manager);
|
server_context_service_real_hide_keyboard(ui_manager);
|
||||||
@ -177,11 +177,33 @@ mod c {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Size in pixels that is aware of scaling
|
||||||
|
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||||
|
pub struct PixelSize {
|
||||||
|
pub pixels: u32,
|
||||||
|
pub scale_factor: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn div_ceil(a: u32, b: u32) -> u32 {
|
||||||
|
// Given that it's for pixels on a screen, an overflow is unlikely.
|
||||||
|
(a + b - 1) / b
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PixelSize {
|
||||||
|
pub fn as_scaled_floor(&self) -> u32 {
|
||||||
|
self.pixels / self.scale_factor
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn as_scaled_ceiling(&self) -> u32 {
|
||||||
|
div_ceil(self.pixels, self.scale_factor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub enum PanelCommand {
|
pub enum PanelCommand {
|
||||||
Show {
|
Show {
|
||||||
output: OutputId,
|
output: OutputId,
|
||||||
height: u32,
|
height: PixelSize,
|
||||||
},
|
},
|
||||||
Hide,
|
Hide,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,9 +139,10 @@ server_context_service_real_hide_keyboard (ServerContextService *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called from rust
|
// Called from rust
|
||||||
/// Updates the type of visibility
|
/// Updates the type of visibility.
|
||||||
|
/// Height is in scaled units.
|
||||||
void
|
void
|
||||||
server_context_service_update_keyboard (ServerContextService *self, struct wl_output *output, uint32_t height)
|
server_context_service_update_keyboard (ServerContextService *self, struct wl_output *output, uint32_t scaled_height)
|
||||||
{
|
{
|
||||||
if (output != self->current_output) {
|
if (output != self->current_output) {
|
||||||
// Recreate on a new output
|
// Recreate on a new output
|
||||||
@ -153,11 +154,11 @@ server_context_service_update_keyboard (ServerContextService *self, struct wl_ou
|
|||||||
"configured-height", &h,
|
"configured-height", &h,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if ((uint32_t)h != height) {
|
if ((uint32_t)h != scaled_height) {
|
||||||
|
|
||||||
//TODO: make sure that redrawing happens in the correct place (it doesn't now).
|
//TODO: make sure that redrawing happens in the correct place (it doesn't now).
|
||||||
phosh_layer_surface_set_size(self->window, 0, height);
|
phosh_layer_surface_set_size(self->window, 0, scaled_height);
|
||||||
phosh_layer_surface_set_exclusive_zone(self->window, height);
|
phosh_layer_surface_set_exclusive_zone(self->window, scaled_height);
|
||||||
phosh_layer_surface_wl_surface_commit(self->window);
|
phosh_layer_surface_wl_surface_commit(self->window);
|
||||||
|
|
||||||
self->current_output = output;
|
self->current_output = output;
|
||||||
@ -169,7 +170,7 @@ server_context_service_update_keyboard (ServerContextService *self, struct wl_ou
|
|||||||
self->current_output = output;
|
self->current_output = output;
|
||||||
|
|
||||||
if (!self->window) {
|
if (!self->window) {
|
||||||
make_window (self, output, height);
|
make_window (self, output, scaled_height);
|
||||||
}
|
}
|
||||||
if (!self->widget) {
|
if (!self->widget) {
|
||||||
make_widget (self);
|
make_widget (self);
|
||||||
|
|||||||
21
src/state.rs
21
src/state.rs
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
use crate::animation;
|
use crate::animation;
|
||||||
use crate::imservice::{ ContentHint, ContentPurpose };
|
use crate::imservice::{ ContentHint, ContentPurpose };
|
||||||
use crate::main::{ Commands, PanelCommand };
|
use crate::main::{ Commands, PanelCommand, PixelSize };
|
||||||
use crate::outputs;
|
use crate::outputs;
|
||||||
use crate::outputs::{OutputId, OutputState};
|
use crate::outputs::{OutputId, OutputState};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
@ -238,14 +238,20 @@ impl Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_preferred_height(output: &OutputState) -> Option<u32> {
|
fn get_preferred_height(output: &OutputState) -> Option<PixelSize> {
|
||||||
output.get_pixel_size()
|
output.get_pixel_size()
|
||||||
.map(|px_size| {
|
.map(|px_size| {
|
||||||
let height = {
|
let height = {
|
||||||
if px_size.width > px_size.height {
|
if px_size.width > px_size.height {
|
||||||
px_size.width / 5
|
px_size.width / 5
|
||||||
} else {
|
} else {
|
||||||
if (px_size.width < 540) & (px_size.width > 0) {
|
let abstract_width
|
||||||
|
= PixelSize {
|
||||||
|
scale_factor: output.scale as u32,
|
||||||
|
pixels: px_size.width,
|
||||||
|
}
|
||||||
|
.as_scaled_ceiling();
|
||||||
|
if (abstract_width < 540) && (px_size.width > 0) {
|
||||||
px_size.width * 7 / 12 // to match 360×210
|
px_size.width * 7 / 12 // to match 360×210
|
||||||
} else {
|
} else {
|
||||||
// Here we switch to wide layout, less height needed
|
// Here we switch to wide layout, less height needed
|
||||||
@ -253,7 +259,10 @@ impl Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cmp::min(height, px_size.height / 2)
|
PixelSize {
|
||||||
|
scale_factor: output.scale as u32,
|
||||||
|
pixels: cmp::min(height, px_size.height / 2),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,10 +274,10 @@ impl Application {
|
|||||||
Some(output) => {
|
Some(output) => {
|
||||||
// Hoping that this will get optimized out on branches not using `visible`.
|
// Hoping that this will get optimized out on branches not using `visible`.
|
||||||
let height = Self::get_preferred_height(self.outputs.get(&output).unwrap())
|
let height = Self::get_preferred_height(self.outputs.get(&output).unwrap())
|
||||||
.unwrap_or(0);
|
.unwrap_or(PixelSize{pixels: 0, scale_factor: 1});
|
||||||
// TODO: Instead of setting size to 0 when the output is invalid,
|
// TODO: Instead of setting size to 0 when the output is invalid,
|
||||||
// simply go invisible.
|
// simply go invisible.
|
||||||
let visible = animation::Outcome::Visible{output, height};
|
let visible = animation::Outcome::Visible{ output, height };
|
||||||
|
|
||||||
match (self.physical_keyboard, self.visibility_override) {
|
match (self.physical_keyboard, self.visibility_override) {
|
||||||
(_, visibility::State::ForcedHidden) => animation::Outcome::Hidden,
|
(_, visibility::State::ForcedHidden) => animation::Outcome::Hidden,
|
||||||
|
|||||||
Reference in New Issue
Block a user