context
I am coding with others RefPerSys, a GPLv3+ project in C++17 on gitlab for GNU/Linux/x86-64/Debian/Sid. Its fltk-branch git branch is using FLTK 1.4, compiled from source code, with an Xorg display server.
I have C++ classes like (in file headfltk_rps.hh
):
class RpsGui_Window: public Fl_Double_Window
{
static std::set<RpsGui_Window*> _set_of_gui_windows_;
public:
virtual int handle(int);
protected:
Fl_Menu_Bar *guiwin_menubar;
std::string guiwin_label;
virtual void initialize_menubar(void) =0;
RpsGui_Window(int w, int h, const std::string& lab);
RpsGui_Window(int x, int y, int w, int h, const std::string& lab);
public:
virtual ~RpsGui_Window();
/// .... skipping irrelevant code
const std::string label_str(void) const {
return guiwin_label;
};
}; /// end class RpsGui_Window
class RpsGui_CommandWindow : public RpsGui_Window
{
static constexpr int right_menu_gap = 16;
static constexpr int menu_height = 20;
Fl_Pack* cmdwin_pack;
friend void rps_fltk_initialize(int &,char**);
virtual void initialize_menubar(void);
virtual void initialize_pack(void);
static void menu_dump_cb(Fl_Widget*, void*);
static void menu_exit_cb(Fl_Widget*, void*);
public:
RpsGui_CommandWindow(int w, int h, const std::string& lab);
RpsGui_CommandWindow(int x, int y, int w, int h, const std::string& lab);
virtual ~RpsGui_CommandWindow();
}; // end class RpsGui_CommandWindow
and I am debugging with old C++ macros outputting to std::cerr
(defined in refpersys.hh
lines 315 and following) such as below:
RPS_DEBUG_LOG(GUI, "RpsGui_CommandWindow::initialize_pack this:"
<< RpsGui_ShowWidget(this)
<< std::endl << "... cmdwin_pack:"
<< RpsGui_ShowWidget(cmdwin_pack));
Something is still wrong on the screen. See RefPerSys issue#33 for even more details (with a screenshot).
I would like to output the position of a given FLTK widget w.r.t. my X11 root window. FWIW xdpyinfo
is giving (with a lot of output skipped)
name of display: :0
version number: 11.0
vendor string: The X.Org Foundation
vendor release number: 12008000
X.Org version: 1.20.8
screen #0:
dimensions: 5360x1440 pixels (1418x381 millimeters)
resolution: 96x96 dots per inch
question
In other words, I want to code (for debugging purposes)
int RpsGui_Window::x_wrt_root() const;
as a member function returning the top left corner horizontal coordinate of this
w.r.t. X11 root window but I am not sure to know how to code that.
The call to XGetWindowAttributes
in function fl_handle
of FLTK (file src/Fl_x.cxx
, near line 2159) is probably related to my question, and so is the top_window_offset
member function of Fl_Widget