window: remove now-dead code for x11/wayland
This commit is contained in:
1 parent
1af1c85818
commit
1ca2aeaeb4
2 files changed
+4
-98
No files matched your search
@@ -1,14 +1,12 @@
|
||||
use super::copy_and_paste::*;
|
||||
use super::keyboard::KeyboardEvent;
|
||||
use super::pointer::*;
|
||||
use crate::bitmaps::BitmapImage;
|
||||
use crate::color::Color;
|
||||
use crate::connection::ConnectionOps;
|
||||
use crate::os::wayland::connection::WaylandConnection;
|
||||
use crate::os::xkeysyms::keysym_to_keycode;
|
||||
use crate::{
|
||||
Clipboard, Connection, Dimensions, MouseCursor, Operator, PaintContext, Point, Rect,
|
||||
ScreenPoint, Window, WindowCallbacks, WindowOps, WindowOpsMut,
|
||||
Clipboard, Connection, Dimensions, MouseCursor, Point, ScreenPoint, Window, WindowCallbacks,
|
||||
WindowOps, WindowOpsMut,
|
||||
};
|
||||
use anyhow::{anyhow, bail, Context};
|
||||
use filedescriptor::FileDescriptor;
|
||||
@@ -572,59 +570,6 @@ impl WaylandWindowInner {
|
||||
}
|
||||
}
|
||||
|
||||
struct MmapImage<'a> {
|
||||
mmap: &'a mut memmap::MmapMut,
|
||||
dimensions: (usize, usize),
|
||||
dpi: usize,
|
||||
}
|
||||
|
||||
impl<'a> BitmapImage for MmapImage<'a> {
|
||||
unsafe fn pixel_data(&self) -> *const u8 {
|
||||
self.mmap.as_ptr()
|
||||
}
|
||||
|
||||
unsafe fn pixel_data_mut(&mut self) -> *mut u8 {
|
||||
self.mmap.as_mut_ptr()
|
||||
}
|
||||
|
||||
fn image_dimensions(&self) -> (usize, usize) {
|
||||
self.dimensions
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> PaintContext for MmapImage<'a> {
|
||||
fn clear_rect(&mut self, rect: Rect, color: Color) {
|
||||
BitmapImage::clear_rect(self, rect, color)
|
||||
}
|
||||
|
||||
fn clear(&mut self, color: Color) {
|
||||
BitmapImage::clear(self, color);
|
||||
}
|
||||
|
||||
fn get_dimensions(&self) -> Dimensions {
|
||||
let (pixel_width, pixel_height) = self.image_dimensions();
|
||||
Dimensions {
|
||||
pixel_width,
|
||||
pixel_height,
|
||||
dpi: self.dpi,
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_image(
|
||||
&mut self,
|
||||
dest_top_left: Point,
|
||||
src_rect: Option<Rect>,
|
||||
im: &dyn BitmapImage,
|
||||
operator: Operator,
|
||||
) {
|
||||
BitmapImage::draw_image(self, dest_top_left, src_rect, im, operator)
|
||||
}
|
||||
|
||||
fn draw_line(&mut self, start: Point, end: Point, color: Color, operator: Operator) {
|
||||
BitmapImage::draw_line(self, start, end, color, operator);
|
||||
}
|
||||
}
|
||||
|
||||
impl WindowOps for WaylandWindow {
|
||||
fn close(&self) -> Future<()> {
|
||||
WaylandConnection::with_window_inner(self.0, |inner| {
|
||||
|
||||
@@ -4,9 +4,8 @@ use crate::connection::ConnectionOps;
|
||||
use crate::os::xkeysyms;
|
||||
use crate::os::{Connection, Window};
|
||||
use crate::{
|
||||
Clipboard, Color, Dimensions, MouseButtons, MouseCursor, MouseEvent, MouseEventKind,
|
||||
MousePress, Operator, PaintContext, Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowOps,
|
||||
WindowOpsMut,
|
||||
Clipboard, Dimensions, MouseButtons, MouseCursor, MouseEvent, MouseEventKind, MousePress,
|
||||
Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowOps, WindowOpsMut,
|
||||
};
|
||||
use anyhow::{anyhow, Context as _};
|
||||
use promise::{Future, Promise};
|
||||
@@ -69,44 +68,6 @@ impl Drop for XWindowInner {
|
||||
}
|
||||
}
|
||||
|
||||
struct X11GraphicsContext<'a> {
|
||||
buffer: &'a mut dyn BitmapImage,
|
||||
}
|
||||
|
||||
impl<'a> PaintContext for X11GraphicsContext<'a> {
|
||||
fn clear_rect(&mut self, rect: Rect, color: Color) {
|
||||
self.buffer.clear_rect(rect, color)
|
||||
}
|
||||
|
||||
fn clear(&mut self, color: Color) {
|
||||
self.buffer.clear(color);
|
||||
}
|
||||
|
||||
fn get_dimensions(&self) -> Dimensions {
|
||||
let (pixel_width, pixel_height) = self.buffer.image_dimensions();
|
||||
Dimensions {
|
||||
pixel_width,
|
||||
pixel_height,
|
||||
dpi: crate::DEFAULT_DPI as usize,
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_image(
|
||||
&mut self,
|
||||
dest_top_left: Point,
|
||||
src_rect: Option<Rect>,
|
||||
im: &dyn BitmapImage,
|
||||
operator: Operator,
|
||||
) {
|
||||
self.buffer
|
||||
.draw_image(dest_top_left, src_rect, im, operator)
|
||||
}
|
||||
|
||||
fn draw_line(&mut self, start: Point, end: Point, color: Color, operator: Operator) {
|
||||
self.buffer.draw_line(start, end, color, operator);
|
||||
}
|
||||
}
|
||||
|
||||
impl XWindowInner {
|
||||
fn enable_opengl(&mut self) -> anyhow::Result<()> {
|
||||
let conn = self.conn();
|
||||
|
||||
Reference in new issue
Block a user