1
0
mirror of https://github.com/gryf/gryf-overlay.git synced 2026-04-28 07:23:36 +02:00

Added fix for pasting PRIMARY selection on GTK2

This commit is contained in:
2017-04-28 14:27:04 +02:00
parent b92fcedc30
commit 1a97c1e372
6 changed files with 680 additions and 0 deletions
@@ -0,0 +1,33 @@
From 9e0f33144aff8d792ab105927cf686eda0afd25e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sun, 18 May 2014 10:50:05 +0200
Subject: [PATCH] aliasfilecheck: check for sources both in builddir & srcdir.
The $gtk_all_c_sources variable contains both supplied and generated
sources. The former reside in $srcdir, the latter in the build directory
(cwd).
In order to handle both kinds properly, first try to find each source
file in cwd, and then fallback to $srcdir. This makes it possible to use
out-of-source builds, and guarantees that fresh-built source files will
be used rather than pre-generated copies included in the distribution
tarball.
---
gtk/aliasfilescheck.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gtk/aliasfilescheck.sh b/gtk/aliasfilescheck.sh
index 31b49d4..3636a82 100755
--- a/gtk/aliasfilescheck.sh
+++ b/gtk/aliasfilescheck.sh
@@ -6,6 +6,6 @@ if test "x$gtk_all_c_sources" = x; then
fi
grep 'IN_FILE' ${srcdir-.}/gtk.symbols | sed 's/.*(//;s/).*//' | grep __ | sort -u > expected-files
-{ cd ${srcdir-.}; grep '^ *# *define __' $gtk_all_c_sources; } | sed 's/.*define //;s/ *$//' | sort > actual-files
+{ for f in $gtk_all_c_sources; do if test -f ${f}; then grep '^ *# *define __' ${f}; else grep '^ *# *define __' "${srcdir-.}"/${f}; fi; done } | sed 's/.*define //;s/ *$//' | sort > actual-files
diff expected-files actual-files && rm -f expected-files actual-files
--
1.9.3
@@ -0,0 +1,42 @@
From debba4d14155a9e5736de069c2b693ab6f6e21aa Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Wed, 5 Oct 2016 12:20:14 -0400
Subject: [PATCH] entry: Fix a corner case of overwrite mode
We currently beep when a character is appended at the end in
overwrite mode. That is obviously not right. Patch based on
a patch by Ian MacDonald.
https://bugzilla.gnome.org/show_bug.cgi?id=772389
---
gtk/gtkentry.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index b522039..bc33754 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -5224,6 +5224,7 @@ gtk_entry_enter_text (GtkEntry *entry,
GtkEditable *editable = GTK_EDITABLE (entry);
gint tmp_pos;
gboolean old_need_im_reset;
+ guint text_length;
old_need_im_reset = entry->need_im_reset;
entry->need_im_reset = FALSE;
@@ -5233,7 +5234,11 @@ gtk_entry_enter_text (GtkEntry *entry,
else
{
if (entry->overwrite_mode)
- gtk_entry_delete_from_cursor (entry, GTK_DELETE_CHARS, 1);
+ {
+ text_length = gtk_entry_buffer_get_length (get_buffer (entry));
+ if (entry->current_pos < text_length)
+ gtk_entry_delete_from_cursor (entry, GTK_DELETE_CHARS, 1);
+ }
}
tmp_pos = entry->current_pos;
--
2.10.0
@@ -0,0 +1,78 @@
From 260f94f3914ba18a256e6f1c222f643a57854e80 Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <eva@gentoo.org>
Date: Sat, 9 May 2015 23:30:58 +0200
Subject: [PATCH] Always use external gtk-update-icon-cache
---
configure.ac | 8 +++-----
docs/reference/gtk/Makefile.am | 2 +-
gtk/Makefile.am | 13 ++-----------
3 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4e11b40..7ef8cb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -913,11 +913,9 @@ dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
-if test $cross_compiling = yes; then
- AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
- if test x$GTK_UPDATE_ICON_CACHE = xno; then
- REBUILD_PNGS=#
- fi
+AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
+if test x$GTK_UPDATE_ICON_CACHE = xno; then
+ REBUILD_PNGS=#
fi
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am
index c239445..60b5265 100644
--- a/docs/reference/gtk/Makefile.am
+++ b/docs/reference/gtk/Makefile.am
@@ -368,7 +368,7 @@ EXTRA_DIST += version.xml.in
if ENABLE_MAN
-man_MANS = gtk-query-immodules-2.0.1 gtk-update-icon-cache.1 gtk-builder-convert.1
+man_MANS = gtk-query-immodules-2.0.1 gtk-builder-convert.1
%.1 : %.xml
@XSLTPROC@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 8cc4536..a7afbf3 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1087,8 +1087,7 @@ endif
# Installed tools
#
bin_PROGRAMS = \
- gtk-query-immodules-2.0 \
- gtk-update-icon-cache
+ gtk-query-immodules-2.0
bin_SCRIPTS = gtk-builder-convert
@@ -1438,16 +1437,8 @@ stamp-icons: $(STOCK_ICONS)
) done \
&& touch stamp-icons
-if CROSS_COMPILING
-gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
-else
-gtk_update_icon_cache_program = \
- ./gtk-update-icon-cache
-endif
-
gtkbuiltincache.h: @REBUILD@ stamp-icons
- $(MAKE) $(AM_MAKEFLAGS) gtk-update-icon-cache$(EXEEXT)
- $(gtk_update_icon_cache_program) --force --ignore-theme-index \
+ $(GTK_UPDATE_ICON_CACHE) --force --ignore-theme-index \
--include-image-data \
--source builtin_icons stock-icons > gtkbuiltincache.h.tmp && \
mv gtkbuiltincache.h.tmp gtkbuiltincache.h
--
2.10.0
@@ -0,0 +1,208 @@
diff -ur gtk+-2.24.31/gtk/gtkentry.c gtk+-2.24.31_patched/gtk/gtkentry.c
--- gtk+-2.24.31/gtk/gtkentry.c 2016-07-03 20:01:01.000000000 +0200
+++ gtk+-2.24.31_patched/gtk/gtkentry.c 2016-10-06 20:19:41.504175144 +0200
@@ -168,6 +168,7 @@
CUT_CLIPBOARD,
COPY_CLIPBOARD,
PASTE_CLIPBOARD,
+ PASTE_SELECTION,
TOGGLE_OVERWRITE,
ICON_PRESS,
ICON_RELEASE,
@@ -382,6 +383,8 @@
static void gtk_entry_cut_clipboard (GtkEntry *entry);
static void gtk_entry_copy_clipboard (GtkEntry *entry);
static void gtk_entry_paste_clipboard (GtkEntry *entry);
+static void gtk_entry_paste_selection (GtkEntry *entry,
+ const gchar *which);
static void gtk_entry_toggle_overwrite (GtkEntry *entry);
static void gtk_entry_select_all (GtkEntry *entry);
static void gtk_entry_real_activate (GtkEntry *entry);
@@ -612,6 +615,7 @@
class->cut_clipboard = gtk_entry_cut_clipboard;
class->copy_clipboard = gtk_entry_copy_clipboard;
class->paste_clipboard = gtk_entry_paste_clipboard;
+ class->paste_selection = gtk_entry_paste_selection;
class->toggle_overwrite = gtk_entry_toggle_overwrite;
class->activate = gtk_entry_real_activate;
class->get_text_area_size = gtk_entry_get_text_area_size;
@@ -1485,6 +1489,26 @@
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+
+ /**
+ * GtkEntry::paste-selection:
+ * @entry: the object which received the signal
+ *
+ * The ::paste-selection signal is a
+ * <link linkend="keybinding-signals">keybinding signal</link>
+ * which gets emitted to paste the contents of the given selection
+ * into the entry.
+ */
+ signals[PASTE_SELECTION] =
+ g_signal_new (I_("paste-selection"),
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkEntryClass, paste_selection),
+ NULL, NULL,
+ _gtk_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
/**
* GtkEntry::toggle-overwrite:
* @entry: the object which received the signal
@@ -5091,6 +5115,23 @@
gtk_widget_error_bell (GTK_WIDGET (entry));
}
+gtk_entry_paste_selection (GtkEntry *entry, const gchar *which)
+{
+ if (entry->editable)
+ {
+ if (g_str_equal(which, "primary"))
+ gtk_entry_paste (entry, GDK_SELECTION_PRIMARY);
+ else if (g_str_equal(which, "secondary"))
+ gtk_entry_paste (entry, GDK_SELECTION_PRIMARY);
+ else if (g_str_equal(which, "clipboard"))
+ gtk_entry_paste (entry, GDK_SELECTION_CLIPBOARD);
+ else
+ gtk_widget_error_bell (GTK_WIDGET (entry));
+ }
+ else
+ gtk_widget_error_bell (GTK_WIDGET (entry));
+}
+
static void
gtk_entry_delete_cb (GtkEntry *entry)
{
diff -ur gtk+-2.24.31/gtk/gtkentry.h gtk+-2.24.31_patched/gtk/gtkentry.h
--- gtk+-2.24.31/gtk/gtkentry.h 2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31_patched/gtk/gtkentry.h 2016-10-06 19:59:44.000000000 +0200
@@ -149,6 +149,8 @@
void (* cut_clipboard) (GtkEntry *entry);
void (* copy_clipboard) (GtkEntry *entry);
void (* paste_clipboard) (GtkEntry *entry);
+ void (* paste_selection) (GtkEntry *entry,
+ const gchar *which);
void (* toggle_overwrite) (GtkEntry *entry);
/* hook to add other objects beside the entry (like in GtkSpinButton) */
@@ -160,7 +162,6 @@
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
};
GType gtk_entry_get_type (void) G_GNUC_CONST;
diff -ur gtk+-2.24.31/gtk/gtktextview.c gtk+-2.24.31_patched/gtk/gtktextview.c
--- gtk+-2.24.31/gtk/gtktextview.c 2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31_patched/gtk/gtktextview.c 2016-10-06 19:59:58.000000000 +0200
@@ -135,6 +135,7 @@
CUT_CLIPBOARD,
COPY_CLIPBOARD,
PASTE_CLIPBOARD,
+ PASTE_SELECTION,
TOGGLE_OVERWRITE,
MOVE_VIEWPORT,
SELECT_ALL,
@@ -281,6 +282,8 @@
static void gtk_text_view_cut_clipboard (GtkTextView *text_view);
static void gtk_text_view_copy_clipboard (GtkTextView *text_view);
static void gtk_text_view_paste_clipboard (GtkTextView *text_view);
+static void gtk_text_view_paste_selection (GtkTextView *text_view,
+ const gchar *which);
static void gtk_text_view_toggle_overwrite (GtkTextView *text_view);
static void gtk_text_view_toggle_cursor_visible (GtkTextView *text_view);
static void gtk_text_view_compat_move_focus(GtkTextView *text_view,
@@ -532,6 +535,7 @@
klass->cut_clipboard = gtk_text_view_cut_clipboard;
klass->copy_clipboard = gtk_text_view_copy_clipboard;
klass->paste_clipboard = gtk_text_view_paste_clipboard;
+ klass->paste_selection = gtk_text_view_paste_selection;
klass->toggle_overwrite = gtk_text_view_toggle_overwrite;
klass->move_focus = gtk_text_view_compat_move_focus;
klass->set_scroll_adjustments = gtk_text_view_set_scroll_adjustments;
@@ -925,6 +929,27 @@
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+
+ /**
+ * GtkTextView::paste-selection:
+ * @text_view: the object which received the signal
+ *
+ * The ::paste-selection signal is a
+ * <link linkend="keybinding-signals">keybinding signal</link>
+ * which gets emitted to paste the contents of the given selection
+ * into the text view.
+ */
+ signals[PASTE_SELECTION] =
+ g_signal_new (I_("paste-selection"),
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkTextViewClass, paste_selection),
+ NULL, NULL,
+ _gtk_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
+
/**
* GtkTextView::paste-clipboard:
* @text_view: the object which received the signal
@@ -5818,6 +5843,32 @@
}
static void
+gtk_text_view_paste_selection (GtkTextView *text_view,
+ const gchar *which)
+{
+ GtkClipboard *clipboard = NULL;
+
+ if (g_str_equal (which, "primary"))
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
+ GDK_SELECTION_PRIMARY);
+ else if (g_str_equal (which, "secondary"))
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
+ GDK_SELECTION_SECONDARY);
+ else if (g_str_equal (which, "clipboard"))
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
+ GDK_SELECTION_CLIPBOARD);
+
+ if (clipboard)
+ gtk_text_buffer_paste_clipboard (get_buffer (text_view),
+ clipboard,
+ NULL,
+ text_view->editable);
+ else
+ gtk_widget_error_bell (GTK_WIDGET (text_view));
+}
+
+
+static void
gtk_text_view_paste_done_handler (GtkTextBuffer *buffer,
GtkClipboard *clipboard,
gpointer data)
diff -ur gtk+-2.24.31/gtk/gtktextview.h gtk+-2.24.31_patched/gtk/gtktextview.h
--- gtk+-2.24.31/gtk/gtktextview.h 2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31_patched/gtk/gtktextview.h 2016-10-06 20:00:08.000000000 +0200
@@ -194,6 +194,8 @@
void (* cut_clipboard) (GtkTextView *text_view);
void (* copy_clipboard) (GtkTextView *text_view);
void (* paste_clipboard) (GtkTextView *text_view);
+ void (* paste_selection) (GtkTextView *text_view, const gchar *which);
+
/* overwrite */
void (* toggle_overwrite) (GtkTextView *text_view);
@@ -211,7 +213,6 @@
void (*_gtk_reserved4) (void);
void (*_gtk_reserved5) (void);
void (*_gtk_reserved6) (void);
- void (*_gtk_reserved7) (void);
};
GType gtk_text_view_get_type (void) G_GNUC_CONST;