[SOLUTION] Hide mouse pointer via Xtst lib

Aivils Stoss aivils at latnet.lv
Wed Sep 13 03:26:28 PDT 2006


Hi, All!

	This program moves the pointer of mouse to right bottom
corner of screen. Pointer show from now 1x1 or 2x2 pixels on the screen.
End-user cannot see pointer on kiosk, where mouse is not
available for normal usage.

	Please drop note to me if exists "official" solution how to hide pointer
over precompiled X application.

Aivils
Source:
/* movepointer.c ************************************************/
/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive for
 * more details.
 * 
 */

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>

Display *dpy;
int scr;
Window win;
unsigned int width, height;

int main(int argc, char **argv)
{
    Window ret_win;
    int x, y;
    unsigned int border_width, depth;

    dpy = XOpenDisplay(NULL);
    if (!dpy)
	return 1;
    scr = DefaultScreen(dpy);
    win = RootWindow(dpy, scr);
    XGetGeometry(dpy, win, &ret_win, &x, &y, &width, &height,
		 &border_width, &depth);
    XTestFakeMotionEvent(dpy, scr, width, height, 0);
    XSync(dpy, 1);
    XCloseDisplay(dpy);
    return 0;
}

Makefile:
CC = gcc
CFLAGS = -Wall -g -O2
SRC = movepointer.c
OBJ = $(SRC:.c=.o)
LIBS = -L/usr/X11R6/lib -lXtst

OUT = movepointer

all: movepointer

movepointer: $(OBJ)
	$(CC) -o $(OUT) $(OBJ) $(LIBS)

install:
	cp  $(OUT) /usr/X11R6/bin

uninstall:
	rm -f /usr/X11R6/bin/$(OUT)

clean:
	rm -f $(OBJ) $(OUT) *~




More information about the xorg mailing list