~ubuntu-branches/ubuntu/raring/libcaca/raring

« back to all changes in this revision

Viewing changes to caca/driver_x11.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hocevar (Debian packages)
  • Date: 2007-10-13 20:10:44 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071013201044-35yldy9w3xe7iy2j
Tags: 0.99.beta12.debian-3
* debian/control:
  + Build-depend on texlive instead of all the other texlive-* packages so
    that we have the proper fonts at build time (Closes: #445797).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  libcaca       Colour ASCII-Art library
3
 
 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
 
3
 *  Copyright (c) 2002-2007 Sam Hocevar <sam@zoy.org>
 
4
 *                2007 Ben Wiley Sittler <bsittler@gmail.com>
4
5
 *                All Rights Reserved
5
6
 *
6
 
 *  $Id: driver_x11.c 968 2006-10-30 16:37:36Z sam $
 
7
 *  $Id: driver_x11.c 1127 2007-06-28 12:46:04Z sam $
7
8
 *
8
 
 *  This library is free software; you can redistribute it and/or
9
 
 *  modify it under the terms of the Do What The Fuck You Want To
10
 
 *  Public License, Version 2, as published by Sam Hocevar. See
 
9
 *  This library is free software. It comes without any warranty, to
 
10
 *  the extent permitted by applicable law. You can redistribute it
 
11
 *  and/or modify it under the terms of the Do What The Fuck You Want
 
12
 *  To Public License, Version 2, as published by Sam Hocevar. See
11
13
 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12
14
 */
13
15
 
29
31
 
30
32
#include <stdio.h> /* BUFSIZ */
31
33
#include <stdlib.h>
 
34
#include <string.h>
32
35
 
33
36
#include "caca.h"
34
37
#include "caca_internals.h"
39
42
 * Local functions
40
43
 */
41
44
static int x11_error_handler(Display *, XErrorEvent *);
 
45
static void x11_put_glyph(caca_display_t *, int, int, int, int, int,
 
46
                          uint32_t, uint32_t);
42
47
 
43
48
struct driver_private
44
49
{
58
63
#if defined(HAVE_X11_XKBLIB_H)
59
64
    Bool autorepeat;
60
65
#endif
 
66
    uint32_t max_char;
61
67
};
62
68
 
 
69
#define UNICODE_XLFD_SUFFIX "-iso10646-1"
 
70
#define LATIN_1_XLFD_SUFFIX "-iso8859-1"
 
71
 
63
72
static int x11_init_graphics(caca_display_t *dp)
64
73
{
65
74
    Colormap colormap;
98
107
    /* Parse our font list */
99
108
    for( ; ; parser++)
100
109
    {
 
110
        unsigned int font_max_char;
 
111
 
101
112
        if(!*parser)
102
113
        {
103
114
            XSetErrorHandler(old_error_handler);
116
127
            continue;
117
128
        }
118
129
 
 
130
        if((strlen(*parser) > sizeof(UNICODE_XLFD_SUFFIX))
 
131
             && !strcasecmp(*parser + strlen(*parser)
 
132
                          - strlen(UNICODE_XLFD_SUFFIX), UNICODE_XLFD_SUFFIX))
 
133
            dp->drv.p->max_char = 0xffff;
 
134
        else if((strlen(*parser) > sizeof(LATIN_1_XLFD_SUFFIX))
 
135
                 && !strcasecmp(*parser + strlen(*parser)
 
136
                        - strlen(LATIN_1_XLFD_SUFFIX), LATIN_1_XLFD_SUFFIX))
 
137
            dp->drv.p->max_char = 0xff;
 
138
        else
 
139
            dp->drv.p->max_char = 0x7f;
 
140
 
 
141
        font_max_char = 
 
142
            (((unsigned int)dp->drv.p->font_struct->max_byte1) << 8)
 
143
             | dp->drv.p->font_struct->max_char_or_byte2;
 
144
        if(font_max_char && (font_max_char < dp->drv.p->max_char))
 
145
            dp->drv.p->max_char = font_max_char;
 
146
 
119
147
        break;
120
148
    }
121
149
 
122
150
    /* Reset the default X11 error handler */
123
151
    XSetErrorHandler(old_error_handler);
124
 
 
125
 
    dp->drv.p->font_width = dp->drv.p->font_struct->max_bounds.width;
 
152
    
 
153
    dp->drv.p->font_width = 0;
 
154
    if(dp->drv.p->font_struct->per_char
 
155
        && !dp->drv.p->font_struct->min_byte1
 
156
        && dp->drv.p->font_struct->min_char_or_byte2 <= 0x21
 
157
        && dp->drv.p->font_struct->max_char_or_byte2 >= 0x7e)
 
158
    {
 
159
        for(i = 0x21; i < 0x7f; i++)
 
160
        {
 
161
            int cw = dp->drv.p->font_struct->per_char[i
 
162
                           - dp->drv.p->font_struct->min_char_or_byte2].width;
 
163
            if(cw > dp->drv.p->font_width)
 
164
                dp->drv.p->font_width = cw;
 
165
        }
 
166
    }
 
167
 
 
168
    if(!dp->drv.p->font_width)
 
169
        dp->drv.p->font_width = dp->drv.p->font_struct->max_bounds.width;
 
170
 
126
171
    dp->drv.p->font_height = dp->drv.p->font_struct->max_bounds.ascent
127
172
                         + dp->drv.p->font_struct->max_bounds.descent;
128
173
    dp->drv.p->font_offset = dp->drv.p->font_struct->max_bounds.descent;
172
217
    {
173
218
        XEvent xevent;
174
219
        XNextEvent(dp->drv.p->dpy, &xevent);
175
 
        if (xevent.type == MapNotify)
 
220
        if(xevent.type == MapNotify)
176
221
            break;
177
222
    }
178
223
 
257
302
            XSetForeground(dp->drv.p->dpy, dp->drv.p->gc,
258
303
                           dp->drv.p->colors[bg]);
259
304
            XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap, dp->drv.p->gc,
260
 
                           x * dp->drv.p->font_width, y * dp->drv.p->font_height,
261
 
                           len * dp->drv.p->font_width, dp->drv.p->font_height);
 
305
                           x * dp->drv.p->font_width,
 
306
                           y * dp->drv.p->font_height,
 
307
                           len * dp->drv.p->font_width,
 
308
                           dp->drv.p->font_height);
262
309
        }
263
310
    }
264
311
 
268
315
        unsigned int yoff = (y + 1) * dp->drv.p->font_height
269
316
                                    - dp->drv.p->font_offset;
270
317
        uint32_t *chars = dp->cv->chars + y * dp->cv->width;
 
318
        uint32_t *attrs = dp->cv->attrs + y * dp->cv->width;
271
319
 
272
 
        for(x = 0; x < dp->cv->width; x++, chars++)
 
320
        for(x = 0; x < dp->cv->width; x++, chars++, attrs++)
273
321
        {
274
 
            uint32_t *attrs = dp->cv->attrs + x + y * dp->cv->width;
275
 
 
276
 
            /* Underline */
277
 
            if(*attrs & CUCUL_UNDERLINE)
278
 
                XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
279
 
                                   dp->drv.p->gc,
280
 
                                   x * dp->drv.p->font_width,
281
 
                                   (y + 1) * dp->drv.p->font_height - 1,
282
 
                                   dp->drv.p->font_width, 1);
283
 
 
284
 
            /* Skip spaces */
285
 
            if(*chars <= 0x00000020)
286
 
                continue;
287
 
 
288
 
            if(*chars == CUCUL_MAGIC_FULLWIDTH)
289
 
                continue;
290
 
 
291
322
            XSetForeground(dp->drv.p->dpy, dp->drv.p->gc,
292
323
                           dp->drv.p->colors[_cucul_attr_to_rgb12fg(*attrs)]);
293
324
 
