commit e77f09ec5d7dcf2b4f5d48e2d134b11e033c1502
parent 72cd6b7a18b7259436623bedfc71b5a2fb915a66
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 5 Jun 2016 21:25:07 -0700
fix windows build and slight refactoring
Diffstat:
5 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -194,11 +194,11 @@ bool Browser::onKeyDown(const int key, const int mods)
if(GetFocus() != m_list->handle())
return false;
- if(mods == MOD_CONTROL && key == 'A')
+ if(mods == CtrlModifier && key == 'A')
m_list->selectAll();
- else if(mods == (MOD_CONTROL | MOD_SHIFT) && key == 'A')
+ else if(mods == (CtrlModifier | ShiftModifier) && key == 'A')
m_list->unselectAll();
- else if(mods == MOD_CONTROL && key == 'C') {
+ else if(mods == CtrlModifier && key == 'C') {
vector<string> values;
for(const int index : m_list->selection(false))
diff --git a/src/browser.hpp b/src/browser.hpp
@@ -54,10 +54,10 @@ protected:
private:
enum Flag {
- UninstalledFlag = 1<<1,
- InstalledFlag = 1<<2,
- OutOfDateFlag = 1<<3,
- ObsoleteFlag = 1<<4,
+ UninstalledFlag = 1<<0,
+ InstalledFlag = 1<<1,
+ OutOfDateFlag = 1<<2,
+ ObsoleteFlag = 1<<3,
};
struct Entry {
diff --git a/src/dialog.cpp b/src/dialog.cpp
@@ -93,14 +93,17 @@ int Dialog::HandleKey(MSG *msg, accelerator_register_t *accel)
if(!dialog || !dialog->hasFocus())
return 0; // not our window
+ const int key = (int)msg->wParam;
int modifiers = 0;
+ if(GetAsyncKeyState(VK_MENU) & 0x8000)
+ modifiers |= AltModifier;
if(GetAsyncKeyState(VK_CONTROL) & 0x8000)
- modifiers |= MOD_CONTROL;
+ modifiers |= CtrlModifier;
if(GetAsyncKeyState(VK_SHIFT) & 0x8000)
- modifiers |= MOD_SHIFT;
+ modifiers |= ShiftModifier;
- if(msg->message == WM_KEYDOWN && dialog->onKeyDown(msg->wParam, modifiers))
+ if(msg->message == WM_KEYDOWN && dialog->onKeyDown(key, modifiers))
return 1;
else
return -1;
diff --git a/src/dialog.hpp b/src/dialog.hpp
@@ -97,8 +97,9 @@ public:
protected:
enum Modifiers {
- MOD_CONTROL = 1<<1,
- MOD_SHIFT = 1<<2,
+ AltModifier = 1<<0,
+ CtrlModifier = 1<<1,
+ ShiftModifier = 1<<2,
};
Dialog(int templateId);
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -181,11 +181,11 @@ bool Manager::onKeyDown(const int key, const int mods)
if(GetFocus() != m_list->handle())
return false;
- if(mods == MOD_CONTROL && key == 'A')
+ if(mods == CtrlModifier && key == 'A')
m_list->selectAll();
- else if(mods == (MOD_CONTROL | MOD_SHIFT) && key == 'A')
+ else if(mods == (CtrlModifier | ShiftModifier) && key == 'A')
m_list->unselectAll();
- else if(mods == MOD_CONTROL && key == 'C') {
+ else if(mods == CtrlModifier && key == 'C') {
vector<string> values;
for(const int index : m_list->selection(false))