Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard support #242

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Add keyboard support #242

wants to merge 10 commits into from

Conversation

BAProductions
Copy link

@BAProductions BAProductions commented Mar 8, 2023

Add keyboard support Resolves #218, #220

@BAProductions BAProductions marked this pull request as ready for review March 8, 2023 15:26
@BAProductions BAProductions changed the title Add keyboarded support Add keyboarded support #220 Mar 8, 2023
@BAProductions BAProductions changed the title Add keyboarded support #220 Add keyboard support Mar 8, 2023
@BAProductions BAProductions changed the title Add keyboard support Add keyboard support Resolves #220 Mar 8, 2023
@BAProductions BAProductions changed the title Add keyboard support Resolves #220 Add keyboard support Mar 8, 2023
@BAProductions
Copy link
Author

BAProductions commented Mar 8, 2023

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
Copy link
Author

@ryonakano

@BAProductions
Copy link
Author

@tintou

@lenemter
Copy link
Member

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Member

@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
Copy link
Author

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
Copy link
Author

BAProductions commented Mar 12, 2023

@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

This comment was marked as resolved.

@lenemter
Copy link
Member

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
Copy link
Member

@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.

src/MainWindow.vala Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@BAProductions
Copy link
Author

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.

Since entry is now in read only mode .grab_focus () & etc is no longer needed;
Remove application_instance.set_accels_for_action (ACTION_PREFIX + ACTION_CLEAR, {"Escape"});
& let event control handle it or the escape button will not animate.
Since Gdk.Key.Return is user by default to trigger the selected UI element when navigating the UI with the arrow keys or the tab keys the equal button will never get pressed or fire, But instead the highlight button will be pressed so Gdk.Key.equal makes the most since
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+C should copy display contents to clipboard
3 participants