From c720aae51515907ae82ee02df80bd084f291d4b1 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 15 Mar 2022 06:42:06 +0100 Subject: Make hybrid Wayland/X11 platform. --- src/Fl_Window_Driver.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/Fl_Window_Driver.cxx') 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 -- cgit v1.2.3