mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
app/internal/wm: use Option method to initialize windows
Added (*w.window).Option methods to the backends and use them for setting the initial options passed into NewWindow. Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
@@ -191,7 +191,9 @@ CFTypeRef gio_createWindow(CFTypeRef viewRef, const char *title, CGFloat width,
|
||||
window.contentMaxSize = NSMakeSize(maxWidth, maxHeight);
|
||||
}
|
||||
[window setAcceptsMouseMovedEvents:YES];
|
||||
window.title = [NSString stringWithUTF8String: title];
|
||||
if (title != nil) {
|
||||
window.title = [NSString stringWithUTF8String: title];
|
||||
}
|
||||
NSView *view = (__bridge NSView *)viewRef;
|
||||
[window setContentView:view];
|
||||
[window makeFirstResponder:view];
|
||||
@@ -206,6 +208,27 @@ void gio_close(CFTypeRef windowRef) {
|
||||
[window performClose:nil];
|
||||
}
|
||||
|
||||
void gio_setSize(CFTypeRef windowRef, CGFloat width, CGFloat height) {
|
||||
NSWindow* window = (__bridge NSWindow *)windowRef;
|
||||
NSSize size = NSMakeSize(width, height);
|
||||
[window setContentSize:size];
|
||||
}
|
||||
|
||||
void gio_setMinSize(CFTypeRef windowRef, CGFloat width, CGFloat height) {
|
||||
NSWindow* window = (__bridge NSWindow *)windowRef;
|
||||
window.contentMinSize = NSMakeSize(width, height);
|
||||
}
|
||||
|
||||
void gio_setMaxSize(CFTypeRef windowRef, CGFloat width, CGFloat height) {
|
||||
NSWindow* window = (__bridge NSWindow *)windowRef;
|
||||
window.contentMaxSize = NSMakeSize(width, height);
|
||||
}
|
||||
|
||||
void gio_setTitle(CFTypeRef windowRef, const char *title) {
|
||||
NSWindow* window = (__bridge NSWindow *)windowRef;
|
||||
window.title = [NSString stringWithUTF8String: title];
|
||||
}
|
||||
|
||||
@implementation GioAppDelegate
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
[[NSRunningApplication currentApplication] activateWithOptions:(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
|
||||
|
||||
Reference in New Issue
Block a user