VirtualBox

忽略:
時間撮記:
2010-2-18 上午10:35:24 (15 年 以前)
作者:
vboxsync
訊息:

Devices, Main, pdmifs.h: initial support for PS/2 touchscreen emulation, based on the Lifebook touchscreen device

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Input/DevPS2.cpp

    r26572 r26624  
    5757#include "../Builtins.h"
    5858
    59 #define PCKBD_SAVED_STATE_VERSION 3
     59#define PCKBD_SAVED_STATE_VERSION 4
    6060
    6161
     
    162162#define KBD_QUEUE_SIZE 256
    163163
     164/* Supported mouse protocols */
     165enum
     166{
     167    MOUSE_PROT_PS2 = 0,
     168    MOUSE_PROT_IMPS2 = 3,
     169    MOUSE_PROT_IMEX = 4,
     170    MOUSE_PROT_LIFEBOOK = 5
     171};
     172
     173/* Mouse flags */
    164174# define MOUSE_REPORT_HORIZONTAL  0x01
    165 # define MOUSE_OUTSTANDING_CLICK  0x02
     175
     176/** Extended mouse button values for Lifebook mode */
     177/** Downwards scrollwheel movement of one step.  Doesn't affect the mouse
     178 * buttons */
     179# define MOUSE_EXT_VSCROLL_DN   4
     180/** Upwards scrollwheel movement of one step. */
     181# define MOUSE_EXT_VSCROLL_UP   5
     182/** Leftwards scrollwheel movement of one step. */
     183# define MOUSE_EXT_HSCROLL_BW   6
     184/** Rightwards scrollwheel movement of one step. */
     185# define MOUSE_EXT_HSCROLL_FW   7
    166186
    167187typedef struct {
     
    210230    int32_t mouse_dw;
    211231    int32_t mouse_flags;
     232    int32_t mouse_cx;
     233    int32_t mouse_cy;
    212234    uint8_t mouse_buttons;
     235    uint8_t mouse_buttons_reported;
     236    uint8_t mouse_last_button;
    213237
    214238    /** Pointer to the device instance - RC. */
     
    647671}
    648672
    649 static void kbd_mouse_send_packet(KBDState *s, bool fToCmdQueue)
     673static void kbd_mouse_set_reported_buttons(KBDState *s, unsigned fButtons, unsigned fButtonMask)
     674{
     675    s->mouse_buttons_reported |= (fButtons & fButtonMask);
     676    s->mouse_buttons_reported &= (fButtons | ~fButtonMask);
     677}
     678
     679static bool kbd_mouse_test_set_button(KBDState *s, unsigned cIndex)
     680{
     681    unsigned fButtonMask = 1 << (cIndex - 1);
     682
     683    AssertReturn(3 <= cIndex && cIndex <= 5, false);
     684    if (   (s->mouse_buttons & fButtonMask)
     685        && !(s->mouse_buttons_reported & fButtonMask))
     686    {
     687        s->mouse_last_button = cIndex;
     688        kbd_mouse_set_reported_buttons(s, fButtonMask, 0x1c);
     689        return true;
     690    }
     691    return false;
     692}
     693
     694static bool kbd_mouse_test_clear_last_button(KBDState *s)
     695{
     696    unsigned fButtonMask = 1 << (s->mouse_last_button - 1);
     697
     698    if (   s->mouse_last_button != 0
     699        && !(s->mouse_buttons & fButtonMask))
     700    {
     701        s->mouse_last_button = 0;
     702        kbd_mouse_set_reported_buttons(s, 0, fButtonMask);
     703        return true;
     704    }
     705    return false;
     706}
     707
     708/**
     709 * Send a single relative packet in 3-byte PS/2 format, optionally with our
     710 * packed button protocol extension, to the PS/2 controller.
     711 * @param  s               keyboard state object
     712 * @param  dx              relative X value, must be between -256 and +255
     713 * @param  dy              relative y value, must be between -256 and +255
     714 * @param  fButtonsLow     the state of the two first mouse buttons
     715 * @param  fButtonsPacked  the state of the upper three mouse buttons and
     716 *                         scroll wheel movement, packed as per the
     717 *                         MOUSE_EXT_* defines.  For standard PS/2 packets
     718 *                         only pass the value of button 3 here.
     719 */
     720static void kbd_mouse_send_rel3_packet(KBDState *s, bool fToCmdQueue)
    650721{
    651722    int aux = fToCmdQueue ? 1 : 2;
     723    int dx1 =   s->mouse_dx < 0 ? RT_MAX(s->mouse_dx, -256)
     724              : s->mouse_dx > 0 ? RT_MIN(s->mouse_dx, 255) : 0;
     725    int dy1 =   s->mouse_dy < 0 ? RT_MAX(s->mouse_dy, -256)
     726              : s->mouse_dy > 0 ? RT_MIN(s->mouse_dy, 255) : 0;
    652727    unsigned int b;
    653     int dx1, dy1, dz1, dw1;
    654 
    655     dx1 = s->mouse_dx;
    656     dy1 = s->mouse_dy;
    657     dz1 = s->mouse_dz;
    658     dw1 = s->mouse_dw;
    659     LogRel3(("%s: dx=%d, dy=%d, dz=%d, dw=%d\n", __PRETTY_FUNCTION__,
    660              dx1, dy1, dz1, dw1));
    661     /* XXX: increase range to 8 bits ? */
    662     if (dx1 > 127)
    663         dx1 = 127;
    664     else if (dx1 < -127)
    665         dx1 = -127;
    666     if (dy1 > 127)
    667         dy1 = 127;
    668     else if (dy1 < -127)
    669         dy1 = -127;
    670     b = 0x08 | ((dx1 < 0) << 4) | ((dy1 < 0) << 5) | (s->mouse_buttons & 0x07);
     728    unsigned fButtonsPacked;
     729    unsigned fButtonsLow = s->mouse_buttons & 0x03;
     730    s->mouse_dx -= dx1;
     731    s->mouse_dy -= dy1;
     732    kbd_mouse_set_reported_buttons(s, fButtonsLow, 0x03);
     733    /* When we are not in lifebook mode, we just set the third bit
     734     * in the first packet byte if the middle button is pressed,
     735     * as per the PS/2 protocol. */
     736    if (s->mouse_type != MOUSE_PROT_LIFEBOOK)
     737    {
     738        fButtonsPacked = (s->mouse_buttons & 0x04 ? 0x04 : 0);
     739        kbd_mouse_set_reported_buttons(s, s->mouse_buttons, 0x04);
     740    }
     741    else
     742    {
     743        if (kbd_mouse_test_set_button(s, 3))
     744            fButtonsPacked = 1;
     745        else if (kbd_mouse_test_set_button(s, 4))
     746            fButtonsPacked = 2;
     747        else if (kbd_mouse_test_set_button(s, 5))
     748            fButtonsPacked = 3;
     749        /* Release event for buttons in the range 3-5. */
     750        else if (kbd_mouse_test_clear_last_button(s))
     751            fButtonsPacked = 0;
     752        else if (s->mouse_dz < 0)
     753        {
     754            ++s->mouse_dz;
     755            fButtonsPacked = MOUSE_EXT_VSCROLL_DN;
     756        }
     757        else if (s->mouse_dz > 0)
     758        {
     759            --s->mouse_dz;
     760            fButtonsPacked = MOUSE_EXT_VSCROLL_UP;
     761        }
     762        else if (s->mouse_dw < 0)
     763        {
     764            ++s->mouse_dw;
     765            fButtonsPacked = MOUSE_EXT_HSCROLL_BW;
     766        }
     767        else if (s->mouse_dw > 0)
     768        {
     769            --s->mouse_dw;
     770            fButtonsPacked = MOUSE_EXT_HSCROLL_FW;
     771        }
     772        else
     773            fButtonsPacked = s->mouse_last_button;
     774    }
     775    LogRel3(("%s: dx1=%d, dy1=%d, fButtonsLow=0x%x, fButtonsPacked=0x%x\n",
     776             __PRETTY_FUNCTION__, dx1, dy1, fButtonsLow, fButtonsPacked));
     777    b = 0x08 | ((dx1 < 0) << 4) | ((dy1 < 0) << 5) | fButtonsLow
     778             | (fButtonsPacked & 4) | ((fButtonsPacked & 3) << 6);
    671779    kbd_queue(s, b, aux);
    672780    kbd_queue(s, dx1 & 0xff, aux);
    673781    kbd_queue(s, dy1 & 0xff, aux);
    674     /* extra byte for IMPS/2 or IMEX */
    675     switch(s->mouse_type) {
    676     default:
    677         break;
    678     case 3:
    679         if (dz1 > 127)
    680             dz1 = 127;
    681         else if (dz1 < -127)
    682                 dz1 = -127;
    683         kbd_queue(s, dz1 & 0xff, aux);
    684         break;
    685     case 4:
    686         if (dz1 > 1)
    687             dz1 = 1;
    688         else if (dz1 < -1)
    689             dz1 = -1;
    690         else if (dw1 > 1)
    691             dw1 = 1;
    692         else if (dw1 < -1)
    693             dw1 = -1;
    694         if (dz1)
    695             dw1 = 0;
    696         if ((s->mouse_flags & MOUSE_REPORT_HORIZONTAL) && dw1)
    697             b = 0x40 | (dw1 & 0x3f);
    698         else
    699         {
    700             b =   (dz1 & 0x0f) | ((dw1 << 1) & 0x0f)
    701                 | ((s->mouse_buttons & 0x18) << 1);
    702             s->mouse_flags &= ~MOUSE_OUTSTANDING_CLICK;
    703         }
    704         kbd_queue(s, b, aux);
    705         break;
    706     }
    707 
    708     /* update deltas */
    709     s->mouse_dx -= dx1;
    710     s->mouse_dy -= dy1;
     782}
     783
     784static void kbd_mouse_send_imps2_byte4(KBDState *s, bool fToCmdQueue)
     785{
     786    int aux = fToCmdQueue ? 1 : 2;
     787
     788    int dz1 =   s->mouse_dz < 0 ? RT_MAX(s->mouse_dz, -127)
     789              : s->mouse_dz > 0 ? RT_MIN(s->mouse_dz, 127) : 0;
    711790    s->mouse_dz -= dz1;
    712     s->mouse_dw -= dw1;
     791    kbd_queue(s, dz1 & 0xff, aux);
     792}
     793
     794static void kbd_mouse_send_imex_byte4(KBDState *s, bool fToCmdQueue)
     795{
     796    int aux = fToCmdQueue ? 1 : 2;
     797
     798    if (s->mouse_dw)
     799    {
     800        int dw1 =   s->mouse_dw < 0 ? RT_MAX(s->mouse_dw, -32)
     801                  : s->mouse_dw > 0 ? RT_MIN(s->mouse_dw, 32) : 0;
     802        s->mouse_dw -= dw1;
     803        kbd_queue(s, 0x40 | (dw1 & 0x3f), aux);
     804    }
     805    else if (s->mouse_flags & MOUSE_REPORT_HORIZONTAL && s->mouse_dz)
     806    {
     807        int dz1 =   s->mouse_dz < 0 ? RT_MAX(s->mouse_dz, -32)
     808                  : s->mouse_dz > 0 ? RT_MIN(s->mouse_dz, 32) : 0;
     809        s->mouse_dz -= dz1;
     810        kbd_queue(s, 0x80 | (dz1 & 0x3f), aux);
     811    }
     812    else
     813    {
     814        int dz1 =   s->mouse_dz < 0 ? RT_MAX(s->mouse_dz, -8)
     815                  : s->mouse_dz > 0 ? RT_MIN(s->mouse_dz, 8) : 0;
     816        s->mouse_dz -= dz1;
     817        kbd_mouse_set_reported_buttons(s, s->mouse_buttons, 0x18);
     818        kbd_queue(s, (dz1 & 0x0f) | ((s->mouse_buttons & 0x18) << 1), aux);
     819    }
     820}
     821
     822/**
     823 * Send a single relative packet in (IM)PS/2 or IMEX format to the PS/2
     824 * controller.
     825 * @param  s            keyboard state object
     826 * @param  fToCmdQueue  should this packet go to the command queue (or the
     827 *                      event queue)?
     828 */
     829static void kbd_mouse_send_rel_packet(KBDState *s, bool fToCmdQueue)
     830{
     831    kbd_mouse_send_rel3_packet(s, fToCmdQueue);
     832    if (s->mouse_type == MOUSE_PROT_IMPS2)
     833        kbd_mouse_send_imps2_byte4(s, fToCmdQueue);
     834    if (s->mouse_type == MOUSE_PROT_IMEX)
     835        kbd_mouse_send_imex_byte4(s, fToCmdQueue);
     836}
     837
     838/**
     839 * Send a single absolute packet in 6-byte lifebook format to the PS/2
     840 * controller.
     841 * @param  s         keyboard state object
     842 * @param  cx        absolute X value
     843 * @param  cy        absolute y value
     844 * @param  fButtons  the state of the two first mouse buttons
     845 */
     846static void kbd_mouse_send_abs_packet(KBDState *s, bool fToCmdQueue)
     847{
     848    int aux = fToCmdQueue ? 1 : 2;
     849    int cx1 = s->mouse_cx * 4096 / 0xffff;
     850    int cy1 = 4096 - (s->mouse_cy * 4096 / 0xffff);
     851    unsigned fButtons = s->mouse_buttons & 0x03;
     852    unsigned int b;
     853
     854    LogRel3(("%s: cx1=%d, cy1=%d, fButtons=0x%x\n", __PRETTY_FUNCTION__,
     855             cx1, cy1, fButtons));
     856    b = 4 /* Screen is being touched */ | fButtons;
     857    kbd_queue(s, b, aux);
     858    b = ((cy1 << 2) & 0xc0) | (cx1 >> 6);
     859    kbd_queue(s, b, aux);
     860    b = ((cx1 << 2) & 0xc0) | (cx1 & 0x3f);
     861    kbd_queue(s, b, aux);
     862    kbd_queue(s, 0xc0, aux);  /* This byte is really wasted in the protocol */
     863    b = ((cx1 << 2) & 0xc0) | (cy1 >> 6);
     864    kbd_queue(s, b, aux);
     865    b = ((cy1 << 2) & 0xc0) | (cy1 & 0x3f);
     866    kbd_queue(s, b, aux);
     867}
     868
     869static bool kbd_mouse_rel_unreported(KBDState *s)
     870{
     871   return    s->mouse_dx
     872          || s->mouse_dy
     873          || s->mouse_dz
     874          || s->mouse_dw
     875          || s->mouse_buttons != s->mouse_buttons_reported;
     876}
     877
     878/**
     879 * Send a single packet in (IM)PS/2, IMEX or Lifebook format to the PS/2
     880 * controller.
     881 * @param  s            keyboard state object
     882 * @param  fToCmdQueue  is this the result of a poll on the mouse controller?
     883 */
     884static void kbd_mouse_send_packet(KBDState *s, bool fToCmdQueue)
     885{
     886    if (   kbd_mouse_rel_unreported(s)
     887        || (s->mouse_type != MOUSE_PROT_LIFEBOOK))
     888        kbd_mouse_send_rel_packet(s, fToCmdQueue);
     889    else
     890        kbd_mouse_send_abs_packet(s, fToCmdQueue);
    713891}
    714892
    715893#ifdef IN_RING3
    716 static void pc_kbd_mouse_event(void *opaque,
    717                                int dx, int dy, int dz, int dw, int buttons_state)
    718 {
     894static size_t kbd_mouse_event_queue_free(KBDState *s)
     895{
     896    AssertReturn(s->mouse_event_queue.count <= MOUSE_EVENT_QUEUE_SIZE, 0);
     897    return MOUSE_EVENT_QUEUE_SIZE - s->mouse_event_queue.count;
     898}
     899
     900static void pc_kbd_mouse_event(void *opaque, int dx, int dy, int dz, int dw,
     901                               int buttons_state)
     902{
     903    LogRel3(("%s: dx=%d, dy=%d, dz=%d, dw=%d, buttons_state=0x%x\n",
     904             __PRETTY_FUNCTION__, dx, dy, dz, dw, buttons_state));
    719905    KBDState *s = (KBDState*)opaque;
    720906
     
    722908    if (!(s->mouse_status & MOUSE_STATUS_ENABLED))
    723909        return;
     910    AssertReturnVoid((buttons_state & ~0x1f) == 0);
    724911
    725912    s->mouse_dx += dx;
    726913    s->mouse_dy -= dy;
    727914    s->mouse_dz += dz;
    728     s->mouse_dw += dw;
    729     /* In horizontal reporting mode, we may need to send an additional packet
    730      * for the forth and fifth buttons, as they can't share a packet with a
    731      * horizontal scroll delta. */
    732     if (   s->mouse_type == 4
    733         && (s->mouse_buttons & 0x18) != (buttons_state & 0x18))
    734         s->mouse_flags |= MOUSE_OUTSTANDING_CLICK;
     915    if (   (   (s->mouse_type == MOUSE_PROT_IMEX)
     916            && s->mouse_flags & MOUSE_REPORT_HORIZONTAL)
     917        || (s->mouse_type == MOUSE_PROT_LIFEBOOK))
     918        s->mouse_dw += dw;
    735919    s->mouse_buttons = buttons_state;
     920    if (!(s->mouse_status & MOUSE_STATUS_REMOTE))
     921        /* if not remote, send event. Multiple events are sent if
     922           too big deltas */
     923        while (   kbd_mouse_rel_unreported(s)
     924               && kbd_mouse_event_queue_free(s) > 4)
     925            kbd_mouse_send_rel_packet(s, false);
     926}
     927
     928static void pc_kbd_mouse_event_abs(void *opaque, unsigned cx, unsigned cy)
     929{
     930    LogRel3(("%s: cx=%d, cy=%d\n", __PRETTY_FUNCTION__, cx, cy));
     931    KBDState *s = (KBDState*)opaque;
     932
     933    if (!(s->mouse_status & MOUSE_STATUS_ENABLED))
     934        return;
     935
     936    if (s->mouse_type != MOUSE_PROT_LIFEBOOK)
     937        return;
     938
     939    s->mouse_cx = cx;
     940    s->mouse_cy = cy;
    736941
    737942    if (!(s->mouse_status & MOUSE_STATUS_REMOTE) &&
    738         (s->mouse_event_queue.count < (MOUSE_EVENT_QUEUE_SIZE - 4))) {
    739         for(;;) {
    740             /* if not remote, send event. Multiple events are sent if
    741                too big deltas */
    742             kbd_mouse_send_packet(s, false);
    743             if (s->mouse_dx == 0 && s->mouse_dy == 0 && s->mouse_dz == 0 && s->mouse_dw == 0 && !(s->mouse_flags & MOUSE_OUTSTANDING_CLICK))
    744                 break;
    745         }
    746     }
     943        (s->mouse_event_queue.count < (MOUSE_EVENT_QUEUE_SIZE - 4)))
     944        /* if not remote, send event */
     945        kbd_mouse_send_abs_packet(s, false);
    747946}
    748947#endif /* IN_RING3 */
    749948
    750 static void kbd_write_mouse(KBDState *s, int val)
     949static int kbd_write_mouse(KBDState *s, int val)
    751950{
    752951#ifdef DEBUG_MOUSE
     
    765964                s->mouse_wrap = 0;
    766965                kbd_queue(s, AUX_ACK, 1);
    767                 return;
     966                return VINF_SUCCESS;
    768967            } else if (val != AUX_RESET) {
    769968                kbd_queue(s, val, 1);
    770                 return;
     969                return VINF_SUCCESS;
    771970            }
    772971        }
     
    8331032            s->mouse_resolution = 2;
    8341033            s->mouse_status = 0;
    835             s->mouse_type = 0;
     1034            s->mouse_type = MOUSE_PROT_PS2;
    8361035            kbd_queue(s, AUX_ACK, 1);
    8371036            kbd_queue(s, 0xaa, 1);
     
    8791078            else if (val == 200)
    8801079                s->mouse_detect_state = 3;
    881             else if ((val == 80) && s->mouse_type == 4 /* IMEX */)
     1080            else if ((val == 80) && s->mouse_type == MOUSE_PROT_IMEX)
    8821081                /* enable horizontal scrolling, byte two */
    8831082                s->mouse_detect_state = 4;
     
    8891088            {
    8901089                LogRelFlowFunc(("switching mouse device to IMPS/2 mode\n"));
    891                 s->mouse_type = 3; /* IMPS/2 */
     1090                s->mouse_type = MOUSE_PROT_IMPS2;
    8921091            }
    8931092            s->mouse_detect_state = 0;
     
    8971096            {
    8981097                LogRelFlowFunc(("switching mouse device to IMEX mode\n"));
    899                 s->mouse_type = 4; /* IMEX */
     1098                s->mouse_type = MOUSE_PROT_IMEX;
    9001099            }
    9011100            s->mouse_detect_state = 0;
     
    9141113        break;
    9151114    case AUX_SET_RES:
    916         s->mouse_resolution = val;
    917         kbd_queue(s, AUX_ACK, 1);
     1115        if (0 <= val && val < 4)
     1116        {
     1117            s->mouse_resolution = val;
     1118            kbd_queue(s, AUX_ACK, 1);
     1119        }
     1120        else if (val == 6)  /* Lifebook off magic knock */
     1121        {
     1122#ifdef IN_RING3
     1123            LogRelFlowFunc(("switching mouse device to basic PS/2 mode\n"));
     1124            s->mouse_type = MOUSE_PROT_PS2;
     1125            s->Mouse.pDrv->pfnAbsModeChange(s->Mouse.pDrv, false);
     1126#else
     1127            return VINF_IOM_HC_IOPORT_WRITE;
     1128#endif
     1129            kbd_queue(s, AUX_NACK, 1);
     1130        }
     1131        else if (val == 8)  /* Lifebook on magic knock */
     1132        {
     1133#ifdef IN_RING3
     1134            LogRelFlowFunc(("switching mouse device to touch screen mode\n"));
     1135            s->mouse_type = MOUSE_PROT_LIFEBOOK;
     1136            s->Mouse.pDrv->pfnAbsModeChange(s->Mouse.pDrv, true);
     1137#else
     1138            return VINF_IOM_HC_IOPORT_WRITE;
     1139#endif
     1140            kbd_queue(s, AUX_NACK, 1);
     1141        }
     1142        else
     1143            kbd_queue(s, AUX_NACK, 1);
    9181144        s->mouse_write_cmd = -1;
    9191145        break;
    9201146    }
     1147    return VINF_SUCCESS;
    9211148}
    9221149
     
    9631190        break;
    9641191    case KBD_CCMD_WRITE_MOUSE:
    965         kbd_write_mouse(s, val);
     1192        rc = kbd_write_mouse(s, val);
    9661193        break;
    9671194    default:
     
    9941221    s->mouse_sample_rate = 0;
    9951222    s->mouse_wrap = 0;
    996     s->mouse_type = 0;
     1223    s->mouse_type = MOUSE_PROT_PS2;
     1224    s->Mouse.pDrv->pfnAbsModeChange(s->Mouse.pDrv, false);
    9971225    s->mouse_detect_state = 0;
    9981226    s->mouse_dx = 0;
     
    10011229    s->mouse_dw = 0;
    10021230    s->mouse_flags = 0;
     1231    s->mouse_cx = 0x8000;
     1232    s->mouse_cy = 0x8000;
    10031233    s->mouse_buttons = 0;
     1234    s->mouse_buttons_reported = 0;
     1235    s->mouse_last_button = 0;
    10041236    q = &s->queue;
    10051237    q->rptr = 0;
     
    10391271    qemu_put_be32s(f, &s->mouse_dw);
    10401272    qemu_put_be32s(f, &s->mouse_flags);
     1273    qemu_put_be32s(f, &s->mouse_cx);
     1274    qemu_put_be32s(f, &s->mouse_cy);
    10411275    qemu_put_8s(f, &s->mouse_buttons);
     1276    qemu_put_8s(f, &s->mouse_buttons_reported);
     1277    qemu_put_8s(f, &s->mouse_last_button);
    10421278
    10431279    /* XXX: s->scancode_set isn't being saved, but we only really support set 2,
     
    10891325    qemu_get_8s(f, &s->mouse_wrap);
    10901326    qemu_get_8s(f, &s->mouse_type);
     1327    if (s->mouse_type == MOUSE_PROT_LIFEBOOK)
     1328        s->Mouse.pDrv->pfnAbsModeChange(s->Mouse.pDrv, true);
    10911329    qemu_get_8s(f, &s->mouse_detect_state);
    10921330    qemu_get_be32s(f, (uint32_t *)&s->mouse_dx);
     
    10991337    }
    11001338    qemu_get_8s(f, &s->mouse_buttons);
     1339    if (version_id > 3)
     1340    {
     1341        SSMR3GetS32(f, &s->mouse_cx);
     1342        SSMR3GetS32(f, &s->mouse_cy);
     1343        SSMR3GetU8(f, &s->mouse_buttons_reported);
     1344        SSMR3GetU8(f, &s->mouse_last_button);
     1345    }
    11011346    s->queue.count = 0;
    11021347    s->queue.rptr = 0;
     
    14231668
    14241669    pc_kbd_mouse_event(pThis, i32DeltaX, i32DeltaY, i32DeltaZ, i32DeltaW, fButtonStates);
     1670
     1671    PDMCritSectLeave(&pThis->CritSect);
     1672    return VINF_SUCCESS;
     1673}
     1674
     1675/**
     1676 * Mouse event handler.
     1677 *
     1678 * @returns VBox status code.
     1679 * @param   pInterface      Pointer to the mouse port interface (KBDState::Mouse.IPort).
     1680 * @param   i32cX           The X value.
     1681 * @param   i32cY           The Y value.
     1682 */
     1683static DECLCALLBACK(int) kbdMousePutEventAbs(PPDMIMOUSEPORT pInterface, int32_t i32cX, int32_t i32cY)
     1684{
     1685    KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.IPort);
     1686    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
     1687    AssertReleaseRC(rc);
     1688
     1689    pc_kbd_mouse_event_abs(pThis, i32cX, i32cY);
    14251690
    14261691    PDMCritSectLeave(&pThis->CritSect);
     
    16191884    pThis->Mouse.IBase.pfnQueryInterface    = kbdMouseQueryInterface;
    16201885    pThis->Mouse.IPort.pfnPutEvent          = kbdMousePutEvent;
     1886    pThis->Mouse.IPort.pfnPutEventAbs       = kbdMousePutEventAbs;
    16211887
    16221888    /*
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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