Beispiel #1
0
static int cleararea_cb(lua_State* L)
{
	int x1 = luaL_checkint(L, 1);
	int y1 = luaL_checkint(L, 2);
	int x2 = luaL_checkint(L, 3);
	int y2 = luaL_checkint(L, 4);
	dpy_cleararea(x1, y1, x2, y2);
	return 0;
}
Beispiel #2
0
static int cleararea_cb(lua_State* L)
{
	int x1 = forceinteger(L, 1);
	int y1 = forceinteger(L, 2);
	int x2 = forceinteger(L, 3);
	int y2 = forceinteger(L, 4);
	dpy_cleararea(x1, y1, x2, y2);
	return 0;
}
Beispiel #3
0
void dpy_clearscreen(void)
{
	dpy_cleararea(0, 0, screenwidth-1, screenheight-1);
}
Beispiel #4
0
void dpy_start(void)
{
	display = XOpenDisplay(NULL);
	if (!display)
	{
		fprintf(stderr, "Error: can't open display. Is DISPLAY set?\n");
		exit(1);
	}

	window = XCreateSimpleWindow(display, RootWindow(display, 0),
					  0, 0, 800, 600, 0, 0, BlackPixel(display, 0));
	XStoreName(display, window, "WordGrinder " VERSION);
	XSetClassHint(display, window,
		&((XClassHint) { "WordGrinder", "WordGrinder" }));
	XSelectInput(display, window,
		StructureNotifyMask | ExposureMask | KeyPressMask | KeymapStateMask);
	XMapWindow(display, window);

	glyphcache_init();

	colours[COLOUR_BLACK]  = load_colour("X11_BLACK_COLOUR",  "#000000");
	colours[COLOUR_DIM]    = load_colour("X11_DIM_COLOUR",    "#555555");
	colours[COLOUR_NORMAL] = load_colour("X11_NORMAL_COLOUR", "#888888");
	colours[COLOUR_BRIGHT] = load_colour("X11_BRIGHT_COLOUR", "#ffffff");

	draw = XftDrawCreate(display, window,
		DefaultVisual(display, DefaultScreen(display)),
		DefaultColormap(display, DefaultScreen(display)));

	xim = XOpenIM(display, NULL, NULL, NULL);
	if (xim)
		xic = XCreateIC(xim, XNInputStyle,
			XIMPreeditNothing | XIMStatusNothing, XNClientWindow, window, NULL);
	if (!xim || !xic)
	{
		fprintf(stderr, "Error: couldn't set up input methods\n");
		exit(1);
	}
	XSetICFocus(xic);

	{
		XGCValues gcv =
		{
			.graphics_exposures = false
		};

		gc = XCreateGC(display, window, GCGraphicsExposures, &gcv);
	}

	screenwidth = screenheight = 0;
	cursorx = cursory = 0;
}

void dpy_shutdown(void)
{
}

void dpy_clearscreen(void)
{
	dpy_cleararea(0, 0, screenwidth-1, screenheight-1);
}