Bug 1232219 (part 2) - Fix -Wunused warnings in widget/gtk/. r=karlt.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 16 Dec 2015 22:24:21 -0800
changeset 278419 8acbf93a07173240edb5818cf4361036d8f85122
parent 278418 3a785337924021ba18a5252775472a2ead8a50f6
child 278420 7950a7c0fcdb8324a8bd4e2abac305f58aaa32c5
push id29850
push usercbook@mozilla.com
push dateTue, 05 Jan 2016 10:59:10 +0000
treeherdermozilla-central@29258f59e545 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1232219
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1232219 (part 2) - Fix -Wunused warnings in widget/gtk/. r=karlt.
widget/gtk/gtk3drawing.c
widget/gtk/mozcontainer.c
widget/gtkxtbin/gtk2xtbin.c
--- a/widget/gtk/gtk3drawing.c
+++ b/widget/gtk/gtk3drawing.c
@@ -717,18 +717,16 @@ ensure_scrolled_window_widget()
         setup_widget_prototype(gScrolledWindowWidget);
     }
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_init()
 {
-    GtkWidgetClass *entry_class;
-
     if (is_initialized)
         return MOZ_GTK_SUCCESS;
 
     is_initialized = TRUE;
     have_arrow_scaling = (gtk_major_version > 2 ||
                           (gtk_major_version == 2 && gtk_minor_version >= 12));
     if (gtk_major_version > 3 ||
        (gtk_major_version == 3 && gtk_minor_version >= 14))
@@ -739,21 +737,16 @@ moz_gtk_init()
     if(!gtk_check_version(3, 12, 0)) {
         ensure_tab_widget();
         gtk_widget_style_get(gTabWidget, "has-tab-gap", &notebook_has_tab_gap, NULL);
     }
     else {
         notebook_has_tab_gap = TRUE;
     }
 
-    /* Add style property to GtkEntry.
-     * Adding the style property to the normal GtkEntry class means that it
-     * will work without issues inside GtkComboBox and for Spinbuttons. */
-    entry_class = g_type_class_ref(GTK_TYPE_ENTRY);
-
     return MOZ_GTK_SUCCESS;
 }
 
 gint
 moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing)
 {
     ensure_checkbox_widget();
 
@@ -1090,24 +1083,21 @@ calculate_arrow_rect(GtkWidget* arrow, G
 
 static gint
 moz_gtk_scrollbar_button_paint(cairo_t *cr, GdkRectangle* rect,
                                GtkWidgetState* state,
                                GtkScrollbarButtonFlags flags,
                                GtkTextDirection direction)
 {
     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
-    GtkStateType saved_state;
     GdkRectangle arrow_rect;
     gdouble arrow_angle;
     GtkStyleContext* style;
     GtkWidget *scrollbar;
     gint arrow_displacement_x, arrow_displacement_y;
-    const char* detail = (flags & MOZ_GTK_STEPPER_VERTICAL) ?
-                           "vscrollbar" : "hscrollbar";
 
     ensure_scrollbar_widget();
 
     if (flags & MOZ_GTK_STEPPER_VERTICAL)
         scrollbar = gVertScrollbarWidget;
     else
         scrollbar = gHorizScrollbarWidget;
 
@@ -1210,17 +1200,16 @@ static gint
 moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget,
                               cairo_t *cr, GdkRectangle* rect,
                               GtkWidgetState* state,
                               GtkTextDirection direction)
 {
     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
     GtkStyleContext* style;
     GtkScrollbar *scrollbar;
-    GtkAdjustment *adj;
     GtkBorder margin;
 
     ensure_scrollbar_widget();
 
     if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
         scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
     else
         scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
@@ -1643,17 +1632,17 @@ moz_gtk_treeview_expander_paint(cairo_t 
 /* See gtk_separator_draw() for reference.
 */
 static gint
 moz_gtk_combo_box_paint(cairo_t *cr, GdkRectangle* rect,
                         GtkWidgetState* state,
                         GtkTextDirection direction)
 {
     GdkRectangle arrow_rect, real_arrow_rect;
-    gint arrow_size, separator_width;
+    gint separator_width;
     gboolean wide_separators;
     GtkStyleContext* style;
     GtkRequisition arrow_req;
 
     ensure_combo_box_widgets();
 
     /* Also sets the direction on gComboBoxButtonWidget, which is then
      * inherited by the separator and arrow */
@@ -2451,33 +2440,31 @@ moz_gtk_menu_popup_paint(cairo_t *cr, Gd
 // See gtk_menu_item_draw() for reference.
 static gint
 moz_gtk_menu_separator_paint(cairo_t *cr, GdkRectangle* rect,
                              GtkTextDirection direction)
 {
     GtkStyleContext* style;
     gboolean wide_separators;
     gint separator_height;
-    gint paint_height;
     guint border_width;
-    gint x, y, w, h;
+    gint x, y, w;
     GtkBorder padding;
 
     ensure_menu_separator_widget();
     gtk_widget_set_direction(gMenuSeparatorWidget, direction);
 
     border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
 
     style = gtk_widget_get_style_context(gMenuSeparatorWidget);
     gtk_style_context_get_padding(style, 0, &padding);
 
     x = rect->x + border_width;
     y = rect->y + border_width;
     w = rect->width - border_width * 2;
-    h = rect->height - border_width * 2;
 
     gtk_style_context_save(style);
     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
 
     gtk_widget_style_get(gMenuSeparatorWidget,
                          "wide-separators",    &wide_separators,
                          "separator-height",   &separator_height,
                          NULL);
@@ -3390,18 +3377,16 @@ gboolean moz_gtk_has_scrollbar_buttons(v
                           "has-secondary-forward-stepper", &secondary_forward,
                           NULL);
     return backward | forward | secondary_forward | secondary_forward;
 }
 
 gint
 moz_gtk_shutdown()
 {
-    GtkWidgetClass *entry_class;
-
     if (gTooltipWidget)
         gtk_widget_destroy(gTooltipWidget);
     /* This will destroy all of our widgets */
     if (gProtoWindow)
         gtk_widget_destroy(gProtoWindow);
 
     /* TODO - replace it with appropriate widget */
     if (gTreeHeaderSortArrowWidget)
@@ -3447,15 +3432,12 @@ moz_gtk_shutdown()
     gTreeHeaderSortArrowWidget = NULL;
     gExpanderWidget = NULL;
     gToolbarSeparatorWidget = NULL;
     gMenuSeparatorWidget = NULL;
     gHPanedWidget = NULL;
     gVPanedWidget = NULL;
     gScrolledWindowWidget = NULL;
 
-    entry_class = g_type_class_peek(GTK_TYPE_ENTRY);
-    g_type_class_unref(entry_class);
-
     is_initialized = FALSE;
 
     return MOZ_GTK_SUCCESS;
 }
--- a/widget/gtk/mozcontainer.c
+++ b/widget/gtk/mozcontainer.c
@@ -259,18 +259,16 @@ moz_container_realize (GtkWidget *widget
 
 void
 moz_container_size_allocate (GtkWidget     *widget,
                              GtkAllocation *allocation)
 {
     MozContainer   *container;
     GList          *tmp_list;
     GtkAllocation   tmp_allocation;
-    GtkRequisition  tmp_requisition;
-    GtkWidget      *tmp_child;
 
     g_return_if_fail (IS_MOZ_CONTAINER (widget));
 
     /*  printf("moz_container_size_allocate %p %d %d %d %d\n",
         (void *)widget,
         allocation->x,
         allocation->y,
         allocation->width,
@@ -380,23 +378,20 @@ moz_container_forall (GtkContainer *cont
     }
 }
 
 static void
 moz_container_allocate_child (MozContainer *container,
                               MozContainerChild *child)
 {
     GtkAllocation  allocation;
-    GtkRequisition requisition;
 
     gtk_widget_get_allocation (child->widget, &allocation);
     allocation.x = child->x;
     allocation.y = child->y;
-    /* gtk_widget_get_child_requisition (child->widget, &requisition); */
-    /* gtk_widget_size_request (child->widget, &requisition); */
 
     gtk_widget_size_allocate (child->widget, &allocation);
 }
 
 MozContainerChild *
 moz_container_get_child (MozContainer *container, GtkWidget *child_widget)
 {
     GList *tmp_list;
--- a/widget/gtkxtbin/gtk2xtbin.c
+++ b/widget/gtkxtbin/gtk2xtbin.c
@@ -35,17 +35,16 @@
 
 #define XTBIN_MAX_EVENTS 30
 
 static void            gtk_xtbin_class_init (GtkXtBinClass *klass);
 static void            gtk_xtbin_init       (GtkXtBin      *xtbin);
 static void            gtk_xtbin_realize    (GtkWidget      *widget);
 static void            gtk_xtbin_unrealize    (GtkWidget      *widget);
 static void            gtk_xtbin_destroy    (GtkObject      *object);
-static void            gtk_xtbin_shutdown   (GtkObject      *object);
 
 /* Xt aware XEmbed */
 static void       xt_client_handle_xembed_message (Widget w, 
                                                    XtPointer client_data, 
                                                    XEvent *event);
 static void       xt_add_focus_listener( Widget w, XtPointer user_data );
 static void       xt_add_focus_listener_tree ( Widget treeroot, XtPointer user_data); 
 static void       xt_remove_focus_listener(Widget w, XtPointer user_data);
@@ -100,17 +99,16 @@ xt_event_check (GSource*  source_data)
   return FALSE;
 }   
 
 static gboolean
 xt_event_dispatch (GSource*  source_data,
                     GSourceFunc call_back,
                     gpointer  user_data)
 {
-  XEvent event;
   XtAppContext ac;
   int i = 0;
 
   ac = XtDisplayToApplicationContext(xtdisplay);
 
   /* Process only real X traffic here.  We only look for data on the
    * pipe, limit it to XTBIN_MAX_EVENTS and only call
    * XtAppProcessEvent so that it will look for X events.  There's no