owncolmap reintroduced, basically the same code, but with a switch -C. didn't use the -v switch as in the patches. I believe it is confusing and should be reserved for -version information. Other than that I can say that the code does not work as it does in the patches... haven't found what's wrong with it. bit shifting?
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@278 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
517c36f2ef
commit
ba91c632d4
@ -57,6 +57,7 @@ BOOL desktop_save = True;
|
||||
BOOL fullscreen = False;
|
||||
BOOL grab_keyboard = True;
|
||||
BOOL hide_decorations = False;
|
||||
extern BOOL owncolmap;
|
||||
|
||||
/* Display usage information */
|
||||
static void
|
||||
@ -79,6 +80,7 @@ usage(char *program)
|
||||
fprintf(stderr, " -b: force bitmap updates\n");
|
||||
fprintf(stderr, " -e: disable encryption (French TS)\n");
|
||||
fprintf(stderr, " -m: do not send motion events\n");
|
||||
fprintf(stderr, " -C: use private colour map\n");
|
||||
fprintf(stderr, " -K: keep window manager key bindings\n");
|
||||
fprintf(stderr, " -T: window title\n");
|
||||
fprintf(stderr, " -D: hide window manager decorations\n");
|
||||
@ -141,7 +143,7 @@ main(int argc, char *argv[])
|
||||
domain[0] = password[0] = shell[0] = directory[0] = 0;
|
||||
strcpy(keymapname, "en-us");
|
||||
|
||||
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemKT:Dh?")) != -1)
|
||||
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemCKT:Dh?")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@ -219,6 +221,10 @@ main(int argc, char *argv[])
|
||||
sendmotion = False;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
owncolmap = True;
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
grab_keyboard = False;
|
||||
break;
|
||||
|
55
xwin.c
55
xwin.c
@ -79,11 +79,13 @@ PropMotifWmHints;
|
||||
}
|
||||
|
||||
/* colour maps */
|
||||
BOOL owncolmap = False;
|
||||
static Colormap xcolmap;
|
||||
static uint32 *colmap;
|
||||
|
||||
#define SET_FOREGROUND(col) XSetForeground(display, gc, translate_colour(colmap[col]));
|
||||
#define SET_BACKGROUND(col) XSetBackground(display, gc, translate_colour(colmap[col]));
|
||||
#define TRANSLATE(col) ( owncolmap ? col : translate_colour(colmap[col]) )
|
||||
#define SET_FOREGROUND(col) XSetForeground(display, gc, TRANSLATE(col));
|
||||
#define SET_BACKGROUND(col) XSetBackground(display, gc, TRANSLATE(col));
|
||||
|
||||
static int rop2_map[] = {
|
||||
GXclear, /* 0 */
|
||||
@ -289,7 +291,16 @@ ui_init(void)
|
||||
return False;
|
||||
}
|
||||
|
||||
if (owncolmap != True)
|
||||
{
|
||||
xcolmap = DefaultColormapOfScreen(screen);
|
||||
if (depth <= 8)
|
||||
{
|
||||
printf("You're using a screen depth of 8-bits or lower\n");
|
||||
printf("If you get scewed colours, try the -C switch\n");
|
||||
}
|
||||
}
|
||||
|
||||
gc = XCreateGC(display, RootWindowOfScreen(screen), 0, NULL);
|
||||
|
||||
if (DoesBackingStore(screen) != Always)
|
||||
@ -711,7 +722,7 @@ ui_create_bitmap(int width, int height, uint8 * data)
|
||||
Pixmap bitmap;
|
||||
uint8 *tdata;
|
||||
|
||||
tdata = translate_image(width, height, data);
|
||||
tdata = (owncolmap ? data : translate_image(width, height, data));
|
||||
bitmap = XCreatePixmap(display, wnd, width, height, depth);
|
||||
image = XCreateImage(display, visual, depth, ZPixmap, 0,
|
||||
(char *) tdata, width, height, 8, 0);
|
||||
@ -719,6 +730,7 @@ ui_create_bitmap(int width, int height, uint8 * data)
|
||||
XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);
|
||||
|
||||
XFree(image);
|
||||
if (!owncolmap)
|
||||
xfree(tdata);
|
||||
return (HBITMAP) bitmap;
|
||||
}
|
||||
@ -729,7 +741,7 @@ ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * dat
|
||||
XImage *image;
|
||||
uint8 *tdata;
|
||||
|
||||
tdata = translate_image(width, height, data);
|
||||
tdata = (owncolmap ? data : translate_image(width, height, data));
|
||||
image = XCreateImage(display, visual, depth, ZPixmap, 0,
|
||||
(char *) tdata, width, height, 8, 0);
|
||||
|
||||
@ -744,6 +756,7 @@ ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * dat
|
||||
}
|
||||
|
||||
XFree(image);
|
||||
if (!owncolmap)
|
||||
xfree(tdata);
|
||||
}
|
||||
|
||||
@ -875,11 +888,14 @@ ui_destroy_cursor(HCURSOR cursor)
|
||||
(xc)->blue = ((c)->blue << 8) | (c)->blue; \
|
||||
(xc)->flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
|
||||
HCOLOURMAP
|
||||
ui_create_colourmap(COLOURMAP * colours)
|
||||
{
|
||||
COLOURENTRY *entry;
|
||||
int i, ncolours = colours->ncolours;
|
||||
if (!owncolmap)
|
||||
{
|
||||
uint32 *map = xmalloc(sizeof(*colmap) * ncolours);
|
||||
XColor xentry;
|
||||
XColor xc_cache[256];
|
||||
@ -905,7 +921,8 @@ ui_create_colourmap(COLOURMAP * colours)
|
||||
xc_cache[colLookup].blue = 0;
|
||||
xc_cache[colLookup].flags = 0;
|
||||
XQueryColor(display,
|
||||
DefaultColormap(display, DefaultScreen(display)),
|
||||
DefaultColormap(display,
|
||||
DefaultScreen(display)),
|
||||
&xc_cache[colLookup]);
|
||||
}
|
||||
colLookup = 0;
|
||||
@ -950,20 +967,46 @@ ui_create_colourmap(COLOURMAP * colours)
|
||||
/* byte swap here to make translate_image faster */
|
||||
map[i] = translate_colour(colour);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
else
|
||||
{
|
||||
XColor *xcolours, *xentry;
|
||||
Colormap map;
|
||||
|
||||
xcolours = xmalloc(sizeof(XColor) * ncolours);
|
||||
for (i = 0; i < ncolours; i++)
|
||||
{
|
||||
entry = &colours->colours[i];
|
||||
xentry = &xcolours[i];
|
||||
xentry->pixel = i;
|
||||
MAKE_XCOLOR(xentry, entry);
|
||||
}
|
||||
|
||||
map = XCreateColormap(display, wnd, visual, AllocAll);
|
||||
XStoreColors(display, map, xcolours, ncolours);
|
||||
|
||||
xfree(xcolours);
|
||||
return (HCOLOURMAP) map;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_destroy_colourmap(HCOLOURMAP map)
|
||||
{
|
||||
if (!owncolmap)
|
||||
xfree(map);
|
||||
else
|
||||
XFreeColormap(display, (Colormap) map);
|
||||
}
|
||||
|
||||
void
|
||||
ui_set_colourmap(HCOLOURMAP map)
|
||||
{
|
||||
if (!owncolmap)
|
||||
colmap = map;
|
||||
else
|
||||
XSetWindowColormap(display, wnd, (Colormap) map);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user