Sunday, November 14, 2010

WeTab Right-Click Mouse Button as soft-touch

Ok, so this one kept me up a good full night. After messing around with Vnc and other stuff on the WeTab it was finally evident that I needed to right-mouse-click on some things. Resorting to a real mouse is ok but not exemplary.

At first I thought I could add a key to the keyboard.xml for matchbox but it turns out you that clicking on the virtual keyboard modifies the current mouse position (Duh). My last resort was to see if I could get the softtouch button to be my right mouse button. To do this, I first needed a program that could simulate the right mouse button click. Fortunately for us, these two guys had the code for such a task posted on a forum here. Many thanks to Osor. (You can skip the compilation details and download the binary directly from here.)

Get the c code for rightclick.c as found below and put in a rightclick.c on your WeTab in a build directory.

#include <stdlib.h>
#include <stdio.h>

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

#define RMB 3 /* Right Mouse Button */

int main(int argc, char **argv)
{
    Display *d;

    if(!(d = XOpenDisplay(NULL))) {
        fprintf(stderr, "Cannot open display \"%s\".\n", XDisplayName(NULL));
        exit(EXIT_FAILURE);
    }

    int ignore;
    if(!(XQueryExtension(d, "XTEST", &ignore, &ignore, &ignore))) {
        fprintf(stderr, "You do not have the \"XTEST\" extension enabled on your current display.\n");
        exit(EXIT_FAILURE);
    }

    XTestFakeButtonEvent(d, RMB, True, 0);
#ifdef UP_AND_DOWN
    XTestFakeButtonEvent(d, RMB, False, 0);
#endif /* UP_AND_DOWN */

    XCloseDisplay(d);
    exit(EXIT_SUCCESS);
}

Of course as always with any code you get, it won't compile straight off. You have to comment out the include for xtest as shown above.

Also changes will need to be made to the makefile and a symbolic link added in your /usr/lib/.

For the makefile, add the -L directive to point the ld linker to the correct search path for the Xtst library.


LDFLAGS += -L/usr/lib/ -lX11 -lXtst

all: rightclick rightclick-alt

rightclick: rightclick.c
    ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $<

rightclick-alt: rightclick.c
    ${CC} ${CFLAGS} ${LDFLAGS} -DUP_AND_DOWN -o $@ $<

Next create a symbolic link for libXtst like so:

$ sudo ln -s /usr/lib/libXtst.so.6 /usr/lib/libXtst.so

Finally do:
$ make

You should now have two files in your directory: rightclick and rightclick-alt. According to the author the rightclick one sends a mouse button down event only and the other one sends a down and up event.

Now we could assign our soft-touch button to the rightclick-alt binary and now have right clicks on our WeTabs. To see how to reassign the soft-touch button please visit my earlier post changing the soft-touch button assignment.

Also I've uploaded the binary I have here. I believe it should work for all WeTabers.

Now go off and right-click as you wish:)

9 comments:

  1. Sorry if I use this comment to ask questions but I see that you know well the wetab and you have tried ubuntu. I will use a wetab primarily for email, calendar and web, but until mid-2011 it will be available only in German and English language (I read on a forum not fully translated). I ask then if I buy it now you think I can install ubuntu in my language and use with touchscreen software such as Thunderbird, OpenOffice, etc.? Is it possible and easy? You think it's a good buy?
    Thanks.

    ReplyDelete
  2. Frenkys, I'm not sure when the international release will be coming out. How comfortable are you with Linux? what you propose is feasible but probably will take sometime adjusting so that you work comfortably on the WeTab: you will have to set up a virtual keyboard, fix any driver issues and deal with extra bootup time, the WeTab OS is quite optimized and boots-up in about 16 seconds, Ubuntu will take longer to boot.

    ReplyDelete
  3. Etheros, thanks for the reply.
    I have occasionally used ubuntu on the pc and I think I can solve some problems with the help of the Internet. But in the end, as far as I want to use it(mail, calendar, web) do you think is a good buy even with the original operating system by using it in English? The system is fully translated into English?
    I do not think there's anything on the market as good (Android systems seem immature for the tablet); what do you think?
    Thanks

    ReplyDelete
  4. I speak almost no German at all but am having minimal trouble with the machine. Also so far anything that runs on other flavors of Linux run fine here, I've either just needed the rpm package or the source along with any needed libraries. The system is pretty much all translated in English, but the help menus and some update messages are in German. That hasn't bothered me though. There is a nice community at http://wetab-community.de/forum/ and they are all capable of replying in English.
    For Mail, I'm using thunderbird which is easily installed from the 4tiitoo repositories, requiring no hardship at all; just a simple yum install thunderbird.
    For the web I've installed chrome which can easily be got from the WeTab Markt app which comes installed by default. I haven't used the Kalendar app but it appears to be the calendar offered by claw which I believe is like the one offered by thunderbird.
    With regards to buying it, I always feel comfortable demoing something first just to be sure that it aligns with my taste, if you can go down to the nearest Media Markt and have a look at both the WeTab and an iPad for comparison that would be best.
    Regards

    ReplyDelete
  5. Unfortunately from here I can only buy it via Internet! For this I have done all these questions. Thank you very much.

    ReplyDelete
  6. Sorry, I'm kind of late to the party, I just received my WeTab, and it's really an awesome device!
    I'm not a big fan of the xfce-panel on the right, and the Tiitoo desktop in general. Isn't there any way to install (or launch at boot) the MeeGo gnome-based core?
    All the packages are available (via yum or here http://repo.meego.com/MeeGo/releases/1.0.1/netbook/repos/ia32/packages/i586/ ), so apart for xfce-panel that keeps relaunching itself and the Tiitoo desktop, that should be feasible, right?

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Yeah and like you said I guess you can just strip down the 4titoo stuff to get down to the core Meego installation underneath. I haven't done much in that respect though, but it shouldn't be too hard to get rid of the xfce-panel and conjure up the gnome stuff. Sorry I'm still swamped with work so my experimentation has dwindled down to nothing these couple of weeks...

    ReplyDelete
  9. i tried downloading the binaries and the files are no longer there. would you mind either reuploading them or just sending them to me?
    raritan01 at gmail dot com
    thanks!

    ReplyDelete