Skip to content

Commit

Permalink
feat: expose raw gdk monitor (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
Legend-Master authored Nov 18, 2024
1 parent 88f0b41 commit 6b49f55
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/gdk-monitor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

Expose raw gdk monitor through `MonitorHandleExtUnix::gdk_monitor`
14 changes: 14 additions & 0 deletions src/platform/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub use crate::platform_impl::EventLoop as UnixEventLoop;
use crate::{
error::{ExternalError, OsError},
event_loop::{EventLoopBuilder, EventLoopWindowTarget},
monitor::MonitorHandle,
platform_impl::{x11::xdisplay::XError, Parent, Window as UnixWindow},
window::{Window, WindowBuilder},
};
Expand Down Expand Up @@ -282,3 +283,16 @@ unsafe extern "C" fn x_error_callback(
// Fun fact: this return value is completely ignored.
0
}

/// Additional methods on `MonitorHandle` that are specific to Unix.
pub trait MonitorHandleExtUnix {
/// Returns the gdk handle of the monitor.
fn gdk_monitor(&self) -> &gtk::gdk::Monitor;
}

impl MonitorHandleExtUnix for MonitorHandle {
#[inline]
fn gdk_monitor(&self) -> &gtk::gdk::Monitor {
&self.inner.monitor
}
}

0 comments on commit 6b49f55

Please sign in to comment.