games/gtetrinet: Fix UI lockups.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-02-13 00:13:24 -05:00 committed by Willy Sudiarto Raharjo
parent 4d54b6821f
commit 03a9357b96
No known key found for this signature in database
GPG key ID: 3F617144D7238786
3 changed files with 63 additions and 1 deletions

View file

@ -0,0 +1,32 @@
diff -Naur gtetrinet-0.8.0_20220828_6d816ee.orig/src/gtetrinet.c gtetrinet-0.8.0_20220828_6d816ee/src/gtetrinet.c
--- gtetrinet-0.8.0_20220828_6d816ee.orig/src/gtetrinet.c 2023-02-10 14:01:33.000000000 -0500
+++ gtetrinet-0.8.0_20220828_6d816ee/src/gtetrinet.c 2023-02-13 01:31:08.820702289 -0500
@@ -76,13 +76,13 @@
GSettings* settings_keys;
GSettings* settings_themes;
-static const struct poptOption options[] = {
- {"connect", 'c', POPT_ARG_STRING, &option_connect, 0, ("Connect to server"), ("SERVER")},
- {"nickname", 'n', POPT_ARG_STRING, &option_nick, 0, ("Set nickname to use"), ("NICKNAME")},
- {"team", 't', POPT_ARG_STRING, &option_team, 0, ("Set team name"), ("TEAM")},
- {"spectate", 's', POPT_ARG_NONE, &option_spec, 0, ("Connect as a spectator"), NULL},
- {"password", 'p', POPT_ARG_STRING, &option_pass, 0, ("Spectator password"), ("PASSWORD")},
- {NULL, 0, 0, NULL, 0, NULL, NULL}
+static const GOptionEntry options[] = {
+ {"connect", 'c', 0, G_OPTION_ARG_STRING, &option_connect, ("Connect to server"), ("SERVER")},
+ {"nickname", 'n', 0, G_OPTION_ARG_STRING, &option_nick, ("Set nickname to use"), ("NICKNAME")},
+ {"team", 't', 0, G_OPTION_ARG_STRING, &option_team, ("Set team name"), ("TEAM")},
+ {"spectate", 's', 0, G_OPTION_ARG_NONE, &option_spec, ("Connect as a spectator"), NULL},
+ {"password", 'p', 0, G_OPTION_ARG_STRING, &option_pass, ("Spectator password"), ("PASSWORD")},
+ {NULL, 0, 0, 0, NULL, NULL, NULL}
};
static int gtetrinet_poll_func(GPollFD *passed_fds,
@@ -134,7 +134,6 @@
argc, argv, GNOME_PARAM_POPT_TABLE, options,
GNOME_PARAM_NONE);
*/
- GOptionEntry options[] = { {NULL}};
if (!gtk_init_with_args(&argc,&argv,"gtetrinet",options,NULL,&err))
{
fprintf (stderr, "Failed to init GTK: %s\n", err->message);

View file

@ -12,11 +12,15 @@
# so I never bothered making a SlackBuild for it. Thanks to r0ni for
# finding this gtk3 port of it.
# 20230213 bkw: BUILD=2
# - add nolockup.diff
# - fix command-line options
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=gtetrinet
VERSION=${VERSION:-0.8.0_20220828_6d816ee}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -63,6 +67,20 @@ chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# Reinstate the command-line options, which were removed when porting
# from GNOME to Gtk3.
patch -p1 < $CWD/cli_opts.diff
# If gtetrinet tries to connect in TetriFAST mode to a server
# that doesn't support TetriFAST, the server will drop the
# connection immediately. This patch prevents gtetrinet's UI
# from going completely unresponsive if that happens: now we'll
# get a "connecting..." dialog with a Cancel button that actually
# works. There is surely a better way to fix it (have it actually pop
# up a "Server doesn't support TetriFAST" dialog), but this is a tiny
# change to the code and works well enough.
patch -p1 < $CWD/nolockup.diff
# desktop-file-validate complains a bit... also use absolute path
# to binary.
sed -i -e 's,GNOME;Application;,,' \

View file

@ -0,0 +1,12 @@
diff -Naur gtetrinet-0.8.0_20220828_6d816ee.orig/src/client.c gtetrinet-0.8.0_20220828_6d816ee/src/client.c
--- gtetrinet-0.8.0_20220828_6d816ee.orig/src/client.c 2023-02-10 14:01:33.000000000 -0500
+++ gtetrinet-0.8.0_20220828_6d816ee/src/client.c 2023-02-12 23:55:28.980242462 -0500
@@ -431,6 +431,8 @@
{
case G_IO_STATUS_EOF :
g_warning ("End of file (server closed connection).");
+ connected = 1;
+ client_disconnect();
return -1;
break;