getWindowFrame method

NativeRect? getWindowFrame(
  1. String windowId
)

Get the current frame of a palette window.

Returns null if the window doesn't exist.

Implementation

NativeRect? getWindowFrame(String windowId) {
  final idPtr = windowId.toNativeUtf8().cast<Char>();
  final x = calloc<Double>();
  final y = calloc<Double>();
  final w = calloc<Double>();
  final h = calloc<Double>();

  try {
    final exists = _bindings.GetWindowFrame(idPtr, x, y, w, h);
    if (!exists) return null;
    return NativeRect(x.value, y.value, w.value, h.value);
  } finally {
    calloc.free(idPtr);
    calloc.free(x);
    calloc.free(y);
    calloc.free(w);
    calloc.free(h);
  }
}