Skip to content

Commit

Permalink
Move song arrays into function where they're used, align preprocessor…
Browse files Browse the repository at this point in the history
… directives
  • Loading branch information
vomindoraan committed Nov 3, 2018
1 parent bcafc3b commit e6d9692
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 50 deletions.
80 changes: 32 additions & 48 deletions quantum/process_keycode/process_unicode_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,6 @@

unicode_config_t unicode_config;
static uint8_t saved_mods;
#ifdef AUDIO_ENABLE
#ifdef UNICODE_SONG_OSX
float osx_song[][2] = UNICODE_SONG_OSX;
#endif
#ifdef UNICODE_SONG_LNX
float song_lnx[][2] = UNICODE_SONG_LNX;
#endif
#ifdef UNICODE_SONG_BSD
float song_bsd[][2] = UNICODE_SONG_BSD;
#endif
#ifdef UNICODE_SONG_WINDOWS
float windows_song[][2] = UNICODE_SONG_WINDOWS;
#endif
#ifdef UNICODE_SONG_WIN_COMPOSE
float win_compose_song[][2] = UNICODE_SONG_WIN_COMPOSE;
#endif
#ifdef UNICODE_SONG_OSX_RALT
float osx_ralt_song[][2] = UNICODE_SONG_OSX_RALT;
#endif
#endif


void set_unicode_input_mode(uint8_t os_target) {
unicode_config.input_mode = os_target;
Expand Down Expand Up @@ -153,50 +132,55 @@ bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case UNICODE_MODE_OSX:
set_unicode_input_mode(UC_OSX);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX)
PLAY_SONG(osx_song);
#endif
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX)
static float song_osx[][2] = UNICODE_SONG_OSX;
PLAY_SONG(song_osx);
#endif
break;
case UNICODE_MODE_LNX:
set_unicode_input_mode(UC_LNX);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_LNX)
PLAY_SONG(song_lnx);
#endif
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_LNX)
static float song_lnx[][2] = UNICODE_SONG_LNX;
PLAY_SONG(song_lnx);
#endif
break;
case UNICODE_MODE_BSD:
set_unicode_input_mode(UC_BSD);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_BSD)
PLAY_SONG(song_bsd);
#endif
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_BSD)
static float song_bsd[][2] = UNICODE_SONG_BSD;
PLAY_SONG(song_bsd);
#endif
break;
case UNICODE_MODE_WIN:
set_unicode_input_mode(UC_WIN);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WINDOWS)
PLAY_SONG(windows_song);
#endif
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WIN)
static float song_win[][2] = UNICODE_SONG_WIN;
PLAY_SONG(song_win);
#endif
break;
case UNICODE_MODE_WINC:
set_unicode_input_mode(UC_WINC);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WIN_COMPOSE)
PLAY_SONG(win_compose_song);
#endif
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WINC)
static float song_winc[][2] = UNICODE_SONG_WINC;
PLAY_SONG(song_winc);
#endif
break;
case UNICODE_MODE_OSX_RALT:
set_unicode_input_mode(UC_OSX_RALT);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX_RALT)
PLAY_SONG(osx_ralt_song);
#endif
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX_RALT)
static float song_osx_ralt[][2] = UNICODE_SONG_OSX_RALT;
PLAY_SONG(song_osx_ralt);
#endif
break;
}
}
#ifdef UNICODE_ENABLE
return process_unicode(keycode, record);
#endif
#ifdef UCIS_ENABLE
return process_ucis(keycode, record);
#endif
#ifdef UNICODEMAP_ENABLE
return process_unicode_map(keycode, record);
#endif
#if defined(UNICODE_ENABLE)
return process_unicode(keycode, record);
#elif defined(UNICODEMAP_ENABLE)
return process_unicode_map(keycode, record);
#elif defined(UCIS_ENABLE)
return process_ucis(keycode, record);
#else
return true;
#endif
}
4 changes: 2 additions & 2 deletions quantum/process_keycode/process_unicode_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include "quantum.h"

#if defined(UNICODE_ENABLE) + defined(UNICODEMAP_ENABLE) + defined(UCIS_ENABLE) > 1
#error "Cannot enable more than one unicode method (UNICODE, UNICODEMAP, UCIS) at the same time"
#error "Cannot enable more than one Unicode method (UNICODE, UNICODEMAP, UCIS) at the same time"
#endif

#ifndef UNICODE_TYPE_DELAY
#define UNICODE_TYPE_DELAY 10
#define UNICODE_TYPE_DELAY 10
#endif

typedef union {
Expand Down

0 comments on commit e6d9692

Please sign in to comment.