many things changed
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-04-17 01:36:34 +09:00
commit 570f05540e
Signed by: nishi
GPG key ID: 27EF69B208EB9343
25 changed files with 258 additions and 208 deletions

View file

@ -42,9 +42,9 @@ static void clipboard(MwWidget handle, void* user_data, void* call_data) {
static void tick(MwWidget handle, void* user_data, void* call_data) {
cur_text = text1;
MwGetClipboard(handle, MwClipboardMain);
MwGetClipboard(handle, MwCLIPBOARD_MAIN);
cur_text = text2;
MwGetClipboard(handle, MwClipboardPrimary);
MwGetClipboard(handle, MwCLIPBOARD_PRIMARY);
MwForceRender(window);
}

View file

@ -51,12 +51,12 @@ static void tick(MwWidget handle, void* user, void* call) {
}
static void mouse(MwWidget handle, void* user, void* call) {
MwLLMouse* mouse = call;
MwMouse* mouse = call;
(void)handle;
(void)user;
if(mouse->button == MwLLMouseLeft) {
if(mouse->button == MwMOUSE_LEFT) {
t[ct].points[click * 2 + 0] = mouse->point.x;
t[ct].points[click * 2 + 1] = mouse->point.y;
click++;
@ -82,7 +82,7 @@ static void mouse(MwWidget handle, void* user, void* call) {
for(i = 0; i < ct; i++) t[i] = old[i];
free(old);
}
} else if(mouse->button == MwLLMouseRight) {
} else if(mouse->button == MwMOUSE_RIGHT) {
if(click > 0) {
click = 0;
} else if(ct > 0) {

View file

@ -232,15 +232,15 @@ void vulkan_setup(MwWidget handle) {
VkFenceCreateInfo fenceInfo = {};
int err = 0;
_vkGetInstanceProcAddr = MwVulkanGetField(handle, MwVulkanField_GetInstanceProcAddr, &err);
instance = MwVulkanGetField(handle, MwVulkanField_Instance, &err);
device = MwVulkanGetField(handle, MwVulkanField_LogicalDevice, &err);
physicalDevice = MwVulkanGetField(handle, MwVulkanField_PhysicalDevice, &err);
graphicsQueue = MwVulkanGetField(handle, MwVulkanField_GraphicsQueue, &err);
presentQueue = MwVulkanGetField(handle, MwVulkanField_PresentQueue, &err);
surface = MwVulkanGetField(handle, MwVulkanField_Surface, &err);
presentQueueIndex = MwVulkanGetField(handle, MwVulkanField_PresentQueueIndex, &err);
graphicsQueueIndex = MwVulkanGetField(handle, MwVulkanField_GraphicsQueueIndex, &err);
_vkGetInstanceProcAddr = MwVulkanGetField(handle, MwVULKANFIELD_GETINSTANCEPROCADDR, &err);
instance = MwVulkanGetField(handle, MwVULKANFIELD_INSTANCE, &err);
device = MwVulkanGetField(handle, MwVULKANFIELD_LOGICALDEVICE, &err);
physicalDevice = MwVulkanGetField(handle, MwVULKANFIELD_PHYSICALDEVICE, &err);
graphicsQueue = MwVulkanGetField(handle, MwVULKANFIELD_GRAPHICSQUEUE, &err);
presentQueue = MwVulkanGetField(handle, MwVULKANFIELD_PRESENTQUEUE, &err);
surface = MwVulkanGetField(handle, MwVULKANFIELD_SURFACE, &err);
presentQueueIndex = MwVulkanGetField(handle, MwVULKANFIELD_PRESENTQUEUEINDEX, &err);
graphicsQueueIndex = MwVulkanGetField(handle, MwVULKANFIELD_GRAPHICSQUEUEINDEX, &err);
LOAD_VK_FUNCTION(vkCreateShaderModule);
LOAD_VK_FUNCTION(vkCreatePipelineLayout);

View file

@ -99,4 +99,26 @@ enum MwMB_ICON {
*/
#define MwMB_BUTTONYESNOCANCEL (MwMB_BUTTONYES | MwMB_BUTTONNO | MwMB_BUTTONCANCEL)
/* Whether or not GetXY/SetXY works with global or local coordinates */
enum MwCOORDINATE {
MwCOORDINATE_GLOBAL = 0,
MwCOORDINATE_LOCAL,
};
/* The clipboard type that MwGetClipboard should return */
enum MwCLIPBOARD {
/* the clipboard that is present on every platform that supports it */
MwCLIPBOARD_MAIN = 0,
/* the "primary" clipboard that Wayland stores to emulate X11's behavior. */
MwCLIPBOARD_PRIMARY,
};
enum MwMOUSE {
MwMOUSE_LEFT = 1,
MwMOUSE_MIDDLE,
MwMOUSE_RIGHT,
MwMOUSE_WHEELUP,
MwMOUSE_WHEELDOWN
};
#endif

View file

@ -10,7 +10,6 @@
#include <Mw/MachDep.h>
typedef struct _MwLLHandler* MwLLHandler;
typedef struct _MwLLMouse MwLLMouse;
typedef struct _MwLLCommon* MwLLCommon;
typedef struct _MwLLCommonColor* MwLLCommonColor;
typedef struct _MwLLCommonPixmap* MwLLCommonPixmap;
@ -187,19 +186,6 @@ enum MwLLKeyEnum {
#define MwLLControlMask MwLLKeyMask | (1 << 30)
#define MwLLAltMask MwLLKeyMask | (1 << 29)
enum MwLLMouseEnum {
MwLLMouseLeft = 1,
MwLLMouseMiddle,
MwLLMouseRight,
MwLLMouseWheelUp,
MwLLMouseWheelDown
};
struct _MwLLMouse {
MwPoint point;
int button;
};
struct _MwLLHandler {
void (*draw)(MwLL handle, void* data);
void (*up)(MwLL handle, void* data);

View file

@ -60,24 +60,27 @@
#define MwNmonospaceFont "VmonospaceFont"
#define MwNboldMonospaceFont "VboldMonospaceFont"
#define MwNactivateHandler "Cactivate" /* NULL/int* (MwListBox)/void* (MwTreeView) */
#define MwNresizeHandler "Cresize" /* NULL */
#define MwNtickHandler "Ctick" /* NULL */
#define MwNmenuHandler "Cmenu" /* MwMenu */
#define MwNmouseDownHandler "CmouseDown" /* MwLLMouse* */
#define MwNmouseUpHandler "CmouseUp" /* same as MwNmouseDownHandler */
#define MwNmouseMoveHandler "CmouseMove" /* MwPoint* */
#define MwNchangedHandler "Cchanged" /* NULL/int* (MwComboBox) */
#define MwNkeyHandler "Ckey" /* int* (MwLLKeyEnum or character code) */
#define MwNkeyReleaseHandler "CkeyRelease" /* same as MwNkeyHandler */
#define MwNcloseHandler "Cclose" /* NULL */
#define MwNfocusInHandler "CfocusIn" /* NULL */
#define MwNfocusOutHandler "CfocusOut" /* NULL */
#define MwNfileChosenHandler "CfileChosen" /* char* */
#define MwNdirectoryChosenHandler "CdirectoryChosen" /* char* */
#define MwNcolorChosenHandler "CcolorChosen" /* MwRGB* */
#define MwNdrawHandler "Cdraw" /* NULL */
#define MwNclipboardHandler "Cclipboard" /* char* */
#define MwNdarkThemeHandler "CdarkTheme" /* int* */
#define MwNactivateHandler "Cactivate" /* NULL */
#define MwNlistBoxActivateHandler "ClistBoxActivate" /* int* */
#define MwNtreeViewActivateHandler "CtreeViewActivate" /* void* */
#define MwNresizeHandler "Cresize" /* NULL */
#define MwNtickHandler "Ctick" /* NULL */
#define MwNmenuHandler "Cmenu" /* MwMenu */
#define MwNmouseDownHandler "CmouseDown" /* MwMouse* */
#define MwNmouseUpHandler "CmouseUp" /* same as MwNmouseDownHandler */
#define MwNmouseMoveHandler "CmouseMove" /* MwPoint* */
#define MwNchangedHandler "Cchanged" /* NULL */
#define MwNcomboBoxChangedHandler "CcomboBoxChanged" /* int* */
#define MwNkeyHandler "Ckey" /* int* (MwLLKeyEnum or character code) */
#define MwNkeyReleaseHandler "CkeyRelease" /* same as MwNkeyHandler */
#define MwNcloseHandler "Cclose" /* NULL */
#define MwNfocusInHandler "CfocusIn" /* NULL */
#define MwNfocusOutHandler "CfocusOut" /* NULL */
#define MwNfileChosenHandler "CfileChosen" /* char* */
#define MwNdirectoryChosenHandler "CdirectoryChosen" /* char* */
#define MwNcolorChosenHandler "CcolorChosen" /* MwRGB* */
#define MwNdrawHandler "Cdraw" /* NULL */
#define MwNclipboardHandler "Cclipboard" /* char* */
#define MwNdarkThemeHandler "CdarkTheme" /* int* */
#endif

View file

@ -28,6 +28,7 @@ typedef struct _MwTreeViewEntry MwTreeViewEntry;
typedef struct _MwDirectoryEntry MwDirectoryEntry;
typedef struct _MwListBoxPacket MwListBoxPacket;
typedef struct _MwBox* MwBox;
typedef struct _MwMouse MwMouse;
#ifdef _MILSKO
typedef struct _MwWidget* MwWidget;
#else
@ -210,6 +211,11 @@ struct _MwBox {
int layout;
};
struct _MwMouse {
MwPoint point;
int button;
};
struct _MwClass {
MwHandlerWithStatus create;
MwHandler destroy;
@ -233,18 +239,4 @@ struct _MwClass {
void* reserved4;
};
/* Whether or not GetXY/SetXY works with global or local coordinates */
enum MwCoordinateType {
MwCoordinatesGlobal = 0,
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

View file

@ -73,45 +73,45 @@ MWDECL void MwVulkanConfigure(MwVulkanConfig* cfg);
/*!
* @brief Field that can be gotten from Vulkan.
*/
typedef enum _MwVulkanField {
enum MwVULKANFIELD {
/*!
* @brief The address of the vulkan widget's vkGetInstanceProcAddr function (PFN_vkGetInstanceProcAddr)
*/
MwVulkanField_GetInstanceProcAddr = 0,
MwVULKANFIELD_GETINSTANCEPROCADDR = 0,
/*!
* @brief The address of the vulkan widget's instance (VkInstance)
*/
MwVulkanField_Instance,
MwVULKANFIELD_INSTANCE,
/*!
* @brief The address of the vulkan widget's surface (VkSurfaceKHR)
*/
MwVulkanField_Surface,
MwVULKANFIELD_SURFACE,
/*!
* @brief The address of the vulkan widget's physical device (VkPhysicalDevice)
*/
MwVulkanField_PhysicalDevice,
MwVULKANFIELD_PHYSICALDEVICE,
/*!
* @brief The address of the vulkan widget's logical device (VkDevice)
*/
MwVulkanField_LogicalDevice,
MwVULKANFIELD_LOGICALDEVICE,
/*!
* @brief The address of the index that the vulkan widget uses for the graphics queue (uint32_t *)
*/
MwVulkanField_GraphicsQueueIndex,
MwVULKANFIELD_GRAPHICSQUEUEINDEX,
/*!
* @brief The address of the index that the vulkan widget uses for the present queue (uint32_t *)
*/
MwVulkanField_PresentQueueIndex,
MwVulkanField_GraphicsQueue,
MwVULKANFIELD_PRESENTQUEUEINDEX,
MwVULKANFIELD_GRAPHICSQUEUE,
/*!
* @brief The address of the vulkan widget's graphics queue (VkQueue)
*/
MwVulkanField_PresentQueue,
} MwVulkanField;
MwVULKANFIELD_PRESENTQUEUE,
};
/*!
* @brief Function for getting a field from within Vulkan.
* @warning Consult the documentation for MwVulkanField to know what type is expected for out.
* @warning Consult the documentation for MwVULKANFIELD to know what type is expected for out.
*/
MwInline void* MwVulkanGetField(MwWidget handle, int field, int* out) {
void* field_out;

View file

@ -38,6 +38,10 @@
<short name="green" unsigned="yes" />
<short name="blue" unsigned="yes" />
</struct>
<struct name="MwMouse">
<struct defname="MwPoint" name="point" />
<integer name="button" />
</struct>
<struct name="MwVulkanConfig">
<integer name="api_version" unsigned="yes" />
<integer name="vk_version" unsigned="yes" />
@ -109,24 +113,55 @@
<pointer name="boldMonospaceFont" />
<handler name="activate" />
<handler name="listBoxActivate">
<integer pointer="yes" />
</handler>
<handler name="treeViewActivate">
<pointer />
</handler>
<handler name="resize" />
<handler name="tick" />
<handler name="menu" />
<handler name="mouseDown" />
<handler name="mouseUp" />
<handler name="mouseMove" />
<handler name="menu">
<pointer />
</handler>
<handler name="mouseDown">
<struct defname="MwMouse" pointer="yes" />
</handler>
<handler name="mouseUp">
<struct defname="MwMouse" pointer="yes" />
</handler>
<handler name="mouseMove">
<struct defname="MwPoint" pointer="yes" />
</handler>
<handler name="changed" />
<handler name="key" />
<handler name="keyRelease" />
<handler name="comboBoxChanged">
<integer pointer="yes" />
</handler>
<handler name="key">
<integer pointer="yes" />
</handler>
<handler name="keyRelease">
<integer pointer="yes" />
</handler>
<handler name="close" />
<handler name="focusIn" />
<handler name="focusOut" />
<handler name="fileChosen" />
<handler name="directoryChosen" />
<handler name="colorChosen" />
<handler name="fileChosen">
<string />
</handler>
<handler name="directoryChosen">
<string />
</handler>
<handler name="colorChosen">
<struct defname="MwRGB" pointer="yes" />
</handler>
<handler name="draw" />
<handler name="clipboard" />
<handler name="darkTheme" />
<handler name="clipboard">
<string />
</handler>
<handler name="darkTheme">
<integer pointer="yes" />
</handler>
</properties>
<enumerations>
<enumeration name="MwDIRECTION">
@ -153,9 +188,20 @@
<integer name="MwMB_ICONERROR" />
<integer name="MwMB_ICONCLOCK" />
</enumeration>
<enumeration name="MwClipboardType">
<integer name="MwClipboardMain">0</integer>
<integer name="MwClipboardPrimary" />
<enumeration name="MwCOORDINATE">
<integer name="MwCOORDINATE_GLOBAL">0</integer>
<integer name="MwCOORDINATE_LOCAL" />
</enumeration>
<enumeration name="MwCLIPBOARD">
<integer name="MwCLIPBOARD_MAIN">0</integer>
<integer name="MwCLIPBOARD_PRIMARY" />
</enumeration>
<enumeration name="MwMOUSE">
<integer name="MwMOUSE_LEFT">1</integer>
<integer name="MwMOUSE_MIDDLE" />
<integer name="MwMOUSE_RIGHT" />
<integer name="MwMOUSE_WHEELUP" />
<integer name="MwMOUSE_WHEELDOWN" />
</enumeration>
<enumeration name="MwVulkanField">
<integer name="MwVulkanField_GetInstanceProcAddr">0</integer>

View file

@ -347,12 +347,12 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
}
- (void)mouseMoved:(NSEvent*)ev {
MwLLMouse mouse;
NSPoint mousePoint = pointFlip([ev locationInWindow]);
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mouse.button = MwLLMouseLeft;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwMouse mouse;
NSPoint mousePoint = pointFlip([ev locationInWindow]);
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mouse.button = MwMOUSE_LEFT;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwLLDispatch(this, move, &mouse);
[this->cocoa.real nudge];
[super mouseMoved:ev];
@ -362,51 +362,51 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
}
- (void)mouseDown:(NSEvent*)ev {
MwLLMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwLLMouseLeft;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwMOUSE_LEFT;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwLLDispatch(this, down, &mouse);
[this->cocoa.real nudge];
[super mouseDown:ev];
}
- (void)mouseUp:(NSEvent*)ev {
MwLLMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwLLMouseLeft;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwMOUSE_LEFT;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwLLDispatch(this, up, &mouse);
[this->cocoa.real nudge];
[super mouseUp:ev];
}
- (void)rightMouseDown:(NSEvent*)ev {
MwLLMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwLLMouseRight;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwMOUSE_RIGHT;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwLLDispatch(this, down, &mouse);
[this->cocoa.real nudge];
[super rightMouseDown:ev];
}
- (void)rightMouseUp:(NSEvent*)ev {
MwLLMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwLLMouseRight;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwMouse mouse;
NSPoint mousePoint = [ev locationInWindow];
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
mouse.button = MwMOUSE_RIGHT;
mouse.point.x = mousePoint.x;
mouse.point.y = mousePoint.y;
MwLLDispatch(this, up, &mouse);
[this->cocoa.real nudge];
[super rightMouseUp:ev];

View file

@ -79,44 +79,44 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
EndPaint(hWnd, &ps);
}
} else if(msg == WM_LBUTTONDOWN || msg == WM_MBUTTONDOWN || msg == WM_RBUTTONDOWN) {
MwLLMouse p;
MwMouse p;
p.point.x = LOWORD(lp);
p.point.y = HIWORD(lp);
if(msg == WM_LBUTTONDOWN) {
p.button = MwLLMouseLeft;
p.button = MwMOUSE_LEFT;
} else if(msg == WM_MBUTTONDOWN) {
p.button = MwLLMouseMiddle;
p.button = MwMOUSE_MIDDLE;
} else if(msg == WM_RBUTTONDOWN) {
p.button = MwLLMouseRight;
p.button = MwMOUSE_RIGHT;
}
SetCapture(hWnd);
SetFocus(hWnd);
MwLLDispatch(u->ll, down, &p);
} else if(msg == WM_LBUTTONUP || msg == WM_MBUTTONUP || msg == WM_RBUTTONUP) {
MwLLMouse p;
MwMouse p;
p.point.x = LOWORD(lp);
p.point.y = HIWORD(lp);
if(msg == WM_LBUTTONUP) {
p.button = MwLLMouseLeft;
p.button = MwMOUSE_LEFT;
} else if(msg == WM_MBUTTONUP) {
p.button = MwLLMouseMiddle;
p.button = MwMOUSE_MIDDLE;
} else if(msg == WM_RBUTTONUP) {
p.button = MwLLMouseRight;
p.button = MwMOUSE_RIGHT;
}
SetCapture(NULL);
MwLLDispatch(u->ll, up, &p);
} else if(msg == WM_MOUSEWHEEL) {
int d = GET_WHEEL_DELTA_WPARAM(wp);
MwLLMouse p;
int d = GET_WHEEL_DELTA_WPARAM(wp);
MwMouse p;
p.point.x = LOWORD(lp);
p.point.y = HIWORD(lp);
if(d > 0) {
p.button = MwLLMouseWheelUp;
p.button = MwMOUSE_WHEELUP;
} else if(d < 0) {
p.button = MwLLMouseWheelDown;
p.button = MwMOUSE_WHEELDOWN;
}
MwLLDispatch(u->ll, down, &p);

View file

@ -119,7 +119,7 @@ static void recursive_dispatch_resize(MwLL handle) {
};
/* Recursively dispatch a move event to a widget and its children */
static void recursive_dispatch_move(MwLL handle, MwLLMouse* p) {
static void recursive_dispatch_move(MwLL handle, MwMouse* p) {
MwWidget h = (MwWidget)handle->common.user;
if(h) {
int i;
@ -282,7 +282,7 @@ static void wl_clipboard_read(wl_clipboard_device_context_t* ctx, int clipboard_
timeout.tv_sec = 0;
timeout.tv_usec = 100;
if(clipboard_type == MwClipboardPrimary) {
if(clipboard_type == MwCLIPBOARD_PRIMARY) {
zwp_primary_selection_offer_v1_receive(ctx->offer.zwp, "text/plain", fds[1]);
} else if(ctx->offer.wl) {
wl_data_offer_receive(ctx->offer.wl, "text/plain", fds[1]);
@ -501,7 +501,7 @@ static void pointer_leave(void* data, struct wl_pointer* wl_pointer, MwU32 seria
WAYLAND_EVENT_OP_END(self);
};
static void xdg_borderless_step(MwLL self, MwLLMouse p, MwU32 serial) {
static void xdg_borderless_step(MwLL self, MwMouse p, MwU32 serial) {
if(self->wayland.type == MWLL_WAYLAND_TOPLEVEL && self->wayland.backbuffer.surface == curSurface) {
if(p.point.y >= (self->wayland.wh + CSD_BORDER_FRAME_TOP + CSD_BORDER_FRAME_BOTTOM) - 5) {
if(p.point.x >= (self->wayland.ww + CSD_BORDER_FRAME_LEFT + CSD_BORDER_FRAME_RIGHT) - 5) {
@ -535,8 +535,8 @@ static void relative_pointer_motion(void* data,
wl_fixed_t dy,
wl_fixed_t dxUnaccel,
wl_fixed_t dyUnaccel) {
MwLL self = data;
MwLLMouse p;
MwLL self = data;
MwMouse p;
WAYLAND_EVENT_OP_START(self);
@ -567,9 +567,9 @@ static void zwp_relative_pointer_manager_v1_interface_destroy(struct _MwLLWaylan
/* `wl_pointer.motion` callback */
static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time,
wl_fixed_t surface_x, wl_fixed_t surface_y) {
MwLL self = data;
MwLL topmost_parent = self;
MwLLMouse p;
MwLL self = data;
MwLL topmost_parent = self;
MwMouse p;
(void)time;
(void)wl_pointer;
@ -590,9 +590,9 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
/* `wl_pointer.button` callback */
static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 serial, MwU32 time, MwU32 button, MwU32 state) {
MwLL self = data;
MwLLMouse p;
MwBool inArea = MwFALSE;
MwLL self = data;
MwMouse p;
MwBool inArea = MwFALSE;
(void)wl_pointer;
(void)serial;
@ -613,13 +613,13 @@ static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 seri
switch(button) {
case BTN_LEFT:
p.button = MwLLMouseLeft;
p.button = MwMOUSE_LEFT;
break;
case BTN_MIDDLE:
p.button = MwLLMouseMiddle;
p.button = MwMOUSE_MIDDLE;
break;
case BTN_RIGHT:
p.button = MwLLMouseRight;
p.button = MwMOUSE_RIGHT;
break;
}
self->wayland.held_down = state == WL_POINTER_BUTTON_STATE_PRESSED;
@ -1757,7 +1757,7 @@ static void wl_logger(const char* fmt, va_list args) {
static void widget_setup(MwLL r, MwLL parent, int x, int y, int width, int height, enum _MwLLWaylandType ty) {
/* Wayland does not report global coordinates ever. Compositors are not even expected to have knowledge of this.
*/
r->common.coordinate_type = MwCoordinatesLocal;
r->common.coordinate_type = MwCOORDINATE_LOCAL;
r->common.type = MwLLBackendWayland;
@ -2510,7 +2510,7 @@ static void MwLLSetClipboardImpl(MwLL handle, const char* text, int clipboard_ty
handle->wayland.clipboard_buffer = malloc(strlen(text));
strcpy(handle->wayland.clipboard_buffer, text);
if(clipboard_type == MwClipboardPrimary) {
if(clipboard_type == MwCLIPBOARD_PRIMARY) {
if(handle->wayland.supports_zwp) {
for(i = 0; i < arrlen(handle->wayland.clipboard_devices_zwp); i++) {
wl_clipboard_device_context_t* device = handle->wayland.clipboard_devices_zwp[i];
@ -2529,7 +2529,7 @@ static void MwLLSetClipboardImpl(MwLL handle, const char* text, int clipboard_ty
static void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) {
int i;
if(clipboard_type == MwClipboardPrimary) {
if(clipboard_type == MwCLIPBOARD_PRIMARY) {
if(handle->wayland.supports_zwp) {
for(i = 0; i < arrlen(handle->wayland.clipboard_devices_zwp); i++) {
wl_clipboard_read(

View file

@ -694,38 +694,38 @@ static void MwLLNextEventImpl(MwLL handle) {
handle->x11.force_render = 0;
render = 1;
} else if(ev.type == ButtonPress) {
MwLLMouse p;
MwMouse p;
p.point.x = ev.xbutton.x;
p.point.y = ev.xbutton.y;
if(ev.xbutton.button == Button1) {
p.button = MwLLMouseLeft;
p.button = MwMOUSE_LEFT;
} else if(ev.xbutton.button == Button2) {
p.button = MwLLMouseMiddle;
p.button = MwMOUSE_MIDDLE;
} else if(ev.xbutton.button == Button3) {
p.button = MwLLMouseRight;
p.button = MwMOUSE_RIGHT;
} else if(ev.xbutton.button == Button4) {
p.button = MwLLMouseWheelUp;
p.button = MwMOUSE_WHEELUP;
} else if(ev.xbutton.button == Button5) {
p.button = MwLLMouseWheelDown;
p.button = MwMOUSE_WHEELDOWN;
}
XSetInputFocus(handle->x11.display, handle->x11.window, RevertToNone, CurrentTime);
MwLLDispatch(handle, down, &p);
} else if(ev.type == ButtonRelease) {
MwLLMouse p;
MwMouse p;
p.point.x = ev.xbutton.x;
p.point.y = ev.xbutton.y;
if(ev.xbutton.button == Button1) {
p.button = MwLLMouseLeft;
p.button = MwMOUSE_LEFT;
} else if(ev.xbutton.button == Button2) {
p.button = MwLLMouseMiddle;
p.button = MwMOUSE_MIDDLE;
} else if(ev.xbutton.button == Button3) {
p.button = MwLLMouseRight;
p.button = MwMOUSE_RIGHT;
} else if(ev.xbutton.button == Button4) {
p.button = MwLLMouseWheelUp;
p.button = MwMOUSE_WHEELUP;
} else if(ev.xbutton.button == Button5) {
p.button = MwLLMouseWheelDown;
p.button = MwMOUSE_WHEELDOWN;
}
MwLLDispatch(handle, up, &p);

View file

@ -52,22 +52,23 @@ static void lldrawhandler(MwLL handle, void* data) {
}
static void lluphandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->common.user;
MwLLMouse* p = data;
MwWidget h = (MwWidget)handle->common.user;
MwMouse* p = data;
if(p->button == MwLLMouseLeft) h->pressed = 0;
if(p->button == MwMOUSE_LEFT) h->pressed = 0;
h->mouse_point.x = p->point.x;
h->mouse_point.y = p->point.y;
if(p->button == MwLLMouseLeft) MwDispatch(h, click);
if(p->button == MwMOUSE_LEFT) MwDispatch(h, click);
MwDispatch3(h, mouse_up, data);
MwDispatchUserHandler(h, MwNmouseUpHandler, data);
}
static void lldownhandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->common.user;
MwLLMouse* p = data;
if(p->button == MwLLMouseLeft) h->pressed = 1;
MwWidget h = (MwWidget)handle->common.user;
MwMouse* p = data;
if(p->button == MwMOUSE_LEFT) h->pressed = 1;
h->mouse_point.x = p->point.x;
h->mouse_point.y = p->point.y;
@ -962,7 +963,7 @@ int MwGetCoordinateType(MwWidget handle) {
if(handle->parent == NULL || handle->parent->lowlevel == NULL) {
return handle->lowlevel->common.coordinate_type;
} else {
return MwCoordinatesLocal;
return MwCOORDINATE_LOCAL;
}
}

View file

@ -160,7 +160,7 @@ static void color_picker_image_update(color_picker_t* picker) {
static void color_picker_click(MwWidget handle, void* user, void* call) {
color_picker_t* picker = user;
MwLLMouse* mouse = call;
MwMouse* mouse = call;
char hexColor[8];
int i;
char fgColor[8];

View file

@ -221,7 +221,7 @@ static void layout(MwWidget handle) {
MwNleftPadding, 16,
NULL);
MwListBoxInsert(fc->nav, -1, p);
MwAddUserHandler(fc->nav, MwNactivateHandler, nav_activate, NULL);
MwAddUserHandler(fc->nav, MwNlistBoxActivateHandler, nav_activate, NULL);
MwListBoxDestroyPacket(p);
} else {
@ -242,7 +242,7 @@ static void layout(MwWidget handle) {
MwNhasHeading, 1,
MwNleftPadding, 16,
NULL);
MwAddUserHandler(fc->files, MwNactivateHandler, files_activate, NULL);
MwAddUserHandler(fc->files, MwNlistBoxActivateHandler, files_activate, NULL);
} else {
MwVaApply(fc->files,
MwNx, wx,

View file

@ -89,7 +89,7 @@ static void listbox_activate(MwWidget handle, void* user, void* client) {
MwForceRender(handle->parent);
MwDispatchUserHandler(handle->parent, MwNchangedHandler, client);
MwDispatchUserHandler(handle->parent, MwNcomboBoxChangedHandler, client);
MwDestroyWidget(handle);
}

View file

@ -113,7 +113,7 @@ static void key(MwWidget handle, int code) {
} else if(code == MwLLKeyEnter) {
MwDispatchUserHandler(handle, MwNactivateHandler, NULL);
} else if(code == (MwLLControlMask | 'v')) {
MwLLGetClipboard(handle->lowlevel, MwClipboardMain);
MwLLGetClipboard(handle->lowlevel, MwCLIPBOARD_MAIN);
} else if(!(code & MwLLKeyMask)) {
int incr = 0;
out = malloc(strlen(str) + 5 + 1);
@ -136,9 +136,9 @@ static void key(MwWidget handle, int code) {
#if defined(USE_X11) || defined(USE_WAYLAND)
static void mouse_up(MwWidget handle, void* ptr) {
if(handle->lowlevel->common.type == MwLLBackendWayland || handle->lowlevel->common.type == MwLLBackendX11) {
MwLLMouse* mouse = ptr;
if(mouse->button == MwLLMouseMiddle) {
MwLLGetClipboard(handle->lowlevel, MwClipboardPrimary);
MwMouse* mouse = ptr;
if(mouse->button == MwMOUSE_MIDDLE) {
MwLLGetClipboard(handle->lowlevel, MwCLIPBOARD_PRIMARY);
}
}
MwForceRender2(handle, NULL);

View file

@ -119,12 +119,12 @@ static void vscroll_changed(MwWidget handle, void* user, void* call) {
}
static void frame_mouse_down(MwWidget handle, void* user, void* call) {
MwListBox lb = handle->parent->internal;
MwLLMouse* m = call;
MwListBox lb = handle->parent->internal;
MwMouse* m = call;
(void)user;
if(m->button == MwLLMouseLeft) {
if(m->button == MwMOUSE_LEFT) {
int st = 0;
int i;
int y = MwDefaultBorderWidth(handle);
@ -140,7 +140,7 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) {
if((((t = MwTimeGetTick()) - lb->click_time) < MwDoubleClickTimeout && old == st + i) || MwGetInteger(handle->parent, MwNsingleClickSelectable)) {
int n = MwGetInteger(handle->parent, MwNvalue);
MwDispatchUserHandler(handle->parent, MwNactivateHandler, &n);
MwDispatchUserHandler(handle->parent, MwNlistBoxActivateHandler, &n);
}
lb->click_time = t;
@ -154,12 +154,12 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) {
}
static void frame_mouse_up(MwWidget handle, void* user, void* call) {
MwListBox lb = handle->parent->internal;
MwLLMouse* m = call;
MwListBox lb = handle->parent->internal;
MwMouse* m = call;
(void)user;
if(m->button == MwLLMouseLeft) {
if(m->button == MwMOUSE_LEFT) {
lb->pressed = 0;
}
}

View file

@ -118,7 +118,7 @@ static void parent_resize(MwWidget handle) {
static void mouse_down(MwWidget handle, void* ptr) {
MENU_LOOP_DECL;
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
if(((MwMouse*)ptr)->button != MwMOUSE_LEFT) return;
BEGIN_MENU_LOOP;
if(in_area) {
@ -150,7 +150,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
static void mouse_up(MwWidget handle, void* ptr) {
MENU_LOOP_DECL;
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
if(((MwMouse*)ptr)->button != MwMOUSE_LEFT) return;
BEGIN_MENU_LOOP;
if(in_area && m->sub[i]->wsub != NULL) {

View file

@ -98,7 +98,7 @@ static void mouse_up(MwWidget handle, void* ptr) {
int h = MwGetInteger(handle, MwNheight);
const char* str = MwGetText(handle, MwNtext);
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
if(((MwMouse*)ptr)->button != MwMOUSE_LEFT) return;
if(e->mouse.x >= (w - e->right)) {
char s[512];
@ -116,7 +116,7 @@ static void mouse_up(MwWidget handle, void* ptr) {
static void mouse_down(MwWidget handle, void* ptr) {
MwEntry e = handle->internal;
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
if(((MwMouse*)ptr)->button != MwMOUSE_LEFT) return;
e->mouse = handle->mouse_point;

View file

@ -170,9 +170,9 @@ static void mouse_down(MwWidget handle, void* ptr) {
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
MwScrollBar scr = handle->internal;
MwLLMouse* m = ptr;
MwMouse* m = ptr;
if(m->button == MwLLMouseWheelUp) {
if(m->button == MwMOUSE_WHEELUP) {
int min = MwGetInteger(handle, MwNminValue);
int val = MwGetInteger(handle, MwNvalue);
int diff = MwGetInteger(handle, MwNareaShown);
@ -184,7 +184,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
MwSetInteger(handle, MwNvalue, val);
MwSetInteger(handle, MwNchangedBy, -diff);
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
} else if(m->button == MwLLMouseWheelDown) {
} else if(m->button == MwMOUSE_WHEELDOWN) {
int max = MwGetInteger(handle, MwNmaxValue);
int val = MwGetInteger(handle, MwNvalue);
int diff = MwGetInteger(handle, MwNareaShown);
@ -197,7 +197,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
MwSetInteger(handle, MwNchangedBy, diff);
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
}
if(m->button != MwLLMouseLeft) return;
if(m->button != MwMOUSE_LEFT) return;
scr->point = handle->mouse_point;
scr->drag = 0;

View file

@ -183,7 +183,7 @@ static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point, in
MwLLMakeToolWindow(handle->lowlevel);
MwLLDetach(handle->lowlevel, &p);
if(handle->lowlevel->common.coordinate_type == MwCoordinatesGlobal) {
if(handle->lowlevel->common.coordinate_type == MwCOORDINATE_GLOBAL) {
if(MwGetInteger(handle, MwNy) + sz.height > rc.height) {
MwVaApply(handle,
MwNy, rc.height - sz.height,

View file

@ -128,7 +128,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
set_all(root, 0);
tree->selected = 1;
if(((t = MwTimeGetTick()) - tree->click_time) < MwDoubleClickTimeout || MwGetInteger(handle->parent, MwNsingleClickSelectable)) {
MwDispatchUserHandler(handle->parent, MwNactivateHandler, tree);
MwDispatchUserHandler(handle->parent, MwNtreeViewActivateHandler, tree);
}
tree->click_time = t;
@ -213,11 +213,11 @@ static int recursive_length(MwTreeViewEntry** e) {
static void frame_mouse_down(MwWidget handle, void* user, void* call) {
MwTreeView tv = handle->parent->internal;
MwLLMouse* mouse = call;
MwMouse* mouse = call;
(void)user;
if(mouse->button == MwLLMouseLeft) tv->pressed = mouse->point;
if(mouse->button == MwMOUSE_LEFT) tv->pressed = mouse->point;
}
static void resize(MwWidget handle);
@ -227,11 +227,11 @@ static void frame_mouse_up(MwWidget handle, void* user, void* call) {
int shared = 0;
int skip = MwGetInteger(tv->vscroll, MwNvalue) * (MwGetInteger(tv->vscroll, MwNmaxValue) - MwGetInteger(tv->vscroll, MwNareaShown)) / MwGetInteger(tv->vscroll, MwNmaxValue);
MwPoint p;
MwLLMouse* mouse = call;
MwMouse* mouse = call;
(void)user;
if(mouse->button == MwLLMouseLeft) {
if(mouse->button == MwMOUSE_LEFT) {
int i;
p.x = MwDefaultBorderWidth(tv->frame);
p.y = MwDefaultBorderWidth(tv->frame);

View file

@ -523,23 +523,23 @@ static void* mwVulkanGetFieldImpl(MwWidget handle, int field, int* out) {
char buf[1024];
switch(field) {
case MwVulkanField_GetInstanceProcAddr:
case MwVULKANFIELD_GETINSTANCEPROCADDR:
return o->vkGetInstanceProcAddr;
case MwVulkanField_Instance:
case MwVULKANFIELD_INSTANCE:
return o->vkInstance;
case MwVulkanField_Surface:
case MwVULKANFIELD_SURFACE:
return o->vkSurface;
case MwVulkanField_PhysicalDevice:
case MwVULKANFIELD_PHYSICALDEVICE:
return o->vkPhysicalDevice;
case MwVulkanField_LogicalDevice:
case MwVULKANFIELD_LOGICALDEVICE:
return o->vkLogicalDevice;
case MwVulkanField_GraphicsQueueIndex:
case MwVULKANFIELD_GRAPHICSQUEUEINDEX:
return &o->vkGraphicsFamilyIDX;
case MwVulkanField_PresentQueueIndex:
case MwVULKANFIELD_PRESENTQUEUEINDEX:
return &o->vkPresentFamilyIDX;
case MwVulkanField_GraphicsQueue:
case MwVULKANFIELD_GRAPHICSQUEUE:
return o->vkGraphicsQueue;
case MwVulkanField_PresentQueue:
case MwVULKANFIELD_PRESENTQUEUE:
return o->vkPresentQueue;
default:
MwStringPrintIntoBuffer(buf, 1024, "Unknown vulkan field request (%d given)", field);