skinnedwnd.cpp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. #include "./skinnedwnd.h"
  2. #include "../winamp/wa_dlg.h"
  3. #include "../nu/trace.h"
  4. #include "./mldwm.h"
  5. #include "../nu/CGlobalAtom.h"
  6. static CGlobalAtom WNDDATAPROPW(L"SWDATA");
  7. static UINT WINAMP_WM_DIRECT_MOUSE_WHEEL = WM_NULL;
  8. #ifndef LONGX86
  9. #ifdef _WIN64
  10. #define LONGX86 LONG_PTR
  11. #else /*_WIN64*/
  12. #define LONGX86 LONG
  13. #endif /*_WIN64*/
  14. #endif // LONGX86
  15. #define SWS_ATTACHED 0x00010000 // window attached
  16. #define SWS_UNICODE 0x00020000 // winodow is unicode
  17. #define SWS_THEMED 0x00040000 // was themed before
  18. #define SWS_REFLECT 0x00080000 // support message reflection
  19. #define SWS_DIALOG 0x00100000 // treat this as dialog
  20. #define BORDER_WIDTH 1
  21. extern HRESULT(WINAPI *SetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList); //xp theme shit
  22. extern BOOL (__stdcall *IsAppThemed)(void);
  23. #define DWM_COMPOSITION_CHECK ((UINT)-1)
  24. #define DWM_COMPOSITION_DISABLED ((UINT)0)
  25. #define DWM_COMPOSITION_ENABLED ((UINT)1)
  26. static UINT dwmCompositionEnabled = DWM_COMPOSITION_CHECK;
  27. static BOOL CALLBACK SkinChangedNotifyCB(HWND hwnd, LPARAM param)
  28. {
  29. SendMessageW(hwnd, (UINT)WM_ML_IPC, MAKEWPARAM(TRUE, param), (LPARAM)ML_IPC_SKINNEDWND_SKINCHANGED);
  30. return TRUE;
  31. }
  32. SkinnedWnd *SkinnedWnd::GetFromHWND(HWND hwndSkinned)
  33. {
  34. return (hwndSkinned && IsWindow(hwndSkinned)) ? (SkinnedWnd*)GetPropW(hwndSkinned, WNDDATAPROPW) : NULL;
  35. }
  36. BOOL SkinnedWnd::IsDwmCompositionEnabled()
  37. {
  38. if (DWM_COMPOSITION_CHECK == dwmCompositionEnabled)
  39. {
  40. dwmCompositionEnabled = DWM_COMPOSITION_DISABLED;
  41. BOOL bEnabled;
  42. if (S_OK == MlDwm_LoadLibrary() && S_OK == MlDwm_IsCompositionEnabled(&bEnabled) && bEnabled)
  43. dwmCompositionEnabled = DWM_COMPOSITION_ENABLED;
  44. }
  45. return (DWM_COMPOSITION_ENABLED == dwmCompositionEnabled);
  46. }
  47. SkinnedWnd::SkinnedWnd(BOOL bIsDialog)
  48. : hwnd(NULL), style(SWS_NORMAL), uiState(NULL), redrawLock(0),
  49. fnWndProc(NULL), wnddata(SKINNEDWND_TYPE_WINDOW | ((bIsDialog) ? SWS_DIALOG : 0))
  50. {
  51. minSize.cx = 0;
  52. minSize.cy = 0;
  53. maxSize.cx = 0;
  54. maxSize.cy = 0;
  55. if (WM_NULL == WINAMP_WM_DIRECT_MOUSE_WHEEL)
  56. WINAMP_WM_DIRECT_MOUSE_WHEEL = RegisterWindowMessageW(L"WINAMP_WM_DIRECT_MOUSE_WHEEL");
  57. }
  58. SkinnedWnd::~SkinnedWnd(void)
  59. {
  60. if (!hwnd || !IsWindow(hwnd)) return;
  61. RemovePropW(hwnd, WNDDATAPROPW);
  62. if (fnWndProc)
  63. {
  64. INT index;
  65. index = (SWS_DIALOG & wnddata) ? DWLP_DLGPROC : GWLP_WNDPROC;
  66. (SWS_UNICODE & wnddata) ? SetWindowLongPtrW(hwnd, index, (LONGX86)(LONG_PTR)fnWndProc) : SetWindowLongPtrA(hwnd, index, (LONGX86)(LONG_PTR)fnWndProc);
  67. }
  68. if ((SWS_THEMED & wnddata) && IsAppThemed && IsAppThemed() && SetWindowTheme) SetWindowTheme(hwnd, NULL, NULL);
  69. }
  70. BOOL SkinnedWnd::IsUnicode(void)
  71. {
  72. return ( 0 != (SWS_UNICODE & wnddata));
  73. }
  74. BOOL SkinnedWnd::IsAttached(void)
  75. {
  76. return ( 0 != (SWS_ATTACHED & wnddata));
  77. }
  78. BOOL SkinnedWnd::Attach(HWND hwndToSkin)
  79. {
  80. INT index;
  81. if (hwnd) return FALSE;
  82. hwnd = hwndToSkin;
  83. if(!hwnd || GetPropW(hwnd, WNDDATAPROPW)) return FALSE;
  84. wnddata &= (SKINNEDWND_TYPE_WINDOW | SWS_DIALOG);
  85. if(IsWindowUnicode(hwnd)) wnddata |= SWS_UNICODE;
  86. index = (SWS_DIALOG & wnddata) ? DWLP_DLGPROC : GWLP_WNDPROC;
  87. fnWndProc= (WNDPROC)(LONG_PTR)((SWS_UNICODE & wnddata) ? SetWindowLongPtrW(hwnd, index, (LONGX86)(LONG_PTR)WindowProcReal) : SetWindowLongPtrA(hwnd, index, (LONGX86)(LONG_PTR)WindowProcReal));
  88. if (!fnWndProc || !SetPropW(hwnd, WNDDATAPROPW, this)) return FALSE;
  89. RemoveReflector(hwnd); // we will use this refelector
  90. wnddata |= (SWS_ATTACHED | SWS_REFLECT);
  91. if (S_OK == MlDwm_LoadLibrary())
  92. {
  93. DWMNCRENDERINGPOLICY ncrp = DWMNCRP_DISABLED;
  94. DWORD allow = FALSE;
  95. MlDwm_SetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &ncrp, sizeof(ncrp));
  96. MlDwm_SetWindowAttribute(hwnd, DWMWA_ALLOW_NCPAINT, &allow, sizeof(allow));
  97. }
  98. if (IsAppThemed && IsAppThemed() && SetWindowTheme)
  99. {
  100. SetWindowTheme(hwnd, NULL, L"");
  101. wnddata |= SWS_THEMED;
  102. }
  103. uiState =(WORD)SendMessageW(hwnd, WM_QUERYUISTATE, 0, 0L);
  104. return TRUE;
  105. }
  106. LRESULT SkinnedWnd::CallPrevWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
  107. {
  108. return (SWS_UNICODE & wnddata) ? CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam) : CallWindowProcA(fnWndProc, hwnd, uMsg, wParam, lParam);
  109. }
  110. LRESULT SkinnedWnd::CallDefWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
  111. {
  112. return (SWS_UNICODE & wnddata) ? DefWindowProcW(hwnd, uMsg, wParam, lParam) : DefWindowProcA(hwnd, uMsg, wParam, lParam);
  113. }
  114. void SkinnedWnd::OnSkinChanged(BOOL bNotifyChildren, BOOL bRedraw)
  115. {
  116. if (SWS_USESKINFONT & style)
  117. {
  118. HFONT skinFont;
  119. skinFont = (HFONT)MlStockObjects_Get(SKIN_FONT);
  120. if (NULL == skinFont)
  121. skinFont = (HFONT)MlStockObjects_Get(DEFAULT_FONT);
  122. if (NULL != skinFont)
  123. {
  124. HFONT windowFont = (HFONT)CallPrevWndProc(WM_GETFONT, 0, 0L);
  125. if (skinFont != windowFont)
  126. {
  127. DisableRedraw();
  128. SendMessageW(hwnd, WM_SETFONT, (WPARAM)skinFont, MAKELPARAM(0, bRedraw));
  129. if (FALSE != bRedraw)
  130. {
  131. SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
  132. SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE |
  133. SWP_FRAMECHANGED | SWP_NOREDRAW);
  134. }
  135. EnableRedraw(SWR_NONE);
  136. }
  137. }
  138. }
  139. if (bNotifyChildren)
  140. EnumChildWindows(hwnd, SkinChangedNotifyCB, bRedraw);
  141. SendMessageW(hwnd, (UINT)WM_ML_IPC,
  142. MAKEWPARAM(bNotifyChildren, bRedraw),
  143. (LPARAM)ML_IPC_SKINNEDWND_SKINUPDATED);
  144. if (bRedraw)
  145. InvalidateRect(hwnd, NULL, TRUE);
  146. }
  147. void SkinnedWnd::OnSkinUpdated(BOOL bNotifyChildren, BOOL bRedraw)
  148. {
  149. }
  150. void SkinnedWnd::SkinChanged(BOOL bNotifyChildren, BOOL bRedraw)
  151. {
  152. OnSkinChanged(bNotifyChildren, bRedraw);
  153. }
  154. void SkinnedWnd::EnableReflection(BOOL bEnable)
  155. {
  156. wnddata = (wnddata & ~SWS_REFLECT) | ((bEnable) ? SWS_REFLECT : 0);
  157. }
  158. BOOL SkinnedWnd::SetStyle(UINT newStyle, BOOL bRedraw)
  159. {
  160. style = newStyle;
  161. if (NULL != hwnd)
  162. SkinChanged(FALSE, bRedraw);
  163. return TRUE;
  164. }
  165. void SkinnedWnd::SetMinMaxInfo(MLSKINNEDMINMAXINFO *minMax)
  166. {
  167. if (NULL != minMax)
  168. {
  169. minSize.cx = minMax->min.cx;
  170. if (minSize.cx < 0)
  171. minSize.cx = 0;
  172. minSize.cy = minMax->min.cy;
  173. if (minSize.cy < 0)
  174. minSize.cy = 0;
  175. maxSize.cx = minMax->max.cx;
  176. if (maxSize.cx < 0)
  177. maxSize.cx = 0;
  178. maxSize.cy = minMax->max.cy;
  179. if (maxSize.cy < 0)
  180. maxSize.cy = 0;
  181. }
  182. else
  183. {
  184. memset(&minSize, 0, sizeof(minSize));
  185. memset(&maxSize, 0, sizeof(maxSize));
  186. }
  187. }
  188. BOOL SkinnedWnd::OnMediaLibraryIPC(INT msg, INT_PTR param, LRESULT *pResult)
  189. {
  190. switch(msg)
  191. {
  192. case ML_IPC_SKINNEDWND_ISSKINNED: *pResult = IsAttached(); return TRUE;
  193. case ML_IPC_SKINNEDWND_SKINCHANGED: SkinChanged(LOWORD(param), HIWORD(param)); *pResult = 1; return TRUE;
  194. case ML_IPC_SKINNEDWND_SKINUPDATED: OnSkinUpdated(LOWORD(param), HIWORD(param)); break;
  195. case ML_IPC_SKINNEDWND_GETTYPE: *pResult = GetType(); return TRUE;
  196. case ML_IPC_SKINNEDWND_ENABLEREFLECTION: EnableReflection((BOOL)param); *pResult = 1; return TRUE;
  197. case ML_IPC_SKINNEDWND_GETPREVWNDPROC:
  198. if (param) *((BOOL*)param) = (SWS_UNICODE & wnddata);
  199. *pResult = (INT_PTR)fnWndProc;
  200. return TRUE;
  201. case ML_IPC_SKINNEDWND_SETSTYLE: *pResult = style; style = (UINT)param; return TRUE;
  202. case ML_IPC_SKINNEDWND_GETSTYLE: *pResult = style; return TRUE;
  203. case ML_IPC_SKINNEDWND_SETMINMAXINFO:
  204. SetMinMaxInfo((MLSKINNEDMINMAXINFO*)param);
  205. *pResult = TRUE;
  206. return TRUE;
  207. }
  208. return FALSE;
  209. }
  210. INT SkinnedWnd::OnNcHitTest(POINTS pts)
  211. {
  212. return (INT)CallPrevWndProc(WM_NCHITTEST, 0, *(LPARAM*)&pts);
  213. }
  214. void SkinnedWnd::DrawBorder(HDC hdc, RECT *prc, UINT type, HPEN pen)
  215. {
  216. HPEN penOld;
  217. INT o = (BORDER_WIDTH/2) + ((BORDER_WIDTH%2) ? 1 : 0);
  218. switch(type)
  219. {
  220. case BORDER_SUNKEN:
  221. case BORDER_FLAT:
  222. penOld = (HPEN)SelectObject(hdc, pen);
  223. MoveToEx(hdc, prc->right - o, prc->top, NULL);
  224. LineTo(hdc, prc->right - o, prc->bottom);
  225. MoveToEx(hdc, prc->right - BORDER_WIDTH, prc->bottom - o, NULL);
  226. LineTo(hdc, prc->left - 1, prc->bottom - o);
  227. if (BORDER_FLAT == type)
  228. {
  229. MoveToEx(hdc, prc->left + BORDER_WIDTH/2, prc->bottom - BORDER_WIDTH, NULL);
  230. LineTo(hdc, prc->left + BORDER_WIDTH/2, prc->top);
  231. MoveToEx(hdc, prc->left, prc->top + BORDER_WIDTH/2, NULL);
  232. LineTo(hdc, prc->right - BORDER_WIDTH, prc->top + BORDER_WIDTH/2);
  233. }
  234. SelectObject(hdc, penOld);
  235. break;
  236. }
  237. }
  238. UINT SkinnedWnd::GetBorderType(void)
  239. {
  240. DWORD ws = (DWORD)GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
  241. if (WS_EX_STATICEDGE & ws) return BORDER_FLAT;
  242. else if (WS_EX_CLIENTEDGE & ws) return BORDER_SUNKEN;
  243. ws = (DWORD)GetWindowLongPtrW(hwnd, GWL_STYLE);
  244. return (WS_BORDER & ws) ? BORDER_FLAT : BORDER_NONE;
  245. }
  246. void SkinnedWnd::DrawBorder(HDC hdc)
  247. {
  248. UINT borderType = GetBorderType();
  249. if (BORDER_NONE != borderType)
  250. {
  251. RECT rc;
  252. GetWindowRect(hwnd, &rc);
  253. OffsetRect(&rc, -rc.left, -rc.top);
  254. DrawBorder(hdc, &rc, borderType, GetBorderPen());
  255. }
  256. }
  257. void SkinnedWnd::OnNcPaint(HRGN rgnUpdate)
  258. {
  259. UINT borderType = GetBorderType();
  260. if (BORDER_NONE == borderType) return;
  261. UINT flags = DCX_PARENTCLIP | DCX_CACHE | DCX_WINDOW | DCX_CLIPSIBLINGS |
  262. DCX_INTERSECTUPDATE | DCX_VALIDATE;
  263. HDC hdc = GetDCEx(hwnd, ((HRGN)NULLREGION != rgnUpdate) ? rgnUpdate : NULL, flags);
  264. if (NULL == hdc) return;
  265. DrawBorder(hdc);
  266. ReleaseDC(hwnd, hdc);
  267. }
  268. INT SkinnedWnd::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS *pncsp)
  269. {
  270. UINT borderType = GetBorderType();
  271. switch(borderType)
  272. {
  273. case BORDER_SUNKEN:
  274. case BORDER_FLAT:
  275. if (bCalcValidRects)
  276. {
  277. SetRect(&pncsp->rgrc[0],
  278. pncsp->lppos->x, pncsp->lppos->y,
  279. pncsp->lppos->x + pncsp->lppos->cx - BORDER_WIDTH, pncsp->lppos->y + pncsp->lppos->cy - BORDER_WIDTH);
  280. }
  281. else
  282. {
  283. GetWindowRect(hwnd, &pncsp->rgrc[0]);
  284. pncsp->rgrc[0].right -= BORDER_WIDTH;
  285. pncsp->rgrc[0].bottom -= BORDER_WIDTH;
  286. }
  287. if (BORDER_FLAT == borderType)
  288. {
  289. pncsp->rgrc[0].left += BORDER_WIDTH;
  290. pncsp->rgrc[0].top += BORDER_WIDTH;
  291. }
  292. break;
  293. }
  294. return 0;
  295. }
  296. void SkinnedWnd::OnPrint(HDC hdc, UINT options)
  297. {
  298. if ((PRF_CHECKVISIBLE & options) && !IsWindowVisible(hwnd)) return;
  299. if (PRF_NONCLIENT & options) DrawBorder(hdc);
  300. if (PRF_CLIENT & options)
  301. {
  302. CallPrevWndProc(WM_PRINT, (WPARAM)hdc, (LPARAM)(~(PRF_NONCLIENT | PRF_CHECKVISIBLE) & options));
  303. }
  304. }
  305. HPEN SkinnedWnd::GetBorderPen(void)
  306. {
  307. return (HPEN)MlStockObjects_Get(HILITE_PEN);
  308. }
  309. void SkinnedWnd::OnUpdateUIState(UINT uAction, UINT uState)
  310. {
  311. CallPrevWndProc(WM_UPDATEUISTATE, MAKEWPARAM(uAction, uState), 0L);
  312. uiState =(WORD)SendMessageW(hwnd, WM_QUERYUISTATE, 0, 0L);
  313. }
  314. void SkinnedWnd::OnStyleChanged(INT styleType, STYLESTRUCT *pss)
  315. {
  316. if (0 != redrawLock)
  317. {
  318. if (0 != (GWL_STYLE & styleType) &&
  319. (WS_VISIBLE & pss->styleOld) != (WS_VISIBLE & pss->styleNew))
  320. {
  321. redrawLock = 0;
  322. }
  323. }
  324. CallPrevWndProc(WM_STYLECHANGED, (WPARAM)styleType, (LPARAM)pss);
  325. }
  326. void SkinnedWnd::OnDwmCompositionChanged(void)
  327. {
  328. dwmCompositionEnabled = DWM_COMPOSITION_CHECK;
  329. }
  330. void SkinnedWnd::DisableRedraw()
  331. {
  332. if (0 == redrawLock)
  333. {
  334. UINT windowStyle = (UINT)GetWindowLongPtrW(hwnd, GWL_STYLE);
  335. if (0 == (WS_VISIBLE & windowStyle))
  336. return;
  337. CallDefWndProc(WM_SETREDRAW, FALSE, 0L);
  338. }
  339. redrawLock++;
  340. }
  341. void SkinnedWnd::EnableRedraw(SkinnedWndRedraw redrawFlags)
  342. {
  343. UINT rdwFlags(0);
  344. if (0 == redrawLock)
  345. return;
  346. redrawLock--;
  347. if (0 != redrawLock)
  348. return;
  349. CallDefWndProc(WM_SETREDRAW, TRUE, 0L);
  350. if (0 != (SWR_INVALIDATE & redrawFlags))
  351. {
  352. rdwFlags |= RDW_INVALIDATE;
  353. if (0 != (SWR_UPDATE & redrawFlags))
  354. rdwFlags |= RDW_UPDATENOW;
  355. }
  356. if (0 != (SWR_ERASE & redrawFlags))
  357. {
  358. rdwFlags |= RDW_ERASE;
  359. if (0 != (SWR_UPDATE & redrawFlags))
  360. rdwFlags |= RDW_ERASENOW;
  361. }
  362. if (0 != rdwFlags)
  363. {
  364. if (0 != (SWR_ALLCHILDREN & redrawFlags))
  365. rdwFlags |= RDW_ALLCHILDREN;
  366. RedrawWindow(hwnd, NULL, NULL, rdwFlags);
  367. }
  368. }
  369. BOOL SkinnedWnd::OnDirectMouseWheel(INT delta, UINT vtKey, POINTS pts)
  370. {
  371. SendMessageW(hwnd, WM_MOUSEWHEEL, MAKEWPARAM(vtKey, delta), *((LPARAM*)&pts));
  372. return TRUE;
  373. }
  374. void SkinnedWnd::OnGetMinMaxInfo(MINMAXINFO *minMax)
  375. {
  376. if (NULL == minMax)
  377. return;
  378. CallPrevWndProc(WM_GETMINMAXINFO, 0, (LPARAM)minMax);
  379. if (0 != minSize.cx)
  380. minMax->ptMinTrackSize.x = minSize.cx;
  381. if (0 != minSize.cy)
  382. minMax->ptMinTrackSize.y = minSize.cy;
  383. if (0 != maxSize.cx)
  384. minMax->ptMaxTrackSize.x = maxSize.cx;
  385. if (0 != maxSize.cy)
  386. minMax->ptMaxTrackSize.y = maxSize.cy;
  387. }
  388. LRESULT SkinnedWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
  389. {
  390. switch(uMsg)
  391. {
  392. case WM_NCHITTEST: return OnNcHitTest(MAKEPOINTS(lParam));
  393. case WM_NCPAINT: OnNcPaint((HRGN)wParam); return 0;
  394. case WM_NCCALCSIZE: return OnNcCalcSize((BOOL)wParam, (NCCALCSIZE_PARAMS*)lParam);
  395. case WM_PRINT: OnPrint((HDC)wParam, (UINT)lParam); return 0;
  396. case WM_UPDATEUISTATE: OnUpdateUIState(LOWORD(wParam), HIWORD(wParam)); return 0;
  397. case WM_STYLECHANGED: OnStyleChanged((INT)wParam, (STYLESTRUCT*)lParam); return 0;
  398. case WM_SUPPORTREFLECT:
  399. {
  400. BOOL reflectionSupported = (0 != (SWS_REFLECT & wnddata) && CanReflect((UINT)wParam));
  401. if (0 != (SWS_DIALOG & wnddata))
  402. {
  403. SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, reflectionSupported);
  404. return TRUE;
  405. }
  406. return reflectionSupported;
  407. }
  408. case WM_ML_IPC:
  409. {
  410. LRESULT result;
  411. if (OnMediaLibraryIPC((INT)lParam, (INT_PTR)wParam, &result))
  412. {
  413. if (SWS_DIALOG & wnddata)
  414. {
  415. SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (LONGX86)result);
  416. return TRUE;
  417. }
  418. return result;
  419. }
  420. break;
  421. }
  422. case WM_DWMCOMPOSITIONCHANGED: OnDwmCompositionChanged(); return 0;
  423. case WM_GETMINMAXINFO: OnGetMinMaxInfo((MINMAXINFO*)lParam); return 0;
  424. }
  425. // Reflection
  426. if (0 != (SWS_REFLECT & wnddata))
  427. {
  428. LRESULT result;
  429. if (ReflectMessage(hwnd, uMsg, wParam, lParam, (0 != (SWS_DIALOG & wnddata)), &result))
  430. return result;
  431. }
  432. if ( 0 == (SWS_NO_DIRECT_MOUSE_WHEEL & style) &&
  433. WINAMP_WM_DIRECT_MOUSE_WHEEL == uMsg &&
  434. WM_NULL != WINAMP_WM_DIRECT_MOUSE_WHEEL &&
  435. FALSE != OnDirectMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), MAKEPOINTS(lParam)))
  436. {
  437. if (0 != (SWS_DIALOG & wnddata))
  438. SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, TRUE);
  439. return TRUE;
  440. }
  441. return CallPrevWndProc(uMsg, wParam, lParam);
  442. }
  443. LRESULT WINAPI SkinnedWnd::WindowProcReal(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  444. {
  445. SkinnedWnd *pWnd = (SkinnedWnd*)GetPropW(hwnd, WNDDATAPROPW);
  446. if (!pWnd)
  447. return (IsWindowUnicode(hwnd)) ? DefWindowProcW(hwnd, uMsg, wParam, lParam) : DefWindowProcA(hwnd, uMsg, wParam, lParam);
  448. switch(uMsg)
  449. {
  450. case WM_NCDESTROY:
  451. {
  452. WNDPROC fnWndProc = pWnd->fnWndProc;
  453. delete(pWnd);
  454. return IsWindowUnicode(hwnd) ? CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam) : CallWindowProcA(fnWndProc, hwnd, uMsg, wParam, lParam);
  455. }
  456. break;
  457. }
  458. return pWnd->WindowProc(uMsg, wParam, lParam);
  459. }