chore: update gtk and related dependencies to 0.18
co-authored-by: Johan Geluk <johan@geluk.io>
This commit is contained in:
parent
0808e78db2
commit
3b6f868ea6
15 changed files with 454 additions and 369 deletions
684
Cargo.lock
generated
684
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -21,20 +21,11 @@ eww_shared_util.workspace = true
|
||||||
yuck.workspace = true
|
yuck.workspace = true
|
||||||
notifier_host.workspace = true
|
notifier_host.workspace = true
|
||||||
|
|
||||||
gtk = "0.17.1"
|
gtk = "0.18.1"
|
||||||
gdk = "0.17.1"
|
|
||||||
pango = "0.17.1"
|
|
||||||
glib = "0.17.8"
|
|
||||||
glib-macros = "0.17.8"
|
|
||||||
|
|
||||||
cairo-rs = "0.17"
|
gtk-layer-shell = { version = "0.8.1", optional = true }
|
||||||
cairo-sys-rs = "0.17"
|
gdkx11 = { version = "0.18", optional = true }
|
||||||
|
x11rb = { version = "0.13.1", features = ["randr"], optional = true }
|
||||||
gdk-pixbuf = "0.17"
|
|
||||||
|
|
||||||
gtk-layer-shell = { version = "0.6.1", optional = true }
|
|
||||||
gdkx11 = { version = "0.17", optional = true }
|
|
||||||
x11rb = { version = "0.11.1", features = ["randr"], optional = true }
|
|
||||||
|
|
||||||
zbus = { version = "3.7.0", default-features = false, features = ["tokio"] }
|
zbus = { version = "3.7.0", default-features = false, features = ["tokio"] }
|
||||||
ordered-stream = "0.2.0"
|
ordered-stream = "0.2.0"
|
||||||
|
|
|
@ -17,6 +17,7 @@ use codespan_reporting::files::Files;
|
||||||
use eww_shared_util::{Span, VarName};
|
use eww_shared_util::{Span, VarName};
|
||||||
use gdk::Monitor;
|
use gdk::Monitor;
|
||||||
use glib::ObjectExt;
|
use glib::ObjectExt;
|
||||||
|
use gtk::{gdk, glib};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use simplexpr::{dynval::DynVal, SimplExpr};
|
use simplexpr::{dynval::DynVal, SimplExpr};
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use crate::{widgets::window::Window, window_initiator::WindowInitiator};
|
use crate::{widgets::window::Window, window_initiator::WindowInitiator};
|
||||||
|
|
||||||
|
use gtk::gdk;
|
||||||
|
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
pub use platform_wayland::WaylandBackend;
|
pub use platform_wayland::WaylandBackend;
|
||||||
|
|
||||||
|
@ -27,7 +29,9 @@ impl DisplayBackend for NoBackend {
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
mod platform_wayland {
|
mod platform_wayland {
|
||||||
use crate::{widgets::window::Window, window_initiator::WindowInitiator};
|
use crate::{widgets::window::Window, window_initiator::WindowInitiator};
|
||||||
|
use gtk::gdk;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
use gtk_layer_shell::LayerShell;
|
||||||
use yuck::config::{window_definition::WindowStacking, window_geometry::AnchorAlignment};
|
use yuck::config::{window_definition::WindowStacking, window_geometry::AnchorAlignment};
|
||||||
|
|
||||||
use super::DisplayBackend;
|
use super::DisplayBackend;
|
||||||
|
@ -41,12 +45,12 @@ mod platform_wayland {
|
||||||
fn initialize_window(window_init: &WindowInitiator, monitor: gdk::Rectangle, x: i32, y: i32) -> Option<Window> {
|
fn initialize_window(window_init: &WindowInitiator, monitor: gdk::Rectangle, x: i32, y: i32) -> Option<Window> {
|
||||||
let window = Window::new(gtk::WindowType::Toplevel, x, y);
|
let window = Window::new(gtk::WindowType::Toplevel, x, y);
|
||||||
// Initialising a layer shell surface
|
// Initialising a layer shell surface
|
||||||
gtk_layer_shell::init_for_window(&window);
|
window.init_layer_shell();
|
||||||
// Sets the monitor where the surface is shown
|
// Sets the monitor where the surface is shown
|
||||||
if let Some(ident) = window_init.monitor.clone() {
|
if let Some(ident) = window_init.monitor.clone() {
|
||||||
let display = gdk::Display::default().expect("could not get default display");
|
let display = gdk::Display::default().expect("could not get default display");
|
||||||
if let Some(monitor) = crate::app::get_monitor_from_display(&display, &ident) {
|
if let Some(monitor) = crate::app::get_monitor_from_display(&display, &ident) {
|
||||||
gtk_layer_shell::set_monitor(&window, &monitor);
|
window.set_monitor(&monitor);
|
||||||
} else {
|
} else {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -55,18 +59,18 @@ mod platform_wayland {
|
||||||
|
|
||||||
// Sets the layer where the layer shell surface will spawn
|
// Sets the layer where the layer shell surface will spawn
|
||||||
match window_init.stacking {
|
match window_init.stacking {
|
||||||
WindowStacking::Foreground => gtk_layer_shell::set_layer(&window, gtk_layer_shell::Layer::Top),
|
WindowStacking::Foreground => window.set_layer(gtk_layer_shell::Layer::Top),
|
||||||
WindowStacking::Background => gtk_layer_shell::set_layer(&window, gtk_layer_shell::Layer::Background),
|
WindowStacking::Background => window.set_layer(gtk_layer_shell::Layer::Background),
|
||||||
WindowStacking::Bottom => gtk_layer_shell::set_layer(&window, gtk_layer_shell::Layer::Bottom),
|
WindowStacking::Bottom => window.set_layer(gtk_layer_shell::Layer::Bottom),
|
||||||
WindowStacking::Overlay => gtk_layer_shell::set_layer(&window, gtk_layer_shell::Layer::Overlay),
|
WindowStacking::Overlay => window.set_layer(gtk_layer_shell::Layer::Overlay),
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(namespace) = &window_init.backend_options.wayland.namespace {
|
if let Some(namespace) = &window_init.backend_options.wayland.namespace {
|
||||||
gtk_layer_shell::set_namespace(&window, namespace);
|
window.set_namespace(namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the keyboard interactivity
|
// Sets the keyboard interactivity
|
||||||
gtk_layer_shell::set_keyboard_interactivity(&window, window_init.backend_options.wayland.focusable);
|
window.set_keyboard_interactivity(window_init.backend_options.wayland.focusable);
|
||||||
|
|
||||||
if let Some(geometry) = window_init.geometry {
|
if let Some(geometry) = window_init.geometry {
|
||||||
// Positioning surface
|
// Positioning surface
|
||||||
|
@ -86,27 +90,27 @@ mod platform_wayland {
|
||||||
AnchorAlignment::END => bottom = true,
|
AnchorAlignment::END => bottom = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Left, left);
|
window.set_anchor(gtk_layer_shell::Edge::Left, left);
|
||||||
gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Right, right);
|
window.set_anchor(gtk_layer_shell::Edge::Right, right);
|
||||||
gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Top, top);
|
window.set_anchor(gtk_layer_shell::Edge::Top, top);
|
||||||
gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Bottom, bottom);
|
window.set_anchor(gtk_layer_shell::Edge::Bottom, bottom);
|
||||||
|
|
||||||
let xoffset = geometry.offset.x.pixels_relative_to(monitor.width());
|
let xoffset = geometry.offset.x.pixels_relative_to(monitor.width());
|
||||||
let yoffset = geometry.offset.y.pixels_relative_to(monitor.height());
|
let yoffset = geometry.offset.y.pixels_relative_to(monitor.height());
|
||||||
|
|
||||||
if left {
|
if left {
|
||||||
gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Left, xoffset);
|
window.set_layer_shell_margin(gtk_layer_shell::Edge::Left, xoffset);
|
||||||
} else {
|
} else {
|
||||||
gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Right, xoffset);
|
window.set_layer_shell_margin(gtk_layer_shell::Edge::Right, xoffset);
|
||||||
}
|
}
|
||||||
if bottom {
|
if bottom {
|
||||||
gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Bottom, yoffset);
|
window.set_layer_shell_margin(gtk_layer_shell::Edge::Bottom, yoffset);
|
||||||
} else {
|
} else {
|
||||||
gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Top, yoffset);
|
window.set_layer_shell_margin(gtk_layer_shell::Edge::Top, yoffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if window_init.backend_options.wayland.exclusive {
|
if window_init.backend_options.wayland.exclusive {
|
||||||
gtk_layer_shell::auto_exclusive_zone_enable(&window);
|
window.auto_exclusive_zone_enable();
|
||||||
}
|
}
|
||||||
Some(window)
|
Some(window)
|
||||||
}
|
}
|
||||||
|
@ -118,6 +122,7 @@ mod platform_x11 {
|
||||||
use crate::{widgets::window::Window, window_initiator::WindowInitiator};
|
use crate::{widgets::window::Window, window_initiator::WindowInitiator};
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use gdk::Monitor;
|
use gdk::Monitor;
|
||||||
|
use gtk::gdk;
|
||||||
use gtk::{self, prelude::*};
|
use gtk::{self, prelude::*};
|
||||||
use x11rb::protocol::xproto::ConnectionExt;
|
use x11rb::protocol::xproto::ConnectionExt;
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ pub fn initialize_server<B: DisplayBackend>(
|
||||||
paths,
|
paths,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(screen) = gdk::Screen::default() {
|
if let Some(screen) = gtk::gdk::Screen::default() {
|
||||||
gtk::StyleContext::add_provider_for_screen(&screen, &app.css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
|
gtk::StyleContext::add_provider_for_screen(&screen, &app.css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ pub fn initialize_server<B: DisplayBackend>(
|
||||||
// initialize all the handlers and tasks running asyncronously
|
// initialize all the handlers and tasks running asyncronously
|
||||||
let tokio_handle = init_async_part(app.paths.clone(), ui_send);
|
let tokio_handle = init_async_part(app.paths.clone(), ui_send);
|
||||||
|
|
||||||
glib::MainContext::default().spawn_local(async move {
|
gtk::glib::MainContext::default().spawn_local(async move {
|
||||||
// if an action was given to the daemon initially, execute it first.
|
// if an action was given to the daemon initially, execute it first.
|
||||||
if let Some(action) = action {
|
if let Some(action) = action {
|
||||||
app.handle_command(action);
|
app.handle_command(action);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use codespan_reporting::diagnostic::Severity;
|
use codespan_reporting::diagnostic::Severity;
|
||||||
use eww_shared_util::{AttrName, Spanned};
|
use eww_shared_util::{AttrName, Spanned};
|
||||||
use gdk::prelude::Cast;
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
|
gdk::prelude::Cast,
|
||||||
prelude::{BoxExt, ContainerExt, WidgetExt},
|
prelude::{BoxExt, ContainerExt, WidgetExt},
|
||||||
Orientation,
|
Orientation,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use glib::{object_subclass, prelude::*, wrapper};
|
use gtk::glib::{self, object_subclass, prelude::*, wrapper, Properties};
|
||||||
use glib_macros::Properties;
|
use gtk::{cairo, gdk, prelude::*, subclass::prelude::*};
|
||||||
use gtk::{prelude::*, subclass::prelude::*};
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
use crate::error_handling_ctx;
|
use crate::error_handling_ctx;
|
||||||
|
@ -154,7 +153,7 @@ impl WidgetImpl for CircProgPriv {
|
||||||
self.preferred_height()
|
self.preferred_height()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(&self, cr: &cairo::Context) -> Inhibit {
|
fn draw(&self, cr: &cairo::Context) -> glib::Propagation {
|
||||||
let res: Result<()> = (|| {
|
let res: Result<()> = (|| {
|
||||||
let value = *self.value.borrow();
|
let value = *self.value.borrow();
|
||||||
let start_at = *self.start_at.borrow();
|
let start_at = *self.start_at.borrow();
|
||||||
|
@ -226,7 +225,7 @@ impl WidgetImpl for CircProgPriv {
|
||||||
error_handling_ctx::print_error(error)
|
error_handling_ctx::print_error(error)
|
||||||
};
|
};
|
||||||
|
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,8 @@ use std::{cell::RefCell, collections::VecDeque};
|
||||||
// https://www.figuiere.net/technotes/notes/tn002/
|
// https://www.figuiere.net/technotes/notes/tn002/
|
||||||
// https://github.com/gtk-rs/examples/blob/master/src/bin/listbox_model.rs
|
// https://github.com/gtk-rs/examples/blob/master/src/bin/listbox_model.rs
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use glib::{object_subclass, wrapper};
|
use gtk::glib::{self, object_subclass, wrapper, Properties};
|
||||||
use glib_macros::Properties;
|
use gtk::{cairo, gdk, prelude::*, subclass::prelude::*};
|
||||||
use gtk::{prelude::*, subclass::prelude::*};
|
|
||||||
|
|
||||||
use crate::error_handling_ctx;
|
use crate::error_handling_ctx;
|
||||||
|
|
||||||
|
@ -170,7 +169,7 @@ impl WidgetImpl for GraphPriv {
|
||||||
(width, width)
|
(width, width)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(&self, cr: &cairo::Context) -> Inhibit {
|
fn draw(&self, cr: &cairo::Context) -> glib::Propagation {
|
||||||
let res: Result<()> = (|| {
|
let res: Result<()> = (|| {
|
||||||
let history = &*self.history.borrow();
|
let history = &*self.history.borrow();
|
||||||
let extra_point = *self.extra_point.borrow();
|
let extra_point = *self.extra_point.borrow();
|
||||||
|
@ -276,7 +275,7 @@ impl WidgetImpl for GraphPriv {
|
||||||
error_handling_ctx::print_error(error)
|
error_handling_ctx::print_error(error)
|
||||||
};
|
};
|
||||||
|
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use crate::widgets::window::Window;
|
use crate::widgets::window::Window;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use gdk::NotifyType;
|
use gtk::{cairo::Surface, gdk, gdk::ffi::gdk_cairo_surface_create_from_pixbuf, gdk::NotifyType, glib, prelude::*};
|
||||||
use gtk::{cairo::Surface, gdk::ffi::gdk_cairo_surface_create_from_pixbuf, prelude::*};
|
|
||||||
use notifier_host;
|
|
||||||
use std::{cell::RefCell, future::Future, rc::Rc};
|
use std::{cell::RefCell, future::Future, rc::Rc};
|
||||||
|
|
||||||
// DBus state shared between systray instances, to avoid creating too many connections etc.
|
// DBus state shared between systray instances, to avoid creating too many connections etc.
|
||||||
|
@ -139,14 +137,14 @@ impl Item {
|
||||||
if evt.detail() != NotifyType::Inferior {
|
if evt.detail() != NotifyType::Inferior {
|
||||||
gtk_widget.clone().set_state_flags(gtk::StateFlags::PRELIGHT, false);
|
gtk_widget.clone().set_state_flags(gtk::StateFlags::PRELIGHT, false);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
gtk_widget.connect_leave_notify_event(|gtk_widget, evt| {
|
gtk_widget.connect_leave_notify_event(|gtk_widget, evt| {
|
||||||
if evt.detail() != NotifyType::Inferior {
|
if evt.detail() != NotifyType::Inferior {
|
||||||
gtk_widget.clone().unset_state_flags(gtk::StateFlags::PRELIGHT);
|
gtk_widget.clone().unset_state_flags(gtk::StateFlags::PRELIGHT);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
let out_widget = gtk_widget.clone(); // copy so we can return it
|
let out_widget = gtk_widget.clone(); // copy so we can return it
|
||||||
|
@ -231,7 +229,7 @@ impl Item {
|
||||||
if let Err(result) = result {
|
if let Err(result) = result {
|
||||||
log::error!("failed to handle mouse click {}: {}", evt.button(), result);
|
log::error!("failed to handle mouse click {}: {}", evt.button(), result);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(true)
|
glib::Propagation::Stop
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// updates
|
// updates
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use glib::{object_subclass, wrapper};
|
use gtk::glib::{self, object_subclass, wrapper, Properties};
|
||||||
use glib_macros::Properties;
|
|
||||||
use gtk::{prelude::*, subclass::prelude::*};
|
use gtk::{prelude::*, subclass::prelude::*};
|
||||||
use std::{cell::RefCell, str::FromStr};
|
use std::{cell::RefCell, str::FromStr};
|
||||||
use yuck::value::NumWithUnit;
|
use yuck::value::NumWithUnit;
|
||||||
|
@ -121,7 +120,7 @@ impl ContainerImpl for TransformPriv {
|
||||||
|
|
||||||
impl BinImpl for TransformPriv {}
|
impl BinImpl for TransformPriv {}
|
||||||
impl WidgetImpl for TransformPriv {
|
impl WidgetImpl for TransformPriv {
|
||||||
fn draw(&self, cr: &cairo::Context) -> Inhibit {
|
fn draw(&self, cr: >k::cairo::Context) -> glib::Propagation {
|
||||||
let res: Result<()> = (|| {
|
let res: Result<()> = (|| {
|
||||||
let rotate = *self.rotate.borrow();
|
let rotate = *self.rotate.borrow();
|
||||||
let total_width = self.obj().allocated_width() as f64;
|
let total_width = self.obj().allocated_width() as f64;
|
||||||
|
@ -166,7 +165,7 @@ impl WidgetImpl for TransformPriv {
|
||||||
error_handling_ctx::print_error(error)
|
error_handling_ctx::print_error(error)
|
||||||
};
|
};
|
||||||
|
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,11 @@ use crate::{
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use codespan_reporting::diagnostic::Severity;
|
use codespan_reporting::diagnostic::Severity;
|
||||||
use eww_shared_util::Spanned;
|
use eww_shared_util::Spanned;
|
||||||
use gdk::{ModifierType, NotifyType};
|
|
||||||
|
|
||||||
|
use gdk::{ModifierType, NotifyType};
|
||||||
use glib::translate::FromGlib;
|
use glib::translate::FromGlib;
|
||||||
use gtk::{self, glib, prelude::*, DestDefaults, TargetEntry, TargetList};
|
use gtk::{self, glib, prelude::*, DestDefaults, TargetEntry, TargetList};
|
||||||
|
use gtk::{gdk, pango};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
@ -232,11 +233,11 @@ pub(super) fn resolve_range_attrs(bargs: &mut BuilderArgs, gtk_widget: >k::Ran
|
||||||
let is_being_dragged = Rc::new(RefCell::new(false));
|
let is_being_dragged = Rc::new(RefCell::new(false));
|
||||||
gtk_widget.connect_button_press_event(glib::clone!(@strong is_being_dragged => move |_, _| {
|
gtk_widget.connect_button_press_event(glib::clone!(@strong is_being_dragged => move |_, _| {
|
||||||
*is_being_dragged.borrow_mut() = true;
|
*is_being_dragged.borrow_mut() = true;
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
gtk_widget.connect_button_release_event(glib::clone!(@strong is_being_dragged => move |_, _| {
|
gtk_widget.connect_button_release_event(glib::clone!(@strong is_being_dragged => move |_, _| {
|
||||||
*is_being_dragged.borrow_mut() = false;
|
*is_being_dragged.borrow_mut() = false;
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// We keep track of the last value that has been set via gtk_widget.set_value (by a change in the value property).
|
// We keep track of the last value that has been set via gtk_widget.set_value (by a change in the value property).
|
||||||
|
@ -507,7 +508,7 @@ fn build_gtk_button(bargs: &mut BuilderArgs) -> Result<gtk::Button> {
|
||||||
3 => run_command(timeout, &onrightclick, &[] as &[&str]),
|
3 => run_command(timeout, &onrightclick, &[] as &[&str]),
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,25 +730,25 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
|
||||||
if evt.detail() != NotifyType::Inferior {
|
if evt.detail() != NotifyType::Inferior {
|
||||||
gtk_widget.clone().set_state_flags(gtk::StateFlags::PRELIGHT, false);
|
gtk_widget.clone().set_state_flags(gtk::StateFlags::PRELIGHT, false);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
gtk_widget.connect_leave_notify_event(|gtk_widget, evt| {
|
gtk_widget.connect_leave_notify_event(|gtk_widget, evt| {
|
||||||
if evt.detail() != NotifyType::Inferior {
|
if evt.detail() != NotifyType::Inferior {
|
||||||
gtk_widget.clone().unset_state_flags(gtk::StateFlags::PRELIGHT);
|
gtk_widget.clone().unset_state_flags(gtk::StateFlags::PRELIGHT);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
// Support :active selector
|
// Support :active selector
|
||||||
gtk_widget.connect_button_press_event(|gtk_widget, _| {
|
gtk_widget.connect_button_press_event(|gtk_widget, _| {
|
||||||
gtk_widget.clone().set_state_flags(gtk::StateFlags::ACTIVE, false);
|
gtk_widget.clone().set_state_flags(gtk::StateFlags::ACTIVE, false);
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
gtk_widget.connect_button_release_event(|gtk_widget, _| {
|
gtk_widget.connect_button_release_event(|gtk_widget, _| {
|
||||||
gtk_widget.clone().unset_state_flags(gtk::StateFlags::ACTIVE);
|
gtk_widget.clone().unset_state_flags(gtk::StateFlags::ACTIVE);
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
def_widget!(bargs, _g, gtk_widget, {
|
def_widget!(bargs, _g, gtk_widget, {
|
||||||
|
@ -761,7 +762,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
|
||||||
if delta != 0f64 { // Ignore the first event https://bugzilla.gnome.org/show_bug.cgi?id=675959
|
if delta != 0f64 { // Ignore the first event https://bugzilla.gnome.org/show_bug.cgi?id=675959
|
||||||
run_command(timeout, &onscroll, &[if delta < 0f64 { "up" } else { "down" }]);
|
run_command(timeout, &onscroll, &[if delta < 0f64 { "up" } else { "down" }]);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
// @prop timeout - timeout of the command. Default: "200ms"
|
// @prop timeout - timeout of the command. Default: "200ms"
|
||||||
|
@ -772,7 +773,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
|
||||||
if evt.detail() != NotifyType::Inferior {
|
if evt.detail() != NotifyType::Inferior {
|
||||||
run_command(timeout, &onhover, &[evt.position().0, evt.position().1]);
|
run_command(timeout, &onhover, &[evt.position().0, evt.position().1]);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
// @prop timeout - timeout of the command. Default: "200ms"
|
// @prop timeout - timeout of the command. Default: "200ms"
|
||||||
|
@ -783,7 +784,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
|
||||||
if evt.detail() != NotifyType::Inferior {
|
if evt.detail() != NotifyType::Inferior {
|
||||||
run_command(timeout, &onhoverlost, &[evt.position().0, evt.position().1]);
|
run_command(timeout, &onhoverlost, &[evt.position().0, evt.position().1]);
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
// @prop cursor - Cursor to show while hovering (see [gtk3-cursors](https://docs.gtk.org/gdk3/ctor.Cursor.new_from_name.html) for possible names)
|
// @prop cursor - Cursor to show while hovering (see [gtk3-cursors](https://docs.gtk.org/gdk3/ctor.Cursor.new_from_name.html) for possible names)
|
||||||
|
@ -799,7 +800,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
|
||||||
gdk_window.set_cursor(gdk::Cursor::from_name(&display, &cursor).as_ref());
|
gdk_window.set_cursor(gdk::Cursor::from_name(&display, &cursor).as_ref());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
connect_signal_handler!(gtk_widget, gtk_widget.connect_leave_notify_event(move |widget, _evt| {
|
connect_signal_handler!(gtk_widget, gtk_widget.connect_leave_notify_event(move |widget, _evt| {
|
||||||
if _evt.detail() != NotifyType::Inferior {
|
if _evt.detail() != NotifyType::Inferior {
|
||||||
|
@ -808,7 +809,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
|
||||||
gdk_window.set_cursor(None);
|
gdk_window.set_cursor(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
// @prop timeout - timeout of the command. Default: "200ms"
|
// @prop timeout - timeout of the command. Default: "200ms"
|
||||||
|
@ -878,7 +879,7 @@ fn build_gtk_event_box(bargs: &mut BuilderArgs) -> Result<gtk::EventBox> {
|
||||||
3 => run_command(timeout, &onrightclick, &[] as &[&str]),
|
3 => run_command(timeout, &onrightclick, &[] as &[&str]),
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
gtk::Inhibit(false)
|
glib::Propagation::Proceed
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use glib::{object_subclass, wrapper};
|
use gtk::glib::{self, object_subclass, wrapper, Properties};
|
||||||
use glib_macros::Properties;
|
|
||||||
use gtk::{prelude::*, subclass::prelude::*};
|
use gtk::{prelude::*, subclass::prelude::*};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,7 @@ repository = "https://github.com/elkowar/eww"
|
||||||
homepage = "https://github.com/elkowar/eww"
|
homepage = "https://github.com/elkowar/eww"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gtk = "0.17.1"
|
gtk = "0.18.1"
|
||||||
gdk = "0.17.1"
|
|
||||||
zbus = { version = "3.7.0", default-features = false, features = ["tokio"] }
|
zbus = { version = "3.7.0", default-features = false, features = ["tokio"] }
|
||||||
dbusmenu-gtk3 = "0.1.0"
|
dbusmenu-gtk3 = "0.1.0"
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ fn icon_from_name(
|
||||||
) -> std::result::Result<gtk::gdk_pixbuf::Pixbuf, IconError> {
|
) -> std::result::Result<gtk::gdk_pixbuf::Pixbuf, IconError> {
|
||||||
let theme = if let Some(path) = theme_path {
|
let theme = if let Some(path) = theme_path {
|
||||||
let theme = gtk::IconTheme::new();
|
let theme = gtk::IconTheme::new();
|
||||||
theme.prepend_search_path(&path);
|
theme.prepend_search_path(path);
|
||||||
theme
|
theme
|
||||||
} else {
|
} else {
|
||||||
gtk::IconTheme::default().expect("Could not get default gtk theme")
|
gtk::IconTheme::default().expect("Could not get default gtk theme")
|
||||||
|
|
|
@ -88,9 +88,9 @@ impl Item {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn popup_menu(&self, event: &gdk::EventButton, x: i32, y: i32) -> zbus::Result<()> {
|
pub async fn popup_menu(&self, event: >k::gdk::EventButton, x: i32, y: i32) -> zbus::Result<()> {
|
||||||
if let Some(menu) = &self.gtk_menu {
|
if let Some(menu) = &self.gtk_menu {
|
||||||
menu.popup_at_pointer(event.downcast_ref::<gdk::Event>());
|
menu.popup_at_pointer(event.downcast_ref::<gtk::gdk::Event>());
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
self.sni.context_menu(x, y).await
|
self.sni.context_menu(x, y).await
|
||||||
|
|
Loading…
Add table
Reference in a new issue