Changeset 188969 in webkit


Ignore:
Timestamp:
Aug 26, 2015 10:33:49 AM (9 years ago)
Author:
Brent Fulgham
Message:

[Win] Simplify menu handling code in WinLauncher
https://bugs.webkit.org/show_bug.cgi?id=148461

Reviewed by Zalan Bujtas.

Revise 'ToggleMenuItem' to return a boolean value indicating if
it handled the message. Revise WndProc to use this to decide if it
should pass the message on to the default handler, rather than
duplicating the logic in both places.

  • WinLauncher/Common.cpp:

(ToggleMenuItem): Return true if the menu item message was handled.
(WndProc): If 'ToggleMenuItem' did not handle the message, pass
the message tothe default handler.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r188958 r188969  
     12015-08-26  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Win] Simplify menu handling code in WinLauncher
     4        https://bugs.webkit.org/show_bug.cgi?id=148461
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Revise 'ToggleMenuItem' to return a boolean value indicating if
     9        it handled the message. Revise WndProc to use this to decide if it
     10        should pass the message on to the default handler, rather than
     11        duplicating the logic in both places.
     12       
     13        * WinLauncher/Common.cpp:
     14        (ToggleMenuItem): Return true if the menu item message was handled.
     15        (WndProc): If 'ToggleMenuItem' did not handle the message, pass
     16        the message tothe default handler.
     17
    1182015-08-26  Csaba Osztrogonác  <ossy@webkit.org>
    219
  • trunk/Tools/WinLauncher/Common.cpp

    r188939 r188969  
    360360}
    361361
    362 static void ToggleMenuItem(HWND hWnd, UINT menuID)
    363 {
     362static bool ToggleMenuItem(HWND hWnd, UINT menuID)
     363{
     364    if (!gWinLauncher)
     365        return false;
     366
    364367    HMENU menu = ::GetMenu(hWnd);
    365368
     
    370373
    371374    if (!::GetMenuItemInfo(menu, menuID, FALSE, &info))
    372         return;
     375        return false;
    373376
    374377    BOOL newState = !menuItemIsChecked(info);
    375378
    376379    if (!gWinLauncher->standardPreferences() || !gWinLauncher->privatePreferences())
    377         return;
     380        return false;
    378381
    379382    switch (menuID) {
     
    423426        turnOffOtherUserAgents(menu);
    424427        break;
     428    default:
     429        return false;
    425430    }
    426431
     
    428433
    429434    ::SetMenuItemInfo(menu, menuID, FALSE, &info);
     435
     436    return true;
    430437}
    431438
     
    488495                gWinLauncher->navigateForwardOrBackward(hWnd, wmId);
    489496            break;
    490         case IDM_AVFOUNDATION:
    491         case IDM_ACC_COMPOSITING:
    492         case IDM_WK_FULLSCREEN:
    493         case IDM_COMPOSITING_BORDERS:
    494         case IDM_INVERT_COLORS:
    495         case IDM_DISABLE_IMAGES:
    496         case IDM_DISABLE_STYLES:
    497         case IDM_DISABLE_JAVASCRIPT:
    498         case IDM_DISABLE_LOCAL_FILE_RESTRICTIONS:
    499         case IDM_UA_DEFAULT:
    500         case IDM_UA_SAFARI_8_0:
    501         case IDM_UA_SAFARI_IOS_8_IPHONE:
    502         case IDM_UA_SAFARI_IOS_8_IPAD:
    503         case IDM_UA_IE_11:
    504         case IDM_UA_CHROME_MAC:
    505         case IDM_UA_CHROME_WIN:
    506         case IDM_UA_FIREFOX_MAC:
    507         case IDM_UA_FIREFOX_WIN:
    508             ToggleMenuItem(hWnd, wmId);
    509             break;
    510497        case IDM_UA_OTHER:
    511498            if (wmEvent)
     
    527514            break;
    528515        default:
    529             return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
     516            if (!ToggleMenuItem(hWnd, wmId))
     517                return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
    530518        }
    531519        }
Note: See TracChangeset for help on using the changeset viewer.