windows: use c_void from winapi (#235)

The `SelectObject()` call accepts a `HGDIOBJ` which is typecast to a
`std::os::raw::c_void` when building using libstd, and is its own thing
when building with std disabled:

winapi/0.3.9/src/winapi/lib.rs.html:
    #[cfg(feature = "std")]
    pub use std::os::raw::c_void;
    #[cfg(not(feature = "std"))]
    pub enum c_void {}

This patch uses `HGDIOBJ` as the typecast as necessary.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-02-10 16:04:47 +08:00 committed by GitHub
parent 655e437346
commit e5b5cc50d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -279,7 +279,7 @@ unsafe extern "system" fn wnd_proc(
let mut y_offset = 0; let mut y_offset = 0;
let dc = wnd.dc.unwrap(); let dc = wnd.dc.unwrap();
wingdi::SelectObject(dc, wnd.clear_brush as *mut std::ffi::c_void); wingdi::SelectObject(dc, wnd.clear_brush as *mut winapi::ctypes::c_void);
match wnd.draw_params.scale_mode { match wnd.draw_params.scale_mode {
ScaleMode::AspectRatioStretch => { ScaleMode::AspectRatioStretch => {
@ -817,7 +817,7 @@ impl Window {
pub fn set_background_color(&mut self, color: u32) { pub fn set_background_color(&mut self, color: u32) {
unsafe { unsafe {
wingdi::DeleteObject(self.clear_brush as *mut std::ffi::c_void); wingdi::DeleteObject(self.clear_brush as *mut winapi::ctypes::c_void);
let r = (color >> 16) & 0xff; let r = (color >> 16) & 0xff;
let g = (color >> 8) & 0xff; let g = (color >> 8) & 0xff;
let b = (color >> 0) & 0xff; let b = (color >> 0) & 0xff;