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