On Sun, Oct 24, 2010 at 04:14:30PM +0200, Martin Jansa wrote:
> my not working testcase attached

attached testcase does draw points on mouse movement now, but still
doesn't kill Xserver :/.

-- 
Martin 'JaMa' Jansa     jabber: [email protected]
#include <gtk/gtk.h> 

static gint
motion_notify_event (GtkWidget *widget, GdkEventButton *event)
{
  GdkWindow *window = widget->window;
  GdkGC *GC = gdk_gc_new (window);
  if (event->button == 1) {
//      printf("[%f, %f]\n", event->x, event->y);
      gdk_draw_point(window, GC, event->x, event->y);
  }

  return TRUE;
}

int main(int argc, char *argv[]) { 
  GtkWidget * MainWindow = NULL; 
  GtkAllocation GombAlloc; 
  GdkGC *GC = NULL; 
  GdkColor FgColor; 
  GdkWindow *window = NULL; 

  gtk_init(&argc, &argv); 
  MainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); 
//  gtk_window_set_resizable((GtkWindow *) MainWindow, FALSE);
//  gtk_window_set_default_size((GtkWindow *) MainWindow, 320, 200);
  gtk_signal_connect (GTK_OBJECT (MainWindow), "motion_notify_event",
                      (GtkSignalFunc) motion_notify_event, NULL);
  gtk_widget_set_events (MainWindow, GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK);
  gtk_widget_realize(MainWindow);
  gtk_widget_show_all (MainWindow); 
/*
  window = MainWindow->window;
  GombAlloc = MainWindow->allocation; 
  gdk_color_parse ("red", &FgColor); 
  printf("%s color\n", gdk_color_to_string(&FgColor));
  GC = gdk_gc_new (window); 
  gdk_gc_set_foreground(GC, &FgColor); 
  gdk_gc_set_background(GC, &FgColor); 
  gdk_gc_set_fill(GC, GDK_SOLID);
  printf("%d points\n", GombAlloc.width);
  int i;
  for(i = 0; i <= GombAlloc.width; i++) { 
    gdk_draw_point(window, GC, GombAlloc.x + i, GombAlloc.y + GombAlloc.height / 2);
  }
*/
  gtk_main(); 
  return 0; 
} 
_______________________________________________
Shr-User mailing list
[email protected]
http://lists.shr-project.org/mailman/listinfo/shr-user

Reply via email to