294
 
            /* Plain ASCII, no problem. */
295
 
            if(*chars > 0x00000020 && *chars < 0x00000080)
296
 
            {
297
 
                char ch = (uint8_t)*chars;
298
 
                XDrawString(dp->drv.p->dpy, dp->drv.p->pixmap, dp->drv.p->gc,
299
 
                            x * dp->drv.p->font_width, yoff, &ch, 1);
300
 
                continue;
301
 
            }
302
 
 
303
 
            /* We want to be able to print a few special Unicode characters
304
 
             * such as the CP437 gradients and half blocks. For unknown
305
 
             * characters, just print '?'. */
306
 
            switch(*chars)
307
 
            {
308
 
                case 0x000000b7: /* · */
309
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
310
 
                                   dp->drv.p->gc,
311
 
                                   x * dp->drv.p->font_width
312
 
                                     + dp->drv.p->font_width / 2,
313
 
                                   y * dp->drv.p->font_height
314
 
                                     + dp->drv.p->font_height / 2, 2, 2);
315
 
                    break;
316
 
                case 0x00002500: /* ─ */
317
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
318
 
                                   dp->drv.p->gc,
319
 
                                   x * dp->drv.p->font_width,
320
 
                                   y * dp->drv.p->font_height
321
 
                                     + dp->drv.p->font_height / 2 + 1,
322
 
                                   dp->drv.p->font_width, 1);
323
 
                    break;
324
 
                case 0x00002580: /* ▀ */
325
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
326
 
                                   dp->drv.p->gc,
327
 
                                   x * dp->drv.p->font_width,
328
 
                                   y * dp->drv.p->font_height,
329
 
                                   dp->drv.p->font_width,
330
 
                                   dp->drv.p->font_height / 2);
331
 
                    break;
332
 
                case 0x00002584: /* ▄ */
333
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
334
 
                                   dp->drv.p->gc,
335
 
                                   x * dp->drv.p->font_width,
336
 
                                   (y + 1) * dp->drv.p->font_height
337
 
                                           - dp->drv.p->font_height / 2,
338
 
                                   dp->drv.p->font_width,
339
 
                                   dp->drv.p->font_height / 2);
340
 
                    break;
341
 
                case 0x00002588: /* █ */
342
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
343
 
                                   dp->drv.p->gc,
344
 
                                   x * dp->drv.p->font_width,
345
 
                                   y * dp->drv.p->font_height,
346
 
                                   dp->drv.p->font_width,
347
 
                                   dp->drv.p->font_height);
348
 
                    break;
349
 
                case 0x0000258c: /* ▌ */
350
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
351
 
                                   dp->drv.p->gc,
352
 
                                   x * dp->drv.p->font_width,
353
 
                                   y * dp->drv.p->font_height,
354
 
                                   dp->drv.p->font_width / 2,
355
 
                                   dp->drv.p->font_height);
356
 
                    break;
357
 
                case 0x00002590: /* ▐ */
358
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
359
 
                                   dp->drv.p->gc,
360
 
                                   (x + 1) * dp->drv.p->font_width
361
 
                                           - dp->drv.p->font_width / 2,
362
 
                                   y * dp->drv.p->font_height,
363
 
                                   dp->drv.p->font_width / 2,
364
 
                                   dp->drv.p->font_height);
365
 
                    break;
366
 
                case 0x000025a0: /* ■ */
367
 
                    XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap,
368
 
                                   dp->drv.p->gc,
369
 
                                   x * dp->drv.p->font_width,
370
 
                                   y * dp->drv.p->font_height
371
 
                                     + dp->drv.p->font_height / 4,
372
 
                                   dp->drv.p->font_width,
373
 
                                   dp->drv.p->font_height / 2);
374
 
                    break;
375
 
                case 0x00002593: /* ▓ */
376
 
                case 0x00002592: /* ▒ */
377
 
                case 0x00002591: /* ░ */
