Skip to content

Add keyboard support#242

Open
BAProductions wants to merge 10 commits into
elementary:mainfrom
MC-OS:Gtk4
Open

Add keyboard support#242
BAProductions wants to merge 10 commits into
elementary:mainfrom
MC-OS:Gtk4

Conversation

@BAProductions

@BAProductions BAProductions commented Mar 8, 2023

Copy link
Copy Markdown

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

BAProductions commented Mar 8, 2023

Copy link
Copy Markdown
Author

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

@ryonakano

@BAProductions

Copy link
Copy Markdown
Author

@tintou

@lenemter

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

BAProductions commented Mar 12, 2023

Copy link
Copy Markdown
Author

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

Comment thread src/MainWindow.vala
Comment thread src/MainWindow.vala Outdated
Comment thread src/MainWindow.vala Outdated
Comment thread src/MainWindow.vala Outdated
Comment thread src/MainWindow.vala Outdated
Comment thread src/MainWindow.vala Outdated

@danirabbit danirabbit left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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