Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > PocketBook > PocketBook Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-19-2012, 03:36 PM   #1
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: 1,696
Karma: 4339998
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Programming pinch events on the Touch

Does anyone know anything about handling pinch events within the Inkview API? The SDK hasn't been updated in a while, and there are new events showing up in the handler that aren't defined in inkview.h. Specifically event types 39 and 44 are showing up. EVT_TOUCHUP is 40, EVT_TOUCHDOWN is 41, and EVT_TOUCHMOVE is 42, so the new types are probably touch related, as well. I suspect that they are necessary to handle pinch events, but I have no idea how. Even source code for a program that handles pinches would be good. Is there no one writing applications for the Touch?
rkomar is online now   Reply With Quote
Old 11-27-2012, 02:46 AM   #2
DmitryZ
Junior Member
DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.
 
Posts: 2
Karma: 11426
Join Date: Mar 2010
Device: PocketBook 301+
Event 39 is EVT_MTSYNC, for multi-touch handling, par2 is touch count. Full information about the event is obtained with GetTouchInfo() function, it returns an array of iv_mtinfo structures. Here is an example:
iv_mtinfo *mti = GetTouchInfo();
int tcnt = par2;
int cx = (tcnt > 1) ? (mti[0].x + mti[1].x) / 2 : mti[0].x;
int cy = (tcnt > 1) ? (mti[0].y + mti[1].y) / 2 : mti[0].y;

Event 44 is EVT_POINTERDRAG, like EVT_POINTERMOVE but with some dead zone, to filter accidental finger move.
DmitryZ is offline   Reply With Quote
Old 11-27-2012, 03:19 AM   #3
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: 1,696
Karma: 4339998
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Thanks! The 1.1a release of the SDK doesn't include the definition of iv_mtinfo. Does it look like this?:

Code:
typedef struct iv_mtinfo_s {
  int x;
  int y;
} iv_mtinfo;
or are short variables used instead of int, perhaps? Are there any other variables in the struct?

Also, will par2 (touch count) only ever be 1 or 2, or can there be more than that (for example, if three fingers are used)? I assume that the iv_mtinfo array only includes points from a single point in time, and not from multiple points concatenated together.

Finally, does par1 mean anything in EVT_MYSYNC events?

Oops, one more question: should the iv_mtinfo array returned by GetTouchInfo() be freed?

Last edited by rkomar; 11-27-2012 at 02:33 PM. Reason: Added another question
rkomar is online now   Reply With Quote
Old 11-27-2012, 06:49 PM   #4
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: 1,696
Karma: 4339998
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
There is no GetTouchInfo() function in libinkview.so within the 1.1a SDK. I guess this means that I cannot build an executable that handles multi-touch events until a new SDK comes out. Too bad. The function is also missing from libinkview.so on my 902 reader (2.1.3 firmware), so a different executable would have to be built for the Touch, or I'd have to figure out how to dynamically use the function.

Edit: I looks like I can build it using dlopen()/dlsym() to call the GetTouchInfo function if it exists. It's ugly code, though.

Last edited by rkomar; 11-27-2012 at 07:44 PM. Reason: Added comment about being able to build without GetTouchInfo().
rkomar is online now   Reply With Quote
Old 11-30-2012, 02:06 AM   #5
DmitryZ
Junior Member
DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.DmitryZ can tame squirrels without the assistance of a chair or a whip.
 
Posts: 2
Karma: 11426
Join Date: Mar 2010
Device: PocketBook 301+
Here is an actual inkview.h, with all needed structures and functions.
For 902, it's not a problem - you will call GetTouchInfo() only from MTSYNC event, there's no such event on 902, and because of lazy resolving, "unresolved symbol" will not occur.
Attached Files
File Type: zip inkview.zip (16.0 KB, 88 views)
DmitryZ is offline   Reply With Quote
Old 11-30-2012, 03:02 AM   #6
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: 1,696
Karma: 4339998
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Thank you very much. The iv_mtinfo struct is quite different from what I imagined, so my guess would not have worked.

I cannot get the application to link if I call GetTouchInfo() because it is missing from my libinkview.so (SDK 1.1a). Anyways, it doesn't matter because I can use dlopen/dlsym to make the call inside the if(type == EVT_MTSYNC) {} block for now. I will have to wait for an updated SDK before I can write code to call the function directly.
rkomar is online now   Reply With Quote
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: 1,696
Karma: 4339998
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
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 online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
kindle pw pinch to zoom in pdf max99 Amazon Kindle 0 10-29-2012 08:19 AM
Detecting headphone events on kindle touch inuxy Kindle Developer's Corner 4 07-15-2012 11:38 AM
Touch uinput : send simulated touch/key events to Kobo ? Rom1 Kobo Reader 0 06-08-2012 08:50 AM
Touch screen events Ehhh Kindle Developer's Corner 3 05-16-2012 02:33 PM
pinch to zoom on the kindle touch Cavestory Amazon Kindle 9 10-14-2011 01:11 PM


All times are GMT -4. The time now is 08:49 PM.


MobileRead.com is a privately owned, operated and funded community.