Skip to content

Commit 12eec76

Browse files
committed
[[ FullscreenMode ]] Add MCStack::view_configure to reconfigure view bounds after window rect changes
[[ FullscreenMode ]] Fix Linux popup location & mouse position offsets
1 parent a7273a8 commit 12eec76

12 files changed

Lines changed: 102 additions & 53 deletions

engine/src/cmdss.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ Exec_stat MCGo::exec(MCExecPoint &ep)
861861

862862
// MW-2011-10-17: [[ Bug 9811 ]] Make sure we configure the new card now.
863863
MCRedrawDisableScreenUpdates();
864-
sptr -> configure(True);
864+
sptr -> view_configure(True);
865865
MCRedrawEnableScreenUpdates();
866866

867867
Boolean t_abort;

engine/src/dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ void MCDispatch::configure(Window w)
12611261
{
12621262
MCStack *target = findstackd(w);
12631263
if (target != NULL)
1264-
target->configure(True);
1264+
target->view_configure(true);
12651265
}
12661266

12671267
void MCDispatch::enter(Window w)

engine/src/eventqueue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static void MCEventQueueDispatchEvent(MCEvent *p_event)
239239
break;
240240

241241
case kMCEventTypeWindowReshape:
242-
t_event -> window . stack -> configure(True);
242+
t_event -> window . stack -> view_configure(true);
243243
break;
244244

245245
case kMCEventTypeMouseFocus:

engine/src/lnxdce.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,13 @@ Boolean MCScreenDC::getmouseclick(uint2 button, Boolean& r_abort)
274274
|| bpevent->state >> 8 & 0x1F & ~(0x1L << button - 1))
275275
{
276276
setmods(bpevent->state, 0, bpevent->button, False);
277-
MCclickstackptr = MCmousestackptr;
278277
// IM-2013-08-12: [[ ResIndependence ]] Scale mouse coordinates to user space
279-
MCclicklocx = bpevent->x / t_device_scale;
280-
MCclicklocy = bpevent->y / t_device_scale;
278+
MCPoint t_clickloc;
279+
t_clickloc = MCPointMake(bpevent->x / t_device_scale, bpevent->y / t_device_scale);
280+
281+
// IM-2013-10-09: [[ FullscreenMode ]] Update clickloc with MCscreen getters & setters
282+
MCscreen->setclickloc(MCmousestackptr, t_clickloc);
283+
281284
pressptr = tptr;
282285
tptr = (MCEventnode *)tptr->next();
283286
break;

engine/src/lnxdclnx.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,13 @@ Boolean MCScreenDC::handle(Boolean dispatch, Boolean anyevent,
568568
t_scale = MCResGetDeviceScale();
569569

570570
MCPoint t_mouseloc;
571-
t_mouseloc.x = mevent->x / t_scale;
572-
t_mouseloc.y = mevent->y / t_scale;
571+
t_mouseloc = MCPointMake(mevent->x / t_scale, mevent->y / t_scale);
573572

574-
MCmousex = t_mouseloc.x;
575-
MCmousey = t_mouseloc.y;
576-
MCmousestackptr = MCdispatcher->findstackd(mevent->window);
573+
MCStack *t_mousestack;
574+
t_mousestack = MCdispatcher->findstackd(mevent->window);
575+
576+
// IM-2013-10-09: [[ FullscreenMode ]] Update mouseloc with MCscreen getters & setters
577+
MCscreen->setmouseloc(t_mousestack, t_mouseloc);
577578

578579
//XDND
579580
if ( !dragclick && (MCU_abs(MCmousex - MCclicklocx) > 4 || MCU_abs(MCmousey - MCclicklocy) > 4) && MCbuttonstate != 0 )
@@ -611,18 +612,16 @@ Boolean MCScreenDC::handle(Boolean dispatch, Boolean anyevent,
611612
MCGFloat t_scale;
612613
t_scale = MCResGetDeviceScale();
613614

614-
MCGPoint t_clickloc;
615-
t_clickloc.x = brevent->x / t_scale;
616-
t_clickloc.y = brevent->y / t_scale;
615+
MCPoint t_clickloc;
616+
t_clickloc = MCPointMake(brevent->x / t_scale, brevent->y / t_scale);
617617

618-
MCGPoint t_oldclickloc;
619-
t_oldclickloc.x = MCclicklocx;
620-
t_oldclickloc.y = MCclicklocy;
618+
MCStack *t_old_clickstack;
619+
MCPoint t_oldclickloc;
620+
MCscreen->getclickloc(t_old_clickstack, t_oldclickloc);
621621

622-
MCclicklocx = t_clickloc.x;
623-
MCclicklocy = t_clickloc.y;
622+
// IM-2013-10-09: [[ FullscreenMode ]] Update clickloc with MCscreen getters & setters
623+
MCscreen->setclickloc(MCmousestackptr, t_clickloc);
624624

625-
MCclickstackptr = MCmousestackptr;
626625
if (dispatch)
627626
{
628627
if (bpevent->window != MCtracewindow)

engine/src/mblandroiddc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ void MCScreenDC::do_fit_window(bool p_immediate_resize, bool p_post_message)
492492
if (p_post_message)
493493
{
494494
if (p_immediate_resize)
495-
((MCStack *)m_current_window) -> configure(True);
495+
((MCStack *)m_current_window) -> view_configure(true);
496496
else
497497
MCEventQueuePostWindowReshape((MCStack *)m_current_window);
498498

engine/src/mbliphonedc.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ static void MCScreenDCDoSnapshot(void *p_env)
744744
if (p_post_message)
745745
{
746746
if (p_immediate_resize)
747-
((MCStack *)m_current_window) -> configure(True);
747+
((MCStack *)m_current_window) -> view_configure(true);
748748
else
749749
MCEventQueuePostWindowReshape((MCStack *)m_current_window);
750750
}

engine/src/osxspec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static pascal OSStatus WinEvtHndlr(EventHandlerCallRef ehcf, EventRef event, voi
294294

295295
// MW-2007-08-29: [[ Bug 4846 ]] Ensure a moveStack message is sent whenever the window moves
296296
if ((attributes & kWindowBoundsChangeSizeChanged) != 0 || ((attributes & kWindowBoundsChangeUserDrag) != 0 && (attributes & kWindowBoundsChangeOriginChanged) != 0))
297-
sptr->configure(True);//causes a redraw and recalculation
297+
sptr->view_configure(true);//causes a redraw and recalculation
298298
}
299299
else if (GetEventKind(event) == kEventWindowInit && sptr != NULL)
300300
{

engine/src/stack.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,14 @@ class MCStack : public MCObject
372372
void view_activatetilecache(void);
373373
void view_compacttilecache(void);
374374

375+
// IM-2013-10-10: [[ FullscreenMode ]] Reconfigure view after window rect changes
376+
void view_configure(bool p_user);
377+
378+
// IM-2013-10-10: [[ FullscreenMode ]] Update the on-screen bounds of the view
379+
void view_setrect(const MCRectangle &p_new_rect);
380+
// IM-2013-10-10: [[ FullscreenMode ]] Notify view of changes to its bounds
381+
void view_on_rect_changed(void);
382+
375383
//////////
376384

377385
// Return the stack -> device coordinate transform

engine/src/stack2.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ void MCStack::configure(Boolean user)
166166
if (view_getfullscreen())
167167
trect = view_setstackviewport(old_rect);
168168
else
169-
mode_getrealrect(trect);
169+
{
170+
// IM-2013-10-09: [[ FullscreenMode ]] Non-fullscreen stacks should use
171+
// the whole view rect
172+
trect = view_getrect();
173+
}
170174
if (trect.width != 0 && trect.height != 0
171175
&& (trect.width != rect.width || trect.height != rect.height))
172176
{
@@ -2105,7 +2109,7 @@ Exec_stat MCStack::openrect(const MCRectangle &rel, Window_mode wm, MCStack *par
21052109

21062110
// MW-2009-09-09: If this is a plugin window, then we need to send a resizeStack
21072111
// as we have no control over the size of the window...
2108-
configure(window != DNULL ? False : True);
2112+
view_configure(window != DNULL ? False : True);
21092113
}
21102114

21112115
// MW-2008-10-31: [[ ParentScripts ]] Send openControl appropriately

0 commit comments

Comments
 (0)