VirtualBox

Ignore:
Timestamp:
Sep 16, 2008 3:46:57 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
36622
Message:

FE/Qt: X11 keyboard: tabs are evil

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/src/linux/keyboard-new.c

    r12495 r12496  
    121121            scan = sun_key_scan[keysym & 0xff];
    122122        else if (keysym == 0x20)            /* Spacebar */
    123             scan = 0x39;
     123            scan = 0x39;
    124124        else if (keysym == 0xFE03)          /* ISO level3 shift, aka AltGr */
    125             scan = 0x138;
    126         else if (use_builtin_table != 0)
     125            scan = 0x138;
     126        else if (use_builtin_table != 0)
    127127            scan = main_keyboard_type_scans[builtin_table_number][code];
    128128        else
     
    204204        /** Does this key match? */
    205205        int ok = 0;
    206         /* search for a match in layout table */
    207         for (key = 0; (key < MAIN_LEN) && (0 == ok); key++) {
    208           if (   ((*lkey)[key][0] == ckey[keyc][0])
    209               && ((*lkey)[key][1] == ckey[keyc][1])
     206        /* search for a match in layout table */
     207        for (key = 0; (key < MAIN_LEN) && (0 == ok); key++) {
     208          if (   ((*lkey)[key][0] == ckey[keyc][0])
     209              && ((*lkey)[key][1] == ckey[keyc][1])
    210210             ) {
    211211              ok = 1;
    212           }
    213         }
    214         /* count the matches and mismatches */
    215         if (0 != ok) {
    216           match++;
     212          }
     213        }
     214        /* count the matches and mismatches */
     215        if (0 != ok) {
     216          match++;
    217217          /* How well in sequence are the keys?  For dvorak layouts. */
    218           if (key > pkey) {
    219             if (1 == direction) {
    220               ++seq;
     218          if (key > pkey) {
     219            if (1 == direction) {
     220              ++seq;
    221221            } else {
    222               direction = -1;
     222              direction = -1;
    223223            }
    224           }
    225           if (key < pkey) {
    226             if (1 != direction) {
    227               ++seq;
     224          }
     225          if (key < pkey) {
     226            if (1 != direction) {
     227              ++seq;
    228228            } else {
    229               direction = 1;
     229              direction = 1;
    230230            }
    231           }
    232           pkey = key;
    233         } else {
     231          }
     232          pkey = key;
     233        } else {
    234234#ifdef DEBUG
    235235          /* print spaces instead of \0's */
     
    244244                       keyc, str, ckey[keyc][0], ckey[keyc][1]));
    245245#endif /* DEBUG defined */
    246         }
     246        }
    247247      }
    248248    }
    249249    LOG_KB_2(("Matches=%d, seq=%d\n", match, seq));
    250250    if (   (match > max_score)
    251         || ((match == max_score) && (seq > max_seq))
     251        || ((match == max_score) && (seq > max_seq))
    252252       ) {
    253253      /* best match so far */
     
    330330              && (0xFE03 != keysym)          /* ISO level3 shift, aka AltGr */
    331331             ) {
    332               unsigned found = 0;
    333 
    334               /* we seem to need to search the layout-dependent scancodes */
     332              unsigned found = 0;
     333
     334              /* we seem to need to search the layout-dependent scancodes */
    335335              char unshifted = keysym & 0xFF;
    336336              char shifted = XKeycodeToKeysym(display, keyc, 1) & 0xFF;
    337               /* find a key which matches */
    338               for (keyn = 0; (0 == found) && (keyn<MAIN_LEN); keyn++) {
     337              /* find a key which matches */
     338              for (keyn = 0; (0 == found) && (keyn<MAIN_LEN); keyn++) {
    339339                if (   ((*lkey)[keyn][0] == unshifted)
    340340                    && ((*lkey)[keyn][1] == shifted)
     
    342342                   found = 1;
    343343                }
    344               }
    345               if (0 != found) {
    346                 /* got it */
    347                 scan = main_key_scan[keyn - 1];
    348                 /* We keep track of the number of keys that we found a
    349                 * match for to see if the layout is optimal or not.
    350                 * We ignore the 102nd key though (key number 48), since
    351                 * not all keyboards have it. */
    352                 if (keyn != 48)
    353                     ++matches;
    354               }
     344              }
     345              if (0 != found) {
     346                /* got it */
     347                scan = main_key_scan[keyn - 1];
     348                /* We keep track of the number of keys that we found a
     349                * match for to see if the layout is optimal or not.
     350                * We ignore the 102nd key though (key number 48), since
     351                * not all keyboards have it. */
     352                if (keyn != 48)
     353                    ++matches;
     354              }
    355355              if (0 == scan) {
    356356                /* print spaces instead of \0's */
     
    376376                             keyc, str, unshifted, shifted, scan));
    377377              }
    378             }
     378            }
    379379        }
    380380        keyc2scan[keyc] = scan;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette