Skip to content

Commit 975ff14

Browse files
committed
Expose SetForeground function to Lua API, remove redundant function with duplicate functionality
1 parent 84b9685 commit 975ff14

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

engine/system/sys_video.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class sys_IVideo {
4747

4848
virtual int Apply(sys_vidSet_s* set) = 0; // Apply settings
4949

50-
virtual void SetActive(bool active) = 0; // Respond to window activated status change
5150
virtual void SetForeground() = 0; // Activate the window if shown
5251
virtual bool IsActive() = 0; // Get activated status
5352
virtual void FramebufferSizeChanged(int width, int height) = 0; // Respond to framebuffer size change

engine/system/win/sys_video.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class sys_video_c : public sys_IVideo {
2929
// Interface
3030
int Apply(sys_vidSet_s* set);
3131

32-
void SetActive(bool active);
3332
void SetForeground();
3433
bool IsActive();
3534
void FramebufferSizeChanged(int width, int height);
@@ -657,13 +656,6 @@ int sys_video_c::Apply(sys_vidSet_s* set)
657656
return 0;
658657
}
659658

660-
void sys_video_c::SetActive(bool active)
661-
{
662-
if (initialised) {
663-
glfwFocusWindow(wnd);
664-
}
665-
}
666-
667659
void sys_video_c::SetForeground()
668660
{
669661
if (initialised) {

ui_api.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
** SetProfiling(isEnabled)
105105
** Restart()
106106
** Exit(["<message>"])
107+
** SetForeground()
107108
*/
108109

109110
// Grab UI main pointer from the registry
@@ -1952,6 +1953,13 @@ static int l_TakeScreenshot(lua_State* L)
19521953
return 0;
19531954
}
19541955

1956+
static int l_SetForeground(lua_State* L)
1957+
{
1958+
ui_main_c* ui = GetUIPtr(L);
1959+
ui->sys->video->SetForeground();
1960+
return 0;
1961+
}
1962+
19551963
// ==============================
19561964
// Library and API Initialisation
19571965
// ==============================
@@ -2128,6 +2136,7 @@ int ui_main_c::InitAPI(lua_State* L)
21282136
ADDFUNC(TakeScreenshot);
21292137
ADDFUNC(Restart);
21302138
ADDFUNC(Exit);
2139+
ADDFUNC(SetForeground);
21312140
lua_getglobal(L, "os");
21322141
lua_pushcfunction(L, l_Exit);
21332142
lua_setfield(L, -2, "exit");

0 commit comments

Comments
 (0)