+ Refresh the X11 window when an exposure event is received. + When resizing the X11 window, start showing extra characters when two thirds are visible.tags/v0.99.beta14
@@ -85,6 +85,8 @@ extern enum caca_feature _caca_antialiasing; | |||||
#include <X11/Xlib.h> | #include <X11/Xlib.h> | ||||
extern Display *x11_dpy; | extern Display *x11_dpy; | ||||
extern Window x11_window; | extern Window x11_window; | ||||
extern Pixmap x11_pixmap; | |||||
extern GC x11_gc; | |||||
extern long int x11_event_mask; | extern long int x11_event_mask; | ||||
extern int x11_font_width, x11_font_height; | extern int x11_font_width, x11_font_height; | ||||
extern unsigned int x11_new_width, x11_new_height; | extern unsigned int x11_new_width, x11_new_height; | ||||
@@ -259,11 +259,24 @@ static unsigned int _lowlevel_event(void) | |||||
{ | { | ||||
KeySym keysym; | KeySym keysym; | ||||
/* Expose event */ | |||||
if(xevent.type == Expose) | |||||
{ | |||||
XCopyArea(x11_dpy, x11_pixmap, x11_window, x11_gc, 0, 0, | |||||
_caca_width * x11_font_width, | |||||
_caca_height * x11_font_height, 0, 0); | |||||
continue; | |||||
} | |||||
/* Resize event */ | /* Resize event */ | ||||
if(xevent.type == ConfigureNotify) | if(xevent.type == ConfigureNotify) | ||||
{ | { | ||||
unsigned int w = xevent.xconfigure.width / x11_font_width; | |||||
unsigned int h = xevent.xconfigure.height / x11_font_height; | |||||
unsigned int w, h; | |||||
h = (xevent.xconfigure.height + x11_font_height / 3) | |||||
/ x11_font_height; | |||||
w = (xevent.xconfigure.width + x11_font_width / 3) | |||||
/ x11_font_width; | |||||
if(w == _caca_width && h == _caca_height) | if(w == _caca_width && h == _caca_height) | ||||
continue; | continue; | ||||
@@ -163,12 +163,13 @@ static char *conio_screen; | |||||
#if defined(USE_X11) && !defined(_DOXYGEN_SKIP_ME) | #if defined(USE_X11) && !defined(_DOXYGEN_SKIP_ME) | ||||
Display *x11_dpy; | Display *x11_dpy; | ||||
Window x11_window; | Window x11_window; | ||||
Pixmap x11_pixmap; | |||||
GC x11_gc; | |||||
long int x11_event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | long int x11_event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ||||
| ButtonReleaseMask | PointerMotionMask | StructureNotifyMask; | |||||
| ButtonReleaseMask | PointerMotionMask | StructureNotifyMask | |||||
| ExposureMask; | |||||
int x11_font_width, x11_font_height; | int x11_font_width, x11_font_height; | ||||
unsigned int x11_new_width, x11_new_height; | unsigned int x11_new_width, x11_new_height; | ||||
static GC x11_gc; | |||||
static Pixmap x11_pixmap; | |||||
static uint8_t *x11_char, *x11_attr; | static uint8_t *x11_char, *x11_attr; | ||||
static int x11_colors[16]; | static int x11_colors[16]; | ||||
static Font x11_font; | static Font x11_font; | ||||