Skip to content

Commit 134cc8a

Browse files
author
Roberto De Ioris
committed
added SWindow.set_as_owner(wid)
1 parent 9aeb22b commit 134cc8a

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

Source/UnrealEnginePython/Private/Slate/UEPySWindow.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
#include "Editor/MainFrame/Public/Interfaces/IMainFrameModule.h"
66
#endif
77

8+
#if PLATFORM_WINDOWS
9+
#include "Windows/AllowWindowsPlatformTypes.h"
10+
#endif
11+
812

913

1014
static PyObject *py_ue_swindow_set_title(ue_PySWindow *self, PyObject * args)
@@ -90,6 +94,21 @@ static PyObject *py_ue_swindow_get_handle(ue_PySWindow *self, PyObject * args)
9094
return PyLong_FromLongLong((long long)py_SWindow->GetNativeWindow()->GetOSWindowHandle());
9195
}
9296

97+
static PyObject *py_ue_swindow_set_as_owner(ue_PySWindow *self, PyObject * args)
98+
{
99+
ue_py_slate_cast(SWindow);
100+
long long window_ptr;
101+
if (!PyArg_ParseTuple(args, "L:set_as_owner", &window_ptr))
102+
{
103+
return nullptr;
104+
}
105+
void *whnd = py_SWindow->GetNativeWindow()->GetOSWindowHandle();
106+
#if PLATFORM_WINDOWS
107+
SetWindowLongPtr((HWND)window_ptr, GWLP_HWNDPARENT, (LONG_PTR)whnd);
108+
#endif
109+
Py_RETURN_NONE;
110+
}
111+
93112
static PyObject *py_ue_swindow_request_destroy(ue_PySWindow *self, PyObject * args)
94113
{
95114
ue_py_slate_cast(SWindow);
@@ -144,6 +163,7 @@ static PyMethodDef ue_PySWindow_methods[] = {
144163
{ "set_client_size", (PyCFunction)py_ue_swindow_resize, METH_VARARGS, "" },
145164
{ "set_content", (PyCFunction)py_ue_swindow_set_content, METH_VARARGS, "" },
146165
{ "get_handle", (PyCFunction)py_ue_swindow_get_handle, METH_VARARGS, "" },
166+
{ "set_as_owner", (PyCFunction)py_ue_swindow_set_as_owner, METH_VARARGS, "" },
147167
{ "request_destroy", (PyCFunction)py_ue_swindow_request_destroy, METH_VARARGS, "" },
148168
#if WITH_EDITOR
149169
{ "add_modal", (PyCFunction)py_ue_swindow_add_modal, METH_VARARGS, "" },

Source/UnrealEnginePython/Private/UnrealEnginePython.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
void unreal_engine_init_py_module();
2424
void init_unreal_engine_builtin();
2525

26-
#if defined(UNREAL_ENGINE_PYTHON_ON_LINUX)
26+
#if PLATFORM_LINUX
2727
const char *ue4_module_options = "linux_global_symbols";
2828
#endif
2929

Source/UnrealEnginePython/Public/UnrealEnginePython.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@
99

1010
//#define UEPY_MEMORY_DEBUG 1
1111

12-
#if defined(UNREAL_ENGINE_PYTHON_ON_MAC)
12+
13+
14+
15+
#include "CoreMinimal.h"
16+
#include "ModuleManager.h"
17+
#include "Styling/SlateStyle.h"
18+
#include "UObject/ScriptMacros.h"
19+
#include "Runtime/Launch/Resources/Version.h"
20+
21+
#if PLATFORM_MAC
1322
#include <Headers/Python.h>
1423
#include <Headers/structmember.h>
15-
#elif defined(UNREAL_ENGINE_PYTHON_ON_LINUX)
24+
#elif PLATFORM_LINUX
1625
#include <Python.h>
1726
#include <structmember.h>
18-
#else
27+
#elif PLATFORM_WINDOWS
1928
#include <include/pyconfig.h>
2029
#ifndef SIZEOF_PID_T
2130
#define SIZEOF_PID_T 4
@@ -24,13 +33,6 @@
2433
#include <include/structmember.h>
2534
#endif
2635

27-
28-
#include "CoreMinimal.h"
29-
#include "ModuleManager.h"
30-
#include "Styling/SlateStyle.h"
31-
#include "UObject/ScriptMacros.h"
32-
#include "Runtime/Launch/Resources/Version.h"
33-
3436
typedef struct
3537
{
3638
PyObject_HEAD

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ public UnrealEnginePython(TargetInfo Target)
232232
string libPath = GetMacPythonLibFile(pythonHome);
233233
PublicLibraryPaths.Add(Path.GetDirectoryName(libPath));
234234
PublicDelayLoadDLLs.Add(libPath);
235-
Definitions.Add(string.Format("UNREAL_ENGINE_PYTHON_ON_MAC"));
236235
}
237236
else if (Target.Platform == UnrealTargetPlatform.Linux)
238237
{
@@ -257,7 +256,6 @@ public UnrealEnginePython(TargetInfo Target)
257256
PublicIncludePaths.Add(items[0]);
258257
PublicAdditionalLibraries.Add(items[1]);
259258
}
260-
Definitions.Add(string.Format("UNREAL_ENGINE_PYTHON_ON_LINUX"));
261259
}
262260

263261
}

0 commit comments

Comments
 (0)