aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/x11')
-rw-r--r--src/api/x11/monitor.rs2
-rw-r--r--src/api/x11/window.rs18
-rw-r--r--src/api/x11/xdisplay.rs4
3 files changed, 23 insertions, 1 deletions
diff --git a/src/api/x11/monitor.rs b/src/api/x11/monitor.rs
index 90b12c2..0a20b63 100644
--- a/src/api/x11/monitor.rs
+++ b/src/api/x11/monitor.rs
@@ -15,6 +15,7 @@ pub fn get_available_monitors(x: &Arc<XConnection>) -> VecDeque<MonitorID> {
monitors
}
+#[inline]
pub fn get_primary_monitor(x: &Arc<XConnection>) -> MonitorID {
let primary_monitor = unsafe { (x.xlib.XDefaultScreen)(x.display) };
MonitorID(x.clone(), primary_monitor as u32)
@@ -26,6 +27,7 @@ impl MonitorID {
Some(format!("Monitor #{}", screen_num))
}
+ #[inline]
pub fn get_native_identifier(&self) -> NativeMonitorId {
NativeMonitorId::Numeric(self.1)
}
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs
index 3032bfd..2da226f 100644
--- a/src/api/x11/window.rs
+++ b/src/api/x11/window.rs
@@ -613,6 +613,7 @@ impl Window {
}
}
+ #[inline]
pub fn get_position(&self) -> Option<(i32, i32)> {
self.get_geometry().map(|(x, y, _, _, _)| (x, y))
}
@@ -621,45 +622,53 @@ impl Window {
unsafe { (self.x.display.xlib.XMoveWindow)(self.x.display.display, self.x.window, x as libc::c_int, y as libc::c_int); }
}
+ #[inline]
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
self.get_geometry().map(|(_, _, w, h, _)| (w, h))
}
+ #[inline]
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
self.get_geometry().map(|(_, _, w, h, b)| (w + b, h + b)) // TODO: is this really outside?
}
+ #[inline]
pub fn set_inner_size(&self, x: u32, y: u32) {
unsafe { (self.x.display.xlib.XResizeWindow)(self.x.display.display, self.x.window, x as libc::c_uint, y as libc::c_uint); }
}
+ #[inline]
pub fn create_window_proxy(&self) -> WindowProxy {
WindowProxy {
data: self.x.window_proxy_data.clone()
}
}
+ #[inline]
pub fn poll_events(&self) -> PollEventsIterator {
PollEventsIterator {
window: self
}
}
+ #[inline]
pub fn wait_events(&self) -> WaitEventsIterator {
WaitEventsIterator {
window: self
}
}
+ #[inline]
pub fn platform_display(&self) -> *mut libc::c_void {
self.x.display.display as *mut libc::c_void
}
+ #[inline]
pub fn platform_window(&self) -> *mut libc::c_void {
self.x.window as *mut libc::c_void
}
-
+ #[inline]
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
@@ -754,6 +763,7 @@ impl Window {
}
}
+ #[inline]
pub fn hidpi_factor(&self) -> f32 {
1.0
}
@@ -768,6 +778,7 @@ impl Window {
}
impl GlContext for Window {
+ #[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.make_current(),
@@ -776,6 +787,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn is_current(&self) -> bool {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.is_current(),
@@ -784,6 +796,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.get_proc_address(addr),
@@ -792,6 +805,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn swap_buffers(&self) -> Result<(), ContextError> {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.swap_buffers(),
@@ -800,6 +814,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn get_api(&self) -> Api {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.get_api(),
@@ -808,6 +823,7 @@ impl GlContext for Window {
}
}
+ #[inline]
fn get_pixel_format(&self) -> PixelFormat {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.get_pixel_format(),
diff --git a/src/api/x11/xdisplay.rs b/src/api/x11/xdisplay.rs
index 2aa5d95..2b77d9c 100644
--- a/src/api/x11/xdisplay.rs
+++ b/src/api/x11/xdisplay.rs
@@ -98,6 +98,7 @@ impl XConnection {
}
impl Drop for XConnection {
+ #[inline]
fn drop(&mut self) {
unsafe { (self.xlib.XCloseDisplay)(self.display) };
}
@@ -113,12 +114,14 @@ pub enum XNotSupported {
}
impl From<ffi::OpenError> for XNotSupported {
+ #[inline]
fn from(err: ffi::OpenError) -> XNotSupported {
XNotSupported::LibraryOpenError(err)
}
}
impl Error for XNotSupported {
+ #[inline]
fn description(&self) -> &str {
match *self {
XNotSupported::LibraryOpenError(_) => "Failed to load one of xlib's shared libraries",
@@ -126,6 +129,7 @@ impl Error for XNotSupported {
}
}
+ #[inline]
fn cause(&self) -> Option<&Error> {
match *self {
XNotSupported::LibraryOpenError(ref err) => Some(err),