Linux: Moved screen from native to java
This commit is contained in:
parent
8296ae06cb
commit
61e7c9e081
|
@ -117,7 +117,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
incDisplay();
|
||||
try {
|
||||
if (isXF86VidModeSupported())
|
||||
return nGetCurrentGammaRamp(getDisplay());
|
||||
return nGetCurrentGammaRamp(getDisplay(), getDefaultScreen());
|
||||
else
|
||||
return null;
|
||||
} finally {
|
||||
|
@ -127,7 +127,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
unlockAWT();
|
||||
}
|
||||
}
|
||||
private static native ByteBuffer nGetCurrentGammaRamp(long display) throws LWJGLException;
|
||||
private static native ByteBuffer nGetCurrentGammaRamp(long display, int screen) throws LWJGLException;
|
||||
|
||||
private static int getBestDisplayModeExtension() {
|
||||
int result;
|
||||
|
@ -189,7 +189,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
try {
|
||||
incDisplay();
|
||||
try {
|
||||
return nIsNetWMFullscreenSupported(getDisplay());
|
||||
return nIsNetWMFullscreenSupported(getDisplay(), getDefaultScreen());
|
||||
} finally {
|
||||
decDisplay();
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
unlockAWT();
|
||||
}
|
||||
}
|
||||
private static native boolean nIsNetWMFullscreenSupported(long display) throws LWJGLException;
|
||||
private static native boolean nIsNetWMFullscreenSupported(long display, int screen) throws LWJGLException;
|
||||
|
||||
/* Since Xlib is not guaranteed to be thread safe, we need a way to synchronize LWJGL
|
||||
* Xlib calls with AWT Xlib calls. Fortunately, JAWT implements Lock()/Unlock() to
|
||||
|
@ -289,7 +289,11 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
return display;
|
||||
}
|
||||
|
||||
private static native int getScreen();
|
||||
static int getDefaultScreen() {
|
||||
return nGetDefaultScreen(getDisplay());
|
||||
}
|
||||
private static native int nGetDefaultScreen(long display);
|
||||
|
||||
private static native long getWindow();
|
||||
|
||||
private void ungrabKeyboard() {
|
||||
|
@ -316,7 +320,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
pointer_grabbed = true;
|
||||
// make sure we have a centered window
|
||||
if (isLegacyFullscreen()) {
|
||||
nSetViewPort(getDisplay(), getWindow(), getScreen());
|
||||
nSetViewPort(getDisplay(), getWindow(), getDefaultScreen());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,7 +383,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
ByteBuffer handle = peer_info.lockAndGetHandle();
|
||||
try {
|
||||
current_window_mode = getWindowMode(fullscreen);
|
||||
nCreateWindow(getDisplay(), handle, mode, current_window_mode, x, y);
|
||||
nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y);
|
||||
blank_cursor = createBlankCursor();
|
||||
current_cursor = null;
|
||||
focused = true;
|
||||
|
@ -403,7 +407,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
unlockAWT();
|
||||
}
|
||||
}
|
||||
private static native void nCreateWindow(long display, ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y) throws LWJGLException;
|
||||
private static native void nCreateWindow(long display, int screen, ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y) throws LWJGLException;
|
||||
|
||||
private void updateInputGrab() {
|
||||
updatePointerGrab();
|
||||
|
@ -443,7 +447,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
private void switchDisplayModeOnTmpDisplay(DisplayMode mode) throws LWJGLException {
|
||||
long tmp_display = openDisplay();
|
||||
try {
|
||||
nSwitchDisplayMode(tmp_display, getScreen(), current_displaymode_extension, mode);
|
||||
nSwitchDisplayMode(tmp_display, nGetDefaultScreen(tmp_display), current_displaymode_extension, mode);
|
||||
} finally {
|
||||
closeDisplay(tmp_display);
|
||||
}
|
||||
|
@ -485,7 +489,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
try {
|
||||
incDisplay();
|
||||
try {
|
||||
return nGetGammaRampLength(getDisplay(), getScreen());
|
||||
return nGetGammaRampLength(getDisplay(), getDefaultScreen());
|
||||
} catch (LWJGLException e) {
|
||||
LWJGLUtil.log("Got exception while querying gamma length: " + e);
|
||||
return 0;
|
||||
|
@ -521,7 +525,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
private void setGammaRampOnTmpDisplay(ByteBuffer native_gamma) throws LWJGLException {
|
||||
long tmp_display = openDisplay();
|
||||
try {
|
||||
nSetGammaRamp(tmp_display, getScreen(), native_gamma);
|
||||
nSetGammaRamp(tmp_display, nGetDefaultScreen(tmp_display), native_gamma);
|
||||
} finally {
|
||||
closeDisplay(tmp_display);
|
||||
}
|
||||
|
@ -575,7 +579,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
try {
|
||||
incDisplay();
|
||||
try {
|
||||
return nGetCurrentXRandrMode(getDisplay());
|
||||
return nGetCurrentXRandrMode(getDisplay(), getDefaultScreen());
|
||||
} finally {
|
||||
decDisplay();
|
||||
}
|
||||
|
@ -585,7 +589,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
}
|
||||
|
||||
/** Assumes extension == XRANDR */
|
||||
private static native DisplayMode nGetCurrentXRandrMode(long display) throws LWJGLException;
|
||||
private static native DisplayMode nGetCurrentXRandrMode(long display, int screen) throws LWJGLException;
|
||||
|
||||
public void setTitle(String title) {
|
||||
lockAWT();
|
||||
|
@ -650,7 +654,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
try {
|
||||
incDisplay();
|
||||
try {
|
||||
DisplayMode[] modes = nGetAvailableDisplayModes(getDisplay(), current_displaymode_extension);
|
||||
DisplayMode[] modes = nGetAvailableDisplayModes(getDisplay(), getDefaultScreen(), current_displaymode_extension);
|
||||
return modes;
|
||||
} finally {
|
||||
decDisplay();
|
||||
|
@ -659,7 +663,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
unlockAWT();
|
||||
}
|
||||
}
|
||||
private static native DisplayMode[] nGetAvailableDisplayModes(long display, int extension) throws LWJGLException;
|
||||
private static native DisplayMode[] nGetAvailableDisplayModes(long display, int screen, int extension) throws LWJGLException;
|
||||
|
||||
/* Mouse */
|
||||
public boolean hasWheel() {
|
||||
|
@ -729,7 +733,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
nSetRepeatMode(getDisplay(), AutoRepeatModeDefault);
|
||||
updateInputGrab();
|
||||
if (current_window_mode == FULLSCREEN_NETWM) {
|
||||
nIconifyWindow(getDisplay(), getWindow(), getScreen());
|
||||
nIconifyWindow(getDisplay(), getWindow(), getDefaultScreen());
|
||||
try {
|
||||
switchDisplayModeOnTmpDisplay(saved_mode);
|
||||
setGammaRampOnTmpDisplay(saved_gamma);
|
||||
|
@ -919,7 +923,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
try {
|
||||
incDisplay();
|
||||
try {
|
||||
return nGetPbufferCapabilities(getDisplay());
|
||||
return nGetPbufferCapabilities(getDisplay(), getDefaultScreen());
|
||||
} finally {
|
||||
decDisplay();
|
||||
}
|
||||
|
@ -930,7 +934,7 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
unlockAWT();
|
||||
}
|
||||
}
|
||||
private static native int nGetPbufferCapabilities(long display);
|
||||
private static native int nGetPbufferCapabilities(long display, int screen);
|
||||
|
||||
public boolean isBufferLost(PeerInfo handle) {
|
||||
return false;
|
||||
|
|
|
@ -49,7 +49,7 @@ final class LinuxDisplayPeerInfo extends LinuxPeerInfo {
|
|||
try {
|
||||
LinuxDisplay.incDisplay();
|
||||
try {
|
||||
initDefaultPeerInfo(LinuxDisplay.getDisplay(), getHandle(), pixel_format);
|
||||
initDefaultPeerInfo(LinuxDisplay.getDisplay(), LinuxDisplay.getDefaultScreen(), getHandle(), pixel_format);
|
||||
} catch (LWJGLException e) {
|
||||
LinuxDisplay.decDisplay();
|
||||
throw e;
|
||||
|
@ -62,7 +62,7 @@ final class LinuxDisplayPeerInfo extends LinuxPeerInfo {
|
|||
LinuxDisplay.unlockAWT();
|
||||
}
|
||||
}
|
||||
private static native void initDefaultPeerInfo(long display, ByteBuffer peer_info_handle, PixelFormat pixel_format) throws LWJGLException;
|
||||
private static native void initDefaultPeerInfo(long display, int screen, ByteBuffer peer_info_handle, PixelFormat pixel_format) throws LWJGLException;
|
||||
|
||||
protected void doLockAndInitHandle() throws LWJGLException {
|
||||
LinuxDisplay.lockAWT();
|
||||
|
|
|
@ -63,6 +63,7 @@ final class LinuxMouse {
|
|||
|
||||
private final long display;
|
||||
private final long window;
|
||||
private final long warp_atom;
|
||||
private final IntBuffer query_pointer_buffer = BufferUtils.createIntBuffer(4);
|
||||
private final ByteBuffer event_buffer = ByteBuffer.allocate(Mouse.EVENT_SIZE);
|
||||
|
||||
|
@ -75,9 +76,10 @@ final class LinuxMouse {
|
|||
private EventQueue event_queue;
|
||||
private long last_event_nanos;
|
||||
|
||||
public LinuxMouse(long display, long window) {
|
||||
public LinuxMouse(long display, long window, long warp_atom) {
|
||||
this.display = display;
|
||||
this.window = window;
|
||||
this.warp_atom = warp_atom;
|
||||
reset();
|
||||
}
|
||||
|
||||
|
@ -130,10 +132,10 @@ final class LinuxMouse {
|
|||
}
|
||||
|
||||
private void doWarpPointer(int center_x, int center_y) {
|
||||
nSendWarpEvent(display, window, center_x, center_y);
|
||||
nSendWarpEvent(display, window, warp_atom, center_x, center_y);
|
||||
nWarpCursor(display, window, center_x, center_y);
|
||||
}
|
||||
private static native void nSendWarpEvent(long display, long window, int center_x, int center_y);
|
||||
private static native void nSendWarpEvent(long display, long window, long warp_atom, int center_x, int center_y);
|
||||
|
||||
private void doHandlePointerMotion(boolean grab, boolean warp_pointer, long root_window, int root_x, int root_y, int win_x, int win_y, long nanos) {
|
||||
setCursorPos(grab, win_x, win_y, nanos);
|
||||
|
|
|
@ -49,7 +49,7 @@ final class LinuxPbufferPeerInfo extends LinuxPeerInfo {
|
|||
try {
|
||||
LinuxDisplay.incDisplay();
|
||||
try {
|
||||
nInitHandle(LinuxDisplay.getDisplay(), getHandle(), width, height, pixel_format);
|
||||
nInitHandle(LinuxDisplay.getDisplay(), LinuxDisplay.getDefaultScreen(), getHandle(), width, height, pixel_format);
|
||||
} catch (LWJGLException e) {
|
||||
LinuxDisplay.decDisplay();
|
||||
throw e;
|
||||
|
@ -62,7 +62,7 @@ final class LinuxPbufferPeerInfo extends LinuxPeerInfo {
|
|||
LinuxDisplay.unlockAWT();
|
||||
}
|
||||
}
|
||||
private static native void nInitHandle(long display, ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException;
|
||||
private static native void nInitHandle(long display, int screen, ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException;
|
||||
|
||||
public void destroy() {
|
||||
LinuxDisplay.lockAWT();
|
||||
|
|
|
@ -50,17 +50,6 @@
|
|||
#include "extgl_glx.h"
|
||||
|
||||
extern bool checkXError(JNIEnv *, Display *);
|
||||
extern Atom getWarpAtom(void);
|
||||
|
||||
/*
|
||||
* get the current display
|
||||
*/
|
||||
extern Display *getDisplay(void);
|
||||
|
||||
/*
|
||||
* get the current screen
|
||||
*/
|
||||
extern int getCurrentScreen(void);
|
||||
|
||||
/*
|
||||
* get the current window
|
||||
|
|
|
@ -288,16 +288,16 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRam
|
|||
return native_ramp;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display) {
|
||||
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display, jint screen) {
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
int ramp_size = getGammaRampLengthOfDisplay(env, disp, getCurrentScreen());
|
||||
int ramp_size = getGammaRampLengthOfDisplay(env, disp, screen);
|
||||
jobject ramp_buffer = newJavaManagedByteBuffer(env, sizeof(unsigned short)*3*ramp_size);
|
||||
if (ramp_buffer == NULL) {
|
||||
throwException(env, "Could not allocate gamma ramp buffer");
|
||||
return NULL;
|
||||
}
|
||||
unsigned short *ramp = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer);
|
||||
if (!XF86VidModeGetGammaRamp(disp, getCurrentScreen(), ramp_size, ramp,
|
||||
if (!XF86VidModeGetGammaRamp(disp, screen, ramp_size, ramp,
|
||||
ramp + ramp_size, ramp + ramp_size*2)) {
|
||||
throwException(env, "Could not get the current gamma ramp");
|
||||
return NULL;
|
||||
|
@ -386,14 +386,14 @@ static jobject getCurrentXRandrMode(JNIEnv * env, Display *disp, int screen) {
|
|||
return displayMode;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display) {
|
||||
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display, jint screen) {
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
return getCurrentXRandrMode(env, disp, getCurrentScreen());
|
||||
return getCurrentXRandrMode(env, disp, screen);
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint extension) {
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension) {
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
return getAvailableDisplayModes(env, disp, getCurrentScreen(), extension);
|
||||
return getAvailableDisplayModes(env, disp, screen, extension);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension, jobject mode) {
|
||||
|
|
|
@ -78,14 +78,9 @@ static Pixmap current_icon_pixmap;
|
|||
|
||||
static Visual *current_visual;
|
||||
|
||||
static int current_screen;
|
||||
static bool async_x_error;
|
||||
static char error_message[ERR_MSG_SIZE];
|
||||
|
||||
int getCurrentScreen(void) {
|
||||
return current_screen;
|
||||
}
|
||||
|
||||
bool checkXError(JNIEnv *env, Display *disp) {
|
||||
XSync(disp, False);
|
||||
if (async_x_error) {
|
||||
|
@ -117,10 +112,13 @@ static jlong openDisplay(JNIEnv *env) {
|
|||
throwException(env, "Could not open X display connection");
|
||||
return (intptr_t)NULL;
|
||||
}
|
||||
current_screen = XDefaultScreen(display_connection);
|
||||
return (intptr_t)display_connection;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen(JNIEnv *env, jclass unused, jlong display_ptr) {
|
||||
Display *disp = (Display *)(intptr_t)display_ptr;
|
||||
return XDefaultScreen(disp);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *env, jclass unused, jlong display_ptr, jstring atom_name_obj, jboolean only_if_exists) {
|
||||
Display *disp = (Display *)(intptr_t)display_ptr;
|
||||
|
@ -250,9 +248,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(J
|
|||
peer_info->drawable = getCurrentWindow();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, jobject peer_info_handle, jobject pixel_format) {
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject pixel_format) {
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
initPeerInfo(env, peer_info_handle, disp, getCurrentScreen(), pixel_format, true, GLX_WINDOW_BIT, true, false);
|
||||
initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, true, GLX_WINDOW_BIT, true, false);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jstring title_obj) {
|
||||
|
@ -279,14 +277,14 @@ static void destroyWindow(JNIEnv *env, Display *disp) {
|
|||
freeIconPixmap(disp);
|
||||
}
|
||||
|
||||
static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp) {
|
||||
static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp, int screen) {
|
||||
unsigned long nitems;
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long bytes_after;
|
||||
Atom *supported_list;
|
||||
Atom netwm_supported_atom = XInternAtom(disp, "_NET_SUPPORTED", False);
|
||||
int result = XGetWindowProperty(disp, RootWindow(disp, getCurrentScreen()), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list);
|
||||
int result = XGetWindowProperty(disp, RootWindow(disp, screen), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list);
|
||||
if (result != Success) {
|
||||
throwException(env, "Unable to query _NET_SUPPORTED window property");
|
||||
return false;
|
||||
|
@ -304,9 +302,9 @@ static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp) {
|
|||
return supported;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display) {
|
||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display, jint screen) {
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
return isNetWMFullscreenSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
|
||||
return isNetWMFullscreenSupported(env, disp, screen) ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jlong display, jint x, jint y, jint width, jint height) {
|
||||
|
@ -314,14 +312,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env,
|
|||
XMoveWindow(disp, getCurrentWindow(), x, y);
|
||||
}
|
||||
|
||||
static bool createWindow(JNIEnv* env, Display *disp, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height) {
|
||||
static bool createWindow(JNIEnv* env, Display *disp, int screen, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height) {
|
||||
bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
|
||||
Window root_win;
|
||||
Window win;
|
||||
XSetWindowAttributes attribs;
|
||||
int attribmask;
|
||||
|
||||
root_win = RootWindow(disp, getCurrentScreen());
|
||||
root_win = RootWindow(disp, screen);
|
||||
XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info);
|
||||
if (vis_info == NULL)
|
||||
return false;
|
||||
|
@ -386,7 +384,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUpdate(JNIEnv *env, j
|
|||
handleMessages(env, disp, disp_obj, warp_atom);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y) {
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y) {
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
|
||||
GLXFBConfig *fb_config = NULL;
|
||||
|
@ -400,7 +398,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *
|
|||
jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
|
||||
int width = (*env)->GetIntField(env, mode, fid_width);
|
||||
int height = (*env)->GetIntField(env, mode, fid_height);
|
||||
bool window_created = createWindow(env, disp, window_mode, peer_info, x, y, width, height);
|
||||
bool window_created = createWindow(env, disp, screen, window_mode, peer_info, x, y, width, height);
|
||||
if (!window_created) {
|
||||
return;
|
||||
}
|
||||
|
@ -562,10 +560,6 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor(
|
|||
return handle_buffer;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getScreen(JNIEnv *env, jclass unsused) {
|
||||
return getCurrentScreen();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) {
|
||||
Display *disp = (Display *)(intptr_t)display_ptr;
|
||||
int revert_mode;
|
||||
|
|
|
@ -48,25 +48,25 @@
|
|||
#include "common_tools.h"
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities
|
||||
(JNIEnv *env, jclass clazz, jlong display)
|
||||
(JNIEnv *env, jclass clazz, jlong display, jint screen)
|
||||
{
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
GLXExtensions extension_flags;
|
||||
if (!extgl_InitGLX(disp, getCurrentScreen(), &extension_flags))
|
||||
if (!extgl_InitGLX(disp, screen, &extension_flags))
|
||||
return 0;
|
||||
// Only support the GLX 1.3 Pbuffers and ignore the GLX_SGIX_pbuffer extension
|
||||
return extension_flags.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle
|
||||
(JNIEnv *env, jclass clazz, jlong display, jobject peer_info_handle, jint width, jint height, jobject pixel_format) {
|
||||
(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jint width, jint height, jobject pixel_format) {
|
||||
Display *disp = (Display *)(intptr_t)display;
|
||||
GLXExtensions extension_flags;
|
||||
if (!extgl_InitGLX(disp, getCurrentScreen(), &extension_flags) || !extension_flags.GLX13) {
|
||||
if (!extgl_InitGLX(disp, screen, &extension_flags) || !extension_flags.GLX13) {
|
||||
throwException(env, "No Pbuffer support");
|
||||
return;
|
||||
}
|
||||
bool result = initPeerInfo(env, peer_info_handle, disp, getCurrentScreen(), pixel_format, false, GLX_PBUFFER_BIT, false, true);
|
||||
bool result = initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, false, GLX_PBUFFER_BIT, false, true);
|
||||
if (!result)
|
||||
return;
|
||||
const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width,
|
||||
|
|
Loading…
Reference in New Issue