src/video/qtopia/SDL_QWin.cc
author Sam Lantinga <slouken@libsdl.org>
Sun, 28 May 2006 18:16:36 +0000
branchSDL-1.3
changeset 1664 cd3db072ba8a
parent 1663 11775724e3fe
child 1665 28193f833b2b
permissions -rw-r--r--
more indent cleanup
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #include "SDL_QWin.h"
    25 #include <qapplication.h>
    26 #include <qdirectpainter_qws.h>
    27 
    28 screenRotationT screenRotation = SDL_QT_NO_ROTATION;
    29 
    30 SDL_QWin::SDL_QWin (const QSize & size):
    31 QWidget (0, "SDL_main"),
    32 my_painter (0),
    33 my_image (0),
    34 my_inhibit_resize (false),
    35 my_mouse_pos (-1, -1),
    36 my_flags (0),
    37 my_has_fullscreen (false),
    38 my_locked (0)
    39 {
    40     setBackgroundMode (NoBackground);
    41 }
    42 
    43 SDL_QWin::~SDL_QWin ()
    44 {
    45     // Nothing to do yet.
    46     if (my_image) {
    47         delete my_image;
    48     }
    49 }
    50 
    51 void
    52 SDL_QWin::setImage (QImage * image)
    53 {
    54     if (my_image) {
    55         delete my_image;
    56     }
    57     my_image = image;
    58     //  setFixedSize(image->size());
    59 }
    60 
    61 void
    62 SDL_QWin::resizeEvent (QResizeEvent * e)
    63 {
    64     if (size () != qApp->desktop ()->size ()) {
    65         // Widget is not the correct size, so do the fullscreen magic
    66         my_has_fullscreen = false;
    67         enableFullscreen ();
    68     }
    69     if (my_inhibit_resize) {
    70         my_inhibit_resize = false;
    71     } else {
    72         SDL_PrivateResize (e->size ().width (), e->size ().height ());
    73     }
    74 }
    75 
    76 void
    77 SDL_QWin::focusInEvent (QFocusEvent *)
    78 {
    79     // Always do it here, no matter the size.
    80     enableFullscreen ();
    81     SDL_PrivateAppActive (true, SDL_APPINPUTFOCUS);
    82 }
    83 
    84 void
    85 SDL_QWin::focusOutEvent (QFocusEvent *)
    86 {
    87     my_has_fullscreen = false;
    88     SDL_PrivateAppActive (false, SDL_APPINPUTFOCUS);
    89 }
    90 
    91 void
    92 SDL_QWin::closeEvent (QCloseEvent * e)
    93 {
    94     SDL_PrivateQuit ();
    95     e->ignore ();
    96 }
    97 
    98 void
    99 SDL_QWin::setMousePos (const QPoint & pos)
   100 {
   101     if (my_image->width () == height ()) {
   102         if (screenRotation == SDL_QT_ROTATION_90)
   103             my_mouse_pos = QPoint (height () - pos.y (), pos.x ());
   104         else if (screenRotation == SDL_QT_ROTATION_270)
   105             my_mouse_pos = QPoint (pos.y (), width () - pos.x ());
   106     } else {
   107         my_mouse_pos = pos;
   108     }
   109 }
   110 
   111 void
   112 SDL_QWin::mouseMoveEvent (QMouseEvent * e)
   113 {
   114     Qt::ButtonState button = e->button ();
   115     int sdlstate = 0;
   116     if ((button & Qt::LeftButton)) {
   117         sdlstate |= SDL_BUTTON_LMASK;
   118     }
   119     if ((button & Qt::RightButton)) {
   120         sdlstate |= SDL_BUTTON_RMASK;
   121     }
   122     if ((button & Qt::MidButton)) {
   123         sdlstate |= SDL_BUTTON_MMASK;
   124     }
   125     setMousePos (e->pos ());
   126     SDL_PrivateMouseMotion (sdlstate, 0, my_mouse_pos.x (),
   127                             my_mouse_pos.y ());
   128 }
   129 
   130 void
   131 SDL_QWin::mousePressEvent (QMouseEvent * e)
   132 {
   133     mouseMoveEvent (e);
   134     Qt::ButtonState button = e->button ();
   135     SDL_PrivateMouseButton (SDL_PRESSED,
   136                             (button & Qt::LeftButton) ? 1 :
   137                             ((button & Qt::RightButton) ? 2 : 3),
   138                             my_mouse_pos.x (), my_mouse_pos.y ());
   139 }
   140 
   141 void
   142 SDL_QWin::mouseReleaseEvent (QMouseEvent * e)
   143 {
   144     setMousePos (e->pos ());
   145     Qt::ButtonState button = e->button ();
   146     SDL_PrivateMouseButton (SDL_RELEASED,
   147                             (button & Qt::LeftButton) ? 1 :
   148                             ((button & Qt::RightButton) ? 2 : 3),
   149                             my_mouse_pos.x (), my_mouse_pos.y ());
   150     my_mouse_pos = QPoint (-1, -1);
   151 }
   152 
   153 static inline void
   154 gs_fastRotateBlit_3 (unsigned short *fb,
   155                      unsigned short *bits, const QRect & rect)
   156 {
   157     // FIXME: this only works correctly for 240x320 displays
   158     int startx, starty;
   159     int width, height;
   160 
   161     startx = rect.left () >> 1;
   162     starty = rect.top () >> 1;
   163     width = ((rect.right () - rect.left ()) >> 1) + 2;
   164     height = ((rect.bottom () - rect.top ()) >> 1) + 2;
   165 
   166     if ((startx + width) > 120) {
   167         width = 120 - startx;   // avoid horizontal overflow
   168     }
   169     if ((starty + height) > 160) {
   170         height = 160 - starty;  // avoid vertical overflow
   171     }
   172 
   173     ulong *sp1, *sp2, *dp1, *dp2;
   174     ulong stop, sbot, dtop, dbot;
   175 
   176     sp1 = (ulong *) bits + startx + starty * 240;
   177     sp2 = sp1 + 120;
   178     dp1 = (ulong *) fb + (159 - starty) + startx * 320;
   179     dp2 = dp1 + 160;
   180     int rowadd = (-320 * width) - 1;
   181     int rowadd2 = 240 - width;
   182     // transfer in cells of 2x2 pixels in words
   183     for (int y = 0; y < height; y++) {
   184         for (int x = 0; x < width; x++) {
   185             // read source pixels
   186             stop = *sp1;
   187             sbot = *sp2;
   188             // rotate pixels
   189             dtop = (sbot & 0xffff) + ((stop & 0xffff) << 16);
   190             dbot = ((sbot & 0xffff0000) >> 16) + (stop & 0xffff0000);
   191             // write to framebuffer
   192             *dp1 = dtop;
   193             *dp2 = dbot;
   194             // update source ptrs
   195             sp1++;
   196             sp2++;
   197             // update dest ptrs - 2 pix at a time
   198             dp1 += 320;
   199             dp2 += 320;
   200         }
   201         // adjust src ptrs - skip a row as we work in pairs
   202         sp1 += rowadd2;
   203         sp2 += rowadd2;
   204         // adjust dest ptrs for rotation
   205         dp1 += rowadd;
   206         dp2 += rowadd;
   207     }
   208 }
   209 
   210 static inline void
   211 gs_fastRotateBlit_1 (unsigned short *fb,
   212                      unsigned short *bits, const QRect & rect)
   213 {
   214     // FIXME: this only works correctly for 240x320 displays
   215     int startx, starty;
   216     int width, height;
   217 
   218     startx = rect.left () >> 1;
   219     starty = rect.top () >> 1;
   220     width = ((rect.right () - rect.left ()) >> 1) + 2;
   221     height = ((rect.bottom () - rect.top ()) >> 1) + 2;
   222 
   223     if ((startx + width) > 120) {
   224         width = 120 - startx;   // avoid horizontal overflow
   225     }
   226     if ((starty + height) > 160) {
   227         height = 160 - starty;  // avoid vertical overflow
   228     }
   229 
   230     ulong *sp1, *sp2, *dp1, *dp2;
   231     ulong stop, sbot, dtop, dbot;
   232     fb += 320 * 239;            // Move "fb" to top left corner
   233     sp1 = (ulong *) bits + startx + starty * 240;
   234     sp2 = sp1 + 120;
   235     dp1 = (ulong *) fb - startx * 320 - starty;
   236     dp2 = dp1 - 160;
   237     int rowadd = (320 * width) + 1;
   238     int rowadd2 = 240 - width;
   239     // transfer in cells of 2x2 pixels in words
   240     for (int y = 0; y < height; y++) {
   241         for (int x = 0; x < width; x++) {
   242             // read
   243             stop = *sp1;
   244             sbot = *sp2;
   245             // rotate
   246             dtop = (stop & 0xffff) + ((sbot & 0xffff) << 16);
   247             dbot = ((stop & 0xffff0000) >> 16) + (sbot & 0xffff0000);
   248             // write
   249             *dp1 = dtop;
   250             *dp2 = dbot;
   251             // update source ptrs
   252             sp1++;
   253             sp2++;
   254             // update dest ptrs - 2 pix at a time
   255             dp1 -= 320;
   256             dp2 -= 320;
   257         }
   258         // adjust src ptrs - skip a row as we work in pairs
   259         sp1 += rowadd2;
   260         sp2 += rowadd2;
   261         // adjust dest ptrs for rotation
   262         dp1 += rowadd;
   263         dp2 += rowadd;
   264     }
   265 }
   266 
   267 // desktop, SL-A300 etc
   268 /* *INDENT-OFF* */
   269 bool SDL_QWin::repaintRotation0 (const QRect & rect)
   270 {
   271     if (my_image->width () == width ()) {
   272         uchar * fb = (uchar *) my_painter->frameBuffer ();
   273         uchar * buf = (uchar *) my_image->bits ();
   274         if (rect == my_image->rect ()) {
   275             SDL_memcpy (fb, buf, width () * height () * 2);
   276         } else {
   277             int h = rect.height ();
   278             int wd = rect.width () << 1;
   279             int fblineadd = my_painter->lineStep ();
   280             int buflineadd = my_image->bytesPerLine ();
   281             fb += (rect.left () << 1) + rect.top () * my_painter->lineStep ();
   282             buf += (rect.left () << 1) + rect.top () * my_image->bytesPerLine ();
   283             while (h--) {
   284                 SDL_memcpy (fb, buf, wd);
   285                 fb += fblineadd;
   286                 buf += buflineadd;
   287             }
   288         }
   289     } else {
   290         return false;           // FIXME: Landscape
   291     }
   292 #ifdef __i386__
   293     my_painter->fillRect (rect, QBrush (Qt::NoBrush));
   294 #endif
   295     return true;
   296 }
   297 /* *INDENT-ON* */
   298 
   299 
   300 // Sharp Zaurus SL-5500 etc 
   301 /* *INDENT-OFF* */
   302 bool SDL_QWin::repaintRotation3 (const QRect & rect)
   303 {
   304     if (my_image->width () == width ()) {
   305         ushort * fb = (ushort *) my_painter->frameBuffer ();
   306         ushort * buf = (ushort *) my_image->bits ();
   307         gs_fastRotateBlit_3 (fb, buf, rect);
   308     } else {
   309         // landscape mode
   310         if (screenRotation == SDL_QT_ROTATION_90) {
   311             uchar * fb = (uchar *) my_painter->frameBuffer ();
   312             uchar * buf = (uchar *) my_image->bits ();
   313             if (rect == my_image->rect ()) {
   314                 SDL_memcpy (fb, buf, width () * height () * 2);
   315             } else {
   316                 int h = rect.height ();
   317                 int wd = rect.width () << 1;
   318                 int fblineadd = my_painter->lineStep ();
   319                 int buflineadd = my_image->bytesPerLine ();
   320                 fb +=
   321                     (rect.left () << 1) +
   322                     rect.top () * my_painter->lineStep ();
   323                 buf +=
   324                     (rect.left () << 1) +
   325                     rect.top () * my_image->bytesPerLine ();
   326                 while (h--) {
   327                     SDL_memcpy (fb, buf, wd);
   328                     fb += fblineadd;
   329                     buf += buflineadd;
   330                 }
   331             }
   332         } else if (screenRotation == SDL_QT_ROTATION_270) {
   333             int h = rect.height ();
   334             int wd = rect.width ();
   335             int fblineadd = my_painter->lineStep () - (rect.width () << 1);
   336             int buflineadd = my_image->bytesPerLine () - (rect.width () << 1);
   337             int w;
   338 
   339             uchar * fb = (uchar *) my_painter->frameBuffer ();
   340             uchar * buf = (uchar *) my_image->bits ();
   341 
   342             fb +=
   343                 ((my_painter->width () -
   344                   (rect.top () +
   345                    rect.height ())) * my_painter->lineStep ()) +
   346                 ((my_painter->height () -
   347                   ((rect.left () + rect.width ()))) << 1);
   348 
   349             buf +=
   350                 my_image->bytesPerLine () * (rect.top () +
   351                                              rect.height ()) -
   352                 (((my_image->width () -
   353                    (rect.left () + rect.width ())) << 1) + 2);
   354 
   355             while (h--) {
   356                 w = wd;
   357                 while (w--)
   358                     *((unsigned short *) fb)++ = *((unsigned short *) buf)--;
   359                 fb += fblineadd;
   360                 buf -= buflineadd;
   361             }
   362         }
   363     }
   364     return true;
   365 }
   366 /* *INDENT-ON* */
   367 
   368 // ipaq 3800...
   369 /* *INDENT-OFF* */
   370 bool SDL_QWin::repaintRotation1 (const QRect & rect)
   371 {
   372     if (my_image->width () == width ()) {
   373         ushort *fb = (ushort *) my_painter->frameBuffer ();
   374         ushort *buf = (ushort *) my_image->bits ();
   375         gs_fastRotateBlit_1 (fb, buf, rect);
   376     } else {
   377         return false;           // FIXME: landscape mode
   378     }
   379     return true;
   380 }
   381 /* *INDENT-ON* */
   382 
   383 void
   384 SDL_QWin::repaintRect (const QRect & rect)
   385 {
   386     if (!my_painter || !rect.width () || !rect.height ()) {
   387         return;
   388     }
   389 
   390     if (QPixmap::defaultDepth () == 16) {
   391         switch (my_painter->transformOrientation ()) {
   392         case 3:
   393             if (repaintRotation3 (rect)) {
   394                 return;
   395             }
   396             break;
   397         case 1:
   398             if (repaintRotation1 (rect)) {
   399                 return;
   400             }
   401             break;
   402         case 0:
   403             if (repaintRotation0 (rect)) {
   404                 return;
   405             }
   406             break;
   407         }
   408     }
   409     my_painter->drawImage (rect.topLeft (), *my_image, rect);
   410 }
   411 
   412 // This paints the current buffer to the screen, when desired. 
   413 void
   414 SDL_QWin::paintEvent (QPaintEvent * ev)
   415 {
   416     if (my_image) {
   417         lockScreen (true);
   418         repaintRect (ev->rect ());
   419         unlockScreen ();
   420     }
   421 }
   422 
   423 /* Function to translate a keyboard transition and queue the key event
   424  * This should probably be a table although this method isn't exactly
   425  * slow.
   426  */
   427 void
   428 SDL_QWin::QueueKey (QKeyEvent * e, int pressed)
   429 {
   430     SDL_keysym keysym;
   431     int scancode = e->key ();
   432     /* Set the keysym information */
   433     if (scancode >= 'A' && scancode <= 'Z') {
   434         // Qt sends uppercase, SDL wants lowercase
   435         keysym.sym = static_cast < SDLKey > (scancode + 32);
   436     } else if (scancode >= 0x1000) {
   437         // Special keys
   438         switch (scancode) {
   439         case Qt::Key_Escape:
   440             scancode = SDLK_ESCAPE;
   441             break;
   442         case Qt::Key_Tab:
   443             scancode = SDLK_TAB;
   444             break;
   445         case Qt::Key_Backspace:
   446             scancode = SDLK_BACKSPACE;
   447             break;
   448         case Qt::Key_Return:
   449             scancode = SDLK_RETURN;
   450             break;
   451         case Qt::Key_Enter:
   452             scancode = SDLK_KP_ENTER;
   453             break;
   454         case Qt::Key_Insert:
   455             scancode = SDLK_INSERT;
   456             break;
   457         case Qt::Key_Delete:
   458             scancode = SDLK_DELETE;
   459             break;
   460         case Qt::Key_Pause:
   461             scancode = SDLK_PAUSE;
   462             break;
   463         case Qt::Key_Print:
   464             scancode = SDLK_PRINT;
   465             break;
   466         case Qt::Key_SysReq:
   467             scancode = SDLK_SYSREQ;
   468             break;
   469         case Qt::Key_Home:
   470             scancode = SDLK_HOME;
   471             break;
   472         case Qt::Key_End:
   473             scancode = SDLK_END;
   474             break;
   475             // We want the control keys to rotate with the screen
   476         case Qt::Key_Left:
   477             if (screenRotation == SDL_QT_ROTATION_90)
   478                 scancode = SDLK_UP;
   479             else if (screenRotation == SDL_QT_ROTATION_270)
   480                 scancode = SDLK_DOWN;
   481             else
   482                 scancode = SDLK_LEFT;
   483             break;
   484         case Qt::Key_Up:
   485             if (screenRotation == SDL_QT_ROTATION_90)
   486                 scancode = SDLK_RIGHT;
   487             else if (screenRotation == SDL_QT_ROTATION_270)
   488                 scancode = SDLK_LEFT;
   489             else
   490                 scancode = SDLK_UP;
   491             break;
   492         case Qt::Key_Right:
   493             if (screenRotation == SDL_QT_ROTATION_90)
   494                 scancode = SDLK_DOWN;
   495             else if (screenRotation == SDL_QT_ROTATION_270)
   496                 scancode = SDLK_UP;
   497             else
   498                 scancode = SDLK_RIGHT;
   499             break;
   500         case Qt::Key_Down:
   501             if (screenRotation == SDL_QT_ROTATION_90)
   502                 scancode = SDLK_LEFT;
   503             else if (screenRotation == SDL_QT_ROTATION_270)
   504                 scancode = SDLK_RIGHT;
   505             else
   506                 scancode = SDLK_DOWN;
   507             break;
   508         case Qt::Key_Prior:
   509             scancode = SDLK_PAGEUP;
   510             break;
   511         case Qt::Key_Next:
   512             scancode = SDLK_PAGEDOWN;
   513             break;
   514         case Qt::Key_Shift:
   515             scancode = SDLK_LSHIFT;
   516             break;
   517         case Qt::Key_Control:
   518             scancode = SDLK_LCTRL;
   519             break;
   520         case Qt::Key_Meta:
   521             scancode = SDLK_LMETA;
   522             break;
   523         case Qt::Key_Alt:
   524             scancode = SDLK_LALT;
   525             break;
   526         case Qt::Key_CapsLock:
   527             scancode = SDLK_CAPSLOCK;
   528             break;
   529         case Qt::Key_NumLock:
   530             scancode = SDLK_NUMLOCK;
   531             break;
   532         case Qt::Key_ScrollLock:
   533             scancode = SDLK_SCROLLOCK;
   534             break;
   535         case Qt::Key_F1:
   536             scancode = SDLK_F1;
   537             break;
   538         case Qt::Key_F2:
   539             scancode = SDLK_F2;
   540             break;
   541         case Qt::Key_F3:
   542             scancode = SDLK_F3;
   543             break;
   544         case Qt::Key_F4:
   545             scancode = SDLK_F4;
   546             break;
   547         case Qt::Key_F5:
   548             scancode = SDLK_F5;
   549             break;
   550         case Qt::Key_F6:
   551             scancode = SDLK_F6;
   552             break;
   553         case Qt::Key_F7:
   554             scancode = SDLK_F7;
   555             break;
   556         case Qt::Key_F8:
   557             scancode = SDLK_F8;
   558             break;
   559         case Qt::Key_F9:
   560             scancode = SDLK_F9;
   561             break;
   562         case Qt::Key_F10:
   563             scancode = SDLK_F10;
   564             break;
   565         case Qt::Key_F11:
   566             scancode = SDLK_F11;
   567             break;
   568         case Qt::Key_F12:
   569             scancode = SDLK_F12;
   570             break;
   571         case Qt::Key_F13:
   572             scancode = SDLK_F13;
   573             break;
   574         case Qt::Key_F14:
   575             scancode = SDLK_F14;
   576             break;
   577         case Qt::Key_F15:
   578             scancode = SDLK_F15;
   579             break;
   580         case Qt::Key_Super_L:
   581             scancode = SDLK_LSUPER;
   582             break;
   583         case Qt::Key_Super_R:
   584             scancode = SDLK_RSUPER;
   585             break;
   586         case Qt::Key_Menu:
   587             scancode = SDLK_MENU;
   588             break;
   589         case Qt::Key_Help:
   590             scancode = SDLK_HELP;
   591             break;
   592 
   593         case Qt::Key_F33:
   594             // FIXME: This is a hack to enable the OK key on
   595             // Zaurii devices. SDLK_RETURN is a suitable key to use
   596             // since it often is used as such.
   597             //     david@hedbor.org
   598             scancode = SDLK_RETURN;
   599             break;
   600         default:
   601             scancode = SDLK_UNKNOWN;
   602             break;
   603         }
   604         keysym.sym = static_cast < SDLKey > (scancode);
   605     } else {
   606         keysym.sym = static_cast < SDLKey > (scancode);
   607     }
   608     keysym.scancode = scancode;
   609     keysym.mod = KMOD_NONE;
   610     ButtonState st = e->state ();
   611     if ((st & ShiftButton)) {
   612         keysym.mod = static_cast < SDLMod > (keysym.mod | KMOD_LSHIFT);
   613     }
   614     if ((st & ControlButton)) {
   615         keysym.mod = static_cast < SDLMod > (keysym.mod | KMOD_LCTRL);
   616     }
   617     if ((st & AltButton)) {
   618         keysym.mod = static_cast < SDLMod > (keysym.mod | KMOD_LALT);
   619     }
   620     if (SDL_TranslateUNICODE) {
   621         QChar qchar = e->text ()[0];
   622         keysym.unicode = qchar.unicode ();
   623     } else {
   624         keysym.unicode = 0;
   625     }
   626 
   627     /* NUMLOCK and CAPSLOCK are implemented as double-presses in reality */
   628     //    if ( (keysym.sym == SDLK_NUMLOCK) || (keysym.sym == SDLK_CAPSLOCK) ) {
   629     //            pressed = 1;
   630     //    }
   631 
   632     /* Queue the key event */
   633     if (pressed) {
   634         SDL_PrivateKeyboard (SDL_PRESSED, &keysym);
   635     } else {
   636         SDL_PrivateKeyboard (SDL_RELEASED, &keysym);
   637     }
   638 }
   639 
   640 void
   641 SDL_QWin::setFullscreen (bool fs_on)
   642 {
   643     my_has_fullscreen = false;
   644     enableFullscreen ();
   645 }
   646 
   647 void
   648 SDL_QWin::enableFullscreen ()
   649 {
   650     // Make sure size is correct
   651     if (!my_has_fullscreen) {
   652         setFixedSize (qApp->desktop ()->size ());
   653         // This call is needed because showFullScreen won't work
   654         // correctly if the widget already considers itself to be fullscreen.
   655         showNormal ();
   656         // This is needed because showNormal() forcefully changes the window
   657         // style to WSTyle_TopLevel.
   658         setWFlags (WStyle_Customize | WStyle_NoBorder);
   659         // Enable fullscreen.
   660         showFullScreen ();
   661         my_has_fullscreen = true;
   662     }
   663 }
   664 
   665 bool
   666 SDL_QWin::lockScreen (bool force)
   667 {
   668     if (!my_painter) {
   669         if (force || (isVisible () && isActiveWindow ())) {
   670             my_painter = new QDirectPainter (this);
   671         } else {
   672             return false;
   673         }
   674     }
   675     my_locked++;                // Increate lock refcount
   676     return true;
   677 }
   678 
   679 void
   680 SDL_QWin::unlockScreen ()
   681 {
   682     if (my_locked > 0) {
   683         my_locked--;            // decrease lock refcount;
   684     }
   685     if (!my_locked && my_painter) {
   686         my_painter->end ();
   687         delete my_painter;
   688         my_painter = 0;
   689     }
   690 }
   691 
   692 /* vi: set ts=4 sw=4 expandtab: */