From 86fe937dc52b1adad81e80fab66b34d4e4756e3d Mon Sep 17 00:00:00 2001
From: William Kendrick
Date: Sun, 16 Jan 2005 09:32:14 +0000
Subject: [PATCH] Added "--nobuttondistinction" option to return Tux Paint to
pre-0.9.15 behavior regarding middle and right mouse clicks.
---
docs/CHANGES.txt | 6 +++++-
docs/OPTIONS.txt | 16 +++++++++++++++-
docs/html/OPTIONS.html | 16 +++++++++++++++-
src/tuxpaint.c | 36 ++++++++++++++++++++++++++++++------
4 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 3916f7923..dee0bb4a5 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -7,7 +7,7 @@ bill@newbreedsoftware.com
http://www.newbreedsoftware.com/tuxpaint/
-2005.January.12 (0.9.15)
+2005.January.16 (0.9.15)
* Stamp tool improvements:
------------------------
* Greatly improved stamp outlining (to avoid empty rows or columns
@@ -103,6 +103,10 @@ http://www.newbreedsoftware.com/tuxpaint/
* Middle and right mouse buttons no longer do anything.
(No reason to teach kids that all the buttons do the same thing!)
+ Note: This can be disabled (resulting in the old-style support for
+ all three buttons meaning the same thing) by setting the
+ "--nobuttondistinction" option.
+
* If middle or right mouse buttons are clicked too much, a pop-up
appears explaining to click the left button, and includes a small
picture of a mouse with the left button being 'clicked.'
diff --git a/docs/OPTIONS.txt b/docs/OPTIONS.txt
index 7d810afce..342db0eab 100644
--- a/docs/OPTIONS.txt
+++ b/docs/OPTIONS.txt
@@ -9,7 +9,7 @@
bill@newbreedsoftware.com
http://www.newbreedsoftware.com/tuxpaint/
- January 9, 2005
+ January 16, 2005
---------------------------------------------------------------------------
@@ -166,6 +166,18 @@ Windows Users
(Normally, the wheel will scroll the selector menu on the
right.)
+ nobuttondistinction=yes
+
+ Prior to Tux Paint 0.9.15, the middle and right buttons on a
+ mouse could also be used for clicking. In version 0.9.15, it was
+ changed so that only the left mouse button worked, so as to not
+ train children to use the wrong button.
+
+ However, for children who have trouble with the mouse, this
+ distinction between the two or three buttons on a mouse can be
+ disabled (returning Tux Paint to its old behavior) by using this
+ option.
+
nofancycursors=yes
This disables the fancy mouse pointer shapes in Tux Paint, and
@@ -407,6 +419,7 @@ Windows Users
--grab
--noshortcuts
--nowheelmouse
+ --nobuttondistinction
--nofancycursors
--nooutlines
--nostamps
@@ -436,6 +449,7 @@ Windows Users
--dontgrab
--shortcuts
--wheelmouse
+ --buttondistinction
--fancycursors
--outlines
--stamps
diff --git a/docs/html/OPTIONS.html b/docs/html/OPTIONS.html
index 22c3485ec..018930c89 100644
--- a/docs/html/OPTIONS.html
+++ b/docs/html/OPTIONS.html
@@ -22,7 +22,7 @@ New Breed Software
bill@newbreedsoftware.com
http://www.newbreedsoftware.com/tuxpaint/
-January 9, 2005
+January 16, 2005
@@ -218,6 +218,18 @@ New Breed Software
(Normally, the wheel will scroll the selector menu on the right.)
+ nobuttondistinction=yes
+
+ Prior to Tux Paint 0.9.15, the middle and right buttons on
+ a mouse could also be used for clicking. In version 0.9.15, it was changed
+ so that only the left mouse button worked, so as to not train
+ children to use the wrong button.
+
+ However, for children who have trouble with the mouse, this distinction
+ between the two or three buttons on a mouse can be disabled (returning
+ Tux Paint to its old behavior) by using this option.
+
+
nofancycursors=yes
This disables the fancy mouse pointer shapes in Tux Paint,
@@ -644,6 +656,7 @@ New Breed Software
--grab
--noshortcuts
--nowheelmouse
+ --nobuttondistinction
--nofancycursors
--nooutlines
--nostamps
@@ -676,6 +689,7 @@ New Breed Software
--dontgrab
--shortcuts
--wheelmouse
+ --buttondistinction
--fancycursors
--outlines
--stamps
diff --git a/src/tuxpaint.c b/src/tuxpaint.c
index 31f72e65d..c52293279 100644
--- a/src/tuxpaint.c
+++ b/src/tuxpaint.c
@@ -22,12 +22,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
- June 14, 2002 - January 14, 2005
+ June 14, 2002 - January 16, 2005
*/
#define VER_VERSION "0.9.15"
-#define VER_DATE "2005-01-14"
+#define VER_DATE "2005-01-16"
/* Color depth for Tux Paint to run in, and store canvases in: */
@@ -1425,7 +1425,7 @@ static int use_sound, fullscreen, disable_quit, simple_shapes,
wheely, no_fancy_cursors, keymouse, mouse_x, mouse_y,
mousekey_up, mousekey_down, mousekey_left, mousekey_right,
dont_do_xor, use_print_config, dont_load_stamps, noshortcuts,
- no_system_fonts,
+ no_system_fonts, no_button_distinction,
mirrorstamps, disable_stamp_controls, disable_save, ok_to_use_lockfile;
static int starter_mirrored, starter_flipped;
static int recording, playing;
@@ -2248,6 +2248,7 @@ static void load_starter(char * img_id);
static SDL_Surface * duplicate_surface(SDL_Surface * orig);
static void mirror_starter(void);
static void flip_starter(void);
+int valid_click(Uint8 button);
#ifdef DEBUG
static char * debug_gettext(const char * str);
@@ -2757,7 +2758,7 @@ static void mainloop(void)
}
}
else if (event.type == SDL_MOUSEBUTTONDOWN &&
- event.button.button == 1)
+ valid_click(event.button.button))
{
if (HIT(r_tools))
{
@@ -6709,6 +6710,7 @@ static void setup(int argc, char * argv[])
dont_do_xor = 0;
keymouse = 0;
wheely = 1;
+ no_button_distinction = 0;
grab_input = 0;
no_fancy_cursors = 0;
simple_shapes = 0;
@@ -6973,6 +6975,10 @@ static void setup(int argc, char * argv[])
{
no_system_fonts = 1;
}
+ else if (strcmp(argv[i], "--nobuttondistinction") == 0)
+ {
+ no_button_distinction = 1;
+ }
else if (strcmp(argv[i], "--sysfonts") == 0)
{
no_system_fonts = 0;
@@ -10722,7 +10728,7 @@ static void do_wait(void)
done = 1;
}
else if (event.type == SDL_MOUSEBUTTONDOWN &&
- event.button.button == 1)
+ valid_click(event.button.button))
{
done = 1;
}
@@ -11472,7 +11478,7 @@ static int do_prompt_image_flash(const char * const text, const char * const btn
}
}
else if (event.type == SDL_MOUSEBUTTONDOWN &&
- event.button.button == 1)
+ valid_click(event.button.button))
{
if (event.button.x >= 166 + PROMPTOFFSETX &&
event.button.x < 166 + PROMPTOFFSETX + 48)
@@ -14713,6 +14719,15 @@ static void parse_options(FILE * fi)
{
no_system_fonts = 0;
}
+ else if (strcmp(str, "nobuttondistinction=yes") == 0)
+ {
+ no_button_distinction= 1;
+ }
+ else if (strcmp(str, "nobuttondistinction=no") == 0 ||
+ strcmp(str, "buttondistinction=yes") == 0)
+ {
+ no_button_distinction= 0;
+ }
else if (strcmp(str, "nosound=yes") == 0)
{
use_sound = 0;
@@ -15179,3 +15194,12 @@ static void flip_starter(void)
}
}
+
+int valid_click(Uint8 button)
+{
+ if (button == 1 ||
+ ((button == 2 || button == 3) && no_button_distinction))
+ return(1);
+ else
+ return(0);
+}