213 |
|
// Calculate minimum and maximum supported X depth |
214 |
|
int min_depth = 1, max_depth = 32; |
215 |
|
switch (depth) { |
216 |
< |
case VDEPTH_1BIT: // 1-bit works always |
217 |
< |
min_depth = 1; |
218 |
< |
max_depth = 32; |
216 |
> |
case VDEPTH_1BIT: // 1-bit works always and uses default visual |
217 |
> |
min_depth = max_depth = DefaultDepth(x_display, screen); |
218 |
|
break; |
219 |
|
#ifdef ENABLE_VOSF |
220 |
|
case VDEPTH_2BIT: |
293 |
|
case DirectColor: D(bug("DirectColor\n")); break; |
294 |
|
} |
295 |
|
#endif |
296 |
+ |
return true; |
297 |
|
} |
298 |
|
|
299 |
|
// Add mode to list of supported modes |
532 |
|
// Palette has changed |
533 |
|
void driver_base::update_palette(void) |
534 |
|
{ |
535 |
< |
if (cmap[0] && cmap[1]) { |
535 |
> |
if (color_class == PseudoColor || color_class == DirectColor) { |
536 |
|
int num = vis->map_entries; |
537 |
|
if (!IsDirectMode(VideoMonitor.mode) && color_class == DirectColor) |
538 |
|
return; // Indexed mode on true color screen, don't set CLUT |
570 |
|
// Set absolute mouse mode |
571 |
|
ADBSetRelMouseMode(mouse_grabbed); |
572 |
|
|
573 |
< |
// Create window |
573 |
> |
// Create window (setting backround_pixel, border_pixel and colormap is |
574 |
> |
// mandatory when using a non-default visual; in 1-bit mode we use the |
575 |
> |
// default visual, so we can also use the default colormap) |
576 |
|
XSetWindowAttributes wattr; |
577 |
|
wattr.event_mask = eventmask = win_eventmask; |
578 |
< |
wattr.background_pixel = black_pixel; |
579 |
< |
wattr.colormap = (mode.depth == VDEPTH_1BIT && color_class == PseudoColor ? DefaultColormap(x_display, screen) : cmap[0]); |
578 |
> |
wattr.background_pixel = (vis == DefaultVisual(x_display, screen) ? black_pixel : 0); |
579 |
> |
wattr.border_pixel = 0; |
580 |
> |
wattr.colormap = (mode.depth == VDEPTH_1BIT ? DefaultColormap(x_display, screen) : cmap[0]); |
581 |
|
w = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth, |
582 |
< |
InputOutput, vis, CWEventMask | CWBackPixel | (color_class == PseudoColor || color_class == DirectColor ? CWColormap : 0), &wattr); |
582 |
> |
InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel | CWColormap, &wattr); |
583 |
|
|
584 |
|
// Set window name/class |
585 |
|
set_window_name(w, STR_WINDOW_TITLE); |
1350 |
|
if (color_class == PseudoColor || color_class == DirectColor) { |
1351 |
|
cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocAll); |
1352 |
|
cmap[1] = XCreateColormap(x_display, rootwin, vis, AllocAll); |
1353 |
+ |
} else { |
1354 |
+ |
cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocNone); |
1355 |
+ |
cmap[1] = XCreateColormap(x_display, rootwin, vis, AllocNone); |
1356 |
|
} |
1357 |
|
|
1358 |
|
// Find pixel format of direct modes |
1397 |
|
palette[i].green = c * 0x0101; |
1398 |
|
palette[i].blue = c * 0x0101; |
1399 |
|
} |
1400 |
< |
if (cmap[0] && cmap[1]) { |
1400 |
> |
if (color_class == PseudoColor || color_class == DirectColor) { |
1401 |
|
XStoreColors(x_display, cmap[0], palette, num); |
1402 |
|
XStoreColors(x_display, cmap[1], palette, num); |
1403 |
|
} |