summaryrefslogtreecommitdiff
path: root/src/msg.c
diff options
context:
space:
mode:
authorAndreas Mohr <andi@lisas.de>2015-04-21 09:55:40 +0200
committerArx Cruz <acruz@redhat.com>2015-04-21 09:56:42 +0200
commit4fe3fa98d941f2a00750bc5ce0c2a23846006265 (patch)
treee5408b3b88234e374e13a3326e083776bcd7da70 /src/msg.c
parentBump to 3.16.1 (diff)
downloadzenity-4fe3fa98d941f2a00750bc5ce0c2a23846006265.tar.gz
zenity-4fe3fa98d941f2a00750bc5ce0c2a23846006265.tar.bz2
zenity-4fe3fa98d941f2a00750bc5ce0c2a23846006265.zip
Bug #734196
--info destroys X11 primary selection content, and does not document that either
Diffstat (limited to 'src/msg.c')
-rw-r--r--src/msg.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/msg.c b/src/msg.c
index 4132ae98..fb549421 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -51,6 +51,31 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data
}
}
+static void
+zenity_label_widget_clipboard_selection(GtkWidget *widget)
+{
+ /* Workaround hotfix for suspected toolkit issue:
+ since focus change of the dialog's focussed widget (text)
+ somehow currently chooses to destroy
+ a pre-existing (read: foreign, user-initiated) X11 primary selection
+ (via gtk_label_select_region() -> ...
+ -> gtk_clipboard_set_contents()/gtk_clipboard_clear()),
+ we need to ensure
+ that the widget does have its gtk-label-select-on-focus property off,
+ in order to avoid having the label become selected automatically
+ and thereby having pre-existing clipboard content nullified.
+ Side note: this selection issue only applies to widgets
+ which have both
+ <property name="can_focus">True</property>
+ <property name="selectable">True</property>
+ .
+ */
+ g_object_set(gtk_widget_get_settings (widget),
+ "gtk-label-select-on-focus",
+ FALSE,
+ NULL);
+}
+
void
zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
{
@@ -164,6 +189,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
gtk_label_set_text (GTK_LABEL (text), msg_data->dialog_text);
else
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (msg_data->dialog_text));
+ zenity_label_widget_clipboard_selection(GTK_WIDGET (text));
}
if (msg_data->ellipsize)
bgstack15