summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-19 12:50:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-19 12:50:25 +0000
commit24a39515399e9555dd0e4ad72b7a22f9152b0adf (patch)
tree3577b4bf1442497133aa1646bdb3443950ed0cef /plugins/AutoShutdown
parent400d7bb71630f774dc9392cad37a22528958e2bc (diff)
end of zoo with WM_CONTEXTMENU's lParam
git-svn-id: http://svn.miranda-ng.org/main/trunk@13693 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AutoShutdown')
-rw-r--r--plugins/AutoShutdown/src/frame.cpp39
-rw-r--r--plugins/AutoShutdown/src/stdafx.h1
2 files changed, 21 insertions, 19 deletions
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index efcc1c4071..d64ec5c093 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -397,27 +397,28 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA
SendMessage(hwndFrame,M_UPDATE_COUNTDOWN,0,0);
return 0;
case WM_CONTEXTMENU:
- { HMENU hContextMenu;
- POINT pt;
- if (dat->flags&FWPDF_COUNTDOWNINVALID) return 0;
- POINTSTOPOINT(pt,MAKEPOINTS(lParam));
- if (pt.x==-1 && pt.y==-1) { /* invoked by keyboard */
- RECT rc;
- /* position in middle above rect */
- if (!GetWindowRect(hwndFrame, &rc)) return 0;
- pt.x=rc.left+((int)(rc.right-rc.left)/2);
- pt.y=rc.top+((int)(rc.bottom-rc.top)/2);
- }
- hContextMenu=CreatePopupMenu();
- if (hContextMenu != NULL) {
- AppendMenu(hContextMenu,MF_STRING,MENUITEM_PAUSECOUNTDOWN,(dat->flags&FWPDF_PAUSED)?TranslateT("&Unpause Countdown"):TranslateT("&Pause Countdown"));
- SetMenuDefaultItem(hContextMenu,MENUITEM_PAUSECOUNTDOWN,FALSE);
- AppendMenu(hContextMenu,MF_STRING,MENUITEM_STOPCOUNTDOWN,TranslateT("&Cancel Countdown"));
- TrackPopupMenuEx(hContextMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_HORPOSANIMATION|TPM_VERPOSANIMATION|TPM_RIGHTBUTTON,pt.x,pt.y,hwndFrame,NULL);
- DestroyMenu(hContextMenu);
+ {
+ if (dat->flags & FWPDF_COUNTDOWNINVALID)
+ return 0;
+
+ POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ if (pt.x==-1 && pt.y==-1) { /* invoked by keyboard */
+ RECT rc;
+ /* position in middle above rect */
+ if (!GetWindowRect(hwndFrame, &rc)) return 0;
+ pt.x=rc.left+((int)(rc.right-rc.left)/2);
+ pt.y=rc.top+((int)(rc.bottom-rc.top)/2);
+ }
+ HMENU hContextMenu = CreatePopupMenu();
+ if (hContextMenu != NULL) {
+ AppendMenu(hContextMenu,MF_STRING,MENUITEM_PAUSECOUNTDOWN,(dat->flags&FWPDF_PAUSED)?TranslateT("&Unpause Countdown"):TranslateT("&Pause Countdown"));
+ SetMenuDefaultItem(hContextMenu,MENUITEM_PAUSECOUNTDOWN,FALSE);
+ AppendMenu(hContextMenu,MF_STRING,MENUITEM_STOPCOUNTDOWN,TranslateT("&Cancel Countdown"));
+ TrackPopupMenuEx(hContextMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_HORPOSANIMATION|TPM_VERPOSANIMATION|TPM_RIGHTBUTTON,pt.x,pt.y,hwndFrame,NULL);
+ DestroyMenu(hContextMenu);
+ }
}
return 0;
- }
case WM_LBUTTONDBLCLK:
if (!(dat->flags&FWPDF_COUNTDOWNINVALID))
SendMessage(hwndFrame,M_PAUSE_COUNTDOWN,0,0);
diff --git a/plugins/AutoShutdown/src/stdafx.h b/plugins/AutoShutdown/src/stdafx.h
index 03a39e306d..f557ed810f 100644
--- a/plugins/AutoShutdown/src/stdafx.h
+++ b/plugins/AutoShutdown/src/stdafx.h
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <time.h> /* for mktime(),time() */
#include <windows.h>
+#include <windowsx.h>
#include <Uxtheme.h>
#include <Shlwapi.h>
#include <PowrProf.h>