Added GdkAtom argument for copy_clipboard() and paste_clipboard()
parent
b4d02e60d8
commit
80377391a6
|
@ -132,13 +132,15 @@ gboolean moo_term_key_press (GtkWidget *widget,
|
|||
case GDK_Insert:
|
||||
if (modifiers & GDK_SHIFT_MASK)
|
||||
{
|
||||
moo_term_paste_clipboard (term);
|
||||
moo_term_paste_clipboard (term,
|
||||
GDK_SELECTION_CLIPBOARD);
|
||||
handled = TRUE;
|
||||
suppress_meta_esc = TRUE;
|
||||
}
|
||||
else if (modifiers & GDK_CONTROL_MASK)
|
||||
{
|
||||
moo_term_copy_clipboard (term);
|
||||
moo_term_copy_clipboard (term,
|
||||
GDK_SELECTION_CLIPBOARD);
|
||||
handled = TRUE;
|
||||
suppress_meta_esc = TRUE;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,12 @@ char *term_selection_get_text (MooTerm *term)
|
|||
}
|
||||
|
||||
|
||||
#define HOWMANY(x, y) (((x) + (y) - 1) / y())
|
||||
#define CALC_ROW(y, char_height) (HOWMANY (y + 1, char_height) - 1)
|
||||
#define CALC_COL(x, char_width) (HOWMANY (x + 1, char_width) - 1)
|
||||
#define DIFF(x, y) (ABS ((x) - (y)))
|
||||
|
||||
|
||||
gboolean moo_term_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
|
@ -65,7 +71,26 @@ gboolean moo_term_button_press (GtkWidget *widget,
|
|||
|
||||
moo_term_set_pointer_visible (term, TRUE);
|
||||
|
||||
return FALSE;
|
||||
if (event->button != 1)
|
||||
{
|
||||
if (event->type != GDK_BUTTON_PRESS)
|
||||
return TRUE;
|
||||
|
||||
switch (event->button)
|
||||
{
|
||||
case 2:
|
||||
moo_term_paste_clipboard (term, GDK_SELECTION_PRIMARY);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
moo_term_do_popup_menu (term, event);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +103,7 @@ gboolean moo_term_button_release (GtkWidget *widget,
|
|||
|
||||
moo_term_set_pointer_visible (term, TRUE);
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,5 +116,5 @@ gboolean moo_term_motion_notify (GtkWidget *widget,
|
|||
|
||||
moo_term_set_pointer_visible (term, TRUE);
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -463,9 +463,14 @@ static void scrollback_changed (MooTerm *term,
|
|||
guint scrollback = buf_scrollback (term->priv->buffer);
|
||||
|
||||
if (term->priv->_scrolled && term->priv->_top_line > scrollback)
|
||||
{
|
||||
term_selection_clear (term);
|
||||
scroll_to_bottom (term, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
update_adjustment (term);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -748,13 +753,19 @@ void moo_term_feed_child (MooTerm *term,
|
|||
}
|
||||
|
||||
|
||||
void moo_term_copy_clipboard (MooTerm *term)
|
||||
void moo_term_copy_clipboard (MooTerm *term,
|
||||
GdkAtom selection)
|
||||
{
|
||||
char *text = term_selection_get_text (term);
|
||||
GtkClipboard *cb;
|
||||
char *text;
|
||||
|
||||
text = term_selection_get_text (term);
|
||||
|
||||
if (text && *text)
|
||||
gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
|
||||
text, -1);
|
||||
{
|
||||
cb = gtk_clipboard_get (selection);
|
||||
gtk_clipboard_set_text (cb, text, -1);
|
||||
}
|
||||
|
||||
if (text)
|
||||
{
|
||||
|
@ -770,14 +781,15 @@ void moo_term_ctrl_c (MooTerm *term)
|
|||
}
|
||||
|
||||
|
||||
void moo_term_paste_clipboard (MooTerm *term)
|
||||
void moo_term_paste_clipboard (MooTerm *term,
|
||||
GdkAtom selection)
|
||||
{
|
||||
GtkClipboard *cb;
|
||||
char *text;
|
||||
|
||||
g_return_if_fail (MOO_IS_TERM (term));
|
||||
|
||||
cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
cb = gtk_clipboard_get (selection);
|
||||
text = gtk_clipboard_wait_for_text (cb);
|
||||
|
||||
if (text)
|
||||
|
|
|
@ -90,8 +90,10 @@ void moo_term_scroll_lines (MooTerm *term,
|
|||
void moo_term_scroll_pages (MooTerm *term,
|
||||
int pages);
|
||||
|
||||
void moo_term_copy_clipboard (MooTerm *term);
|
||||
void moo_term_paste_clipboard (MooTerm *term);
|
||||
void moo_term_copy_clipboard (MooTerm *term,
|
||||
GdkAtom selection);
|
||||
void moo_term_paste_clipboard (MooTerm *term,
|
||||
GdkAtom selection);
|
||||
|
||||
void moo_term_ctrl_c (MooTerm *term);
|
||||
|
||||
|
|
Loading…
Reference in New Issue