Bug=81648

author=ashuk
r=edburns

Files modified:

M mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/win32/Win32BrowserControlCanvas.java
M mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/motif/MotifBrowserControlCanvas.java
M mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlCanvas.java

M mozilla/java/webclient/src_moz/motif/MotifBrowserControlCanvas.cpp
M mozilla/java/webclient/src_moz/motif/MotifBrowserControlCanvas.h
M mozilla/java/webclient/src_moz/motif/MotifBrowserControlCanvasStub.cpp
M mozilla/java/webclient/src_moz/Makefile.in
M mozilla/java/webclient/src_moz/Makefile.win

A mozilla/java/webclient/src_moz/win32/Makefile.win
A mozilla/java/webclient/src_moz/win32/Win32BrowserControlCanvas.cpp
A mozilla/java/webclient/src_moz/win32/Win32BrowserControlCanvas.h


This fix removes the deprecated methods used in Webclient and
now uses the JAWT Native Interface for allowing the Java AWT
canvas access to the native peer window.


git-svn-id: svn://10.0.0.236/trunk@95940 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ashuk%eng.sun.com
2001-05-25 23:09:54 +00:00
parent 6951668628
commit b01e7aac74
11 changed files with 332 additions and 163 deletions

View File

@@ -0,0 +1,74 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..
MODULE=wc_win32
include <$(DEPTH)/config/config.mak>
OBJS = \
.\$(OBJDIR)\Win32BrowserControlCanvas.obj \
$(NULL)
LCFLAGS = \
-DDEBUG_RAPTOR_CANVAS \
$(NULL)
!ifdef BAL_INTERFACE
LCFLAGS = \
$(LCFLAGS) \
-DBAL_INTERFACE \
$(NULL)
LIBRARY_NAME = wc_win32_bal
!else
LIBRARY_NAME = wc_win32
!endif
LLIBS = \
$(NULL)
WIN_LIBS = \
version.lib
include <$(DEPTH)\config\rules.mak>
INCS=-I.. -I..\..\src_share $(INCS)
!ifdef BAL_INTERFACE
INCS = \
-I..\..\bal\ \
-I..\..\bal\win32 \
$(INCS) \
$(NULL)
!else
INCS = \
-I$(JDKHOME)\include \
-I$(JDKHOME)\include\win32 \
$(INCS) \
$(NULL)
!endif
!CMDSWITCHES -S
clobber_all:: clobber
edburns:
@echo $(INCS)

View File

@@ -0,0 +1,99 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Ashu Kulkarni
*/
/*
* Win32BrowserControlCanvas.cpp
*/
#include <jni.h>
#include <jawt_md.h>
#include <jawt.h>
#include "Win32BrowserControlCanvas.h"
#include "ns_util.h" //for throwing Exceptions to Java
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_win32_Win32BrowserControlCanvas
* Method: getHandleToPeer
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_win32_Win32BrowserControlCanvas_getHandleToPeer
(JNIEnv *env, jobject canvas) {
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
JAWT_Win32DrawingSurfaceInfo* dsi_win;
HWND handle_win;
jint lock;
//Get the AWT
awt.version = JAWT_VERSION_1_3;
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
printf(" +++ AWT Not Found +++ \n");
::util_ThrowExceptionToJava(env, "Exception: AWT Not Found");
return 0;
}
//Get the Drawing Surface
ds = awt.GetDrawingSurface(env, canvas);
if (ds == NULL) {
printf(" +++ NULL Drawing Surface +++ \n");
::util_ThrowExceptionToJava(env, "Exception: Null Drawing Surface");
return 0;
}
//Lock the Drawing Surface
lock = ds->Lock(ds);
if ((lock & JAWT_LOCK_ERROR) != 0) {
printf(" +++ Error Locking Surface +++ \n");
::util_ThrowExceptionToJava(env, "Exception: Error Locking Surface");
awt.FreeDrawingSurface(ds);
return 0;
}
//Get the Drawing Surface info
dsi = ds->GetDrawingSurfaceInfo(ds);
if (dsi == NULL) {
printf(" +++ Error Getting Surface Info +++ \n");
::util_ThrowExceptionToJava(env, "Exception: Error Getting Surface Info");
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
return 0;
}
//Get the Platform specific Drawing Info
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
//Get the Handle to the Native Drawing Surface info
handle_win = (HWND) dsi_win->hwnd;
//Clean up after us
ds->FreeDrawingSurfaceInfo(dsi);
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
//return the native peer handle
return (jint) handle_win;
}

View File

@@ -0,0 +1,23 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_mozilla_webclient_wrapper_0005fnative_win32_Win32BrowserControlCanvas */
#ifndef _Included_org_mozilla_webclient_wrapper_0005fnative_win32_Win32BrowserControlCanvas
#define _Included_org_mozilla_webclient_wrapper_0005fnative_win32_Win32BrowserControlCanvas
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_win32_Win32BrowserControlCanvas
* Method: getHandleToPeer
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_win32_Win32BrowserControlCanvas_getHandleToPeer
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif