Skip to content

Commit 85264af

Browse files
authored
Merge pull request #718 from RamonUnch/Allow-to-have-parameters-for-an-action
Allow to have parameters for an action
2 parents 7ef252f + 6f889fa commit 85264af

12 files changed

Lines changed: 583 additions & 387 deletions

File tree

Lang/_en_US baseline.txt

-2.05 KB
Binary file not shown.

Lang/fr_FR.ini

-2.38 KB
Binary file not shown.

Lang/it_IT.ini

-2.44 KB
Binary file not shown.

altsnap.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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...

config.c

Lines changed: 230 additions & 78 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)