1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

window: remove ConfigBridge on x11/wayland

This commit is contained in:
Wez Furlong 2021-03-23 22:11:41 -07:00
parent b876fbabd6
commit e294123215
4 changed files with 21 additions and 21 deletions

View File

@ -4,12 +4,12 @@ use super::pointer::*;
use crate::connection::ConnectionOps;
use crate::os::wayland::connection::WaylandConnection;
use crate::os::xkeysyms::keysym_to_keycode;
use crate::WindowConfigHandle;
use crate::{
Clipboard, Connection, Dimensions, MouseCursor, Point, ScreenPoint, Window, WindowCallbacks,
WindowOps, WindowOpsMut,
};
use anyhow::{anyhow, bail, Context};
use config::ConfigHandle;
use filedescriptor::FileDescriptor;
use promise::{Future, Promise};
use smithay_client_toolkit as toolkit;
@ -167,7 +167,7 @@ impl WaylandWindow {
width: usize,
height: usize,
callbacks: Box<dyn WindowCallbacks>,
_config: Option<&WindowConfigHandle>,
_config: Option<&ConfigHandle>,
) -> anyhow::Result<Window> {
let conn = WaylandConnection::get()
.ok_or_else(|| {

View File

@ -329,7 +329,7 @@ impl XConnection {
let depth_bpp = depth.depth();
if depth_bpp == 24 || depth_bpp == 32 {
for vis in depth.visuals() {
if vis.class() == xcb::xproto::VISUAL_CLASS_TRUE_COLOR as _
if vis.class() == xcb::xproto::VISUAL_CLASS_TRUE_COLOR as u8
&& vis.bits_per_rgb_value() == 8
{
visuals.push((depth_bpp, vis));

View File

@ -3,12 +3,12 @@ use crate::bitmaps::*;
use crate::connection::ConnectionOps;
use crate::os::xkeysyms;
use crate::os::{Connection, Window};
use crate::WindowConfigHandle;
use crate::{
Clipboard, Dimensions, MouseButtons, MouseCursor, MouseEvent, MouseEventKind, MousePress,
Point, Rect, ScreenPoint, Size, WindowCallbacks, WindowDecorations, WindowOps, WindowOpsMut,
};
use anyhow::{anyhow, Context as _};
use config::ConfigHandle;
use promise::{Future, Promise};
use std::any::Any;
use std::collections::VecDeque;
@ -58,7 +58,7 @@ pub(crate) struct XWindowInner {
paint_all: bool,
cursors: CursorInfo,
copy_and_paste: CopyAndPaste,
config: WindowConfigHandle,
config: ConfigHandle,
gl_state: Option<Rc<glium::backend::Context>>,
}
@ -546,7 +546,7 @@ impl XWindowInner {
xcb::ClientMessageData::from_data32(data),
),
);
self.adjust_decorations(self.config.decorations())?;
self.adjust_decorations(self.config.window_decorations)?;
Ok(())
}
@ -635,11 +635,11 @@ impl XWindow {
width: usize,
height: usize,
callbacks: Box<dyn WindowCallbacks>,
config: Option<&WindowConfigHandle>,
config: Option<&ConfigHandle>,
) -> anyhow::Result<Window> {
let config = match config {
Some(c) => Arc::clone(c),
None => crate::config(),
Some(c) => c.clone(),
None => config::configuration(),
};
let conn = Connection::get()
.ok_or_else(|| {
@ -720,7 +720,7 @@ impl XWindow {
copy_and_paste: CopyAndPaste::default(),
cursors: CursorInfo::new(&conn),
gl_state: None,
config: Arc::clone(&config),
config: config.clone(),
}))
};
@ -742,7 +742,7 @@ impl XWindow {
window
.lock()
.unwrap()
.adjust_decorations(config.decorations())?;
.adjust_decorations(config.window_decorations)?;
let window_handle = Window::X11(XWindow::from_id(window_id));
@ -783,9 +783,9 @@ impl WindowOpsMut for XWindowInner {
self.set_fullscreen_hint(!fullscreen).ok();
}
fn config_did_change(&mut self, config: &WindowConfigHandle) {
self.config = Arc::clone(config);
let _ = self.adjust_decorations(config.decorations());
fn config_did_change(&mut self, config: &ConfigHandle) {
self.config = config.clone();
let _ = self.adjust_decorations(config.window_decorations);
}
fn set_inner_size(&mut self, width: usize, height: usize) {
@ -870,8 +870,8 @@ impl WindowOps for XWindow {
})
}
fn config_did_change(&self, config: &WindowConfigHandle) -> Future<()> {
let config = Arc::clone(config);
fn config_did_change(&self, config: &ConfigHandle) -> Future<()> {
let config = config.clone();
XConnection::with_window_inner(self.0, move |inner| {
inner.config_did_change(&config);
Ok(())

View File

@ -7,8 +7,8 @@ use crate::os::wayland::connection::WaylandConnection;
use crate::os::wayland::window::WaylandWindow;
use crate::os::x11::connection::XConnection;
use crate::os::x11::window::XWindow;
use crate::WindowConfigHandle;
use crate::{Clipboard, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps};
use config::ConfigHandle;
use promise::*;
use std::any::Any;
use std::rc::Rc;
@ -30,7 +30,7 @@ impl Connection {
pub(crate) fn create_new() -> anyhow::Result<Connection> {
#[cfg(feature = "wayland")]
{
if crate::config().enable_wayland() {
if config::configuration().enable_wayland {
match WaylandConnection::create_new() {
Ok(w) => {
log::debug!("Using wayland connection!");
@ -52,7 +52,7 @@ impl Connection {
width: usize,
height: usize,
callbacks: Box<dyn WindowCallbacks>,
config: Option<&WindowConfigHandle>,
config: Option<&ConfigHandle>,
) -> anyhow::Result<Window> {
match self {
Self::X11(_) => XWindow::new_window(class_name, name, width, height, callbacks, config),
@ -112,7 +112,7 @@ impl Window {
width: usize,
height: usize,
callbacks: Box<dyn WindowCallbacks>,
config: Option<&WindowConfigHandle>,
config: Option<&ConfigHandle>,
) -> anyhow::Result<Window> {
Connection::get()
.unwrap()
@ -145,7 +145,7 @@ impl WindowOps for Window {
}
}
fn config_did_change(&self, config: &WindowConfigHandle) -> Future<()> {
fn config_did_change(&self, config: &ConfigHandle) -> Future<()> {
match self {
Self::X11(x) => x.config_did_change(config),
#[cfg(feature = "wayland")]