diff options
Diffstat (limited to 'apps/plugins/puzzles/src/windows.c')
-rw-r--r-- | apps/plugins/puzzles/src/windows.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/apps/plugins/puzzles/src/windows.c b/apps/plugins/puzzles/src/windows.c index d4b30386a6..ffd0f75894 100644 --- a/apps/plugins/puzzles/src/windows.c +++ b/apps/plugins/puzzles/src/windows.c | |||
@@ -1545,7 +1545,7 @@ static frontend *frontend_new(HINSTANCE inst) | |||
1545 | fe->statusbar = NULL; | 1545 | fe->statusbar = NULL; |
1546 | fe->bitmap = NULL; | 1546 | fe->bitmap = NULL; |
1547 | 1547 | ||
1548 | SetWindowLong(fe->hwnd, GWL_USERDATA, (LONG)fe); | 1548 | SetWindowLongPtr(fe->hwnd, GWLP_USERDATA, (LONG_PTR)fe); |
1549 | 1549 | ||
1550 | return fe; | 1550 | return fe; |
1551 | } | 1551 | } |
@@ -1992,7 +1992,7 @@ static void make_dialog_full_screen(HWND hwnd) | |||
1992 | static int CALLBACK AboutDlgProc(HWND hwnd, UINT msg, | 1992 | static int CALLBACK AboutDlgProc(HWND hwnd, UINT msg, |
1993 | WPARAM wParam, LPARAM lParam) | 1993 | WPARAM wParam, LPARAM lParam) |
1994 | { | 1994 | { |
1995 | frontend *fe = (frontend *)GetWindowLong(hwnd, GWL_USERDATA); | 1995 | frontend *fe = (frontend *)GetWindowLongPtr(hwnd, GWLP_USERDATA); |
1996 | 1996 | ||
1997 | switch (msg) { | 1997 | switch (msg) { |
1998 | case WM_INITDIALOG: | 1998 | case WM_INITDIALOG: |
@@ -2249,7 +2249,7 @@ static void create_config_controls(frontend * fe) | |||
2249 | static int CALLBACK ConfigDlgProc(HWND hwnd, UINT msg, | 2249 | static int CALLBACK ConfigDlgProc(HWND hwnd, UINT msg, |
2250 | WPARAM wParam, LPARAM lParam) | 2250 | WPARAM wParam, LPARAM lParam) |
2251 | { | 2251 | { |
2252 | frontend *fe = (frontend *)GetWindowLong(hwnd, GWL_USERDATA); | 2252 | frontend *fe = (frontend *)GetWindowLongPtr(hwnd, GWLP_USERDATA); |
2253 | config_item *i; | 2253 | config_item *i; |
2254 | struct cfg_aux *j; | 2254 | struct cfg_aux *j; |
2255 | 2255 | ||
@@ -2260,7 +2260,7 @@ static int CALLBACK ConfigDlgProc(HWND hwnd, UINT msg, | |||
2260 | char *title; | 2260 | char *title; |
2261 | 2261 | ||
2262 | fe = (frontend *) lParam; | 2262 | fe = (frontend *) lParam; |
2263 | SetWindowLong(hwnd, GWL_USERDATA, lParam); | 2263 | SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); |
2264 | fe->cfgbox = hwnd; | 2264 | fe->cfgbox = hwnd; |
2265 | 2265 | ||
2266 | fe->cfg = frontend_get_config(fe, fe->cfg_which, &title); | 2266 | fe->cfg = frontend_get_config(fe, fe->cfg_which, &title); |
@@ -2479,8 +2479,8 @@ static void about(frontend *fe) | |||
2479 | 2479 | ||
2480 | SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE); | 2480 | SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE); |
2481 | 2481 | ||
2482 | SetWindowLong(fe->cfgbox, GWL_USERDATA, (LONG)fe); | 2482 | SetWindowLongPtr(fe->cfgbox, GWLP_USERDATA, (LONG_PTR)fe); |
2483 | SetWindowLong(fe->cfgbox, DWL_DLGPROC, (LONG)AboutDlgProc); | 2483 | SetWindowLongPtr(fe->cfgbox, DWLP_DLGPROC, (LONG_PTR)AboutDlgProc); |
2484 | 2484 | ||
2485 | id = 1000; | 2485 | id = 1000; |
2486 | y = height/2; | 2486 | y = height/2; |
@@ -2660,8 +2660,8 @@ static int get_config(frontend *fe, int which) | |||
2660 | 2660 | ||
2661 | SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE); | 2661 | SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE); |
2662 | 2662 | ||
2663 | SetWindowLong(fe->cfgbox, GWL_USERDATA, (LONG)fe); | 2663 | SetWindowLongPtr(fe->cfgbox, GWLP_USERDATA, (LONG_PTR)fe); |
2664 | SetWindowLong(fe->cfgbox, DWL_DLGPROC, (LONG)ConfigDlgProc); | 2664 | SetWindowLongPtr(fe->cfgbox, DWLP_DLGPROC, (LONG_PTR)ConfigDlgProc); |
2665 | 2665 | ||
2666 | /* | 2666 | /* |
2667 | * Count the controls so we can allocate cfgaux. | 2667 | * Count the controls so we can allocate cfgaux. |
@@ -2975,7 +2975,7 @@ static int is_alt_pressed(void) | |||
2975 | static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, | 2975 | static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, |
2976 | WPARAM wParam, LPARAM lParam) | 2976 | WPARAM wParam, LPARAM lParam) |
2977 | { | 2977 | { |
2978 | frontend *fe = (frontend *)GetWindowLong(hwnd, GWL_USERDATA); | 2978 | frontend *fe = (frontend *)GetWindowLongPtr(hwnd, GWLP_USERDATA); |
2979 | int cmd; | 2979 | int cmd; |
2980 | 2980 | ||
2981 | switch (message) { | 2981 | switch (message) { |
@@ -2993,18 +2993,18 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, | |||
2993 | cmd = wParam & ~0xF; /* low 4 bits reserved to Windows */ | 2993 | cmd = wParam & ~0xF; /* low 4 bits reserved to Windows */ |
2994 | switch (cmd) { | 2994 | switch (cmd) { |
2995 | case IDM_NEW: | 2995 | case IDM_NEW: |
2996 | if (!midend_process_key(fe->me, 0, 0, 'n')) | 2996 | if (!midend_process_key(fe->me, 0, 0, UI_NEWGAME)) |
2997 | PostQuitMessage(0); | 2997 | PostQuitMessage(0); |
2998 | break; | 2998 | break; |
2999 | case IDM_RESTART: | 2999 | case IDM_RESTART: |
3000 | midend_restart_game(fe->me); | 3000 | midend_restart_game(fe->me); |
3001 | break; | 3001 | break; |
3002 | case IDM_UNDO: | 3002 | case IDM_UNDO: |
3003 | if (!midend_process_key(fe->me, 0, 0, 'u')) | 3003 | if (!midend_process_key(fe->me, 0, 0, UI_UNDO)) |
3004 | PostQuitMessage(0); | 3004 | PostQuitMessage(0); |
3005 | break; | 3005 | break; |
3006 | case IDM_REDO: | 3006 | case IDM_REDO: |
3007 | if (!midend_process_key(fe->me, 0, 0, '\x12')) | 3007 | if (!midend_process_key(fe->me, 0, 0, UI_REDO)) |
3008 | PostQuitMessage(0); | 3008 | PostQuitMessage(0); |
3009 | break; | 3009 | break; |
3010 | case IDM_COPY: | 3010 | case IDM_COPY: |
@@ -3026,7 +3026,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, | |||
3026 | } | 3026 | } |
3027 | break; | 3027 | break; |
3028 | case IDM_QUIT: | 3028 | case IDM_QUIT: |
3029 | if (!midend_process_key(fe->me, 0, 0, 'q')) | 3029 | if (!midend_process_key(fe->me, 0, 0, UI_QUIT)) |
3030 | PostQuitMessage(0); | 3030 | PostQuitMessage(0); |
3031 | break; | 3031 | break; |
3032 | case IDM_CONFIG: | 3032 | case IDM_CONFIG: |
@@ -3405,8 +3405,18 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, | |||
3405 | } | 3405 | } |
3406 | break; | 3406 | break; |
3407 | case WM_CHAR: | 3407 | case WM_CHAR: |
3408 | if (!midend_process_key(fe->me, 0, 0, (unsigned char)wParam)) | 3408 | { |
3409 | PostQuitMessage(0); | 3409 | int key = (unsigned char)wParam; |
3410 | if (key == '\x1A') { | ||
3411 | BYTE keystate[256]; | ||
3412 | if (GetKeyboardState(keystate) && | ||
3413 | (keystate[VK_SHIFT] & 0x80) && | ||
3414 | (keystate[VK_CONTROL] & 0x80)) | ||
3415 | key = UI_REDO; | ||
3416 | } | ||
3417 | if (!midend_process_key(fe->me, 0, 0, key)) | ||
3418 | PostQuitMessage(0); | ||
3419 | } | ||
3410 | return 0; | 3420 | return 0; |
3411 | case WM_TIMER: | 3421 | case WM_TIMER: |
3412 | if (fe->timer) { | 3422 | if (fe->timer) { |