Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6974bcd
Implement CommandLineParser in main.cpp
fleischie Jan 8, 2016
938e95a
Setup first UI for managing macro key defs (G1..18)
Jan 3, 2016
ee6b040
Enable G-Key macro: Sending definitions is working
frickler24 Jan 5, 2016
de5808b
Combine multiple infos in the Key definition
frickler24 Jan 6, 2016
13ac15b
get some additions to macro UI
frickler24 Jan 6, 2016
5c5710b
get the first running version of Macro Definition
frickler24 Jan 7, 2016
3b01630
get the first running version of Macro Definition
frickler24 Jan 7, 2016
0072195
get the second running version of Macro Definition
frickler24 Jan 9, 2016
2cffe41
Remove some qDebugs
frickler24 Feb 20, 2016
c747a69
adopt comment style to doxygen
frickler24 Jan 9, 2016
089b88d
add comments
frickler24 Jan 9, 2016
07d5fc6
setup ckb for client side macro managment (aplha)
frickler24 Jan 11, 2016
0ad494d
update UI in extra settings
frickler24 Jan 23, 2016
f48cf8b
Fix initialization bug with K95RGB + M65RGB
frickler24 Feb 6, 2016
6cc62bc
Fix adressing wrong pipe and g-key + modifiers
frickler24 Feb 20, 2016
26302dd
Merge branch 'ckb-parameter-handling' of https://github.com/fleischie…
ccMSC Feb 29, 2016
938edb2
(ckb) Re-added session workaround after CLI parser
ccMSC Feb 29, 2016
16c94f5
(ckb-ripple) Add the option to select a single color at random from t…
0----0 Mar 3, 2016
19ecac1
Merge branch 'master' of https://github.com/0----0/ckb into testing
ccMSC Mar 10, 2016
4b92515
Merge branch 'master' into testing
ccMSC Apr 8, 2016
80c0805
(ckb) Fixed syntax in macroreader.h
ccMSC Apr 18, 2016
8299703
Added info on solution to OS X scroll wheel m.i.a.
johanforssell Apr 27, 2016
153d93c
(ckb-daemon) Moved SYN events from inputupdate to the actual event fu…
ccMSC Apr 28, 2016
7460697
Added missing macro entry in mouse vtable
ccMSC Apr 28, 2016
fc31ac2
Add brew installed qt5 path to qmake-auto script
eastcoastcoder May 1, 2016
bcb8471
Start in background if session is being restored
diijkstra May 14, 2016
038dc17
Fix misleading indentation in ckb/quazip/zip.c
czipperz Jun 16, 2016
492524f
Merge branch 'master' into testing
ccMSC Jun 30, 2016
639f815
Merge branch 'master' of https://github.com/johanforssell/ckb into te…
ccMSC Jun 30, 2016
768a7d1
Merge branch 'patch-1' of https://github.com/ethanx94/ckb into testing
ccMSC Jun 30, 2016
240dd5f
Merge branch 'session_fix' of https://github.com/diijkstra/ckb into t…
ccMSC Jun 30, 2016
60f3c84
Merge branch 'patch-1' of https://github.com/czipperz/ckb into testing
ccMSC Jun 30, 2016
34cd4c8
Lots of fix merges
ccMSC Jun 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,18 @@ If you're using **Unity** and the tray icon doesn't appear correctly, run `sudo

#### OS X

- **“ckb.pkg” can’t be opened because it is from an unidentified developer.**
- Open `System Preferences > Security & Privacy > General` and click `Open Anyway`.
- **Modifier keys (Shift, Ctrl, etc.) are not rebound correctly.**
- ckb does not recognize modifier keys rebound from System Preferences. You can rebind them again within the application.
- **`~` key prints `§±`**
- Check your keyboard layout on ckb's Settings screen. Choose the layout that matches your physical keyboard.
- **Compile problems** can usually be resolved by rebooting your computer and/or reinstalling Qt. Make sure that Xcode works on its own. If a compile fails, delete the `ckb-master` directory as well as any automatically generated `build-ckb` folders and try again from a new download.
- **“ckb.pkg” can’t be opened because it is from an unidentified developer**
Open `System Preferences > Security & Privacy > General` and click `Open Anyway`.
- **Modifier keys (Shift, Ctrl, etc.) are not rebound correctly**
ckb does not recognize modifier keys rebound from System Preferences. You can rebind them again within the application.
- **`~` key prints `§±`**
Check your keyboard layout on ckb's Settings screen. Choose the layout that matches your physical keyboard.
- **Compile problems**
Can usually be resolved by rebooting your computer and/or reinstalling Qt. Make sure that Xcode works on its own. If a compile fails, delete the `ckb-master` directory as well as any automatically generated `build-ckb` folders and try again from a new download.
- **Scroll wheel does not scroll**
As of #c3474d2 it's now possible to **disable scroll acceleration** from the GUI. You can access it under "OSX tweaks" in the "More settings" screen. Once disabled, the scroll wheel should behave consistently.



#### General

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
beta-v0.2.6
beta-v0.2.6+t04
2 changes: 1 addition & 1 deletion qmake-auto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [[ "$QMAKE" != "" ]]; then
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
# OSX: Look for qmake in standard install locations
QMAKE=`find ~/Qt/*/clang_64/bin ~/Qt5*/*/clang_64/bin ~/Applications/Qt/*/clang_64/bin ~/Applications/Qt5*/*/clang_64/bin /Applications/Qt/*/clang_64/bin /Applications/Qt5*/*/clang_64/bin -name qmake -print -quit 2>/dev/null`
QMAKE=`find /usr/local/opt/qt5/bin ~/Qt/*/clang_64/bin ~/Qt5*/*/clang_64/bin ~/Applications/Qt/*/clang_64/bin ~/Applications/Qt5*/*/clang_64/bin /Applications/Qt/*/clang_64/bin /Applications/Qt5*/*/clang_64/bin -name qmake -print -quit 2>/dev/null`
[[ $QMAKE == "" ]] && die
else
# Linux: Look for system-installed Qt5
Expand Down
6 changes: 5 additions & 1 deletion src/ckb-daemon/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

static const char* const cmd_strings[CMD_COUNT - 1] = {
// NONE is implicit
"delay",
"mode",
"switch",
"layout",
Expand Down Expand Up @@ -111,7 +112,7 @@ int readcmd(usbdevice* kb, const char* line){

// Reject unrecognized commands. Reject bind or notify related commands if the keyboard doesn't have the feature enabled.
if(command == NONE
|| ((!HAS_FEATURES(kb, FEAT_BIND) && (command == BIND || command == UNBIND || command == REBIND || command == MACRO))
|| ((!HAS_FEATURES(kb, FEAT_BIND) && (command == BIND || command == UNBIND || command == REBIND || command == MACRO || command == DELAY))
|| (!HAS_FEATURES(kb, FEAT_NOTIFY) && command == NOTIFY))){
next_loop:
continue;
Expand Down Expand Up @@ -197,6 +198,9 @@ int readcmd(usbdevice* kb, const char* line){
}
continue;
}
case DELAY:
kb->delay = (!strcmp (word, "on")); // independendant from parameter to handle false commands like "delay off"
continue;
default:;
}

Expand Down
5 changes: 3 additions & 2 deletions src/ckb-daemon/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// Command operations
typedef enum {
// Special - handled by readcmd, no device functions
NONE = -10,
MODE = -9, CMD_FIRST = MODE,
NONE = -11,
DELAY = -10, CMD_FIRST = DELAY,
MODE = -9,
SWITCH = -8,
LAYOUT = -7,
ACCEL = -6,
Expand Down
2 changes: 2 additions & 0 deletions src/ckb-daemon/device_vtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const devcmd vtable_keyboard_nonrgb = {
.bind = cmd_bind,
.unbind = cmd_unbind,
.rebind = cmd_rebind,
.macro = cmd_macro,

.dpi = cmd_macro_none,
.dpisel = cmd_none,
Expand Down Expand Up @@ -140,6 +141,7 @@ const devcmd vtable_mouse = {
.bind = cmd_bind,
.unbind = cmd_unbind,
.rebind = cmd_rebind,
.macro = cmd_macro,

.dpi = cmd_dpi,
.dpisel = cmd_dpisel,
Expand Down
11 changes: 8 additions & 3 deletions src/ckb-daemon/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
int macromask(const uchar* key1, const uchar* key2){
// Scan a macro against key input. Return 0 if any of them don't match
for(int i = 0; i < N_KEYBYTES_INPUT; i++){
if((key1[i] & key2[i]) != key2[i])
// if((key1[i] & key2[i]) != key2[i])
if(key1[i] != key2[i]) // Changed to detect G-keys + modifiers
return 0;
}
return 1;
Expand All @@ -32,8 +33,13 @@ static void inputupdate_keys(usbdevice* kb){
macroaction* action = macro->actions + a;
if(action->rel_x != 0 || action->rel_y != 0)
os_mousemove(kb, action->rel_x, action->rel_y);
else
else {
os_keypress(kb, action->scan, action->down);
if (kb->delay) {
if (a > 200) usleep (100);
else if (a > 20) usleep(30);
}
}
}
}
} else {
Expand Down Expand Up @@ -130,7 +136,6 @@ void inputupdate(usbdevice* kb){
input->rel_x = input->rel_y = 0;
}
// Finish up
os_isync(kb);
memcpy(input->prevkeys, input->keys, N_KEYBYTES_INPUT);
}

Expand Down
2 changes: 0 additions & 2 deletions src/ckb-daemon/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ void cmd_macro(usbdevice* kb, usbmode* mode, const int notifynumber, const char*
void os_keypress(usbdevice* kb, int scancode, int down);
// Generate mouse movement
void os_mousemove(usbdevice* kb, int x, int y);
// Synchronize input (called after sending key presses)
void os_isync(usbdevice* kb);

// Perform OS-specific setup for indicator lights. Called when the device is created. Return 0 on success.
int os_setupindicators(usbdevice* kb);
Expand Down
29 changes: 18 additions & 11 deletions src/ckb-daemon/input_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ void os_inputclose(usbdevice* kb){
kb->uinput_mouse = 0;
}

// Generate SYN reports to synchronize device
static void isync(usbdevice* kb){
struct input_event event;
memset(&event, 0, sizeof(event));
event.type = EV_SYN;
event.code = SYN_REPORT;
if(write(kb->uinput_kb - 1, &event, sizeof(event)) <= 0)
ckb_warn("uinput write failed: %s\n", strerror(errno));
if(write(kb->uinput_mouse - 1, &event, sizeof(event)) <= 0)
ckb_warn("uinput write failed: %s\n", strerror(errno));
}

void os_keypress(usbdevice* kb, int scancode, int down){
struct input_event event;
memset(&event, 0, sizeof(event));
Expand All @@ -118,6 +130,8 @@ void os_keypress(usbdevice* kb, int scancode, int down){
}
if(write((is_mouse ? kb->uinput_mouse : kb->uinput_kb) - 1, &event, sizeof(event)) <= 0)
ckb_warn("uinput write failed: %s\n", strerror(errno));
else
isync(kb);
}

void os_mousemove(usbdevice* kb, int x, int y){
Expand All @@ -129,26 +143,19 @@ void os_mousemove(usbdevice* kb, int x, int y){
event.value = x;
if(write(kb->uinput_mouse - 1, &event, sizeof(event)) <= 0)
ckb_warn("uinput write failed: %s\n", strerror(errno));
else
isync(kb);
}
if(y != 0){
event.code = REL_Y;
event.value = y;
if(write(kb->uinput_mouse - 1, &event, sizeof(event)) <= 0)
ckb_warn("uinput write failed: %s\n", strerror(errno));
else
isync(kb);
}
}

void os_isync(usbdevice* kb){
struct input_event event;
memset(&event, 0, sizeof(event));
event.type = EV_SYN;
event.code = SYN_REPORT;
if(write(kb->uinput_kb - 1, &event, sizeof(event)) <= 0)
ckb_warn("uinput write failed: %s\n", strerror(errno));
if(write(kb->uinput_mouse - 1, &event, sizeof(event)) <= 0)
ckb_warn("uinput write failed: %s\n", strerror(errno));
}

void* _ledthread(void* ctx){
usbdevice* kb = ctx;
uchar ileds = 0;
Expand Down
4 changes: 0 additions & 4 deletions src/ckb-daemon/input_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,6 @@ void os_mousemove(usbdevice* kb, int x, int y){
postevent_mm(kb->event, x, y, HAS_FEATURES(kb, FEAT_MOUSEACCEL), kb->mousestate);
}

void os_isync(usbdevice* kb){
// OSX doesn't have any equivalent to the SYN_ events
}

int os_setupindicators(usbdevice* kb){
// Set NumLock on permanently
kb->hw_ileds = kb->hw_ileds_old = kb->ileds = 1;
Expand Down
2 changes: 2 additions & 0 deletions src/ckb-daemon/structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ typedef struct {
uchar hw_ileds, hw_ileds_old, ileds;
// Color dithering in use
char dither;
// Flag to check, if large macros should be sent delayed
char delay;
} usbdevice;

#endif // STRUCTURES_H
12 changes: 10 additions & 2 deletions src/ckb-ripple/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "../ckb/ckb-anim.h"
#include <math.h>
#include <time.h>

void ckb_info(){
// Plugin info
Expand All @@ -14,6 +15,7 @@ void ckb_info(){
CKB_PARAM_AGRADIENT("color", "Ripple color:", "", "ffffffff");
CKB_PARAM_DOUBLE("length", "Ring length:", "%", 100, 1, 100);
CKB_PARAM_BOOL("symmetric", "Symmetric", 0);
CKB_PARAM_BOOL("randomize", "Randomly select from gradient", 0);

// Timing/input parameters
CKB_KPMODE(CKB_KP_POSITION);
Expand Down Expand Up @@ -44,11 +46,12 @@ void ckb_info(){

float kbsize = 0.f;
ckb_gradient animcolor = { 0 };
int symmetric = 0, kprelease = 0;
int symmetric = 0, kprelease = 0, randomize = 0;
double animlength = 0.;

void ckb_init(ckb_runctx* context){
kbsize = sqrt(context->width * context->width / 4.f + context->height * context->height / 4.f);
srand((unsigned)time(NULL));
}

void ckb_parameter(ckb_runctx* context, const char* name, const char* value){
Expand All @@ -61,6 +64,7 @@ void ckb_parameter(ckb_runctx* context, const char* name, const char* value){
}
CKB_PARSE_BOOL("symmetric", &symmetric){}
CKB_PARSE_BOOL("kprelease", &kprelease){}
CKB_PARSE_BOOL("randomize", &randomize){}
}

#define ANIM_MAX (144 * 2)
Expand All @@ -69,6 +73,7 @@ struct {
float x, y;
float maxsize;
float cursize;
float choice;
} anim[ANIM_MAX] = { };

void anim_add(float x, float y, float width, float height){
Expand All @@ -82,6 +87,7 @@ void anim_add(float x, float y, float width, float height){
float sizey = fmax(y, height - y);
anim[i].maxsize = sqrt(sizex * sizex + sizey * sizey) + animlength;
anim[i].cursize = (symmetric) ? -animlength : 0;
anim[i].choice = (float)rand()/(float)(RAND_MAX);
return;
}
}
Expand Down Expand Up @@ -140,10 +146,12 @@ int ckb_frame(ckb_runctx* context){
if(distance > 1.f && distance <= 1.005f)
// Round values close to 1
distance = 1.f;

// Blend color gradient according to position
if(distance >= 0. && distance <= 1.f){
float a, r, g, b;
ckb_grad_color(&a, &r, &g, &b, &animcolor, distance * 100.);
float gradChoice = randomize ? anim[i].choice : distance;
ckb_grad_color(&a, &r, &g, &b, &animcolor, gradChoice * 100.);
ckb_alpha_blend(key, a, r, g, b);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/ckb/ckb.pro
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ SOURCES += main.cpp\
layoutdialog.cpp \
extrasettingswidget.cpp \
kbmanager.cpp \
colormap.cpp
colormap.cpp \
macroreader.cpp

HEADERS += mainwindow.h \
kbwidget.h \
Expand Down Expand Up @@ -157,7 +158,8 @@ HEADERS += mainwindow.h \
layoutdialog.h \
extrasettingswidget.h \
kbmanager.h \
colormap.h
colormap.h \
macroreader.h

FORMS += mainwindow.ui \
kbwidget.ui \
Expand Down
10 changes: 10 additions & 0 deletions src/ckb/extrasettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ ExtraSettingsWidget::ExtraSettingsWidget(QWidget *parent) :
// Update animation info
ui->animPathLabel->setText(AnimScript::path());
on_animScanButton_clicked();

/// Read Macro Delay setting, update UI and Kb-internal flag
bool macroDelay = settings.value("MacroDelay").toBool();
Kb::macroDelay(macroDelay);
ui->delayBox->setChecked(macroDelay);
}

ExtraSettingsWidget::~ExtraSettingsWidget(){
Expand Down Expand Up @@ -134,3 +139,8 @@ void ExtraSettingsWidget::on_sSpeedBox_valueChanged(int arg1){
CkbSettings::set("Program/ScrollSpeed", arg1);
Kb::scrollSpeed(ui->sAccelBox->isChecked() ? arg1 : 0);
}

void ExtraSettingsWidget::on_delayBox_clicked(bool checked) {
CkbSettings::set("Program/MacroDelay", checked);
Kb::macroDelay(checked);
}
1 change: 1 addition & 0 deletions src/ckb/extrasettingswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private slots:
void on_mAccelBox_clicked(bool checked);
void on_sAccelBox_clicked(bool checked);
void on_sSpeedBox_valueChanged(int arg1);
void on_delayBox_clicked(bool checked);

private:
Ui::ExtraSettingsWidget *ui;
Expand Down
10 changes: 10 additions & 0 deletions src/ckb/extrasettingswidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,16 @@
</property>
</widget>
</item>
<item row="14" column="1" colspan="6">
<widget class="QCheckBox" name="delayBox">
<property name="toolTip">
<string>When using macros with strings longer than 25 chars, some OS may lose characters (e.g. Mint 17.2). Select to prevent that bug.</string>
</property>
<property name="text">
<string>Use delay for very long macros</string>
</property>
</widget>
</item>
<item row="15" column="0" colspan="7">
<widget class="QLabel" name="osxLabel">
<property name="font">
Expand Down
Loading