Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
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
1 change: 1 addition & 0 deletions docs/notes/bugfix-14056.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Cannot hide cursor on Mac from LiveCode 6.7
8 changes: 4 additions & 4 deletions engine/src/desktop-dc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,10 @@ void MCScreenDC::platform_boundrect(MCRectangle &rect, Boolean title, Window_mod

////////////////////////////////////////////////////////////////////////////////

// SN-2015-06-16: [[ Bug 14056 ]] PI_NONE should be a valid cursor type
static MCPlatformStandardCursor theme_cursorlist[PI_NCURSORS] =
{
kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow,
kMCPlatformStandardCursorNone, kMCPlatformStandardCursorArrow,
kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorWatch, kMCPlatformStandardCursorWatch,
kMCPlatformStandardCursorCross, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorIBeam, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow,
kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorCross, kMCPlatformStandardCursorWatch, kMCPlatformStandardCursorArrow
Expand Down Expand Up @@ -356,10 +357,9 @@ void MCScreenDC::resetcursors()
freecursor(MCcursors[i]);
MCcursors[i] = nil;

// SN-2015-06-16: [[ Bug 14056 ]] PI_NONE should be a valid cursor type
MCImage *im;
if (i == PI_NONE)
MCcursors[i] = nil;
else if ((im = (MCImage *)MCdispatcher->getobjid(CT_IMAGE, i)) != NULL)
if ((im = (MCImage *)MCdispatcher->getobjid(CT_IMAGE, i)) != NULL)
MCcursors[i] = im -> createcursor();
else if (i < PI_BUSY1)
MCPlatformCreateStandardCursor(theme_cursorlist[i], MCcursors[i]);
Expand Down
2 changes: 1 addition & 1 deletion engine/src/mac-core.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ void MCMacPlatformHandleMouseCursorChange(MCPlatformWindowRef p_window)

// PM-2014-04-02: [[ Bug 12082 ]] IDE no longer crashes when changing an applied pattern
if (t_cursor != nil)
MCPlatformShowCursor(t_cursor);
MCPlatformSetCursor(t_cursor);
// SN-2014-10-01: [[ Bug 13516 ]] Hiding a cursor here is not what we want to happen if a cursor hasn't been found
else
MCMacPlatformResetCursor();
Expand Down
41 changes: 14 additions & 27 deletions engine/src/mac-cursor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
};
};

static MCPlatformCursor *s_hidden_cursor = nil;
static MCPlatformCursor *s_current_cursor = nil;
static bool s_cursor_is_hidden = false;
static NSCursor *s_watch_cursor = nil;

static unsigned char s_watch_cursor_bits[] =
Expand Down Expand Up @@ -182,12 +181,23 @@ void MCPlatformReleaseCursor(MCPlatformCursorRef p_cursor)
MCMemoryDelete(p_cursor);
}

void MCPlatformShowCursor(MCPlatformCursorRef p_cursor)
void MCPlatformSetCursor(MCPlatformCursorRef p_cursor)
{
if (p_cursor -> is_standard)
{
{
// By default, we want the cursor to be visible.
if (s_cursor_is_hidden)
{
[NSCursor unhide];
s_cursor_is_hidden = false;
}
switch(p_cursor -> standard)
{
// SN-2015-06-16: [[ Bug 14056 ]] Hidden cursor is part of the cursors
case kMCPlatformStandardCursorNone:
[NSCursor hide];
s_cursor_is_hidden = true;
break;
case kMCPlatformStandardCursorArrow:
[[NSCursor arrowCursor] set];
break;
Expand Down Expand Up @@ -216,29 +226,6 @@ void MCPlatformShowCursor(MCPlatformCursorRef p_cursor)
[p_cursor -> custom set];
}

void MCPlatformHideCursor(void)
{
if (s_hidden_cursor == nil)
{
uint32_t t_img_data;
t_img_data = 0;

MCImageBitmap t_image;
t_image . width = 1;
t_image . height = 1;
t_image . stride = 4;
t_image . data = &t_img_data;

MCPoint t_hot_spot;
t_hot_spot . x = 0;
t_hot_spot . y = 0;
MCPlatformCreateCustomCursor(&t_image, t_hot_spot, s_hidden_cursor);

}

MCPlatformShowCursor(s_hidden_cursor);
}

void MCPlatformHideCursorUntilMouseMoves(void)
{
[NSCursor setHiddenUntilMouseMoves: YES];
Expand Down
7 changes: 4 additions & 3 deletions engine/src/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,12 @@ void MCPlatformGetMenubar(MCPlatformMenuRef menu);

typedef class MCPlatformCursor *MCPlatformCursorRef;

// SN-2015-06-16: [[ Bug 14056 ]] Add hidden cursor as part of the standard ones
enum MCPlatformStandardCursor
{
kMCPlatformStandardCursorUnknown,


kMCPlatformStandardCursorNone,
kMCPlatformStandardCursorArrow,
kMCPlatformStandardCursorWatch,
kMCPlatformStandardCursorCross,
Expand All @@ -651,8 +653,7 @@ void MCPlatformCreateCustomCursor(MCImageBitmap *image, MCPoint hot_spot, MCPlat
void MCPlatformRetainCursor(MCPlatformCursorRef cursor);
void MCPlatformReleaseCursor(MCPlatformCursorRef cursor);

void MCPlatformShowCursor(MCPlatformCursorRef cursor);
void MCPlatformHideCursor(void);
void MCPlatformSetCursor(MCPlatformCursorRef cursor);
void MCPlatformHideCursorUntilMouseMoves(void);

////////////////////////////////////////////////////////////////////////////////
Expand Down