libutouch-geis C++ problems

Asked by Teee

Hi

I'm interesting in develop an aplication in C++ using utouch to get ALL gestures (I see that Qt support only get gestures doing in a widget, I need to get all gestures), I suposse that libutouch-geis provides acces to all gestures.

I only found this documentation:
http://people.canonical.com/~cndougla/geis-1.0/index.html

Well, I have a very very basic problem with geis, I'm trying to get gestures:

#include <geis/geis.h>

static void gestureAdded(void* cookie, GeisGestureType gesture_type,
        GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs) {
}

static void gestureRemoved(void* cookie, GeisGestureType gesture_type,
        GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs) {
}

static void gestureStart(void* cookie, GeisGestureType gesture_type,
        GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs) {
}

static void gestureUpdate(void* cookie, GeisGestureType gesture_type,
        GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs) {
}

static void gestureFinish(void* cookie, GeisGestureType gesture_type,
        GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs) {
}

int main() {

    GeisInstance instance;
    GeisWinInfo winInfo;

    GeisXcbWinInfo xcbWinInfo;
    xcbWinInfo.display_name = NULL;
    xcbWinInfo.screenp = NULL;
    xcbWinInfo.window_id = 0; // What ID to recibe ALL gestures??

    winInfo.win_type = GEIS_XCB_FULL_WINDOW;
    winInfo.win_info = &xcbWinInfo;

    // Init geis
    if(geis_init(&winInfo, &instance) != GEIS_STATUS_SUCCESS)
        return -1;

    // Subcribe to gestures
    GeisGestureFuncs gestureFuncs = {
      gestureAdded,
      gestureRemoved,
      gestureStart,
      gestureUpdate,
      gestureFinish
    };

    if(geis_subscribe(instance, GEIS_ALL_INPUT_DEVICES, GEIS_ALL_GESTURES,
            &gestureFuncs, NULL) != GEIS_STATUS_SUCCESS)
        return -1;

    for(;;) {
        // How to read gestures??
    }

    geis_finish(instance);

    return 0;
}

Trying to compile:
$ g++ Main.cpp -lutouch-geis
/tmp/cctT1OgH.o: In function `main':
Main.cpp:(.text+0xa9): undefined reference to `geis_init(GeisWinInfo*, _GeisInstance**)'
Main.cpp:(.text+0x10d): undefined reference to `geis_subscribe(_GeisInstance*, unsigned int*, char const**, GeisGestureFuncs*, void*)'
collect2: ld returned 1 exit status

Ok... questions ;)

(1) Why don't compile?
(2) Is posible to get ALL gestures? If is posible... How?
(3) Some documentation or examples about geis please?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Open Input Framework Edit question
Assignee:
No assignee Edit question
Solved by:
Stephen M. Webb
Solved:
Last query:
Last reply:
Revision history for this message
Best Stephen M. Webb (bregma) said :
#1

C++ support is a known problem with an upstream fix. A package is available at ppa:bregma/smw-maverick, or for a newer package, ppa:utouch-team/utouch.

If you're looking for example code, the testsuite/geistest program in the geis sources is a good place to start, and the ucube demo <https://launchpad.net/ucube> is another example. The geistest program shows how to support gestures in all windows.

Better documentation is forthcoming but may be targetted to geis v2,0 for the natty (11.04) release of Ubuntu.

Revision history for this message
Teee (eon-jose) said :
#2

Hello Stephen

In first place thanks for answer!

> C++ support is a known problem with an upstream fix.

You're right, the problem occurs when you include a cpp file, with c files works correctly. Fortunately I can fix it including headers as well:

extern "C" {
    #include <geis/geis.h>
}

Thanks!

> The geistest program shows how to support gestures in all windows.

Thanks, I've downloaded the source code ;)

Revision history for this message
Teee (eon-jose) said :
#3

Thanks Stephen M. Webb, that solved my question.