Skip to content

Commit f8b4571

Browse files
committed
Move APPB::GrfcustCur to appbwin.cpp/appbsdl.cpp
1 parent 7402ffc commit f8b4571

3 files changed

Lines changed: 65 additions & 56 deletions

File tree

kauai/src/appb.cpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -167,62 +167,6 @@ void APPB::EndLongOp(bool fAll)
167167
RefreshCurs();
168168
}
169169

170-
/***************************************************************************
171-
Get the current cursor/modifier state. If fAsync is set, the key state
172-
returned is the actual current values at the hardware level, ie, not
173-
synchronized with the command stream.
174-
***************************************************************************/
175-
uint32_t APPB::GrfcustCur(bool fAsync)
176-
{
177-
AssertThis(0);
178-
179-
#ifdef KAUAI_WIN32
180-
181-
auto pfnT = fAsync ? GetAsyncKeyState : GetKeyState;
182-
_grfcust &= ~kgrfcustUser;
183-
if (pfnT(VK_CONTROL) < 0)
184-
_grfcust |= fcustCmd;
185-
if (pfnT(VK_SHIFT) < 0)
186-
_grfcust |= fcustShift;
187-
if (pfnT(VK_MENU) < 0)
188-
_grfcust |= fcustOption;
189-
if (pfnT(VK_LBUTTON) < 0)
190-
_grfcust |= fcustMouse;
191-
#endif // KAUAI_WIN32
192-
#ifdef MAC
193-
Assert(!fAsync, "Unimplemented code"); // REVIEW shonk: Mac: implement
194-
#endif // MAC
195-
196-
#ifdef KAUAI_SDL
197-
uint32_t ret;
198-
199-
_grfcust &= ~kgrfcustUser;
200-
201-
ret = SDL_GetMouseState(pvNil, pvNil);
202-
if (ret & SDL_BUTTON(1))
203-
{
204-
_grfcust |= fcustMouse;
205-
}
206-
207-
ret = SDL_GetModState();
208-
if (ret & SDL_Keymod::KMOD_CTRL)
209-
{
210-
_grfcust |= fcustCmd;
211-
}
212-
if (ret & SDL_Keymod::KMOD_ALT)
213-
{
214-
_grfcust |= fcustOption;
215-
}
216-
if (ret & SDL_Keymod::KMOD_SHIFT)
217-
{
218-
_grfcust |= fcustShift;
219-
}
220-
221-
#endif // KAUAI_SDL
222-
223-
return _grfcust;
224-
}
225-
226170
/***************************************************************************
227171
Modify the current cursor/modifier state. Doesn't affect the key
228172
states or mouse state.

kauai/src/appbsdl.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,42 @@ tribool APPB::TGiveAlertSz(const PCSZ psz, int32_t bk, int32_t cok)
687687
return (tribool)buttonid;
688688
}
689689

690+
/***************************************************************************
691+
Get the current cursor/modifier state. If fAsync is set, the key state
692+
returned is the actual current values at the hardware level, ie, not
693+
synchronized with the command stream.
694+
***************************************************************************/
695+
uint32_t APPB::GrfcustCur(bool fAsync)
696+
{
697+
AssertThis(0);
698+
699+
uint32_t ret;
700+
701+
_grfcust &= ~kgrfcustUser;
702+
703+
ret = SDL_GetMouseState(pvNil, pvNil);
704+
if (ret & SDL_BUTTON(1))
705+
{
706+
_grfcust |= fcustMouse;
707+
}
708+
709+
ret = SDL_GetModState();
710+
if (ret & SDL_Keymod::KMOD_CTRL)
711+
{
712+
_grfcust |= fcustCmd;
713+
}
714+
if (ret & SDL_Keymod::KMOD_ALT)
715+
{
716+
_grfcust |= fcustOption;
717+
}
718+
if (ret & SDL_Keymod::KMOD_SHIFT)
719+
{
720+
_grfcust |= fcustShift;
721+
}
722+
723+
return _grfcust;
724+
}
725+
690726
/***************************************************************************
691727
Hide the cursor
692728
***************************************************************************/

kauai/src/appbwin.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,35 @@ tribool APPB::TGiveAlertSz(const PCSZ psz, int32_t bk, int32_t cok)
10601060
}
10611061
}
10621062

1063+
/***************************************************************************
1064+
Get the current cursor/modifier state. If fAsync is set, the key state
1065+
returned is the actual current values at the hardware level, ie, not
1066+
synchronized with the command stream.
1067+
***************************************************************************/
1068+
uint32_t APPB::GrfcustCur(bool fAsync)
1069+
{
1070+
AssertThis(0);
1071+
1072+
#ifdef WIN
1073+
1074+
auto pfnT = fAsync ? GetAsyncKeyState : GetKeyState;
1075+
_grfcust &= ~kgrfcustUser;
1076+
if (pfnT(VK_CONTROL) < 0)
1077+
_grfcust |= fcustCmd;
1078+
if (pfnT(VK_SHIFT) < 0)
1079+
_grfcust |= fcustShift;
1080+
if (pfnT(VK_MENU) < 0)
1081+
_grfcust |= fcustOption;
1082+
if (pfnT(VK_LBUTTON) < 0)
1083+
_grfcust |= fcustMouse;
1084+
#endif // WIN
1085+
#ifdef MAC
1086+
Assert(!fAsync, "Unimplemented code"); // REVIEW shonk: Mac: implement
1087+
#endif // MAC
1088+
1089+
return _grfcust;
1090+
}
1091+
10631092
/***************************************************************************
10641093
Hide the cursor
10651094
***************************************************************************/

0 commit comments

Comments
 (0)