378
 
                {
379
 
                    /* FIXME: this sucks utterly */
380
 
                    int i, j, k = *chars - 0x00002591;
381
 
                    for(j = dp->drv.p->font_height; j--; )
382
 
                        for(i = dp->drv.p->font_width; i--; )
383
 
                    {
384
 
                        if(((i + 2 * (j & 1)) & 3) > k)
385
 
                            continue;
386
 
 
387
 
                        XDrawPoint(dp->drv.p->dpy, dp->drv.p->pixmap,
388
 
                                   dp->drv.p->gc,
389
 
                                   x * dp->drv.p->font_width + i,
390
 
                                   y * dp->drv.p->font_height + j);
391
 
                    }
392
 
                    break;
393
 
                }
394
 
                default:
395
 
                {
396
 
                    char ch;
397
 
                    ch = '?';
398
 
                    XDrawString(dp->drv.p->dpy, dp->drv.p->pixmap,
399
 
                                dp->drv.p->gc,
400
 
                                x * dp->drv.p->font_width, yoff, &ch, 1);
401
 
                    break;
402
 
                }
403
 
            }
 
325
            x11_put_glyph(dp, x * dp->drv.p->font_width,
 
326
                          y * dp->drv.p->font_height, yoff,
 
327
                          dp->drv.p->font_width, dp->drv.p->font_height,
 
328
                          *attrs, *chars);
404
329
        }
405
330
    }
406
331
 
621
546
    return 0;
622
547
}
623
548
 
 
549
static void x11_put_glyph(caca_display_t *dp, int x, int y, int yoff,
 
550
                          int w, int h, uint32_t attr, uint32_t ch)
 
