Optimization window

This commit is contained in:
fanchenio 2023-11-07 10:33:42 +08:00
parent 80f1c40ad7
commit f6fe6c9558
9 changed files with 37 additions and 14 deletions

View File

@ -30,6 +30,7 @@ features = [
"Win32_System_Environment", "Win32_System_Environment",
"Win32_UI_Input_Ime", "Win32_UI_Input_Ime",
"Win32_Globalization", "Win32_Globalization",
"Win32_Graphics_Dwm",
] ]
[build-dependencies] [build-dependencies]

View File

@ -18,7 +18,6 @@ function createWindow() {
parent: global.mainWindow, parent: global.mainWindow,
height: 212, height: 212,
width: 600, width: 600,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,

View File

@ -43,7 +43,6 @@ function createAddEditWindow(id: number | null, parentId: number | null) {
parent: global.mainWindow, parent: global.mainWindow,
height: 174, height: 174,
width: 400, width: 400,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,
@ -108,7 +107,6 @@ function createSetIconWindow(id: number) {
parent: global.mainWindow, parent: global.mainWindow,
height: 500, height: 500,
width: 358, width: 358,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,
@ -168,7 +166,6 @@ function createAssociateFolderWindow(id: number) {
parent: global.mainWindow, parent: global.mainWindow,
height: 249, height: 249,
width: 400, width: 400,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,
@ -233,7 +230,6 @@ function createAggregateWindow(id: number) {
parent: global.mainWindow, parent: global.mainWindow,
height: 144, height: 144,
width: 400, width: 400,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,

View File

@ -19,7 +19,6 @@ function createBackupRestoreDataWindow() {
parent: global.mainWindow, parent: global.mainWindow,
height: 108, height: 108,
width: 400, width: 400,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,

View File

@ -51,7 +51,6 @@ async function createAddEditWindow(
parent: global.mainWindow, parent: global.mainWindow,
height: 500, height: 500,
width: 600, width: 600,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,
@ -112,7 +111,6 @@ async function createNetworkIconWindow() {
parent: global.itemAddEditWindow, parent: global.itemAddEditWindow,
height: 230, height: 230,
width: 400, width: 400,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,
@ -164,7 +162,6 @@ async function createSVGIconWindow() {
parent: global.itemAddEditWindow, parent: global.itemAddEditWindow,
height: 230, height: 230,
width: 400, width: 400,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,

View File

@ -30,7 +30,6 @@ function createMainWindow() {
title: "Dawn Launcher", title: "Dawn Launcher",
width: 800, width: 800,
height: 600, height: 600,
type: "toolbar",
frame: false, frame: false,
show: false, show: false,
maximizable: false, maximizable: false,
@ -56,6 +55,10 @@ function createMainWindow() {
} }
// 加载完毕 // 加载完毕
mainWindow.webContents.on("did-finish-load", () => { mainWindow.webContents.on("did-finish-load", () => {
// 设置窗口无动画
global.addon.removeWindowAnimation(
mainWindow.getNativeWindowHandle().readInt32LE(0)
);
// 恢复上一次的位置 // 恢复上一次的位置
let bounds = cacheData.cacheStore.get("mainWindowBounds"); let bounds = cacheData.cacheStore.get("mainWindowBounds");
if (bounds) { if (bounds) {

View File

@ -28,7 +28,6 @@ function createSettingWindow() {
parent: global.mainWindow, parent: global.mainWindow,
height: 500, height: 500,
width: 600, width: 600,
type: "toolbar",
maximizable: false, maximizable: false,
minimizable: false, minimizable: false,
resizable: false, resizable: false,

View File

@ -165,3 +165,12 @@ pub fn get_clipboard_bitmap_base64() -> Option<String> {
pub fn empty_recycle_bin(window: i32) { pub fn empty_recycle_bin(window: i32) {
windows::empty_recycle_bin(window) windows::empty_recycle_bin(window)
} }
/**
*
*/
#[allow(dead_code)]
#[napi]
pub fn remove_window_animation(window: i32) {
windows::remove_window_animation(window);
}

View File

@ -18,9 +18,12 @@ use windows::{
w, w,
Win32::{ Win32::{
Foundation::{HWND, LPARAM, LRESULT, MAX_PATH, POINT, RECT, SIZE, WPARAM}, Foundation::{HWND, LPARAM, LRESULT, MAX_PATH, POINT, RECT, SIZE, WPARAM},
Graphics::Gdi::{ Graphics::{
GetMonitorInfoW, GetObjectW, MonitorFromWindow, BITMAP, MONITORINFO, Dwm::{DwmSetWindowAttribute, DWMWA_TRANSITIONS_FORCEDISABLED},
MONITOR_DEFAULTTONEAREST, Gdi::{
GetMonitorInfoW, GetObjectW, MonitorFromWindow, BITMAP, MONITORINFO,
MONITOR_DEFAULTTONEAREST,
},
}, },
Storage::FileSystem::SearchPathW, Storage::FileSystem::SearchPathW,
System::{ System::{
@ -671,3 +674,20 @@ pub fn empty_recycle_bin(window: i32) {
let _ = SHEmptyRecycleBinW(hwnd, None, SHERB_NOSOUND); let _ = SHEmptyRecycleBinW(hwnd, None, SHERB_NOSOUND);
}; };
} }
/**
*
*/
pub fn remove_window_animation(window: i32) {
// HWND
let hwnd = HWND(window as isize);
let pvattribute = &mut true as *mut _ as *const _;
unsafe {
let _ = DwmSetWindowAttribute(
hwnd,
DWMWA_TRANSITIONS_FORCEDISABLED,
pvattribute,
std::mem::size_of_val(&pvattribute) as u32,
);
};
}