예제 #1
0
// QuitRequested
bool
NavigationInfoPanel::QuitRequested()
{
	_Invoke();
	Hide();
	return false;
}
예제 #2
0
// MessageReceived
void
NavigationInfoPanel::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case MSG_INVOKE:
			_Invoke();
			break;
		default:
			BWindow::MessageReceived(message);
	}
}
예제 #3
0
void
ScreenSaverFilter::CheckCornerInvoke()
{
	BAutolock _(this);

	bigtime_t inactivity = system_time() - fLastEventTime;

	if (fCurrentCorner == fBlankCorner && fBlankCorner != NO_CORNER
		&& inactivity >= kCornerDelay)
		_Invoke();
}
예제 #4
0
filter_result
ScreenSaverFilter::Filter(BMessage *message, BList *outList)
{
	BAutolock _(this);

	fLastEventTime = system_time();

	switch (message->what) {
		case B_MOUSE_MOVED:
		{
			BPoint where;
			if (message->FindPoint("where", &where) != B_OK)
				break;

			if ((fFrameNum++ % 32) == 0) {
				// Every so many frames, update
				// Used so that we don't update the screen coord's so often
				// Ideally, we would get a message when the screen changes.
				// R5 doesn't do this.
				_UpdateRectangles();
			}

			if (fBlankRect.Contains(where)) {
				fCurrentCorner = fBlankCorner;

				// start screen blanker after one second of inactivity
				if (fCornerRunner != NULL
					&& fCornerRunner->SetInterval(kCornerDelay) != B_OK)
					_Invoke();
				break;
			}

			if (fNeverBlankRect.Contains(where))
				fCurrentCorner = fNeverBlankCorner;
			else
				fCurrentCorner = NO_CORNER;
			break;
		}
	}

	return B_DISPATCH_MESSAGE;
}
예제 #5
0
void
ScreenSaverFilter::CheckTime()
{
	BAutolock _(this);

	bigtime_t now = system_time();
	if (now >= fLastEventTime + fBlankTime)
		_Invoke();

	// TODO: this doesn't work correctly - since the BMessageRunner is not
	// restarted, the next check will be too far away

	// If the screen saver is on OR it was time to come on but it didn't (corner),
	// snooze for blankTime.
	// Otherwise, there was an event in the middle of the last snooze, so snooze
	// for the remainder.
	if (fIsRunning || fLastEventTime + fBlankTime <= now)
		fSnoozeTime = fBlankTime;
	else
		fSnoozeTime = fLastEventTime + fBlankTime - now;

	if (fRunner != NULL)
		fRunner->SetInterval(fSnoozeTime);
}
예제 #6
0
void
FontSelectionView::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kMsgSetSize:
		{
			int32 size;
			if (message->FindInt32("size", &size) != B_OK
				|| size == fCurrentFont.Size())
				break;

			fCurrentFont.SetSize(size);
			_UpdateFontPreview();
			_Invoke();
			break;
		}

		case kMsgSetFamily:
		{
			const char* family;
			if (message->FindString("family", &family) != B_OK)
				break;

			font_style style;
			fCurrentFont.GetFamilyAndStyle(NULL, &style);

			BMenuItem* familyItem = fFontsMenu->FindItem(family);
			if (familyItem != NULL) {
				_SelectCurrentFont(false);

				BMenuItem* styleItem;
				if (fStylesMenuField != NULL)
					styleItem = fStylesMenuField->Menu()->FindMarked();
				else {
					styleItem = familyItem->Submenu()->FindItem(style);
					if (styleItem == NULL)
						styleItem = familyItem->Submenu()->ItemAt(0);
				}

				if (styleItem != NULL) {
					styleItem->SetMarked(true);
					fCurrentFont.SetFamilyAndStyle(family, styleItem->Label());
					_UpdateFontPreview();
				}
				if (fStylesMenuField != NULL)
					_AddStylesToMenu(fCurrentFont, fStylesMenuField->Menu());
			}

			_Invoke();
			break;
		}

		case kMsgSetStyle:
		{
			const char* family;
			const char* style;
			if (message->FindString("family", &family) != B_OK
				|| message->FindString("style", &style) != B_OK)
				break;

			BMenuItem *familyItem = fFontsMenu->FindItem(family);
			if (!familyItem)
				break;

			_SelectCurrentFont(false);
			familyItem->SetMarked(true);

			fCurrentFont.SetFamilyAndStyle(family, style);
			_UpdateFontPreview();
			_Invoke();
			break;
		}

		default:
			BHandler::MessageReceived(message);
	}
}