Mercurial > pidgin
view plugins/docklet/MinimizeToTray.c @ 13662:b198d0c26b83
[gaim-migrate @ 16064]
Fix Coverity CID 26: A potential crash when the server sends us
an incoming channel 2 ICBM of the ICQ server relay type but
does not send the data normally associated with such an ICBM.
This should never happen.
Fix Coverity CID 45: A potential crash when the server sends us
an incoming channel 2 ICBM but does not send the data normally
associated with such an ICBM. This should never happen.
Fix Coverity CID 47: A 1 byte memleak when signing on using the old
blist method and not when using SSI. This never happens. As far
as I can tell it has been like this since the beginning of time.
It's a weird memleak.
Fix Coverity CID 57: A memleak of the length of a screen name when
searching for screen names by email address and the server returns
a malformed SNAC. This should never happen.
Fix Coverity CID 59: A memleak of the length of an ICBM when _parsing_
an outgoing ICBM. I don't believe this ever happens, and I suspect
the code exists from a time when libfaim was perhaps being written
so that it could be used in an AIM server (in addition to just a client).
I should probably remove the function.
Fix Coverity CID 132: A memleak of the length of the email address
when searching for screen names by email address.
Fix Coverity CID 146: Check the return value of read() and print
a warning to the debug window. This code is only used when AOL
enables their crazy AIM executable hash value stuff, which hasn't
happened in 5 years or so.
Fix Coverity CID 191: Comment out some code that isn't used.
Fix Coverity CID 192: Get rid of a harmless assignment to a variable
that wasn't used.
Fix Coverity CID 194: Comment out some variables and code that
isn't used.
Fix Coverity CID 198: Get rid of a variable that wasn't used in
gaim_ssi_parselist().
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 19 Apr 2006 03:31:47 +0000 |
parents | 6de39a8cc2c1 |
children |
line wrap: on
line source
/* 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 * from the system tray * * These routines are public domain, but it would be nice if you dropped * me a line if you use them! * * 1.0 29.06.2000 Initial version * 1.1 01.07.2000 The window retains it's place in the Z-order of windows * when minimized/hidden. This means that when restored/shown, it doesn't * always appear as the foreground window unless we call SetForegroundWindow * * Copyright 2000 Matthew Ellis <m.t.ellis@bigfoot.com> */ #define _WIN32_WINNT 0x0500 #include <windows.h> #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); if(hShellTrayWnd) { HWND hTrayNotifyWnd = FindWindowEx(hShellTrayWnd, NULL, TEXT("TrayNotifyWnd"), NULL); if(hTrayNotifyWnd) { GetWindowRect(hTrayNotifyWnd,lpTrayRect); 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; return; } SystemParametersInfo(SPI_GETWORKAREA, 0, lpTrayRect, 0); lpTrayRect->left = lpTrayRect->right - DEFAULT_RECT_WIDTH; lpTrayRect->top = lpTrayRect->bottom - DEFAULT_RECT_HEIGHT; } static BOOL GetDoAnimateMinimize(void) { ANIMATIONINFO ai; ai.cbSize = sizeof(ai); SystemParametersInfo(SPI_GETANIMATION, sizeof(ai), &ai, 0); return ai.iMinAnimate ? TRUE : FALSE; } void MinimizeWndToTray(HWND hWnd) { if(!IsWindowVisible(hWnd)) return; if(GetDoAnimateMinimize()) { RECT rcFrom, rcTo; GetWindowRect(hWnd, &rcFrom); GetTrayWndRect(&rcTo); DrawAnimatedRects(hWnd, IDANI_CAPTION, &rcFrom, &rcTo); } ShowWindow(hWnd, SW_HIDE); } void RestoreWndFromTray(HWND hWnd) { if(IsWindowVisible(hWnd)) return; if(GetDoAnimateMinimize()) { RECT rcFrom, rcTo; GetTrayWndRect(&rcFrom); GetWindowRect(hWnd, &rcTo); DrawAnimatedRects(hWnd, IDANI_CAPTION, &rcFrom, &rcTo); } ShowWindow(hWnd, SW_SHOW); SetActiveWindow(hWnd); SetForegroundWindow(hWnd); }