Skip to content

how to make widgets do not steal mouse events? #515

Answered by kotontrion
Xtr4F asked this question in Q&A
Discussion options

You must be logged in to vote

the clickThrough property will make the whole window not receive events. To achieve your goal you have to set the input region of the window to the match the the size/position of your widget. You have to do this manually, I do something similar to make the transparent parts of my bar clickthrough.

Here is a snippet on how you can do that:

//import cairo
import Cairo from "cairo"

//do this after the the widget has been moved
const region = new Cairo.Region()
const alloc = event_box.get_allocation()
region.unionRectangle(alloc)
event_box.get_toplevel().input_shape_combine_region(region)

Note that get_allocation() returns the coordinates relative to the widgets parent, while input_region is…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@Xtr4F
Comment options

@Aylur
Comment options

@kotontrion
Comment options

Answer selected by Xtr4F
@Xtr4F
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants