Exemple #1
0
void sortdisplays (void)
{
	struct MultiDisplay *md;
	int i, idx;

	int w = GetSystemMetrics (SM_CXSCREEN);
	int h = GetSystemMetrics (SM_CYSCREEN);
	int b = 0;
//	HDC hdc = GetDC (NULL);
//	if (hdc) {
//		b = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);
//		ReleaseDC (NULL, hdc);
//	}
	write_log (_T("Desktop: W=%d H=%d B=%d. CXVS=%d CYVS=%d\n"), w, h, b,
		GetSystemMetrics (SM_CXVIRTUALSCREEN), GetSystemMetrics (SM_CYVIRTUALSCREEN));

	md = Displays;
	while (md->monitorname) {
		md->DisplayModes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES);
		md->DisplayModes[0].depth = -1;

		write_log (_T("%s '%s' [%s]\n"), md->adaptername, md->adapterid, md->adapterkey);
		write_log (_T("-: %s [%s]\n"), md->fullname, md->monitorid);
		for (int mode = 0; mode < 2; mode++) {
			DEVMODE dm;
			dm.dmSize = sizeof dm;
			dm.dmDriverExtra = 0;
			idx = 0;

//let's hope for the best
dm.dmPelsWidth = 1280;
dm.dmPelsHeight = 1024;
dm.dmBitsPerPel = 32;
dm.dmDisplayFrequency = 50;
//dm.dmDisplayFlags =
//dm.dmPosition = 
//dm.dmDisplayOrientation = 
//			while (EnumDisplaySettingsEx (md->adapterid, idx, &dm, mode ? EDS_RAWMODE : 0)) {
				int found = 0;
				int idx2 = 0;
				while (md->DisplayModes[idx2].depth >= 0 && !found) {
					struct PicassoResolution *pr = &md->DisplayModes[idx2];
					if ( (pr->res.width  == (uae_u32)dm.dmPelsWidth)
					  && (pr->res.height == (uae_u32)dm.dmPelsHeight)
					  && (pr->depth      == (int)(dm.dmBitsPerPel / 8)) ) {
						for (i = 0; pr->refresh[i]; i++) {
							if (pr->refresh[i] == (int)dm.dmDisplayFrequency) {
								found = 1;
								break;
							}
						}
					}
					idx2++;
				}
				if (!found && dm.dmBitsPerPel > 8) {
					/// REMOVEME: unused: int freq = 0;
//					if ((dm.dmFields & DM_PELSWIDTH) && (dm.dmFields & DM_PELSHEIGHT) && (dm.dmFields & DM_BITSPERPEL)) {
						addmode (md, &dm, mode);
//					}
				}
				idx++;
//			}
		}
		sortmodes (md);
		modesList (md);
		i = 0;
		while (md->DisplayModes[i].depth > 0)
			i++;
		write_log (_T("%d display modes.\n"), i);
		md++;
	}
}
Exemple #2
0
void MainWindow::on_addMode_clicked()
{
    AddMode addmode(this);
    addmode.setModal(true);
    addmode.exec();
}