Skip to content

Commit

Permalink
fix window frame in maximized view on windows & linux
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Jan 23, 2024
1 parent 856c376 commit 324a4de
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
4 changes: 1 addition & 3 deletions core/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,7 @@ impl eframe::App for Core {

impl Core {
fn render_frame(&mut self, ctx: &Context, frame: &mut eframe::Frame) {
let is_fullscreen = ctx.input(|i| i.viewport().fullscreen.unwrap_or(false));

window_frame(self.window_frame && !is_fullscreen, ctx, "Kaspa NG", |ui| {
window_frame(self.window_frame, ctx, "Kaspa NG", |ui| {
if !self.settings.initialized {
egui::CentralPanel::default().show_inside(ui, |ui| {
self.modules
Expand Down
2 changes: 1 addition & 1 deletion core/src/egui/theme/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl ThemeColor {
block_dag_block_fill_color: Color32::from_rgb(201, 230, 240),
block_dag_block_stroke_color: Color32::from_rgb(42, 51, 50),
block_dag_vspc_connect_color: Color32::from_rgb(11, 77, 70),
block_dag_parent_connect_color: Color32::from_rgba_premultiplied(0, 0, 0, 80),
block_dag_parent_connect_color: Color32::from_rgba_premultiplied(0, 0, 0, 72),
}
}
}
Expand Down
28 changes: 25 additions & 3 deletions core/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,36 @@ pub fn window_frame(
title: &str,
add_contents: impl FnOnce(&mut egui::Ui),
) {
if enable {
let (is_fullscreen, is_maximized) = ctx.input(|i| {
let viewport = i.viewport();
(
viewport.fullscreen.unwrap_or(false),
viewport.maximized.unwrap_or(false),
)
});

cfg_if! {
if #[cfg(target_os = "macos")] {
let hide = is_fullscreen;
} else {
let hide = false;
}
}

if enable && !hide {
let mut stroke = ctx.style().visuals.widgets.noninteractive.fg_stroke;
// stroke.width = 0.5;
stroke.width = 1.0;

let rounding = if is_fullscreen || is_maximized {
0.0.into()
} else {
10.0.into()
};

let panel_frame = egui::Frame {
fill: ctx.style().visuals.window_fill(),
rounding: 10.0.into(),
rounding,
stroke,
// stroke: ctx.style().visuals.widgets.noninteractive.fg_stroke,
outer_margin: 0.5.into(), // so the stroke is within the bounds
Expand All @@ -22,7 +44,7 @@ pub fn window_frame(

let outline_frame = egui::Frame {
// fill: ctx.style().visuals.window_fill(),
rounding: 10.0.into(),
rounding,
stroke,
// stroke: ctx.style().visuals.widgets.noninteractive.fg_stroke,
outer_margin: 0.5.into(), // so the stroke is within the bounds
Expand Down
11 changes: 6 additions & 5 deletions resources/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"fi": "Finnish",
"fa": "Farsi",
"vi": "Vietnamese",
"pa": "Panjabi",
"fil": "Filipino",
"lt": "Lithuanian",
"nl": "Dutch",
"sv": "Swedish",
"es": "Español",
"uk": "Ukrainian",
"pa": "Panjabi",
"af": "Afrikaans",
"et": "Esti",
"en": "English",
Expand Down Expand Up @@ -67,8 +67,8 @@
"lt": {},
"nl": {},
"sv": {},
"es": {},
"uk": {},
"es": {},
"af": {},
"et": {},
"en": {
Expand Down Expand Up @@ -137,6 +137,7 @@
"p2p Rx/s": "p2p Rx/s",
"Theme Color": "Theme Color",
"Remote Connection:": "Remote Connection:",
"Capture a screenshot": "Capture a screenshot",
"Difficulty": "Difficulty",
"Uptime:": "Uptime:",
"Small (10 BPS)": "Small (10 BPS)",
Expand All @@ -153,13 +154,12 @@
"Please note, copying to clipboard carries a risk of exposing your mnemonic to malware.": "Please note, copying to clipboard carries a risk of exposing your mnemonic to malware.",
"No public node selected - please select a public node": "No public node selected - please select a public node",
"Resulting daemon arguments:": "Resulting daemon arguments:",
"Network": "Network",
"Time Offset:": "Time Offset:",
"Market Monitor": "Market Monitor",
"Unlock Wallet": "Unlock Wallet",
"Wallet Encryption Password": "Wallet Encryption Password",
"Network": "Network",
"Please note that this is an alpha release. Until this message is removed, avoid using this software with mainnet funds.": "Please note that this is an alpha release. Until this message is removed, avoid using this software with mainnet funds.",
"Capture a screenshot": "Capture a screenshot",
"You are currently not connected to the Kaspa node.": "You are currently not connected to the Kaspa node.",
"Dependencies": "Dependencies",
"Active p2p Peers": "Active p2p Peers",
Expand Down Expand Up @@ -198,6 +198,7 @@
"1 BPS test network": "1 BPS test network",
"No peers": "No peers",
"Enter account name (optional)": "Enter account name (optional)",
"peer": "peer",
"Total Tx": "Total Tx",
"Peers": "Peers",
"Processed Transactions": "Processed Transactions",
Expand Down Expand Up @@ -260,8 +261,8 @@
"Database Blocks": "Database Blocks",
"Not Connected": "Not Connected",
"Use all available system memory": "Use all available system memory",
"Headers": "Headers",
"Address:": "Address:",
"Headers": "Headers",
"Custom": "Custom",
"Mainnet (Main Kaspa network)": "Mainnet (Main Kaspa network)",
"Please enter the wallet secret": "Please enter the wallet secret",
Expand Down

0 comments on commit 324a4de

Please sign in to comment.