summaryrefslogtreecommitdiff
path: root/plugins/YAPP
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/YAPP')
-rw-r--r--plugins/YAPP/src/message_pump.cpp94
-rw-r--r--plugins/YAPP/src/message_pump.h1
-rw-r--r--plugins/YAPP/src/notify_imp.cpp3
-rw-r--r--plugins/YAPP/src/options.cpp46
-rw-r--r--plugins/YAPP/src/popwin.cpp141
5 files changed, 109 insertions, 176 deletions
diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp
index a08fb213f7..73dd3fbf1b 100644
--- a/plugins/YAPP/src/message_pump.cpp
+++ b/plugins/YAPP/src/message_pump.cpp
@@ -9,69 +9,12 @@ HANDLE hMPEvent;
#define MAX_POPUPS 100
-// from popups, popup2 implementation, slightly modified
-// return true if there is a full-screen application (e.g. game) running
-bool is_full_screen() {
- int w = GetSystemMetrics(SM_CXSCREEN);
- int h = GetSystemMetrics(SM_CYSCREEN);
- // use ClientRect instead of WindowRect so that it works normally for maximized applications - thx Nikto
- RECT ClientRect;
- HWND hWnd;
-
- HWND hWndDesktop = GetDesktopWindow();
- HWND hWndShell = GetShellWindow();
-
- // check foregroundwindow
- hWnd = GetForegroundWindow();
- if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
- GetClientRect(hWnd, &ClientRect);
- if ((ClientRect.right - ClientRect.left) >= w && (ClientRect.bottom - ClientRect.top) >= h)
- return true;
- }
-
- // check other top level windows
- while ((hWnd = FindWindowEx(NULL, hWnd, NULL, NULL))) {
- if (IsWindowVisible(hWnd) == 0 || IsIconic(hWnd) || hWnd == hWndDesktop || hWnd == hWndShell)
- continue;
-
-// if (db_get_b(0, MODULE, "ShowForNonTopmostFullscreenWindows", 0) == 1) {
- if (!(GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST))
- continue;
-// }
-
- // not sure if this could be done more simply using 'IsZoomed'?
- GetClientRect(hWnd, &ClientRect);
- if ((ClientRect.right - ClientRect.left) < w || (ClientRect.bottom - ClientRect.top) < h)
- continue;
-
- return true;
- }
-
- return false;
-}
-
-bool is_workstation_locked()
-{
- bool rc = false;
- HDESK hDesk = OpenDesktop((TCHAR*)_T("default"), 0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDesk != 0) {
- HDESK hDeskInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDeskInput == 0) {
- rc = true;
- } else
- CloseDesktop(hDeskInput);
-
- CloseDesktop(hDesk);
- }
-
- return rc;
-}
-
unsigned __stdcall MessagePumpThread(void* param)
{
- if (param) SetEvent((HANDLE)param);
+ if (param)
+ SetEvent((HANDLE)param);
- MSG hwndMsg = {0};
+ MSG hwndMsg = { 0 };
while(GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated()) {
if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) {
switch(hwndMsg.message) {
@@ -81,22 +24,21 @@ unsigned __stdcall MessagePumpThread(void* param)
int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
if (status >= ID_STATUS_OFFLINE && status <= ID_STATUS_OUTTOLUNCH && options.disable_status[status - ID_STATUS_OFFLINE])
enabled = false;
- if ((options.disable_full_screen && is_full_screen()) || is_workstation_locked())
+ if ((options.disable_full_screen && IsFullScreen()) || IsWorkstationLocked())
enabled = false;
- PopupData *pd = (PopupData *)hwndMsg.lParam;
+ PopupData *pd = (PopupData*)hwndMsg.lParam;
if (enabled && num_popups < MAX_POPUPS) {
//HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, GetDesktopWindow(), 0, hInst, (LPVOID)hwndMsg.lParam);
HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam);
num_popups++;
if (hwndMsg.wParam) // set notifyer handle
SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0);
- } else {
- if (pd) {
- mir_free(pd->pwzTitle);
- mir_free(pd->pwzText);
- mir_free(pd);
- }
+ }
+ else if (pd) {
+ mir_free(pd->pwzTitle);
+ mir_free(pd->pwzText);
+ mir_free(pd);
}
}
break;
@@ -112,17 +54,11 @@ unsigned __stdcall MessagePumpThread(void* param)
break;
case MUM_NMUPDATE:
- {
- HANDLE hNotify = (HANDLE)hwndMsg.wParam;
- BroadcastMessage(PUM_UPDATENOTIFY, (WPARAM)hNotify, 0);
- }
+ BroadcastMessage(PUM_UPDATENOTIFY, hwndMsg.wParam, 0);
break;
case MUM_NMREMOVE:
- {
- HANDLE hNotify = (HANDLE)hwndMsg.wParam;
- BroadcastMessage(PUM_KILLNOTIFY, (WPARAM)hNotify, 0);
- }
+ BroadcastMessage(PUM_KILLNOTIFY, hwndMsg.wParam, 0);
break;
case MUM_NMAVATAR:
@@ -153,11 +89,10 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam)
// will post a message to the message queue which will set the hwnd value
// and then set the event...so create an event, call this function and then wait on the event
// when the event is signalled, the hwnd will be valid
-void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd);
void InitMessagePump()
{
- WNDCLASS popup_win_class = {0};
+ WNDCLASS popup_win_class = { 0 };
popup_win_class.lpfnWndProc = PopupWindowProc;
popup_win_class.hInstance = hInst;
popup_win_class.lpszClassName = POP_WIN_CLASS;
@@ -172,6 +107,7 @@ void InitMessagePump()
CloseHandle(hMPEvent);
}
-void DeinitMessagePump() {
+void DeinitMessagePump()
+{
PostMPMessage(WM_QUIT, 0, 0);
}
diff --git a/plugins/YAPP/src/message_pump.h b/plugins/YAPP/src/message_pump.h
index 6acb371080..fc3d889a0a 100644
--- a/plugins/YAPP/src/message_pump.h
+++ b/plugins/YAPP/src/message_pump.h
@@ -40,7 +40,6 @@ struct PopupData
// will post a message to the message queue which will set the hwnd value
// and then set the event...so create an event, call this function and then wait on the event
// when the event is signalled, the hwnd will be valid
-void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd);
void InitMessagePump();
void DeinitMessagePump();
diff --git a/plugins/YAPP/src/notify_imp.cpp b/plugins/YAPP/src/notify_imp.cpp
index 0be4fbd15f..32298027df 100644
--- a/plugins/YAPP/src/notify_imp.cpp
+++ b/plugins/YAPP/src/notify_imp.cpp
@@ -92,8 +92,7 @@ INT_PTR CALLBACK DlgProcPopups(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
int NotifyOptionsInitialize(WPARAM wParam,LPARAM lParam)
{
- OPTIONSDIALOGPAGE odp = {0};
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NOTIFY);
odp.pszTitle = LPGEN("YAPP Popups");
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp
index 08e3dfce8c..497bbc4b18 100644
--- a/plugins/YAPP/src/options.cpp
+++ b/plugins/YAPP/src/options.cpp
@@ -111,8 +111,8 @@ void ShowExamplePopups() {
}
}
-static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
+static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
switch ( msg ) {
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
@@ -138,7 +138,8 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (ServiceExists(MS_AV_DRAWAVATAR)) {
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left avatar"));
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right avatar"));
- } else {
+ }
+ else {
HWND hw = GetDlgItem(hwndDlg, IDC_CMB_AV);
EnableWindow(hw, FALSE);
hw = GetDlgItem(hwndDlg, IDC_SPIN_AVSIZE);
@@ -206,12 +207,16 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
HWND hw = GetDlgItem(hwndDlg, IDC_ED_TIMEOUT);
EnableWindow(hw, FALSE);
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, 7, FALSE);
- } else {
+ }
+ else {
CheckDlgButton(hwndDlg, IDC_RAD_TIMEOUT, TRUE);
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, options.default_timeout, FALSE);
}
- if (options.right_icon) CheckDlgButton(hwndDlg, IDC_RAD_RIGHTICON, TRUE);
- else CheckDlgButton(hwndDlg, IDC_RAD_LEFTICON, TRUE);
+
+ if (options.right_icon)
+ CheckDlgButton(hwndDlg, IDC_RAD_RIGHTICON, TRUE);
+ else
+ CheckDlgButton(hwndDlg, IDC_RAD_LEFTICON, TRUE);
if (ServiceExists(MS_AV_DRAWAVATAR)) {
switch(options.av_layout) {
@@ -219,7 +224,8 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case PAV_RIGHT: CheckDlgButton(hwndDlg, IDC_RAD_RIGHTAV, TRUE); break;
case PAV_LEFT: CheckDlgButton(hwndDlg, IDC_RAD_LEFTAV, TRUE); break;
}
- } else {
+ }
+ else {
CheckDlgButton(hwndDlg, IDC_RAD_NOAV, TRUE);
HWND hw = GetDlgItem(hwndDlg, IDC_RAD_RIGHTAV);
EnableWindow(hw, FALSE);
@@ -255,16 +261,16 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
return FALSE;
case WM_COMMAND:
- if ( HIWORD( wParam ) == CBN_SELCHANGE)
+ if ( HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus())
+ else if ( HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- else if ( HIWORD( wParam ) == BN_CLICKED ) {
+ else if ( HIWORD(wParam) == BN_CLICKED ) {
if (LOWORD(wParam) == IDC_BTN_PREVIEW)
ShowExamplePopups();
else {
HWND hw = GetDlgItem(hwndDlg, IDC_ED_TIMEOUT);
- switch( LOWORD( wParam )) {
+ switch( LOWORD(wParam)) {
case IDC_RAD_NOTIMEOUT:
EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_RAD_TIMEOUT));
break;
@@ -283,7 +289,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case LVN_ITEMCHANGED:
NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
}
}
@@ -367,7 +373,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
return FALSE;
case WM_COMMAND:
- if ( LOWORD(wParam) == IDC_LST_CLASSES && HIWORD( wParam ) == LBN_SELCHANGE) {
+ if ( LOWORD(wParam) == IDC_LST_CLASSES && HIWORD(wParam) == LBN_SELCHANGE) {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PREVIEW), index != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_COL_TEXT), index != -1);
@@ -383,7 +389,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TIMEOUT), index != -1 && IsDlgButtonChecked(hwndDlg, IDC_CHK_TIMEOUT));
return TRUE;
}
- if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ if ( HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
if (index != -1) {
int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
@@ -407,17 +413,17 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
else arNewClasses[i]->iSeconds = -1;
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, arNewClasses[i]->iSeconds, TRUE);
}
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
case IDC_COL_TEXT:
arNewClasses[i]->colorText = SendDlgItemMessage(hwndDlg, IDC_COL_TEXT, CPM_GETCOLOUR, 0, 0);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
case IDC_COL_BG:
arNewClasses[i]->colorBack = SendDlgItemMessage(hwndDlg, IDC_COL_BG, CPM_GETCOLOUR, 0, 0);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
break;
case IDC_BTN_PREVIEW:
@@ -428,7 +434,8 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
d.pwszTitle = L"Preview";
d.pwszText = L"The quick brown fox jumps over the lazy dog.";
CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
- } else {
+ }
+ else {
POPUPCLASS pc = *arNewClasses[i];
pc.PluginWindowProc = 0;
POPUPDATACLASS d = {sizeof(d), pc.pszName};
@@ -443,7 +450,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
arClasses = arNewClasses;
char setting[256];
for (int i = 0; i < arClasses.getCount(); i++) {
@@ -483,7 +490,6 @@ int OptInit(WPARAM wParam, LPARAM lParam)
odp.pszTab = LPGEN("Classes");
odp.pfnDlgProc = DlgProcOptsClasses;
Options_AddPage(wParam, &odp);
-
return 0;
}
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp
index abb3ba2010..3112f17459 100644
--- a/plugins/YAPP/src/popwin.cpp
+++ b/plugins/YAPP/src/popwin.cpp
@@ -79,13 +79,11 @@ void AddWindowToStack(HWND hwnd) {
RECT wa_rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &wa_rect, 0);
- if (options.use_mim_monitor)
- {
+ if (options.use_mim_monitor) {
RECT clr;
GetWindowRect((HWND)CallService(MS_CLUI_GETHWND, 0, 0), &clr);
HMONITOR hMonitor = MonitorFromRect(&clr, MONITOR_DEFAULTTONEAREST);
- if (hMonitor)
- {
+ if (hMonitor) {
MONITORINFO mi;
mi.cbSize = sizeof(mi);
if (GetMonitorInfo(hMonitor, &mi))
@@ -93,41 +91,40 @@ void AddWindowToStack(HWND hwnd) {
}
}
- switch (options.animate)
- {
- case ANIMATE_NO:
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- pop_start_x = wa_rect.right - options.win_width - 1;
- else
- pop_start_x = wa_rect.left + 1;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
- pop_start_y = wa_rect.bottom;
- else
- pop_start_y = wa_rect.top + 1;
- break;
- case ANIMATE_HORZ:
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- pop_start_x = wa_rect.right;
- else
- pop_start_x = wa_rect.left - options.win_width;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
- pop_start_y = wa_rect.bottom;
- else
- pop_start_y = wa_rect.top + 1;
- break;
- case ANIMATE_VERT:
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- pop_start_x = wa_rect.right - options.win_width - 1;
- else
- pop_start_x = wa_rect.left + 1;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
- pop_start_y = wa_rect.bottom;
- else
- pop_start_y = wa_rect.top - height + 1;
- break;
+ switch (options.animate) {
+ case ANIMATE_NO:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right - options.win_width - 1;
+ else
+ pop_start_x = wa_rect.left + 1;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top + 1;
+ break;
+ case ANIMATE_HORZ:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right;
+ else
+ pop_start_x = wa_rect.left - options.win_width;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top + 1;
+ break;
+ case ANIMATE_VERT:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right - options.win_width - 1;
+ else
+ pop_start_x = wa_rect.left + 1;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top - height + 1;
+ break;
}
SetWindowPos(hwnd, 0, pop_start_x, pop_start_y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
@@ -159,9 +156,7 @@ void RemoveWindowFromStack(HWND hwnd)
// Если после удаления в стеке остались окна, то нужно провести сжатие:
// сдвинуть все окна к верхнему/нижнему краю экрана.
if (hwnd_stack_top)
- {
RepositionWindows();
- }
}
void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam)
@@ -244,16 +239,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pwd);
- if (pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1)) {
- // make a really long timeout - say 7 days? ;)
+ // make a really long timeout - say 7 days? ;)
+ if (pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1))
SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
- } else {
- if (pd->timeout == 0) {
- SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0);
- } else {
- SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
- }
- }
+ else if (pd->timeout == 0)
+ SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0);
+ else
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
AddWindowToStack(hwnd); // this updates our size
}
@@ -311,7 +303,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
PostMessage(hwnd, UM_DESTROYPOPUP, 0, 0);
}
return TRUE;
- } else if (wParam == ID_MOVETIMER) {
+ }
+
+ if (wParam == ID_MOVETIMER) {
RECT r;
GetWindowRect(hwnd, &r);
@@ -333,6 +327,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return TRUE;
}
break;
+
case WM_ERASEBKGND:
{
HDC hdc = (HDC) wParam;
@@ -364,9 +359,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SelectObject(hdc, hOldBrush);
SelectObject(hdc, hOldPen);
}
-
}
return TRUE;
+
case WM_PAINT:
{
RECT r;
@@ -388,7 +383,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (pwd->have_av) avr.right = avr.left + pwd->real_av_width;
else avr.right = avr.left + pwd->time_width;
r.left = avr.right;
- } else if (options.av_layout == PAV_RIGHT) {
+ }
+ else if (options.av_layout == PAV_RIGHT) {
avr.right = r.right - options.av_padding;
if (pwd->have_av && options.time_layout == PT_WITHAV) avr.left = avr.right - max(pwd->real_av_width, pwd->time_width);
else if (pwd->have_av) avr.left = avr.right - pwd->real_av_width;
@@ -432,7 +428,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (options.right_icon) {
iconx = r.right - (16 + options.padding);
textxmax -= 16 + options.padding;
- } else {
+ }
+ else {
iconx = r.left + options.padding;
textxmin += 16 + options.padding;
}
@@ -457,8 +454,6 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
textxmax -= pwd->time_width + options.padding;
DrawText(ps.hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &ttr, DT_VCENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
break;
- default:
- break;
}
}
@@ -535,11 +530,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
HRGN hRgn1;
RECT r;
- int v,h;
- int w=11;
+ int w = 11;
GetWindowRect(hwnd,&r);
- h=(r.right-r.left)>(w*2)?w:(r.right-r.left);
- v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top);
+ int h = (r.right-r.left) > (w*2)?w:(r.right-r.left);
+ int v = (r.bottom-r.top) > (w*2)?w:(r.bottom-r.top);
h=(h<v)?h:v;
hRgn1=CreateRoundRectRgn(0,0,(r.right-r.left) + 1,(r.bottom-r.top) + 1,h,h);
SetWindowRgn(hwnd,hRgn1,FALSE);
@@ -552,7 +546,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
pwd->new_x = (int)wParam;
pwd->new_y = (int)lParam;
SetTimer(hwnd, ID_MOVETIMER, 10, 0);
- } else {
+ }
+ else {
SetWindowPos(hwnd, 0, (int)wParam, (int)lParam, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
if (!IsWindowVisible(hwnd)) {
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
@@ -569,15 +564,16 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
case PUM_GETCONTACT:
{
- HANDLE *phContact = (HANDLE *)wParam;
+ HANDLE *phContact = (HANDLE*)wParam;
*phContact = pd->hContact;
- if (lParam) SetEvent((HANDLE)lParam);
+ if (lParam)
+ SetEvent((HANDLE)lParam);
}
return TRUE;
case PUM_GETHEIGHT:
{
- int *pHeight = (int *)wParam;
+ int *pHeight = (int*)wParam;
HDC hdc = GetDC(hwnd);
SIZE size;
HFONT hOldFont = (HFONT)GetCurrentObject(hdc, OBJ_FONT);
@@ -675,16 +671,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
pwd->pd = pd = (PopupData *)lParam;
- if (pd->timeout != -1) {
- if (pd->timeout == 0) {
- SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0);
- } else {
- SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
- }
- } else {
- // make a really long timeout - say 7 days? ;)
+ // make a really long timeout - say 7 days? ;)
+ if (pd->timeout == -1)
SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
- }
+ else if (pd->timeout == 0)
+ SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0);
+ else
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
@@ -714,8 +707,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
}
-
return TRUE;
+
case PUM_KILLNOTIFY:
if (pwd->hNotify != (HANDLE)wParam)
return TRUE;