Skip to content

Commit

Permalink
Fix some GTK deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Jul 6, 2024
1 parent 789cf1a commit 9062e9b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
17 changes: 9 additions & 8 deletions src/C4Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ C4Console::~C4Console()
if (hbmHalt) DeleteObject(hbmHalt);
if (hbmHalt2) DeleteObject(hbmHalt2);
#elif WITH_DEVELOPER_MODE
if (cursorDefault) gdk_cursor_unref(cursorDefault);
if (cursorWait) gdk_cursor_unref(cursorWait);
if (cursorDefault) g_object_unref(cursorDefault);
if (cursorWait) g_object_unref(cursorWait);
#endif // WITH_DEVELOPER_MODE / _WIN32
}

Expand Down Expand Up @@ -350,8 +350,9 @@ bool C4Console::Init(CStdApp *const app, const char *const title, const C4Rect &
return false;
}

cursorWait = gdk_cursor_new(GDK_WATCH);
cursorDefault = gdk_cursor_new(GDK_ARROW);
GdkDisplay *const display{gtk_widget_get_display(window)};
cursorWait = gdk_cursor_new_for_display(display, GDK_WATCH);
cursorDefault = gdk_cursor_new_for_display(display, GDK_ARROW);

// Calls InitGUI
UpdateHaltCtrls(true);
Expand Down Expand Up @@ -398,7 +399,7 @@ GtkWidget *C4Console::InitGUI()
gtk_box_pack_start(GTK_BOX(mode_hbox), btnModeDraw, FALSE, TRUE, 0);

lblCursor = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(lblCursor), 0.0, 0.5);
gtk_label_set_xalign(GTK_LABEL(lblCursor), 0.0f);

gtk_box_pack_start(GTK_BOX(top_hbox), lblCursor, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(top_hbox), play_hbox, FALSE, TRUE, 0);
Expand All @@ -416,9 +417,9 @@ GtkWidget *C4Console::InitGUI()
lblScript = gtk_label_new("Script: 0");
lblTime = gtk_label_new("00:00:00 (0 FPS)");

gtk_misc_set_alignment(GTK_MISC(lblFrame), 0.0, 0.5);
gtk_misc_set_alignment(GTK_MISC(lblScript), 0.0, 0.5);
gtk_misc_set_alignment(GTK_MISC(lblTime), 0.0, 0.5);
gtk_label_set_xalign(GTK_LABEL(lblFrame), 0.0f);
gtk_label_set_xalign(GTK_LABEL(lblScript), 0.0f);
gtk_label_set_xalign(GTK_LABEL(lblTime), 0.0f);

GtkWidget *sep1 = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
GtkWidget *sep2 = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
Expand Down
2 changes: 1 addition & 1 deletion src/C4EditCursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ bool C4EditCursor::DoContextMenu()
GtkLabel *label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(itemProperties)));
gtk_label_set_text(label, LoadResStrUtf8((Mode == C4CNS_ModeEdit) ? "IDS_CNS_PROPERTIES" : "IDS_CNS_TOOLS").getData());

gtk_menu_popup(GTK_MENU(menuContext), nullptr, nullptr, nullptr, nullptr, 3, 0);
gtk_menu_popup_at_pointer(GTK_MENU(menuContext), nullptr);
#endif
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions src/C4Viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,11 @@ bool C4Viewport::ScrollBarsByViewPosition()
gtk_adjustment_set_page_increment(adjustment, allocation.width);
gtk_adjustment_set_page_size(adjustment, allocation.width);
gtk_adjustment_set_value(adjustment, ViewX);
gtk_adjustment_changed(adjustment);

adjustment = gtk_range_get_adjustment(GTK_RANGE(pWindow->v_scrollbar));
gtk_adjustment_set_page_increment(adjustment, allocation.height);
gtk_adjustment_set_page_size(adjustment, allocation.height);
gtk_adjustment_set_value(adjustment, ViewY);
gtk_adjustment_changed(adjustment);

return true;
}
Expand Down

0 comments on commit 9062e9b

Please sign in to comment.