00197 {
00198
UINT htArea;
00199
PWND pwndSwitch;
00200
PMENUSTATE pMenuState;
00201
TL tlpwnd;
00202 POINT pt;
00203
DWORD dw;
00204
PWND pwndCapture;
00205
PTHREADINFO pti;
00206
00207
CheckLock(pwnd);
00208
00209 htArea = (
UINT)(cmd & 0x0F);
00210 cmd -= htArea;
00211
00212
00213
00214
00215
if (lParam == 0x00010000
L)
00216 lParam = 0
L;
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 pti =
GETPTI(pwnd);
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 pwndCapture = ((pti->
TIF_flags &
TIF_16BIT) && (cmd == SC_RESTORE)) ?
gspwndInternalCapture :
00249 pti->
pq->
spwndCapture;
00250
00251
if ((!pwndCapture && !
TestWF(pwnd, WFDISABLED)) ||
00252 (pwnd ==
gspwndFullScreen) ||
00253 (cmd == SC_SCREENSAVE) ||
00254 (cmd == SC_MONITORPOWER) ||
00255 (cmd == SC_TASKLIST)) {
00256
00257
00258
00259
00260
00261
#ifdef SYSMODALWINDOWS
00262
if (gspwndSysModal !=
NULL) {
00263
switch (cmd) {
00264
case SC_SIZE:
00265
case SC_MOVE:
00266
case SC_MINIMIZE:
00267
case SC_MAXIMIZE:
00268
case SC_NEXTWINDOW:
00269
case SC_PREVWINDOW:
00270
case SC_SCREENSAVE:
00271
return;
00272 }
00273 }
00274
#endif
00275
00276
00277
00278
00279
00280
if (
IsHooked(
PtiCurrent(), WHF_CBT) &&
xxxCallHook(HCBT_SYSCOMMAND,
00281 (DWORD)cmd, (DWORD)lParam, WH_CBT)) {
00282
return;
00283 }
00284
00285
switch (cmd) {
00286
case SC_RESTORE:
00287 cmd = SW_RESTORE;
00288
if (
TestWF(pwnd, WFMINIMIZED) || !
TestWF(pwnd, WFMAXIMIZED))
00289
PlayEventSound(USER_SOUND_RESTOREUP);
00290
else
00291
PlayEventSound(USER_SOUND_RESTOREDOWN);
00292
goto MinMax;
00293
00294
00295
case SC_MINIMIZE:
00296 cmd = SW_MINIMIZE;
00297
00298
00299
00300
00301
if (
TestWF(pwnd, WFMINIMIZED))
00302
break;
00303
00304
PlayEventSound(USER_SOUND_MINIMIZE);
00305
00306
goto MinMax;
00307
case SC_MAXIMIZE:
00308 cmd = SW_SHOWMAXIMIZED;
00309
00310
00311
00312
00313
if (
TestWF(pwnd, WFMAXIMIZED))
00314
break;
00315
00316
PlayEventSound(USER_SOUND_MAXIMIZE);
00317 MinMax:
00318
xxxShowWindow(pwnd, cmd |
TEST_PUDF(PUDF_ANIMATE));
00319
return;
00320
00321
case SC_SIZE:
00322 {
00323
xxxMoveSize(pwnd, htArea,
_GetMessagePos());
00324 }
00325
return;
00326
00327
case SC_MOVE:
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337 dw =
_GetMessagePos();
00338 POINTSTOPOINT( pt, MAKEPOINTS(dw));
00339
if ( !htArea ||
00340
xxxIsDragging(pwnd, pt, WM_LBUTTONUP)) {
00341
00342
00343
00344
00345 {
00346
xxxMoveSize(pwnd, (htArea == 0) ? WMSZ_KEYMOVE : WMSZ_MOVE, dw);
00347 }
00348 }
else {
00349
00350
00351
00352
00353
00354
xxxSetWindowPos(pwnd, PWND_TOP, 0, 0, 0, 0,
00355 SWP_NOMOVE | SWP_NOSIZE);
00356
if (
TestWF(pwnd, WFMINIMIZED)) {
00357
00358
00359
00360
00361
xxxSendMessage(pwnd, WM_SYSCOMMAND, SC_KEYMENU,
00362 (DWORD) (
TestWF(pwnd, WFCHILD) ?
'-' : MENUSYSMENU));
00363 }
00364 }
00365
return;
00366
00367
case SC_CLOSE:
00368
xxxSendMessage(pwnd, WM_CLOSE, 0L, 0L);
00369
return;
00370
00371
case SC_NEXTWINDOW:
00372
case SC_PREVWINDOW:
00373
xxxOldNextWindow((UINT)lParam);
00374
break;
00375
00376
case SC_CONTEXTHELP:
00377
xxxHelpLoop(pwnd);
00378
break;
00379
00380
case SC_KEYMENU:
00381
00382
00383
00384
00385 pMenuState =
xxxMNStartMenuState(pwnd, cmd, lParam);
00386
if (pMenuState !=
NULL) {
00387 UserAssert(
PtiCurrent() == pMenuState->
ptiMenuStateOwner);
00388
00389
00390
00391
00392
if (
gspwndFullScreen == pwnd) {
00393
PWND pwndT;
00394
TL tlpwndT;
00395
00396 pwndT =
_GetDesktopWindow();
00397
ThreadLock(pwndT, &tlpwndT);
00398
xxxMakeWindowForegroundWithState(pwndT, GDIFULLSCREEN);
00399
ThreadUnlock(&tlpwndT);
00400 }
00401
00402 pMenuState->
fUnderline =
TRUE;
00403
xxxMNKeyFilter(pMenuState->
pGlobalPopupMenu, pMenuState, (UINT)lParam);
00404
if (!pMenuState->
fModelessMenu) {
00405
xxxMNEndMenuState (TRUE);
00406 }
00407 }
00408
00409
00410
00411 UserAssert(!(
PtiCurrent()->pq->QF_flags & QF_CAPTURELOCKED));
00412
return;
00413
00414
case SC_MOUSEMENU:
00415
case SC_DEFAULT:
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
if (!(
GETPTI(pwnd)->pq ==
gpqForeground))
00427
return;
00428
00429
00430
00431
00432 pMenuState =
xxxMNStartMenuState(pwnd, cmd, lParam);
00433
if (pMenuState !=
NULL) {
00434 UserAssert(
PtiCurrent() == pMenuState->
ptiMenuStateOwner);
00435
xxxMNLoop(pMenuState->
pGlobalPopupMenu, pMenuState, lParam, (cmd==SC_DEFAULT));
00436
if (!pMenuState->
fModelessMenu) {
00437
xxxMNEndMenuState (TRUE);
00438 }
00439 }
00440
00441
00442
00443 UserAssert(!(
PtiCurrent()->pq->QF_flags & QF_CAPTURELOCKED));
00444
return;
00445
00446
case SC_VSCROLL:
00447
case SC_HSCROLL:
00448
xxxSBTrackInit(pwnd, lParam, htArea, (
_GetKeyState(VK_SHIFT) < 0) ? SCROLL_DIRECT : SCROLL_NORMAL);
00449
return;
00450
00451
case SC_TASKLIST:
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
if (
FDoTray() && (
FCallHookTray() ||
FPostTray(pwnd->
head.rpdesk))) {
00464
PWND pwndTaskman = pwnd->
head.rpdesk->pDeskInfo->spwndTaskman;
00465
if (
FCallHookTray()) {
00466
xxxCallHook(HSHELL_TASKMAN, (WPARAM)
HWq(pwnd), (LPARAM) 0, WH_SHELL);
00467 }
00468
if ((
FPostTray(pwnd->
head.rpdesk)) && (pwndTaskman !=
NULL)) {
00469
glinp.
ptiLastWoken =
GETPTI(pwndTaskman);
00470
_PostMessage(pwndTaskman,
gpsi->
uiShellMsg, HSHELL_TASKMAN,
00471 lParam == (ULONG)(-1) ? (LPARAM) -1 :(LPARAM)
HWq(pwnd));
00472 }
00473 }
else if (
gptiTasklist !=
NULL) {
00474
glinp.
ptiLastWoken =
gptiTasklist;
00475
_PostThreadMessage(gptiTasklist, WM_SYSCOMMAND, SC_TASKLIST, 0);
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501 }
00502
00503
break;
00504
00505
case SC_MONITORPOWER:
00506
00507
00508
00509
if (
gPowerState.
fInProgress) {
00510
break;
00511 }
00512
00513
switch (lParam) {
00514
case POWERON_PHASE:
00515
if (
glinp.
dwFlags &
LINP_POWERTIMEOUTS) {
00516
glinp.
dwFlags &= ~
LINP_POWERTIMEOUTS;
00517 DrvSetMonitorPowerState(
gpDispInfo->
pmdev,
00518 PowerDeviceD0);
00519 }
00520
break;
00521
case LOWPOWER_PHASE:
00522
if ((
glinp.
dwFlags &
LINP_LOWPOWER) == 0) {
00523
glinp.
dwFlags |=
LINP_LOWPOWER;
00524 DrvSetMonitorPowerState(
gpDispInfo->
pmdev,
00525 PowerDeviceD1);
00526 }
00527
break;
00528
case POWEROFF_PHASE:
00529
if ((
glinp.
dwFlags &
LINP_POWEROFF) == 0) {
00530
glinp.
dwFlags |=
LINP_POWEROFF;
00531 DrvSetMonitorPowerState(
gpDispInfo->
pmdev,
00532 PowerDeviceD3);
00533 }
00534
break;
00535
default:
00536
break;
00537 }
00538
break;
00539
00540
case SC_SCREENSAVE:
00541 pwndSwitch =
RevalidateHwnd(ghwndSwitch);
00542
00543
00544
00545
if (pwndSwitch !=
NULL && pwnd != pwndSwitch) {
00546
_PostMessage(pwndSwitch, WM_SYSCOMMAND, SC_SCREENSAVE, 0L);
00547 }
else {
00548
StartScreenSaver(FALSE);
00549 }
00550
break;
00551
00552
case SC_HOTKEY:
00553
00554
00555
00556
00557 pwnd =
ValidateHwnd((HWND)lParam);
00558
if (pwnd !=
NULL) {
00559 pwndSwitch =
_GetLastActivePopup(pwnd);
00560
00561
if (pwndSwitch !=
NULL)
00562 pwnd = pwndSwitch;
00563
00564
ThreadLockAlways(pwnd, &tlpwnd);
00565
xxxSetForegroundWindow(pwnd, FALSE);
00566
ThreadUnlock(&tlpwnd);
00567
00568
if (
TestWF(pwnd, WFMINIMIZED))
00569
_PostMessage(pwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
00570 }
00571
break;
00572 }
00573 }
00574 }