mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-06 17:39:45 +00:00
fix some broken stuff
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@232 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -46,6 +46,7 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
||||
p.y = HIWORD(lp);
|
||||
|
||||
SetCapture(hWnd);
|
||||
SetFocus(hWnd);
|
||||
MwLLDispatch(u->ll, down, &p);
|
||||
} else if(msg == WM_LBUTTONUP) {
|
||||
MwPoint p;
|
||||
@@ -71,6 +72,10 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
||||
PostQuitMessage(0);
|
||||
} else if(msg == WM_CLOSE) {
|
||||
DestroyWindow(hWnd);
|
||||
} else if(msg == WM_CHAR) {
|
||||
int n = wp;
|
||||
|
||||
MwLLDispatch(u->ll, key, &n);
|
||||
} else {
|
||||
return (u->old == NULL) ? DefWindowProc(hWnd, msg, wp, lp) : CallWindowProc(u->old, hWnd, msg, wp, lp);
|
||||
}
|
||||
@@ -389,3 +394,8 @@ void MwLLDetach(MwLL handle, MwPoint* point) {
|
||||
|
||||
SetWindowLongPtr(handle->hWnd, GWL_STYLE, style);
|
||||
}
|
||||
|
||||
void MwLLShow(MwLL handle, int show) {
|
||||
ShowWindow(handle->hWnd, show ? SW_NORMAL : SW_HIDE);
|
||||
if(show) SetFocus(handle->hWnd);
|
||||
}
|
||||
|
||||
@@ -185,15 +185,18 @@ void MwLLNextEvent(MwLL handle) {
|
||||
int n;
|
||||
KeySym sym = XLookupKeysym(&ev.xkey, 0);
|
||||
char* str = XKeysymToString(sym);
|
||||
char s = str == NULL ? 0 : str[0];
|
||||
/* HACK: this is bad, you can guess why */
|
||||
if(strlen(str) == 1) {
|
||||
char s = str == NULL ? 0 : str[0];
|
||||
|
||||
if(ev.xkey.state & (ShiftMask | LockMask)) {
|
||||
n = toupper((int)s);
|
||||
} else {
|
||||
n = s;
|
||||
if(ev.xkey.state & (ShiftMask | LockMask)) {
|
||||
n = toupper((int)s);
|
||||
} else {
|
||||
n = s;
|
||||
}
|
||||
|
||||
MwLLDispatch(handle, key, &n);
|
||||
}
|
||||
|
||||
MwLLDispatch(handle, key, &n);
|
||||
}
|
||||
if(render) {
|
||||
int x, y;
|
||||
|
||||
@@ -24,6 +24,10 @@ static void draw(MwWidget handle) {
|
||||
MwLLFreeColor(base);
|
||||
}
|
||||
|
||||
static void key(MwWidget handle, int code) {
|
||||
printf("%c\n", code);
|
||||
}
|
||||
|
||||
MwClassRec MwTextClassRec = {
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
@@ -34,7 +38,7 @@ MwClassRec MwTextClassRec = {
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender, /* mouse_up */
|
||||
MwForceRender, /* mouse_down */
|
||||
NULL, /* key */
|
||||
key, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
Reference in New Issue
Block a user