View Single Post
Old 11-21-2012, 04:03 PM   #241
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by PoP View Post
You got it. My 5 way moves the character cursor too, as expected. I want to also move the mouse pointer.
this thread - obliquely - discusses the issue

http://osdir.com/ml/emulators.qemu/2.../msg00085.html

http://osdir.com/ml/emulators.qemu/2.../msg00093.html

etc..


other thoughts:

http://stackoverflow.com/questions/3...ordinates-in-x


get cursor position
Code:
#include <X11/Xlib.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <malloc.h>

static int _XlibErrorHandler(Display *display, XErrorEvent *event) {
    fprintf(stderr, "An error occured detecting the mouse position\n");
    return True;
}

int main(void) {
    int number_of_screens;
    int i;
    Bool result;
    Window *root_windows;
    Window window_returned;
    int root_x, root_y;
    int win_x, win_y;
    unsigned int mask_return;

    Display *display = XOpenDisplay(NULL);
    assert(display);
    XSetErrorHandler(_XlibErrorHandler);
    number_of_screens = XScreenCount(display);
    fprintf(stderr, "There are %d screens available in this X session\n", number_of_screens);
    root_windows = malloc(sizeof(Window) * number_of_screens);
    for (i = 0; i < number_of_screens; i++) {
        root_windows[i] = XRootWindow(display, i);
    }
    for (i = 0; i < number_of_screens; i++) {
        result = XQueryPointer(display, root_windows[i], &window_returned,
                &window_returned, &root_x, &root_y, &win_x, &win_y,
                &mask_return);
        if (result == True) {
            break;
        }
    }
    if (result != True) {
        fprintf(stderr, "No mouse found.\n");
        return -1;
    }
    printf("Mouse is at (%d,%d)\n", root_x, root_y);

    free(root_windows);
    return 0;
}

So... XQueryPointer(display, root_windows[0], &window_returned,
&window_returned, &root_x, &root_y, &win_x, &win_y,
&mask_return);


perhaps that could be "massaged"

Setting x y
Quote:
..., a flexible X-automation tool is xte, part of the xautomation package. Use xte -h to see a list of the X events it supports. This example goes to a point 320 pixels from the left edge of the screen and 50 pixels down and then fakes a click there with button 1:


xte 'mousemove 320 50' 'mousedown 1'
'mouseup 1'

The mousedown and mouseup events are separate, so you can drag as well as click.
also http://www.slack.com/sw/xwit-man.html

and http://tronche.com/gui/x/xlib/input/XWarpPointer.html

xdotool may also be useful (This I have)

HTH. no answers, but thoughts in a direction

Last edited by twobob; 11-21-2012 at 04:20 PM.
twobob is offline   Reply With Quote