Example #1
0
wxVideoMode wxDisplayImplWin32Base::GetCurrentMode() const
{
    wxVideoMode mode;

    // The first parameter of EnumDisplaySettings() must be NULL under Win95
    // according to MSDN.  The version of GetName() we implement for Win95
    // returns an empty string.
    const wxString name = GetName();
    const wxChar * const deviceName = name.empty()
                                          ? (const wxChar*)NULL
                                          : (const wxChar*)name.c_str();

    DEVMODE dm;
    dm.dmSize = sizeof(dm);
    dm.dmDriverExtra = 0;
    if ( !::EnumDisplaySettings(deviceName, ENUM_CURRENT_SETTINGS, &dm) )
    {
        wxLogLastError(wxT("EnumDisplaySettings(ENUM_CURRENT_SETTINGS)"));
    }
    else
    {
        mode = ConvertToVideoMode(dm);
    }

    return mode;
}
Example #2
0
wxArrayVideoModes
wxDisplayImplMultimon::GetModes(const wxVideoMode& modeMatch) const
{
    wxArrayVideoModes modes;

    // The first parameter of EnumDisplaySettings() must be NULL under Win95
    // according to MSDN.  The version of GetName() we implement for Win95
    // returns an empty string.
    const wxString name = GetName();
    const wxChar * const deviceName = name.empty()
                                            ? (const wxChar*)NULL
                                            : (const wxChar*)name.c_str();

    DEVMODE dm;
    dm.dmSize = sizeof(dm);
    dm.dmDriverExtra = 0;
    for ( int iModeNum = 0;
          ::EnumDisplaySettings(deviceName, iModeNum, &dm);
          iModeNum++ )
    {
        const wxVideoMode mode = ConvertToVideoMode(dm);
        if ( mode.Matches(modeMatch) )
        {
            modes.Add(mode);
        }
    }

    return modes;
}
Example #3
0
FbData* FbGetData(void) {
 FbData *fb;
 struct VideoMode vmode;
 struct fb_var_screeninfo var;
 int res,sstart,send,total;
 str ht,vt;
 str flags;
 int fh = -1; 

 fb = (FbData*)malloc(sizeof(FbData));
 fb->x     = 640;
 fb->y     = 480;
 fb->depth = 8;
 fb->hsync = 33; 
 fb->vsync = 72;
 fb->clock = 35;
 strcpy(fb->ht,"");
 strcpy(fb->vt,"");
 strcpy(fb->flags,"");

 fh = OpenFrameBuffer(DEFAULT_FRAMEBUFFER);
 if (fh < 0) {
  return(fb);
 }
 GetVarScreenInfo(fh, &var);
 ConvertToVideoMode(&var, &vmode);

 #if __powerpc__
 // on PPC we had a real framebuffer driver which provides
 // the correct timing values of the active framebuffer
 // ...
 #else
 // on other architectures we will limit the framebuffer
 // to a 60Hz mode
 // ...
 vmode.hrate = (60.0 / vmode.vrate) * vmode.hrate;
 vmode.drate = (vmode.xres+vmode.right+vmode.hslen+vmode.left) * vmode.hrate;
 vmode.vrate = 60;
 #endif
 fb->x     = vmode.xres;
 fb->y     = vmode.yres;
 fb->depth = vmode.transp.offset;
 fb->hsync = vmode.hrate/1e3;
 fb->vsync = vmode.vrate;
 fb->clock = vmode.drate/1e6;

 res = vmode.xres;
 sstart = res+vmode.right;
 send = sstart+vmode.hslen;
 total = send+vmode.left;
 sprintf(ht,"%d %d %d %d",res, sstart, send, total);

 res = vmode.yres;
 sstart = res+vmode.lower;
 send = sstart+vmode.vslen;
 total = send+vmode.upper;
 sprintf(vt,"%d %d %d %d", res, sstart, send, total);

 strcpy(flags,"");
 if (vmode.laced)
  strcat(flags,"Interlace ");
 if (vmode.dblscan)
  strcat(flags,"DoubleScan ");
 if (vmode.hsync)
  strcat(flags,"+HSync ");
 else
  strcat(flags,"-HSync ");
 if (vmode.vsync)
  strcat(flags,"+VSync ");
 else
  strcat(flags,"-VSync ");
 if (vmode.csync)
  strcat(flags,"Composite ");
 if (vmode.bcast)
  strcat(flags,"bcast ");

 strcpy(fb->ht,ht);
 strcpy(fb->vt,vt);
 strcpy(fb->flags,flags);
 CloseFrameBuffer(fh);
 return(fb);
}