Skip to content

Commit eac8dbf

Browse files
author
Monte Goulding
committed
[[ IgnoreMouseEvents ]] Implemented the ignoreMouseEvents property which will make a stack transparent to mouse events.
1 parent 2dc66c1 commit eac8dbf

File tree

15 files changed

+92
-2
lines changed

15 files changed

+92
-2
lines changed

engine/src/desktop-stack.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ void MCStack::realize(void)
207207
// Sort out drawers
208208

209209
updatemodifiedmark();
210+
211+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] update the window with the ignore mouse events property
212+
updateignoremouseevents();
210213
}
211214

212215
start_externals();
@@ -276,6 +279,16 @@ void MCStack::updatemodifiedmark(void)
276279
MCPlatformSetWindowBoolProperty(window, kMCPlatformWindowPropertyHasModifiedMark, getextendedstate(ECS_MODIFIED_MARK) == True);
277280
}
278281

282+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] update the window with the ignore mouse events property
283+
void MCStack::updateignoremouseevents(void)
284+
{
285+
if (window == nil)
286+
return;
287+
288+
MCPlatformSetWindowBoolProperty(window, kMCPlatformWindowPropertyIgnoreMouseEvents, getextendedstate(ECS_IGNORE_MOUSE_EVENTS) == True);
289+
}
290+
291+
279292
// MW-2011-09-11: [[ Redraw ]] Force an immediate update of the window within the given
280293
// region. The actual rendering is done by deferring to the 'redrawwindow' method.
281294
void MCStack::view_platform_updatewindow(MCRegionRef p_region)

engine/src/lextable.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,8 @@ LT factor_table[] =
952952
{"id", TT_PROPERTY, P_ID},
953953
{"idlerate", TT_PROPERTY, P_IDLE_RATE},
954954
{"idleticks", TT_PROPERTY, P_IDLE_TICKS},
955+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] ignoreMouseEvents stack property
956+
{"ignoremouseevents", TT_PROPERTY, P_IGNORE_MOUSE_EVENTS},
955957
{"image", TT_CHUNK, CT_IMAGE},
956958
{"imagecachelimit", TT_PROPERTY, P_IMAGE_CACHE_LIMIT},
957959
{"imagecacheusage", TT_PROPERTY, P_IMAGE_CACHE_USAGE},

engine/src/lnxstack.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,11 @@ void MCStack::updatemodifiedmark(void)
655655
{
656656
}
657657

658+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] Stub for ignoreMouseEvents.
659+
void MCStack::updateignoremouseevents(void)
660+
{
661+
}
662+
658663
void MCStack::redrawicon(void)
659664
{
660665
}

engine/src/mac-window.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,11 @@ - (void)setFrameSize: (NSSize)size
18151815
if (m_changes . hides_on_suspend_changed)
18161816
[m_window_handle setHidesOnDeactivate: m_hides_on_suspend];
18171817

1818+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] Sync ignoreMouseEvents.
1819+
if (m_changes . ignore_mouse_events_changed)
1820+
[m_window_handle setIgnoresMouseEvents: m_ignore_mouse_events];
1821+
1822+
18181823
m_synchronizing = false;
18191824
}
18201825

engine/src/mblstack.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ void MCStack::updatemodifiedmark(void)
159159
{
160160
}
161161

162+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] Stub for ignoreMouseEvents.
163+
void MCStack::updateignoremouseevents(void)
164+
{
165+
}
166+
162167
void MCStack::redrawicon(void)
163168
{
164169
}

engine/src/objdefs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
502502
// If this is set then this stack needs parentScripts resolve
503503
#define ECS_USES_PARENTSCRIPTS (1UL << 18)
504504

505+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] If this is set then the stack is transparent to mouse events
506+
#define ECS_IGNORE_MOUSE_EVENTS (1UL << 17)
507+
505508
// Has handlers
506509
#define HH_IDLE (1UL << 0)
507510
#define HH_MOUSE_WITHIN (1UL << 1)

engine/src/parsedef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,8 @@ enum Properties {
942942
P_PRIVATE_COLORS,
943943
P_IDLE_RATE,
944944
P_IDLE_TICKS,
945+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] Property tag for 'the ignoreMouseEvents' of stacks.
946+
P_IGNORE_MOUSE_EVENTS,
945947
P_BLINK_RATE,
946948
P_RECURSION_LIMIT,
947949
P_REPEAT_RATE,

engine/src/platform-internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ class MCPlatformWindow
202202
bool cursor_changed : 1;
203203

204204
bool hides_on_suspend_changed : 1;
205+
206+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] Changed flag for ignore mouse events.
207+
bool ignore_mouse_events_changed : 1;
205208
} m_changes;
206209
MCPlatformWindowStyle m_style;
207210
char *m_title;
@@ -220,6 +223,8 @@ class MCPlatformWindow
220223
bool m_has_modified_mark : 1;
221224
bool m_use_live_resizing : 1;
222225
bool m_hides_on_suspend : 1;
226+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] ignoreMouseEvents property
227+
bool m_ignore_mouse_events : 1;
223228
};
224229

225230
// Universal state.

engine/src/platform-window.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ MCPlatformWindow::MCPlatformWindow(void)
4949
m_has_modified_mark = false;
5050
m_use_live_resizing = false;
5151
m_hides_on_suspend = false;
52+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] Default ignoreMouseEvents to false
53+
m_ignore_mouse_events = false;
5254

5355
// MW-2014-05-02: [[ Bug 12348 ]] Make sure we initialize this value appropriately.
5456
m_use_text_input = false;
@@ -357,6 +359,12 @@ void MCPlatformWindow::SetProperty(MCPlatformWindowProperty p_property, MCPlatfo
357359
m_hides_on_suspend = *(bool *)p_value;
358360
m_changes . hides_on_suspend_changed = true;
359361
break;
362+
// MERG-2014-06-02: [[ IgnoreMouseEvents ]] Handle ignoreMouseEvents.
363+
case kMCPlatformWindowPropertyIgnoreMouseEvents:
364+
assert(p_type == kMCPlatformPropertyTypeBool);
365+
m_ignore_mouse_events = *(bool *)p_value;
366+
m_changes . ignore_mouse_events_changed = true;
367+
break;
360368
default:
361369
assert(false);
362370
break;

engine/src/platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,8 @@ enum MCPlatformWindowProperty
786786
kMCPlatformWindowPropertyCursor,
787787

788788
kMCPlatformWindowPropertyHideOnSuspend,
789+
790+
kMCPlatformWindowPropertyIgnoreMouseEvents,
789791
};
790792

791793
void MCPlatformSetWindowProperty(MCPlatformWindowRef window, MCPlatformWindowProperty property, MCPlatformPropertyType type, const void *value);

0 commit comments

Comments
 (0)