mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-09 10:53:27 +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);
|
p.y = HIWORD(lp);
|
||||||
|
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
|
SetFocus(hWnd);
|
||||||
MwLLDispatch(u->ll, down, &p);
|
MwLLDispatch(u->ll, down, &p);
|
||||||
} else if(msg == WM_LBUTTONUP) {
|
} else if(msg == WM_LBUTTONUP) {
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
@@ -71,6 +72,10 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
|||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
} else if(msg == WM_CLOSE) {
|
} else if(msg == WM_CLOSE) {
|
||||||
DestroyWindow(hWnd);
|
DestroyWindow(hWnd);
|
||||||
|
} else if(msg == WM_CHAR) {
|
||||||
|
int n = wp;
|
||||||
|
|
||||||
|
MwLLDispatch(u->ll, key, &n);
|
||||||
} else {
|
} else {
|
||||||
return (u->old == NULL) ? DefWindowProc(hWnd, msg, wp, lp) : CallWindowProc(u->old, hWnd, msg, wp, lp);
|
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);
|
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,6 +185,8 @@ void MwLLNextEvent(MwLL handle) {
|
|||||||
int n;
|
int n;
|
||||||
KeySym sym = XLookupKeysym(&ev.xkey, 0);
|
KeySym sym = XLookupKeysym(&ev.xkey, 0);
|
||||||
char* str = XKeysymToString(sym);
|
char* str = XKeysymToString(sym);
|
||||||
|
/* HACK: this is bad, you can guess why */
|
||||||
|
if(strlen(str) == 1) {
|
||||||
char s = str == NULL ? 0 : str[0];
|
char s = str == NULL ? 0 : str[0];
|
||||||
|
|
||||||
if(ev.xkey.state & (ShiftMask | LockMask)) {
|
if(ev.xkey.state & (ShiftMask | LockMask)) {
|
||||||
@@ -195,6 +197,7 @@ void MwLLNextEvent(MwLL handle) {
|
|||||||
|
|
||||||
MwLLDispatch(handle, key, &n);
|
MwLLDispatch(handle, key, &n);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(render) {
|
if(render) {
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned int w, h;
|
unsigned int w, h;
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ static void draw(MwWidget handle) {
|
|||||||
MwLLFreeColor(base);
|
MwLLFreeColor(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void key(MwWidget handle, int code) {
|
||||||
|
printf("%c\n", code);
|
||||||
|
}
|
||||||
|
|
||||||
MwClassRec MwTextClassRec = {
|
MwClassRec MwTextClassRec = {
|
||||||
create, /* create */
|
create, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
@@ -34,7 +38,7 @@ MwClassRec MwTextClassRec = {
|
|||||||
NULL, /* mouse_move */
|
NULL, /* mouse_move */
|
||||||
MwForceRender, /* mouse_up */
|
MwForceRender, /* mouse_up */
|
||||||
MwForceRender, /* mouse_down */
|
MwForceRender, /* mouse_down */
|
||||||
NULL, /* key */
|
key, /* key */
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user