Skip to content

Commit

Permalink
[awm2] Model window resized message
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Dec 3, 2022
1 parent 97aff76 commit e711203
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions rust_programs/awm_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,23 @@ pub struct AwmCloseWindow {
impl ExpectsEventField for AwmCloseWindow {
const EXPECTED_EVENT: u32 = 814;
}

#[repr(C)]
#[derive(Debug, Clone, Copy, ContainsEventField)]
pub struct AwmWindowResized {
event: u32,
pub new_size: SizeU32,
}

impl AwmWindowResized {
pub fn new(size: Size) -> Self {
Self {
event: Self::EXPECTED_EVENT,
new_size: SizeU32::from(size),
}
}
}

impl ExpectsEventField for AwmWindowResized {
const EXPECTED_EVENT: u32 = 808;
}
1 change: 1 addition & 0 deletions rust_programs/libgui/src/window_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ impl ExpectsEventField for MouseScrolled {

impl AwmWindowEvent for MouseScrolled {}

// TODO(PT): Drop this in favor of the version in awm_messages
#[repr(C)]
#[derive(Debug, Clone, Copy, ContainsEventField)]
pub struct WindowResized {
Expand Down

0 comments on commit e711203

Please sign in to comment.