Skip to content

Commit

Permalink
fix: not properly focused to the desktop when switching to an empty w…
Browse files Browse the repository at this point in the history
…orkspace
  • Loading branch information
DreamMaoMao committed Nov 2, 2024
1 parent 940bb4c commit 54cbe06
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/wm/src/common/platform/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{

use anyhow::{bail, Context};
use windows::{
core::{w, PCWSTR},
core::{w, PCWSTR, PCSTR},
Win32::{
Foundation::{HANDLE, HWND, LPARAM, POINT, WPARAM},
System::{
Expand All @@ -19,7 +19,7 @@ use windows::{
},
WindowsAndMessaging::{
CreateWindowExW, DispatchMessageW, GetAncestor, GetCursorPos,
GetDesktopWindow, GetForegroundWindow, GetMessageW, MessageBoxW,
FindWindowA, GetForegroundWindow, GetMessageW, MessageBoxW,
PeekMessageW, PostThreadMessageW, RegisterClassW, SetCursorPos,
SystemParametersInfoW, TranslateMessage, WindowFromPoint,
ANIMATIONINFO, CS_HREDRAW, CS_VREDRAW, CW_USEDEFAULT, GA_ROOT,
Expand Down Expand Up @@ -51,7 +51,9 @@ impl Platform {

/// Gets the `NativeWindow` instance of the desktop window.
pub fn desktop_window() -> NativeWindow {
let handle = unsafe { GetDesktopWindow() };
let handle = unsafe {
FindWindowA(PCSTR("Progman\0".as_ptr() as *const u8), PCSTR::null())
};
NativeWindow::new(handle.0)
}

Expand Down

0 comments on commit 54cbe06

Please sign in to comment.