Skip to content

Commit

Permalink
Post-rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prokopyl committed Apr 18, 2024
1 parent 0b58445 commit 5298d6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/gl/win.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::ffi::{c_void, CString, OsStr};
use std::os::windows::ffi::OsStrExt;

use raw_window_handle::{RawWindowHandle, Win32WindowHandle};
use raw_window_handle::Win32WindowHandle;

use winapi::shared::minwindef::{HINSTANCE, HMODULE};
use winapi::shared::ntdef::WCHAR;
Expand Down
8 changes: 6 additions & 2 deletions src/win/window.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::cell::RefCell;
use std::cell::{Cell, RefCell};
use std::collections::VecDeque;
use std::ptr::null_mut;
use std::rc::Rc;
Expand All @@ -8,9 +8,11 @@ use winapi::um::ole2::OleInitialize;
use raw_window_handle::{
HasRawWindowHandle, RawDisplayHandle, RawWindowHandle, WindowsDisplayHandle,
};
use winapi::um::winuser::{LoadCursorW, SetCursor};

#[cfg(feature = "opengl")]
use crate::gl::win::GlContext;
use crate::win::cursor::cursor_to_lpcwstr;
use crate::win::handle::{WindowHandle, WindowHandleTransmitter};
use crate::win::proc::ProcState;
use crate::win::win32_window::Win32Window;
Expand All @@ -28,6 +30,7 @@ enum WindowTask {

pub struct Window {
pub(crate) win32_window: Win32Window,
cursor_icon: Cell<MouseCursor>,

/// Tasks that should be executed at the end of `wnd_proc`.
/// This is needed to avoid re-entrant calls into the `WindowHandler`.
Expand Down Expand Up @@ -72,6 +75,7 @@ impl Window {
let win32_window = Win32Window::create(parent, &options);
let window = Rc::new(Window {
win32_window,
cursor_icon: Cell::new(MouseCursor::Default),
deferred_tasks: RefCell::new(VecDeque::with_capacity(4)),
});
let handler = build_handler(crate::Window::new(Rc::downgrade(&window)));
Expand Down Expand Up @@ -106,7 +110,7 @@ impl Window {
}

pub fn set_mouse_cursor(&self, mouse_cursor: MouseCursor) {
self.state.cursor_icon.set(mouse_cursor);
self.cursor_icon.set(mouse_cursor);
unsafe {
let cursor = LoadCursorW(null_mut(), cursor_to_lpcwstr(mouse_cursor));
SetCursor(cursor);
Expand Down

0 comments on commit 5298d6c

Please sign in to comment.