On Tue, 12 Dec 2023 11:19:23 GMT, Jose Pereda <jper...@openjdk.org> wrote:

> This PR replaces the deprecated `gdk_pointer_grab` with `gdk_seat_grab`, and 
> `gdk_pointer_ungrab ` with `gdk_seat_ungrab`, using runtime checks and 
> wrapped functions for GTK 3.20+ (so systems without it still run with GTK 
> 3.8+), and fixes the dragging issue on Wayland.

We want the ability to build this on a system that may or may not have GTK 
3.20, and then to have the binary produced by the build be able to run on a 
system that may or may not have GTK 3.20, using the new function if available.

This means that there should not be any compile-time `#if` checks. All checks 
should be runtime checks, for example, checking whether or not the function 
pointer obtained via dlsym is NULL vs non-NULL.

I think you already have the needed runtime checks. I was able to compile your 
PR branch, using headers and libraries from GTK > 3.20, and run it on a system 
with GTK < 3.20. I confirmed that the dlsym returned NULL on that system (as 
expected), and it didn't crash.

So it might be as simple as removing the `#if` checks along with the entire 
"else" blocks, letting the code currently in the `#if` checks be 
unconditionally compiled. As long as you aren't using anything from a system 
GTK header file that doesn't exist in 3.8, this should be fine.

modules/javafx.graphics/src/main/native-glass/gtk/glass_general.cpp line 599:

> 597:         return TRUE;
> 598:     }
> 599: #if GTK_CHECK_VERSION(3, 20, 0)

I wouldn't have expected any compile-time `#if` checks as part of this PR.

-------------

PR Review: https://git.openjdk.org/jfx/pull/1305#pullrequestreview-1782152507
PR Review Comment: https://git.openjdk.org/jfx/pull/1305#discussion_r1426923806

Reply via email to