GTK3: Fixed workarea handling on systems with frequent monitor removals.

Closes: #40333. Thanks To: Anton Kavalenka.

Check number of connected monitors and fail if none.

Fall back to first monitory id no primary monitor is defined.
This commit is contained in:
Abou Al Montacir 2023-06-24 10:50:28 +02:00 committed by Maxim Ganetsky
parent 8f8892313a
commit 1b1444f245

View File

@ -3949,6 +3949,11 @@ begin
SPI_GETWORKAREA: begin
pdisp:=TGdkDisplay.get_default;
pmon:=pdisp^.get_primary_monitor();
if not Assigned(pmon) then begin
if pdisp^.get_n_monitors = 0 then
Exit(False);
pmon := pdisp^.get_monitor(0);
end;
pmon^.get_workarea(@wa);
pr:=PRect(pvParam);
pr^.Left:=wa.x;