new x11 option for disabling the forced click-to-focus so that the fuzzer can work:

This commit is contained in:
IoIxD 2026-04-26 19:43:32 -07:00
commit 3779b2e0db
3 changed files with 18 additions and 8 deletions

17
configure vendored
View file

@ -47,6 +47,8 @@ param_set("static", 1);
param_set("examples", 1);
param_set("dbus", 1);
# (option that only makes sense on x11)
param_set("allow-sloppy-focus", 0);
my %features = (
"classic-theme" => "use classic theme",
@ -61,7 +63,8 @@ my %features = (
"static" => "build static library",
"wayland" => "enable wayland backend",
"gnustep" => "use gnustep",
"dbus" => "use DBus on supported platform"
"dbus" => "use DBus on supported platform",
"allow-sloppy-focus" => "prevent the x11 backend from using XSetInputFocus to enforce click-to-focus"
);
my @features_keys = (
"1classic-theme", "1stb-image",
@ -81,6 +84,12 @@ sub def_platform {
param_set("freetype2", 0);
param_set("stb-truetype", 1);
}
if($target eq "Linux") {
param_set("x11", 1);
if(!param_get("tiny")){
param_set("wayland", 1);
}
}
}
foreach my $l (@ARGV) {
@ -91,12 +100,6 @@ foreach my $l (@ARGV) {
def_platform();
if($target eq "Linux") {
param_set("x11", 1);
if(!param_get("tiny")){
param_set("wayland", 1);
}
}
foreach my $l (@ARGV) {
if ($l =~ /^--with-([^=]+)=(.+)$/) {

View file

@ -110,6 +110,10 @@ else {
if (param_get("stb-truetype")) {
add_cflags("-DUSE_STB_TRUETYPE");
}
if (param_get("allow-sloppy-focus")) {
add_cflags("-DALLOW_SLOPPY_FOCUS");
}
add_incdir("-Iexternal/libz/include");

View file

@ -708,7 +708,8 @@ static void MwLLNextEventImpl(MwLL handle) {
p.button = MwMOUSE_WHEELDOWN;
}
XSetInputFocus(handle->x11.display, handle->x11.window, RevertToNone, CurrentTime);
/* this really shouldn't be in this function but it might be needed for enforcing click-to-focus. check later. */
/* XSetInputFocus(handle->x11.display, handle->x11.window, RevertToNone, CurrentTime);*/
MwLLDispatch(handle, down, &p);
} else if(ev.type == ButtonRelease) {
@ -1200,7 +1201,9 @@ static void MwLLShowImpl(MwLL handle, int show) {
if(show) {
wait_map(handle, 1);
#ifndef ALLOW_SLOPPY_FOCUS
XSetInputFocus(handle->x11.display, handle->x11.window, RevertToNone, CurrentTime);
#endif
} else {
wait_unmap(handle, 1);
}