Skip to content

Commit ccc8af9

Browse files
committed
Misc bug fixes
1 parent 26be33e commit ccc8af9

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

src/block-window.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void Block_Window::initialize() {
109109
_metatile_group->end();
110110
// Initialize window
111111
_window->box(OS_BG_BOX);
112-
_window->callback((Fl_Callback *)close_cb, this);
112+
_window->callback((Fl_Callback *)cancel_cb, this);
113113
_window->set_modal();
114114
// Initialize window's children
115115
_multiedit_heading->align(FL_ALIGN_RIGHT | FL_ALIGN_INSIDE);
@@ -221,13 +221,16 @@ void Block_Window::metatile(const Metatile *mt, bool has_collisions, bool bin_co
221221
void Block_Window::show(const Fl_Widget *p, bool show_priority) {
222222
initialize();
223223
refresh();
224+
Fl_Window *prev_grab = Fl::grab();
225+
Fl::grab(NULL);
224226
_show_priority = show_priority;
225227
int x = p->x() + (p->w() - _window->w()) / 2;
226228
int y = p->y() + (p->h() - _window->h()) / 2;
227229
_window->position(x, y);
228230
_ok_button->take_focus();
229231
_window->show();
230232
while (_window->shown()) { Fl::wait(); }
233+
Fl::grab(prev_grab);
231234
}
232235

233236
void Block_Window::draw_tile(uint8_t id, int x, int y, int s) const {

src/modal-dialog.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void Modal_Dialog::initialize() {
4949
// Initialize dialog
5050
_dialog->box(OS_BG_BOX);
5151
_dialog->resizable(NULL);
52-
_dialog->callback((Fl_Callback *)close_cb, this);
52+
_dialog->callback((Fl_Callback *)cancel_cb, this);
5353
_dialog->set_modal();
5454
// Initialize dialog's children
5555
_icon->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
@@ -150,6 +150,8 @@ void Modal_Dialog::refresh() {
150150
void Modal_Dialog::show(const Fl_Widget *p) {
151151
initialize();
152152
refresh();
153+
Fl_Window *prev_grab = Fl::grab();
154+
Fl::grab(NULL);
153155
int x = p->x() + (p->w() - _dialog->w()) / 2;
154156
int y = p->y() + (p->h() - _dialog->h()) / 2;
155157
_dialog->position(x, y);
@@ -170,6 +172,7 @@ void Modal_Dialog::show(const Fl_Widget *p) {
170172
}
171173
#endif
172174
while (_dialog->shown()) { Fl::wait(); }
175+
Fl::grab(prev_grab);
173176
}
174177

175178
void Modal_Dialog::close_cb(Fl_Widget *, Modal_Dialog *md) {

src/option-dialogs.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ void Option_Dialog::refresh() {
7777
void Option_Dialog::show(const Fl_Widget *p) {
7878
initialize();
7979
refresh();
80+
Fl_Window *prev_grab = Fl::grab();
81+
Fl::grab(NULL);
8082
int x = p->x() + (p->w() - _dialog->w()) / 2;
8183
int y = p->y() + (p->h() - _dialog->h()) / 2;
8284
_dialog->position(x, y);
8385
_ok_button->take_focus();
8486
_dialog->show();
8587
while (_dialog->shown()) { Fl::wait(); }
88+
Fl::grab(prev_grab);
8689
}
8790

8891
void Option_Dialog::close_cb(Fl_Widget *, Option_Dialog *od) {
@@ -1209,12 +1212,15 @@ void Print_Options_Dialog::refresh() {
12091212
void Print_Options_Dialog::show(const Fl_Widget *p) {
12101213
initialize();
12111214
refresh();
1215+
Fl_Window *prev_grab = Fl::grab();
1216+
Fl::grab(NULL);
12121217
int x = p->x() + (p->w() - _dialog->w()) / 2;
12131218
int y = p->y() + (p->h() - _dialog->h()) / 2;
12141219
_dialog->position(x, y);
12151220
_export_button->take_focus();
12161221
_dialog->show();
12171222
while (_dialog->shown()) { Fl::wait(); }
1223+
Fl::grab(prev_grab);
12181224
}
12191225

12201226
void Print_Options_Dialog::close_cb(Fl_Widget *, Print_Options_Dialog *pd) {

src/palette-window.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void Abstract_Palette_Window::initialize() {
6262
initial_setup();
6363
// Initialize window
6464
_window->box(OS_BG_BOX);
65-
_window->callback((Fl_Callback *)close_cb, this);
65+
_window->callback((Fl_Callback *)cancel_cb, this);
6666
_window->set_modal();
6767
// Initialize window's children
6868
_red_spinner->range(0, 31);
@@ -193,12 +193,15 @@ void Abstract_Palette_Window::update_color(Fl_Widget *wgt) {
193193
void Abstract_Palette_Window::show(const Fl_Widget *p) {
194194
initialize();
195195
refresh();
196+
Fl_Window *prev_grab = Fl::grab();
197+
Fl::grab(NULL);
196198
int x = p->x() + (p->w() - _window->w()) / 2;
197199
int y = p->y() + (p->h() - _window->h()) / 2;
198200
_window->position(x, y);
199201
_ok_button->take_focus();
200202
_window->show();
201203
while (_window->shown()) { Fl::wait(); }
204+
Fl::grab(prev_grab);
202205
}
203206

204207
void Abstract_Palette_Window::select(Color_Button *cb) {

src/roof-window.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void Roof_Window::initialize() {
120120
_tile_group->end();
121121
// Initialize window
122122
_window->box(OS_BG_BOX);
123-
_window->callback((Fl_Callback *)close_cb, this);
123+
_window->callback((Fl_Callback *)cancel_cb, this);
124124
_window->set_modal();
125125
// Initialize window's children
126126
_roof_group->box(OS_SPACER_THIN_DOWN_FRAME);
@@ -184,12 +184,15 @@ void Roof_Window::tileset(Tileset *t) {
184184
void Roof_Window::show(const Fl_Widget *p) {
185185
initialize();
186186
refresh();
187+
Fl_Window *prev_grab = Fl::grab();
188+
Fl::grab(NULL);
187189
int x = p->x() + (p->w() - _window->w()) / 2;
188190
int y = p->y() + (p->h() - _window->h()) / 2;
189191
_window->position(x, y);
190192
_ok_button->take_focus();
191193
_window->show();
192194
while (_window->shown()) { Fl::wait(); }
195+
Fl::grab(prev_grab);
193196
}
194197

195198
void Roof_Window::apply_modifications() {

src/tileset-window.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void Tileset_Window::initialize() {
135135
_tile_group->end();
136136
// Initialize window
137137
_window->box(OS_BG_BOX);
138-
_window->callback((Fl_Callback *)close_cb, this);
138+
_window->callback((Fl_Callback *)cancel_cb, this);
139139
_window->set_modal();
140140
// Initialize window's children
141141
_tileset_group->box(OS_SPACER_THIN_DOWN_FRAME);
@@ -237,13 +237,16 @@ void Tileset_Window::tileset(Tileset *t) {
237237
void Tileset_Window::show(const Fl_Widget *p, bool show_priority) {
238238
initialize();
239239
refresh();
240+
Fl_Window *prev_grab = Fl::grab();
241+
Fl::grab(NULL);
240242
_show_priority = show_priority;
241243
int x = p->x() + (p->w() - _window->w()) / 2;
242244
int y = p->y() + (p->h() - _window->h()) / 2;
243245
_window->position(x, y);
244246
_ok_button->take_focus();
245247
_window->show();
246248
while (_window->shown()) { Fl::wait(); }
249+
Fl::grab(prev_grab);
247250
}
248251

249252
void Tileset_Window::draw_tile(int x, int y, uint8_t id) const {

0 commit comments

Comments
 (0)