You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
|
8
(1) |
9
|
10
|
11
(3) |
12
|
13
|
14
|
|
15
|
16
|
17
|
18
|
19
|
20
(6) |
21
|
|
22
|
23
(8) |
24
(6) |
25
|
26
(10) |
27
(3) |
28
(1) |
|
29
|
30
(2) |
31
(1) |
|
|
|
|
|
From: <eli...@us...> - 2006-10-23 19:51:46
|
Revision: 2595
http://svn.sourceforge.net/java-game-lib/?rev=2595&view=rev
Author: elias_naur
Date: 2006-10-23 12:51:22 -0700 (Mon, 23 Oct 2006)
Log Message:
-----------
Linux: Moved the pointer warp X11 atom from native to java
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxMouse.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 14:22:27 UTC (rev 2594)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 19:51:22 UTC (rev 2595)
@@ -84,6 +84,9 @@
/** Current mode swithcing API */
private int current_displaymode_extension = NONE;
+ /** Atom used for the pointer warp messages */
+ private long warp_atom;
+
private PeerInfo peer_info;
/** Saved gamma used to restore display settings */
@@ -447,6 +450,20 @@
}
private static native void nSwitchDisplayMode(long display, int screen, int extension, DisplayMode mode) throws LWJGLException;
+ static long getWarpAtom() throws LWJGLException {
+ return internAtom("_LWJGL", false);
+ }
+
+ private static long internAtom(String atom_name, boolean only_if_exists) throws LWJGLException {
+ incDisplay();
+ try {
+ return nInternAtom(getDisplay(), atom_name, only_if_exists);
+ } finally {
+ decDisplay();
+ }
+ }
+ private static native long nInternAtom(long display, String atom_name, boolean only_if_exists);
+
public void resetDisplayMode() {
lockAWT();
try {
@@ -527,6 +544,7 @@
public DisplayMode init() throws LWJGLException {
lockAWT();
try {
+ warp_atom = getWarpAtom();
current_displaymode_extension = getBestDisplayModeExtension();
if (current_displaymode_extension == NONE)
throw new LWJGLException("No display mode extension is available");
@@ -607,7 +625,7 @@
public void update() {
lockAWT();
try {
- nUpdate(getDisplay());
+ nUpdate(getDisplay(), warp_atom);
checkInput();
} catch (LWJGLException e) {
LWJGLUtil.log("Caught exception while processing messages: " + e);
@@ -615,7 +633,7 @@
unlockAWT();
}
}
- private native void nUpdate(long display) throws LWJGLException;
+ private native void nUpdate(long display, long warp_atom) throws LWJGLException;
public void reshape(int x, int y, int width, int height) {
lockAWT();
@@ -655,7 +673,7 @@
public void createMouse() {
lockAWT();
try {
- mouse = new LinuxMouse(getDisplay(), getWindow());
+ mouse = new LinuxMouse(getDisplay(), getWindow(), warp_atom);
} finally {
unlockAWT();
}
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-23 14:22:27 UTC (rev 2594)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-23 19:51:22 UTC (rev 2595)
@@ -81,7 +81,6 @@
static int current_screen;
static bool async_x_error;
static char error_message[ERR_MSG_SIZE];
-static Atom warp_atom;
int getCurrentScreen(void) {
return current_screen;
@@ -119,12 +118,18 @@
return (intptr_t)NULL;
}
current_screen = XDefaultScreen(display_connection);
- warp_atom = XInternAtom(display_connection, "_LWJGL_WARP", False);
return (intptr_t)display_connection;
}
-Atom getWarpAtom(void) {
- return warp_atom;
+
+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;
+ char *atom_name = GetStringNativeChars(env, atom_name_obj);
+ if (atom_name == NULL)
+ return 0;
+ Atom atom = XInternAtom(disp, atom_name, only_if_exists ? True : False);
+ free(atom_name);
+ return atom;
}
static void waitMapped(Display *disp, Window win) {
@@ -157,7 +162,7 @@
return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY;
}
-static void handleMessages(JNIEnv *env, Display *disp, jobject disp_obj) {
+static void handleMessages(JNIEnv *env, Display *disp, jobject disp_obj, Atom warp_atom) {
XEvent event;
jclass disp_class = (*env)->GetObjectClass(env, disp_obj);
if (disp_class == NULL)
@@ -375,9 +380,10 @@
return current_win;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUpdate(JNIEnv *env, jobject disp_obj, jlong display) {
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUpdate(JNIEnv *env, jobject disp_obj, jlong display, jlong warp_atom_ptr) {
Display *disp = (Display *)(intptr_t)display;
- handleMessages(env, disp, disp_obj);
+ Atom warp_atom = (Atom)warp_atom_ptr;
+ 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) {
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxMouse.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxMouse.c 2006-10-23 14:22:27 UTC (rev 2594)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxMouse.c 2006-10-23 19:51:22 UTC (rev 2595)
@@ -91,13 +91,14 @@
return root_return;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nSendWarpEvent(JNIEnv *env, jclass unusued, jlong display_ptr, jlong window_ptr, jint x, jint y) {
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nSendWarpEvent(JNIEnv *env, jclass unusued, jlong display_ptr, jlong window_ptr, jlong warp_atom_ptr, jint x, jint y) {
+ Atom warp_atom = (Atom)warp_atom_ptr;
Display *disp = (Display *)(intptr_t)display_ptr;
Window win = (Window)window_ptr;
XEvent warp_event;
warp_event.type = ClientMessage;
warp_event.xclient.window = win;
- warp_event.xclient.message_type = getWarpAtom();
+ warp_event.xclient.message_type = warp_atom;
warp_event.xclient.format = 32;
warp_event.xclient.data.l[0] = x;
warp_event.xclient.data.l[1] = y;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-23 14:23:22
|
Revision: 2594
http://svn.sourceforge.net/java-game-lib/?rev=2594&view=rev
Author: elias_naur
Date: 2006-10-23 07:22:27 -0700 (Mon, 23 Oct 2006)
Log Message:
-----------
Linux: Moved another Display instance to java
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/native/linux/display.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
Removed Paths:
-------------
trunk/LWJGL/src/native/linux/display.h
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 14:16:40 UTC (rev 2593)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 14:22:27 UTC (rev 2594)
@@ -430,14 +430,23 @@
public void switchDisplayMode(DisplayMode mode) throws LWJGLException {
lockAWT();
try {
- nSwitchDisplayMode(getScreen(), current_displaymode_extension, mode);
+ switchDisplayModeOnTmpDisplay(mode);
current_mode = mode;
} finally {
unlockAWT();
}
}
- private static native void nSwitchDisplayMode(int screen, int extension, DisplayMode mode) throws LWJGLException;
+ private void switchDisplayModeOnTmpDisplay(DisplayMode mode) throws LWJGLException {
+ long tmp_display = openDisplay();
+ try {
+ nSwitchDisplayMode(tmp_display, getScreen(), current_displaymode_extension, mode);
+ } finally {
+ closeDisplay(tmp_display);
+ }
+ }
+ private static native void nSwitchDisplayMode(long display, int screen, int extension, DisplayMode mode) throws LWJGLException;
+
public void resetDisplayMode() {
lockAWT();
try {
@@ -704,7 +713,7 @@
if (current_window_mode == FULLSCREEN_NETWM) {
nIconifyWindow(getDisplay(), getWindow(), getScreen());
try {
- nSwitchDisplayMode(getScreen(), current_displaymode_extension, saved_mode);
+ switchDisplayModeOnTmpDisplay(saved_mode);
setGammaRampOnTmpDisplay(saved_gamma);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to restore saved mode: " + e.getMessage());
@@ -721,7 +730,7 @@
updateInputGrab();
if (current_window_mode == FULLSCREEN_NETWM) {
try {
- nSwitchDisplayMode(getScreen(), current_displaymode_extension, current_mode);
+ switchDisplayModeOnTmpDisplay(current_mode);
setGammaRampOnTmpDisplay(current_gamma);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to restore mode: " + e.getMessage());
Modified: trunk/LWJGL/src/native/linux/display.c
===================================================================
--- trunk/LWJGL/src/native/linux/display.c 2006-10-23 14:16:40 UTC (rev 2593)
+++ trunk/LWJGL/src/native/linux/display.c 2006-10-23 14:22:27 UTC (rev 2594)
@@ -47,7 +47,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include "display.h"
#include "common_tools.h"
#include "Window.h"
#include "org_lwjgl_opengl_LinuxDisplay.h"
@@ -319,7 +318,7 @@
}
}
-bool switchDisplayMode(JNIEnv * env, int screen, jint extension, jobject mode) {
+static bool switchDisplayMode(JNIEnv * env, Display *disp, int screen, jint extension, jobject mode) {
if (mode == NULL) {
throwException(env, "mode must be non-null");
return false;
@@ -331,17 +330,11 @@
int width = (*env)->GetIntField(env, mode, fid_width);
int height = (*env)->GetIntField(env, mode, fid_height);
int freq = (*env)->GetIntField(env, mode, fid_freq);
- Display *disp = XOpenDisplay(NULL);
- if (disp == NULL) {
- throwException(env, "Could not open display");
- return false;
- }
if (!setMode(env, disp, screen, extension, width, height, freq)) {
XCloseDisplay(disp);
throwException(env, "Could not switch mode.");
return false;
}
- XCloseDisplay(disp);
return true;
}
@@ -403,8 +396,9 @@
return getAvailableDisplayModes(env, disp, getCurrentScreen(), extension);
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jint screen, jint extension, jobject mode) {
- switchDisplayMode(env, screen, extension, mode);
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension, jobject mode) {
+ Display *disp = (Display *)(intptr_t)display;
+ switchDisplayMode(env, disp, screen, extension, mode);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jclass clazz, jlong display_ptr, jint screen) {
Deleted: trunk/LWJGL/src/native/linux/display.h
===================================================================
--- trunk/LWJGL/src/native/linux/display.h 2006-10-23 14:16:40 UTC (rev 2593)
+++ trunk/LWJGL/src/native/linux/display.h 2006-10-23 14:22:27 UTC (rev 2594)
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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$
- *
- * Linux specific library for display handling.
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision$
- */
-
-#ifndef _DISPLAY_H
-#define _DISPLAY_H
-
-#include <jni.h>
-#include "common_tools.h"
-
-extern bool switchDisplayMode(JNIEnv * env, int screen, jint extension, jobject mode);
-
-#endif
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-23 14:16:40 UTC (rev 2593)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-23 14:22:27 UTC (rev 2594)
@@ -53,7 +53,6 @@
#include "extgl_glx.h"
#include "Window.h"
#include "context.h"
-#include "display.h"
#include "org_lwjgl_opengl_LinuxDisplay.h"
#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-23 14:16:51
|
Revision: 2593
http://svn.sourceforge.net/java-game-lib/?rev=2593&view=rev
Author: elias_naur
Date: 2006-10-23 07:16:40 -0700 (Mon, 23 Oct 2006)
Log Message:
-----------
Linux: Moved another Display instance to java
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/native/linux/display.c
trunk/LWJGL/src/native/linux/display.h
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 14:05:40 UTC (rev 2592)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 14:16:40 UTC (rev 2593)
@@ -485,14 +485,23 @@
private void doSetGamma(ByteBuffer native_gamma) throws LWJGLException {
lockAWT();
try {
- nSetGammaRamp(getScreen(), native_gamma);
+ setGammaRampOnTmpDisplay(native_gamma);
current_gamma = native_gamma;
} finally {
unlockAWT();
}
}
- private static native void nSetGammaRamp(int screen, ByteBuffer gammaRamp) throws LWJGLException;
+ private void setGammaRampOnTmpDisplay(ByteBuffer native_gamma) throws LWJGLException {
+ long tmp_display = openDisplay();
+ try {
+ nSetGammaRamp(tmp_display, getScreen(), native_gamma);
+ } finally {
+ closeDisplay(tmp_display);
+ }
+ }
+ private static native void nSetGammaRamp(long display, int screen, ByteBuffer gammaRamp) throws LWJGLException;
+
private static ByteBuffer convertToNativeRamp(FloatBuffer ramp) throws LWJGLException {
return nConvertToNativeRamp(ramp, ramp.position(), ramp.remaining());
}
@@ -696,7 +705,7 @@
nIconifyWindow(getDisplay(), getWindow(), getScreen());
try {
nSwitchDisplayMode(getScreen(), current_displaymode_extension, saved_mode);
- nSetGammaRamp(getScreen(), saved_gamma);
+ setGammaRampOnTmpDisplay(saved_gamma);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to restore saved mode: " + e.getMessage());
}
@@ -713,7 +722,7 @@
if (current_window_mode == FULLSCREEN_NETWM) {
try {
nSwitchDisplayMode(getScreen(), current_displaymode_extension, current_mode);
- nSetGammaRamp(getScreen(), current_gamma);
+ setGammaRampOnTmpDisplay(current_gamma);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to restore mode: " + e.getMessage());
}
Modified: trunk/LWJGL/src/native/linux/display.c
===================================================================
--- trunk/LWJGL/src/native/linux/display.c 2006-10-23 14:05:40 UTC (rev 2592)
+++ trunk/LWJGL/src/native/linux/display.c 2006-10-23 14:16:40 UTC (rev 2593)
@@ -319,16 +319,6 @@
}
}
-void setGammaRamp(JNIEnv *env, int screen, jobject gamma_ramp_buffer) {
- Display * disp = XOpenDisplay(NULL);
- if (disp == NULL) {
- throwException(env, "Could not open display");
- return;
- }
- setGamma(env, disp, screen, gamma_ramp_buffer);
- XCloseDisplay(disp);
-}
-
bool switchDisplayMode(JNIEnv * env, int screen, jint extension, jobject mode) {
if (mode == NULL) {
throwException(env, "mode must be non-null");
@@ -422,7 +412,8 @@
return (jint)getGammaRampLengthOfDisplay(env, disp, screen);
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jint screen, jobject gamma_buffer) {
- setGammaRamp(env, screen, gamma_buffer);
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject gamma_buffer) {
+ Display *disp = (Display *)(intptr_t)display;
+ setGamma(env, disp, screen, gamma_buffer);
}
Modified: trunk/LWJGL/src/native/linux/display.h
===================================================================
--- trunk/LWJGL/src/native/linux/display.h 2006-10-23 14:05:40 UTC (rev 2592)
+++ trunk/LWJGL/src/native/linux/display.h 2006-10-23 14:16:40 UTC (rev 2593)
@@ -46,6 +46,5 @@
#include "common_tools.h"
extern bool switchDisplayMode(JNIEnv * env, int screen, jint extension, jobject mode);
-extern void setGammaRamp(JNIEnv *env, int screen, jobject gamma_ramp_buffer);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-23 14:05:47
|
Revision: 2592
http://svn.sourceforge.net/java-game-lib/?rev=2592&view=rev
Author: elias_naur
Date: 2006-10-23 07:05:40 -0700 (Mon, 23 Oct 2006)
Log Message:
-----------
Linux: Added sanity check to LinuxDisplay.getDisplay()
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 13:58:33 UTC (rev 2591)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 14:05:40 UTC (rev 2592)
@@ -258,7 +258,7 @@
if (display_connection_usage_count < 0)
throw new InternalError("display_connection_usage_count < 0: " + display_connection_usage_count);
if (display_connection_usage_count == 0) {
- closeDisplay(getDisplay());
+ closeDisplay(display);
display = 0;
GLContext.unloadOpenGLLibrary();
}
@@ -281,6 +281,8 @@
}
static long getDisplay() {
+ if (display_connection_usage_count <= 0)
+ throw new InternalError("display_connection_usage_count = " + display_connection_usage_count);
return display;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-23 13:58:58
|
Revision: 2591
http://svn.sourceforge.net/java-game-lib/?rev=2591&view=rev
Author: elias_naur
Date: 2006-10-23 06:58:33 -0700 (Mon, 23 Oct 2006)
Log Message:
-----------
Linux: Moved Display pointer from native to java
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java
trunk/LWJGL/src/native/linux/display.c
trunk/LWJGL/src/native/linux/org_lwjgl_input_Cursor.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-10-23 13:58:33 UTC (rev 2591)
@@ -57,7 +57,7 @@
private static final String VERSION = "1.0beta3";
/** Current version of the JNI library */
- static final int JNI_VERSION = 4;
+ static final int JNI_VERSION = 5;
/** The implementation instance to delegate platform specific behavior to */
private final static SysImplementation implementation;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java 2006-10-23 13:58:33 UTC (rev 2591)
@@ -107,7 +107,7 @@
GLContext.loadOpenGLLibrary();
try {
LinuxDisplay.incDisplay();
- return nFindVisualIDFromFormat(screen, pixel_format);
+ return nFindVisualIDFromFormat(LinuxDisplay.getDisplay(), screen, pixel_format);
} finally {
LinuxDisplay.decDisplay();
}
@@ -118,5 +118,5 @@
LinuxDisplay.unlockAWT();
}
}
- private static native int nFindVisualIDFromFormat(int screen, PixelFormat pixel_format) throws LWJGLException;
+ private static native int nFindVisualIDFromFormat(long display, int screen, PixelFormat pixel_format) throws LWJGLException;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 13:58:33 UTC (rev 2591)
@@ -75,6 +75,9 @@
*/
private static Thread current_awt_lock_owner;
private static int awt_lock_count;
+
+ /** Current X11 Display pointer */
+ private static long display;
private static int display_connection_usage_count = 0;
@@ -111,7 +114,7 @@
incDisplay();
try {
if (isXF86VidModeSupported())
- return nGetCurrentGammaRamp();
+ return nGetCurrentGammaRamp(getDisplay());
else
return null;
} finally {
@@ -121,7 +124,7 @@
unlockAWT();
}
}
- private static native ByteBuffer nGetCurrentGammaRamp() throws LWJGLException;
+ private static native ByteBuffer nGetCurrentGammaRamp(long display) throws LWJGLException;
private static int getBestDisplayModeExtension() {
int result;
@@ -145,7 +148,7 @@
try {
incDisplay();
try {
- return nIsXrandrSupported();
+ return nIsXrandrSupported(getDisplay());
} finally {
decDisplay();
}
@@ -156,14 +159,14 @@
unlockAWT();
}
}
- private static native boolean nIsXrandrSupported() throws LWJGLException;
+ private static native boolean nIsXrandrSupported(long display) throws LWJGLException;
private static boolean isXF86VidModeSupported() {
lockAWT();
try {
incDisplay();
try {
- return nIsXF86VidModeSupported();
+ return nIsXF86VidModeSupported(getDisplay());
} finally {
decDisplay();
}
@@ -174,7 +177,7 @@
unlockAWT();
}
}
- private static native boolean nIsXF86VidModeSupported() throws LWJGLException;
+ private static native boolean nIsXF86VidModeSupported(long display) throws LWJGLException;
private static boolean isNetWMFullscreenSupported() throws LWJGLException {
if (Display.getPrivilegedBoolean("LWJGL_DISABLE_NETWM"))
@@ -183,7 +186,7 @@
try {
incDisplay();
try {
- return nIsNetWMFullscreenSupported();
+ return nIsNetWMFullscreenSupported(getDisplay());
} finally {
decDisplay();
}
@@ -194,7 +197,7 @@
unlockAWT();
}
}
- private static native boolean nIsNetWMFullscreenSupported() throws LWJGLException;
+ private static native boolean nIsNetWMFullscreenSupported(long display) 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
@@ -245,7 +248,7 @@
static void incDisplay() throws LWJGLException {
if (display_connection_usage_count == 0) {
GLContext.loadOpenGLLibrary();
- openDisplay();
+ display = openDisplay();
}
display_connection_usage_count++;
}
@@ -255,13 +258,14 @@
if (display_connection_usage_count < 0)
throw new InternalError("display_connection_usage_count < 0: " + display_connection_usage_count);
if (display_connection_usage_count == 0) {
- closeDisplay();
+ closeDisplay(getDisplay());
+ display = 0;
GLContext.unloadOpenGLLibrary();
}
}
- private static native void openDisplay() throws LWJGLException;
- private static native void closeDisplay();
+ private static native long openDisplay() throws LWJGLException;
+ private static native void closeDisplay(long display);
private int getWindowMode(boolean fullscreen) throws LWJGLException {
if (fullscreen) {
@@ -276,7 +280,10 @@
return WINDOWED;
}
- private static native long getDisplay();
+ static long getDisplay() {
+ return display;
+ }
+
private static native int getScreen();
private static native long getWindow();
@@ -367,7 +374,7 @@
ByteBuffer handle = peer_info.lockAndGetHandle();
try {
current_window_mode = getWindowMode(fullscreen);
- nCreateWindow(handle, mode, current_window_mode, x, y);
+ nCreateWindow(getDisplay(), handle, mode, current_window_mode, x, y);
blank_cursor = createBlankCursor();
current_cursor = null;
focused = true;
@@ -391,7 +398,7 @@
unlockAWT();
}
}
- private static native void nCreateWindow(ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y) throws LWJGLException;
+ private static native void nCreateWindow(long display, ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y) throws LWJGLException;
private void updateInputGrab() {
updatePointerGrab();
@@ -406,17 +413,17 @@
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to reset cursor: " + e.getMessage());
}
- nDestroyCursor(blank_cursor);
+ nDestroyCursor(getDisplay(), blank_cursor);
blank_cursor = null;
ungrabKeyboard();
- nDestroyWindow();
+ nDestroyWindow(getDisplay());
nSetRepeatMode(getDisplay(), AutoRepeatModeDefault);
decDisplay();
} finally {
unlockAWT();
}
}
- private static native void nDestroyWindow();
+ private static native void nDestroyWindow(long display);
public void switchDisplayMode(DisplayMode mode) throws LWJGLException {
lockAWT();
@@ -530,7 +537,7 @@
try {
incDisplay();
try {
- return nGetCurrentXRandrMode();
+ return nGetCurrentXRandrMode(getDisplay());
} finally {
decDisplay();
}
@@ -540,17 +547,17 @@
}
/** Assumes extension == XRANDR */
- private static native DisplayMode nGetCurrentXRandrMode() throws LWJGLException;
+ private static native DisplayMode nGetCurrentXRandrMode(long display) throws LWJGLException;
public void setTitle(String title) {
lockAWT();
try {
- nSetTitle(title);
+ nSetTitle(getDisplay(), title);
} finally {
unlockAWT();
}
}
- private static native void nSetTitle(String title);
+ private static native void nSetTitle(long display, String title);
public boolean isCloseRequested() {
boolean result = close_requested;
@@ -580,7 +587,7 @@
public void update() {
lockAWT();
try {
- nUpdate();
+ nUpdate(getDisplay());
checkInput();
} catch (LWJGLException e) {
LWJGLUtil.log("Caught exception while processing messages: " + e);
@@ -588,24 +595,24 @@
unlockAWT();
}
}
- private native void nUpdate() throws LWJGLException;
+ private native void nUpdate(long display) throws LWJGLException;
public void reshape(int x, int y, int width, int height) {
lockAWT();
try {
- nReshape(x, y, width, height);
+ nReshape(getDisplay(), x, y, width, height);
} finally {
unlockAWT();
}
}
- private static native void nReshape(int x, int y, int width, int height);
+ private static native void nReshape(long display, int x, int y, int width, int height);
public DisplayMode[] getAvailableDisplayModes() throws LWJGLException {
lockAWT();
try {
incDisplay();
try {
- DisplayMode[] modes = nGetAvailableDisplayModes(current_displaymode_extension);
+ DisplayMode[] modes = nGetAvailableDisplayModes(getDisplay(), current_displaymode_extension);
return modes;
} finally {
decDisplay();
@@ -614,7 +621,7 @@
unlockAWT();
}
}
- private static native DisplayMode[] nGetAvailableDisplayModes(int extension) throws LWJGLException;
+ private static native DisplayMode[] nGetAvailableDisplayModes(long display, int extension) throws LWJGLException;
/* Mouse */
public boolean hasWheel() {
@@ -734,7 +741,7 @@
try {
incDisplay();
try {
- return nGetNativeCursorCapabilities();
+ return nGetNativeCursorCapabilities(getDisplay());
} finally {
decDisplay();
}
@@ -744,7 +751,7 @@
unlockAWT();
}
}
- private static native int nGetNativeCursorCapabilities() throws LWJGLException;
+ private static native int nGetNativeCursorCapabilities(long display) throws LWJGLException;
public void setNativeCursor(Object handle) throws LWJGLException {
current_cursor = (ByteBuffer)handle;
@@ -761,7 +768,7 @@
try {
incDisplay();
try {
- return nGetMinCursorSize();
+ return nGetMinCursorSize(getDisplay());
} finally {
decDisplay();
}
@@ -772,14 +779,14 @@
unlockAWT();
}
}
- private static native int nGetMinCursorSize();
+ private static native int nGetMinCursorSize(long display);
public int getMaxCursorSize() {
lockAWT();
try {
incDisplay();
try {
- return nGetMaxCursorSize();
+ return nGetMaxCursorSize(getDisplay());
} finally {
decDisplay();
}
@@ -790,7 +797,7 @@
unlockAWT();
}
}
- private static native int nGetMaxCursorSize();
+ private static native int nGetMaxCursorSize(long display);
/* Keyboard */
public void createKeyboard() throws LWJGLException {
@@ -836,7 +843,7 @@
return Keyboard.STATE_UNKNOWN;
}
*/
- private static native ByteBuffer nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException;
+ private static native ByteBuffer nCreateCursor(long display, int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException;
private static ByteBuffer createBlankCursor() {
return nCreateBlankCursor(getDisplay(), getWindow());
@@ -848,7 +855,7 @@
try {
incDisplay();
try {
- return nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1);
+ return nCreateCursor(getDisplay(), width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1);
} catch (LWJGLException e) {
decDisplay();
throw e;
@@ -861,20 +868,20 @@
public void destroyCursor(Object cursorHandle) {
lockAWT();
try {
- nDestroyCursor(cursorHandle);
+ nDestroyCursor(getDisplay(), cursorHandle);
decDisplay();
} finally {
unlockAWT();
}
}
- private static native void nDestroyCursor(Object cursorHandle);
+ private static native void nDestroyCursor(long display, Object cursorHandle);
public int getPbufferCapabilities() {
lockAWT();
try {
incDisplay();
try {
- return nGetPbufferCapabilities();
+ return nGetPbufferCapabilities(getDisplay());
} finally {
decDisplay();
}
@@ -885,7 +892,7 @@
unlockAWT();
}
}
- private static native int nGetPbufferCapabilities();
+ private static native int nGetPbufferCapabilities(long display);
public boolean isBufferLost(PeerInfo handle) {
return false;
@@ -954,7 +961,7 @@
int size = icons[i].limit() / 4;
int dimension = (int)Math.sqrt(size);
ByteBuffer icon = convertIcon(icons[i], dimension, dimension);
- nSetWindowIcon(icon, icon.capacity(), dimension, dimension);
+ nSetWindowIcon(getDisplay(), icon, icon.capacity(), dimension, dimension);
return 1;
}
return 0;
@@ -969,7 +976,7 @@
}
}
- private static native void nSetWindowIcon(ByteBuffer icon, int icons_size, int width, int height);
+ private static native void nSetWindowIcon(long display, ByteBuffer icon, int icons_size, int width, int height);
/* Callbacks from nUpdate() */
private void handleButtonEvent(long millis, int type, int button, int state) {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java 2006-10-23 13:58:33 UTC (rev 2591)
@@ -49,7 +49,7 @@
try {
LinuxDisplay.incDisplay();
try {
- initDefaultPeerInfo(getHandle(), pixel_format);
+ initDefaultPeerInfo(LinuxDisplay.getDisplay(), getHandle(), pixel_format);
} catch (LWJGLException e) {
LinuxDisplay.decDisplay();
throw e;
@@ -62,7 +62,7 @@
LinuxDisplay.unlockAWT();
}
}
- private static native void initDefaultPeerInfo(ByteBuffer peer_info_handle, PixelFormat pixel_format) throws LWJGLException;
+ private static native void initDefaultPeerInfo(long display, ByteBuffer peer_info_handle, PixelFormat pixel_format) throws LWJGLException;
protected void doLockAndInitHandle() throws LWJGLException {
LinuxDisplay.lockAWT();
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java 2006-10-23 13:58:33 UTC (rev 2591)
@@ -49,7 +49,7 @@
try {
LinuxDisplay.incDisplay();
try {
- nInitHandle(getHandle(), width, height, pixel_format);
+ nInitHandle(LinuxDisplay.getDisplay(), getHandle(), width, height, pixel_format);
} catch (LWJGLException e) {
LinuxDisplay.decDisplay();
throw e;
@@ -62,7 +62,7 @@
LinuxDisplay.unlockAWT();
}
}
- private static native void nInitHandle(ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException;
+ private static native void nInitHandle(long display, ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException;
public void destroy() {
LinuxDisplay.lockAWT();
Modified: trunk/LWJGL/src/native/linux/display.c
===================================================================
--- trunk/LWJGL/src/native/linux/display.c 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/native/linux/display.c 2006-10-23 13:58:33 UTC (rev 2591)
@@ -108,13 +108,15 @@
return major_ver >= 2;
}
-JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported(JNIEnv *env, jclass unused) {
- jboolean result = isXrandrSupported(env, getDisplay()) ? JNI_TRUE : JNI_FALSE;
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported(JNIEnv *env, jclass unused, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ jboolean result = isXrandrSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
return result;
}
-JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported(JNIEnv *env, jclass unused) {
- jboolean result = isXF86VidModeSupported(env, getDisplay()) ? JNI_TRUE : JNI_FALSE;
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported(JNIEnv *env, jclass unused, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ jboolean result = isXF86VidModeSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
return result;
}
@@ -287,15 +289,16 @@
return native_ramp;
}
-JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused) {
- int ramp_size = getGammaRampLengthOfDisplay(env, getDisplay(), getCurrentScreen());
+JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ int ramp_size = getGammaRampLengthOfDisplay(env, disp, getCurrentScreen());
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(getDisplay(), getCurrentScreen(), ramp_size, ramp,
+ if (!XF86VidModeGetGammaRamp(disp, getCurrentScreen(), ramp_size, ramp,
ramp + ramp_size, ramp + ramp_size*2)) {
throwException(env, "Could not get the current gamma ramp");
return NULL;
@@ -400,12 +403,14 @@
return displayMode;
}
-JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused) {
- return getCurrentXRandrMode(env, getDisplay(), getCurrentScreen());
+JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ return getCurrentXRandrMode(env, disp, getCurrentScreen());
}
-JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jint extension) {
- return getAvailableDisplayModes(env, getDisplay(), getCurrentScreen(), extension);
+JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint extension) {
+ Display *disp = (Display *)(intptr_t)display;
+ return getAvailableDisplayModes(env, disp, getCurrentScreen(), extension);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jint screen, jint extension, jobject mode) {
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_input_Cursor.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_input_Cursor.c 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_input_Cursor.c 2006-10-23 13:58:33 UTC (rev 2591)
@@ -48,10 +48,11 @@
#include "common_tools.h"
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetNativeCursorCapabilities
- (JNIEnv *env, jclass clazz) {
+ (JNIEnv *env, jclass clazz, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
int caps = 0;
- XcursorBool argb_supported = XcursorSupportsARGB(getDisplay());
- XcursorBool anim_supported = XcursorSupportsAnim(getDisplay());
+ XcursorBool argb_supported = XcursorSupportsARGB(disp);
+ XcursorBool anim_supported = XcursorSupportsAnim(disp);
if (argb_supported)
caps |= org_lwjgl_input_Cursor_CURSOR_8_BIT_ALPHA | org_lwjgl_input_Cursor_CURSOR_ONE_BIT_TRANSPARENCY;
if (anim_supported)
@@ -60,26 +61,29 @@
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMinCursorSize
- (JNIEnv *env, jclass clazz)
+ (JNIEnv *env, jclass clazz, jlong display)
{
+ Display *disp = (Display *)(intptr_t)display;
unsigned int width_return = 0;
unsigned int height_return = 0;
- XQueryBestCursor(getDisplay(), getCurrentWindow(), 1, 1, &width_return, &height_return);
+ XQueryBestCursor(disp, getCurrentWindow(), 1, 1, &width_return, &height_return);
return width_return > height_return ? width_return : height_return;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMaxCursorSize
- (JNIEnv *env, jclass clazz)
+ (JNIEnv *env, jclass clazz, jlong display)
{
+ Display *disp = (Display *)(intptr_t)display;
unsigned int width_return = 0;
unsigned int height_return = 0;
- XQueryBestCursor(getDisplay(), getCurrentWindow(), 0xffffffff, 0xffffffff, &width_return, &height_return);
+ XQueryBestCursor(disp, getCurrentWindow(), 0xffffffff, 0xffffffff, &width_return, &height_return);
return width_return > height_return ? height_return : width_return;
}
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateCursor
- (JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
+ (JNIEnv *env, jclass clazz, jlong display, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
{
+ Display *disp = (Display *)(intptr_t)display;
jobject handle_buffer = newJavaManagedByteBuffer(env, sizeof(Cursor));
if (handle_buffer == NULL) {
throwException(env, "Could not allocate handle buffer");
@@ -107,14 +111,15 @@
cursor_images->images[i] = cursor_image;
}
Cursor *cursor = (Cursor *)(*env)->GetDirectBufferAddress(env, handle_buffer);
- *cursor = XcursorImagesLoadCursor(getDisplay(), cursor_images);
+ *cursor = XcursorImagesLoadCursor(disp, cursor_images);
XcursorImagesDestroy(cursor_images);
return handle_buffer;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyCursor
- (JNIEnv *env, jclass clazz, jobject cursor_handle_buffer)
+ (JNIEnv *env, jclass clazz, jlong display, jobject cursor_handle_buffer)
{
+ Display *disp = (Display *)(intptr_t)display;
Cursor *cursor = (Cursor *)(*env)->GetDirectBufferAddress(env, cursor_handle_buffer);
- XFreeCursor(getDisplay(), *cursor);
+ XFreeCursor(disp, *cursor);
}
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-23 13:58:33 UTC (rev 2591)
@@ -80,7 +80,6 @@
static Visual *current_visual;
static int current_screen;
-static Display *display_connection = NULL;
static bool async_x_error;
static char error_message[ERR_MSG_SIZE];
static Atom warp_atom;
@@ -112,35 +111,27 @@
return 0;
}
-Display *getDisplay(void) {
- return display_connection;
-}
-
-static void openDisplay(JNIEnv *env) {
+static jlong openDisplay(JNIEnv *env) {
async_x_error = false;
XSetErrorHandler(errorHandler);
- display_connection = XOpenDisplay(NULL);
+ Display *display_connection = XOpenDisplay(NULL);
if (display_connection == NULL) {
throwException(env, "Could not open X display connection");
- return;
+ return (intptr_t)NULL;
}
- current_screen = XDefaultScreen(getDisplay());
+ current_screen = XDefaultScreen(display_connection);
warp_atom = XInternAtom(display_connection, "_LWJGL_WARP", False);
+ return (intptr_t)display_connection;
}
Atom getWarpAtom(void) {
return warp_atom;
}
-static void closeDisplay(void) {
- XCloseDisplay(display_connection);
- display_connection = NULL;
-}
-
-static void waitMapped(Window win) {
+static void waitMapped(Display *disp, Window win) {
XEvent event;
do {
- XMaskEvent(getDisplay(), StructureNotifyMask, &event);
+ XMaskEvent(disp, StructureNotifyMask, &event);
} while ((event.type != MapNotify) || (event.xmap.event != win));
}
@@ -155,19 +146,19 @@
XCloseDisplay(disp);
}
-static void setDecorations(int dec) {
- Atom motif_hints_atom = XInternAtom(getDisplay(), "_MOTIF_WM_HINTS", False);
+static void setDecorations(Display *disp, int dec) {
+ Atom motif_hints_atom = XInternAtom(disp, "_MOTIF_WM_HINTS", False);
MotifWmHints motif_hints;
motif_hints.flags = MWM_HINTS_DECORATIONS;
motif_hints.decorations = dec;
- XChangeProperty (getDisplay(), getCurrentWindow(), motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long));
+ XChangeProperty(disp, getCurrentWindow(), motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long));
}
static bool isLegacyFullscreen(jint window_mode) {
return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY;
}
-static void handleMessages(JNIEnv *env, jobject disp_obj) {
+static void handleMessages(JNIEnv *env, Display *disp, jobject disp_obj) {
XEvent event;
jclass disp_class = (*env)->GetObjectClass(env, disp_obj);
if (disp_class == NULL)
@@ -196,8 +187,8 @@
jmethodID handleCloseEvent_method = (*env)->GetMethodID(env, disp_class, "handleCloseEvent", "()V");
if (handleCloseEvent_method == NULL)
return;
- while (!(*env)->ExceptionOccurred(env) && XPending(getDisplay()) > 0) {
- XNextEvent(getDisplay(), &event);
+ while (!(*env)->ExceptionOccurred(env) && XPending(disp) > 0) {
+ XNextEvent(disp, &event);
if (XFilterEvent(&event, None) == True)
continue;
// Ignore events from old windows
@@ -234,16 +225,17 @@
}
}
-static void setWindowTitle(const char *title) {
- XStoreName(getDisplay(), current_win, title);
+static void setWindowTitle(Display *disp, const char *title) {
+ XStoreName(disp, current_win, title);
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) {
- openDisplay(env);
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) {
+ return openDisplay(env);
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay(JNIEnv *env, jclass clazz) {
- closeDisplay();
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay(JNIEnv *env, jclass clazz, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ XCloseDisplay(disp);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
@@ -254,46 +246,48 @@
peer_info->drawable = getCurrentWindow();
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject pixel_format) {
- initPeerInfo(env, peer_info_handle, getDisplay(), getCurrentScreen(), pixel_format, true, GLX_WINDOW_BIT, true, false);
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, 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);
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jstring title_obj) {
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jstring title_obj) {
+ Display *disp = (Display *)(intptr_t)display;
char * title = GetStringNativeChars(env, title_obj);
- setWindowTitle(title);
+ setWindowTitle(disp, title);
free(title);
}
-static void freeIconPixmap() {
+static void freeIconPixmap(Display *disp) {
if (current_icon_pixmap != 0) {
- XFreePixmap(getDisplay(), current_icon_pixmap);
+ XFreePixmap(disp, current_icon_pixmap);
current_icon_pixmap = 0;
}
}
-static void destroyWindow(JNIEnv *env) {
+static void destroyWindow(JNIEnv *env, Display *disp) {
if (glx_window != None) {
- lwjgl_glXDestroyWindow(getDisplay(), glx_window);
+ lwjgl_glXDestroyWindow(disp, glx_window);
glx_window = None;
}
- XDestroyWindow(getDisplay(), current_win);
- XFreeColormap(getDisplay(), cmap);
- freeIconPixmap();
+ XDestroyWindow(disp, current_win);
+ XFreeColormap(disp, cmap);
+ freeIconPixmap(disp);
}
-static bool isNetWMFullscreenSupported(JNIEnv *env) {
+static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp) {
unsigned long nitems;
Atom actual_type;
int actual_format;
unsigned long bytes_after;
Atom *supported_list;
- Atom netwm_supported_atom = XInternAtom(getDisplay(), "_NET_SUPPORTED", False);
- int result = XGetWindowProperty(getDisplay(), RootWindow(getDisplay(), getCurrentScreen()), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&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);
if (result != Success) {
throwException(env, "Unable to query _NET_SUPPORTED window property");
return false;
}
- Atom fullscreen_atom = XInternAtom(getDisplay(), "_NET_WM_STATE_FULLSCREEN", False);
+ Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
bool supported = false;
unsigned long i;
for (i = 0; i < nitems; i++) {
@@ -306,26 +300,28 @@
return supported;
}
-JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused) {
- return isNetWMFullscreenSupported(env) ? JNI_TRUE : JNI_FALSE;
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ return isNetWMFullscreenSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jint x, jint y, jint width, jint height) {
- XMoveWindow(getDisplay(), getCurrentWindow(), x, y);
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jlong display, jint x, jint y, jint width, jint height) {
+ Display *disp = (Display *)(intptr_t)display;
+ XMoveWindow(disp, getCurrentWindow(), x, y);
}
-static bool createWindow(JNIEnv* env, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height) {
+static bool createWindow(JNIEnv* env, Display *disp, 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(getDisplay(), getCurrentScreen());
+ root_win = RootWindow(disp, getCurrentScreen());
XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info);
if (vis_info == NULL)
return false;
- cmap = XCreateColormap(getDisplay(), root_win, vis_info->visual, AllocNone);
+ cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone);
attribs.colormap = cmap;
attribs.event_mask = ExposureMask | /*FocusChangeMask | */VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
attribs.background_pixel = 0xFF000000;
@@ -335,21 +331,21 @@
attribmask |= CWOverrideRedirect;
attribs.override_redirect = True;
}
- win = XCreateWindow(getDisplay(), root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs);
+ win = XCreateWindow(disp, root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs);
current_depth = vis_info->depth;
current_visual = vis_info->visual;
XFree(vis_info);
- if (!checkXError(env, getDisplay())) {
- XFreeColormap(getDisplay(), cmap);
+ if (!checkXError(env, disp)) {
+ XFreeColormap(disp, cmap);
return false;
}
printfDebugJava(env, "Created window");
current_win = win;
if (window_mode != org_lwjgl_opengl_LinuxDisplay_WINDOWED || undecorated) {
// Use Motif decoration hint property and hope the window manager respects them
- setDecorations(0);
+ setDecorations(disp, 0);
}
XSizeHints * size_hints = XAllocSizeHints();
size_hints->flags = PMinSize | PMaxSize;
@@ -357,20 +353,20 @@
size_hints->max_width = width;
size_hints->min_height = height;
size_hints->max_height = height;
- XSetWMNormalHints(getDisplay(), win, size_hints);
+ XSetWMNormalHints(disp, win, size_hints);
XFree(size_hints);
- delete_atom = XInternAtom(getDisplay(), "WM_DELETE_WINDOW", False);
- XSetWMProtocols(getDisplay(), win, &delete_atom, 1);
+ delete_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False);
+ XSetWMProtocols(disp, win, &delete_atom, 1);
if (window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM) {
- Atom fullscreen_atom = XInternAtom(getDisplay(), "_NET_WM_STATE_FULLSCREEN", False);
- XChangeProperty(getDisplay(), getCurrentWindow(), XInternAtom(getDisplay(), "_NET_WM_STATE", False),
- XInternAtom(getDisplay(), "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1);
+ Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
+ XChangeProperty(disp, getCurrentWindow(), XInternAtom(disp, "_NET_WM_STATE", False),
+ XInternAtom(disp, "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1);
}
- XMapRaised(getDisplay(), win);
- waitMapped(win);
- XClearWindow(getDisplay(), win);
- if (!checkXError(env, getDisplay())) {
- destroyWindow(env);
+ XMapRaised(disp, win);
+ waitMapped(disp, win);
+ XClearWindow(disp, win);
+ if (!checkXError(env, disp)) {
+ destroyWindow(env, disp);
return false;
}
return true;
@@ -380,12 +376,13 @@
return current_win;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUpdate
- (JNIEnv *env, jobject disp_obj) {
- handleMessages(env, disp_obj);
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUpdate(JNIEnv *env, jobject disp_obj, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ handleMessages(env, disp, disp_obj);
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, 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, 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;
if (peer_info->glx13) {
@@ -398,22 +395,23 @@
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, window_mode, peer_info, x, y, width, height);
+ bool window_created = createWindow(env, disp, window_mode, peer_info, x, y, width, height);
if (!window_created) {
return;
}
if (peer_info->glx13) {
- glx_window = lwjgl_glXCreateWindow(getDisplay(), *fb_config, getCurrentWindow(), NULL);
+ glx_window = lwjgl_glXCreateWindow(disp, *fb_config, getCurrentWindow(), NULL);
XFree(fb_config);
}
- if (!checkXError(env, getDisplay())) {
- lwjgl_glXDestroyWindow(getDisplay(), glx_window);
- destroyWindow(env);
+ if (!checkXError(env, disp)) {
+ lwjgl_glXDestroyWindow(disp, glx_window);
+ destroyWindow(env, disp);
}
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz) {
- destroyWindow(env);
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong display) {
+ Display *disp = (Display *)(intptr_t)display;
+ destroyWindow(env, disp);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT(JNIEnv *env, jclass clazz) {
@@ -436,10 +434,10 @@
jawt.Unlock(env);
}
-static void setIcon(JNIEnv *env, char *data, int icon_size, int width,int height) {
+static void setIcon(JNIEnv *env, Display *disp, char *data, int icon_size, int width,int height) {
XWMHints* win_hints;
- freeIconPixmap();
- current_icon_pixmap = XCreatePixmap(getDisplay(), getCurrentWindow(), width, height, current_depth);
+ freeIconPixmap(disp);
+ current_icon_pixmap = XCreatePixmap(disp, getCurrentWindow(), width, height, current_depth);
/* We need to copy the image data since XDestroyImage will also free its data buffer, which can't be allowed
* since the data buffer is managed by the jvm (it's the storage for the direct ByteBuffer)
*/
@@ -450,17 +448,17 @@
return;
}
memcpy(icon_copy, data, icon_size);
- XImage *image = XCreateImage(getDisplay(), current_visual, current_depth, ZPixmap, 0, icon_copy, width, height, 32, 0);
+ XImage *image = XCreateImage(disp, current_visual, current_depth, ZPixmap, 0, icon_copy, width, height, 32, 0);
if (image == NULL) {
- freeIconPixmap();
+ freeIconPixmap(disp);
free(icon_copy);
throwException(env, "XCreateImage failed");
return;
}
- GC gc = XCreateGC(getDisplay(), current_icon_pixmap, 0, NULL);
- XPutImage(getDisplay(), current_icon_pixmap, gc, image, 0, 0, 0, 0, width, height);
- XFreeGC(getDisplay(), gc);
+ GC gc = XCreateGC(disp, current_icon_pixmap, 0, NULL);
+ XPutImage(disp, current_icon_pixmap, gc, image, 0, 0, 0, 0, width, height);
+ XFreeGC(disp, gc);
XDestroyImage(image);
// We won't free icon_copy because it is freed by XDestroyImage
@@ -473,23 +471,20 @@
win_hints->flags = IconPixmapHint;
win_hints->icon_pixmap = current_icon_pixmap;
- XSetWMHints(getDisplay(), getCurrentWindow(), win_hints);
+ XSetWMHints(disp, getCurrentWindow(), win_hints);
XFree(win_hints);
- XFlush(getDisplay());
+ XFlush(disp);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon
- (JNIEnv *env, jclass clazz, jobject iconBuffer, jint icon_size, jint width, jint height)
+ (JNIEnv *env, jclass clazz, jlong display, jobject iconBuffer, jint icon_size, jint width, jint height)
{
+ Display *disp = (Display *)(intptr_t)display;
char *imgData = (char *)(*env)->GetDirectBufferAddress(env, iconBuffer);
- setIcon(env, imgData, icon_size, width, height);
+ setIcon(env, disp, imgData, icon_size, width, height);
}
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getDisplay(JNIEnv *env, jclass unused) {
- return (intptr_t)getDisplay();
-}
-
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getWindow(JNIEnv *env, jclass unused) {
return getCurrentWindow();
}
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c 2006-10-23 13:58:33 UTC (rev 2591)
@@ -47,13 +47,14 @@
#include "Window.h"
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat
- (JNIEnv *env, jclass clazz, jint screen, jobject pixel_format) {
+ (JNIEnv *env, jclass clazz, jlong display, jint screen, jobject pixel_format) {
+ Display *disp = (Display *)(intptr_t)display;
GLXExtensions extension_flags;
- if (!extgl_InitGLX(getDisplay(), screen, &extension_flags)) {
+ if (!extgl_InitGLX(disp, screen, &extension_flags)) {
throwException(env, "Could not initialize GLX");
return -1;
}
- XVisualInfo *vis_info = chooseVisualGLX(env, getDisplay(), screen, pixel_format, true, true);
+ XVisualInfo *vis_info = chooseVisualGLX(env, disp, screen, pixel_format, true, true);
if (vis_info == NULL) {
throwException(env, "Could not choose a VisualInfo");
return -1;
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c 2006-10-23 10:24:03 UTC (rev 2590)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c 2006-10-23 13:58:33 UTC (rev 2591)
@@ -48,23 +48,25 @@
#include "common_tools.h"
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities
- (JNIEnv *env, jclass clazz)
+ (JNIEnv *env, jclass clazz, jlong display)
{
+ Display *disp = (Display *)(intptr_t)display;
GLXExtensions extension_flags;
- if (!extgl_InitGLX(getDisplay(), getCurrentScreen(), &extension_flags))
+ if (!extgl_InitGLX(disp, getCurrentScreen(), &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, jobject peer_info_handle, jint width, jint height, jobject pixel_format) {
+ (JNIEnv *env, jclass clazz, jlong display, jobject peer_info_handle, jint width, jint height, jobject pixel_format) {
+ Display *disp = (Display *)(intptr_t)display;
GLXExtensions extension_flags;
- if (!extgl_InitGLX(getDisplay(), getCurrentScreen(), &extension_flags) || !extension_flags.GLX13) {
+ if (!extgl_InitGLX(disp, getCurrentScreen(), &extension_flags) || !extension_flags.GLX13) {
throwException(env, "No Pbuffer support");
return;
}
- bool result = initPeerInfo(env, peer_info_handle, getDisplay(), getCurrentScreen(), pixel_format, false, GLX_PBUFFER_BIT, false, true);
+ bool result = initPeerInfo(env, peer_info_handle, disp, getCurrentScreen(), pixel_format, false, GLX_PBUFFER_BIT, false, true);
if (!result)
return;
const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-23 10:24:13
|
Revision: 2590
http://svn.sourceforge.net/java-game-lib/?rev=2590&view=rev
Author: elias_naur
Date: 2006-10-23 03:24:03 -0700 (Mon, 23 Oct 2006)
Log Message:
-----------
Linux: Simplified LinuxMouse
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-20 12:55:01 UTC (rev 2589)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-23 10:24:03 UTC (rev 2590)
@@ -718,12 +718,16 @@
if (new_grab != grab) {
grab = new_grab;
updateInputGrab();
- mouse.changeGrabbed(grab, pointer_grabbed, shouldGrab());
+ mouse.changeGrabbed(grab, shouldWarpPointer());
}
} finally {
unlockAWT();
}
}
+
+ private boolean shouldWarpPointer() {
+ return pointer_grabbed && shouldGrab();
+ }
public int getNativeCursorCapabilities() {
lockAWT();
@@ -980,7 +984,7 @@
private void handlePointerMotionEvent(long millis, long root_window, int x_root, int y_root, int x, int y, int state) {
if (mouse != null)
- mouse.handlePointerMotion(grab, pointer_grabbed, shouldGrab(), millis, root_window, x_root, y_root, x, y);
+ mouse.handlePointerMotion(grab, shouldWarpPointer(), millis, root_window, x_root, y_root, x, y);
}
private void handleWarpEvent(int x, int y) {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java 2006-10-20 12:55:01 UTC (rev 2589)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java 2006-10-23 10:24:03 UTC (rev 2590)
@@ -135,9 +135,9 @@
}
private static native void nSendWarpEvent(long display, long window, int center_x, int center_y);
- private void doHandlePointerMotion(boolean grab, boolean pointer_grabbed, boolean should_grab, long root_window, int root_x, int root_y, int win_x, int win_y, long nanos) {
+ 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);
- if (!pointer_grabbed || !should_grab)
+ if (!warp_pointer)
return;
int root_window_height = nGetWindowHeight(display, root_window);
int root_window_width = nGetWindowWidth(display, root_window);
@@ -165,10 +165,10 @@
}
}
- public void changeGrabbed(boolean grab, boolean pointer_grabbed, boolean should_grab) {
+ public void changeGrabbed(boolean grab, boolean warp_pointer) {
reset();
long root_window = nQueryPointer(display, window, query_pointer_buffer);
- doHandlePointerMotion(grab, pointer_grabbed, should_grab, root_window, query_pointer_buffer.get(0), query_pointer_buffer.get(1), query_pointer_buffer.get(2), query_pointer_buffer.get(3), last_event_nanos);
+ doHandlePointerMotion(grab, warp_pointer, root_window, query_pointer_buffer.get(0), query_pointer_buffer.get(1), query_pointer_buffer.get(2), query_pointer_buffer.get(3), last_event_nanos);
}
public int getButtonCount() {
@@ -188,8 +188,8 @@
}
private static native void nWarpCursor(long display, long window, int x, int y);
- public void handlePointerMotion(boolean grab, boolean pointer_grabbed, boolean should_grab, long millis, long root_window, int x_root, int y_root, int x, int y) {
- doHandlePointerMotion(grab, pointer_grabbed, should_grab, root_window, x_root, y_root, x, y, millis*1000000);
+ public void handlePointerMotion(boolean grab, boolean warp_pointer, long millis, long root_window, int x_root, int y_root, int x, int y) {
+ doHandlePointerMotion(grab, warp_pointer, root_window, x_root, y_root, x, y, millis*1000000);
}
private void handleButton(boolean grab, int button, byte state, long nanos) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-20 12:55:07
|
Revision: 2589
http://svn.sourceforge.net/java-game-lib/?rev=2589&view=rev
Author: elias_naur
Date: 2006-10-20 05:55:01 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
AWTGears: Set background of window to black to avoid some resizing artifacts
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-20 12:36:51 UTC (rev 2588)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-20 12:55:01 UTC (rev 2589)
@@ -32,6 +32,7 @@
package org.lwjgl.test.opengl.awt;
import java.awt.Frame;
+import java.awt.Color;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.nio.FloatBuffer;
@@ -76,6 +77,7 @@
public AWTGears() throws LWJGLException {
setTitle("Gears");
setSize(300, 300);
+ setBackground(Color.BLACK);
add(canvas0 = new AWTGLCanvas() {
long startTime = 0;
long fps = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-20 12:36:57
|
Revision: 2588
http://svn.sourceforge.net/java-game-lib/?rev=2588&view=rev
Author: elias_naur
Date: 2006-10-20 05:36:51 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
Remove redundant resizing of AWT canvases in AWT tests
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-20 12:32:33 UTC (rev 2587)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-20 12:36:51 UTC (rev 2588)
@@ -137,7 +137,6 @@
}
}
});
- canvas0.setBounds(0, 0, 300, 300);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2006-10-20 12:32:33 UTC (rev 2587)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2006-10-20 12:36:51 UTC (rev 2588)
@@ -93,7 +93,6 @@
}
}
});
- canvas0.setBounds(0, 0, 320, 320);
add(canvas1 = new AWTGLCanvas() {
int current_height;
int current_width;
@@ -124,7 +123,6 @@
}
}
});
- canvas1.setBounds(320, 0, 320, 320);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-20 12:32:43
|
Revision: 2587
http://svn.sourceforge.net/java-game-lib/?rev=2587&view=rev
Author: elias_naur
Date: 2006-10-20 05:32:33 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
Added nicer resizing to AWT tests
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-20 11:51:34 UTC (rev 2586)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-20 12:32:33 UTC (rev 2587)
@@ -76,10 +76,11 @@
public AWTGears() throws LWJGLException {
setTitle("Gears");
setSize(300, 300);
- setLayout(null);
add(canvas0 = new AWTGLCanvas() {
long startTime = 0;
- long fps = 0;
+ long fps = 0;
+ int current_width;
+ int current_height;
public void paintGL() {
if(startTime == 0) {
@@ -89,6 +90,11 @@
try {
angle += 2.0f;
+ if (getWidth() != current_width || getHeight() != current_height) {
+ current_width = getWidth();
+ current_height = getHeight();
+ GL11.glViewport(0, 0, current_width, current_height);
+ }
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glPushMatrix();
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2006-10-20 11:51:34 UTC (rev 2586)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2006-10-20 12:32:33 UTC (rev 2587)
@@ -32,6 +32,7 @@
package org.lwjgl.test.opengl.awt;
import java.awt.Frame;
+import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
@@ -61,11 +62,17 @@
public AWTTest() throws LWJGLException {
setTitle("LWJGL AWT Canvas Test");
setSize(640, 320);
- setLayout(null);
+ setLayout(new GridLayout(1, 2));
add(canvas0 = new AWTGLCanvas() {
+ int current_height;
+ int current_width;
public void paintGL() {
try {
- makeCurrent();
+ if (getWidth() != current_width || getHeight() != current_height) {
+ current_width = getWidth();
+ current_height = getHeight();
+ GL11.glViewport(0, 0, current_width, current_height);
+ }
GL11.glViewport(0, 0, getWidth(), getHeight());
GL11.glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
@@ -88,10 +95,16 @@
});
canvas0.setBounds(0, 0, 320, 320);
add(canvas1 = new AWTGLCanvas() {
+ int current_height;
+ int current_width;
public void paintGL() {
try {
angle += 1.0f;
- makeCurrent();
+ if (getWidth() != current_width || getHeight() != current_height) {
+ current_width = getWidth();
+ current_height = getHeight();
+ GL11.glViewport(0, 0, current_width, current_height);
+ }
GL11.glViewport(0, 0, getWidth(), getHeight());
GL11.glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-20 11:51:44
|
Revision: 2586
http://svn.sourceforge.net/java-game-lib/?rev=2586&view=rev
Author: elias_naur
Date: 2006-10-20 04:51:34 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
Linux: Don't use the SUN specific getScreenFromDevice in LinuxAWTCanvasPeerInfo. This avoids garbage creation per frame and avoids one bit of SUN JRE dependency.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2006-10-20 10:44:28 UTC (rev 2585)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2006-10-20 11:51:34 UTC (rev 2586)
@@ -45,20 +45,25 @@
final class LinuxAWTGLCanvasPeerInfo extends LinuxPeerInfo {
private final AWTGLCanvas canvas;
private final AWTSurfaceLock awt_surface = new AWTSurfaceLock();
+ private int screen = -1;
public LinuxAWTGLCanvasPeerInfo(AWTGLCanvas canvas) {
this.canvas = canvas;
}
protected void doLockAndInitHandle() throws LWJGLException {
- int screen = -1;
- try {
- screen = LinuxCanvasImplementation.getScreenFromDevice(canvas.getGraphicsConfiguration().getDevice());
- } catch (LWJGLException e) {
- LWJGLUtil.log("Got exception while trying to determine screen: " + e);
+ ByteBuffer surface_handle = awt_surface.lockAndGetHandle(canvas);
+ if (screen == -1) {
+ try {
+ screen = getScreenFromSurfaceInfo(surface_handle);
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Got exception while trying to determine screen: " + e);
+ screen = 0;
+ }
}
- nInitHandle(screen, awt_surface.lockAndGetHandle(canvas), getHandle());
+ nInitHandle(screen, surface_handle, getHandle());
}
+ private static native int getScreenFromSurfaceInfo(ByteBuffer surface_handle) throws LWJGLException;
private static native void nInitHandle(int screen, ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException;
protected void doUnlock() throws LWJGLException {
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 2006-10-20 10:44:28 UTC (rev 2585)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 2006-10-20 11:51:34 UTC (rev 2586)
@@ -47,33 +47,33 @@
#include "org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h"
#include "context.h"
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_getScreenFromSurfaceInfo
+ (JNIEnv *env, jclass clazz, jobject lock_buffer_handle) {
+ const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
+ // Get the platform-specific drawing info
+ JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo;
+
+ XVisualInfo template;
+ int num_infos;
+ template.visualid = dsi_x11->visualID;
+ template.depth = dsi_x11->depth;
+ XVisualInfo *vis_info = XGetVisualInfo(dsi_x11->display, VisualIDMask | VisualDepthMask, &template, &num_infos);
+ if (vis_info == NULL) {
+ throwException(env, "Could not determine screen");
+ return -1;
+ }
+ int screen = vis_info[0].screen;
+ XFree(vis_info);
+ return screen;
+}
+
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_nInitHandle
(JNIEnv *env, jclass clazz, int screen, jobject lock_buffer_handle, jobject peer_info_handle) {
- if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) {
- throwException(env, "PeerInfo handle buffer not large enough");
- return;
- }
const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
// Get the platform-specific drawing info
JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo;
- // If we couldn't get a screen from java side, attempt to determine a sane screen
- // from the information we do have, namely the visualid and the depth
- if (screen == -1) {
- XVisualInfo template;
- int num_infos;
- template.visualid = dsi_x11->visualID;
- template.depth = dsi_x11->depth;
- XVisualInfo *vis_info = XGetVisualInfo(dsi_x11->display, VisualIDMask | VisualDepthMask, &template, &num_infos);
- if (vis_info == NULL) {
- throwException(env, "Could not determine screen");
- return;
- }
- screen = vis_info[0].screen;
- XFree(vis_info);
- }
-
peer_info->display = dsi_x11->display;
peer_info->screen = screen;
peer_info->drawable = dsi_x11->drawable;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-20 10:44:35
|
Revision: 2585
http://svn.sourceforge.net/java-game-lib/?rev=2585&view=rev
Author: elias_naur
Date: 2006-10-20 03:44:28 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
Undo debug stuff that accidentially went with the last commit.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2006-10-20 10:42:43 UTC (rev 2584)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2006-10-20 10:44:28 UTC (rev 2585)
@@ -51,12 +51,12 @@
}
protected void doLockAndInitHandle() throws LWJGLException {
- int screen = 0;//-1;
-/* try {
+ int screen = -1;
+ try {
screen = LinuxCanvasImplementation.getScreenFromDevice(canvas.getGraphicsConfiguration().getDevice());
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while trying to determine screen: " + e);
- }*/
+ }
nInitHandle(screen, awt_surface.lockAndGetHandle(canvas), getHandle());
}
private static native void nInitHandle(int screen, ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-20 10:42:56
|
Revision: 2584
http://svn.sourceforge.net/java-game-lib/?rev=2584&view=rev
Author: elias_naur
Date: 2006-10-20 03:42:43 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
Don't repaint() from a separate thread in AWT demos. This results in a smoother rendering.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2006-10-11 20:26:35 UTC (rev 2583)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2006-10-20 10:42:43 UTC (rev 2584)
@@ -51,12 +51,12 @@
}
protected void doLockAndInitHandle() throws LWJGLException {
- int screen = -1;
- try {
+ int screen = 0;//-1;
+/* try {
screen = LinuxCanvasImplementation.getScreenFromDevice(canvas.getGraphicsConfiguration().getDevice());
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while trying to determine screen: " + e);
- }
+ }*/
nInitHandle(screen, awt_surface.lockAndGetHandle(canvas), getHandle());
}
private static native void nInitHandle(int screen, ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException;
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-11 20:26:35 UTC (rev 2583)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2006-10-20 10:42:43 UTC (rev 2584)
@@ -116,6 +116,7 @@
GL11.glPopMatrix();
swapBuffers();
+ repaint();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
@@ -139,17 +140,6 @@
});
setResizable(true);
setVisible(true);
-
- new Thread() {
- {
- setDaemon(true);
- }
- public void run() {
- for (;;) {
- canvas0.repaint();
- }
- }
- }.start();
}
private void setup() {
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2006-10-11 20:26:35 UTC (rev 2583)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2006-10-20 10:42:43 UTC (rev 2584)
@@ -53,7 +53,7 @@
/** AWT GL canvas */
private AWTGLCanvas canvas0, canvas1;
- private float angle;
+ private volatile float angle;
/**
* C'tor
@@ -80,6 +80,7 @@
GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
GL11.glPopMatrix();
swapBuffers();
+ repaint();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
@@ -89,6 +90,7 @@
add(canvas1 = new AWTGLCanvas() {
public void paintGL() {
try {
+ angle += 1.0f;
makeCurrent();
GL11.glViewport(0, 0, getWidth(), getHeight());
GL11.glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
@@ -103,6 +105,7 @@
GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
GL11.glPopMatrix();
swapBuffers();
+ repaint();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
@@ -117,24 +120,6 @@
});
setResizable(true);
setVisible(true);
-
- new Thread() {
- {
- setDaemon(true);
- }
- public void run() {
- for (;;) {
- angle += 1.0f;
- canvas0.repaint();
- canvas1.repaint();
- try {
- sleep(20);
- } catch (InterruptedException e) {
- break;
- }
- }
- }
- }.start();
}
public static void main(String[] args) throws LWJGLException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-11 20:26:50
|
Revision: 2583
http://svn.sourceforge.net/java-game-lib/?rev=2583&view=rev
Author: elias_naur
Date: 2006-10-11 13:26:35 -0700 (Wed, 11 Oct 2006)
Log Message:
-----------
Windows: Restore the old ToAscii code used on win9x platforms in an attempt to fix broken keyboard input on win98se machines.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2006-10-11 13:48:48 UTC (rev 2582)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2006-10-11 20:26:35 UTC (rev 2583)
@@ -51,7 +51,9 @@
private final WindowsDirectInputDevice keyboard;
private final IntBuffer temp_data_buffer;
private final ByteBuffer keyboard_state;
+ private final boolean unicode;
private final CharBuffer unicode_buffer;
+ private final ByteBuffer ascii_buffer;
public WindowsKeyboard(WindowsDirectInput dinput, long hwnd) throws LWJGLException {
this.dinput = dinput;
@@ -72,9 +74,19 @@
keyboard.acquire();
temp_data_buffer = BufferUtils.createIntBuffer(BUFFER_SIZE*WindowsDirectInputDevice.DATA_SIZE);
keyboard_state = BufferUtils.createByteBuffer(256);
- unicode_buffer = BufferUtils.createCharBuffer(BUFFER_SIZE);
+ unicode = isWindowsNT();
+ if (unicode) {
+ unicode_buffer = BufferUtils.createCharBuffer(BUFFER_SIZE);
+ ascii_buffer = null;
+ } else {
+ unicode_buffer = null;
+ // ToAscii returns at most 2 characters
+ ascii_buffer = BufferUtils.createByteBuffer(2);
+ }
}
+ private static native boolean isWindowsNT();
+
public void destroy() {
keyboard.unacquire();
keyboard.release();
@@ -117,12 +129,22 @@
if (virt_key != 0 && GetKeyboardState(keyboard_state) != 0) {
// Mark key down in the scan code
dwOfs = dwOfs & 0x7fff;
- unicode_buffer.clear();
- int num_chars = ToUnicode(virt_key,
+ int num_chars;
+ if (unicode) {
+ unicode_buffer.clear();
+ num_chars = ToUnicode(virt_key,
dwOfs,
keyboard_state,
unicode_buffer,
unicode_buffer.capacity(), 0);
+ } else {
+ ascii_buffer.clear();
+ num_chars = ToAscii(virt_key,
+ dwOfs,
+ keyboard_state,
+ ascii_buffer,
+ 0);
+ }
if (num_chars > 0) {
int current_char = 0;
do {
@@ -130,7 +152,12 @@
dst.putInt(0);
dst.put((byte)0);
}
- int char_int = ((int)unicode_buffer.get()) & 0xFFFF;
+ int char_int;
+ if (unicode) {
+ char_int = ((int)unicode_buffer.get()) & 0xFFFF;
+ } else {
+ char_int = ((int)ascii_buffer.get()) & 0xFF;
+ }
dst.putInt(char_int);
dst.putLong(nanos);
current_char++;
@@ -151,6 +178,7 @@
}
private static native int MapVirtualKey(int uCode, int uMapType);
private static native int ToUnicode(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, CharBuffer pwszBuff, int cchBuff, int flags);
+ private static native int ToAscii(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, ByteBuffer lpChar, int flags);
private static native int GetKeyboardState(ByteBuffer lpKeyState);
public void read(ByteBuffer buffer) {
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c 2006-10-11 13:48:48 UTC (rev 2582)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c 2006-10-11 20:26:35 UTC (rev 2583)
@@ -45,12 +45,26 @@
return MapVirtualKey(uCode, uMapType);
}
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_isWindowsNT(JNIEnv *env, jclass unused) {
+ OSVERSIONINFO osvi;
+
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+ return osvi.dwPlatformId == VER_PLATFORM_WIN32_NT ? JNI_TRUE : JNI_FALSE;
+}
+
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToUnicode(JNIEnv *env, jclass unused, jint wVirtKey, jint wScanCode, jobject lpKeyState_obj, jobject pwszBuff_obj, jint cchBuff, jint flags) {
const PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj);
LPWSTR pwszBuff = (*env)->GetDirectBufferAddress(env, pwszBuff_obj);
return ToUnicode(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff, flags);
}
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToAscii(JNIEnv *env, jclass unused, jint wVirtKey, jint wScanCode, jobject lpKeyState_obj, jobject lpChar_obj, jint flags) {
+ const PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj);
+ LPWORD lpChar = (*env)->GetDirectBufferAddress(env, lpChar_obj);
+ return ToAscii(wVirtKey, wScanCode, lpKeyState, lpChar, flags);
+}
+
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyboardState(JNIEnv *env, jclass unused, jobject lpKeyState_obj) {
PBYTE lpKeyState = (*env)->GetDirectBufferAddress(env, lpKeyState_obj);
return GetKeyboardState(lpKeyState);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-11 13:49:06
|
Revision: 2582
http://svn.sourceforge.net/java-game-lib/?rev=2582&view=rev
Author: elias_naur
Date: 2006-10-11 06:48:48 -0700 (Wed, 11 Oct 2006)
Log Message:
-----------
Windows: Don't use a dummy window (HDC) when finding a pixel format but use the actual window directly. This will avoid cases where the pixel format index for the dummy window's HDC wasn't valid for the actual window's HDC. It also avoid unnecessary complexity.
Fix FullScreenWindowedTest to use the Display's current BPP to avoid 24/16 bpp weirdness
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java
trunk/LWJGL/src/native/windows/context.c
trunk/LWJGL/src/native/windows/context.h
trunk/LWJGL/src/native/windows/display.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java 2006-10-11 11:21:40 UTC (rev 2581)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java 2006-10-11 13:48:48 UTC (rev 2582)
@@ -80,7 +80,7 @@
private void initialize() {
try {
//find displaymode
- mode = findDisplayMode(800, 600, 16);
+ mode = findDisplayMode(800, 600, Display.getDisplayMode().getBitsPerPixel());
// start of in windowed mode
Display.create();
glInit();
Modified: trunk/LWJGL/src/native/windows/context.c
===================================================================
--- trunk/LWJGL/src/native/windows/context.c 2006-10-11 11:21:40 UTC (rev 2581)
+++ trunk/LWJGL/src/native/windows/context.c 2006-10-11 13:48:48 UTC (rev 2582)
@@ -370,68 +370,76 @@
return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer);
}
-static int findPixelFormatOnDC(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer, bool floating_point) {
+static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, bool floating_point, jobject pixelFormatCaps) {
+ if (!wglMakeCurrent(dummy_hdc, dummy_hglrc)) {
+ throwException(env, "Could not bind context to dummy window");
+ return false;
+ }
+ extgl_InitWGL(extensions);
+
+ if (!extensions->WGL_ARB_pixel_format) {
+ throwException(env, "No support for WGL_ARB_pixel_format");
+ return false;
+ }
+ if (samples > 0 && !extensions->WGL_ARB_multisample) {
+ throwException(env, "No support for WGL_ARB_multisample");
+ return false;
+ }
+ /*
+ * Apparently, some drivers don't report WGL_ARB_pixel_format_float
+ * even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float
+ * is supported.
+ */
+ if (floating_point && !(extensions->WGL_ARB_pixel_format_float || extensions->WGL_ATI_pixel_format_float)) {
+ throwException(env, "No support for WGL_ARB_pixel_format_float nor WGL_ATI_pixel_format_float");
+ return false;
+ }
+ if (pixelFormatCaps != NULL && !extensions->WGL_ARB_render_texture) {
+ throwException(env, "No support for WGL_ARB_render_texture");
+ return false;
+ }
+ return true;
+}
+
+int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer, bool floating_point) {
HGLRC dummy_hglrc;
HDC saved_current_hdc;
HGLRC saved_current_hglrc;
WGLExtensions extensions;
+ HWND dummy_hwnd;
+ HDC dummy_hdc;
int pixel_format_id;
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
bool use_arb_selection = samples > 0 || floating_point || pbuffer || pixelFormatCaps != NULL;
pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer);
if (pixel_format_id != -1 && use_arb_selection) {
- if (!applyPixelFormat(env, hdc, pixel_format_id)) {
+ dummy_hwnd = createDummyWindow(origin_x, origin_y);
+ if (dummy_hwnd == NULL) {
+ throwException(env, "Could not create dummy window");
return -1;
}
- dummy_hglrc = wglCreateContext(hdc);
+ dummy_hdc = GetDC(dummy_hwnd);
+ if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) {
+ closeWindow(&dummy_hwnd, &dummy_hdc);
+ return -1;
+ }
+ dummy_hglrc = wglCreateContext(dummy_hdc);
if (dummy_hglrc == NULL) {
+ closeWindow(&dummy_hwnd, &dummy_hdc);
throwException(env, "Failed to create OpenGL rendering context");
return -1;
}
// Save the current HDC and HGLRC to avoid disruption
saved_current_hdc = wglGetCurrentDC();
saved_current_hglrc = wglGetCurrentContext();
- if (!wglMakeCurrent(hdc, dummy_hglrc)) {
- wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
- wglDeleteContext(dummy_hglrc);
- throwException(env, "Could not bind context to dummy window");
- return -1;
- }
- extgl_InitWGL(&extensions);
-
- if (!extensions.WGL_ARB_pixel_format) {
- wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
- wglDeleteContext(dummy_hglrc);
- throwException(env, "No support for WGL_ARB_pixel_format");
- return -1;
- }
- if (samples > 0 && !extensions.WGL_ARB_multisample) {
- wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
- wglDeleteContext(dummy_hglrc);
- throwException(env, "No support for WGL_ARB_multisample");
- return -1;
- }
- /*
- * Apparently, some drivers don't report WGL_ARB_pixel_format_float
- * even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float
- * is supported.
- */
- if (floating_point && !(extensions.WGL_ARB_pixel_format_float || extensions.WGL_ATI_pixel_format_float)) {
- wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
- wglDeleteContext(dummy_hglrc);
- throwException(env, "No support for WGL_ARB_pixel_format_float nor WGL_ATI_pixel_format_float");
- return -1;
- }
- if (pixelFormatCaps != NULL && !extensions.WGL_ARB_render_texture) {
- wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
- wglDeleteContext(dummy_hglrc);
- throwException(env, "No support for WGL_ARB_render_texture");
- return -1;
- }
- pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);
+ if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, floating_point, pixelFormatCaps)) {
+ pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);
+ } else
+ pixel_format_id = -1;
wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
wglDeleteContext(dummy_hglrc);
+ closeWindow(&dummy_hwnd, &dummy_hdc);
}
if (pixel_format_id == -1) {
throwException(env, "Could not find a valid pixel format");
@@ -455,18 +463,3 @@
return NULL;
return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false);
}
-
-int findPixelFormat(JNIEnv *env, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer, bool floating_point) {
- HWND dummy_hwnd;
- HDC dummy_hdc;
- int pixel_format_id;
- dummy_hwnd = createDummyWindow(origin_x, origin_y);
- if (dummy_hwnd == NULL) {
- throwException(env, "Failed to create the dummy window.");
- return -1;
- }
- dummy_hdc = GetDC(dummy_hwnd);
- pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);
- closeWindow(&dummy_hwnd, &dummy_hdc);
- return pixel_format_id;
-}
Modified: trunk/LWJGL/src/native/windows/context.h
===================================================================
--- trunk/LWJGL/src/native/windows/context.h 2006-10-11 11:21:40 UTC (rev 2581)
+++ trunk/LWJGL/src/native/windows/context.h 2006-10-11 13:48:48 UTC (rev 2582)
@@ -88,6 +88,6 @@
*/
extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated);
-extern int findPixelFormat(JNIEnv *env, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer, bool floating_point);
+extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer, bool floating_point);
#endif
Modified: trunk/LWJGL/src/native/windows/display.c
===================================================================
--- trunk/LWJGL/src/native/windows/display.c 2006-10-11 11:21:40 UTC (rev 2581)
+++ trunk/LWJGL/src/native/windows/display.c 2006-10-11 13:48:48 UTC (rev 2582)
@@ -40,10 +40,6 @@
*/
#include <windows.h>
-// Multimon.h enables multi monitor emulation on win95 and winnt4
-// So we only need the extended, multi-monitor aware path
-//#define COMPILE_MULTIMON_STUBS
-//#include <Multimon.h>
#include <jni.h>
#include "org_lwjgl_opengl_WindowsDisplay.h"
#include "display.h"
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c 2006-10-11 11:21:40 UTC (rev 2581)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c 2006-10-11 13:48:48 UTC (rev 2582)
@@ -62,15 +62,17 @@
HGLRC saved_context;
int pixel_format_id;
- pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixelFormatCaps, false, true, false, false, false);
- if (pixel_format_id == -1)
- return false;
dummy_hwnd = createDummyWindow(origin_x, origin_y);
if (dummy_hwnd == NULL) {
throwException(env, "Could not create dummy window");
return false;
}
dummy_hdc = GetDC(dummy_hwnd);
+ pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, true, false, false, false);
+ if (pixel_format_id == -1) {
+ closeWindow(&dummy_hwnd, &dummy_hdc);
+ return false;
+ }
if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) {
closeWindow(&dummy_hwnd, &dummy_hdc);
return false;
@@ -142,9 +144,6 @@
} else {
pBufferAttribs_ptr = NULL;
}
- pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false, floating_point);
- if (pixel_format_id == -1)
- return;
if (!getExtensions(env, &extensions, pixel_format, pixelFormatCaps))
return;
dummy_hwnd = createDummyWindow(origin_x, origin_y);
@@ -153,6 +152,11 @@
return;
}
dummy_hdc = GetDC(dummy_hwnd);
+ pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false, floating_point);
+ if (pixel_format_id == -1) {
+ closeWindow(&dummy_hwnd, &dummy_hdc);
+ return;
+ }
Pbuffer = extensions.wglCreatePbufferARB(dummy_hdc, pixel_format_id, width, height, pBufferAttribs_ptr);
closeWindow(&dummy_hwnd, &dummy_hdc);
if (Pbuffer == NULL) {
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c 2006-10-11 11:21:40 UTC (rev 2581)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c 2006-10-11 13:48:48 UTC (rev 2582)
@@ -52,7 +52,7 @@
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
- int pixel_format_id = findPixelFormat(env, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);
+ int pixel_format_id = findPixelFormatOnDC(env, peer_info->drawable_hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);
if (pixel_format_id == -1)
return;
// Let it throw
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2006-10-11 11:22:08
|
Revision: 2581
http://svn.sourceforge.net/java-game-lib/?rev=2581&view=rev
Author: spasi
Date: 2006-10-11 04:21:40 -0700 (Wed, 11 Oct 2006)
Log Message:
-----------
Added missing CURRENT_RASTER_SECONDARY_COLOR enum value (GL 2.1)
Added EXT_gpu_program_parameters extension
Modified Paths:
--------------
trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java
trunk/LWJGL/src/generated/org/lwjgl/opengl/GL21.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL21.java
Added Paths:
-----------
trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTGpuProgramParameters.java
trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTGpuProgramParameters.c
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java
Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java
===================================================================
--- trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java 2006-10-08 09:05:16 UTC (rev 2580)
+++ trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java 2006-10-11 11:21:40 UTC (rev 2581)
@@ -77,6 +77,7 @@
public final boolean GL_EXT_framebuffer_blit;
public final boolean GL_EXT_framebuffer_multisample;
public final boolean GL_EXT_framebuffer_object;
+ public final boolean GL_EXT_gpu_program_parameters;
public final boolean GL_EXT_multi_draw_arrays;
public final boolean GL_EXT_packed_depth_stencil;
public final boolean GL_EXT_packed_pixels;
@@ -453,6 +454,8 @@
long EXT_framebuffer_object_glFramebufferRenderbufferEXT_pointer;
long EXT_framebuffer_object_glGetFramebufferAttachmentParameterivEXT_pointer;
long EXT_framebuffer_object_glGenerateMipmapEXT_pointer;
+ long EXT_gpu_program_parameters_glProgramEnvParameter4fvEXT_pointer;
+ long EXT_gpu_program_parameters_glProgramLocalParameter4fvEXT_pointer;
long EXT_multi_draw_arrays_glMultiDrawArraysEXT_pointer;
long EXT_paletted_texture_glColorTableEXT_pointer;
long EXT_paletted_texture_glColorSubTableEXT_pointer;
@@ -1464,6 +1467,12 @@
(EXT_framebuffer_object_glGenerateMipmapEXT_pointer = GLContext.getFunctionAddress("glGenerateMipmapEXT")) != 0;
}
+ private boolean EXT_gpu_program_parameters_initNativeFunctionAddresses() {
+ return
+ (EXT_gpu_program_parameters_glProgramEnvParameter4fvEXT_pointer = GLContext.getFunctionAddress("glProgramEnvParameter4fvEXT")) != 0 &&
+ (EXT_gpu_program_parameters_glProgramLocalParameter4fvEXT_pointer = GLContext.getFunctionAddress("glProgramLocalParameter4fvEXT")) != 0;
+ }
+
private boolean EXT_multi_draw_arrays_initNativeFunctionAddresses() {
return
(EXT_multi_draw_arrays_glMultiDrawArraysEXT_pointer = GLContext.getFunctionAddress("glMultiDrawArraysEXT")) != 0;
@@ -2232,6 +2241,8 @@
supported_extensions.remove("GL_EXT_framebuffer_multisample");
if (supported_extensions.contains("GL_EXT_framebuffer_object") && !EXT_framebuffer_object_initNativeFunctionAddresses())
supported_extensions.remove("GL_EXT_framebuffer_object");
+ if (supported_extensions.contains("GL_EXT_gpu_program_parameters") && !EXT_gpu_program_parameters_initNativeFunctionAddresses())
+ supported_extensions.remove("GL_EXT_gpu_program_parameters");
if (supported_extensions.contains("GL_EXT_multi_draw_arrays") && !EXT_multi_draw_arrays_initNativeFunctionAddresses())
supported_extensions.remove("GL_EXT_multi_draw_arrays");
if (supported_extensions.contains("GL_EXT_paletted_texture") && !EXT_paletted_texture_initNativeFunctionAddresses())
@@ -2367,6 +2378,7 @@
this.GL_EXT_framebuffer_blit = supported_extensions.contains("GL_EXT_framebuffer_blit");
this.GL_EXT_framebuffer_multisample = supported_extensions.contains("GL_EXT_framebuffer_multisample");
this.GL_EXT_framebuffer_object = supported_extensions.contains("GL_EXT_framebuffer_object");
+ this.GL_EXT_gpu_program_parameters = supported_extensions.contains("GL_EXT_gpu_program_parameters");
this.GL_EXT_multi_draw_arrays = supported_extensions.contains("GL_EXT_multi_draw_arrays");
this.GL_EXT_packed_depth_stencil = supported_extensions.contains("GL_EXT_packed_depth_stencil");
this.GL_EXT_packed_pixels = supported_extensions.contains("GL_EXT_packed_pixels");
Added: trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTGpuProgramParameters.java
===================================================================
--- trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTGpuProgramParameters.java (rev 0)
+++ trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTGpuProgramParameters.java 2006-10-11 11:21:40 UTC (rev 2581)
@@ -0,0 +1,30 @@
+/* MACHINE GENERATED FILE, DO NOT EDIT */
+
+package org.lwjgl.opengl;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.BufferChecks;
+import java.nio.*;
+
+public final class EXTGpuProgramParameters {
+
+ private EXTGpuProgramParameters() {
+ }
+
+
+ public static void glProgramEnvParameter4EXT(int target, int index, int count, FloatBuffer params) {
+ long function_pointer = GLContext.getCapabilities().EXT_gpu_program_parameters_glProgramEnvParameter4fvEXT_pointer;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ BufferChecks.checkBuffer(params, count << 2);
+ nglProgramEnvParameter4fvEXT(target, index, count, params, params.position(), function_pointer);
+ }
+ private static native void nglProgramEnvParameter4fvEXT(int target, int index, int count, FloatBuffer params, int params_position, long function_pointer);
+
+ public static void glProgramLocalParameter4EXT(int target, int index, int count, FloatBuffer params) {
+ long function_pointer = GLContext.getCapabilities().EXT_gpu_program_parameters_glProgramLocalParameter4fvEXT_pointer;
+ BufferChecks.checkFunctionAddress(function_pointer);
+ BufferChecks.checkBuffer(params, count << 2);
+ nglProgramLocalParameter4fvEXT(target, index, count, params, params.position(), function_pointer);
+ }
+ private static native void nglProgramLocalParameter4fvEXT(int target, int index, int count, FloatBuffer params, int params_position, long function_pointer);
+}
Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/GL21.java
===================================================================
--- trunk/LWJGL/src/generated/org/lwjgl/opengl/GL21.java 2006-10-08 09:05:16 UTC (rev 2580)
+++ trunk/LWJGL/src/generated/org/lwjgl/opengl/GL21.java 2006-10-11 11:21:40 UTC (rev 2581)
@@ -39,7 +39,7 @@
/**
* Accepted by the <pname> parameter of GetIntegerv and GetFloatv.
*/
- public static final int GL_CURRENT_RASTER_SECONDARY_COLOR = 0xffffffff;
+ public static final int GL_CURRENT_RASTER_SECONDARY_COLOR = 0x845f;
private GL21() {
}
Added: trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTGpuProgramParameters.c
===================================================================
--- trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTGpuProgramParameters.c (rev 0)
+++ trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTGpuProgramParameters.c 2006-10-11 11:21:40 UTC (rev 2581)
@@ -0,0 +1,20 @@
+/* MACHINE GENERATED FILE, DO NOT EDIT */
+
+#include <jni.h>
+#include "extgl.h"
+
+typedef void (APIENTRY *glProgramEnvParameter4fvEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+typedef void (APIENTRY *glProgramLocalParameter4fvEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTGpuProgramParameters_nglProgramEnvParameter4fvEXT(JNIEnv *env, jclass clazz, jint target, jint index, jint count, jobject params, jint params_position, jlong function_pointer) {
+ const GLfloat *params_address = ((const GLfloat *)(*env)->GetDirectBufferAddress(env, params)) + params_position;
+ glProgramEnvParameter4fvEXTPROC glProgramEnvParameter4fvEXT = (glProgramEnvParameter4fvEXTPROC)((intptr_t)function_pointer);
+ glProgramEnvParameter4fvEXT(target, index, count, params_address);
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTGpuProgramParameters_nglProgramLocalParameter4fvEXT(JNIEnv *env, jclass clazz, jint target, jint index, jint count, jobject params, jint params_position, jlong function_pointer) {
+ const GLfloat *params_address = ((const GLfloat *)(*env)->GetDirectBufferAddress(env, params)) + params_position;
+ glProgramLocalParameter4fvEXTPROC glProgramLocalParameter4fvEXT = (glProgramLocalParameter4fvEXTPROC)((intptr_t)function_pointer);
+ glProgramLocalParameter4fvEXT(target, index, count, params_address);
+}
+
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_program_parameters.java 2006-10-11 11:21:40 UTC (rev 2581)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.*;
+
+import java.nio.*;
+
+public interface EXT_gpu_program_parameters {
+
+ @StripPostfix("params")
+ void glProgramEnvParameter4fvEXT(@GLenum int target, @GLuint int index, @GLsizei int count, @Check("count << 2") @Const FloatBuffer params);
+
+ @StripPostfix("params")
+ void glProgramLocalParameter4fvEXT(@GLenum int target, @GLuint int index, @GLsizei int count, @Check("count << 2") @Const FloatBuffer params);
+
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL21.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL21.java 2006-10-08 09:05:16 UTC (rev 2580)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL21.java 2006-10-11 11:21:40 UTC (rev 2581)
@@ -112,6 +112,6 @@
/**
* Accepted by the <pname> parameter of GetIntegerv and GetFloatv.
*/
- int GL_CURRENT_RASTER_SECONDARY_COLOR = -1; // TODO: Find this value
+ int GL_CURRENT_RASTER_SECONDARY_COLOR = 0x845F;
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-08 09:05:29
|
Revision: 2580
http://svn.sourceforge.net/java-game-lib/?rev=2580&view=rev
Author: elias_naur
Date: 2006-10-08 02:05:16 -0700 (Sun, 08 Oct 2006)
Log Message:
-----------
Made Display.getImplementation package private, and made the input.* packages access it through reflection.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java 2006-09-28 21:53:18 UTC (rev 2579)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java 2006-10-08 09:05:16 UTC (rev 2580)
@@ -38,7 +38,7 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
-import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayImplementation;
/**
*
@@ -115,7 +115,7 @@
* @return the maximum size of a native cursor
*/
public static int getMinCursorSize() {
- return Display.getImplementation().getMinCursorSize();
+ return Mouse.getImplementation().getMinCursorSize();
}
/**
@@ -126,7 +126,7 @@
* @return the maximum size of a native cursor
*/
public static int getMaxCursorSize() {
- return Display.getImplementation().getMaxCursorSize();
+ return Mouse.getImplementation().getMaxCursorSize();
}
/**
@@ -138,7 +138,7 @@
* @return A bit mask with native cursor capabilities.
*/
public static int getCapabilities() {
- return Display.getImplementation().getNativeCursorCapabilities();
+ return Mouse.getImplementation().getNativeCursorCapabilities();
}
/**
@@ -164,7 +164,7 @@
// create our cursor elements
cursors = new CursorElement[numImages];
for(int i=0; i<numImages; i++) {
- Object handle = Display.getImplementation().createCursor(width, height, xHotspot, yHotspot, 1, images_copy, null);
+ Object handle = Mouse.getImplementation().createCursor(width, height, xHotspot, yHotspot, 1, images_copy, null);
long delay = (delays != null) ? delays.get(i) : 0;
long timeout = System.currentTimeMillis();
cursors[i] = new CursorElement(handle, delay, timeout);
@@ -175,7 +175,7 @@
break;
case LWJGLUtil.PLATFORM_LINUX:
// create our cursor elements
- Object handle = Display.getImplementation().createCursor(width, height, xHotspot, yHotspot, numImages, images_copy, delays);
+ Object handle = Mouse.getImplementation().createCursor(width, height, xHotspot, yHotspot, numImages, images_copy, delays);
CursorElement cursor_element = new CursorElement(handle, -1, -1);
cursors = new CursorElement[]{cursor_element};
break;
@@ -251,7 +251,7 @@
}
}
for(int i=0; i<cursors.length; i++) {
- Display.getImplementation().destroyCursor(cursors[i].cursorHandle);
+ Mouse.getImplementation().destroyCursor(cursors[i].cursorHandle);
}
destroyed = true;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-09-28 21:53:18 UTC (rev 2579)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-10-08 09:05:16 UTC (rev 2580)
@@ -42,6 +42,7 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayImplementation;
/**
* <br>
@@ -263,6 +264,8 @@
/** One time initialization */
private static boolean initialized;
+ private static DisplayImplementation implementation;
+
/**
* Keyboard cannot be constructed.
*/
@@ -292,7 +295,8 @@
initialize();
if (created)
return;
- Display.getImplementation().createKeyboard();
+ implementation = Mouse.getImplementation();
+ implementation.createKeyboard();
created = true;
readBuffer = ByteBuffer.allocate(EVENT_SIZE*BUFFER_SIZE);
reset();
@@ -321,7 +325,7 @@
if (!created)
return;
created = false;
- Display.getImplementation().destroyKeyboard();
+ implementation.destroyKeyboard();
reset();
}
@@ -346,13 +350,13 @@
public static void poll() {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can poll the device");
- Display.getImplementation().pollKeyboard(keyDownBuffer);
+ implementation.pollKeyboard(keyDownBuffer);
read();
}
private static void read() {
readBuffer.compact();
- Display.getImplementation().readKeyboard(readBuffer);
+ implementation.readKeyboard(readBuffer);
readBuffer.flip();
}
@@ -376,7 +380,7 @@
/* public static int isStateKeySet(int key) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can query key state");
- return Display.getImplementation().isStateKeySet(key);
+ return implementation.isStateKeySet(key);
}
*/
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-09-28 21:53:18 UTC (rev 2579)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-10-08 09:05:16 UTC (rev 2580)
@@ -40,8 +40,15 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
+import org.lwjgl.opengl.DisplayImplementation;
import org.lwjgl.opengl.Display;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+
+
/**
* <br>
* A raw Mouse interface. This can be used to poll the current state of the
@@ -126,6 +133,8 @@
private static final int BUFFER_SIZE = 50;
private static boolean isGrabbed;
+
+ private static DisplayImplementation implementation;
/** Whether we're running windows - which need to manually update cursor animation */
private static final boolean isWindows = LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS;
@@ -163,10 +172,10 @@
currentCursor = cursor;
if (isCreated()) {
if (currentCursor != null) {
- Display.getImplementation().setNativeCursor(currentCursor.getHandle());
+ implementation.setNativeCursor(currentCursor.getHandle());
currentCursor.setTimeout();
} else {
- Display.getImplementation().setNativeCursor(null);
+ implementation.setNativeCursor(null);
}
}
return oldCursor;
@@ -187,7 +196,7 @@
x = event_x = new_x;
y = event_y = new_y;
if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0)
- Display.getImplementation().setCursorPosition(x, y);
+ implementation.setCursorPosition(x, y);
}
/**
@@ -211,6 +220,23 @@
readBuffer.position(readBuffer.limit());
}
+ static DisplayImplementation getImplementation() {
+ /* Use reflection since we can't make Display.getImplementation
+ * public
+ */
+ try {
+ return (DisplayImplementation)AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws Exception{
+ Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
+ getImplementation_method.setAccessible(true);
+ return getImplementation_method.invoke(null, null);
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw new Error(e);
+ }
+ }
+
/**
* "Create" the mouse. The display must first have been created.
* Initially, the mouse is not grabbed and the delta values are reported
@@ -224,12 +250,13 @@
if (!initialized)
initialize();
if (created) return;
- Display.getImplementation().createMouse();
- hasWheel = Display.getImplementation().hasWheel();
+ implementation = getImplementation();
+ implementation.createMouse();
+ hasWheel = implementation.hasWheel();
created = true;
// set mouse buttons
- buttonCount = Display.getImplementation().getButtonCount();
+ buttonCount = implementation.getButtonCount();
buttons = BufferUtils.createByteBuffer(buttonCount);
coord_buffer = BufferUtils.createIntBuffer(3);
if (currentCursor != null)
@@ -255,7 +282,7 @@
buttons = null;
coord_buffer = null;
- Display.getImplementation().destroyMouse();
+ implementation.destroyMouse();
}
/**
@@ -281,7 +308,7 @@
*/
public static void poll() {
if (!created) throw new IllegalStateException("Mouse must be created before you can poll it");
- Display.getImplementation().pollMouse(coord_buffer, buttons);
+ implementation.pollMouse(coord_buffer, buttons);
/* If we're grabbed, poll returns mouse deltas, if not it returns absolute coordinates */
int poll_coord1 = coord_buffer.get(0);
@@ -308,7 +335,7 @@
private static void read() {
readBuffer.compact();
- Display.getImplementation().readMouse(readBuffer);
+ implementation.readMouse(readBuffer);
readBuffer.flip();
}
@@ -527,7 +554,7 @@
public static void setGrabbed(boolean grab) {
isGrabbed = grab;
if (isCreated()) {
- Display.getImplementation().grabMouse(isGrabbed);
+ implementation.grabMouse(isGrabbed);
resetMouse();
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-09-28 21:53:18 UTC (rev 2579)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-10-08 09:05:16 UTC (rev 2580)
@@ -718,7 +718,7 @@
GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight());
}
- public static DisplayImplementation getImplementation() {
+ static DisplayImplementation getImplementation() {
return display_impl;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|