Skip to content

Commit

Permalink
クリップボードの文字列の取得・書き換え
Browse files Browse the repository at this point in the history
  • Loading branch information
wynd2608 committed Jul 8, 2017
1 parent 5ccebf6 commit 7bf2a12
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Siv3D/Source/Siv3D/Clipboard/CClipboard_Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# include <Siv3D/Platform.hpp>
# if defined(SIV3D_TARGET_LINUX)

# include <GL/glew.h>
# include "../../ThirdParty/GLFW/include/GLFW/glfw3.h"
# include "../Siv3DEngine.hpp"
# include "CClipboard_Linux.hpp"

namespace s3d
Expand All @@ -28,7 +31,8 @@ namespace s3d

bool CClipboard_Linux::init()
{
// [Siv3D ToDo]
m_glfwWindow = Siv3DEngine::GetWindow()->getHandle();

return true;
}

Expand All @@ -38,10 +42,16 @@ namespace s3d
return false;
}

bool CClipboard_Linux::getText(String&)
bool CClipboard_Linux::getText(String& text)
{
// [Siv3D ToDo]
return false;
const char* glfwText = glfwGetClipboardString(m_glfwWindow);
if (glfwText == nullptr)
return false;
else
{
text = CharacterSet::Widen(glfwText);
return true;
}
}

bool CClipboard_Linux::getImage(Image&)
Expand All @@ -58,7 +68,7 @@ namespace s3d

void CClipboard_Linux::setText(const String& text)
{
// [Siv3D ToDo]
glfwSetClipboardString(m_glfwWindow, text.narrow().c_str());
}

void CClipboard_Linux::setImage(const Image& image)
Expand All @@ -68,7 +78,7 @@ namespace s3d

void CClipboard_Linux::clear()
{
// [Siv3D ToDo]
glfwSetClipboardString(m_glfwWindow, "");
}
}

Expand Down
2 changes: 2 additions & 0 deletions Siv3D/Source/Siv3D/Clipboard/CClipboard_Linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@

# include "IClipboard.hpp"
# include <Siv3D/Image.hpp>
# include "../Window/IWindow.hpp"

namespace s3d
{
class CClipboard_Linux : public ISiv3DClipboard
{
private:
WindowHandle m_glfwWindow = nullptr;

public:

Expand Down

0 comments on commit 7bf2a12

Please sign in to comment.