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")
# Blender Application
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)
* @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.
GHOST_kWindowStateMaximized,
GHOST_kWindowStateMinimized,
GHOST_kWindowStateFullScreen,
+ GHOST_kWindowStateEmbedded,
GHOST_kWindowState8Normal = 8,
GHOST_kWindowState8Maximized,
GHOST_kWindowState8Minimized,
} 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.
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
- bool stereoVisual
+ bool stereoVisual,
+ const GHOST_TEmbedderWindowID parentWindow
)
{
GHOST_IWindow* window = 0;
* @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(
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
- const bool stereoVisual
+ const bool stereoVisual,
+ const GHOST_TEmbedderWindowID parentWindow = 0
);
/***************************************************************************************
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);
* @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
* @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*
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) {
}
break;
}
-
+
+ case DestroyNotify:
+ ::exit(-1);
// We're not interested in the following things.(yet...)
case NoExpose :
case GraphicsExpose :
* @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*
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
*/
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
+ const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type,
const bool stereoVisual
) :
// 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
+ );
+
+ XSelectInput(m_display , parentWindow, SubstructureNotifyMask);
+
+ }
// Are we in fullscreen mode - then include
* @param width The width the window.
* @param height The height the window.
* @param state The state the window is initially opened with.
+ * @param parentWindow Parent (embedder) window
* @param type The type of drawing context installed in this window.
* @param stereoVisual Stereo visual for quad buffered stereo.
*/
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
+ const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false
);
# ***** END GPL LICENSE BLOCK *****
SUBDIRS(common ghost)
+
+IF(WITH_WEBPLUGIN)
+ SUBDIRS(xembed)
+ENDIF(WITH_WEBPLUGIN)
m_blendermat(0),
m_blenderglslmat(0),
m_pyGlobalDictString(0),
- m_pyGlobalDictString_Length(0)
+ m_pyGlobalDictString_Length(0),
+ m_isEmbedded(false)
{
fSystem = system;
}
return success;
}
+bool GPG_Application::startEmbeddedWindow(STR_String& title,
+ const GHOST_TEmbedderWindowID parentWindow,
+ const bool stereoVisual,
+ const int stereoMode) {
+
+ m_mainWindow = fSystem->createWindow(title, 0, 0, 0, 0, GHOST_kWindowStateNormal,
+ GHOST_kDrawingContextTypeOpenGL, stereoVisual, parentWindow);
+
+ if (!m_mainWindow) {
+ printf("error: could not create main window\n");
+ exit(-1);
+ }
+ m_isEmbedded = true;
+
+ bool success = initEngine(m_mainWindow, stereoMode);
+ if (success) {
+ success = startEngine();
+ }
+ return success;
+}
bool GPG_Application::startFullScreen(
GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>(eventData);
//no need for this test
//if (fSystem->getFullScreen()) {
- if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc) {
+ if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc && !m_isEmbedded) {
m_exitRequested = KX_EXIT_REQUEST_OUTSIDE;
}
//}
bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight,
const bool stereoVisual, const int stereoMode);
bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
+ bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode);
#ifdef WIN32
bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode);
bool m_engineInitialized;
/** Engine state. */
bool m_engineRunning;
+ /** Running on embedded window */
+ bool m_isEmbedded;
/** the gameengine itself */
KX_KetsjiEngine* m_ketsjiengine;
printf(" anaglyph (Red-Blue glasses)\n");
printf(" vinterlace (Vertical interlace for autostereo display)\n");
printf(" depending on the type of stereo you want\n");
+#ifndef _WIN32
+ printf(" -i: parent windows ID \n");
+#endif
#ifdef _WIN32
printf(" -c: keep console window open\n");
#endif
int fullScreenFrequency = 60;
char* pyGlobalDictString = NULL; /* store python dict data between blend file loading */
int pyGlobalDictString_Length = 0;
+ GHOST_TEmbedderWindowID parentWindow = 0;
+
+
#ifdef __linux__
#ifdef __alpha__
usage(argv[0]);
return 0;
break;
+#ifndef _WIN32
+ case 'i':
+ i++;
+ if ( (i + 1) < argc )
+ parentWindow = atoi(argv[i++]);
+#ifndef NDEBUG
+ printf("XWindows ID = %d\n", parentWindow);
+#endif //NDEBUG
+
+#endif // _WIN32
case 'c':
i++;
closeConsole = false;
else
#endif
{
- app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
+ if (parentWindow != 0)
+ app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode);
+ else
+ app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
stereoWindow, stereomode);
}
}