Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NSWindow and NSWindowDelegate methods #25

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions MACHWindowDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

@interface MACHWindowDelegate : NSObject
@end

@implementation MACHWindowDelegate {
void (^_windowWillResize_toSize_block)(NSSize);
}

- (void)setBlock_windowWillResize_toSize:(void (^)(NSSize))windowWillResize_toSize_block __attribute__((objc_direct)) {
_windowWillResize_toSize_block = windowWillResize_toSize_block;
}

- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize {
if (self->_windowWillResize_toSize_block) self->_windowWillResize_toSize_block(frameSize);
return frameSize;
}
@end
185 changes: 185 additions & 0 deletions MACHWindowDelegate_arm64_apple_macos12.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 12, 0
.private_extern "-[MACHWindowDelegate setBlock_windowWillResize_toSize:]"
.globl "-[MACHWindowDelegate setBlock_windowWillResize_toSize:]"
.p2align 2
"-[MACHWindowDelegate setBlock_windowWillResize_toSize:]":
.cfi_startproc
cbz x0, LBB0_2
stp x20, x19, [sp, #-32]!
stp x29, x30, [sp, #16]
.cfi_def_cfa_offset 32
.cfi_offset w30, -8
.cfi_offset w29, -16
.cfi_offset w19, -24
.cfi_offset w20, -32
mov x19, x0
mov x0, x1
bl _objc_retainBlock
ldr x8, [x19, #8]
ldp x29, x30, [sp, #16]
mov x9, x0
mov x0, x8
str x9, [x19, #8]
ldp x20, x19, [sp], #32
b _objc_release
LBB0_2:
ret
.cfi_endproc

.p2align 2
"-[MACHWindowDelegate windowWillResize:toSize:]":
.cfi_startproc
stp d9, d8, [sp, #-32]!
stp x29, x30, [sp, #16]
.cfi_def_cfa_offset 32
.cfi_offset w30, -8
.cfi_offset w29, -16
.cfi_offset b8, -24
.cfi_offset b9, -32
fmov d8, d1
fmov d9, d0
ldr x0, [x0, #8]
cbz x0, LBB1_2
fmov d0, d9
fmov d1, d8
ldr x8, [x0, #16]
blr x8
LBB1_2:
ldp x29, x30, [sp, #16]
fmov d0, d9
fmov d1, d8
ldp d9, d8, [sp], #32
ret
.cfi_endproc

.p2align 2
"-[MACHWindowDelegate .cxx_destruct]":
.cfi_startproc
add x0, x0, #8
mov x1, xzr
b _objc_storeStrong
.cfi_endproc

.section __TEXT,__objc_classname,cstring_literals
l_OBJC_CLASS_NAME_:
.asciz "MACHWindowDelegate"

.section __DATA,__objc_const
.p2align 3, 0x0
__OBJC_METACLASS_RO_$_MACHWindowDelegate:
.long 389
.long 40
.long 40
.space 4
.quad 0
.quad l_OBJC_CLASS_NAME_
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0

.section __DATA,__objc_data
.globl _OBJC_METACLASS_$_MACHWindowDelegate
.p2align 3, 0x0
_OBJC_METACLASS_$_MACHWindowDelegate:
.quad _OBJC_METACLASS_$_NSObject
.quad _OBJC_METACLASS_$_NSObject
.quad __objc_empty_cache
.quad 0
.quad __OBJC_METACLASS_RO_$_MACHWindowDelegate

.section __TEXT,__objc_classname,cstring_literals
l_OBJC_CLASS_NAME_.1:
.asciz "\001"

.section __TEXT,__objc_methname,cstring_literals
l_OBJC_METH_VAR_NAME_:
.asciz "windowWillResize:toSize:"

.section __TEXT,__objc_methtype,cstring_literals
l_OBJC_METH_VAR_TYPE_:
.asciz "{CGSize=dd}40@0:8@16{CGSize=dd}24"

.section __TEXT,__objc_methname,cstring_literals
l_OBJC_METH_VAR_NAME_.2:
.asciz ".cxx_destruct"

.section __TEXT,__objc_methtype,cstring_literals
l_OBJC_METH_VAR_TYPE_.3:
.asciz "v16@0:8"

.section __DATA,__objc_const
.p2align 3, 0x0
__OBJC_$_INSTANCE_METHODS_MACHWindowDelegate:
.long 24
.long 2
.quad l_OBJC_METH_VAR_NAME_
.quad l_OBJC_METH_VAR_TYPE_
.quad "-[MACHWindowDelegate windowWillResize:toSize:]"
.quad l_OBJC_METH_VAR_NAME_.2
.quad l_OBJC_METH_VAR_TYPE_.3
.quad "-[MACHWindowDelegate .cxx_destruct]"

.private_extern _OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block
.section __DATA,__objc_ivar
.globl _OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block
.p2align 2, 0x0
_OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block:
.long 8

.section __TEXT,__objc_methname,cstring_literals
l_OBJC_METH_VAR_NAME_.4:
.asciz "_windowWillResize_toSize_block"

.section __TEXT,__objc_methtype,cstring_literals
l_OBJC_METH_VAR_TYPE_.5:
.asciz "@?"

.section __DATA,__objc_const
.p2align 3, 0x0
__OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate:
.long 32
.long 1
.quad _OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block
.quad l_OBJC_METH_VAR_NAME_.4
.quad l_OBJC_METH_VAR_TYPE_.5
.long 3
.long 8

.p2align 3, 0x0
__OBJC_CLASS_RO_$_MACHWindowDelegate:
.long 388
.long 8
.long 16
.space 4
.quad l_OBJC_CLASS_NAME_.1
.quad l_OBJC_CLASS_NAME_
.quad __OBJC_$_INSTANCE_METHODS_MACHWindowDelegate
.quad 0
.quad __OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate
.quad 0
.quad 0

.section __DATA,__objc_data
.globl _OBJC_CLASS_$_MACHWindowDelegate
.p2align 3, 0x0
_OBJC_CLASS_$_MACHWindowDelegate:
.quad _OBJC_METACLASS_$_MACHWindowDelegate
.quad _OBJC_CLASS_$_NSObject
.quad __objc_empty_cache
.quad 0
.quad __OBJC_CLASS_RO_$_MACHWindowDelegate

.section __DATA,__objc_classlist,regular,no_dead_strip
.p2align 3, 0x0
l_OBJC_LABEL_CLASS_$:
.quad _OBJC_CLASS_$_MACHWindowDelegate

.section __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
.long 0
.long 64

.subsections_via_symbols
177 changes: 177 additions & 0 deletions MACHWindowDelegate_x86_64_apple_macos12.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 12, 0
.private_extern "-[MACHWindowDelegate setBlock_windowWillResize_toSize:]"
.globl "-[MACHWindowDelegate setBlock_windowWillResize_toSize:]"
"-[MACHWindowDelegate setBlock_windowWillResize_toSize:]":
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
testq %rdi, %rdi
je LBB0_1
movq %rdi, %rbx
movq %rsi, %rdi
callq _objc_retainBlock
movq 8(%rbx), %rdi
movq %rax, 8(%rbx)
popq %rbx
jmpq *_objc_release@GOTPCREL(%rip)
LBB0_1:
popq %rbx
retq
.cfi_endproc

"-[MACHWindowDelegate windowWillResize:toSize:]":

.cfi_startproc
movq 8(%rdi), %rdi
testq %rdi, %rdi
je LBB1_2
subq $24, %rsp
.cfi_def_cfa_offset 32
movsd %xmm0, 8(%rsp)
movsd 8(%rsp), %xmm0

movsd %xmm1, 16(%rsp)
movsd 16(%rsp), %xmm1

callq *16(%rdi)
movsd 8(%rsp), %xmm0

movsd 16(%rsp), %xmm1

addq $24, %rsp
LBB1_2:
retq
.cfi_endproc

"-[MACHWindowDelegate .cxx_destruct]":

.cfi_startproc
addq $8, %rdi
xorl %esi, %esi
jmp _objc_storeStrong
.cfi_endproc

.section __TEXT,__objc_classname,cstring_literals
L_OBJC_CLASS_NAME_:
.asciz "MACHWindowDelegate"

.section __DATA,__objc_const
.p2align 3, 0x0
__OBJC_METACLASS_RO_$_MACHWindowDelegate:
.long 389
.long 40
.long 40
.space 4
.quad 0
.quad L_OBJC_CLASS_NAME_
.quad 0
.quad 0
.quad 0
.quad 0
.quad 0

.section __DATA,__objc_data
.globl _OBJC_METACLASS_$_MACHWindowDelegate
.p2align 3, 0x0
_OBJC_METACLASS_$_MACHWindowDelegate:
.quad _OBJC_METACLASS_$_NSObject
.quad _OBJC_METACLASS_$_NSObject
.quad __objc_empty_cache
.quad 0
.quad __OBJC_METACLASS_RO_$_MACHWindowDelegate

.section __TEXT,__objc_classname,cstring_literals
L_OBJC_CLASS_NAME_.1:
.asciz "\001"

.section __TEXT,__objc_methname,cstring_literals
L_OBJC_METH_VAR_NAME_:
.asciz "windowWillResize:toSize:"

.section __TEXT,__objc_methtype,cstring_literals
L_OBJC_METH_VAR_TYPE_:
.asciz "{CGSize=dd}40@0:8@16{CGSize=dd}24"

.section __TEXT,__objc_methname,cstring_literals
L_OBJC_METH_VAR_NAME_.2:
.asciz ".cxx_destruct"

.section __TEXT,__objc_methtype,cstring_literals
L_OBJC_METH_VAR_TYPE_.3:
.asciz "v16@0:8"

.section __DATA,__objc_const
.p2align 3, 0x0
__OBJC_$_INSTANCE_METHODS_MACHWindowDelegate:
.long 24
.long 2
.quad L_OBJC_METH_VAR_NAME_
.quad L_OBJC_METH_VAR_TYPE_
.quad "-[MACHWindowDelegate windowWillResize:toSize:]"
.quad L_OBJC_METH_VAR_NAME_.2
.quad L_OBJC_METH_VAR_TYPE_.3
.quad "-[MACHWindowDelegate .cxx_destruct]"

.private_extern _OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block
.section __DATA,__objc_ivar
.globl _OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block
.p2align 3, 0x0
_OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block:
.quad 8

.section __TEXT,__objc_methname,cstring_literals
L_OBJC_METH_VAR_NAME_.4:
.asciz "_windowWillResize_toSize_block"

.section __TEXT,__objc_methtype,cstring_literals
L_OBJC_METH_VAR_TYPE_.5:
.asciz "@?"

.section __DATA,__objc_const
.p2align 3, 0x0
__OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate:
.long 32
.long 1
.quad _OBJC_IVAR_$_MACHWindowDelegate._windowWillResize_toSize_block
.quad L_OBJC_METH_VAR_NAME_.4
.quad L_OBJC_METH_VAR_TYPE_.5
.long 3
.long 8

.p2align 3, 0x0
__OBJC_CLASS_RO_$_MACHWindowDelegate:
.long 388
.long 8
.long 16
.space 4
.quad L_OBJC_CLASS_NAME_.1
.quad L_OBJC_CLASS_NAME_
.quad __OBJC_$_INSTANCE_METHODS_MACHWindowDelegate
.quad 0
.quad __OBJC_$_INSTANCE_VARIABLES_MACHWindowDelegate
.quad 0
.quad 0

.section __DATA,__objc_data
.globl _OBJC_CLASS_$_MACHWindowDelegate
.p2align 3, 0x0
_OBJC_CLASS_$_MACHWindowDelegate:
.quad _OBJC_METACLASS_$_MACHWindowDelegate
.quad _OBJC_CLASS_$_NSObject
.quad __objc_empty_cache
.quad 0
.quad __OBJC_CLASS_RO_$_MACHWindowDelegate

.section __DATA,__objc_classlist,regular,no_dead_strip
.p2align 3, 0x0
l_OBJC_LABEL_CLASS_$:
.quad _OBJC_CLASS_$_MACHWindowDelegate

.section __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
.long 0
.long 64

.subsections_via_symbols
Loading
Loading