Skip to content

Commit 7c8a7b1

Browse files
Fix plugin window state tracking
1 parent d208248 commit 7c8a7b1

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

ffrunner.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -705,13 +705,14 @@ main(int argc, char **argv)
705705

706706
/* adjust plugin rect to the real inner size of the window */
707707
if (GetClientRect(hwnd, &winRect)) {
708-
npWin.clipRect.top = winRect.top;
709-
npWin.clipRect.bottom = winRect.bottom;
710-
npWin.clipRect.left = winRect.left;
708+
npWin.x = winRect.left;
709+
npWin.y = winRect.top;
710+
npWin.clipRect.top = 0;
711+
npWin.clipRect.left = 0;
711712
npWin.clipRect.right = winRect.right;
712-
713-
npWin.height = winRect.bottom - winRect.top;
713+
npWin.clipRect.bottom = winRect.bottom;
714714
npWin.width = winRect.right - winRect.left;
715+
npWin.height = winRect.bottom - winRect.top;
715716
}
716717

717718
logmsg("> NPP_SetWindowProc\n");

graphics.c

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ HWND hwnd;
55
LRESULT CALLBACK
66
window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
77
{
8-
UINT width, height;
8+
RECT windowRect;
9+
UINT windowState;
910
PAINTSTRUCT ps;
1011
HDC hdc;
1112
Request *req;
@@ -26,14 +27,36 @@ window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2627

2728
EndPaint(hwnd, &ps);
2829
return 0;
30+
case WM_MOVE:
31+
if (GetClientRect(hwnd, &windowRect)) {
32+
npWin.x = windowRect.left;
33+
npWin.y = windowRect.top;
34+
}
35+
36+
pluginFuncs.setwindow(&npp, &npWin);
37+
/* Let DefWindowProc handle the rest. */
38+
break;
2939
case WM_SIZE:
30-
width = LOWORD(lParam);
31-
height = HIWORD(lParam);
40+
windowState = wParam;
41+
42+
npWin.clipRect.top = 0;
43+
npWin.clipRect.left = 0;
44+
45+
if (windowState == SIZE_MINIMIZED) {
46+
npWin.clipRect.right = 0;
47+
npWin.clipRect.bottom = 0;
48+
} else {
49+
if (GetClientRect(hwnd, &windowRect)) {
50+
npWin.width = windowRect.right - windowRect.left;
51+
npWin.height = windowRect.bottom - windowRect.top;
52+
npWin.clipRect.right = npWin.width;
53+
npWin.clipRect.bottom = npWin.height;
54+
}
55+
}
3256

33-
npWin.width = npWin.clipRect.right = width;
34-
npWin.height = npWin.clipRect.bottom = height;
3557
pluginFuncs.setwindow(&npp, &npWin);
36-
return 0;
58+
/* Let DefWindowProc handle the rest. */
59+
break;
3760
}
3861

3962
if (uMsg == ioMsg) {

0 commit comments

Comments
 (0)