diff --git a/configure b/configure index 6bd00b7..af92470 100755 --- a/configure +++ b/configure @@ -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-([^=]+)=(.+)$/) { diff --git a/pl/rules.pl b/pl/rules.pl index 348a576..c435bff 100644 --- a/pl/rules.pl +++ b/pl/rules.pl @@ -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"); diff --git a/src/backend/x11.c b/src/backend/x11.c index 1d73ed1..b8f68f5 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -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); }