I'm trying to play a game on my MacBook (The Settlers under DOSBox) that makes use of something the manual calls a "special click": holding down the right mouse button and clicking the left mouse button.

It seems to be impossible to do that using the trackpad. Apart from attaching an external mouse, is there any way to simulate such input?

  • Are there in-game control settings that you can use to eliminate the need to click both at once? – user24601 May 13 '15 at 18:02
  • No, the controls are hardcoded. – legoscia May 13 '15 at 19:46

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

  • This might work, but it doesn't work in the game I'm trying to play, because I have to hold down left-click and then right-click. Any more ideas? – James Vanderhyde May 6 at 1:39
  • In the original question it was vice versa. But even in your case it should work. I have right click by two fingers touch. So, normal click on touchpad (this would be your left-click) and then right-click by two fingers touch. – Denis Rasulev May 6 at 12:14
  • Thanks. That works for a split second, but for this game I need to be able to hold them down at the same time. Since my problem is different enough, perhaps I'll post a separate question. – James Vanderhyde May 6 at 13:38

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 {
+   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 {
    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 @@
 #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:


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

  • How do I use your patch? I'm running a macbook pro 2011, with OSX 10.6.8 I'm trying to play Ultima VIII in a Dosbox wrapper, where I need this special click to perform an action. Thanks! – user149048 Sep 28 '15 at 22:32
  • Checkout the DOSBox source code from SVN here, apply the patch with patch -p0 < map-mouse-buttons.diff, and follow the instructions in the INSTALL file. – legoscia Sep 28 '15 at 22:46
  • Your patch seems to have issues with Mac OS 10.13.3 . I get patching file src/gui/sdl_mapper.cpp Hunk #1 FAILED at 32. patch: **** malformed patch at line 25: \ Would you be able to update to work? Thanks – Stevan Lieberman Mar 12 '18 at 1:09
  • Hm, it works for me.... Might be worth trying to download the patch file directly from Sourceforge: sourceforge.net/p/dosbox/patches/264/attachment/… – legoscia Mar 12 '18 at 18:59

You must log in to answer this question.

protected by bmike Mar 12 '18 at 1:12

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .