-
-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undecorated windows are offset by an invisible margin #3162
Comments
I failed to reproduce this: package main
import (
"image/color"
"github.com/hajimehoshi/ebiten/v2"
)
type Game struct {
}
func (g *Game) Update() error {
if ebiten.IsKeyPressed(ebiten.KeyEscape) {
return ebiten.Termination
}
return nil
}
func (g *Game) Draw(screen *ebiten.Image) {
screen.Fill(color.RGBA{0x80, 0x80, 0x80, 0xff})
}
func (g *Game) Layout(width, height int) (int, int) {
return width, height
}
func main() {
ebiten.SetWindowDecorated(false)
ebiten.SetWindowPosition(0, 0)
ebiten.SetWindowSize(ebiten.Monitor().Size())
if err := ebiten.RunGame(&Game{}); err != nil {
panic(err)
}
} Could you show me a minimized code to reproduce your issue? Thanks, |
Hi @hajimehoshi thanks for the quick response! The example code you posted perfectly manages to reproduce the issue on my machine: It has to be something setup-specific, I assume. It wouldn't surprise me if this is a GPU thing, even. If I use a floating, transparent overlay at exactly the monitor's resolution, the GPU performs optimizations that remove the transparency, as if it's a full screen game of sorts. So, for completeness: Windows version: 11 (x64) |
Hmm, that's pretty odd. In your machine, does |
|
Thanks. In this case, didn't this return at the early return? if d == glfw.False {
return x, y, nil
}
I'm skeptical about this since this should not be reached. |
Something like this? func (u *UserInterface) adjustWindowPosition(x, y int, monitor *Monitor) (int, int) {
if microsoftgdk.IsXbox() {
return x, y
}
d, err := u.window.GetAttrib(glfw.Decorated)
if err != nil {
panic(err)
}
mx := monitor.boundsInGLFWPixels.Min.X
my := monitor.boundsInGLFWPixels.Min.Y
// As the video width/height might be wrong,
// adjust x/y at least to enable to handle the window (#328)
if x < mx {
x = mx
}
t, err := _GetSystemMetrics(_SM_CYCAPTION)
if err != nil {
panic(err)
}
if d == glfw.False {
return x, y
}
if y < my+int(t) {
y = my + int(t)
}
return x, y
} If yes then it properly renders in full screen on my machine. Edit: I am not sure if the snippet you posted is existing code, if it is can you mention the file:line? |
Ah, I'm sorry but I was looking at the main branch, not the 2.8 branch. This means this was already fixed by 8b0c930 EDIT: What I was looking at was ebiten/internal/ui/ui_windows.go Lines 118 to 125 in fab511e
|
As there are multiple reports for the same issue, I'll cherry-pick the fix to 2.8. Let me close this issue later as a duplication with #3118. |
Please try
go get github.com/hajimehoshi/ebiten/v2@ec57d482f2d20d125def084d9fd982a2236df2b0 I'll tag v2.8.5 a few days later. |
Can confirm the issue is no longer present on |
Ebitengine Version
v2.8.4
Operating System
Go Version (
go version
)go version go1.23.0 windows/amd64
What steps will reproduce the problem?
ebiten.SetWindowDecorated(false)
What is the expected result?
What happens instead?
Anything else you feel useful to add?
I have found that if the
isInitWindowDecorated
check is added on the last lines of theadjustWindowPosition
function, then the window is properly positioned. I am unsure if it is a valid fix or more work is needed to configure it (e.g. if window decorations are enabled/disabled during runtime).I am aware that if I use SetFullscreen then it can become a true fullscreen, but my usecase is around a transparent, click-pass-through, fullscreen overlay.
The text was updated successfully, but these errors were encountered: