Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit ce6e253

Browse files
[[ Bug 22698 ]] Ensure card state flags reflect keyfocus state
This patch updates card.cpp to ensure that a card's state flags reflect the keyfocus state of the card by setting and unsetting the CS_KFOCUS flag when focus is gained or lost respectively by controls on the card
1 parent 0166a3e commit ce6e253

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

engine/src/card.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ void MCCard::kfocus()
322322
// MW-2014-08-12: [[ Bug 13167 ]] Sync the view focus before the engine state
323323
// (otherwise the engine state can change due to script).
324324
MCscreen -> controlgainedfocus(getstack(), kfocused -> getid());
325+
// Mark card as focused
326+
setstate(true, CS_KFOCUSED);
325327
kfocused->getref()->kfocus();
326328
}
327329
if (kfocused == NULL)
@@ -361,6 +363,8 @@ Boolean MCCard::kfocusnext(Boolean top)
361363
// MW-2014-08-12: [[ Bug 13167 ]] Sync the view focus before the engine state
362364
// (otherwise the engine state can change due to script).
363365
MCscreen -> controllostfocus(getstack(), oldkfocused -> getid());
366+
// Mark card as unfocused
367+
setstate(false, CS_KFOCUSED);
364368
oldkfocused->getref()->kunfocus();
365369
if (oldkfocused == NULL)
366370
return False;
@@ -371,6 +375,8 @@ Boolean MCCard::kfocusnext(Boolean top)
371375
// MW-2014-07-29: [[ Bug 13001 ]] Sync the view focus before the engine state
372376
// (otherwise the engine state can change due to script).
373377
MCscreen -> controlgainedfocus(getstack(), kfocused -> getid());
378+
// Mark card as focused
379+
setstate(true, CS_KFOCUSED);
374380
kfocused->getref()->kfocus();
375381
done = True;
376382
break;
@@ -420,6 +426,8 @@ Boolean MCCard::kfocusprev(Boolean bottom)
420426
// MW-2014-08-12: [[ Bug 13167 ]] Sync the view focus before the engine state
421427
// (otherwise the engine state can change due to script).
422428
MCscreen -> controllostfocus(getstack(), oldkfocused -> getid());
429+
// Mark card as unfocused
430+
setstate(false, CS_KFOCUSED);
423431
oldkfocused->getref()->kunfocus();
424432
if (oldkfocused == NULL)
425433
return False;
@@ -430,6 +438,8 @@ Boolean MCCard::kfocusprev(Boolean bottom)
430438
// MW-2014-07-29: [[ Bug 13001 ]] Sync the view focus before the engine state
431439
// (otherwise the engine state can change due to script).
432440
MCscreen -> controlgainedfocus(getstack(), kfocused -> getid());
441+
// Mark card as focused
442+
setstate(true, CS_KFOCUSED);
433443
kfocused->getref()->kfocus();
434444
done = True;
435445
break;
@@ -453,6 +463,8 @@ void MCCard::kunfocus()
453463
// MW-2014-08-12: [[ Bug 13167 ]] Sync the view focus before the engine state
454464
// (otherwise the engine state can change due to script).
455465
MCscreen -> controllostfocus(getstack(), oldkfocused -> getid());
466+
// Mark card as unfocused
467+
setstate(false, CS_KFOCUSED);
456468
oldkfocused->getref()->kunfocus();
457469
}
458470
else
@@ -1382,6 +1394,8 @@ void MCCard::kfocusset(MCControl *target)
13821394
// MW-2014-08-12: [[ Bug 13167 ]] Sync the view focus before the engine state
13831395
// (otherwise the engine state can change due to script).
13841396
MCscreen -> controllostfocus(getstack(), tkfocused -> getid());
1397+
// Mark card as unfocused
1398+
setstate(false, CS_KFOCUSED);
13851399
tkfocused->getref()->kunfocus();
13861400
}
13871401
if (kfocused != NULL)
@@ -1395,6 +1409,8 @@ void MCCard::kfocusset(MCControl *target)
13951409
// MW-2014-08-12: [[ Bug 13167 ]] Sync the view focus before the engine state
13961410
// (otherwise the engine state can change due to script).
13971411
MCscreen -> controlgainedfocus(getstack(), kfocused -> getid());
1412+
// Mark card as focused
1413+
setstate(true, CS_KFOCUSED);
13981414
kfocused->getref()->kfocus();
13991415

14001416
// OK-2009-04-29: [[Bug 8013]] - Its possible that kfocus() can set kfocused to NULL if the

0 commit comments

Comments
 (0)