From 6c544097597c4226164fd16674e57dc8b8ce7afc Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 15 Sep 2005 22:14:03 +0000 Subject: [PATCH] Check whether the widget actually is a GtkNotebook before treating it as 2005-09-16 Tor Lillqvist * modules/engines/ms-windows/msw_style.c (draw_extension, draw_box_gap): Check whether the widget actually is a GtkNotebook before treating it as such. Drop some unneeded local variables, use parameter with same information instead. (#316412) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ modules/engines/ms-windows/msw_style.c | 21 +++++++++------------ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index e30404f080..a9c29df023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-09-16 Tor Lillqvist + + * modules/engines/ms-windows/msw_style.c (draw_extension, + draw_box_gap): Check whether the widget actually is a GtkNotebook + before treating it as such. Drop some unneeded local variables, + use parameter with same information instead. (#316412) + 2005-09-15 Federico Mena Quintero * tests/autotestfilechooser.c: Start a set of automated tests for diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e30404f080..a9c29df023 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2005-09-16 Tor Lillqvist + + * modules/engines/ms-windows/msw_style.c (draw_extension, + draw_box_gap): Check whether the widget actually is a GtkNotebook + before treating it as such. Drop some unneeded local variables, + use parameter with same information instead. (#316412) + 2005-09-15 Federico Mena Quintero * tests/autotestfilechooser.c: Start a set of automated tests for diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c index 2672d4c6b1..ce76e06625 100755 --- a/modules/engines/ms-windows/msw_style.c +++ b/modules/engines/ms-windows/msw_style.c @@ -1724,24 +1724,23 @@ draw_extension(GtkStyle *style, gint height, GtkPositionType gap_side) { - if (detail && !strcmp(detail, "tab")) + if (GTK_IS_NOTEBOOK(widget) && detail && !strcmp(detail, "tab")) { GtkNotebook *notebook = GTK_NOTEBOOK(widget); - GtkPositionType pos_type = gtk_notebook_get_tab_pos(notebook); - gint x2, y2, w2, h2; + gint x2, y2, w2, h2; - x2 = x; y2 = y; w2 = width; h2 = height; - if (pos_type == GTK_POS_TOP && state_type == GTK_STATE_NORMAL) { + x2 = x; y2 = y; w2 = width; h2 = height; + if (gap_side == GTK_POS_TOP && state_type == GTK_STATE_NORMAL) { /*h2 += XP_EDGE_SIZE;*/ } - else if (pos_type == GTK_POS_BOTTOM && state_type == GTK_STATE_NORMAL) { + else if (gap_side == GTK_POS_BOTTOM && state_type == GTK_STATE_NORMAL) { /*h2 += XP_EDGE_SIZE;*/ } - else if (pos_type == GTK_POS_LEFT && state_type == GTK_STATE_NORMAL) { + else if (gap_side == GTK_POS_LEFT && state_type == GTK_STATE_NORMAL) { x2 += 1; w2 -= XP_EDGE_SIZE; } - else if (pos_type == GTK_POS_RIGHT && state_type == GTK_STATE_NORMAL) { + else if (gap_side == GTK_POS_RIGHT && state_type == GTK_STATE_NORMAL) { w2 -= (XP_EDGE_SIZE + 1); } @@ -1766,12 +1765,10 @@ draw_box_gap (GtkStyle *style, GdkWindow *window, GtkStateType state_type, gint y, gint width, gint height, GtkPositionType gap_side, gint gap_x, gint gap_width) { - if (detail && !strcmp(detail, "notebook")) + if (GTK_IS_NOTEBOOK(widget) && detail && !strcmp(detail, "notebook")) { - GtkNotebook *notebook = GTK_NOTEBOOK(widget); - /* FIXME: pos != TOP to be implemented */ - if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP && xp_theme_draw(window, XP_THEME_ELEMENT_TAB_PANE, style, x, y, width, height, + if (gap_side == GTK_POS_TOP && xp_theme_draw(window, XP_THEME_ELEMENT_TAB_PANE, style, x, y, width, height, state_type, area)) { return;