MacOSX:将屏幕分辨率更改为未列出的分辨率

MacOSX:将屏幕分辨率更改为未列出的分辨率

我刚刚买了一个 KVM 切换盒,当我将显示器插入该盒子时,MacOSX 无法识别所有可能的分辨率,尤其是无法识别原始分辨率,这非常烦人。

有什么方法可以修复这个问题吗?

有什么方法可以强制 MacOSX 让我指定任何可能的分辨率?

答案1

我不确定它是否还能用,但你可以试试 cscreen 命令行工具。它的原作者已经放弃了它,但它仍然可以从 macosxhints 论坛获得(帖子 #6)这里)。

答案2

看一眼切换资源X

SwitchResX 是一款用于管理所有显示器分辨率的工具。以下是简要概述:

标准功能:它可以让您在其可自定义的菜单中访问大多数显示器设置(在菜单栏中或使用 Finder 桌面上的上下文菜单插件 [也在 Snow Leopard 上])。SwitchResX 将与显示器分辨率、色深、视频镜像、显示旋转、显示过扫描相关的功能整合到一个实用程序中。其他有用的功能包括保存桌面布局,即桌面上图标的位置和所有打开的应用程序窗口的位置,并在分辨率发生变化或插入或拔出外接显示器时自动恢复它们。您无需物理拔下显示器即可禁用或停用它,从而允许您在翻盖模式下使用带有外接显示器、键盘和鼠标的笔记本电脑。专门的功能允许您将显示器设置与系统事件链接起来:按下快捷键、Apple 脚本、启动应用程序。

高级功能可让您为显示器、高清电视、等离子或液晶屏幕或视频投影仪创建和启用新分辨率。对于要求完全控制显示分辨率的用户来说,此高级功能非常强大。

答案3

感谢 Gordon 提供的 Macworld 论坛链接。以下代码可能可以实现我想要的功能:

/*
* main.c
* newscreen
*
* Created by Jeffrey Osterman on 10/30/07.
* Copyright 2007 Jeffrey Osterman. All rights reserved. 
* PROVIDED AS IS AND WITH NO WARRANTIES WHATSOEVER
*/

#include <ApplicationServices/ApplicationServices.h>

void MyDisplaySwitchToMode (CGDirectDisplayID display, CFDictionaryRef mode);

int main (int argc, const char * argv[]) {

int h; //horizontal resolution
int v; //vertical resolution
CFDictionaryRef switchMode; //mode to swich to
CGDirectDisplayID mainDisplay; //ID of main display


if (argc != 5)
{
printf("Expected 4 inputs, but only received %i\n", argc-1);
return 0;
}

if (!strcmp(argv[1],"-h"))
h=strtol(argv[2], NULL, 0);
else if (!strcmp(argv[1],"-v"))
v=strtol(argv[2], NULL, 0);
else {
printf("Error! Expected first argument to be -h or -v\n");
return 0;
}


if (!strcmp(argv[3],"-h"))
h=strtol(argv[4], NULL, 0);
else if (!strcmp(argv[3],"-v"))
v=strtol(argv[4], NULL, 0);
else {
printf("Error! Expected third argument to be -h or -v");
return 0;
}

mainDisplay = CGMainDisplayID();
switchMode = CGDisplayBestModeForParameters(mainDisplay, 32, h, v, NULL);
MyDisplaySwitchToMode (mainDisplay, switchMode);
return 0;

}



void MyDisplaySwitchToMode (CGDirectDisplayID display, CFDictionaryRef mode)
{
CGDisplayConfigRef config; // 1
CGBeginDisplayConfiguration (&config); // 2
CGConfigureDisplayMode (config, display, mode); // 3

CGCompleteDisplayConfiguration (config, kCGConfigureForSession ); // 5
}

相关内容