Size FromHiMetric(Size himetric_size) { static Size logdpi = ScreenInfo().GetSizeCaps(LOGPIXELSX, LOGPIXELSY); return Size( iscalefloor(himetric_size.cx, logdpi.cx, HIMETRIC_INCH), iscalefloor(himetric_size.cy, logdpi.cy, HIMETRIC_INCH)); }
Size ToHiMetric(Size pixel_size) { static Size logdpi = ScreenInfo().GetSizeCaps(LOGPIXELSX, LOGPIXELSY); return Size( iscaleceil(pixel_size.cx, HIMETRIC_INCH, logdpi.cx), iscaleceil(pixel_size.cy, HIMETRIC_INCH, logdpi.cy)); }
TInt DLcdPowerHandler::HalFunction(TInt aFunction, TAny* a1, TAny* a2) { TInt r=KErrNone; switch(aFunction) { case EDisplayHalScreenInfo: { TPckgBuf<TScreenInfoV01> vPckg; ScreenInfo(vPckg()); Kern::InfoCopy(*(TDes8*)a1,vPckg); break; } case EDisplayHalWsRegisterSwitchOnScreenHandling: { iWsSwitchOnScreen=(TBool)a1; break; } case EDisplayHalWsSwitchOnScreen: { WsSwitchOnScreen(); break; } case EDisplayHalModeCount: { TInt ndm = KConfigLcdNumberOfDisplayModes; kumemput32(a1, &ndm, sizeof(ndm)); break; } case EDisplayHalSetMode: { __KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetMode")); __SECURE_KERNEL( if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetMode"))) return KErrPermissionDenied; ) r = SetDisplayMode((TInt)a1); break; } case EDisplayHalMode: { kumemput32(a1, &iVideoInfo.iDisplayMode, sizeof(iVideoInfo.iDisplayMode)); r = KErrNone; break; } case EDisplayHalSetPaletteEntry: { __SECURE_KERNEL( if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetPaletteEntry"))) return KErrPermissionDenied; ) r = KErrNotSupported; break; }
//Read the current screen config from xrandr QList<ScreenInfo> RRSettings::CurrentScreens(){ QList<ScreenInfo> SCREENS; QStringList info = LUtils::getCmdOutput("xrandr -q"); ScreenInfo cscreen; for(int i=0; i<info.length(); i++){ if(info[i].contains("connected") ){ //qDebug() << "xrandr info:" << info[i]; if(!cscreen.ID.isEmpty()){ SCREENS << cscreen; //current screen finished - save it into the array cscreen = ScreenInfo(); //Now create a new structure } //qDebug() << "Line:" << info[i]; QString dev = info[i].section(" ",0,0); //device ID //The device resolution can be either the 3rd or 4th output - check both QString devres = info[i].section(" ",2,2, QString::SectionSkipEmpty); if(!devres.contains("x")){ devres = info[i].section(" ",3,3,QString::SectionSkipEmpty); } if(!devres.contains("x")){ devres.clear(); } qDebug() << " - ID:" <<dev << "Current Geometry:" << devres; //qDebug() << " - Res:" << devres; if( !devres.contains("x") || !devres.contains("+") ){ devres.clear(); } //qDebug() << " - Res (modified):" << devres; if(info[i].contains(" disconnected ") && !devres.isEmpty() ){ //Device disconnected, but still active on X cscreen.isavailable = false; cscreen.isactive = true; }else if( !devres.isEmpty() ){ cscreen.isprimary = info[i].contains(" primary "); //Device that is connected and attached (has a resolution) qDebug() << "Create new Screen entry:" << dev << devres; cscreen.ID = dev; //Note: devres format: "<width>x<height>+<xoffset>+<yoffset>" cscreen.geom.setRect( devres.section("+",-2,-2).toInt(), devres.section("+",-1,-1).toInt(), devres.section("x",0,0).toInt(), devres.section("+",0,0).section("x",1,1).toInt() ); cscreen.isavailable = true; cscreen.isactive = true; }else if(info[i].contains(" connected")){ //Device that is connected, but not attached qDebug() << "Create new Screen entry:" << dev << "none"; cscreen.ID = dev; cscreen.order = -2; //flag this right now as a non-active screen cscreen.isavailable = true; cscreen.isactive = false; } }else if( !cscreen.ID.isEmpty() && info[i].section("\t",0,0,QString::SectionSkipEmpty).contains("x")){ //available resolution for a device cscreen.resList << info[i].section("\t",0,0,QString::SectionSkipEmpty); } } //end loop over primary info lines if(!cscreen.ID.isEmpty()){ SCREENS << cscreen; } //make sure to add the last screen to the array return SCREENS; }
HDC ScreenHDC() { return ScreenInfo(); }
NilDraw::NilDraw() { DrawLock __; Attach(ScreenInfo().GetHandle()); pixels = false; cloff.Clear(); }