diff options
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 17 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 21 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 61 | ||||
-rw-r--r-- | intern/ghost/test/gears/GHOST_C-Test.c | 4 | ||||
-rw-r--r-- | intern/ghost/test/multitest/MultiTest.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_playanim.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 43 |
7 files changed, 44 insertions, 110 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 2bc73f7eb22..d79111b742f 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -25,6 +25,8 @@ #include "GHOST_Types.h" +#include <stdbool.h> + #ifdef __cplusplus extern "C" { #endif @@ -160,6 +162,7 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle, * The new window is added to the list of windows managed. * Never explicitly delete the window, use disposeWindow() instead. * \param systemhandle: The handle to the system. + * \param parentWindow: Handle of parent (or owner) window, or NULL * \param title: The name of the window. * (displayed in the title bar of the window if the OS supports it). * \param left: The coordinate of the left edge of the window. @@ -167,31 +170,23 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle, * \param width: The width the window. * \param height: The height the window. * \param state: The state of the window when opened. + * \param is_dialog: Stay on top of parent window, no icon in taskbar, can't be minimized. * \param type: The type of drawing context installed in this window. * \param glSettings: Misc OpenGL options. * \return A handle to the new window ( == NULL if creation failed). */ extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, + GHOST_WindowHandle parent_windowhandle, const char *title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, + bool is_dialog, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings); -extern GHOST_WindowHandle GHOST_CreateDialogWindow(GHOST_SystemHandle systemhandle, - GHOST_WindowHandle parent_windowhandle, - const char *title, - GHOST_TInt32 left, - GHOST_TInt32 top, - GHOST_TUns32 width, - GHOST_TUns32 height, - GHOST_TWindowState state, - GHOST_TDrawingContextType type, - GHOST_GLSettings glSettings); - /** * Create a new offscreen context. * Never explicitly delete the context, use disposeContext() instead. diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index e4bb908fec8..af65e1cd4d2 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -153,34 +153,19 @@ GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle, } GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, + GHOST_WindowHandle parent_windowhandle, const char *title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, + bool is_dialog, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings) { GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (GHOST_WindowHandle)system->createWindow( - title, left, top, width, height, state, type, glSettings, false, false); -} - -GHOST_WindowHandle GHOST_CreateDialogWindow(GHOST_SystemHandle systemhandle, - GHOST_WindowHandle parent_windowhandle, - const char *title, - GHOST_TInt32 left, - GHOST_TInt32 top, - GHOST_TUns32 width, - GHOST_TUns32 height, - GHOST_TWindowState state, - GHOST_TDrawingContextType type, - GHOST_GLSettings glSettings) -{ - GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (GHOST_WindowHandle)system->createWindow(title, left, top, @@ -190,7 +175,7 @@ GHOST_WindowHandle GHOST_CreateDialogWindow(GHOST_SystemHandle systemhandle, type, glSettings, false, - true, + is_dialog, (GHOST_IWindow *)parent_windowhandle); } diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 86a7246a284..fc006c62803 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -293,55 +293,18 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system, m_display, RootWindow(m_display, m_visualInfo->screen), m_visualInfo->visual, AllocNone); /* create the window! */ - if ((parentWindow == 0) || is_dialog) { - m_window = XCreateWindow(m_display, - RootWindow(m_display, m_visualInfo->screen), - left, - top, - width, - height, - 0, /* no border. */ - m_visualInfo->depth, - InputOutput, - m_visualInfo->visual, - xattributes_valuemask, - &xattributes); - } - else { - Window root_return; - int x_return, y_return; - unsigned int w_return, h_return, border_w_return, depth_return; - - XGetGeometry(m_display, - parentWindow->m_window, - &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->m_window, /* reparent against embedder */ - left, - top, - width, - height, - 0, /* no border. */ - m_visualInfo->depth, - InputOutput, - m_visualInfo->visual, - xattributes_valuemask, - &xattributes); - - XSelectInput(m_display, parentWindow->m_window, SubstructureNotifyMask); - } + m_window = XCreateWindow(m_display, + RootWindow(m_display, m_visualInfo->screen), + left, + top, + width, + height, + 0, /* no border. */ + m_visualInfo->depth, + InputOutput, + m_visualInfo->visual, + xattributes_valuemask, + &xattributes); #ifdef WITH_XDND /* initialize drop target for newly created window */ diff --git a/intern/ghost/test/gears/GHOST_C-Test.c b/intern/ghost/test/gears/GHOST_C-Test.c index 3419f70dfcf..4283f990cfb 100644 --- a/intern/ghost/test/gears/GHOST_C-Test.c +++ b/intern/ghost/test/gears/GHOST_C-Test.c @@ -440,12 +440,14 @@ int main(int argc, char **argv) if (shSystem) { /* Create the main window */ sMainWindow = GHOST_CreateWindow(shSystem, + NULL, title1, 10, 64, 320, 200, GHOST_kWindowStateNormal, + false, GHOST_kDrawingContextTypeOpenGL, glSettings); if (!sMainWindow) { @@ -455,12 +457,14 @@ int main(int argc, char **argv) /* Create a secondary window */ sSecondaryWindow = GHOST_CreateWindow(shSystem, + NULL, title2, 340, 64, 320, 200, GHOST_kWindowStateNormal, + false, GHOST_kDrawingContextTypeOpenGL, glSettings); if (!sSecondaryWindow) { diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c index b6b83f2a47d..8c8858fc6d8 100644 --- a/intern/ghost/test/multitest/MultiTest.c +++ b/intern/ghost/test/multitest/MultiTest.c @@ -318,12 +318,14 @@ MainWindow *mainwindow_new(MultiTestApp *app) GHOST_GLSettings glSettings = {0}; win = GHOST_CreateWindow(sys, + NULL, "MultiTest:Main", 40, 40, 400, 400, GHOST_kWindowStateNormal, + false, GHOST_kDrawingContextTypeOpenGL, glSettings); @@ -573,12 +575,14 @@ LoggerWindow *loggerwindow_new(MultiTestApp *app) GHOST_GetMainDisplayDimensions(sys, &screensize[0], &screensize[1]); win = GHOST_CreateWindow(sys, + NULL, "MultiTest:Logger", 40, screensize[1] - 432, 800, 300, GHOST_kWindowStateNormal, + false, GHOST_kDrawingContextTypeOpenGL, glSettings); @@ -773,12 +777,14 @@ ExtraWindow *extrawindow_new(MultiTestApp *app) GHOST_WindowHandle win; win = GHOST_CreateWindow(sys, + NULL, "MultiTest:Extra", 500, 40, 400, 400, GHOST_kWindowStateNormal, + false, GHOST_kDrawingContextTypeOpenGL, glSettings); diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 60bcb687dbf..1b1ebc70fd9 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -1097,6 +1097,7 @@ static void playanim_window_open(const char *title, int posx, int posy, int size posy = (scr_h - posy - sizey); g_WS.ghost_window = GHOST_CreateWindow(g_WS.ghost_system, + NULL, title, posx, posy, @@ -1104,6 +1105,7 @@ static void playanim_window_open(const char *title, int posx, int posy, int size sizey, /* could optionally start fullscreen */ GHOST_kWindowStateNormal, + false, GHOST_kDrawingContextTypeOpenGL, glsettings); } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index c4b50f1c889..6433cd7d12d 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -560,14 +560,6 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, wmWindow *win, bool is_dialog) { - /* On Windows, if there is a parent window then force is_dialog. Otherwise the parent - handle is not used in window creation and they do not stay on top of parents. */ -#ifdef WIN32 - if (win->parent) { - is_dialog = true; - } -#endif - /* a new window is created when pageflip mode is required for a window */ GHOST_GLSettings glSettings = {0}; if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) { @@ -586,30 +578,17 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, wmWindow *prev_windrawable = wm->windrawable; wm_window_clear_drawable(wm); - GHOST_WindowHandle ghostwin; - if (is_dialog && win->parent) { - ghostwin = GHOST_CreateDialogWindow(g_system, - win->parent->ghostwin, - title, - win->posx, - posy, - win->sizex, - win->sizey, - (GHOST_TWindowState)win->windowstate, - GHOST_kDrawingContextTypeOpenGL, - glSettings); - } - else { - ghostwin = GHOST_CreateWindow(g_system, - title, - win->posx, - posy, - win->sizex, - win->sizey, - (GHOST_TWindowState)win->windowstate, - GHOST_kDrawingContextTypeOpenGL, - glSettings); - } + GHOST_WindowHandle ghostwin = GHOST_CreateWindow(g_system, + (win->parent) ? win->parent->ghostwin : NULL, + title, + win->posx, + posy, + win->sizex, + win->sizey, + (GHOST_TWindowState)win->windowstate, + is_dialog, + GHOST_kDrawingContextTypeOpenGL, + glSettings); if (ghostwin) { win->gpuctx = GPU_context_create(ghostwin); |