|
|
@@ -385,7 +385,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
|
|
|
|
|
|
|
|
|
|
|
/* create a fullscreen window */
|
|
|
|
/* create a fullscreen window */
|
|
|
|
GLWin.attr.override_redirect = True;
|
|
|
|
GLWin.attr.override_redirect = True;
|
|
|
|
GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask;
|
|
|
|
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask;
|
|
|
|
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
|
|
|
|
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
|
|
|
|
0, 0, dpyWidth, dpyHeight, 0, vi->depth, InputOutput, vi->visual,
|
|
|
|
0, 0, dpyWidth, dpyHeight, 0, vi->depth, InputOutput, vi->visual,
|
|
|
|
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
|
|
|
|
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
|
|
|
@@ -393,7 +393,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
|
|
|
XWarpPointer(GLWin.dpy, None, GLWin.win, 0, 0, 0, 0, 0, 0);
|
|
|
|
XWarpPointer(GLWin.dpy, None, GLWin.win, 0, 0, 0, 0, 0, 0);
|
|
|
|
XMapRaised(GLWin.dpy, GLWin.win);
|
|
|
|
XMapRaised(GLWin.dpy, GLWin.win);
|
|
|
|
XGrabKeyboard(GLWin.dpy, GLWin.win, True, GrabModeAsync, GrabModeAsync, CurrentTime);
|
|
|
|
XGrabKeyboard(GLWin.dpy, GLWin.win, True, GrabModeAsync, GrabModeAsync, CurrentTime);
|
|
|
|
XGrabPointer(GLWin.dpy, GLWin.win, True, ButtonPressMask,
|
|
|
|
XGrabPointer(GLWin.dpy, GLWin.win, True, NULL,
|
|
|
|
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
|
|
|
|
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@@ -413,7 +413,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
|
|
|
//int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
|
|
|
//int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
|
|
|
|
|
|
|
|
|
|
|
// create a window in window mode
|
|
|
|
// create a window in window mode
|
|
|
|
GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask |
|
|
|
|
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
|
|
|
StructureNotifyMask | ResizeRedirectMask;
|
|
|
|
StructureNotifyMask | ResizeRedirectMask;
|
|
|
|
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
|
|
|
|
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
|
|
|
|
0, 0, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual,
|
|
|
|
0, 0, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual,
|
|
|
@@ -425,6 +425,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
|
|
|
"GPU", None, NULL, 0, NULL);
|
|
|
|
"GPU", None, NULL, 0, NULL);
|
|
|
|
XMapRaised(GLWin.dpy, GLWin.win);
|
|
|
|
XMapRaised(GLWin.dpy, GLWin.win);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_VideoInitialize.pXWindow = (Window *) &GLWin.win;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -455,8 +456,8 @@ bool OpenGL_MakeCurrent()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// better for pad plugin key input (thc)
|
|
|
|
// better for pad plugin key input (thc)
|
|
|
|
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask |
|
|
|
|
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
|
|
|
FocusChangeMask );
|
|
|
|
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -507,7 +508,6 @@ void OpenGL_Update()
|
|
|
|
// We just check all of our events here
|
|
|
|
// We just check all of our events here
|
|
|
|
XEvent event;
|
|
|
|
XEvent event;
|
|
|
|
KeySym key;
|
|
|
|
KeySym key;
|
|
|
|
static RECT rcWindow;
|
|
|
|
|
|
|
|
static bool ShiftPressed = false;
|
|
|
|
static bool ShiftPressed = false;
|
|
|
|
static bool ControlPressed = false;
|
|
|
|
static bool ControlPressed = false;
|
|
|
|
static int FKeyPressed = -1;
|
|
|
|
static int FKeyPressed = -1;
|
|
|
@@ -525,8 +525,6 @@ void OpenGL_Update()
|
|
|
|
ShiftPressed = false;
|
|
|
|
ShiftPressed = false;
|
|
|
|
else if(key == XK_Control_L || key == XK_Control_R)
|
|
|
|
else if(key == XK_Control_L || key == XK_Control_R)
|
|
|
|
ControlPressed = false;
|
|
|
|
ControlPressed = false;
|
|
|
|
else
|
|
|
|
|
|
|
|
XPutBackEvent(GLWin.dpy, &event);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case KeyPress:
|
|
|
|
case KeyPress:
|
|
|
@@ -538,13 +536,10 @@ void OpenGL_Update()
|
|
|
|
ShiftPressed = true;
|
|
|
|
ShiftPressed = true;
|
|
|
|
else if(key == XK_Control_L || key == XK_Control_R)
|
|
|
|
else if(key == XK_Control_L || key == XK_Control_R)
|
|
|
|
ControlPressed = true;
|
|
|
|
ControlPressed = true;
|
|
|
|
else
|
|
|
|
|
|
|
|
XPutBackEvent(GLWin.dpy, &event);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ButtonPress:
|
|
|
|
case ButtonPress:
|
|
|
|
case ButtonRelease:
|
|
|
|
case ButtonRelease:
|
|
|
|
XPutBackEvent(GLWin.dpy, &event);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ConfigureNotify:
|
|
|
|
case ConfigureNotify:
|
|
|
|
Window winDummy;
|
|
|
|
Window winDummy;
|
|
|
@@ -553,20 +548,13 @@ void OpenGL_Update()
|
|
|
|
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
|
|
|
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
|
|
|
s_backbuffer_width = GLWin.width;
|
|
|
|
s_backbuffer_width = GLWin.width;
|
|
|
|
s_backbuffer_height = GLWin.height;
|
|
|
|
s_backbuffer_height = GLWin.height;
|
|
|
|
rcWindow.left = 0;
|
|
|
|
|
|
|
|
rcWindow.top = 0;
|
|
|
|
|
|
|
|
rcWindow.right = GLWin.width;
|
|
|
|
|
|
|
|
rcWindow.bottom = GLWin.height;
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though
|
|
|
|
case ClientMessage:
|
|
|
|
Shutdown(); // Calling from here since returning false does nothing
|
|
|
|
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
|
|
|
|
|
|
|
|
g_VideoInitialize.pKeyPress(0x1b, False, False);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
//TODO: Should we put the event back if we don't handle it?
|
|
|
|
|
|
|
|
// I think we handle all the needed ones, the rest shouldn't matter
|
|
|
|
|
|
|
|
// But to be safe, let's but them back anyway
|
|
|
|
|
|
|
|
//XPutBackEvent(GLWin.dpy, &event);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -614,11 +602,12 @@ void OpenGL_Shutdown()
|
|
|
|
if ((GLWin.dpy != NULL) && GLWin.fs) {
|
|
|
|
if ((GLWin.dpy != NULL) && GLWin.fs) {
|
|
|
|
XUngrabKeyboard (GLWin.dpy, CurrentTime);
|
|
|
|
XUngrabKeyboard (GLWin.dpy, CurrentTime);
|
|
|
|
XUngrabPointer (GLWin.dpy, CurrentTime);
|
|
|
|
XUngrabPointer (GLWin.dpy, CurrentTime);
|
|
|
|
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
|
|
|
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
|
|
|
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
|
|
|
|
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
|
|
|
|
XRRFreeScreenConfigInfo(GLWin.screenConfig);
|
|
|
|
XRRFreeScreenConfigInfo(GLWin.screenConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
printf ("Unmapping window\n");
|
|
|
|
if (GLWin.ctx)
|
|
|
|
if (GLWin.ctx)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!glXMakeCurrent(GLWin.dpy, None, NULL))
|
|
|
|
if (!glXMakeCurrent(GLWin.dpy, None, NULL))
|
|
|
|