Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarley Acheson <harley.acheson@gmail.com>2021-02-10 03:14:31 +0300
committerHarley Acheson <harley.acheson@gmail.com>2021-02-10 03:14:31 +0300
commit1c4ae8a11c820e33da725816d7cccb2668680e51 (patch)
treea073665ca1d502e12ea90eeba3a9f1064aa01c39 /intern/ghost
parent5bddfde217b1477c02de9dcfa8c078969d432519 (diff)
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
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/GHOST_C-api.h17
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp21
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp61
-rw-r--r--intern/ghost/test/gears/GHOST_C-Test.c4
-rw-r--r--intern/ghost/test/multitest/MultiTest.c6
5 files changed, 31 insertions, 78 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);