void StOutPageFlipExt::processEvents() { StOutPageFlip::processEvents(); if(!StOutPageFlip::params.ToShowExtra->getValue()) { return; } // resize extra stuff const StRectI_t aRect = StWindow::getPlacement(); if(aRect != myWinRect) { myWinRect = aRect; myVpSizeY = aRect.height(); myVpSizeX = aRect.width(); if(!StOutPageFlip::params.ToShowExtra->getValue()) { return; } if(!StWindow::isFullScreen()) { const StSearchMonitors& aMonitors = StWindow::getMonitors(); if(myMonitor.isNull()) { myMonitor = new StMonitor(aMonitors[aRect.center()]); } else if(!myMonitor->getVRect().isPointIn(aRect.center())) { *myMonitor = aMonitors[aRect.center()]; } myVpSizeX = myMonitor->getVRect().width(); if(getDeviceControl() != NULL) { myVpSizeY = getDeviceControl()->getSizeY(); } } } }
void StOutPageFlipExt::stglDrawExtra(unsigned int theView, int theMode) { if(!StOutPageFlip::params.ToShowExtra->getValue()) { return; } if(!isControlOn()) { StWindow::hide(ST_WIN_SLAVE); return; } getDeviceControl()->setMode(myIsQuiting ? StGLDeviceControl::OUT_MONO : theMode); if(!getDeviceControl()->isActive()) { StWindow::hide(ST_WIN_SLAVE); return; } const bool toDrawWindowed = !StWindow::isFullScreen() #ifdef _WIN32 && myIsVistaPlus #endif ; if(!toDrawWindowed) { StWindow::hide(ST_WIN_SLAVE); } if(toDrawWindowed) { myVpSizeY = getDeviceControl()->getSizeY(); setSlavePosition(getDeviceControl()->getSlaveId()); StWindow::show(ST_WIN_SLAVE); StWindow::stglMakeCurrent(ST_WIN_SLAVE); myContext->core20fwd->glViewport(0, 0, myVpSizeX, myVpSizeY); // always update slave window Viewport if(StOutPageFlip::params.QuadBuffer->getValue() == QUADBUFFER_HARD_OPENGL) { if(!StWindow::isStereoOutput()) { myContext->core20fwd->glDrawBuffer(GL_BACK); } else { myContext->core20fwd->glDrawBuffer(theView == ST_DRAW_LEFT ? GL_BACK_LEFT : GL_BACK_RIGHT); } } myContext->core20fwd->glClear(GL_COLOR_BUFFER_BIT); // clear the screen } getDeviceControl()->stglDraw(*myContext, theView, myVpSizeX, myVpSizeY); if(toDrawWindowed) { if(StOutPageFlip::params.QuadBuffer->getValue() == QUADBUFFER_HARD_OPENGL) { if(theView != ST_DRAW_LEFT) { StWindow::stglSwap(ST_WIN_SLAVE); } } else { StWindow::stglSwap(ST_WIN_SLAVE); } } }
void StOutPageFlipExt::doSetDeviceControl(const int32_t theValue) { switch(theValue) { case DEVICE_CONTROL_BLUELINE: myCodesLine.setBlueColor(); getDeviceControl()->setMode(StGLDeviceControl::OUT_UNDEFINED); break; case DEVICE_CONTROL_WHITELINE: myCodesLine.setWhiteColor(); getDeviceControl()->setMode(StGLDeviceControl::OUT_UNDEFINED); break; case DEVICE_CONTROL_ED_ON_OFF: getDeviceControl()->setMode(StGLDeviceControl::OUT_UNDEFINED); break; default: break; } myToResetDevice = true; }
void StOutPageFlipExt::beforeClose() { if(!StOutPageFlip::params.ToShowExtra->getValue()) { return; } if(isControlOn() && StWindow::isStereoOutput()) { myIsQuiting = true; const double aTime = getDeviceControl()->quitMS(); StTimer aQuitTimer(true); while(aQuitTimer.getElapsedTimeInMilliSec() <= aTime) { stglDraw(); StThread::sleep(10); } dxRelease(); StWindow::setStereoOutput(false); } }
bool ACPIBacklightPanel::start( IOService * provider ) { DbgLog("%s::%s()\n", this->getName(),__FUNCTION__); #if 0 if (!provider) return false; _provider = provider; _provider->retain(); #endif _lock = IORecursiveLockAlloc(); if (!_lock) return false; findDevices(provider); getDeviceControl(); hasSaveMethod = hasSAVEMethod(backLightDevice); min = 0; max = setupIndexedLevels(); if (min == max) { IOLog("ACPIBacklight: setupIndexedLevels failed (min==max)... aborting"); return false; } // add interrupt source for delayed actions... _workSource = IOInterruptEventSource::interruptEventSource(this, OSMemberFunctionCast(IOInterruptEventAction, this, &ACPIBacklightPanel::processWorkQueue)); if (!_workSource) return false; IOWorkLoop* workLoop = getWorkLoop(); if (!workLoop) { _workSource->release(); _workSource = NULL; return false; } workLoop->addEventSource(_workSource); _workPending = 0; // add timer for smooth fade ins if (_extended && !(_options & kDisableSmooth)) { _smoothTimer = IOTimerEventSource::timerEventSource(this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &ACPIBacklightPanel::onSmoothTimer)); if (_smoothTimer) workLoop->addEventSource(_smoothTimer); } _cmdGate = IOCommandGate::commandGate(this); if (_cmdGate) workLoop->addEventSource(_cmdGate); // initialize from properties OSDictionary* dict = getPropertyTable(); setPropertiesGated(dict); // write current values from smoothData for (int i = 0; i < countof(smoothData); i++) { char buf[kSmoothBufSize]; snprintf(buf, sizeof(buf), kSmoothDelta, i); setProperty(buf, smoothData[i].delta, 32); snprintf(buf, sizeof(buf), kSmoothStep, i); setProperty(buf, smoothData[i].step, 32); snprintf(buf, sizeof(buf), kSmoothTimeout, i); setProperty(buf, smoothData[i].timeout, 32); } #ifdef DEBUG setProperty("CycleTest", 1, 32); setProperty("KLVX", 1, 32); #endif // make the service available for clients like 'ioio'... registerService(); // load and set default brightness level UInt32 value = loadFromNVRAM(); DbgLog("%s: loadFromNVRAM returns %d\n", this->getName(), value); // registerService above must be called before we wait for the BacklightHandler if (useBacklightHandler()) { DbgLog("%s: Waiting for BacklightHandler\n", this->getName()); waitForService(serviceMatching("BacklightHandler")); } // after backlight handler is in place, now we can manipulate backlight level UInt32 current = queryACPICurentBrightnessLevel(); setProperty(kRawBrightness, current, 32); #if 0 _provider->setProperty("AppleBacklightAtBoot", current, 32); _provider->setProperty("AppleMaxBrightness", BCLlevels[BCLlevelsCount-1], 32); #endif _committed_value = _value = _from_value = levelForValue(current); DbgLog("%s: current brightness: %d (%d)\n", this->getName(), _from_value, current); if (-1 != value) { _committed_value = value; DbgLog("%s: setting to value from nvram %d\n", this->getName(), value); setBrightnessLevelSmooth(value); } _saved_value = _committed_value; DbgLog("%s: min = %u, max = %u\n", this->getName(), min, max); // announce version extern kmod_info_t kmod_info; IOLog("ACPIBacklight: Version %s starting on OS X Darwin %d.%d.\n", kmod_info.version, version_major, version_minor); // place version/build info in ioreg properties RM,Build and RM,Version char buf[128]; snprintf(buf, sizeof(buf), "%s %s", kmod_info.name, kmod_info.version); setProperty("RM,Version", buf); #ifdef DEBUG setProperty("RM,Build", "Debug-" LOGNAME); #else setProperty("RM,Build", "Release-" LOGNAME); #endif return true; }