stub.c revision 648dd7edbbd133f10d5213c7a0d66414c8c3873c
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington/* Copyright (c) 2001, Stanford University
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington * All rights reserved
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington * See the file LICENSE.txt for information on redistributing this software.
af38905e8a5231702db169603d942d5d2e0c4332David Luna stub.spu->dispatch_table.GetIntegerv(GL_DRAW_BUFFER, &buffer);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington stub.spu->dispatch_table.DrawBuffer(GL_FRONT);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington stub.spu->dispatch_table.DrawBuffer(buffer);
af38905e8a5231702db169603d942d5d2e0c4332David Luna * Returns -1 on error
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill CunningtonGLint APIENTRY crCreateContext( const char *dpyName, GLint visBits )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington /* XXX in Chromium 1.5 and earlier, the last parameter was UNDECIDED.
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington * That didn't seem right so it was changed to CHROMIUM. (Brian)
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington context = stubNewContext(dpyName, visBits, CHROMIUM, 0);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunningtonvoid APIENTRY crDestroyContext( GLint context )
77a123fe3fd0188a9552995da5a36a9f70b0d36fPhill Cunningtonvoid APIENTRY crMakeCurrent( GLint window, GLint context )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableSearch(stub.windowTable, (unsigned int) window);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableSearch(stub.contextTable, context);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington if (contextInfo && contextInfo->type == NATIVE) {
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crWarning("Can't call crMakeCurrent with native GL context");
abba466207a7a0932f2e83e44989ac71b58e1269Brian Bailey if (stub.currentContext && stub.currentContext->currentDrawable)
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington return stub.currentContext->currentDrawable->spuWindow;
af38905e8a5231702db169603d942d5d2e0c4332David Lunavoid APIENTRY crSwapBuffers( GLint window, GLint flags )
af38905e8a5231702db169603d942d5d2e0c4332David Luna crHashtableSearch(stub.windowTable, (unsigned int) window);
af38905e8a5231702db169603d942d5d2e0c4332David Luna * Returns -1 on error
af38905e8a5231702db169603d942d5d2e0c4332David LunaGLint APIENTRY crWindowCreate( const char *dpyName, GLint visBits )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunningtonvoid APIENTRY crWindowDestroy( GLint window )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableSearch(stub.windowTable, (unsigned int) window);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington if (winInfo && winInfo->type == CHROMIUM && stub.spu) {
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington stub.spu->dispatch_table.WindowDestroy( winInfo->spuWindow );
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington if (winInfo->hVisibleRegion != INVALID_HANDLE_VALUE)
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableDelete(stub.windowTable, window, crFree);
d4f49965121892f04f785a9a695fd709b929e9cfJames Phillpottsvoid APIENTRY crWindowSize( GLint window, GLint w, GLint h )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington const WindowInfo *winInfo = (const WindowInfo *)
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableSearch(stub.windowTable, (unsigned int) window);
c0202e5a338212ae386c672821f6dc4931c50f45James Phillpotts crDebug("Dispatched crWindowSize (%i)", window);
c0202e5a338212ae386c672821f6dc4931c50f45James Phillpotts stub.spu->dispatch_table.WindowSize( window, w, h );
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunningtonvoid APIENTRY crWindowPosition( GLint window, GLint x, GLint y )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington const WindowInfo *winInfo = (const WindowInfo *)
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableSearch(stub.windowTable, (unsigned int) window);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crDebug("Dispatched crWindowPosition (%i)", window);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington stub.spu->dispatch_table.WindowPosition( window, x, y );
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunningtonvoid APIENTRY crWindowVisibleRegion( GLint window, GLint cRects, void *pRects )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington const WindowInfo *winInfo = (const WindowInfo *)
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableSearch(stub.windowTable, (unsigned int) window);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crDebug("Dispatched crWindowVisibleRegion (%i, cRects=%i)", window, cRects);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington stub.spu->dispatch_table.WindowVisibleRegion( window, cRects, pRects );
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunningtonvoid APIENTRY crWindowShow( GLint window, GLint flag )
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington crHashtableSearch(stub.windowTable, (unsigned int) window);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington stub.spu->dispatch_table.WindowShow( window, flag );
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington winInfo->mapped = flag ? GL_TRUE : GL_FALSE;
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunningtonvoid APIENTRY stub_GetChromiumParametervCR( GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid *values )
33908fb93167e643fbb21b47d87c5b632df0dc59Phill Cunnington stub.spu->dispatch_table.GetChromiumParametervCR( target, index, type, count, values );
33908fb93167e643fbb21b47d87c5b632df0dc59Phill Cunnington * Updates geometry info for given spu window.
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington * Returns GL_TRUE if it changed since last call, GL_FALSE overwise.
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington * bForceUpdate - forces dispatching of geometry info even if it's unchanged
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill CunningtonGLboolean stubUpdateWindowGeometry(WindowInfo *pWindow, GLboolean bForceUpdate)
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington stubGetWindowGeometry(pWindow, &winX, &winY, &winW, &winH);
756d4b8bce5a58e5bd8fe686688b6c42d2e7052bPhill Cunnington /* @todo remove "if (winW && winH)"?*/
abba466207a7a0932f2e83e44989ac71b58e1269Brian Bailey if (bForceUpdate || winW != pWindow->width || winH != pWindow->height) {
abba466207a7a0932f2e83e44989ac71b58e1269Brian Bailey crDebug("Dispatched WindowSize (%i)", pWindow->spuWindow);
abba466207a7a0932f2e83e44989ac71b58e1269Brian Bailey stub.spuDispatch.WindowSize(pWindow->spuWindow, winW, winH);
abba466207a7a0932f2e83e44989ac71b58e1269Brian Bailey if (bForceUpdate || winX != pWindow->x || winY != pWindow->y) {
abba466207a7a0932f2e83e44989ac71b58e1269Brian Bailey crDebug("Dispatched WindowPosition (%i)", pWindow->spuWindow);
abba466207a7a0932f2e83e44989ac71b58e1269Brian Bailey stub.spuDispatch.WindowPosition(pWindow->spuWindow, winX, winY);
return res;
#ifdef WINDOWS
int iret;
pt.x = 0;
pt.y = 0;
crDebug("Rgn[%d] = (%d, %d, %d, %d)", i, pRects[i].left, pRects[i].top, pRects[i].right, pRects[i].bottom);
if (lpRgnData)
crDebug("Dispatched WindowVisibleRegion (%i, cRects=%i)", pWindow->spuWindow, lpRgnData->rdh.nCount);
stub.spuDispatch.WindowVisibleRegion(pWindow->spuWindow, lpRgnData->rdh.nCount, (GLint*) lpRgnData->Buffer);
return GL_TRUE;
return GL_FALSE;
(void) key;
case WM_MOVING:
case WM_SIZING:
case WM_MOVE:
case WM_CREATE:
case WM_SIZE:
case WM_SHOWWINDOW:
case WM_ACTIVATEAPP:
case WM_PAINT:
case WM_NCPAINT:
case WM_NCACTIVATE:
case WM_ERASEBKGND:
#ifdef CHROMIUM_THREADSAFE
case WM_MOVING:
case WM_SIZING:
case WM_MOVE:
case WM_ACTIVATEAPP:
case WM_NCPAINT:
case WM_NCACTIVATE:
case WM_ERASEBKGND:
case WM_CREATE:
case WM_SIZE:
case WM_SHOWWINDOW:
#ifdef CHROMIUM_THREADSAFE
void stubInstallWindowMessageHook()
stub.hMessageHook = SetWindowsHookEx(WH_CALLWNDPROCRET, stubCBWindowMessageHookProc, 0, crThreadID());
vma=0;
vmi=0;
return GL_TRUE;
return GL_FALSE;
int cRects, i;
return GL_FALSE;
* it seems there's no way to get even based updates for this. Or I've failed to find the appropriate extension.
/* @todo For some odd reason *first* run of compiz on freshly booted VM gives us 0 cRects all the time.
* In (!pWindow->pVisibleRegions && cRects) "&& cRects" is a workaround for that case, especially as this
|| (pWindow->pVisibleRegions && crMemcmp(pWindow->pVisibleRegions, pXRects, cRects * sizeof(XRectangle))))
if (!pGLRects)
return GL_FALSE;
for (i=0; i<cRects; ++i)
//crDebug("Rect[%i]=(%i,%i,%i,%i)", i, pGLRects[4*i+0], pGLRects[4*i+1], pGLRects[4*i+2], pGLRects[4*i+3]);
return GL_TRUE;
return GL_FALSE;