attempt to port to gtk3

This commit is contained in:
Chris Lee 2021-01-04 21:55:12 +01:00
parent 06bcb3f2da
commit f9cb16a0f0
8 changed files with 281 additions and 318 deletions

View file

@ -6,7 +6,7 @@ Build-Depends: cmake,
debhelper (>= 9), debhelper (>= 9),
libcairo2-dev, libcairo2-dev,
libglib2.0-dev, libglib2.0-dev,
libgtk2.0-dev, libgtk-3-dev,
libimlib2-dev, libimlib2-dev,
libpango1.0-dev, libpango1.0-dev,
librsvg2-dev, librsvg2-dev,

View file

@ -7,7 +7,7 @@ pkg_check_modules( GLIB2 REQUIRED glib-2.0 )
pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 ) pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 )
pkg_check_modules( IMLIB2 REQUIRED imlib2 ) pkg_check_modules( IMLIB2 REQUIRED imlib2 )
pkg_check_modules( GTHREAD2 REQUIRED gthread-2.0 ) pkg_check_modules( GTHREAD2 REQUIRED gthread-2.0 )
pkg_check_modules( GTK2 REQUIRED gtk+-x11-2.0 ) pkg_check_modules( GTK3 REQUIRED gtk+-x11-3.0 )
pkg_check_modules( RSVG librsvg-2.0>=2.36.0 ) pkg_check_modules( RSVG librsvg-2.0>=2.36.0 )
include_directories( ../util include_directories( ../util
@ -16,7 +16,7 @@ include_directories( ../util
${GOBJECT2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS}
${IMLIB2_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS}
${GTHREAD2_INCLUDE_DIRS} ${GTHREAD2_INCLUDE_DIRS}
${GTK2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS}
${RSVG_INCLUDE_DIRS} ) ${RSVG_INCLUDE_DIRS} )
set(SOURCES ../util/common.c set(SOURCES ../util/common.c
@ -55,7 +55,7 @@ link_directories( ${X11_T2C_LIBRARY_DIRS}
${GOBJECT2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS}
${IMLIB2_LIBRARY_DIRS} ${IMLIB2_LIBRARY_DIRS}
${GTHREAD2_LIBRARY_DIRS} ${GTHREAD2_LIBRARY_DIRS}
${GTK2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS}
${RSVG_LIBRARY_DIRS} ) ${RSVG_LIBRARY_DIRS} )
add_executable( tint2conf ${SOURCES} ) add_executable( tint2conf ${SOURCES} )
target_link_libraries( tint2conf ${X11_T2C_LIBRARIES} target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
@ -63,13 +63,14 @@ target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
${GOBJECT2_LIBRARIES} ${GOBJECT2_LIBRARIES}
${IMLIB2_LIBRARIES} ${IMLIB2_LIBRARIES}
${GTHREAD2_LIBRARIES} ${GTHREAD2_LIBRARIES}
${GTK2_LIBRARIES} ${GTK3_LIBRARIES}
${RSVG_LIBRARIES} ) ${RSVG_LIBRARIES} )
add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" ) add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" )
add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" ) add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" )
add_definitions( -DGETTEXT_PACKAGE=\"tint2conf\" ) add_definitions( -DGETTEXT_PACKAGE=\"tint2conf\" )
set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -pthread -std=c99" ) add_definitions( -DDGLIB_DISABLE_DEPRECATION_WARNINGS=1 )
set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wpointer-arith -fno-strict-aliasing -pthread -std=c99 -Werror-implicit-function-declaration -Wno-deprecated -Wno-deprecated-declarations" )
set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" ) set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" )
add_subdirectory(po) add_subdirectory(po)

View file

