MCPcopy Create free account
hub / github.com/davisking/dlib / get_pos

Method get_pos

dlib/gui_core/gui_core_kernel_2.cpp:1876–1900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1874// ----------------------------------------------------------------------------------------
1875
1876 void base_window::
1877 get_pos (
1878 long& x_,
1879 long& y_
1880 )
1881 {
1882 using namespace gui_core_kernel_2_globals;
1883 auto_mutex a(wm);
1884 x_ = 0;
1885 y_ = 0;
1886 if (has_been_destroyed == true)
1887 return;
1888
1889 // we can't really trust the values we have for x and y because some window managers
1890 // will have reported bogus values back in the ConfigureNotify event. So just to be
1891 // on the safe side we will use XTranslateCoordinates()
1892 int rx, ry;
1893 Window desktop_window = DefaultRootWindow(x11_stuff.globals->disp);
1894 Window junk;
1895 XTranslateCoordinates(x11_stuff.globals->disp,x11_stuff.hwnd,desktop_window,0,0,&rx, &ry, &junk);
1896 x_ = rx;
1897 y_ = ry;
1898 x = rx;
1899 y = ry;
1900 }
1901
1902// ----------------------------------------------------------------------------------------
1903

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected