I am trying to use the bool onConfigureEvent(GdkEventConfigure* event, Widget widget)
to store/restore Window position. I needed this because when onDestroy() handler gets called (user pressed the X button) the X and Y positions are by default set to 0. However, it seems that event.x and event.y coordinates are taken without window decorations. Is there a way to fix this?
On 05-09-2022 21:06, Dejan Lekic wrote:
I am trying to use the
bool onConfigureEvent(GdkEventConfigure* event, Widget widget)
to store/restore Window position. I needed this because when onDestroy() handler gets called (user pressed the X button) the X and Y positions are by default set to 0. However, it seems that event.x and event.y coordinates are taken without window decorations. Is there a way to fix this?
I don't know it the gdk window includes the decorations, but you can try
this:
int x,y;
gdk_window_get_origin(event.window, &x, &y)
Hello this is Gulshan Negi
Well, you can obtain the window decorations by using the getwindow() method from the Gtk::Widget class to get the underlying GdkWindow and then use the getroot_origin() method from the GdkWindow class to obtain the position of the window, including the decorations.
Thanks