aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/ogl/NativeWSInfo.c
blob: de971d0f39cf8e3340bcebd9a0b16167c37cd85b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * $RCSfile$
 *
 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
 *
 * Use is subject to license terms.
 *
 * $Revision$
 * $Date$
 * $State$
 */

/*
 * Portions of this code were derived from work done by the Blackdown
 * group (www.blackdown.org), who did the initial Linux implementation
 * of the Java 3D API.
 */

#include <jni.h>
#include <math.h>

#include "gldefs.h"

#if defined(UNIX)
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif

#ifdef WIN32
#include <windows.h>
#endif

#ifdef WIN32

/*
 * Workaround for bug 4169320: Resizing a Java 3D canvas
 * on Win95 crashes the application
 */

#ifdef STRICT
static WNDPROC g_lpDefWindowProc;
#else
static FARPROC g_lpDefWindowProc;
#endif

static
LRESULT CALLBACK canvas3dWndProc(
    HWND hWnd,
    UINT message,
    WPARAM wParam,
    LPARAM lParam)
{
    switch (message) {
      case WM_WINDOWPOSCHANGED:
          return 0;
      default:
          return CallWindowProc(g_lpDefWindowProc, hWnd, message,
                                wParam, lParam);
    }
}

JNIEXPORT
void JNICALL Java_javax_media_j3d_NativeWSInfo_subclass(
    JNIEnv * env,
    jobject obj,
    jint hWnd)
{
#ifdef STRICT
    g_lpDefWindowProc = (WNDPROC) SetWindowLong((HWND) hWnd, GWL_WNDPROC,
                                                (LONG) canvas3dWndProc);
#else
    g_lpDefWindowProc = (FARPROC) SetWindowLong((HWND) hWnd, GWL_WNDPROC,
                                                (LONG) canvas3dWndProc);
#endif
}

#endif