Try to use a TrueColor visual, even if the default-visual is
PseudoColor. This enables high-colour modes on displays with a PseudoColor default visual and eliminates colourmap-flashing at 8 bpp there. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@564 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
df4b9915d8
commit
0f1660ead7
@ -10,4 +10,4 @@ Peter
|
|||||||
Michal Mihalik <mmihalik@sme.sk>
|
Michal Mihalik <mmihalik@sme.sk>
|
||||||
Norbert Federa <nob@thinstuff.com>
|
Norbert Federa <nob@thinstuff.com>
|
||||||
Erik Forsberg <forsberg@cendio.se>
|
Erik Forsberg <forsberg@cendio.se>
|
||||||
Michael Gernoth <stargo@users.sourceforge.net>
|
Michael Gernoth <michael@gernoth.net>
|
||||||
|
68
xwin.c
68
xwin.c
@ -64,6 +64,7 @@ static int g_red_shift_l, g_blue_shift_l, g_green_shift_l;
|
|||||||
/* software backing store */
|
/* software backing store */
|
||||||
static BOOL g_ownbackstore;
|
static BOOL g_ownbackstore;
|
||||||
static Pixmap g_backstore;
|
static Pixmap g_backstore;
|
||||||
|
static BOOL g_backstore_initialized = False;
|
||||||
|
|
||||||
/* Moving in single app mode */
|
/* Moving in single app mode */
|
||||||
static BOOL g_moving_wnd;
|
static BOOL g_moving_wnd;
|
||||||
@ -699,7 +700,10 @@ ui_init(void)
|
|||||||
XVisualInfo vi;
|
XVisualInfo vi;
|
||||||
XPixmapFormatValues *pfm;
|
XPixmapFormatValues *pfm;
|
||||||
uint16 test;
|
uint16 test;
|
||||||
int i, screen_num;
|
int i, screen_num, nvisuals;
|
||||||
|
XVisualInfo *vmatches = NULL;
|
||||||
|
XVisualInfo template;
|
||||||
|
Bool TrueColorVisual = False;
|
||||||
|
|
||||||
g_display = XOpenDisplay(NULL);
|
g_display = XOpenDisplay(NULL);
|
||||||
if (g_display == NULL)
|
if (g_display == NULL)
|
||||||
@ -713,10 +717,32 @@ ui_init(void)
|
|||||||
g_screen = ScreenOfDisplay(g_display, screen_num);
|
g_screen = ScreenOfDisplay(g_display, screen_num);
|
||||||
g_depth = DefaultDepthOfScreen(g_screen);
|
g_depth = DefaultDepthOfScreen(g_screen);
|
||||||
|
|
||||||
if (g_server_bpp == 8)
|
/* Search for best TrueColor depth */
|
||||||
|
template.class = TrueColor;
|
||||||
|
vmatches = XGetVisualInfo(g_display, VisualClassMask, &template, &nvisuals);
|
||||||
|
|
||||||
|
nvisuals--;
|
||||||
|
while (nvisuals >= 0)
|
||||||
{
|
{
|
||||||
/* we use a colourmap, so any visual should do */
|
if ((vmatches + nvisuals)->depth > g_depth)
|
||||||
|
{
|
||||||
|
g_depth = (vmatches + nvisuals)->depth;
|
||||||
|
}
|
||||||
|
nvisuals--;
|
||||||
|
TrueColorVisual = True;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((g_server_bpp == 8) && ((! TrueColorVisual) || (g_depth <= 8)))
|
||||||
|
{
|
||||||
|
/* we use a colourmap, so the default visual should do */
|
||||||
g_visual = DefaultVisualOfScreen(g_screen);
|
g_visual = DefaultVisualOfScreen(g_screen);
|
||||||
|
g_depth = DefaultDepthOfScreen(g_screen);
|
||||||
|
|
||||||
|
/* Do not allocate colours on a TrueColor visual */
|
||||||
|
if (g_visual->class == TrueColor)
|
||||||
|
{
|
||||||
|
g_owncolmap = False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -758,13 +784,11 @@ ui_init(void)
|
|||||||
|
|
||||||
if (!g_owncolmap)
|
if (!g_owncolmap)
|
||||||
{
|
{
|
||||||
g_xcolmap = DefaultColormapOfScreen(g_screen);
|
g_xcolmap = XCreateColormap(g_display,RootWindowOfScreen(g_screen),g_visual,AllocNone);
|
||||||
if (g_depth <= 8)
|
if (g_depth <= 8)
|
||||||
warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");
|
warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_gc = XCreateGC(g_display, RootWindowOfScreen(g_screen), 0, NULL);
|
|
||||||
|
|
||||||
if (DoesBackingStore(g_screen) != Always)
|
if (DoesBackingStore(g_screen) != Always)
|
||||||
g_ownbackstore = True;
|
g_ownbackstore = True;
|
||||||
|
|
||||||
@ -807,17 +831,6 @@ ui_init(void)
|
|||||||
/* make sure width is a multiple of 4 */
|
/* make sure width is a multiple of 4 */
|
||||||
g_width = (g_width + 3) & ~3;
|
g_width = (g_width + 3) & ~3;
|
||||||
|
|
||||||
if (g_ownbackstore)
|
|
||||||
{
|
|
||||||
g_backstore =
|
|
||||||
XCreatePixmap(g_display, RootWindowOfScreen(g_screen), g_width, g_height,
|
|
||||||
g_depth);
|
|
||||||
|
|
||||||
/* clear to prevent rubbish being exposed at startup */
|
|
||||||
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen));
|
|
||||||
XFillRectangle(g_display, g_backstore, g_gc, 0, 0, g_width, g_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_mod_map = XGetModifierMapping(g_display);
|
g_mod_map = XGetModifierMapping(g_display);
|
||||||
|
|
||||||
xkeymap_init();
|
xkeymap_init();
|
||||||
@ -864,12 +877,29 @@ ui_create_window(void)
|
|||||||
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;
|
wndheight = g_fullscreen ? HeightOfScreen(g_screen) : g_height;
|
||||||
|
|
||||||
attribs.background_pixel = BlackPixelOfScreen(g_screen);
|
attribs.background_pixel = BlackPixelOfScreen(g_screen);
|
||||||
|
attribs.border_pixel = WhitePixelOfScreen(g_screen);
|
||||||
attribs.backing_store = g_ownbackstore ? NotUseful : Always;
|
attribs.backing_store = g_ownbackstore ? NotUseful : Always;
|
||||||
attribs.override_redirect = g_fullscreen;
|
attribs.override_redirect = g_fullscreen;
|
||||||
|
attribs.colormap = g_xcolmap;
|
||||||
|
|
||||||
g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, wndwidth, wndheight,
|
g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, wndwidth, wndheight,
|
||||||
0, CopyFromParent, InputOutput, CopyFromParent,
|
0, g_depth, InputOutput, g_visual,
|
||||||
CWBackPixel | CWBackingStore | CWOverrideRedirect, &attribs);
|
CWBackPixel | CWBackingStore | CWOverrideRedirect |
|
||||||
|
CWColormap | CWBorderPixel, &attribs);
|
||||||
|
|
||||||
|
g_gc = XCreateGC(g_display, g_wnd, 0, NULL);
|
||||||
|
|
||||||
|
if ((g_ownbackstore) && (! g_backstore_initialized))
|
||||||
|
{
|
||||||
|
g_backstore =
|
||||||
|
XCreatePixmap(g_display, g_wnd, g_width, g_height,
|
||||||
|
g_depth);
|
||||||
|
|
||||||
|
/* clear to prevent rubbish being exposed at startup */
|
||||||
|
XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen));
|
||||||
|
XFillRectangle(g_display, g_backstore, g_gc, 0, 0, g_width, g_height);
|
||||||
|
g_backstore_initialized = True;
|
||||||
|
}
|
||||||
|
|
||||||
XStoreName(g_display, g_wnd, g_title);
|
XStoreName(g_display, g_wnd, g_title);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user