From 03a9357b96ad493c6f06ccb70833973b8f8cd57d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 13 Feb 2023 00:13:24 -0500 Subject: games/gtetrinet: Fix UI lockups. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- games/gtetrinet/cli_opts.diff | 32 ++++++++++++++++++++++++++++++++ games/gtetrinet/gtetrinet.SlackBuild | 20 +++++++++++++++++++- games/gtetrinet/nolockup.diff | 12 ++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 games/gtetrinet/cli_opts.diff create mode 100644 games/gtetrinet/nolockup.diff (limited to 'games') diff --git a/games/gtetrinet/cli_opts.diff b/games/gtetrinet/cli_opts.diff new file mode 100644 index 0000000000..f31bac72c9 --- /dev/null +++ b/games/gtetrinet/cli_opts.diff @@ -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); diff --git a/games/gtetrinet/gtetrinet.SlackBuild b/games/gtetrinet/gtetrinet.SlackBuild index cd0b68e310..147c219419 100644 --- a/games/gtetrinet/gtetrinet.SlackBuild +++ b/games/gtetrinet/gtetrinet.SlackBuild @@ -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;,,' \ diff --git a/games/gtetrinet/nolockup.diff b/games/gtetrinet/nolockup.diff new file mode 100644 index 0000000000..0cfbe0d599 --- /dev/null +++ b/games/gtetrinet/nolockup.diff @@ -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; + -- cgit v1.2.3-65-gdbad