diff options
Diffstat (limited to 'src/Fl_Window_Driver.cxx')
| -rw-r--r-- | src/Fl_Window_Driver.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index 23c66be7f..a9faa3211 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -258,6 +258,32 @@ void Fl_Window_Driver::menu_window_area(int &X, int &Y, int &W, int &H, int nscr scr_driver->screen_work_area(X, Y, W, H, nscreen); } +/** Returns the platform-specific reference of the given window, or NULL if that window isn't shown. + \version 1.4.0 */ +fl_uintptr_t Fl_Window_Driver::xid(const Fl_Window *win) { + Fl_X *flx = win->i; + return flx ? flx->xid : 0; +} + +/** Returns a pointer to the Fl_Window corresponding to the platform-specific reference \p xid of a shown window. + \version 1.4.0 */ +Fl_Window *Fl_Window_Driver::find(fl_uintptr_t xid) { + Fl_X *window; + for (Fl_X **pp = &Fl_X::first; (window = *pp); pp = &window->next) { + if (window->xid == xid) { + if (window != Fl_X::first && !Fl::modal()) { + // make this window be first to speed up searches + // this is not done if modal is true to avoid messing up modal stack + *pp = window->next; + window->next = Fl_X::first; + Fl_X::first = window; + } + return window->w; + } + } + return 0; +} + /** \} \endcond |
