mirror of
https://github.com/glfw/glfw.git
synced 2025-06-07 08:14:57 +00:00
Merge b3577026c8
into 8e6c8d7eff
This commit is contained in:
commit
0389c447a9
@ -5833,6 +5833,9 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
||||||
|
|
||||||
|
// hacky way for a screenshot
|
||||||
|
GLFWAPI void glfwSetClipboardBitmap(unsigned char * data, int width, int height);
|
||||||
|
|
||||||
/*! @brief Returns the contents of the clipboard as a string.
|
/*! @brief Returns the contents of the clipboard as a string.
|
||||||
*
|
*
|
||||||
* This function returns the contents of the system clipboard, if it contains
|
* This function returns the contents of the system clipboard, if it contains
|
||||||
|
@ -1464,6 +1464,12 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
|||||||
_glfw.platform.setClipboardString(string);
|
_glfw.platform.setClipboardString(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetClipboardBitmap(unsigned char * data, int width, int height)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
_glfw.platform.setClipboardBitmap();
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
@ -750,6 +750,7 @@ struct _GLFWplatform
|
|||||||
void (*getRequiredInstanceExtensions)(char**);
|
void (*getRequiredInstanceExtensions)(char**);
|
||||||
GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t);
|
GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t);
|
||||||
VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||||
|
void (*setClipboardBitmap)();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Library global data
|
// Library global data
|
||||||
|
@ -675,6 +675,7 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
|
|||||||
_glfwGetRequiredInstanceExtensionsWin32,
|
_glfwGetRequiredInstanceExtensionsWin32,
|
||||||
_glfwGetPhysicalDevicePresentationSupportWin32,
|
_glfwGetPhysicalDevicePresentationSupportWin32,
|
||||||
_glfwCreateWindowSurfaceWin32,
|
_glfwCreateWindowSurfaceWin32,
|
||||||
|
_glfwSetClipboardBitmapWin32
|
||||||
};
|
};
|
||||||
|
|
||||||
*platform = win32;
|
*platform = win32;
|
||||||
|
@ -591,6 +591,7 @@ GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape);
|
|||||||
void _glfwDestroyCursorWin32(_GLFWcursor* cursor);
|
void _glfwDestroyCursorWin32(_GLFWcursor* cursor);
|
||||||
void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor);
|
void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor);
|
||||||
void _glfwSetClipboardStringWin32(const char* string);
|
void _glfwSetClipboardStringWin32(const char* string);
|
||||||
|
void _glfwSetClipboardBitmapWin32();
|
||||||
const char* _glfwGetClipboardStringWin32(void);
|
const char* _glfwGetClipboardStringWin32(void);
|
||||||
|
|
||||||
EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs);
|
EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs);
|
||||||
|
@ -2289,6 +2289,24 @@ void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwSetClipboardBitmapWin32(unsigned char * data, int width, int height) {
|
||||||
|
HBITMAP fillBm = NULL;
|
||||||
|
fillBm = CreateBitmap(width, height, 1, 32, data);
|
||||||
|
|
||||||
|
if (!OpenClipboard(_glfw.win32.helperWindowHandle)) {
|
||||||
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EmptyClipboard();
|
||||||
|
|
||||||
|
// place handle to clipboard
|
||||||
|
SetClipboardData(CF_BITMAP, fillBm);
|
||||||
|
|
||||||
|
// Close the clipboard.
|
||||||
|
CloseClipboard();
|
||||||
|
DeleteObject(fillBm);
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwSetClipboardStringWin32(const char* string)
|
void _glfwSetClipboardStringWin32(const char* string)
|
||||||
{
|
{
|
||||||
int characterCount, tries = 0;
|
int characterCount, tries = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user