~oif-team/geis/client-arch

« back to all changes in this revision

Viewing changes to libutouch-geis/geis.c

  • Committer: Stephen M. Webb
  • Date: 2011-10-17 21:52:08 UTC
  • mfrom: (197.1.9 autodiscover-backend)
  • Revision ID: stephen.webb@canonical.com-20111017215208-gk9v99iouh4d07do
Added back-end autodiscovery and failover.

The default back end is now DBus, with a fallback to XCB if the DBus server is not detected.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
  GeisSubBag              subscription_bag;
70
70
  GeisBackendMultiplexor  backend_multiplexor;
71
71
  GeisBackend             backend;
 
72
  GeisBoolean             backend_pending;
72
73
  GeisDBusServer          server; /* @TODO: replace me */
73
74
  GeisEventQueue          input_event_queue;
74
75
  int                     input_event_signal_pipe[2];
228
229
          handled = _class_event_handler(geis, event);
229
230
          break;
230
231
 
 
232
        case GEIS_EVENT_INIT_COMPLETE:
 
233
          geis->backend_pending = GEIS_FALSE;
 
234
          break;
 
235
 
 
236
        case GEIS_EVENT_ERROR:
 
237
          if (geis->backend_pending)
 
238
          {
 
239
            geis->backend = geis_backend_by_name(geis,
 
240
                                                 GEIS_INIT_UTOUCH_XCB_BACKEND);
 
241
            geis->backend_pending = GEIS_FALSE;
 
242
            handled = GEIS_TRUE;
 
243
          }
 
244
          break;
 
245
 
231
246
        default:
232
247
          break;
233
248
      }
537
552
  else if (back_end_type == BACK_END_TYPE_DBUS)
538
553
  {
539
554
    geis->backend = geis_backend_by_name(geis, GEIS_INIT_UTOUCH_DBUS_BACKEND);
 
555
    geis->backend_pending = GEIS_TRUE;
540
556
  }
541
557
  else if (back_end_type == BACK_END_TYPE_XCB)
542
558
  {
544
560
  }
545
561
  else
546
562
  {
547
 
    geis_warning("back end not specified, defaulting to XCB");
548
 
    geis->backend = geis_backend_by_name(geis, GEIS_INIT_UTOUCH_XCB_BACKEND);
 
563
    geis_warning("back end not specified, defaulting to DBus");
 
564
    geis->backend = geis_backend_by_name(geis, GEIS_INIT_UTOUCH_DBUS_BACKEND);
 
565
    geis->backend_pending = GEIS_TRUE;
549
566
  }
550
567
  if (!geis->backend)
551
568
  {
901
918
}
902
919
 
903
920
 
904
 
GeisSubBag
905
 
geis_subscription_bag(Geis geis)
906
 
{
907
 
  return geis->subscription_bag;
 
921
GeisSize
 
922
geis_add_subscription(Geis geis, GeisSubscription subscription)
 
923
{
 
924
  return geis_subscription_bag_insert(geis->subscription_bag, subscription);
 
925
}
 
926
 
 
927
void
 
928
geis_remove_subscription(Geis geis, GeisSubscription subscription)
 
929
{
 
930
  geis_subscription_bag_remove(geis->subscription_bag, subscription);
908
931
}
909
932
 
910
933