summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-10-11 21:34:59 +0300
committermonsta <[email protected]>2016-10-11 21:34:59 +0300
commit002845e5d9a1272b12dc493ea8b2426951069310 (patch)
tree1ca4315d3daa0078c8acf9385618af1bdbffd464
parent14e2a76353f603a520a1b005bbe862a6b12db18b (diff)
downloadlibmatekbd-002845e5d9a1272b12dc493ea8b2426951069310.tar.bz2
libmatekbd-002845e5d9a1272b12dc493ea8b2426951069310.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac41
-rw-r--r--libmatekbd.pc.in2
-rw-r--r--libmatekbd/Makefile.am2
-rw-r--r--libmatekbd/matekbd-indicator-config.c32
-rw-r--r--libmatekbd/matekbd-keyboard-drawing.c149
-rw-r--r--libmatekbd/matekbd-keyboard-drawing.h8
-rw-r--r--test/matekbd-indicator-test.c6
8 files changed, 10 insertions, 232 deletions
diff --git a/Makefile.am b/Makefile.am
index feb6959..7c04518 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@ SUBDIRS = libmatekbd $(TEST) po
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --with-gtk=$(GTK_API_VERSION)
+DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
DISTCLEANFILES = \
intltool-extract \
diff --git a/configure.ac b/configure.ac
index 3ee2291..a18efc3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl ***************************************************************************
dnl *** configure.in for libmatekbd ***
dnl ***************************************************************************
m4_define([libmatekbd_major_version], [1])
-m4_define([libmatekbd_minor_version], [16])
+m4_define([libmatekbd_minor_version], [17])
m4_define([libmatekbd_micro_version], [0])
m4_define([libmatekbd_version],[libmatekbd_major_version.libmatekbd_minor_version.libmatekbd_micro_version])
@@ -17,47 +17,16 @@ AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz check-news])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_CONFIG_MACRO_DIR(m4)
-dnl ----------------------------------------------------------------------------
-dnl GTK library version
-dnl ----------------------------------------------------------------------------
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
- [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
- esac],
- [with_gtk=2.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
- 2.0) GTK_API_VERSION=2.0
- GTK_REQUIRED=2.24
- GDK_REQUIRED=2.24
- ;;
- 3.0) GTK_API_VERSION=3.0
- GTK_REQUIRED=3.0.0
- GDK_REQUIRED=3.0
- ;;
-esac
-AC_SUBST([GTK_API_VERSION])
-
-dnl ***************************************************************************
-dnl *** Minimum library versions for libmatekbd ***
-dnl ***************************************************************************
GLIB_REQUIRED=2.36
GIO_REQUIRED=2.25.0
-
+GTK_REQUIRED=3.14.0
+GDK_REQUIRED=3.14.0
LIBXKLAVIER_REQUIRED=5.2
AC_SUBST([GIO_REQUIRED])
-AC_SUBST([GTK_API_VERSION])
-AC_SUBST([GTK_REQUIRED])
AC_SUBST([GDK_REQUIRED])
AC_SUBST([LIBXKLAVIER_REQUIRED])
-dnl ***************************************************************************
-
MATE_COMMON_INIT
MATE_COMPILE_WARNINGS
@@ -93,12 +62,12 @@ PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
-PKG_CHECK_MODULES(GDK, gdk-$GTK_API_VERSION >= $GDK_REQUIRED)
+PKG_CHECK_MODULES(GDK, gdk-3.0 >= $GDK_REQUIRED)
AC_SUBST(GDK_CFLAGS)
AC_SUBST(GDK_LIBS)
-PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gdk-x11-$GTK_API_VERSION >= $GDK_REQUIRED)
+PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED gdk-x11-3.0 >= $GDK_REQUIRED)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
diff --git a/libmatekbd.pc.in b/libmatekbd.pc.in
index cb6489f..76edc09 100644
--- a/libmatekbd.pc.in
+++ b/libmatekbd.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: libmatekbd
Description: MATE keyboard shared library
Version: @VERSION@
-Requires: gmodule-export-2.0 gdk-@GTK_API_VERSION@ >= @GDK_REQUIRED@ gio-2.0 >= @GIO_REQUIRED@ libxklavier >= @LIBXKLAVIER_REQUIRED@
+Requires: gmodule-export-2.0 gdk-3.0 >= @GDK_REQUIRED@ gio-2.0 >= @GIO_REQUIRED@ libxklavier >= @LIBXKLAVIER_REQUIRED@
Libs: -L${libdir} -lmatekbd
Cflags: -I${includedir}
diff --git a/libmatekbd/Makefile.am b/libmatekbd/Makefile.am
index 2062f73..185834d 100644
--- a/libmatekbd/Makefile.am
+++ b/libmatekbd/Makefile.am
@@ -118,7 +118,7 @@ introspection_sources = $(matekbdinc_HEADERS) \
$(libmatekbdui_la_SOURCES)
Matekbd-1.0.gir: libmatekbd.la libmatekbdui.la
-Matekbd_1_0_gir_INCLUDES = GObject-2.0 Gtk-$(GTK_API_VERSION) xlib-2.0 Xkl-1.0
+Matekbd_1_0_gir_INCLUDES = GObject-2.0 Gtk-3.0 xlib-2.0 Xkl-1.0
Matekbd_1_0_gir_CFLAGS = $(libmatekbdui_la_CFLAGS)
Matekbd_1_0_gir_LIBS = libmatekbd.la libmatekbdui.la
Matekbd_1_0_gir_FILES = $(introspection_sources)
diff --git a/libmatekbd/matekbd-indicator-config.c b/libmatekbd/matekbd-indicator-config.c
index 91f6179..bd2066d 100644
--- a/libmatekbd/matekbd-indicator-config.c
+++ b/libmatekbd/matekbd-indicator-config.c
@@ -61,7 +61,6 @@ matekbd_indicator_config_load_font (MatekbdIndicatorConfig * ind_config)
if (ind_config->font_family == NULL ||
ind_config->font_family[0] == '\0') {
PangoFontDescription *fd = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidgetPath *widget_path = gtk_widget_path_new ();
GtkStyleContext *context = gtk_style_context_new ();
@@ -77,25 +76,14 @@ matekbd_indicator_config_load_font (MatekbdIndicatorConfig * ind_config)
gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL,
GTK_STYLE_PROPERTY_FONT, &fd, NULL);
-#else
- GtkStyle *style =
- gtk_rc_get_style_by_paths (gtk_settings_get_default (),
- "*PanelWidget*",
- "*PanelWidget*",
- GTK_TYPE_LABEL);
- if (style != NULL)
- fd = style->font_desc;
-#endif
if (fd != NULL) {
ind_config->font_family =
g_strdup (pango_font_description_to_string(fd));
}
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (G_OBJECT (context));
gtk_widget_path_unref (widget_path);
-#endif
}
xkl_debug (150, "font: [%s]\n", ind_config->font_family);
@@ -110,7 +98,6 @@ matekbd_indicator_config_load_colors (MatekbdIndicatorConfig * ind_config)
if (ind_config->foreground_color == NULL ||
ind_config->foreground_color[0] == '\0') {
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidgetPath *widget_path = gtk_widget_path_new ();
GtkStyleContext *context = gtk_style_context_new ();
GdkRGBA fg_color;
@@ -135,21 +122,6 @@ matekbd_indicator_config_load_colors (MatekbdIndicatorConfig * ind_config)
g_object_unref (G_OBJECT (context));
gtk_widget_path_unref (widget_path);
-#else
- GtkStyle *style =
- gtk_rc_get_style_by_paths (gtk_settings_get_default (),
- "*PanelWidget*",
- "*PanelWidget*",
- GTK_TYPE_LABEL);
- if (style != NULL) {
- GdkColor fg_color = style->fg[GTK_STATE_NORMAL];
- ind_config->foreground_color =
- g_strdup_printf ("%g %g %g",
- ((double) fg_color.red) / 0xFFFF,
- ((double) fg_color.green) / 0xFFFF,
- ((double) fg_color.blue) / 0xFFFF);
- }
-#endif
}
ind_config->background_color =
@@ -203,11 +175,7 @@ matekbd_indicator_config_get_images_file (MatekbdIndicatorConfig *
if (icon_info != NULL) {
image_file =
g_strdup (gtk_icon_info_get_filename (icon_info));
-#if GTK_CHECK_VERSION (3, 8, 0)
g_object_unref (icon_info);
-#else
- gtk_icon_info_free (icon_info);
-#endif
}
return image_file;
diff --git a/libmatekbd/matekbd-keyboard-drawing.c b/libmatekbd/matekbd-keyboard-drawing.c
index e7d6846..da92f70 100644
--- a/libmatekbd/matekbd-keyboard-drawing.c
+++ b/libmatekbd/matekbd-keyboard-drawing.c
@@ -296,11 +296,7 @@ rounded_polygon (cairo_t * cr,
static void
draw_polygon (MatekbdKeyboardDrawingRenderContext * context,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA * fill_color,
-#else
- GdkColor * fill_color,
-#endif
gint xkb_x,
gint xkb_y, XkbPointRec * xkb_points, guint num_points,
gdouble radius)
@@ -316,11 +312,7 @@ draw_polygon (MatekbdKeyboardDrawingRenderContext * context,
filled = FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (context->cr, fill_color);
-#else
- gdk_cairo_set_source_color (context->cr, fill_color);
-#endif
points = g_new (GdkPoint, num_points);
@@ -376,20 +368,12 @@ curve_rectangle (cairo_t * cr,
static void
draw_curve_rectangle (cairo_t * cr,
gboolean filled,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA * fill_color,
-#else
- GdkColor * fill_color,
-#endif
gint x, gint y, gint width, gint height, gint radius)
{
curve_rectangle (cr, x, y, width, height, radius);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, fill_color);
-#else
- gdk_cairo_set_source_color (cr, fill_color);
-#endif
if (filled)
cairo_fill (cr);
@@ -400,11 +384,7 @@ draw_curve_rectangle (cairo_t * cr,
/* x, y, width, height are in the xkb coordinate system */
static void
draw_rectangle (MatekbdKeyboardDrawingRenderContext * context,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA * fill_color,
-#else
- GdkColor * fill_color,
-#endif
gint angle,
gint xkb_x, gint xkb_y, gint xkb_width, gint xkb_height,
gint radius)
@@ -459,11 +439,7 @@ draw_rectangle (MatekbdKeyboardDrawingRenderContext * context,
static void
draw_outline (MatekbdKeyboardDrawingRenderContext * context,
XkbOutlineRec * outline,
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA * color,
-#else
- GdkColor * color,
-#endif
gint angle, gint origin_x, gint origin_y)
{
#ifdef KBDRAW_DEBUG
@@ -518,98 +494,57 @@ draw_outline (MatekbdKeyboardDrawingRenderContext * context,
/* see PSColorDef in xkbprint */
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
parse_xkb_color_spec (gchar * colorspec, GdkRGBA * color)
-#else
-parse_xkb_color_spec (gchar * colorspec, GdkColor * color)
-#endif
{
glong level;
-#if GTK_CHECK_VERSION (3, 0, 0)
color->alpha = 1.0;
-#endif
+
if (g_ascii_strcasecmp (colorspec, "black") == 0) {
color->red = 0;
color->green = 0;
color->blue = 0;
} else if (g_ascii_strcasecmp (colorspec, "white") == 0) {
-#if GTK_CHECK_VERSION (3, 0, 0)
color->red = 1.0;
color->green = 1.0;
color->blue = 1.0;
-#else
- color->red = 0xFFFF;
- color->green = 0xFFFF;
- color->blue = 0xFFFF;
-#endif
} else if (g_ascii_strncasecmp (colorspec, "grey", 4) == 0 ||
g_ascii_strncasecmp (colorspec, "gray", 4) == 0) {
level = strtol (colorspec + 4, NULL, 10);
-#if GTK_CHECK_VERSION (3, 0, 0)
color->red = 1.0 - 1.0 * level / 100.0;
color->green = 1.0 - 1.0 * level / 100.0;
color->blue = 1.0 - 1.0 * level / 100.0;
-#else
- color->red = 0xFFFF - 0xFFFF * level / 100.0;
- color->green = 0xFFFF - 0xFFFF * level / 100.0;
- color->blue = 0xFFFF - 0xFFFF * level / 100.0;
-#endif
} else if (g_ascii_strcasecmp (colorspec, "red") == 0) {
-#if GTK_CHECK_VERSION (3, 0, 0)
color->red = 1.0;
-#else
- color->red = 0xFFFF;
-#endif
color->green = 0;
color->blue = 0;
} else if (g_ascii_strcasecmp (colorspec, "green") == 0) {
color->red = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
color->green = 1.0;
-#else
- color->green = 0xFFFF;
-#endif
color->blue = 0;
} else if (g_ascii_strcasecmp (colorspec, "blue") == 0) {
color->red = 0;
color->green = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
color->blue = 1.0;
-#else
- color->blue = 0xFFFF;
-#endif
} else if (g_ascii_strncasecmp (colorspec, "red", 3) == 0) {
level = strtol (colorspec + 3, NULL, 10);
-#if GTK_CHECK_VERSION (3, 0, 0)
color->red = 1.0 * level / 100.0;
-#else
- color->red = 0xFFFF * level / 100.0;
-#endif
color->green = 0;
color->blue = 0;
} else if (g_ascii_strncasecmp (colorspec, "green", 5) == 0) {
level = strtol (colorspec + 5, NULL, 10);
color->red = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
color->green = 1.0 * level / 100.0;
-#else
- color->green = 0xFFFF * level / 100.0;
-#endif
color->blue = 0;
} else if (g_ascii_strncasecmp (colorspec, "blue", 4) == 0) {
level = strtol (colorspec + 4, NULL, 10);
color->red = 0;
color->green = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
color->blue = 1.0 * level / 100.0;
-#else
- color->blue = 0xFFFF * level / 100.0;
-#endif
} else
return FALSE;
@@ -876,11 +811,7 @@ draw_pango_layout (MatekbdKeyboardDrawingRenderContext * context,
gint angle, gint x, gint y)
{
PangoLayout *layout = context->layout;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *color;
-#else
- GdkColor *color;
-#endif
PangoLayoutLine *line;
gint x_off, y_off;
gint i;
@@ -928,11 +859,7 @@ draw_pango_layout (MatekbdKeyboardDrawingRenderContext * context,
}
cairo_move_to (context->cr, x, y);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (context->cr, color);
-#else
- gdk_cairo_set_source_color (context->cr, color);
-#endif
pango_cairo_show_layout (context->cr, layout);
}
@@ -1109,13 +1036,8 @@ draw_key (MatekbdKeyboardDrawingRenderContext * context,
MatekbdKeyboardDrawing * drawing, MatekbdKeyboardDrawingKey * key)
{
XkbShapeRec *shape;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style_context;
GdkRGBA color;
-#else
- GtkStyle *style;
- GdkColor color;
-#endif
XkbOutlineRec *outline;
int origin_offset_x;
/* gint i; */
@@ -1132,7 +1054,6 @@ draw_key (MatekbdKeyboardDrawingRenderContext * context,
shape = drawing->xkb->geom->shapes + key->xkbkey->shape_ndx;
if (key->pressed) {
-#if GTK_CHECK_VERSION (3, 0, 0)
style_context = gtk_widget_get_style_context (GTK_WIDGET (drawing));
gtk_style_context_save (style_context);
gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_VIEW);
@@ -1140,10 +1061,6 @@ draw_key (MatekbdKeyboardDrawingRenderContext * context,
GTK_STATE_FLAG_SELECTED,
&color);
gtk_style_context_restore (style_context);
-#else
- style = gtk_widget_get_style (GTK_WIDGET (drawing));
- color = style->base[GTK_STATE_SELECTED];
-#endif
} else
color = *(drawing->colors + key->xkbkey->color_ndx);
@@ -1286,11 +1203,7 @@ draw_indicator_doodad (MatekbdKeyboardDrawingRenderContext * context,
MatekbdKeyboardDrawingDoodad * doodad,
XkbIndicatorDoodadRec * indicator_doodad)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *color;
-#else
- GdkColor *color;
-#endif
XkbShapeRec *shape;
gint i;
@@ -1317,11 +1230,7 @@ draw_shape_doodad (MatekbdKeyboardDrawingRenderContext * context,
XkbShapeDoodadRec * shape_doodad)
{
XkbShapeRec *shape;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *color;
-#else
- GdkColor *color;
-#endif
gint i;
if (!drawing->xkb)
@@ -1449,15 +1358,9 @@ draw_keyboard_to_context (MatekbdKeyboardDrawingRenderContext * context,
static gboolean
create_cairo (MatekbdKeyboardDrawing * drawing)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style_context = NULL;
GtkStateFlags state;
GdkRGBA dark_color;
-#else
- GtkStyle *style = NULL;
- GtkStateType state;
- GdkColor dark_color;
-#endif
if (drawing == NULL)
return FALSE;
@@ -1467,7 +1370,6 @@ create_cairo (MatekbdKeyboardDrawing * drawing)
drawing->renderContext->cr =
cairo_create (drawing->surface);
-#if GTK_CHECK_VERSION (3, 0, 0)
style_context = gtk_widget_get_style_context (GTK_WIDGET (drawing));
state = gtk_style_context_get_state (style_context);
@@ -1477,12 +1379,6 @@ create_cairo (MatekbdKeyboardDrawing * drawing)
dark_color.red *= 0.7;
dark_color.green *= 0.7;
dark_color.blue *= 0.7;
-#else
- style = gtk_widget_get_style (GTK_WIDGET (drawing));
- state = gtk_widget_get_state (GTK_WIDGET (drawing));
-
- dark_color = style->dark[state];
-#endif
drawing->renderContext->dark_color = dark_color;
@@ -1499,15 +1395,10 @@ destroy_cairo (MatekbdKeyboardDrawing * drawing)
static void
draw_keyboard (MatekbdKeyboardDrawing * drawing)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context =
gtk_widget_get_style_context (GTK_WIDGET (drawing));
GtkStateFlags state = gtk_style_context_get_state (context);
GdkRGBA color;
-#else
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (drawing));
- GtkStateType state = gtk_widget_get_state (GTK_WIDGET (drawing));
-#endif
GtkAllocation allocation;
if (!drawing->xkb)
@@ -1524,16 +1415,11 @@ draw_keyboard (MatekbdKeyboardDrawing * drawing)
if (create_cairo (drawing)) {
/* blank background */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
gtk_style_context_get_background_color (context, state, &color);
gtk_style_context_restore (context);
gdk_cairo_set_source_rgba (drawing->renderContext->cr, &color);
-#else
- gdk_cairo_set_source_color (drawing->renderContext->cr,
- &style->base[state]);
-#endif
cairo_paint (drawing->renderContext->cr);
draw_keyboard_to_context (drawing->renderContext, drawing);
@@ -1551,7 +1437,6 @@ alloc_render_context (MatekbdKeyboardDrawing * drawing)
PangoContext *pangoContext =
gtk_widget_get_pango_context (GTK_WIDGET (drawing));
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style_context =
gtk_widget_get_style_context (GTK_WIDGET (drawing));
PangoFontDescription *fd = NULL;
@@ -1559,10 +1444,6 @@ alloc_render_context (MatekbdKeyboardDrawing * drawing)
gtk_style_context_get (style_context,
gtk_style_context_get_state (style_context),
GTK_STYLE_PROPERTY_FONT, &fd, NULL);
-#else
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (drawing));
- PangoFontDescription *fd = style->font_desc;
-#endif
context->layout = pango_layout_new (pangoContext);
pango_layout_set_ellipsize (context->layout, PANGO_ELLIPSIZE_END);
@@ -1585,20 +1466,10 @@ free_render_context (MatekbdKeyboardDrawing * drawing)
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
draw (GtkWidget *widget,
cairo_t *cr,
MatekbdKeyboardDrawing *drawing)
-#else
-expose_event (GtkWidget *widget,
- GdkEventExpose *event,
- MatekbdKeyboardDrawing *drawing)
-#endif
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = gdk_cairo_create (event->window);
-#endif
-
if (!drawing->xkb)
return FALSE;
@@ -1993,11 +1864,7 @@ init_colors (MatekbdKeyboardDrawing * drawing)
if (!drawing->xkb)
return;
-#if GTK_CHECK_VERSION (3, 0, 0)
drawing->colors = g_new (GdkRGBA, drawing->xkb->geom->num_colors);
-#else
- drawing->colors = g_new (GdkColor, drawing->xkb->geom->num_colors);
-#endif
for (i = 0; i < drawing->xkb->geom->num_colors; i++) {
result =
@@ -2276,13 +2143,8 @@ matekbd_keyboard_drawing_init (MatekbdKeyboardDrawing * drawing)
GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK | GDK_BUTTON_PRESS_MASK
| GDK_FOCUS_CHANGE_MASK);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (G_OBJECT (drawing), "draw",
G_CALLBACK (draw), drawing);
-#else
- g_signal_connect (G_OBJECT (drawing), "expose-event",
- G_CALLBACK (expose_event), drawing);
-#endif
g_signal_connect_after (G_OBJECT (drawing), "key-press-event",
G_CALLBACK (key_event), drawing);
g_signal_connect_after (G_OBJECT (drawing), "key-release-event",
@@ -2390,7 +2252,6 @@ matekbd_keyboard_drawing_render (MatekbdKeyboardDrawing * kbdrawing,
double width, double height,
double dpi_x, double dpi_y)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style_context =
gtk_widget_get_style_context (GTK_WIDGET (kbdrawing));
GdkRGBA dark_color;
@@ -2408,14 +2269,6 @@ matekbd_keyboard_drawing_render (MatekbdKeyboardDrawing * kbdrawing,
gtk_style_context_get_state (style_context),
GTK_STYLE_PROPERTY_FONT, &fd, NULL);
fd = pango_font_description_copy (fd);
-#else
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (kbdrawing));
- GdkColor dark_color;
- PangoFontDescription *fd =
- pango_font_description_copy (style->font_desc);
-
- dark_color = style->dark[gtk_widget_get_state (GTK_WIDGET (kbdrawing))];
-#endif
MatekbdKeyboardDrawingRenderContext context = {
cr,
diff --git a/libmatekbd/matekbd-keyboard-drawing.h b/libmatekbd/matekbd-keyboard-drawing.h
index 3a7b1e2..8d117c0 100644
--- a/libmatekbd/matekbd-keyboard-drawing.h
+++ b/libmatekbd/matekbd-keyboard-drawing.h
@@ -117,11 +117,7 @@ struct _MatekbdKeyboardDrawingRenderContext {
gint scale_numerator;
gint scale_denominator;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA dark_color;
-#else
- GdkColor dark_color;
-#endif
};
struct _MatekbdKeyboardDrawing {
@@ -142,11 +138,7 @@ struct _MatekbdKeyboardDrawing {
/* list of stuff to draw in priority order */
GList *keyboard_items;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *colors;
-#else
- GdkColor *colors;
-#endif
guint timeout;
guint idle_redraw;
diff --git a/test/matekbd-indicator-test.c b/test/matekbd-indicator-test.c
index 904f460..cdd34fa 100644
--- a/test/matekbd-indicator-test.c
+++ b/test/matekbd-indicator-test.c
@@ -36,10 +36,6 @@
#include "X11/XKBlib.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
int main(int argc, char** argv)
{
GtkWidget* gki;
@@ -60,7 +56,7 @@ int main(int argc, char** argv)
matekbd_indicator_set_parent_tooltips(MATEKBD_INDICATOR (gki), TRUE);
gtk_window_resize(GTK_WINDOW(mainwin), 250, 250);
- vbox = gtk_vbox_new(TRUE, 6);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add(GTK_CONTAINER(mainwin), vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);