Port X11 backend to the EVL2.0 API (#842)
* Fix compilation on Linux. * x11: port to evl2 with stubs * x11: Implement run_return using calloop * wayland/x11: Make ControlFlow::Exit sticky * x11: Send LoopDestroyed on exit * x11: Fix RedrawRequested semandics * wayland: Fix RedrawRequested semandics * x11/wayland: reduce code duplication for sticky callback
This commit is contained in:
parent
2253565db5
commit
94f998af0a
12 changed files with 2411 additions and 2301 deletions
1010
src/platform_impl/linux/x11/event_processor.rs
Normal file
1010
src/platform_impl/linux/x11/event_processor.rs
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@ use std::os::raw::*;
|
|||
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use {PhysicalPosition, PhysicalSize};
|
||||
use dpi::{PhysicalPosition, PhysicalSize};
|
||||
use super::{util, XConnection, XError};
|
||||
use super::ffi::{
|
||||
RRCrtcChangeNotifyMask,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::cmp;
|
||||
|
||||
use super::*;
|
||||
use {LogicalPosition, LogicalSize};
|
||||
use dpi::{LogicalPosition, LogicalSize};
|
||||
|
||||
// Friendly neighborhood axis-aligned rectangle
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use {Icon, Pixel, PIXEL_SIZE};
|
||||
use window::{Icon, Pixel, PIXEL_SIZE};
|
||||
use super::*;
|
||||
|
||||
impl Pixel {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::str;
|
||||
|
||||
use super::*;
|
||||
use events::ModifiersState;
|
||||
use event::ModifiersState;
|
||||
|
||||
pub const VIRTUAL_CORE_POINTER: c_int = 2;
|
||||
pub const VIRTUAL_CORE_KEYBOARD: c_int = 3;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::{env, slice};
|
||||
use std::str::FromStr;
|
||||
|
||||
use validate_hidpi_factor;
|
||||
use dpi::validate_hidpi_factor;
|
||||
use super::*;
|
||||
|
||||
pub fn calc_dpi_factor(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use std::{cmp, env, mem};
|
||||
use std::collections::HashSet;
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::*;
|
||||
use std::path::Path;
|
||||
|
|
@ -7,15 +8,15 @@ use std::sync::Arc;
|
|||
use libc;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use {Icon, MouseCursor, WindowAttributes};
|
||||
use CreationError::{self, OsError};
|
||||
use window::{Icon, MouseCursor, WindowAttributes};
|
||||
use window::CreationError::{self, OsError};
|
||||
use dpi::{LogicalPosition, LogicalSize};
|
||||
use platform_impl::MonitorHandle as PlatformMonitorHandle;
|
||||
use platform_impl::PlatformSpecificWindowBuilderAttributes;
|
||||
use platform_impl::x11::MonitorHandle as X11MonitorHandle;
|
||||
use window::MonitorHandle as RootMonitorHandle;
|
||||
use monitor::MonitorHandle as RootMonitorHandle;
|
||||
|
||||
use super::{ffi, util, ImeSender, XConnection, XError, WindowId, EventLoop};
|
||||
use super::{ffi, util, ImeSender, XConnection, XError, WindowId, EventLoopWindowTarget};
|
||||
|
||||
unsafe extern "C" fn visibility_predicate(
|
||||
_display: *mut ffi::Display,
|
||||
|
|
@ -66,11 +67,12 @@ pub struct UnownedWindow {
|
|||
ime_sender: Mutex<ImeSender>,
|
||||
pub multitouch: bool, // never changes
|
||||
pub shared_state: Mutex<SharedState>,
|
||||
pending_redraws: Arc<::std::sync::Mutex<HashSet<WindowId>>>,
|
||||
}
|
||||
|
||||
impl UnownedWindow {
|
||||
pub fn new(
|
||||
event_loop: &EventLoop,
|
||||
pub fn new<T>(
|
||||
event_loop: &EventLoopWindowTarget<T>,
|
||||
window_attrs: WindowAttributes,
|
||||
pl_attribs: PlatformSpecificWindowBuilderAttributes,
|
||||
) -> Result<UnownedWindow, CreationError> {
|
||||
|
|
@ -203,6 +205,7 @@ impl UnownedWindow {
|
|||
ime_sender: Mutex::new(event_loop.ime_sender.clone()),
|
||||
multitouch: window_attrs.multitouch,
|
||||
shared_state: SharedState::new(dpi_factor),
|
||||
pending_redraws: event_loop.pending_redraws.clone(),
|
||||
};
|
||||
|
||||
// Title must be set before mapping. Some tiling window managers (i.e. i3) use the window
|
||||
|
|
@ -1210,4 +1213,9 @@ impl UnownedWindow {
|
|||
|
||||
#[inline]
|
||||
pub fn id(&self) -> WindowId { WindowId(self.xwindow) }
|
||||
|
||||
#[inline]
|
||||
pub fn request_redraw(&self) {
|
||||
self.pending_redraws.lock().unwrap().insert(WindowId(self.xwindow));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue