mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
grab focus into the TextView on click empty ClampScrollable area
This commit is contained in:
parent
0178e040bb
commit
7223ac9de4
1 changed files with 17 additions and 0 deletions
|
|
@ -24,14 +24,31 @@ impl Text {
|
|||
base: &Uri,
|
||||
gemtext: &str,
|
||||
) -> Self {
|
||||
// Define some local dependencies
|
||||
use gtk::{prelude::WidgetExt, GestureClick};
|
||||
|
||||
// Init gemtext reader
|
||||
let gemini = Gemini::build(actions, base, gemtext).unwrap(); // @TODO handle
|
||||
|
||||
// Init container widget
|
||||
let clamp_scrollable = ClampScrollable::builder()
|
||||
.child(&gemini.text_view)
|
||||
.css_classes(["view"])
|
||||
.maximum_size(800)
|
||||
.build();
|
||||
|
||||
// Grab focus into the `TextView` on click empty `ClampScrollable` area
|
||||
let controller = GestureClick::new();
|
||||
|
||||
controller.connect_released({
|
||||
let text_view = gemini.text_view.clone();
|
||||
move |_, _, _, _| {
|
||||
text_view.grab_focus();
|
||||
}
|
||||
});
|
||||
|
||||
clamp_scrollable.add_controller(controller);
|
||||
|
||||
Self {
|
||||
text_view: gemini.text_view,
|
||||
meta: Meta {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue