| 1521 | } |
| 1522 | |
| 1523 | static GC |
| 1524 | X11_make_gc( |
| 1525 | struct xwindow *wp UNUSED, |
| 1526 | struct text_map_info_t *text_map, |
| 1527 | X11_color color, |
| 1528 | boolean inverted) |
| 1529 | { |
| 1530 | boolean cur_inv = inverted; |
| 1531 | GC ggc; |
| 1532 | |
| 1533 | #ifdef ENHANCED_SYMBOLS |
| 1534 | if ((color & NH_ENHANCED_COLOR) != 0) { |
| 1535 | /* We need a new GC */ |
| 1536 | if ((color & NH_INVERSE_COLOR) != 0) { |
| 1537 | cur_inv = !cur_inv; |
| 1538 | } |
| 1539 | if (iflags.use_color) { |
| 1540 | Arg arg[1]; |
| 1541 | XGCValues values; |
| 1542 | Pixel fgpixel, bgpixel; |
| 1543 | |
| 1544 | /* FIXME: Does this still work when the display does not support |
| 1545 | true color? */ |
| 1546 | fgpixel = COLORVAL(color); |
| 1547 | XtSetArg(arg[0], XtNbackground, &bgpixel); |
| 1548 | XtGetValues(wp->w, arg, 1); |
| 1549 | if (cur_inv) { |
| 1550 | values.foreground = bgpixel; |
| 1551 | values.background = fgpixel; |
| 1552 | } else { |
| 1553 | values.foreground = fgpixel; |
| 1554 | values.background = bgpixel; |
| 1555 | } |
| 1556 | values.function = GXcopy; |
| 1557 | values.font = X11_get_map_font(wp); |
| 1558 | ggc = XtGetGC(wp->w, |
| 1559 | GCFunction | GCForeground | GCBackground | GCFont, |
| 1560 | &values); |
| 1561 | } else { |
| 1562 | ggc = (cur_inv ? text_map->inv_copy_gc : text_map->copy_gc); |
| 1563 | } |
| 1564 | } else |
| 1565 | #endif |
| 1566 | { |
| 1567 | uint32 nhcolor = COLORVAL(color); /* strip flag bits */ |
| 1568 | |
| 1569 | if (nhcolor >= CLR_MAX) { |
| 1570 | nhcolor -= CLR_MAX; |
| 1571 | cur_inv = !cur_inv; |
| 1572 | } |
| 1573 | ggc = (iflags.use_color |
| 1574 | ? (cur_inv |
| 1575 | ? text_map->inv_color_gcs[nhcolor] |
| 1576 | : text_map->color_gcs[nhcolor]) |
| 1577 | : (cur_inv |
| 1578 | ? text_map->inv_copy_gc |
| 1579 | : text_map->copy_gc)); |
| 1580 | } |
no test coverage detected