title: GtkButton to emit GDK_KEY_PRESS
body: <p>I'm attempting to attach to a toolbar button a signal associated with a keystroke supported by GtkTextView (CTRL+a, CTRL+x, etc) using the following widget structure, signal connect, and callback:</p>
  
  <pre><code>typedef struct
  {
      GtkWidget *window;
      GtkWidget *text_view;
  }EditorWidgets;
  
  //...
  
      g_signal_connect(cut, "clicked", G_CALLBACK(cut_button_press), editor_widgets);
  
  //...
  
  static void cut_button_press(GtkWidget *button, EditorWidgets *editor_widgets)
  {
      UNUSED(button);
  
      GdkEvent *event = gdk_event_new(GDK_KEY_PRESS);
  
      event-&gt;key.window = gtk_widget_get_window(editor_widgets-&gt;window);
      event-&gt;key.send_event = FALSE;
      event-&gt;key.time = 0;
      event-&gt;key.state = GDK_CONTROL_MASK;
      event-&gt;key.keyval = GDK_KEY_x;
      event-&gt;key.string = g_strdup("x");
      event-&gt;key.length = strlen(event-&gt;key.string);
  
      gtk_main_do_event(event);
  
      gdk_event_free(event);
  }
  </code></pre>
  
  <p>When run, GDK complains with the following:</p>
  
  <pre><code>(ex1:7856): Gdk-WARNING **: Event with type 8 not holding a GdkDevice. It is most likely synthesized outside Gdk/GTK+
  </code></pre>
  
  <p>Which lets me know I've created the signal improperly (I assume). However, there's very little out there about having buttons emit GDK signals, so I'm at a loss for what's missing here.</p>
  
  <p>As a secondary question, I remember reading somewhere that there was a GDK <code>#define</code> for <code>TIME_NOW</code> or something, but I couldn't find it again. Any hints there?</p>