@ -95,7 +95,7 @@ void create_background(GtkWidget *parent)
backgrounds = gtk_list_store_new(bgNumCols, backgrounds = gtk_list_store_new(bgNumCols,
GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF,
GDK_TYPE_COLOR, GDK_TYPE_COLOR,
GTK_TYPE_INT, GTK_TYPE_SHADOW_TYPE,
GDK_TYPE_COLOR, GDK_TYPE_COLOR,
GTK_TYPE_INT, GTK_TYPE_INT,
GTK_TYPE_INT, GTK_TYPE_INT,
@ -121,7 +121,6 @@ void create_background(GtkWidget *parent)
GtkWidget *table, *label, *button; GtkWidget *table, *label, *button;
int row, col; int row, col;
GtkTooltips *tooltips = gtk_tooltips_new();
table = gtk_table_new(1, 4, FALSE); table = gtk_table_new(1, 4, FALSE);
gtk_widget_show(table); gtk_widget_show(table);
@ -141,21 +140,21 @@ void create_background(GtkWidget *parent)
gtk_widget_show(current_background); gtk_widget_show(current_background);
gtk_table_attach(GTK_TABLE(table), current_background, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), current_background, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, current_background, _("Selects the background you would like to modify"), NULL); gtk_widget_set_tooltip_text(current_background, _("Selects the background you would like to modify"));
button = gtk_button_new_from_stock("gtk-add"); button = gtk_button_new_from_stock("gtk-add");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(background_duplicate), NULL); g_signal_connect(button, "clicked", G_CALLBACK(background_duplicate), NULL);
gtk_widget_show(button); gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, button, _("Creates a copy of the current background"), NULL); gtk_widget_set_tooltip_text(button, _("Creates a copy of the current background"));
button = gtk_button_new_from_stock("gtk-remove"); button = gtk_button_new_from_stock("gtk-remove");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(background_delete), NULL); g_signal_connect(button, "clicked", G_CALLBACK(background_delete), NULL);
gtk_widget_show(button); gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, button, _("Deletes the current background"), NULL); gtk_widget_set_tooltip_text(button, _("Deletes the current background"));
table = gtk_table_new(4, 4, FALSE); table = gtk_table_new(4, 4, FALSE);
gtk_widget_show(table); gtk_widget_show(table);
@ -175,7 +174,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_color); gtk_widget_show(background_fill_color);
gtk_table_attach(GTK_TABLE(table), background_fill_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_fill_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, background_fill_color, _("The fill color of the current background"), NULL); gtk_widget_set_tooltip_text(background_fill_color, _("The fill color of the current background"));
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Fill tint")); label = gtk_label_new(_("Fill tint"));
@ -188,7 +187,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_content_tint_weight); gtk_widget_show(background_fill_content_tint_weight);
gtk_table_attach(GTK_TABLE(table), background_fill_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_fill_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, background_fill_content_tint_weight, _("How much the border color should be tinted with the content color"), NULL); gtk_widget_set_tooltip_text(background_fill_content_tint_weight, _("How much the border color should be tinted with the content color"));
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Border color")); label = gtk_label_new(_("Border color"));
@ -202,7 +201,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_color); gtk_widget_show(background_border_color);
gtk_table_attach(GTK_TABLE(table), background_border_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_border_color, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, background_border_color, _("The border color of the current background"), NULL); gtk_widget_set_tooltip_text(background_border_color, _("The border color of the current background"));
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Border tint")); label = gtk_label_new(_("Border tint"));
@ -215,7 +214,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_content_tint_weight); gtk_widget_show(background_border_content_tint_weight);
gtk_table_attach(GTK_TABLE(table), background_border_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_border_content_tint_weight, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, background_border_content_tint_weight, _("How much the border color should be tinted with the content color"), NULL); gtk_widget_set_tooltip_text(background_border_content_tint_weight, _("How much the border color should be tinted with the content color"));
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Gradient")); label = gtk_label_new(_("Gradient"));
@ -241,10 +240,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_color_over); gtk_widget_show(background_fill_color_over);
gtk_table_attach(GTK_TABLE(table), background_fill_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_fill_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, gtk_widget_set_tooltip_text(background_fill_color_over,
background_fill_color_over, _("The fill color of the current background on mouse over"));
_("The fill color of the current background on mouse over"),
NULL);
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Border color (mouse over)")); label = gtk_label_new(_("Border color (mouse over)"));
@ -258,10 +255,9 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_color_over); gtk_widget_show(background_border_color_over);
gtk_table_attach(GTK_TABLE(table), background_border_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_border_color_over, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, gtk_widget_set_tooltip_text(
background_border_color_over, background_border_color_over,
_("The border color of the current background on mouse over"), _("The border color of the current background on mouse over"));
NULL);
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Gradient (mouse over)")); label = gtk_label_new(_("Gradient (mouse over)"));
@ -287,10 +283,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_fill_color_press); gtk_widget_show(background_fill_color_press);
gtk_table_attach(GTK_TABLE(table), background_fill_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_fill_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, gtk_widget_set_tooltip_text(background_fill_color_press,
background_fill_color_press, _("The fill color of the current background on mouse button press"));
_("The fill color of the current background on mouse button press"),
NULL);
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Border color (pressed)")); label = gtk_label_new(_("Border color (pressed)"));
@ -304,10 +298,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_color_press); gtk_widget_show(background_border_color_press);
gtk_table_attach(GTK_TABLE(table), background_border_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_border_color_press, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, gtk_widget_set_tooltip_text(background_border_color_press,
background_border_color_press, _("The border color of the current background on mouse button press"));
_("The border color of the current background on mouse button press"),
NULL);
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Gradient (pressed)")); label = gtk_label_new(_("Gradient (pressed)"));
@ -332,10 +324,8 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_border_width); gtk_widget_show(background_border_width);
gtk_table_attach(GTK_TABLE(table), background_border_width, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_border_width, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, gtk_widget_set_tooltip_text(background_border_width,
background_border_width, _("The width of the border of the current background, in pixels"));
_("The width of the border of the current background, in pixels"),
NULL);
row++, col = 2; row++, col = 2;
label = gtk_label_new(_("Corner radius")); label = gtk_label_new(_("Corner radius"));
@ -348,7 +338,7 @@ void create_background(GtkWidget *parent)
gtk_widget_show(background_corner_radius); gtk_widget_show(background_corner_radius);
gtk_table_attach(GTK_TABLE(table), background_corner_radius, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), background_corner_radius, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_tooltips_set_tip(tooltips, background_corner_radius, _("The corner radius of the current background"), NULL); gtk_widget_set_tooltip_text(background_corner_radius, _("The corner radius of the current background"));
row++; row++;
col = 2; col = 2;
@ -712,9 +702,8 @@ void background_update_image(int index)
g_boxed_free(GDK_TYPE_COLOR, fillColor); g_boxed_free(GDK_TYPE_COLOR, fillColor);
g_boxed_free(GDK_TYPE_COLOR, borderColor); g_boxed_free(GDK_TYPE_COLOR, borderColor);
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24); cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
cairo_t *cr = cairo_create(s);
cairo_t *cr = gdk_cairo_create(pixmap);
cairo_set_line_width(cr, b); cairo_set_line_width(cr, b);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
@ -744,13 +733,12 @@ void background_update_image(int index)
cairo_destroy(cr); cairo_destroy(cr);
cr = NULL; cr = NULL;
pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h); pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, w, h);
if (pixmap)
g_object_unref(pixmap);
gtk_list_store_set(backgrounds, &iter, bgColPixbuf, pixbuf, -1); gtk_list_store_set(backgrounds, &iter, bgColPixbuf, pixbuf, -1);
if (pixbuf) if (pixbuf)
g_object_unref(pixbuf); g_object_unref(pixbuf);
cairo_surface_destroy(s);
} }
void background_force_update() void background_force_update()

