[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs TODO.org display.h html.c qe.h x11.c cfb...
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs TODO.org display.h html.c qe.h x11.c cfb... |
Date: |
Tue, 18 Apr 2017 05:14:56 -0400 (EDT) |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 17/04/18 05:14:55
Modified files:
. : TODO.org display.h html.c qe.h x11.c cfb.c
extras.c html2png.c tty.c display.c haiku.cpp
qe.c win32.c
Log message:
display: small fixes for consistency
- add wrappers in display.h
- renamed tty dpy_xxx handlers for consistency
- separate tty_term_resize called on signal and tty_dpy_invalidate
- add dpy_xor_rectangle for software cursor, remove QECOLOR_XOR
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/TODO.org?cvsroot=qemacs&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/qemacs/display.h?cvsroot=qemacs&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/qemacs/html.c?cvsroot=qemacs&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.253&r2=1.254
http://cvs.savannah.gnu.org/viewcvs/qemacs/x11.c?cvsroot=qemacs&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/qemacs/cfb.c?cvsroot=qemacs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/qemacs/extras.c?cvsroot=qemacs&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/qemacs/html2png.c?cvsroot=qemacs&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/qemacs/tty.c?cvsroot=qemacs&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/qemacs/display.c?cvsroot=qemacs&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/qemacs/haiku.cpp?cvsroot=qemacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.271&r2=1.272
http://cvs.savannah.gnu.org/viewcvs/qemacs/win32.c?cvsroot=qemacs&r1=1.18&r2=1.19
Patches:
Index: TODO.org
===================================================================
RCS file: /sources/qemacs/qemacs/TODO.org,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- TODO.org 17 Apr 2017 18:14:15 -0000 1.36
+++ TODO.org 18 Apr 2017 09:14:55 -0000 1.37
@@ -32,7 +32,6 @@
** basic: share mmapped pages correctly
** completion: fix electric behavior
** completion: add completion function to get the default value
-** display: remove QECOLOR_XOR mess, use dpy_cursor_at for all devices
** files: check file date to detect asynchronous modifications on disk
** files: reload modified file upon change if untouched since load
** layout: kill buffer should delete popup and popleft window
Index: display.h
===================================================================
RCS file: /sources/qemacs/qemacs/display.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- display.h 11 Apr 2017 06:46:13 -0000 1.20
+++ display.h 18 Apr 2017 09:14:55 -0000 1.21
@@ -105,6 +105,8 @@
int (*dpy_is_user_input_pending)(QEditScreen *s);
void (*dpy_fill_rectangle)(QEditScreen *s,
int x, int y, int w, int h, QEColor color);
+ void (*dpy_xor_rectangle)(QEditScreen *s,
+ int x, int y, int w, int h, QEColor color);
QEFont *(*dpy_open_font)(QEditScreen *s, int style, int size);
void (*dpy_close_font)(QEditScreen *s, QEFont **fontp);
void (*dpy_text_metrics)(QEditScreen *s, QEFont *font,
@@ -217,8 +219,10 @@
int dst_x, int dst_y, int dst_w, int dst_h,
int offset_x, int offset_y, int flags)
{
+ if (s->dpy.dpy_bmp_draw) {
s->dpy.dpy_bmp_draw(s, b, dst_x, dst_y, dst_w, dst_h,
offset_x, offset_y, flags);
+ }
}
/* used to access the bitmap data. Return the necessary pointers to
@@ -226,14 +230,28 @@
static inline void bmp_lock(QEditScreen *s, QEBitmap *bitmap, QEPicture *pict,
int x1, int y1, int w1, int h1)
{
+ if (s->dpy.dpy_bmp_lock)
s->dpy.dpy_bmp_lock(s, bitmap, pict, x1, y1, w1, h1);
}
static inline void bmp_unlock(QEditScreen *s, QEBitmap *bitmap)
{
+ if (s->dpy.dpy_bmp_unlock)
s->dpy.dpy_bmp_unlock(s, bitmap);
}
+static inline void dpy_full_screen(QEditScreen *s, int full_screen)
+{
+ if (s->dpy.dpy_full_screen)
+ s->dpy.dpy_full_screen(s, full_screen);
+}
+
+static inline void dpy_describe(QEditScreen *s, EditBuffer *b)
+{
+ if (s->dpy.dpy_describe)
+ s->dpy.dpy_describe(s, b);
+}
+
/* XXX: only needed for backward compatibility */
static inline int glyph_width(QEditScreen *s, QEFont *font, int ch)
{
@@ -246,6 +264,8 @@
void fill_rectangle(QEditScreen *s,
int x1, int y1, int w, int h, QEColor color);
+void xor_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color);
void set_clip_rectangle(QEditScreen *s, CSSRect *r);
void push_clip_rectangle(QEditScreen *s, CSSRect *r0, CSSRect *r);
Index: html.c
===================================================================
RCS file: /sources/qemacs/qemacs/html.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- html.c 16 Apr 2017 21:51:20 -0000 1.42
+++ html.c 18 Apr 2017 09:14:55 -0000 1.43
@@ -341,7 +341,7 @@
/* hardware cursor */
s->screen->dpy.dpy_cursor_at(s->screen, x, y, w, h);
} else {
- fill_rectangle(s->screen, x, y, w, h, QECOLOR_XOR);
+ xor_rectangle(s->screen, x, y, w, h, QERGB(0xFF, 0xFF, 0xFF));
/* invalidate rectangle modified by cursor */
css_set_rect(&rect, x, y, x + w, y + h);
css_union_rect(&hs->invalid_rect, &rect);
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.253
retrieving revision 1.254
diff -u -b -r1.253 -r1.254
--- qe.h 17 Apr 2017 23:01:21 -0000 1.253
+++ qe.h 18 Apr 2017 09:14:55 -0000 1.254
@@ -206,7 +206,6 @@
#define QERGB(r,g,b) QEARGB(0xff, r, g, b)
#define QERGB25(r,g,b) QEARGB(1, r, g, b)
#define COLOR_TRANSPARENT 0
-#define QECOLOR_XOR 1
/* A qemacs style is a named set of attributes including:
* - colors for foreground and background
Index: x11.c
===================================================================
RCS file: /sources/qemacs/qemacs/x11.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- x11.c 17 Apr 2017 23:06:06 -0000 1.50
+++ x11.c 18 Apr 2017 09:14:55 -0000 1.51
@@ -499,20 +499,6 @@
}
}
-static void xor_rectangle(QEditScreen *s, int x, int y, int w, int h)
-{
- X11State *xs = s->priv_data;
- int fg;
-
- fg = WhitePixel(xs->display, xs->xscreen);
- XSetForeground(xs->display, xs->gc, fg);
- XSetFunction(xs->display, xs->gc, GXxor);
-
- XFillRectangle(xs->display, xs->dbuffer, xs->gc, x, y, w, h);
-
- XSetFunction(xs->display, xs->gc, GXcopy);
-}
-
/* Print the unicode string 'str' with baseline at position (x,y). The
higher bits of each char may contain attributes. */
#ifdef CONFIG_XFT
@@ -524,11 +510,6 @@
XftColor col;
int r, g, b, a;
- if (color == QECOLOR_XOR) {
- xor_rectangle(s, x1, y1, w, h);
- return;
- }
-
a = (color >> 24) & 0xff;
r = (color >> 16) & 0xff;
g = (color >> 8) & 0xff;
@@ -542,6 +523,19 @@
XftDrawRect(xs->renderDraw, &col, x1, y1, w, h);
}
+static void x11_dpy_xor_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color)
+{
+ X11State *xs = s->priv_data;
+ int fg;
+
+ fg = WhitePixel(xs->display, xs->xscreen);
+ XSetForeground(xs->display, xs->gc, fg);
+ XSetFunction(xs->display, xs->gc, GXxor);
+ XFillRectangle(xs->display, xs->dbuffer, xs->gc, x1, y1, w, h);
+ XSetFunction(xs->display, xs->gc, GXcopy);
+}
+
static QEFont *x11_dpy_open_font(QEditScreen *s, int style, int size)
{
X11State *xs = s->priv_data;
@@ -650,16 +644,26 @@
update_rect(xs, x1, y1, x1 + w, y1 + h);
- if (color == QECOLOR_XOR) {
- xor_rectangle(s, x1, y1, w, h);
- return;
- }
-
xcolor = get_x11_color(xs, color);
XSetForeground(xs->display, xs->gc, xcolor);
XFillRectangle(xs->display, xs->dbuffer, xs->gc, x1, y1, w, h);
}
+static void x11_dpy_xor_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color)
+{
+ X11State *xs = s->priv_data;
+ int fg;
+
+ update_rect(xs, x1, y1, x1 + w, y1 + h);
+
+ fg = WhitePixel(xs->display, xs->xscreen);
+ XSetForeground(xs->display, xs->gc, fg);
+ XSetFunction(xs->display, xs->gc, GXxor);
+ XFillRectangle(xs->display, xs->dbuffer, xs->gc, x1, y1, w, h);
+ XSetFunction(xs->display, xs->gc, GXcopy);
+}
+
static void get_entry(char *buf, int buf_size, const char **pp)
{
const char *p, *r;
@@ -1887,6 +1891,7 @@
x11_dpy_flush,
x11_dpy_is_user_input_pending,
x11_dpy_fill_rectangle,
+ x11_dpy_xor_rectangle,
x11_dpy_open_font,
x11_dpy_close_font,
x11_dpy_text_metrics,
Index: cfb.c
===================================================================
RCS file: /sources/qemacs/qemacs/cfb.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- cfb.c 11 Apr 2017 06:46:13 -0000 1.13
+++ cfb.c 18 Apr 2017 09:14:55 -0000 1.14
@@ -59,17 +59,6 @@
col = (col << 16) | col;
dest = cfb->base + y1 * cfb->wrap + x1 * 2;
- if (color == QECOLOR_XOR) {
- /* XXX: suppress this mess */
- for (y = 0; y < h; y++) {
- d = dest;
- for (n = w; n != 0; n--) {
- ((uint16_t *)(void *)d)[0] ^= 0xffff;
- d += 2;
- }
- dest += cfb->wrap;
- }
- } else {
for (y = 0; y < h; y++) {
d = dest;
n = w;
@@ -95,10 +84,9 @@
}
dest += cfb->wrap;
}
- }
}
-static void cfb32_fill_rectangle(QEditScreen *s,
+static void cfb16_xor_rectangle(QEditScreen *s,
int x1, int y1, int w, int h, QEColor color)
{
CFBContext *cfb = s->priv_data;
@@ -107,19 +95,30 @@
unsigned int col;
col = cfb->get_color(color);
+ col = (col << 16) | col;
- dest = cfb->base + y1 * cfb->wrap + x1 * 4;
- if (color == QECOLOR_XOR) {
- /* XXX: suppress this mess */
+ dest = cfb->base + y1 * cfb->wrap + x1 * 2;
for (y = 0; y < h; y++) {
d = dest;
for (n = w; n != 0; n--) {
- ((uint32_t *)(void *)d)[0] ^= 0x00ffffff;
- d += 4;
+ ((uint16_t *)(void *)d)[0] ^= 0xffff;
+ d += 2;
}
dest += cfb->wrap;
}
- } else {
+}
+
+static void cfb32_fill_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color)
+{
+ CFBContext *cfb = s->priv_data;
+ unsigned char *dest, *d;
+ int y, n;
+ unsigned int col;
+
+ col = cfb->get_color(color);
+
+ dest = cfb->base + y1 * cfb->wrap + x1 * 4;
for (y = 0; y < h; y++) {
d = dest;
n = w;
@@ -138,6 +137,26 @@
}
dest += cfb->wrap;
}
+}
+
+static void cfb32_xor_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color)
+{
+ CFBContext *cfb = s->priv_data;
+ unsigned char *dest, *d;
+ int y, n;
+ unsigned int col;
+
+ col = cfb->get_color(color);
+
+ dest = cfb->base + y1 * cfb->wrap + x1 * 4;
+ for (y = 0; y < h; y++) {
+ d = dest;
+ for (n = w; n != 0; n--) {
+ ((uint32_t *)(void *)d)[0] ^= 0x00ffffff;
+ d += 4;
+ }
+ dest += cfb->wrap;
}
}
@@ -332,11 +351,13 @@
switch (cfb->bpp) {
case 2:
s->dpy.dpy_fill_rectangle = cfb16_fill_rectangle;
+ s->dpy.dpy_xor_rectangle = cfb16_xor_rectangle;
cfb->draw_glyph = cfb16_draw_glyph;
break;
default:
case 4:
s->dpy.dpy_fill_rectangle = cfb32_fill_rectangle;
+ s->dpy.dpy_xor_rectangle = cfb32_xor_rectangle;
cfb->draw_glyph = cfb32_draw_glyph;
break;
}
Index: extras.c
===================================================================
RCS file: /sources/qemacs/qemacs/extras.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- extras.c 17 Apr 2017 18:14:15 -0000 1.69
+++ extras.c 18 Apr 2017 09:14:55 -0000 1.70
@@ -1503,9 +1503,7 @@
eb_printf(b1, "%*s: %x << %d\n", w, "QE_TERM_FG_COLORS",
QE_TERM_FG_COLORS, QE_TERM_FG_SHIFT);
eb_printf(b1, "%*s: %x << %d\n\n", w, "QE_TERM_BG_COLORS",
QE_TERM_BG_COLORS, QE_TERM_BG_SHIFT);
- if (s->dpy.dpy_describe) {
- s->dpy.dpy_describe(s, b1);
- }
+ dpy_describe(s, b1);
b1->flags |= BF_READONLY;
show_popup(e, b1);
Index: html2png.c
===================================================================
RCS file: /sources/qemacs/qemacs/html2png.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- html2png.c 11 Apr 2017 06:46:13 -0000 1.19
+++ html2png.c 18 Apr 2017 09:14:55 -0000 1.20
@@ -115,6 +115,7 @@
NULL, /* dpy_flush */
NULL, /* dpy_is_user_input_pending */
NULL, /* dpy_fill_rectangle */
+ NULL, /* dpy_xor_rectangle */
NULL, /* dpy_open_font */
NULL, /* dpy_close_font */
NULL, /* dpy_text_metrics */
Index: tty.c
===================================================================
RCS file: /sources/qemacs/qemacs/tty.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- tty.c 17 Apr 2017 23:01:21 -0000 1.80
+++ tty.c 18 Apr 2017 09:14:55 -0000 1.81
@@ -144,19 +144,20 @@
unsigned int comb_cache[COMB_CACHE_SIZE];
} TTYState;
-static void tty_term_invalidate(QEditScreen *s);
-static void tty_resize(int sig);
+static QEditScreen *tty_screen; /* for tty_term_exit and tty_term_resize */
+
+static void tty_dpy_invalidate(QEditScreen *s);
+
+static void tty_term_resize(int sig);
static void tty_term_exit(void);
static void tty_read_handler(void *opaque);
-static QEditScreen *tty_screen; /* for tty_term_exit and tty_resize */
-
-static int tty_term_probe(void)
+static int tty_dpy_probe(void)
{
return 1;
}
-static int tty_term_init(QEditScreen *s,
+static int tty_dpy_init(QEditScreen *s,
qe__unused__ int w, qe__unused__ int h)
{
TTYState *ts;
@@ -320,7 +321,7 @@
atexit(tty_term_exit);
- sig.sa_handler = tty_resize;
+ sig.sa_handler = tty_term_resize;
sigemptyset(&sig.sa_mask);
sig.sa_flags = 0;
sigaction(SIGWINCH, &sig, NULL);
@@ -333,7 +334,7 @@
set_read_handler(fileno(s->STDIN), tty_read_handler, s);
- tty_term_invalidate(s);
+ tty_dpy_invalidate(s);
if (ts->term_flags & KBS_CONTROL_H) {
do_toggle_control_h(NULL, 1);
@@ -342,7 +343,7 @@
return 0;
}
-static void tty_term_close(QEditScreen *s)
+static void tty_dpy_close(QEditScreen *s)
{
TTYState *ts = s->priv_data;
@@ -371,23 +372,29 @@
static void tty_term_exit(void)
{
QEditScreen *s = tty_screen;
- TTYState *ts = s->priv_data;
+ if (s) {
+ TTYState *ts = s->priv_data;
+ if (ts) {
tcsetattr(fileno(s->STDIN), TCSANOW, &ts->oldtty);
+ }
+ }
}
-static void tty_resize(qe__unused__ int sig)
+static void tty_term_resize(qe__unused__ int sig)
{
QEditScreen *s = tty_screen;
- tty_term_invalidate(s);
+ if (s) {
+ tty_dpy_invalidate(s);
- //fprintf(stderr, "tty_resize: width=%d, height=%d\n", s->width,
s->height);
+ //fprintf(stderr, "tty_term_resize: width=%d, height=%d\n", s->width,
s->height);
url_redisplay();
+ }
}
-static void tty_term_invalidate(QEditScreen *s)
+static void tty_dpy_invalidate(QEditScreen *s)
{
TTYState *ts;
struct winsize ws;
@@ -435,7 +442,7 @@
s->clip_y2 = s->height;
}
-static void tty_term_cursor_at(QEditScreen *s, int x1, int y1,
+static void tty_dpy_cursor_at(QEditScreen *s, int x1, int y1,
qe__unused__ int w, qe__unused__ int h)
{
TTYState *ts = s->priv_data;
@@ -443,7 +450,7 @@
ts->cursor_y = y1;
}
-static int tty_term_is_user_input_pending(QEditScreen *s)
+static int tty_dpy_is_user_input_pending(QEditScreen *s)
{
fd_set rfds;
struct timeval tv;
@@ -538,7 +545,7 @@
}
}
if (ch == '\033') {
- if (!tty_term_is_user_input_pending(s)) {
+ if (!tty_dpy_is_user_input_pending(s)) {
/* Trick to distinguish the ESC key from function and meta
* keys transmitting escape sequences starting with \033
* but followed immediately by more characters.
@@ -556,7 +563,7 @@
goto the_end;
}
if (ch == '[') {
- if (!tty_term_is_user_input_pending(s)) {
+ if (!tty_dpy_is_user_input_pending(s)) {
ch = KEY_META('[');
ts->input_state = IS_NORM;
goto the_end;
@@ -685,43 +692,53 @@
}
}
-static void tty_term_fill_rectangle(QEditScreen *s,
+static void tty_dpy_fill_rectangle(QEditScreen *s,
int x1, int y1, int w, int h, QEColor
color)
{
TTYState *ts = s->priv_data;
+ int x, y;
int x2 = x1 + w;
int y2 = y1 + h;
- int x, y;
- TTYChar *ptr;
int wrap = s->width - w;
+ TTYChar *ptr;
unsigned int bgcolor;
ptr = ts->screen + y1 * s->width + x1;
- if (color == QECOLOR_XOR) {
+ bgcolor = qe_map_color(color, ts->tty_colors, ts->tty_bg_colors_count,
NULL);
for (y = y1; y < y2; y++) {
ts->line_updated[y] = 1;
for (x = x1; x < x2; x++) {
- /* XXX: should reverse fg and bg */
- *ptr ^= TTY_CHAR(0, 7, 7);
+ *ptr = TTY_CHAR(' ', 7, bgcolor);
ptr++;
}
ptr += wrap;
}
- } else {
- bgcolor = qe_map_color(color, ts->tty_colors, ts->tty_bg_colors_count,
NULL);
+}
+
+static void tty_dpy_xor_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color)
+{
+ TTYState *ts = s->priv_data;
+ int x, y;
+ int x2 = x1 + w;
+ int y2 = y1 + h;
+ int wrap = s->width - w;
+ TTYChar *ptr;
+
+ ptr = ts->screen + y1 * s->width + x1;
for (y = y1; y < y2; y++) {
ts->line_updated[y] = 1;
for (x = x1; x < x2; x++) {
- *ptr = TTY_CHAR(' ', 7, bgcolor);
+ /* XXX: should reverse fg and bg */
+ *ptr ^= TTY_CHAR(0, 7, 7);
ptr++;
}
ptr += wrap;
}
- }
}
/* XXX: could alloc font in wrapper */
-static QEFont *tty_term_open_font(qe__unused__ QEditScreen *s,
+static QEFont *tty_dpy_open_font(qe__unused__ QEditScreen *s,
qe__unused__ int style, qe__unused__ int
size)
{
QEFont *font;
@@ -736,7 +753,7 @@
return font;
}
-static void tty_term_close_font(qe__unused__ QEditScreen *s, QEFont **fontp)
+static void tty_dpy_close_font(qe__unused__ QEditScreen *s, QEFont **fontp)
{
qe_free(fontp);
}
@@ -750,7 +767,7 @@
return unicode_tty_glyph_width(ucs);
}
-static void tty_term_text_metrics(QEditScreen *s, qe__unused__ QEFont *font,
+static void tty_dpy_text_metrics(QEditScreen *s, qe__unused__ QEFont *font,
QECharMetrics *metrics,
const unsigned int *str, int len)
{
@@ -879,7 +896,7 @@
#define comb_cache_describe(s, b)
#endif
-static void tty_term_draw_text(QEditScreen *s, QEFont *font,
+static void tty_dpy_draw_text(QEditScreen *s, QEFont *font,
int x, int y, const unsigned int *str0, int len,
QEColor color)
{
@@ -972,13 +989,13 @@
}
}
-static void tty_term_set_clip(qe__unused__ QEditScreen *s,
+static void tty_dpy_set_clip(qe__unused__ QEditScreen *s,
qe__unused__ int x, qe__unused__ int y,
qe__unused__ int w, qe__unused__ int h)
{
}
-static void tty_term_flush(QEditScreen *s)
+static void tty_dpy_flush(QEditScreen *s)
{
TTYState *ts = s->priv_data;
TTYChar *ptr, *ptr1, *ptr2, *ptr3, *ptr4, cc, blankcc;
@@ -1292,34 +1309,36 @@
comb_cache_clean(ts, ts->screen, ts->screen_size);
}
-static void tty_term_describe(QEditScreen *s, EditBuffer *b) {
+static void tty_dpy_describe(QEditScreen *s, EditBuffer *b)
+{
comb_cache_describe(s, b);
}
static QEDisplay tty_dpy = {
"vt100",
- tty_term_probe,
- tty_term_init,
- tty_term_close,
- tty_term_flush,
- tty_term_is_user_input_pending,
- tty_term_fill_rectangle,
- tty_term_open_font,
- tty_term_close_font,
- tty_term_text_metrics,
- tty_term_draw_text,
- tty_term_set_clip,
+ tty_dpy_probe,
+ tty_dpy_init,
+ tty_dpy_close,
+ tty_dpy_flush,
+ tty_dpy_is_user_input_pending,
+ tty_dpy_fill_rectangle,
+ tty_dpy_xor_rectangle,
+ tty_dpy_open_font,
+ tty_dpy_close_font,
+ tty_dpy_text_metrics,
+ tty_dpy_draw_text,
+ tty_dpy_set_clip,
NULL, /* dpy_selection_activate */
NULL, /* dpy_selection_request */
- tty_term_invalidate,
- tty_term_cursor_at,
+ tty_dpy_invalidate,
+ tty_dpy_cursor_at,
NULL, /* dpy_bmp_alloc */
NULL, /* dpy_bmp_free */
NULL, /* dpy_bmp_draw */
NULL, /* dpy_bmp_lock */
NULL, /* dpy_bmp_unlock */
NULL, /* dpy_full_screen */
- tty_term_describe,
+ tty_dpy_describe,
NULL, /* next */
};
Index: display.c
===================================================================
RCS file: /sources/qemacs/qemacs/display.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- display.c 11 Apr 2017 06:46:13 -0000 1.20
+++ display.c 18 Apr 2017 09:14:55 -0000 1.21
@@ -52,6 +52,13 @@
{
}
+static void dummy_dpy_xor_rectangle(qe__unused__ QEditScreen *s,
+ qe__unused__ int x1, qe__unused__ int y1,
+ qe__unused__ int w, qe__unused__ int h,
+ qe__unused__ QEColor color)
+{
+}
+
static QEFont *dummy_dpy_open_font(qe__unused__ QEditScreen *s,
qe__unused__ int style, qe__unused__ int
size)
{
@@ -91,12 +98,13 @@
static QEDisplay const dummy_dpy = {
"dummy",
- NULL,
+ NULL, /* dpy_probe */
dummy_dpy_init,
dummy_dpy_close,
dummy_dpy_flush,
dummy_dpy_is_user_input_pending,
dummy_dpy_fill_rectangle,
+ dummy_dpy_xor_rectangle,
dummy_dpy_open_font,
dummy_dpy_close_font,
dummy_dpy_text_metrics,
@@ -147,10 +155,25 @@
s->dpy.dpy_fill_rectangle(s, x1, y1, x2 - x1, y2 - y1, color);
}
+void xor_rectangle(QEditScreen *s,
+ int x, int y, int w, int h, QEColor color)
+{
+ /* intersect with clip region */
+ int x1 = max(s->clip_x1, x);
+ int y1 = max(s->clip_y1, y);
+ int x2 = min(s->clip_x2, x1 + w);
+ int y2 = min(s->clip_y2, y1 + h);
+
+ if (x1 < x2 && y1 < y2) {
+ s->dpy.dpy_xor_rectangle(s, x1, y1, x2 - x1, y2 - y1, color);
+ }
+}
+
/* set the clip rectangle (and does not clip by the previous one) */
void set_clip_rectangle(QEditScreen *s, CSSRect *r)
{
int x1, y1, x2, y2;
+
x1 = r->x1;
y1 = r->y1;
x2 = r->x2;
@@ -322,6 +345,7 @@
if (!s->dpy.dpy_bmp_alloc)
return NULL;
+
b = qe_mallocz(QEBitmap);
if (!b)
return NULL;
Index: haiku.cpp
===================================================================
RCS file: /sources/qemacs/qemacs/haiku.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- haiku.cpp 15 Apr 2017 09:39:02 -0000 1.17
+++ haiku.cpp 18 Apr 2017 09:14:55 -0000 1.18
@@ -638,27 +638,29 @@
int x1, int y1, int w, int h, QEColor color)
{
WindowState *ctx = (WindowState *)s->priv_data;
- //fprintf(stderr, "%s()\n", __FUNCTION__);
- drawing_mode oldMode;
BRect r(x1, y1, x1 + w - 1, y1 + h - 1);
rgb_color c = { (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff,
0xff };
ctx->v->LockLooper();
+ ctx->v->SetHighColor(c);
+ ctx->v->FillRect(r);
+ ctx->v->UnlockLooper();
+}
- oldMode = ctx->v->DrawingMode();
+static void haiku_xor_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color)
+{
+ WindowState *ctx = (WindowState *)s->priv_data;
+ drawing_mode oldMode;
+
+ BRect r(x1, y1, x1 + w - 1, y1 + h - 1);
- /* XXX: suppress XOR mode */
- if (color == QECOLOR_XOR)
+ ctx->v->LockLooper();
+ oldMode = ctx->v->DrawingMode();
ctx->v->SetDrawingMode(B_OP_INVERT);
- else
- ctx->v->SetHighColor(c);
ctx->v->FillRect(r);
-
- /* XXX: suppress XOR mode */
- if (color == QECOLOR_XOR)
ctx->v->SetDrawingMode(oldMode);
-
ctx->v->UnlockLooper();
}
@@ -747,10 +749,6 @@
int i;
//fprintf(stderr, "%s()\n", __FUNCTION__);
- /* XXX: suppress XOR mode */
- if (color == QECOLOR_XOR)
- color = QERGB(0xff, 0xff, 0xff);
-
rgb_color c = { (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff,
0xff };
ctx->v->LockLooper();
@@ -873,13 +871,14 @@
haiku_flush,
haiku_is_user_input_pending,
haiku_fill_rectangle,
+ haiku_xor_rectangle,
haiku_open_font,
haiku_close_font,
haiku_text_metrics,
haiku_draw_text,
haiku_set_clip,
- NULL, /* no selection handling */
- NULL, /* no selection handling */
+ NULL, /* dpy_selection_activate */
+ NULL, /* dpy_selection_request */
NULL, /* dpy_invalidate */
NULL, /* dpy_cursor_at */
haiku_bmp_alloc, /* dpy_bmp_alloc */
Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -b -r1.271 -r1.272
--- qe.c 17 Apr 2017 23:01:21 -0000 1.271
+++ qe.c 18 Apr 2017 09:14:55 -0000 1.272
@@ -2974,8 +2974,7 @@
QEditScreen *screen = s->screen;
qs->is_full_screen = !qs->is_full_screen;
- if (screen->dpy.dpy_full_screen)
- screen->dpy.dpy_full_screen(screen, qs->is_full_screen);
+ dpy_full_screen(screen, qs->is_full_screen);
if (qs->is_full_screen)
s->flags &= ~WF_MODELINE;
else
@@ -4355,10 +4354,9 @@
x += w;
w = -w;
}
- fill_rectangle(s->screen, x, y, w, h, QECOLOR_XOR);
+ xor_rectangle(s->screen, x, y, w, h, QERGB(0xFF, 0xFF, 0xFF));
/* invalidate line so that the cursor will be erased next time */
- memset(&s->line_shadow[m->linec], 0xff,
- sizeof(QELineShadow));
+ memset(&s->line_shadow[m->linec], 0xff, sizeof(QELineShadow));
}
}
s->cur_rtl = (m->dirc == DIR_RTL);
Index: win32.c
===================================================================
RCS file: /sources/qemacs/qemacs/win32.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- win32.c 15 Mar 2017 07:24:31 -0000 1.18
+++ win32.c 18 Apr 2017 09:14:55 -0000 1.19
@@ -431,13 +431,26 @@
HBRUSH hbr;
COLORREF col;
- /* XXX: suppress XOR mode */
- if (color == QECOLOR_XOR)
+ SetRect(&rc, x1, y1, x1 + w, y1 + h);
+ col = RGB((color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ hbr = CreateSolidBrush(col);
+ FillRect(win_ctx.hdc, &rc, hbr);
+ DeleteObject(hbr);
+}
+
+static void win_xor_rectangle(QEditScreen *s,
+ int x1, int y1, int w, int h, QEColor color)
+{
+ RECT rc;
+ HBRUSH hbr;
+ COLORREF col;
+
color = QERGB(0xff, 0xff, 0xff);
SetRect(&rc, x1, y1, x1 + w, y1 + h);
col = RGB((color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
hbr = CreateSolidBrush(col);
+ // XXX: set XOR rop?
FillRect(win_ctx.hdc, &rc, hbr);
DeleteObject(hbr);
}
@@ -505,6 +518,7 @@
win_flush,
win_is_user_input_pending,
win_fill_rectangle,
+ win_xor_rectangle,
win_open_font,
win_close_font,
win_text_metrics,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs TODO.org display.h html.c qe.h x11.c cfb...,
Charlie Gordon <=