VirtualBox

儲存庫 vbox 的更動 11971


忽略:
時間撮記:
2008-9-2 上午11:33:18 (16 年 以前)
作者:
vboxsync
訊息:

FE/Qt4-OSX: Mouse cursor handling cleanup.

位置:
trunk/src/VBox/Frontends/VirtualBox4
檔案:
刪除 2 筆資料
修改 3 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk

    r11867 r11971  
    621621VirtualBox4_SOURCES.darwin = \
    622622        src/darwin/DarwinKeyboard.cpp \
    623         src/darwin/DarwinCursor.cpp \
    624623        src/darwin/VBoxUtils-darwin.cpp \
    625624        src/VBoxFBQuartz2D.cpp
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleView.h

    r11622 r11971  
    4040#if defined (Q_WS_MAC)
    4141# include <Carbon/Carbon.h>
    42 # include "DarwinCursor.h"
    4342#endif
    4443
     
    291290     *  key was pressed when we get a kEventRawKeyModifiersChanged event. */
    292291    UInt32 mDarwinKeyModifiers;
    293     /** The darwin cursor handle (see DarwinCursor.h/.cpp). */
    294     DARWINCURSOR mDarwinCursor;
    295292#endif
    296293
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp

    r11942 r11971  
    8181#if defined (Q_WS_MAC)
    8282# include "DarwinKeyboard.h"
    83 # include "DarwinCursor.h"
    8483# ifdef VBOX_WITH_HACKED_QT
    8584#  include "QIApplication.h"
     
    825824    Assert (ok);
    826825    NOREF (ok);
    827 #endif
    828 
    829 #ifdef Q_WS_MAC
    830 //    DarwinCursorClearHandle (&mDarwinCursor);
    831826#endif
    832827}
     
    28152810    else /* !mMouseCaptured */
    28162811    {
    2817 #ifdef Q_WS_MAC /** @todo Christian, can you look at this. It causes flickering and IIRC is really a Qt3 workaround which probably isn't needed. If it is needed it needs to be redone. */
    2818         /* Update the mouse cursor; this is a bit excessive really... */
    2819 //        if (!DarwinCursorIsNull (&mDarwinCursor))
    2820 //            DarwinCursorSet (&mDarwinCursor);
    2821 #endif
    28222812        if (mMainWnd->isTrueFullscreen())
    28232813        {
     
    35073497
    35083498        /* Create a ARGB image out of the shape data. */
    3509         /* @todo: The following isn't nice but is working. Will fix this tomorrow. */
    35103499        QImage image  (me->width(), me->height(), QImage::Format_ARGB32);
    3511         unsigned char alpha;
    3512         const uint8_t *pbSrcMask = (const uint8_t *)srcAndMaskPtr;
    3513         unsigned cbSrcMaskLine = RT_ALIGN(me->width(), 8) / 8;
     3500        const uint8_t* pbSrcMask = static_cast<const uint8_t*> (srcAndMaskPtr);
     3501        unsigned cbSrcMaskLine = RT_ALIGN (me->width(), 8) / 8;
    35143502        for (unsigned int y = 0; y < me->height(); ++y)
    35153503        {
    35163504            for (unsigned int x = 0; x < me->width(); ++x)
    35173505            {
    3518                int i = y*me->width()+x;
    3519                unsigned int color = ((unsigned int*)srcShapePtr)[i];
    3520                if (me->hasAlpha())
    3521                    alpha = qAlpha (color);
    3522                else
     3506               unsigned int color = ((unsigned int*)srcShapePtr)[y*me->width()+x];
     3507               /* If the alpha channel isn't in the shape data, we have to
     3508                * create them from the and-mask. This is a bit field where 1
     3509                * represent transparency & 0 opaque respectively. */
     3510               if (!me->hasAlpha())
    35233511               {
    3524 //                   alpha = !srcAndMaskPtr[i] ? 0xff : 0x00;
    35253512                   if (!(pbSrcMask[x / 8] & (1 << (7 - (x % 8)))))
    3526                        alpha  = 0xff;
     3513                       color  |= 0xff000000;
    35273514                   else
    35283515                   {
    3529                        if (qRed (color) == 0xff &&
    3530                            qGreen (color) == 0xff &&
    3531                            qBlue (color) == 0xff)
    3532                        {
    3533                            color = 0;
    3534                            alpha = 0xff;
    3535                        }else
    3536                        {
    3537                            color = 0;
    3538                            alpha  = 0;
    3539                        }
     3516                       /* This isn't quite right, but it's the best we can do I
     3517                        * think... */
     3518                       if (color & 0x00ffffff)
     3519                           color = 0xff000000;
     3520                       else
     3521                           color = 0x00000000;
    35403522                   }
    35413523               }
    3542                image.setPixel (x, y, qRgba (qRed (color), qGreen (color), qBlue (color), alpha));
    3543             }
     3524               image.setPixel (x, y, color);
     3525            }
     3526            /* Move one scanline forward. */
    35443527            pbSrcMask += cbSrcMaskLine;
    35453528        }
    3546         /* Invert the mask channel if there is one */
    3547         QPixmap pixmap (QPixmap::fromImage (image));
    3548 //        if (!me->hasAlpha())
    3549 //        {
    3550 //            uchar* pu8DstData = (uchar*)alloca(me->width() * me->height());
    3551 //            unsigned int i = 0;
    3552 //            while (i < me->width() * me->height())
    3553 //            {
    3554 //                pu8DstData[i] =  !srcAndMaskPtr[i] ? 0xff : 0x00;
    3555 //                ++i;
    3556 //            }
    3557 //            QBitmap bitmap = QBitmap::fromData (QSize (me->width(), me->height()),
    3558 //                                                pu8DstData, QImage::Format_Mono);
    3559 //            /* Set the mask to the pixmap */
    3560 //            pixmap.setMask (bitmap);
    3561 //        }
    3562 //        printf ("has alpha %d- %d %d\n", me->hasAlpha(), me->width(), me->height());
    35633529        /* Set the new cursor */
    3564         QCursor cursor (pixmap,
     3530        QCursor cursor (QPixmap::fromImage (image),
    35653531                        me->xHot(), me->yHot());
    35663532        viewport()->setCursor (cursor);
    35673533        ok = true;
    3568         /*
    3569          * Qt3/Mac only supports black/white cursors and it offers no way
    3570          * to create your own cursors here unlike on X11 and Windows.
    3571          * Which means we're pretty much forced to do it our own way.
    3572          */
    3573 //        int rc;
    3574 //
    3575 //        /* dispose of the old cursor. */
    3576 //        if (!DarwinCursorIsNull (&mDarwinCursor))
    3577 //        {
    3578 //            rc = DarwinCursorDestroy (&mDarwinCursor);
    3579 //            AssertRC (rc);
    3580 //        }
    3581 //
    3582 //        /* create the new cursor */
    3583 //        rc = DarwinCursorCreate (me->width(), me->height(), me->xHot(), me->yHot(), me->hasAlpha(),
    3584 //                                 srcAndMaskPtr, srcShapePtr, &mDarwinCursor);
    3585 //        AssertRC (rc);
    3586 //        if (VBOX_SUCCESS (rc))
    3587 //        {
    3588 //            /** @todo check current mouse coordinates. */
    3589 //            rc = DarwinCursorSet (&mDarwinCursor);
    3590 //            AssertRC (rc);
    3591 //        }
    3592 //        ok = VBOX_SUCCESS (rc);
    35933534        NOREF (srcShapePtrScan);
    35943535
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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