The R Project SVN R

Rev

Rev 15352 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15352 Rev 50651
Line 23... Line 23...
23
#include <config.h>
23
#include <config.h>
24
#endif
24
#endif
25
 
25
 
26
#include <stdlib.h>
26
#include <stdlib.h>
27
 
27
 
28
#include "Defn.h"
-
 
29
#include "Print.h"
-
 
30
 
-
 
31
/* don't use X11 function prototypes (which tend to ...): */
28
/* don't use X11 function prototypes (which tend to ...): */
32
#define NeedFunctionPrototypes 0
29
#define NeedFunctionPrototypes 0
-
 
30
#ifndef _Xconst
-
 
31
#define _Xconst const
-
 
32
#endif
33
#include <X11/X.h>
33
#include <X11/X.h>
34
#include <X11/Xlib.h>
34
#include <X11/Xlib.h>
35
#include <X11/Xutil.h>
35
#include <X11/Xutil.h>
36
#include <X11/keysym.h>
36
#include <X11/keysym.h>
37
#include <X11/cursorfont.h>
37
#include <X11/cursorfont.h>
38
 
38
 
-
 
39
#include "Defn.h"
-
 
40
#include "Print.h"
-
 
41
 
-
 
42
 
-
 
43
/* <FIXME> this is wrong  as KeySym is defined nowadays */
39
#define KeySym int
44
#define KeySym int
-
 
45
/* </FIXME> */
40
#define DEEvent XEvent
46
#define DEEvent XEvent
41
 
47
 
42
typedef enum { UP, DOWN, LEFT, RIGHT } DE_DIRECTION;
48
typedef enum { UP, DOWN, LEFT, RIGHT } DE_DIRECTION;
43
 
49
 
44
typedef enum {UNKNOWNN, NUMERIC, CHARACTER} CellType;
50
typedef enum {UNKNOWNN, NUMERIC, CHARACTER} CellType;
Line 1242... Line 1248...
1242
static KeySym GetKey(DEEvent * event)
1248
static KeySym GetKey(DEEvent * event)
1243
{
1249
{
1244
    char text[1];
1250
    char text[1];
1245
    KeySym iokey;
1251
    KeySym iokey;
1246
 
1252
 
1247
    XLookupString(event, text, 10, &iokey, 0);
1253
    XLookupString((XKeyEvent *)event, text, 1, &iokey, 0);
1248
    return iokey;
1254
    return iokey;
1249
}
1255
}
1250
 
1256
 
1251
static char GetCharP(DEEvent * event)
1257
static char GetCharP(DEEvent * event)
1252
{
1258
{
1253
    char text[1];
1259
    char text[1];
1254
    KeySym iokey;
1260
    KeySym iokey;
1255
 
1261
 
1256
    XLookupString(event, text, 1, &iokey, 0);
1262
    XLookupString((XKeyEvent *)event, text, 1, &iokey, 0);
1257
    return text[0];
1263
    return text[0];
1258
}
1264
}
1259
 
1265
 
1260
static int CheckControl(DEEvent * event)
1266
static int CheckControl(DEEvent * event)
1261
{
1267
{
Line 1272... Line 1278...
1272
    int i;
1278
    int i;
1273
    char text[1];
1279
    char text[1];
1274
    KeySym iokey;
1280
    KeySym iokey;
1275
 
1281
 
1276
    (*event).xkey.state = 0;
1282
    (*event).xkey.state = 0;
1277
    XLookupString(event, text, 1, &iokey, 0);
1283
    XLookupString((XKeyEvent *)event, text, 1, &iokey, 0);
1278
    /* one row overlap when scrolling: top line <--> bottom line */
1284
    /* one row overlap when scrolling: top line <--> bottom line */
1279
    switch (text[0]) {
1285
    switch (text[0]) {
1280
	case 'b':
1286
	case 'b':
1281
	    i = rowmin - nhigh + 2;
1287
	    i = rowmin - nhigh + 2;
1282
	    jumpwin(colmin, max(1, i));
1288
	    jumpwin(colmin, max(1, i));
Line 1301... Line 1307...
1301
	drawwindow();
1307
	drawwindow();
1302
}
1308
}
1303
 
1309
 
1304
static void RefreshKeyboardMapping(DEEvent * event)
1310
static void RefreshKeyboardMapping(DEEvent * event)
1305
{
1311
{
1306
    XRefreshKeyboardMapping(event);
1312
    XRefreshKeyboardMapping((XMappingEvent *)event);
1307
}
1313
}
1308
 
1314
 
1309
/* Initialize/Close Windows */
1315
/* Initialize/Close Windows */
1310
 
1316
 
1311
void closewin(void)
1317
void closewin(void)
Line 1408... Line 1414...
1408
	ioblack,
1414
	ioblack,
1409
	iowhite)) == 0)
1415
	iowhite)) == 0)
1410
	return TRUE;
1416
	return TRUE;
1411
 
1417
 
1412
    XSetStandardProperties(iodisplay, iowindow, ioname, ioname, None,
1418
    XSetStandardProperties(iodisplay, iowindow, ioname, ioname, None,
1413
			   ioname, 0, &iohint);
1419
			   (char **)NULL, 0, &iohint);
1414
 
1420
 
1415
    winattr.backing_store = Always;
1421
    winattr.backing_store = Always;
1416
    XChangeWindowAttributes(iodisplay, iowindow, CWBackingStore, &winattr);
1422
    XChangeWindowAttributes(iodisplay, iowindow, CWBackingStore, &winattr);
1417
 
1423
 
1418
    /* set up protocols so that window manager sends */
1424
    /* set up protocols so that window manager sends */