[Bf-blender-cvs] [1c4ae8a11c8] master: UI: Removal of GHOST_CreateDialogWindow

Harley Acheson noreply at git.blender.org
Wed Feb 10 01:16:01 CET 2021


Commit: 1c4ae8a11c820e33da725816d7cccb2668680e51
Author: Harley Acheson
Date:   Tue Feb 9 16:14:31 2021 -0800
Branches: master
https://developer.blender.org/rB1c4ae8a11c820e33da725816d7cccb2668680e51

UI: Removal of GHOST_CreateDialogWindow

Simplification of window creation code to allow greater flexibility.

Differential Revision: https://developer.blender.org/D10311

Reviewed by Brecht Van Lommel

===================================================================

M	intern/ghost/GHOST_C-api.h
M	intern/ghost/intern/GHOST_C-api.cpp
M	intern/ghost/intern/GHOST_WindowX11.cpp
M	intern/ghost/test/gears/GHOST_C-Test.c
M	intern/ghost/test/multitest/MultiTest.c
M	source/blender/windowmanager/intern/wm_playanim.c
M	source/blender/windowmanager/intern/wm_window.c

===================================================================

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/inte

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list