Example #1
0
void notify_mousemove_screensandwindows(WORD x,
                                        WORD y,
                                        struct IntuitionBase * IntuitionBase)
{
    LONG    	   lock = LockIBase(0);
    struct Screen *scr = IntuitionBase->FirstScreen;

    while (NULL != scr)
    {
        struct Window * win = scr->FirstWindow;

        scr->MouseX = x;// - scr->LeftEdge;
        scr->MouseY = y;// - scr->TopEdge;

        /*
        ** Visit all windows of this screen
        */

        while (NULL != win)
        {
            UpdateMouseCoords(win);

            win = win -> NextWindow;
        }

        scr = scr->NextScreen;
    }

    UnlockIBase(lock);
}
Example #2
0
__saveds void ErrorProcess(void)
{
	char constring[200];
	BPTR file=NULL;
	ULONG sig;
	ULONG lock;
	ErrorSig=AllocSignal(ErrorSig);
	hassent=1;
	errorprocessalive=1;
	ErrorTask=FindTask(NULL);

	sprintf(constring,"CON:%d/%d/%d/%d/%s/SCREEN%s",20,20,500,300,"radium.nfo",screenname);

	for(;;){
		sig=Wait(1L<<ErrorSig|SIGBREAKF_CTRL_C);
		if(sig&1L<<ErrorSig){
			if(file==NULL){
				file=Open(constring,0x3ee);
			}
			if(file!=NULL && errorwindow==NULL){
				if(mainscreen!=NULL){
					struct Window *tempwindow;
					lock=LockIBase(0);
						tempwindow=mainscreen->FirstWindow;
						for(;;){
							if(tempwindow==NULL) break;
							if(!strcmp(tempwindow->Title,"radium.nfo")){
								errorwindow=tempwindow;
								break;
							}
							tempwindow=tempwindow->NextWindow;
						}
					UnlockIBase(lock);
 				}
			}

			if(file==NULL){
				fprintf(stderr,errorstring);
			}else{
				FPuts(file,errorstring);
			}
			hassent=1;

			if(errorwindow!=NULL){
				WindowToFront(errorwindow);
			}
		}
		if(sig&SIGBREAKF_CTRL_C) break;
	}

	if(file!=NULL){
		Close(file);
	}
	FreeSignal(ErrorSig);
}
Example #3
0
long HandleMouseCheck(void)
{
	long MouseX, MouseY, Lock, Width, Height;

	BlankingDisabled = FALSE;

	Lock = LockIBase(0L);

	MouseX = IntuitionBase->MouseX;
	MouseY = IntuitionBase->MouseY;
	if(IntuitionBase->FirstScreen)
	{
		Width = IntuitionBase->FirstScreen->Width - 1;
		Height = IntuitionBase->FirstScreen->Height - 1;
	}
	else
	{
		Width = ~0L;
		Height = ~0L;
	}
	
	UnlockIBase(Lock);

	switch(Prefs->bp_BlankCorner)
	{
	case BC_UPPERLEFT:
		if(!MouseX && !MouseY)
			timeCount = Prefs->bp_Timeout - 5;
		break;
	case BC_UPPERRIGHT:
		if(!MouseY && MouseX == Width)
			timeCount = Prefs->bp_Timeout - 5;
		break;
	case BC_LOWERRIGHT:	
		if(MouseX == Width && MouseY == Height)
			timeCount = Prefs->bp_Timeout - 5;
	   	break;
	case BC_LOWERLEFT:
		if(!MouseX && MouseY == Height)
			timeCount = Prefs->bp_Timeout - 5;
		break;
	}

	switch(Prefs->bp_DontCorner)
	{
	case BC_UPPERLEFT:
		if(!MouseX && !MouseY)
			BlankingDisabled = TRUE;
		break;
	case BC_UPPERRIGHT:
		if(!MouseY && MouseX == Width)
			BlankingDisabled = TRUE;
		break;
	case BC_LOWERRIGHT:	
		if(MouseX == Width && MouseY == Height)
			BlankingDisabled = TRUE;
	   	break;
	case BC_LOWERLEFT:
		if(!MouseX && MouseY == Height)
			BlankingDisabled = TRUE;
		break;
	}

	return OK;
}
Example #4
0
// Check that a screen can close if Opus disappears
BOOL check_closescreen(struct Screen *screen)
{
	ULONG lock;
	struct Window *window=0;
	TimerHandle *timer=0;
	short a;

	// Try this four times
	for (a=0;a<4;a++)
	{
		// Lock IntuitionBase
		lock=LockIBase(0);

		// Go through window list
		for (window=screen->FirstWindow;
			window;
			window=window->NextWindow)
		{
			// Not a Workbench tool window?
			if (!(window->Flags&WFLG_WBENCHWINDOW))
			{
				// If this is one of Opus', GetWindowID() should know about it
				if (GetWindowID(window)==WINDOW_UNKNOWN)
				{
					BOOL ok=0;
					struct Task *task=0;

					// Special case for IPrefs requester - get window's task
					if (window->UserPort)
						task=(struct Task *)window->UserPort->mp_SigTask;

					// Valid name?
					if (task && task->tc_Node.ln_Name)
					{
						// Owned by IPrefs?
						if (strcmp(task->tc_Node.ln_Name,"« IPrefs »")==0) ok=1;
					}

					// If not ok, fail
					if (!ok) break;
				}
			}
		}

		// Unlock IntuitionBase
		UnlockIBase(lock);

		// Ok to shut?
		if (!window) break;

		// Allocate timer if don't already have it
		if (!timer &&
			!(timer=AllocTimer(UNIT_VBLANK,0))) break;

		// Start timer and wait for it
		StartTimer(timer,0,250000);
		while (!CheckTimer(timer))
			WaitPort(timer->port);
	}

	// Free timer
	FreeTimer(timer);

	// If window==NULL we can shut
	return (BOOL)(!window);
}