~ubuntu-branches/ubuntu/vivid/virtualbox/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/Common/VBoxKeyboard/keyboard.c

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-03-31 23:25:01 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20130331232501-l72jhvixkeyyz6xc
Tags: 4.2.10-dfsg-0ubuntu1
* Start the virtualbox-guest-x11 init script earlier.
  The vboxvideo module needs to be loaded before X starts.
* Change runlevels of virtualbox-guest-x11 init script on upgrade.
* Fix build failure with the Debian wheezy kernel which backports the drm
  subsystem from Linux 3.4. (Closes: #703358)
* Drop build-dependency on bcc as it's not needed anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
547
547
 
548
548
/**
549
549
 * Checks for the XKB extension, and if it is found initialises the X11 keycode
550
 
 * to XT scan code mapping by looking at the XKB names for each keycode.
 
550
 * to XT scan code mapping by looking at the XKB names for each keycode.  As it
 
551
 * turns out that XKB can return an empty list we make sure that the list holds
 
552
 * enough data to be useful to us.
551
553
 */
552
554
static unsigned
553
555
X11DRV_InitKeyboardByXkb(Display *pDisplay)
554
556
{
555
557
    int major = XkbMajorVersion, minor = XkbMinorVersion;
556
558
    XkbDescPtr pKBDesc;
 
559
    unsigned cFound = 0;
 
560
 
557
561
    if (!XkbLibraryVersion(&major, &minor))
558
562
        return 0;
559
563
    if (!XkbQueryExtension(pDisplay, NULL, NULL, &major, &minor, NULL))
574
578
                            XKB_NAME_SIZE))
575
579
                {
576
580
                    keyc2scan[i] = xkbMap[j].uScan;
 
581
                    ++cFound;
577
582
                    break;
578
583
                }
579
584
    }
580
585
    XkbFreeNames(pKBDesc, XkbKeyNamesMask, True);
581
586
    XkbFreeKeyboard(pKBDesc, XkbAllComponentsMask, True);
582
 
    return 1;
 
587
    return cFound >= 45 ? 1 : 0;
583
588
}
584
589
 
585
590
/**
632
637
    if (byXkbOK)
633
638
        *byXkbOK = byXkb;
634
639
 
 
640
    /* Fall back to the one which did work. */
 
641
    if (!byXkb)
 
642
    {
 
643
        if (byType)
 
644
            X11DRV_InitKeyboardByType(display);
 
645
        else
 
646
            X11DRV_InitKeyboardByLayout(display);
 
647
    }
 
648
 
635
649
    /* Remap keycodes after initialization. Remapping stops after an
636
650
       identity mapping is seen */
637
651
    if (remapScancodes != NULL)