[vte/vte-next: 157/223] Move cursor-moved signal to VteBuffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 157/223] Move cursor-moved signal to VteBuffer
- Date: Wed, 22 Jun 2011 21:01:47 +0000 (UTC)
commit fd432899bb49cb5bbe7d8dea2dc5afb283525a75
Author: Christian Persch <chpe gnome org>
Date: Sat Jun 11 22:04:57 2011 +0200
Move cursor-moved signal to VteBuffer
src/vte.c | 47 +++++++++++++++++++++++++----------------------
src/vte.h | 1 -
src/vteaccess.c | 6 ++++--
src/vtebuffer.h | 1 +
4 files changed, 30 insertions(+), 25 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index b17feb9..e95a1ad 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -180,6 +180,7 @@ enum {
BUFFER_MAXIMIZE_WINDOW,
BUFFER_RESIZE_WINDOW,
BUFFER_MOVE_WINDOW,
+ BUFFER_CURSOR_MOVED,
LAST_BUFFER_SIGNAL,
};
@@ -909,15 +910,16 @@ _vte_terminal_queue_contents_changed(VteTerminal *terminal)
/* Emit a "cursor_moved" signal. */
static void
-vte_terminal_emit_cursor_moved(VteTerminal *terminal)
+vte_buffer_emit_cursor_moved(VteBuffer *buffer)
{
- if (terminal->pvt->cursor_moved_pending) {
+ if (buffer->pvt->cursor_moved_pending) {
_vte_debug_print(VTE_DEBUG_SIGNALS,
"Emitting `cursor-moved'.\n");
- g_signal_emit_by_name(terminal, "cursor-moved");
- terminal->pvt->cursor_moved_pending = FALSE;
+ g_signal_emit(buffer, buffer_signals[BUFFER_CURSOR_MOVED], 0);
+ buffer->pvt->cursor_moved_pending = FALSE;
}
}
+
static void
vte_terminal_queue_cursor_moved(VteTerminal *terminal)
{
@@ -10916,7 +10918,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
klass->char_size_changed = NULL;
klass->selection_changed = NULL;
klass->contents_changed = NULL;
- klass->cursor_moved = NULL;
klass->increase_font_size = NULL;
klass->decrease_font_size = NULL;
@@ -10989,22 +10990,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
G_TYPE_NONE, 0);
/**
- * VteTerminal::cursor-moved:
- * @vteterminal: the object which received the signal
- *
- * Emitted whenever the cursor moves to a new character cell. Used
- * primarily by #VteTerminalAccessible.
- */
- g_signal_new(I_("cursor-moved"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, cursor_moved),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /**
* VteTerminal::increase-font-size:
* @vteterminal: the object which received the signal
*
@@ -12697,7 +12682,7 @@ vte_terminal_emit_pending_signals(VteTerminal *terminal)
}
/* Flush any pending "inserted" signals. */
- vte_terminal_emit_cursor_moved(terminal);
+ vte_buffer_emit_cursor_moved(terminal->term_pvt->buffer);
vte_terminal_emit_pending_text_signals(terminal, 0);
vte_terminal_emit_contents_changed (terminal);
@@ -13526,6 +13511,7 @@ vte_buffer_class_init(VteBufferClass *klass)
klass->maximize_window = NULL;
klass->resize_window = NULL;
klass->move_window = NULL;
+ klass->cursor_moved = NULL;
/**
* VteBuffer::child-exited:
@@ -13718,6 +13704,23 @@ vte_buffer_class_init(VteBufferClass *klass)
G_TYPE_NONE, 0);
/**
+ * VteBuffer::cursor-moved:
+ * @vtebuffer: the object which received the signal
+ *
+ * Emitted whenever the cursor moves to a new character cell. Used
+ * primarily by #VteBufferAccessible.
+ */
+ buffer_signals[BUFFER_CURSOR_MOVED] =
+ g_signal_new(I_("cursor-moved"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteBufferClass, cursor_moved),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /**
* VteBuffer::lower-window:
* @vtebuffer: the object which received the signal
*
diff --git a/src/vte.h b/src/vte.h
index ab6d09f..7cd5f89 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -77,7 +77,6 @@ struct _VteTerminalClass {
void (*char_size_changed)(VteTerminal* terminal, guint char_width, guint char_height);
void (*selection_changed)(VteTerminal* terminal);
void (*contents_changed)(VteTerminal* terminal);
- void (*cursor_moved)(VteTerminal* terminal);
/* FIXMEchpe: should these return gboolean and have defaul thandlers
* settings the "scale" property?
diff --git a/src/vteaccess.c b/src/vteaccess.c
index b0cc790..a3ffc45 100644
--- a/src/vteaccess.c
+++ b/src/vteaccess.c
@@ -673,7 +673,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
/* A signal handler to catch "cursor-moved" signals. */
static void
-vte_terminal_accessible_invalidate_cursor(VteTerminal *terminal, gpointer data)
+vte_terminal_accessible_invalidate_cursor(VteBuffer *buffer, gpointer data)
{
VteTerminalAccessiblePrivate *priv;
@@ -776,12 +776,14 @@ static void
vte_terminal_initialize (AtkObject *obj, gpointer data)
{
VteTerminal *terminal;
+ VteBuffer *buffer;
AtkObject *parent;
const char *window_title;
ATK_OBJECT_CLASS (vte_terminal_accessible_parent_class)->initialize (obj, data);
terminal = VTE_TERMINAL (data);
+ buffer = vte_terminal_get_buffer(terminal);
_vte_terminal_accessible_ref(terminal);
@@ -801,7 +803,7 @@ vte_terminal_initialize (AtkObject *obj, gpointer data)
g_signal_connect(terminal, "text-scrolled",
G_CALLBACK(vte_terminal_accessible_text_scrolled),
obj);
- g_signal_connect(terminal, "cursor-moved",
+ g_signal_connect(buffer, "cursor-moved",
G_CALLBACK(vte_terminal_accessible_invalidate_cursor),
obj);
g_signal_connect(terminal, "window-title-changed",
diff --git a/src/vtebuffer.h b/src/vtebuffer.h
index b3ebbb2..13083ef 100644
--- a/src/vtebuffer.h
+++ b/src/vtebuffer.h
@@ -68,6 +68,7 @@ struct _VteBufferClass {
void (*move_window) (VteBuffer* buffer,
guint x,
guint y);
+ void (*cursor_moved) (VteBuffer* buffer);
/*< private >*/
VteBufferClassPrivate *priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]