I subclassed Gtk::Window and i want to move it to a position on the screen, but i cannot find any method to do this.
Was Gtk::Window::move removed in Gtk4 ? If yes, how can i move my window ?
I currently have this in the constructor of my window class :
this->set_title(_("Screenshot"));
// this is for getting the size of the screen, and calculating the center position
Glib::RefPtr<Glib::ObjectBase> first_monitor = Gdk::Display::get_default()->get_monitors()->get_object(0);
Gdk::Rectangle rect;
first_monitor->get_rectangle(rect);
int posx = (rect.get_width() - this->get_width()) / 2;
this->move(posx, -1)
this->show();
and it gives me following errors when compiling :
src/prefswindow.cpp: In constructor ‘PrefsWindow::PrefsWindow()’:
src/prefswindow.cpp:7:17: error: ‘using element_type = class Glib::ObjectBase {aka class Glib::ObjectBase}’ has no member named ‘get_rectangle’
first_monitor->get_rectangle(rect);
^~~~~~~~~~~~~
src/prefswindow.cpp:9:8: error: ‘class PrefsWindow’ has no member named ‘move’; did you mean ‘Role’?
this->move(posx, -1)
^~~~
Role
where class PrefsWindow inherits from Gtk::Window.
Thanks in advance !