2016-04-25 12:58:04 +00:00
|
|
|
diff -up firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-46.0/widget/gtk/gtk3drawing.c
|
|
|
|
--- firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20 2016-04-22 02:37:27.000000000 +0200
|
|
|
|
+++ firefox-46.0/widget/gtk/gtk3drawing.c 2016-04-25 14:56:19.006992927 +0200
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -17,32 +17,79 @@
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
2016-03-15 13:50:37 +00:00
|
|
|
+#define MOZ_WIDGET_STYLES 4
|
2015-12-16 11:52:28 +00:00
|
|
|
+
|
|
|
|
+typedef struct {
|
2016-03-15 13:50:37 +00:00
|
|
|
+ GtkWidget* widget;
|
2016-01-13 15:43:54 +00:00
|
|
|
+
|
2016-03-15 13:50:37 +00:00
|
|
|
+ union {
|
|
|
|
+ struct {
|
|
|
|
+ GtkStyleContext* style;
|
|
|
|
+ GtkStyleContext* styleSelection;
|
|
|
|
+ } entry;
|
|
|
|
+
|
|
|
|
+ struct {
|
|
|
|
+ GtkStyleContext* style;
|
|
|
|
+ } button;
|
|
|
|
+
|
|
|
|
+ struct {
|
|
|
|
+ GtkStyleContext* style;
|
2016-04-20 17:04:32 +00:00
|
|
|
+ GtkStyleContext* styleContents;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ GtkStyleContext* styleTrough;
|
|
|
|
+ GtkStyleContext* styleSlider;
|
|
|
|
+ } scroll;
|
|
|
|
+
|
|
|
|
+ struct {
|
|
|
|
+ GtkStyleContext* style;
|
|
|
|
+ GtkStyleContext* styleCheck;
|
|
|
|
+ GtkStyleContext* styleLabel;
|
|
|
|
+ } check;
|
|
|
|
+
|
|
|
|
+ struct {
|
|
|
|
+ GtkStyleContext* style;
|
|
|
|
+ GtkStyleContext* styleTrough;
|
|
|
|
+ GtkStyleContext* styleProgress;
|
|
|
|
+ } progress;
|
|
|
|
+
|
|
|
|
+ struct {
|
|
|
|
+ GtkStyleContext* style;
|
|
|
|
+ GtkStyleContext* styleEntry;
|
|
|
|
+ GtkStyleContext* styleButtonUp;
|
|
|
|
+ GtkStyleContext* styleButtonDown;
|
|
|
|
+ } spin;
|
|
|
|
+
|
|
|
|
+ struct {
|
|
|
|
+ GtkStyleContext* style[MOZ_WIDGET_STYLES];
|
|
|
|
+ } all;
|
|
|
|
+ };
|
|
|
|
+} MozGtkWidget;
|
2015-12-16 11:52:28 +00:00
|
|
|
+
|
|
|
|
static GtkWidget* gProtoWindow;
|
|
|
|
static GtkWidget* gProtoLayout;
|
2016-03-15 13:50:37 +00:00
|
|
|
-static GtkWidget* gButtonWidget;
|
|
|
|
+static MozGtkWidget gButton;
|
2015-12-16 11:52:28 +00:00
|
|
|
static GtkWidget* gToggleButtonWidget;
|
|
|
|
static GtkWidget* gButtonArrowWidget;
|
|
|
|
-static GtkWidget* gCheckboxWidget;
|
|
|
|
-static GtkWidget* gRadiobuttonWidget;
|
|
|
|
-static GtkWidget* gHorizScrollbarWidget;
|
|
|
|
-static GtkWidget* gVertScrollbarWidget;
|
2016-03-15 13:50:37 +00:00
|
|
|
-static GtkWidget* gSpinWidget;
|
|
|
|
+static MozGtkWidget gCheckbox;
|
|
|
|
+static MozGtkWidget gRadiobutton;
|
|
|
|
+static MozGtkWidget gVertScrollbar;
|
|
|
|
+static MozGtkWidget gHorizScrollbar;
|
|
|
|
+static MozGtkWidget gSpin;
|
2015-12-16 11:52:28 +00:00
|
|
|
static GtkWidget* gHScaleWidget;
|
|
|
|
static GtkWidget* gVScaleWidget;
|
2016-03-15 13:50:37 +00:00
|
|
|
-static GtkWidget* gEntryWidget;
|
|
|
|
+static MozGtkWidget gEntry;
|
|
|
|
static GtkWidget* gComboBoxWidget;
|
|
|
|
static GtkWidget* gComboBoxButtonWidget;
|
|
|
|
static GtkWidget* gComboBoxArrowWidget;
|
|
|
|
static GtkWidget* gComboBoxSeparatorWidget;
|
|
|
|
static GtkWidget* gComboBoxEntryWidget;
|
|
|
|
-static GtkWidget* gComboBoxEntryTextareaWidget;
|
|
|
|
+static MozGtkWidget gComboBoxEntryTextarea;
|
|
|
|
static GtkWidget* gComboBoxEntryButtonWidget;
|
|
|
|
static GtkWidget* gComboBoxEntryArrowWidget;
|
|
|
|
static GtkWidget* gHandleBoxWidget;
|
2016-01-13 15:43:54 +00:00
|
|
|
static GtkWidget* gToolbarWidget;
|
|
|
|
static GtkWidget* gFrameWidget;
|
|
|
|
static GtkWidget* gStatusbarWidget;
|
|
|
|
-static GtkWidget* gProgressWidget;
|
2016-03-15 13:50:37 +00:00
|
|
|
+static MozGtkWidget gProgressBar;
|
2016-01-13 15:43:54 +00:00
|
|
|
static GtkWidget* gTabWidget;
|
|
|
|
static GtkWidget* gTooltipWidget;
|
|
|
|
static GtkWidget* gMenuBarWidget;
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -78,6 +125,37 @@ static gboolean is_initialized;
|
2016-03-15 13:50:37 +00:00
|
|
|
#define GTK_STATE_FLAG_CHECKED (1 << 11)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+void moz_gtk_widget_free(MozGtkWidget *aMozWidget)
|
|
|
|
+{
|
|
|
|
+ // This was removed as a child of gProtoWindow
|
|
|
|
+ if (aMozWidget->widget) {
|
|
|
|
+ aMozWidget->widget = NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < MOZ_WIDGET_STYLES; i++) {
|
|
|
|
+ if (aMozWidget->all.style[i]) {
|
|
|
|
+ g_object_unref(aMozWidget->all.style[i]);
|
|
|
|
+ aMozWidget->all.style[i] = NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// TODO - weak dep!! (dlsym)
|
|
|
|
+#if GTK_CHECK_VERSION(3, 19, 2)
|
|
|
|
+#define moz_gtk_path_set_class_name gtk_widget_path_iter_set_object_name
|
|
|
|
+#else
|
|
|
|
+#define moz_gtk_path_set_class_name gtk_widget_path_iter_add_class
|
|
|
|
+#endif
|
|
|
|
+//gtk_widget_path_iter_get_state
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
+moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
|
|
|
|
+ GtkBorder *border);
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
+moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
|
|
|
|
+ GtkBorder *padding);
|
|
|
|
+
|
|
|
|
static GtkStateFlags
|
|
|
|
GetStateFlagsFromGtkWidgetState(GtkWidgetState* state)
|
|
|
|
{
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -97,6 +175,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge
|
2015-12-16 11:52:28 +00:00
|
|
|
return stateFlags;
|
|
|
|
}
|
|
|
|
|
2015-12-16 19:45:47 +00:00
|
|
|
+GtkStyleContext *
|
2015-12-16 11:52:28 +00:00
|
|
|
+moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent)
|
|
|
|
+{
|
|
|
|
+ GtkWidgetPath *path;
|
|
|
|
+ GtkStyleContext *context;
|
|
|
|
+
|
|
|
|
+ if (parent)
|
|
|
|
+ path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
|
|
|
|
+ else
|
|
|
|
+ path = gtk_widget_path_new ();
|
|
|
|
+
|
|
|
|
+ gtk_widget_path_append_type (path, node->type);
|
|
|
|
+ if (node->name)
|
2016-03-15 13:50:37 +00:00
|
|
|
+ moz_gtk_path_set_class_name(path, -1, node->name);
|
2015-12-16 11:52:28 +00:00
|
|
|
+ if (node->class1)
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_widget_path_iter_add_class(path, -1, node->class1);
|
2015-12-16 11:52:28 +00:00
|
|
|
+ if (node->class2)
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_widget_path_iter_add_class(path, -1, node->class2);
|
2015-12-16 11:52:28 +00:00
|
|
|
+
|
|
|
|
+ context = gtk_style_context_new ();
|
|
|
|
+ gtk_style_context_set_path (context, path);
|
|
|
|
+ gtk_style_context_set_parent (context, parent);
|
2016-03-15 13:50:37 +00:00
|
|
|
+
|
|
|
|
+ if(!gtk_check_version(3, 14, 0)) {
|
|
|
|
+ /* Unfortunately, we have to explicitly set the state again here
|
|
|
|
+ * for it to take effect
|
|
|
|
+ */
|
|
|
|
+ gtk_style_context_set_state (context, gtk_widget_path_iter_get_state (path, -1));
|
|
|
|
+ }
|
|
|
|
+
|
2015-12-16 11:52:28 +00:00
|
|
|
+ gtk_widget_path_unref (path);
|
|
|
|
+
|
|
|
|
+ return context;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine
|
|
|
|
that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific
|
|
|
|
things they may want to do. */
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -141,9 +254,16 @@ setup_widget_prototype(GtkWidget* widget
|
2016-03-15 13:50:37 +00:00
|
|
|
static gint
|
|
|
|
ensure_button_widget()
|
|
|
|
{
|
|
|
|
- if (!gButtonWidget) {
|
|
|
|
- gButtonWidget = gtk_button_new_with_label("M");
|
|
|
|
- setup_widget_prototype(gButtonWidget);
|
|
|
|
+ if (!gButton.widget) {
|
|
|
|
+ GtkCssNode path[] = {
|
|
|
|
+ { GTK_TYPE_BUTTON, "button", NULL, NULL }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ gButton.widget = gtk_button_new_with_label("M");
|
|
|
|
+ setup_widget_prototype(gButton.widget);
|
|
|
|
+ gtk_widget_show(gButton.widget);
|
|
|
|
+
|
|
|
|
+ gButton.button.style = moz_gtk_style_create(&path[0], NULL);
|
|
|
|
}
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -195,9 +315,21 @@ ensure_button_arrow_widget()
|
2015-12-16 11:52:28 +00:00
|
|
|
static gint
|
|
|
|
ensure_checkbox_widget()
|
|
|
|
{
|
|
|
|
- if (!gCheckboxWidget) {
|
|
|
|
- gCheckboxWidget = gtk_check_button_new_with_label("M");
|
|
|
|
- setup_widget_prototype(gCheckboxWidget);
|
|
|
|
+ if (!gCheckbox.widget) {
|
|
|
|
+ GtkCssNode path[] = {
|
2016-03-15 13:50:37 +00:00
|
|
|
+ { GTK_TYPE_TOGGLE_BUTTON, "checkbutton", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "check", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "label", NULL, NULL }
|
2015-12-16 11:52:28 +00:00
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ gCheckbox.widget = gtk_check_button_new_with_label("M");
|
|
|
|
+ setup_widget_prototype(gCheckbox.widget);
|
|
|
|
+
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gCheckbox.check.style = moz_gtk_style_create(&path[0], NULL);
|
|
|
|
+ gCheckbox.check.styleCheck = moz_gtk_style_create(&path[1],
|
|
|
|
+ gCheckbox.check.style);
|
|
|
|
+ gCheckbox.check.styleLabel = moz_gtk_style_create(&path[2],
|
|
|
|
+ gCheckbox.check.style);
|
2015-12-16 11:52:28 +00:00
|
|
|
}
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -205,9 +337,21 @@ ensure_checkbox_widget()
|
2015-12-16 11:52:28 +00:00
|
|
|
static gint
|
|
|
|
ensure_radiobutton_widget()
|
|
|
|
{
|
|
|
|
- if (!gRadiobuttonWidget) {
|
|
|
|
- gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M");
|
|
|
|
- setup_widget_prototype(gRadiobuttonWidget);
|
|
|
|
+ if (!gRadiobutton.widget) {
|
|
|
|
+ GtkCssNode path[] = {
|
2016-03-15 13:50:37 +00:00
|
|
|
+ { GTK_TYPE_TOGGLE_BUTTON, "radiobutton", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "radio", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "label", NULL, NULL }
|
2015-12-16 11:52:28 +00:00
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ gRadiobutton.widget = gtk_radio_button_new_with_label(NULL, "M");
|
|
|
|
+ setup_widget_prototype(gRadiobutton.widget);
|
|
|
|
+
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gRadiobutton.check.style = moz_gtk_style_create(&path[0], NULL);
|
|
|
|
+ gRadiobutton.check.styleCheck = moz_gtk_style_create(&path[1],
|
|
|
|
+ gRadiobutton.check.style);
|
|
|
|
+ gRadiobutton.check.styleLabel = moz_gtk_style_create(&path[2],
|
|
|
|
+ gRadiobutton.check.style);
|
2015-12-16 11:52:28 +00:00
|
|
|
}
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -215,25 +359,62 @@ ensure_radiobutton_widget()
|
2015-12-16 11:52:28 +00:00
|
|
|
static gint
|
|
|
|
ensure_scrollbar_widget()
|
|
|
|
{
|
|
|
|
- if (!gVertScrollbarWidget) {
|
|
|
|
- gVertScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
|
|
|
|
- setup_widget_prototype(gVertScrollbarWidget);
|
|
|
|
- }
|
|
|
|
- if (!gHorizScrollbarWidget) {
|
|
|
|
- gHorizScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL);
|
|
|
|
- setup_widget_prototype(gHorizScrollbarWidget);
|
2016-04-20 17:04:32 +00:00
|
|
|
- }
|
2015-12-16 11:52:28 +00:00
|
|
|
+ if (!gVertScrollbar.widget && !gHorizScrollbar.widget) {
|
|
|
|
+ GtkCssNode path[] = {
|
2016-04-20 17:04:32 +00:00
|
|
|
+ { GTK_TYPE_SCROLLBAR, "scrollbar", "horizontal", "bottom"},
|
2016-04-20 18:05:26 +00:00
|
|
|
+ { GTK_TYPE_SCROLLBAR, "scrollbar", "vertical", "right" },
|
2016-04-20 17:04:32 +00:00
|
|
|
+ { G_TYPE_NONE, "contents", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "trough", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "slider", NULL, NULL }
|
2015-12-16 11:52:28 +00:00
|
|
|
+ };
|
|
|
|
+
|
2016-04-20 17:04:32 +00:00
|
|
|
+ gHorizScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL);
|
|
|
|
+ setup_widget_prototype(gHorizScrollbar.widget);
|
|
|
|
+
|
|
|
|
+ gHorizScrollbar.scroll.style = moz_gtk_style_create(path, NULL);
|
|
|
|
+ gHorizScrollbar.scroll.styleContents = moz_gtk_style_create(path+2,
|
|
|
|
+ gHorizScrollbar.scroll.style);
|
|
|
|
+ gHorizScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3,
|
|
|
|
+ gHorizScrollbar.scroll.styleContents);
|
|
|
|
+ gHorizScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4,
|
|
|
|
+ gHorizScrollbar.scroll.styleTrough);
|
|
|
|
+
|
2015-12-16 11:52:28 +00:00
|
|
|
+ gVertScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
|
|
|
|
+ setup_widget_prototype(gVertScrollbar.widget);
|
|
|
|
+
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gVertScrollbar.scroll.style = moz_gtk_style_create(path+1, NULL);
|
2016-04-20 17:04:32 +00:00
|
|
|
+ gVertScrollbar.scroll.styleContents = moz_gtk_style_create(path+2,
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gVertScrollbar.scroll.style);
|
2016-04-20 17:04:32 +00:00
|
|
|
+ gVertScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3,
|
|
|
|
+ gVertScrollbar.scroll.styleContents);
|
|
|
|
+ gVertScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4,
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gVertScrollbar.scroll.styleTrough);
|
2015-12-16 11:52:28 +00:00
|
|
|
+
|
2016-04-20 17:04:32 +00:00
|
|
|
+ }
|
2015-12-16 11:52:28 +00:00
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-20 17:04:32 +00:00
|
|
|
|
2016-03-15 13:50:37 +00:00
|
|
|
static gint
|
|
|
|
ensure_spin_widget()
|
|
|
|
{
|
|
|
|
- if (!gSpinWidget) {
|
|
|
|
- gSpinWidget = gtk_spin_button_new(NULL, 1, 0);
|
|
|
|
- setup_widget_prototype(gSpinWidget);
|
|
|
|
- }
|
|
|
|
- return MOZ_GTK_SUCCESS;
|
|
|
|
+ if (!gSpin.widget) {
|
|
|
|
+ GtkCssNode path[] = {
|
|
|
|
+ { GTK_TYPE_SPIN_BUTTON, "spinbutton", "horizontal", NULL },
|
|
|
|
+ { GTK_TYPE_SPIN_BUTTON, "spinbutton", "vertical", NULL },
|
|
|
|
+ { GTK_TYPE_ENTRY, "entry", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "button", "up", NULL },
|
|
|
|
+ { G_TYPE_NONE, "button", "down", NULL }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ gSpin.widget = gtk_spin_button_new(NULL, 1, 0);
|
|
|
|
+ setup_widget_prototype(gSpin.widget);
|
|
|
|
+
|
|
|
|
+ gSpin.spin.style = moz_gtk_style_create(path, NULL);
|
|
|
|
+ gSpin.spin.styleButtonUp = moz_gtk_style_create(path+3, gSpin.spin.style);
|
|
|
|
+ gSpin.spin.styleButtonDown = moz_gtk_style_create(path+4, gSpin.spin.style);
|
|
|
|
+ gSpin.spin.styleEntry = moz_gtk_style_create(path+2, gSpin.spin.style);
|
|
|
|
+ }
|
|
|
|
+ return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -253,9 +434,19 @@ ensure_scale_widget()
|
2016-03-15 13:50:37 +00:00
|
|
|
static gint
|
|
|
|
ensure_entry_widget()
|
|
|
|
{
|
|
|
|
- if (!gEntryWidget) {
|
|
|
|
- gEntryWidget = gtk_entry_new();
|
|
|
|
- setup_widget_prototype(gEntryWidget);
|
|
|
|
+ if (!gEntry.widget) {
|
|
|
|
+ GtkCssNode path[] = {
|
|
|
|
+ { GTK_TYPE_ENTRY, "entry", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "selection", NULL, NULL }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ gEntry.widget = gtk_entry_new();
|
|
|
|
+ setup_widget_prototype(gEntry.widget);
|
|
|
|
+ gtk_widget_show(gEntry.widget);
|
|
|
|
+
|
|
|
|
+ gEntry.entry.style = moz_gtk_style_create(&path[0], NULL);
|
|
|
|
+ gEntry.entry.styleSelection = moz_gtk_style_create(&path[1],
|
|
|
|
+ gEntry.entry.style);
|
|
|
|
}
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -387,9 +578,9 @@ moz_gtk_get_combo_box_entry_inner_widget
|
2016-03-15 13:50:37 +00:00
|
|
|
g_object_add_weak_pointer(G_OBJECT(widget),
|
|
|
|
(gpointer) &gComboBoxEntryButtonWidget);
|
|
|
|
} else if (GTK_IS_ENTRY(widget)) {
|
|
|
|
- gComboBoxEntryTextareaWidget = widget;
|
|
|
|
+ gComboBoxEntryTextarea.widget = widget;
|
|
|
|
g_object_add_weak_pointer(G_OBJECT(widget),
|
|
|
|
- (gpointer) &gComboBoxEntryTextareaWidget);
|
|
|
|
+ (gpointer) &gComboBoxEntryTextarea.widget);
|
|
|
|
} else
|
|
|
|
return;
|
|
|
|
gtk_widget_realize(widget);
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -411,7 +602,7 @@ ensure_combo_box_entry_widgets()
|
2016-03-15 13:50:37 +00:00
|
|
|
{
|
|
|
|
GtkWidget* buttonChild;
|
|
|
|
|
|
|
|
- if (gComboBoxEntryTextareaWidget &&
|
|
|
|
+ if (gComboBoxEntryTextarea.widget &&
|
|
|
|
gComboBoxEntryButtonWidget &&
|
|
|
|
gComboBoxEntryArrowWidget)
|
|
|
|
return MOZ_GTK_SUCCESS;
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -427,9 +618,9 @@ ensure_combo_box_entry_widgets()
|
2016-03-15 13:50:37 +00:00
|
|
|
moz_gtk_get_combo_box_entry_inner_widgets,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
- if (!gComboBoxEntryTextareaWidget) {
|
|
|
|
+ if (!gComboBoxEntryTextarea.widget) {
|
|
|
|
ensure_entry_widget();
|
|
|
|
- gComboBoxEntryTextareaWidget = gEntryWidget;
|
|
|
|
+ gComboBoxEntryTextarea.widget = gEntry.widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gComboBoxEntryButtonWidget) {
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -530,9 +721,21 @@ ensure_tab_widget()
|
2016-01-13 15:43:54 +00:00
|
|
|
static gint
|
|
|
|
ensure_progress_widget()
|
|
|
|
{
|
|
|
|
- if (!gProgressWidget) {
|
|
|
|
- gProgressWidget = gtk_progress_bar_new();
|
|
|
|
- setup_widget_prototype(gProgressWidget);
|
|
|
|
+ if (!gProgressBar.widget) {
|
|
|
|
+ GtkCssNode path[] = {
|
2016-03-15 13:50:37 +00:00
|
|
|
+ { GTK_TYPE_LABEL, "progressbar", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "trough", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "progress", NULL, NULL },
|
2016-01-13 15:43:54 +00:00
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ gProgressBar.widget = gtk_progress_bar_new();
|
|
|
|
+ setup_widget_prototype(gProgressBar.widget);
|
|
|
|
+
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gProgressBar.progress.style = moz_gtk_style_create(&path[0], NULL);
|
|
|
|
+ gProgressBar.progress.styleTrough = moz_gtk_style_create(&path[1],
|
|
|
|
+ gProgressBar.progress.style);
|
|
|
|
+ gProgressBar.progress.styleProgress = moz_gtk_style_create(&path[2],
|
|
|
|
+ gProgressBar.progress.styleTrough);
|
2016-01-13 15:43:54 +00:00
|
|
|
}
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -638,6 +841,11 @@ static gint
|
2016-03-15 13:50:37 +00:00
|
|
|
ensure_check_menu_item_widget()
|
|
|
|
{
|
|
|
|
if (!gCheckMenuItemWidget) {
|
|
|
|
+ GtkCssNode path[] = {
|
|
|
|
+ { GTK_TYPE_CHECK_MENU_ITEM, "menuitem", NULL, NULL },
|
|
|
|
+ { G_TYPE_NONE, "check", NULL, NULL }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
ensure_menu_popup_widget();
|
|
|
|
gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
|
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -752,7 +960,7 @@ moz_gtk_checkbox_get_metrics(gint* indic
|
2015-12-16 11:52:28 +00:00
|
|
|
{
|
|
|
|
ensure_checkbox_widget();
|
|
|
|
|
|
|
|
- gtk_widget_style_get (gCheckboxWidget,
|
|
|
|
+ gtk_widget_style_get (gCheckbox.widget,
|
|
|
|
"indicator_size", indicator_size,
|
|
|
|
"indicator_spacing", indicator_spacing,
|
|
|
|
NULL);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -765,7 +973,7 @@ moz_gtk_radio_get_metrics(gint* indicato
|
2015-12-16 11:52:28 +00:00
|
|
|
{
|
|
|
|
ensure_radiobutton_widget();
|
|
|
|
|
|
|
|
- gtk_widget_style_get (gRadiobuttonWidget,
|
|
|
|
+ gtk_widget_style_get (gRadiobutton.widget,
|
|
|
|
"indicator_size", indicator_size,
|
|
|
|
"indicator_spacing", indicator_spacing,
|
|
|
|
NULL);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -778,13 +986,12 @@ moz_gtk_get_focus_outline_size(gint* foc
|
2016-03-15 13:50:37 +00:00
|
|
|
{
|
|
|
|
GtkBorder border;
|
|
|
|
GtkBorder padding;
|
|
|
|
- GtkStyleContext *style;
|
|
|
|
+ GtkStyleContext* style = gEntry.entry.style;
|
|
|
|
|
|
|
|
ensure_entry_widget();
|
|
|
|
- style = gtk_widget_get_style_context(gEntryWidget);
|
|
|
|
|
|
|
|
- gtk_style_context_get_border(style, 0, &border);
|
|
|
|
- gtk_style_context_get_padding(style, 0, &padding);
|
|
|
|
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
|
|
|
|
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
|
|
|
|
*focus_h_width = border.left + padding.left;
|
|
|
|
*focus_v_width = border.top + padding.top;
|
|
|
|
return MOZ_GTK_SUCCESS;
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -821,7 +1028,7 @@ moz_gtk_button_get_default_overflow(gint
|
2016-03-15 13:50:37 +00:00
|
|
|
GtkBorder* default_outside_border;
|
|
|
|
|
|
|
|
ensure_button_widget();
|
|
|
|
- gtk_widget_style_get(gButtonWidget,
|
|
|
|
+ gtk_widget_style_get(gButton.widget,
|
|
|
|
"default-outside-border", &default_outside_border,
|
|
|
|
NULL);
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -844,7 +1051,7 @@ moz_gtk_button_get_default_border(gint*
|
2016-03-15 13:50:37 +00:00
|
|
|
GtkBorder* default_border;
|
|
|
|
|
|
|
|
ensure_button_widget();
|
|
|
|
- gtk_widget_style_get(gButtonWidget,
|
|
|
|
+ gtk_widget_style_get(gButton.widget,
|
|
|
|
"default-border", &default_border,
|
|
|
|
NULL);
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -935,7 +1142,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
|
2016-03-15 13:50:37 +00:00
|
|
|
|
|
|
|
if (state->focused) {
|
|
|
|
GtkBorder border;
|
|
|
|
- gtk_style_context_get_border(style, state_flags, &border);
|
|
|
|
+ moz_gtk_get_style_border(style, state_flags, &border);
|
|
|
|
x += border.left;
|
|
|
|
y += border.top;
|
|
|
|
width -= (border.left + border.right);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -956,15 +1163,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
|
2015-12-16 11:52:28 +00:00
|
|
|
gint indicator_size, indicator_spacing;
|
|
|
|
gint x, y, width, height;
|
|
|
|
gint focus_x, focus_y, focus_width, focus_height;
|
|
|
|
- GtkWidget *w;
|
|
|
|
- GtkStyleContext *style;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ MozGtkWidget *w;
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
if (isradio) {
|
|
|
|
moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing);
|
|
|
|
- w = gRadiobuttonWidget;
|
|
|
|
+ w = &gRadiobutton;
|
|
|
|
} else {
|
|
|
|
moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing);
|
|
|
|
- w = gCheckboxWidget;
|
|
|
|
+ w = &gCheckbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX we should assert rect->height >= indicator_size too
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -983,11 +1189,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
|
2015-12-16 11:52:28 +00:00
|
|
|
focus_width = width + 2 * indicator_spacing;
|
|
|
|
focus_height = height + 2 * indicator_spacing;
|
|
|
|
|
|
|
|
- style = gtk_widget_get_style_context(w);
|
|
|
|
-
|
|
|
|
- gtk_widget_set_sensitive(w, !state->disabled);
|
|
|
|
- gtk_widget_set_direction(w, direction);
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
+ gtk_widget_set_sensitive(w->widget, !state->disabled);
|
|
|
|
+ gtk_widget_set_direction(w->widget, direction);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_save(w->check.styleCheck);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
if (selected)
|
|
|
|
state_flags |= checkbox_check_state;
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -995,13 +1199,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
|
2015-12-16 11:52:28 +00:00
|
|
|
if (inconsistent)
|
|
|
|
state_flags |= GTK_STATE_FLAG_INCONSISTENT;
|
|
|
|
|
|
|
|
- gtk_style_context_set_state(style, state_flags);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_set_state(w->check.styleCheck, state_flags);
|
|
|
|
+
|
|
|
|
+ gtk_render_background(w->check.styleCheck, cr, x, y, width, height);
|
|
|
|
+ gtk_render_frame(w->check.styleCheck, cr, x, y, width, height);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
2015-12-16 19:45:47 +00:00
|
|
|
if (isradio) {
|
2015-12-16 11:52:28 +00:00
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
|
|
|
|
- gtk_render_option(style, cr, x, y, width, height);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_option(w->check.styleCheck, cr, x, y, width, height);
|
2015-12-16 11:52:28 +00:00
|
|
|
if (state->focused) {
|
|
|
|
- gtk_render_focus(style, cr, focus_x, focus_y,
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_focus(w->check.styleCheck, cr, focus_x, focus_y,
|
2015-12-16 11:52:28 +00:00
|
|
|
focus_width, focus_height);
|
|
|
|
}
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1010,15 +1216,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
|
2015-12-16 11:52:28 +00:00
|
|
|
* 'indeterminate' type on checkboxes. In GTK, the shadow type
|
|
|
|
* must also be changed for the state to be drawn.
|
|
|
|
*/
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
|
|
|
|
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), inconsistent);
|
|
|
|
- gtk_render_check(style, cr, x, y, width, height);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(w->widget), inconsistent);
|
|
|
|
+ gtk_render_check(w->check.styleCheck, cr, x, y, width, height);
|
2015-12-16 11:52:28 +00:00
|
|
|
if (state->focused) {
|
|
|
|
- gtk_render_focus(style, cr,
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_focus(w->check.styleCheck, cr,
|
2015-12-16 11:52:28 +00:00
|
|
|
focus_x, focus_y, focus_width, focus_height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- gtk_style_context_restore(style);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_restore(w->check.styleCheck);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1035,8 +1240,8 @@ calculate_button_inner_rect(GtkWidget* b
|
2016-03-15 13:50:37 +00:00
|
|
|
style = gtk_widget_get_style_context(button);
|
|
|
|
|
|
|
|
/* This mirrors gtkbutton's child positioning */
|
|
|
|
- gtk_style_context_get_border(style, 0, &border);
|
|
|
|
- gtk_style_context_get_padding(style, 0, &padding);
|
|
|
|
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
|
|
|
|
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
|
|
|
|
|
|
|
|
inner_rect->x = rect->x + border.left + padding.left;
|
|
|
|
inner_rect->y = rect->y + padding.top + border.top;
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1099,9 +1304,9 @@ moz_gtk_scrollbar_button_paint(cairo_t *
|
2015-12-16 11:52:28 +00:00
|
|
|
ensure_scrollbar_widget();
|
|
|
|
|
|
|
|
if (flags & MOZ_GTK_STEPPER_VERTICAL)
|
|
|
|
- scrollbar = gVertScrollbarWidget;
|
|
|
|
+ scrollbar = gVertScrollbar.widget;
|
|
|
|
else
|
|
|
|
- scrollbar = gHorizScrollbarWidget;
|
|
|
|
+ scrollbar = gHorizScrollbar.widget;
|
|
|
|
|
|
|
|
gtk_widget_set_direction(scrollbar, direction);
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1181,25 +1386,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
|
2015-12-16 11:52:28 +00:00
|
|
|
GtkTextDirection direction)
|
|
|
|
{
|
|
|
|
GtkStyleContext* style;
|
|
|
|
- GtkScrollbar *scrollbar;
|
2016-03-15 13:50:37 +00:00
|
|
|
|
2015-12-16 11:52:28 +00:00
|
|
|
ensure_scrollbar_widget();
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
- if (widget == MOZ_GTK_SCROLLBAR_HORIZONTAL)
|
2015-12-16 11:52:28 +00:00
|
|
|
- scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
|
|
|
|
- else
|
|
|
|
- scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
|
|
|
|
-
|
|
|
|
- gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
|
2016-04-25 12:58:04 +00:00
|
|
|
-
|
2015-12-16 11:52:28 +00:00
|
|
|
if (flags & MOZ_GTK_TRACK_OPAQUE) {
|
|
|
|
style = gtk_widget_get_style_context(GTK_WIDGET(gProtoWindow));
|
|
|
|
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
|
|
|
|
}
|
|
|
|
|
|
|
|
- style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar));
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
|
2016-04-25 18:28:28 +00:00
|
|
|
+ if (widget == MOZ_GTK_SCROLLBAR_HORIZONTAL) {
|
2016-04-25 12:58:04 +00:00
|
|
|
+ gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction);
|
|
|
|
+ style = gHorizScrollbar.scroll.style;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction);
|
|
|
|
+ style = gVertScrollbar.scroll.style;
|
|
|
|
+ }
|
|
|
|
|
2015-12-16 11:52:28 +00:00
|
|
|
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
|
|
|
|
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1208,7 +1410,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
|
2015-12-16 11:52:28 +00:00
|
|
|
gtk_render_focus(style, cr,
|
|
|
|
rect->x, rect->y, rect->width, rect->height);
|
|
|
|
}
|
|
|
|
- gtk_style_context_restore(style);
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1220,24 +1421,20 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
|
2016-03-15 13:50:37 +00:00
|
|
|
{
|
|
|
|
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
|
|
|
|
GtkStyleContext* style;
|
|
|
|
- GtkScrollbar *scrollbar;
|
|
|
|
GtkBorder margin;
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
ensure_scrollbar_widget();
|
|
|
|
|
|
|
|
- if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
|
|
|
|
- scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
|
|
|
|
- else
|
|
|
|
- scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
|
|
|
|
-
|
|
|
|
- gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
|
|
|
|
-
|
|
|
|
- style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar));
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
+ if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) {
|
2016-03-15 13:50:37 +00:00
|
|
|
+ style = gHorizScrollbar.scroll.styleSlider;
|
2015-12-16 11:52:28 +00:00
|
|
|
+ gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction);
|
|
|
|
+ }
|
|
|
|
+ else {
|
2016-04-25 12:58:04 +00:00
|
|
|
+ style = gVertScrollbar.scroll.styleSlider;
|
2015-12-16 11:52:28 +00:00
|
|
|
+ gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_SLIDER);
|
|
|
|
gtk_style_context_set_state(style, state_flags);
|
|
|
|
-
|
|
|
|
gtk_style_context_get_margin (style, state_flags, &margin);
|
|
|
|
|
|
|
|
gtk_render_slider(style, cr,
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1248,8 +1445,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
|
2015-12-16 11:52:28 +00:00
|
|
|
(widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ?
|
|
|
|
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
|
|
|
- gtk_style_context_restore(style);
|
|
|
|
-
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1260,8 +1455,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta
|
2016-03-15 13:50:37 +00:00
|
|
|
GtkStyleContext* style;
|
|
|
|
|
|
|
|
ensure_spin_widget();
|
|
|
|
- gtk_widget_set_direction(gSpinWidget, direction);
|
|
|
|
- style = gtk_widget_get_style_context(gSpinWidget);
|
|
|
|
+ gtk_widget_set_direction(gSpin.widget, direction);
|
|
|
|
+ style = gSpin.spin.style;
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
|
|
|
|
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1280,11 +1475,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G
|
2016-03-15 13:50:37 +00:00
|
|
|
GtkStyleContext* style;
|
|
|
|
|
|
|
|
ensure_spin_widget();
|
|
|
|
- style = gtk_widget_get_style_context(gSpinWidget);
|
|
|
|
+ style = gSpin.spin.style;
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
|
|
|
|
gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
|
|
|
|
- gtk_widget_set_direction(gSpinWidget, direction);
|
|
|
|
+ gtk_widget_set_direction(gSpin.widget, direction);
|
|
|
|
|
|
|
|
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
|
|
|
|
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1450,15 +1644,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec
|
2016-03-15 13:50:37 +00:00
|
|
|
static gint
|
|
|
|
moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
|
|
|
|
GtkWidgetState* state,
|
|
|
|
- GtkWidget* widget, GtkTextDirection direction)
|
|
|
|
+ MozGtkWidget* w, GtkTextDirection direction)
|
|
|
|
{
|
|
|
|
gint x = rect->x, y = rect->y, width = rect->width, height = rect->height;
|
|
|
|
- GtkStyleContext* style;
|
|
|
|
int draw_focus_outline_only = state->depressed; // NS_THEME_FOCUS_OUTLINE
|
|
|
|
+ GtkStyleContext* style = w->entry.style;
|
|
|
|
|
|
|
|
- gtk_widget_set_direction(widget, direction);
|
|
|
|
-
|
|
|
|
- style = gtk_widget_get_style_context(widget);
|
|
|
|
+ gtk_widget_set_direction(w->widget, direction);
|
|
|
|
|
|
|
|
if (draw_focus_outline_only) {
|
|
|
|
// Inflate the given 'rect' with the focus outline size.
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1478,10 +1670,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
|
2016-03-15 13:50:37 +00:00
|
|
|
* textarea window uses gtk_paint_flat_box when exposed */
|
|
|
|
|
|
|
|
/* This gets us a lovely greyish disabledish look */
|
|
|
|
- gtk_widget_set_sensitive(widget, !state->disabled);
|
|
|
|
+ gtk_widget_set_sensitive(w->widget, !state->disabled);
|
|
|
|
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_ENTRY);
|
|
|
|
|
|
|
|
/* Now paint the shadow and focus border.
|
|
|
|
* We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1531,7 +1722,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR
|
2016-03-15 13:50:37 +00:00
|
|
|
style = gtk_widget_get_style_context(gScrolledWindowWidget);
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME);
|
|
|
|
- gtk_style_context_get_border(style, state_flags, &border);
|
|
|
|
+ moz_gtk_get_style_border(style, state_flags, &border);
|
|
|
|
xthickness = border.left;
|
|
|
|
ythickness = border.top;
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1702,7 +1893,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
|
2016-03-15 13:50:37 +00:00
|
|
|
if (direction == GTK_TEXT_DIR_LTR) {
|
|
|
|
GtkBorder padding;
|
|
|
|
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
|
|
|
|
- gtk_style_context_get_padding(style, state_flags, &padding);
|
|
|
|
+ moz_gtk_get_style_padding(style, state_flags, &padding);
|
|
|
|
arrow_rect.x -= padding.left;
|
|
|
|
}
|
|
|
|
else
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1804,29 +1995,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk
|
2015-12-16 11:52:28 +00:00
|
|
|
gboolean isradio, GtkTextDirection direction)
|
|
|
|
{
|
|
|
|
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
|
|
|
|
- GtkStyleContext* style;
|
|
|
|
- GtkWidget *widget;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ MozGtkWidget *widget;
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
if (isradio) {
|
|
|
|
ensure_radiobutton_widget();
|
|
|
|
- widget = gRadiobuttonWidget;
|
|
|
|
+ widget = &gRadiobutton;
|
|
|
|
} else {
|
|
|
|
ensure_checkbox_widget();
|
|
|
|
- widget = gCheckboxWidget;
|
|
|
|
+ widget = &gCheckbox;
|
|
|
|
}
|
|
|
|
- gtk_widget_set_direction(widget, direction);
|
|
|
|
+ gtk_widget_set_direction(widget->widget, direction);
|
|
|
|
|
|
|
|
- style = gtk_widget_get_style_context(widget);
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_set_state(style, state_flags);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_save(widget->check.style);
|
|
|
|
+ gtk_style_context_set_state(widget->check.style, state_flags);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
/* this is for drawing a prelight box */
|
|
|
|
if (state_flags & GTK_STATE_FLAG_PRELIGHT) {
|
|
|
|
- gtk_render_background(style, cr,
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_background(widget->check.style, cr,
|
2015-12-16 11:52:28 +00:00
|
|
|
rect->x, rect->y, rect->width, rect->height);
|
|
|
|
}
|
|
|
|
|
|
|
|
- gtk_style_context_restore(style);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_restore(widget->check.style);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1836,32 +2025,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr,
|
2015-12-16 11:52:28 +00:00
|
|
|
GtkWidgetState* state,
|
|
|
|
gboolean isradio, GtkTextDirection direction)
|
|
|
|
{
|
|
|
|
- GtkStyleContext *style;
|
|
|
|
- GtkWidget *widget;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ MozGtkWidget *widget;
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
if (!state->focused)
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
|
|
|
|
if (isradio) {
|
|
|
|
ensure_radiobutton_widget();
|
|
|
|
- widget = gRadiobuttonWidget;
|
|
|
|
+ widget = &gRadiobutton;
|
|
|
|
} else {
|
|
|
|
ensure_checkbox_widget();
|
|
|
|
- widget = gCheckboxWidget;
|
2016-04-20 17:04:32 +00:00
|
|
|
+ widget = &gCheckbox;
|
|
|
|
}
|
2015-12-16 11:52:28 +00:00
|
|
|
- style = gtk_widget_get_style_context(widget);
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
- if (isradio) {
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
|
|
|
|
- } else {
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
|
2016-04-20 17:04:32 +00:00
|
|
|
- }
|
2015-12-16 11:52:28 +00:00
|
|
|
- gtk_widget_set_direction(widget, direction);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_save(widget->check.styleLabel);
|
2015-12-16 11:52:28 +00:00
|
|
|
+ gtk_widget_set_direction(widget->widget, direction);
|
|
|
|
|
|
|
|
- gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
|
|
|
|
- gtk_render_focus(style, cr,
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_set_state(widget->check.styleLabel,
|
|
|
|
+ GetStateFlagsFromGtkWidgetState(state));
|
|
|
|
+ gtk_render_focus(widget->check.styleLabel, cr,
|
2015-12-16 11:52:28 +00:00
|
|
|
rect->x, rect->y, rect->width, rect->height);
|
|
|
|
- gtk_style_context_restore(style);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_style_context_restore(widget->check.styleLabel);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1922,7 +2105,7 @@ moz_gtk_toolbar_separator_paint(cairo_t
|
2016-03-15 13:50:37 +00:00
|
|
|
rect->height * (end_fraction - start_fraction));
|
|
|
|
} else {
|
|
|
|
GtkBorder padding;
|
|
|
|
- gtk_style_context_get_padding(style, 0, &padding);
|
|
|
|
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
|
|
|
|
|
|
|
|
paint_width = padding.left;
|
|
|
|
if (paint_width > rect->width)
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -2006,18 +2189,13 @@ static gint
|
2016-01-13 15:43:54 +00:00
|
|
|
moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
|
|
|
|
GtkTextDirection direction)
|
|
|
|
{
|
|
|
|
- GtkStyleContext* style;
|
|
|
|
-
|
|
|
|
ensure_progress_widget();
|
|
|
|
- gtk_widget_set_direction(gProgressWidget, direction);
|
|
|
|
+ gtk_widget_set_direction(gProgressBar.widget, direction);
|
|
|
|
|
|
|
|
- style = gtk_widget_get_style_context(gProgressWidget);
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
|
|
|
|
-
|
|
|
|
- gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
|
|
|
|
- gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
|
|
|
|
- gtk_style_context_restore(style);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_background(gProgressBar.progress.styleTrough, cr,
|
2016-01-13 15:43:54 +00:00
|
|
|
+ rect->x, rect->y, rect->width, rect->height);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_frame(gProgressBar.progress.styleTrough, cr,
|
2016-01-13 15:43:54 +00:00
|
|
|
+ rect->x, rect->y, rect->width, rect->height);
|
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -2027,15 +2205,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
|
2016-01-13 15:43:54 +00:00
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkThemeWidgetType widget)
|
|
|
|
{
|
|
|
|
- GtkStyleContext* style;
|
|
|
|
-
|
|
|
|
ensure_progress_widget();
|
|
|
|
- gtk_widget_set_direction(gProgressWidget, direction);
|
|
|
|
-
|
|
|
|
- style = gtk_widget_get_style_context(gProgressWidget);
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
|
|
|
|
+ gtk_widget_set_direction(gProgressBar.widget, direction);
|
2016-03-15 13:50:37 +00:00
|
|
|
|
2016-01-13 15:43:54 +00:00
|
|
|
if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
|
|
|
|
widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -2074,12 +2245,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
|
2016-01-13 15:43:54 +00:00
|
|
|
// gtk_render_activity was used to render progress chunks on GTK versions
|
|
|
|
// before 3.13.7, see bug 1173907.
|
|
|
|
if (!gtk_check_version(3, 13, 7)) {
|
|
|
|
- gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
|
|
|
|
- gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_background(gProgressBar.progress.styleProgress, cr,
|
2016-01-13 15:43:54 +00:00
|
|
|
+ rect->x, rect->y, rect->width, rect->height);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_frame(gProgressBar.progress.styleProgress, cr,
|
2016-01-13 15:43:54 +00:00
|
|
|
+ rect->x, rect->y, rect->width, rect->height);
|
|
|
|
} else {
|
|
|
|
- gtk_render_activity(style, cr, rect->x, rect->y, rect->width, rect->height);
|
2016-03-15 13:50:37 +00:00
|
|
|
+ gtk_render_activity(gProgressBar.progress.styleProgress, cr,
|
2016-01-13 15:43:54 +00:00
|
|
|
+ rect->x, rect->y, rect->width, rect->height);
|
2016-03-15 13:50:37 +00:00
|
|
|
}
|
|
|
|
- gtk_style_context_restore(style);
|
2016-01-13 15:43:54 +00:00
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -2096,7 +2269,7 @@ moz_gtk_get_tab_thickness(void)
|
2016-03-15 13:50:37 +00:00
|
|
|
|
|
|
|
style = gtk_widget_get_style_context(gTabWidget);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK);
|
|
|
|
- gtk_style_context_get_border(style, 0, &border);
|
|
|
|
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
|
|
|
|
|
|
|
|
if (border.top < 2)
|
|
|
|
return 2; /* some themes don't set ythickness correctly */
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -2292,7 +2465,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
|
2016-03-15 13:50:37 +00:00
|
|
|
gtk_style_context_save(style);
|
|
|
|
moz_gtk_tab_prepare_style_context(style, flags);
|
|
|
|
|
|
|
|
- gtk_style_context_get_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
|
|
|
|
+ moz_gtk_get_style_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
|
|
|
|
|
|
|
|
focusRect.x += padding.left;
|
|
|
|
focusRect.width -= (padding.left + padding.right);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -2408,7 +2581,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t *
|
2016-03-15 13:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
-moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect,
|
|
|
|
+moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state,
|
|
|
|
GtkTextDirection direction)
|
|
|
|
{
|
|
|
|
GtkStyleContext* style;
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -2468,7 +2641,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr
|
2016-03-15 13:50:37 +00:00
|
|
|
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);
|
|
|
|
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
|
|
|
|
|
|
|
|
x = rect->x + border_width;
|
|
|
|
y = rect->y + border_width;
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2521,7 +2694,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
|
2016-03-15 13:50:37 +00:00
|
|
|
item_widget = gMenuItemWidget;
|
|
|
|
}
|
|
|
|
style = gtk_widget_get_style_context(item_widget);
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
+// TODO - FIX!
|
|
|
|
+// gtk_style_context_save(style);
|
|
|
|
|
|
|
|
if (flags & MOZ_TOPLEVEL_MENU_ITEM) {
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2540,7 +2714,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
|
2016-03-15 13:50:37 +00:00
|
|
|
|
|
|
|
gtk_render_background(style, cr, x, y, w, h);
|
|
|
|
gtk_render_frame(style, cr, x, y, w, h);
|
|
|
|
- gtk_style_context_restore(style);
|
|
|
|
+// gtk_style_context_restore(style);
|
|
|
|
}
|
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2556,7 +2730,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
|
2016-03-15 13:50:37 +00:00
|
|
|
|
|
|
|
ensure_menu_item_widget();
|
|
|
|
gtk_widget_set_direction(gMenuItemWidget, direction);
|
|
|
|
-
|
|
|
|
+/*
|
|
|
|
+ state_flags |= (direction == GTK_TEXT_DIR_LTR) ? GTK_STATE_FLAG_DIR_LTR :
|
|
|
|
+ GTK_STATE_FLAG_DIR_RTL;
|
|
|
|
+*/
|
|
|
|
style = gtk_widget_get_style_context(gMenuItemWidget);
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUITEM);
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2606,7 +2783,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c
|
2016-03-15 13:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_style_context_set_state(style, state_flags);
|
|
|
|
- gtk_style_context_get_padding(style, state_flags, &padding);
|
|
|
|
+ moz_gtk_get_style_padding(style, state_flags, &padding);
|
|
|
|
|
|
|
|
offset = gtk_container_get_border_width(GTK_CONTAINER(gCheckMenuItemWidget)) +
|
|
|
|
padding.left + 2;
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2658,7 +2835,7 @@ moz_gtk_add_style_border(GtkStyleContext
|
2016-03-15 13:50:37 +00:00
|
|
|
{
|
|
|
|
GtkBorder border;
|
|
|
|
|
|
|
|
- gtk_style_context_get_border(style, 0, &border);
|
|
|
|
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
|
|
|
|
|
|
|
|
*left += border.left;
|
|
|
|
*right += border.right;
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2667,12 +2844,22 @@ moz_gtk_add_style_border(GtkStyleContext
|
2016-03-15 13:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
+moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
|
|
|
|
+ GtkBorder *border)
|
|
|
|
+{
|
|
|
|
+ gtk_style_context_save(style);
|
|
|
|
+ gtk_style_context_set_state(style, state_flags);
|
|
|
|
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), border);
|
|
|
|
+ gtk_style_context_restore(style);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
moz_gtk_add_style_padding(GtkStyleContext* style,
|
|
|
|
gint* left, gint* top, gint* right, gint* bottom)
|
|
|
|
{
|
|
|
|
GtkBorder padding;
|
|
|
|
|
|
|
|
- gtk_style_context_get_padding(style, 0, &padding);
|
|
|
|
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
|
|
|
|
|
|
|
|
*left += padding.left;
|
|
|
|
*right += padding.right;
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2680,6 +2867,16 @@ moz_gtk_add_style_padding(GtkStyleContex
|
2016-03-15 13:50:37 +00:00
|
|
|
*bottom += padding.bottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void
|
|
|
|
+moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
|
|
|
|
+ GtkBorder *padding)
|
|
|
|
+{
|
|
|
|
+ gtk_style_context_save(style);
|
|
|
|
+ gtk_style_context_set_state(style, state_flags);
|
|
|
|
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), padding);
|
|
|
|
+ gtk_style_context_restore(style);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
gint
|
|
|
|
moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
|
|
|
|
gint* right, gint* bottom, GtkTextDirection direction,
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2694,36 +2891,27 @@ moz_gtk_get_widget_border(GtkThemeWidget
|
2016-03-15 13:50:37 +00:00
|
|
|
case MOZ_GTK_TOOLBAR_BUTTON:
|
|
|
|
{
|
|
|
|
ensure_button_widget();
|
|
|
|
- style = gtk_widget_get_style_context(gButtonWidget);
|
|
|
|
-
|
2016-04-20 17:04:32 +00:00
|
|
|
- *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButtonWidget));
|
|
|
|
|
2016-03-15 13:50:37 +00:00
|
|
|
- if (widget == MOZ_GTK_TOOLBAR_BUTTON) {
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_add_class(style, "image-button");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- moz_gtk_add_style_padding(style, left, top, right, bottom);
|
|
|
|
-
|
|
|
|
- if (widget == MOZ_GTK_TOOLBAR_BUTTON)
|
|
|
|
- gtk_style_context_restore(style);
|
|
|
|
+ *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButton.widget));
|
|
|
|
+ moz_gtk_add_style_padding(gButton.button.style, left, top, right, bottom);
|
|
|
|
|
|
|
|
// XXX: Subtract 1 pixel from the border to account for the added
|
|
|
|
// -moz-focus-inner border (Bug 1228281).
|
|
|
|
*left -= 1; *top -= 1; *right -= 1; *bottom -= 1;
|
|
|
|
- moz_gtk_add_style_border(style, left, top, right, bottom);
|
|
|
|
+ moz_gtk_add_style_border(gButton.button.style, left, top, right, bottom);
|
|
|
|
+
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
|
|
|
case MOZ_GTK_ENTRY:
|
|
|
|
{
|
|
|
|
ensure_entry_widget();
|
|
|
|
- style = gtk_widget_get_style_context(gEntryWidget);
|
|
|
|
|
|
|
|
// XXX: Subtract 1 pixel from the padding to account for the default
|
|
|
|
// padding in forms.css. See bug 1187385.
|
|
|
|
*left = *top = *right = *bottom = -1;
|
|
|
|
- moz_gtk_add_style_padding(style, left, top, right, bottom);
|
|
|
|
- moz_gtk_add_style_border(style, left, top, right, bottom);
|
|
|
|
+
|
|
|
|
+ moz_gtk_add_style_padding(gEntry.entry.style, left, top, right, bottom);
|
|
|
|
+ moz_gtk_add_style_border(gEntry.entry.style, left, top, right, bottom);
|
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2759,7 +2947,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
|
2016-03-15 13:50:37 +00:00
|
|
|
break;
|
|
|
|
case MOZ_GTK_DROPDOWN_ENTRY:
|
|
|
|
ensure_combo_box_entry_widgets();
|
|
|
|
- w = gComboBoxEntryTextareaWidget;
|
|
|
|
+ w = gComboBoxEntryTextarea.widget;
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_DROPDOWN_ARROW:
|
|
|
|
ensure_combo_box_entry_widgets();
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2795,7 +2983,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
|
2016-03-15 13:50:37 +00:00
|
|
|
|
|
|
|
if (!wide_separators) {
|
|
|
|
style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
|
|
|
|
- gtk_style_context_get_border(style, 0, &border);
|
|
|
|
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
|
|
|
|
separator_width = border.left;
|
|
|
|
}
|
|
|
|
}
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2814,14 +3002,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
|
2016-01-13 15:43:54 +00:00
|
|
|
w = gTabWidget;
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_PROGRESSBAR:
|
|
|
|
- ensure_progress_widget();
|
|
|
|
- w = gProgressWidget;
|
|
|
|
- break;
|
|
|
|
+ {
|
|
|
|
+ ensure_progress_widget();
|
2016-03-15 13:50:37 +00:00
|
|
|
+ moz_gtk_add_style_border(gProgressBar.progress.styleTrough,
|
2016-01-13 15:43:54 +00:00
|
|
|
+ left, top, right, bottom);
|
|
|
|
+ return MOZ_GTK_SUCCESS;
|
|
|
|
+ }
|
|
|
|
case MOZ_GTK_SPINBUTTON_ENTRY:
|
|
|
|
case MOZ_GTK_SPINBUTTON_UP:
|
|
|
|
case MOZ_GTK_SPINBUTTON_DOWN:
|
2016-03-15 13:50:37 +00:00
|
|
|
ensure_spin_widget();
|
|
|
|
- w = gSpinWidget;
|
|
|
|
+ w = gSpin.widget;
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_SCALE_HORIZONTAL:
|
|
|
|
ensure_scale_widget();
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2840,12 +3031,13 @@ moz_gtk_get_widget_border(GtkThemeWidget
|
2015-12-16 11:52:28 +00:00
|
|
|
{
|
|
|
|
if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
|
|
|
|
ensure_checkbox_widget();
|
|
|
|
- w = gCheckboxWidget;
|
|
|
|
+ w = gCheckbox.widget;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ style = gCheckbox.check.styleCheck;
|
2015-12-16 11:52:28 +00:00
|
|
|
} else {
|
|
|
|
ensure_radiobutton_widget();
|
|
|
|
- w = gRadiobuttonWidget;
|
|
|
|
+ w = gRadiobutton.widget;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ style = gRadiobutton.check.styleCheck;
|
2015-12-16 11:52:28 +00:00
|
|
|
}
|
2016-01-13 15:43:54 +00:00
|
|
|
- style = gtk_widget_get_style_context(w);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
2016-01-13 15:43:54 +00:00
|
|
|
*left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
|
|
|
|
moz_gtk_add_style_border(style,
|
2016-04-20 17:04:32 +00:00
|
|
|
@@ -2978,6 +3170,32 @@ moz_gtk_get_combo_box_entry_button_size(
|
2016-03-15 13:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
+moz_gtk_get_entry_height(gint* height)
|
|
|
|
+{
|
|
|
|
+ GtkRequisition requisition;
|
|
|
|
+ ensure_entry_widget();
|
|
|
|
+
|
|
|
|
+ gtk_widget_get_preferred_size(gEntry.widget, NULL, &requisition);
|
|
|
|
+ *height = requisition.height;
|
|
|
|
+
|
|
|
|
+ return MOZ_GTK_SUCCESS;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+gint
|
|
|
|
+moz_gtk_get_button_height(gint* height)
|
|
|
|
+{
|
|
|
|
+ GtkRequisition requisition;
|
|
|
|
+ ensure_entry_widget();
|
|
|
|
+
|
|
|
|
+ gtk_widget_get_preferred_size(gButton.widget, NULL, &requisition);
|
|
|
|
+ *height = requisition.height;
|
|
|
|
+
|
|
|
|
+ return MOZ_GTK_SUCCESS;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+gint
|
|
|
|
moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height)
|
|
|
|
{
|
|
|
|
gint arrow_size;
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3030,7 +3248,7 @@ moz_gtk_get_toolbar_separator_width(gint
|
2016-03-15 13:50:37 +00:00
|
|
|
"separator-width", &separator_width,
|
|
|
|
NULL);
|
|
|
|
/* Just in case... */
|
|
|
|
- gtk_style_context_get_border(style, 0, &border);
|
|
|
|
+ gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
|
|
|
|
*size = MAX(*size, (wide_separators ? separator_width : border.left));
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3072,7 +3290,7 @@ moz_gtk_get_menu_separator_height(gint *
|
2016-03-15 13:50:37 +00:00
|
|
|
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);
|
|
|
|
+ gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
|
|
|
|
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3130,15 +3348,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro
|
2015-12-16 11:52:28 +00:00
|
|
|
{
|
|
|
|
ensure_scrollbar_widget();
|
|
|
|
|
|
|
|
- gtk_widget_style_get (gHorizScrollbarWidget,
|
|
|
|
+ gtk_widget_style_get (gHorizScrollbar.widget,
|
|
|
|
"slider_width", &metrics->slider_width,
|
|
|
|
"trough_border", &metrics->trough_border,
|
|
|
|
"stepper_size", &metrics->stepper_size,
|
2016-03-15 13:50:37 +00:00
|
|
|
"stepper_spacing", &metrics->stepper_spacing,
|
2015-12-16 11:52:28 +00:00
|
|
|
NULL);
|
|
|
|
|
2016-03-15 13:50:37 +00:00
|
|
|
- metrics->min_slider_size =
|
2015-12-16 11:52:28 +00:00
|
|
|
- gtk_range_get_min_slider_size(GTK_RANGE(gHorizScrollbarWidget));
|
2016-03-15 13:50:37 +00:00
|
|
|
+ if (!gtk_check_version(3,19,7)) {
|
|
|
|
+ gtk_style_context_get(gVertScrollbar.scroll.styleSlider,
|
|
|
|
+ gtk_style_context_get_state(gVertScrollbar.scroll.styleSlider),
|
|
|
|
+ "min-height", &metrics->min_slider_size, NULL);
|
|
|
|
+ } else {
|
|
|
|
+ metrics->min_slider_size =
|
|
|
|
+ gtk_range_get_min_slider_size(GTK_RANGE(gVertScrollbar.widget));
|
|
|
|
+ }
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
return MOZ_GTK_SUCCESS;
|
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3163,7 +3387,7 @@ moz_gtk_images_in_buttons()
|
2016-03-15 13:50:37 +00:00
|
|
|
GtkSettings* settings;
|
|
|
|
|
|
|
|
ensure_button_widget();
|
|
|
|
- settings = gtk_widget_get_settings(gButtonWidget);
|
|
|
|
+ settings = gtk_widget_get_settings(gButton.widget);
|
|
|
|
|
|
|
|
g_object_get(settings, "gtk-button-images", &result, NULL);
|
|
|
|
return result;
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3191,7 +3415,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
|
2016-03-15 13:50:37 +00:00
|
|
|
}
|
|
|
|
ensure_button_widget();
|
|
|
|
return moz_gtk_button_paint(cr, rect, state,
|
|
|
|
- (GtkReliefStyle) flags, gButtonWidget,
|
|
|
|
+ (GtkReliefStyle) flags, gButton.widget,
|
|
|
|
direction);
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_CHECKBUTTON:
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3241,7 +3465,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
|
2016-03-15 13:50:37 +00:00
|
|
|
case MOZ_GTK_SPINBUTTON_ENTRY:
|
|
|
|
ensure_spin_widget();
|
|
|
|
return moz_gtk_entry_paint(cr, rect, state,
|
|
|
|
- gSpinWidget, direction);
|
|
|
|
+ &gSpin, direction);
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_GRIPPER:
|
|
|
|
return moz_gtk_gripper_paint(cr, rect, state,
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3268,7 +3492,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
|
2016-03-15 13:50:37 +00:00
|
|
|
case MOZ_GTK_ENTRY:
|
|
|
|
ensure_entry_widget();
|
|
|
|
return moz_gtk_entry_paint(cr, rect, state,
|
|
|
|
- gEntryWidget, direction);
|
|
|
|
+ &gEntry, direction);
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_DROPDOWN:
|
|
|
|
return moz_gtk_combo_box_paint(cr, rect, state, direction);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3280,7 +3504,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
|
2016-03-15 13:50:37 +00:00
|
|
|
case MOZ_GTK_DROPDOWN_ENTRY:
|
|
|
|
ensure_combo_box_entry_widgets();
|
|
|
|
return moz_gtk_entry_paint(cr, rect, state,
|
|
|
|
- gComboBoxEntryTextareaWidget, direction);
|
|
|
|
+ &gComboBoxEntryTextarea, direction);
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_CHECKBUTTON_CONTAINER:
|
|
|
|
case MOZ_GTK_RADIOBUTTON_CONTAINER:
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3332,7 +3556,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
|
2016-03-15 13:50:37 +00:00
|
|
|
(GtkArrowType) flags, direction);
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_MENUBAR:
|
|
|
|
- return moz_gtk_menu_bar_paint(cr, rect, direction);
|
|
|
|
+ return moz_gtk_menu_bar_paint(cr, rect, state, direction);
|
|
|
|
break;
|
|
|
|
case MOZ_GTK_MENUPOPUP:
|
|
|
|
return moz_gtk_menu_popup_paint(cr, rect, direction);
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3383,7 +3607,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
|
2015-12-16 11:52:28 +00:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
|
|
|
|
ensure_scrollbar_widget();
|
|
|
|
- return gHorizScrollbarWidget;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ return gVertScrollbar.widget;
|
2015-12-16 11:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean moz_gtk_has_scrollbar_buttons(void)
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3391,7 +3615,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v
|
2015-12-16 11:52:28 +00:00
|
|
|
gboolean backward, forward, secondary_backward, secondary_forward;
|
|
|
|
MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
|
|
|
|
ensure_scrollbar_widget();
|
|
|
|
- gtk_widget_style_get (gHorizScrollbarWidget,
|
|
|
|
+ gtk_widget_style_get (gHorizScrollbar.widget,
|
|
|
|
"has-backward-stepper", &backward,
|
|
|
|
"has-forward-stepper", &forward,
|
|
|
|
"has-secondary-backward-stepper", &secondary_backward,
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3415,17 +3639,19 @@ moz_gtk_shutdown()
|
2016-03-15 13:50:37 +00:00
|
|
|
|
|
|
|
gProtoWindow = NULL;
|
|
|
|
gProtoLayout = NULL;
|
|
|
|
- gButtonWidget = NULL;
|
|
|
|
+
|
|
|
|
+ // MozWidgets
|
|
|
|
+ moz_gtk_widget_free(&gButton);
|
2015-12-16 11:52:28 +00:00
|
|
|
gToggleButtonWidget = NULL;
|
|
|
|
gButtonArrowWidget = NULL;
|
|
|
|
- gCheckboxWidget = NULL;
|
|
|
|
- gRadiobuttonWidget = NULL;
|
|
|
|
- gHorizScrollbarWidget = NULL;
|
|
|
|
- gVertScrollbarWidget = NULL;
|
2016-03-15 13:50:37 +00:00
|
|
|
- gSpinWidget = NULL;
|
|
|
|
+ moz_gtk_widget_free(&gCheckbox);
|
|
|
|
+ moz_gtk_widget_free(&gRadiobutton);
|
|
|
|
+ moz_gtk_widget_free(&gHorizScrollbar);
|
|
|
|
+ moz_gtk_widget_free(&gVertScrollbar);
|
|
|
|
+ moz_gtk_widget_free(&gSpin);
|
2015-12-16 11:52:28 +00:00
|
|
|
gHScaleWidget = NULL;
|
|
|
|
gVScaleWidget = NULL;
|
2016-03-15 13:50:37 +00:00
|
|
|
- gEntryWidget = NULL;
|
|
|
|
+ moz_gtk_widget_free(&gEntry);
|
|
|
|
gComboBoxWidget = NULL;
|
|
|
|
gComboBoxButtonWidget = NULL;
|
|
|
|
gComboBoxSeparatorWidget = NULL;
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -3433,12 +3659,12 @@ moz_gtk_shutdown()
|
2016-03-15 13:50:37 +00:00
|
|
|
gComboBoxEntryWidget = NULL;
|
|
|
|
gComboBoxEntryButtonWidget = NULL;
|
|
|
|
gComboBoxEntryArrowWidget = NULL;
|
|
|
|
- gComboBoxEntryTextareaWidget = NULL;
|
|
|
|
+ moz_gtk_widget_free(&gComboBoxEntryTextarea);
|
|
|
|
gHandleBoxWidget = NULL;
|
2016-01-13 15:43:54 +00:00
|
|
|
gToolbarWidget = NULL;
|
|
|
|
gStatusbarWidget = NULL;
|
|
|
|
gFrameWidget = NULL;
|
|
|
|
- gProgressWidget = NULL;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ moz_gtk_widget_free(&gProgressBar);
|
2016-01-13 15:43:54 +00:00
|
|
|
gTabWidget = NULL;
|
|
|
|
gTooltipWidget = NULL;
|
|
|
|
gMenuBarWidget = NULL;
|
2016-04-25 12:58:04 +00:00
|
|
|
diff -up firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20 firefox-46.0/widget/gtk/gtkdrawing.h
|
|
|
|
--- firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20 2016-04-22 02:37:27.000000000 +0200
|
|
|
|
+++ firefox-46.0/widget/gtk/gtkdrawing.h 2016-04-25 14:42:42.000000000 +0200
|
2015-12-16 19:45:47 +00:00
|
|
|
@@ -67,6 +67,13 @@ typedef enum {
|
|
|
|
MOZ_GTK_TAB_SELECTED = 1 << 10
|
|
|
|
} GtkTabFlags;
|
|
|
|
|
|
|
|
+typedef struct {
|
|
|
|
+ GType type;
|
|
|
|
+ const gchar *name;
|
|
|
|
+ const gchar *class1;
|
|
|
|
+ const gchar *class2;
|
|
|
|
+} GtkCssNode;
|
|
|
|
+
|
|
|
|
/** flags for menuitems **/
|
|
|
|
typedef enum {
|
|
|
|
/* menuitem is part of the menubar */
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -396,6 +403,9 @@ void
|
|
|
|
moz_gtk_get_arrow_size(GtkThemeWidgetType widgetType,
|
|
|
|
gint* width, gint* height);
|
2016-03-15 13:50:37 +00:00
|
|
|
|
|
|
|
+gint moz_gtk_get_entry_height(gint* height);
|
|
|
|
+gint moz_gtk_get_button_height(gint* height);
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Get the desired size of a toolbar separator
|
|
|
|
* size: [OUT] the desired width
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -466,6 +476,12 @@ gboolean moz_gtk_images_in_buttons(void)
|
2015-12-16 19:45:47 +00:00
|
|
|
*/
|
|
|
|
gboolean moz_gtk_has_scrollbar_buttons(void);
|
|
|
|
|
|
|
|
+
|
|
|
|
+GtkStyleContext *
|
|
|
|
+moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent);
|
2016-03-15 13:50:37 +00:00
|
|
|
+
|
|
|
|
+
|
2015-12-16 19:45:47 +00:00
|
|
|
+
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
2016-04-25 12:58:04 +00:00
|
|
|
diff -up firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-46.0/widget/gtk/mozgtk/mozgtk.c
|
|
|
|
--- firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 2016-04-22 02:37:27.000000000 +0200
|
|
|
|
+++ firefox-46.0/widget/gtk/mozgtk/mozgtk.c 2016-04-25 14:46:15.299592716 +0200
|
|
|
|
@@ -504,6 +504,11 @@ STUB(gtk_window_set_type_hint)
|
2016-03-15 13:50:37 +00:00
|
|
|
STUB(gtk_window_set_wmclass)
|
|
|
|
STUB(gtk_window_unfullscreen)
|
|
|
|
STUB(gtk_window_unmaximize)
|
|
|
|
+STUB(gtk_widget_get_preferred_height_and_baseline_for_width)
|
|
|
|
+STUB(gtk_entry_get_text_area)
|
|
|
|
+STUB(gtk_check_menu_item_get_type)
|
|
|
|
+STUB(gtk_spin_button_get_type)
|
2016-04-05 13:18:52 +00:00
|
|
|
+STUB(gtk_button_get_type)
|
2016-03-15 13:50:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GTK3_SYMBOLS
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -581,6 +586,13 @@ STUB(gtk_color_chooser_get_type)
|
2015-12-16 11:52:28 +00:00
|
|
|
STUB(gtk_color_chooser_set_rgba)
|
|
|
|
STUB(gtk_color_chooser_get_rgba)
|
|
|
|
STUB(gtk_color_chooser_set_use_alpha)
|
|
|
|
+STUB(gtk_style_context_get_path)
|
|
|
|
+STUB(gtk_widget_path_copy)
|
|
|
|
+STUB(gtk_widget_path_iter_set_object_name)
|
|
|
|
+STUB(gtk_widget_path_iter_add_class)
|
2016-03-29 09:33:27 +00:00
|
|
|
+STUB(gtk_widget_path_iter_get_state)
|
2015-12-16 11:52:28 +00:00
|
|
|
+STUB(gtk_style_context_set_parent)
|
|
|
|
+STUB(gtk_widget_path_unref)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GTK2_SYMBOLS
|
2016-04-25 12:58:04 +00:00
|
|
|
diff -up firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-46.0/widget/gtk/nsLookAndFeel.cpp
|
|
|
|
--- firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20 2016-04-22 02:37:27.000000000 +0200
|
|
|
|
+++ firefox-46.0/widget/gtk/nsLookAndFeel.cpp 2016-04-25 14:18:25.000000000 +0200
|
|
|
|
@@ -353,14 +353,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI
|
2016-03-15 13:50:37 +00:00
|
|
|
case eColorID_activeborder:
|
|
|
|
// active window border
|
|
|
|
gtk_style_context_get_border_color(mBackgroundStyle,
|
|
|
|
- GTK_STATE_FLAG_NORMAL, &gdk_color);
|
|
|
|
+ gtk_style_context_get_state(mBackgroundStyle),
|
|
|
|
+ &gdk_color);
|
|
|
|
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
|
|
|
|
break;
|
|
|
|
case eColorID_inactiveborder:
|
|
|
|
// inactive window border
|
|
|
|
+ gtk_style_context_save(mBackgroundStyle);
|
|
|
|
+ gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE);
|
|
|
|
gtk_style_context_get_border_color(mBackgroundStyle,
|
|
|
|
- GTK_STATE_FLAG_INSENSITIVE,
|
|
|
|
+ gtk_style_context_get_state(mBackgroundStyle),
|
|
|
|
&gdk_color);
|
|
|
|
+ gtk_style_context_restore(mBackgroundStyle);
|
|
|
|
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
|
|
|
|
break;
|
|
|
|
case eColorID_graytext: // disabled text in windows, menus, etc.
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -369,9 +373,12 @@ nsLookAndFeel::NativeGetColor(ColorID aI
|
2016-03-15 13:50:37 +00:00
|
|
|
break;
|
|
|
|
case eColorID_inactivecaption:
|
|
|
|
// inactive window caption
|
|
|
|
+ gtk_style_context_save(mBackgroundStyle);
|
|
|
|
+ gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE);
|
|
|
|
gtk_style_context_get_background_color(mBackgroundStyle,
|
|
|
|
- GTK_STATE_FLAG_INSENSITIVE,
|
|
|
|
+ gtk_style_context_get_state(mBackgroundStyle),
|
|
|
|
&gdk_color);
|
|
|
|
+ gtk_style_context_restore(mBackgroundStyle);
|
|
|
|
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
|
|
|
|
break;
|
|
|
|
#endif
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -497,13 +504,17 @@ nsLookAndFeel::NativeGetColor(ColorID aI
|
2016-03-15 13:50:37 +00:00
|
|
|
case eColorID__moz_buttondefault:
|
|
|
|
// default button border color
|
|
|
|
gtk_style_context_get_border_color(mButtonStyle,
|
|
|
|
- GTK_STATE_FLAG_NORMAL, &gdk_color);
|
|
|
|
+ gtk_style_context_get_state(mButtonStyle),
|
|
|
|
+ &gdk_color);
|
|
|
|
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
|
|
|
|
break;
|
|
|
|
case eColorID__moz_buttonhoverface:
|
|
|
|
+ gtk_style_context_save(mButtonStyle);
|
|
|
|
+ gtk_style_context_set_state(mButtonStyle, GTK_STATE_FLAG_PRELIGHT);
|
|
|
|
gtk_style_context_get_background_color(mButtonStyle,
|
|
|
|
- GTK_STATE_FLAG_PRELIGHT,
|
|
|
|
+ gtk_style_context_get_state(mButtonStyle),
|
|
|
|
&gdk_color);
|
|
|
|
+ gtk_style_context_restore(mButtonStyle);
|
|
|
|
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
|
|
|
|
break;
|
|
|
|
case eColorID__moz_buttonhovertext:
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1110,7 +1121,7 @@ nsLookAndFeel::Init()
|
2015-12-16 11:52:28 +00:00
|
|
|
style = create_context(path);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
|
|
|
|
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
g_object_unref(style);
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1118,18 +1129,18 @@ nsLookAndFeel::Init()
|
2015-12-16 11:52:28 +00:00
|
|
|
style = create_context(path);
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
|
|
|
|
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
gtk_style_context_restore(style);
|
|
|
|
|
|
|
|
// tooltip foreground and background
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
|
|
|
|
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sInfoText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
g_object_unref(style);
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1144,20 +1155,26 @@ nsLookAndFeel::Init()
|
2015-12-16 11:52:28 +00:00
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
|
|
|
|
|
|
|
style = gtk_widget_get_style_context(accel_label);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMenuText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
|
|
|
|
+ gtk_style_context_save(style);
|
|
|
|
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_INSENSITIVE);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
+ gtk_style_context_restore(style);
|
|
|
|
|
|
|
|
style = gtk_widget_get_style_context(menu);
|
|
|
|
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMenuBackground = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
|
|
|
|
style = gtk_widget_get_style_context(menuitem);
|
|
|
|
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
|
|
|
|
+ gtk_style_context_save(style);
|
|
|
|
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
|
|
|
|
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMenuHover = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
+ gtk_style_context_restore(style);
|
|
|
|
|
|
|
|
g_object_unref(menu);
|
|
|
|
#endif
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1266,44 +1283,54 @@ nsLookAndFeel::Init()
|
2015-12-16 19:45:47 +00:00
|
|
|
GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
+ GtkCssNode labelPath[] = {
|
|
|
|
+ { GTK_TYPE_LABEL, "label", "view", NULL },
|
|
|
|
+ { G_TYPE_NONE, "selection", NULL, NULL }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ GtkStyleContext *styleLabel;
|
|
|
|
+ GtkStyleContext *styleSelection;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ GtkBorder padding;
|
2015-12-16 19:45:47 +00:00
|
|
|
+
|
|
|
|
// Text colors
|
|
|
|
- style = gtk_widget_get_style_context(textView);
|
|
|
|
- gtk_style_context_save(style);
|
|
|
|
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_VIEW);
|
2015-12-16 11:52:28 +00:00
|
|
|
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
2015-12-16 19:45:47 +00:00
|
|
|
+ styleLabel = moz_gtk_style_create(labelPath, NULL);
|
|
|
|
+ styleSelection = moz_gtk_style_create(labelPath+1, styleLabel);
|
2016-03-17 12:48:28 +00:00
|
|
|
+
|
2015-12-16 19:45:47 +00:00
|
|
|
+ gtk_style_context_get_background_color(styleLabel, gtk_style_context_get_state(styleLabel), &color);
|
2015-12-16 11:52:28 +00:00
|
|
|
sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
2015-12-16 19:45:47 +00:00
|
|
|
+ gtk_style_context_get_color(styleLabel, gtk_style_context_get_state(styleLabel), &color);
|
2015-12-16 11:52:28 +00:00
|
|
|
sMozFieldText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
|
|
|
|
// Selected text and background
|
|
|
|
- gtk_style_context_get_background_color(style,
|
|
|
|
- static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
|
|
|
|
- &color);
|
2015-12-16 19:45:47 +00:00
|
|
|
+ gtk_style_context_get_background_color(styleSelection, gtk_style_context_get_state(styleSelection), &color);
|
2015-12-16 11:52:28 +00:00
|
|
|
sTextSelectedBackground = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style,
|
|
|
|
- static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
|
|
|
|
- &color);
|
2015-12-16 19:45:47 +00:00
|
|
|
+ gtk_style_context_get_color(styleSelection, gtk_style_context_get_state(styleSelection), &color);
|
2015-12-16 11:52:28 +00:00
|
|
|
sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
|
2015-12-16 19:45:47 +00:00
|
|
|
- gtk_style_context_restore(style);
|
2015-12-16 11:52:28 +00:00
|
|
|
|
|
|
|
// Button text, background, border
|
|
|
|
style = gtk_widget_get_style_context(label);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sButtonText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
|
|
|
|
+ gtk_style_context_save(style);
|
|
|
|
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
+ gtk_style_context_restore(style);
|
|
|
|
|
|
|
|
// Combobox text color
|
|
|
|
style = gtk_widget_get_style_context(comboboxLabel);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sComboBoxText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
|
|
|
|
// Menubar text and hover text colors
|
|
|
|
style = gtk_widget_get_style_context(menuBar);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMenuBarText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
|
|
|
|
+ gtk_style_context_save(style);
|
|
|
|
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
+ gtk_style_context_restore(style);
|
|
|
|
|
|
|
|
// GTK's guide to fancy odd row background colors:
|
|
|
|
// 1) Check if a theme explicitly defines an odd row color
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1316,7 +1343,7 @@ nsLookAndFeel::Init()
|
2015-12-16 11:52:28 +00:00
|
|
|
// Get odd row background color
|
|
|
|
gtk_style_context_save(style);
|
|
|
|
gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD);
|
|
|
|
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
gtk_style_context_restore(style);
|
|
|
|
|
2016-04-25 12:58:04 +00:00
|
|
|
@@ -1334,9 +1361,11 @@ nsLookAndFeel::Init()
|
2015-12-16 11:52:28 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(parent), infoBar);
|
|
|
|
gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
|
|
|
|
style = gtk_widget_get_style_context(infoBarLabel);
|
|
|
|
+ gtk_style_context_save(style);
|
|
|
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
|
|
|
|
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
|
|
+ gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
|
|
|
|
sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
|
|
|
|
+ gtk_style_context_restore(style);
|
|
|
|
#endif
|
|
|
|
// Some themes have a unified menu bar, and support window dragging on it
|
|
|
|
gboolean supports_menubar_drag = FALSE;
|
2016-04-25 12:58:04 +00:00
|
|
|
diff -up firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp
|
|
|
|
--- firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 2016-04-25 14:46:15.300592722 +0200
|
|
|
|
+++ firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp 2016-04-25 14:40:42.000000000 +0200
|
|
|
|
@@ -1567,9 +1567,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
|
2016-03-15 13:50:37 +00:00
|
|
|
case NS_THEME_RADIO_CONTAINER:
|
|
|
|
case NS_THEME_CHECKBOX_LABEL:
|
|
|
|
case NS_THEME_RADIO_LABEL:
|
|
|
|
- case NS_THEME_BUTTON:
|
|
|
|
- case NS_THEME_DROPDOWN:
|
|
|
|
- case NS_THEME_TOOLBAR_BUTTON:
|
|
|
|
case NS_THEME_TREEVIEW_HEADER_CELL:
|
|
|
|
{
|
2016-04-25 12:58:04 +00:00
|
|
|
if (aWidgetType == NS_THEME_DROPDOWN) {
|
|
|
|
@@ -1588,6 +1585,21 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
|
|
|
|
aResult->height += border.top + border.bottom;
|
2016-03-15 13:50:37 +00:00
|
|
|
}
|
2016-04-25 12:58:04 +00:00
|
|
|
break;
|
2016-03-15 13:50:37 +00:00
|
|
|
+ case NS_THEME_BUTTON:
|
|
|
|
+ case NS_THEME_DROPDOWN:
|
|
|
|
+ case NS_THEME_TOOLBAR_BUTTON:
|
|
|
|
+ {
|
|
|
|
+ moz_gtk_get_button_height(&aResult->height);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case NS_THEME_FOCUS_OUTLINE:
|
|
|
|
+ case NS_THEME_NUMBER_INPUT:
|
|
|
|
+ case NS_THEME_TEXTFIELD:
|
|
|
|
+ case NS_THEME_TEXTFIELD_MULTILINE:
|
|
|
|
+ {
|
|
|
|
+ moz_gtk_get_entry_height(&aResult->height);
|
|
|
|
+ }
|
2016-04-25 12:58:04 +00:00
|
|
|
+ break;
|
2016-03-15 13:50:37 +00:00
|
|
|
case NS_THEME_TOOLBAR_SEPARATOR:
|
|
|
|
{
|
2016-04-25 12:58:04 +00:00
|
|
|
gint separator_width;
|