From 531b4ef88b0e7f705c80272328d8588b916f9958 Mon Sep 17 00:00:00 2001
From: Andreas Bombe <aeb@debian.org>
Date: Mon, 11 Jun 2018 23:10:26 +0200
Subject: [PATCH] Revert "Migration to wxWidgets v3.11:"

This reverts commit e46d7f9735579d651664b6a1243d4b63a39bf109.
---
 src/AppFrame.cpp                   |  8 ++++----
 src/CubicSDR.cpp                   | 15 +--------------
 src/CubicSDR.h                     |  7 +++----
 src/ui/UITestCanvas.cpp            |  4 ++--
 src/ui/UITestCanvas.h              |  2 +-
 src/ui/UITestContext.cpp           |  4 ++--
 src/ui/UITestContext.h             |  2 +-
 src/util/GLExt.cpp                 |  3 +--
 src/visual/GainCanvas.cpp          |  4 ++--
 src/visual/GainCanvas.h            |  2 +-
 src/visual/InteractiveCanvas.cpp   |  6 +++---
 src/visual/InteractiveCanvas.h     |  2 +-
 src/visual/MeterCanvas.cpp         |  4 ++--
 src/visual/MeterCanvas.h           |  2 +-
 src/visual/MeterContext.cpp        |  4 ++--
 src/visual/MeterContext.h          |  2 +-
 src/visual/ModeSelectorCanvas.cpp  |  4 ++--
 src/visual/ModeSelectorCanvas.h    |  2 +-
 src/visual/ModeSelectorContext.cpp |  4 ++--
 src/visual/ModeSelectorContext.h   |  2 +-
 src/visual/PrimaryGLContext.cpp    |  7 ++-----
 src/visual/PrimaryGLContext.h      |  2 +-
 src/visual/ScopeCanvas.cpp         |  4 ++--
 src/visual/ScopeCanvas.h           |  2 +-
 src/visual/ScopeContext.cpp        |  4 ++--
 src/visual/ScopeContext.h          |  2 +-
 src/visual/SpectrumCanvas.cpp      |  4 ++--
 src/visual/SpectrumCanvas.h        |  2 +-
 src/visual/TuningCanvas.cpp        |  5 +++--
 src/visual/TuningCanvas.h          |  2 +-
 src/visual/TuningContext.cpp       |  4 ++--
 src/visual/TuningContext.h         |  2 +-
 src/visual/WaterfallCanvas.cpp     |  5 +++--
 src/visual/WaterfallCanvas.h       |  2 +-
 34 files changed, 57 insertions(+), 73 deletions(-)

--- a/src/AppFrame.cpp
+++ b/src/AppFrame.cpp
@@ -88,10 +88,10 @@ AppFrame::AppFrame() :
     wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL);
     wxBoxSizer *demodTunerTray = new wxBoxSizer(wxHORIZONTAL);
 
