gtk2.6.8, drawing_area, drawing lines, windows xp, may be a BUG



minimalist but complete program hand typed here(so might there be typing errors[though checked 
thoroughly],[sorry, couldnot copy and paste, floppy drive crashed and no internet connection in my computer, 
browsing net through internet cafe])
 
people, please check if it happens to you,
 
#include<gtk/gtk.h>
/*
It could be a posible bug
 
lets draw a line
 
  (30,120) ---------------------------- (120,20)
 
lets draw another line
 
  (120,24) ---------------------------- (30,24)
 
now both lines should be parallel && same size && starts at 30 and end in 120
 
In windows XP: 2nd line shifts to left by 1 pixel, Gtk Version 2.6.8
In Windows 98: works fine,Gtk version 2.6.8(same dll as above)
In Gentoo 2004.2: works fine, Gtk version 2.4
 
anything you want to ask:yzonesoft yahoo com
*/
 
static void destroy(GtkWidget *widget, gpointer data)
{
 gtk_main_quit();
}
 
gboolean expose_event_callback(GtkWidget *widget, gpointer data)
{
gdk_draw_rectangle(widget->window,widget->style->white_gc,TRUE,5,5,(widget->allocation.width)-10,(widget->allocation.height)-10);
gdk_draw_line(widget->window,widget->style->black_gc,30,20,120,20);
gdk_draw_line(widget->window,widget->style->black_gc,120,24,30,24);
}
 
int main(int argc,char *argv[])
{
 GtkWidget *window;
 GtkWidget *drawing_area; 
 GtkWidget *box1;
 
 gtk_init(argc,&argv);
 
 window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
 g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(destroy),NULL);
 
 box1=gtk_hbox_new(FALSE,0);
 
 gtk_container_add(GTK_CONTAINER(window),box1);
 
 drawing_area=gtk_drawing_area_new();
 
 gtk_widget_set_size_request(drawing_area,200,100);
 
 g_signal_connect(G_OBJECT(drawing_area),"expose_event",G_CALLBACK (expose_event_callback),gpointer("GOOD");
 
 gtk_box_pack_start(GTK_BOX(box1),drawing_area,TRUE,TRUE,0);
 
 gtk_widget_show(drawing_area);
 gtk_widget_show(box1);
 gtk_widget_show(window);
 gtk_main();
 
 return 0;
}
 


                
---------------------------------
 Start your day with Yahoo! - make it your home page 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]