focus_on_mouse_paste.diff 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. --- a/src/mssh-window.c
  2. +++ b/src/mssh-window.c
  3. @@ -21,6 +21,8 @@
  4. static gboolean mssh_window_session_close(gpointer data);
  5. static void mssh_window_session_focused(MSSHTerminal *terminal,
  6. gpointer data);
  7. +static gboolean mssh_window_mouse_paste_cb(MSSHTerminal *terminal,
  8. + gpointer data);
  9. static void mssh_window_insert(GtkWidget *widget, gchar *new_text,
  10. gint new_text_length, gint *position, gpointer data);
  11. static void mssh_window_add_session(MSSHWindow *window, char *hostname);
  12. @@ -248,6 +250,14 @@
  13. }
  14. }
  15. +static gboolean mssh_window_mouse_paste_cb(MSSHTerminal *terminal,
  16. + gpointer data)
  17. +{
  18. + gtk_widget_grab_focus(GTK_WIDGET(terminal));
  19. +
  20. + return FALSE;
  21. +}
  22. +
  23. static void mssh_window_session_focused(MSSHTerminal *terminal,
  24. gpointer data)
  25. {
  26. @@ -355,6 +365,8 @@
  27. G_CALLBACK(mssh_window_session_closed), window);
  28. g_signal_connect(G_OBJECT(terminal), "session-focused",
  29. G_CALLBACK(mssh_window_session_focused), window);
  30. + g_signal_connect(GTK_WIDGET(terminal), "button-release-event",
  31. + G_CALLBACK(mssh_window_mouse_paste_cb), window);
  32. mssh_terminal_init_session(terminal, hostname);