View file

@ -32,7 +32,7 @@ GtkWidget *create_gradient_combo()
void create_gradient(GtkWidget *parent) void create_gradient(GtkWidget *parent)
{ {
gradient_ids = gtk_list_store_new(grNumCols, GDK_TYPE_PIXBUF, GTK_TYPE_INT, GTK_TYPE_STRING); gradient_ids = gtk_list_store_new(grNumCols, GDK_TYPE_PIXBUF, G_TYPE_INT, G_TYPE_STRING);
gradients = NULL; gradients = NULL;
gradient_stop_ids = gtk_list_store_new(grStopNumCols, GDK_TYPE_PIXBUF); gradient_stop_ids = gtk_list_store_new(grStopNumCols, GDK_TYPE_PIXBUF);
@ -61,13 +61,13 @@ void create_gradient(GtkWidget *parent)
col++; col++;
button = gtk_button_new_from_stock("gtk-add"); button = gtk_button_new_from_stock("gtk-add");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_duplicate), NULL); g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_duplicate), NULL);
gtk_widget_show(button); gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
button = gtk_button_new_from_stock("gtk-remove"); button = gtk_button_new_from_stock("gtk-remove");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_delete), NULL); g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_delete), NULL);
gtk_widget_show(button); gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
@ -85,13 +85,13 @@ void create_gradient(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), label, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gradient_combo_type = gtk_combo_box_new_text(); gradient_combo_type = gtk_combo_box_text_new();
gtk_widget_show(gradient_combo_type); gtk_widget_show(gradient_combo_type);
gtk_table_attach(GTK_TABLE(table), gradient_combo_type, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), gradient_combo_type, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Vertical")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gradient_combo_type), _("Vertical"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Horizontal")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gradient_combo_type), _("Horizontal"));
gtk_combo_box_append_text(GTK_COMBO_BOX(gradient_combo_type), _("Radial")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gradient_combo_type), _("Radial"));
gtk_combo_box_set_active(GTK_COMBO_BOX(gradient_combo_type), 0); gtk_combo_box_set_active(GTK_COMBO_BOX(gradient_combo_type), 0);
row++, col = 2; row++, col = 2;
@ -142,13 +142,13 @@ void create_gradient(GtkWidget *parent)
col++; col++;
button = gtk_button_new_from_stock("gtk-add"); button = gtk_button_new_from_stock("gtk-add");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_duplicate), NULL); g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_duplicate), NULL);
gtk_widget_show(button); gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
button = gtk_button_new_from_stock("gtk-remove"); button = gtk_button_new_from_stock("gtk-remove");
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_delete), NULL); g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gradient_stop_delete), NULL);
gtk_widget_show(button); gtk_widget_show(button);
gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), button, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++; col++;
@ -327,18 +327,17 @@ void gradient_update_image(int index)
int w = 70; int w = 70;
int h = 30; int h = 30;
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24); cairo_surface_t *pixmap = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
cairo_t *cr = gdk_cairo_create(pixmap); cairo_t *cr = cairo_create(pixmap);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
cairo_rectangle(cr, 0, 0, w, h); cairo_rectangle(cr, 0, 0, w, h);
cairo_fill(cr); cairo_fill(cr);
gradient_draw(cr, g, w, h, FALSE); gradient_draw(cr, g, w, h, FALSE);
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h); GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(pixmap, 0, 0, w, h);
if (pixmap) cairo_surface_destroy(pixmap);
g_object_unref(pixmap);
GtkTreePath *path; GtkTreePath *path;
GtkTreeIter iter; GtkTreeIter iter;
@ -528,16 +527,14 @@ void gradient_stop_update_image(int index)
int w = 70; int w = 70;
int h = 30; int h = 30;
GdkPixmap *pixmap = gdk_pixmap_new(NULL, w, h, 24); cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
cairo_t *cr = cairo_create(s);
cairo_t *cr = gdk_cairo_create(pixmap);
cairo_set_source_rgba(cr, stop->color.rgb[0], stop->color.rgb[1], stop->color.rgb[2], stop->color.alpha); cairo_set_source_rgba(cr, stop->color.rgb[0], stop->color.rgb[1], stop->color.rgb[2], stop->color.alpha);
cairo_rectangle(cr, 0, 0, w, h); cairo_rectangle(cr, 0, 0, w, h);
cairo_fill(cr); cairo_fill(cr);
GdkPixbuf *pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, w, h); GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, w, h);
if (pixmap) cairo_surface_destroy(s);
g_object_unref(pixmap);
GtkTreePath *path; GtkTreePath *path;
GtkTreeIter iter; GtkTreeIter iter;

