/src/org/mt4j/util/manyMouse/ManyMouse.java

http://mt4j.googlecode.com/ · Java · 83 lines · 17 code · 18 blank · 48 comment · 2 complexity · c16c07c071128c8e5bcc69a4a27c4df9 MD5 · raw file

  1. package org.mt4j.util.manyMouse;
  2. import java.io.File;
  3. /*
  4. * Java bindings to the ManyMouse C code, via JNI.
  5. *
  6. * Please see the file LICENSE.txt in the source's root directory.
  7. *
  8. * This file written by Ryan C. Gordon.
  9. */
  10. /**
  11. * The Class ManyMouse.
  12. */
  13. public class ManyMouse{
  14. // JNI link.
  15. static {
  16. //TODO compile library on linux/osx
  17. if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
  18. System.loadLibrary("ManyMouse");
  19. }else if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) {
  20. // System.loadLibrary("ManyMouse"); //FIXME why not working?
  21. System.load(System.getProperty("user.dir") + File.separator + "ManyMouse.so");
  22. }
  23. }
  24. // static { System.load("D:\\Eclipse Workspace\\MTMetaCollab\\ManyMouse.dll"); }
  25. // Native method hooks.
  26. /**
  27. * Inits the.
  28. *
  29. * @return the int
  30. */
  31. public native static synchronized int Init();
  32. /**
  33. * Java_ many mouse_ init.
  34. *
  35. * @return the int
  36. */
  37. public native static synchronized int Java_ManyMouse_Init();
  38. /**
  39. * Many mouse_ init.
  40. *
  41. * @return the int
  42. */
  43. public native static synchronized int ManyMouse_Init();
  44. /**
  45. * Quit.
  46. */
  47. public native static synchronized void Quit();
  48. /**
  49. * Device name.
  50. *
  51. * @param index the index
  52. *
  53. * @return the string
  54. */
  55. public native static synchronized String DeviceName(int index);
  56. /**
  57. * Poll event.
  58. *
  59. * @param event the event
  60. *
  61. * @return true, if successful
  62. */
  63. public native static synchronized boolean PollEvent(ManyMouseEvent event);
  64. } // ManyMouse
  65. // end of ManyMouse.java ...