Skip to content

[Linux] onWindowMove called on window focus and windowManager.getPosition() seems working bad #491

Open
@acorn371

Description

@acorn371

Hi,
I'm developing app size/position size&position persistence by shared_preference on windows and linux platforms . On windows platform all work great.
On linux I'm having some issues:

  1. WindowListener.onWindowMove and WindowListener.onWindowMoved are called on app window focus and aren't called on window move:
    @override
    void onWindowMove() {
      _platform.savePosition();
    }

    @override
    void onWindowMoved() {
      _platform.savePosition();
    }
  1. inside method _platform.savePosition(); the call to final Offset pos = await windowManager.getPosition(); always return Offset(26.0, 23.0) moving and dragging my app window
    @override
    Future<void> savePosition() async  {
      final Offset pos = await windowManager.getPosition();
  
      await PlatformUtils.prefs.setDouble(PREF_MAINWIN_POSX, pos.dx);
      await PlatformUtils.prefs.setDouble(PREF_MAINWIN_POSY, pos.dy);
  
      print("save-pos: ${pos.dx} ${pos.dy}");
    }

I'm working with flutter 3.24.0 and window_manager: 0.4.2 on Debian 11.

Is there a workaround to these issues ? Or better, a patch ?
Thanks,
Marco

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions