Skip to content

Commit 38bcea4

Browse files
committed
Be robust wrt invalid workarea
1 parent 3e1ebd1 commit 38bcea4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎src/api.ml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ struct
319319
let sx, sy = point_of_vec2 (Raylib.get_monitor_position i) in
320320
let sw, sh = Raylib.(get_monitor_width i, get_monitor_height i) in
321321
let outer = sx, sy, sw, sh in
322-
let inner = Glfw.get_monitor_workarea i in
322+
let inner' = Glfw.get_monitor_workarea i in
323+
let _, _, iw, ih = inner' in
324+
let inner = if iw * ih = 0 then outer else inner' in
323325

324326
if !App.debug_layout then
325327
(
@@ -356,9 +358,8 @@ struct
356358

357359
let update current =
358360
let {outer; inner} = Iarray.get !monitors current in
359-
let x', y', w', h'= Glfw.get_monitor_workarea current in
360-
let change = inner <> (x', y', w', h') in
361-
if not change then None else
361+
let _, _, w', h' as inner' = Glfw.get_monitor_workarea current in
362+
if inner = inner' || w' * h' = 0 then None else
362363
(
363364
let current' = init_monitors (Some current) in
364365

0 commit comments

Comments
 (0)