fixed input behavior with overlapping panels after closing

This commit is contained in:
vurtun 2015-08-13 18:12:25 +02:00
parent 6709dc8875
commit fd5a380a0d
3 changed files with 13 additions and 6 deletions

View File

@ -614,12 +614,12 @@ run_demo(struct demo_gui *gui)
{
const gui_char *file_items[] = {"Open", "Close", "Quit"};
const gui_char *edit_items[] = {"Copy", "Cut", "Delete", "Paste"};
gui_panel_row_begin(&layout, GUI_STATIC, 30, 2);
gui_panel_row_begin(&layout, GUI_STATIC, 25, 2);
gui_panel_row_push(&layout, config->font.width(config->font.userdata, "_FILE_", 6));
gui_panel_menu(&layout, "FILE", file_items, LEN(file_items), 30, 100,
gui_panel_menu(&layout, "FILE", file_items, LEN(file_items), 25, 100,
&state->file_open, gui_vec2(0,0));
gui_panel_row_push(&layout, config->font.width(config->font.userdata, "_EDIT_", 6));
gui_panel_menu(&layout, "EDIT", edit_items, LEN(edit_items), 30, 100,
gui_panel_menu(&layout, "EDIT", edit_items, LEN(edit_items), 25, 100,
&state->edit_open, gui_vec2(0,0));
gui_panel_row_end(&layout);
}

7
gui.c
View File

@ -3528,6 +3528,8 @@ gui_panel_end(struct gui_panel_layout *layout, struct gui_panel *panel)
/* panel is visible and not tab */
else gui_command_queue_finish(panel->queue, &panel->buffer);
}
if (layout->flags & GUI_PANEL_REMOVE_ROM)
layout->flags &= ~(gui_flags)GUI_PANEL_ROM;
panel->flags = layout->flags;
}
@ -5465,7 +5467,7 @@ gui_panel_popup_end(struct gui_panel_layout *parent, struct gui_panel_layout *po
gui_zero(&pan, sizeof(pan));
if (popup->flags & GUI_PANEL_HIDDEN) {
parent->flags &= (gui_flags)~GUI_PANEL_ROM;
parent->flags |= GUI_PANEL_REMOVE_ROM;
popup->flags &= ~(gui_flags)~GUI_PANEL_HIDDEN;
popup->valid = gui_true;
}
@ -5513,11 +5515,12 @@ gui_panel_popup_nonblock_begin(struct gui_panel_layout *parent,
gui_panel_popup_begin(parent, popup, GUI_POPUP_DYNAMIC, body, offset);
gui_panel_popup_close(popup);
popup->flags &= ~(gui_flags)GUI_PANEL_MINIMIZED;
parent->flags &= ~(gui_flags)GUI_PANEL_ROM;
} else if (!is_active && !*active) {
*active = is_active;
popup->flags |= GUI_PANEL_MINIMIZED;
return gui_false;
} else{
} else {
gui_panel_popup_begin(parent, popup, GUI_POPUP_DYNAMIC, body, offset);
popup->flags &= ~(gui_flags)GUI_PANEL_MINIMIZED;
}

6
gui.h
View File

@ -1778,7 +1778,10 @@ enum gui_panel_flags {
/* INTERNAL ONLY!: marks the panel as active, used by the panel stack */
GUI_PANEL_TAB = 0x20000,
/* INTERNAL ONLY!: Marks the panel as an subpanel of another panel(Groups/Tabs/Shelf)*/
GUI_PANEL_COMBO_MENU = 0x40000
GUI_PANEL_COMBO_MENU = 0x40000,
/* INTERNAL ONLY!: Marks the panel as an combo box or menu */
GUI_PANEL_REMOVE_ROM = 0x80000
/* INTERNAL ONLY!: removes the read only mode at the end of the panel */
};
struct gui_panel {
@ -2632,6 +2635,7 @@ enum gui_popup_type {
GUI_POPUP_STATIC, /* static fixed height non growing popup */
GUI_POPUP_DYNAMIC /* dynamically growing popup with maximum height */
};
gui_flags gui_panel_popup_begin(struct gui_panel_layout *parent, struct gui_panel_layout *popup,
enum gui_popup_type, struct gui_rect bounds, struct gui_vec2 offset);
/* this function adds a grouped subpanel into the parent panel