Key repeat speeds and delays.




Greetings.

Im devoloping an application that requires an interactive input via the
keyboard. The problem is I need a continuous input and I can't seem to
find a way to get rid of that initial delay before the key-repeat sets
in after a key-press. E.g the user presses and holds <j>, but the
output becomes:  j[pause]jjjjjjjjjjjjjjjjjjjj. Anyone have any
experience on how to manipulate this? If you could tell me how to
fiddle with the speed of repetition from within a program I would also
be grateful.

Test program:

#include <gtk/gtk.h>

void
destroy() {
  gtk_exit(0);
}

key_press(GtkWidget *wid, GdkEventKey *key) {
  printf("Key: %s Value: %i\n",(*key).string, (*key).keyval);


int
main(int argc, char *argv[]) {
  GtkWidget *window;

  /* Window setup */     
  gtk_init(&argc, &argv);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window),"Key-detector");
  gtk_container_border_width(GTK_CONTAINER(window), 10);

  gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
		     GTK_SIGNAL_FUNC(key_press),NULL);


  gtk_widget_show(window);

  gtk_main();
  
     
  return 1;
}


-- 
Thomas Clemen		Email: 	    clemen@daimi.aau.dk



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