Skip to content

Commit

Permalink
UPBGE: Set the window on top at python interpreter end.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Jul 29, 2016
1 parent 5ea4c9b commit 5a35942
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/blender/windowmanager/intern/wm_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,13 @@ void wm_window_testbreak(void)
}
}

void wm_window_set_order(wmWindow *win, int order)
{
if (win->ghostwin) {
GHOST_SetWindowOrder(win->ghostwin, (order == 0) ? GHOST_kWindowOrderBottom : GHOST_kWindowOrderTop);
}
}

/* **************** init ********************** */

void wm_ghost_init(bContext *C)
Expand Down
2 changes: 2 additions & 0 deletions source/blender/windowmanager/wm_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ void wm_cursor_position_to_ghost (wmWindow *win, int *x, int *y);

void wm_window_testbreak (void);

void wm_window_set_order(wmWindow *win, int order);

#ifdef WITH_INPUT_IME
void wm_window_IME_begin (wmWindow *win, int x, int y, int w, int h, bool complete);
void wm_window_IME_end (wmWindow *win);
Expand Down
6 changes: 6 additions & 0 deletions source/gameengine/Launcher/LA_BlenderLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extern "C" {
# include "WM_types.h"
# include "WM_api.h"
# include "wm_event_system.h"
# include "wm_window.h"

# include "BLI_rect.h"
}
Expand Down Expand Up @@ -154,6 +155,11 @@ void LA_BlenderLauncher::ExitPython()
#endif // WITH_PYTHON
}

void LA_BlenderLauncher::SetWindowOrder(short order)
{
wm_window_set_order(m_window, order);
}

void LA_BlenderLauncher::InitEngine()
{
// Lock frame and camera enabled - storing global values.
Expand Down
2 changes: 2 additions & 0 deletions source/gameengine/Launcher/LA_BlenderLauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class LA_BlenderLauncher : public LA_Launcher
virtual void InitPython();
virtual void ExitPython();

virtual void SetWindowOrder(short order);

public:
LA_BlenderLauncher(GHOST_ISystem *system, Main *maggie, Scene *scene, GlobalSettings *gs, RAS_IRasterizer::StereoMode stereoMode,
int argc, char **argv, bContext *context, rcti *camframe, ARegion *ar, int alwaysUseExpandFraming);
Expand Down
8 changes: 8 additions & 0 deletions source/gameengine/Launcher/LA_Launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,18 @@ void LA_Launcher::HandlePythonConsole()
}
}

// Pop the console window for windows.
m_system->toggleConsole(1);

createPythonConsole();

// Hide the console window for windows.
m_system->toggleConsole(0);

// Set the game engine windows on top of all other and active.
SetWindowOrder(1);


/* As we show the console, the release events of the shortcut keys can be not handled by the engine.
* We simulate they them.
*/
Expand Down
2 changes: 2 additions & 0 deletions source/gameengine/Launcher/LA_Launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class LA_Launcher
virtual void InitPython() = 0;
virtual void ExitPython() = 0;

virtual void SetWindowOrder(short order) = 0;

public:
LA_Launcher(GHOST_ISystem *system, Main *maggie, Scene *scene, GlobalSettings *gs, RAS_IRasterizer::StereoMode stereoMode, int argc, char **argv);
virtual ~LA_Launcher();
Expand Down
5 changes: 5 additions & 0 deletions source/gameengine/Launcher/LA_PlayerLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ void LA_PlayerLauncher::ExitPython()
#endif // WITH_PYTHON
}

void LA_PlayerLauncher::SetWindowOrder(short order)
{
m_mainWindow->setOrder((order == 0) ? GHOST_kWindowOrderBottom : GHOST_kWindowOrderTop);
}

void LA_PlayerLauncher::InitEngine()
{
GPU_init();
Expand Down
2 changes: 2 additions & 0 deletions source/gameengine/Launcher/LA_PlayerLauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class LA_PlayerLauncher : public LA_Launcher
virtual void InitPython();
virtual void ExitPython();

virtual void SetWindowOrder(short order);

public:
LA_PlayerLauncher(GHOST_ISystem* system, Main *maggie, Scene *scene, GlobalSettings *gs,
RAS_IRasterizer::StereoMode stereoMode, int argc, char **argv, char *pythonMainLoop);
Expand Down

0 comments on commit 5a35942

Please sign in to comment.