From cf8d54c7906f096d6150d6cd80b8c825df30944b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 26 Mar 2012 20:31:32 +0200 Subject: [PATCH] gcompat: gtk_widget_set_can_focus() for below 2.18 Signed-off-by: Jens Axboe --- gcompat.c | 10 ++++++++++ gcompat.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/gcompat.c b/gcompat.c index 7b0810ba..5944df0d 100644 --- a/gcompat.c +++ b/gcompat.c @@ -47,3 +47,13 @@ guint gtk_widget_get_allocated_height(GtkWidget *w) } #endif + +#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 18 +void gtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus) +{ + if (can_focus) + GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS); +} +#endif diff --git a/gcompat.h b/gcompat.h index 61b98945..8b8461a8 100644 --- a/gcompat.h +++ b/gcompat.h @@ -39,4 +39,8 @@ guint gtk_widget_get_allocated_height(GtkWidget *w); #define GFIO_DRAW_EVENT "expose_event" #endif +#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 18 +void gtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus); +#endif + #endif -- 2.25.1