Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkorpionm <85568270+Skorpionm@users.noreply.github.com>2021-09-02 00:05:00 +0300
committerGitHub <noreply@github.com>2021-09-02 00:05:00 +0300
commite17336498db48de0898313aca9099985b91bd89e (patch)
tree2ad1fedde8432714b1fa230c23f913d29b8ba494 /applications/gui/view_port.c
parent3ed26e61eb75f715f4b46e6104c9b49057159594 (diff)
[FL-1756, FL-1769, FL-1776, FL-1759] Gui: input events complementary V3, refactoring. SubGhz: read/emulate fixes. Cleanup. (#684)
* Gui: move rotation logic to ViewPort, replace delayed View switch in ViewDispatcher with event filtering and redirection to previous view. * SubGhz: add function description * Gui, Input: add event id to input events. * SubGhz: fix "crashing on ?" * SubGhz: add icon scanning * SubGhz: updated interface read scene, updated interface config scene * Assets: update subghz assets * SubGhz: replaced the picture in the read scene, changed the paths to additional files * SubGhz: fix deadlock in timer callback * SubGhz: fix icon read scene * SubGhz: fix icon read scene * SubGhz: fix duble text transmitter scene * SubGhz: correct spelling. Gui: bigger queue for ViewDispatcher. * SubGhz: fix creation and transmission of dynamic code without the presence of a manufactory key * SubGhz: fix keelog, setting a name in the absence of a manufactory key * SubGhz: fix load bad keelog key * Format sources * Furi: remove garbage from core. GpioTester: fix memory leak and cleanup * Accessor: remove obsolete notification code * MusicPlayer: remove input event injection * Input: rename id to sequence Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
Diffstat (limited to 'applications/gui/view_port.c')
-rw-r--r--applications/gui/view_port.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/applications/gui/view_port.c b/applications/gui/view_port.c
index d65b9f7a..66560bbc 100644
--- a/applications/gui/view_port.c
+++ b/applications/gui/view_port.c
@@ -7,6 +7,33 @@
// TODO add mutex to view_port ops
+static void view_port_rotate_buttons(InputEvent* event) {
+ switch(event->key) {
+ case InputKeyUp:
+ event->key = InputKeyRight;
+ break;
+ case InputKeyDown:
+ event->key = InputKeyLeft;
+ break;
+ case InputKeyRight:
+ event->key = InputKeyDown;
+ break;
+ case InputKeyLeft:
+ event->key = InputKeyUp;
+ break;
+ default:
+ break;
+ }
+}
+
+static void view_port_setup_canvas_orientation(const ViewPort* view_port, Canvas* canvas) {
+ if(view_port->orientation == ViewPortOrientationHorizontal) {
+ canvas_set_orientation(canvas, CanvasOrientationHorizontal);
+ } else if(view_port->orientation == ViewPortOrientationVertical) {
+ canvas_set_orientation(canvas, CanvasOrientationVertical);
+ }
+}
+
ViewPort* view_port_alloc() {
ViewPort* view_port = furi_alloc(sizeof(ViewPort));
view_port->orientation = ViewPortOrientationHorizontal;
@@ -84,6 +111,7 @@ void view_port_draw(ViewPort* view_port, Canvas* canvas) {
furi_check(view_port->gui);
if(view_port->draw_callback) {
+ view_port_setup_canvas_orientation(view_port, canvas);
view_port->draw_callback(canvas, view_port->draw_callback_context);
}
}
@@ -94,6 +122,9 @@ void view_port_input(ViewPort* view_port, InputEvent* event) {
furi_check(view_port->gui);
if(view_port->input_callback) {
+ if(view_port_get_orientation(view_port) == ViewPortOrientationVertical) {
+ view_port_rotate_buttons(event);
+ }
view_port->input_callback(event, view_port->input_callback_context);
}
}