View | Details | Raw Unified | Return to bug 188264 | Differences between
and this patch

Collapse All | Expand All

(-)x11-toolkits/gtk20/Makefile (-1 / +3 lines)
Lines 40-46 CPPFLAGS+= -I${LOCALBASE}/include Link Here
40
LDFLAGS+=	-L${LOCALBASE}/lib
40
LDFLAGS+=	-L${LOCALBASE}/lib
41
INSTALL_TARGET=	install-strip
41
INSTALL_TARGET=	install-strip
42
42
43
OPTIONS_DEFINE=	CUPS DEBUG
43
OPTIONS_DEFINE=	CUPS DEBUG SHIFT_INSERT
44
OPTIONS_DEFAULT=CUPS
44
OPTIONS_DEFAULT=CUPS
45
OPTIONS_SUB=	yes
45
OPTIONS_SUB=	yes
46
46
Lines 48-53 CUPS_LIB_DEPENDS= libcups.so:${PORTSDIR}/print/cup Link Here
48
CUPS_CONFIGURE_ON=	--enable-cups=auto
48
CUPS_CONFIGURE_ON=	--enable-cups=auto
49
CUPS_CONFIGURE_OFF=	--disable-cups
49
CUPS_CONFIGURE_OFF=	--disable-cups
50
DEBUG_CONFIGURE_ON=	--enable-debug=yes
50
DEBUG_CONFIGURE_ON=	--enable-debug=yes
51
SHIFT_INSERT_DESC=	Use Shift-Insert to paste primary selection
52
SHIFT_INSERT_EXTRA_PATCHES= ${FILESDIR}/extra-patch-shift-insert
51
53
52
.include <bsd.port.options.mk>
54
.include <bsd.port.options.mk>
53
55
(-)x11-toolkits/gtk20/files/extra-patch-shift-insert (+24 lines)
Line 0 Link Here
1
--- gtk/gtktextview.c~
2
+++ gtk/gtktextview.c
3
@@ -1255,7 +1255,8 @@ gtk_text_view_class_init (GtkTextViewCla
4
   gtk_binding_entry_add_signal (binding_set, GDK_Insert, GDK_CONTROL_MASK,
5
 				"copy-clipboard", 0);
6
   gtk_binding_entry_add_signal (binding_set, GDK_Insert, GDK_SHIFT_MASK,
7
-				"paste-clipboard", 0);
8
+				"paste-selection", 1,
9
+				G_TYPE_STRING, "primary");
10
 
11
   /* Overwrite */
