Bug 393737 - GTK buttons should have a "default button" style if its the default button p=Michael Ventnor <ventnor.bugzilla@yahoo.com.au> r+sr=roc, a=pavlov

This commit is contained in:
asqueella@gmail.com 2007-09-02 09:38:54 -07:00
parent ed16bde7f8
commit e3b818fb86
2 changed files with 5 additions and 20 deletions

View File

@ -406,25 +406,8 @@ moz_gtk_button_paint(GdkDrawable* drawable, GdkRectangle* rect,
gtk_widget_set_state(widget, button_state);
/*
* XXX fix this code when we have default state working.
if (state->isDefault) {
TSOffsetStyleGCs(style, x, y);
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
cliprect, widget, "buttondefault", x, y, width, height);
}
if (state->canDefault) {
x += XTHICKNESS(style);
y += YTHICKNESS(style);
width -= 2 * x + default_spacing;
height -= 2 * y + default_spacing;
x += (1 + default_spacing) / 2;
y += (1 + default_spacing) / 2;
}
*/
if (state->isDefault)
GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_DEFAULT);
if (!interior_focus && state->focused) {
x += focus_width + focus_pad;
@ -463,6 +446,7 @@ moz_gtk_button_paint(GdkDrawable* drawable, GdkRectangle* rect,
widget, "button", x, y, width, height);
}
GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_DEFAULT);
return MOZ_GTK_SUCCESS;
}

View File

@ -224,7 +224,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aState->active = (eventState & NS_EVENT_STATE_ACTIVE) == NS_EVENT_STATE_ACTIVE;
aState->focused = (eventState & NS_EVENT_STATE_FOCUS) == NS_EVENT_STATE_FOCUS;
aState->inHover = (eventState & NS_EVENT_STATE_HOVER) == NS_EVENT_STATE_HOVER;
aState->isDefault = FALSE; // XXX fix me
aState->isDefault = IsDefaultButton(aFrame);
aState->canDefault = FALSE; // XXX fix me
if (aFrame && aFrame->GetContent()->IsNodeOfType(nsINode::eXUL)) {
@ -891,6 +891,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aAttribute == nsWidgetAtoms::selected ||
aAttribute == nsWidgetAtoms::focused ||
aAttribute == nsWidgetAtoms::readonly ||
aAttribute == nsWidgetAtoms::_default ||
aAttribute == nsWidgetAtoms::mozmenuactive)
*aShouldRepaint = PR_TRUE;
}