-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gdk4-macos: manually implement native_window method
For now we need to depend on the cocoa crate in order to implement this method since it is the only decent crate implementing the cocoa api.
- Loading branch information
Showing
8 changed files
with
175 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
#[cfg(feature = "v4_8")] | ||
use crate::ffi; | ||
#[cfg(not(feature = "v4_8"))] | ||
use crate::prelude::*; | ||
use crate::{id, MacosSurface}; | ||
#[cfg(feature = "v4_8")] | ||
use glib::translate::*; | ||
#[cfg(not(feature = "v4_8"))] | ||
use std::ffi::c_void; | ||
|
||
impl MacosSurface { | ||
#[doc(alias = "gdk_macos_surface_get_native_window")] | ||
#[doc(alias = "get_native_window")] | ||
pub fn native(&self) -> id { | ||
#[cfg(feature = "v4_8")] | ||
unsafe { | ||
let native_window_ptr = ffi::gdk_macos_surface_get_native_window(self.to_glib_none().0); | ||
native_window_ptr as id | ||
} | ||
|
||
#[cfg(not(feature = "v4_8"))] | ||
{ | ||
let native_window_ptr: *mut c_void = ObjectExt::property(self, "native"); | ||
native_window_ptr as id | ||
} | ||
} | ||
} |