diff options
author | Martin Stransky <stransky@anakreon.cz> | 2016-01-13 16:43:54 +0100 |
---|---|---|
committer | Martin Stransky <stransky@anakreon.cz> | 2016-01-13 16:43:54 +0100 |
commit | e9049336df3a344c04404e4b639594aa2670cfc0 (patch) | |
tree | 310066bc60931d4697175005ebda5237b4c26bd9 /firefox-gtk3-20.patch | |
parent | spec file tweak - libjpeg library build req (diff) | |
download | librewolf-fedora-ff-e9049336df3a344c04404e4b639594aa2670cfc0.tar.gz librewolf-fedora-ff-e9049336df3a344c04404e4b639594aa2670cfc0.tar.bz2 librewolf-fedora-ff-e9049336df3a344c04404e4b639594aa2670cfc0.zip |
Updated progress bars rendering for Gtk 3.20
Diffstat (limited to 'firefox-gtk3-20.patch')
-rw-r--r-- | firefox-gtk3-20.patch | 209 |
1 files changed, 169 insertions, 40 deletions
diff --git a/firefox-gtk3-20.patch b/firefox-gtk3-20.patch index cc7ee93..1475fb8 100644 --- a/firefox-gtk3-20.patch +++ b/firefox-gtk3-20.patch @@ -1,7 +1,7 @@ -diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/gtk3drawing.c ---- firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 2015-12-08 19:06:46.000000000 +0100 -+++ firefox-43.0/widget/gtk/gtk3drawing.c 2015-12-16 20:40:48.591930885 +0100 -@@ -17,15 +17,29 @@ +diff -up firefox-43.0.3/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0.3/widget/gtk/gtk3drawing.c +--- firefox-43.0.3/widget/gtk/gtk3drawing.c.gtk3-20 2015-12-23 23:11:14.000000000 +0100 ++++ firefox-43.0.3/widget/gtk/gtk3drawing.c 2016-01-13 16:40:37.940796568 +0100 +@@ -17,15 +17,35 @@ #include <math.h> @@ -19,6 +19,12 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g + GtkStyleContext* styleLabel; +} GtkWidgetToogleBox; + ++typedef struct { ++ GtkWidget* widget; ++ GtkStyleContext* styleProgress; ++ GtkStyleContext* styleTrough; ++} GtkWidgetProgressBar; ++ static GtkWidget* gProtoWindow; static GtkWidget* gProtoLayout; static GtkWidget* gButtonWidget; @@ -35,7 +41,16 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g static GtkWidget* gSpinWidget; static GtkWidget* gHScaleWidget; static GtkWidget* gVScaleWidget; -@@ -97,6 +111,33 @@ GetStateFlagsFromGtkWidgetState(GtkWidge +@@ -42,7 +62,7 @@ static GtkWidget* gHandleBoxWidget; + static GtkWidget* gToolbarWidget; + static GtkWidget* gFrameWidget; + static GtkWidget* gStatusbarWidget; +-static GtkWidget* gProgressWidget; ++static GtkWidgetProgressBar gProgressBar; + static GtkWidget* gTabWidget; + static GtkWidget* gTooltipWidget; + static GtkWidget* gMenuBarWidget; +@@ -97,6 +117,33 @@ GetStateFlagsFromGtkWidgetState(GtkWidge return stateFlags; } @@ -69,7 +84,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g /* 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. */ -@@ -195,9 +236,21 @@ ensure_button_arrow_widget() +@@ -195,9 +242,21 @@ ensure_button_arrow_widget() static gint ensure_checkbox_widget() { @@ -94,7 +109,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g } return MOZ_GTK_SUCCESS; } -@@ -205,9 +258,21 @@ ensure_checkbox_widget() +@@ -205,9 +264,21 @@ ensure_checkbox_widget() static gint ensure_radiobutton_widget() { @@ -119,7 +134,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g } return MOZ_GTK_SUCCESS; } -@@ -215,13 +280,31 @@ ensure_radiobutton_widget() +@@ -215,13 +286,31 @@ ensure_radiobutton_widget() static gint ensure_scrollbar_widget() { @@ -158,7 +173,29 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g } return MOZ_GTK_SUCCESS; } -@@ -757,7 +840,7 @@ moz_gtk_checkbox_get_metrics(gint* indic +@@ -528,9 +617,18 @@ ensure_tab_widget() + static gint + ensure_progress_widget() + { +- if (!gProgressWidget) { +- gProgressWidget = gtk_progress_bar_new(); +- setup_widget_prototype(gProgressWidget); ++ if (!gProgressBar.widget) { ++ GtkCssNode path[] = { ++ { GTK_TYPE_LABEL, "progressbar", NULL, NULL }, ++ { G_TYPE_NONE, "trough", NULL, NULL }, ++ }; ++ ++ gProgressBar.widget = gtk_progress_bar_new(); ++ setup_widget_prototype(gProgressBar.widget); ++ ++ gProgressBar.styleProgress = moz_gtk_style_create(&path[0], NULL); ++ gProgressBar.styleTrough = moz_gtk_style_create(&path[1], ++ gProgressBar.styleProgress); + } + return MOZ_GTK_SUCCESS; + } +@@ -757,7 +855,7 @@ moz_gtk_checkbox_get_metrics(gint* indic { ensure_checkbox_widget(); @@ -167,7 +204,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g "indicator_size", indicator_size, "indicator_spacing", indicator_spacing, NULL); -@@ -770,7 +853,7 @@ moz_gtk_radio_get_metrics(gint* indicato +@@ -770,7 +868,7 @@ moz_gtk_radio_get_metrics(gint* indicato { ensure_radiobutton_widget(); @@ -176,7 +213,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g "indicator_size", indicator_size, "indicator_spacing", indicator_spacing, NULL); -@@ -961,15 +1044,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec +@@ -961,15 +1059,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec gint indicator_size, indicator_spacing; gint x, y, width, height; gint focus_x, focus_y, focus_width, focus_height; @@ -195,7 +232,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g } // XXX we should assert rect->height >= indicator_size too -@@ -988,11 +1070,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec +@@ -988,11 +1085,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec focus_width = width + 2 * indicator_spacing; focus_height = height + 2 * indicator_spacing; @@ -210,7 +247,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g if (selected) state_flags |= checkbox_check_state; -@@ -1000,13 +1080,12 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec +@@ -1000,13 +1095,12 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec if (inconsistent) state_flags |= GTK_STATE_FLAG_INCONSISTENT; @@ -227,7 +264,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g focus_width, focus_height); } } -@@ -1015,15 +1094,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec +@@ -1015,15 +1109,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec * 'indeterminate' type on checkboxes. In GTK, the shadow type * must also be changed for the state to be drawn. */ @@ -247,7 +284,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g return MOZ_GTK_SUCCESS; } -@@ -1109,9 +1187,9 @@ moz_gtk_scrollbar_button_paint(cairo_t * +@@ -1109,9 +1202,9 @@ moz_gtk_scrollbar_button_paint(cairo_t * ensure_scrollbar_widget(); if (flags & MOZ_GTK_STEPPER_VERTICAL) @@ -259,7 +296,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g gtk_widget_set_direction(scrollbar, direction); -@@ -1177,26 +1255,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW +@@ -1177,26 +1270,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW GtkTextDirection direction) { GtkStyleContext* style; @@ -294,7 +331,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g 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); -@@ -1204,7 +1278,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW +@@ -1204,7 +1293,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW gtk_render_focus(style, cr, rect->x, rect->y, rect->width, rect->height); } @@ -302,7 +339,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g return MOZ_GTK_SUCCESS; } -@@ -1222,19 +1295,16 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi +@@ -1222,19 +1310,16 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi ensure_scrollbar_widget(); @@ -330,7 +367,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g gtk_style_context_get_margin (style, state_flags, &margin); gtk_render_slider(style, cr, -@@ -1245,8 +1315,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi +@@ -1245,8 +1330,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); @@ -339,7 +376,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g return MOZ_GTK_SUCCESS; } -@@ -1801,29 +1869,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk +@@ -1801,29 +1884,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk gboolean isradio, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); @@ -377,7 +414,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g return MOZ_GTK_SUCCESS; } -@@ -1833,32 +1899,25 @@ moz_gtk_toggle_label_paint(cairo_t *cr, +@@ -1833,32 +1914,25 @@ moz_gtk_toggle_label_paint(cairo_t *cr, GtkWidgetState* state, gboolean isradio, GtkTextDirection direction) { @@ -395,15 +432,15 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g } else { ensure_checkbox_widget(); - widget = gCheckboxWidget; -- } ++ widget = &gCheckbox; + } - 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); -+ widget = &gCheckbox; - } +- } - gtk_widget_set_direction(widget, direction); + gtk_style_context_save(widget->styleLabel); + gtk_widget_set_direction(widget->widget, direction); @@ -418,20 +455,103 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g return MOZ_GTK_SUCCESS; } -@@ -2841,10 +2900,10 @@ moz_gtk_get_widget_border(GtkThemeWidget +@@ -2006,18 +2080,13 @@ static gint + 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); ++ gtk_render_background(gProgressBar.styleProgress, cr, ++ rect->x, rect->y, rect->width, rect->height); ++ gtk_render_frame(gProgressBar.styleProgress, cr, ++ rect->x, rect->y, rect->width, rect->height); + + return MOZ_GTK_SUCCESS; + } +@@ -2027,16 +2096,9 @@ moz_gtk_progress_chunk_paint(cairo_t *cr + 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); ++ + if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE || + widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) { + /** +@@ -2074,12 +2136,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr + // 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); ++ gtk_render_background(gProgressBar.styleTrough, cr, ++ rect->x, rect->y, rect->width, rect->height); ++ gtk_render_frame(gProgressBar.styleTrough, cr, ++ rect->x, rect->y, rect->width, rect->height); + } else { +- gtk_render_activity(style, cr, rect->x, rect->y, rect->width, rect->height); +- } +- gtk_style_context_restore(style); ++ gtk_render_activity(gProgressBar.styleTrough, cr, ++ rect->x, rect->y, rect->width, rect->height); ++ } + + return MOZ_GTK_SUCCESS; + } +@@ -2815,9 +2879,12 @@ moz_gtk_get_widget_border(GtkThemeWidget + w = gTabWidget; + break; + case MOZ_GTK_PROGRESSBAR: +- ensure_progress_widget(); +- w = gProgressWidget; +- break; ++ { ++ ensure_progress_widget(); ++ moz_gtk_add_style_border(gProgressBar.styleProgress, ++ left, top, right, bottom); ++ return MOZ_GTK_SUCCESS; ++ } + case MOZ_GTK_SPINBUTTON_ENTRY: + case MOZ_GTK_SPINBUTTON_UP: + case MOZ_GTK_SPINBUTTON_DOWN: +@@ -2841,12 +2908,13 @@ moz_gtk_get_widget_border(GtkThemeWidget { if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) { ensure_checkbox_widget(); - w = gCheckboxWidget; + w = gCheckbox.widget; ++ style = gCheckbox.styleCheck; } else { ensure_radiobutton_widget(); - w = gRadiobuttonWidget; + w = gRadiobutton.widget; ++ style = gRadiobutton.styleCheck; } - style = gtk_widget_get_style_context(w); +- style = gtk_widget_get_style_context(w); -@@ -3123,7 +3182,7 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro + *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w)); + moz_gtk_add_style_border(style, +@@ -3123,7 +3191,7 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro { ensure_scrollbar_widget(); @@ -440,7 +560,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g "slider_width", &metrics->slider_width, "trough_border", &metrics->trough_border, "stepper_size", &metrics->stepper_size, -@@ -3131,7 +3190,7 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro +@@ -3131,7 +3199,7 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro NULL); metrics->min_slider_size = @@ -449,7 +569,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g return MOZ_GTK_SUCCESS; } -@@ -3377,7 +3436,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget( +@@ -3377,7 +3445,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget( { MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()"); ensure_scrollbar_widget(); @@ -458,7 +578,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g } gboolean moz_gtk_has_scrollbar_buttons(void) -@@ -3385,7 +3444,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v +@@ -3385,7 +3453,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v gboolean backward, forward, secondary_backward, secondary_forward; MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()"); ensure_scrollbar_widget(); @@ -467,7 +587,7 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g "has-backward-stepper", &backward, "has-forward-stepper", &forward, "has-secondary-backward-stepper", &secondary_backward, -@@ -3414,10 +3473,10 @@ moz_gtk_shutdown() +@@ -3414,10 +3482,10 @@ moz_gtk_shutdown() gButtonWidget = NULL; gToggleButtonWidget = NULL; gButtonArrowWidget = NULL; @@ -482,9 +602,18 @@ diff -up firefox-43.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-43.0/widget/gtk/g gSpinWidget = NULL; gHScaleWidget = NULL; gVScaleWidget = NULL; -diff -up firefox-43.0/widget/gtk/gtkdrawing.h.gtk3-20 firefox-43.0/widget/gtk/gtkdrawing.h ---- firefox-43.0/widget/gtk/gtkdrawing.h.gtk3-20 2015-12-08 19:06:46.000000000 +0100 -+++ firefox-43.0/widget/gtk/gtkdrawing.h 2015-12-16 20:38:30.313116412 +0100 +@@ -3434,7 +3502,7 @@ moz_gtk_shutdown() + gToolbarWidget = NULL; + gStatusbarWidget = NULL; + gFrameWidget = NULL; +- gProgressWidget = NULL; ++ //gProgressBar = NULL; + gTabWidget = NULL; + gTooltipWidget = NULL; + gMenuBarWidget = NULL; +diff -up firefox-43.0.3/widget/gtk/gtkdrawing.h.gtk3-20 firefox-43.0.3/widget/gtk/gtkdrawing.h +--- firefox-43.0.3/widget/gtk/gtkdrawing.h.gtk3-20 2015-12-23 23:11:14.000000000 +0100 ++++ firefox-43.0.3/widget/gtk/gtkdrawing.h 2016-01-13 14:54:34.231234533 +0100 @@ -67,6 +67,13 @@ typedef enum { MOZ_GTK_TAB_SELECTED = 1 << 10 } GtkTabFlags; @@ -510,9 +639,9 @@ diff -up firefox-43.0/widget/gtk/gtkdrawing.h.gtk3-20 firefox-43.0/widget/gtk/gt #ifdef __cplusplus } #endif /* __cplusplus */ -diff -up firefox-43.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-43.0/widget/gtk/mozgtk/mozgtk.c ---- firefox-43.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 2015-12-08 19:06:46.000000000 +0100 -+++ firefox-43.0/widget/gtk/mozgtk/mozgtk.c 2015-12-16 20:38:30.313116412 +0100 +diff -up firefox-43.0.3/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-43.0.3/widget/gtk/mozgtk/mozgtk.c +--- firefox-43.0.3/widget/gtk/mozgtk/mozgtk.c.gtk3-20 2015-12-23 23:11:14.000000000 +0100 ++++ firefox-43.0.3/widget/gtk/mozgtk/mozgtk.c 2016-01-13 14:54:34.231234533 +0100 @@ -547,6 +547,7 @@ STUB(gtk_style_context_get_border_color) STUB(gtk_style_context_get_color) STUB(gtk_style_context_get_margin) @@ -534,9 +663,9 @@ diff -up firefox-43.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-43.0/widget/gtk #endif #ifdef GTK2_SYMBOLS -diff -up firefox-43.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-43.0/widget/gtk/nsLookAndFeel.cpp ---- firefox-43.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20 2015-12-08 19:06:46.000000000 +0100 -+++ firefox-43.0/widget/gtk/nsLookAndFeel.cpp 2015-12-16 20:38:30.314116418 +0100 +diff -up firefox-43.0.3/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-43.0.3/widget/gtk/nsLookAndFeel.cpp +--- firefox-43.0.3/widget/gtk/nsLookAndFeel.cpp.gtk3-20 2015-12-23 23:11:14.000000000 +0100 ++++ firefox-43.0.3/widget/gtk/nsLookAndFeel.cpp 2016-01-13 14:54:34.232234536 +0100 @@ -983,7 +983,7 @@ nsLookAndFeel::Init() style = create_context(path); gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR); |