[cairo-commit] cairo-gtk-engine/src cge-draw.c,1.13,1.14
Julien Boulnois
commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005
Committed by: jboulnois
Update of /cvs/cairo/cairo-gtk-engine/src
In directory pdx:/tmp/cvs-serv10657/src
Modified Files:
cge-draw.c
Log Message:
bugfixes:
- fix rounded box problem
- fix menu border problem
Index: cge-draw.c
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/cge-draw.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** cge-draw.c 13 Sep 2003 11:01:22 -0000 1.13
--- cge-draw.c 13 Feb 2004 17:39:35 -0000 1.14
***************
*** 6,9 ****
--- 6,22 ----
#define DETAIL(xx) ((detail) && (!strcmp(xx, detail)))
+ /*#define DEBUG*/
+
+ void debug_msg(gchar *fun,
+ const gchar *detail,
+ gdouble x,
+ gdouble y,
+ gdouble w,
+ gdouble h)
+ {
+ #ifdef DEBUG
+ printf("cge:%s(%s) at %ix%ix%ix%i\n",fun,detail,(int)x,(int)y,(int)w,(int)h);
+ #endif
+ }
static void color_gdk_to_rgb(GdkColor color,gdouble *r,gdouble *g,gdouble *b);
***************
*** 381,385 ****
Drawable drawable;
GdkDrawable *real_drawable;
! gint x_off, y_off;
/* Unabstract X from GTK+ */
--- 394,398 ----
Drawable drawable;
GdkDrawable *real_drawable;
! gint x_off=0, y_off=0;
/* Unabstract X from GTK+ */
***************
*** 398,404 ****
cairo_set_target_drawable (xrs, dpy, drawable);
! if(GDK_IS_WINDOW(window))
cairo_translate(xrs,-(double)x_off,-(double)y_off);
!
}
--- 411,417 ----
cairo_set_target_drawable (xrs, dpy, drawable);
! if(GDK_IS_WINDOW(window))
cairo_translate(xrs,-(double)x_off,-(double)y_off);
!
}
***************
*** 766,770 ****
! cairo_translate(xrs,(double)x,(double)y);
cairo_move_to(xrs, 0,(double)round_size);
cairo_rel_curve_to (xrs,
--- 779,783 ----
! cairo_translate(xrs,(double)x,(double)y);
cairo_move_to(xrs, 0,(double)round_size);
cairo_rel_curve_to (xrs,
***************
*** 792,805 ****
-(double)round_size,-(double)round_size);
color_gdk_to_rgb(c,&r,&g,&b);
cairo_set_rgb_color(xrs, r, g, b);
if(pattern!=NULL)
cairo_set_pattern(xrs,pattern);
- cairo_set_alpha(xrs,alpha);
-
! cairo_close_path(xrs);
--- 805,821 ----
-(double)round_size,-(double)round_size);
+ cairo_rel_line_to(xrs, 0, -(double)h+(double)2*round_size);
+
color_gdk_to_rgb(c,&r,&g,&b);
+
+ cairo_set_alpha(xrs,alpha);
cairo_set_rgb_color(xrs, r, g, b);
+
if(pattern!=NULL)
cairo_set_pattern(xrs,pattern);
! // cairo_close_path(xrs);
***************
*** 809,812 ****
--- 825,829 ----
else
cairo_stroke(xrs);
+
cairo_restore(xrs);
}
***************
*** 838,842 ****
! cairo_translate(xrs,(double)x,(double)y);
cairo_move_to(xrs, 0,(double)round_size);
cairo_rel_curve_to (xrs,
--- 855,859 ----
! cairo_translate(xrs,(double)x,(double)y);
cairo_move_to(xrs, 0,(double)round_size);
cairo_rel_curve_to (xrs,
***************
*** 1117,1120 ****
--- 1134,1138 ----
cge_draw_box(xrs,
color,
+ //NULL,
gradient,
1,
***************
*** 1235,1238 ****
--- 1253,1271 ----
}
else if(cstyle->line_style.line_mode==CGE_LINE_SOLID)
+ {
+ /* Cannot have rounded box for menu */
+ if (DETAIL("menu"))
+ cge_draw_box(xrs,
+ color,
+ NULL,
+ cstyle->line_style.alpha,
+ x,
+ y,
+ width,
+ height,
+ 0,
+ FALSE,
+ cstyle->line_style.line_width);
+ else
cge_draw_box(xrs,
color,
***************
*** 1247,1251 ****
cstyle->line_style.line_width);
!
cairo_restore(xrs);
}
--- 1280,1284 ----
cstyle->line_style.line_width);
! }
cairo_restore(xrs);
}
***************
*** 1301,1304 ****
--- 1334,1340 ----
{
cairo_t *xrs;
+
+ debug_msg("draw_hline",detail,x1,y,x2,y);
+
xrs=cairo_create();
cge_gdk(xrs,window);
***************
*** 1326,1329 ****
--- 1362,1368 ----
{
cairo_t *xrs;
+
+ debug_msg("draw_vline",detail,x,y1,x,y2);
+
xrs=cairo_create();
cge_gdk(xrs,window);
***************
*** 1358,1364 ****
--- 1397,1407 ----
{
cairo_t *xrs;
+
+ debug_msg("draw_tab",detail,x,y,width,height);
+
xrs=cairo_create();
cge_gdk(xrs,window);
+
cge_draw_arrow_from_rc(xrs,
style,
***************
*** 1398,1401 ****
--- 1441,1446 ----
cge_style *cstyle;
+ debug_msg("draw_shadow",detail,x,y,width,height);
+
cstyle=cge_get_style(style,detail);
***************
*** 1453,1456 ****
--- 1498,1503 ----
cge_style *cstyle;
+ debug_msg("draw_shadow_gap",detail,x,y,width,height);
+
cstyle=cge_get_style(style,detail);
***************
*** 1510,1513 ****
--- 1557,1563 ----
{
cairo_t *xrs;
+
+ debug_msg("draw_arrow",detail,x,y,width,height);
+
xrs=cairo_create();
cge_gdk(xrs,window);
***************
*** 1536,1539 ****
--- 1586,1591 ----
cge_style *cstyle;
+ debug_msg("draw_focus",detail,x,y,width,height);
+
cstyle=cge_get_style(style,detail);
***************
*** 1542,1545 ****
--- 1594,1598 ----
cge_gdk(xrs,window);
+
if(!GTK_IS_NOTEBOOK(widget))
cge_draw_box(xrs,
***************
*** 1553,1556 ****
--- 1606,1610 ----
+
cairo_destroy(xrs);
***************
*** 1570,1573 ****
--- 1624,1629 ----
gint x_off=0,y_off=0;
+ debug_msg("draw_box",detail,x,y,width,height);
+
xrs=cairo_create();
***************
*** 1577,1591 ****
//cairo_translate(xrs,-(double)x_off,-(double)y_off);
- //printf("detail(draw_box) : %s\n",detail);
if(DETAIL("trough"))
! cge_draw_rectangle(xrs,style->bg[GTK_STATE_NORMAL],1,x,y,width,height);
!
! if(DETAIL("menu")
) {
! }
! else
{
cge_draw_filled_box_from_rc(xrs,
--- 1633,1677 ----
//cairo_translate(xrs,-(double)x_off,-(double)y_off);
if(DETAIL("trough"))
! {
! cge_draw_rectangle(xrs,style->bg[GTK_STATE_NORMAL],1,x,y,width,height);
! }
!
!
! if(DETAIL("menu")
) {
! gint d;
! /* Don't ask me about that ... */
! gdk_window_get_geometry (window,
! &x,
! &y,
! &width,
! &height,
! &d);
! debug_msg("draw_box[recalculated]",detail,x,y,width,height);
! /* cge_draw_box(xrs,
! style->dark[state_type],
! NULL,
! 1,
! x,y,width,height,
! 0,
! FALSE,
! 1);
! */
!
! cge_draw_unfilled_box_from_rc(xrs,
! style,
! state_type,
! detail,
! x,
! y,
! width,
! height);
!
! }
! else
{
cge_draw_filled_box_from_rc(xrs,
***************
*** 1635,1638 ****
--- 1721,1726 ----
cge_style *cstyle;
+ debug_msg("draw_box_gap",detail,x,y,width,height);
+
cstyle=cge_get_style(style,detail);
***************
*** 1695,1698 ****
--- 1783,1789 ----
cairo_t *xrs;
gint x_off=0,y_off=0;
+
+ debug_msg("draw_flat_box",detail,x,y,width,height);
+
xrs=cairo_create();
cge_gdk(xrs,window);
***************
*** 1701,1705 ****
cge_draw_rectangle(xrs,style->bg[state_type],1,x,y,width,height);
! //printf("detail(draw_flat_box) : %s\n",detail);
--- 1792,1796 ----
cge_draw_rectangle(xrs,style->bg[state_type],1,x,y,width,height);
!
***************
*** 1715,1719 ****
height);
!
--- 1806,1817 ----
height);
! cge_draw_unfilled_box_from_rc(xrs,
! style,
! state_type,
! detail,
! x,
! y,
! width,
! height);
***************
*** 1735,1738 ****
--- 1833,1838 ----
cge_style *cstyle;
+ debug_msg("draw_check",detail,x,y,width,height);
+
cstyle=cge_get_style(style,detail);
***************
*** 1806,1809 ****
--- 1906,1911 ----
cge_style *cstyle;
+ debug_msg("draw_option",detail,x,y,width,height);
+
cstyle=cge_get_style(style,detail);
***************
*** 1888,1891 ****
--- 1990,1995 ----
cge_style *cstyle;
+ debug_msg("draw_extension",detail,x,y,width,height);
+
cstyle=cge_get_style(style,detail);
***************
*** 1945,1948 ****
--- 2049,2054 ----
gint x_off=0,y_off=0;
+ debug_msg("draw_slider",detail,x,y,width,height);
+
xrs=cairo_create();
cge_gdk(xrs,window);
***************
*** 1996,1999 ****
--- 2102,2107 ----
gint x_off=0,y_off=0;
+ debug_msg("draw_handle",detail,x,y,width,height);
+
xrs=cairo_create();
cge_gdk(xrs,window);
***************
*** 2039,2042 ****
--- 2147,2152 ----
gint x_off=0,y_off=0;
+ debug_msg("draw_resize_grip",detail,x,y,width,height);
+
xrs=cairo_create();
cge_gdk(xrs,window);
***************
*** 2070,2073 ****
--- 2180,2184 ----
}
+ /* should work */
static void set_background (GtkStyle *style,
GdkWindow *window,
***************
*** 2093,2103 ****
xrs=cairo_create();
-
-
- /*gdk_window_set_background (window,
- &style->bg[state_type]);
-
- */
-
pm = gdk_pixmap_new(window,w,h,d);
cge_gdk(xrs,pm);
--- 2204,2207 ----
***************
*** 2109,2133 ****
cairo_translate(xrs,-(double)x_off,-(double)y_off);
- /* cge_draw_rectangle(xrs,
- style->bg[state_type],
- 1,
- x,y,w,h);
- */
- cge_draw_filled_box_from_rc(xrs,
- style,
- state_type,
- "background",
- x_off,
- y_off,
- x,
- y,
- w,
- h);
! gdk_window_set_back_pixmap(window,pm,FALSE);
- //printf("set_background : %i %i %i %i %i %i\n",x_off,y_off,x,y,w,h);
cairo_destroy(xrs);
}
--- 2213,2237 ----
cairo_translate(xrs,-(double)x_off,-(double)y_off);
!
! cge_draw_rectangle(xrs,style->bg[GTK_STATE_NORMAL],1,x,y,w,h);
! /* we can now have style defined background ! */
! /*
! cge_draw_filled_box_from_rc(xrs,
! style,
! state_type,
! "background",
! x_off,
! y_off,
! x,
! y,
! w,
! h);
!
! */
! gdk_window_set_back_pixmap(window,pm,FALSE);
cairo_destroy(xrs);
}
***************
*** 2179,2183 ****
style_class->draw_focus = draw_focus;
style_class->draw_box = draw_box;
! style_class->draw_flat_box = draw_flat_box;
style_class->draw_box_gap = draw_box_gap;
style_class->draw_extension = draw_extension;
--- 2283,2287 ----
style_class->draw_focus = draw_focus;
style_class->draw_box = draw_box;
! // style_class->draw_flat_box = draw_flat_box;
style_class->draw_box_gap = draw_box_gap;
style_class->draw_extension = draw_extension;
***************
*** 2194,2197 ****
//style_class->draw_layout = draw_layout;
! //style_class->set_background=set_background;
}
--- 2298,2301 ----
//style_class->draw_layout = draw_layout;
! style_class->set_background=set_background;
}
More information about the cairo-commit
mailing list