Fixed linux compile
This commit is contained in:
parent
988f115218
commit
a6bd8e7fa4
|
@ -6,8 +6,7 @@ INCLUDES = -I../common
|
||||||
NATIVE = \
|
NATIVE = \
|
||||||
org_lwjgl_Display.cpp \
|
org_lwjgl_Display.cpp \
|
||||||
org_lwjgl_Sys.cpp \
|
org_lwjgl_Sys.cpp \
|
||||||
org_lwjgl_input_GamePad.cpp \
|
org_lwjgl_input_Controller.cpp \
|
||||||
org_lwjgl_input_Joystick.cpp \
|
|
||||||
org_lwjgl_input_Keyboard.cpp \
|
org_lwjgl_input_Keyboard.cpp \
|
||||||
org_lwjgl_input_Mouse.cpp \
|
org_lwjgl_input_Mouse.cpp \
|
||||||
org_lwjgl_opengl_BaseGL.cpp
|
org_lwjgl_opengl_BaseGL.cpp
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
* Copyright (c) 2002 Lightweight Java Game Library Project
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -32,39 +32,39 @@
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Win32 analogue joystick handling.
|
* Win32 controller handling.
|
||||||
*
|
*
|
||||||
* @author Brian Matzon <brian@matzon.com>
|
* @author Brian Matzon <brian@matzon.com>
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
|
#include <jni.h>
|
||||||
#include "org_lwjgl_input_Joystick.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes any field ids
|
* Initializes any field ids
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Joystick_initIDs(JNIEnv * env, jclass clazz) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_initIDs(JNIEnv * env, jclass clazz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the Joystick instance is to be created
|
* Called when the Controller instance is to be created
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Joystick_nCreate(JNIEnv *env, jclass clazz) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) {
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_input_Joystick
|
* Class: org_lwjgl_input_Controller
|
||||||
* Method: nDestroy
|
* Method: nDestroy
|
||||||
* Signature: ()V
|
* Signature: ()V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Joystick_nDestroy(JNIEnv *env, jclass clazz) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nDestroy(JNIEnv *env, jclass clazz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_input_Joystick
|
* Class: org_lwjgl_input_Controller
|
||||||
* Method: nPoll
|
* Method: nPoll
|
||||||
* Signature: ()V
|
* Signature: ()V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Joystick_nPoll(JNIEnv * env, jclass clazz) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nPoll(JNIEnv * env, jclass clazz) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,117 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2002 Light Weight Java Game Library Project
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of
|
|
||||||
* its contributors may be used to endorse or promote products derived
|
|
||||||
* from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
||||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Win32 digital (Atari) joystick handling. These days it's a gamepad.
|
|
||||||
*
|
|
||||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
|
||||||
* @version $Revision$
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "org_lwjgl_input_GamePad.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_lwjgl_input_GamePad
|
|
||||||
* Method: initIDs
|
|
||||||
* Signature: ()V
|
|
||||||
*/
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_GamePad_initIDs
|
|
||||||
(JNIEnv * env, jclass clazz) {}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_lwjgl_input_GamePad
|
|
||||||
* Method: nCreate
|
|
||||||
* Signature: ()Z
|
|
||||||
*/
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_GamePad_nCreate
|
|
||||||
(JNIEnv * env, jclass clazz)
|
|
||||||
{
|
|
||||||
printf("GamePad not implemented yet!\n");
|
|
||||||
return JNI_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_lwjgl_input_GamePad
|
|
||||||
* Method: nDestroy
|
|
||||||
* Signature: ()V
|
|
||||||
*/
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_GamePad_nDestroy
|
|
||||||
(JNIEnv * env, jclass clazz)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_lwjgl_input_GamePad
|
|
||||||
* Method: nPoll
|
|
||||||
* Signature: (I)V
|
|
||||||
*/
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_GamePad_nPoll
|
|
||||||
(JNIEnv * env, jclass clazz, jint buf)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_lwjgl_input_GamePad
|
|
||||||
* Method: nRead
|
|
||||||
* Signature: (I)I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_GamePad_nRead
|
|
||||||
(JNIEnv * env, jclass clazz, jint buf)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_lwjgl_input_GamePad
|
|
||||||
* Method: nEnableBuffer
|
|
||||||
* Signature: ()I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_GamePad_nEnableBuffer
|
|
||||||
(JNIEnv * env, jclass clazz)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: org_lwjgl_input_GamePad
|
|
||||||
* Method: nGetNumButtons
|
|
||||||
* Signature: ()I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_GamePad_nGetNumButtons
|
|
||||||
(JNIEnv * env, jclass clazz)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "org_lwjgl_input_Keyboard.h"
|
#include "org_lwjgl_input_Keyboard.h"
|
||||||
|
@ -51,20 +52,16 @@
|
||||||
|
|
||||||
unsigned char readBuffer[KEYBOARD_BUFFER_SIZE * 2];
|
unsigned char readBuffer[KEYBOARD_BUFFER_SIZE * 2];
|
||||||
jfieldID fid_readBuffer;
|
jfieldID fid_readBuffer;
|
||||||
jfieldID fid_readBufferAddress;
|
|
||||||
unsigned char key_buf[KEYBOARD_SIZE];
|
unsigned char key_buf[KEYBOARD_SIZE];
|
||||||
unsigned char key_map[KEYBOARD_SIZE];
|
unsigned char key_map[KEYBOARD_SIZE];
|
||||||
|
|
||||||
typedef struct {
|
XKeyEvent saved_key_events[KEY_EVENT_BACKLOG];
|
||||||
unsigned char keycode;
|
|
||||||
unsigned char state;
|
|
||||||
} input_event;
|
|
||||||
|
|
||||||
input_event saved_key_events[KEY_EVENT_BACKLOG];
|
|
||||||
int list_start = 0;
|
int list_start = 0;
|
||||||
int list_end = 0;
|
int list_end = 0;
|
||||||
|
|
||||||
bool keyboard_grabbed;
|
bool keyboard_grabbed;
|
||||||
|
bool buffer_enabled;
|
||||||
|
bool translation_enabled;
|
||||||
|
|
||||||
extern Display *disp;
|
extern Display *disp;
|
||||||
extern Window win;
|
extern Window win;
|
||||||
|
@ -88,7 +85,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_initIDs
|
||||||
}
|
}
|
||||||
|
|
||||||
fid_readBuffer = env->GetStaticFieldID(clazz, "readBuffer", "Ljava/nio/ByteBuffer;");
|
fid_readBuffer = env->GetStaticFieldID(clazz, "readBuffer", "Ljava/nio/ByteBuffer;");
|
||||||
fid_readBufferAddress = env->GetStaticFieldID(clazz, "readBufferAddress", "I");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int grabKeyboard(void) {
|
int grabKeyboard(void) {
|
||||||
|
@ -127,7 +123,10 @@ int updateKeyboardGrab(void) {
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nCreate
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nCreate
|
||||||
(JNIEnv * env, jclass clazz)
|
(JNIEnv * env, jclass clazz)
|
||||||
{
|
{
|
||||||
keyboard_grabbed = 0;
|
keyboard_grabbed = false;
|
||||||
|
translation_enabled = false;
|
||||||
|
buffer_enabled = false;
|
||||||
|
|
||||||
if (updateKeyboardGrab() != GrabSuccess) {
|
if (updateKeyboardGrab() != GrabSuccess) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Could not grab keyboard\n");
|
printf("Could not grab keyboard\n");
|
||||||
|
@ -170,29 +169,68 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy
|
||||||
ungrabKeyboard();
|
ungrabKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
input_event *nextEventElement(void) {
|
XKeyEvent *nextEventElement(void) {
|
||||||
if (list_start == list_end)
|
if (list_start == list_end)
|
||||||
return NULL;
|
return NULL;
|
||||||
input_event *result = &(saved_key_events[list_start]);
|
XKeyEvent *result = &(saved_key_events[list_start]);
|
||||||
list_start = (list_start + 1)%KEY_EVENT_BACKLOG;
|
list_start = (list_start + 1)%KEY_EVENT_BACKLOG;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void putEventElement(unsigned char keycode, unsigned char state) {
|
void putEventElement(XKeyEvent *event) {
|
||||||
int next_index = (list_end + 1)%KEY_EVENT_BACKLOG;
|
int next_index = (list_end + 1)%KEY_EVENT_BACKLOG;
|
||||||
if (next_index == list_start)
|
if (next_index == list_start)
|
||||||
return;
|
return;
|
||||||
saved_key_events[list_end].keycode = keycode;
|
saved_key_events[list_end] = *event;
|
||||||
saved_key_events[list_end].state = state;
|
|
||||||
list_end = next_index;
|
list_end = next_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char getKeycode(XEvent *event) {
|
unsigned char getKeycode(XKeyEvent *event) {
|
||||||
unsigned char keycode = (unsigned char)((event->xkey.keycode - 8) & 0xff);
|
unsigned char keycode = (unsigned char)((event->keycode - 8) & 0xff);
|
||||||
keycode = key_map[keycode];
|
keycode = key_map[keycode];
|
||||||
return keycode;
|
return keycode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int translateEvent(int *position, XKeyEvent *event) {
|
||||||
|
static char temp_translation_buffer[KEYBOARD_BUFFER_SIZE];
|
||||||
|
static XComposeStatus status;
|
||||||
|
int num_chars, i;
|
||||||
|
|
||||||
|
if (*position >= KEYBOARD_BUFFER_SIZE * 2)
|
||||||
|
return 0;
|
||||||
|
if (event->type == KeyRelease) {
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
num_chars = XLookupString(event, temp_translation_buffer, KEYBOARD_BUFFER_SIZE, NULL, &status);
|
||||||
|
if (num_chars > 0) {
|
||||||
|
num_chars--;
|
||||||
|
/* Assume little endian byte order */
|
||||||
|
readBuffer[(*position)++] = temp_translation_buffer[0];
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
for (i = 0; i < num_chars; i++) {
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
readBuffer[(*position)++] = temp_translation_buffer[i + 1];
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
readBuffer[(*position)++] = 0;
|
||||||
|
}
|
||||||
|
return num_chars;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char eventState(XKeyEvent *event) {
|
||||||
|
if (event->type == KeyPress) {
|
||||||
|
return 1;
|
||||||
|
} else if (event->type == KeyRelease) {
|
||||||
|
return 0;
|
||||||
|
} else
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_input_Keyboard
|
* Class: org_lwjgl_input_Keyboard
|
||||||
* Method: nPoll
|
* Method: nPoll
|
||||||
|
@ -202,20 +240,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll
|
||||||
(JNIEnv * env, jclass clazz, jint buf)
|
(JNIEnv * env, jclass clazz, jint buf)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
int state;
|
unsigned char state;
|
||||||
|
|
||||||
updateKeyboardGrab();
|
updateKeyboardGrab();
|
||||||
|
|
||||||
while (XCheckMaskEvent(disp, KeyPressMask | KeyReleaseMask, &event)) {
|
while (XCheckMaskEvent(disp, KeyPressMask | KeyReleaseMask, &event)) {
|
||||||
unsigned char keycode = getKeycode(&event);
|
unsigned char keycode = getKeycode(&(event.xkey));
|
||||||
if (event.type == KeyPress) {
|
state = eventState(&(event.xkey));
|
||||||
state = 1;
|
|
||||||
} else if (event.type == KeyRelease) {
|
|
||||||
state = 0;
|
|
||||||
} else
|
|
||||||
assert(0);
|
|
||||||
key_buf[keycode] = state;
|
key_buf[keycode] = state;
|
||||||
putEventElement(keycode, state);
|
if (buffer_enabled)
|
||||||
|
putEventElement(&(event.xkey));
|
||||||
}
|
}
|
||||||
memcpy((unsigned char*)buf, key_buf, KEYBOARD_SIZE*sizeof(unsigned char));
|
memcpy((unsigned char*)buf, key_buf, KEYBOARD_SIZE*sizeof(unsigned char));
|
||||||
}
|
}
|
||||||
|
@ -225,43 +259,51 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll
|
||||||
* Method: nRead
|
* Method: nRead
|
||||||
* Signature: (I)V
|
* Signature: (I)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead
|
JNIEXPORT int JNICALL Java_org_lwjgl_input_Keyboard_nRead
|
||||||
(JNIEnv * env, jclass clazz, jint keys)
|
(JNIEnv * env, jclass clazz)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
int count = 0;
|
XKeyEvent *key_event;
|
||||||
int buf_count = 0;
|
int buf_count = 0;
|
||||||
int state;
|
int state;
|
||||||
input_event *input_ev;
|
int num_events = 0;
|
||||||
unsigned char *result_buf = (unsigned char *)keys;
|
|
||||||
|
|
||||||
updateKeyboardGrab();
|
updateKeyboardGrab();
|
||||||
|
|
||||||
while ((input_ev = nextEventElement()) != NULL) {
|
while (buf_count < KEYBOARD_BUFFER_SIZE * 2 && (key_event = nextEventElement()) != NULL) {
|
||||||
count++;
|
num_events++;
|
||||||
// printf("Reading a key %d %d count %d\n", (int)input_ev->keycode, (int)input_ev->state, count);
|
unsigned char keycode = getKeycode(key_event);
|
||||||
result_buf[buf_count++] = input_ev->keycode;
|
unsigned char state = eventState(key_event);
|
||||||
result_buf[buf_count++] = input_ev->state;
|
// printf("Reading a key %d %d count %d\n", (int)keycode, (int)state, num_events);
|
||||||
if (buf_count >= KEYBOARD_BUFFER_SIZE * 2)
|
readBuffer[buf_count++] = keycode;
|
||||||
return count;
|
readBuffer[buf_count++] = state;
|
||||||
|
if (translation_enabled)
|
||||||
|
num_events += translateEvent(&buf_count, key_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (XCheckMaskEvent(disp, KeyPressMask | KeyReleaseMask, &event)) {
|
while (buf_count < KEYBOARD_BUFFER_SIZE * 2 && XCheckMaskEvent(disp, KeyPressMask | KeyReleaseMask, &event)) {
|
||||||
count++;
|
num_events++;
|
||||||
unsigned char keycode = getKeycode(&event);
|
unsigned char keycode = getKeycode(&(event.xkey));
|
||||||
if (event.type == KeyPress) {
|
unsigned char state = eventState(&(event.xkey));
|
||||||
state = 1;
|
// printf("Reading a key %d %d count %d\n", (int)keycode, (int)state, num_events);
|
||||||
} else if (event.type == KeyRelease) {
|
|
||||||
state = 0;
|
|
||||||
} else
|
|
||||||
assert(0);
|
|
||||||
key_buf[keycode] = state;
|
key_buf[keycode] = state;
|
||||||
result_buf[buf_count++] = keycode;
|
readBuffer[buf_count++] = keycode;
|
||||||
result_buf[buf_count++] = state;
|
readBuffer[buf_count++] = state;
|
||||||
if (buf_count >= KEYBOARD_BUFFER_SIZE * 2)
|
if (translation_enabled)
|
||||||
return count;
|
num_events += translateEvent(&buf_count, &(event.xkey));
|
||||||
}
|
}
|
||||||
return count;
|
return num_events;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_lwjgl_input_Keyboard
|
||||||
|
* Method: nEnableTranslation
|
||||||
|
* Signature: ()I
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation
|
||||||
|
(JNIEnv *env, jclass clazz)
|
||||||
|
{
|
||||||
|
translation_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -274,6 +316,6 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer
|
||||||
{
|
{
|
||||||
jobject newBuffer = env->NewDirectByteBuffer(&readBuffer, KEYBOARD_BUFFER_SIZE * 2);
|
jobject newBuffer = env->NewDirectByteBuffer(&readBuffer, KEYBOARD_BUFFER_SIZE * 2);
|
||||||
env->SetStaticObjectField(clazz, fid_readBuffer, newBuffer);
|
env->SetStaticObjectField(clazz, fid_readBuffer, newBuffer);
|
||||||
env->SetStaticIntField(clazz, fid_readBufferAddress, (jint) (&readBuffer));
|
buffer_enabled = true;
|
||||||
return KEYBOARD_BUFFER_SIZE;
|
return KEYBOARD_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue