This commit is contained in:
Conrad Irwin 2024-06-17 15:30:19 -06:00
parent 49c7c8cc86
commit 28bdc3ad66
5 changed files with 55 additions and 5 deletions

View File

@ -6,6 +6,7 @@ rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"]
xtask = "run --package xtask --"
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

View File

@ -23,7 +23,7 @@ impl Render for HelloWorld {
fn main() {
App::new().run(|cx: &mut AppContext| {
let bounds = Bounds::centered(None, size(px(600.0), px(600.0)), cx);
let bounds = Bounds::new(Point::new(px(14.0), px(49.0)), size(px(300.0), px(300.0)));
cx.open_window(
WindowOptions {
window_bounds: Some(WindowBounds::Windowed(bounds)),

View File

@ -466,6 +466,17 @@ impl X11Client {
}
fn handle_event(&self, event: Event) -> Option<()> {
match event {
Event::XinputMotion(_) => {}
Event::Expose(_) | Event::XkbStateNotify(_) => {}
Event::MapNotify(map_notify) => {
println!("MapNotify: {:?}", map_notify);
}
Event::ConfigureNotify(configure_notify) => {
println!("ConfigureNotify: {:?}", configure_notify);
}
_ => println!("{:?}", event),
}
match event {
Event::ClientMessage(event) => {
let window = self.get_window(event.window)?;
@ -481,6 +492,9 @@ impl X11Client {
}
}
}
Event::ReparentNotify(event) => {
dbg!(event.x, event.y);
}
Event::ConfigureNotify(event) => {
let bounds = Bounds {
origin: Point {
@ -492,6 +506,7 @@ impl X11Client {
height: event.height.into(),
},
};
dbg!(bounds);
let window = self.get_window(event.window)?;
window.configure(bounds);
}

View File

@ -267,6 +267,7 @@ impl X11WindowState {
| xproto::EventMask::KEY_RELEASE,
);
dbg!(params.bounds);
xcb_connection
.create_window(
visual.depth,
@ -358,10 +359,31 @@ impl X11WindowState {
.map_err(|e| anyhow::anyhow!("{:?}", e))?,
);
let message = ClientMessageEvent::new(
32,
x_window,
atoms._NET_WM_STATE,
[
1,
atoms._NET_WM_STATE_MAXIMIZED_VERT,
atoms._NET_WM_STATE_MAXIMIZED_HORZ,
atoms._NET_WM_STATE_FULLSCREEN,
0,
],
);
xcb_connection
.send_event(
false,
visual_set.root,
EventMask::SUBSTRUCTURE_REDIRECT | EventMask::SUBSTRUCTURE_NOTIFY,
message,
)
.unwrap();
let config = BladeSurfaceConfig {
// Note: this has to be done after the GPU init, or otherwise
// the sizes are immediately invalidated.
size: query_render_extent(xcb_connection, x_window),
size: dbg!(query_render_extent(xcb_connection, x_window)),
transparent: params.window_background != WindowBackgroundAppearance::Opaque,
};
xcb_connection.map_window(x_window).unwrap();
@ -426,8 +448,8 @@ impl Drop for X11Window {
}
enum WmHintPropertyState {
// Remove = 0,
// Add = 1,
Remove = 0,
Add = 1,
Toggle = 2,
}
@ -931,6 +953,7 @@ impl PlatformWindow for X11Window {
fn show_window_menu(&self, position: Point<Pixels>) {
let state = self.0.state.borrow();
let coords = self.get_root_position(position);
dbg!(coords.dst_x, coords.dst_y);
let message = ClientMessageEvent::new(
32,
self.0.x_window,

View File

@ -988,6 +988,17 @@ impl Workspace {
(None, None)
}
};
dbg!(window_bounds, display);
let window_bounds = Some(WindowBounds::Windowed(Bounds {
origin: Point {
x: px(14.),
y: px(49.),
},
size: Size {
width: px(1717.),
height: px(928.),
},
}));
// Use the serialized workspace to construct the new window
let mut options = cx.update(|cx| (app_state.build_window_options)(display, cx))?;
@ -3721,7 +3732,7 @@ impl Workspace {
if let Some(location) = location {
let center_group = build_serialized_pane_group(&self.center.root, cx);
let docks = build_serialized_docks(self, cx);
let window_bounds = Some(SerializedWindowBounds(cx.window_bounds()));
let window_bounds = Some(SerializedWindowBounds(dbg!(cx.window_bounds())));
let serialized_workspace = SerializedWorkspace {
id: database_id,
location,