* --joystick-buttons-ignore option can be used to ignore joystick buttons
(rather than all non-command-assigned buttons being used asi left-mouse-click) * Updated docs re: joysticks a bit.
This commit is contained in:
parent
2146904cb0
commit
e6365974f6
8 changed files with 62 additions and 10 deletions
|
|
@ -151,18 +151,19 @@ $Id$
|
|||
* ASDW is QWERTY-centric; drop it, or add ways to support other
|
||||
keyboard layouts.
|
||||
|
||||
* Joystick can be used to drive Tuxpaint
|
||||
* Joystick can be used to drive Tux Paint
|
||||
by Ankit Choudary <ankit.goaldecided@gmail.com> (GSOC 2010)
|
||||
with integration and fixes by Pere Pujal i Carabantes
|
||||
|
||||
* Uses the first joystick found on the system, so should work out
|
||||
of the box.
|
||||
* Use --joystick-dev to choose joystick (otherwise
|
||||
uses the first joystick found on the system).
|
||||
* Uses any of the buttons found in the joystick, no need for
|
||||
configuration.
|
||||
* The hat of the joystick moves one pixel at a time, usefull to
|
||||
configuration. (--joystick-buttons-ignore can be used to
|
||||
ignore buttons.)
|
||||
* The hat of the joystick moves one pixel at a time, useful to
|
||||
carefully place the pointer.
|
||||
* The ball of the joystick should also trigger pointer
|
||||
motion. FIXME: This should work but is not tested.
|
||||
motion.
|
||||
* The responsivity of the joystick can be configured via command
|
||||
line or config files:
|
||||
* --joystick-slownes sets a delay at each axis motion event.
|
||||
|
|
@ -173,6 +174,8 @@ $Id$
|
|||
* --joystick_maxsteps sets the maximum number of pixels that
|
||||
the pointer will move at a time.
|
||||
Allowed values from 1 to 7, defaults to 7.
|
||||
* Joystick buttons can be assigned used to activate certain commands.
|
||||
(--joystick-btn-COMMAND options)
|
||||
|
||||
* Magic Tool Improvememnts:
|
||||
-------------------------
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Options Documentation
|
|||
bill@newbreedsoftware.com
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
March 28, 2013
|
||||
March 30, 2013
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
|
@ -485,6 +485,12 @@ Windows Users
|
|||
Selects the joystick button number, as seen by SDL, that will
|
||||
be a shortcurt to print.
|
||||
|
||||
joystick-buttons-ignore=BUTTON1,BUTTON2,...
|
||||
A set of joystick button numbers, as seen by SDL, that should
|
||||
be ignored. Otherwise, unless they are used by one of the
|
||||
"joystick-btn-" options above, buttons will be seen as a mouse
|
||||
left-click.
|
||||
|
||||
stampsize=SIZE
|
||||
|
||||
Use this option to force Tux Paint to set the starting size of
|
||||
|
|
@ -909,6 +915,7 @@ Windows Users
|
|||
--onscreen-keyboard
|
||||
--onscreen-keyboard-layout
|
||||
--onscreen-keyboard-disable-change
|
||||
--joystick-dev
|
||||
--joystick-slowness
|
||||
--joystick-threshold
|
||||
--joystick-maxsteps
|
||||
|
|
@ -930,6 +937,7 @@ Windows Users
|
|||
--joystick-btn-save
|
||||
--joystick-btn-pgsetup
|
||||
--joystick-btn-print
|
||||
--joystick-buttons-ignore
|
||||
--sysfonts
|
||||
--alllocalefonts
|
||||
--mirrorstamps
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ New Breed Software</p>
|
|||
<a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p>
|
||||
|
||||
|
||||
<p>March 28, 2013</p>
|
||||
<p>March 30, 2013</p>
|
||||
|
||||
|
||||
</center>
|
||||
|
|
@ -604,6 +604,13 @@ New Breed Software</p>
|
|||
Selects the joystick button number, as seen by SDL, that will be a shortcurt to print.
|
||||
</dd>
|
||||
|
||||
<dt><code><b>joystick-buttons-ignore=<i>BUTTON1,BUTTON2,...</i></b></code></dt>
|
||||
<dd>
|
||||
A set of joystick button numbers, as seen by SDL, that should be ignored.
|
||||
Otherwise, unless they are used by one of the "<code>joystick-btn-</code>" options
|
||||
above, buttons will be seen as a mouse left-click.
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1388,6 +1395,7 @@ New Breed Software</p>
|
|||
--onscreen-keyboard<br>
|
||||
--onscreen-keyboard-layout<br>
|
||||
--onscreen-keyboard-disable-change<br>
|
||||
--joystick-dev<br>
|
||||
--joystick-slowness<br>
|
||||
--joystick-threshold<br>
|
||||
--joystick-maxsteps<br>
|
||||
|
|
@ -1409,6 +1417,7 @@ New Breed Software</p>
|
|||
--joystick-btn-save<br>
|
||||
--joystick-btn-pgsetup<br>
|
||||
--joystick-btn-print<br>
|
||||
--joystick-buttons-ignore<br>
|
||||
--sysfonts<br>
|
||||
--alllocalefonts<br>
|
||||
--mirrorstamps<br>
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children.
|
|||
.br
|
||||
[\-\-joystick-btn-print=\fIBUTTON\fP]
|
||||
.br
|
||||
[\-\-joystick-buttons-ignore=\fIBUTTON1,BUTTON2,...\fP]
|
||||
.br
|
||||
[\-\-stampsize=\fISIZE\fP]
|
||||
.br
|
||||
[\-\-keyboard]
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ joystick-btn-open, MULTI(joystick_button_open)
|
|||
joystick-btn-save, MULTI(joystick_button_save)
|
||||
joystick-btn-pgsetup, MULTI(joystick_button_pagesetup)
|
||||
joystick-btn-print, MULTI(joystick_button_print)
|
||||
joystick-buttons-ignore, MULTI(joystick_buttons_ignore)
|
||||
%%
|
||||
|
||||
void parse_one_option(struct cfginfo *restrict tmpcfg, const char *str, const char *opt, const char *restrict src)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ struct cfginfo
|
|||
const char *joystick_button_save;
|
||||
const char *joystick_button_pagesetup;
|
||||
const char *joystick_button_print;
|
||||
const char *joystick_buttons_ignore;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ _tuxpaint()
|
|||
--joystick-btn-save \
|
||||
--joystick-btn-pgsetup \
|
||||
--joystick-btn-print \
|
||||
--joystick-buttons-ignore \
|
||||
--colorfile' -- $cur ) )
|
||||
# We don't accept filenames on the command-line yet -bjk 2009.09.09
|
||||
# else
|
||||
|
|
|
|||
|
|
@ -1080,6 +1080,8 @@ static int joystick_button_open = 255;
|
|||
static int joystick_button_save = 255;
|
||||
static int joystick_button_pagesetup = 255;
|
||||
static int joystick_button_print = 255;
|
||||
static int joystick_buttons_ignore_len = 0;
|
||||
static int joystick_buttons_ignore[256];
|
||||
static Uint32 old_hat_ticks = 0;
|
||||
static int oldpos_x;
|
||||
static int oldpos_y;
|
||||
|
|
@ -22082,6 +22084,22 @@ static void setup_config(char *argv[])
|
|||
}
|
||||
joystick_button_print = strtof(tmpcfg.joystick_button_print, NULL);
|
||||
}
|
||||
if(tmpcfg.joystick_buttons_ignore)
|
||||
{
|
||||
int i;
|
||||
char * token;
|
||||
|
||||
token = strtok(tmpcfg.joystick_buttons_ignore, ",");
|
||||
while (token != NULL) {
|
||||
if (strtof(token, NULL) < 0 || strtof(token, NULL) > 254) {
|
||||
/* FIXME: Find better exit code */
|
||||
printf("Joystick buttons must be between 0 and 254", tmpcfg.joystick_button_print);
|
||||
exit(1);
|
||||
}
|
||||
joystick_buttons_ignore[joystick_buttons_ignore_len++] = strtof(token, NULL);
|
||||
token = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* having any of theese implies having onscreen keyboard setted */
|
||||
|
|
@ -23899,6 +23917,7 @@ static void handle_joybuttonupdown(SDL_Event event, int oldpos_x, int oldpos_y)
|
|||
}
|
||||
|
||||
static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_y, SDL_Rect real_r_tools) {
|
||||
int i, ignore = 0;
|
||||
int eby, ts;
|
||||
SDL_Event ev;
|
||||
|
||||
|
|
@ -24060,6 +24079,14 @@ static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_
|
|||
printf("result %d %d\n", ev.button.x, ev.button.y);
|
||||
#endif
|
||||
|
||||
SDL_PushEvent(&ev);
|
||||
}
|
||||
/* See if it's a button we ignore */
|
||||
|
||||
for (i = 0; i < joystick_buttons_ignore_len && !ignore; i++) {
|
||||
if (event.button.button == joystick_buttons_ignore[i]) {
|
||||
ignore = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignore)
|
||||
SDL_PushEvent(&ev);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue