mirror of https://github.com/liamg/aminal.git
Use primary monitor for DPI calc if monitor could be determined (#197)
This avoids a panic on startup in some specific situations (e.g. when xrandr's --scale option is in use).
This commit is contained in:
parent
1f05951012
commit
c2b1b95343
|
@ -80,7 +80,6 @@ type ResizeCache struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GUI) GetMonitor() *glfw.Monitor {
|
func (g *GUI) GetMonitor() *glfw.Monitor {
|
||||||
|
|
||||||
if g.window == nil {
|
if g.window == nil {
|
||||||
panic("to determine current monitor the window must be set")
|
panic("to determine current monitor the window must be set")
|
||||||
}
|
}
|
||||||
|
@ -107,7 +106,8 @@ func (g *GUI) GetMonitor() *glfw.Monitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if currentMonitor == nil {
|
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
|
return currentMonitor
|
||||||
|
|
Loading…
Reference in New Issue