From MythTV Official Wiki
Jump to: navigation, search


The application will move the mouse cursor to the bottom right of the screen, in effect hiding it. This handy if the mouse is in the middle of the screen in MythVideo.


/* 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);
    return 0;

Makefile (tabs for indents and not spaces)

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)

  cp  $(OUT) /usr/X11R6/bin

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

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