Skip to content

Commit

Permalink
Use primary monitor for DPI calc if monitor could be determined (#197)
Browse files Browse the repository at this point in the history
This avoids a panic on startup in some specific situations (e.g. when
xrandr's --scale option is in use).
  • Loading branch information
mjs authored and liamg committed Feb 5, 2019
1 parent 1f05951 commit c2b1b95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ type ResizeCache struct {
}

func (g *GUI) GetMonitor() *glfw.Monitor {

if g.window == nil {
panic("to determine current monitor the window must be set")
}
Expand All @@ -107,7 +106,8 @@ func (g *GUI) GetMonitor() *glfw.Monitor {
}

if currentMonitor == nil {
panic("was not able to resolve current monitor")
// Monitor couldn't be found (xrandr scaling?) - default to primary
return glfw.GetPrimaryMonitor()
}

return currentMonitor
Expand Down

0 comments on commit c2b1b95

Please sign in to comment.