Hooked up the Windows menu event system and fixed some bugs in it. Still need to define menu events in general...
This commit is contained in:
parent
dc386a599e
commit
ac8e59c004
|
@ -93,7 +93,7 @@ HMENU makeMenubar(void)
|
|||
// this is slow, but it will do for now
|
||||
// TODO investigate faster options
|
||||
|
||||
static const uiMenuItem *lookupID(const uiMenu *items, UINT_PTR *cur, UINT_PTR id)
|
||||
static const uiMenuItem *lookupID(const uiMenuItem *items, UINT_PTR *cur, UINT_PTR id)
|
||||
{
|
||||
const uiMenuItem *i;
|
||||
|
||||
|
@ -115,7 +115,7 @@ const uiMenuItem *menuIDToItem(UINT_PTR id)
|
|||
|
||||
cur = 100;
|
||||
for (m = options.Menu; m->Name != NULL; m++) {
|
||||
item = lookupID(m, &cur, id);
|
||||
item = lookupID(m->Items, &cur, id);
|
||||
if (item != NULL)
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
|
|||
WINDOWPOS *wp = (WINDOWPOS *) lParam;
|
||||
RECT r;
|
||||
HWND contenthwnd;
|
||||
const uiMenuItem *item;
|
||||
|
||||
w = (struct window *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||
if (w == NULL) {
|
||||
|
@ -30,6 +31,18 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
|
|||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
switch (uMsg) {
|
||||
case WM_COMMAND:
|
||||
// not a menu
|
||||
if (lParam != 0)
|
||||
break;
|
||||
if (HIWORD(wParam) != 0)
|
||||
break;
|
||||
item = menuIDToItem(LOWORD(wParam));
|
||||
printf("%d", item->Type);
|
||||
if (item->Type == uiMenuItemTypeCommand)
|
||||
printf(" %s", item->Name);
|
||||
printf("\n");
|
||||
return 0;
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
if ((wp->flags & SWP_NOSIZE) != 0)
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue