Skip to content

Commit

Permalink
Get basic brightness hotkey working
Browse files Browse the repository at this point in the history
  • Loading branch information
fsfod committed Apr 8, 2019
1 parent cb895be commit 33177af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 13 additions & 8 deletions 3RVX/OSD/BrightnessOSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "BrightnessOSD.h"

#include "../Controllers/Brightness/BrightnessController.h"
#include "../Controllers/Brightness/DDCBrightnessController.h"
#include "../DisplayManager.h"
#include "../HotkeyInfo.h"
#include "../Skin/OSDComponent.h"
Expand All @@ -21,7 +22,7 @@ _mWnd(L"3RVX-BrightnessOSD", L"3RVX-BrightnessOSD") {

OSD::InitMeterWnd(_mWnd);

_brightnessCtrl = new BrightnessController(
_brightnessCtrl = new DDCBrightnessController(
DisplayManager::Primary().Handle());
}

Expand All @@ -39,13 +40,17 @@ void BrightnessOSD::HideIcon() {

void BrightnessOSD::ProcessHotkeys(HotkeyInfo &hki) {
switch (hki.action) {
case HotkeyInfo::IncreaseBrightness:

break;

case HotkeyInfo::DecreaseBrightness:

break;
case HotkeyInfo::IncreaseBrightness: {
float newval = _brightnessCtrl->Brightness() + _stepsize;
if (newval > 1.0) break;
_brightnessCtrl->Brightness(newval);
}break;

case HotkeyInfo::DecreaseBrightness: {
float newval = _brightnessCtrl->Brightness() - _stepsize;
if (newval < 0.0) break;
_brightnessCtrl->Brightness(newval);
}break;

case HotkeyInfo::SetBrightness:

Expand Down
2 changes: 2 additions & 0 deletions 3RVX/OSD/BrightnessOSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ class BrightnessOSD : public OSD {

virtual LRESULT WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);

float _stepsize = 0.1f;
};

0 comments on commit 33177af

Please sign in to comment.