cargo: Update gtk-rs stack
This commit is contained in:
parent
a7116925bf
commit
0ed7036098
11 changed files with 230 additions and 199 deletions
|
|
@ -27,7 +27,7 @@ use crate::deps::*;
|
|||
mod imp {
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::{ParamSpec, Properties, Value};
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::cell::OnceCell;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ mod imp {
|
|||
);
|
||||
|
||||
obj.connect_realize(glib::clone!(@weak surface_signals => move |obj| {
|
||||
surface_signals.set_target(obj.native().map(|x| x.surface()).as_ref());
|
||||
surface_signals.set_target(obj.native().and_then(|x| x.surface()).as_ref());
|
||||
}));
|
||||
|
||||
obj.connect_unrealize(glib::clone!(@weak surface_signals => move |_| {
|
||||
|
|
|
|||
|
|
@ -85,10 +85,7 @@ impl imp::LpImage {
|
|||
|
||||
let node = snapshot.to_node()?;
|
||||
|
||||
let renderer = obj.root()?.renderer();
|
||||
if !renderer.is_realized() {
|
||||
return None;
|
||||
}
|
||||
let renderer = obj.root()?.renderer()?;
|
||||
|
||||
// Render the small version of the image and download to RAM
|
||||
let texture = renderer.render_texture(node, None);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ impl imp::LpImage {
|
|||
(f64::exp(-y * f64::ln(ZOOM_FACTOR_SCROLL_SURFACE)), false)
|
||||
}
|
||||
unknown_unit => {
|
||||
log::warn!("Ignoring unknown scroll unit: {unknown_unit}");
|
||||
log::warn!("Ignoring unknown scroll unit: {unknown_unit:?}");
|
||||
(1., false)
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ impl LpImage {
|
|||
.add_to_snapshot(&snapshot, scale, &render_options);
|
||||
|
||||
let node = snapshot.to_node()?;
|
||||
let renderer = self.root()?.renderer();
|
||||
let renderer = self.root()?.renderer()?;
|
||||
|
||||
Some(renderer.render_texture(&node, None))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,13 +299,10 @@ impl imp::LpImage {
|
|||
let obj = self.obj();
|
||||
|
||||
// TODO: This avoids panics and should be fixed upstream
|
||||
if obj.is_realized() {
|
||||
obj.native()
|
||||
.map(|x| x.surface().scale())
|
||||
.unwrap_or_else(|| obj.scale_factor() as f64)
|
||||
} else {
|
||||
1.
|
||||
}
|
||||
obj.native()
|
||||
.and_then(|x| x.surface())
|
||||
.map(|x| x.scale())
|
||||
.unwrap_or_else(|| obj.scale_factor() as f64)
|
||||
}
|
||||
|
||||
/// Monitor size in physical pixels
|
||||
|
|
@ -313,8 +310,8 @@ impl imp::LpImage {
|
|||
let obj = self.obj();
|
||||
|
||||
if let Some(display) = gdk::Display::default() {
|
||||
if let Some(native) = obj.native() {
|
||||
if let Some(monitor) = display.monitor_at_surface(&native.surface()) {
|
||||
if let Some(surface) = obj.native().and_then(|x| x.surface()) {
|
||||
if let Some(monitor) = display.monitor_at_surface(&surface) {
|
||||
let hidpi_scale = self.scaling();
|
||||
let monitor_geometry = monitor.geometry();
|
||||
let monitor_size = (
|
||||
|
|
|
|||
|
|
@ -140,4 +140,12 @@ impl LpImage {
|
|||
pub fn is_vscrollable(&self) -> bool {
|
||||
self.imp().max_vadjustment_value() != 0.
|
||||
}
|
||||
|
||||
pub fn hadjustment(&self) -> gtk::Adjustment {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn vadjustment(&self) -> gtk::Adjustment {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,14 +18,13 @@
|
|||
|
||||
//! The print layout widget that also coordinates the print process
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cell::{Cell, OnceCell, RefCell};
|
||||
use std::rc::Rc;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::Properties;
|
||||
use gtk::CompositeTemplate;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use crate::decoder::{self};
|
||||
use crate::deps::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue