Mercurial > pidgin
changeset 13432:6de39a8cc2c1
[gaim-migrate @ 15807]
Cleanup, mostly whitespace, but also a couple warnings.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 07 Mar 2006 05:06:22 +0000 |
parents | 983921e78632 |
children | 7ef6a2d0d9da |
files | plugins/docklet/MinimizeToTray.c |
diffstat | 1 files changed, 78 insertions(+), 94 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/docklet/MinimizeToTray.c Tue Mar 07 05:03:15 2006 +0000 +++ b/plugins/docklet/MinimizeToTray.c Tue Mar 07 05:06:22 2006 +0000 @@ -1,7 +1,7 @@ /* MinimizeToTray * * A couple of routines to show how to make it produce a custom caption - * animation to make it look like we are minimizing to and maximizing + * animation to make it look like we are minimizing to and maximizing * from the system tray * * These routines are public domain, but it would be nice if you dropped @@ -14,122 +14,106 @@ * * Copyright 2000 Matthew Ellis <m.t.ellis@bigfoot.com> */ +#define _WIN32_WINNT 0x0500 #include <windows.h> - -#ifndef IDANI_OPEN -#define IDANI_OPEN 1 -#endif -#ifndef IDANI_CLOSE -#define IDANI_CLOSE 2 -#endif -#ifndef IDANI_CAPTION -#define IDANI_CAPTION 3 -#endif +#include "MinimizeToTray.h" #define DEFAULT_RECT_WIDTH 150 #define DEFAULT_RECT_HEIGHT 30 -static void GetTrayWndRect(LPRECT lpTrayRect) -{ - APPBARDATA appBarData; - HWND hShellTrayWnd=FindWindowEx(NULL,NULL,TEXT("Shell_TrayWnd"),NULL); +static void GetTrayWndRect(LPRECT lpTrayRect) { + APPBARDATA appBarData; + HWND hShellTrayWnd = FindWindowEx(NULL, NULL, TEXT("Shell_TrayWnd"), + NULL); - if(hShellTrayWnd) - { - HWND hTrayNotifyWnd=FindWindowEx(hShellTrayWnd,NULL,TEXT("TrayNotifyWnd"),NULL); - if(hTrayNotifyWnd) - { - GetWindowRect(hTrayNotifyWnd,lpTrayRect); - return; - } - } + if(hShellTrayWnd) { + HWND hTrayNotifyWnd = FindWindowEx(hShellTrayWnd, NULL, + TEXT("TrayNotifyWnd"), NULL); - appBarData.cbSize=sizeof(appBarData); - if(SHAppBarMessage(ABM_GETTASKBARPOS,&appBarData)) - { - switch(appBarData.uEdge) - { - case ABE_LEFT: - case ABE_RIGHT: - lpTrayRect->top=appBarData.rc.bottom-100; - lpTrayRect->bottom=appBarData.rc.bottom-16; - lpTrayRect->left=appBarData.rc.left; - lpTrayRect->right=appBarData.rc.right; - break; + if(hTrayNotifyWnd) { + GetWindowRect(hTrayNotifyWnd,lpTrayRect); + return; + } + } - case ABE_TOP: - case ABE_BOTTOM: - lpTrayRect->top=appBarData.rc.top; - lpTrayRect->bottom=appBarData.rc.bottom; - lpTrayRect->left=appBarData.rc.right-100; - lpTrayRect->right=appBarData.rc.right-16; - break; - } - - return; - } + appBarData.cbSize = sizeof(appBarData); + if(SHAppBarMessage(ABM_GETTASKBARPOS, &appBarData)) { + switch(appBarData.uEdge) { + case ABE_LEFT: + case ABE_RIGHT: + lpTrayRect->top = appBarData.rc.bottom - 100; + lpTrayRect->bottom = appBarData.rc.bottom - 16; + lpTrayRect->left = appBarData.rc.left; + lpTrayRect->right = appBarData.rc.right; + break; + case ABE_TOP: + case ABE_BOTTOM: + lpTrayRect->top = appBarData.rc.top; + lpTrayRect->bottom = appBarData.rc.bottom; + lpTrayRect->left = appBarData.rc.right - 100; + lpTrayRect->right = appBarData.rc.right - 16; + break; + } + return; + } - hShellTrayWnd=FindWindowEx(NULL,NULL,TEXT("Shell_TrayWnd"),NULL); - if(hShellTrayWnd) - { - GetWindowRect(hShellTrayWnd,lpTrayRect); - if(lpTrayRect->right-lpTrayRect->left>DEFAULT_RECT_WIDTH) - lpTrayRect->left=lpTrayRect->right-DEFAULT_RECT_WIDTH; - if(lpTrayRect->bottom-lpTrayRect->top>DEFAULT_RECT_HEIGHT) - lpTrayRect->top=lpTrayRect->bottom-DEFAULT_RECT_HEIGHT; + hShellTrayWnd = FindWindowEx(NULL, NULL, TEXT("Shell_TrayWnd"), NULL); + if(hShellTrayWnd) { + GetWindowRect(hShellTrayWnd, lpTrayRect); + if(lpTrayRect->right-lpTrayRect->left > DEFAULT_RECT_WIDTH) + lpTrayRect->left = lpTrayRect->right - DEFAULT_RECT_WIDTH; + if(lpTrayRect->bottom-lpTrayRect->top > DEFAULT_RECT_HEIGHT) + lpTrayRect->top=lpTrayRect->bottom - DEFAULT_RECT_HEIGHT; - return; - } + return; + } - SystemParametersInfo(SPI_GETWORKAREA,0,lpTrayRect,0); - lpTrayRect->left=lpTrayRect->right-DEFAULT_RECT_WIDTH; - lpTrayRect->top=lpTrayRect->bottom-DEFAULT_RECT_HEIGHT; + SystemParametersInfo(SPI_GETWORKAREA, 0, lpTrayRect, 0); + lpTrayRect->left = lpTrayRect->right - DEFAULT_RECT_WIDTH; + lpTrayRect->top = lpTrayRect->bottom - DEFAULT_RECT_HEIGHT; } -static int GetDoAnimateMinimize(void) -{ - ANIMATIONINFO ai; +static BOOL GetDoAnimateMinimize(void) { + ANIMATIONINFO ai; - ai.cbSize=sizeof(ai); - SystemParametersInfo(SPI_GETANIMATION,sizeof(ai),&ai,0); + ai.cbSize = sizeof(ai); + SystemParametersInfo(SPI_GETANIMATION, sizeof(ai), &ai, 0); - return ai.iMinAnimate?TRUE:FALSE; + return ai.iMinAnimate ? TRUE : FALSE; } -void MinimizeWndToTray(HWND hWnd) -{ - if(!IsWindowVisible(hWnd)) - return; - if(GetDoAnimateMinimize()) - { - RECT rcFrom,rcTo; +void MinimizeWndToTray(HWND hWnd) { + + if(!IsWindowVisible(hWnd)) + return; + + if(GetDoAnimateMinimize()) { + RECT rcFrom, rcTo; - GetWindowRect(hWnd,&rcFrom); - GetTrayWndRect(&rcTo); + GetWindowRect(hWnd, &rcFrom); + GetTrayWndRect(&rcTo); - DrawAnimatedRects(hWnd,IDANI_CAPTION,&rcFrom,&rcTo); - } + DrawAnimatedRects(hWnd, IDANI_CAPTION, &rcFrom, &rcTo); + } - ShowWindow(hWnd,SW_HIDE); + ShowWindow(hWnd, SW_HIDE); } -void RestoreWndFromTray(HWND hWnd) -{ - if(IsWindowVisible(hWnd)) - return; - if(GetDoAnimateMinimize()) - { - RECT rcFrom,rcTo; - GetTrayWndRect(&rcFrom); - GetWindowRect(hWnd,&rcTo); +void RestoreWndFromTray(HWND hWnd) { + + if(IsWindowVisible(hWnd)) + return; - DrawAnimatedRects(hWnd,IDANI_CAPTION,&rcFrom,&rcTo); - } + if(GetDoAnimateMinimize()) { + RECT rcFrom, rcTo; + GetTrayWndRect(&rcFrom); + GetWindowRect(hWnd, &rcTo); - ShowWindow(hWnd,SW_SHOW); - SetActiveWindow(hWnd); - SetForegroundWindow(hWnd); + DrawAnimatedRects(hWnd, IDANI_CAPTION, &rcFrom, &rcTo); + } + + ShowWindow(hWnd, SW_SHOW); + SetActiveWindow(hWnd); + SetForegroundWindow(hWnd); } - -