* Fixed compilation warnings.
* Removed fucking K&R syntax. git-svn-id: svn://svn.zoy.org/elk/trunk@91 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
parent
6bc9b501c7
commit
e81273f8a3
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static Object Sym_Wm_Hints, Sym_Size_Hints;
|
static Object Sym_Wm_Hints, Sym_Size_Hints;
|
||||||
|
|
||||||
static Object P_Iconify_Window (Object w, Object scr) {
|
static Object P_Iconify_Window (Object w, Object scr) {
|
||||||
|
@ -81,8 +83,8 @@ static Object P_Wm_Command (Object w) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String_List_To_Text_Property (Object x, XTextProperty *ret) {
|
static void String_List_To_Text_Property (Object x, XTextProperty *ret) {
|
||||||
register i, n;
|
register int i, n;
|
||||||
register char **s;
|
register char **s;
|
||||||
Object t;
|
Object t;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
@ -101,7 +103,7 @@ static String_List_To_Text_Property (Object x, XTextProperty *ret) {
|
||||||
|
|
||||||
static Object Text_Property_To_String_List (XTextProperty *p) {
|
static Object Text_Property_To_String_List (XTextProperty *p) {
|
||||||
int n;
|
int n;
|
||||||
register i;
|
register int i;
|
||||||
char **s;
|
char **s;
|
||||||
Object x, ret, t;
|
Object x, ret, t;
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
@ -232,7 +234,7 @@ static Object P_Set_Wm_Class (Object w, Object name, Object class) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Wm_Command (Object w, Object cmd) {
|
static Object P_Set_Wm_Command (Object w, Object cmd) {
|
||||||
register i, n;
|
register int i, n;
|
||||||
register char **argv;
|
register char **argv;
|
||||||
Object c;
|
Object c;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
@ -304,7 +306,7 @@ static Object P_Set_Size_Hints (Object w, Object a, Object h) {
|
||||||
|
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
Check_Type (a, T_Atom);
|
Check_Type (a, T_Atom);
|
||||||
bzero ((char *)&SZH, sizeof (SZH)); /* Not portable? */
|
memset ((char *)&SZH, 0, sizeof (SZH)); /* Not portable? */
|
||||||
mask = Vector_To_Record (h, Size_Hints_Size, Sym_Size_Hints,
|
mask = Vector_To_Record (h, Size_Hints_Size, Sym_Size_Hints,
|
||||||
Size_Hints_Rec);
|
Size_Hints_Rec);
|
||||||
if ((mask & (PPosition|USPosition)) == (PPosition|USPosition))
|
if ((mask & (PPosition|USPosition)) == (PPosition|USPosition))
|
||||||
|
@ -349,7 +351,7 @@ static Object P_Icon_Sizes (Object w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Icon_Sizes (Object w, Object v) {
|
static Object P_Set_Icon_Sizes (Object w, Object v) {
|
||||||
register i, n;
|
register int i, n;
|
||||||
XIconSize *p;
|
XIconSize *p;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
|
@ -393,7 +395,7 @@ static Object P_Set_Transient_For (Object w, Object pw) {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_client () {
|
void elk_init_xlib_client () {
|
||||||
Define_Symbol (&Sym_Wm_Hints, "wm-hints");
|
Define_Symbol (&Sym_Wm_Hints, "wm-hints");
|
||||||
Define_Symbol (&Sym_Size_Hints, "size-hints");
|
Define_Symbol (&Sym_Size_Hints, "size-hints");
|
||||||
Define_Primitive (P_Iconify_Window, "iconify-window", 2, 2, EVAL);
|
Define_Primitive (P_Iconify_Window, "iconify-window", 2, 2, EVAL);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
Generic_Predicate (Color)
|
Generic_Predicate (Color)
|
||||||
|
|
||||||
static Color_Equal (Object x, Object y) {
|
static int Color_Equal (Object x, Object y) {
|
||||||
register XColor *p = &COLOR(x)->c, *q = &COLOR(y)->c;
|
register XColor *p = &COLOR(x)->c, *q = &COLOR(y)->c;
|
||||||
return p->red == q->red && p->green == q->green && p->blue == q->blue;
|
return p->red == q->red && p->green == q->green && p->blue == q->blue;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ XColor *Get_Color (Object c) {
|
||||||
return &COLOR(c)->c;
|
return &COLOR(c)->c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned short Get_RGB_Value (x) Object x; {
|
static unsigned short Get_RGB_Value (Object x) {
|
||||||
double d;
|
double d;
|
||||||
|
|
||||||
d = Get_Double (x);
|
d = Get_Double (x);
|
||||||
|
@ -68,11 +68,11 @@ static unsigned short Get_RGB_Value (x) Object x; {
|
||||||
return (unsigned short)(d * 65535);
|
return (unsigned short)(d * 65535);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Make_Color (r, g, b) Object r, g, b; {
|
static Object P_Make_Color (Object r, Object g, Object b) {
|
||||||
return Make_Color (Get_RGB_Value (r), Get_RGB_Value (g), Get_RGB_Value (b));
|
return Make_Color (Get_RGB_Value (r), Get_RGB_Value (g), Get_RGB_Value (b));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Color_Rgb_Values (c) Object c; {
|
static Object P_Color_Rgb_Values (Object c) {
|
||||||
Object ret, t, x;
|
Object ret, t, x;
|
||||||
GC_Node3;
|
GC_Node3;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ static Object P_Color_Rgb_Values (c) Object c; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Query_Color (cmap, p) Object cmap, p; {
|
static Object P_Query_Color (Object cmap, Object p) {
|
||||||
XColor c;
|
XColor c;
|
||||||
Colormap cm = Get_Colormap (cmap);
|
Colormap cm = Get_Colormap (cmap);
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ static Object P_Query_Color (cmap, p) Object cmap, p; {
|
||||||
return Make_Color (c.red, c.green, c.blue);
|
return Make_Color (c.red, c.green, c.blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Query_Colors (cmap, v) Object cmap, v; {
|
static Object P_Query_Colors (Object cmap, Object v) {
|
||||||
Colormap cm = Get_Colormap (cmap);
|
Colormap cm = Get_Colormap (cmap);
|
||||||
register i, n;
|
register int i, n;
|
||||||
Object ret;
|
Object ret;
|
||||||
register XColor *p;
|
register XColor *p;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
@ -130,7 +130,7 @@ static Object P_Query_Colors (cmap, v) Object cmap, v; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Lookup_Color (cmap, name) Object cmap, name; {
|
static Object P_Lookup_Color (Object cmap, Object name) {
|
||||||
XColor visual, exact;
|
XColor visual, exact;
|
||||||
Colormap cm = Get_Colormap (cmap);
|
Colormap cm = Get_Colormap (cmap);
|
||||||
Object ret, x;
|
Object ret, x;
|
||||||
|
@ -149,7 +149,7 @@ static Object P_Lookup_Color (cmap, name) Object cmap, name; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_color () {
|
void elk_init_xlib_color () {
|
||||||
Generic_Define (Color, "color", "color?");
|
Generic_Define (Color, "color", "color?");
|
||||||
Define_Primitive (P_Make_Color, "make-color", 3, 3, EVAL);
|
Define_Primitive (P_Make_Color, "make-color", 3, 3, EVAL);
|
||||||
Define_Primitive (P_Color_Rgb_Values, "color-rgb-values", 1, 1, EVAL);
|
Define_Primitive (P_Color_Rgb_Values, "color-rgb-values", 1, 1, EVAL);
|
||||||
|
|
|
@ -38,7 +38,7 @@ Generic_Print (Colormap, "#[colormap %lu]", COLORMAP(x)->cm)
|
||||||
|
|
||||||
Generic_Get_Display (Colormap, COLORMAP)
|
Generic_Get_Display (Colormap, COLORMAP)
|
||||||
|
|
||||||
Object Make_Colormap (finalize, dpy, cmap) Display *dpy; Colormap cmap; {
|
Object Make_Colormap (int finalize, Display *dpy, Colormap cmap) {
|
||||||
Object cm;
|
Object cm;
|
||||||
|
|
||||||
if (cmap == None)
|
if (cmap == None)
|
||||||
|
@ -56,12 +56,12 @@ Object Make_Colormap (finalize, dpy, cmap) Display *dpy; Colormap cmap; {
|
||||||
return cm;
|
return cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
Colormap Get_Colormap (c) Object c; {
|
Colormap Get_Colormap (Object c) {
|
||||||
Check_Type (c, T_Colormap);
|
Check_Type (c, T_Colormap);
|
||||||
return COLORMAP(c)->cm;
|
return COLORMAP(c)->cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Free_Colormap (c) Object c; {
|
Object P_Free_Colormap (Object c) {
|
||||||
Check_Type (c, T_Colormap);
|
Check_Type (c, T_Colormap);
|
||||||
if (!COLORMAP(c)->free)
|
if (!COLORMAP(c)->free)
|
||||||
XFreeColormap (COLORMAP(c)->dpy, COLORMAP(c)->cm);
|
XFreeColormap (COLORMAP(c)->dpy, COLORMAP(c)->cm);
|
||||||
|
@ -70,7 +70,7 @@ Object P_Free_Colormap (c) Object c; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Alloc_Color (cmap, color) Object cmap, color; {
|
static Object P_Alloc_Color (Object cmap, Object color) {
|
||||||
XColor c;
|
XColor c;
|
||||||
Colormap cm = Get_Colormap (cmap);
|
Colormap cm = Get_Colormap (cmap);
|
||||||
int r;
|
int r;
|
||||||
|
@ -84,7 +84,7 @@ static Object P_Alloc_Color (cmap, color) Object cmap, color; {
|
||||||
return Make_Pixel (c.pixel);
|
return Make_Pixel (c.pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Alloc_Named_Color (cmap, name) Object cmap, name; {
|
static Object P_Alloc_Named_Color (Object cmap, Object name) {
|
||||||
Colormap cm = Get_Colormap (cmap);
|
Colormap cm = Get_Colormap (cmap);
|
||||||
XColor screen, exact;
|
XColor screen, exact;
|
||||||
int r;
|
int r;
|
||||||
|
@ -109,7 +109,7 @@ static Object P_Alloc_Named_Color (cmap, name) Object cmap, name; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_colormap () {
|
void elk_init_xlib_colormap () {
|
||||||
Generic_Define (Colormap, "colormap", "colormap?");
|
Generic_Define (Colormap, "colormap", "colormap?");
|
||||||
Define_Primitive (P_Colormap_Display, "colormap-display", 1, 1, EVAL);
|
Define_Primitive (P_Colormap_Display, "colormap-display", 1, 1, EVAL);
|
||||||
Define_Primitive (P_Free_Colormap, "free-colormap", 1, 1, EVAL);
|
Define_Primitive (P_Free_Colormap, "free-colormap", 1, 1, EVAL);
|
||||||
|
|
|
@ -38,8 +38,7 @@ Generic_Print (Cursor, "#[cursor %lu]", CURSOR(x)->cursor)
|
||||||
|
|
||||||
Generic_Get_Display (Cursor, CURSOR)
|
Generic_Get_Display (Cursor, CURSOR)
|
||||||
|
|
||||||
static Object Internal_Make_Cursor (finalize, dpy, cursor)
|
static Object Internal_Make_Cursor (int finalize, Display *dpy, Cursor cursor) {
|
||||||
Display *dpy; Cursor cursor; {
|
|
||||||
Object c;
|
Object c;
|
||||||
|
|
||||||
if (cursor == None)
|
if (cursor == None)
|
||||||
|
@ -58,22 +57,22 @@ static Object Internal_Make_Cursor (finalize, dpy, cursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backwards compatibility: */
|
/* Backwards compatibility: */
|
||||||
Object Make_Cursor (dpy, cursor) Display *dpy; Cursor cursor; {
|
Object Make_Cursor (Display *dpy, Cursor cursor) {
|
||||||
return Internal_Make_Cursor (1, dpy, cursor);
|
return Internal_Make_Cursor (1, dpy, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object Make_Cursor_Foreign (dpy, cursor) Display *dpy; Cursor cursor; {
|
Object Make_Cursor_Foreign (Display *dpy, Cursor cursor) {
|
||||||
return Internal_Make_Cursor (0, dpy, cursor);
|
return Internal_Make_Cursor (0, dpy, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor Get_Cursor (c) Object c; {
|
Cursor Get_Cursor (Object c) {
|
||||||
if (EQ(c, Sym_None))
|
if (EQ(c, Sym_None))
|
||||||
return None;
|
return None;
|
||||||
Check_Type (c, T_Cursor);
|
Check_Type (c, T_Cursor);
|
||||||
return CURSOR(c)->cursor;
|
return CURSOR(c)->cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Free_Cursor (c) Object c; {
|
Object P_Free_Cursor (Object c) {
|
||||||
Check_Type (c, T_Cursor);
|
Check_Type (c, T_Cursor);
|
||||||
if (!CURSOR(c)->free)
|
if (!CURSOR(c)->free)
|
||||||
XFreeCursor (CURSOR(c)->dpy, CURSOR(c)->cursor);
|
XFreeCursor (CURSOR(c)->dpy, CURSOR(c)->cursor);
|
||||||
|
@ -82,8 +81,8 @@ Object P_Free_Cursor (c) Object c; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Create_Cursor (srcp, maskp, x, y, f, b)
|
static Object P_Create_Cursor (Object srcp, Object maskp, Object x, Object y,
|
||||||
Object srcp, maskp, x, y, f, b; {
|
Object f, Object b) {
|
||||||
Pixmap sp = Get_Pixmap (srcp), mp;
|
Pixmap sp = Get_Pixmap (srcp), mp;
|
||||||
Display *d = PIXMAP(srcp)->dpy;
|
Display *d = PIXMAP(srcp)->dpy;
|
||||||
|
|
||||||
|
@ -92,8 +91,8 @@ static Object P_Create_Cursor (srcp, maskp, x, y, f, b)
|
||||||
Get_Color (f), Get_Color (b), Get_Integer (x), Get_Integer (y)));
|
Get_Color (f), Get_Color (b), Get_Integer (x), Get_Integer (y)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Create_Glyph_Cursor (srcf, srcc, maskf, maskc, f, b)
|
static Object P_Create_Glyph_Cursor (Object srcf, Object srcc, Object maskf,
|
||||||
Object srcf, srcc, maskf, maskc, f, b; {
|
Object maskc, Object f, Object b) {
|
||||||
Font sf = Get_Font (srcf), mf;
|
Font sf = Get_Font (srcf), mf;
|
||||||
Display *d = FONT(srcf)->dpy;
|
Display *d = FONT(srcf)->dpy;
|
||||||
|
|
||||||
|
@ -103,14 +102,14 @@ static Object P_Create_Glyph_Cursor (srcf, srcc, maskf, maskc, f, b)
|
||||||
Get_Color (f), Get_Color (b)));
|
Get_Color (f), Get_Color (b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Recolor_Cursor (c, f, b) Object c, f, b; {
|
static Object P_Recolor_Cursor (Object c, Object f, Object b) {
|
||||||
Check_Type (c, T_Cursor);
|
Check_Type (c, T_Cursor);
|
||||||
XRecolorCursor (CURSOR(c)->dpy, CURSOR(c)->cursor, Get_Color (f),
|
XRecolorCursor (CURSOR(c)->dpy, CURSOR(c)->cursor, Get_Color (f),
|
||||||
Get_Color (b));
|
Get_Color (b));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_cursor () {
|
void elk_init_xlib_cursor () {
|
||||||
Generic_Define (Cursor, "cursor", "cursor?");
|
Generic_Define (Cursor, "cursor", "cursor?");
|
||||||
Define_Primitive (P_Cursor_Display, "cursor-display", 1, 1, EVAL);
|
Define_Primitive (P_Cursor_Display, "cursor-display", 1, 1, EVAL);
|
||||||
Define_Primitive (P_Free_Cursor, "free-cursor", 1, 1, EVAL);
|
Define_Primitive (P_Free_Cursor, "free-cursor", 1, 1, EVAL);
|
||||||
|
|
|
@ -30,20 +30,25 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
static Display_Visit (dp, f) Object *dp; int (*f)(); {
|
#include <string.h>
|
||||||
|
|
||||||
|
static int Display_Visit (Object *dp, int (*f)()) {
|
||||||
(*f)(&DISPLAY(*dp)->after);
|
(*f)(&DISPLAY(*dp)->after);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Generic_Predicate (Display)
|
Generic_Predicate (Display)
|
||||||
|
|
||||||
Generic_Equal (Display, DISPLAY, dpy)
|
Generic_Equal (Display, DISPLAY, dpy)
|
||||||
|
|
||||||
static Display_Print (d, port, raw, depth, length) Object d, port; {
|
static int Display_Print (Object d, Object port,
|
||||||
|
int raw, int depth, int length) {
|
||||||
Printf (port, "#[display %lu %s]", (unsigned)DISPLAY(d)->dpy,
|
Printf (port, "#[display %lu %s]", (unsigned)DISPLAY(d)->dpy,
|
||||||
DisplayString (DISPLAY(d)->dpy));
|
DisplayString (DISPLAY(d)->dpy));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object Make_Display (finalize, dpy) Display *dpy; {
|
Object Make_Display (int finalize, Display *dpy) {
|
||||||
Object d;
|
Object d;
|
||||||
|
|
||||||
d = Find_Object (T_Display, (GENERIC)dpy, Match_X_Obj);
|
d = Find_Object (T_Display, (GENERIC)dpy, Match_X_Obj);
|
||||||
|
@ -58,7 +63,7 @@ Object Make_Display (finalize, dpy) Display *dpy; {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Open_Display (argc, argv) Object *argv; {
|
static Object P_Open_Display (int argc, Object *argv) {
|
||||||
register char *s;
|
register char *s;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
|
||||||
|
@ -73,7 +78,7 @@ static Object P_Open_Display (argc, argv) Object *argv; {
|
||||||
return Make_Display (1, dpy);
|
return Make_Display (1, dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Close_Display (d) Object d; {
|
Object P_Close_Display (Object d) {
|
||||||
register struct S_Display *p;
|
register struct S_Display *p;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -87,13 +92,13 @@ Object P_Close_Display (d) Object d; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Default_Root_Window (d) Object d; {
|
static Object P_Display_Default_Root_Window (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Window (0, DISPLAY(d)->dpy,
|
return Make_Window (0, DISPLAY(d)->dpy,
|
||||||
DefaultRootWindow (DISPLAY(d)->dpy));
|
DefaultRootWindow (DISPLAY(d)->dpy));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Default_Colormap (d) Object d; {
|
static Object P_Display_Default_Colormap (Object d) {
|
||||||
register Display *dpy;
|
register Display *dpy;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -101,7 +106,7 @@ static Object P_Display_Default_Colormap (d) Object d; {
|
||||||
return Make_Colormap (0, dpy, DefaultColormap (dpy, DefaultScreen (dpy)));
|
return Make_Colormap (0, dpy, DefaultColormap (dpy, DefaultScreen (dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Default_Gcontext (d) Object d; {
|
static Object P_Display_Default_Gcontext (Object d) {
|
||||||
register Display *dpy;
|
register Display *dpy;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -109,7 +114,7 @@ static Object P_Display_Default_Gcontext (d) Object d; {
|
||||||
return Make_Gc (0, dpy, DefaultGC (dpy, DefaultScreen (dpy)));
|
return Make_Gc (0, dpy, DefaultGC (dpy, DefaultScreen (dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Default_Depth (d) Object d; {
|
static Object P_Display_Default_Depth (Object d) {
|
||||||
register Display *dpy;
|
register Display *dpy;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -117,32 +122,32 @@ static Object P_Display_Default_Depth (d) Object d; {
|
||||||
return Make_Integer (DefaultDepth (dpy, DefaultScreen (dpy)));
|
return Make_Integer (DefaultDepth (dpy, DefaultScreen (dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Default_Screen_Number (d) Object d; {
|
static Object P_Display_Default_Screen_Number (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DefaultScreen (DISPLAY(d)->dpy));
|
return Make_Integer (DefaultScreen (DISPLAY(d)->dpy));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Get_Screen_Number (dpy, scr) Display *dpy; Object scr; {
|
int Get_Screen_Number (Display *dpy, Object scr) {
|
||||||
register s;
|
register int s;
|
||||||
|
|
||||||
if ((s = Get_Integer (scr)) < 0 || s > ScreenCount (dpy)-1)
|
if ((s = Get_Integer (scr)) < 0 || s > ScreenCount (dpy)-1)
|
||||||
Primitive_Error ("invalid screen number");
|
Primitive_Error ("invalid screen number");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Cells (d, scr) Object d, scr; {
|
static Object P_Display_Cells (Object d, Object scr) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DisplayCells (DISPLAY(d)->dpy,
|
return Make_Integer (DisplayCells (DISPLAY(d)->dpy,
|
||||||
Get_Screen_Number (DISPLAY(d)->dpy, scr)));
|
Get_Screen_Number (DISPLAY(d)->dpy, scr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Planes (d, scr) Object d, scr; {
|
static Object P_Display_Planes (Object d, Object scr) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DisplayPlanes (DISPLAY(d)->dpy,
|
return Make_Integer (DisplayPlanes (DISPLAY(d)->dpy,
|
||||||
Get_Screen_Number (DISPLAY(d)->dpy, scr)));
|
Get_Screen_Number (DISPLAY(d)->dpy, scr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_String (d) Object d; {
|
static Object P_Display_String (Object d) {
|
||||||
register char *s;
|
register char *s;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -150,7 +155,7 @@ static Object P_Display_String (d) Object d; {
|
||||||
return Make_String (s, strlen (s));
|
return Make_String (s, strlen (s));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Vendor (d) Object d; {
|
static Object P_Display_Vendor (Object d) {
|
||||||
register char *s;
|
register char *s;
|
||||||
Object ret, name;
|
Object ret, name;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
@ -165,90 +170,90 @@ static Object P_Display_Vendor (d) Object d; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Protocol_Version (d) Object d; {
|
static Object P_Display_Protocol_Version (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Cons (Make_Integer (ProtocolVersion (DISPLAY(d)->dpy)),
|
return Cons (Make_Integer (ProtocolVersion (DISPLAY(d)->dpy)),
|
||||||
Make_Integer (ProtocolRevision (DISPLAY(d)->dpy)));
|
Make_Integer (ProtocolRevision (DISPLAY(d)->dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Screen_Count (d) Object d; {
|
static Object P_Display_Screen_Count (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (ScreenCount (DISPLAY(d)->dpy));
|
return Make_Integer (ScreenCount (DISPLAY(d)->dpy));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Image_Byte_Order (d) Object d; {
|
static Object P_Display_Image_Byte_Order (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Bits_To_Symbols ((unsigned long)ImageByteOrder (DISPLAY(d)->dpy),
|
return Bits_To_Symbols ((unsigned long)ImageByteOrder (DISPLAY(d)->dpy),
|
||||||
0, Byte_Order_Syms);
|
0, Byte_Order_Syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Bitmap_Unit (d) Object d; {
|
static Object P_Display_Bitmap_Unit (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (BitmapUnit (DISPLAY(d)->dpy));
|
return Make_Integer (BitmapUnit (DISPLAY(d)->dpy));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Bitmap_Bit_Order (d) Object d; {
|
static Object P_Display_Bitmap_Bit_Order (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Bits_To_Symbols ((unsigned long)BitmapBitOrder (DISPLAY(d)->dpy),
|
return Bits_To_Symbols ((unsigned long)BitmapBitOrder (DISPLAY(d)->dpy),
|
||||||
0, Byte_Order_Syms);
|
0, Byte_Order_Syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Bitmap_Pad (d) Object d; {
|
static Object P_Display_Bitmap_Pad (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (BitmapPad (DISPLAY(d)->dpy));
|
return Make_Integer (BitmapPad (DISPLAY(d)->dpy));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Width (d) Object d; {
|
static Object P_Display_Width (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DisplayWidth (DISPLAY(d)->dpy,
|
return Make_Integer (DisplayWidth (DISPLAY(d)->dpy,
|
||||||
DefaultScreen (DISPLAY(d)->dpy)));
|
DefaultScreen (DISPLAY(d)->dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Height (d) Object d; {
|
static Object P_Display_Height (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DisplayHeight (DISPLAY(d)->dpy,
|
return Make_Integer (DisplayHeight (DISPLAY(d)->dpy,
|
||||||
DefaultScreen (DISPLAY(d)->dpy)));
|
DefaultScreen (DISPLAY(d)->dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Width_Mm (d) Object d; {
|
static Object P_Display_Width_Mm (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DisplayWidthMM (DISPLAY(d)->dpy,
|
return Make_Integer (DisplayWidthMM (DISPLAY(d)->dpy,
|
||||||
DefaultScreen (DISPLAY(d)->dpy)));
|
DefaultScreen (DISPLAY(d)->dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Height_Mm (d) Object d; {
|
static Object P_Display_Height_Mm (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DisplayHeightMM (DISPLAY(d)->dpy,
|
return Make_Integer (DisplayHeightMM (DISPLAY(d)->dpy,
|
||||||
DefaultScreen (DISPLAY(d)->dpy)));
|
DefaultScreen (DISPLAY(d)->dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Motion_Buffer_Size (d) Object d; {
|
static Object P_Display_Motion_Buffer_Size (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Unsigned_Long (XDisplayMotionBufferSize (DISPLAY(d)->dpy));
|
return Make_Unsigned_Long (XDisplayMotionBufferSize (DISPLAY(d)->dpy));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Flush_Output (d) Object d; {
|
static Object P_Display_Flush_Output (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XFlush (DISPLAY(d)->dpy);
|
XFlush (DISPLAY(d)->dpy);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Wait_Output (d, discard) Object d, discard; {
|
static Object P_Display_Wait_Output (Object d, Object discard) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
Check_Type (discard, T_Boolean);
|
Check_Type (discard, T_Boolean);
|
||||||
XSync (DISPLAY(d)->dpy, EQ(discard, True));
|
XSync (DISPLAY(d)->dpy, EQ(discard, True));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_No_Op (d) Object d; {
|
static Object P_No_Op (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XNoOp (DISPLAY(d)->dpy);
|
XNoOp (DISPLAY(d)->dpy);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_List_Depths (d, scr) Object d, scr; {
|
static Object P_List_Depths (Object d, Object scr) {
|
||||||
int num;
|
int num;
|
||||||
register *p, i;
|
register int *p, i;
|
||||||
Object ret;
|
Object ret;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -262,10 +267,10 @@ static Object P_List_Depths (d, scr) Object d, scr; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_List_Pixmap_Formats (d) Object d; {
|
static Object P_List_Pixmap_Formats (Object d) {
|
||||||
register XPixmapFormatValues *p;
|
register XPixmapFormatValues *p;
|
||||||
int num;
|
int num;
|
||||||
register i;
|
register int i;
|
||||||
Object ret;
|
Object ret;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
|
||||||
|
@ -288,7 +293,7 @@ static Object P_List_Pixmap_Formats (d) Object d; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_display () {
|
void elk_init_xlib_display () {
|
||||||
T_Display = Define_Type (0, "display", NOFUNC, sizeof (struct S_Display),
|
T_Display = Define_Type (0, "display", NOFUNC, sizeof (struct S_Display),
|
||||||
Display_Equal, Display_Equal, Display_Print, Display_Visit);
|
Display_Equal, Display_Equal, Display_Print, Display_Visit);
|
||||||
Define_Primitive (P_Displayp, "display?", 1, 1, EVAL);
|
Define_Primitive (P_Displayp, "display?", 1, 1, EVAL);
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define MAX_ARGS 14
|
#define MAX_ARGS 14
|
||||||
|
|
||||||
static Object Argl, Argv;
|
static Object Argl, Argv;
|
||||||
|
@ -82,14 +84,14 @@ struct predicate_arg {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
static Event_Predicate (dpy, ep, ptr) Display *dpy; XEvent *ep;
|
static int Event_Predicate (Display *dpy, XEvent *ep,
|
||||||
#ifdef XLIB_RELEASE_5_OR_LATER
|
#ifdef XLIB_RELEASE_5_OR_LATER
|
||||||
XPointer ptr; {
|
XPointer ptr) {
|
||||||
#else
|
#else
|
||||||
char *ptr; {
|
char *ptr) {
|
||||||
#endif
|
#endif
|
||||||
struct predicate_arg *ap = (struct predicate_arg *)ptr;
|
struct predicate_arg *ap = (struct predicate_arg *)ptr;
|
||||||
register i;
|
register int i;
|
||||||
Object args;
|
Object args;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
|
||||||
|
@ -110,9 +112,9 @@ static Event_Predicate (dpy, ep, ptr) Display *dpy; XEvent *ep;
|
||||||
* peek?: don't discard processed events.
|
* peek?: don't discard processed events.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static Object P_Handle_Events (argl) Object argl; {
|
static Object P_Handle_Events (Object argl) {
|
||||||
Object next, clause, func, ret, funcs[LASTEvent], args;
|
Object next, clause, func, ret, funcs[LASTEvent], args;
|
||||||
register i, discard, peek;
|
register int i, discard, peek;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
char *errmsg = "event occurs more than once";
|
char *errmsg = "event occurs more than once";
|
||||||
GC_Node3; struct gcnode gcv;
|
GC_Node3; struct gcnode gcv;
|
||||||
|
@ -192,13 +194,13 @@ static Object P_Handle_Events (argl) Object argl; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object Get_Time_Arg (t) Time t; {
|
static Object Get_Time_Arg (Time t) {
|
||||||
return t == CurrentTime ? Sym_Now : Make_Unsigned_Long ((unsigned long)t);
|
return t == CurrentTime ? Sym_Now : Make_Unsigned_Long ((unsigned long)t);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object Get_Event_Args (ep) XEvent *ep; {
|
Object Get_Event_Args (XEvent *ep) {
|
||||||
Object tmpargs[MAX_ARGS];
|
Object tmpargs[MAX_ARGS];
|
||||||
register e, i;
|
register int e, i;
|
||||||
register Object *a, *vp;
|
register Object *a, *vp;
|
||||||
struct gcnode gcv;
|
struct gcnode gcv;
|
||||||
Object dummy;
|
Object dummy;
|
||||||
|
@ -422,7 +424,7 @@ Object Get_Event_Args (ep) XEvent *ep; {
|
||||||
} break;
|
} break;
|
||||||
case ClientMessage: {
|
case ClientMessage: {
|
||||||
register XClientMessageEvent *p = (XClientMessageEvent *)ep;
|
register XClientMessageEvent *p = (XClientMessageEvent *)ep;
|
||||||
register i;
|
register int i;
|
||||||
|
|
||||||
a[1] = Make_Window (0, p->display, p->window);
|
a[1] = Make_Window (0, p->display, p->window);
|
||||||
a[2] = Make_Atom (p->message_type);
|
a[2] = Make_Atom (p->message_type);
|
||||||
|
@ -463,18 +465,18 @@ Object Get_Event_Args (ep) XEvent *ep; {
|
||||||
return Argl;
|
return Argl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Destroy_Event_Args (args) Object args; {
|
void Destroy_Event_Args (Object args) {
|
||||||
Object t;
|
Object t;
|
||||||
|
|
||||||
for (t = args; !Nullp (t); t = Cdr (t))
|
for (t = args; !Nullp (t); t = Cdr (t))
|
||||||
Car (t) = Null;
|
Car (t) = Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Encode_Event (e) Object e; {
|
int Encode_Event (Object e) {
|
||||||
Object s;
|
Object s;
|
||||||
register char *p;
|
register char *p;
|
||||||
register struct event_desc *ep;
|
register struct event_desc *ep;
|
||||||
register n;
|
register int n;
|
||||||
|
|
||||||
Check_Type (e, T_Symbol);
|
Check_Type (e, T_Symbol);
|
||||||
s = SYMBOL(e)->name;
|
s = SYMBOL(e)->name;
|
||||||
|
@ -487,10 +489,10 @@ Encode_Event (e) Object e; {
|
||||||
return ep-Event_Table;
|
return ep-Event_Table;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Get_Motion_Events (w, from, to) Object w, from, to; {
|
static Object P_Get_Motion_Events (Object w, Object from, Object to) {
|
||||||
XTimeCoord *p;
|
XTimeCoord *p;
|
||||||
int n;
|
int n;
|
||||||
register i;
|
register int i;
|
||||||
Object e, ret;
|
Object e, ret;
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
|
||||||
|
@ -511,9 +513,9 @@ static Object P_Get_Motion_Events (w, from, to) Object w, from, to; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Event_Listen (d, wait_flag) Object d, wait_flag; {
|
static Object P_Event_Listen (Object d, Object wait_flag) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
register n;
|
register int n;
|
||||||
XEvent e;
|
XEvent e;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -527,9 +529,9 @@ static Object P_Event_Listen (d, wait_flag) Object d, wait_flag; {
|
||||||
return Make_Integer (n);
|
return Make_Integer (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_event () {
|
void elk_init_xlib_event () {
|
||||||
Object t;
|
Object t;
|
||||||
register i;
|
register int i;
|
||||||
|
|
||||||
Argl = P_Make_List (Make_Integer (MAX_ARGS), Null);
|
Argl = P_Make_List (Make_Integer (MAX_ARGS), Null);
|
||||||
Global_GC_Link (Argl);
|
Global_GC_Link (Argl);
|
||||||
|
|
|
@ -30,10 +30,12 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
static Object P_List_Extensions (d) Object d; {
|
#include <string.h>
|
||||||
|
|
||||||
|
static Object P_List_Extensions (Object d) {
|
||||||
Object ret;
|
Object ret;
|
||||||
int n;
|
int n;
|
||||||
register i;
|
register int i;
|
||||||
register char **p;
|
register char **p;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ static Object P_List_Extensions (d) Object d; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Query_Extension (d, name) Object d, name; {
|
static Object P_Query_Extension (Object d, Object name) {
|
||||||
int opcode, event, error;
|
int opcode, event, error;
|
||||||
Object ret, t;
|
Object ret, t;
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
@ -72,7 +74,7 @@ static Object P_Query_Extension (d, name) Object d, name; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_extension () {
|
void elk_init_xlib_extension () {
|
||||||
Define_Primitive (P_List_Extensions, "list-extensions", 1, 1, EVAL);
|
Define_Primitive (P_List_Extensions, "list-extensions", 1, 1, EVAL);
|
||||||
Define_Primitive (P_Query_Extension, "query-extension", 2, 2, EVAL);
|
Define_Primitive (P_Query_Extension, "query-extension", 2, 2, EVAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,14 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
Object Sym_Char_Info;
|
Object Sym_Char_Info;
|
||||||
static Object Sym_Font_Info, Sym_Min, Sym_Max;
|
static Object Sym_Font_Info, Sym_Min, Sym_Max;
|
||||||
|
|
||||||
Generic_Predicate (Font)
|
Generic_Predicate (Font)
|
||||||
|
|
||||||
static Font_Equal (x, y) Object x, y; {
|
static int Font_Equal (Object x, Object y) {
|
||||||
Font id1 = FONT(x)->id, id2 = FONT(y)->id;
|
Font id1 = FONT(x)->id, id2 = FONT(y)->id;
|
||||||
if (id1 && id2)
|
if (id1 && id2)
|
||||||
return id1 == id2 && FONT(x)->dpy == FONT(y)->dpy;
|
return id1 == id2 && FONT(x)->dpy == FONT(y)->dpy;
|
||||||
|
@ -43,16 +45,18 @@ static Font_Equal (x, y) Object x, y; {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Generic_Print (Font, "#[font %lu]", FONT(x)->id ? FONT(x)->id : POINTER(x))
|
Generic_Print (Font, "#[font %lu]", FONT(x)->id ? FONT(x)->id
|
||||||
|
: (unsigned int)FIXNUM(x))
|
||||||
|
|
||||||
static Font_Visit (fp, f) Object *fp; int (*f)(); {
|
static int Font_Visit (Object *fp, int (*f)()) {
|
||||||
(*f)(&FONT(*fp)->name);
|
(*f)(&FONT(*fp)->name);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Generic_Get_Display (Font, FONT)
|
Generic_Get_Display (Font, FONT)
|
||||||
|
|
||||||
static Object Internal_Make_Font (finalize, dpy, name, id, info)
|
static Object Internal_Make_Font (int finalize, Display *dpy, Object name,
|
||||||
Display *dpy; Object name; Font id; XFontStruct *info; {
|
Font id, XFontStruct *info) {
|
||||||
Object f;
|
Object f;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
|
||||||
|
@ -71,23 +75,22 @@ static Object Internal_Make_Font (finalize, dpy, name, id, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backwards compatibility: */
|
/* Backwards compatibility: */
|
||||||
Object Make_Font (dpy, name, id, info)
|
Object Make_Font (Display *dpy, Object name, Font id, XFontStruct *info) {
|
||||||
Display *dpy; Object name; Font id; XFontStruct *info; {
|
|
||||||
return Internal_Make_Font (1, dpy, name, id, info);
|
return Internal_Make_Font (1, dpy, name, id, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object Make_Font_Foreign (dpy, name, id, info)
|
Object Make_Font_Foreign (Display *dpy, Object name, Font id,
|
||||||
Display *dpy; Object name; Font id; XFontStruct *info; {
|
XFontStruct *info) {
|
||||||
return Internal_Make_Font (0, dpy, name, id, info);
|
return Internal_Make_Font (0, dpy, name, id, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
Font Get_Font (f) Object f; {
|
Font Get_Font (Object f) {
|
||||||
Check_Type (f, T_Font);
|
Check_Type (f, T_Font);
|
||||||
Open_Font_Maybe (f);
|
Open_Font_Maybe (f);
|
||||||
return FONT(f)->id;
|
return FONT(f)->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static XFontStruct *Internal_Open_Font (d, name) Display *d; Object name; {
|
static XFontStruct *Internal_Open_Font (Display *d, Object name) {
|
||||||
register char *s;
|
register char *s;
|
||||||
XFontStruct *p;
|
XFontStruct *p;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
@ -101,7 +104,7 @@ static XFontStruct *Internal_Open_Font (d, name) Display *d; Object name; {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Open_Font (d, name) Object d, name; {
|
static Object P_Open_Font (Object d, Object name) {
|
||||||
XFontStruct *p;
|
XFontStruct *p;
|
||||||
|
|
||||||
Check_Type (d, T_Display)
|
Check_Type (d, T_Display)
|
||||||
|
@ -109,7 +112,7 @@ static Object P_Open_Font (d, name) Object d, name; {
|
||||||
return Make_Font (DISPLAY(d)->dpy, name, p->fid, p);
|
return Make_Font (DISPLAY(d)->dpy, name, p->fid, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Open_Font_Maybe (f) Object f; {
|
void Open_Font_Maybe (Object f) {
|
||||||
Object name;
|
Object name;
|
||||||
XFontStruct *p;
|
XFontStruct *p;
|
||||||
|
|
||||||
|
@ -124,7 +127,7 @@ void Open_Font_Maybe (f) Object f; {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Close_Font (f) Object f; {
|
Object P_Close_Font (Object f) {
|
||||||
Check_Type (f, T_Font);
|
Check_Type (f, T_Font);
|
||||||
if (FONT(f)->id)
|
if (FONT(f)->id)
|
||||||
XUnloadFont (FONT(f)->dpy, FONT(f)->id);
|
XUnloadFont (FONT(f)->dpy, FONT(f)->id);
|
||||||
|
@ -133,12 +136,12 @@ Object P_Close_Font (f) Object f; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Font_Name (f) Object f; {
|
static Object P_Font_Name (Object f) {
|
||||||
Check_Type (f, T_Font);
|
Check_Type (f, T_Font);
|
||||||
return FONT(f)->name;
|
return FONT(f)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Gcontext_Font (g) Object g; {
|
static Object P_Gcontext_Font (Object g) {
|
||||||
register struct S_Gc *p;
|
register struct S_Gc *p;
|
||||||
register XFontStruct *info;
|
register XFontStruct *info;
|
||||||
|
|
||||||
|
@ -150,11 +153,11 @@ static Object P_Gcontext_Font (g) Object g; {
|
||||||
return Make_Font_Foreign (p->dpy, False, (Font)0, info);
|
return Make_Font_Foreign (p->dpy, False, (Font)0, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object Internal_List_Fonts (d, pat, with_info) Object d, pat; {
|
static Object Internal_List_Fonts (Object d, Object pat, int with_info) {
|
||||||
char **ret;
|
char **ret;
|
||||||
int n;
|
int n;
|
||||||
XFontStruct *iret;
|
XFontStruct *iret;
|
||||||
register i;
|
register int i;
|
||||||
Object f, v;
|
Object f, v;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
@ -184,24 +187,24 @@ static Object Internal_List_Fonts (d, pat, with_info) Object d, pat; {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_List_Font_Names (d, pat) Object d, pat; {
|
static Object P_List_Font_Names (Object d, Object pat) {
|
||||||
return Internal_List_Fonts (d, pat, 0);
|
return Internal_List_Fonts (d, pat, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_List_Fonts (d, pat) Object d, pat; {
|
static Object P_List_Fonts (Object d, Object pat) {
|
||||||
return Internal_List_Fonts (d, pat, 1);
|
return Internal_List_Fonts (d, pat, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Font_Info (f) Object f; {
|
static Object P_Font_Info (Object f) {
|
||||||
Check_Type (f, T_Font);
|
Check_Type (f, T_Font);
|
||||||
FI = *FONT(f)->info;
|
FI = *FONT(f)->info;
|
||||||
return Record_To_Vector (Font_Info_Rec, Font_Info_Size,
|
return Record_To_Vector (Font_Info_Rec, Font_Info_Size,
|
||||||
Sym_Font_Info, FONT(f)->dpy, ~0L);
|
Sym_Font_Info, FONT(f)->dpy, ~0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Char_Info (f, index) Object f, index; {
|
static Object P_Char_Info (Object f, Object index) {
|
||||||
register t = TYPE(index);
|
register int t = TYPE(index);
|
||||||
register unsigned i;
|
register unsigned int i;
|
||||||
register XCharStruct *cp;
|
register XCharStruct *cp;
|
||||||
register XFontStruct *p;
|
register XFontStruct *p;
|
||||||
char *msg = "argument must be integer, character, 'min, or 'max";
|
char *msg = "argument must be integer, character, 'min, or 'max";
|
||||||
|
@ -227,7 +230,7 @@ static Object P_Char_Info (f, index) Object f, index; {
|
||||||
Range_Error (index);
|
Range_Error (index);
|
||||||
i -= p->min_char_or_byte2;
|
i -= p->min_char_or_byte2;
|
||||||
} else {
|
} else {
|
||||||
register unsigned b1 = i & 0xff, b2 = (i >> 8) & 0xff;
|
register unsigned int b1 = i & 0xff, b2 = (i >> 8) & 0xff;
|
||||||
if (b1 < p->min_byte1 || b1 > p->max_byte1 ||
|
if (b1 < p->min_byte1 || b1 > p->max_byte1 ||
|
||||||
b2 < p->min_char_or_byte2 || b2 > p->max_char_or_byte2)
|
b2 < p->min_char_or_byte2 || b2 > p->max_char_or_byte2)
|
||||||
Range_Error (index);
|
Range_Error (index);
|
||||||
|
@ -243,8 +246,8 @@ static Object P_Char_Info (f, index) Object f, index; {
|
||||||
Sym_Char_Info, FONT(f)->dpy, ~0L);
|
Sym_Char_Info, FONT(f)->dpy, ~0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Font_Properties (f) Object f; {
|
static Object P_Font_Properties (Object f) {
|
||||||
register i, n;
|
register int i, n;
|
||||||
Object v, a, val, x;
|
Object v, a, val, x;
|
||||||
GC_Node4;
|
GC_Node4;
|
||||||
|
|
||||||
|
@ -264,7 +267,7 @@ static Object P_Font_Properties (f) Object f; {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Font_Path (d) Object d; {
|
static Object P_Font_Path (Object d) {
|
||||||
Object v;
|
Object v;
|
||||||
int i, n;
|
int i, n;
|
||||||
char **ret;
|
char **ret;
|
||||||
|
@ -287,9 +290,9 @@ static Object P_Font_Path (d) Object d; {
|
||||||
return P_Vector_To_List (v);
|
return P_Vector_To_List (v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Font_Path (d, p) Object d, p; {
|
static Object P_Set_Font_Path (Object d, Object p) {
|
||||||
register char **path;
|
register char **path;
|
||||||
register i, n;
|
register int i, n;
|
||||||
Object c;
|
Object c;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
|
@ -306,7 +309,7 @@ static Object P_Set_Font_Path (d, p) Object d, p; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_font () {
|
void elk_init_xlib_font () {
|
||||||
Define_Symbol (&Sym_Font_Info, "font-info");
|
Define_Symbol (&Sym_Font_Info, "font-info");
|
||||||
Define_Symbol (&Sym_Char_Info, "char-info");
|
Define_Symbol (&Sym_Char_Info, "char-info");
|
||||||
Define_Symbol (&Sym_Min, "min");
|
Define_Symbol (&Sym_Min, "min");
|
||||||
|
|
|
@ -40,7 +40,7 @@ Generic_Print (Gc, "#[gcontext %lu]", GCONTEXT(x)->gc)
|
||||||
|
|
||||||
Generic_Get_Display (Gc, GCONTEXT)
|
Generic_Get_Display (Gc, GCONTEXT)
|
||||||
|
|
||||||
Object Make_Gc (finalize, dpy, g) Display *dpy; GC g; {
|
Object Make_Gc (int finalize, Display *dpy, GC g) {
|
||||||
Object gc;
|
Object gc;
|
||||||
|
|
||||||
if (g == None)
|
if (g == None)
|
||||||
|
@ -58,7 +58,7 @@ Object Make_Gc (finalize, dpy, g) Display *dpy; GC g; {
|
||||||
return gc;
|
return gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Create_Gc (w, g) Object w, g; {
|
static Object P_Create_Gc (Object w, Object g) {
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr;
|
Drawable dr;
|
||||||
|
@ -68,7 +68,7 @@ static Object P_Create_Gc (w, g) Object w, g; {
|
||||||
return Make_Gc (1, dpy, XCreateGC (dpy, dr, mask, &GCV));
|
return Make_Gc (1, dpy, XCreateGC (dpy, dr, mask, &GCV));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Copy_Gc (gc, w) Object gc, w; {
|
static Object P_Copy_Gc (Object gc, Object w) {
|
||||||
GC dst;
|
GC dst;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr;
|
Drawable dr;
|
||||||
|
@ -80,7 +80,7 @@ static Object P_Copy_Gc (gc, w) Object gc, w; {
|
||||||
return Make_Gc (1, dpy, dst);
|
return Make_Gc (1, dpy, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Change_Gc (gc, g) Object gc, g; {
|
static Object P_Change_Gc (Object gc, Object g) {
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
|
|
||||||
Check_Type (gc, T_Gc);
|
Check_Type (gc, T_Gc);
|
||||||
|
@ -89,7 +89,7 @@ static Object P_Change_Gc (gc, g) Object gc, g; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Free_Gc (g) Object g; {
|
Object P_Free_Gc (Object g) {
|
||||||
Check_Type (g, T_Gc);
|
Check_Type (g, T_Gc);
|
||||||
if (!GCONTEXT(g)->free)
|
if (!GCONTEXT(g)->free)
|
||||||
XFreeGC (GCONTEXT(g)->dpy, GCONTEXT(g)->gc);
|
XFreeGC (GCONTEXT(g)->dpy, GCONTEXT(g)->gc);
|
||||||
|
@ -98,7 +98,7 @@ Object P_Free_Gc (g) Object g; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Query_Best_Size (d, w, h, shape) Object d, w, h, shape; {
|
static Object P_Query_Best_Size (Object d, Object w, Object h, Object shape) {
|
||||||
unsigned int rw, rh;
|
unsigned int rw, rh;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -109,10 +109,10 @@ static Object P_Query_Best_Size (d, w, h, shape) Object d, w, h, shape; {
|
||||||
return Cons (Make_Integer (rw), Make_Integer (rh));
|
return Cons (Make_Integer (rw), Make_Integer (rh));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Gcontext_Clip_Rectangles (gc, x, y, v, ord)
|
static Object P_Set_Gcontext_Clip_Rectangles (Object gc, Object x, Object y,
|
||||||
Object gc, x, y, v, ord; {
|
Object v, Object ord) {
|
||||||
register XRectangle *p;
|
register XRectangle *p;
|
||||||
register i, n;
|
register int i, n;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
Check_Type (gc, T_Gc);
|
Check_Type (gc, T_Gc);
|
||||||
|
@ -137,9 +137,9 @@ static Object P_Set_Gcontext_Clip_Rectangles (gc, x, y, v, ord)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Gcontext_Dashlist (gc, off, v) Object gc, off, v; {
|
static Object P_Set_Gcontext_Dashlist (Object gc, Object off, Object v) {
|
||||||
register char *p;
|
register char *p;
|
||||||
register i, n, d;
|
register int i, n, d;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
Check_Type (gc, T_Gc);
|
Check_Type (gc, T_Gc);
|
||||||
|
@ -164,7 +164,7 @@ static Object P_Set_Gcontext_Dashlist (gc, off, v) Object gc, off, v; {
|
||||||
GCSubwindowMode | GCGraphicsExposures | GCClipXOrigin | GCClipYOrigin |\
|
GCSubwindowMode | GCGraphicsExposures | GCClipXOrigin | GCClipYOrigin |\
|
||||||
GCDashOffset | GCArcMode)
|
GCDashOffset | GCArcMode)
|
||||||
|
|
||||||
static Object P_Get_Gc_Values (gc) Object gc; {
|
static Object P_Get_Gc_Values (Object gc) {
|
||||||
unsigned long mask = ValidGCValuesBits;
|
unsigned long mask = ValidGCValuesBits;
|
||||||
|
|
||||||
Check_Type (gc, T_Gc);
|
Check_Type (gc, T_Gc);
|
||||||
|
@ -174,7 +174,7 @@ static Object P_Get_Gc_Values (gc) Object gc; {
|
||||||
mask);
|
mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_gcontext () {
|
void elk_init_xlib_gcontext () {
|
||||||
Define_Symbol (&Sym_Gc, "gcontext");
|
Define_Symbol (&Sym_Gc, "gcontext");
|
||||||
Generic_Define (Gc, "gcontext", "gcontext?");
|
Generic_Define (Gc, "gcontext", "gcontext?");
|
||||||
Define_Primitive (P_Gc_Display, "gcontext-display", 1, 1, EVAL);
|
Define_Primitive (P_Gc_Display, "gcontext-display", 1, 1, EVAL);
|
||||||
|
|
|
@ -32,20 +32,20 @@
|
||||||
|
|
||||||
static Object Sym_Any;
|
static Object Sym_Any;
|
||||||
|
|
||||||
Time Get_Time (time) Object time; {
|
Time Get_Time (Object time) {
|
||||||
if (EQ(time, Sym_Now))
|
if (EQ(time, Sym_Now))
|
||||||
return CurrentTime;
|
return CurrentTime;
|
||||||
return (Time)Get_Long (time);
|
return (Time)Get_Long (time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Get_Mode (m) Object m; {
|
static int Get_Mode (Object m) {
|
||||||
Check_Type (m, T_Boolean);
|
Check_Type (m, T_Boolean);
|
||||||
return EQ(m, True) ? GrabModeSync : GrabModeAsync;
|
return EQ(m, True) ? GrabModeSync : GrabModeAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Grab_Pointer (win, ownerp, events, psyncp, ksyncp, confine_to,
|
static Object P_Grab_Pointer (Object win, Object ownerp, Object events,
|
||||||
cursor, time) Object win, ownerp, events, psyncp, ksyncp, confine_to,
|
Object psyncp, Object ksyncp, Object confine_to,
|
||||||
cursor, time; {
|
Object cursor, Object time) {
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
Check_Type (ownerp, T_Boolean);
|
Check_Type (ownerp, T_Boolean);
|
||||||
return Bits_To_Symbols ((unsigned long)XGrabPointer (WINDOW(win)->dpy,
|
return Bits_To_Symbols ((unsigned long)XGrabPointer (WINDOW(win)->dpy,
|
||||||
|
@ -56,15 +56,15 @@ static Object P_Grab_Pointer (win, ownerp, events, psyncp, ksyncp, confine_to,
|
||||||
0, Grabstatus_Syms);
|
0, Grabstatus_Syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Ungrab_Pointer (d, time) Object d, time; {
|
static Object P_Ungrab_Pointer (Object d, Object time) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XUngrabPointer (DISPLAY(d)->dpy, Get_Time (time));
|
XUngrabPointer (DISPLAY(d)->dpy, Get_Time (time));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Grab_Button (win, button, mods, ownerp, events, psyncp, ksyncp,
|
static Object P_Grab_Button (Object win, Object button, Object mods,
|
||||||
confine_to, cursor) Object win, button, mods, ownerp, events,
|
Object ownerp, Object events, Object psyncp,
|
||||||
psyncp, ksyncp, confine_to, cursor; {
|
Object ksyncp, Object confine_to, Object cursor) {
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
Check_Type (ownerp, T_Boolean);
|
Check_Type (ownerp, T_Boolean);
|
||||||
XGrabButton (WINDOW(win)->dpy, Symbols_To_Bits (button, 0, Button_Syms),
|
XGrabButton (WINDOW(win)->dpy, Symbols_To_Bits (button, 0, Button_Syms),
|
||||||
|
@ -75,23 +75,23 @@ static Object P_Grab_Button (win, button, mods, ownerp, events, psyncp, ksyncp,
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Ungrab_Button (win, button, mods) Object win, button, mods; {
|
static Object P_Ungrab_Button (Object win, Object button, Object mods) {
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
XUngrabButton (WINDOW(win)->dpy, Symbols_To_Bits (button, 0, Button_Syms),
|
XUngrabButton (WINDOW(win)->dpy, Symbols_To_Bits (button, 0, Button_Syms),
|
||||||
Symbols_To_Bits (mods, 1, State_Syms), WINDOW(win)->win);
|
Symbols_To_Bits (mods, 1, State_Syms), WINDOW(win)->win);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Change_Active_Pointer_Grab (d, events, cursor, time)
|
static Object P_Change_Active_Pointer_Grab (Object d, Object events,
|
||||||
Object d, events, cursor, time; {
|
Object cursor, Object time) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XChangeActivePointerGrab (DISPLAY(d)->dpy, Symbols_To_Bits (events, 1,
|
XChangeActivePointerGrab (DISPLAY(d)->dpy, Symbols_To_Bits (events, 1,
|
||||||
Event_Syms), Get_Cursor (cursor), Get_Time (time));
|
Event_Syms), Get_Cursor (cursor), Get_Time (time));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Grab_Keyboard (win, ownerp, psyncp, ksyncp, time) Object win,
|
static Object P_Grab_Keyboard (Object win, Object ownerp, Object psyncp,
|
||||||
ownerp, psyncp, ksyncp, time; {
|
Object ksyncp, Object time) {
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
Check_Type (ownerp, T_Boolean);
|
Check_Type (ownerp, T_Boolean);
|
||||||
return Bits_To_Symbols ((unsigned long)XGrabKeyboard (WINDOW(win)->dpy,
|
return Bits_To_Symbols ((unsigned long)XGrabKeyboard (WINDOW(win)->dpy,
|
||||||
|
@ -100,14 +100,14 @@ static Object P_Grab_Keyboard (win, ownerp, psyncp, ksyncp, time) Object win,
|
||||||
0, Grabstatus_Syms);
|
0, Grabstatus_Syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Ungrab_Keyboard (d, time) Object d, time; {
|
static Object P_Ungrab_Keyboard (Object d, Object time) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XUngrabKeyboard (DISPLAY(d)->dpy, Get_Time (time));
|
XUngrabKeyboard (DISPLAY(d)->dpy, Get_Time (time));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Grab_Key (win, key, mods, ownerp, psyncp, ksyncp) Object win,
|
static Object P_Grab_Key (Object win, Object key, Object mods, Object ownerp,
|
||||||
key, mods, ownerp, psyncp, ksyncp; {
|
Object psyncp, Object ksyncp) {
|
||||||
int keycode = AnyKey;
|
int keycode = AnyKey;
|
||||||
|
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
|
@ -120,7 +120,7 @@ static Object P_Grab_Key (win, key, mods, ownerp, psyncp, ksyncp) Object win,
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Ungrab_Key (win, key, mods) Object win, key, mods; {
|
static Object P_Ungrab_Key (Object win, Object key, Object mods) {
|
||||||
int keycode = AnyKey;
|
int keycode = AnyKey;
|
||||||
|
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
|
@ -131,26 +131,26 @@ static Object P_Ungrab_Key (win, key, mods) Object win, key, mods; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Allow_Events (d, mode, time) Object d, mode, time; {
|
static Object P_Allow_Events (Object d, Object mode, Object time) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XAllowEvents (DISPLAY(d)->dpy, Symbols_To_Bits (mode, 0,
|
XAllowEvents (DISPLAY(d)->dpy, Symbols_To_Bits (mode, 0,
|
||||||
Allow_Events_Syms), Get_Time (time));
|
Allow_Events_Syms), Get_Time (time));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Grab_Server (d) Object d; {
|
static Object P_Grab_Server (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XGrabServer (DISPLAY(d)->dpy);
|
XGrabServer (DISPLAY(d)->dpy);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Ungrab_Server (d) Object d; {
|
static Object P_Ungrab_Server (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
XUngrabServer (DISPLAY(d)->dpy);
|
XUngrabServer (DISPLAY(d)->dpy);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_grab () {
|
void elk_init_xlib_grab () {
|
||||||
Define_Primitive (P_Grab_Pointer, "grab-pointer", 8, 8, EVAL);
|
Define_Primitive (P_Grab_Pointer, "grab-pointer", 8, 8, EVAL);
|
||||||
Define_Primitive (P_Ungrab_Pointer, "ungrab-pointer", 2, 2, EVAL);
|
Define_Primitive (P_Ungrab_Pointer, "ungrab-pointer", 2, 2, EVAL);
|
||||||
Define_Primitive (P_Grab_Button, "grab-button", 9, 9, EVAL);
|
Define_Primitive (P_Grab_Button, "grab-button", 9, 9, EVAL);
|
||||||
|
|
|
@ -30,11 +30,12 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
extern XDrawPoints(), XDrawLines(), XDrawRectangle(), XFillRectangle();
|
extern int XDrawPoints(), XDrawLines(), XDrawRectangle(), XFillRectangle();
|
||||||
extern XDrawRectangles(), XFillRectangles(), XDrawArc(), XFillArc();
|
extern int XDrawRectangles(), XFillRectangles(), XDrawArc(), XFillArc();
|
||||||
extern XDrawArcs(), XFillArcs(), XFillPolygon();
|
extern int XDrawArcs(), XFillArcs(), XFillPolygon();
|
||||||
|
|
||||||
static Object P_Clear_Area (win, x, y, w, h, e) Object win, x, y, w, h, e; {
|
static Object P_Clear_Area (Object win, Object x, Object y, Object w, Object h,
|
||||||
|
Object e) {
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
Check_Type (e, T_Boolean);
|
Check_Type (e, T_Boolean);
|
||||||
XClearArea (WINDOW(win)->dpy, WINDOW(win)->win, Get_Integer (x),
|
XClearArea (WINDOW(win)->dpy, WINDOW(win)->win, Get_Integer (x),
|
||||||
|
@ -42,8 +43,9 @@ static Object P_Clear_Area (win, x, y, w, h, e) Object win, x, y, w, h, e; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Copy_Area (src, gc, sx, sy, w, h, dst, dx, dy) Object src, gc,
|
static Object P_Copy_Area (Object src, Object gc, Object sx, Object sy,
|
||||||
sx, sy, w, h, dst, dx, dy; {
|
Object w, Object h, Object dst, Object dx,
|
||||||
|
Object dy) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable ddst = Get_Drawable (dst, &dpy), dsrc = Get_Drawable (src, &dpy);
|
Drawable ddst = Get_Drawable (dst, &dpy), dsrc = Get_Drawable (src, &dpy);
|
||||||
|
|
||||||
|
@ -54,8 +56,9 @@ static Object P_Copy_Area (src, gc, sx, sy, w, h, dst, dx, dy) Object src, gc,
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Copy_Plane (src, gc, plane, sx, sy, w, h, dst, dx, dy)
|
static Object P_Copy_Plane (Object src, Object gc, Object plane, Object sx,
|
||||||
Object src, gc, plane, sx, sy, w, h, dst, dx, dy; {
|
Object sy, Object w, Object h, Object dst,
|
||||||
|
Object dx, Object dy) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable ddst = Get_Drawable (dst, &dpy), dsrc = Get_Drawable (src, &dpy);
|
Drawable ddst = Get_Drawable (dst, &dpy), dsrc = Get_Drawable (src, &dpy);
|
||||||
register unsigned long p;
|
register unsigned long p;
|
||||||
|
@ -70,7 +73,7 @@ static Object P_Copy_Plane (src, gc, plane, sx, sy, w, h, dst, dx, dy)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Point (d, gc, x, y) Object d, gc, x, y; {
|
static Object P_Draw_Point (Object d, Object gc, Object x, Object y) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
|
|
||||||
|
@ -79,12 +82,13 @@ static Object P_Draw_Point (d, gc, x, y) Object d, gc, x, y; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object Internal_Draw_Points (d, gc, v, relative, func, shape)
|
static Object Internal_Draw_Points (Object d, Object gc, Object v,
|
||||||
Object d, gc, v, relative, shape; int (*func)(); {
|
Object relative,
|
||||||
|
int (*func)(), Object shape) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
register XPoint *p;
|
register XPoint *p;
|
||||||
register i, n;
|
register int i, n;
|
||||||
int rel, sh;
|
int rel, sh;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
|
@ -111,12 +115,12 @@ static Object Internal_Draw_Points (d, gc, v, relative, func, shape)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Points (d, gc, v, relative) Object d, gc, v, relative; {
|
static Object P_Draw_Points (Object d, Object gc, Object v, Object relative) {
|
||||||
return Internal_Draw_Points (d, gc, v, relative, XDrawPoints, Null);
|
return Internal_Draw_Points (d, gc, v, relative, XDrawPoints, Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Line (d, gc, x1, y1, x2, y2)
|
static Object P_Draw_Line (Object d, Object gc, Object x1, Object y1,
|
||||||
Object d, gc, x1, y1, x2, y2; {
|
Object x2, Object y2) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
|
|
||||||
|
@ -126,15 +130,15 @@ static Object P_Draw_Line (d, gc, x1, y1, x2, y2)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Lines (d, gc, v, relative) Object d, gc, v, relative; {
|
static Object P_Draw_Lines (Object d, Object gc, Object v, Object relative) {
|
||||||
return Internal_Draw_Points (d, gc, v, relative, XDrawLines, Null);
|
return Internal_Draw_Points (d, gc, v, relative, XDrawLines, Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Segments (d, gc, v) Object d, gc, v; {
|
static Object P_Draw_Segments (Object d, Object gc, Object v) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
register XSegment *p;
|
register XSegment *p;
|
||||||
register i, n;
|
register int i, n;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
Check_Type (gc, T_Gc);
|
Check_Type (gc, T_Gc);
|
||||||
|
@ -157,8 +161,8 @@ static Object P_Draw_Segments (d, gc, v) Object d, gc, v; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object Internal_Draw_Rectangle (d, gc, x, y, w, h, func)
|
static Object Internal_Draw_Rectangle (Object d, Object gc, Object x, Object y,
|
||||||
Object d, gc, x, y, w, h; int (*func)(); {
|
Object w, Object h, int (*func)()) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
|
|
||||||
|
@ -168,20 +172,22 @@ static Object Internal_Draw_Rectangle (d, gc, x, y, w, h, func)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Rectangle (d, gc, x, y, w, h) Object d, gc, x, y, w, h; {
|
static Object P_Draw_Rectangle (Object d, Object gc, Object x, Object y,
|
||||||
|
Object w, Object h) {
|
||||||
return Internal_Draw_Rectangle (d, gc, x, y, w, h, XDrawRectangle);
|
return Internal_Draw_Rectangle (d, gc, x, y, w, h, XDrawRectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Fill_Rectangle (d, gc, x, y, w, h) Object d, gc, x, y, w, h; {
|
static Object P_Fill_Rectangle (Object d, Object gc, Object x, Object y,
|
||||||
|
Object w, Object h) {
|
||||||
return Internal_Draw_Rectangle (d, gc, x, y, w, h, XFillRectangle);
|
return Internal_Draw_Rectangle (d, gc, x, y, w, h, XFillRectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object Internal_Draw_Rectangles (d, gc, v, func)
|
static Object Internal_Draw_Rectangles (Object d, Object gc, Object v,
|
||||||
Object d, gc, v; int (*func)(); {
|
int (*func)()) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
register XRectangle *p;
|
register XRectangle *p;
|
||||||
register i, n;
|
register int i, n;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
Check_Type (gc, T_Gc);
|
Check_Type (gc, T_Gc);
|
||||||
|
@ -204,16 +210,17 @@ static Object Internal_Draw_Rectangles (d, gc, v, func)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Rectangles (d, gc, v) Object d, gc, v; {
|
static Object P_Draw_Rectangles (Object d, Object gc, Object v) {
|
||||||
return Internal_Draw_Rectangles (d, gc, v, XDrawRectangles);
|
return Internal_Draw_Rectangles (d, gc, v, XDrawRectangles);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Fill_Rectangles (d, gc, v) Object d, gc, v; {
|
static Object P_Fill_Rectangles (Object d, Object gc, Object v) {
|
||||||
return Internal_Draw_Rectangles (d, gc, v, XFillRectangles);
|
return Internal_Draw_Rectangles (d, gc, v, XFillRectangles);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object Internal_Draw_Arc (d, gc, x, y, w, h, a1, a2, func)
|
static Object Internal_Draw_Arc (Object d, Object gc, Object x, Object y,
|
||||||
Object d, gc, x, y, w, h, a1, a2; int (*func)(); {
|
Object w, Object h, Object a1, Object a2,
|
||||||
|
int (*func)()) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
|
|
||||||
|
@ -223,22 +230,22 @@ static Object Internal_Draw_Arc (d, gc, x, y, w, h, a1, a2, func)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Arc (d, gc, x, y, w, h, a1, a2)
|
static Object P_Draw_Arc (Object d, Object gc, Object x, Object y, Object w,
|
||||||
Object d, gc, x, y, w, h, a1, a2; {
|
Object h, Object a1, Object a2) {
|
||||||
return Internal_Draw_Arc (d, gc, x, y, w, h, a1, a2, XDrawArc);
|
return Internal_Draw_Arc (d, gc, x, y, w, h, a1, a2, XDrawArc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Fill_Arc (d, gc, x, y, w, h, a1, a2)
|
static Object P_Fill_Arc (Object d, Object gc, Object x, Object y, Object w,
|
||||||
Object d, gc, x, y, w, h, a1, a2; {
|
Object h, Object a1, Object a2) {
|
||||||
return Internal_Draw_Arc (d, gc, x, y, w, h, a1, a2, XFillArc);
|
return Internal_Draw_Arc (d, gc, x, y, w, h, a1, a2, XFillArc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object Internal_Draw_Arcs (d, gc, v, func) Object d, gc, v;
|
static Object Internal_Draw_Arcs (Object d, Object gc, Object v,
|
||||||
int (*func)(); {
|
int (*func)()) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
register XArc *p;
|
register XArc *p;
|
||||||
register i, n;
|
register int i, n;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
Check_Type (gc, T_Gc);
|
Check_Type (gc, T_Gc);
|
||||||
|
@ -263,20 +270,20 @@ static Object Internal_Draw_Arcs (d, gc, v, func) Object d, gc, v;
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Arcs (d, gc, v) Object d, gc, v; {
|
static Object P_Draw_Arcs (Object d, Object gc, Object v) {
|
||||||
return Internal_Draw_Arcs (d, gc, v, XDrawArcs);
|
return Internal_Draw_Arcs (d, gc, v, XDrawArcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Fill_Arcs (d, gc, v) Object d, gc, v; {
|
static Object P_Fill_Arcs (Object d, Object gc, Object v) {
|
||||||
return Internal_Draw_Arcs (d, gc, v, XFillArcs);
|
return Internal_Draw_Arcs (d, gc, v, XFillArcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Fill_Polygon (d, gc, v, relative, shape)
|
static Object P_Fill_Polygon (Object d, Object gc, Object v, Object relative,
|
||||||
Object d, gc, v, relative, shape; {
|
Object shape) {
|
||||||
return Internal_Draw_Points (d, gc, v, relative, XFillPolygon, shape);
|
return Internal_Draw_Points (d, gc, v, relative, XFillPolygon, shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_graphics () {
|
void elk_init_xlib_graphics () {
|
||||||
Define_Primitive (P_Clear_Area, "clear-area", 6, 6, EVAL);
|
Define_Primitive (P_Clear_Area, "clear-area", 6, 6, EVAL);
|
||||||
Define_Primitive (P_Copy_Area, "copy-area", 9, 9, EVAL);
|
Define_Primitive (P_Copy_Area, "copy-area", 9, 9, EVAL);
|
||||||
Define_Primitive (P_Copy_Plane, "copy-plane", 10,10, EVAL);
|
Define_Primitive (P_Copy_Plane, "copy-plane", 10,10, EVAL);
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef XLIB_RELEASE_5_OR_LATER
|
#ifdef XLIB_RELEASE_5_OR_LATER
|
||||||
|
|
||||||
/* I don't know if XDisplayKeycodes() was already there in X11R4.
|
/* I don't know if XDisplayKeycodes() was already there in X11R4.
|
||||||
*/
|
*/
|
||||||
static Object P_Display_Min_Keycode (d) Object d; {
|
static Object P_Display_Min_Keycode (Object d) {
|
||||||
int mink, maxk;
|
int mink, maxk;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -42,7 +44,7 @@ static Object P_Display_Min_Keycode (d) Object d; {
|
||||||
return Make_Integer (mink);
|
return Make_Integer (mink);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Max_Keycode (d) Object d; {
|
static Object P_Display_Max_Keycode (Object d) {
|
||||||
int mink, maxk;
|
int mink, maxk;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -51,12 +53,12 @@ static Object P_Display_Max_Keycode (d) Object d; {
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static Object P_Display_Min_Keycode (d) Object d; {
|
static Object P_Display_Min_Keycode (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DISPLAY(d)->dpy->min_keycode);
|
return Make_Integer (DISPLAY(d)->dpy->min_keycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Display_Max_Keycode (d) Object d; {
|
static Object P_Display_Max_Keycode (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Integer (DISPLAY(d)->dpy->max_keycode);
|
return Make_Integer (DISPLAY(d)->dpy->max_keycode);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +68,7 @@ static Object P_Display_Max_Keycode (d) Object d; {
|
||||||
|
|
||||||
/* I'm not sure if this works correctly in X11R4:
|
/* I'm not sure if this works correctly in X11R4:
|
||||||
*/
|
*/
|
||||||
static Object P_Display_Keysyms_Per_Keycode (d) Object d; {
|
static Object P_Display_Keysyms_Per_Keycode (Object d) {
|
||||||
KeySym *ksyms;
|
KeySym *ksyms;
|
||||||
int mink, maxk, ksyms_per_kode;
|
int mink, maxk, ksyms_per_kode;
|
||||||
|
|
||||||
|
@ -78,7 +80,7 @@ static Object P_Display_Keysyms_Per_Keycode (d) Object d; {
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static Object P_Display_Keysyms_Per_Keycode (d) Object d; {
|
static Object P_Display_Keysyms_Per_Keycode (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
/* Force initialization: */
|
/* Force initialization: */
|
||||||
Disable_Interrupts;
|
Disable_Interrupts;
|
||||||
|
@ -88,21 +90,21 @@ static Object P_Display_Keysyms_Per_Keycode (d) Object d; {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Object P_String_To_Keysym (s) Object s; {
|
static Object P_String_To_Keysym (Object s) {
|
||||||
KeySym k;
|
KeySym k;
|
||||||
|
|
||||||
k = XStringToKeysym (Get_Strsym (s));
|
k = XStringToKeysym (Get_Strsym (s));
|
||||||
return k == NoSymbol ? False : Make_Unsigned_Long ((unsigned long)k);
|
return k == NoSymbol ? False : Make_Unsigned_Long ((unsigned long)k);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Keysym_To_String (k) Object k; {
|
static Object P_Keysym_To_String (Object k) {
|
||||||
register char *s;
|
register char *s;
|
||||||
|
|
||||||
s = XKeysymToString ((KeySym)Get_Long (k));
|
s = XKeysymToString ((KeySym)Get_Long (k));
|
||||||
return s ? Make_String (s, strlen (s)) : False;
|
return s ? Make_String (s, strlen (s)) : False;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Keycode_To_Keysym (d, k, index) Object d, k, index; {
|
static Object P_Keycode_To_Keysym (Object d, Object k, Object index) {
|
||||||
Object ret;
|
Object ret;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -113,7 +115,7 @@ static Object P_Keycode_To_Keysym (d, k, index) Object d, k, index; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Keysym_To_Keycode (d, k) Object d, k; {
|
static Object P_Keysym_To_Keycode (Object d, Object k) {
|
||||||
Object ret;
|
Object ret;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -124,10 +126,10 @@ static Object P_Keysym_To_Keycode (d, k) Object d, k; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Lookup_String (d, k, mask) Object d, k, mask; {
|
static Object P_Lookup_String (Object d, Object k, Object mask) {
|
||||||
XKeyEvent e;
|
XKeyEvent e;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
register len;
|
register int len;
|
||||||
KeySym keysym_return;
|
KeySym keysym_return;
|
||||||
XComposeStatus status_return;
|
XComposeStatus status_return;
|
||||||
|
|
||||||
|
@ -141,9 +143,9 @@ static Object P_Lookup_String (d, k, mask) Object d, k, mask; {
|
||||||
return Make_String (buf, len);
|
return Make_String (buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Rebind_Keysym (d, k, mods, str) Object d, k, mods, str; {
|
static Object P_Rebind_Keysym (Object d, Object k, Object mods, Object str) {
|
||||||
KeySym *p;
|
KeySym *p;
|
||||||
register i, n;
|
register int i, n;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -159,7 +161,7 @@ static Object P_Rebind_Keysym (d, k, mods, str) Object d, k, mods, str; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Refresh_Keyboard_Mapping (w, event) Object w, event; {
|
static Object P_Refresh_Keyboard_Mapping (Object w, Object event) {
|
||||||
static XMappingEvent fake;
|
static XMappingEvent fake;
|
||||||
|
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
|
@ -171,7 +173,7 @@ static Object P_Refresh_Keyboard_Mapping (w, event) Object w, event; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_key () {
|
void elk_init_xlib_key () {
|
||||||
Define_Primitive (P_Display_Min_Keycode, "display-min-keycode",
|
Define_Primitive (P_Display_Min_Keycode, "display-min-keycode",
|
||||||
1, 1, EVAL);
|
1, 1, EVAL);
|
||||||
Define_Primitive (P_Display_Max_Keycode, "display-max-keycode",
|
Define_Primitive (P_Display_Max_Keycode, "display-max-keycode",
|
||||||
|
|
|
@ -36,7 +36,7 @@ Generic_Simple_Equal (Pixel, PIXEL, pix)
|
||||||
|
|
||||||
Generic_Print (Pixel, "#[pixel 0x%lx]", PIXEL(x)->pix)
|
Generic_Print (Pixel, "#[pixel 0x%lx]", PIXEL(x)->pix)
|
||||||
|
|
||||||
Object Make_Pixel (val) unsigned long val; {
|
Object Make_Pixel (unsigned long val) {
|
||||||
Object pix;
|
Object pix;
|
||||||
|
|
||||||
pix = Find_Object (T_Pixel, (GENERIC)0, Match_X_Obj, val);
|
pix = Find_Object (T_Pixel, (GENERIC)0, Match_X_Obj, val);
|
||||||
|
@ -49,28 +49,28 @@ Object Make_Pixel (val) unsigned long val; {
|
||||||
return pix;
|
return pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long Get_Pixel (p) Object p; {
|
unsigned long Get_Pixel (Object p) {
|
||||||
Check_Type (p, T_Pixel);
|
Check_Type (p, T_Pixel);
|
||||||
return PIXEL(p)->pix;
|
return PIXEL(p)->pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Pixel_Value (p) Object p; {
|
static Object P_Pixel_Value (Object p) {
|
||||||
return Make_Unsigned_Long (Get_Pixel (p));
|
return Make_Unsigned_Long (Get_Pixel (p));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Black_Pixel (d) Object d; {
|
static Object P_Black_Pixel (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Pixel (BlackPixel (DISPLAY(d)->dpy,
|
return Make_Pixel (BlackPixel (DISPLAY(d)->dpy,
|
||||||
DefaultScreen (DISPLAY(d)->dpy)));
|
DefaultScreen (DISPLAY(d)->dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_White_Pixel (d) Object d; {
|
static Object P_White_Pixel (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Pixel (WhitePixel (DISPLAY(d)->dpy,
|
return Make_Pixel (WhitePixel (DISPLAY(d)->dpy,
|
||||||
DefaultScreen (DISPLAY(d)->dpy)));
|
DefaultScreen (DISPLAY(d)->dpy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_pixel () {
|
void elk_init_xlib_pixel () {
|
||||||
Generic_Define (Pixel, "pixel", "pixel?");
|
Generic_Define (Pixel, "pixel", "pixel?");
|
||||||
Define_Primitive (P_Pixel_Value, "pixel-value", 1, 1, EVAL);
|
Define_Primitive (P_Pixel_Value, "pixel-value", 1, 1, EVAL);
|
||||||
Define_Primitive (P_Black_Pixel, "black-pixel", 1, 1, EVAL);
|
Define_Primitive (P_Black_Pixel, "black-pixel", 1, 1, EVAL);
|
||||||
|
|
|
@ -38,8 +38,7 @@ Generic_Print (Pixmap, "#[pixmap %lu]", PIXMAP(x)->pm)
|
||||||
|
|
||||||
Generic_Get_Display (Pixmap, PIXMAP)
|
Generic_Get_Display (Pixmap, PIXMAP)
|
||||||
|
|
||||||
static Object Internal_Make_Pixmap (finalize, dpy, pix)
|
static Object Internal_Make_Pixmap (int finalize, Display *dpy, Pixmap pix) {
|
||||||
Display *dpy; Pixmap pix; {
|
|
||||||
Object pm;
|
Object pm;
|
||||||
|
|
||||||
if (pix == None)
|
if (pix == None)
|
||||||
|
@ -58,20 +57,20 @@ static Object Internal_Make_Pixmap (finalize, dpy, pix)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backwards compatibility: */
|
/* Backwards compatibility: */
|
||||||
Object Make_Pixmap (dpy, pix) Display *dpy; Pixmap pix; {
|
Object Make_Pixmap (Display *dpy, Pixmap pix) {
|
||||||
return Internal_Make_Pixmap (1, dpy, pix);
|
return Internal_Make_Pixmap (1, dpy, pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object Make_Pixmap_Foreign (dpy, pix) Display *dpy; Pixmap pix; {
|
Object Make_Pixmap_Foreign (Display *dpy, Pixmap pix) {
|
||||||
return Internal_Make_Pixmap (0, dpy, pix);
|
return Internal_Make_Pixmap (0, dpy, pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pixmap Get_Pixmap (p) Object p; {
|
Pixmap Get_Pixmap (Object p) {
|
||||||
Check_Type (p, T_Pixmap);
|
Check_Type (p, T_Pixmap);
|
||||||
return PIXMAP(p)->pm;
|
return PIXMAP(p)->pm;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Free_Pixmap (p) Object p; {
|
Object P_Free_Pixmap (Object p) {
|
||||||
Check_Type (p, T_Pixmap);
|
Check_Type (p, T_Pixmap);
|
||||||
if (!PIXMAP(p)->free)
|
if (!PIXMAP(p)->free)
|
||||||
XFreePixmap (PIXMAP(p)->dpy, PIXMAP(p)->pm);
|
XFreePixmap (PIXMAP(p)->dpy, PIXMAP(p)->pm);
|
||||||
|
@ -80,7 +79,7 @@ Object P_Free_Pixmap (p) Object p; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Create_Pixmap (d, w, h, depth) Object d, w, h, depth; {
|
static Object P_Create_Pixmap (Object d, Object w, Object h, Object depth) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
|
|
||||||
|
@ -88,9 +87,9 @@ static Object P_Create_Pixmap (d, w, h, depth) Object d, w, h, depth; {
|
||||||
Get_Integer (h), Get_Integer (depth)));
|
Get_Integer (h), Get_Integer (depth)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Create_Bitmap_From_Data (win, data, pw, ph)
|
static Object P_Create_Bitmap_From_Data (Object win, Object data, Object pw,
|
||||||
Object win, data, pw, ph; {
|
Object ph) {
|
||||||
register w, h;
|
register int w, h;
|
||||||
|
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
Check_Type (data, T_String);
|
Check_Type (data, T_String);
|
||||||
|
@ -103,9 +102,11 @@ static Object P_Create_Bitmap_From_Data (win, data, pw, ph)
|
||||||
STRING(data)->data, w, h));
|
STRING(data)->data, w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Create_Pixmap_From_Bitmap_Data (win, data, pw, ph, fg, bg,
|
static Object P_Create_Pixmap_From_Bitmap_Data (Object win, Object data,
|
||||||
depth) Object win, data, pw, ph, fg, bg, depth; {
|
Object pw, Object ph,
|
||||||
register w, h;
|
Object fg, Object bg,
|
||||||
|
Object depth) {
|
||||||
|
register int w, h;
|
||||||
|
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
Check_Type (data, T_String);
|
Check_Type (data, T_String);
|
||||||
|
@ -119,7 +120,7 @@ static Object P_Create_Pixmap_From_Bitmap_Data (win, data, pw, ph, fg, bg,
|
||||||
Get_Integer (depth)));
|
Get_Integer (depth)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Read_Bitmap_File (d, fn) Object d, fn; {
|
static Object P_Read_Bitmap_File (Object d, Object fn) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
|
@ -146,7 +147,7 @@ static Object P_Read_Bitmap_File (d, fn) Object d, fn; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Write_Bitmap_File (argc, argv) Object *argv; {
|
static Object P_Write_Bitmap_File (int argc, Object *argv) {
|
||||||
Pixmap pm;
|
Pixmap pm;
|
||||||
int ret, xhot = -1, yhot = -1;
|
int ret, xhot = -1, yhot = -1;
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ static Object P_Write_Bitmap_File (argc, argv) Object *argv; {
|
||||||
return Bits_To_Symbols ((unsigned long)ret, 0, Bitmapstatus_Syms);
|
return Bits_To_Symbols ((unsigned long)ret, 0, Bitmapstatus_Syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_pixmap () {
|
void elk_init_xlib_pixmap () {
|
||||||
Generic_Define (Pixmap, "pixmap", "pixmap?");
|
Generic_Define (Pixmap, "pixmap", "pixmap?");
|
||||||
Define_Primitive (P_Pixmap_Display, "pixmap-display", 1, 1, EVAL);
|
Define_Primitive (P_Pixmap_Display, "pixmap-display", 1, 1, EVAL);
|
||||||
Define_Primitive (P_Free_Pixmap, "free-pixmap", 1, 1, EVAL);
|
Define_Primitive (P_Free_Pixmap, "free-pixmap", 1, 1, EVAL);
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
Object Sym_Now;
|
Object Sym_Now;
|
||||||
|
|
||||||
Generic_Predicate (Atom)
|
Generic_Predicate (Atom)
|
||||||
|
@ -38,7 +40,7 @@ Generic_Simple_Equal (Atom, ATOM, atom)
|
||||||
|
|
||||||
Generic_Print (Atom, "#[atom %lu]", ATOM(x)->atom)
|
Generic_Print (Atom, "#[atom %lu]", ATOM(x)->atom)
|
||||||
|
|
||||||
Object Make_Atom (a) Atom a; {
|
Object Make_Atom (Atom a) {
|
||||||
Object atom;
|
Object atom;
|
||||||
|
|
||||||
if (a == None)
|
if (a == None)
|
||||||
|
@ -54,21 +56,21 @@ Object Make_Atom (a) Atom a; {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should be used with care */
|
/* Should be used with care */
|
||||||
static Object P_Make_Atom (n) Object n; {
|
static Object P_Make_Atom (Object n) {
|
||||||
return Make_Atom ((Atom)Get_Long (n));
|
return Make_Atom ((Atom)Get_Long (n));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Intern_Atom (d, name) Object d, name; {
|
static Object P_Intern_Atom (Object d, Object name) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Atom (XInternAtom (DISPLAY(d)->dpy, Get_Strsym (name), 0));
|
return Make_Atom (XInternAtom (DISPLAY(d)->dpy, Get_Strsym (name), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Find_Atom (d, name) Object d, name; {
|
static Object P_Find_Atom (Object d, Object name) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return Make_Atom (XInternAtom (DISPLAY(d)->dpy, Get_Strsym (name), 1));
|
return Make_Atom (XInternAtom (DISPLAY(d)->dpy, Get_Strsym (name), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Atom_Name (d, a) Object d, a; {
|
static Object P_Atom_Name (Object d, Object a) {
|
||||||
register char *s;
|
register char *s;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -79,8 +81,8 @@ static Object P_Atom_Name (d, a) Object d, a; {
|
||||||
return Make_String (s, strlen (s));
|
return Make_String (s, strlen (s));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_List_Properties (w) Object w; {
|
static Object P_List_Properties (Object w) {
|
||||||
register i;
|
register int i;
|
||||||
int n;
|
int n;
|
||||||
register Atom *ap;
|
register Atom *ap;
|
||||||
Object v;
|
Object v;
|
||||||
|
@ -103,14 +105,14 @@ static Object P_List_Properties (w) Object w; {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Get_Property (w, prop, type, start, len, deletep)
|
static Object P_Get_Property (Object w, Object prop, Object type, Object start,
|
||||||
Object w, prop, type, start, len, deletep; {
|
Object len, Object deletep) {
|
||||||
Atom req_type = AnyPropertyType, actual_type;
|
Atom req_type = AnyPropertyType, actual_type;
|
||||||
int format;
|
int format;
|
||||||
unsigned long nitems, bytes_left;
|
unsigned long nitems, bytes_left;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
Object ret, t, x;
|
Object ret, t, x;
|
||||||
register i;
|
register unsigned int i;
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
|
@ -162,9 +164,9 @@ static Object P_Get_Property (w, prop, type, start, len, deletep)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Change_Property (w, prop, type, format, mode, data)
|
static Object P_Change_Property (Object w, Object prop, Object type,
|
||||||
Object w, prop, type, format, mode, data; {
|
Object format, Object mode, Object data) {
|
||||||
register i, m, x, nitems, f;
|
register int i, m, x, nitems, f;
|
||||||
char *buf;
|
char *buf;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
|
@ -200,16 +202,16 @@ static Object P_Change_Property (w, prop, type, format, mode, data)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Delete_Property (w, prop) Object w, prop; {
|
static Object P_Delete_Property (Object w, Object prop) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
Check_Type (prop, T_Atom);
|
Check_Type (prop, T_Atom);
|
||||||
XDeleteProperty (WINDOW(w)->dpy, WINDOW(w)->win, ATOM(prop)->atom);
|
XDeleteProperty (WINDOW(w)->dpy, WINDOW(w)->win, ATOM(prop)->atom);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Rotate_Properties (w, v, delta) Object w, v, delta; {
|
static Object P_Rotate_Properties (Object w, Object v, Object delta) {
|
||||||
Atom *p;
|
Atom *p;
|
||||||
register i, n;
|
register int i, n;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
|
@ -229,8 +231,8 @@ static Object P_Rotate_Properties (w, v, delta) Object w, v, delta; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Selection_Owner (d, s, owner, time) Object d, s, owner,
|
static Object P_Set_Selection_Owner (Object d, Object s, Object owner,
|
||||||
time; {
|
Object time) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
Check_Type (s, T_Atom);
|
Check_Type (s, T_Atom);
|
||||||
XSetSelectionOwner (DISPLAY(d)->dpy, ATOM(s)->atom, Get_Window (owner),
|
XSetSelectionOwner (DISPLAY(d)->dpy, ATOM(s)->atom, Get_Window (owner),
|
||||||
|
@ -238,15 +240,15 @@ static Object P_Set_Selection_Owner (d, s, owner, time) Object d, s, owner,
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Selection_Owner (d, s) Object d, s; {
|
static Object P_Selection_Owner (Object d, Object s) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
Check_Type (s, T_Atom);
|
Check_Type (s, T_Atom);
|
||||||
return Make_Window (0, DISPLAY(d)->dpy,
|
return Make_Window (0, DISPLAY(d)->dpy,
|
||||||
XGetSelectionOwner (DISPLAY(d)->dpy, ATOM(s)->atom));
|
XGetSelectionOwner (DISPLAY(d)->dpy, ATOM(s)->atom));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Convert_Selection (s, target, prop, w, time)
|
static Object P_Convert_Selection (Object s, Object target, Object prop,
|
||||||
Object s, target, prop, w, time; {
|
Object w, Object time) {
|
||||||
Atom p = None;
|
Atom p = None;
|
||||||
|
|
||||||
Check_Type (s, T_Atom);
|
Check_Type (s, T_Atom);
|
||||||
|
@ -261,7 +263,7 @@ static Object P_Convert_Selection (s, target, prop, w, time)
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_property () {
|
void elk_init_xlib_property () {
|
||||||
Define_Symbol (&Sym_Now, "now");
|
Define_Symbol (&Sym_Now, "now");
|
||||||
Generic_Define (Atom, "atom", "atom?");
|
Generic_Define (Atom, "atom", "atom?");
|
||||||
Define_Primitive (P_Make_Atom, "make-atom", 1, 1, EVAL);
|
Define_Primitive (P_Make_Atom, "make-atom", 1, 1, EVAL);
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
extern XDrawText(), XDrawText16();
|
extern int XDrawText(), XDrawText16();
|
||||||
static Object Sym_1byte, Sym_2byte;
|
static Object Sym_1byte, Sym_2byte;
|
||||||
|
|
||||||
static Two_Byte (format) Object format; {
|
static int Two_Byte (Object format) {
|
||||||
Check_Type (format, T_Symbol);
|
Check_Type (format, T_Symbol);
|
||||||
if (EQ(format, Sym_1byte))
|
if (EQ(format, Sym_1byte))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -41,17 +41,18 @@ static Two_Byte (format) Object format; {
|
||||||
return 1;
|
return 1;
|
||||||
Primitive_Error ("index format must be '1-byte or '2-byte");
|
Primitive_Error ("index format must be '1-byte or '2-byte");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Get_1_Byte_Char (x) Object x; {
|
static int Get_1_Byte_Char (Object x) {
|
||||||
register c = Get_Integer (x);
|
register int c = Get_Integer (x);
|
||||||
if (c < 0 || c > 255)
|
if (c < 0 || c > 255)
|
||||||
Range_Error (x);
|
Range_Error (x);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Get_2_Byte_Char (x) Object x; {
|
static int Get_2_Byte_Char (Object x) {
|
||||||
register c = Get_Integer (x);
|
register int c = Get_Integer (x);
|
||||||
if (c < 0 || c > 65535)
|
if (c < 0 || c > 65535)
|
||||||
Range_Error (x);
|
Range_Error (x);
|
||||||
return c;
|
return c;
|
||||||
|
@ -63,12 +64,13 @@ static Get_2_Byte_Char (x) Object x; {
|
||||||
* long strings.
|
* long strings.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static Object Internal_Text_Metrics (font, t, f, width) Object font, t, f; {
|
static Object Internal_Text_Metrics (Object font, Object t, Object f,
|
||||||
|
int width) {
|
||||||
char *s;
|
char *s;
|
||||||
XChar2b *s2;
|
XChar2b *s2;
|
||||||
XFontStruct *info;
|
XFontStruct *info;
|
||||||
Object *data;
|
Object *data;
|
||||||
register i, n;
|
register int i, n;
|
||||||
int dir, fasc, fdesc;
|
int dir, fasc, fdesc;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
|
@ -80,7 +82,7 @@ static Object Internal_Text_Metrics (font, t, f, width) Object font, t, f; {
|
||||||
if (Two_Byte (f)) {
|
if (Two_Byte (f)) {
|
||||||
Alloca (s2, XChar2b*, n * sizeof (XChar2b));
|
Alloca (s2, XChar2b*, n * sizeof (XChar2b));
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
register c = Get_2_Byte_Char (data[i]);
|
register int c = Get_2_Byte_Char (data[i]);
|
||||||
s2[i].byte1 = (c >> 8) & 0xff;
|
s2[i].byte1 = (c >> 8) & 0xff;
|
||||||
s2[i].byte2 = c & 0xff;
|
s2[i].byte2 = c & 0xff;
|
||||||
}
|
}
|
||||||
|
@ -102,19 +104,20 @@ static Object Internal_Text_Metrics (font, t, f, width) Object font, t, f; {
|
||||||
Char_Info_Size, Sym_Char_Info, FONT(font)->dpy, ~0L);
|
Char_Info_Size, Sym_Char_Info, FONT(font)->dpy, ~0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Text_Width (font, t, f) Object font, t, f; {
|
static Object P_Text_Width (Object font, Object t, Object f) {
|
||||||
return Internal_Text_Metrics (font, t, f, 1);
|
return Internal_Text_Metrics (font, t, f, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Text_Extents (font, t, f) Object font, t, f; {
|
static Object P_Text_Extents (Object font, Object t, Object f) {
|
||||||
return Internal_Text_Metrics (font, t, f, 0);
|
return Internal_Text_Metrics (font, t, f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Image_Text (d, gc, x, y, t, f) Object d, gc, x, y, t, f; {
|
static Object P_Draw_Image_Text (Object d, Object gc, Object x, Object y,
|
||||||
|
Object t, Object f) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
Object *data;
|
Object *data;
|
||||||
register i, n;
|
register int i, n;
|
||||||
char *s;
|
char *s;
|
||||||
XChar2b *s2;
|
XChar2b *s2;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
@ -126,7 +129,7 @@ static Object P_Draw_Image_Text (d, gc, x, y, t, f) Object d, gc, x, y, t, f; {
|
||||||
if (Two_Byte (f)) {
|
if (Two_Byte (f)) {
|
||||||
Alloca (s2, XChar2b*, n * sizeof (XChar2b));
|
Alloca (s2, XChar2b*, n * sizeof (XChar2b));
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
register c = Get_2_Byte_Char (data[i]);
|
register int c = Get_2_Byte_Char (data[i]);
|
||||||
s2[i].byte1 = (c >> 8) & 0xff;
|
s2[i].byte1 = (c >> 8) & 0xff;
|
||||||
s2[i].byte2 = c & 0xff;
|
s2[i].byte2 = c & 0xff;
|
||||||
}
|
}
|
||||||
|
@ -143,11 +146,12 @@ static Object P_Draw_Image_Text (d, gc, x, y, t, f) Object d, gc, x, y, t, f; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Draw_Poly_Text (d, gc, x, y, t, f) Object d, gc, x, y, t, f; {
|
static Object P_Draw_Poly_Text (Object d, Object gc, Object x, Object y,
|
||||||
|
Object t, Object f) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
Object *data;
|
Object *data;
|
||||||
register i, n, j, k;
|
register int i, n, j, k;
|
||||||
int twobyte, nitems;
|
int twobyte, nitems;
|
||||||
XTextItem *items;
|
XTextItem *items;
|
||||||
int (*func)();
|
int (*func)();
|
||||||
|
@ -173,7 +177,7 @@ static Object P_Draw_Poly_Text (d, gc, x, y, t, f) Object d, gc, x, y, t, f; {
|
||||||
Alloca (p, XChar2b*, (i-k) * sizeof (XChar2b));
|
Alloca (p, XChar2b*, (i-k) * sizeof (XChar2b));
|
||||||
((XTextItem16 *)items)[j].chars = p;
|
((XTextItem16 *)items)[j].chars = p;
|
||||||
for ( ; k < i; k++, p++) {
|
for ( ; k < i; k++, p++) {
|
||||||
register c = Get_2_Byte_Char (data[k]);
|
register int c = Get_2_Byte_Char (data[k]);
|
||||||
p->byte1 = (c >> 8) & 0xff;
|
p->byte1 = (c >> 8) & 0xff;
|
||||||
p->byte2 = c & 0xff;
|
p->byte2 = c & 0xff;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +204,7 @@ static Object P_Draw_Poly_Text (d, gc, x, y, t, f) Object d, gc, x, y, t, f; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_text () {
|
void elk_init_xlib_text () {
|
||||||
Define_Primitive (P_Text_Width, "text-width", 3, 3, EVAL);
|
Define_Primitive (P_Text_Width, "text-width", 3, 3, EVAL);
|
||||||
Define_Primitive (P_Text_Extents, "xlib-text-extents", 3, 3, EVAL);
|
Define_Primitive (P_Text_Extents, "xlib-text-extents", 3, 3, EVAL);
|
||||||
Define_Primitive (P_Draw_Image_Text, "draw-image-text", 6, 6, EVAL);
|
Define_Primitive (P_Draw_Image_Text, "draw-image-text", 6, 6, EVAL);
|
||||||
|
|
|
@ -299,8 +299,8 @@ RECORD Size_Hints_Rec[] = {
|
||||||
};
|
};
|
||||||
int Size_Hints_Size = sizeof Size_Hints_Rec / sizeof (RECORD);
|
int Size_Hints_Size = sizeof Size_Hints_Rec / sizeof (RECORD);
|
||||||
|
|
||||||
unsigned long Vector_To_Record (v, len, sym, rp) Object v, sym;
|
unsigned long Vector_To_Record (Object v, int len, Object sym,
|
||||||
register RECORD *rp; {
|
register RECORD *rp) {
|
||||||
register Object *p;
|
register Object *p;
|
||||||
unsigned long mask = 0;
|
unsigned long mask = 0;
|
||||||
|
|
||||||
|
@ -365,9 +365,9 @@ unsigned long Vector_To_Record (v, len, sym, rp) Object v, sym;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object Record_To_Vector (rp, len, sym, dpy, flags) Object sym;
|
Object Record_To_Vector (register RECORD *rp, int len, Object sym,
|
||||||
register RECORD *rp; Display *dpy; unsigned long flags; {
|
Display *dpy, unsigned long flags) {
|
||||||
register i;
|
register int i;
|
||||||
Object v, x;
|
Object v, x;
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
|
||||||
|
@ -391,13 +391,13 @@ Object Record_To_Vector (rp, len, sym, dpy, flags) Object sym;
|
||||||
case T_PIXEL:
|
case T_PIXEL:
|
||||||
x = Make_Pixel (*(unsigned long *)rp->slot); break;
|
x = Make_Pixel (*(unsigned long *)rp->slot); break;
|
||||||
case T_PIXMAP:
|
case T_PIXMAP:
|
||||||
if (*(unsigned long *)rp->slot == ~0L)
|
if (*(unsigned long *)rp->slot == ~0UL)
|
||||||
x = Sym_None;
|
x = Sym_None;
|
||||||
else
|
else
|
||||||
x = Make_Pixmap_Foreign (dpy, *(Pixmap *)rp->slot);
|
x = Make_Pixmap_Foreign (dpy, *(Pixmap *)rp->slot);
|
||||||
break;
|
break;
|
||||||
case T_FONT:
|
case T_FONT:
|
||||||
if (*(unsigned long *)rp->slot == ~0L)
|
if (*(unsigned long *)rp->slot == ~0UL)
|
||||||
x = Sym_None;
|
x = Sym_None;
|
||||||
else {
|
else {
|
||||||
register XFontStruct *info;
|
register XFontStruct *info;
|
||||||
|
@ -793,10 +793,9 @@ SYMDESCR Error_Syms[] = {
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static Init_Record (rec, size, name, var) RECORD *rec; char *name;
|
static void Init_Record (RECORD *rec, int size, char *name, Object *var) {
|
||||||
Object *var; {
|
|
||||||
Object list, tail, cell;
|
Object list, tail, cell;
|
||||||
register i;
|
register int i;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
|
||||||
|
@ -815,7 +814,7 @@ static Init_Record (rec, size, name, var) RECORD *rec; char *name;
|
||||||
GC_Unlink;
|
GC_Unlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_type () {
|
void elk_init_xlib_type () {
|
||||||
Init_Record (Set_Attr_Rec, Set_Attr_Size, "set-window-attributes",
|
Init_Record (Set_Attr_Rec, Set_Attr_Size, "set-window-attributes",
|
||||||
&Set_Attr_Slots);
|
&Set_Attr_Slots);
|
||||||
Init_Record (Conf_Rec, Conf_Size, "window-configuration", &Conf_Slots);
|
Init_Record (Conf_Rec, Conf_Size, "window-configuration", &Conf_Slots);
|
||||||
|
|
|
@ -30,17 +30,20 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
static Object P_Get_Default (d, program, option) Object d, program, option; {
|
#include <string.h>
|
||||||
|
|
||||||
|
static Object P_Get_Default (Object d, Object program, Object option) {
|
||||||
register char *ret;
|
register char *ret;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
if (ret = XGetDefault (DISPLAY(d)->dpy, Get_Strsym (program),
|
ret = XGetDefault (DISPLAY(d)->dpy, Get_Strsym (program),
|
||||||
Get_Strsym (option)))
|
Get_Strsym (option));
|
||||||
|
if (ret)
|
||||||
return Make_String (ret, strlen (ret));
|
return Make_String (ret, strlen (ret));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Resource_Manager_String (d) Object d; {
|
static Object P_Resource_Manager_String (Object d) {
|
||||||
register char *ret;
|
register char *ret;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -48,9 +51,9 @@ static Object P_Resource_Manager_String (d) Object d; {
|
||||||
return ret ? Make_String (ret, strlen (ret)) : False;
|
return ret ? Make_String (ret, strlen (ret)) : False;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Parse_Geometry (string) Object string; {
|
static Object P_Parse_Geometry (Object string) {
|
||||||
Object ret, t;
|
Object ret, t;
|
||||||
register mask;
|
register int mask;
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned w, h;
|
unsigned w, h;
|
||||||
|
|
||||||
|
@ -65,7 +68,7 @@ static Object P_Parse_Geometry (string) Object string; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Parse_Color (d, cmap, spec) Object d, cmap, spec; {
|
static Object P_Parse_Color (Object d, Object cmap, Object spec) {
|
||||||
XColor ret;
|
XColor ret;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -75,7 +78,7 @@ static Object P_Parse_Color (d, cmap, spec) Object d, cmap, spec; {
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_util () {
|
void elk_init_xlib_util () {
|
||||||
Define_Primitive (P_Get_Default, "get-default", 3, 3, EVAL);
|
Define_Primitive (P_Get_Default, "get-default", 3, 3, EVAL);
|
||||||
Define_Primitive (P_Resource_Manager_String,
|
Define_Primitive (P_Resource_Manager_String,
|
||||||
"resource-manager-string", 1, 1, EVAL);
|
"resource-manager-string", 1, 1, EVAL);
|
||||||
|
|
|
@ -41,7 +41,7 @@ Generic_Print (Window, "#[window %lu]", WINDOW(x)->win)
|
||||||
|
|
||||||
Generic_Get_Display (Window, WINDOW)
|
Generic_Get_Display (Window, WINDOW)
|
||||||
|
|
||||||
Object Make_Window (finalize, dpy, win) Display *dpy; Window win; {
|
Object Make_Window (int finalize, Display *dpy, Window win) {
|
||||||
Object w;
|
Object w;
|
||||||
|
|
||||||
if (win == None)
|
if (win == None)
|
||||||
|
@ -62,14 +62,14 @@ Object Make_Window (finalize, dpy, win) Display *dpy; Window win; {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window Get_Window (w) Object w; {
|
Window Get_Window (Object w) {
|
||||||
if (EQ(w, Sym_None))
|
if (EQ(w, Sym_None))
|
||||||
return None;
|
return None;
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
return WINDOW(w)->win;
|
return WINDOW(w)->win;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawable Get_Drawable (d, dpyp) Object d; Display **dpyp; {
|
Drawable Get_Drawable (Object d, Display **dpyp) {
|
||||||
if (TYPE(d) == T_Window) {
|
if (TYPE(d) == T_Window) {
|
||||||
*dpyp = WINDOW(d)->dpy;
|
*dpyp = WINDOW(d)->dpy;
|
||||||
return (Drawable)WINDOW(d)->win;
|
return (Drawable)WINDOW(d)->win;
|
||||||
|
@ -81,8 +81,9 @@ Drawable Get_Drawable (d, dpyp) Object d; Display **dpyp; {
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Create_Window (parent, x, y, width, height, border_width, attr)
|
static Object P_Create_Window (Object parent, Object x, Object y, Object width,
|
||||||
Object parent, x, y, width, height, border_width, attr; {
|
Object height, Object border_width,
|
||||||
|
Object attr) {
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
Window win;
|
Window win;
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ static Object P_Create_Window (parent, x, y, width, height, border_width, attr)
|
||||||
return Make_Window (1, WINDOW(parent)->dpy, win);
|
return Make_Window (1, WINDOW(parent)->dpy, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Configure_Window (w, conf) Object w, conf; {
|
static Object P_Configure_Window (Object w, Object conf) {
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
|
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
|
@ -105,7 +106,7 @@ static Object P_Configure_Window (w, conf) Object w, conf; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Change_Window_Attributes (w, attr) Object w, attr; {
|
static Object P_Change_Window_Attributes (Object w, Object attr) {
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
|
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
|
@ -114,14 +115,14 @@ static Object P_Change_Window_Attributes (w, attr) Object w, attr; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Get_Window_Attributes (w) Object w; {
|
static Object P_Get_Window_Attributes (Object w) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
XGetWindowAttributes (WINDOW(w)->dpy, WINDOW(w)->win, &WA);
|
XGetWindowAttributes (WINDOW(w)->dpy, WINDOW(w)->win, &WA);
|
||||||
return Record_To_Vector (Win_Attr_Rec, Win_Attr_Size, Sym_Get_Attr,
|
return Record_To_Vector (Win_Attr_Rec, Win_Attr_Size, Sym_Get_Attr,
|
||||||
WINDOW(w)->dpy, ~0L);
|
WINDOW(w)->dpy, ~0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Get_Geometry (d) Object d; {
|
static Object P_Get_Geometry (Object d) {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Drawable dr = Get_Drawable (d, &dpy);
|
Drawable dr = Get_Drawable (d, &dpy);
|
||||||
|
|
||||||
|
@ -133,19 +134,19 @@ static Object P_Get_Geometry (d) Object d; {
|
||||||
return Record_To_Vector (Geometry_Rec, Geometry_Size, Sym_Geo, dpy, ~0L);
|
return Record_To_Vector (Geometry_Rec, Geometry_Size, Sym_Geo, dpy, ~0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Map_Window (w) Object w; {
|
static Object P_Map_Window (Object w) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
XMapWindow (WINDOW(w)->dpy, WINDOW(w)->win);
|
XMapWindow (WINDOW(w)->dpy, WINDOW(w)->win);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Unmap_Window (w) Object w; {
|
static Object P_Unmap_Window (Object w) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
XUnmapWindow (WINDOW(w)->dpy, WINDOW(w)->win);
|
XUnmapWindow (WINDOW(w)->dpy, WINDOW(w)->win);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object P_Destroy_Window (w) Object w; {
|
Object P_Destroy_Window (Object w) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
if (!WINDOW(w)->free)
|
if (!WINDOW(w)->free)
|
||||||
XDestroyWindow (WINDOW(w)->dpy, WINDOW(w)->win);
|
XDestroyWindow (WINDOW(w)->dpy, WINDOW(w)->win);
|
||||||
|
@ -154,36 +155,35 @@ Object P_Destroy_Window (w) Object w; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Destroy_Subwindows (w) Object w; {
|
static Object P_Destroy_Subwindows (Object w) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
XDestroySubwindows (WINDOW(w)->dpy, WINDOW(w)->win);
|
XDestroySubwindows (WINDOW(w)->dpy, WINDOW(w)->win);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Map_Subwindows (w) Object w; {
|
static Object P_Map_Subwindows (Object w) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
XMapSubwindows (WINDOW(w)->dpy, WINDOW(w)->win);
|
XMapSubwindows (WINDOW(w)->dpy, WINDOW(w)->win);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Unmap_Subwindows (w) Object w; {
|
static Object P_Unmap_Subwindows (Object w) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
XUnmapSubwindows (WINDOW(w)->dpy, WINDOW(w)->win);
|
XUnmapSubwindows (WINDOW(w)->dpy, WINDOW(w)->win);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Circulate_Subwindows (w, dir) Object w, dir; {
|
static Object P_Circulate_Subwindows (Object w, Object dir) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
XCirculateSubwindows (WINDOW(w)->dpy, WINDOW(w)->win,
|
XCirculateSubwindows (WINDOW(w)->dpy, WINDOW(w)->win,
|
||||||
Symbols_To_Bits (dir, 0, Circulate_Syms));
|
Symbols_To_Bits (dir, 0, Circulate_Syms));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Query_Tree (w) Object w; {
|
static Object P_Query_Tree (Object w) {
|
||||||
Window root, parent, *children;
|
Window root, parent, *children;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
int i;
|
unsigned int i, n;
|
||||||
unsigned n;
|
|
||||||
Object v, ret;
|
Object v, ret;
|
||||||
GC_Node2;
|
GC_Node2;
|
||||||
|
|
||||||
|
@ -210,7 +210,8 @@ static Object P_Query_Tree (w) Object w; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Translate_Coordinates (src, x, y, dst) Object src, x, y, dst; {
|
static Object P_Translate_Coordinates (Object src, Object x, Object y,
|
||||||
|
Object dst) {
|
||||||
int rx, ry;
|
int rx, ry;
|
||||||
Window child;
|
Window child;
|
||||||
Object l, t, z;
|
Object l, t, z;
|
||||||
|
@ -232,7 +233,7 @@ static Object P_Translate_Coordinates (src, x, y, dst) Object src, x, y, dst; {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Query_Pointer (win) Object win; {
|
static Object P_Query_Pointer (Object win) {
|
||||||
Object l, t, z;
|
Object l, t, z;
|
||||||
Bool ret;
|
Bool ret;
|
||||||
Window root, child;
|
Window root, child;
|
||||||
|
@ -260,7 +261,7 @@ static Object P_Query_Pointer (win) Object win; {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_window () {
|
void elk_init_xlib_window () {
|
||||||
Define_Symbol (&Sym_Set_Attr, "set-window-attributes");
|
Define_Symbol (&Sym_Set_Attr, "set-window-attributes");
|
||||||
Define_Symbol (&Sym_Get_Attr, "get-window-attributes");
|
Define_Symbol (&Sym_Get_Attr, "get-window-attributes");
|
||||||
Define_Symbol (&Sym_Conf, "window-configuration");
|
Define_Symbol (&Sym_Conf, "window-configuration");
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
static Object Sym_Pointer_Root;
|
static Object Sym_Pointer_Root;
|
||||||
|
|
||||||
static Object P_Reparent_Window (w, parent, x, y) Object w, parent, x, y; {
|
static Object P_Reparent_Window (Object w, Object parent, Object x,
|
||||||
|
Object y) {
|
||||||
Check_Type (w, T_Window);
|
Check_Type (w, T_Window);
|
||||||
Check_Type (parent, T_Window);
|
Check_Type (parent, T_Window);
|
||||||
XReparentWindow (WINDOW(w)->dpy, WINDOW(w)->win, WINDOW(parent)->win,
|
XReparentWindow (WINDOW(w)->dpy, WINDOW(w)->win, WINDOW(parent)->win,
|
||||||
|
@ -40,19 +41,19 @@ static Object P_Reparent_Window (w, parent, x, y) Object w, parent, x, y; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Install_Colormap (c) Object c; {
|
static Object P_Install_Colormap (Object c) {
|
||||||
Check_Type (c, T_Colormap);
|
Check_Type (c, T_Colormap);
|
||||||
XInstallColormap (COLORMAP(c)->dpy, COLORMAP(c)->cm);
|
XInstallColormap (COLORMAP(c)->dpy, COLORMAP(c)->cm);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Uninstall_Colormap (c) Object c; {
|
static Object P_Uninstall_Colormap (Object c) {
|
||||||
Check_Type (c, T_Colormap);
|
Check_Type (c, T_Colormap);
|
||||||
XUninstallColormap (COLORMAP(c)->dpy, COLORMAP(c)->cm);
|
XUninstallColormap (COLORMAP(c)->dpy, COLORMAP(c)->cm);
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_List_Installed_Colormaps (w) Object w; {
|
static Object P_List_Installed_Colormaps (Object w) {
|
||||||
int i, n;
|
int i, n;
|
||||||
Colormap *ret;
|
Colormap *ret;
|
||||||
Object v;
|
Object v;
|
||||||
|
@ -73,8 +74,8 @@ static Object P_List_Installed_Colormaps (w) Object w; {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Input_Focus (d, win, revert_to, time) Object d, win,
|
static Object P_Set_Input_Focus (Object d, Object win, Object revert_to,
|
||||||
revert_to, time; {
|
Object time) {
|
||||||
Window focus = PointerRoot;
|
Window focus = PointerRoot;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -85,7 +86,7 @@ static Object P_Set_Input_Focus (d, win, revert_to, time) Object d, win,
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Input_Focus (d) Object d; {
|
static Object P_Input_Focus (Object d) {
|
||||||
Window win;
|
Window win;
|
||||||
int revert_to;
|
int revert_to;
|
||||||
Object ret, x;
|
Object ret, x;
|
||||||
|
@ -103,8 +104,9 @@ static Object P_Input_Focus (d) Object d; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_General_Warp_Pointer (dpy, dst, dstx, dsty, src, srcx, srcy,
|
static Object P_General_Warp_Pointer (Object dpy, Object dst, Object dstx,
|
||||||
srcw, srch) Object dpy, dst, dstx, dsty, src, srcx, srcy, srcw, srch; {
|
Object dsty, Object src, Object srcx,
|
||||||
|
Object srcy, Object srcw, Object srch) {
|
||||||
Check_Type (dpy, T_Display);
|
Check_Type (dpy, T_Display);
|
||||||
XWarpPointer (DISPLAY(dpy)->dpy, Get_Window (src), Get_Window (dst),
|
XWarpPointer (DISPLAY(dpy)->dpy, Get_Window (src), Get_Window (dst),
|
||||||
Get_Integer (srcx), Get_Integer (srcy), Get_Integer (srcw),
|
Get_Integer (srcx), Get_Integer (srcy), Get_Integer (srcw),
|
||||||
|
@ -112,8 +114,8 @@ static Object P_General_Warp_Pointer (dpy, dst, dstx, dsty, src, srcx, srcy,
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Bell (argc, argv) Object *argv; {
|
static Object P_Bell (int argc, Object *argv) {
|
||||||
register percent = 0;
|
register int percent = 0;
|
||||||
|
|
||||||
Check_Type (argv[0], T_Display);
|
Check_Type (argv[0], T_Display);
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
|
@ -125,30 +127,30 @@ static Object P_Bell (argc, argv) Object *argv; {
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Access_Control (dpy, on) Object dpy, on; {
|
static Object P_Set_Access_Control (Object dpy, Object on) {
|
||||||
Check_Type (dpy, T_Display);
|
Check_Type (dpy, T_Display);
|
||||||
Check_Type (on, T_Boolean);
|
Check_Type (on, T_Boolean);
|
||||||
XSetAccessControl (DISPLAY(dpy)->dpy, EQ(on, True));
|
XSetAccessControl (DISPLAY(dpy)->dpy, EQ(on, True));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Change_Save_Set (win, mode) Object win, mode; {
|
static Object P_Change_Save_Set (Object win, Object mode) {
|
||||||
Check_Type (win, T_Window);
|
Check_Type (win, T_Window);
|
||||||
XChangeSaveSet (WINDOW(win)->dpy, WINDOW(win)->win,
|
XChangeSaveSet (WINDOW(win)->dpy, WINDOW(win)->win,
|
||||||
Symbols_To_Bits (mode, 0, Saveset_Syms));
|
Symbols_To_Bits (mode, 0, Saveset_Syms));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Close_Down_Mode (dpy, mode) Object dpy, mode; {
|
static Object P_Set_Close_Down_Mode (Object dpy, Object mode) {
|
||||||
Check_Type (dpy, T_Display);
|
Check_Type (dpy, T_Display);
|
||||||
XSetCloseDownMode (DISPLAY(dpy)->dpy,
|
XSetCloseDownMode (DISPLAY(dpy)->dpy,
|
||||||
Symbols_To_Bits (mode, 0, Closemode_Syms));
|
Symbols_To_Bits (mode, 0, Closemode_Syms));
|
||||||
return Void;
|
return Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Get_Pointer_Mapping (dpy) Object dpy; {
|
static Object P_Get_Pointer_Mapping (Object dpy) {
|
||||||
unsigned char map[256];
|
unsigned char map[256];
|
||||||
register i, n;
|
register int i, n;
|
||||||
Object ret;
|
Object ret;
|
||||||
|
|
||||||
Check_Type (dpy, T_Display);
|
Check_Type (dpy, T_Display);
|
||||||
|
@ -159,8 +161,8 @@ static Object P_Get_Pointer_Mapping (dpy) Object dpy; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_Pointer_Mapping (dpy, map) Object dpy, map; {
|
static Object P_Set_Pointer_Mapping (Object dpy, Object map) {
|
||||||
register i, n;
|
register int i, n;
|
||||||
register unsigned char *p;
|
register unsigned char *p;
|
||||||
Object ret;
|
Object ret;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
@ -177,7 +179,7 @@ static Object P_Set_Pointer_Mapping (dpy, map) Object dpy, map; {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_wm () {
|
void elk_init_xlib_wm () {
|
||||||
Define_Primitive (P_Reparent_Window, "reparent-window", 4, 4, EVAL);
|
Define_Primitive (P_Reparent_Window, "reparent-window", 4, 4, EVAL);
|
||||||
Define_Primitive (P_Install_Colormap, "install-colormap", 1, 1, EVAL);
|
Define_Primitive (P_Install_Colormap, "install-colormap", 1, 1, EVAL);
|
||||||
Define_Primitive (P_Uninstall_Colormap,
|
Define_Primitive (P_Uninstall_Colormap,
|
||||||
|
|
|
@ -30,13 +30,15 @@
|
||||||
|
|
||||||
#include "xlib.h"
|
#include "xlib.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
static Object V_X_Error_Handler, V_X_Fatal_Error_Handler;
|
static Object V_X_Error_Handler, V_X_Fatal_Error_Handler;
|
||||||
|
|
||||||
/* Default error handlers of the Xlib */
|
/* Default error handlers of the Xlib */
|
||||||
extern int _XDefaultIOError();
|
extern int _XDefaultIOError();
|
||||||
extern int _XDefaultError();
|
extern int _XDefaultError();
|
||||||
|
|
||||||
static X_Fatal_Error (d) Display *d; {
|
static int X_Fatal_Error (Display *d) {
|
||||||
Object args, fun;
|
Object args, fun;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
|
||||||
|
@ -51,9 +53,10 @@ static X_Fatal_Error (d) Display *d; {
|
||||||
_XDefaultIOError (d);
|
_XDefaultIOError (d);
|
||||||
exit (1); /* In case the default handler doesn't exit() */
|
exit (1); /* In case the default handler doesn't exit() */
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static X_Error (d, ep) Display *d; XErrorEvent *ep; {
|
static int X_Error (Display *d, XErrorEvent *ep) {
|
||||||
Object args, a, fun;
|
Object args, a, fun;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
|
||||||
|
@ -79,9 +82,10 @@ static X_Error (d, ep) Display *d; XErrorEvent *ep; {
|
||||||
(void)Funcall (fun, args, 0);
|
(void)Funcall (fun, args, 0);
|
||||||
else
|
else
|
||||||
_XDefaultError (d, ep);
|
_XDefaultError (d, ep);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static X_After_Function (d) Display *d; {
|
static int X_After_Function (Display *d) {
|
||||||
Object args;
|
Object args;
|
||||||
GC_Node;
|
GC_Node;
|
||||||
|
|
||||||
|
@ -90,9 +94,10 @@ static X_After_Function (d) Display *d; {
|
||||||
args = Cons (args, Null);
|
args = Cons (args, Null);
|
||||||
GC_Unlink;
|
GC_Unlink;
|
||||||
(void)Funcall (DISPLAY(Car (args))->after, args, 0);
|
(void)Funcall (DISPLAY(Car (args))->after, args, 0);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_Set_After_Function (d, f) Object d, f; {
|
static Object P_Set_After_Function (Object d, Object f) {
|
||||||
Object old;
|
Object old;
|
||||||
|
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
|
@ -107,12 +112,12 @@ static Object P_Set_After_Function (d, f) Object d, f; {
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object P_After_Function (d) Object d; {
|
static Object P_After_Function (Object d) {
|
||||||
Check_Type (d, T_Display);
|
Check_Type (d, T_Display);
|
||||||
return DISPLAY(d)->after;
|
return DISPLAY(d)->after;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_error () {
|
void elk_init_xlib_error () {
|
||||||
Define_Variable (&V_X_Fatal_Error_Handler, "x-fatal-error-handler", Null);
|
Define_Variable (&V_X_Fatal_Error_Handler, "x-fatal-error-handler", Null);
|
||||||
Define_Variable (&V_X_Error_Handler, "x-error-handler", Null);
|
Define_Variable (&V_X_Error_Handler, "x-error-handler", Null);
|
||||||
(void)XSetIOErrorHandler (X_Fatal_Error);
|
(void)XSetIOErrorHandler (X_Fatal_Error);
|
||||||
|
|
|
@ -50,7 +50,7 @@ static Object P_Xlib_Release_6_Or_Laterp () {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_init () {
|
void elk_init_xlib_init () {
|
||||||
Define_Primitive (P_Xlib_Release_4_Or_Laterp,
|
Define_Primitive (P_Xlib_Release_4_Or_Laterp,
|
||||||
"xlib-release-4-or-later?", 0, 0, EVAL);
|
"xlib-release-4-or-later?", 0, 0, EVAL);
|
||||||
Define_Primitive (P_Xlib_Release_5_Or_Laterp,
|
Define_Primitive (P_Xlib_Release_5_Or_Laterp,
|
||||||
|
|
|
@ -242,54 +242,54 @@ extern Object Sym_None, Sym_Now, Sym_Char_Info, Sym_Conf;
|
||||||
*
|
*
|
||||||
* int T_Pixmap;
|
* int T_Pixmap;
|
||||||
*
|
*
|
||||||
* static Object P_Pixmapp (x) Object x; {
|
* static Object P_Pixmapp (Object x) {
|
||||||
* return TYPE(x) == T_Pixmap ? True : False;
|
* return TYPE(x) == T_Pixmap ? True : False;
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
#define Generic_Predicate(type) int conc(T_,type);\
|
#define Generic_Predicate(type) int conc(T_,type);\
|
||||||
\
|
\
|
||||||
static Object conc3(P_,type,p) (x) Object x; {\
|
static Object conc3(P_,type,p) (Object x) {\
|
||||||
return TYPE(x) == conc(T_,type) ? True : False;\
|
return TYPE(x) == conc(T_,type) ? True : False;\
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic_Equal (Pixmap, PIXMAP, pm) generates:
|
/* Generic_Equal (Pixmap, PIXMAP, pm) generates:
|
||||||
*
|
*
|
||||||
* static Pixmap_Equal (x, y) Object x, y; {
|
* static Pixmap_Equal (Object x, Object y) {
|
||||||
* return PIXMAP(x)->pm == PIXMAP(y)->field
|
* return PIXMAP(x)->pm == PIXMAP(y)->field
|
||||||
* && !PIXMAP(x)->free && !PIXMAP(y)->free;
|
* && !PIXMAP(x)->free && !PIXMAP(y)->free;
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
#define Generic_Equal(type,cast,field) static conc(type,_Equal) (x, y)\
|
#define Generic_Equal(type,cast,field) static int conc(type,_Equal)\
|
||||||
Object x, y; {\
|
(Object x, Object y) {\
|
||||||
return cast(x)->field == cast(y)->field\
|
return cast(x)->field == cast(y)->field\
|
||||||
&& !cast(x)->free && !cast(y)->free;\
|
&& !cast(x)->free && !cast(y)->free;\
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same as above, but doesn't check for ->free:
|
/* Same as above, but doesn't check for ->free:
|
||||||
*/
|
*/
|
||||||
#define Generic_Simple_Equal(type,cast,field) static conc(type,_Equal) (x, y)\
|
#define Generic_Simple_Equal(type,cast,field) static int conc(type,_Equal)\
|
||||||
Object x, y; {\
|
(Object x, Object y) {\
|
||||||
return cast(x)->field == cast(y)->field;\
|
return cast(x)->field == cast(y)->field;\
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same as above, but also checks ->dpy
|
/* Same as above, but also checks ->dpy
|
||||||
*/
|
*/
|
||||||
#define Generic_Equal_Dpy(type,cast,field) static conc(type,_Equal)\
|
#define Generic_Equal_Dpy(type,cast,field) static int conc(type,_Equal)\
|
||||||
(x, y)\
|
(Object x, Object y) {\
|
||||||
Object x, y; {\
|
|
||||||
return cast(x)->field == cast(y)->field && cast(x)->dpy == cast(y)->dpy\
|
return cast(x)->field == cast(y)->field && cast(x)->dpy == cast(y)->dpy\
|
||||||
&& !cast(x)->free && !cast(y)->free;\
|
&& !cast(x)->free && !cast(y)->free;\
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic_Print (Pixmap, "#[pixmap %u]", PIXMAP(x)->pm) generates:
|
/* Generic_Print (Pixmap, "#[pixmap %u]", PIXMAP(x)->pm) generates:
|
||||||
*
|
*
|
||||||
* static Pixmap_Print (x, port, raw, depth, len) Object x, port; {
|
* static Pixmap_Print (Object x, Object port, int raw, int depth, int len) {
|
||||||
* Printf (port, "#[pixmap %u]", PIXMAP(x)->pm);
|
* Printf (port, "#[pixmap %u]", PIXMAP(x)->pm);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
#define Generic_Print(type,fmt,how) static conc(type,_Print)\
|
#define Generic_Print(type,fmt,how) static int conc(type,_Print)\
|
||||||
(x, port, raw, depth, len) Object x, port; {\
|
(Object x, Object port, int raw, int depth, int len) {\
|
||||||
Printf (port, fmt, (unsigned)how);\
|
Printf (port, fmt, (unsigned)how);\
|
||||||
|
return 0;\
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic_Define (Pixmap, "pixmap", "pixmap?") generates:
|
/* Generic_Define (Pixmap, "pixmap", "pixmap?") generates:
|
||||||
|
@ -305,13 +305,13 @@ static Object conc3(P_,type,p) (x) Object x; {\
|
||||||
|
|
||||||
/* Generic_Get_Display (Pixmap, PIXMAP) generates:
|
/* Generic_Get_Display (Pixmap, PIXMAP) generates:
|
||||||
*
|
*
|
||||||
* static Object P_Pixmap_Display (x) Object x; {
|
* static Object P_Pixmap_Display (Object x) {
|
||||||
* Check_Type (x, T_Pixmap);
|
* Check_Type (x, T_Pixmap);
|
||||||
* return Make_Display (PIXMAP(x)->dpy);
|
* return Make_Display (PIXMAP(x)->dpy);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
#define Generic_Get_Display(type,cast) static Object conc3(P_,type,_Display)\
|
#define Generic_Get_Display(type,cast) static Object conc3(P_,type,_Display)\
|
||||||
(x) Object x; {\
|
(Object x) {\
|
||||||
Check_Type (x, conc(T_,type));\
|
Check_Type (x, conc(T_,type));\
|
||||||
return Make_Display (0, cast(x)->dpy);\
|
return Make_Display (0, cast(x)->dpy);\
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
|
|
||||||
Object Sym_None;
|
Object Sym_None;
|
||||||
|
|
||||||
int Match_X_Obj (x, v) Object x; va_list v; {
|
int Match_X_Obj (Object x, va_list v) {
|
||||||
register type = TYPE(x);
|
register int type = TYPE(x);
|
||||||
|
|
||||||
if (type == T_Display) {
|
if (type == T_Display) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -63,6 +63,6 @@ int Match_X_Obj (x, v) Object x; va_list v; {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
elk_init_xlib_objects () {
|
void elk_init_xlib_objects () {
|
||||||
Define_Symbol (&Sym_None, "none");
|
Define_Symbol (&Sym_None, "none");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue