[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#986017: unblock: osk-sdl/0.62.1-2



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: undef <debian@undef.tools>

Please unblock package osk-sdl

[ Reason ]
Help users understand the purpose of osk-sdl when the O.S.K appeas 
during boot without specific context information.

[ Impact ]
Some users have been unable to use their device, not knowing that the 
presented keyboard was for disk decryption.

[ Tests ]
This issue is fixed with a 50 line patch provided by upstream.
Manual tests by upstream, as well as with this package have
shown that the issue is fixed.

[ Risks ]
while the code change is non-trivial, it has been throughly tested
across two different Linux distributions. I consider the risk to be low.

[ Checklist ]
  [X] all changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in testing

unblock osk-sdl/0.62.1-2
diff -Nru osk-sdl-0.62.1/debian/changelog osk-sdl-0.62.1/debian/changelog
--- osk-sdl-0.62.1/debian/changelog	2021-01-22 21:32:26.000000000 +0000
+++ osk-sdl-0.62.1/debian/changelog	2021-03-16 08:14:26.000000000 +0000
@@ -1,3 +1,10 @@
+osk-sdl (0.62.1-2) unstable; urgency=medium
+
+  [ Jarrah Gosbell ]
+  * Backport tooltip from 0.64 (unreleased)
+
+ -- Jarrah Gosbell <debian@undef.tools>  Tue, 16 Mar 2021 08:14:26 +0000
+
 osk-sdl (0.62.1-1) unstable; urgency=medium
 
   [ undef ]
diff -Nru osk-sdl-0.62.1/debian/patches/0001-tooltip-add-support-for-specifying-the-type-of-toolt.patch osk-sdl-0.62.1/debian/patches/0001-tooltip-add-support-for-specifying-the-type-of-toolt.patch
--- osk-sdl-0.62.1/debian/patches/0001-tooltip-add-support-for-specifying-the-type-of-toolt.patch	1970-01-01 00:00:00.000000000 +0000
+++ osk-sdl-0.62.1/debian/patches/0001-tooltip-add-support-for-specifying-the-type-of-toolt.patch	2021-03-16 08:14:26.000000000 +0000
@@ -0,0 +1,110 @@
+From 794d4fc5d4a6e38c56b826ce7cca8dc5a373fdcc Mon Sep 17 00:00:00 2001
+From: Clayton Craft <clayton@craftyguy.net>
+Date: Thu, 4 Mar 2021 01:16:53 -0800
+Subject: [PATCH 1/3] tooltip: add support for specifying the type of tooltip
+ to render
+
+Tooltips can be themed/colored based on type with this change. Only two
+types ('info' and 'error') are introduced here.
+---
+ src/tooltip.cpp | 22 +++++++++++++++++-----
+ src/tooltip.h   |  9 ++++++++-
+ 2 files changed, 25 insertions(+), 6 deletions(-)
+
+diff --git a/src/tooltip.cpp b/src/tooltip.cpp
+index 5d288e8..e07dfb9 100644
+--- a/src/tooltip.cpp
++++ b/src/tooltip.cpp
+@@ -20,11 +20,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include "tooltip.h"
+ #include "draw_helpers.h"
+ 
+-Tooltip::Tooltip(int width, int height, int cornerRadius, Config *config)
++Tooltip::Tooltip(TooltipType type, int width, int height, int cornerRadius, Config *config)
+ 	: config(config)
+ 	, width(width)
+ 	, height(height)
+ 	, cornerRadius(cornerRadius)
++	, type(type)
+ {
+ }
+ 
+@@ -32,6 +33,7 @@ int Tooltip::init(SDL_Renderer *renderer, const std::string &text)
+ {
+ 	SDL_Surface *surface;
+ 	Uint32 rmask, gmask, bmask, amask;
++	argb foregroundColor, backgroundColor;
+ 	// SDL interprets each pixel as a 32-bit number, so our masks must depend
+ 	//   on the endianness (byte order) of the machine
+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+@@ -52,8 +54,19 @@ int Tooltip::init(SDL_Renderer *renderer, const std::string &text)
+ 		return -1;
+ 	}
+ 
+-	Uint32 background = SDL_MapRGB(surface->format, config->inputBoxBackgroundError.r,
+-		config->inputBoxBackgroundError.g, config->inputBoxBackgroundError.b);
++	switch (type) {
++	case TooltipType::error:
++		foregroundColor = config->inputBoxForegroundError;
++		backgroundColor = config->inputBoxBackgroundError;
++		break;
++	case TooltipType::info:
++	default:
++		foregroundColor = config->inputBoxForeground;
++		backgroundColor = config->inputBoxBackground;
++		break;
++	}
++
++	Uint32 background = SDL_MapRGB(surface->format, backgroundColor.r, backgroundColor.g, backgroundColor.b);
+ 	SDL_FillRect(surface, nullptr, background);
+ 
+ 	if (cornerRadius > 0) {
+@@ -63,8 +76,7 @@ int Tooltip::init(SDL_Renderer *renderer, const std::string &text)
+ 
+ 	TTF_Font *font = TTF_OpenFont(config->keyboardFont.c_str(), config->keyboardFontSize);
+ 	SDL_Surface *textSurface;
+-	SDL_Color textColor = { config->inputBoxForegroundError.r, config->inputBoxForegroundError.g,
+-		config->inputBoxForegroundError.b, config->inputBoxForegroundError.a };
++	SDL_Color textColor = { foregroundColor.r, foregroundColor.g, foregroundColor.b, foregroundColor.a };
+ 	textSurface = TTF_RenderText_Blended(font, text.c_str(), textColor);
+ 
+ 	SDL_Rect textRect;
+diff --git a/src/tooltip.h b/src/tooltip.h
+index 9c92d1b..8fa179a 100644
+--- a/src/tooltip.h
++++ b/src/tooltip.h
+@@ -25,16 +25,22 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include <SDL2/SDL_ttf.h>
+ #include <string>
+ 
++enum class TooltipType {
++	info,
++	error
++};
++
+ class Tooltip {
+ public:
+ 	/**
+ 	  Constructor
++	  @param type TooltipType, the type of tooltip to render
+ 	  @param width Width of the tooltip
+ 	  @param height Height of the tooltip
+ 	  @param cornerRadius Corner radius of the tooltip background box
+ 	  @param config Config object
+ 	  */
+-	Tooltip(int width, int height, int cornerRadius, Config *config);
++	Tooltip(TooltipType type, int width, int height, int cornerRadius, Config *config);
+ 	/**
+ 	  Initialize tooltip
+ 	  @param renderer Initialized SDL renderer object
+@@ -56,6 +62,7 @@ private:
+ 	int width;
+ 	int height;
+ 	int cornerRadius;
++	TooltipType type;
+ };
+ 
+ #endif
+-- 
+2.20.1
+
diff -Nru osk-sdl-0.62.1/debian/patches/0002-main-use-more-descriptive-name-for-pass-error-toolti.patch osk-sdl-0.62.1/debian/patches/0002-main-use-more-descriptive-name-for-pass-error-toolti.patch
--- osk-sdl-0.62.1/debian/patches/0002-main-use-more-descriptive-name-for-pass-error-toolti.patch	1970-01-01 00:00:00.000000000 +0000
+++ osk-sdl-0.62.1/debian/patches/0002-main-use-more-descriptive-name-for-pass-error-toolti.patch	2021-03-16 08:14:26.000000000 +0000
@@ -0,0 +1,39 @@
+From 587279eaa3e315eaa48a4f44c839ec76719d9894 Mon Sep 17 00:00:00 2001
+From: Clayton Craft <clayton@craftyguy.net>
+Date: Thu, 4 Mar 2021 01:19:00 -0800
+Subject: [PATCH 2/3] main: use more descriptive name for pass error tooltip,
+ specify type
+
+---
+ src/main.cpp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/main.cpp b/src/main.cpp
+index 46a866b..a9734a0 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -202,9 +202,9 @@ int main(int argc, char **args)
+ 	}
+ 
+ 	// Initialize tooltip for password error
+-	Tooltip tooltip(inputWidth, inputHeight, inputBoxRadius, &config);
+-	if (tooltip.init(renderer, ErrorText)) {
+-		SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to initialize tooltip!");
++	Tooltip passErrorTooltip(TooltipType::error, inputWidth, inputHeight, inputBoxRadius, &config);
++	if (passErrorTooltip.init(renderer, ErrorText)) {
++		SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to initialize passErrorTooltip!");
+ 		exit(EXIT_FAILURE);
+ 	}
+ 
+@@ -354,7 +354,7 @@ int main(int argc, char **args)
+ 					inputBoxRect.y = static_cast<int>(topHalf / 3.5);
+ 					// Only show either error box or password input box, not both
+ 					if (showPasswordError) {
+-						tooltip.draw(renderer, inputBoxRect.x, inputBoxRect.y);
++						passErrorTooltip.draw(renderer, inputBoxRect.x, inputBoxRect.y);
+ 					} else {
+ 						SDL_RenderCopy(renderer, inputBoxTexture, nullptr, &inputBoxRect);
+ 						draw_password_box_dots(renderer, &config, inputBoxRect, passphrase.size(), luksDev.unlockRunning());
+-- 
+2.20.1
+
diff -Nru osk-sdl-0.62.1/debian/patches/0003-main-show-tooltip-with-instructions-when-no-pass-has.patch osk-sdl-0.62.1/debian/patches/0003-main-show-tooltip-with-instructions-when-no-pass-has.patch
--- osk-sdl-0.62.1/debian/patches/0003-main-show-tooltip-with-instructions-when-no-pass-has.patch	1970-01-01 00:00:00.000000000 +0000
+++ osk-sdl-0.62.1/debian/patches/0003-main-show-tooltip-with-instructions-when-no-pass-has.patch	2021-03-16 08:14:26.000000000 +0000
@@ -0,0 +1,63 @@
+From 410e7c3354dc87720762468758454b487cb26086 Mon Sep 17 00:00:00 2001
+From: Clayton Craft <clayton@craftyguy.net>
+Date: Thu, 4 Mar 2021 01:19:36 -0800
+Subject: [PATCH 3/3] main: show tooltip with instructions when no pass has
+ been entered
+
+This adds a new tooltip that shows when the app starts, and when no text
+is in the input box (including when all text is deleted), informing the
+user to input a disk decryption passphrase.
+
+The tooltip disappears as soon as the user starts entering characters,
+and the normal password dots replace it in the input box.
+
+I decided to use a tooltip in this way since there was not enough space
+on the screen to fit it elsewhere when the screen height is small (e.g.
+on the N900), and I think this looks rather nice.
+
+fixes #60
+---
+ src/main.cpp | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/main.cpp b/src/main.cpp
+index a9734a0..f54388c 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -36,6 +36,7 @@ Uint32 EVENT_RENDER;
+ bool lastUnlockingState = false;
+ bool showPasswordError = false;
+ constexpr char ErrorText[] = "Incorrect passphrase";
++constexpr char EnterPassText[] = "Enter disk decryption passphrase";
+ 
+ int main(int argc, char **args)
+ {
+@@ -208,6 +209,12 @@ int main(int argc, char **args)
+ 		exit(EXIT_FAILURE);
+ 	}
+ 
++	Tooltip enterPassTooltip(TooltipType::info, inputWidth, inputHeight, inputBoxRadius, &config);
++	if (enterPassTooltip.init(renderer, EnterPassText)) {
++		SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to initialize enterPassTooltip!");
++		exit(EXIT_FAILURE);
++	}
++
+ 	argb inputBoxColor = config.inputBoxBackground;
+ 
+ 	SDL_Surface *inputBox = make_input_box(inputWidth, inputHeight, &inputBoxColor, inputBoxRadius);
+@@ -352,9 +359,11 @@ int main(int argc, char **args)
+ 
+ 					topHalf = static_cast<int>(HEIGHT - (keyboard.getHeight() * keyboard.getPosition()));
+ 					inputBoxRect.y = static_cast<int>(topHalf / 3.5);
+-					// Only show either error box or password input box, not both
++					// Only show either error tooltip, enter password tooltip, or password input box
+ 					if (showPasswordError) {
+ 						passErrorTooltip.draw(renderer, inputBoxRect.x, inputBoxRect.y);
++					} else if (passphrase.size() == 0) {
++						enterPassTooltip.draw(renderer, inputBoxRect.x, inputBoxRect.y);
+ 					} else {
+ 						SDL_RenderCopy(renderer, inputBoxTexture, nullptr, &inputBoxRect);
+ 						draw_password_box_dots(renderer, &config, inputBoxRect, passphrase.size(), luksDev.unlockRunning());
+-- 
+2.20.1
+
diff -Nru osk-sdl-0.62.1/debian/patches/series osk-sdl-0.62.1/debian/patches/series
--- osk-sdl-0.62.1/debian/patches/series	2021-01-22 21:32:26.000000000 +0000
+++ osk-sdl-0.62.1/debian/patches/series	2021-03-16 08:14:26.000000000 +0000
@@ -1,3 +1,7 @@
 set-font.patch
 whatis-entry.patch
 fix-key-height.patch
+
+0001-tooltip-add-support-for-specifying-the-type-of-toolt.patch
+0002-main-use-more-descriptive-name-for-pass-error-toolti.patch
+0003-main-show-tooltip-with-instructions-when-no-pass-has.patch

Reply to: