Skip to content

Commit

Permalink
set_hash_shadow on macos if is transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed May 29, 2024
1 parent baef0af commit 37eb53d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ console_log = "0.2.2"
bitflags = "2.5.0"
console_error_panic_hook = "0.1.7"
# winit = { path = "../winit", default-features = false, features = ["rwh_06"] }
winit = { git = "https://github.com/raphamorim/winit", rev = "0363111", default-features = false, features = ["rwh_06"] }
winit = { git = "https://github.com/raphamorim/winit", rev = "e6433ca", default-features = false, features = ["rwh_06"] }

[profile.release]
opt-level = 3
Expand Down
33 changes: 7 additions & 26 deletions frontends/rioterm/src/router/window/mod.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
// #[cfg(target_os = "macos")]
// use {
// cocoa::base::{id, NO, YES},
// objc::{msg_send, sel, sel_impl},
// };

// #[cfg(target_os = "macos")]
// use raw_window_handle::HasRawWindowHandle;
// #[cfg(target_os = "macos")]
// use raw_window_handle::RawWindowHandle;
use rio_backend::config::window::{Decorations, WindowMode};
use rio_backend::config::Config;
use std::rc::Rc;
use winit::window::{CursorIcon, Fullscreen, Icon, ImePurpose, Window, WindowAttributes};

pub const LOGO_ICON: &[u8; 410598] = include_bytes!("./resources/images/rio-logo.ico");
// Terminal W/H contraints
pub const DEFAULT_MINIMUM_WINDOW_HEIGHT: i32 = 150;
pub const DEFAULT_MINIMUM_WINDOW_HEIGHT: i32 = 200;
pub const DEFAULT_MINIMUM_WINDOW_WIDTH: i32 = 300;

// #[cfg(target_os = "macos")]
// fn set_has_shadow(window: &Window, has_shadows: bool) {
// let raw_window = match window.raw_window_handle().unwrap() {
// RawWindowHandle::AppKit(handle) => NonNull::from(handle.ns_view).cast() as id,
// _ => return,
// };

// let value = if has_shadows { YES } else { NO };
// unsafe {
// let _: id = msg_send![raw_window, setHasShadow: value];
// }
// }

#[cfg(all(
any(feature = "wayland", feature = "x11"),
not(any(target_os = "macos", windows))
Expand Down Expand Up @@ -165,8 +142,12 @@ pub fn configure_window(winit_window: Window, config: &Rc<Config>) -> Window {

let is_transparent = config.window.background_opacity < 1.;
winit_window.set_transparent(is_transparent);
// #[cfg(target_os = "macos")]
// set_has_shadow(&winit_window, !is_transparent);

#[cfg(target_os = "macos")]
{
use winit::platform::macos::WindowExtMacOS;
winit_window.set_has_shadow(!is_transparent);
}

winit_window.set_blur(config.window.blur);

Expand Down

0 comments on commit 37eb53d

Please sign in to comment.