From 1068fe4d1bde1f532aedb612244f0f3c4ad555be Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 23 Apr 2012 00:34:29 -0700 Subject: [PATCH] Fix minor GTK3 problems found by static checking. * emacsgtkfixed.c (EMACS_TYPE_FIXED, EMACS_FIXED, EmacsFixed) (EmacsFixedPrivate, EmacsFixedClass, struct _EmacsFixed) (struct _EmacsFixedClass, emacs_fixed_get_type): Move decls here from emacsgtkfixed.h, since they needn't be public. (emacs_fixed_get_type): Now static. (emacs_fixed_class_init): Omit unused local. (emacs_fixed_child_type): Remove; unused. * emacsgtkfixed.h (EMACS_TYPE_FIXED, EMACS_FIXED, EmacsFixed) (EmacsFixedPrivate, EmacsFixedClass, struct _EmacsFixed) (struct _EmacsFixedClass): Move to emacsgtkfixed.c. (EMACS_FIXED_CLASS, EMACS_IS_FIXED, EMACS_IS_FIXED_CLASS) (EMACS_FIXED_GET_CLASS): Remove; unused. * gtkutil.c (xg_create_frame_widgets) [!HAVE_GTK3]: Omit unused local. --- src/ChangeLog | 15 +++++++++++++++ src/emacsgtkfixed.c | 30 ++++++++++++++++++++++-------- src/emacsgtkfixed.h | 26 -------------------------- src/gtkutil.c | 2 ++ 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 825211aa8c..1db958d8d6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,20 @@ 2012-04-23 Paul Eggert + Fix minor GTK3 problems found by static checking. + * emacsgtkfixed.c (EMACS_TYPE_FIXED, EMACS_FIXED, EmacsFixed) + (EmacsFixedPrivate, EmacsFixedClass, struct _EmacsFixed) + (struct _EmacsFixedClass, emacs_fixed_get_type): + Move decls here from emacsgtkfixed.h, since they needn't be public. + (emacs_fixed_get_type): Now static. + (emacs_fixed_class_init): Omit unused local. + (emacs_fixed_child_type): Remove; unused. + * emacsgtkfixed.h (EMACS_TYPE_FIXED, EMACS_FIXED, EmacsFixed) + (EmacsFixedPrivate, EmacsFixedClass, struct _EmacsFixed) + (struct _EmacsFixedClass): Move to emacsgtkfixed.c. + (EMACS_FIXED_CLASS, EMACS_IS_FIXED, EMACS_IS_FIXED_CLASS) + (EMACS_FIXED_GET_CLASS): Remove; unused. + * gtkutil.c (xg_create_frame_widgets) [!HAVE_GTK3]: Omit unused local. + * keyboard.c (handle_async_input): Define only if SYNC_INPUT || SIGIO. Problem reported by Juanma Barranquero for Windows -Wunused-function. diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index fba672ff74..1a62b59b7a 100644 --- a/src/emacsgtkfixed.c +++ b/src/emacsgtkfixed.c @@ -28,6 +28,27 @@ along with GNU Emacs. If not, see . */ #include "frame.h" #include "xterm.h" +#define EMACS_TYPE_FIXED emacs_fixed_get_type () +#define EMACS_FIXED(obj) \ + G_TYPE_CHECK_INSTANCE_CAST (obj, EMACS_TYPE_FIXED, EmacsFixed) + +typedef struct _EmacsFixed EmacsFixed; +typedef struct _EmacsFixedPrivate EmacsFixedPrivate; +typedef struct _EmacsFixedClass EmacsFixedClass; + +struct _EmacsFixed +{ + GtkFixed container; + + /*< private >*/ + EmacsFixedPrivate *priv; +}; + +struct _EmacsFixedClass +{ + GtkFixedClass parent_class; +}; + struct _EmacsFixedPrivate { struct frame *f; @@ -40,28 +61,21 @@ static void emacs_fixed_get_preferred_width (GtkWidget *widget, static void emacs_fixed_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural); +static GType emacs_fixed_get_type (void); G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) static void emacs_fixed_class_init (EmacsFixedClass *klass) { GtkWidgetClass *widget_class; - GtkFixedClass *fixed_class; widget_class = (GtkWidgetClass*) klass; - fixed_class = (GtkFixedClass*) klass; widget_class->get_preferred_width = emacs_fixed_get_preferred_width; widget_class->get_preferred_height = emacs_fixed_get_preferred_height; g_type_class_add_private (klass, sizeof (EmacsFixedPrivate)); } -static GType -emacs_fixed_child_type (GtkFixed *container) -{ - return GTK_TYPE_WIDGET; -} - static void emacs_fixed_init (EmacsFixed *fixed) { diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h index 90fb37e521..3fa294aa41 100644 --- a/src/emacsgtkfixed.h +++ b/src/emacsgtkfixed.h @@ -27,33 +27,7 @@ G_BEGIN_DECLS struct frame; -#define EMACS_TYPE_FIXED (emacs_fixed_get_type ()) -#define EMACS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMACS_TYPE_FIXED, EmacsFixed)) -#define EMACS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMACS_TYPE_FIXED, EmacsFixedClass)) -#define EMACS_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMACS_TYPE_FIXED)) -#define EMACS_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMACS_TYPE_FIXED)) -#define EMACS_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMACS_TYPE_FIXED, EmacsFixedClass)) - -typedef struct _EmacsFixed EmacsFixed; -typedef struct _EmacsFixedPrivate EmacsFixedPrivate; -typedef struct _EmacsFixedClass EmacsFixedClass; - -struct _EmacsFixed -{ - GtkFixed container; - - /*< private >*/ - EmacsFixedPrivate *priv; -}; - - -struct _EmacsFixedClass -{ - GtkFixedClass parent_class; -}; - extern GtkWidget *emacs_fixed_new (struct frame *f); -extern GType emacs_fixed_get_type (void); G_END_DECLS diff --git a/src/gtkutil.c b/src/gtkutil.c index 4dbef65ded..c8a505273f 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1090,7 +1090,9 @@ xg_create_frame_widgets (FRAME_PTR f) GtkWidget *wtop; GtkWidget *wvbox, *whbox; GtkWidget *wfixed; +#ifndef HAVE_GTK3 GtkRcStyle *style; +#endif char *title = 0; BLOCK_INPUT; -- 2.20.1