@@ -373,22 +373,18 @@ static LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
373373 WriteCurrentLayoutNumber ();
374374 } else if (wmId == CMD_EDITLAYOUT ) {
375375 if (G_HotKeyProc ) {
376- unsigned len = G_HotKeyProc (hwnd , WM_GETZONESLEN , LayoutNumber , 0 );
377- if (!len ) {
376+ RECT * zones = NULL ;
377+ unsigned len = G_HotKeyProc (hwnd , WM_GETZONES , LayoutNumber , (LPARAM )& zones );
378+ if (!len || !zones ) {
378379 // Empty layout, Let's open a new Test Window
379380 return !NewTestWindow ();
380381 }
381- RECT * zones = (RECT * )malloc (len * sizeof (* zones ));
382- if (!zones ) return 0 ;
383-
384- G_HotKeyProc (hwnd , WM_GETZONES , LayoutNumber , (LPARAM )zones );
385382 // Open them from bottom to top to ensure
386383 // the windows are in the correct order.
387384 while (len -- ) {
388385 const RECT * rc = & zones [len ];
389386 NewTestWindowAt (rc -> left , rc -> top , rc -> right - rc -> left , rc -> bottom - rc -> top );
390387 }
391- free (zones );
392388 }
393389 }
394390 } else if (msg == WM_QUERYENDSESSION ) {
@@ -514,8 +510,8 @@ int WINAPI tWinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, TCHAR *params, int
514510 // Ask old HotKey window to perform an action.
515511 const TCHAR * actionstr = lstrstr (params , TEXT ("-a" ));
516512 if (actionstr && actionstr [2 ] && actionstr [3 ] && actionstr [4 ]) {
517- enum action action = MapActionW (& actionstr [3 ]);
518- PostMessage (previnst , WM_HOTKEY , (actionstr [2 ] == 'p' )* 0x1000 + action , 0 );
513+ action_t action = MapActionW (& actionstr [3 ]);
514+ PostMessage (previnst , WM_HOTKEY , (actionstr [2 ] == 'p' )* 0x1000 + action . ac , PACK_ACTION ( action ) );
519515 return 0 ;
520516 }
521517 // Change layout if asked...
0 commit comments