X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bcf1fa6bb46c38751072a1b5294bbd803ceb657e..520e470fdd0daef09c77938db642e4583933c90d:/src/gtk1/accel.cpp?ds=sidebyside diff --git a/src/gtk1/accel.cpp b/src/gtk1/accel.cpp index 08b5436b34..52949c26ea 100644 --- a/src/gtk1/accel.cpp +++ b/src/gtk1/accel.cpp @@ -13,6 +13,8 @@ #include "wx/accel.h" +#include + //----------------------------------------------------------------------------- // wxAcceleratorTable //----------------------------------------------------------------------------- @@ -39,7 +41,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable,wxObject) wxAcceleratorTable::wxAcceleratorTable() { - m_refData = new wxAccelRefData(); } wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) @@ -47,8 +48,11 @@ wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) m_refData = new wxAccelRefData(); for (int i = 0; i < n; i++) { - M_ACCELDATA->m_accels.Append( (wxObject*) - new wxAcceleratorEntry( entries[n].GetFlags(), entries[n].GetKeyCode(), entries[n].GetCommand() ) ); + int flag = entries[i].GetFlags(); + int keycode = entries[i].GetKeyCode(); + int command = entries[i].GetCommand(); + if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); + M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) ); } } @@ -63,6 +67,8 @@ bool wxAcceleratorTable::Ok() const int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) { + if (!Ok()) return -1; + wxNode *node = M_ACCELDATA->m_accels.First(); while (node) {