Ui.cpp 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290
  1. /** (c) Nullsoft, Inc. C O N F I D E N T I A L
  2. ** Filename:
  3. ** Project:
  4. ** Description:
  5. ** Author:
  6. ** Created:
  7. **/
  8. #include "Main.h"
  9. #include <malloc.h>
  10. #include "api.h"
  11. #include "resource.h"
  12. int minimize_hack_winamp;
  13. #define inreg(x,y,x2,y2) \
  14. ((mouse_x <= ( x2 ) && mouse_x >= ( x ) && \
  15. mouse_y <= ( y2 ) && mouse_y >= ( y )))
  16. static int mouse_x, mouse_y, mouse_type, mouse_stats;
  17. static int do_titlebar_clicking;
  18. static int do_buttonbar();
  19. static int do_shuffle();
  20. static int do_peeq();
  21. static int do_repeat();
  22. static int do_eject();
  23. static int do_icon();
  24. static int do_posbar();
  25. static int do_volbar();
  26. static int do_panbar();
  27. static int do_songname();
  28. static int do_titlebar();
  29. static int do_titlebuttons();
  30. static int do_timedisplay();
  31. static int do_clutterbar();
  32. static BOOL HasParent(HWND hwnd)
  33. {
  34. return ((0 != (WS_CHILD & GetWindowLongPtrW(hwnd, GWL_STYLE))) && NULL != GetParent(hwnd));
  35. }
  36. void ui_handlemouseevent(int x, int y, int type, int stats)
  37. {
  38. mouse_x = x;
  39. mouse_y = y;
  40. mouse_type = type;
  41. mouse_stats = stats;
  42. if (do_titlebar_clicking || (!do_posbar() &&
  43. !do_volbar() && !do_panbar() && !do_songname()))
  44. {
  45. if (do_titlebar_clicking || !(do_buttonbar()+
  46. do_shuffle()+
  47. do_repeat()+
  48. do_eject()+
  49. do_peeq()+
  50. do_icon()+
  51. do_clutterbar()+
  52. do_timedisplay()))
  53. {
  54. if (do_titlebar_clicking || !do_titlebuttons()) do_titlebar();
  55. }
  56. }
  57. }
  58. static int __do_buttons(int which)
  59. {
  60. int m = WINAMP_BUTTON1 + which;
  61. if (which == 5)
  62. {
  63. if (mouse_stats & MK_CONTROL) SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_LOC,0);
  64. else if (mouse_stats & MK_SHIFT) SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_DIR,0);
  65. else SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_PLAY,0);
  66. }
  67. else
  68. {
  69. if (mouse_stats & MK_SHIFT) m += 100;
  70. else if (mouse_stats & MK_CONTROL) m += 110;
  71. SendMessageW(hMainWindow,WM_COMMAND,m,0);
  72. }
  73. return 0;
  74. }
  75. static int do_clutterbar_active;
  76. static int do_clutterbar()
  77. {
  78. int en=0,t=0;
  79. if (mouse_type == -2)
  80. return 0;
  81. if (inreg(11,24,19,31))
  82. {
  83. en=1;
  84. if (mouse_type == -1)
  85. {
  86. POINT p = {14,25};
  87. extern HMENU g_submenus_options;
  88. HMENU hmenu = g_submenus_options;
  89. if (config_dsize)
  90. {
  91. p.x *= 2;
  92. p.y *= 2;
  93. }
  94. ClientToScreen(hMainWindow,&p);
  95. DoTrackPopup(hmenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON, p.x, p.y, hMainWindow);
  96. }
  97. if (mouse_stats & MK_LBUTTON)
  98. {
  99. wchar_t songnameStr[128] = {0};
  100. draw_songname(getStringW(IDS_OPTIONS_MENU,songnameStr,128),&t,-1);
  101. }
  102. }
  103. if (inreg(11,32,19,39))
  104. {
  105. en=2;
  106. if (mouse_type == -1) SendMessageW(hMainWindow,WM_COMMAND,WINAMP_OPTIONS_AOT,0);
  107. if (mouse_stats & MK_LBUTTON)
  108. {
  109. wchar_t songnameStr[128] = {0};
  110. if (config_aot)
  111. draw_songname(getStringW(IDS_DISABLE_AOT,songnameStr,128),&t,-1);
  112. else
  113. draw_songname(getStringW(IDS_ENABLE_AOT,songnameStr,128),&t,-1);
  114. }
  115. }
  116. if (inreg(11,40,19,47))
  117. {
  118. en=3;
  119. if (mouse_type == -1)
  120. {
  121. if (FileName[0]) in_infobox(hMainWindow,FileName);
  122. }
  123. if (mouse_stats & MK_LBUTTON)
  124. {
  125. wchar_t songnameStr[128] = {0};
  126. draw_songname(getStringW(IDS_FILE_INFO_BOX,songnameStr,128),&t,-1);
  127. }
  128. }
  129. if (inreg(11,48,19,55))
  130. {
  131. en=4;
  132. if (mouse_type == -1) SendMessageW(hMainWindow,WM_COMMAND,WINAMP_OPTIONS_DSIZE,0);
  133. if (mouse_stats & MK_LBUTTON)
  134. {
  135. wchar_t songnameStr[128] = {0};
  136. if (config_dsize) draw_songname(getStringW(IDS_DISABLE_DOUBLESIZE_MODE,songnameStr,128),&t,-1);
  137. else draw_songname(getStringW(IDS_ENABLE_DOUBLESIZE_MODE,songnameStr,128),&t,-1);
  138. }
  139. }
  140. if (inreg(11,56,19,62))
  141. {
  142. en=5;
  143. if (mouse_type == -1)
  144. {
  145. POINT p={14,56};
  146. extern HMENU g_submenus_vis;
  147. if (config_dsize) {p.x*=2;p.y*=2;}
  148. ClientToScreen(hMainWindow,&p);
  149. DoTrackPopup(g_submenus_vis, TPM_LEFTALIGN|TPM_RIGHTBUTTON, p.x, p.y, hMainWindow);
  150. }
  151. if (mouse_stats & MK_LBUTTON)
  152. {
  153. wchar_t songnameStr[128] = {0};
  154. draw_songname(getStringW(IDS_VISUALIZATION_MENU,songnameStr,128),&t,-1);
  155. }
  156. }
  157. if (inreg(9,20,19,65) && mouse_stats & MK_LBUTTON)
  158. {
  159. draw_clutterbar(1+en);
  160. do_clutterbar_active=1;
  161. return 1;
  162. }
  163. if (do_clutterbar_active || mouse_type == -1)
  164. {
  165. draw_songname(FileTitle,&ui_songposition,playing?in_getlength():PlayList_getcurrentlength());
  166. do_clutterbar_active=0;
  167. draw_clutterbar(0);
  168. }
  169. return 0;
  170. }
  171. static int do_timedisplay()
  172. {
  173. if (mouse_type == -2)
  174. return 0;
  175. if (((!config_windowshade && inreg(36,26,96,39)) ||
  176. (config_windowshade && inreg(129,3,129+28,3+6))
  177. ) && mouse_type == 1)
  178. {
  179. config_timeleftmode = !config_timeleftmode;
  180. if (!config_timeleftmode)
  181. {
  182. CheckMenuItem(main_menu,WINAMP_OPTIONS_ELAPSED,MF_CHECKED);
  183. CheckMenuItem(main_menu,WINAMP_OPTIONS_REMAINING,MF_UNCHECKED);
  184. }
  185. else
  186. {
  187. CheckMenuItem(main_menu,WINAMP_OPTIONS_ELAPSED,MF_UNCHECKED);
  188. CheckMenuItem(main_menu,WINAMP_OPTIONS_REMAINING,MF_CHECKED);
  189. }
  190. SendMessageW(hMainWindow,WM_TIMER,UPDATE_DISPLAY_TIMER+4,0);
  191. return 1;
  192. }
  193. if (playing && inreg(27,40,99,61) && mouse_type == 1)
  194. {
  195. config_sa++;
  196. if (config_sa > 2) config_sa = 0;
  197. set_visopts();
  198. sa_setthread(config_sa);
  199. return 1;
  200. }
  201. if (config_windowshade && inreg(78,4,116,11) && mouse_type == 1)
  202. {
  203. config_sa++;
  204. if (config_sa > 2) config_sa = 0;
  205. set_visopts();
  206. sa_setthread(config_sa);
  207. return 1;
  208. }
  209. if (config_windowshade && inreg(168,2,213+11,11) && mouse_type == 1)
  210. {
  211. int which = 5 - (mouse_x < 215) - (mouse_x < 204) - (mouse_x < 195) - (mouse_x < 186) - (mouse_x < 176);
  212. __do_buttons(which);
  213. return 1;
  214. }
  215. return 0;
  216. }
  217. static int do_titlebar()
  218. {
  219. if (mouse_type == -2)
  220. return 0;
  221. if (do_titlebar_clicking || config_easymove || mouse_y < 14)
  222. {
  223. static int clickx, clicky;
  224. switch (mouse_type)
  225. {
  226. case 1:
  227. if (!do_titlebar_clicking)
  228. {
  229. EnterCriticalSection(&embedcs);
  230. {
  231. typedef struct
  232. {
  233. int open;
  234. int at;
  235. RECT r;
  236. embedWindowState *isemb;
  237. } rec;
  238. int x;
  239. int cnt = 5+embedwndlist_cnt;
  240. embedWindowState *p=embedwndlist;
  241. rec *a = (rec *)_malloca(cnt * sizeof(rec));
  242. //rec *a = (rec*)malloc(cnt * sizeof(rec));
  243. memset(a,0,cnt * sizeof(rec));
  244. a[0].at=1;
  245. a[0].open=1;
  246. EstMainWindowRect(&a[0].r);
  247. EstEQWindowRect(&a[1].r);a[1].open=config_eq_open;
  248. EstPLWindowRect(&a[2].r);a[2].open=config_pe_open;
  249. //EstMBWindowRect(&a[3].r);a[3].open=config_mb_open;
  250. EstVidWindowRect(&a[4].r);a[4].open=config_video_open;
  251. for (x = 5; x < cnt && p; x ++)
  252. {
  253. a[x].open=IsWindowVisible(p->me) && !HasParent(p->me);
  254. a[x].isemb=p;
  255. a[x].r = p->r;
  256. p->attached=0;
  257. p = p->link;
  258. }
  259. x=0;
  260. do_titlebar_clicking=1;
  261. if ((!!config_snap) ^ (!!(mouse_stats & MK_SHIFT)))
  262. {
  263. int t = 0;
  264. for (;;)
  265. {
  266. if (a[x].open&&a[x].at) for (int b = 0; b < cnt; b ++)
  267. {
  268. if (b != x && !a[b].at && IsWindowAttached(a[x].r,a[b].r))
  269. {
  270. a[b].at=1;
  271. t=1;
  272. }
  273. }
  274. if (!x)
  275. {
  276. if (!t) break;
  277. t=0;
  278. }
  279. x++;
  280. x%=cnt;
  281. }
  282. if (a[1].at) do_titlebar_clicking|=2;
  283. if (a[2].at) do_titlebar_clicking|=4;
  284. if (a[3].at) do_titlebar_clicking|=8;
  285. if (a[4].at) do_titlebar_clicking|=16;
  286. for (x = 5; x < cnt && a[x].isemb; x ++)
  287. a[x].isemb->attached = a[x].at;
  288. }
  289. _freea(a);
  290. }
  291. LeaveCriticalSection(&embedcs);
  292. clickx=mouse_x;
  293. clicky=mouse_y;
  294. }
  295. return 1;
  296. case -1:
  297. if (do_titlebar_clicking)
  298. {
  299. do_titlebar_clicking=0;
  300. }
  301. return 1;
  302. case 0:
  303. if (do_titlebar_clicking)
  304. {
  305. RECT eqr,plr,mwr,mbr,vwr,omwr;
  306. embedWindowState *p;
  307. int skip_eq = GetParent(hEQWindow) != NULL;
  308. //int skip_mb = 1;//GetParent(hMBWindow) != NULL;
  309. int skip_pl = GetParent(hPLWindow) != NULL;
  310. int skip_vw = GetParent(hVideoWindow) != NULL;
  311. EnterCriticalSection(&embedcs);
  312. EstEQWindowRect(&eqr);
  313. //EstMBWindowRect(&mbr);
  314. EstPLWindowRect(&plr);
  315. EstVidWindowRect(&vwr);
  316. EstMainWindowRect(&mwr);
  317. omwr=mwr;
  318. MoveRect(&mwr,mouse_x-clickx,mouse_y-clicky);
  319. // snap to nondocked windows
  320. if ((!!config_snap) ^ (!!(mouse_stats & MK_SHIFT)))
  321. {
  322. embedWindowState *state=embedwndlist;
  323. SnapToScreen(&mwr);
  324. if (!skip_eq && config_eq_open && !(do_titlebar_clicking&2)) SnapWindowToWindow(&mwr,eqr);
  325. if (!skip_pl && config_pe_open && !(do_titlebar_clicking&4)) SnapWindowToWindow(&mwr,plr);
  326. // if (!skip_mb && config_mb_open && !(do_titlebar_clicking&8)) SnapWindowToWindow(&mwr,mbr);
  327. if (!skip_vw && config_video_open && !(do_titlebar_clicking&16)) SnapWindowToWindow(&mwr,vwr);
  328. while (state)
  329. {
  330. if (IsWindowVisible(state->me) && !HasParent(state->me) && !state->attached)
  331. SnapWindowToWindow(&mwr,state->r);
  332. state=state->link;
  333. }
  334. }
  335. // move docked windows the same amount the the main window has moved
  336. {
  337. embedWindowState *state=embedwndlist;
  338. int movex=mwr.left-omwr.left;
  339. int movey=mwr.top-omwr.top;
  340. if (do_titlebar_clicking&2) MoveRect(&eqr,movex,movey);
  341. if (do_titlebar_clicking&4) MoveRect(&plr,movex,movey);
  342. if (do_titlebar_clicking&8) MoveRect(&mbr,movex,movey);
  343. if (do_titlebar_clicking&16) MoveRect(&vwr,movex,movey);
  344. while (state)
  345. {
  346. if (!HasParent(state->me) && state->attached) MoveRect(&state->r,movex,movey);
  347. state=state->link;
  348. }
  349. }
  350. if ((!!config_snap) ^ (!!(mouse_stats & MK_SHIFT)))
  351. {
  352. // dock the attached windows to the screen
  353. if (config_keeponscreen&1)
  354. {
  355. RECT omwr;
  356. int x;
  357. p = embedwndlist;
  358. for (x=0;;x++) // snap to screen
  359. {
  360. int op=0;
  361. int mask=1<<(x+1);
  362. intptr_t isact=(do_titlebar_clicking & mask);
  363. int m=do_titlebar_clicking&~mask;
  364. RECT *r=NULL;
  365. if (x == 0) {op = config_eq_open && !skip_eq; r=&eqr; }
  366. else if (x == 1) { op = config_pe_open && !skip_pl; r=&plr; }
  367. // else if (x == 2) { op = config_mb_open && !skip_mb; r=&mbr; }
  368. else if (x == 3) { op = config_video_open && !skip_vw; r=&vwr; }
  369. else
  370. {
  371. if (!p) break;
  372. op=IsWindowVisible(p->me) && !HasParent(p->me);
  373. isact=p->attached;
  374. m=do_titlebar_clicking;
  375. r=&p->r;
  376. p =p->link;
  377. }
  378. if (op && isact)
  379. {
  380. embedWindowState *p2 = embedwndlist;
  381. RECT oldr=*r;
  382. SnapToScreen(r);
  383. MoveRect(&mwr,r->left-oldr.left,r->top-oldr.top);
  384. if (m & 2) MoveRect(&eqr,r->left-oldr.left,r->top-oldr.top);
  385. if (m & 4) MoveRect(&plr,r->left-oldr.left,r->top-oldr.top);
  386. if (m & 8) MoveRect(&mbr,r->left-oldr.left,r->top-oldr.top);
  387. if (m & 16) MoveRect(&vwr,r->left-oldr.left,r->top-oldr.top);
  388. while (p2)
  389. {
  390. if (&p2->r != r && p2->attached)
  391. {
  392. MoveRect(&p2->r,r->left-oldr.left,r->top-oldr.top);
  393. }
  394. p2=p2->link;
  395. }
  396. }
  397. } // each window docking to screen
  398. omwr=mwr;
  399. SnapToScreen(&mwr);
  400. if (do_titlebar_clicking & 2) MoveRect(&eqr,mwr.left-omwr.left,mwr.top-omwr.top);
  401. if (do_titlebar_clicking & 4) MoveRect(&plr,mwr.left-omwr.left,mwr.top-omwr.top);
  402. if (do_titlebar_clicking & 8) MoveRect(&mbr,mwr.left-omwr.left,mwr.top-omwr.top);
  403. if (do_titlebar_clicking & 16) MoveRect(&vwr,mwr.left-omwr.left,mwr.top-omwr.top);
  404. p = embedwndlist;
  405. while (p)
  406. {
  407. if (p->attached)
  408. {
  409. MoveRect(&p->r,mwr.left-omwr.left,mwr.top-omwr.top);
  410. }
  411. p=p->link;
  412. }
  413. } // kepponscreen&1
  414. // dock the attached windows to the non attached windows
  415. {
  416. int x;
  417. p = embedwndlist;
  418. for (x = 0;; x ++)
  419. {
  420. int op=0;
  421. int mask=1<<(x+1);
  422. intptr_t isact=do_titlebar_clicking & mask;
  423. int m = do_titlebar_clicking&~mask;
  424. RECT *r=NULL;
  425. if (x == 0) { op = config_eq_open; r=&eqr; }
  426. else if (x == 1) { op = config_pe_open; r=&plr; }
  427. // else if (x == 2) { op = config_mb_open; r=&mbr; }
  428. else if (x == 3) { op = config_video_open; r=&vwr; }
  429. else
  430. {
  431. if (!p) break;
  432. op=IsWindowVisible(p->me) && !HasParent(p->me);
  433. isact=p->attached;
  434. m=do_titlebar_clicking;
  435. r=&p->r;
  436. p =p->link;
  437. }
  438. if (!isact && op) // if this isn't docked
  439. {
  440. int x2;
  441. embedWindowState *p2 = embedwndlist;
  442. for (x2=0;; x2 ++)
  443. {
  444. int op2;
  445. RECT *r2;
  446. int mask2=1<<(x2+1);
  447. int isa2=(m & mask2);
  448. if (x2 == 0) { op2 = config_eq_open; r2=&eqr; }
  449. else if (x2 == 1) { op2 = config_pe_open; r2=&plr; }
  450. // else if (x2 == 2) { op2 = config_mb_open; r2=&mbr; }
  451. else if (x2 == 3) { op2 = config_video_open; r2=&vwr; }
  452. else
  453. {
  454. if (!p2) break;
  455. op2=IsWindowVisible(p2->me) && !HasParent(p2->me);
  456. isa2=&p2->r != r && p2->attached;
  457. r2=&p2->r;
  458. p2 =p2->link;
  459. }
  460. if (op2 && isa2)
  461. {
  462. embedWindowState *p3 = embedwndlist;
  463. RECT r4=*r2,r3=*r2;
  464. RECT omwr=mwr;
  465. SnapWindowToWindow(&r4,*r);
  466. MoveRect(&mwr,r4.left-r3.left,r4.top-r3.top);
  467. if (m & 2) MoveRect(&eqr,mwr.left-omwr.left,mwr.top-omwr.top);
  468. if (m & 4) MoveRect(&plr,mwr.left-omwr.left,mwr.top-omwr.top);
  469. if (m & 8) MoveRect(&mbr,mwr.left-omwr.left,mwr.top-omwr.top);
  470. if (m & 16) MoveRect(&vwr,mwr.left-omwr.left,mwr.top-omwr.top);
  471. while (p3)
  472. {
  473. if (&p3->r != r && p3->attached)
  474. {
  475. MoveRect(&p3->r,mwr.left-omwr.left,mwr.top-omwr.top);
  476. }
  477. p3=p3->link;
  478. }
  479. }
  480. }
  481. }
  482. }
  483. } // dock to nonattached
  484. } // if snapping
  485. {
  486. // calculate number of windows to move
  487. int deferred_move_count = 1;
  488. if (do_titlebar_clicking&2 && !skip_eq) deferred_move_count ++;// final EQ positioning
  489. if (do_titlebar_clicking&4 && !skip_pl) deferred_move_count ++;// final PE positioning
  490. if (do_titlebar_clicking&16 && !skip_vw) deferred_move_count ++;// final VW positioning
  491. p = embedwndlist;
  492. while (p)
  493. {
  494. if (p->attached) deferred_move_count ++;
  495. p=p->link;
  496. }
  497. HDWP hdwp=BeginDeferWindowPos(deferred_move_count);
  498. if (do_titlebar_clicking&2 && !skip_eq) // final EQ positioning
  499. {
  500. SetEQWindowRect(&eqr);
  501. hdwp=DeferWindowPos(hdwp,hEQWindow,0,config_eq_wx,config_eq_wy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
  502. }
  503. if (do_titlebar_clicking&4 && !skip_pl) // final PE positioning
  504. {
  505. SetPLWindowRect(&plr);
  506. hdwp=DeferWindowPos(hdwp,hPLWindow,0,config_pe_wx,config_pe_wy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
  507. }
  508. if (do_titlebar_clicking&16 && !skip_vw) // final VW positioning
  509. {
  510. SetVidWindowRect(&vwr);
  511. hdwp=DeferWindowPos(hdwp,hVideoWindow,0,config_video_wx,config_video_wy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
  512. }
  513. SetMainWindowRect(&mwr);
  514. hdwp=DeferWindowPos(hdwp,hMainWindow,0,config_wx,config_wy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
  515. p = embedwndlist;
  516. while (p)
  517. {
  518. if (p->attached)
  519. {
  520. hdwp=DeferWindowPos(hdwp,p->me,0,p->r.left,p->r.top,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
  521. }
  522. p=p->link;
  523. }
  524. EndDeferWindowPos(hdwp);
  525. }
  526. LeaveCriticalSection(&embedcs);
  527. }
  528. return 1;
  529. }
  530. }
  531. return 0;
  532. }
  533. static int title_buttons_active[4];
  534. static int do_titlebuttons()
  535. {
  536. if (mouse_type == -2)
  537. return 0;
  538. if (inreg(254,3,262,12)) // windowshade button
  539. {
  540. if (mouse_type == -1)
  541. {
  542. SendMessageW(hMainWindow,WM_COMMAND,WINAMP_OPTIONS_WINDOWSHADE,0);
  543. draw_tbuttons(-1,-1,-1,0);
  544. title_buttons_active[3]=0;
  545. }
  546. else if (mouse_stats & MK_LBUTTON)
  547. {
  548. title_buttons_active[3]=1;
  549. draw_tbuttons(-1,-1,-1,1);
  550. }
  551. if (mouse_type) return 1;
  552. }
  553. else if (title_buttons_active[3])
  554. {
  555. title_buttons_active[3]=0;
  556. draw_tbuttons(-1,-1,-1,0);
  557. }
  558. if (inreg(244,3,253,12)) // minimize button
  559. {
  560. if (mouse_type == -1)
  561. {
  562. if (GetAsyncKeyState(VK_SHIFT)>>15)
  563. minimize_hack_winamp=1;
  564. else
  565. minimize_hack_winamp=0;
  566. ShowWindow(hMainWindow,SW_MINIMIZE);
  567. draw_tbuttons(-1,0,-1,-1);
  568. title_buttons_active[1]=0;
  569. }
  570. else if (mouse_stats & MK_LBUTTON)
  571. {
  572. title_buttons_active[1]=1;
  573. draw_tbuttons(-1,1,-1,-1);
  574. }
  575. if (mouse_type) return 1;
  576. }
  577. else if (title_buttons_active[1])
  578. {
  579. title_buttons_active[1]=0;
  580. draw_tbuttons(-1,0,-1,-1);
  581. }
  582. if (inreg(264,3,272,12)) // kill button
  583. {
  584. if (mouse_type == -1)
  585. {
  586. title_buttons_active[2]=0;
  587. draw_tbuttons(-1,-1,0,-1);
  588. if (GetAsyncKeyState(VK_SHIFT)&0x8000)
  589. SendMessageW(hMainWindow,WM_COMMAND,WINAMP_MAIN_WINDOW,0);
  590. else
  591. WASABI_API_APP->main_shutdown();
  592. }
  593. else if (mouse_stats & MK_LBUTTON)
  594. {
  595. title_buttons_active[2]=1;
  596. draw_tbuttons(-1,-1,1,-1);
  597. }
  598. if (mouse_type) return 1;
  599. }
  600. else if (title_buttons_active[2])
  601. {
  602. title_buttons_active[2]=0;
  603. draw_tbuttons(-1,-1,0,-1);
  604. }
  605. if (inreg(5,3,17,13))
  606. {
  607. if (mouse_stats & MK_LBUTTON && !title_buttons_active[0])
  608. {
  609. SetTimer(hMainWindow,666,155,NULL);
  610. title_buttons_active[0]=1;
  611. draw_tbuttons(1,-1,-1,-1);
  612. }
  613. if (mouse_type) return 1;
  614. }
  615. else if (title_buttons_active[0])
  616. {
  617. KillTimer(hMainWindow,666);
  618. title_buttons_active[0]=0;
  619. draw_tbuttons(0,-1,-1,-1);
  620. }
  621. return 0;
  622. }
  623. static int do_buttonbar_needupdate;
  624. static int do_buttonbar()
  625. {
  626. if (mouse_type == -2)
  627. return 0;
  628. if (inreg(7+8,15+72,7+123,15+91))
  629. {
  630. int which = 4 - (mouse_x < 100+7) - (mouse_x < 77+7) - (mouse_x < 53+7) - (mouse_x < 31+7);
  631. switch (mouse_type)
  632. {
  633. case 1: // mousedown
  634. draw_buttonbar(which);
  635. do_buttonbar_needupdate=1;
  636. break;
  637. case 0: // mousemove
  638. if (mouse_stats & MK_LBUTTON)
  639. {
  640. draw_buttonbar(which);
  641. do_buttonbar_needupdate=1;
  642. }
  643. break;
  644. case -1: // mouseup
  645. do_buttonbar_needupdate=0;
  646. draw_buttonbar(-1);
  647. __do_buttons(which);
  648. break;
  649. }
  650. return 1;
  651. }
  652. if (do_buttonbar_needupdate)
  653. {
  654. do_buttonbar_needupdate=0;
  655. draw_buttonbar(-1);
  656. }
  657. return 0;
  658. }
  659. static int do_eq_needupdate, do_pe_needupdate;
  660. static int do_peeq()
  661. {
  662. if (mouse_type == -2)
  663. {
  664. if (do_eq_needupdate || do_pe_needupdate)
  665. {
  666. draw_eqplbut(config_eq_open,0,config_pe_open,0);
  667. do_eq_needupdate=0;
  668. do_pe_needupdate=0;
  669. return 1;
  670. }
  671. return 0;
  672. }
  673. if (inreg(219,58,219+23,58+12)) // eq
  674. {
  675. switch (mouse_type)
  676. {
  677. case 1:
  678. draw_eqplbut(config_eq_open,1,config_pe_open,0);
  679. do_eq_needupdate=1;
  680. break;
  681. case 0:
  682. if (mouse_stats & MK_LBUTTON)
  683. {
  684. draw_eqplbut(config_eq_open,1,config_pe_open,0);
  685. do_eq_needupdate=1;
  686. }
  687. break;
  688. case -1:
  689. do_eq_needupdate=0;
  690. SendMessageW(hMainWindow,WM_COMMAND,WINAMP_OPTIONS_EQ,0);
  691. break;
  692. }
  693. return 1;
  694. }
  695. if (do_eq_needupdate)
  696. {
  697. draw_eqplbut(config_eq_open,0,config_pe_open,0);
  698. do_eq_needupdate=0;
  699. }
  700. if (inreg(219+23,58,219+23+23,58+12)) // pl
  701. {
  702. switch (mouse_type)
  703. {
  704. case 1:
  705. draw_eqplbut(config_eq_open,0,config_pe_open,1);
  706. do_pe_needupdate=1;
  707. break;
  708. case 0:
  709. if (mouse_stats & MK_LBUTTON)
  710. {
  711. draw_eqplbut(config_eq_open,0,config_pe_open,1);
  712. do_pe_needupdate=1;
  713. }
  714. break;
  715. case -1:
  716. do_pe_needupdate=0;
  717. SendMessageW(hMainWindow,WM_COMMAND,WINAMP_OPTIONS_PLEDIT,0);
  718. SetForegroundWindow(hMainWindow);
  719. break;
  720. }
  721. return 1;
  722. }
  723. if (do_pe_needupdate)
  724. {
  725. draw_eqplbut(config_eq_open,0,config_pe_open,0);
  726. do_pe_needupdate=0;
  727. }
  728. return 0;
  729. }
  730. static int do_shuffle_needupdate;
  731. static int do_shuffle()
  732. {
  733. if (mouse_type == -2)
  734. return 0;
  735. if (inreg(133+7-4+29,75+15,181+7-4-4+29,87+15))
  736. {
  737. switch (mouse_type)
  738. {
  739. case 1:
  740. draw_shuffle(config_shuffle,1);
  741. do_shuffle_needupdate=1;
  742. break;
  743. case 0:
  744. if (mouse_stats & MK_LBUTTON)
  745. {
  746. draw_shuffle(config_shuffle,1);
  747. do_shuffle_needupdate=1;
  748. }
  749. break;
  750. case -1:
  751. do_shuffle_needupdate=0;
  752. SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_SHUFFLE,0);
  753. break;
  754. }
  755. return 1;
  756. }
  757. if (do_shuffle_needupdate)
  758. {
  759. draw_shuffle(config_shuffle,0);
  760. do_shuffle_needupdate=0;
  761. }
  762. return 0;
  763. }
  764. static int do_repeat_needupdate;
  765. static int do_repeat()
  766. {
  767. if (mouse_type == -2)
  768. return 0;
  769. if (inreg(182+7-4-4+29,75+15,182+29+7-4-4+29,87+15))
  770. {
  771. switch (mouse_type)
  772. {
  773. case 1:
  774. draw_repeat(config_repeat,1);
  775. do_repeat_needupdate=1;
  776. break;
  777. case 0:
  778. if (mouse_stats & MK_LBUTTON)
  779. {
  780. draw_repeat(config_repeat,1);
  781. do_repeat_needupdate=1;
  782. }
  783. break;
  784. case -1:
  785. do_repeat_needupdate=0;
  786. SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_REPEAT,0);
  787. break;
  788. }
  789. return 1;
  790. }
  791. if (do_repeat_needupdate)
  792. {
  793. draw_repeat(config_repeat,0);
  794. do_repeat_needupdate=0;
  795. }
  796. return 0;
  797. }
  798. static int do_eject_needupdate;
  799. static int do_eject()
  800. {
  801. if (mouse_type == -2)
  802. {
  803. if (do_eject_needupdate)
  804. {
  805. draw_eject(0);
  806. //do_eject_needupdate=0;
  807. return 1;
  808. }
  809. return 0;
  810. }
  811. if (inreg(132+7-4+1,60+14+15,132+7-4+22+1,60+14+15+16))
  812. {
  813. switch (mouse_type)
  814. {
  815. case 1:
  816. draw_eject(1);
  817. do_eject_needupdate=1;
  818. break;
  819. case 0:
  820. if (mouse_stats & MK_LBUTTON)
  821. {
  822. draw_eject(1);
  823. do_eject_needupdate=1;
  824. }
  825. break;
  826. case -1:
  827. do_eject_needupdate=0;
  828. draw_eject(0);
  829. if (mouse_stats & MK_CONTROL) SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_LOC,0);
  830. else if (mouse_stats & MK_SHIFT) SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_DIR,0);
  831. else SendMessageW(hMainWindow,WM_COMMAND,WINAMP_FILE_PLAY,0);
  832. break;
  833. }
  834. return 1;
  835. }
  836. if (do_eject_needupdate)
  837. {
  838. draw_eject(0);
  839. do_eject_needupdate=0;
  840. }
  841. return 0;
  842. }
  843. static int do_icon()
  844. {
  845. if (mouse_type == -2)
  846. return 0;
  847. if (inreg(246+7,76+15,258+7,90+15))
  848. {
  849. if (mouse_type == -1)
  850. SendMessageW(hMainWindow,WM_COMMAND,WINAMP_LIGHTNING_CLICK,0);
  851. return 1;
  852. }
  853. return 0;
  854. }
  855. int do_posbar_active, do_posbar_clickx=14;
  856. static int do_posbar()
  857. {
  858. int a,t;
  859. if (mouse_type == -2)
  860. {
  861. if (do_posbar_active)
  862. {
  863. do_posbar_active=0;
  864. return 1;
  865. }
  866. return 0;
  867. }
  868. if (!playing || !in_mod || !in_mod->is_seekable || PlayList_ishidden(PlayList_getPosition()))
  869. {
  870. if (mouse_type == -1 && do_posbar_active) do_posbar_active=0;
  871. return 0;
  872. }
  873. if ((mouse_type == -1
  874. || (mouse_type==0 && (mouse_stats&MK_SHIFT) && (mouse_stats&MK_LBUTTON))) && do_posbar_active)
  875. {
  876. if (mouse_type == -1)
  877. do_posbar_active=0;
  878. if (config_windowshade)
  879. {
  880. a = mouse_x - 228;
  881. a *= (257-29-10);
  882. a/=13;
  883. }
  884. else {
  885. a = mouse_x - do_posbar_clickx - (10+7); // posbar_clickx is offset from start of bar
  886. do_posbar_clickx = 14;
  887. }
  888. if (a < 0) a = 0;
  889. if (a > 257-29-10) a = 257-29-10;
  890. t = MulDiv(in_getlength(),1000 * a,(257-29-10));
  891. if (in_seek(t) < 0) StopPlaying(0);
  892. else
  893. {
  894. // ui_drawtime(in_getouttime()/1000,0);
  895. }
  896. if (mouse_type == -1)
  897. {
  898. draw_songname(FileTitle,&ui_songposition,playing?in_getlength():PlayList_getcurrentlength());
  899. return 1;
  900. }
  901. }
  902. if (mouse_type == 1)
  903. if ((inreg(11+7,58+15,256+7,66+15) && !config_windowshade) || (inreg(228,3,228+14,12) && config_windowshade) )
  904. {
  905. do_posbar_active=1;
  906. if (!config_windowshade)
  907. {
  908. int curpos = 11 + 7 +
  909. ((in_getouttime() * (257-10-29)) / in_getlength()) / 1000;
  910. if (mouse_x <= curpos + 29 && mouse_x >= curpos-1) do_posbar_clickx = mouse_x - curpos;
  911. else do_posbar_clickx = 14;
  912. }
  913. else do_posbar_clickx = 0;
  914. }
  915. if (do_posbar_active)
  916. {
  917. if (config_windowshade)
  918. {
  919. a = mouse_x - 228;
  920. a *= (257-29-10);
  921. a/=13;
  922. }
  923. else
  924. {
  925. a = mouse_x - do_posbar_clickx - (10+7);
  926. }
  927. if (a < 0) a = 0;
  928. if (a > 257-29-10) a = 257-29-10;
  929. t = MulDiv(in_getlength(),1000 * a,(257-29-10))/1000;
  930. {
  931. wchar_t buf[256] = {0}, seekStr[64] = {0};
  932. int a=in_getlength();
  933. if (in_mod && in_mod->is_seekable)
  934. {
  935. if (a) draw_positionbar((t*256) / a,1);
  936. else draw_positionbar(0,1);
  937. }
  938. StringCchPrintfW(buf,256, L"%s: %02d:%02d/%02d:%02d (%d%%)",getStringW(IDS_SEEK_TO,seekStr,64),t/60,t%60,
  939. a/60,a%60,(t*100)/(a?a:1)
  940. );
  941. if (config_windowshade) draw_time(t/60,t%60,0);
  942. t=0;
  943. draw_songname(buf,&t,-1);
  944. }
  945. return 1;
  946. }
  947. return 0;
  948. }
  949. void ui_drawtime(int time_elapsed, int mode)
  950. {
  951. if (time_elapsed < 0) time_elapsed = 0;
  952. if (!mode && paused)
  953. {
  954. static int i;
  955. draw_time(time_elapsed/60,time_elapsed%60,i);
  956. i ^= 1;
  957. }
  958. else
  959. {
  960. if (!do_posbar_active || !config_windowshade)
  961. draw_time(time_elapsed/60,time_elapsed%60,0);
  962. }
  963. if (playing)
  964. if (!do_posbar_active && in_mod && in_mod->is_seekable) {
  965. if (in_getlength()) draw_positionbar((time_elapsed*256) / in_getlength(),mode);
  966. else draw_positionbar(0,mode);
  967. }
  968. }
  969. int do_volbar_clickx=4, do_volbar_active;
  970. static int do_volbar()
  971. {
  972. if (mouse_type == -2)
  973. {
  974. if (do_volbar_active)
  975. {
  976. do_volbar_active=0;
  977. draw_volumebar(config_volume,0);
  978. return 1;
  979. }
  980. return 0;
  981. }
  982. if (mouse_type == -1 && do_volbar_active)
  983. {
  984. do_volbar_active=0;
  985. do_volbar_clickx = 7;
  986. draw_volumebar(config_volume,0);
  987. in_setvol(config_volume);
  988. draw_songname(FileTitle,&ui_songposition,playing?in_getlength():PlayList_getcurrentlength());
  989. return 1;
  990. }
  991. if (inreg(107,43+15,107+68,51+15) && mouse_type == 1)
  992. {
  993. int vs = 107 + (config_volume*51)/255;
  994. if (mouse_x < vs+15 && mouse_x >= vs) do_volbar_clickx = mouse_x - vs;
  995. else do_volbar_clickx = 7;
  996. do_volbar_active=1;
  997. }
  998. if (do_volbar_active)
  999. {
  1000. int v = mouse_x - do_volbar_clickx - (107);
  1001. // v = (v * 256) / (195-132-12);
  1002. v = (v*255)/51;
  1003. if (v < 0) v = 0;
  1004. if (v > 255) v = 255;
  1005. config_volume=v;
  1006. draw_volumebar(config_volume,1);
  1007. in_setvol(config_volume);
  1008. update_volume_text(-1);
  1009. return 1;
  1010. }
  1011. return 0;
  1012. }
  1013. int do_panbar_clickx=4, do_panbar_active;
  1014. static int do_panbar()
  1015. {
  1016. if (mouse_type == -2)
  1017. {
  1018. if (do_panbar_active)
  1019. {
  1020. draw_panbar(config_pan,0);
  1021. do_panbar_active=0;
  1022. return 1;
  1023. }
  1024. return 0;
  1025. }
  1026. if (mouse_type == -1 && do_panbar_active)
  1027. {
  1028. do_panbar_active=0;
  1029. do_panbar_clickx = 7;
  1030. if (config_pan < 27 && config_pan > -27) config_pan = 0;
  1031. draw_panbar(config_pan,0);
  1032. in_setpan(config_pan);
  1033. draw_songname(FileTitle,&ui_songposition,playing?in_getlength():PlayList_getcurrentlength());
  1034. return 1;
  1035. }
  1036. if (inreg(177,43+15,177+38,51+15) && mouse_type == 1)
  1037. {
  1038. int vs = 177 + 12 + (config_pan*12)/127;
  1039. if (mouse_x < vs+15 && mouse_x >= vs) do_panbar_clickx = mouse_x - vs;
  1040. else do_panbar_clickx = 7;
  1041. do_panbar_active=1;
  1042. }
  1043. if (do_panbar_active)
  1044. {
  1045. int v = mouse_x - do_panbar_clickx - (177);
  1046. if (v < 0) v = 0;
  1047. if (v > 24) v = 24;
  1048. v-=12;
  1049. // changed in 5.64 to have a lower limit (~16% vs 24%) and for
  1050. // holding shift to drop the central clamp (allows 7% balance)
  1051. if (!(mouse_stats & MK_SHIFT)) if (v < 2 && v > -2) v = 0;
  1052. v *= 127;
  1053. v/=12;
  1054. config_pan = v;
  1055. draw_panbar(config_pan,1);
  1056. in_setpan(config_pan);
  1057. update_panning_text(-1);
  1058. return 1;
  1059. }
  1060. return 0;
  1061. }
  1062. int ui_songposition = 0;
  1063. int ui_songposition_tts=10;
  1064. int do_songname_clickx = -1;
  1065. int do_songname_active = 0;
  1066. void ui_doscrolling()
  1067. {
  1068. if (!do_clutterbar_active && !ui_songposition_tts && !do_songname_active && !do_volbar_active && !do_panbar_active && !do_posbar_active)
  1069. {
  1070. ui_songposition+=5;
  1071. draw_songname(FileTitle,&ui_songposition,playing?in_getlength():PlayList_getcurrentlength());
  1072. } else if (ui_songposition_tts) ui_songposition_tts--;
  1073. else ui_songposition_tts = 10;
  1074. }
  1075. static int do_songname()
  1076. {
  1077. if (mouse_type == -2)
  1078. return 0;
  1079. if (mouse_stats & MK_LBUTTON || mouse_type == -1) if (do_songname_active || (inreg(117,24,266,35) && mouse_type == 1))
  1080. {
  1081. if (mouse_type == -1)
  1082. {
  1083. do_songname_clickx = -1;
  1084. do_songname_active=0;
  1085. ui_songposition_tts=10;
  1086. return 1;
  1087. }
  1088. if (do_songname_active)
  1089. {
  1090. ui_songposition -= mouse_x - do_songname_clickx;
  1091. draw_songname(FileTitle,&ui_songposition,playing?in_getlength():PlayList_getcurrentlength());
  1092. }
  1093. do_songname_clickx = mouse_x;
  1094. do_songname_active=1;
  1095. return 1;
  1096. }
  1097. return 0;
  1098. }
  1099. void ui_reset()
  1100. {
  1101. title_buttons_active[0] = title_buttons_active[1] = title_buttons_active[2] = 0;
  1102. do_clutterbar_active=0;
  1103. do_songname_clickx = -1;
  1104. do_songname_active=0;
  1105. do_buttonbar_needupdate = 0;
  1106. do_shuffle_needupdate = 0;
  1107. do_eq_needupdate = do_pe_needupdate = 0;
  1108. do_repeat_needupdate = 0;
  1109. do_eject_needupdate = 0;
  1110. do_posbar_active = 0;
  1111. do_posbar_clickx = 14;
  1112. do_volbar_active = 0;
  1113. do_volbar_clickx = 7;
  1114. do_panbar_active = 0;
  1115. do_panbar_clickx = 7;
  1116. ui_songposition = 0;
  1117. ui_songposition_tts=0;
  1118. }
  1119. void ui_handlecursor(void)
  1120. {
  1121. POINT p = {0};
  1122. static RECT b_normal[] =
  1123. {
  1124. {107,43+15,177+38,51+15},// vol & bal
  1125. {11+7,58+15,256+7,66+15},// pos
  1126. {254,3,262,12},//wshade
  1127. {244,3,253,12},//min
  1128. {264,3,272,12},//close
  1129. {5,3,17,13},//mainmenu
  1130. {0,0,275,13},// titelbar
  1131. {105,24,266,35},
  1132. }, b_windowshade[] =
  1133. {
  1134. {254,3,262,12},//wshade
  1135. {244,3,253,12},//min
  1136. {228,3,228+14,12}, // seeker
  1137. {264,3,272,12},//close
  1138. {5,3,17,13},//mainmenu
  1139. };
  1140. int x;
  1141. if (0 != (WS_DISABLED & GetWindowLongPtrW(hMainWindow, GWL_STYLE)))
  1142. x = (config_windowshade) ? 14 : 8;
  1143. else
  1144. {
  1145. int b_len;
  1146. RECT r;
  1147. GetCursorPos(&p);
  1148. GetWindowRect(hMainWindow,&r);
  1149. FixMainWindowRect(&r);
  1150. int mouse_x=p.x-r.left;
  1151. int mouse_y=p.y-r.top;
  1152. if (config_dsize) { mouse_x/=2; mouse_y/=2;}
  1153. RECT *b;
  1154. if (config_windowshade)
  1155. {
  1156. b=b_windowshade;
  1157. b_len = sizeof(b_windowshade)/sizeof(b_windowshade[0]);
  1158. }
  1159. else
  1160. {
  1161. b=b_normal;
  1162. b_len = sizeof(b_normal)/sizeof(b_normal[0]);
  1163. }
  1164. for (x = 0; x < b_len; x ++)
  1165. if (inreg(b[x].left,b[x].top,b[x].right,b[x].bottom)) break;
  1166. if (config_windowshade) x+=9;
  1167. }
  1168. if (Skin_Cursors[x]) SetCursor(Skin_Cursors[x]);
  1169. else SetCursor(LoadCursor(NULL,IDC_ARROW));
  1170. }
  1171. #include "../Plugins/General/gen_ml/menu.h"
  1172. BOOL DoTrackPopup(HMENU hMenu, UINT fuFlags, int x, int y, HWND hwnd)
  1173. {
  1174. if(hMenu == NULL)
  1175. {
  1176. return NULL;
  1177. }
  1178. HWND ml_wnd = (HWND)sendMlIpc(0, 0);
  1179. if (IsWindow(ml_wnd))
  1180. {
  1181. return Menu_TrackPopup(ml_wnd, hMenu, fuFlags, x, y, hwnd, NULL);
  1182. }
  1183. else
  1184. {
  1185. return TrackPopupMenu(hMenu, fuFlags, x, y, 0, hwnd, NULL);
  1186. }
  1187. }