Skip to content

Commit

Permalink
revert extension change for WindowLong
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlie Davis committed Jun 17, 2024
1 parent fb4675f commit 78a1ac4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
26 changes: 11 additions & 15 deletions crates/libs/bindgen/src/rust/extensions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ use super::*;

/// Helper function for `gen_mod` and `gen_impl`.
///
/// This function generates an `include!(...)` that points into the
/// `src/includes` directory for the `windows` and `windows-sys`
/// crates. This is no longer needed, but is preserved in case it is
/// needed again in the future.
/// This function generates an `include!(...)` that points into the `src/includes` directory for
/// the `windows` and `windows-sys` crates. This makes it easy to inject code into WinMD namespaces.
#[allow(dead_code)]
fn include_ext(relative_path: &str) -> TokenStream {
quote! {
Expand All @@ -20,19 +18,17 @@ fn include_ext(relative_path: &str) -> TokenStream {
}

/// Generates extension code for a specific namespace
///
/// This function allows us to inject code into modules generated by bindgen.
/// This feature is no longer needed but is preserved in case it is needed
/// again in the future.
pub fn gen_mod(_writer: &Writer, _namespace: &str) -> TokenStream {
TokenStream::new()
pub fn gen_mod(_writer: &Writer, namespace: &str) -> TokenStream {
match namespace {
"Windows.Win32.UI.WindowsAndMessaging" => {
include_ext("Win32/UI/WindowsAndMessaging/WindowLong.rs")
}

_ => quote!(),
}
}

/// Generates implementation extension code for a specific namespace
///
/// This function allows us to inject code into modules generated by bindgen.
/// This feature is no longer needed but is preserved in case it is needed
/// again in the future.
/// Generates extension code that is subject to the `implement` feature for a specific namespace
pub fn gen_impl(_namespace: &str) -> TokenStream {
TokenStream::new()
}
Original file line number Diff line number Diff line change
Expand Up @@ -3752,3 +3752,4 @@ pub type SENDASYNCPROC = Option<unsafe extern "system" fn(param0: super::super::
pub type TIMERPROC = Option<unsafe extern "system" fn(param0: super::super::Foundation::HWND, param1: u32, param2: usize, param3: u32)>;
pub type WNDENUMPROC = Option<unsafe extern "system" fn(param0: super::super::Foundation::HWND, param1: super::super::Foundation::LPARAM) -> super::super::Foundation::BOOL>;
pub type WNDPROC = Option<unsafe extern "system" fn(param0: super::super::Foundation::HWND, param1: u32, param2: super::super::Foundation::WPARAM, param3: super::super::Foundation::LPARAM) -> super::super::Foundation::LRESULT>;
core::include!(core::concat!(core::env!("CARGO_MANIFEST_DIR"), "/src/includes/", "Win32/UI/WindowsAndMessaging/WindowLong.rs"));
Original file line number Diff line number Diff line change
Expand Up @@ -9426,3 +9426,4 @@ pub type SENDASYNCPROC = Option<unsafe extern "system" fn(param0: super::super::
pub type TIMERPROC = Option<unsafe extern "system" fn(param0: super::super::Foundation::HWND, param1: u32, param2: usize, param3: u32)>;
pub type WNDENUMPROC = Option<unsafe extern "system" fn(param0: super::super::Foundation::HWND, param1: super::super::Foundation::LPARAM) -> super::super::Foundation::BOOL>;
pub type WNDPROC = Option<unsafe extern "system" fn(param0: super::super::Foundation::HWND, param1: u32, param2: super::super::Foundation::WPARAM, param3: super::super::Foundation::LPARAM) -> super::super::Foundation::LRESULT>;
core::include!(core::concat!(core::env!("CARGO_MANIFEST_DIR"), "/src/includes/", "Win32/UI/WindowsAndMessaging/WindowLong.rs"));

0 comments on commit 78a1ac4

Please sign in to comment.