@ -6575,10 +6575,12 @@ namespace olc
private :
X11 : : Display * olc_Display = nullptr ;
X11 : : Window olc_WindowRoot ;
X11 : : Window olc_WindowParent ;
X11 : : Window olc_Window ;
X11 : : XVisualInfo * olc_VisualInfo ;
X11 : : Colormap olc_ColourMap ;
X11 : : XSetWindowAttributes olc_SetWindowAttribs ;
vi2d desiredPos { 30 , 30 } ;
public :
virtual olc : : rcode ApplicationStartUp ( ) override
@ -6718,9 +6720,21 @@ namespace olc
}
virtual void SetWindowPos ( vi2d pos ) override {
using namespace X11 ;
if ( ! ptrPGE - > IsFullscreen ( ) ) {
Window rootW , parentW ;
Window * childWindows ;
unsigned int children ;
XQueryTree ( olc_Display , olc_Window , & rootW , & olc_WindowParent , & childWindows , & children ) ;
if ( childWindows ! = nullptr ) XFree ( childWindows ) ;
XWindowAttributes gwa ;
XGetWindowAttributes ( olc_Display , olc_Window , & gwa ) ;
XWindowAttributes cwa ;
XGetWindowAttributes ( olc_Display , olc_WindowParent , & cwa ) ;
int diffX = gwa . x - cwa . x ; //The border is some defined size, and the window manager may be accounting for that when deciding window positions. If we take the difference of window between the two and subtract, we probably end up with a window at the right spot!
int diffY = gwa . y - cwa . y ;
XMapWindow ( olc_Display , olc_Window ) ;
XMoveWindow ( olc_Display , olc_Window , pos . x , pos . y ) ;
XMoveWindow ( olc_Display , olc_Window , pos . x - diffX , pos . y - diffY ) ;
}
}
virtual void SetWindowSize ( vi2d size ) override {
@ -6782,17 +6796,31 @@ namespace olc
XNextEvent ( olc_Display , & xev ) ;
if ( xev . type = = Expose )
{
Window rootW , parentW ;
Window * childWindows ;
unsigned int children ;
XQueryTree ( olc_Display , olc_Window , & rootW , & olc_WindowParent , & childWindows , & children ) ;
if ( childWindows ! = nullptr ) XFree ( childWindows ) ;
XWindowAttributes cwa ;
XGetWindowAttributes ( olc_Display , olc_WindowParent , & cwa ) ;
XWindowAttributes gwa ;
XGetWindowAttributes ( olc_Display , olc_Window , & gwa ) ;
ptrPGE - > olc_UpdateWindowPos ( gwa . x , gwa . y ) ;
ptrPGE - > olc_UpdateActualWindowPos ( gwa . x , gwa . y ) ;
ptrPGE - > olc_UpdateActualWindowPos ( cwa . x , c wa. y ) ;
ptrPGE - > olc_UpdateWindowSize ( gwa . width , gwa . height ) ;
}
else if ( xev . type = = ConfigureNotify )
{
Window rootW , parentW ;
Window * childWindows ;
unsigned int children ;
XQueryTree ( olc_Display , olc_Window , & rootW , & olc_WindowParent , & childWindows , & children ) ;
if ( childWindows ! = nullptr ) XFree ( childWindows ) ;
XWindowAttributes gwa ;
XGetWindowAttributes ( olc_Display , olc_WindowParent , & gwa ) ;
XConfigureEvent xce = xev . xconfigure ;
ptrPGE - > olc_UpdateWindowPos ( xce . x , xce . y ) ;
ptrPGE - > olc_UpdateActualWindowPos ( xce . x , xce . y ) ;
ptrPGE - > olc_UpdateActualWindowPos ( gwa . x , gwa . y ) ;
ptrPGE - > olc_UpdateWindowSize ( xce . width , xce . height ) ;
}
else if ( xev . type = = KeyPress )