Rust bindings for GTK+, Cairo, GtkSourceView and other GLib-compatible libraries
Questions tagged [gtk-rs]
94 questions
1
vote
1 answer
Making channels constructioned in a function last the lifetime of the program in Rust
I'm trying to write a basic multithreaded application using gtk3-rs, where the main thread sends a message to a child thread when a button is clicked, and the child thread sends a message back in response, after doing some calculations, the results…

Alexis Dumas
- 1,299
- 11
- 30
1
vote
2 answers
How to access state and template children in callback in GTK-rs
The tutorials and examples for gtk-rs are honestly really incomplete and spotty, so I'm trying to piece together how to modify the application's state, as well as the state of some of the child elements, inside a button callback. So, in brief, I…

Alexis Dumas
- 1,299
- 11
- 30
1
vote
0 answers
missing crate error even though present in Cargo.toml
I have a basic gtk-rs project with which I use meson. I have included gtk4 crate in the Cargo.toml file. When I run with cargo, it compiles but outputs "segmentation fault" error (I have searched and I still don't know what that is). However, when I…

Spirit_bird
- 35
- 6
1
vote
0 answers
detect when window size changed
I am making a web browser with gtk-rs. I am trying to do a check for fullscreen. I can get the screen size and compare that to the window size, if they are the same it is in fullscreen and I can hide the unnecessary widgets. Though this works, I can…

NotEverSoAnxious
- 21
- 1
1
vote
0 answers
Fullscreen GTK Box should only fullscreen webkit2gtk window, but fullscreens whole app instead
I am attempting to make a Webkit2gtk browser in Rust using WebKit2Gtk-rs. When the WebView attempts to go into fullscreen, it makes the entire application fullscreen, including stuff outside the webview. screenshot of application
What I am doing is…

NotEverSoAnxious
- 21
- 1
1
vote
2 answers
How do we build GUI with glade, gtk-rs in rust?
I created a simple GUI with a window,entry box ,label and a button using glade and saved as example.glade in my src directory of my rust project.

Eka
- 14,170
- 38
- 128
- 212
1
vote
1 answer
Handle children when subclassing gtk::Container in Rust
I am trying to create a custom gtk container containing multiple children using the Rust binding for gtk. I derive my custom class from gtk::Container and gtk::Widget. The problem is as follows:
gtk::subclass::container::ContainerImpl…

andrbrue
- 721
- 6
- 15
1
vote
0 answers
gtk-rs app gives the warning "Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal"
I get this warning every time I launch a simple GTK application:
GLib-GIO-WARNING **: HH:MM:SS.XXX: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal. It should do one of…

Cromo
- 169
- 8
1
vote
1 answer
fatal error LNK1181: cannot open input file 'gtk-3.lib'
So I set up GTK-rs for rust and I must have done something wrong because when I try to run my code it returns this error and I have no idea how to fix it:
fatal error LNK1181: cannot open input file 'gtk-3.lib'
I use Eclipse IDE if that will…

gearDev
- 29
- 1
- 8
1
vote
1 answer
Seemingly nothing happens when attempting to add to a `gtk::ListBox` from within an event handler in GTK-RS application
I'm attempting to to add to a gtk::ListBox container from within the event handling closure of an unrelated widget. The list box in question is fetched via a gtk::Builder like so:
let notes_list: gtk::ListBox =…

bmoxb
- 33
- 3
1
vote
2 answers
How to use Diesel connection and Gtk-rs events?
I am trying to do a get a object from a database with Diesel when the Enter key is pressed in a gtk Entry. My idea is to create a Diesel SQLite connection in main function and then borrow it every time that I need it.
To do that, I am trying to use…

user2474683
- 29
- 5
1
vote
1 answer
How to make `Button`s smaller than their minimal size?
I'm currently setting up some buttons, and the problem is, that I need to squeeze 10 of them into 480 pixels.
I found that the smallest width that the button can be is 50px; if I resize it to less than 50, it does not change. I'd like to change…

MG lolenstine
- 919
- 1
- 11
- 32
1
vote
1 answer
Update drawing function of a DrawingArea
I want to update a cairo drawing inside a DrawingArea. I tried to achieve this by calling DrawingArea::connect_draw(...) with a new function as the parameter. My issue is that it does not replace the original drawing function, but calls both when…

Natjo
- 2,005
- 29
- 75
1
vote
0 answers
No compositing effects on quiting the gtk application
I want to quit my gtk application automatically after a certain time. How do I properly do this? My issue is, that while the window closes and the program exists, no window effects through compton appearto work, such as fading.
This is my…

Natjo
- 2,005
- 29
- 75
1
vote
2 answers
Display multiple overlaying widgets
I'm trying to display multiple cairo drawings overlapping each other:
extern crate cairo;
extern crate gio;
extern crate gtk;
use std::f64::consts::PI;
use gio::prelude::*;
use gtk::prelude::*;
use gtk::DrawingArea;
use std::env::args;
fn…

Natjo
- 2,005
- 29
- 75