FLTK: Handle some bugs exhibited when using GNOME

This commit is contained in:
rdanbrook 2024-05-19 21:54:34 -06:00
parent 0ad4790576
commit fcb3976aaf
2 changed files with 8 additions and 3 deletions

View file

@ -437,12 +437,17 @@ int handle(int e) {
int NstWindow::handle(int e) {
switch (e) {
case FL_KEYDOWN: case FL_KEYUP:
inputmgr->event(Fl::event_key(), e == FL_KEYDOWN);
case FL_KEYDOWN: case FL_KEYUP: {
// GNOME has a bad habit of spamming keyup events while holding
// a button down, so Fl::get_key is required here.
int key = Fl::event_key();
bool down = Fl::get_key(key);
inputmgr->event(key, down);
if (jgm->is_loaded()) {
inputmgr->ui_events();
}
break;
}
}
return Fl_Double_Window::handle(e);
}
@ -550,6 +555,7 @@ void makenstwin(const char *name) {
nstwin = new NstWindow(rw, rh + UI_MBARHEIGHT, name);
nstwin->color(FL_BLACK);
nstwin->xclass("nestopia");
nstwin->resizable(nstwin);
nstwin->begin();

View file

@ -17,7 +17,6 @@ private:
public:
NstWindow(int w, int h, const char* t = 0) : Fl_Double_Window(w, h, t) { }
virtual ~NstWindow() { }
void resize(int x, int y, int w, int h);
};