deno-windowing / dwm

Deno Window Manager: Cross-platform window creation and management
https://deno.land/x/dwm
Apache License 2.0
138 stars 10 forks source link

Add rawHandle() API #29

Closed littledivy closed 8 months ago

littledivy commented 9 months ago

Ability to retrieve the window and display/instance handles from glfw. Similar to deno_sdl2's Window#rawHandle().

Rust implementation for reference: https://github.com/PistonDevelopers/glfw-rs/blob/2221cf05410c3dd2fac6f711c8f28e072c16f1fb/src/lib.rs#L3518

  /**
   * Return the raw handle of the window.
   *
   * platform: "cocoa" | "win32" | "winrt" | "x11" | "wayland"
   *
   * ```ts
   * const [platform, handle, display] = window.rawHandle();
   * ```
   *
   * on macOS:
   * - platform: "cocoa"
   * - handle: NSWindow
   * - display: NSView
   *
   * on Windows:
   * - platform: "win32" | "winrt"
   * - handle: HWND
   * - display: null | HINSTANCE
   *
   * on Linux:
   * - platform: "x11" | "wayland"
   * - handle: Window
   * - display: Display
   */
  rawHandle(): [string, Deno.PointerValue, Deno.PointerValue | null];

This can be passed to Deno's WebGPU with this proposal: https://github.com/denoland/deno/issues/21713

load1n9 commented 9 months ago

Sounds good!

nhrones commented 9 months ago

Any progress here? I'm interested in porting my DWM-ReactiveUI framework from Skia-Canvas to WebGPU.

What would it take to use DWM as the BYOW for Deno-WebGPU? Is anyone working on this?