Skip to content

Commit

Permalink
chore(deps): upgrade gtk to 0.18 (#801)
Browse files Browse the repository at this point in the history
* update to gtk 0.18

* Create gtk018.md

* Update gtk018.md
  • Loading branch information
dklassic committed Oct 16, 2023
1 parent d471ea7 commit 32ce759
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .changes/gtk018.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "minor"
---

Updated to gtk 0.18 and Bump MSRV to 1.70.0.
23 changes: 11 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ documentation = "https://docs.rs/tao"
categories = [ "gui" ]

[package.metadata.docs.rs]
features = [ "serde", "dox" ]
features = [ "serde" ]
default-target = "x86_64-unknown-linux-gnu"
targets = [
"i686-pc-windows-msvc",
Expand All @@ -31,7 +31,6 @@ members = [ "tao-macros" ]

[features]
default = [ ]
dox = [ "gtk/dox" ]

[build-dependencies]
cc = "1"
Expand Down Expand Up @@ -111,16 +110,16 @@ windows-implement = "0.48.0"
]

[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
cairo-rs = "0.16"
gio = "0.16"
glib = "0.16"
glib-sys = "0.16"
gtk = "0.16"
gdk = "0.16"
gdk-sys = "0.16"
gdkx11-sys = "0.16"
gdkwayland-sys = "0.16.0"
gdk-pixbuf = "0.16"
cairo-rs = "0.18"
gio = "0.18"
glib = "0.18"
glib-sys = "0.18"
gtk = "0.18"
gdk = "0.18"
gdk-sys = "0.18"
gdkx11-sys = "0.18"
gdkwayland-sys = "0.18.0"
gdk-pixbuf = "0.18"
x11-dl = "2.21"
zbus = "3"
uuid = { version = "1.3", features = [ "v4" ] }
Expand Down
48 changes: 26 additions & 22 deletions src/platform_impl/linux/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use cairo::{RectangleInt, Region};
use crossbeam_channel::SendError;
use gdk::{Cursor, CursorType, EventKey, EventMask, ScrollDirection, WindowEdge, WindowState};
use gio::{prelude::*, Cancellable};
use glib::{source::Priority, Continue, MainContext};
use gtk::{prelude::*, Inhibit};
use glib::{source::Priority, MainContext};
use gtk::prelude::*;

use raw_window_handle::{RawDisplayHandle, WaylandDisplayHandle, XlibDisplayHandle};

Expand Down Expand Up @@ -207,7 +207,11 @@ impl<T: 'static> EventLoop<T> {
}) {
log::warn!("Fail to send device event to event channel: {}", e);
}
Continue(run.load(Ordering::Relaxed))
if run.load(Ordering::Relaxed) {
glib::ControlFlow::Continue
} else {
glib::ControlFlow::Break
}
});
Some(run_device_thread)
} else {
Expand Down Expand Up @@ -422,7 +426,7 @@ impl<T: 'static> EventLoop<T> {
);
}
}
Inhibit(false)
glib::Propagation::Proceed
});
window.connect_button_press_event(|window, event| {
if !window.is_decorated() && window.is_resizable() && event.button() == 1 {
Expand All @@ -441,7 +445,7 @@ impl<T: 'static> EventLoop<T> {
}
}

Inhibit(false)
glib::Propagation::Proceed
});
window.connect_touch_event(|window, event| {
if !window.is_decorated() && window.is_resizable() {
Expand All @@ -467,7 +471,7 @@ impl<T: 'static> EventLoop<T> {
}
}

Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -478,7 +482,7 @@ impl<T: 'static> EventLoop<T> {
}) {
log::warn!("Failed to send window close event to event channel: {}", e);
}
Inhibit(true)
glib::Propagation::Stop
});

