Mailinglist Archive: opensuse-kde (174 mails)
| < Previous | Next > |
Re: [opensuse-kde] tool to show mouse position / coordinates
- From: Lubos Lunak <l.lunak@xxxxxxx>
- Date: Tue, 28 Jul 2009 13:47:21 +0200
- Message-id: <200907281347.21075.l.lunak@xxxxxxx>
On Sunday 26 of July 2009, Malte Gell wrote:
What do you mean, show coordinates? If you want to see the position of the
cursor, KWin has a compositing effect that marks the position when you press
Ctrl+Meta, and I think Compiz has something like that too. If you really want
the coordinates, the attached small utility can print it (gcc a.c -lX11 -o
mousepos).
--
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail: l.lunak@xxxxxxx , l.lunak@xxxxxxx
Lihovarska 1060/12 tel: +420 284 084 672
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http://www.suse.cz
#include <X11/Xlib.h>
#include <stdio.h>
int main()
{
Display* dpy = XOpenDisplay( NULL );
if( dpy == NULL )
{
fprintf( stderr, "Cannot connect to X server." );
return 1;
}
Window root, child;
int x, y, wx, wy;
unsigned int mask;
if( !XQueryPointer( dpy, DefaultRootWindow( dpy ), &root, &child, &x, &y,
&wx, &wy, &mask ))
{
fprintf( stderr, "Cursor not on the current X screen." );
return 2;
}
printf( "%d %d\n", x, y );
return 0;
}
Hi there,
does anyone know a tool that shows the coordinates of the current mouse
position? I looked at KDE4 and Compiz, but found no such thing, but I'm
sure there is.
What do you mean, show coordinates? If you want to see the position of the
cursor, KWin has a compositing effect that marks the position when you press
Ctrl+Meta, and I think Compiz has something like that too. If you really want
the coordinates, the attached small utility can print it (gcc a.c -lX11 -o
mousepos).
--
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail: l.lunak@xxxxxxx , l.lunak@xxxxxxx
Lihovarska 1060/12 tel: +420 284 084 672
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http://www.suse.cz
#include <X11/Xlib.h>
#include <stdio.h>
int main()
{
Display* dpy = XOpenDisplay( NULL );
if( dpy == NULL )
{
fprintf( stderr, "Cannot connect to X server." );
return 1;
}
Window root, child;
int x, y, wx, wy;
unsigned int mask;
if( !XQueryPointer( dpy, DefaultRootWindow( dpy ), &root, &child, &x, &y,
&wx, &wy, &mask ))
{
fprintf( stderr, "Cursor not on the current X screen." );
return 2;
}
printf( "%d %d\n", x, y );
return 0;
}
| < Previous | Next > |