Mercurial > vim
comparison src/gui_gtk_x11.c @ 11745:5a5709918a98 v8.0.0755
patch 8.0.0755: terminal window does not have colors in the GUI
commit https://github.com/vim/vim/commit/26af85d97ba1ed0ade6cdd41890ca04ed879b9c7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 23 16:45:10 2017 +0200
patch 8.0.0755: terminal window does not have colors in the GUI
Problem: Terminal window does not have colors in the GUI.
Solution: Lookup the GUI color.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 23 Jul 2017 17:00:04 +0200 |
parents | 621e41f6dcc2 |
children | 24abce52ad20 |
comparison
equal
deleted
inserted
replaced
11744:44adc1cc0cdd | 11745:5a5709918a98 |
---|---|
5604 | 5604 |
5605 #if GTK_CHECK_VERSION(3,0,0) | 5605 #if GTK_CHECK_VERSION(3,0,0) |
5606 return name != NULL ? gui_get_color_cmn(name) : INVALCOLOR; | 5606 return name != NULL ? gui_get_color_cmn(name) : INVALCOLOR; |
5607 #else | 5607 #else |
5608 guicolor_T color; | 5608 guicolor_T color; |
5609 GdkColor gcolor; | |
5610 int ret; | |
5611 | 5609 |
5612 color = (name != NULL) ? gui_get_color_cmn(name) : INVALCOLOR; | 5610 color = (name != NULL) ? gui_get_color_cmn(name) : INVALCOLOR; |
5613 if (color == INVALCOLOR) | 5611 if (color == INVALCOLOR) |
5614 return INVALCOLOR; | 5612 return INVALCOLOR; |
5615 | 5613 |
5616 gcolor.red = (guint16)(((color & 0xff0000) >> 16) / 255.0 * 65535 + 0.5); | 5614 return gui_mch_get_rgb_color( |
5617 gcolor.green = (guint16)(((color & 0xff00) >> 8) / 255.0 * 65535 + 0.5); | 5615 (color & 0xff0000) >> 16, |
5618 gcolor.blue = (guint16)((color & 0xff) / 255.0 * 65535 + 0.5); | 5616 (color & 0xff00) >> 8, |
5617 color & 0xff); | |
5618 #endif | |
5619 } | |
5620 | |
5621 /* | |
5622 * Return the Pixel value (color) for the given RGB values. | |
5623 * Return INVALCOLOR for error. | |
5624 */ | |
5625 guicolor_T | |
5626 gui_mch_get_rgb_color(int r, int g, int b) | |
5627 { | |
5628 #if GTK_CHECK_VERSION(3,0,0) | |
5629 return gui_get_rgb_color_cmn(r, g, b); | |
5630 #else | |
5631 GdkColor gcolor; | |
5632 int ret; | |
5633 | |
5634 gcolor.red = (guint16)(r / 255.0 * 65535 + 0.5); | |
5635 gcolor.green = (guint16)(g / 255.0 * 65535 + 0.5); | |
5636 gcolor.blue = (guint16)(b / 255.0 * 65535 + 0.5); | |
5619 | 5637 |
5620 ret = gdk_colormap_alloc_color(gtk_widget_get_colormap(gui.drawarea), | 5638 ret = gdk_colormap_alloc_color(gtk_widget_get_colormap(gui.drawarea), |
5621 &gcolor, FALSE, TRUE); | 5639 &gcolor, FALSE, TRUE); |
5622 | 5640 |
5623 return ret != 0 ? (guicolor_T)gcolor.pixel : INVALCOLOR; | 5641 return ret != 0 ? (guicolor_T)gcolor.pixel : INVALCOLOR; |