Some formatting to match upstream

This commit is contained in:
Willy-JL 2024-05-18 08:28:45 +01:00
parent c4709a5b6b
commit 23ca7e7b48
13 changed files with 60 additions and 64 deletions

View file

@ -4,7 +4,6 @@
#include "views.h"
#include <notification/notification_messages.h>
#include <dolphin/dolphin.h>
#include "hid_icons.h"
#define TAG "HidApp"
@ -59,7 +58,7 @@ static uint32_t hid_ptt_menu_view(void* context) {
return HidViewPushToTalkMenu;
}
Hid* hid_alloc(void) {
Hid* hid_alloc() {
Hid* app = malloc(sizeof(Hid));
// Gui

View file

@ -62,6 +62,7 @@ struct Hid {
HidPushToTalk* hid_ptt;
HidPushToTalkMenu* hid_ptt_menu;
};
void bt_hid_remove_pairing(Hid* app);
void hid_hal_keyboard_press(Hid* instance, uint16_t event);
@ -76,4 +77,4 @@ void hid_hal_mouse_move(Hid* instance, int8_t dx, int8_t dy);
void hid_hal_mouse_scroll(Hid* instance, int8_t delta);
void hid_hal_mouse_press(Hid* instance, uint16_t event);
void hid_hal_mouse_release(Hid* instance, uint16_t event);
void hid_hal_mouse_release_all(Hid* instance);
void hid_hal_mouse_release_all(Hid* instance);

View file

@ -3,7 +3,6 @@
void hid_scene_main_on_enter(void* context) {
Hid* app = context;
view_dispatcher_switch_to_view(
app->view_dispatcher, scene_manager_get_scene_state(app->scene_manager, HidSceneMain));
}

View file

@ -228,9 +228,9 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidKeyboardModel* model = context;
// Header
// Header
#ifdef HID_TRANSPORT_BLE
if((!model->connected)) {
if(!model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keyboard");

View file

@ -38,7 +38,7 @@ static void hid_keynote_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidKeynoteModel* model = context;
// Header
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
@ -114,7 +114,7 @@ static void hid_keynote_draw_vertical_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidKeynoteModel* model = context;
// Header
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
@ -273,7 +273,6 @@ HidKeynote* hid_keynote_alloc(Hid* hid) {
view_allocate_model(hid_keynote->view, ViewModelTypeLocking, sizeof(HidKeynoteModel));
view_set_draw_callback(hid_keynote->view, hid_keynote_draw_callback);
view_set_input_callback(hid_keynote->view, hid_keynote_input_callback);
return hid_keynote;
}

View file

@ -41,7 +41,7 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMediaModel* model = context;
// Header
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
@ -197,6 +197,7 @@ static bool hid_media_input_callback(InputEvent* event, void* context) {
hid_media_process_release(hid_media, event);
}
}
return consumed;
}
@ -208,7 +209,6 @@ HidMedia* hid_media_alloc(Hid* hid) {
view_allocate_model(hid_media->view, ViewModelTypeLocking, sizeof(HidMediaModel));
view_set_draw_callback(hid_media->view, hid_media_draw_callback);
view_set_input_callback(hid_media->view, hid_media_input_callback);
return hid_media;
}

View file

@ -3,7 +3,6 @@
#include <gui/view.h>
typedef struct Hid Hid;
typedef struct HidMedia HidMedia;
HidMedia* hid_media_alloc(Hid* hid);

View file

@ -27,7 +27,7 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMouseModel* model = context;
// Header
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
@ -53,9 +53,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 80, 8, &I_Pin_arrow_up_7x9);
@ -63,9 +63,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 80, 40, &I_Pin_arrow_down_7x9);
@ -73,9 +73,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 63, 25, &I_Pin_arrow_left_9x7);
@ -83,9 +83,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 95, 25, &I_Pin_arrow_right_9x7);
@ -93,9 +93,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
// Ok
if(model->left_mouse_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 79, 24, &I_Left_mouse_icon_9x9);
@ -103,9 +103,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
// Back
if(model->right_mouse_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 112, 38, &I_Right_mouse_icon_9x9);
@ -217,7 +217,6 @@ HidMouse* hid_mouse_alloc(Hid* hid) {
view_allocate_model(hid_mouse->view, ViewModelTypeLocking, sizeof(HidMouseModel));
view_set_draw_callback(hid_mouse->view, hid_mouse_draw_callback);
view_set_input_callback(hid_mouse->view, hid_mouse_input_callback);
return hid_mouse;
}

View file

@ -42,7 +42,7 @@ static void hid_mouse_clicker_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMouseClickerModel* model = context;
// Header
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);

View file

@ -25,7 +25,7 @@ static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMouseJigglerModel* model = context;
// Header
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);

View file

@ -59,9 +59,9 @@ static void hid_movie_draw_callback(Canvas* canvas, void* context) {
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 79, 9, &I_Volup_8x6);
@ -69,9 +69,9 @@ static void hid_movie_draw_callback(Canvas* canvas, void* context) {
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 80, 41, &I_Voldwn_6x6);
@ -79,9 +79,9 @@ static void hid_movie_draw_callback(Canvas* canvas, void* context) {
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_movie_draw_arrow(canvas, 65, 28, CanvasDirectionRightToLeft);
@ -90,9 +90,9 @@ static void hid_movie_draw_callback(Canvas* canvas, void* context) {
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_movie_draw_arrow(canvas, 96, 28, CanvasDirectionLeftToRight);
@ -101,9 +101,9 @@ static void hid_movie_draw_callback(Canvas* canvas, void* context) {
// Ok
if(model->ok_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_movie_draw_arrow(canvas, 80, 28, CanvasDirectionLeftToRight);
@ -113,9 +113,9 @@ static void hid_movie_draw_callback(Canvas* canvas, void* context) {
// Exit
if(model->back_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 111, 38, &I_Pin_back_arrow_10x10);

View file

@ -59,9 +59,9 @@ static void hid_music_macos_draw_callback(Canvas* canvas, void* context) {
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 79, 9, &I_Volup_8x6);
@ -69,9 +69,9 @@ static void hid_music_macos_draw_callback(Canvas* canvas, void* context) {
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 80, 41, &I_Voldwn_6x6);
@ -79,9 +79,9 @@ static void hid_music_macos_draw_callback(Canvas* canvas, void* context) {
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_music_macos_draw_arrow(canvas, 67, 28, CanvasDirectionRightToLeft);
@ -91,9 +91,9 @@ static void hid_music_macos_draw_callback(Canvas* canvas, void* context) {
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_music_macos_draw_arrow(canvas, 96, 28, CanvasDirectionLeftToRight);
@ -103,9 +103,9 @@ static void hid_music_macos_draw_callback(Canvas* canvas, void* context) {
// Ok
if(model->ok_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_music_macos_draw_arrow(canvas, 80, 28, CanvasDirectionLeftToRight);
@ -115,9 +115,9 @@ static void hid_music_macos_draw_callback(Canvas* canvas, void* context) {
// Exit
if(model->back_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 111, 38, &I_Pin_back_arrow_10x10);

View file

@ -45,9 +45,9 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
// Pause
if(model->back_mouse_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 113, 37, &I_Pause_icon_9x9);
@ -55,9 +55,9 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 80, 8, &I_Arr_up_7x9);
@ -65,9 +65,9 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 80, 40, &I_Arr_dwn_7x9);
@ -75,9 +75,9 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 64, 25, &I_Voldwn_6x6);
@ -85,9 +85,9 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 95, 25, &I_Volup_8x6);
@ -95,9 +95,9 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
// Ok
if(model->ok_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 78, 25, &I_Like_def_11x9);