clipboard refactoring
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoI_xD 2026-04-15 10:58:46 -07:00
commit b641a03bae
12 changed files with 116 additions and 73 deletions

View file

@ -362,10 +362,11 @@ MWDECL void MwGetScreenSize(MwWidget handle, MwRect* rect);
MWDECL int MwGetCoordinateType(MwWidget handle);
/*!
* @brief Queue to get clipboard content
* @brief Queue to get clipboard content.
* @param handle Widget
* @param clipboard_type The Clipboard Type to get. See MwClipboardType. This is ignored on backends that aren't X11/Wayland, so if you're unsure, just use MwClipboardMain
*/
MWDECL void MwGetClipboard(MwWidget handle);
MWDECL void MwGetClipboard(MwWidget handle, int clipboard_type);
#ifdef __cplusplus
}

View file

@ -234,8 +234,8 @@ MWDECL void (*MwLLEndStateChange)(MwLL handle);
MWDECL void (*MwLLFocus)(MwLL handle);
MWDECL void (*MwLLGrabPointer)(MwLL handle, int toggle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text);
MWDECL void (*MwLLGetClipboard)(MwLL handle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text, int clipboard_type);
MWDECL void (*MwLLGetClipboard)(MwLL handle, int clipboard_type);
MWDECL void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);

View file

@ -439,7 +439,7 @@ struct _MwLLWayland {
/* clipboard related stuff.
* Note that unlike most interfaces, we don't keep zwp_primary_selection stuff in a wayland_protocol_t because we use wl_data_device as a fallback and want to have it share memory space.*/
union {
struct {
struct wl_data_device_manager* wl;
struct zwp_primary_selection_device_manager_v1* zwp;
} clipboard_manager;
@ -451,7 +451,8 @@ struct _MwLLWayland {
MwBool supports_zwp;
uint32_t clipboard_serial;
wl_clipboard_device_context_t** clipboard_devices;
wl_clipboard_device_context_t** clipboard_devices_wl;
wl_clipboard_device_context_t** clipboard_devices_zwp;
struct wl_pointer* pointer;
MwU32 pointer_serial;

View file

@ -239,4 +239,12 @@ enum MwCoordinateType {
MwCoordinatesLocal,
};
/* The clipboard type that MwGetClipboard should return */
enum MwClipboardType {
/* the clipboard that is present on every platform that supports it */
MwClipboardMain = 0,
/* the "primary" clipboard that Wayland stores to emulate X11's behavior. */
MwClipboardPrimary,
};
#endif