This commit is contained in:
parent
ece1527689
commit
4423c318e8
6 changed files with 6 additions and 19 deletions
|
|
@ -246,13 +246,6 @@ MWDECL void MwSetErrorHandler(MwErrorHandler handler, void* user_data);
|
||||||
*/
|
*/
|
||||||
MWDECL void MwDispatchError(int code, const char* message);
|
MWDECL void MwDispatchError(int code, const char* message);
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Gets the before_step of widget
|
|
||||||
* @param handle Widget
|
|
||||||
* @param jmpbuf jmp_buf
|
|
||||||
*/
|
|
||||||
MWDECL void MwGetBeforeStep(MwWidget handle, jmp_buf* jmpbuf);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Forcefully makes widget render
|
* @brief Forcefully makes widget render
|
||||||
* @param handle Widget
|
* @param handle Widget
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ struct _MwLLWayland {
|
||||||
}* wl_protocol_map;
|
}* wl_protocol_map;
|
||||||
|
|
||||||
MwBool has_decorations;
|
MwBool has_decorations;
|
||||||
char title[255];
|
char title[256];
|
||||||
|
|
||||||
struct xkb_context* xkb_context;
|
struct xkb_context* xkb_context;
|
||||||
struct xkb_keymap* xkb_keymap;
|
struct xkb_keymap* xkb_keymap;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <setjmp.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ typedef void* MwWidget;
|
||||||
#endif
|
#endif
|
||||||
typedef void (*MwHandler)(MwWidget handle);
|
typedef void (*MwHandler)(MwWidget handle);
|
||||||
typedef int (*MwHandlerWithStatus)(MwWidget handle);
|
typedef int (*MwHandlerWithStatus)(MwWidget handle);
|
||||||
|
typedef void (*MwHandlerProps)(MwWidget handle, const char** key);
|
||||||
typedef void (*MwHandlerProp)(MwWidget handle, const char* key);
|
typedef void (*MwHandlerProp)(MwWidget handle, const char* key);
|
||||||
typedef void (*MwHandlerChildrenProp)(MwWidget handle, MwWidget child, const char* key);
|
typedef void (*MwHandlerChildrenProp)(MwWidget handle, MwWidget child, const char* key);
|
||||||
typedef void (*MwHandlerKey)(MwWidget handle, int key);
|
typedef void (*MwHandlerKey)(MwWidget handle, int key);
|
||||||
|
|
@ -85,7 +86,6 @@ struct _MwWidget {
|
||||||
int pressed;
|
int pressed;
|
||||||
MwPoint mouse_point;
|
MwPoint mouse_point;
|
||||||
int close;
|
int close;
|
||||||
jmp_buf before_step;
|
|
||||||
int prop_event;
|
int prop_event;
|
||||||
|
|
||||||
void* internal;
|
void* internal;
|
||||||
|
|
@ -228,10 +228,10 @@ struct _MwClass {
|
||||||
MwHandler children_update;
|
MwHandler children_update;
|
||||||
MwHandlerChildrenProp children_prop_change;
|
MwHandlerChildrenProp children_prop_change;
|
||||||
MwHandlerClipboardReceived clipboard;
|
MwHandlerClipboardReceived clipboard;
|
||||||
|
MwHandlerProps props_change;
|
||||||
void* reserved1;
|
void* reserved1;
|
||||||
void* reserved2;
|
void* reserved2;
|
||||||
void* reserved3;
|
void* reserved3;
|
||||||
void* reserved4;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -340,8 +340,8 @@ static void MwFreeWidget(MwWidget handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->destroyed = 0;
|
handle->destroyed = 0;
|
||||||
MwDispatch(handle, destroy);
|
|
||||||
if(handle->destroy_inject != NULL) handle->destroy_inject(handle);
|
if(handle->destroy_inject != NULL) handle->destroy_inject(handle);
|
||||||
|
MwDispatch(handle, destroy);
|
||||||
|
|
||||||
for(i = 0; i < arrlen(handle->children); i++) {
|
for(i = 0; i < arrlen(handle->children); i++) {
|
||||||
MwFreeWidget(handle->children[i]);
|
MwFreeWidget(handle->children[i]);
|
||||||
|
|
@ -392,6 +392,8 @@ static void destroy_children(MwWidget handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwDestroyWidget(MwWidget handle) {
|
void MwDestroyWidget(MwWidget handle) {
|
||||||
|
if(handle->destroyed) return;
|
||||||
|
|
||||||
if(handle->parent != NULL) {
|
if(handle->parent != NULL) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < arrlen(handle->parent->destroy_queue); i++) {
|
for(i = 0; i < arrlen(handle->parent->destroy_queue); i++) {
|
||||||
|
|
@ -457,7 +459,6 @@ static void MwAfterStep(MwWidget handle) {
|
||||||
int MwStep(MwWidget handle) {
|
int MwStep(MwWidget handle) {
|
||||||
int i;
|
int i;
|
||||||
MwWidget* widgets = NULL;
|
MwWidget* widgets = NULL;
|
||||||
if(setjmp(handle->before_step)) return 0;
|
|
||||||
for(i = 0; i < arrlen(handle->children); i++) {
|
for(i = 0; i < arrlen(handle->children); i++) {
|
||||||
arrput(widgets, handle->children[i]);
|
arrput(widgets, handle->children[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -859,10 +860,6 @@ void MwDispatchError(int code, const char* message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwGetBeforeStep(MwWidget handle, jmp_buf* jmpbuf) {
|
|
||||||
memcpy(jmpbuf, &handle->before_step, sizeof(*jmpbuf));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MwForceRender(MwWidget handle) {
|
void MwForceRender(MwWidget handle) {
|
||||||
MwLLForceRender(handle->lowlevel);
|
MwLLForceRender(handle->lowlevel);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ static void draw(MwWidget handle) {
|
||||||
|
|
||||||
static void click(MwWidget handle) {
|
static void click(MwWidget handle) {
|
||||||
MwWidget w = handle;
|
MwWidget w = handle;
|
||||||
jmp_buf jmp;
|
|
||||||
MwMenu menu = handle->internal;
|
MwMenu menu = handle->internal;
|
||||||
|
|
||||||
if(arrlen(menu->sub) > 0) {
|
if(arrlen(menu->sub) > 0) {
|
||||||
|
|
@ -152,7 +151,6 @@ static void click(MwWidget handle) {
|
||||||
MwForceRender(handle);
|
MwForceRender(handle);
|
||||||
} else if(strcmp(menu->sub[i]->name, "----") != 0 && arrlen(menu->sub[i]->sub) == 0) {
|
} else if(strcmp(menu->sub[i]->name, "----") != 0 && arrlen(menu->sub[i]->sub) == 0) {
|
||||||
while(w->parent->widget_class == MwSubMenuClass) w = w->parent;
|
while(w->parent->widget_class == MwSubMenuClass) w = w->parent;
|
||||||
MwGetBeforeStep(w, &jmp);
|
|
||||||
|
|
||||||
MwDestroyWidget(w);
|
MwDestroyWidget(w);
|
||||||
((MwMenu)w->internal)->wsub = NULL;
|
((MwMenu)w->internal)->wsub = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue