Project

General

Profile

Bug #11056

SHIFT + TAB doesn't work on Swing ChUI

Added by Razvan-Nicolae Chichirau 7 months ago. Updated 6 months ago.

Status:
Test
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

History

#1 Updated by Razvan-Nicolae Chichirau 7 months ago

Testcase:

def var fi1 as char view-as fill-in.
def var fi2 as char view-as fill-in.
def var fi3 as char view-as fill-in.

def frame f fi1 at row 1 col 1 fi2 at row 3 col 1 fi3 at row 5 col 1 with side-labels.
enable all with frame f.
wait-for window-close of current-window.

TAB should move the focus on the next tab-stop widget and SHIFT-TAB should do the opposite. In Web ChUI both work, but Swing ChUI just flashes the widget which should receive focus, and then returns the focus on the initial widget. Tested with trunk/rev. 16323.

#2 Updated by Razvan-Nicolae Chichirau 7 months ago

  • Status changed from New to WIP
  • % Done changed from 0 to 100
  • reviewer Hynek Cihlar added
The problem originates from LinuxKeyboardReader which processes SHIFT+TAB as SHIFT-TAB + TAB. Let's break down what happens when the user presses SHIFT+TAB:
  1. SHIFT is pressed: only LKR.keyPressed() is invoked since SHIFT is not a printable character
  2. TAB is pressed:
    1. LKR.keyPressed() is first invoked with the TAB character. Shift is also pressed, so we treat it as BACK_TAB and insert it into the queue.
    2. LKR.keyTyped() is invoked because TAB is printable (\t). It also ends up being forwarded to the queue.

Because of this, FWD will rapidly switch the focus between the previous focusable widget (due to SHIFT-TAB) and the current widget (due to TAB).

Hynek: Please review 11056a/rev. 16326.

#3 Updated by Razvan-Nicolae Chichirau 7 months ago

  • Status changed from WIP to Review

#4 Updated by Hynek Cihlar 7 months ago

  • reviewer Sergey Ivanovskiy added

Is this issue limited only to Shift+Tab?

Sergey, also please review.

#5 Updated by Sergey Ivanovskiy 7 months ago

Do TAB/SHIFT+TAB keys work properly if the client is running on Windows?

#6 Updated by Razvan-Nicolae Chichirau 7 months ago

Hynek Cihlar wrote:

Is this issue limited only to Shift+Tab?

ATM we only treat the shift+tab combination in keyPressed() and that's why I wrote only its counterpart in keyTyped(). There are probably more cases like this. We could make it general and stop any SHIFT+keys processing from keyTyped() in order to handle it in keyPressed(), but this is prone to errors because we would need to test every possible SHIFT+key combination. So, how do you want to proceed further?

Do TAB/SHIFT+TAB keys work properly if the client is running on Windows?

I can't know that as I don't have the client configured on Windows.

#7 Updated by Sergey Ivanovskiy 7 months ago

Razvan-Nicolae Chichirau wrote:

Hynek Cihlar wrote:

Is this issue limited only to Shift+Tab?

ATM we only treat the shift+tab combination in keyPressed() and that's why I wrote only its counterpart in keyTyped(). There are probably more cases like this. We could make it general and stop any SHIFT+keys processing from keyTyped() in order to handle it in keyPressed(), but this is prone to errors because we would need to test every possible SHIFT+key combination. So, how do you want to proceed further?

Do TAB/SHIFT+TAB keys work properly if the client is running on Windows?

I can't know that as I don't have the client configured on Windows.

Is it correct that if we choose this configuration option "opsys"="WIN32", then WinKeyboardReader will be used with the Swing client

<parameter name="opsys"            value="WIN32" />

WinKeyboardReader has another way to implement key processing. The java doc for LinuxKeyboardReader states
that
This class represents a {@link SwingKeyboardReader} implementation for clients which require NCURSES/Linux compatibility.

Do you know/understand what means NCURSES/Linux compatibility?

#8 Updated by Razvan-Nicolae Chichirau 7 months ago

Sergey Ivanovskiy wrote:

Is it correct that if we choose this configuration option "opsys"="WIN32", then WinKeyboardReader will be used with the Swing client

No. You need to have the following node in deploy/client/client.xml:

<node type="client">
   <client>
      <chui windows="true"/>
   </client>
</node>

This will enable the WinKeyboardReader. The bug from #11056-1 doesn't happen with the Windows keyboard.

Do you know/understand what means NCURSES/Linux compatibility?

I guess the compatibility that FWD offers to run a program in an NCURSES-powered terminal / Linux in general (i.e. custom Linux keys behavior).

#9 Updated by Sergey Ivanovskiy 7 months ago

Do you know/understand what means NCURSES/Linux compatibility?

I guess the compatibility that FWD offers to run a program in an NCURSES-powered terminal / Linux in general (i.e. custom Linux keys behavior).

I meant what is the difference in compare with Windows case or what is the special Linux keys behavior? LinuxKeyboardReader sends key on keypressed if

      Integer mappedCode = xlate.get(key);

      if (mappedCode != null)

the key is contained in xlate map.

#10 Updated by Sergey Ivanovskiy 7 months ago

The changes 11056a/rev. 16326 looks correct.

#11 Updated by Razvan-Nicolae Chichirau 7 months ago

Has 11056a passed the review?

#12 Updated by Sergey Ivanovskiy 7 months ago

Razvan-Nicolae Chichirau wrote:

Has 11056a passed the review?

Yes, I think that the changes are good.

#13 Updated by Sergey Ivanovskiy 7 months ago

Sergey Ivanovskiy wrote:

Razvan-Nicolae Chichirau wrote:

Has 11056a passed the review?

Yes, I think that the changes are good.

Although there is the following comments in the code

         // normal VK_TAB is generated naturally in keyTyped() but SHIFT +
         // TAB must be handled here
         if (code == Key.VK_TAB)
         {
            code = shift ? Key.VK_BACK_TAB : -1;
         }

This comment supposes that SHIFT+TAB doesn't emit keyTyped event. What should be changed so TAB became emitted?

#14 Updated by Hynek Cihlar 7 months ago

Razvan-Nicolae Chichirau wrote:

ATM we only treat the shift+tab combination in keyPressed() and that's why I wrote only its counterpart in keyTyped(). There are probably more cases like this. We could make it general and stop any SHIFT+keys processing from keyTyped() in order to handle it in keyPressed(), but this is prone to errors because we would need to test every possible SHIFT+key combination. So, how do you want to proceed further?

Unless there are more similar customer reports, let's address it case by case for now.

#15 Updated by Razvan-Nicolae Chichirau 6 months ago

Sergey Ivanovskiy wrote:

This comment supposes that SHIFT+TAB doesn't emit keyTyped event. What should be changed so TAB became emitted?

When you are pressing TAB in the sequence SHIFT+TAB, both keyPressed() and keyTyped() are called in this order.

Hynek Cihlar wrote:

Unless there are more similar customer reports, let's address it case by case for now.

Can this be moved to Internal Testing?

#16 Updated by Hynek Cihlar 6 months ago

  • Status changed from Review to Internal Test

Razvan-Nicolae Chichirau wrote:

Can this be moved to Internal Testing?

I think so. Sergey, if you think there are still unresolved issues, let's discuss them further.

#17 Updated by Razvan-Nicolae Chichirau 6 months ago

Knowing this affects only Swing ChUI, I've done the following:
  • ChUI regression tests
  • Isolated tests such as #11056-1
  • Customer app smoke-test

If this is enough, we should merge 11056a.

#18 Updated by Hynek Cihlar 6 months ago

Razvan-Nicolae Chichirau wrote:

Knowing this affects only Swing ChUI, I've done the following:
  • ChUI regression tests
  • Isolated tests such as #11056-1
  • Customer app smoke-test

If this is enough, we should merge 11056a.

I think this should be enough, but let's wait for Sergey's go.

#19 Updated by Razvan-Nicolae Chichirau 6 months ago

Sergey, please respond to #11056-18.

#20 Updated by Sergey Ivanovskiy 6 months ago

It seems that you completed all tests and this branch can be merged.

#21 Updated by Hynek Cihlar 6 months ago

  • Status changed from Internal Test to Merge Pending

Please merge 11056a to trunk.

#22 Updated by Razvan-Nicolae Chichirau 6 months ago

  • Status changed from Merge Pending to Test

Branch 11056a was merged into trunk as rev. 16366 and archived.

Also available in: Atom PDF