@@ -2,8 +2,7 @@ use anyhow::{Context, Result}; |
| 2 | use gartk_core::{Color, InputEvent, Key, KeyEvent, Rect, Theme}; | 2 | use gartk_core::{Color, InputEvent, Key, KeyEvent, Rect, Theme}; |
| 3 | use gartk_render::{Renderer, TextStyle, copy_surface_to_window}; | 3 | use gartk_render::{Renderer, TextStyle, copy_surface_to_window}; |
| 4 | use gartk_x11::{ | 4 | use gartk_x11::{ |
| 5 | - Connection, EventLoop, EventLoopConfig, Window, WindowConfig, monitor_at_pointer, | 5 | + Connection, EventLoop, EventLoopConfig, Window, WindowConfig, monitor_of_active_window, |
| 6 | - primary_monitor, | | |
| 7 | }; | 6 | }; |
| 8 | use serde::Deserialize; | 7 | use serde::Deserialize; |
| 9 | use std::collections::HashMap; | 8 | use std::collections::HashMap; |
@@ -559,9 +558,7 @@ impl PromptDialog { |
| 559 | } | 558 | } |
| 560 | | 559 | |
| 561 | fn centered_position(conn: &Connection, width: u32, height: u32) -> (i32, i32) { | 560 | fn centered_position(conn: &Connection, width: u32, height: u32) -> (i32, i32) { |
| 562 | - let monitor = monitor_at_pointer(conn) | 561 | + let monitor = monitor_of_active_window(conn).ok(); |
| 563 | - .or_else(|_| primary_monitor(conn)) | | |
| 564 | - .ok(); | | |
| 565 | if let Some(monitor) = monitor { | 562 | if let Some(monitor) = monitor { |
| 566 | let x = monitor.rect.x + (monitor.rect.width as i32 - width as i32) / 2; | 563 | let x = monitor.rect.x + (monitor.rect.width as i32 - width as i32) / 2; |
| 567 | let y = monitor.rect.y + (monitor.rect.height as i32 - height as i32) / 3; | 564 | let y = monitor.rect.y + (monitor.rect.height as i32 - height as i32) / 3; |