API for registering MIME types for drag enter

This commit is contained in:
Kovid Goyal
2026-02-21 17:25:25 +05:30
parent 57e7dc2cdc
commit dea3ad5eed
4 changed files with 27 additions and 2 deletions

View File

@@ -3876,6 +3876,17 @@ glfwCocoaCycleThroughOSWindows(bool backwards) {
}
GLFWAPI void
glfwCocoaRegisterMIMETypes(GLFWwindow *window, const char **mimes, size_t count) {
_GLFWwindow *w = (_GLFWwindow*)window;
NSArray *currentTypes = [w->ns.view registeredDraggedTypes];
NSMutableArray *updatedTypes = [NSMutableArray arrayWithArray:currentTypes];
for (size_t i = 0; i < count; i++) {
NSString *uti = mime_to_uti(mimes[i]);
if (![updatedTypes containsObject:uti]) [updatedTypes addObject:uti];
}
[w->ns.view registerForDraggedTypes:updatedTypes];
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////

View File

@@ -316,6 +316,7 @@ def generate_wrappers(glfw_header: str) -> None:
void glfwCocoaCycleThroughOSWindows(bool backwards)
void glfwCocoaSetWindowChrome(GLFWwindow* window, unsigned int color, bool use_system_color, unsigned int system_color,\
int background_blur, unsigned int hide_window_decorations, bool show_text_in_titlebar, int color_space, float background_opacity, bool resizable)
void glfwCocoaRegisterMIMETypes(GLFWwindow *window, const char **mimes, size_t count)
const char* glfwGetPrimarySelectionString(GLFWwindow* window, void)
int glfwGetNativeKeyForName(const char* key_name, int case_sensitive)
void glfwRequestWaylandFrameEvent(GLFWwindow *handle, unsigned long long id, GLFWwaylandframecallbackfunc callback)