Skip to content

Commit

Permalink
[Windows] RegisterDragDrop に失敗してもエンジン初期化を続行 #1238
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Jun 29, 2024
1 parent 4b8e927 commit 78a09e2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,23 @@ namespace s3d

if (FAILED(::RegisterDragDrop(m_hWnd, m_pDropTarget)))
{
throw EngineError{ U"RegisterDragDrop() failed" };
LOG_WARNING(U"RegisterDragDrop() failed");
}
else
{
m_initialized = true;
}

m_pDropTarget->Release();
}

void CDragDrop::update()
{
if (not m_initialized)
{
return;
}

const auto status = m_pDropTarget->getStatus();

const Array<DroppedFilePath>& filePaths = std::get<Array<DroppedFilePath>>(status);
Expand All @@ -768,11 +777,21 @@ namespace s3d

void CDragDrop::acceptFilePaths(const bool accept)
{
if (not m_initialized)
{
return;
}

m_pDropTarget->acceptFilePaths(accept);
}

void CDragDrop::acceptText(const bool accept)
{
if (not m_initialized)
{
return;
}

m_pDropTarget->acceptText(accept);
}

Expand Down Expand Up @@ -829,13 +848,23 @@ namespace s3d

void CDragDrop::makeDragDrop(const Array<FilePath>& paths)
{
if (not m_initialized)
{
return;
}

std::lock_guard lock{ m_mutex };

m_newDragPaths = paths;
}

void CDragDrop::process()
{
if (not m_initialized)
{
return;
}

Array<FilePath> paths;

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ namespace s3d

HWND m_hWnd = nullptr;

bool m_initialized = false;

detail::DropTarget* m_pDropTarget = nullptr;

Array<DroppedFilePath> m_droppedFilePaths;
Expand Down

0 comments on commit 78a09e2

Please sign in to comment.