Skip to content

Commit 6ee0239

Browse files
Desktop: Update CEF to 149 (#4286)
1 parent 244b257 commit 6ee0239

5 files changed

Lines changed: 58 additions & 104 deletions

File tree

.nix/pkgs/graphite-cef.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{ pkgs, ... }:
22

33
let
4-
version = "147.0.14+g76d2442+chromium-147.0.7727.138";
4+
version = "149.0.5+g6770623+chromium-149.0.7827.197";
55
hashes = {
6-
aarch64-linux = "sha256-Gy2Xs1NHwmIr+buzoqDso1QJVkKlA/UMXytHjNGqpNk=";
7-
x86_64-linux = "sha256-os7wAFJ+mVK65HCikvEjhMeQUj2ty7y+6Ad0OlOcbeA=";
6+
aarch64-linux = "sha256-cBAvcvs1rAg5EKJkCt81RZYupCWpUNIC/nLt3PJow7Q=";
7+
x86_64-linux = "sha256-OPGMBJmvvLiLdBDniBQwx7LmTGGI59AcesJdILSeqcs=";
88
};
99

1010
selectSystem =

Cargo.lock

Lines changed: 21 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ gungraun = { version = "0.18" }
214214
ndarray = "0.16"
215215
strum = { version = "0.27", features = ["derive"] }
216216
dirs = "6.0"
217-
cef = "148"
218-
cef-dll-sys = "148"
217+
cef = "149"
218+
cef-dll-sys = "149"
219219
include_dir = "0.7"
220220
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
221221
tracing = "0.1"
@@ -257,5 +257,5 @@ debug = true
257257
# Force cargo to use only one version of the dpi crate (vendoring breaks without this)
258258
dpi = { git = "https://github.com/rust-windowing/winit.git" }
259259
rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released
260-
cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite" }
261-
cef-dll-sys = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite" }
260+
cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-149" }
261+
cef-dll-sys = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-149" }

desktop/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ window_clipboard = "0.5"
5555

5656
# Windows-specific dependencies
5757
[target.'cfg(target_os = "windows")'.dependencies]
58-
windows = { version = "0.58.0", features = [
58+
windows = { version = "0.62.2", features = [
5959
"Win32_Foundation",
6060
"Win32_Graphics_Dwm",
6161
"Win32_Graphics_Gdi",

desktop/src/window/win/native_handle.rs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ impl NativeWindowHandle {
6161
0,
6262
0,
6363
0,
64-
main,
64+
Some(main),
65+
None,
6566
None,
66-
HINSTANCE(std::ptr::null_mut()),
6767
// Pass the main window's HWND to WM_NCCREATE so the helper can store it.
6868
Some(&main as *const _ as _),
6969
)
@@ -103,18 +103,36 @@ impl NativeWindowHandle {
103103
};
104104
let _ = unsafe { DwmExtendFrameIntoClientArea(main, &margins) };
105105

106-
let hinst = unsafe { GetModuleHandleW(None) }.unwrap();
106+
let hinst: HINSTANCE = unsafe { GetModuleHandleW(None) }.unwrap().into();
107107

108108
// Set taskbar icon
109-
if let Ok(big) = unsafe { LoadImageW(hinst, PCWSTR(1usize as *const u16), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_SHARED) } {
109+
if let Ok(big) = unsafe {
110+
LoadImageW(
111+
Some(hinst),
112+
PCWSTR(1usize as *const u16),
113+
IMAGE_ICON,
114+
GetSystemMetrics(SM_CXICON),
115+
GetSystemMetrics(SM_CYICON),
116+
LR_SHARED,
117+
)
118+
} {
110119
unsafe { SetClassLongPtrW(main, GCLP_HICON, big.0 as isize) };
111-
unsafe { SendMessageW(main, WM_SETICON, WPARAM(ICON_BIG as usize), LPARAM(big.0 as isize)) };
120+
unsafe { SendMessageW(main, WM_SETICON, Some(WPARAM(ICON_BIG as usize)), Some(LPARAM(big.0 as isize))) };
112121
}
113122

114123
// Set window icon
115-
if let Ok(small) = unsafe { LoadImageW(hinst, PCWSTR(1usize as *const u16), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) } {
124+
if let Ok(small) = unsafe {
125+
LoadImageW(
126+
Some(hinst),
127+
PCWSTR(1usize as *const u16),
128+
IMAGE_ICON,
129+
GetSystemMetrics(SM_CXSMICON),
130+
GetSystemMetrics(SM_CYSMICON),
131+
LR_SHARED,
132+
)
133+
} {
116134
unsafe { SetClassLongPtrW(main, GCLP_HICONSM, small.0 as isize) };
117-
unsafe { SendMessageW(main, WM_SETICON, WPARAM(ICON_SMALL as usize), LPARAM(small.0 as isize)) };
135+
unsafe { SendMessageW(main, WM_SETICON, Some(WPARAM(ICON_SMALL as usize)), Some(LPARAM(small.0 as isize))) };
118136
}
119137

120138
// Force window update
@@ -197,7 +215,7 @@ unsafe fn ensure_helper_class() {
197215
lpfnWndProc: Some(helper_window_handle_message),
198216
hInstance: unsafe { GetModuleHandleW(None).unwrap().into() },
199217
hIcon: HICON::default(),
200-
hCursor: unsafe { LoadCursorW(HINSTANCE(std::ptr::null_mut()), IDC_ARROW).unwrap() },
218+
hCursor: unsafe { LoadCursorW(None, IDC_ARROW).unwrap() },
201219
// No painting; the ring is invisible.
202220
hbrBackground: HBRUSH::default(),
203221
lpszClassName: PCWSTR(class_name.as_ptr()),
@@ -292,7 +310,7 @@ unsafe extern "system" fn helper_window_handle_message(hwnd: HWND, msg: u32, wpa
292310
// Extract the main window's HWND from GWLP_USERDATA that we saved earlier.
293311
let main_ptr = unsafe { GetWindowLongPtrW(hwnd, GWLP_USERDATA) } as *mut std::ffi::c_void;
294312
let main = HWND(main_ptr);
295-
if unsafe { IsWindow(main).as_bool() } {
313+
if unsafe { IsWindow(Some(main)).as_bool() } {
296314
let Some(wmsz) = (unsafe { calculate_resize_direction(hwnd, lparam) }) else {
297315
return LRESULT(0);
298316
};
@@ -301,7 +319,7 @@ unsafe extern "system" fn helper_window_handle_message(hwnd: HWND, msg: u32, wpa
301319
let _ = unsafe { SetForegroundWindow(main) };
302320

303321
// Start sizing on the main window in the calculated direction. (SC_SIZE + WMSZ_*)
304-
let _ = unsafe { PostMessageW(main, WM_SYSCOMMAND, WPARAM((SC_SIZE + wmsz) as usize), lparam) };
322+
let _ = unsafe { PostMessageW(Some(main), WM_SYSCOMMAND, WPARAM((SC_SIZE + wmsz) as usize), lparam) };
305323
}
306324
return LRESULT(0);
307325
}
@@ -325,7 +343,7 @@ unsafe fn position_helper(main: HWND, helper: HWND) {
325343
let w = (r.right - r.left) + RESIZE_BAND_THICKNESS * 2;
326344
let h = (r.bottom - r.top) + RESIZE_BAND_THICKNESS * 2;
327345

328-
let _ = unsafe { SetWindowPos(helper, main, x, y, w, h, SWP_NOACTIVATE | SWP_NOSENDCHANGING) };
346+
let _ = unsafe { SetWindowPos(helper, Some(main), x, y, w, h, SWP_NOACTIVATE | SWP_NOSENDCHANGING) };
329347
}
330348

331349
unsafe fn calculate_hit(helper: HWND, lparam: LPARAM) -> u32 {

0 commit comments

Comments
 (0)