瀏覽代碼

* src/event.c:

+ 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
Sam Hocevar sam 21 年之前
父節點
當前提交
7a94100442
共有 3 個檔案被更改,包括 21 行新增5 行删除
  1. +2
    -0
      src/caca_internals.h
  2. +15
    -2
      src/event.c
  3. +4
    -3
      src/graphics.c

+ 2
- 0
src/caca_internals.h 查看文件

@@ -85,6 +85,8 @@ extern enum caca_feature _caca_antialiasing;
#include <X11/Xlib.h>
extern Display *x11_dpy;
extern Window x11_window;
extern Pixmap x11_pixmap;
extern GC x11_gc;
extern long int x11_event_mask;
extern int x11_font_width, x11_font_height;
extern unsigned int x11_new_width, x11_new_height;


+ 15
- 2
src/event.c 查看文件

@@ -259,11 +259,24 @@ static unsigned int _lowlevel_event(void)
{
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 */
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)
continue;


+ 4
- 3
src/graphics.c 查看文件

@@ -163,12 +163,13 @@ static char *conio_screen;
#if defined(USE_X11) && !defined(_DOXYGEN_SKIP_ME)
Display *x11_dpy;
Window x11_window;
Pixmap x11_pixmap;
GC x11_gc;
long int x11_event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask
| ButtonReleaseMask | PointerMotionMask | StructureNotifyMask;
| ButtonReleaseMask | PointerMotionMask | StructureNotifyMask
| ExposureMask;
int x11_font_width, x11_font_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 int x11_colors[16];
static Font x11_font;


Loading…
取消
儲存