more handler

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@268 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-11 11:46:28 +00:00
parent 927f9577ca
commit a5dae3ffd9
5 changed files with 33 additions and 12 deletions

View File

@@ -81,13 +81,19 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
int n = wp;
MwLLDispatch(u->ll, key, &n);
} else if(msg == WM_KEYDOWN) {
} else if(msg == WM_KEYDOWN || msg == WM_KEYUP) {
int n = -1;
if(wp == VK_LEFT) n = MwLLKeyLeft;
if(wp == VK_RIGHT) n = MwLLKeyRight;
if(wp == VK_UP) n = MwLLKeyUp;
if(wp == VK_DOWN) n = MwLLKeyDown;
if(n != -1) MwLLDispatch(u->ll, key, &n);
if(n != -1) {
if(msg == WM_KEYDOWN) {
MwLLDispatch(u->ll, key, &n);
} else {
MwLLDispatch(u->ll, key_released, &n);
}
}
} else if(msg == WM_GETMINMAXINFO) {
if(u->min_set || u->max_set) {
LPARAM style = GetWindowLongPtr(hWnd, GWL_STYLE);

View File

@@ -200,7 +200,7 @@ void MwLLNextEvent(MwLL handle) {
p.y = ev.xmotion.y;
MwLLDispatch(handle, move, &p);
} else if(ev.type == KeyPress) {
} else if(ev.type == KeyPress || ev.type == KeyRelease) {
int n = -1;
char str[512];
KeySym sym;
@@ -237,7 +237,13 @@ void MwLLNextEvent(MwLL handle) {
n = MwLLKeyDown;
}
if(n != -1) MwLLDispatch(handle, key, &n);
if(n != -1) {
if(ev.type == KeyPress) {
MwLLDispatch(handle, key, &n);
} else {
MwLLDispatch(handle, key_released, &n);
}
}
}
if(render) {
int x, y;