flutter-embedded-linux
flutter-embedded-linux copied to clipboard
Add support for setting scale factor from parameters
This adds support for manually specifying dpi scale factor. --force-scale-factor
argument is added to examples to set factor. Tested on wayland.
I have no problem to contribute all my code to flutter.
@andreadaoud
I don't know if this change will be included in future contributions to flutter/engine, but is it okay to delegate all rights related to this change to us (Sony)? If you agree with the above, please add the Developer Certificate of Origin (DCO).
Yes, I'm willing to do so, but could you please point out how to do it?
See https://www.secondstate.io/articles/dco/
@HidenoriMatsubayashi DCO is added, thanks for your guide. However, I cannot get the code formatting correctly, could you please help me?
Run find src/flutter/shell/platform/linux_embedded/ -iname *.h -o -iname *.cc | xargs clang-format --dry-run --Werror
src/flutter/shell/platform/linux_embedded/window/elinux_window_x11.cc:26:19: error: code should be clang-formatted [-Wclang-format-violations]
current_scale_ =
^
src/flutter/shell/platform/linux_embedded/window/elinux_window_wayland.cc:833:19: error: code should be clang-formatted [-Wclang-format-violations]
current_scale_ =
^
src/flutter/shell/platform/linux_embedded/window/elinux_window_drm.h:37:21: error: code should be clang-formatted [-Wclang-format-violations]
current_scale_ =
^
Can you try to clang-format?
$ clang-format -i src/flutter/shell/platform/linux_embedded/window/elinux_window_x11.cc
$ clang-format -i src/flutter/shell/platform/linux_embedded/window/elinux_window_wayland.cc
$ clang-format -i src/flutter/shell/platform/linux_embedded/window/elinux_window_drm.h
I don't know why, but running clang-format check locally results in errors that does not belong to my code.
find src/flutter/shell/platform/linux_embedded/ -iname *.h -o -iname *.cc | xargs clang-format --dry-run --Werror
src/flutter/shell/platform/linux_embedded/flutter_elinux_view.cc:304:32: error: code should be clang-formatted [-Wclang-format-violations]
mouse_state_.buttons == 0
^
src/flutter/shell/platform/linux_embedded/flutter_elinux_view.cc:305:47: error: code should be clang-formatted [-Wclang-format-violations]
? mouse_state_.flutter_state_is_down ? FlutterPointerPhase::kUp
^
src/flutter/shell/platform/linux_embedded/flutter_elinux_view.cc:305:74: error: code should be clang-formatted [-Wclang-format-violations]
? mouse_state_.flutter_state_is_down ? FlutterPointerPhase::kUp
^
src/flutter/shell/platform/linux_embedded/flutter_elinux_view.cc:306:77: error: code should be clang-formatted [-Wclang-format-violations]
: FlutterPointerPhase::kHover
^
src/flutter/shell/platform/linux_embedded/flutter_elinux_view.cc:307:76: error: code should be clang-formatted [-Wclang-format-violations]
: mouse_state_.flutter_state_is_down ? FlutterPointerPhase::kMove
Hmm, but the remain errors are below:
src/client_wrapper/flutter_view_controller.cc:37:41: error: code should be clang-formatted [-Wclang-format-violations]
c_view_properties.force_scale_factor =
^
src/client_wrapper/flutter_view_controller.cc:39:35: error: code should be clang-formatted [-Wclang-format-violations]
c_view_properties.scale_factor =
@HidenoriMatsubayashi CI has passed, thank you.
BTW, currently I have tested this on standalone launcher, but I'm not sure how to integrate changed code into my app, to let it build directly (that is, make flutter-elinux directly use the changed code). Could you please give me a little clue? Thanks a lot!
Thanks a lot.
You can build libflutter_elinux_{wayland|gbm|eglstream|x11}.so
with this step in https://github.com/sony/flutter-embedded-linux/wiki/Building-Embedded-Linux-embedding-for-Flutter#build-shared-library-for-flutter-elinux. After building it, copy it to `<path_to_install>/flutter-elinux/flutter/bin/cache/artifacts/engine/elinux--/libflutter_elinux_*.so