Input key press event is fired twice (depending on input method ?)

Bug #1500912 reported by Jérémy Munsch
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Synapse
Triaged
Medium
Unassigned

Bug Description

Hi,

when pasting a hostname into synapse (eg. for ssh plugin) it is being pasted twice like:
clipboard: hostname
synapse: hostnamehostname

when hold shift key and selecting a hostname it opens 2 terminal windows for this host.

is there a configuration option for this or is it a bug?

regards,
nean

EDIT: using GTK_IM_MODULE='' synapse solves the problem as a workaround

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

I just noticed that if you start synapse from cli the bug does not occur, howhever if you start using a graphical method your pastes will be doubled

Revision history for this message
nean (nean.and.i) wrote :

hmm, I can not confirm that.
If I start it via terminal the same issue occurs.
So whats different to your starting option?

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

Yeah right i just noticed i had an alias :
GTK_IM_MODULE='' synapse

This was because i had crash from synapse (it made crash my kde (plasma5.3 desktop).
Seems like it solves more problems.

I did had to use on plasma5.2.

I actually have echo $GTK_IM_MODULE => fcitx

So i check into the code: if you set GTK_IM_MODULE='' => paste is triggered once
in no => paste is triggered twice

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

I mean i did not have to use on plasma 5.2, cause synapse made no crash

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

Indeed key_press_event function is triggered twice so i do not know where is the bug, but sure there is.

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

If anyone is aware on how to debug synapse or vala programs don't hesitate, i'm real stranger to this programming language.

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

Well definitly a synapse bug.
    public override bool key_press_event (Gdk.EventKey event)
    {
      message("keypress ");
      // this.controller.key_press_event (event);
      return false;
    }
This is some recursive situation because if you comment the controller method the key press is fired once only.

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

I found the cause :

im_context.focus_in ();

On controller.vala line 55 the very specific instruction "im_context.focus_in ();"
 // Input Method Fix
if (this.view is Gtk.Window) //this has to be true, otherwise im_context will not work well
{
  Gtk.Window v = this.view as Gtk.Window;

  message ("Using %s input method.", im_context.get_context_id ());

  v.focus_in_event.connect (() => {
    im_context.reset ();
    im_context.focus_in ();
    return false;
  });

  v.focus_out_event.connect (() => {
    im_context.focus_out ();
    return false;
  });

I'm not sure what this is doing.

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :
summary: - Paste in synapse doubles the paste
+ Input key press event is fired twice (depending on input method ?)
description: updated
description: updated
Revision history for this message
nean (nean.and.i) wrote :

seems it has something to do with the keyboard input method system which is in unity by default at "ibus"

there is a way to set it to "none" which might have the same effect as to set it via environment variable:
http://askubuntu.com/questions/472562/how-to-change-keyboard-input-method-system-to-none-in-ubuntu-gnome

however, I need to find out more about input method, what it is all about and why it behave strange in synapse,...

Revision history for this message
Jérémy Munsch (jeremy-munsch) wrote :

@nean it is a synapse bug actually see above.

if you want to change you input method use : im-config to set it to none.

https://en.wikipedia.org/wiki/Input_method

Like said, event is fired twice because of some code part i have tried to reach to original author but i'm waiting for an answer now.
I guess we could try to remove this code part.
If i have got any answer soon i'll make a merge request to fix this.

Revision history for this message
nean (nean.and.i) wrote :

thanks jeremy.

temp. WORKAROUND:
as tested in ubuntu 14.04.x
switching input method to "none" via im-config solves the problem.
(seems to be the same as to switch it via: system settings -> language support -> keyboard input method system )
However this might not be a solution for people who need "input method" set to "ibus" (korean, chinese keyboard etc,...)

Changed in synapse-project:
status: New → Triaged
importance: Undecided → Medium
milestone: none → 0.2.99.2
Changed in synapse-project:
milestone: 0.2.99.2 → 0.3.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.