raw-window-handle | A common windowing interoperability library for Rust
kandi X-RAY | raw-window-handle Summary
kandi X-RAY | raw-window-handle Summary
This library provides standard types for accessing a window's platform-specific raw window handle. This does not provide any utilities for creating and managing windows; instead, it provides a common interface that window creation libraries (e.g. Winit, SDL) can use to easily talk with graphics libraries (e.g. gfx-hal).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of raw-window-handle
raw-window-handle Key Features
raw-window-handle Examples and Code Snippets
Community Discussions
Trending Discussions on raw-window-handle
QUESTION
I'm trying to create my first Vulkan application using Rust following adrien ben's vulkan-tutorial.
As I progressed to commit 1.2.1 I noticed he is creating the winit-window for Windows.
Because I'm developing the application on my Linux-system I decided to leave the pre-scripted path, and try to implement the windowing-part on my own.
So I stumbled across the ash-window-crate which gives me a create-surface()
method that needs a window-handle
as a parameter.
My problem is as follows:
I'm not able to call the raw-window-handle function from my winit-window although the docs of winit suggest the Window-Struct implements the HasRawWindowHandle-Trait, which to my understanding would expose the aforementioned function.
I'm trying to create the KHRSurface like this:
...ANSWER
Answered 2021-Jun-21 at 18:07welcome to StackOverflow.
The window
does indeed implement the HasRawWindowHandle
trait, and the create_surface
function wants to be passed a window object that implements this trait.
That tells us that, somewhere inside of create_surface
, it will call raw_window_handle
on that object.
But in your code, you are already grabbing the window
's raw_window_handle
and passing that into the function.
So now create_surface
would want to get the raw_window_handle
of your raw_window_handle.
Long story short, just try passing in &window
instead of &window.raw_window_handle()
.
QUESTION
I'm trying to make a window I created using the winit
crate be always on top (HWND_TOPMOST
). I'm creating my window, and getting the RawWindowHandle::Windows
from it. That struct has a pub hwnd
which is a *mut c_void
. And my question now is, how can I convert that *mut c_void
to a *mut winapi::shared::windef::HWND__
so I can pass it to winapi::winuser::SetWindowPos(...)
?
Here's my code for getting the raw window handle:
...ANSWER
Answered 2020-Oct-15 at 12:46Turns out, there is a HWND struct to which you can simply cast the *mut c_void
, like so:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install raw-window-handle
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page