Revision: 16448
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16448
Author:   ben2610
Date:     2008-09-09 23:15:30 +0200 (Tue, 09 Sep 2008)

Log Message:
-----------
Patch 17508: Blender Web Plugin - XEmbed. Enable XEmbed integration of 
blenderplayer, using -i as input parameter to pass embedder window id. create a 
minimal web plugin to embed blenderplayer on web pages (using gecko/mozilla as 
browser). Only for *nix.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/intern/ghost/GHOST_ISystem.h
    trunk/blender/intern/ghost/GHOST_Types.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
    trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowX11.h
    trunk/blender/source/gameengine/GamePlayer/CMakeLists.txt
    trunk/blender/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
    trunk/blender/source/gameengine/GamePlayer/ghost/GPG_Application.h
    trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
    trunk/blender/source/gameengine/GamePlayer/netscape/test/resource/test.html

Added Paths:
-----------
    trunk/blender/source/gameengine/GamePlayer/xembed/
    trunk/blender/source/gameengine/GamePlayer/xembed/CMakeLists.txt
    trunk/blender/source/gameengine/GamePlayer/xembed/UnixShell.c
    trunk/blender/source/gameengine/GamePlayer/xembed/blender_plugin_types.h
    trunk/blender/source/gameengine/GamePlayer/xembed/npunix.c

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt        2008-09-09 20:52:18 UTC (rev 16447)
+++ trunk/blender/CMakeLists.txt        2008-09-09 21:15:30 UTC (rev 16448)
@@ -64,6 +64,7 @@
 OPTION(WITH_FFMPEG             "Enable FFMPeg Support 
(http://ffmpeg.mplayerhq.hu/)"   OFF)
 OPTION(WITH_OPENAL             "Enable OpenAL Support (http://www.openal.org)" 
        ON)
 OPTION(WITH_OPENMP             "Enable OpenMP (has to be supported by the 
compiler)"   OFF)
+OPTION(WITH_WEBPLUGIN          "Enable Web Plugin (Mozilla-Unix only)"         
        OFF)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -457,6 +458,13 @@
 SUBDIRS(source/creator)
 
 #-----------------------------------------------------------------------------
+# Blender WebPlugin
+IF(WITH_WEBPLUGIN) 
+  SET(MOZILLA_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK 
path")
+  SET(WITH_PLAYER ON)
+ENDIF(WITH_WEBPLUGIN)
+
+#-----------------------------------------------------------------------------
 # Blender Player
 IF(WITH_PLAYER)
   SUBDIRS(blenderplayer)

Modified: trunk/blender/intern/ghost/GHOST_ISystem.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystem.h  2008-09-09 20:52:18 UTC (rev 
16447)
+++ trunk/blender/intern/ghost/GHOST_ISystem.h  2008-09-09 21:15:30 UTC (rev 
16448)
@@ -224,13 +224,15 @@
         * @param       state           The state of the window when opened.
         * @param       type            The type of drawing context installed 
in this window.
         * @param       stereoVisual    Create a stereo visual for quad 
buffered stereo.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        virtual GHOST_IWindow* createWindow(
                const STR_String& title,
                GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, 
GHOST_TUns32 height,
                GHOST_TWindowState state, GHOST_TDrawingContextType type,
-               const bool stereoVisual) = 0;
+               const bool stereoVisual,
+               const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
 
        /**
         * Dispose a window.

Modified: trunk/blender/intern/ghost/GHOST_Types.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_Types.h    2008-09-09 20:52:18 UTC (rev 
16447)
+++ trunk/blender/intern/ghost/GHOST_Types.h    2008-09-09 21:15:30 UTC (rev 
16448)
@@ -100,6 +100,7 @@
        GHOST_kWindowStateMaximized,
        GHOST_kWindowStateMinimized,
        GHOST_kWindowStateFullScreen,
+       GHOST_kWindowStateEmbedded,
        GHOST_kWindowState8Normal = 8,
        GHOST_kWindowState8Maximized,
        GHOST_kWindowState8Minimized,
@@ -392,6 +393,15 @@
 } GHOST_DisplaySetting;
 
 
+#ifdef _WIN32
+typedef long GHOST_TEmbedderWindowID;
+#endif // _WIN32
+
+#ifndef _WIN32
+// I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window 
defined in winlay.h
+typedef int GHOST_TEmbedderWindowID;
+#endif // _WIN32
+
 /**
  * A timer task callback routine.
  * @param task The timer task object.

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp    2008-09-09 
20:52:18 UTC (rev 16447)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp    2008-09-09 
21:15:30 UTC (rev 16448)
@@ -402,7 +402,8 @@
        GHOST_TUns32 height,
        GHOST_TWindowState state,
        GHOST_TDrawingContextType type,
-       bool stereoVisual
+       bool stereoVisual,
+       const GHOST_TEmbedderWindowID parentWindow
 )
 {
     GHOST_IWindow* window = 0;

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h      2008-09-09 
20:52:18 UTC (rev 16447)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h      2008-09-09 
21:15:30 UTC (rev 16448)
@@ -103,6 +103,7 @@
         * @param       height  The height the window.
         * @param       state   The state of the window when opened.
         * @param       type    The type of drawing context installed in this 
window.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        virtual GHOST_IWindow* createWindow(
@@ -113,7 +114,8 @@
                GHOST_TUns32 height,
                GHOST_TWindowState state,
                GHOST_TDrawingContextType type,
-               const bool stereoVisual
+               const bool stereoVisual,
+               const GHOST_TEmbedderWindowID parentWindow = 0 
        );
        
        
/***************************************************************************************

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp     2008-09-09 
20:52:18 UTC (rev 16447)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp     2008-09-09 
21:15:30 UTC (rev 16448)
@@ -169,7 +169,7 @@
        const STR_String& title, 
        GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 
height,
        GHOST_TWindowState state, GHOST_TDrawingContextType type,
-       bool stereoVisual)
+       bool stereoVisual, const GHOST_TEmbedderWindowID parentWindow )
 {
        GHOST_Window* window = 0;
        window = new GHOST_WindowWin32 (title, left, top, width, height, state, 
type, stereoVisual);

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h       2008-09-09 
20:52:18 UTC (rev 16447)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h       2008-09-09 
21:15:30 UTC (rev 16448)
@@ -109,13 +109,14 @@
         * @param       height  The height the window.
         * @param       state   The state of the window when opened.
         * @param       type    The type of drawing context installed in this 
window.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        virtual GHOST_IWindow* createWindow(
                const STR_String& title,
                GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, 
GHOST_TUns32 height,
                GHOST_TWindowState state, GHOST_TDrawingContextType type,
-               const bool stereoVisual);
+               const bool stereoVisual, const GHOST_TEmbedderWindowID 
parentWindow = 0 );
 
        
/***************************************************************************************
         ** Event management functionality

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp       2008-09-09 
20:52:18 UTC (rev 16447)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp       2008-09-09 
21:15:30 UTC (rev 16448)
@@ -191,6 +191,7 @@
         * @param       height  The height the window.
         * @param       state   The state of the window when opened.
         * @param       type    The type of drawing context installed in this 
window.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
        GHOST_IWindow* 
@@ -203,14 +204,18 @@
        GHOST_TUns32 height,
        GHOST_TWindowState state,
        GHOST_TDrawingContextType type,
-       bool stereoVisual
+       bool stereoVisual,
+       const GHOST_TEmbedderWindowID parentWindow
 ){
        GHOST_WindowX11 * window = 0;
        
        if (!m_display) return 0;
        
+
+       
+
        window = new GHOST_WindowX11 (
-               this,m_display,title, left, top, width, height, state, type, 
stereoVisual
+               this,m_display,title, left, top, width, height, state, 
parentWindow, type, stereoVisual
        );
 
        if (window) {
@@ -511,7 +516,9 @@
                        }
                        break;
                }
-                       
+               
+               case DestroyNotify:
+                       ::exit(-1);     
                // We're not interested in the following things.(yet...)
                case NoExpose : 
                case GraphicsExpose :

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.h 2008-09-09 20:52:18 UTC 
(rev 16447)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.h 2008-09-09 21:15:30 UTC 
(rev 16448)
@@ -108,6 +108,7 @@
         * @param       state           The state of the window when opened.
         * @param       type            The type of drawing context installed 
in this window.
         * @param       stereoVisual    Create a stereo visual for quad 
buffered stereo.
+        * @param       parentWindow    Parent (embedder) window
         * @return      The new window (or 0 if creation failed).
         */
                GHOST_IWindow* 
@@ -119,9 +120,10 @@
                GHOST_TUns32 height,
                GHOST_TWindowState state,
                GHOST_TDrawingContextType type,
-               const bool stereoVisual
+               const bool stereoVisual,
+               const GHOST_TEmbedderWindowID parentWindow = 0 
        );
-        
+
        /**
         * @section Interface Inherited from GHOST_ISystem 
         */

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp       2008-09-09 
20:52:18 UTC (rev 16447)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp       2008-09-09 
21:15:30 UTC (rev 16448)
@@ -138,6 +138,7 @@
        GHOST_TUns32 width,     
        GHOST_TUns32 height,
        GHOST_TWindowState state,
+       const GHOST_TEmbedderWindowID parentWindow,
        GHOST_TDrawingContextType type,
        const bool stereoVisual
 ) :
@@ -205,21 +206,57 @@
 
        // create the window!
 
-       m_window = 
-               XCreateWindow(
-                       m_display, 
-                       RootWindow(m_display, m_visual->screen), 
-                       left,
-                       top,
-                       width,
-                       height,
-                       0, // no border.
-                       m_visual->depth,
-                       InputOutput, 
-                       m_visual->visual,
-                       CWBorderPixel|CWColormap|CWEventMask, 
-                       &xattributes
-               );
+       ;
+       if (parentWindow == 0) {
+               m_window = 
+                       XCreateWindow(
+                               m_display, 
+                               RootWindow(m_display, m_visual->screen), 
+                               left,
+                               top,
+                               width,
+                               height,
+                               0, // no border.
+                               m_visual->depth,
+                               InputOutput, 
+                               m_visual->visual,
+                               CWBorderPixel|CWColormap|CWEventMask, 
+                               &xattributes
+                       );
+       } else {
+
+               Window root_return;
+               int x_return,y_return;
+               unsigned int w_return,h_return,border_w_return,depth_return;
+               GHOST_TInt32 screen_x, screen_y;
+               
+               XGetGeometry(m_display, parentWindow, &root_return, &x_return, 
&y_return,
+                       &w_return, &h_return, &border_w_return, &depth_return );
+
+               left = 0;
+               top = 0;
+               width = w_return;
+               height = h_return;
+
+
+               m_window = XCreateWindow(
+                               m_display, 
+                               parentWindow,  // reparent against embedder 
+                               left,
+                               top,
+                               width,
+                               height,
+                               0, // no border.
+                               m_visual->depth,
+                               InputOutput, 
+                               m_visual->visual,
+                               CWBorderPixel|CWColormap|CWEventMask, 
+                               &xattributes
+                       );
+

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to