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: |
531 |
|
// Palette has changed |
532 |
|
void driver_base::update_palette(void) |
533 |
|
{ |
534 |
< |
if (cmap[0] && cmap[1]) { |
534 |
> |
if (color_class == PseudoColor || color_class == DirectColor) { |
535 |
|
int num = vis->map_entries; |
536 |
|
if (!IsDirectMode(VideoMonitor.mode) && color_class == DirectColor) |
537 |
|
return; // Indexed mode on true color screen, don't set CLUT |
569 |
|
// Set absolute mouse mode |
570 |
|
ADBSetRelMouseMode(mouse_grabbed); |
571 |
|
|
572 |
< |
// Create window |
572 |
> |
// Create window (setting backround_pixel, border_pixel and colormap is |
573 |
> |
// mandatory when using a non-default visual; in 1-bit mode we use the |
574 |
> |
// default visual, so we can also use the default colormap) |
575 |
|
XSetWindowAttributes wattr; |
576 |
|
wattr.event_mask = eventmask = win_eventmask; |
577 |
< |
wattr.background_pixel = black_pixel; |
578 |
< |
wattr.colormap = (mode.depth == VDEPTH_1BIT && color_class == PseudoColor ? DefaultColormap(x_display, screen) : cmap[0]); |
577 |
> |
wattr.background_pixel = (vis == DefaultVisual(x_display, screen) ? black_pixel : 0); |
578 |
> |
wattr.border_pixel = 0; |
579 |
> |
wattr.colormap = (mode.depth == VDEPTH_1BIT ? DefaultColormap(x_display, screen) : cmap[0]); |
580 |
|
w = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth, |
581 |
< |
InputOutput, vis, CWEventMask | CWBackPixel | (color_class == PseudoColor || color_class == DirectColor ? CWColormap : 0), &wattr); |
581 |
> |
InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel | CWColormap, &wattr); |
582 |
|
|
583 |
|
// Set window name/class |
584 |
|
set_window_name(w, STR_WINDOW_TITLE); |
1349 |
|
if (color_class == PseudoColor || color_class == DirectColor) { |
1350 |
|
cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocAll); |
1351 |
|
cmap[1] = XCreateColormap(x_display, rootwin, vis, AllocAll); |
1352 |
+ |
} else { |
1353 |
+ |
cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocNone); |
1354 |
+ |
cmap[1] = XCreateColormap(x_display, rootwin, vis, AllocNone); |
1355 |
|
} |
1356 |
|
|
1357 |
|
// Find pixel format of direct modes |
1396 |
|
palette[i].green = c * 0x0101; |
1397 |
|
palette[i].blue = c * 0x0101; |
1398 |
|
} |
1399 |
< |
if (cmap[0] && cmap[1]) { |
1399 |
> |
if (color_class == PseudoColor || color_class == DirectColor) { |
1400 |
|
XStoreColors(x_display, cmap[0], palette, num); |
1401 |
|
XStoreColors(x_display, cmap[1], palette, num); |
1402 |
|
} |