Skip to content

Commit

Permalink
fix issue with some listeners not being triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
isneezy committed Sep 2, 2020
1 parent 4c37923 commit c0d819e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Services/ActionManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,11 @@ public class Akira.Services.ActionManager : Object {
bool is_holding_shift = false;
var color_picker = new Akira.Utils.ColorPicker ();
color_picker.show_all ();
color_picker.key_press_event.connect (e => {
color_picker.key_pressed.connect (e => {
is_holding_shift = e.keyval == Gdk.Key.Shift_L;
return true;
});
color_picker.key_release_event.connect (e => {
color_picker.key_released.connect (e => {
is_holding_shift = e.keyval == Gdk.Key.Shift_L;
return true;
});
color_picker.cancelled.connect (() => {
color_picker.close ();
Expand Down
10 changes: 10 additions & 0 deletions src/Utils/ColorPicker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class Akira.Utils.ColorPicker : Gtk.Window {
public signal void picked (Gdk.RGBA color);
public signal void cancelled ();
public signal void moved (Gdk.RGBA color);
public signal void key_pressed (Gdk.EventKey e);
public signal void key_released (Gdk.EventKey e);

const string DARK_BORDER_COLOR_STRING = "#333333";
private Gdk.RGBA dark_border_color = Gdk.RGBA ();
Expand Down Expand Up @@ -271,6 +273,14 @@ public class Akira.Utils.ColorPicker : Gtk.Window {
break;
}

key_pressed (e);

return true;
}

public override bool key_release_event (Gdk.EventKey e) {
key_released (e);

return true;
}

Expand Down

0 comments on commit c0d819e

Please sign in to comment.