-
Notifications
You must be signed in to change notification settings - Fork 282
fixes pixel ration on macos #458
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on MacOS 10.15.5! Thanks!
On linux (and in my setup), this method of handling the pixel ratio works better than the current one. |
On linux/X11 the fix/contentscale branch is broken. Everything is way too large. It is the same value for both of my monitors now; 2.6458333. I don't think we can ever use glfw's content scale directly as flutters pixelRatio because flutter bases it's pixelRatio on the 160dpi standard. It's related to the Android Display Pixel calculations. So at the very least there needs to be some formula calculating from one to the other. |
The current implementations of the DPI calculations is done by querying the |
The |
Looking at the code in https://github.com/flutter/engine/blob/175a92b467e988649d642193e864189f88430524/shell/platform/glfw/flutter_glfw.cc |
I think the two maybe should be combined or something like that... |
Hey guys! What's the status of this fix? We are using this branch for MacOS builds because otherwise, it's all too small on retina displays. Is there any new info on this so this could get merged? |
We needed this fix for retina displays and it seemed to work just fine for all platforms... Apart from the fact that it crashed on some Macs before we got it merged with the current master head! We tested it in laptops and iMacs running OSX 10.15.6, 10.15.5, 10.12.6 and 10.13.6 and found no stable pattern in where it worked and where it didn't. When we merged with the head of master it stopped crashing for everybody. This is what the system log had to say about the crash:
At first, we blamed the scaling callback for not debouncing as the position callback does. But after we merged the master in everything works fine with or without debouncing. We were not able to get to the bottom of the problem. |
We had to switch off go-flutter due to this so I stopped looking into it. We're using the native desktop embedder and calling Go from a shared library now. |
Any progress on this? |
@JanezStupar does |
Looks great on Macos - both retina and external display. |
Awesome, does |
With hover 0.43.0 yes. With hover 0.44.0 no as it throws a sefgault during build (I haven't looked into it, I just downgraded hoping that somebody else is on it already. |
If you update hover. |
The segfault maybe happens, because an old engine is used and not the new AOT engines. Doing a |
I tried all your suggestions the result is the same. I have created a new ticket for that as to not clutter this discussion. |
So what is the recomendation for my issue? To use the |
@JanezStupar yes, I'll get this merge for MacOS and Windows this week. |
@GeertJohan I've compiled all cases and came out with this code. Is it good for you ? This work for me on linux. |
@GeertJohan Can you look at this. |
I tried to use this branch locally with the latest version of hover, but the resulting release binary failed instantly:
|
What I can tell is that the following error:
is a building error. (with the latest version of hover, the |
I think a rebase is needed! diff --git a/accessibility.go b/accessibility.go
index 386e943..97a280f 100644
--- a/accessibility.go
+++ b/accessibility.go
@@ -9,7 +9,7 @@ var defaultAccessibilityPlugin = &accessibilityPlugin{}
func (p *accessibilityPlugin) InitPlugin(messenger plugin.BinaryMessenger) error {
channel := plugin.NewBasicMessageChannel(messenger, "flutter/accessibility", plugin.StandardMessageCodec{})
- // Ignored: go-flutter doesn't support accessibility events
+ // Ignored: go-flutter dosn't support accessibility events
channel.HandleFunc(func(_ interface{}) (interface{}, error) { return nil, nil })
return nil
}
diff --git a/application.go b/application.go
index 14422e7..6e1a684 100644
--- a/application.go
+++ b/application.go
@@ -320,6 +320,9 @@ func (a *Application) Run() error {
})
})
})
+ a.window.SetContentScaleCallback(func(window *glfw.Window, x float32, y float32) {
+ windowManager.glfwRefreshCallback(window)
+ })
// Attach glfw window callbacks for text input
a.window.SetKeyCallback(
diff --git a/embedder/build.go b/embedder/build.go
index eef0dcd..9f185b0 100644
--- a/embedder/build.go
+++ b/embedder/build.go
@@ -1,5 +1,3 @@
-// +build !no_engine_tags
-
package embedder
// #cgo linux LDFLAGS: -lflutter_engine -Wl,-rpath,$ORIGIN
diff --git a/embedder/embedder.go b/embedder/embedder.go
index 81cf529..2aa94a6 100644
--- a/embedder/embedder.go
+++ b/embedder/embedder.go
@@ -132,17 +132,17 @@ func (flu *FlutterEngine) Run(userData unsafe.Pointer, vmArgs []string) error {
}
if C.FlutterEngineRunsAOTCompiledDartCode() {
- elfSnapshotPath := C.CString(flu.ElfSnapshotPath)
- defer C.free(unsafe.Pointer(elfSnapshotPath))
+ // elfSnapshotPath := C.CString(flu.ElfSnapshotPath)
+ // defer C.free(unsafe.Pointer(elfSnapshotPath))
- dataIn := C.FlutterEngineAOTDataSource{}
+ // dataIn := C.FlutterEngineAOTDataSource{}
- C.createAOTDataSource(&dataIn, elfSnapshotPath)
- res := (Result)(C.FlutterEngineCreateAOTData(&dataIn, &flu.aotDataSource))
- if res != ResultSuccess {
- return res.GoError("C.FlutterEngineCreateAOTData()")
- }
- args.aot_data = flu.aotDataSource
+ // C.createAOTDataSource(&dataIn, elfSnapshotPath)
+ // res := (Result)(C.FlutterEngineCreateAOTData(&dataIn, &flu.aotDataSource))
+ // if res != ResultSuccess {
+ // return res.GoError("C.FlutterEngineCreateAOTData()")
+ // }
+ // args.aot_data = flu.aotDataSource
}
args.struct_size = C.size_t(unsafe.Sizeof(args))
@@ -167,10 +167,10 @@ func (flu *FlutterEngine) Shutdown() error {
}
if C.FlutterEngineRunsAOTCompiledDartCode() {
- res := (Result)(C.FlutterEngineCollectAOTData(flu.aotDataSource))
- if res != ResultSuccess {
- return res.GoError("engine.Shutdown()")
- }
+ // res := (Result)(C.FlutterEngineCollectAOTData(flu.aotDataSource))
+ // if res != ResultSuccess {
+ // return res.GoError("engine.Shutdown()")
+ // }
}
return nil
} |
d585248
to
17ae550
Compare
fixes: #563 |
When will it be merged? After testing the |
After many report from the community, this branch fixes the problem for the majority of the users. I'll merge this branch as a step in the right direction but not a complete solution. (IMHO, it's good enough of linux windows and macos users) |
No description provided.