12
   gtk_binding_entry_add_signal (binding_set, GDK_Insert, 0,
13
--- gtk/gtkentry.c~
14
+++ gtk/gtkentry.c
15
@@ -1720,7 +1720,8 @@ gtk_entry_class_init (GtkEntryClass *cla
16
   gtk_binding_entry_add_signal (binding_set, GDK_Insert, GDK_CONTROL_MASK,
17
 				"copy-clipboard", 0);
18
   gtk_binding_entry_add_signal (binding_set, GDK_Insert, GDK_SHIFT_MASK,
19
-				"paste-clipboard", 0);
20
+				"paste-selection", 1,
21
+				G_TYPE_STRING, "primary");
22
 
23
   /* Overwrite */
24
   gtk_binding_entry_add_signal (binding_set, GDK_Insert, 0,
(-)x11-toolkits/gtk20/files/patch-gnome-bug643391 (+224 lines)
Line 0 Link Here
1
From 1362bbc140d6853307a7127aead766b001b613b6 Mon Sep 17 00:00:00 2001
2
From: Andy Spencer <andy753421@gmail.com>
3
Date: Sun, 27 Feb 2011 01:52:06 +0000
4
Subject: [PATCH 1/1] Add "paste-selection" keybind signal
5
6
This allows (re)binding a key to paste the PRIMARY and/or SECONDARY
7
selections under X11.
8
---
9
 gtk/gtkentry.c    |   42 ++++++++++++++++++++++++++++++++++++++++++
10
 gtk/gtkentry.h    |    4 +++-
11
 gtk/gtktextview.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
12
 gtk/gtktextview.h |    4 +++-
13
 4 files changed, 96 insertions(+), 2 deletions(-)
14
15
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
16
index dd509c2..2066952 100644
17
--- gtk/gtkentry.c
18
+++ gtk/gtkentry.c
19
@@ -168,6 +168,7 @@ enum {
20
   CUT_CLIPBOARD,
21
   COPY_CLIPBOARD,
22
   PASTE_CLIPBOARD,
23
+  PASTE_SELECTION,
24
   TOGGLE_OVERWRITE,
25
   ICON_PRESS,
26
   ICON_RELEASE,
27
@@ -382,6 +383,8 @@ static void gtk_entry_backspace          (GtkEntry        *entry);
28
 static void gtk_entry_cut_clipboard      (GtkEntry        *entry);
29
 static void gtk_entry_copy_clipboard     (GtkEntry        *entry);
30
 static void gtk_entry_paste_clipboard    (GtkEntry        *entry);
31
+static void gtk_entry_paste_selection    (GtkEntry        *entry,
32
+					  const gchar     *which);
33
 static void gtk_entry_toggle_overwrite   (GtkEntry        *entry);
34
 static void gtk_entry_select_all         (GtkEntry        *entry);
35
 static void gtk_entry_real_activate      (GtkEntry        *entry);
36
@@ -615,6 +618,7 @@ gtk_entry_class_init (GtkEntryClass *class)
37
   class->cut_clipboard = gtk_entry_cut_clipboard;
38
   class->copy_clipboard = gtk_entry_copy_clipboard;
39
   class->paste_clipboard = gtk_entry_paste_clipboard;
40
+  class->paste_selection = gtk_entry_paste_selection;
41
   class->toggle_overwrite = gtk_entry_toggle_overwrite;
42
   class->activate = gtk_entry_real_activate;
43
   class->get_text_area_size = gtk_entry_get_text_area_size;
44
@@ -1489,6 +1493,25 @@ gtk_entry_class_init (GtkEntryClass *class)
45
 		  G_TYPE_NONE, 0);
46
 
47
   /**
48
+   * GtkEntry::paste-selection:
49
+   * @entry: the object which received the signal
50
+   *
51
+   * The ::paste-selection signal is a
52
+   * <link linkend="keybinding-signals">keybinding signal</link>
53
+   * which gets emitted to paste the contents of the given selection
54
+   * into the entry.
55
+   */
56
+  signals[PASTE_SELECTION] =
57
+    g_signal_new (I_("paste-selection"),
58
+		  G_OBJECT_CLASS_TYPE (gobject_class),
59
+		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
60
+		  G_STRUCT_OFFSET (GtkEntryClass, paste_selection),
61
+		  NULL, NULL,
62
+		  _gtk_marshal_VOID__STRING,
63
+		  G_TYPE_NONE, 1,
64
+		  G_TYPE_STRING);
65
+
66
+  /**
67
    * GtkEntry::toggle-overwrite:
68
    * @entry: the object which received the signal
69
    *
70
@@ -5094,6 +5117,25 @@ gtk_entry_paste_clipboard (GtkEntry *entry)
71
 }
72
 
73
 static void
74
+gtk_entry_paste_selection (GtkEntry *entry,
75
+			   const gchar *which)
76
+{
77
+  if (entry->editable)
78
+    {
79
+      if (g_str_equal(which, "primary"))
80
+	gtk_entry_paste (entry, GDK_SELECTION_PRIMARY);
81
+      else if (g_str_equal(which, "secondary"))
82
+	gtk_entry_paste (entry, GDK_SELECTION_SECONDARY);
83
+      else if (g_str_equal(which, "clipboard"))
84
+	gtk_entry_paste (entry, GDK_SELECTION_CLIPBOARD);
85
+      else
86
+	gtk_widget_error_bell (GTK_WIDGET (entry));
87
+    }
88
+  else
89
+    gtk_widget_error_bell (GTK_WIDGET (entry));
90
+}
91
+
92
+static void
93
 gtk_entry_delete_cb (GtkEntry *entry)
94
 {
95
   GtkEditable *editable = GTK_EDITABLE (entry);
96
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
97
index 9bbba0b..21c0ca4 100644
98
--- gtk/gtkentry.h
99
+++ gtk/gtkentry.h
100
@@ -158,9 +158,11 @@ struct _GtkEntryClass
101
 			       gint           *width,
102
 			       gint           *height);
103
 
104
+  void (* paste_selection)    (GtkEntry             *entry,
105
+			       const gchar          *which);
106
+
107
   /* Padding for future expansion */
108
   void (*_gtk_reserved1)      (void);
109
-  void (*_gtk_reserved2)      (void);
110
 };
111
 
112
 GType      gtk_entry_get_type       		(void) G_GNUC_CONST;
113
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
114
index 9a2edc0..c9cd014 100644
115
--- gtk/gtktextview.c
116
+++ gtk/gtktextview.c
117
@@ -135,6 +135,7 @@ enum
118
   CUT_CLIPBOARD,
119
   COPY_CLIPBOARD,
120
   PASTE_CLIPBOARD,
121
+  PASTE_SELECTION,
122
   TOGGLE_OVERWRITE,
123
   MOVE_VIEWPORT,
124
   SELECT_ALL,
125
@@ -281,6 +282,8 @@ static void gtk_text_view_backspace        (GtkTextView           *text_view);
126
 static void gtk_text_view_cut_clipboard    (GtkTextView           *text_view);
127
 static void gtk_text_view_copy_clipboard   (GtkTextView           *text_view);
128
 static void gtk_text_view_paste_clipboard  (GtkTextView           *text_view);
129
+static void gtk_text_view_paste_selection  (GtkTextView           *text_view,
130
+					    const gchar           *which);
131
 static void gtk_text_view_toggle_overwrite (GtkTextView           *text_view);
132
 static void gtk_text_view_toggle_cursor_visible (GtkTextView      *text_view);
133
 static void gtk_text_view_compat_move_focus(GtkTextView           *text_view,
134
@@ -532,6 +535,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
135
   klass->cut_clipboard = gtk_text_view_cut_clipboard;
136
   klass->copy_clipboard = gtk_text_view_copy_clipboard;
137
   klass->paste_clipboard = gtk_text_view_paste_clipboard;
138
+  klass->paste_selection = gtk_text_view_paste_selection;
139
   klass->toggle_overwrite = gtk_text_view_toggle_overwrite;
140
   klass->move_focus = gtk_text_view_compat_move_focus;
141
   klass->set_scroll_adjustments = gtk_text_view_set_scroll_adjustments;
142
@@ -947,6 +951,25 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
143
 		  G_TYPE_NONE, 0);
144
 
145
   /**
146
+   * GtkTextView::paste-selection:
147
+   * @text_view: the object which received the signal
148
+   *
149
+   * The ::paste-selection signal is a
150
+   * <link linkend="keybinding-signals">keybinding signal</link>
151
+   * which gets emitted to paste the contents of the given selection
152
+   * into the text view.
153
+   */
154
+  signals[PASTE_SELECTION] =
155
+    g_signal_new (I_("paste-selection"),
156
+		  G_OBJECT_CLASS_TYPE (gobject_class),
157
+		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
158
+		  G_STRUCT_OFFSET (GtkTextViewClass, paste_selection),
159
+		  NULL, NULL,
160
+		  _gtk_marshal_VOID__STRING,
161
+		  G_TYPE_NONE, 1,
162
+		  G_TYPE_STRING);
163
+
164
+  /**
165
    * GtkTextView::toggle-overwrite:
166
    * @text_view: the object which received the signal
167
    *
168
@@ -5818,6 +5841,31 @@ gtk_text_view_paste_clipboard (GtkTextView *text_view)
169
 }
170
 
171
 static void
172
+gtk_text_view_paste_selection (GtkTextView *text_view,
173
+			       const gchar *which)
174
+{
175
+  GtkClipboard *clipboard = NULL;
176
+
177
+  if (g_str_equal (which, "primary"))
178
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
179
+					  GDK_SELECTION_PRIMARY);
180
+  else if (g_str_equal (which, "secondary"))
181
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
182
+					  GDK_SELECTION_SECONDARY);
183
+  else if (g_str_equal (which, "clipboard"))
184
+    clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
185
+					  GDK_SELECTION_CLIPBOARD);
186
+
187
+  if (clipboard)
188
+    gtk_text_buffer_paste_clipboard (get_buffer (text_view),
189
+				     clipboard,
190
+				     NULL,
191
+				     text_view->editable);
192
+  else
193
+    gtk_widget_error_bell (GTK_WIDGET (text_view));
194
+}
195
+
196
+static void
197
 gtk_text_view_paste_done_handler (GtkTextBuffer *buffer,
198
                                   GtkClipboard  *clipboard,
199
                                   gpointer       data)
200
diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h
201
index c3fa802..eacd734 100644
202
--- gtk/gtktextview.h
203
+++ gtk/gtktextview.h
204
@@ -204,6 +204,9 @@ struct _GtkTextViewClass
205
   void (* move_focus)       (GtkTextView     *text_view,
206
                              GtkDirectionType direction);
207
 
208
+  void (* paste_selection) (GtkTextView *text_view,
209
+			    const gchar *which);
210
+
211
   /* Padding for future expansion */
212
   void (*_gtk_reserved1) (void);
213
   void (*_gtk_reserved2) (void);
214
@@ -211,7 +214,6 @@ struct _GtkTextViewClass
215
   void (*_gtk_reserved4) (void);
216
   void (*_gtk_reserved5) (void);
217
   void (*_gtk_reserved6) (void);
218
-  void (*_gtk_reserved7) (void);
219
 };
220
 
221
 GType          gtk_text_view_get_type              (void) G_GNUC_CONST;
222
-- 
223
1.7.3.4
224

Return to bug 188264