diff --git a/src/backend/glutin.rs b/src/backend/glutin.rs index 456fb68..18cf3f7 100644 --- a/src/backend/glutin.rs +++ b/src/backend/glutin.rs @@ -261,7 +261,7 @@ impl GlutinInputBackend { if let Some(ref mut handler) = self.handler { match event { - Event::KeyboardInput(state, key_code/*TODO: Is this really the keycode? glutins docs don't tell*/, _) => handler.on_keyboard_key(&self.seat, self.time_counter, key_code as u32, state.into(), 1), + Event::KeyboardInput(state, key_code, _) => handler.on_keyboard_key(&self.seat, self.time_counter, key_code as u32, state.into(), 1), Event::MouseMoved(x, y) => handler.on_pointer_move(&self.seat, self.time_counter, (x as u32, y as u32)), Event::MouseWheel(delta, _) => match delta { MouseScrollDelta::LineDelta(x, y) => { diff --git a/src/backend/graphics/opengl.rs b/src/backend/graphics/opengl.rs index e29521b..5d41694 100644 --- a/src/backend/graphics/opengl.rs +++ b/src/backend/graphics/opengl.rs @@ -20,6 +20,7 @@ pub enum SwapBuffersError { /// The buffers have already been swapped. /// /// This error can be returned when `swap_buffers` has been called multiple times + /// without any modification in between. AlreadySwapped, } @@ -38,23 +39,23 @@ pub enum Api { /// Describes the pixel format of the main framebuffer #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct PixelFormat { - /// Is the format hardware accelerated + /// is the format hardware accelerated pub hardware_accelerated: bool, - /// bits used for colors + /// number of bits used for colors pub color_bits: u8, - /// bits used for alpha channel + /// number of bits used for alpha channel pub alpha_bits: u8, - /// bits used for depth channel + /// number of bits used for depth channel pub depth_bits: u8, - /// bits used for stencil buffer + /// number of bits used for stencil buffer pub stencil_bits: u8, /// is stereoscopy enabled pub stereoscopy: bool, /// is double buffering enabled pub double_buffer: bool, - /// multisampling format used if enabled + /// number of samples used for multisampling if enabled pub multisampling: Option, - /// if the format has srgb enabled + /// is srgb enabled pub srgb: bool, } @@ -70,13 +71,20 @@ pub trait OpenglRenderer /// Supposes that the context has been made current before this function is called. unsafe fn get_proc_address(&self, symbol: &str) -> *const c_void; - /// Returns the dimensions of the window, or screen, etc. + /// Returns the dimensions of the window, or screen, etc in points. + /// + /// That are the scaled pixels of the underlying graphics backend. + /// For nested compositors this will respect the scaling of the root compositor. + /// For drawing directly onto hardware this unit will be equal to actual pixels. fn get_framebuffer_dimensions(&self) -> (u32, u32); /// Returns true if the OpenGL context is the current one in the thread. fn is_current(&self) -> bool; /// Makes the OpenGL context the current context in the current thread. + /// + /// This function is marked unsafe, because the context cannot be made current + /// on multiple threads. unsafe fn make_current(&self); /// Returns the OpenGL API being used. diff --git a/src/backend/input.rs b/src/backend/input.rs index d5712f4..9306e0d 100644 --- a/src/backend/input.rs +++ b/src/backend/input.rs @@ -187,13 +187,13 @@ pub trait InputHandler { /// - `time` - A upward counting variable useful for event ordering. Makes no gurantees about actual time passed between events. /// - `key_code` - Code of the pressed key. See linux/input-event-codes.h /// - `state` - `KeyState` of the event - /// - `count` - Amount of key presses registered + /// - `count` - Total number of keys pressed on all devices on the associated `Seat` /// /// # TODO: /// - check if events can arrive out of order. /// - Make stronger time guarantees fn on_keyboard_key(&mut self, seat: &Seat, time: u32, key_code: u32, state: KeyState, count: u32); - /// Called when a new keyboard event was received. + /// Called when a new pointer movement event was received. /// /// # Arguments /// @@ -205,7 +205,7 @@ pub trait InputHandler { /// - check if events can arrive out of order. /// - Make stronger time guarantees fn on_pointer_move(&mut self, seat: &Seat, time: u32, to: (u32, u32)); - /// Called when a new keyboard event was received. + /// Called when a new pointer button event was received. /// /// # Arguments /// @@ -218,7 +218,7 @@ pub trait InputHandler { /// - check if events can arrive out of order. /// - Make stronger time guarantees fn on_pointer_button(&mut self, seat: &Seat, time: u32, button: MouseButton, state: MouseButtonState); - /// Called when a new keyboard event was received. + /// Called when a new pointer scroll event was received. /// /// # Arguments /// @@ -232,7 +232,7 @@ pub trait InputHandler { /// - check if events can arrive out of order. /// - Make stronger time guarantees fn on_pointer_scroll(&mut self, seat: &Seat, time: u32, axis: Axis, source: AxisSource, amount: f64); - /// Called when a new keyboard event was received. + /// Called when a new touch event was received. /// /// # Arguments ///