From 8d6c124d9f5ac423c4edca1d4c6319376ab22bed Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Sun, 9 Apr 2006 22:51:03 +0000 Subject: [PATCH] Bug 300207. Set scrollbar button size and position so that Clearlooks (and other themes?) will draw button correctly. r=bryner --- widget/src/gtk2/gtk2drawing.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index b9c60155fad..19853506f90 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -653,6 +653,20 @@ moz_gtk_scrollbar_button_paint(GdkDrawable* drawable, GdkRectangle* rect, scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget); else scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget); + + /* Some theme engines (i.e., ClearLooks) check the scrollbar's allocation + to determine where it should paint rounded corners on the buttons. + We need to trick them into drawing the buttons the way we want them. */ + + GTK_WIDGET(scrollbar)->allocation.x = rect->x; + GTK_WIDGET(scrollbar)->allocation.y = rect->y; + GTK_WIDGET(scrollbar)->allocation.width = 2 * rect->width; + GTK_WIDGET(scrollbar)->allocation.height = 2 * rect->height; + + if (type == GTK_ARROW_DOWN) + GTK_WIDGET(scrollbar)->allocation.y -= rect->height; + else if (type == GTK_ARROW_RIGHT) + GTK_WIDGET(scrollbar)->allocation.x -= rect->width; style = GTK_WIDGET(scrollbar)->style;