let tx_clone = event_tx.clone();
Expand Down Expand Up @@ -521,7 +525,7 @@ impl<T: 'static> EventLoop<T> {
e
);
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -535,7 +539,7 @@ impl<T: 'static> EventLoop<T> {
e
);
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand Down Expand Up @@ -564,7 +568,7 @@ impl<T: 'static> EventLoop<T> {
e
);
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -586,7 +590,7 @@ impl<T: 'static> EventLoop<T> {
}
}
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -599,7 +603,7 @@ impl<T: 'static> EventLoop<T> {
}) {
log::warn!("Failed to send cursor left event to event channel: {}", e);
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -625,7 +629,7 @@ impl<T: 'static> EventLoop<T> {
e
);
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -651,7 +655,7 @@ impl<T: 'static> EventLoop<T> {
e
);
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -671,7 +675,7 @@ impl<T: 'static> EventLoop<T> {
}) {
log::warn!("Failed to send scroll event to event channel: {}", e);
}
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand All @@ -695,7 +699,7 @@ impl<T: 'static> EventLoop<T> {
} else {
// stop here we don't want to send the key event
// as we emit the `ModifiersChanged`
return Continue(true);
return glib::ControlFlow::Continue;
}
}

Expand All @@ -714,7 +718,7 @@ impl<T: 'static> EventLoop<T> {
log::warn!("Failed to send keyboard event to event channel: {}", e);
}
}
Continue(true)
glib::ControlFlow::Continue
});

let tx_clone = event_tx.clone();
Expand All @@ -739,13 +743,13 @@ impl<T: 'static> EventLoop<T> {
handler(event_key.to_owned(), ElementState::Pressed);
ime.filter_keypress(event_key);

Inhibit(false)
glib::Propagation::Proceed
});

let handler = keyboard_handler.clone();
window.connect_key_release_event(move |_, event_key| {
handler(event_key.to_owned(), ElementState::Released);
Inhibit(false)
glib::Propagation::Proceed
});

let tx_clone = event_tx.clone();
Expand Down Expand Up @@ -777,7 +781,7 @@ impl<T: 'static> EventLoop<T> {
);
}
}
Inhibit(false)
glib::Propagation::Proceed
});

// Receive draw events of the window.
Expand All @@ -794,7 +798,7 @@ impl<T: 'static> EventLoop<T> {
cr.set_operator(cairo::Operator::Over);
}

Inhibit(false)
glib::Propagation::Proceed
});
}
}
Expand All @@ -818,7 +822,7 @@ impl<T: 'static> EventLoop<T> {
_ => unreachable!(),
}
}
Continue(true)
glib::ControlFlow::Continue
});

// Create event loop itself.
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/linux/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright 2021-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use gdk::Display;
use gdk::{prelude::MonitorExt, Display};

use crate::{
dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize},
Expand Down
5 changes: 4 additions & 1 deletion src/platform_impl/linux/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use gdk::Display;
use gdk::{
prelude::{DeviceExt, SeatExt},
Display,
};
use gtk::traits::{GtkWindowExt, WidgetExt};

use crate::{
Expand Down
6 changes: 3 additions & 3 deletions src/platform_impl/linux/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{

use gdk::{WindowEdge, WindowState};
use glib::translate::ToGlibPtr;
use gtk::{prelude::*, traits::SettingsExt, Settings};
use gtk::{prelude::*, Settings};
use raw_window_handle::{
RawDisplayHandle, RawWindowHandle, WaylandDisplayHandle, WaylandWindowHandle, XlibDisplayHandle,
XlibWindowHandle,
Expand Down Expand Up @@ -226,7 +226,7 @@ impl Window {
window.set_accept_focus(true);
window.disconnect(id);
}
Inhibit(false)
glib::Propagation::Proceed
});
signal_id.borrow_mut().replace(id);
}
Expand Down Expand Up @@ -261,7 +261,7 @@ impl Window {
let state = event.new_window_state();
max_clone.store(state.contains(WindowState::MAXIMIZED), Ordering::Release);
minimized_clone.store(state.contains(WindowState::ICONIFIED), Ordering::Release);
Inhibit(false)
glib::Propagation::Proceed
});

let scale_factor: Rc<AtomicI32> = Rc::new(win_scale_factor.into());
Expand Down

0 comments on commit 32ce759

Please sign in to comment.