desktop/wmcliphist: Updated for version 2.1.

Signed-off-by: B. Watson <yalhcru@gmail.com>
This commit is contained in:
B. Watson 2017-02-27 01:37:35 -05:00 committed by Willy Sudiarto Raharjo
parent 620f343cae
commit 33b2839bd3
3 changed files with 72 additions and 1 deletions

View file

@ -0,0 +1,35 @@
FIXME: There is a really annoying bug, seems to be an interaction
between gtk and windowmaker's docking mechanism. To reproduce:
- Start wmcliphist normally
- Place wmcliphist in the dock (if not already there)
- Right-click wmcliphist dock icon, select "Exit"
- From a terminal, run "wmcliphist -c notacolor" (any unknown color
string), or "wmcliphist -b nosuchbuffer". Basically anything that
causes wmcliphist to pop up a warning dialog on startup.
- Click "OK" in the warning dialog.
- Now, wmcliphist is running, but it has failed dock. It's
running in an icon (like an un-docked dockapp)... and in the dock,
there is a blank icon where wmcliphist should be. Attempting to
drag the wmcliphist icon to the blank icon won't work (though you
can dock it in another empty dock position).
I tried various things to fix this (rewrote show_message() to use
gtk_dialog_new_with_buttons(), added a sleep(1) before showing the
dialog, call gtk_main_iteration() before popping up the dialog), but
none of it helped. Fixing this might require a patch to WindowMaker
itself...? Anyone interested in fixing this should have a look at
foo_create_main_icon_window() in wmcliphist.c. If you don't understand
what's going on there (and I admit I don't), you probably have little
chance of fixing this bug...
One approach I can think of: The trouble seems to be caused by calling
show_message() before gtk_main() has been called. If show_message()
gets called later (after the app has been docked), all is well. So for
startup warnings, we could use g_timeout_add() to display the warnings
later. Unfortunately one of these ("Some items from history will be
lost") isn't a warning with just an OK button, it's a Yes/No question,
and by the time gtk_main() is running, it's too late for the No answer.
Turning that into a "Some items from history were lost. [OK]" kinda
violates the author's intent (he wanted to make sure no data was lost
by accident).

View file

@ -0,0 +1,22 @@
diff -Naur dockapps/gui.c dockapps.patched/gui.c
--- dockapps/gui.c 2017-02-25 03:58:36.637396483 -0500
+++ dockapps.patched/gui.c 2017-02-25 04:04:34.568392242 -0500
@@ -173,7 +173,6 @@
history_items = g_list_remove_link(history_items, list_node);
gtk_container_remove(GTK_CONTAINER(hist_item->menu),
hist_item->menu_item);
- gtk_widget_destroy(hist_item->menu_item);
g_free(hist_item->content);
g_free(hist_item);
g_list_free_1(list_node);
diff -Naur dockapps/history.c dockapps.patched/history.c
--- dockapps/history.c 2014-11-23 09:59:59.000000000 -0500
+++ dockapps.patched/history.c 2017-02-25 04:12:31.276386594 -0500
@@ -362,7 +362,6 @@
hist_item = (HISTORY_ITEM *)list_node->data;
gtk_container_remove(GTK_CONTAINER(hist_item->menu),
hist_item->menu_item);
- gtk_widget_destroy(hist_item->menu_item);
g_free(hist_item->content);
g_free(hist_item);
list_node = g_list_previous(list_node);

View file

@ -17,9 +17,14 @@
# - Install sample config file in doc dir (as per the man page).
# - Fix path to docdir in man page.
# 20170225 bkw:
# - BUILD=2
# - Get rid of annoying assertion "'GTK_IS_WIDGET (widget)' failed" warnings
# - Document annoying bug I don't know how to fix, in BUG.txt
PRGNAM=wmcliphist
VERSION=${VERSION:-2.1}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -73,6 +78,15 @@ for i in $CWD/*.patch; do
patch -p1 < $i
done
# This patch is my own. It removes these annoying warnings:
# gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed
# Reason for the warnings: gtk_container_remove() already destroys
# a widget, if there's no other reference to it. So we don't need
# to then call gtk_widget_destroy() on the same widget. See
# https://developer.gnome.org/gtk3/unstable/GtkContainer.html#gtk-container-remove
# This explanation is longer than the patch, sorry about that.
patch -p1 < $CWD/gtk_assert.diff
sed -i "/^CFLAGS/s,-pedantic,$SLKCFLAGS," Makefile
sed -i "s,/usr/share/doc/$PRGNAM,/usr/doc/$PRGNAM-$VERSION," $PRGNAM.1