Update of /cvsroot/gtk-wimp/gtk-wimp/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11925
Modified Files:
msw_style.c
Log Message:
fix tooltip leak; factor out some DC-related code; let win32 draw the status bar gripper
Index: msw_style.c
===================================================================
RCS file: /cvsroot/gtk-wimp/gtk-wimp/src/msw_style.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** msw_style.c 25 Nov 2005 20:08:38 -0000 1.38
--- msw_style.c 25 Nov 2005 21:07:55 -0000 1.39
***************
*** 1442,1445 ****
--- 1442,1485 ----
}
+ static HDC get_window_dc(GtkStyle * style, GdkWindow * window, GtkStateType state_type, gint x, gint y, gint width, gint height, RECT *rect)
+ {
+ int xoff, yoff;
+ GdkDrawable *drawable;
+
+ if (!GDK_IS_WINDOW (window))
+ {
+ xoff = 0;
+ yoff = 0;
+ drawable = window;
+ }
+ else
+ {
+ gdk_window_get_internal_paint_info (window, &drawable, &xoff, &yoff);
+ }
+
+ rect->left = x - xoff;
+ rect->top = y - yoff;
+ rect->right = rect->left + width;
+ rect->bottom = rect->top + height;
+
+ return gdk_win32_hdc_get (drawable, style->dark_gc[state_type], 0);
+ }
+
+ static void release_window_dc(GtkStyle * style, GdkWindow * window, GtkStateType state_type)
+ {
+ GdkDrawable *drawable;
+
+ if (!GDK_IS_WINDOW (window))
+ {
+ drawable = window;
+ }
+ else
+ {
+ gdk_window_get_internal_paint_info (window, &drawable, NULL, NULL);
+ }
+
+ gdk_win32_hdc_release (drawable, style->dark_gc[state_type], 0);
+ }
+
static void
draw_box (GtkStyle * style,
***************
*** 1507,1511 ****
gboolean is_v = GTK_IS_VSCROLLBAR (widget);
! if (xp_theme_draw (window,
is_v
? XP_THEME_ELEMENT_SCROLLBAR_V
--- 1547,1551 ----
gboolean is_v = GTK_IS_VSCROLLBAR (widget);
! if (xp_theme_draw (window,
is_v
? XP_THEME_ELEMENT_SCROLLBAR_V
***************
*** 1739,1768 ****
{
HBRUSH brush;
- gint xoff, yoff;
- GdkDrawable *drawable;
RECT rect;
HDC hdc;
! if (!GDK_IS_WINDOW (window))
! {
! xoff = 0;
! yoff = 0;
! drawable = window;
! }
! else
! {
! gdk_window_get_internal_paint_info
! (window, &drawable, &xoff, &yoff);
! }
!
! rect.left = x - xoff;
! rect.top = y - yoff;
! rect.right = rect.left + width;
! rect.bottom = rect.top + height;
- hdc =
- gdk_win32_hdc_get (window,
- style->dark_gc[state_type],
- 0);
brush = GetSysColorBrush (COLOR_3DDKSHADOW);
if (brush)
--- 1779,1787 ----
{
HBRUSH brush;
RECT rect;
HDC hdc;
! hdc = get_window_dc(style, window, state_type, x, y, width, height, &rect);
brush = GetSysColorBrush (COLOR_3DDKSHADOW);
if (brush)
***************
*** 1772,1775 ****
--- 1791,1796 ----
(HBRUSH) (COLOR_INFOBK + 1));
+ release_window_dc (style, window, state_type);
+
return;
}
***************
*** 1974,2018 ****
/* experimental tab-drawing code from mozilla */
RECT rect;
- int xoff, yoff;
HDC dc;
! GdkDrawable *drawable;
! GdkGC * gc = style->dark_gc[GTK_STATE_NORMAL];
!
! if (!GDK_IS_WINDOW (window))
! {
! xoff = 0;
! yoff = 0;
! drawable = window;
! }
! else
! {
! gdk_window_get_internal_paint_info (window, &drawable, &xoff, &yoff);
! }
! rect.left = x - xoff;
! rect.top = y - yoff;
! rect.right = rect.left + width;
! rect.bottom = rect.top + height;
! dc = gdk_win32_hdc_get (drawable, gc, 0);
! if (dc) {
! gint32 aPosition;
! if (real_gap_side == GTK_POS_TOP)
! aPosition = BF_TOP;
! else if (real_gap_side == GTK_POS_BOTTOM)
! aPosition = BF_BOTTOM;
! else if (real_gap_side == GTK_POS_LEFT)
! aPosition = BF_LEFT;
! else
! aPosition = BF_RIGHT;
! if (area)
! gdk_gc_set_clip_rectangle (gc, area);
! DrawTab (dc, rect, aPosition, state_type != GTK_STATE_PRELIGHT, (real_gap_side != GTK_POS_LEFT), (real_gap_side != GTK_POS_RIGHT));
! if (area)
! gdk_gc_set_clip_rectangle (gc, NULL);
! gdk_win32_hdc_release (drawable, gc, 0);
! }
}
}
--- 1995,2019 ----
/* experimental tab-drawing code from mozilla */
RECT rect;
HDC dc;
! gint32 aPosition;
! dc = get_window_dc(style, window, state_type, x, y, width, height, &rect);
! if (real_gap_side == GTK_POS_TOP)
! aPosition = BF_TOP;
! else if (real_gap_side == GTK_POS_BOTTOM)
! aPosition = BF_BOTTOM;
! else if (real_gap_side == GTK_POS_LEFT)
! aPosition = BF_LEFT;
! else
! aPosition = BF_RIGHT;
! if (area)
! gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
! DrawTab (dc, rect, aPosition, state_type != GTK_STATE_PRELIGHT, (real_gap_side != GTK_POS_LEFT), (real_gap_side != GTK_POS_RIGHT));
! if (area)
! gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
! release_window_dc (style, window, state_type);
}
}
***************
*** 2313,2317 ****
(window, XP_THEME_ELEMENT_STATUS_GRIPPER, style, x, y, width,
height, state_type, area))
! return;
}
--- 2314,2330 ----
(window, XP_THEME_ELEMENT_STATUS_GRIPPER, style, x, y, width,
height, state_type, area))
! return;
! else {
! RECT rect;
! HDC dc = get_window_dc(style, window, state_type, x, y, width, height, &rect);
!
! if (area)
! gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
! DrawFrameControl(dc, &rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
! release_window_dc(style, window, state_type);
! if (area)
! gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
! return;
! }
}
|