Simultaneous left and right click with trackpad

You can setup touchpad to perform right click by pressing its right (or left) bottom corner. If your normal click is done by touching trackpad (not clicking it) then you can perform this magic trick - press bottom corner for right click and touch touchpad to make normal click = two clicks simultaneously. enter image description here


It turned out to be quite easy to patch DOSBox to allow using a keyboard key as a mouse button. I submitted a patch for adding that functionality to the key mapper.


If you want to try this out, save the following into a text file called map-mouse-buttons.diff:

Index: src/gui/sdl_mapper.cpp
===================================================================
--- src/gui/sdl_mapper.cpp  (revision 3914)
+++ src/gui/sdl_mapper.cpp  (working copy)
@@ -32,6 +32,7 @@
 #include "dosbox.h"
 #include "video.h"
 #include "keyboard.h"
+#include "mouse.h"
 #include "joystick.h"
 #include "support.h"
 #include "mapper.h"
@@ -1497,6 +1498,20 @@
    KBD_KEYS key;
 };

+class CMouseButtonEvent : public CTriggeredEvent {
+public:
+   CMouseButtonEvent(char const * const _entry,Bit8u _button) : CTriggeredEvent(_entry) {
+       button=_button;
+   }
+   void Active(bool yesno) {
+       if (yesno)
+           Mouse_ButtonPressed(button);
+       else
+           Mouse_ButtonReleased(button);
+   }
+   Bit8u button;
+};
+   
 class CJAxisEvent : public CContinuousEvent {
 public:
    CJAxisEvent(char const * const _entry,Bitu _stick,Bitu _axis,bool _positive,CJAxisEvent * _opposite_axis) : CContinuousEvent(_entry) {
@@ -1708,6 +1723,15 @@
    return event;
 }

+static CMouseButtonEvent * AddMouseButtonEvent(Bitu x,Bitu y,Bitu dx,Bitu dy,char const * const title,char const * const entry,Bit8u button) {
+   char buf[64];
+   strcpy(buf,"mouse_");
+   strcat(buf,entry);
+   CMouseButtonEvent * event=new CMouseButtonEvent(buf,button);
+   new CEventButton(x,y,dx,dy,title,event);
+   return event;
+}
+
 static CJAxisEvent * AddJAxisButton(Bitu x,Bitu y,Bitu dx,Bitu dy,char const * const title,Bitu stick,Bitu axis,bool positive,CJAxisEvent * opposite_axis) {
    char buf[64];
    sprintf(buf,"jaxis_%d_%d%s",stick,axis,positive ? "+" : "-");
@@ -1866,6 +1890,15 @@
    AddKeyButtonEvent(PX(XO+2),PY(YO+4),BW,BH,".","kp_period",KBD_kpperiod);
 #undef XO
 #undef YO
+#define XO 5
+#define YO 8
+   /* Mouse Buttons */
+   new CTextButton(PX(XO+0),PY(YO-1),3*BW,20,"Mouse");
+   AddMouseButtonEvent(PX(XO+0),PY(YO),BW,BH,"L","left",0);
+   AddMouseButtonEvent(PX(XO+1),PY(YO),BW,BH,"M","middle",2);
+   AddMouseButtonEvent(PX(XO+2),PY(YO),BW,BH,"R","right",1);
+#undef XO
+#undef YO
 #define XO 10
 #define YO 8
    /* Joystick Buttons/Texts */

Then, in the terminal, check out the latest DOSBox code from Subversion:

svn co svn://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk dosbox-svn

Enter the directory, and apply the patch with the patch command:

cd dosbox-svn
patch -p0 < ../map-mouse-buttons.diff

(This assumes that the patch file is saved in the parent directory of dosbox-svn. If it's somewhere else, adjust the command as needed.)

Then, follow the instructions in the INSTALL file to build your new version of DOSBox. Basically, it's these three commands:

./autogen.sh
./configure
make

Though you may have to install various dependencies, which can be done through Macports and similar tools.