Skip to content

Commit

Permalink
start update
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Feb 18, 2025
1 parent 5492d62 commit 2175a9f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ language: 'en'
- OSC 7 Escape sequences to advise the terminal of the working directory.
- OSC 133 Escape sequence to define Input, Output and Prompt zones.
- OSC 1337 Escape sequences to set user vars for tracking additional shell state.
- Updated `windows-sys` to `v0.59`.
- To match the corresponding changes in `windows-sys`, the `HWND`, `HMONITOR`, and `HMENU` types now alias to `*mut c_void` instead of `isize`.

## 0.2.7

Expand Down
2 changes: 1 addition & 1 deletion rio-window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ features = [
unicode-segmentation = "1.7.1"

[target.'cfg(target_os = "windows")'.dependencies.windows-sys]
version = "0.52.0"
version = "0.59.0"
features = [
"Win32_Devices_HumanInterfaceDevice",
"Win32_Foundation",
Expand Down
6 changes: 3 additions & 3 deletions rio-window/src/platform/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use crate::monitor::MonitorHandle;
use crate::window::{BadIcon, Icon, Window, WindowAttributes};

/// Window Handle type used by Win32 API
pub type HWND = isize;
pub type HWND = *mut c_void;
/// Menu Handle type used by Win32 API
pub type HMENU = isize;
pub type HMENU = *mut c_void;
/// Monitor Handle type used by Win32 API
pub type HMONITOR = isize;
pub type HMONITOR = *mut c_void;

/// Describes a system-drawn backdrop material of a window.
///
Expand Down
2 changes: 1 addition & 1 deletion rio-window/src/platform_impl/windows/dark_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn should_apps_use_dark_mode() -> bool {

let module = LoadLibraryA("uxtheme.dll\0".as_ptr());

if module == 0 {
if module.is_null() {
return None;
}

Expand Down
12 changes: 8 additions & 4 deletions rio-window/src/platform_impl/windows/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

use std::ffi::c_void;

use windows_sys::core::{IUnknown, GUID, HRESULT};
use windows_sys::core::{GUID, HRESULT};
use windows_sys::Win32::Foundation::{BOOL, HWND, POINTL};
use windows_sys::Win32::System::Com::{
IAdviseSink, IDataObject, IEnumFORMATETC, IEnumSTATDATA, FORMATETC, STGMEDIUM,
};
use windows_sys::Win32::System::Com::{FORMATETC, STGMEDIUM};

pub type IUnknown = *mut c_void;
pub type IAdviseSink = *mut c_void;
pub type IDataObject = *mut c_void;
pub type IEnumFORMATETC = *mut c_void;
pub type IEnumSTATDATA = *mut c_void;

#[repr(C)]
pub struct IUnknownVtbl {
Expand Down
4 changes: 2 additions & 2 deletions rio-window/src/platform_impl/windows/dpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn dpi_to_scale_factor(dpi: u32) -> f64 {

pub unsafe fn hwnd_dpi(hwnd: HWND) -> u32 {
let hdc = unsafe { GetDC(hwnd) };
if hdc == 0 {
if hdc.is_null() {
panic!("[winit] `GetDC` returned null!");
}
if let Some(GetDpiForWindow) = *GET_DPI_FOR_WINDOW {
Expand All @@ -93,7 +93,7 @@ pub unsafe fn hwnd_dpi(hwnd: HWND) -> u32 {
} else if let Some(GetDpiForMonitor) = *GET_DPI_FOR_MONITOR {
// We are on Windows 8.1 or later.
let monitor = unsafe { MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST) };
if monitor == 0 {
if monitor.is_null() {
return BASE_DPI;
}

Expand Down

0 comments on commit 2175a9f

Please sign in to comment.