Skip to content

Commit f16a0c8

Browse files
committed
cocoa: Popup menu positioning, Tree leaf icon
1 parent f640bcf commit f16a0c8

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

iup/external/src/cocoa/iupcocoa_font.m

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,13 @@ - (void)dealloc
9898
NSFont *ns_font;
9999

100100
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
101-
/* Use modern API on macOS 11+ */
102-
NSOperatingSystemVersion version = {11, 0, 0};
103-
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version])
104-
{
105101
#pragma clang diagnostic push
106102
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
107-
ns_font = [NSFont preferredFontForTextStyle:NSFontTextStyleBody options:@{}];
103+
ns_font = [NSFont preferredFontForTextStyle:NSFontTextStyleBody options:@{}];
108104
#pragma clang diagnostic pop
109-
}
110-
else
105+
#else
106+
ns_font = [NSFont messageFontOfSize:0];
111107
#endif
112-
{
113-
/* Fall back to legacy API (or when SDK doesn't have macOS 11+ APIs) */
114-
ns_font = [NSFont messageFontOfSize:0];
115-
}
116108

117109
IupCocoaFont *iup_font = cocoaCreateIupCocoaFontFromNSFont(ns_font);
118110
s_systemFont = [iup_font retain];

iup/external/src/cocoa/iupcocoa_info.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ IUP_SDK_API void iupdrvGetCursorPos(int *x, int *y)
166166

167167
if (x) *x = iupROUND(mouse_point.x);
168168
if (y) *y = iupROUND(inverted_y);
169+
170+
iupdrvAddScreenOffset(x, y, -1);
169171
}
170172

171173
IUP_SDK_API void iupdrvGetKeyState(char* key)

iup/external/src/cocoa/iupcocoa_tree.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3939,7 +3939,14 @@ static void helperReplaceDefaultImages(Ihandle* ih, IupCocoaOutlineView* outline
39393939
leaf_image = (NSImage*)iupImageGetImage(leaf_img_name, ih, 0, NULL);
39403940
else
39413941
{
3942-
leaf_image = [NSImage imageNamed:NSImageNameIChatTheaterTemplate];
3942+
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
3943+
#pragma clang diagnostic push
3944+
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
3945+
leaf_image = [NSImage imageWithSystemSymbolName:@"doc.text" accessibilityDescription:nil];
3946+
#pragma clang diagnostic pop
3947+
#else
3948+
leaf_image = [NSImage imageNamed:NSImageNameMultipleDocuments];
3949+
#endif
39433950
[leaf_image setSize:NSMakeSize(16, 16)];
39443951
}
39453952
[outline_view setLeafImage:leaf_image];

0 commit comments

Comments
 (0)