Fix MyDock

This commit is contained in:
daleclack 2023-05-18 14:48:49 +08:00
parent 9184ebcd3e
commit d8a1b4d8c8
1 changed files with 5 additions and 5 deletions

View File

@ -514,8 +514,9 @@ void MyDock::padset_clicked()
void MyDock::window_ctrl(Gtk::Window &window, bool on_dock) void MyDock::window_ctrl(Gtk::Window &window, bool on_dock)
{ {
// Get the GdkWindow object to get the state of a window // Get the GdkWindow object to get the state of a window
auto gdk_win = window.get_surface(); GtkWindow *c_win = window.gobj();
if (gdk_win) GdkSurface *surface = gtk_native_get_surface(GTK_NATIVE(c_win));
if (surface)
{ {
/* /*
The State of GdkWindow (GdkSurface for Gtk4) The State of GdkWindow (GdkSurface for Gtk4)
@ -523,14 +524,13 @@ void MyDock::window_ctrl(Gtk::Window &window, bool on_dock)
Gdk::Toplevel::State::MINIMIZED: The window is minimized Gdk::Toplevel::State::MINIMIZED: The window is minimized
the default mode for first launch the default mode for first launch
*/ */
auto toplevel = Glib::wrap(GDK_TOPLEVEL(gdk_win->gobj())); auto state = gdk_toplevel_get_state(GDK_TOPLEVEL(surface));
auto state = toplevel->get_state();
switch (state) switch (state)
{ {
// case Gdk::Toplevel::State::BELOW: // case Gdk::Toplevel::State::BELOW:
// window.present(); // window.present();
// break; // break;
case Gdk::Toplevel::State::MINIMIZED: case GDK_TOPLEVEL_STATE_MINIMIZED:
window.set_transient_for(*parent_win); window.set_transient_for(*parent_win);
window.unminimize(); window.unminimize();
break; break;