Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/gtk-engine
diff options
context:
space:
mode:
authorManu Cornet <manu@cacao.(none)>2006-07-11 14:56:49 (GMT)
committer Manu Cornet <manu@cacao.(none)>2006-07-11 14:56:49 (GMT)
commit4f8bb992f7fcfbd36c93e37a2a233149ea7c8b3f (patch)
treeaca7868a1128e4bbec3ba61c7f49c41ebfae1781 /gtk-engine
parent2a14c0265a746f44ee49079ace8424d00ef42874 (diff)
Fixed olpc-style.c to use a DETAIL macro instead of lots of strcmp. The
problem was that the engine didn't check whether the detail string was NULL or not before strcmping it --> segfault on the first test of my theme torturer. See http://www.manucornet.net/pub/olpc/log_olpc_theme_torture.txt (July 11th) for moer information about the changes.
Diffstat (limited to 'gtk-engine')
-rw-r--r--gtk-engine/src/olpc-style.c73
1 files changed, 38 insertions, 35 deletions
diff --git a/gtk-engine/src/olpc-style.c b/gtk-engine/src/olpc-style.c
index fea84cb..33a7c04 100644
--- a/gtk-engine/src/olpc-style.c
+++ b/gtk-engine/src/olpc-style.c
@@ -32,6 +32,8 @@
#include "olpc-style.h"
#include "olpc-rc-style.h"
+#define DETAIL(x) ((detail) && (!strcmp(x, detail)))
+
static GtkStyleClass *olpc_style_parent_class;
enum {
@@ -341,19 +343,19 @@ olpc_draw_shadow (GtkStyle *style,
int width,
int height)
{
- if (strcmp(detail, "entry") == 0) {
- draw_entry(style, state_type, widget, window, area,
- x, y, width, height);
- } else if (strcmp(detail, "scrolled_window") == 0) {
- draw_scrolled_window(style, state_type, widget, window, area,
- x, y, width, height);
- } else if (strcmp(detail, "toolbar") == 0) {
- } else {
- olpc_style_parent_class->draw_shadow (style, window,
- state_type, shadow_type,
- area, widget, detail,
- x, y, width, height);
- }
+ if (DETAIL("entry")) {
+ draw_entry (style, state_type, widget, window, area,
+ x, y, width, height);
+ } else if (DETAIL ("scrolled_window")) {
+ draw_scrolled_window(style, state_type, widget, window, area,
+ x, y, width, height);
+ } else if (DETAIL ("toolbar")) {
+ } else {
+ olpc_style_parent_class->draw_shadow (style, window,
+ state_type, shadow_type,
+ area, widget, detail,
+ x, y, width, height);
+ }
}
static void
@@ -553,25 +555,26 @@ olpc_draw_box (GtkStyle *style,
int width,
int height)
{
- if ((strcmp(detail, "button") == 0 ||
- strcmp(detail, "buttondefault") == 0)) {
- draw_button(style, state_type, widget, window,
- area, x, y, width, height);
- } else if ((strcmp (detail, "trough") == 0) && widget && (GTK_IS_VSCROLLBAR (widget) || GTK_IS_HSCROLLBAR (widget))) {
- draw_trough(style, state_type, widget, window, area,
- x, y, width, height);
- } else if ((strcmp (detail, "slider") == 0)) {
- draw_slider(style, state_type, widget, window, area,
- x, y, width, height);
- } else if ((strcmp (detail, "vscrollbar") == 0) || (strcmp (detail, "hscrollbar") == 0)) {
- draw_stepper(style, state_type, widget, window, area,
- x, y, width, height);
- } else {
- olpc_style_parent_class->draw_box (style, window,
- state_type, shadow_type,
- area, widget, detail,
- x, y, width, height);
- }
+ if (DETAIL ("button") ||
+ DETAIL ("buttondefault")) {
+ draw_button(style, state_type, widget, window,
+ area, x, y, width, height);
+ } else if (DETAIL ("trough") && widget && (GTK_IS_VSCROLLBAR (widget) || GTK_IS_HSCROLLBAR (widget))) {
+ draw_trough(style, state_type, widget, window, area,
+ x, y, width, height);
+ } else if (DETAIL ("slider")) {
+ draw_slider(style, state_type, widget, window, area,
+ x, y, width, height);
+ } else if (DETAIL ("vscrollbar") ||
+ DETAIL ("hscrollbar")) {
+ draw_stepper(style, state_type, widget, window, area,
+ x, y, width, height);
+ } else {
+ olpc_style_parent_class->draw_box (style, window,
+ state_type, shadow_type,
+ area, widget, detail,
+ x, y, width, height);
+ }
}
static void
@@ -612,9 +615,9 @@ olpc_draw_arrow (GtkStyle *style,
int width,
int height)
{
- if ((strcmp (detail, "vscrollbar") == 0) ||
- (strcmp (detail, "hscrollbar") == 0) ||
- (strcmp (detail, "arrow") == 0)) {
+ if (DETAIL ("vscrollbar") ||
+ DETAIL ("hscrollbar") ||
+ DETAIL ("arrow")) {
cairo_t *cr;
double ax = 0, ay = 0, bx = 0, by = 0, cx = 0, cy = 0;