Closed abcbcafe closed 7 months ago
Hi @abcbcafe,
thank you so much for reporting this bug AND proposing a fix! I have fixed the multi-monitor issues now:
XSetNormalHints
libx11-dev
, x11proto-dev
, libxrandr-dev
and libxrender-dev
installed (in case users don't have sudo
permissions), I've pulled the additional headers and the additional lib from these packages and included them directly in the FluidX3D repoFind the commit here.
Kind regards, Moritz
Hi, and thanks for the cool software.
I ran into an issue using the interactive graphics mode with a multi-monitor setup on Linux/X11. When launching a simulation, the fullscreen window launches on my main monitor, but the actual visualization inside the window is off-center. The same off-centeredness is also apparent for where the cursor gets picked up. This seems to be caused by DisplayWidth() and DisplayHeight() returning the total/combined size of all monitors, instead of only the size of the main monitor, causing the calculation of the center to be off. See attached screenshot.
I noticed that direct PRs are not accepted, but I wanted to share a workaround for anyone else facing this issue. If it suits the project, feel free to incorporate this into the codebase. The patch uses Xrandr to obtain the dimensions of the primary monitor, which ensures correct positioning of the simulation and mouse cursor. Note that this fix adds a dependency to Xrandr and could probably benefit from some better error handling.
To build, you'll have to add -lXrandr to the linker flags, e.g.
g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL -I./src/X11/include -L./src/X11/lib -lXrandr -lX11
I don't think it should matter, but for reference, I'm using:
Cheers, and have a great weekend.