8000 use scaled frame buffer when needed by AnyCPU · Pull Request #1471 · cogentcore/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

use scaled frame buffer when needed #1471

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion system/driver/desktop/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ import (
"github.com/go-gl/glfw/v3.3/glfw"
)

// ScaleFramebuffer is a workaround for a GLFW_SCALE_FRAMEBUFFER window hint introduced in GLFW 3.4,
// GLFW_COCOA_RETINA_FRAMEBUFFER is kept for compatibility reasons,
// both have the same effect.
// Use it while using GLFW 3.3.
const ScaleFramebuffer = glfw.CocoaRetinaFramebuffer

// Window is the implementation of [system.Window] for the desktop platform.
type Window struct {
base.WindowMulti[*App, *gpudraw.Drawer]
Expand Down Expand Up @@ -95,7 +101,11 @@ func (w *Window) newGlfwWindow(opts *system.NewWindowOptions, sc *system.Screen)
} else {
glfw.WindowHint(glfw.Decorated, glfw.True)
}
glfw.WindowHint(glfw.CocoaRetinaFramebuffer, glfw.True)
if sc.DevicePixelRatio > 1 {
glfw.WindowHint(ScaleFramebuffer, glfw.True)
} else {
glfw.WindowHint(ScaleFramebuffer, glfw.False)
}
// glfw.WindowHint(glfw.TransparentFramebuffer, glfw.True)
// todo: glfw.Floating for always-on-top -- could set for modal
sz := opts.Size
Expand Down
Loading
0