ΕΕΛ/ΛΑΚ - Λίστες Ταχυδρομείου

RSI software

Opws merikoi kserete, edw kai dyo bdomades talaipwroymai me RSI.

Diabazontas gia ayto, synanthsa thn ennoia toy "click-less mouse use",
dhladh na mh xreiazetai na kaneis click kathe ligo kai ligaki.
To dokimasa kai enthoysiasthka!  Poly boliko!

Opote shmera poy antexa na plhktrologhsw ligo,
ekatsa ki egrapsa ena aplo programma gia X11
poy kanei aytomata click otan to pontiki menei
akinhto gia ligo (.5 sec).  H logikh einai oti
*synhthws* koynas to pontiki gia na to pas kapoy
kai na kaneis click -- e, ayto to click sto glytwnei.
Den einai gia panta, alla moy einai xrhsimo
gia megalo meros ths meras moy...

Attached the source code.  Just compile & run.
Fancy stuff, like GUI or command-like options
for specifying granularity, etc. will have to wait
a later version, when I can type better.
Try it and you'll be amazed!

Paraklhsh: an kapoios kserei apo programmatismo Windows,
tha ektimoysa ta megista ena antistoixo programma --
pros to paron boleyomai me to demo toy Nib:
	http://www.aerobicmouse.com/software-overview/nib/

Prosexete thn ygeia sas!
-- 
-- zvr --
--  +---------------------------+       Alexios Zavras (-zvr-)
    | H eytyxia den exei enoxes |       zvr [ at ] zvr [ dot ] gr
    +-----------------------zvr-+
/*
 * mclick -- click the left mousebutton whenever the cursor pauses 
 */

/*
 * Copyright (c) 2007, Alexios Zavras <zvr [ at ] zvr [ dot ] gr>
 * Last modified by zvr on:
	Wed 09 May 2007 (day 129)	12:15:02	[20070509.121502]
 */

/*
 * Compile with:
	gcc -O3 -o mclick mclick.c -lXtst -lXt
 */

#include	<X11/Shell.h>
#include	<X11/extensions/XTest.h>

#define	CHECK_EVERY	100	/* milliseconds */
#define	STATIONARY	5	/* consecutive checks without movement */

XtAppContext	ctx;
Display *	dpy;

int
cursor_moved_or_button_pressed(void)
{
    Window		root;
    Window		child;
    int			root_x;
    int			root_y;
    int			win_x;
    int			win_y;
    unsigned int	mask;
    int			ret = 0;
    static Window	prev_root = -1;
    static int		prev_root_x = -1;
    static int		prev_root_y = -1;
#define CHECK_SAME(v) do { \
			    if (v != prev_ ## v) ret = 1; prev_ ## v = v; \
			} while (0)
#define CHECK_BUTTON(n) do { \
			    if (mask & Button ## n ## Mask) ret = 1; \
			} while (0)

    XQueryPointer(dpy, DefaultRootWindow(dpy),
		  &root, &child, &root_x, &root_y, &win_x, &win_y, &mask);
    CHECK_SAME(root);
    CHECK_SAME(root_x);
    CHECK_SAME(root_y);
    CHECK_BUTTON(1);
    CHECK_BUTTON(2);
    CHECK_BUTTON(3);
    CHECK_BUTTON(4);
    CHECK_BUTTON(5);
    return(ret);
#undef CHECK_SAME
#undef CHECK_BUTTON
}

void
click(void)
{
    XTestFakeButtonEvent(dpy, 1, True, CurrentTime);
    XTestFakeButtonEvent(dpy, 1, False, CurrentTime);
    XFlush(dpy);
}

void
check(XtPointer closure, XtIntervalId *id)
{
    static int	cnt = 0;
    static int	clicked = 0;

    cnt++;
    if (cursor_moved_or_button_pressed())
	clicked = cnt = 0;
    if (!clicked && cnt >= STATIONARY)
	cnt = 0, click(), clicked++;
    XtAppAddTimeOut(ctx, CHECK_EVERY, (XtTimerCallbackProc) check, NULL);  
}

int
main(int argc, char ** argv)
{
    Widget	top;

    top = XtOpenApplication(&ctx, "MClick", NULL, 0, &argc, argv, NULL,
			applicationShellWidgetClass, NULL, 0);
    dpy = XtDisplay(top);
    XtAppAddTimeOut(ctx, CHECK_EVERY, (XtTimerCallbackProc) check, NULL);
    XtAppMainLoop(ctx);
}

απαντήσεις

πλοήγηση μηνυμάτων