Back to index

unity  6.0.0
GeisAdapter.cpp
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2010 Canonical Ltd
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  *
00017  * Authored by: Jason Smith <jason.smith@canonical.com>
00018  */
00019 
00020 #include <glib.h>
00021 #include <gdk/gdkx.h>
00022 #include <NuxCore/Logger.h>
00023 #include "GeisAdapter.h"
00024 
00025 namespace
00026 {
00027   GeisAdapter* adaptor_instance = nullptr;
00028   nux::logging::Logger logger("unity.geisadapter");
00029 }
00030 
00031 /* static */
00032 GeisAdapter& GeisAdapter::Instance()
00033 {
00034   if (!adaptor_instance)
00035   {
00036     LOG_ERROR(logger) << "No GeisAdapter created yet.";
00037   }
00038 
00039   return *adaptor_instance;
00040 }
00041 
00042 GeisAdapter::GeisAdapter() : _root_instance(nullptr)
00043 {
00044   if (adaptor_instance)
00045   {
00046     LOG_ERROR(logger) << "More than one GeisAdapter created.";
00047   }
00048   else
00049   {
00050     adaptor_instance = this;
00051   }
00052   RegisterRootInstance();
00053 }
00054 
00055 GeisAdapter::~GeisAdapter()
00056 {
00057   if (_root_instance != nullptr)
00058     geis_finish(_root_instance);
00059   if (adaptor_instance == this)
00060   {
00061     adaptor_instance = nullptr;
00062   }
00063 }
00064 
00065 void
00066 GeisAdapter::Run()
00067 {
00068   int fd = -1;
00069   GeisStatus status = GEIS_STATUS_NOT_SUPPORTED;
00070 
00071   if (_root_instance != nullptr)
00072     status = geis_configuration_get_value(_root_instance, GEIS_CONFIG_UNIX_FD, &fd);
00073 
00074   if (status != GEIS_STATUS_SUCCESS)
00075     return;
00076 
00077   _watch_id = g_io_add_watch(g_io_channel_unix_new(fd),
00078                              G_IO_IN,
00079                              &GeisAdapter::OnWatchIn,
00080                              this);
00081 }
00082 
00083 gboolean
00084 GeisAdapter::OnWatchIn(GIOChannel* source, GIOCondition condition, gpointer data)
00085 {
00086   GeisAdapter* self = static_cast<GeisAdapter*>(data);
00087   geis_event_dispatch(self->_root_instance);
00088   return true;
00089 }
00090 
00091 void
00092 GeisAdapter::InputDeviceAdded(void* cookie, GeisInputDeviceId device_id, void* attrs)
00093 {
00094 }
00095 
00096 
00097 void
00098 GeisAdapter::InputDeviceChanged(void* cookie, GeisInputDeviceId device_id, void* attrs)
00099 {
00100 }
00101 
00102 
00103 void
00104 GeisAdapter::InputDeviceRemoved(void* cookie, GeisInputDeviceId device_id, void* attrs)
00105 {
00106 }
00107 
00108 void
00109 GeisAdapter::GestureAdded(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
00110 {
00111 }
00112 
00113 void
00114 GeisAdapter::GestureRemoved(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
00115 {
00116 }
00117 
00118 void
00119 GeisAdapter::GestureStart(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
00120 {
00121   GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
00122 
00123   if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
00124   {
00125     GeisDragData* data = self->ProcessDragGesture(count, attrs);
00126     data->id = gesture_id;
00127     self->drag_start.emit(data);
00128     g_free(data);
00129   }
00130   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
00131   {
00132     GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
00133     data->id = gesture_id;
00134     self->rotate_start.emit(data);
00135     g_free(data);
00136   }
00137   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
00138   {
00139     GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
00140     data->id = gesture_id;
00141     self->pinch_start.emit(data);
00142     g_free(data);
00143   }
00144   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
00145   {
00146     GeisTapData* data = self->ProcessTapGesture(count, attrs);
00147     data->id = gesture_id;
00148     self->tap.emit(data);
00149     g_free(data);
00150   }
00151   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
00152   {
00153     GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
00154     data->id = gesture_id;
00155     self->touch_start.emit(data);
00156     g_free(data);
00157   }
00158 }
00159 
00160 void
00161 GeisAdapter::GestureUpdate(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
00162 {
00163   GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
00164 
00165   if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
00166   {
00167     GeisDragData* data = self->ProcessDragGesture(count, attrs);
00168     data->id = gesture_id;
00169     self->drag_update.emit(data);
00170     g_free(data);
00171   }
00172   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
00173   {
00174     GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
00175     data->id = gesture_id;
00176     self->rotate_update.emit(data);
00177     g_free(data);
00178   }
00179   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
00180   {
00181     GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
00182     data->id = gesture_id;
00183     self->pinch_update.emit(data);
00184     g_free(data);
00185   }
00186   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
00187   {
00188     GeisTapData* data = self->ProcessTapGesture(count, attrs);
00189     data->id = gesture_id;
00190     self->tap.emit(data);
00191     g_free(data);
00192   }
00193   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
00194   {
00195     GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
00196     data->id = gesture_id;
00197     self->touch_update.emit(data);
00198     g_free(data);
00199   }
00200 }
00201 
00202 void
00203 GeisAdapter::GestureFinish(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
00204 {
00205   GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
00206 
00207   if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
00208   {
00209     GeisDragData* data = self->ProcessDragGesture(count, attrs);
00210     data->id = gesture_id;
00211     self->drag_finish.emit(data);
00212     g_free(data);
00213   }
00214   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
00215   {
00216     GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
00217     data->id = gesture_id;
00218     self->rotate_finish.emit(data);
00219     g_free(data);
00220   }
00221   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
00222   {
00223     GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
00224     data->id = gesture_id;
00225     self->pinch_finish.emit(data);
00226     g_free(data);
00227   }
00228   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
00229   {
00230     GeisTapData* data = self->ProcessTapGesture(count, attrs);
00231     data->id = gesture_id;
00232     self->tap.emit(data);
00233     g_free(data);
00234   }
00235   else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
00236   {
00237     GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
00238     data->id = gesture_id;
00239     self->touch_finish.emit(data);
00240     g_free(data);
00241   }
00242 }
00243 
00244 GeisAdapter::GeisTapData* GeisAdapter::ProcessTapGesture(GeisSize count, GeisGestureAttr* attrs)
00245 {
00246   GeisTapData* result = (GeisTapData*) g_malloc0(sizeof(GeisTapData));
00247 
00248   int i;
00249   for (i = 0; i < (int) count; i++)
00250   {
00251     GeisGestureAttr attr = attrs[i];
00252     if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
00253       result->device_id = attr.integer_val;
00254     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
00255       result->window = (Window) attr.integer_val;
00256     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
00257       result->timestamp = attr.integer_val;
00258     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
00259       result->focus_x = attr.float_val;
00260     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
00261       result->focus_y = attr.float_val;
00262     else if (g_str_equal (attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
00263       result->touches = attr.integer_val;
00264     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME))
00265     {
00266       if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP1))
00267         result->touches = 1;
00268       else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP2))
00269         result->touches = 2;
00270       else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP3))
00271         result->touches = 3;
00272       else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP4))
00273         result->touches = 4;
00274       else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP5))
00275         result->touches = 5;
00276     }
00277     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TAP_TIME))
00278       result->tap_length_ms = attr.integer_val;
00279     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_X))
00280       result->position_x = attr.float_val;
00281     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_Y))
00282       result->position_y = attr.float_val;
00283     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
00284       result->bound_x1 = attr.float_val;
00285     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
00286       result->bound_y1 = attr.float_val;
00287     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
00288       result->bound_x2 = attr.float_val;
00289     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
00290       result->bound_y2 = attr.float_val;
00291   }
00292 
00293   return result;
00294 }
00295 
00296 GeisAdapter::GeisTouchData* GeisAdapter::ProcessTouchGesture(GeisSize count, GeisGestureAttr* attrs)
00297 {
00298   GeisTouchData* result = (GeisTouchData*) g_malloc0(sizeof(GeisTouchData));
00299 
00300   int i;
00301   for (i = 0; i < (int) count; i++)
00302   {
00303     GeisGestureAttr attr = attrs[i];
00304     if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
00305       result->device_id = attr.integer_val;
00306     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
00307       result->window = (Window) attr.integer_val;
00308     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
00309       result->timestamp = attr.integer_val;
00310     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
00311       result->focus_x = attr.float_val;
00312     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
00313       result->focus_y = attr.float_val;
00314     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
00315       result->touches = attr.integer_val;
00316     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
00317       result->bound_x1 = attr.float_val;
00318     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
00319       result->bound_y1 = attr.float_val;
00320     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
00321       result->bound_x2 = attr.float_val;
00322     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
00323       result->bound_y2 = attr.float_val;
00324   }
00325 
00326   return result;
00327 }
00328 
00329 GeisAdapter::GeisDragData* GeisAdapter::ProcessDragGesture(GeisSize count, GeisGestureAttr* attrs)
00330 {
00331   GeisDragData* result = (GeisDragData*) g_malloc0(sizeof(GeisDragData));
00332 
00333   int i;
00334   for (i = 0; i < (int) count; i++)
00335   {
00336     GeisGestureAttr attr = attrs[i];
00337     if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
00338       result->device_id = attr.integer_val;
00339     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
00340       result->window = (Window) attr.integer_val;
00341     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
00342       result->timestamp = attr.integer_val;
00343     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
00344       result->focus_x = attr.float_val;
00345     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
00346       result->focus_y = attr.float_val;
00347     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
00348       result->touches = attr.integer_val;
00349     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_X))
00350       result->position_x = attr.float_val;
00351     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_Y))
00352       result->position_y = attr.float_val;
00353     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_X))
00354       result->velocity_x = attr.float_val;
00355     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y))
00356       result->velocity_y = attr.float_val;
00357     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DELTA_X))
00358       result->delta_x = attr.float_val;
00359     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DELTA_Y))
00360       result->delta_y = attr.float_val;
00361     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
00362       result->bound_x1 = attr.float_val;
00363     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
00364       result->bound_y1 = attr.float_val;
00365     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
00366       result->bound_x2 = attr.float_val;
00367     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
00368       result->bound_y2 = attr.float_val;
00369   }
00370 
00371   return result;
00372 }
00373 
00374 GeisAdapter::GeisPinchData* GeisAdapter::ProcessPinchGesture(GeisSize count, GeisGestureAttr* attrs)
00375 {
00376   GeisPinchData* result = (GeisPinchData*) g_malloc0(sizeof(GeisPinchData));
00377 
00378   int i;
00379   for (i = 0; i < (int) count; i++)
00380   {
00381     GeisGestureAttr attr = attrs[i];
00382     if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
00383       result->device_id = attr.integer_val;
00384     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
00385       result->window = (Window) attr.integer_val;
00386     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
00387       result->timestamp = attr.integer_val;
00388     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
00389       result->focus_x = attr.float_val;
00390     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
00391       result->focus_y = attr.float_val;
00392     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
00393       result->touches = attr.integer_val;
00394     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIUS))
00395       result->radius = attr.float_val;
00396     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIUS_DELTA))
00397       result->radius_delta = attr.float_val;
00398     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIAL_VELOCITY))
00399       result->radius_velocity = attr.float_val;
00400     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
00401       result->bound_x1 = attr.float_val;
00402     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
00403       result->bound_y1 = attr.float_val;
00404     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
00405       result->bound_x2 = attr.float_val;
00406     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
00407       result->bound_y2 = attr.float_val;
00408   }
00409 
00410   return result;
00411 }
00412 
00413 GeisAdapter::GeisRotateData* GeisAdapter::ProcessRotateGesture(GeisSize count, GeisGestureAttr* attrs)
00414 {
00415   GeisRotateData* result = (GeisRotateData*) g_malloc0(sizeof(GeisRotateData));
00416 
00417   int i;
00418   for (i = 0; i < (int) count; i++)
00419   {
00420     GeisGestureAttr attr = attrs[i];
00421     if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
00422       result->device_id = attr.integer_val;
00423     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
00424       result->window = (Window) attr.integer_val;
00425     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
00426       result->timestamp = attr.integer_val;
00427     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
00428       result->focus_x = attr.float_val;
00429     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
00430       result->focus_y = attr.float_val;
00431     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
00432       result->touches = attr.integer_val;
00433     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGLE))
00434       result->angle = attr.float_val;
00435     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA))
00436       result->angle_delta = attr.float_val;
00437     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGULAR_VELOCITY))
00438       result->angle_velocity = attr.float_val;
00439     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
00440       result->bound_x1 = attr.float_val;
00441     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
00442       result->bound_y1 = attr.float_val;
00443     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
00444       result->bound_x2 = attr.float_val;
00445     else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
00446       result->bound_y2 = attr.float_val;
00447   }
00448 
00449   return result;
00450 }
00451 
00452 static const char* s_gestures[] =
00453 {
00454   GEIS_GESTURE_TYPE_DRAG3, GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TYPE_ROTATE3, GEIS_GESTURE_TYPE_PINCH3, GEIS_GESTURE_TYPE_TOUCH3,
00455   GEIS_GESTURE_TYPE_DRAG4, GEIS_GESTURE_TYPE_TAP4, GEIS_GESTURE_TYPE_ROTATE4, GEIS_GESTURE_TYPE_PINCH4, GEIS_GESTURE_TYPE_TOUCH4,
00456   GEIS_GESTURE_TYPE_SYSTEM,
00457   NULL
00458 };
00459 
00460 void
00461 GeisAdapter::RegisterRootInstance()
00462 {
00463   static GeisInputFuncs input_funcs =
00464   {
00465     &GeisAdapter::InputDeviceAdded,
00466     &GeisAdapter::InputDeviceChanged,
00467     &GeisAdapter::InputDeviceRemoved
00468   };
00469 
00470   static GeisGestureFuncs gesture_funcs =
00471   {
00472     &GeisAdapter::GestureAdded,
00473     &GeisAdapter::GestureRemoved,
00474     &GeisAdapter::GestureStart,
00475     &GeisAdapter::GestureUpdate,
00476     &GeisAdapter::GestureFinish
00477   };
00478 
00479   GeisStatus status = GEIS_UNKNOWN_ERROR;
00480 
00481   GeisXcbWinInfo xcb_win_info;
00482   xcb_win_info.display_name  = NULL,
00483                xcb_win_info.screenp       = NULL,
00484                             xcb_win_info.window_id     = gdk_x11_get_default_root_xwindow();
00485 
00486   GeisWinInfo win_info =
00487   {
00488     GEIS_XCB_FULL_WINDOW,
00489     &xcb_win_info
00490   };
00491   GeisInstance instance;
00492 
00493   status = geis_init(&win_info, &instance);
00494   if (status != GEIS_STATUS_SUCCESS)
00495   {
00496     fprintf(stderr, "error in geis_init\n");
00497     return;
00498   }
00499 
00500   status = geis_input_devices(instance, &input_funcs, this);
00501   if (status != GEIS_STATUS_SUCCESS)
00502   {
00503     fprintf(stderr, "error subscribing to input devices\n");
00504     geis_finish(instance);
00505     return;
00506   }
00507 
00508   status = geis_subscribe(instance,
00509                           GEIS_ALL_INPUT_DEVICES,
00510                           s_gestures,
00511                           &gesture_funcs,
00512                           this);
00513   if (status != GEIS_STATUS_SUCCESS)
00514   {
00515     fprintf(stderr, "error subscribing to gestures\n");
00516     geis_finish(instance);
00517     return;
00518   }
00519 
00520   _root_instance = instance;
00521 }