diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-21 12:55:09 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-21 13:54:42 -0700 |
commit | 9838b7032ea9792bec21af424c53c07078636d21 (patch) | |
tree | b72d0827dac50f0f3b8eab29b3b7639546d735d7 /hw/xwin/wintrayicon.c | |
parent | 75199129c603fc8567185ac31866c9518193cb78 (diff) |
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:
-bap
-psl
-T PrivatePtr
-T pmWait
-T _XFUNCPROTOBEGIN
-T _XFUNCPROTOEND
-T _X_EXPORT
The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.
The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.
The comparison was done with this script:
dir1=$1
dir2=$2
for dir in $dir1 $dir2; do
(cd $dir && find . -name '*.o' | while read file; do
dir=`dirname $file`
base=`basename $file .o`
dump=$dir/$base.dump
objdump -d $file > $dump
done)
done
find $dir1 -name '*.dump' | while read dump; do
otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
diff -u $dump $otherdump
done
Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'hw/xwin/wintrayicon.c')
-rw-r--r-- | hw/xwin/wintrayicon.c | 235 |
1 files changed, 111 insertions, 124 deletions
diff --git a/hw/xwin/wintrayicon.c b/hw/xwin/wintrayicon.c index 895b47caf..dbc47257b 100644 --- a/hw/xwin/wintrayicon.c +++ b/hw/xwin/wintrayicon.c @@ -41,170 +41,157 @@ */ void -winInitNotifyIcon (winPrivScreenPtr pScreenPriv) +winInitNotifyIcon(winPrivScreenPtr pScreenPriv) { - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - NOTIFYICONDATA nid = {0}; - - nid.cbSize = sizeof (NOTIFYICONDATA); - nid.hWnd = pScreenPriv->hwndScreen; - nid.uID = pScreenInfo->dwScreen; - nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; - nid.uCallbackMessage = WM_TRAYICON; - nid.hIcon = winTaskbarIcon (); - - /* Save handle to the icon so it can be freed later */ - pScreenPriv->hiconNotifyIcon = nid.hIcon; - - /* Set display and screen-specific tooltip text */ - snprintf (nid.szTip, - sizeof (nid.szTip), - PROJECT_NAME " Server:%s.%d", - display, - (int) pScreenInfo->dwScreen); - - /* Add the tray icon */ - if (!Shell_NotifyIcon (NIM_ADD, &nid)) - ErrorF ("winInitNotifyIcon - Shell_NotifyIcon Failed\n"); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + NOTIFYICONDATA nid = { 0 }; + + nid.cbSize = sizeof(NOTIFYICONDATA); + nid.hWnd = pScreenPriv->hwndScreen; + nid.uID = pScreenInfo->dwScreen; + nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; + nid.uCallbackMessage = WM_TRAYICON; + nid.hIcon = winTaskbarIcon(); + + /* Save handle to the icon so it can be freed later */ + pScreenPriv->hiconNotifyIcon = nid.hIcon; + + /* Set display and screen-specific tooltip text */ + snprintf(nid.szTip, + sizeof(nid.szTip), + PROJECT_NAME " Server:%s.%d", + display, (int) pScreenInfo->dwScreen); + + /* Add the tray icon */ + if (!Shell_NotifyIcon(NIM_ADD, &nid)) + ErrorF("winInitNotifyIcon - Shell_NotifyIcon Failed\n"); } - /* * Delete the tray icon */ void -winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv) +winDeleteNotifyIcon(winPrivScreenPtr pScreenPriv) { - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - NOTIFYICONDATA nid = {0}; - + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + NOTIFYICONDATA nid = { 0 }; + #if 0 - ErrorF ("winDeleteNotifyIcon\n"); + ErrorF("winDeleteNotifyIcon\n"); #endif - nid.cbSize = sizeof (NOTIFYICONDATA); - nid.hWnd = pScreenPriv->hwndScreen; - nid.uID = pScreenInfo->dwScreen; - - /* Delete the tray icon */ - if (!Shell_NotifyIcon (NIM_DELETE, &nid)) - { - ErrorF ("winDeleteNotifyIcon - Shell_NotifyIcon failed\n"); - return; + nid.cbSize = sizeof(NOTIFYICONDATA); + nid.hWnd = pScreenPriv->hwndScreen; + nid.uID = pScreenInfo->dwScreen; + + /* Delete the tray icon */ + if (!Shell_NotifyIcon(NIM_DELETE, &nid)) { + ErrorF("winDeleteNotifyIcon - Shell_NotifyIcon failed\n"); + return; } - /* Free the icon that was loaded */ - if (pScreenPriv->hiconNotifyIcon != NULL - && DestroyIcon (pScreenPriv->hiconNotifyIcon) == 0) - { - ErrorF ("winDeleteNotifyIcon - DestroyIcon failed\n"); + /* Free the icon that was loaded */ + if (pScreenPriv->hiconNotifyIcon != NULL + && DestroyIcon(pScreenPriv->hiconNotifyIcon) == 0) { + ErrorF("winDeleteNotifyIcon - DestroyIcon failed\n"); } - pScreenPriv->hiconNotifyIcon = NULL; + pScreenPriv->hiconNotifyIcon = NULL; } - /* * Process messages intended for the tray icon */ LRESULT -winHandleIconMessage (HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam, - winPrivScreenPtr pScreenPriv) +winHandleIconMessage(HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam, winPrivScreenPtr pScreenPriv) { #if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_MULTIWINDOW) - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; #endif - switch (lParam) - { + switch (lParam) { case WM_LBUTTONUP: - /* Restack and bring all windows to top */ - SetForegroundWindow (hwnd); + /* Restack and bring all windows to top */ + SetForegroundWindow(hwnd); #ifdef XWIN_MULTIWINDOWEXTWM - if (pScreenInfo->fMWExtWM) - winMWExtWMRestackWindows (pScreenInfo->pScreen); + if (pScreenInfo->fMWExtWM) + winMWExtWMRestackWindows(pScreenInfo->pScreen); #endif - break; + break; case WM_LBUTTONDBLCLK: - /* Display Exit dialog box */ - winDisplayExitDialog (pScreenPriv); - break; + /* Display Exit dialog box */ + winDisplayExitDialog(pScreenPriv); + break; case WM_RBUTTONUP: - { - POINT ptCursor; - HMENU hmenuPopup; - HMENU hmenuTray; + { + POINT ptCursor; + HMENU hmenuPopup; + HMENU hmenuTray; - /* Get cursor position */ - GetCursorPos (&ptCursor); + /* Get cursor position */ + GetCursorPos(&ptCursor); - /* Load tray icon menu resource */ - hmenuPopup = LoadMenu (g_hInstance, - MAKEINTRESOURCE(IDM_TRAYICON_MENU)); - if (!hmenuPopup) - ErrorF ("winHandleIconMessage - LoadMenu failed\n"); + /* Load tray icon menu resource */ + hmenuPopup = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDM_TRAYICON_MENU)); + if (!hmenuPopup) + ErrorF("winHandleIconMessage - LoadMenu failed\n"); - /* Get actual tray icon menu */ - hmenuTray = GetSubMenu (hmenuPopup, 0); + /* Get actual tray icon menu */ + hmenuTray = GetSubMenu(hmenuPopup, 0); #ifdef XWIN_MULTIWINDOW - /* Check for MultiWindow mode */ - if (pScreenInfo->fMultiWindow) - { - MENUITEMINFO mii = {0}; - - /* Root is shown, remove the check box */ - - /* Setup menu item info structure */ - mii.cbSize = sizeof (MENUITEMINFO); - mii.fMask = MIIM_STATE; - mii.fState = MFS_CHECKED; - - /* Unheck box if root is shown */ - if (pScreenPriv->fRootWindowShown) - mii.fState = MFS_UNCHECKED; - - /* Set menu state */ - SetMenuItemInfo (hmenuTray, ID_APP_HIDE_ROOT, FALSE, &mii); - } - else + /* Check for MultiWindow mode */ + if (pScreenInfo->fMultiWindow) { + MENUITEMINFO mii = { 0 }; + + /* Root is shown, remove the check box */ + + /* Setup menu item info structure */ + mii.cbSize = sizeof(MENUITEMINFO); + mii.fMask = MIIM_STATE; + mii.fState = MFS_CHECKED; + + /* Unheck box if root is shown */ + if (pScreenPriv->fRootWindowShown) + mii.fState = MFS_UNCHECKED; + + /* Set menu state */ + SetMenuItemInfo(hmenuTray, ID_APP_HIDE_ROOT, FALSE, &mii); + } + else #endif - { - /* Remove Hide Root Window button */ - RemoveMenu (hmenuTray, - ID_APP_HIDE_ROOT, - MF_BYCOMMAND); - } - - SetupRootMenu ((unsigned long)hmenuTray); - - /* - * NOTE: This three-step procedure is required for - * proper popup menu operation. Without the - * call to SetForegroundWindow the - * popup menu will often not disappear when you click - * outside of it. Without the PostMessage the second - * time you display the popup menu it might immediately - * disappear. - */ - SetForegroundWindow (hwnd); - TrackPopupMenuEx (hmenuTray, - TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON, - ptCursor.x, ptCursor.y, - hwnd, - NULL); - PostMessage (hwnd, WM_NULL, 0, 0); - - /* Free menu */ - DestroyMenu (hmenuPopup); - } - break; + { + /* Remove Hide Root Window button */ + RemoveMenu(hmenuTray, ID_APP_HIDE_ROOT, MF_BYCOMMAND); + } + + SetupRootMenu((unsigned long) hmenuTray); + + /* + * NOTE: This three-step procedure is required for + * proper popup menu operation. Without the + * call to SetForegroundWindow the + * popup menu will often not disappear when you click + * outside of it. Without the PostMessage the second + * time you display the popup menu it might immediately + * disappear. + */ + SetForegroundWindow(hwnd); + TrackPopupMenuEx(hmenuTray, + TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON, + ptCursor.x, ptCursor.y, hwnd, NULL); + PostMessage(hwnd, WM_NULL, 0, 0); + + /* Free menu */ + DestroyMenu(hmenuPopup); + } + break; } - return 0; + return 0; } |