Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorvald Natvig <slicer@users.sourceforge.net>2008-03-11 20:53:06 +0300
committerThorvald Natvig <slicer@users.sourceforge.net>2008-03-11 20:53:06 +0300
commitb5a49637d32a182e69f80d96dea395b48180a92a (patch)
tree419d7dc630ec956019efffbf93677a1fbe6bc1ec /overlay_gl
parent361d01ff7cd297c2d0264f918500196af3b0e6e2 (diff)
Add version checking to overlay
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@976 05730e5d-ab1b-0410-a4ac-84af385074fa
Diffstat (limited to 'overlay_gl')
-rw-r--r--overlay_gl/overlay.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/overlay_gl/overlay.c b/overlay_gl/overlay.c
index 10ab44a9b..25c4224e4 100644
--- a/overlay_gl/overlay.c
+++ b/overlay_gl/overlay.c
@@ -91,6 +91,9 @@ static void resolveOpenGL() {
}
static void resolveSM() {
+ static bool warned_sm = false;
+ static bool warned_ver = false;
+
int fd = shm_open("/MumbleOverlayMem", O_RDWR, 0600);
if (fd >= 0) {
sm = (struct SharedMem *)(mmap(NULL, sizeof(struct SharedMem), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
@@ -98,14 +101,40 @@ static void resolveSM() {
sm = NULL;
close(fd);
} else {
- sem = sem_open("/MumbleOverlaySem", 0);
- if (sem == SEM_FAILED) {
+ if ((sm->version[0] != OVERLAY_VERSION_MAJ) ||
+ (sm->version[1] != OVERLAY_VERSION_MIN) ||
+ (sm->version[2] != OVERLAY_VERSION_PATCH)) {
+ if (! warned_ver) {
+ fflush(stderr);
+ fprintf(stderr, "MUMBLE OVERLAY:: Version mismatch. Library is %u.%u.%u.%u, application is %u.%u.%u.%u\n",
+ OVERLAY_VERSION_MAJ, OVERLAY_VERSION_MIN, OVERLAY_VERSION_PATCH, OVERLAY_VERSION_SUB,
+ sm->version[0], sm->version[1], sm->version[2], sm->version[3]
+ );
+ fflush(stderr);
+ warned_ver = true;
+ }
munmap(sm, sizeof(struct SharedMem));
sm = NULL;
close(fd);
+ } else {
+ sem = sem_open("/MumbleOverlaySem", 0);
+ if (sem == SEM_FAILED) {
+ munmap(sm, sizeof(struct SharedMem));
+ sm = NULL;
+ close(fd);
+ }
}
}
}
+
+ if (sm == NULL) {
+ if (! warned_sm && ! warned_ver) {
+ fflush(stderr);
+ fprintf(stderr, "MUMBLE OVERLAY:: NO CONTACT WITH MUMBLE\n");
+ fflush(stderr);
+ warned_sm = true;
+ }
+ }
}
__attribute__((format(printf, 1, 2)))
@@ -176,11 +205,11 @@ static void drawContext(Context * ctx, Display * dpy, GLXDrawable draw) {
// DEBUG
// sm->bDebug = true;
- unsigned int width, height;
+ int width, height;
int i;
- glXQueryDrawable(dpy, draw, GLX_WIDTH, &width);
- glXQueryDrawable(dpy, draw, GLX_HEIGHT, &height);
+ glXQueryDrawable(dpy, draw, GLX_WIDTH, (unsigned int *) &width);
+ glXQueryDrawable(dpy, draw, GLX_HEIGHT, (unsigned int *) &height);
ods("DrawStart: Screen is %d x %d", width, height);
@@ -334,7 +363,7 @@ void glXSwapBuffers(Display * dpy, GLXDrawable draw) {
contexts = c;
- int attrib[4] = { GLX_FBCONFIG_ID, -1, 0, 0 };
+ int attrib[4] = { GLX_FBCONFIG_ID, -1, None, None };
glXQueryContext(dpy, ctx, GLX_FBCONFIG_ID, &attrib[1]);
int screen = -1;
@@ -346,8 +375,6 @@ void glXSwapBuffers(Display * dpy, GLXDrawable draw) {
GLXFBConfig *fb = glXChooseFBConfig(dpy, screen, attrib, &nelem);
ods("ChooseFB returned %d elems: %p\n", nelem, fb);
- GLXContext myctx = NULL;
-
if (fb) {
GLXContext myctx = glXCreateNewContext(dpy, *fb, GLX_RGBA_TYPE, NULL, 1);
ods("Got Context %p\n", myctx);
@@ -366,12 +393,6 @@ void glXSwapBuffers(Display * dpy, GLXDrawable draw) {
drawContext(c, dpy, draw);
glXMakeCurrent(dpy, draw, ctx);
}
- } else {
- static bool warned = false;
- if (!warned) {
- ods("MUMBLE OVERLAY:: NO CONTACT WITH MUMBLE\n");
- warned = true;
- }
}
oglXSwapBuffers(dpy, draw);
}