Reputation: 81
i have a little problem setting up my glfw overlay properly, i already successfully created an glfw window with transparent background , now i want to make the window also "click-through" so i can access the windows behind it and let it act like an overlay.
sadly i cant figure out how to do this in glfw, my current code to init the window looks like that:
Width = 3440;
Height = 1440;
/* GLFW */
if (!glfwInit()) {
fprintf(stdout, "[GLFW] failed to init!\n");
exit(1);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
/*Topmost and see through*/
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);
glfwSwapInterval(1);
Window = glfwCreateWindow(Width, Height, "Overlay", 0, 0);
glfwMakeContextCurrent(Window);
i also tried with glfw3_native.h given glfwGetX11Window function and tried to do stuff like
void Render::MakeClickable(bool State){
auto X11Window = glfwGetX11Window(Window);
if(State){
}else{
XserverRegion region = XFixesCreateRegion (MainDisplay, NULL, 0);
XFixesSetWindowShapeRegion (MainDisplay, X11Window, ShapeInput, 0, 0, region);
XFixesDestroyRegion (MainDisplay, region);
}
}
but that didn't worked :/
How can I setup my window correctly to ignore my click and let it pass to the windows behind, so i can use it as an overlay?
Upvotes: 4
Views: 2808