<commit_before>
#include "ImwPlatformWindow.h"

#include "ImwWindowManager.h"
#include <imgui/imgui.h>
#include <imgui/imgui_internal.h>

using namespace ImWindow;

ImwPlatformWindow::ImwPlatformWindow(bool bMain, bool bIsDragWindow)
{
	m_bMain = bMain;
	m_bIsDragWindow = bIsDragWindow;
	m_pContainer = new ImwContainer(NULL);
	m_pState = NULL;
	m_pPreviousState = NULL;

	void* pTemp = ImGui::GetInternalState();
	m_pState = ImwMalloc(ImGui::GetInternalStateSize());
	memcpy(m_pState, ImGui::GetInternalState(), ImGui::GetInternalStateSize());
	ImGui::SetInternalState(m_pState);
	//ImGui::SetInternalState(m_pState, true);
	ImGui::SetInternalState(pTemp);
}

ImwPlatformWindow::~ImwPlatformWindow()
{
	ImwSafeDelete(m_pContainer);
	ImwSafeDelete(m_pState);
}

void ImwPlatformWindow::OnClose()
{
	ImwWindowManager::GetInstance()->OnClosePlatformWindow(this);
	delete this;
}

void ImwPlatformWindow::SetState()
{
	m_pPreviousState = ImGui::GetInternalState();
	ImGui::SetInternalState(m_pState);
}

void ImwPlatformWindow::RestoreState()
{
	ImGui::SetInternalState(m_pPreviousState);
}

void ImwPlatformWindow::Paint()
{
	ImwWindowManager::GetInstance()->Paint(this);
}

bool ImwPlatformWindow::IsMain()
{
	return m_bMain;
}

void ImwPlatformWindow::Dock(ImwWindow* pWindow)
{
	m_pContainer->Dock(pWindow);
}

bool ImwPlatformWindow::UnDock(ImwWindow* pWindow)
{
	return m_pContainer->UnDock(pWindow);
}

ImwContainer* ImwPlatformWindow::GetContainer()<commit_msg>Copy ImGuiStyle on SetState and RestoreState<commit_after>
#include "ImwPlatformWindow.h"

#include "ImwWindowManager.h"
#include <imgui/imgui.h>
#include <imgui/imgui_internal.h>

using namespace ImWindow;

ImwPlatformWindow::ImwPlatformWindow(bool bMain, bool bIsDragWindow)
{
	m_bMain = bMain;
	m_bIsDragWindow = bIsDragWindow;
	m_pContainer = new ImwContainer(NULL);
	m_pState = NULL;
	m_pPreviousState = NULL;

	void* pTemp = ImGui::GetInternalState();
	m_pState = ImwMalloc(ImGui::GetInternalStateSize());
	memcpy(m_pState, ImGui::GetInternalState(), ImGui::GetInternalStateSize());
	ImGui::SetInternalState(m_pState);
	//ImGui::SetInternalState(m_pState, true);
	ImGui::SetInternalState(pTemp);
}

ImwPlatformWindow::~ImwPlatformWindow()
{
	ImwSafeDelete(m_pContainer);
	ImwSafeDelete(m_pState);
}

void ImwPlatformWindow::OnClose()
{
	ImwWindowManager::GetInstance()->OnClosePlatformWindow(this);
	delete this;
}

void ImwPlatformWindow::SetState()
{
	m_pPreviousState = ImGui::GetInternalState();
	ImGui::SetInternalState(m_pState);
	memcpy(&((ImGuiState*)m_pState)->Style, &((ImGuiState*)m_pPreviousState)->Style, sizeof(ImGuiStyle));
}

void ImwPlatformWindow::RestoreState()
{
	memcpy(&((ImGuiState*)m_pPreviousState)->Style, &((ImGuiState*)m_pState)->Style, sizeof(ImGuiStyle));
	ImGui::SetInternalState(m_pPreviousState);
}

void ImwPlatformWindow::Paint()
{
	ImwWindowManager::GetInstance()->Paint(this);
}

bool ImwPlatformWindow::IsMain()
{
	return m_bMain;
}

void ImwPlatformWindow::Dock(ImwWindow* pWindow)
{
	m_pContainer->Dock(pWindow);
}

bool ImwPlatformWindow::UnDock(ImwWindow* pWindow)
{
	return m_pContainer->UnDock(pWindow);
}

ImwContainer* ImwPlatformWindow::GetContainer()
{'fraction_non_alphanumeric': 0.13749605802585935, 'fraction_numerical': 0.0, 'mean_word_length': 9.2987012987013, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5806103', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1160, 'n_words': 156}