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

VENOM-389: Fix modifiers issue #390

Closed
wants to merge 2 commits into from
Closed

Conversation

SkyzohKey
Copy link

@SkyzohKey SkyzohKey commented Jun 15, 2018

closes #389

public bool on_key_press_event(Gdk.EventKey event) {
if (event.keyval == key.accel_key && event.state == key.accel_mods) {
send();
if (event.keyval in new uint[]{Gdk.Key.Return, Gdk.Key.KP_Enter}) {
Copy link
Owner

Choose a reason for hiding this comment

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

this will discard any user set preferences on which key to press for sending

Copy link
Author

Choose a reason for hiding this comment

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

Mh, yeah. Will fix.

@codecov-io
Copy link

codecov-io commented Jun 15, 2018

Codecov Report

Merging #390 into develop will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop    #390      +/-   ##
==========================================
- Coverage    24.62%   24.6%   -0.02%     
==========================================
  Files          101     101              
  Lines         5938    5942       +4     
==========================================
  Hits          1462    1462              
- Misses        4476    4480       +4
Impacted Files Coverage Δ
src/view/ConversationWindow.vala 0.53% <0%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c69c2c...9483223. Read the comment docs.

send();
if (event.keyval in new uint[]{Gdk.Key.Return, Gdk.Key.KP_Enter}) {
if ((event.state & Gdk.ModifierType.SHIFT_MASK) > 0) {
insert_new_line();
Copy link
Owner

Choose a reason for hiding this comment

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

return false; should do the same, pressing enter in a textview adds a "\n"

@naxuroqa naxuroqa changed the title Fix modifiers issue. Close #389 Fix modifiers issue Jun 15, 2018
if (event.keyval == key.accel_key && event.state == key.accel_mods) {
send();
if (event.keyval == key.accel_key) {
if ((event.state & Gdk.ModifierType.SHIFT_MASK) > 0) {
Copy link
Owner

Choose a reason for hiding this comment

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

this still discards the key.accels_mod

Copy link
Owner

Choose a reason for hiding this comment

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

Does this work on your system?

    public bool on_key_press_event(Gdk.EventKey event) {
      uint modifiers = event.state & (Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.CONTROL_MASK);
      if (event.keyval == key.accel_key && modifiers == key.accel_mods) {
        send();
        return true;
      }
      return false;
    }

@SkyzohKey
Copy link
Author

I guess I could replace the SHIFT_MASK with key.accel_mods

send();
if (event.keyval == key.accel_key) {
if ((event.state & Gdk.ModifierType.SHIFT_MASK) > 0) {
insert_new_line();
Copy link
Owner

Choose a reason for hiding this comment

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

Please remove the insert_new_line and just return false, otherwise we are catching stuff here that we aren't supposed to. If this will be needed in the future we can always add it.

@naxuroqa
Copy link
Owner

If you replace the shift_mask with accel_mods then we are pretty much where we were before :)

@SkyzohKey
Copy link
Author

Mh

@naxuroqa naxuroqa changed the title Fix modifiers issue VENOM-389: Fix modifiers issue Jun 15, 2018
@SkyzohKey
Copy link
Author

What is needed for this to be merged?

@naxuroqa
Copy link
Owner

naxuroqa commented Jun 16, 2018

There are still requested changes that need to be adressed. Please don't feature creep in bug fixes, or if you do, at least provide reasoning why you think this improves the existing behaviour.

The current implementation, though broken, catches a user definable key combination (key+modifier(s)), consumes the event on an exact match.

This means I could define something like ctrl-s as a key combination to send messages.

Your change would change the behavior, you would catch any key combination containing the user defined key and ignore the user defined modifier(s) all together. Additionally would the user defined key and shift always insert a newline.

This means that if someone sets the send key accel to ctrl-s, suddenly pressing s would send a message and shift-s would insert a newline (what?).

I hope this explains my concerns here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modifer comparison is broken
3 participants