Skip to content

Commit

Permalink
Color picker working under wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
madjesc committed Jun 28, 2021
1 parent e339e45 commit 51268af
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 340 deletions.
11 changes: 10 additions & 1 deletion build-aux/flatpak/com.github.akiraux.akira.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@
"--filesystem=xdg-run/gvfs",
"--filesystem=xdg-run/gvfsd"
],
"modules": [{
"modules": [
{
"name": "libportal",
"buildsystem": "meson",
"sources": [{
"type": "git",
"url": "https://github.com/flatpak/libportal.git"
}]
},
{
"name": "goocanvas",
"config-opts": ["--enable-python=no"],
"build-options": {
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cairo_dependency = dependency('cairo', version: '>=1.14')
goocanvas_dependency = dependency('goocanvas-3.0')
libarchive_dependency = dependency('libarchive')
json_glib_dependency = dependency('json-glib-1.0')
dep_libportal = dependency('libportal', required: true)

# Optional dependencies
desktop_file_validate = find_program('desktop-file-validate', required: false)
Expand Down
7 changes: 7 additions & 0 deletions src/Layouts/Partials/FillItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public class Akira.Layouts.Partials.FillItem : Gtk.Grid {
hidden_button.clicked.connect (toggle_visibility);
}

private void on_color_changed () {
color_set_manually = true;
color = color_chooser_widget.rgba.to_string ();
alpha = ((int)(color_chooser_widget.rgba.alpha * 255));
set_button_color ();
}

private void on_delete_item () {
fill.remove ();
fill_deleted ();
Expand Down
15 changes: 0 additions & 15 deletions src/Services/ActionManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -470,19 +470,6 @@ 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_pressed.connect (e => {
is_holding_shift = e.keyval == Gdk.Key.Shift_L;
});

color_picker.key_released.connect (e => {
is_holding_shift = e.keyval == Gdk.Key.Shift_L;
});

color_picker.cancelled.connect (() => {
color_picker.close ();
});

color_picker.picked.connect (color => {
foreach (var item in canvas.selected_bound_manager.selected_items) {
Expand All @@ -500,8 +487,6 @@ public class Akira.Services.ActionManager : Object {
item.fills.update_color_from_action (color);
}

color_picker.close ();

// Force a UI reload of the fills and borders panel since some items
// had their properties changed.
canvas.window.event_bus.selected_items_list_changed (canvas.selected_bound_manager.selected_items);
Expand Down
Loading

0 comments on commit 51268af

Please sign in to comment.