popUpWindowMenu method

Future<void> popUpWindowMenu()

Opens the window menu at the cursor.

The system menu exists on Windows and on Linux window managers that offer one; elsewhere this does nothing.

Implementation

Future<void> popUpWindowMenu() async {
  final window = _target;
  if (window == null) return;
  tryNative(() {
    if (!nativeapi.Window.isSystemMenuSupported()) return;
    final cursor = nativeapi.DisplayManager.instance
        .getCursorPosition()
        .toOffset();
    final content = window.contentBounds.toRect();
    window.showSystemMenu((cursor - content.topLeft).toNative());
  });
}