forked from 0ad/0ad
# Made the Atlas scenario editor partly work on Linux.
- Made the canvas get shown before it's used. - Added some bits of SDL initialisation so that SDL_GL_GetProcAddress is happy. SnapSplitterWindow: fixed virtual override. This was SVN commit r4735.
This commit is contained in:
parent
fffc32f8ad
commit
0bdc1c22c8
@ -85,7 +85,7 @@ function package_set_build_flags()
|
||||
if options["icc"] then
|
||||
tinsert(package.buildoptions, {
|
||||
"-w1",
|
||||
"-Wabi",
|
||||
-- "-Wabi",
|
||||
-- "-Wp64", -- complains about OBJECT_TO_JSVAL which is annoying
|
||||
"-Wpointer-arith",
|
||||
"-Wreturn-type",
|
||||
|
@ -29,14 +29,18 @@ void SnapSplitterWindow::SetDefaultSashPosition(int sashPosition)
|
||||
SetSashGravity(0.0);
|
||||
}
|
||||
|
||||
bool SnapSplitterWindow::SplitVertically(wxWindow *window1, wxWindow *window2)
|
||||
bool SnapSplitterWindow::SplitVertically(wxWindow *window1, wxWindow *window2, int sashPosition)
|
||||
{
|
||||
return wxSplitterWindow::SplitVertically(window1, window2, m_DefaultSashPosition);
|
||||
if (sashPosition == 0)
|
||||
sashPosition = m_DefaultSashPosition;
|
||||
return wxSplitterWindow::SplitVertically(window1, window2, sashPosition);
|
||||
}
|
||||
|
||||
bool SnapSplitterWindow::SplitHorizontally(wxWindow *window1, wxWindow *window2)
|
||||
bool SnapSplitterWindow::SplitHorizontally(wxWindow *window1, wxWindow *window2, int sashPosition)
|
||||
{
|
||||
return wxSplitterWindow::SplitHorizontally(window1, window2, m_DefaultSashPosition);
|
||||
if (sashPosition == 0)
|
||||
sashPosition = m_DefaultSashPosition;
|
||||
return wxSplitterWindow::SplitHorizontally(window1, window2, sashPosition);
|
||||
}
|
||||
|
||||
void SnapSplitterWindow::OnSashPosChanging(wxSplitterEvent& evt)
|
||||
|
@ -5,8 +5,8 @@ class SnapSplitterWindow : public wxSplitterWindow
|
||||
public:
|
||||
SnapSplitterWindow(wxWindow* parent, long style = wxSP_3D);
|
||||
void SetDefaultSashPosition(int sashPosition);
|
||||
virtual bool SplitVertically(wxWindow* window1, wxWindow* window2);
|
||||
virtual bool SplitHorizontally(wxWindow* window1, wxWindow* window2);
|
||||
virtual bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
|
||||
virtual bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
|
||||
|
||||
private:
|
||||
void OnSashPosChanging(wxSplitterEvent& evt);
|
||||
|
@ -383,17 +383,24 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
|
||||
Canvas* canvas = new GameCanvas(m_SectionLayout.GetCanvasParent(), glAttribList);
|
||||
m_SectionLayout.SetCanvas(canvas);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Set up sidebars:
|
||||
|
||||
m_SectionLayout.Build();
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
// The canvas' context gets made current on creation; but it can only be
|
||||
// current for one thread at a time, and it needs to be current for the
|
||||
// thread that is doing the draw calls, so disable it for this one.
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
#elif defined(__WXGTK__)
|
||||
// Need to make sure the canvas is realized by GTK, so that its context is valid
|
||||
Show(true);
|
||||
wxSafeYield();
|
||||
|
||||
assert(canvas->GetContext() != NULL);
|
||||
assert(glXGetCurrentContext() == NULL);
|
||||
#endif
|
||||
|
||||
// Set up sidebars:
|
||||
|
||||
m_SectionLayout.Build();
|
||||
|
||||
// Send setup messages to game engine:
|
||||
|
||||
POST_MESSAGE(SetCanvas, (static_cast<wxGLCanvas*>(canvas)));
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "gui/CGUI.h"
|
||||
#include "gui/GUIbase.h"
|
||||
#include "lib/res/file/vfs.h"
|
||||
#include "lib/sdl.h"
|
||||
#include "maths/MathUtil.h"
|
||||
#include "ps/CConsole.h"
|
||||
#include "ps/Game.h"
|
||||
@ -26,6 +27,22 @@ MESSAGEHANDLER(Init)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
#if OS_LINUX
|
||||
// When using GLX (Linux), SDL has to load the GL library to find
|
||||
// glXGetProcAddressARB before it can load any extensions.
|
||||
// When running in Atlas, we skip the SDL video initialisation code
|
||||
// which loads the library, and so SDL_GL_GetProcAddress fails (in
|
||||
// ogl.cpp importExtensionFunctions).
|
||||
// (TODO: I think this is meant to be context-independent, i.e. it
|
||||
// doesn't matter that we're getting extensions from SDL-initialised
|
||||
// GL stuff instead of from the wxWidgets-initialised GL stuff, but that
|
||||
// should be checked.)
|
||||
// So, make sure it's loaded:
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_GL_LoadLibrary(NULL); // NULL = use default
|
||||
// (it shouldn't hurt if this is called multiple times, I think)
|
||||
#endif
|
||||
|
||||
oglInit();
|
||||
|
||||
g_Quickstart = true;
|
||||
|
@ -75,9 +75,9 @@ public:
|
||||
public: \
|
||||
enum { TypeIsShareable = 1 }; \
|
||||
Shareable() {} \
|
||||
Shareable(T const& rhs) { m = rhs; } \
|
||||
operator const T() const { return m; } \
|
||||
const T _Unwrap() const { return m; } \
|
||||
Shareable(T const& rhs) : m(rhs) {} \
|
||||
operator T() const { return m; } \
|
||||
T _Unwrap() const { return m; } \
|
||||
}
|
||||
|
||||
SHAREABLE_PRIMITIVE(unsigned char);
|
||||
|
Loading…
Reference in New Issue
Block a user