Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/cycle_state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::window_manager::{EveWindow, WindowManager};
use crate::window_manager::{EveWindow, WindowId, WindowManager};
use anyhow::Result;
use std::time::{Duration, Instant};

Expand Down Expand Up @@ -247,7 +247,7 @@ impl CycleState {
.is_some_and(|t| t.elapsed() < ACTIVATION_GRACE)
}

pub fn sync_with_active(&mut self, active_window: u32) {
pub fn sync_with_active(&mut self, active_window: WindowId) {
// Within the grace window after our own activation, the compositor's
// reported active window may still be the *previous* one — its focus
// commit is asynchronous. Trust `current_index` rather than rewinding
Expand Down Expand Up @@ -347,7 +347,7 @@ impl CycleState {
mod tests {
use super::*;

fn create_test_window(id: u32, title: &str) -> EveWindow {
fn create_test_window(id: WindowId, title: &str) -> EveWindow {
EveWindow {
id,
title: title.to_string(),
Expand Down Expand Up @@ -505,7 +505,7 @@ mod tests {

// Mock WindowManager for testing switch_to
struct MockWindowManager {
activated_windows: std::sync::Mutex<Vec<u32>>,
activated_windows: std::sync::Mutex<Vec<WindowId>>,
}

impl MockWindowManager {
Expand All @@ -515,7 +515,7 @@ mod tests {
}
}

fn get_activated(&self) -> Vec<u32> {
fn get_activated(&self) -> Vec<WindowId> {
self.activated_windows.lock().unwrap().clone()
}
}
Expand All @@ -525,7 +525,7 @@ mod tests {
Ok(vec![])
}

fn activate_window(&self, window_id: u32) -> anyhow::Result<()> {
fn activate_window(&self, window_id: WindowId) -> anyhow::Result<()> {
self.activated_windows.lock().unwrap().push(window_id);
Ok(())
}
Expand All @@ -538,15 +538,15 @@ mod tests {
Ok(())
}

fn get_active_window(&self) -> anyhow::Result<u32> {
fn get_active_window(&self) -> anyhow::Result<WindowId> {
Ok(0)
}

fn minimize_window(&self, _window_id: u32) -> anyhow::Result<()> {
fn minimize_window(&self, _window_id: WindowId) -> anyhow::Result<()> {
Ok(())
}

fn restore_window(&self, _window_id: u32) -> anyhow::Result<()> {
fn restore_window(&self, _window_id: WindowId) -> anyhow::Result<()> {
Ok(())
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/preview_windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::cycle_state::CycleState;
use crate::preview_common::{
preview_should_hide, snap_position, DragRect, DragState, DRAG_THRESHOLD_PX, SNAP_THRESHOLD_PX,
};
use crate::window_manager::WindowManager;
use crate::window_manager::{WindowId, WindowManager};
use crate::windows_manager::{hwnd_to_id, id_to_hwnd};
use anyhow::{Context, Result};
use std::collections::HashMap;
Expand Down Expand Up @@ -167,7 +167,7 @@ use crate::preview_positions::PreviewPositions;
/// State for a single preview window. The pointer is stored in the
/// window's GWLP_USERDATA so the wnd_proc can recover it.
struct PreviewWindowState {
source_id: u32,
source_id: WindowId,
character_name: String,
thumbnail: Hthumbnail,
wm: Arc<dyn WindowManager>,
Expand All @@ -184,7 +184,7 @@ struct PreviewWindowState {
/// One owned preview window. Drop unregisters the DWM thumbnail.
struct OwnedPreview {
hwnd: HWND,
source_id: u32,
source_id: WindowId,
/// Mirror of `PreviewWindowState.is_active` kept here so reconcile
/// can detect changes without dereferencing the GWLP_USERDATA pointer
/// on every tick.
Expand Down Expand Up @@ -232,7 +232,7 @@ struct PreviewManager {
list: Option<OwnedListWindow>,
/// Most recent foreground EVE window id. Used by the list window's
/// paint callback to decide which row to highlight.
active_id: u32,
active_id: WindowId,
/// Names rendered in the list window on the previous reconcile, in
/// order. Used to detect changes (add/remove/reorder) so we only
/// invalidate when something actually shifted — calling
Expand Down Expand Up @@ -607,7 +607,7 @@ impl PreviewManager {
/// focuses a non-EVE app, then presses F11, the cycle would step
/// from wherever we last cycled to (say A) instead of from B,
/// looking like "cycle skipped a client."
fn update_active(&mut self, active_id: u32) {
fn update_active(&mut self, active_id: WindowId) {
self.state.lock().unwrap().sync_with_active(active_id);

for preview in self.previews.values_mut() {
Expand Down
Loading
Loading