mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
windows: Rename some constants and functions in GPUI (#23348)
Some checks failed
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Linux x86_x64 release bundle (push) Blocked by required conditions
CI / Linux arm64 release bundle (push) Blocked by required conditions
CI / Auto release preview (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Has been cancelled
Script / ShellCheck Scripts (push) Has been cancelled
Some checks failed
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Linux x86_x64 release bundle (push) Blocked by required conditions
CI / Linux arm64 release bundle (push) Blocked by required conditions
CI / Auto release preview (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Has been cancelled
Script / ShellCheck Scripts (push) Has been cancelled
This PR renames the constants and functions previously introduced in PR#23283. Since the changes are within the GPUI crate, I renamed these from `**_ZED_**` to `**_GPUI_**`. Release Notes: - N/A
This commit is contained in:
parent
ac8220bb2e
commit
1d5499bee7
3 changed files with 15 additions and 13 deletions
|
@ -21,7 +21,7 @@ use windows::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::{PlatformDispatcher, TaskLabel, WM_ZED_EVENT_DISPATCHED_ON_MAIN_THREAD};
|
||||
use crate::{PlatformDispatcher, TaskLabel, WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD};
|
||||
|
||||
pub(crate) struct WindowsDispatcher {
|
||||
main_sender: Sender<Runnable>,
|
||||
|
@ -105,7 +105,7 @@ impl PlatformDispatcher for WindowsDispatcher {
|
|||
unsafe {
|
||||
PostThreadMessageW(
|
||||
self.main_thread_id_win32,
|
||||
WM_ZED_EVENT_DISPATCHED_ON_MAIN_THREAD,
|
||||
WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD,
|
||||
WPARAM(self.validation_number),
|
||||
LPARAM(0),
|
||||
)
|
||||
|
|
|
@ -16,9 +16,9 @@ use windows::Win32::{
|
|||
|
||||
use crate::*;
|
||||
|
||||
pub(crate) const WM_ZED_CURSOR_STYLE_CHANGED: u32 = WM_USER + 1;
|
||||
pub(crate) const WM_ZED_CLOSE_ONE_WINDOW: u32 = WM_USER + 2;
|
||||
pub(crate) const WM_ZED_EVENT_DISPATCHED_ON_MAIN_THREAD: u32 = WM_USER + 3;
|
||||
pub(crate) const WM_GPUI_CURSOR_STYLE_CHANGED: u32 = WM_USER + 1;
|
||||
pub(crate) const WM_GPUI_CLOSE_ONE_WINDOW: u32 = WM_USER + 2;
|
||||
pub(crate) const WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD: u32 = WM_USER + 3;
|
||||
|
||||
const SIZE_MOVE_LOOP_TIMER_ID: usize = 1;
|
||||
const AUTO_HIDE_TASKBAR_THICKNESS_PX: i32 = 1;
|
||||
|
@ -90,7 +90,7 @@ pub(crate) fn handle_msg(
|
|||
WM_SETCURSOR => handle_set_cursor(lparam, state_ptr),
|
||||
WM_SETTINGCHANGE => handle_system_settings_changed(handle, state_ptr),
|
||||
WM_DWMCOLORIZATIONCOLORCHANGED => handle_system_theme_changed(state_ptr),
|
||||
WM_ZED_CURSOR_STYLE_CHANGED => handle_cursor_changed(lparam, state_ptr),
|
||||
WM_GPUI_CURSOR_STYLE_CHANGED => handle_cursor_changed(lparam, state_ptr),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(n) = handled {
|
||||
|
@ -246,7 +246,7 @@ fn handle_destroy_msg(handle: HWND, state_ptr: Rc<WindowsWindowStatePtr>) -> Opt
|
|||
unsafe {
|
||||
PostThreadMessageW(
|
||||
state_ptr.main_thread_id_win32,
|
||||
WM_ZED_CLOSE_ONE_WINDOW,
|
||||
WM_GPUI_CLOSE_ONE_WINDOW,
|
||||
WPARAM(state_ptr.validation_number),
|
||||
LPARAM(handle.0 as isize),
|
||||
)
|
||||
|
|
|
@ -184,14 +184,15 @@ impl WindowsPlatform {
|
|||
}
|
||||
}
|
||||
|
||||
// Returns true if the app should quit.
|
||||
fn handle_events(&self) -> bool {
|
||||
let mut msg = MSG::default();
|
||||
unsafe {
|
||||
while PeekMessageW(&mut msg, None, 0, 0, PM_REMOVE).as_bool() {
|
||||
match msg.message {
|
||||
WM_QUIT => return true,
|
||||
WM_ZED_CLOSE_ONE_WINDOW | WM_ZED_EVENT_DISPATCHED_ON_MAIN_THREAD => {
|
||||
if self.handle_zed_evnets(msg.message, msg.wParam, msg.lParam, &msg) {
|
||||
WM_GPUI_CLOSE_ONE_WINDOW | WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD => {
|
||||
if self.handle_gpui_evnets(msg.message, msg.wParam, msg.lParam, &msg) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +208,8 @@ impl WindowsPlatform {
|
|||
false
|
||||
}
|
||||
|
||||
fn handle_zed_evnets(
|
||||
// Returns true if the app should quit.
|
||||
fn handle_gpui_evnets(
|
||||
&self,
|
||||
message: u32,
|
||||
wparam: WPARAM,
|
||||
|
@ -219,12 +221,12 @@ impl WindowsPlatform {
|
|||
return false;
|
||||
}
|
||||
match message {
|
||||
WM_ZED_CLOSE_ONE_WINDOW => {
|
||||
WM_GPUI_CLOSE_ONE_WINDOW => {
|
||||
if self.close_one_window(HWND(lparam.0 as _)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
WM_ZED_EVENT_DISPATCHED_ON_MAIN_THREAD => self.run_foreground_task(),
|
||||
WM_GPUI_TASK_DISPATCHED_ON_MAIN_THREAD => self.run_foreground_task(),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
false
|
||||
|
@ -506,7 +508,7 @@ impl Platform for WindowsPlatform {
|
|||
let mut lock = self.state.borrow_mut();
|
||||
if lock.current_cursor.0 != hcursor.0 {
|
||||
self.post_message(
|
||||
WM_ZED_CURSOR_STYLE_CHANGED,
|
||||
WM_GPUI_CURSOR_STYLE_CHANGED,
|
||||
WPARAM(0),
|
||||
LPARAM(hcursor.0 as isize),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue