gardesk/garcard / 855c0c2

Browse files

use monitor_of_active_window for prompt placement

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
855c0c238b828fa6fe744aa54edb05c8ce01ddb5
Parents
57d75fe
Tree
7d34f69

1 changed file

StatusFile+-
M garcard/src/prompt_ui.rs 2 5
garcard/src/prompt_ui.rsmodified
@@ -2,8 +2,7 @@ use anyhow::{Context, Result};
22
 use gartk_core::{Color, InputEvent, Key, KeyEvent, Rect, Theme};
33
 use gartk_render::{Renderer, TextStyle, copy_surface_to_window};
44
 use gartk_x11::{
5
-    Connection, EventLoop, EventLoopConfig, Window, WindowConfig, monitor_at_pointer,
6
-    primary_monitor,
5
+    Connection, EventLoop, EventLoopConfig, Window, WindowConfig, monitor_of_active_window,
76
 };
87
 use serde::Deserialize;
98
 use std::collections::HashMap;
@@ -559,9 +558,7 @@ impl PromptDialog {
559558
 }
560559
 
561560
 fn centered_position(conn: &Connection, width: u32, height: u32) -> (i32, i32) {
562
-    let monitor = monitor_at_pointer(conn)
563
-        .or_else(|_| primary_monitor(conn))
564
-        .ok();
561
+    let monitor = monitor_of_active_window(conn).ok();
565562
     if let Some(monitor) = monitor {
566563
         let x = monitor.rect.x + (monitor.rect.width as i32 - width as i32) / 2;
567564
         let y = monitor.rect.y + (monitor.rect.height as i32 - height as i32) / 3;