| 1152 | |
| 1153 | |
| 1154 | EGLBoolean eglMakeCurrent(EGLDisplay display, EGLSurface draw, EGLSurface read, |
| 1155 | EGLContext context) |
| 1156 | { |
| 1157 | EGLBoolean retval = EGL_FALSE; |
| 1158 | EGLSurface actualDraw = draw, actualRead = read; |
| 1159 | |
| 1160 | TRY(); |
| 1161 | |
| 1162 | if(IS_EXCLUDED_EGLX(display)) |
| 1163 | { |
| 1164 | faker::setEGLExcludeCurrent(true); |
| 1165 | faker::setOGLExcludeCurrent(true); |
| 1166 | faker::setEGLXContextCurrent(false); |
| 1167 | faker::setCurrentEGLXDisplay(NULL); |
| 1168 | return _eglMakeCurrent(display, draw, read, context); |
| 1169 | } |
| 1170 | faker::setEGLExcludeCurrent(false); |
| 1171 | faker::setOGLExcludeCurrent(false); |
| 1172 | |
| 1173 | GET_DISPLAY() |
| 1174 | if(!eglxdpy->isInit && context) |
| 1175 | { |
| 1176 | faker::setEGLError(EGL_NOT_INITIALIZED); goto bailout; \ |
| 1177 | } |
| 1178 | DISABLE_FAKER(); |
| 1179 | |
| 1180 | ///////////////////////////////////////////////////////////////////////////// |
| 1181 | OPENTRACE(eglMakeCurrent); PRARGX(display); PRARGX(draw); PRARGX(read); |
| 1182 | PRARGX(context); STARTTRACE(); |
| 1183 | ///////////////////////////////////////////////////////////////////////////// |
| 1184 | |
| 1185 | faker::EGLXVirtualWin *drawEGLXVW = EGLXWINHASH.find(eglxdpy, draw); |
| 1186 | if(drawEGLXVW) |
| 1187 | { |
| 1188 | actualDraw = (EGLSurface)drawEGLXVW->updateGLXDrawable(); |
| 1189 | setWMAtom(drawEGLXVW->getX11Display(), drawEGLXVW->getX11Drawable(), |
| 1190 | drawEGLXVW); |
| 1191 | } |
| 1192 | faker::EGLXVirtualWin *readEGLXVW = EGLXWINHASH.find(eglxdpy, read); |
| 1193 | if(readEGLXVW) |
| 1194 | { |
| 1195 | actualRead = (EGLSurface)readEGLXVW->updateGLXDrawable(); |
| 1196 | if(readEGLXVW != drawEGLXVW) |
| 1197 | setWMAtom(readEGLXVW->getX11Display(), readEGLXVW->getX11Drawable(), |
| 1198 | readEGLXVW); |
| 1199 | } |
| 1200 | retval = _eglMakeCurrent(display, actualDraw, actualRead, context); |
| 1201 | |
| 1202 | if((drawEGLXVW = EGLXWINHASH.findInternal(eglxdpy, actualDraw)) != NULL) |
| 1203 | { |
| 1204 | drawEGLXVW->clear(); drawEGLXVW->cleanup(); |
| 1205 | } |
| 1206 | if((readEGLXVW = EGLXWINHASH.findInternal(eglxdpy, actualRead)) != NULL) |
| 1207 | readEGLXVW->cleanup(); |
| 1208 | |
| 1209 | if(context && retval) |
| 1210 | { |
| 1211 | // Disable the OpenGL interposer |
no test coverage detected