fixes for OSX

This commit is contained in:
Vadim Lopatin 2015-12-19 07:52:19 +03:00
parent 88a7aaf7f2
commit c7964762c4
2 changed files with 13 additions and 4 deletions

View File

@ -150,8 +150,14 @@ class SDLWindow : Window {
static if (ENABLE_OPENGL) { static if (ENABLE_OPENGL) {
if (_enableOpengl) if (_enableOpengl)
windowFlags |= SDL_WINDOW_OPENGL; windowFlags |= SDL_WINDOW_OPENGL;
if (!_glSupport) if (!_glSupport) {
_glSupport = new GLSupport(); version(OSX) {
bool useLegacyOpengl = true;
} else {
bool useLegacyOpengl = false;
}
_glSupport = new GLSupport(useLegacyOpengl);
}
} }
_win = SDL_CreateWindow(toUTF8(_caption).toStringz, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, _win = SDL_CreateWindow(toUTF8(_caption).toStringz, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
_dx, _dy, _dx, _dy,

View File

@ -214,18 +214,21 @@ class X11Window : DWindow {
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ExposureMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ExposureMask | VisibilityChangeMask |
FocusChangeMask | KeymapStateMask | StructureNotifyMask; FocusChangeMask | KeymapStateMask | StructureNotifyMask;
Visual * visual = DefaultVisual(x11display, x11screen); Visual * visual = DefaultVisual(x11display, x11screen);
int depth = DefaultDepth(x11display, x11screen);
static if (ENABLE_OPENGL) { static if (ENABLE_OPENGL) {
if (_enableOpengl) { if (_enableOpengl) {
swamask |= CWColormap; swamask |= CWColormap;
swa.colormap = x11cmap; swa.colormap = x11cmap;
visual = cast(Visual*)x11visual.visual; visual = cast(Visual*)x11visual.visual;
depth = x11visutal.depth;
} }
} }
_win = XCreateWindow(x11display, DefaultRootWindow(x11display), _win = XCreateWindow(x11display, DefaultRootWindow(x11display),
0, 0, 0, 0,
_dx, _dy, 0, _dx, _dy, 0,
x11visual.depth, InputOutput, depth,
InputOutput,
visual, visual,
swamask, swamask,
&swa); &swa);