Changeset 8 for trunk/llmozlib2
- Timestamp:
- 02/29/08 19:32:35 (2 years ago)
- Files:
-
- trunk/llmozlib2/README-linux-linden.txt (modified) (1 diff)
- trunk/llmozlib2/README-linux.txt (modified) (3 diffs)
- trunk/llmozlib2/README-mac.txt (modified) (3 diffs)
- trunk/llmozlib2/build-linux-llmozlib.sh (modified) (2 diffs)
- trunk/llmozlib2/build_mozilla/.mozconfig.debug (modified) (1 diff)
- trunk/llmozlib2/build_mozilla/.mozconfig.optimized (modified) (1 diff)
- trunk/llmozlib2/build_mozilla/linux-checkout_patch_build.sh (modified) (2 diffs)
- trunk/llmozlib2/build_mozilla/linux-libxul-bits/mozconfig (modified) (2 diffs)
- trunk/llmozlib2/build_mozilla/mac-checkout_patch_build.sh (modified) (3 diffs)
- trunk/llmozlib2/build_mozilla/mac-universal-libxul-bits/mozconfig (modified) (2 diffs)
- trunk/llmozlib2/copy_products_linux.sh (modified) (3 diffs)
- trunk/llmozlib2/copy_products_mac.sh (modified) (1 diff)
- trunk/llmozlib2/copy_products_windows.bat (modified) (2 diffs)
- trunk/llmozlib2/llembeddedbrowser.cpp (modified) (11 diffs)
- trunk/llmozlib2/llembeddedbrowser.h (modified) (4 diffs)
- trunk/llmozlib2/llembeddedbrowserwindow.cpp (modified) (36 diffs)
- trunk/llmozlib2/llembeddedbrowserwindow.h (modified) (10 diffs)
- trunk/llmozlib2/repackage_runtime_mac.sh (modified) (4 diffs)
- trunk/llmozlib2/tests/dependencies/include/GL/glut.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/llmozlib2/README-linux-linden.txt
r1 r8 67 67 Probably only of interest if you're a Second Life developer! 68 68 69 1. copy llmozlib .h to ${SLSRC}/libraries/include/70 2. copy libllmozlib .a to ${SLSRC}/libraries/i686-linux/lib_release_client/69 1. copy llmozlib2.h to ${SLSRC}/libraries/include/ 70 2. copy libllmozlib2.a to ${SLSRC}/libraries/i686-linux/lib_release_client/ 71 71 3. copy libraries/i686-linux/lib_release/libprofdirserviceprovider_s.a to ${SLSRC}/libraries/i686-linux/lib_release_client/ 72 72 4. copy libraries/i686-linux/runtime_release to ${SLSRC}/indra/newview/app_settings/mozilla-runtime-linux-i686 trunk/llmozlib2/README-linux.txt
r1 r8 34 34 1. ./build-linux-llmozlib.sh 35 35 36 This simple builder-script will build the libllmozlib .a library.36 This simple builder-script will build the libllmozlib2.a library. 37 37 38 38 3. BUILDING THE TEST APPLICATIONS … … 46 46 downloaded from http://glui.sourceforge.net/ 47 47 48 0. Edit tests/ubrowser .llmozlib/ubrowser-linux-build.sh48 0. Edit tests/ubrowser/ubrowser-linux-build.sh 49 49 * Change CXX if appropriate. 50 1. cd tests/ubrowser .llmozlib/50 1. cd tests/ubrowser/ 51 51 2. ./browser-linux-build.sh 52 52 … … 54 54 55 55 3. cd ../../libraries/i686-linux/runtime_release 56 4. LD_LIBRARY_PATH=`pwd` ../../../tests/ubrowser .llmozlib/ubrowser56 4. LD_LIBRARY_PATH=`pwd` ../../../tests/ubrowser/ubrowser 57 57 trunk/llmozlib2/README-mac.txt
r1 r8 3 3 If you just need to rebuild the llmozlib library, you can skip ahead to building the xcode project. 4 4 5 If you want to start from scratch, you should first build the mozilla project. The script ../mozilla-mac-universal-build/checkout_patch_build.sh will check out the mozilla sources from the mozilla cvs server, apply our local patches, and build the whole thing. 5 Building mozilla from scratch 6 ----------------------------- 6 7 7 Once you have the mozilla library built, run the copy_products_mac.sh script in this directory to pull the necessary bits across. This will repopulate the architecture-specific portions of the libraries directory here, so you may want to do a preemptive 'svn remove' and commit first. It will also create mozilla-universal-darwin.tgz which contains the necessary runtime bits that need to go into the application bundle. 8 If you want to start from scratch, or are updating to a new mozilla release tag, you should first build the mozilla project. The script ../mozilla-mac-universal-build/checkout_patch_build.sh will check out the mozilla sources from the mozilla cvs server, apply our local patches, and build the whole thing. Embedded in this script is the CVS tag to check out, which should correspond to one of the official mozilla releases. If you update to a later version, please commit the change to checkout_patch_build.sh so that others will be able to tell which version is current. 9 10 Once you have the mozilla library built, run the copy_products_mac.sh script in this directory to pull the necessary bits across. This will repopulate the architecture-specific portions of the libraries directory here, so you may want to do a preemptive 'svn remove' and commit first. It will also create mozilla-universal-darwin-original.tgz which contains the necessary runtime bits that need to go into the application bundle. 11 12 At this point, you can 'svn add' any new files in ./libraries, commit them and mozilla-universal-darwin-original.tgz, and someone else will be able to check out this directory and rebuild llmozlib without having to do a full mozilla build. This is the reason for splitting the build process at this point. 13 14 Rebuilding llmozlib (Xcode) 15 --------------------------- 16 17 *** WARNING *** 18 19 Build will fail the first time! This is expected! There's some voodoo going on with include directory names. Open the project in Xcode (or use the command line equivalent listed at the end of this section). Build it. Now close the Xcode project and reopen it and build it again (or just run the command line equivalent again). 8 20 9 21 Once you've got the mozilla libraries in place, open llmozlib.xcodeproj and build the "Release" build style. If the build fails with a bunch of missing include files, close the project and reopen it, then try again. (A script phase in the project creates a symlink, but xcode only reevaluates the wildcard header path search when the project is opened. You should only have to do this once per checkout.) 10 22 11 After that completes, run repackage_runtime.sh to do the final packaging step and copy the necessary pieces into your sandbox. The script takes a single argument, which is the location of the sandbox directory. (Note that this should be the directory containing the 'libraries' and 'indra' directories.) The script should be run from the llmozlib directory, and the sandbox path can either be relative or absolute (i.e. './repackage_runtime.sh ../../BRANCH' will work fine). 23 If the llmozlib build still fails due to missing header files after doing the steps above, you'll want to figure out where in the mozilla build they live and modify copy_products_mac.sh to copy them, run it (so they get pulled into ./libraries), 'svn add' the new files, and commit. 24 25 If there's any chance the public interface (i.e. member functions) of the LLMozLib class has changed, you need to regenerate the exports file and (re)build the "Release" target. See the NOTE about llmozlib2.exp below. 26 27 If you did a full mozilla build and you're certain you have all the header files you need copied into ./libraries, it's now safe to delete the files that the mozilla build generated: 28 29 build_mozilla/cvsco.log 30 build_mozilla/mozilla 31 build_mozilla/objdir-mozilla-universal 32 33 After the xcode build completes, run repackage_runtime.sh to do the final packaging step (including creating mozilla-universal-darwin.tgz from mozilla-universal-darwin-original.tgz and the llmozlib build products) and copy the necessary pieces into your sandbox. The script takes a single argument, which is the location of the sandbox directory. (Note that this should be the directory containing the 'libraries' and 'indra' directories.) The script should be run from the llmozlib directory, and the sandbox path can either be relative or absolute (i.e. './repackage_runtime.sh ../../BRANCH' will work fine). 34 35 NOTE: Command line build command: 36 37 xcodebuild -project llmozlib2.xcodeproj -target llmozlib2 -configuration Release build 38 39 (You can use "clean" instead of "build") 12 40 13 41 ----------- 14 NOTE: about llmozlib .exp42 NOTE: about llmozlib2.exp 15 43 16 44 In order to hide internal symbols in the mozilla library, we have to use an explicit export list when building llmozlib. … … 18 46 The list of symbols to export is in llmozlib.exp. The symbols are in "name mangled" form, making them a bit of a pain to read. 19 47 20 If changes are made to any of the class definitions in llmozlib.h, this list may need to be regenerated. To regenerate the list of symbols: 48 If changes are made to any of the class definitions in llmozlib.h, this list may need to be regenerated. The script update-mac-symbols.sh in this directory now takes care of doing this step. The following directions are what I used to do manually, preserved for posterity (or in case the script breaks in the future). If you run the script and it works, you don't need to read any further. 49 50 51 To regenerate the list of symbols: 21 52 22 53 - Open up the xcode project 23 - Change the "Exported Symbols File" setting in the llmozlib target from llmozlib.exp to nothing 24 - Build the "Release" target 54 - Build the "All Symbols" configuration 25 55 - Execute the following commands: 26 56 27 otool -vT build/Release/libllmozlib.dylib>symbols.txt57 otool -vT 'build/All Symbols/libllmozlib2.dylib' >symbols.txt 28 58 sed -n -e '/.*\.eh/d' -e 's/^single module \(.*\)/\1/p' <symbols.txt >symbols2.txt 29 59 … … 33 63 34 64 Once you've got the new list, paste it into llmozlib.exp and change the "Exported Symbols File" setting back to "llmozlib.exp". 65 66 NOTE: Command line build command: 67 68 xcodebuild -project llmozlib2.xcodeproj -target llmozlib2 -configuration Release build 69 70 (You can use "clean" instead of "build") 35 71 36 72 ----------- trunk/llmozlib2/build-linux-llmozlib.sh
r1 r8 1 #!/bin/ sh1 #!/bin/bash 2 2 # This script builds llmozlib itself. This should happen after 3 3 # mozilla has been built and copy_products_linux.sh has been run. … … 5 5 CXX='g++-3.4' 6 6 MOZARCH='i686-linux' 7 SRCS='llembeddedbrowser.cpp llembeddedbrowserwindow.cpp llmozlib .cpp'7 SRCS='llembeddedbrowser.cpp llembeddedbrowserwindow.cpp llmozlib2.cpp' 8 8 9 9 #------------------------ 10 10 11 LIBNAME=libllmozlib 11 LIBNAME=libllmozlib2 12 12 OBJS=`echo ${SRCS} | sed s/\\.cpp/.o/g` 13 INCS_LINE="` pkg-config gtk+-2.0 --cflags` `find libraries/${MOZARCH}/include -type d | sed s/^/-I/`"13 INCS_LINE="`find libraries/${MOZARCH}/include -type d | sed s/^/-I/`" 14 14 DEFS='-DMOZILLA_INTERNAL_API -DLL_LINUX=1' 15 15 OPTS='-ggdb' trunk/llmozlib2/build_mozilla/.mozconfig.debug
r1 r8 27 27 ac_add_options --enable-image-decoders=png,gif,jpeg 28 28 ac_add_options --enable-svg 29 ac_add_options --enable-svg-renderer=gdiplus30 29 ac_add_options --disable-javaxpcom 31 30 ac_add_options --disable-activex trunk/llmozlib2/build_mozilla/.mozconfig.optimized
r1 r8 27 27 ac_add_options --enable-image-decoders=png,gif,jpeg 28 28 ac_add_options --enable-svg 29 ac_add_options --enable-svg-renderer=gdiplus30 29 ac_add_options --disable-javaxpcom 31 30 ac_add_options --disable-activex trunk/llmozlib2/build_mozilla/linux-checkout_patch_build.sh
r1 r8 10 10 echo 'use the password "anonymous" if prompted' 11 11 cvs login 12 cvs checkout -r FIREFOX_ 1_5_0_12_RELEASE mozilla/client.mk12 cvs checkout -r FIREFOX_2_0_0_11_RELEASE mozilla/client.mk 13 13 (cd mozilla && make -f client.mk checkout MOZ_CO_PROJECT=xulrunner) 14 14 … … 18 18 # apply a patch to the mozilla source so that it doesn't try to use the OS 19 19 # versions of scrollbars, combo boxes, etc. 20 cat lin ux-libxul-bits/linden_updates.patch | (cd mozilla && patch -p0)20 cat linden.patch | (cd mozilla && patch -p0) 21 21 22 22 # XXX FIXME: ideally we need to bring custom GTK in-tree and do some magic on its .pc files - yuck. Only Linden Lab's conservative-deps binary builds really care though. 23 #export PKG_CONFIG_PATH=/home/moss/linden/GTKBUILD24/lib/pkgconfig23 export PKG_CONFIG_PATH=/tmp/GTKBUILD24/lib/pkgconfig 24 24 (cd mozilla && make -f client.mk build) 25 25 trunk/llmozlib2/build_mozilla/linux-libxul-bits/mozconfig
r1 r8 61 61 CURRENTDIR=`pwd` 62 62 63 # parallel build (adjust to taste) 64 mk_add_options MOZ_MAKE_FLAGS=-j4 65 63 66 mk_add_options MOZ_CO_PROJECT=xulrunner 64 67 ac_add_options --enable-application=xulrunner … … 99 102 #ac_add_options --with-gtk-prefix=/tmp/GTKBUILD 100 103 #ac_add_options --with-glib-prefix=/tmp/GTKBUILD 101 #ac_add_options --disable-pango 104 ac_add_options --disable-pango 105 #ac_add_options --enable-pango 106 #ac_add_options --enable-freetype2 102 107 ac_add_options --disable-gnomevfs 103 108 ac_add_options --disable-gnomeui trunk/llmozlib2/build_mozilla/mac-checkout_patch_build.sh
r1 r8 11 11 cvs login 12 12 #cvs checkout -r MOZILLA_1_8_BRANCH mozilla/client.mk 13 cvs checkout -r FIREFOX_ 1_5_0_12_RELEASE mozilla/client.mk13 cvs checkout -r FIREFOX_2_0_0_11_RELEASE mozilla/client.mk 14 14 (cd mozilla && make -f client.mk checkout MOZ_CO_PROJECT=xulrunner) 15 15 … … 20 20 # shell scripts that I don't want to set up. Since we don't need to build the 21 21 # package, just comment this out. 22 cp mac-universal-libxul-bits/installer-mac-Makefile.in mozilla/xulrunner/installer/mac/Makefile.in 22 # NOTE: this is now part of the linden.patch file instead. 23 #cp mac-universal-libxul-bits/installer-mac-Makefile.in mozilla/xulrunner/installer/mac/Makefile.in 23 24 24 25 # replace the 'flight.mk' with one that does the right thing for the xulrunner build … … 29 30 # apply a patch to the mozilla source so that it doesn't try to use the OS 30 31 # versions of scrollbars, combo boxes, etc. 31 cat mac-universal-libxul-bits/linden-mozilla-mods.patch | (cd mozilla && patch -p0)32 cat linden.patch | (cd mozilla && patch -p0) 32 33 33 34 (cd mozilla && make -f client.mk build) trunk/llmozlib2/build_mozilla/mac-universal-libxul-bits/mozconfig
r1 r8 107 107 fi 108 108 109 109 110 # parallel build (adjust to taste) 110 111 mk_add_options MOZ_MAKE_FLAGS=-j4 … … 142 143 ac_add_options --disable-activex 143 144 ac_add_options --disable-activex-scripting 144 ac_add_options --enable-canvas 145 # MBW -- got a mysterious compile error somewhere in the canvas stuff. Turning it off for now. 146 #ac_add_options --enable-canvas 147 ac_add_options --disable-canvas 145 148 146 149 ac_add_options --enable-cpp-rtti trunk/llmozlib2/copy_products_linux.sh
r1 r8 1 #!/bin/ sh1 #!/bin/bash 2 2 3 3 # This script copies the relevant headers from the mozilla tree to the llmozlib … … 12 12 export LIBRARIES_DEST="." 13 13 14 export ARCH= i686-linux14 export ARCH=`uname -m`-linux 15 15 16 16 # make sure the destination directories exist. If they don't, the user running the script probably hasn't set them up properly. … … 27 27 SRC="$MOZ_OBJDIR" 28 28 DST="$LIBRARIES_DEST/libraries/$ARCH" 29 for dir in /include/webbrwsr/ /include/docshell/ /include/dom/ /include/xpcom/ /include/widget/ /include/gfx/ /include/string/ /include/uriloader/ /include/view/ /include/layout/ /include/content/ /include/locale/ /include/profdirserviceprovider/ /include/xulapp/ /include/pref/ /include/necko/ /include/nkcache/ / sdk/include/ ; do29 for dir in /include/webbrwsr/ /include/docshell/ /include/dom/ /include/xpcom/ /include/widget/ /include/gfx/ /include/string/ /include/uriloader/ /include/view/ /include/layout/ /include/content/ /include/locale/ /include/profdirserviceprovider/ /include/xulapp/ /include/pref/ /include/necko/ /include/nkcache/ /include/js/ /include/appshell/ /sdk/include/ ; do 30 30 mkdir -p $DST/include/mozilla/${dir} 31 31 cp -LR $SRC/dist/${dir}/* $DST/include/mozilla/${dir} trunk/llmozlib2/copy_products_mac.sh
r1 r8 97 97 + /include/necko/ 98 98 + /include/nkcache/ 99 + /include/js/ 99 100 + /sdk/ 100 101 + /sdk/include/ 101 102 + /sdk/include/*/ 102 103 + *.h 104 + *.tbl 103 105 - * 104 106 EOF trunk/llmozlib2/copy_products_windows.bat
r1 r8 1 1 @rem ===== source/destination dirs that may change depending where you build mozilla ===== 2 @set SRC_DIR_OPT="c:\mozilla .1.8.0.9\objdir-opt-xulrunner-small"3 @set SRC_DIR_DEBUG="c:\mozilla .1.8.0.9\objdir-debug-xulrunner-small"2 @set SRC_DIR_OPT="c:\mozilla\objdir-opt-xulrunner-small" 3 @set SRC_DIR_DEBUG="c:\mozilla\objdir-debug-xulrunner-small" 4 4 @set DEST_DIR="libraries\i686-win32" 5 5 6 6 @rem =============== instructions =============== 7 7 @echo This batch file copies the files required to build the 8 @echo Linden Lab Mozilla Library (LLMozLib).8 @echo Linden Lab Mozilla Library2 (LLMozLib2). 9 9 @echo. 10 10 @echo It will copy the required files from a Mozilla build in the specified 11 @echo directories to the right location for LLMozLib .11 @echo directories to the right location for LLMozLib2. 12 12 @echo. 13 13 @echo The release build will be copied from: … … 28 28 xcopy %SRC_DIR_OPT%\dist\include\dom\*.* %DEST_DIR%\include\mozilla\include\dom\ /s 29 29 xcopy %SRC_DIR_OPT%\dist\include\gfx\*.* %DEST_DIR%\include\mozilla\include\gfx\ /s 30 xcopy %SRC_DIR_OPT%\dist\include\js\*.* %DEST_DIR%\include\mozilla\include\js\ /s 30 31 xcopy %SRC_DIR_OPT%\dist\include\layout\*.* %DEST_DIR%\include\mozilla\include\layout\ /s 31 32 xcopy %SRC_DIR_OPT%\dist\include\locale\*.* %DEST_DIR%\include\mozilla\include\locale\ /s trunk/llmozlib2/llembeddedbrowser.cpp
r3 r8 1 /** 2 * @file llembeddedbrowser.cpp 3 * @brief LLEmbeddedBrowser implementation. 4 * 5 * $LicenseInfo:firstyear=2006&license=viewergpl$ 6 * 7 * Copyright (c) 2006-2007, Linden Research, Inc. 8 * 9 * Second Life Viewer Source Code 10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * to you under the terms of the GNU General Public License, version 2.0 12 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * online at http://secondlife.com/developers/opensource/gplv2 16 * 17 * There are special exceptions to the terms and conditions of the GPL as 18 * it is applied to this Source Code. View the full text of the exception 19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * online at http://secondlife.com/developers/opensource/flossexception 21 * 22 * By copying, modifying or distributing this software, you acknowledge 23 * that you have read and understood your obligations described above, 24 * and agree to abide by those obligations. 25 * 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 28 * COMPLETENESS OR PERFORMANCE. 29 * $/LicenseInfo$ 30 */ 1 /* ***** BEGIN LICENSE BLOCK ***** 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * 4 * The contents of this file are subject to the Mozilla Public License Version 5 * 1.1 (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * http://www.mozilla.org/MPL/ 8 * 9 * Software distributed under the License is distributed on an "AS IS" basis, 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 * for the specific language governing rights and limitations under the 12 * License. 13 * 14 * The Original Code is Linden Lab Inc. (http://lindenlab.com) code. 15 * 16 * The Initial Developer of the Original Code is: 17 * Callum Prentice (callum@ubrowser.com) 18 * 19 * Portions created by the Initial Developer are Copyright (C) 2006 20 * the Initial Developer. All Rights Reserved. 21 * 22 * Contributor(s): 23 * Callum Prentice (callum@ubrowser.com) 24 * 25 * Alternatively, the contents of this file may be used under the terms of 26 * either the GNU General Public License Version 2 or later (the "GPL"), or 27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 28 * in which case the provisions of the GPL or the LGPL are applicable instead 29 * of those above. If you wish to allow use of your version of this file only 30 * under the terms of either the GPL or the LGPL, and not to allow others to 31 * use your version of this file under the terms of the MPL, indicate your 32 * decision by deleting the provisions above and replace them with the notice 33 * and other provisions required by the GPL or the LGPL. If you do not delete 34 * the provisions above, a recipient may use your version of this file under 35 * the terms of any one of the MPL, the GPL or the LGPL. 36 * 37 * ***** END LICENSE BLOCK ***** */ 31 38 32 39 // Windows specific switches … … 36 43 #define DEBUG 1 37 44 #endif 38 #endif 45 #endif // WIN32 39 46 40 47 #include "llembeddedbrowser.h" … … 42 49 43 50 #ifdef WIN32 44 #pragma warning( disable : 4265 ) // "class has virtual functions, but destructor is not virtual"45 #pragma warning( disable : 4291 ) // (no matching operator delete found; memory will not be freed if initialization throws an exception)51 #pragma warning( disable : 4265 ) // "class has virtual functions, but destructor is not virtual" 52 #pragma warning( disable : 4291 ) // (no matching operator delete found; memory will not be freed if initialization throws an exception) 46 53 #endif // WIN32 47 54 48 55 #include "nsBuildID.h" 49 #include "nsNetCID.h"50 #include "nsCWebBrowser.h"51 #include "nsGUIEvent.h"52 56 #include "nsICacheService.h" 53 57 #include "nsICookieManager.h" 54 #include "nsICaret.h"55 #include "nsIComponentRegistrar.h"56 #include "nsIContent.h"57 #include "nsIDOMDocument.h"58 #include "nsIDOMElement.h"59 #include "nsIDOMWindow.h"60 #include "nsIDocShell.h"61 #include "nsIDocShellTreeItem.h"62 #include "nsIDocument.h"63 #include "nsIFactory.h"64 #include "nsIFrame.h"65 #include "nsIInterfaceRequestorUtils.h"66 58 #include "nsIPref.h" 67 #include "nsIPromptService.h" 68 #include "nsIScrollableView.h" 69 #include "nsISelection.h" 70 #include "nsISelectionController.h" 71 #include "nsIWebBrowserChrome.h" 72 #include "nsIWebBrowserChromeFocus.h" 73 #include "nsIWebBrowserFocus.h" 74 #include "nsPresContext.h" 59 #include "nsNetCID.h" 75 60 #include "nsProfileDirServiceProvider.h" 76 #include "nsXPCOMGlue.h"77 61 #include "nsXULAppAPI.h" 78 #include "nsWidgetsCID.h" // for NS_APPSHELL_CID79 62 #include "nsIAppShell.h" 80 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); 63 64 #if defined(LL_LINUX) || defined(LL_DARWIN) 65 #include "nsWidgetsCID.h" 66 static nsIAppShell *sAppShell = nsnull; 67 #endif // defined(LL_LINUX) || defined(LL_DARWIN) 81 68 82 69 // singleton pattern - initialization … … 86 73 // 87 74 LLEmbeddedBrowser::LLEmbeddedBrowser() : 88 mErrorNum( 0 ) 75 mErrorNum( 0 ), 76 mNativeWindowHandle( 0 ) 89 77 { 90 78 } … … 131 119 //////////////////////////////////////////////////////////////////////////////// 132 120 // 133 static nsIAppShell *sAppShell = nsnull; 134 135 bool LLEmbeddedBrowser::init( std::string applicationDir, std::string componentDir, std::string profileDir ) 136 { 121 std::string LLEmbeddedBrowser::getGREVersion() 122 { 123 // take the string directly from Mozilla 124 return std::string( GRE_BUILD_ID ); 125 } 126 127 //////////////////////////////////////////////////////////////////////////////// 128 // 129 bool LLEmbeddedBrowser::init( std::string applicationDir, 130 std::string componentDir, 131 std::string profileDir, 132 void* nativeWindowHandleIn ) 133 { 134 mNativeWindowHandle = nativeWindowHandleIn; 135 137 136 nsCOMPtr< nsILocalFile > applicationDirNative; 138 137 nsresult result = NS_NewNativeLocalFile( nsCString( applicationDir.c_str() ), PR_FALSE, getter_AddRefs( applicationDirNative ) ); … … 193 192 if ( pref ) 194 193 { 195 //pref->SetBoolPref( "viewmanager.do_doublebuffering", PR_FALSE );196 194 pref->SetBoolPref( "security.warn_entering_secure", PR_FALSE ); 197 195 pref->SetBoolPref( "security.warn_entering_weak", PR_FALSE ); … … 208 206 enableProxy( false, "", 0 ); 209 207 210 #if def LL_LINUX208 #if defined(LL_LINUX) || defined(LL_DARWIN) 211 209 // Essential on Linux/GTK to add the gecko pump to the GTK event 212 210 // loop. Might be harmless/good on other platforms too. 211 nsresult rv; 213 212 nsCOMPtr<nsIAppShell> appShell; 214 appShell = do_CreateInstance(kAppShellCID); 213 NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); 214 appShell = do_CreateInstance(kAppShellCID, &rv); 215 215 if (!appShell) 216 216 { … … 233 233 bool LLEmbeddedBrowser::reset() 234 234 { 235 if (sAppShell) {236 // Shutdown the appshell service.237 sAppShell->Spindown();238 NS_RELEASE(sAppShell);239 sAppShell = NULL;240 }241 242 235 XRE_TermEmbedding(); 243 244 return true;245 }246 247 ////////////////////////////////////////////////////////////////////////////////248 //249 std::string LLEmbeddedBrowser::getGREVersion()250 {251 // take the string directly from Mozilla252 return std::string( GRE_BUILD_ID );253 }254 255 ////////////////////////////////////////////////////////////////////////////////256 //257 void LLEmbeddedBrowser::setBrowserAgentId( std::string idIn )258 {259 nsCOMPtr<nsIPref> pref = do_CreateInstance( NS_PREF_CONTRACTID );260 if ( pref )261 {262 pref->SetCharPref( "general.useragent.extra.* ", idIn.c_str() );263 };264 }265 266 ////////////////////////////////////////////////////////////////////////////////267 //268 LLEmbeddedBrowserWindow* createWindow( void* nativeWindowHandleIn, int widthIn, int heightIn, PRUint32 aChromeFlags, nsIWebBrowserChrome* aParent, nsIWebBrowserChrome** aNewWindow )269 {270 LLEmbeddedBrowserWindow* chrome = new LLEmbeddedBrowserWindow();271 if ( ! chrome )272 {273 return 0;274 };275 276 CallQueryInterface( NS_STATIC_CAST( nsIWebBrowserChrome*, chrome ), aNewWindow );277 278 NS_ADDREF( *aNewWindow );279 280 chrome->SetChromeFlags( aChromeFlags );281 282 nsCOMPtr< nsIWebBrowser > newBrowser;283 284 chrome->createBrowser( nativeWindowHandleIn, widthIn, heightIn, getter_AddRefs( newBrowser ) );285 if ( ! newBrowser )286 {287 return 0;288 };289 290 return chrome;291 }292 293 ////////////////////////////////////////////////////////////////////////////////294 //295 LLEmbeddedBrowserWindow* LLEmbeddedBrowser::createBrowserWindow( void* nativeWindowHandleIn, int browserWidthIn, int browserHeightIn )296 {297 nsCOMPtr< nsIWebBrowserChrome > chrome;298 LLEmbeddedBrowserWindow* newWin = createWindow( nativeWindowHandleIn, browserWidthIn, browserHeightIn, nsIWebBrowserChrome::CHROME_ALL, nsnull, getter_AddRefs( chrome ) );299 if ( newWin && chrome )300 {301 nsCOMPtr< nsIWebBrowser > newBrowser;302 chrome->GetWebBrowser( getter_AddRefs( newBrowser ) );303 nsCOMPtr< nsIWebNavigation > webNav( do_QueryInterface ( newBrowser ) );304 webNav->LoadURI( NS_ConvertUTF8toUTF16( "about:blank" ).get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull );305 306 307 clearLastError();308 309 return newWin;310 };311 312 setLastError( 0x2001 );313 314 return 0;315 };316 317 ////////////////////////////////////////////////////////////////////////////////318 //319 bool LLEmbeddedBrowser::destroyBrowserWindow( LLEmbeddedBrowserWindow* browserWindowIn )320 {321 nsCOMPtr< nsIWebBrowser > webBrowser;322 nsCOMPtr< nsIWebNavigation > webNavigation;323 324 browserWindowIn->GetWebBrowser( getter_AddRefs( webBrowser ) );325 webNavigation = do_QueryInterface( webBrowser );326 if ( webNavigation )327 {328 webNavigation->Stop( nsIWebNavigation::STOP_ALL );329 };330 331 nsCOMPtr< nsIWebBrowser > browser = nsnull;332 browserWindowIn->GetWebBrowser( getter_AddRefs( browser ) );333 nsCOMPtr< nsIBaseWindow > browserAsWin = do_QueryInterface( browser );334 if ( browserAsWin )335 {336 browserAsWin->Destroy();337 };338 339 browserWindowIn->SetWebBrowser( nsnull );340 341 NS_RELEASE( browserWindowIn );342 343 delete browserWindowIn;344 345 clearLastError();346 236 347 237 return true; … … 361 251 } 362 252 363 /////////////////////////////////////////////////////////////////////////////// 253 //////////////////////////////////////////////////////////////////////////////// 364 254 // 365 255 bool LLEmbeddedBrowser::enableProxy( bool proxyEnabledIn, std::string proxyHostNameIn, int proxyPortIn ) … … 440 330 pref->SetBoolPref( "plugin.scan.plid.all", PR_FALSE ); 441 331 pref->SetBoolPref( "xpinstall-enabled", PR_FALSE ); 332 pref->SetBoolPref( "plugin.scan.4xPluginFolder", PR_FALSE ); 333 pref->SetCharPref( "plugin.scan.Quicktime", "20.0" ); 334 pref->SetCharPref( "plugin.scan.Acrobat", "99.0" ); 335 pref->SetCharPref( "plugin.scan.SunJRE", "99.0" ); 336 pref->SetCharPref( "plugin.scan.WindowsMediaPlayer", "99.0" ); 442 337 }; 443 338 … … 446 341 447 342 return false; 343 } 344 345 //////////////////////////////////////////////////////////////////////////////// 346 // 347 void LLEmbeddedBrowser::setBrowserAgentId( std::string idIn ) 348 { 349 nsCOMPtr<nsIPref> pref = do_CreateInstance( NS_PREF_CONTRACTID ); 350 if ( pref ) 351 { 352 pref->SetCharPref( "general.useragent.extra.* ", idIn.c_str() ); 353 }; 354 } 355 356 //////////////////////////////////////////////////////////////////////////////// 357 // 358 LLEmbeddedBrowserWindow* LLEmbeddedBrowser::createBrowserWindow( int browserWidthIn, int browserHeightIn ) 359 { 360 nsCOMPtr< nsIWebBrowserChrome > chrome; 361 362 LLEmbeddedBrowserWindow* newWin = new LLEmbeddedBrowserWindow(); 363 if ( ! newWin ) 364 { 365 return 0; 366 }; 367 368 nsIWebBrowserChrome** aNewWindow = getter_AddRefs( chrome ); 369 370 CallQueryInterface( NS_STATIC_CAST( nsIWebBrowserChrome*, newWin ), aNewWindow ); 371 372 NS_ADDREF( *aNewWindow ); 373 374 newWin->SetChromeFlags( nsIWebBrowserChrome::CHROME_ALL ); 375 376 nsCOMPtr< nsIWebBrowser > newBrowser; 377 378 newWin->createBrowser( mNativeWindowHandle, browserWidthIn, browserHeightIn, getter_AddRefs( newBrowser ) ); 379 if ( ! newBrowser ) 380 { 381 return 0; 382 }; 383 384 if ( newWin && chrome ) 385 { 386 newWin->setParent( this ); 387 nsCOMPtr< nsIWebBrowser > newBrowser; 388 chrome->GetWebBrowser( getter_AddRefs( newBrowser ) ); 389 nsCOMPtr< nsIWebNavigation > webNav( do_QueryInterface ( newBrowser ) ); 390 webNav->LoadURI( NS_ConvertUTF8toUTF16( "about:blank" ).get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull ); 391 392 clearLastError(); 393 394 return newWin; 395 }; 396 397 setLastError( 0x2001 ); 398 return 0; 399 }; 400 401 //////////////////////////////////////////////////////////////////////////////// 402 // 403 bool LLEmbeddedBrowser::destroyBrowserWindow( LLEmbeddedBrowserWindow* browserWindowIn ) 404 { 405 nsCOMPtr< nsIWebBrowser > webBrowser; 406 nsCOMPtr< nsIWebNavigation > webNavigation; 407 408 browserWindowIn->GetWebBrowser( getter_AddRefs( webBrowser ) ); 409 webNavigation = do_QueryInterface( webBrowser ); 410 if ( webNavigation ) 411 { 412 webNavigation->Stop( nsIWebNavigation::STOP_ALL ); 413 }; 414 415 nsCOMPtr< nsIWebBrowser > browser = nsnull; 416 browserWindowIn->GetWebBrowser( getter_AddRefs( browser ) ); 417 nsCOMPtr< nsIBaseWindow > browserAsWin = do_QueryInterface( browser ); 418 if ( browserAsWin ) 419 { 420 browserAsWin->Destroy(); 421 }; 422 423 browserWindowIn->SetWebBrowser( nsnull ); 424 425 NS_RELEASE( browserWindowIn ); 426 427 delete browserWindowIn; 428 429 clearLastError(); 430 431 return true; 448 432 } 449 433 450 434 // Windows specific switches 451 435 #ifdef WIN32 452 453 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"454 436 #pragma warning( 3 : 4291 ) // (no matching operator delete found; memory will not be freed if initialization throws an exception) 437 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" 455 438 456 439 // #define required by this file for LibXUL/Mozilla code to avoid crashes in their debug code trunk/llmozlib2/llembeddedbrowser.h
r3 r8 1 /** 2 * @file llembeddedbrowser.h 3 * @brief LLEmbeddedBrowser declaration. 1 /* ***** BEGIN LICENSE BLOCK ***** 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 4 3 * 5 * $LicenseInfo:firstyear=2006&license=viewergpl$ 4 * The contents of this file are subject to the Mozilla Public License Version 5 * 1.1 (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * http://www.mozilla.org/MPL/ 6 8 * 7 * Copyright (c) 2006-2007, Linden Research, Inc. 9 * Software distributed under the License is distributed on an "AS IS" basis, 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 * for the specific language governing rights and limitations under the 12 * License. 8 13 * 9 * Second Life Viewer Source Code 10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * to you under the terms of the GNU General Public License, version 2.0 12 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * online at http://secondlife.com/developers/opensource/gplv2 14 * The Original Code is Linden Lab Inc. (http://lindenlab.com) code. 16 15 * 17 * There are special exceptions to the terms and conditions of the GPL as 18 * it is applied to this Source Code. View the full text of the exception 19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * online at http://secondlife.com/developers/opensource/flossexception 16 * The Initial Developer of the Original Code is: 17 * Callum Prentice (callum@ubrowser.com) 21 18 * 22 * By copying, modifying or distributing this software, you acknowledge 23 * that you have read and understood your obligations described above, 24 * and agree to abide by those obligations. 19 * Portions created by the Initial Developer are Copyright (C) 2006 20 * the Initial Developer. All Rights Reserved. 25 21 * 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 28 * COMPLETENESS OR PERFORMANCE. 29 * $/LicenseInfo$ 30 */ 22 * Contributor(s): 23 * Callum Prentice (callum@ubrowser.com) 24 * 25 * Alternatively, the contents of this file may be used under the terms of 26 * either the GNU General Public License Version 2 or later (the "GPL"), or 27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 28 * in which case the provisions of the GPL or the LGPL are applicable instead 29 * of those above. If you wish to allow use of your version of this file only 30 * under the terms of either the GPL or the LGPL, and not to allow others to 31 * use your version of this file under the terms of the MPL, indicate your 32 * decision by deleting the provisions above and replace them with the notice 33 * and other provisions required by the GPL or the LGPL. If you do not delete 34 * the provisions above, a recipient may use your version of this file under 35 * the terms of any one of the MPL, the GPL or the LGPL. 36 * 37 * ***** END LICENSE BLOCK ***** */ 31 38 32 39 #ifndef LLEMBEDDEDBROWSER_H … … 47 54 static LLEmbeddedBrowser* getInstance(); 48 55 49 bool init( std::string applicationDir, std::string componentDir, std::string profileDir );56 bool init( std::string applicationDir, std::string componentDir, std::string profileDir, void* nativeWindowHandleIn ); 50 57 bool reset(); 51 58 bool clearCache(); … … 56 63 std::string getGREVersion(); 57 64 void setBrowserAgentId( std::string idIn ); 58 LLEmbeddedBrowserWindow* createBrowserWindow( void* nativeWindowHandleIn,int browserWidthIn, int browserHeightIn );65 LLEmbeddedBrowserWindow* createBrowserWindow( int browserWidthIn, int browserHeightIn ); 59 66 bool destroyBrowserWindow( LLEmbeddedBrowserWindow* browserWindowIn ); 60 bool setCaretColor( int browserWindowIdIn, const int redIn, const int greenIn, const int blueIn );61 67 void setLastError( int errorNumIn ); 62 68 void clearLastError(); … … 65 71 private: 66 72 static LLEmbeddedBrowser* sInstance; 73 void* mNativeWindowHandle; 67 74 int mErrorNum; 68 75 }; 69 76 70 77 #endif // LLEMBEDDEDBROWSER_H 78 trunk/llmozlib2/llembeddedbrowserwindow.cpp
r3 r8 1 /** 2 * @file llembeddedbrowserwindow.cpp 3 * @brief LLEmbeddedBrowserWindow implementation. 1 /* ***** BEGIN LICENSE BLOCK ***** 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 4 3 * 5 * $LicenseInfo:firstyear=2006&license=viewergpl$ 4 * The contents of this file are subject to the Mozilla Public License Version 5 * 1.1 (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * http://www.mozilla.org/MPL/ 6 8 * 7 * Copyright (c) 2006-2007, Linden Research, Inc. 9 * Software distributed under the License is distributed on an "AS IS" basis, 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 * for the specific language governing rights and limitations under the 12 * License. 8 13 * 9 * Second Life Viewer Source Code 10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * to you under the terms of the GNU General Public License, version 2.0 12 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * online at http://secondlife.com/developers/opensource/gplv2 14 * The Original Code is Linden Lab Inc. (http://lindenlab.com) code. 16 15 * 17 * There are special exceptions to the terms and conditions of the GPL as 18 * it is applied to this Source Code. View the full text of the exception 19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * online at http://secondlife.com/developers/opensource/flossexception 16 * The Initial Developer of the Original Code is: 17 * Callum Prentice (callum@ubrowser.com) 21 18 * 22 * By copying, modifying or distributing this software, you acknowledge 23 * that you have read and understood your obligations described above, 24 * and agree to abide by those obligations. 19 * Portions created by the Initial Developer are Copyright (C) 2006 20 * the Initial Developer. All Rights Reserved. 25 21 * 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 28 * COMPLETENESS OR PERFORMANCE. 29 * $/LicenseInfo$ 30 */ 31 32 // required by LibXUL/Mozilla code to avoid crashes in their debug code, but only on Windows. 22 * Contributor(s): 23 * Callum Prentice (callum@ubrowser.com) 24 * 25 * Alternatively, the contents of this file may be used under the terms of 26 * either the GNU General Public License Version 2 or later (the "GPL"), or 27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 28 * in which case the provisions of the GPL or the LGPL are applicable instead 29 * of those above. If you wish to allow use of your version of this file only 30 * under the terms of either the GPL or the LGPL, and not to allow others to 31 * use your version of this file under the terms of the MPL, indicate your 32 * decision by deleting the provisions above and replace them with the notice 33 * and other provisions required by the GPL or the LGPL. If you do not delete 34 * the provisions above, a recipient may use your version of this file under 35 * the terms of any one of the MPL, the GPL or the LGPL. 36 * 37 * ***** END LICENSE BLOCK ***** */ 38 39 // seems to be required by LibXUL/Mozilla code to avoid crashes in their debug code, but only on Windows. 33 40 // undef'd at end of this 34 41 #ifdef _DEBUG … … 38 45 #endif 39 46 47 // needed for the code in LLEmbeddedBrowserWindow::NotifyInvalidated() which will 48 // one day be moved to platform agnostic code when I find out how... 49 #ifdef WIN32 50 #include "windows.h" 51 #endif 52 53 #include "llembeddedbrowser.h" 40 54 #include "llembeddedbrowserwindow.h" 41 55 … … 73 87 #include "nsXULAppAPI.h" 74 88 89 #include "llembeddedbrowserwindow.h" 90 91 #include <iostream> 92 75 93 #ifdef WIN32 76 94 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" … … 80 98 // 81 99 LLEmbeddedBrowserWindow::LLEmbeddedBrowserWindow() : 100 mParent( 0 ), 82 101 mWebBrowser( nsnull ), 83 102 mBaseWindow( nsnull ), … … 87 106 mBrowserHeight( 0 ), 88 107 mBrowserDepth( 4 ), 89 mPageBuffer( NULL),90 m PageBufferSize ( 0),108 mPageBuffer( 0 ), 109 mEnabled( true ), 91 110 mCurrentUri( "" ), 92 111 mStatusText( "" ), 93 112 mClickHref( "" ), 94 mBackgroundRed( 0xff ), 95 mBackgroundGreen( 0xff ), 96 mBackgroundBlue( 0xff ), 113 mClickTarget( "" ), 114 mNoFollowScheme( "secondlife://" ), 115 mBkgRed( 0xff ), 116 mBkgGreen( 0xff ), 117 mBkgBlue( 0xff ), 97 118 mCaretRed( 0x0 ), 98 119 mCaretGreen( 0x0 ), 99 120 mCaretBlue( 0x0 ), 100 m404RedirectUrl( "" ) 121 m404RedirectUrl( "" ), 122 mFlipBitmap( false ) 101 123 { 102 124 } … … 121 143 { 122 144 delete[] mPageBuffer; 123 mPageBuffer = NULL; 124 mPageBufferSize = 0; 145 mPageBuffer = 0; 125 146 }; 126 147 } … … 133 154 *aBrowser = nsnull; 134 155 135 mWebBrowser = do_CreateInstance( NS_WEBBROWSER_CONTRACTID ); 156 nsresult rv; 157 mWebBrowser = do_CreateInstance( NS_WEBBROWSER_CONTRACTID, &rv ); 136 158 if ( ! mWebBrowser ) 159 { 137 160 return NS_ERROR_FAILURE; 138 139 (void)mWebBrowser->SetContainerWindow(NS_STATIC_CAST(nsIWebBrowserChrome*, this)); 140 141 nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(mWebBrowser); 142 dsti->SetItemType(nsIDocShellTreeItem::typeContentWrapper); 143 144 mBaseWindow = do_QueryInterface(mWebBrowser); 161 } 162 163 (void)mWebBrowser->SetContainerWindow( NS_STATIC_CAST( nsIWebBrowserChrome*, this ) ); 164 165 nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface( mWebBrowser ); 166 dsti->SetItemType( nsIDocShellTreeItem::typeContentWrapper ); 167 168 mBaseWindow = do_QueryInterface( mWebBrowser ); 145 169 146 170 mBaseWindow->InitWindow( nativeWindowHandleIn, nsnull, 0, 0, mBrowserWidth, mBrowserHeight ); 147 171 mBaseWindow->Create(); 148 172 149 nsCOMPtr<nsIWebProgressListener> listener(NS_STATIC_CAST(nsIWebProgressListener*, this)); 150 nsCOMPtr<nsIWeakReference> thisListener(do_GetWeakReference(listener)); 151 (void)mWebBrowser->AddWebBrowserListener(thisListener, 152 NS_GET_IID(nsIWebProgressListener)); 173 nsCOMPtr< nsIWebProgressListener > listener( NS_STATIC_CAST( nsIWebProgressListener*, this ) ); 174 nsCOMPtr< nsIWeakReference > thisListener( do_GetWeakReference( listener ) ); 175 mWebBrowser->AddWebBrowserListener( thisListener, NS_GET_IID( nsIWebProgressListener ) ); 176 177 #if LL_DARWIN 178 // Without this, the mac doesn't get upates for animating gifs, mouseovers, etc. 179 mBaseWindow->SetVisibility( PR_TRUE ); 180 #else 181 mBaseWindow->SetVisibility( PR_FALSE ); 182 #endif 153 183 154 184 nsresult result; 155 // set the listener to we can catch nsURIContentListener events156 if ( mWebBrowser )157 {158 result = mWebBrowser->SetParentURIContentListener( NS_STATIC_CAST( nsIURIContentListener*, this ) );159 if ( NS_FAILED( result ) )160 {161 };162 };163 164 185 mWebNav = do_QueryInterface( mWebBrowser, &result ); 165 186 if ( NS_FAILED( result ) || ! mWebNav ) 166 187 { 167 }; 168 169 mBaseWindow->SetVisibility( PR_FALSE ); 188 return NS_ERROR_FAILURE; 189 }; 170 190 171 191 setSize( widthIn, heightIn ); 172 192 173 if ( mWebBrowser)193 if ( mWebBrowser ) 174 194 { 175 195 *aBrowser = mWebBrowser; 176 NS_ADDREF(*aBrowser); 196 NS_ADDREF( *aBrowser ); 197 177 198 return NS_OK; 178 199 }; … … 195 216 NS_INTERFACE_MAP_ENTRY( nsIURIContentListener ) 196 217 NS_INTERFACE_MAP_ENTRY( nsISupportsWeakReference ) 218 NS_INTERFACE_MAP_ENTRY( nsIToolkitObserver ) 197 219 NS_INTERFACE_MAP_END 198 220 … … 220 242 mStatusText = std::string( NS_ConvertUTF16toUTF8( aStatus ).get() ); 221 243 222 LLEmbeddedBrowserWindowEvent event( getWindowId(), mStatusText );244 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), mStatusText ); 223 245 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onStatusTextChange, event ); 224 246 … … 317 339 mPercentComplete = 100; 318 340 319 LLEmbeddedBrowserWindowEvent event( getWindowId(), mPercentComplete );341 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), mPercentComplete ); 320 342 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onUpdateProgress, event ); 321 343 … … 330 352 if ( ( progressStateFlags & STATE_START ) && ( progressStateFlags & STATE_IS_DOCUMENT ) && ( status == NS_OK ) ) 331 353 { 354 // TODO: move this to a better place. 355 enableToolkitObserver( false ); 356 enableToolkitObserver( true ); 357 332 358 // page load is starting so remove listener that catches "click" events 333 359 nsCOMPtr< nsIDOMWindow > window; … … 340 366 }; 341 367 368 // set the listener to we can catch nsURIContentListener events 369 if ( mWebBrowser ) 370 { 371 mWebBrowser->SetParentURIContentListener( NS_STATIC_CAST( nsIURIContentListener*, this ) ); 372 }; 373 342 374 // emit event that navigation is beginning 343 375 mStatusText = std::string( "Browser loaded" ); 344 LLEmbeddedBrowserWindowEvent event( getWindowId() );376 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), mStatusText ); 345 377 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onNavigateBegin, event ); 378 379 // about to move to a different page so have to stop grabbing a page 380 // but done one final grab in case the app doesn't ever call grabWindow again 381 grabWindow( 0, 0, mBrowserWidth, mBrowserHeight ); 346 382 }; 347 383 … … 358 394 }; 359 395 396 // pick up raw HTML response status code 397 PRUint32 responseStatus = 0; 398 if ( request ) 399 { 400 nsCOMPtr< nsIHttpChannel > httpChannel = do_QueryInterface( request ); 401 if ( httpChannel ) 402 { 403 httpChannel->GetResponseStatus( &responseStatus ); 404 }; 405 }; 406 360 407 // emit event that navigation is finished 361 408 mStatusText = std::string( "Done" ); 362 LLEmbeddedBrowserWindowEvent event( getWindowId() );409 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), mStatusText, (int)responseStatus ); 363 410 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onNavigateComplete, event ); 411 412 // also set the flag here since back/forward navigation doesn't call progress change 413 grabWindow( 0, 0, mBrowserWidth, mBrowserHeight ); 364 414 }; 365 415 … … 379 429 }; 380 430 381 LLEmbeddedBrowserWindowEvent event( getWindowId(), mStatusText );431 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), mStatusText ); 382 432 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onStatusTextChange, event ); 383 433 … … 389 439 // TODO: ought to check that this change is on the top frame and 390 440 // indicate this to the consumer of this class 391 NS_IMETHODIMP LLEmbeddedBrowserWindow::OnLocationChange( nsIWebProgress* progress,392 nsIRequest* request,393 nsIURI* location )441 NS_IMETHODIMP LLEmbeddedBrowserWindow::OnLocationChange( nsIWebProgress* webProgress, 442 nsIRequest* request, 443 nsIURI* location ) 394 444 { 395 445 if ( request ) … … 422 472 mCurrentUri = newURI.get(); 423 473 424 LLEmbeddedBrowserWindowEvent event( getWindowId(), mCurrentUri);474 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri() ); 425 475 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onLocationChange, event ); 426 476 427 477 return NS_OK; 478 } 479 480 //////////////////////////////////////////////////////////////////////////////// 481 // change the background color that gets used between pages (usually white) 482 void LLEmbeddedBrowserWindow::setBackgroundColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ) 483 { 484 mBkgRed = redIn; 485 mBkgGreen = greenIn; 486 mBkgBlue = blueIn; 487 } 488 489 //////////////////////////////////////////////////////////////////////////////// 490 // change the caret color (we have different backgrounds to edit fields - black caret on black background == bad) 491 void LLEmbeddedBrowserWindow::setCaretColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ) 492 { 493 mCaretRed = redIn; 494 mCaretGreen = greenIn; 495 mCaretBlue = blueIn; 496 } 497 498 //////////////////////////////////////////////////////////////////////////////// 499 // 500 void LLEmbeddedBrowserWindow::setEnabled( PRBool enabledIn ) 501 { 502 mEnabled = enabledIn; 428 503 } 429 504 … … 468 543 { 469 544 return mClickHref; 545 } 546 547 //////////////////////////////////////////////////////////////////////////////// 548 // utility method that is used by observers to retrieve data after an event 549 const std::string& LLEmbeddedBrowserWindow::getClickLinkTarget() 550 { 551 return mClickTarget; 470 552 } 471 553 … … 479 561 mStatusText = std::string( NS_ConvertUTF16toUTF8( aMessage ).get() ); 480 562 481 LLEmbeddedBrowserWindowEvent event( getWindowId(), mStatusText );563 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), mStatusText ); 482 564 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onStatusTextChange, event ); 483 565 … … 495 577 496 578 //////////////////////////////////////////////////////////////////////////////// 497 // 498 unsigned char* LLEmbeddedBrowserWindow::grabWindow() 499 { 579 // render a page into memory and grab the window 580 // TODO: 0,0, browser width, browser height is always passed in right now 581 // need to make this work with arbitrary rects (i.e. the dirty rect) 582 unsigned char* LLEmbeddedBrowserWindow::grabWindow( int xIn, int yIn, int widthIn, int heightIn ) 583 { 584 // sanity check 585 if ( ! mWebBrowser ) 586 return 0; 587 588 // only grab the window if it's enabled 589 if ( ! mEnabled ) 590 return false; 591 592 // get the docshell 500 593 nsCOMPtr< nsIDocShell > docShell = do_GetInterface( mWebBrowser ); 501 594 if ( ! docShell ) 502 595 return PR_FALSE; 503 596 597 // get pres context 504 598 nsCOMPtr< nsPresContext > presContext; 505 599 nsresult result = docShell->GetPresContext( getter_AddRefs( presContext ) ); … … 507 601 return PR_FALSE; 508 602 603 // get view manager 509 604 nsIViewManager* viewManager = presContext->GetViewManager(); 510 605 if ( ! viewManager ) 511 606 return PR_FALSE; 512 607 608 // get the view 513 609 nsIScrollableView* scrollableView = NULL; 514 610 viewManager->GetRootScrollableView( &scrollableView ); 515 516 611 nsIView* view = NULL; 517 612 if ( scrollableView ) … … 520 615 viewManager->GetRootView( view ); 521 616 617 // get the rectangle we want to render in twips (this looks odd but takees care of scrolling too) 522 618 nsRect rect = view->GetBounds() - view->GetPosition() - view->GetPosition(); 523 619 if ( rect.IsEmpty() ) … … 525 621 526 622 float p2t = presContext->PixelsToTwips(); 527 rect.width = NSIntPixelsToTwips( mBrowserWidth, p2t ); 528 rect.height = NSIntPixelsToTwips( mBrowserHeight, p2t ); 529 623 rect.width = NSIntPixelsToTwips( widthIn, p2t ); 624 rect.height = NSIntPixelsToTwips( heightIn, p2t ); 625 626 // render the page 530 627 nsCOMPtr< nsIRenderingContext > context; 531 result = viewManager->RenderOffscreen( view, rect, PR_FALSE, PR_FALSE, NS_RGB( mB ackgroundRed, mBackgroundGreen, mBackgroundBlue), getter_AddRefs( context ) );628 result = viewManager->RenderOffscreen( view, rect, PR_FALSE, PR_FALSE, NS_RGB( mBkgRed, mBkgGreen, mBkgBlue ), getter_AddRefs( context ) ); 532 629 if ( NS_FAILED( result ) ) 533 630 return 0; 534 631 632 // retrieve the surface we rendered to 535 633 nsIDrawingSurface* surface = nsnull; 536 634 context->GetDrawingSurface( &surface ); … … 538 636 return 0; 539 637 540 float t2p = presContext->TwipsToPixels(); 541 PRInt32 width = NSTwipsToIntPixels( rect.width, t2p ); 542 PRInt32 height = NSTwipsToIntPixels( rect.height, t2p ); 543 638 // lock the surface and retrieve a pointer to the rendered data and current row span 544 639 PRUint8* data; 545 640 PRInt32 rowLen; 546 547 641 // sometime rowspan ! width in pixels * bytes per pixel so save row span value and use in application 548 result = surface->Lock( 0, 0, width, height, reinterpret_cast< void** >( &data ), &mBrowserRowSpan, &rowLen, NS_LOCK_SURFACE_READ_ONLY );642 result = surface->Lock( xIn, yIn, widthIn, heightIn, reinterpret_cast< void** >( &data ), &mBrowserRowSpan, &rowLen, NS_LOCK_SURFACE_READ_ONLY ); 549 643 if ( NS_FAILED ( result ) ) 550 644 return 0; 551 645 552 PRUint32 bytesPerPix = rowLen / width; 553 nsPixelFormat format; 554 surface->GetPixelFormat( &format ); 555 mBrowserDepth = bytesPerPix; 556 size_t bufferSize = mBrowserRowSpan * mBrowserHeight; 557 558 if( (mPageBuffer) && ( mPageBufferSize < bufferSize ) ) 559 { 560 // the page buffer exists, but it's too small. Delete it so it'll be recreated. 561 delete[] mPageBuffer; 562 mPageBuffer = NULL; 563 mPageBufferSize = 0; 646 // save row span - it *can* change during the life of the app 647 mBrowserDepth = rowLen / mBrowserWidth; 648 649 // create memory buffer here so it can be deleted and recreated elsewhere 650 if ( ! mPageBuffer ) 651 mPageBuffer = new unsigned char[ mBrowserRowSpan * mBrowserHeight ]; 652 653 // save the pixels and optionally invert them 654 // (it's useful the SL client to get bitmaps that are inverted compared 655 // to the way that Mozilla renders them - allow to optionally flip 656 if ( mFlipBitmap ) 657 { 658 for( int y = mBrowserHeight - 1; y > -1; --y ) 659 { 660 memcpy( mPageBuffer + y * mBrowserRowSpan, 661 data + ( mBrowserHeight - y - 1 ) * mBrowserRowSpan, 662 mBrowserRowSpan ); 663 }; 564 664 } 565 566 // create it here so it can be deleted and recreated elsewhere 567 if ( ! mPageBuffer ) 568 { 569 mPageBufferSize = bufferSize; 570 mPageBuffer = new unsigned char[ mPageBufferSize ]; 571 } 572 573 memcpy( mPageBuffer, data, bufferSize ); 574 665 else 666 { 667 memcpy( mPageBuffer, data, mBrowserRowSpan * mBrowserHeight ); 668 }; 669 670 // release and destroy the surface we rendered to 575 671 surface->Unlock(); 576 672 context->DestroyDrawingSurface( surface ); … … 579 675 580 676 return mPageBuffer; 677 } 678 679 //////////////////////////////////////////////////////////////////////////////// 680 // all this just to render a caret! 681 PRBool LLEmbeddedBrowserWindow::renderCaret() 682 { 683 nsCOMPtr< nsIWebBrowserFocus > focus = do_QueryInterface( mWebBrowser ); 684 685 nsCOMPtr< nsIDOMElement > focusedElement; 686 focus->GetFocusedElement( getter_AddRefs( focusedElement ) ); 687 if ( ! focusedElement ) 688 return NS_ERROR_FAILURE; 689 690 nsCOMPtr<nsIContent> focusedContent = do_QueryInterface( focusedElement ); 691 692 nsCOMPtr< nsIDOMWindow > domWindow; 693 mWebBrowser->GetContentDOMWindow( getter_AddRefs( domWindow ) ); 694 if ( ! domWindow ) 695 return NS_ERROR_FAILURE; 696 697 nsCOMPtr< nsIDOMDocument > domDocument; 698 domWindow->GetDocument( getter_AddRefs( domDocument ) ); 699 if ( ! domDocument ) 700 return NS_ERROR_FAILURE; 701 702 nsCOMPtr< nsIDocument> document = do_QueryInterface( domDocument ); 703 if ( ! document ) 704 return NS_ERROR_FAILURE; 705 706 nsIPresShell* presShell = document->GetShellAt( 0 ); 707 if ( ! presShell ) 708 return NS_ERROR_FAILURE; 709 710 nsCOMPtr< nsICaret > caret; 711 presShell->GetCaret( getter_AddRefs( caret ) ); 712 713 nsIFrame* frame = nsnull; 714 presShell->GetPrimaryFrameFor( focusedContent, &frame ); 715 if ( ! frame ) 716 return NS_ERROR_FAILURE; 717 718 nsCOMPtr<nsISelectionController> selCtrl; 719 frame->GetSelectionController( presShell->GetPresContext(), getter_AddRefs( selCtrl ) ); 720 721 nsCOMPtr<nsISelection> selection; 722 selCtrl->GetSelection( nsISelectionController::SELECTION_NORMAL, getter_AddRefs( selection ) ); 723 724 PRBool collapsed; 725 nsRect coords; 726 nsIView* caretView; 727 caret->GetCaretCoordinates( nsICaret::eTopLevelWindowCoordinates, selection, &coords, &collapsed, &caretView ); 728 729 float twips2Pixls = presShell->GetPresContext()->TwipsToPixels(); 730 731 PRInt32 caretX = NSTwipsToIntPixels( coords.x, twips2Pixls ); 732 PRInt32 caretY = NSTwipsToIntPixels( coords.y, twips2Pixls ); 733 PRInt32 caretHeight = NSTwipsToIntPixels( coords.height, twips2Pixls ); 734 735 if ( caretX > -1 && caretX < mBrowserWidth && caretY > -1 && caretY < mBrowserHeight ) 736 { 737 if ( mPageBuffer ) 738 { 739 for( int y = 1; y < caretHeight - 1; ++y ) 740 { 741 PRInt32 base_pos = caretY + y; 742 if ( mFlipBitmap ) 743 base_pos = mBrowserHeight - ( caretY + y ); 744 745 // sometimes the caret seems valid when it really isn't - cap it to size of screen 746 if ( caretY + y + caretHeight < mBrowserHeight ) 747 { 748 mPageBuffer[ base_pos * getBrowserRowSpan() + ( caretX + 1 ) * mBrowserDepth + 0 ] = mCaretBlue; 749 mPageBuffer[ base_pos * getBrowserRowSpan() + ( caretX + 1 ) * mBrowserDepth + 1 ] = mCaretGreen; 750 mPageBuffer[ base_pos * getBrowserRowSpan() + ( caretX + 1 ) * mBrowserDepth + 2 ] = mCaretRed; 751 }; 752 }; 753 }; 754 }; 755 756 return NS_OK; 581 757 } 582 758 … … 637 813 { 638 814 if ( ! mWebNav ) 639 return PR_FALSE; 815 { 816 return PR_FALSE; 817 }; 640 818 641 819 PRBool canGoBack = PR_FALSE; … … 693 871 694 872 //////////////////////////////////////////////////////////////////////////////// 695 // 873 // set the size of the browser window 696 874 PRBool LLEmbeddedBrowserWindow::setSize( PRInt16 widthIn, PRInt16 heightIn ) 697 875 { 698 if ( widthIn > 2048 )699 widthIn = 2048;700 701 if ( heightIn > 2048 )702 heightIn = 2048;703 704 876 if ( mBaseWindow ) 705 877 { … … 708 880 { 709 881 delete[] mPageBuffer; 710 mPageBuffer = NULL; 711 mPageBufferSize = 0; 882 mPageBuffer = 0; 712 883 }; 713 884 714 // record new size 885 // record new size (important: may change after grabWindow() is called); 715 886 mBrowserWidth = widthIn; 716 887 mBrowserHeight = heightIn; 888 mBrowserRowSpan = mBrowserWidth * mBrowserDepth; 717 889 718 890 // On the Mac, these calls do strange things to the main viewer window, and they don't seem necessary in any case. 719 #if WIN32891 #ifdef WIN32 720 892 // this is the actual OS (on Win32) Window so it needs to be hidden 721 893 mBaseWindow->SetVisibility( PR_FALSE ); 722 894 723 // move off screen (and in a place that makes the combobox hack work895 // move WAY off screen (and in a place that makes the combobox hack work) 724 896 mBaseWindow->SetPosition( 8000, -6000 ); 725 #endif897 #endif 726 898 727 899 // tell Mozilla about the new size … … 735 907 736 908 //////////////////////////////////////////////////////////////////////////////// 737 // higher level mouse event 738 void LLEmbeddedBrowserWindow::mouseDown( PRInt16 xPosIn, PRInt16 yPosIn ) 739 { 740 const PRUint32 clickCount = 1; 741 sendMozillaMouseEvent( NS_MOUSE_LEFT_BUTTON_DOWN, xPosIn, yPosIn, clickCount ); 742 } 743 744 //////////////////////////////////////////////////////////////////////////////// 745 // higher level mouse event 746 void LLEmbeddedBrowserWindow::mouseUp( PRInt16 xPosIn, PRInt16 yPosIn ) 747 { 748 const PRUint32 clickCount = 1; 749 sendMozillaMouseEvent( NS_MOUSE_LEFT_BUTTON_UP, xPosIn, yPosIn, clickCount ); 750 } 751 752 //////////////////////////////////////////////////////////////////////////////// 753 // higher level mouse event 754 void LLEmbeddedBrowserWindow::mouseMove( PRInt16 xPosIn, PRInt16 yPosIn ) 755 { 756 const PRUint32 clickCount = 1; // ignored? 757 sendMozillaMouseEvent( NS_MOUSE_MOVE, xPosIn, yPosIn, clickCount ); 909 // 910 PRBool LLEmbeddedBrowserWindow::flipWindow( PRBool flip ) 911 { 912 mFlipBitmap = flip; 913 914 return true; 758 915 } 759 916 … … 769 926 770 927 //////////////////////////////////////////////////////////////////////////////// 928 // higher level mouse event 929 void LLEmbeddedBrowserWindow::mouseDown( PRInt16 xPosIn, PRInt16 yPosIn ) 930 { 931 const PRUint32 clickCount = 1; 932 sendMozillaMouseEvent( NS_MOUSE_LEFT_BUTTON_DOWN, xPosIn, yPosIn, clickCount ); 933 } 934 935 //////////////////////////////////////////////////////////////////////////////// 936 // higher level mouse event 937 void LLEmbeddedBrowserWindow::mouseUp( PRInt16 xPosIn, PRInt16 yPosIn ) 938 { 939 const PRUint32 clickCount = 1; 940 sendMozillaMouseEvent( NS_MOUSE_LEFT_BUTTON_UP, xPosIn, yPosIn, clickCount ); 941 } 942 943 //////////////////////////////////////////////////////////////////////////////// 944 // higher level mouse event 945 void LLEmbeddedBrowserWindow::mouseMove( PRInt16 xPosIn, PRInt16 yPosIn ) 946 { 947 const PRUint32 clickCount = 1; // ignored? 948 sendMozillaMouseEvent( NS_MOUSE_MOVE, xPosIn, yPosIn, clickCount ); 949 } 950 951 //////////////////////////////////////////////////////////////////////////////// 771 952 // utility methods to set an error message so something else can look at it 772 953 void LLEmbeddedBrowserWindow::scrollByLines( PRInt16 linesIn ) … … 786 967 //////////////////////////////////////////////////////////////////////////////// 787 968 // synthesizes a mouse event and sends into the embedded instance 788 //789 969 // eventIn - NS_MOUSE_LEFT_BUTTON_DOWN, NS_MOUSE_LEFT_BUTTON_UP, etc. 790 // xPosIn, yPosIn - coordinates (in browser window space ?)970 // xPosIn, yPosIn - coordinates (in browser window space) 791 971 // clickCountIn - use 1 for single click, 2 for double-click, etc. 792 972 PRBool LLEmbeddedBrowserWindow::sendMozillaMouseEvent( PRInt16 eventIn, PRInt16 xPosIn, PRInt16 yPosIn, PRUint32 clickCountIn ) 793 973 { 974 if ( ! mEnabled ) 975 return PR_FALSE; 976 977 if ( ! mWebBrowser ) 978 return PR_FALSE; 979 794 980 nsCOMPtr< nsIDocShell > docShell = do_GetInterface( mWebBrowser ); 795 981 if ( ! docShell ) … … 855 1041 PRBool LLEmbeddedBrowserWindow::sendMozillaKeyboardEvent( PRUint32 uni_char, PRUint32 ns_vk_code ) 856 1042 { 857 nsresult result = NS_OK; 1043 if ( ! mEnabled ) 1044 return PR_FALSE; 1045 1046 if ( ! mWebBrowser ) 1047 return PR_FALSE; 858 1048 859 1049 nsCOMPtr< nsIDocShell > docShell = do_GetInterface( mWebBrowser ); … … 896 1086 897 1087 nsEventStatus status; 898 result = viewManager->DispatchEvent( &keyEvent, &status );1088 nsresult result = viewManager->DispatchEvent( &keyEvent, &status ); 899 1089 if ( NS_FAILED( result ) ) 900 1090 return PR_FALSE; 901 1091 902 1092 return PR_TRUE; 903 }904 905 ////////////////////////////////////////////////////////////////////////////////906 // all this just to render a caret!907 PRBool LLEmbeddedBrowserWindow::renderCaret()908 {909 nsCOMPtr< nsIWebBrowserFocus > focus = do_QueryInterface( mWebBrowser );910 911 nsCOMPtr< nsIDOMElement > focusedElement;912 focus->GetFocusedElement( getter_AddRefs( focusedElement ) );913 if ( ! focusedElement )914 return NS_ERROR_FAILURE;915 916 nsCOMPtr<nsIContent> focusedContent = do_QueryInterface( focusedElement );917 918 nsCOMPtr< nsIDOMWindow > domWindow;919 mWebBrowser->GetContentDOMWindow( getter_AddRefs( domWindow ) );920 if ( ! domWindow )921 return NS_ERROR_FAILURE;922 923 nsCOMPtr< nsIDOMDocument > domDocument;924 domWindow->GetDocument( getter_AddRefs( domDocument ) );925 if ( ! domDocument )926 return NS_ERROR_FAILURE;927 928 nsCOMPtr< nsIDocument> document = do_QueryInterface( domDocument );929 if ( ! document )930 return NS_ERROR_FAILURE;931 932 nsIPresShell* presShell = document->GetShellAt( 0 );933 if ( ! presShell )934 return NS_ERROR_FAILURE;935 936 nsCOMPtr< nsICaret > caret;937 presShell->GetCaret( getter_AddRefs( caret ) );938 939 nsIFrame* frame = nsnull;940 presShell->GetPrimaryFrameFor( focusedContent, &frame );941 if ( ! frame )942 return NS_ERROR_FAILURE;943 944 nsCOMPtr<nsISelectionController> selCtrl;945 frame->GetSelectionController( presShell->GetPresContext(), getter_AddRefs( selCtrl ) );946 947 nsCOMPtr<nsISelection> selection;948 selCtrl->GetSelection( nsISelectionController::SELECTION_NORMAL, getter_AddRefs( selection ) );949 950 PRBool collapsed;951 nsRect coords;952 nsIView* caretView;953 caret->GetCaretCoordinates( nsICaret::eTopLevelWindowCoordinates, selection, &coords, &collapsed, &caretView );954 955 float twips2Pixls = presShell->GetPresContext()->TwipsToPixels();956 957 PRInt32 caretX = NSTwipsToIntPixels( coords.x, twips2Pixls );958 PRInt32 caretY = NSTwipsToIntPixels( coords.y, twips2Pixls );959 PRInt32 caretHeight = NSTwipsToIntPixels( coords.height, twips2Pixls );960 961 if ( caretX > -1 && caretX < mBrowserWidth && caretY > -1 && caretY < mBrowserHeight )962 {963 if ( mPageBuffer )964 {965 for( int y = 1; y < caretHeight - 1; ++y )966 {967 // sometimes the caret seems valid when it really isn't - cap it to size of screen968 if ( caretY + y + caretHeight < mBrowserHeight )969 {970 mPageBuffer[ ( caretY + y ) * getBrowserRowSpan() + ( caretX + 1 ) * mBrowserDepth + 0 ] = mCaretBlue;971 mPageBuffer[ ( caretY + y ) * getBrowserRowSpan() + ( caretX + 1 ) * mBrowserDepth + 1 ] = mCaretGreen;972 mPageBuffer[ ( caretY + y ) * getBrowserRowSpan() + ( caretX + 1 ) * mBrowserDepth + 2 ] = mCaretRed;973 };974 };975 };976 };977 978 return NS_OK;979 }980 981 ////////////////////////////////////////////////////////////////////////////////982 //983 void LLEmbeddedBrowserWindow::setBackgroundColor( PRUint8 redIn, PRUint8 greenIn, PRUint8 blueIn )984 {985 mBackgroundRed = redIn;986 mBackgroundGreen = greenIn;987 mBackgroundBlue = blueIn;988 }989 990 ////////////////////////////////////////////////////////////////////////////////991 // change the caret color (we have different backgrounds to edit fields - black caret on black background == bad)992 void LLEmbeddedBrowserWindow::setCaretColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn )993 {994 mCaretRed = redIn;995 mCaretGreen = greenIn;996 mCaretBlue = blueIn;997 1093 } 998 1094 … … 1007 1103 if ( linkElement ) 1008 1104 { 1105 // look for an href link 1009 1106 nsString name; 1010 1107 linkElement->GetAttribute( NS_ConvertUTF8toUTF16( "href" ), name ); 1011 1108 mClickHref = std::string( NS_ConvertUTF16toUTF8( name ).get() ); 1012 1109 1013 LLEmbeddedBrowserWindowEvent event( getWindowId(), mClickHref ); 1014 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onClickLinkHref, event ); 1110 // look for a target element 1111 linkElement->GetAttribute( NS_ConvertUTF8toUTF16( "target" ), name ); 1112 mClickTarget = std::string( NS_ConvertUTF16toUTF8( name ).get() ); 1113 1114 // if the href link contains something 1115 if ( mClickHref.length() ) 1116 { 1117 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), mClickHref, mClickTarget ); 1118 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onClickLinkHref, event ); 1119 }; 1015 1120 }; 1016 1121 … … 1026 1131 std::string rawUri = newURI.get(); 1027 1132 1028 if ( rawUri.substr( 0, std::string( "secondlife://" ).length() ) == "secondlife://" ) 1029 { 1030 LLEmbeddedBrowserWindowEvent event( getWindowId(), rawUri ); 1031 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onClickLinkSecondLife, event ); 1133 // are we navigating to a 'nofollow' link 1134 if ( mNoFollowScheme.length() && rawUri.substr( 0, mNoFollowScheme.length() ) == mNoFollowScheme ) 1135 { 1136 LLEmbeddedBrowserWindowEvent event( getWindowId(), rawUri, rawUri ); 1137 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onClickLinkNoFollow, event ); 1032 1138 1033 1139 // tell browser we're handling things and don't follow link … … 1041 1147 1042 1148 return NS_OK; 1149 } 1150 1151 //////////////////////////////////////////////////////////////////////////////// 1152 // 1153 void LLEmbeddedBrowserWindow::setNoFollowScheme( std::string schemeIn ) 1154 { 1155 mNoFollowScheme = schemeIn; 1156 } 1157 1158 //////////////////////////////////////////////////////////////////////////////// 1159 // 1160 std::string LLEmbeddedBrowserWindow::getNoFollowScheme() 1161 { 1162 return mNoFollowScheme; 1043 1163 } 1044 1164 … … 1107 1227 void LLEmbeddedBrowserWindow::focusBrowser( PRBool focusBrowserIn ) 1108 1228 { 1109 if ( focusBrowserIn ) 1110 { 1111 nsCOMPtr< nsIWebBrowserFocus > focus( do_GetInterface( mWebBrowser ) ); 1112 focus->Activate(); 1229 if ( mWebBrowser ) 1230 { 1231 if ( focusBrowserIn ) 1232 { 1233 nsCOMPtr< nsIWebBrowserFocus > focus( do_GetInterface( mWebBrowser ) ); 1234 focus->Activate(); 1235 } 1236 else 1237 { 1238 nsCOMPtr< nsIWebBrowserFocus > focus( do_GetInterface( mWebBrowser ) ); 1239 focus->Deactivate(); 1240 }; 1241 }; 1242 } 1243 1244 //////////////////////////////////////////////////////////////////////////////// 1245 // 1246 void LLEmbeddedBrowserWindow::setWindowId( int windowIdIn ) 1247 { 1248 mWindowId = windowIdIn; 1249 } 1250 1251 //////////////////////////////////////////////////////////////////////////////// 1252 // 1253 int LLEmbeddedBrowserWindow::getWindowId() 1254 { 1255 //printf("## Getting id for %p and it is %d\n", this, mWindowId ); 1256 1257 return mWindowId; 1258 } 1259 1260 //////////////////////////////////////////////////////////////////////////////// 1261 // add / remove the toolkit (and therefore 'page changed') observer 1262 PRBool LLEmbeddedBrowserWindow::enableToolkitObserver( PRBool enableIn ) 1263 { 1264 //TODO: AddObserver fails if I grab the toolkit this way. 1265 //static NS_DEFINE_CID(kNS_TOOLKIT_CID, NS_TOOLKIT_CID); 1266 //nsresult result1; 1267 //nsCOMPtr< nsIToolkit > toolkit = do_GetService( kNS_TOOLKIT_CID, &result1 ); 1268 //if ( ( result1 == NS_OK ) && toolkit ) 1269 //{ 1270 // if ( toolkit->AddObserver( this ) ) 1271 // { 1272 // return true; 1273 // }; 1274 //}; 1275 //return false; 1276 1277 // TODO: this is horrible but seems to work - need a better way to get the toolkit 1278 nsCOMPtr< nsIDocShell > docShell = do_GetInterface( mWebBrowser ); 1279 if ( ! docShell ) 1280 return false; 1281 1282 nsCOMPtr< nsPresContext > presContext; 1283 nsresult result = docShell->GetPresContext( getter_AddRefs( presContext ) ); 1284 if ( NS_FAILED( result ) || ( ! presContext ) ) 1285 return false; 1286 1287 nsIViewManager* viewManager = presContext->GetViewManager(); 1288 if ( ! viewManager ) 1289 return false; 1290 1291 nsIView* rootView; 1292 result = viewManager->GetRootView( rootView ); 1293 if ( NS_FAILED( result ) || ( ! rootView ) ) 1294 return false; 1295 1296 nsCOMPtr< nsIWidget > widget = rootView->GetWidget(); 1297 if ( ! widget ) 1298 return false; 1299 1300 nsCOMPtr< nsIToolkit > mToolkit = widget->GetToolkit(); 1301 if ( ! mToolkit ) 1302 return false; 1303 1304 if ( enableIn ) 1305 mToolkit->AddObserver( this ); 1306 else 1307 mToolkit->RemoveObserver( this ); 1308 1309 return true; 1310 } 1311 1312 //////////////////////////////////////////////////////////////////////////////// 1313 // something on the page changed - e.g. a new page loaded, scrolling, user 1314 // input or as the result of some kind of animation. 1315 // NOTE: we don't call grabWindow here as this can stall graphics apps - 1316 // we merely pass back an event to the app and let it decide when/if 1317 // to call grabWindow() 1318 NS_METHOD LLEmbeddedBrowserWindow::NotifyInvalidated( nsIWidget *aWidget, PRInt32 x, PRInt32 y, PRInt32 width, PRInt32 height ) 1319 { 1320 // printf("LLEmbeddedBrowserWindow::NotifyInvalidated(%p, %d, %d, %d, %d)\n", (void*)aWidget, (int)x, (int)y, (int)width, (int)height); 1321 1322 // try to match widget-window against ourselves to see if we need to update the texture 1323 // only works using native widgets (on Windows) at the moment - needs to be moved to platform agnostic code ASAP 1324 #ifdef WIN32 1325 1326 // this is horrible beyond words but it seems to work... 1327 // nsToolkit tells us that a widget changed and we need to see if it's this instance 1328 // so we can emit an event that causes the parent app to update the browser texture 1329 nsIWidget* mainWidget; 1330 mBaseWindow->GetMainWidget( &mainWidget ); 1331 1332 HWND nativeWidget = (HWND)aWidget->GetNativeData( NS_NATIVE_WIDGET ); 1333 HWND nativeWidgetChild; 1334 while ( ::GetParent( nativeWidget ) ) 1335 { 1336 nativeWidgetChild = nativeWidget; 1337 nativeWidget = ::GetParent( nativeWidget ); 1338 }; 1339 1340 if ( ( (HWND)mainWidget->GetNativeData( NS_NATIVE_WIDGET ) ) == nativeWidgetChild ) 1341 { 1342 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), x, y, width, height ); 1343 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onPageChanged, event ); 1344 }; 1345 1346 // other platforms will always update - desperately inefficient but you'll see something. 1347 #else 1348 LLEmbeddedBrowserWindowEvent event( getWindowId(), getCurrentUri(), x, y, width, height ); 1349 mEventEmitter.update( &LLEmbeddedBrowserWindowObserver::onPageChanged, event ); 1350 #endif 1351 1352 return NS_OK; 1353 } 1354 1355 //////////////////////////////////////////////////////////////////////////////// 1356 // 1357 std::string LLEmbeddedBrowserWindow::evaluateJavascript( std::string scriptIn ) 1358 { 1359 nsCOMPtr< nsIScriptGlobalObjectOwner > theGlobalObjectOwner( do_GetInterface( mWebBrowser ) ); 1360 1361 if ( theGlobalObjectOwner ) 1362 { 1363 nsIScriptGlobalObject* theGlobalObject; 1364 theGlobalObject = theGlobalObjectOwner->GetScriptGlobalObject(); 1365 1366 nsIScriptContext* theScriptContext = theGlobalObject->GetContext(); 1367 1368 PRBool IsUndefined; 1369 nsString output; 1370 nsresult result = theScriptContext->EvaluateString(NS_ConvertUTF8toUTF16(scriptIn.c_str()), 1371 nsnull, nsnull, "", 1, nsnull, &output, &IsUndefined); 1372 1373 if( NS_FAILED( result ) ) 1374 return ""; 1375 1376 return std::string( NS_ConvertUTF16toUTF8( output ).get() ); 1113 1377 } 1114 else 1115 { 1116 nsCOMPtr< nsIWebBrowserFocus > focus( do_GetInterface( mWebBrowser ) ); 1117 focus->Deactivate(); 1118 }; 1119 } 1120 1121 //////////////////////////////////////////////////////////////////////////////// 1122 // 1123 void LLEmbeddedBrowserWindow::setWindowId( int windowIdIn ) 1124 { 1125 mWindowId = windowIdIn; 1126 } 1127 1128 //////////////////////////////////////////////////////////////////////////////// 1129 // 1130 int LLEmbeddedBrowserWindow::getWindowId() 1131 { 1132 return mWindowId; 1378 1379 return ""; 1133 1380 } 1134 1381 trunk/llmozlib2/llembeddedbrowserwindow.h
r3 r8 1 /** 2 * @file llembeddedbrowserwindow.h 3 * @brief LLEmbeddedBrowserWindow and associated helpers declaration. 4 * 5 * $LicenseInfo:firstyear=2006&license=viewergpl$ 6 * 7 * Copyright (c) 2006-2007, Linden Research, Inc. 8 * 9 * Second Life Viewer Source Code 10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * to you under the terms of the GNU General Public License, version 2.0 12 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * online at http://secondlife.com/developers/opensource/gplv2 16 * 17 * There are special exceptions to the terms and conditions of the GPL as 18 * it is applied to this Source Code. View the full text of the exception 19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * online at http://secondlife.com/developers/opensource/flossexception 21 * 22 * By copying, modifying or distributing this software, you acknowledge 23 * that you have read and understood your obligations described above, 24 * and agree to abide by those obligations. 25 * 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 28 * COMPLETENESS OR PERFORMANCE. 29 * $/LicenseInfo$ 30 */ 1 /* ***** BEGIN LICENSE BLOCK ***** 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * 4 * The contents of this file are subject to the Mozilla Public License Version 5 * 1.1 (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * http://www.mozilla.org/MPL/ 8 * 9 * Software distributed under the License is distributed on an "AS IS" basis, 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 * for the specific language governing rights and limitations under the 12 * License. 13 * 14 * The Original Code is Linden Lab Inc. (http://lindenlab.com) code. 15 * 16 * The Initial Developer of the Original Code is: 17 * Callum Prentice (callum@ubrowser.com) 18 * 19 * Portions created by the Initial Developer are Copyright (C) 2006 20 * the Initial Developer. All Rights Reserved. 21 * 22 * Contributor(s): 23 * Callum Prentice (callum@ubrowser.com) 24 * 25 * Alternatively, the contents of this file may be used under the terms of 26 * either the GNU General Public License Version 2 or later (the "GPL"), or 27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 28 * in which case the provisions of the GPL or the LGPL are applicable instead 29 * of those above. If you wish to allow use of your version of this file only 30 * under the terms of either the GPL or the LGPL, and not to allow others to 31 * use your version of this file under the terms of the MPL, indicate your 32 * decision by deleting the provisions above and replace them with the notice 33 * and other provisions required by the GPL or the LGPL. If you do not delete 34 * the provisions above, a recipient may use your version of this file under 35 * the terms of any one of the MPL, the GPL or the LGPL. 36 * 37 * ***** END LICENSE BLOCK ***** */ 31 38 32 39 #ifndef LLEMBEDDEDBROWSERWINDOW_H … … 48 55 #include "nsWeakReference.h" 49 56 #include "nsIWebBrowser.h" 57 #include "nsIToolkit.h" 58 #include "nsIScriptGlobalObject.h" 59 #include "nsIScriptGlobalObjectOwner.h" 60 #include "nsIScriptContext.h" 61 62 #ifdef WIN32 63 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" 64 #endif 50 65 51 66 #include <string> … … 53 68 #include <algorithm> 54 69 55 #include "llmozlib .h"70 #include "llmozlib2.h" 56 71 57 72 /////////////////////////////////////////////////////////////////////////////// 58 // manages the process of s otring and emitting events that the consumer73 // manages the process of storing and emitting events that the consumer 59 74 // of the embedding class can observe 60 75 template< class T > … … 124 139 public nsIURIContentListener, 125 140 public nsSupportsWeakReference, 126 public nsIDOMEventListener 141 public nsIDOMEventListener, 142 public nsIToolkitObserver 127 143 { 128 144 public: … … 136 152 NS_DECL_NSIURICONTENTLISTENER 137 153 NS_DECL_NSIDOMEVENTLISTENER 138 154 NS_DECL_NSITOOLKITOBSERVER 155 156 // housekeeping 139 157 nsresult createBrowser( void* nativeWindowHandleIn, PRInt32 widthIn, PRInt32 heightIn, nsIWebBrowser** aBrowser ); 158 void setParent( LLEmbeddedBrowser* parentIn ) { mParent = parentIn; }; 140 159 PRBool setSize( PRInt16 widthIn, PRInt16 heightIn ); 141 160 void focusBrowser( PRBool focusBrowserIn ); … … 144 163 int getWindowId(); 145 164 165 // random accessors 146 166 const PRInt16 getPercentComplete(); 147 167 const std::string& getStatusMsg(); 148 168 const std::string& getCurrentUri(); 149 169 const std::string& getClickLinkHref(); 150 151 unsigned char* grabWindow(); 170 const std::string& getClickLinkTarget(); 171 172 // memory buffer management 173 unsigned char* grabWindow( int xIn, int yIn, int widthIn, int heightIn ); 174 PRBool flipWindow( PRBool flip ); 152 175 unsigned char* getPageBuffer(); 153 176 PRInt16 getBrowserWidth(); … … 156 179 PRInt32 getBrowserRowSpan(); 157 180 158 void setBackgroundColor( PRUint8 redIn, PRUint8 greenIn, PRUint8 blueIn ); 181 // set background color that you see in between pages - default is white but sometimes useful to change 182 void setBackgroundColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ); 183 184 // change the caret color (we have different backgrounds to edit fields - black caret on black background == bad) 159 185 void setCaretColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ); 160 186 187 // can turn off updates to a page - e.g. when it's hidden by your windowing system 188 void setEnabled( PRBool enabledIn ); 189 190 // navigation 161 191 void navigateStop(); 162 192 PRBool navigateTo( const std::string uriIn ); … … 166 196 void navigateForward(); 167 197 198 // javascript access/control 199 std::string evaluateJavascript( std::string scriptIn ); 200 201 // redirection when you hit a missing page 168 202 bool set404RedirectUrl( std::string redirect_url ); 169 203 bool clr404RedirectUrl(); 170 204 205 // mouse & keyboard events 171 206 void mouseDown( PRInt16 xPosIn, PRInt16 yPosIn ); 172 207 void mouseUp( PRInt16 xPosIn, PRInt16 yPosIn ); … … 176 211 void unicodeInput( PRUint32 uni_char ); 177 212 213 // allow consumers of this class and to observe browser events 178 214 bool addObserver( LLEmbeddedBrowserWindowObserver* observerIn ); 179 215 bool remObserver( LLEmbeddedBrowserWindowObserver* observerIn ); 216 217 // accessor/mutator for scheme that browser doesn't follow - e.g. secondlife.com:// 218 void setNoFollowScheme( std::string schemeIn ); 219 std::string getNoFollowScheme(); 180 220 181 221 private: … … 183 223 PRBool sendMozillaKeyboardEvent( PRUint32 keyIn, PRUint32 ns_vk_code ); 184 224 PRBool renderCaret(); 225 PRBool enableToolkitObserver( PRBool enableIn ); 226 185 227 LLEmbeddedBrowserWindowEmitter< LLEmbeddedBrowserWindowObserver > mEventEmitter; 228 229 LLEmbeddedBrowser* mParent; 186 230 PRInt16 mPercentComplete; 187 231 std::string mStatusText; 188 232 std::string mCurrentUri; 189 233 std::string mClickHref; 190 std::string m 404RedirectUrl;191 234 std::string mClickTarget; 235 std::string mNoFollowScheme; 192 236 nsCOMPtr< nsIWebBrowser > mWebBrowser; 193 237 nsCOMPtr< nsIBaseWindow > mBaseWindow; 194 238 nsCOMPtr< nsIWebNavigation > mWebNav; 195 196 239 int mWindowId; 197 198 PRUint8 mBackgroundRed;199 PRUint8 mBackgroundGreen;200 PRUint8 mBackgroundBlue;201 PRUint8 mCaretRed;202 PRUint8 mCaretGreen;203 PRUint8 mCaretBlue;204 205 240 unsigned char* mPageBuffer; 206 size_t mPageBufferSize; 241 std::string m404RedirectUrl; 242 PRBool mEnabled; 243 PRBool mFlipBitmap; 207 244 PRInt32 mBrowserRowSpan; 208 245 PRInt16 mBrowserWidth; 209 246 PRInt16 mBrowserHeight; 210 247 PRInt16 mBrowserDepth; 248 PRUint8 mBkgRed; 249 PRUint8 mBkgGreen; 250 PRUint8 mBkgBlue; 251 PRUint8 mCaretRed; 252 PRUint8 mCaretGreen; 253 PRUint8 mCaretBlue; 211 254 }; 212 255 213 #ifdef WIN32214 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"215 #endif216 217 256 #endif // LLEMBEDEDDBROWSERWINDOW_H trunk/llmozlib2/repackage_runtime_mac.sh
r1 r8 1 1 #!/bin/bash 2 2 3 # This script adds or updates libllmozlib .dylib in mozilla-universal-darwin.tgz.3 # This script adds or updates libllmozlib2.dylib in mozilla-universal-darwin.tgz. 4 4 sandbox_location="$1" 5 5 6 xcodebuild -project llmozlib2.xcodeproj -target llmozlib2 -configuration 'Release' build 6 7 7 if [ -f build/Release/libllmozlib .dylib ]; then8 echo "libllmozlib .dylib found"8 if [ -f build/Release/libllmozlib2.dylib ]; then 9 echo "libllmozlib2.dylib found" 9 10 else 10 echo "libllmozlib .dylib not found, please build the Release target in llmozlib.xcodeproj"11 echo "libllmozlib2.dylib not found, please build the Release target in llmozlib.xcodeproj" 11 12 exit 1 12 13 fi … … 30 31 (cd mozilla-universal-darwin && tar -zxf ../mozilla-universal-darwin-original.tgz) 31 32 32 echo "Adding libllmozlib .dylib..."33 echo "Adding libllmozlib2.dylib..." 33 34 34 # copy in the latest built version of llmozlib 35 cp ./build/Release/libllmozlib .dylib mozilla-universal-darwin35 # copy in the latest built version of llmozlib2 36 cp ./build/Release/libllmozlib2.dylib mozilla-universal-darwin 36 37 37 38 echo "Removing unneeded pieces..." … … 48 49 echo "Creating mozilla-universal-darwin.tgz..." 49 50 50 # tar up the runtime and llmozlib 51 # tar up the runtime and llmozlib2 51 52 rm -f ./mozilla-universal-darwin.tgz 52 53 tar -zcf ./mozilla-universal-darwin.tgz \ … … 62 63 63 64 echo "Copying stub library to $sandbox_location/libraries/universal-darwin/..." 64 cp build/Release_stub/libllmozlib .dylib $sandbox_location/libraries/universal-darwin/lib_debug/libllmozlib.dylib65 cp build/Release_stub/libllmozlib .dylib $sandbox_location/libraries/universal-darwin/lib_release/libllmozlib.dylib65 cp build/Release_stub/libllmozlib2.dylib $sandbox_location/libraries/universal-darwin/lib_debug/libllmozlib2.dylib 66 cp build/Release_stub/libllmozlib2.dylib $sandbox_location/libraries/universal-darwin/lib_release/libllmozlib2.dylib 66 67 67 68 echo "done!" trunk/llmozlib2/tests/dependencies/include/GL/glut.h
r1 r8 11 11 12 12 /* GLUT 3.7 now tries to avoid including <windows.h> 13 to avoid name space pollution, but Win32's <GL/gl.h> 13 to avoid name space pollution, but Win32's <GL/gl.h> 14 14 needs APIENTRY and WINGDIAPI defined properly. */ 15 15 # if 0 … … 162 162 /** 163 163 GLUT API revision history: 164 164 165 165 GLUT_API_VERSION is updated to reflect incompatible GLUT 166 166 API changes (interface changes, semantic changes, deletions, 167 167 or additions). 168 168 169 169 GLUT_API_VERSION=1 First public release of GLUT. 11/29/94 170 170 … … 187 187 /** 188 188 GLUT implementation revision history: 189 189 190 190 GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT 191 191 API revisions and implementation revisions (ie, bug fixes). … … 195 195 196 196 GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of 197 GLUT Xlib-based implementation providing GLUT version 2 197 GLUT Xlib-based implementation providing GLUT version 2 198 198 interfaces. 199 199
