Commit f851dca2 authored by Jeremy Soller's avatar Jeremy Soller

HiDPI support

parent 183e1a72
Pipeline #5879 failed with stage
in 1 minute and 22 seconds
......@@ -4,7 +4,6 @@ use std::{cmp, mem, ptr};
use std::collections::BTreeSet;
use std::io::Result;
use BLOCK_WIDTH;
use config::Config;
use orbclient::{Color, EventOption, Mode, Renderer, Window, WindowFlag};
use orbfont::Font;
......@@ -34,6 +33,8 @@ pub struct Console {
pub requested: usize,
pub block_width: usize,
pub block_height: usize,
pub default_block_width: usize,
pub default_block_height: usize,
pub alpha: u8,
pub selection: Option<(usize, usize)>,
pub last_selection: Option<(usize, usize)>,
......@@ -89,6 +90,8 @@ impl Console {
requested: 0,
block_width,
block_height,
default_block_width: block_width,
default_block_height: block_height,
alpha,
selection: None,
last_selection: None,
......@@ -127,7 +130,8 @@ impl Console {
} else if key_event.pressed {
match key_event.scancode {
orbclient::K_0 if self.ctrl => { // Ctrl-0 reset block size
self.set_block_size(BLOCK_WIDTH);
self.block_width = self.default_block_width;
self.block_height = self.default_block_height;
let w = self.window.width() as usize / self.block_width;
let h = self.window.height() as usize / self.block_height;
......
......@@ -36,8 +36,8 @@ mod getpty;
mod handle;
mod slave_stdio;
const BLOCK_WIDTH: usize = 8;
const BLOCK_HEIGHT: usize = BLOCK_WIDTH * 2;
const BLOCK_WIDTH: u32 = 8;
const BLOCK_HEIGHT: u32 = BLOCK_WIDTH * 2;
fn main() {
#[cfg(feature = "env_logger")]
......@@ -89,8 +89,14 @@ fn main() {
drop(slave_stdout);
drop(slave_stdin);
let mut console = Console::new(&config, columns * BLOCK_WIDTH as u32, lines * BLOCK_HEIGHT as u32,
BLOCK_WIDTH, BLOCK_HEIGHT);
let scale = (display_height / 1600) + 1;
let (block_width, block_height) = (BLOCK_WIDTH * scale, BLOCK_HEIGHT * scale);
let mut console = Console::new(
&config,
columns * block_width as u32, lines * block_height as u32,
block_width as usize, block_height as usize
);
handle(&mut console, master_fd, &mut process);
},
Err(err) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment