Skip to content

Commit c1551a3

Browse files
Merge pull request livecode#2550 from livecodesebastien/merge-6.7.7-rc-1
[[ Merge 6.7.7 rc 1 ]] Merge develop-6.7 into develop-7.0
2 parents e1490e3 + 5456ac1 commit c1551a3

File tree

5 files changed

+24
-35
lines changed

5 files changed

+24
-35
lines changed

docs/notes/bugfix-14056.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Cannot hide cursor on Mac from LiveCode 6.7

engine/src/desktop-dc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ void MCScreenDC::platform_boundrect(MCRectangle &rect, Boolean title, Window_mod
316316

317317
////////////////////////////////////////////////////////////////////////////////
318318

319+
// SN-2015-06-16: [[ Bug 14056 ]] PI_NONE should be a valid cursor type
319320
static MCPlatformStandardCursor theme_cursorlist[PI_NCURSORS] =
320321
{
321-
kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow,
322+
kMCPlatformStandardCursorNone, kMCPlatformStandardCursorArrow,
322323
kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorWatch, kMCPlatformStandardCursorWatch,
323324
kMCPlatformStandardCursorCross, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorIBeam, kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorArrow,
324325
kMCPlatformStandardCursorArrow, kMCPlatformStandardCursorCross, kMCPlatformStandardCursorWatch, kMCPlatformStandardCursorArrow
@@ -356,10 +357,9 @@ void MCScreenDC::resetcursors()
356357
freecursor(MCcursors[i]);
357358
MCcursors[i] = nil;
358359

360+
// SN-2015-06-16: [[ Bug 14056 ]] PI_NONE should be a valid cursor type
359361
MCImage *im;
360-
if (i == PI_NONE)
361-
MCcursors[i] = nil;
362-
else if ((im = (MCImage *)MCdispatcher->getobjid(CT_IMAGE, i)) != NULL)
362+
if ((im = (MCImage *)MCdispatcher->getobjid(CT_IMAGE, i)) != NULL)
363363
MCcursors[i] = im -> createcursor();
364364
else if (i < PI_BUSY1)
365365
MCPlatformCreateStandardCursor(theme_cursorlist[i], MCcursors[i]);

engine/src/mac-core.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ void MCMacPlatformHandleMouseCursorChange(MCPlatformWindowRef p_window)
16771677

16781678
// PM-2014-04-02: [[ Bug 12082 ]] IDE no longer crashes when changing an applied pattern
16791679
if (t_cursor != nil)
1680-
MCPlatformShowCursor(t_cursor);
1680+
MCPlatformSetCursor(t_cursor);
16811681
// SN-2014-10-01: [[ Bug 13516 ]] Hiding a cursor here is not what we want to happen if a cursor hasn't been found
16821682
else
16831683
MCMacPlatformResetCursor();

engine/src/mac-cursor.mm

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
};
4242
};
4343

44-
static MCPlatformCursor *s_hidden_cursor = nil;
45-
static MCPlatformCursor *s_current_cursor = nil;
44+
static bool s_cursor_is_hidden = false;
4645
static NSCursor *s_watch_cursor = nil;
4746

4847
static unsigned char s_watch_cursor_bits[] =
@@ -181,12 +180,23 @@ void MCPlatformReleaseCursor(MCPlatformCursorRef p_cursor)
181180
MCMemoryDelete(p_cursor);
182181
}
183182

184-
void MCPlatformShowCursor(MCPlatformCursorRef p_cursor)
183+
void MCPlatformSetCursor(MCPlatformCursorRef p_cursor)
185184
{
186185
if (p_cursor -> is_standard)
187-
{
186+
{
187+
// By default, we want the cursor to be visible.
188+
if (s_cursor_is_hidden)
189+
{
190+
[NSCursor unhide];
191+
s_cursor_is_hidden = false;
192+
}
188193
switch(p_cursor -> standard)
189194
{
195+
// SN-2015-06-16: [[ Bug 14056 ]] Hidden cursor is part of the cursors
196+
case kMCPlatformStandardCursorNone:
197+
[NSCursor hide];
198+
s_cursor_is_hidden = true;
199+
break;
190200
case kMCPlatformStandardCursorArrow:
191201
[[NSCursor arrowCursor] set];
192202
break;
@@ -215,29 +225,6 @@ void MCPlatformShowCursor(MCPlatformCursorRef p_cursor)
215225
[p_cursor -> custom set];
216226
}
217227

218-
void MCPlatformHideCursor(void)
219-
{
220-
if (s_hidden_cursor == nil)
221-
{
222-
uint32_t t_img_data;
223-
t_img_data = 0;
224-
225-
MCImageBitmap t_image;
226-
t_image . width = 1;
227-
t_image . height = 1;
228-
t_image . stride = 4;
229-
t_image . data = &t_img_data;
230-
231-
MCPoint t_hot_spot;
232-
t_hot_spot . x = 0;
233-
t_hot_spot . y = 0;
234-
MCPlatformCreateCustomCursor(&t_image, t_hot_spot, s_hidden_cursor);
235-
236-
}
237-
238-
MCPlatformShowCursor(s_hidden_cursor);
239-
}
240-
241228
void MCPlatformHideCursorUntilMouseMoves(void)
242229
{
243230
[NSCursor setHiddenUntilMouseMoves: YES];

engine/src/platform.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,12 @@ void MCPlatformGetMenubar(MCPlatformMenuRef menu);
636636

637637
typedef class MCPlatformCursor *MCPlatformCursorRef;
638638

639+
// SN-2015-06-16: [[ Bug 14056 ]] Add hidden cursor as part of the standard ones
639640
enum MCPlatformStandardCursor
640641
{
641642
kMCPlatformStandardCursorUnknown,
642-
643+
644+
kMCPlatformStandardCursorNone,
643645
kMCPlatformStandardCursorArrow,
644646
kMCPlatformStandardCursorWatch,
645647
kMCPlatformStandardCursorCross,
@@ -651,8 +653,7 @@ void MCPlatformCreateCustomCursor(MCImageBitmap *image, MCPoint hot_spot, MCPlat
651653
void MCPlatformRetainCursor(MCPlatformCursorRef cursor);
652654
void MCPlatformReleaseCursor(MCPlatformCursorRef cursor);
653655

654-
void MCPlatformShowCursor(MCPlatformCursorRef cursor);
655-
void MCPlatformHideCursor(void);
656+
void MCPlatformSetCursor(MCPlatformCursorRef cursor);
656657
void MCPlatformHideCursorUntilMouseMoves(void);
657658

658659
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)