if (pipWindow)
{
// Yay, we have overlay!
}
else
{
switch (error)
{
case PIPERR_NOMEMORY:
printf("PIPERR_NOMEMORY\n");
break; /* couldn't get normal memory */
case PIPERR_ATTACHFAIL:
printf("PIPERR_ATTACHFAIL\n");
break; /* Failed to attach to a screen */
case PIPERR_NOTAVAILABLE:
printf("PIPERR_NOTAVAILABLE\n");
break; /* PIP not available for other reason */
case PIPERR_OUTOFPENS:
printf("PIPERR_OUTOFPENS\n");
break; /* couldn't get a free pen for occlusion */
case PIPERR_BADDIMENSIONS:
printf("PIPERR_BADDIMENSIONS\n");
break; /* type, width, height or format invalid */
case PIPERR_NOWINDOW:
printf("PIPERR_NOWINDOW\n");
break; /* couldn't open window */
case PIPERR_BADALIGNMENT:
printf("PIPERR_BADALIGNMENT\n");
break; /* specified alignment is not ok */
case PIPERR_CROPPED:
printf("PIPERR_CROPPED\n");
break;
}
Perhaps you should set WA_Activate to FALSE and WA_Hidden to TRUE to avoid that the window becomes visible and takes away the focus of another active window if the function is just there to check if overlay is possible at all.
if (pipWindow)
{
printf("Yeah, we have overlay!\n");
CloseWindow(pipWindow);
quit();
}
else
{
switch (error)
{
case PIPERR_NOMEMORY:
printf("PIPERR_NOMEMORYn");
break; /* couldn't get normal memory */
case PIPERR_ATTACHFAIL:
printf("PIPERR_ATTACHFAILn");
break; /* Failed to attach to a screen */
case PIPERR_NOTAVAILABLE:
printf("PIPERR_NOTAVAILABLEn");
break; /* PIP not available for other reason */
case PIPERR_OUTOFPENS:
printf("PIPERR_OUTOFPENSn");
break; /* couldn't get a free pen for occlusion */
case PIPERR_BADDIMENSIONS:
printf("PIPERR_BADDIMENSIONSn");
break; /* type, width, height or format invalid */
case PIPERR_NOWINDOW:
printf("PIPERR_NOWINDOWn");
break; /* couldn't open window */
case PIPERR_BADALIGNMENT:
printf("PIPERR_BADALIGNMENTn");
break; /* specified alignment is not ok */
case PIPERR_CROPPED:
printf("PIPERR_CROPPEDn");
break;
}
}
}
int quit()
{
if (P96Base) {
DropInterface((struct Interface*)IP96);
CloseLibrary(P96Base);
P96Base = NULL;
}
return 0;
}
Once i run it first time, i have "yeah, we have overlay!", but if i just run it second (or third, or does not matter how many times since first run) i have "PIERR_NOTAVAILABLE". If i reboot, and run it again, then first run all is fine, and all other ones again the same.
@Thore Right :) Just was in hope CloseWindow(pipWindow) will deal with p96_pip one as well. Replaced with p96_Close(pipWindow) and all works now. Thanks for tip!