Re: rubberbanding with GTK1* and GTK2*



kees ha scritto lo scorso 25/02/2005 12:45:
Can anyone explain to me why the very small program beneath, demonstrating
a very basic form of rubberbanding, works excellent while compiled
with GTK1* but does not work correctly when compiled with GTK2*.
[..]
 gint drawareacb(GtkWidget *widget, GdkEventButton *event, gpointer data)
  {
  gint  x0, y0;
  gint x[2], y[2];
  if(ii == 0)
   {
   cleararea(drawing_area);
   ii=1;
   }
  gdk_window_get_pointer(drawing_area->window, &x0, &y0, NULL);
  switch(event->type)
  {
  case GDK_BUTTON_PRESS:
  x[0]=x0;
  y[0]=y0;
  gdk_draw_line(drawing_area->window, gc, 200, 400, x0, y0);
  break;
  case GDK_MOTION_NOTIFY:
  x[1]=x0;
  y[1]=y0;
  gdk_draw_line(drawing_area->window, gc, 200, 400, x[0], y[0]);
                                                      ^^^^^^^^^^
gdb gives:
x[0] = 1048
y[0] = -1073751042

  gdk_draw_line(drawing_area->window, gc, 200, 400, x[1], y[1]);
  x[0]=x[1];
  y[0]=y[1];



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