wills | 23 Feb 11:17
Picon

agar 1.4 patch for wgl driver

Hi,

There are some errors when compile agar-1.4 from svn on msys for wgl driver, i
make a patch as follows, this patch only fixes compile-time errors, moreover, 
this driver depend on gdi32 libaray, i modify configure scripts (add
WGL_LIBS="${OPENGL_LIBS} -lgdi32") for this issue, but this is not a recommended
method 

--- D:/tmp/agar/drv_wgl.c	Tue Feb 23 17:51:12 2010
+++ D:/tmp/agar/build/agar/gui/drv_wgl.c	Mon Feb 22 11:59:20 2010
@@ -31,6 +31,10 @@
 #include <config/have_wgl.h>
 #ifdef HAVE_WGL

+#if (WINVER < 0x0500)
+#define WINVER 0x0500
+#endif
+
 // XXX
 #include <windows.h>
 #undef SLIST_ENTRY // @todo core_close?
@@ -92,6 +96,7 @@
 static void      InitClipRect0(AG_DriverWGL *wgl, AG_Window *win);
 static int       InitDefaultCursor(AG_DriverWGL *wgl);
 static void      WGL_PostResizeCallback(AG_Window *win, AG_SizeAlloc *a);
+static void      WGL_PostMoveCallback(AG_Window *win, AG_SizeAlloc *a);

 void
 _SetWindowsError(char* errorMessage, DWORD errorCode)
@@ -784,7 +789,7 @@
 {
 	AG_ClipRect *cr;

-	cr = &glx->clipRects[0];
+	cr = &wgl->clipRects[0];
 	cr->r.w = WIDTH(win);
 	cr->r.h = HEIGHT(win);
 	cr->eqns[2][3] = (double)WIDTH(win);
@@ -927,7 +932,7 @@
 WGL_MoveResizeWindow(AG_Window *win, AG_SizeAlloc *a)
 {
 	AG_DriverWGL *wgl = (AG_DriverWGL *)WIDGET(win)->drv;
-	AG_SizeAlloc a;
+	AG_SizeAlloc aa;

 	SetWindowPos(wgl->hwnd, NULL, a->x, a->y, a->w, a->h, SWP_NOZORDER);	
 	WGL_PostResizeCallback(win, a);
@@ -1077,12 +1082,16 @@
 {
 	AG_Driver *drv = obj;
 	AG_DriverWGL *wgl = obj;
+	AG_Cursor *ac;
+	AG_CursorWGL *cg;
 	
 	if (drv->activeCursor == &drv->cursors[0]) {
 		return;
 	}
 	SetCursor(LoadCursor(NULL, IDC_ARROW));
 	drv->activeCursor = &drv->cursors[0];
+	ac = drv->activeCursor;
+	cg = ac->p;
 	cg->visible = 1;
 }

Best Regargs
Wills

Gmane