state: Move Xwayland state into shell
This commit is contained in:
parent
41a69cfc9f
commit
c09a735289
8 changed files with 21 additions and 13 deletions
|
|
@ -592,7 +592,7 @@ where
|
|||
.render::<R>(
|
||||
renderer,
|
||||
&state.shell.override_redirect_windows,
|
||||
state.xwayland_state.as_mut(),
|
||||
state.shell.xwayland_state.as_mut(),
|
||||
(!move_active && is_active_space).then_some(&last_active_seat),
|
||||
overview.clone(),
|
||||
resize_indicator.clone(),
|
||||
|
|
@ -650,7 +650,7 @@ where
|
|||
.render::<R>(
|
||||
renderer,
|
||||
&state.shell.override_redirect_windows,
|
||||
state.xwayland_state.as_mut(),
|
||||
state.shell.xwayland_state.as_mut(),
|
||||
(!move_active && is_active_space).then_some(&last_active_seat),
|
||||
overview,
|
||||
resize_indicator,
|
||||
|
|
|
|||
|
|
@ -1838,6 +1838,7 @@ impl State {
|
|||
let wayland_display = self.common.socket.clone();
|
||||
let display = self
|
||||
.common
|
||||
.shell
|
||||
.xwayland_state
|
||||
.as_ref()
|
||||
.map(|s| format!(":{}", s.display))
|
||||
|
|
|
|||
|
|
@ -82,7 +82,13 @@ pub fn setup_socket(handle: LoopHandle<State>, state: &State) -> Result<()> {
|
|||
.into_string()
|
||||
.map_err(|_| anyhow!("wayland socket is no valid utf-8 string?"))?,
|
||||
);
|
||||
if let Some(display) = state.common.xwayland_state.as_ref().map(|s| s.display) {
|
||||
if let Some(display) = state
|
||||
.common
|
||||
.shell
|
||||
.xwayland_state
|
||||
.as_ref()
|
||||
.map(|s| s.display)
|
||||
{
|
||||
env.insert(String::from("DISPLAY"), format!(":{}", display));
|
||||
}
|
||||
let message = serde_json::to_string(&Message::SetEnv { variables: env })
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ use crate::{
|
|||
},
|
||||
},
|
||||
},
|
||||
xwayland::XWaylandState,
|
||||
};
|
||||
|
||||
pub mod element;
|
||||
|
|
@ -188,6 +189,7 @@ pub struct Shell {
|
|||
pub xdg_shell_state: XdgShellState,
|
||||
pub xdg_activation_state: XdgActivationState,
|
||||
pub workspace_state: WorkspaceState<State>,
|
||||
pub xwayland_state: Option<XWaylandState>,
|
||||
|
||||
theme: cosmic::Theme,
|
||||
overview_mode: OverviewMode,
|
||||
|
|
@ -1022,6 +1024,7 @@ impl Shell {
|
|||
xdg_shell_state,
|
||||
xdg_activation_state,
|
||||
workspace_state,
|
||||
xwayland_state: None,
|
||||
|
||||
theme,
|
||||
overview_mode: OverviewMode::None,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ use crate::{
|
|||
screencopy::{BufferParams, ScreencopyState, Session as ScreencopySession},
|
||||
workspace::WorkspaceClientState,
|
||||
},
|
||||
xwayland::XWaylandState,
|
||||
};
|
||||
use anyhow::Context;
|
||||
use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_manager_v1::CursorMode;
|
||||
|
|
@ -170,9 +169,6 @@ pub struct Common {
|
|||
pub viewporter_state: ViewporterState,
|
||||
pub kde_decoration_state: KdeDecorationState,
|
||||
pub xdg_decoration_state: XdgDecorationState,
|
||||
|
||||
// xwayland state
|
||||
pub xwayland_state: Option<XWaylandState>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -421,8 +417,6 @@ impl State {
|
|||
wl_drm_state,
|
||||
kde_decoration_state,
|
||||
xdg_decoration_state,
|
||||
|
||||
xwayland_state: None,
|
||||
},
|
||||
backend: BackendData::Unset,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ pub fn ready(state: &State) {
|
|||
"DISPLAY",
|
||||
&state
|
||||
.common
|
||||
.shell
|
||||
.xwayland_state
|
||||
.as_ref()
|
||||
.map(|s| format!(":{}", s.display))
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ impl SelectionHandler for State {
|
|||
) {
|
||||
if let Some(xwm) = self
|
||||
.common
|
||||
.shell
|
||||
.xwayland_state
|
||||
.as_mut()
|
||||
.and_then(|xstate| xstate.xwm.as_mut())
|
||||
|
|
@ -44,6 +45,7 @@ impl SelectionHandler for State {
|
|||
) {
|
||||
if let Some(xwm) = self
|
||||
.common
|
||||
.shell
|
||||
.xwayland_state
|
||||
.as_mut()
|
||||
.and_then(|xstate| xstate.xwm.as_mut())
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ pub struct XWaylandState {
|
|||
|
||||
impl State {
|
||||
pub fn launch_xwayland(&mut self, render_node: Option<DrmNode>) {
|
||||
if self.common.xwayland_state.is_some() {
|
||||
if self.common.shell.xwayland_state.is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -90,11 +90,11 @@ impl State {
|
|||
);
|
||||
}
|
||||
|
||||
let xwayland_state = data.common.xwayland_state.as_mut().unwrap();
|
||||
let xwayland_state = data.common.shell.xwayland_state.as_mut().unwrap();
|
||||
xwayland_state.xwm = Some(wm);
|
||||
}
|
||||
XWaylandEvent::Exited => {
|
||||
if let Some(mut xwayland_state) = data.common.xwayland_state.take() {
|
||||
if let Some(mut xwayland_state) = data.common.shell.xwayland_state.take() {
|
||||
xwayland_state.xwm = None;
|
||||
}
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ impl State {
|
|||
},
|
||||
) {
|
||||
Ok(display) => {
|
||||
self.common.xwayland_state = Some(XWaylandState {
|
||||
self.common.shell.xwayland_state = Some(XWaylandState {
|
||||
xwayland,
|
||||
xwm: None,
|
||||
display,
|
||||
|
|
@ -136,6 +136,7 @@ impl State {
|
|||
impl XwmHandler for State {
|
||||
fn xwm_state(&mut self, _xwm: XwmId) -> &mut X11Wm {
|
||||
self.common
|
||||
.shell
|
||||
.xwayland_state
|
||||
.as_mut()
|
||||
.and_then(|state| state.xwm.as_mut())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue