Commits (3)
...@@ -71,6 +71,7 @@ static Display *dpy=NULL; ...@@ -71,6 +71,7 @@ static Display *dpy=NULL;
static Window win; static Window win;
static Cursor curs = None; static Cursor curs = None;
static Visual visual; static Visual visual;
static bool VisualIsRGB8 = false;
static XImage *xim; static XImage *xim;
static XIM im; static XIM im;
static XIC ic; static XIC ic;
...@@ -284,6 +285,13 @@ static int init_window() ...@@ -284,6 +285,13 @@ static int init_window()
} }
if (best != -1) { if (best != -1) {
visual = *vi[best].visual; visual = *vi[best].visual;
/*
* TODO: Set VisualIsRGB8 if appropriate...
* "appropriate" in this context means it's a sequence of
* unpadded uint32_t values in XXRRGGBB format where XX is
* ignored, and RR, GG, and BB are Red, Green, Blue values
* respectively.
*/
base_pixel = ULONG_MAX; base_pixel = ULONG_MAX;
base_pixel &= ~visual.red_mask; base_pixel &= ~visual.red_mask;
base_pixel &= ~visual.green_mask; base_pixel &= ~visual.green_mask;
...@@ -477,7 +485,6 @@ local_draw_rect(struct rectlist *rect) ...@@ -477,7 +485,6 @@ local_draw_rect(struct rectlist *rect)
int idx; int idx;
uint32_t last_pixel = 0x55555555; uint32_t last_pixel = 0x55555555;
struct graphics_buffer *source; struct graphics_buffer *source;
bool isRGB8 = false;
if (bitmap_width != rect->rect.width || bitmap_height != rect->rect.height) { if (bitmap_width != rect->rect.width || bitmap_height != rect->rect.height) {
bitmap_drv_free_rect(rect); bitmap_drv_free_rect(rect);
...@@ -513,8 +520,6 @@ local_draw_rect(struct rectlist *rect) ...@@ -513,8 +520,6 @@ local_draw_rect(struct rectlist *rect)
/* TODO: Translate into local colour depth */ /* TODO: Translate into local colour depth */
idx = 0; idx = 0;
if (visual.red_mask == 0xff0000 && visual.green_mask == 0x00ff00 && visual.blue_mask == 0x0000ff)
isRGB8 = true;
for (y = 0; y < source->h; y++) { for (y = 0; y < source->h; y++) {
for (x = 0; x < source->w; x++) { for (x = 0; x < source->w; x++) {
...@@ -534,7 +539,7 @@ local_draw_rect(struct rectlist *rect) ...@@ -534,7 +539,7 @@ local_draw_rect(struct rectlist *rect)
continue; continue;
} }
} }
if (isRGB8) { if (VisualIsRGB8) {
pixel = source->data[idx]; pixel = source->data[idx];
((uint32_t*)xim->data)[idx] = pixel; ((uint32_t*)xim->data)[idx] = pixel;
} }
...@@ -971,7 +976,10 @@ static int x11_event(XEvent *ev) ...@@ -971,7 +976,10 @@ static int x11_event(XEvent *ev)
case XLookupChars: case XLookupChars:
if (lus == XLookupChars || ((ev->xkey.state & (Mod1Mask | ControlMask)) == 0)) { if (lus == XLookupChars || ((ev->xkey.state & (Mod1Mask | ControlMask)) == 0)) {
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
ch = cpchar_from_unicode_cpoint(getcodepage(), wbuf[i], 0); if (wbuf[i] < 127)
ch = wbuf[i];
else
ch = cpchar_from_unicode_cpoint(getcodepage(), wbuf[i], 0);
if (ch) { if (ch) {
write(key_pipe[1], &ch, 1); write(key_pipe[1], &ch, 1);
} }
......
...@@ -1772,6 +1772,7 @@ int main(int argc, char **argv) ...@@ -1772,6 +1772,7 @@ int main(int argc, char **argv)
FREE_AND_NULL(conio_fontdata[i].desc); FREE_AND_NULL(conio_fontdata[i].desc);
} }
load_font_files(); load_font_files();
setfont(find_font_id(bbs->font),TRUE,1);
if(doterm(bbs)) if(doterm(bbs))
quitting=TRUE; quitting=TRUE;
fake_mode = -1; fake_mode = -1;
......