Add WindowBuilder::with_parent_window (#2548)
* On macOS, add `WindowBuilderExtMacOS::with_parent_window` * Replace Parent with Option<Id<NSWindow, Shared>> * Add addChildWindow method on NSWindow instead * Update with_parent_window to be unsafe fn * Add unified `with_parent_window` * Remove `WindowBuilderExtUnix::with_parent` * Remove `WindowBuilderExtWindows::with_parent_window` * Clean up CI warnings * Update CHANGELOG.md It's `WindowBuilderExtX11` rather than `WindowBuilderExtUnix` * Rename parent to owner * Make with_parent_window unsafe and update its doc * Add another way to get window on mac * Add more documentations * Add match arm and panic on invalid varients * Add Xcb arm * Update child_window example to make it safer and work in i686 * Remove duplicate entry in CHANGELOG.md * Propogate error instead of expect * Replace unreachable to panic * Add platform note to X11 Co-authored-by: Wu Yu Wei <wusyong9104@gmail.com>
This commit is contained in:
parent
8934d2765d
commit
da7422c6e1
13 changed files with 151 additions and 97 deletions
|
|
@ -213,6 +213,9 @@ extern_methods!(
|
|||
|
||||
#[sel(sendEvent:)]
|
||||
pub unsafe fn sendEvent(&self, event: &NSEvent);
|
||||
|
||||
#[sel(addChildWindow:ordered:)]
|
||||
pub unsafe fn addChildWindow(&self, child: &NSWindow, ordered: NSWindowOrderingMode);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -379,3 +382,16 @@ pub enum NSWindowSharingType {
|
|||
unsafe impl Encode for NSWindowSharingType {
|
||||
const ENCODING: Encoding = NSUInteger::ENCODING;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(isize)] // NSInteger
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum NSWindowOrderingMode {
|
||||
NSWindowAbove = 1,
|
||||
NSWindowBelow = -1,
|
||||
NSWindowOut = 0,
|
||||
}
|
||||
|
||||
unsafe impl Encode for NSWindowOrderingMode {
|
||||
const ENCODING: Encoding = NSInteger::ENCODING;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue