Skip to content

Commit

Permalink
Fixed bit depth
Browse files Browse the repository at this point in the history
  • Loading branch information
mbwilding committed Jan 29, 2024
1 parent 61f1a0b commit c345c3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/csharp/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Screen {

unsafe { GetMonitorInfoW(HMONITOR(monitor), ptr::addr_of!(info) as *mut MONITORINFO) };

device_name.push_str(&String::from_utf16_lossy(&info.szDevice));
device_name.push_str(String::from_utf16_lossy(&info.szDevice).trim_end_matches('\0'));
bounds = Rectangle::from(info.monitorInfo.rcMonitor);
primary = (info.monitorInfo.dwFlags & MONITORINFOF_PRIMARY) != 0;

Expand All @@ -71,9 +71,9 @@ impl Screen {
}
}

if let Some(hdc) = hdc {
bit_depth = unsafe { GetDeviceCaps(hdc, BITSPIXEL) };
bit_depth *= unsafe { GetDeviceCaps(hdc, PLANES) };
if let Some(screen_dc) = screen_dc {
bit_depth = unsafe { GetDeviceCaps(screen_dc, BITSPIXEL) };
bit_depth *= unsafe { GetDeviceCaps(screen_dc, PLANES) };
}

if hdc != screen_dc {
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod windows_manager;
mod windows_window;
mod workspace;

use crate::csharp::screen::Screen;
use crate::layout_engines::LayoutEngine;
use eframe::egui;
use log::{debug, info};
Expand All @@ -27,6 +28,8 @@ fn main() -> eframe::Result<()> {
info!("Starting Tile-RS");
single::check();

println!("{:#?}", Screen::all_screens());

let native_options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default()
.with_inner_size([1280.0, 720.0])
Expand Down

0 comments on commit c345c3c

Please sign in to comment.