551
{
 
552
    static uint8_t const udlr[] =
 
553
    {
 
554
        /* 0x2500 - 0x250f: ─ . │ . . . . . . . . . ┌ . . . */
 
555
        0x05, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
 
556
        0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
 
557
        /* 0x2510 - 0x251f: ┐ . . . └ . . . ┘ . . . ├ . . . */
 
558
        0x14, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00,
 
559
        0x44, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00,
 
560
        /* 0x2520 - 0x252f: . . . . ┤ . . . . . . . ┬ . . . */
 
561
        0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
 
562
        0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
 
563
        /* 0x2530 - 0x253f: . . . . ┴ . . . . . . . ┼ . . . */
 
564
        0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00,
 
565
        0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00,
 
566
        /* 0x2540 - 0x254f: . . . . . . . . . . . . . . . . */
 
567
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
568
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
569
        /* 0x2550 - 0x255f: ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ */
 
570
        0x0a, 0xa0, 0x12, 0x21, 0x22, 0x18, 0x24, 0x28,
 
571
        0x42, 0x81, 0x82, 0x48, 0x84, 0x88, 0x52, 0xa1,
 
572
        /* 0x2560 - 0x256c: ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ */
 
573
        0xa2, 0x58, 0xa4, 0xa8, 0x1a, 0x25, 0x2a, 0x4a,
 
574
        0x85, 0x8a, 0x5a, 0xa5, 0xaa,
 
575
    };
 
576
 
 
577
    Display *dpy = dp->drv.p->dpy;
 
578
    Pixmap px = dp->drv.p->pixmap;
 
579
    GC gc = dp->drv.p->gc;
 
580
    int fw;
 
581
    XChar2b ch16;
 
582
 
 
583
    /* Underline */
 
584
    if(attr & CUCUL_UNDERLINE)
 
585
        XFillRectangle(dpy, px, gc, x, y + h - 1, w, 1);
 
586
 
 
587
    /* Skip spaces and magic stuff */
 
588
    if(ch <= 0x00000020)
 
589
        return;
 
590
 
 
591
    if(ch == CUCUL_MAGIC_FULLWIDTH)
 
592
        return;
 
593
 
 
594
    fw = w;
 
595
    if(cucul_utf32_is_fullwidth(ch))
 
596
        fw *= 2;
 
597
 
 
598
    /* We want to be able to print a few special Unicode characters
 
599
     * such as the CP437 gradients and half blocks. For unknown
 
600
     * characters, print what cucul_utf32_to_ascii() returns. */
 
601
 
 
602
    if(ch >= 0x2500 && ch <= 0x256c && udlr[ch - 0x2500])
 
603
    {
 
604
        uint16_t D = udlr[ch - 0x2500];
 
605
 
 
606
        if(D & 0x04)
 
607
            XFillRectangle(dpy, px, gc, x, y + h / 2, fw / 2 + 1, 1);
 
608
 
 
609
        if(D & 0x01)
 
610
            XFillRectangle(dpy, px, gc,
 
611
                           x + fw / 2, y + h / 2, (fw + 1) / 2, 1);
 
612
 
 
613
        if(D & 0x40)
 
614
            XFillRectangle(dpy, px, gc, x + fw / 2, y, 1, h / 2 + 1);
 
615
 
 
616
        if(D & 0x10)
 
617
            XFillRectangle(dpy, px, gc, x + fw / 2, y + h / 2, 1, (h + 1) / 2);
 
618
 
 
619
#define STEPIF(a,b) (D&(a)?-1:(D&(b))?1:0)
 
620
 
 
621
        if(D & 0x08)
 
622
        {
 
623
            XFillRectangle(dpy, px, gc, x, y - 1 + h / 2,
 
624
                           fw / 2 + 1 + STEPIF(0xc0,0x20), 1);
 
625
            XFillRectangle(dpy, px, gc, x, y + 1 + h / 2,
 
626
                           fw / 2 + 1 + STEPIF(0x30,0x80), 1);
 
627
        }
 
628
 
 
629
        if(D & 0x02)
 
630
        {
 
631
            XFillRectangle(dpy, px, gc, x - STEPIF(0xc0,0x20) + fw / 2,
 
632
                           y - 1 + h / 2, (fw + 1) / 2 + STEPIF(0xc0,0x20), 1);
 
633
            XFillRectangle(dpy, px, gc, x - STEPIF(0x30,0x80) + fw / 2,
 
634
                           y + 1 + h / 2, (fw + 1) / 2 + STEPIF(0x30,0x80), 1);
 
635
        }
 
636
 
 
637
        if(D & 0x80)
 
638
        {
 
639
            XFillRectangle(dpy, px, gc, x - 1 + fw / 2, y,
 
640
                           1, h / 2 + 1 + STEPIF(0x0c,0x02));
 
641
            XFillRectangle(dpy, px, gc, x + 1 + fw / 2, y,
 
642
                           1, h / 2 + 1 + STEPIF(0x03,0x08));
 
643
        }
 
644
 
 
645
        if(D & 0x20)
 
646
        {
 
647
            XFillRectangle(dpy, px, gc, x - 1 + fw / 2,
 
648
                           y - STEPIF(0x0c,0x02) + h / 2,
 
649
                           1, (h + 1) / 2 + STEPIF(0x0c,0x02));
 
650
            XFillRectangle(dpy, px, gc, x + 1 + fw / 2,
 
651
                           y - STEPIF(0x03,0x08) + h / 2,
 
652
                           1, (h + 1) / 2 + STEPIF(0x03,0x08));
 
653
        }
 
654
 
 
655
        return;
 
656
    }
 
657
 
 
658
    switch(ch)
 
659
    {
 
660
        case 0x000000b7: /* · */
 
661
        case 0x00002219: /* ∙ */
 
662
        case 0x000030fb: /* ・ */
 
663
            XFillRectangle(dpy, px, gc, x + fw / 2 - 1, y + h / 2 - 1, 2, 2);
 
664
            return;
 
665
 
 
666
        case 0x00002261: /* ≡ */
 
667
            XFillRectangle(dpy, px, gc, x + 1, y - 2 + h / 2, fw - 1, 1);
 
668
            XFillRectangle(dpy, px, gc, x + 1, y + h / 2, fw - 1, 1);
 
669
            XFillRectangle(dpy, px, gc, x + 1, y + 2 + h / 2, fw - 1, 1);
 
670
            return;
 
671
 
 
672
        case 0x00002580: /* ▀ */
 
673
            XFillRectangle(dpy, px, gc, x, y, fw, h / 2);
 
674
            return;
 
675
 
 
676
        case 0x00002584: /* ▄ */
 
677
            XFillRectangle(dpy, px, gc, x, y + h - h / 2, fw, h / 2);
 
678
            return;
 
679
 
 
680
        case 0x00002588: /* █ */
 
681
        case 0x000025ae: /* ▮ */
 
682
            XFillRectangle(dpy, px, gc, x, y, fw, h);
 
683
            return;
 
684
 
 
685
        case 0x0000258c: /* ▌ */
 
686
            XFillRectangle(dpy, px, gc, x, y, fw / 2, h);
 
687
            return;
 
688
 
 
689
        case 0x00002590: /* ▐ */
 
690
            XFillRectangle(dpy, px, gc, x + fw - fw / 2, y, fw / 2, h);
 
691
            return;
 
692
 
 
693
        case 0x000025a0: /* ■ */
 
694
        case 0x000025ac: /* ▬ */
 
695
            XFillRectangle(dpy, px, gc, x, y + h / 4, fw, h / 2);
 
696
            return;
 
697
 
 
698
        case 0x00002593: /* ▓ */
 
699
        case 0x00002592: /* ▒ */
 
700
        case 0x00002591: /* ░ */
 
701
        {
 
702
            /* FIXME: this sucks utterly */
 
703
            int i, j, k = ch - 0x00002591;
 
704
            for(j = h; j--; )
 
705
                for(i = fw; i--; )
 
706
            {
 
707
                if(((i + 2 * (j & 1)) & 3) > k)
 
708
                    continue;
 
709
 
 
710
                XDrawPoint(dpy, px, gc, x + i, y + j);
 
711
            }
 
712
            return;
 
713
        }
 
714
 
 
715
        case 0x000025cb: /* ○ */
 
716
        case 0x00002022: /* • */
 
717
        case 0x000025cf: /* ● */
 
718
        {
 
719
            int d, xo, yo;
 
720
 
 
721
            d = fw >> (~ch & 0x1); /* XXX: hack */
 
722
            if(h < fw)
 
723
                d = h;
 
724
            if(d < 1)
 
725
                d = 1;
 
726
            xo = (fw - d) / 2;
 
727
            yo = (h - d) / 2;
 
728
            if(ch == 0x000025cb)
 
729
                XDrawArc(dpy, px, gc, x + xo, y + yo, d, d, 0, 64 * 360);
 
730
            else
 
731
                XFillArc(dpy, px, gc, x + xo, y + yo, d, d, 0, 64 * 360);
 
732
            return;
 
733
        }
 
734
    }
 
735
 
 
736
    if(ch >= 0x00000020 && ch <= dp->drv.p->max_char)
 
737
    {
 
738
        /* ascii, latin-1 or unicode font (might draw a blank square) */
 
739
        ch16.byte1 = (ch) >> 8;
 
740
        ch16.byte2 = (ch) & 0xff;
 
741
    }
 
742
    else
 
743
    {
 
744
        ch16.byte1 = 0;
 
745
        ch16.byte2 = cucul_utf32_to_ascii(ch);
 
746
    }
 
747
 
 
748
    XDrawString16(dpy, px, gc, x + (ch16.byte1 ? 0 : (fw - w) / 2), yoff, &ch16, 1);
 
749
}
 
750
 
624
751
/*
625
752
 * Driver initialisation
626
753
 */
643
770
    dp->drv.handle_resize = x11_handle_resize;
644
771
    dp->drv.get_event = x11_get_event;
645
772
    dp->drv.set_mouse = x11_set_mouse;
 
773
    dp->drv.set_cursor = NULL;
646
774
 
647
775
    return 0;
648
776
}