blinc_platform_desktop

Crates.ioblinc_platform_desktop
lib.rsblinc_platform_desktop
version0.1.12
created_at2026-01-14 18:46:44.879478+00
updated_at2026-01-19 01:07:38.711032+00
descriptionBlinc desktop platform - macOS, Windows, Linux windowing and input
homepage
repositoryhttps://github.com/project-blinc/Blinc
max_upload_size
id2043445
size75,807
'Damilare Darmie Akinlaja (darmie)

documentation

https://docs.rs/blinc_platform_desktop

README

blinc_platform_desktop

Part of the Blinc UI Framework

This crate is a component of Blinc, a GPU-accelerated UI framework for Rust. For full documentation and guides, visit the Blinc documentation.

Desktop platform implementation for Blinc UI.

Overview

blinc_platform_desktop provides windowing, input handling, and event loop implementation for desktop platforms (macOS, Windows, Linux) using winit.

Supported Platforms

  • macOS: 11.0+ (Big Sur and later)
  • Windows: 10+
  • Linux: X11 and Wayland

Features

  • Native Windowing: Platform-native window management
  • Full Input Support: Mouse, keyboard, trackpad, touch
  • High DPI: Automatic scale factor handling
  • Multiple Windows: Create and manage multiple windows
  • Platform Integration: Native look and feel

Quick Start

use blinc_platform_desktop::DesktopPlatform;
use blinc_platform::{Platform, WindowConfig};

fn main() {
    let platform = DesktopPlatform::new();

    let window = platform.create_window(WindowConfig {
        title: "My App".to_string(),
        width: 800,
        height: 600,
        ..Default::default()
    });

    platform.run(|event| {
        match event {
            Event::RedrawRequested(_) => {
                // Render your UI
            }
            Event::WindowEvent { event, .. } => {
                // Handle window events
            }
            _ => {}
        }
        ControlFlow::Poll
    });
}

Platform-Specific Features

macOS

#[cfg(target_os = "macos")]
{
    // Native title bar integration
    window.set_titlebar_transparent(true);

    // Vibrancy effects
    window.set_background_appearance(NSVisualEffectMaterial::Sidebar);

    // Full screen support
    window.set_fullscreen(Some(Fullscreen::Borderless));
}

Windows

#[cfg(target_os = "windows")]
{
    // DWM composition
    window.enable_blur_behind();

    // Taskbar integration
    window.set_taskbar_progress(0.5);
}

Linux

#[cfg(target_os = "linux")]
{
    // Wayland-specific
    window.set_app_id("com.example.myapp");

    // X11-specific
    window.set_wm_class("MyApp", "myapp");
}

Event Handling

platform.run(|event| {
    match event {
        // Window lifecycle
        Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
            return ControlFlow::Exit;
        }

        // Input
        Event::WindowEvent { event: WindowEvent::KeyboardInput { input, .. }, .. } => {
            handle_key(input);
        }

        Event::WindowEvent { event: WindowEvent::CursorMoved { position, .. }, .. } => {
            handle_mouse_move(position.x, position.y);
        }

        // Redraw
        Event::RedrawRequested(_) => {
            render();
        }

        _ => {}
    }
    ControlFlow::Poll
});

Requirements

macOS

  • Xcode Command Line Tools

Windows

  • Visual Studio Build Tools 2019+

Linux

  • X11: libxkbcommon-dev, libwayland-dev, libxrandr-dev
  • Wayland: libwayland-dev, libxkbcommon-dev

License

MIT OR Apache-2.0

Commit count: 444

cargo fmt