-    // OpenGL settings:
-    //deprecated format: std::vector<int> attribList = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
-    wxGLAttributes attribList;
-    attribList.PlatformDefaults().RGBA().MinRGBA(8, 8, 8, 8).DoubleBuffer().EndList();
+    std::vector<int> attribList = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
+    //wxGLAttributes attribList;
+    //attribList.PlatformDefaults().RGBA().DoubleBuffer().EndList();
+    //attribList.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(16).EndList();
 
     mainSplitter = new wxSplitterWindow( this, wxID_MAIN_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
     mainSplitter->SetSashGravity(10.0f / 37.0f);
--- a/src/CubicSDR.cpp
+++ b/src/CubicSDR.cpp
@@ -206,14 +206,6 @@ CubicSDR::CubicSDR() : frequency(0), off
         shuttingDown.store(false);
         fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
         stoppedDev = nullptr;
-
-        //set OpenGL configuration:
-        m_glContextAttributes = new wxGLContextAttrs();
-        
-        wxGLContextAttrs glSettings;
-        glSettings.PlatformDefaults().EndList();
-
-        *m_glContextAttributes = glSettings;
 }
 
 bool CubicSDR::OnInit() {
@@ -503,18 +495,13 @@ int CubicSDR::OnExit() {
 PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) {
     PrimaryGLContext *glContext;
     if (!m_glContext) {
-        m_glContext = new PrimaryGLContext(canvas, NULL, GetContextAttributes());
+        m_glContext = new PrimaryGLContext(canvas, NULL);
     }
     glContext = m_glContext;
 
     return *glContext;
 }
 
-wxGLContextAttrs* CubicSDR::GetContextAttributes() {
-   
-    return m_glContextAttributes;
-}
-
 void CubicSDR::OnInitCmdLine(wxCmdLineParser& parser) {
     parser.SetDesc (commandLineInfo);
     parser.SetSwitchChars (wxT("-"));
--- a/src/CubicSDR.h
+++ b/src/CubicSDR.h
@@ -71,7 +71,6 @@ public:
     CubicSDR();
 
     PrimaryGLContext &GetContext(wxGLCanvas *canvas);
-    wxGLContextAttrs* GetContextAttributes();
 
     virtual bool OnInit();
     virtual int OnExit();
@@ -103,6 +102,8 @@ public:
     void setSampleRate(long long rate_in);
     long long getSampleRate();
 
+    void setDBOffset(int ofs);
+    int getDBOffset();
    
     std::vector<SDRDeviceInfo *> *getDevices();
     void setDevice(SDRDeviceInfo *dev, int waitMsForTermination);
@@ -188,8 +189,6 @@ private:
     AppFrame *appframe = nullptr;
     AppConfig config;
     PrimaryGLContext *m_glContext = nullptr;
-    wxGLContextAttrs *m_glContextAttributes = nullptr;
-
     std::vector<SDRDeviceInfo *> *devs = nullptr;
 
     DemodulatorMgr demodMgr;
--- a/src/ui/UITestCanvas.cpp
+++ b/src/ui/UITestCanvas.cpp
@@ -27,10 +27,10 @@ EVT_LEAVE_WINDOW(UITestCanvas::OnMouseLe
 EVT_ENTER_WINDOW(UITestCanvas::OnMouseEnterWindow)
 wxEND_EVENT_TABLE()
 
-UITestCanvas::UITestCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
+UITestCanvas::UITestCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
 InteractiveCanvas(parent, dispAttrs) {
     
-    glContext = new UITestContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new UITestContext(this, &wxGetApp().GetContext(this));
 }
 
 UITestCanvas::~UITestCanvas() {
--- a/src/ui/UITestCanvas.h
+++ b/src/ui/UITestCanvas.h
@@ -17,7 +17,7 @@
 
 class UITestCanvas: public InteractiveCanvas {
 public:
-    UITestCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    UITestCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     ~UITestCanvas();
     
 private:
--- a/src/ui/UITestContext.cpp
+++ b/src/ui/UITestContext.cpp
@@ -5,8 +5,8 @@
 #include "UITestCanvas.h"
 #include "ColorTheme.h"
 
-UITestContext::UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
-PrimaryGLContext(canvas, sharedContext, ctxAttrs), testMeter("TEST",0,100,50) {
+UITestContext::UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext) :
+PrimaryGLContext(canvas, sharedContext), testMeter("TEST",0,100,50) {
     
     testPanel.setPosition(0.0, 0.0);
     testPanel.setSize(1.0, 1.0);
--- a/src/ui/UITestContext.h
+++ b/src/ui/UITestContext.h
@@ -11,7 +11,7 @@ class UITestCanvas;
 
 class UITestContext: public PrimaryGLContext {
 public:
-    UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
+    UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext);
     
     void DrawBegin();
     void Draw();
--- a/src/util/GLExt.cpp
+++ b/src/util/GLExt.cpp
@@ -46,8 +46,7 @@ void initGLExtensions() {
 
 #ifdef _WIN32
     if (GLExtSupported("WGL_EXT_swap_control")) {
-        std::cout << "Initializing WGL swap control extensions.." << std::endl << std::flush;
-
+        std::cout << "Initializing WGL swap control extensions.." << std::endl;
         wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT");
         wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC) wglGetProcAddress("wglGetSwapIntervalEXT");
 
--- a/src/visual/GainCanvas.cpp
+++ b/src/visual/GainCanvas.cpp
@@ -29,10 +29,10 @@ EVT_ENTER_WINDOW(GainCanvas::OnMouseEnte
 EVT_MOUSEWHEEL(GainCanvas::OnMouseWheelMoved)
 wxEND_EVENT_TABLE()
 
-GainCanvas::GainCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
+GainCanvas::GainCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
         InteractiveCanvas(parent, dispAttrs) {
 
-    glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this));
     bgPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_UP);
     bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
 
--- a/src/visual/GainCanvas.h
+++ b/src/visual/GainCanvas.h
@@ -21,7 +21,7 @@
 
 class GainCanvas: public InteractiveCanvas {
 public:
-    GainCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    GainCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     ~GainCanvas();
 
     void setHelpTip(std::string tip);
--- a/src/visual/InteractiveCanvas.cpp
+++ b/src/visual/InteractiveCanvas.cpp
@@ -20,9 +20,9 @@
 
 #include <wx/numformatter.h>
 
-InteractiveCanvas::InteractiveCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
-        wxGLCanvas(parent, dispAttrs, wxID_ANY,  wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE), 
-        parent(parent), shiftDown(false), altDown(false), ctrlDown(false), centerFreq(0), bandwidth(0), lastBandwidth(0), isView(
+InteractiveCanvas::InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
+        wxGLCanvas(parent, wxID_ANY, dispAttrs.data(), wxDefaultPosition, wxDefaultSize,
+        wxFULL_REPAINT_ON_RESIZE), parent(parent), shiftDown(false), altDown(false), ctrlDown(false), centerFreq(0), bandwidth(0), lastBandwidth(0), isView(
         false) {
     mouseTracker.setTarget(this);
 }
--- a/src/visual/InteractiveCanvas.h
+++ b/src/visual/InteractiveCanvas.h
@@ -12,7 +12,7 @@
 
 class InteractiveCanvas: public wxGLCanvas {
 public:
-    InteractiveCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     virtual ~InteractiveCanvas();
 
     long long getFrequencyAt(float x);
--- a/src/visual/MeterCanvas.cpp
+++ b/src/visual/MeterCanvas.cpp
@@ -30,10 +30,10 @@ EVT_LEAVE_WINDOW(MeterCanvas::OnMouseLef
 EVT_ENTER_WINDOW(MeterCanvas::OnMouseEnterWindow)
 wxEND_EVENT_TABLE()
 
-MeterCanvas::MeterCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
+MeterCanvas::MeterCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
         InteractiveCanvas(parent, dispAttrs), level(0), level_min(0), level_max(1), inputValue(0), userInputValue(0), showUserInput(true) {
 
-    glContext = new MeterContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new MeterContext(this, &wxGetApp().GetContext(this));
 }
 
 MeterCanvas::~MeterCanvas() {
--- a/src/visual/MeterCanvas.h
+++ b/src/visual/MeterCanvas.h
@@ -17,7 +17,7 @@
 
 class MeterCanvas: public InteractiveCanvas {
 public:
-    MeterCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    MeterCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     ~MeterCanvas();
 
     void setLevel(float level_in);
--- a/src/visual/MeterContext.cpp
+++ b/src/visual/MeterContext.cpp
@@ -5,8 +5,8 @@
 #include "MeterCanvas.h"
 #include "ColorTheme.h"
 
-MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
-        PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
+MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext) :
+        PrimaryGLContext(canvas, sharedContext) {
 }
 
 void MeterContext::DrawBegin() {
--- a/src/visual/MeterContext.h
+++ b/src/visual/MeterContext.h
@@ -12,7 +12,7 @@ class MeterCanvas;
 
 class MeterContext: public PrimaryGLContext {
 public:
-    MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
+    MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext);
 
     void DrawBegin();
     void Draw(float r, float g, float b, float a, float level);
--- a/src/visual/ModeSelectorCanvas.cpp
+++ b/src/visual/ModeSelectorCanvas.cpp
@@ -27,10 +27,10 @@ EVT_LEAVE_WINDOW(ModeSelectorCanvas::OnM
 EVT_ENTER_WINDOW(ModeSelectorCanvas::OnMouseEnterWindow)
 wxEND_EVENT_TABLE()
 
-ModeSelectorCanvas::ModeSelectorCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
+ModeSelectorCanvas::ModeSelectorCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
 InteractiveCanvas(parent, dispAttrs), numChoices(0), currentSelection(-1), toggleMode(false), inputChanged(false), padX(4.0), padY(4.0), highlightOverride(false) {
 
-    glContext = new ModeSelectorContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new ModeSelectorContext(this, &wxGetApp().GetContext(this));
     
     highlightColor = RGBA4f(1.0,1.0,1.0,1.0);
 }
--- a/src/visual/ModeSelectorCanvas.h
+++ b/src/visual/ModeSelectorCanvas.h
@@ -27,7 +27,7 @@ public:
 
 class ModeSelectorCanvas: public InteractiveCanvas {
 public:
-    ModeSelectorCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    ModeSelectorCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     ~ModeSelectorCanvas();
 
     int getHoveredSelection();
--- a/src/visual/ModeSelectorContext.cpp
+++ b/src/visual/ModeSelectorContext.cpp
@@ -6,8 +6,8 @@
 #include "ColorTheme.h"
 
 
-ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
-        PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
+ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext) :
+        PrimaryGLContext(canvas, sharedContext) {
     glDisable(GL_CULL_FACE);
     glDisable(GL_DEPTH_TEST);
 
--- a/src/visual/ModeSelectorContext.h
+++ b/src/visual/ModeSelectorContext.h
@@ -12,7 +12,7 @@ class ModeSelectorCanvas;
 
 class ModeSelectorContext: public PrimaryGLContext {
 public:
-    ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
+    ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext);
 
     void DrawBegin();
     void DrawSelector(std::string label, int c, int cMax, bool on, float r, float g, float b, float a, float padx, float pady);
--- a/src/visual/PrimaryGLContext.cpp
+++ b/src/visual/PrimaryGLContext.cpp
@@ -50,11 +50,8 @@ void PrimaryGLContext::CheckGLError() {
     }
 }
 
-PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs* ctxAttrs) :
-        wxGLContext(canvas, sharedContext, (const wxGLContextAttrs*) ctxAttrs), hoverAlpha(1.0) {
-
-
-
+PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) :
+        wxGLContext(canvas, sharedContext), hoverAlpha(1.0) {
 //#ifndef __linux__
 //    SetCurrent(*canvas);
 //    // Pre-load fonts
--- a/src/visual/PrimaryGLContext.h
+++ b/src/visual/PrimaryGLContext.h
@@ -16,7 +16,7 @@
 
 class PrimaryGLContext: public wxGLContext {
 public:
-    PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs* ctxAttrs);
+    PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext);
 
     static wxString glGetwxString(GLenum name);
     static void CheckGLError();
--- a/src/visual/ScopeCanvas.cpp
+++ b/src/visual/ScopeCanvas.cpp
@@ -31,9 +31,9 @@ EVT_LEAVE_WINDOW(ScopeCanvas::OnMouseLef
 EVT_ENTER_WINDOW(ScopeCanvas::OnMouseEnterWindow)
 wxEND_EVENT_TABLE()
 
-ScopeCanvas::ScopeCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) : InteractiveCanvas(parent, dispAttrs), ppmMode(false), ctr(0), ctrTarget(0), dragAccel(0), helpTip("") {
+ScopeCanvas::ScopeCanvas(wxWindow *parent, std::vector<int> dispAttrs) : InteractiveCanvas(parent, dispAttrs), ppmMode(false), ctr(0), ctrTarget(0), dragAccel(0), helpTip("") {
 
-    glContext = new ScopeContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new ScopeContext(this, &wxGetApp().GetContext(this));
     inputData->set_max_num_items(2);
     bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_Y);
     bgPanel.setSize(1.0, 0.5f);
--- a/src/visual/ScopeCanvas.h
+++ b/src/visual/ScopeCanvas.h
@@ -18,7 +18,7 @@
 
 class ScopeCanvas: public InteractiveCanvas {
 public:
-    ScopeCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    ScopeCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     ~ScopeCanvas();
 
     //This is public because it is indeed forwarded from
--- a/src/visual/ScopeContext.cpp
+++ b/src/visual/ScopeContext.cpp
@@ -6,8 +6,8 @@
 #include "ScopeCanvas.h"
 #include "ColorTheme.h"
 
-ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
-        PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
+ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) :
+        PrimaryGLContext(canvas, sharedContext) {
     glDisable (GL_CULL_FACE);
     glDisable (GL_DEPTH_TEST);
 
--- a/src/visual/ScopeContext.h
+++ b/src/visual/ScopeContext.h
@@ -12,7 +12,7 @@ class ScopeCanvas;
 
 class ScopeContext: public PrimaryGLContext {
 public:
-    ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
+    ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext);
 
     void DrawBegin(bool clear=true);
     void DrawTunerTitles(bool ppmMode=false);
--- a/src/visual/SpectrumCanvas.cpp
+++ b/src/visual/SpectrumCanvas.cpp
@@ -32,10 +32,10 @@ EVT_RIGHT_DOWN(SpectrumCanvas::OnMouseRi
 EVT_RIGHT_UP(SpectrumCanvas::OnMouseRightReleased)
 wxEND_EVENT_TABLE()
 
-SpectrumCanvas::SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
+SpectrumCanvas::SpectrumCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
         InteractiveCanvas(parent, dispAttrs), waterfallCanvas(NULL) {
 
-    glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this));
 
     visualDataQueue->set_max_num_items(1);
             
--- a/src/visual/SpectrumCanvas.h
+++ b/src/visual/SpectrumCanvas.h
@@ -17,7 +17,7 @@ class WaterfallCanvas;
 
 class SpectrumCanvas: public InteractiveCanvas {
 public:
-    SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    SpectrumCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     ~SpectrumCanvas();
 
     //This is public because it is indeed forwarded from
--- a/src/visual/TuningCanvas.cpp
+++ b/src/visual/TuningCanvas.cpp
@@ -33,10 +33,10 @@ EVT_MOUSEWHEEL(TuningCanvas::OnMouseWhee
 //EVT_KEY_UP(TuningCanvas::OnKeyUp)
 wxEND_EVENT_TABLE()
 
-TuningCanvas::TuningCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
+TuningCanvas::TuningCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
         InteractiveCanvas(parent, dispAttrs), dragAccum(0), uxDown(0), top(false), bottom(false), freq(-1), bw(-1), center(-1), halfBand(false) {
 
-    glContext = new TuningContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new TuningContext(this, &wxGetApp().GetContext(this));
 
     hoverIndex = 0;
     downIndex = 0;
@@ -272,6 +272,7 @@ void TuningCanvas::OnIdle(wxIdleEvent &e
     if (mouseTracker.mouseInView() || changed()) {
         Refresh();
     }
+    event.RequestMore();
 }
 
 void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
--- a/src/visual/TuningCanvas.h
+++ b/src/visual/TuningCanvas.h
@@ -20,7 +20,7 @@ public:
     enum ActiveState {
         TUNING_HOVER_NONE, TUNING_HOVER_FREQ, TUNING_HOVER_BW, TUNING_HOVER_PPM, TUNING_HOVER_CENTER
     };
-    TuningCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    TuningCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     ~TuningCanvas();
 
     void setHelpTip(std::string tip);
--- a/src/visual/TuningContext.cpp
+++ b/src/visual/TuningContext.cpp
@@ -18,8 +18,8 @@ protected:
     }
 };
 
-TuningContext::TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
-        PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
+TuningContext::TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext) :
+        PrimaryGLContext(canvas, sharedContext) {
     glDisable(GL_CULL_FACE);
     glDisable(GL_DEPTH_TEST);
 
--- a/src/visual/TuningContext.h
+++ b/src/visual/TuningContext.h
@@ -12,7 +12,7 @@ class TuningCanvas;
 
 class TuningContext: public PrimaryGLContext {
 public:
-    TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
+    TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext);
 
     void DrawBegin();
     void Draw(float r, float g, float b, float a, float p1, float p2);
--- a/src/visual/WaterfallCanvas.cpp
+++ b/src/visual/WaterfallCanvas.cpp
@@ -39,11 +39,11 @@ EVT_ENTER_WINDOW(WaterfallCanvas::OnMous
 EVT_MOUSEWHEEL(WaterfallCanvas::OnMouseWheelMoved)
 wxEND_EVENT_TABLE()
 
-WaterfallCanvas::WaterfallCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
+WaterfallCanvas::WaterfallCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
         InteractiveCanvas(parent, dispAttrs), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), new_fft_size(0), waterfall_lines(0),
         dragOfs(0), mouseZoom(1), zoom(1), freqMoving(false), freqMove(0.0), hoverAlpha(1.0) {
 
-    glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
+    glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this));
     linesPerSecond = DEFAULT_WATERFALL_LPS;
     lpsIndex = 0;
     preBuf = false;
@@ -486,6 +486,7 @@ void WaterfallCanvas::OnKeyDown(wxKeyEve
 void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
     processInputQueue();
     Refresh();
+    event.RequestMore();
 }
 
 void WaterfallCanvas::updateHoverState() {
--- a/src/visual/WaterfallCanvas.h
+++ b/src/visual/WaterfallCanvas.h
@@ -21,7 +21,7 @@ public:
         WF_DRAG_NONE, WF_DRAG_BANDWIDTH_LEFT, WF_DRAG_BANDWIDTH_RIGHT, WF_DRAG_FREQUENCY, WF_DRAG_RANGE
     };
 
-    WaterfallCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
+    WaterfallCanvas(wxWindow *parent, std::vector<int> dispAttrs);
     void setup(unsigned int fft_size_in, int waterfall_lines_in);
     void setFFTSize(unsigned int fft_size_in);
     ~WaterfallCanvas();
