Skip to content

Commit 67b67df

Browse files
committed
Minor fixes
1 parent 61f80e0 commit 67b67df

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/x11/event_loop.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl EventLoop {
4949
// the same.
5050
// NOTE: x11rb uses calloop under the hood, so that won't be an issue anymore once we switch to
5151
// it
52-
pub fn run(&mut self) {
52+
pub fn run(&mut self) -> Result<(), Box<dyn Error>> {
5353
use nix::poll::*;
5454

5555
let xcb_fd = self.window.xcb_connection.file_descriptor();
@@ -74,7 +74,7 @@ impl EventLoop {
7474

7575
// Check for any events in the internal buffers
7676
// before going to sleep:
77-
self.drain_xcb_events();
77+
self.drain_xcb_events()?;
7878

7979
// FIXME: handle errors
8080
poll(&mut fds, next_frame.duration_since(Instant::now()).subsec_millis() as i32)
@@ -86,7 +86,7 @@ impl EventLoop {
8686
}
8787

8888
if revents.contains(PollFlags::POLLIN) {
89-
self.drain_xcb_events();
89+
self.drain_xcb_events()?;
9090
}
9191
}
9292

@@ -107,6 +107,8 @@ impl EventLoop {
107107
self.handle_must_close();
108108
}
109109
}
110+
111+
Ok(())
110112
}
111113

112114
fn handle_close_requested(&mut self) {

src/x11/window.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::cell::Cell;
44
use std::error::Error;
5-
use std::rc::{Rc, Weak};
5+
use std::rc::Rc;
66
use std::sync::mpsc;
77
use std::thread;
88

@@ -100,7 +100,7 @@ impl Window {
100100

101101
window_shared.x11_window.show(&window_shared.xcb_connection)?;
102102

103-
EventLoop::new(window_shared, handler, handle_receiver).run();
103+
EventLoop::new(window_shared, handler, handle_receiver).run()?;
104104
Ok(())
105105
}
106106

@@ -123,7 +123,7 @@ impl Window {
123123
}
124124

125125
#[cfg(feature = "opengl")]
126-
pub fn gl_context(&self) -> Option<Weak<crate::gl::platform::GlContext>> {
126+
pub fn gl_context(&self) -> Option<std::rc::Weak<crate::gl::platform::GlContext>> {
127127
self.x11_window.gl_context()
128128
}
129129

src/x11/x11_window.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::x11::xcb_connection::XcbConnection;
33
use crate::{MouseCursor, Size, WindowInfo, WindowOpenOptions, WindowScalePolicy};
44
use raw_window_handle::XcbWindowHandle;
55
use std::error::Error;
6-
use std::rc::{Rc, Weak};
76
use x11rb::connection::Connection;
87
use x11rb::protocol::xproto::{
98
AtomEnum, ChangeWindowAttributesAux, ConfigureWindowAux, ConnectionExt, CreateGCAux,
@@ -20,7 +19,7 @@ pub(crate) struct X11Window {
2019
_graphics_context: Gcontext,
2120

2221
#[cfg(feature = "opengl")]
23-
gl_context: Option<Rc<crate::gl::x11::GlContext>>,
22+
gl_context: Option<std::rc::Rc<crate::gl::x11::GlContext>>,
2423
}
2524

2625
impl X11Window {
@@ -86,7 +85,7 @@ impl X11Window {
8685
gl_context: None,
8786
};
8887

89-
created_window.set_title(connection, &options.title);
88+
created_window.set_title(connection, &options.title)?;
9089

9190
// Register protocols
9291
connection.conn2.change_property32(
@@ -180,6 +179,7 @@ fn create_graphics_context(
180179
#[cfg(feature = "opengl")]
181180
const _: () = {
182181
use crate::gl::platform::GlContext;
182+
use std::rc::{Rc, Weak};
183183

184184
use std::ffi::c_ulong;
185185

0 commit comments

Comments
 (0)