mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1273013 - "download progress bar does not show in gtk3 build." r=karlt
This commit is contained in:
parent
cd414072f6
commit
b8bb3b2ec9
@ -97,6 +97,14 @@ CreateMenuItemWidget(WidgetNodeType aShellType)
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkWidget*
|
||||||
|
CreateProgressWidget()
|
||||||
|
{
|
||||||
|
GtkWidget* widget = gtk_progress_bar_new();
|
||||||
|
AddToWindowContainer(widget);
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
CreateWidget(WidgetNodeType aWidgetType)
|
CreateWidget(WidgetNodeType aWidgetType)
|
||||||
{
|
{
|
||||||
@ -105,16 +113,18 @@ CreateWidget(WidgetNodeType aWidgetType)
|
|||||||
return CreateWindowWidget();
|
return CreateWindowWidget();
|
||||||
case MOZ_GTK_WINDOW_CONTAINER:
|
case MOZ_GTK_WINDOW_CONTAINER:
|
||||||
return CreateWindowContainerWidget();
|
return CreateWindowContainerWidget();
|
||||||
|
case MOZ_GTK_CHECKBUTTON_CONTAINER:
|
||||||
|
return CreateCheckboxWidget();
|
||||||
|
case MOZ_GTK_PROGRESSBAR:
|
||||||
|
return CreateProgressWidget();
|
||||||
|
case MOZ_GTK_RADIOBUTTON_CONTAINER:
|
||||||
|
return CreateRadiobuttonWidget();
|
||||||
case MOZ_GTK_SCROLLBAR_HORIZONTAL:
|
case MOZ_GTK_SCROLLBAR_HORIZONTAL:
|
||||||
return CreateScrollbarWidget(aWidgetType,
|
return CreateScrollbarWidget(aWidgetType,
|
||||||
GTK_ORIENTATION_HORIZONTAL);
|
GTK_ORIENTATION_HORIZONTAL);
|
||||||
case MOZ_GTK_SCROLLBAR_VERTICAL:
|
case MOZ_GTK_SCROLLBAR_VERTICAL:
|
||||||
return CreateScrollbarWidget(aWidgetType,
|
return CreateScrollbarWidget(aWidgetType,
|
||||||
GTK_ORIENTATION_VERTICAL);
|
GTK_ORIENTATION_VERTICAL);
|
||||||
case MOZ_GTK_CHECKBUTTON_CONTAINER:
|
|
||||||
return CreateCheckboxWidget();
|
|
||||||
case MOZ_GTK_RADIOBUTTON_CONTAINER:
|
|
||||||
return CreateRadiobuttonWidget();
|
|
||||||
case MOZ_GTK_MENUBAR:
|
case MOZ_GTK_MENUBAR:
|
||||||
return CreateMenuBarWidget();
|
return CreateMenuBarWidget();
|
||||||
case MOZ_GTK_MENUPOPUP:
|
case MOZ_GTK_MENUPOPUP:
|
||||||
@ -241,6 +251,22 @@ GetStyleInternal(WidgetNodeType aNodeType)
|
|||||||
MOZ_GTK_CHECKBUTTON_CONTAINER,
|
MOZ_GTK_CHECKBUTTON_CONTAINER,
|
||||||
GTK_STYLE_CLASS_CHECK,
|
GTK_STYLE_CLASS_CHECK,
|
||||||
MOZ_GTK_CHECKBUTTON_CONTAINER);
|
MOZ_GTK_CHECKBUTTON_CONTAINER);
|
||||||
|
|
||||||
|
case MOZ_GTK_PROGRESSBAR:
|
||||||
|
/* Root CSS node / widget for progress bars */
|
||||||
|
break;
|
||||||
|
case MOZ_GTK_PROGRESS_TROUGH:
|
||||||
|
/* Progress bar background (trough) */
|
||||||
|
return GetChildNodeStyle(aNodeType,
|
||||||
|
MOZ_GTK_PROGRESSBAR,
|
||||||
|
GTK_STYLE_CLASS_TROUGH,
|
||||||
|
MOZ_GTK_PROGRESSBAR);
|
||||||
|
case MOZ_GTK_PROGRESS_CHUNK:
|
||||||
|
/* Actual progress bar indicator for Gtk3.20+ only. */
|
||||||
|
return GetChildNodeStyle(MOZ_GTK_PROGRESS_CHUNK,
|
||||||
|
MOZ_GTK_PROGRESSBAR,
|
||||||
|
"progress",
|
||||||
|
MOZ_GTK_PROGRESS_TROUGH);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ static GtkWidget* gComboBoxEntryArrowWidget;
|
|||||||
static GtkWidget* gHandleBoxWidget;
|
static GtkWidget* gHandleBoxWidget;
|
||||||
static GtkWidget* gToolbarWidget;
|
static GtkWidget* gToolbarWidget;
|
||||||
static GtkWidget* gFrameWidget;
|
static GtkWidget* gFrameWidget;
|
||||||
static GtkWidget* gProgressWidget;
|
|
||||||
static GtkWidget* gTabWidget;
|
static GtkWidget* gTabWidget;
|
||||||
static GtkWidget* gTextViewWidget;
|
static GtkWidget* gTextViewWidget;
|
||||||
static GtkWidget* gTooltipWidget;
|
static GtkWidget* gTooltipWidget;
|
||||||
@ -480,16 +479,6 @@ ensure_tab_widget()
|
|||||||
return MOZ_GTK_SUCCESS;
|
return MOZ_GTK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
|
||||||
ensure_progress_widget()
|
|
||||||
{
|
|
||||||
if (!gProgressWidget) {
|
|
||||||
gProgressWidget = gtk_progress_bar_new();
|
|
||||||
setup_widget_prototype(gProgressWidget);
|
|
||||||
}
|
|
||||||
return MOZ_GTK_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
ensure_frame_widget()
|
ensure_frame_widget()
|
||||||
{
|
{
|
||||||
@ -1900,18 +1889,11 @@ static gint
|
|||||||
moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
|
moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
|
||||||
GtkTextDirection direction)
|
GtkTextDirection direction)
|
||||||
{
|
{
|
||||||
GtkStyleContext* style;
|
GtkStyleContext* style = ClaimStyleContext(MOZ_GTK_PROGRESS_TROUGH,
|
||||||
|
direction);
|
||||||
ensure_progress_widget();
|
|
||||||
gtk_widget_set_direction(gProgressWidget, 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_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_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
|
||||||
gtk_style_context_restore(style);
|
ReleaseStyleContext(style);
|
||||||
|
|
||||||
return MOZ_GTK_SUCCESS;
|
return MOZ_GTK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1923,13 +1905,15 @@ moz_gtk_progress_chunk_paint(cairo_t *cr, GdkRectangle* rect,
|
|||||||
{
|
{
|
||||||
GtkStyleContext* style;
|
GtkStyleContext* style;
|
||||||
|
|
||||||
ensure_progress_widget();
|
if (gtk_check_version(3, 20, 0) != nullptr) {
|
||||||
gtk_widget_set_direction(gProgressWidget, direction);
|
/* Ask for MOZ_GTK_PROGRESS_TROUGH instead of MOZ_GTK_PROGRESSBAR
|
||||||
|
* because ClaimStyleContext() saves/restores that style */
|
||||||
style = gtk_widget_get_style_context(gProgressWidget);
|
style = ClaimStyleContext(MOZ_GTK_PROGRESS_TROUGH, direction);
|
||||||
gtk_style_context_save(style);
|
gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
|
||||||
gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
|
gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
|
||||||
gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
|
} else {
|
||||||
|
style = ClaimStyleContext(MOZ_GTK_PROGRESS_CHUNK, direction);
|
||||||
|
}
|
||||||
|
|
||||||
if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
|
if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
|
||||||
widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
|
widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
|
||||||
@ -1973,7 +1957,7 @@ moz_gtk_progress_chunk_paint(cairo_t *cr, GdkRectangle* rect,
|
|||||||
} else {
|
} else {
|
||||||
gtk_render_activity(style, cr, rect->x, rect->y, rect->width, rect->height);
|
gtk_render_activity(style, cr, rect->x, rect->y, rect->width, rect->height);
|
||||||
}
|
}
|
||||||
gtk_style_context_restore(style);
|
ReleaseStyleContext(style);
|
||||||
|
|
||||||
return MOZ_GTK_SUCCESS;
|
return MOZ_GTK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -2707,8 +2691,7 @@ moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
|
|||||||
w = gTabWidget;
|
w = gTabWidget;
|
||||||
break;
|
break;
|
||||||
case MOZ_GTK_PROGRESSBAR:
|
case MOZ_GTK_PROGRESSBAR:
|
||||||
ensure_progress_widget();
|
w = GetWidget(MOZ_GTK_PROGRESSBAR);
|
||||||
w = gProgressWidget;
|
|
||||||
break;
|
break;
|
||||||
case MOZ_GTK_SPINBUTTON_ENTRY:
|
case MOZ_GTK_SPINBUTTON_ENTRY:
|
||||||
case MOZ_GTK_SPINBUTTON_UP:
|
case MOZ_GTK_SPINBUTTON_UP:
|
||||||
@ -3345,7 +3328,6 @@ moz_gtk_shutdown()
|
|||||||
gHandleBoxWidget = NULL;
|
gHandleBoxWidget = NULL;
|
||||||
gToolbarWidget = NULL;
|
gToolbarWidget = NULL;
|
||||||
gFrameWidget = NULL;
|
gFrameWidget = NULL;
|
||||||
gProgressWidget = NULL;
|
|
||||||
gTabWidget = NULL;
|
gTabWidget = NULL;
|
||||||
gTextViewWidget = nullptr;
|
gTextViewWidget = nullptr;
|
||||||
gTooltipWidget = NULL;
|
gTooltipWidget = NULL;
|
||||||
|
@ -155,6 +155,8 @@ typedef enum {
|
|||||||
MOZ_GTK_RESIZER,
|
MOZ_GTK_RESIZER,
|
||||||
/* Paints a GtkProgressBar. */
|
/* Paints a GtkProgressBar. */
|
||||||
MOZ_GTK_PROGRESSBAR,
|
MOZ_GTK_PROGRESSBAR,
|
||||||
|
/* Paints a trough (track) of a GtkProgressBar */
|
||||||
|
MOZ_GTK_PROGRESS_TROUGH,
|
||||||
/* Paints a progress chunk of a GtkProgressBar. */
|
/* Paints a progress chunk of a GtkProgressBar. */
|
||||||
MOZ_GTK_PROGRESS_CHUNK,
|
MOZ_GTK_PROGRESS_CHUNK,
|
||||||
/* Paints a progress chunk of an indeterminated GtkProgressBar. */
|
/* Paints a progress chunk of an indeterminated GtkProgressBar. */
|
||||||
|
Loading…
Reference in New Issue
Block a user