many things changed
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
5220f742be
commit
570f05540e
25 changed files with 258 additions and 208 deletions
|
|
@ -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) {
|
static void tick(MwWidget handle, void* user_data, void* call_data) {
|
||||||
cur_text = text1;
|
cur_text = text1;
|
||||||
MwGetClipboard(handle, MwClipboardMain);
|
MwGetClipboard(handle, MwCLIPBOARD_MAIN);
|
||||||
cur_text = text2;
|
cur_text = text2;
|
||||||
MwGetClipboard(handle, MwClipboardPrimary);
|
MwGetClipboard(handle, MwCLIPBOARD_PRIMARY);
|
||||||
MwForceRender(window);
|
MwForceRender(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,12 @@ static void tick(MwWidget handle, void* user, void* call) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mouse(MwWidget handle, void* user, void* call) {
|
static void mouse(MwWidget handle, void* user, void* call) {
|
||||||
MwLLMouse* mouse = call;
|
MwMouse* mouse = call;
|
||||||
|
|
||||||
(void)handle;
|
(void)handle;
|
||||||
(void)user;
|
(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 + 0] = mouse->point.x;
|
||||||
t[ct].points[click * 2 + 1] = mouse->point.y;
|
t[ct].points[click * 2 + 1] = mouse->point.y;
|
||||||
click++;
|
click++;
|
||||||
|
|
@ -82,7 +82,7 @@ static void mouse(MwWidget handle, void* user, void* call) {
|
||||||
for(i = 0; i < ct; i++) t[i] = old[i];
|
for(i = 0; i < ct; i++) t[i] = old[i];
|
||||||
free(old);
|
free(old);
|
||||||
}
|
}
|
||||||
} else if(mouse->button == MwLLMouseRight) {
|
} else if(mouse->button == MwMOUSE_RIGHT) {
|
||||||
if(click > 0) {
|
if(click > 0) {
|
||||||
click = 0;
|
click = 0;
|
||||||
} else if(ct > 0) {
|
} else if(ct > 0) {
|
||||||
|
|
|
||||||
|
|
@ -232,15 +232,15 @@ void vulkan_setup(MwWidget handle) {
|
||||||
VkFenceCreateInfo fenceInfo = {};
|
VkFenceCreateInfo fenceInfo = {};
|
||||||
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
_vkGetInstanceProcAddr = MwVulkanGetField(handle, MwVulkanField_GetInstanceProcAddr, &err);
|
_vkGetInstanceProcAddr = MwVulkanGetField(handle, MwVULKANFIELD_GETINSTANCEPROCADDR, &err);
|
||||||
instance = MwVulkanGetField(handle, MwVulkanField_Instance, &err);
|
instance = MwVulkanGetField(handle, MwVULKANFIELD_INSTANCE, &err);
|
||||||
device = MwVulkanGetField(handle, MwVulkanField_LogicalDevice, &err);
|
device = MwVulkanGetField(handle, MwVULKANFIELD_LOGICALDEVICE, &err);
|
||||||
physicalDevice = MwVulkanGetField(handle, MwVulkanField_PhysicalDevice, &err);
|
physicalDevice = MwVulkanGetField(handle, MwVULKANFIELD_PHYSICALDEVICE, &err);
|
||||||
graphicsQueue = MwVulkanGetField(handle, MwVulkanField_GraphicsQueue, &err);
|
graphicsQueue = MwVulkanGetField(handle, MwVULKANFIELD_GRAPHICSQUEUE, &err);
|
||||||
presentQueue = MwVulkanGetField(handle, MwVulkanField_PresentQueue, &err);
|
presentQueue = MwVulkanGetField(handle, MwVULKANFIELD_PRESENTQUEUE, &err);
|
||||||
surface = MwVulkanGetField(handle, MwVulkanField_Surface, &err);
|
surface = MwVulkanGetField(handle, MwVULKANFIELD_SURFACE, &err);
|
||||||
presentQueueIndex = MwVulkanGetField(handle, MwVulkanField_PresentQueueIndex, &err);
|
presentQueueIndex = MwVulkanGetField(handle, MwVULKANFIELD_PRESENTQUEUEINDEX, &err);
|
||||||
graphicsQueueIndex = MwVulkanGetField(handle, MwVulkanField_GraphicsQueueIndex, &err);
|
graphicsQueueIndex = MwVulkanGetField(handle, MwVULKANFIELD_GRAPHICSQUEUEINDEX, &err);
|
||||||
|
|
||||||
LOAD_VK_FUNCTION(vkCreateShaderModule);
|
LOAD_VK_FUNCTION(vkCreateShaderModule);
|
||||||
LOAD_VK_FUNCTION(vkCreatePipelineLayout);
|
LOAD_VK_FUNCTION(vkCreatePipelineLayout);
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,26 @@ enum MwMB_ICON {
|
||||||
*/
|
*/
|
||||||
#define MwMB_BUTTONYESNOCANCEL (MwMB_BUTTONYES | MwMB_BUTTONNO | MwMB_BUTTONCANCEL)
|
#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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
#include <Mw/MachDep.h>
|
#include <Mw/MachDep.h>
|
||||||
|
|
||||||
typedef struct _MwLLHandler* MwLLHandler;
|
typedef struct _MwLLHandler* MwLLHandler;
|
||||||
typedef struct _MwLLMouse MwLLMouse;
|
|
||||||
typedef struct _MwLLCommon* MwLLCommon;
|
typedef struct _MwLLCommon* MwLLCommon;
|
||||||
typedef struct _MwLLCommonColor* MwLLCommonColor;
|
typedef struct _MwLLCommonColor* MwLLCommonColor;
|
||||||
typedef struct _MwLLCommonPixmap* MwLLCommonPixmap;
|
typedef struct _MwLLCommonPixmap* MwLLCommonPixmap;
|
||||||
|
|
@ -187,19 +186,6 @@ enum MwLLKeyEnum {
|
||||||
#define MwLLControlMask MwLLKeyMask | (1 << 30)
|
#define MwLLControlMask MwLLKeyMask | (1 << 30)
|
||||||
#define MwLLAltMask MwLLKeyMask | (1 << 29)
|
#define MwLLAltMask MwLLKeyMask | (1 << 29)
|
||||||
|
|
||||||
enum MwLLMouseEnum {
|
|
||||||
MwLLMouseLeft = 1,
|
|
||||||
MwLLMouseMiddle,
|
|
||||||
MwLLMouseRight,
|
|
||||||
MwLLMouseWheelUp,
|
|
||||||
MwLLMouseWheelDown
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MwLLMouse {
|
|
||||||
MwPoint point;
|
|
||||||
int button;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MwLLHandler {
|
struct _MwLLHandler {
|
||||||
void (*draw)(MwLL handle, void* data);
|
void (*draw)(MwLL handle, void* data);
|
||||||
void (*up)(MwLL handle, void* data);
|
void (*up)(MwLL handle, void* data);
|
||||||
|
|
|
||||||
|
|
@ -60,24 +60,27 @@
|
||||||
#define MwNmonospaceFont "VmonospaceFont"
|
#define MwNmonospaceFont "VmonospaceFont"
|
||||||
#define MwNboldMonospaceFont "VboldMonospaceFont"
|
#define MwNboldMonospaceFont "VboldMonospaceFont"
|
||||||
|
|
||||||
#define MwNactivateHandler "Cactivate" /* NULL/int* (MwListBox)/void* (MwTreeView) */
|
#define MwNactivateHandler "Cactivate" /* NULL */
|
||||||
#define MwNresizeHandler "Cresize" /* NULL */
|
#define MwNlistBoxActivateHandler "ClistBoxActivate" /* int* */
|
||||||
#define MwNtickHandler "Ctick" /* NULL */
|
#define MwNtreeViewActivateHandler "CtreeViewActivate" /* void* */
|
||||||
#define MwNmenuHandler "Cmenu" /* MwMenu */
|
#define MwNresizeHandler "Cresize" /* NULL */
|
||||||
#define MwNmouseDownHandler "CmouseDown" /* MwLLMouse* */
|
#define MwNtickHandler "Ctick" /* NULL */
|
||||||
#define MwNmouseUpHandler "CmouseUp" /* same as MwNmouseDownHandler */
|
#define MwNmenuHandler "Cmenu" /* MwMenu */
|
||||||
#define MwNmouseMoveHandler "CmouseMove" /* MwPoint* */
|
#define MwNmouseDownHandler "CmouseDown" /* MwMouse* */
|
||||||
#define MwNchangedHandler "Cchanged" /* NULL/int* (MwComboBox) */
|
#define MwNmouseUpHandler "CmouseUp" /* same as MwNmouseDownHandler */
|
||||||
#define MwNkeyHandler "Ckey" /* int* (MwLLKeyEnum or character code) */
|
#define MwNmouseMoveHandler "CmouseMove" /* MwPoint* */
|
||||||
#define MwNkeyReleaseHandler "CkeyRelease" /* same as MwNkeyHandler */
|
#define MwNchangedHandler "Cchanged" /* NULL */
|
||||||
#define MwNcloseHandler "Cclose" /* NULL */
|
#define MwNcomboBoxChangedHandler "CcomboBoxChanged" /* int* */
|
||||||
#define MwNfocusInHandler "CfocusIn" /* NULL */
|
#define MwNkeyHandler "Ckey" /* int* (MwLLKeyEnum or character code) */
|
||||||
#define MwNfocusOutHandler "CfocusOut" /* NULL */
|
#define MwNkeyReleaseHandler "CkeyRelease" /* same as MwNkeyHandler */
|
||||||
#define MwNfileChosenHandler "CfileChosen" /* char* */
|
#define MwNcloseHandler "Cclose" /* NULL */
|
||||||
#define MwNdirectoryChosenHandler "CdirectoryChosen" /* char* */
|
#define MwNfocusInHandler "CfocusIn" /* NULL */
|
||||||
#define MwNcolorChosenHandler "CcolorChosen" /* MwRGB* */
|
#define MwNfocusOutHandler "CfocusOut" /* NULL */
|
||||||
#define MwNdrawHandler "Cdraw" /* NULL */
|
#define MwNfileChosenHandler "CfileChosen" /* char* */
|
||||||
#define MwNclipboardHandler "Cclipboard" /* char* */
|
#define MwNdirectoryChosenHandler "CdirectoryChosen" /* char* */
|
||||||
#define MwNdarkThemeHandler "CdarkTheme" /* int* */
|
#define MwNcolorChosenHandler "CcolorChosen" /* MwRGB* */
|
||||||
|
#define MwNdrawHandler "Cdraw" /* NULL */
|
||||||
|
#define MwNclipboardHandler "Cclipboard" /* char* */
|
||||||
|
#define MwNdarkThemeHandler "CdarkTheme" /* int* */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ typedef struct _MwTreeViewEntry MwTreeViewEntry;
|
||||||
typedef struct _MwDirectoryEntry MwDirectoryEntry;
|
typedef struct _MwDirectoryEntry MwDirectoryEntry;
|
||||||
typedef struct _MwListBoxPacket MwListBoxPacket;
|
typedef struct _MwListBoxPacket MwListBoxPacket;
|
||||||
typedef struct _MwBox* MwBox;
|
typedef struct _MwBox* MwBox;
|
||||||
|
typedef struct _MwMouse MwMouse;
|
||||||
#ifdef _MILSKO
|
#ifdef _MILSKO
|
||||||
typedef struct _MwWidget* MwWidget;
|
typedef struct _MwWidget* MwWidget;
|
||||||
#else
|
#else
|
||||||
|
|
@ -210,6 +211,11 @@ struct _MwBox {
|
||||||
int layout;
|
int layout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _MwMouse {
|
||||||
|
MwPoint point;
|
||||||
|
int button;
|
||||||
|
};
|
||||||
|
|
||||||
struct _MwClass {
|
struct _MwClass {
|
||||||
MwHandlerWithStatus create;
|
MwHandlerWithStatus create;
|
||||||
MwHandler destroy;
|
MwHandler destroy;
|
||||||
|
|
@ -233,18 +239,4 @@ struct _MwClass {
|
||||||
void* reserved4;
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -73,45 +73,45 @@ MWDECL void MwVulkanConfigure(MwVulkanConfig* cfg);
|
||||||
/*!
|
/*!
|
||||||
* @brief Field that can be gotten from Vulkan.
|
* @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)
|
* @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)
|
* @brief The address of the vulkan widget's instance (VkInstance)
|
||||||
*/
|
*/
|
||||||
MwVulkanField_Instance,
|
MwVULKANFIELD_INSTANCE,
|
||||||
/*!
|
/*!
|
||||||
* @brief The address of the vulkan widget's surface (VkSurfaceKHR)
|
* @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)
|
* @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)
|
* @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 *)
|
* @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 *)
|
* @brief The address of the index that the vulkan widget uses for the present queue (uint32_t *)
|
||||||
*/
|
*/
|
||||||
MwVulkanField_PresentQueueIndex,
|
MwVULKANFIELD_PRESENTQUEUEINDEX,
|
||||||
MwVulkanField_GraphicsQueue,
|
MwVULKANFIELD_GRAPHICSQUEUE,
|
||||||
/*!
|
/*!
|
||||||
* @brief The address of the vulkan widget's graphics queue (VkQueue)
|
* @brief The address of the vulkan widget's graphics queue (VkQueue)
|
||||||
*/
|
*/
|
||||||
MwVulkanField_PresentQueue,
|
MwVULKANFIELD_PRESENTQUEUE,
|
||||||
} MwVulkanField;
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Function for getting a field from within Vulkan.
|
* @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) {
|
MwInline void* MwVulkanGetField(MwWidget handle, int field, int* out) {
|
||||||
void* field_out;
|
void* field_out;
|
||||||
|
|
|
||||||
74
milsko.xml
74
milsko.xml
|
|
@ -38,6 +38,10 @@
|
||||||
<short name="green" unsigned="yes" />
|
<short name="green" unsigned="yes" />
|
||||||
<short name="blue" unsigned="yes" />
|
<short name="blue" unsigned="yes" />
|
||||||
</struct>
|
</struct>
|
||||||
|
<struct name="MwMouse">
|
||||||
|
<struct defname="MwPoint" name="point" />
|
||||||
|
<integer name="button" />
|
||||||
|
</struct>
|
||||||
<struct name="MwVulkanConfig">
|
<struct name="MwVulkanConfig">
|
||||||
<integer name="api_version" unsigned="yes" />
|
<integer name="api_version" unsigned="yes" />
|
||||||
<integer name="vk_version" unsigned="yes" />
|
<integer name="vk_version" unsigned="yes" />
|
||||||
|
|
@ -109,24 +113,55 @@
|
||||||
<pointer name="boldMonospaceFont" />
|
<pointer name="boldMonospaceFont" />
|
||||||
|
|
||||||
<handler name="activate" />
|
<handler name="activate" />
|
||||||
|
<handler name="listBoxActivate">
|
||||||
|
<integer pointer="yes" />
|
||||||
|
</handler>
|
||||||
|
<handler name="treeViewActivate">
|
||||||
|
<pointer />
|
||||||
|
</handler>
|
||||||
<handler name="resize" />
|
<handler name="resize" />
|
||||||
<handler name="tick" />
|
<handler name="tick" />
|
||||||
<handler name="menu" />
|
<handler name="menu">
|
||||||
<handler name="mouseDown" />
|
<pointer />
|
||||||
<handler name="mouseUp" />
|
</handler>
|
||||||
<handler name="mouseMove" />
|
<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="changed" />
|
||||||
<handler name="key" />
|
<handler name="comboBoxChanged">
|
||||||
<handler name="keyRelease" />
|
<integer pointer="yes" />
|
||||||
|
</handler>
|
||||||
|
<handler name="key">
|
||||||
|
<integer pointer="yes" />
|
||||||
|
</handler>
|
||||||
|
<handler name="keyRelease">
|
||||||
|
<integer pointer="yes" />
|
||||||
|
</handler>
|
||||||
<handler name="close" />
|
<handler name="close" />
|
||||||
<handler name="focusIn" />
|
<handler name="focusIn" />
|
||||||
<handler name="focusOut" />
|
<handler name="focusOut" />
|
||||||
<handler name="fileChosen" />
|
<handler name="fileChosen">
|
||||||
<handler name="directoryChosen" />
|
<string />
|
||||||
<handler name="colorChosen" />
|
</handler>
|
||||||
|
<handler name="directoryChosen">
|
||||||
|
<string />
|
||||||
|
</handler>
|
||||||
|
<handler name="colorChosen">
|
||||||
|
<struct defname="MwRGB" pointer="yes" />
|
||||||
|
</handler>
|
||||||
<handler name="draw" />
|
<handler name="draw" />
|
||||||
<handler name="clipboard" />
|
<handler name="clipboard">
|
||||||
<handler name="darkTheme" />
|
<string />
|
||||||
|
</handler>
|
||||||
|
<handler name="darkTheme">
|
||||||
|
<integer pointer="yes" />
|
||||||
|
</handler>
|
||||||
</properties>
|
</properties>
|
||||||
<enumerations>
|
<enumerations>
|
||||||
<enumeration name="MwDIRECTION">
|
<enumeration name="MwDIRECTION">
|
||||||
|
|
@ -153,9 +188,20 @@
|
||||||
<integer name="MwMB_ICONERROR" />
|
<integer name="MwMB_ICONERROR" />
|
||||||
<integer name="MwMB_ICONCLOCK" />
|
<integer name="MwMB_ICONCLOCK" />
|
||||||
</enumeration>
|
</enumeration>
|
||||||
<enumeration name="MwClipboardType">
|
<enumeration name="MwCOORDINATE">
|
||||||
<integer name="MwClipboardMain">0</integer>
|
<integer name="MwCOORDINATE_GLOBAL">0</integer>
|
||||||
<integer name="MwClipboardPrimary" />
|
<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>
|
||||||
<enumeration name="MwVulkanField">
|
<enumeration name="MwVulkanField">
|
||||||
<integer name="MwVulkanField_GetInstanceProcAddr">0</integer>
|
<integer name="MwVulkanField_GetInstanceProcAddr">0</integer>
|
||||||
|
|
|
||||||
|
|
@ -347,12 +347,12 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseMoved:(NSEvent*)ev {
|
- (void)mouseMoved:(NSEvent*)ev {
|
||||||
MwLLMouse mouse;
|
MwMouse mouse;
|
||||||
NSPoint mousePoint = pointFlip([ev locationInWindow]);
|
NSPoint mousePoint = pointFlip([ev locationInWindow]);
|
||||||
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
||||||
mouse.button = MwLLMouseLeft;
|
mouse.button = MwMOUSE_LEFT;
|
||||||
mouse.point.x = mousePoint.x;
|
mouse.point.x = mousePoint.x;
|
||||||
mouse.point.y = mousePoint.y;
|
mouse.point.y = mousePoint.y;
|
||||||
MwLLDispatch(this, move, &mouse);
|
MwLLDispatch(this, move, &mouse);
|
||||||
[this->cocoa.real nudge];
|
[this->cocoa.real nudge];
|
||||||
[super mouseMoved:ev];
|
[super mouseMoved:ev];
|
||||||
|
|
@ -362,51 +362,51 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent*)ev {
|
- (void)mouseDown:(NSEvent*)ev {
|
||||||
MwLLMouse mouse;
|
MwMouse mouse;
|
||||||
NSPoint mousePoint = [ev locationInWindow];
|
NSPoint mousePoint = [ev locationInWindow];
|
||||||
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
||||||
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
||||||
mouse.button = MwLLMouseLeft;
|
mouse.button = MwMOUSE_LEFT;
|
||||||
mouse.point.x = mousePoint.x;
|
mouse.point.x = mousePoint.x;
|
||||||
mouse.point.y = mousePoint.y;
|
mouse.point.y = mousePoint.y;
|
||||||
MwLLDispatch(this, down, &mouse);
|
MwLLDispatch(this, down, &mouse);
|
||||||
[this->cocoa.real nudge];
|
[this->cocoa.real nudge];
|
||||||
[super mouseDown:ev];
|
[super mouseDown:ev];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseUp:(NSEvent*)ev {
|
- (void)mouseUp:(NSEvent*)ev {
|
||||||
MwLLMouse mouse;
|
MwMouse mouse;
|
||||||
NSPoint mousePoint = [ev locationInWindow];
|
NSPoint mousePoint = [ev locationInWindow];
|
||||||
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
||||||
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
||||||
mouse.button = MwLLMouseLeft;
|
mouse.button = MwMOUSE_LEFT;
|
||||||
mouse.point.x = mousePoint.x;
|
mouse.point.x = mousePoint.x;
|
||||||
mouse.point.y = mousePoint.y;
|
mouse.point.y = mousePoint.y;
|
||||||
MwLLDispatch(this, up, &mouse);
|
MwLLDispatch(this, up, &mouse);
|
||||||
[this->cocoa.real nudge];
|
[this->cocoa.real nudge];
|
||||||
[super mouseUp:ev];
|
[super mouseUp:ev];
|
||||||
}
|
}
|
||||||
- (void)rightMouseDown:(NSEvent*)ev {
|
- (void)rightMouseDown:(NSEvent*)ev {
|
||||||
MwLLMouse mouse;
|
MwMouse mouse;
|
||||||
NSPoint mousePoint = [ev locationInWindow];
|
NSPoint mousePoint = [ev locationInWindow];
|
||||||
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
||||||
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
||||||
mouse.button = MwLLMouseRight;
|
mouse.button = MwMOUSE_RIGHT;
|
||||||
mouse.point.x = mousePoint.x;
|
mouse.point.x = mousePoint.x;
|
||||||
mouse.point.y = mousePoint.y;
|
mouse.point.y = mousePoint.y;
|
||||||
MwLLDispatch(this, down, &mouse);
|
MwLLDispatch(this, down, &mouse);
|
||||||
[this->cocoa.real nudge];
|
[this->cocoa.real nudge];
|
||||||
[super rightMouseDown:ev];
|
[super rightMouseDown:ev];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)rightMouseUp:(NSEvent*)ev {
|
- (void)rightMouseUp:(NSEvent*)ev {
|
||||||
MwLLMouse mouse;
|
MwMouse mouse;
|
||||||
NSPoint mousePoint = [ev locationInWindow];
|
NSPoint mousePoint = [ev locationInWindow];
|
||||||
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
MwLL this = [((MilskoFakePointer*)[[self subviews] objectAtIndex:0]) pointer];
|
||||||
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
mousePoint.y = [[ev window] frame].size.height - mousePoint.y;
|
||||||
mouse.button = MwLLMouseRight;
|
mouse.button = MwMOUSE_RIGHT;
|
||||||
mouse.point.x = mousePoint.x;
|
mouse.point.x = mousePoint.x;
|
||||||
mouse.point.y = mousePoint.y;
|
mouse.point.y = mousePoint.y;
|
||||||
MwLLDispatch(this, up, &mouse);
|
MwLLDispatch(this, up, &mouse);
|
||||||
[this->cocoa.real nudge];
|
[this->cocoa.real nudge];
|
||||||
[super rightMouseUp:ev];
|
[super rightMouseUp:ev];
|
||||||
|
|
|
||||||
|
|
@ -79,44 +79,44 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
||||||
EndPaint(hWnd, &ps);
|
EndPaint(hWnd, &ps);
|
||||||
}
|
}
|
||||||
} else if(msg == WM_LBUTTONDOWN || msg == WM_MBUTTONDOWN || msg == WM_RBUTTONDOWN) {
|
} else if(msg == WM_LBUTTONDOWN || msg == WM_MBUTTONDOWN || msg == WM_RBUTTONDOWN) {
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
p.point.x = LOWORD(lp);
|
p.point.x = LOWORD(lp);
|
||||||
p.point.y = HIWORD(lp);
|
p.point.y = HIWORD(lp);
|
||||||
if(msg == WM_LBUTTONDOWN) {
|
if(msg == WM_LBUTTONDOWN) {
|
||||||
p.button = MwLLMouseLeft;
|
p.button = MwMOUSE_LEFT;
|
||||||
} else if(msg == WM_MBUTTONDOWN) {
|
} else if(msg == WM_MBUTTONDOWN) {
|
||||||
p.button = MwLLMouseMiddle;
|
p.button = MwMOUSE_MIDDLE;
|
||||||
} else if(msg == WM_RBUTTONDOWN) {
|
} else if(msg == WM_RBUTTONDOWN) {
|
||||||
p.button = MwLLMouseRight;
|
p.button = MwMOUSE_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
SetFocus(hWnd);
|
SetFocus(hWnd);
|
||||||
MwLLDispatch(u->ll, down, &p);
|
MwLLDispatch(u->ll, down, &p);
|
||||||
} else if(msg == WM_LBUTTONUP || msg == WM_MBUTTONUP || msg == WM_RBUTTONUP) {
|
} else if(msg == WM_LBUTTONUP || msg == WM_MBUTTONUP || msg == WM_RBUTTONUP) {
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
p.point.x = LOWORD(lp);
|
p.point.x = LOWORD(lp);
|
||||||
p.point.y = HIWORD(lp);
|
p.point.y = HIWORD(lp);
|
||||||
if(msg == WM_LBUTTONUP) {
|
if(msg == WM_LBUTTONUP) {
|
||||||
p.button = MwLLMouseLeft;
|
p.button = MwMOUSE_LEFT;
|
||||||
} else if(msg == WM_MBUTTONUP) {
|
} else if(msg == WM_MBUTTONUP) {
|
||||||
p.button = MwLLMouseMiddle;
|
p.button = MwMOUSE_MIDDLE;
|
||||||
} else if(msg == WM_RBUTTONUP) {
|
} else if(msg == WM_RBUTTONUP) {
|
||||||
p.button = MwLLMouseRight;
|
p.button = MwMOUSE_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCapture(NULL);
|
SetCapture(NULL);
|
||||||
MwLLDispatch(u->ll, up, &p);
|
MwLLDispatch(u->ll, up, &p);
|
||||||
} else if(msg == WM_MOUSEWHEEL) {
|
} else if(msg == WM_MOUSEWHEEL) {
|
||||||
int d = GET_WHEEL_DELTA_WPARAM(wp);
|
int d = GET_WHEEL_DELTA_WPARAM(wp);
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
p.point.x = LOWORD(lp);
|
p.point.x = LOWORD(lp);
|
||||||
p.point.y = HIWORD(lp);
|
p.point.y = HIWORD(lp);
|
||||||
|
|
||||||
if(d > 0) {
|
if(d > 0) {
|
||||||
p.button = MwLLMouseWheelUp;
|
p.button = MwMOUSE_WHEELUP;
|
||||||
} else if(d < 0) {
|
} else if(d < 0) {
|
||||||
p.button = MwLLMouseWheelDown;
|
p.button = MwMOUSE_WHEELDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
MwLLDispatch(u->ll, down, &p);
|
MwLLDispatch(u->ll, down, &p);
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ static void recursive_dispatch_resize(MwLL handle) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Recursively dispatch a move event to a widget and its children */
|
/* 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;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
if(h) {
|
if(h) {
|
||||||
int i;
|
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_sec = 0;
|
||||||
timeout.tv_usec = 100;
|
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]);
|
zwp_primary_selection_offer_v1_receive(ctx->offer.zwp, "text/plain", fds[1]);
|
||||||
} else if(ctx->offer.wl) {
|
} else if(ctx->offer.wl) {
|
||||||
wl_data_offer_receive(ctx->offer.wl, "text/plain", fds[1]);
|
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);
|
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(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.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) {
|
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 dy,
|
||||||
wl_fixed_t dxUnaccel,
|
wl_fixed_t dxUnaccel,
|
||||||
wl_fixed_t dyUnaccel) {
|
wl_fixed_t dyUnaccel) {
|
||||||
MwLL self = data;
|
MwLL self = data;
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
|
|
||||||
WAYLAND_EVENT_OP_START(self);
|
WAYLAND_EVENT_OP_START(self);
|
||||||
|
|
||||||
|
|
@ -567,9 +567,9 @@ static void zwp_relative_pointer_manager_v1_interface_destroy(struct _MwLLWaylan
|
||||||
/* `wl_pointer.motion` callback */
|
/* `wl_pointer.motion` callback */
|
||||||
static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time,
|
static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time,
|
||||||
wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
||||||
MwLL self = data;
|
MwLL self = data;
|
||||||
MwLL topmost_parent = self;
|
MwLL topmost_parent = self;
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
(void)time;
|
(void)time;
|
||||||
(void)wl_pointer;
|
(void)wl_pointer;
|
||||||
|
|
||||||
|
|
@ -590,9 +590,9 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
|
||||||
|
|
||||||
/* `wl_pointer.button` callback */
|
/* `wl_pointer.button` callback */
|
||||||
static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 serial, MwU32 time, MwU32 button, MwU32 state) {
|
static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 serial, MwU32 time, MwU32 button, MwU32 state) {
|
||||||
MwLL self = data;
|
MwLL self = data;
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
MwBool inArea = MwFALSE;
|
MwBool inArea = MwFALSE;
|
||||||
|
|
||||||
(void)wl_pointer;
|
(void)wl_pointer;
|
||||||
(void)serial;
|
(void)serial;
|
||||||
|
|
@ -613,13 +613,13 @@ static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 seri
|
||||||
|
|
||||||
switch(button) {
|
switch(button) {
|
||||||
case BTN_LEFT:
|
case BTN_LEFT:
|
||||||
p.button = MwLLMouseLeft;
|
p.button = MwMOUSE_LEFT;
|
||||||
break;
|
break;
|
||||||
case BTN_MIDDLE:
|
case BTN_MIDDLE:
|
||||||
p.button = MwLLMouseMiddle;
|
p.button = MwMOUSE_MIDDLE;
|
||||||
break;
|
break;
|
||||||
case BTN_RIGHT:
|
case BTN_RIGHT:
|
||||||
p.button = MwLLMouseRight;
|
p.button = MwMOUSE_RIGHT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
self->wayland.held_down = state == WL_POINTER_BUTTON_STATE_PRESSED;
|
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) {
|
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.
|
/* 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;
|
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));
|
handle->wayland.clipboard_buffer = malloc(strlen(text));
|
||||||
strcpy(handle->wayland.clipboard_buffer, text);
|
strcpy(handle->wayland.clipboard_buffer, text);
|
||||||
|
|
||||||
if(clipboard_type == MwClipboardPrimary) {
|
if(clipboard_type == MwCLIPBOARD_PRIMARY) {
|
||||||
if(handle->wayland.supports_zwp) {
|
if(handle->wayland.supports_zwp) {
|
||||||
for(i = 0; i < arrlen(handle->wayland.clipboard_devices_zwp); i++) {
|
for(i = 0; i < arrlen(handle->wayland.clipboard_devices_zwp); i++) {
|
||||||
wl_clipboard_device_context_t* device = 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) {
|
static void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) {
|
||||||
int i;
|
int i;
|
||||||
if(clipboard_type == MwClipboardPrimary) {
|
if(clipboard_type == MwCLIPBOARD_PRIMARY) {
|
||||||
if(handle->wayland.supports_zwp) {
|
if(handle->wayland.supports_zwp) {
|
||||||
for(i = 0; i < arrlen(handle->wayland.clipboard_devices_zwp); i++) {
|
for(i = 0; i < arrlen(handle->wayland.clipboard_devices_zwp); i++) {
|
||||||
wl_clipboard_read(
|
wl_clipboard_read(
|
||||||
|
|
|
||||||
|
|
@ -694,38 +694,38 @@ static void MwLLNextEventImpl(MwLL handle) {
|
||||||
handle->x11.force_render = 0;
|
handle->x11.force_render = 0;
|
||||||
render = 1;
|
render = 1;
|
||||||
} else if(ev.type == ButtonPress) {
|
} else if(ev.type == ButtonPress) {
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
p.point.x = ev.xbutton.x;
|
p.point.x = ev.xbutton.x;
|
||||||
p.point.y = ev.xbutton.y;
|
p.point.y = ev.xbutton.y;
|
||||||
if(ev.xbutton.button == Button1) {
|
if(ev.xbutton.button == Button1) {
|
||||||
p.button = MwLLMouseLeft;
|
p.button = MwMOUSE_LEFT;
|
||||||
} else if(ev.xbutton.button == Button2) {
|
} else if(ev.xbutton.button == Button2) {
|
||||||
p.button = MwLLMouseMiddle;
|
p.button = MwMOUSE_MIDDLE;
|
||||||
} else if(ev.xbutton.button == Button3) {
|
} else if(ev.xbutton.button == Button3) {
|
||||||
p.button = MwLLMouseRight;
|
p.button = MwMOUSE_RIGHT;
|
||||||
} else if(ev.xbutton.button == Button4) {
|
} else if(ev.xbutton.button == Button4) {
|
||||||
p.button = MwLLMouseWheelUp;
|
p.button = MwMOUSE_WHEELUP;
|
||||||
} else if(ev.xbutton.button == Button5) {
|
} else if(ev.xbutton.button == Button5) {
|
||||||
p.button = MwLLMouseWheelDown;
|
p.button = MwMOUSE_WHEELDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetInputFocus(handle->x11.display, handle->x11.window, RevertToNone, CurrentTime);
|
XSetInputFocus(handle->x11.display, handle->x11.window, RevertToNone, CurrentTime);
|
||||||
|
|
||||||
MwLLDispatch(handle, down, &p);
|
MwLLDispatch(handle, down, &p);
|
||||||
} else if(ev.type == ButtonRelease) {
|
} else if(ev.type == ButtonRelease) {
|
||||||
MwLLMouse p;
|
MwMouse p;
|
||||||
p.point.x = ev.xbutton.x;
|
p.point.x = ev.xbutton.x;
|
||||||
p.point.y = ev.xbutton.y;
|
p.point.y = ev.xbutton.y;
|
||||||
if(ev.xbutton.button == Button1) {
|
if(ev.xbutton.button == Button1) {
|
||||||
p.button = MwLLMouseLeft;
|
p.button = MwMOUSE_LEFT;
|
||||||
} else if(ev.xbutton.button == Button2) {
|
} else if(ev.xbutton.button == Button2) {
|
||||||
p.button = MwLLMouseMiddle;
|
p.button = MwMOUSE_MIDDLE;
|
||||||
} else if(ev.xbutton.button == Button3) {
|
} else if(ev.xbutton.button == Button3) {
|
||||||
p.button = MwLLMouseRight;
|
p.button = MwMOUSE_RIGHT;
|
||||||
} else if(ev.xbutton.button == Button4) {
|
} else if(ev.xbutton.button == Button4) {
|
||||||
p.button = MwLLMouseWheelUp;
|
p.button = MwMOUSE_WHEELUP;
|
||||||
} else if(ev.xbutton.button == Button5) {
|
} else if(ev.xbutton.button == Button5) {
|
||||||
p.button = MwLLMouseWheelDown;
|
p.button = MwMOUSE_WHEELDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
MwLLDispatch(handle, up, &p);
|
MwLLDispatch(handle, up, &p);
|
||||||
|
|
|
||||||
17
src/core.c
17
src/core.c
|
|
@ -52,22 +52,23 @@ static void lldrawhandler(MwLL handle, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lluphandler(MwLL handle, void* data) {
|
static void lluphandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
MwLLMouse* p = data;
|
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.x = p->point.x;
|
||||||
h->mouse_point.y = p->point.y;
|
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);
|
MwDispatch3(h, mouse_up, data);
|
||||||
MwDispatchUserHandler(h, MwNmouseUpHandler, data);
|
MwDispatchUserHandler(h, MwNmouseUpHandler, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lldownhandler(MwLL handle, void* data) {
|
static void lldownhandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
MwLLMouse* p = data;
|
MwMouse* p = data;
|
||||||
if(p->button == MwLLMouseLeft) h->pressed = 1;
|
|
||||||
|
if(p->button == MwMOUSE_LEFT) h->pressed = 1;
|
||||||
h->mouse_point.x = p->point.x;
|
h->mouse_point.x = p->point.x;
|
||||||
h->mouse_point.y = p->point.y;
|
h->mouse_point.y = p->point.y;
|
||||||
|
|
||||||
|
|
@ -962,7 +963,7 @@ int MwGetCoordinateType(MwWidget handle) {
|
||||||
if(handle->parent == NULL || handle->parent->lowlevel == NULL) {
|
if(handle->parent == NULL || handle->parent->lowlevel == NULL) {
|
||||||
return handle->lowlevel->common.coordinate_type;
|
return handle->lowlevel->common.coordinate_type;
|
||||||
} else {
|
} else {
|
||||||
return MwCoordinatesLocal;
|
return MwCOORDINATE_LOCAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
static void color_picker_click(MwWidget handle, void* user, void* call) {
|
||||||
color_picker_t* picker = user;
|
color_picker_t* picker = user;
|
||||||
MwLLMouse* mouse = call;
|
MwMouse* mouse = call;
|
||||||
char hexColor[8];
|
char hexColor[8];
|
||||||
int i;
|
int i;
|
||||||
char fgColor[8];
|
char fgColor[8];
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ static void layout(MwWidget handle) {
|
||||||
MwNleftPadding, 16,
|
MwNleftPadding, 16,
|
||||||
NULL);
|
NULL);
|
||||||
MwListBoxInsert(fc->nav, -1, p);
|
MwListBoxInsert(fc->nav, -1, p);
|
||||||
MwAddUserHandler(fc->nav, MwNactivateHandler, nav_activate, NULL);
|
MwAddUserHandler(fc->nav, MwNlistBoxActivateHandler, nav_activate, NULL);
|
||||||
|
|
||||||
MwListBoxDestroyPacket(p);
|
MwListBoxDestroyPacket(p);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -242,7 +242,7 @@ static void layout(MwWidget handle) {
|
||||||
MwNhasHeading, 1,
|
MwNhasHeading, 1,
|
||||||
MwNleftPadding, 16,
|
MwNleftPadding, 16,
|
||||||
NULL);
|
NULL);
|
||||||
MwAddUserHandler(fc->files, MwNactivateHandler, files_activate, NULL);
|
MwAddUserHandler(fc->files, MwNlistBoxActivateHandler, files_activate, NULL);
|
||||||
} else {
|
} else {
|
||||||
MwVaApply(fc->files,
|
MwVaApply(fc->files,
|
||||||
MwNx, wx,
|
MwNx, wx,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ static void listbox_activate(MwWidget handle, void* user, void* client) {
|
||||||
|
|
||||||
MwForceRender(handle->parent);
|
MwForceRender(handle->parent);
|
||||||
|
|
||||||
MwDispatchUserHandler(handle->parent, MwNchangedHandler, client);
|
MwDispatchUserHandler(handle->parent, MwNcomboBoxChangedHandler, client);
|
||||||
|
|
||||||
MwDestroyWidget(handle);
|
MwDestroyWidget(handle);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ static void key(MwWidget handle, int code) {
|
||||||
} else if(code == MwLLKeyEnter) {
|
} else if(code == MwLLKeyEnter) {
|
||||||
MwDispatchUserHandler(handle, MwNactivateHandler, NULL);
|
MwDispatchUserHandler(handle, MwNactivateHandler, NULL);
|
||||||
} else if(code == (MwLLControlMask | 'v')) {
|
} else if(code == (MwLLControlMask | 'v')) {
|
||||||
MwLLGetClipboard(handle->lowlevel, MwClipboardMain);
|
MwLLGetClipboard(handle->lowlevel, MwCLIPBOARD_MAIN);
|
||||||
} else if(!(code & MwLLKeyMask)) {
|
} else if(!(code & MwLLKeyMask)) {
|
||||||
int incr = 0;
|
int incr = 0;
|
||||||
out = malloc(strlen(str) + 5 + 1);
|
out = malloc(strlen(str) + 5 + 1);
|
||||||
|
|
@ -136,9 +136,9 @@ static void key(MwWidget handle, int code) {
|
||||||
#if defined(USE_X11) || defined(USE_WAYLAND)
|
#if defined(USE_X11) || defined(USE_WAYLAND)
|
||||||
static void mouse_up(MwWidget handle, void* ptr) {
|
static void mouse_up(MwWidget handle, void* ptr) {
|
||||||
if(handle->lowlevel->common.type == MwLLBackendWayland || handle->lowlevel->common.type == MwLLBackendX11) {
|
if(handle->lowlevel->common.type == MwLLBackendWayland || handle->lowlevel->common.type == MwLLBackendX11) {
|
||||||
MwLLMouse* mouse = ptr;
|
MwMouse* mouse = ptr;
|
||||||
if(mouse->button == MwLLMouseMiddle) {
|
if(mouse->button == MwMOUSE_MIDDLE) {
|
||||||
MwLLGetClipboard(handle->lowlevel, MwClipboardPrimary);
|
MwLLGetClipboard(handle->lowlevel, MwCLIPBOARD_PRIMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MwForceRender2(handle, NULL);
|
MwForceRender2(handle, NULL);
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
||||||
MwListBox lb = handle->parent->internal;
|
MwListBox lb = handle->parent->internal;
|
||||||
MwLLMouse* m = call;
|
MwMouse* m = call;
|
||||||
|
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
if(m->button == MwLLMouseLeft) {
|
if(m->button == MwMOUSE_LEFT) {
|
||||||
int st = 0;
|
int st = 0;
|
||||||
int i;
|
int i;
|
||||||
int y = MwDefaultBorderWidth(handle);
|
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)) {
|
if((((t = MwTimeGetTick()) - lb->click_time) < MwDoubleClickTimeout && old == st + i) || MwGetInteger(handle->parent, MwNsingleClickSelectable)) {
|
||||||
int n = MwGetInteger(handle->parent, MwNvalue);
|
int n = MwGetInteger(handle->parent, MwNvalue);
|
||||||
MwDispatchUserHandler(handle->parent, MwNactivateHandler, &n);
|
MwDispatchUserHandler(handle->parent, MwNlistBoxActivateHandler, &n);
|
||||||
}
|
}
|
||||||
|
|
||||||
lb->click_time = t;
|
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) {
|
static void frame_mouse_up(MwWidget handle, void* user, void* call) {
|
||||||
MwListBox lb = handle->parent->internal;
|
MwListBox lb = handle->parent->internal;
|
||||||
MwLLMouse* m = call;
|
MwMouse* m = call;
|
||||||
|
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
if(m->button == MwLLMouseLeft) {
|
if(m->button == MwMOUSE_LEFT) {
|
||||||
lb->pressed = 0;
|
lb->pressed = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ static void parent_resize(MwWidget handle) {
|
||||||
static void mouse_down(MwWidget handle, void* ptr) {
|
static void mouse_down(MwWidget handle, void* ptr) {
|
||||||
MENU_LOOP_DECL;
|
MENU_LOOP_DECL;
|
||||||
|
|
||||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
if(((MwMouse*)ptr)->button != MwMOUSE_LEFT) return;
|
||||||
|
|
||||||
BEGIN_MENU_LOOP;
|
BEGIN_MENU_LOOP;
|
||||||
if(in_area) {
|
if(in_area) {
|
||||||
|
|
@ -150,7 +150,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
|
||||||
static void mouse_up(MwWidget handle, void* ptr) {
|
static void mouse_up(MwWidget handle, void* ptr) {
|
||||||
MENU_LOOP_DECL;
|
MENU_LOOP_DECL;
|
||||||
|
|
||||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
if(((MwMouse*)ptr)->button != MwMOUSE_LEFT) return;
|
||||||
|
|
||||||
BEGIN_MENU_LOOP;
|
BEGIN_MENU_LOOP;
|
||||||
if(in_area && m->sub[i]->wsub != NULL) {
|
if(in_area && m->sub[i]->wsub != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ static void mouse_up(MwWidget handle, void* ptr) {
|
||||||
int h = MwGetInteger(handle, MwNheight);
|
int h = MwGetInteger(handle, MwNheight);
|
||||||
const char* str = MwGetText(handle, MwNtext);
|
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)) {
|
if(e->mouse.x >= (w - e->right)) {
|
||||||
char s[512];
|
char s[512];
|
||||||
|
|
@ -116,7 +116,7 @@ static void mouse_up(MwWidget handle, void* ptr) {
|
||||||
static void mouse_down(MwWidget handle, void* ptr) {
|
static void mouse_down(MwWidget handle, void* ptr) {
|
||||||
MwEntry e = handle->internal;
|
MwEntry e = handle->internal;
|
||||||
|
|
||||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
if(((MwMouse*)ptr)->button != MwMOUSE_LEFT) return;
|
||||||
|
|
||||||
e->mouse = handle->mouse_point;
|
e->mouse = handle->mouse_point;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,9 +170,9 @@ static void mouse_down(MwWidget handle, void* ptr) {
|
||||||
int wh = MwGetInteger(handle, MwNheight);
|
int wh = MwGetInteger(handle, MwNheight);
|
||||||
int or = MwGetInteger(handle, MwNorientation);
|
int or = MwGetInteger(handle, MwNorientation);
|
||||||
MwScrollBar scr = handle->internal;
|
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 min = MwGetInteger(handle, MwNminValue);
|
||||||
int val = MwGetInteger(handle, MwNvalue);
|
int val = MwGetInteger(handle, MwNvalue);
|
||||||
int diff = MwGetInteger(handle, MwNareaShown);
|
int diff = MwGetInteger(handle, MwNareaShown);
|
||||||
|
|
@ -184,7 +184,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
|
||||||
MwSetInteger(handle, MwNvalue, val);
|
MwSetInteger(handle, MwNvalue, val);
|
||||||
MwSetInteger(handle, MwNchangedBy, -diff);
|
MwSetInteger(handle, MwNchangedBy, -diff);
|
||||||
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
|
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
|
||||||
} else if(m->button == MwLLMouseWheelDown) {
|
} else if(m->button == MwMOUSE_WHEELDOWN) {
|
||||||
int max = MwGetInteger(handle, MwNmaxValue);
|
int max = MwGetInteger(handle, MwNmaxValue);
|
||||||
int val = MwGetInteger(handle, MwNvalue);
|
int val = MwGetInteger(handle, MwNvalue);
|
||||||
int diff = MwGetInteger(handle, MwNareaShown);
|
int diff = MwGetInteger(handle, MwNareaShown);
|
||||||
|
|
@ -197,7 +197,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
|
||||||
MwSetInteger(handle, MwNchangedBy, diff);
|
MwSetInteger(handle, MwNchangedBy, diff);
|
||||||
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
|
MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
|
||||||
}
|
}
|
||||||
if(m->button != MwLLMouseLeft) return;
|
if(m->button != MwMOUSE_LEFT) return;
|
||||||
|
|
||||||
scr->point = handle->mouse_point;
|
scr->point = handle->mouse_point;
|
||||||
scr->drag = 0;
|
scr->drag = 0;
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point, in
|
||||||
MwLLMakeToolWindow(handle->lowlevel);
|
MwLLMakeToolWindow(handle->lowlevel);
|
||||||
MwLLDetach(handle->lowlevel, &p);
|
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) {
|
if(MwGetInteger(handle, MwNy) + sz.height > rc.height) {
|
||||||
MwVaApply(handle,
|
MwVaApply(handle,
|
||||||
MwNy, rc.height - sz.height,
|
MwNy, rc.height - sz.height,
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
||||||
set_all(root, 0);
|
set_all(root, 0);
|
||||||
tree->selected = 1;
|
tree->selected = 1;
|
||||||
if(((t = MwTimeGetTick()) - tree->click_time) < MwDoubleClickTimeout || MwGetInteger(handle->parent, MwNsingleClickSelectable)) {
|
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;
|
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) {
|
static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
||||||
MwTreeView tv = handle->parent->internal;
|
MwTreeView tv = handle->parent->internal;
|
||||||
MwLLMouse* mouse = call;
|
MwMouse* mouse = call;
|
||||||
|
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
if(mouse->button == MwLLMouseLeft) tv->pressed = mouse->point;
|
if(mouse->button == MwMOUSE_LEFT) tv->pressed = mouse->point;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resize(MwWidget handle);
|
static void resize(MwWidget handle);
|
||||||
|
|
@ -227,11 +227,11 @@ static void frame_mouse_up(MwWidget handle, void* user, void* call) {
|
||||||
int shared = 0;
|
int shared = 0;
|
||||||
int skip = MwGetInteger(tv->vscroll, MwNvalue) * (MwGetInteger(tv->vscroll, MwNmaxValue) - MwGetInteger(tv->vscroll, MwNareaShown)) / MwGetInteger(tv->vscroll, MwNmaxValue);
|
int skip = MwGetInteger(tv->vscroll, MwNvalue) * (MwGetInteger(tv->vscroll, MwNmaxValue) - MwGetInteger(tv->vscroll, MwNareaShown)) / MwGetInteger(tv->vscroll, MwNmaxValue);
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
MwLLMouse* mouse = call;
|
MwMouse* mouse = call;
|
||||||
|
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
if(mouse->button == MwLLMouseLeft) {
|
if(mouse->button == MwMOUSE_LEFT) {
|
||||||
int i;
|
int i;
|
||||||
p.x = MwDefaultBorderWidth(tv->frame);
|
p.x = MwDefaultBorderWidth(tv->frame);
|
||||||
p.y = MwDefaultBorderWidth(tv->frame);
|
p.y = MwDefaultBorderWidth(tv->frame);
|
||||||
|
|
|
||||||
|
|
@ -523,23 +523,23 @@ static void* mwVulkanGetFieldImpl(MwWidget handle, int field, int* out) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
switch(field) {
|
switch(field) {
|
||||||
case MwVulkanField_GetInstanceProcAddr:
|
case MwVULKANFIELD_GETINSTANCEPROCADDR:
|
||||||
return o->vkGetInstanceProcAddr;
|
return o->vkGetInstanceProcAddr;
|
||||||
case MwVulkanField_Instance:
|
case MwVULKANFIELD_INSTANCE:
|
||||||
return o->vkInstance;
|
return o->vkInstance;
|
||||||
case MwVulkanField_Surface:
|
case MwVULKANFIELD_SURFACE:
|
||||||
return o->vkSurface;
|
return o->vkSurface;
|
||||||
case MwVulkanField_PhysicalDevice:
|
case MwVULKANFIELD_PHYSICALDEVICE:
|
||||||
return o->vkPhysicalDevice;
|
return o->vkPhysicalDevice;
|
||||||
case MwVulkanField_LogicalDevice:
|
case MwVULKANFIELD_LOGICALDEVICE:
|
||||||
return o->vkLogicalDevice;
|
return o->vkLogicalDevice;
|
||||||
case MwVulkanField_GraphicsQueueIndex:
|
case MwVULKANFIELD_GRAPHICSQUEUEINDEX:
|
||||||
return &o->vkGraphicsFamilyIDX;
|
return &o->vkGraphicsFamilyIDX;
|
||||||
case MwVulkanField_PresentQueueIndex:
|
case MwVULKANFIELD_PRESENTQUEUEINDEX:
|
||||||
return &o->vkPresentFamilyIDX;
|
return &o->vkPresentFamilyIDX;
|
||||||
case MwVulkanField_GraphicsQueue:
|
case MwVULKANFIELD_GRAPHICSQUEUE:
|
||||||
return o->vkGraphicsQueue;
|
return o->vkGraphicsQueue;
|
||||||
case MwVulkanField_PresentQueue:
|
case MwVULKANFIELD_PRESENTQUEUE:
|
||||||
return o->vkPresentQueue;
|
return o->vkPresentQueue;
|
||||||
default:
|
default:
|
||||||
MwStringPrintIntoBuffer(buf, 1024, "Unknown vulkan field request (%d given)", field);
|
MwStringPrintIntoBuffer(buf, 1024, "Unknown vulkan field request (%d given)", field);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue