diff --git a/riscos/wimp.c b/riscos/wimp.c index fa667d1d6..e9188aeb9 100644 --- a/riscos/wimp.c +++ b/riscos/wimp.c @@ -849,3 +849,32 @@ bool ro_gui_wimp_check_window_furniture(wimp_w w, wimp_window_flags mask) { } return state.flags & mask; } + + +/** + * Open/move a window to the front of the window stack. + */ + +bool ro_gui_open_window_at_front(wimp_w w) { + wimp_window_state state; + os_error *error; + + state.w = w; + error = xwimp_get_window_state(&state); + if (error) { + LOG(("xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess)); + warn_user("WimpError", error->errmess); + return false; + } + + state.next = wimp_TOP; + error = xwimp_open_window((wimp_open*)&state); + if (error) { + LOG(("xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess)); + warn_user("WimpError", error->errmess); + return false; + } + return true; +} diff --git a/riscos/wimp.h b/riscos/wimp.h index a7777d28d..35a1ddc30 100644 --- a/riscos/wimp.h +++ b/riscos/wimp.h @@ -59,5 +59,6 @@ void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill, os_colour user_colour void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask, wimp_window_flags xor_mask); bool ro_gui_wimp_check_window_furniture(wimp_w w, wimp_window_flags mask); +bool ro_gui_open_window_at_front(wimp_w w); #endif