From 03184de73de4adf8fcba09b8eac6b8c0a3f06aab Mon Sep 17 00:00:00 2001 From: Burt P Date: Tue, 25 Jul 2017 06:24:47 -0500 Subject: GTK3 updates * Use gtk_widget_get_window() instead of ->window cmake: * add option to build against gtk3 `-DHARDINFO_GTK3=1` * combine hardinfo-shell static library and hardinfo * disable guibench for gtk3 hardinfo/util.c: * widget_set_cursor() gtk3 changes * For now, the whole function tree_view_save_image() is disabled for gtk3. shell/shell.c: * add gtk_notebook_set_page() compatibility macro if not defined * shell_summary_add_item() fixes * Disable RANGE_GET_VALUE() RANGE_SET_VALUE() macros for GTK3. This is a nigtmare onion to try and peel. shell/callbacks.c: * gtk_about_dialog_set_name() -> gtk_about_dialog_set_program_name() after GTK+2.12. shell/loadgraph.c: * builds, but not yet functioning under gtk3 Signed-off-by: Burt P --- hardinfo/util.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'hardinfo/util.c') diff --git a/hardinfo/util.c b/hardinfo/util.c index d1329d24..cf6857f8 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -169,15 +169,30 @@ void remove_linefeed(gchar * str) void widget_set_cursor(GtkWidget * widget, GdkCursorType cursor_type) { GdkCursor *cursor; + GdkDisplay *display; +#if GTK_CHECK_VERSION(3, 0, 0) + GdkWindow *gdk_window; +#endif + + display = gtk_widget_get_display(widget); +#if GTK_CHECK_VERSION(3, 0, 0) + gdk_window = gtk_widget_get_window(widget); + if ((cursor = gdk_cursor_new_for_display(display, cursor_type))) { + gdk_window_set_cursor(gdk_window, cursor); + gdk_display_flush(display); + g_object_unref(cursor); + } +#else if ((cursor = gdk_cursor_new(cursor_type))) { gdk_window_set_cursor(GDK_WINDOW(widget->window), cursor); - gdk_display_flush(gtk_widget_get_display(widget)); + gdk_display_flush(display); gdk_cursor_unref(cursor); } +#endif while (gtk_events_pending()) - gtk_main_iteration(); + gtk_main_iteration(); } static gboolean __nonblock_cb(gpointer data) @@ -979,6 +994,9 @@ gint tree_view_get_visible_height(GtkTreeView * tv) void tree_view_save_image(gchar * filename) { +#if GTK_CHECK_VERSION(3, 0, 0) + /* TODO:GTK3 needs conversion for gtk3 */ +#else /* this is ridiculously complicated :/ why in the hell gtk+ makes this kind of thing so difficult? */ @@ -1074,6 +1092,7 @@ void tree_view_save_image(gchar * filename) g_free(tmp); gtk_widget_set_sensitive(widget, tv_enabled); +#endif } static gboolean __idle_free_do(gpointer ptr) -- cgit v1.2.3