View file

@ -14,6 +14,27 @@
#define GETTEXT_PACKAGE "tint2conf" #define GETTEXT_PACKAGE "tint2conf"
#endif #endif
#ifndef GTK_TYPE_INT
#define GTK_TYPE_INT G_TYPE_INT
#endif
#ifndef GTK_TYPE_STRING
#define GTK_TYPE_STRING G_TYPE_STRING
#endif
#ifndef GTK_TYPE_BOOL
#define GTK_TYPE_BOOL G_TYPE_BOOLEAN
#endif
#ifndef GTK_TYPE_DOUBLE
#define GTK_TYPE_DOUBLE G_TYPE_DOUBLE
#endif
#define gtk_tooltips_set_tip(t, widget, txt, arg) gtk_widget_set_tooltip_text(widget, txt)
#define GTK_OBJECT(x) (x)
#define GTK_SIGNAL_FUNC G_CALLBACK
#define SNAPSHOT_TICK 190 #define SNAPSHOT_TICK 190
gboolean update_snapshot(gpointer ignored); gboolean update_snapshot(gpointer ignored);
void menuApply(); void menuApply();

File diff suppressed because it is too large Load diff

View file

@ -1855,10 +1855,12 @@ void add_entry(char *key, char *value)
} else if (strcmp(key, "launcher_apps_dir") == 0) { } else if (strcmp(key, "launcher_apps_dir") == 0) {
char *path = expand_tilde(value); char *path = expand_tilde(value);
if (gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs)) > 0) { int position = gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs));
gtk_entry_append_text(GTK_ENTRY(launcher_apps_dirs), ","); if (position > 0) {
gtk_editable_insert_text(GTK_EDITABLE(launcher_apps_dirs), ",", 1, &position);
} }
gtk_entry_append_text(GTK_ENTRY(launcher_apps_dirs), path); position = gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs));
gtk_editable_insert_text(GTK_EDITABLE(launcher_apps_dirs), path, strlen(path), &position);
free(path); free(path);
} else if (strcmp(key, "launcher_icon_theme") == 0) { } else if (strcmp(key, "launcher_icon_theme") == 0) {

View file

@ -22,7 +22,7 @@
/usr/include/librsvg-2.0 /usr/include/librsvg-2.0
/usr/include/gdk-pixbuf-2.0 /usr/include/gdk-pixbuf-2.0
/usr/include/startup-notification-1.0 /usr/include/startup-notification-1.0
/usr/include/gtk-2.0 /usr/include/gtk-3.0
/usr/lib/x86_64-linux-gnu/gtk-2.0/include /usr/lib/x86_64-linux-gnu/gtk-2.0/include
/usr/include/atk-1.0 /usr/include/atk-1.0
/usr/include/gio-unix-2.0 /usr/include/gio-unix-2.0