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) |
2
(2) |
3
(2) |
4
|
5
(2) |
|
6
(5) |
7
(22) |
8
(4) |
9
(5) |
10
(6) |
11
(5) |
12
(7) |
|
13
(11) |
14
(1) |
15
(1) |
16
|
17
|
18
(3) |
19
(1) |
|
20
(10) |
21
(3) |
22
(7) |
23
|
24
(2) |
25
(2) |
26
(2) |
|
27
(1) |
28
(1) |
29
(4) |
30
(9) |
|
|
|
|
From: <eli...@us...> - 2008-04-30 19:00:15
|
Revision: 3059
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3059&view=rev
Author: elias_naur
Date: 2008-04-30 12:00:08 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Windows: Check for Display.isCreated in Sys.getHwnd()
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 16:40:14 UTC (rev 3058)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 19:00:08 UTC (rev 3059)
@@ -65,6 +65,8 @@
private static native long nGetTime();
private static long getHwnd() {
+ if (!Display.isCreated())
+ return 0;
/* Use reflection since we can't make Display.getImplementation
* public
*/
@@ -74,8 +76,6 @@
Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
getImplementation_method.setAccessible(true);
Object display_impl = getImplementation_method.invoke(null, null);
- if (display_impl == null)
- return null;
Class WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd", null);
getHwnd_method.setAccessible(true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 16:40:22
|
Revision: 3058
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3058&view=rev
Author: elias_naur
Date: 2008-04-30 09:40:14 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Windows: Moved hwnd and hdc to java
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/windows/Window.h
trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 16:01:25 UTC (rev 3057)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 16:40:14 UTC (rev 3058)
@@ -31,7 +31,13 @@
*/
package org.lwjgl;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+import java.security.AccessController;
+import java.lang.reflect.Method;
+import org.lwjgl.opengl.Display;
+
/**
* <p>
* @author $Author$
@@ -39,7 +45,7 @@
* $Id$
*/
final class WindowsSysImplementation extends DefaultSysImplementation {
- private final static int JNI_VERSION = 16;
+ private final static int JNI_VERSION = 17;
static {
Sys.initialize();
@@ -53,10 +59,41 @@
return 1000;
}
- public native long getTime();
+ public long getTime() {
+ return nGetTime();
+ }
+ private static native long nGetTime();
- public native void alert(String title, String message);
+ private static long getHwnd() {
+ /* Use reflection since we can't make Display.getImplementation
+ * public
+ */
+ try {
+ Long hwnd_obj = (Long)AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws Exception {
+ Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
+ getImplementation_method.setAccessible(true);
+ Object display_impl = getImplementation_method.invoke(null, null);
+ if (display_impl == null)
+ return null;
+ Class WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
+ Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd", null);
+ getHwnd_method.setAccessible(true);
+ Long hwnd = (Long)getHwnd_method.invoke(display_impl, null);
+ return hwnd;
+ }
+ });
+ return hwnd_obj.longValue();
+ } catch (PrivilegedActionException e) {
+ throw new Error(e);
+ }
+ }
+ public void alert(String title, String message) {
+ nAlert(getHwnd(), title, message);
+ }
+ private static native void nAlert(long parent_hwnd, String title, String message);
+
public boolean openURL(final String url) {
try {
LWJGLUtil.execPrivileged(new String[]{"rundll32", "url.dll,FileProtocolHandler", url});
@@ -67,5 +104,8 @@
}
}
- public native String getClipboard();
+ public String getClipboard() {
+ return nGetClipboard();
+ }
+ private static native String nGetClipboard();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-30 16:01:25 UTC (rev 3057)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-30 16:40:14 UTC (rev 3058)
@@ -140,6 +140,9 @@
private boolean did_maximize;
private boolean inAppActivate;
+ private long hwnd;
+ private long hdc;
+
public WindowsDisplay() {
current_display = this;
}
@@ -154,7 +157,15 @@
this.parent = parent;
long parent_hwnd = parent != null ? getHwnd(parent) : 0;
boolean isUndecorated = isUndecorated();
- nCreateWindow(mode, fullscreen, x, y, isUndecorated, parent != null, parent_hwnd);
+ this.hwnd = nCreateWindow(mode, fullscreen, x, y, isUndecorated, parent != null, parent_hwnd);
+ if (hwnd == 0) {
+ throw new LWJGLException("Failed to create window");
+ }
+ this.hdc = getDC(hwnd);
+ if (hdc == 0) {
+ nDestroyWindow(hwnd, hdc);
+ throw new LWJGLException("Failed to get dc");
+ }
peer_info.initDC(getHwnd(), getHdc());
showWindow(getHwnd(), SW_SHOWDEFAULT);
if (parent == null) {
@@ -162,7 +173,7 @@
setFocus(getHwnd());
}
}
- private native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
+ private native long nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
@@ -180,10 +191,10 @@
}
public void destroyWindow() {
- nDestroyWindow();
+ nDestroyWindow(hwnd, hdc);
resetCursorClipping();
}
- private static native void nDestroyWindow();
+ private static native void nDestroyWindow(long hwnd, long hdc);
static void resetCursorClipping() {
if (cursor_clipped) {
try {
@@ -338,7 +349,10 @@
}
private static native DisplayMode getCurrentDisplayMode() throws LWJGLException;
- public native void setTitle(String title);
+ public void setTitle(String title) {
+ nSetTitle(hwnd, title);
+ }
+ private static native void nSetTitle(long hwnd, String title);
public boolean isCloseRequested() {
boolean saved = close_requested;
@@ -467,11 +481,19 @@
static native int getSystemMetrics(int index);
private static native long getDllInstance();
- private static native long getHwnd();
- private static native long getHdc();
+
+ private long getHwnd() {
+ return hwnd;
+ }
+
+ private long getHdc() {
+ return hdc;
+ }
+
+ private static native long getDC(long hwnd);
private static native long getDesktopWindow();
static void centerCursor(long hwnd) {
- getGlobalClientRect(getHwnd(), rect);
+ getGlobalClientRect(hwnd, rect);
int local_offset_x = rect.left;
int local_offset_y = rect.top;
getGlobalClientRect(getDesktopWindow(), rect2);
@@ -482,7 +504,7 @@
int local_x = center_x - local_offset_x;
int local_y = center_y - local_offset_y;
if (current_display != null)
- current_display.setMousePosition(local_x, transformY(getHwnd(), local_y));
+ current_display.setMousePosition(local_x, transformY(hwnd, local_y));
}
private void setMousePosition(int x, int y) {
@@ -582,12 +604,12 @@
int size = icons[i].limit() / 4;
if ((((int) Math.sqrt(size)) == small_icon_size) && (!done_small)) {
- nSetWindowIconSmall(small_icon_size, small_icon_size, icons[i].asIntBuffer());
+ nSetWindowIconSmall(hwnd, small_icon_size, small_icon_size, icons[i].asIntBuffer());
used++;
done_small = true;
}
if ((((int) Math.sqrt(size)) == large_icon_size) && (!done_large)) {
- nSetWindowIconLarge(large_icon_size, large_icon_size, icons[i].asIntBuffer());
+ nSetWindowIconLarge(hwnd, large_icon_size, large_icon_size, icons[i].asIntBuffer());
used++;
done_large = true;
}
@@ -596,9 +618,9 @@
return used;
}
- private static native int nSetWindowIconSmall(int width, int height, IntBuffer icon);
+ private static native int nSetWindowIconSmall(long hwnd, int width, int height, IntBuffer icon);
- private static native int nSetWindowIconLarge(int width, int height, IntBuffer icon);
+ private static native int nSetWindowIconLarge(long hwnd, int width, int height, IntBuffer icon);
private void handleMouseButton(int button, int state, long millis) {
if (mouse != null)
Modified: trunk/LWJGL/src/native/windows/Window.h
===================================================================
--- trunk/LWJGL/src/native/windows/Window.h 2008-04-30 16:01:25 UTC (rev 3057)
+++ trunk/LWJGL/src/native/windows/Window.h 2008-04-30 16:40:14 UTC (rev 3058)
@@ -62,7 +62,4 @@
#define WINDOW_H_API extern
#endif /* _PRIVATE_WINDOW_H_ */
- WINDOW_H_API HDC getCurrentHDC();
-
- WINDOW_H_API HWND getCurrentHWND();
#endif /* _LWJGL_WINDOW_H_INCLUDED_ */
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2008-04-30 16:01:25 UTC (rev 3057)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2008-04-30 16:40:14 UTC (rev 3058)
@@ -45,7 +45,7 @@
#include "common_tools.h"
#include <malloc.h>
-JNIEXPORT jlong JNICALL Java_org_lwjgl_WindowsSysImplementation_getTime(JNIEnv * env, jobject ignored) {
+JNIEXPORT jlong JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetTime(JNIEnv * env, jclass unused) {
DWORD time;
timeBeginPeriod(1);
@@ -55,10 +55,11 @@
return time;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_alert(JNIEnv * env, jobject ignored, jstring title, jstring message) {
+JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert(JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title, jstring message) {
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
char * eMessageText = GetStringNativeChars(env, message);
char * cTitleBarText = GetStringNativeChars(env, title);
- MessageBox(getCurrentHWND(), eMessageText, cTitleBarText, MB_OK | MB_TOPMOST);
+ MessageBox(hwnd, eMessageText, cTitleBarText, MB_OK | MB_TOPMOST);
printfDebugJava(env, "*** Alert ***%s\n%s\n", cTitleBarText, eMessageText);
@@ -66,8 +67,8 @@
free(cTitleBarText);
}
-JNIEXPORT jstring JNICALL Java_org_lwjgl_WindowsSysImplementation_getClipboard
- (JNIEnv * env, jobject ignored)
+JNIEXPORT jstring JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetClipboard
+ (JNIEnv * env, jclass unused)
{
// Check to see if there's text available in the clipboard
BOOL textAvailable = IsClipboardFormatAvailable(CF_TEXT);
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 16:01:25 UTC (rev 3057)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 16:40:14 UTC (rev 3058)
@@ -52,20 +52,9 @@
static HICON small_icon = NULL;
static HICON large_icon = NULL;
-static HWND display_hwnd = NULL; // Handle to the window
-static HDC display_hdc = NULL; // Device context
- // has recovered from minimized
#define WINDOWCLASSNAME "LWJGL"
-HDC getCurrentHDC() {
- return display_hdc;
-}
-
-HWND getCurrentHWND() {
- return display_hwnd;
-}
-
static void freeLargeIcon() {
if (large_icon != NULL) {
DestroyIcon(large_icon);
@@ -140,33 +129,29 @@
* work properly
*/
MSG msg;
- if (display_hwnd != NULL) {
- while (!(*env)->ExceptionOccurred(env) && PeekMessage(
- &msg, // message information
- NULL, // handle to window
- 0, // first message
- 0, // last message
- PM_REMOVE // removal options
- ))
- {
- DispatchMessage(&msg);
- TranslateMessage(&msg);
- }
+ while (!(*env)->ExceptionOccurred(env) && PeekMessage(
+ &msg, // message information
+ NULL, // handle to window
+ 0, // first message
+ 0, // last message
+ PM_REMOVE // removal options
+ ))
+ {
+ DispatchMessage(&msg);
+ TranslateMessage(&msg);
}
}
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getHdc(JNIEnv *env, jclass unused) {
- return (INT_PTR)display_hdc;
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDC(JNIEnv *env, jclass unused, jlong hwnd_ptr) {
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
+ return (INT_PTR)GetDC(hwnd);
}
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getHwnd(JNIEnv *env, jclass unused) {
- return (INT_PTR)display_hwnd;
-}
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setTitle
- (JNIEnv * env, jobject self, jstring title_obj) {
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetTitle
+ (JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title_obj) {
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
char * title = GetStringNativeChars(env, title_obj);
- SetWindowText(display_hwnd, title);
+ SetWindowText(hwnd, title);
free(title);
}
@@ -183,45 +168,39 @@
return org_lwjgl_WindowsSysImplementation_JNI_VERSION;
}
-static void destroyWindow(JNIEnv *env) {
- jclass display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(display_hwnd, GWLP_USERDATA);
- closeWindow(&display_hwnd, &display_hdc);
+static void destroyWindow(JNIEnv *env, HWND *hwnd, HDC *hdc) {
+ jclass display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(*hwnd, GWLP_USERDATA);
+ closeWindow(hwnd, hdc);
if (display_class_global != NULL)
(*env)->DeleteGlobalRef(env, display_class_global);
freeLargeIcon();
freeSmallIcon();
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y, jboolean undecorated, jboolean child_window, jlong parent_hwnd) {
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y, jboolean undecorated, jboolean child_window, jlong parent_hwnd) {
jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
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);
+ HWND hwnd;
static bool oneShotInitialised = false;
if (!oneShotInitialised) {
if (!registerWindow(lwjglWindowProc, WINDOWCLASSNAME)) {
throwException(env, "Could not register window class");
- return;
+ return 0;
}
oneShotInitialised = true;
}
- display_hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, fullscreen, undecorated, child_window, (HWND)parent_hwnd);
- if (display_hwnd == NULL) {
- throwException(env, "Failed to create the window.");
- return;
- }
- display_hdc = GetDC(display_hwnd);
- if (display_hdc == NULL) {
- destroyWindow(env);
- throwException(env, "Failed to get the window DC.");
- return;
- }
+ hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, fullscreen, undecorated, child_window, (HWND)parent_hwnd);
+ return (INT_PTR)hwnd;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nDestroyWindow(JNIEnv *env, jclass clazz) {
- destroyWindow(env);
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong hwnd_ptr, jlong hdc_ptr) {
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
+ HDC hdc = (HDC)(INT_PTR)hdc_ptr;
+ destroyWindow(env, &hwnd, &hdc);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clientToScreen(JNIEnv *env, jclass unused, jlong hwnd_int, jobject buffer_handle) {
@@ -475,15 +454,16 @@
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIconSmall
- (JNIEnv *env, jclass clazz, jint width, jint height, jobject iconBuffer)
+ (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jint width, jint height, jobject iconBuffer)
{
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer);
freeSmallIcon();
small_icon = createWindowIcon(env, imgData, width, height);
if (small_icon != NULL) {
- if (display_hwnd != NULL) {
- SendMessage(display_hwnd, WM_SETICON, ICON_SMALL, (LPARAM) (small_icon));
+ if (hwnd != NULL) {
+ SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) (small_icon));
return 0;
}
@@ -493,15 +473,16 @@
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIconLarge
- (JNIEnv *env, jclass clazz, jint width, jint height, jobject iconBuffer)
+ (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jint width, jint height, jobject iconBuffer)
{
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer);
freeLargeIcon();
large_icon = createWindowIcon(env, imgData, width, height);
if (large_icon != NULL) {
- if (display_hwnd != NULL) {
- SendMessage(display_hwnd, WM_SETICON, ICON_BIG, (LPARAM) (large_icon));
+ if (hwnd != NULL) {
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) (large_icon));
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 16:01:27
|
Revision: 3057
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3057&view=rev
Author: elias_naur
Date: 2008-04-30 09:01:25 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Windows: Made WindowsDisplayPeerInfo take hwnd and hdc arguments
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-30 15:29:39 UTC (rev 3056)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-30 16:01:25 UTC (rev 3057)
@@ -155,7 +155,7 @@
long parent_hwnd = parent != null ? getHwnd(parent) : 0;
boolean isUndecorated = isUndecorated();
nCreateWindow(mode, fullscreen, x, y, isUndecorated, parent != null, parent_hwnd);
- peer_info.initDC();
+ peer_info.initDC(getHwnd(), getHdc());
showWindow(getHwnd(), SW_SHOWDEFAULT);
if (parent == null) {
setForegroundWindow(getHwnd());
@@ -468,6 +468,7 @@
private static native long getDllInstance();
private static native long getHwnd();
+ private static native long getHdc();
private static native long getDesktopWindow();
static void centerCursor(long hwnd) {
getGlobalClientRect(getHwnd(), rect);
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java 2008-04-30 15:29:39 UTC (rev 3056)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java 2008-04-30 16:01:25 UTC (rev 3057)
@@ -49,11 +49,11 @@
GLContext.loadOpenGLLibrary();
}
- void initDC() throws LWJGLException {
- nInitDC(getHandle());
+ void initDC(long hwnd, long hdc) throws LWJGLException {
+ nInitDC(getHandle(), hwnd, hdc);
choosePixelFormat(0, 0, pixel_format, null, true, true, false, true);
}
- private static native void nInitDC(ByteBuffer peer_info_handle);
+ private static native void nInitDC(ByteBuffer peer_info_handle, long hwnd, long hdc);
protected void doLockAndInitHandle() throws LWJGLException {
// NO-OP
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 15:29:39 UTC (rev 3056)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 16:01:25 UTC (rev 3057)
@@ -155,15 +155,14 @@
}
}
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getHdc(JNIEnv *env, jclass unused) {
+ return (INT_PTR)display_hdc;
+}
+
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getHwnd(JNIEnv *env, jclass unused) {
return (INT_PTR)display_hwnd;
}
-/*
- * Class: org_lwjgl_Window
- * Method: nSetTitle
- * Signature: ()V
- */
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setTitle
(JNIEnv * env, jobject self, jstring title_obj) {
char * title = GetStringNativeChars(env, title_obj);
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c 2008-04-30 15:29:39 UTC (rev 3056)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c 2008-04-30 16:01:25 UTC (rev 3057)
@@ -44,8 +44,10 @@
#include "common_tools.h"
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplayPeerInfo_nInitDC
- (JNIEnv *env, jclass clazz, jobject peer_info_handle) {
+ (JNIEnv *env, jclass clazz, jobject peer_info_handle, jlong hwnd_ptr, jlong hdc_ptr) {
+ HWND hwnd = (HWND)(INT_PTR)hwnd_ptr;
+ HDC hdc = (HDC)(INT_PTR)hdc_ptr;
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
- peer_info->drawable_hdc = getCurrentHDC();
- peer_info->u.hwnd = getCurrentHWND();
+ peer_info->drawable_hdc = hdc;
+ peer_info->u.hwnd = hwnd;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 15:29:42
|
Revision: 3056
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3056&view=rev
Author: elias_naur
Date: 2008-04-30 08:29:39 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Windows: Moved child window style selection to java
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/windows/context.c
trunk/LWJGL/src/native/windows/context.h
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-30 14:58:47 UTC (rev 3055)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-30 15:29:39 UTC (rev 3056)
@@ -154,7 +154,7 @@
this.parent = parent;
long parent_hwnd = parent != null ? getHwnd(parent) : 0;
boolean isUndecorated = isUndecorated();
- nCreateWindow(mode, fullscreen, x, y, isUndecorated, parent_hwnd);
+ nCreateWindow(mode, fullscreen, x, y, isUndecorated, parent != null, parent_hwnd);
peer_info.initDC();
showWindow(getHwnd(), SW_SHOWDEFAULT);
if (parent == null) {
@@ -162,7 +162,7 @@
setFocus(getHwnd());
}
}
- private native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y, boolean undecorated, long parent_hwnd) throws LWJGLException;
+ private native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
Modified: trunk/LWJGL/src/native/windows/context.c
===================================================================
--- trunk/LWJGL/src/native/windows/context.c 2008-04-30 14:58:47 UTC (rev 3055)
+++ trunk/LWJGL/src/native/windows/context.c 2008-04-30 15:29:39 UTC (rev 3056)
@@ -139,13 +139,13 @@
*
* Returns true for success, or false for failure
*/
-HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, HWND parent)
+HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, bool child_window, HWND parent)
{
RECT clientSize;
DWORD exstyle, windowflags;
HWND new_hwnd;
- getWindowFlags(&windowflags, &exstyle, fullscreen, undecorated, parent != NULL);
+ getWindowFlags(&windowflags, &exstyle, fullscreen, undecorated, child_window);
// If we're not a fullscreen window, adjust the height to account for the
// height of the title bar (unless undecorated)
@@ -468,5 +468,5 @@
HWND createDummyWindow(int origin_x, int origin_y) {
if (!registerDummyWindow())
return NULL;
- return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL);
+ return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, false, NULL);
}
Modified: trunk/LWJGL/src/native/windows/context.h
===================================================================
--- trunk/LWJGL/src/native/windows/context.h 2008-04-30 14:58:47 UTC (rev 3055)
+++ trunk/LWJGL/src/native/windows/context.h 2008-04-30 15:29:39 UTC (rev 3056)
@@ -89,7 +89,7 @@
*
* Returns true for success, or false for failure
*/
-extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, HWND parent);
+extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool fullscreen, bool undecorated, bool child_window, HWND parent);
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);
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 14:58:47 UTC (rev 3055)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 15:29:39 UTC (rev 3056)
@@ -193,7 +193,7 @@
freeSmallIcon();
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y, jboolean undecorated, jlong parent_hwnd) {
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y, jboolean undecorated, jboolean child_window, jlong parent_hwnd) {
jclass cls_displayMode = (*env)->GetObjectClass(env, mode);
jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I");
jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
@@ -208,7 +208,7 @@
oneShotInitialised = true;
}
- display_hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, fullscreen, undecorated, (HWND)parent_hwnd);
+ display_hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, fullscreen, undecorated, child_window, (HWND)parent_hwnd);
if (display_hwnd == NULL) {
throwException(env, "Failed to create the window.");
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 14:58:52
|
Revision: 3055
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3055&view=rev
Author: elias_naur
Date: 2008-04-30 07:58:47 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Added platform specific getJNIVersion implementations
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
trunk/LWJGL/src/native/common/common_tools.c
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/build.xml 2008-04-30 14:58:47 UTC (rev 3055)
@@ -177,6 +177,7 @@
<!-- Generates the native headers from source files -->
<target name="headers" description="invokes javah on java classes" depends="compile">
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes">
+ <class name="org.lwjgl.LinuxSysImplementation" />
<class name="org.lwjgl.opengl.LinuxEvent" />
<class name="org.lwjgl.opengl.LinuxMouse" />
<class name="org.lwjgl.opengl.LinuxKeyboard" />
@@ -202,6 +203,7 @@
</javah>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
+ <class name="org.lwjgl.MacOSXSysImplementation" />
<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
<class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" />
<class name="org.lwjgl.opengl.MacOSXPeerInfo" />
Modified: trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055)
@@ -39,9 +39,6 @@
* $Id$
*/
abstract class DefaultSysImplementation implements SysImplementation {
- /** Included to let native have easy access to Sys.JNI_VERSION */
- private final static int JNI_VERSION = Sys.JNI_VERSION;
-
public native int getJNIVersion();
public native void setDebug(boolean debug);
Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055)
@@ -39,12 +39,14 @@
* $Id$
*/
final class LinuxSysImplementation extends J2SESysImplementation {
+ private final static int JNI_VERSION = 16;
+
static {
java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
}
public int getRequiredJNIVersion() {
- return 16;
+ return JNI_VERSION;
}
public boolean openURL(final String url) {
Modified: trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055)
@@ -45,13 +45,15 @@
* $Id$
*/
final class MacOSXSysImplementation extends J2SESysImplementation {
+ private final static int JNI_VERSION = 16;
+
static {
// Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3
Toolkit.getDefaultToolkit();
}
public int getRequiredJNIVersion() {
- return 16;
+ return JNI_VERSION;
}
public boolean openURL(String url) {
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 14:58:47 UTC (rev 3055)
@@ -39,12 +39,14 @@
* $Id$
*/
final class WindowsSysImplementation extends DefaultSysImplementation {
+ private final static int JNI_VERSION = 16;
+
static {
Sys.initialize();
}
public int getRequiredJNIVersion() {
- return 16;
+ return JNI_VERSION;
}
public long getTimerResolution() {
Modified: trunk/LWJGL/src/native/common/common_tools.c
===================================================================
--- trunk/LWJGL/src/native/common/common_tools.c 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/native/common/common_tools.c 2008-04-30 14:58:47 UTC (rev 3055)
@@ -58,11 +58,6 @@
list->current_index++;
}
-JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
- (JNIEnv *env, jobject ignored) {
- return org_lwjgl_DefaultSysImplementation_JNI_VERSION;
-}
-
JNIEXPORT void JNICALL Java_org_lwjgl_DefaultSysImplementation_setDebug
(JNIEnv *env, jobject ignored, jboolean enable) {
debug = enable == JNI_TRUE ? true : false;
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2008-04-30 14:58:47 UTC (rev 3055)
@@ -54,6 +54,7 @@
#include "context.h"
#include "org_lwjgl_opengl_LinuxDisplay.h"
#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h"
+#include "org_lwjgl_LinuxSysImplementation.h"
#define ERR_MSG_SIZE 1024
@@ -108,6 +109,11 @@
return (intptr_t)display_connection;
}
+JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
+ (JNIEnv *env, jobject ignored) {
+ return org_lwjgl_LinuxSysImplementation_JNI_VERSION;
+}
+
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) {
Display *disp = (Display *)(intptr_t)display_ptr;
char err_msg_buffer[ERR_MSG_SIZE];
Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m
===================================================================
--- trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2008-04-30 14:58:47 UTC (rev 3055)
@@ -47,9 +47,15 @@
//#import "display.h"
#import "common_tools.h"
#import "org_lwjgl_opengl_MacOSXDisplay.h"
+#import "org_lwjgl_MacOSXSysImplementation.h"
#define WAIT_DELAY 100
+JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
+ (JNIEnv *env, jobject ignored) {
+ return org_lwjgl_MacOSXSysImplementation_JNI_VERSION;
+}
+
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma(JNIEnv *env, jobject this) {
CGDisplayRestoreColorSyncSettings();
}
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 14:34:54 UTC (rev 3054)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2008-04-30 14:58:47 UTC (rev 3055)
@@ -47,6 +47,7 @@
#include "common_tools.h"
#include "display.h"
#include "org_lwjgl_opengl_WindowsDisplay.h"
+#include "org_lwjgl_WindowsSysImplementation.h"
#include "context.h"
static HICON small_icon = NULL;
@@ -178,6 +179,11 @@
return getAvailableDisplayModes(env);
}
+JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
+ (JNIEnv *env, jobject ignored) {
+ return org_lwjgl_WindowsSysImplementation_JNI_VERSION;
+}
+
static void destroyWindow(JNIEnv *env) {
jclass display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(display_hwnd, GWLP_USERDATA);
closeWindow(&display_hwnd, &display_hdc);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 14:34:59
|
Revision: 3054
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3054&view=rev
Author: elias_naur
Date: 2008-04-30 07:34:54 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Moved Sys.JNI_VERSION to SysImplementation.getRequiredJNIVersion() to enable platform specific native library versions.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java
trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2008-04-30 13:47:26 UTC (rev 3053)
+++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
@@ -38,11 +38,15 @@
* @version $Revision$
* $Id$
*/
-class LinuxSysImplementation extends J2SESysImplementation {
+final class LinuxSysImplementation extends J2SESysImplementation {
static {
java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded
}
+ public int getRequiredJNIVersion() {
+ return 16;
+ }
+
public boolean openURL(final String url) {
// Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it
// right anyway.
Modified: trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2008-04-30 13:47:26 UTC (rev 3053)
+++ trunk/LWJGL/src/java/org/lwjgl/MacOSXSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
@@ -44,12 +44,16 @@
* @version $Revision$
* $Id$
*/
-class MacOSXSysImplementation extends J2SESysImplementation {
+final class MacOSXSysImplementation extends J2SESysImplementation {
static {
// Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3
Toolkit.getDefaultToolkit();
}
+ public int getRequiredJNIVersion() {
+ return 16;
+ }
+
public boolean openURL(String url) {
try {
FileManager.openURL(url);
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2008-04-30 13:47:26 UTC (rev 3053)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2008-04-30 14:34:54 UTC (rev 3054)
@@ -56,9 +56,6 @@
/** Current version of library */
private static final String VERSION = "2.0b1";
- /** Current version of the JNI library */
- static final int JNI_VERSION = 16;
-
/** The implementation instance to delegate platform specific behavior to */
private final static SysImplementation implementation;
@@ -101,8 +98,9 @@
loadLibrary(JNI_LIBRARY_NAME);
int native_jni_version = implementation.getJNIVersion();
- if (native_jni_version != JNI_VERSION)
- throw new LinkageError("Version mismatch: jar version is '" + JNI_VERSION +
+ int required_version = implementation.getRequiredJNIVersion();
+ if (native_jni_version != required_version)
+ throw new LinkageError("Version mismatch: jar version is '" + required_version +
"', native libary version is '" + native_jni_version + "'");
implementation.setDebug(LWJGLUtil.DEBUG);
}
@@ -112,9 +110,9 @@
case LWJGLUtil.PLATFORM_LINUX:
return new LinuxSysImplementation();
case LWJGLUtil.PLATFORM_WINDOWS:
- return new org.lwjgl.WindowsSysImplementation();
+ return new WindowsSysImplementation();
case LWJGLUtil.PLATFORM_MACOSX:
- return new org.lwjgl.MacOSXSysImplementation();
+ return new MacOSXSysImplementation();
default:
throw new IllegalStateException("Unsupported platform");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2008-04-30 13:47:26 UTC (rev 3053)
+++ trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
@@ -42,6 +42,11 @@
*/
interface SysImplementation {
/**
+ * Return the required version of the native library
+ */
+ int getRequiredJNIVersion();
+
+ /**
* Return the version of the native library
*/
int getJNIVersion();
Modified: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 13:47:26 UTC (rev 3053)
+++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2008-04-30 14:34:54 UTC (rev 3054)
@@ -38,11 +38,15 @@
* @version $Revision$
* $Id$
*/
-class WindowsSysImplementation extends DefaultSysImplementation {
+final class WindowsSysImplementation extends DefaultSysImplementation {
static {
Sys.initialize();
}
+ public int getRequiredJNIVersion() {
+ return 16;
+ }
+
public long getTimerResolution() {
return 1000;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 13:47:29
|
Revision: 3053
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3053&view=rev
Author: elias_naur
Date: 2008-04-30 06:47:26 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Mac OS X: Worked around another Display.destroy hang when parented to an applet
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java 2008-04-30 13:16:53 UTC (rev 3052)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java 2008-04-30 13:47:26 UTC (rev 3053)
@@ -53,18 +53,19 @@
public MacOSXCanvasListener(Canvas canvas) {
this.canvas = canvas;
-// ((MacOSXDisplay)Display.getImplementation()).setView(this);
- }
-
- public void enableListeners() {
canvas.addComponentListener(this);
canvas.addHierarchyListener(this);
setUpdate();
}
public void disableListeners() {
- canvas.removeComponentListener(this);
- canvas.removeHierarchyListener(this);
+ // Mac OS X applets will hang in Display.destroy() when parented when removing the listeners directly
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public final void run() {
+ canvas.removeComponentListener(MacOSXCanvasListener.this);
+ canvas.removeHierarchyListener(MacOSXCanvasListener.this);
+ }
+ });
}
public boolean syncShouldUpdateContext() {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2008-04-30 13:16:53 UTC (rev 3052)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2008-04-30 13:47:26 UTC (rev 3053)
@@ -107,7 +107,6 @@
canvas = parent;
}
canvas_listener = new MacOSXCanvasListener(canvas);
- canvas_listener.enableListeners();
robot = AWTUtil.createRobot(canvas);
} catch (LWJGLException e) {
destroyWindow();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 13:21:18
|
Revision: 3052
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3052&view=rev
Author: elias_naur
Date: 2008-04-30 06:16:53 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Mac OS X: Fixed a hang on Display.destroy in applets
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2008-04-30 12:46:54 UTC (rev 3051)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2008-04-30 13:16:53 UTC (rev 3052)
@@ -327,7 +327,7 @@
public void destroyMouse() {
if (mouse_queue != null) {
- mouse_queue.setGrabbed(false);
+ MacOSXMouseEventQueue.nGrabMouse(false);
mouse_queue.unregister();
}
this.mouse_queue = null;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2008-04-30 12:46:54 UTC (rev 3051)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2008-04-30 13:16:53 UTC (rev 3052)
@@ -107,5 +107,5 @@
private static native void nWarpCursor(int x, int y);
- private static native void nGrabMouse(boolean grab);
+ static native void nGrabMouse(boolean grab);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-30 12:46:59
|
Revision: 3051
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3051&view=rev
Author: elias_naur
Date: 2008-04-30 05:46:54 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Don't use reflection for AWTUtil.getPointerLocation
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2008-04-29 18:56:46 UTC (rev 3050)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2008-04-30 12:46:54 UTC (rev 3051)
@@ -42,6 +42,8 @@
import java.awt.GraphicsConfiguration;
import java.awt.IllegalComponentStateException;
import java.awt.Point;
+import java.awt.MouseInfo;
+import java.awt.PointerInfo;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
@@ -109,30 +111,21 @@
*/
private static Point getPointerLocation(final Component component) {
try {
- final Class MouseInfo_class = Class.forName("java.awt.MouseInfo");
- final Method getPointerInfo_method = MouseInfo_class.getMethod("getPointerInfo", null);
- final Class PointerInfo_class = Class.forName("java.awt.PointerInfo");
- final Method getDevice_method = PointerInfo_class.getMethod("getDevice", null);
- final Method getLocation_method = PointerInfo_class.getMethod("getLocation", null);
- return (Point)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public final Object run() throws Exception {
- GraphicsConfiguration config = component.getGraphicsConfiguration();
- if (config != null) {
- Object pointer_info = getPointerInfo_method.invoke(null, null);
- GraphicsDevice device = (GraphicsDevice)getDevice_method.invoke(pointer_info, null);
- if (device == config.getDevice()) {
- return (Point)getLocation_method.invoke(pointer_info, null);
- }
+ final GraphicsConfiguration config = component.getGraphicsConfiguration();
+ if (config != null) {
+ PointerInfo pointer_info = (PointerInfo)AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public final Object run() throws Exception {
+ return MouseInfo.getPointerInfo();
}
- return null;
+ });
+ GraphicsDevice device = pointer_info.getDevice();
+ if (device == config.getDevice()) {
+ return pointer_info.getLocation();
}
- });
+ return null;
+ }
} catch (PrivilegedActionException e) {
LWJGLUtil.log("Failed to query pointer location: " + e.getCause());
- } catch (NoSuchMethodException e) {
- LWJGLUtil.log("Failed to query pointer location: " + e);
- } catch (ClassNotFoundException e) {
- LWJGLUtil.log("Failed to query pointer location: " + e);
}
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|