Hotfix patch for direct input on linux

This commit is contained in:
Charles J. Cliffe 2015-06-07 21:42:23 -04:00
parent 95ff1e9c36
commit 35af5748a0

View File

@ -5,7 +5,8 @@
#include <iomanip> #include <iomanip>
#include "CubicSDR.h" #include "CubicSDR.h"
wxBEGIN_EVENT_TABLE(FrequencyDialog, wxDialog) EVT_CHAR_HOOK(FrequencyDialog::OnChar) wxBEGIN_EVENT_TABLE(FrequencyDialog, wxDialog)
EVT_CHAR_HOOK(FrequencyDialog::OnChar)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstance *demod, const wxPoint & position, FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstance *demod, const wxPoint & position,
@ -98,7 +99,7 @@ long long FrequencyDialog::strToFrequency(std::string freqStr) {
} }
void FrequencyDialog::OnChar(wxKeyEvent& event) { void FrequencyDialog::OnChar(wxKeyEvent& event) {
wxChar c = event.GetKeyCode(); int c = event.GetKeyCode();
long long freq; long long freq;
switch (c) { switch (c) {
@ -125,7 +126,12 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
if (allowed.find_first_of(c) != std::string::npos || c == WXK_DELETE || c == WXK_BACK || c == WXK_NUMPAD_DECIMAL if (allowed.find_first_of(c) != std::string::npos || c == WXK_DELETE || c == WXK_BACK || c == WXK_NUMPAD_DECIMAL
|| (c >= WXK_NUMPAD0 && c <= WXK_NUMPAD9)) { || (c >= WXK_NUMPAD0 && c <= WXK_NUMPAD9)) {
#ifdef __linux__
dialogText->OnChar(event);
event.Skip();
#else
event.DoAllowNextEvent(); event.DoAllowNextEvent();
#endif
} else if (event.ControlDown() && c == 'V') { } else if (event.ControlDown() && c == 'V') {
// Alter clipboard contents to remove unwanted chars // Alter clipboard contents to remove unwanted chars
wxTheClipboard->Open(); wxTheClipboard->Open();