View Single Post
Old 12-25-2012, 05:03 PM   #7
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,986
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
If anyone wants to know how to call GetTouchInfo() (or any other function) if it isn't part of their SDK, here's some simple example code showing how to do it:

Code:
#include <stdio.h>
#include <dlfcn.h>

#define EVT_MTSYNC 39
#define EVT_POINTERDRAG 44

typedef struct iv_mtinfo_s {
  int active;
  int x;
  int y;
  int pressure;
  int rsv_1;
  int rsv_2;
} iv_mtinfo;

iv_mtinfo* (*gti)(void);  /* Pointer to GetTouchInfo() function. */

int main_handler(int type, int par1, int par2) {
  void *handle;
  iv_mtinfo *mti;
  int i;

  if (type == EVT_INIT) {
    if ((handle = dlopen("libinkview.so", RTLD_LAZY))) {
      *(void **) (&gti) = dlsym(handle, "GetTouchInfo");
      dlclose(handle);
    } else
      gti = NULL;
  }
 
  if type == EVT_MTSYNC) {
    if (gti && (mti = (*gti)())) {
      for (i = 0; i < par2; i++)
        printf("   x = %d, y = %d\n", mti[i].x, mti[i].y);
    }
  }

  return 0;
}
Hopefully, this will go away when a new SDK comes out.

Last edited by rkomar; 12-25-2012 at 06:16 PM.
rkomar is offline   Reply With Quote