1129 |
|
break; |
1130 |
|
} |
1131 |
|
|
1132 |
+ |
// Get screen mode from preferences |
1133 |
+ |
const char *mode_str = PrefsFindString("screen"); |
1134 |
+ |
int default_width = 640, default_height = 480; |
1135 |
+ |
if (mode_str) { |
1136 |
+ |
display_type = DIS_INVALID; |
1137 |
+ |
if (sscanf(mode_str, "win/%d/%d", &default_width, &default_height) == 2) |
1138 |
+ |
display_type = DIS_WINDOW; |
1139 |
+ |
#ifdef ENABLE_XF86_DGA |
1140 |
+ |
else if (has_dga && sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) |
1141 |
+ |
display_type = DIS_SCREEN; |
1142 |
+ |
#endif |
1143 |
+ |
if (display_type == DIS_INVALID) { |
1144 |
+ |
D(bug("Invalid screen mode specified, defaulting to old modes selection\n")); |
1145 |
+ |
mode_str = NULL; |
1146 |
+ |
} |
1147 |
+ |
else { |
1148 |
+ |
if (default_width <= 0) |
1149 |
+ |
default_width = DisplayWidth(x_display, screen); |
1150 |
+ |
else if (default_width > DisplayWidth(x_display, screen)) |
1151 |
+ |
default_width = DisplayWidth(x_display, screen); |
1152 |
+ |
if (default_height <= 0) |
1153 |
+ |
default_height = DisplayHeight(x_display, screen); |
1154 |
+ |
else if (default_height > DisplayHeight(x_display, screen)) |
1155 |
+ |
default_height = DisplayHeight(x_display, screen); |
1156 |
+ |
} |
1157 |
+ |
} |
1158 |
+ |
|
1159 |
|
// Construct video mode table |
1160 |
|
uint32 window_modes = PrefsFindInt32("windowmodes"); |
1161 |
|
uint32 screen_modes = PrefsFindInt32("screenmodes"); |
1162 |
|
if (!has_dga) |
1163 |
|
screen_modes = 0; |
1164 |
< |
if (window_modes == 0 && screen_modes == 0) |
1164 |
> |
if (mode_str) |
1165 |
> |
window_modes = screen_modes = 0; |
1166 |
> |
else if (window_modes == 0 && screen_modes == 0) |
1167 |
|
window_modes |= 3; // Allow at least 640x480 and 800x600 window modes |
1168 |
|
|
1169 |
|
VideoInfo *p = VModes; |
1170 |
< |
for (unsigned int d = APPLE_1_BIT; d <= APPLE_32_BIT; d++) |
1171 |
< |
if (find_visual_for_depth(d)) |
1172 |
< |
add_window_modes(p, window_modes, d); |
1173 |
< |
|
1174 |
< |
if (has_vidmode) { |
1170 |
> |
if (mode_str) { |
1171 |
> |
if (display_type == DIS_WINDOW) { |
1172 |
> |
for (unsigned int d = APPLE_1_BIT; d <= APPLE_32_BIT; d++) { |
1173 |
> |
if (find_visual_for_depth(d)) { |
1174 |
> |
if (default_width > 640 && default_height > 480) |
1175 |
> |
add_mode(p, 3, 1, d, APPLE_W_640x480, DIS_WINDOW); |
1176 |
> |
if (default_width > 800 && default_height > 600) |
1177 |
> |
add_mode(p, 3, 2, d, APPLE_W_800x600, DIS_WINDOW); |
1178 |
> |
add_custom_mode(p, display_type, default_width, default_height, d, APPLE_CUSTOM); |
1179 |
> |
} |
1180 |
> |
} |
1181 |
> |
} else |
1182 |
> |
add_custom_mode(p, display_type, default_width, default_height, default_mode, APPLE_CUSTOM); |
1183 |
> |
} else if (window_modes) { |
1184 |
> |
for (unsigned int d = APPLE_1_BIT; d <= APPLE_32_BIT; d++) |
1185 |
> |
if (find_visual_for_depth(d)) |
1186 |
> |
add_window_modes(p, window_modes, d); |
1187 |
> |
} else if (has_vidmode) { |
1188 |
|
if (has_mode(640, 480)) |
1189 |
|
add_mode(p, screen_modes, 1, default_mode, APPLE_640x480, DIS_SCREEN); |
1190 |
|
if (has_mode(800, 600)) |
1225 |
|
int apple_id = find_apple_resolution(screen_width, screen_height); |
1226 |
|
if (apple_id != -1) |
1227 |
|
cur_mode = find_mode(default_mode, apple_id, DIS_SCREEN); |
1228 |
< |
} |
1228 |
> |
} else if (has_dga && mode_str) |
1229 |
> |
cur_mode = find_mode(default_mode, APPLE_CUSTOM, DIS_SCREEN); |
1230 |
> |
|
1231 |
|
if (cur_mode == -1) { |
1232 |
|
// pick up first windowed mode available |
1233 |
|
for (VideoInfo *p = VModes; p->viType != DIS_INVALID; p++) { |