Bug 1027138 - Revert fix from Bug 984075 and fix arrow rendering by extra gtk_widget_show() call. It realizes the arrow widget and allocates it a size. r=karlt
authorMartin Stransky <stransky@redhat.com>
Fri, 27 Jun 2014 01:57:00 -0400
changeset 211976 38b404a28e4e7baccde15e227ba556b291e26b2a
parent 211975 19704ccde4ddd819fc062d811dae602d8874f090
child 211977 5e3e41601d277811f8ca586aad8aa3dd5747681c
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1027138, 984075
milestone33.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 1027138 - Revert fix from Bug 984075 and fix arrow rendering by extra gtk_widget_show() call. It realizes the arrow widget and allocates it a size. r=karlt
widget/gtk/gtk3drawing.c
--- a/widget/gtk/gtk3drawing.c
+++ b/widget/gtk/gtk3drawing.c
@@ -15,17 +15,17 @@
 #include "nsDebug.h"
 #include "prinrval.h"
 
 #include <math.h>
 
 static GtkWidget* gProtoWindow;
 static GtkWidget* gProtoLayout;
 static GtkWidget* gButtonWidget;
-static GtkWidget* gToggleMenuButtonWidget;
+static GtkWidget* gToggleButtonWidget;
 static GtkWidget* gButtonArrowWidget;
 static GtkWidget* gCheckboxWidget;
 static GtkWidget* gRadiobuttonWidget;
 static GtkWidget* gHorizScrollbarWidget;
 static GtkWidget* gVertScrollbarWidget;
 static GtkWidget* gSpinWidget;
 static GtkWidget* gHScaleWidget;
 static GtkWidget* gVScaleWidget;
@@ -157,31 +157,35 @@ ensure_vpaned_widget()
     if (!gVPanedWidget) {
         gVPanedWidget = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
         setup_widget_prototype(gVPanedWidget);
     }
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
-ensure_toggle_menu_button_widget()
+ensure_toggle_button_widget()
 {
-    if (!gToggleMenuButtonWidget) {
-        gToggleMenuButtonWidget = gtk_menu_button_new();
-        setup_widget_prototype(gToggleMenuButtonWidget);
+    if (!gToggleButtonWidget) {
+        gToggleButtonWidget = gtk_toggle_button_new();
+        setup_widget_prototype(gToggleButtonWidget);
   }
   return MOZ_GTK_SUCCESS;
 }
 
 static gint
 ensure_button_arrow_widget()
 {
     if (!gButtonArrowWidget) {
-        ensure_toggle_menu_button_widget();
-        gButtonArrowWidget = gtk_bin_get_child(GTK_BIN(gToggleMenuButtonWidget));
+        ensure_toggle_button_widget();
+
+        gButtonArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
+        gtk_container_add(GTK_CONTAINER(gToggleButtonWidget), gButtonArrowWidget);
+        gtk_widget_realize(gButtonArrowWidget);
+        gtk_widget_show(gButtonArrowWidget);
     }
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 ensure_checkbox_widget()
 {
     if (!gCheckboxWidget) {
@@ -324,18 +328,18 @@ ensure_combo_box_widgets()
             g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer)
                                       &gComboBoxArrowWidget);
             gtk_widget_realize(gComboBoxArrowWidget);
         }
     } else {
         /* Shouldn't be reached with current internal gtk implementation; we
          * use a generic toggle button as last resort fallback to avoid
          * crashing. */
-        ensure_toggle_menu_button_widget();
-        gComboBoxButtonWidget = gToggleMenuButtonWidget;
+        ensure_toggle_button_widget();
+        gComboBoxButtonWidget = gToggleButtonWidget;
     }
 
     if (!gComboBoxArrowWidget) {
         /* Shouldn't be reached with current internal gtk implementation;
          * we gButtonArrowWidget as last resort fallback to avoid
          * crashing. */
         ensure_button_arrow_widget();
         gComboBoxArrowWidget = gButtonArrowWidget;
@@ -430,18 +434,18 @@ ensure_combo_box_entry_widgets()
             g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer)
                                       &gComboBoxEntryArrowWidget);
             gtk_widget_realize(gComboBoxEntryArrowWidget);
         }
     } else {
         /* Shouldn't be reached with current internal gtk implementation;
          * we use a generic toggle button as last resort fallback to avoid
          * crashing. */
-        ensure_toggle_menu_button_widget();
-        gComboBoxEntryButtonWidget = gToggleMenuButtonWidget;
+        ensure_toggle_button_widget();
+        gComboBoxEntryButtonWidget = gToggleButtonWidget;
     }
 
     if (!gComboBoxEntryArrowWidget) {
         /* Shouldn't be reached with current internal gtk implementation;
          * we gButtonArrowWidget as last resort fallback to avoid
          * crashing. */
         ensure_button_arrow_widget();
         gComboBoxEntryArrowWidget = gButtonArrowWidget;
@@ -3108,20 +3112,20 @@ moz_gtk_widget_paint(GtkThemeWidgetType 
 {
     /* A workaround for https://bugzilla.gnome.org/show_bug.cgi?id=694086
      */
     cairo_new_path(cr);
 
     switch (widget) {
     case MOZ_GTK_BUTTON:
         if (state->depressed) {
-            ensure_toggle_menu_button_widget();
+            ensure_toggle_button_widget();
             return moz_gtk_button_paint(cr, rect, state,
                                         (GtkReliefStyle) flags,
-                                        gToggleMenuButtonWidget, direction);
+                                        gToggleButtonWidget, direction);
         }
         ensure_button_widget();
         return moz_gtk_button_paint(cr, rect, state,
                                     (GtkReliefStyle) flags, gButtonWidget,
                                     direction);
         break;
     case MOZ_GTK_CHECKBUTTON:
     case MOZ_GTK_RADIOBUTTON:
@@ -3324,17 +3328,17 @@ moz_gtk_shutdown()
 
     /* TODO - replace it with appropriate widget */
     if (gTreeHeaderSortArrowWidget)
         gtk_widget_destroy(gTreeHeaderSortArrowWidget);
 
     gProtoWindow = NULL;
     gProtoLayout = NULL;
     gButtonWidget = NULL;
-    gToggleMenuButtonWidget = NULL;
+    gToggleButtonWidget = NULL;
     gButtonArrowWidget = NULL;
     gCheckboxWidget = NULL;
     gRadiobuttonWidget = NULL;
     gHorizScrollbarWidget = NULL;
     gVertScrollbarWidget = NULL;
     gSpinWidget = NULL;
     gHScaleWidget = NULL;
     gVScaleWidget = NULL;