offscreengecko-commits Mailing List for Offscreen Gecko
Status: Pre-Alpha
Brought to you by:
res2002
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(31) |
Dec
(31) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(9) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(22) |
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <re...@us...> - 2012-01-16 07:15:41
|
Revision: 110
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=110&view=rev
Author: res2002
Date: 2012-01-16 07:15:32 +0000 (Mon, 16 Jan 2012)
Log Message:
-----------
Bump xulrunner version
Modified Paths:
--------------
trunk/sdk/win32/README.txt
Modified: trunk/sdk/win32/README.txt
===================================================================
--- trunk/sdk/win32/README.txt 2010-09-02 23:22:11 UTC (rev 109)
+++ trunk/sdk/win32/README.txt 2012-01-16 07:15:32 UTC (rev 110)
@@ -1,8 +1,8 @@
NOTES ON USING OFFSCREENGECKO SDK
The contained binary of OffscreenGecko was build against the XULrunner
-1.9b4pre nightly from 2008-02-26. You can get binaries and SDKs from
-http://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/2008-02-26-09-trunk/.
+1.9.1.19. You can get binaries and SDKs from
+http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/1.9.1.19/sdk/xulrunner-1.9.1.19.en-US.win32.sdk.zip.
It may or may not work with later nightlies.
You will either have to give the directory with the XULrunner binaries as
an additional path to search for XULrunner to OffscreenGecko (see API docs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2010-09-02 23:22:17
|
Revision: 109
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=109&view=rev
Author: res2002
Date: 2010-09-02 23:22:11 +0000 (Thu, 02 Sep 2010)
Log Message:
-----------
Add demo in pure C
Modified Paths:
--------------
trunk/src/demos/CMakeLists.txt
trunk/src/demos/doxygen_samples
Added Paths:
-----------
trunk/src/demos/webpage2image.c
Modified: trunk/src/demos/CMakeLists.txt
===================================================================
--- trunk/src/demos/CMakeLists.txt 2010-09-02 23:21:15 UTC (rev 108)
+++ trunk/src/demos/CMakeLists.txt 2010-09-02 23:22:11 UTC (rev 109)
@@ -1,8 +1,11 @@
include_directories(../../include)
-add_executable(webpage2image webpage2image.cpp)
+
IF(CMAKE_COMPILER_IS_GNUCXX)
- target_link_libraries(webpage2image "-Wl,--warn-unresolved-symbols -Wl,--as-needed")
+ set(DEMO_FLAGS "-Wl,--warn-unresolved-symbols -Wl,--as-needed")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-target_link_libraries(webpage2image OffscreenGecko)
-target_link_libraries(webpage2image osgk-common)
+add_executable(webpage2image webpage2image.cpp)
+target_link_libraries(webpage2image ${DEMO_FLAGS} OffscreenGecko osgk-common)
+
+add_executable(webpage2image_c webpage2image.c)
+target_link_libraries(webpage2image_c ${DEMO_FLAGS} OffscreenGecko)
Modified: trunk/src/demos/doxygen_samples
===================================================================
--- trunk/src/demos/doxygen_samples 2010-09-02 23:21:15 UTC (rev 108)
+++ trunk/src/demos/doxygen_samples 2010-09-02 23:22:11 UTC (rev 109)
@@ -27,4 +27,6 @@
* (OSGK::TGAWriter is an OffscreenGecko-internal class; but the image
* writing is not the point of the example anyway.)
* \include webpage2image.cpp
+ * Same functionality, but written in pure C:
+ * \include webpage2image.c
*/
\ No newline at end of file
Added: trunk/src/demos/webpage2image.c
===================================================================
--- trunk/src/demos/webpage2image.c (rev 0)
+++ trunk/src/demos/webpage2image.c 2010-09-02 23:22:11 UTC (rev 109)
@@ -0,0 +1,149 @@
+/*
+
+Copyright (c) 2008-2010, Frank Richter <fra...@gm...>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * The name of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stdio.h>
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#define usleep(x) Sleep(x)
+#else
+#include <unistd.h> // for usleep()
+#endif
+
+#include <OffscreenGecko/browser.h>
+
+// TGA writing code, translated from tgawrite.cpp
+static void tga_WriteByte (unsigned char c, FILE* out)
+{ fwrite ((const char*)&c, 1, 1, out); }
+
+static void tga_WriteWord (unsigned short s, FILE* out)
+{
+ // @@@ TODO: Support big endian machines
+ fwrite ((const char*)&s, 2, 1, out);
+}
+static void tga_WriteBGRAImage (int width, int height, const void* data, FILE* out)
+{
+ // TGA Header
+ tga_WriteByte (0, out); // ID length
+ tga_WriteByte (0, out); // Color map type
+ tga_WriteByte (2, out); // Image type - TrueColor
+ tga_WriteWord (0, out); // Color map stuff
+ tga_WriteWord (0, out);
+ tga_WriteByte (0, out);
+ tga_WriteWord (0, out); // X/Y offset
+ tga_WriteWord (0, out);
+ tga_WriteWord (width, out);
+ tga_WriteWord (height, out);
+ tga_WriteByte (32, out); // Image depth
+ tga_WriteByte (1 | 32, out); // 1 attribute; origin top left
+
+ fwrite ((const char*)data, 1, width * height * 4, out);
+}
+
+int main (int argc, const char* const argv[])
+{
+ const char* uri;
+ const char* outputFilename;
+ // Rendering dimensions
+ int renderW = 1024, renderH = 1024;
+ int returnCode = 0;
+ OSGK_GeckoResult embedInitResult;
+ OSGK_Embedding* embedding;
+ OSGK_Browser* browser;
+ FILE* tgafile;
+ const unsigned char* lockedData;
+
+ if (argc != 3)
+ {
+ fputs ("expecting parameters: <URI to render> <output TGA file name>\n", stderr);
+ return 1;
+ }
+
+ uri = argv[1];
+ outputFilename = argv[2];
+
+ // To use OSGK we first need an embedding object.
+ embedding = osgk_embedding_create (&embedInitResult);
+ if (!embedding)
+ {
+ // This means something went wrong
+ fprintf (stderr, "Error initializing OSGK embedding (%.8x)\n", embedInitResult);
+ return 1;
+ }
+
+ // The browser object is the main workhorse for web page rendering.
+ browser = osgk_browser_create (embedding, renderW, renderH);
+ if (!browser)
+ {
+ fputs ("Error creating OSGK browser\n", stderr);
+ returnCode = 1;
+ goto cleanupEmbedding;
+ }
+
+ // Instruct browser to navigate to the given URI
+ osgk_browser_navigate (browser, uri);
+
+ // Wait until the URI finished loading
+ while (osgk_browser_query_load_state (browser) != loadFinished)
+ {
+ usleep (500);
+ }
+
+ // Get a size that covers all of the page without scrollbars
+ if (!osgk_browser_get_preferred_dimensions (browser, &renderW, &renderH, renderW))
+ {
+ fputs ("Error when determining preferred image dimensions\n", stderr);
+ returnCode = 1;
+ goto cleanupBrowser;
+ }
+
+ // Set the browser size to the preferred size we just obtained
+ osgk_browser_resize (browser, renderW, renderH);
+
+ // Open output file
+ tgafile = fopen (outputFilename, "wb");
+ // Lock pixel data from browser object for retrieval
+ lockedData = osgk_browser_lock_data (browser, 0);
+ // Write output file
+ tga_WriteBGRAImage (renderW, renderH, lockedData, tgafile);
+ // Clean up file
+ fclose (tgafile);
+ // Unlock pixel data
+ osgk_browser_unlock_data (browser, lockedData);
+
+cleanupBrowser:
+ // Clean up browser object
+ osgk_release (browser);
+cleanupEmbedding:
+ // Clean up embedding object
+ osgk_release (embedding);
+
+ return returnCode;
+}
Property changes on: trunk/src/demos/webpage2image.c
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2010-09-02 23:21:21
|
Revision: 108
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=108&view=rev
Author: res2002
Date: 2010-09-02 23:21:15 +0000 (Thu, 02 Sep 2010)
Log Message:
-----------
Include exception flags to silence MSVC warnings
Modified Paths:
--------------
trunk/CMakeMSVCDefaults.txt
Modified: trunk/CMakeMSVCDefaults.txt
===================================================================
--- trunk/CMakeMSVCDefaults.txt 2010-09-02 22:44:29 UTC (rev 107)
+++ trunk/CMakeMSVCDefaults.txt 2010-09-02 23:21:15 UTC (rev 108)
@@ -6,7 +6,7 @@
SET (CMAKE_CXX_STACK_SIZE "" CACHE STRING "")
# Removed Compiler heap setting; exceptions disabled; RTTI disabled
-SET (CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /GR-" CACHE STRING "")
+SET (CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /GR- /EHsc" CACHE STRING "")
# Enable full debug info
SET (CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MTd /ZI /Ob0 /Od /RTC1" CACHE STRING "")
# Enable debug info
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2010-09-02 22:44:35
|
Revision: 107
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=107&view=rev
Author: res2002
Date: 2010-09-02 22:44:29 +0000 (Thu, 02 Sep 2010)
Log Message:
-----------
Silence cmake 2.8 warning
Modified Paths:
--------------
trunk/src/libosgk/CMakeLists.txt
Modified: trunk/src/libosgk/CMakeLists.txt
===================================================================
--- trunk/src/libosgk/CMakeLists.txt 2010-02-22 21:41:13 UTC (rev 106)
+++ trunk/src/libosgk/CMakeLists.txt 2010-09-02 22:44:29 UTC (rev 107)
@@ -5,8 +5,8 @@
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
IF(NOT XULRUNNER_SDK_DIR)
- MESSAGE("XULRUNNER_SDK_DIR variable is not set; assuming src/${XULRUNNER_SDK_DIR_DEFAULT}")
- set(XULRUNNER_SDK_DIR "${XULRUNNER_SDK_DIR_DEFAULT}")
+ set(XULRUNNER_SDK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${XULRUNNER_SDK_DIR_DEFAULT}")
+ MESSAGE("XULRUNNER_SDK_DIR variable is not set; assuming ${XULRUNNER_SDK_DIR}")
ENDIF(NOT XULRUNNER_SDK_DIR)
set(XULRUNNER_CFLAGS "-DXP_WIN -Zc:wchar_t-")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2010-02-22 21:41:19
|
Revision: 106
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=106&view=rev
Author: res2002
Date: 2010-02-22 21:41:13 +0000 (Mon, 22 Feb 2010)
Log Message:
-----------
Additional needed includes
Modified Paths:
--------------
trunk/src/libosgk/defs_private.h
trunk/src/libosgk/pathutil.h
Modified: trunk/src/libosgk/defs_private.h
===================================================================
--- trunk/src/libosgk/defs_private.h 2009-07-05 14:47:58 UTC (rev 105)
+++ trunk/src/libosgk/defs_private.h 2010-02-22 21:41:13 UTC (rev 106)
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <stdarg.h>
+#include <limits.h>
#define _GECKO_INCLUDE_STRINGIZE(X) _GECKO_INCLUDE_STRINGIZE2(#X)
#define _GECKO_INCLUDE_STRINGIZE2(X) X
Modified: trunk/src/libosgk/pathutil.h
===================================================================
--- trunk/src/libosgk/pathutil.h 2009-07-05 14:47:58 UTC (rev 105)
+++ trunk/src/libosgk/pathutil.h 2010-02-22 21:41:13 UTC (rev 106)
@@ -39,6 +39,7 @@
#include "defs_private.h"
#include <string>
+#include <stdlib.h>
#if defined(XP_WIN)
# include <direct.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2009-07-05 14:47:59
|
Revision: 105
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=105&view=rev
Author: res2002
Date: 2009-07-05 14:47:58 +0000 (Sun, 05 Jul 2009)
Log Message:
-----------
Updated relaytool (from CrystalSpace)
Modified Paths:
--------------
trunk/bin/relaytool
Modified: trunk/bin/relaytool
===================================================================
--- trunk/bin/relaytool 2009-07-05 14:40:58 UTC (rev 104)
+++ trunk/bin/relaytool 2009-07-05 14:47:58 UTC (rev 105)
@@ -122,11 +122,9 @@
if $using_partial_map; then
functions=$( grep "^F " "$partial_map" | cut -d' ' -f2 )
variables=$( grep "^V " "$partial_map" | cut -d' ' -f2 )
- variables_weak=
else
functions=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "T") || ($2 == "W")) print $3; }' | LC_ALL=C grep -v '\(\<_init\>\|\<_fini\>\)' | LC_ALL=C sort -u )
- variables=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "D") || ($2 == "G") || ($2 == "B")) print $3; }' | LC_ALL=C sort -u )
- variables_weak=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "V")) print $3; }' | LC_ALL=C sort -u )
+ variables=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "D") || ($2 == "G") || ($2 == "B") || ($2 == "V")) print $3; }' | LC_ALL=C sort -u )
fi
if $using_minimal_list; then
functions="$functions
@@ -135,12 +133,9 @@
variables="$variables
$( nm `echo "$object_list"` | awk '{ if ($1 == "U") print $2; }' | LC_ALL=C sort -u )"
variables=$( echo "$variables" | LC_ALL=C sort | LC_ALL=C uniq -d )
- variables_weak="$variables_weak
-$( nm `echo "$object_list"` | awk '{ if ($1 == "U") print $2; }' | LC_ALL=C sort -u )"
- variables_weak=$( echo "$variables_weak" | LC_ALL=C sort | LC_ALL=C uniq -d )
fi
- if [ "$functions" == "" ] && [ "$variables" == "" ] && [ "$variables_weak" == "" ]; then
+ if [ "$functions" == "" ] && [ "$variables" == "" ]; then
# Nothing will be used, so do nothing for that lib
exit 1
fi
@@ -182,9 +177,6 @@
for s in $variables; do
echo " \"$s\"," >>"$outfile"
done
- for s in $variables_weak; do
- echo " \"$s\"," >>"$outfile"
- done
echo " 0" >>"$outfile"
cat <<EOF >>"$outfile"
@@ -203,9 +195,9 @@
#define ASM_FUNC(x) #x "@PLT"
#define ASM_FIXUPVAR(x) #x "@GOTOFF(%%ebx)"
#elif defined( __x86_64__ )
- #define ASM_VAR(x) #x "@GOT(%rbx)"
+ #define ASM_VAR(x) #x "@GOTPCREL(%rip)"
#define ASM_FUNC(x) #x "@PLT"
- #define ASM_FIXUPVAR(x) #x "@GOT(%%rbx)"
+ #define ASM_FIXUPVAR(x) #x "@GOTPCREL(%%rip)"
#endif
#endif
@@ -298,19 +290,19 @@
/* build function jumptable */
while (functions[i++]) ptrs[i - 1] = dlsym( handle, functions[i - 1] );
+EOF
+
+ if [ "$variables" != "" ]; then
+ cat <<EOF >>"$outfile"
+ /* now fixup the global offset table for variable imports */
void* symptr;
EOF
-
- if [ "$variables" != "" ] || [ "$variables_weak" != "" ]; then echo " /* now fixup the global offset table for variable imports */" >>"$outfile"; fi
+ fi
for s in $variables; do
echo " symptr = dlsym(handle, \"$s\");" >>"$outfile"
echo " FIXUP_GOT_RELOC( $s, symptr );" >>"$outfile"
done
- for s in $variables_weak; do
- echo " symptr = dlsym(handle, \"$s\");" >>"$outfile"
- echo " FIXUP_GOT_RELOC( $s, symptr );" >>"$outfile"
- done
cat <<EOF >>"$outfile"
}
@@ -341,6 +333,7 @@
" .type " name ", @function\n" \\
name ":\n" \\
" movq " ASM_VAR (ptrs) ", %r11\n" \\
+ " movq (%r11), %r11\n" \\
" movq " #index "(%r11), %r11\n" \\
" test %r11, %r11\n" \\
" jnz JS" #index "\n" \\
@@ -378,9 +371,6 @@
for s in $variables; do
echo "int $s __attribute__(( visibility(\"hidden\") )) = -1;" >>"$outfile"
done
- for s in $variables_weak; do
- echo "int $s __attribute__((weak)) __attribute__(( visibility(\"hidden\") )) = -1;" >>"$outfile"
- done
cat <<EOF >>"$outfile"
@@ -455,14 +445,15 @@
i386 | i486 | i586 | i686 )
arch_ok=true
arch_ptr_size=4
+ searchpath=( "/usr/lib" "/usr/local/lib" "/lib" `pwd` )
;;
x86_64)
arch_ok=true
arch_ptr_size=8
+ searchpath=( "/usr/lib" "/usr/local/lib" "/lib" "/usr/lib64" "/usr/local/lib64" "/lib64" `pwd` )
;;
esac
-searchpath=( "/usr/lib" "/usr/local/lib" "/lib" `pwd` )
multilinklist=( )
relaylist=( )
@@ -546,8 +537,12 @@
stubobj=$( echo "$stubfile" | sed 's/\.c$/\.o/' )
# remove -include flags from CFLAGS, if any
CFLAGS=$( echo $CFLAGS | sed 's/-include .*\.h//g' )
- ${CC:-gcc} ${CFLAGS} -fPIC -DPIC -c -o "$stubobj" "$stubfile" 2>/dev/tty
- echo -n "$stubobj "
+ # ${CC:-gcc} ${CFLAGS} -fPIC -DPIC -c -o "$stubobj" "$stubfile" 2>/dev/tty
+ ${CC:-gcc} ${CFLAGS} -fPIC -DPIC -c -o "$stubobj" "$stubfile"
+ # We may have to patch the GOT at runtime; instruct
+ # linker to not mark it as RELRO, which will cause it
+ # to be read-only after the loader performed relocation.
+ echo -n "$stubobj -Wl,-z,norelro "
fi
echo -n "-l$lib "
@@ -580,7 +575,8 @@
stubobj=$( echo "$stubfile" | sed 's/\.c$/\.o/' )
# remove -include flags from CFLAGS, if any
CFLAGS=$( echo $CFLAGS | sed 's/-include .*\.h//g' )
- ${CC:-gcc} ${CFLAGS} -fPIC -DPIC -c -o "$stubobj" "$stubfile" 2>/dev/tty
+ # ${CC:-gcc} ${CFLAGS} -fPIC -DPIC -c -o "$stubobj" "$stubfile" 2>/dev/tty
+ ${CC:-gcc} ${CFLAGS} -fPIC -DPIC -c -o "$stubobj" "$stubfile"
echo -n "$stubobj "
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2009-07-05 14:40:59
|
Revision: 104
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=104&view=rev
Author: res2002
Date: 2009-07-05 14:40:58 +0000 (Sun, 05 Jul 2009)
Log Message:
-----------
Build with xulrunner 1.9.1
Modified Paths:
--------------
trunk/src/libosgk/CMakeLists.txt
trunk/src/libosgk/OffscreenDeviceContext.h
trunk/src/libosgk/OffscreenWidget.h
trunk/src/libosgk/nsBaseWidget.cpp
trunk/src/libosgk/nsBaseWidget.h
Modified: trunk/src/libosgk/CMakeLists.txt
===================================================================
--- trunk/src/libosgk/CMakeLists.txt 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/CMakeLists.txt 2009-07-05 14:40:58 UTC (rev 104)
@@ -23,7 +23,6 @@
# @@@ Gentoo: libdir points at sdk/lib/ subdirectory which only contains a subset of xulrunner libs
set(XULRUNNER_NEW_LIBRARY_DIRS ${XULRUNNER_NEW_LIBRARY_DIRS} ${XULRUNNER_LIB_DIR}/../..)
set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -L${XULRUNNER_LIB_DIR}/../..)
- set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -Wl,-rpath,${XULRUNNER_LIB_DIR}/../..)
endforeach(XULRUNNER_LIB_DIR)
set(XULRUNNER_LIBRARY_DIRS XULRUNNER_NEW_LIBRARY_DIRS)
ELSE(XULRUNNER_FOUND)
@@ -39,6 +38,10 @@
set(XULRUNNER_LDFLAGS -lxul -lnspr4)
ENDIF(XULRUNNER_SDK_DIR)
+IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -lmozjs)
+ENDIF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+
set(CMAKE_REQUIRED_INCLUDES "${XULRUNNER_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_DEFINITIONS "${XULRUNNER_CFLAGS}")
CHECK_CXX_SOURCE_COMPILES(
@@ -48,7 +51,6 @@
XULRUNNER_FLAT_INCDIR)
IF(XULRUNNER_FLAT_INCDIR)
- add_definitions(-DOSGK_GECKOINC_FLAT)
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DOSGK_GECKOINC_FLAT")
ENDIF(XULRUNNER_FLAT_INCDIR)
@@ -79,9 +81,6 @@
int main() { gfxASurface* surf = 0; surf->Release(); return 0; }"
XULRUNNER_LINKS_WITHOUT_THEBES)
-IF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
- set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -lthebes)
-ENDIF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
include_directories(${XULRUNNER_INCLUDE_DIRS})
IF(XULRUNNER_FLAT_INCDIR)
@@ -141,19 +140,19 @@
IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
message("Creating relaytool files...")
execute_process(
- COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay xul --relay nspr4 ${XULRUNNER_LDFLAGS}
+ COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay xul --relay nspr4 --relay mozjs ${XULRUNNER_LDFLAGS}
WORKING_DIRECTORY out/libosgk
OUTPUT_VARIABLE XULRUNNER_LFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
# @@@ FIXME(?): Disabled b/c of duplicate symbols in thebes and xul
- #IF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
- # execute_process(
- # COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay thebes ${XULRUNNER_LDFLAGS}
- # WORKING_DIRECTORY out/libosgk
- # OUTPUT_VARIABLE RELAYTOOL_THEBES
- # OUTPUT_STRIP_TRAILING_WHITESPACE)
- # set(XULRUNNER_LFLAGS ${XULRUNNER_LFLAGS} ${RELAYTOOL_THEBES})
- #ENDIF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
+ IF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
+ execute_process(
+ COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay thebes ${XULRUNNER_LDFLAGS} -lthebes
+ WORKING_DIRECTORY out/libosgk
+ OUTPUT_VARIABLE RELAYTOOL_THEBES
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(XULRUNNER_LFLAGS ${XULRUNNER_LFLAGS} ${RELAYTOOL_THEBES})
+ ENDIF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
# -lxpcomglue added manually to work around xpcomglue_s appearing in LFLAGS on gentoo
string(STRIP "-lxpcomglue ${XULRUNNER_LFLAGS}" XULRUNNER_LFLAGS)
target_link_libraries(OffscreenGecko ${XULRUNNER_LFLAGS})
Modified: trunk/src/libosgk/OffscreenDeviceContext.h
===================================================================
--- trunk/src/libosgk/OffscreenDeviceContext.h 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/OffscreenDeviceContext.h 2009-07-05 14:40:58 UTC (rev 104)
@@ -89,10 +89,10 @@
NS_IMETHOD GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
{ return thebesDC->GetSystemFont (aID, aFont); }
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
- nsIFontMetrics*& aMetrics)
- { return thebesDC->GetMetricsFor (aFont, aLangGroup, aMetrics); }
- NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics)
- { return thebesDC->GetMetricsFor (aFont, aMetrics); }
+ gfxUserFontSet* fs, nsIFontMetrics*& aMetrics)
+ { return thebesDC->GetMetricsFor (aFont, aLangGroup, fs, aMetrics); }
+ NS_IMETHOD GetMetricsFor(const nsFont& aFont, gfxUserFontSet* fs, nsIFontMetrics*& aMetrics)
+ { return thebesDC->GetMetricsFor (aFont, fs, aMetrics); }
NS_IMETHOD CheckFontExistence(const nsString& aFaceName)
{ return thebesDC->CheckFontExistence (aFaceName); }
NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName)
Modified: trunk/src/libosgk/OffscreenWidget.h
===================================================================
--- trunk/src/libosgk/OffscreenWidget.h 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/OffscreenWidget.h 2009-07-05 14:40:58 UTC (rev 104)
@@ -236,7 +236,7 @@
NS_IMETHOD SetTitle(const nsAString& aTitle) { return NS_ERROR_NOT_IMPLEMENTED; }
- NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetMenuBar(void* aMenuBar) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD ShowMenuBar(PRBool aShow) { return NS_ERROR_NOT_IMPLEMENTED; }
Modified: trunk/src/libosgk/nsBaseWidget.cpp
===================================================================
--- trunk/src/libosgk/nsBaseWidget.cpp 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/nsBaseWidget.cpp 2009-07-05 14:40:58 UTC (rev 104)
@@ -36,8 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
-#include "mozilla-config.h"
-
#include "nsBaseWidget.h"
#include "nsIDeviceContext.h"
#include "nsCOMPtr.h"
@@ -48,6 +46,7 @@
#include "nsIScreenManager.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
+#include "nsIContent.h"
// [res]: for CallCreateInstance
#include "nsComponentManagerUtils.h"
@@ -69,10 +68,27 @@
static PRInt32 gNumWidgets;
#endif
+nsIContent* nsBaseWidget::mLastRollup = nsnull;
+
// nsBaseWidget
-NS_IMPL_ISUPPORTS1(nsBaseWidget, nsIWidget)
+NS_IMPL_ISUPPORTS2(nsBaseWidget, nsIWidget, nsIWidget_1_9_1_BRANCH)
+nsAutoRollup::nsAutoRollup()
+{
+ // remember if mLastRollup was null, and only clear it upon destruction
+ // if so. This prevents recursive usage of nsAutoRollup from clearing
+ // mLastRollup when it shouldn't.
+ wasClear = !nsBaseWidget::mLastRollup;
+}
+
+nsAutoRollup::~nsAutoRollup()
+{
+ if (nsBaseWidget::mLastRollup && wasClear) {
+ NS_RELEASE(nsBaseWidget::mLastRollup);
+ }
+}
+
//-------------------------------------------------------------------------
//
// nsBaseWidget constructor
@@ -84,15 +100,10 @@
, mEventCallback(nsnull)
, mContext(nsnull)
, mToolkit(nsnull)
-, mMouseListener(nsnull)
, mEventListener(nsnull)
, mCursor(eCursor_standard)
, mWindowType(eWindowType_child)
, mBorderStyle(eBorderStyle_none)
-, mIsShiftDown(PR_FALSE)
-, mIsControlDown(PR_FALSE)
-, mIsAltDown(PR_FALSE)
-, mIsDestroying(PR_FALSE)
, mOnDestroyCalled(PR_FALSE)
, mBounds(0,0,0,0)
, mOriginalBounds(nsnull)
@@ -245,14 +256,12 @@
{
// Just in case our parent is the only ref to us
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
-
// disconnect from the parent
nsIWidget *parent = GetParent();
if (parent) {
parent->RemoveChild(this);
}
// disconnect listeners.
- NS_IF_RELEASE(mMouseListener);
NS_IF_RELEASE(mEventListener);
return NS_OK;
@@ -282,6 +291,35 @@
//-------------------------------------------------------------------------
//
+// Get this nsBaseWidget top level widget
+//
+//-------------------------------------------------------------------------
+nsIWidget* nsBaseWidget::GetTopLevelWidget(PRInt32* aLevelsUp)
+{
+ nsIWidget *topLevelWidget, *widget = this;
+ if (aLevelsUp)
+ *aLevelsUp = -1;
+ while (widget) {
+ topLevelWidget = widget;
+ widget = widget->GetParent();
+ if (aLevelsUp)
+ ++*aLevelsUp;
+ }
+ return topLevelWidget;
+}
+
+//-------------------------------------------------------------------------
+//
+// Get this nsBaseWidget's top (non-sheet) parent (if it's a sheet)
+//
+//-------------------------------------------------------------------------
+nsIWidget* nsBaseWidget::GetSheetWindowParent(void)
+{
+ return nsnull;
+}
+
+//-------------------------------------------------------------------------
+//
// Add a child to the list of children
//
//-------------------------------------------------------------------------
@@ -523,17 +561,21 @@
//
//-------------------------------------------------------------------------
-NS_IMETHODIMP nsBaseWidget::SetWindowTranslucency(PRBool aTranslucent) {
- return NS_ERROR_NOT_IMPLEMENTED;
+void nsBaseWidget::SetTransparencyMode(nsTransparencyMode aMode) {
}
-NS_IMETHODIMP nsBaseWidget::GetWindowTranslucency(PRBool& aTranslucent) {
- aTranslucent = PR_FALSE;
- return NS_OK;
+nsTransparencyMode nsBaseWidget::GetTransparencyMode() {
+ return eTransparencyOpaque;
}
-NS_IMETHODIMP nsBaseWidget::UpdateTranslucentWindowAlpha(const nsRect& aRect, PRUint8* aAlphas) {
- NS_ASSERTION(PR_FALSE, "Window is not translucent");
+//-------------------------------------------------------------------------
+//
+// Set window shadow style
+//
+//-------------------------------------------------------------------------
+
+NS_IMETHODIMP nsBaseWidget::SetWindowShadowStyle(PRInt32 aMode)
+{
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -555,11 +597,7 @@
NS_IMETHODIMP nsBaseWidget::MakeFullScreen(PRBool aFullScreen)
{
HideWindowChrome(aFullScreen);
- return MakeFullScreenInternal(aFullScreen);
-}
-nsresult nsBaseWidget::MakeFullScreenInternal(PRBool aFullScreen)
-{
nsCOMPtr<nsIFullScreen> fullScreen = do_GetService("@mozilla.org/browser/fullscreen;1");
if (aFullScreen) {
@@ -696,25 +734,12 @@
/**
-* Processes a mouse pressed event
+* Sets the event listener for a widget
*
**/
-NS_METHOD nsBaseWidget::AddMouseListener(nsIMouseListener * aListener)
-{
- NS_PRECONDITION(mMouseListener == nsnull, "Null mouse listener");
- NS_IF_RELEASE(mMouseListener);
- NS_ADDREF(aListener);
- mMouseListener = aListener;
- return NS_OK;
-}
-
-/**
-* Processes a mouse pressed event
-*
-**/
NS_METHOD nsBaseWidget::AddEventListener(nsIEventListener * aListener)
{
- NS_PRECONDITION(mEventListener == nsnull, "Null mouse listener");
+ NS_PRECONDITION(mEventListener == nsnull, "Null event listener");
NS_IF_RELEASE(mEventListener);
NS_ADDREF(aListener);
mEventListener = aListener;
@@ -818,6 +843,12 @@
return NS_ERROR_NOT_IMPLEMENTED;
}
+PRBool
+nsBaseWidget::HasPendingInputEvent()
+{
+ return PR_FALSE;
+}
+
NS_IMETHODIMP
nsBaseWidget::SetIcon(const nsAString&)
{
@@ -845,12 +876,18 @@
}
NS_IMETHODIMP
-nsBaseWidget::SetWindowTitlebarColor(nscolor aColor)
+nsBaseWidget::SetWindowTitlebarColor(nscolor aColor, PRBool aActive)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
+PRBool
+nsBaseWidget::ShowsResizeIndicator(nsIntRect* aResizerRect)
+{
+ return PR_FALSE;
+}
+
/**
* Modifies aFile to point at an icon file with the given name and suffix. The
* suffix may correspond to a file extension with leading '.' if appropriate.
@@ -866,7 +903,7 @@
// [res]: embed nsString doesn't have '+'
//aFile->Append(aIconName + aIconSuffix);
aFile->Append(aIconName);
- aFile->Append(aIconSuffix);
+ aFile->Append(aIconSuffix);
PRBool readable;
return NS_SUCCEEDED(aFile->IsReadable(&readable)) && readable;
@@ -921,6 +958,12 @@
NS_ADDREF(*aResult = file);
}
+NS_IMETHODIMP
+nsBaseWidget::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
#ifdef DEBUG
//////////////////////////////////////////////////////////////
//
@@ -939,9 +982,8 @@
nsAutoString eventName(NS_LITERAL_STRING("UNKNOWN"));
- // [res]: removed AssignWithConversion
#define _ASSIGN_eventName(_value,_name)\
-case _value: eventName.Assign(NS_L(_name)) ; break
+case _value: eventName.AssignWithConversion(_name) ; break
switch(aGuiEvent->message)
{
@@ -995,8 +1037,8 @@
char buf[32];
sprintf(buf,"UNKNOWN: %d",aGuiEvent->message);
- // [res]: removed AssignWithConversion
- eventName = NS_ConvertASCIItoUTF16 (buf);
+
+ eventName.AssignWithConversion(buf);
}
break;
}
@@ -1174,9 +1216,7 @@
if (!debug_GetCachedBoolPref("nglayout.debug.event_dumping"))
return;
- // [res]: removed AssignWithConversion
- nsCAutoString tempString;
- tempString = NS_ConvertUTF16toUTF8 (debug_GuiEventToString(aGuiEvent).get());
+ nsCAutoString tempString; tempString.AssignWithConversion(debug_GuiEventToString(aGuiEvent).get());
fprintf(aFileOut,
"%4d %-26s widget=%-8p name=%-12s id=%-8p refpt=%d,%d\n",
Modified: trunk/src/libosgk/nsBaseWidget.h
===================================================================
--- trunk/src/libosgk/nsBaseWidget.h 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/nsBaseWidget.h 2009-07-05 14:40:58 UTC (rev 104)
@@ -43,7 +43,6 @@
#include "nsRect.h"
#include "nsIWidget.h"
-#include "nsIMouseListener.h"
#include "nsIEventListener.h"
#include "nsIToolkit.h"
#include "nsIAppShell.h"
@@ -54,6 +53,9 @@
#include "nsCOMPtr.h"
#include "nsGUIEvent.h"
+class nsIContent;
+class nsAutoRollup;
+
/**
* Common widget implementation used as base class for native
* or crossplatform implementations of Widgets.
@@ -63,8 +65,9 @@
* class, but it gives them a head start.)
*/
-class nsBaseWidget : public nsIWidget
+class nsBaseWidget : public nsIWidget_1_9_1_BRANCH
{
+ friend class nsAutoRollup;
public:
nsBaseWidget();
@@ -83,6 +86,8 @@
NS_IMETHOD Destroy();
NS_IMETHOD SetParent(nsIWidget* aNewParent);
virtual nsIWidget* GetParent(void);
+ virtual nsIWidget* GetTopLevelWidget(PRInt32* aLevelsUp = NULL);
+ virtual nsIWidget* GetSheetWindowParent(void);
virtual void AddChild(nsIWidget* aChild);
virtual void RemoveChild(nsIWidget* aChild);
@@ -104,24 +109,20 @@
PRUint32 aHotspotX, PRUint32 aHotspotY);
NS_IMETHOD GetWindowType(nsWindowType& aWindowType);
NS_IMETHOD SetWindowType(nsWindowType aWindowType);
- NS_IMETHOD SetWindowTranslucency(PRBool aTranslucent);
- NS_IMETHOD GetWindowTranslucency(PRBool& aTranslucent);
- NS_IMETHOD UpdateTranslucentWindowAlpha(const nsRect& aRect, PRUint8* aAlphas);
+ virtual void SetTransparencyMode(nsTransparencyMode aMode);
+ virtual nsTransparencyMode GetTransparencyMode();
+ NS_IMETHOD SetWindowShadowStyle(PRInt32 aStyle);
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
- nsresult MakeFullScreenInternal(PRBool aFullScreen);
virtual nsIRenderingContext* GetRenderingContext();
virtual nsIDeviceContext* GetDeviceContext();
virtual nsIToolkit* GetToolkit();
-#ifdef MOZ_CAIRO_GFX
virtual gfxASurface* GetThebesSurface();
-#endif
NS_IMETHOD SetModal(PRBool aModal);
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent,
PRBool *aForWindow);
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle);
- NS_IMETHOD AddMouseListener(nsIMouseListener * aListener);
NS_IMETHOD AddEventListener(nsIEventListener * aListener);
NS_IMETHOD SetBounds(const nsRect &aRect);
NS_IMETHOD GetBounds(nsRect &aRect);
@@ -133,12 +134,24 @@
NS_IMETHOD EnableDragDrop(PRBool aEnable);
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
NS_IMETHOD GetLastInputEventTime(PRUint32& aTime);
+ virtual PRBool HasPendingInputEvent();
NS_IMETHOD SetIcon(const nsAString &anIconSpec);
NS_IMETHOD BeginSecureKeyboardInput();
NS_IMETHOD EndSecureKeyboardInput();
- NS_IMETHOD SetWindowTitlebarColor(nscolor aColor);
+ NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
+ virtual PRBool ShowsResizeIndicator(nsIntRect* aResizerRect);
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}
+ NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
+ virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
+ virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD ResetInputState() { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetIMEOpenState(PRBool aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetIMEOpenState(PRBool* aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetIMEEnabled(PRUint32 aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetIMEEnabled(PRUint32* aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD CancelIMEComposition() { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState) { return NS_ERROR_NOT_IMPLEMENTED; }
protected:
@@ -154,27 +167,38 @@
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData);
+ virtual nsIContent* GetLastRollup()
+ {
+ return mLastRollup;
+ }
+
+ virtual nsresult SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
+ PRInt32 aNativeKeyCode,
+ PRUint32 aModifierFlags,
+ const nsAString& aCharacters,
+ const nsAString& aUnmodifiedCharacters)
+ { return NS_ERROR_UNEXPECTED; }
+
protected:
void* mClientData;
EVENT_CALLBACK mEventCallback;
nsIDeviceContext *mContext;
nsIToolkit *mToolkit;
- nsIMouseListener *mMouseListener;
nsIEventListener *mEventListener;
nscolor mBackground;
nscolor mForeground;
nsCursor mCursor;
nsWindowType mWindowType;
nsBorderStyle mBorderStyle;
- PRPackedBool mIsShiftDown;
- PRPackedBool mIsControlDown;
- PRPackedBool mIsAltDown;
- PRPackedBool mIsDestroying;
PRPackedBool mOnDestroyCalled;
nsRect mBounds;
nsRect* mOriginalBounds;
PRInt32 mZIndex;
nsSizeMode mSizeMode;
+
+ // the last rolled up popup. Only set this when an nsAutoRollup is in scope,
+ // so it can be cleared automatically.
+ static nsIContent* mLastRollup;
// Enumeration of the methods which are accessible on the "main GUI thread"
// via the CallMethod(...) mechanism...
@@ -216,4 +240,26 @@
#endif
};
+// A situation can occur when a mouse event occurs over a menu label while the
+// menu popup is already open. The expected behaviour is to close the popup.
+// This happens by calling nsIRollupListener::Rollup before the mouse event is
+// processed. However, in cases where the mouse event is not consumed, this
+// event will then get targeted at the menu label causing the menu to open
+// again. To prevent this, we store in mLastRollup a reference to the popup
+// that was closed during the Rollup call, and prevent this popup from
+// reopening while processing the mouse event.
+// mLastRollup should only be set while an nsAutoRollup is in scope;
+// when it goes out of scope mLastRollup is cleared automatically.
+// As mLastRollup is static, it can be retrieved by calling
+// nsIWidget::GetLastRollup on any widget.
+class nsAutoRollup
+{
+ PRBool wasClear;
+
+ public:
+
+ nsAutoRollup();
+ ~nsAutoRollup();
+};
+
#endif // nsBaseWidget_h__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-10 23:48:28
|
Revision: 103
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=103&view=rev
Author: res2002
Date: 2008-11-10 23:48:25 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
Pump messages on Win32 in ProcessToolkitEvents()
Modified Paths:
--------------
trunk/sdk/win32/README.txt
trunk/src/libosgk/browser.cpp
Modified: trunk/sdk/win32/README.txt
===================================================================
--- trunk/sdk/win32/README.txt 2008-11-10 23:47:07 UTC (rev 102)
+++ trunk/sdk/win32/README.txt 2008-11-10 23:48:25 UTC (rev 103)
@@ -7,6 +7,3 @@
You will either have to give the directory with the XULrunner binaries as
an additional path to search for XULrunner to OffscreenGecko (see API docs)
or set the GRE_HOME variable to that directory.
-
-The embedding application must regularly pump messages to all Windows. (This
-is usually the case.)
Modified: trunk/src/libosgk/browser.cpp
===================================================================
--- trunk/src/libosgk/browser.cpp 2008-11-10 23:47:07 UTC (rev 102)
+++ trunk/src/libosgk/browser.cpp 2008-11-10 23:48:25 UTC (rev 103)
@@ -89,9 +89,9 @@
#include GECKO_INCLUDE(dom,nsIDOMDocument.h)
#include GECKO_INCLUDE(dom,nsIDOMWindow.h)
#include GECKO_INCLUDE(embed_base,nsEmbedCID.h)
-#include GECKO_INCLUDE(generic,nsHTMLReflowState.h)
#include GECKO_INCLUDE(layout,nsIDocumentViewer.h)
#include GECKO_INCLUDE(layout,nsIFrame.h)
+#include GECKO_INCLUDE(layout,nsHTMLReflowState.h)
#include GECKO_INCLUDE(layout,nsPresContext.h)
#include GECKO_INCLUDE(webbrwsr,nsIWebBrowserSetup.h)
#include GECKO_INCLUDE(widget,nsIWidget.h)
@@ -105,6 +105,13 @@
#include "gtk/gtk.h"
#endif
+#ifdef WIN32
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
/* Depends on whether a modification I made to gecko makes it into the source -
see https://bugzilla.mozilla.org/show_bug.cgi?id=407531 */
//#define HAVE_GECKO_AA_GRAY
@@ -333,6 +340,18 @@
{
#ifdef MOZ_WIDGET_GTK2
gtk_main_iteration_do (FALSE);
+ #elif defined(WIN32)
+ MSG msg;
+ while (PeekMessage (&msg, 0, 0, 0, PM_NOREMOVE))
+ {
+ // Make sure that WM_QUIT is passed back to the host app
+ if (msg.message == WM_QUIT) return;
+ if (GetMessage (&msg, 0, 0, 0) >= 0)
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
#endif
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-10 23:47:13
|
Revision: 102
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=102&view=rev
Author: res2002
Date: 2008-11-10 23:47:07 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
Correct calling conventions
Modified Paths:
--------------
trunk/src/libosgk/OffscreenWidget.h
Modified: trunk/src/libosgk/OffscreenWidget.h
===================================================================
--- trunk/src/libosgk/OffscreenWidget.h 2008-11-10 23:44:39 UTC (rev 101)
+++ trunk/src/libosgk/OffscreenWidget.h 2008-11-10 23:47:07 UTC (rev 102)
@@ -287,7 +287,7 @@
virtual nsIWidget* GetSheetWindowParent() { return 0; }
NS_IMETHOD SetWindowTitlebarColor(nscolor, PRBool)
{ return NS_ERROR_NOT_IMPLEMENTED; }
- NS_IMETHOD SynthesizeNativeKeyEvent(PRInt32, PRInt32, PRUint32, const nsAString&, const nsAString&)
+ virtual nsresult SynthesizeNativeKeyEvent(PRInt32, PRInt32, PRUint32, const nsAString&, const nsAString&)
{ return NS_ERROR_NOT_IMPLEMENTED; }
void EventMouseMove (const EventHelpers::KeyState& kstate, int x, int y);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-10 23:44:45
|
Revision: 101
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=101&view=rev
Author: res2002
Date: 2008-11-10 23:44:39 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
Fix building on Win32
Modified Paths:
--------------
trunk/src/demos/webpage2image.cpp
Modified: trunk/src/demos/webpage2image.cpp
===================================================================
--- trunk/src/demos/webpage2image.cpp 2008-11-10 23:44:15 UTC (rev 100)
+++ trunk/src/demos/webpage2image.cpp 2008-11-10 23:44:39 UTC (rev 101)
@@ -29,7 +29,13 @@
*/
#include <stdio.h>
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#define usleep(x) Sleep(x)
+#else
#include <unistd.h> // for usleep()
+#endif
#include <OffscreenGecko/browser.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-10 23:44:21
|
Revision: 100
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=100&view=rev
Author: res2002
Date: 2008-11-10 23:44:15 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
Fix building on Win32
Modified Paths:
--------------
trunk/src/demos/CMakeLists.txt
trunk/src/libosgk/CMakeLists.txt
Modified: trunk/src/demos/CMakeLists.txt
===================================================================
--- trunk/src/demos/CMakeLists.txt 2008-11-02 23:03:48 UTC (rev 99)
+++ trunk/src/demos/CMakeLists.txt 2008-11-10 23:44:15 UTC (rev 100)
@@ -1,6 +1,8 @@
include_directories(../../include)
add_executable(webpage2image webpage2image.cpp)
-target_link_libraries(webpage2image "-Wl,--warn-unresolved-symbols -Wl,--as-needed")
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ target_link_libraries(webpage2image "-Wl,--warn-unresolved-symbols -Wl,--as-needed")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
target_link_libraries(webpage2image OffscreenGecko)
target_link_libraries(webpage2image osgk-common)
Modified: trunk/src/libosgk/CMakeLists.txt
===================================================================
--- trunk/src/libosgk/CMakeLists.txt 2008-11-02 23:03:48 UTC (rev 99)
+++ trunk/src/libosgk/CMakeLists.txt 2008-11-10 23:44:15 UTC (rev 100)
@@ -1,7 +1,7 @@
INCLUDE(FindPkgConfig)
include_directories(${OffscreenGecko_SOURCE_DIR}/include)
-set(XULRUNNER_SDK_DIR_DEFAULT "../xulrunner-sdk")
+set(XULRUNNER_SDK_DIR_DEFAULT "../../xulrunner-sdk")
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
IF(NOT XULRUNNER_SDK_DIR)
@@ -89,9 +89,13 @@
ELSE(XULRUNNER_FLAT_INCDIR)
FOREACH(d ${XULRUNNER_INCLUDE_DIRS})
include_directories(${d}/content)
+ include_directories(${d}/docshell)
include_directories(${d}/dom)
include_directories(${d}/gfx)
include_directories(${d}/js)
+ include_directories(${d}/layout)
+ include_directories(${d}/locale)
+ include_directories(${d}/necko)
include_directories(${d}/nspr)
include_directories(${d}/pref)
include_directories(${d}/string)
@@ -119,6 +123,7 @@
link_libraries(${GTK_LDFLAGS})
ENDIF(XULRUNNER_WIDGET_GTK2)
+link_directories(${XULRUNNER_LIBRARY_DIRS})
file(GLOB sources *.cpp *.h)
add_library(OffscreenGecko SHARED ${sources})
target_link_libraries(OffscreenGecko osgk-common)
@@ -133,7 +138,6 @@
add_definitions("-fno-rtti -ggdb -fvisibility-inlines-hidden -fvisibility=hidden")
target_link_libraries(OffscreenGecko "-Wl,--warn-unresolved-symbols -Wl,--as-needed")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-link_directories(${XULRUNNER_LIBRARY_DIRS})
IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
message("Creating relaytool files...")
execute_process(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 23:03:54
|
Revision: 99
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=99&view=rev
Author: res2002
Date: 2008-11-02 23:03:48 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Mark weak relayed symbols as weak
Modified Paths:
--------------
trunk/bin/relaytool
Modified: trunk/bin/relaytool
===================================================================
--- trunk/bin/relaytool 2008-11-02 17:16:36 UTC (rev 98)
+++ trunk/bin/relaytool 2008-11-02 23:03:48 UTC (rev 99)
@@ -122,9 +122,11 @@
if $using_partial_map; then
functions=$( grep "^F " "$partial_map" | cut -d' ' -f2 )
variables=$( grep "^V " "$partial_map" | cut -d' ' -f2 )
+ variables_weak=
else
functions=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "T") || ($2 == "W")) print $3; }' | LC_ALL=C grep -v '\(\<_init\>\|\<_fini\>\)' | LC_ALL=C sort -u )
- variables=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "D") || ($2 == "G") || ($2 == "B") || ($2 == "V")) print $3; }' | LC_ALL=C sort -u )
+ variables=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "D") || ($2 == "G") || ($2 == "B")) print $3; }' | LC_ALL=C sort -u )
+ variables_weak=$( nm --extern-only -D "$lib" | awk '{ if (($2 == "V")) print $3; }' | LC_ALL=C sort -u )
fi
if $using_minimal_list; then
functions="$functions
@@ -133,9 +135,12 @@
variables="$variables
$( nm `echo "$object_list"` | awk '{ if ($1 == "U") print $2; }' | LC_ALL=C sort -u )"
variables=$( echo "$variables" | LC_ALL=C sort | LC_ALL=C uniq -d )
+ variables_weak="$variables_weak
+$( nm `echo "$object_list"` | awk '{ if ($1 == "U") print $2; }' | LC_ALL=C sort -u )"
+ variables_weak=$( echo "$variables_weak" | LC_ALL=C sort | LC_ALL=C uniq -d )
fi
- if [ "$functions" == "" ] && [ "$variables" == "" ]; then
+ if [ "$functions" == "" ] && [ "$variables" == "" ] && [ "$variables_weak" == "" ]; then
# Nothing will be used, so do nothing for that lib
exit 1
fi
@@ -177,6 +182,9 @@
for s in $variables; do
echo " \"$s\"," >>"$outfile"
done
+ for s in $variables_weak; do
+ echo " \"$s\"," >>"$outfile"
+ done
echo " 0" >>"$outfile"
cat <<EOF >>"$outfile"
@@ -294,11 +302,15 @@
void* symptr;
EOF
- if [ "$variables" != "" ]; then echo " /* now fixup the global offset table for variable imports */" >>"$outfile"; fi
+ if [ "$variables" != "" ] || [ "$variables_weak" != "" ]; then echo " /* now fixup the global offset table for variable imports */" >>"$outfile"; fi
for s in $variables; do
echo " symptr = dlsym(handle, \"$s\");" >>"$outfile"
echo " FIXUP_GOT_RELOC( $s, symptr );" >>"$outfile"
done
+ for s in $variables_weak; do
+ echo " symptr = dlsym(handle, \"$s\");" >>"$outfile"
+ echo " FIXUP_GOT_RELOC( $s, symptr );" >>"$outfile"
+ done
cat <<EOF >>"$outfile"
}
@@ -366,6 +378,9 @@
for s in $variables; do
echo "int $s __attribute__(( visibility(\"hidden\") )) = -1;" >>"$outfile"
done
+ for s in $variables_weak; do
+ echo "int $s __attribute__((weak)) __attribute__(( visibility(\"hidden\") )) = -1;" >>"$outfile"
+ done
cat <<EOF >>"$outfile"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 17:16:40
|
Revision: 98
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=98&view=rev
Author: res2002
Date: 2008-11-02 17:16:36 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Documentation tweaks
Modified Paths:
--------------
trunk/docs/api.dox
trunk/include/OffscreenGecko/baseobj.h
trunk/include/OffscreenGecko/browser.h
Added Paths:
-----------
trunk/src/demos/doxygen_samples
Modified: trunk/docs/api.dox
===================================================================
--- trunk/docs/api.dox 2008-11-02 16:37:36 UTC (rev 97)
+++ trunk/docs/api.dox 2008-11-02 17:16:36 UTC (rev 98)
@@ -136,7 +136,7 @@
# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
-JAVADOC_AUTOBRIEF = NO
+JAVADOC_AUTOBRIEF = YES
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style
@@ -360,7 +360,7 @@
# by member name. If set to NO (the default) the members will appear in
# declaration order.
-SORT_BRIEF_DOCS = NO
+SORT_BRIEF_DOCS = YES
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to
@@ -493,7 +493,7 @@
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = include/
+INPUT = include/ src/demos/doxygen_samples
# This tag can be used to specify the character encoding of the source files that
# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
@@ -548,7 +548,7 @@
# directories that contain example code fragments that are included (see
# the \include command).
-EXAMPLE_PATH =
+EXAMPLE_PATH = $(TOP)/src/demos/
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
@@ -673,7 +673,7 @@
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
-IGNORE_PREFIX =
+IGNORE_PREFIX = osgk_
#---------------------------------------------------------------------------
# configuration options related to the HTML output
Modified: trunk/include/OffscreenGecko/baseobj.h
===================================================================
--- trunk/include/OffscreenGecko/baseobj.h 2008-11-02 16:37:36 UTC (rev 97)
+++ trunk/include/OffscreenGecko/baseobj.h 2008-11-02 17:16:36 UTC (rev 98)
@@ -54,6 +54,9 @@
*
* If you're programming in C++ instead, you might be more interested in
* <a href="annotated.html">the class list</a>.
+ *
+ * <em>Examples</em> can be found in the
+ * <a href="pages.html">Related Pages section</a>.
*/
/**\page Basics OffscreenGecko object basics
@@ -88,12 +91,12 @@
* \section BasicsCXX Dealing with OffscreenGecko objects (C++)
* The OffscreenGecko C++ interface wraps all OffscreenGecko objects into C++
* classes; so instead of calling a function and passing in the opaque object
- * pointer you can directly a method on the object. Furthermore, reference
+ * pointer you can directly call a method on the object. Furthermore, reference
* counting is handled automatically when an object is created, destroyed,
* copied etc.
*
* However, to use these classes efficiently, an implementation detail must be
- * noted: the classes merely wrap the opaque pointers from the C interface.
+ * noted: the C++ classes merely wrap the opaque pointers from the C interface.
* This has several implications:
* - A copy is not a true copy - the "copy" is merely an additional reference
* to the same object as the original.
@@ -102,26 +105,18 @@
* In that sense, the wrapper classes have a behaviour that more resembles Java
* references to classes than "true" C++ inlined classes.
*
- * An instance of the wrapped object is created immediately when the wrapper
- * class is constructed. Delayed creation is still possible, though: for that,
- * the wrapper must be initialized with a <i>null reference</i>. Later, a new
- * instance of the wrapper for the desired object can be assigned. Example:
- * \code
- * // Initializes as a "null reference"
- * OSGK::Browser myBrowser (OSGK::Browser::Null());
- *
- * // ... do other stuff ...
- *
- * // Now actually create an object
- * myBrowser = OSGK::Browser (...);
- * \endcode
+ * In C++, an instance of the wrapped object type is created immediately when
+ * the wrapper class is constructed. Delayed creation is still possible,
+ * though: for that, the wrapper must be initialized with a <i>null reference</i>.
+ * Later, a new instance of the wrapper type for the desired object can be assigned.
+ * For example code see \ref example_delayedcreation.
*/
-
+
/**
* Base OffscreenGecko object. All other types derive from this.
* @{
*/
-struct OSGK_BaseObject_s
+typedef struct OSGK_BaseObject_s
{
#ifdef OSGK_BUILD
///\internal Object reference count
@@ -131,8 +126,8 @@
int reserved;
# endif
#endif
-};
-typedef struct OSGK_BaseObject_s OSGK_BaseObject;
+}
+OSGK_BaseObject;
/** @} */
#define OSGK_DERIVEDTYPE(T) \
@@ -182,6 +177,10 @@
/// Wrapped object
T* obj;
public:
+ /**
+ * Return a <i>null instance</i> of the wrapped object type.
+ * Useful when creating objects in a delayed fashion.
+ */
static WrappedType* Null() { return 0; }
/// Construct with taking ownership of a given object.
Modified: trunk/include/OffscreenGecko/browser.h
===================================================================
--- trunk/include/OffscreenGecko/browser.h 2008-11-02 16:37:36 UTC (rev 97)
+++ trunk/include/OffscreenGecko/browser.h 2008-11-02 17:16:36 UTC (rev 98)
@@ -273,7 +273,7 @@
/**
* Allow subpixel antialiasing (aka ClearType). This should only be used
* when it's known that a surface pixel will exactly match an LCD pixel. If
- * that's not the case output will jave color fringes.
+ * that's not the case output will have color fringes.
*/
aaSubpixel
} OSGK_AntiAliasType;
Added: trunk/src/demos/doxygen_samples
===================================================================
--- trunk/src/demos/doxygen_samples (rev 0)
+++ trunk/src/demos/doxygen_samples 2008-11-02 17:16:36 UTC (rev 98)
@@ -0,0 +1,30 @@
+/**\file
+ * This is just a dummy container for the doxygen markup for the examples.
+ * The list of examples can be found in the <a href="pages.html">Related Pages section</a>.
+ */
+
+/** \page example_delayedcreation Example: Delayed creation of an OffscreenGecko object in C++
+ * In C++, an instance of the wrapped object type is created immediately when
+ * the wrapper class is constructed. Delayed creation is still possible,
+ * though: for that, the wrapper must be initialized with a <i>null reference</i>.
+ * Later, a new instance of the wrapper type for the desired object can be assigned.
+ * \code
+ * // Initializes as a "null reference"
+ * OSGK::Browser myBrowser (OSGK::Browser::Null());
+ *
+ * // ... do other stuff ...
+ *
+ * // Now actually create an object
+ * myBrowser = OSGK::Browser (...);
+ * \endcode
+ */
+
+/**
+ * \page example_web2image Example: Render web page to image file
+ * This is a simple application that renders a web page to a memory buffer
+ * and writes that to disk.
+ *
+ * (OSGK::TGAWriter is an OffscreenGecko-internal class; but the image
+ * writing is not the point of the example anyway.)
+ * \include webpage2image.cpp
+ */
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 16:37:39
|
Revision: 97
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=97&view=rev
Author: res2002
Date: 2008-11-02 16:37:36 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Doxygen docs style tweaks
Modified Paths:
--------------
trunk/docs/api.dox
Added Paths:
-----------
trunk/docs/doxygen.css
trunk/docs/header.html
Modified: trunk/docs/api.dox
===================================================================
--- trunk/docs/api.dox 2008-11-02 16:30:09 UTC (rev 96)
+++ trunk/docs/api.dox 2008-11-02 16:37:36 UTC (rev 97)
@@ -700,7 +700,7 @@
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
-HTML_HEADER =
+HTML_HEADER = $(TOP)/docs/header.html
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
@@ -715,7 +715,7 @@
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
-HTML_STYLESHEET =
+HTML_STYLESHEET = $(TOP)/docs/doxygen.css
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
Added: trunk/docs/doxygen.css
===================================================================
--- trunk/docs/doxygen.css (rev 0)
+++ trunk/docs/doxygen.css 2008-11-02 16:37:36 UTC (rev 97)
@@ -0,0 +1,366 @@
+BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+}
+BODY,TD {
+ /*font-size: 90%;*/
+}
+H1 {
+ text-align: center;
+ font-size: 160%;
+}
+H2 {
+ font-size: 120%;
+}
+H3 {
+ font-size: 100%;
+}
+CAPTION { font-weight: bold }
+DIV.qindex {
+ width: 100%;
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+ line-height: 140%;
+}
+DIV.nav {
+ width: 100%;
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+ line-height: 140%;
+}
+DIV.navtab {
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+TD.navtab {
+ font-size: 70%;
+}
+A.qindex {
+ text-decoration: none;
+ font-weight: bold;
+ color: #1A419D;
+}
+A.qindex:visited {
+ text-decoration: none;
+ font-weight: bold;
+ color: #1A419D
+}
+A.qindex:hover {
+ text-decoration: none;
+ background-color: #ddddff;
+}
+A.qindexHL {
+ text-decoration: none;
+ font-weight: bold;
+ background-color: #6666cc;
+ color: #ffffff;
+ border: 1px double #9295C2;
+}
+A.qindexHL:hover {
+ text-decoration: none;
+ background-color: #6666cc;
+ color: #ffffff;
+}
+A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }
+A.el { text-decoration: none; font-weight: bold }
+A.elRef { font-weight: bold }
+A.code:link { text-decoration: none; font-weight: normal; color: #0000FF}
+A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF}
+A.codeRef:link { font-weight: normal; color: #0000FF}
+A.codeRef:visited { font-weight: normal; color: #0000FF}
+A:hover { text-decoration: none; background-color: #f2f2ff }
+DL.el { margin-left: -1cm }
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 95%;
+}
+PRE.fragment {
+ border: 1px solid #CCCCCC;
+ background-color: #f5f5f5;
+ margin-top: 4px;
+ margin-bottom: 4px;
+ margin-left: 2px;
+ margin-right: 8px;
+ padding-left: 6px;
+ padding-right: 6px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
+
+DIV.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ margin-bottom: 6px;
+ font-weight: bold;
+}
+DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
+BODY {
+ background: white;
+ color: black;
+ margin-right: 20px;
+ margin-left: 20px;
+}
+TD.indexkey {
+ background-color: #e8eef2;
+ font-weight: bold;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ border: 1px solid #CCCCCC;
+}
+TD.indexvalue {
+ background-color: #e8eef2;
+ font-style: italic;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ border: 1px solid #CCCCCC;
+}
+TR.memlist {
+ background-color: #f0f0f0;
+}
+P.formulaDsp { text-align: center; }
+IMG.formulaDsp { }
+IMG.formulaInl { vertical-align: middle; }
+SPAN.keyword { color: #008000 }
+SPAN.keywordtype { color: #604020 }
+SPAN.keywordflow { color: #e08000 }
+SPAN.comment { color: #800000 }
+SPAN.preprocessor { color: #806020 }
+SPAN.stringliteral { color: #002080 }
+SPAN.charliteral { color: #008080 }
+.mdescLeft {
+ padding: 0px 8px 4px 8px;
+ font-size: 80%;
+ font-style: italic;
+ background-color: #FAFAFA;
+ border-top: 1px none #E0E0E0;
+ border-right: 1px none #E0E0E0;
+ border-bottom: 1px none #E0E0E0;
+ border-left: 1px none #E0E0E0;
+ margin: 0px;
+}
+.mdescRight {
+ padding: 0px 8px 4px 8px;
+ font-size: 80%;
+ font-style: italic;
+ background-color: #FAFAFA;
+ border-top: 1px none #E0E0E0;
+ border-right: 1px none #E0E0E0;
+ border-bottom: 1px none #E0E0E0;
+ border-left: 1px none #E0E0E0;
+ margin: 0px;
+}
+.memItemLeft {
+ padding: 1px 0px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: solid;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memItemRight {
+ padding: 1px 8px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: solid;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memTemplItemLeft {
+ padding: 1px 0px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: none;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memTemplItemRight {
+ padding: 1px 8px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: none;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.memTemplParams {
+ padding: 1px 0px 0px 8px;
+ margin: 4px;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ border-top-color: #E0E0E0;
+ border-right-color: #E0E0E0;
+ border-bottom-color: #E0E0E0;
+ border-left-color: #E0E0E0;
+ border-top-style: solid;
+ border-right-style: none;
+ border-bottom-style: none;
+ border-left-style: none;
+ color: #606060;
+ background-color: #FAFAFA;
+ font-size: 80%;
+}
+.search { color: #003399;
+ font-weight: bold;
+}
+FORM.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+INPUT.search { font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+TD.tiny { font-size: 75%;
+}
+a {
+ color: #1A41A8;
+}
+a:visited {
+ color: #2A3798;
+}
+.dirtab { padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #84b0c7;
+}
+TH.dirtab { background: #e8eef2;
+ font-weight: bold;
+}
+HR { height: 1px;
+ border: none;
+ border-top: 1px solid black;
+}
+
+/* Style for detailed member documentation */
+.memtemplate {
+ font-size: 80%;
+ color: #606060;
+ font-weight: normal;
+ margin-left: 3px;
+}
+.memnav {
+ background-color: #e8eef2;
+ border: 1px solid #84b0c7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+.memitem {
+ padding: 4px;
+ background-color: #eef3f5;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #dedeee;
+ -moz-border-radius: 8px 8px 8px 8px;
+}
+.memname {
+ white-space: nowrap;
+ font-weight: bold;
+}
+.memdoc{
+ padding-left: 10px;
+}
+.memproto {
+ background-color: #d5e1e8;
+ width: 100%;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #84b0c7;
+ font-weight: bold;
+ -moz-border-radius: 8px 8px 8px 8px;
+}
+.paramkey {
+ text-align: right;
+}
+.paramtype {
+ white-space: nowrap;
+}
+.paramname {
+ color: #602020;
+ font-style: italic;
+ white-space: nowrap;
+}
+/* End Styling for detailed member documentation */
+
+/* for the tree view */
+.ftvtree {
+ font-family: sans-serif;
+ margin:0.5em;
+}
+.directory { font-size: 9pt; font-weight: bold; }
+.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; }
+.directory > h3 { margin-top: 0; }
+.directory p { margin: 0px; white-space: nowrap; }
+.directory div { display: none; margin: 0px; }
+.directory img { vertical-align: -30%; }
+
+
+/* Tweak tabs */
+DIV.tabs A
+{
+ font-size: 100%;
+}
\ No newline at end of file
Added: trunk/docs/header.html
===================================================================
--- trunk/docs/header.html (rev 0)
+++ trunk/docs/header.html 2008-11-02 16:37:36 UTC (rev 97)
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+<title>$title</title>
+<link href="$relpath$tabs.css" rel="stylesheet" type="text/css">
+<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css">
+</head><body>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 16:30:14
|
Revision: 96
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=96&view=rev
Author: res2002
Date: 2008-11-02 16:30:09 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Script to upload API docs
Added Paths:
-----------
trunk/upload_api_docs.sh
Added: trunk/upload_api_docs.sh
===================================================================
--- trunk/upload_api_docs.sh (rev 0)
+++ trunk/upload_api_docs.sh 2008-11-02 16:30:09 UTC (rev 96)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+scp -r out/api res2002,off...@we...:/home/groups/o/of/offscreengecko/htdocs
Property changes on: trunk/upload_api_docs.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 16:24:28
|
Revision: 95
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=95&view=rev
Author: res2002
Date: 2008-11-02 16:24:22 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Building docs updates
Modified Paths:
--------------
trunk/docs/building-linux.txt
trunk/docs/building-win32.txt
Modified: trunk/docs/building-linux.txt
===================================================================
--- trunk/docs/building-linux.txt 2008-11-02 16:23:55 UTC (rev 94)
+++ trunk/docs/building-linux.txt 2008-11-02 16:24:22 UTC (rev 95)
@@ -4,6 +4,9 @@
- Compiler, of course. You may have to install extra packages on some
distros for that.
+ - cmake:
+ The build system used for OffscreenGecko. At least cmake 2.6 is required.
+
- A build of Gecko 1.9:
This can either be the pre-built XULrunner SDK, a version that ships with
your or a customized version built from the mozilla.org sources.
Modified: trunk/docs/building-win32.txt
===================================================================
--- trunk/docs/building-win32.txt 2008-11-02 16:23:55 UTC (rev 94)
+++ trunk/docs/building-win32.txt 2008-11-02 16:24:22 UTC (rev 95)
@@ -9,13 +9,11 @@
build.
- cmake:
- To generate project files (as they depend on local paths). Note that at
- least cmake 2.4.7 has a bug that prevents certain linker flags from
- appearing in the generated project files; however, at least version
- 2.5.20071122 works correctly.
+ To generate project files (as they depend on local paths). At least cmake 2.6
+ is required.
- A build of Gecko 1.9:
- This can either be the pre-built XULrunner SDK or any a customized version
+ This can either be the pre-built XULrunner SDK or a customized version
built from the mozilla.org sources.
Generating projects:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 16:24:01
|
Revision: 94
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=94&view=rev
Author: res2002
Date: 2008-11-02 16:23:55 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Create output dir for docs
Modified Paths:
--------------
trunk/build_api_docs.sh
Modified: trunk/build_api_docs.sh
===================================================================
--- trunk/build_api_docs.sh 2008-11-02 16:22:27 UTC (rev 93)
+++ trunk/build_api_docs.sh 2008-11-02 16:23:55 UTC (rev 94)
@@ -1,4 +1,5 @@
#!/bin/sh
export TOP=`pwd`
+mkdir -p out/api/
doxygen docs/api.dox
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 16:22:29
|
Revision: 93
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=93&view=rev
Author: res2002
Date: 2008-11-02 16:22:27 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Linux build docs
Added Paths:
-----------
trunk/docs/building-linux.txt
Added: trunk/docs/building-linux.txt
===================================================================
--- trunk/docs/building-linux.txt (rev 0)
+++ trunk/docs/building-linux.txt 2008-11-02 16:22:27 UTC (rev 93)
@@ -0,0 +1,22 @@
+BUILDING OFFSCREENGECKO FOR LINUX
+
+Prerequisites:
+ - Compiler, of course. You may have to install extra packages on some
+ distros for that.
+
+ - A build of Gecko 1.9:
+ This can either be the pre-built XULrunner SDK, a version that ships with
+ your or a customized version built from the mozilla.org sources.
+ Note that building against the version from your distro may mean that
+ OffscreenGecko does not work on other distros. For maximum compatibility
+ I recommend using a pre-built SDK and shipping the binaries from that with
+ your app.
+
+Actually building OffscreenGecko:
+ Run 'cmake' to generate Makefiles, run 'make' to do the building itself.
+ Currently, the application linking will result in a number of warnings for
+ unresolved symbols. These can be ignored.
+
+Caveat:
+ Main Linux development is done on Gentoo; OffscreenGecko works & builds there
+ with the distro-supplied XULrunner. For other distros YMMV.
Property changes on: trunk/docs/building-linux.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 15:58:04
|
Revision: 92
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=92&view=rev
Author: res2002
Date: 2008-11-02 15:57:49 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Make webpage2image obtain the preferred page size
Modified Paths:
--------------
trunk/src/demos/webpage2image.cpp
Modified: trunk/src/demos/webpage2image.cpp
===================================================================
--- trunk/src/demos/webpage2image.cpp 2008-11-02 15:56:53 UTC (rev 91)
+++ trunk/src/demos/webpage2image.cpp 2008-11-02 15:57:49 UTC (rev 92)
@@ -76,6 +76,16 @@
usleep (500);
}
+ // Get a size that covers all of the page without scrollbars
+ if (!browser.GetPreferredDimensions (renderW, renderH, renderW))
+ {
+ fputs ("Error when determining preferred image dimensions\n", stderr);
+ return 1;
+ }
+
+ // Set the browser size to the preferred size we just obtained
+ browser.Resize (renderW, renderH);
+
// Open output file
std::ofstream tgastream;
tgastream.open (outputFilename, std::ios::out | std::ios::binary);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 15:56:55
|
Revision: 91
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=91&view=rev
Author: res2002
Date: 2008-11-02 15:56:53 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Fix incomplete repaint after resize
Modified Paths:
--------------
trunk/src/libosgk/OffscreenWidget.cpp
Modified: trunk/src/libosgk/OffscreenWidget.cpp
===================================================================
--- trunk/src/libosgk/OffscreenWidget.cpp 2008-11-02 15:50:26 UTC (rev 90)
+++ trunk/src/libosgk/OffscreenWidget.cpp 2008-11-02 15:56:53 UTC (rev 91)
@@ -52,7 +52,7 @@
#ifdef REPAINT_DUMP
#include <fstream>
-#include "tgawrite.h"
+#include "../common/tgawrite.h"
#endif
namespace OSGK
@@ -171,6 +171,8 @@
nsEventStatus status;
DispatchEvent (&event, status);
+
+ Invalidate (false);
}
NS_IMETHODIMP OffscreenWidget::Validate()
@@ -306,39 +308,41 @@
PRBool result = true;
nsEventStatus eventStatus = nsEventStatus_eIgnore;
- if (dirtyRegion->IsEmpty()) return NS_OK;
+ if (dirtyRegion->IsEmpty() && (browser || surface)) return NS_OK;
+ nsCOMPtr<nsIRenderingContext> rc;
+ nsresult rv = mContext->CreateRenderingContextInstance (*getter_AddRefs(rc));
+ if (NS_FAILED(rv)) {
+ NS_WARNING("CreateRenderingContextInstance failed");
+ return NS_ERROR_FAILURE;
+ }
+
+ nsRefPtr<gfxASurface> targetSurface (GetThebesSurface ());
+ rv = rc->Init (mContext, targetSurface);
+ if (NS_FAILED(rv)) {
+ NS_WARNING("RC::Init failed");
+ return NS_ERROR_FAILURE;
+ }
+
#ifdef REPAINT_DUMP
+ gfxImageSurface* dumpSurface = static_cast<gfxImageSurface*> (targetSurface.get());
+
char filename[64];
std::ofstream tgastream;
AlphaCounter localCounter;
- if ((surface != 0) && (surface->Data() != 0))
+ if ((dumpSurface != 0) && (dumpSurface->Data() != 0))
{
snprintf (filename, sizeof (filename),
"paint_%08x_%u_%s.tga", this, paintCounter, localCounter.GetStr());
tgastream.open (filename, std::ios::out | std::ios::binary);
- const gfxIntSize& surfSize (surface->GetSize ());
+ const gfxIntSize& surfSize (dumpSurface->GetSize ());
TGAWriter::WriteBGRAImage (surfSize.width, surfSize.height,
- surface->Data(), tgastream);
+ dumpSurface->Data(), tgastream);
tgastream.close ();
}
++localCounter;
#endif
- nsCOMPtr<nsIRenderingContext> rc;
- nsresult rv = mContext->CreateRenderingContextInstance (*getter_AddRefs(rc));
- if (NS_FAILED(rv)) {
- NS_WARNING("CreateRenderingContextInstance failed");
- return NS_ERROR_FAILURE;
- }
-
- nsRefPtr<gfxASurface> targetSurface (GetThebesSurface ());
- rv = rc->Init (mContext, targetSurface);
- if (NS_FAILED(rv)) {
- NS_WARNING("RC::Init failed");
- return NS_ERROR_FAILURE;
- }
-
rc->SetClipRegion (*dirtyRegion, nsClipCombine_kReplace);
gfxContext* thebesContext = reinterpret_cast<gfxContext*> (
@@ -373,14 +377,14 @@
thebesContext->SetOperator(gfxContext::OPERATOR_OVER);
#ifdef REPAINT_DUMP
- if ((surface != 0) && (surface->Data() != 0))
+ if ((dumpSurface != 0) && (dumpSurface->Data() != 0))
{
snprintf (filename, sizeof (filename),
"paint_%08x_%u_%s.tga", this, paintCounter, localCounter.GetStr());
tgastream.open (filename, std::ios::out | std::ios::binary);
- const gfxIntSize& surfSize (surface->GetSize ());
+ const gfxIntSize& surfSize (dumpSurface->GetSize ());
TGAWriter::WriteBGRAImage (surfSize.width, surfSize.height,
- surface->Data(), tgastream);
+ dumpSurface->Data(), tgastream);
tgastream.close ();
}
#endif
@@ -394,14 +398,14 @@
#ifdef REPAINT_DUMP
++localCounter;
- if ((surface != 0) && (surface->Data() != 0))
+ if ((dumpSurface != 0) && (dumpSurface->Data() != 0))
{
snprintf (filename, sizeof (filename),
"paint_%08x_%u_%s.tga", this, paintCounter, localCounter.GetStr());
tgastream.open (filename, std::ios::out | std::ios::binary);
- const gfxIntSize& surfSize (surface->GetSize ());
+ const gfxIntSize& surfSize (dumpSurface->GetSize ());
TGAWriter::WriteBGRAImage (surfSize.width, surfSize.height,
- surface->Data(), tgastream);
+ dumpSurface->Data(), tgastream);
tgastream.close ();
}
++localCounter;
@@ -431,14 +435,14 @@
}
#ifdef REPAINT_DUMP
- if ((surface != 0) && (surface->Data() != 0))
+ if ((dumpSurface != 0) && (dumpSurface->Data() != 0))
{
snprintf (filename, sizeof (filename),
"paint_%08x_%u_%s.tga", this, paintCounter, localCounter.GetStr());
tgastream.open (filename, std::ios::out | std::ios::binary);
- const gfxIntSize& surfSize (surface->GetSize ());
+ const gfxIntSize& surfSize (dumpSurface->GetSize ());
TGAWriter::WriteBGRAImage (surfSize.width, surfSize.height,
- surface->Data(), tgastream);
+ dumpSurface->Data(), tgastream);
tgastream.close ();
}
paintCounter++;
@@ -515,6 +519,7 @@
gfxIntSize size (mBounds.width, mBounds.height);
surface = new gfxImageSurface (size,
gfxASurface::ImageFormatARGB32);
+ dirtyRegion->Union (0, 0, mBounds.width, mBounds.height);
}
return surface;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 15:50:30
|
Revision: 90
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=90&view=rev
Author: res2002
Date: 2008-11-02 15:50:26 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Add -fPIC
Modified Paths:
--------------
trunk/src/common/CMakeLists.txt
Modified: trunk/src/common/CMakeLists.txt
===================================================================
--- trunk/src/common/CMakeLists.txt 2008-11-02 15:49:48 UTC (rev 89)
+++ trunk/src/common/CMakeLists.txt 2008-11-02 15:50:26 UTC (rev 90)
@@ -1,2 +1,3 @@
file(GLOB sources *.cpp *.h)
+add_definitions("-fPIC")
add_library(osgk-common STATIC ${sources})
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 15:49:57
|
Revision: 89
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=89&view=rev
Author: res2002
Date: 2008-11-02 15:49:48 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Add function to get preferred size of displayed content
Modified Paths:
--------------
trunk/include/OffscreenGecko/browser.h
Modified: trunk/include/OffscreenGecko/browser.h
===================================================================
--- trunk/include/OffscreenGecko/browser.h 2008-11-02 04:44:16 UTC (rev 88)
+++ trunk/include/OffscreenGecko/browser.h 2008-11-02 15:49:48 UTC (rev 89)
@@ -377,6 +377,27 @@
/** @} */
+/**
+ * Get the preferred dimensions of the displayed content.
+ * The preferred dimensions are the dimensions at which no scrollbars have
+ * to be displayed and no lines have to be wrapped.
+ * \param browser The browser object.
+ * \param preferredWidth Returns the preferred width.
+ * \param preferredHeight Returns the preferred height.
+ * \param maxWidth Sets the maximum returned width. If -1 the width is
+ * unbounded.
+ * \return Whether obtaining the preferred width was successful. If not, the
+ * values referenced by \a preferredWidth and \a preferredHeight are
+ * unchanged.
+ * \remarks The returned preferred width may be larger than \a maxWidth if
+ * scrollbars would be displayed. Thus, if providing a maximum width of 0,
+ * the returned preferred width is the minimal width at which no scrollbars
+ * are displayed.
+ */
+OSGK_EXTERN_C OSGK_API int osgk_browser_get_preferred_dimensions (
+ OSGK_Browser* browser, int* preferredWidth, int* preferredHeight,
+ int maxWidth OSGK_DEFAULT_ARG(-1));
+
#ifdef __cplusplus
namespace OSGK
{
@@ -614,9 +635,31 @@
{
return osgk_browser_query_load_progress (GetObject());
}
-
/** @} */
- };
+
+ /**
+ * Get the preferred dimensions of the displayed content.
+ * The preferred dimensions are the dimensions at which no scrollbars have
+ * to be displayed and no lines have to be wrapped.
+ * \param preferredWidth Returns the preferred width.
+ * \param preferredHeight Returns the preferred height.
+ * \param maxWidth Sets the maximum returned width. If -1 the width is
+ * unbounded.
+ * \return Whether obtaining the preferred width was successful. If not, the
+ * values referenced by \a preferredWidth and \a preferredHeight are
+ * unchanged.
+ * \remarks The returned preferred width may be larger than \a maxWidth if
+ * scrollbars would be displayed. Thus, if providing a maximum width of 0,
+ * the returned preferred width is the minimal width at which no scrollbars
+ * are displayed.
+ */
+ bool GetPreferredDimensions (int& preferredWidth, int& preferredHeight,
+ int maxWidth = -1)
+ {
+ return osgk_browser_get_preferred_dimensions (GetObject(),
+ &preferredWidth, &preferredHeight, maxWidth) != 0;
+ }
+ };
} // namespace OSGK
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 04:44:29
|
Revision: 88
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=88&view=rev
Author: res2002
Date: 2008-11-02 04:44:16 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Add function to get preferred size of displayed content
Modified Paths:
--------------
trunk/src/libosgk/browser.cpp
trunk/src/libosgk/browser.h
Modified: trunk/src/libosgk/browser.cpp
===================================================================
--- trunk/src/libosgk/browser.cpp 2008-11-02 01:56:36 UTC (rev 87)
+++ trunk/src/libosgk/browser.cpp 2008-11-02 04:44:16 UTC (rev 88)
@@ -78,8 +78,21 @@
#include "embedding.h"
#include "OffscreenWidget.h"
+// HACKs to allow inclusion of nsPresContext.h
+#define nsAString_h___
+class nsAFlatCString;
+// HACKs to allow inclusion of nsIFrame.h
+#define nsString_h___
+
+#include GECKO_INCLUDE(content,nsIDocument.h)
+#include GECKO_INCLUDE(docshell,nsIDocShellTreeItem.h)
+#include GECKO_INCLUDE(dom,nsIDOMDocument.h)
#include GECKO_INCLUDE(dom,nsIDOMWindow.h)
#include GECKO_INCLUDE(embed_base,nsEmbedCID.h)
+#include GECKO_INCLUDE(generic,nsHTMLReflowState.h)
+#include GECKO_INCLUDE(layout,nsIDocumentViewer.h)
+#include GECKO_INCLUDE(layout,nsIFrame.h)
+#include GECKO_INCLUDE(layout,nsPresContext.h)
#include GECKO_INCLUDE(webbrwsr,nsIWebBrowserSetup.h)
#include GECKO_INCLUDE(widget,nsIWidget.h)
#include GECKO_INCLUDE(xpcom,nsComponentManagerUtils.h)
@@ -202,7 +215,15 @@
return static_cast<OSGK::Impl::Browser*> (browser)->QueryLoadProgress ();
}
+int osgk_browser_get_preferred_dimensions (OSGK_Browser* browser,
+ int* preferredWidth, int* preferredHeight,
+ int maxWidth)
+{
+ return static_cast<OSGK::Impl::Browser*> (browser)->GetPreferredDimensions (
+ *preferredWidth, *preferredHeight, maxWidth);
+}
+
namespace OSGK
{
namespace Impl
@@ -546,6 +567,89 @@
return container->QueryLoadProgress();
}
+ bool Browser::GetPreferredDimensions (int& preferredWidth,
+ int& preferredHeight,
+ int maxWidth)
+ {
+ nsCOMPtr<nsIDOMWindow> domWindow;
+ webBrowser->GetContentDOMWindow (getter_AddRefs(domWindow));
+ if (!domWindow) return false;
+
+ // Mostly lifted from Gecko DocumentViewerImpl::SizeToContent()
+ nsCOMPtr<nsIDOMDocument> domDoc;
+ domWindow->GetDocument (getter_AddRefs(domDoc));
+ NS_ENSURE_TRUE(domDoc, false);
+
+ nsCOMPtr<nsIDocument> doc (do_QueryInterface(domDoc));
+ NS_ENSURE_TRUE(doc, false);
+
+ nsIPresShell* presShell = doc->GetPrimaryShell();
+ NS_ENSURE_TRUE(presShell, false);
+
+ nsPresContext* presContext = presShell->GetPresContext ();
+ NS_ENSURE_TRUE(presContext, false);
+
+ nsCOMPtr<nsISupports> container (presContext->GetContainer());
+
+ nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(container));
+ NS_ENSURE_TRUE(docShellAsItem, false);
+
+ nsCOMPtr<nsIDocShellTreeItem> docShellParent;
+ docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));
+
+ // It's only valid to access this from a top frame. Doesn't work from
+ // sub-frames.
+ NS_ENSURE_TRUE(!docShellParent, false);
+
+ // Flush out all content and style updates. We can't use a resize reflow
+ // because it won't change some sizes that a style change reflow will.
+ doc->FlushPendingNotifications(Flush_Layout);
+
+ nsIFrame *root = presShell->GetRootFrame();
+ NS_ENSURE_TRUE(root, false);
+
+ maxWidth = presContext->DevPixelsToAppUnits (maxWidth-1);
+ nscoord prefWidth;
+ {
+ nsCOMPtr<nsIRenderingContext> rcx;
+ presShell->CreateRenderingContext(root, getter_AddRefs(rcx));
+ NS_ENSURE_TRUE(rcx, NS_ERROR_FAILURE);
+ nscoord minWidth = root->GetMinWidth(rcx);
+ prefWidth = root->GetPrefWidth(rcx);
+ if ((maxWidth >= 0) && (prefWidth > maxWidth))
+ prefWidth = maxWidth;
+ if (prefWidth < minWidth) prefWidth = minWidth;
+ }
+
+ nsresult rv = presShell->ResizeReflow(prefWidth, NS_UNCONSTRAINEDSIZE);
+ NS_ENSURE_SUCCESS(rv, false);
+
+ PRInt32 width, height;
+
+ // so how big is it?
+ nsRect shellArea = presContext->GetVisibleArea();
+ // Protect against bogus returns here
+ NS_ENSURE_TRUE(shellArea.width != NS_UNCONSTRAINEDSIZE &&
+ shellArea.height != NS_UNCONSTRAINEDSIZE,
+ false);
+ width = presContext->AppUnitsToDevPixels(shellArea.width);
+ height = presContext->AppUnitsToDevPixels(shellArea.height);
+
+ /* presContext's size was calculated in app units and has already been
+ rounded to the equivalent pixels (so the width/height calculation
+ we just performed was probably exact, though it was based on
+ values already rounded during ResizeReflow). In a surprising
+ number of instances, this rounding makes a window which for want
+ of one extra pixel's width ends up wrapping the longest line of
+ text during actual window layout. This makes the window too short,
+ generally clipping the OK/Cancel buttons. Here we add one pixel
+ to the calculated width, to circumvent this problem. */
+ preferredWidth = width + 1;
+ preferredHeight = height;
+
+ return true;
+ }
+
//-----------------------------------------------------------------------
NS_IMPL_ADDREF(Container)
Modified: trunk/src/libosgk/browser.h
===================================================================
--- trunk/src/libosgk/browser.h 2008-11-02 01:56:36 UTC (rev 87)
+++ trunk/src/libosgk/browser.h 2008-11-02 04:44:16 UTC (rev 88)
@@ -154,6 +154,9 @@
OSGK_LoadState QueryLoadState ();
float QueryLoadProgress ();
+
+ bool GetPreferredDimensions (int& preferredWidth, int& preferredHeight,
+ int maxWidth);
gfxASurface* GetSurface() { return surface; }
enum
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 01:56:51
|
Revision: 87
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=87&view=rev
Author: res2002
Date: 2008-11-02 01:56:36 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Add demo app to render a web page to a TGA file
Modified Paths:
--------------
trunk/src/CMakeLists.txt
Added Paths:
-----------
trunk/src/demos/
trunk/src/demos/CMakeLists.txt
trunk/src/demos/webpage2image.cpp
Modified: trunk/src/CMakeLists.txt
===================================================================
--- trunk/src/CMakeLists.txt 2008-11-02 01:56:08 UTC (rev 86)
+++ trunk/src/CMakeLists.txt 2008-11-02 01:56:36 UTC (rev 87)
@@ -2,3 +2,5 @@
add_subdirectory (common)
add_subdirectory (libosgk)
+
+add_subdirectory (demos)
Added: trunk/src/demos/CMakeLists.txt
===================================================================
--- trunk/src/demos/CMakeLists.txt (rev 0)
+++ trunk/src/demos/CMakeLists.txt 2008-11-02 01:56:36 UTC (rev 87)
@@ -0,0 +1,6 @@
+include_directories(../../include)
+add_executable(webpage2image webpage2image.cpp)
+target_link_libraries(webpage2image "-Wl,--warn-unresolved-symbols -Wl,--as-needed")
+target_link_libraries(webpage2image OffscreenGecko)
+target_link_libraries(webpage2image osgk-common)
+
Property changes on: trunk/src/demos/CMakeLists.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/src/demos/webpage2image.cpp
===================================================================
--- trunk/src/demos/webpage2image.cpp (rev 0)
+++ trunk/src/demos/webpage2image.cpp 2008-11-02 01:56:36 UTC (rev 87)
@@ -0,0 +1,92 @@
+/*
+
+Copyright (c) 2008, Frank Richter <fra...@gm...>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * The name of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stdio.h>
+#include <unistd.h> // for usleep()
+
+#include <OffscreenGecko/browser.h>
+
+#include <fstream>
+#include "../common/tgawrite.h"
+
+int main (int argc, const char* const argv[])
+{
+ if (argc != 3)
+ {
+ fputs ("expecting parameters: <URI to render> <output TGA file name>\n", stderr);
+ return 1;
+ }
+
+ const char* uri = argv[1];
+ const char* outputFilename = argv[2];
+ // Rendering dimensions
+ int renderW = 1024, renderH = 1024;
+
+ // To use OSGK we first need an embedding object.
+ OSGK_GeckoResult embedInitResult;
+ OSGK::Embedding embedding (embedInitResult);
+ if (!embedding.IsValid())
+ {
+ // This means something went wrong
+ fprintf (stderr, "Error initializing OSGK embedding (%.8x)\n", embedInitResult);
+ return 1;
+ }
+
+ // The browser object is the main workhorse for web page rendering.
+ OSGK::Browser browser (embedding, renderW, renderH);
+ if (!browser.IsValid())
+ {
+ fputs ("Error creating OSGK browser\n", stderr);
+ return 1;
+ }
+
+ // Instruct browser to navigate to the given URI
+ browser.Navigate (uri);
+
+ // Wait until the URI finished loading
+ while (browser.QueryLoadState() != loadFinished)
+ {
+ usleep (500);
+ }
+
+ // Open output file
+ std::ofstream tgastream;
+ tgastream.open (outputFilename, std::ios::out | std::ios::binary);
+ // Lock pixel data from browser object for retrieval
+ const unsigned char* lockedData = browser.LockData();
+ // Write output file
+ OSGK::TGAWriter::WriteBGRAImage (renderW, renderH, lockedData, tgastream);
+ // Clean up file
+ tgastream.close ();
+ // Unlock pixel data
+ browser.UnlockData (lockedData);
+
+ return 0;
+}
Property changes on: trunk/src/demos/webpage2image.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <re...@us...> - 2008-11-02 01:56:17
|
Revision: 86
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=86&view=rev
Author: res2002
Date: 2008-11-02 01:56:08 +0000 (Sun, 02 Nov 2008)
Log Message:
-----------
Add progress querying
Modified Paths:
--------------
trunk/include/OffscreenGecko/browser.h
trunk/src/libosgk/browser.cpp
trunk/src/libosgk/browser.h
Modified: trunk/include/OffscreenGecko/browser.h
===================================================================
--- trunk/include/OffscreenGecko/browser.h 2008-11-02 01:53:12 UTC (rev 85)
+++ trunk/include/OffscreenGecko/browser.h 2008-11-02 01:56:08 UTC (rev 86)
@@ -343,6 +343,40 @@
unsigned int key, void** data);
/** @} */
+/**\name Progress queries
+ * @{ */
+
+/// URI loading state
+typedef enum OSGK_LoadState
+{
+ /// Loading is in progress
+ loadLoading,
+ /// Loading is completed
+ loadFinished
+} OSGK_LoadState;
+
+/**
+ * Poll the loading state.
+ * \param browser The browser object.
+ * \return The loading state (loading or completed).
+ */
+OSGK_EXTERN_C OSGK_API OSGK_LoadState osgk_browser_query_load_state (
+ OSGK_Browser* browser);
+
+/**
+ * Poll the loading progress.
+ * \param browser The browser object.
+ * \return A float value between 0 and 1 where 0 means loading did not
+ * progress and 1 means loading is completed.
+ * \remarks This function is intended for feedback display. To programmatically
+ * check whether a URI was loaded completely use
+ * osgk_brower_query_load_state().
+ */
+OSGK_EXTERN_C OSGK_API float osgk_browser_query_load_progress (
+ OSGK_Browser* browser);
+
+/** @} */
+
#ifdef __cplusplus
namespace OSGK
{
@@ -556,7 +590,33 @@
return osgk_browser_get_user_data (GetObject(), key, &data) != 0;
}
/** @} */
- };
+
+ /**\name Progress queries
+ * @{ */
+
+ /**
+ * Poll the loading state.
+ * \return The loading state (loading or completed).
+ */
+ OSGK_LoadState QueryLoadState ()
+ {
+ return osgk_browser_query_load_state (GetObject());
+ }
+
+ /**
+ * Poll the loading progress.
+ * \return A float value between 0 and 1 where 0 means loading did not
+ * progress and 1 means loading is completed.
+ * \remarks This function is intended for feedback display. To programmatically
+ * check whether a URI was loaded completely use QueryLoadState().
+ */
+ float QueryLoadProgress ()
+ {
+ return osgk_browser_query_load_progress (GetObject());
+ }
+
+ /** @} */
+ };
} // namespace OSGK
#endif
Modified: trunk/src/libosgk/browser.cpp
===================================================================
--- trunk/src/libosgk/browser.cpp 2008-11-02 01:53:12 UTC (rev 85)
+++ trunk/src/libosgk/browser.cpp 2008-11-02 01:56:08 UTC (rev 86)
@@ -192,7 +192,17 @@
return static_cast<OSGK::Impl::Browser*> (browser)->GetUserData (key, *data);
}
+OSGK_LoadState osgk_browser_query_load_state (OSGK_Browser* browser)
+{
+ return static_cast<OSGK::Impl::Browser*> (browser)->QueryLoadState ();
+}
+float osgk_browser_query_load_progress (OSGK_Browser* browser)
+{
+ return static_cast<OSGK::Impl::Browser*> (browser)->QueryLoadProgress ();
+}
+
+
namespace OSGK
{
namespace Impl
@@ -205,6 +215,9 @@
{
nsIWebBrowser* webBrowser;
PRUint32 chromeFlags;
+
+ OSGK_LoadState loadState;
+ float loadProgress;
public:
Container ();
virtual ~Container ();
@@ -215,6 +228,8 @@
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIINTERFACEREQUESTOR
+ OSGK_LoadState QueryLoadState () { return loadState; }
+ float QueryLoadProgress () { return loadProgress; }
};
Browser::Browser (OSGK_GeckoResult& result, Embedding* embedding,
@@ -517,6 +532,20 @@
return true;
}
+ OSGK_LoadState Browser::QueryLoadState ()
+ {
+ if (!container) return loadFinished;
+ ProcessToolkitEvents ();
+ return container->QueryLoadState();
+ }
+
+ float Browser::QueryLoadProgress ()
+ {
+ if (!container) return 1.0f;
+ ProcessToolkitEvents ();
+ return container->QueryLoadProgress();
+ }
+
//-----------------------------------------------------------------------
NS_IMPL_ADDREF(Container)
@@ -531,7 +560,7 @@
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_END
- Container::Container ()
+ Container::Container () : loadState (loadFinished), loadProgress (1.0f)
{
}
@@ -699,24 +728,29 @@
PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
{
//WebBrowserChromeUI::UpdateProgress(this, curTotalProgress, maxTotalProgress);
+ loadProgress = (float)curTotalProgress/(float)maxTotalProgress;
return NS_OK;
}
NS_IMETHODIMP Container::OnStateChange(nsIWebProgress *progress, nsIRequest *request,
PRUint32 progressStateFlags, nsresult status)
{
- /*if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT))
+ if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT))
{
- WebBrowserChromeUI::UpdateBusyState(this, PR_TRUE);
+ //WebBrowserChromeUI::UpdateBusyState(this, PR_TRUE);
+ if (loadState != loadLoading) loadProgress = 0.0f;
+ loadState = loadLoading;
}
if ((progressStateFlags & STATE_STOP) && (progressStateFlags & STATE_IS_DOCUMENT))
{
- WebBrowserChromeUI::UpdateBusyState(this, PR_FALSE);
+ /*WebBrowserChromeUI::UpdateBusyState(this, PR_FALSE);
WebBrowserChromeUI::UpdateProgress(this, 0, 100);
WebBrowserChromeUI::UpdateStatusBarText(this, nsnull);
- ContentFinishedLoading();
- }*/
+ ContentFinishedLoading();*/
+ loadState = loadFinished;
+ loadProgress = 1.0f;
+ }
return NS_OK;
}
Modified: trunk/src/libosgk/browser.h
===================================================================
--- trunk/src/libosgk/browser.h 2008-11-02 01:53:12 UTC (rev 85)
+++ trunk/src/libosgk/browser.h 2008-11-02 01:56:08 UTC (rev 86)
@@ -151,6 +151,9 @@
bool SetUserData (unsigned int key, void* data, bool overrideData);
bool GetUserData (unsigned int key, void*& data);
+
+ OSGK_LoadState QueryLoadState ();
+ float QueryLoadProgress ();
gfxASurface* GetSurface() { return surface; }
enum
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|