1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #if !defined WIN32_LEAN_AND_MEAN
23 # define WIN32_LEAN_AND_MEAN
26 // property name to register own window procedure on hwnd
27 #define OLD_PROC_KEY "oldwindowproc"
28 // signature of this window procedure
29 static LRESULT APIENTRY
NativeViewWndProc( HWND
, UINT
, WPARAM
, LPARAM
);
35 #include "NativeView.h"
37 #define MY_ASSERT(X,S) if (!X) { fprintf(stderr,"%s\n",S); return 0;}
39 #define SYSTEM_WIN32 1
40 #define SYSTEM_WIN16 2
43 #define SYSTEM_XWINDOW 6
45 /*****************************************************************************
48 * Method : getNativeWindowSystemType
50 * Description: returns an identifier for the current operating system
52 JNIEXPORT jint JNICALL Java_embeddedobj_test_NativeView_getNativeWindowSystemType
53 (JNIEnv
* env
, jobject obj_this
)
58 /*****************************************************************************
61 * Method : getNativeWindow
63 * Description: returns the native systemw window handle of this object
65 JNIEXPORT jlong JNICALL Java_embeddedobj_test_NativeView_getNativeWindow
66 (JNIEnv
* env
, jobject obj_this
)
71 JAWT_DrawingSurface
* ds
;
72 JAWT_DrawingSurfaceInfo
* dsi
;
74 JAWT_Win32DrawingSurfaceInfo
* dsi_win
;
76 // FIXME: Where is dsi_x11 defined?
77 // Added below because I'm guessing this test breaks
79 // JAWT_X11DrawingSurfaceInfo*dsi_x11 ;
84 awt
.version
= JAWT_VERSION_1_3
;
85 result
= JAWT_GetAWT(env
, &awt
);
86 MY_ASSERT(result
!=JNI_FALSE
,"wrong jawt version");
88 /* Get the drawing surface */
89 if ((ds
= awt
.GetDrawingSurface(env
, obj_this
)) == NULL
)
92 /* Lock the drawing surface */
94 MY_ASSERT((lock
& JAWT_LOCK_ERROR
)==0,"can't lock the drawing surface");
96 /* Get the drawing surface info */
97 dsi
= ds
->GetDrawingSurfaceInfo(ds
);
99 /* Get the platform-specific drawing info */
101 dsi_win
= (JAWT_Win32DrawingSurfaceInfo
*)dsi
->platformInfo
;
102 drawable
= (jlong
)dsi_win
->hwnd
;
104 dsi_x11
= (JAWT_X11DrawingSurfaceInfo
*)dsi
->platformInfo
;
105 drawable
= (jlong
)dsi_x11
->drawable
;
108 /* Free the drawing surface info */
109 ds
->FreeDrawingSurfaceInfo(dsi
);
110 /* Unlock the drawing surface */
112 /* Free the drawing surface */
113 awt
.FreeDrawingSurface(ds
);
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */