elementary / calculator

Calculator app designed for elementary OS
https://elementary.io
GNU General Public License v3.0
79 stars 29 forks source link

Add keyboard support #242

Open BAProductions opened 1 year ago

BAProductions commented 1 year ago

Add keyboard support Resolves #218, #220

BAProductions commented 1 year ago

basically control V does nothing ATM, Because the code for reading the clipboard is giving me error, So is anyone wants to jump in help figure the code out going on with the the code for reading the clipboard that would be awesome.

BAProductions commented 1 year ago

@ryonakano

BAProductions commented 1 year ago

@Tintou

lenemter commented 1 year ago

I created #244 to resolve #218 in a clean way.

I don't think it's possible to fix #220 currently because GTK 4 doesn't expose needed methods to animate the buttons. Both clicked and activate signals only activate them, unfortunately :(

BAProductions commented 1 year ago

I created #244 to resolve #218 in a clean way.

I don't think it's possible to fix #220 currently because GTK 4 doesn't expose needed methods to animate the buttons. Both clicked and activate signals only activate them, unfortunately :(

I know, But it's a starts none the less.

BAProductions commented 1 year ago

I created #244 to resolve #218 in a clean way.

I don't think it's possible to fix #220 currently because GTK 4 doesn't expose needed methods to animate the buttons. Both clicked and activate signals only activate them, unfortunately :(

It posable do animated the button by adding a css class to change the background color on key_press & then removing it on key_release

BAProductions commented 1 year ago

I created #244 to resolve #218 in a clean way.

I don't think it's possible to fix #220 currently because GTK 4 doesn't expose needed methods to animate the buttons. Both clicked and activate signals only activate them, unfortunately :(

https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3390

lenemter commented 1 year ago

@BAProductions Thank you for looking into this. Our stylesheet doesn't support this .keyboard-activating class and adding it fixes the keyboard navigation. Using activate () signal instead of clicked () highlights the buttons, change that please.

BAProductions commented 1 year ago

The only thing that's still not working is Control V to paste aka I don't understand how to read the clipboard in GTK4, But I know how to do in GTK3.

BAProductions commented 1 year ago

@BAProductions Thank you for looking into this. Our stylesheet doesn't support this .keyboard-activating class and adding it fixes the keyboard navigation. Using activate () signal instead of clicked () highlights the buttons, change that please.

I just tested & all the buttons get highlights when Using activate () Except for the equal, and the clear button.

lenemter commented 1 year ago

Equal and clear buttons have different style, so I guess it's a problem with elementary/stylesheet#1246

lenemter commented 1 year ago

The only thing that's still not working is Control V to paste aka I don't understand how to read the clipboard in GTK4, But I know how to do in GTK3.

Added that in #245

lenemter commented 1 year ago

@BAProductions After #245 is merged can you please remove copy and paste functionality from this PR please?

Also please fix lint issues, you can install vala-lint from https://github.com/vala-lang/vala-lint to check lint localy.

BAProductions commented 1 year ago

I don't think this is the right way to do this. Probably what you want to do instead is set up a key event forwarder like this: https://github.com/elementary/switchboard/blob/b013b28bd18703812857e443b6791756e00f3498/src/Application.vala#L259

This might work, But i'm going to redo everything & open a new PR, so then I can have a clean slate adding & setting up key event forwarder.