Skip to content

Commit

Permalink
Merge pull request #1165 from Smithay/fix/x11_synthetic_configure
Browse files Browse the repository at this point in the history
xwm: Send synthetic configure event for reparented windows
  • Loading branch information
Drakulix authored Nov 1, 2023
2 parents 60e41f8 + 0c7bf19 commit f4b204e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
38 changes: 33 additions & 5 deletions src/xwayland/xwm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ use x11rb::{
render::{ConnectionExt as _, CreatePictureAux, PictureWrapper},
xfixes::{ConnectionExt as _, SelectionEventMask},
xproto::{
Atom, AtomEnum, ChangeWindowAttributesAux, ConfigWindow, ConfigureWindowAux, ConnectionExt as _,
CreateGCAux, CreateWindowAux, CursorWrapper, EventMask, FontWrapper, GcontextWrapper,
GetPropertyReply, ImageFormat, PixmapWrapper, PropMode, Property, QueryExtensionReply, Screen,
SelectionNotifyEvent, SelectionRequestEvent, StackMode, Window as X11Window, WindowClass,
SELECTION_NOTIFY_EVENT,
Atom, AtomEnum, ChangeWindowAttributesAux, ConfigWindow, ConfigureNotifyEvent,
ConfigureWindowAux, ConnectionExt as _, CreateGCAux, CreateWindowAux, CursorWrapper, EventMask,
FontWrapper, GcontextWrapper, GetPropertyReply, ImageFormat, PixmapWrapper, PropMode, Property,
QueryExtensionReply, Screen, SelectionNotifyEvent, SelectionRequestEvent, StackMode,
Window as X11Window, WindowClass, CONFIGURE_NOTIFY_EVENT, SELECTION_NOTIFY_EVENT,
},
Event,
},
Expand Down Expand Up @@ -2391,3 +2391,31 @@ fn send_selection_notify_resp(
conn.flush()?;
Ok(())
}

fn send_configure_notify(
conn: &RustConnection,
win: &X11Window,
geometry: Rectangle<i32, Logical>,
override_redirect: bool,
) -> Result<(), ConnectionError> {
conn.send_event(
false,
*win,
EventMask::STRUCTURE_NOTIFY,
ConfigureNotifyEvent {
response_type: CONFIGURE_NOTIFY_EVENT,
sequence: 0,
event: *win,
window: *win,
above_sibling: x11rb::NONE,
x: geometry.loc.x as i16,
y: geometry.loc.y as i16,
width: geometry.size.w as u16,
height: geometry.size.h as u16,
border_width: 0,
override_redirect,
},
)?;
conn.flush()?;
Ok(())
}
3 changes: 2 additions & 1 deletion src/xwayland/xwm/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use x11rb::{
wrapper::ConnectionExt,
};

use super::XwmId;
use super::{send_configure_notify, XwmId};

/// X11 window managed by an [`X11Wm`](super::X11Wm)
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -259,6 +259,7 @@ impl X11Surface {
.border_width(0);
conn.configure_window(frame, &aux)?;
conn.configure_window(self.window, &win_aux)?;
send_configure_notify(&conn, &self.window, rect, false)?;
} else {
conn.configure_window(self.window, &aux)?;
}
Expand Down

0 comments on commit f4b204e

Please sign in to comment.