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 .
23 // property name to register own window procedure on hwnd
24 #define OLD_PROC_KEY "oldwindowproc"
25 // signature of this window procedure
26 static LRESULT APIENTRY
NativeViewWndProc( HWND
, UINT
, WPARAM
, LPARAM
);
32 #include "NativeView.h"
34 #define MY_ASSERT(X,S) if (!X) { fprintf(stderr,"%s\n",S); return 0L;}
36 #define SYSTEM_WIN32 1
37 #define SYSTEM_WIN16 2
40 #define SYSTEM_XWINDOW 6
42 /*****************************************************************************
45 * Method : getNativeWindowSystemType
47 * Description: returns an identifier for the current operating system
49 JNIEXPORT jint JNICALL Java_embeddedobj_test_NativeView_getNativeWindowSystemType
50 (JNIEnv
* env
, jobject obj_this
)
52 return (SYSTEM_WIN32
);
55 /*****************************************************************************
58 * Method : getNativeWindow
60 * Description: returns the native systemw window handle of this object
62 JNIEXPORT jlong JNICALL Java_embeddedobj_test_NativeView_getNativeWindow
63 (JNIEnv
* env
, jobject obj_this
)
68 JAWT_DrawingSurface
* ds
;
69 JAWT_DrawingSurfaceInfo
* dsi
;
71 JAWT_Win32DrawingSurfaceInfo
* dsi_win
;
73 // FIXME: Where is dsi_x11 defined?
74 // Added below because I'm guessing this test breaks
76 // JAWT_X11DrawingSurfaceInfo*dsi_x11 ;
81 awt
.version
= JAWT_VERSION_1_3
;
82 result
= JAWT_GetAWT(env
, &awt
);
83 MY_ASSERT(result
!=JNI_FALSE
,"wrong jawt version");
85 /* Get the drawing surface */
86 if ((ds
= awt
.GetDrawingSurface(env
, obj_this
)) == NULL
)
89 /* Lock the drawing surface */
91 MY_ASSERT((lock
& JAWT_LOCK_ERROR
)==0,"can't lock the drawing surface");
93 /* Get the drawing surface info */
94 dsi
= ds
->GetDrawingSurfaceInfo(ds
);
96 /* Get the platform-specific drawing info */
98 dsi_win
= (JAWT_Win32DrawingSurfaceInfo
*)dsi
->platformInfo
;
99 drawable
= (jlong
)dsi_win
->hwnd
;
101 dsi_x11
= (JAWT_X11DrawingSurfaceInfo
*)dsi
->platformInfo
;
102 drawable
= (jlong
)dsi_x11
->drawable
;
105 /* Free the drawing surface info */
106 ds
->FreeDrawingSurfaceInfo(dsi
);
107 /* Unlock the drawing surface */
109 /* Free the drawing surface */
110 awt
.FreeDrawingSurface(ds
);
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */