xwm: add X11Surface::is_modal, deprecate is_popup
This commit is contained in:
parent
ba0063fbeb
commit
66fc28b98e
2 changed files with 13 additions and 5 deletions
|
|
@ -425,7 +425,7 @@ pub trait XwmHandler {
|
||||||
fn unfullscreen_request(&mut self, xwm: XwmId, window: X11Surface) {
|
fn unfullscreen_request(&mut self, xwm: XwmId, window: X11Surface) {
|
||||||
let _ = (xwm, window);
|
let _ = (xwm, window);
|
||||||
}
|
}
|
||||||
/// Window requests to be set as a modal dialog (see [`X11Surface::is_popup`]).
|
/// Window requests to be set as a modal dialog (see [`X11Surface::is_modal`]).
|
||||||
fn modal_request(&mut self, xwm: XwmId, window: X11Surface) {
|
fn modal_request(&mut self, xwm: XwmId, window: X11Surface) {
|
||||||
let _ = (xwm, window);
|
let _ = (xwm, window);
|
||||||
}
|
}
|
||||||
|
|
@ -2529,7 +2529,7 @@ where
|
||||||
0 => state.unmodal_request(xwm_id, surface),
|
0 => state.unmodal_request(xwm_id, surface),
|
||||||
1 => state.modal_request(xwm_id, surface),
|
1 => state.modal_request(xwm_id, surface),
|
||||||
2 => {
|
2 => {
|
||||||
if surface.is_popup() {
|
if surface.is_modal() {
|
||||||
state.unmodal_request(xwm_id, surface)
|
state.unmodal_request(xwm_id, surface)
|
||||||
} else {
|
} else {
|
||||||
state.modal_request(xwm_id, surface)
|
state.modal_request(xwm_id, surface)
|
||||||
|
|
|
||||||
|
|
@ -1102,12 +1102,20 @@ impl X11Surface {
|
||||||
self.state.lock().unwrap().opacity
|
self.state.lock().unwrap().opacity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns if the window is a modal dialog.
|
||||||
|
///
|
||||||
|
/// Corresponds to the `_NET_WM_STATE_MODAL` state of the underlying X11 window.
|
||||||
|
pub fn is_modal(&self) -> bool {
|
||||||
|
let state = self.state.lock().unwrap();
|
||||||
|
state.net_state.contains(&self.atoms._NET_WM_STATE_MODAL)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns if the window is considered to be a popup.
|
/// Returns if the window is considered to be a popup.
|
||||||
///
|
///
|
||||||
/// Corresponds to the internal `_NET_WM_STATE_MODAL` state of the underlying X11 window.
|
/// Corresponds to the internal `_NET_WM_STATE_MODAL` state of the underlying X11 window.
|
||||||
|
#[deprecated = "use `X11Surface::is_modal` instead"]
|
||||||
pub fn is_popup(&self) -> bool {
|
pub fn is_popup(&self) -> bool {
|
||||||
let state = self.state.lock().unwrap();
|
self.is_modal()
|
||||||
state.net_state.contains(&self.atoms._NET_WM_STATE_MODAL)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns if the underlying window is transient to another window.
|
/// Returns if the underlying window is transient to another window.
|
||||||
|
|
@ -1365,7 +1373,7 @@ impl X11Surface {
|
||||||
/// Sets the window as a modal dialog or not.
|
/// Sets the window as a modal dialog or not.
|
||||||
///
|
///
|
||||||
/// Corresponds to the `_NET_WM_STATE_MODAL` state, also reflected
|
/// Corresponds to the `_NET_WM_STATE_MODAL` state, also reflected
|
||||||
/// by [`X11Surface::is_popup`].
|
/// by [`X11Surface::is_modal`].
|
||||||
pub fn set_modal(&self, modal: bool) -> Result<(), ConnectionError> {
|
pub fn set_modal(&self, modal: bool) -> Result<(), ConnectionError> {
|
||||||
if modal {
|
if modal {
|
||||||
self.change_net_state(&[self.atoms._NET_WM_STATE_MODAL], &[])?;
|
self.change_net_state(&[self.atoms._NET_WM_STATE_MODAL], &[])?;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue