summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure4
-rw-r--r--examples/examples.pro1
-rw-r--r--examples/opengl/hellowindow/hellowindow.cpp268
-rw-r--r--examples/opengl/hellowindow/hellowindow.h40
-rw-r--r--examples/opengl/hellowindow/hellowindow.pro14
-rw-r--r--examples/opengl/hellowindow/main.cpp13
-rw-r--r--examples/opengl/opengl.pro4
-rw-r--r--examples/qpa/qpa.pro8
-rw-r--r--examples/qpa/windows/main.cpp19
-rw-r--r--examples/qpa/windows/window.cpp131
-rw-r--r--examples/qpa/windows/window.h25
-rw-r--r--examples/qpa/windows/windows.pro12
-rw-r--r--mkspecs/qws/freebsd-generic-g++/qmake.conf85
-rw-r--r--mkspecs/qws/freebsd-generic-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-arm-g++/qmake.conf21
-rw-r--r--mkspecs/qws/linux-arm-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf21
-rw-r--r--mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-armv6-g++/qmake.conf23
-rw-r--r--mkspecs/qws/linux-armv6-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-avr32-g++/qmake.conf21
-rw-r--r--mkspecs/qws/linux-avr32-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-cellon-g++/qmake.conf30
-rw-r--r--mkspecs/qws/linux-cellon-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-dm7000-g++/qmake.conf27
-rw-r--r--mkspecs/qws/linux-dm7000-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-dm800-g++/qmake.conf25
-rw-r--r--mkspecs/qws/linux-dm800-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-generic-g++-32/qmake.conf15
-rw-r--r--mkspecs/qws/linux-generic-g++-32/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-generic-g++/qmake.conf10
-rw-r--r--mkspecs/qws/linux-generic-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-ipaq-g++/qmake.conf22
-rw-r--r--mkspecs/qws/linux-ipaq-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-lsb-g++/qmake.conf24
-rw-r--r--mkspecs/qws/linux-lsb-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-mips-g++/qmake.conf23
-rw-r--r--mkspecs/qws/linux-mips-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-nacl-g++/qmake.conf29
-rw-r--r--mkspecs/qws/linux-nacl-g++/qplatformdefs.h69
-rw-r--r--mkspecs/qws/linux-powerpc-g++/qmake.conf21
-rw-r--r--mkspecs/qws/linux-powerpc-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-sh-g++/qmake.conf21
-rw-r--r--mkspecs/qws/linux-sh-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-sh4al-g++/qmake.conf24
-rw-r--r--mkspecs/qws/linux-sh4al-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-sharp-g++/qmake.conf24
-rw-r--r--mkspecs/qws/linux-sharp-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-x86-g++/qmake.conf10
-rw-r--r--mkspecs/qws/linux-x86-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-x86_64-g++/qmake.conf15
-rw-r--r--mkspecs/qws/linux-x86_64-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/linux-zylonite-g++/qmake.conf26
-rw-r--r--mkspecs/qws/linux-zylonite-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/macx-generic-g++/qmake.conf90
-rw-r--r--mkspecs/qws/macx-generic-g++/qplatformdefs.h42
-rw-r--r--mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib18
-rw-r--r--mkspecs/qws/macx-iphonedevice-g++/qmake.conf48
-rw-r--r--mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h99
-rw-r--r--mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib18
-rw-r--r--mkspecs/qws/macx-iphonesimulator-g++/qmake.conf49
-rw-r--r--mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h99
-rw-r--r--mkspecs/qws/macx-nacl-g++/qmake.conf29
-rw-r--r--mkspecs/qws/macx-nacl-g++/qplatformdefs.h68
-rw-r--r--mkspecs/qws/solaris-generic-g++/qmake.conf89
-rw-r--r--mkspecs/qws/solaris-generic-g++/qplatformdefs.h42
-rw-r--r--src/corelib/global/qnamespace.h68
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp18
-rw-r--r--src/corelib/kernel/qcoreapplication.h14
-rw-r--r--src/corelib/kernel/qobject.cpp1
-rw-r--r--src/corelib/kernel/qobject.h4
-rw-r--r--src/gui/accessible/accessible.pri2
-rw-r--r--src/gui/accessible/qaccessible.h3
-rw-r--r--src/gui/dialogs/dialogs.pri20
-rw-r--r--src/gui/dialogs/qprintdialog_qws.cpp567
-rw-r--r--src/gui/dialogs/qprintdialog_unix.cpp39
-rw-r--r--src/gui/egl/egl.pri22
-rw-r--r--src/gui/egl/qegl_qpa.cpp3
-rw-r--r--src/gui/egl/qegl_qws.cpp114
-rw-r--r--src/gui/embedded/directfb.pri40
-rw-r--r--src/gui/embedded/embedded.pri226
-rw-r--r--src/gui/embedded/qcopchannel_qws.cpp608
-rw-r--r--src/gui/embedded/qcopchannel_qws.h108
-rw-r--r--src/gui/embedded/qdecoration_qws.cpp404
-rw-r--r--src/gui/embedded/qdecoration_qws.h124
-rw-r--r--src/gui/embedded/qdecorationdefault_qws.cpp803
-rw-r--r--src/gui/embedded/qdecorationdefault_qws.h101
-rw-r--r--src/gui/embedded/qdecorationfactory_qws.cpp156
-rw-r--r--src/gui/embedded/qdecorationfactory_qws.h66
-rw-r--r--src/gui/embedded/qdecorationplugin_qws.cpp116
-rw-r--r--src/gui/embedded/qdecorationplugin_qws.h80
-rw-r--r--src/gui/embedded/qdecorationstyled_qws.cpp313
-rw-r--r--src/gui/embedded/qdecorationwindows_qws.cpp407
-rw-r--r--src/gui/embedded/qdecorationwindows_qws.h77
-rw-r--r--src/gui/embedded/qdirectpainter_qws.cpp682
-rw-r--r--src/gui/embedded/qdirectpainter_qws.h112
-rw-r--r--src/gui/embedded/qkbd_defaultmap_qws_p.h806
-rw-r--r--src/gui/embedded/qkbd_qws.cpp693
-rw-r--r--src/gui/embedded/qkbd_qws.h103
-rw-r--r--src/gui/embedded/qkbd_qws_p.h134
-rw-r--r--src/gui/embedded/qkbddriverfactory_qws.cpp187
-rw-r--r--src/gui/embedded/qkbddriverfactory_qws.h70
-rw-r--r--src/gui/embedded/qkbddriverplugin_qws.cpp124
-rw-r--r--src/gui/embedded/qkbddriverplugin_qws.h84
-rw-r--r--src/gui/embedded/qkbdintegrity_qws.cpp197
-rw-r--r--src/gui/embedded/qkbdintegrity_qws.h81
-rw-r--r--src/gui/embedded/qkbdlinuxinput_qws.cpp245
-rw-r--r--src/gui/embedded/qkbdlinuxinput_qws.h79
-rw-r--r--src/gui/embedded/qkbdqnx_qws.cpp236
-rw-r--r--src/gui/embedded/qkbdqnx_qws.h76
-rw-r--r--src/gui/embedded/qkbdtty_qws.cpp353
-rw-r--r--src/gui/embedded/qkbdtty_qws.h79
-rw-r--r--src/gui/embedded/qkbdum_qws.cpp144
-rw-r--r--src/gui/embedded/qkbdum_qws.h77
-rw-r--r--src/gui/embedded/qkbdvfb_qws.cpp124
-rw-r--r--src/gui/embedded/qkbdvfb_qws.h86
-rw-r--r--src/gui/embedded/qlock.cpp325
-rw-r--r--src/gui/embedded/qlock_p.h100
-rw-r--r--src/gui/embedded/qmouse_qws.cpp653
-rw-r--r--src/gui/embedded/qmouse_qws.h123
-rw-r--r--src/gui/embedded/qmousedriverfactory_qws.cpp197
-rw-r--r--src/gui/embedded/qmousedriverfactory_qws.h67
-rw-r--r--src/gui/embedded/qmousedriverplugin_qws.cpp124
-rw-r--r--src/gui/embedded/qmousedriverplugin_qws.h84
-rw-r--r--src/gui/embedded/qmouseintegrity_qws.cpp271
-rw-r--r--src/gui/embedded/qmouseintegrity_qws.h82
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.cpp205
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.h78
-rw-r--r--src/gui/embedded/qmouselinuxtp_qws.cpp335
-rw-r--r--src/gui/embedded/qmouselinuxtp_qws.h77
-rw-r--r--src/gui/embedded/qmousepc_qws.cpp794
-rw-r--r--src/gui/embedded/qmousepc_qws.h76
-rw-r--r--src/gui/embedded/qmouseqnx_qws.cpp190
-rw-r--r--src/gui/embedded/qmouseqnx_qws.h79
-rw-r--r--src/gui/embedded/qmousetslib_qws.cpp371
-rw-r--r--src/gui/embedded/qmousetslib_qws.h80
-rw-r--r--src/gui/embedded/qmousevfb_qws.cpp133
-rw-r--r--src/gui/embedded/qmousevfb_qws.h83
-rw-r--r--src/gui/embedded/qscreen_qws.cpp3347
-rw-r--r--src/gui/embedded/qscreen_qws.h391
-rw-r--r--src/gui/embedded/qscreendriverfactory_qws.cpp204
-rw-r--r--src/gui/embedded/qscreendriverfactory_qws.h67
-rw-r--r--src/gui/embedded/qscreendriverplugin_qws.cpp123
-rw-r--r--src/gui/embedded/qscreendriverplugin_qws.h84
-rw-r--r--src/gui/embedded/qscreenintegrityfb_qws.cpp405
-rw-r--r--src/gui/embedded/qscreenintegrityfb_qws.h83
-rw-r--r--src/gui/embedded/qscreenlinuxfb_qws.cpp1386
-rw-r--r--src/gui/embedded/qscreenlinuxfb_qws.h135
-rw-r--r--src/gui/embedded/qscreenmulti_qws.cpp486
-rw-r--r--src/gui/embedded/qscreenmulti_qws_p.h114
-rw-r--r--src/gui/embedded/qscreenproxy_qws.cpp635
-rw-r--r--src/gui/embedded/qscreenproxy_qws.h153
-rw-r--r--src/gui/embedded/qscreenqnx_qws.cpp450
-rw-r--r--src/gui/embedded/qscreenqnx_qws.h82
-rw-r--r--src/gui/embedded/qscreentransformed_qws.cpp748
-rw-r--r--src/gui/embedded/qscreentransformed_qws.h103
-rw-r--r--src/gui/embedded/qscreenvfb_qws.cpp445
-rw-r--r--src/gui/embedded/qscreenvfb_qws.h86
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp1530
-rw-r--r--src/gui/embedded/qsoundqss_qws.h177
-rw-r--r--src/gui/embedded/qtransportauth_qws.cpp1563
-rw-r--r--src/gui/embedded/qtransportauth_qws.h281
-rw-r--r--src/gui/embedded/qtransportauth_qws_p.h189
-rw-r--r--src/gui/embedded/qtransportauthdefs_qws.h174
-rw-r--r--src/gui/embedded/qunixsocket.cpp1800
-rw-r--r--src/gui/embedded/qunixsocket_p.h202
-rw-r--r--src/gui/embedded/qunixsocketserver.cpp376
-rw-r--r--src/gui/embedded/qunixsocketserver_p.h98
-rw-r--r--src/gui/embedded/qvfbhdr.h119
-rw-r--r--src/gui/embedded/qwindowsystem_p.h315
-rw-r--r--src/gui/embedded/qwindowsystem_qws.cpp4960
-rw-r--r--src/gui/embedded/qwindowsystem_qws.h508
-rw-r--r--src/gui/embedded/qwscommand_qws.cpp609
-rw-r--r--src/gui/embedded/qwscommand_qws_p.h851
-rw-r--r--src/gui/embedded/qwscursor_qws.cpp654
-rw-r--r--src/gui/embedded/qwscursor_qws.h83
-rw-r--r--src/gui/embedded/qwsdisplay_qws.h185
-rw-r--r--src/gui/embedded/qwsdisplay_qws_p.h161
-rw-r--r--src/gui/embedded/qwsembedwidget.cpp227
-rw-r--r--src/gui/embedded/qwsevent_qws.cpp216
-rw-r--r--src/gui/embedded/qwsevent_qws.h459
-rw-r--r--src/gui/embedded/qwslock.cpp236
-rw-r--r--src/gui/embedded/qwslock_p.h85
-rw-r--r--src/gui/embedded/qwsmanager_p.h122
-rw-r--r--src/gui/embedded/qwsmanager_qws.cpp537
-rw-r--r--src/gui/embedded/qwsmanager_qws.h122
-rw-r--r--src/gui/embedded/qwsproperty_qws.cpp145
-rw-r--r--src/gui/embedded/qwsproperty_qws.h96
-rw-r--r--src/gui/embedded/qwsprotocolitem_qws.h100
-rw-r--r--src/gui/embedded/qwssharedmemory.cpp185
-rw-r--r--src/gui/embedded/qwssharedmemory_p.h105
-rw-r--r--src/gui/embedded/qwssignalhandler.cpp128
-rw-r--r--src/gui/embedded/qwssignalhandler_p.h99
-rw-r--r--src/gui/embedded/qwssocket_qws.cpp280
-rw-r--r--src/gui/embedded/qwssocket_qws.h120
-rw-r--r--src/gui/embedded/qwsutils_qws.h98
-rw-r--r--src/gui/gui.pro4
-rw-r--r--src/gui/image/image.pri3
-rw-r--r--src/gui/image/qbitmap.cpp94
-rw-r--r--src/gui/image/qbitmap.h23
-rw-r--r--src/gui/image/qicon.cpp157
-rw-r--r--src/gui/image/qicon.h19
-rw-r--r--src/gui/image/qiconloader.cpp9
-rw-r--r--src/gui/image/qimage.cpp553
-rw-r--r--src/gui/image/qimage.h49
-rw-r--r--src/gui/image/qimage_p.h3
-rw-r--r--src/gui/image/qmovie.h20
-rw-r--r--src/gui/image/qnativeimage.cpp110
-rw-r--r--src/gui/image/qnativeimage_p.h12
-rw-r--r--src/gui/image/qpicture.cpp2
-rw-r--r--src/gui/image/qpicture.h3
-rw-r--r--src/gui/image/qpixmap.cpp252
-rw-r--r--src/gui/image/qpixmap.h36
-rw-r--r--src/gui/image/qpixmap_blitter.cpp5
-rw-r--r--src/gui/image/qpixmap_qpa.cpp5
-rw-r--r--src/gui/image/qpixmap_qws.cpp160
-rw-r--r--src/gui/image/qpixmapdata.cpp17
-rw-r--r--src/gui/image/qpixmapdatafactory.cpp21
-rw-r--r--src/gui/image/qpixmapfilter.cpp3
-rw-r--r--src/gui/inputmethod/inputmethod.pri6
-rw-r--r--src/gui/inputmethod/qwsinputcontext_p.h97
-rw-r--r--src/gui/inputmethod/qwsinputcontext_qws.cpp246
-rw-r--r--src/gui/kernel/kernel.pri69
-rw-r--r--src/gui/kernel/mac.pri2
-rw-r--r--src/gui/kernel/qapplication.cpp277
-rw-r--r--src/gui/kernel/qapplication.h26
-rw-r--r--src/gui/kernel/qapplication_p.h64
-rw-r--r--src/gui/kernel/qapplication_qpa.cpp546
-rw-r--r--src/gui/kernel/qapplication_qws.cpp3797
-rw-r--r--src/gui/kernel/qclipboard.h1
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp6
-rw-r--r--src/gui/kernel/qclipboard_qws.cpp304
-rw-r--r--src/gui/kernel/qcursor.h12
-rw-r--r--src/gui/kernel/qcursor_qws.cpp138
-rw-r--r--src/gui/kernel/qdesktopwidget_qpa.cpp14
-rw-r--r--src/gui/kernel/qdesktopwidget_qws.cpp159
-rw-r--r--src/gui/kernel/qdnd_qpa.cpp (renamed from src/gui/kernel/qdnd_qws.cpp)0
-rw-r--r--src/gui/kernel/qdnd_x11.cpp4
-rw-r--r--src/gui/kernel/qevent.cpp232
-rw-r--r--src/gui/kernel/qevent.h77
-rw-r--r--src/gui/kernel/qeventdispatcher_glib_qpa.cpp4
-rw-r--r--src/gui/kernel/qeventdispatcher_glib_qws.cpp195
-rw-r--r--src/gui/kernel/qeventdispatcher_glib_qws_p.h78
-rw-r--r--src/gui/kernel/qeventdispatcher_qpa.cpp6
-rw-r--r--src/gui/kernel/qeventdispatcher_qws.cpp168
-rw-r--r--src/gui/kernel/qeventdispatcher_qws_p.h86
-rw-r--r--src/gui/kernel/qguiapplication.cpp925
-rw-r--r--src/gui/kernel/qguiapplication.h132
-rw-r--r--src/gui/kernel/qguiapplication_p.h149
-rw-r--r--src/gui/kernel/qguivariant.cpp28
-rw-r--r--src/gui/kernel/qhexstring_p.h (renamed from src/gui/painting/qgraphicssystemplugin_p.h)64
-rw-r--r--src/gui/kernel/qkeymapper_qpa.cpp (renamed from src/gui/kernel/qkeymapper_qws.cpp)0
-rw-r--r--src/gui/kernel/qkeysequence.h3
-rw-r--r--src/gui/kernel/qpalette.cpp315
-rw-r--r--src/gui/kernel/qpalette.h73
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h2
-rw-r--r--src/gui/kernel/qplatformglcontext_qpa.cpp128
-rw-r--r--src/gui/kernel/qplatformglcontext_qpa.h35
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h7
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.h4
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp14
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h3
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp27
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h7
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.cpp1008
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.h234
-rw-r--r--src/gui/kernel/qsessionmanager_qpa.cpp1
-rw-r--r--src/gui/kernel/qsessionmanager_qws.cpp171
-rw-r--r--src/gui/kernel/qsound.cpp23
-rw-r--r--src/gui/kernel/qsound.h5
-rw-r--r--src/gui/kernel/qsound_qws.cpp350
-rw-r--r--src/gui/kernel/qwidget.cpp88
-rw-r--r--src/gui/kernel/qwidget.h19
-rw-r--r--src/gui/kernel/qwidget_p.h5
-rw-r--r--src/gui/kernel/qwidget_qpa.cpp163
-rw-r--r--src/gui/kernel/qwidget_qws.cpp1221
-rw-r--r--src/gui/kernel/qwidgetwindow_qpa.cpp154
-rw-r--r--src/gui/kernel/qwidgetwindow_qpa_p.h (renamed from src/gui/embedded/qwsembedwidget.h)38
-rw-r--r--src/gui/kernel/qwindow.cpp458
-rw-r--r--src/gui/kernel/qwindow.h186
-rw-r--r--src/gui/kernel/qwindow_p.h (renamed from src/gui/embedded/qdecorationstyled_qws.h)46
-rw-r--r--src/gui/kernel/qwindowcontext_qpa.cpp201
-rw-r--r--src/gui/kernel/qwindowcontext_qpa.h (renamed from src/opengl/qglwindowsurface_qws_p.h)70
-rw-r--r--src/gui/kernel/qwindowdefs.h3
-rw-r--r--src/gui/kernel/qwindowformat_qpa.cpp406
-rw-r--r--src/gui/kernel/qwindowformat_qpa.h155
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp69
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h32
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h38
-rw-r--r--src/gui/painting/painting.pri71
-rw-r--r--src/gui/painting/qbackingstore.cpp7
-rw-r--r--src/gui/painting/qbrush.cpp32
-rw-r--r--src/gui/painting/qbrush.h10
-rw-r--r--src/gui/painting/qcolor.cpp24
-rw-r--r--src/gui/painting/qcolor.h21
-rw-r--r--src/gui/painting/qcolormap_qpa.cpp5
-rw-r--r--src/gui/painting/qcolormap_qws.cpp185
-rw-r--r--src/gui/painting/qdrawhelper.cpp744
-rw-r--r--src/gui/painting/qdrawhelper_p.h144
-rw-r--r--src/gui/painting/qdrawutil.cpp309
-rw-r--r--src/gui/painting/qdrawutil.h20
-rw-r--r--src/gui/painting/qgraphicssystem.cpp97
-rw-r--r--src/gui/painting/qgraphicssystem_mac.cpp59
-rw-r--r--src/gui/painting/qgraphicssystem_mac_p.h69
-rw-r--r--src/gui/painting/qgraphicssystem_p.h85
-rw-r--r--src/gui/painting/qgraphicssystem_qws.cpp62
-rw-r--r--src/gui/painting/qgraphicssystem_qws_p.h79
-rw-r--r--src/gui/painting/qgraphicssystem_raster.cpp72
-rw-r--r--src/gui/painting/qgraphicssystem_raster_p.h69
-rw-r--r--src/gui/painting/qgraphicssystem_runtime.cpp426
-rw-r--r--src/gui/painting/qgraphicssystem_runtime_p.h187
-rw-r--r--src/gui/painting/qgraphicssystemfactory.cpp123
-rw-r--r--src/gui/painting/qgraphicssystemfactory_p.h78
-rw-r--r--src/gui/painting/qgraphicssystemplugin.cpp56
-rw-r--r--src/gui/painting/qmatrix.cpp36
-rw-r--r--src/gui/painting/qmatrix.h12
-rw-r--r--src/gui/painting/qpaintdevice.cpp14
-rw-r--r--src/gui/painting/qpaintdevice.h47
-rw-r--r--src/gui/painting/qpaintdevice_qws.cpp56
-rw-r--r--src/gui/painting/qpaintdevice_x11.cpp114
-rw-r--r--src/gui/painting/qpaintengine.cpp3
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp1
-rw-r--r--src/gui/painting/qpaintengine_p.h4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp231
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h65
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp594
-rw-r--r--src/gui/painting/qpainter.h76
-rw-r--r--src/gui/painting/qprintengine_ps.cpp972
-rw-r--r--src/gui/painting/qprintengine_ps_p.h137
-rw-r--r--src/gui/painting/qprintengine_qws.cpp886
-rw-r--r--src/gui/painting/qprintengine_qws_p.h213
-rw-r--r--src/gui/painting/qprinter.cpp215
-rw-r--r--src/gui/painting/qprinter.h56
-rw-r--r--src/gui/painting/qregion.cpp11
-rw-r--r--src/gui/painting/qregion.h6
-rw-r--r--src/gui/painting/qregion_qws.cpp3183
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac.cpp264
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac_p.h107
-rw-r--r--src/gui/painting/qwindowsurface.cpp101
-rw-r--r--src/gui/painting/qwindowsurface_mac.cpp139
-rw-r--r--src/gui/painting/qwindowsurface_mac_p.h84
-rw-r--r--src/gui/painting/qwindowsurface_p.h25
-rw-r--r--src/gui/painting/qwindowsurface_qws.cpp1433
-rw-r--r--src/gui/painting/qwindowsurface_qws_p.h355
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp487
-rw-r--r--src/gui/painting/qwindowsurface_raster_p.h132
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp254
-rw-r--r--src/gui/painting/qwindowsurface_s60_p.h93
-rw-r--r--src/gui/painting/qwindowsurface_x11.cpp265
-rw-r--r--src/gui/painting/qwindowsurface_x11_p.h92
-rw-r--r--src/gui/painting/qwmatrix.h61
-rw-r--r--src/gui/statemachine/qguistatemachine.cpp23
-rw-r--r--src/gui/styles/qstyle.cpp38
-rw-r--r--src/gui/styles/qstylehelper_p.h33
-rw-r--r--src/gui/styles/styles.pri2
-rw-r--r--src/gui/text/qabstractfontengine_qws.cpp776
-rw-r--r--src/gui/text/qabstractfontengine_qws.h221
-rw-r--r--src/gui/text/qfont.cpp71
-rw-r--r--src/gui/text/qfont.h8
-rw-r--r--src/gui/text/qfont_qpa.cpp6
-rw-r--r--src/gui/text/qfont_qws.cpp135
-rw-r--r--src/gui/text/qfontdatabase.cpp48
-rw-r--r--src/gui/text/qfontdatabase.h4
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp29
-rw-r--r--src/gui/text/qfontdatabase_qws.cpp975
-rw-r--r--src/gui/text/qfontengine_qpa.cpp1
-rw-r--r--src/gui/text/qfontengine_qws.cpp665
-rw-r--r--src/gui/text/qfontmetrics.h9
-rw-r--r--src/gui/text/qstatictext.cpp2
-rw-r--r--src/gui/text/qtextcontrol_p.h5
-rw-r--r--src/gui/text/qtextdocument.cpp1
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp4
-rw-r--r--src/gui/text/qtextengine.cpp4
-rw-r--r--src/gui/text/qtexthtmlparser.cpp2
-rw-r--r--src/gui/text/qtextimagehandler.cpp6
-rw-r--r--src/gui/text/qtextlayout.cpp2
-rw-r--r--src/gui/text/qtextoption.cpp4
-rw-r--r--src/gui/text/text.pri20
-rw-r--r--src/gui/util/qdesktopservices.cpp2
-rw-r--r--src/gui/util/qdesktopservices_qpa.cpp (renamed from src/gui/util/qdesktopservices_qws.cpp)0
-rw-r--r--src/gui/util/qsystemtrayicon_qpa.cpp (renamed from src/gui/util/qsystemtrayicon_qws.cpp)0
-rw-r--r--src/gui/util/util.pri6
-rw-r--r--src/gui/widgets/widgets.pri2
-rw-r--r--src/opengl/opengl.pro23
-rw-r--r--src/opengl/qgl.cpp8
-rw-r--r--src/opengl/qgl.h10
-rw-r--r--src/opengl/qgl_p.h4
-rw-r--r--src/opengl/qgl_qpa.cpp136
-rw-r--r--src/opengl/qgl_qws.cpp318
-rw-r--r--src/opengl/qglpixmapfilter.cpp1
-rw-r--r--src/opengl/qglscreen_qws.cpp242
-rw-r--r--src/opengl/qglscreen_qws.h127
-rw-r--r--src/opengl/qglwindowsurface_qws.cpp133
-rw-r--r--src/opengl/qgraphicssystem_gl.cpp114
-rw-r--r--src/opengl/qgraphicssystem_gl_p.h80
-rw-r--r--src/opengl/qwindowsurface_gl.cpp159
-rw-r--r--src/opengl/qwindowsurface_gl_p.h10
-rw-r--r--src/plugins/decorations/decorations.pro4
-rw-r--r--src/plugins/decorations/default/default.pro10
-rw-r--r--src/plugins/decorations/default/main.cpp76
-rw-r--r--src/plugins/decorations/styled/main.cpp77
-rw-r--r--src/plugins/decorations/styled/styled.pro13
-rw-r--r--src/plugins/decorations/windows/main.cpp76
-rw-r--r--src/plugins/decorations/windows/windows.pro10
-rw-r--r--src/plugins/gfxdrivers/ahi/ahi.pro14
-rw-r--r--src/plugins/gfxdrivers/ahi/qscreenahi_qws.cpp598
-rw-r--r--src/plugins/gfxdrivers/ahi/qscreenahi_qws.h84
-rw-r--r--src/plugins/gfxdrivers/ahi/qscreenahiplugin.cpp74
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro15
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp436
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h74
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp294
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.h75
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp221
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h108
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp1430
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h123
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp588
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h105
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp1819
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h303
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp78
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp506
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h129
-rw-r--r--src/plugins/gfxdrivers/eglnullws/README48
-rw-r--r--src/plugins/gfxdrivers/eglnullws/eglnullws.pro18
-rw-r--r--src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp181
-rw-r--r--src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h69
-rw-r--r--src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp66
-rw-r--r--src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h47
-rw-r--r--src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp84
-rw-r--r--src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h63
-rw-r--r--src/plugins/gfxdrivers/gfxdrivers.pro10
-rw-r--r--src/plugins/gfxdrivers/linuxfb/linuxfb.pro14
-rw-r--r--src/plugins/gfxdrivers/linuxfb/main.cpp79
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro26
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c830
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h169
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h132
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c402
-rw-r--r--src/plugins/gfxdrivers/powervr/README66
-rw-r--r--src/plugins/gfxdrivers/powervr/powervr.pri2
-rw-r--r--src/plugins/gfxdrivers/powervr/powervr.pro3
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp351
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h99
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro27
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreenplugin.cpp74
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp273
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h85
-rw-r--r--src/plugins/gfxdrivers/qvfb/main.cpp82
-rw-r--r--src/plugins/gfxdrivers/qvfb/qvfb.pro19
-rw-r--r--src/plugins/gfxdrivers/transformed/main.cpp84
-rw-r--r--src/plugins/gfxdrivers/transformed/transformed.pro13
-rw-r--r--src/plugins/gfxdrivers/vnc/main.cpp86
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_p.h524
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp2338
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h88
-rw-r--r--src/plugins/gfxdrivers/vnc/vnc.pro16
-rw-r--r--src/plugins/graphicssystems/graphicssystems.pro15
-rw-r--r--src/plugins/graphicssystems/meego/dithering.cpp266
-rw-r--r--src/plugins/graphicssystems/meego/meego.pro13
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.cpp213
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.h125
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp534
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h127
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp58
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h54
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp323
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h78
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp224
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.h74
-rw-r--r--src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.cpp60
-rw-r--r--src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.h55
-rw-r--r--src/plugins/graphicssystems/opengl/main.cpp95
-rw-r--r--src/plugins/graphicssystems/opengl/opengl.pro13
-rw-r--r--src/plugins/graphicssystems/openvg/main.cpp71
-rw-r--r--src/plugins/graphicssystems/openvg/openvg.pro14
-rw-r--r--src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp88
-rw-r--r--src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h73
-rw-r--r--src/plugins/graphicssystems/shivavg/README8
-rw-r--r--src/plugins/graphicssystems/shivavg/main.cpp71
-rw-r--r--src/plugins/graphicssystems/shivavg/shivavg.pro12
-rw-r--r--src/plugins/graphicssystems/shivavg/shivavggraphicssystem.cpp62
-rw-r--r--src/plugins/graphicssystems/shivavg/shivavggraphicssystem.h60
-rw-r--r--src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp358
-rw-r--r--src/plugins/graphicssystems/shivavg/shivavgwindowsurface.h76
-rw-r--r--src/plugins/graphicssystems/trace/main.cpp69
-rw-r--r--src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp153
-rw-r--r--src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h71
-rw-r--r--src/plugins/graphicssystems/trace/trace.pro13
-rw-r--r--src/plugins/kbddrivers/kbddrivers.pro2
-rw-r--r--src/plugins/kbddrivers/linuxinput/linuxinput.pro14
-rw-r--r--src/plugins/kbddrivers/linuxinput/main.cpp77
-rw-r--r--src/plugins/mousedrivers/linuxtp/linuxtp.pro14
-rw-r--r--src/plugins/mousedrivers/linuxtp/main.cpp76
-rw-r--r--src/plugins/mousedrivers/mousedrivers.pro5
-rw-r--r--src/plugins/mousedrivers/pc/main.cpp81
-rw-r--r--src/plugins/mousedrivers/pc/pc.pro14
-rw-r--r--src/plugins/mousedrivers/tslib/main.cpp77
-rw-r--r--src/plugins/mousedrivers/tslib/tslib.pro16
-rw-r--r--src/plugins/platforms/eglconvenience/qeglconvenience.cpp46
-rw-r--r--src/plugins/platforms/eglconvenience/qeglconvenience.h8
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp6
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.h4
-rw-r--r--src/plugins/platforms/glxconvenience/qglxconvenience.cpp99
-rw-r--r--src/plugins/platforms/glxconvenience/qglxconvenience.h12
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp10
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.h4
-rw-r--r--src/plugins/platforms/minimal/qminimalwindowsurface.cpp6
-rw-r--r--src/plugins/platforms/minimal/qminimalwindowsurface.h5
-rw-r--r--src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp18
-rw-r--r--src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp6
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h1
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h3
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp3
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp6
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h4
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h2
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp1
-rw-r--r--src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h4
-rw-r--r--src/plugins/platforms/wayland/qwaylandcursor.cpp4
-rw-r--r--src/plugins/platforms/wayland/qwaylandcursor.h2
-rw-r--r--src/plugins/platforms/wayland/qwaylandinputdevice.cpp12
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.cpp20
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.h4
-rw-r--r--src/plugins/platforms/wayland/qwaylandscreen.cpp4
-rw-r--r--src/plugins/platforms/wayland/qwaylandscreen.h2
-rw-r--r--src/plugins/platforms/wayland/qwaylandshmsurface.cpp16
-rw-r--r--src/plugins/platforms/wayland/qwaylandshmsurface.h6
-rw-r--r--src/plugins/platforms/wayland/qwaylandshmwindow.cpp4
-rw-r--r--src/plugins/platforms/wayland/qwaylandshmwindow.h2
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp8
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.h2
-rw-r--r--src/plugins/platforms/xcb/qdri2context.cpp2
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp15
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h8
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp28
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h10
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp9
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h8
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp61
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h16
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp64
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbwindowsurface.cpp19
-rw-r--r--src/plugins/platforms/xcb/qxcbwindowsurface.h4
-rw-r--r--src/plugins/plugins.pro2
573 files changed, 4563 insertions, 91561 deletions
diff --git a/configure b/configure
index e6956fbda9..0de4ab0667 100755
--- a/configure
+++ b/configure
@@ -185,8 +185,8 @@ fi
#-------------------------------------------------------------------------------
PLATFORM_X11=no
-PLATFORM_QWS=maybe
-PLATFORM_QPA=maybe
+PLATFORM_QWS=no
+PLATFORM_QPA=yes
BUILD_ON_MAC=no
if [ -d /System/Library/Frameworks/Carbon.framework ]; then
PLATFORM_MAC=maybe
diff --git a/examples/examples.pro b/examples/examples.pro
index 0680ff45f6..c070b3cdd4 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -48,6 +48,7 @@ symbian: SUBDIRS = \
SUBDIRS += multimedia
}
+qpa:SUBDIRS += qpa
embedded:SUBDIRS += qws
contains(QT_BUILD_PARTS, tools):!contains(QT_CONFIG, no-gui):SUBDIRS += qtestlib
contains(QT_CONFIG, opengl): SUBDIRS += opengl
diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp
new file mode 100644
index 0000000000..32732f72b6
--- /dev/null
+++ b/examples/opengl/hellowindow/hellowindow.cpp
@@ -0,0 +1,268 @@
+#include "hellowindow.h"
+
+#include <QWindowContext>
+
+#include <QTimer>
+
+#include <qmath.h>
+
+HelloWindow::HelloWindow()
+ : colorIndex(0)
+{
+ setSurfaceType(OpenGLSurface);
+ setWindowTitle(QLatin1String("Hello Window"));
+
+ QWindowFormat format;
+ format.setDepthBufferSize(16);
+ format.setSamples(4);
+
+ setWindowFormat(format);
+
+ setGeometry(QRect(10, 10, 640, 480));
+
+ create();
+
+ initialize();
+
+ QTimer *timer = new QTimer(this);
+ timer->start(10);
+
+ connect(timer, SIGNAL(timeout()), this, SLOT(render()));
+}
+
+void HelloWindow::mousePressEvent(QMouseEvent *)
+{
+ updateColor();
+}
+
+void HelloWindow::resizeEvent(QResizeEvent *)
+{
+ glContext()->makeCurrent();
+
+ glViewport(0, 0, geometry().width(), geometry().height());
+}
+
+void HelloWindow::updateColor()
+{
+ float colors[][4] =
+ {
+ { 0.4, 1.0, 0.0, 0.0 },
+ { 0.0, 0.4, 1.0, 0.0 }
+ };
+
+ glContext()->makeCurrent();
+
+ program.bind();
+ program.setUniformValue(colorUniform, colors[colorIndex][0], colors[colorIndex][1], colors[colorIndex][2], colors[colorIndex][3]);
+ program.release();
+
+ colorIndex++;
+ if (colorIndex >= sizeof(colors) / sizeof(colors[0]))
+ colorIndex = 0;
+}
+
+void HelloWindow::render()
+{
+ if (!glContext())
+ return;
+
+ glContext()->makeCurrent();
+
+ glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glFrontFace(GL_CW);
+ glCullFace(GL_FRONT);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_DEPTH_TEST);
+
+ QMatrix4x4 modelview;
+ modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
+ modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f);
+ modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f);
+ modelview.translate(0.0f, -0.2f, 0.0f);
+
+ program.bind();
+ program.setUniformValue(matrixUniform, modelview);
+ paintQtLogo();
+ program.release();
+
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+
+ glContext()->swapBuffers();
+
+ m_fAngle += 1.0f;
+}
+
+void HelloWindow::paintQtLogo()
+{
+ program.enableAttributeArray(normalAttr);
+ program.enableAttributeArray(vertexAttr);
+ program.setAttributeArray(vertexAttr, vertices.constData());
+ program.setAttributeArray(normalAttr, normals.constData());
+ glDrawArrays(GL_TRIANGLES, 0, vertices.size());
+ program.disableAttributeArray(normalAttr);
+ program.disableAttributeArray(vertexAttr);
+}
+
+void HelloWindow::initialize()
+{
+ glContext()->makeCurrent();
+
+ glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
+
+ QGLShader *vshader = new QGLShader(QGLShader::Vertex, this);
+ const char *vsrc =
+ "attribute highp vec4 vertex;\n"
+ "attribute mediump vec3 normal;\n"
+ "uniform mediump mat4 matrix;\n"
+ "uniform lowp vec4 sourceColor;\n"
+ "varying mediump vec4 color;\n"
+ "void main(void)\n"
+ "{\n"
+ " vec3 toLight = normalize(vec3(0.0, 0.3, 1.0));\n"
+ " float angle = max(dot(normal, toLight), 0.0);\n"
+ " vec3 col = sourceColor.rgb;\n"
+ " color = vec4(col * 0.2 + col * 0.8 * angle, 1.0);\n"
+ " color = clamp(color, 0.0, 1.0);\n"
+ " gl_Position = matrix * vertex;\n"
+ "}\n";
+ vshader->compileSourceCode(vsrc);
+
+ QGLShader *fshader = new QGLShader(QGLShader::Fragment, this);
+ const char *fsrc =
+ "varying mediump vec4 color;\n"
+ "void main(void)\n"
+ "{\n"
+ " gl_FragColor = color;\n"
+ "}\n";
+ fshader->compileSourceCode(fsrc);
+
+ program.addShader(vshader);
+ program.addShader(fshader);
+ program.link();
+
+ vertexAttr = program.attributeLocation("vertex");
+ normalAttr = program.attributeLocation("normal");
+ matrixUniform = program.uniformLocation("matrix");
+ colorUniform = program.uniformLocation("sourceColor");
+
+ m_fAngle = 0;
+ createGeometry();
+ updateColor();
+}
+
+void HelloWindow::createGeometry()
+{
+ vertices.clear();
+ normals.clear();
+
+ qreal x1 = +0.06f;
+ qreal y1 = -0.14f;
+ qreal x2 = +0.14f;
+ qreal y2 = -0.06f;
+ qreal x3 = +0.08f;
+ qreal y3 = +0.00f;
+ qreal x4 = +0.30f;
+ qreal y4 = +0.22f;
+
+ quad(x1, y1, x2, y2, y2, x2, y1, x1);
+ quad(x3, y3, x4, y4, y4, x4, y3, x3);
+
+ extrude(x1, y1, x2, y2);
+ extrude(x2, y2, y2, x2);
+ extrude(y2, x2, y1, x1);
+ extrude(y1, x1, x1, y1);
+ extrude(x3, y3, x4, y4);
+ extrude(x4, y4, y4, x4);
+ extrude(y4, x4, y3, x3);
+
+ const qreal Pi = 3.14159f;
+ const int NumSectors = 100;
+
+ for (int i = 0; i < NumSectors; ++i) {
+ qreal angle1 = (i * 2 * Pi) / NumSectors;
+ qreal x5 = 0.30 * qSin(angle1);
+ qreal y5 = 0.30 * qCos(angle1);
+ qreal x6 = 0.20 * qSin(angle1);
+ qreal y6 = 0.20 * qCos(angle1);
+
+ qreal angle2 = ((i + 1) * 2 * Pi) / NumSectors;
+ qreal x7 = 0.20 * qSin(angle2);
+ qreal y7 = 0.20 * qCos(angle2);
+ qreal x8 = 0.30 * qSin(angle2);
+ qreal y8 = 0.30 * qCos(angle2);
+
+ quad(x5, y5, x6, y6, x7, y7, x8, y8);
+
+ extrude(x6, y6, x7, y7);
+ extrude(x8, y8, x5, y5);
+ }
+
+ for (int i = 0;i < vertices.size();i++)
+ vertices[i] *= 2.0f;
+}
+
+void HelloWindow::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4)
+{
+ vertices << QVector3D(x1, y1, -0.05f);
+ vertices << QVector3D(x2, y2, -0.05f);
+ vertices << QVector3D(x4, y4, -0.05f);
+
+ vertices << QVector3D(x3, y3, -0.05f);
+ vertices << QVector3D(x4, y4, -0.05f);
+ vertices << QVector3D(x2, y2, -0.05f);
+
+ QVector3D n = QVector3D::normal
+ (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(x4 - x1, y4 - y1, 0.0f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ vertices << QVector3D(x4, y4, 0.05f);
+ vertices << QVector3D(x2, y2, 0.05f);
+ vertices << QVector3D(x1, y1, 0.05f);
+
+ vertices << QVector3D(x2, y2, 0.05f);
+ vertices << QVector3D(x4, y4, 0.05f);
+ vertices << QVector3D(x3, y3, 0.05f);
+
+ n = QVector3D::normal
+ (QVector3D(x2 - x4, y2 - y4, 0.0f), QVector3D(x1 - x4, y1 - y4, 0.0f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+}
+
+void HelloWindow::extrude(qreal x1, qreal y1, qreal x2, qreal y2)
+{
+ vertices << QVector3D(x1, y1, +0.05f);
+ vertices << QVector3D(x2, y2, +0.05f);
+ vertices << QVector3D(x1, y1, -0.05f);
+
+ vertices << QVector3D(x2, y2, -0.05f);
+ vertices << QVector3D(x1, y1, -0.05f);
+ vertices << QVector3D(x2, y2, +0.05f);
+
+ QVector3D n = QVector3D::normal
+ (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(0.0f, 0.0f, -0.1f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+}
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h
new file mode 100644
index 0000000000..f0b8ee8b45
--- /dev/null
+++ b/examples/opengl/hellowindow/hellowindow.h
@@ -0,0 +1,40 @@
+#include <QWindow>
+
+#include <QtOpenGL/qgl.h>
+#include <QtOpenGL/qglshaderprogram.h>
+
+#include <QTime>
+
+class HelloWindow : public QWindow
+{
+ Q_OBJECT
+public:
+ HelloWindow();
+
+protected:
+ void mousePressEvent(QMouseEvent *);
+ void resizeEvent(QResizeEvent *);
+
+private slots:
+ void render();
+
+private:
+ void initialize();
+ void updateColor();
+
+ qreal m_fAngle;
+ bool m_showBubbles;
+ void paintQtLogo();
+ void createGeometry();
+ void createBubbles(int number);
+ void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4);
+ void extrude(qreal x1, qreal y1, qreal x2, qreal y2);
+ QVector<QVector3D> vertices;
+ QVector<QVector3D> normals;
+ QGLShaderProgram program;
+ int vertexAttr;
+ int normalAttr;
+ int matrixUniform;
+ int colorUniform;
+ uint colorIndex;
+};
diff --git a/examples/opengl/hellowindow/hellowindow.pro b/examples/opengl/hellowindow/hellowindow.pro
new file mode 100644
index 0000000000..5cb3632ff9
--- /dev/null
+++ b/examples/opengl/hellowindow/hellowindow.pro
@@ -0,0 +1,14 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT += opengl
+
+# Input
+HEADERS += hellowindow.h
+SOURCES += hellowindow.cpp main.cpp
diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp
new file mode 100644
index 0000000000..1b80dc7523
--- /dev/null
+++ b/examples/opengl/hellowindow/main.cpp
@@ -0,0 +1,13 @@
+#include <QGuiApplication>
+
+#include "hellowindow.h"
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ HelloWindow window;
+ window.setVisible(true);
+
+ return app.exec();
+}
diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro
index f9ca0bdaf4..9d06cd4b0b 100644
--- a/examples/opengl/opengl.pro
+++ b/examples/opengl/opengl.pro
@@ -21,6 +21,10 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){
textures
}
+qpa {
+ SUBDIRS += hellowindow
+}
+
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS opengl.pro README
diff --git a/examples/qpa/qpa.pro b/examples/qpa/qpa.pro
new file mode 100644
index 0000000000..b1b4428c23
--- /dev/null
+++ b/examples/qpa/qpa.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS = windows
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qpa
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qpa.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qpa
+INSTALLS += target sources
diff --git a/examples/qpa/windows/main.cpp b/examples/qpa/windows/main.cpp
new file mode 100644
index 0000000000..99c24fa017
--- /dev/null
+++ b/examples/qpa/windows/main.cpp
@@ -0,0 +1,19 @@
+#include <QGuiApplication>
+
+#include "window.h"
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ Window a;
+ a.setVisible(true);
+
+ Window b;
+ b.setVisible(true);
+
+ Window child(&b);
+ child.setVisible(true);
+
+ return app.exec();
+}
diff --git a/examples/qpa/windows/window.cpp b/examples/qpa/windows/window.cpp
new file mode 100644
index 0000000000..0f3355b86b
--- /dev/null
+++ b/examples/qpa/windows/window.cpp
@@ -0,0 +1,131 @@
+#include "window.h"
+
+#include <private/qguiapplication_qpa_p.h>
+#include <private/qwindowsurface_p.h>
+
+#include <QPainter>
+
+static int colorIndexId = 0;
+
+QColor colorTable[] =
+{
+ QColor("#f09f8f"),
+ QColor("#a2bff2"),
+ QColor("#c0ef8f")
+};
+
+Window::Window(QWindow *parent)
+ : QWindow(0)
+ , m_backgroundColorIndex(colorIndexId++)
+{
+ setSurfaceType(RasterSurface);
+ setWindowTitle(QLatin1String("Window"));
+
+ if (parent)
+ setGeometry(QRect(10, 10, 40, 40));
+ else
+ setGeometry(QRect(10, 10, 640, 480));
+
+ if (parent) {
+ setParent(parent);
+ setGeometry(QRect(160, 120, 320, 240));
+ }
+
+ create();
+ QGuiApplicationPrivate::platformIntegration()->createWindowSurface(this, winId());
+
+ m_image = QImage(geometry().size(), QImage::Format_RGB32);
+ m_image.fill(colorTable[m_backgroundColorIndex % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba());
+
+ m_lastPos = QPoint(-1, -1);
+
+ render();
+}
+
+void Window::mousePressEvent(QMouseEvent *event)
+{
+ m_lastPos = event->pos();
+}
+
+void Window::mouseMoveEvent(QMouseEvent *event)
+{
+ if (m_lastPos != QPoint(-1, -1)) {
+ QPainter p(&m_image);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.drawLine(m_lastPos, event->pos());
+ m_lastPos = event->pos();
+ }
+
+ render();
+}
+
+void Window::mouseReleaseEvent(QMouseEvent *event)
+{
+ if (m_lastPos != QPoint(-1, -1)) {
+ QPainter p(&m_image);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.drawLine(m_lastPos, event->pos());
+ m_lastPos = QPoint(-1, -1);
+ }
+
+ render();
+}
+
+void Window::resizeEvent(QResizeEvent *)
+{
+ QImage old = m_image;
+
+ int width = qMax(geometry().width(), old.width());
+ int height = qMax(geometry().height(), old.height());
+
+ if (width > old.width() || height > old.height()) {
+ m_image = QImage(width, height, QImage::Format_RGB32);
+ m_image.fill(colorTable[(m_backgroundColorIndex) % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba());
+
+ QPainter p(&m_image);
+ p.drawImage(0, 0, old);
+ }
+
+ render();
+}
+
+void Window::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Backspace:
+ m_text.chop(1);
+ break;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ m_text.append('\n');
+ break;
+ default:
+ m_text.append(event->text());
+ break;
+ }
+ render();
+}
+
+void Window::render()
+{
+ QRect rect(QPoint(), geometry().size());
+ surface()->resize(rect.size());
+
+ surface()->beginPaint(rect);
+
+ QPaintDevice *device = surface()->paintDevice();
+
+ QPainter p(device);
+ p.drawImage(0, 0, m_image);
+
+ QFont font;
+ font.setPixelSize(32);
+
+ p.setFont(font);
+ p.drawText(rect, 0, m_text);
+
+ surface()->endPaint(rect);
+ surface()->flush(this, rect, QPoint());
+}
+
+
diff --git a/examples/qpa/windows/window.h b/examples/qpa/windows/window.h
new file mode 100644
index 0000000000..f0b7d80531
--- /dev/null
+++ b/examples/qpa/windows/window.h
@@ -0,0 +1,25 @@
+#include <QWindow>
+#include <QImage>
+
+class Window : public QWindow
+{
+public:
+ Window(QWindow *parent = 0);
+
+protected:
+ void mousePressEvent(QMouseEvent *);
+ void mouseMoveEvent(QMouseEvent *);
+ void mouseReleaseEvent(QMouseEvent *);
+
+ void keyPressEvent(QKeyEvent *);
+
+ void resizeEvent(QResizeEvent *);
+
+private:
+ void render();
+
+ QString m_text;
+ QImage m_image;
+ QPoint m_lastPos;
+ int m_backgroundColorIndex;
+};
diff --git a/examples/qpa/windows/windows.pro b/examples/qpa/windows/windows.pro
new file mode 100644
index 0000000000..a7e3bf6db5
--- /dev/null
+++ b/examples/qpa/windows/windows.pro
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += window.h
+SOURCES += window.cpp main.cpp
diff --git a/mkspecs/qws/freebsd-generic-g++/qmake.conf b/mkspecs/qws/freebsd-generic-g++/qmake.conf
deleted file mode 100644
index d50ce6b7b6..0000000000
--- a/mkspecs/qws/freebsd-generic-g++/qmake.conf
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# qmake configuration for freebsd-g++ with Qtopia Core
-#
-
-MAKEFILE_GENERATOR = UNIX
-TARGET_PLATFORM = unix
-TEMPLATE = app
-CONFIG += qt warn_on release
-QT += core gui network
-QMAKE_INCREMENTAL_STYLE = sublib
-
-QMAKE_CC = gcc
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = yacc
-QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -pipe
-QMAKE_CFLAGS_DEPS = -M
-QMAKE_CFLAGS_WARN_ON = -Wall -W
-QMAKE_CFLAGS_WARN_OFF = -w
-QMAKE_CFLAGS_RELEASE = -O2 -fno-default-inline
-QMAKE_CFLAGS_DEBUG = -g
-QMAKE_CFLAGS_SHLIB = -fPIC
-QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
-QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
-QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
-
-QMAKE_CXX = g++
-QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_LINUXFB -DQT_NO_QWS_TRANSFORMED
-QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
-QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
-QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
-
-# Addon software goes into /usr/local on the BSDs, by default we will look there
-QMAKE_INCDIR = /usr/local/include
-QMAKE_LIBDIR = /usr/local/lib
-QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
-QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
-QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include
-QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib
-
-QMAKE_LINK = g++
-QMAKE_LINK_SHLIB = g++
-QMAKE_LINK_C = gcc
-QMAKE_LINK_C_SHLIB = gcc
-QMAKE_LFLAGS =
-QMAKE_LFLAGS_RELEASE =
-QMAKE_LFLAGS_DEBUG =
-QMAKE_LFLAGS_SHLIB = -shared
-QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
-QMAKE_LFLAGS_SONAME = -Wl,-soname,
-QMAKE_LFLAGS_THREAD = -pthread
-QMAKE_LFLAGS_RPATH = -Wl,-rpath,
-
-QMAKE_LIBS =
-QMAKE_LIBS_QT = -lqte
-QMAKE_LIBS_QT_THREAD = -lqte-mt
-QMAKE_LIBS_THREAD =
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_QTOPIA = -lqpe -lqtopia
-
-QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
-QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
-
-QMAKE_AR = ar cqs
-QMAKE_OBJCOPY = objcopy
-QMAKE_RANLIB =
-
-QMAKE_TAR = tar -cf
-QMAKE_GZIP = gzip -9f
-
-QMAKE_COPY = cp -f
-QMAKE_MOVE = mv -f
-QMAKE_DEL_FILE = rm -f
-QMAKE_DEL_DIR = rmdir
-QMAKE_CHK_DIR_EXISTS = test -d
-QMAKE_MKDIR = mkdir -p
-include(../../common/unix.conf)
-load(qt_config)
diff --git a/mkspecs/qws/freebsd-generic-g++/qplatformdefs.h b/mkspecs/qws/freebsd-generic-g++/qplatformdefs.h
deleted file mode 100644
index b5e2897e23..0000000000
--- a/mkspecs/qws/freebsd-generic-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../freebsd-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-arm-g++/qmake.conf b/mkspecs/qws/linux-arm-g++/qmake.conf
deleted file mode 100644
index 7b378133ac..0000000000
--- a/mkspecs/qws/linux-arm-g++/qmake.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# qmake configuration for building with arm-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = arm-linux-gcc
-QMAKE_CXX = arm-linux-g++
-QMAKE_LINK = arm-linux-g++
-QMAKE_LINK_SHLIB = arm-linux-g++
-
-# modifications to linux.conf
-QMAKE_AR = arm-linux-ar cqs
-QMAKE_OBJCOPY = arm-linux-objcopy
-QMAKE_STRIP = arm-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-arm-g++/qplatformdefs.h b/mkspecs/qws/linux-arm-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-arm-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf b/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf
deleted file mode 100644
index e1ad837361..0000000000
--- a/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# qmake configuration for building with arm-none-linux-gnueabi-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = arm-none-linux-gnueabi-gcc
-QMAKE_CXX = arm-none-linux-gnueabi-g++
-QMAKE_LINK = arm-none-linux-gnueabi-g++
-QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++
-
-# modifications to linux.conf
-QMAKE_AR = arm-none-linux-gnueabi-ar cqs
-QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy
-QMAKE_STRIP = arm-none-linux-gnueabi-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h b/mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-armv6-g++/qmake.conf b/mkspecs/qws/linux-armv6-g++/qmake.conf
deleted file mode 100644
index 0e2473c26c..0000000000
--- a/mkspecs/qws/linux-armv6-g++/qmake.conf
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# qmake configuration for building for ARMv6 devices with arm-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = arm-linux-gcc
-QMAKE_CXX = arm-linux-g++
-QMAKE_LINK = arm-linux-g++
-QMAKE_LINK_SHLIB = arm-linux-g++
-QMAKE_CFLAGS += -march=armv6
-QMAKE_CXXFLAGS += -march=armv6
-
-# modifications to linux.conf
-QMAKE_AR = arm-linux-ar cqs
-QMAKE_OBJCOPY = arm-linux-objcopy
-QMAKE_STRIP = arm-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-armv6-g++/qplatformdefs.h b/mkspecs/qws/linux-armv6-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-armv6-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-avr32-g++/qmake.conf b/mkspecs/qws/linux-avr32-g++/qmake.conf
deleted file mode 100644
index 32c0444de8..0000000000
--- a/mkspecs/qws/linux-avr32-g++/qmake.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# qmake configuration for building with avr32-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = avr32-linux-gcc
-QMAKE_CXX = avr32-linux-g++
-QMAKE_LINK = avr32-linux-g++
-QMAKE_LINK_SHLIB = avr32-linux-g++
-
-# modifications to linux.conf
-QMAKE_AR = avr32-linux-ar cqs
-QMAKE_OBJCOPY = avr32-linux-objcopy
-QMAKE_STRIP = avr32-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-avr32-g++/qplatformdefs.h b/mkspecs/qws/linux-avr32-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-avr32-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-cellon-g++/qmake.conf b/mkspecs/qws/linux-cellon-g++/qmake.conf
deleted file mode 100644
index ad66c3c342..0000000000
--- a/mkspecs/qws/linux-cellon-g++/qmake.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# qmake configuration for linux-g++ using the arm-linux-g++ crosscompiler
-#
-
-#
-# qmake configuration for building with arm-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = arm-linux-gcc
-QMAKE_CXX = arm-linux-g++
-QMAKE_LINK = arm-linux-g++
-QMAKE_LINK_SHLIB = arm-linux-g++
-QMAKE_CFLAGS = $$QMAKE_CFLAGS -DQT_QWS_CELLON -DQWS
-QMAKE_CXXFLAGS = $$QMAKE_CXXFLAGS -DQT_QWS_CELLON -DQWS
-QMAKE_CFLAGS_RELEASE ~= s/-O2/-Os/
-QMAKE_CXXFLAGS_RELEASE ~= s/-O2/-Os/
-
-# modifications to linux.conf
-QMAKE_AR = arm-linux-ar cqs
-QMAKE_OBJCOPY = arm-linux-objcopy
-QMAKE_STRIP = arm-linux-strip
-
-load(qt_config)
-
diff --git a/mkspecs/qws/linux-cellon-g++/qplatformdefs.h b/mkspecs/qws/linux-cellon-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-cellon-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-dm7000-g++/qmake.conf b/mkspecs/qws/linux-dm7000-g++/qmake.conf
deleted file mode 100644
index c897091466..0000000000
--- a/mkspecs/qws/linux-dm7000-g++/qmake.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# qmake configuration for linux-dm7000-g++, for Dream Multimedia's DM7000S
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = powerpc-tuxbox-linux-gnu-gcc
-QMAKE_CFLAGS = -pipe -msoft-float -meabi
-QMAKE_CFLAGS_RELEASE = -O2 -mcpu=405 -mmultiple -mstring
-QMAKE_CFLAGS_DEBUG = -ggdb3
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXX = powerpc-tuxbox-linux-gnu-g++
-QMAKE_LINK = powerpc-tuxbox-linux-gnu-g++
-QMAKE_LINK_SHLIB = powerpc-tuxbox-linux-gnu-g++
-
-# modifications to linux.conf
-QMAKE_AR = powerpc-tuxbox-linux-gnu-ar cqs
-QMAKE_OBJCOPY = powerpc-tuxbox-linux-gnu-objcopy
-QMAKE_STRIP = powerpc-tuxbox-linux-gnu-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-dm7000-g++/qplatformdefs.h b/mkspecs/qws/linux-dm7000-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-dm7000-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-dm800-g++/qmake.conf b/mkspecs/qws/linux-dm800-g++/qmake.conf
deleted file mode 100644
index 002e4c7d56..0000000000
--- a/mkspecs/qws/linux-dm800-g++/qmake.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# qmake configuration for linux-dm800-g++, for Dream Multimedia's DM800
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = mipsel-linux-gcc
-QMAKE_CXX = mipsel-linux-g++
-QMAKE_LINK = mipsel-linux-g++
-QMAKE_LINK_SHLIB = mipsel-linux-g++
-QMAKE_CFLAGS += -mabi=32 -mips32
-QMAKE_CFLAGS_RELEASE += -fexpensive-optimizations -frename-registers -O2
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-
-# modifications to linux.conf
-QMAKE_AR = mipsel-linux-ar cqs
-QMAKE_OBJCOPY = mipsel-linux-objcopy
-QMAKE_STRIP = mipsel-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-dm800-g++/qplatformdefs.h b/mkspecs/qws/linux-dm800-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-dm800-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-generic-g++-32/qmake.conf b/mkspecs/qws/linux-generic-g++-32/qmake.conf
deleted file mode 100644
index 249c10aae9..0000000000
--- a/mkspecs/qws/linux-generic-g++-32/qmake.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# qmake configuration for building with arm-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CFLAGS += -m32
-QMAKE_CXXFLAGS += -m32
-QMAKE_LFLAGS += -m32
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-generic-g++-32/qplatformdefs.h b/mkspecs/qws/linux-generic-g++-32/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-generic-g++-32/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-generic-g++/qmake.conf b/mkspecs/qws/linux-generic-g++/qmake.conf
deleted file mode 100644
index e803d0d402..0000000000
--- a/mkspecs/qws/linux-generic-g++/qmake.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# qmake configuration for building with g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-generic-g++/qplatformdefs.h b/mkspecs/qws/linux-generic-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-generic-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-ipaq-g++/qmake.conf b/mkspecs/qws/linux-ipaq-g++/qmake.conf
deleted file mode 100644
index f9d33b3628..0000000000
--- a/mkspecs/qws/linux-ipaq-g++/qmake.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# qmake configuration for building with arm-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = arm-linux-gcc -DQT_QWS_IPAQ
-QMAKE_CXX = arm-linux-g++ -DQT_QWS_IPAQ
-QMAKE_LINK = arm-linux-g++
-QMAKE_LINK_SHLIB = arm-linux-g++
-
-# modifications to linux.conf
-QMAKE_AR = arm-linux-ar cqs
-QMAKE_OBJCOPY = arm-linux-objcopy
-QMAKE_STRIP = arm-linux-strip
-
-load(qt_config)
-
diff --git a/mkspecs/qws/linux-ipaq-g++/qplatformdefs.h b/mkspecs/qws/linux-ipaq-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-ipaq-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-lsb-g++/qmake.conf b/mkspecs/qws/linux-lsb-g++/qmake.conf
deleted file mode 100644
index 4b359258fb..0000000000
--- a/mkspecs/qws/linux-lsb-g++/qmake.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# qmake configuration for linux-g++
-#
-
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-
-QMAKE_LSB = 1
-
-# modifications to g++.conf
-QMAKE_CC = lsbcc
-QMAKE_CXX = lsbc++
-QMAKE_CFLAGS = -pipe -DQT_LINUXBASE -fno-stack-protector
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
-QMAKE_LINK = lsbc++
-QMAKE_LINK_SHLIB = lsbc++
-QMAKE_LFLAGS += -fno-stack-protector
-
-load(qt_config)
-
diff --git a/mkspecs/qws/linux-lsb-g++/qplatformdefs.h b/mkspecs/qws/linux-lsb-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-lsb-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-mips-g++/qmake.conf b/mkspecs/qws/linux-mips-g++/qmake.conf
deleted file mode 100644
index 1a8607869f..0000000000
--- a/mkspecs/qws/linux-mips-g++/qmake.conf
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# qmake configuration for building with mipsel-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = mips-linux-gcc
-QMAKE_CXX = mips-linux-g++
-QMAKE_CFLAGS += -mips32
-QMAKE_CXXFLAGS += -mips32
-QMAKE_LINK = mips-linux-g++
-QMAKE_LINK_SHLIB = mips-linux-g++
-
-# modifications to linux.conf
-QMAKE_AR = mips-linux-ar cqs
-QMAKE_OBJCOPY = mips-linux-objcopy
-QMAKE_STRIP = mips-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-mips-g++/qplatformdefs.h b/mkspecs/qws/linux-mips-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-mips-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-nacl-g++/qmake.conf b/mkspecs/qws/linux-nacl-g++/qmake.conf
deleted file mode 100644
index 7293a1acfd..0000000000
--- a/mkspecs/qws/linux-nacl-g++/qmake.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# qmake configuration for building with nacl-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/qws.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-
-QT = core gui
-
-QMAKE_CC = nacl-gcc
-QMAKE_CXX = nacl-g++
-QMAKE_LINK = nacl-g++
-QMAKE_LINK_SHLIB = nacl-g++
-QMAKE_AR = nacl-ar q
-QMAKE_OBJCOPY = nacl-objcopy
-QMAKE_STRIP = nacl-strip
-
-# work around linker crash when using PIC
-QMAKE_CFLAGS_STATIC_LIB -= -fPIC
-QMAKE_CFLAGS_SHLIB -= -fPIC
-QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC
-QMAKE_CXXFLAGS_SHLIB -= -fPIC
-
-#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1
-QMAKE_LIBS_DYNLOAD -= -ldl
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h
deleted file mode 100644
index 8d25281ab6..0000000000
--- a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-// Get Qt defines/settings
-
-#define _POSIX_TIMERS
-
-#include "qglobal.h"
-
-// extra disabling.
-#ifdef __native_client__
-#define QT_NO_FSFILEENGINE
-#endif
-
-#define QT_NO_SOCKET_H
-
-#define DIR void *
-#define PATH_MAX 256
-
-#include "../../common/posix/qplatformdefs.h"
-#include "qfunctions_nacl.h"
-#include <pthread.h>
-
-#undef QT_LSTAT
-#define QT_LSTAT QT_STAT
-
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/qws/linux-powerpc-g++/qmake.conf b/mkspecs/qws/linux-powerpc-g++/qmake.conf
deleted file mode 100644
index 6a6310aa02..0000000000
--- a/mkspecs/qws/linux-powerpc-g++/qmake.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# qmake configuration for building with g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = powerpc-linux-gcc
-QMAKE_CXX = powerpc-linux-g++
-QMAKE_LINK = powerpc-linux-g++
-QMAKE_LINK_SHLIB = powerpc-linux-g++
-
-# modifications to linux.conf
-QMAKE_AR = powerpc-linux-ar cqs
-QMAKE_OBJCOPY = powerpc-linux-objcopy
-QMAKE_STRIP = powerpc-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-powerpc-g++/qplatformdefs.h b/mkspecs/qws/linux-powerpc-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-powerpc-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-sh-g++/qmake.conf b/mkspecs/qws/linux-sh-g++/qmake.conf
deleted file mode 100644
index 004780a559..0000000000
--- a/mkspecs/qws/linux-sh-g++/qmake.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# qmake configuration for building for SH devices with sh3-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = sh3-linux-gcc
-QMAKE_CXX = sh3-linux-g++
-QMAKE_LINK = sh3-linux-g++
-QMAKE_LINK_SHLIB = sh3-linux-g++
-
-# modifications to linux.conf
-QMAKE_AR = sh3-linux-ar cqs
-QMAKE_OBJCOPY = sh3-linux-objcopy
-QMAKE_STRIP = sh3-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-sh-g++/qplatformdefs.h b/mkspecs/qws/linux-sh-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-sh-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-sh4al-g++/qmake.conf b/mkspecs/qws/linux-sh4al-g++/qmake.conf
deleted file mode 100644
index 71f6b3df56..0000000000
--- a/mkspecs/qws/linux-sh4al-g++/qmake.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# qmake configuration for building for SH4AL-DSP devices with sh3-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = sh3-linux-gcc
-QMAKE_CXX = sh3-linux-g++
-QMAKE_LINK = sh3-linux-g++
-QMAKE_LINK_SHLIB = sh3-linux-g++
-QMAKE_CFLAGS += -m4al
-QMAKE_CXXFLAGS += -m4al
-
-
-# modifications to linux.conf
-QMAKE_AR = sh3-linux-ar cqs
-QMAKE_OBJCOPY = sh3-linux-objcopy
-QMAKE_STRIP = sh3-linux-strip
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-sh4al-g++/qplatformdefs.h b/mkspecs/qws/linux-sh4al-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-sh4al-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-sharp-g++/qmake.conf b/mkspecs/qws/linux-sharp-g++/qmake.conf
deleted file mode 100644
index 6a000b9c64..0000000000
--- a/mkspecs/qws/linux-sharp-g++/qmake.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# qmake configuration for building with arm-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = arm-linux-gcc
-QMAKE_CXX = arm-linux-g++
-QMAKE_LINK = arm-linux-g++
-QMAKE_LINK_SHLIB = arm-linux-g++
-QMAKE_CFLAGS += -DQT_QWS_SHARP -DQT_QWS_EBX
-QMAKE_CXXFLAGS += -DQT_QWS_SHARP -DQT_QWS_EBX
-
-# modifications to linux.conf
-QMAKE_AR = arm-linux-ar cqs
-QMAKE_OBJCOPY = arm-linux-objcopy
-QMAKE_STRIP = arm-linux-strip
-
-load(qt_config)
-
diff --git a/mkspecs/qws/linux-sharp-g++/qplatformdefs.h b/mkspecs/qws/linux-sharp-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-sharp-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-x86-g++/qmake.conf b/mkspecs/qws/linux-x86-g++/qmake.conf
deleted file mode 100644
index 55011ec52b..0000000000
--- a/mkspecs/qws/linux-x86-g++/qmake.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# qmake configuration for building with linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-load(qt_config)
diff --git a/mkspecs/qws/linux-x86-g++/qplatformdefs.h b/mkspecs/qws/linux-x86-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-x86-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-x86_64-g++/qmake.conf b/mkspecs/qws/linux-x86_64-g++/qmake.conf
deleted file mode 100644
index e18d055790..0000000000
--- a/mkspecs/qws/linux-x86_64-g++/qmake.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# qmake configuration for building with linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CFLAGS += -m64
-QMAKE_CXXFLAGS += -m64
-
-load(qt_config)
-
diff --git a/mkspecs/qws/linux-x86_64-g++/qplatformdefs.h b/mkspecs/qws/linux-x86_64-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-x86_64-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/linux-zylonite-g++/qmake.conf b/mkspecs/qws/linux-zylonite-g++/qmake.conf
deleted file mode 100644
index f50b70f945..0000000000
--- a/mkspecs/qws/linux-zylonite-g++/qmake.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# qmake configuration for building with arm-linux-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-include(../../common/qws.conf)
-
-# modifications to g++.conf
-QMAKE_CC = arm-linux-gcc
-QMAKE_CXX = arm-linux-g++
-QMAKE_CFLAGS += -DQT_QWS_ZYLONITE -DQWS -fno-rtti
-QMAKE_CXXFLAGS += -DQT_QWS_ZYLONITE -DQWS -fno-rtti
-QMAKE_LINK = arm-linux-g++
-QMAKE_LINK_SHLIB = arm-linux-g++
-QMAKE_CFLAGS_RELEASE ~= s/-O2/-Os/
-QMAKE_CXXFLAGS_RELEASE ~= s/-O2/-Os/
-
-# modifications to linux.conf
-QMAKE_AR = arm-linux-ar cqs
-QMAKE_OBJCOPY = arm-linux-objcopy
-QMAKE_STRIP = arm-linux-strip
-
-load(qt_config)
-
diff --git a/mkspecs/qws/linux-zylonite-g++/qplatformdefs.h b/mkspecs/qws/linux-zylonite-g++/qplatformdefs.h
deleted file mode 100644
index afffb5a837..0000000000
--- a/mkspecs/qws/linux-zylonite-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/macx-generic-g++/qmake.conf b/mkspecs/qws/macx-generic-g++/qmake.conf
deleted file mode 100644
index 8dcbb39316..0000000000
--- a/mkspecs/qws/macx-generic-g++/qmake.conf
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# qmake configuration for macx-g++ with Qtopia Core
-#
-
-include(../../common/unix.conf)
-
-MAKEFILE_GENERATOR = UNIX
-TARGET_PLATFORM = macx
-TEMPLATE = app
-CONFIG += qt warn_on release link_prl
-QT += core gui network
-QMAKE_INCREMENTAL_STYLE = sublib
-QMAKE_EXTENSION_SHLIB = dylib
-
-QMAKE_CC = $(TB)cc
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = yacc
-QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -pipe
-QMAKE_CFLAGS_WARN_ON = -Wall -W
-QMAKE_CFLAGS_WARN_OFF =
-QMAKE_CFLAGS_RELEASE = -O2
-QMAKE_CFLAGS_DEBUG = -g
-QMAKE_CFLAGS_SHLIB = -fPIC
-QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
-QMAKE_CFLAGS_THREAD = -D_REENTRANT
-QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
-
-QMAKE_CXX = c++
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED
-QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
-QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -fno-default-inline
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
-QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
-
-QMAKE_INCDIR =
-QMAKE_LIBDIR =
-QMAKE_INCDIR_X11 =
-QMAKE_LIBDIR_X11 =
-QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
-QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
-QMAKE_INCDIR_OPENGL =
-QMAKE_LIBDIR_OPENGL =
-QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include
-QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib
-
-QMAKE_LINK = $$QMAKE_CXX
-QMAKE_LINK_SHLIB = $$QMAKE_CXX
-QMAKE_LFLAGS =
-QMAKE_LFLAGS_RELEASE =
-QMAKE_LFLAGS_DEBUG =
-QMAKE_LFLAGS_SHLIB = -dynamiclib
-QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace
-QMAKE_LFLAGS_PLUGIN = -bundle
-QMAKE_LFLAGS_SONAME =
-QMAKE_LFLAGS_THREAD =
-QMAKE_LFLAGS_RPATH =
-
-QMAKE_LIBS =
-QMAKE_LIBS_X11 =
-QMAKE_LIBS_X11SM =
-QMAKE_LIBS_QT = -lqte
-QMAKE_LIBS_QT_THREAD = -lqte-mt
-QMAKE_LIBS_QT_OPENGL = -lqgl
-QMAKE_LIBS_QTOPIA = -lqpe -lqtopia
-QMAKE_LIBS_THREAD =
-QMAKE_LIBS_OPENGL =
-
-QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
-QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
-
-QMAKE_AR = ar cqs
-QMAKE_OBJCOPY = objcopy
-QMAKE_RANLIB =
-
-QMAKE_TAR = tar -cf
-QMAKE_GZIP = gzip -9f
-
-QMAKE_COPY = cp -f
-QMAKE_MOVE = mv -f
-QMAKE_DEL_FILE = rm -f
-QMAKE_DEL_DIR = rmdir
-QMAKE_CHK_DIR_EXISTS = test -d
-QMAKE_MKDIR = mkdir -p
-load(qt_config)
diff --git a/mkspecs/qws/macx-generic-g++/qplatformdefs.h b/mkspecs/qws/macx-generic-g++/qplatformdefs.h
deleted file mode 100644
index 7328c5049a..0000000000
--- a/mkspecs/qws/macx-generic-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../macx-g++/qplatformdefs.h"
diff --git a/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib b/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib
deleted file mode 100644
index 97609ed0ce..0000000000
--- a/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.9">
-<dict>
- <key>CFBundlePackageType</key>
- <string>FMWK</string>
- <key>CFBundleShortVersionString</key>
- <string>@SHORT_VERSION@</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleSignature</key>
- <string>@TYPEINFO@</string>
- <key>CFBundleExecutable</key>
- <string>@LIBRARY@</string>
- <key>NOTE</key>
- <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string>
-</dict>
-</plist>
diff --git a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf
deleted file mode 100644
index 227d24e838..0000000000
--- a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# qmake configuration for iphone-device-g++
-#
-include(../../common/mac.conf)
-include(../../common/gcc-base-macx.conf)
-include(../../common/g++-macx.conf)
-
-MAKEFILE_GENERATOR = UNIX
-TEMPLATE = app
-CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl
-QT += core gui
-QMAKE_INCREMENTAL_STYLE = sublib
-
-# Do not compile a few things
-DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER
-
-# You may need to change this to point to the iOS SDK you want to use.
-QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneOS.platform/Developer
-QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneOS4.3.sdk
-DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200
-
-#clear
-QMAKE_MACOSX_DEPLOYMENT_TARGET =
-
-QMAKE_LIBS_OPENGL_ES1 += -framework OpenGLES
-QMAKE_LIBS_OPENGL_ES2 += -framework OpenGLES
-
-# TARGET_PLATFORM = ios
-QMAKE_CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
-QMAKE_CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2
-QMAKE_LINK = $$QMAKE_CXX
-QMAKE_LINK_SHLIB = $$QMAKE_CXX
-
-QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
-QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -fobjc-abi-version=2 -fobjc-legacy-dispatch
-QMAKE_LFLAGS += -arch armv7 -marm -miphoneos-version-min=4.2 -Wl,-syslibroot,$$QMAKE_IOS_SDK
-
-QMAKE_INCDIR_OPENGL =
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_OPENGL_QT =
-
-#QMAKE_RESOURCE =
-QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id
-QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq
-QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s
-
-load(qt_config)
diff --git a/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h
deleted file mode 100644
index 0468935ea6..0000000000
--- a/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-// Get Qt defines/settings
-
-#include "qglobal.h"
-
-// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
-
-#include <unistd.h>
-
-
-// We are hot - unistd.h should have turned on the specific APIs we requested
-
-
-#include <pthread.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <pwd.h>
-#include <signal.h>
-#define QT_NO_LIBRARY_UNLOAD
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/ipc.h>
-#include <sys/time.h>
-#include <sys/shm.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <netinet/in.h>
-#ifndef QT_NO_IPV6IFNAME
-#include <net/if.h>
-#endif
-
-#include "../../common/posix/qplatformdefs.h"
-
-#undef QT_OPEN_LARGEFILE
-#undef QT_SOCKLEN_T
-#undef QT_SIGNAL_IGNORE
-
-#define QT_OPEN_LARGEFILE 0
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
-#define QT_SOCKLEN_T socklen_t
-#else
-#define QT_SOCKLEN_T int
-#endif
-
-#define QT_SIGNAL_IGNORE (void (*)(int))1
-
-#define QT_SNPRINTF ::snprintf
-#define QT_VSNPRINTF ::vsnprintf
-
-#define QT_QPA_DEFAULT_PLATFORM_NAME "uikit"
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib b/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib
deleted file mode 100644
index 97609ed0ce..0000000000
--- a/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.9">
-<dict>
- <key>CFBundlePackageType</key>
- <string>FMWK</string>
- <key>CFBundleShortVersionString</key>
- <string>@SHORT_VERSION@</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleSignature</key>
- <string>@TYPEINFO@</string>
- <key>CFBundleExecutable</key>
- <string>@LIBRARY@</string>
- <key>NOTE</key>
- <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string>
-</dict>
-</plist>
diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf
deleted file mode 100644
index 93c47862a0..0000000000
--- a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# qmake configuration for macx-g++
-#
-include(../../common/mac.conf)
-include(../../common/gcc-base-macx.conf)
-include(../../common/g++-macx.conf)
-
-MAKEFILE_GENERATOR = UNIX
-TEMPLATE = app
-CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl
-QT += core gui
-QMAKE_INCREMENTAL_STYLE = sublib
-
-# Do not compile a few things
-DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER
-
-# You may need to change this to point to the iOS SDK you want to use.
-QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneSimulator.platform/Developer
-QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneSimulator4.2.sdk
-DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200
-#clear
-QMAKE_MACOSX_DEPLOYMENT_TARGET =
-
-QMAKE_LIBS_OPENGL_ES1 += -framework OpenGLES
-QMAKE_LIBS_OPENGL_ES2 += -framework OpenGLES
-
-# TARGET_PLATFORM = ios
-QMAKE_CC = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2
-QMAKE_CXX = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2
-QMAKE_LINK = $$QMAKE_CXX
-QMAKE_LINK_SHLIB = $$QMAKE_CXX
-
-QMAKE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
-QMAKE_OBJECTIVE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch
-QMAKE_LFLAGS += -arch i386 -Wl,-syslibroot,$$QMAKE_IOS_SDK
-
-QMAKE_INCDIR_OPENGL =
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_OPENGL_QT =
-
-#QMAKE_RESOURCE =
-QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id
-QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq
-QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s
-
-load(qt_config)
-
-QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch
diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h
deleted file mode 100644
index 0468935ea6..0000000000
--- a/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-// Get Qt defines/settings
-
-#include "qglobal.h"
-
-// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
-
-#include <unistd.h>
-
-
-// We are hot - unistd.h should have turned on the specific APIs we requested
-
-
-#include <pthread.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <pwd.h>
-#include <signal.h>
-#define QT_NO_LIBRARY_UNLOAD
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/ipc.h>
-#include <sys/time.h>
-#include <sys/shm.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <netinet/in.h>
-#ifndef QT_NO_IPV6IFNAME
-#include <net/if.h>
-#endif
-
-#include "../../common/posix/qplatformdefs.h"
-
-#undef QT_OPEN_LARGEFILE
-#undef QT_SOCKLEN_T
-#undef QT_SIGNAL_IGNORE
-
-#define QT_OPEN_LARGEFILE 0
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
-#define QT_SOCKLEN_T socklen_t
-#else
-#define QT_SOCKLEN_T int
-#endif
-
-#define QT_SIGNAL_IGNORE (void (*)(int))1
-
-#define QT_SNPRINTF ::snprintf
-#define QT_VSNPRINTF ::vsnprintf
-
-#define QT_QPA_DEFAULT_PLATFORM_NAME "uikit"
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/qws/macx-nacl-g++/qmake.conf b/mkspecs/qws/macx-nacl-g++/qmake.conf
deleted file mode 100644
index 7293a1acfd..0000000000
--- a/mkspecs/qws/macx-nacl-g++/qmake.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# qmake configuration for building with nacl-g++
-#
-
-include(../../common/linux.conf)
-include(../../common/qws.conf)
-include(../../common/gcc-base-unix.conf)
-include(../../common/g++-unix.conf)
-
-QT = core gui
-
-QMAKE_CC = nacl-gcc
-QMAKE_CXX = nacl-g++
-QMAKE_LINK = nacl-g++
-QMAKE_LINK_SHLIB = nacl-g++
-QMAKE_AR = nacl-ar q
-QMAKE_OBJCOPY = nacl-objcopy
-QMAKE_STRIP = nacl-strip
-
-# work around linker crash when using PIC
-QMAKE_CFLAGS_STATIC_LIB -= -fPIC
-QMAKE_CFLAGS_SHLIB -= -fPIC
-QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC
-QMAKE_CXXFLAGS_SHLIB -= -fPIC
-
-#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1
-QMAKE_LIBS_DYNLOAD -= -ldl
-
-load(qt_config)
diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h
deleted file mode 100644
index 2a806a3fa3..0000000000
--- a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-
-#define _POSIX_TIMERS
-
-#include "qglobal.h"
-
-// extra disabling.
-#ifdef __native_client__
-#define QT_NO_FSFILEENGINE
-#endif
-
-#define QT_NO_SOCKET_H
-
-#define DIR void *
-#define PATH_MAX 256
-
-#include "../../common/posix/qplatformdefs.h"
-#include "qfunctions_nacl.h"
-#include <pthread.h>
-
-#undef QT_LSTAT
-#define QT_LSTAT QT_STAT
-
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/qws/solaris-generic-g++/qmake.conf b/mkspecs/qws/solaris-generic-g++/qmake.conf
deleted file mode 100644
index 3bf7e56447..0000000000
--- a/mkspecs/qws/solaris-generic-g++/qmake.conf
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# qmake configuration for solaris-g++ with Qtopia Core
-#
-
-MAKEFILE_GENERATOR = UNIX
-TARGET_PLATFORM = unix
-TEMPLATE = app
-CONFIG += qt warn_on release link_prl
-QT += core gui network
-QMAKE_INCREMENTAL_STYLE = sublib
-
-QMAKE_CC = gcc
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = yacc
-QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -pipe
-QMAKE_CFLAGS_WARN_ON = -Wall -W
-QMAKE_CFLAGS_WARN_OFF =
-QMAKE_CFLAGS_RELEASE = -O2 -fno-default-inline
-QMAKE_CFLAGS_DEBUG = -g
-QMAKE_CFLAGS_SHLIB = -fPIC
-QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
-QMAKE_CFLAGS_THREAD = -D_REENTRANT
-QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
-
-QMAKE_CXX = g++
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_SOUND -DQT_NO_QWS_LINUXFB -DQT_NO_QWS_TRANSFORMED
-QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
-QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
-QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
-
-QMAKE_INCDIR =
-QMAKE_LIBDIR =
-QMAKE_INCDIR_X11 =
-QMAKE_LIBDIR_X11 =
-QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
-QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
-QMAKE_INCDIR_OPENGL =
-QMAKE_LIBDIR_OPENGL =
-QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include
-QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib
-
-QMAKE_LINK = g++
-QMAKE_LINK_SHLIB = g++
-QMAKE_LINK_C = gcc
-QMAKE_LINK_C_SHLIB = gcc
-QMAKE_LFLAGS =
-QMAKE_LFLAGS_RELEASE =
-QMAKE_LFLAGS_DEBUG =
-QMAKE_LFLAGS_SHLIB = -shared
-QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
-QMAKE_LFLAGS_SONAME = -Wl,-soname,
-QMAKE_LFLAGS_THREAD =
-QMAKE_LFLAGS_RPATH = -Wl,-rpath,
-
-QMAKE_LIBS = -lsocket -lnsl -lresolv
-QMAKE_LIBS_DYNLOAD = -ldl
-QMAKE_LIBS_X11 =
-QMAKE_LIBS_X11SM =
-QMAKE_LIBS_QT = -lqte
-QMAKE_LIBS_QT_THREAD = -lqte-mt
-QMAKE_LIBS_QT_OPENGL = -lqgl
-QMAKE_LIBS_QTOPIA = -lqpe -lqtopia
-QMAKE_LIBS_THREAD = -lthread -lrt
-QMAKE_LIBS_OPENGL =
-
-QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
-QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
-
-QMAKE_AR = ar cq
-QMAKE_OBJCOPY = objcopy
-QMAKE_RANLIB =
-
-QMAKE_TAR = tar -cf
-QMAKE_GZIP = gzip -9f
-
-QMAKE_COPY = cp -f
-QMAKE_MOVE = mv -f
-QMAKE_DEL_FILE = rm -f
-QMAKE_DEL_DIR = rmdir
-QMAKE_CHK_DIR_EXISTS = test -d
-QMAKE_MKDIR = mkdir -p
-load(qt_config)
diff --git a/mkspecs/qws/solaris-generic-g++/qplatformdefs.h b/mkspecs/qws/solaris-generic-g++/qplatformdefs.h
deleted file mode 100644
index d0525cbcba..0000000000
--- a/mkspecs/qws/solaris-generic-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the qmake spec of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../solaris-g++/qplatformdefs.h"
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 75ce68afbf..252af2caf6 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -271,13 +271,13 @@ public:
Window = 0x00000001,
Dialog = 0x00000002 | Window,
Sheet = 0x00000004 | Window,
- Drawer = 0x00000006 | Window,
+ Drawer = Sheet | Dialog,
Popup = 0x00000008 | Window,
- Tool = 0x0000000a | Window,
- ToolTip = 0x0000000c | Window,
- SplashScreen = 0x0000000e | Window,
+ Tool = Popup | Dialog,
+ ToolTip = Popup | Sheet,
+ SplashScreen = ToolTip | Dialog,
Desktop = 0x00000010 | Window,
- SubWindow = 0x00000012,
+ SubWindow = Desktop | Dialog,
WindowType_Mask = 0x000000ff,
MSWindowsFixedSizeDialogHint = 0x00000100,
@@ -292,13 +292,7 @@ public:
WindowContextHelpButtonHint = 0x00010000,
WindowShadeButtonHint = 0x00020000,
WindowStaysOnTopHint = 0x00040000,
- // reserved for Qt3Support:
- // WMouseNoMask = 0x00080000,
- // WDestructiveClose = 0x00100000,
- // WStaticContents = 0x00200000,
- // WGroupLeader = 0x00400000,
- // WShowModal = 0x00800000,
- // WNoMousePropagation = 0x01000000,
+
CustomizeWindowHint = 0x02000000,
WindowStaysOnBottomHint = 0x04000000,
WindowCloseButtonHint = 0x08000000,
@@ -308,56 +302,6 @@ public:
WindowCancelButtonHint = 0x00100000,
WindowSoftkeysVisibleHint = 0x40000000,
WindowSoftkeysRespondHint = 0x80000000
-
-#ifdef QT3_SUPPORT
- ,
- WMouseNoMask = 0x00080000,
- WDestructiveClose = 0x00100000,
- WStaticContents = 0x00200000,
- WGroupLeader = 0x00400000,
- WShowModal = 0x00800000,
- WNoMousePropagation = 0x01000000,
-
- WType_TopLevel = Window,
- WType_Dialog = Dialog,
- WType_Popup = Popup,
- WType_Desktop = Desktop,
- WType_Mask = WindowType_Mask,
-
- WStyle_Customize = 0,
- WStyle_NormalBorder = 0,
- WStyle_DialogBorder = MSWindowsFixedSizeDialogHint,
- WStyle_NoBorder = FramelessWindowHint,
- WStyle_Title = WindowTitleHint,
- WStyle_SysMenu = WindowSystemMenuHint,
- WStyle_Minimize = WindowMinimizeButtonHint,
- WStyle_Maximize = WindowMaximizeButtonHint,
- WStyle_MinMax = WStyle_Minimize | WStyle_Maximize,
- WStyle_Tool = Tool,
- WStyle_StaysOnTop = WindowStaysOnTopHint,
- WStyle_ContextHelp = WindowContextHelpButtonHint,
-
- // misc flags
- WPaintDesktop = 0,
- WPaintClever = 0,
-
- WX11BypassWM = X11BypassWindowManagerHint,
- WWinOwnDC = MSWindowsOwnDC,
- WMacSheet = Sheet,
- WMacDrawer = Drawer,
-
- WStyle_Splash = SplashScreen,
-
- WNoAutoErase = 0,
- WRepaintNoErase = 0,
- WNorthWestGravity = WStaticContents,
- WType_Modal = Dialog | WShowModal,
- WStyle_Dialog = Dialog,
- WStyle_NoBorderEx = FramelessWindowHint,
- WResizeNoErase = 0,
- WMacNoSheet = 0
-#endif
-
};
Q_DECLARE_FLAGS(WindowFlags, WindowType)
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index e0841cbadc..36609a3a1c 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -585,23 +585,6 @@ void QCoreApplication::flush()
\a argc must be greater than zero and \a argv must contain at least
one valid character string.
*/
-QCoreApplication::QCoreApplication(int &argc, char **argv)
- : QObject(*new QCoreApplicationPrivate(argc, argv, 0x040000))
-{
- init();
- QCoreApplicationPrivate::eventDispatcher->startingUp();
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_LIBRARY)
- // Refresh factoryloader, as text codecs are requested during lib path
- // resolving process and won't be therefore properly loaded.
- // Unknown if this is symbian specific issue.
- QFactoryLoader::refreshAll();
-#endif
-
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
- d_func()->symbianInit();
-#endif
-}
-
QCoreApplication::QCoreApplication(int &argc, char **argv, int _internal)
: QObject(*new QCoreApplicationPrivate(argc, argv, _internal))
{
@@ -2192,7 +2175,6 @@ QStringList QCoreApplication::arguments()
;
else if (l1arg == "-style" ||
l1arg == "-session" ||
- l1arg == "-graphicssystem" ||
l1arg == "-testability")
++a;
else
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 024c5096c9..929e4a9836 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -84,16 +84,7 @@ public:
#endif
};
-#if defined(QT_BUILD_CORE_LIB) || defined(qdoc)
- QCoreApplication(int &argc, char **argv); // ### Qt5 remove
-#endif
-#if !defined(qdoc)
- QCoreApplication(int &argc, char **argv, int
-#if !defined(QT_BUILD_CORE_LIB)
- = ApplicationFlags
-#endif
- );
-#endif
+ QCoreApplication(int &argc, char **argv, int = ApplicationFlags);
~QCoreApplication();
@@ -218,10 +209,13 @@ private:
friend class QEventDispatcherUNIXPrivate;
friend class QApplication;
friend class QApplicationPrivate;
+ friend class QGuiApplication;
+ friend class QGuiApplicationPrivate;
friend class QETWidget;
friend class Q3AccelManager;
friend class QShortcutMap;
friend class QWidget;
+ friend class QWidgetWindow;
friend class QWidgetPrivate;
friend bool qt_sendSpontaneousEvent(QObject*, QEvent*);
friend Q_CORE_EXPORT QString qAppName();
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 357cfd3f33..9f3c63c588 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -157,6 +157,7 @@ QObjectPrivate::QObjectPrivate(int version)
#endif
metaObject = 0;
hasGuards = false;
+ isWindow = false;
}
QObjectPrivate::~QObjectPrivate()
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 0ad73f5fe9..be2f5cbf6e 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -102,7 +102,8 @@ public:
uint inEventHandler : 1; //only used if QT_JAMBI_BUILD
uint inThreadChangeEvent : 1;
uint hasGuards : 1; //true iff there is one or more QPointer attached to this object
- uint unused : 22;
+ uint isWindow : 1; //for QWindow
+ uint unused : 21;
int postedEvents;
QMetaObject *metaObject; // assert dynamic
};
@@ -144,6 +145,7 @@ public:
void setObjectName(const QString &name);
inline bool isWidgetType() const { return d_ptr->isWidget; }
+ inline bool isWindowType() const { return d_ptr->isWindow; }
inline bool signalsBlocked() const { return d_ptr->blockSig; }
bool blockSignals(bool b);
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index 31362ffded..66a84bcce6 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -12,7 +12,7 @@ contains(QT_CONFIG, accessibility) {
accessible/qaccessiblewidget.cpp \
accessible/qaccessibleplugin.cpp
- mac:!embedded:!qpa {
+ mac:!qpa {
HEADERS += accessible/qaccessible_mac_p.h
OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \
accessible/qaccessible_mac_cocoa.mm
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index c71417352b..be3d4b5ffc 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -125,9 +125,6 @@ public:
Offscreen = 0x00010000,
Sizeable = 0x00020000,
Movable = 0x00040000,
-#ifdef QT3_SUPPORT
- Moveable = Movable,
-#endif
SelfVoicing = 0x00080000,
Focusable = 0x00100000,
Selectable = 0x00200000,
diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri
index 6ba707c9d3..472787a20c 100644
--- a/src/gui/dialogs/dialogs.pri
+++ b/src/gui/dialogs/dialogs.pri
@@ -27,7 +27,7 @@ HEADERS += \
dialogs/qwizard.h \
dialogs/qprintpreviewdialog.h
-!embedded:!qpa:mac {
+!qpa:mac {
OBJECTIVE_SOURCES += dialogs/qfiledialog_mac.mm \
dialogs/qfontdialog_mac.mm \
dialogs/qnspanelproxy_mac.mm \
@@ -61,7 +61,7 @@ win32 {
!win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library
}
-!mac:!embedded:!symbian:unix|qpa {
+!mac:!symbian:unix|qpa {
HEADERS += dialogs/qpagesetupdialog_unix_p.h
SOURCES += dialogs/qprintdialog_unix.cpp \
dialogs/qpagesetupdialog_unix.cpp
@@ -70,22 +70,6 @@ win32 {
dialogs/qprintpropertieswidget.ui
}
-embedded {
- contains(QT_CONFIG,qtopia) {
- HEADERS += dialogs/qpagesetupdialog_unix_p.h
- DEFINES += QTOPIA_PRINTDIALOG
- SOURCES += dialogs/qprintdialog_qws.cpp \
- dialogs/qpagesetupdialog_unix.cpp
- } else {
- HEADERS += dialogs/qpagesetupdialog_unix_p.h
- SOURCES += dialogs/qprintdialog_unix.cpp \
- dialogs/qpagesetupdialog_unix.cpp
- FORMS += dialogs/qprintsettingsoutput.ui \
- dialogs/qprintwidget.ui \
- dialogs/qprintpropertieswidget.ui
- }
-}
-
wince*|symbian: FORMS += dialogs/qfiledialog_embedded.ui
else: FORMS += dialogs/qfiledialog.ui
diff --git a/src/gui/dialogs/qprintdialog_qws.cpp b/src/gui/dialogs/qprintdialog_qws.cpp
deleted file mode 100644
index 373b986f0b..0000000000
--- a/src/gui/dialogs/qprintdialog_qws.cpp
+++ /dev/null
@@ -1,567 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-
-#include <private/qabstractprintdialog_p.h>
-#include "qprintdialog.h"
-
-#ifndef QT_NO_PRINTDIALOG
-
-#include "qapplication.h"
-#include "qbuttongroup.h"
-#include "qradiobutton.h"
-#include "qcombobox.h"
-#include "qspinbox.h"
-#include "qprinter.h"
-#include "qlineedit.h"
-#include "qdir.h"
-#include "qmessagebox.h"
-#include "qinputdialog.h"
-#include "qlayout.h"
-#include "qlabel.h"
-
-#include "qlibrary.h"
-
-#ifndef QT_NO_NIS
-
-#ifndef BOOL_DEFINED
-#define BOOL_DEFINED
-#endif
-
-#include <rpcsvc/ypclnt.h>
-#include <rpcsvc/yp_prot.h>
-
-#endif //QT_NO_NIS
-
-#include <ctype.h>
-#include <stdlib.h>
-
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef void (*QPrintDialogCreator)(QPrintDialog *parent);
-Q_GUI_EXPORT QPrintDialogCreator _qt_print_dialog_creator;
-
-class QPrintDialogPrivate : public QAbstractPrintDialogPrivate
-{
- Q_DECLARE_PUBLIC(QPrintDialog)
-public:
- QButtonGroup *printerOrFile;
- bool outputToFile;
- QRadioButton *printToPrinterButton;
- QRadioButton *printToFileButton;
- QLineEdit *fileName;
-
- QButtonGroup *colorMode;
- QRadioButton *printColor;
- QRadioButton *printGray;
- QPrinter::ColorMode colorMode2;
-
- QComboBox *orientationCombo, *sizeCombo;
- QPrinter::PaperSize pageSize;
- QPrinter::Orientation orientation;
-
- QSpinBox *copies;
- int numCopies;
- QPrinter::PaperSize indexToPaperSize[QPrinter::NPaperSize];
-
- QComboBox *rangeCombo;
- QSpinBox *firstPage;
- QSpinBox *lastPage;
-
- QComboBox *pageOrderCombo;
- QPrinter::PageOrder pageOrder2;
-
- QString faxNum;
-
- void init();
-
- void _q_okClicked();
- void _q_printerOrFileSelected(QAbstractButton *b);
- void _q_paperSizeSelected(int);
- void _q_orientSelected(int);
- void _q_pageOrderSelected(int);
- void _q_colorModeSelected(QAbstractButton *);
- void _q_setNumCopies(int);
- void _q_printRangeSelected(int);
- void _q_setFirstPage(int);
- void _q_setLastPage(int);
- void _q_fileNameEditChanged(const QString &text);
-
- void setupDestination();
- void setupPrinterSettings();
- void setupPaper();
- void setupOptions();
-
- void setPrinter(QPrinter *p, bool pickUpSettings);
-};
-
-static void isc(QPrintDialogPrivate *d, const QString & text,
- QPrinter::PaperSize ps);
-
-void QPrintDialogPrivate::_q_okClicked()
-{
- Q_Q(QPrintDialog);
-#ifndef QT_NO_MESSAGEBOX
- if (outputToFile && fileName->isModified() && QFileInfo(fileName->text()).exists()) {
- int confirm = QMessageBox::warning(
- q, QPrintDialog::tr("File exists"),
- QPrintDialog::tr("<qt>Do you want to overwrite it?</qt>"),
- QMessageBox::Yes, QMessageBox::No);
- if (confirm == QMessageBox::No)
- return;
- }
-#endif // QT_NO_MESSAGEBOX
-
- lastPage->interpretText();
- firstPage->interpretText();
- copies->interpretText();
- if (outputToFile) {
- printer->setOutputFileName(fileName->text());
- }
- printer->setOrientation(orientation);
- printer->setPaperSize(pageSize);
- printer->setPageOrder(pageOrder2);
- printer->setColorMode(colorMode2);
- printer->setCopyCount(numCopies);
-
- switch ((rangeCombo->itemData(rangeCombo->currentIndex())).toInt()){
- case (int)QPrintDialog::AllPages:
- q->setPrintRange(QPrintDialog::AllPages);
- q->setFromTo(0, 0);
- break;
- case (int)QPrintDialog::Selection:
- q->setPrintRange(QPrintDialog::Selection);
- q->setFromTo(0, 0);
- break;
- case (int)QPrintDialog::PageRange:
- q->setPrintRange(QPrintDialog::PageRange);
- q->setFromTo(firstPage->value(), lastPage->value());
- break;
- case (int)QPrintDialog::CurrentPage:
- q->setPrintRange(QPrintDialog::CurrentPage);
- q->setFromTo(0, 0);
- break;
- }
- q->accept();
-}
-
-void QPrintDialogPrivate::_q_printerOrFileSelected(QAbstractButton *b)
-{
- outputToFile = (b == printToFileButton);
- if (outputToFile) {
- _q_fileNameEditChanged(fileName->text());
- if (!fileName->isModified() && fileName->text().isEmpty()) {
- QString file = "print.tiff";
- fileName->setText(file);
- fileName->setCursorPosition(file.length());
- fileName->selectAll();
- fileName->setModified(true); // confirm overwrite when OK clicked
-
- }
- fileName->setEnabled(true);
- fileName->setFocus();
- } else {
- fileName->setText(QString());
- if (fileName->isEnabled())
- fileName->setEnabled(false);
- }
-}
-
-void QPrintDialogPrivate::_q_paperSizeSelected(int id)
-{
- if (id < QPrinter::NPaperSize)
- pageSize = QPrinter::PaperSize(indexToPaperSize[id]);
-}
-
-void QPrintDialogPrivate::_q_orientSelected(int id)
-{
- orientation = (QPrinter::Orientation)id;
-}
-
-void QPrintDialogPrivate::_q_pageOrderSelected(int id)
-{
- pageOrder2 = (QPrinter::PageOrder)id;
-}
-
-void QPrintDialogPrivate::_q_colorModeSelected(QAbstractButton *b)
-{
- colorMode2 = (b == printColor) ? QPrinter::Color : QPrinter::GrayScale;
-}
-
-void QPrintDialogPrivate::_q_setNumCopies(int copies)
-{
- numCopies = copies;
-}
-
-void QPrintDialogPrivate::_q_printRangeSelected(int id)
-{
- bool enable = (rangeCombo->itemData(id).toInt() == (int)QPrintDialog::PageRange);
- firstPage->setEnabled(enable);
- lastPage->setEnabled(enable);
-}
-
-void QPrintDialogPrivate::_q_setFirstPage(int fp)
-{
- Q_Q(QPrintDialog);
- if (printer) {
- lastPage->setMinimum(fp);
- lastPage->setMaximum(qMax(fp, q->maxPage()));
- }
-}
-
-void QPrintDialogPrivate::_q_setLastPage(int lp)
-{
- Q_Q(QPrintDialog);
- if (printer) {
- firstPage->setMinimum(qMin(lp, q->minPage()));
- firstPage->setMaximum(lp);
- }
-}
-
-void QPrintDialogPrivate::_q_fileNameEditChanged(const QString &text)
-{
- Q_UNUSED(text);
-}
-
-void QPrintDialogPrivate::setupDestination()
-{
- Q_Q(QPrintDialog);
-
- // print destinations
- printerOrFile = new QButtonGroup(q);
- QObject::connect(printerOrFile, SIGNAL(buttonClicked(QAbstractButton*)),
- q, SLOT(_q_printerOrFileSelected(QAbstractButton*)));
-
- printToPrinterButton = q->findChild<QRadioButton *>("printToPrinterButton");
- printerOrFile->addButton(printToPrinterButton);
- printToFileButton = q->findChild<QRadioButton *>("printToFileButton");
- printerOrFile->addButton(printToFileButton);
-
- // file name
- fileName = q->findChild<QLineEdit *>("fileName");
- QObject::connect(fileName, SIGNAL(textChanged(QString)),
- q, SLOT(_q_fileNameEditChanged(QString)));
-
- outputToFile = false;
-}
-
-void QPrintDialogPrivate::setupPrinterSettings()
-{
- Q_Q(QPrintDialog);
-
- // color mode
- colorMode = new QButtonGroup(q);
- QObject::connect(colorMode, SIGNAL(buttonClicked(QAbstractButton*)),
- q, SLOT(_q_colorModeSelected(QAbstractButton*)));
-
- printColor = q->findChild<QRadioButton *>("printColor");
- colorMode->addButton(printColor);
- printGray = q->findChild<QRadioButton *>("printGray");
- colorMode->addButton(printGray);
-}
-
-void isc(QPrintDialogPrivate *ptr, const QString & text, QPrinter::PaperSize ps)
-{
- if (ptr && !text.isEmpty() && ps < QPrinter::NPaperSize) {
- ptr->sizeCombo->addItem(text);
- int index = ptr->sizeCombo->count()-1;
- if (index >= 0 && index < QPrinter::NPaperSize)
- ptr->indexToPaperSize[index] = ps;
- }
-}
-
-void QPrintDialogPrivate::setupPaper()
-{
- Q_Q(QPrintDialog);
-
- pageSize = QPrinter::A4;
-
- // paper orientation
- orientationCombo = q->findChild<QComboBox *>("orientationCombo");
- orientation = QPrinter::Portrait;
- QObject::connect(orientationCombo, SIGNAL(activated(int)),
- q, SLOT(_q_orientSelected(int)));
-
- // paper size
- sizeCombo = q->findChild<QComboBox *>("sizeCombo");
-
- int n;
- for(n=0; n<QPrinter::NPaperSize; n++)
- indexToPaperSize[n] = QPrinter::A4;
-
- isc(this, QPrintDialog::tr("A0 (841 x 1189 mm)"), QPrinter::A0);
- isc(this, QPrintDialog::tr("A1 (594 x 841 mm)"), QPrinter::A1);
- isc(this, QPrintDialog::tr("A2 (420 x 594 mm)"), QPrinter::A2);
- isc(this, QPrintDialog::tr("A3 (297 x 420 mm)"), QPrinter::A3);
- isc(this, QPrintDialog::tr("A4 (210 x 297 mm, 8.26 x 11.7 inches)"), QPrinter::A4);
- isc(this, QPrintDialog::tr("A5 (148 x 210 mm)"), QPrinter::A5);
- isc(this, QPrintDialog::tr("A6 (105 x 148 mm)"), QPrinter::A6);
- isc(this, QPrintDialog::tr("A7 (74 x 105 mm)"), QPrinter::A7);
- isc(this, QPrintDialog::tr("A8 (52 x 74 mm)"), QPrinter::A8);
- isc(this, QPrintDialog::tr("A9 (37 x 52 mm)"), QPrinter::A9);
- isc(this, QPrintDialog::tr("B0 (1000 x 1414 mm)"), QPrinter::B0);
- isc(this, QPrintDialog::tr("B1 (707 x 1000 mm)"), QPrinter::B1);
- isc(this, QPrintDialog::tr("B2 (500 x 707 mm)"), QPrinter::B2);
- isc(this, QPrintDialog::tr("B3 (353 x 500 mm)"), QPrinter::B3);
- isc(this, QPrintDialog::tr("B4 (250 x 353 mm)"), QPrinter::B4);
- isc(this, QPrintDialog::tr("B5 (176 x 250 mm, 6.93 x 9.84 inches)"), QPrinter::B5);
- isc(this, QPrintDialog::tr("B6 (125 x 176 mm)"), QPrinter::B6);
- isc(this, QPrintDialog::tr("B7 (88 x 125 mm)"), QPrinter::B7);
- isc(this, QPrintDialog::tr("B8 (62 x 88 mm)"), QPrinter::B8);
- isc(this, QPrintDialog::tr("B9 (44 x 62 mm)"), QPrinter::B9);
- isc(this, QPrintDialog::tr("B10 (31 x 44 mm)"), QPrinter::B10);
- isc(this, QPrintDialog::tr("C5E (163 x 229 mm)"), QPrinter::C5E);
- isc(this, QPrintDialog::tr("DLE (110 x 220 mm)"), QPrinter::DLE);
- isc(this, QPrintDialog::tr("Executive (7.5 x 10 inches, 191 x 254 mm)"), QPrinter::Executive);
- isc(this, QPrintDialog::tr("Folio (210 x 330 mm)"), QPrinter::Folio);
- isc(this, QPrintDialog::tr("Ledger (432 x 279 mm)"), QPrinter::Ledger);
- isc(this, QPrintDialog::tr("Legal (8.5 x 14 inches, 216 x 356 mm)"), QPrinter::Legal);
- isc(this, QPrintDialog::tr("Letter (8.5 x 11 inches, 216 x 279 mm)"), QPrinter::Letter);
- isc(this, QPrintDialog::tr("Tabloid (279 x 432 mm)"), QPrinter::Tabloid);
- isc(this, QPrintDialog::tr("US Common #10 Envelope (105 x 241 mm)"), QPrinter::Comm10E);
-
- QObject::connect(sizeCombo, SIGNAL(activated(int)),
- q, SLOT(_q_paperSizeSelected(int)));
-}
-
-void QPrintDialogPrivate::setupOptions()
-{
- Q_Q(QPrintDialog);
-
- // no. of copies
- copies = q->findChild<QSpinBox *>("copies");
- QObject::connect(copies, SIGNAL(valueChanged(int)),
- q, SLOT(_q_setNumCopies(int)));
-
- // print range
- rangeCombo = q->findChild<QComboBox *>("rangeCombo");
- rangeCombo->addItem(QPrintDialog::tr("Print all"), QPrintDialog::AllPages);
- rangeCombo->addItem(QPrintDialog::tr("Print selection"), QPrintDialog::Selection);
- rangeCombo->addItem(QPrintDialog::tr("Print range"), QPrintDialog::PageRange);
- rangeCombo->addItem(QPrintDialog::tr("Print current page"), QPrintDialog::CurrentPage);
- QObject::connect(rangeCombo, SIGNAL(activated(int)),
- q, SLOT(_q_printRangeSelected(int)));
-
- // page range
- firstPage = q->findChild<QSpinBox *>("firstPage");
- firstPage->setRange(1, 9999);
- firstPage->setValue(1);
- QObject::connect(firstPage, SIGNAL(valueChanged(int)),
- q, SLOT(_q_setFirstPage(int)));
-
- lastPage = q->findChild<QSpinBox *>("lastPage");
- lastPage->setRange(1, 9999);
- lastPage->setValue(1);
- QObject::connect(lastPage, SIGNAL(valueChanged(int)),
- q, SLOT(_q_setLastPage(int)));
-
- // print order
- pageOrderCombo = q->findChild<QComboBox *>("pageOrderCombo");
- QObject::connect(pageOrderCombo, SIGNAL(activated(int)),
- q, SLOT(_q_pageOrderSelected(int)));
-}
-
-bool QPrintDialog::eventFilter(QObject *o, QEvent *e)
-{
- Q_UNUSED(o);
-
- Q_D(QPrintDialog);
- switch (e->type()){
- case QEvent::KeyPress:
- switch (static_cast<QKeyEvent*>(e)->key()) {
- case Qt::Key_Back:
- d->_q_okClicked();
- return true;
- }
- break;
- default:
- break;
- }
- return false;
-}
-
-QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent)
- : QAbstractPrintDialog(*(new QPrintDialogPrivate), printer, parent)
-{
- d_func()->init();
-}
-
-QPrintDialog::QPrintDialog(QWidget *parent)
- : QAbstractPrintDialog(*(new QPrintDialogPrivate), 0, parent)
-{
- d_func()->init();
-}
-
-QPrintDialog::~QPrintDialog()
-{
-}
-
-void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings)
-{
- Q_Q(QPrintDialog);
- printer = p;
-
- if (p && pickUpSettings) {
- // top to bottom in the old dialog.
- // printer or file
- outputToFile = !p->outputFileName().isEmpty() && q->isOptionEnabled(QPrintDialog::PrintToFile);
- if (outputToFile)
- printToFileButton->setChecked(true);
- else
- printToPrinterButton->setChecked(true);
- fileName->setEnabled(outputToFile);
-
- // file name
- if (q->isOptionEnabled(QPrintDialog::PrintToFile)) {
- fileName->setText(p->outputFileName());
- fileName->setModified(!fileName->text().isEmpty());
- } else {
- printToFileButton->setEnabled(false);
- }
-
- // orientation
- orientationCombo->setCurrentIndex((int)p->orientation());
- _q_orientSelected(p->orientation());
-
- // page size
- int n = 0;
- while (n < QPrinter::NPaperSize &&
- indexToPaperSize[n] != p->pageSize())
- n++;
- sizeCombo->setCurrentIndex(n);
- _q_paperSizeSelected(n);
-
- // page order
- pageOrder2 = p->pageOrder();
- pageOrderCombo->setCurrentIndex((int)pageOrder2);
-
- // color mode
- colorMode2 = p->colorMode();
- if (colorMode2 == QPrinter::Color)
- printColor->setChecked(true);
- else
- printGray->setChecked(true);
-
- // number of copies
- copies->setValue(p->copyCount());
- _q_setNumCopies(p->copyCount());
- }
-
- if (p) {
- if (!q->isOptionEnabled(QPrintDialog::PrintSelection)
- && rangeCombo->findData(QPrintDialog::Selection) > 0)
- rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::Selection));
- if (!q->isOptionEnabled(QPrintDialog::PrintPageRange)
- && rangeCombo->findData(QPrintDialog::PageRange) > 0)
- rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::PageRange));
- if (!q->isOptionEnabled(QPrintDialog::PrintCurrentPage)
- && rangeCombo->findData(QPrintDialog::CurrentPage) > 0)
- rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::CurrentPage));
-
- switch (q->printRange()) {
- case QPrintDialog::AllPages:
- rangeCombo->setCurrentIndex((int)(QPrintDialog::AllPages));
- break;
- case QPrintDialog::Selection:
- rangeCombo->setCurrentIndex((int)(QPrintDialog::Selection));
- break;
- case QPrintDialog::PageRange:
- rangeCombo->setCurrentIndex((int)(QPrintDialog::PageRange));
- break;
- case QPrintDialog::CurrentPage:
- rangeCombo->setCurrentIndex((int)(QPrintDialog::CurrentPage));
- break;
- }
- }
-
- if (p && q->maxPage()) {
- int from = q->minPage();
- int to = q->maxPage();
- if (q->printRange() == QPrintDialog::PageRange) {
- from = q->fromPage();
- to = q->toPage();
- }
- firstPage->setRange(q->minPage(), to);
- lastPage->setRange(from, q->maxPage());
- firstPage->setValue(from);
- lastPage->setValue(to);
- }
-}
-
-int QPrintDialog::exec()
-{
- Q_D(QPrintDialog);
- d->setPrinter(d->printer, true);
- return QDialog::exec();
-}
-
-void QPrintDialogPrivate::init()
-{
- Q_Q(QPrintDialog);
- numCopies = 1;
-
- if (_qt_print_dialog_creator)
- (*_qt_print_dialog_creator)(q);
-
- setupDestination();
- setupPrinterSettings();
- setupPaper();
- setupOptions();
-
- setPrinter(printer, true);
-
- q->installEventFilter(q);
-}
-
-void QPrintDialog::setVisible(bool visible)
-{
- QAbstractPrintDialog::setVisible(visible);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qprintdialog.cpp"
-#include "qrc_qprintdialog.cpp"
-
-#endif // QT_NO_PRINTDIALOG
diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp
index 5b5c49d158..c6a1474b21 100644
--- a/src/gui/dialogs/qprintdialog_unix.cpp
+++ b/src/gui/dialogs/qprintdialog_unix.cpp
@@ -726,7 +726,6 @@ void QUnixPrintWidgetPrivate::updateWidget()
if (widget.printers->count())
widget.printers->insertSeparator(widget.printers->count());
widget.printers->addItem(QPrintDialog::tr("Print to File (PDF)"));
- widget.printers->addItem(QPrintDialog::tr("Print to File (Postscript)"));
filePrintersAdded = true;
}
if (!printToFile && filePrintersAdded) {
@@ -740,8 +739,6 @@ void QUnixPrintWidgetPrivate::updateWidget()
|| printer->printerName().isEmpty()))
{
if (printer->outputFormat() == QPrinter::PdfFormat)
- widget.printers->setCurrentIndex(widget.printers->count() - 2);
- else if (printer->outputFormat() == QPrinter::PostScriptFormat)
widget.printers->setCurrentIndex(widget.printers->count() - 1);
widget.filename->setEnabled(true);
widget.lOutput->setEnabled(true);
@@ -771,19 +768,13 @@ void QUnixPrintWidgetPrivate::_q_printerChanged(int index)
if (filePrintersAdded) {
Q_ASSERT(index != printerCount - 3); // separator
- if (index > printerCount - 3) { // PDF or postscript
- bool pdfPrinter = (index == printerCount - 2);
+ if (index == printerCount - 1) { // PDF
widget.location->setText(QPrintDialog::tr("Local file"));
- widget.type->setText(QPrintDialog::tr("Write %1 file").arg(pdfPrinter ? QString::fromLatin1("PDF")
- : QString::fromLatin1("PostScript")));
+ widget.type->setText(QPrintDialog::tr("Write PDF file"));
widget.properties->setEnabled(true);
widget.filename->setEnabled(true);
QString filename = widget.filename->text();
QString suffix = QFileInfo(filename).suffix();
- if (pdfPrinter && suffix == QLatin1String("ps"))
- filename = filename.replace(QLatin1String(".ps"), QLatin1String(".pdf"));
- if (!pdfPrinter && suffix == QLatin1String("pdf"))
- filename = filename.replace(QLatin1String(".pdf"), QLatin1String(".ps"));
widget.filename->setText(filename);
widget.lOutput->setEnabled(true);
if (propertiesDialog)
@@ -852,12 +843,7 @@ void QUnixPrintWidgetPrivate::_q_btnBrowseClicked()
#endif
if (!filename.isEmpty()) {
widget.filename->setText(filename);
- if (filename.endsWith(QString::fromLatin1(".ps"), Qt::CaseInsensitive))
- widget.printers->setCurrentIndex(widget.printers->count() - 1); // the postscript one
- else if (filename.endsWith(QString::fromLatin1(".pdf"), Qt::CaseInsensitive))
- widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one
- else if (widget.printers->currentIndex() != widget.printers->count() - 1) // if ps is not selected, pdf is default
- widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one
+ widget.printers->setCurrentIndex(widget.printers->count() - 1); // the pdf one
}
}
@@ -877,20 +863,14 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties(QPrinter *p)
cur = home;
#ifdef Q_WS_X11
if (p->docName().isEmpty()) {
- if (p->outputFormat() == QPrinter::PostScriptFormat)
- cur += QLatin1String("print.ps");
- else
- cur += QLatin1String("print.pdf");
+ cur += QLatin1String("print.pdf");
} else {
QRegExp re(QString::fromLatin1("(.*)\\.\\S+"));
if (re.exactMatch(p->docName()))
cur += re.cap(1);
else
cur += p->docName();
- if (p->outputFormat() == QPrinter::PostScriptFormat)
- cur += QLatin1String(".ps");
- else
- cur += QLatin1String(".pdf");
+ cur += QLatin1String(".pdf");
}
#endif
widget.filename->setText(cur);
@@ -962,7 +942,7 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked()
propertiesDialog->applyPrinterProperties(q->printer());
if (q->isOptionEnabled(QPrintDialog::PrintToFile)
- && (widget.printers->currentIndex() > widget.printers->count() - 3)) // PDF or postscript
+ && (widget.printers->currentIndex() == widget.printers->count() - 1)) // PDF
propertiesDialog->selectPdfPsPrinter(q->printer());
else
propertiesDialog->selectPrinter();
@@ -1004,13 +984,10 @@ void QUnixPrintWidgetPrivate::setupPrinter()
const int printerCount = widget.printers->count();
const int index = widget.printers->currentIndex();
- if (filePrintersAdded && index > printerCount - 3) { // PDF or postscript
+ if (filePrintersAdded && index == printerCount - 1) { // PDF
printer->setPrinterName(QString());
Q_ASSERT(index != printerCount - 3); // separator
- if (index == printerCount - 2)
- printer->setOutputFormat(QPrinter::PdfFormat);
- else
- printer->setOutputFormat(QPrinter::PostScriptFormat);
+ printer->setOutputFormat(QPrinter::PdfFormat);
QString path = widget.filename->text();
if (QDir::isRelativePath(path))
path = QDir::homePath() + QDir::separator() + path;
diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri
index 8e8664c679..ec23da3312 100644
--- a/src/gui/egl/egl.pri
+++ b/src/gui/egl/egl.pri
@@ -25,19 +25,15 @@ contains(QT_CONFIG, egl): {
wince*: SOURCES += egl/qegl_wince.cpp
unix {
- embedded {
- SOURCES += egl/qegl_qws.cpp
- } else {
- qpa {
- SOURCES += egl/qegl_qpa.cpp
- } else {
- symbian {
- SOURCES += egl/qegl_symbian.cpp
- } else {
- SOURCES += egl/qegl_x11.cpp
- }
- }
- }
+ qpa {
+ SOURCES += egl/qegl_qpa.cpp
+ } else {
+ symbian {
+ SOURCES += egl/qegl_symbian.cpp
+ } else {
+ SOURCES += egl/qegl_x11.cpp
+ }
+ }
}
} else:symbian {
DEFINES += QT_NO_EGL
diff --git a/src/gui/egl/qegl_qpa.cpp b/src/gui/egl/qegl_qpa.cpp
index 10caf46d56..7785c03084 100644
--- a/src/gui/egl/qegl_qpa.cpp
+++ b/src/gui/egl/qegl_qpa.cpp
@@ -46,7 +46,6 @@
#if !defined(QT_NO_EGL)
-#include <QtGui/private/qgraphicssystem_p.h>
#include <QtGui/private/qapplication_p.h>
#include <QtGui/qdesktopwidget.h>
@@ -75,7 +74,7 @@ EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap)
static QPlatformScreen *screenForDevice(QPaintDevice *device)
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp
deleted file mode 100644
index 181a9f2c63..0000000000
--- a/src/gui/egl/qegl_qws.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qwidget.h>
-
-#include "qegl_p.h"
-#include "qeglcontext_p.h"
-
-#if !defined(QT_NO_EGL)
-
-#include <qscreen_qws.h>
-#include <qscreenproxy_qws.h>
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-
-QT_BEGIN_NAMESPACE
-
-static QScreen *screenForDevice(QPaintDevice *device)
-{
- QScreen *screen = qt_screen;
- if (!screen)
- return 0;
- if (screen->classId() == QScreen::MultiClass) {
- int screenNumber;
- if (device && device->devType() == QInternal::Widget)
- screenNumber = qApp->desktop()->screenNumber(static_cast<QWidget *>(device));
- else
- screenNumber = 0;
- screen = screen->subScreens()[screenNumber];
- }
- while (screen->classId() == QScreen::ProxyClass ||
- screen->classId() == QScreen::TransformedClass) {
- screen = static_cast<QProxyScreen *>(screen)->screen();
- }
- return screen;
-}
-
-// Set pixel format and other properties based on a paint device.
-void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
-{
- if (!dev)
- return;
-
- // Find the QGLScreen for this paint device.
- QScreen *screen = screenForDevice(dev);
- if (!screen)
- return;
- int devType = dev->devType();
- if (devType == QInternal::Image)
- setPixelFormat(static_cast<QImage *>(dev)->format());
- else
- setPixelFormat(screen->pixelFormat());
-}
-
-EGLNativeDisplayType QEgl::nativeDisplay()
-{
- return EGLNativeDisplayType(EGL_DEFAULT_DISPLAY);
-}
-
-EGLNativeWindowType QEgl::nativeWindow(QWidget* widget)
-{
- return (EGLNativeWindowType)(widget->winId()); // Might work
-}
-
-EGLNativePixmapType QEgl::nativePixmap(QPixmap*)
-{
- qWarning("QEgl: EGL pixmap surfaces not supported on QWS");
- return (EGLNativePixmapType)0;
-}
-
-
-QT_END_NAMESPACE
-
-#endif // !QT_NO_EGL
diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri
deleted file mode 100644
index 75d693e0b4..0000000000
--- a/src/gui/embedded/directfb.pri
+++ /dev/null
@@ -1,40 +0,0 @@
-# These defines might be necessary if your DirectFB driver doesn't
-# support all of the DirectFB API.
-#
-#DEFINES += QT_DIRECTFB_SUBSURFACE
-#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
-#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
-#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-#DEFINES += QT_DIRECTFB_IMAGECACHE
-#DEFINES += QT_NO_DIRECTFB_WM
-#DEFINES += QT_NO_DIRECTFB_LAYER
-#DEFINES += QT_DIRECTFB_PALETTE
-#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
-#DEFINES += QT_NO_DIRECTFB_MOUSE
-#DEFINES += QT_NO_DIRECTFB_KEYBOARD
-#DEFINES += QT_DIRECTFB_TIMING
-#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
-#DEFINES += QT_NO_DIRECTFB_STRETCHBLIT
-DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS|DRAW_ROUNDED_RECT|DRAW_STATICTEXT
-#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-
-HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
-
-SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
-
-
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
-LIBS += $$QT_LIBS_DIRECTFB
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
deleted file mode 100644
index 31f0bc6d50..0000000000
--- a/src/gui/embedded/embedded.pri
+++ /dev/null
@@ -1,226 +0,0 @@
-# Qt for Embedded Linux
-
-embedded {
- CONFIG -= opengl x11
- LIBS -= -dl
- KERNEL_P = kernel
-
- !mac:HEADERS += embedded/qsoundqss_qws.h
- HEADERS += \
- embedded/qcopchannel_qws.h \
- embedded/qdecoration_qws.h \
- embedded/qdecorationfactory_qws.h \
- embedded/qdecorationplugin_qws.h \
- embedded/qdirectpainter_qws.h \
- embedded/qlock_p.h \
- embedded/qscreen_qws.h \
- embedded/qscreenmulti_qws_p.h \
- embedded/qscreenproxy_qws.h \
- embedded/qwindowsystem_qws.h \
- embedded/qwindowsystem_p.h \
- embedded/qwscommand_qws_p.h \
- embedded/qwscursor_qws.h \
- embedded/qwsdisplay_qws.h \
- embedded/qwsdisplay_qws_p.h \
- embedded/qwsevent_qws.h \
- embedded/qwsmanager_qws.h \
- embedded/qwsmanager_p.h \
- embedded/qwsproperty_qws.h \
- embedded/qwsprotocolitem_qws.h \
- embedded/qtransportauth_qws.h \
- embedded/qtransportauth_qws_p.h \
- embedded/qtransportauthdefs_qws.h \
- embedded/qwssocket_qws.h \
- embedded/qwslock_p.h \
- embedded/qwsutils_qws.h \
- embedded/qwssharedmemory_p.h \
- embedded/qwssignalhandler_p.h \
- embedded/qwsembedwidget.h
-
- !mac:SOURCES += embedded/qsoundqss_qws.cpp
- SOURCES += \
- embedded/qcopchannel_qws.cpp \
- embedded/qdecoration_qws.cpp \
- embedded/qdecorationfactory_qws.cpp \
- embedded/qdecorationplugin_qws.cpp \
- embedded/qdirectpainter_qws.cpp \
- embedded/qlock.cpp \
- embedded/qscreen_qws.cpp \
- embedded/qscreenmulti_qws.cpp \
- embedded/qscreenproxy_qws.cpp \
- embedded/qwindowsystem_qws.cpp \
- embedded/qwscommand_qws.cpp \
- embedded/qwscursor_qws.cpp \
- embedded/qwsevent_qws.cpp \
- embedded/qwsmanager_qws.cpp \
- embedded/qwsproperty_qws.cpp \
- embedded/qtransportauth_qws.cpp \
- embedded/qwslock.cpp \
- embedded/qwssharedmemory.cpp \
- embedded/qwssocket_qws.cpp \
- embedded/qwssignalhandler.cpp \
- embedded/qwsembedwidget.cpp
-
- contains(QT_CONFIG,sxe)|contains(QT_CONFIG,qtopia) {
- SOURCES += embedded/qunixsocket.cpp embedded/qunixsocketserver.cpp
- HEADERS += embedded/qunixsocket_p.h embedded/qunixsocketserver_p.h
- }
-
-#
-# Decorations
-#
- contains( decorations, default ) {
- HEADERS += embedded/qdecorationdefault_qws.h
- SOURCES += embedded/qdecorationdefault_qws.cpp
- }
- contains( decorations, styled ) {
- HEADERS += embedded/qdecorationstyled_qws.h
- SOURCES += embedded/qdecorationstyled_qws.cpp
- }
-
- contains( decorations, windows ) {
- HEADERS += embedded/qdecorationwindows_qws.h
- SOURCES += embedded/qdecorationwindows_qws.cpp
- }
-
-#
-# Qt for Embedded Linux Drivers
-#
- HEADERS += embedded/qscreendriverplugin_qws.h \
- embedded/qscreendriverfactory_qws.h \
- embedded/qkbd_qws.h \
- embedded/qkbd_qws_p.h \
- embedded/qkbd_defaultmap_qws_p.h \
- embedded/qkbddriverplugin_qws.h \
- embedded/qkbddriverfactory_qws.h \
- embedded/qmouse_qws.h \
- embedded/qmousedriverplugin_qws.h \
- embedded/qmousedriverfactory_qws.h
-
- SOURCES += embedded/qscreendriverplugin_qws.cpp \
- embedded/qscreendriverfactory_qws.cpp \
- embedded/qkbd_qws.cpp \
- embedded/qkbddriverplugin_qws.cpp \
- embedded/qkbddriverfactory_qws.cpp \
- embedded/qmouse_qws.cpp \
- embedded/qmousedriverplugin_qws.cpp \
- embedded/qmousedriverfactory_qws.cpp
-
-#
-# Graphics drivers
-#
- contains( gfx-drivers, linuxfb ) {
- HEADERS += embedded/qscreenlinuxfb_qws.h
- SOURCES += embedded/qscreenlinuxfb_qws.cpp
- }
-
- contains( gfx-drivers, qnx ) {
- HEADERS += embedded/qscreenqnx_qws.h
- SOURCES += embedded/qscreenqnx_qws.cpp
- LIBS += -lgf
- }
-
- contains( gfx-drivers, integrityfb ) {
- HEADERS += embedded/qscreenintegrityfb_qws.h
- SOURCES += embedded/qscreenintegrityfb_qws.cpp
- LIBS += -lfbdev
- }
-
- contains( gfx-drivers, qvfb ) {
- HEADERS += embedded/qscreenvfb_qws.h
- SOURCES += embedded/qscreenvfb_qws.cpp
- }
-
-
- contains( gfx-drivers, vnc ) {
- VNCDIR = $$QT_SOURCE_TREE/src/plugins/gfxdrivers/vnc
- INCLUDEPATH += $$VNCDIR
- HEADERS += $$VNCDIR/qscreenvnc_qws.h \
- $$VNCDIR/qscreenvnc_p.h
- SOURCES += $$VNCDIR/qscreenvnc_qws.cpp
- }
-
- contains( gfx-drivers, transformed ) {
- HEADERS += embedded/qscreentransformed_qws.h
- SOURCES += embedded/qscreentransformed_qws.cpp
- }
-
- contains( gfx-drivers, directfb ) {
- INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb
- include($$PWD/directfb.pri)
- }
-#
-# Keyboard drivers
-#
- contains( kbd-drivers, qvfb ) {
- HEADERS +=embedded/qkbdvfb_qws.h
- SOURCES +=embedded/qkbdvfb_qws.cpp
- !contains( kbd-drivers, qvfb ) {
- kbd-drivers += qvfb
- }
- }
-
- contains( kbd-drivers, tty ) {
- HEADERS +=embedded/qkbdtty_qws.h
- SOURCES +=embedded/qkbdtty_qws.cpp
- }
-
- contains( kbd-drivers, linuxinput ) {
- HEADERS +=embedded/qkbdlinuxinput_qws.h
- SOURCES +=embedded/qkbdlinuxinput_qws.cpp
- }
-
- contains( kbd-drivers, um ) {
- HEADERS +=embedded/qkbdum_qws.h
- SOURCES +=embedded/qkbdum_qws.cpp
- }
-
- contains( kbd-drivers, qnx ) {
- HEADERS += embedded/qkbdqnx_qws.h
- SOURCES += embedded/qkbdqnx_qws.cpp
- }
-
- contains( kbd-drivers, integrity ) {
- HEADERS += embedded/qkbdintegrity_qws.h
- SOURCES += embedded/qkbdintegrity_qws.cpp
- }
-
-#
-# Mouse drivers
-#
- contains( mouse-drivers, qvfb ) {
- HEADERS +=embedded/qmousevfb_qws.h
- SOURCES +=embedded/qmousevfb_qws.cpp
- }
-
- contains( mouse-drivers, pc ) {
- HEADERS +=embedded/qmousepc_qws.h
- SOURCES +=embedded/qmousepc_qws.cpp
- }
-
- contains( mouse-drivers, linuxtp ) {
- HEADERS +=embedded/qmouselinuxtp_qws.h
- SOURCES +=embedded/qmouselinuxtp_qws.cpp
- }
-
- contains( mouse-drivers, tslib ) {
- LIBS_PRIVATE += -lts
- HEADERS +=embedded/qmousetslib_qws.h
- SOURCES +=embedded/qmousetslib_qws.cpp
- }
-
- contains( mouse-drivers, linuxinput ) {
- HEADERS +=embedded/qmouselinuxinput_qws.h
- SOURCES +=embedded/qmouselinuxinput_qws.cpp
- }
-
- contains( mouse-drivers, qnx ) {
- HEADERS += embedded/qmouseqnx_qws.h
- SOURCES += embedded/qmouseqnx_qws.cpp
- }
-
- contains( mouse-drivers, integrity ) {
- HEADERS += embedded/qmouseintegrity_qws.h
- SOURCES += embedded/qmouseintegrity_qws.cpp
- }
-}
diff --git a/src/gui/embedded/qcopchannel_qws.cpp b/src/gui/embedded/qcopchannel_qws.cpp
deleted file mode 100644
index 703debc69c..0000000000
--- a/src/gui/embedded/qcopchannel_qws.cpp
+++ /dev/null
@@ -1,608 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcopchannel_qws.h"
-
-#ifndef QT_NO_COP
-
-#include "qwsdisplay_qws.h"
-#include "qwscommand_qws_p.h"
-#include "qwindowsystem_qws.h"
-#include "qwindowsystem_p.h"
-#include "qlist.h"
-#include "qmap.h"
-#include "qdatastream.h"
-#include "qpointer.h"
-#include "qmutex.h"
-
-#include "qdebug.h"
-
-QT_BEGIN_NAMESPACE
-
-typedef QMap<QString, QList<QWSClient*> > QCopServerMap;
-static QCopServerMap *qcopServerMap = 0;
-
-class QCopServerRegexp
-{
-public:
- QCopServerRegexp( const QString& channel, QWSClient *client );
- QCopServerRegexp( const QCopServerRegexp& other );
-
- QString channel;
- QWSClient *client;
- QRegExp regexp;
-};
-
-QCopServerRegexp::QCopServerRegexp( const QString& channel, QWSClient *client )
-{
- this->channel = channel;
- this->client = client;
- this->regexp = QRegExp( channel, Qt::CaseSensitive, QRegExp::Wildcard );
-}
-
-QCopServerRegexp::QCopServerRegexp( const QCopServerRegexp& other )
-{
- channel = other.channel;
- client = other.client;
- regexp = other.regexp;
-}
-
-typedef QList<QCopServerRegexp> QCopServerRegexpList;
-static QCopServerRegexpList *qcopServerRegexpList = 0;
-
-typedef QMap<QString, QList< QPointer<QCopChannel> > > QCopClientMap;
-static QCopClientMap *qcopClientMap = 0;
-
-Q_GLOBAL_STATIC(QMutex, qcopClientMapMutex)
-
-// Determine if a channel name contains wildcard characters.
-static bool containsWildcards( const QString& channel )
-{
- return channel.contains(QLatin1Char('*'));
-}
-
-class QCopChannelPrivate
-{
-public:
- QString channel;
-};
-
-/*!
- \class QCopChannel
- \ingroup qws
-
- \brief The QCopChannel class provides communication capabilities
- between clients in \l{Qt for Embedded Linux}.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- The Qt COmmunication Protocol (QCOP) is a many-to-many protocol
- for transferring messages across registered channels. A channel is
- registered by name, and anyone who wants to can listen to the
- channel as well as send messages through it. The QCOP protocol
- allows clients to communicate both within the same address space
- and between different processes.
-
- To send messages to a given channel, QCopChannel provides the
- static send() function. Using this function alone, the messages
- are queued until Qt re-enters the event loop. To immediately flush
- all queued messages to the registered listeners, call the static
- flush() function.
-
- To listen to the traffic on a given channel, you typically
- instantiate a QCopChannel object for the given channel and connect
- to its received() signal that is emitted whenever there is
- incoming data. Use the static isRegistered() function to query
- the server for the existence of a given channel. QCopChannel
- provides the channel() function returning the name of this
- QCopChannel object's channel.
-
- In additon, QCopChannel provides the virtual receive() function
- that can be reimplemented to filter the incoming messages and
- data. The default implementation simply emits the received()
- signal.
-
- \sa QWSServer, QWSClient, {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- Constructs a QCopChannel object for the specified \a channel, with
- the given \a parent. Once created, the channel is registered by
- the server.
-
- \sa isRegistered(), channel()
-*/
-
-QCopChannel::QCopChannel(const QString& channel, QObject *parent) :
- QObject(parent)
-{
- init(channel);
-}
-
-#ifdef QT3_SUPPORT
-/*!
- Use the two argument overload instead, and call the
- QObject::setObjectName() function to \a name the instance.
-*/
-QCopChannel::QCopChannel(const QString& channel, QObject *parent, const char *name) :
- QObject(parent)
-{
- setObjectName(QString::fromAscii(name));
- init(channel);
-}
-#endif
-
-void QCopChannel::init(const QString& channel)
-{
- d = new QCopChannelPrivate;
- d->channel = channel;
-
- if (!qt_fbdpy) {
- qFatal("QCopChannel: Must construct a QApplication "
- "before QCopChannel");
- return;
- }
-
- {
- QMutexLocker locker(qcopClientMapMutex());
-
- if (!qcopClientMap)
- qcopClientMap = new QCopClientMap;
-
- // do we need a new channel list ?
- QCopClientMap::Iterator it = qcopClientMap->find(channel);
- if (it != qcopClientMap->end()) {
- it.value().append(this);
- return;
- }
-
- it = qcopClientMap->insert(channel, QList< QPointer<QCopChannel> >());
- it.value().append(QPointer<QCopChannel>(this));
- }
-
- // inform server about this channel
- qt_fbdpy->registerChannel(channel);
-}
-
-/*!
- \internal
-
- Resend all channel registrations
- */
-void QCopChannel::reregisterAll()
-{
- if(qcopClientMap)
- for(QCopClientMap::Iterator iter = qcopClientMap->begin();
- iter != qcopClientMap->end();
- ++iter)
- qt_fbdpy->registerChannel(iter.key());
-}
-
-/*!
- Destroys this QCopChannel object.
-
- The server is notified that this particular listener has closed
- its connection. The server will keep the channel open until the
- last registered listener detaches.
-
- \sa isRegistered(), channel()
-*/
-
-QCopChannel::~QCopChannel()
-{
- QMutexLocker locker(qcopClientMapMutex());
- QCopClientMap::Iterator it = qcopClientMap->find(d->channel);
- Q_ASSERT(it != qcopClientMap->end());
- it.value().removeAll(this);
- // still any clients connected locally ?
- if (it.value().isEmpty()) {
- QByteArray data;
- QDataStream s(&data, QIODevice::WriteOnly);
- s << d->channel;
- if (qt_fbdpy)
- send(QLatin1String(""), QLatin1String("detach()"), data);
- qcopClientMap->remove(d->channel);
- }
-
- delete d;
-}
-
-/*!
- Returns the name of this object's channel.
-
- \sa isRegistered()
-*/
-
-QString QCopChannel::channel() const
-{
- return d->channel;
-}
-
-/*!
- \fn void QCopChannel::receive(const QString& message, const QByteArray &data)
-
- Processes the incoming \a message and \a data.
-
- This function is called by the server when this object's channel
- receives new messages. Note that the default implementation simply
- emits the received() signal; reimplement this function to process
- the incoming \a message and \a data.
-
- Note that the format of the given \a data has to be well defined
- in order to extract the information it contains. In addition, it
- is recommended to use the DCOP convention. This is not a
- requirement, but you must ensure that the sender and receiver
- agree on the argument types. For example:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp 0
-
- The above code assumes that the \c message is a DCOP-style
- function signature and the \c data contains the function's
- arguments.
-
- \sa send(), channel(), received()
- */
-void QCopChannel::receive(const QString& msg, const QByteArray &data)
-{
- emit received(msg, data);
-}
-
-/*!
- \fn void QCopChannel::received(const QString& message, const QByteArray &data)
-
- This signal is emitted whenever this object's channel receives new
- messages (i.e., it is emitted by the receive() function), passing
- the incoming \a message and \a data as parameters.
-
- \sa receive(), channel()
-*/
-
-/*!
- Queries the server for the existence of the given \a channel. Returns true
- if the channel is registered; otherwise returns false.
-
- \sa channel(), send()
-*/
-
-bool QCopChannel::isRegistered(const QString& channel)
-{
- QByteArray data;
- QDataStream s(&data, QIODevice::WriteOnly);
- s << channel;
- if (!send(QLatin1String(""), QLatin1String("isRegistered()"), data))
- return false;
-
- QWSQCopMessageEvent *e = qt_fbdpy->waitForQCopResponse();
- bool known = e->message == "known";
- delete e;
- return known;
-}
-
-/*!
- \fn bool QCopChannel::send(const QString& channel, const QString& message)
- \overload
-*/
-
-bool QCopChannel::send(const QString& channel, const QString& msg)
-{
- QByteArray data;
- return send(channel, msg, data);
-}
-
-/*!
- \fn bool QCopChannel::send(const QString& channel, const QString& message,
- const QByteArray &data)
-
- Sends the given \a message on the specified \a channel with the
- given \a data. The message will be distributed to all clients
- subscribed to the channel. Returns true if the message is sent
- successfully; otherwise returns false.
-
- It is recommended to use the DCOP convention. This is not a
- requirement, but you must ensure that the sender and receiver
- agree on the argument types.
-
- Note that QDataStream provides a convenient way to fill the byte
- array with auxiliary data. For example:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp 1
-
- In the code above the channel is \c "System/Shell". The \c message
- is an arbitrary string, but in the example we've used the DCOP
- convention of passing a function signature. Such a signature is
- formatted as \c "functionname(types)" where \c types is a list of
- zero or more comma-separated type names, with no whitespace, no
- consts and no pointer or reference marks, i.e. no "*" or "&".
-
- \sa receive(), isRegistered()
-*/
-
-bool QCopChannel::send(const QString& channel, const QString& msg,
- const QByteArray &data)
-{
- if (!qt_fbdpy) {
- qFatal("QCopChannel::send: Must construct a QApplication "
- "before using QCopChannel");
- return false;
- }
-
- qt_fbdpy->sendMessage(channel, msg, data);
-
- return true;
-}
-
-/*!
- \since 4.2
-
- Flushes all queued messages to the registered listeners.
-
- Note that this function returns false if no QApplication has been
- constructed, otherwise it returns true.
-
- \sa send()
-
-*/
-bool QCopChannel::flush()
-{
- if (!qt_fbdpy) {
- qFatal("QCopChannel::flush: Must construct a QApplication "
- "before using QCopChannel");
- return false;
- }
-
- qt_fbdpy->flushCommands();
-
- return true;
-}
-
-class QWSServerSignalBridge : public QObject {
- Q_OBJECT
-
-public:
- void emitNewChannel(const QString& channel);
- void emitRemovedChannel(const QString& channel);
-
- signals:
- void newChannel(const QString& channel);
- void removedChannel(const QString& channel);
-};
-
-void QWSServerSignalBridge::emitNewChannel(const QString& channel){
- emit newChannel(channel);
-}
-
-void QWSServerSignalBridge::emitRemovedChannel(const QString& channel) {
- emit removedChannel(channel);
-}
-
-/*!
- \internal
- Server side: subscribe client \a cl on channel \a ch.
-*/
-
-void QCopChannel::registerChannel(const QString& ch, QWSClient *cl)
-{
- if (!qcopServerMap)
- qcopServerMap = new QCopServerMap;
-
- // do we need a new channel list ?
- QCopServerMap::Iterator it = qcopServerMap->find(ch);
- if (it == qcopServerMap->end())
- it = qcopServerMap->insert(ch, QList<QWSClient*>());
-
- // If the channel name contains wildcard characters, then we also
- // register it on the server regexp matching list.
- if (containsWildcards( ch )) {
- QCopServerRegexp item(ch, cl);
- if (!qcopServerRegexpList)
- qcopServerRegexpList = new QCopServerRegexpList;
- qcopServerRegexpList->append( item );
- }
-
- // If this is the first client in the channel, announce the channel as being created.
- if (it.value().count() == 0) {
- QWSServerSignalBridge* qwsBridge = new QWSServerSignalBridge();
- connect(qwsBridge, SIGNAL(newChannel(QString)), qwsServer, SIGNAL(newChannel(QString)));
- qwsBridge->emitNewChannel(ch);
- delete qwsBridge;
- }
-
- it.value().append(cl);
-}
-
-/*!
- \internal
- Server side: unsubscribe \a cl from all channels.
-*/
-
-void QCopChannel::detach(QWSClient *cl)
-{
- if (!qcopServerMap)
- return;
-
- QCopServerMap::Iterator it = qcopServerMap->begin();
- for (; it != qcopServerMap->end(); ++it) {
- if (it.value().contains(cl)) {
- it.value().removeAll(cl);
- // If this was the last client in the channel, announce the channel as dead.
- if (it.value().count() == 0) {
- QWSServerSignalBridge* qwsBridge = new QWSServerSignalBridge();
- connect(qwsBridge, SIGNAL(removedChannel(QString)), qwsServer, SIGNAL(removedChannel(QString)));
- qwsBridge->emitRemovedChannel(it.key());
- delete qwsBridge;
- }
- }
- }
-
- if (!qcopServerRegexpList)
- return;
-
- QCopServerRegexpList::Iterator it2 = qcopServerRegexpList->begin();
- while(it2 != qcopServerRegexpList->end()) {
- if ((*it2).client == cl)
- it2 = qcopServerRegexpList->erase(it2);
- else
- ++it2;
- }
-}
-
-/*!
- \internal
- Server side: transmit the message to all clients registered to the
- specified channel.
-*/
-
-void QCopChannel::answer(QWSClient *cl, const QString& ch,
- const QString& msg, const QByteArray &data)
-{
- // internal commands
- if (ch.isEmpty()) {
- if (msg == QLatin1String("isRegistered()")) {
- QString c;
- QDataStream s(data);
- s >> c;
- bool known = qcopServerMap && qcopServerMap->contains(c)
- && !((*qcopServerMap)[c]).isEmpty();
- // Yes, it's a typo, it's not user-visible, and we choose not to fix it for compatibility
- QLatin1String ans = QLatin1String(known ? "known" : "unknown");
- QWSServerPrivate::sendQCopEvent(cl, QLatin1String(""),
- ans, data, true);
- return;
- } else if (msg == QLatin1String("detach()")) {
- QString c;
- QDataStream s(data);
- s >> c;
- Q_ASSERT(qcopServerMap);
- QCopServerMap::Iterator it = qcopServerMap->find(c);
- if (it != qcopServerMap->end()) {
- //Q_ASSERT(it.value().contains(cl));
- it.value().removeAll(cl);
- if (it.value().isEmpty()) {
- // If this was the last client in the channel, announce the channel as dead
- QWSServerSignalBridge* qwsBridge = new QWSServerSignalBridge();
- connect(qwsBridge, SIGNAL(removedChannel(QString)), qwsServer, SIGNAL(removedChannel(QString)));
- qwsBridge->emitRemovedChannel(it.key());
- delete qwsBridge;
- qcopServerMap->erase(it);
- }
- }
- if (qcopServerRegexpList && containsWildcards(c)) {
- // Remove references to a wildcarded channel.
- QCopServerRegexpList::Iterator it
- = qcopServerRegexpList->begin();
- while(it != qcopServerRegexpList->end()) {
- if ((*it).client == cl && (*it).channel == c)
- it = qcopServerRegexpList->erase(it);
- else
- ++it;
- }
- }
- return;
- }
- qWarning("QCopChannel: unknown internal command %s", qPrintable(msg));
- QWSServerPrivate::sendQCopEvent(cl, QLatin1String(""),
- QLatin1String("bad"), data);
- return;
- }
-
- if (qcopServerMap) {
- QList<QWSClient*> clist = qcopServerMap->value(ch);
- for (int i=0; i < clist.size(); ++i) {
- QWSClient *c = clist.at(i);
- QWSServerPrivate::sendQCopEvent(c, ch, msg, data);
- }
- }
-
- if(qcopServerRegexpList && !containsWildcards(ch)) {
- // Search for wildcard matches and forward the message on.
- QCopServerRegexpList::ConstIterator it = qcopServerRegexpList->constBegin();
- for (; it != qcopServerRegexpList->constEnd(); ++it) {
- if ((*it).regexp.exactMatch(ch)) {
- QByteArray newData;
- {
- QDataStream stream
- (&newData, QIODevice::WriteOnly | QIODevice::Append);
- stream << ch;
- stream << msg;
- stream << data;
- // Stream is flushed and closed at this point.
- }
- QWSServerPrivate::sendQCopEvent
- ((*it).client, (*it).channel,
- QLatin1String("forwardedMessage(QString,QString,QByteArray)"),
- newData);
- }
- }
- }
-}
-
-/*!
- \internal
- Client side: distribute received event to the QCop instance managing the
- channel.
-*/
-void QCopChannel::sendLocally(const QString& ch, const QString& msg,
- const QByteArray &data)
-{
- Q_ASSERT(qcopClientMap);
-
- // filter out internal events
- if (ch.isEmpty())
- return;
-
- // feed local clients with received data
- QList< QPointer<QCopChannel> > clients;
- {
- QMutexLocker locker(qcopClientMapMutex());
- clients = (*qcopClientMap)[ch];
- }
- for (int i = 0; i < clients.size(); ++i) {
- QCopChannel *channel = (QCopChannel *)clients.at(i);
- if ( channel )
- channel->receive(msg, data);
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qcopchannel_qws.moc"
-
-#endif
diff --git a/src/gui/embedded/qcopchannel_qws.h b/src/gui/embedded/qcopchannel_qws.h
deleted file mode 100644
index 5f018662c7..0000000000
--- a/src/gui/embedded/qcopchannel_qws.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCOPCHANNEL_QWS_H
-#define QCOPCHANNEL_QWS_H
-
-#include <QtCore/qobject.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_COP
-
-class QWSClient;
-class QCopChannelPrivate;
-
-class Q_GUI_EXPORT QCopChannel : public QObject
-{
- Q_OBJECT
-public:
- explicit QCopChannel(const QString& channel, QObject *parent=0);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QCopChannel(const QString& channel, QObject *parent, const char *name);
-#endif
- virtual ~QCopChannel();
-
- QString channel() const;
-
- static bool isRegistered(const QString& channel);
- static bool send(const QString& channel, const QString& msg);
- static bool send(const QString& channel, const QString& msg,
- const QByteArray &data);
-
- static bool flush();
-
- static void sendLocally( const QString& ch, const QString& msg,
- const QByteArray &data);
- static void reregisterAll();
-
- virtual void receive(const QString& msg, const QByteArray &data);
-
-Q_SIGNALS:
- void received(const QString& msg, const QByteArray &data);
-
-private:
- void init(const QString& channel);
-
- // server side
- static void registerChannel(const QString& ch, QWSClient *cl);
- static void detach(QWSClient *cl);
- static void answer(QWSClient *cl, const QString& ch,
- const QString& msg, const QByteArray &data);
- // client side
- QCopChannelPrivate* d;
-
- friend class QWSServer;
- friend class QWSServerPrivate;
- friend class QApplication;
-};
-
-#endif // QT_NO_COP
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QCOPCHANNEL_QWS_H
diff --git a/src/gui/embedded/qdecoration_qws.cpp b/src/gui/embedded/qdecoration_qws.cpp
deleted file mode 100644
index 7e93407c08..0000000000
--- a/src/gui/embedded/qdecoration_qws.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdecoration_qws.h"
-
-#include "qapplication.h"
-#include "qdrawutil.h"
-#include "qpainter.h"
-#include "qregion.h"
-#include "qwhatsthis.h"
-
-#include "qmenu.h"
-#include "private/qwidget_p.h"
-#include "qwsmanager_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QDecoration
- \ingroup qws
-
- \brief The QDecoration class is a base class for window
- decorations in Qt for Embedded Linux
-
- Note that this class is non-portable and only available in
- \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides window management of top level windows
- and several ready made decorations (i.e., \c Default, \c Styled
- and \c Windows). Custom decorations can be implemented by
- subclassing the QDecoration class and creating a decoration plugin
- (derived from QDecorationPlugin). The default
- implementation of the QDecorationFactory class will automatically
- detect the plugin, and load the decoration into the application at
- run-time using Qt's \l {How to Create Qt Plugins}{plugin
- system}. To actually apply a decoration, use the
- QApplication::qwsSetDecoration() function.
-
- When creating a custom decoration, implement the paint() function
- to paint the border and title decoration, and the region()
- function to return the regions the decoration
- occupies. Reimplement the regionClicked() and
- regionDoubleClicked() functions to respond to mouse clicks (the
- default implementations responds to (single) clicks on items in a
- widget's system menu and double clicks on a widget's title).
-
- QDecoration provides the DecorationRegion enum that describes the
- various regions of the window decoration, and the regionAt()
- function to determine the region containing a given point. The
- QDecoration class also provides the DecorationState enum
- describing the state of a given region, e.g. whether it is active
- or not.
-
- In addition, it is possible to build the system menu for a given
- top level widget using the buildSysMenu() function; whenever an
- action in this menu is triggered, the menuTriggered() function is
- called automatically.
-
- Finally, the QDecoration class provides a couple of static
- functions, startMove() and startResize(), which start a move or
- resize action by making the appropriate decoration region active
- and grabbing the mouse input.
-
- \sa QDecorationFactory, QDecorationPlugin, {Qt for Embedded Linux
- Architecture}
-*/
-
-/*!
- \fn QDecoration::QDecoration()
-
- Constructs a decoration object.
-*/
-
-/*!
- \fn QDecoration::~QDecoration()
-
- Destroys this decoration object.
-*/
-
-/*!
- \enum QDecoration::DecorationRegion
-
- This enum describes the various regions of the window decoration.
-
- \value All The entire region used by the window decoration.
-
- \value Top The top border used to vertically resize the window.
- \value Bottom The bottom border used to vertically resize the window.
- \value Left The left border used to horizontally resize the window.
- \value Right The right border used to horizontally resize the window.
- \value TopLeft The top-left corner of the window used to resize the
- window both horizontally and vertically.
- \value TopRight The top-right corner of the window used to resize the
- window both horizontally and vertically.
- \value BottomLeft The bottom-left corner of the window used to resize the
- window both horizontally and vertically.
- \value BottomRight The bottom-right corner of the window used to resize the
- window both horizontally and vertically.
- \value Borders All the regions used to describe the window's borders.
-
- \value Title The region containing the window title, used
- to move the window by dragging with the mouse cursor.
- \value Close The region occupied by the close button. Clicking in this
- region closes the window.
- \value Minimize The region occupied by the minimize button. Clicking in
- this region minimizes the window.
- \value Maximize The region occupied by the maximize button. Clicking in
- this region maximizes the window.
- \value Normalize The region occupied by a button used to restore a window's
- normal size. Clicking in this region restores a maximized
- window to its previous size. The region used for this
- button is often also the Maximize region.
- \value Menu The region occupied by the window's menu button. Clicking
- in this region opens the window operations (system) menu.
- \value Help The region occupied by the window's help button. Clicking
- in this region causes the context-sensitive help function
- to be enabled.
- \value Resize The region used to resize the window.
- \value Move The region used to move the window.
- \value None No region.
-
- \sa region(), regionAt(), DecorationState
-*/
-
-/*!
- \enum QDecoration::DecorationState
-
- This enum describes the various states of a decoration region.
-
- \value Normal The region is active
- \value Disabled The region is inactive.
- \value Hover The cursor is hovering over the region.
- \value Pressed The region is pressed.
-
- \sa paint(), DecorationRegion
-*/
-
-/*!
- \fn QRegion QDecoration::region(const QWidget *widget, const QRect & rectangle, int decorationRegion)
-
- Implement this function to return the region specified by \a
- decorationRegion for the given top level \a widget.
-
- The \a rectangle parameter specifies the rectangle the decoration
- is wrapped around. The \a decorationRegion is a bitmask of the
- values described by the DecorationRegion enum.
-
- \sa regionAt(), paint()
-*/
-
-/*!
- \fn QRegion QDecoration::region(const QWidget *widget, int decorationRegion)
- \overload
-*/
-
-/*!
- \fn bool QDecoration::paint(QPainter *painter, const QWidget *widget, int decorationRegion,
- DecorationState state)
-
- Implement this function to paint the border and title decoration
- for the specified top level \a widget using the given \a painter
- and decoration \a state. The specified \a decorationRegion is a
- bitmask of the values described by the DecorationRegion enum.
-
- Note that \l{Qt for Embedded Linux} expects this function to return true if
- any of the widget's decorations are repainted; otherwise it should
- return false.
-
- \sa region()
-*/
-
-/*!
- \fn int QDecoration::regionAt(const QWidget *widget, const QPoint &point)
-
- Returns the type of the first region of the specified top level \a
- widget containing the given \a point.
-
- The return value is one of the DecorationRegion enum's values. Use
- the region() function to retrieve the actual region. If none of
- the widget's regions contain the point, this function returns \l
- None.
-
- \sa region()
-*/
-int QDecoration::regionAt(const QWidget *w, const QPoint &point)
-{
- int regions[] = {
- TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight, // Borders first
- Menu, Title, Help, Minimize, Normalize, Maximize, Close, // then buttons
- None
- };
-
-// char *regions_str[] = {
-// "TopLeft", "Top", "TopRight", "Left", "Right", "BottomLeft", "Bottom", "BottomRight",
-// "Menu", "Title", "Help", "Minimize", "Normalize", "Maximize", "Close",
-// "None"
-// };
-
- // First check to see if within all regions at all
- QRegion reg = region(w, w->geometry(), All);
- if (!reg.contains(point)) {
- return None;
- }
-
- int i = 0;
- while (regions[i]) {
- reg = region(w, w->geometry(), regions[i]);
- if (reg.contains(point)) {
-// qDebug("In region %s", regions_str[i]);
- return regions[i];
- }
- ++i;
- }
- return None;
-}
-
-#ifndef QT_NO_MENU
-/*!
- Builds the system menu for the given top level \a widget, adding
- \gui Restore, \gui Move, \gui Size, \gui Minimize, \gui Maximize
- and \gui Close actions to the given \a menu.
-
- \sa menuTriggered()
-*/
-void QDecoration::buildSysMenu(QWidget *widget, QMenu *menu)
-{
- QDecorationAction *act = new QDecorationAction(QLatin1String("Restore"),
- menu, Maximize);
- act->setEnabled(widget->windowState() & Qt::WindowMaximized);
- menu->addAction(act);
- act = new QDecorationAction(QLatin1String("Move"), menu, Move);
- act->setEnabled(!(widget->windowState() & Qt::WindowMaximized));
- menu->addAction(act);
- menu->addAction(new QDecorationAction(QLatin1String("Size"), menu, Resize));
- act = new QDecorationAction(QLatin1String("Minimize"), menu, Minimize);
- menu->addAction(act);
- act = new QDecorationAction(QLatin1String("Maximize"), menu, Maximize);
- act->setDisabled(widget->windowState() & Qt::WindowMaximized);
- menu->addAction(act);
- menu->addSeparator();
- menu->addAction(new QDecorationAction(QLatin1String("Close"), menu, Close));
-}
-
-/*!
- This function is called whenever an action in a top level widget's
- menu is triggered, and simply calls the regionClicked() function
- passing the \a widget and \a action parameters as arguments.
-
- \sa buildSysMenu()
-*/
-void QDecoration::menuTriggered(QWidget *widget, QAction *action)
-{
- QDecorationAction *decAction = static_cast<QDecorationAction *>(action);
- regionClicked(widget, decAction->reg);
-}
-#endif // QT_NO_MENU
-
-/*!
- \fn void QDecoration::regionClicked(QWidget *widget, int region)
-
- Handles the event that the specified \a region in the given top
- level \a widget is activated by a single click (the \a region
- parameter is described using the DecorationRegion enum).
-
- This function is called whenever a region in a top level widget is
- clicked; the default implementation responds to clicks on items in
- the system menu, performing the requested actions.
-
- \sa regionDoubleClicked(), region()
-*/
-void QDecoration::regionClicked(QWidget *widget, int reg)
-{
- switch(reg) {
- case Move:
- startMove(widget);
- break;
- case Resize:
- startResize(widget);
- break;
- case Help:
-#ifndef QT_NO_WHATSTHIS
- if (QWhatsThis::inWhatsThisMode())
- QWhatsThis::leaveWhatsThisMode();
- else
- QWhatsThis::enterWhatsThisMode();
-#endif
- break;
- case Close:
- widget->close();
- break;
- case Normalize:
- widget->showNormal();
- break;
- case Maximize:
- if (widget->windowState() & Qt::WindowMaximized)
- widget->showNormal();
- else
- widget->showMaximized();
- break;
- }
-}
-
-/*!
- \fn void QDecoration::regionDoubleClicked(QWidget *widget, int region)
-
- Handles the event that the specified \a region in the given top
- level \a widget is activated by a double click (the region
- parameter is described using the DecorationRegion enum).
-
- This function is called whenever a region in a top level widget is
- double clicked; the default implementation responds to a double
- click on the widget's title, toggling its size between the maximum
- and its normal size.
-
- \sa regionClicked(), region()
-*/
-void QDecoration::regionDoubleClicked(QWidget *widget, int reg)
-{
- switch(reg)
- {
- case Title: {
- if (widget->windowState() & Qt::WindowMaximized)
- widget->showNormal();
- else
- widget->showMaximized();
- break;
- }
- }
-}
-
-/*!
- Starts to move the given top level \a widget by making its \l
- Title region active and grabbing the mouse input.
-
- \sa startResize()
-*/
-void QDecoration::startMove(QWidget *widget)
-{
-#ifdef QT_NO_QWS_MANAGER
- Q_UNUSED(widget);
-#else
- QWSManager *manager = widget->d_func()->topData()->qwsManager;
- if (manager)
- manager->startMove();
-#endif
-}
-
-/*!
- Starts to resize the given top level \a widget by making its \l
- BottomRight region active and grabbing the mouse input.
-
- \sa startMove()
-*/
-void QDecoration::startResize(QWidget *widget)
-{
-#ifdef QT_NO_QWS_MANAGER
- Q_UNUSED(widget);
-#else
- QWSManager *manager = widget->d_func()->topData()->qwsManager;
- if (manager)
- manager->startResize();
-#endif
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qdecoration_qws.h b/src/gui/embedded/qdecoration_qws.h
deleted file mode 100644
index 979e15f07d..0000000000
--- a/src/gui/embedded/qdecoration_qws.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECORATION_QWS_H
-#define QDECORATION_QWS_H
-
-#include <QtGui/qregion.h>
-#include <QtGui/qwidget.h>
-#include <QtGui/qaction.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QPopupMenu;
-class QMenu;
-
-#ifndef QT_NO_ACTION
-class QDecorationAction : public QAction
-{
-public:
- QDecorationAction(const QString &text, QObject* parent, int region)
- : QAction(text, parent), reg(region) {}
- int reg;
-};
-#endif // QT_NO_ACTION
-
-/*
- Implements decoration styles
-*/
-class Q_GUI_EXPORT QDecoration
-{
-public:
- QDecoration() {}
- virtual ~QDecoration() {}
-
- /* AABBBBBBBBBBCC Items in DecorationRegion:
- AijjjjjjjklmnC
- A C A = TopLeft B = Top C = TopRight
- D E D = Left E = Right
- D E F = BottomLeft H = Bottom G = BottomRight
- F G i = Menu j = Title k = Help
- FFHHHHHHHHHHGG l = Minimize m = Maximize n = Close
-
- */
-
- enum DecorationRegion {
- None = 0x0000000000, All = 0x7fffffff,
- TopLeft = 0x0000000001, Top = 0x0000000002, TopRight = 0x0000000004,
- Left = 0x0000000008, Right = 0x0000000010,
- BottomLeft = 0x0000000020, Bottom = 0x0000000040, BottomRight = 0x0000000080,
- Borders = 0x00000000ff,
- Menu = 0x0000000100, Title = 0x0000000200, Help = 0x0000000400,
- Minimize = 0x0000000800, Maximize = 0x0000001000, Normalize = 0x0000002000,
- Close = 0x0000004000, Move = 0x0000008000, Resize = 0x0000010000
- };
-
- enum DecorationState { Normal = 0x04, Disabled = 0x08, Hover = 0x01, Pressed = 0x02 };
-
- virtual QRegion region(const QWidget *w, const QRect &rect, int decorationRegion = All ) = 0;
- QRegion region(const QWidget *w, int decorationRegion = All )
- { return region(w, w->rect(), decorationRegion); }
- virtual int regionAt(const QWidget *w, const QPoint &point);
-
- virtual void regionClicked(QWidget *widget, int region);
- virtual void regionDoubleClicked(QWidget *widget, int region);
-#ifndef QT_NO_MENU
- virtual void buildSysMenu(QWidget *widget, QMenu *menu);
- void menuTriggered(QWidget *widget, QAction *action);
-#endif
-
- static void startMove(QWidget *widget);
- static void startResize(QWidget *widget);
-
- virtual bool paint(QPainter *p, const QWidget *w, int decorationRegion = All,
- DecorationState state = Normal) = 0;
-
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QDECORATION_QWS_H
diff --git a/src/gui/embedded/qdecorationdefault_qws.cpp b/src/gui/embedded/qdecorationdefault_qws.cpp
deleted file mode 100644
index b87ac3223d..0000000000
--- a/src/gui/embedded/qdecorationdefault_qws.cpp
+++ /dev/null
@@ -1,803 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qapplication.h>
-#include <qwidget.h>
-#include <qpainter.h>
-#include <qpaintengine.h>
-#include <qdrawutil.h>
-#include "qdecorationdefault_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(QT_NO_QWS_DECORATION_DEFAULT) || defined(QT_PLUGIN)
-
-QPixmap *QDecorationDefault::staticHelpPixmap = 0;
-QPixmap *QDecorationDefault::staticMenuPixmap = 0;
-QPixmap *QDecorationDefault::staticClosePixmap = 0;
-QPixmap *QDecorationDefault::staticMinimizePixmap = 0;
-QPixmap *QDecorationDefault::staticMaximizePixmap = 0;
-QPixmap *QDecorationDefault::staticNormalizePixmap = 0;
-
-#ifndef QT_NO_IMAGEFORMAT_XPM
-
-/* XPM */
-static const char * const default_menu_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"16 16 11 1",
-/* colors */
-" c #000000",
-". c #336600",
-"X c #666600",
-"o c #99CC00",
-"O c #999933",
-"+ c #333300",
-"@ c #669900",
-"# c #999900",
-"$ c #336633",
-"% c #666633",
-"& c #99CC33",
-/* pixels */
-"oooooooooooooooo",
-"oooooooooooooooo",
-"ooooo#.++X#ooooo",
-"ooooX Xoooo",
-"oooX XO#% X&oo",
-"oo# Ooo&@O Ooo",
-"oo. Xoo#+ @X Xoo",
-"oo+ OoO+ +O# +oo",
-"oo+ #O+ +## +oo",
-"oo. %@ ++ +. Xoo",
-"oo# O@OO+ #oo",
-"oooX X##$ Ooo",
-"ooooX Xoo",
-"oooo&OX++X#OXooo",
-"oooooooooooooooo",
-"oooooooooooooooo"
-};
-
-static const char * const default_help_xpm[] = {
-"16 16 3 1",
-" s None c None",
-". c #ffffff",
-"X c #707070",
-" ",
-" ",
-" ...... ",
-" ..XXXXXX ",
-" .XX .XX ",
-" .XX .XX ",
-" ..XX ",
-" ..XX ",
-" ..XX ",
-" .XX ",
-" .XX ",
-" .. ",
-" .XX ",
-" .XX ",
-" ",
-" "};
-
-static const char * const default_close_xpm[] = {
-"16 16 3 1",
-" s None c None",
-". c #ffffff",
-"X c #707070",
-" ",
-" ",
-" .X .X ",
-" .XX .XX ",
-" .XX .XX ",
-" .XX .XX ",
-" .XX.XX ",
-" .XXX ",
-" .XXX ",
-" .XX.XX ",
-" .XX .XX ",
-" .XX .XX ",
-" .XX .XX ",
-" .X .X ",
-" ",
-" "};
-
-static const char * const default_maximize_xpm[] = {
-"16 16 3 1",
-" s None c None",
-". c #ffffff",
-"X c #707070",
-" ",
-" ",
-" ........... ",
-" .XXXXXXXXXX ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X........X ",
-" .XXXXXXXXXX ",
-" ",
-" ",
-" "};
-
-static const char * const default_minimize_xpm[] = {
-"16 16 3 1",
-" s None c None",
-". c #ffffff",
-"X c #707070",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ... ",
-" . X ",
-" .XX ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
-
-static const char * const default_normalize_xpm[] = {
-"16 16 3 1",
-" s None c None",
-". c #ffffff",
-"X c #707070",
-" ",
-" ",
-" ........ ",
-" .XXXXXXXX ",
-" .X .X ",
-" .X .X ",
-" ....X... .X ",
-" .XXXXXXXX .X ",
-" .X .XXXX ",
-" .X .X ",
-" .X .X ",
-" .X......X ",
-" .XXXXXXXX ",
-" ",
-" ",
-" "};
-
-#endif // QT_NO_IMAGEFORMAT_XPM
-
-/*!
- \class QDecorationDefault
- \since 4.4
- \ingroup qws
- \brief The QDecorationDefault class is a base class providing default window decorations.
-
- See the documentation for class QDecoration for a detailed
- description. This subclass of QDecoration provides standard
- icons for the decoration regions.
-
- Note that this class is non-portable and only available in
- \l{Qt for Embedded Linux}.
- */
-
-/*!
- Default constructor.
- */
-QDecorationDefault::QDecorationDefault()
- : QDecoration()
-{
- menu_width = 20;
- help_width = 20;
- close_width = 20;
- minimize_width = 20;
- maximize_width = 20;
- normalize_width = 20;
-}
-
-/*!
- The constructor deletes the static pixmaps.
- */
-QDecorationDefault::~QDecorationDefault()
-{
- delete staticMenuPixmap;
- delete staticClosePixmap;
- delete staticMinimizePixmap;
- delete staticMaximizePixmap;
- delete staticNormalizePixmap;
-
- // This makes it safe to delete and then create a QDecorationDefault
- staticMenuPixmap = 0;
- staticClosePixmap = 0;
- staticMinimizePixmap = 0;
- staticMaximizePixmap = 0;
- staticNormalizePixmap = 0;
-}
-
-/*!
- \fn const char **QDecorationDefault::xpmForRegion(int region)
-
- Returns a pointer to the X pixmap for the icon specified by
- \a region. An X pixmap is an ASCII-text-based image. The value
- of \a region must be one of a subset of the values of enum
- DecorationRegion. The supported values are \e Help, \e Menu,
- \e Close, \e Minimize, \e Maximize, and \e Normalize. Other
- values of \a region cause zero to be returned.
-
- \sa QDecoration::DecorationRegion
- */
-const char **QDecorationDefault::xpmForRegion(int reg)
-{
-#ifdef QT_NO_IMAGEFORMAT_XPM
- Q_UNUSED(reg);
-#else
- switch(reg)
- {
- case Help:
- return (const char **)default_help_xpm;
- case Menu:
- return (const char **)default_menu_xpm;
- case Close:
- return (const char **)default_close_xpm;
- case Minimize:
- return (const char **)default_minimize_xpm;
- case Maximize:
- return (const char **)default_maximize_xpm;
- case Normalize:
- return (const char **)default_normalize_xpm;
- }
-#endif
- return 0;
-}
-
-/*!
- \fn QPixmap QDecorationDefault::pixmapFor(const QWidget *widget,
- int decorationRegion, int &xoff, int &yoff)
-
- Returns a pointer to the QPixmap for the widget specified by \a widget and
- \a decorationRegion. The returned QPixmap is constructed from the default
- X pixmap obtained from xpmForRegion().
-
- \a xoff and \a yoff specify the offset for the pixmap.
-
- The value of \a decorationRegion must be one of a subset of the values
- of enum DecorationRegion. The supported values are \e Help,
- \e Menu, \e Close, \e Minimize, \e Maximize, and \e Normalize.
- Other values of \a decorationRegion return 0.
-
- \sa QDecoration::DecorationRegion
-*/
-QPixmap QDecorationDefault::pixmapFor(const QWidget *widget,
- int decorationRegion,
- int &xoff,
- int &/*yoff*/)
-{
-#ifdef QT_NO_IMAGEFORMAT_XPM
- Q_UNUSED(widget);
- Q_UNUSED(decorationRegion);
- Q_UNUSED(xoff);
- return QPixmap();
-#else
- static const char **staticHelpPixmapXPM = 0;
- static const char **staticMenuPixmapXPM = 0;
- static const char **staticClosePixmapXPM = 0;
- static const char **staticMinimizePixmapXPM = 0;
- static const char **staticMaximizePixmapXPM = 0;
- static const char **staticNormalizePixmapXPM = 0;
- const char **xpm;
-
- // Why don't we just use/extend the enum type...
-
- if (staticHelpPixmapXPM != (xpm = xpmForRegion(Help)) || !staticHelpPixmap) {
- staticHelpPixmapXPM = xpm;
- staticHelpPixmap = new QPixmap(xpm);
- }
- if (staticMenuPixmapXPM != (xpm = xpmForRegion(Menu)) || !staticMenuPixmap) {
- staticMenuPixmapXPM = xpm;
- staticMenuPixmap = new QPixmap(xpm);
- }
- if (staticClosePixmapXPM != (xpm = xpmForRegion(Close)) || !staticClosePixmap) {
- staticClosePixmapXPM = xpm;
- staticClosePixmap = new QPixmap(xpm);
- }
- if (staticMinimizePixmapXPM != (xpm = xpmForRegion(Minimize)) || !staticMinimizePixmap) {
- staticMinimizePixmapXPM = xpm;
- staticMinimizePixmap = new QPixmap(xpm);
- }
- if (staticMaximizePixmapXPM != (xpm = xpmForRegion(Maximize)) || !staticMaximizePixmap) {
- staticMaximizePixmapXPM = xpm;
- staticMaximizePixmap = new QPixmap(xpm);
- }
- if (staticNormalizePixmapXPM != (xpm = xpmForRegion(Normalize)) || !staticNormalizePixmap) {
- staticNormalizePixmapXPM = xpm;
- staticNormalizePixmap = new QPixmap(xpm);
- }
-
- const QPixmap *pm = 0;
-
- switch (decorationRegion) {
- case Help:
- pm = staticHelpPixmap;
- break;
- case Menu:
- if (!widget->windowIcon().isNull())
- return widget->windowIcon().pixmap(16,16); //##### QIcon::pixmap() needs a size !!!!!!"
- if (!pm) {
- xoff = 1;
- pm = staticMenuPixmap;
- }
- break;
- case Close:
- pm = staticClosePixmap;
- break;
- case Maximize:
- pm = staticMaximizePixmap;
- break;
- case Normalize:
- pm = staticNormalizePixmap;
- break;
- case Minimize:
- pm = staticMinimizePixmap;
- break;
- default:
- break;
- }
- return *pm;
-#endif
-}
-
-/*!
- \fn int QDecorationDefault::titleBarHeight(const QWidget *widget)
-
- Returns the title bar height in pixels for the given \a widget. It is the
- greater of 20, or the sum of the application font's line spacing value
- plus a border width fudge factor.
-*/
-int QDecorationDefault::titleBarHeight(const QWidget *)
-{
- return qMax(20, QApplication::fontMetrics().height() + BORDER_WIDTH);
-}
-
-/*!
- Returns the region specified by \a decorationRegion for the
- top-level \a widget. \a rect specifies the rectangle the decoration
- wraps. The value of \a decorationRegion is a combination of the
- bitmask values of enum DecorationRegion.
- */
-QRegion QDecorationDefault::region(const QWidget *widget,
- const QRect &rect,
- int decorationRegion)
-{
- Qt::WindowFlags flags = widget->windowFlags();
- bool hasBorder = !widget->isMaximized();
- bool hasTitle = flags & Qt::WindowTitleHint;
- bool hasSysMenu = flags & Qt::WindowSystemMenuHint;
- bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint;
- bool hasMinimize = flags & Qt::WindowMinimizeButtonHint;
- bool hasMaximize = flags & Qt::WindowMaximizeButtonHint;
- int state = widget->windowState();
- bool isMinimized = state & Qt::WindowMinimized;
- bool isMaximized = state & Qt::WindowMaximized;
-
- int titleHeight = hasTitle ? titleBarHeight(widget) : 0;
- int bw = hasBorder ? BORDER_WIDTH : 0;
- int bbw = hasBorder ? BOTTOM_BORDER_WIDTH : 0;
-
- QRegion region;
- switch (decorationRegion) {
- case All: {
- QRect r(rect.left() - bw,
- rect.top() - titleHeight - bw,
- rect.width() + 2 * bw,
- rect.height() + titleHeight + bw + bbw);
- region = r;
- region -= rect;
- }
- break;
-
- case Title: {
- QRect r(rect.left()
- + (hasSysMenu ? menu_width : 0),
- rect.top() - titleHeight,
- rect.width()
- - (hasSysMenu ? menu_width : 0)
- - close_width
- - (hasMaximize ? maximize_width : 0)
- - (hasMinimize ? minimize_width : 0)
- - (hasContextHelp ? help_width : 0),
-
- titleHeight);
- if (r.width() > 0)
- region = r;
- }
- break;
-
- case Top: {
- QRect r(rect.left() + CORNER_GRAB,
- rect.top() - titleHeight - bw,
- rect.width() - 2 * CORNER_GRAB,
- bw);
- region = r;
- }
- break;
-
- case Left: {
- QRect r(rect.left() - bw,
- rect.top() - titleHeight + CORNER_GRAB,
- bw,
- rect.height() + titleHeight - 2 * CORNER_GRAB);
- region = r;
- }
- break;
-
- case Right: {
- QRect r(rect.right() + 1,
- rect.top() - titleHeight + CORNER_GRAB,
- bw,
- rect.height() + titleHeight - 2 * CORNER_GRAB);
- region = r;
- }
- break;
-
- case Bottom: {
- QRect r(rect.left() + CORNER_GRAB,
- rect.bottom() + 1,
- rect.width() - 2 * CORNER_GRAB,
- bw);
- region = r;
- }
- break;
-
- case TopLeft: {
- QRect r1(rect.left() - bw,
- rect.top() - bw - titleHeight,
- CORNER_GRAB + bw,
- bw);
-
- QRect r2(rect.left() - bw,
- rect.top() - bw - titleHeight,
- bw,
- CORNER_GRAB + bw);
-
- region = QRegion(r1) + r2;
- }
- break;
-
- case TopRight: {
- QRect r1(rect.right() - CORNER_GRAB,
- rect.top() - bw - titleHeight,
- CORNER_GRAB + bw,
- bw);
-
- QRect r2(rect.right() + 1,
- rect.top() - bw - titleHeight,
- bw,
- CORNER_GRAB + bw);
-
- region = QRegion(r1) + r2;
- }
- break;
-
- case BottomLeft: {
- QRect r1(rect.left() - bw,
- rect.bottom() + 1,
- CORNER_GRAB + bw,
- bw);
-
- QRect r2(rect.left() - bw,
- rect.bottom() - CORNER_GRAB,
- bw,
- CORNER_GRAB + bw);
- region = QRegion(r1) + r2;
- }
- break;
-
- case BottomRight: {
- QRect r1(rect.right() - CORNER_GRAB,
- rect.bottom() + 1,
- CORNER_GRAB + bw,
- bw);
-
- QRect r2(rect.right() + 1,
- rect.bottom() - CORNER_GRAB,
- bw,
- CORNER_GRAB + bw);
- region = QRegion(r1) + r2;
- }
- break;
-
- case Menu: {
- if (hasSysMenu) {
- region = QRect(rect.left(), rect.top() - titleHeight,
- menu_width, titleHeight);
- }
- }
- break;
-
- case Help: {
- if (hasContextHelp) {
- QRect r(rect.right()
- - close_width
- - (hasMaximize ? maximize_width : 0)
- - (hasMinimize ? minimize_width : 0)
- - help_width + 1, rect.top() - titleHeight,
- help_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
-
- case Minimize: {
- if (hasMinimize && !isMinimized) {
- QRect r(rect.right() - close_width
- - (hasMaximize ? maximize_width : 0)
- - minimize_width + 1, rect.top() - titleHeight,
- minimize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
- case Maximize: {
- if (hasMaximize && !isMaximized) {
- QRect r(rect.right() - close_width - maximize_width + 1,
- rect.top() - titleHeight, maximize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
- case Normalize: {
- if (hasMinimize && isMinimized) {
- QRect r(rect.right() - close_width
- - (hasMaximize ? maximize_width : 0)
- - minimize_width + 1, rect.top() - titleHeight,
- minimize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- } else if (hasMaximize && isMaximized) {
- QRect r(rect.right() - close_width - maximize_width + 1,
- rect.top() - titleHeight, maximize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
- case Close: {
- QRect r(rect.right() - close_width + 1, rect.top() - titleHeight,
- close_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- break;
-
- default: {
- int i = 1;
- while (i) {
- if (i & decorationRegion)
- region += this->region(widget, rect, i);
- i <<= 1;
- }
- }
- break;
- }
-
- return region;
-}
-
-/*!
- Paints the border and title decoration for the top-level \a widget
- using the \a painter provided and the decoration \a state. The value
- of \a decorationRegion is a combination of the bitmask values of
- enum DecorationRegion.
-
- Note that Qt for Embedded Linux expects this function to return true if any of
- the widget's decorations are repainted; otherwise it returns false.
- */
-bool QDecorationDefault::paint(QPainter *painter,
- const QWidget *widget,
- int decorationRegion,
- DecorationState state)
-{
- if (decorationRegion == None)
- return false;
-
- const QRect titleRect = QDecoration::region(widget, Title).boundingRect();
- const QPalette pal = QApplication::palette();
- int titleHeight = titleRect.height();
- int titleWidth = titleRect.width();
- QRegion oldClipRegion = painter->clipRegion();
-
-
- Qt::WindowFlags flags = widget->windowFlags();
- bool hasBorder = !widget->isMaximized();
- bool hasTitle = flags & Qt::WindowTitleHint;
- bool hasSysMenu = flags & Qt::WindowSystemMenuHint;
- bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint;
- bool hasMinimize = flags & Qt::WindowMinimizeButtonHint;
- bool hasMaximize = flags & Qt::WindowMaximizeButtonHint;
-
- bool paintAll = (decorationRegion == int(All));
- bool handled = false;
-
- bool porterDuff = painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff);
-
- if ((paintAll || decorationRegion & Borders) && state == Normal && hasBorder) {
- if (hasTitle) { // reduce flicker
- QRect rect(widget->rect());
- QRect r(rect.left(), rect.top() - titleHeight,
- rect.width(), titleHeight);
- painter->setClipRegion(oldClipRegion - r);
- }
- QRect br = QDecoration::region(widget).boundingRect();
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_Source);
- qDrawWinPanel(painter, br.x(), br.y(), br.width(),
- br.height(), pal, false,
- &pal.brush(QPalette::Window));
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
- handled |= true;
- }
-
- if ((paintAll || decorationRegion & Title && titleWidth > 0) && state == Normal && hasTitle) {
- painter->setClipRegion(oldClipRegion);
- QBrush titleBrush;
- QPen titlePen;
-
- if (widget == qApp->activeWindow()) {
- titleBrush = pal.brush(QPalette::Highlight);
- titlePen = pal.color(QPalette::HighlightedText);
- } else {
- titleBrush = pal.brush(QPalette::Window);
- titlePen = pal.color(QPalette::Text);
- }
-
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_Source);
- qDrawShadePanel(painter,
- titleRect.x(), titleRect.y(), titleRect.width(), titleRect.height(),
- pal, true, 1, &titleBrush);
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
-
- painter->setPen(titlePen);
- painter->drawText(titleRect.x() + 4, titleRect.y(),
- titleRect.width() - 8, titleRect.height(),
- Qt::AlignVCenter, windowTitleFor(widget));
- handled |= true;
- }
-
- if (state != Hover) {
- painter->setClipRegion(oldClipRegion);
- if ((paintAll || decorationRegion & Menu) && hasSysMenu) {
- paintButton(painter, widget, Menu, state, pal);
- handled |= true;
- }
-
- if ((paintAll || decorationRegion & Help) && hasContextHelp) {
- paintButton(painter, widget, Help, state, pal);
- handled |= true;
- }
-
- if ((paintAll || decorationRegion & Minimize) && hasMinimize) {
- paintButton(painter, widget, Minimize, state, pal);
- handled |= true;
- }
-
- if ((paintAll || decorationRegion & Maximize) && hasMaximize) {
- paintButton(painter, widget,
- ((widget->windowState() & Qt::WindowMaximized)? Normalize : Maximize),
- state, pal);
- handled |= true;
- }
-
- if (paintAll || decorationRegion & Close) {
- paintButton(painter, widget, Close, state, pal);
- handled |= true;
- }
- }
- return handled;
-}
-
-/*!
- \fn void QDecorationDefault::paintButton(QPainter *painter, const
- QWidget *widget, int buttonRegion, DecorationState state,
- const QPalette &palette)
-
- Paints a region of the top-level \a widget. The region is
- painted in the specified decoration \a state using the
- \a painter and \a palette provided. The region to be painted is specified
- by \a buttonRegion, which is a combination of the bitmask values of
- DecorationRegion. If the value of \a buttonRegion is one of \e Help,
- \e Menu, \e Close, \e Minimize, \e Maximize, and \e Normalize, the
- button pixmap for that region is painted.
-
- \sa pixmapFor()
- */
-void QDecorationDefault::paintButton(QPainter *painter,
- const QWidget *widget,
- int buttonRegion,
- DecorationState state,
- const QPalette &pal)
-{
- int xoff = 2;
- int yoff = 2;
-
- const QPixmap pm = pixmapFor(widget, buttonRegion, xoff, yoff);
- QRect brect(QDecoration::region(widget, buttonRegion).boundingRect());
- bool porterDuff = painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff);
-
- if (state & QDecoration::Pressed) {
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_Source);
- qDrawWinPanel(painter, brect, pal, true, &pal.brush(QPalette::Window));
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
- ++xoff;
- ++yoff;
- } else {
- painter->fillRect(brect, pal.brush(QPalette::Window));
- }
-
- if (!pm.isNull())
- painter->drawPixmap(brect.x() + xoff, brect.y() + yoff, pm);
-}
-
-extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*);
-
-/*!
- \internal
- */
-QString QDecorationDefault::windowTitleFor(const QWidget *widget) const
-{
- return qt_setWindowTitle_helperHelper(widget->windowTitle(), widget);
-}
-
-#endif // QT_NO_QWS_DECORATION_DEFAULT
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qdecorationdefault_qws.h b/src/gui/embedded/qdecorationdefault_qws.h
deleted file mode 100644
index a166220913..0000000000
--- a/src/gui/embedded/qdecorationdefault_qws.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECORATIONDEFAULT_QWS_H
-#define QDECORATIONDEFAULT_QWS_H
-
-#include <QtGui/qdecoration_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if !defined(QT_NO_QWS_DECORATION_DEFAULT) || defined(QT_PLUGIN)
-
-#define CORNER_GRAB 16
-#define BORDER_WIDTH 4
-#define BOTTOM_BORDER_WIDTH BORDER_WIDTH
-
-class Q_GUI_EXPORT QDecorationDefault : public QDecoration
-{
-public:
- QDecorationDefault();
- virtual ~QDecorationDefault();
-
- virtual QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All);
- virtual bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All,
- DecorationState state = Normal);
-
-protected:
- virtual int titleBarHeight(const QWidget *widget);
-
- virtual void paintButton(QPainter *painter, const QWidget *widget, int buttonRegion,
- DecorationState state, const QPalette &pal);
- virtual QPixmap pixmapFor(const QWidget *widget, int decorationRegion, int &xoff, int &yoff);
- virtual const char **xpmForRegion(int region);
-
- QString windowTitleFor(const QWidget *widget) const;
-
- int menu_width;
- int help_width;
- int close_width;
- int minimize_width;
- int maximize_width;
- int normalize_width;
-
-private:
- static QPixmap *staticHelpPixmap;
- static QPixmap *staticMenuPixmap;
- static QPixmap *staticClosePixmap;
- static QPixmap *staticMinimizePixmap;
- static QPixmap *staticMaximizePixmap;
- static QPixmap *staticNormalizePixmap;
-
-};
-
-
-QT_END_NAMESPACE
-#endif // QT_NO_QWS_DECORATION_DEFAULT
-QT_END_HEADER
-
-#endif // QDECORATIONDEFAULT_QWS_H
diff --git a/src/gui/embedded/qdecorationfactory_qws.cpp b/src/gui/embedded/qdecorationfactory_qws.cpp
deleted file mode 100644
index 2cae140ac0..0000000000
--- a/src/gui/embedded/qdecorationfactory_qws.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdecorationfactory_qws.h"
-#include "qdecorationplugin_qws.h"
-#include "private/qfactoryloader_p.h"
-#include "qmutex.h"
-
-#include "qapplication.h"
-#include "qdecorationdefault_qws.h"
-#include "qdecorationwindows_qws.h"
-#include "qdecorationstyled_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QDecorationFactoryInterface_iid,
- QLatin1String("/decorations"), Qt::CaseInsensitive))
-#endif
-
-
-
-/*!
- \class QDecorationFactory
- \ingroup qws
- \ingroup appearance
-
- \brief The QDecorationFactory class creates window decorations in
- Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QDecorationFactory is used to detect and instantiate the available
- decorations, allowing \l{Qt for Embedded Linux} to load the preferred
- decoration into the application at runtime. The create() function
- returns a QDecoration object representing the decoration
- identified by a given key. The valid keys (i.e. the supported
- decorations) can be retrieved using the keys() function.
-
- \l{Qt for Embedded Linux} provides three built-in decorations: \c Default,
- \c Styled and \c Windows. In addition, custom decorations can be
- added using Qt's \l {How to Create Qt Plugins}{plugin mechanism},
- i.e. by subclassing the QDecoration class and creating a mouse
- driver plugin (QDecorationPlugin).
-
- \sa QDecoration, QDecorationPlugin
-*/
-
-/*!
- Creates the decoration specified by the given \a key. Note that
- the keys are case-insensitive.
-
- \sa keys()
-*/
-
-QDecoration *QDecorationFactory::create(const QString& key)
-{
- QDecoration *ret = 0;
- QString decoration = key.toLower();
-#ifndef QT_NO_QWS_DECORATION_DEFAULT
- if (decoration == QLatin1String("default"))
- ret = new QDecorationDefault;
- else
-#endif
-#ifndef QT_NO_QWS_DECORATION_WINDOWS
- if (decoration == QLatin1String("windows"))
- ret = new QDecorationWindows;
- else
-#endif
-#ifndef QT_NO_QWS_DECORATION_STYLED
- if (decoration == QLatin1String("styled"))
- ret = new QDecorationStyled;
- else
-#endif
- { } // Keep these here - they make the #ifdefery above work
-#ifndef QT_NO_LIBRARY
- if (!ret) {
- if (QDecorationFactoryInterface *factory = qobject_cast<QDecorationFactoryInterface*>(loader()->instance(decoration))) {
- ret = factory->create(decoration);
- }
- }
-#endif
- return ret;
-}
-
-/*!
- Returns the list of valid keys, i.e., the available decorations.
-
- \sa create()
-*/
-QStringList QDecorationFactory::keys()
-{
- QStringList list;
-#ifndef QT_NO_QWS_DECORATION_STYLED
- list << QLatin1String("Styled");
-#endif
-#ifndef QT_NO_QWS_DECORATION_DEFAULT
- list << QLatin1String("Default");
-#endif
-#ifndef QT_NO_QWS_DECORATION_WINDOWS
- list << QLatin1String("Windows");
-#endif
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
- QStringList plugins = loader()->keys();
- for (int i = 0; i < plugins.size(); ++i) {
- if (!list.contains(plugins.at(i)))
- list += plugins.at(i);
- }
-#endif //QT_NO_LIBRARY
-#endif //QT_MAKEDLL
-
- return list;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qdecorationfactory_qws.h b/src/gui/embedded/qdecorationfactory_qws.h
deleted file mode 100644
index c5995eeb02..0000000000
--- a/src/gui/embedded/qdecorationfactory_qws.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECORATIONFACTORY_QWS_H
-#define QDECORATIONFACTORY_QWS_H
-
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QDecoration;
-
-class Q_GUI_EXPORT QDecorationFactory
-{
-public:
- static QStringList keys();
- static QDecoration *create(const QString&);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QDECORATIONFACTORY_QWS_H
diff --git a/src/gui/embedded/qdecorationplugin_qws.cpp b/src/gui/embedded/qdecorationplugin_qws.cpp
deleted file mode 100644
index 869243151f..0000000000
--- a/src/gui/embedded/qdecorationplugin_qws.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdecorationplugin_qws.h"
-#include "qdecoration_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QDecorationPlugin
- \ingroup qws
- \ingroup plugins
-
- \brief The QDecorationPlugin class is an abstract base class for
- window decoration plugins in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides three ready-made decoration styles: \c
- Default, \c Styled and \c Windows. Custom decorations can be
- implemented by subclassing the QDecoration class and creating a
- decoration plugin.
-
- A decoration plugin can be created by subclassing
- QDecorationPlugin and implementing the pure virtual keys() and
- create() functions. By exporting the derived class using the
- Q_EXPORT_PLUGIN2() macro, the default implementation of the
- QDecorationFactory class will automatically detect the plugin and
- load the driver into the application at run-time. See \l{How to
- Create Qt Plugins} for details.
-
- To actually apply a decoration, use the
- QApplication::qwsSetDecoration() function.
-
- \sa QDecoration, QDecorationFactory
-*/
-
-/*!
- \fn QStringList QDecorationPlugin::keys() const
-
- Returns the list of valid keys, i.e., the decorations supported by
- this plugin.
-
- \sa create()
-*/
-
-/*!
- \fn QDecoration *QDecorationPlugin::create(const QString &key)
-
- Creates a decoration matching the given \a key. Note that keys are
- case-insensitive.
-
- \sa keys()
-*/
-
-/*!
- Constructs a decoration plugin with the given \a parent.
-
- Note that this constructor is invoked automatically by the
- Q_EXPORT_PLUGIN2() macro, so there is no need for calling it
- explicitly.
-*/
-QDecorationPlugin::QDecorationPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys the decoration plugin.
-
- Note that Qt destroys a plugin automatically when it is no longer
- used, so there is no need for calling the destructor explicitly.
-*/
-QDecorationPlugin::~QDecorationPlugin()
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qdecorationplugin_qws.h b/src/gui/embedded/qdecorationplugin_qws.h
deleted file mode 100644
index 4fa97f36f1..0000000000
--- a/src/gui/embedded/qdecorationplugin_qws.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECORATIONPLUGIN_QWS_H
-#define QDECORATIONPLUGIN_QWS_H
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QDecoration;
-
-struct Q_GUI_EXPORT QDecorationFactoryInterface : public QFactoryInterface
-{
- virtual QDecoration *create(const QString &key) = 0;
-};
-
-#define QDecorationFactoryInterface_iid "com.trolltech.Qt.QDecorationFactoryInterface"
-Q_DECLARE_INTERFACE(QDecorationFactoryInterface, QDecorationFactoryInterface_iid)
-
-class Q_GUI_EXPORT QDecorationPlugin : public QObject, public QDecorationFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QDecorationFactoryInterface:QFactoryInterface)
- public:
- explicit QDecorationPlugin(QObject *parent = 0);
- ~QDecorationPlugin();
-
- virtual QStringList keys() const = 0;
- virtual QDecoration *create(const QString &key) = 0;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QDECORATIONPLUGIN_QWS_H
diff --git a/src/gui/embedded/qdecorationstyled_qws.cpp b/src/gui/embedded/qdecorationstyled_qws.cpp
deleted file mode 100644
index 40da4c2583..0000000000
--- a/src/gui/embedded/qdecorationstyled_qws.cpp
+++ /dev/null
@@ -1,313 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qapplication.h>
-#include <qwidget.h>
-#include <qpainter.h>
-#include <qdrawutil.h>
-#include "qdecorationstyled_qws.h"
-#include "qstyle.h"
-#include "qstyleoption.h"
-#include "qpaintengine.h"
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(QT_NO_QWS_DECORATION_STYLED) || defined(QT_PLUGIN)
-
-QDecorationStyled::QDecorationStyled()
- : QDecorationDefault()
-{
-}
-
-QDecorationStyled::~QDecorationStyled()
-{
-}
-
-int QDecorationStyled::titleBarHeight(const QWidget *widget)
-{
- QStyleOptionTitleBar opt;
- opt.subControls = QStyle::SC_TitleBarLabel
- | QStyle::SC_TitleBarSysMenu
- | QStyle::SC_TitleBarNormalButton
- | QStyle::SC_TitleBarContextHelpButton
- | QStyle::SC_TitleBarMinButton
- | QStyle::SC_TitleBarMaxButton
- | QStyle::SC_TitleBarCloseButton;
- opt.titleBarFlags = widget->windowFlags();
- opt.direction = QApplication::layoutDirection();
- opt.text = windowTitleFor(widget);
- opt.icon = widget->windowIcon();
- opt.rect = widget->rect();
-
- QStyle *style = QApplication::style();
- if (!style)
- return 18;
-
- return style->pixelMetric(QStyle::PM_TitleBarHeight, &opt, 0);
-}
-
-bool QDecorationStyled::paint(QPainter *painter, const QWidget *widget, int decorationRegion,
- DecorationState state)
-{
- if (decorationRegion == None)
- return false;
-
- bool isActive = (widget == qApp->activeWindow());
- QPalette pal = qApp->palette();
- //ideally, the difference between Active and Inactive should be enough, so we shouldn't need to test this
- if (!isActive) {
- //pal.setCurrentColorGroup(QPalette::Disabled); //Can't do this either, because of palette limitations
- //copied from Q3TitleBar:
- pal.setColor(QPalette::Inactive, QPalette::Highlight,
- pal.color(QPalette::Inactive, QPalette::Dark));
- pal.setColor(QPalette::Inactive, QPalette::Base,
- pal.color(QPalette::Inactive, QPalette::Dark));
- pal.setColor(QPalette::Inactive, QPalette::HighlightedText,
- pal.color(QPalette::Inactive, QPalette::Window));
- }
-
- Qt::WindowFlags flags = widget->windowFlags();
- bool hasBorder = !widget->isMaximized();
- bool hasTitle = flags & Qt::WindowTitleHint;
- bool hasSysMenu = flags & Qt::WindowSystemMenuHint;
- bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint;
- bool hasMinimize = flags & Qt::WindowMinimizeButtonHint;
- bool hasMaximize = flags & Qt::WindowMaximizeButtonHint;
-
- bool paintAll = (DecorationRegion(decorationRegion) == All);
- bool handled = false;
-
- QStyle *style = QApplication::style();
-
- // In the case of a borderless title bar, the title bar must be expanded one
- // borderWidth to the left, right and up.
- bool noTitleBorder = style->styleHint(QStyle::SH_TitleBar_NoBorder, 0, widget);
- int borderWidth = style->pixelMetric(QStyle::PM_MDIFrameWidth, 0, 0);
- int titleHeight = titleBarHeight(widget) + (noTitleBorder ? borderWidth : 0);
- int titleExtra = noTitleBorder ? borderWidth : 0;
-
- if ((paintAll || decorationRegion & Borders) && state == Normal && hasBorder) {
- QRegion newClip = painter->clipRegion();
- if (hasTitle) { // reduce flicker
- QRect rect(widget->rect());
- QRect r(rect.left() - titleExtra, rect.top() - titleHeight,
- rect.width() + 2 * titleExtra, titleHeight);
- newClip -= r;
- }
- if (!newClip.isEmpty()) {
- QRect br = QDecoration::region(widget).boundingRect();
- painter->save();
- painter->setClipRegion(newClip);
-
- QStyleOptionFrame opt;
- opt.palette = pal;
- opt.rect = br;
- opt.lineWidth = borderWidth;
-
- if (isActive)
- opt.state |= QStyle::State_Active;
- bool porterDuff = painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff);
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_Source);
- painter->fillRect(br, pal.window());
- if (porterDuff)
- painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
- style->drawPrimitive(QStyle::PE_FrameWindow, &opt, painter, 0);
- painter->restore();
-
- decorationRegion &= (~Borders);
- handled |= true;
- }
- }
-
- if (hasTitle) {
- painter->save();
-
- QStyleOptionTitleBar opt;
- opt.subControls = (decorationRegion & Title
- ? QStyle::SC_TitleBarLabel : QStyle::SubControl(0))
- | (decorationRegion & Menu
- ? QStyle::SC_TitleBarSysMenu : QStyle::SubControl(0))
- | (decorationRegion & Help
- ? QStyle::SC_TitleBarContextHelpButton : QStyle::SubControl(0))
- | (decorationRegion & Minimize
- ? QStyle::SC_TitleBarMinButton : QStyle::SubControl(0))
- | (decorationRegion & Maximize
- ? QStyle::SC_TitleBarMaxButton : QStyle::SubControl(0))
- | (decorationRegion & (Minimize | Maximize)
- ? QStyle::SC_TitleBarNormalButton : QStyle::SubControl(0))
- | (decorationRegion & Close
- ? QStyle::SC_TitleBarCloseButton : QStyle::SubControl(0));
- opt.titleBarFlags = widget->windowFlags();
- opt.titleBarState = widget->windowState();
- if (isActive)
- opt.titleBarState |= QStyle::State_Active;
- opt.text = windowTitleFor(widget);
- opt.icon = widget->windowIcon();
- opt.palette = pal;
- opt.rect = QRect(widget->rect().x() - titleExtra, -titleHeight,
- widget->rect().width() + 2 * titleExtra, titleHeight);
-
- if (paintAll) {
- painter->setClipRegion(opt.rect);
- } else {
- const QRect widgetRect = widget->rect();
- QRegion newClip = opt.rect;
- if (!(decorationRegion & Menu) && hasSysMenu)
- newClip -= region(widget, widgetRect, Menu);
- if (!(decorationRegion & Title) && hasTitle)
- newClip -= region(widget, widgetRect, Title);
- if (!(decorationRegion & Help) && hasContextHelp)
- newClip -= region(widget, widgetRect, Help);
- if (!(decorationRegion & Minimize) && hasMinimize)
- newClip -= region(widget, widgetRect, Minimize);
- if (!(decorationRegion & Maximize) && hasMaximize)
- newClip -= region(widget, widgetRect, Maximize);
- if (!(decorationRegion & (Minimize | Maximize)) && (hasMaximize | hasMinimize))
- newClip -= region(widget, widgetRect, Normal);
- if (!(decorationRegion & Close))
- newClip -= region(widget, widgetRect, Close);
- painter->setClipRegion(newClip);
- }
-
- if (state == Pressed)
- opt.activeSubControls = opt.subControls;
-
- style->drawComplexControl(QStyle::CC_TitleBar, &opt, painter, 0);
- painter->restore();
-
- decorationRegion &= ~(Title | Menu | Help | Normalize | Minimize | Maximize | Close);
- handled |= true;
- }
-
- return handled;
-}
-
-QRegion QDecorationStyled::region(const QWidget *widget, const QRect &rect, int decorationRegion)
-{
- QStyle *style = QApplication::style();
-
- // In the case of a borderless title bar, the title bar must be expanded one
- // borderWidth to the left, right and up.
- bool noTitleBorder = style->styleHint(QStyle::SH_TitleBar_NoBorder, 0, widget);
- int borderWidth = style->pixelMetric(QStyle::PM_MDIFrameWidth, 0, 0);
- int titleHeight = titleBarHeight(widget) + (noTitleBorder ? borderWidth : 0);
- int titleExtra = noTitleBorder ? borderWidth : 0;
-
- QRect inside = QRect(rect.x() - titleExtra, rect.top() - titleHeight,
- rect.width() + 2 * titleExtra, titleHeight);
-
- Qt::WindowFlags flags = widget->windowFlags();
- bool hasSysMenu = flags & Qt::WindowSystemMenuHint;
- bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint;
- bool hasMinimize = flags & Qt::WindowMinimizeButtonHint;
- bool hasMaximize = flags & Qt::WindowMaximizeButtonHint;
-
- QStyleOptionTitleBar opt;
- opt.subControls = QStyle::SC_TitleBarLabel
- | QStyle::SC_TitleBarSysMenu
- | QStyle::SC_TitleBarNormalButton
- | QStyle::SC_TitleBarMinButton
- | QStyle::SC_TitleBarMaxButton
- | QStyle::SC_TitleBarCloseButton;
- opt.titleBarFlags = widget->windowFlags();
- opt.direction = QApplication::layoutDirection();
- opt.text = windowTitleFor(widget);
- opt.icon = widget->windowIcon();
- opt.rect = inside;
-
- QRegion region;
- switch (decorationRegion) {
- case Title:
- region = style->subControlRect(QStyle::CC_TitleBar, &opt,
- QStyle::SC_TitleBarLabel, 0);
- break;
- case Menu:
- if (hasSysMenu)
- region = style->subControlRect(QStyle::CC_TitleBar, &opt,
- QStyle::SC_TitleBarSysMenu, 0);
- break;
- case Help:
- if (hasContextHelp)
- region = style->subControlRect(QStyle::CC_TitleBar, &opt,
- QStyle::SC_TitleBarContextHelpButton,
- 0);
- break;
- case Normalize:
- if (hasMaximize | hasMinimize)
- region = style->subControlRect(QStyle::CC_TitleBar, &opt,
- QStyle::SC_TitleBarNormalButton,
- 0);
- break;
- case Minimize:
- if (hasMinimize)
- region = style->subControlRect(QStyle::CC_TitleBar, &opt,
- QStyle::SC_TitleBarMinButton,
- 0);
- break;
- case Maximize:
- if (hasMaximize)
- region = style->subControlRect(QStyle::CC_TitleBar, &opt,
- QStyle::SC_TitleBarMaxButton,
- 0);
- break;
- case Close:
- region = style->subControlRect(QStyle::CC_TitleBar, &opt,
- QStyle::SC_TitleBarCloseButton, 0);
- break;
-
- default:
- region = QDecorationDefault::region(widget, rect, decorationRegion);
- }
-
- opt.rect = QRect(rect.x() - titleExtra, rect.top() - titleHeight,
- rect.width() + 2 * titleExtra,
- rect.height() + titleHeight + titleExtra);
-
- QStyleHintReturnMask mask;
- style->styleHint(QStyle::SH_WindowFrame_Mask, &opt, 0, &mask);
-
- return (mask.region.isEmpty() ? region : (region & mask.region));
-}
-
-#endif // QT_NO_QWS_DECORATION_STYLED
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qdecorationwindows_qws.cpp b/src/gui/embedded/qdecorationwindows_qws.cpp
deleted file mode 100644
index 51d57d7203..0000000000
--- a/src/gui/embedded/qdecorationwindows_qws.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qapplication.h>
-#include <qwidget.h>
-#include <qpainter.h>
-#include <qdrawutil.h>
-#include "qdecorationwindows_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(QT_NO_QWS_DECORATION_WINDOWS) || defined(QT_PLUGIN)
-
-#ifndef QT_NO_IMAGEFORMAT_XPM
-
-/* XPM */
-static const char * const win_close_xpm[] = {
-"16 16 4 1",
-" s None c None",
-". c #000000",
-"X c #FFFFFF",
-"Y c #707070",
-" ",
-" ",
-" ",
-" Y. .Y ",
-" .. .. ",
-" .. .. ",
-" .YY. ",
-" Y..Y ",
-" .YY. ",
-" .. .. ",
-" .. .. ",
-" Y. .Y ",
-" ",
-" ",
-" ",
-" "};
-
-static const char * const win_help_xpm[] = {
-"16 16 3 1",
-" s None c None",
-". c #ffffff",
-"X c #000000",
-" ",
-" ",
-" ",
-" XXXXXX ",
-" XX XX ",
-" XX XX ",
-" XX ",
-" XX ",
-" XX ",
-" XX ",
-" ",
-" XX ",
-" XX ",
-" ",
-" ",
-" "};
-
-static const char * const win_maximize_xpm[] = {
-"16 16 4 1",
-" s None c None",
-". c #000000",
-"X c #FFFFFF",
-"Y c #707070",
-" ",
-" ",
-" ",
-" .......... ",
-" .......... ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" .......... ",
-" ",
-" ",
-" ",
-" "};
-
-static const char * const win_minimize_xpm[] = {
-"16 16 4 1",
-" s None c None",
-". c #000000",
-"X c #FFFFFF",
-"Y c #707070",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ........ ",
-" ........ ",
-" ",
-" ",
-" ",
-" "};
-
-static const char * const win_normalize_xpm[] = {
-"16 16 4 1",
-" s None c None",
-". c #000000",
-"X c #FFFFFF",
-"Y c #707070",
-" ",
-" ",
-" ......... ",
-" ......... ",
-" . . ",
-" . . ",
-" ......... . ",
-" ......... . ",
-" . . . ",
-" . .... ",
-" . . ",
-" . . ",
-" ......... ",
-" ",
-" ",
-" "};
-
-#endif // QT_NO_IMAGEFORMAT_XPM
-
-
-QDecorationWindows::QDecorationWindows()
- : QDecorationDefault()
-{
- menu_width = 16;
- help_width = 18;
- minimize_width = 18;
- maximize_width = 18;
- close_width = 18;
-}
-
-QDecorationWindows::~QDecorationWindows()
-{
-}
-
-const char **QDecorationWindows::xpmForRegion(int reg)
-{
-#ifdef QT_NO_IMAGEFORMAT_XPM
- Q_UNUSED(reg);
-#else
- switch(reg)
- {
- case Close:
- return (const char **)win_close_xpm;
- case Help:
- return (const char **)win_help_xpm;
- case Minimize:
- return (const char **)win_minimize_xpm;
- case Maximize:
- return (const char **)win_maximize_xpm;
- case Normalize:
- return (const char **)win_normalize_xpm;
- default:
- return QDecorationDefault::xpmForRegion(reg);
- }
-#endif
- return 0;
-}
-
-QRegion QDecorationWindows::region(const QWidget *widget, const QRect &rect, int type)
-{
- Qt::WindowFlags flags = widget->windowFlags();
- bool hasTitle = flags & Qt::WindowTitleHint;
- bool hasSysMenu = flags & Qt::WindowSystemMenuHint;
- bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint;
- bool hasMinimize = flags & Qt::WindowMinimizeButtonHint;
- bool hasMaximize = flags & Qt::WindowMaximizeButtonHint;
- const QFontMetrics fontMetrics = QApplication::fontMetrics();
- int titleHeight = hasTitle ? qMax(20, fontMetrics.height()) : 0;
- int state = widget->windowState();
- bool isMinimized = state & Qt::WindowMinimized;
- bool isMaximized = state & Qt::WindowMaximized;
-
- QRegion region;
- switch (type) {
- case Menu: {
- if (hasSysMenu) {
- region = QRect(rect.left() + 2, rect.top() - titleHeight,
- menu_width, titleHeight);
- }
- }
- break;
-
- case Title: {
- QRect r(rect.left()
- + (hasSysMenu ? menu_width + 4: 0),
- rect.top() - titleHeight,
- rect.width()
- - (hasSysMenu ? menu_width : 0)
- - close_width
- - (hasMaximize ? maximize_width : 0)
- - (hasMinimize ? minimize_width : 0)
- - (hasContextHelp ? help_width : 0)
- - 3,
- titleHeight);
- if (r.width() > 0)
- region = r;
- }
- break;
- case Help: {
- if (hasContextHelp) {
- QRect r(rect.right()
- - close_width
- - (hasMaximize ? maximize_width : 0)
- - (hasMinimize ? minimize_width : 0)
- - help_width - 3, rect.top() - titleHeight,
- help_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
- case Minimize: {
- if (hasMinimize && !isMinimized) {
- QRect r(rect.right() - close_width
- - (hasMaximize ? maximize_width : 0)
- - minimize_width - 3, rect.top() - titleHeight,
- minimize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
- case Maximize: {
- if (hasMaximize && !isMaximized) {
- QRect r(rect.right() - close_width - maximize_width - 3,
- rect.top() - titleHeight, maximize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
- case Normalize: {
- if (hasMinimize && isMinimized) {
- QRect r(rect.right() - close_width
- - (hasMaximize ? maximize_width : 0)
- - minimize_width - 3, rect.top() - titleHeight,
- minimize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- } else if (hasMaximize && isMaximized) {
- QRect r(rect.right() - close_width - maximize_width - 3,
- rect.top() - titleHeight, maximize_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- }
- break;
-
- case Close: {
- QRect r(rect.right() - close_width - 1, rect.top() - titleHeight,
- close_width, titleHeight);
- if (r.left() > rect.left() + titleHeight)
- region = r;
- }
- break;
-
- default:
- region = QDecorationDefault::region(widget, rect, type);
- break;
- }
-
- return region;
-}
-
-bool QDecorationWindows::paint(QPainter *painter, const QWidget *widget, int decorationRegion,
- DecorationState state)
-{
- if (decorationRegion == None)
- return false;
-
- const QRect titleRect = QDecoration::region(widget, Title).boundingRect();
- const QPalette pal = QApplication::palette();
- QRegion oldClipRegion = painter->clipRegion();
-
- bool paintAll = (decorationRegion == int(All));
- if ((paintAll || decorationRegion & Title && titleRect.width() > 0) && state == Normal
- && (widget->windowFlags() & Qt::WindowTitleHint) ) {
- painter->setClipRegion(oldClipRegion);
- QColor fromBrush, toBrush;
- QPen titlePen;
-
- if (widget == qApp->activeWindow() || qApp->activeWindow() == qApp->activePopupWidget()) {
- fromBrush = pal.color(QPalette::Highlight);
- titlePen = pal.color(QPalette::HighlightedText);
- } else {
- fromBrush = pal.color(QPalette::Window);
- titlePen = pal.color(QPalette::Text);
- }
- toBrush = fromBrush.lighter(300);
-
- painter->setPen(Qt::NoPen);
- QPoint p1(titleRect.x(), titleRect.y() + titleRect.height()/2);
- QPoint p2(titleRect.right(), titleRect.y() + titleRect.height()/2);
- QLinearGradient lg(p1, p2);
- lg.setColorAt(0, fromBrush);
- lg.setColorAt(1, toBrush);
- painter->fillRect(titleRect, lg);
-
- painter->setPen(titlePen);
- painter->drawText(titleRect, Qt::AlignVCenter, windowTitleFor(widget));
- decorationRegion ^= Title;
- }
-
- return QDecorationDefault::paint(painter, widget, decorationRegion, state);
-}
-
-void QDecorationWindows::paintButton(QPainter *painter, const QWidget *widget, int buttonRegion,
- DecorationState state, const QPalette &pal)
-{
- QBrush fromBrush, toBrush;
- QPen titlePen;
-
- if (widget == qApp->activeWindow() || qApp->activeWindow() == qApp->activePopupWidget()) {
- fromBrush = pal.brush(QPalette::Highlight);
- titlePen = pal.color(QPalette::HighlightedText);
- } else {
- fromBrush = pal.brush(QPalette::Window);
- titlePen = pal.color(QPalette::Text);
- }
- toBrush = fromBrush.color().lighter(300);
-
- QRect brect(QDecoration::region(widget, buttonRegion).boundingRect());
- if (buttonRegion != Close && buttonRegion != Menu)
- painter->fillRect(brect, toBrush);
- else
- painter->fillRect(brect.x() - 2, brect.y(), brect.width() + 4, brect.height(),
- buttonRegion == Menu ? fromBrush : toBrush);
-
- int xoff = 1;
- int yoff = 2;
- const QPixmap pm = pixmapFor(widget, buttonRegion, xoff, yoff);
- if (buttonRegion != Menu) {
- if (state & Normal) {
- qDrawWinPanel(painter, brect.x(), brect.y() + 2, brect.width(),
- brect.height() - 4, pal, false, &pal.brush(QPalette::Window));
- } else if (state & Pressed) {
- qDrawWinPanel(painter, brect.x(), brect.y() + 2, brect.width(),
- brect.height() - 4, pal, true, &pal.brush(QPalette::Window));
- ++xoff;
- ++yoff;
- }
- } else {
- xoff = 0;
- yoff = 2;
- }
-
- if (!pm.isNull())
- painter->drawPixmap(brect.x() + xoff, brect.y() + yoff, pm);
-}
-
-#endif // QT_NO_QWS_DECORATION_WINDOWS || QT_PLUGIN
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qdecorationwindows_qws.h b/src/gui/embedded/qdecorationwindows_qws.h
deleted file mode 100644
index 44213e6680..0000000000
--- a/src/gui/embedded/qdecorationwindows_qws.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECORATIONWINDOWS_QWS_H
-#define QDECORATIONWINDOWS_QWS_H
-
-#include <QtGui/qdecorationdefault_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if !defined(QT_NO_QWS_DECORATION_WINDOWS) || defined(QT_PLUGIN)
-
-class Q_GUI_EXPORT QDecorationWindows : public QDecorationDefault
-{
-public:
- QDecorationWindows();
- virtual ~QDecorationWindows();
-
- QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All);
- bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All,
- DecorationState state = Normal);
-
-protected:
- void paintButton(QPainter *painter, const QWidget *widget, int buttonRegion,
- DecorationState state, const QPalette &pal);
- const char **xpmForRegion(int reg);
-};
-
-#endif // QT_NO_QWS_DECORATION_WINDOWS
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QDECORATIONWINDOWS_QWS_H
diff --git a/src/gui/embedded/qdirectpainter_qws.cpp b/src/gui/embedded/qdirectpainter_qws.cpp
deleted file mode 100644
index 47369947da..0000000000
--- a/src/gui/embedded/qdirectpainter_qws.cpp
+++ /dev/null
@@ -1,682 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectpainter_qws.h"
-
-#include "qscreen_qws.h"
-#include "private/qobject_p.h"
-#include "private/qapplication_p.h"
-#include "qwsdisplay_qws.h"
-#include "qwidget.h"
-#include "qimage.h"
-#include <qwsevent_qws.h>
-#include <private/qwindowsurface_qws_p.h>
-#include <private/qwsdisplay_qws_p.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_WS_QWS
-#ifndef QT_NO_DIRECTPAINTER
-
-/*!
- \class QDirectPainter
- \ingroup painting
- \ingroup qws
-
- \brief The QDirectPainter class provides direct access to the
- underlying hardware in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QDirectPainter allows a client application to reserve a region of
- the framebuffer and render directly onto the screen. There are two
- ways of using the QDirectPainter class: You can either reserve a
- region using the provided static functions, or you can instantiate
- an object and make use of its more dynamic API.
-
- \tableofcontents
-
- \section1 Dynamic Allocation
-
- By instantiating a QDirectPainter object using the default
- QDirectPainter::NonReserved surface flag, the client application
- only gets some control over the reserved region, i.e., it can
- still render directly onto the screen but the allocated region may
- change (for example, if a window with a higher focus requests
- parts of the same region). The currently allocated region can be
- retrieved using the allocatedRegion() function, while the
- requestedRegion() function returns the originally reserved
- region.
-
-
- \section1 Static Allocation
-
-
- Using the static approach, the client application gets complete
- control over the reserved region, i.e., the affected region will
- never be modified by the screen driver.
-
- To create a static region, pass the QDirectPainter::Reserved
- surface flag to the constructor. After the reserved region is
- reported through regionChanged(), the allocated region will not
- change, unless setRegion() is called.
-
- If QDirectPainter::ReservedSynchronous is passed to the
- constructor, calls to setRegion() will block until the region is
- reserved, meaning that allocatedRegion() will be available immediately.
- Note that in the current version setRegion() will cause the application
- event loop to be entered, potentially causing reentrancy issues.
-
- \section1 Rendering
-
- To draw on a given region, the application must first get hold of
- a pointer to the framebuffer. In most cases, this pointer can be
- retrieved using the QDirectPainter::frameBuffer() function. But
- note that if the current screen has subscreens, you must query the
- screen driver instead to identify the correct subscreen. A pointer
- to the current screen driver can always be retrieved using the
- static QScreen::instance() function. Then use QScreen's \l
- {QScreen::}{subScreenIndexAt()} and \l {QScreen::}{subScreens()}
- functions to access the correct subscreen, and the subscreen's \l
- {QScreen::}{base()} function to retrieve a pointer to the
- framebuffer.
-
- Depending on the hardware, it might be necessary to lock the
- framebuffer for exclusive use while writing to it. This is
- possible using the lock() and unlock() functions. Note that
- calling lock() will prevent all other applications from working
- until unlock() is called.
-
- In addition, QDirectPainter provides several functions returning
- information about the framebuffer: the linestep() function returns
- the length (in bytes) of each scanline of the framebuffer while
- the screenDepth(), screenWidth() and screenHeight() function
- return the screen metrics.
-
- \sa QScreen, QWSEmbedWidget, {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- \enum QDirectPainter::SurfaceFlag
-
- This enum describes the behavior of the region reserved by this
- QDirectPainter object.
-
- \value NonReserved The allocated region may change, e.g., if a
- window with a higher focus requests parts of the same region. See
- also \l {Dynamic Allocation}.
-
- \value Reserved The allocated region will never change. See also
- \l {Static Allocation}.
-
- \value ReservedSynchronous The allocated region will never change and
- each function that changes the allocated region will be blocking.
-
- \sa allocatedRegion()
-*/
-
-/*!
- \fn QRegion QDirectPainter::region()
- \obsolete
-
- Use QDirectPainter::allocatedRegion() instead.
-*/
-
-static inline QScreen *getPrimaryScreen()
-{
- QScreen *screen = QScreen::instance();
- if (!screen->base()) {
- QList<QScreen*> subScreens = screen->subScreens();
- if (subScreens.size() < 1)
- return 0;
- screen = subScreens.at(0);
- }
- return screen;
-}
-
-static inline QSize screenS()
-{
- QScreen *screen = getPrimaryScreen();
- if (!screen)
- return QSize();
- return QSize(screen->width(), screen->height());
-}
-
-static inline QSize devS()
-{
- QScreen *screen = getPrimaryScreen();
- if (!screen)
- return QSize();
- return QSize(screen->deviceWidth(), screen->deviceHeight());
-}
-
-
-class QDirectPainterPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QDirectPainter);
-public:
-
- QDirectPainterPrivate() : surface(0), seenRegion(false) {}
-
- ~QDirectPainterPrivate() {
- if (QPaintDevice::qwsDisplay()) { // make sure not in QApplication destructor
- qApp->d_func()->directPainters->remove(surface->windowId());
- surface->setGeometry(QRect());
- }
- delete surface;
- }
-
- QWSDirectPainterSurface *surface;
- QRegion requested_region;
-
- static QDirectPainter *staticPainter;
- bool seenRegion;
-};
-
-QDirectPainter *QDirectPainterPrivate::staticPainter = 0;
-
-void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type)
-{
- QDirectPainterPrivate *d = dp->d_func();
-
- QRegion r = alloc;
- QScreen *screen = d->surface->screen();
- if (screen->isTransformed()) {
- const QSize screenSize(screen->width(), screen->height());
- r = screen->mapToDevice(r, screenSize);
- }
- if (type == QWSRegionEvent::Allocation) {
- d->surface->setClipRegion(alloc);
- d->seenRegion = true;
- if (dp != QDirectPainterPrivate::staticPainter) {
- if (!d->surface->flushingRegionEvents) // recursion guard
- dp->regionChanged(r);
- }
- }
-}
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-void qt_directpainter_embedevent(QDirectPainter *dp, const QWSEmbedEvent *event)
-{
- if (event->type | QWSEmbedEvent::Region) {
- QScreen *screen = dp->d_func()->surface->screen();
- QRegion r = event->region;
- if (screen->isTransformed()) {
- const QSize screenSize(screen->width(), screen->height());
- r = screen->mapToDevice(r, screenSize);
- }
- dp->setRegion(r);
- }
-}
-#endif
-
-/*!
- Constructs a QDirectPainter object with the given \a parent and
- surface \a flag.
-*/
-QDirectPainter::QDirectPainter(QObject *parent, SurfaceFlag flag)
- :QObject(*new QDirectPainterPrivate, parent)
-{
- Q_D(QDirectPainter);
- d->surface = new QWSDirectPainterSurface(true, flag);
-
- if (flag != NonReserved)
- d->surface->setReserved();
-
- QApplicationPrivate *ad = qApp->d_func();
- if (!ad->directPainters)
- ad->directPainters = new QMap<WId, QDirectPainter*>;
- ad->directPainters->insert(d->surface->windowId(), this);
-}
-
-/*!
- Destroys this QDirectPainter object, releasing the reserved region.
-
- \sa allocatedRegion()
-*/
-QDirectPainter::~QDirectPainter()
-{
- /* should not be necessary
- if (this == QDirectPainterPrivate::staticPainter)
- QDirectPainterPrivate::staticPainter = 0;
- */
-}
-
-/*!
- \fn void QDirectPainter::setGeometry(const QRect &rectangle)
- \since 4.2
-
- Request to reserve the given \a rectangle of the framebuffer.
-
- Note that the actually allocated region might differ from the
- requested one, e.g., if the given region overlaps with the
- region of another QDirectPainter object.
-
- \sa geometry(), allocatedRegion(), setRegion()
-*/
-void QDirectPainter::setGeometry(const QRect &rect)
-{
- setRegion(rect);
-}
-
-/*!
- \since 4.2
-
- Returns the bounding rectangle of the requested region.
-
- \sa setGeometry(), requestedRegion()
-*/
-QRect QDirectPainter::geometry() const
-{
- Q_D(const QDirectPainter);
- return d->requested_region.boundingRect();
-}
-
-/*!
- \since 4.2
-
- Requests to reserve the given \a region of the framebuffer.
-
- Note that the actually allocated region might differ from the
- requested one, e.g., if the given region overlaps with the region
- of another QDirectPainter object.
-
- \sa requestedRegion(), allocatedRegion(), {Dynamic Allocation}
-*/
-void QDirectPainter::setRegion(const QRegion &region)
-{
- Q_D(QDirectPainter);
- d->requested_region = region;
-
- const QScreen *screen = d->surface->screen();
- if (screen->isTransformed()) {
- const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
- const QRegion r = screen->mapFromDevice(region, devSize);
- d->surface->setRegion(r);
- } else {
- d->surface->setRegion(region);
- }
-}
-
-/*!
- \since 4.2
-
- Returns the region requested by this QDirectPainter.
-
- Note that if the QDirectPainter::Reserved flag is set, the region
- returned by this function will always be equivalent to the region
- returned by the allocatedRegion() function. Otherwise they might
- differ (see \l {Dynamic Allocation} for details).
-
- \sa geometry(), setRegion(), allocatedRegion()
-*/
-QRegion QDirectPainter::requestedRegion() const
-{
- Q_D(const QDirectPainter);
- return d->requested_region;
-}
-
-/*!
- \since 4.2
-
- Returns the currently reserved region.
-
- Note that if the QDirectPainter::Reserved flag is set, the region
- returned by this function will always be equivalent to the region
- returned by the requestedRegion() function. Otherwise they might
- differ (see \l {Dynamic Allocation} for details).
-
- \sa requestedRegion(), geometry()
-*/
-QRegion QDirectPainter::allocatedRegion() const
-{
- Q_D(const QDirectPainter);
- const QScreen *screen = d->surface->screen();
- if (screen->isTransformed()) {
- const QSize screenSize(screen->width(), screen->height());
- return screen->mapToDevice(d->surface->region(), screenSize);
- } else {
- return d->surface->region();
- }
-}
-
-/*!
- \since 4.2
-
- Returns the window system identifier of the widget.
-*/
-WId QDirectPainter::winId() const
-{
- Q_D(const QDirectPainter);
- return d->surface->windowId();
-}
-
-/*!
- \fn void QDirectPainter::regionChanged(const QRegion &newRegion)
- \since 4.2
-
- This function is called when the allocated region changes.
-
- This function is not called for region changes that happen while the
- startPainting() function is executing.
-
- Note that the given region, \a newRegion, is not guaranteed to be correct at the
- time you access the display. To prevent reentrancy problems you should
- always call startPainting() before updating the display and then use
- allocatedRegion() to retrieve the correct region.
-
- \sa allocatedRegion(), startPainting(), {Dynamic Allocation}
-*/
-void QDirectPainter::regionChanged(const QRegion &region)
-{
- Q_UNUSED(region);
-}
-
-/*!
- \since 4.2
-
- Call this function before you start updating the pixels in the
- allocated region. The hardware will be notified, if necessary,
- that you are about to start painting operations.
-
- Set \a lockDisplay if you want startPainting() and endPainting()
- to lock() and unlock() the display automatically.
-
- Note that for a NonReserved direct painter, you must call
- allocatedRegion() after calling this function, since the allocated
- region is only guaranteed to be correct after this function has
- returned.
-
- The regionChanged() function will not be called between startPainting()
- and endPainting().
-
- \sa endPainting(), flush()
-*/
-void QDirectPainter::startPainting(bool lockDisplay)
-{
- Q_D(QDirectPainter);
- d->surface->setLocking(lockDisplay);
-
- const QScreen *screen = d->surface->screen();
- if (screen->isTransformed()) {
- const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
- const QRegion r = screen->mapFromDevice(d->surface->region(), devSize);
- d->surface->beginPaint(r);
- } else {
- d->surface->beginPaint(d->surface->region());
- }
-}
-
-/*!
- \since 4.2
-
- Call this function when you are done updating the screen. It will
- notify the hardware, if necessary, that your painting operations
- have ended.
-*/
-void QDirectPainter::endPainting()
-{
- Q_D(QDirectPainter);
-
- const QScreen *screen = d->surface->screen();
- if (screen->isTransformed()) {
- const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
- const QRegion r = screen->mapFromDevice(d->surface->region(), devSize);
- d->surface->endPaint(r);
- } else {
- d->surface->endPaint(d->surface->region());
- }
-}
-
-/*!
- \since 4.3
- \overload
-
- This function will automatically call flush() to flush the
- \a region to the display before notifying the hardware, if
- necessary, that painting operations have ended.
-*/
-void QDirectPainter::endPainting(const QRegion &region)
-{
- endPainting();
- flush(region);
-}
-
-/*!
- \since 4.3
-
- Flushes the \a region onto the screen.
-*/
-void QDirectPainter::flush(const QRegion &region)
-{
- Q_D(QDirectPainter);
-
- const QScreen *screen = d->surface->screen();
- if (screen->isTransformed()) {
- const QSize devSize(screen->deviceWidth(), screen->deviceHeight());
- const QRegion r = screen->mapFromDevice(region, devSize);
- d->surface->flush(0, r, QPoint());
- } else {
- d->surface->flush(0, region, QPoint());
- }
-}
-
-/*!
- \since 4.2
-
- Raises the reserved region to the top of the widget stack.
-
- After this call the reserved region will be visually in front of
- any overlapping widgets.
-
- \sa lower(), requestedRegion()
-*/
-void QDirectPainter::raise()
-{
- QWidget::qwsDisplay()->setAltitude(winId(),QWSChangeAltitudeCommand::Raise);
-}
-
-/*!
- \since 4.2
-
- Lowers the reserved region to the bottom of the widget stack.
-
- After this call the reserved region will be visually behind (and
- therefore obscured by) any overlapping widgets.
-
- \sa raise(), requestedRegion()
-*/
-void QDirectPainter::lower()
-{
- QWidget::qwsDisplay()->setAltitude(winId(),QWSChangeAltitudeCommand::Lower);
-}
-
-
-/*!
- \fn QRegion QDirectPainter::reserveRegion(const QRegion &region)
-
- Attempts to reserve the \a region and returns the region that is
- actually reserved.
-
- This function also releases the previously reserved region if
- any. If not released explicitly, the region will be released on
- application exit.
-
- \sa allocatedRegion(), {Static Allocation}
-
- \obsolete
-
- Construct a QDirectPainter using QDirectPainter::ReservedSynchronous instead.
-*/
-QRegion QDirectPainter::reserveRegion(const QRegion &reg)
-{
- if (!QDirectPainterPrivate::staticPainter)
- QDirectPainterPrivate::staticPainter = new QDirectPainter(qApp, ReservedSynchronous);
-
- QDirectPainter *dp = QDirectPainterPrivate::staticPainter;
- dp->setRegion(reg);
-
- return dp->allocatedRegion();
-}
-
-/*!
- Returns a pointer to the beginning of the display memory.
-
- Note that it is the application's responsibility to limit itself
- to modifying only the reserved region.
-
- Do not use this pointer if the current screen has subscreens,
- query the screen driver instead: A pointer to the current screen
- driver can always be retrieved using the static
- QScreen::instance() function. Then use QScreen's \l
- {QScreen::}{subScreenIndexAt()} and \l {QScreen::}{subScreens()}
- functions to access the correct subscreen, and the subscreen's \l
- {QScreen::}{base()} function to retrieve a pointer to the
- framebuffer.
-
- \sa requestedRegion(), allocatedRegion(), linestep()
-*/
-uchar* QDirectPainter::frameBuffer()
-{
- QScreen *screen = getPrimaryScreen();
- if (!screen)
- return 0;
- return screen->base();
-}
-
-/*!
- \since 4.2
-
- Returns the reserved region.
-
- \sa reserveRegion(), frameBuffer()
-
- \obsolete
-
- Use allocatedRegion() instead.
-*/
-QRegion QDirectPainter::reservedRegion()
-{
- return QDirectPainterPrivate::staticPainter
- ? QDirectPainterPrivate::staticPainter->allocatedRegion() : QRegion();
-}
-
-/*!
- Returns the bit depth of the display.
-
- \sa screenHeight(), screenWidth()
-*/
-int QDirectPainter::screenDepth()
-{
- QScreen *screen = getPrimaryScreen();
- if (!screen)
- return 0;
- return screen->depth();
-}
-
-/*!
- Returns the width of the display in pixels.
-
- \sa screenHeight(), screenDepth()
-*/
-int QDirectPainter::screenWidth()
-{
- QScreen *screen = getPrimaryScreen();
- if (!screen)
- return 0;
- return screen->deviceWidth();
-}
-
-/*!
- Returns the height of the display in pixels.
-
- \sa screenWidth(), screenDepth()
-*/
-int QDirectPainter::screenHeight()
-{
- QScreen *screen = getPrimaryScreen();
- if (!screen)
- return 0;
- return screen->deviceHeight();
-}
-
-/*!
- Returns the length (in bytes) of each scanline of the framebuffer.
-
- \sa frameBuffer()
-*/
-int QDirectPainter::linestep()
-{
- QScreen *screen = getPrimaryScreen();
- if (!screen)
- return 0;
- return screen->linestep();
-}
-
-
-/*!
- Locks access to the framebuffer.
-
- Note that calling this function will prevent all other
- applications from updating the display until unlock() is called.
-
- \sa unlock()
-*/
-void QDirectPainter::lock()
-{
- QWSDisplay::grab(true);
-}
-/*!
- Unlocks the lock on the framebuffer (set using the lock()
- function), allowing other applications to access the screen.
-
- \sa lock()
- */
-void QDirectPainter::unlock()
-{
- QWSDisplay::ungrab();
-}
-
-#endif //QT_NO_DIRECTPAINTER
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qdirectpainter_qws.h b/src/gui/embedded/qdirectpainter_qws.h
deleted file mode 100644
index 47cc721d49..0000000000
--- a/src/gui/embedded/qdirectpainter_qws.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECTPAINTER_QWS_H
-#define QDIRECTPAINTER_QWS_H
-
-#include <QtCore/qobject.h>
-#include <QtGui/qregion.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_DIRECTPAINTER
-class QDirectPainterPrivate;
-class QWSEmbedEvent;
-
-class Q_GUI_EXPORT QDirectPainter : public QObject {
- Q_OBJECT
- Q_DECLARE_PRIVATE(QDirectPainter)
-public:
-
- enum SurfaceFlag { NonReserved = 0,
- Reserved = 1,
- ReservedSynchronous = 3 };
-
- explicit QDirectPainter(QObject *parentObject = 0, SurfaceFlag flag = NonReserved);
- ~QDirectPainter();
-
- void setRegion(const QRegion&);
- QRegion requestedRegion() const;
- QRegion allocatedRegion() const;
-
- void setGeometry(const QRect&);
- QRect geometry() const;
-
- WId winId() const;
- virtual void regionChanged(const QRegion &exposedRegion);
-
- void startPainting(bool lockDisplay = true);
- void endPainting();
- void endPainting(const QRegion &region);
- void flush(const QRegion &region);
-
- void raise();
- void lower();
-
-
- static QRegion reserveRegion(const QRegion&);
- static QRegion reservedRegion();
- static QRegion region() { return reservedRegion(); }
-
- static uchar* frameBuffer();
- static int screenDepth();
- static int screenWidth();
- static int screenHeight();
- static int linestep();
-
- static void lock();
- static void unlock();
-private:
- friend void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type);
- friend void qt_directpainter_embedevent(QDirectPainter*, const QWSEmbedEvent*);
-};
-
-#endif
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QDIRECTPAINTER_QWS_H
diff --git a/src/gui/embedded/qkbd_defaultmap_qws_p.h b/src/gui/embedded/qkbd_defaultmap_qws_p.h
deleted file mode 100644
index 017f56deb6..0000000000
--- a/src/gui/embedded/qkbd_defaultmap_qws_p.h
+++ /dev/null
@@ -1,806 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSKEYBOARDHANDLER_DEFAULTMAP_H
-#define QWSKEYBOARDHANDLER_DEFAULTMAP_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// no QT_BEGIN_NAMESPACE, since we include it internally...
-
-const QWSKeyboard::Mapping QWSKbPrivate::s_keymap_default[] = {
- { 1, 0xffff, 0x01000000, 0x00, 0x00, 0x0000 },
- { 2, 0x0031, 0x00000031, 0x00, 0x00, 0x0000 },
- { 2, 0x0021, 0x00000021, 0x01, 0x00, 0x0000 },
- { 3, 0x0032, 0x00000032, 0x00, 0x00, 0x0000 },
- { 3, 0x0040, 0x00000040, 0x01, 0x00, 0x0000 },
- { 3, 0x0040, 0x00000040, 0x02, 0x00, 0x0000 },
- { 4, 0x0033, 0x00000033, 0x00, 0x00, 0x0000 },
- { 4, 0x0023, 0x00000023, 0x01, 0x00, 0x0000 },
- { 4, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 },
- { 5, 0x0034, 0x00000034, 0x00, 0x00, 0x0000 },
- { 5, 0x0024, 0x00000024, 0x01, 0x00, 0x0000 },
- { 5, 0x0024, 0x00000024, 0x02, 0x00, 0x0000 },
- { 5, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 },
- { 6, 0x0035, 0x00000035, 0x00, 0x00, 0x0000 },
- { 6, 0x0025, 0x00000025, 0x01, 0x00, 0x0000 },
- { 6, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 },
- { 7, 0x0036, 0x00000036, 0x00, 0x00, 0x0000 },
- { 7, 0x005e, 0x0000005e, 0x01, 0x00, 0x0000 },
- { 7, 0x005e, 0x01001252, 0x02, 0x01, 0x0000 },
- { 7, 0x005e, 0x0400005e, 0x04, 0x00, 0x0000 },
- { 8, 0x0037, 0x00000037, 0x00, 0x00, 0x0000 },
- { 8, 0x0026, 0x00000026, 0x01, 0x00, 0x0000 },
- { 8, 0x007b, 0x0000007b, 0x02, 0x00, 0x0000 },
- { 8, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 },
- { 9, 0x0038, 0x00000038, 0x00, 0x00, 0x0000 },
- { 9, 0x002a, 0x0000002a, 0x01, 0x00, 0x0000 },
- { 9, 0x005b, 0x0000005b, 0x02, 0x00, 0x0000 },
- { 9, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 },
- { 10, 0x0039, 0x00000039, 0x00, 0x00, 0x0000 },
- { 10, 0x0028, 0x00000028, 0x01, 0x00, 0x0000 },
- { 10, 0x005d, 0x0000005d, 0x02, 0x00, 0x0000 },
- { 11, 0x0030, 0x00000030, 0x00, 0x00, 0x0000 },
- { 11, 0x0029, 0x00000029, 0x01, 0x00, 0x0000 },
- { 11, 0x007d, 0x0000007d, 0x02, 0x00, 0x0000 },
- { 12, 0x002d, 0x0000002d, 0x00, 0x00, 0x0000 },
- { 12, 0x005f, 0x0000005f, 0x01, 0x00, 0x0000 },
- { 12, 0x005c, 0x0000005c, 0x02, 0x00, 0x0000 },
- { 12, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 },
- { 12, 0x005f, 0x0400005f, 0x05, 0x00, 0x0000 },
- { 13, 0x003d, 0x0000003d, 0x00, 0x00, 0x0000 },
- { 13, 0x002b, 0x0000002b, 0x01, 0x00, 0x0000 },
- { 14, 0xffff, 0x01000003, 0x00, 0x00, 0x0000 },
- { 14, 0xffff, 0x01000000, 0x0c, 0x08, 0x0300 },
- { 15, 0xffff, 0x01000001, 0x00, 0x00, 0x0000 },
- { 16, 0x0071, 0x00000051, 0x00, 0x00, 0x0000 },
- { 16, 0x0051, 0x00000051, 0x01, 0x00, 0x0000 },
- { 16, 0x0071, 0x00000051, 0x02, 0x00, 0x0000 },
- { 16, 0x0051, 0x00000051, 0x03, 0x00, 0x0000 },
- { 16, 0x0071, 0x04000051, 0x04, 0x00, 0x0000 },
- { 16, 0x0071, 0x04000051, 0x05, 0x00, 0x0000 },
- { 16, 0x0071, 0x04000051, 0x06, 0x00, 0x0000 },
- { 16, 0x0071, 0x04000051, 0x07, 0x00, 0x0000 },
- { 16, 0x0071, 0x08000051, 0x08, 0x00, 0x0000 },
- { 16, 0x0071, 0x08000051, 0x09, 0x00, 0x0000 },
- { 16, 0x0071, 0x08000051, 0x0a, 0x00, 0x0000 },
- { 16, 0x0071, 0x08000051, 0x0b, 0x00, 0x0000 },
- { 16, 0x0071, 0x0c000051, 0x0c, 0x00, 0x0000 },
- { 16, 0x0071, 0x0c000051, 0x0d, 0x00, 0x0000 },
- { 16, 0x0071, 0x0c000051, 0x0e, 0x00, 0x0000 },
- { 16, 0x0071, 0x0c000051, 0x0f, 0x00, 0x0000 },
- { 17, 0x0077, 0x00000057, 0x00, 0x00, 0x0000 },
- { 17, 0x0057, 0x00000057, 0x01, 0x00, 0x0000 },
- { 17, 0x0077, 0x00000057, 0x02, 0x00, 0x0000 },
- { 17, 0x0057, 0x00000057, 0x03, 0x00, 0x0000 },
- { 17, 0x0077, 0x04000057, 0x04, 0x00, 0x0000 },
- { 17, 0x0077, 0x04000057, 0x05, 0x00, 0x0000 },
- { 17, 0x0077, 0x04000057, 0x06, 0x00, 0x0000 },
- { 17, 0x0077, 0x04000057, 0x07, 0x00, 0x0000 },
- { 17, 0x0077, 0x08000057, 0x08, 0x00, 0x0000 },
- { 17, 0x0077, 0x08000057, 0x09, 0x00, 0x0000 },
- { 17, 0x0077, 0x08000057, 0x0a, 0x00, 0x0000 },
- { 17, 0x0077, 0x08000057, 0x0b, 0x00, 0x0000 },
- { 17, 0x0077, 0x0c000057, 0x0c, 0x00, 0x0000 },
- { 17, 0x0077, 0x0c000057, 0x0d, 0x00, 0x0000 },
- { 17, 0x0077, 0x0c000057, 0x0e, 0x00, 0x0000 },
- { 17, 0x0077, 0x0c000057, 0x0f, 0x00, 0x0000 },
- { 18, 0x0065, 0x00000045, 0x00, 0x00, 0x0000 },
- { 18, 0x0045, 0x00000045, 0x01, 0x00, 0x0000 },
- { 18, 0x0065, 0x00000045, 0x02, 0x00, 0x0000 },
- { 18, 0x0045, 0x00000045, 0x03, 0x00, 0x0000 },
- { 18, 0x0065, 0x04000045, 0x04, 0x00, 0x0000 },
- { 18, 0x0065, 0x04000045, 0x05, 0x00, 0x0000 },
- { 18, 0x0065, 0x04000045, 0x06, 0x00, 0x0000 },
- { 18, 0x0065, 0x04000045, 0x07, 0x00, 0x0000 },
- { 18, 0x0065, 0x08000045, 0x08, 0x00, 0x0000 },
- { 18, 0x0065, 0x08000045, 0x09, 0x00, 0x0000 },
- { 18, 0x0065, 0x08000045, 0x0a, 0x00, 0x0000 },
- { 18, 0x0065, 0x08000045, 0x0b, 0x00, 0x0000 },
- { 18, 0x0065, 0x0c000045, 0x0c, 0x00, 0x0000 },
- { 18, 0x0065, 0x0c000045, 0x0d, 0x00, 0x0000 },
- { 18, 0x0065, 0x0c000045, 0x0e, 0x00, 0x0000 },
- { 18, 0x0065, 0x0c000045, 0x0f, 0x00, 0x0000 },
- { 19, 0x0072, 0x00000052, 0x00, 0x00, 0x0000 },
- { 19, 0x0052, 0x00000052, 0x01, 0x00, 0x0000 },
- { 19, 0x0072, 0x00000052, 0x02, 0x00, 0x0000 },
- { 19, 0x0052, 0x00000052, 0x03, 0x00, 0x0000 },
- { 19, 0x0072, 0x04000052, 0x04, 0x00, 0x0000 },
- { 19, 0x0072, 0x04000052, 0x05, 0x00, 0x0000 },
- { 19, 0x0072, 0x04000052, 0x06, 0x00, 0x0000 },
- { 19, 0x0072, 0x04000052, 0x07, 0x00, 0x0000 },
- { 19, 0x0072, 0x08000052, 0x08, 0x00, 0x0000 },
- { 19, 0x0072, 0x08000052, 0x09, 0x00, 0x0000 },
- { 19, 0x0072, 0x08000052, 0x0a, 0x00, 0x0000 },
- { 19, 0x0072, 0x08000052, 0x0b, 0x00, 0x0000 },
- { 19, 0x0072, 0x0c000052, 0x0c, 0x00, 0x0000 },
- { 19, 0x0072, 0x0c000052, 0x0d, 0x00, 0x0000 },
- { 19, 0x0072, 0x0c000052, 0x0e, 0x00, 0x0000 },
- { 19, 0x0072, 0x0c000052, 0x0f, 0x00, 0x0000 },
- { 20, 0x0074, 0x00000054, 0x00, 0x00, 0x0000 },
- { 20, 0x0054, 0x00000054, 0x01, 0x00, 0x0000 },
- { 20, 0x0074, 0x00000054, 0x02, 0x00, 0x0000 },
- { 20, 0x0054, 0x00000054, 0x03, 0x00, 0x0000 },
- { 20, 0x0074, 0x04000054, 0x04, 0x00, 0x0000 },
- { 20, 0x0074, 0x04000054, 0x05, 0x00, 0x0000 },
- { 20, 0x0074, 0x04000054, 0x06, 0x00, 0x0000 },
- { 20, 0x0074, 0x04000054, 0x07, 0x00, 0x0000 },
- { 20, 0x0074, 0x08000054, 0x08, 0x00, 0x0000 },
- { 20, 0x0074, 0x08000054, 0x09, 0x00, 0x0000 },
- { 20, 0x0074, 0x08000054, 0x0a, 0x00, 0x0000 },
- { 20, 0x0074, 0x08000054, 0x0b, 0x00, 0x0000 },
- { 20, 0x0074, 0x0c000054, 0x0c, 0x00, 0x0000 },
- { 20, 0x0074, 0x0c000054, 0x0d, 0x00, 0x0000 },
- { 20, 0x0074, 0x0c000054, 0x0e, 0x00, 0x0000 },
- { 20, 0x0074, 0x0c000054, 0x0f, 0x00, 0x0000 },
- { 21, 0x0079, 0x00000059, 0x00, 0x00, 0x0000 },
- { 21, 0x0059, 0x00000059, 0x01, 0x00, 0x0000 },
- { 21, 0x0079, 0x00000059, 0x02, 0x00, 0x0000 },
- { 21, 0x0059, 0x00000059, 0x03, 0x00, 0x0000 },
- { 21, 0x0079, 0x04000059, 0x04, 0x00, 0x0000 },
- { 21, 0x0079, 0x04000059, 0x05, 0x00, 0x0000 },
- { 21, 0x0079, 0x04000059, 0x06, 0x00, 0x0000 },
- { 21, 0x0079, 0x04000059, 0x07, 0x00, 0x0000 },
- { 21, 0x0079, 0x08000059, 0x08, 0x00, 0x0000 },
- { 21, 0x0079, 0x08000059, 0x09, 0x00, 0x0000 },
- { 21, 0x0079, 0x08000059, 0x0a, 0x00, 0x0000 },
- { 21, 0x0079, 0x08000059, 0x0b, 0x00, 0x0000 },
- { 21, 0x0079, 0x0c000059, 0x0c, 0x00, 0x0000 },
- { 21, 0x0079, 0x0c000059, 0x0d, 0x00, 0x0000 },
- { 21, 0x0079, 0x0c000059, 0x0e, 0x00, 0x0000 },
- { 21, 0x0079, 0x0c000059, 0x0f, 0x00, 0x0000 },
- { 22, 0x0075, 0x00000055, 0x00, 0x00, 0x0000 },
- { 22, 0x0055, 0x00000055, 0x01, 0x00, 0x0000 },
- { 22, 0x0075, 0x00000055, 0x02, 0x00, 0x0000 },
- { 22, 0x0055, 0x00000055, 0x03, 0x00, 0x0000 },
- { 22, 0x0075, 0x04000055, 0x04, 0x00, 0x0000 },
- { 22, 0x0075, 0x04000055, 0x05, 0x00, 0x0000 },
- { 22, 0x0075, 0x04000055, 0x06, 0x00, 0x0000 },
- { 22, 0x0075, 0x04000055, 0x07, 0x00, 0x0000 },
- { 22, 0x0075, 0x08000055, 0x08, 0x00, 0x0000 },
- { 22, 0x0075, 0x08000055, 0x09, 0x00, 0x0000 },
- { 22, 0x0075, 0x08000055, 0x0a, 0x00, 0x0000 },
- { 22, 0x0075, 0x08000055, 0x0b, 0x00, 0x0000 },
- { 22, 0x0075, 0x0c000055, 0x0c, 0x00, 0x0000 },
- { 22, 0x0075, 0x0c000055, 0x0d, 0x00, 0x0000 },
- { 22, 0x0075, 0x0c000055, 0x0e, 0x00, 0x0000 },
- { 22, 0x0075, 0x0c000055, 0x0f, 0x00, 0x0000 },
- { 23, 0x0069, 0x00000049, 0x00, 0x00, 0x0000 },
- { 23, 0x0049, 0x00000049, 0x01, 0x00, 0x0000 },
- { 23, 0x0069, 0x00000049, 0x02, 0x00, 0x0000 },
- { 23, 0x0049, 0x00000049, 0x03, 0x00, 0x0000 },
- { 23, 0x0069, 0x04000049, 0x04, 0x00, 0x0000 },
- { 23, 0x0069, 0x04000049, 0x05, 0x00, 0x0000 },
- { 23, 0x0069, 0x04000049, 0x06, 0x00, 0x0000 },
- { 23, 0x0069, 0x04000049, 0x07, 0x00, 0x0000 },
- { 23, 0x0069, 0x08000049, 0x08, 0x00, 0x0000 },
- { 23, 0x0069, 0x08000049, 0x09, 0x00, 0x0000 },
- { 23, 0x0069, 0x08000049, 0x0a, 0x00, 0x0000 },
- { 23, 0x0069, 0x08000049, 0x0b, 0x00, 0x0000 },
- { 23, 0x0069, 0x0c000049, 0x0c, 0x00, 0x0000 },
- { 23, 0x0069, 0x0c000049, 0x0d, 0x00, 0x0000 },
- { 23, 0x0069, 0x0c000049, 0x0e, 0x00, 0x0000 },
- { 23, 0x0069, 0x0c000049, 0x0f, 0x00, 0x0000 },
- { 24, 0x006f, 0x0000004f, 0x00, 0x00, 0x0000 },
- { 24, 0x004f, 0x0000004f, 0x01, 0x00, 0x0000 },
- { 24, 0x006f, 0x0000004f, 0x02, 0x00, 0x0000 },
- { 24, 0x004f, 0x0000004f, 0x03, 0x00, 0x0000 },
- { 24, 0x006f, 0x0400004f, 0x04, 0x00, 0x0000 },
- { 24, 0x006f, 0x0400004f, 0x05, 0x00, 0x0000 },
- { 24, 0x006f, 0x0400004f, 0x06, 0x00, 0x0000 },
- { 24, 0x006f, 0x0400004f, 0x07, 0x00, 0x0000 },
- { 24, 0x006f, 0x0800004f, 0x08, 0x00, 0x0000 },
- { 24, 0x006f, 0x0800004f, 0x09, 0x00, 0x0000 },
- { 24, 0x006f, 0x0800004f, 0x0a, 0x00, 0x0000 },
- { 24, 0x006f, 0x0800004f, 0x0b, 0x00, 0x0000 },
- { 24, 0x006f, 0x0c00004f, 0x0c, 0x00, 0x0000 },
- { 24, 0x006f, 0x0c00004f, 0x0d, 0x00, 0x0000 },
- { 24, 0x006f, 0x0c00004f, 0x0e, 0x00, 0x0000 },
- { 24, 0x006f, 0x0c00004f, 0x0f, 0x00, 0x0000 },
- { 25, 0x0070, 0x00000050, 0x00, 0x00, 0x0000 },
- { 25, 0x0050, 0x00000050, 0x01, 0x00, 0x0000 },
- { 25, 0x0070, 0x00000050, 0x02, 0x00, 0x0000 },
- { 25, 0x0050, 0x00000050, 0x03, 0x00, 0x0000 },
- { 25, 0x0070, 0x04000050, 0x04, 0x00, 0x0000 },
- { 25, 0x0070, 0x04000050, 0x05, 0x00, 0x0000 },
- { 25, 0x0070, 0x04000050, 0x06, 0x00, 0x0000 },
- { 25, 0x0070, 0x04000050, 0x07, 0x00, 0x0000 },
- { 25, 0x0070, 0x08000050, 0x08, 0x00, 0x0000 },
- { 25, 0x0070, 0x08000050, 0x09, 0x00, 0x0000 },
- { 25, 0x0070, 0x08000050, 0x0a, 0x00, 0x0000 },
- { 25, 0x0070, 0x08000050, 0x0b, 0x00, 0x0000 },
- { 25, 0x0070, 0x0c000050, 0x0c, 0x00, 0x0000 },
- { 25, 0x0070, 0x0c000050, 0x0d, 0x00, 0x0000 },
- { 25, 0x0070, 0x0c000050, 0x0e, 0x00, 0x0000 },
- { 25, 0x0070, 0x0c000050, 0x0f, 0x00, 0x0000 },
- { 26, 0x005b, 0x0000005b, 0x00, 0x00, 0x0000 },
- { 26, 0x007b, 0x0000007b, 0x01, 0x00, 0x0000 },
- { 26, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 },
- { 27, 0x005d, 0x0000005d, 0x00, 0x00, 0x0000 },
- { 27, 0x007d, 0x0000007d, 0x01, 0x00, 0x0000 },
- { 27, 0x007e, 0x0000007e, 0x02, 0x00, 0x0000 },
- { 27, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 },
- { 28, 0xffff, 0x01000004, 0x00, 0x00, 0x0000 },
- { 28, 0x006d, 0x0c00004d, 0x08, 0x00, 0x0000 },
- { 29, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 },
- { 30, 0x0061, 0x00000041, 0x00, 0x00, 0x0000 },
- { 30, 0x0041, 0x00000041, 0x01, 0x00, 0x0000 },
- { 30, 0x0061, 0x00000041, 0x02, 0x00, 0x0000 },
- { 30, 0x0041, 0x00000041, 0x03, 0x00, 0x0000 },
- { 30, 0x0061, 0x04000041, 0x04, 0x00, 0x0000 },
- { 30, 0x0061, 0x04000041, 0x05, 0x00, 0x0000 },
- { 30, 0x0061, 0x04000041, 0x06, 0x00, 0x0000 },
- { 30, 0x0061, 0x04000041, 0x07, 0x00, 0x0000 },
- { 30, 0x0061, 0x08000041, 0x08, 0x00, 0x0000 },
- { 30, 0x0061, 0x08000041, 0x09, 0x00, 0x0000 },
- { 30, 0x0061, 0x08000041, 0x0a, 0x00, 0x0000 },
- { 30, 0x0061, 0x08000041, 0x0b, 0x00, 0x0000 },
- { 30, 0x0061, 0x0c000041, 0x0c, 0x00, 0x0000 },
- { 30, 0x0061, 0x0c000041, 0x0d, 0x00, 0x0000 },
- { 30, 0x0061, 0x0c000041, 0x0e, 0x00, 0x0000 },
- { 30, 0x0061, 0x0c000041, 0x0f, 0x00, 0x0000 },
- { 31, 0x0073, 0x00000053, 0x00, 0x00, 0x0000 },
- { 31, 0x0053, 0x00000053, 0x01, 0x00, 0x0000 },
- { 31, 0x0073, 0x00000053, 0x02, 0x00, 0x0000 },
- { 31, 0x0053, 0x00000053, 0x03, 0x00, 0x0000 },
- { 31, 0x0073, 0x04000053, 0x04, 0x00, 0x0000 },
- { 31, 0x0073, 0x04000053, 0x05, 0x00, 0x0000 },
- { 31, 0x0073, 0x04000053, 0x06, 0x00, 0x0000 },
- { 31, 0x0073, 0x04000053, 0x07, 0x00, 0x0000 },
- { 31, 0x0073, 0x08000053, 0x08, 0x00, 0x0000 },
- { 31, 0x0073, 0x08000053, 0x09, 0x00, 0x0000 },
- { 31, 0x0073, 0x08000053, 0x0a, 0x00, 0x0000 },
- { 31, 0x0073, 0x08000053, 0x0b, 0x00, 0x0000 },
- { 31, 0x0073, 0x0c000053, 0x0c, 0x00, 0x0000 },
- { 31, 0x0073, 0x0c000053, 0x0d, 0x00, 0x0000 },
- { 31, 0x0073, 0x0c000053, 0x0e, 0x00, 0x0000 },
- { 31, 0x0073, 0x0c000053, 0x0f, 0x00, 0x0000 },
- { 32, 0x0064, 0x00000044, 0x00, 0x00, 0x0000 },
- { 32, 0x0044, 0x00000044, 0x01, 0x00, 0x0000 },
- { 32, 0x0064, 0x00000044, 0x02, 0x00, 0x0000 },
- { 32, 0x0044, 0x00000044, 0x03, 0x00, 0x0000 },
- { 32, 0x0064, 0x04000044, 0x04, 0x00, 0x0000 },
- { 32, 0x0064, 0x04000044, 0x05, 0x00, 0x0000 },
- { 32, 0x0064, 0x04000044, 0x06, 0x00, 0x0000 },
- { 32, 0x0064, 0x04000044, 0x07, 0x00, 0x0000 },
- { 32, 0x0064, 0x08000044, 0x08, 0x00, 0x0000 },
- { 32, 0x0064, 0x08000044, 0x09, 0x00, 0x0000 },
- { 32, 0x0064, 0x08000044, 0x0a, 0x00, 0x0000 },
- { 32, 0x0064, 0x08000044, 0x0b, 0x00, 0x0000 },
- { 32, 0x0064, 0x0c000044, 0x0c, 0x00, 0x0000 },
- { 32, 0x0064, 0x0c000044, 0x0d, 0x00, 0x0000 },
- { 32, 0x0064, 0x0c000044, 0x0e, 0x00, 0x0000 },
- { 32, 0x0064, 0x0c000044, 0x0f, 0x00, 0x0000 },
- { 33, 0x0066, 0x00000046, 0x00, 0x00, 0x0000 },
- { 33, 0x0046, 0x00000046, 0x01, 0x00, 0x0000 },
- { 33, 0x0066, 0x00000046, 0x02, 0x00, 0x0000 },
- { 33, 0x0046, 0x00000046, 0x03, 0x00, 0x0000 },
- { 33, 0x0066, 0x04000046, 0x04, 0x00, 0x0000 },
- { 33, 0x0066, 0x04000046, 0x05, 0x00, 0x0000 },
- { 33, 0x0066, 0x04000046, 0x06, 0x00, 0x0000 },
- { 33, 0x0066, 0x04000046, 0x07, 0x00, 0x0000 },
- { 33, 0x0066, 0x08000046, 0x08, 0x00, 0x0000 },
- { 33, 0x0066, 0x08000046, 0x09, 0x00, 0x0000 },
- { 33, 0x0066, 0x08000046, 0x0a, 0x00, 0x0000 },
- { 33, 0x0066, 0x08000046, 0x0b, 0x00, 0x0000 },
- { 33, 0x0066, 0x0c000046, 0x0c, 0x00, 0x0000 },
- { 33, 0x0066, 0x0c000046, 0x0d, 0x00, 0x0000 },
- { 33, 0x0066, 0x0c000046, 0x0e, 0x00, 0x0000 },
- { 33, 0x0066, 0x0c000046, 0x0f, 0x00, 0x0000 },
- { 34, 0x0067, 0x00000047, 0x00, 0x00, 0x0000 },
- { 34, 0x0047, 0x00000047, 0x01, 0x00, 0x0000 },
- { 34, 0x0067, 0x00000047, 0x02, 0x00, 0x0000 },
- { 34, 0x0047, 0x00000047, 0x03, 0x00, 0x0000 },
- { 34, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 },
- { 34, 0x0067, 0x04000047, 0x05, 0x00, 0x0000 },
- { 34, 0x0067, 0x04000047, 0x06, 0x00, 0x0000 },
- { 34, 0x0067, 0x04000047, 0x07, 0x00, 0x0000 },
- { 34, 0x0067, 0x08000047, 0x08, 0x00, 0x0000 },
- { 34, 0x0067, 0x08000047, 0x09, 0x00, 0x0000 },
- { 34, 0x0067, 0x08000047, 0x0a, 0x00, 0x0000 },
- { 34, 0x0067, 0x08000047, 0x0b, 0x00, 0x0000 },
- { 34, 0x0067, 0x0c000047, 0x0c, 0x00, 0x0000 },
- { 34, 0x0067, 0x0c000047, 0x0d, 0x00, 0x0000 },
- { 34, 0x0067, 0x0c000047, 0x0e, 0x00, 0x0000 },
- { 34, 0x0067, 0x0c000047, 0x0f, 0x00, 0x0000 },
- { 35, 0x0068, 0x00000048, 0x00, 0x00, 0x0000 },
- { 35, 0x0048, 0x00000048, 0x01, 0x00, 0x0000 },
- { 35, 0x0068, 0x00000048, 0x02, 0x00, 0x0000 },
- { 35, 0x0048, 0x00000048, 0x03, 0x00, 0x0000 },
- { 35, 0x0068, 0x04000048, 0x04, 0x00, 0x0000 },
- { 35, 0x0068, 0x04000048, 0x05, 0x00, 0x0000 },
- { 35, 0x0068, 0x04000048, 0x06, 0x00, 0x0000 },
- { 35, 0x0068, 0x04000048, 0x07, 0x00, 0x0000 },
- { 35, 0x0068, 0x08000048, 0x08, 0x00, 0x0000 },
- { 35, 0x0068, 0x08000048, 0x09, 0x00, 0x0000 },
- { 35, 0x0068, 0x08000048, 0x0a, 0x00, 0x0000 },
- { 35, 0x0068, 0x08000048, 0x0b, 0x00, 0x0000 },
- { 35, 0x0068, 0x0c000048, 0x0c, 0x00, 0x0000 },
- { 35, 0x0068, 0x0c000048, 0x0d, 0x00, 0x0000 },
- { 35, 0x0068, 0x0c000048, 0x0e, 0x00, 0x0000 },
- { 35, 0x0068, 0x0c000048, 0x0f, 0x00, 0x0000 },
- { 36, 0x006a, 0x0000004a, 0x00, 0x00, 0x0000 },
- { 36, 0x004a, 0x0000004a, 0x01, 0x00, 0x0000 },
- { 36, 0x006a, 0x0000004a, 0x02, 0x00, 0x0000 },
- { 36, 0x004a, 0x0000004a, 0x03, 0x00, 0x0000 },
- { 36, 0x006a, 0x0400004a, 0x04, 0x00, 0x0000 },
- { 36, 0x006a, 0x0400004a, 0x05, 0x00, 0x0000 },
- { 36, 0x006a, 0x0400004a, 0x06, 0x00, 0x0000 },
- { 36, 0x006a, 0x0400004a, 0x07, 0x00, 0x0000 },
- { 36, 0x006a, 0x0800004a, 0x08, 0x00, 0x0000 },
- { 36, 0x006a, 0x0800004a, 0x09, 0x00, 0x0000 },
- { 36, 0x006a, 0x0800004a, 0x0a, 0x00, 0x0000 },
- { 36, 0x006a, 0x0800004a, 0x0b, 0x00, 0x0000 },
- { 36, 0x006a, 0x0c00004a, 0x0c, 0x00, 0x0000 },
- { 36, 0x006a, 0x0c00004a, 0x0d, 0x00, 0x0000 },
- { 36, 0x006a, 0x0c00004a, 0x0e, 0x00, 0x0000 },
- { 36, 0x006a, 0x0c00004a, 0x0f, 0x00, 0x0000 },
- { 37, 0x006b, 0x0000004b, 0x00, 0x00, 0x0000 },
- { 37, 0x004b, 0x0000004b, 0x01, 0x00, 0x0000 },
- { 37, 0x006b, 0x0000004b, 0x02, 0x00, 0x0000 },
- { 37, 0x004b, 0x0000004b, 0x03, 0x00, 0x0000 },
- { 37, 0x006b, 0x0400004b, 0x04, 0x00, 0x0000 },
- { 37, 0x006b, 0x0400004b, 0x05, 0x00, 0x0000 },
- { 37, 0x006b, 0x0400004b, 0x06, 0x00, 0x0000 },
- { 37, 0x006b, 0x0400004b, 0x07, 0x00, 0x0000 },
- { 37, 0x006b, 0x0800004b, 0x08, 0x00, 0x0000 },
- { 37, 0x006b, 0x0800004b, 0x09, 0x00, 0x0000 },
- { 37, 0x006b, 0x0800004b, 0x0a, 0x00, 0x0000 },
- { 37, 0x006b, 0x0800004b, 0x0b, 0x00, 0x0000 },
- { 37, 0x006b, 0x0c00004b, 0x0c, 0x00, 0x0000 },
- { 37, 0x006b, 0x0c00004b, 0x0d, 0x00, 0x0000 },
- { 37, 0x006b, 0x0c00004b, 0x0e, 0x00, 0x0000 },
- { 37, 0x006b, 0x0c00004b, 0x0f, 0x00, 0x0000 },
- { 38, 0x006c, 0x0000004c, 0x00, 0x00, 0x0000 },
- { 38, 0x004c, 0x0000004c, 0x01, 0x00, 0x0000 },
- { 38, 0x006c, 0x0000004c, 0x02, 0x00, 0x0000 },
- { 38, 0x004c, 0x0000004c, 0x03, 0x00, 0x0000 },
- { 38, 0x006c, 0x0400004c, 0x04, 0x00, 0x0000 },
- { 38, 0x006c, 0x0400004c, 0x05, 0x00, 0x0000 },
- { 38, 0x006c, 0x0400004c, 0x06, 0x00, 0x0000 },
- { 38, 0x006c, 0x0400004c, 0x07, 0x00, 0x0000 },
- { 38, 0x006c, 0x0800004c, 0x08, 0x00, 0x0000 },
- { 38, 0x006c, 0x0800004c, 0x09, 0x00, 0x0000 },
- { 38, 0x006c, 0x0800004c, 0x0a, 0x00, 0x0000 },
- { 38, 0x006c, 0x0800004c, 0x0b, 0x00, 0x0000 },
- { 38, 0x006c, 0x0c00004c, 0x0c, 0x00, 0x0000 },
- { 38, 0x006c, 0x0c00004c, 0x0d, 0x00, 0x0000 },
- { 38, 0x006c, 0x0c00004c, 0x0e, 0x00, 0x0000 },
- { 38, 0x006c, 0x0c00004c, 0x0f, 0x00, 0x0000 },
- { 39, 0x003b, 0x0000003b, 0x00, 0x00, 0x0000 },
- { 39, 0x003a, 0x0000003a, 0x01, 0x00, 0x0000 },
- { 40, 0x0027, 0x00000027, 0x00, 0x00, 0x0000 },
- { 40, 0x0022, 0x00000022, 0x01, 0x00, 0x0000 },
- { 40, 0x0027, 0x01001251, 0x02, 0x01, 0x0000 },
- { 40, 0x0022, 0x01001257, 0x03, 0x01, 0x0000 },
- { 40, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 },
- { 41, 0x0060, 0x00000060, 0x00, 0x00, 0x0000 },
- { 41, 0x007e, 0x0000007e, 0x01, 0x00, 0x0000 },
- { 41, 0x0060, 0x01001250, 0x02, 0x01, 0x0000 },
- { 41, 0x007e, 0x01001253, 0x03, 0x01, 0x0000 },
- { 42, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 },
- { 43, 0x005c, 0x0000005c, 0x00, 0x00, 0x0000 },
- { 43, 0x007c, 0x0000007c, 0x01, 0x00, 0x0000 },
- { 43, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 },
- { 44, 0x007a, 0x0000005a, 0x00, 0x00, 0x0000 },
- { 44, 0x005a, 0x0000005a, 0x01, 0x00, 0x0000 },
- { 44, 0x007a, 0x0000005a, 0x02, 0x00, 0x0000 },
- { 44, 0x005a, 0x0000005a, 0x03, 0x00, 0x0000 },
- { 44, 0x007a, 0x0400005a, 0x04, 0x00, 0x0000 },
- { 44, 0x007a, 0x0400005a, 0x05, 0x00, 0x0000 },
- { 44, 0x007a, 0x0400005a, 0x06, 0x00, 0x0000 },
- { 44, 0x007a, 0x0400005a, 0x07, 0x00, 0x0000 },
- { 44, 0x007a, 0x0800005a, 0x08, 0x00, 0x0000 },
- { 44, 0x007a, 0x0800005a, 0x09, 0x00, 0x0000 },
- { 44, 0x007a, 0x0800005a, 0x0a, 0x00, 0x0000 },
- { 44, 0x007a, 0x0800005a, 0x0b, 0x00, 0x0000 },
- { 44, 0x007a, 0x0c00005a, 0x0c, 0x00, 0x0000 },
- { 44, 0x007a, 0x0c00005a, 0x0d, 0x00, 0x0000 },
- { 44, 0x007a, 0x0c00005a, 0x0e, 0x00, 0x0000 },
- { 44, 0x007a, 0x0c00005a, 0x0f, 0x00, 0x0000 },
- { 45, 0x0078, 0x00000058, 0x00, 0x00, 0x0000 },
- { 45, 0x0058, 0x00000058, 0x01, 0x00, 0x0000 },
- { 45, 0x0078, 0x00000058, 0x02, 0x00, 0x0000 },
- { 45, 0x0058, 0x00000058, 0x03, 0x00, 0x0000 },
- { 45, 0x0078, 0x04000058, 0x04, 0x00, 0x0000 },
- { 45, 0x0078, 0x04000058, 0x05, 0x00, 0x0000 },
- { 45, 0x0078, 0x04000058, 0x06, 0x00, 0x0000 },
- { 45, 0x0078, 0x04000058, 0x07, 0x00, 0x0000 },
- { 45, 0x0078, 0x08000058, 0x08, 0x00, 0x0000 },
- { 45, 0x0078, 0x08000058, 0x09, 0x00, 0x0000 },
- { 45, 0x0078, 0x08000058, 0x0a, 0x00, 0x0000 },
- { 45, 0x0078, 0x08000058, 0x0b, 0x00, 0x0000 },
- { 45, 0x0078, 0x0c000058, 0x0c, 0x00, 0x0000 },
- { 45, 0x0078, 0x0c000058, 0x0d, 0x00, 0x0000 },
- { 45, 0x0078, 0x0c000058, 0x0e, 0x00, 0x0000 },
- { 45, 0x0078, 0x0c000058, 0x0f, 0x00, 0x0000 },
- { 46, 0x0063, 0x00000043, 0x00, 0x00, 0x0000 },
- { 46, 0x0043, 0x00000043, 0x01, 0x00, 0x0000 },
- { 46, 0x0063, 0x00000043, 0x02, 0x00, 0x0000 },
- { 46, 0x0043, 0x00000043, 0x03, 0x00, 0x0000 },
- { 46, 0x0063, 0x04000043, 0x04, 0x00, 0x0000 },
- { 46, 0x0063, 0x04000043, 0x05, 0x00, 0x0000 },
- { 46, 0x0063, 0x04000043, 0x06, 0x00, 0x0000 },
- { 46, 0x0063, 0x04000043, 0x07, 0x00, 0x0000 },
- { 46, 0x0063, 0x08000043, 0x08, 0x00, 0x0000 },
- { 46, 0x0063, 0x08000043, 0x09, 0x00, 0x0000 },
- { 46, 0x0063, 0x08000043, 0x0a, 0x00, 0x0000 },
- { 46, 0x0063, 0x08000043, 0x0b, 0x00, 0x0000 },
- { 46, 0x0063, 0x0c000043, 0x0c, 0x00, 0x0000 },
- { 46, 0x0063, 0x0c000043, 0x0d, 0x00, 0x0000 },
- { 46, 0x0063, 0x0c000043, 0x0e, 0x00, 0x0000 },
- { 46, 0x0063, 0x0c000043, 0x0f, 0x00, 0x0000 },
- { 47, 0x0076, 0x00000056, 0x00, 0x00, 0x0000 },
- { 47, 0x0056, 0x00000056, 0x01, 0x00, 0x0000 },
- { 47, 0x0076, 0x00000056, 0x02, 0x00, 0x0000 },
- { 47, 0x0056, 0x00000056, 0x03, 0x00, 0x0000 },
- { 47, 0x0076, 0x04000056, 0x04, 0x00, 0x0000 },
- { 47, 0x0076, 0x04000056, 0x05, 0x00, 0x0000 },
- { 47, 0x0076, 0x04000056, 0x06, 0x00, 0x0000 },
- { 47, 0x0076, 0x04000056, 0x07, 0x00, 0x0000 },
- { 47, 0x0076, 0x08000056, 0x08, 0x00, 0x0000 },
- { 47, 0x0076, 0x08000056, 0x09, 0x00, 0x0000 },
- { 47, 0x0076, 0x08000056, 0x0a, 0x00, 0x0000 },
- { 47, 0x0076, 0x08000056, 0x0b, 0x00, 0x0000 },
- { 47, 0x0076, 0x0c000056, 0x0c, 0x00, 0x0000 },
- { 47, 0x0076, 0x0c000056, 0x0d, 0x00, 0x0000 },
- { 47, 0x0076, 0x0c000056, 0x0e, 0x00, 0x0000 },
- { 47, 0x0076, 0x0c000056, 0x0f, 0x00, 0x0000 },
- { 48, 0x0062, 0x00000042, 0x00, 0x00, 0x0000 },
- { 48, 0x0042, 0x00000042, 0x01, 0x00, 0x0000 },
- { 48, 0x0062, 0x00000042, 0x02, 0x00, 0x0000 },
- { 48, 0x0042, 0x00000042, 0x03, 0x00, 0x0000 },
- { 48, 0x0062, 0x04000042, 0x04, 0x00, 0x0000 },
- { 48, 0x0062, 0x04000042, 0x05, 0x00, 0x0000 },
- { 48, 0x0062, 0x04000042, 0x06, 0x00, 0x0000 },
- { 48, 0x0062, 0x04000042, 0x07, 0x00, 0x0000 },
- { 48, 0x0062, 0x08000042, 0x08, 0x00, 0x0000 },
- { 48, 0x0062, 0x08000042, 0x09, 0x00, 0x0000 },
- { 48, 0x0062, 0x08000042, 0x0a, 0x00, 0x0000 },
- { 48, 0x0062, 0x08000042, 0x0b, 0x00, 0x0000 },
- { 48, 0x0062, 0x0c000042, 0x0c, 0x00, 0x0000 },
- { 48, 0x0062, 0x0c000042, 0x0d, 0x00, 0x0000 },
- { 48, 0x0062, 0x0c000042, 0x0e, 0x00, 0x0000 },
- { 48, 0x0062, 0x0c000042, 0x0f, 0x00, 0x0000 },
- { 49, 0x006e, 0x0000004e, 0x00, 0x00, 0x0000 },
- { 49, 0x004e, 0x0000004e, 0x01, 0x00, 0x0000 },
- { 49, 0x006e, 0x0000004e, 0x02, 0x00, 0x0000 },
- { 49, 0x004e, 0x0000004e, 0x03, 0x00, 0x0000 },
- { 49, 0x006e, 0x0400004e, 0x04, 0x00, 0x0000 },
- { 49, 0x006e, 0x0400004e, 0x05, 0x00, 0x0000 },
- { 49, 0x006e, 0x0400004e, 0x06, 0x00, 0x0000 },
- { 49, 0x006e, 0x0400004e, 0x07, 0x00, 0x0000 },
- { 49, 0x006e, 0x0800004e, 0x08, 0x00, 0x0000 },
- { 49, 0x006e, 0x0800004e, 0x09, 0x00, 0x0000 },
- { 49, 0x006e, 0x0800004e, 0x0a, 0x00, 0x0000 },
- { 49, 0x006e, 0x0800004e, 0x0b, 0x00, 0x0000 },
- { 49, 0x006e, 0x0c00004e, 0x0c, 0x00, 0x0000 },
- { 49, 0x006e, 0x0c00004e, 0x0d, 0x00, 0x0000 },
- { 49, 0x006e, 0x0c00004e, 0x0e, 0x00, 0x0000 },
- { 49, 0x006e, 0x0c00004e, 0x0f, 0x00, 0x0000 },
- { 50, 0x006d, 0x0000004d, 0x00, 0x00, 0x0000 },
- { 50, 0x004d, 0x0000004d, 0x01, 0x00, 0x0000 },
- { 50, 0x006d, 0x0000004d, 0x02, 0x00, 0x0000 },
- { 50, 0x004d, 0x0000004d, 0x03, 0x00, 0x0000 },
- { 50, 0x006d, 0x0400004d, 0x04, 0x00, 0x0000 },
- { 50, 0x006d, 0x0400004d, 0x05, 0x00, 0x0000 },
- { 50, 0x006d, 0x0400004d, 0x06, 0x00, 0x0000 },
- { 50, 0x006d, 0x0400004d, 0x07, 0x00, 0x0000 },
- { 50, 0x006d, 0x0800004d, 0x08, 0x00, 0x0000 },
- { 50, 0x006d, 0x0800004d, 0x09, 0x00, 0x0000 },
- { 50, 0x006d, 0x0800004d, 0x0a, 0x00, 0x0000 },
- { 50, 0x006d, 0x0800004d, 0x0b, 0x00, 0x0000 },
- { 50, 0x006d, 0x0c00004d, 0x0c, 0x00, 0x0000 },
- { 50, 0x006d, 0x0c00004d, 0x0d, 0x00, 0x0000 },
- { 50, 0x006d, 0x0c00004d, 0x0e, 0x00, 0x0000 },
- { 50, 0x006d, 0x0c00004d, 0x0f, 0x00, 0x0000 },
- { 51, 0x002c, 0x0000002c, 0x00, 0x00, 0x0000 },
- { 51, 0x003c, 0x0000003c, 0x01, 0x00, 0x0000 },
- { 51, 0x002c, 0x0100125b, 0x02, 0x01, 0x0000 },
- { 52, 0x002e, 0x0000002e, 0x00, 0x00, 0x0000 },
- { 52, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 },
- { 52, 0xffff, 0x01001120, 0x02, 0x00, 0x0000 },
- { 53, 0x002f, 0x0000002f, 0x00, 0x00, 0x0000 },
- { 53, 0x003f, 0x0000003f, 0x01, 0x00, 0x0000 },
- { 53, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 },
- { 54, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 },
- { 55, 0x002a, 0x2000002a, 0x00, 0x00, 0x0000 },
- { 56, 0xffff, 0x01000023, 0x00, 0x04, 0x0008 },
- { 57, 0x0020, 0x00000020, 0x00, 0x00, 0x0000 },
- { 58, 0xffff, 0x01000024, 0x00, 0x00, 0x0000 },
- { 59, 0xffff, 0x01000030, 0x00, 0x00, 0x0000 },
- { 59, 0xffff, 0x0100003c, 0x01, 0x00, 0x0000 },
- { 59, 0xffff, 0x01000048, 0x04, 0x00, 0x0000 },
- { 59, 0xffff, 0x01000000, 0x0c, 0x08, 0x0100 },
- { 60, 0xffff, 0x01000031, 0x00, 0x00, 0x0000 },
- { 60, 0xffff, 0x0100003d, 0x01, 0x00, 0x0000 },
- { 60, 0xffff, 0x01000049, 0x04, 0x00, 0x0000 },
- { 60, 0xffff, 0x01000000, 0x0c, 0x08, 0x0101 },
- { 61, 0xffff, 0x01000032, 0x00, 0x00, 0x0000 },
- { 61, 0xffff, 0x0100003e, 0x01, 0x00, 0x0000 },
- { 61, 0xffff, 0x0100004a, 0x04, 0x00, 0x0000 },
- { 61, 0xffff, 0x01000000, 0x0c, 0x08, 0x0102 },
- { 62, 0xffff, 0x01000033, 0x00, 0x00, 0x0000 },
- { 62, 0xffff, 0x0100003f, 0x01, 0x00, 0x0000 },
- { 62, 0xffff, 0x0100004b, 0x04, 0x00, 0x0000 },
- { 62, 0xffff, 0x01000000, 0x0c, 0x08, 0x0103 },
- { 63, 0xffff, 0x01000034, 0x00, 0x00, 0x0000 },
- { 63, 0xffff, 0x01000040, 0x01, 0x00, 0x0000 },
- { 63, 0xffff, 0x0100004c, 0x04, 0x00, 0x0000 },
- { 63, 0xffff, 0x01000000, 0x0c, 0x08, 0x0104 },
- { 64, 0xffff, 0x01000035, 0x00, 0x00, 0x0000 },
- { 64, 0xffff, 0x01000041, 0x01, 0x00, 0x0000 },
- { 64, 0xffff, 0x0100004d, 0x04, 0x00, 0x0000 },
- { 64, 0xffff, 0x01000000, 0x0c, 0x08, 0x0105 },
- { 65, 0xffff, 0x01000036, 0x00, 0x00, 0x0000 },
- { 65, 0xffff, 0x01000042, 0x01, 0x00, 0x0000 },
- { 65, 0xffff, 0x0100004e, 0x04, 0x00, 0x0000 },
- { 65, 0xffff, 0x01000000, 0x0c, 0x08, 0x0106 },
- { 66, 0xffff, 0x01000037, 0x00, 0x00, 0x0000 },
- { 66, 0xffff, 0x01000043, 0x01, 0x00, 0x0000 },
- { 66, 0xffff, 0x0100004f, 0x04, 0x00, 0x0000 },
- { 66, 0xffff, 0x01000000, 0x0c, 0x08, 0x0107 },
- { 67, 0xffff, 0x01000038, 0x00, 0x00, 0x0000 },
- { 67, 0xffff, 0x01000044, 0x01, 0x00, 0x0000 },
- { 67, 0xffff, 0x01000050, 0x04, 0x00, 0x0000 },
- { 67, 0xffff, 0x01000000, 0x0c, 0x08, 0x0108 },
- { 68, 0xffff, 0x01000039, 0x00, 0x00, 0x0000 },
- { 68, 0xffff, 0x01000045, 0x01, 0x00, 0x0000 },
- { 68, 0xffff, 0x01000051, 0x04, 0x00, 0x0000 },
- { 68, 0xffff, 0x01000000, 0x0c, 0x08, 0x0109 },
- { 69, 0xffff, 0x01000025, 0x00, 0x00, 0x0000 },
- { 70, 0xffff, 0x01000026, 0x00, 0x00, 0x0000 },
- { 70, 0xffff, 0x01000026, 0x08, 0x00, 0x0000 },
- { 71, 0x0037, 0x20000037, 0x00, 0x00, 0x0000 },
- { 72, 0x0038, 0x20000038, 0x00, 0x00, 0x0000 },
- { 73, 0x0039, 0x20000039, 0x00, 0x00, 0x0000 },
- { 74, 0x002d, 0x2000002d, 0x00, 0x00, 0x0000 },
- { 75, 0x0034, 0x20000034, 0x00, 0x00, 0x0000 },
- { 76, 0x0035, 0x20000035, 0x00, 0x00, 0x0000 },
- { 77, 0x0036, 0x20000036, 0x00, 0x00, 0x0000 },
- { 78, 0x002b, 0x2000002b, 0x00, 0x00, 0x0000 },
- { 79, 0x0031, 0x20000031, 0x00, 0x00, 0x0000 },
- { 80, 0x0032, 0x20000032, 0x00, 0x00, 0x0000 },
- { 81, 0x0033, 0x20000033, 0x00, 0x00, 0x0000 },
- { 82, 0x0030, 0x20000030, 0x00, 0x00, 0x0000 },
- { 83, 0x002e, 0x2000002e, 0x00, 0x00, 0x0000 },
- { 83, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 },
- { 83, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 },
- { 86, 0x003c, 0x0000003c, 0x00, 0x00, 0x0000 },
- { 86, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 },
- { 86, 0x007c, 0x0000007c, 0x02, 0x00, 0x0000 },
- { 87, 0xffff, 0x0100003a, 0x00, 0x00, 0x0000 },
- { 87, 0xffff, 0x01000046, 0x01, 0x00, 0x0000 },
- { 87, 0xffff, 0x01000052, 0x04, 0x00, 0x0000 },
- { 87, 0xffff, 0x01000000, 0x0c, 0x08, 0x010a },
- { 88, 0xffff, 0x0100003b, 0x00, 0x00, 0x0000 },
- { 88, 0xffff, 0x01000047, 0x01, 0x00, 0x0000 },
- { 88, 0xffff, 0x01000000, 0x0c, 0x08, 0x010b },
- { 96, 0xffff, 0x21000005, 0x00, 0x00, 0x0000 },
- { 97, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 },
- { 98, 0x002f, 0x2000002f, 0x00, 0x00, 0x0000 },
- { 99, 0x005c, 0x0400005c, 0x00, 0x00, 0x0000 },
- { 100, 0xffff, 0x01001103, 0x00, 0x04, 0x0002 },
- { 102, 0xffff, 0x01000010, 0x00, 0x00, 0x0000 },
- { 103, 0xffff, 0x01000013, 0x00, 0x00, 0x0000 },
- { 104, 0xffff, 0x01000016, 0x00, 0x00, 0x0000 },
- { 105, 0xffff, 0x01000012, 0x00, 0x00, 0x0000 },
- { 105, 0xffff, 0x01000000, 0x0c, 0x08, 0x0180 },
- { 106, 0xffff, 0x01000014, 0x00, 0x00, 0x0000 },
- { 106, 0xffff, 0x01000000, 0x0c, 0x08, 0x0181 },
- { 107, 0xffff, 0x01000011, 0x00, 0x00, 0x0000 },
- { 108, 0xffff, 0x01000015, 0x00, 0x00, 0x0000 },
- { 109, 0xffff, 0x01000017, 0x00, 0x00, 0x0000 },
- { 110, 0xffff, 0x01000006, 0x00, 0x00, 0x0000 },
- { 111, 0xffff, 0x01000007, 0x00, 0x00, 0x0000 },
- { 111, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 },
- { 111, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 },
- { 113, 0xffff, 0x01000071, 0x00, 0x00, 0x0000 },
- { 114, 0xffff, 0x01000070, 0x00, 0x00, 0x0000 },
- { 115, 0xffff, 0x01000072, 0x00, 0x00, 0x0000 },
- { 116, 0xffff, 0x0100010b, 0x00, 0x00, 0x0000 },
- { 119, 0xffff, 0x01000008, 0x00, 0x00, 0x0000 },
- { 138, 0xffff, 0x01000058, 0x00, 0x00, 0x0000 },
- { 139, 0xffff, 0x01000055, 0x00, 0x00, 0x0000 },
- { 152, 0xffff, 0x010000ba, 0x00, 0x00, 0x0000 },
-
-};
-
-const QWSKeyboard::Composing QWSKbPrivate::s_keycompose_default[] = {
- { 0x0060, 0x0041, 0x00c0 },
- { 0x0060, 0x0061, 0x00e0 },
- { 0x0027, 0x0041, 0x00c1 },
- { 0x0027, 0x0061, 0x00e1 },
- { 0x005e, 0x0041, 0x00c2 },
- { 0x005e, 0x0061, 0x00e2 },
- { 0x007e, 0x0041, 0x00c3 },
- { 0x007e, 0x0061, 0x00e3 },
- { 0x0022, 0x0041, 0x00c4 },
- { 0x0022, 0x0061, 0x00e4 },
- { 0x002d, 0x0061, 0x00aa },
- { 0x002d, 0x0041, 0x00aa },
- { 0x004f, 0x0041, 0x00c5 },
- { 0x006f, 0x0061, 0x00e5 },
- { 0x0030, 0x0041, 0x00c5 },
- { 0x0030, 0x0061, 0x00e5 },
- { 0x0041, 0x0041, 0x00c5 },
- { 0x0061, 0x0061, 0x00e5 },
- { 0x00b0, 0x0041, 0x00c5 },
- { 0x00b0, 0x0061, 0x00e5 },
- { 0x0041, 0x0045, 0x00c6 },
- { 0x0061, 0x0065, 0x00e6 },
- { 0x002c, 0x0043, 0x00c7 },
- { 0x002c, 0x0063, 0x00e7 },
- { 0x005e, 0x0043, 0x00c7 },
- { 0x005e, 0x0063, 0x00e7 },
- { 0x0060, 0x0045, 0x00c8 },
- { 0x0060, 0x0065, 0x00e8 },
- { 0x0027, 0x0045, 0x00c9 },
- { 0x0027, 0x0065, 0x00e9 },
- { 0x005e, 0x0045, 0x00ca },
- { 0x005e, 0x0065, 0x00ea },
- { 0x0022, 0x0045, 0x00cb },
- { 0x0022, 0x0065, 0x00eb },
- { 0x0060, 0x0049, 0x00cc },
- { 0x0060, 0x0069, 0x00ec },
- { 0x0027, 0x0049, 0x00cd },
- { 0x0027, 0x0069, 0x00ed },
- { 0x005e, 0x0049, 0x00ce },
- { 0x005e, 0x0069, 0x00ee },
- { 0x0022, 0x0049, 0x00cf },
- { 0x0022, 0x0069, 0x00ef },
- { 0x002d, 0x0044, 0x00d0 },
- { 0x002d, 0x0064, 0x00f0 },
- { 0x005e, 0x0044, 0x00d0 },
- { 0x005e, 0x0064, 0x00f0 },
- { 0x007e, 0x004e, 0x00d1 },
- { 0x007e, 0x006e, 0x00f1 },
- { 0x005e, 0x004e, 0x00d1 },
- { 0x005e, 0x006e, 0x00f1 },
- { 0x0060, 0x004f, 0x00d2 },
- { 0x0060, 0x006f, 0x00f2 },
- { 0x0027, 0x004f, 0x00d3 },
- { 0x0027, 0x006f, 0x00f3 },
- { 0x005e, 0x004f, 0x00d4 },
- { 0x005e, 0x006f, 0x00f4 },
- { 0x007e, 0x004f, 0x00d5 },
- { 0x007e, 0x006f, 0x00f5 },
- { 0x0022, 0x004f, 0x00d6 },
- { 0x0022, 0x006f, 0x00f6 },
- { 0x002f, 0x004f, 0x00d8 },
- { 0x002f, 0x006f, 0x00f8 },
- { 0x002d, 0x006f, 0x00ba },
- { 0x002d, 0x004f, 0x00ba },
- { 0x0060, 0x0055, 0x00d9 },
- { 0x0060, 0x0075, 0x00f9 },
- { 0x0027, 0x0055, 0x00da },
- { 0x0027, 0x0075, 0x00fa },
- { 0x005e, 0x0055, 0x00db },
- { 0x005e, 0x0075, 0x00fb },
- { 0x0022, 0x0055, 0x00dc },
- { 0x0022, 0x0075, 0x00fc },
- { 0x0027, 0x0059, 0x00dd },
- { 0x0027, 0x0079, 0x00fd },
- { 0x0054, 0x0048, 0x00de },
- { 0x0074, 0x0068, 0x00fe },
- { 0x0073, 0x0073, 0x00df },
- { 0x0022, 0x0079, 0x00ff },
- { 0x0073, 0x007a, 0x00df },
- { 0x006e, 0x006e, 0x00f1 },
- { 0x006e, 0x0068, 0x00f1 },
- { 0x004e, 0x0059, 0x00d1 },
- { 0x004e, 0x004e, 0x00d1 },
- { 0x004e, 0x0048, 0x00d1 },
- { 0x004e, 0x0079, 0x00d1 },
- { 0x004e, 0x006e, 0x00d1 },
- { 0x004e, 0x0068, 0x00d1 },
- { 0x002d, 0x004c, 0x00a3 },
- { 0x003c, 0x003c, 0x00ab },
- { 0x003e, 0x003e, 0x00bb },
- { 0x003f, 0x003f, 0x00bf },
- { 0x005e, 0x003f, 0x00bf },
- { 0x0021, 0x0021, 0x00a1 },
- { 0x005e, 0x0021, 0x00a1 },
- { 0x005e, 0x0031, 0x00b9 },
- { 0x005e, 0x0032, 0x00b2 },
- { 0x005e, 0x0033, 0x00b3 },
- { 0x002b, 0x002d, 0x00b1 },
- { 0x0063, 0x003d, 0x00a2 },
- { 0x0063, 0x002f, 0x00a2 },
- { 0x002f, 0x0063, 0x00a2 },
- { 0x002d, 0x0063, 0x00a2 },
- { 0x002d, 0x0043, 0x00a2 },
- { 0x004c, 0x003d, 0x00a3 },
- { 0x002d, 0x004c, 0x00a3 },
- { 0x002d, 0x006c, 0x00a3 },
- { 0x005e, 0x002a, 0x00d7 },
- { 0x005e, 0x0078, 0x00d7 },
- { 0x0078, 0x0078, 0x00d7 },
- { 0x005e, 0x002e, 0x00b7 },
- { 0x002e, 0x002e, 0x00b7 },
- { 0x005e, 0x002f, 0x00f7 },
- { 0x005e, 0x003a, 0x00f7 },
- { 0x002d, 0x003a, 0x00f7 },
- { 0x003a, 0x002d, 0x00f7 },
- { 0x0059, 0x003d, 0x00a5 },
- { 0x002d, 0x0059, 0x00a5 },
- { 0x002d, 0x006c, 0x00a5 },
- { 0x0028, 0x0063, 0x00a9 },
- { 0x0022, 0x0063, 0x00a9 },
- { 0x002d, 0x0061, 0x00aa },
- { 0x002d, 0x0041, 0x00aa },
- { 0x002d, 0x006f, 0x00ba },
- { 0x002d, 0x004f, 0x00ba },
- { 0x0028, 0x0072, 0x00ae },
- { 0x0022, 0x0072, 0x00ae },
- { 0x006d, 0x0075, 0x00b5 },
- { 0x0031, 0x0034, 0x0152 },
- { 0x0031, 0x0032, 0x0153 },
- { 0x0033, 0x0034, 0x0178 },
- { 0x0065, 0x003d, 0x20ac },
- { 0x002d, 0x0065, 0x20ac },
- { 0x002d, 0x0045, 0x20ac },
- { 0x0076, 0x0053, 0x0160 },
- { 0x005e, 0x0053, 0x0160 },
- { 0x0076, 0x0073, 0x0161 },
- { 0x005e, 0x0073, 0x0161 },
- { 0x0076, 0x005a, 0x017d },
- { 0x005e, 0x005a, 0x017d },
- { 0x0076, 0x007a, 0x017e },
- { 0x005e, 0x007a, 0x017e },
- { 0x004f, 0x0045, 0x0152 },
- { 0x004f, 0x0065, 0x0152 },
- { 0x006f, 0x0065, 0x0153 },
- { 0x0022, 0x0059, 0x0178 },
- { 0x0069, 0x006a, 0x00ff },
- { 0x0049, 0x004a, 0x0178 },
-};
-
-#endif
diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp
deleted file mode 100644
index 9d2c6e86d8..0000000000
--- a/src/gui/embedded/qkbd_qws.cpp
+++ /dev/null
@@ -1,693 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbd_qws.h"
-#include "qkbd_qws_p.h"
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#include <QFile>
-#include <QDataStream>
-#include <QStringList>
-
-#ifdef Q_WS_QWS
-#include "qwindowsystem_qws.h"
-#include "qscreen_qws.h"
-#endif
-
-#ifdef Q_WS_QPA
-#include <QWindowSystemInterface>
-#include <QKeyEvent>
-#endif
-
-#include "qtimer.h"
-#include <stdlib.h>
-
-//#define QT_DEBUG_KEYMAP
-
-
-QT_BEGIN_NAMESPACE
-
-class QWSKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSKbPrivate(QWSKeyboardHandler *h, const QString &device)
- : m_handler(h), m_modifiers(0), m_composing(0), m_dead_unicode(0xffff),
- m_no_zap(false), m_do_compose(false),
- m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0)
- {
- m_ar_timer = new QTimer(this);
- m_ar_timer->setSingleShot(true);
- connect(m_ar_timer, SIGNAL(timeout()), SLOT(autoRepeat()));
- m_ar_delay = 400;
- m_ar_period = 80;
-
- memset(m_locks, 0, sizeof(m_locks));
-
- QString keymap;
- QStringList args = device.split(QLatin1Char(':'));
- foreach (const QString &arg, args) {
- if (arg.startsWith(QLatin1String("keymap=")))
- keymap = arg.mid(7);
- else if (arg == QLatin1String("disable-zap"))
- m_no_zap = true;
- else if (arg == QLatin1String("enable-compose"))
- m_do_compose = true;
- else if (arg.startsWith(QLatin1String("repeat-delay=")))
- m_ar_delay = arg.mid(13).toInt();
- else if (arg.startsWith(QLatin1String("repeat-rate=")))
- m_ar_period = arg.mid(12).toInt();
- }
-
- if (keymap.isEmpty() || !loadKeymap(keymap))
- unloadKeymap();
- }
-
- ~QWSKbPrivate()
- {
- unloadKeymap();
- }
-
- void beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod)
- {
- m_ar_unicode = uni;
- m_ar_keycode = code;
- m_ar_modifier = mod;
- m_ar_timer->start(m_ar_delay);
- }
-
- void endAutoRepeat()
- {
- m_ar_timer->stop();
- }
-
- static Qt::KeyboardModifiers toQtModifiers(quint8 mod)
- {
- Qt::KeyboardModifiers qtmod = Qt::NoModifier;
-
- if (mod & (QWSKeyboard::ModShift | QWSKeyboard::ModShiftL | QWSKeyboard::ModShiftR))
- qtmod |= Qt::ShiftModifier;
- if (mod & (QWSKeyboard::ModControl | QWSKeyboard::ModCtrlL | QWSKeyboard::ModCtrlR))
- qtmod |= Qt::ControlModifier;
- if (mod & QWSKeyboard::ModAlt)
- qtmod |= Qt::AltModifier;
-
- return qtmod;
- }
-
- void unloadKeymap();
- bool loadKeymap(const QString &file);
-
-private slots:
- void autoRepeat()
- {
- m_handler->processKeyEvent(m_ar_unicode, m_ar_keycode, m_ar_modifier, false, true);
- m_handler->processKeyEvent(m_ar_unicode, m_ar_keycode, m_ar_modifier, true, true);
- m_ar_timer->start(m_ar_period);
- }
-
-private:
- QWSKeyboardHandler *m_handler;
-
- // auto repeat simulation
- int m_ar_unicode;
- int m_ar_keycode;
- Qt::KeyboardModifiers m_ar_modifier;
- int m_ar_delay;
- int m_ar_period;
- QTimer *m_ar_timer;
-
- // keymap handling
- quint8 m_modifiers;
- quint8 m_locks[3];
- int m_composing;
- quint16 m_dead_unicode;
-
- bool m_no_zap;
- bool m_do_compose;
-
- const QWSKeyboard::Mapping *m_keymap;
- int m_keymap_size;
- const QWSKeyboard::Composing *m_keycompose;
- int m_keycompose_size;
-
- static const QWSKeyboard::Mapping s_keymap_default[];
- static const QWSKeyboard::Composing s_keycompose_default[];
-
- friend class QWSKeyboardHandler;
-};
-
-// simple builtin US keymap
-#include "qkbd_defaultmap_qws_p.h"
-
-// the unloadKeymap() function needs to be AFTER the defaultmap include,
-// since the sizeof(s_keymap_default) wouldn't work otherwise.
-
-void QWSKbPrivate::unloadKeymap()
-{
- if (m_keymap && m_keymap != s_keymap_default)
- delete [] m_keymap;
- if (m_keycompose && m_keycompose != s_keycompose_default)
- delete [] m_keycompose;
-
- m_keymap = s_keymap_default;
- m_keymap_size = sizeof(s_keymap_default) / sizeof(s_keymap_default[0]);
- m_keycompose = s_keycompose_default;
- m_keycompose_size = sizeof(s_keycompose_default) / sizeof(s_keycompose_default[0]);
-
- // reset state, so we could switch keymaps at runtime
- m_modifiers = 0;
- memset(m_locks, 0, sizeof(m_locks));
- m_composing = 0;
- m_dead_unicode = 0xffff;
-}
-
-bool QWSKbPrivate::loadKeymap(const QString &file)
-{
- QFile f(file);
-
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning("Could not open keymap file '%s'", qPrintable(file));
- return false;
- }
-
- // .qmap files have a very simple structure:
- // quint32 magic (QWSKeyboard::FileMagic)
- // quint32 version (1)
- // quint32 keymap_size (# of struct QWSKeyboard::Mappings)
- // quint32 keycompose_size (# of struct QWSKeyboard::Composings)
- // all QWSKeyboard::Mappings via QDataStream::operator(<<|>>)
- // all QWSKeyboard::Composings via QDataStream::operator(<<|>>)
-
- quint32 qmap_magic, qmap_version, qmap_keymap_size, qmap_keycompose_size;
-
- QDataStream ds(&f);
-
- ds >> qmap_magic >> qmap_version >> qmap_keymap_size >> qmap_keycompose_size;
-
- if (ds.status() != QDataStream::Ok || qmap_magic != QWSKeyboard::FileMagic || qmap_version != 1 || qmap_keymap_size == 0) {
- qWarning("'%s' is ot a valid.qmap keymap file.", qPrintable(file));
- return false;
- }
-
- QWSKeyboard::Mapping *qmap_keymap = new QWSKeyboard::Mapping[qmap_keymap_size];
- QWSKeyboard::Composing *qmap_keycompose = qmap_keycompose_size ? new QWSKeyboard::Composing[qmap_keycompose_size] : 0;
-
- for (quint32 i = 0; i < qmap_keymap_size; ++i)
- ds >> qmap_keymap[i];
- for (quint32 i = 0; i < qmap_keycompose_size; ++i)
- ds >> qmap_keycompose[i];
-
- if (ds.status() != QDataStream::Ok) {
- delete [] qmap_keymap;
- delete [] qmap_keycompose;
-
- qWarning("Keymap file '%s' can not be loaded.", qPrintable(file));
- return false;
- }
-
- // unload currently active and clear state
- unloadKeymap();
-
- m_keymap = qmap_keymap;
- m_keymap_size = qmap_keymap_size;
- m_keycompose = qmap_keycompose;
- m_keycompose_size = qmap_keycompose_size;
-
- m_do_compose = true;
-
- return true;
-}
-
-
-/*!
- \class QWSKeyboardHandler
- \ingroup qws
-
- \brief The QWSKeyboardHandler class is a base class for keyboard
- drivers in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several keyboard
- protocols, see the \l{Qt for Embedded Linux Character Input}{character
- input} documentation for details. Custom keyboard drivers can be
- implemented by subclassing the QWSKeyboardHandler class and
- creating a keyboard driver plugin (derived from
- QKbdDriverPlugin). The default implementation of the
- QKbdDriverFactory class will automatically detect the plugin, and
- load the driver into the server application at run-time using Qt's
- \l{How to Create Qt Plugins}{plugin system}.
-
- The keyboard driver receives keyboard events from the system
- device and encapsulates each event with an instance of the
- QWSEvent class which it then passes to the server application (the
- server is responsible for propagating the event to the appropriate
- client). To receive keyboard events, a QWSKeyboardHandler object
- will usually create a QSocketNotifier object for the given
- device. The QSocketNotifier class provides support for monitoring
- activity on a file descriptor. When the socket notifier receives
- data, it will call the keyboard driver's processKeyEvent()
- function to send the event to the \l{Qt for Embedded Linux} server
- application for relaying to clients.
-
-
- QWSKeyboardHandler also provides functions to control
- auto-repetion of key sequences, beginAutoRepeat() and
- endAutoRepeat(), and the transformDirKey() function enabling
- transformation of arrow keys according to the display orientation.
-
- \sa QKbdDriverPlugin, QKbdDriverFactory, {Qt for Embedded Linux Character Input}
-*/
-
-
-/*!
- Constructs a keyboard driver. The \a device argument is passed by the
- QWS_KEYBOARD environment variable.
-
- Call the QWSServer::setKeyboardHandler() function to make the
- newly created keyboard driver, the primary driver. Note that the
- primary driver is controlled by the system, i.e., the system will
- delete it upon exit.
-*/
-QWSKeyboardHandler::QWSKeyboardHandler(const QString &device)
-{
- d = new QWSKbPrivate(this, device);
-}
-
-/*!
- \overload
-*/
-QWSKeyboardHandler::QWSKeyboardHandler()
-{
- d = new QWSKbPrivate(this, QString());
-}
-
-
-
-/*!
- Destroys this keyboard driver.
-
- Do not call this function if this driver is the primary keyboard
- handler, i.e., if QWSServer::setKeyboardHandler() function has
- been called passing this driver as argument. The primary keyboard
- driver is deleted by the system.
-*/
-QWSKeyboardHandler::~QWSKeyboardHandler()
-{
- delete d;
-}
-
-
-/*!
- Sends a key event to the \l{Qt for Embedded Linux} server application.
-
- The key event is identified by its \a unicode value and the \a
- keycode, \a modifiers, \a isPress and \a autoRepeat parameters.
-
- The \a keycode parameter is the Qt keycode value as defined by the
- Qt::Key enum. The \a modifiers is an OR combination of
- Qt::KeyboardModifier values, indicating whether \gui
- Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true
- if the event is a key press event and \a autoRepeat is true if the
- event is caused by an auto-repeat mechanism and not an actual key
- press.
-
- Note that this function does not handle key mapping. Please use
- processKeycode() if you need that functionality.
-
- \sa processKeycode(), beginAutoRepeat(), endAutoRepeat(), transformDirKey()
-*/
-void QWSKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat)
-{
-#if defined(Q_WS_QWS)
- qwsServer->processKeyEvent(unicode, keycode, modifiers, isPress, autoRepeat);
-#elif defined(Q_WS_QPA)
- QEvent::Type type = isPress ? QEvent::KeyPress : QEvent::KeyRelease;
- QString str;
- if (unicode != 0xffff)
- str = QString(unicode);
- QWindowSystemInterface::handleKeyEvent(0, type, keycode, modifiers, str);
-#endif
-}
-
-/*!
- \fn int QWSKeyboardHandler::transformDirKey(int keycode)
-
- Transforms the arrow key specified by the given \a keycode, to the
- orientation of the display and returns the transformed keycode.
-
- The \a keycode is a Qt::Key value. The values identifying arrow
- keys are:
-
- \list
- \o Qt::Key_Left
- \o Qt::Key_Up
- \o Qt::Key_Right
- \o Qt::Key_Down
- \endlist
-
- \sa processKeyEvent()
- */
-int QWSKeyboardHandler::transformDirKey(int key)
-{
-#ifdef Q_WS_QWS
- static int dir_keyrot = -1;
- if (dir_keyrot < 0) {
- // get the rotation
- switch (qgetenv("QWS_CURSOR_ROTATION").toInt()) {
- case 90: dir_keyrot = 1; break;
- case 180: dir_keyrot = 2; break;
- case 270: dir_keyrot = 3; break;
- default: dir_keyrot = 0; break;
- }
- }
- int xf = qt_screen->transformOrientation() + dir_keyrot;
- return (key-Qt::Key_Left+xf)%4+Qt::Key_Left;
-#else
- return 0;
-#endif
-}
-
-/*!
- \fn void QWSKeyboardHandler::beginAutoRepeat(int unicode, int keycode, Qt::KeyboardModifiers modifier)
-
- Begins auto-repeating the specified key press; after a short delay
- the key press is sent periodically until the endAutoRepeat()
- function is called.
-
- The key press is specified by its \a unicode, \a keycode and \a
- modifier state.
-
- \sa endAutoRepeat(), processKeyEvent()
-*/
-void QWSKeyboardHandler::beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod)
-{
- d->beginAutoRepeat(uni, code, mod);
-}
-
-/*!
- Stops auto-repeating a key press.
-
- \sa beginAutoRepeat(), processKeyEvent()
-*/
-void QWSKeyboardHandler::endAutoRepeat()
-{
- d->endAutoRepeat();
-}
-
-/*!
- \enum QWSKeyboardHandler::KeycodeAction
-
- This enum describes the various special actions that actual
- QWSKeyboardHandler implementations have to take care of.
-
- \value None No further action required.
-
- \value CapsLockOn Set the state of the Caps lock LED to on.
- \value CapsLockOff Set the state of the Caps lock LED to off.
- \value NumLockOn Set the state of the Num lock LED to on.
- \value NumLockOff Set the state of the Num lock LED to off.
- \value ScrollLockOn Set the state of the Scroll lock LED to on.
- \value ScrollLockOff Set the state of the Scroll lock LED to off.
-
- \value PreviousConsole Switch to the previous virtual console (by
- default Ctrl+Alt+Left on Linux).
- \value NextConsole Switch to the next virtual console (by default
- Ctrl+Alt+Right on Linux).
- \value SwitchConsoleFirst Switch to the first virtual console (0).
- \value SwitchConsoleLast Switch to the last virtual console (255).
- \value SwitchConsoleMask If the KeyAction value is between SwitchConsoleFirst
- and SwitchConsoleLast, you can use this mask to get
- the specific virtual console number to switch to.
-
- \value Reboot Reboot the machine - this is ignored in both the TTY and
- LinuxInput handlers though (by default Ctrl+Alt+Del on Linux).
-
- \sa processKeycode()
-*/
-
-/*!
- \fn QWSKeyboardHandler::KeycodeAction QWSKeyboardHandler::processKeycode(quint16 keycode, bool isPress, bool autoRepeat)
-
- \since 4.6
-
- Maps \a keycode according to a keymap and sends that key event to the
- \l{Qt for Embedded Linux} server application.
-
- Please see the \l{Qt for Embedded Linux Character Input} and the \l
- {kmap2qmap} documentations for a description on how to create and use
- keymap files.
-
- The key event is identified by its \a keycode value and the \a isPress
- and \a autoRepeat parameters.
-
- The \a keycode parameter is \bold NOT the Qt keycode value as defined by
- the Qt::Key enum. This functions expects a standard Linux 16 bit kernel
- keycode as it is used in the Linux Input Event sub-system. This
- \a keycode is transformed to a Qt::Key code by using either a
- compiled-in US keyboard layout or by dynamically loading a keymap at
- startup which can be specified via the QWS_KEYBOARD environment
- variable.
-
- The \a isPress parameter is true if the event is a key press event and
- \a autoRepeat is true if the event is caused by an auto-repeat mechanism
- and not an actual key press.
-
- The return value indicates if the actual QWSKeyboardHandler
- implementation needs to take care of a special action, like console
- switching or LED handling.
-
- If standard Linux console keymaps are used, \a keycode must be one of the
- standardized values defined in \c /usr/include/linux/input.h
-
- \sa processKeyEvent(), KeycodeAction
-*/
-
-QWSKeyboardHandler::KeycodeAction QWSKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat)
-{
- KeycodeAction result = None;
- bool first_press = pressed && !autorepeat;
-
- const QWSKeyboard::Mapping *map_plain = 0;
- const QWSKeyboard::Mapping *map_withmod = 0;
-
- // get a specific and plain mapping for the keycode and the current modifiers
- for (int i = 0; i < d->m_keymap_size && !(map_plain && map_withmod); ++i) {
- const QWSKeyboard::Mapping *m = d->m_keymap + i;
- if (m->keycode == keycode) {
- if (m->modifiers == 0)
- map_plain = m;
-
- quint8 testmods = d->m_modifiers;
- if (d->m_locks[0] /*CapsLock*/ && (m->flags & QWSKeyboard::IsLetter))
- testmods ^= QWSKeyboard::ModShift;
- if (m->modifiers == testmods)
- map_withmod = m;
- }
- }
-
-#ifdef QT_DEBUG_KEYMAP
- qWarning("Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d | plain=%d, withmod=%d, size=%d", \
- keycode, d->m_modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0, \
- map_plain ? map_plain - d->m_keymap : -1, \
- map_withmod ? map_withmod - d->m_keymap : -1, \
- d->m_keymap_size);
-#endif
-
- const QWSKeyboard::Mapping *it = map_withmod ? map_withmod : map_plain;
-
- if (!it) {
-#ifdef QT_DEBUG_KEYMAP
- // we couldn't even find a plain mapping
- qWarning("Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode, d->m_modifiers);
-#endif
- return result;
- }
-
- bool skip = false;
- quint16 unicode = it->unicode;
- quint32 qtcode = it->qtcode;
-
- if ((it->flags & QWSKeyboard::IsModifier) && it->special) {
- // this is a modifier, i.e. Shift, Alt, ...
- if (pressed)
- d->m_modifiers |= quint8(it->special);
- else
- d->m_modifiers &= ~quint8(it->special);
- } else if (qtcode >= Qt::Key_CapsLock && qtcode <= Qt::Key_ScrollLock) {
- // (Caps|Num|Scroll)Lock
- if (first_press) {
- quint8 &lock = d->m_locks[qtcode - Qt::Key_CapsLock];
- lock ^= 1;
-
- switch (qtcode) {
- case Qt::Key_CapsLock : result = lock ? CapsLockOn : CapsLockOff; break;
- case Qt::Key_NumLock : result = lock ? NumLockOn : NumLockOff; break;
- case Qt::Key_ScrollLock: result = lock ? ScrollLockOn : ScrollLockOff; break;
- default : break;
- }
- }
- } else if ((it->flags & QWSKeyboard::IsSystem) && it->special && first_press) {
- switch (it->special) {
- case QWSKeyboard::SystemReboot:
- result = Reboot;
- break;
-
- case QWSKeyboard::SystemZap:
- if (!d->m_no_zap)
- qApp->quit();
- break;
-
- case QWSKeyboard::SystemConsolePrevious:
- result = PreviousConsole;
- break;
-
- case QWSKeyboard::SystemConsoleNext:
- result = NextConsole;
- break;
-
- default:
- if (it->special >= QWSKeyboard::SystemConsoleFirst &&
- it->special <= QWSKeyboard::SystemConsoleLast) {
- result = KeycodeAction(SwitchConsoleFirst + ((it->special & QWSKeyboard::SystemConsoleMask) & SwitchConsoleMask));
- }
- break;
- }
-
- skip = true; // no need to tell QWS about it
- } else if ((qtcode == Qt::Key_Multi_key) && d->m_do_compose) {
- // the Compose key was pressed
- if (first_press)
- d->m_composing = 2;
- skip = true;
- } else if ((it->flags & QWSKeyboard::IsDead) && d->m_do_compose) {
- // a Dead key was pressed
- if (first_press && d->m_composing == 1 && d->m_dead_unicode == unicode) { // twice
- d->m_composing = 0;
- qtcode = Qt::Key_unknown; // otherwise it would be Qt::Key_Dead...
- } else if (first_press && unicode != 0xffff) {
- d->m_dead_unicode = unicode;
- d->m_composing = 1;
- skip = true;
- } else {
- skip = true;
- }
- }
-
- if (!skip) {
- // a normal key was pressed
- const int modmask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier;
-
- // we couldn't find a specific mapping for the current modifiers,
- // or that mapping didn't have special modifiers:
- // so just report the plain mapping with additional modifiers.
- if ((it == map_plain && it != map_withmod) ||
- (map_withmod && !(map_withmod->qtcode & modmask))) {
- qtcode |= QWSKbPrivate::toQtModifiers(d->m_modifiers);
- }
-
- if (d->m_composing == 2 && first_press && !(it->flags & QWSKeyboard::IsModifier)) {
- // the last key press was the Compose key
- if (unicode != 0xffff) {
- int idx = 0;
- // check if this code is in the compose table at all
- for ( ; idx < d->m_keycompose_size; ++idx) {
- if (d->m_keycompose[idx].first == unicode)
- break;
- }
- if (idx < d->m_keycompose_size) {
- // found it -> simulate a Dead key press
- d->m_dead_unicode = unicode;
- unicode = 0xffff;
- d->m_composing = 1;
- skip = true;
- } else {
- d->m_composing = 0;
- }
- } else {
- d->m_composing = 0;
- }
- } else if (d->m_composing == 1 && first_press && !(it->flags & QWSKeyboard::IsModifier)) {
- // the last key press was a Dead key
- bool valid = false;
- if (unicode != 0xffff) {
- int idx = 0;
- // check if this code is in the compose table at all
- for ( ; idx < d->m_keycompose_size; ++idx) {
- if (d->m_keycompose[idx].first == d->m_dead_unicode && d->m_keycompose[idx].second == unicode)
- break;
- }
- if (idx < d->m_keycompose_size) {
- quint16 composed = d->m_keycompose[idx].result;
- if (composed != 0xffff) {
- unicode = composed;
- qtcode = Qt::Key_unknown;
- valid = true;
- }
- }
- }
- if (!valid) {
- unicode = d->m_dead_unicode;
- qtcode = Qt::Key_unknown;
- }
- d->m_composing = 0;
- }
-
- if (!skip) {
-#ifdef QT_DEBUG_KEYMAP
- qWarning("Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask));
-#endif
-
- // send the result to the QWS server
- processKeyEvent(unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat);
- }
- }
- return result;
-}
-
-QT_END_NAMESPACE
-
-#include "qkbd_qws.moc"
-
-#endif // QT_NO_QWS_KEYBOARD
diff --git a/src/gui/embedded/qkbd_qws.h b/src/gui/embedded/qkbd_qws.h
deleted file mode 100644
index 712b9007c7..0000000000
--- a/src/gui/embedded/qkbd_qws.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBD_QWS_H
-#define QKBD_QWS_H
-
-#include <QtGui/qapplication.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-class QWSKbPrivate;
-
-class Q_GUI_EXPORT QWSKeyboardHandler
-{
-public:
- QWSKeyboardHandler();
- QWSKeyboardHandler(const QString &device);
- virtual ~QWSKeyboardHandler();
-
- virtual void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat);
-
- enum KeycodeAction {
- None = 0,
-
- CapsLockOff = 0x01000000,
- CapsLockOn = 0x01000001,
- NumLockOff = 0x02000000,
- NumLockOn = 0x02000001,
- ScrollLockOff = 0x03000000,
- ScrollLockOn = 0x03000001,
-
- Reboot = 0x04000000,
-
- PreviousConsole = 0x05000000,
- NextConsole = 0x05000001,
- SwitchConsoleFirst = 0x06000000,
- SwitchConsoleLast = 0x0600007f,
- SwitchConsoleMask = 0x0000007f,
- };
-
- KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat);
-
-protected:
- int transformDirKey(int key);
- void beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod);
- void endAutoRepeat();
-
-private:
- QWSKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KEYBOARD
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBD_QWS_H
diff --git a/src/gui/embedded/qkbd_qws_p.h b/src/gui/embedded/qkbd_qws_p.h
deleted file mode 100644
index be260e3273..0000000000
--- a/src/gui/embedded/qkbd_qws_p.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSKEYBOARD_P_H
-#define QWSKEYBOARD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QDataStream>
-
-QT_BEGIN_NAMESPACE
-
-namespace QWSKeyboard {
- const quint32 FileMagic = 0x514d4150; // 'QMAP'
-
- struct Mapping {
- quint16 keycode;
- quint16 unicode;
- quint32 qtcode;
- quint8 modifiers;
- quint8 flags;
- quint16 special;
-
- };
-
- enum Flags {
- IsDead = 0x01,
- IsLetter = 0x02,
- IsModifier = 0x04,
- IsSystem = 0x08,
- };
-
- enum System {
- SystemConsoleFirst = 0x0100,
- SystemConsoleMask = 0x007f,
- SystemConsoleLast = 0x017f,
- SystemConsolePrevious = 0x0180,
- SystemConsoleNext = 0x0181,
- SystemReboot = 0x0200,
- SystemZap = 0x0300,
- };
-
- struct Composing {
- quint16 first;
- quint16 second;
- quint16 result;
- };
-
- enum Modifiers {
- ModPlain = 0x00,
- ModShift = 0x01,
- ModAltGr = 0x02,
- ModControl = 0x04,
- ModAlt = 0x08,
- ModShiftL = 0x10,
- ModShiftR = 0x20,
- ModCtrlL = 0x40,
- ModCtrlR = 0x80,
- // ModCapsShift = 0x100, // not supported!
- };
-};
-
-#ifndef QT_NO_DATASTREAM
-inline QDataStream &operator>>(QDataStream &ds, QWSKeyboard::Mapping &m)
-{
- return ds >> m.keycode >> m.unicode >> m.qtcode >> m.modifiers >> m.flags >> m.special;
-}
-
-inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Mapping &m)
-{
- return ds << m.keycode << m.unicode << m.qtcode << m.modifiers << m.flags << m.special;
-}
-
-inline QDataStream &operator>>(QDataStream &ds, QWSKeyboard::Composing &c)
-{
- return ds >> c.first >> c.second >> c.result;
-}
-
-inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Composing &c)
-{
- return ds << c.first << c.second << c.result;
-}
-#endif // QT_NO_DATASTREAM
-
-QT_END_NAMESPACE
-
-#endif // QWSKEYBOARD_H
diff --git a/src/gui/embedded/qkbddriverfactory_qws.cpp b/src/gui/embedded/qkbddriverfactory_qws.cpp
deleted file mode 100644
index 45825e52ea..0000000000
--- a/src/gui/embedded/qkbddriverfactory_qws.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbddriverfactory_qws.h"
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#include "qapplication.h"
-#include "qkbdtty_qws.h"
-#include "qkbdlinuxinput_qws.h"
-#include "qkbdum_qws.h"
-#include "qkbdvfb_qws.h"
-#include "qkbdqnx_qws.h"
-#include "qkbdintegrity_qws.h"
-#include <stdlib.h>
-#include "private/qfactoryloader_p.h"
-#include "qkbddriverplugin_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QWSKeyboardHandlerFactoryInterface_iid,
- QLatin1String("/kbddrivers"), Qt::CaseInsensitive))
-
-#endif //QT_NO_LIBRARY
-#endif //QT_MAKEDLL
-
-/*!
- \class QKbdDriverFactory
- \ingroup qws
-
- \brief The QKbdDriverFactory class creates keyboard drivers in
- Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QKbdDriverFactory is used to detect and instantiate the available
- keyboard drivers, allowing \l{Qt for Embedded Linux} to load the preferred
- driver into the server application at runtime. The create()
- function returns a QWSKeyboardHandler object representing the
- keyboard driver identified by a given key. The valid keys
- (i.e. the supported drivers) can be retrieved using the keys()
- function.
-
- \l{Qt for Embedded Linux} provides several built-in keyboard drivers. In
- addition, custom keyboard drivers can be added using Qt's plugin
- mechanism, i.e. by subclassing the QWSKeyboardHandler class and
- creating a keyboard driver plugin (QKbdDriverPlugin). See the
- \l{Qt for Embedded Linux Character Input}{character input} documentation
- for details.
-
- \sa QWSKeyboardHandler, QKbdDriverPlugin
-*/
-
-/*!
- Creates the keyboard driver specified by the given \a key, using
- the display specified by the given \a device.
-
- Note that the keys are case-insensitive.
-
- \sa keys()
-*/
-QWSKeyboardHandler *QKbdDriverFactory::create(const QString& key, const QString& device)
-{
- QString driver = key.toLower();
-#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX)
- if (driver == QLatin1String("qnx") || driver.isEmpty())
- return new QWSQnxKeyboardHandler(device);
-#endif
-#if defined(Q_OS_INTEGRITY)
- if (driver == QLatin1String("integrity") || driver.isEmpty())
- return new QWSIntKeyboardHandler(device);
-#endif
-#ifndef QT_NO_QWS_KEYBOARD
-# ifndef QT_NO_QWS_KBD_TTY
- if (driver == QLatin1String("tty") || driver.isEmpty())
- return new QWSTtyKeyboardHandler(device);
-# endif
-# ifndef QT_NO_QWS_KBD_LINUXINPUT
- if (driver == QLatin1String("linuxinput") || \
- driver == QLatin1String("usb") || \
- driver == QLatin1String("linuxis"))
- return new QWSLinuxInputKeyboardHandler(device);
-# endif
-# ifndef QT_NO_QWS_KBD_UM
- if (driver == QLatin1String("um") || driver == QLatin1String("qvfbkeyboard"))
- return new QWSUmKeyboardHandler(device);
-# endif
-# ifndef QT_NO_QWS_KBD_QVFB
- if (driver == QLatin1String("qvfbkbd")
- || driver == QLatin1String("qvfbkeyboard")
- || driver == QLatin1String("qvfb"))
- return new QVFbKeyboardHandler(device);
-# endif
-#endif
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
- if (QWSKeyboardHandlerFactoryInterface *factory = qobject_cast<QWSKeyboardHandlerFactoryInterface*>(loader()->instance(driver)))
- return factory->create(driver, device);
-#endif
-#endif
- return 0;
-}
-
-/*!
- Returns the list of valid keys, i.e. the available keyboard
- drivers.
-
- \sa create()
-*/
-QStringList QKbdDriverFactory::keys()
-{
- QStringList list;
-
-#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX)
- list << QLatin1String("QNX");
-#endif
-#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_KBD_INTEGRITY)
- list << QLatin1String("INTEGRITY");
-#endif
-#ifndef QT_NO_QWS_KBD_TTY
- list << QLatin1String("TTY");
-#endif
-#ifndef QT_NO_QWS_KBD_LINUXINPUT
- list << QLatin1String("LinuxInput");
-#endif
-#ifndef QT_NO_QWS_KBD_UM
- list << QLatin1String("UM");
-#endif
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
- QStringList plugins = loader()->keys();
- for (int i = 0; i < plugins.size(); ++i) {
- if (!list.contains(plugins.at(i)))
- list += plugins.at(i);
- }
-#endif //QT_NO_LIBRARY
-#endif //QT_MAKEDLL
-
- return list;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_KEYBOARD
diff --git a/src/gui/embedded/qkbddriverfactory_qws.h b/src/gui/embedded/qkbddriverfactory_qws.h
deleted file mode 100644
index ffb768b01f..0000000000
--- a/src/gui/embedded/qkbddriverfactory_qws.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDDRIVERFACTORY_QWS_H
-#define QKBDDRIVERFACTORY_QWS_H
-
-#include <QtCore/qstringlist.h>
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QString;
-class QWSKeyboardHandler;
-
-class Q_GUI_EXPORT QKbdDriverFactory
-{
-public:
- static QStringList keys();
- static QWSKeyboardHandler *create(const QString&, const QString&);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_KEYBOARD
-#endif // QKBDDRIVERFACTORY_QWS_H
diff --git a/src/gui/embedded/qkbddriverplugin_qws.cpp b/src/gui/embedded/qkbddriverplugin_qws.cpp
deleted file mode 100644
index 569cb425c9..0000000000
--- a/src/gui/embedded/qkbddriverplugin_qws.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbddriverplugin_qws.h"
-
-#ifndef QT_NO_LIBRARY
-
-#include "qkbd_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QKbdDriverPlugin
- \ingroup plugins
- \ingroup qws
-
- \brief The QKbdDriverPlugin class is an abstract base class for
- keyboard driver plugins in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several keyboard
- protocols, see the \l{Qt for Embedded Linux Character Input}{character
- input} documentation for details. Custom keyboard drivers can be
- implemented by subclassing the QWSKeyboardHandler class and
- creating a keyboard driver plugin.
-
- A keyboard driver plugin can be created by subclassing
- QKbdDriverPlugin and reimplementing the pure virtual keys() and
- create() functions. By exporting the derived class using the
- Q_EXPORT_PLUGIN2() macro, the default implementation of the
- QKbdDriverFactory class will automatically detect the plugin and
- load the driver into the server application at run-time. See
- \l{How to Create Qt Plugins} for details.
-
- \sa QKbdDriverFactory, QWSKeyboardHandler
-*/
-
-/*!
- \fn QStringList QKbdDriverPlugin::keys() const
-
- Implement this function to return the list of valid keys, i.e. the
- keyboard drivers supported by this plugin.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several keyboard
- protocols, see the \l{Qt for Embedded Linux Character Input}{character
- input} documentation for details.
-
- \sa create()
-*/
-
-/*!
- Constructs a keyboard driver plugin with the given \a parent.
-
- Note that this constructor is invoked automatically by the
- Q_EXPORT_PLUGIN2() macro, so there is no need for calling it
- explicitly.
-*/
-QKbdDriverPlugin::QKbdDriverPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys the keyboard driver plugin.
-
- Note that Qt destroys a plugin automatically when it is no longer
- used, so there is no need for calling the destructor explicitly.
-*/
-QKbdDriverPlugin::~QKbdDriverPlugin()
-{
-}
-
-/*!
- \fn QScreen *QKbdDriverPlugin::create(const QString &key, const QString &device)
-
- Implement this function to create a driver matching the type
- specified by the given \a key and \a device parameters. Note that
- keys are case-insensitive.
-
- \sa keys()
-*/
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/gui/embedded/qkbddriverplugin_qws.h b/src/gui/embedded/qkbddriverplugin_qws.h
deleted file mode 100644
index 2bb111cbea..0000000000
--- a/src/gui/embedded/qkbddriverplugin_qws.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDDRIVERPLUGIN_QWS_H
-#define QKBDDRIVERPLUGIN_QWS_H
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_LIBRARY
-
-class QWSKeyboardHandler;
-
-struct Q_GUI_EXPORT QWSKeyboardHandlerFactoryInterface : public QFactoryInterface
-{
- virtual QWSKeyboardHandler* create(const QString &name, const QString &device) = 0;
-};
-
-#define QWSKeyboardHandlerFactoryInterface_iid "com.trolltech.Qt.QWSKeyboardHandlerFactoryInterface"
-Q_DECLARE_INTERFACE(QWSKeyboardHandlerFactoryInterface, QWSKeyboardHandlerFactoryInterface_iid)
-
-class Q_GUI_EXPORT QKbdDriverPlugin : public QObject, public QWSKeyboardHandlerFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QWSKeyboardHandlerFactoryInterface:QFactoryInterface)
-public:
- explicit QKbdDriverPlugin(QObject *parent = 0);
- ~QKbdDriverPlugin();
-
- virtual QStringList keys() const = 0;
- virtual QWSKeyboardHandler* create(const QString& driver, const QString &device) = 0;
-};
-
-#endif // QT_NO_LIBRARY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDDRIVERPLUGIN_QWS_H
diff --git a/src/gui/embedded/qkbdintegrity_qws.cpp b/src/gui/embedded/qkbdintegrity_qws.cpp
deleted file mode 100644
index b2df4226a8..0000000000
--- a/src/gui/embedded/qkbdintegrity_qws.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_INTEGRITY)
-
-#include "qkbdintegrity_qws.h"
-#include <qwindowsystem_qws.h>
-#include <qapplication.h>
-#include <qtimer.h>
-#include <qthread.h>
-
-#include <INTEGRITY.h>
-
-
-//===========================================================================
-
-QT_BEGIN_NAMESPACE
-
-//
-// INTEGRITY keyboard
-//
-
-class QIntKeyboardListenThread;
-
-class QWSIntKbPrivate : public QObject
-{
- Q_OBJECT
- friend class QIntKeyboardListenThread;
-public:
- QWSIntKbPrivate(QWSKeyboardHandler *, const QString &device);
- ~QWSIntKbPrivate();
- void dataReady(int amount) { emit kbdDataAvailable(amount); }
- uint8_t scancodebuf[32 /* USB_SCANCODE_BUF_LEN */ ];
- uint8_t rxpost;
- uint8_t rxack;
-
-Q_SIGNALS:
- void kbdDataAvailable(int amount);
-
-private Q_SLOTS:
- void readKeyboardData(int amount);
-
-private:
- QWSKeyboardHandler *handler;
- QIntKeyboardListenThread *kbdthread;
-};
-class QIntKeyboardListenThread : public QThread
-{
-protected:
- QWSIntKbPrivate *imp;
- bool loop;
-public:
- QIntKeyboardListenThread(QWSIntKbPrivate *im) : QThread(), imp(im) {};
- ~QIntKeyboardListenThread() {};
- void run();
- void stoploop() { loop = false; };
-};
-
-
-QWSIntKeyboardHandler::QWSIntKeyboardHandler(const QString &device)
- : QWSKeyboardHandler(device)
-{
- d = new QWSIntKbPrivate(this, device);
-}
-
-QWSIntKeyboardHandler::~QWSIntKeyboardHandler()
-{
- delete d;
-}
-
-//void QWSIntKeyboardHandler::processKeyEvent(int keycode, bool isPress,
-// bool autoRepeat)
-//{
-// QWSKeyboardHandler::processKeyEvent(keycode, isPress, autoRepeat);
-//}
-
-void QIntKeyboardListenThread::run(void)
-{
- Error E;
- Buffer b;
- Connection kbdc;
- bool waitforresource = true;
- do {
- E = RequestResource((Object*)&kbdc,
- "USBKeyboardClient", "!systempassword");
- if (E == Success) {
- loop = false;
- } else {
- E = RequestResource((Object*)&kbdc,
- "KeyboardClient", "!systempassword");
- if (E == Success) {
- waitforresource = false;
- }
- }
- if (waitforresource)
- ::sleep(1);
- } while (loop && waitforresource);
- if (!loop)
- return;
- b.BufferType = DataBuffer | LastBuffer;
- b.Length = sizeof(imp->scancodebuf);
- b.TheAddress = (Address)imp->scancodebuf;
- do {
- b.Transferred = 0;
- b.TheAddress = (Address)imp->scancodebuf + imp->rxpost;
- CheckSuccess(SynchronousReceive(kbdc, &b));
- imp->rxpost += b.Transferred;
- if (imp->rxpost >= 32 /* USB_SCANCODE_BUF_LEN */)
- imp->rxpost = 0;
- if (imp->rxpost == (imp->rxack + b.Transferred) % 32 /* USB_SCANCODE_BUF_LEN */) {
- imp->kbdDataAvailable(b.Transferred);
- }
- } while (loop);
-}
-
-void QWSIntKbPrivate::readKeyboardData(int amount)
-{
- uint16_t keycode;
- do {
- if (scancodebuf[rxack] == 0xe0) {
- keycode = scancodebuf[rxack] << 8;
- rxack++;
- if (rxack >= 32 /* USB_SCANCODE_BUF_LEN */)
- rxack = 0;
- } else {
- keycode = 0;
- }
-
- handler->processKeycode(keycode + (scancodebuf[rxack] & 0x7f),
- (scancodebuf[rxack] & 0x80) == 0,
- scancodebuf[rxack] == 2);
- rxack++;
- if (rxack >= 32 /* USB_SCANCODE_BUF_LEN */)
- rxack = 0;
- } while (rxack != rxpost);
-}
-
-QWSIntKbPrivate::QWSIntKbPrivate(QWSKeyboardHandler *h, const QString &device) : handler(h)
-{
- connect(this, SIGNAL(kbdDataAvailable(int)), this, SLOT(readKeyboardData(int)));
- this->handler = handler;
- rxack = rxpost = 0;
- kbdthread = new QIntKeyboardListenThread(this);
- kbdthread->start();
-}
-
-QWSIntKbPrivate::~QWSIntKbPrivate()
-{
- kbdthread->stoploop();
- kbdthread->wait();
- delete kbdthread;
-}
-
-
-QT_END_NAMESPACE
-
-#include "qkbdintegrity_qws.moc"
-
-#endif // QT_NO_QWS_KEYBOARD || QT_NO_QWS_KBD_TTY
diff --git a/src/gui/embedded/qkbdintegrity_qws.h b/src/gui/embedded/qkbdintegrity_qws.h
deleted file mode 100644
index f9ae4e3250..0000000000
--- a/src/gui/embedded/qkbdintegrity_qws.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDINTEGRITY_QWS_H
-#define QKBDINTEGRITY_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#ifndef QT_NO_QWS_KBD_INTEGRITY
-
-class QSocketNotifier;
-class QWSIntKbPrivate;
-
-class QWSIntKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- explicit QWSIntKeyboardHandler(const QString&);
- virtual ~QWSIntKeyboardHandler();
-
-//protected:
-// virtual void processKeyEvent(int keycode, bool isPress, bool autoRepeat);
-
-private:
- QWSIntKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_INTEGRITY
-
-#endif // QT_NO_QWS_KEYBOARD
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDINTEGRITY_QWS_H
diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp
deleted file mode 100644
index 71910b41e7..0000000000
--- a/src/gui/embedded/qkbdlinuxinput_qws.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdlinuxinput_qws.h"
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#include <QSocketNotifier>
-#include <QStringList>
-
-#include <qplatformdefs.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <errno.h>
-#include <termios.h>
-
-#include <linux/kd.h>
-#include <linux/input.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QWSLinuxInputKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *, const QString &);
- ~QWSLinuxInputKbPrivate();
-
-private:
- void switchLed(int, bool);
-
-private Q_SLOTS:
- void readKeycode();
-
-private:
- QWSLinuxInputKeyboardHandler *m_handler;
- int m_fd;
- int m_tty_fd;
- struct termios m_tty_attr;
- int m_orig_kbmode;
-};
-
-QWSLinuxInputKeyboardHandler::QWSLinuxInputKeyboardHandler(const QString &device)
- : QWSKeyboardHandler(device)
-{
- d = new QWSLinuxInputKbPrivate(this, device);
-}
-
-QWSLinuxInputKeyboardHandler::~QWSLinuxInputKeyboardHandler()
-{
- delete d;
-}
-
-bool QWSLinuxInputKeyboardHandler::filterInputEvent(quint16 &, qint32 &)
-{
- return false;
-}
-
-QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, const QString &device)
- : m_handler(h), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE)
-{
- setObjectName(QLatin1String("LinuxInputSubsystem Keyboard Handler"));
-
- QString dev = QLatin1String("/dev/input/event1");
- int repeat_delay = -1;
- int repeat_rate = -1;
-
- QStringList args = device.split(QLatin1Char(':'));
- foreach (const QString &arg, args) {
- if (arg.startsWith(QLatin1String("repeat-delay=")))
- repeat_delay = arg.mid(13).toInt();
- else if (arg.startsWith(QLatin1String("repeat-rate=")))
- repeat_rate = arg.mid(12).toInt();
- else if (arg.startsWith(QLatin1String("/dev/")))
- dev = arg;
- }
-
- m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDWR, 0);
- if (m_fd >= 0) {
- if (repeat_delay > 0 && repeat_rate > 0) {
- int kbdrep[2] = { repeat_delay, repeat_rate };
- ::ioctl(m_fd, EVIOCSREP, kbdrep);
- }
-
- QSocketNotifier *notifier;
- notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode()));
-
- // play nice in case we are started from a shell (e.g. for debugging)
- m_tty_fd = isatty(0) ? 0 : -1;
-
- if (m_tty_fd >= 0) {
- // save tty config for restore.
- tcgetattr(m_tty_fd, &m_tty_attr);
-
- struct ::termios termdata;
- tcgetattr(m_tty_fd, &termdata);
-
- // record the original mode so we can restore it again in the destructor.
- ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
-
- // setting this translation mode is even needed in INPUT mode to prevent
- // the shell from also interpreting codes, if the process has a tty
- // attached: e.g. Ctrl+C wouldn't copy, but kill the application.
- ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
-
- // set the tty layer to pass-through
- termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- termdata.c_oflag = 0;
- termdata.c_cflag = CREAD | CS8;
- termdata.c_lflag = 0;
- termdata.c_cc[VTIME]=0;
- termdata.c_cc[VMIN]=1;
- cfsetispeed(&termdata, 9600);
- cfsetospeed(&termdata, 9600);
- tcsetattr(m_tty_fd, TCSANOW, &termdata);
- }
- } else {
- qWarning("Cannot open keyboard input device '%s': %s", qPrintable(dev), strerror(errno));
- return;
- }
-}
-
-QWSLinuxInputKbPrivate::~QWSLinuxInputKbPrivate()
-{
- if (m_tty_fd >= 0) {
- ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
- tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
- }
- if (m_fd >= 0)
- QT_CLOSE(m_fd);
-}
-
-void QWSLinuxInputKbPrivate::switchLed(int led, bool state)
-{
- struct ::input_event led_ie;
- ::gettimeofday(&led_ie.time, 0);
- led_ie.type = EV_LED;
- led_ie.code = led;
- led_ie.value = state;
-
- QT_WRITE(m_fd, &led_ie, sizeof(led_ie));
-}
-
-void QWSLinuxInputKbPrivate::readKeycode()
-{
- struct ::input_event buffer[32];
- int n = 0;
-
- forever {
- n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
-
- if (n == 0) {
- qWarning("Got EOF from the input device.");
- return;
- } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
- qWarning("Could not read from input device: %s", strerror(errno));
- return;
- } else if (n % sizeof(buffer[0]) == 0) {
- break;
- }
- }
-
- n /= sizeof(buffer[0]);
-
- for (int i = 0; i < n; ++i) {
- if (buffer[i].type != EV_KEY)
- continue;
-
- quint16 code = buffer[i].code;
- qint32 value = buffer[i].value;
-
- if (m_handler->filterInputEvent(code, value))
- continue;
-
- QWSKeyboardHandler::KeycodeAction ka;
- ka = m_handler->processKeycode(code, value != 0, value == 2);
-
- switch (ka) {
- case QWSKeyboardHandler::CapsLockOn:
- case QWSKeyboardHandler::CapsLockOff:
- switchLed(LED_CAPSL, ka == QWSKeyboardHandler::CapsLockOn);
- break;
-
- case QWSKeyboardHandler::NumLockOn:
- case QWSKeyboardHandler::NumLockOff:
- switchLed(LED_NUML, ka == QWSKeyboardHandler::NumLockOn);
- break;
-
- case QWSKeyboardHandler::ScrollLockOn:
- case QWSKeyboardHandler::ScrollLockOff:
- switchLed(LED_SCROLLL, ka == QWSKeyboardHandler::ScrollLockOn);
- break;
-
- default:
- // ignore console switching and reboot
- break;
- }
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdlinuxinput_qws.moc"
-
-#endif // QT_NO_QWS_KEYBOARD
diff --git a/src/gui/embedded/qkbdlinuxinput_qws.h b/src/gui/embedded/qkbdlinuxinput_qws.h
deleted file mode 100644
index 4cd45de854..0000000000
--- a/src/gui/embedded/qkbdlinuxinput_qws.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDLINUXINPUT_QWS_H
-#define QKBDLINUXINPUT_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#ifndef QT_NO_QWS_KBD_LINUXINPUT
-
-class QWSLinuxInputKbPrivate;
-
-class QWSLinuxInputKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- QWSLinuxInputKeyboardHandler(const QString&);
- virtual ~QWSLinuxInputKeyboardHandler();
-
- virtual bool filterInputEvent(quint16 &input_code, qint32 &input_value);
-
-private:
- QWSLinuxInputKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_LINUXINPUT
-
-#endif // QT_NO_QWS_KEYBOARD
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDLINUXINPUT_QWS_H
diff --git a/src/gui/embedded/qkbdqnx_qws.cpp b/src/gui/embedded/qkbdqnx_qws.cpp
deleted file mode 100644
index 87e658d35a..0000000000
--- a/src/gui/embedded/qkbdqnx_qws.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdqnx_qws.h"
-#include "QtCore/qsocketnotifier.h"
-#include "QtCore/qdebug.h"
-
-#include <sys/dcmd_input.h>
-#include <photon/keycodes.h>
-
-#include "qplatformdefs.h"
-#include <errno.h>
-
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QWSQnxKeyboardHandler
- \preliminary
- \ingroup qws
- \since 4.6
- \internal
-
- \brief The QWSQnxKeyboardHandler class implements a keyboard driver
- for the QNX \c{devi-hid} input manager.
-
- To be able to compile this mouse handler, \l{Qt for Embedded Linux}
- must be configured with the \c -qt-kbd-qnx option, see the
- \l{Qt for Embedded Linux Character Input} documentation for details.
-
- In order to use this keyboard handler, the \c{devi-hid} input manager
- must be set up and run with the resource manager interface (option \c{-r}).
- Also, Photon must not be running.
-
- Example invocation from command line: \c{/usr/photon/bin/devi-hid -Pr kbd mouse}
- Note that after running \c{devi-hid}, you will not be able to use the local
- shell anymore. It is suggested to run the command in a shell scrip, that launches
- a Qt application after invocation of \c{devi-hid}.
-
- To make \l{Qt for Embedded Linux} explicitly choose the qnx keyboard
- handler, set the QWS_KEYBOARD environment variable to \c{qnx}. By default,
- the first keyboard device (\c{/dev/devi/keyboard0}) is used. To override, pass a device
- name as the first and only parameter, for example
- \c{QWS_KEYBOARD=qnx:/dev/devi/keyboard1; export QWS_KEYBOARD}.
-
- \sa {Qt for Embedded Linux Character Input}, {Qt for Embedded Linux}
-*/
-
-/*!
- Constructs a keyboard handler for the specified \a device, defaulting to
- \c{/dev/devi/keyboard0}.
-
- Note that you should never instanciate this class, instead let QKbdDriverFactory
- handle the keyboard handlers.
-
- \sa QKbdDriverFactory
- */
-QWSQnxKeyboardHandler::QWSQnxKeyboardHandler(const QString &device)
-{
- // open the keyboard device
- keyboardFD = QT_OPEN(device.isEmpty() ? "/dev/devi/keyboard0" : device.toLatin1().constData(),
- QT_OPEN_RDONLY);
- if (keyboardFD == -1) {
- qErrnoWarning(errno, "QWSQnxKeyboardHandler: Unable to open device");
- return;
- }
-
- // create a socket notifier so we'll wake up whenever keyboard input is detected.
- QSocketNotifier *notifier = new QSocketNotifier(keyboardFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), SLOT(socketActivated()));
-
- qDebug() << "QWSQnxKeyboardHandler: connected.";
-
-}
-
-/*!
- Destroys this keyboard handler and closes the connection to the keyboard device.
- */
-QWSQnxKeyboardHandler::~QWSQnxKeyboardHandler()
-{
- QT_CLOSE(keyboardFD);
-}
-
-/*! \internal
- Translates the QNX keyboard events to Qt keyboard events
- */
-void QWSQnxKeyboardHandler::socketActivated()
-{
- _keyboard_packet packet;
-
- // read one keyboard event
- int bytesRead = QT_READ(keyboardFD, &packet, sizeof(_keyboard_packet));
- if (bytesRead == -1) {
- qErrnoWarning(errno, "QWSQnxKeyboardHandler::socketActivated(): Unable to read data.");
- return;
- }
-
- // the bytes read must be the size of a keyboard packet
- Q_ASSERT(bytesRead == sizeof(_keyboard_packet));
-
-#if 0
- qDebug() << "keyboard got scancode"
- << hex << packet.data.modifiers
- << packet.data.flags
- << packet.data.key_cap
- << packet.data.key_sym
- << packet.data.key_scan;
-#endif
-
- // QNX is nice enough to translate the raw keyboard data into a QNX data structure
- // Now we just have to translate it into a format Qt understands.
-
- // figure out whether it's a press
- bool isPress = packet.data.key_cap & KEY_DOWN;
- // figure out whether the key is still pressed and the key event is repeated
- bool isRepeat = packet.data.key_cap & KEY_REPEAT;
-
- Qt::Key key = Qt::Key_unknown;
- int unicode = 0xffff;
-
- // TODO - this switch is not complete!
- switch (packet.data.key_scan) {
- case KEYCODE_SPACE: key = Qt::Key_Space; unicode = 0x20; break;
- case KEYCODE_F1: key = Qt::Key_F1; break;
- case KEYCODE_F2: key = Qt::Key_F2; break;
- case KEYCODE_F3: key = Qt::Key_F3; break;
- case KEYCODE_F4: key = Qt::Key_F4; break;
- case KEYCODE_F5: key = Qt::Key_F5; break;
- case KEYCODE_F6: key = Qt::Key_F6; break;
- case KEYCODE_F7: key = Qt::Key_F7; break;
- case KEYCODE_F8: key = Qt::Key_F8; break;
- case KEYCODE_F9: key = Qt::Key_F9; break;
- case KEYCODE_F10: key = Qt::Key_F10; break;
- case KEYCODE_F11: key = Qt::Key_F11; break;
- case KEYCODE_F12: key = Qt::Key_F12; break;
- case KEYCODE_BACKSPACE: key = Qt::Key_Backspace; break;
- case KEYCODE_TAB: key = Qt::Key_Tab; break;
- case KEYCODE_RETURN: key = Qt::Key_Return; break;
- case KEYCODE_KP_ENTER: key = Qt::Key_Enter; break;
- case KEYCODE_UP:
- case KEYCODE_KP_UP:
- key = Qt::Key_Up; break;
- case KEYCODE_DOWN:
- case KEYCODE_KP_DOWN:
- key = Qt::Key_Down; break;
- case KEYCODE_LEFT:
- case KEYCODE_KP_LEFT:
- key = Qt::Key_Left; break;
- case KEYCODE_RIGHT:
- case KEYCODE_KP_RIGHT:
- key = Qt::Key_Right; break;
- case KEYCODE_HOME:
- case KEYCODE_KP_HOME:
- key = Qt::Key_Home; break;
- case KEYCODE_END:
- case KEYCODE_KP_END:
- key = Qt::Key_End; break;
- case KEYCODE_PG_UP:
- case KEYCODE_KP_PG_UP:
- key = Qt::Key_PageUp; break;
- case KEYCODE_PG_DOWN:
- case KEYCODE_KP_PG_DOWN:
- key = Qt::Key_PageDown; break;
- case KEYCODE_INSERT:
- case KEYCODE_KP_INSERT:
- key = Qt::Key_Insert; break;
- case KEYCODE_DELETE:
- case KEYCODE_KP_DELETE:
- key = Qt::Key_Delete; break;
- case KEYCODE_ESCAPE:
- key = Qt::Key_Escape; break;
- default: // none of the above, try the key_scan directly
- unicode = packet.data.key_scan;
- break;
- }
-
- // figure out the modifiers that are currently pressed
- Qt::KeyboardModifiers modifiers = Qt::NoModifier;
- if (packet.data.flags & KEYMOD_SHIFT)
- modifiers |= Qt::ShiftModifier;
- if (packet.data.flags & KEYMOD_CTRL)
- modifiers |= Qt::ControlModifier;
- if (packet.data.flags & KEYMOD_ALT)
- modifiers |= Qt::AltModifier;
-
- // if the unicode value is not ascii, we ignore it.
- // TODO - do a complete mapping between all QNX scan codes and Qt codes
- if (unicode != 0xffff && !isascii(unicode))
- return; // unprintable character
-
- // call processKeyEvent. This is where all the magic happens to insert a
- // key event into Qt's event loop.
- // Note that for repeated key events, isPress must be true
- // (on QNX, isPress is not set when the key event is repeated).
- processKeyEvent(unicode, key, modifiers, isPress || isRepeat, isRepeat);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qkbdqnx_qws.h b/src/gui/embedded/qkbdqnx_qws.h
deleted file mode 100644
index 1615a42fd7..0000000000
--- a/src/gui/embedded/qkbdqnx_qws.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDQNX_QWS_H
-#define QKBDQNX_QWS_H
-
-#include <QtGui/qapplication.h>
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_QNX)
-
-class Q_GUI_EXPORT QWSQnxKeyboardHandler : public QObject, public QWSKeyboardHandler
-{
- Q_OBJECT
-public:
- QWSQnxKeyboardHandler(const QString &device);
- ~QWSQnxKeyboardHandler();
-
-private Q_SLOTS:
- void socketActivated();
-
-private:
- int keyboardFD;
-};
-
-#endif // QT_NO_QWS_KEYBOARD
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDQNX_QWS_H
diff --git a/src/gui/embedded/qkbdtty_qws.cpp b/src/gui/embedded/qkbdtty_qws.cpp
deleted file mode 100644
index c4b7df2d9b..0000000000
--- a/src/gui/embedded/qkbdtty_qws.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdtty_qws.h"
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_TTY)
-
-#include <QSocketNotifier>
-#include <QStringList>
-
-#include <qplatformdefs.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <errno.h>
-#include <termios.h>
-
-#if defined Q_OS_LINUX
-# include <linux/kd.h>
-# include <linux/vt.h> //TODO: move vt handling somewhere else (QLinuxFbScreen?)
-
-# include "qscreen_qws.h"
-# include "qwindowsystem_qws.h"
-# include "qapplication.h"
-# include "private/qwindowsurface_qws_p.h"
-# include "private/qwssignalhandler_p.h"
-
-# define VTACQSIG SIGUSR1
-# define VTRELSIG SIGUSR2
-#endif
-
-
-QT_BEGIN_NAMESPACE
-
-class QWSTtyKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSTtyKbPrivate(QWSTtyKeyboardHandler *handler, const QString &device);
- ~QWSTtyKbPrivate();
-
-private:
- void switchLed(char, bool);
- void switchConsole(int vt);
-
-private Q_SLOTS:
- void readKeycode();
- void handleConsoleSwitch(int sig);
-
-private:
- QWSTtyKeyboardHandler *m_handler;
- int m_tty_fd;
- struct termios m_tty_attr;
- char m_last_keycode;
- int m_vt_qws;
- int m_orig_kbmode;
-};
-
-
-QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString &device)
- : QWSKeyboardHandler(device)
-{
- d = new QWSTtyKbPrivate(this, device);
-}
-
-QWSTtyKeyboardHandler::~QWSTtyKeyboardHandler()
-{
- delete d;
-}
-
-bool QWSTtyKeyboardHandler::filterKeycode(char &)
-{
- return false;
-}
-
-QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device)
- : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0), m_orig_kbmode(K_XLATE)
-{
- setObjectName(QLatin1String("TTY Keyboard Handler"));
-#ifndef QT_NO_QWS_SIGNALHANDLER
- QWSSignalHandler::instance()->addObject(this);
-#endif
-
- QString dev = QLatin1String("/dev/tty0");
- int repeat_delay = -1;
- int repeat_rate = -1;
-
- QStringList args = device.split(QLatin1Char(':'));
- foreach (const QString &arg, args) {
- if (arg.startsWith(QLatin1String("repeat-delay=")))
- repeat_delay = arg.mid(13).toInt();
- else if (arg.startsWith(QLatin1String("repeat-rate=")))
- repeat_rate = arg.mid(12).toInt();
- else if (arg.startsWith(QLatin1String("/dev/")))
- dev = arg;
- }
-
- m_tty_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDWR, 0);
- if (m_tty_fd >= 0) {
- if (repeat_delay > 0 && repeat_rate > 0) {
-#if defined(Q_OS_LINUX)
- struct ::kbd_repeat kbdrep = { repeat_delay, repeat_rate };
- ::ioctl(m_tty_fd, KDKBDREP, &kbdrep);
-#endif
- }
-
- QSocketNotifier *notifier;
- notifier = new QSocketNotifier(m_tty_fd, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode()));
-
- // save tty config for restore.
- tcgetattr(m_tty_fd, &m_tty_attr);
-
- struct ::termios termdata;
- tcgetattr(m_tty_fd, &termdata);
-
-#if defined(Q_OS_LINUX)
- // record the original mode so we can restore it again in the destructor.
- ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
-
- // PLEASE NOTE:
- // the tty keycode interface can only report keycodes 0x01 .. 0x7f
- // KEY_MAX is however defined to 0x1ff. In practice this is sufficient
- // for a PC style keyboard though.
- // we don't support K_RAW anymore - if you need that, you have to add
- // a scan- to keycode converter yourself.
- ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
-#endif
-
- // set the tty layer to pass-through
- termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- termdata.c_oflag = 0;
- termdata.c_cflag = CREAD | CS8;
- termdata.c_lflag = 0;
- termdata.c_cc[VTIME]=0;
- termdata.c_cc[VMIN]=1;
- cfsetispeed(&termdata, 9600);
- cfsetospeed(&termdata, 9600);
- tcsetattr(m_tty_fd, TCSANOW, &termdata);
-
-#if defined(Q_OS_LINUX)
- // VT switching is handled via unix signals
- connect(QApplication::instance(), SIGNAL(unixSignal(int)), this, SLOT(handleConsoleSwitch(int)));
- QApplication::instance()->watchUnixSignal(VTACQSIG, true);
- QApplication::instance()->watchUnixSignal(VTRELSIG, true);
-
- struct ::vt_mode vtMode;
- if (::ioctl(m_tty_fd, VT_GETMODE, &vtMode) == 0) {
- vtMode.mode = VT_PROCESS;
- vtMode.relsig = VTRELSIG;
- vtMode.acqsig = VTACQSIG;
-
- if (::ioctl(m_tty_fd, VT_SETMODE, &vtMode) == 0) {
- struct ::vt_stat vtStat;
- ::memset(&vtStat, 0, sizeof(vtStat));
-
- if (::ioctl(m_tty_fd, VT_GETSTATE, &vtStat) == 0 ) {
- m_vt_qws = vtStat.v_active;
- }
- }
- }
-
- if (!m_vt_qws)
- qWarning("Could not initialize virtual console switching");
-#endif
- } else {
- qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno));
- return;
- }
-
-}
-
-QWSTtyKbPrivate::~QWSTtyKbPrivate()
-{
- if (m_tty_fd >= 0) {
-#if defined(Q_OS_LINUX)
- ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
-#endif
- tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
- QT_CLOSE(m_tty_fd);
- }
-}
-
-
-
-void QWSTtyKbPrivate::switchLed(char led, bool state)
-{
-#if defined(Q_OS_LINUX)
- char ledstate;
-
- ::ioctl(m_tty_fd, KDGETLED, &ledstate);
- if (state)
- ledstate |= led;
- else
- ledstate &= ~led;
- ::ioctl(m_tty_fd, KDSETLED, ledstate);
-#endif
-}
-
-void QWSTtyKbPrivate::readKeycode()
-{
- char buffer[32];
- int n = 0;
-
- forever {
- n = QT_READ(m_tty_fd, buffer + n, 32 - n);
-
- if (n == 0) {
- qWarning("Got EOF from the input device.");
- return;
- } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
- qWarning("Could not read from input device: %s", strerror(errno));
- return;
- } else {
- break;
- }
- }
-
- for (int i = 0; i < n; ++i) {
- if (m_handler->filterKeycode(buffer[i]))
- continue;
-
- QWSKeyboardHandler::KeycodeAction ka;
- ka = m_handler->processKeycode(buffer[i] & 0x7f, (buffer[i] & 0x80) == 0x00, buffer[i] == m_last_keycode);
- m_last_keycode = buffer[i];
-
- switch (ka) {
- case QWSKeyboardHandler::CapsLockOn:
- case QWSKeyboardHandler::CapsLockOff:
- switchLed(LED_CAP, ka == QWSKeyboardHandler::CapsLockOn);
- break;
-
- case QWSKeyboardHandler::NumLockOn:
- case QWSKeyboardHandler::NumLockOff:
- switchLed(LED_NUM, ka == QWSKeyboardHandler::NumLockOn);
- break;
-
- case QWSKeyboardHandler::ScrollLockOn:
- case QWSKeyboardHandler::ScrollLockOff:
- switchLed(LED_SCR, ka == QWSKeyboardHandler::ScrollLockOn);
- break;
-
- case QWSKeyboardHandler::PreviousConsole:
- switchConsole(qBound(1, m_vt_qws - 1, 10));
- break;
-
- case QWSKeyboardHandler::NextConsole:
- switchConsole(qBound(1, m_vt_qws + 1, 10));
- break;
-
- default:
- if (ka >= QWSKeyboardHandler::SwitchConsoleFirst &&
- ka <= QWSKeyboardHandler::SwitchConsoleLast) {
- switchConsole(1 + (ka & QWSKeyboardHandler::SwitchConsoleMask));
- }
- //ignore reboot
- break;
- }
- }
-}
-
-
-void QWSTtyKbPrivate::switchConsole(int vt)
-{
-#if defined(Q_OS_LINUX)
- if (m_vt_qws && vt && (m_tty_fd >= 0 ))
- ::ioctl(m_tty_fd, VT_ACTIVATE, vt);
-#endif
-}
-
-void QWSTtyKbPrivate::handleConsoleSwitch(int sig)
-{
-#if defined(Q_OS_LINUX)
- // received a notification from the kernel that the current VT is
- // changing: either enable or disable QWS painting accordingly.
-
- if (sig == VTACQSIG) {
- if (::ioctl(m_tty_fd, VT_RELDISP, VT_ACKACQ) == 0) {
- qwsServer->enablePainting(true);
- qt_screen->restore();
- qwsServer->resumeMouse();
- qwsServer->refresh();
- }
- } else if (sig == VTRELSIG) {
- qwsServer->enablePainting(false);
-
- // Check for reserved surfaces which might still do painting
- bool allWindowsHidden = true;
- const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows();
- for (int i = 0; i < windows.size(); ++i) {
- const QWSWindow *w = windows.at(i);
- QWSWindowSurface *s = w->windowSurface();
- if (s && s->isRegionReserved() && !w->allocatedRegion().isEmpty()) {
- allWindowsHidden = false;
- break;
- }
- }
-
- if (!allWindowsHidden) {
- ::ioctl(m_tty_fd, VT_RELDISP, 0); // abort console switch
- qwsServer->enablePainting(true);
- } else if (::ioctl(m_tty_fd, VT_RELDISP, 1) == 0) {
- qt_screen->save();
- qwsServer->suspendMouse();
- } else {
- qwsServer->enablePainting(true);
- }
- }
-#endif
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdtty_qws.moc"
-
-#endif // QT_NO_QWS_KEYBOARD || QT_NO_QWS_KBD_TTY
diff --git a/src/gui/embedded/qkbdtty_qws.h b/src/gui/embedded/qkbdtty_qws.h
deleted file mode 100644
index 373342b87b..0000000000
--- a/src/gui/embedded/qkbdtty_qws.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDTTY_QWS_H
-#define QKBDTTY_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#ifndef QT_NO_QWS_KBD_TTY
-
-class QWSTtyKbPrivate;
-
-class QWSTtyKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- explicit QWSTtyKeyboardHandler(const QString&);
- virtual ~QWSTtyKeyboardHandler();
-
- virtual bool filterKeycode(char &code);
-
-private:
- QWSTtyKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_TTY
-
-#endif // QT_NO_QWS_KEYBOARD
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDTTY_QWS_H
diff --git a/src/gui/embedded/qkbdum_qws.cpp b/src/gui/embedded/qkbdum_qws.cpp
deleted file mode 100644
index cfdaa2eed1..0000000000
--- a/src/gui/embedded/qkbdum_qws.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdum_qws.h"
-#include "qvfbhdr.h"
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_UM)
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <qstring.h>
-#include <qwindowsystem_qws.h>
-#include <qsocketnotifier.h>
-#include "qplatformdefs.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWSUmKeyboardHandlerPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QWSUmKeyboardHandlerPrivate(const QString&);
- ~QWSUmKeyboardHandlerPrivate();
-
-private slots:
- void readKeyboardData();
-
-private:
- int kbdFD;
- int kbdIdx;
- const int kbdBufferLen;
- unsigned char *kbdBuffer;
- QSocketNotifier *notifier;
-};
-
-QWSUmKeyboardHandlerPrivate::QWSUmKeyboardHandlerPrivate(const QString &device)
- : kbdFD(-1), kbdIdx(0), kbdBufferLen(sizeof(QVFbKeyData)*5)
-{
- kbdBuffer = new unsigned char [kbdBufferLen];
-
- if ((kbdFD = QT_OPEN((const char *)device.toLocal8Bit(), O_RDONLY | O_NDELAY, 0)) < 0) {
- qDebug("Cannot open %s (%s)", (const char *)device.toLocal8Bit(),
- strerror(errno));
- } else {
- // Clear pending input
- char buf[2];
- while (QT_READ(kbdFD, buf, 1) > 0) { }
-
- notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
- }
-}
-
-QWSUmKeyboardHandlerPrivate::~QWSUmKeyboardHandlerPrivate()
-{
- if (kbdFD >= 0)
- QT_CLOSE(kbdFD);
- delete [] kbdBuffer;
-}
-
-
-void QWSUmKeyboardHandlerPrivate::readKeyboardData()
-{
- int n;
- do {
- n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
- if (n > 0)
- kbdIdx += n;
- } while (n > 0);
-
- int idx = 0;
- while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) {
- QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx);
- // Qtopia Key filters must still work.
- QWSServer::processKeyEvent(kd->unicode, kd->keycode, kd->modifiers, kd->press, kd->repeat);
- idx += sizeof(QVFbKeyData);
- }
-
- int surplus = kbdIdx - idx;
- for (int i = 0; i < surplus; i++)
- kbdBuffer[i] = kbdBuffer[idx+i];
- kbdIdx = surplus;
-}
-
-QWSUmKeyboardHandler::QWSUmKeyboardHandler(const QString &device)
- : QWSKeyboardHandler()
-{
- d = new QWSUmKeyboardHandlerPrivate(device);
-}
-
-QWSUmKeyboardHandler::~QWSUmKeyboardHandler()
-{
- delete d;
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdum_qws.moc"
-
-#endif // QT_NO_QWS_KEYBOARD && QT_NO_QWS_KBD_UM
diff --git a/src/gui/embedded/qkbdum_qws.h b/src/gui/embedded/qkbdum_qws.h
deleted file mode 100644
index fd21c4875a..0000000000
--- a/src/gui/embedded/qkbdum_qws.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDUM_QWS_H
-#define QKBDUM_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#ifndef QT_NO_QWS_KBD_UM
-
-class QWSUmKeyboardHandlerPrivate;
-
-class QWSUmKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- QWSUmKeyboardHandler(const QString &);
- virtual ~QWSUmKeyboardHandler();
-
-private:
-
- QWSUmKeyboardHandlerPrivate *d;
-};
-#endif // QT_NO_QWS_KBD_UM
-
-#endif // QT_NO_QWS_KEYBOARD
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDUM_QWS_H
diff --git a/src/gui/embedded/qkbdvfb_qws.cpp b/src/gui/embedded/qkbdvfb_qws.cpp
deleted file mode 100644
index a626ef5e13..0000000000
--- a/src/gui/embedded/qkbdvfb_qws.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <qvfbhdr.h>
-#include <qkbdvfb_qws.h>
-
-#ifndef QT_NO_QWS_KEYBOARD
-#ifndef QT_NO_QWS_KBD_QVFB
-
-#include <qwindowsystem_qws.h>
-#include <qsocketnotifier.h>
-#include <qapplication.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-QT_BEGIN_NAMESPACE
-
-QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device)
- : QObject()
-{
- terminalName = device;
- if (terminalName.isEmpty())
- terminalName = QLatin1String("/dev/vkdb");
- kbdFD = -1;
- kbdIdx = 0;
- kbdBufferLen = sizeof(QVFbKeyData) * 5;
- kbdBuffer = new unsigned char [kbdBufferLen];
-
- if ((kbdFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
- qWarning("Cannot open %s (%s)", terminalName.toLatin1().constData(),
- strerror(errno));
- } else {
- // Clear pending input
- char buf[2];
- while (QT_READ(kbdFD, buf, 1) > 0) { }
-
- notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
- }
-}
-
-QVFbKeyboardHandler::~QVFbKeyboardHandler()
-{
- if (kbdFD >= 0)
- QT_CLOSE(kbdFD);
- delete [] kbdBuffer;
-}
-
-
-void QVFbKeyboardHandler::readKeyboardData()
-{
- int n;
- do {
- n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
- if (n > 0)
- kbdIdx += n;
- } while (n > 0);
-
- int idx = 0;
- while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) {
- QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx);
- if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) {
- // magic exit key
- qWarning("Instructed to quit by Virtual Keyboard");
- qApp->quit();
- }
- QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat);
- idx += sizeof(QVFbKeyData);
- }
-
- int surplus = kbdIdx - idx;
- for (int i = 0; i < surplus; i++)
- kbdBuffer[i] = kbdBuffer[idx+i];
- kbdIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_KBD_QVFB
-#endif // QT_NO_QWS_KEYBOARD
diff --git a/src/gui/embedded/qkbdvfb_qws.h b/src/gui/embedded/qkbdvfb_qws.h
deleted file mode 100644
index c99a6df006..0000000000
--- a/src/gui/embedded/qkbdvfb_qws.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDVFB_QWS_H
-#define QKBDVFB_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-#ifndef QT_NO_QWS_KBD_QVFB
-
-class QSocketNotifier;
-
-class QVFbKeyboardHandler : public QObject, public QWSKeyboardHandler
-{
- Q_OBJECT
-public:
- QVFbKeyboardHandler(const QString &device);
- virtual ~QVFbKeyboardHandler();
-
-private Q_SLOTS:
- void readKeyboardData();
-
-private:
- QString terminalName;
- int kbdFD;
- int kbdIdx;
- int kbdBufferLen;
- unsigned char *kbdBuffer;
- QSocketNotifier *notifier;
-};
-
-#endif // QT_NO_QWS_KBD_QVFB
-
-#endif // QT_NO_QWS_KEYBOARD
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDVFB_QWS_H
diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp
deleted file mode 100644
index d429b93f26..0000000000
--- a/src/gui/embedded/qlock.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlock_p.h"
-
-
-#ifdef QT_NO_QWS_MULTIPROCESS
-
-QT_BEGIN_NAMESPACE
-
-/* no multiprocess - use a dummy */
-
-QLock::QLock(const QString & /*filename*/, char /*id*/, bool /*create*/)
- : type(Read), data(0)
-{
-}
-
-QLock::~QLock()
-{
-}
-
-bool QLock::isValid() const
-{
- return true;
-}
-
-void QLock::lock(Type t)
-{
- data = (QLockData *)-1;
- type = t;
-}
-
-void QLock::unlock()
-{
- data = 0;
-}
-
-bool QLock::locked() const
-{
- return data;
-}
-
-QT_END_NAMESPACE
-
-#else // QT_NO_QWS_MULTIPROCESS
-
-#if defined(Q_OS_DARWIN)
-# define Q_NO_SEMAPHORE
-#endif
-
-#include "qwssignalhandler_p.h"
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#if defined(Q_NO_SEMAPHORE)
-# include <sys/stat.h>
-# include <sys/file.h>
-#else
-# include <sys/sem.h>
-#endif
-#include <string.h>
-#include <errno.h>
-#include <qdebug.h>
-
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-QT_BEGIN_NAMESPACE
-
-#define MAX_LOCKS 200 // maximum simultaneous read locks
-
-class QLockData
-{
-public:
-#ifdef Q_NO_SEMAPHORE
- QByteArray file;
-#endif // Q_NO_SEMAPHORE
- int id;
- int count;
- bool owned;
-};
-
-/*!
- \class QLock
- \brief The QLock class is a wrapper for a System V shared semaphore.
-
- \ingroup qws
-
- \internal
-
- It is used by \l{Qt for Embedded Linux} for synchronizing access to the graphics
- card and shared memory region between processes.
-*/
-
-/*!
- \enum QLock::Type
-
- \value Read
- \value Write
-*/
-
-/*!
- \fn QLock::QLock(const QString &filename, char id, bool create)
-
- Creates a lock. \a filename is the file path of the Unix-domain
- socket the \l{Qt for Embedded Linux} client is using. \a id is the name of the
- particular lock to be created on that socket. If \a create is true
- the lock is to be created (as the Qt for Embedded Linux server does); if \a
- create is false the lock should exist already (as the Qt for Embedded Linux
- client expects).
-*/
-
-QLock::QLock(const QString &filename, char id, bool create)
-{
- data = new QLockData;
- data->count = 0;
-#ifdef Q_NO_SEMAPHORE
- data->file = QString(filename+id).toLocal8Bit().constData();
- for(int x = 0; x < 2; x++) {
- data->id = QT_OPEN(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
- if(data->id != -1 || !create) {
- data->owned = x;
- break;
- }
- }
-#else
- key_t semkey = ftok(filename.toLocal8Bit().constData(), id);
- data->id = semget(semkey,0,0);
- data->owned = create;
- if (create) {
- qt_semun arg; arg.val = 0;
- if (data->id != -1)
- semctl(data->id,0,IPC_RMID,arg);
- data->id = semget(semkey,1,IPC_CREAT|0600);
- arg.val = MAX_LOCKS;
- semctl(data->id,0,SETVAL,arg);
-
- QWSSignalHandler::instance()->addSemaphore(data->id);
- }
-#endif
- if (data->id == -1) {
- int eno = errno;
- qWarning("Cannot %s semaphore %s '%c'", (create ? "create" : "get"),
- qPrintable(filename), id);
- qDebug() << "Error" << eno << strerror(eno);
- }
-}
-
-/*!
- \fn QLock::~QLock()
-
- Destroys a lock
-*/
-
-QLock::~QLock()
-{
- if (locked())
- unlock();
-#ifdef Q_NO_SEMAPHORE
- if(isValid()) {
- QT_CLOSE(data->id);
- if(data->owned)
- unlink(data->file);
- }
-#else
- if(data->owned)
- QWSSignalHandler::instance()->removeSemaphore(data->id);
-#endif
- delete data;
-}
-
-/*!
- \fn bool QLock::isValid() const
-
- Returns true if the lock constructor was successful; returns false if
- the lock could not be created or was not available to connect to.
-*/
-
-bool QLock::isValid() const
-{
- return (data->id != -1);
-}
-
-/*!
- Locks the semaphore with a lock of type \a t. Locks can either be
- \c Read or \c Write. If a lock is \c Read, attempts by other
- processes to obtain \c Read locks will succeed, and \c Write
- attempts will block until the lock is unlocked. If locked as \c
- Write, all attempts to lock by other processes will block until
- the lock is unlocked. Locks are stacked: i.e. a given QLock can be
- locked multiple times by the same process without blocking, and
- will only be unlocked after a corresponding number of unlock()
- calls.
-*/
-
-void QLock::lock(Type t)
-{
- if (!data->count) {
-#ifdef Q_NO_SEMAPHORE
- int op = LOCK_SH;
- if(t == Write)
- op = LOCK_EX;
- for(int rv=1; rv;) {
- rv = flock(data->id, op);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop lock failure %s",strerror(errno));
- }
-#else
- sembuf sops;
- sops.sem_num = 0;
- sops.sem_flg = SEM_UNDO;
-
- if (t == Write) {
- sops.sem_op = -MAX_LOCKS;
- type = Write;
- } else {
- sops.sem_op = -1;
- type = Read;
- }
-
- int rv;
- do {
- rv = semop(data->id,&sops,1);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop lock failure %s",strerror(errno));
- } while (rv == -1 && errno == EINTR);
-#endif
- }
- data->count++;
-}
-
-/*!
- \fn void QLock::unlock()
-
- Unlocks the semaphore. If other processes were blocking waiting to
- lock() the semaphore, one of them will wake up and succeed in
- lock()ing.
-*/
-
-void QLock::unlock()
-{
- if(data->count) {
- data->count--;
- if(!data->count) {
-#ifdef Q_NO_SEMAPHORE
- for(int rv=1; rv;) {
- rv = flock(data->id, LOCK_UN);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop lock failure %s",strerror(errno));
- }
-#else
- sembuf sops;
- sops.sem_num = 0;
- sops.sem_op = 1;
- sops.sem_flg = SEM_UNDO;
- if (type == Write)
- sops.sem_op = MAX_LOCKS;
-
- int rv;
- do {
- rv = semop(data->id,&sops,1);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop unlock failure %s",strerror(errno));
- } while (rv == -1 && errno == EINTR);
-#endif
- }
- } else {
- qDebug("Unlock without corresponding lock");
- }
-}
-
-/*!
- \fn bool QLock::locked() const
-
- Returns true if the lock is currently held by the current process;
- otherwise returns false.
-*/
-
-bool QLock::locked() const
-{
- return (data->count > 0);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
diff --git a/src/gui/embedded/qlock_p.h b/src/gui/embedded/qlock_p.h
deleted file mode 100644
index 34560a012e..0000000000
--- a/src/gui/embedded/qlock_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCK_P_H
-#define QLOCK_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. This header file may
-// change from version to version without notice, or even be
-// removed.
-//
-// We mean it.
-//
-
-#include "QtCore/qstring.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLockData;
-
-class Q_GUI_EXPORT QLock
-{
-public:
- QLock(const QString &filename, char id, bool create = false);
- ~QLock();
-
- enum Type { Read, Write };
-
- bool isValid() const;
- void lock(Type type);
- void unlock();
- bool locked() const;
-
-private:
- Type type;
- QLockData *data;
-};
-
-
-// Nice class for ensuring the lock is released.
-// Just create one on the stack and the lock is automatically released
-// when QLockHandle is destructed.
-class Q_GUI_EXPORT QLockHandle
-{
-public:
- QLockHandle(QLock *l, QLock::Type type) : qlock(l) { qlock->lock(type); }
- ~QLockHandle() { if (locked()) qlock->unlock(); }
-
- void lock(QLock::Type type) { qlock->lock(type); }
- void unlock() { qlock->unlock(); }
- bool locked() const { return qlock->locked(); }
-
-private:
- QLock *qlock;
-};
-
-QT_END_NAMESPACE
-
-#endif // QLOCK_P_H
diff --git a/src/gui/embedded/qmouse_qws.cpp b/src/gui/embedded/qmouse_qws.cpp
deleted file mode 100644
index c373b916ca..0000000000
--- a/src/gui/embedded/qmouse_qws.cpp
+++ /dev/null
@@ -1,653 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouse_qws.h"
-#include "qwindowsystem_qws.h"
-#include "qscreen_qws.h"
-#include "qapplication.h"
-#include "qtextstream.h"
-#include "qfile.h"
-#include "qdebug.h"
-#include "qscreen_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QWSPointerCalibrationData
- \ingroup qws
-
- \brief The QWSPointerCalibrationData class is a container for
- mouse calibration data in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QWSPointerCalibrationData stores device and screen coordinates in
- the devPoints and screenPoints variables, respectively.
-
- A calibration program should create a QWSPointerCalibrationData
- object, fill the devPoints and screenPoints variables with its
- device and screen coordinates, and pass the object to the mouse
- driver using the QWSMouseHandler::calibrate() function.
-
- \sa QWSCalibratedMouseHandler, {Mouse Calibration Example}
-*/
-
-/*!
- \variable QWSPointerCalibrationData::devPoints
- \brief the raw device coordinates for each value of the Location enum.
-*/
-
-/*!
- \variable QWSPointerCalibrationData::screenPoints
- \brief the logical screen coordinates for each value of the Location enum.
-*/
-
-/*!
- \enum QWSPointerCalibrationData::Location
-
- This enum describes the various logical positions that can be
- specified by the devPoints and screenPoints variables.
-
- \value TopLeft Index of the top left corner of the screen.
- \value BottomLeft Index of the bottom left corner of the screen.
- \value BottomRight Index of the bottom right corner of the screen.
- \value TopRight Index of the top right corner of the screen.
- \value Center Index of the center of the screen.
- \value LastLocation Last index in the pointer arrays.
-*/
-
-class QWSMouseHandlerPrivate
-{
-public:
- QWSMouseHandlerPrivate() : screen(qt_screen) {}
-
- const QScreen *screen;
-};
-
-/*!
- \class QWSMouseHandler
- \ingroup qws
-
- \brief The QWSMouseHandler class is a base class for mouse drivers in
- Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several mouse
- protocols, see the \l{Qt for Embedded Linux Pointer Handling}{pointer
- handling} documentation for details. Custom mouse drivers can be
- implemented by subclassing the QWSMouseHandler class and creating
- a mouse driver plugin (derived from QMouseDriverPlugin).
- The default implementation of the QMouseDriverFactory class
- will automatically detect the plugin, and load the driver into the
- server application at run-time using Qt's \l {How to Create Qt
- Plugins}{plugin system}.
-
- The mouse driver receives mouse events from the system device and
- encapsulates each event with an instance of the QWSEvent class
- which it then passes to the server application (the server is
- responsible for propagating the event to the appropriate
- client). To receive mouse events, a QWSMouseHandler object will
- usually create a QSocketNotifier object for the given device. The
- QSocketNotifier class provides support for monitoring activity on
- a file descriptor. When the socket notifier receives data, it will
- call the mouse driver's mouseChanged() function to send the event
- to the \l{Qt for Embedded Linux} server application for relaying to
- clients.
-
- If you are creating a driver for a device that needs calibration
- or noise reduction, such as a touchscreen, use the
- QWSCalibratedMouseHandler subclass instead to take advantage of
- the calibrate() and clearCalibration() functions. The \l
- {qws/mousecalibration}{Mouse Calibration}
- demonstrates how to write a simple program using the mechanisms
- provided by the QWSMouseHandler class to calibrate a mouse driver.
-
- Note that when deriving from the QWSMouseHandler class, the
- resume() and suspend() functions must be reimplemented to control
- the flow of mouse input, i.e., the default implementation does
- nothing. Reimplementations of these functions typically call the
- QSocketNotifier::setEnabled() function to enable or disable the
- socket notifier, respectively.
-
- In addition, QWSMouseHandler provides the setScreen() function
- that allows you to specify a screen for your mouse driver and the
- limitToScreen() function that ensures that a given position is
- within this screen's boundaries (changing the position if
- necessary). Finally, QWSMouseHandler provides the pos() function
- returning the current mouse position.
-
- \sa QMouseDriverPlugin, QMouseDriverFactory, {Qt for Embedded Linux Pointer
- Handling}
-*/
-
-
-/*!
- \fn void QWSMouseHandler::suspend()
-
- Implement this function to suspend reading and handling of mouse
- events, e.g., call the QSocketNotifier::setEnabled() function to
- disable the socket notifier.
-
- \sa resume()
-*/
-
-/*!
- \fn void QWSMouseHandler::resume()
-
- Implement this function to resume reading and handling mouse
- events, e.g., call the QSocketNotifier::setEnabled() function to
- enable the socket notifier.
-
- \sa suspend()
-*/
-
-/*!
- \fn const QPoint &QWSMouseHandler::pos() const
-
- Returns the current mouse position.
-
- \sa mouseChanged(), limitToScreen()
-*/
-
-/*!
- Constructs a mouse driver. The \a driver and \a device arguments
- are passed by the QWS_MOUSE_PROTO environment variable.
-
- Call the QWSServer::setMouseHandler() function to make the newly
- created mouse driver, the primary driver. Note that the primary
- driver is controlled by the system, i.e., the system will delete
- it upon exit.
-*/
-QWSMouseHandler::QWSMouseHandler(const QString &, const QString &)
- : mousePos(QWSServer::mousePosition), d_ptr(new QWSMouseHandlerPrivate)
-{
-}
-
-/*!
- Destroys this mouse driver.
-
- Do not call this function if this driver is the primary mouse
- driver, i.e., if QWSServer::setMouseHandler() function has been
- called passing this driver as argument. The primary mouse
- driver is deleted by the system.
-*/
-QWSMouseHandler::~QWSMouseHandler()
-{
- delete d_ptr;
-}
-
-/*!
- Ensures that the given \a position is within the screen's
- boundaries, changing the \a position if necessary.
-
- \sa pos(), setScreen()
-*/
-
-void QWSMouseHandler::limitToScreen(QPoint &position)
-{
- position.setX(qMin(d_ptr->screen->deviceWidth() - 1, qMax(0, position.x())));
- position.setY(qMin(d_ptr->screen->deviceHeight() - 1, qMax(0, position.y())));
-}
-
-/*!
- \since 4.2
-
- Sets the screen for this mouse driver to be the given \a screen.
-
- \sa limitToScreen()
-*/
-void QWSMouseHandler::setScreen(const QScreen *screen)
-{
- d_ptr->screen = (screen ? screen : qt_screen);
-}
-
-/*!
- Notifies the system of a new mouse event.
-
- This function updates the current mouse position and sends the
- event to the \l{Qt for Embedded Linux} server application for
- delivery to the correct widget. Note that a custom mouse driver must call
- this function whenever it wants to deliver a new mouse event.
-
- The given \a position is the global position of the mouse cursor.
- The \a state parameter is a bitmask of the Qt::MouseButton enum's
- values, indicating which mouse buttons are pressed. The \a wheel
- parameter is the delta value of the mouse wheel as returned by
- QWheelEvent::delta().
-
- \sa pos()
-*/
-void QWSMouseHandler::mouseChanged(const QPoint &position, int state, int wheel)
-{
- mousePos = position + d_ptr->screen->offset();
- QWSServer::sendMouseEvent(mousePos, state, wheel);
-}
-
-/*!
- \fn QWSMouseHandler::clearCalibration()
-
- This virtual function allows subclasses of QWSMouseHandler to
- clear the calibration information. Note that the default
- implementation does nothing.
-
- \sa QWSCalibratedMouseHandler::clearCalibration(), calibrate()
-*/
-
-/*!
- \fn QWSMouseHandler::calibrate(const QWSPointerCalibrationData *data)
-
- This virtual function allows subclasses of QWSMouseHandler to set
- the calibration information passed in the given \a data. Note that
- the default implementation does nothing.
-
- \sa QWSCalibratedMouseHandler::calibrate(), clearCalibration()
-*/
-
-/*! \fn QWSMouseHandler::getCalibration(QWSPointerCalibrationData *data) const
- This virtual function allows subclasses of QWSMouseHandler
- to fill in the device coordinates in \a data with values
- that correspond to screen coordinates that are already in
- \a data. Note that the default implementation does nothing.
- */
-
-/*!
- \class QWSCalibratedMouseHandler
- \ingroup qws
-
- \brief The QWSCalibratedMouseHandler class provides mouse
- calibration and noise reduction in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several mouse
- protocols, see the \l{Qt for Embedded Linux Pointer Handling}{pointer
- handling} documentation for details. In general, custom mouse
- drivers can be implemented by subclassing the QWSMouseHandler
- class. But when the system device does not have a fixed mapping
- between device and screen coordinates and/or produces noisy events
- (e.g., a touchscreen), you should derive from the
- QWSCalibratedMouseHandler class instead to take advantage of its
- calibration functionality. As always, you must also create a mouse
- driver plugin (derived from QMouseDriverPlugin);
- the implementation of the QMouseDriverFactory class will then
- automatically detect the plugin, and load the driver into the
- server application at run-time using Qt's
- \l{How to Create Qt Plugins}{plugin system}.
-
- QWSCalibratedMouseHandler provides an implementation of the
- calibrate() function to update the calibration parameters based on
- coordinate mapping of the given calibration data. The calibration
- data is represented by an QWSPointerCalibrationData object. The
- linear transformation between device coordinates and screen
- coordinates is performed by calling the transform() function
- explicitly on the points passed to the
- QWSMouseHandler::mouseChanged() function. Use the
- clearCalibration() function to make the mouse driver return mouse
- events in raw device coordinates and not in screen coordinates.
-
- The calibration parameters are recalculated whenever calibrate()
- is called, and they can be stored using the writeCalibration()
- function. Previously written parameters can be retrieved at any
- time using the readCalibration() function (calibration parameters
- are always read when the class is instantiated). Note that the
- calibration parameters is written to and read from the file
- currently specified by the POINTERCAL_FILE environment variable;
- the default file is \c /etc/pointercal.
-
- To achieve noise reduction, QWSCalibratedMouseHandler provides the
- sendFiltered() function. Use this function instead of
- mouseChanged() whenever a mouse event occurs. The filter's size
- can be manipulated using the setFilterSize() function.
-
- \sa QWSMouseHandler, QWSPointerCalibrationData,
- {Mouse Calibration Example}
-*/
-
-
-/*!
- \internal
- */
-
-QWSCalibratedMouseHandler::QWSCalibratedMouseHandler(const QString &, const QString &)
- : samples(5), currSample(0), numSamples(0)
-{
- clearCalibration();
- readCalibration();
-}
-
-/*!
- Fills \a cd with the device coordinates corresponding to the given
- screen coordinates.
-
- \internal
-*/
-void QWSCalibratedMouseHandler::getCalibration(QWSPointerCalibrationData *cd) const
-{
- const qint64 scale = qint64(a) * qint64(e) - qint64(b) * qint64(d);
- const qint64 xOff = qint64(b) * qint64(f) - qint64(c) * qint64(e);
- const qint64 yOff = qint64(c) * qint64(d) - qint64(a) * qint64(f);
- for (int i = 0; i <= QWSPointerCalibrationData::LastLocation; ++i) {
- const qint64 sX = cd->screenPoints[i].x();
- const qint64 sY = cd->screenPoints[i].y();
- const qint64 dX = (s*(e*sX - b*sY) + xOff) / scale;
- const qint64 dY = (s*(a*sY - d*sX) + yOff) / scale;
- cd->devPoints[i] = QPoint(dX, dY);
- }
-}
-
-/*!
- Clears the current calibration, i.e., makes the mouse
- driver return mouse events in raw device coordinates instead of
- screen coordinates.
-
- \sa calibrate()
-*/
-void QWSCalibratedMouseHandler::clearCalibration()
-{
- a = 1;
- b = 0;
- c = 0;
- d = 0;
- e = 1;
- f = 0;
- s = 1;
-}
-
-
-/*!
- Saves the current calibration parameters in \c /etc/pointercal
- (separated by whitespace and in alphabetical order).
-
- You can override the default \c /etc/pointercal by specifying
- another file using the POINTERCAL_FILE environment variable.
-
- \sa readCalibration()
-*/
-void QWSCalibratedMouseHandler::writeCalibration()
-{
- QString calFile;
- calFile = QString::fromLocal8Bit(qgetenv("POINTERCAL_FILE"));
- if (calFile.isEmpty())
- calFile = QLatin1String("/etc/pointercal");
-
-#ifndef QT_NO_TEXTSTREAM
- QFile file(calFile);
- if (file.open(QIODevice::WriteOnly)) {
- QTextStream t(&file);
- t << a << ' ' << b << ' ' << c << ' ';
- t << d << ' ' << e << ' ' << f << ' ' << s << endl;
- } else
-#endif
- {
- qCritical("QWSCalibratedMouseHandler::writeCalibration: "
- "Could not save calibration into %s", qPrintable(calFile));
- }
-}
-
-/*!
- Reads previously written calibration parameters which are stored
- in \c /etc/pointercal (separated by whitespace and in alphabetical
- order).
-
- You can override the default \c /etc/pointercal by specifying
- another file using the POINTERCAL_FILE environment variable.
-
-
- \sa writeCalibration()
-*/
-void QWSCalibratedMouseHandler::readCalibration()
-{
- QString calFile = QString::fromLocal8Bit(qgetenv("POINTERCAL_FILE"));
- if (calFile.isEmpty())
- calFile = QLatin1String("/etc/pointercal");
-
-#ifndef QT_NO_TEXTSTREAM
- QFile file(calFile);
- if (file.open(QIODevice::ReadOnly)) {
- QTextStream t(&file);
- t >> a >> b >> c >> d >> e >> f >> s;
- if (s == 0 || t.status() != QTextStream::Ok) {
- qCritical("Corrupt calibration data");
- clearCalibration();
- }
- } else
-#endif
- {
- qDebug() << "Could not read calibration:" <<calFile;
- }
-}
-
-static int ilog2(quint32 n)
-{
- int result = 0;
-
- if (n & 0xffff0000) {
- n >>= 16;
- result += 16;
- }
- if (n & 0xff00) {
- n >>= 8;
- result += 8;}
- if (n & 0xf0) {
- n >>= 4;
- result += 4;
- }
- if (n & 0xc) {
- n >>= 2;
- result += 2;
- }
- if (n & 0x2)
- result += 1;
-
- return result;
-}
-
-/*!
- Updates the calibration parameters based on coordinate mapping of
- the given \a data.
-
- Create an instance of the QWSPointerCalibrationData class, fill in
- the device and screen coordinates and pass that object to the mouse
- driver using this function.
-
- \sa clearCalibration(), transform()
-*/
-void QWSCalibratedMouseHandler::calibrate(const QWSPointerCalibrationData *data)
-{
- // Algorithm derived from
- // "How To Calibrate Touch Screens" by Carlos E. Vidales,
- // printed in Embedded Systems Programming, Vol. 15 no 6, June 2002
- // URL: http://www.embedded.com/showArticle.jhtml?articleID=9900629
-
- const QPoint pd0 = data->devPoints[QWSPointerCalibrationData::TopLeft];
- const QPoint pd1 = data->devPoints[QWSPointerCalibrationData::TopRight];
- const QPoint pd2 = data->devPoints[QWSPointerCalibrationData::BottomRight];
- const QPoint p0 = data->screenPoints[QWSPointerCalibrationData::TopLeft];
- const QPoint p1 = data->screenPoints[QWSPointerCalibrationData::TopRight];
- const QPoint p2 = data->screenPoints[QWSPointerCalibrationData::BottomRight];
-
- const qint64 xd0 = pd0.x();
- const qint64 xd1 = pd1.x();
- const qint64 xd2 = pd2.x();
- const qint64 yd0 = pd0.y();
- const qint64 yd1 = pd1.y();
- const qint64 yd2 = pd2.y();
- const qint64 x0 = p0.x();
- const qint64 x1 = p1.x();
- const qint64 x2 = p2.x();
- const qint64 y0 = p0.y();
- const qint64 y1 = p1.y();
- const qint64 y2 = p2.y();
-
- qint64 scale = ((xd0 - xd2)*(yd1 - yd2) - (xd1 - xd2)*(yd0 - yd2));
- int shift = 0;
- qint64 absScale = qAbs(scale);
- // use maximum 16 bit precision to reduce risk of integer overflow
- if (absScale > (1 << 16)) {
- shift = ilog2(absScale >> 16) + 1;
- scale >>= shift;
- }
-
- s = scale;
- a = ((x0 - x2)*(yd1 - yd2) - (x1 - x2)*(yd0 - yd2)) >> shift;
- b = ((xd0 - xd2)*(x1 - x2) - (x0 - x2)*(xd1 - xd2)) >> shift;
- c = (yd0*(xd2*x1 - xd1*x2) + yd1*(xd0*x2 - xd2*x0) + yd2*(xd1*x0 - xd0*x1)) >> shift;
- d = ((y0 - y2)*(yd1 - yd2) - (y1 - y2)*(yd0 - yd2)) >> shift;
- e = ((xd0 - xd2)*(y1 - y2) - (y0 - y2)*(xd1 - xd2)) >> shift;
- f = (yd0*(xd2*y1 - xd1*y2) + yd1*(xd0*y2 - xd2*y0) + yd2*(xd1*y0 - xd0*y1)) >> shift;
-
- writeCalibration();
-}
-
-/*!
- Transforms the given \a position from device coordinates to screen
- coordinates, and returns the transformed position.
-
- This function is typically called explicitly on the points passed
- to the QWSMouseHandler::mouseChanged() function.
-
- This implementation is a linear transformation using 7 parameters
- (\c a, \c b, \c c, \c d, \c e, \c f and \c s) to transform the
- device coordinates (\c Xd, \c Yd) into screen coordinates (\c Xs,
- \c Ys) using the following equations:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qmouse_qws.cpp 0
-
- \sa mouseChanged()
-*/
-QPoint QWSCalibratedMouseHandler::transform(const QPoint &position)
-{
- QPoint tp;
-
- tp.setX((a * position.x() + b * position.y() + c) / s);
- tp.setY((d * position.x() + e * position.y() + f) / s);
-
- return tp;
-}
-
-/*!
- Sets the size of the filter used in noise reduction to the given
- \a size.
-
- The sendFiltered() function reduces noice by calculating an
- average position from a collection of mouse event positions. The
- filter size determines the number of positions that forms the
- basis for these calculations.
-
- \sa sendFiltered()
-*/
-void QWSCalibratedMouseHandler::setFilterSize(int size)
-{
- samples.resize(qMax(1, size));
- numSamples = 0;
- currSample = 0;
-}
-
-/*!
- \fn bool QWSCalibratedMouseHandler::sendFiltered(const QPoint &position, int state)
-
- Notifies the system of a new mouse event \e after applying a noise
- reduction filter. Returns true if the filtering process is
- successful; otherwise returns false. Note that if the filtering
- process failes, the system is not notified about the event.
-
- The given \a position is the global position of the mouse. The \a
- state parameter is a bitmask of the Qt::MouseButton enum's values
- indicating which mouse buttons are pressed.
-
- The noice is reduced by calculating an average position from a
- collection of mouse event positions and then calling the
- mouseChanged() function with the new position. The number of
- positions that is used is determined by the filter size.
-
- \sa mouseChanged(), setFilterSize()
-*/
-bool QWSCalibratedMouseHandler::sendFiltered(const QPoint &position, int button)
-{
- if (!button) {
- if (numSamples >= samples.count())
- mouseChanged(transform(position), 0);
- currSample = 0;
- numSamples = 0;
- return true;
- }
-
- bool sent = false;
- samples[currSample] = position;
- numSamples++;
- if (numSamples >= samples.count()) {
-
- int ignore = -1;
- if (samples.count() > 2) { // throw away the "worst" sample
- int maxd = 0;
- for (int i = 0; i < samples.count(); i++) {
- int d = (mousePos - samples[i]).manhattanLength();
- if (d > maxd) {
- maxd = d;
- ignore = i;
- }
- }
- }
-
- // average the rest
- QPoint pos(0, 0);
- int numAveraged = 0;
- for (int i = 0; i < samples.count(); i++) {
- if (ignore == i)
- continue;
- pos += samples[i];
- ++numAveraged;
- }
- if (numAveraged)
- pos /= numAveraged;
-
- mouseChanged(transform(pos), button);
- sent = true;
- }
- currSample++;
- if (currSample >= samples.count())
- currSample = 0;
-
- return sent;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qmouse_qws.h b/src/gui/embedded/qmouse_qws.h
deleted file mode 100644
index 8f2cbe5fc2..0000000000
--- a/src/gui/embedded/qmouse_qws.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSE_QWS_H
-#define QMOUSE_QWS_H
-
-#include <QtCore/qobject.h>
-#include <QtGui/qpolygon.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QWSMouseHandlerPrivate;
-class QScreen;
-
-class Q_GUI_EXPORT QWSPointerCalibrationData
-{
-public:
- enum Location { TopLeft = 0, BottomLeft = 1, BottomRight = 2, TopRight = 3,
- Center = 4, LastLocation = Center };
- QPoint devPoints[5];
- QPoint screenPoints[5];
-};
-
-class Q_GUI_EXPORT QWSMouseHandler
-{
-public:
- explicit QWSMouseHandler(const QString &driver = QString(),
- const QString &device = QString());
- virtual ~QWSMouseHandler();
-
- virtual void clearCalibration() {}
- virtual void calibrate(const QWSPointerCalibrationData *) {}
- virtual void getCalibration(QWSPointerCalibrationData *) const {}
-
- virtual void resume() = 0;
- virtual void suspend() = 0;
-
- void limitToScreen(QPoint &pt);
- void mouseChanged(const QPoint& pos, int bstate, int wheel = 0);
- const QPoint &pos() const { return mousePos; }
-
- void setScreen(const QScreen *screen);
-
-protected:
- QPoint &mousePos;
- QWSMouseHandlerPrivate *d_ptr;
-};
-
-
-class Q_GUI_EXPORT QWSCalibratedMouseHandler : public QWSMouseHandler
-{
-public:
- explicit QWSCalibratedMouseHandler(const QString &driver = QString(),
- const QString &device = QString());
-
- virtual void clearCalibration();
- virtual void calibrate(const QWSPointerCalibrationData *);
- virtual void getCalibration(QWSPointerCalibrationData *) const;
-
-protected:
- bool sendFiltered(const QPoint &, int button);
- QPoint transform(const QPoint &);
-
- void readCalibration();
- void writeCalibration();
- void setFilterSize(int);
-
-private:
- int a, b, c;
- int d, e, f;
- int s;
- QPolygon samples;
- int currSample;
- int numSamples;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSE_QWS_H
diff --git a/src/gui/embedded/qmousedriverfactory_qws.cpp b/src/gui/embedded/qmousedriverfactory_qws.cpp
deleted file mode 100644
index f67284d6d5..0000000000
--- a/src/gui/embedded/qmousedriverfactory_qws.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousedriverfactory_qws.h"
-
-#include "qapplication.h"
-#include "qmousepc_qws.h"
-#include "qmouselinuxtp_qws.h"
-#include "qmouselinuxinput_qws.h"
-#include "qmousevfb_qws.h"
-#include "qmousetslib_qws.h"
-#include "qmouseqnx_qws.h"
-#include "qmouseintegrity_qws.h"
-#include <stdlib.h>
-#include "private/qfactoryloader_p.h"
-#include "qmousedriverplugin_qws.h"
-#include "qdebug.h"
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
-
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QWSMouseHandlerFactoryInterface_iid,
- QLatin1String("/mousedrivers"), Qt::CaseInsensitive))
-
-#endif //QT_NO_LIBRARY
-#endif //QT_MAKEDLL
-
-/*!
- \class QMouseDriverFactory
- \ingroup qws
-
- \brief The QMouseDriverFactory class creates mouse drivers in
- Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QMouseDriverFactory is used to detect and instantiate the
- available mouse drivers, allowing \l{Qt for Embedded Linux} to load the
- preferred driver into the server application at runtime. The
- create() function returns a QWSMouseHandler object representing
- the mouse driver identified by a given key. The valid keys
- (i.e. the supported drivers) can be retrieved using the keys()
- function.
-
- \l{Qt for Embedded Linux} provides several built-in mouse drivers. In
- addition, custom mouse drivers can be added using Qt's plugin
- mechanism, i.e. by subclassing the QWSMouseHandler class and
- creating a mouse driver plugin (QMouseDriverPlugin). See the
- \l{Qt for Embedded Linux Pointer Handling}{pointer handling}
- documentation for details.
-
- \sa QWSMouseHandler, QMouseDriverPlugin
-*/
-
-/*!
- Creates the mouse driver specified by the given \a key, using the
- display specified by the given \a device.
-
- Note that the keys are case-insensitive.
-
- \sa keys()
-*/
-QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &device)
-{
- QString driver = key.toLower();
-#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_MOUSE_QNX)
- if (driver == QLatin1String("qnx") || driver.isEmpty())
- return new QQnxMouseHandler(key, device);
-#endif
-#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_MOUSE_INTEGRITY)
- if (driver == QLatin1String("integrity") || driver.isEmpty())
- return new QIntMouseHandler(key, device);
-#endif
-#ifndef QT_NO_QWS_MOUSE_LINUXTP
- if (driver == QLatin1String("linuxtp") || driver.isEmpty())
- return new QWSLinuxTPMouseHandler(key, device);
-#endif
-#ifndef QT_NO_QWS_MOUSE_PC
- if (driver == QLatin1String("auto")
- || driver == QLatin1String("intellimouse")
- || driver == QLatin1String("microsoft")
- || driver == QLatin1String("mousesystems")
- || driver == QLatin1String("mouseman")
- || driver.isEmpty()) {
- return new QWSPcMouseHandler(key, device);
- }
-#endif
-#ifndef QT_NO_QWS_MOUSE_TSLIB
- if (driver == QLatin1String("tslib") || driver.isEmpty())
- return new QWSTslibMouseHandler(key, device);
-#endif
-# ifndef QT_NO_QWS_MOUSE_LINUXINPUT
- if (driver == QLatin1String("linuxinput") || \
- driver == QLatin1String("usb") || \
- driver == QLatin1String("linuxis"))
- return new QWSLinuxInputMouseHandler(device);
-# endif
-#ifndef QT_NO_QWS_MOUSE_QVFB
- if (driver == QLatin1String("qvfbmouse") || driver == QLatin1String("qvfb"))
- return new QVFbMouseHandler(key, device);
-#endif
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
- if (QWSMouseHandlerFactoryInterface *factory = qobject_cast<QWSMouseHandlerFactoryInterface*>(loader()->instance(driver)))
- return factory->create(driver, device);
-#endif
-#endif
- return 0;
-}
-
-/*!
- Returns the list of valid keys, i.e. the available mouse drivers.
-
- \sa create()
-*/
-QStringList QMouseDriverFactory::keys()
-{
- QStringList list;
-
-#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_MOUSE_QNX)
- list << QLatin1String("QNX");
-#endif
-#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_MOUSE_INTEGRITY)
- list << QLatin1String("INTEGRITY");
-#endif
-#ifndef QT_NO_QWS_MOUSE_LINUXTP
- list << QLatin1String("LinuxTP");
-#endif
-#ifndef QT_NO_QWS_MOUSE_PC
- list << QLatin1String("Auto")
- << QLatin1String("IntelliMouse")
- << QLatin1String("Microsoft")
- << QLatin1String("MouseSystems")
- << QLatin1String("MouseMan");
-#endif
-#ifndef QT_NO_QWS_MOUSE_TSLIB
- list << QLatin1String("Tslib");
-#endif
-#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
- list << QLatin1String("LinuxInput");
-#endif
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
- QStringList plugins = loader()->keys();
- for (int i = 0; i < plugins.size(); ++i) {
- if (!list.contains(plugins.at(i)))
- list += plugins.at(i);
- }
-#endif //QT_NO_LIBRARY
-#endif //QT_MAKEDLL
- return list;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qmousedriverfactory_qws.h b/src/gui/embedded/qmousedriverfactory_qws.h
deleted file mode 100644
index 0eac39a758..0000000000
--- a/src/gui/embedded/qmousedriverfactory_qws.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEDRIVERFACTORY_QWS_H
-#define QMOUSEDRIVERFACTORY_QWS_H
-
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QString;
-class QWSMouseHandler;
-
-class Q_GUI_EXPORT QMouseDriverFactory
-{
-public:
- static QStringList keys();
- static QWSMouseHandler *create(const QString&, const QString &);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEDRIVERFACTORY_QWS_H
diff --git a/src/gui/embedded/qmousedriverplugin_qws.cpp b/src/gui/embedded/qmousedriverplugin_qws.cpp
deleted file mode 100644
index 4fae54b6b7..0000000000
--- a/src/gui/embedded/qmousedriverplugin_qws.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousedriverplugin_qws.h"
-
-#ifndef QT_NO_LIBRARY
-
-#include "qmouse_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMouseDriverPlugin
- \ingroup plugins
- \ingroup qws
-
- \brief The QMouseDriverPlugin class is an abstract base class for
- mouse driver plugins in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several mouse
- protocols, see the \l{Qt for Embedded Linux Pointer Handling}{pointer
- handling} documentation for details. Custom mouse drivers can be
- implemented by subclassing the QWSMouseHandler class and creating
- a mouse driver plugin.
-
- A mouse driver plugin can be created by subclassing
- QMouseDriverPlugin and reimplementing the pure virtual keys() and
- create() functions. By exporting the derived class using the
- Q_EXPORT_PLUGIN2() macro, The default implementation of the
- QMouseDriverFactory class will automatically detect the plugin and
- load the driver into the server application at run-time. See \l
- {How to Create Qt Plugins} for details.
-
- \sa QWSMouseHandler, QMouseDriverFactory
-*/
-
-/*!
- \fn QStringList QMouseDriverPlugin::keys() const
-
- Implement this function to return the list of valid keys, i.e. the
- mouse drivers supported by this plugin.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several mouse
- protocols, see the \l {Qt for Embedded Linux Pointer Handling}{pointer
- handling} documentation for details.
-
- \sa create()
-*/
-
-/*!
- Constructs a mouse driver plugin with the given \a parent.
-
- Note that this constructor is invoked automatically by the
- Q_EXPORT_PLUGIN2() macro, so there is no need for calling it
- explicitly.
-*/
-QMouseDriverPlugin::QMouseDriverPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys the mouse driver plugin.
-
- Note that Qt destroys a plugin automatically when it is no longer
- used, so there is no need for calling the destructor explicitly.
-*/
-QMouseDriverPlugin::~QMouseDriverPlugin()
-{
-}
-
-/*!
- \fn QScreen* QMouseDriverPlugin::create(const QString &key, const QString& device)
-
- Implement this function to create a driver matching the type
- specified by the given \a key and \a device parameters. Note that
- keys are case-insensitive.
-
- \sa keys()
-*/
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_LIBRARY
diff --git a/src/gui/embedded/qmousedriverplugin_qws.h b/src/gui/embedded/qmousedriverplugin_qws.h
deleted file mode 100644
index 275bbd1514..0000000000
--- a/src/gui/embedded/qmousedriverplugin_qws.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEDRIVERPLUGIN_QWS_H
-#define QMOUSEDRIVERPLUGIN_QWS_H
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_LIBRARY
-
-class QWSMouseHandler;
-
-struct Q_GUI_EXPORT QWSMouseHandlerFactoryInterface : public QFactoryInterface
-{
- virtual QWSMouseHandler* create(const QString &name, const QString &device) = 0;
-};
-
-#define QWSMouseHandlerFactoryInterface_iid "com.trolltech.Qt.QWSMouseHandlerFactoryInterface"
-Q_DECLARE_INTERFACE(QWSMouseHandlerFactoryInterface, QWSMouseHandlerFactoryInterface_iid)
-
-class Q_GUI_EXPORT QMouseDriverPlugin : public QObject, public QWSMouseHandlerFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QWSMouseHandlerFactoryInterface:QFactoryInterface)
-public:
- explicit QMouseDriverPlugin(QObject *parent = 0);
- ~QMouseDriverPlugin();
-
- virtual QStringList keys() const = 0;
- virtual QWSMouseHandler* create(const QString& driver, const QString &device) = 0;
-};
-
-#endif // QT_NO_LIBRARY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEDRIVERPLUGIN_QWS_H
diff --git a/src/gui/embedded/qmouseintegrity_qws.cpp b/src/gui/embedded/qmouseintegrity_qws.cpp
deleted file mode 100644
index 78a8c1b509..0000000000
--- a/src/gui/embedded/qmouseintegrity_qws.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_NO_QWS_MOUSE_INTEGRITY
-
-#include "qmouseintegrity_qws.h"
-#include <qwindowsystem_qws.h>
-#include <qapplication.h>
-#include <qtimer.h>
-#include <qthread.h>
-
-#include <INTEGRITY.h>
-
-
-typedef Address MOUSEHandler;
-typedef struct MOUSEMessageStruct
-{
- Value x;
- Value y;
- Value z;
- Value buttons;
-} MOUSEMessage;
-
-static Error MOUSE_Init(MOUSEHandler *handler, Boolean *isabsolute);
-static Error MOUSE_SynchronousGetPosition(MOUSEHandler handler, MOUSEMessage *msg,
- Boolean absolute);
-static Error MOUSE_ShouldFilter(MOUSEHandler handler, Boolean *filter);
-
-QT_BEGIN_NAMESPACE
-
-class QIntMouseListenThread;
-
-class QIntMousePrivate : public QObject
-{
- Q_OBJECT
- friend class QIntMouseListenTaskThread;
-Q_SIGNALS:
- void mouseDataAvailable(int x, int y, int buttons);
-public:
- QIntMousePrivate(QIntMouseHandler *handler);
- ~QIntMousePrivate();
- void dataReady(int x, int y, int buttons) { emit mouseDataAvailable(x, y, buttons); }
- bool calibrated;
- bool waitforread;
- bool suspended;
- QIntMouseListenThread *mousethread;
-
-private:
- QIntMouseHandler *handler;
-};
-
-class QIntMouseListenThread : public QThread
-{
-protected:
- QIntMousePrivate *imp;
- bool loop;
-public:
- QIntMouseListenThread(QIntMousePrivate *im) : QThread(), imp(im) {};
- ~QIntMouseListenThread() {};
- void run();
- void stoploop() { loop = false; };
-};
-
-
-QIntMouseHandler::QIntMouseHandler(const QString &driver, const QString &device)
- : QObject(), QWSCalibratedMouseHandler(driver, device)
-{
- QPoint test(1,1);
- d = new QIntMousePrivate(this);
- connect(d, SIGNAL(mouseDataAvailable(int, int, int)), this, SLOT(readMouseData(int, int, int)));
-
- d->calibrated = (test != transform(test));
-
- d->mousethread->start();
-}
-
-QIntMouseHandler::~QIntMouseHandler()
-{
- disconnect(d, SIGNAL(mouseDataAvailable(int, int, int)), this, SLOT(readMouseData(int, int, int)));
- delete d;
-}
-
-void QIntMouseHandler::resume()
-{
- d->suspended = true;
-}
-
-void QIntMouseHandler::suspend()
-{
- d->suspended = false;
-}
-
-void QIntMouseHandler::readMouseData(int x, int y, int buttons)
-{
- d->waitforread = false;
- if (d->suspended)
- return;
- if (d->calibrated) {
- sendFiltered(QPoint(x, y), buttons);
- } else {
- QPoint pos;
- pos = transform(QPoint(x, y));
- limitToScreen(pos);
- mouseChanged(pos, buttons, 0);
- }
-}
-
-void QIntMouseHandler::clearCalibration()
-{
- QWSCalibratedMouseHandler::clearCalibration();
-}
-
-void QIntMouseHandler::calibrate(const QWSPointerCalibrationData *data)
-{
- QWSCalibratedMouseHandler::calibrate(data);
-}
-
-void QIntMouseListenThread::run(void)
-{
- MOUSEHandler handler;
- MOUSEMessage msg;
- Boolean filter;
- Boolean isabsolute;
- loop = true;
- CheckSuccess(MOUSE_Init(&handler, &isabsolute));
- CheckSuccess(MOUSE_ShouldFilter(handler, &filter));
- if (!filter)
- imp->calibrated = false;
- imp->waitforread = false;
- do {
- MOUSE_SynchronousGetPosition(handler, &msg, isabsolute);
- imp->dataReady(msg.x, msg.y, msg.buttons);
- } while (loop);
- QThread::exit(0);
-}
-
-QIntMousePrivate::QIntMousePrivate(QIntMouseHandler *handler)
- : QObject()
-{
- this->handler = handler;
- suspended = false;
- mousethread = new QIntMouseListenThread(this);
-}
-
-QIntMousePrivate::~QIntMousePrivate()
-{
- mousethread->stoploop();
- mousethread->wait();
- delete mousethread;
-}
-
-QT_END_NAMESPACE
-
-#include "qmouseintegrity_qws.moc"
-
-typedef struct USBMouseStruct
-{
- Connection mouseconn;
- Buffer mousemsg[2];
- Value x;
- Value y;
-} USBMouse;
-
-USBMouse mousedev;
-
-Error MOUSE_Init(MOUSEHandler *handler, Boolean *isabsolute)
-{
- Error E;
- bool loop = true;
- memset((void*)&mousedev, 0, sizeof(USBMouse));
- mousedev.mousemsg[0].BufferType = DataImmediate;
- mousedev.mousemsg[1].BufferType = DataImmediate | LastBuffer;
- do {
- E = RequestResource((Object*)&mousedev.mouseconn,
- "MouseClient", "!systempassword");
- if (E == Success) {
- *isabsolute = true;
- loop = false;
- } else {
- E = RequestResource((Object*)&mousedev.mouseconn,
- "USBMouseClient", "!systempassword");
- if (E == Success) {
- *isabsolute = false;
- loop = false;
- }
- }
- if (loop)
- sleep(1);
- } while (loop);
- *handler = (MOUSEHandler)&mousedev;
- return Success;
-}
-
-Error MOUSE_SynchronousGetPosition(MOUSEHandler handler, MOUSEMessage *msg,
- Boolean isabsolute)
-{
- signed long x;
- signed long y;
- USBMouse *mdev = (USBMouse *)handler;
- mdev->mousemsg[0].Transferred = 0;
- mdev->mousemsg[1].Transferred = 0;
- SynchronousReceive(mdev->mouseconn, mdev->mousemsg);
- if (isabsolute) {
- x = (signed long)mdev->mousemsg[0].Length;
- y = (signed long)mdev->mousemsg[1].TheAddress;
- } else {
- x = mdev->x + (signed long)mdev->mousemsg[0].Length;
- y = mdev->y + (signed long)mdev->mousemsg[1].TheAddress;
- }
- if (x < 0)
- mdev->x = 0;
- else
- mdev->x = x;
- if (y < 0)
- mdev->y = 0;
- else
- mdev->y = y;
- msg->x = mdev->x;
- msg->y = mdev->y;
- msg->buttons = mdev->mousemsg[0].TheAddress;
- return Success;
-}
-
-Error MOUSE_ShouldFilter(MOUSEHandler handler, Boolean *filter)
-{
- if (filter == NULL)
- return Failure;
- *filter = false;
- return Success;
-}
-
-#endif // QT_NO_QWS_MOUSE_INTEGRITY
-
diff --git a/src/gui/embedded/qmouseintegrity_qws.h b/src/gui/embedded/qmouseintegrity_qws.h
deleted file mode 100644
index 46d27a3d2e..0000000000
--- a/src/gui/embedded/qmouseintegrity_qws.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEINTEGRITY_QWS_H
-#define QMOUSEINTEGRITY_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_INTEGRITY
-
-class QSocketNotifier;
-class QIntMousePrivate;
-
-class QIntMouseHandler : public QObject, public QWSCalibratedMouseHandler {
- Q_OBJECT
-public:
- QIntMouseHandler(const QString &driver = QString(),
- const QString &device = QString());
- ~QIntMouseHandler();
-
- void resume();
- void suspend();
-
- void calibrate(const QWSPointerCalibrationData *data);
- void clearCalibration();
-
-private:
- QIntMousePrivate *d;
-private Q_SLOTS:
- void readMouseData(int x, int y, int buttons);
-};
-#endif // QT_NO_QWS_MOUSE_INTEGRITY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEINTEGRITY_QWS_H
diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp
deleted file mode 100644
index 534e9f16f7..0000000000
--- a/src/gui/embedded/qmouselinuxinput_qws.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouselinuxinput_qws.h"
-
-#include <QScreen>
-#include <QSocketNotifier>
-
-#include <qplatformdefs.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <errno.h>
-
-#include <linux/input.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QWSLinuxInputMousePrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *, const QString &);
- ~QWSLinuxInputMousePrivate();
-
- void enable(bool on);
-
-private Q_SLOTS:
- void readMouseData();
-
-private:
- QWSLinuxInputMouseHandler *m_handler;
- QSocketNotifier * m_notify;
- int m_fd;
- int m_x, m_y;
- int m_buttons;
-};
-
-QWSLinuxInputMouseHandler::QWSLinuxInputMouseHandler(const QString &device)
- : QWSCalibratedMouseHandler(device)
-{
- d = new QWSLinuxInputMousePrivate(this, device);
-}
-
-QWSLinuxInputMouseHandler::~QWSLinuxInputMouseHandler()
-{
- delete d;
-}
-
-void QWSLinuxInputMouseHandler::suspend()
-{
- d->enable(false);
-}
-
-void QWSLinuxInputMouseHandler::resume()
-{
- d->enable(true);
-}
-
-QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *h, const QString &device)
- : m_handler(h), m_notify(0), m_x(0), m_y(0), m_buttons(0)
-{
- setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler"));
-
- QString dev = QLatin1String("/dev/input/event0");
- if (device.startsWith(QLatin1String("/dev/")))
- dev = device;
-
- m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
- if (m_fd >= 0) {
- m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
- connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
- } else {
- qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno));
- return;
- }
-}
-
-QWSLinuxInputMousePrivate::~QWSLinuxInputMousePrivate()
-{
- if (m_fd >= 0)
- QT_CLOSE(m_fd);
-}
-
-void QWSLinuxInputMousePrivate::enable(bool on)
-{
- if (m_notify)
- m_notify->setEnabled(on);
-}
-
-void QWSLinuxInputMousePrivate::readMouseData()
-{
- if (!qt_screen)
- return;
-
- struct ::input_event buffer[32];
- int n = 0;
-
- forever {
- n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
-
- if (n == 0) {
- qWarning("Got EOF from the input device.");
- return;
- } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
- qWarning("Could not read from input device: %s", strerror(errno));
- return;
- } else if (n % sizeof(buffer[0]) == 0) {
- break;
- }
- }
-
- n /= sizeof(buffer[0]);
-
- for (int i = 0; i < n; ++i) {
- struct ::input_event *data = &buffer[i];
-
- bool unknown = false;
- if (data->type == EV_ABS) {
- if (data->code == ABS_X) {
- m_x = data->value;
- } else if (data->code == ABS_Y) {
- m_y = data->value;
- } else {
- unknown = true;
- }
- } else if (data->type == EV_REL) {
- if (data->code == REL_X) {
- m_x += data->value;
- } else if (data->code == REL_Y) {
- m_y += data->value;
- } else {
- unknown = true;
- }
- } else if (data->type == EV_KEY && data->code == BTN_TOUCH) {
- m_buttons = data->value ? Qt::LeftButton : 0;
- } else if (data->type == EV_KEY) {
- int button = 0;
- switch (data->code) {
- case BTN_LEFT: button = Qt::LeftButton; break;
- case BTN_MIDDLE: button = Qt::MidButton; break;
- case BTN_RIGHT: button = Qt::RightButton; break;
- }
- if (data->value)
- m_buttons |= button;
- else
- m_buttons &= ~button;
- } else if (data->type == EV_SYN && data->code == SYN_REPORT) {
- QPoint pos(m_x, m_y);
- pos = m_handler->transform(pos);
- m_handler->limitToScreen(pos);
- m_handler->mouseChanged(pos, m_buttons);
- } else if (data->type == EV_MSC && data->code == MSC_SCAN) {
- // kernel encountered an unmapped key - just ignore it
- continue;
- } else {
- unknown = true;
- }
- if (unknown) {
- qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value);
- }
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qmouselinuxinput_qws.moc"
diff --git a/src/gui/embedded/qmouselinuxinput_qws.h b/src/gui/embedded/qmouselinuxinput_qws.h
deleted file mode 100644
index 2a9ddb3826..0000000000
--- a/src/gui/embedded/qmouselinuxinput_qws.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSELINUXINPUT_QWS_H
-#define QMOUSELINUXINPUT_QWS_H
-
-#include <QtGui/QWSCalibratedMouseHandler>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
-
-class QWSLinuxInputMousePrivate;
-
-class QWSLinuxInputMouseHandler : public QWSCalibratedMouseHandler
-{
-public:
- QWSLinuxInputMouseHandler(const QString &);
- ~QWSLinuxInputMouseHandler();
-
- void suspend();
- void resume();
-
-private:
- QWSLinuxInputMousePrivate *d;
-
- friend class QWSLinuxInputMousePrivate;
-};
-
-#endif // QT_NO_QWS_MOUSE_LINUXINPUT
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSELINUXINPUT_QWS_H
diff --git a/src/gui/embedded/qmouselinuxtp_qws.cpp b/src/gui/embedded/qmouselinuxtp_qws.cpp
deleted file mode 100644
index 21fff97418..0000000000
--- a/src/gui/embedded/qmouselinuxtp_qws.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouselinuxtp_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_LINUXTP
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qtimer.h"
-#include "qapplication.h"
-#include "qscreen_qws.h"
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-#if defined(QT_QWS_IPAQ)
- #define QT_QWS_IPAQ_RAW
- #define QT_QWS_SCREEN_COORDINATES
- typedef struct {
- unsigned short pressure;
- unsigned short x;
- unsigned short y;
- unsigned short pad;
- } TS_EVENT;
-#elif defined(QT_QWS_EBX)
- #define QT_QWS_EBX_RAW
- #define QT_QWS_SCREEN_COORDINATES
-#ifndef QT_QWS_SHARP
- typedef struct {
- unsigned short pressure;
- unsigned short x;
- unsigned short y;
- unsigned short pad;
- } TS_EVENT;
- #else
- typedef struct {
- long y;
- long x;
- long pressure;
- long long millisecs;
- } TS_EVENT;
- #define QT_QWS_TP_SAMPLE_SIZE 10
- #define QT_QWS_TP_MINIMUM_SAMPLES 4
- #define QT_QWS_TP_PRESSURE_THRESHOLD 500
- #define QT_QWS_TP_MOVE_LIMIT 50
- #define QT_QWS_TP_JITTER_LIMIT 2
- #endif
-#else // not IPAQ, not SHARP
- typedef struct {
- unsigned short pressure;
- unsigned short x;
- unsigned short y;
- unsigned short pad;
- } TS_EVENT;
-#endif
-
-#ifndef QT_QWS_TP_SAMPLE_SIZE
-#define QT_QWS_TP_SAMPLE_SIZE 5
-#endif
-
-#ifndef QT_QWS_TP_MINIMUM_SAMPLES
-#define QT_QWS_TP_MINIMUM_SAMPLES 5
-#endif
-
-#ifndef QT_QWS_TP_PRESSURE_THRESHOLD
-#define QT_QWS_TP_PRESSURE_THRESHOLD 1
-#endif
-
-#ifndef QT_QWS_TP_MOVE_LIMIT
-#define QT_QWS_TP_MOVE_LIMIT 100
-#endif
-
-#ifndef QT_QWS_TP_JITTER_LIMIT
-#define QT_QWS_TP_JITTER_LIMIT 2
-#endif
-
-class QWSLinuxTPMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHandler *h, const QString &);
- ~QWSLinuxTPMouseHandlerPrivate();
-
- void suspend();
- void resume();
-private:
- static const int mouseBufSize = 2048;
- int mouseFD;
- QPoint oldmouse;
- QPoint oldTotalMousePos;
- bool waspressed;
- QPolygon samples;
- int currSample;
- int lastSample;
- int numSamples;
- int skipCount;
- int mouseIdx;
- uchar mouseBuf[mouseBufSize];
- QWSLinuxTPMouseHandler *handler;
- QSocketNotifier *mouseNotifier;
-
-private slots:
- void readMouseData();
-};
-
-QWSLinuxTPMouseHandler::QWSLinuxTPMouseHandler(const QString &driver, const QString &device)
- : QWSCalibratedMouseHandler(driver, device)
-{
- d = new QWSLinuxTPMouseHandlerPrivate(this, device);
-}
-
-QWSLinuxTPMouseHandler::~QWSLinuxTPMouseHandler()
-{
- delete d;
-}
-
-void QWSLinuxTPMouseHandler::suspend()
-{
- d->suspend();
-}
-
-void QWSLinuxTPMouseHandler::resume()
-{
- d->resume();
-}
-
-QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHandler *h,
- const QString &device)
- : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0),
- numSamples(0), skipCount(0), handler(h)
-{
- QString mousedev;
- if (device.isEmpty()) {
-#if defined(QT_QWS_IPAQ)
-# ifdef QT_QWS_IPAQ_RAW
- mousedev = QLatin1String("/dev/h3600_tsraw");
-# else
- mousedev = QLatin1String("/dev/h3600_ts");
-# endif
-#else
- mousedev = QLatin1String("/dev/ts");
-#endif
- } else {
- mousedev = device;
- }
- if ((mouseFD = QT_OPEN(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
- qWarning("Cannot open %s (%s)", qPrintable(mousedev), strerror(errno));
- return;
- }
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read,
- this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
- waspressed=false;
- mouseIdx = 0;
-}
-
-QWSLinuxTPMouseHandlerPrivate::~QWSLinuxTPMouseHandlerPrivate()
-{
- if (mouseFD >= 0)
- QT_CLOSE(mouseFD);
-}
-
-void QWSLinuxTPMouseHandlerPrivate::suspend()
-{
- if (mouseNotifier)
- mouseNotifier->setEnabled(false);
-}
-
-void QWSLinuxTPMouseHandlerPrivate::resume()
-{
- mouseIdx=0;
- currSample=0;
- lastSample=0;
- numSamples=0;
- skipCount=0;
- if (mouseNotifier)
- mouseNotifier->setEnabled(true);
-}
-
-
-void QWSLinuxTPMouseHandlerPrivate::readMouseData()
-{
- if(!qt_screen)
- return;
-
- int n;
- do {
- n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
- if (n > 0)
- mouseIdx += n;
- } while (n > 0 && mouseIdx < mouseBufSize);
-
- //qDebug("readMouseData()");
-
- TS_EVENT *data;
- int idx = 0;
-
- // perhaps we shouldn't be reading EVERY SAMPLE.
- while (mouseIdx-idx >= (int)sizeof(TS_EVENT)) {
- uchar *mb = mouseBuf+idx;
- data = (TS_EVENT *) mb;
-
- if(data->pressure >= QT_QWS_TP_PRESSURE_THRESHOLD) {
-#ifdef QT_QWS_SHARP
- samples[currSample] = QPoint(1000 - data->x, data->y);
-#else
- samples[currSample] = QPoint(data->x, data->y);
-#endif
- numSamples++;
- if (numSamples >= QT_QWS_TP_MINIMUM_SAMPLES) {
- int sampleCount = qMin(numSamples + 1,samples.count());
-
- // average the rest
- QPoint mousePos = QPoint(0, 0);
- QPoint totalMousePos = oldTotalMousePos;
- totalMousePos += samples[currSample];
- if(numSamples >= samples.count())
- totalMousePos -= samples[lastSample];
-
- mousePos = totalMousePos / (sampleCount - 1);
-#if defined(QT_QWS_SCREEN_COORDINATES)
- mousePos = handler->transform(mousePos);
-#endif
- if(!waspressed)
- oldmouse = mousePos;
- QPoint dp = mousePos - oldmouse;
- int dxSqr = dp.x() * dp.x();
- int dySqr = dp.y() * dp.y();
- if (dxSqr + dySqr < (QT_QWS_TP_MOVE_LIMIT * QT_QWS_TP_MOVE_LIMIT)) {
- if (waspressed) {
- if ((dxSqr + dySqr > (QT_QWS_TP_JITTER_LIMIT * QT_QWS_TP_JITTER_LIMIT)) || skipCount > 2) {
- handler->mouseChanged(mousePos,Qt::LeftButton);
- oldmouse = mousePos;
- skipCount = 0;
- } else {
- skipCount++;
- }
- } else {
- handler->mouseChanged(mousePos,Qt::LeftButton);
- oldmouse=mousePos;
- waspressed=true;
- }
-
- // save recuring information
- currSample++;
- if (numSamples >= samples.count())
- lastSample++;
- oldTotalMousePos = totalMousePos;
- } else {
- numSamples--; // don't use this sample, it was bad.
- }
- } else {
- // build up the average
- oldTotalMousePos += samples[currSample];
- currSample++;
- }
- if (currSample >= samples.count())
- currSample = 0;
- if (lastSample >= samples.count())
- lastSample = 0;
- } else {
- currSample = 0;
- lastSample = 0;
- numSamples = 0;
- skipCount = 0;
- oldTotalMousePos = QPoint(0,0);
- if (waspressed) {
- handler->mouseChanged(oldmouse,0);
- oldmouse = QPoint(-100, -100);
- waspressed=false;
- }
- }
- idx += sizeof(TS_EVENT);
- }
-
- int surplus = mouseIdx - idx;
- for (int i = 0; i < surplus; i++)
- mouseBuf[i] = mouseBuf[idx+i];
- mouseIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#include "qmouselinuxtp_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_LINUXTP
diff --git a/src/gui/embedded/qmouselinuxtp_qws.h b/src/gui/embedded/qmouselinuxtp_qws.h
deleted file mode 100644
index 1974ad0e89..0000000000
--- a/src/gui/embedded/qmouselinuxtp_qws.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSELINUXTP_QWS_H
-#define QMOUSELINUXTP_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_LINUXTP
-
-class QWSLinuxTPMouseHandlerPrivate;
-
-class QWSLinuxTPMouseHandler : public QWSCalibratedMouseHandler
-{
- friend class QWSLinuxTPMouseHandlerPrivate;
-public:
- explicit QWSLinuxTPMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSLinuxTPMouseHandler();
-
- void suspend();
- void resume();
-protected:
- QWSLinuxTPMouseHandlerPrivate *d;
-};
-
-#endif // QT_NO_QWS_MOUSE_LINUXTP
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSELINUXTP_QWS_H
diff --git a/src/gui/embedded/qmousepc_qws.cpp b/src/gui/embedded/qmousepc_qws.cpp
deleted file mode 100644
index e3f85cbc77..0000000000
--- a/src/gui/embedded/qmousepc_qws.cpp
+++ /dev/null
@@ -1,794 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousepc_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_PC
-
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qwsevent_qws.h"
-#include "qwscommand_qws_p.h"
-#include "qwsutils_qws.h"
-
-#include "qapplication.h"
-#include "qpolygon.h"
-#include "qtimer.h"
-#include "qfile.h"
-#include "qtextstream.h"
-#include "qstringlist.h"
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-#include <qscreen_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-//#define QWS_MOUSE_DEBUG
-
-/*
- * Automatic-detection mouse driver
- */
-
-class QWSPcMouseSubHandler {
-protected:
- enum { max_buf=32 };
-
- int fd;
-
- uchar buffer[max_buf];
- int nbuf;
-
- QPoint motion;
- int bstate;
- int wheel;
-
- int goodness;
- int badness;
-
- virtual int tryData()=0;
-
-public:
- QWSPcMouseSubHandler(int f) : fd(f)
- {
- initState();
- }
- virtual ~QWSPcMouseSubHandler() {}
-
- int file() const { return fd; }
-
- void closeIfNot(int& f)
- {
- if (fd != f) {
- f = fd;
- QT_CLOSE(fd);
- }
- }
-
- void initState() { nbuf = bstate = goodness = badness = 0; }
-
- void worse(int by=1) { badness+=by; }
- bool reliable() const { return goodness >= 5 && badness < 50; }
- int buttonState() const { return bstate; }
- bool motionPending() const { return motion!=QPoint(0,0); }
- QPoint takeMotion() { QPoint r=motion; motion=QPoint(0,0); return r; }
- int takeWheel() { int result = wheel; wheel = 0; return result; }
-
- void appendData(uchar* data, int length)
- {
- memcpy(buffer+nbuf, data, length);
- nbuf += length;
- }
-
- enum UsageResult { Insufficient, Motion, Button };
-
- UsageResult useData()
- {
- int pbstate = bstate;
- int n = tryData();
-#ifdef QWS_MOUSE_DEBUG
- if (n) {
- fprintf(stderr, "QWSPcMouseSubHandler tryData read %d bytes:", n);
- for (int i=0; i<n; ++i)
- fprintf(stderr, " %02x", buffer[i]);
- fprintf(stderr, "\n");
- }
-#endif
- if (n > 0) {
- if (n<nbuf)
- memmove(buffer, buffer+n, nbuf-n);
- nbuf -= n;
- return (wheel || pbstate != bstate) ? Button : Motion;
- }
- return Insufficient;
- }
-};
-
-class QWSPcMouseSubHandler_intellimouse : public QWSPcMouseSubHandler {
- int packetsize;
-public:
- QWSPcMouseSubHandler_intellimouse(int f) : QWSPcMouseSubHandler(f)
- {
- init();
- }
-
- void init()
- {
- int n;
- uchar reply[20];
-
- if (tcflush(fd,TCIOFLUSH) == -1) {
-#ifdef QWS_MOUSE_DEBUG
- perror("QWSPcMouseSubHandler_intellimouse: pre-init tcflush");
-#endif
- }
- static const uchar initseq[] = { 243, 200, 243, 100, 243, 80 };
- static const uchar query[] = { 0xf2 };
- if (QT_WRITE(fd, initseq, sizeof(initseq))!=sizeof(initseq)) {
- badness = 100;
- return;
- }
- usleep(10000);
- if (tcflush(fd,TCIOFLUSH) == -1) {
-#ifdef QWS_MOUSE_DEBUG
- perror("QWSPcMouseSubHandler_intellimouse: post-init tcflush");
-#endif
- }
- if (QT_WRITE(fd, query, sizeof(query))!=sizeof(query)) {
- badness = 100;
- return;
- }
- usleep(10000);
- n = QT_READ(fd, reply, 20);
- if (n > 0) {
- goodness = 10;
- switch (reply[n-1]) {
- case 3:
- case 4:
- packetsize = 4;
- break;
- default:
- packetsize = 3;
- }
- } else {
- badness = 100;
- }
- }
-
- int tryData()
- {
- if (nbuf >= packetsize) {
- //int overflow = (buffer[0]>>6)& 0x03;
-
- if (/*overflow ||*/ !(buffer[0] & 8)) {
-#ifdef QWS_MOUSE_DEBUG
- qDebug("Intellimouse: skipping (overflow)");
-#endif
- badness++;
- return 1;
- } else {
- QPoint delta((buffer[0] & 0x10) ? buffer[1]-256 : buffer[1],
- (buffer[0] & 0x20) ? 256-buffer[2] : -buffer[2]);
- motion += delta;
- int nbstate = buffer[0] & 0x7;
-#ifdef QWS_MOUSE_DEBUG
- int debugwheel =
-#endif
- wheel = packetsize > 3 ? -(signed char)buffer[3] : 0;
- if (wheel < -2 || wheel > 2)
- wheel = 0;
- wheel *= 120; // WHEEL_DELTA?
-#ifdef QWS_MOUSE_DEBUG
- qDebug("Intellimouse: motion %d,%d, state %d, raw wheel %d, wheel %d", motion.x(), motion.y(), nbstate, debugwheel, wheel);
-#endif
- if (motion.x() || motion.y() || bstate != nbstate || wheel) {
- bstate = nbstate;
- goodness++;
- } else {
- badness++;
- return 1;
- }
- }
- return packetsize;
- }
- return 0;
- }
-};
-
-class QWSPcMouseSubHandler_mouseman : public QWSPcMouseSubHandler {
- int packetsize;
-public:
- QWSPcMouseSubHandler_mouseman(int f) : QWSPcMouseSubHandler(f)
- {
- init();
- }
-
- void init()
- {
- if (tcflush(fd,TCIOFLUSH) == -1) {
-#ifdef QWS_MOUSE_DEBUG
- perror("QWSPcMouseSubHandler_mouseman: initial tcflush");
-#endif
- }
- QT_WRITE(fd,"",1);
- usleep(50000);
- QT_WRITE(fd,"@EeI!",5);
- usleep(10000);
- static const char ibuf[] = { 246, 244 };
- QT_WRITE(fd,ibuf,1);
- QT_WRITE(fd,ibuf+1,1);
- if (tcflush(fd,TCIOFLUSH) == -1) {
-#ifdef QWS_MOUSE_DEBUG
- perror("QWSPcMouseSubHandler_mouseman: tcflush");
-#endif
- }
- usleep(10000);
-
- char buf[100];
- while (QT_READ(fd, buf, 100) > 0) { } // eat unwanted replies
- }
-
- int tryData()
- {
- if (nbuf >= 3) {
- int nbstate = 0;
- if (buffer[0] & 0x01)
- nbstate |= Qt::LeftButton;
- if (buffer[0] & 0x02)
- nbstate |= Qt::RightButton;
- if (buffer[0] & 0x04)
- nbstate |= Qt::MidButton;
-
- int overflow = (buffer[0]>>6)& 0x03;
- if (overflow) {
- //### wheel events signalled with overflow bit, ignore for now
- badness++;
- return 1;
- } else {
- bool xs = buffer[0] & 0x10;
- bool ys = buffer[0] & 0x20;
- int dx = xs ? buffer[1]-256 : buffer[1];
- int dy = ys ? buffer[2]-256 : buffer[2];
-
- motion += QPoint(dx, -dy);
- if (motion.x() || motion.y() || bstate != nbstate) {
- bstate = nbstate;
- goodness++;
- } else {
- badness++;
- return 1;
- }
- }
- return 3;
- }
- return 0;
- }
-};
-
-class QWSPcMouseSubHandler_serial : public QWSPcMouseSubHandler {
-public:
- QWSPcMouseSubHandler_serial(int f) : QWSPcMouseSubHandler(f)
- {
- initSerial();
- }
-
-protected:
- void setflags(int f)
- {
- termios tty;
- if (tcgetattr(fd, &tty) == -1) {
-#ifdef QWS_MOUSE_DEBUG
- perror("QWSPcMouseSubHandler_serial: tcgetattr");
-#endif
- }
- tty.c_iflag = IGNBRK | IGNPAR;
- tty.c_oflag = 0;
- tty.c_lflag = 0;
- tty.c_cflag = f | CREAD | CLOCAL | HUPCL;
-#ifdef Q_OS_LINUX
- tty.c_line = 0;
-#endif
- tty.c_cc[VTIME] = 0;
- tty.c_cc[VMIN] = 1;
- if (tcsetattr(fd, TCSANOW, &tty) == -1) {
-#ifdef QWS_MOUSE_DEBUG
- perror("QWSPcMouseSubHandler_serial: tcgetattr");
-#endif
- }
- }
-
-private:
- void initSerial()
- {
- int speed[4] = { B9600, B4800, B2400, B1200 };
-
- for (int n = 0; n < 4; n++) {
- setflags(CSTOPB | speed[n]);
- QT_WRITE(fd, "*q", 2);
- usleep(10000);
- }
- }
-};
-
-class QWSPcMouseSubHandler_mousesystems : public QWSPcMouseSubHandler_serial {
-public:
- // ##### This driver has not been tested
-
- QWSPcMouseSubHandler_mousesystems(int f) : QWSPcMouseSubHandler_serial(f)
- {
- init();
- }
-
- void init()
- {
- setflags(B1200|CS8|CSTOPB);
- // 60Hz
- if (QT_WRITE(fd, "R", 1)!=1) {
- badness = 100;
- return;
- }
- if (tcflush(fd,TCIOFLUSH) == -1) {
-#ifdef QT_QWS_VNC_DEBUG
- perror("QWSPcMouseSubHandler_mousesystems: tcflush");
-#endif
- }
- }
-
- int tryData()
- {
- if (nbuf >= 5) {
- if ((buffer[0] & 0xf8) != 0x80) {
- badness++;
- return 1;
- }
- motion +=
- QPoint((signed char)buffer[1] + (signed char)buffer[3],
- -(signed char)buffer[2] + (signed char)buffer[4]);
- int t = ~buffer[0];
- int nbstate = ((t&3) << 1) | ((t&4) >> 2);
- if (motion.x() || motion.y() || bstate != nbstate) {
- bstate = nbstate;
- goodness++;
- } else {
- badness++;
- return 1;
- }
- return 5;
- }
- return 0;
- }
-};
-
-class QWSPcMouseSubHandler_ms : public QWSPcMouseSubHandler_serial {
- int mman;
-public:
- QWSPcMouseSubHandler_ms(int f) : QWSPcMouseSubHandler_serial(f)
- {
- mman=0;
- init();
- }
-
- void init()
- {
- setflags(B1200|CS7);
- // 60Hz
- if (QT_WRITE(fd, "R", 1)!=1) {
- badness = 100;
- return;
- }
- if (tcflush(fd,TCIOFLUSH) == -1) {
-#ifdef QWS_MOUSE_DEBUG
- perror("QWSPcMouseSubHandler_ms: tcflush");
-#endif
- }
- }
-
- int tryData()
- {
- if (!(buffer[0] & 0x40)) {
- if (buffer[0] == 0x20 && (bstate & Qt::MidButton)) {
- mman=1; // mouseman extension
- }
- return 1;
- }
- int extra = mman&&(bstate & Qt::MidButton);
- if (nbuf >= 3+extra) {
- int nbstate = 0;
- if (buffer[0] == 0x40 && !bstate && !buffer[1] && !buffer[2]) {
- nbstate = Qt::MidButton;
- } else {
- nbstate = ((buffer[0] & 0x20) >> 5)
- | ((buffer[0] & 0x10) >> 3);
- if (extra && buffer[3] == 0x20)
- nbstate = Qt::MidButton;
- }
-
- if (buffer[1] & 0x40) {
- badness++;
- return 1;
- } else {
- motion +=
- QPoint((signed char)((buffer[0]&0x3)<<6)
- |(signed char)(buffer[1]&0x3f),
- (signed char)((buffer[0]&0xc)<<4)
- |(signed char)(buffer[2]&0x3f));
- if (motion.x() || motion.y() || bstate != nbstate) {
- bstate = nbstate;
- goodness++;
- } else {
- badness++;
- return 1;
- }
- return 3+extra;
- }
- }
- return 0;
- }
-};
-
-//===========================================================================
-
-class QWSPcMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSPcMouseHandlerPrivate(QWSPcMouseHandler *h, const QString &, const QString &);
- ~QWSPcMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
-private:
- enum { max_dev=32 };
- QWSPcMouseSubHandler *sub[max_dev];
- QList<QSocketNotifier*> notifiers;
- int nsub;
- int retries;
-
-private slots:
- void readMouseData(int);
-
-private:
- void openDevices();
- void closeDevices();
- void notify(int fd);
- bool sendEvent(QWSPcMouseSubHandler& h);
-
-private:
- QWSPcMouseHandler *handler;
- QString driver;
- QString device;
- qreal accel;
- int accel_limit;
-};
-
-QWSPcMouseHandler::QWSPcMouseHandler(const QString &driver, const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QWSPcMouseHandlerPrivate(this, driver, device);
-}
-
-QWSPcMouseHandler::~QWSPcMouseHandler()
-{
- delete d;
-}
-
-void QWSPcMouseHandler::suspend()
-{
- d->suspend();
-}
-
-void QWSPcMouseHandler::resume()
-{
- d->resume();
-}
-
-
-QWSPcMouseHandlerPrivate::QWSPcMouseHandlerPrivate(QWSPcMouseHandler *h,
- const QString &drv, const QString &arg)
- : handler(h), driver(drv)
-{
- QStringList args = arg.split(QLatin1Char(':'), QString::SkipEmptyParts);
-
- int index;
-
- accel = qreal(2.0);
- QRegExp accelRegex(QLatin1String("^accel=(\\d+\\.?\\d*)$"));
- index = args.indexOf(accelRegex);
- if (index >= 0) {
- accel = qreal(accelRegex.cap(1).toDouble());
- args.removeAt(index);
- }
-
- accel_limit = 5;
- QRegExp accelLimitRegex(QLatin1String("^accel_limit=(\\d+)$"));
- index = args.indexOf(accelLimitRegex);
- if (index >= 0) {
- accel_limit = accelLimitRegex.cap(1).toInt();
- args.removeAt(index);
- }
-
- device = args.join(QString());
-
- retries = 0;
- openDevices();
-}
-
-QWSPcMouseHandlerPrivate::~QWSPcMouseHandlerPrivate()
-{
- closeDevices();
-}
-
-/*
-QWSPcMouseHandler::UsageResult QWSPcMouseHandler::useDev(Dev& d)
-{
- if (d.nbuf >= mouseData[d.protocol].bytesPerPacket) {
- uchar *mb = d.buf;
- int bstate = 0;
- int dx = 0;
- int dy = 0;
-
- switch (mouseProtocol) {
- case MouseMan:
- case IntelliMouse:
- {
- bstate = mb[0] & 0x7; // assuming Qt::*Button order
-
- int overflow = (mb[0]>>6)& 0x03;
- if (mouseProtocol == MouseMan && overflow) {
- //### wheel events signalled with overflow bit, ignore for now
- }
- else {
- bool xs = mb[0] & 0x10;
- bool ys = mb[0] & 0x20;
- dx = xs ? mb[1]-256 : mb[1];
- dy = ys ? mb[2]-256 : mb[2];
- }
- break;
- }
- case Microsoft:
- if (((mb[0] & 0x20) >> 3)) {
- bstate |= Qt::LeftButton;
- }
- if (((mb[0] & 0x10) >> 4)) {
- bstate |= Qt::RightButton;
- }
-
- dx=(signed char)(((mb[0] & 0x03) << 6) | (mb[1] & 0x3f));
- dy=-(signed char)(((mb[0] & 0x0c) << 4) | (mb[2] & 0x3f));
-
- break;
- }
- }
- }
-*/
-
-
-bool QWSPcMouseHandlerPrivate::sendEvent(QWSPcMouseSubHandler& h)
-{
- if (h.reliable()) {
- QPoint motion = h.takeMotion();
- if (qAbs(motion.x()) > accel_limit || qAbs(motion.y()) > accel_limit)
- motion *= accel;
- QPoint newPos = handler->pos() + motion;
- if (qt_screen->isTransformed()) {
- QSize s = QSize(qt_screen->width(), qt_screen->height());
- newPos = qt_screen->mapToDevice(newPos, s);
- }
- handler->limitToScreen(newPos);
-
- handler->mouseChanged(newPos, h.buttonState(), h.takeWheel());
- return true;
- } else {
- h.takeMotion();
- if (h.buttonState() & (Qt::RightButton|Qt::MidButton)) {
- // Strange for the user to press right or middle without
- // a moving mouse!
- h.worse();
- }
- return false;
- }
-}
-
-void QWSPcMouseHandlerPrivate::openDevices()
-{
- nsub=0;
- int fd = -1;
-
- QString drv = driver.toLower();
- if (!drv.isEmpty() && drv != QLatin1String("auto")) {
- // Manually specified mouse
- QByteArray dev = device.toLatin1();
- if (drv == QLatin1String("intellimouse")) {
- if (dev.isEmpty())
- dev = "/dev/psaux";
- fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
- if (fd >= 0)
- sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
- } else if (drv == QLatin1String("microsoft")) {
- if (dev.isEmpty())
- dev = "/dev/ttyS0";
- fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
- if (fd >= 0)
- sub[nsub++] = new QWSPcMouseSubHandler_ms(fd);
- } else if (drv == QLatin1String("mousesystems")) {
- if (dev.isEmpty())
- dev = "/dev/ttyS0";
- fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
- if (fd >= 0)
- sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd);
- } else if (drv == QLatin1String("mouseman")) {
- if (dev.isEmpty())
- dev = "/dev/psaux";
- fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
- if (fd >= 0)
- sub[nsub++] = new QWSPcMouseSubHandler_mouseman(fd);
- }
- if (fd >= 0)
- notify(fd);
- else
- qCritical("Error opening mouse device '%s': %s",
- dev.constData(), strerror(errno));
- } else {
- // Try automatically
- fd = QT_OPEN("/dev/psaux", O_RDWR | O_NDELAY);
- if (fd >= 0) {
- sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
- notify(fd);
- }
- fd = QT_OPEN("/dev/input/mice", O_RDWR | O_NDELAY);
- if (fd >= 0) {
- sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
- notify(fd);
- //qDebug("/dev/input/mice fd %d #%d", fd, nsub-1);
- }
-
-// include the code below to auto-detect serial mice, and to mess up
-// any sort of serial communication
-#if 0
- const char fn[4][11] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3" };
- for (int ch = 0; ch < 4; ++ch) {
- fd = QT_OPEN(fn[ch], O_RDWR | O_NDELAY);
- if (fd >= 0) {
- //sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
- sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd);
- sub[nsub++] = new QWSPcMouseSubHandler_ms(fd);
- notify(fd);
- }
- }
-#endif
- }
-}
-
-void QWSPcMouseHandlerPrivate::closeDevices()
-{
- int pfd=-1;
- for (int i=0; i<nsub; i++) {
- sub[i]->closeIfNot(pfd);
- delete sub[i];
- }
- qDeleteAll(notifiers);
- notifiers.clear();
-}
-
-void QWSPcMouseHandlerPrivate::suspend()
-{
- for (int i=0; i<notifiers.size(); ++i)
- notifiers.at(i)->setEnabled(false);
-}
-
-void QWSPcMouseHandlerPrivate::resume()
-{
- for (int i=0; i<nsub; i++)
- sub[i]->initState();
-
- for (int i=0; i<notifiers.size(); ++i)
- notifiers.at(i)->setEnabled(true);
-}
-
-
-
-void QWSPcMouseHandlerPrivate::notify(int fd)
-{
- QSocketNotifier *mouseNotifier
- = new QSocketNotifier(fd, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData(int)));
- notifiers.append(mouseNotifier);
-}
-
-void QWSPcMouseHandlerPrivate::readMouseData(int fd)
-{
- for (;;) {
- uchar buf[8];
- int n = read(fd, buf, 8);
- if (n<=0)
- break;
- for (int i=0; i<nsub; i++) {
- QWSPcMouseSubHandler& h = *sub[i];
- if (h.file() == fd) {
- h.appendData(buf,n);
- for (;;) {
- switch (h.useData()) {
- case QWSPcMouseSubHandler::Button:
- sendEvent(h);
- break;
- case QWSPcMouseSubHandler::Insufficient:
- goto breakbreak;
- case QWSPcMouseSubHandler::Motion:
- break;
- }
- }
- breakbreak:
- ;
- }
- }
- }
- bool any_reliable=false;
- for (int i=0; i<nsub; i++) {
- QWSPcMouseSubHandler& h = *sub[i];
- if (h.motionPending())
- sendEvent(h);
- any_reliable = any_reliable || h.reliable();
- }
- if (any_reliable) {
- // ... get rid of all unreliable ones? All bad ones?
- } else if (retries < 2) {
- // Try again - maybe the mouse was being moved when we tried to init.
- closeDevices();
- openDevices();
- retries++;
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qmousepc_qws.moc"
-
-#endif // QT_NO_MOUSE_PC
diff --git a/src/gui/embedded/qmousepc_qws.h b/src/gui/embedded/qmousepc_qws.h
deleted file mode 100644
index 339418cdb8..0000000000
--- a/src/gui/embedded/qmousepc_qws.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEPC_QWS_H
-#define QMOUSEPC_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_PC
-
-class QWSPcMouseHandlerPrivate;
-
-class QWSPcMouseHandler : public QWSMouseHandler
-{
-public:
- explicit QWSPcMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSPcMouseHandler();
-
- void suspend();
- void resume();
-protected:
- QWSPcMouseHandlerPrivate *d;
-};
-
-#endif // QT_NO_QWS_MOUSE_PC
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEPC_QWS_H
diff --git a/src/gui/embedded/qmouseqnx_qws.cpp b/src/gui/embedded/qmouseqnx_qws.cpp
deleted file mode 100644
index cea3673d70..0000000000
--- a/src/gui/embedded/qmouseqnx_qws.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-#include "qmouseqnx_qws.h"
-
-#include "qsocketnotifier.h"
-#include "qdebug.h"
-
-#include <sys/dcmd_input.h>
-
-#include <errno.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QQnxMouseHandler
- \preliminary
- \ingroup qws
- \internal
- \since 4.6
-
- \brief The QQnxMouseHandler class implements a mouse driver
- for the QNX \c{devi-hid} input manager.
-
- To be able to compile this mouse handler, \l{Qt for Embedded Linux}
- must be configured with the \c -qt-mouse-qnx option, see the
- \l{Qt for Embedded Linux Pointer Handling}{Pointer Handling} documentation for details.
-
- In order to use this mouse handler, the \c{devi-hid} input manager
- must be set up and run with the resource manager interface (option \c{-r}).
- Also, Photon must not be running.
-
- Example invocation from command line: \c{/usr/photon/bin/devi-hid -Pr kbd mouse}
- Note that after running \c{devi-hid}, you will not be able to use the local
- shell anymore. It is suggested to run the command in a shell scrip, that launches
- a Qt application after invocation of \c{devi-hid}.
-
- To make \l{Qt for Embedded Linux} explicitly choose the qnx mouse
- handler, set the QWS_MOUSE_PROTO environment variable to \c{qnx}. By default,
- the first mouse device (\c{/dev/devi/mouse0}) is used. To override, pass a device
- name as the first and only parameter, for example
- \c{QWS_MOUSE_PROTO=qnx:/dev/devi/mouse1; export QWS_MOUSE_PROTO}.
-
- \sa {Qt for Embedded Linux Pointer Handling}{Pointer Handling}, {Qt for Embedded Linux}
-*/
-
-/*!
- Constructs a mouse handler for the specified \a device, defaulting to \c{/dev/devi/mouse0}.
- The \a driver parameter must be \c{"qnx"}.
-
- Note that you should never instanciate this class, instead let QMouseDriverFactory
- handle the mouse handlers.
-
- \sa QMouseDriverFactory
- */
-QQnxMouseHandler::QQnxMouseHandler(const QString & /*driver*/, const QString &device)
-{
- // open the mouse device with O_NONBLOCK so reading won't block when there's no data
- mouseFD = QT_OPEN(device.isEmpty() ? "/dev/devi/mouse0" : device.toLatin1().constData(),
- QT_OPEN_RDONLY | O_NONBLOCK);
- if (mouseFD == -1) {
- qErrnoWarning(errno, "QQnxMouseHandler: Unable to open mouse device");
- return;
- }
-
- // register a socket notifier on the file descriptor so we'll wake up whenever
- // there's a mouse move waiting for us.
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)), SLOT(socketActivated()));
-
- qDebug() << "QQnxMouseHandler: connected.";
-}
-
-/*!
- Destroys this mouse handler and closes the connection to the mouse device.
- */
-QQnxMouseHandler::~QQnxMouseHandler()
-{
- QT_CLOSE(mouseFD);
-}
-
-/*! \reimp */
-void QQnxMouseHandler::resume()
-{
- if (mouseNotifier)
- mouseNotifier->setEnabled(true);
-}
-
-/*! \reimp */
-void QQnxMouseHandler::suspend()
-{
- if (mouseNotifier)
- mouseNotifier->setEnabled(false);
-}
-
-/*! \internal
-
- This function is called whenever there is activity on the mouse device.
- By default, it reads up to 10 mouse move packets and calls mouseChanged()
- for each of them.
-*/
-void QQnxMouseHandler::socketActivated()
-{
- // _mouse_packet is a QNX structure. devi-hid is nice enough to translate
- // the raw byte data from mouse devices into generic format for us.
- _mouse_packet packet;
-
- int iteration = 0;
-
- // read mouse events in batches of 10. Since we're getting quite a lot
- // of mouse events, it's better to do them in batches than to return to the
- // event loop every time.
- do {
- int bytesRead = QT_READ(mouseFD, &packet, sizeof(packet));
- if (bytesRead == -1) {
- // EAGAIN means that there are no more mouse events to read
- if (errno != EAGAIN)
- qErrnoWarning(errno, "QQnxMouseHandler: Unable to read from socket");
- return;
- }
-
- // bytes read should always be equal to the size of a packet.
- Q_ASSERT(bytesRead == sizeof(packet));
-
- // translate the coordinates from the QNX data structure to Qt coordinates
- // note the swapped y axis
- QPoint pos = mousePos;
- pos += QPoint(packet.dx, -packet.dy);
-
- // QNX only tells us relative mouse movements, not absolute ones, so limit the
- // cursor position manually to the screen
- limitToScreen(pos);
-
- // translate the QNX mouse button bitmask to Qt buttons
- int buttons = Qt::NoButton;
-
- if (packet.hdr.buttons & _POINTER_BUTTON_LEFT)
- buttons |= Qt::LeftButton;
- if (packet.hdr.buttons & _POINTER_BUTTON_MIDDLE)
- buttons |= Qt::MidButton;
- if (packet.hdr.buttons & _POINTER_BUTTON_RIGHT)
- buttons |= Qt::RightButton;
-
- // call mouseChanged() - this does all the magic to actually move the on-screen
- // mouse cursor.
- mouseChanged(pos, buttons, 0);
- } while (++iteration < 11);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/gui/embedded/qmouseqnx_qws.h b/src/gui/embedded/qmouseqnx_qws.h
deleted file mode 100644
index 0779367600..0000000000
--- a/src/gui/embedded/qmouseqnx_qws.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSE_QNX_H
-#define QMOUSE_QNX_H
-
-#include <QtCore/qobject.h>
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QSocketNotifier;
-
-class Q_GUI_EXPORT QQnxMouseHandler : public QObject, public QWSMouseHandler
-{
- Q_OBJECT
-public:
- explicit QQnxMouseHandler(const QString &driver = QString(),
- const QString &device = QString());
- ~QQnxMouseHandler();
-
- void resume();
- void suspend();
-
-private Q_SLOTS:
- void socketActivated();
-
-private:
- QSocketNotifier *mouseNotifier;
- int mouseFD;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSE_QWS_H
diff --git a/src/gui/embedded/qmousetslib_qws.cpp b/src/gui/embedded/qmousetslib_qws.cpp
deleted file mode 100644
index 8794eed2f2..0000000000
--- a/src/gui/embedded/qmousetslib_qws.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousetslib_qws.h"
-
-#if !defined(QT_NO_QWS_MOUSE_TSLIB) || defined(QT_PLUGIN)
-
-#include <QtCore/qregexp.h>
-#include <QtCore/qstringlist.h>
-#include "qsocketnotifier.h"
-#include "qscreen_qws.h"
-
-#include <tslib.h>
-#include <errno.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef TSLIBMOUSEHANDLER_DEBUG
-# include <QtCore/QDebug>
-#endif
-
-/*!
- \internal
-
- \class QWSTslibMouseHandler
- \ingroup qws
-
- \brief The QWSTslibMouseHandler class implements a mouse driver
- for the Universal Touch Screen Library, tslib.
-
- QWSTslibMouseHandler inherits the QWSCalibratedMouseHandler class,
- providing calibration and noise reduction functionality in
- addition to generating mouse events, for devices using the
- Universal Touch Screen Library.
-
- To be able to compile this mouse handler, \l{Qt for Embedded Linux}
- must be configured with the \c -qt-mouse-tslib option, see the
- \l{Pointer Handling} documentation for details. In addition, the tslib
- headers and library must be present in the build environment. The
- tslib sources can be downloaded from \l
- {http://tslib.berlios.de/}. Use the \c -L and \c -I options
- with \c configure to explicitly specify the location of the
- library and its headers:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qmousetslib_qws.cpp 0
-
- In order to use this mouse handler, tslib must also be correctly
- installed on the target machine. This includes providing a \c
- ts.conf configuration file and setting the necessary environment
- variables, see the README file provided with tslib for details.
-
- The ts.conf file will usually contain the following two lines
-
- \snippet doc/src/snippets/code/src_gui_embedded_qmousetslib_qws.cpp 1
-
- To make \l{Qt for Embedded Linux} explicitly choose the tslib mouse
- handler, set the QWS_MOUSE_PROTO environment variable.
-
- \sa {Pointer Handling}, {Qt for Embedded Linux}
-*/
-
-class QWSTslibMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSTslibMouseHandlerPrivate(QWSTslibMouseHandler *h,
- const QString &device);
- ~QWSTslibMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
- void calibrate(const QWSPointerCalibrationData *data);
- void clearCalibration();
-
-private:
- QWSTslibMouseHandler *handler;
- struct tsdev *dev;
- QSocketNotifier *mouseNotifier;
- int jitter_limit;
-
- struct ts_sample lastSample;
- bool wasPressed;
- int lastdx;
- int lastdy;
-
- bool calibrated;
- QString devName;
-
- bool open();
- void close();
- inline bool get_sample(struct ts_sample *sample);
-
-private slots:
- void readMouseData();
-};
-
-QWSTslibMouseHandlerPrivate::QWSTslibMouseHandlerPrivate(QWSTslibMouseHandler *h,
- const QString &device)
- : handler(h), dev(0), mouseNotifier(0), jitter_limit(3)
-{
- QStringList args = device.split(QLatin1Char(':'), QString::SkipEmptyParts);
- QRegExp jitterRegex(QLatin1String("^jitter_limit=(\\d+)$"));
- int index = args.indexOf(jitterRegex);
- if (index >= 0) {
- jitter_limit = jitterRegex.cap(1).toInt();
- args.removeAt(index);
- }
-
- devName = args.join(QString());
-
- if (devName.isNull()) {
- const char *str = getenv("TSLIB_TSDEVICE");
- if (str)
- devName = QString::fromLocal8Bit(str);
- }
-
- if (devName.isNull())
- devName = QLatin1String("/dev/ts");
-
- if (!open())
- return;
-
- calibrated = true;
-
- int fd = ts_fd(dev);
- mouseNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
- resume();
-}
-
-QWSTslibMouseHandlerPrivate::~QWSTslibMouseHandlerPrivate()
-{
- close();
-}
-
-bool QWSTslibMouseHandlerPrivate::open()
-{
- dev = ts_open(devName.toLocal8Bit().constData(), 1);
- if (!dev) {
- qCritical("QWSTslibMouseHandlerPrivate: ts_open() failed"
- " with error: '%s'", strerror(errno));
- qCritical("Please check your tslib installation!");
- return false;
- }
-
- if (ts_config(dev)) {
- qCritical("QWSTslibMouseHandlerPrivate: ts_config() failed"
- " with error: '%s'", strerror(errno));
- qCritical("Please check your tslib installation!");
- close();
- return false;
- }
-
- return true;
-}
-
-void QWSTslibMouseHandlerPrivate::close()
-{
- if (dev)
- ts_close(dev);
-}
-
-void QWSTslibMouseHandlerPrivate::suspend()
-{
- if (mouseNotifier)
- mouseNotifier->setEnabled(false);
-}
-
-void QWSTslibMouseHandlerPrivate::resume()
-{
- memset(&lastSample, 0, sizeof(lastSample));
- wasPressed = false;
- lastdx = 0;
- lastdy = 0;
- if (mouseNotifier)
- mouseNotifier->setEnabled(true);
-}
-
-bool QWSTslibMouseHandlerPrivate::get_sample(struct ts_sample *sample)
-{
- if (!calibrated)
- return (ts_read_raw(dev, sample, 1) == 1);
-
- return (ts_read(dev, sample, 1) == 1);
-}
-
-void QWSTslibMouseHandlerPrivate::readMouseData()
-{
- if (!qt_screen)
- return;
-
- for(;;) {
- struct ts_sample sample = lastSample;
- bool pressed = wasPressed;
-
- // Fast return if there's no events.
- if (!get_sample(&sample))
- return;
- pressed = (sample.pressure > 0);
-
- // Only return last sample unless there's a press/release event.
- while (pressed == wasPressed) {
- if (!get_sample(&sample))
- break;
- pressed = (sample.pressure > 0);
- }
-
- // work around missing coordinates on mouse release in raw mode
- if (!calibrated && !pressed && sample.x == 0 && sample.y == 0) {
- sample.x = lastSample.x;
- sample.y = lastSample.y;
- }
-
- int dx = sample.x - lastSample.x;
- int dy = sample.y - lastSample.y;
-
- // Remove small movements in oppsite direction
- if (dx * lastdx < 0 && qAbs(dx) < jitter_limit) {
- sample.x = lastSample.x;
- dx = 0;
- }
- if (dy * lastdy < 0 && qAbs(dy) < jitter_limit) {
- sample.y = lastSample.y;
- dy = 0;
- }
-
- if (wasPressed == pressed && dx == 0 && dy == 0)
- return;
-
-#ifdef TSLIBMOUSEHANDLER_DEBUG
- qDebug() << "last" << QPoint(lastSample.x, lastSample.y)
- << "curr" << QPoint(sample.x, sample.y)
- << "dx,dy" << QPoint(dx, dy)
- << "ddx,ddy" << QPoint(dx*lastdx, dy*lastdy)
- << "pressed" << wasPressed << pressed;
-#endif
-
- lastSample = sample;
- wasPressed = pressed;
- if (dx != 0)
- lastdx = dx;
- if (dy != 0)
- lastdy = dy;
-
- const QPoint p(sample.x, sample.y);
- if (calibrated) {
- // tslib should do all the translation and filtering, so we send a
- // "raw" mouse event
- handler->QWSMouseHandler::mouseChanged(p, pressed);
- } else {
- handler->sendFiltered(p, pressed);
- }
- }
-}
-
-void QWSTslibMouseHandlerPrivate::clearCalibration()
-{
- suspend();
- close();
- handler->QWSCalibratedMouseHandler::clearCalibration();
- calibrated = false;
- open();
- resume();
-}
-
-void QWSTslibMouseHandlerPrivate::calibrate(const QWSPointerCalibrationData *data)
-{
- suspend();
- close();
- // default implementation writes to /etc/pointercal
- // using the same format as the tslib linear module.
- handler->QWSCalibratedMouseHandler::calibrate(data);
- calibrated = true;
- open();
- resume();
-}
-
-/*!
- \internal
-*/
-QWSTslibMouseHandler::QWSTslibMouseHandler(const QString &driver,
- const QString &device)
- : QWSCalibratedMouseHandler(driver, device)
-{
- d = new QWSTslibMouseHandlerPrivate(this, device);
-}
-
-/*!
- \internal
-*/
-QWSTslibMouseHandler::~QWSTslibMouseHandler()
-{
- delete d;
-}
-
-/*!
- \reimp
-*/
-void QWSTslibMouseHandler::suspend()
-{
- d->suspend();
-}
-
-/*!
- \reimp
-*/
-void QWSTslibMouseHandler::resume()
-{
- d->resume();
-}
-
-/*!
- \reimp
-*/
-void QWSTslibMouseHandler::clearCalibration()
-{
- d->clearCalibration();
-}
-
-/*!
- \reimp
-*/
-void QWSTslibMouseHandler::calibrate(const QWSPointerCalibrationData *data)
-{
- d->calibrate(data);
-}
-
-QT_END_NAMESPACE
-
-#include "qmousetslib_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_TSLIB
diff --git a/src/gui/embedded/qmousetslib_qws.h b/src/gui/embedded/qmousetslib_qws.h
deleted file mode 100644
index fc6206c03f..0000000000
--- a/src/gui/embedded/qmousetslib_qws.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSETSLIB_QWS_H
-#define QMOUSETSLIB_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if !defined(QT_NO_QWS_MOUSE_TSLIB) || defined(QT_PLUGIN)
-
-class QWSTslibMouseHandlerPrivate;
-
-class QWSTslibMouseHandler : public QWSCalibratedMouseHandler
-{
-public:
- explicit QWSTslibMouseHandler(const QString &driver = QString(),
- const QString &device = QString());
- ~QWSTslibMouseHandler();
-
- void suspend();
- void resume();
-
- void calibrate(const QWSPointerCalibrationData *data);
- void clearCalibration();
-
-protected:
- friend class QWSTslibMouseHandlerPrivate;
- QWSTslibMouseHandlerPrivate *d;
-};
-
-
-#endif // QT_NO_QWS_MOUSE_TSLIB
-QT_END_NAMESPACE
-QT_END_HEADER
-
-#endif // QMOUSETSLIB_QWS_H
diff --git a/src/gui/embedded/qmousevfb_qws.cpp b/src/gui/embedded/qmousevfb_qws.cpp
deleted file mode 100644
index 76eff3efe1..0000000000
--- a/src/gui/embedded/qmousevfb_qws.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_NO_QWS_MOUSE_QVFB
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include <qvfbhdr.h>
-#include <qmousevfb_qws.h>
-#include <qwindowsystem_qws.h>
-#include <qsocketnotifier.h>
-#include <qapplication.h>
-#include <qtimer.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-QT_BEGIN_NAMESPACE
-
-QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device)
- : QObject(), QWSMouseHandler(driver, device)
-{
- QString mouseDev = device;
- if (device.isEmpty())
- mouseDev = QLatin1String("/dev/vmouse");
-
- mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY);
- if (mouseFD == -1) {
- perror("QVFbMouseHandler::QVFbMouseHandler");
- qWarning("QVFbMouseHander: Unable to open device %s",
- qPrintable(mouseDev));
- return;
- }
-
- // Clear pending input
- char buf[2];
- while (QT_READ(mouseFD, buf, 1) > 0) { }
-
- mouseIdx = 0;
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-QVFbMouseHandler::~QVFbMouseHandler()
-{
- if (mouseFD >= 0)
- QT_CLOSE(mouseFD);
-}
-
-void QVFbMouseHandler::resume()
-{
- mouseNotifier->setEnabled(true);
-}
-
-void QVFbMouseHandler::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-void QVFbMouseHandler::readMouseData()
-{
- int n;
- do {
- n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
- if (n > 0)
- mouseIdx += n;
- } while (n > 0);
-
- int idx = 0;
- static const int packetsize = sizeof(QPoint) + 2*sizeof(int);
- while (mouseIdx-idx >= packetsize) {
- uchar *mb = mouseBuf+idx;
- QPoint mousePos = *reinterpret_cast<QPoint *>(mb);
- mb += sizeof(QPoint);
- int bstate = *reinterpret_cast<int *>(mb);
- mb += sizeof(int);
- int wheel = *reinterpret_cast<int *>(mb);
-// limitToScreen(mousePos);
- mouseChanged(mousePos, bstate, wheel);
- idx += packetsize;
- }
-
- int surplus = mouseIdx - idx;
- for (int i = 0; i < surplus; i++)
- mouseBuf[i] = mouseBuf[idx+i];
- mouseIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MOUSE_QVFB
diff --git a/src/gui/embedded/qmousevfb_qws.h b/src/gui/embedded/qmousevfb_qws.h
deleted file mode 100644
index f2e7bd14fc..0000000000
--- a/src/gui/embedded/qmousevfb_qws.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEVFB_QWS_H
-#define QMOUSEVFB_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_QVFB
-
-class QSocketNotifier;
-
-class QVFbMouseHandler : public QObject, public QWSMouseHandler {
- Q_OBJECT
-public:
- QVFbMouseHandler(const QString &driver = QString(),
- const QString &device = QString());
- ~QVFbMouseHandler();
-
- void resume();
- void suspend();
-
-private:
- int mouseFD;
- int mouseIdx;
- enum {mouseBufSize = 128};
- uchar mouseBuf[mouseBufSize];
- QSocketNotifier *mouseNotifier;
-
-private Q_SLOTS:
- void readMouseData();
-};
-#endif // QT_NO_QWS_MOUSE_QVFB
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEVFB_QWS_H
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
deleted file mode 100644
index 90561fd06d..0000000000
--- a/src/gui/embedded/qscreen_qws.cpp
+++ /dev/null
@@ -1,3347 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-#include "qscreen_qws.h"
-
-#include "qcolormap.h"
-#include "qscreendriverfactory_qws.h"
-#include "qwindowsystem_qws.h"
-#include "qwidget.h"
-#include "qcolor.h"
-#include "qpixmap.h"
-#include "qvarlengtharray.h"
-#include "qwsdisplay_qws.h"
-#include "qpainter.h"
-#include <private/qdrawhelper_p.h>
-#include <private/qpaintengine_raster_p.h>
-#include <private/qpixmap_raster_p.h>
-#include <private/qwindowsurface_qws_p.h>
-#include <private/qpainter_p.h>
-#include <private/qwidget_p.h>
-#include <private/qgraphicssystem_qws_p.h>
-
-QT_BEGIN_NAMESPACE
-
-// #define QT_USE_MEMCPY_DUFF
-
-#ifndef QT_NO_QWS_CURSOR
-Q_GUI_EXPORT QScreenCursor * qt_screencursor = 0;
-#endif
-Q_GUI_EXPORT QScreen * qt_screen = 0;
-
-ClearCacheFunc QScreen::clearCacheFunc = 0;
-
-#ifndef QT_NO_QWS_CURSOR
-/*!
- \class QScreenCursor
- \ingroup qws
-
- \brief The QScreenCursor class is a base class for screen cursors
- in Qt for Embedded Linux.
-
- Note that this class is non-portable, and that it is only
- available in \l{Qt for Embedded Linux}.
-
- QScreenCursor implements a software cursor, but can be subclassed
- to support hardware cursors as well. When deriving from the
- QScreenCursor class it is important to maintain the cursor's
- image, position, hot spot (the point within the cursor's image
- that will be the position of the associated mouse events) and
- visibility as well as informing whether it is hardware accelerated
- or not.
-
- Note that there may only be one screen cursor at a time. Use the
- static instance() function to retrieve a pointer to the current
- screen cursor. Typically, the cursor is constructed by the QScreen
- class or one of its descendants when it is initializing the
- device; the QScreenCursor class should never be instantiated
- explicitly.
-
- Use the move() function to change the position of the cursor, and
- the set() function to alter its image or its hot spot. In
- addition, you can find out whether the cursor is accelerated or
- not, using the isAccelerated() function, and the boundingRect()
- function returns the cursor's bounding rectangle.
-
- The cursor's appearance can be controlled using the isVisible(),
- hide() and show() functions; alternatively the QWSServer class
- provides some means of controlling the cursor's appearance using
- the QWSServer::isCursorVisible() and QWSServer::setCursorVisible()
- functions.
-
- \sa QScreen, QWSServer
-*/
-
-/*!
- \fn static QScreenCursor* QScreenCursor::instance()
- \since 4.2
-
- Returns a pointer to the application's unique screen cursor.
-*/
-
-/*!
- Constructs a screen cursor
-*/
-QScreenCursor::QScreenCursor()
-{
- pos = QPoint(qt_screen->deviceWidth()/2, qt_screen->deviceHeight()/2);
- size = QSize(0,0);
- enable = true;
- hwaccel = false;
- supportsAlpha = true;
-}
-
-/*!
- Destroys the screen cursor.
-*/
-QScreenCursor::~QScreenCursor()
-{
-}
-
-/*!
- Hides the cursor from the screen.
-
- \sa show()
-*/
-void QScreenCursor::hide()
-{
- if (enable) {
- enable = false;
- if (!hwaccel)
- qt_screen->exposeRegion(boundingRect(), 0);
- }
-}
-
-/*!
- Shows the mouse cursor.
-
- \sa hide()
-*/
-void QScreenCursor::show()
-{
- if (!enable) {
- enable = true;
- if (!hwaccel)
- qt_screen->exposeRegion(boundingRect(), 0);
- }
-}
-
-/*!
- Sets the cursor's image to be the given \a image.
-
- The \a hotx and \a hoty parameters define the cursor's hot spot,
- i.e., the point within the cursor's image that will be the
- position of the associated mouse events.
-
- \sa move()
-*/
-void QScreenCursor::set(const QImage &image, int hotx, int hoty)
-{
- const QRect r = boundingRect();
-
- hotspot = QPoint(hotx, hoty);
- // These are in almost all cases the fastest formats to blend
- QImage::Format f;
- switch (qt_screen->depth()) {
- case 12:
- f = QImage::Format_ARGB4444_Premultiplied;
- break;
- case 15:
- f = QImage::Format_ARGB8555_Premultiplied;
- break;
- case 16:
- f = QImage::Format_ARGB8565_Premultiplied;
- break;
- case 18:
- f = QImage::Format_ARGB6666_Premultiplied;
- break;
- default:
- f = QImage::Format_ARGB32_Premultiplied;
- }
-
- cursor = image.convertToFormat(f);
-
- size = image.size();
-
- if (enable && !hwaccel)
- qt_screen->exposeRegion(r | boundingRect(), 0);
-}
-
-/*!
- Moves the mouse cursor to the given position, i.e., (\a x, \a y).
-
- Note that the given position defines the top-left corner of the
- cursor's image, i.e., not the cursor's hot spot (the position of
- the associated mouse events).
-
- \sa set()
-*/
-void QScreenCursor::move(int x, int y)
-{
- QRegion r = boundingRect();
- pos = QPoint(x,y);
- if (enable && !hwaccel) {
- r |= boundingRect();
- qt_screen->exposeRegion(r, 0);
- }
-}
-
-
-/*!
- \fn void QScreenCursor::initSoftwareCursor ()
-
- Initializes the screen cursor.
-
- This function is typically called from the screen driver when
- initializing the device. Alternatively, the cursor can be set
- directly using the pointer returned by the static instance()
- function.
-
- \sa QScreen::initDevice()
-*/
-void QScreenCursor::initSoftwareCursor()
-{
- qt_screencursor = new QScreenCursor;
-}
-
-
-#endif // QT_NO_QWS_CURSOR
-
-
-/*!
- \fn QRect QScreenCursor::boundingRect () const
-
- Returns the cursor's bounding rectangle.
-*/
-
-/*!
- \internal
- \fn bool QScreenCursor::enabled ()
-*/
-
-/*!
- \fn QImage QScreenCursor::image () const
-
- Returns the cursor's image.
-*/
-
-
-/*!
- \fn bool QScreenCursor::isAccelerated () const
-
- Returns true if the cursor is accelerated; otherwise false.
-*/
-
-/*!
- \fn bool QScreenCursor::isVisible () const
-
- Returns true if the cursor is visible; otherwise false.
-*/
-
-/*!
- \internal
- \fn bool QScreenCursor::supportsAlphaCursor () const
-*/
-
-/*
- \variable QScreenCursor::cursor
-
- \brief the cursor's image.
-
- \sa image()
-*/
-
-/*
- \variable QScreenCursor::size
-
- \brief the cursor's size
-*/
-
-/*
- \variable QScreenCursor::pos
-
- \brief the cursor's position, i.e., the position of the top-left
- corner of the crsor's image
-
- \sa set(), move()
-*/
-
-/*
- \variable QScreenCursor::hotspot
-
- \brief the cursor's hotspot, i.e., the point within the cursor's
- image that will be the position of the associated mouse events.
-
- \sa set(), move()
-*/
-
-/*
- \variable QScreenCursor::enable
-
- \brief whether the cursor is visible or not
-
- \sa isVisible()
-*/
-
-/*
- \variable QScreenCursor::hwaccel
-
- \brief holds whether the cursor is accelerated or not
-
- If the cursor is not accelerated, its image will be included by
- the screen when it composites the window surfaces.
-
- \sa isAccelerated()
-
-*/
-
-/*
- \variable QScreenCursor::supportsAlpha
-*/
-
-/*!
- \internal
- \macro qt_screencursor
- \relates QScreenCursor
-
- A global pointer referring to the unique screen cursor. It is
- equivalent to the pointer returned by the
- QScreenCursor::instance() function.
-*/
-
-
-
-class QScreenPrivate
-{
-public:
- QScreenPrivate(QScreen *parent, QScreen::ClassId id = QScreen::CustomClass);
- ~QScreenPrivate();
-
- inline QImage::Format preferredImageFormat() const;
-
- typedef void (*SolidFillFunc)(QScreen*, const QColor&, const QRegion&);
- typedef void (*BlitFunc)(QScreen*, const QImage&, const QPoint&, const QRegion&);
-
- SolidFillFunc solidFill;
- BlitFunc blit;
-
- QPoint offset;
- QList<QScreen*> subScreens;
- QPixmapDataFactory* pixmapFactory;
- QGraphicsSystem* graphicsSystem;
- QWSGraphicsSystem defaultGraphicsSystem; //###
- QImage::Format pixelFormat;
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- bool fb_is_littleEndian;
-#endif
-#ifdef QT_QWS_CLIENTBLIT
- bool supportsBlitInClients;
-#endif
- int classId;
- QScreen *q_ptr;
-};
-
-template <typename T>
-static void solidFill_template(QScreen *screen, const QColor &color,
- const QRegion &region)
-{
- T *dest = reinterpret_cast<T*>(screen->base());
- const T c = qt_colorConvert<T, quint32>(color.rgba(), 0);
- const int stride = screen->linestep();
- const QVector<QRect> rects = region.rects();
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect r = rects.at(i);
- qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride);
- }
-}
-
-#ifdef QT_QWS_DEPTH_GENERIC
-static void solidFill_rgb_32bpp(QScreen *screen, const QColor &color,
- const QRegion &region)
-{
- quint32 *dest = reinterpret_cast<quint32*>(screen->base());
- const quint32 c = qt_convertToRgb<quint32>(color.rgba());
-
- const int stride = screen->linestep();
- const QVector<QRect> rects = region.rects();
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect r = rects.at(i);
- qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride);
- }
-}
-
-static void solidFill_rgb_16bpp(QScreen *screen, const QColor &color,
- const QRegion &region)
-{
- quint16 *dest = reinterpret_cast<quint16*>(screen->base());
- const quint16 c = qt_convertToRgb<quint32>(color.rgba());
-
- const int stride = screen->linestep();
- const QVector<QRect> rects = region.rects();
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect r = rects.at(i);
- qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride);
- }
-}
-#endif // QT_QWS_DEPTH_GENERIC
-
-#ifdef QT_QWS_DEPTH_4
-static inline void qt_rectfill_gray4(quint8 *dest, quint8 value,
- int x, int y, int width, int height,
- int stride)
-{
- const int pixelsPerByte = 2;
- dest += y * stride + x / pixelsPerByte;
- const int doAlign = x & 1;
- const int doTail = (width - doAlign) & 1;
- const int width8 = (width - doAlign) / pixelsPerByte;
-
- for (int j = 0; j < height; ++j) {
- if (doAlign)
- *dest = (*dest & 0xf0) | (value & 0x0f);
- if (width8)
- qt_memfill<quint8>(dest + doAlign, value, width8);
- if (doTail) {
- quint8 *d = dest + doAlign + width8;
- *d = (*d & 0x0f) | (value & 0xf0);
- }
- dest += stride;
- }
-}
-
-static void solidFill_gray4(QScreen *screen, const QColor &color,
- const QRegion &region)
-{
- quint8 *dest = reinterpret_cast<quint8*>(screen->base());
- const quint8 c = qGray(color.rgba()) >> 4;
- const quint8 c8 = (c << 4) | c;
-
- const int stride = screen->linestep();
- const QVector<QRect> rects = region.rects();
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect r = rects.at(i);
- qt_rectfill_gray4(dest, c8, r.x(), r.y(), r.width(), r.height(),
- stride);
- }
-}
-#endif // QT_QWS_DEPTH_4
-
-#ifdef QT_QWS_DEPTH_1
-static inline void qt_rectfill_mono(quint8 *dest, quint8 value,
- int x, int y, int width, int height,
- int stride)
-{
- const int pixelsPerByte = 8;
- const int alignWidth = qMin(width, (8 - (x & 7)) & 7);
- const int doAlign = (alignWidth > 0 ? 1 : 0);
- const int alignStart = pixelsPerByte - 1 - (x & 7);
- const int alignStop = alignStart - (alignWidth - 1);
- const quint8 alignMask = ((1 << alignWidth) - 1) << alignStop;
- const int tailWidth = (width - alignWidth) & 7;
- const int doTail = (tailWidth > 0 ? 1 : 0);
- const quint8 tailMask = (1 << (pixelsPerByte - tailWidth)) - 1;
- const int width8 = (width - alignWidth) / pixelsPerByte;
-
- dest += y * stride + x / pixelsPerByte;
- stride -= (doAlign + width8);
-
- for (int j = 0; j < height; ++j) {
- if (doAlign) {
- *dest = (*dest & ~alignMask) | (value & alignMask);
- ++dest;
- }
- if (width8) {
- qt_memfill<quint8>(dest, value, width8);
- dest += width8;
- }
- if (doTail)
- *dest = (*dest & tailMask) | (value & ~tailMask);
- dest += stride;
- }
-}
-
-static void solidFill_mono(QScreen *screen, const QColor &color,
- const QRegion &region)
-{
- quint8 *dest = reinterpret_cast<quint8*>(screen->base());
- const quint8 c8 = (qGray(color.rgba()) >> 7) * 0xff;
-
- const int stride = screen->linestep();
- const QVector<QRect> rects = region.rects();
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect r = rects.at(i);
- qt_rectfill_mono(dest, c8, r.x(), r.y(), r.width(), r.height(),
- stride);
- }
-}
-#endif // QT_QWS_DEPTH_1
-
-void qt_solidFill_setup(QScreen *screen, const QColor &color,
- const QRegion &region)
-{
- switch (screen->depth()) {
-#ifdef QT_QWS_DEPTH_32
- case 32:
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->solidFill = solidFill_template<quint32>;
- else
- screen->d_ptr->solidFill = solidFill_template<qabgr8888>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_24
- case 24:
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->solidFill = solidFill_template<qrgb888>;
- else
- screen->d_ptr->solidFill = solidFill_template<quint24>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_18
- case 18:
- screen->d_ptr->solidFill = solidFill_template<quint18>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_16
- case 16:
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->solidFill = solidFill_template<quint16>;
- else
- screen->d_ptr->solidFill = solidFill_template<qbgr565>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_15
- case 15:
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->solidFill = solidFill_template<qrgb555>;
- else
- screen->d_ptr->solidFill = solidFill_template<qbgr555>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_12
- case 12:
- screen->d_ptr->solidFill = solidFill_template<qrgb444>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_8
- case 8:
- screen->d_ptr->solidFill = solidFill_template<quint8>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_4
- case 4:
- screen->d_ptr->solidFill = solidFill_gray4;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_1
- case 1:
- screen->d_ptr->solidFill = solidFill_mono;
- break;
-#endif
- default:
- qFatal("solidFill_setup(): Screen depth %d not supported!",
- screen->depth());
- screen->d_ptr->solidFill = 0;
- break;
- }
- screen->d_ptr->solidFill(screen, color, region);
-}
-
-template <typename DST, typename SRC>
-static void blit_template(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- DST *dest = reinterpret_cast<DST*>(screen->base());
- const int screenStride = screen->linestep();
- const int imageStride = image.bytesPerLine();
-
- if (region.rectCount() == 1) {
- const QRect r = region.boundingRect();
- const SRC *src = reinterpret_cast<const SRC*>(image.scanLine(r.y()))
- + r.x();
- qt_rectconvert<DST, SRC>(dest, src,
- r.x() + topLeft.x(), r.y() + topLeft.y(),
- r.width(), r.height(),
- screenStride, imageStride);
- } else {
- const QVector<QRect> rects = region.rects();
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect r = rects.at(i);
- const SRC *src = reinterpret_cast<const SRC*>(image.scanLine(r.y()))
- + r.x();
- qt_rectconvert<DST, SRC>(dest, src,
- r.x() + topLeft.x(), r.y() + topLeft.y(),
- r.width(), r.height(),
- screenStride, imageStride);
- }
- }
-}
-
-#ifdef QT_QWS_DEPTH_32
-static void blit_32(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<quint32, quint32>(screen, image, topLeft, region);
- return;
-#ifdef QT_QWS_DEPTH_16
- case QImage::Format_RGB16:
- blit_template<quint32, quint16>(screen, image, topLeft, region);
- return;
-#endif
- default:
- qCritical("blit_32(): Image format %d not supported!", image.format());
- }
-}
-#endif // QT_QWS_DEPTH_32
-
-#ifdef QT_QWS_DEPTH_24
-static void blit_24(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<quint24, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB888:
- blit_template<quint24, qrgb888>(screen, image, topLeft, region);
- return;
-#ifdef QT_QWS_DEPTH_16
- case QImage::Format_RGB16:
- blit_template<quint24, quint16>(screen, image, topLeft, region);
- return;
-#endif
- default:
- qCritical("blit_24(): Image format %d not supported!", image.format());
- }
-}
-
-static void blit_qrgb888(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<qrgb888, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB888:
- blit_template<qrgb888, qrgb888>(screen, image, topLeft, region);
- return;
-#ifdef QT_QWS_DEPTH_16
- case QImage::Format_RGB16:
- blit_template<qrgb888, quint16>(screen, image, topLeft, region);
- return;
-#endif
- default:
- qCritical("blit_24(): Image format %d not supported!", image.format());
- break;
- }
-}
-#endif // QT_QWS_DEPTH_24
-
-#ifdef QT_QWS_DEPTH_18
-static void blit_18(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<qrgb666, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB666:
- blit_template<qrgb666, qrgb666>(screen, image, topLeft, region);
- return;
-#ifdef QT_QWS_DEPTH_16
- case QImage::Format_RGB16:
- blit_template<qrgb666, quint16>(screen, image, topLeft, region);
- return;
-#endif
- default:
- qCritical("blit_18(): Image format %d not supported!", image.format());
- }
-}
-#endif // QT_QWS_DEPTH_18
-
-#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) && (defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15))
-class quint16LE
-{
-public:
- inline quint16LE(quint32 v) {
- data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8);
- }
-
- inline quint16LE(int v) {
- data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8);
- }
-
- inline quint16LE(quint16 v) {
- data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8);
- }
-
- inline quint16LE(qrgb555 v) {
- data = (( (quint16)v & 0xff00) >> 8) |
- (( (quint16)v & 0x00ff) << 8);
- }
-
- inline bool operator==(const quint16LE &v) const
- {
- return data == v.data;
- }
-
-private:
- quint16 data;
-};
-#endif
-
-#ifdef QT_QWS_DEPTH_16
-static void blit_16(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- // ### This probably doesn't work but it's a case which should never happen
- blit_template<quint16, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB16:
- blit_template<quint16, quint16>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_16(): Image format %d not supported!", image.format());
- }
-}
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-static void blit_16_bigToLittleEndian(QScreen *screen, const QImage &image,
- const QPoint &topLeft,
- const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<quint16LE, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB16:
- blit_template<quint16LE, quint16>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_16_bigToLittleEndian(): Image format %d not supported!", image.format());
- }
-}
-
-#endif // Q_BIG_ENDIAN
-#endif // QT_QWS_DEPTH_16
-
-#ifdef QT_QWS_DEPTH_15
-static void blit_15(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<qrgb555, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB555:
- blit_template<qrgb555, qrgb555>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB16:
- blit_template<qrgb555, quint16>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_15(): Image format %d not supported!", image.format());
- }
-}
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-static void blit_15_bigToLittleEndian(QScreen *screen, const QImage &image,
- const QPoint &topLeft,
- const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB555:
- blit_template<quint16LE, qrgb555>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_15_bigToLittleEndian(): Image format %d not supported!", image.format());
- }
-}
-#endif // Q_BIG_ENDIAN
-#endif // QT_QWS_DEPTH_15
-
-
-#ifdef QT_QWS_DEPTH_12
-static void blit_12(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_ARGB4444_Premultiplied:
- blit_template<qrgb444, qargb4444>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB444:
- blit_template<qrgb444, qrgb444>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_12(): Image format %d not supported!", image.format());
- }
-}
-#endif // QT_QWS_DEPTH_12
-
-#ifdef QT_QWS_DEPTH_8
-static void blit_8(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<quint8, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB16:
- blit_template<quint8, quint16>(screen, image, topLeft, region);
- return;
- case QImage::Format_ARGB4444_Premultiplied:
- blit_template<quint8, qargb4444>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB444:
- blit_template<quint8, qrgb444>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_8(): Image format %d not supported!", image.format());
- }
-}
-#endif // QT_QWS_DEPTH_8
-
-#ifdef QT_QWS_DEPTH_4
-
-struct qgray4 { quint8 dummy; } Q_PACKED;
-
-template <typename SRC>
-Q_STATIC_TEMPLATE_FUNCTION inline quint8 qt_convertToGray4(SRC color);
-
-template <>
-inline quint8 qt_convertToGray4(quint32 color)
-{
- return qGray(color) >> 4;
-}
-
-template <>
-inline quint8 qt_convertToGray4(quint16 color)
-{
- const int r = (color & 0xf800) >> 11;
- const int g = (color & 0x07e0) >> 6; // only keep 5 bit
- const int b = (color & 0x001f);
- return (r * 11 + g * 16 + b * 5) >> 6;
-}
-
-template <>
-inline quint8 qt_convertToGray4(qrgb444 color)
-{
- return qt_convertToGray4(quint32(color));
-}
-
-template <>
-inline quint8 qt_convertToGray4(qargb4444 color)
-{
- return qt_convertToGray4(quint32(color));
-}
-
-template <typename SRC>
-Q_STATIC_TEMPLATE_FUNCTION inline void qt_rectconvert_gray4(qgray4 *dest4, const SRC *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- const int pixelsPerByte = 2;
- quint8 *dest8 = reinterpret_cast<quint8*>(dest4)
- + y * dstStride + x / pixelsPerByte;
- const int doAlign = x & 1;
- const int doTail = (width - doAlign) & 1;
- const int width8 = (width - doAlign) / pixelsPerByte;
- const int count8 = (width8 + 3) / 4;
-
- srcStride = srcStride / sizeof(SRC) - width;
- dstStride -= (width8 + doAlign);
-
- for (int i = 0; i < height; ++i) {
- if (doAlign) {
- *dest8 = (*dest8 & 0xf0) | qt_convertToGray4<SRC>(*src++);
- ++dest8;
- }
- if (count8) {
- int n = count8;
- switch (width8 & 0x03) // duff's device
- {
- case 0: do { *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
- | qt_convertToGray4<SRC>(src[1]);
- src += 2;
- case 3: *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
- | qt_convertToGray4<SRC>(src[1]);
- src += 2;
- case 2: *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
- | qt_convertToGray4<SRC>(src[1]);
- src += 2;
- case 1: *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
- | qt_convertToGray4<SRC>(src[1]);
- src += 2;
- } while (--n > 0);
- }
- }
-
- if (doTail)
- *dest8 = qt_convertToGray4<SRC>(*src++) << 4 | (*dest8 & 0x0f);
-
- dest8 += dstStride;
- src += srcStride;
- }
-}
-
-template <>
-void qt_rectconvert(qgray4 *dest, const quint32 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_gray4<quint32>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-template <>
-void qt_rectconvert(qgray4 *dest, const quint16 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_gray4<quint16>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-template <>
-void qt_rectconvert(qgray4 *dest, const qrgb444 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_gray4<qrgb444>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-template <>
-void qt_rectconvert(qgray4 *dest, const qargb4444 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_gray4<qargb4444>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-static void blit_4(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<qgray4, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB16:
- blit_template<qgray4, quint16>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB444:
- blit_template<qgray4, qrgb444>(screen, image, topLeft, region);
- return;
- case QImage::Format_ARGB4444_Premultiplied:
- blit_template<qgray4, qargb4444>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_4(): Image format %d not supported!", image.format());
- }
-}
-#endif // QT_QWS_DEPTH_4
-
-#ifdef QT_QWS_DEPTH_1
-
-struct qmono { quint8 dummy; } Q_PACKED;
-
-template <typename SRC>
-Q_STATIC_TEMPLATE_FUNCTION inline quint8 qt_convertToMono(SRC color);
-
-template <>
-inline quint8 qt_convertToMono(quint32 color)
-{
- return qGray(color) >> 7;
-}
-
-template <>
-inline quint8 qt_convertToMono(quint16 color)
-{
- return (qGray(qt_colorConvert<quint32, quint16>(color, 0)) >> 7);
-}
-
-template <>
-inline quint8 qt_convertToMono(qargb4444 color)
-{
- return (qGray(quint32(color)) >> 7);
-}
-
-template <>
-inline quint8 qt_convertToMono(qrgb444 color)
-{
- return (qGray(quint32(color)) >> 7);
-}
-
-template <typename SRC>
-inline void qt_rectconvert_mono(qmono *dest, const SRC *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- const int pixelsPerByte = 8;
- quint8 *dest8 = reinterpret_cast<quint8*>(dest)
- + y * dstStride + x / pixelsPerByte;
- const int alignWidth = qMin(width, (8 - (x & 7)) & 7);
- const int doAlign = (alignWidth > 0 ? 1 : 0);
- const int alignStart = pixelsPerByte - 1 - (x & 7);
- const int alignStop = alignStart - (alignWidth - 1);
- const quint8 alignMask = ((1 << alignWidth) - 1) << alignStop;
- const int tailWidth = (width - alignWidth) & 7;
- const int doTail = (tailWidth > 0 ? 1 : 0);
- const quint8 tailMask = (1 << (pixelsPerByte - tailWidth)) - 1;
- const int width8 = (width - alignWidth) / pixelsPerByte;
-
- srcStride = srcStride / sizeof(SRC) - (width8 * 8 + alignWidth);
- dstStride -= (width8 + doAlign);
-
- for (int j = 0; j < height; ++j) {
- if (doAlign) {
- quint8 d = *dest8 & ~alignMask;
- for (int i = alignStart; i >= alignStop; --i)
- d |= qt_convertToMono<SRC>(*src++) << i;
- *dest8++ = d;
- }
- for (int i = 0; i < width8; ++i) {
- *dest8 = (qt_convertToMono<SRC>(src[0]) << 7)
- | (qt_convertToMono<SRC>(src[1]) << 6)
- | (qt_convertToMono<SRC>(src[2]) << 5)
- | (qt_convertToMono<SRC>(src[3]) << 4)
- | (qt_convertToMono<SRC>(src[4]) << 3)
- | (qt_convertToMono<SRC>(src[5]) << 2)
- | (qt_convertToMono<SRC>(src[6]) << 1)
- | (qt_convertToMono<SRC>(src[7]));
- src += 8;
- ++dest8;
- }
- if (doTail) {
- quint8 d = *dest8 & tailMask;
- switch (tailWidth) {
- case 7: d |= qt_convertToMono<SRC>(src[6]) << 1;
- case 6: d |= qt_convertToMono<SRC>(src[5]) << 2;
- case 5: d |= qt_convertToMono<SRC>(src[4]) << 3;
- case 4: d |= qt_convertToMono<SRC>(src[3]) << 4;
- case 3: d |= qt_convertToMono<SRC>(src[2]) << 5;
- case 2: d |= qt_convertToMono<SRC>(src[1]) << 6;
- case 1: d |= qt_convertToMono<SRC>(src[0]) << 7;
- }
- *dest8 = d;
- }
-
- dest8 += dstStride;
- src += srcStride;
- }
-}
-
-template <>
-void qt_rectconvert(qmono *dest, const quint32 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_mono<quint32>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-template <>
-void qt_rectconvert(qmono *dest, const quint16 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_mono<quint16>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-template <>
-void qt_rectconvert(qmono *dest, const qrgb444 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_mono<qrgb444>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-template <>
-void qt_rectconvert(qmono *dest, const qargb4444 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_mono<qargb4444>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-static void blit_1(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<qmono, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB16:
- blit_template<qmono, quint16>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB444:
- blit_template<qmono, qrgb444>(screen, image, topLeft, region);
- return;
- case QImage::Format_ARGB4444_Premultiplied:
- blit_template<qmono, qargb4444>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_1(): Image format %d not supported!", image.format());
- }
-}
-#endif // QT_QWS_DEPTH_1
-
-#ifdef QT_QWS_DEPTH_GENERIC
-
-static void blit_rgb(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (image.format()) {
- case QImage::Format_ARGB32_Premultiplied:
- blit_template<qrgb, quint32>(screen, image, topLeft, region);
- return;
- case QImage::Format_RGB16:
- blit_template<qrgb, quint16>(screen, image, topLeft, region);
- return;
- default:
- qCritical("blit_rgb(): Image format %d not supported!", image.format());
- }
-}
-
-void qt_set_generic_blit(QScreen *screen, int bpp,
- int len_red, int len_green, int len_blue, int len_alpha,
- int off_red, int off_green, int off_blue, int off_alpha)
-{
- qrgb::bpp = bpp / 8;
- qrgb::len_red = len_red;
- qrgb::len_green = len_green;
- qrgb::len_blue = len_blue;
- qrgb::len_alpha = len_alpha;
- qrgb::off_red = off_red;
- qrgb::off_green = off_green;
- qrgb::off_blue = off_blue;
- qrgb::off_alpha = off_alpha;
- screen->d_ptr->blit = blit_rgb;
- if (bpp == 16)
- screen->d_ptr->solidFill = solidFill_rgb_16bpp;
- else if (bpp == 32)
- screen->d_ptr->solidFill = solidFill_rgb_32bpp;
-}
-
-#endif // QT_QWS_DEPTH_GENERIC
-
-void qt_blit_setup(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region)
-{
- switch (screen->depth()) {
-#ifdef QT_QWS_DEPTH_32
- case 32:
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->blit = blit_32;
- else
- screen->d_ptr->blit = blit_template<qabgr8888, quint32>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_24
- case 24:
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->blit = blit_qrgb888;
- else
- screen->d_ptr->blit = blit_24;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_18
- case 18:
- screen->d_ptr->blit = blit_18;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_16
- case 16:
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- if (screen->d_ptr->fb_is_littleEndian)
- screen->d_ptr->blit = blit_16_bigToLittleEndian;
- else
-#endif
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->blit = blit_16;
- else
- screen->d_ptr->blit = blit_template<qbgr565, quint16>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_15
- case 15:
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- if (screen->d_ptr->fb_is_littleEndian)
- screen->d_ptr->blit = blit_15_bigToLittleEndian;
- else
-#endif // Q_BIG_ENDIAN
- if (screen->pixelType() == QScreen::NormalPixel)
- screen->d_ptr->blit = blit_15;
- else
- screen->d_ptr->blit = blit_template<qbgr555, qrgb555>;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_12
- case 12:
- screen->d_ptr->blit = blit_12;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_8
- case 8:
- screen->d_ptr->blit = blit_8;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_4
- case 4:
- screen->d_ptr->blit = blit_4;
- break;
-#endif
-#ifdef QT_QWS_DEPTH_1
- case 1:
- screen->d_ptr->blit = blit_1;
- break;
-#endif
- default:
- qFatal("blit_setup(): Screen depth %d not supported!",
- screen->depth());
- screen->d_ptr->blit = 0;
- break;
- }
- screen->d_ptr->blit(screen, image, topLeft, region);
-}
-
-QScreenPrivate::QScreenPrivate(QScreen *parent, QScreen::ClassId id)
- : defaultGraphicsSystem(QWSGraphicsSystem(parent)),
- pixelFormat(QImage::Format_Invalid),
-#ifdef QT_QWS_CLIENTBLIT
- supportsBlitInClients(false),
-#endif
- classId(id), q_ptr(parent)
-{
- solidFill = qt_solidFill_setup;
- blit = qt_blit_setup;
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- fb_is_littleEndian = false;
-#endif
- pixmapFactory = 0;
- graphicsSystem = &defaultGraphicsSystem;
-}
-
-QScreenPrivate::~QScreenPrivate()
-{
-}
-
-QImage::Format QScreenPrivate::preferredImageFormat() const
-{
- if (pixelFormat > QImage::Format_Indexed8)
- return pixelFormat;
-
- if (q_ptr->depth() <= 16)
- return QImage::Format_RGB16;
- else
- return QImage::Format_ARGB32_Premultiplied;
-}
-
-/*!
- \class QScreen
- \ingroup qws
-
- \brief The QScreen class is a base class for screen drivers in
- Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several screen
- protocols, see the \l{Qt for Embedded Linux Display Management}{display
- management} documentation for details. Custom screen drivers can
- be implemented by subclassing the QScreen class and creating a
- screen driver plugin (derived from QScreenDriverPlugin). The
- default implementation of the QScreenDriverFactory class
- will automatically detect the plugin, and load the driver into the
- server application at run-time using Qt's \l {How to Create Qt
- Plugins}{plugin system}.
-
- When rendering, the default behavior is for each
- client to render its widgets as well as its decorations into
- memory, while the server copies the memory content to the device's
- framebuffer using the screen driver. See the \l{Qt for Embedded Linux
- Architecture} overview for details (note that it is possible for
- the clients to manipulate and control the underlying hardware
- directly as well).
-
- Starting with Qt 4.2, it is also possible to add an
- accelerated graphics driver to take advantage of available
- hardware resources. See the \l{Adding an Accelerated Graphics
- Driver to Qt for Embedded Linux} documentation for details.
-
- \tableofcontents
-
- \section1 Framebuffer Management
-
- When a \l{Qt for Embedded Linux} application starts running, it
- calls the screen driver's connect() function to map the
- framebuffer and the accelerated drivers that the graphics card
- control registers. The connect() function should then read out the
- parameters of the framebuffer and use them as required to set this
- class's protected variables.
-
- The initDevice() function can be reimplemented to initialize the
- graphics card. Note, however, that connect() is called \e before
- the initDevice() function, so, for some hardware configurations,
- some of the initialization that would normally be done in the
- initDevice() function might have to be done in the connect()
- function.
-
- Likewise, just before a \l{Qt for Embedded Linux} application
- exits, it calls the screen driver's disconnect() function. The
- server application will in addition call the shutdownDevice()
- function before it calls disconnect(). Note that the default
- implementation of the shutdownDevice() function only hides the
- mouse cursor.
-
- QScreen also provides the save() and restore() functions, making
- it possible to save and restore the state of the graphics
- card. Note that the default implementations do nothing. Hardware
- screen drivers should reimplement these functions to save (and
- restore) its registers, enabling switching between virtual
- consoles.
-
- In addition, you can use the base() function to retrieve a pointer
- to the beginning of the framebuffer, and the region() function to
- retrieve the framebuffer's region. Use the onCard() function to
- determine whether the framebuffer is within the graphics card's
- memory, and the totalSize() function to determine the size of the
- available graphics card memory (including the screen). Finally,
- you can use the offset() function to retrieve the offset between
- the framebuffer's coordinates and the application's coordinate
- system.
-
- \section1 Palette Management
-
- QScreen provides several functions to retrieve information about
- the color palette: The clut() function returns a pointer to the
- color lookup table (i.e. its color palette). Use the colorCount()
- function to determine the number of entries in this table, and the
- alloc() function to retrieve the palette index of the color that
- is the closest match to a given RGB value.
-
- To determine if the screen driver supports a given color depth,
- use the supportsDepth() function that returns true of the
- specified depth is supported.
-
- \section1 Drawing on Screen
-
- When a screen update is required, the \l{Qt for Embedded Linux} server runs
- through all the top-level windows that intersect with the region
- that is about to be updated, and ensures that the associated
- clients have updated their memory buffer. Then the server calls
- the exposeRegion() function that composes the window surfaces and
- copies the content of memory to screen by calling the blit() and
- solidFill() functions.
-
- The blit() function copies a given region in a given image to a
- specified point using device coordinates, while the solidFill()
- function fills the given region of the screen with the specified
- color. Note that normally there is no need to call either of these
- functions explicitly.
-
- In addition, QScreen provides the blank() function that can be
- reimplemented to prevent any contents from being displayed on the
- screen, and the setDirty() function that can be reimplemented to
- indicate that a given rectangle of the screen has been
- altered. Note that the default implementations of these functions
- do nothing.
-
- Reimplement the mapFromDevice() and mapToDevice() functions to
- map objects from the framebuffer coordinate system to the
- coordinate space used by the application, and vice versa. Be aware
- that the default implementations simply return the given objects
- as they are.
-
- \section1 Properties
-
- \table
- \header \o Property \o Functions
- \row
- \o Size
- \o
-
- The size of the screen can be retrieved using the screenSize()
- function. The size is returned in bytes.
-
- The framebuffer's logical width and height can be retrieved using
- width() and height(), respectively. These functions return values
- are given in pixels. Alternatively, the physicalWidth() and
- physicalHeight() function returns the same metrics in
- millimeters. QScreen also provides the deviceWidth() and
- deviceHeight() functions returning the physical width and height
- of the device in pixels. Note that the latter metrics can differ
- from the ones used if the display is centered within the
- framebuffer.
-
- \row
- \o Resolution
- \o
-
- Reimplement the setMode() function to be able to set the
- framebuffer to a new resolution (width and height) and bit depth.
-
- The current depth of the framebuffer can be always be retrieved
- using the depth() function. Use the pixmapDepth() function to
- obtain the preferred depth for pixmaps.
-
- \row
- \o Pixmap Alignment
- \o
-
- Use the pixmapOffsetAlignment() function to retrieve the value to
- which the start address of pixmaps held in the graphics card's
- memory, should be aligned.
-
- Use the pixmapLinestepAlignment() to retrieve the value to which
- the \e {individual scanlines} of pixmaps should be aligned.
-
- \row
- \o Image Display
- \o
-
- The isInterlaced() function tells whether the screen is displaying
- images progressively, and the isTransformed() function whether it
- is rotated. The transformOrientation() function can be
- reimplemented to return the current rotation.
-
- \row
- \o Scanlines
- \o
-
- Use the linestep() function to retrieve the length of each
- scanline of the framebuffer.
-
- \row
- \o Pixel Type
- \o
-
- The pixelType() function returns the screen's pixel storage format as
- described by the PixelType enum.
-
- \endtable
-
- \section1 Subclassing and Initial Values
-
- You need to set the following members when implementing a subclass of QScreen:
-
- \table
- \header \o Member \o Initial Value
- \row \o \l{QScreen::}{data} \o A pointer to the framebuffer if possible;
- 0 otherwise.
- \row \o \l{QScreen::}{lstep} \o The number of bytes between each scanline
- in the framebuffer.
- \row \o \l{QScreen::}{w} \o The logical screen width in pixels.
- \row \o \l{QScreen::}{h} \o The logical screen height in pixels.
- \row \o \l{QScreen::}{dw} \o The real screen width in pixels.
- \row \o \l{QScreen::}{dh} \o The real screen height in pixels.
- \row \o \l{QScreen::}{d} \o The number of bits per pixel.
- \row \o \l{QScreen::}{physWidth} \o The screen width in millimeters.
- \row \o \l{QScreen::}{physHeight} \o The screen height in millimeters.
- \endtable
-
- The logical screen values are the same as the real screen values unless the
- screen is transformed in some way; e.g., rotated.
-
- See also the \l{Accelerated Graphics Driver Example} for an example that
- shows how to initialize these values.
-
- \sa QScreenDriverPlugin, QScreenDriverFactory, {Qt for Embedded Linux Display
- Management}
-*/
-
-/*!
- \enum QScreen::PixelType
-
- This enum describes the pixel storage format of the screen,
- i.e. the order of the red (R), green (G) and blue (B) components
- of a pixel.
-
- \value NormalPixel Red-green-blue (RGB)
- \value BGRPixel Blue-green-red (BGR)
-
- \sa pixelType()
-*/
-
-/*!
- \enum QScreen::ClassId
-
- This enum defines the class identifiers for the known screen subclasses.
-
- \value LinuxFBClass QLinuxFBScreen
- \value TransformedClass QTransformedScreen
- \value VNCClass QVNCScreen
- \value MultiClass QMultiScreen
- \value VFbClass QVFbScreen
- \value DirectFBClass QDirectFBScreen
- \value SvgalibClass QSvgalibScreen
- \value ProxyClass QProxyScreen
- \value GLClass QGLScreen
- \value CustomClass Unknown QScreen subclass
-
- \sa classId()
-*/
-
-/*!
- \variable QScreen::screenclut
- \brief the color table
-
- Initialize this variable in a subclass using a paletted screen mode,
- and initialize its partner, QScreen::screencols.
-
- \sa screencols
-*/
-
-/*!
- \variable QScreen::screencols
- \brief the number of entries in the color table
-
- Initialize this variable in a subclass using a paletted screen mode,
- and initialize its partner, QScreen::screenclut.
-
- \sa screenclut
-*/
-
-/*!
- \variable QScreen::data
- \brief points to the first visible pixel in the frame buffer.
-
- You must initialize this variable if you are using the default
- implementation of non-buffered painting Qt::WA_PaintOnScreen,
- QPixmap::grabWindow() or QDirectPainter::frameBuffer(). If you
- initialize this variable, you must also initialize QScreen::size and
- QScreen::mapsize.
-
- \sa QScreen::size, QScreen::mapsize
-*/
-
-/*!
- \variable QScreen::w
- \brief the logical width of the screen.
-
- This variable \e{must} be initialized by a subclass.
-*/
-
-/*!
- \variable QScreen::lstep
- \brief the number of bytes representing a line in the frame buffer.
-
- i.e., \e{line step}. \c {data[lstep * 2]} is the address of the
- first visible pixel in the third line of the frame buffer.
-
- \sa data
-*/
-
-/*!
- \variable QScreen::h
- \brief the logical height of the screen.
-
- This variable \e{must} be initialized by a subclass.
-*/
-
-/*!
- \variable QScreen::d
- \brief the pixel depth
-
- This is the number of significant bits used to set a pixel
- color. This variable \e{must} be initialized by a subclass.
-*/
-
-/*!
- \variable QScreen::pixeltype
- \brief set to BGRPixel
-
- Set this variable to BGRPixel in a subclass, if the screen pixel
- format is a BGR type and you have used setPixelFormat() to set the
- pixel format to the corresponding RGB format. e.g., you have set the
- pixel format to QImage::Format_RGB555, but your screen really uses
- BGR, not RGB.
-*/
-
-/*!
- \variable QScreen::grayscale
- \brief the gray scale screen mode flag
-
- Set this variable to true in a subclass, if you are using a
- grayscale screen mode. e.g., in an 8-bit mode where you don't want
- to use the palette, but you want to use the grayscales.
-*/
-
-/*!
- \variable QScreen::dw
- \brief the device width
-
- This is the number of pixels in a row of the physical screen. It
- \e{must} be initialized by a subclass. Normally, it should be set to
- the logical width QScreen::w, but it might be different, e.g., if
- you are doing rotations in software.
-
- \sa QScreen::w
-*/
-
-/*!
- \variable QScreen::dh
- \brief the device height
-
- This is the number of pixels in a column of the physical screen. It
- \e{must} be initialized by a subclass. Normally, it should be set to
- the logical height QScreen::h, but it might be different, e.g., if
- you are doing rotations in software.
-
- \sa QScreen::h
-*/
-
-/*!
- \variable QScreen::size
- \brief the number of bytes in the visible region of the frame buffer
-
- This is the number of bytes in the visible part of the block pointed
- to by the QScreen::data pointer. You must initialize this variable
- if you initialize the QScreen::data pointer.
-
- \sa QScreen::data, QScreen::mapsize
-*/
-
-/*!
- \variable QScreen::mapsize
- \brief the total number of bytes in the frame buffer
-
- This is the total number of bytes in the block pointed to by the
- QScreen::data pointer. You must initialize this variable if you
- initialize the QScreen::data pointer.
-
- \sa QScreen::data, QScreen::size
-*/
-
-/*!
- \variable QScreen::physWidth
- \brief the physical width of the screen in millimeters.
-
- Currently, this variable is used when calculating the screen DPI,
- which in turn is used when deciding the actual font size Qt is
- using.
-*/
-
-/*!
- \variable QScreen::physHeight
- \brief the physical height of the screen in millimeters.
-
- Currently, this variable is used when calculating the screen DPI,
- which in turn is used when deciding the actual font size Qt is
- using.
-*/
-
-/*!
- \fn static QScreen* QScreen::instance()
-
- Returns a pointer to the application's QScreen instance.
-
- If this screen consists of several subscreens, operations to the
- returned instance will affect all its subscreens. Use the
- subscreens() function to retrieve access to a particular
- subscreen.
-
- \sa subScreens(), subScreenIndexAt()
-*/
-
-/*!
- \fn QList<QScreen*> QScreen::subScreens() const
- \since 4.2
-
- Returns a list of this screen's subscreens. Use the
- subScreenIndexAt() function to retrieve the index of a screen at a
- given position.
-
- Note that if \e this screen consists of several subscreens,
- operations to \e this instance will affect all subscreens by
- default.
-
- \sa instance(), subScreenIndexAt()
-*/
-
-/*!
- \fn int QScreen::physicalWidth() const
- \since 4.2
-
- Returns the physical width of the screen in millimeters.
-
- \sa width(), deviceWidth(), physicalHeight()
-*/
-
-/*!
- \fn int QScreen::physicalHeight() const
- \since 4.2
-
- Returns the physical height of the screen in millimeters.
-
- \sa height(), deviceHeight(), physicalWidth()
-*/
-
-/*!
- \fn virtual bool QScreen::initDevice() = 0
-
- This function is called by the \l{Qt for Embedded Linux} server to
- initialize the framebuffer. Note that a server application will call the
- connect() function prior to this function.
-
- Implement this function to make accelerated drivers set up the
- graphics card. Return true to indicate success and false to indicate
- failure.
-
- \sa shutdownDevice(), connect()
-*/
-
-/*!
- \fn virtual bool QScreen::connect(const QString &displaySpec) = 0
-
- This function is called by every \l{Qt for Embedded Linux}
- application on startup, and must be implemented to map in the
- framebuffer and the accelerated drivers that the graphics card
- control registers. Note that connect must be called \e before
- the initDevice() function.
-
- Ensure that true is returned if a connection to the screen device
- is made. Otherwise, return false. Upon making the connection, the
- function should read out the parameters of the framebuffer and use
- them as required to set this class's protected variables.
-
- The \a displaySpec argument is passed by the QWS_DISPLAY
- environment variable or the -display command line parameter, and
- has the following syntax:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qscreen_qws.cpp 0
-
- For example, to use the mach64 driver on fb1 as display 2:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qscreen_qws.cpp 1
-
- See \l{Qt for Embedded Linux Display Management} for more details.
-
- \sa disconnect(), initDevice(), {Running Qt for Embedded Linux Applications}
-*/
-
-/*!
- \fn QScreen::disconnect()
-
- This function is called by every \l{Qt for Embedded Linux} application
- before exiting, and must be implemented to unmap the
- framebuffer. Note that a server application will call the
- shutdownDevice() function prior to this function.
-
- \sa connect(), shutdownDevice(), {Running Qt for Embedded Linux
- Applications}
-*/
-
-/*!
- \fn QScreen::setMode(int width, int height, int depth)
-
- Implement this function to reset the framebuffer's resolution (\a
- width and \a height) and bit \a depth.
-
- After the resolution has been set, existing paint engines will be
- invalid and the framebuffer should be completely redrawn. In a
- multiple-process situation, all other applications must be
- notified to reset their mode and update themselves accordingly.
-*/
-
-/*!
- \fn QScreen::blank(bool on)
-
- Prevents the screen driver form displaying any content on the
- screen.
-
- Note that the default implementation does nothing.
-
- Reimplement this function to prevent the screen driver from
- displaying any contents on the screen if \a on is true; otherwise
- the contents is expected to be shown.
-
- \sa blit()
-*/
-
-/*!
- \fn int QScreen::pixmapOffsetAlignment()
-
- Returns the value (in bits) to which the start address of pixmaps
- held in the graphics card's memory, should be aligned.
-
- Note that the default implementation returns 64; reimplement this
- function to override the return value, e.g., when implementing an
- accelerated driver (see the \l {Adding an Accelerated Graphics
- Driver to Qt for Embedded Linux}{Adding an Accelerated Graphics Driver}
- documentation for details).
-
- \sa pixmapLinestepAlignment()
-*/
-
-/*!
- \fn int QScreen::pixmapLinestepAlignment()
-
- Returns the value (in bits) to which individual scanlines of
- pixmaps held in the graphics card's memory, should be
- aligned.
-
- Note that the default implementation returns 64; reimplement this
- function to override the return value, e.g., when implementing an
- accelerated driver (see the \l {Adding an Accelerated Graphics
- Driver to Qt for Embedded Linux}{Adding an Accelerated Graphics Driver}
- documentation for details).
-
- \sa pixmapOffsetAlignment()
-*/
-
-/*!
- \fn QScreen::width() const
-
- Returns the logical width of the framebuffer in pixels.
-
- \sa deviceWidth(), physicalWidth(), height()
-*/
-
-/*!
- \fn int QScreen::height() const
-
- Returns the logical height of the framebuffer in pixels.
-
- \sa deviceHeight(), physicalHeight(), width()
-*/
-
-/*!
- \fn QScreen::depth() const
-
- Returns the depth of the framebuffer, in bits per pixel.
-
- Note that the returned depth is the number of bits each pixel
- fills rather than the number of significant bits, so 24bpp and
- 32bpp express the same range of colors (8 bits of red, green and
- blue).
-
- \sa clut(), pixmapDepth()
-*/
-
-/*!
- \fn int QScreen::pixmapDepth() const
-
- Returns the preferred depth for pixmaps, in bits per pixel.
-
- \sa depth()
-*/
-
-/*!
- \fn QScreen::linestep() const
-
- Returns the length of each scanline of the framebuffer in bytes.
-
- \sa isInterlaced()
-*/
-
-/*!
- \fn QScreen::deviceWidth() const
-
- Returns the physical width of the framebuffer device in pixels.
-
- Note that the returned width can differ from the width which
- \l{Qt for Embedded Linux} will actually use, that is if the display is
- centered within the framebuffer.
-
- \sa width(), physicalWidth(), deviceHeight()
-*/
-
-/*!
- \fn QScreen::deviceHeight() const
-
- Returns the full height of the framebuffer device in pixels.
-
- Note that the returned height can differ from the height which
- \l{Qt for Embedded Linux} will actually use, that is if the display is
- centered within the framebuffer.
-
- \sa height(), physicalHeight(), deviceWidth()
-*/
-
-/*!
- \fn uchar *QScreen::base() const
-
- Returns a pointer to the beginning of the framebuffer.
-
- \sa onCard(), region(), totalSize()
-*/
-
-/*!
- \fn uchar *QScreen::cache(int)
-
- \internal
-
- This function is used to store pixmaps in graphics memory for the
- use of the accelerated drivers. See QLinuxFbScreen (where the
- caching is implemented) for more information.
-*/
-
-/*!
- \fn QScreen::uncache(uchar *)
-
- \internal
-
- This function is called on pixmap destruction to remove them from
- graphics card memory.
-*/
-
-/*!
- \fn QScreen::screenSize() const
-
- Returns the size of the screen in bytes.
-
- The screen size is always located at the beginning of framebuffer
- memory, i.e. it can also be retrieved using the base() function.
-
- \sa base(), region()
-*/
-
-/*!
- \fn QScreen::totalSize() const
-
- Returns the size of the available graphics card memory (including
- the screen) in bytes.
-
- \sa onCard()
-*/
-
-// Unaccelerated screen/driver setup. Can be overridden by accelerated
-// drivers
-
-/*!
- \fn QScreen::QScreen(int displayId)
-
- Constructs a new screen driver.
-
- The \a displayId identifies the \l{Qt for Embedded Linux} server to connect
- to.
-*/
-
-/*!
- \fn QScreen::clut()
-
- Returns a pointer to the screen's color lookup table (i.e. its
- color palette).
-
- Note that this function only apply in paletted modes like 8-bit,
- i.e. in modes where only the palette indexes (and not the actual
- color values) are stored in memory.
-
- \sa alloc(), depth(), colorCount()
-*/
-
-/*!
- \obsolete
- \fn int QScreen::numCols()
-
- \sa colorCount()
-*/
-
-/*!
- \since 4.6
- \fn int QScreen::colorCount()
-
- Returns the number of entries in the screen's color lookup table
- (i.e. its color palette). A pointer to the color table can be
- retrieved using the clut() function.
-
- \sa clut(), alloc()
-*/
-
-/*!
- \since 4.4
-
- Constructs a new screen driver.
-
- The \a display_id identifies the \l{Qt for Embedded Linux}
- server to connect to. The \a classId specifies the class
- identifier.
-*/
-QScreen::QScreen(int display_id, ClassId classId)
- : screencols(0), data(0), entries(0), entryp(0), lowest(0),
- w(0), lstep(0), h(0), d(1), pixeltype(NormalPixel), grayscale(false),
- dw(0), dh(0), size(0), mapsize(0), displayId(display_id),
- physWidth(0), physHeight(0), d_ptr(new QScreenPrivate(this, classId))
-{
- clearCacheFunc = 0;
-}
-
-QScreen::QScreen(int display_id)
- : screencols(0), data(0), entries(0), entryp(0), lowest(0),
- w(0), lstep(0), h(0), d(1), pixeltype(NormalPixel), grayscale(false),
- dw(0), dh(0), size(0), mapsize(0), displayId(display_id),
- physWidth(0), physHeight(0), d_ptr(new QScreenPrivate(this))
-{
- clearCacheFunc = 0;
-}
-
-/*!
- Destroys this screen driver.
-*/
-
-QScreen::~QScreen()
-{
- delete d_ptr;
-}
-
-/*!
- This function is called by the \l{Qt for Embedded Linux} server before it
- calls the disconnect() function when exiting.
-
- Note that the default implementation only hides the mouse cursor;
- reimplement this function to do the necessary graphics card
- specific cleanup.
-
- \sa initDevice(), disconnect()
-*/
-
-void QScreen::shutdownDevice()
-{
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor)
- qt_screencursor->hide();
-#endif
-}
-
-extern bool qws_accel; //in qapplication_qws.cpp
-
-/*!
- \fn PixelType QScreen::pixelType() const
-
- Returns the pixel storage format of the screen.
-*/
-
-/*!
- Returns the pixel format of the screen, or \c QImage::Format_Invalid
- if the pixel format is not a supported image format.
-
-*/
-QImage::Format QScreen::pixelFormat() const
-{
- return d_ptr->pixelFormat;
-}
-
-/*!
- Sets the screen's pixel format to \a format.
- */
-void QScreen::setPixelFormat(QImage::Format format)
-{
- d_ptr->pixelFormat = format;
-}
-
-
-/*!
- \fn int QScreen::alloc(unsigned int red, unsigned int green, unsigned int blue)
-
- Returns the index in the screen's palette which is the closest
- match to the given RGB value (\a red, \a green, \a blue).
-
- Note that this function only apply in paletted modes like 8-bit,
- i.e. in modes where only the palette indexes (and not the actual
- color values) are stored in memory.
-
- \sa clut(), colorCount()
-*/
-
-int QScreen::alloc(unsigned int r,unsigned int g,unsigned int b)
-{
- int ret = 0;
- if (d == 8) {
- if (grayscale)
- return qGray(r, g, b);
-
- // First we look to see if we match a default color
- const int pos = (r + 25) / 51 * 36 + (g + 25) / 51 * 6 + (b + 25) / 51;
- if (pos < screencols && screenclut[pos] == qRgb(r, g, b)) {
- return pos;
- }
-
- // search for nearest color
- unsigned int mindiff = 0xffffffff;
- unsigned int diff;
- int dr,dg,db;
-
- for (int loopc = 0; loopc < screencols; ++loopc) {
- dr = qRed(screenclut[loopc]) - r;
- dg = qGreen(screenclut[loopc]) - g;
- db = qBlue(screenclut[loopc]) - b;
- diff = dr*dr + dg*dg + db*db;
-
- if (diff < mindiff) {
- ret = loopc;
- if (!diff)
- break;
- mindiff = diff;
- }
- }
- } else if (d == 4) {
- ret = qGray(r, g, b) >> 4;
- } else if (d == 1) {
- ret = qGray(r, g, b) >= 128;
- } else {
- qFatal("cannot alloc %dbpp color", d);
- }
-
- return ret;
-}
-
-/*!
- Saves the current state of the graphics card.
-
- For example, hardware screen drivers should reimplement the save()
- and restore() functions to save and restore its registers,
- enabling swintching between virtual consoles.
-
- Note that the default implementation does nothing.
-
- \sa restore()
-*/
-
-void QScreen::save()
-{
-}
-
-/*!
- Restores the previously saved state of the graphics card.
-
- For example, hardware screen drivers should reimplement the save()
- and restore() functions to save and restore its registers,
- enabling swintching between virtual consoles.
-
- Note that the default implementation does nothing.
-
- \sa save()
-*/
-
-void QScreen::restore()
-{
-}
-
-void QScreen::blank(bool)
-{
-}
-
-/*!
- \internal
-*/
-
-void QScreen::set(unsigned int, unsigned int, unsigned int, unsigned int)
-{
-}
-
-/*!
- \fn bool QScreen::supportsDepth(int depth) const
-
- Returns true if the screen supports the specified color \a depth;
- otherwise returns false.
-
- \sa clut()
-*/
-
-bool QScreen::supportsDepth(int d) const
-{
- if (false) {
- //Just to simplify the ifdeffery
-#ifdef QT_QWS_DEPTH_1
- } else if(d==1) {
- return true;
-#endif
-#ifdef QT_QWS_DEPTH_4
- } else if(d==4) {
- return true;
-#endif
-#ifdef QT_QWS_DEPTH_8
- } else if(d==8) {
- return true;
-#endif
-#ifdef QT_QWS_DEPTH_16
- } else if(d==16) {
- return true;
-#endif
-#ifdef QT_QWS_DEPTH_15
- } else if (d == 15) {
- return true;
-#endif
-#ifdef QT_QWS_DEPTH_18
- } else if(d==18 || d==19) {
- return true;
-#endif
-#ifdef QT_QWS_DEPTH_24
- } else if(d==24) {
- return true;
-#endif
-#ifdef QT_QWS_DEPTH_32
- } else if(d==32) {
- return true;
-#endif
- }
- return false;
-}
-
-/*!
- \fn bool QScreen::onCard(const unsigned char *buffer) const
-
- Returns true if the specified \a buffer is within the graphics
- card's memory; otherwise returns false (i.e. if it's in main RAM).
-
- \sa base(), totalSize()
-*/
-
-bool QScreen::onCard(const unsigned char * p) const
-{
- long t=(unsigned long)p;
- long bmin=(unsigned long)data;
- if (t < bmin)
- return false;
- if(t >= bmin+mapsize)
- return false;
- return true;
-}
-
-/*!
- \fn bool QScreen::onCard(const unsigned char * buffer, ulong& offset) const
- \overload
-
- If the specified \a buffer is within the graphics card's memory,
- this function stores the offset from the start of graphics card
- memory (in bytes), in the location specified by the \a offset
- parameter.
-*/
-
-bool QScreen::onCard(const unsigned char * p, ulong& offset) const
-{
- long t=(unsigned long)p;
- long bmin=(unsigned long)data;
- if (t < bmin)
- return false;
- long o = t - bmin;
- if (o >= mapsize)
- return false;
- offset = o;
- return true;
-}
-
-/*
-#if !defined(QT_NO_QWS_REPEATER)
- { "Repeater", qt_get_screen_repeater, 0 },
-#endif
-#if defined(QT_QWS_EE)
- { "EE", qt_get_screen_ee, 0 },
-#endif
-
-*/
-
-/*
-Given a display_id (number of the \l{Qt for Embedded Linux} server to connect to)
-and a spec (e.g. Mach64:/dev/fb0) return a QScreen-descendant.
-The QScreenDriverFactory is queried for a suitable driver and, if found,
-asked to create a driver.
-People writing new graphics drivers should either hook their own
-QScreen-descendant into QScreenDriverFactory or use the QScreenDriverPlugin
-to make a dynamically loadable driver.
-*/
-
-Q_GUI_EXPORT QScreen* qt_get_screen(int display_id, const char *spec)
-{
- QString displaySpec = QString::fromAscii(spec);
- QString driver = displaySpec;
- int colon = displaySpec.indexOf(QLatin1Char(':'));
- if (colon >= 0)
- driver.truncate(colon);
- driver = driver.trimmed();
-
- bool foundDriver = false;
- QString driverName = driver;
-
- QStringList driverList;
- if (!driver.isEmpty())
- driverList << driver;
- else
- driverList = QScreenDriverFactory::keys();
-
- for (int i = 0; i < driverList.size(); ++i) {
- const QString driverName = driverList.at(i);
- qt_screen = QScreenDriverFactory::create(driverName, display_id);
- if (qt_screen) {
- foundDriver = true;
- if (qt_screen->connect(displaySpec)) {
- return qt_screen;
- } else {
- delete qt_screen;
- qt_screen = 0;
- }
- }
- }
-
- if (driver.isNull())
- qFatal("No suitable driver found");
- else if (foundDriver)
- qFatal("%s: driver cannot connect", driver.toLatin1().constData());
- else
- qFatal("%s: driver not found", driver.toLatin1().constData());
-
- return 0;
-}
-
-#ifndef QT_NO_QWS_CURSOR
-static void blendCursor(QImage *dest, const QImage &cursor, const QPoint &offset)
-{
- QRasterBuffer rb;
- rb.prepare(dest);
-
- QSpanData spanData;
- spanData.init(&rb, 0);
- spanData.type = QSpanData::Texture;
- spanData.initTexture(&cursor, 256);
- spanData.dx = -offset.x();
- spanData.dy = -offset.y();
- if (!spanData.blend)
- return;
-
- const QRect rect = QRect(offset, cursor.size())
- & QRect(QPoint(0, 0), dest->size());
- const int w = rect.width();
- const int h = rect.height();
-
- QVarLengthArray<QT_FT_Span, 32> spans(h);
- for (int i = 0; i < h; ++i) {
- spans[i].x = rect.x();
- spans[i].len = w;
- spans[i].y = rect.y() + i;
- spans[i].coverage = 255;
- }
- spanData.blend(h, spans.constData(), &spanData);
-}
-#endif // QT_NO_QWS_CURSOR
-
-/*!
- \fn void QScreen::exposeRegion(QRegion region, int windowIndex)
-
- This function is called by the \l{Qt for Embedded Linux} server whenever a
- screen update is required. \a region is the area on the screen
- that must be updated, and \a windowIndex is the index into
- QWSServer::clientWindows() of the window that required the
- update. QWSWindow::state() gives more information about the cause.
-
- The default implementation composes the
- affected windows and paints the given \a region on screen by
- calling the blit() and solidFill() functions
-
- This function can be reimplemented to perform composition in
- hardware, or to perform transition effects.
- For simpler hardware acceleration, or to interface with
- this is typically done by reimplementing the blit() and
- solidFill() functions instead.
-
- Note that there is no need to call this function explicitly.
-
- \sa blit(), solidFill(), blank()
-*/
-void QScreen::exposeRegion(QRegion r, int windowIndex)
-{
- r &= region();
- if (r.isEmpty())
- return;
-
- int changing = windowIndex;
- // when we have just lowered a window, we have to expose all the windows below where the
- // window used to be.
- if (changing && qwsServer->clientWindows().at(changing)->state() == QWSWindow::Lowering)
- changing = 0;
-#ifdef QTOPIA_PERFTEST
- static enum { PerfTestUnknown, PerfTestOn, PerfTestOff } perfTestState = PerfTestUnknown;
- if(PerfTestUnknown == perfTestState) {
- if(::getenv("QTOPIA_PERFTEST"))
- perfTestState = PerfTestOn;
- else
- perfTestState = PerfTestOff;
- }
- if(PerfTestOn == perfTestState) {
- QWSWindow *changed = qwsServer->clientWindows().at(changing);
- if(!changed->client()->identity().isEmpty())
- qDebug() << "Performance : expose_region :"
- << changed->client()->identity()
- << r.boundingRect() << ": "
- << qPrintable( QTime::currentTime().toString( "h:mm:ss.zzz" ) );
- }
-#endif
-
- const QRect bounds = r.boundingRect();
- QRegion blendRegion;
- QImage *blendBuffer = 0;
-
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor && !qt_screencursor->isAccelerated()) {
- blendRegion = r & qt_screencursor->boundingRect();
- }
-#endif
- compose(0, r, blendRegion, &blendBuffer, changing);
-
- if (blendBuffer && !blendBuffer->isNull()) {
- const QPoint offset = blendRegion.boundingRect().topLeft();
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor && !qt_screencursor->isAccelerated()) {
- const QRect cursorRect = qt_screencursor->boundingRect();
- if (blendRegion.intersects(cursorRect)) {
- blendCursor(blendBuffer, qt_screencursor->image(),
- cursorRect.topLeft() - offset);
- }
- }
-#endif // QT_NO_QWS_CURSOR
- blit(*blendBuffer, offset, blendRegion);
- delete blendBuffer;
- }
-
- if (r.rectCount() == 1) {
- setDirty(r.boundingRect());
- } else {
- const QVector<QRect> rects = r.rects();
- for (int i = 0; i < rects.size(); ++i)
- setDirty(rects.at(i));
- }
-}
-
-/*!
- \fn void QScreen::blit(const QImage &image, const QPoint &topLeft, const QRegion &region)
-
- Copies the given \a region in the given \a image to the point
- specified by \a topLeft using device coordinates.
-
- This function is called from the exposeRegion() function; it is
- not intended to be called explicitly.
-
- Reimplement this function to make use of \l{Adding an Accelerated
- Graphics Driver to Qt for Embedded Linux}{accelerated hardware}. Note that
- this function must be reimplemented if the framebuffer format is
- not supported by \l{Qt for Embedded Linux} (See the
- \l{Qt for Embedded Linux Display Management}{Display Management}
- documentation for more details).
-
- \sa exposeRegion(), solidFill(), blank()
-*/
-void QScreen::blit(const QImage &img, const QPoint &topLeft, const QRegion &reg)
-{
- const QRect bound = (region() & QRect(topLeft, img.size())).boundingRect();
- QWSDisplay::grab();
- d_ptr->blit(this, img, topLeft - offset(),
- (reg & bound).translated(-topLeft));
- QWSDisplay::ungrab();
-}
-
-#ifdef QT_QWS_CLIENTBLIT
-/*!
- Returns true if this screen driver supports calling QScreen::blit() and
- QScreen::setDirty() directly from non-server applications, otherwise returns
- false.
-
- If available, this is used to optimize the performance of non-occluded, opaque
- client windows by removing the server round trip when they are updated.
-
- \sa setSupportsBlitInClients()
- */
-bool QScreen::supportsBlitInClients() const
-{
- return d_ptr->supportsBlitInClients;
-}
-
-/*!
- If \a supported, the screen driver is marked as supporting blitting directly
- from non-server applications.
-
- \sa supportsBlitInClients()
- */
-void QScreen::setSupportsBlitInClients(bool supported)
-{
- d_ptr->supportsBlitInClients = supported;
-}
-#endif
-
-/*!
- \internal
-*/
-
-void QScreen::blit(QWSWindow *win, const QRegion &clip)
-{
- QWSWindowSurface *surface = win->windowSurface();
- if (!surface)
- return;
-
- const QImage &img = surface->image();
- if (img.isNull())
- return;
-
- const QRegion rgn = clip & win->paintedRegion();
- if (rgn.isEmpty())
- return;
-
- surface->lock();
- blit(img, win->requestedRegion().boundingRect().topLeft(), rgn);
- surface->unlock();
-}
-
-struct fill_data {
- quint32 color;
- uchar *data;
- int lineStep;
- int x;
- int y;
- int w;
- int h;
-};
-
-/*!
- Fills the given \a region of the screen with the specified \a
- color.
-
- This function is called from the exposeRegion() function; it is
- not intended to be called explicitly.
-
- Reimplement this function to make use of \l{Adding an Accelerated
- Graphics Driver to Qt for Embedded Linux}{accelerated hardware}. Note that
- this function must be reimplemented if the framebuffer format is
- not supported by \l{Qt for Embedded Linux} (See the
- \l{Qt for Embedded Linux Display Management}{Display Management}
- documentation for more details).
-
- \sa exposeRegion(), blit(), blank()
-*/
-// the base class implementation works in device coordinates, so that transformed drivers can use it
-void QScreen::solidFill(const QColor &color, const QRegion &region)
-{
- QWSDisplay::grab();
- d_ptr->solidFill(this, color,
- region.translated(-offset()) & QRect(0, 0, dw, dh));
- QWSDisplay::ungrab();
-}
-
-/*!
- \since 4.2
-
- Creates and returns a new window surface matching the given \a
- key.
-
- The server application will call this function whenever it needs
- to create a server side representation of a window, e.g. when
- copying the content of memory to the screen using the screen
- driver.
-
- Note that this function must be reimplemented when adding an
- accelerated graphics driver. See the
- \l{Adding an Accelerated Graphics Driver to Qt for Embedded Linux}
- {Adding an Accelerated Graphics Driver} documentation for details.
-
- \sa {Qt for Embedded Linux Architecture}
-*/
-QWSWindowSurface* QScreen::createSurface(const QString &key) const
-{
-#ifndef QT_NO_PAINTONSCREEN
- if (key == QLatin1String("OnScreen"))
- return new QWSOnScreenSurface;
- else
-#endif
- if (key == QLatin1String("mem"))
- return new QWSLocalMemSurface;
-#ifndef QT_NO_QWS_MULTIPROCESS
- else if (key == QLatin1String("shm"))
- return new QWSSharedMemSurface;
-#endif
-#ifndef QT_NO_PAINT_DEBUG
- else if (key == QLatin1String("Yellow"))
- return new QWSYellowSurface;
-#endif
-#ifndef QT_NO_DIRECTPAINTER
- else if (key == QLatin1String("DirectPainter"))
- return new QWSDirectPainterSurface;
-#endif
-
- return 0;
-}
-
-#ifndef QT_NO_PAINTONSCREEN
-bool QScreen::isWidgetPaintOnScreen(const QWidget *w)
-{
- static int doOnScreen = -1;
- if (doOnScreen == -1) {
- const QByteArray env = qgetenv("QT_ONSCREEN_PAINT");
- if (env == "force")
- doOnScreen = 2;
- else
- doOnScreen = (env.toInt() > 0 ? 1 : 0);
- }
-
- if (doOnScreen == 2) // force
- return true;
-
- if (doOnScreen == 0 && !w->testAttribute(Qt::WA_PaintOnScreen))
- return false;
-
- return w->d_func()->isOpaque;
-}
-#endif
-
-/*!
- \overload
-
- Creates and returns a new window surface for the given \a widget.
-*/
-QWSWindowSurface* QScreen::createSurface(QWidget *widget) const
-{
-#ifndef QT_NO_PAINTONSCREEN
- if (isWidgetPaintOnScreen(widget) && base())
- return new QWSOnScreenSurface(widget);
- else
-#endif
- if (QApplication::type() == QApplication::GuiServer)
- return new QWSLocalMemSurface(widget);
-#ifndef QT_NO_QWS_MULTIPROCESS
- else
- return new QWSSharedMemSurface(widget);
-#endif
-
- return 0;
-}
-
-void QScreen::compose(int level, const QRegion &exposed, QRegion &blend,
- QImage **blendbuffer, int changing_level)
-{
- QRect exposed_bounds = exposed.boundingRect();
- QWSWindow *win = 0;
- do {
- win = qwsServer->clientWindows().value(level); // null is background
- ++level;
- } while (win && !win->paintedRegion().boundingRect().intersects(exposed_bounds));
-
- QWSWindowSurface *surface = (win ? win->windowSurface() : 0);
- bool above_changing = level <= changing_level; // 0 is topmost
-
- QRegion exposedBelow = exposed;
- bool opaque = true;
-
- if (win) {
- opaque = win->isOpaque() || !surface->isBuffered();
- if (opaque) {
- exposedBelow -= win->paintedRegion();
- if (above_changing || !surface->isBuffered())
- blend -= exposed & win->paintedRegion();
- } else {
- blend += exposed & win->paintedRegion();
- }
- }
- if (win && !exposedBelow.isEmpty()) {
- compose(level, exposedBelow, blend, blendbuffer, changing_level);
- } else {
- QSize blendSize = blend.boundingRect().size();
- if (!blendSize.isNull()) {
- *blendbuffer = new QImage(blendSize, d_ptr->preferredImageFormat());
- }
- }
-
- const QRegion blitRegion = exposed - blend;
- if (!win)
- paintBackground(blitRegion);
- else if (!above_changing && surface->isBuffered())
- blit(win, blitRegion);
-
- QRegion blendRegion = exposed & blend;
-
- if (win)
- blendRegion &= win->paintedRegion();
- if (!blendRegion.isEmpty()) {
-
- QPoint off = blend.boundingRect().topLeft();
-
- QRasterBuffer rb;
- rb.prepare(*blendbuffer);
- QSpanData spanData;
- spanData.init(&rb, 0);
- if (!win) {
- const QImage::Format format = (*blendbuffer)->format();
- switch (format) {
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB4444_Premultiplied:
- spanData.rasterBuffer->compositionMode = QPainter::CompositionMode_Source;
- break;
- default:
- break;
- }
- spanData.setup(qwsServer->backgroundBrush(), 256, QPainter::CompositionMode_Source);
- spanData.dx = off.x();
- spanData.dy = off.y();
- } else if (!surface->isBuffered()) {
- return;
- } else {
- const QImage &img = surface->image();
- QPoint winoff = off - win->requestedRegion().boundingRect().topLeft();
- // convert win->opacity() from scale [0..255] to [0..256]
- int const_alpha = win->opacity();
- const_alpha += (const_alpha >> 7);
- spanData.type = QSpanData::Texture;
- spanData.initTexture(&img, const_alpha);
- spanData.dx = winoff.x();
- spanData.dy = winoff.y();
- }
- if (!spanData.blend)
- return;
-
- if (surface)
- surface->lock();
- const QVector<QRect> rects = blendRegion.rects();
- const int nspans = 256;
- QT_FT_Span spans[nspans];
- for (int i = 0; i < rects.size(); ++i) {
- int y = rects.at(i).y() - off.y();
- int ye = y + rects.at(i).height();
- int x = rects.at(i).x() - off.x();
- int len = rects.at(i).width();
- while (y < ye) {
- int n = qMin(nspans, ye - y);
- int i = 0;
- while (i < n) {
- spans[i].x = x;
- spans[i].len = len;
- spans[i].y = y + i;
- spans[i].coverage = 255;
- ++i;
- }
- spanData.blend(n, spans, &spanData);
- y += n;
- }
- }
- if (surface)
- surface->unlock();
- }
-}
-
-void QScreen::paintBackground(const QRegion &r)
-{
- const QBrush &bg = qwsServer->backgroundBrush();
- Qt::BrushStyle bs = bg.style();
- if (bs == Qt::NoBrush || r.isEmpty())
- return;
-
- if (bs == Qt::SolidPattern) {
- solidFill(bg.color(), r);
- } else {
- const QRect br = r.boundingRect();
- QImage img(br.size(), d_ptr->preferredImageFormat());
- QPoint off = br.topLeft();
- QRasterBuffer rb;
- rb.prepare(&img);
- QSpanData spanData;
- spanData.init(&rb, 0);
- spanData.setup(bg, 256, QPainter::CompositionMode_Source);
- spanData.dx = off.x();
- spanData.dy = off.y();
- Q_ASSERT(spanData.blend);
-
- const QVector<QRect> rects = r.rects();
- const int nspans = 256;
- QT_FT_Span spans[nspans];
- for (int i = 0; i < rects.size(); ++i) {
- int y = rects.at(i).y() - off.y();
- int ye = y + rects.at(i).height();
- int x = rects.at(i).x() - off.x();
- int len = rects.at(i).width();
- while (y < ye) {
- int n = qMin(nspans, ye - y);
- int i = 0;
- while (i < n) {
- spans[i].x = x;
- spans[i].len = len;
- spans[i].y = y + i;
- spans[i].coverage = 255;
- ++i;
- }
- spanData.blend(n, spans, &spanData);
- y += n;
- }
- }
- blit(img, br.topLeft(), r);
- }
-}
-
-/*!
- \fn virtual int QScreen::sharedRamSize(void *)
-
- \internal
-*/
-
-/*!
- \fn QScreen::setDirty(const QRect& rectangle)
-
- Marks the given \a rectangle as dirty.
-
- Note that the default implementation does nothing; reimplement
- this function to indicate that the given \a rectangle has been
- altered.
-*/
-
-void QScreen::setDirty(const QRect&)
-{
-}
-
-/*!
- \fn QScreen::isTransformed() const
-
- Returns true if the screen is transformed (for instance, rotated
- 90 degrees); otherwise returns false.
-
- \sa transformOrientation(), isInterlaced()
-*/
-
-bool QScreen::isTransformed() const
-{
- return false;
-}
-
-/*!
- \fn QScreen::isInterlaced() const
-
- Returns true if the display is interlaced (i.e. is displaying
- images progressively like a television screen); otherwise returns
- false.
-
- If the display is interlaced, the drawing is altered to look
- better.
-
- \sa isTransformed(), linestep()
-*/
-
-bool QScreen::isInterlaced() const
-{
- return false;//qws_screen_is_interlaced;;
-}
-
-/*!
- \fn QScreen::mapToDevice(const QSize &size) const
-
- Maps the given \a size from the coordinate space used by the
- application to the framebuffer coordinate system. Note that the
- default implementation simply returns the given \a size as it is.
-
- Reimplement this function to use the given device's coordinate
- system when mapping.
-
- \sa mapFromDevice()
-*/
-
-QSize QScreen::mapToDevice(const QSize &s) const
-{
- return s;
-}
-
-/*!
- \fn QScreen::mapFromDevice(const QSize &size) const
-
- Maps the given \a size from the framebuffer coordinate system to
- the coordinate space used by the application. Note that the
- default implementation simply returns the given \a size as it is.
-
- Reimplement this function to use the given device's coordinate
- system when mapping.
-
- \sa mapToDevice()
-*/
-
-QSize QScreen::mapFromDevice(const QSize &s) const
-{
- return s;
-}
-
-/*!
- \fn QScreen::mapToDevice(const QPoint &point, const QSize &screenSize) const
- \overload
-
- Maps the given \a point from the coordinate space used by the
- application to the framebuffer coordinate system, passing the
- device's \a screenSize as argument. Note that the default
- implementation returns the given \a point as it is.
-*/
-
-QPoint QScreen::mapToDevice(const QPoint &p, const QSize &) const
-{
- return p;
-}
-
-/*!
- \fn QScreen::mapFromDevice(const QPoint &point, const QSize &screenSize) const
- \overload
-
- Maps the given \a point from the framebuffer coordinate system to
- the coordinate space used by the application, passing the device's
- \a screenSize as argument. Note that the default implementation
- simply returns the given \a point as it is.
-*/
-
-QPoint QScreen::mapFromDevice(const QPoint &p, const QSize &) const
-{
- return p;
-}
-
-/*!
- \fn QScreen::mapToDevice(const QRect &rectangle, const QSize &screenSize) const
- \overload
-
- Maps the given \a rectangle from the coordinate space used by the
- application to the framebuffer coordinate system, passing the
- device's \a screenSize as argument. Note that the default
- implementation returns the given \a rectangle as it is.
-*/
-
-QRect QScreen::mapToDevice(const QRect &r, const QSize &) const
-{
- return r;
-}
-
-/*!
- \fn QScreen::mapFromDevice(const QRect &rectangle, const QSize &screenSize) const
- \overload
-
- Maps the given \a rectangle from the framebuffer coordinate system to
- the coordinate space used by the application, passing the device's
- \a screenSize as argument. Note that the default implementation
- simply returns the given \a rectangle as it is.
-*/
-
-QRect QScreen::mapFromDevice(const QRect &r, const QSize &) const
-{
- return r;
-}
-
-/*!
- \fn QScreen::mapToDevice(const QImage &image) const
- \overload
-
- Maps the given \a image from the coordinate space used by the
- application to the framebuffer coordinate system. Note that the
- default implementation returns the given \a image as it is.
-*/
-
-QImage QScreen::mapToDevice(const QImage &i) const
-{
- return i;
-}
-
-/*!
- \fn QScreen::mapFromDevice(const QImage &image) const
- \overload
-
- Maps the given \a image from the framebuffer coordinate system to
- the coordinate space used by the application. Note that the
- default implementation simply returns the given \a image as it is.
-*/
-
-QImage QScreen::mapFromDevice(const QImage &i) const
-{
- return i;
-}
-
-/*!
- \fn QScreen::mapToDevice(const QRegion &region, const QSize &screenSize) const
- \overload
-
- Maps the given \a region from the coordinate space used by the
- application to the framebuffer coordinate system, passing the
- device's \a screenSize as argument. Note that the default
- implementation returns the given \a region as it is.
-*/
-
-QRegion QScreen::mapToDevice(const QRegion &r, const QSize &) const
-{
- return r;
-}
-
-/*!
- \fn QScreen::mapFromDevice(const QRegion &region, const QSize &screenSize) const
- \overload
-
- Maps the given \a region from the framebuffer coordinate system to
- the coordinate space used by the application, passing the device's
- \a screenSize as argument. Note that the default implementation
- simply returns the given \a region as it is.
-*/
-
-QRegion QScreen::mapFromDevice(const QRegion &r, const QSize &) const
-{
- return r;
-}
-
-/*!
- \fn QScreen::transformOrientation() const
-
- Returns the current rotation as an integer value.
-
- Note that the default implementation returns 0; reimplement this
- function to override this value.
-
- \sa isTransformed()
-*/
-
-int QScreen::transformOrientation() const
-{
- return 0;
-}
-
-int QScreen::pixmapDepth() const
-{
- return depth();
-}
-
-/*!
- \internal
-*/
-int QScreen::memoryNeeded(const QString&)
-{
- return 0;
-}
-
-/*!
- \internal
-*/
-void QScreen::haltUpdates()
-{
-}
-
-/*!
- \internal
-*/
-void QScreen::resumeUpdates()
-{
-}
-
-/*!
- \fn QRegion QScreen::region() const
- \since 4.2
-
- Returns the region covered by this screen driver.
-
- \sa base(), screenSize()
-*/
-
-/*!
- \internal
-*/
-void QScreen::setOffset(const QPoint &p)
-{
- d_ptr->offset = p;
-}
-
-/*!
- \since 4.2
-
- Returns the logical offset of the screen, i.e., the offset between
- (0,0) in screen coordinates and the application coordinate system.
-*/
-QPoint QScreen::offset() const
-{
- return d_ptr->offset;
-}
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-void QScreen::setFrameBufferLittleEndian(bool littleEndian)
-{
- d_ptr->fb_is_littleEndian = littleEndian;
-}
-
-bool QScreen::frameBufferLittleEndian() const
-{
- return d_ptr->fb_is_littleEndian;
-}
-#endif
-
-/*!
- \fn int QScreen::subScreenIndexAt(const QPoint &position) const
- \since 4.2
-
- Returns the index of the subscreen at the given \a position;
- returns -1 if no screen is found.
-
- The index identifies the subscreen in the list of pointers
- returned by the subScreens() function.
-
- \sa instance(), subScreens()
-*/
-int QScreen::subScreenIndexAt(const QPoint &p) const
-{
- const QList<QScreen*> screens = subScreens();
- const int n = screens.count();
- for (int i = 0; i < n; ++i) {
- if (screens.at(i)->region().contains(p))
- return i;
- }
-
- return -1;
-}
-
-#if 0
-#ifdef QT_LOADABLE_MODULES
-#include <dlfcn.h>
-
-// ### needs update after driver init changes
-
-static QScreen * qt_dodriver(char * driver,char * a,unsigned char * b)
-
-{
- char buf[200];
- strcpy(buf,"/etc/qws/drivers/");
- qstrcpy(buf+17,driver);
- qDebug("Attempting driver %s",driver);
-
- void * handle;
- handle=dlopen(buf,RTLD_LAZY);
- if(handle==0) {
- qFatal("Module load error");
- }
- QScreen *(*qt_get_screen_func)(char *,unsigned char *);
- qt_get_screen_func=dlsym(handle,"qt_get_screen");
- if(qt_get_screen_func==0) {
- qFatal("Couldn't get symbol");
- }
- QScreen * ret=qt_get_screen_func(a,b);
- return ret;
-}
-
-static QScreen * qt_do_entry(char * entry)
-{
- unsigned char config[256];
-
- FILE * f=fopen(entry,"r");
- if(!f) {
- return 0;
- }
-
- int r=fread(config,256,1,f);
- if(r<1)
- return 0;
-
- fclose(f);
-
- unsigned short vendorid=*((unsigned short int *)config);
- unsigned short deviceid=*(((unsigned short int *)config)+1);
- if(config[0xb]!=3)
- return 0;
-
- if(vendorid==0x1002) {
- if(deviceid==0x4c4d) {
- qDebug("Compaq Armada/IBM Thinkpad's Mach64 card");
- return qt_dodriver("mach64.so",entry,config);
- } else if(deviceid==0x4742) {
- qDebug("Desktop Rage Pro Mach64 card");
- return qt_dodriver("mach64.so",entry,config);
- } else {
- qDebug("Unrecognised ATI card id %x",deviceid);
- return 0;
- }
- } else {
- qDebug("Unrecognised vendor");
- }
- return 0;
-}
-
-extern bool qws_accel;
-
-/// ** NOT SUPPPORTED **
-
-QScreen * qt_probe_bus()
-{
- if(!qws_accel) {
- return qt_dodriver("unaccel.so",0,0);
- }
-
- QT_DIR *dirptr = QT_OPENDIR("/proc/bus/pci");
- if(!dirptr)
- return qt_dodriver("unaccel.so",0,0);
- QT_DIR * dirptr2;
- QT_DIRENT *cards;
-
- QT_DIRENT *busses = QT_READDIR(dirptr);
-
- while(busses) {
- if(busses->d_name[0]!='.') {
- char buf[100];
- strcpy(buf,"/proc/bus/pci/");
- qstrcpy(buf+14,busses->d_name);
- int p=strlen(buf);
- dirptr2 = QT_OPENDIR(buf);
- if(dirptr2) {
- cards = QT_READDIR(dirptr2);
- while(cards) {
- if(cards->d_name[0]!='.') {
- buf[p]='/';
- qstrcpy(buf+p+1,cards->d_name);
- QScreen * ret=qt_do_entry(buf);
- if(ret)
- return ret;
- }
- cards = QT_READDIR(dirptr2);
- }
- QT_CLOSEDIR(dirptr2);
- }
- }
- busses = QT_READDIR(dirptr);
- }
- QT_CLOSEDIR(dirptr);
-
- return qt_dodriver("unaccel.so",0,0);
-}
-
-#else
-
-char *qt_qws_hardcoded_slot = "/proc/bus/pci/01/00.0";
-
-const unsigned char* qt_probe_bus()
-{
- const char * slot;
- slot=::getenv("QWS_CARD_SLOT");
- if(!slot)
- slot=qt_qws_hardcoded_slot;
- if (slot) {
- static unsigned char config[256];
- FILE * f=fopen(slot,"r");
- if(!f) {
- qDebug("Open failure for %s",slot);
- slot=0;
- } else {
- int r=fread((char*)config,256,1,f);
- fclose(f);
- if(r<1) {
- qDebug("Read failure");
- return 0;
- } else {
- return config;
- }
- }
- }
- return 0;
-}
-
-#endif
-
-#endif // 0
-
-/*!
- \internal
- \since 4.4
-*/
-void QScreen::setPixmapDataFactory(QPixmapDataFactory *factory)
-{
- static bool shownWarning = false;
- if (!shownWarning) {
- qWarning("QScreen::setPixmapDataFactory() is deprecated - use setGraphicsSystem() instead");
- shownWarning = true;
- }
-
- d_ptr->pixmapFactory = factory;
-}
-
-/*!
- \internal
- \since 4.4
-*/
-QPixmapDataFactory* QScreen::pixmapDataFactory() const
-{
- return d_ptr->pixmapFactory;
-}
-
-/*!
- \internal
- \since 4.5
-*/
-void QScreen::setGraphicsSystem(QGraphicsSystem* system)
-{
- d_ptr->graphicsSystem = system;
-}
-
-/*!
- \internal
- \since 4.5
-*/
-QGraphicsSystem* QScreen::graphicsSystem() const
-{
- return d_ptr->graphicsSystem;
-}
-
-/*!
- \since 4.4
-
- Returns the class identifier for the screen object.
-*/
-QScreen::ClassId QScreen::classId() const
-{
- return static_cast<ClassId>(d_ptr->classId);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h
deleted file mode 100644
index 85c775e377..0000000000
--- a/src/gui/embedded/qscreen_qws.h
+++ /dev/null
@@ -1,391 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREEN_QWS_H
-#define QSCREEN_QWS_H
-
-#include <QtCore/qnamespace.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qlist.h>
-#include <QtGui/qrgb.h>
-#include <QtCore/qrect.h>
-#include <QtGui/qimage.h>
-#include <QtGui/qregion.h>
-
-struct fb_cmap;
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QScreenCursor;
-class QBrush;
-class QWSWindow;
-class QWSWindowSurface;
-class QGraphicsSystem;
-class QPixmapData;
-
-#ifndef QT_QWS_DEPTH16_RGB
-#define QT_QWS_DEPTH16_RGB 565
-#endif
-static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100);
-static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10);
-static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10);
-static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits);
-static const int qt_green_shift = qt_bbits-(8-qt_gbits);
-static const int qt_neg_blue_shift = 8-qt_bbits;
-static const int qt_blue_mask = (1<<qt_bbits)-1;
-static const int qt_green_mask = (1<<(qt_gbits+qt_bbits))-(1<<qt_bbits);
-static const int qt_red_mask = (1<<(qt_rbits+qt_gbits+qt_bbits))-(1<<(qt_gbits+qt_bbits));
-
-static const int qt_red_rounding_shift = qt_red_shift + qt_rbits;
-static const int qt_green_rounding_shift = qt_green_shift + qt_gbits;
-static const int qt_blue_rounding_shift = qt_bbits - qt_neg_blue_shift;
-
-
-inline ushort qt_convRgbTo16(const int r, const int g, const int b)
-{
- const int tr = r << qt_red_shift;
- const int tg = g << qt_green_shift;
- const int tb = b >> qt_neg_blue_shift;
-
- return (tb & qt_blue_mask) | (tg & qt_green_mask) | (tr & qt_red_mask);
-}
-
-inline ushort qt_convRgbTo16(QRgb c)
-{
- const int tr = qRed(c) << qt_red_shift;
- const int tg = qGreen(c) << qt_green_shift;
- const int tb = qBlue(c) >> qt_neg_blue_shift;
-
- return (tb & qt_blue_mask) | (tg & qt_green_mask) | (tr & qt_red_mask);
-}
-
-inline QRgb qt_conv16ToRgb(ushort c)
-{
- const int r=(c & qt_red_mask);
- const int g=(c & qt_green_mask);
- const int b=(c & qt_blue_mask);
- const int tr = r >> qt_red_shift | r >> qt_red_rounding_shift;
- const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift;
- const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift;
-
- return qRgb(tr,tg,tb);
-}
-
-inline void qt_conv16ToRgb(ushort c, int& r, int& g, int& b)
-{
- const int tr=(c & qt_red_mask);
- const int tg=(c & qt_green_mask);
- const int tb=(c & qt_blue_mask);
- r = tr >> qt_red_shift | tr >> qt_red_rounding_shift;
- g = tg >> qt_green_shift | tg >> qt_green_rounding_shift;
- b = tb << qt_neg_blue_shift | tb >> qt_blue_rounding_shift;
-}
-
-const int SourceSolid=0;
-const int SourcePixmap=1;
-
-#ifndef QT_NO_QWS_CURSOR
-
-class QScreenCursor;
-extern QScreenCursor *qt_screencursor;
-extern bool qws_sw_cursor;
-
-class Q_GUI_EXPORT QScreenCursor
-{
-public:
- QScreenCursor();
- virtual ~QScreenCursor();
-
- virtual void set(const QImage &image, int hotx, int hoty);
- virtual void move(int x, int y);
- virtual void show();
- virtual void hide();
-
- bool supportsAlphaCursor() const { return supportsAlpha; }
-
- static bool enabled() { return qws_sw_cursor; }
-
- QRect boundingRect() const { return QRect(pos - hotspot, size); }
- QImage image() const { return cursor; }
- bool isVisible() const { return enable; }
- bool isAccelerated() const { return hwaccel; }
-
- static void initSoftwareCursor();
- static QScreenCursor* instance() { return qt_screencursor; }
-
-protected:
- QImage cursor;
-
- QSize size;
- QPoint pos;
- QPoint hotspot;
- uint enable : 1;
- uint hwaccel : 1;
- uint supportsAlpha : 1;
-
-private:
- friend class QProxyScreenCursor;
-};
-
-#endif // QT_NO_QWS_CURSOR
-
-// A (used) chunk of offscreen memory
-
-class QPoolEntry
-{
-public:
- unsigned int start;
- unsigned int end;
- int clientId;
-};
-
-class QScreen;
-class QScreenPrivate;
-class QPixmapDataFactory;
-
-extern Q_GUI_EXPORT QScreen *qt_screen;
-typedef void(*ClearCacheFunc)(QScreen *obj, int);
-
-class Q_GUI_EXPORT QScreen {
-
-public:
- enum ClassId { LinuxFBClass, TransformedClass, VNCClass, MultiClass,
- VFbClass, DirectFBClass, SvgalibClass, ProxyClass,
- GLClass, IntfbClass, CustomClass = 1024 };
-
- QScreen(int display_id, ClassId classId);
- explicit QScreen(int display_id);
- virtual ~QScreen();
- static QScreen* instance() { return qt_screen; }
- virtual bool initDevice() = 0;
- virtual bool connect(const QString &displaySpec) = 0;
- virtual void disconnect() = 0;
- virtual void shutdownDevice();
- virtual void setMode(int,int,int) = 0;
- virtual bool supportsDepth(int) const;
-
- virtual void save();
- virtual void restore();
- virtual void blank(bool on);
-
- virtual int pixmapOffsetAlignment() { return 64; }
- virtual int pixmapLinestepAlignment() { return 64; }
- virtual int sharedRamSize(void *) { return 0; }
-
- virtual bool onCard(const unsigned char *) const;
- virtual bool onCard(const unsigned char *, ulong& out_offset) const;
-
- enum PixelType { NormalPixel, BGRPixel };
-
- // sets a single color in the colormap
- virtual void set(unsigned int,unsigned int,unsigned int,unsigned int);
- // allocates a color
- virtual int alloc(unsigned int,unsigned int,unsigned int);
-
- int width() const { return w; }
- int height() const { return h; }
- int depth() const { return d; }
- virtual int pixmapDepth() const;
- PixelType pixelType() const { return pixeltype; }
- int linestep() const { return lstep; }
- int deviceWidth() const { return dw; }
- int deviceHeight() const { return dh; }
- uchar * base() const { return data; }
- // Ask for memory from card cache with alignment
- virtual uchar * cache(int) { return 0; }
- virtual void uncache(uchar *) {}
-
- QImage::Format pixelFormat() const;
-
- int screenSize() const { return size; }
- int totalSize() const { return mapsize; }
-
- QRgb * clut() { return screenclut; }
-#ifdef QT_DEPRECATED
- QT_DEPRECATED int numCols() { return screencols; }
-#endif
- int colorCount() { return screencols; }
-
- virtual QSize mapToDevice(const QSize &) const;
- virtual QSize mapFromDevice(const QSize &) const;
- virtual QPoint mapToDevice(const QPoint &, const QSize &) const;
- virtual QPoint mapFromDevice(const QPoint &, const QSize &) const;
- virtual QRect mapToDevice(const QRect &, const QSize &) const;
- virtual QRect mapFromDevice(const QRect &, const QSize &) const;
- virtual QImage mapToDevice(const QImage &) const;
- virtual QImage mapFromDevice(const QImage &) const;
- virtual QRegion mapToDevice(const QRegion &, const QSize &) const;
- virtual QRegion mapFromDevice(const QRegion &, const QSize &) const;
- virtual int transformOrientation() const;
- virtual bool isTransformed() const;
- virtual bool isInterlaced() const;
-
- virtual void setDirty(const QRect&);
-
- virtual int memoryNeeded(const QString&);
-
- virtual void haltUpdates();
- virtual void resumeUpdates();
-
- // composition manager methods
- virtual void exposeRegion(QRegion r, int changing);
-
- // these work directly on the screen
- virtual void blit(const QImage &img, const QPoint &topLeft, const QRegion &region);
- virtual void solidFill(const QColor &color, const QRegion &region);
- void blit(QWSWindow *bs, const QRegion &clip);
-
- virtual QWSWindowSurface* createSurface(QWidget *widget) const;
- virtual QWSWindowSurface* createSurface(const QString &key) const;
-
- virtual QList<QScreen*> subScreens() const { return QList<QScreen*>(); }
- virtual QRegion region() const { return QRect(offset(), QSize(w, h)); }
- int subScreenIndexAt(const QPoint &p) const;
-
- void setOffset(const QPoint &p);
- QPoint offset() const;
-
- int physicalWidth() const { return physWidth; } // physical display size in mm
- int physicalHeight() const { return physHeight; } // physical display size in mm
-
- QPixmapDataFactory* pixmapDataFactory() const; // Deprecated, will be removed in 4.6
- QGraphicsSystem* graphicsSystem() const;
-
-#ifdef QT_QWS_CLIENTBLIT
- bool supportsBlitInClients() const;
- void setSupportsBlitInClients(bool);
-#endif
-
- ClassId classId() const;
-
-protected:
- void setPixelFormat(QImage::Format format);
- void setPixmapDataFactory(QPixmapDataFactory *factory); // Deprecated, will be removed in 4.6
- void setGraphicsSystem(QGraphicsSystem* system);
-
- QRgb screenclut[256];
- int screencols;
-
- uchar * data;
-
- // Table of allocated lumps, kept in sorted highest-to-lowest order
- // The table itself is allocated at the bottom of offscreen memory
- // i.e. it's similar to having a stack (the table) and a heap
- // (the allocated blocks). Freed space is implicitly described
- // by the gaps between the allocated lumps (this saves entries and
- // means we don't need to worry about coalescing freed lumps)
-
- QPoolEntry * entries;
- int * entryp;
- unsigned int * lowest;
-
- int w;
- int lstep;
- int h;
- int d;
- PixelType pixeltype;
- bool grayscale;
-
- int dw;
- int dh;
-
- int size; // Screen size
- int mapsize; // Total mapped memory
-
- int displayId;
-
- int physWidth;
- int physHeight;
-
- friend class QWSServer;
- friend class QWSServerPrivate;
- static ClearCacheFunc clearCacheFunc;
-
-private:
- void compose(int level, const QRegion &exposed, QRegion &blend,
- QImage **blendbuffer, int changing_level);
- void paintBackground(const QRegion &);
-
- friend class QWSOnScreenSurface;
- static bool isWidgetPaintOnScreen(const QWidget *w);
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- void setFrameBufferLittleEndian(bool littleEndian);
- bool frameBufferLittleEndian() const;
- friend class QVNCScreen;
- friend class QLinuxFbScreen;
- friend class QVFbScreen;
- friend class QProxyScreen;
- friend class QIntfbScreen;
-#endif
- friend void qt_solidFill_setup(QScreen*, const QColor&, const QRegion&);
- friend void qt_blit_setup(QScreen *screen, const QImage &image,
- const QPoint &topLeft, const QRegion &region);
-#ifdef QT_QWS_DEPTH_GENERIC
- friend void qt_set_generic_blit(QScreen *screen, int bpp,
- int len_red, int len_green, int len_blue,
- int len_alpha, int off_red, int off_green,
- int off_blue, int off_alpha);
-#endif
-
- QScreenPrivate *d_ptr;
-};
-
-// This lives in loadable modules
-
-#ifndef QT_LOADABLE_MODULES
-extern "C" QScreen * qt_get_screen(int display_id, const char* spec);
-#endif
-
-// This is in main lib, loads the right module, calls qt_get_screen
-// In non-loadable cases just aliases to qt_get_screen
-
-const unsigned char * qt_probe_bus();
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREEN_QWS_H
diff --git a/src/gui/embedded/qscreendriverfactory_qws.cpp b/src/gui/embedded/qscreendriverfactory_qws.cpp
deleted file mode 100644
index ea194e56c5..0000000000
--- a/src/gui/embedded/qscreendriverfactory_qws.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreendriverfactory_qws.h"
-
-#include "qscreen_qws.h"
-#include "qapplication.h"
-#include "qscreenlinuxfb_qws.h"
-#include "qscreentransformed_qws.h"
-#include "qscreenvfb_qws.h"
-#include "qscreenmulti_qws_p.h"
-#include "qscreenqnx_qws.h"
-#include "qscreenintegrityfb_qws.h"
-#include <stdlib.h>
-#include "private/qfactoryloader_p.h"
-#include "qscreendriverplugin_qws.h"
-#ifndef QT_NO_QWS_DIRECTFB
-#include "qdirectfbscreen.h"
-#endif
-#ifndef QT_NO_QWS_VNC
-#include "qscreenvnc_qws.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
-
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QScreenDriverFactoryInterface_iid,
- QLatin1String("/gfxdrivers"), Qt::CaseInsensitive))
-
-#endif //QT_NO_LIBRARY
-#endif //QT_MAKEDLL
-
-/*!
- \class QScreenDriverFactory
- \ingroup qws
-
- \brief The QScreenDriverFactory class creates screen drivers in
- Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QScreenDriverFactory is used to detect and instantiate the
- available screen drivers, allowing \l{Qt for Embedded Linux} to load the
- preferred driver into the server application at runtime. The
- create() function returns a QScreen object representing the screen
- driver identified by a given key. The valid keys (i.e. the
- supported drivers) can be retrieved using the keys() function.
-
-
- \l{Qt for Embedded Linux} provides several built-in screen drivers. In
- addition, custom screen drivers can be added using Qt's plugin
- mechanism, i.e. by subclassing the QScreen class and creating a
- screen driver plugin (QScreenDriverPlugin). See the
- \l{Qt for Embedded Linux Display Management}{display management}
- documentation for details.
-
- \sa QScreen, QScreenDriverPlugin
-*/
-
-/*!
- Creates the screen driver specified by the given \a key, using the
- display specified by the given \a displayId.
-
- Note that the keys are case-insensitive.
-
- \sa keys()
-*/
-QScreen *QScreenDriverFactory::create(const QString& key, int displayId)
-{
- QString driver = key.toLower();
-#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_QNX)
- if (driver == QLatin1String("qnx") || driver.isEmpty())
- return new QQnxScreen(displayId);
-#endif
-#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY)
- if (driver == QLatin1String("integrityfb") || driver.isEmpty())
- return new QIntfbScreen(displayId);
-#endif
-#ifndef QT_NO_QWS_QVFB
- if (driver == QLatin1String("qvfb") || driver.isEmpty())
- return new QVFbScreen(displayId);
-#endif
-#ifndef QT_NO_QWS_LINUXFB
- if (driver == QLatin1String("linuxfb") || driver.isEmpty())
- return new QLinuxFbScreen(displayId);
-#endif
-#ifndef QT_NO_QWS_DIRECTFB
- if (driver == QLatin1String("directfb") || driver.isEmpty())
- return new QDirectFBScreen(displayId);
-#endif
-#ifndef QT_NO_QWS_TRANSFORMED
- if (driver == QLatin1String("transformed"))
- return new QTransformedScreen(displayId);
-#endif
-#ifndef QT_NO_QWS_VNC
- if (driver == QLatin1String("vnc"))
- return new QVNCScreen(displayId);
-#endif
-#ifndef QT_NO_QWS_MULTISCREEN
- if (driver == QLatin1String("multi"))
- return new QMultiScreen(displayId);
-#endif
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
-
- if (QScreenDriverFactoryInterface *factory = qobject_cast<QScreenDriverFactoryInterface*>(loader()->instance(key)))
- return factory->create(driver, displayId);
-
-#endif
-#endif
- return 0;
-}
-
-/*!
- Returns the list of valid keys, i.e. the available screen drivers.
-
- \sa create()
-*/
-QStringList QScreenDriverFactory::keys()
-{
- QStringList list;
-
-#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_QNX)
- list << QLatin1String("QNX");
-#endif
-#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY)
- list << QLatin1String("INTEGRITYFB");
-#endif
-#ifndef QT_NO_QWS_QVFB
- list << QLatin1String("QVFb");
-#endif
-#ifndef QT_NO_QWS_LINUXFB
- list << QLatin1String("LinuxFb");
-#endif
-#ifndef QT_NO_QWS_TRANSFORMED
- list << QLatin1String("Transformed");
-#endif
-#ifndef QT_NO_QWS_VNC
- list << QLatin1String("VNC");
-#endif
-#ifndef QT_NO_QWS_MULTISCREEN
- list << QLatin1String("Multi");
-#endif
-
-#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
-#ifndef QT_NO_LIBRARY
- QStringList plugins = loader()->keys();
- for (int i = 0; i < plugins.size(); ++i) {
-# ifdef QT_NO_QWS_QVFB
- // give QVFb top priority for autodetection
- if (plugins.at(i) == QLatin1String("QVFb"))
- list.prepend(plugins.at(i));
- else
-# endif
- if (!list.contains(plugins.at(i)))
- list += plugins.at(i);
- }
-#endif //QT_NO_LIBRARY
-#endif //QT_MAKEDLL
- return list;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qscreendriverfactory_qws.h b/src/gui/embedded/qscreendriverfactory_qws.h
deleted file mode 100644
index 072ae9bad8..0000000000
--- a/src/gui/embedded/qscreendriverfactory_qws.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENDRIVERFACTORY_QWS_H
-#define QSCREENDRIVERFACTORY_QWS_H
-
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QString;
-class QScreen;
-
-class Q_GUI_EXPORT QScreenDriverFactory
-{
-public:
- static QStringList keys();
- static QScreen *create(const QString&, int);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREENDRIVERFACTORY_QWS_H
diff --git a/src/gui/embedded/qscreendriverplugin_qws.cpp b/src/gui/embedded/qscreendriverplugin_qws.cpp
deleted file mode 100644
index d7822c8ffc..0000000000
--- a/src/gui/embedded/qscreendriverplugin_qws.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreendriverplugin_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_LIBRARY
-
-/*!
- \class QScreenDriverPlugin
- \ingroup plugins
- \ingroup qws
-
- \brief The QScreenDriverPlugin class is an abstract base class for
- screen driver plugins in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several screen
- protocols, see the \l{Qt for Embedded Linux Display Management}{display
- management} documentation for details. Custom screen drivers can be
- implemented by subclassing the QScreen class and creating a screen
- driver plugin.
-
- A screen driver plugin can be created by subclassing
- QScreenDriverPlugin and reimplementing the pure virtual keys() and
- create() functions. By exporting the derived class using the
- Q_EXPORT_PLUGIN2() macro, The default implementation of the
- QScreenDriverFactory class will automatically detect the plugin
- and load the driver into the server application at run-time. See
- \l{How to Create Qt Plugins} for details.
-
- \sa QScreen, QScreenDriverFactory
-*/
-
-/*!
- \fn QStringList QScreenDriverPlugin::keys() const
-
- Implement this function to return the list of valid keys, i.e. the
- screen drivers supported by this plugin.
-
- \l{Qt for Embedded Linux} provides ready-made drivers for several screen
- protocols, see the \l{Qt for Embedded Linux Display Management}{display
- management} documentation for details.
-
- \sa create()
-*/
-
-/*!
- Constructs a screen driver plugin with the given \a parent.
-
- Note that this constructor is invoked automatically by the
- Q_EXPORT_PLUGIN2() macro, so there is no need for calling it
- explicitly.
-*/
-QScreenDriverPlugin::QScreenDriverPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys this screen driver plugin.
-
- Note that Qt destroys a plugin automatically when it is no longer
- used, so there is no need for calling the destructor explicitly.
-*/
-QScreenDriverPlugin::~QScreenDriverPlugin()
-{
-}
-
-
-/*!
- \fn QScreen* QScreenDriverPlugin::create(const QString &key, int displayId)
-
- Implement this function to create a driver matching the type
- specified by the given \a key and \a displayId parameters. Note
- that keys are case-insensitive.
-
- \sa keys()
-*/
-
-#endif // QT_NO_LIBRARY
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qscreendriverplugin_qws.h b/src/gui/embedded/qscreendriverplugin_qws.h
deleted file mode 100644
index 039a8aabf1..0000000000
--- a/src/gui/embedded/qscreendriverplugin_qws.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENDRIVERPLUGIN_QWS_H
-#define QSCREENDRIVERPLUGIN_QWS_H
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_LIBRARY
-
-class QScreen;
-
-struct Q_GUI_EXPORT QScreenDriverFactoryInterface : public QFactoryInterface
-{
- virtual QScreen* create(const QString& driver, int displayId) = 0;
-};
-
-#define QScreenDriverFactoryInterface_iid "com.trolltech.Qt.QScreenDriverFactoryInterface"
-Q_DECLARE_INTERFACE(QScreenDriverFactoryInterface, QScreenDriverFactoryInterface_iid)
-
-class Q_GUI_EXPORT QScreenDriverPlugin : public QObject, public QScreenDriverFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QScreenDriverFactoryInterface:QFactoryInterface)
-public:
- explicit QScreenDriverPlugin(QObject *parent = 0);
- ~QScreenDriverPlugin();
-
- virtual QStringList keys() const = 0;
- virtual QScreen *create(const QString& driver, int displayId) = 0;
-};
-
-#endif // QT_NO_LIBRARY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREENDRIVERPLUGIN_QWS_H
diff --git a/src/gui/embedded/qscreenintegrityfb_qws.cpp b/src/gui/embedded/qscreenintegrityfb_qws.cpp
deleted file mode 100644
index 7b24490353..0000000000
--- a/src/gui/embedded/qscreenintegrityfb_qws.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_NO_QWS_INTEGRITYFB
-
-#include <qscreenintegrityfb_qws.h>
-#include <qwindowsystem_qws.h>
-#include <qsocketnotifier.h>
-#include <qapplication.h>
-#include <qscreen_qws.h>
-#include "qmouseintegrity_qws.h"
-#include "qkbdintegrity_qws.h"
-#include <qmousedriverfactory_qws.h>
-#include <qkbddriverfactory_qws.h>
-#include <qdebug.h>
-
-#include <INTEGRITY.h>
-#include <device/fbdriver.h>
-
-QT_BEGIN_NAMESPACE
-
-class QIntfbScreenPrivate
-{
-public:
- QIntfbScreenPrivate();
- ~QIntfbScreenPrivate();
-
- FBHandle handle;
- struct FBInfoStruct fbinfo;
-
- QWSMouseHandler *mouse;
-#ifndef QT_NO_QWS_KEYBOARD
- QWSKeyboardHandler *keyboard;
-#endif
-};
-
-QIntfbScreenPrivate::QIntfbScreenPrivate()
- : mouse(0)
-
-{
-#ifndef QT_NO_QWS_KEYBOARD
- keyboard = 0;
-#endif
-}
-
-QIntfbScreenPrivate::~QIntfbScreenPrivate()
-{
- delete mouse;
-#ifndef QT_NO_QWS_KEYBOARD
- delete keyboard;
-#endif
-}
-
-/*!
- \internal
-
- \class QIntfbScreen
- \ingroup qws
-
- \brief The QIntfbScreen class implements a screen driver for the
- INTEGRITY framebuffer drivers.
-
- Note that this class is only available in \l{Qt for INTEGRITY}.
- Custom screen drivers can be added by subclassing the
- QScreenDriverPlugin class, using the QScreenDriverFactory class to
- dynamically load the driver into the application, but there should
- only be one screen object per application.
-
- \sa QScreen, QScreenDriverPlugin, {Running Applications}
-*/
-
-/*!
- \fn bool QIntfbScreen::connect(const QString & displaySpec)
- \reimp
-*/
-
-/*!
- \fn void QIntfbScreen::disconnect()
- \reimp
-*/
-
-/*!
- \fn bool QIntfbScreen::initDevice()
- \reimp
-*/
-
-/*!
- \fn void QIntfbScreen::restore()
- \reimp
-*/
-
-/*!
- \fn void QIntfbScreen::save()
- \reimp
-*/
-
-/*!
- \fn void QIntfbScreen::setDirty(const QRect & r)
- \reimp
-*/
-
-/*!
- \fn void QIntfbScreen::setMode(int nw, int nh, int nd)
- \reimp
-*/
-
-/*!
- \fn void QIntfbScreen::shutdownDevice()
- \reimp
-*/
-
-/*!
- \fn QIntfbScreen::QIntfbScreen(int displayId)
-
- Constructs a QVNCScreen object. The \a displayId argument
- identifies the Qt for Embedded Linux server to connect to.
-*/
-QIntfbScreen::QIntfbScreen(int display_id)
- : QScreen(display_id, IntfbClass), d_ptr(new QIntfbScreenPrivate)
-{
- d_ptr->handle = 0;
- data = 0;
-}
-
-/*!
- Destroys this QIntfbScreen object.
-*/
-QIntfbScreen::~QIntfbScreen()
-{
- delete d_ptr;
-}
-
-static QIntfbScreen *connected = 0;
-
-bool QIntfbScreen::connect(const QString &displaySpec)
-{
- FBDriver *fbdev;
-
- CheckSuccess(gh_FB_get_driver(0, &fbdev));
- CheckSuccess(gh_FB_init_device(fbdev, 0, &d_ptr->handle));
- CheckSuccess(gh_FB_get_info(d_ptr->handle, &d_ptr->fbinfo));
-
- data = (uchar *)d_ptr->fbinfo.start;
-
- d = d_ptr->fbinfo.bitsperpixel;
- switch (d) {
- case 1:
- setPixelFormat(QImage::Format_Mono);
- break;
- case 8:
- setPixelFormat(QImage::Format_Indexed8);
- break;
- case 12:
- setPixelFormat(QImage::Format_RGB444);
- break;
- case 15:
- setPixelFormat(QImage::Format_RGB555);
- break;
- case 16:
- setPixelFormat(QImage::Format_RGB16);
- break;
- case 18:
- setPixelFormat(QImage::Format_RGB666);
- break;
- case 24:
- setPixelFormat(QImage::Format_RGB888);
-#ifdef QT_QWS_DEPTH_GENERIC
-#if Q_BYTE_ORDER != Q_BIG_ENDIAN
- qt_set_generic_blit(this, 24,
- d_ptr->fbinfo.redbits,
- d_ptr->fbinfo.greenbits,
- d_ptr->fbinfo.bluebits,
- d_ptr->fbinfo.alphabits,
- d_ptr->fbinfo.redoffset,
- d_ptr->fbinfo.greenoffset,
- d_ptr->fbinfo.blueoffset,
- d_ptr->fbinfo.alphaoffset);
-#else
- qt_set_generic_blit(this, 24,
- d_ptr->fbinfo.redbits,
- d_ptr->fbinfo.greenbits,
- d_ptr->fbinfo.bluebits,
- d_ptr->fbinfo.alphabits,
- 16 - d_ptr->fbinfo.redoffset,
- 16 - d_ptr->fbinfo.greenoffset,
- 16 - d_ptr->fbinfo.blueoffset,
- d_ptr->fbinfo.alphaoffset);
-#endif
-#endif
- break;
- case 32:
- setPixelFormat(QImage::Format_ARGB32_Premultiplied);
-#ifdef QT_QWS_DEPTH_GENERIC
-#if Q_BYTE_ORDER != Q_BIG_ENDIAN
- qt_set_generic_blit(this, 32,
- d_ptr->fbinfo.redbits,
- d_ptr->fbinfo.greenbits,
- d_ptr->fbinfo.bluebits,
- d_ptr->fbinfo.alphabits,
- d_ptr->fbinfo.redoffset,
- d_ptr->fbinfo.greenoffset,
- d_ptr->fbinfo.blueoffset,
- d_ptr->fbinfo.alphaoffset);
-#else
- qt_set_generic_blit(this, 32,
- d_ptr->fbinfo.redbits,
- d_ptr->fbinfo.greenbits,
- d_ptr->fbinfo.bluebits,
- d_ptr->fbinfo.alphabits,
- 24 - d_ptr->fbinfo.redoffset,
- 24 - d_ptr->fbinfo.greenoffset,
- 24 - d_ptr->fbinfo.blueoffset,
- d_ptr->fbinfo.alphaoffset ? 24 - d_ptr->fbinfo.alphaoffset : 0);
-#endif
-#endif
- break;
- }
-
- dw = w = d_ptr->fbinfo.width;
- dh = h = d_ptr->fbinfo.height;
-
- /* assumes no padding */
- lstep = w * ((d + 7) >> 3);
-
- mapsize = size = h * lstep;
-
- /* default values */
- int dpi = 72;
- physWidth = qRound(dw * 25.4 / dpi);
- physHeight = qRound(dh * 25.4 / dpi);
-
- qDebug("Connected to INTEGRITYfb server: %d x %d x %d %dx%dmm (%dx%ddpi)",
- w, h, d, physWidth, physHeight, qRound(dw*25.4/physWidth), qRound(dh*25.4/physHeight) );
-
-
- QWSServer::setDefaultMouse("integrity");
- QWSServer::setDefaultKeyboard("integrity");
-
- connected = this;
-
- return true;
-}
-
-void QIntfbScreen::disconnect()
-{
- connected = 0;
-}
-
-bool QIntfbScreen::initDevice()
-{
-
- CheckSuccess(gh_FB_set_info(d_ptr->handle, &d_ptr->fbinfo, false));
- CheckSuccess(gh_FB_get_info(d_ptr->handle, &d_ptr->fbinfo));
- data = (uchar *)d_ptr->fbinfo.start;
- d = d_ptr->fbinfo.bitsperpixel;
- dw = w = d_ptr->fbinfo.width;
- dh = h = d_ptr->fbinfo.height;
- mapsize = d_ptr->fbinfo.length;
- /* assumes no padding */
- lstep = w * ((d + 7) >> 3);
-
- mapsize = size = h * lstep;
-
- data = (uchar *)d_ptr->fbinfo.start;
-
- d = d_ptr->fbinfo.bitsperpixel;
- switch (d) {
- case 1:
- setPixelFormat(QImage::Format_Mono);
- break;
- case 8:
- setPixelFormat(QImage::Format_Indexed8);
- break;
- case 12:
- setPixelFormat(QImage::Format_RGB444);
- break;
- case 15:
- setPixelFormat(QImage::Format_RGB555);
- break;
- case 16:
- setPixelFormat(QImage::Format_RGB16);
- break;
- case 18:
- setPixelFormat(QImage::Format_RGB666);
- break;
- case 24:
- setPixelFormat(QImage::Format_RGB888);
- break;
- case 32:
- setPixelFormat(QImage::Format_ARGB32_Premultiplied);
- break;
- }
-#ifdef QT_QWS_DEPTH_GENERIC
-#if defined(__BIG_ENDIAN__)
- qt_set_generic_blit(this, d,
- d_ptr->fbinfo.redbits,
- d_ptr->fbinfo.greenbits,
- d_ptr->fbinfo.bluebits,
- d_ptr->fbinfo.alphabits,
- 24 - d_ptr->fbinfo.redoffset,
- 24 - d_ptr->fbinfo.greenoffset,
- 24 - d_ptr->fbinfo.blueoffset,
- d_ptr->fbinfo.alphaoffset ? 24 - d_ptr->fbinfo.alphaoffset : 0);
-#else
- qt_set_generic_blit(this, d,
- d_ptr->fbinfo.redbits,
- d_ptr->fbinfo.greenbits,
- d_ptr->fbinfo.bluebits,
- d_ptr->fbinfo.alphabits,
- d_ptr->fbinfo.redoffset,
- d_ptr->fbinfo.greenoffset,
- d_ptr->fbinfo.blueoffset,
- d_ptr->fbinfo.alphaoffset);
-#endif
-#endif
-
-#ifndef QT_NO_QWS_CURSOR
- QScreenCursor::initSoftwareCursor();
-#endif
- return true;
-}
-
-void QIntfbScreen::shutdownDevice()
-{
- gh_FB_close(d_ptr->handle);
-}
-
-void QIntfbScreen::setMode(int ,int ,int)
-{
-}
-
-// save the state of the graphics card
-// This is needed so that e.g. we can restore the palette when switching
-// between linux virtual consoles.
-void QIntfbScreen::save()
-{
- // nothing to do.
-}
-
-// restore the state of the graphics card.
-void QIntfbScreen::restore()
-{
-}
-void QIntfbScreen::setDirty(const QRect& rect)
-{
- FBRect fbrect;
- fbrect.dx = rect.x();
- fbrect.dy = rect.y();
- fbrect.width = rect.width();
- fbrect.height = rect.height();
- gh_FB_expose(d_ptr->handle, &fbrect);
-}
-
-void QIntfbScreen::setBrightness(int b)
-{
- if (connected) {
- }
-}
-
-void QIntfbScreen::blank(bool on)
-{
-}
-
-#endif // QT_NO_QWS_INTEGRITYFB
-
-QT_END_NAMESPACE
-
diff --git a/src/gui/embedded/qscreenintegrityfb_qws.h b/src/gui/embedded/qscreenintegrityfb_qws.h
deleted file mode 100644
index 06b39671f4..0000000000
--- a/src/gui/embedded/qscreenintegrityfb_qws.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENINTEGRITYFB_QWS_H
-#define QSCREENINTEGRITYFB_QWS_H
-
-#include <QtGui/qscreen_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_INTEGRITYFB
-
-class QIntfbScreenPrivate;
-
-class Q_GUI_EXPORT QIntfbScreen : public QScreen
-{
-public:
- explicit QIntfbScreen(int display_id);
- virtual ~QIntfbScreen();
- virtual bool initDevice();
- virtual bool connect(const QString &displaySpec);
- virtual void disconnect();
- virtual void shutdownDevice();
- virtual void save();
- virtual void restore();
- virtual void setMode(int nw,int nh,int nd);
- virtual void setDirty(const QRect& r);
- virtual void blank(bool);
- static void setBrightness(int b);
-
-private:
- QIntfbScreenPrivate *d_ptr;
-};
-
-#endif // QT_NO_QWS_INTEGRITYFB
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREENINTEGRITYFB_QWS_H
diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp
deleted file mode 100644
index a566f5294c..0000000000
--- a/src/gui/embedded/qscreenlinuxfb_qws.cpp
+++ /dev/null
@@ -1,1386 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreenlinuxfb_qws.h"
-
-#ifndef QT_NO_QWS_LINUXFB
-//#include "qmemorymanager_qws.h"
-#include "qwsdisplay_qws.h"
-#include "qpixmap.h"
-#include <private/qwssignalhandler_p.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/kd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <limits.h>
-#include <signal.h>
-
-#include "qwindowsystem_qws.h"
-
-#if !defined(Q_OS_DARWIN) && !defined(Q_OS_FREEBSD)
-#include <linux/fb.h>
-
-#ifdef __i386__
-#include <asm/mtrr.h>
-#endif
-#endif
-
-QT_BEGIN_NAMESPACE
-
-extern int qws_client_id;
-
-//#define DEBUG_CACHE
-
-class QLinuxFbScreenPrivate : public QObject
-{
-public:
- QLinuxFbScreenPrivate();
- ~QLinuxFbScreenPrivate();
-
- void openTty();
- void closeTty();
-
- int fd;
- int startupw;
- int startuph;
- int startupd;
- bool blank;
- QLinuxFbScreen::DriverTypes driverType;
-
- bool doGraphicsMode;
-#ifdef QT_QWS_DEPTH_GENERIC
- bool doGenericColors;
-#endif
- int ttyfd;
- long oldKdMode;
- QString ttyDevice;
- QString displaySpec;
-};
-
-QLinuxFbScreenPrivate::QLinuxFbScreenPrivate()
- : fd(-1), blank(true), doGraphicsMode(true),
-#ifdef QT_QWS_DEPTH_GENERIC
- doGenericColors(false),
-#endif
- ttyfd(-1), oldKdMode(KD_TEXT)
-{
- QWSSignalHandler::instance()->addObject(this);
-}
-
-QLinuxFbScreenPrivate::~QLinuxFbScreenPrivate()
-{
- closeTty();
-}
-
-void QLinuxFbScreenPrivate::openTty()
-{
- const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0};
-
- if (ttyDevice.isEmpty()) {
- for (const char * const *dev = devs; *dev; ++dev) {
- ttyfd = QT_OPEN(*dev, O_RDWR);
- if (ttyfd != -1)
- break;
- }
- } else {
- ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR);
- }
-
- if (ttyfd == -1)
- return;
-
- if (doGraphicsMode) {
- ioctl(ttyfd, KDGETMODE, &oldKdMode);
- if (oldKdMode != KD_GRAPHICS) {
- int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS);
- if (ret == -1)
- doGraphicsMode = false;
- }
- }
-
- // No blankin' screen, no blinkin' cursor!, no cursor!
- const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c";
- QT_WRITE(ttyfd, termctl, sizeof(termctl));
-}
-
-void QLinuxFbScreenPrivate::closeTty()
-{
- if (ttyfd == -1)
- return;
-
- if (doGraphicsMode)
- ioctl(ttyfd, KDSETMODE, oldKdMode);
-
- // Blankin' screen, blinkin' cursor!
- const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c";
- QT_WRITE(ttyfd, termctl, sizeof(termctl));
-
- QT_CLOSE(ttyfd);
- ttyfd = -1;
-}
-
-/*!
- \enum QLinuxFbScreen::DriverTypes
-
- This enum describes the driver type.
-
- \value GenericDriver Generic Linux framebuffer driver
- \value EInk8Track e-Ink framebuffer driver using the 8Track chipset
- */
-
-/*!
- \fn QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo)
-
- Adjust the values returned by the framebuffer driver, to work
- around driver bugs or nonstandard behavior in certain drivers.
- \a finfo and \a vinfo specify the fixed and variable screen info
- returned by the driver.
- */
-void QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo)
-{
- // 8Track e-ink devices (as found in Sony PRS-505) lie
- // about their bit depth -- they claim they're 1 bit per
- // pixel while the only supported mode is 8 bit per pixel
- // grayscale.
- // Caused by this, they also miscalculate their line length.
- if(!strcmp(finfo.id, "8TRACKFB") && vinfo.bits_per_pixel == 1) {
- vinfo.bits_per_pixel = 8;
- finfo.line_length = vinfo.xres;
- }
-}
-
-/*!
- \internal
-
- \class QLinuxFbScreen
- \ingroup qws
-
- \brief The QLinuxFbScreen class implements a screen driver for the
- Linux framebuffer.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
- Custom screen drivers can be added by subclassing the
- QScreenDriverPlugin class, using the QScreenDriverFactory class to
- dynamically load the driver into the application, but there should
- only be one screen object per application.
-
- The QLinuxFbScreen class provides the cache() function allocating
- off-screen graphics memory, and the complementary uncache()
- function releasing the allocated memory. The latter function will
- first sync the graphics card to ensure the memory isn't still
- being used by a command in the graphics card FIFO queue. The
- deleteEntry() function deletes the given memory block without such
- synchronization. Given the screen instance and client id, the
- memory can also be released using the clearCache() function, but
- this should only be necessary if a client exits abnormally.
-
- In addition, when in paletted graphics modes, the set() function
- provides the possibility of setting a specified color index to a
- given RGB value.
-
- The QLinuxFbScreen class also acts as a factory for the
- unaccelerated screen cursor and the unaccelerated raster-based
- implementation of QPaintEngine (\c QRasterPaintEngine);
- accelerated drivers for Linux should derive from this class.
-
- \sa QScreen, QScreenDriverPlugin, {Running Applications}
-*/
-
-/*!
- \fn bool QLinuxFbScreen::useOffscreen()
- \internal
-*/
-
-// Unaccelerated screen/driver setup. Can be overridden by accelerated
-// drivers
-
-/*!
- \fn QLinuxFbScreen::QLinuxFbScreen(int displayId)
-
- Constructs a QLinuxFbScreen object. The \a displayId argument
- identifies the Qt for Embedded Linux server to connect to.
-*/
-
-QLinuxFbScreen::QLinuxFbScreen(int display_id)
- : QScreen(display_id, LinuxFBClass), d_ptr(new QLinuxFbScreenPrivate)
-{
- canaccel=false;
- clearCacheFunc = &clearCache;
-#ifdef QT_QWS_CLIENTBLIT
- setSupportsBlitInClients(true);
-#endif
-}
-
-/*!
- Destroys this QLinuxFbScreen object.
-*/
-
-QLinuxFbScreen::~QLinuxFbScreen()
-{
-}
-
-/*!
- \reimp
-
- This is called by \l{Qt for Embedded Linux} clients to map in the framebuffer.
- It should be reimplemented by accelerated drivers to map in
- graphics card registers; those drivers should then call this
- function in order to set up offscreen memory management. The
- device is specified in \a displaySpec; e.g. "/dev/fb".
-
- \sa disconnect()
-*/
-
-bool QLinuxFbScreen::connect(const QString &displaySpec)
-{
- d_ptr->displaySpec = displaySpec;
-
- const QStringList args = displaySpec.split(QLatin1Char(':'));
-
- if (args.contains(QLatin1String("nographicsmodeswitch")))
- d_ptr->doGraphicsMode = false;
-
-#ifdef QT_QWS_DEPTH_GENERIC
- if (args.contains(QLatin1String("genericcolors")))
- d_ptr->doGenericColors = true;
-#endif
-
- QRegExp ttyRegExp(QLatin1String("tty=(.*)"));
- if (args.indexOf(ttyRegExp) != -1)
- d_ptr->ttyDevice = ttyRegExp.cap(1);
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN
- if (args.contains(QLatin1String("littleendian")))
-#endif
- QScreen::setFrameBufferLittleEndian(true);
-#endif
-
- QString dev = QLatin1String("/dev/fb0");
- foreach(QString d, args) {
- if (d.startsWith(QLatin1Char('/'))) {
- dev = d;
- break;
- }
- }
-
- if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0)
- d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR);
- if (d_ptr->fd == -1) {
- if (QApplication::type() == QApplication::GuiServer) {
- perror("QScreenLinuxFb::connect");
- qCritical("Error opening framebuffer device %s", qPrintable(dev));
- return false;
- }
- if (access(dev.toLatin1().constData(), R_OK) == 0)
- d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY);
- }
-
- ::fb_fix_screeninfo finfo;
- ::fb_var_screeninfo vinfo;
- //#######################
- // Shut up Valgrind
- memset(&vinfo, 0, sizeof(vinfo));
- memset(&finfo, 0, sizeof(finfo));
- //#######################
-
- /* Get fixed screen information */
- if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) {
- perror("QLinuxFbScreen::connect");
- qWarning("Error reading fixed information");
- return false;
- }
-
- d_ptr->driverType = strcmp(finfo.id, "8TRACKFB") ? GenericDriver : EInk8Track;
-
- if (finfo.type == FB_TYPE_VGA_PLANES) {
- qWarning("VGA16 video mode not supported");
- return false;
- }
-
- /* Get variable screen information */
- if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) {
- perror("QLinuxFbScreen::connect");
- qWarning("Error reading variable information");
- return false;
- }
-
- fixupScreenInfo(finfo, vinfo);
-
- grayscale = vinfo.grayscale;
- d = vinfo.bits_per_pixel;
- if (d == 24) {
- d = vinfo.red.length + vinfo.green.length + vinfo.blue.length;
- if (d <= 0)
- d = 24; // reset if color component lengths are not reported
- } else if (d == 16) {
- d = vinfo.red.length + vinfo.green.length + vinfo.blue.length;
- if (d <= 0)
- d = 16;
- }
- lstep = finfo.line_length;
-
- int xoff = vinfo.xoffset;
- int yoff = vinfo.yoffset;
- const char* qwssize;
- if((qwssize=::getenv("QWS_SIZE")) && sscanf(qwssize,"%dx%d",&w,&h)==2) {
- if (d_ptr->fd != -1) {
- if ((uint)w > vinfo.xres) w = vinfo.xres;
- if ((uint)h > vinfo.yres) h = vinfo.yres;
- }
- dw=w;
- dh=h;
- int xxoff, yyoff;
- if (sscanf(qwssize, "%*dx%*d+%d+%d", &xxoff, &yyoff) == 2) {
- if (xxoff < 0 || xxoff + w > vinfo.xres)
- xxoff = vinfo.xres - w;
- if (yyoff < 0 || yyoff + h > vinfo.yres)
- yyoff = vinfo.yres - h;
- xoff += xxoff;
- yoff += yyoff;
- } else {
- xoff += (vinfo.xres - w)/2;
- yoff += (vinfo.yres - h)/2;
- }
- } else {
- dw=w=vinfo.xres;
- dh=h=vinfo.yres;
- }
-
- if (w == 0 || h == 0) {
- qWarning("QScreenLinuxFb::connect(): Unable to find screen geometry, "
- "will use 320x240.");
- dw = w = 320;
- dh = h = 240;
- }
-
- setPixelFormat(vinfo);
-
- // Handle display physical size spec.
- QStringList displayArgs = displaySpec.split(QLatin1Char(':'));
- QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)"));
- int dimIdxW = displayArgs.indexOf(mmWidthRx);
- QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)"));
- int dimIdxH = displayArgs.indexOf(mmHeightRx);
- if (dimIdxW >= 0) {
- mmWidthRx.exactMatch(displayArgs.at(dimIdxW));
- physWidth = mmWidthRx.cap(1).toInt();
- if (dimIdxH < 0)
- physHeight = dh*physWidth/dw;
- }
- if (dimIdxH >= 0) {
- mmHeightRx.exactMatch(displayArgs.at(dimIdxH));
- physHeight = mmHeightRx.cap(1).toInt();
- if (dimIdxW < 0)
- physWidth = dw*physHeight/dh;
- }
- if (dimIdxW < 0 && dimIdxH < 0) {
- if (vinfo.width != 0 && vinfo.height != 0
- && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) {
- physWidth = vinfo.width;
- physHeight = vinfo.height;
- } else {
- const int dpi = 72;
- physWidth = qRound(dw * 25.4 / dpi);
- physHeight = qRound(dh * 25.4 / dpi);
- }
- }
-
- dataoffset = yoff * lstep + xoff * d / 8;
- //qDebug("Using %dx%dx%d screen",w,h,d);
-
- /* Figure out the size of the screen in bytes */
- size = h * lstep;
-
- mapsize = finfo.smem_len;
-
- data = (unsigned char *)-1;
- if (d_ptr->fd != -1)
- data = (unsigned char *)mmap(0, mapsize, PROT_READ | PROT_WRITE,
- MAP_SHARED, d_ptr->fd, 0);
-
- if ((long)data == -1) {
- if (QApplication::type() == QApplication::GuiServer) {
- perror("QLinuxFbScreen::connect");
- qWarning("Error: failed to map framebuffer device to memory.");
- return false;
- }
- data = 0;
- } else {
- data += dataoffset;
- }
-
- canaccel = useOffscreen();
- if(canaccel)
- setupOffScreen();
-
- // Now read in palette
- if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) {
- screencols= (vinfo.bits_per_pixel==8) ? 256 : 16;
- int loopc;
- ::fb_cmap startcmap;
- startcmap.start=0;
- startcmap.len=screencols;
- startcmap.red=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
- startcmap.green=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
- startcmap.blue=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
- startcmap.transp=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
- if (d_ptr->fd == -1 || ioctl(d_ptr->fd, FBIOGETCMAP, &startcmap)) {
- perror("QLinuxFbScreen::connect");
- qWarning("Error reading palette from framebuffer, using default palette");
- createPalette(startcmap, vinfo, finfo);
- }
- int bits_used = 0;
- for(loopc=0;loopc<screencols;loopc++) {
- screenclut[loopc]=qRgb(startcmap.red[loopc] >> 8,
- startcmap.green[loopc] >> 8,
- startcmap.blue[loopc] >> 8);
- bits_used |= startcmap.red[loopc]
- | startcmap.green[loopc]
- | startcmap.blue[loopc];
- }
- // WORKAROUND: Some framebuffer drivers only return 8 bit
- // color values, so we need to not bit shift them..
- if ((bits_used & 0x00ff) && !(bits_used & 0xff00)) {
- for(loopc=0;loopc<screencols;loopc++) {
- screenclut[loopc] = qRgb(startcmap.red[loopc],
- startcmap.green[loopc],
- startcmap.blue[loopc]);
- }
- qWarning("8 bits cmap returned due to faulty FB driver, colors corrected");
- }
- free(startcmap.red);
- free(startcmap.green);
- free(startcmap.blue);
- free(startcmap.transp);
- } else {
- screencols=0;
- }
-
- return true;
-}
-
-/*!
- \reimp
-
- This unmaps the framebuffer.
-
- \sa connect()
-*/
-
-void QLinuxFbScreen::disconnect()
-{
- data -= dataoffset;
- if (data)
- munmap((char*)data,mapsize);
- close(d_ptr->fd);
-}
-
-// #define DEBUG_VINFO
-
-void QLinuxFbScreen::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo)
-{
- if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) {
- screencols= (vinfo.bits_per_pixel==8) ? 256 : 16;
- cmap.start=0;
- cmap.len=screencols;
- cmap.red=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
- cmap.green=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
- cmap.blue=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
- cmap.transp=(unsigned short int *)
- malloc(sizeof(unsigned short int)*screencols);
-
- if (screencols==16) {
- if (finfo.type == FB_TYPE_PACKED_PIXELS) {
- // We'll setup a grayscale cmap for 4bpp linear
- int val = 0;
- for (int idx = 0; idx < 16; ++idx, val += 17) {
- cmap.red[idx] = (val<<8)|val;
- cmap.green[idx] = (val<<8)|val;
- cmap.blue[idx] = (val<<8)|val;
- screenclut[idx]=qRgb(val, val, val);
- }
- } else {
- // Default 16 colour palette
- // Green is now trolltech green so certain images look nicer
- // black d_gray l_gray white red green blue cyan magenta yellow
- unsigned char reds[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0xFF, 0xA2, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x82 };
- unsigned char greens[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0xC5, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F };
- unsigned char blues[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0x11, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00 };
-
- for (int idx = 0; idx < 16; ++idx) {
- cmap.red[idx] = ((reds[idx]) << 8)|reds[idx];
- cmap.green[idx] = ((greens[idx]) << 8)|greens[idx];
- cmap.blue[idx] = ((blues[idx]) << 8)|blues[idx];
- cmap.transp[idx] = 0;
- screenclut[idx]=qRgb(reds[idx], greens[idx], blues[idx]);
- }
- }
- } else {
- if (grayscale) {
- // Build grayscale palette
- int i;
- for(i=0;i<screencols;++i) {
- int bval = screencols == 256 ? i : (i << 4);
- ushort val = (bval << 8) | bval;
- cmap.red[i] = val;
- cmap.green[i] = val;
- cmap.blue[i] = val;
- cmap.transp[i] = 0;
- screenclut[i] = qRgb(bval,bval,bval);
- }
- } else {
- // 6x6x6 216 color cube
- int idx = 0;
- for(int ir = 0x0; ir <= 0xff; ir+=0x33) {
- for(int ig = 0x0; ig <= 0xff; ig+=0x33) {
- for(int ib = 0x0; ib <= 0xff; ib+=0x33) {
- cmap.red[idx] = (ir << 8)|ir;
- cmap.green[idx] = (ig << 8)|ig;
- cmap.blue[idx] = (ib << 8)|ib;
- cmap.transp[idx] = 0;
- screenclut[idx]=qRgb(ir, ig, ib);
- ++idx;
- }
- }
- }
- // Fill in rest with 0
- for (int loopc=0; loopc<40; ++loopc) {
- screenclut[idx]=0;
- ++idx;
- }
- screencols=idx;
- }
- }
- } else if(finfo.visual==FB_VISUAL_DIRECTCOLOR) {
- cmap.start=0;
- int rbits=0,gbits=0,bbits=0;
- switch (vinfo.bits_per_pixel) {
- case 8:
- rbits=vinfo.red.length;
- gbits=vinfo.green.length;
- bbits=vinfo.blue.length;
- if(rbits==0 && gbits==0 && bbits==0) {
- // cyber2000 driver bug hack
- rbits=3;
- gbits=3;
- bbits=2;
- }
- break;
- case 15:
- rbits=5;
- gbits=5;
- bbits=5;
- break;
- case 16:
- rbits=5;
- gbits=6;
- bbits=5;
- break;
- case 18:
- case 19:
- rbits=6;
- gbits=6;
- bbits=6;
- break;
- case 24: case 32:
- rbits=gbits=bbits=8;
- break;
- }
- screencols=cmap.len=1<<qMax(rbits,qMax(gbits,bbits));
- cmap.red=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.green=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.blue=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.transp=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- for(unsigned int i = 0x0; i < cmap.len; i++) {
- cmap.red[i] = i*65535/((1<<rbits)-1);
- cmap.green[i] = i*65535/((1<<gbits)-1);
- cmap.blue[i] = i*65535/((1<<bbits)-1);
- cmap.transp[i] = 0;
- }
- }
-}
-
-/*!
- \reimp
-
- This is called by the \l{Qt for Embedded Linux} server at startup time.
- It turns off console blinking, sets up the color palette, enables write
- combining on the framebuffer and initialises the off-screen memory
- manager.
-*/
-
-bool QLinuxFbScreen::initDevice()
-{
- d_ptr->openTty();
-
- // Grab current mode so we can reset it
- fb_var_screeninfo vinfo;
- fb_fix_screeninfo finfo;
- //#######################
- // Shut up Valgrind
- memset(&vinfo, 0, sizeof(vinfo));
- memset(&finfo, 0, sizeof(finfo));
- //#######################
-
- if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) {
- perror("QLinuxFbScreen::initDevice");
- qFatal("Error reading variable information in card init");
- return false;
- }
-
-#ifdef DEBUG_VINFO
- qDebug("Greyscale %d",vinfo.grayscale);
- qDebug("Nonstd %d",vinfo.nonstd);
- qDebug("Red %d %d %d",vinfo.red.offset,vinfo.red.length,
- vinfo.red.msb_right);
- qDebug("Green %d %d %d",vinfo.green.offset,vinfo.green.length,
- vinfo.green.msb_right);
- qDebug("Blue %d %d %d",vinfo.blue.offset,vinfo.blue.length,
- vinfo.blue.msb_right);
- qDebug("Transparent %d %d %d",vinfo.transp.offset,vinfo.transp.length,
- vinfo.transp.msb_right);
-#endif
-
- if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) {
- perror("QLinuxFbScreen::initDevice");
- qCritical("Error reading fixed information in card init");
- // It's not an /error/ as such, though definitely a bad sign
- // so we return true
- return true;
- }
-
- fixupScreenInfo(finfo, vinfo);
-
- d_ptr->startupw=vinfo.xres;
- d_ptr->startuph=vinfo.yres;
- d_ptr->startupd=vinfo.bits_per_pixel;
- grayscale = vinfo.grayscale;
-
-#ifdef __i386__
- // Now init mtrr
- if(!::getenv("QWS_NOMTRR")) {
- int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0);
- // MTRR entry goes away when file is closed - i.e.
- // hopefully when QWS is killed
- if(mfd != -1) {
- mtrr_sentry sentry;
- sentry.base=(unsigned long int)finfo.smem_start;
- //qDebug("Physical framebuffer address %p",(void*)finfo.smem_start);
- // Size needs to be in 4k chunks, but that's not always
- // what we get thanks to graphics card registers. Write combining
- // these is Not Good, so we write combine what we can
- // (which is not much - 4 megs on an 8 meg card, it seems)
- unsigned int size=finfo.smem_len;
- size=size >> 22;
- size=size << 22;
- sentry.size=size;
- sentry.type=MTRR_TYPE_WRCOMB;
- if(ioctl(mfd,MTRRIOC_ADD_ENTRY,&sentry)==-1) {
- //printf("Couldn't add mtrr entry for %lx %lx, %s\n",
- //sentry.base,sentry.size,strerror(errno));
- }
- }
-
- // Should we close mfd here?
- //QT_CLOSE(mfd);
- }
-#endif
- if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR))
- {
- fb_cmap cmap;
- createPalette(cmap, vinfo, finfo);
- if (ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap)) {
- perror("QLinuxFbScreen::initDevice");
- qWarning("Error writing palette to framebuffer");
- }
- free(cmap.red);
- free(cmap.green);
- free(cmap.blue);
- free(cmap.transp);
- }
-
- if (canaccel) {
- *entryp=0;
- *lowest = mapsize;
- insert_entry(*entryp, *lowest, *lowest); // dummy entry to mark start
- }
-
- shared->fifocount = 0;
- shared->buffer_offset = 0xffffffff; // 0 would be a sensible offset (screen)
- shared->linestep = 0;
- shared->cliptop = 0xffffffff;
- shared->clipleft = 0xffffffff;
- shared->clipright = 0xffffffff;
- shared->clipbottom = 0xffffffff;
- shared->rop = 0xffffffff;
-
-#ifdef QT_QWS_DEPTH_GENERIC
- if (pixelFormat() == QImage::Format_Invalid && screencols == 0
- && d_ptr->doGenericColors)
- {
- qt_set_generic_blit(this, vinfo.bits_per_pixel,
- vinfo.red.length, vinfo.green.length,
- vinfo.blue.length, vinfo.transp.length,
- vinfo.red.offset, vinfo.green.offset,
- vinfo.blue.offset, vinfo.transp.offset);
- }
-#endif
-
-#ifndef QT_NO_QWS_CURSOR
- QScreenCursor::initSoftwareCursor();
-#endif
- blank(false);
-
- return true;
-}
-
-/*
- The offscreen memory manager's list of entries is stored at the bottom
- of the offscreen memory area and consistes of a series of QPoolEntry's,
- each of which keep track of a block of allocated memory. Unallocated memory
- is implicitly indicated by the gap between blocks indicated by QPoolEntry's.
- The memory manager looks through any unallocated memory before the end
- of currently-allocated memory to see if a new block will fit in the gap;
- if it doesn't it allocated it from the end of currently-allocated memory.
- Memory is allocated from the top of the framebuffer downwards; if it hits
- the list of entries then offscreen memory is full and further allocations
- are made from main RAM (and hence unaccelerated). Allocated memory can
- be seen as a sort of upside-down stack; lowest keeps track of the
- bottom of the stack.
-*/
-
-void QLinuxFbScreen::delete_entry(int pos)
-{
- if (pos > *entryp || pos < 0) {
- qWarning("Attempt to delete odd pos! %d %d", pos, *entryp);
- return;
- }
-
-#ifdef DEBUG_CACHE
- qDebug("Remove entry: %d", pos);
-#endif
-
- QPoolEntry *qpe = &entries[pos];
- if (qpe->start <= *lowest) {
- // Lowest goes up again
- *lowest = entries[pos-1].start;
-#ifdef DEBUG_CACHE
- qDebug(" moved lowest to %d", *lowest);
-#endif
- }
-
- (*entryp)--;
- if (pos == *entryp)
- return;
-
- int size = (*entryp)-pos;
- memmove(&entries[pos], &entries[pos+1], size*sizeof(QPoolEntry));
-}
-
-void QLinuxFbScreen::insert_entry(int pos, int start, int end)
-{
- if (pos > *entryp) {
- qWarning("Attempt to insert odd pos! %d %d",pos,*entryp);
- return;
- }
-
-#ifdef DEBUG_CACHE
- qDebug("Insert entry: %d, %d -> %d", pos, start, end);
-#endif
-
- if (start < (int)*lowest) {
- *lowest = start;
-#ifdef DEBUG_CACHE
- qDebug(" moved lowest to %d", *lowest);
-#endif
- }
-
- if (pos == *entryp) {
- entries[pos].start = start;
- entries[pos].end = end;
- entries[pos].clientId = qws_client_id;
- (*entryp)++;
- return;
- }
-
- int size=(*entryp)-pos;
- memmove(&entries[pos+1],&entries[pos],size*sizeof(QPoolEntry));
- entries[pos].start=start;
- entries[pos].end=end;
- entries[pos].clientId=qws_client_id;
- (*entryp)++;
-}
-
-/*!
- \fn uchar * QLinuxFbScreen::cache(int amount)
-
- Requests the specified \a amount of offscreen graphics card memory
- from the memory manager, and returns a pointer to the data within
- the framebuffer (or 0 if there is no free memory).
-
- Note that the display is locked while memory is allocated in order to
- preserve the memory pool's integrity.
-
- Use the QScreen::onCard() function to retrieve an offset (in
- bytes) from the start of graphics card memory for the returned
- pointer.
-
- \sa uncache(), clearCache(), deleteEntry()
-*/
-
-uchar * QLinuxFbScreen::cache(int amount)
-{
- if (!canaccel || entryp == 0)
- return 0;
-
- qt_fbdpy->grab();
-
- int startp = cacheStart + (*entryp+1) * sizeof(QPoolEntry);
- if (startp >= (int)*lowest) {
- // We don't have room for another cache QPoolEntry.
-#ifdef DEBUG_CACHE
- qDebug("No room for pool entry in VRAM");
-#endif
- qt_fbdpy->ungrab();
- return 0;
- }
-
- int align = pixmapOffsetAlignment();
-
- if (*entryp > 1) {
- // Try to find a gap in the allocated blocks.
- for (int loopc = 0; loopc < *entryp-1; loopc++) {
- int freestart = entries[loopc+1].end;
- int freeend = entries[loopc].start;
- if (freestart != freeend) {
- while (freestart % align) {
- freestart++;
- }
- int len=freeend-freestart;
- if (len >= amount) {
- insert_entry(loopc+1, freestart, freestart+amount);
- qt_fbdpy->ungrab();
- return data+freestart;
- }
- }
- }
- }
-
- // No free blocks in already-taken memory; get some more
- // if we can
- int newlowest = (*lowest)-amount;
- if (newlowest % align) {
- newlowest -= align;
- while (newlowest % align) {
- newlowest++;
- }
- }
- if (startp >= newlowest) {
- qt_fbdpy->ungrab();
-#ifdef DEBUG_CACHE
- qDebug("No VRAM available for %d bytes", amount);
-#endif
- return 0;
- }
- insert_entry(*entryp, newlowest, *lowest);
- qt_fbdpy->ungrab();
-
- return data + newlowest;
-}
-
-/*!
- \fn void QLinuxFbScreen::uncache(uchar * memoryBlock)
-
- Deletes the specified \a memoryBlock allocated from the graphics
- card memory.
-
- Note that the display is locked while memory is unallocated in
- order to preserve the memory pool's integrity.
-
- This function will first sync the graphics card to ensure the
- memory isn't still being used by a command in the graphics card
- FIFO queue. It is possible to speed up a driver by overriding this
- function to avoid syncing. For example, the driver might delay
- deleting the memory until it detects that all commands dealing
- with the memory are no longer in the queue. Note that it will then
- be up to the driver to ensure that the specified \a memoryBlock no
- longer is being used.
-
- \sa cache(), deleteEntry(), clearCache()
- */
-void QLinuxFbScreen::uncache(uchar * c)
-{
- // need to sync graphics card
-
- deleteEntry(c);
-}
-
-/*!
- \fn void QLinuxFbScreen::deleteEntry(uchar * memoryBlock)
-
- Deletes the specified \a memoryBlock allocated from the graphics
- card memory.
-
- \sa uncache(), cache(), clearCache()
-*/
-void QLinuxFbScreen::deleteEntry(uchar * c)
-{
- qt_fbdpy->grab();
- unsigned long pos=(unsigned long)c;
- pos-=((unsigned long)data);
- unsigned int hold=(*entryp);
- for(unsigned int loopc=1;loopc<hold;loopc++) {
- if (entries[loopc].start==pos) {
- if (entries[loopc].clientId == qws_client_id)
- delete_entry(loopc);
- else
- qWarning("Attempt to delete client id %d cache entry",
- entries[loopc].clientId);
- qt_fbdpy->ungrab();
- return;
- }
- }
- qt_fbdpy->ungrab();
- qWarning("Attempt to delete unknown offset %ld",pos);
-}
-
-/*!
- Removes all entries from the cache for the specified screen \a
- instance and client identified by the given \a clientId.
-
- Calling this function should only be necessary if a client exits
- abnormally.
-
- \sa cache(), uncache(), deleteEntry()
-*/
-void QLinuxFbScreen::clearCache(QScreen *instance, int clientId)
-{
- QLinuxFbScreen *screen = (QLinuxFbScreen *)instance;
- if (!screen->canaccel || !screen->entryp)
- return;
- qt_fbdpy->grab();
- for (int loopc = 0; loopc < *(screen->entryp); loopc++) {
- if (screen->entries[loopc].clientId == clientId) {
- screen->delete_entry(loopc);
- loopc--;
- }
- }
- qt_fbdpy->ungrab();
-}
-
-
-void QLinuxFbScreen::setupOffScreen()
-{
- // Figure out position of offscreen memory
- // Set up pool entries pointer table and 64-bit align it
- int psize = size;
-
- // hw: this causes the limitation of cursors to 64x64
- // the cursor should rather use the normal pixmap mechanism
- psize += 4096; // cursor data
- psize += 8; // for alignment
- psize &= ~0x7; // align
-
- unsigned long pos = (unsigned long)data;
- pos += psize;
- entryp = ((int *)pos);
- lowest = ((unsigned int *)pos)+1;
- pos += (sizeof(int))*4;
- entries = (QPoolEntry *)pos;
-
- // beginning of offscreen memory available for pixmaps.
- cacheStart = psize + 4*sizeof(int) + sizeof(QPoolEntry);
-}
-
-/*!
- \reimp
-
- This is called by the \l{Qt for Embedded Linux} server when it shuts
- down, and should be inherited if you need to do any card-specific cleanup.
- The default version hides the screen cursor and reenables the blinking
- cursor and screen blanking.
-*/
-
-void QLinuxFbScreen::shutdownDevice()
-{
- // Causing crashes. Not needed.
- //setMode(startupw,startuph,startupd);
-/*
- if (startupd == 8) {
- ioctl(fd,FBIOPUTCMAP,startcmap);
- free(startcmap->red);
- free(startcmap->green);
- free(startcmap->blue);
- free(startcmap->transp);
- delete startcmap;
- startcmap = 0;
- }
-*/
- d_ptr->closeTty();
-}
-
-/*!
- \fn void QLinuxFbScreen::set(unsigned int index,unsigned int red,unsigned int green,unsigned int blue)
-
- Sets the specified color \a index to the specified RGB value, (\a
- red, \a green, \a blue), when in paletted graphics modes.
-*/
-
-void QLinuxFbScreen::set(unsigned int i,unsigned int r,unsigned int g,unsigned int b)
-{
- if (d_ptr->fd != -1) {
- fb_cmap cmap;
- cmap.start=i;
- cmap.len=1;
- cmap.red=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.green=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.blue=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.transp=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.red[0]=r << 8;
- cmap.green[0]=g << 8;
- cmap.blue[0]=b << 8;
- cmap.transp[0]=0;
- ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap);
- free(cmap.red);
- free(cmap.green);
- free(cmap.blue);
- free(cmap.transp);
- }
- screenclut[i] = qRgb(r, g, b);
-}
-
-/*!
- \reimp
-
- Sets the framebuffer to a new resolution and bit depth. The width is
- in \a nw, the height is in \a nh, and the depth is in \a nd. After
- doing this any currently-existing paint engines will be invalid and the
- screen should be completely redrawn. In a multiple-process
- Embedded Qt situation you must signal all other applications to
- call setMode() to the same mode and redraw.
-*/
-
-void QLinuxFbScreen::setMode(int nw,int nh,int nd)
-{
- if (d_ptr->fd == -1)
- return;
-
- fb_fix_screeninfo finfo;
- fb_var_screeninfo vinfo;
- //#######################
- // Shut up Valgrind
- memset(&vinfo, 0, sizeof(vinfo));
- memset(&finfo, 0, sizeof(finfo));
- //#######################
-
- if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) {
- perror("QLinuxFbScreen::setMode");
- qFatal("Error reading variable information in mode change");
- }
-
- vinfo.xres=nw;
- vinfo.yres=nh;
- vinfo.bits_per_pixel=nd;
-
- if (ioctl(d_ptr->fd, FBIOPUT_VSCREENINFO, &vinfo)) {
- perror("QLinuxFbScreen::setMode");
- qCritical("Error writing variable information in mode change");
- }
-
- if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) {
- perror("QLinuxFbScreen::setMode");
- qFatal("Error reading changed variable information in mode change");
- }
-
- if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) {
- perror("QLinuxFbScreen::setMode");
- qFatal("Error reading fixed information");
- }
-
- fixupScreenInfo(finfo, vinfo);
- disconnect();
- connect(d_ptr->displaySpec);
- exposeRegion(region(), 0);
-}
-
-// save the state of the graphics card
-// This is needed so that e.g. we can restore the palette when switching
-// between linux virtual consoles.
-
-/*!
- \reimp
-
- This doesn't do anything; accelerated drivers may wish to reimplement
- it to save graphics cards registers. It's called by the
- \l{Qt for Embedded Linux} server when the virtual console is switched.
-*/
-
-void QLinuxFbScreen::save()
-{
- // nothing to do.
-}
-
-
-// restore the state of the graphics card.
-/*!
- \reimp
-
- This is called when the virtual console is switched back to
- \l{Qt for Embedded Linux} and restores the palette.
-*/
-void QLinuxFbScreen::restore()
-{
- if (d_ptr->fd == -1)
- return;
-
- if ((d == 8) || (d == 4)) {
- fb_cmap cmap;
- cmap.start=0;
- cmap.len=screencols;
- cmap.red=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.green=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.blue=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- cmap.transp=(unsigned short int *)
- malloc(sizeof(unsigned short int)*256);
- for (int loopc = 0; loopc < screencols; loopc++) {
- cmap.red[loopc] = qRed(screenclut[loopc]) << 8;
- cmap.green[loopc] = qGreen(screenclut[loopc]) << 8;
- cmap.blue[loopc] = qBlue(screenclut[loopc]) << 8;
- cmap.transp[loopc] = 0;
- }
- ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap);
- free(cmap.red);
- free(cmap.green);
- free(cmap.blue);
- free(cmap.transp);
- }
-}
-
-/*!
- \fn int QLinuxFbScreen::sharedRamSize(void * end)
- \internal
-*/
-
-// This works like the QScreenCursor code. end points to the end
-// of our shared structure, we return the amount of memory we reserved
-int QLinuxFbScreen::sharedRamSize(void * end)
-{
- shared=(QLinuxFb_Shared *)end;
- shared--;
- return sizeof(QLinuxFb_Shared);
-}
-
-/*!
- \reimp
-*/
-void QLinuxFbScreen::setDirty(const QRect &r)
-{
- if(d_ptr->driverType == EInk8Track) {
- // e-Ink displays need a trigger to actually show what is
- // in their framebuffer memory. The 8-Track driver does this
- // by adding custom IOCTLs - FBIO_EINK_DISP_PIC (0x46a2) takes
- // an argument specifying whether or not to flash the screen
- // while updating.
- // There doesn't seem to be a way to tell it to just update
- // a subset of the screen.
- if(r.left() == 0 && r.top() == 0 && r.width() == dw && r.height() == dh)
- ioctl(d_ptr->fd, 0x46a2, 1);
- else
- ioctl(d_ptr->fd, 0x46a2, 0);
- }
-}
-
-/*!
- \reimp
-*/
-void QLinuxFbScreen::blank(bool on)
-{
- if (d_ptr->blank == on)
- return;
-
-#if defined(QT_QWS_IPAQ)
- if (on)
- system("apm -suspend");
-#else
- if (d_ptr->fd == -1)
- return;
-// Some old kernel versions don't have this. These defines should go
-// away eventually
-#if defined(FBIOBLANK)
-#if defined(VESA_POWERDOWN) && defined(VESA_NO_BLANKING)
- ioctl(d_ptr->fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING);
-#else
- ioctl(d_ptr->fd, FBIOBLANK, on ? 1 : 0);
-#endif
-#endif
-#endif
-
- d_ptr->blank = on;
-}
-
-void QLinuxFbScreen::setPixelFormat(struct fb_var_screeninfo info)
-{
- const fb_bitfield rgba[4] = { info.red, info.green,
- info.blue, info.transp };
-
- QImage::Format format = QImage::Format_Invalid;
-
- switch (d) {
- case 32: {
- const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0},
- {0, 8, 0}, {24, 8, 0}};
- const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0},
- {16, 8, 0}, {24, 8, 0}};
- if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_ARGB32;
- } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB32;
- } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB32;
- pixeltype = QScreen::BGRPixel;
- }
- break;
- }
- case 24: {
- const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0},
- {0, 8, 0}, {0, 0, 0}};
- const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0},
- {16, 8, 0}, {0, 0, 0}};
- if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB888;
- } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB888;
- pixeltype = QScreen::BGRPixel;
- }
- break;
- }
- case 18: {
- const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0},
- {0, 6, 0}, {0, 0, 0}};
- if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0)
- format = QImage::Format_RGB666;
- break;
- }
- case 16: {
- const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0},
- {0, 5, 0}, {0, 0, 0}};
- const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0},
- {11, 5, 0}, {0, 0, 0}};
- if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB16;
- } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB16;
- pixeltype = QScreen::BGRPixel;
- }
- break;
- }
- case 15: {
- const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0},
- {0, 5, 0}, {15, 1, 0}};
- const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0},
- {10, 5, 0}, {15, 1, 0}};
- if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB555;
- } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) {
- format = QImage::Format_RGB555;
- pixeltype = QScreen::BGRPixel;
- }
- break;
- }
- case 12: {
- const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0},
- {0, 4, 0}, {0, 0, 0}};
- if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0)
- format = QImage::Format_RGB444;
- break;
- }
- case 8:
- break;
- case 1:
- format = QImage::Format_Mono; //###: LSB???
- break;
- default:
- break;
- }
-
- QScreen::setPixelFormat(format);
-}
-
-bool QLinuxFbScreen::useOffscreen()
-{
- // Not done for 8Track because on e-Ink displays,
- // everything is offscreen anyway
- if (d_ptr->driverType == EInk8Track || ((mapsize - size) < 16*1024))
- return false;
-
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_LINUXFB
diff --git a/src/gui/embedded/qscreenlinuxfb_qws.h b/src/gui/embedded/qscreenlinuxfb_qws.h
deleted file mode 100644
index 4142bb5dd4..0000000000
--- a/src/gui/embedded/qscreenlinuxfb_qws.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENLINUXFB_QWS_H
-#define QSCREENLINUXFB_QWS_H
-
-#include <QtGui/qscreen_qws.h>
-
-struct fb_cmap;
-struct fb_var_screeninfo;
-struct fb_fix_screeninfo;
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_LINUXFB
-
-class QLinuxFb_Shared
-{
-public:
- volatile int lastop;
- volatile int optype;
- volatile int fifocount; // Accel drivers only
- volatile int fifomax;
- volatile int forecol; // Foreground colour caching
- volatile unsigned int buffer_offset; // Destination
- volatile int linestep;
- volatile int cliptop; // Clip rectangle
- volatile int clipleft;
- volatile int clipright;
- volatile int clipbottom;
- volatile unsigned int rop;
-
-};
-
-class QLinuxFbScreenPrivate;
-
-class Q_GUI_EXPORT QLinuxFbScreen : public QScreen
-{
-public:
- explicit QLinuxFbScreen(int display_id);
- virtual ~QLinuxFbScreen();
-
- virtual bool initDevice();
- virtual bool connect(const QString &displaySpec);
-
- virtual bool useOffscreen();
-
- enum DriverTypes { GenericDriver, EInk8Track };
-
- virtual void disconnect();
- virtual void shutdownDevice();
- virtual void setMode(int,int,int);
- virtual void save();
- virtual void restore();
- virtual void blank(bool on);
- virtual void set(unsigned int,unsigned int,unsigned int,unsigned int);
- virtual uchar * cache(int);
- virtual void uncache(uchar *);
- virtual int sharedRamSize(void *);
- virtual void setDirty(const QRect&);
-
- QLinuxFb_Shared * shared;
-
-protected:
-
- void deleteEntry(uchar *);
-
- bool canaccel;
- int dataoffset;
- int cacheStart;
-
- virtual void fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo);
- static void clearCache(QScreen *instance, int);
-
-private:
-
- void delete_entry(int);
- void insert_entry(int,int,int);
- void setupOffScreen();
- void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo);
- void setPixelFormat(struct fb_var_screeninfo);
-
- QLinuxFbScreenPrivate *d_ptr;
-};
-
-#endif // QT_NO_QWS_LINUXFB
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREENLINUXFB_QWS_H
diff --git a/src/gui/embedded/qscreenmulti_qws.cpp b/src/gui/embedded/qscreenmulti_qws.cpp
deleted file mode 100644
index 8a27a7cb82..0000000000
--- a/src/gui/embedded/qscreenmulti_qws.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreenmulti_qws_p.h"
-
-#ifndef QT_NO_QWS_MULTISCREEN
-
-#include <qlist.h>
-#include <qstringlist.h>
-#include <qwidget.h>
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_QWS_CURSOR
-
-class QMultiScreenCursor : public QScreenCursor
-{
-public:
- QMultiScreenCursor() : currentCursor(qt_screencursor) { enable = false; }
- ~QMultiScreenCursor() { qt_screencursor = 0; }
-
- void set(const QImage &image, int hotx, int hoty);
- void move(int x, int y);
- void show();
- void hide();
-
- void addCursor(QScreenCursor *cursor);
-
-private:
- void setCurrentCursor(QScreenCursor *newCursor);
-
- QScreenCursor *currentCursor;
- QList<QScreenCursor*> cursors;
-};
-
-void QMultiScreenCursor::set(const QImage &image, int hotx, int hoty)
-{
- QScreenCursor::set(image, hotx, hoty);
- if (currentCursor)
- currentCursor->set(image, hotx, hoty);
-}
-
-void QMultiScreenCursor::setCurrentCursor(QScreenCursor *newCursor)
-{
- *((QScreenCursor*)this) = *newCursor;
- currentCursor = newCursor;
-}
-
-// XXX: this is a mess!
-void QMultiScreenCursor::move(int x, int y)
-{
- const int oldIndex = qt_screen->subScreenIndexAt(pos);
- QScreenCursor::move(x, y); // updates pos
- const int newIndex = qt_screen->subScreenIndexAt(pos);
-
- if (!currentCursor && oldIndex != -1)
- setCurrentCursor(cursors.at(oldIndex));
- QScreenCursor *oldCursor = currentCursor;
-
- if (oldIndex != -1) {
- const QScreen *oldScreen = qt_screen->subScreens().at(oldIndex);
- if (newIndex == -1 || oldScreen->region().contains(pos)) {
- oldCursor->move(x, y);
- return;
- }
- }
-
- if (newIndex != -1) {
- QScreenCursor *newCursor = cursors.at(newIndex);
- newCursor->set(cursor, hotspot.x(), hotspot.y());
-
- if (oldCursor) {
- if (oldCursor->isVisible())
- newCursor->show();
- oldCursor->hide();
- }
-
- newCursor->move(x, y);
-
- setCurrentCursor(newCursor);
- }
-}
-
-void QMultiScreenCursor::show()
-{
- if (currentCursor)
- currentCursor->show();
-}
-
-void QMultiScreenCursor::hide()
-{
- if (currentCursor)
- currentCursor->hide();
-}
-
-void QMultiScreenCursor::addCursor(QScreenCursor *cursor)
-{
- cursors.append(cursor);
-}
-
-#endif
-
-class QMultiScreenPrivate
-{
-public:
- QMultiScreenPrivate()
-#ifndef QT_NO_QWS_CURSOR
- : cursor(0)
-#endif
- {}
- ~QMultiScreenPrivate()
- {
-#ifndef QT_NO_QWS_CURSOR
- delete cursor;
-#endif
- }
-
- QList<QScreen*> screens;
- QRegion region;
-#ifndef QT_NO_QWS_CURSOR
- QMultiScreenCursor *cursor;
-#endif
-};
-
-QMultiScreen::QMultiScreen(int displayId)
- : QScreen(displayId, MultiClass), d_ptr(new QMultiScreenPrivate)
-{
-}
-
-QMultiScreen::~QMultiScreen()
-{
- delete d_ptr;
-}
-
-bool QMultiScreen::initDevice()
-{
- bool ok = true;
-
-#ifndef QT_NO_QWS_CURSOR
- d_ptr->cursor = new QMultiScreenCursor;
-#endif
-
- const int n = d_ptr->screens.count();
- for (int i = 0; i < n; ++i) {
- QScreen *s = d_ptr->screens.at(i);
- ok = s->initDevice() && ok;
-#ifndef QT_NO_QWS_CURSOR
- d_ptr->cursor->addCursor(qt_screencursor); // XXX
-#endif
- }
-
-#ifndef QT_NO_QWS_CURSOR
- // XXX
- qt_screencursor = d_ptr->cursor;
-#endif
-
- return ok;
-}
-
-static int getDisplayId(const QString &spec)
-{
- QRegExp regexp(QLatin1String(":(\\d+)\\b"));
- if (regexp.lastIndexIn(spec) != -1) {
- const QString capture = regexp.cap(1);
- return capture.toInt();
- }
- return 0;
-}
-
-static QPoint filterDisplayOffset(QString &spec)
-{
- QRegExp regexp(QLatin1String(":offset=(\\d+),(\\d+)\\b"));
- if (regexp.indexIn(spec) == -1)
- return QPoint();
-
- const int x = regexp.cap(1).toInt();
- const int y = regexp.cap(2).toInt();
- spec.remove(regexp.pos(0), regexp.matchedLength());
- return QPoint(x, y);
-}
-
-bool QMultiScreen::connect(const QString &displaySpec)
-{
- QString dSpec = displaySpec;
- if (dSpec.startsWith(QLatin1String("Multi:"), Qt::CaseInsensitive))
- dSpec = dSpec.mid(QString::fromLatin1("Multi:").size());
-
- const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
- if (dSpec.endsWith(displayIdSpec))
- dSpec = dSpec.left(dSpec.size() - displayIdSpec.size());
-
- QStringList specs = dSpec.split(QLatin1Char(' '), QString::SkipEmptyParts);
- foreach (QString spec, specs) {
- const int id = getDisplayId(spec);
- if (spec.startsWith("vnc:", Qt::CaseInsensitive)) {
- spec.append(":noDisablePainting");
- }
- const QPoint offset = filterDisplayOffset(spec);
- QScreen *s = qt_get_screen(id, spec.toLatin1().constData());
- s->setOffset(offset);
- addSubScreen(s);
- }
-
- QScreen *firstScreen = d_ptr->screens.at(0);
- Q_ASSERT(firstScreen);
-
- // XXX
- QScreen::d = firstScreen->depth();
-
- QScreen::lstep = 0;
- QScreen::data = 0;
- QScreen::size = 0;
-
- QScreen::w = d_ptr->region.boundingRect().width();
- QScreen::h = d_ptr->region.boundingRect().height();
-
- QScreen::dw = QScreen::w;
- QScreen::dh = QScreen::h;
-
- // XXX - Extend the physical size based on the first screen
- // to encompass all screens, so that code that uses the multi
- // screen to calculate dpi values will get the right numbers.
- QScreen::physWidth = firstScreen->physicalWidth() * w / firstScreen->width();
- QScreen::physHeight = firstScreen->physicalHeight() * h / firstScreen->height();
-
- // XXXXX
- qt_screen = this;
-
- return true;
-}
-
-void QMultiScreen::disconnect()
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- d_ptr->screens.at(i)->disconnect();
-}
-
-void QMultiScreen::shutdownDevice()
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- d_ptr->screens.at(i)->shutdownDevice();
-}
-
-void QMultiScreen::setMode(int, int, int)
-{
- return;
-}
-
-bool QMultiScreen::supportsDepth(int) const
-{
- return false;
-}
-
-void QMultiScreen::save()
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- d_ptr->screens.at(i)->save();
-}
-
-void QMultiScreen::restore()
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- d_ptr->screens.at(i)->restore();
-}
-
-void QMultiScreen::blank(bool on)
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- d_ptr->screens.at(i)->blank(on);
-}
-
-bool QMultiScreen::onCard(const unsigned char *ptr) const
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- if (d_ptr->screens.at(i)->onCard(ptr))
- return true;
- return false;
-}
-
-bool QMultiScreen::onCard(const unsigned char *ptr, ulong &offset) const
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- if (d_ptr->screens.at(i)->onCard(ptr, offset))
- return true;
- return false;
-}
-
-bool QMultiScreen::isInterlaced() const
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- if (d_ptr->screens.at(i)->isInterlaced())
- return true;
-
- return false;
-}
-
-int QMultiScreen::memoryNeeded(const QString &string)
-{
- int total = 0;
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- total += d_ptr->screens.at(i)->memoryNeeded(string);
- return total;
-}
-
-int QMultiScreen::sharedRamSize(void *arg)
-{
- int total = 0;
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- total += d_ptr->screens.at(i)->sharedRamSize(arg);
- return total;
-}
-
-void QMultiScreen::haltUpdates()
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- d_ptr->screens.at(i)->haltUpdates();
-}
-
-void QMultiScreen::resumeUpdates()
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i)
- d_ptr->screens.at(i)->resumeUpdates();
-}
-
-void QMultiScreen::exposeRegion(QRegion region, int changing)
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i) {
- QScreen *screen = d_ptr->screens.at(i);
- const QRegion r = region & screen->region();
- if (r.isEmpty())
- continue;
- screen->exposeRegion(r, changing);
- }
-}
-
-void QMultiScreen::solidFill(const QColor &color, const QRegion &region)
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i) {
- QScreen *screen = d_ptr->screens.at(i);
- const QRegion r = region & screen->region();
- if (r.isEmpty())
- continue;
- screen->solidFill(color, r);
- }
-}
-
-void QMultiScreen::blit(const QImage &img, const QPoint &topLeft,
- const QRegion &region)
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i) {
- QScreen *screen = d_ptr->screens.at(i);
- const QRegion r = region & screen->region();
- if (r.isEmpty())
- continue;
- screen->blit(img, topLeft, r);
- }
-}
-
-void QMultiScreen::blit(QWSWindow *bs, const QRegion &clip)
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i) {
- QScreen *screen = d_ptr->screens.at(i);
- const QRegion r = clip & screen->region();
- if (r.isEmpty())
- continue;
- screen->blit(bs, r);
- }
-}
-
-void QMultiScreen::setDirty(const QRect &rect)
-{
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i) {
- QScreen *screen = d_ptr->screens.at(i);
- const QRegion r = screen->region() & rect;
- if (r.isEmpty())
- continue;
- screen->setDirty(r.boundingRect());
- }
-}
-
-
-QWSWindowSurface* QMultiScreen::createSurface(const QString &key) const
-{
- QWSWindowSurface* surf = 0;
- const int n = d_ptr->screens.size();
- for (int i = 0; i < n; ++i) {
- QScreen *screen = d_ptr->screens.at(i);
- surf = screen->createSurface(key);
- if (surf)
- break;
- }
- return surf;
-}
-
-
-QWSWindowSurface* QMultiScreen::createSurface(QWidget *widget) const
-{
- const QPoint midpoint = (widget->frameGeometry().topLeft()
- + widget->frameGeometry().bottomRight()) / 2;
- int index = subScreenIndexAt(midpoint);
- if (index == -1)
- index = 0; // XXX
- return d_ptr->screens.at(index)->createSurface(widget);
-}
-
-QList<QScreen*> QMultiScreen::subScreens() const
-{
- return d_ptr->screens;
-}
-
-QRegion QMultiScreen::region() const
-{
- return d_ptr->region;
-}
-
-void QMultiScreen::addSubScreen(QScreen *screen)
-{
- d_ptr->screens.append(screen);
- d_ptr->region += screen->region();
-}
-
-void QMultiScreen::removeSubScreen(QScreen *screen)
-{
- d_ptr->screens.removeAll(screen);
- d_ptr->region -= screen->region();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MULTISCREEN
diff --git a/src/gui/embedded/qscreenmulti_qws_p.h b/src/gui/embedded/qscreenmulti_qws_p.h
deleted file mode 100644
index b7eba7e374..0000000000
--- a/src/gui/embedded/qscreenmulti_qws_p.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMULTISCREEN_QWS_P_H
-#define QMULTISCREEN_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qscreen_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_QWS_MULTISCREEN
-
-class QMultiScreenPrivate;
-
-class QMultiScreen : public QScreen
-{
-public:
- QMultiScreen(int displayId);
- ~QMultiScreen();
- bool initDevice();
- bool connect(const QString &displaySpec);
- void disconnect();
- void shutdownDevice();
- void setMode(int,int,int);
- bool supportsDepth(int) const;
-
- void save();
- void restore();
- void blank(bool on);
-
- bool onCard(const unsigned char *) const;
- bool onCard(const unsigned char *, ulong& out_offset) const;
-
- bool isInterlaced() const;
-
- int memoryNeeded(const QString&);
- int sharedRamSize(void *);
-
- void haltUpdates();
- void resumeUpdates();
-
- void exposeRegion(QRegion r, int changing);
-
- void blit(const QImage &img, const QPoint &topLeft, const QRegion &region);
- void solidFill(const QColor &color, const QRegion &region);
- void blit(QWSWindow *bs, const QRegion &clip);
- void setDirty(const QRect&);
-
- QWSWindowSurface* createSurface(QWidget *widget) const;
- QWSWindowSurface* createSurface(const QString &key) const;
-
- QList<QScreen*> subScreens() const;
- QRegion region() const;
-
-private:
- void addSubScreen(QScreen *screen);
- void removeSubScreen(QScreen *screen);
-
- QMultiScreenPrivate *d_ptr;
-};
-
-
-QT_END_NAMESPACE
-#endif // QT_NO_QWS_MULTISCREEN
-#endif // QMULTISCREEN_QWS_P_H
diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp
deleted file mode 100644
index 706524ad19..0000000000
--- a/src/gui/embedded/qscreenproxy_qws.cpp
+++ /dev/null
@@ -1,635 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qscreenproxy_qws.h>
-
-#ifndef QT_NO_QWS_PROXYSCREEN
-
-#include <qregexp.h>
-
-QT_BEGIN_NAMESPACE
-#ifndef QT_NO_QWS_CURSOR
-
-/*!
- \class QProxyScreenCursor
- \since 4.5
- \ingroup qws
- \brief The QProxyScreenCursor class provides a generic interface to
- QScreenCursor implementations.
-*/
-
-/*!
- Constructs a proxy screen cursor.
-*/
-QProxyScreenCursor::QProxyScreenCursor()
- : QScreenCursor(), realCursor(0), d_ptr(0)
-{
-}
-
-/*!
- Destroys the proxy screen cursor.
-*/
-QProxyScreenCursor::~QProxyScreenCursor()
-{
-}
-
-/*!
- Sets the real screen cursor to be used for the proxy screen cursor to
- the \a cursor specified.
-
- \sa screenCursor()
-*/
-void QProxyScreenCursor::setScreenCursor(QScreenCursor *cursor)
-{
- realCursor = cursor;
- configure();
-}
-
-/*!
- Returns the real screen cursor used by the proxy screen cursor.
-
- \sa setScreenCursor()
-*/
-QScreenCursor* QProxyScreenCursor::screenCursor() const
-{
- return realCursor;
-}
-
-/*!
- \reimp
-*/
-void QProxyScreenCursor::set(const QImage &image, int hotx, int hoty)
-{
- if (realCursor) {
- hotspot = QPoint(hotx, hoty);
- cursor = image;
- size = image.size();
- realCursor->set(image, hotx, hoty);
- } else {
- QScreenCursor::set(image, hotx, hoty);
- }
-}
-
-/*!
- \reimp
-*/
-void QProxyScreenCursor::move(int x, int y)
-{
- if (realCursor) {
- pos = QPoint(x, y);
- realCursor->move(x, y);
- } else {
- QScreenCursor::move(x, y);
- }
-}
-
-/*!
- \reimp
-*/
-void QProxyScreenCursor::show()
-{
- if (realCursor) {
- realCursor->show();
- enable = true;
- } else {
- QScreenCursor::show();
- }
-}
-
-/*!
- \reimp
-*/
-void QProxyScreenCursor::hide()
-{
- if (realCursor) {
- realCursor->hide();
- enable = false;
- } else {
- QScreenCursor::hide();
- }
-}
-
-/*!
- \internal
-*/
-void QProxyScreenCursor::configure()
-{
- if (!realCursor)
- return;
-
- cursor = realCursor->cursor;
- size = realCursor->size;
- pos = realCursor->pos;
- hotspot = realCursor->hotspot;
- enable = realCursor->enable;
- hwaccel = realCursor->hwaccel;
- supportsAlpha = realCursor->supportsAlpha;
-}
-
-#endif // QT_NO_QWS_CURSOR
-
-/*!
- \class QProxyScreen
- \ingroup qws
- \brief The QProxyScreen class provides a generic interface to QScreen implementations.
-*/
-
-/*!
- \fn QProxyScreen::QProxyScreen(int displayId, ClassId classId)
-
- Constructs a proxy screen with the given \a displayId and \a classId.
-*/
-QProxyScreen::QProxyScreen(int displayId, QScreen::ClassId classId)
- : QScreen(displayId, classId), realScreen(0), d_ptr(0)
-{
-}
-
-/*!
- Destroys the proxy screen.
-*/
-QProxyScreen::~QProxyScreen()
-{
-}
-
-/*!
- Sets the real \a screen to be used by the proxy screen.
-
- \sa screen()
-*/
-void QProxyScreen::setScreen(QScreen *screen)
-{
- realScreen = screen;
- configure();
-}
-
-/*!
- Returns the real screen used by the proxy screen.
-
- \sa setScreen()
-*/
-QScreen* QProxyScreen::screen() const
-{
- return realScreen;
-}
-
-
-/*!
- \internal
-*/
-void QProxyScreen::configure()
-{
- if (!realScreen)
- return;
-
- d = realScreen->depth();
- w = realScreen->width();
- h = realScreen->height();
- dw = realScreen->deviceWidth();
- dh = realScreen->deviceHeight();
- lstep = realScreen->linestep();
- data = realScreen->base();
- lstep = realScreen->linestep();
- size = realScreen->screenSize();
- physWidth = realScreen->physicalWidth();
- physHeight = realScreen->physicalHeight();
- pixeltype = realScreen->pixelType();
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- setFrameBufferLittleEndian(realScreen->frameBufferLittleEndian());
-#endif
-
- setOffset(realScreen->offset());
- setPixelFormat(realScreen->pixelFormat());
-
-#ifdef QT_QWS_CLIENTBLIT
- setSupportsBlitInClients(realScreen->supportsBlitInClients());
-#endif
-}
-
-/*!
- \internal
- Returns the display ID that corresponds to the given \a spec.
-*/
-static int getDisplayId(const QString &spec)
-{
- QRegExp regexp(QLatin1String(":(\\d+)\\b"));
- if (regexp.lastIndexIn(spec) != -1) {
- const QString capture = regexp.cap(1);
- return capture.toInt();
- }
- return 0;
-}
-
-/*!
- \reimp
-*/
-bool QProxyScreen::connect(const QString &displaySpec)
-{
- const int id = getDisplayId(displaySpec);
- realScreen = qt_get_screen(id, displaySpec.toLatin1().constData());
- configure();
-
- return true;
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::exposeRegion(QRegion r, int changing)
-{
- if (!realScreen) {
- QScreen::exposeRegion(r, changing);
- return;
- }
-
- realScreen->exposeRegion(r, changing);
- r &= realScreen->region();
-
- const QVector<QRect> rects = r.rects();
- for (int i = 0; i < rects.size(); ++i)
- setDirty(rects.at(i));
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::blit(const QImage &image, const QPoint &topLeft,
- const QRegion &region)
-{
- if (!realScreen) {
- QScreen::blit(image, topLeft, region);
- return;
- }
-
- realScreen->blit(image, topLeft, region);
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::solidFill(const QColor &color, const QRegion &region)
-{
- if (!realScreen) {
- QScreen::solidFill(color, region);
- return;
- }
- realScreen->solidFill(color, region);
-}
-
-/*!
- \reimp
-*/
-QSize QProxyScreen::mapToDevice(const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapToDevice(s);
-
- return realScreen->mapToDevice(s);
-}
-
-/*!
- \reimp
-*/
-QSize QProxyScreen::mapFromDevice(const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapFromDevice(s);
-
- return realScreen->mapFromDevice(s);
-}
-
-/*!
- \reimp
-*/
-QPoint QProxyScreen::mapToDevice(const QPoint &p, const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapToDevice(p, s);
-
- return realScreen->mapToDevice(p, s);
-}
-
-/*!
- \reimp
-*/
-QPoint QProxyScreen::mapFromDevice(const QPoint &p, const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapFromDevice(p, s);
-
- return realScreen->mapFromDevice(p, s);
-}
-
-/*!
- \reimp
-*/
-QRect QProxyScreen::mapToDevice(const QRect &r, const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapToDevice(r, s);
-
- return realScreen->mapToDevice(r, s);
-}
-
-/*!
- \reimp
-*/
-QRect QProxyScreen::mapFromDevice(const QRect &r, const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapFromDevice(r, s);
-
- return realScreen->mapFromDevice(r, s);
-}
-
-/*!
- \reimp
-*/
-QRegion QProxyScreen::mapToDevice(const QRegion &r, const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapToDevice(r, s);
-
- return realScreen->mapToDevice(r, s);
-}
-
-/*!
- \reimp
-*/
-QRegion QProxyScreen::mapFromDevice(const QRegion &r, const QSize &s) const
-{
- if (!realScreen)
- return QScreen::mapFromDevice(r, s);
-
- return realScreen->mapFromDevice(r, s);
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::disconnect()
-{
- if (realScreen) {
- realScreen->disconnect();
- delete realScreen;
- realScreen = 0;
- }
-}
-
-/*!
-*/
-bool QProxyScreen::initDevice()
-{
- if (realScreen)
- return realScreen->initDevice();
-
- return false;
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::shutdownDevice()
-{
- if (realScreen)
- realScreen->shutdownDevice();
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::setMode(int w,int h, int d)
-{
- if (realScreen) {
- realScreen->setMode(w, h, d);
- } else {
- QScreen::dw = QScreen::w = w;
- QScreen::dh = QScreen::h = h;
- QScreen::d = d;
- }
- configure();
- exposeRegion(region(), 0);
-}
-
-/*!
- \reimp
-*/
-bool QProxyScreen::supportsDepth(int depth) const
-{
- if (realScreen)
- return realScreen->supportsDepth(depth);
- return false;
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::save()
-{
- if (realScreen)
- realScreen->save();
- QScreen::save();
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::restore()
-{
- if (realScreen)
- realScreen->restore();
- QScreen::restore();
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::blank(bool on)
-{
- if (realScreen)
- realScreen->blank(on);
-}
-
-/*!
- \reimp
-*/
-bool QProxyScreen::onCard(const unsigned char *ptr) const
-{
- if (realScreen)
- return realScreen->onCard(ptr);
- return false;
-}
-
-/*!
- \reimp
-*/
-bool QProxyScreen::onCard(const unsigned char *ptr, ulong &offset) const
-{
- if (realScreen)
- return realScreen->onCard(ptr, offset);
- return false;
-}
-
-/*!
- \reimp
-*/
-bool QProxyScreen::isInterlaced() const
-{
- if (realScreen)
- return realScreen->isInterlaced();
- return false;
-}
-
-/*!
- \reimp
-*/
-bool QProxyScreen::isTransformed() const
-{
- if (realScreen)
- return realScreen->isTransformed();
- return QScreen::isTransformed();
-}
-
-/*!
- \reimp
-*/
-int QProxyScreen::transformOrientation() const
-{
- if (realScreen)
- return realScreen->transformOrientation();
- return QScreen::transformOrientation();
-}
-
-/*!
-\internal
-*/
-int QProxyScreen::memoryNeeded(const QString &str)
-{
- if (realScreen)
- return realScreen->memoryNeeded(str);
- else
- return QScreen::memoryNeeded(str);
-}
-
-/*!
-\internal
-*/
-int QProxyScreen::sharedRamSize(void *ptr)
-{
- if (realScreen)
- return realScreen->sharedRamSize(ptr);
- else
- return QScreen::sharedRamSize(ptr);
-}
-
-/*!
-\internal
-*/
-void QProxyScreen::haltUpdates()
-{
- if (realScreen)
- realScreen->haltUpdates();
-}
-
-/*!
-\internal
-*/
-void QProxyScreen::resumeUpdates()
-{
- if (realScreen)
- realScreen->resumeUpdates();
-}
-
-/*!
- \reimp
-*/
-void QProxyScreen::setDirty(const QRect &rect)
-{
- if (realScreen)
- realScreen->setDirty(rect);
-}
-
-/*!
- \reimp
-*/
-QWSWindowSurface* QProxyScreen::createSurface(QWidget *widget) const
-{
- if (realScreen)
- return realScreen->createSurface(widget);
-
- return QScreen::createSurface(widget);
-}
-
-/*!
- \reimp
-*/
-QWSWindowSurface* QProxyScreen::createSurface(const QString &key) const
-{
- if (realScreen)
- return realScreen->createSurface(key);
-
- return QScreen::createSurface(key);
-}
-
-/*!
- \reimp
-*/
-QList<QScreen*> QProxyScreen::subScreens() const
-{
- if (realScreen)
- return realScreen->subScreens();
-
- return QScreen::subScreens();
-}
-
-/*!
- \reimp
-*/
-QRegion QProxyScreen::region() const
-{
- if (realScreen)
- return realScreen->region();
- else
- return QScreen::region();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_PROXYSCREEN
diff --git a/src/gui/embedded/qscreenproxy_qws.h b/src/gui/embedded/qscreenproxy_qws.h
deleted file mode 100644
index bde36aa6bd..0000000000
--- a/src/gui/embedded/qscreenproxy_qws.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPROXYSCREEN_QWS_H
-#define QPROXYSCREEN_QWS_H
-
-#include <QtGui/qscreen_qws.h>
-
-#ifndef QT_NO_QWS_PROXYSCREEN
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QProxyScreenPrivate;
-
-#ifndef QT_NO_QWS_CURSOR
-
-class QProxyScreenCursorPrivate;
-
-class Q_GUI_EXPORT QProxyScreenCursor : public QScreenCursor
-{
-public:
- QProxyScreenCursor();
- ~QProxyScreenCursor();
-
- void setScreenCursor(QScreenCursor *cursor);
- QScreenCursor* screenCursor() const;
-
- void set(const QImage &image, int hotx, int hoty);
- void move(int x, int y);
- void show();
- void hide();
-
-private:
- void configure();
-
- QScreenCursor *realCursor;
- QProxyScreenCursorPrivate *d_ptr;
-};
-
-#endif // QT_NO_QWS_CURSOR
-
-class Q_GUI_EXPORT QProxyScreen : public QScreen
-{
-public:
- QProxyScreen(int display_id, ClassId = ProxyClass);
- ~QProxyScreen();
-
- void setScreen(QScreen *screen);
- QScreen *screen() const;
-
- QSize mapToDevice(const QSize &s) const;
- QSize mapFromDevice(const QSize &s) const;
-
- QPoint mapToDevice(const QPoint &, const QSize &) const;
- QPoint mapFromDevice(const QPoint &, const QSize &) const;
-
- QRect mapToDevice(const QRect &, const QSize &) const;
- QRect mapFromDevice(const QRect &, const QSize &) const;
-
- QRegion mapToDevice(const QRegion &, const QSize &) const;
- QRegion mapFromDevice(const QRegion &, const QSize &) const;
-
- bool connect(const QString &displaySpec);
- bool initDevice();
- void shutdownDevice();
- void disconnect();
-
- void setMode(int width, int height, int depth);
- bool supportsDepth(int) const;
-
- void save();
- void restore();
- void blank(bool on);
-
- bool onCard(const unsigned char *) const;
- bool onCard(const unsigned char *, ulong& out_offset) const;
-
- bool isInterlaced() const;
- bool isTransformed() const;
- int transformOrientation() const;
-
- int memoryNeeded(const QString&);
- int sharedRamSize(void *);
-
- void haltUpdates();
- void resumeUpdates();
-
- void exposeRegion(QRegion r, int changing);
- void blit(const QImage &img, const QPoint &topLeft, const QRegion &region);
- void solidFill(const QColor &color, const QRegion &region);
- void setDirty(const QRect&);
-
- QWSWindowSurface* createSurface(QWidget *widget) const;
- QWSWindowSurface* createSurface(const QString &key) const;
-
- QList<QScreen*> subScreens() const;
- QRegion region() const;
-
-private:
- void configure();
-
- QScreen *realScreen;
- QProxyScreenPrivate *d_ptr;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_PROXYSCREEN
-#endif // QPROXYSCREEN_QWS_H
diff --git a/src/gui/embedded/qscreenqnx_qws.cpp b/src/gui/embedded/qscreenqnx_qws.cpp
deleted file mode 100644
index 7101a71d83..0000000000
--- a/src/gui/embedded/qscreenqnx_qws.cpp
+++ /dev/null
@@ -1,450 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreenqnx_qws.h"
-#include "qdebug.h"
-
-#include <gf/gf.h>
-
-QT_BEGIN_NAMESPACE
-
-// This struct holds all the pointers to QNX's internals
-struct QQnxScreenContext
-{
- inline QQnxScreenContext()
- : device(0), display(0), layer(0), hwSurface(0), memSurface(0), context(0)
- {}
-
- gf_dev_t device;
- gf_dev_info_t deviceInfo;
- gf_display_t display;
- gf_display_info_t displayInfo;
- gf_layer_t layer;
- gf_surface_t hwSurface;
- gf_surface_t memSurface;
- gf_surface_info_t memSurfaceInfo;
- gf_context_t context;
-};
-
-/*!
- \class QQnxScreen
- \preliminary
- \ingroup qws
- \since 4.6
- \internal
-
- \brief The QQnxScreen class implements a screen driver
- for QNX io-display based devices.
-
- Note - you never have to instanciate this class, the QScreenDriverFactory
- does that for us based on the \c{QWS_DISPLAY} environment variable.
-
- To activate this driver, set \c{QWS_DISPLAY} to \c{qnx}.
-
- Example:
- \c{QWS_DISPLAY=qnx; export QWS_DISPLAY}
-
- By default, the main layer of the first display of the first device is used.
- If you have multiple graphic cards, multiple displays or multiple layers and
- don't want to connect to the default, you can override that with setting
- the corresponding options \c{device}, \c{display} or \c{layer} in the \c{QWS_DISPLAY} variable:
-
- \c{QWS_DISPLAY=qnx:device=3:display=4:layer=5}
-
- In addition, it is suggested to set the physical width and height of the display.
- QQnxScreen will use that information to compute the dots per inch (DPI) in order to render
- fonts correctly. If this informaiton is omitted, QQnxScreen defaults to 72 dpi.
-
- \c{QWS_DISPLAY=qnx:mmWidth=120:mmHeight=80}
-
- \c{mmWidth} and \c{mmHeight} are the physical width/height of the screen in millimeters.
-
- \sa QScreen, QScreenDriverPlugin, {Running Qt for Embedded Linux Applications}{Running Applications}
-*/
-
-/*!
- Constructs a QQnxScreen object. The \a display_id argument
- identifies the Qt for Embedded Linux server to connect to.
-*/
-QQnxScreen::QQnxScreen(int display_id)
- : QScreen(display_id), d(new QQnxScreenContext)
-{
-}
-
-/*!
- Destroys this QQnxScreen object.
-*/
-QQnxScreen::~QQnxScreen()
-{
- delete d;
-}
-
-/*! \reimp
-*/
-bool QQnxScreen::initDevice()
-{
- // implement this if you have multiple processes that want to access the display
- // (not required if QT_NO_QWS_MULTIPROCESS is set)
- return true;
-}
-
-/*! \internal
- Attaches to the named device \a name.
-*/
-static bool attachDevice(QQnxScreenContext * const d, const char *name)
-{
- int ret = gf_dev_attach(&d->device, name, &d->deviceInfo);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_dev_attach(%s) failed with error code %d", name, ret);
- return false;
- }
- return true;
-}
-
-/*! \internal
- Attaches to the display at index \a displayIndex.
- */
-static bool attachDisplay(QQnxScreenContext * const d, int displayIndex)
-{
- int ret = gf_display_attach(&d->display, d->device, displayIndex, &d->displayInfo);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_display_attach(%d) failed with error code %d",
- displayIndex, ret);
- return false;
- }
- return true;
-}
-
-/*! \internal
- Attaches to the layer \a layerIndex.
- */
-static bool attachLayer(QQnxScreenContext * const d, int layerIndex)
-{
- int ret = gf_layer_attach(&d->layer, d->display, layerIndex, 0);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_layer_attach(%d) failed with error code %d", layerIndex,
- ret);
- return false;
- }
- gf_layer_enable(d->layer);
-
- return true;
-}
-
-/*! \internal
- Creates a new hardware surface (usually on the Gfx card memory) with the dimensions \a w * \a h.
- */
-static bool createHwSurface(QQnxScreenContext * const d, int w, int h)
-{
- int ret = gf_surface_create_layer(&d->hwSurface, &d->layer, 1, 0,
- w, h, GF_FORMAT_ARGB8888, 0, 0);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_surface_create_layer(%dx%d) failed with error code %d",
- w, h, ret);
- return false;
- }
-
- gf_layer_set_surfaces(d->layer, &d->hwSurface, 1);
-
- ret = gf_layer_update(d->layer, 0);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_layer_update() failed with error code %d\n", ret);
- return false;
- }
-
- return true;
-}
-
-/*! \internal
- Creates an in-memory, linear accessible surface of dimensions \a w * \a h.
- This is the main surface that QWS blits to.
- */
-static bool createMemSurface(QQnxScreenContext * const d, int w, int h)
-{
- // Note: gf_surface_attach() could also be used, so we'll create the buffer
- // and let the surface point to it. Here, we use surface_create instead.
-
- int ret = gf_surface_create(&d->memSurface, d->device, w, h,
- GF_FORMAT_ARGB8888, 0,
- GF_SURFACE_CREATE_CPU_FAST_ACCESS | GF_SURFACE_CREATE_CPU_LINEAR_ACCESSIBLE
- | GF_SURFACE_PHYS_CONTIG | GF_SURFACE_CREATE_SHAREABLE);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_surface_create(%dx%d) failed with error code %d",
- w, h, ret);
- return false;
- }
-
- gf_surface_get_info(d->memSurface, &d->memSurfaceInfo);
-
- if (d->memSurfaceInfo.sid == unsigned(GF_SID_INVALID)) {
- qWarning("QQnxScreen: gf_surface_get_info() failed.");
- return false;
- }
-
- return true;
-}
-
-/* \internal
- Creates a QNX gf context and sets our memory surface on it.
- */
-static bool createContext(QQnxScreenContext * const d)
-{
- int ret = gf_context_create(&d->context);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_context_create() failed with error code %d", ret);
- return false;
- }
-
- ret = gf_context_set_surface(d->context, d->memSurface);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_context_set_surface() failed with error code %d", ret);
- return false;
- }
-
- return true;
-}
-
-/*! \reimp
- Connects to QNX's io-display based device based on the \a displaySpec parameters
- from the \c{QWS_DISPLAY} environment variable. See the QQnxScreen class documentation
- for possible parameters.
-
- \sa QQnxScreen
- */
-bool QQnxScreen::connect(const QString &displaySpec)
-{
- const QStringList params = displaySpec.split(QLatin1Char(':'), QString::SkipEmptyParts);
-
- bool isOk = false;
- QRegExp deviceRegExp(QLatin1String("^device=(.+)$"));
- if (params.indexOf(deviceRegExp) != -1) {
- isOk = attachDevice(d, deviceRegExp.cap(1).toLocal8Bit().constData());
- } else {
- // no device specified - attach to device 0 (the default)
- isOk = attachDevice(d, GF_DEVICE_INDEX(0));
- }
-
- if (!isOk)
- return false;
-
- qDebug("QQnxScreen: Attached to Device, number of displays: %d", d->deviceInfo.ndisplays);
-
- // default to display 0
- int displayIndex = 0;
- QRegExp displayRegexp(QLatin1String("^display=(\\d+)$"));
- if (params.indexOf(displayRegexp) != -1) {
- displayIndex = displayRegexp.cap(1).toInt();
- }
-
- if (!attachDisplay(d, displayIndex))
- return false;
-
- qDebug("QQnxScreen: Attached to Display %d, resolution %dx%d, refresh %d Hz",
- displayIndex, d->displayInfo.xres, d->displayInfo.yres,
- d->displayInfo.refresh);
-
-
- // default to main_layer_index from the displayInfo struct
- int layerIndex = 0;
- QRegExp layerRegexp(QLatin1String("^layer=(\\d+)$"));
- if (params.indexOf(layerRegexp) != -1) {
- layerIndex = layerRegexp.cap(1).toInt();
- } else {
- layerIndex = d->displayInfo.main_layer_index;
- }
-
- if (!attachLayer(d, layerIndex))
- return false;
-
- // tell QWSDisplay the width and height of the display
- w = dw = d->displayInfo.xres;
- h = dh = d->displayInfo.yres;
-
- // we only support 32 bit displays for now.
- QScreen::d = 32;
-
- // assume 72 dpi as default, to calculate the physical dimensions if not specified
- const int defaultDpi = 72;
-
- // Handle display physical size spec.
- QRegExp mmWidthRegexp(QLatin1String("^mmWidth=(\\d+)$"));
- if (params.indexOf(mmWidthRegexp) == -1) {
- physWidth = qRound(dw * 25.4 / defaultDpi);
- } else {
- physWidth = mmWidthRegexp.cap(1).toInt();
- }
-
- QRegExp mmHeightRegexp(QLatin1String("^mmHeight=(\\d+)$"));
- if (params.indexOf(mmHeightRegexp) == -1) {
- physHeight = qRound(dh * 25.4 / defaultDpi);
- } else {
- physHeight = mmHeightRegexp.cap(1).toInt();
- }
-
- // create a hardware surface with our dimensions. In the old days, it was possible
- // to get a pointer directly to the hw surface, so we could blit directly. Now, we
- // have to use one indirection more, because it's not guaranteed that the hw surface
- // is mappable into our process.
- if (!createHwSurface(d, w, h))
- return false;
-
- // create an in-memory linear surface that is used by QWS. QWS will blit directly in here.
- if (!createMemSurface(d, w, h))
- return false;
-
- // set the address of the in-memory buffer that QWS is blitting to
- data = d->memSurfaceInfo.vaddr;
- // set the line stepping
- lstep = d->memSurfaceInfo.stride;
-
- // the overall size of the in-memory buffer is linestep * height
- size = mapsize = lstep * h;
-
- // create a QNX drawing context
- if (!createContext(d))
- return false;
-
- // we're always using a software cursor for now. Initialize it here.
- QScreenCursor::initSoftwareCursor();
-
- // done, the driver should be connected to the display now.
- return true;
-}
-
-/*! \reimp
- */
-void QQnxScreen::disconnect()
-{
- if (d->context)
- gf_context_free(d->context);
-
- if (d->memSurface)
- gf_surface_free(d->memSurface);
-
- if (d->hwSurface)
- gf_surface_free(d->hwSurface);
-
- if (d->layer)
- gf_layer_detach(d->layer);
-
- if (d->display)
- gf_display_detach(d->display);
-
- if (d->device)
- gf_dev_detach(d->device);
-
- d->memSurface = 0;
- d->hwSurface = 0;
- d->context = 0;
- d->layer = 0;
- d->display = 0;
- d->device = 0;
-}
-
-/*! \reimp
- */
-void QQnxScreen::shutdownDevice()
-{
-}
-
-
-/*! \reimp
- QQnxScreen doesn't support setting the mode, use io-display instead.
- */
-void QQnxScreen::setMode(int,int,int)
-{
- qWarning("QQnxScreen: Unable to change mode, use io-display instead.");
-}
-
-/*! \reimp
- */
-bool QQnxScreen::supportsDepth(int depth) const
-{
- // only 32-bit for the moment
- return depth == 32;
-}
-
-/*! \reimp
- */
-void QQnxScreen::exposeRegion(QRegion r, int changing)
-{
- // here is where the actual magic happens. QWS will call exposeRegion whenever
- // a region on the screen is dirty and needs to be updated on the actual screen.
-
- // first, call the parent implementation. The parent implementation will update
- // the region on our in-memory surface
- QScreen::exposeRegion(r, changing);
-
- // now our in-memory surface should be up to date with the latest changes.
- // the code below copies the region from the in-memory surface to the hardware.
-
- // just get the bounding rectangle of the region. Most screen updates are rectangular
- // anyways. Code could be optimized to blit each and every member of the region
- // individually, but in real life, the speed-up is neglectable
- const QRect br = r.boundingRect();
- if (br.isEmpty())
- return; // ignore empty regions because gf_draw_blit2 doesn't like 0x0 dimensions
-
- // start drawing.
- int ret = gf_draw_begin(d->context);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_draw_begin() failed with error code %d", ret);
- return;
- }
-
- // blit the changed region from the memory surface to the hardware surface
- ret = gf_draw_blit2(d->context, d->memSurface, d->hwSurface,
- br.x(), br.y(), br.right(), br.bottom(), br.x(), br.y());
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_draw_blit2() failed with error code %d", ret);
- }
-
- // flush all drawing commands (in our case, a single blit)
- ret = gf_draw_flush(d->context);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_draw_flush() failed with error code %d", ret);
- }
-
- // tell QNX that we're done drawing.
- gf_draw_end(d->context);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qscreenqnx_qws.h b/src/gui/embedded/qscreenqnx_qws.h
deleted file mode 100644
index 35915ae794..0000000000
--- a/src/gui/embedded/qscreenqnx_qws.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENQNX_QWS_H
-#define QSCREENQNX_QWS_H
-
-#include <QtGui/qscreen_qws.h>
-
-#ifndef QT_NO_QWS_QNX
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-struct QQnxScreenContext;
-
-class QQnxScreen : public QScreen
-{
-public:
- explicit QQnxScreen(int display_id);
- ~QQnxScreen();
-
- bool initDevice();
- bool connect(const QString &displaySpec);
- void disconnect();
- void shutdownDevice();
- void setMode(int,int,int);
- bool supportsDepth(int) const;
-
- void exposeRegion(QRegion r, int changing);
-
-private:
- QQnxScreenContext * const d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_QNX
-
-#endif
diff --git a/src/gui/embedded/qscreentransformed_qws.cpp b/src/gui/embedded/qscreentransformed_qws.cpp
deleted file mode 100644
index f37ab8084b..0000000000
--- a/src/gui/embedded/qscreentransformed_qws.cpp
+++ /dev/null
@@ -1,748 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreentransformed_qws.h"
-
-#ifndef QT_NO_QWS_TRANSFORMED
-#include <qscreendriverfactory_qws.h>
-#include <qvector.h>
-#include <private/qpainter_p.h>
-#include <private/qmemrotate_p.h>
-#include <qmatrix.h>
-
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <qwindowsystem_qws.h>
-#include <qwsdisplay_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-//#define QT_REGION_DEBUG
-
-#ifdef QT_REGION_DEBUG
-#include <QDebug>
-#endif
-
-class QTransformedScreenPrivate
-{
-public:
- QTransformedScreenPrivate(QTransformedScreen *parent);
-
- void configure();
-
- QTransformedScreen::Transformation transformation;
-#ifdef QT_QWS_DEPTH_GENERIC
- bool doGenericColors;
-#endif
- QTransformedScreen *q;
-};
-
-QTransformedScreenPrivate::QTransformedScreenPrivate(QTransformedScreen *parent)
- : transformation(QTransformedScreen::None),
-#ifdef QT_QWS_DEPTH_GENERIC
- doGenericColors(false),
-#endif
- q(parent)
-{
-}
-
-extern "C"
-#ifndef QT_BUILD_GUI_LIB
-Q_DECL_EXPORT
-#endif
-void qws_setScreenTransformation(QScreen *that, int t)
-{
- QTransformedScreen *tscreen = static_cast<QTransformedScreen*>(that);
- tscreen->setTransformation((QTransformedScreen::Transformation)t);
-}
-
-// ---------------------------------------------------------------------------
-// Transformed Screen
-// ---------------------------------------------------------------------------
-
-/*!
- \internal
-
- \class QTransformedScreen
- \ingroup qws
-
- \brief The QTransformedScreen class implements a screen driver for
- a transformed screen.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
- Custom screen drivers can be added by subclassing the
- QScreenDriverPlugin class, using the QScreenDriverFactory class to
- dynamically load the driver into the application, but there should
- only be one screen object per application.
-
- Use the QScreen::isTransformed() function to determine if a screen
- is transformed. The QTransformedScreen class itself provides means
- of rotating the screen with its setTransformation() function; the
- transformation() function returns the currently set rotation in
- terms of the \l Transformation enum (which describes the various
- available rotation settings). Alternatively, QTransformedScreen
- provides an implementation of the QScreen::transformOrientation()
- function, returning the current rotation as an integer value.
-
- \sa QScreen, QScreenDriverPlugin, {Running Applications}
-*/
-
-/*!
- \enum QTransformedScreen::Transformation
-
- This enum describes the various rotations a transformed screen can
- have.
-
- \value None No rotation
- \value Rot90 90 degrees rotation
- \value Rot180 180 degrees rotation
- \value Rot270 270 degrees rotation
-*/
-
-/*!
- \fn bool QTransformedScreen::isTransformed() const
- \reimp
-*/
-
-/*!
- Constructs a QTransformedScreen object. The \a displayId argument
- identifies the Qt for Embedded Linux server to connect to.
-*/
-QTransformedScreen::QTransformedScreen(int displayId)
- : QProxyScreen(displayId, QScreen::TransformedClass)
-{
- d_ptr = new QTransformedScreenPrivate(this);
- d_ptr->transformation = None;
-
-#ifdef QT_REGION_DEBUG
- qDebug() << "QTransformedScreen::QTransformedScreen";
-#endif
-}
-
-void QTransformedScreenPrivate::configure()
-{
- // ###: works because setTransformation recalculates unconditionally
- q->setTransformation(transformation);
-}
-
-/*!
- Destroys the QTransformedScreen object.
-*/
-QTransformedScreen::~QTransformedScreen()
-{
- delete d_ptr;
-}
-
-static int getDisplayId(const QString &spec)
-{
- QRegExp regexp(QLatin1String(":(\\d+)\\b"));
- if (regexp.lastIndexIn(spec) != -1) {
- const QString capture = regexp.cap(1);
- return capture.toInt();
- }
- return 0;
-}
-
-static QTransformedScreen::Transformation filterTransformation(QString &spec)
-{
- QRegExp regexp(QLatin1String("\\bRot(\\d+):?\\b"), Qt::CaseInsensitive);
- if (regexp.indexIn(spec) == -1)
- return QTransformedScreen::None;
-
- const int degrees = regexp.cap(1).toInt();
- spec.remove(regexp.pos(0), regexp.matchedLength());
-
- return static_cast<QTransformedScreen::Transformation>(degrees / 90);
-}
-
-/*!
- \reimp
-*/
-bool QTransformedScreen::connect(const QString &displaySpec)
-{
- QString dspec = displaySpec.trimmed();
- if (dspec.startsWith(QLatin1String("Transformed:"), Qt::CaseInsensitive))
- dspec = dspec.mid(QString::fromLatin1("Transformed:").size());
- else if (!dspec.compare(QLatin1String("Transformed"), Qt::CaseInsensitive))
- dspec = QString();
-
- const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
- if (dspec.endsWith(displayIdSpec))
- dspec = dspec.left(dspec.size() - displayIdSpec.size());
-
- d_ptr->transformation = filterTransformation(dspec);
-
- QString driver = dspec;
- int colon = driver.indexOf(QLatin1Char(':'));
- if (colon >= 0)
- driver.truncate(colon);
-
- if (!QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive))
- if (!dspec.isEmpty())
- dspec.prepend(QLatin1Char(':'));
-
- const int id = getDisplayId(dspec);
- QScreen *s = qt_get_screen(id, dspec.toLatin1().constData());
- setScreen(s);
-
-#ifdef QT_QWS_DEPTH_GENERIC
- d_ptr->doGenericColors = dspec.contains(QLatin1String("genericcolors"));
-#endif
-
- d_ptr->configure();
-
- // XXX
- qt_screen = this;
-
- return true;
-}
-
-/*!
- Returns the currently set rotation.
-
- \sa setTransformation(), QScreen::transformOrientation()
-*/
-QTransformedScreen::Transformation QTransformedScreen::transformation() const
-{
- return d_ptr->transformation;
-}
-
-/*!
- \reimp
-*/
-int QTransformedScreen::transformOrientation() const
-{
- return (int)d_ptr->transformation;
-}
-
-/*!
- \reimp
-*/
-void QTransformedScreen::exposeRegion(QRegion region, int changing)
-{
- if (!data || d_ptr->transformation == None) {
- QProxyScreen::exposeRegion(region, changing);
- return;
- }
- QScreen::exposeRegion(region, changing);
-}
-
-/*!
- Rotates this screen object according to the specified \a transformation.
-
- \sa transformation()
-*/
-void QTransformedScreen::setTransformation(Transformation transformation)
-{
- d_ptr->transformation = transformation;
- QSize size = mapFromDevice(QSize(dw, dh));
- w = size.width();
- h = size.height();
-
- const QScreen *s = screen();
- size = mapFromDevice(QSize(s->physicalWidth(), s->physicalHeight()));
- physWidth = size.width();
- physHeight = size.height();
-
-#ifdef QT_REGION_DEBUG
- qDebug() << "QTransformedScreen::setTransformation" << transformation
- << "size" << w << h << "dev size" << dw << dh;
-#endif
-
-}
-
-static inline QRect correctNormalized(const QRect &r) {
- const int x1 = qMin(r.left(), r.right());
- const int x2 = qMax(r.left(), r.right());
- const int y1 = qMin(r.top(), r.bottom());
- const int y2 = qMax(r.top(), r.bottom());
-
- return QRect( QPoint(x1,y1), QPoint(x2,y2) );
-}
-
-template <class DST, class SRC>
-static inline void blit90(QScreen *screen, const QImage &image,
- const QRect &rect, const QPoint &topLeft)
-{
- const SRC *src = (const SRC*)(image.scanLine(rect.top())) + rect.left();
- DST *dest = (DST*)(screen->base() + topLeft.y() * screen->linestep())
- + topLeft.x();
- qt_memrotate90(src, rect.width(), rect.height(), image.bytesPerLine(),
- dest, screen->linestep());
-}
-
-template <class DST, class SRC>
-static inline void blit180(QScreen *screen, const QImage &image,
- const QRect &rect, const QPoint &topLeft)
-{
- const SRC *src = (const SRC*)(image.scanLine(rect.top())) + rect.left();
- DST *dest = (DST*)(screen->base() + topLeft.y() * screen->linestep())
- + topLeft.x();
- qt_memrotate180(src, rect.width(), rect.height(), image.bytesPerLine(),
- dest, screen->linestep());
-}
-
-template <class DST, class SRC>
-static inline void blit270(QScreen *screen, const QImage &image,
- const QRect &rect, const QPoint &topLeft)
-{
- const SRC *src = (const SRC *)(image.scanLine(rect.top())) + rect.left();
- DST *dest = (DST*)(screen->base() + topLeft.y() * screen->linestep())
- + topLeft.x();
- qt_memrotate270(src, rect.width(), rect.height(), image.bytesPerLine(),
- dest, screen->linestep());
-}
-
-typedef void (*BlitFunc)(QScreen *, const QImage &, const QRect &, const QPoint &);
-
-#define SET_BLIT_FUNC(dst, src, rotation, func) \
-do { \
- switch (rotation) { \
- case Rot90: \
- func = blit90<dst, src>; \
- break; \
- case Rot180: \
- func = blit180<dst, src>; \
- break; \
- case Rot270: \
- func = blit270<dst, src>; \
- break; \
- default: \
- break; \
- } \
-} while (0)
-
-/*!
- \reimp
-*/
-void QTransformedScreen::blit(const QImage &image, const QPoint &topLeft,
- const QRegion &region)
-{
- const Transformation trans = d_ptr->transformation;
- if (trans == None) {
- QProxyScreen::blit(image, topLeft, region);
- return;
- }
-
- const QVector<QRect> rects = region.rects();
- const QRect bound = QRect(0, 0, QScreen::w, QScreen::h)
- & QRect(topLeft, image.size());
-
- BlitFunc func = 0;
-#ifdef QT_QWS_DEPTH_GENERIC
- if (d_ptr->doGenericColors && depth() == 16) {
- if (image.depth() == 16)
- SET_BLIT_FUNC(qrgb_generic16, quint16, trans, func);
- else
- SET_BLIT_FUNC(qrgb_generic16, quint32, trans, func);
- } else
-#endif
- switch (depth()) {
-#ifdef QT_QWS_DEPTH_32
- case 32:
-#ifdef QT_QWS_DEPTH_16
- if (image.depth() == 16)
- SET_BLIT_FUNC(quint32, quint16, trans, func);
- else
-#endif
- SET_BLIT_FUNC(quint32, quint32, trans, func);
- break;
-#endif
-#if defined(QT_QWS_DEPTH_24) || defined(QT_QWS_DEPTH18)
- case 24:
- case 18:
- SET_BLIT_FUNC(quint24, quint24, trans, func);
- break;
-#endif
-#if defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15) || defined(QT_QWS_DEPTH_12)
- case 16:
-#if defined QT_QWS_ROTATE_BGR
- if (pixelType() == BGRPixel && image.depth() == 16) {
- SET_BLIT_FUNC(qbgr565, quint16, trans, func);
- break;
- } //fall-through here!!!
-#endif
- case 15:
-#if defined QT_QWS_ROTATE_BGR
- if (pixelType() == BGRPixel && image.format() == QImage::Format_RGB555) {
- SET_BLIT_FUNC(qbgr555, qrgb555, trans, func);
- break;
- } //fall-through here!!!
-#endif
- case 12:
- if (image.depth() == 16)
- SET_BLIT_FUNC(quint16, quint16, trans, func);
- else
- SET_BLIT_FUNC(quint16, quint32, trans, func);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_8
- case 8:
- if (image.format() == QImage::Format_RGB444)
- SET_BLIT_FUNC(quint8, qrgb444, trans, func);
- else if (image.depth() == 16)
- SET_BLIT_FUNC(quint8, quint16, trans, func);
- else
- SET_BLIT_FUNC(quint8, quint32, trans, func);
- break;
-#endif
- default:
- return;
- }
- if (!func)
- return;
-
- QWSDisplay::grab();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect r = rects.at(i) & bound;
-
- QPoint dst;
- switch (trans) {
- case Rot90:
- dst = mapToDevice(r.topRight(), QSize(w, h));
- break;
- case Rot180:
- dst = mapToDevice(r.bottomRight(), QSize(w, h));
- break;
- case Rot270:
- dst = mapToDevice(r.bottomLeft(), QSize(w, h));
- break;
- default:
- break;
- }
- func(this, image, r.translated(-topLeft), dst);
- }
- QWSDisplay::ungrab();
-
-}
-
-/*!
- \reimp
-*/
-void QTransformedScreen::solidFill(const QColor &color, const QRegion &region)
-{
- const QRegion tr = mapToDevice(region, QSize(w,h));
-
- Q_ASSERT(tr.boundingRect() == mapToDevice(region.boundingRect(), QSize(w,h)));
-
-#ifdef QT_REGION_DEBUG
- qDebug() << "QTransformedScreen::solidFill region" << region << "transformed" << tr;
-#endif
- QProxyScreen::solidFill(color, tr);
-}
-
-/*!
- \reimp
-*/
-QSize QTransformedScreen::mapToDevice(const QSize &s) const
-{
- switch (d_ptr->transformation) {
- case None:
- case Rot180:
- break;
- case Rot90:
- case Rot270:
- return QSize(s.height(), s.width());
- break;
- }
- return s;
-}
-
-/*!
- \reimp
-*/
-QSize QTransformedScreen::mapFromDevice(const QSize &s) const
-{
- switch (d_ptr->transformation) {
- case None:
- case Rot180:
- break;
- case Rot90:
- case Rot270:
- return QSize(s.height(), s.width());
- break;
- }
- return s;
-}
-
-/*!
- \reimp
-*/
-QPoint QTransformedScreen::mapToDevice(const QPoint &p, const QSize &s) const
-{
- QPoint rp(p);
-
- switch (d_ptr->transformation) {
- case None:
- break;
- case Rot90:
- rp.setX(p.y());
- rp.setY(s.width() - p.x() - 1);
- break;
- case Rot180:
- rp.setX(s.width() - p.x() - 1);
- rp.setY(s.height() - p.y() - 1);
- break;
- case Rot270:
- rp.setX(s.height() - p.y() - 1);
- rp.setY(p.x());
- break;
- }
-
- return rp;
-}
-
-/*!
- \reimp
-*/
-QPoint QTransformedScreen::mapFromDevice(const QPoint &p, const QSize &s) const
-{
- QPoint rp(p);
-
- switch (d_ptr->transformation) {
- case None:
- break;
- case Rot90:
- rp.setX(s.height() - p.y() - 1);
- rp.setY(p.x());
- break;
- case Rot180:
- rp.setX(s.width() - p.x() - 1);
- rp.setY(s.height() - p.y() - 1);
- break;
- case Rot270:
- rp.setX(p.y());
- rp.setY(s.width() - p.x() - 1);
- break;
- }
-
- return rp;
-}
-
-/*!
- \reimp
-*/
-QRect QTransformedScreen::mapToDevice(const QRect &r, const QSize &s) const
-{
- if (r.isNull())
- return QRect();
-
- QRect tr;
- switch (d_ptr->transformation) {
- case None:
- tr = r;
- break;
- case Rot90:
- tr.setCoords(r.y(), s.width() - r.x() - 1,
- r.bottom(), s.width() - r.right() - 1);
- break;
- case Rot180:
- tr.setCoords(s.width() - r.x() - 1, s.height() - r.y() - 1,
- s.width() - r.right() - 1, s.height() - r.bottom() - 1);
- break;
- case Rot270:
- tr.setCoords(s.height() - r.y() - 1, r.x(),
- s.height() - r.bottom() - 1, r.right());
- break;
- }
-
- return correctNormalized(tr);
-}
-
-/*!
- \reimp
-*/
-QRect QTransformedScreen::mapFromDevice(const QRect &r, const QSize &s) const
-{
- if (r.isNull())
- return QRect();
-
- QRect tr;
- switch (d_ptr->transformation) {
- case None:
- tr = r;
- break;
- case Rot90:
- tr.setCoords(s.height() - r.y() - 1, r.x(),
- s.height() - r.bottom() - 1, r.right());
- break;
- case Rot180:
- tr.setCoords(s.width() - r.x() - 1, s.height() - r.y() - 1,
- s.width() - r.right() - 1, s.height() - r.bottom() - 1);
- break;
- case Rot270:
- tr.setCoords(r.y(), s.width() - r.x() - 1,
- r.bottom(), s.width() - r.right() - 1);
- break;
- }
-
- return correctNormalized(tr);
-}
-
-/*!
- \reimp
-*/
-QRegion QTransformedScreen::mapToDevice(const QRegion &rgn, const QSize &s) const
-{
- if (d_ptr->transformation == None)
- return QProxyScreen::mapToDevice(rgn, s);
-
-#ifdef QT_REGION_DEBUG
- qDebug() << "mapToDevice size" << s << "rgn: " << rgn;
-#endif
- QRect tr;
- QRegion trgn;
- QVector<QRect> a = rgn.rects();
- const QRect *r = a.data();
-
- int w = s.width();
- int h = s.height();
- int size = a.size();
-
- switch (d_ptr->transformation) {
- case None:
- break;
- case Rot90:
- for (int i = 0; i < size; i++, r++) {
- tr.setCoords(r->y(), w - r->x() - 1,
- r->bottom(), w - r->right() - 1);
- trgn |= correctNormalized(tr);
- }
- break;
- case Rot180:
- for (int i = 0; i < size; i++, r++) {
- tr.setCoords(w - r->x() - 1, h - r->y() - 1,
- w - r->right() - 1, h - r->bottom() - 1);
- trgn |= correctNormalized(tr);
- }
- break;
- case Rot270:
- for (int i = 0; i < size; i++, r++) {
- tr.setCoords(h - r->y() - 1, r->x(),
- h - r->bottom() - 1, r->right());
- trgn |= correctNormalized(tr);
- }
- break;
- }
-#ifdef QT_REGION_DEBUG
- qDebug() << "mapToDevice trgn: " << trgn;
-#endif
- return trgn;
-}
-
-/*!
- \reimp
-*/
-QRegion QTransformedScreen::mapFromDevice(const QRegion &rgn, const QSize &s) const
-{
- if (d_ptr->transformation == None)
- return QProxyScreen::mapFromDevice(rgn, s);
-
-#ifdef QT_REGION_DEBUG
- qDebug() << "fromDevice: realRegion count: " << rgn.rects().size() << " isEmpty? " << rgn.isEmpty() << " bounds:" << rgn.boundingRect();
-#endif
- QRect tr;
- QRegion trgn;
- QVector<QRect> a = rgn.rects();
- const QRect *r = a.data();
-
- int w = s.width();
- int h = s.height();
- int size = a.size();
-
- switch (d_ptr->transformation) {
- case None:
- break;
- case Rot90:
- for (int i = 0; i < size; i++, r++) {
- tr.setCoords(h - r->y() - 1, r->x(),
- h - r->bottom() - 1, r->right());
- trgn |= correctNormalized(tr);
- }
- break;
- case Rot180:
- for (int i = 0; i < size; i++, r++) {
- tr.setCoords(w - r->x() - 1, h - r->y() - 1,
- w - r->right() - 1, h - r->bottom() - 1);
- trgn |= correctNormalized(tr);
- }
- break;
- case Rot270:
- for (int i = 0; i < size; i++, r++) {
- tr.setCoords(r->y(), w - r->x() - 1,
- r->bottom(), w - r->right() - 1);
- trgn |= correctNormalized(tr);
- }
- break;
- }
-#ifdef QT_REGION_DEBUG
- qDebug() << "fromDevice: transRegion count: " << trgn.rects().size() << " isEmpty? " << trgn.isEmpty() << " bounds:" << trgn.boundingRect();
-#endif
- return trgn;
-}
-
-/*!
- \reimp
-*/
-void QTransformedScreen::setDirty(const QRect& rect)
-{
- const QRect r = mapToDevice(rect, QSize(width(), height()));
- QProxyScreen::setDirty(r);
-}
-
-/*!
- \reimp
-*/
-QRegion QTransformedScreen::region() const
-{
- QRegion deviceRegion = QProxyScreen::region();
- return mapFromDevice(deviceRegion, QSize(deviceWidth(), deviceHeight()));
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_TRANSFORMED
diff --git a/src/gui/embedded/qscreentransformed_qws.h b/src/gui/embedded/qscreentransformed_qws.h
deleted file mode 100644
index 70f5063387..0000000000
--- a/src/gui/embedded/qscreentransformed_qws.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENTRANSFORMED_QWS_H
-#define QSCREENTRANSFORMED_QWS_H
-
-#include <QtGui/qscreenproxy_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_TRANSFORMED
-
-class QTransformedScreenPrivate;
-
-class Q_AUTOTEST_EXPORT QTransformedScreen : public QProxyScreen
-{
-public:
- explicit QTransformedScreen(int display_id);
- ~QTransformedScreen();
-
- enum Transformation { None, Rot90, Rot180, Rot270 };
-
- void setTransformation(Transformation t);
- Transformation transformation() const;
- int transformOrientation() const;
-
- QSize mapToDevice(const QSize &s) const;
- QSize mapFromDevice(const QSize &s) const;
-
- QPoint mapToDevice(const QPoint &, const QSize &) const;
- QPoint mapFromDevice(const QPoint &, const QSize &) const;
-
- QRect mapToDevice(const QRect &, const QSize &) const;
- QRect mapFromDevice(const QRect &, const QSize &) const;
-
- QRegion mapToDevice(const QRegion &, const QSize &) const;
- QRegion mapFromDevice(const QRegion &, const QSize &) const;
-
- bool connect(const QString &displaySpec);
-
- bool isTransformed() const { return transformation() != None; }
-
- void exposeRegion(QRegion region, int changing);
- void blit(const QImage &img, const QPoint &topLeft, const QRegion &region);
- void solidFill(const QColor &color, const QRegion &region);
- void setDirty(const QRect&);
-
- QRegion region() const;
-
-private:
- friend class QTransformedScreenPrivate;
- QTransformedScreenPrivate *d_ptr;
-};
-
-#endif // QT_NO_QWS_TRANSFORMED
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREENTRANSFORMED_QWS_H
diff --git a/src/gui/embedded/qscreenvfb_qws.cpp b/src/gui/embedded/qscreenvfb_qws.cpp
deleted file mode 100644
index 1c8829d500..0000000000
--- a/src/gui/embedded/qscreenvfb_qws.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_NO_QWS_QVFB
-
-#define QTOPIA_QVFB_BRIGHTNESS
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <qvfbhdr.h>
-#include <qscreenvfb_qws.h>
-#include <qkbdvfb_qws.h>
-#include <qmousevfb_qws.h>
-#include <qwindowsystem_qws.h>
-#include <qsocketnotifier.h>
-#include <qapplication.h>
-#include <qscreen_qws.h>
-#include <qmousedriverfactory_qws.h>
-#include <qkbddriverfactory_qws.h>
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVFbScreenPrivate
-{
-public:
- QVFbScreenPrivate();
- ~QVFbScreenPrivate();
-
- bool success;
- unsigned char *shmrgn;
- int brightness;
- bool blank;
- QVFbHeader *hdr;
- QWSMouseHandler *mouse;
-#ifndef QT_NO_QWS_KEYBOARD
- QWSKeyboardHandler *keyboard;
-#endif
-};
-
-QVFbScreenPrivate::QVFbScreenPrivate()
- : mouse(0)
-
-{
-#ifndef QT_NO_QWS_KEYBOARD
- keyboard = 0;
-#endif
- brightness = 255;
- blank = false;
-}
-
-QVFbScreenPrivate::~QVFbScreenPrivate()
-{
- delete mouse;
-#ifndef QT_NO_QWS_KEYBOARD
- delete keyboard;
-#endif
-}
-
-/*!
- \internal
-
- \class QVFbScreen
- \ingroup qws
-
- \brief The QVFbScreen class implements a screen driver for the
- virtual framebuffer.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
- Custom screen drivers can be added by subclassing the
- QScreenDriverPlugin class, using the QScreenDriverFactory class to
- dynamically load the driver into the application, but there should
- only be one screen object per application.
-
- The Qt for Embedded Linux platform provides a \l{The Virtual
- Framebuffer}{virtual framebuffer} for development and debugging;
- the virtual framebuffer allows Qt for Embedded Linux applications to be
- developed on a desktop machine, without switching between consoles
- and X11.
-
- \sa QScreen, QScreenDriverPlugin, {Running Applications}
-*/
-
-/*!
- \fn bool QVFbScreen::connect(const QString & displaySpec)
- \reimp
-*/
-
-/*!
- \fn void QVFbScreen::disconnect()
- \reimp
-*/
-
-/*!
- \fn bool QVFbScreen::initDevice()
- \reimp
-*/
-
-/*!
- \fn void QVFbScreen::restore()
- \reimp
-*/
-
-/*!
- \fn void QVFbScreen::save()
- \reimp
-*/
-
-/*!
- \fn void QVFbScreen::setDirty(const QRect & r)
- \reimp
-*/
-
-/*!
- \fn void QVFbScreen::setMode(int nw, int nh, int nd)
- \reimp
-*/
-
-/*!
- \fn void QVFbScreen::shutdownDevice()
- \reimp
-*/
-
-/*!
- \fn QVFbScreen::QVFbScreen(int displayId)
-
- Constructs a QVNCScreen object. The \a displayId argument
- identifies the Qt for Embedded Linux server to connect to.
-*/
-QVFbScreen::QVFbScreen(int display_id)
- : QScreen(display_id, VFbClass), d_ptr(new QVFbScreenPrivate)
-{
- d_ptr->shmrgn = 0;
- d_ptr->hdr = 0;
- data = 0;
-}
-
-/*!
- Destroys this QVFbScreen object.
-*/
-QVFbScreen::~QVFbScreen()
-{
- delete d_ptr;
-}
-
-static QVFbScreen *connected = 0;
-
-bool QVFbScreen::connect(const QString &displaySpec)
-{
- QStringList displayArgs = displaySpec.split(QLatin1Char(':'));
- if (displayArgs.contains(QLatin1String("Gray")))
- grayscale = true;
-
- key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLocal8Bit(), 'b');
-
- if (key == -1)
- return false;
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN
- if (displayArgs.contains(QLatin1String("littleendian")))
-#endif
- QScreen::setFrameBufferLittleEndian(true);
-#endif
-
- int shmId = shmget(key, 0, 0);
- if (shmId != -1)
- d_ptr->shmrgn = (unsigned char *)shmat(shmId, 0, 0);
- else
- return false;
-
- if ((long)d_ptr->shmrgn == -1 || d_ptr->shmrgn == 0) {
- qDebug("No shmrgn %ld", (long)d_ptr->shmrgn);
- return false;
- }
-
- d_ptr->hdr = (QVFbHeader *)d_ptr->shmrgn;
- data = d_ptr->shmrgn + d_ptr->hdr->dataoffset;
-
- dw = w = d_ptr->hdr->width;
- dh = h = d_ptr->hdr->height;
- d = d_ptr->hdr->depth;
-
- switch (d) {
- case 1:
- setPixelFormat(QImage::Format_Mono);
- break;
- case 8:
- setPixelFormat(QImage::Format_Indexed8);
- break;
- case 12:
- setPixelFormat(QImage::Format_RGB444);
- break;
- case 15:
- setPixelFormat(QImage::Format_RGB555);
- break;
- case 16:
- setPixelFormat(QImage::Format_RGB16);
- break;
- case 18:
- setPixelFormat(QImage::Format_RGB666);
- break;
- case 24:
- setPixelFormat(QImage::Format_RGB888);
- break;
- case 32:
- setPixelFormat(QImage::Format_ARGB32_Premultiplied);
- break;
- }
-
- lstep = d_ptr->hdr->linestep;
-
- // Handle display physical size spec.
- int dimIdxW = -1;
- int dimIdxH = -1;
- for (int i = 0; i < displayArgs.size(); ++i) {
- if (displayArgs.at(i).startsWith(QLatin1String("mmWidth"))) {
- dimIdxW = i;
- break;
- }
- }
- for (int i = 0; i < displayArgs.size(); ++i) {
- if (displayArgs.at(i).startsWith(QLatin1String("mmHeight"))) {
- dimIdxH = i;
- break;
- }
- }
- if (dimIdxW >= 0) {
- bool ok;
- int pos = 7;
- if (displayArgs.at(dimIdxW).at(pos) == QLatin1Char('='))
- ++pos;
- int pw = displayArgs.at(dimIdxW).mid(pos).toInt(&ok);
- if (ok) {
- physWidth = pw;
- if (dimIdxH < 0)
- physHeight = dh*physWidth/dw;
- }
- }
- if (dimIdxH >= 0) {
- bool ok;
- int pos = 8;
- if (displayArgs.at(dimIdxH).at(pos) == QLatin1Char('='))
- ++pos;
- int ph = displayArgs.at(dimIdxH).mid(pos).toInt(&ok);
- if (ok) {
- physHeight = ph;
- if (dimIdxW < 0)
- physWidth = dw*physHeight/dh;
- }
- }
- if (dimIdxW < 0 && dimIdxH < 0) {
- const int dpi = 72;
- physWidth = qRound(dw * 25.4 / dpi);
- physHeight = qRound(dh * 25.4 / dpi);
- }
-
- qDebug("Connected to VFB server %s: %d x %d x %d %dx%dmm (%dx%ddpi)", displaySpec.toLatin1().data(),
- w, h, d, physWidth, physHeight, qRound(dw*25.4/physWidth), qRound(dh*25.4/physHeight) );
-
- size = lstep * h;
- mapsize = size;
- screencols = d_ptr->hdr->numcols;
- memcpy(screenclut, d_ptr->hdr->clut, sizeof(QRgb) * screencols);
-
- connected = this;
-
- if (qgetenv("QT_QVFB_BGR").toInt())
- pixeltype = BGRPixel;
-
- return true;
-}
-
-void QVFbScreen::disconnect()
-{
- connected = 0;
- if ((long)d_ptr->shmrgn != -1 && d_ptr->shmrgn) {
- if (qApp->type() == QApplication::GuiServer && d_ptr->hdr->dataoffset >= (int)sizeof(QVFbHeader)) {
- d_ptr->hdr->serverVersion = 0;
- }
- shmdt((char*)d_ptr->shmrgn);
- }
-}
-
-bool QVFbScreen::initDevice()
-{
-#ifndef QT_NO_QWS_MOUSE_QVFB
- const QString mouseDev = QT_VFB_MOUSE_PIPE(displayId);
- d_ptr->mouse = new QVFbMouseHandler(QLatin1String("QVFbMouse"), mouseDev);
- qwsServer->setDefaultMouse("None");
- if (d_ptr->mouse)
- d_ptr->mouse->setScreen(this);
-#endif
-
-#if !defined(QT_NO_QWS_KBD_QVFB) && !defined(QT_NO_QWS_KEYBOARD)
- const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId);
- d_ptr->keyboard = new QVFbKeyboardHandler(keyboardDev);
- qwsServer->setDefaultKeyboard("None");
-#endif
-
- if (d_ptr->hdr->dataoffset >= (int)sizeof(QVFbHeader))
- d_ptr->hdr->serverVersion = QT_VERSION;
-
- if(d==8) {
- screencols=256;
- if (grayscale) {
- // Build grayscale palette
- for(int loopc=0;loopc<256;loopc++) {
- screenclut[loopc]=qRgb(loopc,loopc,loopc);
- }
- } else {
- // 6x6x6 216 color cube
- int idx = 0;
- for(int ir = 0x0; ir <= 0xff; ir+=0x33) {
- for(int ig = 0x0; ig <= 0xff; ig+=0x33) {
- for(int ib = 0x0; ib <= 0xff; ib+=0x33) {
- screenclut[idx]=qRgb(ir, ig, ib);
- idx++;
- }
- }
- }
- screencols=idx;
- }
- memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols);
- d_ptr->hdr->numcols = screencols;
- } else if (d == 4) {
- int val = 0;
- for (int idx = 0; idx < 16; idx++, val += 17) {
- screenclut[idx] = qRgb(val, val, val);
- }
- screencols = 16;
- memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols);
- d_ptr->hdr->numcols = screencols;
- } else if (d == 1) {
- screencols = 2;
- screenclut[1] = qRgb(0xff, 0xff, 0xff);
- screenclut[0] = qRgb(0, 0, 0);
- memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols);
- d_ptr->hdr->numcols = screencols;
- }
-
-#ifndef QT_NO_QWS_CURSOR
- QScreenCursor::initSoftwareCursor();
-#endif
- return true;
-}
-
-void QVFbScreen::shutdownDevice()
-{
-}
-
-void QVFbScreen::setMode(int ,int ,int)
-{
-}
-
-// save the state of the graphics card
-// This is needed so that e.g. we can restore the palette when switching
-// between linux virtual consoles.
-void QVFbScreen::save()
-{
- // nothing to do.
-}
-
-// restore the state of the graphics card.
-void QVFbScreen::restore()
-{
-}
-void QVFbScreen::setDirty(const QRect& rect)
-{
- const QRect r = rect.translated(-offset());
- d_ptr->hdr->dirty = true;
- d_ptr->hdr->update = d_ptr->hdr->update.united(r);
-}
-
-void QVFbScreen::setBrightness(int b)
-{
- if (connected) {
- connected->d_ptr->brightness = b;
-
- QVFbHeader *hdr = connected->d_ptr->hdr;
- if (hdr->viewerVersion < 0x040400) // brightness not supported
- return;
-
- const int br = connected->d_ptr->blank ? 0 : b;
- if (hdr->brightness != br) {
- hdr->brightness = br;
- connected->setDirty(connected->region().boundingRect());
- }
- }
-}
-
-void QVFbScreen::blank(bool on)
-{
- d_ptr->blank = on;
- setBrightness(connected->d_ptr->brightness);
-}
-
-#endif // QT_NO_QWS_QVFB
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qscreenvfb_qws.h b/src/gui/embedded/qscreenvfb_qws.h
deleted file mode 100644
index dc5ff54a1b..0000000000
--- a/src/gui/embedded/qscreenvfb_qws.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENVFB_QWS_H
-#define QSCREENVFB_QWS_H
-
-#include <QtGui/qscreen_qws.h>
-#include <QtGui/qvfbhdr.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_QVFB
-
-class QVFbScreenPrivate;
-
-class Q_GUI_EXPORT QVFbScreen : public QScreen
-{
-public:
- explicit QVFbScreen(int display_id);
- virtual ~QVFbScreen();
- virtual bool initDevice();
- virtual bool connect(const QString &displaySpec);
- virtual void disconnect();
- virtual void shutdownDevice();
- virtual void save();
- virtual void restore();
- virtual void setMode(int nw,int nh,int nd);
- virtual void setDirty(const QRect& r);
- virtual void blank(bool);
-#ifdef QTOPIA_QVFB_BRIGHTNESS
- static void setBrightness(int b);
-#endif
-
-private:
- QVFbScreenPrivate *d_ptr;
-};
-
-#endif // QT_NO_QWS_QVFB
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREENVFB_QWS_H
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
deleted file mode 100644
index bd6da77d4c..0000000000
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ /dev/null
@@ -1,1530 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsoundqss_qws.h"
-
-#ifndef QT_NO_SOUND
-#include <qbytearray.h>
-#include <qlist.h>
-#include <qsocketnotifier.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qstringlist.h>
-#include <qevent.h>
-#include <qalgorithms.h>
-#include <qtimer.h>
-#include <qpointer.h>
-#include <qendian.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-
-#include <qdebug.h>
-
-#include <qvfbhdr.h>
-
-extern int errno;
-
-QT_BEGIN_NAMESPACE
-
-#define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0
-#define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0
-
-// Zaurus SL5000D doesn't seem to return any error if setting to 44000 and it fails,
-// however 44100 works, 44100 is more common that 44000.
-static int sound_speed = 44100;
-#ifndef QT_NO_QWS_SOUNDSERVER
-extern int qws_display_id;
-#endif
-
-static char *zeroMem = 0;
-
-struct QRiffChunk {
- char id[4];
- quint32 size;
- char data[4/*size*/];
-};
-
-#if defined(QT_QWS_IPAQ)
-static const int sound_fragment_size = 12;
-#else
-static const int sound_fragment_size = 12;
-#endif
-static const int sound_buffer_size = 1 << sound_fragment_size;
-// nb. there will be an sound startup delay of
-// 2^sound_fragment_size / sound_speed seconds.
-// (eg. sound_fragment_size==12, sound_speed==44000 means 0.093s delay)
-
-#ifdef QT_QWS_SOUND_STEREO
-static int sound_stereo=QT_QWS_SOUND_STEREO;
-#else
-static const int sound_stereo=0;
-#endif
-#ifdef QT_QWS_SOUND_16BIT
-static bool sound_16bit=QT_QWS_SOUND_16BIT;
-#else
-static const bool sound_16bit=false;
-#endif
-
-#ifndef QT_NO_QWS_SOUNDSERVER
-class QWSSoundServerClient : public QObject {
- Q_OBJECT
-
-public:
- QWSSoundServerClient(QWS_SOCK_BASE *s, QObject* parent);
- ~QWSSoundServerClient();
-
-public slots:
- void sendSoundCompleted(int, int);
- void sendDeviceReady(int, int);
- void sendDeviceError(int, int, int);
-
-signals:
- void play(int, int, const QString&);
- void play(int, int, const QString&, int, int);
- void playRaw(int, int, const QString&, int, int, int, int);
-
- void pause(int, int);
- void stop(int, int);
- void resume(int, int);
- void setVolume(int, int, int, int);
- void setMute(int, int, bool);
-
- void stopAll(int);
-
- void playPriorityOnly(bool);
-
- void setSilent( bool );
-
-private slots:
- void tryReadCommand();
-
-private:
- void sendClientMessage(QString msg);
- int mCurrentID;
- int left, right;
- bool priExist;
- static int lastId;
- static int nextId() { return ++lastId; }
- QPointer<QWS_SOCK_BASE> socket;
-};
-
-int QWSSoundServerClient::lastId = 0;
-
-QWSSoundServerClient::QWSSoundServerClient(QWS_SOCK_BASE *s, QObject* parent) :
- QObject( parent )
-{
- socket = s;
- priExist = false;
- mCurrentID = nextId();
- connect(socket,SIGNAL(readyRead()),
- this,SLOT(tryReadCommand()));
- connect(socket, SIGNAL(disconnected()), this, SLOT(deleteLater()));
-}
-
-QWSSoundServerClient::~QWSSoundServerClient()
-{
- if (priExist)
- playPriorityOnly(false);
- emit stopAll(mCurrentID);
- if (socket)
- socket->deleteLater();
-}
-
-static QString getStringTok(QString &in)
-{
- int pos = in.indexOf(QLatin1Char(' '));
- QString ret;
- if (pos > 0) {
- ret = in.left(pos);
- in = in.mid(pos+1);
- } else {
- ret = in;
- in = QString::null;
- }
- return ret;
-}
-
-static int getNumTok(QString &in)
-{
- return getStringTok(in).toInt();
-}
-
-void QWSSoundServerClient::tryReadCommand()
-{
- while ( socket->canReadLine() ) {
- QString l = QString::fromAscii(socket->readLine());
- l.truncate(l.length()-1); // chomp
- QString functionName = getStringTok(l);
- int soundid = getNumTok(l);
- if (functionName == QLatin1String("PLAY")) {
- emit play(mCurrentID, soundid, l);
- } else if (functionName == QLatin1String("PLAYEXTEND")) {
- int volume = getNumTok(l);
- int flags = getNumTok(l);
- emit play(mCurrentID, soundid, l, volume, flags);
- } else if (functionName == QLatin1String("PLAYRAW")) {
- int chs = getNumTok(l);
- int freq = getNumTok(l);
- int bitspersample = getNumTok(l);
- int flags = getNumTok(l);
- emit playRaw(mCurrentID, soundid, l, freq, chs, bitspersample, flags);
- } else if (functionName == QLatin1String("PAUSE")) {
- emit pause(mCurrentID, soundid);
- } else if (functionName == QLatin1String("STOP")) {
- emit stop(mCurrentID, soundid);
- } else if (functionName == QLatin1String("RESUME")) {
- emit resume(mCurrentID, soundid);
- } else if (functionName == QLatin1String("SETVOLUME")) {
- int left = getNumTok(l);
- int right = getNumTok(l);
- emit setVolume(mCurrentID, soundid, left, right);
- } else if (functionName == QLatin1String("MUTE")) {
- emit setMute(mCurrentID, soundid, true);
- } else if (functionName == QLatin1String("UNMUTE")) {
- emit setMute(mCurrentID, soundid, false);
- } else if (functionName == QLatin1String("PRIORITYONLY")) {
- bool sPri = soundid != 0;
- if (sPri != priExist) {
- priExist = sPri;
- emit playPriorityOnly(sPri);
- }
- } else if(functionName == QLatin1String("SILENT")) {
- emit setSilent( soundid != 0 );
- }
- }
-}
-
-void QWSSoundServerClient::sendClientMessage(QString msg)
-{
-#ifndef QT_NO_TEXTCODEC
- QByteArray u = msg.toUtf8();
-#else
- QByteArray u = msg.toLatin1();
-#endif
- socket->write(u.data(), u.length());
- socket->flush();
-}
-
-void QWSSoundServerClient::sendSoundCompleted(int gid, int sid)
-{
- if (gid == mCurrentID)
- sendClientMessage(QLatin1String("SOUNDCOMPLETED ")
- + QString::number(sid) + QLatin1Char('\n'));
-}
-
-void QWSSoundServerClient::sendDeviceReady(int gid, int sid)
-{
- if (gid == mCurrentID)
- sendClientMessage(QLatin1String("DEVICEREADY ")
- + QString::number(sid) + QLatin1Char('\n'));
-}
-
-void QWSSoundServerClient::sendDeviceError(int gid, int sid, int err)
-{
- if (gid == mCurrentID)
- sendClientMessage(QLatin1String("DEVICEERROR ")
- + QString::number(sid) + QLatin1Char(' ')
- + QString::number(err) + QLatin1Char('\n'));
-}
-#endif
-
-static const int maxVolume = 100;
-static const int runinLength = 2*sound_buffer_size;
-class QWSSoundServerProvider {
-public:
- QWSSoundServerProvider(int w, int s)
- : mWid(w), mSid(s), mMuted(false)
- {
- leftVolume = maxVolume>>1;
- rightVolume = maxVolume>>1;
- isPriority = false;
- samples_due = 0;
- max1 = max2 = out = 0;// = sound_buffer_size;
- data = data1;
- max = &max1;
- sampleRunin = 0;
- dev = -1;
- }
-
- virtual ~QWSSoundServerProvider() {
- }
-
- int groupId() const { return mWid; }
- int soundId() const { return mSid; }
-
- void startSampleRunin() {
- // inteded to provide even audio return from mute/pause/dead samples.
- //sampleRunin = runinLength; // or more?
- }
-
-
- void setVolume(int lv, int rv) {
- leftVolume = qMin(maxVolume, qMax(0, lv));
- rightVolume = qMin(maxVolume, qMax(0, rv));
- }
-
- void setMute(bool m) { mMuted = m; }
- bool muted() { return mMuted; }
-
- void setPriority(bool p) {
- if (p != isPriority) {
- isPriority = p; // currently meaningless.
- }
- }
-
-
- static void setPlayPriorityOnly(bool p)
- {
- if (p)
- priorityExists++;
- else
- priorityExists--;
-
- if (priorityExists < 0)
- qDebug("QSS: got more priority offs than ons");
- }
-
- // return -1 for file broken, give up.
- // else return sampels ready for playing.
- // argument is max samples server is looking for,
- // in terms of current device status.
- virtual int readySamples(int) = 0;
-
- int getSample(int off, int bps) {
-
- //
- // 16-bit audio data is converted to native endian so that it can be scaled
- // Yes, this is ugly on a BigEndian machine
- // Perhaps it shouldn't be scaled at all
- //
- return (bps == 1) ? (data[out+off] - 128) * 128 : qToLittleEndian(((short*)data)[(out/2)+off]);
- }
-
- int add(int* mixl, int* mixr, int count)
- {
- int bytesPerSample = chunkdata.wBitsPerSample >> 3;
-
- if ( mMuted ) {
- sampleRunin -= qMin(sampleRunin,count);
- while (count && (dev != -1)) {
- if (out >= *max) {
- // switch buffers
- out = 0;
- if (data == data1 && max2 != 0) {
- data = data2;
- max = &max2;
- max1 = 0;
- } else if (data == data2 && max1 != 0) {
- data = data1;
- max = &max1;
- max2 = 0;
- } else {
- qDebug("QSS Read Error: both buffers empty");
- return 0;
- }
- }
- samples_due += sound_speed;
- while (count && samples_due >= chunkdata.samplesPerSec) {
- samples_due -= chunkdata.samplesPerSec;
- count--;
- }
- out += bytesPerSample * chunkdata.channels;
- }
- return count;
- }
-
- // This shouldn't be the case
- if ( !mixl || !mixr )
- return 0;
-
- int lVolNum = leftVolume, lVolDen = maxVolume;
- int rVolNum = rightVolume, rVolDen = maxVolume;
- if (priorityExists > 0 && !isPriority) {
- lVolNum = 0; // later, make this gradually fade in and out.
- lVolDen = 5;
- rVolNum = 0;
- rVolDen = 5;
- }
-
- while (count && (dev != -1)) {
- if (out >= *max) {
- // switch buffers
- out = 0;
- if (data == data1 && max2 != 0) {
- data = data2;
- max = &max2;
- max1 = 0;
- } else if (data == data2 && max1 != 0) {
- data = data1;
- max = &max1;
- max2 = 0;
- } else {
- qDebug("QSS Read Error: both buffers empty");
- return 0;
- }
- }
- samples_due += sound_speed;
- if (count && samples_due >= chunkdata.samplesPerSec) {
- int l = getSample(0,bytesPerSample)*lVolNum/lVolDen;
- int r = (chunkdata.channels == 2) ? getSample(1,bytesPerSample)*rVolNum/rVolDen : l;
- if (!sound_stereo && chunkdata.channels == 2)
- l += r;
- if (sampleRunin) {
- while (sampleRunin && count && samples_due >= chunkdata.samplesPerSec) {
- mixl++;
- if (sound_stereo)
- mixr++;
- samples_due -= chunkdata.samplesPerSec;
- sampleRunin--;
- count--;
- }
- }
- while (count && samples_due >= chunkdata.samplesPerSec) {
- *mixl++ += l;
- if (sound_stereo)
- *mixr++ += r;
- samples_due -= chunkdata.samplesPerSec;
- count--;
- }
- }
-
- // optimize out manipulation of sample if downsampling and we skip it
- out += bytesPerSample * chunkdata.channels;
- }
-
- return count;
- }
-
- virtual bool finished() const = 0;
-
- bool equal(int wid, int sid)
- {
- return (wid == mWid && sid == mSid);
- }
-
-protected:
-
- char * prepareBuffer( int &size)
- {
- // keep reading as long as there is 50 % or more room in off buffer.
- if (data == data1 && (max2<<1 < sound_buffer_size)) {
- size=sound_buffer_size - max2;
- return (char *)data2;
- } else if (data == data2 && (max1<<1 < sound_buffer_size)) {
- size=sound_buffer_size - max1;
- return (char *)data1;
- } else {
- size = 0;
- return 0;
- }
- }
-
- void updateBuffer(int read)
- {
- // always reads to off buffer.
- if (read >= 0) {
- if (data == data2) {
- max1 = read;
- } else {
- max2 = read;
- }
- }
- }
-
- int devSamples()
- {
- int possible = (((max1+max2-out) / ((chunkdata.wBitsPerSample>>3)*chunkdata.channels))
- *sound_speed)/chunkdata.samplesPerSec;
-
- return possible;
- }
-
-
- struct {
- qint16 formatTag;
- qint16 channels;
- qint32 samplesPerSec;
- qint32 avgBytesPerSec;
- qint16 blockAlign;
- qint16 wBitsPerSample;
- } chunkdata;
- int dev;
- int samples_due;
-private:
- int mWid;
- int mSid;
- int leftVolume;
- int rightVolume;
- bool isPriority;
- static int priorityExists;
- int *max;
- uchar *data;
- uchar data1[sound_buffer_size+4]; // +4 to handle badly aligned input data
- uchar data2[sound_buffer_size+4]; // +4 to handle badly aligned input data
- int out, max1, max2;
- int sampleRunin;
- bool mMuted;
-};
-
-int QWSSoundServerProvider::priorityExists = 0;
-
-class QWSSoundServerBucket : public QWSSoundServerProvider {
-public:
- QWSSoundServerBucket(int d, int wid, int sid)
- : QWSSoundServerProvider(wid, sid)
- {
- dev = d;
- wavedata_remaining = -1;
- mFinishedRead = false;
- mInsufficientSamples = false;
- }
- ~QWSSoundServerBucket()
- {
- //dev->close();
- ::close(dev);
- }
- bool finished() const
- {
- //return !max;
- return mInsufficientSamples && mFinishedRead ;
- }
- int readySamples(int)
- {
- int size;
- char *dest = prepareBuffer(size);
- // may want to change this to something like
- // if (data == data1 && max2<<1 < sound_buffer_size
- // ||
- // data == data2 && max1<<1 < sound_buffer_size)
- // so will keep filling off buffer while there is +50% space left
- if (size > 0 && dest != 0) {
- while ( wavedata_remaining < 0 ) {
- //max = 0;
- wavedata_remaining = -1;
- // Keep reading chunks...
- const int n = sizeof(chunk)-sizeof(chunk.data);
- int nr = ::read(dev, (void*)&chunk,n);
- if ( nr != n ) {
- // XXX check error? or don't we care?
- wavedata_remaining = 0;
- mFinishedRead = true;
- } else if ( qstrncmp(chunk.id,"data",4) == 0 ) {
- wavedata_remaining = qToLittleEndian( chunk.size );
-
- //out = max = sound_buffer_size;
-
- } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) {
- char d[4];
- if ( read(dev, d, 4) != 4 ) {
- // XXX check error? or don't we care?
- //qDebug("couldn't read riff");
- mInsufficientSamples = true;
- mFinishedRead = true;
- return 0;
- } else if ( qstrncmp(d,"WAVE",4) != 0 ) {
- // skip
- if ( chunk.size > 1000000000 || lseek(dev,chunk.size-4, SEEK_CUR) == -1 ) {
- //qDebug("oversized wav chunk");
- mFinishedRead = true;
- }
- }
- } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) {
- if ( ::read(dev,(char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) {
- // XXX check error? or don't we care?
- //qDebug("couldn't ready chunkdata");
- mFinishedRead = true;
- }
-
-#define WAVE_FORMAT_PCM 1
- else
- {
- /*
- ** Endian Fix the chuck data
- */
- chunkdata.formatTag = qToLittleEndian( chunkdata.formatTag );
- chunkdata.channels = qToLittleEndian( chunkdata.channels );
- chunkdata.samplesPerSec = qToLittleEndian( chunkdata.samplesPerSec );
- chunkdata.avgBytesPerSec = qToLittleEndian( chunkdata.avgBytesPerSec );
- chunkdata.blockAlign = qToLittleEndian( chunkdata.blockAlign );
- chunkdata.wBitsPerSample = qToLittleEndian( chunkdata.wBitsPerSample );
- if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
- qWarning("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
- mFinishedRead = true;
- }
- }
- } else {
- // ignored chunk
- if ( chunk.size > 1000000000 || lseek(dev, chunk.size, SEEK_CUR) == -1) {
- //qDebug("chunk size too big");
- mFinishedRead = true;
- }
- }
- }
- // this looks wrong.
- if (wavedata_remaining <= 0) {
- mFinishedRead = true;
- }
-
- }
- // may want to change this to something like
- // if (data == data1 && max2<<1 < sound_buffer_size
- // ||
- // data == data2 && max1<<1 < sound_buffer_size)
- // so will keep filling off buffer while there is +50% space left
-
- if (wavedata_remaining) {
- if (size > 0 && dest != 0) {
- int read = ::read(dev, dest, qMin(size, wavedata_remaining));
- // XXX check error? or don't we care?
- wavedata_remaining -= read;
- updateBuffer(read);
- if (read <= 0) // data unexpectidly ended
- mFinishedRead = true;
- }
- }
- int possible = devSamples();
- if (possible == 0)
- mInsufficientSamples = true;
- return possible;
- }
-
-protected:
- QRiffChunk chunk;
- int wavedata_remaining;
- bool mFinishedRead;
- bool mInsufficientSamples;
-};
-
-class QWSSoundServerStream : public QWSSoundServerProvider {
-public:
- QWSSoundServerStream(int d,int c, int f, int b,
- int wid, int sid)
- : QWSSoundServerProvider(wid, sid)
- {
- chunkdata.channels = c;
- chunkdata.samplesPerSec = f;
- chunkdata.wBitsPerSample = b;
- dev = d;
- //fcntl( dev, F_SETFL, O_NONBLOCK );
- lasttime = 0;
- }
-
- ~QWSSoundServerStream()
- {
- if (dev != -1) {
- ::close(dev);
- dev = -1;
- }
- }
-
- bool finished() const
- {
- return (dev == -1);
- }
-
-
- int readySamples(int)
- {
- int size;
- char *dest = prepareBuffer(size);
- if (size > 0 && dest != 0 && dev != -1) {
-
- int read = ::read(dev, dest, size);
- if (read < 0) {
- switch(errno) {
- case EAGAIN:
- case EINTR:
- // means read may yet succeed on the next attempt
- break;
- default:
- // unexpected error, fail.
- ::close(dev);
- dev = -1;
- }
- } else if (read == 0) {
- // 0 means writer has closed dev and/or
- // file is at end.
- ::close(dev);
- dev = -1;
- } else {
- updateBuffer(read);
- }
- }
- int possible = devSamples();
- if (possible == 0)
- startSampleRunin();
- return possible;
- }
-
-protected:
- time_t lasttime;
-};
-
-#ifndef QT_NO_QWS_SOUNDSERVER
-QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent) :
- QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent)
-{
- connect(this, SIGNAL(newConnection()), this, SLOT(newConnection()));
-}
-
-
-#ifdef QT3_SUPPORT
-QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent, const char *name) :
- QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent)
-{
- if (name)
- setObjectName(QString::fromAscii(name));
- connect(this, SIGNAL(newConnection()), this, SLOT(newConnection()));
-}
-#endif
-
-void QWSSoundServerSocket::newConnection()
-{
- while (QWS_SOCK_BASE *sock = nextPendingConnection()) {
- QWSSoundServerClient* client = new QWSSoundServerClient(sock,this);
-
- connect(client, SIGNAL(play(int,int,QString)),
- this, SIGNAL(playFile(int,int,QString)));
- connect(client, SIGNAL(play(int,int,QString,int,int)),
- this, SIGNAL(playFile(int,int,QString,int,int)));
- connect(client, SIGNAL(playRaw(int,int,QString,int,int,int,int)),
- this, SIGNAL(playRawFile(int,int,QString,int,int,int,int)));
-
- connect(client, SIGNAL(pause(int,int)),
- this, SIGNAL(pauseFile(int,int)));
- connect(client, SIGNAL(stop(int,int)),
- this, SIGNAL(stopFile(int,int)));
- connect(client, SIGNAL(playPriorityOnly(bool)),
- this, SIGNAL(playPriorityOnly(bool)));
- connect(client, SIGNAL(stopAll(int)),
- this, SIGNAL(stopAll(int)));
- connect(client, SIGNAL(resume(int,int)),
- this, SIGNAL(resumeFile(int,int)));
-
- connect(client, SIGNAL(setSilent(bool)),
- this, SIGNAL(setSilent(bool)));
-
- connect(client, SIGNAL(setMute(int,int,bool)),
- this, SIGNAL(setMute(int,int,bool)));
- connect(client, SIGNAL(setVolume(int,int,int,int)),
- this, SIGNAL(setVolume(int,int,int,int)));
-
- connect(this, SIGNAL(soundFileCompleted(int,int)),
- client, SLOT(sendSoundCompleted(int,int)));
- connect(this, SIGNAL(deviceReady(int,int)),
- client, SLOT(sendDeviceReady(int,int)));
- connect(this, SIGNAL(deviceError(int,int,int)),
- client, SLOT(sendDeviceError(int,int,int)));
- }
-}
-
-#endif
-
-class QWSSoundServerPrivate : public QObject {
- Q_OBJECT
-
-public:
- QWSSoundServerPrivate(QObject* parent=0, const char* name=0) :
- QObject(parent)
- {
- timerId = 0;
- if (name)
- setObjectName(QString::fromAscii(name));
-#ifndef QT_NO_QWS_SOUNDSERVER
- server = new QWSSoundServerSocket(this);
-
- connect(server, SIGNAL(playFile(int,int,QString)),
- this, SLOT(playFile(int,int,QString)));
- connect(server, SIGNAL(playFile(int,int,QString,int,int)),
- this, SLOT(playFile(int,int,QString,int,int)));
- connect(server, SIGNAL(playRawFile(int,int,QString,int,int,int,int)),
- this, SLOT(playRawFile(int,int,QString,int,int,int,int)));
-
- connect(server, SIGNAL(pauseFile(int,int)),
- this, SLOT(pauseFile(int,int)));
- connect(server, SIGNAL(stopFile(int,int)),
- this, SLOT(stopFile(int,int)));
- connect(server, SIGNAL(stopAll(int)),
- this, SLOT(stopAll(int)));
- connect(server, SIGNAL(playPriorityOnly(bool)),
- this, SLOT(playPriorityOnly(bool)));
- connect(server, SIGNAL(resumeFile(int,int)),
- this, SLOT(resumeFile(int,int)));
-
- connect( server, SIGNAL(setSilent(bool)),
- this, SLOT(setSilent(bool)));
-
- connect(server, SIGNAL(setMute(int,int,bool)),
- this, SLOT(setMute(int,int,bool)));
- connect(server, SIGNAL(setVolume(int,int,int,int)),
- this, SLOT(setVolume(int,int,int,int)));
-
- connect(this, SIGNAL(soundFileCompleted(int,int)),
- server, SIGNAL(soundFileCompleted(int,int)));
- connect(this, SIGNAL(deviceReady(int,int)),
- server, SIGNAL(deviceReady(int,int)));
- connect(this, SIGNAL(deviceError(int,int,int)),
- server, SIGNAL(deviceError(int,int,int)));
-
-#endif
- silent = false;
- fd = -1;
- unwritten = 0;
- can_GETOSPACE = true;
- }
-
- ~QWSSoundServerPrivate()
- {
- qDeleteAll(active);
- qDeleteAll(inactive);
- }
-
-signals:
- void soundFileCompleted(int, int);
- void deviceReady(int, int);
- void deviceError(int, int, int);
-
-public slots:
- void playRawFile(int wid, int sid, const QString &filename, int freq, int channels, int bitspersample, int flags);
- void playFile(int wid, int sid, const QString& filename);
- void playFile(int wid, int sid, const QString& filename, int v, int flags);
- void checkPresetVolumes(int wid, int sid, QWSSoundServerProvider *p);
- void pauseFile(int wid, int sid);
- void resumeFile(int wid, int sid);
- void stopFile(int wid, int sid);
- void stopAll(int wid);
- void setVolume(int wid, int sid, int lv, int rv);
- void setMute(int wid, int sid, bool m);
- void playPriorityOnly(bool p);
- void sendCompletedSignals();
- void feedDevice(int fd);
- void setSilent( bool enabled );
-
-protected:
- void timerEvent(QTimerEvent* event);
-
-private:
- int openFile(int wid, int sid, const QString& filename);
- bool openDevice();
- void closeDevice()
- {
- if (fd >= 0) {
- ::close(fd);
- fd = -1;
- }
- }
-
- QList<QWSSoundServerProvider*> active;
- QList<QWSSoundServerProvider*> inactive;
- struct PresetVolume {
- int wid;
- int sid;
- int left;
- int right;
- bool mute;
- };
- QList<PresetVolume> volumes;
- struct CompletedInfo {
- CompletedInfo( ) : groupId( 0 ), soundId( 0 ) { }
- CompletedInfo( int _groupId, int _soundId ) : groupId( _groupId ), soundId( _soundId ) { }
- int groupId;
- int soundId;
- };
- QList<CompletedInfo> completed;
-
- bool silent;
-
- int fd;
- int unwritten;
- int timerId;
- char* cursor;
- short data[sound_buffer_size*2];
- bool can_GETOSPACE;
-#ifndef QT_NO_QWS_SOUNDSERVER
- QWSSoundServerSocket *server;
-#endif
-};
-
-void QWSSoundServerPrivate::setSilent( bool enabled )
-{
- // Close output device
- closeDevice();
- if( !unwritten && !active.count() ) {
- sendCompletedSignals();
- }
- // Stop processing audio
- killTimer( timerId );
- silent = enabled;
- // If audio remaining, open output device and continue processing
- if( unwritten || active.count() ) {
- openDevice();
- }
-}
-
-void QWSSoundServerPrivate::timerEvent(QTimerEvent* event)
-{
- // qDebug("QSS timer event");
- if( event->timerId() == timerId ) {
- if (fd >= 0)
- feedDevice(fd);
- if (fd < 0) {
- killTimer(timerId);
- timerId = 0;
- }
- }
-}
-
-void QWSSoundServerPrivate::playRawFile(int wid, int sid, const QString &filename,
- int freq, int channels, int bitspersample, int flags)
-{
-#ifdef QT_NO_QWS_SOUNDSERVER
- Q_UNUSED(flags);
-#endif
- int f = openFile(wid, sid, filename);
- if ( f ) {
- QWSSoundServerStream *b = new QWSSoundServerStream(f, channels, freq, bitspersample, wid, sid);
- // check preset volumes.
- checkPresetVolumes(wid, sid, b);
-#ifndef QT_NO_QWS_SOUNDSERVER
- b->setPriority((flags & QWSSoundClient::Priority) == QWSSoundClient::Priority);
-#endif
- active.append(b);
- emit deviceReady(wid, sid);
- }
-}
-
-void QWSSoundServerPrivate::playFile(int wid, int sid, const QString& filename)
-{
- int f = openFile(wid, sid, filename);
- if ( f ) {
- QWSSoundServerProvider *b = new QWSSoundServerBucket(f, wid, sid);
- checkPresetVolumes(wid, sid, b);
- active.append( b );
- emit deviceReady(wid, sid);
- }
-}
-
-void QWSSoundServerPrivate::playFile(int wid, int sid, const QString& filename,
- int v, int flags)
-{
-#ifdef QT_NO_QWS_SOUNDSERVER
- Q_UNUSED(flags);
-#endif
- int f = openFile(wid, sid, filename);
- if ( f ) {
- QWSSoundServerProvider *b = new QWSSoundServerBucket(f, wid, sid);
- checkPresetVolumes(wid, sid, b);
- b->setVolume(v, v);
-#ifndef QT_NO_QWS_SOUNDSERVER
- b->setPriority((flags & QWSSoundClient::Priority) == QWSSoundClient::Priority);
-#endif
- active.append(b);
- emit deviceReady(wid, sid);
- }
-}
-
-void QWSSoundServerPrivate::checkPresetVolumes(int wid, int sid, QWSSoundServerProvider *p)
-{
- QList<PresetVolume>::Iterator it = volumes.begin();
- while (it != volumes.end()) {
- PresetVolume v = *it;
- if (v.wid == wid && v.sid == sid) {
- p->setVolume(v.left, v.right);
- p->setMute(v.mute);
- it = volumes.erase(it);
- return;
- } else {
- ++it;
- }
- }
-}
-
-void QWSSoundServerPrivate::pauseFile(int wid, int sid)
-{
- QWSSoundServerProvider *bucket;
- for (int i = 0; i < active.size(); ++i ) {
- bucket = active.at(i);
- if (bucket->equal(wid, sid)) {
- // found bucket....
- active.removeAt(i);
- inactive.append(bucket);
- return;
- }
- }
-}
-
-void QWSSoundServerPrivate::resumeFile(int wid, int sid)
-{
- QWSSoundServerProvider *bucket;
- for (int i = 0; i < inactive.size(); ++i ) {
- bucket = inactive.at(i);
- if (bucket->equal(wid, sid)) {
- // found bucket....
- inactive.removeAt(i);
- active.append(bucket);
- return;
- }
- }
-}
-
-void QWSSoundServerPrivate::stopFile(int wid, int sid)
-{
- QWSSoundServerProvider *bucket;
- for (int i = 0; i < active.size(); ++i ) {
- bucket = active.at(i);
- if (bucket->equal(wid, sid)) {
- active.removeAt(i);
- delete bucket;
- return;
- }
- }
- for (int i = 0; i < inactive.size(); ++i ) {
- bucket = inactive.at(i);
- if (bucket->equal(wid, sid)) {
- inactive.removeAt(i);
- delete bucket;
- return;
- }
- }
-}
-
-void QWSSoundServerPrivate::stopAll(int wid)
-{
- QWSSoundServerProvider *bucket;
- if (!active.isEmpty()) {
- QList<QWSSoundServerProvider*>::Iterator it = active.begin();
- while (it != active.end()) {
- bucket = *it;
- if (bucket->groupId() == wid) {
- it = active.erase(it);
- delete bucket;
- } else {
- ++it;
- }
- }
- }
- if (!inactive.isEmpty()) {
- QList<QWSSoundServerProvider*>::Iterator it = inactive.begin();
- while (it != inactive.end()) {
- bucket = *it;
- if (bucket->groupId() == wid) {
- it = inactive.erase(it);
- delete bucket;
- } else {
- ++it;
- }
- }
- }
-}
-
-void QWSSoundServerPrivate::setVolume(int wid, int sid, int lv, int rv)
-{
- QWSSoundServerProvider *bucket;
- for( int i = 0; i < active.size(); ++i ) {
- bucket = active.at(i);
- if (bucket->equal(wid, sid)) {
- bucket->setVolume(lv,rv);
- return;
- }
- }
- // If gotten here, then it means wid/sid wasn't set up yet.
- // first find and remove current preset volumes, then add this one.
- QList<PresetVolume>::Iterator it = volumes.begin();
- while (it != volumes.end()) {
- PresetVolume v = *it;
- if (v.wid == wid && v.sid == sid)
- it = volumes.erase(it);
- else
- ++it;
- }
- // and then add this volume
- PresetVolume nv;
- nv.wid = wid;
- nv.sid = sid;
- nv.left = lv;
- nv.right = rv;
- nv.mute = false;
- volumes.append(nv);
-}
-
-void QWSSoundServerPrivate::setMute(int wid, int sid, bool m)
-{
- QWSSoundServerProvider *bucket;
- for( int i = 0; i < active.size(); ++i ) {
- bucket = active.at(i);
- if (bucket->equal(wid, sid)) {
- bucket->setMute(m);
- return;
- }
- }
- // if gotten here then setting is being applied before item
- // is created.
- QList<PresetVolume>::Iterator it = volumes.begin();
- while (it != volumes.end()) {
- PresetVolume v = *it;
- if (v.wid == wid && v.sid == sid) {
- (*it).mute = m;
- return;
- }
- }
- if (m) {
- PresetVolume nv;
- nv.wid = wid;
- nv.sid = sid;
- nv.left = maxVolume>>1;
- nv.right = maxVolume>>1;
- nv.mute = true;
- volumes.append(nv);
- }
-}
-
-void QWSSoundServerPrivate::playPriorityOnly(bool p)
-{
- QWSSoundServerProvider::setPlayPriorityOnly(p);
-}
-
-void QWSSoundServerPrivate::sendCompletedSignals()
-{
- while( !completed.isEmpty() ) {
- emit soundFileCompleted( (*completed.begin()).groupId,
- (*completed.begin()).soundId );
- completed.erase( completed.begin() );
- }
-}
-
-
-int QWSSoundServerPrivate::openFile(int wid, int sid, const QString& filename)
-{
- stopFile(wid, sid); // close and re-open.
- int f = QT_OPEN(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK);
- if (f == -1) {
- // XXX check ferror, check reason.
- qDebug("Failed opening \"%s\"",filename.toLatin1().data());
-#ifndef QT_NO_QWS_SOUNDSERVER
- emit deviceError(wid, sid, (int)QWSSoundClient::ErrOpeningFile );
-#endif
- } else if ( openDevice() ) {
- return f;
- }
-#ifndef QT_NO_QWS_SOUNDSERVER
- emit deviceError(wid, sid, (int)QWSSoundClient::ErrOpeningAudioDevice );
-#endif
- return 0;
-}
-
-bool QWSSoundServerPrivate::openDevice()
-{
- if (fd < 0) {
- if( silent ) {
- fd = QT_OPEN( "/dev/null", O_WRONLY );
- // Emulate write to audio device
- int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit))/sound_speed/2;
- timerId = startTimer(delay);
-
- return true;
- }
- //
- // Don't block open right away.
- //
- bool openOkay = false;
- if ((fd = QT_OPEN("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
- int flags = fcntl(fd, F_GETFL);
- flags &= ~O_NONBLOCK;
- openOkay = (fcntl(fd, F_SETFL, flags) == 0);
- }
- if (!openOkay) {
- qDebug("Failed opening audio device");
- return false;
- }
-
- // Setup soundcard at 16 bit mono
- int v;
- //v=0x00010000+sound_fragment_size;
- // um the media player did this instead.
- v=0x10000 * 4 + sound_fragment_size;
- if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &v))
- qWarning("Could not set fragments to %08x",v);
-#ifdef QT_QWS_SOUND_16BIT
- //
- // Use native endian
- // Since we have manipulated the data volume the data
- // is now in native format, even though its stored
- // as little endian in the WAV file
- //
- v=AFMT_S16_NE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))
- qWarning("Could not set format %d",v);
- if (AFMT_S16_NE != v)
- qDebug("Want format %d got %d", AFMT_S16_LE, v);
-#else
- v=AFMT_U8; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))
- qWarning("Could not set format %d",v);
- if (AFMT_U8 != v)
- qDebug("Want format %d got %d", AFMT_U8, v);
-#endif
- v=sound_stereo; if (ioctl(fd, SNDCTL_DSP_STEREO, &v))
- qWarning("Could not set stereo %d",v);
- if (sound_stereo != v)
- qDebug("Want stereo %d got %d", sound_stereo, v);
-#ifdef QT_QWS_SOUND_STEREO
- sound_stereo=v;
-#endif
- v=sound_speed; if (ioctl(fd, SNDCTL_DSP_SPEED, &sound_speed))
- qWarning("Could not set speed %d",v);
- if (v != sound_speed)
- qDebug("Want speed %d got %d", v, sound_speed);
-
- int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit))
- /sound_speed/2;
- // qDebug("QSS delay: %d", delay);
- timerId = startTimer(delay);
-
- //
- // Check system volume
- //
- int mixerHandle = QT_OPEN( "/dev/mixer", O_RDWR|O_NONBLOCK );
- if ( mixerHandle >= 0 ) {
- int volume;
- ioctl( mixerHandle, MIXER_READ(0), &volume );
- close( mixerHandle );
- if ( volume < 1<<(sound_stereo+sound_16bit) )
- qDebug("Want sound at %d got %d",
- 1<<(sound_stereo+sound_16bit), volume);
- } else
- qDebug( "get volume of audio device failed" );
-
- }
- return true;
-}
-
-void QWSSoundServerPrivate::feedDevice(int fd)
-{
- if ( !unwritten && active.size() == 0 ) {
- closeDevice();
- sendCompletedSignals();
- return;
- } else {
- sendCompletedSignals();
- }
-
- QWSSoundServerProvider* bucket;
-
- // find out how much audio is possible
- int available = sound_buffer_size;
- QList<QWSSoundServerProvider*> running;
- for (int i = 0; i < active.size(); ++i) {
- bucket = active.at(i);
- int ready = bucket->readySamples(available);
- if (ready > 0) {
- available = qMin(available, ready);
- running.append(bucket);
- }
- }
-
- audio_buf_info info;
- if (can_GETOSPACE && ioctl(fd,SNDCTL_DSP_GETOSPACE,&info)) {
- can_GETOSPACE = false;
- fcntl(fd, F_SETFL, O_NONBLOCK);
- }
- if (!can_GETOSPACE)
- info.fragments = 4; // #### configurable?
- if (info.fragments > 0) {
- if (!unwritten) {
- int left[sound_buffer_size];
- memset(left,0,available*sizeof(int));
- int right[sound_buffer_size];
- if ( sound_stereo )
- memset(right,0,available*sizeof(int));
-
- if (running.size() > 0) {
- // should do volume mod here in regards to each bucket to avoid flattened/bad peaks.
- for (int i = 0; i < running.size(); ++i ) {
- bucket = running.at(i);
- int unused = bucket->add(left,right,available);
- if (unused > 0) {
- // this error is quite serious, as
- // it will really screw up mixing.
- qDebug("provider lied about samples ready");
- }
- }
- if ( sound_16bit ) {
- short *d = (short*)data;
- for (int i=0; i<available; i++) {
- *d++ = (short)qMax(qMin(left[i],32767),-32768);
- if ( sound_stereo )
- *d++ = (short)qMax(qMin(right[i],32767),-32768);
- }
- } else {
- signed char *d = (signed char *)data;
- for (int i=0; i<available; i++) {
- *d++ = (signed char)qMax(qMin(left[i]/256,127),-128)+128;
- if ( sound_stereo )
- *d++ = (signed char)qMax(qMin(right[i]/256,127),-128)+128;
- }
- }
- unwritten = available*(sound_16bit+1)*(sound_stereo+1);
- cursor = (char*)data;
- }
- }
- // sound open, but nothing written. Should clear the buffer.
-
- int w;
- if (unwritten) {
- w = ::write(fd,cursor,unwritten);
-
- if (w < 0) {
- if (can_GETOSPACE)
- return;
- w = 0;
- }
-
- cursor += w;
- unwritten -= w;
- } else {
- // write some zeros to clear the buffer?
- if (!zeroMem)
- zeroMem = (char *)calloc(sound_buffer_size, sizeof(char));
- w = ::write(fd, zeroMem, sound_buffer_size);
- if (w < 0)
- w = 0;
- }
- }
-
- QList<QWSSoundServerProvider*>::Iterator it = active.begin();
- while (it != active.end()) {
- bucket = *it;
- if (bucket->finished()) {
- completed.append(CompletedInfo(bucket->groupId(), bucket->soundId()));
- it = active.erase(it);
- delete bucket;
- } else {
- ++it;
- }
- }
-}
-
-
-QWSSoundServer::QWSSoundServer(QObject* parent) :
- QObject(parent)
-{
- d = new QWSSoundServerPrivate(this);
-
- connect( d, SIGNAL(soundFileCompleted(int,int)),
- this, SLOT(translateSoundCompleted(int,int)) );
-}
-
-void QWSSoundServer::playFile( int sid, const QString& filename )
-{
- //wid == 0, as it is the server initiating rather than a client
- // if wid was passable, would accidently collide with server
- // sockect's wids.
- d->playFile(0, sid, filename);
-}
-
-void QWSSoundServer::pauseFile( int sid )
-{
- d->pauseFile(0, sid);
-}
-
-void QWSSoundServer::stopFile( int sid )
-{
- d->stopFile(0, sid);
-}
-
-void QWSSoundServer::resumeFile( int sid )
-{
- d->resumeFile(0, sid);
-}
-
-QWSSoundServer::~QWSSoundServer()
-{
- d->stopAll(0);
-}
-
-void QWSSoundServer::translateSoundCompleted( int, int sid )
-{
- emit soundCompleted( sid );
-}
-
-#ifndef QT_NO_QWS_SOUNDSERVER
-QWSSoundClient::QWSSoundClient(QObject* parent) :
- QWSSocket(parent)
-{
- connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id));
- QObject::connect(this,SIGNAL(readyRead()),
- this,SLOT(tryReadCommand()));
- if( state() == QWS_SOCK_BASE::ConnectedState ) QTimer::singleShot(1, this, SIGNAL(connected()));
- else QTimer::singleShot(1, this, SLOT(emitConnectionRefused()));
-}
-
-QWSSoundClient::~QWSSoundClient( )
-{
- flush();
-}
-
-void QWSSoundClient::reconnect()
-{
- connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id));
- if( state() == QWS_SOCK_BASE::ConnectedState ) emit connected();
- else emit error( QTcpSocket::ConnectionRefusedError );
-}
-
-void QWSSoundClient::sendServerMessage(QString msg)
-{
-#ifndef QT_NO_TEXTCODEC
- QByteArray u = msg.toUtf8();
-#else
- QByteArray u = msg.toLatin1();
-#endif
- write(u.data(), u.length());
- flush();
-}
-
-void QWSSoundClient::play( int id, const QString& filename )
-{
- QFileInfo fi(filename);
- sendServerMessage(QLatin1String("PLAY ")
- + QString::number(id) + QLatin1Char(' ')
- + fi.absoluteFilePath() + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::play( int id, const QString& filename, int volume, int flags)
-{
- QFileInfo fi(filename);
- sendServerMessage(QLatin1String("PLAYEXTEND ")
- + QString::number(id) + QLatin1Char(' ')
- + QString::number(volume) + QLatin1Char(' ')
- + QString::number(flags) + QLatin1Char(' ')
- + fi.absoluteFilePath() + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::pause( int id )
-{
- sendServerMessage(QLatin1String("PAUSE ")
- + QString::number(id) + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::stop( int id )
-{
- sendServerMessage(QLatin1String("STOP ")
- + QString::number(id) + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::resume( int id )
-{
- sendServerMessage(QLatin1String("RESUME ")
- + QString::number(id) + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::playRaw( int id, const QString& filename,
- int freq, int chs, int bitspersample, int flags)
-{
- QFileInfo fi(filename);
- sendServerMessage(QLatin1String("PLAYRAW ")
- + QString::number(id) + QLatin1Char(' ')
- + QString::number(chs) + QLatin1Char(' ')
- + QString::number(freq) + QLatin1Char(' ')
- + QString::number(bitspersample) + QLatin1Char(' ')
- + QString::number(flags) + QLatin1Char(' ')
- + fi.absoluteFilePath() + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::setMute( int id, bool m )
-{
- sendServerMessage(QLatin1String(m ? "MUTE " : "UNMUTE ")
- + QString::number(id) + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::setVolume( int id, int leftVol, int rightVol )
-{
- sendServerMessage(QLatin1String("SETVOLUME ")
- + QString::number(id) + QLatin1Char(' ')
- + QString::number(leftVol) + QLatin1Char(' ')
- + QString::number(rightVol) + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::playPriorityOnly( bool pri )
-{
- sendServerMessage(QLatin1String("PRIORITYONLY ")
- + QString::number(pri ? 1 : 0) + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::setSilent( bool enable )
-{
- sendServerMessage(QLatin1String("SILENT ")
- + QString::number( enable ? 1 : 0 ) + QLatin1Char('\n'));
-}
-
-void QWSSoundClient::tryReadCommand()
-{
- while ( canReadLine() ) {
- QString l = QString::fromAscii(readLine());
- l.truncate(l.length()-1); // chomp
- QStringList token = l.split(QLatin1Char(' '));
- if (token[0] == QLatin1String("SOUNDCOMPLETED")) {
- emit soundCompleted(token[1].toInt());
- } else if (token[0] == QLatin1String("DEVICEREADY")) {
- emit deviceReady(token[1].toInt());
- } else if (token[0] == QLatin1String("DEVICEERROR")) {
- emit deviceError(token[1].toInt(),(DeviceErrors)token[2].toInt());
- }
- }
-}
-
-void QWSSoundClient::emitConnectionRefused()
-{
- emit error( QTcpSocket::ConnectionRefusedError );
-}
-#endif
-
-QT_END_NAMESPACE
-
-#include "qsoundqss_qws.moc"
-
-#endif // QT_NO_SOUND
diff --git a/src/gui/embedded/qsoundqss_qws.h b/src/gui/embedded/qsoundqss_qws.h
deleted file mode 100644
index c802a72384..0000000000
--- a/src/gui/embedded/qsoundqss_qws.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOUNDQSS_QWS_H
-#define QSOUNDQSS_QWS_H
-
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_SOUND
-
-#include <QtNetwork/qtcpserver.h>
-#include <QtNetwork/qtcpsocket.h>
-#include <QtGui/qwssocket_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if defined(QT_NO_NETWORK) || defined(QT_NO_DNS)
-#define QT_NO_QWS_SOUNDSERVER
-#endif
-
-#ifndef Q_OS_MAC
-
-class QWSSoundServerPrivate;
-
-class Q_GUI_EXPORT QWSSoundServer : public QObject {
- Q_OBJECT
-public:
- explicit QWSSoundServer(QObject *parent=0);
- ~QWSSoundServer();
- void playFile( int id, const QString& filename );
- void stopFile( int id );
- void pauseFile( int id );
- void resumeFile( int id );
-
-Q_SIGNALS:
- void soundCompleted( int );
-
-private Q_SLOTS:
- void translateSoundCompleted( int, int );
-
-private:
- QWSSoundServerPrivate* d;
-};
-
-#ifndef QT_NO_QWS_SOUNDSERVER
-class Q_GUI_EXPORT QWSSoundClient : public QWSSocket {
- Q_OBJECT
-public:
-
- enum SoundFlags {
- Priority = 0x01,
- Streaming = 0x02 // currently ignored, but but could set up so both Raw and non raw can be done streaming or not.
- };
- enum DeviceErrors {
- ErrOpeningAudioDevice = 0x01,
- ErrOpeningFile = 0x02,
- ErrReadingFile = 0x04
- };
- explicit QWSSoundClient(QObject* parent=0);
- ~QWSSoundClient( );
- void reconnect();
- void play( int id, const QString& filename );
- void play( int id, const QString& filename, int volume, int flags = 0 );
- void playRaw( int id, const QString&, int, int, int, int flags = 0 );
-
- void pause( int id );
- void stop( int id );
- void resume( int id );
- void setVolume( int id, int left, int right );
- void setMute( int id, bool m );
-
- // to be used by server only, to protect phone conversation/rings.
- void playPriorityOnly(bool);
-
- // If silent, tell sound server to release audio device
- // Otherwise, allow sound server to regain audio device
- void setSilent(bool);
-
-Q_SIGNALS:
- void soundCompleted(int);
- void deviceReady(int id);
- void deviceError(int id, QWSSoundClient::DeviceErrors);
-
-private Q_SLOTS:
- void tryReadCommand();
- void emitConnectionRefused();
-
-private:
- void sendServerMessage(QString msg);
-};
-
-class QWSSoundServerSocket : public QWSServerSocket {
- Q_OBJECT
-
-public:
- explicit QWSSoundServerSocket(QObject *parent=0);
-public Q_SLOTS:
- void newConnection();
-
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QWSSoundServerSocket(QObject *parent, const char *name);
-#endif
-
-Q_SIGNALS:
- void playFile(int, int, const QString&);
- void playFile(int, int, const QString&, int, int);
- void playRawFile(int, int, const QString&, int, int, int, int);
- void pauseFile(int, int);
- void stopFile(int, int);
- void resumeFile(int, int);
- void setVolume(int, int, int, int);
- void setMute(int, int, bool);
-
- void stopAll(int);
-
- void playPriorityOnly(bool);
-
- void setSilent(bool);
-
- void soundFileCompleted(int, int);
- void deviceReady(int, int);
- void deviceError(int, int, int);
-};
-#endif
-
-#endif // Q_OS_MAC
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_SOUND
-
-#endif // QSOUNDQSS_QWS_H
diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp
deleted file mode 100644
index 81e67a9e90..0000000000
--- a/src/gui/embedded/qtransportauth_qws.cpp
+++ /dev/null
@@ -1,1563 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtransportauth_qws.h"
-#include "qtransportauth_qws_p.h"
-
-#ifndef QT_NO_SXE
-
-#include "../../3rdparty/md5/md5.h"
-#include "../../3rdparty/md5/md5.cpp"
-#include "qwsutils_qws.h"
-#include "qwssocket_qws.h"
-#include "qwscommand_qws_p.h"
-#include "qwindowsystem_qws.h"
-#include "qbuffer.h"
-#include "qthread.h"
-#include "qabstractsocket.h"
-#include "qlibraryinfo.h"
-#include "qfile.h"
-#include "qdebug.h"
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <syslog.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-
-#include <QtCore/qcache.h>
-
-#define BUF_SIZE 512
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
- memset for security purposes, guaranteed not to be optimized away
- http://www.faqs.org/docs/Linux-HOWTO/Secure-Programs-HOWTO.html
-*/
-Q_GUI_EXPORT void *guaranteed_memset(void *v,int c,size_t n)
-{
- volatile char *p = (char *)v; while (n--) *p++=c; return v;
-}
-
-/*!
- \class QTransportAuth
- \internal
-
- \brief Authenticate a message transport.
-
- For performance reasons, message authentication is tied to an individual
- message transport instance. For example in connection oriented transports
- the authentication cookie can be cached against the connection avoiding
- the overhead of authentication on every message.
-
- For each process there is one instance of the QTransportAuth object.
- For server processes it can determine the \link secure-exe-environ.html SXE
- Program Identity \endlink and provide access to policy data to determine if
- the message should be forwarded for action. If not actioned, the message
- may be treated as being from a flawed or malicious process.
-
- Retrieve the instance with the getInstance() method. The constructor is
- disabled and instances of QTransportAuth should never be constructed by
- calling classes.
-
- To make the Authentication easier to use a proxied QIODevice is provided
- which uses an internal QBuffer.
-
- In the server code first get a pointer to a QTransportAuth::Data object
- using the connectTransport() method:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 0
-
- Here it is asserted that the transport is trusted. See the assumptions
- listed in the \link secure-exe-environ.html SXE documentation \endlink
-
- Then proxy in the authentication device:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 1
-
- In the client code it is similar. Use the connectTransport() method
- just the same then proxy in the authentication device instead of the
- socket in write calls:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 2
-*/
-
-static int hmac_md5(
- unsigned char* text, /* pointer to data stream */
- int text_length, /* length of data stream */
- const unsigned char* key, /* pointer to authentication key */
- int key_length, /* length of authentication key */
- unsigned char * digest /* caller digest to be filled in */
- );
-
-
-
-#define KEY_CACHE_SIZE 30
-
-const char * const errorStrings[] = {
- "pending identity verification",
- "message too small to carry auth data",
- "cache miss on connection oriented transport",
- "no magic bytes on message",
- "key not found for prog id",
- "authorization key match failed",
- "key out of date"
-};
-
-const char *QTransportAuth::errorString( const Data &d )
-{
- if (( d.status & ErrMask ) == Success )
- return "success";
- int e = d.status & ErrMask;
- if ( e > OutOfDate )
- return "unknown";
- return errorStrings[e];
-}
-
-SxeRegistryLocker::SxeRegistryLocker( QObject *reg )
- : m_success( false )
- , m_reg( 0 )
-{
- if ( reg )
- if ( !QMetaObject::invokeMethod( reg, "lockManifest", Q_RETURN_ARG(bool, m_success) ))
- m_success = false;
- m_reg = reg;
-}
-
-SxeRegistryLocker::~SxeRegistryLocker()
-{
- if ( m_success )
- QMetaObject::invokeMethod( m_reg, "unlockManifest" );
-}
-
-
-QTransportAuthPrivate::QTransportAuthPrivate()
- : keyInitialised(false)
- , m_packageRegistry( 0 )
-{
-}
-
-QTransportAuthPrivate::~QTransportAuthPrivate()
-{
-}
-
-/*!
- \internal
- Construct a new QTransportAuth
-*/
-QTransportAuth::QTransportAuth() : QObject(*new QTransportAuthPrivate)
-{
- // qDebug( "creating transport auth" );
-}
-
-/*!
- \internal
- Destructor
-*/
-QTransportAuth::~QTransportAuth()
-{
- // qDebug( "deleting transport auth" );
-}
-
-/*!
- Set the process key for this currently running Qt Extended process to
- the \a authdata. \a authdata should be sizeof(struct AuthCookie)
- in length and contain the key and program id. Use this method
- when setting or changing the SXE identity of the current program.
-*/
-void QTransportAuth::setProcessKey( const char *authdata )
-{
- Q_D(QTransportAuth);
- ::memcpy(&d->authKey, authdata, sizeof(struct AuthCookie));
- QFile proc_key( QLatin1String("/proc/self/lids_key") );
- // where proc key exists use that instead
- if ( proc_key.open( QIODevice::ReadOnly ))
- {
- qint64 kb = proc_key.read( (char*)&d->authKey.key, QSXE_KEY_LEN );
-#ifdef QTRANSPORTAUTH_DEBUG
- qDebug( "Using %li bytes of /proc/%i/lids_key\n", (long int)kb, getpid() );
-#else
- Q_UNUSED( kb );
-#endif
- }
- d->keyInitialised = true;
-}
-
-
-/*!
- Apply \a key as the process key for the currently running application.
-
- \a prog is current ignored
-
- Deprecated function
-*/
-void QTransportAuth::setProcessKey( const char *key, const char *prog )
-{
- Q_UNUSED(prog);
- setProcessKey( key );
-#ifdef QTRANSPORTAUTH_DEBUG
- char displaybuf[QSXE_KEY_LEN*2+1];
- hexstring( displaybuf, (const unsigned char *)key, QSXE_KEY_LEN );
- qDebug() << "key" << displaybuf << "set";
-#endif
-}
-
-/*!
- Register \a pr as a policy handler object. The object pointed to
- by \a pr should have a slot as follows
- \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 3
- All requests received by this server will then generate a call to
- this slot, and may be processed for policy compliance.
-*/
-void QTransportAuth::registerPolicyReceiver( QObject *pr )
-{
- // not every policy receiver needs setup - no error if this fails
- QMetaObject::invokeMethod( pr, "setupPolicyCheck" );
-
- connect( this, SIGNAL(policyCheck(QTransportAuth::Data&,QString)),
- pr, SLOT(policyCheck(QTransportAuth::Data&,QString)), Qt::DirectConnection );
-}
-
-/*!
- Unregister the \a pr from being a policy handler. No more policyCheck signals
- are received by this object.
-*/
-void QTransportAuth::unregisterPolicyReceiver( QObject *pr )
-{
- disconnect( pr );
- // not every policy receiver needs tear down - no error if this fails
- QMetaObject::invokeMethod( pr, "teardownPolicyCheck" );
-}
-
-/*!
- Record a new transport connection with \a properties and \a descriptor.
-
- The calling code is responsible for destroying the returned data when the
- tranport connection is closed.
-*/
-QTransportAuth::Data *QTransportAuth::connectTransport( unsigned char properties, int descriptor )
-{
- Data *data = new Data(properties, descriptor);
- data->status = Pending;
- return data;
-}
-
-/*!
- Is the transport trusted. This is true iff data written into the
- transport medium cannot be intercepted or modified by another process.
- This is for example true for Unix Domain Sockets, but not for shared
- memory or UDP sockets.
-
- There is of course an underlying assumption that the kernel implementing
- the transport is sound, ie it cannot be compromised by writing to
- /dev/kmem or loading untrusted modules
-*/
-inline bool QTransportAuth::Data::trusted() const
-{
- return (bool)(properties & Trusted);
-}
-
-/*!
- Assert that the transport is trusted.
-
- For example with respect to shared memory, if it is ensured that no untrusted
- root processes are running, and that unix permissions have been set such that
- any untrusted non-root processes do not have access rights, then a shared
- memory transport could be asserted to be trusted.
-
- \sa trusted()
-*/
-inline void QTransportAuth::Data::setTrusted( bool t )
-{
- properties = t ? properties | Trusted : properties & ~Trusted;
-}
-
-/*!
- Is the transport connection oriented. This is true iff once a connection
- has been accepted, and state established, then further messages over the
- transport are guaranteed to have come from the original connecting entity.
- This is for example true for Unix Domain Sockets, but not
- for shared memory or UDP sockets.
-
- By extension if the transport is not trusted() then it should not be
- assumed to be connection oriented, since spoofed connection information
- could be created. For example if we assume the TCP/IP transport is
- trusted, it can be treated as connection oriented; but this is only the
- case if intervening routers are trusted.
-
- Connection oriented transports have authorization cached against the
- connection, and thus authorization is only done at connect time.
-*/
-inline bool QTransportAuth::Data::connection() const
-{
- return (bool)(properties & Connection);
-}
-
-/*!
- Assert that the transport is connection oriented.
-
- \sa connection()
-*/
-inline void QTransportAuth::Data::setConnection( bool t )
-{
- properties = t ? properties | Connection : properties & ~Connection;
-}
-
-/*!
- Return a pointer to the instance of this process's QTransportAuth object
-*/
-QTransportAuth *QTransportAuth::getInstance()
-{
- static QTransportAuth theInstance;
-
- return &theInstance;
-}
-
-/*!
- Set the full path to the key file
-
- Since this is normally relative to Qtopia::qpeDir() this needs to be
- set within the Qt Extended framework.
-
- The keyfile should be protected by file permissions or by MAC rules
- such that it can only be read/written by the "qpe" server process
-*/
-void QTransportAuth::setKeyFilePath( const QString &path )
-{
- Q_D(QTransportAuth);
- d->m_keyFilePath = path;
-}
-
-QString QTransportAuth::keyFilePath() const
-{
- Q_D(const QTransportAuth);
- return d->m_keyFilePath;
-}
-
-void QTransportAuth::setLogFilePath( const QString &path )
-{
- Q_D(QTransportAuth);
- d->m_logFilePath = path;
-}
-
-QString QTransportAuth::logFilePath() const
-{
- Q_D(const QTransportAuth);
- return d->m_logFilePath;
-}
-
-void QTransportAuth::setPackageRegistry( QObject *registry )
-{
- Q_D(QTransportAuth);
- d->m_packageRegistry = registry;
-}
-
-bool QTransportAuth::isDiscoveryMode() const
-{
-#if defined(SXE_DISCOVERY)
- static bool checked = false;
- static bool yesItIs = false;
-
- if ( checked ) return yesItIs;
-
- yesItIs = ( getenv( "SXE_DISCOVERY_MODE" ) != 0 );
- if ( yesItIs )
- {
- qWarning("SXE Discovery mode on, ALLOWING ALL requests and logging to %s",
- qPrintable(logFilePath()));
- QFile::remove( logFilePath() );
- }
- checked = true;
- return yesItIs;
-#else
- return false;
-#endif
-}
-
-/*!
- \internal
- Return the authorizer device mapped to this client. Note that this
- could probably all be void* instead of QWSClient* for generality.
- Until the need for that rears its head its QWSClient* to save the casts.
-
- #### OK the need has arrived, but the public API is frozen.
-*/
-QIODevice *QTransportAuth::passThroughByClient( QWSClient *client ) const
-{
- Q_D(const QTransportAuth);
-
- if ( client == 0 ) return 0;
- if ( d->buffersByClient.contains( client ))
- {
- return d->buffersByClient[client];
- }
- // qWarning( "buffer not found for client %p", client );
- return 0;
-}
-
-/*!
- \internal
- Return a QIODevice pointer (to an internal QBuffer) which can be used
- to receive data after authorization on transport \a d.
-
- The return QIODevice will act as a pass-through.
-
- The data will be consumed from \a iod and forwarded on to the returned
- QIODevice which can be connected to readyRead() signal handlers in
- place of the original QIODevice \a iod.
-
- This will be called in the server process to handle incoming
- authenticated requests.
-
- The returned QIODevice will take ownership of \a data which will be deleted
- when the QIODevice is delected.
-
- \sa setTargetDevice()
-*/
-QAuthDevice *QTransportAuth::recvBuf( QTransportAuth::Data *data, QIODevice *iod )
-{
- return new QAuthDevice( iod, data, QAuthDevice::Receive );
-}
-
-/*!
- Return a QIODevice pointer (to an internal QBuffer) which can be used
- to write data onto, for authorization on transport \a d.
-
- The return QIODevice will act as a pass-through.
-
- The data written to the return QIODevice will be forwarded on to the
- returned QIODevice. In the case of a QTcpSocket, this will cause it
- to send out the data with the authentication information on it.
-
- This will be called in the client process to generate outgoing
- authenticated requests.
-
- The returned QIODevice will take ownership of \a data which will be deleted
- when the QIODevice is delected.
-
- \sa setTargetDevice()
-*/
-QAuthDevice *QTransportAuth::authBuf( QTransportAuth::Data *data, QIODevice *iod )
-{
- return new QAuthDevice( iod, data, QAuthDevice::Send );
-}
-
-const unsigned char *QTransportAuth::getClientKey( unsigned char progId )
-{
- Q_D(QTransportAuth);
- return d->getClientKey( progId );
-}
-
-void QTransportAuth::invalidateClientKeyCache()
-{
- Q_D(QTransportAuth);
- d->invalidateClientKeyCache();
-}
-
-QMutex *QTransportAuth::getKeyFileMutex()
-{
- Q_D(QTransportAuth);
- return &d->keyfileMutex;
-}
-
-/*
- \internal
- Respond to the destroyed(QObject*) signal of the QAuthDevice's
- client object and remove it from the buffersByClient lookup hash.
-*/
-void QTransportAuth::bufferDestroyed( QObject *cli )
-{
- Q_D(QTransportAuth);
- if ( cli == NULL ) return;
-
- if ( d->buffersByClient.contains( cli ))
- {
- d->buffersByClient.remove( cli );
- // qDebug( "@@@@@@@ client %p removed @@@@@@@@@", cli );
- }
- // qDebug( " client count %d", d->buffersByClient.count() );
-}
-
-bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &request )
-{
- bool isAuthorized = true;
-
- if ( !request.isEmpty() && request != QLatin1String("Unknown") )
- {
- d.status &= QTransportAuth::ErrMask; // clear the status
- emit policyCheck( d, request );
- isAuthorized = (( d.status & QTransportAuth::StatusMask ) == QTransportAuth::Allow );
- }
-#if defined(SXE_DISCOVERY)
- if (isDiscoveryMode()) {
-#ifndef QT_NO_TEXTSTREAM
- if (!logFilePath().isEmpty()) {
- QFile log( logFilePath() );
- if (!log.open(QIODevice::WriteOnly | QIODevice::Append)) {
- qWarning("Could not write to log in discovery mode: %s",
- qPrintable(logFilePath()));
- } else {
- QTextStream ts( &log );
- ts << d.progId << '\t' << ( isAuthorized ? "Allow" : "Deny" ) << '\t' << request << endl;
- }
- }
-#endif
- isAuthorized = true;
- }
-#endif
- if ( !isAuthorized )
- {
- qWarning( "%s - denied: for Program Id %u [PID %d]"
- , qPrintable(request), d.progId, d.processId );
-
- char linkTarget[BUF_SIZE]="";
- char exeLink[BUF_SIZE]="";
- char cmdlinePath[BUF_SIZE]="";
- char cmdline[BUF_SIZE]="";
-
- //get executable from /proc/pid/exe
- snprintf( exeLink, BUF_SIZE, "/proc/%d/exe", d.processId );
- if ( -1 == ::readlink( exeLink, linkTarget, BUF_SIZE - 1 ) )
- {
- qWarning( "SXE:- Error encountered in retrieving executable link target from /proc/%u/exe : %s",
- d.processId, strerror(errno) );
- snprintf( linkTarget, BUF_SIZE, "%s", linkTarget );
- }
-
- //get cmdline from proc/pid/cmdline
- snprintf( cmdlinePath, BUF_SIZE, "/proc/%d/cmdline", d.processId );
- int cmdlineFd = QT_OPEN( cmdlinePath, O_RDONLY );
- if ( cmdlineFd == -1 )
- {
- qWarning( "SXE:- Error encountered in opening /proc/%u/cmdline: %s",
- d.processId, strerror(errno) );
- snprintf( cmdline, BUF_SIZE, "%s", "Unknown" );
- }
- else
- {
- if ( -1 == QT_READ(cmdlineFd, cmdline, BUF_SIZE - 1 ) )
- {
- qWarning( "SXE:- Error encountered in reading /proc/%u/cmdline : %s",
- d.processId, strerror(errno) );
- snprintf( cmdline, BUF_SIZE, "%s", "Unknown" );
- }
- QT_CLOSE( cmdlineFd );
- }
-
- syslog( LOG_ERR | LOG_LOCAL6, "%s // PID:%u // ProgId:%u // Exe:%s // Request:%s // Cmdline:%s",
- "<SXE Breach>", d.processId, d.progId, linkTarget, qPrintable(request), cmdline);
- }
-
- return isAuthorized;
-}
-
-inline bool __fileOpen( QFile *f )
-{
-#ifdef QTRANSPORTAUTH_DEBUG
- if ( f->open( QIODevice::ReadOnly ))
- {
- qDebug( "Opened file: %s\n", qPrintable( f->fileName() ));
- return true;
- }
- else
- {
- qWarning( "Could not open file: %s\n", qPrintable( f->fileName() ));
- return false;
- }
-#else
- return ( f->open( QIODevice::ReadOnly ));
-#endif
-}
-
-/*!
- \internal
- Find client keys for the \a progId. If it is cached should be very
- fast, otherwise requires a read of the secret key file
-
- In the success case a pointer to the keys is returned. The pointer is
- to storage allocated for the internal cache and must be used asap.
-
- The list returned is a sequence of one or more keys which match the
- progId. There is no separator, each 16 byte sequence represents a key.
- The sequence is followed by two iterations of the SXE magic
- bytes,eg 0xBA, 0xD4, 0xD4, 0xBA, 0xBA, 0xD4, 0xD4, 0xBA
-
- NULL is returned in the following cases:
- \list
- \o the keyfiles could not be accessed - error condition
- \o there was no key for the supplied program id - key auth failed
- \endlist
-
- Note that for the keyfiles, there is multi-thread and multi-process
- concurrency issues: they can be read by the qpe process when
- QTransportAuth calls getClientKey to verify a request, and they can be
- read or written by the packagemanager when updating package data.
-
- To protect against this, the keyfileMutex & SxeRegistryLocker is used.
-
- The sxe_installer tool can also update inode and device numbers in
- the manifest file, but this only occurs outside of normal operation,
- so qpe and packagemanager are never running when this occurs.
-*/
-const unsigned char *QTransportAuthPrivate::getClientKey(unsigned char progId)
-{
- int manifestMatchCount = 0;
- struct IdBlock mr;
- int total_size = 0;
- char *result = 0;
- char *result_ptr;
- int keysFound = 0;
- bool foundKey;
- int keysRead = 0;
- struct usr_key_entry keys_list[128];
-
- if ( keyCache.contains( progId ))
- return (const unsigned char *)keyCache[progId];
-
- SxeRegistryLocker rlock( m_packageRegistry );
-
- // ### Qt 4.3: this is hacky - see documentation for setKeyFilePath
- QString manifestPath = m_keyFilePath + QLatin1String("/manifest");
- QString actualKeyPath = QLatin1String("/proc/lids/keys");
- bool noFailOnKeyMissing = true;
- if ( !QFile::exists( actualKeyPath )) {
- actualKeyPath = m_keyFilePath + QLatin1String( "/" QSXE_KEYFILE );
- }
- QFile kf( actualKeyPath );
- QFile mn( manifestPath );
- if ( !__fileOpen( &mn ))
- goto key_not_found;
- // first find how much storage is needed
- while ( mn.read( (char*)&mr, sizeof(struct IdBlock)) > 0 )
- if ( mr.progId == progId )
- manifestMatchCount++;
- if ( manifestMatchCount == 0 )
- goto key_not_found;
- if ( !__fileOpen( &kf ))
- {
- noFailOnKeyMissing = false;
- goto key_not_found;
- }
- total_size = 2 * QSXE_MAGIC_BYTES + manifestMatchCount * QSXE_KEY_LEN;
- result = (char*)malloc( total_size );
- Q_CHECK_PTR( result );
- mn.seek( 0 );
- result_ptr = result;
- /* reading whole key array in is much more efficient, 99% case is this loop only
- executes once, should not have more than 128 keyed items */
- while (( keysRead = kf.read( (char*)keys_list, sizeof(struct usr_key_entry)*128 )) > 0 )
- {
- /* qDebug("PID %d: getClientKey() - read %d bytes = %d keys from %s", getpid(), keysRead,
- keysRead/sizeof(struct usr_key_entry), qPrintable(actualKeyPath)); */
- keysRead /= sizeof(struct usr_key_entry);
- while ( mn.read( (char*)&mr, sizeof(struct IdBlock)) > 0 )
- {
- if ( mr.progId == progId )
- {
- foundKey = false;
- for ( int i = 0; i < keysRead; ++i )
- {
- /* if ( i == 0 )
- qDebug() << " pid" << getpid() << "looking for device" << (dev_t)mr.device << "inode" << (ino_t)mr.inode;
- qDebug() << " pid" << getpid() << "trying device" << keys_list[i].dev << "inode" << keys_list[i].ino; */
- if ( keys_list[i].ino == (ino_t)mr.inode && keys_list[i].dev == (dev_t)mr.device )
- {
- memcpy( result_ptr, keys_list[i].key, QSXE_KEY_LEN );
- result_ptr += QSXE_KEY_LEN;
- foundKey = true;
- break;
- }
- }
- if ( foundKey )
- {
- keysFound++;
- if ( keysFound == manifestMatchCount )
- break;
- }
- }
- }
- }
- if ( result_ptr == result ) // nothing found!
- goto key_not_found;
- // 2 x magic bytes sentinel at end of sequence
- for ( int i = 0; i < 2; ++i )
- for ( int j = 0; j < QSXE_MAGIC_BYTES; ++j )
- *result_ptr++ = magic[j];
- keyCache.insert( progId, result, total_size / 10 );
- /* qDebug( "PID %d : Found %d client keys for prog %u", getpid(), keysFound, progId ); */
- goto success_out;
-
-key_not_found:
- if ( noFailOnKeyMissing ) // return an "empty" set of keys in this case
- {
- if ( result == 0 )
- {
- result = (char*)malloc( 2 * QSXE_MAGIC_BYTES );
- Q_CHECK_PTR( result );
- }
- result_ptr = result;
- for ( int i = 0; i < 2; ++i )
- for ( int j = 0; j < QSXE_MAGIC_BYTES; ++j )
- *result_ptr++ = magic[j];
- return (unsigned char *)result;
- }
- qWarning( "PID %d : Not found client key for prog %u", getpid(), progId );
- if ( result )
- {
- free( result );
- result = 0;
- }
-success_out:
- if ( mn.isOpen() )
- mn.close();
- if ( kf.isOpen() )
- kf.close();
- return (unsigned char *)result;
-}
-
-void QTransportAuthPrivate::invalidateClientKeyCache()
-{
- keyfileMutex.lock();
- keyCache.clear();
- keyfileMutex.unlock();
-}
-
-////////////////////////////////////////////////////////////////////////
-////
-//// RequestAnalyzer definition
-////
-
-
-RequestAnalyzer::RequestAnalyzer()
- : moreData( false )
- , dataSize( 0 )
-{
-}
-
-RequestAnalyzer::~RequestAnalyzer()
-{
-}
-
-/*!
- Analzye the data in the\a msgQueue according to some protocol
- and produce a request string for policy analysis.
-
- If enough data is in the queue for analysis of a complete message,
- return a non-null string, and set a flag so requireMoreData() will
- return false; otherwise return a null string and requireMoreData()
- return true.
-
- The amount of bytes analyzed is then available via bytesAnalyzed().
-
- A null string is also returned in the case where the message was
- corrupt and could not be analyzed. In this case requireMoreData()
- returns false.
-
-Note: this method will modify the msgQueue and pull off the data
- deemed to be corrupt, in the case of corrupt data.
-
- In all other cases the msgQueue is left alone. The calling code
- should then pull off the analyzed data. Use bytesAnalzyed() to
- find how much data to pull off the queue.
-*/
-QString RequestAnalyzer::analyze( QByteArray *msgQueue )
-{
-#ifdef Q_WS_QWS
- dataSize = 0;
- moreData = false;
- QBuffer cmdBuf( msgQueue );
- cmdBuf.open( QIODevice::ReadOnly | QIODevice::Unbuffered );
- QWSCommand::Type command_type = (QWSCommand::Type)(qws_read_uint( &cmdBuf ));
- QWSCommand *command = QWSCommand::factory(command_type);
- // if NULL, factory will have already printed warning for bogus
- // command_type just purge the bad stuff and attempt to recover
- if ( command == NULL )
- {
- *msgQueue = msgQueue->mid( sizeof(int) );
- return QString();
- }
- QString request = QLatin1String(qws_getCommandTypeString(command_type));
-#ifndef QT_NO_COP
- if ( !command->read( &cmdBuf ))
- {
- // not all command arrived yet - come back later
- delete command;
- moreData = true;
- return QString();
- }
- if ( command_type == QWSCommand::QCopSend )
- {
- QWSQCopSendCommand *sendCommand = static_cast<QWSQCopSendCommand*>(command);
- request += QString::fromLatin1("/QCop/%1/%2").arg( sendCommand->channel ).arg( sendCommand->message );
- }
- if ( command_type == QWSCommand::QCopRegisterChannel )
- {
- QWSQCopRegisterChannelCommand *registerCommand = static_cast<QWSQCopRegisterChannelCommand*>(command);
- request += QString::fromLatin1("/QCop/RegisterChannel/%1").arg( registerCommand->channel );
- }
-#endif
- dataSize = QWS_PROTOCOL_ITEM_SIZE( *command );
- delete command;
- return request;
-#else
- Q_UNUSED(msgQueue);
- return QString();
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////
-////
-//// AuthDevice definition
-////
-
-/*!
- Constructs a new auth device for the transport \a data and I/O device \a parent.
-
- Incoming or outgoing data will be authenticated according to the auth direction \a dir.
-
- The auth device will take ownership of the transport \a data and delete it when the device
- is destroyed.
-*/
-QAuthDevice::QAuthDevice( QIODevice *parent, QTransportAuth::Data *data, AuthDirection dir )
- : QIODevice( parent )
- , d( data )
- , way( dir )
- , m_target( parent )
- , m_client( 0 )
- , m_bytesAvailable( 0 )
- , m_skipWritten( 0 )
- , analyzer( 0 )
-{
- if ( dir == Receive ) // server side
- {
- connect( m_target, SIGNAL(readyRead()),
- this, SLOT(recvReadyRead()));
- } else {
- connect( m_target, SIGNAL(readyRead()),
- this, SIGNAL(readyRead()));
- }
- connect( m_target, SIGNAL(bytesWritten(qint64)),
- this, SLOT(targetBytesWritten(qint64)) );
- open( QIODevice::ReadWrite | QIODevice::Unbuffered );
-}
-
-QAuthDevice::~QAuthDevice()
-{
- if ( analyzer )
- delete analyzer;
- delete d;
-}
-
-/*!
- \internal
- Store a pointer to the related device or instance which this
- authorizer is proxying for
-*/
-void QAuthDevice::setClient( QObject *cli )
-{
- m_client = cli;
- QTransportAuth::getInstance()->d_func()->buffersByClient[cli] = this;
- QObject::connect( cli, SIGNAL(destroyed(QObject*)),
- QTransportAuth::getInstance(), SLOT(bufferDestroyed(QObject*)) );
- // qDebug( "@@@@@@@@@@@@ client set %p @@@@@@@@@", cli );
- // qDebug( " client count %d", QTransportAuth::getInstance()->d_func()->buffersByClient.count() );
-}
-
-QObject *QAuthDevice::client() const
-{
- return m_client;
-}
-
-/*
- \fn void QAuthDevice::authViolation(QTransportAuth::Data &)
-
- This signal is emitted if an authorization failure is generated, as
- described in checkAuth();
-
- \sa checkAuth()
-*/
-
-
-/*
- \fn void QAuthDevice::policyCheck(QTransportAuth::Data &transport, const QString &request )
-
- This signal is emitted when a transport successfully delivers a request
- and gives the opportunity to either deny or accept the request.
-
- This signal must be connected in the same thread, ie it cannot be queued.
-
- As soon as all handlers connected to this signal are processed the Allow or
- Deny state on the \a transport is checked, and the request is allowed or denied
- accordingly.
-
- \sa checkAuth()
-*/
-
-/*!
- \internal
- Reimplement QIODevice writeData method.
-
- For client end, when the device is written to the incoming data is
- processed and an authentication header calculated. This is pushed
- into the target device, followed by the actual incoming data (the
- payload).
-
- For server end, it is a fatal error to write to the device.
-*/
-qint64 QAuthDevice::writeData(const char *data, qint64 len)
-{
- if ( way == Receive ) // server
- return m_target->write( data, len );
- // client
-#ifdef QTRANSPORTAUTH_DEBUG
- char displaybuf[1024];
-#endif
- char header[QSXE_HEADER_LEN];
- ::memset( header, 0, QSXE_HEADER_LEN );
- qint64 bytes = 0;
- if ( QTransportAuth::getInstance()->authToMessage( *d, header, data, len ))
- {
- m_target->write( header, QSXE_HEADER_LEN );
-#ifdef QTRANSPORTAUTH_DEBUG
- hexstring( displaybuf, (const unsigned char *)header, QSXE_HEADER_LEN );
- qDebug( "%d QAuthDevice::writeData - CLIENT: Header written: %s", getpid(), displaybuf );
-#endif
- m_skipWritten += QSXE_HEADER_LEN;
- }
- m_target->write( data, len );
- bytes += len;
-#ifdef QTRANSPORTAUTH_DEBUG
- int bytesToDisplay = bytes;
- const unsigned char *dataptr = (const unsigned char *)data;
- while ( bytesToDisplay > 0 )
- {
- int amt = bytes < 500 ? bytes : 500;
- hexstring( displaybuf, dataptr, amt );
- qDebug( "%d QAuthDevice::writeData - CLIENT: %s", getpid(), bytes > 0 ? displaybuf : "(null)" );
- dataptr += 500;
- bytesToDisplay -= 500;
- }
-#endif
- if ( m_target->inherits( "QAbstractSocket" ))
- static_cast<QAbstractSocket*>(m_target)->flush();
- return bytes;
-}
-
-/*!
- Reimplement from QIODevice
-
- Read data out of the internal message queue, reduce the queue by the amount
- read. Note that the amount available is only ever the size of a command
- (although a command can be very big) since we need to check at command
- boundaries for new authentication headers.
-*/
-qint64 QAuthDevice::readData( char *data, qint64 maxSize )
-{
- if ( way == Send ) // client
- return m_target->read( data, maxSize );
- if ( msgQueue.size() == 0 )
- return 0;
-#ifdef QTRANSPORTAUTH_DEBUG
- char displaybuf[1024];
- hexstring( displaybuf, reinterpret_cast<const unsigned char *>(msgQueue.constData()),
- msgQueue.size() > 500 ? 500 : msgQueue.size() );
- qDebug() << getpid() << "QAuthDevice::readData() buffered/requested/avail"
- << msgQueue.size() << maxSize << m_bytesAvailable << displaybuf;
-#endif
- Q_ASSERT( m_bytesAvailable <= msgQueue.size() );
- qint64 bytes = ( maxSize > m_bytesAvailable ) ? m_bytesAvailable : maxSize;
- ::memcpy( data, msgQueue.constData(), bytes );
- msgQueue = msgQueue.mid( bytes );
- m_bytesAvailable -= bytes;
- return bytes;
-}
-
-/*!
- \internal
- Receive readyRead signal from the target recv device. In response
- authorize the data, and write results out to the recvBuf() device
- for processing by the application. Trigger the readyRead signal.
-
- Authorizing involves first checking the transport is valid, ie the
- handshake has either already been done and is cached on a trusted
- transport, or was valid with this message; then second passing the
- string representation of the service request up to any policyReceivers
-
- If either of these fail, the message is denied. In discovery mode
- denied messages are allowed, but the message is logged.
-*/
-void QAuthDevice::recvReadyRead()
-{
- qint64 bytes = m_target->bytesAvailable();
- if ( bytes <= 0 ) return;
- open( QIODevice::ReadWrite | QIODevice::Unbuffered );
- QUnixSocket *usock = static_cast<QUnixSocket*>(m_target);
- QUnixSocketMessage msg = usock->read();
- msgQueue.append( msg.bytes() );
- d->processId = msg.processId();
- // if "fragmented" packet 1/2 way through start of a command, ie
- // in the QWS msg type, cant do anything, come back later when
- // there's more of the packet
- if ( msgQueue.size() < (int)sizeof(int) )
- {
- // qDebug() << "returning: msg size too small" << msgQueue.size();
- return;
- }
-#ifdef QTRANSPORTAUTH_DEBUG
- char displaybuf[1024];
- hexstring( displaybuf, reinterpret_cast<const unsigned char *>(msgQueue.constData()),
- msgQueue.size() > 500 ? 500 : msgQueue.size() );
- qDebug( "%d ***** SERVER read %lli bytes - msg %s", getpid(), bytes, displaybuf );
-#endif
-
- bool bufHasMessages = msgQueue.size() >= (int)sizeof(int);
- while ( bufHasMessages )
- {
- unsigned char saveStatus = d->status;
- if (( d->status & QTransportAuth::ErrMask ) == QTransportAuth::NoSuchKey )
- {
- QTransportAuth::getInstance()->authorizeRequest( *d, QLatin1String("NoSuchKey") );
- break;
- }
- if ( !QTransportAuth::getInstance()->authFromMessage( *d, msgQueue, msgQueue.size() ))
- {
- // not all arrived yet? come back later
- if (( d->status & QTransportAuth::ErrMask ) == QTransportAuth::TooSmall )
- {
- d->status = saveStatus;
- return;
- }
- }
- if (( d->status & QTransportAuth::ErrMask ) == QTransportAuth::NoMagic )
- {
- // no msg auth header, don't change the success status for connections
- if ( d->connection() )
- d->status = saveStatus;
- }
- else
- {
- // msg auth header detected and auth determined, remove hdr
- msgQueue = msgQueue.mid( QSXE_HEADER_LEN );
- }
- if ( !authorizeMessage() )
- break;
- bufHasMessages = msgQueue.size() >= (int)sizeof(int);
- }
-}
-
-/**
- \internal
- Handle bytesWritten signals from the underlying target device.
- We adjust the target's value for bytes that are part of auth packets.
-*/
-void QAuthDevice::targetBytesWritten( qint64 bytes )
-{
- if ( m_skipWritten >= bytes ) {
- m_skipWritten -= bytes;
- bytes = 0;
- } else if ( m_skipWritten > 0 ) {
- bytes -= m_skipWritten;
- m_skipWritten = 0;
- }
- if ( bytes > 0 ) {
- emit bytesWritten( bytes );
- }
-}
-
-/**
- \internal
- Pre-process the message to determine what QWS command it is. This
- information is used as the "request" for the purposes of authorization.
-
- The request and other data on the connection (id, PID, etc.) are forwarded
- to all policy listeners by emitting a signal.
-
- The signal must be processed synchronously because on return the allow/deny
- status is used immediately to either drop or continue processing the message.
-*/
-bool QAuthDevice::authorizeMessage()
-{
- if ( analyzer == NULL )
- analyzer = new RequestAnalyzer();
- QString request = (*analyzer)( &msgQueue );
- if ( analyzer->requireMoreData() )
- return false;
- bool isAuthorized = true;
-
- if ( !request.isEmpty() && request != QLatin1String("Unknown") )
- {
- isAuthorized = QTransportAuth::getInstance()->authorizeRequest( *d, request );
- }
-
- bool moreToProcess = ( msgQueue.size() - analyzer->bytesAnalyzed() ) > (int)sizeof(int);
- if ( isAuthorized )
- {
-#ifdef QTRANSPORTAUTH_DEBUG
- qDebug() << getpid() << "SERVER authorized: releasing" << analyzer->bytesAnalyzed() << "byte command" << request;
-#endif
- m_bytesAvailable = analyzer->bytesAnalyzed();
- emit QIODevice::readyRead();
- return moreToProcess;
- }
- else
- {
- msgQueue = msgQueue.mid( analyzer->bytesAnalyzed() );
- }
-
- return true;
-}
-
-void QAuthDevice::setRequestAnalyzer( RequestAnalyzer *ra )
-{
- Q_ASSERT( ra );
- if ( analyzer )
- delete analyzer;
- analyzer = ra;
-}
-
-/*!
- \internal
- Add authentication header to the beginning of a message
-
- Note that the per-process auth cookie is used. This key should be rewritten in
- the binary image of the executable at install time to make it unique.
-
- For this to be secure some mechanism (eg MAC kernel or other
- permissions) must prevent other processes from reading the key.
-
- The buffer must have AUTH_SPACE(0) bytes spare at the beginning for the
- authentication header to be added.
-
- Returns true if header successfully added. Will fail if the
- per-process key has not yet been set with setProcessKey()
-*/
-bool QTransportAuth::authToMessage( QTransportAuth::Data &d, char *hdr, const char *msg, int msgLen )
-{
- // qDebug( "authToMessage(): prog id %u", d.progId );
- // only authorize connection oriented transports once, unless key has changed
- if ( d.connection() && ((d.status & QTransportAuth::ErrMask) != QTransportAuth::Pending) &&
- d_func()->authKey.progId == d.progId )
- return false;
- d.progId = d_func()->authKey.progId;
- // If Unix socket credentials are being used the key wont be set
- if ( !d_func()->keyInitialised )
- return false;
- unsigned char digest[QSXE_KEY_LEN];
- char *msgPtr = hdr;
- // magic always goes on the beginning
- for ( int m = 0; m < QSXE_MAGIC_BYTES; ++m )
- *msgPtr++ = magic[m];
- hdr[ QSXE_LEN_IDX ] = (unsigned char)msgLen;
- if ( !d.trusted())
- {
- // Use HMAC
- int rc = hmac_md5( (unsigned char *)msg, msgLen, d_func()->authKey.key, QSXE_KEY_LEN, digest );
- if ( rc == -1 )
- return false;
- memcpy( hdr + QSXE_KEY_IDX, digest, QSXE_KEY_LEN );
- }
- else
- {
- memcpy( hdr + QSXE_KEY_IDX, d_func()->authKey.key, QSXE_KEY_LEN );
- }
-
- hdr[ QSXE_PROG_IDX ] = d_func()->authKey.progId;
-
-#ifdef QTRANSPORTAUTH_DEBUG
- char keydisplay[QSXE_KEY_LEN*2+1];
- hexstring( keydisplay, d_func()->authKey.key, QSXE_KEY_LEN );
-
- qDebug( "%d CLIENT Auth to message %s against prog id %u and key %s\n",
- getpid(), msg, d_func()->authKey.progId, keydisplay );
-#endif
-
- // TODO implement sequence to prevent replay attack, not required
- // for trusted transports
- hdr[ QSXE_SEQ_IDX ] = 1; // dummy sequence
-
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::Success;
- return true;
-}
-
-
-/*!
- Check authorization on the \a msg, which must be of size \a msgLen,
- for the transport \a d.
-
- If able to determine authorization, return the program identity of
- the message source in the reference \a progId, and return true.
-
- Otherwise return false.
-
- If data is being received on a socket, it may be that more data is yet
- needed before authentication can proceed.
-
- Also the message may not be an authenticated at all.
-
- In these cases the method returns false to indicate authorization could
- not be determined:
- \list
- \i The message is too small to carry the authentication data
- (status TooSmall is set on the \a d transport )
- \i The 4 magic bytes are missing from the message start
- (status NoMagic is set on the \a d transport )
- \i The message is too small to carry the auth + claimed payload
- (status TooSmall is set on the \a d transport )
- \endlist
-
- If however the authentication header (preceded by the magic bytes) and
- any authenticated payload is received the method will determine the
- authentication status, and return true.
-
- In the following cases as well as returning true it will also emit
- an authViolation():
- \list
- \i If the program id claimed by the message is not found in the key file
- (status NoSuchKey is set on the \a d transport )
- \i The authentication token failed against the claimed program id:
- \list
- \i in the case of trusted transports, the secret did not match
- \i in the case of untrusted transports the HMAC code did not match
- \endlist
- (status FailMatch is set on the \a d transport )
- \endlist
-
- In these cases the authViolation( QTransportAuth::Data d ) signal is emitted
- and the error string can be obtained from the status like this:
- \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 4
-*/
-bool QTransportAuth::authFromMessage( QTransportAuth::Data &d, const char *msg, int msgLen )
-{
- if ( msgLen < QSXE_MAGIC_BYTES )
- {
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::TooSmall;
- return false;
- }
- // if no magic bytes, exit straight away
- int m;
- const unsigned char *mptr = reinterpret_cast<const unsigned char *>(msg);
- for ( m = 0; m < QSXE_MAGIC_BYTES; ++m )
- {
- if ( *mptr++ != magic[m] )
- {
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::NoMagic;
- return false;
- }
- }
-
- if ( msgLen < AUTH_SPACE(1) )
- {
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::TooSmall;
- return false;
- }
-
- // At this point we know the header is at least long enough to contain valid auth
- // data, however the data may be spoofed. If it is not verified then the status will
- // be set to uncertified so the spoofed data will not be relied on. However we want to
- // know the program id which is being reported (even if it might be spoofed) for
- // policy debugging purposes. So set it here, rather than after verification.
- d.progId = msg[QSXE_PROG_IDX];
-
-#ifdef QTRANSPORTAUTH_DEBUG
- char authhdr[QSXE_HEADER_LEN*2+1];
- hexstring( authhdr, reinterpret_cast<const unsigned char *>(msg), QSXE_HEADER_LEN );
- qDebug( "%d SERVER authFromMessage(): message header is %s",
- getpid(), authhdr );
-#endif
-
- unsigned char authLen = (unsigned char)(msg[ QSXE_LEN_IDX ]);
-
- if ( msgLen < AUTH_SPACE(authLen) )
- {
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::TooSmall;
- return false;
- }
-
- bool isCached = d_func()->keyCache.contains( d.progId );
- const unsigned char *clientKey = d_func()->getClientKey( d.progId );
- if ( clientKey == NULL )
- {
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::NoSuchKey;
- return false;
- }
-
-#ifdef QTRANSPORTAUTH_DEBUG
- char keydisplay[QSXE_KEY_LEN*2+1];
- hexstring( keydisplay, clientKey, QSXE_KEY_LEN );
- qDebug( "\t\tauthFromMessage(): message %s against prog id %u and key %s\n",
- AUTH_DATA(msg), ((unsigned int)d.progId), keydisplay );
-#endif
-
- const unsigned char *auth_tok;
- unsigned char digest[QSXE_KEY_LEN];
- bool multi_tok = false;
-
- bool need_to_recheck=false;
- do
- {
- if ( !d.trusted())
- {
- hmac_md5( AUTH_DATA(msg), authLen, clientKey, QSXE_KEY_LEN, digest );
- auth_tok = digest;
- }
- else
- {
- auth_tok = clientKey;
- multi_tok = true; // 1 or more keys are in the clientKey
- }
- while( true )
- {
- if ( memcmp( auth_tok, magic, QSXE_MAGIC_BYTES ) == 0
- && memcmp( auth_tok + QSXE_MAGIC_BYTES, magic, QSXE_MAGIC_BYTES ) == 0 )
- break;
- if ( memcmp( msg + QSXE_KEY_IDX, auth_tok, QSXE_KEY_LEN ) == 0 )
- {
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::Success;
- return true;
- }
- if ( !multi_tok )
- break;
- auth_tok += QSXE_KEY_LEN;
- }
- //the keys cached on d.progId may not contain the binary key because the cache entry was made
- //before the binary had first started, must search for client key again.
- if ( isCached )
- {
- d_func()->keyCache.remove(d.progId);
- isCached = false;
-
-#ifdef QTRANSPORTAUTH_DEBUG
- qDebug() << "QTransportAuth::authFromMessage(): key not found in set of keys cached"
- << "against prog Id =" << d.progId << ". Re-obtaining client key. ";
-#endif
- clientKey = d_func()->getClientKey( d.progId );
- if ( clientKey == NULL )
- {
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::NoSuchKey;
- return false;
- }
- need_to_recheck = true;
- }
- else
- {
- need_to_recheck = false;
- }
- } while( need_to_recheck );
-
- d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::FailMatch;
- qWarning() << "QTransportAuth::authFromMessage():failed authentication";
- FAREnforcer::getInstance()->logAuthAttempt( QDateTime::currentDateTime() );
- emit authViolation( d );
- return false;
-}
-
-
-#ifdef QTRANSPORTAUTH_DEBUG
-/*!
- sprintf into hex - dest \a buf, src \a key, \a key_len is length of key.
-
- The target buf should be [ key_len * 2 + 1 ] in size
-*/
-void hexstring( char *buf, const unsigned char* key, size_t key_len )
-{
- unsigned int i, p;
- for ( i = 0, p = 0; i < key_len; i++, p+=2 )
- {
- unsigned char lo_nibble = key[i] & 0x0f;
- unsigned char hi_nibble = key[i] >> 4;
- buf[p] = (int)hi_nibble > 9 ? hi_nibble-10 + 'A' : hi_nibble + '0';
- buf[p+1] = (int)lo_nibble > 9 ? lo_nibble-10 + 'A' : lo_nibble + '0';
- }
- buf[p] = '\0';
-}
-#endif
-
-/*
- HMAC MD5 as listed in RFC 2104
-
- This code is taken from:
-
- http://www.faqs.org/rfcs/rfc2104.html
-
- with the allowance for keys other than length 16 removed, but otherwise
- a straight cut-and-paste.
-
- The HMAC_MD5 transform looks like:
-
- \snippet doc/src/snippets/code/src.gui.embedded.qtransportauth_qws.cpp 5
-
- \list
- \i where K is an n byte key
- \i ipad is the byte 0x36 repeated 64 times
- \i opad is the byte 0x5c repeated 64 times
- \i and text is the data being protected
- \endlist
-
- Hardware is available with accelerated implementations of HMAC-MD5 and
- HMAC-SHA1. Where this hardware is available, this routine should be
- replaced with a call into the accelerated version.
-*/
-
-static int hmac_md5(
- unsigned char* text, /* pointer to data stream */
- int text_length, /* length of data stream */
- const unsigned char* key, /* pointer to authentication key */
- int key_length, /* length of authentication key */
- unsigned char * digest /* caller digest to be filled in */
- )
-{
- MD5Context context;
- unsigned char k_ipad[65]; /* inner padding - * key XORd with ipad */
- unsigned char k_opad[65]; /* outer padding - * key XORd with opad */
- int i;
-
- /* in this implementation key_length == 16 */
- if ( key_length != 16 )
- {
- fprintf( stderr, "Key length was %d - must be 16 bytes", key_length );
- return 0;
- }
-
- /* start out by storing key in pads */
- memset( k_ipad, 0, sizeof k_ipad );
- memset( k_opad, 0, sizeof k_opad );
- memcpy( k_ipad, key, key_length );
- memcpy( k_opad, key, key_length );
-
- /* XOR key with ipad and opad values */
- for (i=0; i<64; i++) {
- k_ipad[i] ^= 0x36;
- k_opad[i] ^= 0x5c;
- }
-
- /* perform inner MD5 */
- MD5Init(&context); /* init context for 1st pass */
- MD5Update(&context, k_ipad, 64); /* start with inner pad */
- MD5Update(&context, text, text_length); /* then text of datagram */
- MD5Final(&context, digest); /* finish up 1st pass */
-
- /* perform outer MD5 */
- MD5Init(&context); /* init context for 2nd pass */
- MD5Update(&context, k_opad, 64); /* start with outer pad */
- MD5Update(&context, digest, 16); /* then results of 1st * hash */
- MD5Final(&context, digest); /* finish up 2nd pass */
- return 1;
-}
-
-
-const int FAREnforcer::minutelyRate = 4; //allowed number of false authentication attempts per minute
-const QString FAREnforcer::FARMessage = QLatin1String("FAR_Exceeded");
-const QString FAREnforcer::SxeTag = QLatin1String("<SXE Breach>");
-const int FAREnforcer::minute = 60;
-
-FAREnforcer::FAREnforcer():authAttempts()
-{
- QDateTime nullDateTime = QDateTime();
- for (int i = 0; i < minutelyRate; i++ )
- authAttempts << nullDateTime;
-}
-
-
-FAREnforcer *FAREnforcer::getInstance()
-{
- static FAREnforcer theInstance;
- return &theInstance;
-}
-
-void FAREnforcer::logAuthAttempt( QDateTime time )
-{
- QDateTime dt = authAttempts.takeFirst();
-
- authAttempts.append( time );
- if ( dt.secsTo( authAttempts.last() ) <= minute )
- {
-#if defined(SXE_DISCOVERY)
- if ( QTransportAuth::getInstance()->isDiscoveryMode() ) {
- static QBasicAtomicInt reported = Q_BASIC_ATOMIC_INITIALIZER(0);
- if ( reported.testAndSetRelaxed(0,1) ) {
-#ifndef QT_NO_TEXTSTREAM
- QString logFilePath = QTransportAuth::getInstance()->logFilePath();
- if ( !logFilePath.isEmpty() ) {
- QFile log( logFilePath );
- if ( !log.open(QIODevice::WriteOnly | QIODevice::Append) ) {
- qWarning("Could not write to log in discovery mode: %s",
- qPrintable(logFilePath) );
- } else {
- QTextStream ts( &log );
- ts << "\t\tWarning: False Authentication Rate of " << minutelyRate << "\n"
- << "\t\tserver connections/authentications per minute has been exceeded,\n"
- << "\t\tno further warnings will be issued\n";
- }
- }
- }
-#endif
- reset();
- return;
- }
-#endif
- syslog( LOG_ERR | LOG_LOCAL6, "%s %s",
- qPrintable( FAREnforcer::SxeTag ),
- qPrintable( FAREnforcer::FARMessage ) );
- reset();
- }
-}
-
-void FAREnforcer::reset()
-{
- QDateTime nullDateTime = QDateTime();
- for (int i = 0; i < minutelyRate; i++ )
- authAttempts[i] = nullDateTime;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qtransportauth_qws_p.cpp"
-
-#endif // QT_NO_SXE
diff --git a/src/gui/embedded/qtransportauth_qws.h b/src/gui/embedded/qtransportauth_qws.h
deleted file mode 100644
index cd89e0f3aa..0000000000
--- a/src/gui/embedded/qtransportauth_qws.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTRANSPORTAUTH_QWS_H
-#define QTRANSPORTAUTH_QWS_H
-
-#include <QtCore/qglobal.h>
-
-#if !defined(QT_NO_SXE) || defined(SXE_INSTALLER)
-
-#include <QtCore/qobject.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qbuffer.h>
-#include <QtCore/qpointer.h>
-
-#include <sys/types.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QAuthDevice;
-class QWSClient;
-class QIODevice;
-class QTransportAuthPrivate;
-class QMutex;
-
-class Q_GUI_EXPORT QTransportAuth : public QObject
-{
- Q_OBJECT
-public:
- static QTransportAuth *getInstance();
-
- enum Result {
- // Error codes
- Pending = 0x00,
- TooSmall = 0x01,
- CacheMiss = 0x02,
- NoMagic = 0x03,
- NoSuchKey = 0x04,
- FailMatch = 0x05,
- OutOfDate = 0x06,
- // reserved for expansion
- Success = 0x1e,
- ErrMask = 0x1f,
-
- // Verification codes
- Allow = 0x20,
- Deny = 0x40,
- Ask = 0x60,
- // reserved
- StatusMask = 0xe0
- };
-
- enum Properties {
- Trusted = 0x01,
- Connection = 0x02,
- UnixStreamSock = 0x04,
- SharedMemory = 0x08,
- MessageQueue = 0x10,
- UDP = 0x20,
- TCP = 0x40,
- UserDefined = 0x80,
- TransportType = 0xfc
- };
-
- struct Data
- {
- Data() { processId = -1; }
- Data( unsigned char p, int d )
- : properties( p )
- , descriptor( d )
- , processId( -1 )
- {
- if (( properties & TransportType ) == TCP ||
- ( properties & TransportType ) == UnixStreamSock )
- properties |= Connection;
- }
-
- unsigned char properties;
- unsigned char progId;
- unsigned char status;
- unsigned int descriptor; // socket fd or shmget key
- pid_t processId;
-
- bool trusted() const;
- void setTrusted( bool );
- bool connection() const;
- void setConnection( bool );
- };
-
- static const char *errorString( const QTransportAuth::Data & );
-
- QTransportAuth::Data *connectTransport( unsigned char, int );
-
- QAuthDevice *authBuf( QTransportAuth::Data *, QIODevice * );
- QAuthDevice *recvBuf( QTransportAuth::Data *, QIODevice * );
- QIODevice *passThroughByClient( QWSClient * ) const;
-
- void setKeyFilePath( const QString & );
- QString keyFilePath() const;
- const unsigned char *getClientKey( unsigned char progId );
- void invalidateClientKeyCache();
- QMutex *getKeyFileMutex();
- void setLogFilePath( const QString & );
- QString logFilePath() const;
- void setPackageRegistry( QObject *registry );
- bool isDiscoveryMode() const;
- void setProcessKey( const char * );
- void setProcessKey( const char *, const char * );
- void registerPolicyReceiver( QObject * );
- void unregisterPolicyReceiver( QObject * );
-
- bool authToMessage( QTransportAuth::Data &d, char *hdr, const char *msg, int msgLen );
- bool authFromMessage( QTransportAuth::Data &d, const char *msg, int msgLen );
-
- bool authorizeRequest( QTransportAuth::Data &d, const QString &request );
-
-Q_SIGNALS:
- void policyCheck( QTransportAuth::Data &, const QString & );
- void authViolation( QTransportAuth::Data & );
-private Q_SLOTS:
- void bufferDestroyed( QObject * );
-
-private:
- // users should never construct their own
- QTransportAuth();
- ~QTransportAuth();
-
- friend class QAuthDevice;
- Q_DECLARE_PRIVATE(QTransportAuth)
-};
-
-class Q_GUI_EXPORT RequestAnalyzer
-{
-public:
- RequestAnalyzer();
- virtual ~RequestAnalyzer();
- QString operator()( QByteArray *data ) { return analyze( data ); }
- bool requireMoreData() const { return moreData; }
- qint64 bytesAnalyzed() const { return dataSize; }
-protected:
- virtual QString analyze( QByteArray * );
- bool moreData;
- qint64 dataSize;
-};
-
-/*!
- \internal
- \class QAuthDevice
-
- \brief Pass-through QIODevice sub-class for authentication.
-
- Use this class to forward on or receive forwarded data over a real
- device for authentication.
-*/
-class Q_GUI_EXPORT QAuthDevice : public QIODevice
-{
- Q_OBJECT
-public:
- enum AuthDirection {
- Receive,
- Send
- };
- QAuthDevice( QIODevice *, QTransportAuth::Data *, AuthDirection );
- ~QAuthDevice();
- void setTarget( QIODevice *t ) { m_target = t; }
- QIODevice *target() const { return m_target; }
- void setClient( QObject* );
- QObject *client() const;
- void setRequestAnalyzer( RequestAnalyzer * );
- bool isSequential() const;
- bool atEnd() const;
- qint64 bytesAvailable() const;
- qint64 bytesToWrite() const;
- bool seek( qint64 );
- QByteArray & buffer();
-
-protected:
- qint64 readData( char *, qint64 );
- qint64 writeData(const char *, qint64 );
-private Q_SLOTS:
- void recvReadyRead();
- void targetBytesWritten( qint64 );
-private:
- bool authorizeMessage();
-
- QTransportAuth::Data *d;
- AuthDirection way;
- QIODevice *m_target;
- QObject *m_client;
- QByteArray msgQueue;
- qint64 m_bytesAvailable;
- qint64 m_skipWritten;
-
- RequestAnalyzer *analyzer;
-};
-
-inline bool QAuthDevice::isSequential() const
-{
- return true;
-}
-
-inline bool QAuthDevice::seek( qint64 )
-{
- return false;
-}
-
-inline bool QAuthDevice::atEnd() const
-{
- return msgQueue.isEmpty();
-}
-
-inline qint64 QAuthDevice::bytesAvailable() const
-{
- if ( way == Receive )
- return m_bytesAvailable;
- else
- return ( m_target ? m_target->bytesAvailable() : 0 );
-}
-
-inline qint64 QAuthDevice::bytesToWrite() const
-{
- return msgQueue.size();
-}
-
-inline QByteArray &QAuthDevice::buffer()
-{
- return msgQueue;
-}
-
-
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_SXE
-#endif // QTRANSPORTAUTH_QWS_H
diff --git a/src/gui/embedded/qtransportauth_qws_p.h b/src/gui/embedded/qtransportauth_qws_p.h
deleted file mode 100644
index 9cdbaaf26a..0000000000
--- a/src/gui/embedded/qtransportauth_qws_p.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTRANSPORTAUTH_QWS_P_H
-#define QTRANSPORTAUTH_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_SXE
-
-#include "qtransportauth_qws.h"
-#include "qtransportauthdefs_qws.h"
-#include "qbuffer.h"
-
-#include <qmutex.h>
-#include <qdatetime.h>
-#include "private/qobject_p.h"
-
-#include <QtCore/qcache.h>
-
-QT_BEGIN_NAMESPACE
-
-// Uncomment to generate debug output
-// #define QTRANSPORTAUTH_DEBUG 1
-
-#ifdef QTRANSPORTAUTH_DEBUG
-void hexstring( char *buf, const unsigned char* key, size_t sz );
-#endif
-
-// proj id for ftok usage in sxe
-#define SXE_PROJ 10022
-
-/*!
- \internal
- memset for security purposes, guaranteed not to be optimized away
- http://www.faqs.org/docs/Linux-HOWTO/Secure-Programs-HOWTO.html
-*/
-void *guaranteed_memset(void *v,int c,size_t n);
-
-class QUnixSocketMessage;
-
-/*!
- \internal
- \class AuthCookie
- Struct to carry process authentication key and id
-*/
-#define QSXE_HEADER_LEN 24
-
-/*!
- \macro AUTH_ID
- Macro to manage authentication header. Format of header is:
- \table
- \header \i BYTES \i CONTENT
- \row \i 0-3 \i magic numbers
- \row \i 4 \i length of authenticated data (max 255 bytes)
- \row i\ 5 \i reserved
- \row \i 6-21 \i MAC digest, or shared secret in case of simple auth
- \row \i 22 \i program id
- \row \i 23 \i sequence number
- \endtable
- Total length of the header is 24 bytes
-
- However this may change. Instead of coding these numbers use the AUTH_ID,
- AUTH_KEY, AUTH_DATA and AUTH_SPACE macros.
-*/
-
-#define AUTH_ID(k) ((unsigned char)(k[QSXE_KEY_LEN]))
-#define AUTH_KEY(k) ((unsigned char *)(k))
-
-#define AUTH_DATA(x) (unsigned char *)((x) + QSXE_HEADER_LEN)
-#define AUTH_SPACE(x) ((x) + QSXE_HEADER_LEN)
-#define QSXE_LEN_IDX 4
-#define QSXE_KEY_IDX 6
-#define QSXE_PROG_IDX 22
-#define QSXE_SEQ_IDX 23
-
-class SxeRegistryLocker : public QObject
-{
- Q_OBJECT
-public:
- SxeRegistryLocker( QObject * );
- ~SxeRegistryLocker();
- bool success() const { return m_success; }
-private:
- bool m_success;
- QObject *m_reg;
-};
-
-class QTransportAuthPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QTransportAuth)
-public:
- QTransportAuthPrivate();
- ~QTransportAuthPrivate();
-
- const unsigned char *getClientKey( unsigned char progId );
- void invalidateClientKeyCache();
-
- bool keyInitialised;
- QString m_logFilePath;
- QString m_keyFilePath;
- QObject *m_packageRegistry;
- AuthCookie authKey;
- QCache<unsigned char, char> keyCache;
- QHash< QObject*, QIODevice*> buffersByClient;
- QMutex keyfileMutex;
-};
-
-/*!
- \internal
- Enforces the False Authentication Rate. If more than 4 authentications
- are received per minute the sxemonitor is notified that the FAR has been exceeded
-*/
-class FAREnforcer
-{
- public:
- static FAREnforcer *getInstance();
- void logAuthAttempt( QDateTime time = QDateTime::currentDateTime() );
- void reset();
-
-#ifndef TEST_FAR_ENFORCER
- private:
-#endif
- FAREnforcer();
- FAREnforcer( const FAREnforcer & );
- FAREnforcer &operator=(FAREnforcer const & );
-
- static const QString FARMessage;
- static const int minutelyRate;
- static const QString SxeTag;
- static const int minute;
-
- QList<QDateTime> authAttempts;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_SXE
-#endif // QTRANSPORTAUTH_QWS_P_H
-
diff --git a/src/gui/embedded/qtransportauthdefs_qws.h b/src/gui/embedded/qtransportauthdefs_qws.h
deleted file mode 100644
index a6d39fb425..0000000000
--- a/src/gui/embedded/qtransportauthdefs_qws.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTRANSPORTAUTHDEFS_QWS_H
-#define QTRANSPORTAUTHDEFS_QWS_H
-
-#include <sys/types.h>
-#include <string.h>
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#define QSXE_KEY_LEN 16
-#define QSXE_MAGIC_BYTES 4
-
-// Number of bytes of each message to authenticate. Just need to ensure
-// that the command at the beginning hasn't been tampered with. This value
-// does not matter for trusted transports.
-#define AMOUNT_TO_AUTHENTICATE 200
-
-#define AUTH_ID(k) ((unsigned char)(k[QSXE_KEY_LEN]))
-#define AUTH_KEY(k) ((unsigned char *)(k))
-
-// must be a largish -ve number under any endianess when cast as an int
-const unsigned char magic[QSXE_MAGIC_BYTES] = { 0xBA, 0xD4, 0xD4, 0xBA };
-const int magicInt = 0xBAD4D4BA;
-
-#define QSXE_KEYFILE "keyfile"
-
-/*
- Header in above format, less the magic bytes.
- Useful for reading off the socket
-*/
-struct AuthHeader
-{
- unsigned char len;
- unsigned char pad;
- unsigned char digest[QSXE_KEY_LEN];
- unsigned char id;
- unsigned char seq;
-};
-
-/*
- Header in a form suitable for authentication routines
-*/
-struct AuthMessage
-{
- AuthMessage()
- {
- ::memset( authData, 0, sizeof(authData) );
- ::memcpy( pad_magic, magic, QSXE_MAGIC_BYTES );
- }
- unsigned char pad_magic[QSXE_MAGIC_BYTES];
- union {
- AuthHeader hdr;
- char authData[sizeof(AuthHeader)];
- };
- char payLoad[AMOUNT_TO_AUTHENTICATE];
-};
-
-/**
- Auth data as stored in _key
-*/
-struct AuthCookie
-{
- unsigned char key[QSXE_KEY_LEN];
- unsigned char pad;
- unsigned char progId;
-};
-
-/*
- Auth data as written to the key file - SUPERSEDED by usr_key_entry
-
- This is still used internally for some functions, ie the socket
- related calls.
-*/
-struct AuthRecord
-{
- union {
- AuthCookie auth;
- char data[sizeof(struct AuthCookie)];
- };
- time_t change_time;
-};
-
-/*!
- \class usr_key_entry
- This comes from the SXE kernel patch file include/linux/lidsif.h
-
- This is the (new) data record for the key file (version 2).
-
- The key file is (now) either /proc/lids/keys (and the per-process
- keys in /proc/<pid>/lids_key) OR for desktop/development ONLY (not
- for production) it is $QPEDIR/etc/keyfile
-
- The key file maps keys to files.
-
- File are identified by inode and device numbers, not paths.
-
- (See the "installs" file for path to inode/device mapping)
-*/
-struct usr_key_entry
-{
- char key[QSXE_KEY_LEN];
- ino_t ino;
- dev_t dev;
-};
-
-
-/*!
- \class IdBlock
- \brief Data record for the manifest file.
- The manifest file maps program id's to files
-*/
-struct IdBlock
-{
- quint64 inode;
- quint64 device;
- unsigned char pad;
- unsigned char progId;
- unsigned short installId;
- unsigned int keyOffset;
- qint64 install_time;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTRANSPORTAUTHDEFS_QWS_H
-
diff --git a/src/gui/embedded/qunixsocket.cpp b/src/gui/embedded/qunixsocket.cpp
deleted file mode 100644
index 03319cbb0a..0000000000
--- a/src/gui/embedded/qunixsocket.cpp
+++ /dev/null
@@ -1,1800 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qunixsocket_p.h"
-
-// #define QUNIXSOCKET_DEBUG 1
-
-#include <QtCore/qsocketnotifier.h>
-#include <QtCore/qqueue.h>
-#include <QtCore/qdatetime.h>
-#include "private/qcore_unix_p.h" // overrides QT_OPEN
-
-#ifdef QUNIXSOCKET_DEBUG
-#include <QtCore/qdebug.h>
-#endif
-
-extern "C" {
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-};
-
-#define UNIX_PATH_MAX 108 // From unix(7)
-
-#ifdef QT_LINUXBASE
-// LSB doesn't declare ucred
-struct ucred
-{
- pid_t pid; /* PID of sending process. */
- uid_t uid; /* UID of sending process. */
- gid_t gid; /* GID of sending process. */
-};
-
-// LSB doesn't define the ones below
-#ifndef SO_PASSCRED
-# define SO_PASSCRED 16
-#endif
-#ifndef SCM_CREDENTIALS
-# define SCM_CREDENTIALS 0x02
-#endif
-#ifndef MSG_DONTWAIT
-# define MSG_DONTWAIT 0x40
-#endif
-#ifndef MSG_NOSIGNAL
-# define MSG_NOSIGNAL 0x4000
-#endif
-
-#endif // QT_LINUXBASE
-
-QT_BEGIN_NAMESPACE
-
-///////////////////////////////////////////////////////////////////////////////
-// class QUnixSocketRights
-///////////////////////////////////////////////////////////////////////////////
-/*!
- \class QUnixSocketRights
- \internal
-
- \brief The QUnixSocketRights class encapsulates QUnixSocket rights data.
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- \l QUnixSocket allows you to transfer Unix file descriptors between processes.
- A file descriptor is referred to as "rights data" as it allows one process to
- transfer its right to access a resource to another.
-
- The Unix system verifies resource permissions only when the resource is first
- opened. For example, consider a file on disk readable only by the user "qt".
- A process running as user "qt" will be able to open this file for reading.
- If, while the process was still reading from the file, the ownership was
- changed from user "qt" to user "root", the process would be allowed to
- continue reading from the file, even though attempting to reopen the file
- would be denied. Permissions are associated with special descriptors called
- file descriptors which are returned to a process after it initially opens a
- resource.
-
- File descriptors can be duplicated within a process through the dup(2) system
- call. File descriptors can be passed between processes using the
- \l QUnixSocket class in the same way. Even though the receiving process never
- opened the resource directly, it has the same permissions to access it as the
- process that did.
-
- \sa QUnixSocket
- */
-struct QUnixSocketRightsPrivate : public QSharedData
-{
- virtual ~QUnixSocketRightsPrivate() {
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- QT_CLOSE(fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocketRightsPrivate: Unable to close managed"
- " file descriptor (" << ::strerror(errno) << ')';
- }
-#endif
- }
-
- int fd;
-};
-
-/*!
- Create a new QUnixSocketRights instance containing the file descriptor \a fd.
- \a fd will be dup(2)'d internally, so the application is free to close \a fd
- following this call.
-
- If the dup(2) fails, or you pass an invalid \a fd, an
- \l {QUnixSocketRights::isValid()}{invalid } object will be
- constructed.
-
- QUnixSocketRights instances are immutable and the internal file descriptor
- will be shared between any copies made of this object. The system will
- close(2) the file descriptor once it is no longer needed.
- */
-QUnixSocketRights::QUnixSocketRights(int fd)
-{
- d = new QUnixSocketRightsPrivate();
- if(-1 == fd) {
- d->fd = -1;
- } else {
- d->fd = qt_safe_dup(fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(-1 == d->fd) {
- qDebug() << "QUnixSocketRights: Unable to duplicate fd "
- << fd << " (" << ::strerror(errno) << ')';
- }
-#endif
- }
-}
-
-/*!
- \internal
-
- Construct a QUnixSocketRights instance on \a fd without dup(2)'ing the file
- descriptor.
- */
-QUnixSocketRights::QUnixSocketRights(int fd,int)
-{
- Q_ASSERT(-1 != fd);
- d = new QUnixSocketRightsPrivate();
- d->fd = fd;
-}
-
-/*!
- Destroys the QUnixSocketRights instance.
- */
-QUnixSocketRights::~QUnixSocketRights()
-{
-}
-
-/*!
- Create a copy of \a other.
- */
-QUnixSocketRights &
-QUnixSocketRights::operator=(const QUnixSocketRights & other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Create a copy of \a other.
- */
-QUnixSocketRights::QUnixSocketRights(const QUnixSocketRights & other)
-: d(other.d)
-{
-}
-
-/*!
- Returns true if this QUnixSocketRights instance is managing a valid file
- descriptor. This method is equivalent to (-1 != peekFd()).
-
- \sa QUnixSocketRights::peekFd()
- */
-bool QUnixSocketRights::isValid() const
-{
- return d->fd != -1;
-}
-
-/*!
- Return a duplicate of the file descriptor contained in this object. If this
- is an \l {QUnixSocketRights::isValid()}{invalid } object, or the
- dup(2) call fails, an invalid file descriptor (-1) will be returned.
-
- \sa QUnixSocketRights::peekFd()
- */
-int QUnixSocketRights::dupFd() const
-{
- if(-1 == d->fd) return -1;
-
- int rv = qt_safe_dup(d->fd);
-
-#ifdef QUNIXSOCKET_DEBUG
- if(-1 == rv)
- qDebug() << "QUnixSocketRights: Unable to duplicate managed file "
- "descriptor (" << ::strerror(errno) << ')';
-#endif
-
- return rv;
-}
-
-/*!
- Returns the file descriptor contained in this object. If this
- is an \l {QUnixSocketRights::isValid()}{invalid } object an invalid
- file descriptor (-1) will be returned.
-
- The lifetime of this file descriptor is tied to the lifetime of the
- QUnixSocketRights instance. The file descriptor returned by this method
- \e may be close(2)'d when the QUnixSocketRights instance is destroyed. If
- you want to continue to use the file descriptor use
- \l QUnixSocketRights::dupFd() instead.
-
- \sa QUnixSocketRights::dupFd()
- */
-int QUnixSocketRights::peekFd() const
-{
- return d->fd;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// class QUnixSocketMessage
-///////////////////////////////////////////////////////////////////////////////
-struct QUnixSocketMessagePrivate : public QSharedData
-{
- QUnixSocketMessagePrivate()
- : state(Default), vec(0), iovecLen(0), dataSize(0) {}
- QUnixSocketMessagePrivate(const QByteArray & b)
- : bytes(b), state(Default), vec(0), iovecLen(0), dataSize(0) {}
- QUnixSocketMessagePrivate(const QByteArray & b,
- const QList<QUnixSocketRights> & r)
- : bytes(b), rights(r), state(Default), vec(0), iovecLen(0), dataSize(0) {}
-
- int size() const { return vec ? dataSize : bytes.size(); }
- void removeBytes( unsigned int );
-
- QByteArray bytes;
- QList<QUnixSocketRights> rights;
-
- enum AncillaryDataState {
- Default = 0x00,
- Truncated = 0x01,
- Credential = 0x02
- };
- AncillaryDataState state;
-
- pid_t pid;
- gid_t gid;
- uid_t uid;
-
- ::iovec *vec;
- int iovecLen; // number of vectors in array
- int dataSize; // total size of vectors = payload
-};
-
-/*!
- \internal
- Remove \a bytesToDequeue bytes from the front of this message
-*/
-void QUnixSocketMessagePrivate::removeBytes( unsigned int bytesToDequeue )
-{
- if ( vec )
- {
- ::iovec *vecPtr = vec;
- if ( bytesToDequeue > (unsigned int)dataSize ) bytesToDequeue = dataSize;
- while ( bytesToDequeue > 0 && iovecLen > 0 )
- {
- if ( vecPtr->iov_len > bytesToDequeue )
- {
- // dequeue the bytes by taking them off the front of the
- // current vector. since we don't own the iovec, its okay
- // to "leak" this away by pointing past it
- char **base = reinterpret_cast<char**>(&(vecPtr->iov_base));
- *base += bytesToDequeue;
- vecPtr->iov_len -= bytesToDequeue;
- bytesToDequeue = 0;
- }
- else
- {
- // dequeue bytes by skipping a whole vector. again, its ok
- // to lose the pointers to this data
- bytesToDequeue -= vecPtr->iov_len;
- iovecLen--;
- vecPtr++;
- }
- }
- dataSize -= bytesToDequeue;
- if ( iovecLen == 0 ) vec = 0;
- }
- else
- {
- bytes.remove(0, bytesToDequeue );
- }
-}
-
-
-/*!
- \class QUnixSocketMessage
- \internal
-
- \brief The QUnixSocketMessage class encapsulates a message sent or received
- through the QUnixSocket class.
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- In addition to transmitting regular byte stream data, messages sent over Unix
- domain sockets may have special ancillary properties. QUnixSocketMessage
- instances allow programmers to retrieve and control these properties.
-
- Every QUnixSocketMessage sent has an associated set of credentials. A
- message's credentials consist of the process id, the user id and the group id
- of the sending process. Normally these credentials are set automatically for
- you by the QUnixSocketMessage class and can be queried by the receiving
- process using the \l QUnixSocketMessage::processId(),
- \l QUnixSocketMessage::userId() and \l QUnixSocketMessage::groupId() methods
- respectively.
-
- Advanced applications may wish to change the credentials that their message
- is sent with, and may do so though the \l QUnixSocketMessage::setProcessId(),
- \l QUnixSocketMessage::setUserId() and \l QUnixSocketMessage::setGroupId()
- methods. The validity of these credentials is verified by the system kernel.
- Only the root user can send messages with credentials that are not his own.
- Sending of the message will fail for any non-root user who attempts to
- fabricate credentials. Note that this failure is enforced by the system
- kernel - receivers can trust the accuracy of credential data!
-
- Unix domain socket messages may also be used to transmit Unix file descriptors
- between processes. In this context, file descriptors are known as rights data
- and are encapsulated by the \l QUnixSocketRights class. Senders can set the
- file descriptors to transmit using the \l QUnixSocketMessage::setRights() and
- receivers can retrieve this data through a call to
- \l QUnixSocketMessage::rights(). \l QUnixSocket and \l QUnixSocketRights
- discuss the specific copy and ordering semantic associated with rights data.
-
- QUnixSocketMessage messages are sent by the \l QUnixSocket::write() method.
- Like any normal network message, attempting to transmit an empty
- QUnixSocketMessage will succeed, but result in a no-op. Limitations in the
- Unix domain protocol semantic will cause a transmission of a
- QUnixSocketMessage with rights data, but no byte data portion, to fail.
-
- \sa QUnixSocket QUnixSocketRights
- */
-
-/*!
- Construct an empty QUnixSocketMessage. This instance will have not data and
- no rights information. The message's credentials will be set to the
- application's default credentials.
- */
-QUnixSocketMessage::QUnixSocketMessage()
-: d(new QUnixSocketMessagePrivate())
-{
-}
-
-/*!
- Construct a QUnixSocketMessage with an initial data payload of \a bytes. The
- message's credentials will be set to the application's default credentials.
- */
-QUnixSocketMessage::QUnixSocketMessage(const QByteArray & bytes)
-: d(new QUnixSocketMessagePrivate(bytes))
-{
-}
-
-/*!
- Construct a QUnixSocketMessage with an initial data payload of \a bytes and
- an initial rights payload of \a rights. The message's credentials will be set
- to the application's default credentials.
-
- A message with rights data but an empty data payload cannot be transmitted
- by the system.
- */
-QUnixSocketMessage::QUnixSocketMessage(const QByteArray & bytes,
- const QList<QUnixSocketRights> & rights)
-: d(new QUnixSocketMessagePrivate(bytes, rights))
-{
-}
-
-/*!
- Create a copy of \a other.
- */
-QUnixSocketMessage::QUnixSocketMessage(const QUnixSocketMessage & other)
-: d(other.d)
-{
-}
-
-/*!
- \fn QUnixSocketMessage::QUnixSocketMessage(const iovec* data, int vecLen)
-
- Construct a QUnixSocketMessage with an initial data payload of \a
- data which points to an array of \a vecLen iovec structures. The
- message's credentials will be set to the application's default
- credentials.
-
- This method can be used to avoid the overhead of copying buffers of data
- and will directly send the data pointed to by \a data on the socket. It also
- avoids the syscall overhead of making a number of small socket write calls,
- if a number of data items can be delivered with one write.
-
- Caller must ensure the iovec * \a data remains valid until the message
- is flushed. Caller retains ownership of the iovec structs.
- */
-QUnixSocketMessage::QUnixSocketMessage(const ::iovec* data, int vecLen )
-: d(new QUnixSocketMessagePrivate())
-{
- for ( int v = 0; v < vecLen; v++ )
- d->dataSize += data[v].iov_len;
- d->vec = const_cast<iovec*>(data);
- d->iovecLen = vecLen;
-}
-
-/*!
- Assign the contents of \a other to this object.
- */
-QUnixSocketMessage & QUnixSocketMessage::operator=(const QUnixSocketMessage & other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Destroy this instance.
- */
-QUnixSocketMessage::~QUnixSocketMessage()
-{
-}
-
-/*!
- Set the data portion of the message to \a bytes.
-
- \sa QUnixSocketMessage::bytes()
- */
-void QUnixSocketMessage::setBytes(const QByteArray & bytes)
-{
- d.detach();
- d->bytes = bytes;
-}
-
-/*!
- Set the rights portion of the message to \a rights.
-
- A message with rights data but an empty byte data payload cannot be
- transmitted by the system.
-
- \sa QUnixSocketMessage::rights()
- */
-void QUnixSocketMessage::setRights(const QList<QUnixSocketRights> & rights)
-{
- d.detach();
- d->rights = rights;
-}
-
-/*!
- Return the rights portion of the message.
-
- \sa QUnixSocketMessage::setRights()
- */
-const QList<QUnixSocketRights> & QUnixSocketMessage::rights() const
-{
- return d->rights;
-}
-
-/*!
- Returns true if the rights portion of the message was truncated on reception
- due to insufficient buffer size. The rights buffer size can be adjusted
- through calls to the \l QUnixSocket::setRightsBufferSize() method.
- \l QUnixSocket contains a discussion of the buffering and truncation
- characteristics of the Unix domain protocol.
-
- \sa QUnixSocket QUnixSocket::setRightsBufferSize()
- */
-bool QUnixSocketMessage::rightsWereTruncated() const
-{
- return d->state & QUnixSocketMessagePrivate::Truncated;
-}
-
-/*!
- Return the data portion of the message.
-
- \sa QUnixSocketMessage::setBytes()
- */
-const QByteArray & QUnixSocketMessage::bytes() const
-{
- return d->bytes;
-}
-
-/*!
- Returns the process id credential associated with this message.
-
- \sa QUnixSocketMessage::setProcessId()
- */
-pid_t QUnixSocketMessage::processId() const
-{
- if(QUnixSocketMessagePrivate::Credential & d->state)
- return d->pid;
- else
- return ::getpid();
-}
-
-/*!
- Returns the user id credential associated with this message.
-
- \sa QUnixSocketMessage::setUserId()
- */
-uid_t QUnixSocketMessage::userId() const
-{
- if(QUnixSocketMessagePrivate::Credential & d->state)
- return d->uid;
- else
- return ::geteuid();
-}
-
-/*!
- Returns the group id credential associated with this message.
-
- \sa QUnixSocketMessage::setGroupId()
- */
-gid_t QUnixSocketMessage::groupId() const
-{
- if(QUnixSocketMessagePrivate::Credential & d->state)
- return d->gid;
- else
- return ::getegid();
-}
-
-/*!
- Set the process id credential associated with this message to \a pid. Unless
- you are the root user, setting a fraudulant credential will cause this message
- to fail.
-
- \sa QUnixSocketMessage::processId()
- */
-void QUnixSocketMessage::setProcessId(pid_t pid)
-{
- if(!(d->state & QUnixSocketMessagePrivate::Credential)) {
- d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential );
- d->uid = ::geteuid();
- d->gid = ::getegid();
- }
- d->pid = pid;
-}
-
-/*!
- Set the user id credential associated with this message to \a uid. Unless
- you are the root user, setting a fraudulant credential will cause this message
- to fail.
-
- \sa QUnixSocketMessage::userId()
- */
-void QUnixSocketMessage::setUserId(uid_t uid)
-{
- if(!(d->state & QUnixSocketMessagePrivate::Credential)) {
- d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential );
- d->pid = ::getpid();
- d->gid = ::getegid();
- }
- d->uid = uid;
-}
-
-/*!
- Set the group id credential associated with this message to \a gid. Unless
- you are the root user, setting a fraudulant credential will cause this message
- to fail.
-
- \sa QUnixSocketMessage::groupId()
- */
-void QUnixSocketMessage::setGroupId(gid_t gid)
-{
- if(!(d->state & QUnixSocketMessagePrivate::Credential)) {
- d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential );
- d->pid = ::getpid();
- d->uid = ::geteuid();
- }
- d->gid = gid;
-}
-
-/*!
- Return true if this message is valid. A message with rights data but an empty
- byte data payload cannot be transmitted by the system and is marked as
- invalid.
- */
-bool QUnixSocketMessage::isValid() const
-{
- return d->rights.isEmpty() || !d->bytes.isEmpty();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// class QUnixSocket
-///////////////////////////////////////////////////////////////////////////////
-#define QUNIXSOCKET_DEFAULT_READBUFFER 1024
-#define QUNIXSOCKET_DEFAULT_ANCILLARYBUFFER 0
-
-/*!
- \class QUnixSocket
- \internal
-
- \brief The QUnixSocket class provides a Unix domain socket.
-
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- Unix domain sockets provide an efficient mechanism for communications between
- Unix processes on the same machine. Unix domain sockets support a reliable,
- stream-oriented, connection-oriented transport protocol, much like TCP
- sockets. Unlike IP based sockets, the connection endpoint of a Unix domain
- socket is a file on disk of type socket.
-
- In addition to transporting raw data bytes, Unix domain sockets are able to
- transmit special ancillary data. The two types of ancillary data supported
- by the QUnixSocket class are:
-
- \list
- \o Credential Data - Allows a receiver
- to reliably identify the process sending each message.
- \o \l {QUnixSocketRights}{Rights Data } - Allows Unix file descriptors
- to be transmitted between processes.
- \endlist
-
- Because of the need to support ancillary data, QUnixSocket is not a QIODevice,
- like QTcpSocket and QUdpSocket. Instead, QUnixSocket contains a number of
- read and write methods that clients must invoke directly. Rather than
- returning raw data bytes, \l QUnixSocket::read() returns \l QUnixSocketMessage
- instances that encapsulate the message's byte data and any other ancillary
- data.
-
- Ancillary data is transmitted "out of band". Every \l QUnixSocketMessage
- received will have credential data associated with it that the client can
- access through calls to \l QUnixSocketMessage::processId(),
- \l QUnixSocketMessage::groupId() and \l QUnixSocketMessage::userId().
- Likewise, message creators can set the credential data to send through calls
- to \l QUnixSocketMessage::setProcessId(), \l QUnixSocketMessage::setGroupId()
- and \l QUnixSocketMessage::setUserId() respectively. The authenticity of the
- credential values is verified by the system kernel and cannot be fabricated
- by unprivileged processes. Only processes running as the root user can
- specify credential data that does not match the sending process.
-
- Unix file descriptors, known as "rights data", transmitted between processes
- appear as though they had been dup(2)'d between the two. As Unix
- domain sockets present a continuous stream of bytes to the receiver, the
- rights data - which is transmitted out of band - must be "slotted" in at some
- point. The rights data is logically associated with the first byte - called
- the anchor byte - of the \l QUnixSocketMessage to which they are attached.
- Received rights data will be available from the
- \l QUnixSocketMessage::rights() method for the \l QUnixSocketMessage
- instance that contains the anchor byte.
-
- In addition to a \l QUnixSocket::write() that takes a \l QUnixSocketMessage
- instance - allowing a client to transmit both byte and rights data - a
- number of convenience overloads are provided for use when only transmitting
- simple byte data. Unix requires that at least one byte of raw data be
- transmitted in order to send rights data. A \l QUnixSocketMessage instance
- with rights data, but no byte data, cannot be transmitted.
-
- Unix sockets present a stream interface, such that, for example, a single
- six byte transmission might be received as two three byte messages. Rights
- data, on the other hand, is conceptually transmitted as unfragmentable
- datagrams. If the receiving buffer is not large enough to contain all the
- transmitted rights information, the data is truncated and irretreivably lost.
- Users should use the \l QUnixSocket::setRightsBufferSize() method to control
- the buffer size used for this data, and develop protocols that avoid the
- problem. If the buffer size is too small and rights data is truncated,
- the \l QUnixSocketMessage::rightsWereTruncated() flag will be set.
-
- \sa QUnixSocketMessage QUnixSocketRights
-*/
-
-/*!
- \enum QUnixSocket::SocketError
-
- The SocketError enumeration represents the various errors that can occur on
- a Unix domain socket. The most recent error for the socket is available
- through the \l QUnixSocket::error() method.
-
- \value NoError No error has occurred.
- \value InvalidPath An invalid path endpoint was passed to
- \l QUnixSocket::connect(). As defined by unix(7), invalid paths
- include an empty path, or what more than 107 characters long.
- \value ResourceError An error acquiring or manipulating the system's socket
- resources occurred. For example, if the process runs out of available
- socket descriptors, a ResourceError will occur.
- \value NonexistentPath The endpoing passed to \l QUnixSocket::connect() does
- not refer to a Unix domain socket entity on disk.
- \value ConnectionRefused The connection to the specified endpoint was refused.
- Generally this means that there is no server listening on that
- endpoint.
- \value UnknownError An unknown error has occurred.
- \value ReadFailure An error occurred while reading bytes from the connection.
- \value WriteFailure An error occurred while writing bytes into the connection.
- */
-
-/*!
- \enum QUnixSocket::SocketState
-
- The SocketState enumeration represents the connection state of a QUnixSocket
- instance.
-
- \value UnconnectedState The connection is not established.
- \value ConnectedState The connection is established.
- \value ClosingState The connection is being closed, following a call to
- \l QUnixSocket::close(). While closing, any pending data will be
- transmitted, but further writes by the application will be refused.
- */
-
-/*
- \fn QUnixSocket::bytesWritten(qint64 bytes)
-
- This signal is emitted every time a payload of data has been written to the
- connection. The \a bytes argument is set to the number of bytes that were
- written in this payload.
-
- \sa QUnixSocket::readyRead()
-*/
-
-/*
- \fn QUnixSocket::readyRead()
-
- This signal is emitted once every time new data is available for reading from
- the connection. It will only be emitted again once new data is available.
-
- \sa QUnixSocket::bytesWritten()
-*/
-
-/*!
- \fn QUnixSocket::stateChanged(SocketState socketState)
-
- This signal is emitted each time the socket changes connection state.
- \a socketState will be set to the socket's new state.
-*/
-
-class QUnixSocketPrivate : public QObject {
-Q_OBJECT
-public:
- QUnixSocketPrivate(QUnixSocket * _me)
- : me(_me), fd(-1), readNotifier(0), writeNotifier(0),
- state(QUnixSocket::UnconnectedState), error(QUnixSocket::NoError),
- writeQueueBytes(0), messageValid(false), dataBuffer(0),
- dataBufferLength(0), dataBufferCapacity(0), ancillaryBuffer(0),
- ancillaryBufferCount(0), closingTimer(0) {
- QObject::connect(this, SIGNAL(readyRead()), me, SIGNAL(readyRead()));
- QObject::connect(this, SIGNAL(bytesWritten(qint64)),
- me, SIGNAL(bytesWritten(qint64)));
- }
- ~QUnixSocketPrivate()
- {
- if(dataBuffer)
- delete [] dataBuffer;
- if(ancillaryBuffer)
- delete [] ancillaryBuffer;
- }
-
- enum { CausedAbort = 0x70000000 };
-
- QUnixSocket * me;
-
- int fd;
-
- QSocketNotifier * readNotifier;
- QSocketNotifier * writeNotifier;
-
- QUnixSocket::SocketState state;
- QUnixSocket::SocketError error;
-
- QQueue<QUnixSocketMessage> writeQueue;
- unsigned int writeQueueBytes;
-
- bool messageValid;
- ::msghdr message;
- inline void flushAncillary()
- {
- if(!messageValid) return;
- ::cmsghdr * h = (::cmsghdr *)CMSG_FIRSTHDR(&(message));
- while(h) {
-
- if(SCM_RIGHTS == h->cmsg_type) {
- int * fds = (int *)CMSG_DATA(h);
- int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int);
-
- for(int ii = 0; ii < numFds; ++ii)
- QT_CLOSE(fds[ii]);
- }
-
- h = (::cmsghdr *)CMSG_NXTHDR(&(message), h);
- }
-
- messageValid = false;
- }
-
-
- char * dataBuffer;
- unsigned int dataBufferLength;
- unsigned int dataBufferCapacity;
-
- char * ancillaryBuffer;
- inline unsigned int ancillaryBufferCapacity()
- {
- return CMSG_SPACE(sizeof(::ucred)) + CMSG_SPACE(sizeof(int) * ancillaryBufferCount);
- }
- unsigned int ancillaryBufferCount;
-
- QByteArray address;
-
- int closingTimer;
-
- virtual void timerEvent(QTimerEvent *)
- {
- me->abort();
- killTimer(closingTimer);
- closingTimer = 0;
- }
-signals:
- void readyRead();
- void bytesWritten(qint64);
-
-public slots:
- void readActivated();
- qint64 writeActivated();
-};
-
-/*!
- Construct a QUnixSocket instance, with \a parent.
-
- The read buffer is initially set to 1024 bytes, and the rights buffer to 0
- entries.
-
- \sa QUnixSocket::readBufferSize() QUnixSocket::rightsBufferSize()
- */
-QUnixSocket::QUnixSocket(QObject * parent)
-: QIODevice(parent), d(new QUnixSocketPrivate(this))
-{
- setOpenMode(QIODevice::NotOpen);
- setReadBufferSize(QUNIXSOCKET_DEFAULT_READBUFFER);
- setRightsBufferSize(QUNIXSOCKET_DEFAULT_ANCILLARYBUFFER);
-}
-
-/*!
- Construct a QUnixSocket instance, with \a parent.
-
- The read buffer is initially set to \a readBufferSize bytes, and the rights
- buffer to \a rightsBufferSize entries.
-
- \sa QUnixSocket::readBufferSize() QUnixSocket::rightsBufferSize()
- */
-QUnixSocket::QUnixSocket(qint64 readBufferSize, qint64 rightsBufferSize,
- QObject * parent)
-: QIODevice(parent), d(new QUnixSocketPrivate(this))
-{
- Q_ASSERT(readBufferSize > 0 && rightsBufferSize >= 0);
-
- setOpenMode(QIODevice::NotOpen);
- setReadBufferSize(readBufferSize);
- setRightsBufferSize(rightsBufferSize);
-}
-
-/*!
- Destroys the QUnixSocket instance. Any unsent data is discarded.
- */
-QUnixSocket::~QUnixSocket()
-{
- abort();
- delete d;
-}
-
-/*!
- Attempt to connect to \a path.
-
- This method is synchronous and will return true if the connection succeeds and
- false otherwise. In the case of failure, \l QUnixSocket::error() will be set
- accordingly.
-
- Any existing connection will be aborted, and all pending data will be
- discarded.
-
- \sa QUnixSocket::close() QUnixSocket::abort() QUnixSocket::error()
- */
-bool QUnixSocket::connect(const QByteArray & path)
-{
- int _true;
- int crv;
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Connect requested to '"
- << path << '\'';
-#endif
-
- abort(); // Reset any existing connection
-
- if(UnconnectedState != d->state) // abort() caused a signal and someone messed
- // with us. We'll assume they know what
- // they're doing and bail. Alternative is to
- // have a special "Connecting" state
- return false;
-
-
- if(path.isEmpty() || path.size() > UNIX_PATH_MAX) {
- d->error = InvalidPath;
- return false;
- }
-
- // Create the socket
- d->fd = ::socket(PF_UNIX, SOCK_STREAM, 0);
- if(-1 == d->fd) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to create socket ("
- << strerror(errno) << ')';
-#endif
- d->error = ResourceError;
- goto connect_error;
- }
-
- // Set socket options
- _true = 1;
- crv = ::setsockopt(d->fd, SOL_SOCKET, SO_PASSCRED, (void *)&_true,
- sizeof(int));
- if(-1 == crv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to configure socket ("
- << ::strerror(errno) << ')';
-#endif
- d->error = ResourceError;
-
- goto connect_error;
- }
-
- // Construct our unix address
- struct ::sockaddr_un addr;
- addr.sun_family = AF_UNIX;
- ::memcpy(addr.sun_path, path.data(), path.size());
- if(path.size() < UNIX_PATH_MAX)
- addr.sun_path[path.size()] = '\0';
-
- // Attempt the connect
- crv = ::connect(d->fd, (sockaddr *)&addr, sizeof(sockaddr_un));
- if(-1 == crv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to connect ("
- << ::strerror(errno) << ')';
-#endif
- if(ECONNREFUSED == errno)
- d->error = ConnectionRefused;
- else if(ENOENT == errno)
- d->error = NonexistentPath;
- else
- d->error = UnknownError;
-
- goto connect_error;
- }
-
- // We're connected!
- d->address = path;
- d->state = ConnectedState;
- d->readNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d);
- d->writeNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Write, d);
- QObject::connect(d->readNotifier, SIGNAL(activated(int)),
- d, SLOT(readActivated()));
- QObject::connect(d->writeNotifier, SIGNAL(activated(int)),
- d, SLOT(writeActivated()));
- d->readNotifier->setEnabled(true);
- d->writeNotifier->setEnabled(false);
- setOpenMode(QIODevice::ReadWrite);
- emit stateChanged(ConnectedState);
-
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Connected to " << path;
-#endif
- return true;
-
-connect_error: // Cleanup failed connection
- if(-1 != d->fd) {
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- QT_CLOSE(d->fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocket: Unable to close file descriptor after "
- "failed connect (" << ::strerror(errno) << ')';
- }
-#endif
- }
- d->fd = -1;
- return false;
-}
-
-/*!
- Sets the socket descriptor to use to \a socketDescriptor, bypassing
- QUnixSocket's connection infrastructure, and return true on success and false
- on failure. \a socketDescriptor must be in the connected state, and must be
- a Unix domain socket descriptor. Following a successful call to this method,
- the QUnixSocket instance will be in the Connected state and will have assumed
- ownership of \a socketDescriptor.
-
- Any existing connection will be aborted, and all pending data will be
- discarded.
-
- \sa QUnixSocket::connect()
-*/
-bool QUnixSocket::setSocketDescriptor(int socketDescriptor)
-{
- abort();
-
- if(UnconnectedState != state()) // See QUnixSocket::connect()
- return false;
-
- // Attempt to set the socket options
- if(-1 == socketDescriptor) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: User provided socket is invalid";
-#endif
- d->error = ResourceError;
- return false;
- }
-
- // Set socket options
- int _true = 1;
- int crv = ::setsockopt(socketDescriptor, SOL_SOCKET,
- SO_PASSCRED, (void *)&_true, sizeof(int));
- if(-1 == crv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to configure client provided socket ("
- << ::strerror(errno) << ')';
-#endif
- d->error = ResourceError;
-
- return false;
- }
-
- d->fd = socketDescriptor;
- d->state = ConnectedState;
- d->address = QByteArray();
- setOpenMode(QIODevice::ReadWrite);
- d->readNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d);
- d->writeNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Write, d);
- QObject::connect(d->readNotifier, SIGNAL(activated(int)),
- d, SLOT(readActivated()));
- QObject::connect(d->writeNotifier, SIGNAL(activated(int)),
- d, SLOT(writeActivated()));
- d->readNotifier->setEnabled(true);
- d->writeNotifier->setEnabled(false);
- emit stateChanged(d->state);
-
- return true;
-}
-
-/*!
- Returns the socket descriptor currently in use. This method will return -1
- if the QUnixSocket instance is in the UnconnectedState \l {QUnixSocket::state()}{state. }
-
- \sa QUnixSocket::setSocketDescriptor()
- */
-int QUnixSocket::socketDescriptor() const
-{
- return d->fd;
-}
-
-/*!
- Abort the connection. This will immediately disconnect (if connected) and
- discard any pending data. Following a call to QUnixSocket::abort() the
- object will always be in the disconnected \link QUnixSocket::state() state.
- \endlink
-
- \sa QUnixSocket::close()
-*/
-void QUnixSocket::abort()
-{
- setOpenMode(QIODevice::NotOpen);
-
- // We want to be able to use QUnixSocket::abort() to cleanup our state but
- // also preserve the error message that caused the abort. It is not
- // possible to reorder code to do this:
- // abort();
- // d->error = SomeError
- // as QUnixSocket::abort() might emit a signal and we need the error to be
- // set within that signal. So, if we want an error message to be preserved
- // across a *single* call to abort(), we set the
- // QUnixSocketPrivate::CausedAbort flag in the error.
- if(d->error & QUnixSocketPrivate::CausedAbort)
- d->error = (QUnixSocket::SocketError)(d->error &
- ~QUnixSocketPrivate::CausedAbort);
- else
- d->error = NoError;
-
- if( UnconnectedState == d->state) return;
-
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- ::close(d->fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocket: Unable to close socket during abort ("
- << strerror(errno) << ')';
- }
-#endif
-
- // Reset variables
- d->fd = -1;
- d->state = UnconnectedState;
- d->dataBufferLength = 0;
- d->flushAncillary();
- d->address = QByteArray();
- if(d->readNotifier) {
- d->readNotifier->setEnabled(false);
- d->readNotifier->deleteLater();
- }
- if(d->writeNotifier) {
- d->writeNotifier->setEnabled(false);
- d->writeNotifier->deleteLater();
- }
- d->readNotifier = 0;
- d->writeNotifier = 0;
- d->writeQueue.clear();
- d->writeQueueBytes = 0;
- if(d->closingTimer) {
- d->killTimer(d->closingTimer);
- }
- d->closingTimer = 0;
- emit stateChanged(d->state);
-}
-
-/*!
- Close the connection. The instance will enter the Closing
- \l {QUnixSocket::state()}{state } until all pending data has been
- transmitted, at which point it will enter the Unconnected state.
-
- Even if there is no pending data for transmission, the object will never
- jump directly to Disconnect without first passing through the
- Closing state.
-
- \sa QUnixSocket::abort()
- */
-void QUnixSocket::close()
-{
- if(ConnectedState != state()) return;
-
- d->state = ClosingState;
- if(d->writeQueue.isEmpty()) {
- d->closingTimer = d->startTimer(0); // Start a timer to "fake"
- // completing writes
- }
- emit stateChanged(d->state);
-}
-
-/*!
- This function writes as much as possible from the internal write buffer to
- the underlying socket, without blocking. If any data was written, this
- function returns true; otherwise false is returned.
-*/
-// Note! docs partially copied from QAbstractSocket::flush()
-bool QUnixSocket::flush()
-{
- // This needs to have the same semantics as QAbstractSocket, if it is to
- // be used interchangeably with that class.
- if (d->writeQueue.isEmpty())
- return false;
-
- d->writeActivated();
- return true;
-}
-
-/*!
- Returns the last error to have occurred on this object. This method is not
- destructive, so multiple calls to QUnixSocket::error() will return the same
- value. The error is only reset by a call to \l QUnixSocket::connect() or
- \l QUnixSocket::abort()
- */
-QUnixSocket::SocketError QUnixSocket::error() const
-{
- return (QUnixSocket::SocketError)
- (d->error & ~QUnixSocketPrivate::CausedAbort);
-}
-
-/*!
- Returns the connection state of this instance.
- */
-QUnixSocket::SocketState QUnixSocket::state() const
-{
- return d->state;
-}
-
-/*!
- Returns the Unix path address passed to \l QUnixSocket::connect(). This
- method will return an empty path if the object is in the Unconnected
- \l {QUnixSocket::state()}{state } or was connected through a call
- to \l QUnixSocket::setSocketDescriptor()
-
- \sa QUnixSocket::connect() QUnixSocket::setSocketDescriptor()
- */
-QByteArray QUnixSocket::address() const
-{
- return d->address;
-}
-
-/*!
- Returns the number of bytes available for immediate retrieval through a call
- to \l QUnixSocket::read().
- */
-qint64 QUnixSocket::bytesAvailable() const
-{
- return QIODevice::bytesAvailable() + d->dataBufferLength;
-}
-
-/*!
- Returns the number of enqueued bytes still to be written to the socket.
- */
-qint64 QUnixSocket::bytesToWrite() const
-{
- return d->writeQueueBytes;
-}
-
-/*!
- Returns the size of the read buffer in bytes. The read buffer size
- determines the amount of byte data that can be read from the socket in one go.
- The read buffer size caps the maximum value that can be returned by
- \l QUnixSocket::bytesAvailable() and will always be greater than zero. By
- default, the read buffer size is 1024 bytes.
-
- The size of the read buffer is independent of the rights buffer, which can be
- queried by \l QUnixSocket::rightsBufferSize().
-
- \sa QUnixSocket::setReadBufferSize()
- */
-qint64 QUnixSocket::readBufferSize() const
-{
- return d->dataBufferCapacity;
-}
-
-/*!
- Sets the \a size of the socket's read buffer in bytes.
-
- The size of the read buffer is independent of the rights buffer, which can be
- set by \l QUnixSocket::setRightsBufferSize().
-
- Attempting to reduce the buffer size while bytes are available for reading
- (ie. while the buffer is in use) will fail.
-
- \sa QUnixSocket::readBufferSize()
- */
-void QUnixSocket::setReadBufferSize(qint64 size)
-{
- Q_ASSERT(size > 0);
- if(size == d->dataBufferCapacity || d->dataBufferLength) return;
- if(d->dataBuffer) delete [] d->dataBuffer;
- d->dataBuffer = new char[size];
- d->dataBufferCapacity = size;
-}
-
-/*!
- Returns the size of the rights buffer in rights entries. The rights buffer
- size determines the number of rights transferences that can be received in
- any message. Unlike byte stream data which can be fragmented into many
- smaller messages if the \link QUnixSocket::readBufferSize() read buffer
- \endlink is not large enough to contain all the available data, rights data
- is transmitted as unfragmentable datagrams. If the rights buffer is not
- large enough to contain this unfragmentable datagram, the datagram will be
- truncated and rights data irretrievably lost. If truncation occurs, the
- \l QUnixSocketMessage::rightsWereTruncated() flag will be set. By default
- the rights buffer size is 0 entries - rights data cannot be received.
-
- The size of the rights buffer is independent of the read buffer, which can be
- queried by \l QUnixSocket::readBufferSize().
-
- \sa QUnixSocket::setRightsBufferSize()
- */
-qint64 QUnixSocket::rightsBufferSize() const
-{
- return d->ancillaryBufferCount;
-}
-
-/*!
- Sets the \a size of the socket's rights buffer in rights entries.
-
- The size of the rights buffer is independent of the read buffer, which can be
- set by \l QUnixSocket::setReadBufferSize().
-
- Attempting to reduce the buffer size while bytes are available for reading
- (ie. while the buffer is in use) will fail.
-
- \sa QUnixSocket::rightsBufferSize()
- */
-void QUnixSocket::setRightsBufferSize(qint64 size)
-{
- Q_ASSERT(size >= 0);
-
- if((size == d->ancillaryBufferCount || d->dataBufferLength) &&
- d->ancillaryBuffer)
- return;
-
- qint64 byteSize = CMSG_SPACE(sizeof(::ucred)) +
- CMSG_SPACE(size * sizeof(int));
-
- if(d->ancillaryBuffer) delete [] d->ancillaryBuffer;
- d->ancillaryBuffer = new char[byteSize];
- d->ancillaryBufferCount = size;
-}
-
-/*!
- \overload
-
- Writes \a socketdata to the socket. In addition to failing if the socket
- is not in the Connected state, writing will fail if \a socketdata is
- \l {QUnixSocketMessage::isValid()}{invalid. }
-
- Writes through the QUnixSocket class are asynchronous. Rather than being
- written immediately, data is enqueued and written once the application
- reenters the Qt event loop and the socket becomes available for writing.
- Thus, this method will only fail if the socket is not in the Connected state
- - it is illegal to attempt a write on a Unconnected or Closing socket.
-
- Applications can monitor the progress of data writes through the
- \l QUnixSocket::bytesWritten() signal and \l QUnixSocket::bytesToWrite()
- method.
-
- \sa QUnixSocketMessage
- */
-qint64 QUnixSocket::write(const QUnixSocketMessage & socketdata)
-{
- if(ConnectedState != state() || !socketdata.isValid()) return -1;
- if(socketdata.d->size() == 0) return 0;
-
- d->writeQueue.enqueue(socketdata);
- d->writeQueueBytes += socketdata.d->size();
- d->writeNotifier->setEnabled(true);
-
- return socketdata.d->size();
-}
-
-/*!
- Return the next available message, or an empty message if none is available.
-
- To avoid retrieving empty messages, applications should connect to the
- \l QUnixSocket::readyRead() signal to be notified when new messages are
- available or periodically poll the \l QUnixSocket::bytesAvailable() method.
-
- \sa QUnixSocket::readyRead() QUnixSocket::bytesAvailable()
- */
-QUnixSocketMessage QUnixSocket::read()
-{
- QUnixSocketMessage data;
- if(!d->dataBufferLength)
- return data;
-
- data.d->state = QUnixSocketMessagePrivate::Credential;
-
- // Bytes are easy
- data.setBytes(QByteArray(d->dataBuffer, d->dataBufferLength));
-
- // Extract ancillary data
- QList<QUnixSocketRights> a;
-
- ::cmsghdr * h = (::cmsghdr *)CMSG_FIRSTHDR(&(d->message));
- while(h) {
-
- if(SCM_CREDENTIALS == h->cmsg_type) {
- ::ucred * cred = (::ucred *)CMSG_DATA(h);
-#ifdef QUNIXSOCKET_DEBUG
- qDebug( "Credentials recd: pid %lu - gid %lu - uid %lu",
- cred->pid, cred->gid, cred->uid );
-#endif
- data.d->pid = cred->pid;
- data.d->gid = cred->gid;
- data.d->uid = cred->uid;
-
- } else if(SCM_RIGHTS == h->cmsg_type) {
-
- int * fds = (int *)CMSG_DATA(h);
- int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int);
-
- for(int ii = 0; ii < numFds; ++ii) {
- QUnixSocketRights qusr(fds[ii], 0);
- a.append(qusr);
- }
-
- } else {
-
-#ifdef QUNIXSOCKET_DEBUG
- qFatal("QUnixSocket: Unknown ancillary data type (%d) received.",
- h->cmsg_type);
-#endif
-
- }
-
- h = (::cmsghdr *)CMSG_NXTHDR(&(d->message), h);
- }
-
- if(d->message.msg_flags & MSG_CTRUNC) {
- data.d->state = (QUnixSocketMessagePrivate::AncillaryDataState)(QUnixSocketMessagePrivate::Truncated |
- QUnixSocketMessagePrivate::Credential );
- }
-
- if(!a.isEmpty())
- data.d->rights = a;
-
- d->dataBufferLength = 0;
- d->messageValid = false;
- d->readNotifier->setEnabled(true);
-
- return data;
-}
-
-/*! \internal */
-bool QUnixSocket::isSequential() const
-{
- return true;
-}
-
-/*! \internal */
-bool QUnixSocket::waitForReadyRead(int msecs)
-{
- if(UnconnectedState == d->state)
- return false;
-
- if(d->messageValid) {
- return true;
- }
-
- Q_ASSERT(-1 != d->fd);
-
- int timeout = msecs;
- struct timeval tv;
- struct timeval *ptrTv = 0;
- QTime stopWatch;
-
- stopWatch.start();
-
- do
- {
- fd_set readset;
-
- FD_ZERO(&readset);
- FD_SET(d->fd, &readset);
-
- if(-1 != msecs) {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- ptrTv = &tv;
- }
-
- int rv = ::select(d->fd + 1, &readset, 0, 0, ptrTv);
- switch(rv) {
- case 0:
- // timeout
- return false;
- case 1:
- // ok
- d->readActivated();
- return true;
- default:
- if (errno != EINTR)
- abort(); // error
- break;
- }
-
- timeout = msecs - stopWatch.elapsed();
- }
- while (timeout > 0);
-
- return false;
-}
-
-bool QUnixSocket::waitForBytesWritten(int msecs)
-{
- if(UnconnectedState == d->state)
- return false;
-
- Q_ASSERT(-1 != d->fd);
-
- if ( d->writeQueue.isEmpty() )
- return true;
-
- QTime stopWatch;
- stopWatch.start();
-
- while ( true )
- {
- fd_set fdwrite;
- FD_ZERO(&fdwrite);
- FD_SET(d->fd, &fdwrite);
- int timeout = msecs < 0 ? 0 : msecs - stopWatch.elapsed();
- struct timeval tv;
- struct timeval *ptrTv = 0;
- if ( -1 != msecs )
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- ptrTv = &tv;
- }
-
- int rv = ::select(d->fd + 1, 0, &fdwrite, 0, ptrTv);
- switch ( rv )
- {
- case 0:
- // timeout
- return false;
- case 1:
- {
- // ok to write
- qint64 bytesWritten = d->writeActivated();
- if (bytesWritten == 0) {
- // We need to retry
- int delay = 1;
- do {
- if (-1 != msecs) {
- timeout = msecs - stopWatch.elapsed();
- if (timeout <= 0) {
- // We have exceeded our allotted time
- return false;
- } else {
- if (delay > timeout)
- delay = timeout;
- }
- }
-
- // Pause before we make another attempt to send
- ::usleep(delay * 1000);
- if (delay < 1024)
- delay *= 2;
-
- bytesWritten = d->writeActivated();
- } while (bytesWritten == 0);
- }
- return (bytesWritten != -1);
- }
- default:
- // error - or an uncaught signal!!!!!!!!!
- if ( rv == EINTR )
- continue;
- abort();
- return false;
- }
- }
- return false; // fix warnings
-}
-
-/*! \internal */
-bool QUnixSocket::canReadLine() const
-{
- for(unsigned int ii = 0; ii < d->dataBufferLength; ++ii)
- if(d->dataBuffer[ii] == '\n') return true;
- return false;
-}
-
-/*! \internal */
-qint64 QUnixSocket::readData(char * data, qint64 maxSize)
-{
- Q_ASSERT(data);
- if(0 >= maxSize) return 0;
- if(!d->dataBufferLength) return 0;
-
- // Read data
- unsigned int size = d->dataBufferLength>maxSize?maxSize:d->dataBufferLength;
- memcpy(data, d->dataBuffer, size);
- if(size == d->dataBufferLength) {
- d->dataBufferLength = 0;
- } else {
- memmove(d->dataBuffer, d->dataBuffer + size, d->dataBufferLength - size);
- d->dataBufferLength -= size;
- }
-
-
- // Flush ancillary
- d->flushAncillary();
-
- if(0 == d->dataBufferLength)
- d->readNotifier->setEnabled(true);
-
- return size;
-}
-
-/*! \internal */
-qint64 QUnixSocket::writeData (const char * data, qint64 maxSize)
-{
- return write(QUnixSocketMessage(QByteArray(data, maxSize)));
-}
-
-qint64 QUnixSocketPrivate::writeActivated()
-{
- writeNotifier->setEnabled(false);
-
- QUnixSocketMessage & m = writeQueue.head();
- const QList<QUnixSocketRights> & a = m.rights();
-
- //
- // Construct the message
- //
- ::iovec vec;
- if ( !m.d->vec ) // message does not already have an iovec
- {
- vec.iov_base = (void *)m.bytes().constData();
- vec.iov_len = m.bytes().size();
- }
-
- // Allocate the control buffer
- ::msghdr sendmessage;
- ::bzero(&sendmessage, sizeof(::msghdr));
- if ( m.d->vec )
- {
- sendmessage.msg_iov = m.d->vec;
- sendmessage.msg_iovlen = m.d->iovecLen;
- }
- else
- {
- sendmessage.msg_iov = &vec;
- sendmessage.msg_iovlen = 1;
- }
- unsigned int required = CMSG_SPACE(sizeof(::ucred)) +
- a.size() * CMSG_SPACE(sizeof(int));
- sendmessage.msg_control = new char[required];
- ::bzero(sendmessage.msg_control, required);
- sendmessage.msg_controllen = required;
-
- // Create ancillary buffer
- ::cmsghdr * h = CMSG_FIRSTHDR(&sendmessage);
-
- if(m.d->state & QUnixSocketMessagePrivate::Credential) {
- h->cmsg_len = CMSG_LEN(sizeof(::ucred));
- h->cmsg_level = SOL_SOCKET;
- h->cmsg_type = SCM_CREDENTIALS;
- ((::ucred *)CMSG_DATA(h))->pid = m.d->pid;
- ((::ucred *)CMSG_DATA(h))->gid = m.d->gid;
- ((::ucred *)CMSG_DATA(h))->uid = m.d->uid;
- h = CMSG_NXTHDR(&sendmessage, h);
- } else {
- sendmessage.msg_controllen -= CMSG_SPACE(sizeof(::ucred));
- }
-
- for(int ii = 0; ii < a.count(); ++ii) {
- const QUnixSocketRights & r = a.at(ii);
-
- if(r.isValid()) {
- h->cmsg_len = CMSG_LEN(sizeof(int));
- h->cmsg_level = SOL_SOCKET;
- h->cmsg_type = SCM_RIGHTS;
- *((int *)CMSG_DATA(h)) = r.peekFd();
- h = CMSG_NXTHDR(&sendmessage, h);
- } else {
- sendmessage.msg_controllen -= CMSG_SPACE(sizeof(int));
- }
- }
-
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Transmitting message (length" << m.d->size() << ')';
-#endif
- ::ssize_t s = ::sendmsg(fd, &sendmessage, MSG_DONTWAIT | MSG_NOSIGNAL);
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Transmitted message (" << s << ')';
-#endif
-
- if(-1 == s) {
- if(EAGAIN == errno || EWOULDBLOCK == errno || EINTR == errno) {
- writeNotifier->setEnabled(true);
- } else if(EPIPE == errno) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Remote side disconnected during transmit "
- "(" << ::strerror(errno) << ')';
-#endif
- me->abort();
- } else {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to transmit data ("
- << ::strerror(errno) << ')';
-#endif
- error = (QUnixSocket::SocketError)(QUnixSocket::WriteFailure |
- CausedAbort);
- me->abort();
- }
- } else if(s != m.d->size()) {
-
- // A partial transmission
- writeNotifier->setEnabled(true);
- delete [] (char *)sendmessage.msg_control;
- m.d->rights = QList<QUnixSocketRights>();
- m.d->removeBytes( s );
- writeQueueBytes -= s;
- emit bytesWritten(s);
- return s;
-
- } else {
-
- // Success!
- writeQueue.dequeue();
- Q_ASSERT(writeQueueBytes >= (unsigned)s);
- writeQueueBytes -= s;
- emit bytesWritten(s);
-
- }
-
- delete [] (char *)sendmessage.msg_control;
- if(-1 != s && !writeQueue.isEmpty())
- return writeActivated();
- else if(QUnixSocket::ClosingState == me->state() && writeQueue.isEmpty())
- me->abort();
-
- if((-1 == s) && (EAGAIN == errno || EWOULDBLOCK == errno || EINTR == errno))
- // Return zero bytes written to indicate retry may be required
- return 0;
- else
- return s;
-}
-
-void QUnixSocketPrivate::readActivated()
-{
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: readActivated";
-#endif
- readNotifier->setEnabled(false);
-
- ::iovec vec;
- vec.iov_base = dataBuffer;
- vec.iov_len = dataBufferCapacity;
-
- bzero(&message, sizeof(::msghdr));
- message.msg_iov = &vec;
- message.msg_iovlen = 1;
- message.msg_controllen = ancillaryBufferCapacity();
- message.msg_control = ancillaryBuffer;
-
- int flags = 0;
-#ifdef MSG_CMSG_CLOEXEC
- flags = MSG_CMSG_CLOEXEC;
-#endif
-
- int recvrv = ::recvmsg(fd, &message, flags);
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Received message (" << recvrv << ')';
-#endif
- if(-1 == recvrv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to receive data ("
- << ::strerror(errno) << ')';
-#endif
- error = (QUnixSocket::SocketError)(QUnixSocket::ReadFailure |
- CausedAbort);
- me->abort();
- } else if(0 == recvrv) {
- me->abort();
- } else {
- Q_ASSERT(recvrv);
- Q_ASSERT((unsigned)recvrv <= dataBufferCapacity);
- dataBufferLength = recvrv;
- messageValid = true;
-
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: readyRead() " << dataBufferLength;
-#endif
- emit readyRead();
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qunixsocket.moc"
diff --git a/src/gui/embedded/qunixsocket_p.h b/src/gui/embedded/qunixsocket_p.h
deleted file mode 100644
index cfa463001f..0000000000
--- a/src/gui/embedded/qunixsocket_p.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QUNIXSOCKET_P_H
-#define QUNIXSOCKET_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/qabstractsocket.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qshareddata.h>
-
-extern "C" {
-#include <sys/types.h>
-};
-
-QT_BEGIN_NAMESPACE
-
-class QUnixSocketRights;
-class QUnixSocketRightsPrivate;
-class QUnixSocketPrivate;
-class QUnixSocketMessagePrivate;
-struct iovec;
-
-class Q_GUI_EXPORT QUnixSocketRights {
-public:
- QUnixSocketRights(int);
- ~QUnixSocketRights();
-
- QUnixSocketRights(const QUnixSocketRights &);
- QUnixSocketRights & operator=(const QUnixSocketRights &);
-
- bool isValid() const;
-
- int dupFd() const;
- int peekFd() const;
-
-private:
- friend class QUnixSocket;
- QUnixSocketRights(int,int);
- QSharedDataPointer<QUnixSocketRightsPrivate> d;
-};
-
-class Q_GUI_EXPORT QUnixSocketMessage {
-public:
- QUnixSocketMessage();
- QUnixSocketMessage(const QByteArray &);
- QUnixSocketMessage(const QByteArray &, const QList<QUnixSocketRights> &);
- QUnixSocketMessage(const QUnixSocketMessage &);
- QUnixSocketMessage(const iovec*, int);
- QUnixSocketMessage & operator=(const QUnixSocketMessage &);
- ~QUnixSocketMessage();
-
- void setBytes(const QByteArray &);
- void setRights(const QList<QUnixSocketRights> &);
-
- const QList<QUnixSocketRights> & rights() const;
- bool rightsWereTruncated() const;
-
- const QByteArray & bytes() const;
-
- pid_t processId() const;
- uid_t userId() const;
- gid_t groupId() const;
-
- void setProcessId(pid_t);
- void setUserId(uid_t);
- void setGroupId(gid_t);
-
- bool isValid() const;
-private:
- friend class QUnixSocket;
- friend class QUnixSocketPrivate;
- QSharedDataPointer<QUnixSocketMessagePrivate> d;
-};
-
-class Q_GUI_EXPORT QUnixSocket : public QIODevice
-{
- Q_OBJECT
-public:
- QUnixSocket(QObject * = 0);
- QUnixSocket(qint64, qint64, QObject * = 0);
- virtual ~QUnixSocket();
-
- enum SocketState {
- UnconnectedState = QAbstractSocket::UnconnectedState,
- HostLookupState = QAbstractSocket::HostLookupState,
- ConnectingState = QAbstractSocket::ConnectingState,
- ConnectedState = QAbstractSocket::ConnectedState,
- BoundState = QAbstractSocket::BoundState,
- ClosingState = QAbstractSocket::ClosingState,
- ListeningState = QAbstractSocket::ListeningState,
- };
-
- enum SocketError { NoError, InvalidPath, ResourceError,
- NonexistentPath, ConnectionRefused, UnknownError,
- ReadFailure, WriteFailure };
-
- bool connect(const QByteArray & path);
- bool setSocketDescriptor(int socketDescriptor);
- int socketDescriptor() const;
- void abort();
- void close();
-
- bool flush();
-
- SocketError error() const;
-
- SocketState state() const;
- QByteArray address() const;
-
- qint64 bytesAvailable() const;
- qint64 bytesToWrite() const;
-
- qint64 readBufferSize() const;
- void setReadBufferSize(qint64 size);
- qint64 rightsBufferSize() const;
- void setRightsBufferSize(qint64 size);
-
- bool canReadLine() const;
-
- qint64 write(const char * data, qint64 maxSize)
- { return QIODevice::write(data, maxSize); }
- qint64 write(const QByteArray & byteArray)
- { return QIODevice::write(byteArray); }
- qint64 read(char * data, qint64 maxSize)
- { return QIODevice::read(data, maxSize); }
- QByteArray read(qint64 maxSize)
- { return QIODevice::read(maxSize); }
-
- qint64 write(const QUnixSocketMessage &);
- QUnixSocketMessage read();
-
- virtual bool isSequential() const;
- virtual bool waitForReadyRead(int msec = 300);
- virtual bool waitForBytesWritten(int msec = 300);
-
-Q_SIGNALS:
- void stateChanged(SocketState socketState);
-
-protected:
- virtual qint64 readData(char * data, qint64 maxSize);
- virtual qint64 writeData (const char * data, qint64 maxSize);
-
-private:
- QUnixSocket(const QUnixSocket &);
- QUnixSocket & operator=(const QUnixSocket &);
-
- QUnixSocketPrivate * d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QUNIXSOCKET_P_H
diff --git a/src/gui/embedded/qunixsocketserver.cpp b/src/gui/embedded/qunixsocketserver.cpp
deleted file mode 100644
index 36060fdd29..0000000000
--- a/src/gui/embedded/qunixsocketserver.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qunixsocketserver_p.h"
-
-// #define QUNIXSOCKETSERVER_DEBUG
-
-#ifdef QUNIXSOCKETSERVER_DEBUG
-#include <QDebug>
-#endif
-
-#include <QtCore/qsocketnotifier.h>
-
-extern "C" {
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <errno.h>
-};
-
-#define UNIX_PATH_MAX 108 // From unix(7)
-
-QT_BEGIN_NAMESPACE
-
-class QUnixSocketServerPrivate : public QObject
-{
-Q_OBJECT
-public:
- QUnixSocketServerPrivate(QUnixSocketServer * parent)
- : QObject(), me(parent), fd(-1), maxConns(30),
- error(QUnixSocketServer::NoError), acceptNotifier(0)
- {}
-
- QUnixSocketServer * me;
- int fd;
- int maxConns;
- QByteArray address;
- QUnixSocketServer::ServerError error;
- QSocketNotifier * acceptNotifier;
-public slots:
- void acceptActivated();
-};
-
-/*!
- \class QUnixSocketServer
- \internal
-
- \brief The QUnixSocketServer class provides a Unix domain socket based server.
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- This class makes it possible to accept incoming Unix domain socket
- connections. Call \l QUnixSocketServer::listen() to have the server listen
- for incoming connections on a specified path. The pure virtual
- \l QUnixSocketServer::incomingConnection() is called each time a new
- connection is established. Users must inherit from QUnixSocketServer and
- implement this method.
-
- If an error occurs, \l QUnixSocketServer::serverError() returns the type of
- error. Errors can only occur during server establishment - that is, during a
- call to \l QUnixSocketServer::listen(). Calling \l QUnixSocketServer::close()
- causes QUnixSocketServer to stop listening for connections and reset its
- state.
-
- QUnixSocketServer is often used in conjunction with the \l QUnixSocket class.
-
- \sa QUnixSocket
-*/
-
-/*!
- \enum QUnixSocketServer::ServerError
-
- The ServerError enumeration represents the errors that can occur during server
- establishment. The most recent error can be retrieved through a call to
- \l QUnixSocketServer::serverError().
-
- \value NoError No error has occurred.
- \value InvalidPath An invalid path endpoint was passed to
- \l QUnixSocketServer::listen(). As defined by unix(7), invalid paths
- include an empty path, or what more than 107 characters long.
- \value ResourceError An error acquiring or manipulating the system's socket
- resources occurred. For example, if the process runs out of available
- socket descriptors, a ResourceError will occur.
- \value BindError The server was unable to bind to the specified path.
- \value ListenError The server was unable to listen on the specified path for
- incoming connections.
- */
-
-/*!
- Create a new Unix socket server with the given \a parent.
- */
-QUnixSocketServer::QUnixSocketServer(QObject *parent)
-: QObject(parent), d(0)
-{
-}
-
-/*!
- Stops listening for incoming connection and destroys the Unix socket server.
- */
-QUnixSocketServer::~QUnixSocketServer()
-{
- close();
- if(d)
- delete d;
-}
-
-/*!
- Stop listening for incoming connections and resets the Unix socket server's
- state. Calling this method while \l {QUnixSocketServer::isListening()}{not listening } for incoming connections is a no-op.
-
- \sa QUnixSocketServer::listen()
- */
-void QUnixSocketServer::close()
-{
- if(!d)
- return;
-
- if(d->acceptNotifier) {
- d->acceptNotifier->setEnabled(false);
- delete d->acceptNotifier;
- }
- d->acceptNotifier = 0;
-
- if(-1 != d->fd) {
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- ::close(d->fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocketServer: Unable to close socket ("
- << strerror(errno) << ')';
- }
-#endif
- }
- d->fd = -1;
- d->address = QByteArray();
- d->error = NoError;
-}
-
-/*!
- Returns the last server error. Errors may only occur within a call to
- \l QUnixSocketServer::listen(), and only when such a call fails.
-
- This method is not destructive, so multiple calls to
- QUnixSocketServer::serverError() will return the same value. The error is
- only reset by an explicit call to \l QUnixSocketServer::close() or
- by further calls to \l QUnixSocketServer::listen().
- */
-QUnixSocketServer::ServerError QUnixSocketServer::serverError() const
-{
- if(!d)
- return NoError;
-
- return d->error;
-}
-
-/*!
- Returns true if this server is listening for incoming connections, false
- otherwise.
-
- \sa QUnixSocketServer::listen()
- */
-bool QUnixSocketServer::isListening() const
-{
- if(!d)
- return false;
-
- return (-1 != d->fd);
-}
-
-/*!
- Tells the server to listen for incoming connections on \a path. Returns true
- if it successfully initializes, false otherwise. In the case of failure, the
- \l QUnixSocketServer::serverError() error status is set accordingly.
-
- Calling this method while the server is already running will result in the
- server begin reset, and then attempting to listen on \a path. This will not
- affect connections established prior to the server being reset, but further
- incoming connections on the previous path will be refused.
-
- The server can be explicitly reset by a call to \l QUnixSocketServer::close().
-
- \sa QUnixSocketServer::close()
- */
-bool QUnixSocketServer::listen(const QByteArray & path)
-{
- if(d) {
- close(); // Any existing server is destroyed
- } else {
- d = new QUnixSocketServerPrivate(this);
- }
-
- if(path.isEmpty() || path.size() > UNIX_PATH_MAX) {
- d->error = InvalidPath;
- return false;
- }
- unlink( path ); // ok if this fails
-
- // Create the socket
- d->fd = ::socket(PF_UNIX, SOCK_STREAM, 0);
- if(-1 == d->fd) {
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Unable to create socket ("
- << strerror(errno) << ')';
-#endif
- close();
- d->error = ResourceError;
- return false;
- }
-
- // Construct our unix address
- struct ::sockaddr_un addr;
- addr.sun_family = AF_UNIX;
- ::memcpy(addr.sun_path, path.data(), path.size());
- if(path.size() < UNIX_PATH_MAX)
- addr.sun_path[path.size()] = '\0';
-
- // Attempt to bind
- if(-1 == ::bind(d->fd, (sockaddr *)&addr, sizeof(sockaddr_un))) {
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Unable to bind socket ("
- << strerror(errno) << ')';
-#endif
- close();
- d->error = BindError;
- return false;
- }
-
- // Listen to socket
- if(-1 == ::listen(d->fd, d->maxConns)) {
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Unable to listen socket ("
- << strerror(errno) << ')';
-#endif
- close();
- d->error = ListenError;
- return false;
- }
-
- // Success!
- d->address = path;
- d->acceptNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d);
- d->acceptNotifier->setEnabled(true);
- QObject::connect(d->acceptNotifier, SIGNAL(activated(int)),
- d, SLOT(acceptActivated()));
-
- return true;
-}
-
-/*!
- Returns the Unix path on which this server is listening. If this server is
- not listening, and empty address will be returned.
- */
-QByteArray QUnixSocketServer::serverAddress() const
-{
- if(!d)
- return QByteArray();
- return d->address;
-}
-
-int QUnixSocketServer::socketDescriptor() const
-{
- if (!d)
- return -1;
- return d->fd;
-}
-
-
-/*!
- Returns the maximum length the queue of pending connections may grow to. That
- is, the maximum number of clients attempting to connect for which the Unix
- socket server has not yet accepted and passed to
- \l QUnixSocketServer::incomingConnection(). If a connection request arrives
- with the queue full, the client may receive a connection refused notification.
-
- By default a queue length of 30 is used.
-
- \sa QUnixSocketServer::setMaxPendingConnections()
- */
-int QUnixSocketServer::maxPendingConnections() const
-{
- if(!d)
- return 30;
-
- return d->maxConns;
-}
-
-/*!
- Sets the maximum length the queue of pending connections may grow to
- \a numConnections. This value will only apply to
- \l QUnixSocketServer::listen() calls made following the value change - it will
- not be retroactively applied.
-
- \sa QUnixSocketServer::maxPendingConnections()
- */
-void QUnixSocketServer::setMaxPendingConnections(int numConnections)
-{
- Q_ASSERT(numConnections >= 1);
- if(!d)
- d = new QUnixSocketServerPrivate(this);
-
- d->maxConns = numConnections;
-}
-
-/*!
- \fn void QUnixSocketServer::incomingConnection(int socketDescriptor)
-
- This method is invoked each time a new incoming connection is established with
- the server. Clients must reimplement this function in their QUnixSocketServer
- derived class to handle the connection.
-
- A common approach to handling the connection is to pass \a socketDescriptor to
- a QUnixSocket instance.
-
- \sa QUnixSocket
- */
-
-void QUnixSocketServerPrivate::acceptActivated()
-{
- ::sockaddr_un r;
- socklen_t len = sizeof(sockaddr_un);
- int connsock = ::accept(fd, (sockaddr *)&r, &len);
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Accept connection " << connsock;
-#endif
- if(-1 != connsock)
- me->incomingConnection(connsock);
-}
-
-QT_END_NAMESPACE
-
-#include "qunixsocketserver.moc"
diff --git a/src/gui/embedded/qunixsocketserver_p.h b/src/gui/embedded/qunixsocketserver_p.h
deleted file mode 100644
index d7b0a45782..0000000000
--- a/src/gui/embedded/qunixsocketserver_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QUNIXSOCKETSERVER_P_H
-#define QUNIXSOCKETSERVER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-
-QT_BEGIN_NAMESPACE
-
-class QUnixSocketServerPrivate;
-class Q_GUI_EXPORT QUnixSocketServer : public QObject
-{
- Q_OBJECT
-public:
- enum ServerError { NoError, InvalidPath, ResourceError, BindError,
- ListenError };
-
- QUnixSocketServer(QObject *parent=0);
- virtual ~QUnixSocketServer();
-
- void close();
-
- ServerError serverError() const;
-
- bool isListening() const;
- bool listen(const QByteArray & path);
-
- int socketDescriptor() const;
- QByteArray serverAddress() const;
-
- int maxPendingConnections() const;
- void setMaxPendingConnections(int numConnections);
-
-protected:
- virtual void incomingConnection(int socketDescriptor) = 0;
-
-private:
- QUnixSocketServer(const QUnixSocketServer &);
- QUnixSocketServer & operator=(const QUnixSocketServer &);
-
- friend class QUnixSocketServerPrivate;
- QUnixSocketServerPrivate * d;
-};
-
-
-QT_END_NAMESPACE
-#endif // QUNIXSOCKETSERVER_P_H
-
diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h
deleted file mode 100644
index 84f82acd69..0000000000
--- a/src/gui/embedded/qvfbhdr.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVFBHDR_H
-#define QVFBHDR_H
-
-#include <QtGui/qcolor.h>
-#include <QtGui/qwindowdefs.h>
-#include <QtCore/qrect.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_QWS_TEMP_DIR
-# define QT_QWS_TEMP_DIR QLatin1String("/tmp")
-#endif
-
-#ifdef QT_PRIVATE_QWS
-#define QT_VFB_DATADIR(DISPLAY) QString::fromLatin1("%1/qtembedded-%2-%3") \
- .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY)
-#define QT_VFB_MOUSE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qtvfb_mouse"))
-#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qtvfb_keyboard"))
-#define QT_VFB_MAP(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qtvfb_map"))
-#define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qt_soundserver"))
-#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/QtEmbedded"))
-#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY)
-#else
-#define QT_VFB_DATADIR(DISPLAY) QString::fromLatin1("%1/qtembedded-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_MOUSE_PIPE(DISPLAY) QString::fromLatin1("%1/.qtvfb_mouse-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QString::fromLatin1("%1/.qtvfb_keyboard-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_MAP(DISPLAY) QString::fromLatin1("%1/.qtvfb_map-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_SOUND_PIPE(DISPLAY) QString::fromLatin1("%1/.qt_soundserver-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/QtEmbedded-%1")).arg(DISPLAY)
-#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY)
-#endif
-
-struct QVFbHeader
-{
- int width;
- int height;
- int depth;
- int linestep;
- int dataoffset;
- QRect update;
- bool dirty;
- int numcols;
- QRgb clut[256];
- int viewerVersion;
- int serverVersion;
- int brightness; // since 4.4.0
- WId windowId; // since 4.5.0
-};
-
-struct QVFbKeyData
-{
- unsigned int keycode;
- Qt::KeyboardModifiers modifiers;
- unsigned short int unicode;
- bool press;
- bool repeat;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QVFBHDR_H
diff --git a/src/gui/embedded/qwindowsystem_p.h b/src/gui/embedded/qwindowsystem_p.h
deleted file mode 100644
index 31190033f2..0000000000
--- a/src/gui/embedded/qwindowsystem_p.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSYSTEM_QWS_P_H
-#define QWINDOWSYSTEM_QWS_P_H
-
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QWSServer class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qobject_p.h"
-#include "qwindowsystem_qws.h"
-#include "qbrush.h"
-#include "qwsproperty_qws.h"
-#include "qwscommand_qws_p.h"
-#include "QtCore/qbasictimer.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWSServerPrivate : public QObjectPrivate {
- friend class QCopChannel;
- friend class QWSMouseHandler;
- friend class QWSWindow;
- friend class QWSDisplay;
- friend class QWSInputMethod;
- Q_DECLARE_PUBLIC(QWSServer)
-
-public:
- QWSServerPrivate()
- : screensaverintervals(0)
- , screensavereventblocklevel(-1), screensaverblockevents(false)
- , saver(0), cursorClient(0), mouseState(0), nReserved(0)
- , doClientIsActive(false)
- {
- }
- ~QWSServerPrivate()
- {
- closeDisplay();
-
- qDeleteAll(deletedWindows);
- delete [] screensaverintervals;
- delete saver;
-
- qDeleteAll(windows);
- windows.clear();
-
- delete bgBrush;
- bgBrush = 0;
- }
- QTime screensavertime;
- QTimer* screensavertimer;
- int* screensaverintervals;
- int screensavereventblocklevel;
- bool screensaverblockevents;
- bool screensaverblockevent( int index, int *screensaverinterval, bool isDown );
- QWSScreenSaver* saver;
- QWSClient *cursorClient;
- int mouseState;
-// bool prevWin;
- QList<QWSWindow*> deletedWindows;
- QList<int> crashedClientIds;
-
- void update_regions();
-//private functions moved from class
-
-private:
- void initServer(int flags);
-#ifndef QT_NO_COP
- static void sendQCopEvent(QWSClient *c, const QString &ch,
- const QString &msg, const QByteArray &data,
- bool response = false);
-#endif
- void move_region(const QWSRegionMoveCommand *);
- void set_altitude(const QWSChangeAltitudeCommand *);
- void set_opacity(const QWSSetOpacityCommand *);
- void request_focus(const QWSRequestFocusCommand *);
- QRegion reserve_region(QWSWindow *window, const QRegion &region);
- void request_region(int winId, const QString &surfaceKey,
- const QByteArray &surfaceData,
- const QRegion &region);
- void repaint_region(int winId, int windowFlags, bool opaque, const QRegion &);
- void destroy_region(const QWSRegionDestroyCommand *);
- void name_region(const QWSRegionNameCommand *);
- void set_identity(const QWSIdentifyCommand *);
-#ifndef QT_NO_QWS_PROPERTIES
- bool get_property(int winId, int property, const char *&data, int &len);
-#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
- void im_response(const QWSIMResponseCommand *);
-
- void im_update(const QWSIMUpdateCommand *);
-
- void send_im_mouse(const QWSIMMouseCommand *);
-#endif
- // not in ifndef as this results in more readable functions.
- static void sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat);
- static void sendMouseEventUnfiltered(const QPoint &pos, int state, int wheel = 0);
- static void emergency_cleanup();
-
- static QBrush *bgBrush;
-
- void sendMaxWindowRectEvents(const QRect &rect);
-
- void invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client);
- void invokeCreate(QWSCreateCommand *cmd, QWSClient *client);
- void invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client);
- void invokeRegion(QWSRegionCommand *cmd, QWSClient *client);
- void invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client);
- void invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client);
- void invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, QWSClient *client);
- void invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client);
-#ifndef QT_NO_QWS_PROPERTIES
- void invokeAddProperty(QWSAddPropertyCommand *cmd);
- void invokeSetProperty(QWSSetPropertyCommand *cmd);
- void invokeRemoveProperty(QWSRemovePropertyCommand *cmd);
- void invokeGetProperty(QWSGetPropertyCommand *cmd, QWSClient *client);
-#endif //QT_NO_QWS_PROPERTIES
- void invokeSetSelectionOwner(QWSSetSelectionOwnerCommand *cmd);
- void invokeConvertSelection(QWSConvertSelectionCommand *cmd);
- void invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client);
-
- void initIO();
- void setFocus(QWSWindow*, bool gain);
-#ifndef QT_NO_QWS_CURSOR
- void invokeDefineCursor(QWSDefineCursorCommand *cmd, QWSClient *client);
- void invokeSelectCursor(QWSSelectCursorCommand *cmd, QWSClient *client);
- void invokePositionCursor(QWSPositionCursorCommand *cmd, QWSClient *client);
-#endif
- void invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client);
- void invokeGrabKeyboard(QWSGrabKeyboardCommand *cmd, QWSClient *client);
-#ifndef QT_NO_SOUND
- void invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *client);
-#endif
-#ifndef QT_NO_COP
- void invokeRegisterChannel(QWSQCopRegisterChannelCommand *cmd,
- QWSClient *client);
- void invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client);
-#endif
- void invokeRepaintRegion(QWSRepaintRegionCommand *cmd,
- QWSClient *client);
-#ifndef QT_NO_QWSEMBEDWIDGET
- void invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client);
-#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
- void invokeIMResponse(const QWSIMResponseCommand *cmd,
- QWSClient *client);
- void invokeIMUpdate(const QWSIMUpdateCommand *cmd,
- QWSClient *client);
-#endif
- void invokeFont(const QWSFontCommand *cmd, QWSClient *client);
- void invokeScreenTransform(const QWSScreenTransformCommand *cmd,
- QWSClient *client);
-
- QWSMouseHandler* newMouseHandler(const QString& spec);
- void openDisplay();
- void closeDisplay();
-
- void showCursor();
- void hideCursor();
- void initializeCursor();
-
- void resetEngine();
-
-//private Q_SLOTS:
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- void _q_clientClosed();
- void _q_doClient();
- void _q_deleteWindowsLater();
-#endif
-
- void _q_screenSaverWake();
- void _q_screenSaverSleep();
- void _q_screenSaverTimeout();
-#ifndef QT_NO_QWS_MULTIPROCESS
- void _q_newConnection();
-#endif
-
-//other private moved from class
-
- void disconnectClient(QWSClient *);
- void screenSave(int level);
- void doClient(QWSClient *);
- typedef QMap<int,QWSClient*>::Iterator ClientIterator;
- typedef QMap<int,QWSClient*> ClientMap;
- void handleWindowClose(QWSWindow *w);
- void releaseMouse(QWSWindow* w);
- void releaseKeyboard(QWSWindow* w);
- void updateClientCursorPos();
-
- uchar* sharedram;
- int ramlen;
-
- ClientMap clientMap;
-#ifndef QT_NO_QWS_PROPERTIES
- QWSPropertyManager propertyManager;
-#endif
- struct SelectionOwner {
- int windowid;
- struct Time {
- void set(int h, int m, int s, int s2) {
- hour = h; minute = m; sec = s; ms = s2;
- }
- int hour, minute, sec, ms;
- } time;
- } selectionOwner;
- QTime timer;
- int* screensaverinterval;
-
- QWSWindow *focusw;
- QWSWindow *mouseGrabber;
- bool mouseGrabbing;
- bool inputMethodMouseGrabbed;
- int swidth, sheight, sdepth;
-#ifndef QT_NO_QWS_CURSOR
- bool haveviscurs;
- QWSCursor *cursor; // cursor currently shown
- QWSCursor *nextCursor; // cursor to show once grabbing is off
-#endif
-
- bool disablePainting;
- QList<QWSMouseHandler*> mousehandlers;
-#ifndef QT_NO_QWS_KEYBOARD
- QList<QWSKeyboardHandler*> keyboardhandlers;
-#endif
-
- QList<QWSCommandStruct*> commandQueue;
-
- // Window management
- QList<QWSWindow*> windows; // first=topmost
- int nReserved;
- QWSWindow* newWindow(int id, QWSClient* client);
- QWSWindow* findWindow(int windowid, QWSClient* client = 0);
- void moveWindowRegion(QWSWindow*, int dx, int dy);
- void setWindowRegion(QWSWindow*, const QRegion &r);
- void raiseWindow(QWSWindow *, int = 0);
- void lowerWindow(QWSWindow *, int = -1);
- void exposeRegion(const QRegion &, int index = 0);
-
- void setCursor(QWSCursor *curs);
-
- // multimedia
-#ifndef QT_NO_SOUND
- QWSSoundServer *soundserver;
-#endif
-#ifndef QT_NO_COP
- QMap<QString, QList<QWSClient*> > channels;
-#endif
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- QWSServerSocket *ssocket;
-#endif
-
- // filename -> refcount
- QMap<QByteArray, int> fontReferenceCount;
- QBasicTimer fontCleanupTimer;
- void referenceFont(QWSClientPrivate *client, const QByteArray &font);
- void dereferenceFont(QWSClientPrivate *client, const QByteArray &font);
- void cleanupFonts(bool force = false);
- void sendFontRemovedEvent(const QByteArray &font);
-
- bool doClientIsActive;
- QList<QWSClient*> pendingDoClients;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp
deleted file mode 100644
index 0d1ae0d2d2..0000000000
--- a/src/gui/embedded/qwindowsystem_qws.cpp
+++ /dev/null
@@ -1,4960 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-
-#include "qwindowsystem_qws.h"
-#include "qwsevent_qws.h"
-#include "qwscommand_qws_p.h"
-#include "qtransportauth_qws_p.h"
-#include "qwsutils_qws.h"
-#include "qwscursor_qws.h"
-#include "qwsdisplay_qws.h"
-#include "qmouse_qws.h"
-#include "qcopchannel_qws.h"
-#include "qwssocket_qws.h"
-
-#include "qapplication.h"
-#include "private/qapplication_p.h"
-#include "qsocketnotifier.h"
-#include "qpolygon.h"
-#include "qimage.h"
-#include "qcursor.h"
-#include <private/qpaintengine_raster_p.h>
-#include "qscreen_qws.h"
-#include "qwindowdefs.h"
-#include "private/qlock_p.h"
-#include "qwslock_p.h"
-#include "qfile.h"
-#include "qtimer.h"
-#include "qpen.h"
-#include "qdesktopwidget.h"
-#include "qevent.h"
-#include "qinputcontext.h"
-#include "qpainter.h"
-
-#include <qdebug.h>
-
-#include "qkbddriverfactory_qws.h"
-#include "qmousedriverfactory_qws.h"
-
-#include <qbuffer.h>
-#include <qdir.h>
-
-#include <private/qwindowsurface_qws_p.h>
-#include <private/qfontengine_qpf_p.h>
-
-#include "qwindowsystem_p.h"
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-#include <sys/param.h>
-#include <sys/mount.h>
-#endif
-
-#if !defined(QT_NO_SOUND) && !defined(Q_OS_DARWIN)
-#ifdef QT_USE_OLD_QWS_SOUND
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#else
-#include "qsoundqss_qws.h"
-#endif
-#endif
-
-//#define QWS_DEBUG_FONTCLEANUP
-
-QT_BEGIN_NAMESPACE
-
-QWSServer Q_GUI_EXPORT *qwsServer=0;
-static QWSServerPrivate *qwsServerPrivate=0;
-
-#define MOUSE 0
-#define KEY 1
-//#define EVENT_BLOCK_DEBUG
-
-QWSScreenSaver::~QWSScreenSaver()
-{
-}
-
-extern QByteArray qws_display_spec;
-extern void qt_init_display(); //qapplication_qws.cpp
-extern QString qws_qtePipeFilename();
-
-extern void qt_client_enqueue(const QWSEvent *); //qapplication_qws.cpp
-extern QList<QWSCommand*> *qt_get_server_queue();
-
-Q_GLOBAL_STATIC_WITH_ARGS(QString, defaultMouse, (QLatin1String("Auto")))
-Q_GLOBAL_STATIC_WITH_ARGS(QString, defaultKeyboard, (QLatin1String("TTY")))
-static const int FontCleanupInterval = 60 * 1000;
-
-static int qws_keyModifiers = 0;
-
-static QWSWindow *keyboardGrabber;
-static bool keyboardGrabbing;
-
-static int get_object_id(int count = 1)
-{
- static int next=1000;
- int n = next;
- next += count;
- return n;
-}
-#ifndef QT_NO_QWS_INPUTMETHODS
-static QWSInputMethod *current_IM = 0;
-
-static QWSWindow *current_IM_composing_win = 0;
-static int current_IM_winId = -1;
-static bool force_reject_strokeIM = false;
-#endif
-
-static void cleanupFontsDir();
-
-//#define QWS_REGION_DEBUG
-
-/*!
- \class QWSScreenSaver
- \ingroup qws
-
- \brief The QWSScreenSaver class is a base class for screensavers
- in Qt for Embedded Linux.
-
- When running \l{Qt for Embedded Linux} applications, it is the server
- application that installs and controls the screensaver.
- \l{Qt for Embedded Linux} supports multilevel screen saving; i.e., it is possible to
- specify several different levels of screen responsiveness. For
- example, you can choose to first turn off the light before you
- fully activate the screensaver.
-
- Note that there exists no default screensaver implementation.
-
- To create a custom screensaver, derive from this class and
- reimplement the restore() and save() functions. These functions
- are called whenever the screensaver is activated or deactivated,
- respectively. Once an instance of your custom screensaver is
- created, you can use the QWSServer::setScreenSaver() function to
- install it.
-
- \sa QWSServer, QScreen, {Qt for Embedded Linux}
-*/
-
-/*!
- \fn QWSScreenSaver::~QWSScreenSaver()
-
- Reimplement this function to destroy the screensaver.
-*/
-
-/*!
- \fn QWSScreenSaver::restore()
-
- Implement this function to deactivate the screensaver, restoring
- the previously saved screen.
-
- \sa save(), QWSServer::screenSaverActivate()
-*/
-
-/*!
- \fn QWSScreenSaver::save(int level)
-
- Implement this function to activate the screensaver, saving the
- current screen.
-
- \l{Qt for Embedded Linux} supports multilevel screen saving; i.e., it is
- possible to specify several different levels of screen
- responsiveness. For example, you can choose to first turn off the
- light before you fully activate the screensaver. Use the
- QWSServer::setScreenSaverIntervals() to specify the time intervals
- between the different levels.
-
- This function should return true if the screensaver successfully
- enters the given \a level; otherwise it should return false.
-
- \sa restore(), QWSServer::screenSaverActivate()
-*/
-
-class QWSWindowPrivate
-{
-public:
- QWSWindowPrivate();
-
-#ifdef QT_QWS_CLIENTBLIT
- QRegion directPaintRegion;
-#endif
- QRegion allocatedRegion;
-#ifndef QT_NO_QWSEMBEDWIDGET
- QList<QWSWindow*> embedded;
- QWSWindow *embedder;
-#endif
- QWSWindow::State state;
- Qt::WindowFlags windowFlags;
- QRegion dirtyOnScreen;
- bool painted;
-};
-
-QWSWindowPrivate::QWSWindowPrivate()
- :
-#ifndef QT_NO_QWSEMBEDWIDGET
- embedder(0), state(QWSWindow::NoState),
-#endif
- painted(false)
-{
-}
-
-/*!
- \class QWSWindow
- \ingroup qws
-
- \brief The QWSWindow class encapsulates a top-level window in
- Qt for Embedded Linux.
-
- When you run a \l{Qt for Embedded Linux} application, it either runs as a
- server or connects to an existing server. As applications add and
- remove windows, the server process maintains information about
- each window. In \l{Qt for Embedded Linux}, top-level windows are
- encapsulated as QWSWindow objects. Note that you should never
- construct the QWSWindow class yourself; the current top-level
- windows can be retrieved using the QWSServer::clientWindows()
- function.
-
- With a window at hand, you can retrieve its caption, name, opacity
- and ID using the caption(), name(), opacity() and winId()
- functions, respectively. Use the client() function to retrieve a
- pointer to the client that owns the window.
-
- Use the isVisible() function to find out if the window is
- visible. You can find out if the window is completely obscured by
- another window or by the bounds of the screen, using the
- isFullyObscured() function. The isOpaque() function returns true
- if the window has an alpha channel equal to 255. Finally, the
- requestedRegion() function returns the region of the display the
- window wants to draw on.
-
- \sa QWSServer, QWSClient, {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- \fn int QWSWindow::winId() const
-
- Returns the window's ID.
-
- \sa name(), caption()
-*/
-
-/*!
- \fn const QString &QWSWindow::name() const
-
- Returns the window's name, which is taken from the \l {QWidget::}{objectName()}
- at the time of \l {QWidget::}{show()}.
-
- \sa caption(), winId()
-*/
-
-/*!
- \fn const QString &QWSWindow::caption() const
-
- Returns the window's caption.
-
- \sa name(), winId()
-*/
-
-/*!
- \fn QWSClient* QWSWindow::client() const
-
- Returns a reference to the QWSClient object that owns this window.
-
- \sa requestedRegion()
-*/
-
-/*!
- \fn QRegion QWSWindow::requestedRegion() const
-
- Returns the region that the window has requested to draw onto,
- including any window decorations.
-
- \sa client()
-*/
-
-/*!
- \fn bool QWSWindow::isVisible() const
-
- Returns true if the window is visible; otherwise returns false.
-
- \sa isFullyObscured()
-*/
-
-/*!
- \fn bool QWSWindow::isOpaque() const
-
- Returns true if the window is opaque, i.e., if its alpha channel
- equals 255; otherwise returns false.
-
- \sa opacity()
-*/
-
-/*!
- \fn uint QWSWindow::opacity () const
-
- Returns the window's alpha channel value.
-
- \sa isOpaque()
-*/
-
-/*!
- \fn bool QWSWindow::isPartiallyObscured() const
- \internal
-
- Returns true if the window is partially obsured by another window
- or by the bounds of the screen; otherwise returns false.
-*/
-
-/*!
- \fn bool QWSWindow::isFullyObscured() const
-
- Returns true if the window is completely obsured by another window
- or by the bounds of the screen; otherwise returns false.
-
- \sa isVisible()
-*/
-
-/*!
- \fn QWSWindowSurface* QWSWindow::windowSurface() const
- \internal
-*/
-
-QWSWindow::QWSWindow(int i, QWSClient* client)
- : id(i), modified(false),
- onTop(false), c(client), last_focus_time(0), _opacity(255),
- opaque(true), d(new QWSWindowPrivate)
-{
- surface = 0;
-}
-
-
-/*!
- \enum QWSWindow::State
-
- This enum describes the state of a window. Most of the
- transitional states are set just before a call to
- QScreen::exposeRegion() and reset immediately afterwards.
-
- \value NoState Initial state before the window is properly initialized.
- \value Hidden The window is not visible.
- \value Showing The window is being shown.
- \value Visible The window is visible, and not in a transition.
- \value Hiding The window is being hidden.
- \value Raising The windoe is being raised.
- \value Lowering The window is being raised.
- \value Moving The window is being moved.
- \value ChangingGeometry The window's geometry is being changed.
- \value Destroyed The window is destroyed.
-
- \sa state(), QScreen::exposeRegion()
-*/
-
-/*!
- Returns the current state of the window.
-
- \since 4.3
-*/
-QWSWindow::State QWSWindow::state() const
-{
- return d->state;
-}
-
-/*!
- Returns the window flags of the window. This value is only available
- after the first paint event.
-
- \since 4.3
-*/
-Qt::WindowFlags QWSWindow::windowFlags() const
-{
- return d->windowFlags;
-}
-
-/*!
- Returns the region that has been repainted since the previous
- QScreen::exposeRegion(), and needs to be copied to the screen.
- \since 4.3
-*/
-QRegion QWSWindow::dirtyOnScreen() const
-{
- return d->dirtyOnScreen;
-}
-
-void QWSWindow::createSurface(const QString &key, const QByteArray &data)
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (surface && !surface->isBuffered())
- c->removeUnbufferedSurface();
-#endif
-
- delete surface;
- surface = qt_screen->createSurface(key);
- surface->setPermanentState(data);
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (!surface->isBuffered())
- c->addUnbufferedSurface();
-#endif
-}
-
-/*!
- \internal
- Raises the window above all other windows except "Stay on top" windows.
-*/
-void QWSWindow::raise()
-{
- qwsServerPrivate->raiseWindow(this);
-#ifndef QT_NO_QWSEMBEDWIDGET
- const int n = d->embedded.size();
- for (int i = 0; i < n; ++i)
- d->embedded.at(i)->raise();
-#endif
-}
-
-/*!
- \internal
- Lowers the window below other windows.
-*/
-void QWSWindow::lower()
-{
- qwsServerPrivate->lowerWindow(this);
-#ifndef QT_NO_QWSEMBEDWIDGET
- const int n = d->embedded.size();
- for (int i = 0; i < n; ++i)
- d->embedded.at(i)->lower();
-#endif
-}
-
-/*!
- \internal
- Shows the window.
-*/
-void QWSWindow::show()
-{
- operation(QWSWindowOperationEvent::Show);
-#ifndef QT_NO_QWSEMBEDWIDGET
- const int n = d->embedded.size();
- for (int i = 0; i < n; ++i)
- d->embedded.at(i)->show();
-#endif
-}
-
-/*!
- \internal
- Hides the window.
-*/
-void QWSWindow::hide()
-{
- operation(QWSWindowOperationEvent::Hide);
-#ifndef QT_NO_QWSEMBEDWIDGET
- const int n = d->embedded.size();
- for (int i = 0; i < n; ++i)
- d->embedded.at(i)->hide();
-#endif
-}
-
-/*!
- \internal
- Make this the active window (i.e., sets the keyboard focus to this
- window).
-*/
-void QWSWindow::setActiveWindow()
-{
- qwsServerPrivate->setFocus(this, true);
-#ifndef QT_NO_QWSEMBEDWIDGET
- const int n = d->embedded.size();
- for (int i = 0; i < n; ++i)
- d->embedded.at(i)->setActiveWindow();
-#endif
-}
-
-void QWSWindow::setName(const QString &n)
-{
- rgnName = n;
-}
-
-/*!
- \internal
- Sets the window's caption to \a c.
-*/
-void QWSWindow::setCaption(const QString &c)
-{
- rgnCaption = c;
-}
-
-
-static int global_focus_time_counter=100;
-
-void QWSWindow::focus(bool get)
-{
- if (get)
- last_focus_time = global_focus_time_counter++;
- if (c) {
- QWSFocusEvent event;
- event.simpleData.window = id;
- event.simpleData.get_focus = get;
- c->sendEvent(&event);
- }
-}
-
-void QWSWindow::operation(QWSWindowOperationEvent::Operation o)
-{
- if (!c)
- return;
- QWSWindowOperationEvent event;
- event.simpleData.window = id;
- event.simpleData.op = o;
- c->sendEvent(&event);
-}
-
-/*!
- \internal
- Destructor.
-*/
-QWSWindow::~QWSWindow()
-{
-#ifndef QT_NO_QWS_INPUTMETHODS
- if (current_IM_composing_win == this)
- current_IM_composing_win = 0;
-#endif
-#ifndef QT_NO_QWSEMBEDWIDGET
- QWSWindow *embedder = d->embedder;
- if (embedder) {
- embedder->d->embedded.removeAll(this);
- d->embedder = 0;
- }
- while (!d->embedded.isEmpty())
- stopEmbed(d->embedded.first());
-#endif
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (surface && !surface->isBuffered()) {
- if (c && c->d_func()) // d_func() will be 0 if client is deleted
- c->removeUnbufferedSurface();
- }
-#endif
-
- delete surface;
- delete d;
-}
-
-/*!
- \internal
-
- Returns the region that the window is allowed to draw onto,
- including any window decorations but excluding regions covered by
- other windows.
-
- \sa paintedRegion(), requestedRegion()
-*/
-QRegion QWSWindow::allocatedRegion() const
-{
- return d->allocatedRegion;
-}
-
-#ifdef QT_QWS_CLIENTBLIT
-QRegion QWSWindow::directPaintRegion() const
-{
- return d->directPaintRegion;
-}
-
-inline void QWSWindow::setDirectPaintRegion(const QRegion &r)
-{
- d->directPaintRegion = r;
-}
-#endif
-
-/*!
- \internal
-
- Returns the region that the window is known to have drawn into.
-
- \sa allocatedRegion(), requestedRegion()
-*/
-QRegion QWSWindow::paintedRegion() const
-{
- return (d->painted ? d->allocatedRegion : QRegion());
-}
-
-inline void QWSWindow::setAllocatedRegion(const QRegion &region)
-{
- d->allocatedRegion = region;
-}
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-inline void QWSWindow::startEmbed(QWSWindow *w)
-{
- d->embedded.append(w);
- w->d->embedder = this;
-}
-
-inline void QWSWindow::stopEmbed(QWSWindow *w)
-{
- w->d->embedder = 0;
- w->client()->sendEmbedEvent(w->winId(), QWSEmbedEvent::Region, QRegion());
- d->embedded.removeAll(w);
-}
-#endif // QT_NO_QWSEMBEDWIDGET
-
-/*********************************************************************
- *
- * Class: QWSClient
- *
- *********************************************************************/
-
-class QWSClientPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QWSClient)
-
-public:
- QWSClientPrivate();
- ~QWSClientPrivate();
-
- void setLockId(int id);
- void unlockCommunication();
-
-private:
-#ifndef QT_NO_QWS_MULTIPROCESS
- QWSLock *clientLock;
- bool shutdown;
- int numUnbufferedSurfaces;
-#endif
- QSet<QByteArray> usedFonts;
- friend class QWSServerPrivate;
-};
-
-QWSClientPrivate::QWSClientPrivate()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- clientLock = 0;
- shutdown = false;
- numUnbufferedSurfaces = 0;
-#endif
-}
-
-QWSClientPrivate::~QWSClientPrivate()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- delete clientLock;
-#endif
-}
-
-void QWSClientPrivate::setLockId(int id)
-{
-#ifdef QT_NO_QWS_MULTIPROCESS
- Q_UNUSED(id);
-#else
- clientLock = new QWSLock(id);
-#endif
-}
-
-void QWSClientPrivate::unlockCommunication()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (clientLock)
- clientLock->unlock(QWSLock::Communication);
-#endif
-}
-
-/*!
- \class QWSClient
- \ingroup qws
-
- \brief The QWSClient class encapsulates a client process in Qt for Embedded Linux.
-
- When you run a \l{Qt for Embedded Linux} application, it either runs as a
- server or connects to an existing server. The server and client
- processes have different responsibilities: The client process
- performs all application specific operations. The server process
- is responsible for managing the clients as well as taking care of
- the pointer handling, character input, and screen output. In
- addition, the server provides functionality to handle input
- methods.
-
- As applications add and remove windows, the server process
- maintains information about each window. In \l{Qt for Embedded Linux},
- top-level windows are encapsulated as QWSWindow objects. A list of
- the current windows can be retrieved using the
- QWSServer::clientWindows() function, and each window can tell
- which client that owns it through its QWSWindow::client()
- function.
-
- A QWSClient object has an unique ID that can be retrieved using
- its clientId() function. QWSClient also provides the identity()
- function which typically returns the name of this client's running
- application.
-
- \sa QWSServer, QWSWindow, {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- \internal
-*/
-//always use frame buffer
-QWSClient::QWSClient(QObject* parent, QWS_SOCK_BASE* sock, int id)
- : QObject(*new QWSClientPrivate, parent), command(0), cid(id)
-{
-#ifdef QT_NO_QWS_MULTIPROCESS
- Q_UNUSED(sock);
- isClosed = false;
-#else
- csocket = 0;
- if (!sock) {
- socketDescriptor = -1;
- isClosed = false;
- } else {
- csocket = static_cast<QWSSocket*>(sock); //###
- isClosed = false;
-
- csocket->flush();
- socketDescriptor = csocket->socketDescriptor();
- connect(csocket, SIGNAL(readyRead()), this, SIGNAL(readyRead()));
- connect(csocket, SIGNAL(disconnected()), this, SLOT(closeHandler()));
- connect(csocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(errorHandler()));
- }
-#endif //QT_NO_QWS_MULTIPROCESS
-}
-
-/*!
- \internal
-*/
-QWSClient::~QWSClient()
-{
- qDeleteAll(cursors);
- delete command;
-#ifndef QT_NO_QWS_MULTIPROCESS
- delete csocket;
-#endif
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSClient::removeUnbufferedSurface()
-{
- Q_D(QWSClient);
- --d->numUnbufferedSurfaces;
-}
-
-void QWSClient::addUnbufferedSurface()
-{
- Q_D(QWSClient);
- ++d->numUnbufferedSurfaces;
-}
-#endif // QT_NO_QWS_MULTIPROCESS
-
-/*!
- \internal
-*/
-void QWSClient::setIdentity(const QString& i)
-{
- id = i;
-}
-
-void QWSClient::closeHandler()
-{
- isClosed = true;
- emit connectionClosed();
-}
-
-void QWSClient::errorHandler()
-{
-#if defined(QWS_SOCKET_DEBUG)
- qDebug("Client %p error %s", this, csocket ? csocket->errorString().toLatin1().constData() : "(no socket)");
-#endif
- isClosed = true;
-//####Do we need to clean out the pipes?
-
- emit connectionClosed();
-}
-
-/*!
- \internal
-*/
-int QWSClient::socket() const
-{
- return socketDescriptor;
-}
-
-/*!
- \internal
-*/
-void QWSClient::sendEvent(QWSEvent* event)
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket) {
- // qDebug() << "QWSClient::sendEvent type " << event->type << " socket state " << csocket->state();
- if ((QAbstractSocket::SocketState)(csocket->state()) == QAbstractSocket::ConnectedState) {
- event->write(csocket);
- }
- }
- else
-#endif
- {
- qt_client_enqueue(event);
- }
-}
-
-/*!
- \internal
-*/
-void QWSClient::sendRegionEvent(int winid, QRegion rgn, int type
-#ifdef QT_QWS_CLIENTBLIT
- , int id
-#endif
- )
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- Q_D(QWSClient);
- if (d->clientLock)
- d->clientLock->lock(QWSLock::RegionEvent);
-#endif
-
- QWSRegionEvent event;
- event.setData(winid, rgn, type);
-#ifdef QT_QWS_CLIENTBLIT
- event.simpleData.id = id;
-#endif
-
-// qDebug() << "Sending Region event to" << winid << "rgn" << rgn << "type" << type;
-
- sendEvent(&event);
-}
-
-extern int qt_servershmid;
-
-/*!
- \internal
-*/
-void QWSClient::sendConnectedEvent(const char *display_spec)
-{
- QWSConnectedEvent event;
- event.simpleData.window = 0;
- event.simpleData.len = strlen(display_spec) + 1;
- event.simpleData.clientId = cid;
- event.simpleData.servershmid = qt_servershmid;
- char * tmp=(char *)display_spec;
- event.setData(tmp, event.simpleData.len);
- sendEvent(&event);
-}
-
-/*!
- \internal
-*/
-void QWSClient::sendMaxWindowRectEvent(const QRect &rect)
-{
- QWSMaxWindowRectEvent event;
- event.simpleData.window = 0;
- event.simpleData.rect = rect;
- sendEvent(&event);
-}
-
-/*!
- \internal
-*/
-#ifndef QT_NO_QWS_PROPERTIES
-void QWSClient::sendPropertyNotifyEvent(int property, int state)
-{
- QWSPropertyNotifyEvent event;
- event.simpleData.window = 0; // not used yet
- event.simpleData.property = property;
- event.simpleData.state = state;
- sendEvent(&event);
-}
-
-/*!
- \internal
-*/
-void QWSClient::sendPropertyReplyEvent(int property, int len, const char *data)
-{
- QWSPropertyReplyEvent event;
- event.simpleData.window = 0; // not used yet
- event.simpleData.property = property;
- event.simpleData.len = len;
- event.setData(data, len);
- sendEvent(&event);
-}
-#endif //QT_NO_QWS_PROPERTIES
-
-/*!
- \internal
-*/
-void QWSClient::sendSelectionClearEvent(int windowid)
-{
- QWSSelectionClearEvent event;
- event.simpleData.window = windowid;
- sendEvent(&event);
-}
-
-/*!
- \internal
-*/
-void QWSClient::sendSelectionRequestEvent(QWSConvertSelectionCommand *cmd, int windowid)
-{
- QWSSelectionRequestEvent event;
- event.simpleData.window = windowid;
- event.simpleData.requestor = cmd->simpleData.requestor;
- event.simpleData.property = cmd->simpleData.selection;
- event.simpleData.mimeTypes = cmd->simpleData.mimeTypes;
- sendEvent(&event);
-}
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-/*!
- \internal
-*/
-void QWSClient::sendEmbedEvent(int windowid, QWSEmbedEvent::Type type,
- const QRegion &region)
-{
- QWSEmbedEvent event;
- event.setData(windowid, type, region);
- sendEvent(&event);
-}
-#endif // QT_NO_QWSEMBEDWIDGET
-
-/*!
- \fn void QWSClient::connectionClosed()
- \internal
-*/
-
-/*!
- \fn void QWSClient::readyRead();
- \internal
-*/
-
-/*!
- \fn int QWSClient::clientId () const
-
- Returns an integer uniquely identfying this client.
-*/
-
-/*!
- \fn QString QWSClient::identity () const
-
- Returns the name of this client's running application.
-*/
-/*********************************************************************
- *
- * Class: QWSServer
- *
- *********************************************************************/
-
-/*!
- \class QWSServer
- \brief The QWSServer class encapsulates a server process in Qt for Embedded Linux.
-
- \ingroup qws
-
- When you run a \l{Qt for Embedded Linux} application, it either runs as a
- server or connects to an existing server. The server and client
- processes have different responsibilities: The client process
- performs all application specific operations. The server process
- is responsible for managing the clients as well as taking care of
- the pointer handling, character input, and screen output. In
- addition, the server provides functionality to handle input
- methods.
-
- In \l{Qt for Embedded Linux}, all system generated events are passed to the
- server application which then propagates the event to the
- appropriate client. See the \l{Qt for Embedded Linux Architecture}
- documentation for details.
-
- Note that this class is instantiated by QApplication for
- \l{Qt for Embedded Linux} server processes; you should never construct this
- class yourself. Use the instance() function to retrieve a pointer
- to the server object.
-
- Note that the static functions of the QWSServer class can only be
- used in the server process.
-
- \tableofcontents
-
- \section1 Client Administration
-
- As applications add and remove windows, the server process
- maintains information about each window. In \l{Qt for Embedded Linux},
- top-level windows are encapsulated as QWSWindow objects. Each
- window can tell which client that owns it through its
- QWSWindow::client() function. Use the clientWindows() function to
- retrieve a list of the current top-level windows. Given a
- particular position on the display, the window containing it can
- be retrieved using the windowAt() function.
-
- QWSServer also provides the windowEvent() signal which is emitted
- whenever something happens to a top level window; the WindowEvent
- enum describes the various types of events that the signal
- recognizes. In addition, the server class provides the
- markedText() signal which is emitted whenever some text has been
- selected in any of the windows, passing the selection as
- parameter.
-
- The QCopChannel class and the QCOP communication protocol enable
- transfer of messages between clients. QWSServer provides the
- newChannel() and removedChannel() signals that is emitted whenever
- a new QCopChannel object is created or destroyed, respectively.
-
- See also: QWSWindow, QWSClient and QCopChannel.
-
-
- \section1 Mouse Handling
-
- The mouse driver (represented by an instance of the
- QWSMouseHandler class) is loaded by the server application when it
- starts running, using Qt's \l {How to Create Qt Plugins}{plugin
- system}. A mouse driver receives mouse events from the device and
- encapsulates each event with an instance of the QWSEvent class
- which it then passes to the server.
-
- The openMouse() function opens the mouse devices specified by the
- QWS_MOUSE_PROTO environment variable, and the setMouseHandler()
- functions sets the primary mouse driver. Alternatively, the static
- setDefaultMouse() function provides means of specifying the mouse
- driver to use if the QWS_MOUSE_PROTO variable is not defined (note
- that the default is otherwise platform dependent). The primary
- mouse driver can be retrieved using the static mouseHandler()
- function. Use the closeMouse() function to delete the mouse
- drivers.
-
- In addition, the QWSServer class can control the flow of mouse
- input using the suspendMouse() and resumeMouse() functions.
-
- See also: QWSMouseHandler and \l{Qt for Embedded Linux Pointer Handling}.
-
- \section1 Keyboard Handling
-
- The keyboard driver (represented by an instance of the
- QWSKeyboardHandler class) is loaded by the server application when
- it starts running, using Qt's \l {How to Create Qt Plugins}{plugin
- system}. A keyboard driver receives keyboard events from the
- device and encapsulates each event with an instance of the
- QWSEvent class which it then passes to the server.
-
- The openKeyboard() function opens the keyboard devices specified
- by the QWS_KEYBOARD environment variable, and the
- setKeyboardHandler() functions sets the primary keyboard
- driver. Alternatively, the static setDefaultKeyboard() function
- provides means of specifying the keyboard driver to use if the
- QWS_KEYBOARD variable is not defined (note again that the default
- is otherwise platform dependent). The primary keyboard driver can
- be retrieved using the static keyboardHandler() function. Use the
- closeKeyboard() function to delete the keyboard drivers.
-
- In addition, the QWSServer class can handle key events from both
- physical and virtual keyboards using the processKeyEvent() and
- sendKeyEvent() functions, respectively. Use the
- addKeyboardFilter() function to filter the key events from
- physical keyboard drivers, the most recently added filter can be
- removed and deleted using the removeKeyboardFilter() function.
-
- See also: QWSKeyboardHandler and \l{Qt for Embedded Linux Character Input}.
-
- \section1 Display Handling
-
- When a screen update is required, the server runs through all the
- top-level windows that intersect with the region that is about to
- be updated, and ensures that the associated clients have updated
- their memory buffer. Then the server uses the screen driver
- (represented by an instance of the QScreen class) to copy the
- content of the memory to the screen.
-
- In addition, the QWSServer class provides some means of managing
- the screen output: Use the refresh() function to refresh the
- entire display, or alternatively a specified region of it. The
- enablePainting() function can be used to disable (and enable)
- painting onto the screen. QWSServer also provide the
- setMaxWindowRect() function restricting the area of the screen
- which \l{Qt for Embedded Linux} applications will consider to be the
- maximum area to use for windows. To set the brush used as the
- background in the absence of obscuring windows, QWSServer provides
- the static setBackground() function. The corresponding
- backgroundBrush() function returns the currently set brush.
-
- QWSServer also controls the screen saver: Use the setScreenSaver()
- to install a custom screen saver derived from the QWSScreenSaver
- class. Once installed, the screensaver can be activated using the
- screenSaverActivate() function, and the screenSaverActive()
- function returns its current status. Use the
- setScreenSaverInterval() function to specify the timeout interval.
- \l{Qt for Embedded Linux} also supports multilevel screen saving, use the
- setScreenSaverIntervals() function to specify the various levels
- and their timeout intervals.
-
- Finally, the QWSServer class controls the cursor's appearance,
- i.e., use the setCursorVisible() function to hide or show the
- cursor, and the isCursorVisible() function to determine whether
- the cursor is visible on the display or not.
-
- See also: QScreen and \l{Qt for Embedded Linux Display Management}.
-
- \section1 Input Method Handling
-
- Whenever the server receives an event, it queries its stack of
- top-level windows to find the window containing the event's
- position (each window can identify the client application that
- created it). Then the server forwards the event to the appropriate
- client. If an input method is installed, it is used as a filter
- between the server and the client application.
-
- Derive from the QWSInputMethod class to create custom input
- methods, and use the server's setCurrentInputMethod() function to
- install it. Use the sendIMEvent() and sendIMQuery() functions to
- send input method events and queries.
-
- QWSServer provides the IMMouse enum describing the various mouse
- events recognized by the QWSInputMethod::mouseHandler()
- function. The latter function allows subclasses of QWSInputMethod
- to handle mouse events within the preedit text.
-
- \sa QWSInputMethod
-*/
-
-/*!
- \enum QWSServer::IMState
- \obsolete
-
- This enum describes the various states of an input method.
-
- \value IMCompose Composing.
- \value IMStart Equivalent to IMCompose.
- \value IMEnd Finished composing.
-
- \sa QWSInputMethod::sendIMEvent()
-*/
-
-/*!
- \enum QWSServer::IMMouse
-
- This enum describes the various types of mouse events recognized
- by the QWSInputMethod::mouseHandler() function.
-
- \value MousePress An event generated by pressing a mouse button.
- \value MouseRelease An event generated by relasing a mouse button.
- \value MouseMove An event generated by moving the mouse cursor.
- \value MouseOutside This value is only reserved, i.e., it is not used in
- current implementations.
-
- \sa QWSInputMethod, setCurrentInputMethod()
-*/
-
-/*!
- \enum QWSServer::ServerFlags
- \internal
-
- This enum is used to pass various options to the window system
- server.
-
- \value DisableKeyboard Ignore all keyboard input.
- \value DisableMouse Ignore all mouse input.
-*/
-
-/*!
- \enum QWSServer::WindowEvent
-
- This enum specifies the various events that can occur in a
- top-level window.
-
- \value Create A new window has been created (by the QWidget constructor).
- \value Destroy The window has been closed and deleted (by the QWidget destructor).
- \value Hide The window has been hidden using the QWidget::hide() function.
- \value Show The window has been shown using the QWidget::show() function or similar.
- \value Raise The window has been raised to the top of the desktop.
- \value Lower The window has been lowered.
- \value Geometry The window has changed size or position.
- \value Active The window has become the active window (i.e., it has keyboard focus).
- \value Name The window has been named.
-
- \sa windowEvent()
-*/
-
-/*!
- \fn void QWSServer::markedText(const QString &selection)
-
- This signal is emitted whenever some text is selected in any of
- the running applications, passing the selected text in the \a
- selection parameter.
-
- \sa windowEvent()
-*/
-
-/*!
- \fn const QList<QWSWindow*> &QWSServer::clientWindows()
-
- Returns the list of current top-level windows.
-
- Note that the collection of top-level windows changes as
- applications add and remove widgets so it should not be stored for
- future use. The windows are sorted in stacking order from top-most
- to bottom-most.
-
- Use the QWSWindow::client() function to retrieve the client
- application that owns a given window.
-
- \sa windowAt(), instance()
-*/
-
-/*!
- \fn void QWSServer::newChannel(const QString& channel)
-
- This signal is emitted whenever a new QCopChannel object is
- created, passing the channel's name in the \a channel parameter.
-
- \sa removedChannel()
-*/
-
-/*!
- \fn void QWSServer::removedChannel(const QString& channel)
-
- This signal is emitted immediately after the given the QCopChannel
- object specified by \a channel, is destroyed.
-
- Note that a channel is not destroyed until all its listeners have
- been unregistered.
-
- \sa newChannel()
-*/
-
-/*!
- \fn QWSServer::QWSServer(int flags, QObject *parent)
- \internal
-
- Construct a QWSServer object with the given \a parent. The \a
- flags are used for keyboard and mouse settings.
-
- \warning This class is instantiated by QApplication for
- \l{Qt for Embedded Linux} server processes. You should never construct
- this class yourself.
-
- \sa {Running Applications}
-*/
-
-/*!
- \fn static QWSServer* QWSServer::instance()
- \since 4.2
-
- Returns a pointer to the server instance.
-
- Note that the pointer will be 0 if the application is not the
- server, i.e., if the QApplication::type() function doesn't return
- QApplication::GuiServer.
-
- \sa clientWindows(), windowAt()
-*/
-
-struct QWSCommandStruct
-{
- QWSCommandStruct(QWSCommand *c, QWSClient *cl) :command(c),client(cl){}
- ~QWSCommandStruct() { delete command; }
-
- QWSCommand *command;
- QWSClient *client;
-
-};
-
-QWSServer::QWSServer(int flags, QObject *parent) :
- QObject(*new QWSServerPrivate, parent)
-{
- Q_D(QWSServer);
- QT_TRY {
- d->initServer(flags);
- } QT_CATCH(...) {
- qwsServer = 0;
- qwsServerPrivate = 0;
- QT_RETHROW;
- }
-}
-
-#ifdef QT3_SUPPORT
-/*!
- Use the two-argument overload and call the
- QObject::setObjectName() function instead.
-*/
-QWSServer::QWSServer(int flags, QObject *parent, const char *name) :
- QObject(*new QWSServerPrivate, parent)
-{
- Q_D(QWSServer);
- setObjectName(QString::fromAscii(name));
- d->initServer(flags);
-}
-#endif
-
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-static void ignoreSignal(int) {} // Used to eat SIGPIPE signals below
-#endif
-
-bool QWSServerPrivate::screensaverblockevent( int index, int *screensaverinterval, bool isDown )
-{
- static bool ignoreEvents[2] = { false, false };
- if ( isDown ) {
- if ( !ignoreEvents[index] ) {
- bool wake = false;
- if ( screensaverintervals ) {
- if ( screensaverinterval != screensaverintervals ) {
- wake = true;
- }
- }
- if ( screensaverblockevents && wake ) {
-#ifdef EVENT_BLOCK_DEBUG
- qDebug( "waking the screen" );
-#endif
- ignoreEvents[index] = true;
- } else if ( !screensaverblockevents ) {
-#ifdef EVENT_BLOCK_DEBUG
- qDebug( "the screen was already awake" );
-#endif
- ignoreEvents[index] = false;
- }
- }
- } else {
- if ( ignoreEvents[index] ) {
-#ifdef EVENT_BLOCK_DEBUG
- qDebug( "mouseup?" );
-#endif
- ignoreEvents[index] = false;
- return true;
- }
- }
- return ignoreEvents[index];
-}
-
-void QWSServerPrivate::initServer(int flags)
-{
- Q_Q(QWSServer);
- Q_ASSERT(!qwsServer);
- qwsServer = q;
- qwsServerPrivate = this;
- disablePainting = false;
-#ifndef QT_NO_QWS_MULTIPROCESS
- ssocket = new QWSServerSocket(qws_qtePipeFilename(), q);
- QObject::connect(ssocket, SIGNAL(newConnection()), q, SLOT(_q_newConnection()));
-
- if ( !ssocket->isListening()) {
- perror("QWSServerPrivate::initServer: server socket not listening");
- qFatal("Failed to bind to %s", qws_qtePipeFilename().toLatin1().constData());
- }
-
- struct linger tmp;
- tmp.l_onoff=1;
- tmp.l_linger=0;
- setsockopt(ssocket->socketDescriptor(),SOL_SOCKET,SO_LINGER,(char *)&tmp,sizeof(tmp));
-
-
- signal(SIGPIPE, ignoreSignal); //we get it when we read
-#endif
- focusw = 0;
- mouseGrabber = 0;
- mouseGrabbing = false;
- inputMethodMouseGrabbed = false;
- keyboardGrabber = 0;
- keyboardGrabbing = false;
-#ifndef QT_NO_QWS_CURSOR
- haveviscurs = false;
- cursor = 0;
- nextCursor = 0;
-#endif
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
- if (!geteuid()) {
-#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
- if(mount(0,"/var/shm", "shm", 0, 0)) {
- /* This just confuses people with 2.2 kernels
- if (errno != EBUSY)
- qDebug("Failed mounting shm fs on /var/shm: %s",strerror(errno));
- */
- }
-#endif
- }
-#endif
-
- // no selection yet
- selectionOwner.windowid = -1;
- selectionOwner.time.set(-1, -1, -1, -1);
-
- cleanupFontsDir();
-
- // initialize the font database
- // from qfontdatabase_qws.cpp
- extern void qt_qws_init_fontdb();
- qt_qws_init_fontdb();
-
- openDisplay();
-
- screensavertimer = new QTimer(q);
- screensavertimer->setSingleShot(true);
- QObject::connect(screensavertimer, SIGNAL(timeout()), q, SLOT(_q_screenSaverTimeout()));
- _q_screenSaverWake();
-
- clientMap[-1] = new QWSClient(q, 0, 0);
-
- if (!bgBrush)
- bgBrush = new QBrush(QColor(0x20, 0xb0, 0x50));
-
- initializeCursor();
-
- // input devices
- if (!(flags&QWSServer::DisableMouse)) {
- q->openMouse();
- }
-#ifndef QT_NO_QWS_KEYBOARD
- if (!(flags&QWSServer::DisableKeyboard)) {
- q->openKeyboard();
- }
-#endif
-
-#if !defined(QT_NO_SOUND) && !defined(QT_EXTERNAL_SOUND_SERVER) && !defined(Q_OS_DARWIN)
- soundserver = new QWSSoundServer(q);
-#endif
-}
-
-/*!
- \internal
- Destructs this server.
-*/
-QWSServer::~QWSServer()
-{
- closeMouse();
-#ifndef QT_NO_QWS_KEYBOARD
- closeKeyboard();
-#endif
- d_func()->cleanupFonts(/*force =*/true);
-}
-
-/*!
- \internal
- */
-void QWSServer::timerEvent(QTimerEvent *e)
-{
- Q_D(QWSServer);
- if (e->timerId() == d->fontCleanupTimer.timerId()) {
- d->cleanupFonts();
- d->fontCleanupTimer.stop();
- } else {
- QObject::timerEvent(e);
- }
-}
-
-const QList<QWSWindow*> &QWSServer::clientWindows()
-{
- Q_D(QWSServer);
- return d->windows;
-}
-
-/*!
- \internal
-*/
-void QWSServerPrivate::releaseMouse(QWSWindow* w)
-{
- if (w && mouseGrabber == w) {
- mouseGrabber = 0;
- mouseGrabbing = false;
-#ifndef QT_NO_QWS_CURSOR
- if (nextCursor) {
- // Not grabbing -> set the correct cursor
- setCursor(nextCursor);
- nextCursor = 0;
- }
-#endif
- }
-}
-
-/*!
- \internal
-*/
-void QWSServerPrivate::releaseKeyboard(QWSWindow* w)
-{
- if (keyboardGrabber == w) {
- keyboardGrabber = 0;
- keyboardGrabbing = false;
- }
-}
-
-void QWSServerPrivate::handleWindowClose(QWSWindow *w)
-{
- w->shuttingDown();
- if (focusw == w)
- setFocus(w,false);
- if (mouseGrabber == w)
- releaseMouse(w);
- if (keyboardGrabber == w)
- releaseKeyboard(w);
-}
-
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-/*!
- \internal
-*/
-void QWSServerPrivate::_q_newConnection()
-{
- Q_Q(QWSServer);
- while (QWS_SOCK_BASE *sock = ssocket->nextPendingConnection()) {
- int socket = sock->socketDescriptor();
- sock->setParent(0);
-
- QWSClient *client = new QWSClient(q,sock, get_object_id());
- clientMap[socket] = client;
-
-#ifndef QT_NO_SXE
-#ifdef QTRANSPORTAUTH_DEBUG
- qDebug( "Transport auth connected: unix stream socket %d", socket );
-#endif
- // get a handle to the per-process authentication service
- QTransportAuth *a = QTransportAuth::getInstance();
-
- // assert that this transport is trusted
- QTransportAuth::Data *d = a->connectTransport(
- QTransportAuth::UnixStreamSock |
- QTransportAuth::Trusted, socket );
-
- QAuthDevice *ad = a->recvBuf( d, sock );
- ad->setClient(client);
-
- QObject::connect(ad, SIGNAL(readyRead()),
- q, SLOT(_q_doClient()));
-
- QObject::connect(client, SIGNAL(connectionClosed()),
- q, SLOT(_q_clientClosed()));
-#else
- QObject::connect(client, SIGNAL(readyRead()),
- q, SLOT(_q_doClient()));
- QObject::connect(client, SIGNAL(connectionClosed()),
- q, SLOT(_q_clientClosed()));
-#endif // QT_NO_SXE
-
- client->sendConnectedEvent(qws_display_spec.constData());
-
- if (clientMap.contains(socket)) {
- QList<QScreen*> screens = qt_screen->subScreens();
- if (screens.isEmpty())
- screens.append(qt_screen);
- for (int i = 0; i < screens.size(); ++i) {
- const QApplicationPrivate *ap = QApplicationPrivate::instance();
- QScreen *screen = screens.at(i);
- const QRect rect = ap->maxWindowRect(screen);
- if (!rect.isEmpty())
- client->sendMaxWindowRectEvent(rect);
- if (screen->isTransformed()) {
- QWSScreenTransformationEvent event;
- event.simpleData.screen = i;
- event.simpleData.transformation = screen->transformOrientation();
- client->sendEvent(&event);
- }
- }
- }
-
- // pre-provide some object id's
- QWSCreateCommand cmd(30);
- invokeCreate(&cmd, client);
- }
-}
-/*!
- \internal
-*/
-void QWSServerPrivate::_q_clientClosed()
-{
- Q_Q(QWSServer);
- QWSClient* cl = (QWSClient*)q->sender();
-
- // Remove any queued commands for this client
- int i = 0;
- while (i < commandQueue.size()) {
- QWSCommandStruct *cs = commandQueue.at(i);
- if (cs->client == cl) {
- commandQueue.removeAt(i);
- delete cs;
- } else {
- ++i;
- }
- }
-
-#ifndef QT_NO_COP
- // Enfore unsubscription from all channels.
- QCopChannel::detach(cl);
-#endif
-
- // Shut down all windows for this client
- for (int i = 0; i < windows.size(); ++i) {
- QWSWindow* w = windows.at(i);
- if (w->forClient(cl))
- w->shuttingDown();
- }
-
- // Delete all windows for this client
- QRegion exposed;
- i = 0;
- while (i < windows.size()) {
- QWSWindow* w = windows.at(i);
- if (w->forClient(cl)) {
- windows.takeAt(i);
- w->c = 0; //so we don't send events to it anymore
- releaseMouse(w);
- releaseKeyboard(w);
- exposed += w->allocatedRegion();
-// rgnMan->remove(w->allocationIndex());
- if (focusw == w)
- setFocus(focusw,0);
- if (mouseGrabber == w)
- releaseMouse(w);
- if (i < nReserved)
- --nReserved;
-#ifndef QT_NO_QWS_PROPERTIES
- propertyManager.removeProperties(w->winId());
-#endif
- emit q->windowEvent(w, QWSServer::Destroy);
- w->d->state = QWSWindow::Destroyed; //???
- deletedWindows.append(w);
- } else {
- ++i;
- }
- }
- if (deletedWindows.count())
- QTimer::singleShot(0, q, SLOT(_q_deleteWindowsLater()));
-
- QWSClientPrivate *clientPrivate = cl->d_func();
- if (!clientPrivate->shutdown) {
-#if defined(QWS_DEBUG_FONTCLEANUP)
- qDebug() << "client" << cl->clientId() << "crashed";
-#endif
- // this would be the place to emit a signal to notify about the
- // crash of a client
- crashedClientIds.append(cl->clientId());
- fontCleanupTimer.start(10, q_func());
- }
- clientPrivate->shutdown = true;
-
- while (!clientPrivate->usedFonts.isEmpty()) {
- const QByteArray font = *clientPrivate->usedFonts.begin();
-#if defined(QWS_DEBUG_FONTCLEANUP)
- qDebug() << "dereferencing font" << font << "from disconnected client";
-#endif
- dereferenceFont(clientPrivate, font);
- }
- clientPrivate->usedFonts.clear();
-
- //qDebug("removing client %d with socket %d", cl->clientId(), cl->socket());
- clientMap.remove(cl->socket());
- if (cl == cursorClient)
- cursorClient = 0;
- if (qt_screen->clearCacheFunc)
- (qt_screen->clearCacheFunc)(qt_screen, cl->clientId()); // remove any remaining cache entries.
- cl->deleteLater();
-
- update_regions();
- exposeRegion(exposed);
-}
-
-void QWSServerPrivate::_q_deleteWindowsLater()
-{
- qDeleteAll(deletedWindows);
- deletedWindows.clear();
-}
-
-#endif //QT_NO_QWS_MULTIPROCESS
-
-void QWSServerPrivate::referenceFont(QWSClientPrivate *client, const QByteArray &font)
-{
- if (!client->usedFonts.contains(font)) {
- client->usedFonts.insert(font);
-
- ++fontReferenceCount[font];
-#if defined(QWS_DEBUG_FONTCLEANUP)
- qDebug() << "Client" << client->q_func()->clientId() << "added font" << font;
- qDebug() << "Refcount is" << fontReferenceCount[font];
-#endif
- }
-}
-
-void QWSServerPrivate::dereferenceFont(QWSClientPrivate *client, const QByteArray &font)
-{
- if (client->usedFonts.contains(font)) {
- client->usedFonts.remove(font);
-
- Q_ASSERT(fontReferenceCount[font]);
- if (!--fontReferenceCount[font] && !fontCleanupTimer.isActive())
- fontCleanupTimer.start(FontCleanupInterval, q_func());
-
-#if defined(QWS_DEBUG_FONTCLEANUP)
- qDebug() << "Client" << client->q_func()->clientId() << "removed font" << font;
- qDebug() << "Refcount is" << fontReferenceCount[font];
-#endif
- }
-}
-
-static void cleanupFontsDir()
-{
- static bool dontDelete = !qgetenv("QWS_KEEP_FONTS").isEmpty();
- if (dontDelete)
- return;
-
- extern QString qws_fontCacheDir();
- QDir dir(qws_fontCacheDir(), QLatin1String("*.qsf"));
- for (uint i = 0; i < dir.count(); ++i) {
-#if defined(QWS_DEBUG_FONTCLEANUP)
- qDebug() << "removing stale font file" << dir[i];
-#endif
- dir.remove(dir[i]);
- }
-}
-
-void QWSServerPrivate::cleanupFonts(bool force)
-{
- static bool dontDelete = !qgetenv("QWS_KEEP_FONTS").isEmpty();
- if (dontDelete)
- return;
-
-#if defined(QWS_DEBUG_FONTCLEANUP)
- qDebug() << "cleanupFonts()";
-#endif
- if (!fontReferenceCount.isEmpty()) {
- QMap<QByteArray, int>::Iterator it = fontReferenceCount.begin();
- while (it != fontReferenceCount.end()) {
- if (it.value() && !force) {
- ++it;
- continue;
- }
-
- const QByteArray &fontName = it.key();
-#if defined(QWS_DEBUG_FONTCLEANUP)
- qDebug() << "removing unused font file" << fontName;
-#endif
- QT_TRY {
- QFile::remove(QFile::decodeName(fontName));
- sendFontRemovedEvent(fontName);
-
- it = fontReferenceCount.erase(it);
- } QT_CATCH(...) {
- // so we were not able to remove the font.
- // don't be angry and just continue with the next ones.
- ++it;
- }
- }
- }
-
- if (crashedClientIds.isEmpty())
- return;
-
- QList<QByteArray> removedFonts;
-#if !defined(QT_NO_QWS_QPF2) && !defined(QT_FONTS_ARE_RESOURCES)
- removedFonts = QFontEngineQPF::cleanUpAfterClientCrash(crashedClientIds);
-#endif
- crashedClientIds.clear();
-
- for (int i = 0; i < removedFonts.count(); ++i)
- sendFontRemovedEvent(removedFonts.at(i));
-}
-
-void QWSServerPrivate::sendFontRemovedEvent(const QByteArray &font)
-{
- QWSFontEvent event;
- event.simpleData.type = QWSFontEvent::FontRemoved;
- event.setData(font.constData(), font.length(), false);
-
- QMap<int,QWSClient*>::const_iterator it = clientMap.constBegin();
- for (; it != clientMap.constEnd(); ++it)
- (*it)->sendEvent(&event);
-}
-
-/*!
- \internal
-*/
-QWSCommand* QWSClient::readMoreCommand()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- QIODevice *socket = 0;
-#endif
-#ifndef QT_NO_SXE
- if (socketDescriptor != -1) // not server socket
- socket = QTransportAuth::getInstance()->passThroughByClient( this );
-#if QTRANSPORTAUTH_DEBUG
- if (socket) {
- char displaybuf[1024];
- qint64 bytes = socket->bytesAvailable();
- if ( bytes > 511 ) bytes = 511;
- hexstring( displaybuf, ((unsigned char *)(reinterpret_cast<QAuthDevice*>(socket)->buffer().constData())), bytes );
- qDebug( "readMoreCommand: %lli bytes - %s", socket->bytesAvailable(), displaybuf );
- }
-#endif
-#endif // QT_NO_SXE
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (!socket)
- socket = csocket; // server socket
- if (socket) {
- // read next command
- if (!command) {
- int command_type = qws_read_uint(socket);
-
- if (command_type >= 0)
- command = QWSCommand::factory(command_type);
- }
- if (command) {
- if (command->read(socket)) {
- // Finished reading a whole command.
- QWSCommand* result = command;
- command = 0;
- return result;
- }
- }
-
- // Not finished reading a whole command.
- return 0;
- } else
-#endif // QT_NO_QWS_MULTIPROCESS
- {
- QList<QWSCommand*> *serverQueue = qt_get_server_queue();
- return serverQueue->isEmpty() ? 0 : serverQueue->takeFirst();
- }
-}
-
-
-/*!
- \internal
-*/
-void QWSServer::processEventQueue()
-{
- if (qwsServerPrivate)
- qwsServerPrivate->doClient(qwsServerPrivate->clientMap.value(-1));
-}
-
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSServerPrivate::_q_doClient()
-{
- Q_Q(QWSServer);
-
- QWSClient* client;
-#ifndef QT_NO_SXE
- QAuthDevice *ad = qobject_cast<QAuthDevice*>(q->sender());
- if (ad)
- client = (QWSClient*)ad->client();
- else
-#endif
- client = (QWSClient*)q->sender();
-
- if (doClientIsActive) {
- pendingDoClients.append(client);
- return;
- }
- doClientIsActive = true;
-
- doClient(client);
-
- while (!pendingDoClients.isEmpty()) {
- doClient(pendingDoClients.takeFirst());
- }
-
- doClientIsActive = false;
-}
-#endif // QT_NO_QWS_MULTIPROCESS
-
-void QWSServerPrivate::doClient(QWSClient *client)
-{
- QWSCommand* command=client->readMoreCommand();
-
- while (command) {
- QWSCommandStruct *cs = new QWSCommandStruct(command, client);
- commandQueue.append(cs);
- // Try for some more...
- command=client->readMoreCommand();
- }
-
- while (!commandQueue.isEmpty()) {
- QWSCommandStruct *cs = commandQueue.takeAt(0);
- switch (cs->command->type) {
- case QWSCommand::Identify:
- invokeIdentify((QWSIdentifyCommand*)cs->command, cs->client);
- break;
- case QWSCommand::Create:
- invokeCreate((QWSCreateCommand*)cs->command, cs->client);
- break;
-#ifndef QT_NO_QWS_MULTIPROCESS
- case QWSCommand::Shutdown:
- cs->client->d_func()->shutdown = true;
- break;
-#endif
- case QWSCommand::RegionName:
- invokeRegionName((QWSRegionNameCommand*)cs->command, cs->client);
- break;
- case QWSCommand::Region:
- invokeRegion((QWSRegionCommand*)cs->command, cs->client);
- cs->client->d_func()->unlockCommunication();
- break;
- case QWSCommand::RegionMove:
- invokeRegionMove((QWSRegionMoveCommand*)cs->command, cs->client);
- cs->client->d_func()->unlockCommunication();
- break;
- case QWSCommand::RegionDestroy:
- invokeRegionDestroy((QWSRegionDestroyCommand*)cs->command, cs->client);
- break;
-#ifndef QT_NO_QWS_PROPERTIES
- case QWSCommand::AddProperty:
- invokeAddProperty((QWSAddPropertyCommand*)cs->command);
- break;
- case QWSCommand::SetProperty:
- invokeSetProperty((QWSSetPropertyCommand*)cs->command);
- break;
- case QWSCommand::RemoveProperty:
- invokeRemoveProperty((QWSRemovePropertyCommand*)cs->command);
- break;
- case QWSCommand::GetProperty:
- invokeGetProperty((QWSGetPropertyCommand*)cs->command, cs->client);
- break;
-#endif
- case QWSCommand::SetSelectionOwner:
- invokeSetSelectionOwner((QWSSetSelectionOwnerCommand*)cs->command);
- break;
- case QWSCommand::RequestFocus:
- invokeSetFocus((QWSRequestFocusCommand*)cs->command, cs->client);
- break;
- case QWSCommand::ChangeAltitude:
- invokeSetAltitude((QWSChangeAltitudeCommand*)cs->command,
- cs->client);
- cs->client->d_func()->unlockCommunication();
- break;
- case QWSCommand::SetOpacity:
- invokeSetOpacity((QWSSetOpacityCommand*)cs->command,
- cs->client);
- break;
-
-#ifndef QT_NO_QWS_CURSOR
- case QWSCommand::DefineCursor:
- invokeDefineCursor((QWSDefineCursorCommand*)cs->command, cs->client);
- break;
- case QWSCommand::SelectCursor:
- invokeSelectCursor((QWSSelectCursorCommand*)cs->command, cs->client);
- break;
- case QWSCommand::PositionCursor:
- invokePositionCursor((QWSPositionCursorCommand*)cs->command, cs->client);
- break;
-#endif
- case QWSCommand::GrabMouse:
- invokeGrabMouse((QWSGrabMouseCommand*)cs->command, cs->client);
- break;
- case QWSCommand::GrabKeyboard:
- invokeGrabKeyboard((QWSGrabKeyboardCommand*)cs->command, cs->client);
- break;
-#if !defined(QT_NO_SOUND) && !defined(Q_OS_DARWIN)
- case QWSCommand::PlaySound:
- invokePlaySound((QWSPlaySoundCommand*)cs->command, cs->client);
- break;
-#endif
-#ifndef QT_NO_COP
- case QWSCommand::QCopRegisterChannel:
- invokeRegisterChannel((QWSQCopRegisterChannelCommand*)cs->command,
- cs->client);
- break;
- case QWSCommand::QCopSend:
- invokeQCopSend((QWSQCopSendCommand*)cs->command, cs->client);
- break;
-#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
- case QWSCommand::IMUpdate:
- invokeIMUpdate((QWSIMUpdateCommand*)cs->command, cs->client);
- break;
- case QWSCommand::IMResponse:
- invokeIMResponse((QWSIMResponseCommand*)cs->command, cs->client);
- break;
- case QWSCommand::IMMouse:
- {
- if (current_IM) {
- QWSIMMouseCommand *cmd = (QWSIMMouseCommand *) cs->command;
- current_IM->mouseHandler(cmd->simpleData.index,
- cmd->simpleData.state);
- }
- }
- break;
-#endif
- case QWSCommand::Font:
- invokeFont((QWSFontCommand *)cs->command, cs->client);
- break;
- case QWSCommand::RepaintRegion:
- invokeRepaintRegion((QWSRepaintRegionCommand*)cs->command,
- cs->client);
- cs->client->d_func()->unlockCommunication();
- break;
-#ifndef QT_NO_QWSEMBEDWIDGET
- case QWSCommand::Embed:
- invokeEmbed(static_cast<QWSEmbedCommand*>(cs->command),
- cs->client);
- break;
-#endif
- case QWSCommand::ScreenTransform:
- invokeScreenTransform(static_cast<QWSScreenTransformCommand*>(cs->command),
- cs->client);
- break;
- }
- delete cs;
- }
-}
-
-
-void QWSServerPrivate::showCursor()
-{
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor)
- qt_screencursor->show();
-#endif
-}
-
-void QWSServerPrivate::hideCursor()
-{
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor)
- qt_screencursor->hide();
-#endif
-}
-
-/*!
- \fn void QWSServer::enablePainting(bool enable)
-
- Enables painting onto the screen if \a enable is true; otherwise
- painting is disabled.
-
- \sa {Qt for Embedded Linux Architecture#Drawing on Screen}{Qt for Embedded Linux
- Architecture}
-*/
-void QWSServer::enablePainting(bool enable)
-{
- Q_D(QWSServer);
-
- if (d->disablePainting == !enable)
- return;
-
- d->disablePainting = !enable;
-
- if (enable) {
- // Reset the server side allocated regions to ensure update_regions()
- // will send out region events.
- for (int i = 0; i < d->windows.size(); ++i) {
- QWSWindow *w = d->windows.at(i);
- w->setAllocatedRegion(QRegion());
-#ifdef QT_QWS_CLIENTBLIT
- w->setDirectPaintRegion(QRegion());
-#endif
- }
- d->update_regions();
- d->showCursor();
- } else {
- // Disable painting by clients by taking away their allocated region.
- // To ensure mouse events are still delivered to the correct windows,
- // the allocated regions are not modified on the server.
- for (int i = 0; i < d->windows.size(); ++i) {
- QWSWindow *w = d->windows.at(i);
- w->client()->sendRegionEvent(w->winId(), QRegion(),
- QWSRegionEvent::Allocation);
-#ifdef QT_QWS_CLIENTBLIT
- w->client()->sendRegionEvent(w->winId(), QRegion(),
- QWSRegionEvent::DirectPaint);
-#endif
- }
- d->hideCursor();
- }
-}
-
-/*!
- Refreshes the display by making the screen driver update the
- entire display.
-
- \sa QScreen::exposeRegion()
-*/
-void QWSServer::refresh()
-{
- Q_D(QWSServer);
- d->exposeRegion(QScreen::instance()->region());
-//### send repaint to non-buffered windows
-}
-
-/*!
- \fn void QWSServer::refresh(QRegion & region)
- \overload
-
- Refreshes the given \a region of the display.
-*/
-void QWSServer::refresh(QRegion & r)
-{
- Q_D(QWSServer);
- d->exposeRegion(r);
-//### send repaint to non-buffered windows
-}
-
-/*!
- \fn void QWSServer::setMaxWindowRect(const QRect& rectangle)
-
- Sets the maximum area of the screen that \l{Qt for Embedded Linux}
- applications can use, to be the given \a rectangle.
-
- Note that this function can only be used in the server process.
-
- \sa QWidget::showMaximized()
-*/
-void QWSServer::setMaxWindowRect(const QRect &rect)
-{
- QList<QScreen*> subScreens = qt_screen->subScreens();
- if (subScreens.isEmpty() && qt_screen != 0)
- subScreens.append(qt_screen);
-
- for (int i = 0; i < subScreens.size(); ++i) {
- const QScreen *screen = subScreens.at(i);
- const QRect r = (screen->region() & rect).boundingRect();
- if (r.isEmpty())
- continue;
-
- QApplicationPrivate *ap = QApplicationPrivate::instance();
- if (ap->maxWindowRect(screen) != r) {
- ap->setMaxWindowRect(screen, i, r);
- qwsServerPrivate->sendMaxWindowRectEvents(r);
- }
- }
-}
-
-/*!
- \internal
-*/
-void QWSServerPrivate::sendMaxWindowRectEvents(const QRect &rect)
-{
- QMap<int,QWSClient*>::const_iterator it = clientMap.constBegin();
- for (; it != clientMap.constEnd(); ++it)
- (*it)->sendMaxWindowRectEvent(rect);
-}
-
-/*!
- \fn void QWSServer::setDefaultMouse(const char *mouseDriver)
-
- Sets the mouse driver that will be used if the QWS_MOUSE_PROTO
- environment variable is not defined, to be the given \a
- mouseDriver.
-
- Note that the default is platform-dependent. This function can
- only be used in the server process.
-
-
- \sa setMouseHandler(), {Qt for Embedded Linux Pointer Handling}
-*/
-void QWSServer::setDefaultMouse(const char *m)
-{
- *defaultMouse() = QString::fromAscii(m);
-}
-
-/*!
- \fn void QWSServer::setDefaultKeyboard(const char *keyboardDriver)
-
- Sets the keyboard driver that will be used if the QWS_KEYBOARD
- environment variable is not defined, to be the given \a
- keyboardDriver.
-
- Note that the default is platform-dependent. This function can
- only be used in the server process.
-
- \sa setKeyboardHandler(), {Qt for Embedded Linux Character Input}
-*/
-void QWSServer::setDefaultKeyboard(const char *k)
-{
- *defaultKeyboard() = QString::fromAscii(k);
-}
-
-#ifndef QT_NO_QWS_CURSOR
-static bool prevWin;
-#endif
-
-
-extern int *qt_last_x,*qt_last_y;
-
-
-/*!
- \internal
-
- Send a mouse event. \a pos is the screen position where the mouse
- event occurred and \a state is a mask indicating which buttons are
- pressed.
-
- \a pos is in device coordinates
-*/
-void QWSServer::sendMouseEvent(const QPoint& pos, int state, int wheel)
-{
- bool block = qwsServerPrivate->screensaverblockevent(MOUSE, qwsServerPrivate->screensaverinterval, state);
-#ifdef EVENT_BLOCK_DEBUG
- qDebug() << "sendMouseEvent" << pos.x() << pos.y() << state << (block ? "block" : "pass");
-#endif
-
- if (state || wheel)
- qwsServerPrivate->_q_screenSaverWake();
-
- if ( block )
- return;
-
- QPoint tpos;
- // transformations
- if (qt_screen->isTransformed()) {
- QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight());
- tpos = qt_screen->mapFromDevice(pos, s);
- } else {
- tpos = pos;
- }
-
- if (qt_last_x) {
- *qt_last_x = tpos.x();
- *qt_last_y = tpos.y();
- }
- QWSServer::mousePosition = tpos;
- qwsServerPrivate->mouseState = state;
-
-#ifndef QT_NO_QWS_INPUTMETHODS
- const int btnMask = Qt::LeftButton | Qt::RightButton | Qt::MidButton;
- int stroke_count; // number of strokes to keep shown.
- if (force_reject_strokeIM || !current_IM)
- {
- stroke_count = 0;
- } else {
- stroke_count = current_IM->filter(tpos, state, wheel);
- }
-
- if (stroke_count == 0) {
- if (state&btnMask)
- force_reject_strokeIM = true;
- QWSServerPrivate::sendMouseEventUnfiltered(tpos, state, wheel);
- }
- // stop force reject after stroke ends.
- if (state&btnMask && force_reject_strokeIM)
- force_reject_strokeIM = false;
- // on end of stroke, force_rejct
- // and once a stroke is rejected, do not try again till pen is lifted
-#else
- QWSServerPrivate::sendMouseEventUnfiltered(tpos, state, wheel);
-#endif // end QT_NO_QWS_FSIM
-}
-
-void QWSServerPrivate::sendMouseEventUnfiltered(const QPoint &pos, int state, int wheel)
-{
- const int btnMask = Qt::LeftButton | Qt::RightButton | Qt::MidButton;
- QWSMouseEvent event;
-
- QWSWindow *win = qwsServer->windowAt(pos);
-
- QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1);
- QWSClient *winClient = win ? win->client() : 0;
-
-
- bool imMouse = false;
-#ifndef QT_NO_QWS_INPUTMETHODS
- // check for input method window
- if (current_IM && current_IM_winId != -1) {
- QWSWindow *kbw = keyboardGrabber ? keyboardGrabber :
- qwsServerPrivate->focusw;
-
- imMouse = kbw == win;
- if ( !imMouse ) {
- QWidget *target = winClient == serverClient ?
- QApplication::widgetAt(pos) : 0;
- imMouse = target && (target->testAttribute(Qt::WA_InputMethodTransparent));
- }
- }
-#endif
-
- //If grabbing window disappears, grab is still active until
- //after mouse release.
- if ( qwsServerPrivate->mouseGrabber && (!imMouse || qwsServerPrivate->inputMethodMouseGrabbed)) {
- win = qwsServerPrivate->mouseGrabber;
- winClient = win ? win->client() : 0;
- }
- event.simpleData.window = win ? win->id : 0;
-
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor)
- qt_screencursor->move(pos.x(),pos.y());
-
- // Arrow cursor over desktop
- // prevWin remembers if the last event was over a window
- if (!win && prevWin) {
- if (!qwsServerPrivate->mouseGrabber)
- qwsServerPrivate->setCursor(QWSCursor::systemCursor(Qt::ArrowCursor));
- else
- qwsServerPrivate->nextCursor = QWSCursor::systemCursor(Qt::ArrowCursor);
- prevWin = false;
- }
- // reset prevWin
- if (win && !prevWin)
- prevWin = true;
-#endif
-
- if ((state&btnMask) && !qwsServerPrivate->mouseGrabbing) {
- qwsServerPrivate->mouseGrabber = win;
- if (imMouse)
- qwsServerPrivate->inputMethodMouseGrabbed = true;
- }
- if (!(state&btnMask))
- qwsServerPrivate->inputMethodMouseGrabbed = false;
-
- event.simpleData.x_root=pos.x();
- event.simpleData.y_root=pos.y();
- event.simpleData.state=state | qws_keyModifiers;
- event.simpleData.delta = wheel;
- event.simpleData.time=qwsServerPrivate->timer.elapsed();
-
- static int oldstate = 0;
-
-#ifndef QT_NO_QWS_INPUTMETHODS
- //tell the input method if we click on a different window that is not IM transparent
- bool isPress = state > oldstate;
- if (isPress && !imMouse && current_IM && current_IM_winId != -1)
- current_IM->mouseHandler(-1, QWSServer::MouseOutside);
-#endif
-
- if (serverClient)
- serverClient->sendEvent(&event);
- if (winClient && winClient != serverClient)
- winClient->sendEvent(&event);
-
- if ( !imMouse ) {
- // Make sure that if we leave a window, that window gets one last mouse
- // event so that it knows the mouse has left.
- QWSClient *oldClient = qwsServer->d_func()->cursorClient;
- if (oldClient && oldClient != winClient && oldClient != serverClient) {
- event.simpleData.state = oldstate | qws_keyModifiers;
- oldClient->sendEvent(&event);
- }
- }
-
- oldstate = state;
- if ( !imMouse )
- qwsServer->d_func()->cursorClient = winClient;
-
- if (!(state&btnMask) && !qwsServerPrivate->mouseGrabbing)
- qwsServerPrivate->releaseMouse(qwsServerPrivate->mouseGrabber);
-}
-
-/*!
- Returns the primary mouse driver.
-
- Note that this function can only be used in the server process.
-
- \sa setMouseHandler(), openMouse(), closeMouse()
-*/
-QWSMouseHandler *QWSServer::mouseHandler()
-{
- if (qwsServerPrivate->mousehandlers.empty())
- return 0;
- return qwsServerPrivate->mousehandlers.first();
-}
-
-/*!
- \since 4.5
-
- Returns list of all mouse handlers
-
- Note that this function can only be used in the server process.
-
- \sa mouseHandler(), setMouseHandler(), openMouse(), closeMouse()
-*/
-const QList<QWSMouseHandler*>& QWSServer::mouseHandlers()
-{
- return qwsServerPrivate->mousehandlers;
-}
-
-
-// called by QWSMouseHandler constructor, not user code.
-/*!
- \fn void QWSServer::setMouseHandler(QWSMouseHandler* driver)
-
- Sets the primary mouse driver to be the given \a driver.
-
- \l{Qt for Embedded Linux} provides several ready-made mouse drivers, and
- custom drivers are typically added using Qt's plugin
- mechanism. See the \l{Qt for Embedded Linux Pointer Handling} documentation
- for details.
-
- Note that this function can only be used in the server process.
-
- \sa mouseHandler(), setDefaultMouse()
-*/
-void QWSServer::setMouseHandler(QWSMouseHandler* mh)
-{
- if (!mh)
- return;
- qwsServerPrivate->mousehandlers.removeAll(mh);
- qwsServerPrivate->mousehandlers.prepend(mh);
-}
-
-/*!
- \internal
- \obsolete
- Caller owns data in list, and must delete contents
-*/
-QList<QWSInternalWindowInfo*> * QWSServer::windowList()
-{
- QList<QWSInternalWindowInfo*> * ret=new QList<QWSInternalWindowInfo*>;
- for (int i=0; i < qwsServerPrivate->windows.size(); ++i) {
- QWSWindow *window = qwsServerPrivate->windows.at(i);
- QWSInternalWindowInfo * qwi=new QWSInternalWindowInfo();
- qwi->winid=window->winId();
- qwi->clientid=window->client()->clientId();
- ret->append(qwi);
- }
- return ret;
-}
-
-#ifndef QT_NO_COP
-/*!
- \internal
-*/
-void QWSServerPrivate::sendQCopEvent(QWSClient *c, const QString &ch,
- const QString &msg, const QByteArray &data,
- bool response)
-{
- Q_ASSERT(c);
-
- QWSQCopMessageEvent event;
- event.channel = ch.toLatin1();
- event.message = msg.toLatin1();
- event.data = data;
- event.simpleData.is_response = response;
- event.simpleData.lchannel = ch.length();
- event.simpleData.lmessage = msg.length();
- event.simpleData.ldata = data.size();
- int l = event.simpleData.lchannel + event.simpleData.lmessage +
- event.simpleData.ldata;
-
- // combine channel, message and data into one block of raw bytes
- char *tmp = new char [l];
- char *d = tmp;
- memcpy(d, event.channel.constData(), event.simpleData.lchannel);
- d += event.simpleData.lchannel;
- memcpy(d, event.message.constData(), event.simpleData.lmessage);
- d += event.simpleData.lmessage;
- memcpy(d, data.constData(), event.simpleData.ldata);
-
- event.setDataDirect(tmp, l);
-
- c->sendEvent(&event);
-}
-#endif
-
-/*!
- \fn QWSWindow *QWSServer::windowAt(const QPoint& position)
-
- Returns the window containing the given \a position.
-
- Note that if there is no window under the specified point this
- function returns 0.
-
- \sa clientWindows(), instance()
-*/
-QWSWindow *QWSServer::windowAt(const QPoint& pos)
-{
- Q_D(QWSServer);
- for (int i=0; i<d->windows.size(); ++i) {
- QWSWindow* w = d->windows.at(i);
- if (w->allocatedRegion().contains(pos))
- return w;
- }
- return 0;
-}
-
-#ifndef QT_NO_QWS_KEYBOARD
-static int keyUnicode(int keycode)
-{
- int code = 0xffff;
-
- if (keycode >= Qt::Key_A && keycode <= Qt::Key_Z)
- code = keycode - Qt::Key_A + 'a';
- else if (keycode >= Qt::Key_0 && keycode <= Qt::Key_9)
- code = keycode - Qt::Key_0 + '0';
-
- return code;
-}
-#endif
-
-/*!
- Sends the given key event. The key is identified by its \a unicode
- value and the given \a keycode, \a modifiers, \a isPress and \a
- autoRepeat parameters.
-
- Use this function to send key events generated by "virtual
- keyboards" (note that the processKeyEvent() function is
- impelemented using this function).
-
- The \a keycode parameter is the Qt keycode value as defined by the
- Qt::Key enum. The \a modifiers is an OR combination of
- Qt::KeyboardModifier values, indicating whether \gui
- Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true
- if the event is a key press event and \a autoRepeat is true if the
- event is caused by an auto-repeat mechanism and not an actual key
- press.
-
- Note that this function can only be used in the server process.
-
- \sa processKeyEvent(), {Qt for Embedded Linux Character Input}
-*/
-void QWSServer::sendKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat)
-{
- qws_keyModifiers = modifiers;
-
- if (isPress) {
- if (keycode != Qt::Key_F34 && keycode != Qt::Key_F35)
- qwsServerPrivate->_q_screenSaverWake();
- }
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
- if (!current_IM || !current_IM->filter(unicode, keycode, modifiers, isPress, autoRepeat))
- QWSServerPrivate::sendKeyEventUnfiltered(unicode, keycode, modifiers, isPress, autoRepeat);
-#else
- QWSServerPrivate::sendKeyEventUnfiltered(unicode, keycode, modifiers, isPress, autoRepeat);
-#endif
-}
-
-void QWSServerPrivate::sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat)
-{
-
- QWSKeyEvent event;
- QWSWindow *win = keyboardGrabber ? keyboardGrabber :
- qwsServerPrivate->focusw;
-
- event.simpleData.window = win ? win->winId() : 0;
-
- event.simpleData.unicode =
-#ifndef QT_NO_QWS_KEYBOARD
- unicode < 0 ? keyUnicode(keycode) :
-#endif
- unicode;
- event.simpleData.keycode = keycode;
- event.simpleData.modifiers = modifiers;
- event.simpleData.is_press = isPress;
- event.simpleData.is_auto_repeat = autoRepeat;
-
- QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1);
- QWSClient *winClient = win ? win->client() : 0;
- if (serverClient)
- serverClient->sendEvent(&event);
- if (winClient && winClient != serverClient)
- winClient->sendEvent(&event);
-}
-
-/*!
- \internal
-*/
-void QWSServer::beginDisplayReconfigure()
-{
- qwsServer->enablePainting(false);
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor)
- qt_screencursor->hide();
-#endif
- QWSDisplay::grab(true);
- qt_screen->disconnect();
-}
-
-/*!
- \internal
-*/
-void QWSServer::endDisplayReconfigure()
-{
- qt_screen->connect(QString());
- qwsServerPrivate->swidth = qt_screen->deviceWidth();
- qwsServerPrivate->sheight = qt_screen->deviceHeight();
-
- QWSDisplay::ungrab();
-#ifndef QT_NO_QWS_CURSOR
- if (qt_screencursor)
- qt_screencursor->show();
-#endif
- QApplicationPrivate *ap = QApplicationPrivate::instance();
- ap->setMaxWindowRect(qt_screen, 0,
- QRect(0, 0, qt_screen->width(), qt_screen->height()));
- QSize olds = qApp->desktop()->size();
- qApp->desktop()->resize(qt_screen->width(), qt_screen->height());
- qApp->postEvent(qApp->desktop(), new QResizeEvent(qApp->desktop()->size(), olds));
- qwsServer->enablePainting(true);
- qwsServer->refresh();
- qDebug("Desktop size: %dx%d", qApp->desktop()->width(), qApp->desktop()->height());
-}
-
-void QWSServerPrivate::resetEngine()
-{
-#ifndef QT_NO_QWS_CURSOR
- if (!qt_screencursor)
- return;
- qt_screencursor->hide();
- qt_screencursor->show();
-#endif
-}
-
-
-#ifndef QT_NO_QWS_CURSOR
-/*!
- \fn void QWSServer::setCursorVisible(bool visible)
-
- Shows the cursor if \a visible is true: otherwise the cursor is
- hidden.
-
- Note that this function can only be used in the server process.
-
- \sa isCursorVisible()
-*/
-void QWSServer::setCursorVisible(bool vis)
-{
- if (qwsServerPrivate && qwsServerPrivate->haveviscurs != vis) {
- QWSCursor* c = qwsServerPrivate->cursor;
- qwsServerPrivate->setCursor(QWSCursor::systemCursor(Qt::BlankCursor));
- qwsServerPrivate->haveviscurs = vis;
- qwsServerPrivate->setCursor(c);
- }
-}
-
-/*!
- Returns true if the cursor is visible; otherwise returns false.
-
- Note that this function can only be used in the server process.
-
- \sa setCursorVisible()
-*/
-bool QWSServer::isCursorVisible()
-{
- return qwsServerPrivate ? qwsServerPrivate->haveviscurs : true;
-}
-#endif
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-
-/*!
- \fn void QWSServer::sendIMEvent(const QInputMethodEvent *event)
-
- Sends the given input method \a event.
-
- The \c QInputMethodEvent class is derived from QWSEvent, i.e., it
- is a QWSEvent object of the QWSEvent::IMEvent type.
-
- If there is a window actively composing the preedit string, the
- event is sent to that window. Otherwise, the event is sent to the
- window currently in focus.
-
- \sa sendIMQuery(), QWSInputMethod::sendEvent()
-*/
-void QWSServer::sendIMEvent(const QInputMethodEvent *ime)
-{
- QWSIMEvent event;
-
- QWSWindow *win = keyboardGrabber ? keyboardGrabber :
- qwsServerPrivate->focusw;
-
- //if currently composing then event must go to the composing window
-
- if (current_IM_composing_win)
- win = current_IM_composing_win;
-
- event.simpleData.window = win ? win->winId() : 0;
- event.simpleData.replaceFrom = ime->replacementStart();;
- event.simpleData.replaceLength = ime->replacementLength();
-
- QBuffer buffer;
- buffer.open(QIODevice::WriteOnly);
- QDataStream out(&buffer);
-
- out << ime->preeditString();
- out << ime->commitString();
-
- const QList<QInputMethodEvent::Attribute> &attributes = ime->attributes();
- for (int i = 0; i < attributes.count(); ++i) {
- const QInputMethodEvent::Attribute &a = attributes.at(i);
- out << a.type << a.start << a.length << a.value;
- }
- event.setData(buffer.data(), buffer.size());
- QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1);
- if (serverClient)
- serverClient->sendEvent(&event);
- if (win && win->client() && win->client() != serverClient)
- win->client()->sendEvent(&event);
-
- current_IM_composing_win = ime->preeditString().isEmpty() ? 0 : win;
- current_IM_winId = win ? win->winId() : 0;
-}
-
-
-/*!
- Sends an input method query for the given \a property.
-
- To receive responses to input method queries, the virtual
- QWSInputMethod::queryResponse() function must be reimplemented in
- a QWSInputMethod subclass that is activated using the
- setCurrentInputMethod() function.
-
- \sa sendIMEvent(), setCurrentInputMethod()
-*/
-void QWSServer::sendIMQuery(int property)
-{
- QWSIMQueryEvent event;
-
- QWSWindow *win = keyboardGrabber ? keyboardGrabber :
- qwsServerPrivate->focusw;
- if (current_IM_composing_win)
- win = current_IM_composing_win;
-
- event.simpleData.window = win ? win->winId() : 0;
- event.simpleData.property = property;
- if (win && win->client())
- win->client()->sendEvent(&event);
-}
-
-
-
-/*!
- \fn void QWSServer::setCurrentInputMethod(QWSInputMethod *method)
-
- Sets the current input method to be the given \a method.
-
- Note that this function can only be used in the server process.
-
- \sa sendIMQuery(), sendIMEvent()
-*/
-void QWSServer::setCurrentInputMethod(QWSInputMethod *im)
-{
- if (current_IM)
- current_IM->reset(); //??? send an update event instead ?
- current_IM = im;
-}
-
-/*!
- \fn static void QWSServer::resetInputMethod()
-
- \internal
-*/
-
-#endif //QT_NO_QWS_INPUTMETHODS
-
-#ifndef QT_NO_QWS_PROPERTIES
-/*!
- \internal
-*/
-void QWSServer::sendPropertyNotifyEvent(int property, int state)
-{
- Q_D(QWSServer);
- QWSServerPrivate::ClientIterator it = d->clientMap.begin();
- while (it != d->clientMap.end()) {
- QWSClient *cl = *it;
- ++it;
- cl->sendPropertyNotifyEvent(property, state);
- }
-}
-#endif
-
-void QWSServerPrivate::invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client)
-{
- client->setIdentity(cmd->id);
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (client->clientId() > 0)
- client->d_func()->setLockId(cmd->simpleData.idLock);
-#endif
-}
-
-void QWSServerPrivate::invokeCreate(QWSCreateCommand *cmd, QWSClient *client)
-{
- QWSCreationEvent event;
- event.simpleData.objectid = get_object_id(cmd->count);
- event.simpleData.count = cmd->count;
- client->sendEvent(&event);
-}
-
-void QWSServerPrivate::invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client)
-{
- Q_Q(QWSServer);
- QWSWindow* changingw = findWindow(cmd->simpleData.windowid, client);
- if (changingw && (changingw->name() != cmd->name || changingw->caption() !=cmd->caption)) {
- changingw->setName(cmd->name);
- changingw->setCaption(cmd->caption);
- emit q->windowEvent(changingw, QWSServer::Name);
- }
-}
-
-void QWSServerPrivate::invokeRegion(QWSRegionCommand *cmd, QWSClient *client)
-{
-#ifdef QWS_REGION_DEBUG
- qDebug("QWSServer::invokeRegion %d rects (%d)",
- cmd->simpleData.nrectangles, cmd->simpleData.windowid);
-#endif
-
- QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0);
- if (!changingw) {
- qWarning("Invalid window handle %08x",cmd->simpleData.windowid);
- return;
- }
- if (!changingw->forClient(client)) {
- qWarning("Disabled: clients changing other client's window region");
- return;
- }
-
- request_region(cmd->simpleData.windowid, cmd->surfaceKey, cmd->surfaceData,
- cmd->region);
-}
-
-void QWSServerPrivate::invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client)
-{
- Q_Q(QWSServer);
- QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0);
- if (!changingw) {
- qWarning("invokeRegionMove: Invalid window handle %d",cmd->simpleData.windowid);
- return;
- }
- if (!changingw->forClient(client)) {
- qWarning("Disabled: clients changing other client's window region");
- return;
- }
-
-// changingw->setNeedAck(true);
- moveWindowRegion(changingw, cmd->simpleData.dx, cmd->simpleData.dy);
- emit q->windowEvent(changingw, QWSServer::Geometry);
-}
-
-void QWSServerPrivate::invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client)
-{
- Q_Q(QWSServer);
- QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0);
- if (!changingw) {
- qWarning("invokeRegionDestroy: Invalid window handle %d",cmd->simpleData.windowid);
- return;
- }
- if (!changingw->forClient(client)) {
- qWarning("Disabled: clients changing other client's window region");
- return;
- }
-
- setWindowRegion(changingw, QRegion());
-// rgnMan->remove(changingw->allocationIndex());
- for (int i = 0; i < windows.size(); ++i) {
- if (windows.at(i) == changingw) {
- windows.takeAt(i);
- if (i < nReserved)
- --nReserved;
- break;
- }
- }
-
- handleWindowClose(changingw);
-#ifndef QT_NO_QWS_PROPERTIES
- propertyManager.removeProperties(changingw->winId());
-#endif
- emit q->windowEvent(changingw, QWSServer::Destroy);
- delete changingw;
-}
-
-void QWSServerPrivate::invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client)
-{
- int winId = cmd->simpleData.windowid;
- int gain = cmd->simpleData.flag;
-
- if (gain != 0 && gain != 1) {
- qWarning("Only 0(lose) and 1(gain) supported");
- return;
- }
-
- QWSWindow* changingw = findWindow(winId, 0);
- if (!changingw)
- return;
-
- if (!changingw->forClient(client)) {
- qWarning("Disabled: clients changing other client's focus");
- return;
- }
-
- setFocus(changingw, gain);
-}
-
-void QWSServerPrivate::setFocus(QWSWindow* changingw, bool gain)
-{
- Q_Q(QWSServer);
-#ifndef QT_NO_QWS_INPUTMETHODS
- /*
- This is the logic:
- QWSWindow *loser = 0;
- if (gain && focusw != changingw)
- loser = focusw;
- else if (!gain && focusw == changingw)
- loser = focusw;
- But these five lines can be reduced to one:
- */
- if (current_IM) {
- QWSWindow *loser = (!gain == (focusw==changingw)) ? focusw : 0;
- if (loser && loser->winId() == current_IM_winId)
- current_IM->updateHandler(QWSInputMethod::FocusOut);
- }
-#endif
- if (gain) {
- if (focusw != changingw) {
- if (focusw) focusw->focus(0);
- focusw = changingw;
- focusw->focus(1);
- emit q->windowEvent(focusw, QWSServer::Active);
- }
- } else if (focusw == changingw) {
- if (changingw->client())
- changingw->focus(0);
- focusw = 0;
- // pass focus to window which most recently got it...
- QWSWindow* bestw=0;
- for (int i=0; i<windows.size(); ++i) {
- QWSWindow* w = windows.at(i);
- if (w != changingw && !w->hidden() &&
- (!bestw || bestw->focusPriority() < w->focusPriority()))
- bestw = w;
- }
- if (!bestw && changingw->focusPriority()) { // accept focus back?
- bestw = changingw; // must be the only one
- }
- focusw = bestw;
- if (focusw) {
- focusw->focus(1);
- emit q->windowEvent(focusw, QWSServer::Active);
- }
- }
-}
-
-
-
-void QWSServerPrivate::invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client)
-{
- Q_UNUSED( client );
- int winId = cmd->simpleData.windowid;
- int opacity = cmd->simpleData.opacity;
-
- QWSWindow* changingw = findWindow(winId, 0);
-
- if (!changingw) {
- qWarning("invokeSetOpacity: Invalid window handle %d", winId);
- return;
- }
-
- int altitude = windows.indexOf(changingw);
- const bool wasOpaque = changingw->isOpaque();
- changingw->_opacity = opacity;
- if (wasOpaque != changingw->isOpaque())
- update_regions();
- exposeRegion(changingw->allocatedRegion(), altitude);
-}
-
-void QWSServerPrivate::invokeSetAltitude(const QWSChangeAltitudeCommand *cmd,
- QWSClient *client)
-{
- Q_UNUSED(client);
-
- int winId = cmd->simpleData.windowid;
- int alt = cmd->simpleData.altitude;
- bool fixed = cmd->simpleData.fixed;
-#if 0
- qDebug("QWSServer::invokeSetAltitude winId %d alt %d)", winId, alt);
-#endif
-
- if (alt < -1 || alt > 1) {
- qWarning("QWSServer::invokeSetAltitude Only lower, raise and stays-on-top supported");
- return;
- }
-
- QWSWindow* changingw = findWindow(winId, 0);
- if (!changingw) {
- qWarning("invokeSetAltitude: Invalid window handle %d", winId);
- return;
- }
-
- if (fixed && alt >= 1) {
- changingw->onTop = true;
- }
- if (alt == QWSChangeAltitudeCommand::Lower)
- changingw->lower();
- else
- changingw->raise();
-
-// if (!changingw->forClient(client)) {
-// refresh();
-// }
-}
-
-#ifndef QT_NO_QWS_PROPERTIES
-void QWSServerPrivate::invokeAddProperty(QWSAddPropertyCommand *cmd)
-{
- propertyManager.addProperty(cmd->simpleData.windowid, cmd->simpleData.property);
-}
-
-void QWSServerPrivate::invokeSetProperty(QWSSetPropertyCommand *cmd)
-{
- Q_Q(QWSServer);
- if (propertyManager.setProperty(cmd->simpleData.windowid,
- cmd->simpleData.property,
- cmd->simpleData.mode,
- cmd->data,
- cmd->rawLen)) {
- q->sendPropertyNotifyEvent(cmd->simpleData.property,
- QWSPropertyNotifyEvent::PropertyNewValue);
-#ifndef QT_NO_QWS_INPUTMETHODS
- if (cmd->simpleData.property == QT_QWS_PROPERTY_MARKEDTEXT) {
- QString s((const QChar*)cmd->data, cmd->rawLen/2);
- emit q->markedText(s);
- }
-#endif
- }
-}
-
-void QWSServerPrivate::invokeRemoveProperty(QWSRemovePropertyCommand *cmd)
-{
- Q_Q(QWSServer);
- if (propertyManager.removeProperty(cmd->simpleData.windowid,
- cmd->simpleData.property)) {
- q->sendPropertyNotifyEvent(cmd->simpleData.property,
- QWSPropertyNotifyEvent::PropertyDeleted);
- }
-}
-
-
-bool QWSServerPrivate:: get_property(int winId, int property, const char *&data, int &len)
-{
- return propertyManager.getProperty(winId, property, data, len);
-}
-
-
-void QWSServerPrivate::invokeGetProperty(QWSGetPropertyCommand *cmd, QWSClient *client)
-{
- const char *data;
- int len;
-
- if (propertyManager.getProperty(cmd->simpleData.windowid,
- cmd->simpleData.property,
- data, len)) {
- client->sendPropertyReplyEvent(cmd->simpleData.property, len, data);
- } else {
- client->sendPropertyReplyEvent(cmd->simpleData.property, -1, 0);
- }
-}
-#endif //QT_NO_QWS_PROPERTIES
-
-void QWSServerPrivate::invokeSetSelectionOwner(QWSSetSelectionOwnerCommand *cmd)
-{
- qDebug("QWSServer::invokeSetSelectionOwner");
-
- SelectionOwner so;
- so.windowid = cmd->simpleData.windowid;
- so.time.set(cmd->simpleData.hour, cmd->simpleData.minute,
- cmd->simpleData.sec, cmd->simpleData.ms);
-
- if (selectionOwner.windowid != -1) {
- QWSWindow *win = findWindow(selectionOwner.windowid, 0);
- if (win)
- win->client()->sendSelectionClearEvent(selectionOwner.windowid);
- else
- qDebug("couldn't find window %d", selectionOwner.windowid);
- }
-
- selectionOwner = so;
-}
-
-void QWSServerPrivate::invokeConvertSelection(QWSConvertSelectionCommand *cmd)
-{
- qDebug("QWSServer::invokeConvertSelection");
-
- if (selectionOwner.windowid != -1) {
- QWSWindow *win = findWindow(selectionOwner.windowid, 0);
- if (win)
- win->client()->sendSelectionRequestEvent(cmd, selectionOwner.windowid);
- else
- qDebug("couldn't find window %d", selectionOwner.windowid);
- }
-}
-
-#ifndef QT_NO_QWS_CURSOR
-void QWSServerPrivate::invokeDefineCursor(QWSDefineCursorCommand *cmd, QWSClient *client)
-{
- if (cmd->simpleData.height > 64 || cmd->simpleData.width > 64) {
- qDebug("Cannot define cursor size > 64x64");
- return;
- }
-
- delete client->cursors.take(cmd->simpleData.id);
-
- int dataLen = cmd->simpleData.height * ((cmd->simpleData.width+7) / 8);
-
- if (dataLen > 0 && cmd->data) {
- QWSCursor *curs = new QWSCursor(cmd->data, cmd->data + dataLen,
- cmd->simpleData.width, cmd->simpleData.height,
- cmd->simpleData.hotX, cmd->simpleData.hotY);
- client->cursors.insert(cmd->simpleData.id, curs);
- }
-}
-
-void QWSServerPrivate::invokeSelectCursor(QWSSelectCursorCommand *cmd, QWSClient *client)
-{
- int id = cmd->simpleData.id;
- QWSCursor *curs = 0;
- if (id <= Qt::LastCursor) {
- curs = QWSCursor::systemCursor(id);
- }
- else {
- QWSCursorMap cursMap = client->cursors;
- QWSCursorMap::Iterator it = cursMap.find(id);
- if (it != cursMap.end()) {
- curs = it.value();
- }
- }
- if (curs == 0) {
- curs = QWSCursor::systemCursor(Qt::ArrowCursor);
- }
-
- QWSWindow* win = findWindow(cmd->simpleData.windowid, 0);
- if (mouseGrabber) {
- // If the mouse is being grabbed, we don't want just anyone to
- // be able to change the cursor. We do want the cursor to be set
- // correctly once mouse grabbing is stopped though.
- if (win != mouseGrabber)
- nextCursor = curs;
- else
- setCursor(curs);
- } else if (win && win->allocatedRegion().contains(QWSServer::mousePosition)) { //##################### cursor
- // A non-grabbing window can only set the cursor shape if the
- // cursor is within its allocated region.
- setCursor(curs);
- }
-}
-
-void QWSServerPrivate::invokePositionCursor(QWSPositionCursorCommand *cmd, QWSClient *)
-{
- Q_Q(QWSServer);
- QPoint newPos(cmd->simpleData.newX, cmd->simpleData.newY);
- if (newPos != QWSServer::mousePosition)
- q->sendMouseEvent(newPos, qwsServer->d_func()->mouseState);
-}
-#endif
-
-void QWSServerPrivate::invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client)
-{
- QWSWindow* win = findWindow(cmd->simpleData.windowid, 0);
- if (!win)
- return;
-
- if (cmd->simpleData.grab) {
- if (!mouseGrabber || mouseGrabber->client() == client) {
- mouseGrabbing = true;
- mouseGrabber = win;
- }
- } else {
- releaseMouse(mouseGrabber);
- }
-}
-
-void QWSServerPrivate::invokeGrabKeyboard(QWSGrabKeyboardCommand *cmd, QWSClient *client)
-{
- QWSWindow* win = findWindow(cmd->simpleData.windowid, 0);
- if (!win)
- return;
-
- if (cmd->simpleData.grab) {
- if (!keyboardGrabber || (keyboardGrabber->client() == client)) {
- keyboardGrabbing = true;
- keyboardGrabber = win;
- }
- } else {
- releaseKeyboard(keyboardGrabber);
- }
-}
-
-#if !defined(QT_NO_SOUND)
-void QWSServerPrivate::invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *)
-{
-#if !defined(QT_EXTERNAL_SOUND_SERVER) && !defined(Q_OS_DARWIN)
- soundserver->playFile( 1, cmd->filename );
-#else
- Q_UNUSED(cmd);
-#endif
-}
-#endif
-
-#ifndef QT_NO_COP
-void QWSServerPrivate::invokeRegisterChannel(QWSQCopRegisterChannelCommand *cmd,
- QWSClient *client)
-{
- // QCopChannel will force us to emit the newChannel signal if this channel
- // didn't already exist.
- QCopChannel::registerChannel(cmd->channel, client);
-}
-
-void QWSServerPrivate::invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client)
-{
- QCopChannel::answer(client, cmd->channel, cmd->message, cmd->data);
-}
-
-#endif
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-void QWSServer::resetInputMethod()
-{
- if (current_IM && qwsServer) {
- current_IM->reset();
- }
-}
-
-void QWSServerPrivate::invokeIMResponse(const QWSIMResponseCommand *cmd,
- QWSClient *)
-{
- if (current_IM)
- current_IM->queryResponse(cmd->simpleData.property, cmd->result);
-}
-
-void QWSServerPrivate::invokeIMUpdate(const QWSIMUpdateCommand *cmd,
- QWSClient *)
-{
- if (cmd->simpleData.type == QWSInputMethod::FocusIn)
- current_IM_winId = cmd->simpleData.windowid;
-
- if (current_IM && (current_IM_winId == cmd->simpleData.windowid || cmd->simpleData.windowid == -1))
- current_IM->updateHandler(cmd->simpleData.type);
-}
-
-#endif
-
-void QWSServerPrivate::invokeFont(const QWSFontCommand *cmd, QWSClient *client)
-{
- QWSClientPrivate *priv = client->d_func();
- if (cmd->simpleData.type == QWSFontCommand::StartedUsingFont) {
- referenceFont(priv, cmd->fontName);
- } else if (cmd->simpleData.type == QWSFontCommand::StoppedUsingFont) {
- dereferenceFont(priv, cmd->fontName);
- }
-}
-
-void QWSServerPrivate::invokeRepaintRegion(QWSRepaintRegionCommand * cmd,
- QWSClient *)
-{
- QRegion r;
- r.setRects(cmd->rectangles,cmd->simpleData.nrectangles);
- repaint_region(cmd->simpleData.windowid, cmd->simpleData.windowFlags, cmd->simpleData.opaque, r);
-}
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-void QWSServerPrivate::invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client)
-{
- // Should find these two windows in a single loop
- QWSWindow *embedder = findWindow(cmd->simpleData.embedder, client);
- QWSWindow *embedded = findWindow(cmd->simpleData.embedded);
-
- if (!embedder) {
- qWarning("QWSServer: Embed command from window %i failed: No such id.",
- static_cast<int>(cmd->simpleData.embedder));
- return;
- }
-
- if (!embedded) {
- qWarning("QWSServer: Embed command on window %i failed: No such id.",
- static_cast<int>(cmd->simpleData.embedded));
- return;
- }
-
- switch (cmd->simpleData.type) {
- case QWSEmbedEvent::StartEmbed:
- embedder->startEmbed(embedded);
- windows.removeAll(embedded);
- windows.insert(windows.indexOf(embedder), embedded);
- break;
- case QWSEmbedEvent::StopEmbed:
- embedder->stopEmbed(embedded);
- break;
- case QWSEmbedEvent::Region:
- break;
- }
-
- embedded->client()->sendEmbedEvent(embedded->winId(),
- cmd->simpleData.type, cmd->region);
- const QRegion oldAllocated = embedded->allocatedRegion();
- update_regions();
- exposeRegion(oldAllocated - embedded->allocatedRegion(),
- windows.indexOf(embedded));
-}
-#endif // QT_NO_QWSEMBEDWIDGET
-
-void QWSServerPrivate::invokeScreenTransform(const QWSScreenTransformCommand *cmd,
- QWSClient *client)
-{
- Q_UNUSED(client);
-
- QWSScreenTransformationEvent event;
- event.simpleData.screen = cmd->simpleData.screen;
- event.simpleData.transformation = cmd->simpleData.transformation;
-
- QMap<int, QWSClient*>::const_iterator it = clientMap.constBegin();
- for (; it != clientMap.constEnd(); ++it)
- (*it)->sendEvent(&event);
-}
-
-QWSWindow* QWSServerPrivate::newWindow(int id, QWSClient* client)
-{
- Q_Q(QWSServer);
- // Make a new window, put it on top.
- QWSWindow* w = new QWSWindow(id,client);
-
- // insert after "stays on top" windows
- bool added = false;
- for (int i = nReserved; i < windows.size(); ++i) {
- QWSWindow *win = windows.at(i);
- if (!win->onTop) {
- windows.insert(i, w);
- added = true;
- break;
- }
- }
- if (!added)
- windows.append(w);
- emit q->windowEvent(w, QWSServer::Create);
- return w;
-}
-
-QWSWindow* QWSServerPrivate::findWindow(int windowid, QWSClient* client)
-{
- for (int i=0; i<windows.size(); ++i) {
- QWSWindow* w = windows.at(i);
- if (w->winId() == windowid)
- return w;
- }
- if (client)
- return newWindow(windowid,client);
- else
- return 0;
-}
-
-void QWSServerPrivate::raiseWindow(QWSWindow *changingw, int /*alt*/)
-{
- Q_Q(QWSServer);
- if (changingw == windows.first())
- return;
- QWSWindow::State oldstate = changingw->d->state;
- changingw->d->state = QWSWindow::Raising;
- // Expose regions previously overlapped by transparent windows
- const QRegion bound = changingw->allocatedRegion();
- QRegion expose;
- int windowPos = 0;
-
- //change position in list:
- for (int i = 0; i < windows.size(); ++i) {
- QWSWindow *w = windows.at(i);
- if (w == changingw) {
- windowPos = i;
- windows.takeAt(i);
- break;
- }
- if (!w->isOpaque())
- expose += (w->allocatedRegion() & bound);
- }
-
- bool onTop = changingw->onTop;
-
-#ifndef QT_NO_QWSEMBEDWIDGET
- // an embedded window is on top if the embedder is on top
- QWSWindow *embedder = changingw->d->embedder;
- while (!onTop && embedder) {
- onTop = embedder->onTop;
- embedder = embedder->d->embedder;
- }
-#endif
-
- int newPos = -1;
- if (onTop) {
- windows.insert(nReserved, changingw);
- newPos = nReserved;
- } else {
- // insert after "stays on top" windows
- bool in = false;
- for (int i = nReserved; i < windows.size(); ++i) {
- QWSWindow *w = windows.at(i);
- if (!w->onTop) {
- windows.insert(i, changingw);
- in = true;
- newPos = i;
- break;
- }
- }
- if (!in) {
- windows.append(changingw);
- newPos = windows.size()-1;
- }
- }
-
- if (windowPos != newPos) {
- update_regions();
- if (!expose.isEmpty())
- exposeRegion(expose, newPos);
- }
- changingw->d->state = oldstate;
- emit q->windowEvent(changingw, QWSServer::Raise);
-}
-
-void QWSServerPrivate::lowerWindow(QWSWindow *changingw, int /*alt*/)
-{
- Q_Q(QWSServer);
- if (changingw == windows.last())
- return;
- QWSWindow::State oldstate = changingw->d->state;
- changingw->d->state = QWSWindow::Lowering;
-
- int i = windows.indexOf(changingw);
- int newIdx = windows.size()-1;
- windows.move(i, newIdx);
-
- const QRegion bound = changingw->allocatedRegion();
-
- update_regions();
-
- // Expose regions previously overlapped by transparent window
- if (!changingw->isOpaque()) {
- QRegion expose;
- for (int j = i; j < windows.size() - 1; ++j)
- expose += (windows.at(j)->allocatedRegion() & bound);
- if (!expose.isEmpty())
- exposeRegion(expose, newIdx);
- }
-
- changingw->d->state = oldstate;
- emit q->windowEvent(changingw, QWSServer::Lower);
-}
-
-void QWSServerPrivate::update_regions()
-{
- if (disablePainting)
- return;
-
- QRegion available = QRect(0, 0, qt_screen->width(), qt_screen->height());
- QRegion transparentRegion;
-
- // only really needed if there are unbuffered surfaces...
- const bool doLock = (clientMap.size() > 1);
- if (doLock)
- QWSDisplay::grab(true);
-
- for (int i = 0; i < windows.count(); ++i) {
- QWSWindow *w = windows.at(i);
- QRegion r = (w->requested_region & available);
-
-#ifndef QT_NO_QWSEMBEDWIDGET
- // Subtract regions needed for embedded windows
- const int n = w->d->embedded.size();
- for (int i = 0; i < n; ++i)
- r -= w->d->embedded.at(i)->allocatedRegion();
-
- // Limited to the embedder region
- if (w->d->embedder)
- r &= w->d->embedder->requested_region;
-#endif // QT_NO_QWSEMBEDWIDGET
-
- QWSWindowSurface *surface = w->windowSurface();
- const bool opaque = w->isOpaque()
- && (w->d->painted || !surface || !surface->isBuffered());
-
- if (!opaque) {
- transparentRegion += r;
- } else {
- if (surface && (surface->isRegionReserved() || !surface->isBuffered()))
- r -= transparentRegion;
- available -= r;
- }
-
- if (r != w->allocatedRegion()) {
- w->setAllocatedRegion(r);
- w->client()->sendRegionEvent(w->winId(), r,
- QWSRegionEvent::Allocation);
- }
-
-#ifdef QT_QWS_CLIENTBLIT
-#ifdef QT_NO_QWS_CURSOR
- // This optimization only really works when there isn't a crazy cursor
- // wizzing around.
- QRegion directPaint = (r - transparentRegion); // in gloal coords
- if(directPaint != w->directPaintRegion()) {
- w->setDirectPaintRegion(directPaint);
- static int id = 0;
- surface->setDirectRegion(directPaint, ++id);
- w->client()->sendRegionEvent(w->winId(), directPaint,
- QWSRegionEvent::DirectPaint, id);
- }
-#endif
-#endif
- }
-
- if (doLock)
- QWSDisplay::ungrab();
-}
-
-void QWSServerPrivate::moveWindowRegion(QWSWindow *changingw, int dx, int dy)
-{
- if (!changingw)
- return;
-
- QWSWindow::State oldState = changingw->d->state;
- changingw->d->state = QWSWindow::Moving;
- const QRegion oldRegion(changingw->allocatedRegion());
- changingw->requested_region.translate(dx, dy);
-
- // hw: Even if the allocated region doesn't change, the requested region
- // region has changed and we need to send region events.
- // Resetting the allocated region to force update_regions to send events.
- changingw->setAllocatedRegion(QRegion());
- update_regions();
- const QRegion newRegion(changingw->allocatedRegion());
-
- QWSWindowSurface *surface = changingw->windowSurface();
- QRegion expose;
- if (surface)
- expose = surface->move(QPoint(dx, dy), changingw->allocatedRegion());
- else
- expose = oldRegion + newRegion;
-
- if (!changingw->d->painted && !expose.isEmpty())
- expose = oldRegion - newRegion;
-
- int idx = windows.indexOf(changingw);
- exposeRegion(expose, idx);
- changingw->d->state = oldState;
-}
-
-/*!
- Changes the requested region of window \a changingw to \a r
- If \a changingw is 0, the server's reserved region is changed.
-*/
-void QWSServerPrivate::setWindowRegion(QWSWindow* changingw, const QRegion &r)
-{
- if (!changingw) {
- qWarning("Not implemented in this release");
- return;
- }
-
- if (changingw->requested_region == r)
- return;
-
- const QRegion oldRegion(changingw->allocatedRegion());
- changingw->requested_region = r;
- update_regions();
- const QRegion newRegion(changingw->allocatedRegion());
-
- int idx = windows.indexOf(changingw);
- exposeRegion(oldRegion - newRegion, idx);
-}
-
-
-void QWSServerPrivate::exposeRegion(const QRegion &r, int changing)
-{
- if (disablePainting)
- return;
-
- if (r.isEmpty())
- return;
-
- static bool initial = true;
- if (initial) {
- changing = 0;
- initial = false;
- qt_screen->exposeRegion(qt_screen->region(), changing);
- } else {
- qt_screen->exposeRegion(r, changing);
- }
-}
-
-/*!
- Closes all pointer devices (specified by the QWS_MOUSE_PROTO
- environment variable) by deleting the associated mouse drivers.
-
- \sa openMouse(), mouseHandler()
-*/
-void QWSServer::closeMouse()
-{
- Q_D(QWSServer);
- qDeleteAll(d->mousehandlers);
- d->mousehandlers.clear();
-}
-
-/*!
- Opens the mouse devices specified by the QWS_MOUSE_PROTO
- environment variable. Be advised that closeMouse() is called first
- to delete all the existing mouse handlers. This behaviour could be
- the cause of problems if you were not expecting it.
-
- \sa closeMouse(), mouseHandler()
-*/
-void QWSServer::openMouse()
-{
- Q_D(QWSServer);
- QString mice = QString::fromLatin1(qgetenv("QWS_MOUSE_PROTO"));
-#if defined(QT_QWS_CASSIOPEIA)
- if (mice.isEmpty())
- mice = QLatin1String("TPanel:/dev/tpanel");
-#endif
- if (mice.isEmpty())
- mice = *defaultMouse();
- closeMouse();
- bool needviscurs = true;
- if (mice != QLatin1String("None")) {
- const QStringList mouse = mice.split(QLatin1Char(' '));
- for (int i = mouse.size() - 1; i >= 0; --i) {
- QWSMouseHandler *handler = d->newMouseHandler(mouse.at(i));
- setMouseHandler(handler);
- /* XXX handle mouse cursor visibility sensibly
- if (!h->inherits("QCalibratedMouseHandler"))
- needviscurs = true;
- */
- }
- }
-#ifndef QT_NO_QWS_CURSOR
- setCursorVisible(needviscurs);
-#else
- Q_UNUSED(needviscurs)
-#endif
-}
-
-/*!
- Suspends pointer handling by deactivating all the mouse drivers
- registered by the QWS_MOUSE_PROTO environment variable.
-
-
- \sa resumeMouse(), QWSMouseHandler::suspend()
-*/
-void QWSServer::suspendMouse()
-{
- Q_D(QWSServer);
- for (int i=0; i < d->mousehandlers.size(); ++i)
- d->mousehandlers.at(i)->suspend();
-}
-
-/*!
- Resumes pointer handling by reactivating all the mouse drivers
- registered by the QWS_MOUSE_PROTO environment variable.
-
- \sa suspendMouse(), QWSMouseHandler::resume()
-*/
-void QWSServer::resumeMouse()
-{
- Q_D(QWSServer);
- for (int i=0; i < d->mousehandlers.size(); ++i)
- d->mousehandlers.at(i)->resume();
-}
-
-
-
-QWSMouseHandler* QWSServerPrivate::newMouseHandler(const QString& spec)
-{
- int c = spec.indexOf(QLatin1Char(':'));
- QString mouseProto;
- QString mouseDev;
- if (c >= 0) {
- mouseProto = spec.left(c);
- mouseDev = spec.mid(c+1);
- } else {
- mouseProto = spec;
- }
-
- int screen = -1;
- const QList<QRegExp> regexps = QList<QRegExp>()
- << QRegExp(QLatin1String(":screen=(\\d+)\\b"))
- << QRegExp(QLatin1String("\\bscreen=(\\d+):"));
- for (int i = 0; i < regexps.size(); ++i) {
- QRegExp regexp = regexps.at(i);
- if (regexp.indexIn(mouseDev) == -1)
- continue;
- screen = regexp.cap(1).toInt();
- mouseDev.remove(regexp.pos(0), regexp.matchedLength());
- break;
- }
-
- QWSMouseHandler *handler = 0;
- handler = QMouseDriverFactory::create(mouseProto, mouseDev);
- if (screen != -1)
- handler->setScreen(qt_screen->subScreens().at(screen));
-
- return handler;
-}
-
-#ifndef QT_NO_QWS_KEYBOARD
-
-/*!
- Closes all the keyboard devices (specified by the QWS_KEYBOARD
- environment variable) by deleting the associated keyboard
- drivers.
-
- \sa openKeyboard(), keyboardHandler()
-*/
-void QWSServer::closeKeyboard()
-{
- Q_D(QWSServer);
- qDeleteAll(d->keyboardhandlers);
- d->keyboardhandlers.clear();
-}
-
-/*!
- Returns the primary keyboard driver.
-
- Note that this function can only be used in the server process.
-
- \sa setKeyboardHandler(), openKeyboard(), closeKeyboard()
-*/
-QWSKeyboardHandler* QWSServer::keyboardHandler()
-{
- return qwsServerPrivate->keyboardhandlers.first();
-}
-
-/*!
- \fn void QWSServer::setKeyboardHandler(QWSKeyboardHandler* driver)
-
- Sets the primary keyboard driver to be the given \a driver.
-
- \l{Qt for Embedded Linux} provides several ready-made keyboard drivers, and
- custom drivers are typically added using Qt's plugin
- mechanism. See the \l{Qt for Embedded Linux Character Input} documentation
- for details.
-
- Note that this function can only be used in the server process.
-
- \sa keyboardHandler(), setDefaultKeyboard()
-*/
-void QWSServer::setKeyboardHandler(QWSKeyboardHandler* kh)
-{
- if (!kh)
- return;
- qwsServerPrivate->keyboardhandlers.removeAll(kh);
- qwsServerPrivate->keyboardhandlers.prepend(kh);
-}
-
-/*!
- Opens the keyboard devices specified by the QWS_KEYBOARD
- environment variable.
-
- \sa closeKeyboard(), keyboardHandler()
-*/
-void QWSServer::openKeyboard()
-{
- QString keyboards = QString::fromLatin1(qgetenv("QWS_KEYBOARD"));
-#if defined(QT_QWS_CASSIOPEIA)
- if (keyboards.isEmpty())
- keyboards = QLatin1String("Buttons");
-#endif
- if (keyboards.isEmpty())
- keyboards = *defaultKeyboard();
-
- closeKeyboard();
- if (keyboards == QLatin1String("None"))
- return;
-
- QString device;
- QString type;
- QStringList keyboard = keyboards.split(QLatin1Char(' '));
- for (int i = keyboard.size() - 1; i >= 0; --i) {
- const QString spec = keyboard.at(i);
- int colon=spec.indexOf(QLatin1Char(':'));
- if (colon>=0) {
- type = spec.left(colon);
- device = spec.mid(colon+1);
- } else {
- type = spec;
- device = QString();
- }
- QWSKeyboardHandler *handler = QKbdDriverFactory::create(type, device);
- setKeyboardHandler(handler);
- }
-}
-
-#endif //QT_NO_QWS_KEYBOARD
-
-QPoint QWSServer::mousePosition;
-QBrush *QWSServerPrivate::bgBrush = 0;
-
-void QWSServerPrivate::move_region(const QWSRegionMoveCommand *cmd)
-{
- QWSClient *serverClient = clientMap.value(-1);
- invokeRegionMove(cmd, serverClient);
-}
-
-void QWSServerPrivate::set_altitude(const QWSChangeAltitudeCommand *cmd)
-{
- QWSClient *serverClient = clientMap.value(-1);
- invokeSetAltitude(cmd, serverClient);
-}
-
-void QWSServerPrivate::set_opacity(const QWSSetOpacityCommand *cmd)
-{
- QWSClient *serverClient = clientMap.value(-1);
- invokeSetOpacity(cmd, serverClient);
-}
-
-
-void QWSServerPrivate::request_focus(const QWSRequestFocusCommand *cmd)
-{
- invokeSetFocus(cmd, clientMap.value(-1));
-}
-
-void QWSServerPrivate::set_identity(const QWSIdentifyCommand *cmd)
-{
- invokeIdentify(cmd, clientMap.value(-1));
-}
-
-void QWSServerPrivate::repaint_region(int wid, int windowFlags, bool opaque,
- const QRegion &region)
-{
- QWSWindow* changingw = findWindow(wid, 0);
- if (!changingw) {
- return;
- }
-
- const bool isOpaque = changingw->opaque;
- const bool wasPainted = changingw->d->painted;
- changingw->opaque = opaque;
- changingw->d->windowFlags = QFlag(windowFlags);
- changingw->d->dirtyOnScreen |= region;
- changingw->d->painted = true;
- if (isOpaque != opaque || !wasPainted)
- update_regions();
-
- int level = windows.indexOf(changingw);
- exposeRegion(region, level);
- changingw->d->dirtyOnScreen = QRegion();
-}
-
-QRegion QWSServerPrivate::reserve_region(QWSWindow *win, const QRegion &region)
-{
- QRegion r = region;
-
- int oldPos = windows.indexOf(win);
- int newPos = oldPos < nReserved ? nReserved - 1 : nReserved;
- for (int i = 0; i < nReserved; ++i) {
- if (i != oldPos) {
- QWSWindow *w = windows.at(i);
- r -= w->requested_region;
- }
- }
- windows.move(oldPos, newPos);
- nReserved = newPos + 1;
-
- return r;
-}
-
-void QWSServerPrivate::request_region(int wid, const QString &surfaceKey,
- const QByteArray &surfaceData,
- const QRegion &region)
-{
- QWSWindow *changingw = findWindow(wid, 0);
- if (!changingw)
- return;
-
- Q_Q(QWSServer);
- QWSWindow::State windowState = QWSWindow::NoState;
-
- if (region.isEmpty()) {
- windowState = QWSWindow::Hiding;
- emit q->windowEvent(changingw, QWSServer::Hide);
- }
-
- const bool wasOpaque = changingw->opaque;
-
- changingw->createSurface(surfaceKey, surfaceData);
- QWSWindowSurface *surface = changingw->windowSurface();
-
- changingw->opaque = surface->isOpaque();
-
- QRegion r;
- if (surface->isRegionReserved())
- r = reserve_region(changingw, region);
- else
- r = region;
-
- if (!region.isEmpty()) {
- if (changingw->isVisible())
- windowState = QWSWindow::ChangingGeometry;
- else
- windowState = QWSWindow::Showing;
- }
- changingw->d->state = windowState;
-
- if (!r.isEmpty() && wasOpaque != changingw->opaque && surface->isBuffered())
- changingw->requested_region = QRegion(); // XXX: force update_regions
-
- const QRegion oldAllocated = changingw->allocatedRegion();
- setWindowRegion(changingw, r);
- if (oldAllocated == changingw->allocatedRegion()) {
- // Always send region event to the requesting window even if the
- // region didn't change. This is necessary as the client will reset
- // the clip region until an event is received.
- changingw->client()->sendRegionEvent(wid, changingw->allocatedRegion(),
- QWSRegionEvent::Allocation);
- }
-
- surface->QWindowSurface::setGeometry(r.boundingRect());
-
- if (windowState == QWSWindow::Showing)
- emit q->windowEvent(changingw, QWSServer::Show);
- else if (windowState == QWSWindow::ChangingGeometry)
- emit q->windowEvent(changingw, QWSServer::Geometry);
- if (windowState == QWSWindow::Hiding) {
- handleWindowClose(changingw);
- changingw->d->state = QWSWindow::Hidden;
- changingw->d->painted = false;
- } else {
- changingw->d->state = QWSWindow::Visible;
- }
-}
-
-void QWSServerPrivate::destroy_region(const QWSRegionDestroyCommand *cmd)
-{
- invokeRegionDestroy(cmd, clientMap.value(-1));
-}
-
-void QWSServerPrivate::name_region(const QWSRegionNameCommand *cmd)
-{
- invokeRegionName(cmd, clientMap.value(-1));
-}
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-void QWSServerPrivate::im_response(const QWSIMResponseCommand *cmd)
- {
- invokeIMResponse(cmd, clientMap.value(-1));
-}
-
-void QWSServerPrivate::im_update(const QWSIMUpdateCommand *cmd)
-{
- invokeIMUpdate(cmd, clientMap.value(-1));
-}
-
-void QWSServerPrivate::send_im_mouse(const QWSIMMouseCommand *cmd)
-{
- if (current_IM)
- current_IM->mouseHandler(cmd->simpleData.index, cmd->simpleData.state);
-}
-#endif
-
-void QWSServerPrivate::openDisplay()
-{
- qt_init_display();
-
-// rgnMan = qt_fbdpy->regionManager();
- swidth = qt_screen->deviceWidth();
- sheight = qt_screen->deviceHeight();
-}
-
-void QWSServerPrivate::closeDisplay()
-{
- if (qt_screen)
- qt_screen->shutdownDevice();
-}
-
-/*!
- Returns the brush used as background in the absence of obscuring
- windows.
-
- \sa setBackground()
-*/
-const QBrush &QWSServer::backgroundBrush() const
-{
- return *QWSServerPrivate::bgBrush;
-}
-
-/*!
- Sets the brush used as background in the absence of obscuring
- windows, to be the given \a brush.
-
- Note that this function can only be used in the server process.
-
- \sa backgroundBrush()
-*/
-void QWSServer::setBackground(const QBrush &brush)
-{
- if (!QWSServerPrivate::bgBrush)
- QWSServerPrivate::bgBrush = new QBrush(brush);
- else
- *QWSServerPrivate::bgBrush = brush;
- if (!qwsServer)
- return;
- qt_screen->exposeRegion(QRect(0,0,qt_screen->width(), qt_screen->height()), 0);
-}
-
-
-#ifdef QT3_SUPPORT
-/*!
- \fn void QWSServer::setDesktopBackground(const QImage &image)
-
- Sets the image used as background in the absence of obscuring
- windows, to be the given \a image.
-
- Use the setBackground() function instead.
-
- \oldcode
- QImage image;
- setDesktopBackground(image);
- \newcode
- QImage image;
- setBackground(QBrush(image));
- \endcode
-*/
-void QWSServer::setDesktopBackground(const QImage &img)
-{
- if (img.isNull())
- setBackground(Qt::NoBrush);
- else
- setBackground(QBrush(QPixmap::fromImage(img)));
-}
-
-/*!
- \fn void QWSServer::setDesktopBackground(const QColor &color)
- \overload
-
- Sets the color used as background in the absence of obscuring
- windows, to be the given \a color.
-
- Use the setBackground() function instead.
-
- \oldcode
- QColor color;
- setDesktopBackground(color);
- \newcode
- QColor color;
- setBackground(QBrush(color));
- \endcode
-*/
-void QWSServer::setDesktopBackground(const QColor &c)
-{
- setBackground(QBrush(c));
-}
-#endif //QT3_SUPPORT
-
-/*!
- \internal
- */
-void QWSServer::startup(int flags)
-{
- if (qwsServer)
- return;
- unlink(qws_qtePipeFilename().toLatin1().constData());
- (void)new QWSServer(flags);
-}
-
-/*!
- \internal
-*/
-
-void QWSServer::closedown()
-{
- QScopedPointer<QWSServer> server(qwsServer);
- qwsServer = 0;
- QT_TRY {
- unlink(qws_qtePipeFilename().toLatin1().constData());
- } QT_CATCH(const std::bad_alloc &) {
- // ### TODO - what to do when we run out of memory
- // when calling toLatin1?
- }
-}
-
-void QWSServerPrivate::emergency_cleanup()
-{
-#ifndef QT_NO_QWS_KEYBOARD
- if (qwsServer)
- qwsServer->closeKeyboard();
-#endif
-}
-
-#ifndef QT_NO_QWS_KEYBOARD
-static QList<QWSServer::KeyboardFilter*> *keyFilters = 0;
-
-/*!
- Processes the given key event. The key is identified by its \a
- unicode value and the given \a keycode, \a modifiers, \a isPress
- and \a autoRepeat parameters.
-
- The \a keycode parameter is the Qt keycode value as defined by the
- Qt::Key enum. The \a modifiers is an OR combination of
- Qt::KeyboardModifier values, indicating whether \gui
- Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true
- if the event is a key press event and \a autoRepeat is true if the
- event is caused by an auto-repeat mechanism and not an actual key
- press.
-
- This function is typically called internally by keyboard drivers.
- Note that this function can only be used in the server process.
-
- \sa sendKeyEvent(), {Qt for Embedded Linux Character Input}
-*/
-void QWSServer::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat)
-{
- bool block;
- // Don't block the POWER or LIGHT keys
- if ( keycode == Qt::Key_F34 || keycode == Qt::Key_F35 )
- block = false;
- else
- block = qwsServerPrivate->screensaverblockevent(KEY, qwsServerPrivate->screensaverinterval, isPress);
-
-#ifdef EVENT_BLOCK_DEBUG
- qDebug() << "processKeyEvent" << unicode << keycode << modifiers << isPress << autoRepeat << (block ? "block" : "pass");
-#endif
-
- // If we press a key and it's going to be blocked, wake up the screen
- if ( block && isPress )
- qwsServerPrivate->_q_screenSaverWake();
-
- if ( block )
- return;
-
- if (keyFilters) {
- for (int i = 0; i < keyFilters->size(); ++i) {
- QWSServer::KeyboardFilter *keyFilter = keyFilters->at(i);
- if (keyFilter->filter(unicode, keycode, modifiers, isPress, autoRepeat))
- return;
- }
- }
- sendKeyEvent(unicode, keycode, modifiers, isPress, autoRepeat);
-}
-
-/*!
- \fn void QWSServer::addKeyboardFilter(KeyboardFilter *filter)
-
- Activates the given keyboard \a filter all key events generated by
- physical keyboard drivers (i.e., events sent using the
- processKeyEvent() function).
-
- Note that the filter is not invoked for keys generated by \e
- virtual keyboard drivers (i.e., events sent using the
- sendKeyEvent() function).
-
- Note that this function can only be used in the server process.
-
- \sa removeKeyboardFilter()
-*/
-void QWSServer::addKeyboardFilter(KeyboardFilter *f)
-{
- if (!keyFilters)
- keyFilters = new QList<QWSServer::KeyboardFilter*>;
- if (f) {
- keyFilters->prepend(f);
- }
-}
-
-/*
-//#######
- We should probably obsolete the whole keyboard filter thing since
- it's not useful for input methods anyway
-
- We could do removeKeyboardFilter(KeyboardFilter *f), but
- the "remove and delete the filter" concept does not match "user
- remembers the pointer".
-*/
-
-/*!
- Removes and deletes the most recently added filter.
-
- Note that the programmer is responsible for removing each added
- keyboard filter.
-
- Note that this function can only be used in the server process.
-
- \sa addKeyboardFilter()
-*/
-void QWSServer::removeKeyboardFilter()
-{
- if (!keyFilters || keyFilters->isEmpty())
- return;
- delete keyFilters->takeAt(0);
-}
-#endif // QT_NO_QWS_KEYBOARD
-
-/*!
- \fn void QWSServer::setScreenSaverIntervals(int* intervals)
-
- Specifies the time \a intervals (in milliseconds) between the
- different levels of screen responsiveness.
-
- \l{Qt for Embedded Linux} supports multilevel screen saving, i.e., it is
- possible to specify several different levels of screen
- responsiveness by implementing the QWSScreenSaver::save()
- function. For example, you can choose to first turn off the light
- before you fully activate the screensaver. See the QWSScreenSaver
- documentation for details.
-
- Note that an interval of 0 milliseconds will turn off the
- screensaver, and that the \a intervals array must be 0-terminated.
- This function can only be used in the server process.
-
- \sa setScreenSaverInterval(), setScreenSaverBlockLevel()
-*/
-void QWSServer::setScreenSaverIntervals(int* ms)
-{
- if (!qwsServerPrivate)
- return;
-
- delete [] qwsServerPrivate->screensaverintervals;
- if (ms) {
- int* t=ms;
- int n=0;
- while (*t++) n++;
- if (n) {
- n++; // the 0
- qwsServerPrivate->screensaverintervals = new int[n];
- memcpy(qwsServerPrivate->screensaverintervals, ms, n*sizeof(int));
- } else {
- qwsServerPrivate->screensaverintervals = 0;
- }
- } else {
- qwsServerPrivate->screensaverintervals = 0;
- }
- qwsServerPrivate->screensaverinterval = 0;
-
- qwsServerPrivate->screensavertimer->stop();
- qt_screen->blank(false);
- qwsServerPrivate->_q_screenSaverWake();
-}
-
-/*!
- \fn void QWSServer::setScreenSaverInterval(int milliseconds)
-
- Sets the timeout interval for the screensaver to the specified \a
- milliseconds. To turn off the screensaver, set the timout interval
- to 0.
-
- Note that this function can only be used in the server process.
-
- \sa setScreenSaverIntervals(), setScreenSaverBlockLevel()
-*/
-void QWSServer::setScreenSaverInterval(int ms)
-{
- int v[2];
- v[0] = ms;
- v[1] = 0;
- setScreenSaverIntervals(v);
-}
-
-/*!
- Block the key or mouse event that wakes the system from level \a eventBlockLevel or higher.
- To completely disable event blocking (the default behavior), set \a eventBlockLevel to -1.
-
- The algorithm blocks the "down", "up" as well as any "repeat" events for the same key
- but will not block other key events after the initial "down" event. For mouse events, the
- algorithm blocks all mouse events until an event with no buttons pressed is received.
-
- There are 2 keys that are never blocked, Qt::Key_F34 (POWER) and Qt::Key_F35 (LIGHT).
-
- Example usage:
-
- \snippet doc/src/snippets/code/src_gui_embedded_qwindowsystem_qws.cpp 0
-
- Note that this function can only be used in the server process.
-
- \sa setScreenSaverIntervals(), setScreenSaverInterval()
-*/
-void QWSServer::setScreenSaverBlockLevel(int eventBlockLevel)
-{
- if (!qwsServerPrivate)
- return;
- qwsServerPrivate->screensavereventblocklevel = eventBlockLevel;
-#ifdef EVENT_BLOCK_DEBUG
- qDebug() << "QWSServer::setScreenSaverBlockLevel() " << eventBlockLevel;
-#endif
-}
-
-extern bool qt_disable_lowpriority_timers; //in qeventloop_unix.cpp
-
-void QWSServerPrivate::_q_screenSaverWake()
-{
- if (screensaverintervals) {
- if (screensaverinterval != screensaverintervals) {
- if (saver) saver->restore();
- screensaverinterval = screensaverintervals;
- screensaverblockevents = false;
- } else {
- if (!screensavertimer->isActive()) {
- qt_screen->blank(false);
- if (saver) saver->restore();
- }
- }
- screensavertimer->start(*screensaverinterval);
- screensavertime.start();
- }
- qt_disable_lowpriority_timers=false;
-}
-
-void QWSServerPrivate::_q_screenSaverSleep()
-{
- qt_screen->blank(true);
-#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
- screensavertimer->stop();
-#else
- if (screensaverinterval) {
- screensavertimer->start(*screensaverinterval);
- screensavertime.start();
- } else {
- screensavertimer->stop();
- }
-#endif
- qt_disable_lowpriority_timers=true;
-}
-
-/*!
- \fn void QWSServer::setScreenSaver(QWSScreenSaver* screenSaver)
-
- Installs the given \a screenSaver, deleting the current screen
- saver.
-
- Note that this function can only be used in the server process.
-
- \sa screenSaverActivate(), setScreenSaverInterval(), setScreenSaverIntervals(), setScreenSaverBlockLevel()
-*/
-void QWSServer::setScreenSaver(QWSScreenSaver* ss)
-{
- QWSServerPrivate *qd = qwsServer->d_func();
- delete qd->saver;
- qd->saver = ss;
-}
-
-void QWSServerPrivate::screenSave(int level)
-{
- if (saver) {
- // saver->save() may call QCoreApplication::processEvents,
- // block event before calling saver->save().
- bool oldScreensaverblockevents = screensaverblockevents;
- if (*screensaverinterval >= 1000) {
- screensaverblockevents = (screensavereventblocklevel >= 0 && screensavereventblocklevel <= level);
-#ifdef EVENT_BLOCK_DEBUG
- if (screensaverblockevents)
- qDebug("ready to block events");
-#endif
- }
- int *oldScreensaverinterval = screensaverinterval;
- if (saver->save(level)) {
- // only update screensaverinterval if it hasn't already changed
- if (oldScreensaverinterval == screensaverinterval) {
- if (screensaverinterval && screensaverinterval[1]) {
- screensavertimer->start(*++screensaverinterval);
- screensavertime.start();
- } else {
- screensaverinterval = 0;
- }
- }
- } else {
- // restore previous state
- screensaverblockevents = oldScreensaverblockevents;
-
- // for some reason, the saver don't want us to change to the
- // next level, so we'll stay at this level for another interval
- if (screensaverinterval && *screensaverinterval) {
- screensavertimer->start(*screensaverinterval);
- screensavertime.start();
- }
- }
- } else {
- screensaverinterval = 0;//screensaverintervals;
- screensaverblockevents = false;
- _q_screenSaverSleep();
- }
-}
-
-void QWSServerPrivate::_q_screenSaverTimeout()
-{
- if (screensaverinterval) {
- if (screensavertime.elapsed() > *screensaverinterval*2) {
- // bogus (eg. unsuspend, system time changed)
- _q_screenSaverWake(); // try again
- return;
- }
- screenSave(screensaverinterval - screensaverintervals);
- }
-}
-
-/*!
- Returns true if the screen saver is active; otherwise returns
- false.
-
- Note that this function can only be used in the server process.
-
- \sa screenSaverActivate()
-*/
-bool QWSServer::screenSaverActive()
-{
- return qwsServerPrivate->screensaverinterval
- && !qwsServerPrivate->screensavertimer->isActive();
-}
-
-/*!
- \internal
-*/
-void QWSServer::updateWindowRegions() const
-{
- qwsServerPrivate->update_regions();
-}
-
-/*!
- Activates the screen saver if \a activate is true; otherwise it is
- deactivated.
-
- Note that this function can only be used in the server process.
-
- \sa screenSaverActive(), setScreenSaver()
-*/
-void QWSServer::screenSaverActivate(bool activate)
-{
- if (activate)
- qwsServerPrivate->_q_screenSaverSleep();
- else
- qwsServerPrivate->_q_screenSaverWake();
-}
-
-void QWSServerPrivate::disconnectClient(QWSClient *c)
-{
- QTimer::singleShot(0, c, SLOT(closeHandler()));
-}
-
-void QWSServerPrivate::updateClientCursorPos()
-{
- Q_Q(QWSServer);
- QWSWindow *win = qwsServerPrivate->mouseGrabber ? qwsServerPrivate->mouseGrabber : qwsServer->windowAt(QWSServer::mousePosition);
- QWSClient *winClient = win ? win->client() : 0;
- if (winClient && winClient != cursorClient)
- q->sendMouseEvent(QWSServer::mousePosition, mouseState);
-}
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-/*!
- \class QWSInputMethod
- \preliminary
- \ingroup qws
-
- \brief The QWSInputMethod class provides international input methods
- in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- A \l{Qt for Embedded Linux} application requires a server application to be
- running, or to be the server application itself. All system
- generated events, including keyboard and mouse events, are passed
- to the server application which then propagates the event to the
- appropriate client.
-
- An input method consists of a filter and optionally a graphical
- interface, and is used to filter input events between the server
- and the client application.
-
- \tableofcontents
-
- \section1 Creating Custom Input Methods
-
- To implement a custom input method, derive from the QWSInputMethod
- class, and use the server's \l
- {QWSServer::}{setCurrentInputMethod()} function to install it.
-
- When subclassing QWSInputMethod, you can reimplement the filter()
- functions to handle input from both physical and virtual keyboards
- as well as mouse devices. Note that the default implementations do
- nothing. Use the setInputResolution() function to control the
- number of bits shifted when filtering mouse input, i.e., when
- going from pointer resolution to screen resolution (the current
- resolution can be retrieved using the inputResolutionShift()
- function).
-
- Reimplement the reset() function to restore the state of the input
- method. Note that the default implementation calls the sendEvent()
- function with empty preedit and commit strings if the input method
- is in compose mode (i.e., if the input method is actively
- composing a preedit string).
-
- To receive replies to an input method query (sent using the
- sendQuery() function), you must reimplement the queryResponse()
- function, while the mouseHandler() function must be reimplemented
- if you want to handle mouse events within the preedit
- text. Reimplement the updateHandler() function to handle update
- events including resets and focus changes. The UpdateType enum
- describes the various types of update events recognized by the
- input method.
-
- \section1 Using Input Methods
-
- In addition to the filter(), reset(), queryResponse(),
- mouseHandler() and updateHandler() function mentioned in the
- previous section, the QWSInputMethod provides several other
- functions helping the window system to manage the installed input
- methods.
-
- The sendEvent() function sends the given event to the focus
- widget, while the sendPreeditString() function sends the given
- preedit text (encapsulated by an event). QWSInputMethod also
- provides the sendCommitString() convenience function which sends
- an event encapsulating the given commit string to the current
- focus widget, and the sendMouseEvent() function which sends the
- given mouse event.
-
- Finally, the QWSInputMethod class provides the sendQuery()
- function for sending input method queries. This function
- encapsulates the event with a QWSEvent instance of the \l
- {QWSEvent::}{IMQuery} type.
-
- \sa QWSServer, {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- Constructs a new input method.
-
- Use the QWSServer::setCurrentInputMethod() function to install it.
-*/
-
-QWSInputMethod::QWSInputMethod()
-{
-
-}
-
-/*!
- Destroys this input method, uninstalling it if it is installed.
-*/
-QWSInputMethod::~QWSInputMethod()
-{
- if (current_IM == this)
- current_IM = 0;
-}
-
-/*!
- Filters the key input identified by the given \a unicode, \a
- keycode, \a modifiers, \a isPress and \a autoRepeat parameters.
-
- Note that the default implementation does nothing; reimplement
- this function to handle input from both physical and virtual
- devices.
-
- The \a keycode is a Qt::Key value, and the \a modifiers is an OR
- combination of Qt::KeyboardModifiers. The \a isPress parameter is
- telling whether the input is a key press or key release, and the
- \a autoRepeat parameter determines whether the input is
- autorepeated ( i.e., in which case the
- QWSKeyboardHandler::beginAutoRepeat() function has been called).
-
- To block the event from further processing, return true when
- reimplementing this function; the default implementation returns
- false.
-
- \sa setInputResolution(), inputResolutionShift()
-*/
-bool QWSInputMethod::filter(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat)
-{
- Q_UNUSED(unicode);
- Q_UNUSED(keycode);
- Q_UNUSED(modifiers);
- Q_UNUSED(isPress);
- Q_UNUSED(autoRepeat);
- return false;
-}
-
-/*!
- \overload
-
- Filters the mouse input identified by the given \a position, \a
- state, and \a wheel parameters.
-*/
-bool QWSInputMethod::filter(const QPoint &position, int state, int wheel)
-{
- Q_UNUSED(position);
- Q_UNUSED(state);
- Q_UNUSED(wheel);
- return false;
-}
-
-/*!
- Resets the state of the input method.
-
- If the input method is in compose mode, i.e., the input method is
- actively composing a preedit string, the default implementation
- calls sendEvent() with empty preedit and commit strings; otherwise
- it does nothing. Reimplement this function to alter this behavior.
-
- \sa sendEvent()
-*/
-void QWSInputMethod::reset()
-{
- if (current_IM_composing_win) {
- QInputMethodEvent ime;
- sendEvent(&ime);
- }
-}
-
-/*!
- \enum QWSInputMethod::UpdateType
-
- This enum describes the various types of update events recognized
- by the input method.
-
- \value Update The input widget is updated in some way; use sendQuery() with
- Qt::ImMicroFocus as an argument for more information.
- \value FocusIn A new input widget receives focus.
- \value FocusOut The input widget loses focus.
- \value Reset The input method should be reset.
- \value Destroyed The input widget is destroyed.
-
- \sa updateHandler()
-*/
-
-/*!
- Handles update events including resets and focus changes. The
- update events are specified by the given \a type which is one of
- the UpdateType enum values.
-
- Note that reimplementations of this function must call the base
- implementation for all cases that it does not handle itself.
-
- \sa UpdateType
-*/
-void QWSInputMethod::updateHandler(int type)
-{
- switch (type) {
- case FocusOut:
- case Reset:
- reset();
- break;
-
- default:
- break;
- }
-}
-
-
-/*!
- Receive replies to an input method query.
-
- Note that the default implementation does nothing; reimplement
- this function to receive such replies.
-
- Internally, an input method query is passed encapsulated by an \l
- {QWSEvent::IMQuery}{IMQuery} event generated by the sendQuery()
- function. The queried property and the result is passed in the \a
- property and \a result parameters.
-
- \sa sendQuery(), QWSServer::sendIMQuery()
-*/
-void QWSInputMethod::queryResponse(int property, const QVariant &result)
-{
- Q_UNUSED(property);
- Q_UNUSED(result);
-}
-
-
-
-/*!
- \fn void QWSInputMethod::mouseHandler(int offset, int state)
-
- Handles mouse events within the preedit text.
-
- Note that the default implementation resets the input method on
- all mouse presses; reimplement this function to alter this
- behavior.
-
- The \a offset parameter specifies the position of the mouse event
- within the string, and \a state specifies the type of the mouse
- event as described by the QWSServer::IMMouse enum. If \a state is
- less than 0, the mouse event is inside the associated widget, but
- outside the preedit text. When clicking in a different widget, the
- \a state is QWSServer::MouseOutside.
-
- \sa sendPreeditString(), reset()
-*/
-void QWSInputMethod::mouseHandler(int, int state)
-{
- if (state == QWSServer::MousePress || state == QWSServer::MouseOutside)
- reset();
-}
-
-
-/*!
- Sends an event encapsulating the given \a preeditString, to the
- focus widget.
-
- The specified \a selectionLength is the number of characters to be
- marked as selected (starting at the given \a cursorPosition). If
- \a selectionLength is negative, the text \e before \a
- cursorPosition is marked.
-
- The preedit string is marked with QInputContext::PreeditFormat,
- and the selected part is marked with
- QInputContext::SelectionFormat.
-
- Sending an input method event with a non-empty preedit string will
- cause the input method to enter compose mode. Sending an input
- method event with an empty preedit string will cause the input
- method to leave compose mode, i.e., the input method will no longer
- be actively composing the preedit string.
-
- Internally, the event is represented by a QWSEvent object of the
- \l {QWSEvent::IMEvent}{IMEvent} type.
-
- \sa sendEvent(), sendCommitString()
-*/
-
-void QWSInputMethod::sendPreeditString(const QString &preeditString, int cursorPosition, int selectionLength)
-{
- QList<QInputMethodEvent::Attribute> attributes;
-
- int selPos = cursorPosition;
- if (selectionLength == 0) {
- selPos = 0;
- } else if (selectionLength < 0) {
- selPos += selectionLength;
- selectionLength = -selectionLength;
- }
- if (selPos > 0)
- attributes += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, selPos,
- QVariant(int(QInputContext::PreeditFormat)));
-
- if (selectionLength)
- attributes += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, selPos, selectionLength,
- QVariant(int(QInputContext::SelectionFormat)));
-
- if (selPos + selectionLength < preeditString.length())
- attributes += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
- selPos + selectionLength,
- preeditString.length() - selPos - selectionLength,
- QVariant(int(QInputContext::PreeditFormat)));
-
- attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPosition, 0, QVariant());
-
- QInputMethodEvent ime(preeditString, attributes);
- qwsServer->sendIMEvent(&ime);
-}
-
-/*!
- \fn void QWSInputMethod::sendCommitString(const QString &commitString, int replaceFromPosition, int replaceLength)
-
- Sends an event encapsulating the given \a commitString, to the
- focus widget.
-
- Note that this will cause the input method to leave compose mode,
- i.e., the input method will no longer be actively composing the
- preedit string.
-
- If the specified \a replaceLength is greater than 0, the commit
- string will replace the given number of characters of the
- receiving widget's previous text, starting at the given \a
- replaceFromPosition relative to the start of the current preedit
- string.
-
- Internally, the event is represented by a QWSEvent object of the
- \l {QWSEvent::IMEvent}{IMEvent} type.
-
- \sa sendEvent(), sendPreeditString()
-*/
-void QWSInputMethod::sendCommitString(const QString &commitString, int replaceFrom, int replaceLength)
-{
- QInputMethodEvent ime;
- ime.setCommitString(commitString, replaceFrom, replaceLength);
- qwsServer->sendIMEvent(&ime);
-}
-
-/*!
- \fn QWSInputMethod::sendIMEvent(QWSServer::IMState state, const QString &text, int cursorPosition, int selectionLength)
- \obsolete
-
- Sends a QInputMethodEvent object to the focus widget.
-
- If the specified \a state is QWSServer::IMCompose, \a text is a
- preedit string, \a cursorPosition is the cursor's position within
- the preedit string, and \a selectionLength is the number of
- characters (starting at \a cursorPosition) that should be marked
- as selected by the input widget receiving the event. If the
- specified \a state is QWSServer::IMEnd, \a text is a commit
- string.
-
- Use sendEvent(), sendPreeditString() or sendCommitString() instead.
-*/
-
-/*!
- \fn QWSInputMethod::sendEvent(const QInputMethodEvent *event)
-
- Sends the given \a event to the focus widget.
-
- The \c QInputMethodEvent class is derived from QWSEvent, i.e., the
- given \a event is a QWSEvent object of the \l
- {QWSEvent::IMEvent}{IMEvent} type.
-
- \sa sendPreeditString(), sendCommitString(), reset()
-*/
-
-
-/*!
- \fn void QWSInputMethod::sendQuery(int property)
-
- Sends an input method query (internally encapsulated by a QWSEvent
- of the \l {QWSEvent::IMQuery}{IMQuery} type) for the specified \a
- property.
-
- To receive responses to input method queries, the virtual
- queryResponse() function must be reimplemented.
-
- \sa queryResponse(), QWSServer::sendIMQuery()
-*/
-
-/*!
- Sets and returns the number of bits shifted to go from pointer
- resolution to screen resolution when filtering mouse input.
-
- If \a isHigh is true and the device has a pointer device
- resolution twice or more of the screen resolution, the positions
- passed to the filter() function will be presented at the higher
- resolution; otherwise the resolution will be equal to that of the
- screen resolution.
-
- \sa inputResolutionShift(), filter()
-*/
-uint QWSInputMethod::setInputResolution(bool isHigh)
-{
- mIResolution = isHigh;
- return inputResolutionShift();
-}
-
-/*!
- Returns the number of bits shifted to go from pointer resolution
- to screen resolution when filtering mouse input.
-
- \sa setInputResolution(), filter()
-*/
-uint QWSInputMethod::inputResolutionShift() const
-{
- return 0; // default for devices with single resolution.
-}
-
-/*!
- \fn void QWSInputMethod::sendMouseEvent( const QPoint &position, int state, int wheel )
-
- Sends a mouse event specified by the given \a position, \a state
- and \a wheel parameters.
-
- The given \a position will be transformed if the screen
- coordinates do not match the pointer device coordinates.
-
- Note that the event will be not be tested by the active input
- method, but calling the QWSServer::sendMouseEvent() function will
- make the current input method filter the event.
-
- \sa mouseHandler(), sendEvent()
-*/
-void QWSInputMethod::sendMouseEvent( const QPoint &pos, int state, int wheel )
-{
- if (qt_last_x) {
- *qt_last_x = pos.x();
- *qt_last_y = pos.y();
- }
- QWSServer::mousePosition = pos;
- qwsServerPrivate->mouseState = state;
- QWSServerPrivate::sendMouseEventUnfiltered(pos, state, wheel);
-}
-#endif // QT_NO_QWS_INPUTMETHODS
-
-/*!
- \fn QWSWindow::QWSWindow(int i, QWSClient * client)
- \internal
-
- Constructs a new top-level window, associated with the client \a
- client and giving it the id \a i.
-*/
-
-/*!
- \fn QWSServer::windowEvent(QWSWindow * window, QWSServer::WindowEvent eventType)
-
- This signal is emitted whenever something happens to a top-level
- window (e.g., it's created or destroyed), passing a pointer to the
- window and the event's type in the \a window and \a eventType
- parameters, respectively.
-
- \sa markedText()
-*/
-
-/*!
- \class QWSServer::KeyboardFilter
- \ingroup qws
-
- \brief The KeyboardFilter class is a base class for global
- keyboard event filters in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- In \l{Qt for Embedded Linux}, all system generated events, including
- keyboard events, are passed to the server application which then
- propagates the event to the appropriate client. The KeyboardFilter
- class is used to implement a global, low-level filter on the
- server side. The server applies the filter to all keyboard events
- before passing them on to the clients:
-
- \image qwsserver_keyboardfilter.png
-
- This feature can, for example, be used to filter things like APM
- (advanced power management) suspended from a button without having
- to filter for it in all applications.
-
- To add a new keyboard filter you must first create the filter by
- deriving from this class, reimplementing the pure virtual filter()
- function. Then you can install the filter on the server using
- QWSServer's \l {QWSServer::}{addKeyboardFilter()}
- function. QWSServer also provides a \l
- {QWSServer::}{removeKeyboardFilter()} function.
-
- \sa {Qt for Embedded Linux Architecture}, QWSServer, QWSInputMethod
-*/
-
-/*!
- \fn QWSServer::KeyboardFilter::~KeyboardFilter()
-
- Destroys the keyboard filter.
-*/
-
-/*!
- \fn bool QWSServer::KeyboardFilter::filter(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat)
-
- Implement this function to return true if a given key event should
- be stopped from being processed any further; otherwise it should
- return false.
-
- A key event can be identified by the given \a unicode value and
- the \a keycode, \a modifiers, \a isPress and \a autoRepeat
- parameters.
-
- The \a keycode parameter is the Qt keycode value as defined by the
- Qt::Key enum. The \a modifiers is an OR combination of
- Qt::KeyboardModifier values, indicating whether \gui
- Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true
- if the event is a key press event and \a autoRepeat is true if the
- event is caused by an auto-repeat mechanism and not an actual key
- press.
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qwindowsystem_qws.cpp"
diff --git a/src/gui/embedded/qwindowsystem_qws.h b/src/gui/embedded/qwindowsystem_qws.h
deleted file mode 100644
index 65e1683d38..0000000000
--- a/src/gui/embedded/qwindowsystem_qws.h
+++ /dev/null
@@ -1,508 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSYSTEM_QWS_H
-#define QWINDOWSYSTEM_QWS_H
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qlist.h>
-
-#include <QtGui/qwsevent_qws.h>
-#include <QtGui/qkbd_qws.h>
-#include <QtGui/qregion.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-struct QWSWindowPrivate;
-class QWSCursor;
-class QWSClient;
-class QWSRegionManager;
-class QBrush;
-class QVariant;
-class QInputMethodEvent;
-class QWSInputMethod;
-class QWSBackingStore;
-class QWSWindowSurface;
-
-#ifdef QT3_SUPPORT
-class QImage;
-class QColor;
-#endif
-
-class QWSInternalWindowInfo
-{
-public:
- int winid;
- unsigned int clientid;
- QString name; // Corresponds to QObject name of top-level widget
-};
-
-
-class Q_GUI_EXPORT QWSScreenSaver
-{
-public:
- virtual ~QWSScreenSaver();
- virtual void restore()=0;
- virtual bool save(int level)=0;
-};
-
-
-class Q_GUI_EXPORT QWSWindow
-{
- friend class QWSServer;
- friend class QWSServerPrivate;
-
-public:
- QWSWindow(int i, QWSClient* client);
- ~QWSWindow();
-
- int winId() const { return id; }
- const QString &name() const { return rgnName; }
- const QString &caption() const { return rgnCaption; }
- QWSClient* client() const { return c; }
- const QRegion &requestedRegion() const { return requested_region; }
- QRegion allocatedRegion() const;
- QRegion paintedRegion() const;
- bool isVisible() const { return !requested_region.isEmpty(); }
- bool isPartiallyObscured() const { return requested_region != allocatedRegion(); }
- bool isFullyObscured() const { return allocatedRegion().isEmpty(); }
-
- enum State { NoState, Hidden, Showing, Visible, Hiding, Raising, Lowering, Moving, ChangingGeometry, Destroyed };
- State state() const;
- Qt::WindowFlags windowFlags() const;
- QRegion dirtyOnScreen() const;
-
- void raise();
- void lower();
- void show();
- void hide();
- void setActiveWindow();
-
- bool isOpaque() const {return opaque && _opacity == 255;}
- uint opacity() const { return _opacity; }
-
- QWSWindowSurface* windowSurface() const { return surface; }
-
-private:
- bool hidden() const { return requested_region.isEmpty(); }
- bool forClient(const QWSClient* cl) const { return cl==c; }
-
- void setName(const QString &n);
- void setCaption(const QString &c);
-
- void focus(bool get);
- int focusPriority() const { return last_focus_time; }
- void operation(QWSWindowOperationEvent::Operation o);
- void shuttingDown() { last_focus_time=0; }
-
-#ifdef QT_QWS_CLIENTBLIT
- QRegion directPaintRegion() const;
- inline void setDirectPaintRegion(const QRegion &topmost);
-#endif
- inline void setAllocatedRegion(const QRegion &region);
-
- void createSurface(const QString &key, const QByteArray &data);
-
-#ifndef QT_NO_QWSEMBEDWIDGET
- void startEmbed(QWSWindow *window);
- void stopEmbed(QWSWindow *window);
-#endif
-
-private:
- int id;
- QString rgnName;
- QString rgnCaption;
- bool modified;
- bool onTop;
- QWSClient* c;
- QRegion requested_region;
- QRegion exposed;
- int last_focus_time;
- QWSWindowSurface *surface;
- uint _opacity;
- bool opaque;
- QWSWindowPrivate *d;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT QRegion requested() const { return requested_region; }
-// inline QT3_SUPPORT QRegion allocation() const { return allocated_region; }
-#endif
-};
-
-
-#ifndef QT_NO_SOUND
-class QWSSoundServer;
-#ifdef QT_USE_OLD_QWS_SOUND
-class QWSSoundServerData;
-
-class Q_GUI_EXPORT QWSSoundServer : public QObject {
- Q_OBJECT
-public:
- QWSSoundServer(QObject* parent);
- ~QWSSoundServer();
- void playFile(const QString& filename);
-private Q_SLOTS:
- void feedDevice(int fd);
-private:
- QWSSoundServerData* d;
-};
-#endif
-#endif
-
-
-/*********************************************************************
- *
- * Class: QWSServer
- *
- *********************************************************************/
-
-class QWSMouseHandler;
-struct QWSCommandStruct;
-class QWSServerPrivate;
-class QWSServer;
-
-extern Q_GUI_EXPORT QWSServer *qwsServer;
-
-class Q_GUI_EXPORT QWSServer : public QObject
-{
- friend class QCopChannel;
- friend class QWSMouseHandler;
- friend class QWSWindow;
- friend class QWSDisplay;
- friend class QWSInputMethod;
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWSServer)
-public:
- explicit QWSServer(int flags = 0, QObject *parent=0);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QWSServer(int flags, QObject *parent, const char *name);
-#endif
- ~QWSServer();
- enum ServerFlags { DisableKeyboard = 0x01,
- DisableMouse = 0x02 };
-
- static void sendKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat);
-#ifndef QT_NO_QWS_KEYBOARD
- static void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat);
-#endif
-
- static QWSServer* instance() { return qwsServer; }
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-#ifdef QT3_SUPPORT
- enum IMState { IMCompose, IMEnd, IMStart = IMCompose };
-#endif
- enum IMMouse { MousePress, MouseRelease, MouseMove, MouseOutside }; //MouseMove reserved but not used
- void sendIMEvent(const QInputMethodEvent*);
- void sendIMQuery(int property);
-#endif
-
-#ifndef QT_NO_QWS_KEYBOARD
- class KeyboardFilter
- {
- public:
- virtual ~KeyboardFilter() {}
- virtual bool filter(int unicode, int keycode, int modifiers,
- bool isPress, bool autoRepeat)=0;
- };
- static void addKeyboardFilter(KeyboardFilter *f);
- static void removeKeyboardFilter();
-#endif
-
-#ifndef QT_NO_QWS_INPUTMETHODS
- static void setCurrentInputMethod(QWSInputMethod *im);
- static void resetInputMethod();
-#endif
-
- static void setDefaultMouse(const char *);
- static void setDefaultKeyboard(const char *);
- static void setMaxWindowRect(const QRect&);
- static void sendMouseEvent(const QPoint& pos, int state, int wheel = 0);
-
- static void setBackground(const QBrush &);
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT void setDesktopBackground(const QImage &img);
- static QT3_SUPPORT void setDesktopBackground(const QColor &);
-#endif
- static QWSMouseHandler *mouseHandler();
- static const QList<QWSMouseHandler*>& mouseHandlers();
- static void setMouseHandler(QWSMouseHandler*);
-#ifndef QT_NO_QWS_KEYBOARD
- static QWSKeyboardHandler* keyboardHandler();
- static void setKeyboardHandler(QWSKeyboardHandler* kh);
-#endif
- QWSWindow *windowAt(const QPoint& pos);
-
- const QList<QWSWindow*> &clientWindows();
-
- void openMouse();
- void closeMouse();
- void suspendMouse();
- void resumeMouse();
-#ifndef QT_NO_QWS_KEYBOARD
- void openKeyboard();
- void closeKeyboard();
-#endif
-
- static void setScreenSaver(QWSScreenSaver*);
- static void setScreenSaverIntervals(int* ms);
- static void setScreenSaverInterval(int);
- static void setScreenSaverBlockLevel(int);
- static bool screenSaverActive();
- static void screenSaverActivate(bool);
-
- // the following are internal.
- void refresh();
- void refresh(QRegion &);
-
- void enablePainting(bool);
- static void processEventQueue();
- static QList<QWSInternalWindowInfo*> * windowList();
-
- void sendPropertyNotifyEvent(int property, int state);
-
- static QPoint mousePosition;
-
- static void startup(int flags);
- static void closedown();
-
- static void beginDisplayReconfigure();
- static void endDisplayReconfigure();
-
-#ifndef QT_NO_QWS_CURSOR
- static void setCursorVisible(bool);
- static bool isCursorVisible();
-#endif
-
- const QBrush &backgroundBrush() const;
-
- enum WindowEvent { Create=0x0001, Destroy=0x0002, Hide=0x0004, Show=0x0008,
- Raise=0x0010, Lower=0x0020, Geometry=0x0040, Active = 0x0080,
- Name=0x0100 };
-
-Q_SIGNALS:
- void windowEvent(QWSWindow *w, QWSServer::WindowEvent e);
-
-#ifndef QT_NO_COP
- void newChannel(const QString& channel);
- void removedChannel(const QString& channel);
-
-#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
- void markedText(const QString &);
-#endif
-
-protected:
- void timerEvent(QTimerEvent *e);
-
-private:
- friend class QApplicationPrivate;
- void updateWindowRegions() const;
-
-#ifdef QT3_SUPPORT
-#ifndef QT_NO_QWS_KEYBOARD
- static inline QT3_SUPPORT void setKeyboardFilter(QWSServer::KeyboardFilter *f)
- { if (f) addKeyboardFilter(f); else removeKeyboardFilter(); }
-#endif
-#endif
-
-private:
-#ifndef QT_NO_QWS_MULTIPROCESS
- Q_PRIVATE_SLOT(d_func(), void _q_clientClosed())
- Q_PRIVATE_SLOT(d_func(), void _q_doClient())
- Q_PRIVATE_SLOT(d_func(), void _q_deleteWindowsLater())
-#endif
-
- Q_PRIVATE_SLOT(d_func(), void _q_screenSaverWake())
- Q_PRIVATE_SLOT(d_func(), void _q_screenSaverSleep())
- Q_PRIVATE_SLOT(d_func(), void _q_screenSaverTimeout())
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- Q_PRIVATE_SLOT(d_func(), void _q_newConnection())
-#endif
-};
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-class Q_GUI_EXPORT QWSInputMethod : public QObject
-{
- Q_OBJECT
-public:
- QWSInputMethod();
- virtual ~QWSInputMethod();
-
- enum UpdateType {Update, FocusIn, FocusOut, Reset, Destroyed};
-
- virtual bool filter(int unicode, int keycode, int modifiers,
- bool isPress, bool autoRepeat);
-
- virtual bool filter(const QPoint &, int state, int wheel);
-
- virtual void reset();
- virtual void updateHandler(int type);
- virtual void mouseHandler(int pos, int state);
- virtual void queryResponse(int property, const QVariant&);
-
-protected:
- uint setInputResolution(bool isHigh);
- uint inputResolutionShift() const;
- // needed for required transform
- void sendMouseEvent(const QPoint &pos, int state, int wheel);
-
- void sendEvent(const QInputMethodEvent*);
- void sendPreeditString(const QString &preeditString, int cursorPosition, int selectionLength = 0);
- void sendCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
- void sendQuery(int property);
-
-#ifdef QT3_SUPPORT
- inline void sendIMEvent(QWSServer::IMState, const QString& txt, int cpos, int selLen = 0);
-#endif
-private:
- bool mIResolution;
-};
-
-inline void QWSInputMethod::sendEvent(const QInputMethodEvent *ime)
-{
- qwsServer->sendIMEvent(ime);
-}
-#ifdef QT3_SUPPORT
-inline void QWSInputMethod::sendIMEvent(QWSServer::IMState state, const QString& txt, int cpos, int selLen)
-{
- if (state == QWSServer::IMCompose) sendPreeditString(txt, cpos, selLen); else sendCommitString(txt);
-}
-#endif
-
-inline void QWSInputMethod::sendQuery(int property)
-{
- qwsServer->sendIMQuery(property);
-}
-
-// mouse events not inline as involve transformations.
-#endif // QT_NO_QWS_INPUTMETHODS
-
-
-
-/*********************************************************************
- *
- * Class: QWSClient
- *
- *********************************************************************/
-
-struct QWSMouseEvent;
-
-typedef QMap<int, QWSCursor*> QWSCursorMap;
-
-class QWSClientPrivate;
-class QWSCommand;
-class QWSConvertSelectionCommand;
-
-class Q_GUI_EXPORT QWSClient : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWSClient)
-public:
- QWSClient(QObject* parent, QWS_SOCK_BASE *, int id);
- ~QWSClient();
-
- int socket() const;
-
- void setIdentity(const QString&);
- QString identity() const { return id; }
-
- void sendEvent(QWSEvent* event);
- void sendConnectedEvent(const char *display_spec);
- void sendMaxWindowRectEvent(const QRect &rect);
- void sendPropertyNotifyEvent(int property, int state);
- void sendPropertyReplyEvent(int property, int len, const char *data);
- void sendSelectionClearEvent(int windowid);
- void sendSelectionRequestEvent(QWSConvertSelectionCommand *cmd, int windowid);
-#ifndef QT_QWS_CLIENTBLIT
- void sendRegionEvent(int winid, QRegion rgn, int type);
-#else
- void sendRegionEvent(int winid, QRegion rgn, int type, int id = 0);
-#endif
-#ifndef QT_NO_QWSEMBEDWIDGET
- void sendEmbedEvent(int winid, QWSEmbedEvent::Type type,
- const QRegion &region = QRegion());
-#endif
- QWSCommand* readMoreCommand();
-
- int clientId() const { return cid; }
-
- QWSCursorMap cursors; // cursors defined by this client
-Q_SIGNALS:
- void connectionClosed();
- void readyRead();
-private Q_SLOTS:
- void closeHandler();
- void errorHandler();
-
-private:
-#ifndef QT_NO_QWS_MULTIPROCESS
- friend class QWSWindow;
- void removeUnbufferedSurface();
- void addUnbufferedSurface();
-#endif
-
-private:
- int socketDescriptor;
-#ifndef QT_NO_QWS_MULTIPROCESS
- QWSSocket *csocket;
-#endif
- QWSCommand* command;
- uint isClosed : 1;
- QString id;
- int cid;
-
- friend class QWSServerPrivate;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWINDOWSYSTEM_QWS_H
diff --git a/src/gui/embedded/qwscommand_qws.cpp b/src/gui/embedded/qwscommand_qws.cpp
deleted file mode 100644
index 71d3a06dbe..0000000000
--- a/src/gui/embedded/qwscommand_qws.cpp
+++ /dev/null
@@ -1,609 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwscommand_qws_p.h"
-#include "qtransportauth_qws.h"
-#include "qtransportauth_qws_p.h"
-
-#include <unistd.h>
-
-// #define QWSCOMMAND_DEBUG 1 // Uncomment to debug client/server communication
-
-#ifdef QWSCOMMAND_DEBUG
-# include <qdebug.h>
-# include "qfile.h"
-# include <ctype.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#ifdef QWSCOMMAND_DEBUG
-// QWSHexDump -[ start ]---------------------------------------------
-# define QWSHEXDUMP_MAX 32
-class QWSHexDump
-{
-public:
-
- QWSHexDump(const void *address, int len, int wrapAt = 16)
- : wrap(wrapAt), dataSize(len)
- {
- init();
- data = reinterpret_cast<const char*>(address);
- if (len < 0)
- dataSize = 0;
- }
-
- QWSHexDump(const char *str, int len = -1, int wrapAt = 16)
- : wrap(wrapAt), dataSize(len)
- {
- init();
- data = str;
- if (len == -1)
- dataSize = str ? strlen(str) : 0;
- }
-
- QWSHexDump(const QByteArray &array, int wrapAt = 16)
- : wrap(wrapAt)
- {
- init();
- data = array.data();
- dataSize = array.size();
- }
-
- // Sets a customized prefix for the hexdump
- void setPrefix(const char *str) { prefix = str; }
-
- // Sets number of bytes to cluster together
- void setClusterSize(uint num) { clustering = num; }
-
- // Output hexdump to a text stream
- void intoTextStream(QTextStream &strm) {
- outstrm = &strm;
- hexDump();
- }
-
- // Output hexdump to a QString
- QString toString();
-
-protected:
- void init();
- void hexDump();
- void sideviewDump(int at);
-
-private:
- uint wrap;
- uint clustering;
- uint dataSize;
- int dataWidth;
- const char *data;
- const char *prefix;
- bool dirty;
-
- char sideviewLayout[QWSHEXDUMP_MAX + 1];
- char sideview[15];
-
- QTextStream *outstrm;
-};
-
-void QWSHexDump::init()
-{
- prefix = "> "; // Standard line prefix
- clustering = 2; // Word-size clustering by default
- if (wrap > QWSHEXDUMP_MAX) // No wider than QWSHexDump_MAX bytes
- wrap = QWSHEXDUMP_MAX;
-}
-
-void QWSHexDump::hexDump()
-{
- *outstrm << '(' << dataSize << " bytes):\n" << prefix;
- sprintf(sideviewLayout, " [%%-%us]", wrap);
- dataWidth = (2 * wrap) + (wrap / clustering);
-
- dirty = false;
- uint wrapIndex = 0;
- for (uint i = 0; i < dataSize; i++) {
- uint c = static_cast<uchar>(data[i]);
- sideview[wrapIndex = i%wrap] = isprint(c) ? c : '.';
-
- if (wrapIndex && (wrapIndex % clustering == 0))
- *outstrm << ' ';
-
- outstrm->setFieldWidth(2);
- outstrm->setPadChar('0');
- outstrm->setNumberFlags( QTextStream::ShowBase );
- *outstrm << hex << c;
- dirty = true;
-
- if (wrapIndex == wrap-1) {
- sideviewDump(wrapIndex);
- wrapIndex = 0;
- if (i+1 < dataSize)
- *outstrm << endl << prefix;
- }
-
- }
- sideviewDump(wrapIndex);
-}
-
-void QWSHexDump::sideviewDump(int at)
-{
- if (dirty) {
- dirty = false;
- ++at;
- sideview[at] = '\0';
- int currentWidth = (2 * at) + (at / clustering) - (at%clustering?0:1);
- int missing = qMax(dataWidth - currentWidth, 0);
- while (missing--)
- *outstrm << ' ';
-
- *outstrm << " [";
- outstrm->setPadChar(' ');
- outstrm->setFieldWidth(wrap);
- outstrm->setFieldAlignment( QTextStream::AlignLeft );
- *outstrm << sideview;
- *outstrm << ']';
- }
-}
-
-// Output hexdump to a QString
-QString QWSHexDump::toString() {
- QString result;
- QTextStream strm(&result, QFile::WriteOnly);
- outstrm = &strm;
- hexDump();
- return result;
-}
-
-#ifndef QT_NO_DEBUG
-QDebug &operator<<(QDebug &dbg, QWSHexDump *hd) {
- if (!hd)
- return dbg << "QWSHexDump(0x0)";
- QString result = hd->toString();
- dbg.nospace() << result;
- return dbg.space();
-}
-
-// GCC & Intel wont handle references here
-QDebug operator<<(QDebug dbg, QWSHexDump hd) {
- return dbg << &hd;
-}
-#endif
-// QWSHexDump -[ end ]-----------------------------------------------
-
-
-QDebug &operator<<(QDebug &dbg, QWSCommand::Type tp)
-{
- dbg << qws_getCommandTypeString( tp );
- return dbg;
-}
-
-#define N_EVENTS 19
-const char * eventNames[N_EVENTS] = {
- "NoEvent",
- "Connected",
- "Mouse", "Focus", "Key",
- "Region",
- "Creation",
- "PropertyNotify",
- "PropertyReply",
- "SelectionClear",
- "SelectionRequest",
- "SelectionNotify",
- "MaxWindowRect",
- "QCopMessage",
- "WindowOperation",
- "IMEvent",
- "IMQuery",
- "IMInit",
- "Font"
- };
-
-class QWSServer;
-extern QWSServer *qwsServer;
-#endif
-
-const char *qws_getCommandTypeString( QWSCommand::Type tp )
-{
- const char *typeStr;
- switch(tp) {
- case QWSCommand::Create:
- typeStr = "Create";
- break;
- case QWSCommand::Shutdown:
- typeStr = "Shutdown";
- break;
- case QWSCommand::Region:
- typeStr = "Region";
- break;
- case QWSCommand::RegionMove:
- typeStr = "RegionMove";
- break;
- case QWSCommand::RegionDestroy:
- typeStr = "RegionDestroy";
- break;
- case QWSCommand::SetProperty:
- typeStr = "SetProperty";
- break;
- case QWSCommand::AddProperty:
- typeStr = "AddProperty";
- break;
- case QWSCommand::RemoveProperty:
- typeStr = "RemoveProperty";
- break;
- case QWSCommand::GetProperty:
- typeStr = "GetProperty";
- break;
- case QWSCommand::SetSelectionOwner:
- typeStr = "SetSelectionOwner";
- break;
- case QWSCommand::ConvertSelection:
- typeStr = "ConvertSelection";
- break;
- case QWSCommand::RequestFocus:
- typeStr = "RequestFocus";
- break;
- case QWSCommand::ChangeAltitude:
- typeStr = "ChangeAltitude";
- break;
- case QWSCommand::SetOpacity:
- typeStr = "SetOpacity";
- break;
- case QWSCommand::DefineCursor:
- typeStr = "DefineCursor";
- break;
- case QWSCommand::SelectCursor:
- typeStr = "SelectCursor";
- break;
- case QWSCommand::PositionCursor:
- typeStr = "PositionCursor";
- break;
- case QWSCommand::GrabMouse:
- typeStr = "GrabMouse";
- break;
- case QWSCommand::PlaySound:
- typeStr = "PlaySound";
- break;
- case QWSCommand::QCopRegisterChannel:
- typeStr = "QCopRegisterChannel";
- break;
- case QWSCommand::QCopSend:
- typeStr = "QCopSend";
- break;
- case QWSCommand::RegionName:
- typeStr = "RegionName";
- break;
- case QWSCommand::Identify:
- typeStr = "Identify";
- break;
- case QWSCommand::GrabKeyboard:
- typeStr = "GrabKeyboard";
- break;
- case QWSCommand::RepaintRegion:
- typeStr = "RepaintRegion";
- break;
- case QWSCommand::IMMouse:
- typeStr = "IMMouse";
- break;
- case QWSCommand::IMUpdate:
- typeStr = "IMUpdate";
- break;
- case QWSCommand::IMResponse:
- typeStr = "IMResponse";
- break;
- case QWSCommand::Font:
- typeStr = "Font";
- break;
- case QWSCommand::Unknown:
- default:
- typeStr = "Unknown";
- break;
- }
- return typeStr;
-}
-
-
-/*********************************************************************
- *
- * Functions to read/write commands on/from a socket
- *
- *********************************************************************/
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void qws_write_command(QIODevice *socket, int type, char *simpleData, int simpleLen,
- char *rawData, int rawLen)
-{
-#ifdef QWSCOMMAND_DEBUG
- if (simpleLen) qDebug() << "WRITE simpleData " << QWSHexDump(simpleData, simpleLen);
- if (rawLen > 0) qDebug() << "WRITE rawData " << QWSHexDump(rawData, rawLen);
-#endif
-
-#ifndef QT_NO_SXE
- QTransportAuth *a = QTransportAuth::getInstance();
- // ###### as soon as public API can be modified get rid of horrible casts
- QIODevice *ad = a->passThroughByClient(reinterpret_cast<QWSClient*>(socket));
- if (ad)
- socket = ad;
-#endif
-
- qws_write_uint(socket, type);
-
- if (rawLen > MAX_COMMAND_SIZE) {
- qWarning("qws_write_command: Message of size %d too big. "
- "Truncated to %d", rawLen, MAX_COMMAND_SIZE);
- rawLen = MAX_COMMAND_SIZE;
- }
-
- qws_write_uint(socket, rawLen == -1 ? 0 : rawLen);
-
- if (simpleData && simpleLen)
- socket->write(simpleData, simpleLen);
-
- if (rawLen && rawData)
- socket->write(rawData, rawLen);
-}
-
-/*
- command format: [type][rawLen][simpleData][rawData]
- type is already read when entering this function
-*/
-
-bool qws_read_command(QIODevice *socket, char *&simpleData, int &simpleLen,
- char *&rawData, int &rawLen, int &bytesRead)
-{
-
- // read rawLen
- if (rawLen == -1) {
- rawLen = qws_read_uint(socket);
- if (rawLen == -1)
- return false;
- }
-
- // read simpleData, assumes socket is capable of buffering all the data
- if (simpleLen && !rawData) {
- if (socket->bytesAvailable() < uint(simpleLen))
- return false;
- int tmp = socket->read(simpleData, simpleLen);
- Q_ASSERT(tmp == simpleLen);
- Q_UNUSED(tmp);
- }
-
- if (rawLen > MAX_COMMAND_SIZE) {
- socket->close();
- qWarning("qws_read_command: Won't read command of length %d, "
- "connection closed.", rawLen);
- return false;
- }
-
- // read rawData
- if (rawLen && !rawData) {
- rawData = new char[rawLen];
- bytesRead = 0;
- }
- if (bytesRead < rawLen && socket->bytesAvailable())
- bytesRead += socket->read(rawData + bytesRead, rawLen - bytesRead);
-
- return (bytesRead == rawLen);
-}
-#endif
-
-/*********************************************************************
- *
- * QWSCommand base class - only use derived classes from that
- *
- *********************************************************************/
-QWSProtocolItem::~QWSProtocolItem() {
- if (deleteRaw)
- delete []rawDataPtr;
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSProtocolItem::write(QIODevice *s) {
-#ifdef QWSCOMMAND_DEBUG
- if (!qwsServer)
- qDebug() << "QWSProtocolItem::write sending type " << static_cast<QWSCommand::Type>(type);
- else
- qDebug() << "QWSProtocolItem::write sending event " << (type < N_EVENTS ? eventNames[type] : "unknown");
-#endif
- qws_write_command(s, type, simpleDataPtr, simpleLen, rawDataPtr, rawLen);
-}
-
-bool QWSProtocolItem::read(QIODevice *s) {
-#ifdef QWSCOMMAND_DEBUG
- QLatin1String reread( (rawLen == -1) ? "" : "REREAD");
- if (qwsServer)
- qDebug() << "QWSProtocolItem::read reading type " << static_cast<QWSCommand::Type>(type) << reread;
- else
- qDebug() << "QWSProtocolItem::read reading event " << (type < N_EVENTS ? eventNames[type] : "unknown") << reread;
- //qDebug("QWSProtocolItem::read reading event %s", type < N_EVENTS ? eventNames[type] : "unknown");
-#endif
- bool b = qws_read_command(s, simpleDataPtr, simpleLen, rawDataPtr, rawLen, bytesRead);
- if (b) {
- setData(rawDataPtr, rawLen, false);
- deleteRaw = true;
- }
-#ifdef QWSCOMMAND_DEBUG
- else
- {
- qDebug() << "error in reading command " << static_cast<QWSCommand::Type>(type);
- }
-#endif
- return b;
-}
-#endif // QT_NO_QWS_MULTIPROCESS
-
-void QWSProtocolItem::copyFrom(const QWSProtocolItem *item) {
- if (this == item)
- return;
- simpleLen = item->simpleLen;
- memcpy(simpleDataPtr, item->simpleDataPtr, simpleLen);
- setData(item->rawDataPtr, item->rawLen);
-}
-
-void QWSProtocolItem::setData(const char *data, int len, bool allocateMem) {
- if (deleteRaw)
- delete [] rawDataPtr;
- if (!data || len <= 0) {
- rawDataPtr = 0;
- rawLen = 0;
- return;
- }
- if (allocateMem) {
- rawDataPtr = new char[len];
- memcpy(rawDataPtr, data, len);
- deleteRaw = true;
- } else {
- rawDataPtr = const_cast<char *>(data);
- deleteRaw = false;
- }
- rawLen = len;
-}
-
-QWSCommand *QWSCommand::factory(int type)
-{
- QWSCommand *command = 0;
- switch (type) {
- case QWSCommand::Create:
- command = new QWSCreateCommand;
- break;
- case QWSCommand::Shutdown:
- command = new QWSCommand(type, 0, 0);
- break;
- case QWSCommand::Region:
- command = new QWSRegionCommand;
- break;
- case QWSCommand::RegionMove:
- command = new QWSRegionMoveCommand;
- break;
- case QWSCommand::RegionDestroy:
- command = new QWSRegionDestroyCommand;
- break;
- case QWSCommand::AddProperty:
- command = new QWSAddPropertyCommand;
- break;
- case QWSCommand::SetProperty:
- command = new QWSSetPropertyCommand;
- break;
- case QWSCommand::RemoveProperty:
- command = new QWSRemovePropertyCommand;
- break;
- case QWSCommand::GetProperty:
- command = new QWSGetPropertyCommand;
- break;
- case QWSCommand::SetSelectionOwner:
- command = new QWSSetSelectionOwnerCommand;
- break;
- case QWSCommand::RequestFocus:
- command = new QWSRequestFocusCommand;
- break;
- case QWSCommand::ChangeAltitude:
- command = new QWSChangeAltitudeCommand;
- break;
- case QWSCommand::SetOpacity:
- command = new QWSSetOpacityCommand;
- break;
- case QWSCommand::DefineCursor:
- command = new QWSDefineCursorCommand;
- break;
- case QWSCommand::SelectCursor:
- command = new QWSSelectCursorCommand;
- break;
- case QWSCommand::GrabMouse:
- command = new QWSGrabMouseCommand;
- break;
- case QWSCommand::GrabKeyboard:
- command = new QWSGrabKeyboardCommand;
- break;
-#ifndef QT_NO_SOUND
- case QWSCommand::PlaySound:
- command = new QWSPlaySoundCommand;
- break;
-#endif
-#ifndef QT_NO_COP
- case QWSCommand::QCopRegisterChannel:
- command = new QWSQCopRegisterChannelCommand;
- break;
- case QWSCommand::QCopSend:
- command = new QWSQCopSendCommand;
- break;
-#endif
- case QWSCommand::RegionName:
- command = new QWSRegionNameCommand;
- break;
- case QWSCommand::Identify:
- command = new QWSIdentifyCommand;
- break;
- case QWSCommand::RepaintRegion:
- command = new QWSRepaintRegionCommand;
- break;
-#ifndef QT_NO_QWS_INPUTMETHODS
- case QWSCommand::IMUpdate:
- command = new QWSIMUpdateCommand;
- break;
-
- case QWSCommand::IMMouse:
- command = new QWSIMMouseCommand;
- break;
-
- case QWSCommand::IMResponse:
- command = new QWSIMResponseCommand;
- break;
-#endif
- case QWSCommand::PositionCursor:
- command = new QWSPositionCursorCommand;
- break;
-#ifndef QT_NO_QWSEMBEDWIDGET
- case QWSCommand::Embed:
- command = new QWSEmbedCommand;
- break;
-#endif
- case QWSCommand::Font:
- command = new QWSFontCommand;
- break;
- case QWSCommand::ScreenTransform:
- command = new QWSScreenTransformCommand;
- break;
- default:
- qWarning("QWSCommand::factory : Type error - got %08x!", type);
- }
- return command;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qwscommand_qws_p.h b/src/gui/embedded/qwscommand_qws_p.h
deleted file mode 100644
index 70ecc6be6d..0000000000
--- a/src/gui/embedded/qwscommand_qws_p.h
+++ /dev/null
@@ -1,851 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSCOMMAND_QWS_P_H
-#define QWSCOMMAND_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// When reading commands "off the wire" in the server, the rawLen is read
-// and then that many bytes are allocated. If the rawLen is corrupted (or
-// the protocol is being attacked) too many bytes can be allocated. Set
-// a hard limit here for security.
-#define MAX_COMMAND_SIZE (16 * 1024)
-
-#include <QtCore/qbytearray.h>
-#include <QtGui/qwsutils_qws.h>
-#include <QtGui/qfont.h>
-#include <QtCore/qdatastream.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qrect.h>
-#include <QtGui/qregion.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qvarlengtharray.h>
-#include <QtGui/qwsevent_qws.h>
-#include "qwsprotocolitem_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QRect;
-
-/*********************************************************************
- *
- * Functions to read/write commands on/from a socket
- *
- *********************************************************************/
-#ifndef QT_NO_QWS_MULTIPROCESS
-void qws_write_command(QIODevice *socket, int type, char *simpleData, int simpleLen, char *rawData, int rawLen);
-bool qws_read_command(QIODevice *socket, char *&simpleData, int &simpleLen, char *&rawData, int &rawLen, int &bytesRead);
-#endif
-
-struct QWSCommand : QWSProtocolItem
-{
- QWSCommand(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {}
-
- enum Type {
- Unknown = 0,
- Create,
- Shutdown,
- Region,
- RegionMove,
- RegionDestroy,
- SetProperty,
- AddProperty,
- RemoveProperty,
- GetProperty,
- SetSelectionOwner,
- ConvertSelection,
- RequestFocus,
- ChangeAltitude,
- SetOpacity,
- DefineCursor,
- SelectCursor,
- PositionCursor,
- GrabMouse,
- PlaySound,
- QCopRegisterChannel,
- QCopSend,
- RegionName,
- Identify,
- GrabKeyboard,
- RepaintRegion,
- IMMouse,
- IMUpdate,
- IMResponse,
- Embed,
- Font,
- ScreenTransform
- };
- static QWSCommand *factory(int type);
-};
-
-const char *qws_getCommandTypeString( QWSCommand::Type tp );
-
-#ifndef QT_NO_DEBUG
-class QDebug;
-QDebug &operator<<(QDebug &dbg, QWSCommand::Type tp);
-#endif // QT_NO_DEBUG
-
-/*********************************************************************
- *
- * Commands
- *
- *********************************************************************/
-
-struct QWSIdentifyCommand : public QWSCommand
-{
- QWSIdentifyCommand() :
- QWSCommand(QWSCommand::Identify,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData))
- {
- simpleData.idLen = 0;
- simpleData.idLock = -1;
- }
-
- void setData(const char *d, int len, bool allocateMem) {
- QWSCommand::setData(d, len, allocateMem);
- if ( simpleData.idLen > MAX_COMMAND_SIZE )
- {
- qWarning( "Identify command - name length %d - too big!", simpleData.idLen );
- simpleData.idLen = MAX_COMMAND_SIZE;
- }
- if ( simpleData.idLen * int(sizeof(QChar)) > len )
- {
- qWarning( "Identify command - name length %d - buffer size %d - buffer overrun!", simpleData.idLen, len );
- }
- else
- {
- id = QString(reinterpret_cast<const QChar*>(d), simpleData.idLen);
- }
- }
-
- void setId(const QString& i, int lock)
- {
- id = i;
- simpleData.idLen = id.length();
- simpleData.idLock = lock;
- setData(reinterpret_cast<const char*>(id.unicode()), simpleData.idLen*2, true);
- }
-
- struct SimpleData {
- int idLen;
- int idLock;
- } simpleData;
- QString id;
-};
-
-struct QWSCreateCommand : public QWSCommand
-{
- QWSCreateCommand(int n = 1) :
- QWSCommand(QWSCommand::Create, sizeof(count),
- reinterpret_cast<char *>(&count)), count(n) {}
- int count;
-};
-
-struct QWSRegionNameCommand : public QWSCommand
-{
- QWSRegionNameCommand() :
- QWSCommand(QWSCommand::RegionName,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem) {
- QWSCommand::setData(d, len, allocateMem);
- if ( simpleData.nameLen > MAX_COMMAND_SIZE )
- {
- qWarning( "region name command - name length too big!" );
- simpleData.nameLen = MAX_COMMAND_SIZE;
- }
- if ( simpleData.captionLen > MAX_COMMAND_SIZE )
- {
- qWarning( "region name command - caption length too big!" );
- simpleData.captionLen = MAX_COMMAND_SIZE;
- }
- if ( simpleData.nameLen + simpleData.captionLen > len )
- {
- qWarning( "region name command - name length %d - caption length %d - buffer size %d - buffer overrun!",
- simpleData.nameLen, simpleData.captionLen, len );
-
- }
- else
- {
- name = QString(reinterpret_cast<const QChar*>(d), simpleData.nameLen/2);
- d += simpleData.nameLen;
- caption = QString(reinterpret_cast<const QChar*>(d), simpleData.captionLen/2);
- }
- }
-
- void setName(const QString& n, const QString &c)
- {
- name = n;
- caption = c;
- int l = simpleData.nameLen = name.length()*2;
- l += simpleData.captionLen = caption.length()*2;
- char *d = new char[l];
- memcpy(d, name.unicode(), simpleData.nameLen);
- memcpy(d+simpleData.nameLen, caption.unicode(), simpleData.captionLen);
- setData(d, l, true);
- delete[] d;
- }
-
- struct SimpleData {
- int windowid;
- int nameLen;
- int captionLen;
- } simpleData;
- QString name;
- QString caption;
-};
-
-struct QWSRegionCommand : public QWSCommand
-{
- QWSRegionCommand() :
- QWSCommand(QWSCommand::Region, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSCommand::setData(d, len, allocateMem);
-
- if( simpleData.nrectangles * int(sizeof(QRect)) + simpleData.surfacekeylength * int(sizeof(QChar)) + simpleData.surfacedatalength * int(sizeof(char)) > len )
- {
- qWarning( "region command - rectangle count %d - surface key length %d - region data size %d - buffer size %d - buffer overrun!",
- simpleData.nrectangles, simpleData.surfacekeylength, simpleData.surfacedatalength, len );
- }
- else
- {
- char *ptr = rawDataPtr;
-
- region.setRects(reinterpret_cast<QRect*>(ptr), simpleData.nrectangles);
- ptr += simpleData.nrectangles * sizeof(QRect);
-
- surfaceKey = QString(reinterpret_cast<QChar*>(ptr),
- simpleData.surfacekeylength);
- ptr += simpleData.surfacekeylength * sizeof(QChar);
-
- surfaceData = QByteArray(ptr, simpleData.surfacedatalength);
- }
- }
-
- void setData(int id, const QString &key, const QByteArray &data,
- const QRegion &reg)
- {
- surfaceKey = key;
- surfaceData = data;
- region = reg;
-
- const QVector<QRect> rects = reg.rects();
-
- simpleData.windowid = id;
- simpleData.surfacekeylength = key.size();
- simpleData.surfacedatalength = data.size();
- simpleData.nrectangles = rects.count();
-
- QVarLengthArray<char, 256> buffer;
- buffer.append(reinterpret_cast<const char*>(rects.constData()),
- rects.count() * sizeof(QRect));
- buffer.append(reinterpret_cast<const char*>(key.constData()),
- key.size() * sizeof(QChar));
- buffer.append(data, data.size());
-
- QWSCommand::setData(buffer.constData(), buffer.size(), true);
- }
-
- /* XXX this will pad out in a compiler dependent way,
- should move nrectangles to before windowtype, and
- add reserved bytes.
- Symptom will be valgrind reported uninitialized memory usage
- */
- struct SimpleData {
- int windowid;
- int surfacekeylength;
- int surfacedatalength;
- int nrectangles;
- } simpleData;
-
- QString surfaceKey;
- QByteArray surfaceData;
- QRegion region;
-};
-
-struct QWSSetOpacityCommand : public QWSCommand
-{
- QWSSetOpacityCommand() :
- QWSCommand(QWSCommand::SetOpacity, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- uchar opacity;
- } simpleData;
-};
-
-struct QWSRegionMoveCommand : public QWSCommand
-{
- QWSRegionMoveCommand() :
- QWSCommand(QWSCommand::RegionMove, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- int dx;
- int dy;
- } simpleData;
-
-};
-
-struct QWSRegionDestroyCommand : public QWSCommand
-{
- QWSRegionDestroyCommand() :
- QWSCommand(QWSCommand::RegionDestroy, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- } simpleData;
-
-};
-
-struct QWSRequestFocusCommand : public QWSCommand
-{
- QWSRequestFocusCommand() :
- QWSCommand(QWSCommand::RequestFocus, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- int flag;
- } simpleData;
-};
-
-struct QWSChangeAltitudeCommand : public QWSCommand
-{
- QWSChangeAltitudeCommand() :
- QWSCommand(QWSCommand::ChangeAltitude, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {}
-
- enum Altitude {
- Lower = -1,
- Raise = 0,
- StaysOnTop = 1
- };
-
- struct SimpleData {
- int windowid;
- Altitude altitude;
- bool fixed;
- } simpleData;
-
-};
-
-
-struct QWSAddPropertyCommand : public QWSCommand
-{
- QWSAddPropertyCommand() :
- QWSCommand(QWSCommand::AddProperty, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid, property;
- } simpleData;
-
-};
-
-struct QWSSetPropertyCommand : public QWSCommand
-{
- QWSSetPropertyCommand() :
- QWSCommand(QWSCommand::SetProperty, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) { data = 0; }
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSCommand::setData(d, len, allocateMem);
- data = rawDataPtr;
- }
-
- struct SimpleData {
- int windowid, property, mode;
- } simpleData;
-
- char *data;
-};
-
-struct QWSRepaintRegionCommand : public QWSCommand
-{
- QWSRepaintRegionCommand() :
- QWSCommand(QWSCommand::RepaintRegion, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSCommand::setData(d, len, allocateMem);
-
- if( simpleData.nrectangles * int(sizeof(QRect)) > len )
- {
- qWarning( "repaint region command - region rectangle count %d - buffer size %d - buffer overrun",
- simpleData.nrectangles, len );
-
- simpleData.nrectangles = len / sizeof(QRect);
- }
- rectangles = reinterpret_cast<QRect *>(rawDataPtr);
- }
-
- struct SimpleData {
- int windowid;
- int windowFlags;
- bool opaque;
- int nrectangles;
- } simpleData;
-
- QRect * rectangles;
-
-};
-
-struct QWSRemovePropertyCommand : public QWSCommand
-{
- QWSRemovePropertyCommand() :
- QWSCommand(QWSCommand::RemoveProperty, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid, property;
- } simpleData;
-
-};
-
-struct QWSGetPropertyCommand : public QWSCommand
-{
- QWSGetPropertyCommand() :
- QWSCommand(QWSCommand::GetProperty, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid, property;
- } simpleData;
-
-};
-
-struct QWSSetSelectionOwnerCommand : public QWSCommand
-{
- QWSSetSelectionOwnerCommand() :
- QWSCommand(QWSCommand::SetSelectionOwner,
- sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- int hour, minute, sec, ms; // time
- } simpleData;
-
-};
-
-struct QWSConvertSelectionCommand : public QWSCommand
-{
- QWSConvertSelectionCommand() :
- QWSCommand(QWSCommand::ConvertSelection,
- sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int requestor; // requestor window of the selection
- int selection; // property on requestor into which the selection should be stored
- int mimeTypes; // property ion requestor in which the mimetypes, in which the selection may be, are stored
- } simpleData;
-
-};
-
-struct QWSDefineCursorCommand : public QWSCommand
-{
- QWSDefineCursorCommand() :
- QWSCommand(QWSCommand::DefineCursor,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSCommand::setData(d, len, allocateMem);
- data = reinterpret_cast<unsigned char *>(rawDataPtr);
- if (simpleData.height * ((simpleData.width+7) / 8) > len) {
- qWarning("define cursor command - width %d height %d- buffer size %d - buffer overrun",
- simpleData.width, simpleData.height, len );
- simpleData.width = simpleData.height = 0;
- }
- }
-
- struct SimpleData {
- int width;
- int height;
- int hotX;
- int hotY;
- int id;
- } simpleData;
-
- unsigned char *data;
-};
-
-struct QWSSelectCursorCommand : public QWSCommand
-{
- QWSSelectCursorCommand() :
- QWSCommand(QWSCommand::SelectCursor,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- int id;
- } simpleData;
-};
-
-struct QWSPositionCursorCommand : public QWSCommand
-{
- QWSPositionCursorCommand() :
- QWSCommand(QWSCommand::PositionCursor,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- struct SimpleData {
- int newX;
- int newY;
- } simpleData;
-};
-
-struct QWSGrabMouseCommand : public QWSCommand
-{
- QWSGrabMouseCommand() :
- QWSCommand(QWSCommand::GrabMouse,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- bool grab; // grab or ungrab?
- } simpleData;
-};
-
-struct QWSGrabKeyboardCommand : public QWSCommand
-{
- QWSGrabKeyboardCommand() :
- QWSCommand(QWSCommand::GrabKeyboard,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- bool grab; // grab or ungrab?
- } simpleData;
-};
-
-#ifndef QT_NO_SOUND
-struct QWSPlaySoundCommand : public QWSCommand
-{
- QWSPlaySoundCommand() :
- QWSCommand(QWSCommand::PlaySound,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem) {
- QWSCommand::setData(d, len, allocateMem);
- filename = QString(reinterpret_cast<QChar*>(rawDataPtr),len/2);
- }
- void setFileName(const QString& n)
- {
- setData(reinterpret_cast<const char*>(n.unicode()), n.length()*2, true);
- }
-
- struct SimpleData {
- int windowid;
- } simpleData;
- QString filename;
-};
-#endif
-
-
-#ifndef QT_NO_COP
-struct QWSQCopRegisterChannelCommand : public QWSCommand
-{
- QWSQCopRegisterChannelCommand() :
- QWSCommand(QWSCommand::QCopRegisterChannel,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem) {
- QWSCommand::setData(d, len, allocateMem);
- if ( simpleData.chLen > MAX_COMMAND_SIZE )
- {
- qWarning( "Command channel name too large!" );
- simpleData.chLen = MAX_COMMAND_SIZE;
- }
- if( simpleData.chLen * int(sizeof(QChar)) > len )
- {
- qWarning( "register qcop channel command - channel name length %d - buffer size %d - buffer overrun!", simpleData.chLen, len );
- }
- else
- {
- channel = QString(reinterpret_cast<const QChar*>(d), simpleData.chLen);
- }
- }
-
- void setChannel(const QString& n)
- {
- channel = n;
- simpleData.chLen = channel.length();
- setData(reinterpret_cast<const char*>(channel.unicode()), simpleData.chLen*2, true);
- }
-
- struct SimpleData {
- int chLen;
- } simpleData;
- QString channel;
-};
-
-struct QWSQCopSendCommand : public QWSCommand
-{
- QWSQCopSendCommand() :
- QWSCommand(QWSCommand::QCopSend,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem) {
- QWSCommand::setData(d, len, allocateMem);
-
- if( simpleData.clen * int(sizeof(QChar)) + simpleData.mlen * int(sizeof(QChar)) + simpleData.dlen * int(sizeof(char)) > len )
- {
- qWarning( "qcop send command - channel name length %d - message name length %d - data size %d - buffer size %d - buffer overrun!",
- simpleData.clen, simpleData.mlen, simpleData.dlen, len );
- }
- else
- {
- const QChar *cd = reinterpret_cast<const QChar*>(d);
- channel = QString(cd,simpleData.clen); cd += simpleData.clen;
- message = QString(cd,simpleData.mlen);
- d += simpleData.clen*sizeof(QChar) + simpleData.mlen*sizeof(QChar);
- data = QByteArray(d, simpleData.dlen);
- }
- }
-
- void setMessage(const QString &c, const QString &m,
- const QByteArray &data)
- {
- this->channel = c;
- this->message = m;
- this->data = data;
- simpleData.clen = c.length();
- simpleData.mlen = m.length();
- simpleData.dlen = data.size();
- int l = simpleData.clen*sizeof(QChar);
- l += simpleData.mlen*sizeof(QChar);
- l += simpleData.dlen;
- char *tmp = new char[l];
- char *d = tmp;
- memcpy(d, c.unicode(), simpleData.clen*sizeof(QChar));
- d += simpleData.clen*sizeof(QChar);
- memcpy(d, m.unicode(), simpleData.mlen*sizeof(QChar));
- d += simpleData.mlen*sizeof(QChar);
- memcpy(d, data.data(), simpleData.dlen);
- QWSCommand::setData(tmp, l, false);
- deleteRaw = true;
- }
-
- struct SimpleData {
- int clen;
- int mlen;
- int dlen;
- } simpleData;
- QString channel;
- QString message;
- QByteArray data;
-};
-
-#endif
-
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-struct QWSIMMouseCommand : public QWSCommand
-{
- QWSIMMouseCommand() :
- QWSCommand(QWSCommand::IMMouse,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- int state;
- int index;
- } simpleData;
-};
-
-
-struct QWSIMResponseCommand : public QWSCommand
-{
- QWSIMResponseCommand() :
- QWSCommand(QWSCommand::IMResponse,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem) {
- QWSCommand::setData(d, len, allocateMem);
-
- QByteArray tmp = QByteArray::fromRawData(d, len);
- QDataStream s(tmp);
- s >> result;
- }
-
- void setResult(const QVariant & v)
- {
- QByteArray tmp;
- QDataStream s(&tmp, QIODevice::WriteOnly);
- s << v;
- setData(tmp.data(), tmp.size(), true);
- }
-
- struct SimpleData {
- int windowid;
- int property;
- } simpleData;
-
- QVariant result;
-};
-
-struct QWSIMUpdateCommand: public QWSCommand
-{
- QWSIMUpdateCommand() :
- QWSCommand(QWSCommand::IMUpdate,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- struct SimpleData {
- int windowid;
- int type;
- int widgetid;
- } simpleData;
-};
-
-#endif
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-struct QWSEmbedCommand : public QWSCommand
-{
- QWSEmbedCommand() : QWSCommand(QWSCommand::Embed,
- sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData))
- {}
-
- void setData(const char *d, int len, bool allocateMem = true)
- {
- QWSCommand::setData(d, len, allocateMem);
-
- if( simpleData.rects * int(sizeof(QRect)) > len )
- {
- qWarning( "embed command - region rectangle count %d - buffer size %d - buffer overrun!",
- simpleData.rects, len );
- }
- else
- {
- region.setRects(reinterpret_cast<QRect*>(rawDataPtr),
- simpleData.rects);
- }
- }
-
- void setData(WId embedder, WId embedded, QWSEmbedEvent::Type type,
- const QRegion reg = QRegion())
- {
- simpleData.embedder = embedder;
- simpleData.embedded = embedded;
- simpleData.type = type;
-
- region = reg;
- const QVector<QRect> rects = reg.rects();
- simpleData.rects = rects.count();
-
- QWSCommand::setData(reinterpret_cast<const char*>(rects.constData()),
- rects.count() * sizeof(QRect));
- }
-
- struct {
- WId embedder;
- WId embedded;
- QWSEmbedEvent::Type type;
- int rects;
- } simpleData;
-
- QRegion region;
-};
-#endif // QT_NO_QWSEMBEDWIDGET
-
-struct QWSFontCommand : public QWSCommand
-{
- enum CommandType {
- StartedUsingFont,
- StoppedUsingFont
- };
-
- QWSFontCommand() :
- QWSCommand(QWSCommand::Font,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem) {
- QWSCommand::setData(d, len, allocateMem);
-
- fontName = QByteArray(d, len);
- }
-
- void setFontName(const QByteArray &name)
- {
- setData(name.constData(), name.size(), true);
- }
-
- struct SimpleData {
- int type;
- } simpleData;
-
- QByteArray fontName;
-};
-
-struct QWSScreenTransformCommand : public QWSCommand
-{
- QWSScreenTransformCommand() :
- QWSCommand(QWSCommand::ScreenTransform,
- sizeof(simpleData), reinterpret_cast<char *>(&simpleData)) {}
-
- void setTransformation(int screen, int transformation)
- {
- simpleData.screen = screen;
- simpleData.transformation = transformation;
- }
-
- struct SimpleData {
- int screen;
- int transformation;
- } simpleData;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWSCOMMAND_QWS_P_H
diff --git a/src/gui/embedded/qwscursor_qws.cpp b/src/gui/embedded/qwscursor_qws.cpp
deleted file mode 100644
index 0313e00391..0000000000
--- a/src/gui/embedded/qwscursor_qws.cpp
+++ /dev/null
@@ -1,654 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcursor.h"
-#include "qbitmap.h"
-#include "qscreen_qws.h"
-#include "qapplication.h"
-#include "qwindowsystem_qws.h"
-#include "qwindowsystem_p.h"
-#include "qwscursor_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_QWS_CURSOR
-static QWSCursor *systemCursorTable[Qt::LastCursor+1];
-static bool systemCursorTableInit = false;
-
-// 16 x 16
-static const uchar cur_arrow_bits[] = {
- 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08,
- 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22,
- 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 };
-static const uchar mcur_arrow_bits[] = {
- 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f,
- 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e,
- 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 };
-
-static const unsigned char cur_up_arrow_bits[] = {
- 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04,
- 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
- 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01};
-static const unsigned char mcur_up_arrow_bits[] = {
- 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07,
- 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
- 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};
-
-static const unsigned char cur_cross_bits[] = {
- 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
- 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
- 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00};
-static const unsigned char mcur_cross_bits[] = {
- 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
- 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
- 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00};
-
-static const uchar cur_ibeam_bits[] = {
- 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
- 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
- 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 };
-static const uchar mcur_ibeam_bits[] = {
- 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
- 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
- 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 };
-
-static const uchar cur_ver_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,
- 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f,
- 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 };
-static const uchar mcur_ver_bits[] = {
- 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f,
- 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f,
- 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 };
-
-static const uchar cur_hor_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18,
- 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar mcur_hor_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c,
- 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c,
- 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 };
-static const uchar cur_bdiag_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e,
- 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00,
- 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar mcur_bdiag_bits[] = {
- 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f,
- 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01,
- 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 };
-static const uchar cur_fdiag_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00,
- 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c,
- 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 };
-static const uchar mcur_fdiag_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00,
- 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e,
- 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 };
-static const uchar cur_blank_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-// 20 x 20
-static const uchar forbidden_bits[] = {
- 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01,
- 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06,
- 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03,
- 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 };
-
-static const uchar forbiddenm_bits[] = {
- 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03,
- 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f,
- 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07,
- 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00};
-
-// 32 x 32
-static const uchar wait_data_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,
- 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00,
- 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00,
- 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00,
- 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00,
- 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00,
- 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00,
- 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar wait_mask_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,
- 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
- 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
- 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00,
- 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00,
- 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
- 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00,
- 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-static const uchar hsplit_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
- 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
- 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03,
- 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00,
- 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
- 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar hsplitm_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00,
- 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07,
- 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00,
- 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar vsplit_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
- 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar vsplitm_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
- 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
- 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
- 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
- 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
- 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
- 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00,
- 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar phand_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
- 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00,
- 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00,
- 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00,
- 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar phandm_bits[] = {
- 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
- 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00,
- 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00,
- 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00,
- 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-static const uchar size_all_data_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00,
- 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static const uchar size_all_mask_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
- 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
- 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00,
- 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01,
- 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00,
- 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00,
- 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00,
- 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-static const uchar whatsthis_bits[] = {
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00,
- 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00,
- 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00,
- 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00,
- 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00,
- 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00,
- 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
-static const uchar whatsthism_bits[] = {
- 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00,
- 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00,
- 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00,
- 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00,
- 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00,
- 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00,
- 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
-
-static const uchar busy_bits[] = {
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
- 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00,
- 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00,
- 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00,
- 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00,
- 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00,
- 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-static const uchar busym_bits[] = {
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
- 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00,
- 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00,
- 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00,
- 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00,
- 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00,
- 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-// 16 x 16
-static const uchar openhand_bits[] = {
- 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92,
- 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20,
- 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00};
-static const uchar openhandm_bits[] = {
- 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff,
- 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f,
- 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00};
-static const uchar closedhand_bits[] = {
- 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50,
- 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10,
- 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00};
-static const uchar closedhandm_bits[] = {
- 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f,
- 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f,
- 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00};
-
-#endif
-
-void QWSServerPrivate::initializeCursor()
-{
- Q_Q(QWSServer);
- // setup system cursors
-#ifndef QT_NO_QWS_CURSOR
-// qt_screen->initCursor(sharedram + ramlen,true);
-
- // default cursor
- cursor = 0;
- setCursor(QWSCursor::systemCursor(Qt::ArrowCursor));
-#endif
- q->sendMouseEvent(QPoint(swidth/2, sheight/2), 0);
-}
-
-void QWSServerPrivate::setCursor(QWSCursor *curs)
-{
-#ifdef QT_NO_QWS_CURSOR
- Q_UNUSED(curs);
-#else
- if (cursor == curs)
- return;
-
- cursor = curs;
-
- if (!haveviscurs || !curs)
- curs = QWSCursor::systemCursor(Qt::BlankCursor);
-
- if (qt_screencursor) {
- qt_screencursor->set(curs->image(),
- curs->hotSpot().x(),
- curs->hotSpot().y());
- }
-#endif
-}
-
-#ifndef QT_NO_QWS_CURSOR
-static void cleanupSystemCursorTable()
-{
- for (int i = 0; i <= Qt::LastCursor; i++)
- if (systemCursorTable[i]) {
- delete systemCursorTable[i];
- systemCursorTable[i] = 0;
- }
-}
-#endif
-
-void QWSCursor::createSystemCursor(int id)
-{
-#ifdef QT_NO_QWS_CURSOR
- Q_UNUSED(id);
-#else
- if (!systemCursorTableInit) {
- for (int i = 0; i <= Qt::LastCursor; i++)
- systemCursorTable[i] = 0;
- qAddPostRoutine(cleanupSystemCursorTable);
- systemCursorTableInit = true;
- }
- switch (id) {
- // 16x16 cursors
- case Qt::ArrowCursor:
- systemCursorTable[Qt::ArrowCursor] =
- new QWSCursor(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0);
- break;
-
- case Qt::UpArrowCursor:
- systemCursorTable[Qt::UpArrowCursor] =
- new QWSCursor(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0);
- break;
-
- case Qt::CrossCursor:
- systemCursorTable[Qt::CrossCursor] =
- new QWSCursor(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7);
- break;
-
- case Qt::IBeamCursor:
- systemCursorTable[Qt::IBeamCursor] =
- new QWSCursor(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7);
- break;
-
- case Qt::SizeVerCursor:
- systemCursorTable[Qt::SizeVerCursor] =
- new QWSCursor(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7);
- break;
-
- case Qt::SizeHorCursor:
- systemCursorTable[Qt::SizeHorCursor] =
- new QWSCursor(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7);
- break;
-
- case Qt::SizeBDiagCursor:
- systemCursorTable[Qt::SizeBDiagCursor] =
- new QWSCursor(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7);
- break;
-
- case Qt::SizeFDiagCursor:
- systemCursorTable[Qt::SizeFDiagCursor] =
- new QWSCursor(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7);
- break;
-
- case Qt::BlankCursor:
- systemCursorTable[Qt::BlankCursor] =
- new QWSCursor(0, 0, 0, 0, 0, 0);
- break;
-
- // 20x20 cursors
- case Qt::ForbiddenCursor:
- systemCursorTable[Qt::ForbiddenCursor] =
- new QWSCursor(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10);
- break;
-
- // 32x32 cursors
- case Qt::WaitCursor:
- systemCursorTable[Qt::WaitCursor] =
- new QWSCursor(wait_data_bits, wait_mask_bits, 32, 32, 15, 15);
- break;
-
- case Qt::SplitVCursor:
- systemCursorTable[Qt::SplitVCursor] =
- new QWSCursor(vsplit_bits, vsplitm_bits, 32, 32, 15, 15);
- break;
-
- case Qt::SplitHCursor:
- systemCursorTable[Qt::SplitHCursor] =
- new QWSCursor(hsplit_bits, hsplitm_bits, 32, 32, 15, 15);
- break;
-
- case Qt::SizeAllCursor:
- systemCursorTable[Qt::SizeAllCursor] =
- new QWSCursor(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15);
- break;
-
- case Qt::PointingHandCursor:
- systemCursorTable[Qt::PointingHandCursor] =
- new QWSCursor(phand_bits, phandm_bits, 32, 32, 0, 0);
- break;
-
- case Qt::WhatsThisCursor:
- systemCursorTable[Qt::WhatsThisCursor] =
- new QWSCursor(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0);
- break;
- case Qt::BusyCursor:
- systemCursorTable[Qt::BusyCursor] =
- new QWSCursor(busy_bits, busym_bits, 32, 32, 0, 0);
- break;
-
- case Qt::OpenHandCursor:
- systemCursorTable[Qt::OpenHandCursor] =
- new QWSCursor(openhand_bits, openhandm_bits, 16, 16, 8, 8);
- break;
- case Qt::ClosedHandCursor:
- systemCursorTable[Qt::ClosedHandCursor] =
- new QWSCursor(closedhand_bits, closedhandm_bits, 16, 16, 8, 8);
- break;
- default:
- qWarning("Unknown system cursor %d", id);
- }
-#endif
-}
-
-QWSCursor *QWSCursor::systemCursor(int id)
-{
- QWSCursor *cursor = 0;
-#ifdef QT_NO_QWS_CURSOR
- Q_UNUSED(id);
-#else
- if (id >= 0 && id <= Qt::LastCursor) {
- if (!systemCursorTable[id])
- createSystemCursor(id);
- cursor = systemCursorTable[id];
- }
-
- if (cursor == 0) {
- if (!systemCursorTable[Qt::ArrowCursor])
- createSystemCursor(Qt::ArrowCursor);
- cursor = systemCursorTable[Qt::ArrowCursor];
- }
-#endif
- return cursor;
-}
-
-void QWSCursor::set(const uchar *data, const uchar *mask,
- int width, int height, int hx, int hy)
-{
-#ifdef QT_NO_QWS_CURSOR
- Q_UNUSED(data);
- Q_UNUSED(mask);
- Q_UNUSED(width);
- Q_UNUSED(height);
- Q_UNUSED(hx);
- Q_UNUSED(hy);
-#else
- hot.setX(hx);
- hot.setY(hy);
-
- cursor = QImage(width,height, QImage::Format_Indexed8);
-
- if (!width || !height || !data || !mask || cursor.isNull())
- return;
-
- cursor.setColorCount(3);
- cursor.setColor(0, 0xff000000);
- cursor.setColor(1, 0xffffffff);
- cursor.setColor(2, 0x00000000);
-
- int bytesPerLine = (width + 7) / 8;
- int p = 0;
- int d, m;
-
- int x = -1, w = 0;
-
- uchar *cursor_data = cursor.bits();
- int bpl = cursor.bytesPerLine();
- for (int i = 0; i < height; i++)
- {
- for (int j = 0; j < bytesPerLine; j++, data++, mask++)
- {
- for (int b = 0; b < 8 && j*8+b < width; b++)
- {
- d = *data & (1 << b);
- m = *mask & (1 << b);
- if (d && m) p = 0;
- else if (!d && m) p = 1;
- else p = 2;
- cursor_data[j*8+b] = p;
-
- // calc region
- if (x < 0 && m)
- x = j*8+b;
- else if (x >= 0 && !m) {
- x = -1;
- w = 0;
- }
- if (m)
- w++;
- }
- }
- if (x >= 0) {
- x = -1;
- w = 0;
- }
- cursor_data += bpl;
- }
-
- if (qt_screencursor && qt_screencursor->supportsAlphaCursor())
- createDropShadow(5, 2);
-#endif
-}
-
-// now we're really silly
-void QWSCursor::createDropShadow(int dropx, int dropy)
-{
- //####
-#if 1 || defined(QT_NO_QWS_CURSOR) || defined(QT_NO_QWS_ALHPA_CURSOR)
- Q_UNUSED(dropx);
- Q_UNUSED(dropy);
-#else
- if (cursor.width() + dropx > 64 || cursor.height() + dropy > 64)
- return;
-
- if (!cursor.hasAlphaBuffer()) {
- cursor.setAlphaBuffer(true);
-
- const int nblur=4;
- const int darkness=140;
-
- QImage drop(cursor.width()+dropx+nblur, cursor.height()+dropy+nblur, 8, 18);
- drop.setColor(0, 0xff000000); // bg (black)
- drop.setColor(1, 0xffffffff); // fg (white)
- for (int i=0; i<16; i++) {
- drop.setColor(2+i, (darkness*i/16)<<24);
- }
- drop.fill(2); // all trans
- QImage drop2 = drop.copy();
-
- int cp;
-
- // made solid shadow
- for (int row = 0; row < cursor.height(); row++) {
- for (int col = 0; col < cursor.width(); col++) {
- cp = cursor.pixelIndex(col, row);
- if (cp != 2)
- drop.setPixel(col+dropx, row+dropy, 17);
- }
- }
-
- // blur shadow
- for (int blur=0; blur<nblur; blur++) {
- QImage& to((blur&1)?drop:drop2);
- QImage& from((blur&1)?drop2:drop);
- for (int row = 1; row < drop.height()-1; row++) {
- for (int col = 1; col < drop.width()-1; col++) {
- int t=0;
- for (int dx=-1; dx<=1; dx++) {
- for (int dy=-1; dy<=1; dy++) {
- t += from.pixelIndex(col+dx,row+dy)-2;
- }
- }
- to.setPixel(col,row,2+t/9);
- }
- }
- }
-
- // copy cursor
- for (int row = 0; row < cursor.height(); row++) {
- for (int col = 0; col < cursor.width(); col++) {
- cp = cursor.pixelIndex(col, row);
- if (cp != 2)
- drop.setPixel(col, row, cp);
- }
- }
-
- cursor = drop;
- }
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qwscursor_qws.h b/src/gui/embedded/qwscursor_qws.h
deleted file mode 100644
index 39464173c1..0000000000
--- a/src/gui/embedded/qwscursor_qws.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSCURSOR_QWS_H
-#define QWSCURSOR_QWS_H
-
-#include <QtGui/qimage.h>
-#include <QtGui/qregion.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QWSCursor
-{
-public:
- QWSCursor() {}
- QWSCursor(const uchar *data, const uchar *mask, int width, int height,
- int hotX, int hotY)
- { set(data, mask, width, height, hotX, hotY); }
-
- void set(const uchar *data, const uchar *mask,
- int width, int height, int hotX, int hotY);
-
- QPoint hotSpot() const { return hot; }
- QImage &image() { return cursor; }
-
- static QWSCursor *systemCursor(int id);
-
-private:
- static void createSystemCursor(int id);
- void createDropShadow(int dropx, int dropy);
-
-private:
- QPoint hot;
- QImage cursor;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWSCURSOR_QWS_H
diff --git a/src/gui/embedded/qwsdisplay_qws.h b/src/gui/embedded/qwsdisplay_qws.h
deleted file mode 100644
index 81acb425c9..0000000000
--- a/src/gui/embedded/qwsdisplay_qws.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSDISPLAY_QWS_H
-#define QWSDISPLAY_QWS_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qbytearray.h>
-#include <QtGui/qregion.h>
-#include <QtGui/qimage.h>
-#include <QtGui/qwindowdefs.h>
-#include <QtCore/qlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QWSEvent;
-class QWSMouseEvent;
-class QWSQCopMessageEvent;
-class QVariant;
-class QLock;
-
-class QWSWindowInfo
-{
-
-public:
-
- int winid;
- unsigned int clientid;
- QString name;
-
-};
-
-#define QT_QWS_PROPERTY_CONVERTSELECTION 999
-#define QT_QWS_PROPERTY_WINDOWNAME 998
-#define QT_QWS_PROPERTY_MARKEDTEXT 997
-
-class QWSDisplay;
-extern Q_GUI_EXPORT QWSDisplay *qt_fbdpy;
-
-class Q_GUI_EXPORT QWSDisplay
-{
-public:
- QWSDisplay();
- ~QWSDisplay();
-
- static QWSDisplay* instance() { return qt_fbdpy; }
-
- bool eventPending() const;
- QWSEvent *getEvent();
-// QWSRegionManager *regionManager() const;
-
- uchar* frameBuffer() const;
- int width() const;
- int height() const;
- int depth() const;
- int pixmapDepth() const;
- bool supportsDepth(int) const;
-
- uchar *sharedRam() const;
- int sharedRamSize() const;
-
-#ifndef QT_NO_QWS_PROPERTIES
- void addProperty(int winId, int property);
- void setProperty(int winId, int property, int mode, const QByteArray &data);
- void setProperty(int winId, int property, int mode, const char * data);
- void removeProperty(int winId, int property);
- bool getProperty(int winId, int property, char *&data, int &len);
-#endif // QT_NO_QWS_PROPERTIES
-
- QList<QWSWindowInfo> windowList();
- int windowAt(const QPoint &);
-
- void setIdentity(const QString &appName);
- void nameRegion(int winId, const QString& n, const QString &c);
- void requestRegion(int winId, const QString &surfacekey,
- const QByteArray &surfaceData,
- const QRegion &region);
- void repaintRegion(int winId, int windowFlags, bool opaque, QRegion);
- void moveRegion(int winId, int dx, int dy);
- void destroyRegion(int winId);
- void requestFocus(int winId, bool get);
- void setAltitude(int winId, int altitude, bool fixed = false);
- void setOpacity(int winId, int opacity);
- int takeId();
- void setSelectionOwner(int winId, const QTime &time);
- void convertSelection(int winId, int selectionProperty, const QString &mimeTypes);
- void defineCursor(int id, const QBitmap &curs, const QBitmap &mask,
- int hotX, int hotY);
- void destroyCursor(int id);
- void selectCursor(QWidget *w, unsigned int id);
- void setCursorPosition(int x, int y);
- void grabMouse(QWidget *w, bool grab);
- void grabKeyboard(QWidget *w, bool grab);
- void playSoundFile(const QString&);
- void registerChannel(const QString &channel);
- void sendMessage(const QString &channel, const QString &msg,
- const QByteArray &data);
- void flushCommands();
-#ifndef QT_NO_QWS_INPUTMETHODS
- void sendIMUpdate(int type, int winId, int widgetid);
- void resetIM();
- void sendIMResponse(int winId, int property, const QVariant &result);
- void sendIMMouseEvent(int index, bool isPress);
-#endif
- QWSQCopMessageEvent* waitForQCopResponse();
- void sendFontCommand(int type, const QByteArray &fontName);
-
- void setWindowCaption(QWidget *w, const QString &);
-
- // Lock display for access only by this process
- static bool initLock(const QString &filename, bool create = false);
- static bool grabbed();
- static void grab();
- static void grab(bool write);
- static void ungrab();
-
- static void setTransformation(int transformation, int screenNo = -1);
- static void setRawMouseEventFilter(void (*filter)(QWSMouseEvent *));
-
-private:
- friend int qt_fork_qapplication();
- friend void qt_app_reinit( const QString& newAppName );
- friend class QApplication;
- friend class QCopChannel;
- friend class QWSEmbedWidget;
- friend class QWSEmbedWidgetPrivate;
- class Data;
- friend class Data;
- Data *d;
-
- friend class QWSMemorySurface;
- friend class QWSOnScreenSurface;
- friend class QWSDirectPainterSurface;
- int getPropertyLen;
- char *getPropertyData;
- static QLock *lock;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWSDISPLAY_QWS_H
diff --git a/src/gui/embedded/qwsdisplay_qws_p.h b/src/gui/embedded/qwsdisplay_qws_p.h
deleted file mode 100644
index a217a2af7c..0000000000
--- a/src/gui/embedded/qwsdisplay_qws_p.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSDISPLAY_QWS_P_H
-#define QWSDISPLAY_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwsdisplay_qws.h"
-#include "qwssocket_qws.h"
-#include "qwsevent_qws.h"
-#include <private/qwssharedmemory_p.h>
-#include "qwscommand_qws_p.h"
-#include "qwslock_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWSDisplay::Data
-{
-public:
- Data(QObject* parent, bool singleProcess = false);
- ~Data();
-
- void flush();
-
- bool queueNotEmpty();
- QWSEvent *dequeue();
- QWSEvent *peek();
-
- bool directServerConnection();
- void fillQueue();
-#ifndef QT_NO_QWS_MULTIPROCESS
- void connectToPipe();
- void waitForConnection();
- void waitForPropertyReply();
- void waitForRegionAck(int winId);
- void waitForRegionEvents(int winId, bool ungrabDisplay);
- bool hasPendingRegionEvents() const;
-#endif
- void waitForCreation();
-#ifndef QT_NO_COP
- void waitForQCopResponse();
-#endif
- void init();
- void reinit( const QString& newAppName );
- void create(int n = 1);
-
- void flushCommands();
- void sendCommand(QWSCommand & cmd);
- void sendSynchronousCommand(QWSCommand & cmd);
-
- QWSEvent *readMore();
-
- int takeId();
-
- void setMouseFilter(void (*filter)(QWSMouseEvent*));
-
- //####public data members
-
-// QWSRegionManager *rgnMan;
- uchar *sharedRam;
-#ifndef QT_NO_QWS_MULTIPROCESS
- QWSSharedMemory shm;
-#endif
- int sharedRamSize;
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- static QWSLock *clientLock;
-
- static bool lockClient(QWSLock::LockType, int timeout = -1);
- static void unlockClient(QWSLock::LockType);
- static bool waitClient(QWSLock::LockType, int timeout = -1);
- static QWSLock* getClientLock();
-#endif // QT_NO_QWS_MULTIPROCESS
-
-private:
-#ifndef QT_NO_QWS_MULTIPROCESS
- QWSSocket *csocket;
-#endif
- QList<QWSEvent*> queue;
-
-#if 0
- void debugQueue() {
- for (int i = 0; i < queue.size(); ++i) {
- QWSEvent *e = queue.at(i);
- qDebug( " ev %d type %d sl %d rl %d", i, e->type, e->simpleLen, e->rawLen);
- }
- }
-#endif
-
- QWSConnectedEvent* connected_event;
- QWSMouseEvent* mouse_event;
- int region_events_count;
- int mouse_state;
- int mouse_winid;
- QPoint region_offset;
- int region_offset_window;
-#ifndef QT_NO_COP
- QWSQCopMessageEvent *qcop_response;
-#endif
- QWSEvent* current_event;
- QList<int> unused_identifiers;
-#ifdef QAPPLICATION_EXTRA_DEBUG
- int mouse_event_count;
-#endif
- void (*mouseFilter)(QWSMouseEvent *);
-
- enum { VariableEvent=-1 };
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QWSDISPLAY_QWS_P_H
diff --git a/src/gui/embedded/qwsembedwidget.cpp b/src/gui/embedded/qwsembedwidget.cpp
deleted file mode 100644
index 9005ea4400..0000000000
--- a/src/gui/embedded/qwsembedwidget.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwsembedwidget.h"
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-
-#include <qwsdisplay_qws.h>
-#include <private/qwidget_p.h>
-#include <private/qwsdisplay_qws_p.h>
-#include <private/qwscommand_qws_p.h>
-
-QT_BEGIN_NAMESPACE
-
-// TODO:
-// Must remove window decorations from the embedded window
-// Focus In/Out, Keyboard/Mouse...
-//
-// BUG: what if my parent change parent?
-
-class QWSEmbedWidgetPrivate : public QWidgetPrivate
-{
- Q_DECLARE_PUBLIC(QWSEmbedWidget);
-
-public:
- QWSEmbedWidgetPrivate(int winId);
- void updateWindow();
- void resize(const QSize &size);
-
- QWidget *window;
- WId windowId;
- WId embeddedId;
-};
-
-QWSEmbedWidgetPrivate::QWSEmbedWidgetPrivate(int winId)
- : window(0), windowId(0), embeddedId(winId)
-{
-}
-
-void QWSEmbedWidgetPrivate::updateWindow()
-{
- Q_Q(QWSEmbedWidget);
-
- QWidget *win = q->window();
- if (win == window)
- return;
-
- if (window) {
- window->removeEventFilter(q);
- QWSEmbedCommand command;
- command.setData(windowId, embeddedId, QWSEmbedEvent::StopEmbed);
- QWSDisplay::instance()->d->sendCommand(command);
- }
-
- window = win;
- if (!window)
- return;
- windowId = window->winId();
-
- QWSEmbedCommand command;
- command.setData(windowId, embeddedId, QWSEmbedEvent::StartEmbed);
- QWSDisplay::instance()->d->sendCommand(command);
- window->installEventFilter(q);
- q->installEventFilter(q);
-}
-
-void QWSEmbedWidgetPrivate::resize(const QSize &size)
-{
- if (!window)
- return;
-
- Q_Q(QWSEmbedWidget);
-
- QWSEmbedCommand command;
- command.setData(windowId, embeddedId, QWSEmbedEvent::Region,
- QRect(q->mapToGlobal(QPoint(0, 0)), size));
- QWSDisplay::instance()->d->sendCommand(command);
-}
-
-/*!
- \class QWSEmbedWidget
- \since 4.2
- \ingroup qws
- \ingroup advanced
-
- \brief The QWSEmbedWidget class enables embedded top-level widgets
- in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QWSEmbedWidget inherits QWidget and acts as any other widget, but
- in addition it is capable of embedding another top-level widget.
-
- An example of use is when painting directly onto the screen using
- the QDirectPainter class. Then the reserved region can be embedded
- into an instance of the QWSEmbedWidget class, providing for
- example event handling and size policies for the reserved region.
-
- All that is required to embed a top-level widget is its window ID.
-
- \sa {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- Constructs a widget with the given \a parent, embedding the widget
- identified by the given window \a id.
-*/
-QWSEmbedWidget::QWSEmbedWidget(WId id, QWidget *parent)
- : QWidget(*new QWSEmbedWidgetPrivate(id), parent, 0)
-{
- Q_D(QWSEmbedWidget);
- d->updateWindow();
-}
-
-/*!
- Destroys this widget.
-*/
-QWSEmbedWidget::~QWSEmbedWidget()
-{
- Q_D(QWSEmbedWidget);
- if (!d->window)
- return;
-
- QWSEmbedCommand command;
- command.setData(d->windowId, d->embeddedId, QWSEmbedEvent::StopEmbed);
- QWSDisplay::instance()->d->sendCommand(command);
-}
-
-/*!
- \reimp
-*/
-bool QWSEmbedWidget::eventFilter(QObject *object, QEvent *event)
-{
- Q_D(QWSEmbedWidget);
- if (object == d->window && event->type() == QEvent::Move)
- resizeEvent(0);
- else if (object == this && event->type() == QEvent::Hide)
- d->resize(QSize());
- return QWidget::eventFilter(object, event);
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::changeEvent(QEvent *event)
-{
- Q_D(QWSEmbedWidget);
- if (event->type() == QEvent::ParentChange)
- d->updateWindow();
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::resizeEvent(QResizeEvent*)
-{
- Q_D(QWSEmbedWidget);
- d->resize(rect().size());
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::moveEvent(QMoveEvent*)
-{
- resizeEvent(0);
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::hideEvent(QHideEvent*)
-{
- Q_D(QWSEmbedWidget);
- d->resize(QSize());
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::showEvent(QShowEvent*)
-{
- Q_D(QWSEmbedWidget);
- d->resize(rect().size());
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWSEMBEDWIDGET
diff --git a/src/gui/embedded/qwsevent_qws.cpp b/src/gui/embedded/qwsevent_qws.cpp
deleted file mode 100644
index bcecafed40..0000000000
--- a/src/gui/embedded/qwsevent_qws.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwsevent_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-QWSEvent *QWSEvent::factory(int type)
-{
- QWSEvent *event = 0;
- switch (type) {
- case QWSEvent::Connected:
- event = new QWSConnectedEvent;
- break;
- case QWSEvent::MaxWindowRect:
- event = new QWSMaxWindowRectEvent;
- break;
- case QWSEvent::Mouse:
- event = new QWSMouseEvent;
- break;
- case QWSEvent::Focus:
- event = new QWSFocusEvent;
- break;
- case QWSEvent::Key:
- event = new QWSKeyEvent;
- break;
- case QWSEvent::Region:
- event = new QWSRegionEvent;
- break;
- case QWSEvent::Creation:
- event = new QWSCreationEvent;
- break;
-#ifndef QT_NO_QWS_PROPERTIES
- case QWSEvent::PropertyNotify:
- event = new QWSPropertyNotifyEvent;
- break;
- case QWSEvent::PropertyReply:
- event = new QWSPropertyReplyEvent;
- break;
-#endif // QT_NO_QWS_PROPERTIES
- case QWSEvent::SelectionClear:
- event = new QWSSelectionClearEvent;
- break;
- case QWSEvent::SelectionRequest:
- event = new QWSSelectionRequestEvent;
- break;
- case QWSEvent::SelectionNotify:
- event = new QWSSelectionNotifyEvent;
- break;
-#ifndef QT_NO_COP
- case QWSEvent::QCopMessage:
- event = new QWSQCopMessageEvent;
- break;
-#endif
- case QWSEvent::WindowOperation:
- event = new QWSWindowOperationEvent;
- break;
-
-#ifndef QT_NO_QWS_INPUTMETHODS
- case QWSEvent::IMEvent:
- event = new QWSIMEvent;
- break;
- case QWSEvent::IMQuery:
- event = new QWSIMQueryEvent;
- break;
- case QWSEvent::IMInit:
- event = new QWSIMInitEvent;
- break;
-#endif
-#ifndef QT_NO_QWSEMBEDWIDGET
- case QWSEvent::Embed:
- event = new QWSEmbedEvent;
- break;
-#endif
- case QWSEvent::Font:
- event = new QWSFontEvent;
- break;
- case QWSEvent::ScreenTransformation:
- event = new QWSScreenTransformationEvent;
- break;
- default:
- qCritical("QWSEvent::factory() : Unknown event type %08x!", type);
- }
- return event;
-}
-
-/*!
- \class QWSEvent
- \ingroup qws
-
- \brief The QWSEvent class encapsulates an event in Qt for Embedded Linux.
-
- When running a \l{Qt for Embedded Linux} application, it either runs as a
- server or connects to an existing server. All system generated
- events are passed to the server application which then propagates
- the event to the appropriate client.
-
- Whenever the server receives an event, it queries its stack of
- top-level windows to find the window containing the event's
- position. Each window can identify the client application that
- created it, and returns its ID to the server upon
- request. Finally, the server forwards the event, encapsulated by
- an instance of the QWSEvent class, to the appropriate client.
-
- \image qt-embedded-client.png
-
- The server communicates with the client applications over the UNIX
- domain socket. You can retrieve direct access to all the events a
- client receives from the server, by reimplementing QApplication's
- \l {QApplication::}{qwsEventFilter()} function.
-
- QWSEvent provides the \l Type enum specifying the origin of the
- event. Internally, each type is represented by a QWSEvent
- subclass, e.g., \c QWSKeyEvent.
-
- \sa QWSServer, QWSClient, {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- \enum QWSEvent::Type
-
- This enum describes the origin of the event.
-
- \value NoEvent No event has occurred.
- \value Connected An application has connected to the server.
- \value Mouse A mouse button is pressed or released, or the mouse cursor is moved.
- See also \l{Qt for Embedded Linux Pointer Handling}.
- \value Focus A window has lost or received focus.
- \value Key A key is pressed or released. See also \l{Qt for Embedded Linux Character Input}.
- \value Region A region has changed.
- \value Creation The server has created an ID, typically for a window.
- \value PropertyNotify A property has changed.
- \value PropertyReply The server is responding to a request for a property's value.
- \value SelectionClear A selection is deleted.
- \value SelectionRequest The server has queried for a selection.
- \value SelectionNotify A new selection has been created.
- \value MaxWindowRect The server has changed the maximum window for an application.
- \value QCopMessage A new Qt Cop message has appeared. See also QCopChannel
- \value WindowOperation A window operation, e.g. resizing, has occurred.
- \value IMEvent An input method has been used to enter text for languages with
- non-Latin alphabets. See also QWSInputMethod.
- \value IMQuery An input method query for a specified property has occurred.
- See also QWSInputMethod.
- \value NEvent The number of events has changed.
- \value Embed An event used internally to implement embedded windows. See also
- QWSEmbedWidget.
- \value ScreenTransformation An event used internally to notify the client processes
- that the screen has changed for example, rotation, etc.
- \omitvalue Font
- \omitvalue IMInit
-*/
-
-/*!
- \fn QWSMouseEvent *QWSEvent::asMouse()
- \internal
-*/
-
-/*!
- \fn int QWSEvent::window()
- \internal
-*/
-
-/*!
- \fn int QWSEvent::window() const
- \internal
-*/
-
-/*!
- \fn QWSEvent *QWSEvent::factory(int type)
- \internal
-*/
-
-/*!
- \fn QWSEvent::QWSEvent( int t, int len, char * ptr)
- \internal
-*/
-
-QT_END_NAMESPACE
diff --git a/src/gui/embedded/qwsevent_qws.h b/src/gui/embedded/qwsevent_qws.h
deleted file mode 100644
index f439ee5843..0000000000
--- a/src/gui/embedded/qwsevent_qws.h
+++ /dev/null
@@ -1,459 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSEVENT_QWS_H
-#define QWSEVENT_QWS_H
-
-#include <QtGui/qwsutils_qws.h>
-#include <QtGui/qwsprotocolitem_qws.h>
-#include <QtCore/qrect.h>
-#include <QtGui/qregion.h>
-#include <QtCore/qvector.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-struct QWSMouseEvent;
-
-struct QWSEvent : QWSProtocolItem {
-
- QWSEvent(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {}
-
-
-
- enum Type {
- NoEvent,
- Connected,
- Mouse,
- Focus,
- Key,
- Region,
- Creation,
- PropertyNotify,
- PropertyReply,
- SelectionClear,
- SelectionRequest,
- SelectionNotify,
- MaxWindowRect,
- QCopMessage,
- WindowOperation,
- IMEvent,
- IMQuery,
- IMInit,
- Embed,
- Font,
- ScreenTransformation,
- NEvent
- };
-
- QWSMouseEvent *asMouse()
- { return type == Mouse ? reinterpret_cast<QWSMouseEvent*>(this) : 0; }
- int window() { return *(reinterpret_cast<int*>(simpleDataPtr)); }
- int window() const { return *(reinterpret_cast<int*>(simpleDataPtr)); }
- static QWSEvent *factory(int type);
-};
-
-
-//All events must start with windowID
-
-struct QWSConnectedEvent : QWSEvent {
- QWSConnectedEvent()
- : QWSEvent(QWSEvent::Connected, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- display = reinterpret_cast<char*>(rawDataPtr);
- }
-
- struct SimpleData {
- int window;
- int len;
- int clientId;
- int servershmid;
- } simpleData;
-
- char *display;
-};
-
-struct QWSMaxWindowRectEvent : QWSEvent {
- QWSMaxWindowRectEvent()
- : QWSEvent(MaxWindowRect, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { }
- struct SimpleData {
- int window;
- QRect rect;
- } simpleData;
-};
-
-struct QWSMouseEvent : QWSEvent {
- QWSMouseEvent()
- : QWSEvent(QWSEvent::Mouse, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
- struct SimpleData {
- int window;
- int x_root, y_root, state, delta;
- int time; // milliseconds
- } simpleData;
-};
-
-struct QWSFocusEvent : QWSEvent {
- QWSFocusEvent()
- : QWSEvent(QWSEvent::Focus, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
- { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
- struct SimpleData {
- int window;
- uint get_focus:1;
- } simpleData;
-};
-
-struct QWSKeyEvent: QWSEvent {
- QWSKeyEvent()
- : QWSEvent(QWSEvent::Key, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
- struct SimpleData {
- int window;
- uint keycode;
- Qt::KeyboardModifiers modifiers;
- ushort unicode;
- uint is_press:1;
- uint is_auto_repeat:1;
- } simpleData;
-};
-
-
-struct QWSCreationEvent : QWSEvent {
- QWSCreationEvent()
- : QWSEvent(QWSEvent::Creation, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
- struct SimpleData {
- int objectid;
- int count;
- } simpleData;
-};
-
-#ifndef QT_NO_QWS_PROPERTIES
-struct QWSPropertyNotifyEvent : QWSEvent {
- QWSPropertyNotifyEvent()
- : QWSEvent(QWSEvent::PropertyNotify, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
- enum State {
- PropertyNewValue,
- PropertyDeleted
- };
- struct SimpleData {
- int window;
- int property;
- int state;
- } simpleData;
-};
-#endif
-
-struct QWSSelectionClearEvent : QWSEvent {
- QWSSelectionClearEvent()
- : QWSEvent(QWSEvent::SelectionClear, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
- struct SimpleData {
- int window;
- } simpleData;
-};
-
-struct QWSSelectionRequestEvent : QWSEvent {
- QWSSelectionRequestEvent()
- : QWSEvent(QWSEvent::SelectionRequest, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
- struct SimpleData {
- int window;
- int requestor; // window which wants the selection
- int property; // property on requestor into which the selection should be stored, normally QWSProperty::PropSelection
- int mimeTypes; // Value is stored in the property mimeType on the requestor window. This value may contain
- // multiple mimeTypes separated by ;; where the order reflects the priority
- } simpleData;
-};
-
-struct QWSSelectionNotifyEvent : QWSEvent {
- QWSSelectionNotifyEvent()
- : QWSEvent(QWSEvent::SelectionNotify, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
- struct SimpleData {
- int window;
- int requestor; // the window which wanted the selection and to which this event is sent
- int property; // property of requestor in which the data of the selection is stored
- int mimeType; // a property on the requestor in which the mime type in which the selection is, is stored
- } simpleData;
-};
-
-//complex events:
-
-struct QWSRegionEvent : QWSEvent {
- QWSRegionEvent()
- : QWSEvent(QWSEvent::Region, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData))
- { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- rectangles = reinterpret_cast<QRect*>(rawDataPtr);
- }
-
- void setData(int winId, const QRegion &region, uint type) {
- const QVector<QRect> rects = region.rects();
- setData(reinterpret_cast<const char*>(rects.constData()),
- rects.size() * sizeof(QRect));
- simpleData.window = winId;
- simpleData.nrectangles = rects.size();
- simpleData.type = type;
-#ifdef QT_QWS_CLIENTBLIT
- simpleData.id = 0;
-#endif
- }
-
- enum Type {Allocation
-#ifdef QT_QWS_CLIENTBLIT
- , DirectPaint
-#endif
- };
- struct SimpleData {
- int window;
- int nrectangles;
-#ifdef QT_QWS_CLIENTBLIT
- int id;
-#endif
- uint type:8;
- } simpleData;
-
- QRect *rectangles;
-};
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-struct QWSEmbedEvent : QWSEvent
-{
- QWSEmbedEvent() : QWSEvent(QWSEvent::Embed, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData))
- {}
-
- enum Type { StartEmbed = 1, StopEmbed = 2, Region = 4 };
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- region.setRects(reinterpret_cast<const QRect *>(rawDataPtr),
- simpleData.nrectangles);
- }
-
- void setData(int winId, Type type, const QRegion &reg = QRegion()) {
- simpleData.window = winId;
- simpleData.nrectangles = reg.rects().size();
- simpleData.type = type;
- region = reg;
- const QVector<QRect> rects = reg.rects();
- QWSEvent::setData(reinterpret_cast<const char*>(rects.data()),
- rects.size() * sizeof(QRect));
- }
-
- struct SimpleData {
- int window;
- int nrectangles;
- Type type;
- } simpleData;
-
- QRegion region;
-};
-#endif // QT_NO_QWSEMBEDWIDGET
-
-#ifndef QT_NO_QWS_PROPERTIES
-struct QWSPropertyReplyEvent : QWSEvent {
- QWSPropertyReplyEvent()
- : QWSEvent(QWSEvent::PropertyReply, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- data = reinterpret_cast<char*>(rawDataPtr);
- }
-
- struct SimpleData {
- int window;
- int property;
- int len;
- } simpleData;
- char *data;
-};
-#endif //QT_NO_QWS_PROPERTIES
-
-#ifndef QT_NO_COP
-struct QWSQCopMessageEvent : QWSEvent {
- QWSQCopMessageEvent()
- : QWSEvent(QWSEvent::QCopMessage, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData))
- { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- char* p = rawDataPtr;
- channel = QByteArray(p, simpleData.lchannel);
- p += simpleData.lchannel;
- message = QByteArray(p, simpleData.lmessage);
- p += simpleData.lmessage;
- data = QByteArray(p, simpleData.ldata);
- }
-
- void setDataDirect(const char *d, int len) {
- QWSEvent::setData(d, len, false);
- deleteRaw = true;
- }
-
- struct SimpleData {
- bool is_response;
- int lchannel;
- int lmessage;
- int ldata;
- } simpleData;
-
- QByteArray channel;
- QByteArray message;
- QByteArray data;
-};
-
-#endif
-
-struct QWSWindowOperationEvent : QWSEvent {
- QWSWindowOperationEvent()
- : QWSEvent(WindowOperation, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { }
-
- enum Operation { Show, Hide, ShowMaximized, ShowNormal, ShowMinimized, Close };
- struct SimpleData {
- int window;
- Operation op;
- } simpleData;
-};
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-
-struct QWSIMEvent : QWSEvent {
- QWSIMEvent()
- : QWSEvent(IMEvent, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
- { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
-
- struct SimpleData {
- int window;
- int replaceFrom;
- int replaceLength;
- } simpleData;
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- streamingData = QByteArray::fromRawData(rawDataPtr, len);
- }
- QByteArray streamingData;
-};
-
-
-struct QWSIMInitEvent : QWSEvent {
- QWSIMInitEvent()
- : QWSEvent(IMInit, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
- { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
-
- struct SimpleData {
- int window;
- int existence;
- } simpleData;
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- streamingData = QByteArray::fromRawData(rawDataPtr, len);
- }
- QByteArray streamingData;
-};
-
-
-struct QWSIMQueryEvent : QWSEvent {
- QWSIMQueryEvent()
- : QWSEvent(QWSEvent::IMQuery, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int window;
- int property;
- } simpleData;
-
-};
-
-#endif
-
-struct QWSFontEvent : QWSEvent {
- QWSFontEvent()
- : QWSEvent(QWSEvent::Font, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- enum EventType {
- FontRemoved
- };
-
- void setData(const char *d, int len, bool allocateMem = true) {
- QWSEvent::setData(d, len, allocateMem);
- fontName = QByteArray::fromRawData(rawDataPtr, len);
- }
-
- struct SimpleData {
- uchar type;
- } simpleData;
- QByteArray fontName;
-};
-
-struct QWSScreenTransformationEvent : QWSEvent {
- QWSScreenTransformationEvent()
- : QWSEvent(QWSEvent::ScreenTransformation, sizeof(simpleData),
- reinterpret_cast<char*>(&simpleData)) {}
-
- struct SimpleData {
- int screen;
- int transformation;
- } simpleData;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWSEVENT_QWS_H
diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp
deleted file mode 100644
index 324d81362d..0000000000
--- a/src/gui/embedded/qwslock.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwslock_p.h"
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-#include "qwssignalhandler_p.h"
-
-#include <qglobal.h>
-#include <qdebug.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <sys/time.h>
-#include <time.h>
-#ifdef Q_OS_LINUX
-#include <linux/version.h>
-#endif
-#include <unistd.h>
-
-#include <private/qcore_unix_p.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef QT_NO_SEMAPHORE
-#error QWSLock currently requires semaphores
-#endif
-
-QWSLock::QWSLock()
-{
- semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666);
-
- if (semId == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to create semaphore");
- }
- QWSSignalHandler::instance()->addSemaphore(semId);
-
- qt_semun semval;
- semval.val = 1;
-
- if (semctl(semId, BackingStore, SETVAL, semval) == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to initialize backingstore semaphore");
- }
- lockCount[BackingStore] = 0;
-
- if (semctl(semId, Communication, SETVAL, semval) == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to initialize communication semaphore");
- }
- lockCount[Communication] = 0;
-
- semval.val = 0;
- if (semctl(semId, RegionEvent, SETVAL, semval) == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to initialize region event semaphore");
- }
-}
-
-QWSLock::QWSLock(int id)
-{
- semId = id;
- QWSSignalHandler::instance()->addSemaphore(semId);
- lockCount[0] = lockCount[1] = 0;
-}
-
-QWSLock::~QWSLock()
-{
- if (semId == -1)
- return;
- QWSSignalHandler::instance()->removeSemaphore(semId);
-}
-
-static bool forceLock(int semId, int semNum, int)
-{
- int ret;
- do {
- sembuf sops = { semNum, -1, 0 };
-
- // As the BackingStore lock is a mutex, and only one process may own
- // the lock, it's safe to use SEM_UNDO. On the other hand, the
- // Communication lock is locked by the client but unlocked by the
- // server and therefore can't use SEM_UNDO.
- if (semNum == QWSLock::BackingStore)
- sops.sem_flg |= SEM_UNDO;
-
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::lock: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return (ret != -1);
-}
-
-static bool up(int semId, int semNum)
-{
- int ret;
- do {
- sembuf sops = { semNum, 1, 0 };
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::up: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return (ret != -1);
-}
-
-static bool down(int semId, int semNum)
-{
- int ret;
- do {
- sembuf sops = { semNum, -1, 0 };
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::down: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return (ret != -1);
-}
-
-static int getValue(int semId, int semNum)
-{
- int ret;
- do {
- ret = semctl(semId, semNum, GETVAL, 0);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::getValue: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return ret;
-}
-
-bool QWSLock::lock(LockType type, int timeout)
-{
- if (type == RegionEvent)
- return up(semId, RegionEvent);
-
- if (hasLock(type)) {
- ++lockCount[type];
- return true;
- }
-
- if (!forceLock(semId, type, timeout))
- return false;
- ++lockCount[type];
- return true;
-}
-
-bool QWSLock::hasLock(LockType type)
-{
- if (type == RegionEvent)
- return (getValue(semId, RegionEvent) == 0);
-
- return (lockCount[type] > 0);
-}
-
-void QWSLock::unlock(LockType type)
-{
- if (type == RegionEvent) {
- down(semId, RegionEvent);
- return;
- }
-
- if (hasLock(type)) {
- --lockCount[type];
- if (hasLock(type))
- return;
- }
-
- const int semNum = type;
- int ret;
- do {
- sembuf sops = {semNum, 1, 0};
- if (semNum == QWSLock::BackingStore)
- sops.sem_flg |= SEM_UNDO;
-
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::unlock: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-}
-
-bool QWSLock::wait(LockType type, int timeout)
-{
- bool ok = forceLock(semId, type, timeout);
- if (ok)
- unlock(type);
- return ok;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MULTIPROCESS
diff --git a/src/gui/embedded/qwslock_p.h b/src/gui/embedded/qwslock_p.h
deleted file mode 100644
index 397053776a..0000000000
--- a/src/gui/embedded/qwslock_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSLOCK_P_H
-#define QWSLOCK_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. This header file may
-// change from version to version without notice, or even be
-// removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-class QWSLock
-{
-public:
- enum LockType { BackingStore, Communication, RegionEvent };
-
- QWSLock();
- QWSLock(int lockId);
- ~QWSLock();
-
- bool lock(LockType type, int timeout = -1);
- void unlock(LockType type);
- bool wait(LockType type, int timeout = -1);
- bool hasLock(LockType type);
- int id() const { return semId; }
-
-private:
- int semId;
- int lockCount[2];
-};
-
-
-QT_END_NAMESPACE
-#endif // QT_NO_QWS_MULTIPROCESS
-#endif // QWSLOCK_P_H
diff --git a/src/gui/embedded/qwsmanager_p.h b/src/gui/embedded/qwsmanager_p.h
deleted file mode 100644
index e5db3ef4b2..0000000000
--- a/src/gui/embedded/qwsmanager_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSMANAGER_P_H
-#define QWSMANAGER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtGui/qregion.h"
-#include "QtGui/qdecoration_qws.h"
-
-#ifndef QT_NO_QWS_MANAGER
-
-#include "QtCore/qhash.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWidget;
-class QMenu;
-
-class QWSManagerPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QWSManager)
-public:
- QWSManagerPrivate();
-
- int activeRegion;
- QWidget *managed;
- QMenu *popup;
-
- enum MenuAction {
- NormalizeAction,
- TitleAction,
- BottomRightAction,
- MinimizeAction,
- MaximizeAction,
- CloseAction,
- LastMenuAction
- };
- QAction *menuActions[LastMenuAction];
-
- static QWidget *active;
- static QPoint mousePos;
-
- // Region caching to avoid getting a regiontype's
- // QRegion for each mouse move event
- int previousRegionType;
- bool previousRegionRepainted; // Hover/Press handled
- bool entireDecorationNeedsRepaint;
- struct RegionCaching {
- int regionType;
- QRegion region;
- Qt::WindowFlags windowFlags;
- QRect windowGeometry;
- } cached_region;
-
- bool newCachedRegion(const QPoint &pos);
- int cachedRegionAt()
- { return cached_region.regionType; }
-
- void dirtyRegion(int decorationRegion,
- QDecoration::DecorationState state,
- const QRegion &clip = QRegion());
- void clearDirtyRegions();
-
- QList<int> dirtyRegions;
- QList<QDecoration::DecorationState> dirtyStates;
- QRegion dirtyClip;
-};
-
-#endif // QT_NO_QWS_MANAGER
-
-QT_END_NAMESPACE
-
-#endif // QWSMANAGER_P_H
diff --git a/src/gui/embedded/qwsmanager_qws.cpp b/src/gui/embedded/qwsmanager_qws.cpp
deleted file mode 100644
index 5b5695264b..0000000000
--- a/src/gui/embedded/qwsmanager_qws.cpp
+++ /dev/null
@@ -1,537 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwsmanager_qws.h"
-
-#ifndef QT_NO_QWS_MANAGER
-
-#include "qdrawutil.h"
-#include "qapplication.h"
-#include "qstyle.h"
-#include "qwidget.h"
-#include "qmenu.h"
-#include "qpainter.h"
-#include "private/qpainter_p.h"
-#include "qregion.h"
-#include "qevent.h"
-#include "qcursor.h"
-#include "qwsdisplay_qws.h"
-#include "qdesktopwidget.h"
-
-#include <private/qapplication_p.h>
-#include <private/qwidget_p.h>
-#include <private/qbackingstore_p.h>
-#include <private/qwindowsurface_qws_p.h>
-#include "qdecorationfactory_qws.h"
-
-#include "qlayout.h"
-
-#include "qwsmanager_p.h"
-
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-QWidget *QWSManagerPrivate::active = 0;
-QPoint QWSManagerPrivate::mousePos;
-
-
-QWSManagerPrivate::QWSManagerPrivate()
- : QObjectPrivate(), activeRegion(QDecoration::None), managed(0), popup(0),
- previousRegionType(0), previousRegionRepainted(false), entireDecorationNeedsRepaint(false)
-{
- cached_region.regionType = 0;
-}
-
-QRegion &QWSManager::cachedRegion()
-{
- return d_func()->cached_region.region;
-}
-
-/*!
- \class QWSManager
- \ingroup qws
- \internal
-*/
-
-/*!
-
-*/
-QWSManager::QWSManager(QWidget *w)
- : QObject(*new QWSManagerPrivate, (QObject*)0)
-{
- d_func()->managed = w;
-
-}
-
-QWSManager::~QWSManager()
-{
- Q_D(QWSManager);
-#ifndef QT_NO_MENU
- if (d->popup)
- delete d->popup;
-#endif
- if (d->managed == QWSManagerPrivate::active)
- QWSManagerPrivate::active = 0;
-}
-
-QWidget *QWSManager::widget()
-{
- Q_D(QWSManager);
- return d->managed;
-}
-
-QWidget *QWSManager::grabbedMouse()
-{
- return QWSManagerPrivate::active;
-}
-
-QRegion QWSManager::region()
-{
- Q_D(QWSManager);
- return QApplication::qwsDecoration().region(d->managed, d->managed->geometry());
-}
-
-bool QWSManager::event(QEvent *e)
-{
- if (QObject::event(e))
- return true;
-
- switch (e->type()) {
- case QEvent::MouseMove:
- mouseMoveEvent((QMouseEvent*)e);
- break;
-
- case QEvent::MouseButtonPress:
- mousePressEvent((QMouseEvent*)e);
- break;
-
- case QEvent::MouseButtonRelease:
- mouseReleaseEvent((QMouseEvent*)e);
- break;
-
- case QEvent::MouseButtonDblClick:
- mouseDoubleClickEvent((QMouseEvent*)e);
- break;
-
- case QEvent::Paint:
- paintEvent((QPaintEvent*)e);
- break;
-
- default:
- return false;
- break;
- }
-
- return true;
-}
-
-void QWSManager::mousePressEvent(QMouseEvent *e)
-{
- Q_D(QWSManager);
- d->mousePos = e->globalPos();
- d->activeRegion = QApplication::qwsDecoration().regionAt(d->managed, d->mousePos);
- if(d->cached_region.regionType)
- d->previousRegionRepainted |= repaintRegion(d->cached_region.regionType, QDecoration::Pressed);
-
- if (d->activeRegion == QDecoration::Menu) {
- QPoint pos = (QApplication::layoutDirection() == Qt::LeftToRight
- ? d->managed->geometry().topLeft()
- : d->managed->geometry().topRight());
- menu(pos);
- }
- if (d->activeRegion != QDecoration::None &&
- d->activeRegion != QDecoration::Menu) {
- d->active = d->managed;
- d->managed->grabMouse();
- }
- if (d->activeRegion != QDecoration::None &&
- d->activeRegion != QDecoration::Close &&
- d->activeRegion != QDecoration::Minimize &&
- d->activeRegion != QDecoration::Menu) {
- d->managed->raise();
- }
-
- if (e->button() == Qt::RightButton) {
- menu(e->globalPos());
- }
-}
-
-void QWSManager::mouseReleaseEvent(QMouseEvent *e)
-{
- Q_D(QWSManager);
- d->managed->releaseMouse();
- if (d->cached_region.regionType && d->previousRegionRepainted && QApplication::mouseButtons() == 0) {
- bool doesHover = repaintRegion(d->cached_region.regionType, QDecoration::Hover);
- if (!doesHover) {
- repaintRegion(d->cached_region.regionType, QDecoration::Normal);
- d->previousRegionRepainted = false;
- }
- }
-
- if (e->button() == Qt::LeftButton) {
- //handleMove();
- int itm = QApplication::qwsDecoration().regionAt(d->managed, e->globalPos());
- int activatedItem = d->activeRegion;
- d->activeRegion = QDecoration::None;
- d->active = 0;
- if (activatedItem == itm)
- QApplication::qwsDecoration().regionClicked(d->managed, itm);
- } else if (d->activeRegion == QDecoration::None) {
- d->active = 0;
- }
-}
-
-void QWSManager::mouseDoubleClickEvent(QMouseEvent *e)
-{
- Q_D(QWSManager);
- if (e->button() == Qt::LeftButton)
- QApplication::qwsDecoration().regionDoubleClicked(d->managed,
- QApplication::qwsDecoration().regionAt(d->managed, e->globalPos()));
-}
-
-static inline Qt::CursorShape regionToShape(int region)
-{
- if (region == QDecoration::None)
- return Qt::ArrowCursor;
-
- static const struct {
- int region;
- Qt::CursorShape shape;
- } r2s[] = {
- { QDecoration::TopLeft, Qt::SizeFDiagCursor },
- { QDecoration::Top, Qt::SizeVerCursor},
- { QDecoration::TopRight, Qt::SizeBDiagCursor},
- { QDecoration::Left, Qt::SizeHorCursor},
- { QDecoration::Right, Qt::SizeHorCursor},
- { QDecoration::BottomLeft, Qt::SizeBDiagCursor},
- { QDecoration::Bottom, Qt::SizeVerCursor},
- { QDecoration::BottomRight, Qt::SizeFDiagCursor},
- { QDecoration::None, Qt::ArrowCursor}
- };
-
- int i = 0;
- while (region != r2s[i].region && r2s[i].region)
- ++i;
- return r2s[i].shape;
-}
-
-void QWSManager::mouseMoveEvent(QMouseEvent *e)
-{
- Q_D(QWSManager);
- if (d->newCachedRegion(e->globalPos())) {
- if(d->previousRegionType && d->previousRegionRepainted)
- repaintRegion(d->previousRegionType, QDecoration::Normal);
- if(d->cached_region.regionType) {
- d->previousRegionRepainted = repaintRegion(d->cached_region.regionType, QDecoration::Hover);
- }
- }
-
-
-#ifndef QT_NO_CURSOR
- if (d->managed->minimumSize() != d->managed->maximumSize()) {
- QWSDisplay *qwsd = QApplication::desktop()->qwsDisplay();
- qwsd->selectCursor(d->managed, regionToShape(d->cachedRegionAt()));
- }
-#endif //QT_NO_CURSOR
-
- if (d->activeRegion)
- handleMove(e->globalPos());
-}
-
-void QWSManager::handleMove(QPoint g)
-{
- Q_D(QWSManager);
-
- // don't allow dragging to where the user probably cannot click!
- QApplicationPrivate *ap = QApplicationPrivate::instance();
- const QRect maxWindowRect = ap->maxWindowRect(qt_screen);
- if (maxWindowRect.isValid()) {
- if (g.x() < maxWindowRect.x())
- g.setX(maxWindowRect.x());
- if (g.y() < maxWindowRect.y())
- g.setY(maxWindowRect.y());
- if (g.x() > maxWindowRect.right())
- g.setX(maxWindowRect.right());
- if (g.y() > maxWindowRect.bottom())
- g.setY(maxWindowRect.bottom());
- }
-
- if (g == d->mousePos)
- return;
-
- if ( d->managed->isMaximized() )
- return;
-
- int x = d->managed->geometry().x();
- int y = d->managed->geometry().y();
- int w = d->managed->width();
- int h = d->managed->height();
-
- QRect geom(d->managed->geometry());
-
- QPoint delta = g - d->mousePos;
- d->mousePos = g;
-
- if (d->activeRegion == QDecoration::Title) {
- geom = QRect(x + delta.x(), y + delta.y(), w, h);
- } else {
- bool keepTop = true;
- bool keepLeft = true;
- switch (d->activeRegion) {
- case QDecoration::Top:
- geom.setTop(geom.top() + delta.y());
- keepTop = false;
- break;
- case QDecoration::Bottom:
- geom.setBottom(geom.bottom() + delta.y());
- keepTop = true;
- break;
- case QDecoration::Left:
- geom.setLeft(geom.left() + delta.x());
- keepLeft = false;
- break;
- case QDecoration::Right:
- geom.setRight(geom.right() + delta.x());
- keepLeft = true;
- break;
- case QDecoration::TopRight:
- geom.setTopRight(geom.topRight() + delta);
- keepLeft = true;
- keepTop = false;
- break;
- case QDecoration::TopLeft:
- geom.setTopLeft(geom.topLeft() + delta);
- keepLeft = false;
- keepTop = false;
- break;
- case QDecoration::BottomLeft:
- geom.setBottomLeft(geom.bottomLeft() + delta);
- keepLeft = false;
- keepTop = true;
- break;
- case QDecoration::BottomRight:
- geom.setBottomRight(geom.bottomRight() + delta);
- keepLeft = true;
- keepTop = true;
- break;
- default:
- return;
- }
-
- QSize newSize = QLayout::closestAcceptableSize(d->managed, geom.size());
-
- int dx = newSize.width() - geom.width();
- int dy = newSize.height() - geom.height();
-
- if (keepTop) {
- geom.setBottom(geom.bottom() + dy);
- d->mousePos.ry() += dy;
- } else {
- geom.setTop(geom.top() - dy);
- d->mousePos.ry() -= dy;
- }
- if (keepLeft) {
- geom.setRight(geom.right() + dx);
- d->mousePos.rx() += dx;
- } else {
- geom.setLeft(geom.left() - dx);
- d->mousePos.rx() -= dx;
- }
- }
- if (geom != d->managed->geometry()) {
- QApplication::sendPostedEvents();
- d->managed->setGeometry(geom);
- }
-}
-
-void QWSManager::paintEvent(QPaintEvent *)
-{
- Q_D(QWSManager);
- d->dirtyRegion(QDecoration::All, QDecoration::Normal);
-}
-
-void QWSManagerPrivate::dirtyRegion(int decorationRegion,
- QDecoration::DecorationState state,
- const QRegion &clip)
-{
- QTLWExtra *topextra = managed->d_func()->extra->topextra;
- QWidgetBackingStore *bs = topextra->backingStore.data();
- const bool pendingUpdateRequest = bs->isDirty();
-
- if (decorationRegion == QDecoration::All) {
- if (clip.isEmpty())
- entireDecorationNeedsRepaint = true;
- dirtyRegions.clear();
- dirtyStates.clear();
- }
- int i = dirtyRegions.indexOf(decorationRegion);
- if (i >= 0) {
- dirtyRegions.removeAt(i);
- dirtyStates.removeAt(i);
- }
-
- dirtyRegions.append(decorationRegion);
- dirtyStates.append(state);
- if (!entireDecorationNeedsRepaint)
- dirtyClip += clip;
-
- if (!pendingUpdateRequest)
- QApplication::postEvent(managed, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority);
-}
-
-void QWSManagerPrivate::clearDirtyRegions()
-{
- dirtyRegions.clear();
- dirtyStates.clear();
- dirtyClip = QRegion();
- entireDecorationNeedsRepaint = false;
-}
-
-bool QWSManager::repaintRegion(int decorationRegion, QDecoration::DecorationState state)
-{
- Q_D(QWSManager);
-
- d->dirtyRegion(decorationRegion, state);
- return true;
-}
-
-void QWSManager::menu(const QPoint &pos)
-{
-#ifdef QT_NO_MENU
- Q_UNUSED(pos);
-#else
- Q_D(QWSManager);
- if (d->popup)
- delete d->popup;
-
- // Basic window operation menu
- d->popup = new QMenu();
- QApplication::qwsDecoration().buildSysMenu(d->managed, d->popup);
- connect(d->popup, SIGNAL(triggered(QAction*)), SLOT(menuTriggered(QAction*)));
-
- d->popup->popup(pos);
- d->activeRegion = QDecoration::None;
-#endif // QT_NO_MENU
-}
-
-void QWSManager::menuTriggered(QAction *action)
-{
-#ifdef QT_NO_MENU
- Q_UNUSED(action);
-#else
- Q_D(QWSManager);
- QApplication::qwsDecoration().menuTriggered(d->managed, action);
- d->popup->deleteLater();
- d->popup = 0;
-#endif
-}
-
-void QWSManager::startMove()
-{
- Q_D(QWSManager);
- d->mousePos = QCursor::pos();
- d->activeRegion = QDecoration::Title;
- d->active = d->managed;
- d->managed->grabMouse();
-}
-
-void QWSManager::startResize()
-{
- Q_D(QWSManager);
- d->activeRegion = QDecoration::BottomRight;
- d->active = d->managed;
- d->managed->grabMouse();
-}
-
-void QWSManager::maximize()
-{
- Q_D(QWSManager);
- // find out how much space the decoration needs
- const int screen = QApplication::desktop()->screenNumber(d->managed);
- const QRect desk = QApplication::desktop()->availableGeometry(screen);
- QRect dummy(0, 0, 1, 1);
- QRect nr;
- QRegion r = QApplication::qwsDecoration().region(d->managed, dummy);
- if (r.isEmpty()) {
- nr = desk;
- } else {
- r += dummy; // make sure we get the full window region in case of 0 width borders
- QRect rect = r.boundingRect();
- nr = QRect(desk.x()-rect.x(), desk.y()-rect.y(),
- desk.width() - (rect.width()==1 ? 0 : rect.width()-1), // ==1 -> dummy
- desk.height() - (rect.height()==1 ? 0 : rect.height()-1));
- }
- d->managed->setGeometry(nr);
-}
-
-bool QWSManagerPrivate::newCachedRegion(const QPoint &pos)
-{
- // Check if anything has changed that would affect the region caching
- if (managed->windowFlags() == cached_region.windowFlags
- && managed->geometry() == cached_region.windowGeometry
- && cached_region.region.contains(pos))
- return false;
-
- // Update the cached region
- int reg = QApplication::qwsDecoration().regionAt(managed, pos);
- if (QWidget::mouseGrabber())
- reg = QDecoration::None;
-
- previousRegionType = cached_region.regionType;
- cached_region.regionType = reg;
- cached_region.region = QApplication::qwsDecoration().region(managed, managed->geometry(),
- reg);
- // Make room for borders around the widget, even if the decoration doesn't have a frame.
- if (reg && !(reg & int(QDecoration::Borders))) {
- cached_region.region -= QApplication::qwsDecoration().region(managed, managed->geometry(), QDecoration::Borders);
- }
- cached_region.windowFlags = managed->windowFlags();
- cached_region.windowGeometry = managed->geometry();
-// QRect rec = cached_region.region.boundingRect();
-// qDebug("Updated cached region: 0x%04x (%d, %d) (%d, %d, %d, %d)",
-// reg, pos.x(), pos.y(), rec.x(), rec.y(), rec.right(), rec.bottom());
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_QWS_MANAGER
diff --git a/src/gui/embedded/qwsmanager_qws.h b/src/gui/embedded/qwsmanager_qws.h
deleted file mode 100644
index 5a33bfd038..0000000000
--- a/src/gui/embedded/qwsmanager_qws.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSMANAGER_QWS_H
-#define QWSMANAGER_QWS_H
-
-#include <QtGui/qpixmap.h>
-#include <QtCore/qobject.h>
-#include <QtGui/qdecoration_qws.h>
-#include <QtGui/qevent.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MANAGER
-
-class QAction;
-class QPixmap;
-class QWidget;
-class QPopupMenu;
-class QRegion;
-class QMouseEvent;
-class QWSManagerPrivate;
-
-class Q_GUI_EXPORT QWSManager : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWSManager)
-public:
- explicit QWSManager(QWidget *);
- ~QWSManager();
-
- static QDecoration *newDefaultDecoration();
-
- QWidget *widget();
- static QWidget *grabbedMouse();
- void maximize();
- void startMove();
- void startResize();
-
- QRegion region();
- QRegion &cachedRegion();
-
-protected Q_SLOTS:
- void menuTriggered(QAction *action);
-
-protected:
- void handleMove(QPoint g);
-
- virtual bool event(QEvent *e);
- virtual void mouseMoveEvent(QMouseEvent *);
- virtual void mousePressEvent(QMouseEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void mouseDoubleClickEvent(QMouseEvent *);
- virtual void paintEvent(QPaintEvent *);
- bool repaintRegion(int region, QDecoration::DecorationState state);
-
- void menu(const QPoint &);
-
-private:
- friend class QWidget;
- friend class QETWidget;
- friend class QWidgetPrivate;
- friend class QApplication;
- friend class QApplicationPrivate;
- friend class QWidgetBackingStore;
- friend class QWSWindowSurface;
- friend class QGLDrawable;
-};
-
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <QtGui/qdecorationdefault_qws.h>
-QT_END_INCLUDE_NAMESPACE
-
-#endif // QT_NO_QWS_MANAGER
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWSMANAGER_QWS_H
diff --git a/src/gui/embedded/qwsproperty_qws.cpp b/src/gui/embedded/qwsproperty_qws.cpp
deleted file mode 100644
index b5ce4c52be..0000000000
--- a/src/gui/embedded/qwsproperty_qws.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwsproperty_qws.h"
-
-#ifndef QT_NO_QWS_PROPERTIES
-#include "qwscommand_qws_p.h"
-#include "qwindowsystem_qws.h"
-#include "qhash.h"
-#include "qalgorithms.h"
-#include "qbytearray.h"
-
-#include <stdio.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSPropertyManager::Data {
-public:
- QByteArray find(int winId, int property)
- {
- return properties.value(winId).value(property);
- }
-
- typedef QHash<int, QHash<int, QByteArray> > PropertyHash;
- PropertyHash properties;
-};
-
-/*********************************************************************
- *
- * Class: QWSPropertyManager
- *
- *********************************************************************/
-
-QWSPropertyManager::QWSPropertyManager()
-{
- d = new Data;
-}
-
-QWSPropertyManager::~QWSPropertyManager()
-{
- delete d;
-}
-
-bool QWSPropertyManager::setProperty(int winId, int property, int mode, const char *data, int len)
-{
- QHash<int, QByteArray> props = d->properties.value(winId);
- QHash<int, QByteArray>::iterator it = props.find(property);
- if (it == props.end())
- return false;
-
- switch (mode) {
- case PropReplace:
- d->properties[winId][property] = QByteArray(data, len);
- break;
- case PropAppend:
- d->properties[winId][property].append(data);
- break;
- case PropPrepend:
- d->properties[winId][property].prepend(data);
- break;
- }
- return true;
-}
-
-bool QWSPropertyManager::hasProperty(int winId, int property)
-{
- return d->properties.value(winId).contains(property);
-}
-
-bool QWSPropertyManager::removeProperty(int winId, int property)
-{
- QWSPropertyManager::Data::PropertyHash::iterator it = d->properties.find(winId);
- if (it == d->properties.end())
- return false;
- return d->properties[winId].remove( property );
-}
-
-bool QWSPropertyManager::addProperty(int winId, int property)
-{
- if( !d->properties[winId].contains(property) )
- d->properties[winId][property] = QByteArray(); // only add if it doesn't exist
- return true;
-}
-
-bool QWSPropertyManager::getProperty(int winId, int property, const char *&data, int &len)
-{
- QHash<int, QByteArray> props = d->properties.value(winId);
- QHash<int, QByteArray>::iterator it = props.find(property);
- if (it == props.end()) {
- data = 0;
- len = -1;
- return false;
- }
- data = it.value().constData();
- len = it.value().length();
-
- return true;
-}
-
-bool QWSPropertyManager::removeProperties(int winId)
-{
- return d->properties.remove(winId);
-}
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_QWS_PROPERTIES
diff --git a/src/gui/embedded/qwsproperty_qws.h b/src/gui/embedded/qwsproperty_qws.h
deleted file mode 100644
index 4a779e0905..0000000000
--- a/src/gui/embedded/qwsproperty_qws.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSPROPERTY_QWS_H
-#define QWSPROPERTY_QWS_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-/*********************************************************************
- *
- * Class: QWSPropertyManager
- *
- *********************************************************************/
-
-#ifndef QT_NO_QWS_PROPERTIES
-
-class QWSPropertyManager
-{
-public:
- enum Mode {
- PropReplace = 0,
- PropPrepend,
- PropAppend
- };
-
- // pre-defined properties
- enum Atom {
- PropSelection = 0
- };
-
- QWSPropertyManager();
- ~QWSPropertyManager();
-
- bool setProperty(int winId, int property, int mode, const char *data, int len);
- bool hasProperty(int winId, int property);
- bool removeProperty(int winId, int property);
- bool addProperty(int winId, int property);
- bool getProperty(int winId, int property, const char *&data, int &len);
- bool removeProperties(int winId);
-
-private:
- class Data;
- Data* d;
-};
-
-#endif // QT_NO_QWS_PROPERTIES
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWSPROPERTY_QWS_H
diff --git a/src/gui/embedded/qwsprotocolitem_qws.h b/src/gui/embedded/qwsprotocolitem_qws.h
deleted file mode 100644
index 0afd4c2a02..0000000000
--- a/src/gui/embedded/qwsprotocolitem_qws.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSPROTOCOLITEM_QWS_H
-#define QWSPROTOCOLITEM_QWS_H
-
-/*********************************************************************
- *
- * QWSCommand base class - only use derived classes from that
- *
- *********************************************************************/
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QIODevice;
-
-struct QWSProtocolItem
-{
- // ctor - dtor
- QWSProtocolItem(int t, int len, char *ptr) : type(t),
- simpleLen(len), rawLen(-1), deleteRaw(false), simpleDataPtr(ptr),
- rawDataPtr(0), bytesRead(0) { }
- virtual ~QWSProtocolItem();
-
- // data
- int type;
- int simpleLen;
- int rawLen;
- bool deleteRaw;
-
- // functions
-#ifndef QT_NO_QWS_MULTIPROCESS
- void write(QIODevice *s);
- bool read(QIODevice *s);
-#endif
- void copyFrom(const QWSProtocolItem *item);
-
- virtual void setData(const char *data, int len, bool allocateMem = true);
-
- char *simpleDataPtr;
- char *rawDataPtr;
- // temp variables
- int bytesRead;
-};
-
-// This should probably be a method on QWSProtocolItem, but this way avoids
-// changing the API of this apparently public header
-// size = (int)type + (int)rawLenSize + simpleLen + rawLen
-#define QWS_PROTOCOL_ITEM_SIZE( item ) \
- (2 * sizeof(int)) + ((item).simpleDataPtr ? (item).simpleLen : 0) + ((item).rawDataPtr ? (item).rawLen : 0)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWSPROTOCOLITEM_QWS_H
diff --git a/src/gui/embedded/qwssharedmemory.cpp b/src/gui/embedded/qwssharedmemory.cpp
deleted file mode 100644
index 07c46254bd..0000000000
--- a/src/gui/embedded/qwssharedmemory.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwssharedmemory_p.h"
-
-#if !defined(QT_NO_QWS_MULTIPROCESS)
-
-#include <sys/shm.h>
-
-QT_BEGIN_NAMESPACE
-
-QWSSharedMemory::QWSSharedMemory()
- : shmBase(0), shmSize(0), character(0), shmId(-1), key(-1)
-{
-}
-
-
-QWSSharedMemory::~QWSSharedMemory()
-{
- detach();
-}
-
-/*
- man page says:
- On Linux, it is possible to attach a shared memory segment even if it
- is already marked to be deleted. However, POSIX.1-2001 does not spec-
- ify this behaviour and many other implementations do not support it.
-*/
-
-bool QWSSharedMemory::create(int size)
-{
- if (shmId != -1)
- detach();
- shmId = shmget(IPC_PRIVATE, size, IPC_CREAT|0600);
-
- if (shmId == -1) {
-#ifdef QT_SHM_DEBUG
- perror("QWSSharedMemory::create allocating shared memory");
- qWarning("Error allocating shared memory of size %d", size);
-#endif
- return false;
- }
- shmBase = shmat(shmId,0,0);
- shmctl(shmId, IPC_RMID, 0);
- if (shmBase == (void*)-1) {
-#ifdef QT_SHM_DEBUG
- perror("QWSSharedMemory::create attaching to shared memory");
- qWarning("Error attaching to shared memory id %d", shmId);
-#endif
- shmBase = 0;
- return false;
- }
- return true;
-}
-
-bool QWSSharedMemory::attach(int id)
-{
- if (shmId == id)
- return id != -1;
- if (shmId != -1)
- detach();
-
- shmBase = shmat(id,0,0);
- if (shmBase == (void*)-1) {
-#ifdef QT_SHM_DEBUG
- perror("QWSSharedMemory::attach attaching to shared memory");
- qWarning("Error attaching to shared memory 0x%x of size %d",
- id, size());
-#endif
- shmBase = 0;
- return false;
- }
- shmId = id;
- return true;
-}
-
-
-void QWSSharedMemory::detach ()
-{
- if (!shmBase)
- return;
- shmdt (shmBase);
- shmBase = 0;
- shmSize = 0;
- shmId = -1;
-}
-
-void QWSSharedMemory::setPermissions (mode_t mode)
-{
- struct shmid_ds shm;
- shmctl (shmId, IPC_STAT, &shm);
- shm.shm_perm.mode = mode;
- shmctl (shmId, IPC_SET, &shm);
-}
-
-int QWSSharedMemory::size () const
-{
- struct shmid_ds shm;
- shmctl (shmId, IPC_STAT, &shm);
- return shm.shm_segsz;
-}
-
-
-// old API
-
-
-
-QWSSharedMemory::QWSSharedMemory (int size, const QString &filename, char c)
-{
- shmSize = size;
- shmFile = filename;
- shmBase = 0;
- shmId = -1;
- character = c;
- key = ftok (shmFile.toLatin1().constData(), c);
-}
-
-
-
-bool QWSSharedMemory::create ()
-{
- shmId = shmget (key, shmSize, IPC_CREAT | 0666);
- return (shmId != -1);
-}
-
-void QWSSharedMemory::destroy ()
-{
- if (shmId != -1)
- shmctl(shmId, IPC_RMID, 0);
-}
-
-bool QWSSharedMemory::attach ()
-{
- if (shmId == -1)
- shmId = shmget (key, shmSize, 0);
-
- shmBase = shmat (shmId, 0, 0);
- if ((long)shmBase == -1)
- shmBase = 0;
-
- return (long)shmBase != 0;
-}
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MULTIPROCESS
diff --git a/src/gui/embedded/qwssharedmemory_p.h b/src/gui/embedded/qwssharedmemory_p.h
deleted file mode 100644
index 591d92a012..0000000000
--- a/src/gui/embedded/qwssharedmemory_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSSHAREDMEMORY_P_H
-#define QWSSHAREDMEMORY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qplatformdefs.h"
-#include "QtCore/qstring.h"
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(QT_NO_QWS_MULTIPROCESS)
-
-class QWSSharedMemory {
-public:
-
- QWSSharedMemory();
- ~QWSSharedMemory();
-
- void setPermissions(mode_t mode);
- int size() const;
- void *address() { return shmBase; }
-
- int id() const { return shmId; }
-
- void detach();
-
- bool create(int size);
- bool attach(int id);
-
- //bool create(int size, const QString &filename, char c = 'Q');
- //bool attach(const QString &filename, char c = 'Q');
-// old API
-
- QWSSharedMemory(int, const QString &, char c = 'Q');
- void * base() { return address(); }
-
- bool create();
- void destroy();
-
- bool attach();
-
-private:
- void *shmBase;
- int shmSize;
- QString shmFile;
- char character;
- int shmId;
- key_t key;
-};
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
-QT_END_NAMESPACE
-
-#endif // QWSSHAREDMEMORY_P_H
diff --git a/src/gui/embedded/qwssignalhandler.cpp b/src/gui/embedded/qwssignalhandler.cpp
deleted file mode 100644
index cc18bebdfb..0000000000
--- a/src/gui/embedded/qwssignalhandler.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwssignalhandler_p.h"
-
-#ifndef QT_NO_QWS_SIGNALHANDLER
-
-#include <sys/types.h>
-#ifndef QT_NO_QWS_MULTIPROCESS
-# include <sys/ipc.h>
-# include <sys/sem.h>
-
-# include <private/qcore_unix_p.h>
-#endif
-#include <signal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSSignalHandlerPrivate : public QWSSignalHandler
-{
-public:
- QWSSignalHandlerPrivate() : QWSSignalHandler() {}
-};
-
-
-Q_GLOBAL_STATIC(QWSSignalHandlerPrivate, signalHandlerInstance);
-
-
-QWSSignalHandler* QWSSignalHandler::instance()
-{
- return signalHandlerInstance();
-}
-
-QWSSignalHandler::QWSSignalHandler()
-{
- const int signums[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE,
- SIGSEGV, SIGTERM, SIGBUS };
- const int n = sizeof(signums)/sizeof(int);
-
- for (int i = 0; i < n; ++i) {
- const int signum = signums[i];
- qt_sighandler_t old = signal(signum, handleSignal);
- if (old == SIG_IGN) // don't remove shm and semaphores when ignored
- signal(signum, old);
- else
- oldHandlers[signum] = (old == SIG_ERR ? SIG_DFL : old);
- }
-}
-
-QWSSignalHandler::~QWSSignalHandler()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- while (!semaphores.isEmpty())
- removeSemaphore(semaphores.last());
-#endif
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSSignalHandler::removeSemaphore(int semno)
-{
- const int index = semaphores.lastIndexOf(semno);
- if (index != -1) {
- qt_semun semval;
- semval.val = 0;
- semctl(semaphores.at(index), 0, IPC_RMID, semval);
- semaphores.remove(index);
- }
-}
-#endif // QT_NO_QWS_MULTIPROCESS
-
-void QWSSignalHandler::handleSignal(int signum)
-{
- QWSSignalHandler *h = instance();
-
- signal(signum, h->oldHandlers[signum]);
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- qt_semun semval;
- semval.val = 0;
- for (int i = 0; i < h->semaphores.size(); ++i)
- semctl(h->semaphores.at(i), 0, IPC_RMID, semval);
-#endif
-
- h->objects.clear();
- raise(signum);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_QWS_NO_SIGNALHANDLER
diff --git a/src/gui/embedded/qwssignalhandler_p.h b/src/gui/embedded/qwssignalhandler_p.h
deleted file mode 100644
index e933d06b6a..0000000000
--- a/src/gui/embedded/qwssignalhandler_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSSIGNALHANDLER_P_H
-#define QWSSIGNALHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_QWS_SIGNALHANDLER
-
-#include <QtCore/qmap.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qobjectcleanuphandler.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef void (*qt_sighandler_t)(int);
-
-class QWSSignalHandlerPrivate;
-
-class Q_GUI_EXPORT QWSSignalHandler
-{
-public:
- static QWSSignalHandler* instance();
-
- ~QWSSignalHandler();
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- inline void addSemaphore(int semno) { semaphores.append(semno); }
- void removeSemaphore(int semno);
-#endif
- inline void addObject(QObject *object) { (void)objects.add(object); }
-
-private:
- QWSSignalHandler();
- static void handleSignal(int signal);
- QMap<int, qt_sighandler_t> oldHandlers;
-#ifndef QT_NO_QWS_MULTIPROCESS
- QVector<int> semaphores;
-#endif
- QObjectCleanupHandler objects;
-
- friend class QWSSignalHandlerPrivate;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_SIGNALHANDLER
-
-#endif // QWSSIGNALHANDLER_P_H
diff --git a/src/gui/embedded/qwssocket_qws.cpp b/src/gui/embedded/qwssocket_qws.cpp
deleted file mode 100644
index 463af6c336..0000000000
--- a/src/gui/embedded/qwssocket_qws.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-#include "qwssocket_qws.h"
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-#include <fcntl.h>
-#include <netdb.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/un.h>
-
-#ifdef __MIPSEL__
-# ifndef SOCK_DGRAM
-# define SOCK_DGRAM 1
-# endif
-# ifndef SOCK_STREAM
-# define SOCK_STREAM 2
-# endif
-#endif
-
-#if defined(Q_OS_SOLARIS) || defined (QT_LINUXBASE)
-// uff-da apparently Solaris doesn't have the SUN_LEN macro, here is
-// an implementation of it...
-# ifndef SUN_LEN
-# define SUN_LEN(su) \
- sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)
-# endif
-
-// nor the POSIX names of UNIX domain sockets *sigh*
-# ifndef AF_LOCAL
-# define AF_LOCAL AF_UNIX
-# endif
-# ifndef PF_LOCAL
-# define PF_LOCAL PF_UNIX
-# endif
-#endif // Q_OS_SOLARIS || QT_LINUXBASE
-
-QT_BEGIN_NAMESPACE
-
-/***********************************************************************
- *
- * QWSSocket
- *
- **********************************************************************/
-QWSSocket::QWSSocket(QObject *parent)
- : QWS_SOCK_BASE(parent)
-{
-#ifndef QT_NO_SXE
- QObject::connect( this, SIGNAL(stateChanged(SocketState)),
- this, SLOT(forwardStateChange(SocketState)));
-#endif
-}
-
-QWSSocket::~QWSSocket()
-{
-}
-
-#ifndef QT_NO_SXE
-QString QWSSocket::errorString()
-{
- switch (QUnixSocket::error()) {
- case NoError:
- return QString();
- case InvalidPath:
- case NonexistentPath:
- return QLatin1String("Bad path"); // NO_TR
- default:
- return QLatin1String("Bad socket"); // NO TR
- }
-}
-
-void QWSSocket::forwardStateChange(QUnixSocket::SocketState st )
-{
- switch ( st )
- {
- case ConnectedState:
- emit connected();
- break;
- case ClosingState:
- break;
- case UnconnectedState:
- emit disconnected();
- break;
- default:
- // nothing
- break;
- }
- if ( QUnixSocket::error() != NoError )
- emit error((QAbstractSocket::SocketError)0);
-}
-#endif
-
-bool QWSSocket::connectToLocalFile(const QString &file)
-{
-#ifndef QT_NO_SXE
- bool result = QUnixSocket::connect( file.toLocal8Bit() );
- if ( !result )
- {
- perror( "QWSSocketAuth::connectToLocalFile could not connect:" );
- emit error(QAbstractSocket::ConnectionRefusedError);
- return false;
- }
- return true;
-#else
- // create socket
- int s = ::socket(PF_LOCAL, SOCK_STREAM, 0);
-
- // connect to socket
- struct sockaddr_un a;
- memset(&a, 0, sizeof(a));
- a.sun_family = PF_LOCAL;
- strncpy(a.sun_path, file.toLocal8Bit().constData(), sizeof(a.sun_path) - 1);
- int r = ::connect(s, (struct sockaddr*)&a, SUN_LEN(&a));
- if (r == 0) {
- setSocketDescriptor(s);
- } else {
- perror("QWSSocket::connectToLocalFile could not connect:");
- ::close(s);
- emit error(ConnectionRefusedError);
- return false;
- }
-#endif
- return true;
-}
-
-
-/***********************************************************************
- *
- * QWSServerSocket
- *
- **********************************************************************/
-QWSServerSocket::QWSServerSocket(const QString& file, QObject *parent)
-#ifndef QT_NO_SXE
- : QUnixSocketServer(parent)
-#else
- : QTcpServer(parent)
-#endif
-{
- init(file);
-}
-
-void QWSServerSocket::init(const QString &file)
-{
-#ifndef QT_NO_SXE
- QByteArray fn = file.toLocal8Bit();
- bool result = QUnixSocketServer::listen( fn );
- if ( !result )
- {
- QUnixSocketServer::ServerError err = serverError();
- switch ( err )
- {
- case InvalidPath:
- qWarning("QWSServerSocket:: invalid path %s", qPrintable(file));
- break;
- case ResourceError:
- case BindError:
- case ListenError:
- qWarning("QWSServerSocket:: could not listen on path %s", qPrintable(file));
- break;
- default:
- break;
- }
- }
-#else
- int backlog = 16; //#####
-
-// create socket
- int s = ::socket(PF_LOCAL, SOCK_STREAM, 0);
- if (s == -1) {
- perror("QWSServerSocket::init");
- qWarning("QWSServerSocket: unable to create socket.");
- return;
- }
-
- QByteArray fn = file.toLocal8Bit();
- unlink(fn.constData()); // doesn't have to succeed
-
- // bind socket
- struct sockaddr_un a;
- memset(&a, 0, sizeof(a));
- a.sun_family = PF_LOCAL;
- strncpy(a.sun_path, fn.constData(), sizeof(a.sun_path) - 1);
- int r = ::bind(s, (struct sockaddr*)&a, SUN_LEN(&a));
- if (r < 0) {
- perror("QWSServerSocket::init");
- qWarning("QWSServerSocket: could not bind to file %s", fn.constData());
- ::close(s);
- return;
- }
-
- if (chmod(fn.constData(), 0600) < 0) {
- perror("QWSServerSocket::init");
- qWarning("Could not set permissions of %s", fn.constData());
- ::close(s);
- return;
- }
-
- // listen
- if (::listen(s, backlog) == 0) {
- if (!setSocketDescriptor(s))
- qWarning( "QWSServerSocket could not set descriptor %d : %s", s, errorString().toLatin1().constData());
- } else {
- perror("QWSServerSocket::init");
- qWarning("QWSServerSocket: could not listen to file %s", fn.constData());
- ::close(s);
- }
-#endif
-}
-
-QWSServerSocket::~QWSServerSocket()
-{
-}
-
-#ifndef QT_NO_SXE
-
-void QWSServerSocket::incomingConnection(int socketDescriptor)
-{
- inboundConnections.append( socketDescriptor );
- emit newConnection();
-}
-
-
-QWSSocket *QWSServerSocket::nextPendingConnection()
-{
- QMutexLocker locker( &ssmx );
- if ( inboundConnections.count() == 0 )
- return 0;
- QWSSocket *s = new QWSSocket();
- s->setSocketDescriptor( inboundConnections.takeFirst() );
- return s;
-}
-
-#endif // QT_NO_SXE
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_QWS_MULTIPROCESS
diff --git a/src/gui/embedded/qwssocket_qws.h b/src/gui/embedded/qwssocket_qws.h
deleted file mode 100644
index 4f90564bdb..0000000000
--- a/src/gui/embedded/qwssocket_qws.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSSOCKET_QWS_H
-#define QWSSOCKET_QWS_H
-
-#include <QtCore/qconfig.h>
-#include <QtGui/qwsutils_qws.h>
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-#ifndef QT_NO_SXE
-#include <QtCore/qmutex.h>
-#include <QtGui/private/qunixsocketserver_p.h>
-#include <QtGui/private/qunixsocket_p.h>
-#else
-#include <QtNetwork/qtcpsocket.h>
-#include <QtNetwork/qtcpserver.h>
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-
-class QWSSocket : public QWS_SOCK_BASE
-{
- Q_OBJECT
-public:
- explicit QWSSocket(QObject *parent=0);
- ~QWSSocket();
-
- bool connectToLocalFile(const QString &file);
-
-#ifndef QT_NO_SXE
- QString errorString();
-Q_SIGNALS:
- void connected();
- void disconnected();
- void error(QAbstractSocket::SocketError);
-private Q_SLOTS:
- void forwardStateChange(SocketState);
-#endif
-
-private:
- Q_DISABLE_COPY(QWSSocket)
-};
-
-
-class QWSServerSocket : public QWS_SOCK_SERVER_BASE
-{
- Q_OBJECT
-public:
- QWSServerSocket(const QString& file, QObject *parent=0);
- ~QWSServerSocket();
-
-#ifndef QT_NO_SXE
- QWSSocket *nextPendingConnection();
-Q_SIGNALS:
- void newConnection();
-protected:
- void incomingConnection(int socketDescriptor);
-private:
- QMutex ssmx;
- QList<int> inboundConnections;
-#endif
-
-private:
- Q_DISABLE_COPY(QWSServerSocket)
-
- void init(const QString &file);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
-#endif // QWSSOCKET_QWS_H
diff --git a/src/gui/embedded/qwsutils_qws.h b/src/gui/embedded/qwsutils_qws.h
deleted file mode 100644
index c1295082fd..0000000000
--- a/src/gui/embedded/qwsutils_qws.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSUTILS_QWS_H
-#define QWSUTILS_QWS_H
-
-#include <QtCore/QIODevice>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_SXE
-#define QWS_SOCK_BASE QUnixSocket
-#define QWS_SOCK_SERVER_BASE QUnixSocketServer
-class QUnixSocket;
-class QUnixSocketServer;
-#else
-#define QWS_SOCK_BASE QTcpSocket
-#define QWS_SOCK_SERVER_BASE QTcpServer
-class QTcpSocket;
-class QTcpServer;
-#endif
-class QWSSocket;
-class QWSServerSocket;
-
-/********************************************************************
- *
- * Convenient socket functions
- *
- ********************************************************************/
-#ifndef QT_NO_QWS_MULTIPROCESS
-inline int qws_read_uint(QIODevice *socket)
-{
- if (!socket || socket->bytesAvailable() < (int)sizeof(int))
- return -1;
-
- int i;
- socket->read(reinterpret_cast<char*>(&i), sizeof(i));
-
- return i;
-}
-
-inline void qws_write_uint(QIODevice *socket, int i)
-{
- if (!socket)
- return;
-
- socket->write(reinterpret_cast<char*>(&i), sizeof(i));
-}
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWSUTILS_QWS_H
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 072553a05c..379f2745ce 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -9,7 +9,7 @@ DEFINES += QT_BUILD_GUI_LIB QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
-!win32:!embedded:!qpa:!mac:!symbian:CONFIG += x11
+!win32:!qpa:!mac:!symbian:CONFIG += x11
unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
@@ -21,7 +21,6 @@ contains(QT_CONFIG, x11sm):CONFIG += x11sm
x11:include(kernel/x11.pri)
mac:include(kernel/mac.pri)
win32:include(kernel/win.pri)
-embedded:include(embedded/embedded.pri)
symbian {
include(kernel/symbian.pri)
include(s60framework/s60framework.pri)
@@ -47,7 +46,6 @@ include(effects/effects.pri)
include(egl/egl.pri)
win32:!wince*: DEFINES += QT_NO_EGL
-embedded: QT += network
QMAKE_LIBS += $$QMAKE_LIBS_GUI
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 72738c9fa8..e970fb05a1 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -62,9 +62,6 @@ SOURCES += \
win32 {
SOURCES += image/qpixmap_win.cpp
}
-else:embedded {
- SOURCES += image/qpixmap_qws.cpp
-}
else:qpa {
SOURCES += image/qpixmap_qpa.cpp
}
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index 260b397140..6cd8363374 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -44,8 +44,7 @@
#include "qimage.h"
#include "qvariant.h"
#include <qpainter.h>
-#include <private/qgraphicssystem_p.h>
-#include <private/qapplication_p.h>
+#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -205,20 +204,6 @@ QBitmap &QBitmap::operator=(const QPixmap &pixmap)
return *this;
}
-
-#ifdef QT3_SUPPORT
-QBitmap::QBitmap(int w, int h, const uchar *bits, bool isXbitmap)
-{
- *this = fromData(QSize(w, h), bits, isXbitmap ? QImage::Format_MonoLSB : QImage::Format_Mono);
-}
-
-
-QBitmap::QBitmap(const QSize &size, const uchar *bits, bool isXbitmap)
-{
- *this = fromData(size, bits, isXbitmap ? QImage::Format_MonoLSB : QImage::Format_Mono);
-}
-#endif
-
/*!
Destroys the bitmap.
*/
@@ -275,9 +260,7 @@ QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
img.setColor(1, c0);
}
- QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem();
- QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::BitmapType)
- : QGraphicsSystem::createDefaultPixmapData(QPixmapData::BitmapType));
+ QScopedPointer<QPixmapData> data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::BitmapType));
data->fromImage(img, flags | Qt::MonoOnly);
return QPixmap(data.take());
@@ -335,77 +318,4 @@ QBitmap QBitmap::transformed(const QMatrix &matrix) const
return transformed(QTransform(matrix));
}
-#ifdef QT3_SUPPORT
-/*!
- \fn QBitmap QBitmap::xForm(const QMatrix &matrix) const
-
- Returns a copy of this bitmap, transformed according to the given
- \a matrix.
-
- Use transformed() instead.
-*/
-
-/*!
- \fn QBitmap::QBitmap(const QSize &size, bool clear)
-
- Constructs a bitmap with the given \a size. If \a clear is true,
- the bits are initialized to Qt::color0.
-
- Use the corresponding QBitmap() constructor instead, and then call
- the clear() function if the \a clear parameter is true.
-*/
-
-/*!
- \fn QBitmap::QBitmap(int width, int height, bool clear)
-
- Constructs a bitmap with the given \a width and \a height. If \a
- clear is true, the bits are initialized to Qt::color0.
-
- Use the corresponding QBitmap() constructor instead, and then call
- the clear() function if the \a clear parameter is true.
-*/
-
-/*!
- \fn QBitmap::QBitmap(int width, int height, const uchar *bits, bool isXbitmap)
-
- Constructs a bitmap with the given \a width and \a height, and
- sets the contents to the \a bits supplied. The \a isXbitmap flag
- should be true if \a bits was generated by the X11 bitmap
- program.
-
- Use the static fromData() function instead. If \a isXbitmap is
- true, use the default bit order(QImage_FormatMonoLSB) otherwise
- use QImage::Format_Mono.
-
- \omit
- The X bitmap bit order is little endian. The QImage
- documentation discusses bit order of monochrome images. Opposed to
- QImage, the data has to be byte aligned.
-
- Example (creates an arrow bitmap):
- \snippet doc/src/snippets/code/src_gui_image_qbitmap.cpp 0
- \endomit
-*/
-
-
-/*!
- \fn QBitmap::QBitmap(const QSize &size, const uchar *bits, bool isXbitmap)
-
- \overload
-
- Constructs a bitmap with the given \a size, and sets the contents
- to the \a bits supplied. The \a isXbitmap flag should be true if
- \a bits was generated by the X11 bitmap program.
-
- \omit
- The X bitmap bit order is little endian. The QImage documentation
- discusses bit order of monochrome images.
- \endomit
-
- Use the static fromData() function instead. If \a isXbitmap is
- true, use the default bit order(QImage_FormatMonoLSB) otherwise
- use QImage::Format_Mono.
-*/
-#endif
-
QT_END_NAMESPACE
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index f1771e3e43..9dff0816dd 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -74,34 +74,11 @@ public:
QBitmap transformed(const QMatrix &) const;
QBitmap transformed(const QTransform &matrix) const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, bool clear);
- inline QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, bool clear);
- QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, const uchar *bits, bool isXbitmap=false);
- QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, const uchar *bits, bool isXbitmap=false);
- inline QT3_SUPPORT QBitmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); }
- QT3_SUPPORT_CONSTRUCTOR QBitmap(const QImage &image) { *this = fromImage(image); }
- QT3_SUPPORT QBitmap &operator=(const QImage &image) { *this = fromImage(image); return *this; }
-#endif
typedef QExplicitlySharedDataPointer<QPixmapData> DataPtr;
};
Q_DECLARE_SHARED(QBitmap)
-#ifdef QT3_SUPPORT
-inline QBitmap::QBitmap(int w, int h, bool clear)
- : QPixmap(QSize(w, h), 1)
-{
- if (clear) this->clear();
-}
-
-inline QBitmap::QBitmap(const QSize &size, bool clear)
- : QPixmap(size, 1)
-{
- if (clear) this->clear();
-}
-#endif
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 7182062e59..59687c709d 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -45,7 +45,6 @@
#include "qiconengineplugin.h"
#include "private/qfactoryloader_p.h"
#include "private/qiconloader_p.h"
-#include "qapplication.h"
#include "qstyleoption.h"
#include "qpainter.h"
#include "qfileinfo.h"
@@ -55,6 +54,7 @@
#include "qcache.h"
#include "qdebug.h"
#include "private/qguiplatformplugin_p.h"
+#include "qguiapplication.h"
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
@@ -66,7 +66,7 @@
#include "private/qkde_p.h"
#endif
-#include "private/qstylehelper_p.h"
+#include "private/qhexstring_p.h"
#ifndef QT_NO_ICON
QT_BEGIN_NAMESPACE
@@ -263,37 +263,38 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
actualSize.scale(size, Qt::KeepAspectRatio);
- QString key = QLatin1Literal("qt_")
- % HexString<quint64>(pm.cacheKey())
- % HexString<uint>(pe->mode)
- % HexString<quint64>(QApplication::palette().cacheKey())
- % HexString<uint>(actualSize.width())
- % HexString<uint>(actualSize.height());
-
- if (mode == QIcon::Active) {
- if (QPixmapCache::find(key % HexString<uint>(mode), pm))
- return pm; // horray
- if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) {
- QStyleOption opt(0);
- opt.palette = QApplication::palette();
- QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt);
- if (pm.cacheKey() == active.cacheKey())
- return pm;
- }
- }
-
- if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) {
+ // #### Qt5 no idea what this really does, but we need to remove the QApp and style references
+// QString key = QLatin1Literal("qt_")
+// % HexString<quint64>(pm.cacheKey())
+// % HexString<uint>(pe->mode)
+// % HexString<quint64>(QApplication::palette().cacheKey())
+// % HexString<uint>(actualSize.width())
+// % HexString<uint>(actualSize.height());
+
+// if (mode == QIcon::Active) {
+// if (QPixmapCache::find(key % HexString<uint>(mode), pm))
+// return pm; // horray
+// if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) {
+// QStyleOption opt(0);
+// opt.palette = QApplication::palette();
+// QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt);
+// if (pm.cacheKey() == active.cacheKey())
+// return pm;
+// }
+// }
+
+// if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) {
if (pm.size() != actualSize)
pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- if (pe->mode != mode && mode != QIcon::Normal) {
- QStyleOption opt(0);
- opt.palette = QApplication::palette();
- QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt);
- if (!generated.isNull())
- pm = generated;
- }
- QPixmapCache::insert(key % HexString<uint>(mode), pm);
- }
+// if (pe->mode != mode && mode != QIcon::Normal) {
+// QStyleOption opt(0);
+// opt.palette = QApplication::palette();
+// QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt);
+// if (!generated.isNull())
+// pm = generated;
+// }
+// QPixmapCache::insert(key % HexString<uint>(mode), pm);
+// }
return pm;
}
@@ -1150,100 +1151,6 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
#endif //QT_NO_DATASTREAM
-
-#ifdef QT3_SUPPORT
-
-static int widths[2] = { 22, 32 };
-static int heights[2] = { 22, 32 };
-
-static QSize pixmapSizeHelper(QIcon::Size which)
-{
- int i = 0;
- if (which == QIcon::Large)
- i = 1;
- return QSize(widths[i], heights[i]);
-}
-
-/*!
- \enum QIcon::Size
- \compat
-
- \value Small Use QStyle::pixelMetric(QStyle::PM_SmallIconSize) instead.
- \value Large Use QStyle::pixelMetric(QStyle::PM_LargeIconSize) instead.
- \value Automatic N/A.
-*/
-
-/*!
- Use pixmap(QSize(...), \a mode, \a state), where the first
- argument is an appropriate QSize instead of a \l Size value.
-
- \sa pixmapSize()
-*/
-QPixmap QIcon::pixmap(Size size, Mode mode, State state) const
-{ return pixmap(pixmapSizeHelper(size), mode, state); }
-
-/*!
- Use pixmap(QSize(...), mode, \a state), where the first argument
- is an appropriate QSize instead of a \l Size value, and the
- second argument is QIcon::Normal or QIcon::Disabled, depending on
- the value of \a enabled.
-
- \sa pixmapSize()
-*/
-QPixmap QIcon::pixmap(Size size, bool enabled, State state) const
-{ return pixmap(pixmapSizeHelper(size), enabled ? Normal : Disabled, state); }
-
-/*!
- Use one of the other pixmap() overloads.
-*/
-QPixmap QIcon::pixmap() const
-{ return pixmap(pixmapSizeHelper(Small), Normal, Off); }
-
-/*!
- The pixmap() function now takes a QSize instead of a QIcon::Size,
- so there is no need for this function in new code.
-*/
-void QIcon::setPixmapSize(Size which, const QSize &size)
-{
- int i = 0;
- if (which == Large)
- i = 1;
- widths[i] = size.width();
- heights[i] = size.height();
-}
-
-/*!
- Use QStyle::pixelMetric() with QStyle::PM_SmallIconSize or
- QStyle::PM_LargeIconSize as the first argument, depending on \a
- which.
-*/
-QSize QIcon::pixmapSize(Size which)
-{
- return pixmapSizeHelper(which);
-}
-
-/*!
- \fn void QIcon::reset(const QPixmap &pixmap, Size size)
-
- Use the constructor that takes a QPixmap and operator=().
-*/
-
-/*!
- \fn void QIcon::setPixmap(const QPixmap &pixmap, Size size, Mode mode, State state)
-
- Use addPixmap(\a pixmap, \a mode, \a state) instead. The \a size
- parameter is ignored.
-*/
-
-/*!
- \fn void QIcon::setPixmap(const QString &fileName, Size size, Mode mode, State state)
-
- Use addFile(\a fileName, \a mode, \a state) instead. The \a size
- parameter is ignored.
-*/
-
-#endif // QT3_SUPPORT
-
/*!
\fn DataPtr &QIcon::data_ptr()
\internal
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 170559182b..4e3960925e 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -114,21 +114,6 @@ public:
static QString themeName();
static void setThemeName(const QString &path);
-
-#ifdef QT3_SUPPORT
- enum Size { Small, Large, Automatic = Small };
- static QT3_SUPPORT void setPixmapSize(Size which, const QSize &size);
- static QT3_SUPPORT QSize pixmapSize(Size which);
- inline QT3_SUPPORT void reset(const QPixmap &pixmap, Size /*size*/) { *this = QIcon(pixmap); }
- inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap, Size, Mode mode = Normal, State state = Off)
- { addPixmap(pixmap, mode, state); }
- inline QT3_SUPPORT void setPixmap(const QString &fileName, Size, Mode mode = Normal, State state = Off)
- { addPixmap(QPixmap(fileName), mode, state); }
- QT3_SUPPORT QPixmap pixmap(Size size, Mode mode, State state = Off) const;
- QT3_SUPPORT QPixmap pixmap(Size size, bool enabled, State state = Off) const;
- QT3_SUPPORT QPixmap pixmap() const;
-#endif
-
Q_DUMMY_COMPARISON_OPERATOR(QIcon)
private:
@@ -151,10 +136,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
#endif
-#ifdef QT3_SUPPORT
-typedef QIcon QIconSet;
-#endif
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 0a42f0af78..19be636e9c 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -41,7 +41,7 @@
#ifndef QT_NO_ICON
#include <private/qiconloader_p.h>
-#include <private/qapplication_p.h>
+#include <private/qguiapplication_p.h>
#include <private/qicon_p.h>
#include <private/qguiplatformplugin_p.h>
@@ -63,7 +63,7 @@
#include <private/qt_x11_p.h>
#endif
-#include <private/qstylehelper_p.h>
+#include <private/qhexstring_p.h>
QT_BEGIN_NAMESPACE
@@ -489,8 +489,8 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
if (basePixmap.isNull())
basePixmap.load(filename);
+#if 0 // ### Qt5
int actualSize = qMin(size.width(), size.height());
-
QString key = QLatin1Literal("$qt_theme_")
% HexString<qint64>(basePixmap.cacheKey())
% HexString<int>(mode)
@@ -507,6 +507,9 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
QPixmapCache::insert(key, cachedPixmap);
}
return cachedPixmap;
+#else
+ return basePixmap;
+#endif
}
QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 50b372ea63..448e1b4be0 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -124,9 +124,6 @@ QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1);
QImageData::QImageData()
: ref(0), width(0), height(0), depth(0), nbytes(0), data(0),
-#ifdef QT3_SUPPORT
- jumptable(0),
-#endif
format(QImage::Format_ARGB32), bytes_per_line(0),
ser_no(qimage_serial_number.fetchAndAddRelaxed(1)),
detach_no(0),
@@ -220,11 +217,6 @@ QImageData::~QImageData()
delete paintEngine;
if (data && own_data)
free(data);
-#ifdef QT3_SUPPORT
- if (jumptable)
- free(jumptable);
- jumptable = 0;
-#endif
data = 0;
}
@@ -757,27 +749,6 @@ const uchar *qt_get_bitflip_array() // called from QPixma
return bitflip;
}
-#if defined(QT3_SUPPORT)
-static QImage::Format formatFor(int depth, QImage::Endian bitOrder)
-{
- QImage::Format format;
- if (depth == 1) {
- format = bitOrder == QImage::BigEndian ? QImage::Format_Mono : QImage::Format_MonoLSB;
- } else if (depth == 8) {
- format = QImage::Format_Indexed8;
- } else if (depth == 32) {
- format = QImage::Format_RGB32;
- } else if (depth == 24) {
- format = QImage::Format_RGB888;
- } else if (depth == 16) {
- format = QImage::Format_RGB16;
- } else {
- qWarning("QImage: Depth %d not supported", depth);
- format = QImage::Format_Invalid;
- }
- return format;
-}
-#endif
/*!
Constructs a null image.
@@ -991,42 +962,6 @@ QImage::QImage(const QString &fileName, const char *format)
load(fileName, format);
}
-/*!
- Constructs an image and tries to load the image from the file with
- the given \a fileName.
-
- The loader attempts to read the image using the specified \a
- format. If the \a format is not specified (which is the default),
- the loader probes the file for a header to guess the file format.
-
- If the loading of the image failed, this object is a null image.
-
- The file name can either refer to an actual file on disk or to one
- of the application's embedded resources. See the
- \l{resources.html}{Resource System} overview for details on how to
- embed images and other resource files in the application's
- executable.
-
- You can disable this constructor by defining \c
- QT_NO_CAST_FROM_ASCII when you compile your applications. This can
- be useful, for example, if you want to ensure that all
- user-visible strings go through QObject::tr().
-
- \sa QString::fromAscii(), isNull(), {QImage#Reading and Writing
- Image Files}{Reading and Writing Image Files}
-*/
-#ifndef QT_NO_CAST_FROM_ASCII
-QImage::QImage(const char *fileName, const char *format)
- : QPaintDevice()
-{
- // ### Qt 5: if you remove the QImage(const QByteArray &) QT3_SUPPORT
- // constructor, remove this constructor as well. The constructor here
- // exists so that QImage("foo.png") compiles without ambiguity.
- d = 0;
- load(QString::fromAscii(fileName), format);
-}
-#endif
-
#ifndef QT_NO_IMAGEFORMAT_XPM
extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *source, QImage &image);
@@ -1097,178 +1032,6 @@ QImage::QImage(const QImage &image)
}
}
-#ifdef QT3_SUPPORT
-/*!
- \fn QImage::QImage(int width, int height, int depth, int numColors, Endian bitOrder)
-
- Constructs an image with the given \a width, \a height, \a depth,
- \a numColors colors and \a bitOrder.
-
- Use the constructor that accepts a width, a height and a format
- (i.e. specifying the depth and bit order), in combination with the
- setColorCount() function, instead.
-
- \oldcode
- QImage image(width, height, depth, numColors);
- \newcode
- QImage image(width, height, format);
-
- // For 8 bit images the default number of colors is 256. If
- // another number of colors is required it can be specified
- // using the setColorCount() function.
- image.setColorCount(numColors);
- \endcode
-*/
-
-QImage::QImage(int w, int h, int depth, int colorCount, Endian bitOrder)
- : QPaintDevice()
-{
- d = QImageData::create(QSize(w, h), formatFor(depth, bitOrder), colorCount);
-}
-
-/*!
- Constructs an image with the given \a size, \a depth, \a numColors
- and \a bitOrder.
-
- Use the constructor that accepts a size and a format
- (i.e. specifying the depth and bit order), in combination with the
- setColorCount() function, instead.
-
- \oldcode
- QSize mySize(width, height);
- QImage image(mySize, depth, numColors);
- \newcode
- QSize mySize(width, height);
- QImage image(mySize, format);
-
- // For 8 bit images the default number of colors is 256. If
- // another number of colors is required it can be specified
- // using the setColorCount() function.
- image.setColorCount(numColors);
- \endcode
-*/
-QImage::QImage(const QSize& size, int depth, int numColors, Endian bitOrder)
- : QPaintDevice()
-{
- d = QImageData::create(size, formatFor(depth, bitOrder), numColors);
-}
-
-/*!
- \fn QImage::QImage(uchar* data, int width, int height, int depth, const QRgb* colortable, int numColors, Endian bitOrder)
-
- Constructs an image with the given \a width, \a height, depth, \a
- colortable, \a numColors and \a bitOrder, that uses an existing
- memory buffer, \a data.
-
- Use the constructor that accepts a uchar pointer, a width, a
- height and a format (i.e. specifying the depth and bit order), in
- combination with the setColorTable() function, instead.
-
- \oldcode
- uchar *myData;
- QRgb *myColorTable;
-
- QImage image(myData, width, height, depth,
- myColorTable, numColors, IgnoreEndian);
- \newcode
- uchar *myData;
- QVector<QRgb> myColorTable;
-
- QImage image(myData, width, height, format);
- image.setColorTable(myColorTable);
- \endcode
-*/
-QImage::QImage(uchar* data, int w, int h, int depth, const QRgb* colortable, int numColors, Endian bitOrder)
- : QPaintDevice()
-{
- d = 0;
- Format f = formatFor(depth, bitOrder);
- if (f == Format_Invalid)
- return;
-
- const int bytes_per_line = ((w*depth+31)/32)*4; // bytes per scanline
- if (w <= 0 || h <= 0 || numColors < 0 || !data
- || INT_MAX/sizeof(uchar *) < uint(h)
- || INT_MAX/uint(depth) < uint(w)
- || bytes_per_line <= 0
- || INT_MAX/uint(bytes_per_line) < uint(h))
- return; // invalid parameter(s)
- d = new QImageData;
- d->ref.ref();
-
- d->own_data = false;
- d->data = data;
- d->width = w;
- d->height = h;
- d->depth = depth;
- d->format = f;
- if (depth == 32)
- numColors = 0;
-
- d->bytes_per_line = bytes_per_line;
- d->nbytes = d->bytes_per_line * h;
- if (colortable) {
- d->colortable.resize(numColors);
- for (int i = 0; i < numColors; ++i)
- d->colortable[i] = colortable[i];
- } else if (numColors) {
- setColorCount(numColors);
- }
-}
-
-#ifdef Q_WS_QWS
-
-/*!
- \fn QImage::QImage(uchar* data, int width, int height, int depth, int bytesPerLine, const QRgb* colortable, int numColors, Endian bitOrder)
-
- Constructs an image with the given \a width, \a height, \a depth,
- \a bytesPerLine, \a colortable, \a numColors and \a bitOrder, that
- uses an existing memory buffer, \a data. The image does not delete
- the buffer at destruction.
-
- \warning This constructor is only available in Qt for Embedded Linux.
-
- The data has to be 32-bit aligned, and each scanline of data in the image
- must also be 32-bit aligned, so it's no longer possible to specify a custom
- \a bytesPerLine value.
-*/
-QImage::QImage(uchar* data, int w, int h, int depth, int bpl, const QRgb* colortable, int numColors, Endian bitOrder)
- : QPaintDevice()
-{
- d = 0;
- Format f = formatFor(depth, bitOrder);
- if (f == Format_Invalid)
- return;
- if (!data || w <= 0 || h <= 0 || depth <= 0 || numColors < 0
- || INT_MAX/sizeof(uchar *) < uint(h)
- || INT_MAX/uint(depth) < uint(w)
- || bpl <= 0
- || INT_MAX/uint(bpl) < uint(h))
- return; // invalid parameter(s)
-
- d = new QImageData;
- d->ref.ref();
- d->own_data = false;
- d->data = data;
- d->width = w;
- d->height = h;
- d->depth = depth;
- d->format = f;
- if (depth == 32)
- numColors = 0;
- d->bytes_per_line = bpl;
- d->nbytes = d->bytes_per_line * h;
- if (colortable) {
- d->colortable.resize(numColors);
- for (int i = 0; i < numColors; ++i)
- d->colortable[i] = colortable[i];
- } else if (numColors) {
- setColorCount(numColors);
- }
-}
-#endif // Q_WS_QWS
-#endif // QT3_SUPPORT
-
/*!
Destroys the image and cleans up.
*/
@@ -1613,75 +1376,6 @@ int QImage::colorCount() const
return d ? d->colortable.size() : 0;
}
-
-#ifdef QT3_SUPPORT
-/*!
- \fn QImage::Endian QImage::bitOrder() const
-
- Returns the bit order for the image. If it is a 1-bpp image, this
- function returns either QImage::BigEndian or
- QImage::LittleEndian. Otherwise, this function returns
- QImage::IgnoreEndian.
-
- Use the format() function instead for the monochrome formats. For
- non-monochrome formats the bit order is irrelevant.
-*/
-
-/*!
- Returns a pointer to the scanline pointer table. This is the
- beginning of the data block for the image.
- Returns 0 in case of an error.
-
- Use the bits() or scanLine() function instead.
-*/
-uchar **QImage::jumpTable()
-{
- if (!d)
- return 0;
- detach();
-
- // in case detach() ran out of memory..
- if (!d)
- return 0;
-
- if (!d->jumptable) {
- d->jumptable = (uchar **)malloc(d->height*sizeof(uchar *));
- if (!d->jumptable)
- return 0;
- uchar *data = d->data;
- int height = d->height;
- uchar **p = d->jumptable;
- while (height--) {
- *p++ = data;
- data += d->bytes_per_line;
- }
- }
- return d->jumptable;
-}
-
-/*!
- \overload
-*/
-const uchar * const *QImage::jumpTable() const
-{
- if (!d)
- return 0;
- if (!d->jumptable) {
- d->jumptable = (uchar **)malloc(d->height*sizeof(uchar *));
- if (!d->jumptable)
- return 0;
- uchar *data = d->data;
- int height = d->height;
- uchar **p = d->jumptable;
- while (height--) {
- *p++ = data;
- data += d->bytes_per_line;
- }
- }
- return d->jumptable;
-}
-#endif
-
/*!
Sets the color table used to translate color indexes to QRgb
values, to the specified \a colors.
@@ -2223,116 +1917,6 @@ QImage::Format QImage::format() const
}
-#ifdef QT3_SUPPORT
-/*!
- Returns true if alpha buffer mode is enabled; otherwise returns
- false.
-
- Use the hasAlphaChannel() function instead.
-
-*/
-bool QImage::hasAlphaBuffer() const
-{
- if (!d)
- return false;
-
- switch (d->format) {
- case Format_ARGB32:
- case Format_ARGB32_Premultiplied:
- case Format_ARGB8565_Premultiplied:
- case Format_ARGB8555_Premultiplied:
- case Format_ARGB6666_Premultiplied:
- case Format_ARGB4444_Premultiplied:
- return true;
- default:
- return false;
- }
-}
-
-/*!
- Enables alpha buffer mode if \a enable is true, otherwise disables
- it. The alpha buffer is used to set a mask when a QImage is
- translated to a QPixmap.
-
- If a monochrome or indexed 8-bit image has alpha channels in their
- color tables they will automatically detect that they have an
- alpha channel, so this function is not required. To force alpha
- channels on 32-bit images, use the convertToFormat() function.
-*/
-
-void QImage::setAlphaBuffer(bool enable)
-{
- if (!d
- || d->format == Format_Mono
- || d->format == Format_MonoLSB
- || d->format == Format_Indexed8)
- return;
- if (enable && (d->format == Format_ARGB32 ||
- d->format == Format_ARGB32_Premultiplied ||
- d->format == Format_ARGB8565_Premultiplied ||
- d->format == Format_ARGB6666_Premultiplied ||
- d->format == Format_ARGB8555_Premultiplied ||
- d->format == Format_ARGB4444_Premultiplied))
- {
- return;
- }
- if (!enable && (d->format == Format_RGB32 ||
- d->format == Format_RGB555 ||
- d->format == Format_RGB666 ||
- d->format == Format_RGB888 ||
- d->format == Format_RGB444))
- {
- return;
- }
- detach();
- d->format = (enable ? Format_ARGB32 : Format_RGB32);
-}
-
-
-/*!
- \fn bool QImage::create(int width, int height, int depth, int numColors, Endian bitOrder)
-
- Sets the image \a width, \a height, \a depth, its number of colors
- (in \a numColors), and bit order. Returns true if successful, or
- false if the parameters are incorrect or if memory cannot be
- allocated.
-
- The \a width and \a height is limited to 32767. \a depth must be
- 1, 8, or 32. If \a depth is 1, \a bitOrder must be set to
- either QImage::LittleEndian or QImage::BigEndian. For other depths
- \a bitOrder must be QImage::IgnoreEndian.
-
- This function allocates a color table and a buffer for the image
- data. The image data is not initialized. The image buffer is
- allocated as a single block that consists of a table of scanLine()
- pointers (jumpTable()) and the image data (bits()).
-
- Use a QImage constructor instead.
-*/
-bool QImage::create(int width, int height, int depth, int numColors, Endian bitOrder)
-{
- if (d && !d->ref.deref())
- delete d;
- d = QImageData::create(QSize(width, height), formatFor(depth, bitOrder), numColors);
- return true;
-}
-
-/*!
- \fn bool QImage::create(const QSize& size, int depth, int numColors, Endian bitOrder)
- \overload
-
- The width and height are specified in the \a size argument.
-
- Use a QImage constructor instead.
-*/
-bool QImage::create(const QSize& size, int depth, int numColors, QImage::Endian bitOrder)
-{
- if (d && !d->ref.deref())
- delete d;
- d = QImageData::create(size, formatFor(depth, bitOrder), numColors);
- return true;
-}
-#endif // QT3_SUPPORT
/*****************************************************************************
Internal routines for converting image depth.
@@ -4022,30 +3606,6 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q
return image;
}
-#ifdef QT3_SUPPORT
-/*!
- Converts the depth (bpp) of the image to the given \a depth and
- returns the converted image. The original image is not changed.
- Returns this image if \a depth is equal to the image depth, or a
- null image if this image cannot be converted. The \a depth
- argument must be 1, 8 or 32. If the image needs to be modified to
- fit in a lower-resolution result (e.g. converting from 32-bit to
- 8-bit), use the \a flags to specify how you'd prefer this to
- happen.
-
- Use the convertToFormat() function instead.
-*/
-
-QImage QImage::convertDepth(int depth, Qt::ImageConversionFlags flags) const
-{
- if (!d || d->depth == depth)
- return *this;
-
- Format format = formatFor (depth, QImage::LittleEndian);
- return convertToFormat(format, flags);
-}
-#endif
-
/*!
\fn bool QImage::valid(const QPoint &pos) const
@@ -4264,41 +3824,6 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
}
}
-#ifdef QT3_SUPPORT
-/*!
- Converts the bit order of the image to the given \a bitOrder and
- returns the converted image. The original image is not changed.
- Returns this image if the given \a bitOrder is equal to the image
- current bit order, or a null image if this image cannot be
- converted.
-
- Use convertToFormat() instead.
-*/
-
-QImage QImage::convertBitOrder(Endian bitOrder) const
-{
- if (!d || isNull() || d->depth != 1 || !(bitOrder == BigEndian || bitOrder == LittleEndian))
- return QImage();
-
- if ((d->format == Format_Mono && bitOrder == BigEndian)
- || (d->format == Format_MonoLSB && bitOrder == LittleEndian))
- return *this;
-
- QImage image(d->width, d->height, d->format == Format_Mono ? Format_MonoLSB : Format_Mono);
-
- const uchar *data = d->data;
- const uchar *end = data + d->nbytes;
- uchar *ndata = image.d->data;
- while (data < end)
- *ndata++ = bitflip[*data++];
-
- image.setDotsPerMeterX(dotsPerMeterX());
- image.setDotsPerMeterY(dotsPerMeterY());
-
- image.d->colortable = d->colortable;
- return image;
-}
-#endif
/*!
Returns true if all the colors in the image are shades of gray
(i.e. their red, green and blue components are equal); otherwise
@@ -5283,66 +4808,6 @@ QDataStream &operator>>(QDataStream &s, QImage &image)
#endif // QT_NO_DATASTREAM
-#ifdef QT3_SUPPORT
-/*!
- \fn QImage QImage::convertDepthWithPalette(int depth, QRgb* palette, int palette_count, Qt::ImageConversionFlags flags) const
-
- Returns an image with the given \a depth, using the \a
- palette_count colors pointed to by \a palette. If \a depth is 1 or
- 8, the returned image will have its color table ordered in the
- same way as \a palette.
-
- If the image needs to be modified to fit in a lower-resolution
- result (e.g. converting from 32-bit to 8-bit), use the \a flags to
- specify how you'd prefer this to happen.
-
- Note: currently no closest-color search is made. If colors are
- found that are not in the palette, the palette may not be used at
- all. This result should not be considered valid because it may
- change in future implementations.
-
- Currently inefficient for non-32-bit images.
-
- Use the convertToFormat() function in combination with the
- setColorTable() function instead.
-*/
-QImage QImage::convertDepthWithPalette(int d, QRgb* palette, int palette_count, Qt::ImageConversionFlags flags) const
-{
- Format f = formatFor(d, QImage::LittleEndian);
- QVector<QRgb> colortable;
- for (int i = 0; i < palette_count; ++i)
- colortable.append(palette[i]);
- return convertToFormat(f, colortable, flags);
-}
-
-/*!
- \relates QImage
-
- Copies a block of pixels from \a src to \a dst. The pixels
- copied from source (src) are converted according to
- \a flags if it is incompatible with the destination
- (\a dst).
-
- \a sx, \a sy is the top-left pixel in \a src, \a dx, \a dy is the
- top-left position in \a dst and \a sw, \a sh is the size of the
- copied block. The copying is clipped if areas outside \a src or \a
- dst are specified. If \a sw is -1, it is adjusted to
- src->width(). Similarly, if \a sh is -1, it is adjusted to
- src->height().
-
- Currently inefficient for non 32-bit images.
-
- Use copy() or QPainter::drawImage() instead.
-*/
-void bitBlt(QImage *dst, int dx, int dy, const QImage *src, int sx, int sy, int sw, int sh,
- Qt::ImageConversionFlags flags)
-{
- if (dst->isNull() || src->isNull())
- return;
- QPainter p(dst);
- p.drawImage(QPoint(dx, dy), *src, QRect(sx, sy, sw, sh), flags);
-}
-#endif
/*!
\fn bool QImage::operator==(const QImage & image) const
@@ -6322,24 +5787,6 @@ int QImage::bitPlaneCount() const
return bpc;
}
-
-#ifdef QT3_SUPPORT
-#if defined(Q_WS_X11)
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <private/qt_x11_p.h>
-QT_END_INCLUDE_NAMESPACE
-#endif
-
-QImage::Endian QImage::systemBitOrder()
-{
-#if defined(Q_WS_X11)
- return BitmapBitOrder(X11->display) == MSBFirst ? BigEndian : LittleEndian;
-#else
- return BigEndian;
-#endif
-}
-#endif
-
/*!
\fn QImage QImage::copy(const QRect &rect, Qt::ImageConversionFlags flags) const
\compat
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 496fe93c54..849f731f5e 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -283,50 +283,6 @@ public:
void setText(const char* key, const char* lang, const QString&);
#endif
-#ifdef QT3_SUPPORT
- enum Endian { BigEndian, LittleEndian, IgnoreEndian };
- QT3_SUPPORT_CONSTRUCTOR QImage(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian);
- QT3_SUPPORT_CONSTRUCTOR QImage(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian);
- QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, const QRgb *colortable, int numColors, Endian bitOrder);
-#ifdef Q_WS_QWS
- QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, int pbl, const QRgb *colortable, int numColors, Endian bitOrder);
-#endif
- inline QT3_SUPPORT Endian bitOrder() const {
- Format f = format();
- return f == Format_Mono ? BigEndian : (f == Format_MonoLSB ? LittleEndian : IgnoreEndian);
- }
- QT3_SUPPORT QImage convertDepth(int, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
- QT3_SUPPORT QImage convertDepthWithPalette(int, QRgb* p, int pc, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
- QT3_SUPPORT QImage convertBitOrder(Endian) const;
- QT3_SUPPORT bool hasAlphaBuffer() const;
- QT3_SUPPORT void setAlphaBuffer(bool);
- QT3_SUPPORT uchar **jumpTable();
- QT3_SUPPORT const uchar * const *jumpTable() const;
- inline QT3_SUPPORT void reset() { *this = QImage(); }
- static inline QT3_SUPPORT Endian systemByteOrder()
- { return QSysInfo::ByteOrder == QSysInfo::BigEndian ? BigEndian : LittleEndian; }
- inline QT3_SUPPORT QImage swapRGB() const { return rgbSwapped(); }
- inline QT3_SUPPORT QImage mirror(bool horizontally = false, bool vertically = true) const
- { return mirrored(horizontally, vertically); }
- QT3_SUPPORT bool create(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian);
- QT3_SUPPORT bool create(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian);
- inline QT3_SUPPORT QImage xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); }
- inline QT3_SUPPORT QImage smoothScale(int w, int h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const
- { return scaled(QSize(w, h), mode, Qt::SmoothTransformation); }
- inline QImage QT3_SUPPORT smoothScale(const QSize &s, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const
- { return scaled(s, mode, Qt::SmoothTransformation); }
- inline QT3_SUPPORT QImage scaleWidth(int w) const { return scaledToWidth(w); }
- inline QT3_SUPPORT QImage scaleHeight(int h) const { return scaledToHeight(h); }
- inline QT3_SUPPORT void invertPixels(bool invertAlpha) { invertAlpha ? invertPixels(InvertRgba) : invertPixels(InvertRgb); }
- inline QT3_SUPPORT QImage copy(int x, int y, int w, int h, Qt::ImageConversionFlags) const
- { return copy(QRect(x, y, w, h)); }
- inline QT3_SUPPORT QImage copy(const QRect &rect, Qt::ImageConversionFlags) const
- { return copy(rect); }
- static QT3_SUPPORT Endian systemBitOrder();
- inline QT3_SUPPORT_CONSTRUCTOR QImage(const QByteArray &data)
- { d = 0; *this = QImage::fromData(data); }
-#endif
-
protected:
virtual int metric(PaintDeviceMetric metric) const;
@@ -362,11 +318,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &);
#endif
-#ifdef QT3_SUPPORT
-Q_GUI_EXPORT QT3_SUPPORT void bitBlt(QImage* dst, int dx, int dy, const QImage* src,
- int sx=0, int sy=0, int sw=-1, int sh=-1, Qt::ImageConversionFlags flags = Qt::AutoColor);
-#endif
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index db6620b39c..93ab8a78ba 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -79,9 +79,6 @@ struct Q_GUI_EXPORT QImageData { // internal image data
int nbytes; // number of bytes data
QVector<QRgb> colortable;
uchar *data;
-#ifdef QT3_SUPPORT
- uchar **jumptable;
-#endif
QImage::Format format;
int bytes_per_line;
int ser_no; // serial number
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index b64df29c41..98fcf68ee6 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -51,11 +51,6 @@
#include <QtCore/qobject.h>
#include <QtGui/qimagereader.h>
-#ifdef QT3_SUPPORT
-#include <QtGui/qimage.h>
-#include <QtGui/qpixmap.h>
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -151,21 +146,6 @@ public Q_SLOTS:
private:
Q_DISABLE_COPY(QMovie)
Q_PRIVATE_SLOT(d_func(), void _q_loadNextFrame())
-
-#ifdef QT3_SUPPORT
-public:
- inline QT3_SUPPORT bool isNull() const { return isValid(); }
- inline QT3_SUPPORT int frameNumber() const { return currentFrameNumber(); }
- inline QT3_SUPPORT bool running() const { return state() == Running; }
- inline QT3_SUPPORT bool paused() const { return state() == Paused; }
- inline QT3_SUPPORT bool finished() const { return state() == NotRunning; }
- inline QT3_SUPPORT void restart() { stop(); start(); }
- inline QT3_SUPPORT QImage frameImage() const { return currentImage(); }
- inline QT3_SUPPORT QPixmap framePixmap() const { return currentPixmap(); }
- inline QT3_SUPPORT void step() { jumpToNextFrame(); }
- inline QT3_SUPPORT void pause() { setPaused(true); }
- inline QT3_SUPPORT void unpause() { setPaused(false); }
-#endif
};
QT_END_NAMESPACE
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index 8face87a92..f09cf1b0ef 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -45,8 +45,7 @@
#include "private/qpaintengine_raster_p.h"
-#include "private/qapplication_p.h"
-#include "private/qgraphicssystem_p.h"
+#include "private/qguiapplication_p.h"
#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
#include <qx11info_x11.h>
@@ -70,7 +69,7 @@ typedef struct {
} BITMAPINFO_MASK;
-QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer, QWidget *)
+QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer, QWindow *)
{
#ifndef Q_WS_WINCE
Q_UNUSED(isTextBuffer);
@@ -147,102 +146,9 @@ QImage::Format QNativeImage::systemFormat()
return QImage::Format_RGB32;
}
-
-#elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
-
-QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget)
- : xshmimg(0), xshmpm(0)
-{
- if (!X11->use_mitshm) {
- image = QImage(width, height, format);
- // follow good coding practice and set xshminfo attributes, though values not used in this case
- xshminfo.readOnly = true;
- xshminfo.shmaddr = 0;
- xshminfo.shmid = 0;
- xshminfo.shmseg = 0;
- return;
- }
-
- QX11Info info = widget->x11Info();
-
- int dd = info.depth();
- Visual *vis = (Visual*) info.visual();
-
- xshmimg = XShmCreateImage(X11->display, vis, dd, ZPixmap, 0, &xshminfo, width, height);
- if (!xshmimg) {
- qWarning("QNativeImage: Unable to create shared XImage.");
- return;
- }
-
- bool ok;
- xshminfo.shmid = shmget(IPC_PRIVATE, xshmimg->bytes_per_line * xshmimg->height,
- IPC_CREAT | 0777);
- ok = xshminfo.shmid != -1;
- if (ok) {
- xshmimg->data = (char*)shmat(xshminfo.shmid, 0, 0);
- xshminfo.shmaddr = xshmimg->data;
- ok = (xshminfo.shmaddr != (char*)-1);
- if (ok)
- image = QImage((uchar *)xshmimg->data, width, height, format);
- }
- xshminfo.readOnly = false;
- if (ok) {
- ok = XShmAttach(X11->display, &xshminfo);
- XSync(X11->display, False);
- if (shmctl(xshminfo.shmid, IPC_RMID, 0) == -1)
- qWarning() << "Error while marking the shared memory segment to be destroyed";
- }
- if (!ok) {
- qWarning() << "QNativeImage: Unable to attach to shared memory segment.";
- if (xshmimg->data) {
- free(xshmimg->data);
- xshmimg->data = 0;
- }
- XDestroyImage(xshmimg);
- xshmimg = 0;
- if (xshminfo.shmaddr)
- shmdt(xshminfo.shmaddr);
- if (xshminfo.shmid != -1)
- shmctl(xshminfo.shmid, IPC_RMID, 0);
- return;
- }
- if (X11->use_mitshm_pixmaps) {
- xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data,
- &xshminfo, width, height, dd);
- if (!xshmpm) {
- qWarning() << "QNativeImage: Unable to create shared Pixmap.";
- }
- }
-}
-
-
-QNativeImage::~QNativeImage()
-{
- if (!xshmimg)
- return;
-
- if (xshmpm) {
- XFreePixmap(X11->display, xshmpm);
- xshmpm = 0;
- }
- XShmDetach(X11->display, &xshminfo);
- xshmimg->data = 0;
- XDestroyImage(xshmimg);
- xshmimg = 0;
- shmdt(xshminfo.shmaddr);
- shmctl(xshminfo.shmid, IPC_RMID, 0);
-}
-
-QImage::Format QNativeImage::systemFormat()
-{
- if (QX11Info::appDepth() == 16)
- return QImage::Format_RGB16;
- return QImage::Format_RGB32;
-}
-
#elif defined(Q_WS_MAC)
-QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWidget *widget)
+QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *)
: image(width, height, format)
{
@@ -267,7 +173,7 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /*
#endif
cg = CGBitmapContextCreate(image.bits(), width, height, 8, image.bytesPerLine(),
- QCoreGraphicsPaintEngine::macDisplayColorSpace(widget), cgflags);
+ QCoreGraphicsPaintEngine::macDisplayColorSpace(0), cgflags);
CGContextTranslateCTM(cg, 0, height);
CGContextScaleCTM(cg, 1, -1);
@@ -289,7 +195,7 @@ QImage::Format QNativeImage::systemFormat()
#else // other platforms...
-QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWidget *)
+QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *)
: image(width, height, format)
{
@@ -302,11 +208,7 @@ QNativeImage::~QNativeImage()
QImage::Format QNativeImage::systemFormat()
{
-#ifdef Q_WS_QPA
- return QApplicationPrivate::platformIntegration()->screens().at(0)->format();
-#else
- return QImage::Format_RGB32;
-#endif
+ return QGuiApplicationPrivate::platformIntegration()->screens().at(0)->format();
}
#endif // platforms
diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h
index 12aa0f021a..00897d4d54 100644
--- a/src/gui/image/qnativeimage_p.h
+++ b/src/gui/image/qnativeimage_p.h
@@ -58,9 +58,6 @@
#ifdef Q_WS_WIN
#include "qt_windows.h"
-#elif defined(Q_WS_X11)
-#include <private/qt_x11_p.h>
-
#elif defined(Q_WS_MAC)
#include <private/qt_mac_p.h>
@@ -68,12 +65,12 @@
QT_BEGIN_NAMESPACE
-class QWidget;
+class QWindow;
class QNativeImage
{
public:
- QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWidget *widget = 0);
+ QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWindow *window = 0);
~QNativeImage();
inline int width() const;
@@ -88,11 +85,6 @@ public:
HBITMAP bitmap;
HBITMAP null_bitmap;
-#elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
- XImage *xshmimg;
- Pixmap xshmpm;
- XShmSegmentInfo xshminfo;
-
#elif defined(Q_WS_MAC)
CGContextRef cg;
#endif
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 3f38c0ce2a..9fd4fbd59c 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -47,6 +47,7 @@
#include <private/qfactoryloader_p.h>
#include <private/qpaintengine_pic_p.h>
#include <private/qfont_p.h>
+#include <qguiapplication.h>
#include "qdatastream.h"
#include "qfile.h"
@@ -1217,7 +1218,6 @@ QDataStream &operator>>(QDataStream &s, QPicture &r)
QT_BEGIN_INCLUDE_NAMESPACE
#include "qregexp.h"
-#include "qapplication.h"
#include "qpictureformatplugin.h"
QT_END_INCLUDE_NAMESPACE
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index c478ed962e..3bcd87e5a0 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -104,9 +104,6 @@ protected:
QPicture(QPicturePrivate &data);
int metric(PaintDeviceMetric m) const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT QPicture copy() const { QPicture p(*this); p.detach(); return p; }
-#endif
private:
bool exec(QPainter *p, QDataStream &ds, int i);
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 34804e5311..a484bd408a 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -52,9 +52,7 @@
#include "qpainter.h"
#include "qdatastream.h"
#include "qbuffer.h"
-#include "qapplication.h"
-#include <private/qapplication_p.h>
-#include <private/qgraphicssystem_p.h>
+#include <private/qguiapplication_p.h>
#include <private/qwidget_p.h>
#include "qevent.h"
#include "qfile.h"
@@ -65,6 +63,7 @@
#include "qimagewriter.h"
#include "qpaintengine.h"
#include "qthread.h"
+#include "qdebug.h"
#ifdef Q_WS_MAC
# include "private/qt_mac_p.h"
@@ -86,7 +85,7 @@
#endif
#include "qpixmap_raster_p.h"
-#include "private/qstylehelper_p.h"
+#include "private/qhexstring_p.h"
QT_BEGIN_NAMESPACE
@@ -98,25 +97,17 @@ Q_GUI_EXPORT qint64 qt_pixmap_id(const QPixmap &pixmap)
static bool qt_pixmap_thread_test()
{
- if (!qApp) {
+ if (!QCoreApplication::instance()) {
qFatal("QPixmap: Must construct a QApplication before a QPaintDevice");
return false;
}
if (qApp->thread() != QThread::currentThread()) {
bool fail = false;
-#if defined (Q_WS_X11)
- if (!QApplication::testAttribute(Qt::AA_X11InitThreads))
- fail = true;
-#elif defined (Q_WS_QPA)
- if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
printf("Lighthouse plugin does not support threaded pixmaps!\n");
fail = true;
}
-#else
- if (QApplicationPrivate::graphics_system_name != QLatin1String("raster"))
- fail = true;
-#endif
if (fail) {
qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread");
return false;
@@ -130,16 +121,8 @@ void QPixmap::init(int w, int h, Type type)
init(w, h, int(type));
}
-extern QApplication::Type qt_appType;
-
void QPixmap::init(int w, int h, int type)
{
- if (qt_appType == QApplication::Tty) {
- qWarning("QPixmap: Cannot create a QPixmap when no GUI is being used");
- data = 0;
- return;
- }
-
if ((w > 0 && h > 0) || type == QPixmapData::BitmapType)
data = QPixmapData::create(w, h, (QPixmapData::PixelType) type);
else
@@ -657,65 +640,6 @@ int QPixmap::depth() const
pixmap = pixmap.copy(QRect(QPoint(0, 0), size));
\endcode
*/
-#ifdef QT3_SUPPORT
-void QPixmap::resize_helper(const QSize &s)
-{
- int w = s.width();
- int h = s.height();
- if (w < 1 || h < 1) {
- *this = QPixmap();
- return;
- }
-
- if (size() == s)
- return;
-
- // QPixmap.data member may be QRuntimePixmapData so use pixmapData() function to get
- // the actual underlaying runtime pixmap data.
- QPixmapData *pd = pixmapData();
-
- // Create new pixmap
- QPixmap pm(QSize(w, h), pd ? pd->type : QPixmapData::PixmapType);
- bool uninit = false;
-#if defined(Q_WS_X11)
- QX11PixmapData *x11Data = pd && pd->classId() == QPixmapData::X11Class ? static_cast<QX11PixmapData*>(pd) : 0;
- if (x11Data) {
- pm.x11SetScreen(x11Data->xinfo.screen());
- uninit = x11Data->flags & QX11PixmapData::Uninitialized;
- }
-#elif defined(Q_WS_MAC)
- QMacPixmapData *macData = pd && pd->classId() == QPixmapData::MacClass ? static_cast<QMacPixmapData*>(pd) : 0;
- if (macData)
- uninit = macData->uninit;
-#endif
- if (!uninit && !isNull()) {
- // Copy old pixmap
- if (hasAlphaChannel())
- pm.fill(Qt::transparent);
- QPainter p(&pm);
- p.drawPixmap(0, 0, *this, 0, 0, qMin(width(), w), qMin(height(), h));
- }
-
-#if defined(Q_WS_X11)
- if (x11Data && x11Data->x11_mask) {
- QPixmapData *newPd = pm.pixmapData();
- QX11PixmapData *pmData = (newPd && newPd->classId() == QPixmapData::X11Class)
- ? static_cast<QX11PixmapData*>(newPd) : 0;
- if (pmData) {
- pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display,
- RootWindow(x11Data->xinfo.display(),
- x11Data->xinfo.screen()),
- w, h, 1);
- GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0);
- XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0,
- qMin(width(), w), qMin(height(), h), 0, 0);
- XFreeGC(X11->display, gc);
- }
- }
-#endif
- *this = pm;
-}
-#endif
/*!
\fn void QPixmap::resize(int width, int height)
@@ -986,21 +910,24 @@ bool QPixmap::doImageIO(QImageWriter *writer, int quality) const
return writer->write(toImage());
}
-
-// The implementation (and documentation) of
-// QPixmap::fill(const QWidget *, const QPoint &)
-// is in qwidget.cpp
-
/*!
- \fn void QPixmap::fill(const QWidget *widget, int x, int y)
+ \fn void QPixmap::fill(const QPaintDevice *device, int x, int y)
\overload
- Fills the pixmap with the \a widget's background color or pixmap.
+ \obsolete
+
+ Fills the pixmap with the \a device's background color or pixmap.
The given point, (\a x, \a y), defines an offset in widget
coordinates to which the pixmap's top-left pixel will be mapped
to.
*/
+void QPixmap::fill(const QPaintDevice *, const QPoint &)
+{
+ qWarning() << "QPixmap::fill(const QPaintDevice *device, const QPoint &offset) is deprecated, ignored";
+}
+
+
/*!
Fills the pixmap with the given \a color.
@@ -1072,6 +999,7 @@ qint64 QPixmap::cacheKey() const
return data->cacheKey();
}
+#if 0
static void sendResizeEvents(QWidget *target)
{
QResizeEvent e(target->size(), QSize());
@@ -1084,9 +1012,10 @@ static void sendResizeEvents(QWidget *target)
sendResizeEvents(child);
}
}
+#endif
/*!
- \fn QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rectangle)
+ \fn QPixmap QPixmap::grabWidget(QPaintDevice * widget, const QRect &rectangle)
Creates a pixmap and paints the given \a widget, restricted by the
given \a rectangle, in it. If the \a widget has any children, then
@@ -1115,8 +1044,13 @@ static void sendResizeEvents(QWidget *target)
\sa grabWindow()
*/
-QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
+QPixmap QPixmap::grabWidget(QPaintDevice *, const QRect &)
{
+ // ### Qt5: should we keep or remove this method?
+ // SC solution would be to install a callback form QtWidgets, but ugly.
+ qWarning() << "QPixmap::grabWidget is deprecated, use QWidget::render() instead";
+ return QPixmap();
+#if 0
if (!widget)
return QPixmap();
@@ -1142,6 +1076,7 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground
| QWidget::DrawChildren | QWidget::IgnoreMask, true);
return res;
+#endif
}
/*!
@@ -1217,7 +1152,6 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
graphics system is explicitly enabled.
\sa detach()
- \sa QApplication::setGraphicsSystem()
*/
Qt::HANDLE QPixmap::handle() const
@@ -1236,104 +1170,6 @@ Qt::HANDLE QPixmap::handle() const
#endif
-#ifdef QT3_SUPPORT
-static Qt::ImageConversionFlags colorModeToFlags(QPixmap::ColorMode mode)
-{
- Qt::ImageConversionFlags flags = Qt::AutoColor;
- switch (mode) {
- case QPixmap::Color:
- flags |= Qt::ColorOnly;
- break;
- case QPixmap::Mono:
- flags |= Qt::MonoOnly;
- break;
- default:
- break;// Nothing.
- }
- return flags;
-}
-
-/*!
- Use the constructor that takes a Qt::ImageConversionFlag instead.
-*/
-
-QPixmap::QPixmap(const QString& fileName, const char *format, ColorMode mode)
- : QPaintDevice()
-{
- init(0, 0, QPixmapData::PixmapType);
- if (!qt_pixmap_thread_test())
- return;
-
- load(fileName, format, colorModeToFlags(mode));
-}
-
-/*!
- Constructs a pixmap from the QImage \a image.
-
- Use the static fromImage() function instead.
-*/
-QPixmap::QPixmap(const QImage& image)
- : QPaintDevice()
-{
- init(0, 0, QPixmapData::PixmapType);
- if (!qt_pixmap_thread_test())
- return;
-
- if (data && data->pixelType() == QPixmapData::BitmapType)
- *this = QBitmap::fromImage(image);
- else
- *this = fromImage(image);
-}
-
-/*!
- \overload
-
- Converts the given \a image to a pixmap that is assigned to this
- pixmap.
-
- Use the static fromImage() function instead.
-*/
-
-QPixmap &QPixmap::operator=(const QImage &image)
-{
- if (data && data->pixelType() == QPixmapData::BitmapType)
- *this = QBitmap::fromImage(image);
- else
- *this = fromImage(image);
- return *this;
-}
-
-/*!
- Use the load() function that takes a Qt::ImageConversionFlag instead.
-*/
-
-bool QPixmap::load(const QString &fileName, const char *format, ColorMode mode)
-{
- return load(fileName, format, colorModeToFlags(mode));
-}
-
-/*!
- Use the loadFromData() function that takes a Qt::ImageConversionFlag instead.
-*/
-
-bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, ColorMode mode)
-{
- return loadFromData(buf, len, format, colorModeToFlags(mode));
-}
-
-/*!
- Use the static fromImage() function instead.
-*/
-bool QPixmap::convertFromImage(const QImage &image, ColorMode mode)
-{
- if (data && data->pixelType() == QPixmapData::BitmapType)
- *this = QBitmap::fromImage(image, colorModeToFlags(mode));
- else
- *this = fromImage(image, colorModeToFlags(mode));
- return !isNull();
-}
-
-#endif
/*****************************************************************************
QPixmap stream functions
@@ -1379,34 +1215,6 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap)
#endif // QT_NO_DATASTREAM
-#ifdef QT3_SUPPORT
-Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy,
- const QPixmap *src, int sx, int sy, int sw, int sh)
-{
- Q_ASSERT_X(dst, "::copyBlt", "Destination pixmap must be non-null");
- Q_ASSERT_X(src, "::copyBlt", "Source pixmap must be non-null");
-
- if (src->hasAlphaChannel()) {
- if (dst->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) {
- QPainter p(dst);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- p.drawPixmap(dx, dy, *src, sx, sy, sw, sh);
- } else {
- QImage image = dst->toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
- QPainter p(&image);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- p.drawPixmap(dx, dy, *src, sx, sy, sw, sh);
- p.end();
- *dst = QPixmap::fromImage(image);
- }
- } else {
- QPainter p(dst);
- p.drawPixmap(dx, dy, *src, sx, sy, sw, sh);
- }
-
-}
-#endif
-
/*!
\internal
*/
@@ -1992,7 +1800,7 @@ int QPixmap::defaultDepth()
#elif defined(Q_OS_SYMBIAN)
return S60->screenDepth;
#elif defined(Q_WS_QPA)
- return 32; //LITE: use graphicssystem (we should do that in general)
+ return 32; //LITE: ### use graphicssystem (we should do that in general)
#endif
}
@@ -2084,9 +1892,7 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
if (image.isNull())
return QPixmap();
- QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem();
- QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::PixmapType)
- : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType));
+ QScopedPointer<QPixmapData> data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::PixmapType));
data->fromImage(image, flags);
return QPixmap(data.take());
}
@@ -2105,9 +1911,7 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
*/
QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags)
{
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::PixmapType)
- : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType));
+ QScopedPointer<QPixmapData> data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::PixmapType));
data->fromImageReader(imageReader, flags);
return QPixmap(data.take());
}
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index f2e79c14f4..1341ad2b1b 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -103,8 +103,8 @@ public:
static int defaultDepth();
void fill(const QColor &fillColor = Qt::white);
- void fill(const QWidget *widget, const QPoint &ofs);
- inline void fill(const QWidget *widget, int xofs, int yofs) { fill(widget, QPoint(xofs, yofs)); }
+ void fill(const QPaintDevice *device, const QPoint &ofs);
+ inline void fill(const QPaintDevice *device, int xofs, int yofs) { fill(device, QPoint(xofs, yofs)); }
QBitmap mask() const;
void setMask(const QBitmap &);
@@ -122,8 +122,8 @@ public:
QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) const;
static QPixmap grabWindow(WId, int x=0, int y=0, int w=-1, int h=-1);
- static QPixmap grabWidget(QWidget *widget, const QRect &rect);
- static inline QPixmap grabWidget(QWidget *widget, int x=0, int y=0, int w=-1, int h=-1)
+ static QPixmap grabWidget(QPaintDevice *widget, const QRect &rect);
+ static inline QPixmap grabWidget(QPaintDevice *widget, int x=0, int y=0, int w=-1, int h=-1)
{ return grabWidget(widget, QRect(x, y, w, h)); }
@@ -224,26 +224,6 @@ public:
protected:
int metric(PaintDeviceMetric) const;
-#ifdef QT3_SUPPORT
-public:
- enum ColorMode { Auto, Color, Mono };
- QT3_SUPPORT_CONSTRUCTOR QPixmap(const QString& fileName, const char *format, ColorMode mode);
- QT3_SUPPORT bool load(const QString& fileName, const char *format, ColorMode mode);
- QT3_SUPPORT bool loadFromData(const uchar *buf, uint len, const char* format, ColorMode mode);
- QT3_SUPPORT_CONSTRUCTOR QPixmap(const QImage& image);
- QT3_SUPPORT QPixmap &operator=(const QImage &);
- inline QT3_SUPPORT QImage convertToImage() const { return toImage(); }
- QT3_SUPPORT bool convertFromImage(const QImage &, ColorMode mode);
- inline QT3_SUPPORT operator QImage() const { return toImage(); }
- inline QT3_SUPPORT QPixmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); }
- inline QT3_SUPPORT bool selfMask() const { return false; }
-private:
- void resize_helper(const QSize &s);
-public:
- inline QT3_SUPPORT void resize(const QSize &s) { resize_helper(s); }
- inline QT3_SUPPORT void resize(int width, int height) { resize_helper(QSize(width, height)); }
-#endif
-
private:
QExplicitlySharedDataPointer<QPixmapData> data;
@@ -320,14 +300,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPixmap &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &);
#endif
-/*****************************************************************************
- QPixmap (and QImage) helper functions
-*****************************************************************************/
-#ifdef QT3_SUPPORT
-QT3_SUPPORT Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, const QPixmap *src,
- int sx=0, int sy=0, int sw=-1, int sh=-1);
-#endif // QT3_SUPPORT
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index e2cd745e7c..da1c8e135d 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -44,8 +44,7 @@
#include <qpainter.h>
#include <qimage.h>
-#include <private/qapplication_p.h>
-#include <private/qgraphicssystem_p.h>
+#include <private/qguiapplication_p.h>
#include <private/qblittable_p.h>
#include <private/qdrawhelper_p.h>
@@ -99,7 +98,7 @@ void QBlittablePixmapData::resize(int width, int height)
delete m_engine;
m_engine = 0;
#ifdef Q_WS_QPA
- d = QApplicationPrivate::platformIntegration()->screens().at(0)->depth();
+ d = QGuiApplicationPrivate::platformIntegration()->screens().at(0)->depth();
#endif
w = width;
h = height;
diff --git a/src/gui/image/qpixmap_qpa.cpp b/src/gui/image/qpixmap_qpa.cpp
index 61be2169d0..da301baa19 100644
--- a/src/gui/image/qpixmap_qpa.cpp
+++ b/src/gui/image/qpixmap_qpa.cpp
@@ -40,10 +40,9 @@
****************************************************************************/
#include <qpixmap.h>
-#include <private/qgraphicssystem_p.h>
-#include <private/qapplication_p.h>
+#include <private/qguiapplication_p.h>
QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
{
- return QApplicationPrivate::platformIntegration()->grabWindow(window, x, y, w, h);
+ return QGuiApplicationPrivate::platformIntegration()->grabWindow(window, x, y, w, h);
}
diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp
deleted file mode 100644
index 3c1907089d..0000000000
--- a/src/gui/image/qpixmap_qws.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qpixmap.h>
-#include <qapplication.h>
-#include <qwidget.h>
-#include <qdesktopwidget.h>
-#include <qscreen_qws.h>
-#include <qwsdisplay_qws.h>
-#include <private/qdrawhelper_p.h>
-#include <private/qpixmap_raster_p.h>
-
-
-QT_BEGIN_NAMESPACE
-
-QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
-{
- QWidget *widget = QWidget::find(window);
- if (!widget)
- return QPixmap();
-
- QRect grabRect = widget->frameGeometry();
- if (!widget->isWindow())
- grabRect.translate(widget->parentWidget()->mapToGlobal(QPoint()));
- if (w < 0)
- w = widget->width() - x;
- if (h < 0)
- h = widget->height() - y;
- grabRect &= QRect(x, y, w, h).translated(widget->mapToGlobal(QPoint()));
-
- QScreen *screen = qt_screen;
- QDesktopWidget *desktop = QApplication::desktop();
- if (!desktop)
- return QPixmap();
- if (desktop->numScreens() > 1) {
- const int screenNo = desktop->screenNumber(widget);
- if (screenNo != -1)
- screen = qt_screen->subScreens().at(screenNo);
- grabRect = grabRect.translated(-screen->region().boundingRect().topLeft());
- }
-
- if (screen->pixelFormat() == QImage::Format_Invalid) {
- qWarning("QPixmap::grabWindow(): Unable to copy pixels from framebuffer");
- return QPixmap();
- }
-
- if (screen->isTransformed()) {
- const QSize screenSize(screen->width(), screen->height());
- grabRect = screen->mapToDevice(grabRect, screenSize);
- }
-
- QWSDisplay::grab(false);
- QPixmap pixmap;
- QImage img(screen->base(),
- screen->deviceWidth(), screen->deviceHeight(),
- screen->linestep(), screen->pixelFormat());
- img = img.copy(grabRect);
- QWSDisplay::ungrab();
-
- if (screen->isTransformed()) {
- QMatrix matrix;
- switch (screen->transformOrientation()) {
- case 1: matrix.rotate(90); break;
- case 2: matrix.rotate(180); break;
- case 3: matrix.rotate(270); break;
- default: break;
- }
- img = img.transformed(matrix);
- }
-
- if (screen->pixelType() == QScreen::BGRPixel)
- img = img.rgbSwapped();
-
- return QPixmap::fromImage(img);
-}
-
-QRgb* QPixmap::clut() const
-{
- if (data && data->classId() == QPixmapData::RasterClass) {
- const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data());
- return d->image.colorTable().data();
- }
-
- return 0;
-}
-
-int QPixmap::numCols() const
-{
- return colorCount();
-}
-
-int QPixmap::colorCount() const
-{
- if (data && data->classId() == QPixmapData::RasterClass) {
- const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data());
- return d->image.colorCount();
- }
-
- return 0;
-}
-
-const uchar* QPixmap::qwsBits() const
-{
- if (data && data->classId() == QPixmapData::RasterClass) {
- const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data());
- return d->image.bits();
- }
-
- return 0;
-}
-
-int QPixmap::qwsBytesPerLine() const
-{
- if (data && data->classId() == QPixmapData::RasterClass) {
- const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data());
- return d->image.bytesPerLine();
- }
-
- return 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index 8222d714dc..a56504ed94 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -43,8 +43,7 @@
#include <QtCore/qbuffer.h>
#include <QtGui/qbitmap.h>
#include <QtGui/qimagereader.h>
-#include <private/qgraphicssystem_p.h>
-#include <private/qapplication_p.h>
+#include <private/qguiapplication_p.h>
#include <private/qimagepixmapcleanuphooks_p.h>
QT_BEGIN_NAMESPACE
@@ -54,12 +53,7 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
QPixmapData *QPixmapData::create(int w, int h, PixelType type)
{
- QPixmapData *data;
- QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem();
- if (gs)
- data = gs->createPixmapData(static_cast<QPixmapData::PixelType>(type));
- else
- data = QGraphicsSystem::createDefaultPixmapData(static_cast<QPixmapData::PixelType>(type));
+ QPixmapData *data = QGuiApplicationPrivate::platformIntegration()->createPixmapData(static_cast<QPixmapData::PixelType>(type));
data->resize(w, h);
return data;
}
@@ -95,12 +89,7 @@ QPixmapData::~QPixmapData()
QPixmapData *QPixmapData::createCompatiblePixmapData() const
{
- QPixmapData *d;
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (gs)
- d = gs->createPixmapData(pixelType());
- else
- d = QGraphicsSystem::createDefaultPixmapData(pixelType());
+ QPixmapData *d = QGuiApplicationPrivate::platformIntegration()->createPixmapData(pixelType());
return d;
}
diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp
index ec53dcb9c1..906d8ddd8e 100644
--- a/src/gui/image/qpixmapdatafactory.cpp
+++ b/src/gui/image/qpixmapdatafactory.cpp
@@ -60,8 +60,7 @@
# include <private/qpixmap_s60_p.h>
#endif
-#include "private/qapplication_p.h"
-#include "private/qgraphicssystem_p.h"
+#include "private/qguiapplication_p.h"
QT_BEGIN_NAMESPACE
@@ -76,22 +75,8 @@ public:
QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type)
{
- if (QApplicationPrivate::graphicsSystem())
- return QApplicationPrivate::graphicsSystem()->createPixmapData(type);
-
-#if defined(Q_WS_X11)
- return new QX11PixmapData(type);
-#elif defined(Q_WS_WIN)
- return new QRasterPixmapData(type);
-#elif defined(Q_WS_MAC)
- return new QMacPixmapData(type);
-#elif defined(Q_WS_QPA)
- return new QRasterPixmapData(type);
-#elif defined(Q_OS_SYMBIAN)
- return new QS60PixmapData(type);
-#else
-#error QSimplePixmapDataFactory::create() not implemented
-#endif
+ // ### should we always use Raster instead?
+ return QGuiApplicationPrivate::platformIntegration()->createPixmapData(type);
}
Q_GLOBAL_STATIC(QSimplePixmapDataFactory, factory)
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index c05afb052e..ecab3d7a41 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -48,8 +48,7 @@
#include "qpixmapfilter_p.h"
#include "qvarlengtharray.h"
-#include "private/qapplication_p.h"
-#include "private/qgraphicssystem_p.h"
+#include "private/qguiapplication_p.h"
#include "private/qpaintengineex_p.h"
#include "private/qpaintengine_raster_p.h"
#include "qmath.h"
diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri
index d4394380dc..77ca3bd057 100644
--- a/src/gui/inputmethod/inputmethod.pri
+++ b/src/gui/inputmethod/inputmethod.pri
@@ -15,11 +15,7 @@ win32 {
HEADERS += inputmethod/qwininputcontext_p.h
SOURCES += inputmethod/qwininputcontext_win.cpp
}
-embedded {
- HEADERS += inputmethod/qwsinputcontext_p.h
- SOURCES += inputmethod/qwsinputcontext_qws.cpp
-}
-mac:!embedded:!qpa {
+mac:!qpa {
HEADERS += inputmethod/qmacinputcontext_p.h
SOURCES += inputmethod/qmacinputcontext_mac.cpp
}
diff --git a/src/gui/inputmethod/qwsinputcontext_p.h b/src/gui/inputmethod/qwsinputcontext_p.h
deleted file mode 100644
index 72b06a0b8f..0000000000
--- a/src/gui/inputmethod/qwsinputcontext_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSINPUTCONTEXT_P_H
-#define QWSINPUTCONTEXT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtGui/qinputcontext.h"
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-QT_BEGIN_NAMESPACE
-
-class QWSIMEvent;
-class QWSIMQueryEvent;
-class QWSIMInitEvent;
-
-class QWSInputContext : public QInputContext
-{
- Q_OBJECT
-public:
- explicit QWSInputContext(QObject* parent = 0);
- ~QWSInputContext() {}
-
-
- QString identifierName() { return QString(); }
- QString language() { return QString(); }
-
- void reset();
- void update();
- void mouseHandler( int x, QMouseEvent *event);
-
- void setFocusWidget( QWidget *w );
- void widgetDestroyed(QWidget *w);
-
- bool isComposing() const;
-
- static QWidget *activeWidget();
- static bool translateIMEvent(QWidget *w, const QWSIMEvent *e);
- static bool translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e);
- static bool translateIMInitEvent(const QWSIMInitEvent *e);
- static void updateImeStatus(QWidget *w, bool hasFocus);
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_INPUTMETHODS
-
-#endif // QWSINPUTCONTEXT_P_H
diff --git a/src/gui/inputmethod/qwsinputcontext_qws.cpp b/src/gui/inputmethod/qwsinputcontext_qws.cpp
deleted file mode 100644
index d8d64f28d4..0000000000
--- a/src/gui/inputmethod/qwsinputcontext_qws.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwsinputcontext_p.h"
-#include "qinputcontext_p.h"
-#include "qwsdisplay_qws.h"
-#include "qwsevent_qws.h"
-#include "private/qwscommand_qws_p.h"
-#include "qwindowsystem_qws.h"
-#include "qevent.h"
-#include "qtextformat.h"
-
-#include <qbuffer.h>
-
-#include <qdebug.h>
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-QT_BEGIN_NAMESPACE
-
-static QWidget* activeWidget = 0;
-
-//#define EXTRA_DEBUG
-
-QWSInputContext::QWSInputContext(QObject *parent)
- :QInputContext(parent)
-{
-}
-
-void QWSInputContext::reset()
-{
- QPaintDevice::qwsDisplay()->resetIM();
-}
-
-
-void QWSInputContext::setFocusWidget( QWidget *w )
-{
- QWidget *oldFocus = focusWidget();
- if (oldFocus == w)
- return;
-
- if (w) {
- QWSInputContext::updateImeStatus(w, true);
- } else {
- if (oldFocus)
- QWSInputContext::updateImeStatus(oldFocus, false);
- }
-
- if (oldFocus) {
- QWidget *tlw = oldFocus->window();
- int winid = tlw->internalWinId();
-
- int widgetid = oldFocus->internalWinId();
- QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::FocusOut, winid, widgetid);
- }
-
- QInputContext::setFocusWidget(w);
-
- if (!w)
- return;
-
- QWidget *tlw = w->window();
- int winid = tlw->winId();
-
- int widgetid = w->winId();
- QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::FocusIn, winid, widgetid);
-
- //setfocus ???
-
- update();
-}
-
-
-void QWSInputContext::widgetDestroyed(QWidget *w)
-{
- if (w == QT_PREPEND_NAMESPACE(activeWidget))
- QT_PREPEND_NAMESPACE(activeWidget) = 0;
- QInputContext::widgetDestroyed(w);
-}
-
-void QWSInputContext::update()
-{
- QWidget *w = focusWidget();
- if (!w)
- return;
-
- QWidget *tlw = w->window();
- int winid = tlw->winId();
-
- int widgetid = w->winId();
- QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::Update, winid, widgetid);
-
-}
-
-void QWSInputContext::mouseHandler( int x, QMouseEvent *event)
-{
- if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
- QPaintDevice::qwsDisplay()->sendIMMouseEvent( x, event->type() == QEvent::MouseButtonPress );
-}
-
-QWidget *QWSInputContext::activeWidget()
-{
- return QT_PREPEND_NAMESPACE(activeWidget);
-}
-
-
-bool QWSInputContext::isComposing() const
-{
- return QT_PREPEND_NAMESPACE(activeWidget) != 0;
-}
-
-bool QWSInputContext::translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e)
-{
- Qt::InputMethodQuery type = static_cast<Qt::InputMethodQuery>(e->simpleData.property);
- QVariant result = w->inputMethodQuery(type);
- QWidget *tlw = w->window();
- int winId = tlw->winId();
-
- if ( type == Qt::ImMicroFocus ) {
- // translate to relative to tlw
- QRect mf = result.toRect();
- mf.moveTopLeft(w->mapTo(tlw,mf.topLeft()));
- result = mf;
- }
-
- QPaintDevice::qwsDisplay()->sendIMResponse(winId, e->simpleData.property, result);
-
- return false;
-}
-
-bool QWSInputContext::translateIMInitEvent(const QWSIMInitEvent *e)
-{
- Q_UNUSED(e);
- qDebug("### QWSInputContext::translateIMInitEvent not implemented ###");
- return false;
-}
-
-bool QWSInputContext::translateIMEvent(QWidget *w, const QWSIMEvent *e)
-{
- QDataStream stream(e->streamingData);
- QString preedit;
- QString commit;
-
- stream >> preedit;
- stream >> commit;
-
- if (preedit.isEmpty() && QT_PREPEND_NAMESPACE(activeWidget))
- w = QT_PREPEND_NAMESPACE(activeWidget);
-
- QInputContext *qic = w->inputContext();
- if (!qic)
- return false;
-
- QList<QInputMethodEvent::Attribute> attrs;
-
-
- while (!stream.atEnd()) {
- int type = -1;
- int start = -1;
- int length = -1;
- QVariant data;
- stream >> type >> start >> length >> data;
- if (stream.status() != QDataStream::Ok) {
- qWarning("corrupted QWSIMEvent");
- //qic->reset(); //???
- return false;
- }
- if (type == QInputMethodEvent::TextFormat)
- data = qic->standardFormat(static_cast<QInputContext::StandardFormat>(data.toInt()));
- attrs << QInputMethodEvent::Attribute(static_cast<QInputMethodEvent::AttributeType>(type), start, length, data);
- }
-#ifdef EXTRA_DEBUG
- qDebug() << "preedit" << preedit << "len" << preedit.length() <<"commit" << commit << "len" << commit.length()
- << "n attr" << attrs.count();
-#endif
-
- if (preedit.isEmpty())
- QT_PREPEND_NAMESPACE(activeWidget) = 0;
- else
- QT_PREPEND_NAMESPACE(activeWidget) = w;
-
-
- QInputMethodEvent ime(preedit, attrs);
- if (!commit.isEmpty() || e->simpleData.replaceLength > 0)
- ime.setCommitString(commit, e->simpleData.replaceFrom, e->simpleData.replaceLength);
-
-
- extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); //qapplication_qws.cpp
- qt_sendSpontaneousEvent(w, &ime);
-
- return true;
-}
-
-Q_GUI_EXPORT void (*qt_qws_inputMethodStatusChanged)(QWidget*) = 0;
-
-void QWSInputContext::updateImeStatus(QWidget *w, bool hasFocus)
-{
- Q_UNUSED(hasFocus);
-
- if (!w || !qt_qws_inputMethodStatusChanged)
- return;
- qt_qws_inputMethodStatusChanged(w);
-}
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_INPUTMETHODS
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 3c57368bab..09ef146597 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -49,6 +49,7 @@ HEADERS += \
kernel/qsoftkeymanager_p.h \
kernel/qsoftkeymanager_common_p.h \
kernel/qguiplatformplugin_p.h \
+ kernel/qhexstring_p.h
SOURCES += \
kernel/qaction.cpp \
@@ -66,8 +67,8 @@ SOURCES += \
kernel/qlayout.cpp \
kernel/qlayoutengine.cpp \
kernel/qlayoutitem.cpp \
- kernel/qmime.cpp \
- kernel/qpalette.cpp \
+ kernel/qmime.cpp \
+ kernel/qpalette.cpp \
kernel/qshortcut.cpp \
kernel/qshortcutmap.cpp \
kernel/qstackedlayout.cpp \
@@ -173,32 +174,6 @@ unix:x11 {
kernel/qeventdispatcher_x11_p.h
}
-embedded {
- HEADERS += \
- kernel/qeventdispatcher_qws_p.h
-
- SOURCES += \
- kernel/qapplication_qws.cpp \
- kernel/qclipboard_qws.cpp \
- kernel/qcursor_qws.cpp \
- kernel/qdesktopwidget_qws.cpp \
- kernel/qdnd_qws.cpp \
- kernel/qeventdispatcher_qws.cpp \
- kernel/qsound_qws.cpp \
- kernel/qwidget_qws.cpp \
- kernel/qkeymapper_qws.cpp \
- kernel/qsessionmanager_qws.cpp
-
- contains(QT_CONFIG, glib) {
- SOURCES += \
- kernel/qeventdispatcher_glib_qws.cpp
- HEADERS += \
- kernel/qeventdispatcher_glib_qws_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE +=$$QT_LIBS_GLIB
- }
-}
-
!qpa {
HEADERS += \
kernel/qsound.h \
@@ -210,7 +185,7 @@ embedded {
qpa {
HEADERS += \
- kernel/qgenericpluginfactory_qpa.h \
+ kernel/qgenericpluginfactory_qpa.h \
kernel/qgenericplugin_qpa.h \
kernel/qeventdispatcher_qpa_p.h \
kernel/qwindowsysteminterface_qpa.h \
@@ -220,23 +195,29 @@ qpa {
kernel/qplatformintegrationfactory_qpa_p.h \
kernel/qplatformintegrationplugin_qpa.h \
kernel/qplatformwindow_qpa.h \
- kernel/qplatformwindowformat_qpa.h \
kernel/qplatformglcontext_qpa.h \
+ kernel/qwindowcontext_qpa.h \
kernel/qdesktopwidget_qpa_p.h \
kernel/qplatformeventloopintegration_qpa.h \
kernel/qplatformcursor_qpa.h \
kernel/qplatformclipboard_qpa.h \
- kernel/qplatformnativeinterface_qpa.h
+ kernel/qplatformnativeinterface_qpa.h \
+ kernel/qwindowformat_qpa.h \
+ kernel/qguiapplication.h \
+ kernel/qguiapplication_p.h \
+ kernel/qwidgetwindow_qpa_p.h \
+ kernel/qwindow_p.h \
+ kernel/qwindow.h
SOURCES += \
- kernel/qapplication_qpa.cpp \
- kernel/qclipboard_qpa.cpp \
- kernel/qcursor_qpa.cpp \
- kernel/qdnd_qws.cpp \
- kernel/qdesktopwidget_qpa.cpp \
- kernel/qgenericpluginfactory_qpa.cpp \
- kernel/qgenericplugin_qpa.cpp \
- kernel/qkeymapper_qws.cpp \
+ kernel/qapplication_qpa.cpp \
+ kernel/qclipboard_qpa.cpp \
+ kernel/qcursor_qpa.cpp \
+ kernel/qdnd_qpa.cpp \
+ kernel/qdesktopwidget_qpa.cpp \
+ kernel/qgenericpluginfactory_qpa.cpp \
+ kernel/qgenericplugin_qpa.cpp \
+ kernel/qkeymapper_qpa.cpp \
kernel/qwidget_qpa.cpp \
kernel/qeventdispatcher_qpa.cpp \
kernel/qwindowsysteminterface_qpa.cpp \
@@ -245,13 +226,17 @@ qpa {
kernel/qplatformintegrationfactory_qpa.cpp \
kernel/qplatformintegrationplugin_qpa.cpp \
kernel/qplatformwindow_qpa.cpp \
- kernel/qplatformwindowformat_qpa.cpp \
kernel/qplatformeventloopintegration_qpa.cpp \
kernel/qplatformglcontext_qpa.cpp \
+ kernel/qwindowcontext_qpa.cpp \
kernel/qplatformcursor_qpa.cpp \
kernel/qplatformclipboard_qpa.cpp \
kernel/qplatformnativeinterface_qpa.cpp \
- kernel/qsessionmanager_qpa.cpp
+ kernel/qsessionmanager_qpa.cpp \
+ kernel/qwindowformat_qpa.cpp \
+ kernel/qguiapplication.cpp \
+ kernel/qwidgetwindow_qpa.cpp \
+ kernel/qwindow.cpp
contains(QT_CONFIG, glib) {
SOURCES += \
@@ -263,7 +248,7 @@ qpa {
}
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
SOURCES += \
kernel/qclipboard_mac.cpp \
kernel/qmime_mac.cpp \
diff --git a/src/gui/kernel/mac.pri b/src/gui/kernel/mac.pri
index 21acd06e65..df457dd166 100644
--- a/src/gui/kernel/mac.pri
+++ b/src/gui/kernel/mac.pri
@@ -1,4 +1,4 @@
-!x11:!embedded:!qpa:mac {
+!x11:!qpa:mac {
LIBS_PRIVATE += -framework Carbon -lz
*-mwerks:INCLUDEPATH += compat
}
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 4096bf378b..08a6f540a8 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -64,17 +64,11 @@
#include "qdnd_p.h"
#include "qcolormap.h"
#include "qdebug.h"
-#include "private/qgraphicssystemfactory_p.h"
-#include "private/qgraphicssystem_p.h"
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qmessagebox.h"
#include <QtGui/qgraphicsproxywidget.h>
-#ifdef QT_GRAPHICSSYSTEM_RUNTIME
-#include "private/qgraphicssystem_runtime_p.h"
-#endif
-
#include "qinputcontext.h"
#include "qkeymapper_p.h"
@@ -172,7 +166,7 @@ bool QApplicationPrivate::autoSipEnabled = true;
#endif
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type, int flags)
- : QCoreApplicationPrivate(argc, argv, flags)
+ : QApplicationPrivateBase(argc, argv, flags)
{
application_type = type;
qt_appType = type;
@@ -453,15 +447,10 @@ QPalette *QApplicationPrivate::app_pal = 0; // default application palett
QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
-QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system
-#if defined(Q_WS_QPA)
-QPlatformIntegration *QApplicationPrivate::platform_integration = 0;
-#endif
-QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization
-bool QApplicationPrivate::runtime_graphics_system = false;
-
+#ifndef Q_WS_QPA
Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
QFont *QApplicationPrivate::app_font = 0; // default application font
+#endif
QFont *QApplicationPrivate::sys_font = 0; // default system font
QFont *QApplicationPrivate::set_font = 0; // default font set by programmer
@@ -491,7 +480,6 @@ static int drag_distance = 12; //XXX move to qplatformdefs.h
#else
static int drag_distance = QT_GUI_DRAG_DISTANCE;
#endif
-static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut
bool QApplicationPrivate::animate_ui = true;
bool QApplicationPrivate::animate_menu = false;
@@ -513,7 +501,6 @@ QWidget *QApplicationPrivate::oldEditFocus = 0;
#endif
bool qt_tabletChokeMouse = false;
-static bool force_reverse = false;
inline bool QApplicationPrivate::isAlien(QWidget *widget)
{
@@ -547,7 +534,7 @@ FontHash *qt_app_fonts_hash()
QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus
QDesktopWidget *qt_desktopWidget = 0; // root window widgets
-#ifndef QT_NO_CLIPBOARD
+#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
QClipboard *qt_clipboard = 0; // global clipboard object
#endif
QWidgetList * qt_modal_stack=0; // stack of modal widgets
@@ -601,15 +588,10 @@ void QApplicationPrivate::process_cmdline()
styleSheet = QLatin1String("file:///");
styleSheet.append(QString::fromLocal8Bit(arg.right(arg.length() - 12)));
#endif
- } else if (qstrcmp(arg, "-reverse") == 0) {
- force_reverse = true;
- QApplication::setLayoutDirection(Qt::RightToLeft);
} else if (qstrcmp(arg, "-widgetcount") == 0) {
widgetCount = true;
} else if (qstrcmp(arg, "-testability") == 0) {
load_testability = true;
- } else if (arg == "-graphicssystem" && i < argc-1) {
- graphics_system_name = QString::fromLocal8Bit(argv[++i]);
} else {
argv[j++] = argv[i];
}
@@ -679,8 +661,6 @@ void QApplicationPrivate::process_cmdline()
the same time
\o -reverse, sets the application's layout direction to
Qt::RightToLeft
- \o -graphicssystem, sets the backend to be used for on-screen widgets
- and QPixmaps. Available options are \c{raster} and \c{opengl}.
\o -qmljsdebugger=, activates the QML/JS debugger with a specified port.
The value must be of format port:1234[,block], where block is optional
and will make the application wait until a debugger connects to it.
@@ -729,11 +709,11 @@ void QApplicationPrivate::process_cmdline()
*/
QApplication::QApplication(int &argc, char **argv)
- : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000))
{ Q_D(QApplication); d->construct(); }
QApplication::QApplication(int &argc, char **argv, int _internal)
- : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, _internal))
{ Q_D(QApplication); d->construct(); }
@@ -763,11 +743,11 @@ QApplication::QApplication(int &argc, char **argv, int _internal)
*/
QApplication::QApplication(int &argc, char **argv, bool GUIenabled )
- : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, 0x040000))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, 0x040000))
{ Q_D(QApplication); d->construct(); }
QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _internal)
- : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, _internal))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, _internal))
{ Q_D(QApplication); d->construct();}
@@ -786,11 +766,11 @@ QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _intern
\c -qws option).
*/
QApplication::QApplication(int &argc, char **argv, Type type)
- : QCoreApplication(*new QApplicationPrivate(argc, argv, type, 0x040000))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, type, 0x040000))
{ Q_D(QApplication); d->construct(); }
QApplication::QApplication(int &argc, char **argv, Type type , int _internal)
- : QCoreApplication(*new QApplicationPrivate(argc, argv, type, _internal))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, type, _internal))
{ Q_D(QApplication); d->construct(); }
#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
@@ -814,21 +794,6 @@ void QApplicationPrivate::construct(
qt_is_gui_used = (qt_appType != QApplication::Tty);
process_cmdline();
- // the environment variable has the lowest precedence of runtime graphicssystem switches
- if (graphics_system_name.isEmpty())
- graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM"));
-
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
- if (graphics_system_name.isEmpty()) {
- bool linksWithMeeGoTouch = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libmeegotouchcore"));
- bool linksWithMeeGoGraphicsSystemHelper = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libQtMeeGoGraphicsSystemHelper"));
-
- if (linksWithMeeGoTouch && !linksWithMeeGoGraphicsSystemHelper) {
- qWarning("Running non-meego graphics system enabled MeeGo touch, forcing native graphicssystem\n");
- graphics_system_name = QLatin1String("native");
- }
- }
-#endif
// Must be called before initialize()
qt_init(this, qt_appType
@@ -897,7 +862,7 @@ static char *aargv[] = { (char*)"unknown", 0 };
This function is only available on X11.
*/
QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap)
- : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, 0x040000))
+ : QApplicationBase(*new QApplicationPrivate(aargc, aargv, GuiClient, 0x040000))
{
if (! dpy)
qWarning("QApplication: Invalid Display* argument");
@@ -906,7 +871,7 @@ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap)
}
QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, int _internal)
- : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, _internal))
+ : QApplicationBase(*new QApplicationPrivate(aargc, aargv, GuiClient, _internal))
{
if (! dpy)
qWarning("QApplication: Invalid Display* argument");
@@ -931,7 +896,7 @@ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap,
*/
QApplication::QApplication(Display *dpy, int &argc, char **argv,
Qt::HANDLE visual, Qt::HANDLE colormap)
- : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000))
{
if (! dpy)
qWarning("QApplication: Invalid Display* argument");
@@ -941,7 +906,7 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv,
QApplication::QApplication(Display *dpy, int &argc, char **argv,
Qt::HANDLE visual, Qt::HANDLE colormap, int _internal)
- : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal))
+ : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, _internal))
{
if (! dpy)
qWarning("QApplication: Invalid Display* argument");
@@ -971,14 +936,6 @@ void QApplicationPrivate::initialize()
QWidgetPrivate::mapper = new QWidgetMapper;
QWidgetPrivate::allWidgets = new QWidgetSet;
-#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA)
- // initialize the graphics system - on X11 this is initialized inside
- // qt_init() in qapplication_x11.cpp because of several reasons.
- // On QWS, the graphics system is set by the QScreen plugin.
- // We don't use graphics systems in Qt QPA
- graphics_system = QGraphicsSystemFactory::create(graphics_system_name);
-#endif
-
if (qt_appType != QApplication::Tty)
(void) QApplication::style(); // trigger creation of application style
// trigger registering of QVariant's GUI types
@@ -1087,7 +1044,7 @@ QApplication::~QApplication()
{
Q_D(QApplication);
-#ifndef QT_NO_CLIPBOARD
+#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
// flush clipboard contents
if (qt_clipboard) {
QEvent event(QEvent::Clipboard);
@@ -1102,8 +1059,10 @@ QApplication::~QApplication()
d->toolTipWakeUp.stop();
d->toolTipFallAsleep.stop();
+#if !defined(Q_WS_QPA)
d->eventDispatcher->closingDown();
d->eventDispatcher = 0;
+#endif
QApplicationPrivate::is_app_closing = true;
QApplicationPrivate::is_app_running = false;
@@ -1125,7 +1084,7 @@ QApplication::~QApplication()
delete qt_desktopWidget;
qt_desktopWidget = 0;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
delete qt_clipboard;
qt_clipboard = 0;
#endif
@@ -1147,11 +1106,14 @@ QApplication::~QApplication()
QApplicationPrivate::set_pal = 0;
app_palettes()->clear();
+#ifndef Q_WS_QPA
{
QMutexLocker locker(applicationFontMutex());
delete QApplicationPrivate::app_font;
QApplicationPrivate::app_font = 0;
}
+#endif
+
delete QApplicationPrivate::sys_font;
QApplicationPrivate::sys_font = 0;
delete QApplicationPrivate::set_font;
@@ -1162,8 +1124,6 @@ QApplication::~QApplication()
QApplicationPrivate::app_style = 0;
delete QApplicationPrivate::app_icon;
QApplicationPrivate::app_icon = 0;
- delete QApplicationPrivate::graphics_system;
- QApplicationPrivate::graphics_system = 0;
#ifndef QT_NO_CURSOR
d->cursor_list.clear();
#endif
@@ -1191,7 +1151,6 @@ QApplication::~QApplication()
drag_time = 500;
drag_distance = 4;
- layout_direction = Qt::LeftToRight;
QApplicationPrivate::app_strut = QSize(0, 0);
QApplicationPrivate::animate_ui = true;
QApplicationPrivate::animate_menu = false;
@@ -1316,7 +1275,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
}
return false;
}
- return QCoreApplication::compressEvent(event, receiver, postedEvents);
+ return QApplicationBase::compressEvent(event, receiver, postedEvents);
}
/*!
@@ -1624,46 +1583,6 @@ QStyle* QApplication::setStyle(const QString& style)
}
/*!
- \since 4.5
-
- Sets the default graphics backend to \a system, which will be used for
- on-screen widgets and QPixmaps. The available systems are \c{"native"},
- \c{"raster"} and \c{"opengl"}.
-
- There are several ways to set the graphics backend, in order of decreasing
- precedence:
- \list
- \o the application commandline \c{-graphicssystem} switch
- \o QApplication::setGraphicsSystem()
- \o the QT_GRAPHICSSYSTEM environment variable
- \o the Qt configure \c{-graphicssystem} switch
- \endlist
- If the highest precedence switch sets an invalid name, the error will be
- ignored and the default backend will be used.
-
- \warning This function is only effective before the QApplication constructor
- is called.
-
- \note The \c{"opengl"} option is currently experimental.
-*/
-
-void QApplication::setGraphicsSystem(const QString &system)
-{
-#ifdef Q_WS_QPA
- Q_UNUSED(system);
-#else
-# ifdef QT_GRAPHICSSYSTEM_RUNTIME
- if (QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) {
- QRuntimeGraphicsSystem *r =
- static_cast<QRuntimeGraphicsSystem *>(QApplicationPrivate::graphics_system);
- r->setGraphicsSystem(system);
- } else
-# endif
- QApplicationPrivate::graphics_system_name = system;
-#endif
-}
-
-/*!
Returns the color specification.
\sa QApplication::setColorSpec()
@@ -1941,10 +1860,14 @@ void QApplicationPrivate::setSystemPalette(const QPalette &pal)
*/
QFont QApplication::font()
{
+#ifndef Q_WS_QPA
QMutexLocker locker(applicationFontMutex());
if (!QApplicationPrivate::app_font)
QApplicationPrivate::app_font = new QFont(QLatin1String("Helvetica"));
return *QApplicationPrivate::app_font;
+#else
+ return QGuiApplication::font();
+#endif
}
/*!
@@ -2023,11 +1946,15 @@ void QApplication::setFont(const QFont &font, const char *className)
bool all = false;
FontHash *hash = app_fonts();
if (!className) {
+#ifndef Q_WS_QPA
QMutexLocker locker(applicationFontMutex());
if (!QApplicationPrivate::app_font)
QApplicationPrivate::app_font = new QFont(font);
else
*QApplicationPrivate::app_font = font;
+#else
+ QGuiApplication::setFont(font);
+#endif
if (hash && hash->size()) {
all = true;
hash->clear();
@@ -2391,27 +2318,8 @@ void QApplication::aboutQt()
\sa QWidget::setFocus(), QWidget::clearFocus(), Qt::FocusReason
*/
-/*!
- \since 4.5
- \fn void QApplication::fontDatabaseChanged()
-
- This signal is emitted when application fonts are loaded or removed.
-
- \sa QFontDatabase::addApplicationFont(),
- QFontDatabase::addApplicationFontFromData(),
- QFontDatabase::removeAllApplicationFonts(),
- QFontDatabase::removeApplicationFont()
-*/
#ifndef QT_NO_TRANSLATION
-static bool qt_detectRTLLanguage()
-{
- return force_reverse ^
- (QApplication::tr("QT_LAYOUT_DIRECTION",
- "Translate this string to the string 'LTR' in left-to-right"
- " languages or to 'RTL' in right-to-left languages (such as Hebrew"
- " and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
-}
#if defined(Q_WS_MAC)
static const char *application_menu_strings[] = {
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"),
@@ -2468,19 +2376,6 @@ bool QApplication::event(QEvent *e)
qt_abortFullScreenEffect();
#endif
}
- } else if(e->type() == QEvent::LanguageChange) {
-#ifndef QT_NO_TRANSLATION
- setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight);
-#endif
-#if defined(QT_MAC_USE_COCOA)
- qt_mac_post_retranslateAppMenu();
-#endif
- QWidgetList list = topLevelWidgets();
- for (int i = 0; i < list.size(); ++i) {
- QWidget *w = list.at(i);
- if (!(w->windowType() == Qt::Desktop))
- postEvent(w, new QEvent(QEvent::LanguageChange));
- }
#ifndef Q_OS_WIN
} else if (e->type() == QEvent::LocaleChange) {
// on Windows the event propagation is taken care by the
@@ -2521,7 +2416,20 @@ bool QApplication::event(QEvent *e)
d->toolTipFallAsleep.stop();
}
}
- return QCoreApplication::event(e);
+ return QApplicationBase::event(e);
+
+ if(e->type() == QEvent::LanguageChange) {
+#if defined(QT_MAC_USE_COCOA)
+ qt_mac_post_retranslateAppMenu();
+#endif
+ QWidgetList list = topLevelWidgets();
+ for (int i = 0; i < list.size(); ++i) {
+ QWidget *w = list.at(i);
+ if (!(w->windowType() == Qt::Desktop))
+ postEvent(w, new QEvent(QEvent::LanguageChange));
+ }
+ }
+
}
#if !defined(Q_WS_X11)
@@ -2531,6 +2439,18 @@ void QApplication::syncX() {} // do nothing
#endif
+void QApplicationPrivate::notifyLayoutDirectionChange()
+{
+ Q_Q(QApplication);
+ QWidgetList list = q->topLevelWidgets();
+ for (int i = 0; i < list.size(); ++i) {
+ QWidget *w = list.at(i);
+ QEvent ev(QEvent::ApplicationLayoutDirectionChange);
+ q->sendEvent(w, &ev);
+ }
+}
+
+
/*!
\fn Qt::WindowsVersion QApplication::winVersion()
@@ -2898,6 +2818,7 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget)
if (QApplication::activePopupWidget() == widget)
return false;
+#if 0
for (int i = 0; i < qt_modal_stack->size(); ++i) {
QWidget *modalWidget = qt_modal_stack->at(i);
@@ -2976,6 +2897,7 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget)
break;
}
}
+#endif
return false;
}
@@ -3259,7 +3181,7 @@ QDesktopWidget *QApplication::desktop()
return qt_desktopWidget;
}
-#ifndef QT_NO_CLIPBOARD
+#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
/*!
Returns a pointer to the application global clipboard.
@@ -3277,8 +3199,7 @@ QClipboard *QApplication::clipboard()
}
return qt_clipboard;
}
-#endif // QT_NO_CLIPBOARD
-
+#endif // Q_WS_QPA && QT_NO_CLIPBOARD
/*!
Sets whether Qt should use the system's standard colors, fonts, etc., to
\a on. By default, this is true.
@@ -3614,54 +3535,6 @@ int QApplication::startDragDistance()
Use layoutDirection() instead.
*/
-/*!
- \fn bool QApplication::isRightToLeft()
-
- Returns true if the application's layout direction is
- Qt::RightToLeft; otherwise returns false.
-
- \sa layoutDirection(), isLeftToRight()
-*/
-
-/*!
- \fn bool QApplication::isLeftToRight()
-
- Returns true if the application's layout direction is
- Qt::LeftToRight; otherwise returns false.
-
- \sa layoutDirection(), isRightToLeft()
-*/
-
-/*!
- \property QApplication::layoutDirection
- \brief the default layout direction for this application
-
- On system start-up, the default layout direction depends on the
- application's language.
-
- \sa QWidget::layoutDirection, isLeftToRight(), isRightToLeft()
- */
-
-void QApplication::setLayoutDirection(Qt::LayoutDirection direction)
-{
- if (layout_direction == direction || direction == Qt::LayoutDirectionAuto)
- return;
-
- layout_direction = direction;
-
- QWidgetList list = topLevelWidgets();
- for (int i = 0; i < list.size(); ++i) {
- QWidget *w = list.at(i);
- QEvent ev(QEvent::ApplicationLayoutDirectionChange);
- sendEvent(w, &ev);
- }
-}
-
-Qt::LayoutDirection QApplication::layoutDirection()
-{
- return layout_direction;
-}
-
/*!
\obsolete
@@ -3674,7 +3547,7 @@ Qt::LayoutDirection QApplication::layoutDirection()
#ifdef QT3_SUPPORT
Qt::Alignment QApplication::horizontalAlignment(Qt::Alignment align)
{
- return QStyle::visualAlignment(layoutDirection(), align);
+ return QGuiApplicationPrivate::visualAlignment(layoutDirection(), align);
}
#endif
@@ -3753,7 +3626,7 @@ int QApplication::exec()
#ifndef QT_NO_ACCESSIBILITY
QAccessible::setRootObject(qApp);
#endif
- return QCoreApplication::exec();
+ return QApplicationBase::exec();
}
/*! \reimp
@@ -5486,34 +5359,10 @@ uint QApplicationPrivate::currentPlatform(){
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
{
- return QCoreApplication::sendSpontaneousEvent(receiver, event);
+ return QApplicationBase::sendSpontaneousEvent(receiver, event);
}
-/*!
- \since 4.2
-
- Returns the current keyboard input locale.
-*/
-QLocale QApplication::keyboardInputLocale()
-{
- if (!QApplicationPrivate::checkInstance("keyboardInputLocale"))
- return QLocale::c();
- return qt_keymapper_private()->keyboardInputLocale;
-}
-
-/*!
- \since 4.2
-
- Returns the current keyboard input direction.
-*/
-Qt::LayoutDirection QApplication::keyboardInputDirection()
-{
- if (!QApplicationPrivate::checkInstance("keyboardInputDirection"))
- return Qt::LeftToRight;
- return qt_keymapper_private()->keyboardInputDirection;
-}
-
void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget,
Qt::FocusPolicy focusPolicy,
Qt::FocusReason focusReason)
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index fb61d36307..b045dc3788 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -58,6 +58,9 @@
# include <QtGui/qrgb.h>
# include <QtGui/qtransportauth_qws.h>
#endif
+#ifdef Q_WS_QPA
+# include <QtGui/qguiapplication.h>
+#endif
QT_BEGIN_HEADER
@@ -93,11 +96,15 @@ class QApplicationPrivate;
#endif
#define qApp (static_cast<QApplication *>(QCoreApplication::instance()))
+#ifdef Q_WS_QPA
+#define QApplicationBase QGuiApplication
+#else
+#define QApplicationBase QCoreApplication
+#endif
-class Q_GUI_EXPORT QApplication : public QCoreApplication
+class Q_GUI_EXPORT QApplication : public QApplicationBase
{
Q_OBJECT
- Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime)
Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval)
@@ -146,7 +153,8 @@ public:
enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 };
static int colorSpec();
static void setColorSpec(int);
- static void setGraphicsSystem(const QString &);
+ // ### Qt4 compatibility, remove?
+ static inline void setGraphicsSystem(const QString &) {}
#ifndef QT_NO_CURSOR
static QCursor *overrideCursor();
@@ -180,7 +188,7 @@ public:
static QWidget *activePopupWidget();
static QWidget *activeModalWidget();
-#ifndef QT_NO_CLIPBOARD
+#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD)
static QClipboard *clipboard();
#endif
static QWidget *focusWidget();
@@ -224,12 +232,6 @@ public:
static void setStartDragDistance(int l);
static int startDragDistance();
- static void setLayoutDirection(Qt::LayoutDirection direction);
- static Qt::LayoutDirection layoutDirection();
-
- static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
- static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
-
static bool isEffectEnabled(Qt::UIEffect);
static void setEffectEnabled(Qt::UIEffect, bool enable = true);
@@ -279,9 +281,6 @@ public:
QInputContext *inputContext() const;
#endif
- static QLocale keyboardInputLocale();
- static Qt::LayoutDirection keyboardInputDirection();
-
static int exec();
bool notify(QObject *, QEvent *);
@@ -400,7 +399,6 @@ private:
friend class QTextControl;
#endif
friend class QAction;
- friend class QFontDatabasePrivate;
#if defined(Q_WS_QWS)
friend class QInputContext;
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 954c6deb90..acad22d4a9 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -69,10 +69,6 @@
#include <private/qthread_p.h>
#include "QtCore/qpoint.h"
#include <QTime>
-#ifdef Q_WS_QWS
-#include "QtGui/qscreen_qws.h"
-#include <private/qgraphicssystem_qws_p.h>
-#endif
#ifdef Q_OS_SYMBIAN
#include <w32std.h>
#endif
@@ -80,13 +76,13 @@
#include <QWindowSystemInterface>
#include "qwindowsysteminterface_qpa_p.h"
#include "QtGui/qplatformintegration_qpa.h"
+#include "QtGui/private/qguiapplication_p.h"
#endif
QT_BEGIN_NAMESPACE
class QClipboard;
class QGraphicsScene;
-class QGraphicsSystem;
class QInputContext;
class QObject;
class QWidget;
@@ -294,13 +290,21 @@ FontHash *qt_app_fonts_hash();
typedef QHash<QByteArray, QPalette> PaletteHash;
PaletteHash *qt_app_palettes_hash();
-class Q_GUI_EXPORT QApplicationPrivate : public QCoreApplicationPrivate
+#ifdef Q_WS_QPA
+#define QApplicationPrivateBase QGuiApplicationPrivate
+#else
+#define QApplicationPrivateBase QCoreApplicationPrivate
+#endif
+
+class Q_GUI_EXPORT QApplicationPrivate : public QApplicationPrivateBase
{
Q_DECLARE_PUBLIC(QApplication)
public:
QApplicationPrivate(int &argc, char **argv, QApplication::Type type, int flags);
~QApplicationPrivate();
+ virtual void notifyLayoutDirectionChange();
+
#if defined(Q_WS_X11)
#ifndef QT_NO_SETTINGS
static bool x11_apply_settings();
@@ -318,20 +322,6 @@ public:
static bool autoSipEnabled;
static QString desktopStyleKey();
- static QGraphicsSystem *graphicsSystem()
-#if defined(Q_WS_QWS)
- { return QScreen::instance()->graphicsSystem(); }
-#else
- { return graphics_system; }
-#endif
-
-#if defined(Q_WS_QPA)
- static QPlatformIntegration *platformIntegration()
- { return platform_integration; }
-
- static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
- { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
-#endif
void createEventDispatcher();
QString appName() const;
@@ -430,15 +420,11 @@ public:
static QPalette *app_pal;
static QPalette *sys_pal;
static QPalette *set_pal;
- static QGraphicsSystem *graphics_system;
- static QString graphics_system_name;
- static bool runtime_graphics_system;
-#ifdef Q_WS_QPA
- static QPlatformIntegration *platform_integration;
-#endif
private:
+#ifndef Q_WS_QPA
static QFont *app_font; // private for a reason! Always use QApplication::font() instead!
+#endif
public:
static QFont *sys_font;
static QFont *set_font;
@@ -493,32 +479,6 @@ public:
static bool qt_mac_apply_settings();
#endif
-#ifdef Q_WS_QPA
- static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e);
- static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e);
- static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e);
- static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e);
-
- static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e);
-
- static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e);
-
- static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e);
- static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e);
-
- static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e);
-
- static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
-
-// static void reportScreenCount(int count);
- static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e);
-// static void reportGeometryChange(int screenIndex);
- static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
-// static void reportAvailableGeometryChange(int screenIndex);
- static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
-
-#endif
-
#ifdef Q_WS_QWS
QPointer<QWSManager> last_manager;
QWSServerCleaner qwsServerCleaner;
diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp
index b754cf7de8..1996bdaa13 100644
--- a/src/gui/kernel/qapplication_qpa.cpp
+++ b/src/gui/kernel/qapplication_qpa.cpp
@@ -71,71 +71,6 @@ QT_BEGIN_NAMESPACE
static QString appName;
static QString appFont;
-QWidget *qt_button_down = 0; // widget got last button-down
-
-static bool app_do_modal = false;
-extern QWidgetList *qt_modal_stack; // stack of modal widgets
-
-int qt_last_x = 0;
-int qt_last_y = 0;
-QPointer<QWidget> qt_last_mouse_receiver = 0;
-
-static Qt::MouseButtons buttons = Qt::NoButton;
-static ulong mousePressTime;
-static Qt::MouseButton mousePressButton = Qt::NoButton;
-static int mousePressX;
-static int mousePressY;
-static int mouse_double_click_distance = 5;
-
-void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
-{
- switch(e->type) {
- case QWindowSystemInterfacePrivate::Mouse:
- QApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterfacePrivate::MouseEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::Wheel:
- QApplicationPrivate::processWheelEvent(static_cast<QWindowSystemInterfacePrivate::WheelEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::Key:
- QApplicationPrivate::processKeyEvent(static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::Touch:
- QApplicationPrivate::processTouchEvent(static_cast<QWindowSystemInterfacePrivate::TouchEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::GeometryChange:
- QApplicationPrivate::processGeometryChangeEvent(static_cast<QWindowSystemInterfacePrivate::GeometryChangeEvent*>(e));
- break;
- case QWindowSystemInterfacePrivate::Enter:
- QApplicationPrivate::processEnterEvent(static_cast<QWindowSystemInterfacePrivate::EnterEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::Leave:
- QApplicationPrivate::processLeaveEvent(static_cast<QWindowSystemInterfacePrivate::LeaveEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::ActivatedWindow:
- QApplicationPrivate::processActivatedEvent(static_cast<QWindowSystemInterfacePrivate::ActivatedWindowEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::Close:
- QApplicationPrivate::processCloseEvent(
- static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::ScreenCountChange:
- QApplicationPrivate::reportScreenCount(
- static_cast<QWindowSystemInterfacePrivate::ScreenCountEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::ScreenGeometry:
- QApplicationPrivate::reportGeometryChange(
- static_cast<QWindowSystemInterfacePrivate::ScreenGeometryEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::ScreenAvailableGeometry:
- QApplicationPrivate::reportAvailableGeometryChange(
- static_cast<QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *>(e));
- break;
- default:
- qWarning() << "Unknown user input event type:" << e->type;
- break;
- }
-}
-
QString QApplicationPrivate::appName() const
{
return QT_PREPEND_NAMESPACE(appName);
@@ -143,13 +78,7 @@ QString QApplicationPrivate::appName() const
void QApplicationPrivate::createEventDispatcher()
{
- Q_Q(QApplication);
-#if !defined(QT_NO_GLIB)
- if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported())
- eventDispatcher = new QPAEventDispatcherGlib(q);
- else
-#endif
- eventDispatcher = new QEventDispatcherQPA(q);
+ QGuiApplicationPrivate::createEventDispatcher();
}
static bool qt_try_modal(QWidget *widget, QEvent::Type type)
@@ -188,16 +117,19 @@ static bool qt_try_modal(QWidget *widget, QEvent::Type type)
-void QApplicationPrivate::enterModal_sys(QWidget *widget)
+void QApplicationPrivate::enterModal_sys(QWidget *)
{
+#if 0
if (!qt_modal_stack)
qt_modal_stack = new QWidgetList;
qt_modal_stack->insert(0, widget);
app_do_modal = true;
+#endif
}
-void QApplicationPrivate::leaveModal_sys(QWidget *widget )
+void QApplicationPrivate::leaveModal_sys(QWidget *)
{
+#if 0
if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
if (qt_modal_stack->isEmpty()) {
delete qt_modal_stack;
@@ -205,11 +137,15 @@ void QApplicationPrivate::leaveModal_sys(QWidget *widget )
}
}
app_do_modal = qt_modal_stack != 0;
+#endif
}
bool QApplicationPrivate::modalState()
{
+ return false;
+#if 0
return app_do_modal;
+#endif
}
void QApplicationPrivate::closePopup(QWidget *popup)
@@ -416,7 +352,7 @@ void QApplication::restoreOverrideCursor()
QWidget *QApplication::topLevelAt(const QPoint &pos)
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
QList<QPlatformScreen *>::const_iterator screen = screens.constBegin();
@@ -446,49 +382,10 @@ void QApplication::alert(QWidget *, int)
QPlatformNativeInterface *QApplication::platformNativeInterface()
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return pi->nativeInterface();
}
-static void init_platform(const QString &name, const QString &platformPluginPath)
-{
- QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath);
- if (!QApplicationPrivate::platform_integration) {
- QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
- QString fatalMessage =
- QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name);
- foreach(QString key, keys) {
- fatalMessage.append(key + QString::fromLatin1("\n"));
- }
- qFatal("%s", fatalMessage.toLocal8Bit().constData());
-
- }
-
-}
-
-
-static void cleanup_platform()
-{
- delete QApplicationPrivate::platform_integration;
- QApplicationPrivate::platform_integration = 0;
-}
-
-static void init_plugins(const QList<QByteArray> pluginList)
-{
- for (int i = 0; i < pluginList.count(); ++i) {
- QByteArray pluginSpec = pluginList.at(i);
- qDebug() << "init_plugins" << i << pluginSpec;
- int colonPos = pluginSpec.indexOf(':');
- QObject *plugin;
- if (colonPos < 0)
- plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString());
- else
- plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)),
- QLatin1String(pluginSpec.mid(colonPos+1)));
- qDebug() << " created" << plugin;
- }
-}
-
#ifndef QT_NO_QWS_INPUTMETHODS
class QDummyInputContext : public QInputContext
{
@@ -504,74 +401,12 @@ public:
};
#endif // QT_NO_QWS_INPUTMETHODS
-void qt_init(QApplicationPrivate *priv, int type)
+void qt_init(QApplicationPrivate *, int type)
{
Q_UNUSED(type);
qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
- char *p;
- char **argv = priv->argv;
- int argc = priv->argc;
-
- if (argv && *argv) { //apparently, we allow people to pass 0 on the other platforms
- p = strrchr(argv[0], '/');
- appName = QString::fromLocal8Bit(p ? p + 1 : argv[0]);
- }
-
- QList<QByteArray> pluginList;
- QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
- QByteArray platformName;
-#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
- platformName = QT_QPA_DEFAULT_PLATFORM_NAME;
-#endif
- QByteArray platformNameEnv = qgetenv("QT_QPA_PLATFORM");
- if (!platformNameEnv.isEmpty()) {
- platformName = platformNameEnv;
- }
-
- // Get command line params
-
- int j = argc ? 1 : 0;
- for (int i=1; i<argc; i++) {
- if (argv[i] && *argv[i] != '-') {
- argv[j++] = argv[i];
- continue;
- }
- QByteArray arg = argv[i];
- if (arg == "-fn" || arg == "-font") {
- if (++i < argc)
- appFont = QString::fromLocal8Bit(argv[i]);
- } else if (arg == "-platformpluginpath") {
- if (++i < argc)
- platformPluginPath = QLatin1String(argv[i]);
- } else if (arg == "-platform") {
- if (++i < argc)
- platformName = argv[i];
- } else if (arg == "-plugin") {
- if (++i < argc)
- pluginList << argv[i];
- } else {
- argv[j++] = argv[i];
- }
- }
-
- if (j < priv->argc) {
- priv->argv[j] = 0;
- priv->argc = j;
- }
-
-#if 0
- QByteArray pluginEnv = qgetenv("QT_QPA_PLUGINS");
- if (!pluginEnv.isEmpty()) {
- pluginList.append(pluginEnv.split(';'));
- }
-#endif
-
- init_platform(QLatin1String(platformName), platformPluginPath);
- init_plugins(pluginList);
-
QColormap::initialize();
- QFont::initialize();
#ifndef QT_NO_CURSOR
// QCursorData::initialize();
#endif
@@ -585,13 +420,10 @@ void qt_init(QApplicationPrivate *priv, int type)
void qt_cleanup()
{
- cleanup_platform();
-
QPixmapCache::clear();
#ifndef QT_NO_CURSOR
QCursorData::cleanup();
#endif
- QFont::cleanup();
QColormap::cleanup();
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = 0;
@@ -610,356 +442,4 @@ void QApplication::setMainWidget(QWidget *mainWidget)
}
#endif
-void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e)
-{
- // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons();
- static QWeakPointer<QWidget> implicit_mouse_grabber;
-
- QEvent::Type type;
- // move first
- Qt::MouseButtons stateChange = e->buttons ^ buttons;
- if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
- QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent =
- new QWindowSystemInterfacePrivate::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons);
- QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop
- stateChange = Qt::NoButton;
- }
-
- QWidget * tlw = e->widget.data();
-
- QPoint localPoint = e->localPos;
- QPoint globalPoint = e->globalPos;
- QWidget *mouseWindow = tlw;
-
- Qt::MouseButton button = Qt::NoButton;
-
-
- if (qt_last_x != globalPoint.x() || qt_last_y != globalPoint.y()) {
- type = QEvent::MouseMove;
- qt_last_x = globalPoint.x();
- qt_last_y = globalPoint.y();
- if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
- qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
- mousePressButton = Qt::NoButton;
- }
- else { // check to see if a new button has been pressed/released
- for (int check = Qt::LeftButton;
- check <= Qt::XButton2;
- check = check << 1) {
- if (check & stateChange) {
- button = Qt::MouseButton(check);
- break;
- }
- }
- if (button == Qt::NoButton) {
- // Ignore mouse events that don't change the current state
- return;
- }
- buttons = e->buttons;
- if (button & e->buttons) {
- if ((e->timestamp - mousePressTime) < static_cast<ulong>(QApplication::doubleClickInterval()) && button == mousePressButton) {
- type = QEvent::MouseButtonDblClick;
- mousePressButton = Qt::NoButton;
- }
- else {
- type = QEvent::MouseButtonPress;
- mousePressTime = e->timestamp;
- mousePressButton = button;
- mousePressX = qt_last_x;
- mousePressY = qt_last_y;
- }
- }
- else
- type = QEvent::MouseButtonRelease;
- }
-
- if (self->inPopupMode()) {
- //popup mouse handling is magical...
- mouseWindow = qApp->activePopupWidget();
-
- implicit_mouse_grabber.clear();
- //### how should popup mode and implicit mouse grab interact?
-
- } else if (tlw && app_do_modal && !qt_try_modal(tlw, QEvent::MouseButtonRelease) ) {
- //even if we're blocked by modality, we should deliver the mouse release event..
- //### this code is not completely correct: multiple buttons can be pressed simultaneously
- if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) {
- //qDebug() << "modal blocked mouse event to" << tlw;
- return;
- }
- }
-
- // find the tlw if we didn't get it from the plugin
- if (!mouseWindow) {
- mouseWindow = QApplication::topLevelAt(globalPoint);
- }
-
- if (!mouseWindow && !implicit_mouse_grabber)
- mouseWindow = QApplication::desktop();
-
- if (mouseWindow && mouseWindow != tlw) {
- //we did not get a sensible localPoint from the window system, so let's calculate it
- localPoint = mouseWindow->mapFromGlobal(globalPoint);
- }
-
- // which child should have it?
- QWidget *mouseWidget = mouseWindow;
- if (mouseWindow) {
- QWidget *w = mouseWindow->childAt(localPoint);
- if (w) {
- mouseWidget = w;
- }
- }
-
- //handle implicit mouse grab
- if (type == QEvent::MouseButtonPress && !implicit_mouse_grabber) {
- implicit_mouse_grabber = mouseWidget;
-
- Q_ASSERT(mouseWindow);
- mouseWindow->activateWindow(); //focus
- } else if (implicit_mouse_grabber) {
- mouseWidget = implicit_mouse_grabber.data();
- mouseWindow = mouseWidget->window();
- if (mouseWindow != tlw)
- localPoint = mouseWindow->mapFromGlobal(globalPoint);
- }
-
- Q_ASSERT(mouseWidget);
-
- //localPoint is local to mouseWindow, but it needs to be local to mouseWidget
- localPoint = mouseWidget->mapFrom(mouseWindow, localPoint);
-
- if (buttons == Qt::NoButton) {
- //qDebug() << "resetting mouse grabber";
- implicit_mouse_grabber.clear();
- }
-
- if (mouseWidget != qt_last_mouse_receiver) {
- dispatchEnterLeave(mouseWidget, qt_last_mouse_receiver);
- qt_last_mouse_receiver = mouseWidget;
- }
-
- // Remember, we might enter a modal event loop when sending the event,
- // so think carefully before adding code below this point.
-
- // qDebug() << "sending mouse ev." << ev.type() << localPoint << globalPoint << ev.button() << ev.buttons() << mouseWidget << "mouse grabber" << implicit_mouse_grabber;
-
- QMouseEvent ev(type, localPoint, globalPoint, button, buttons, QApplication::keyboardModifiers());
-
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- foreach (QWeakPointer<QPlatformCursor> cursor, cursors) {
- if (cursor)
- cursor.data()->pointerEvent(ev);
- }
-
- int oldOpenPopupCount = openPopupCount;
- QApplication::sendSpontaneousEvent(mouseWidget, &ev);
-
-#ifndef QT_NO_CONTEXTMENU
- if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) {
- QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, QApplication::keyboardModifiers());
- QApplication::sendSpontaneousEvent(mouseWidget, &e);
- }
-#endif // QT_NO_CONTEXTMENU
-}
-
-
-//### there's a lot of duplicated logic here -- refactoring required!
-
-void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
-{
-// QPoint localPoint = ev.pos();
- QPoint globalPoint = e->globalPos;
-// bool trustLocalPoint = !!tlw; //is there something the local point can be local to?
- QWidget *mouseWidget;
-
- qt_last_x = globalPoint.x();
- qt_last_y = globalPoint.y();
-
- QWidget *mouseWindow = e->widget.data();
-
- // find the tlw if we didn't get it from the plugin
- if (!mouseWindow) {
- mouseWindow = QApplication::topLevelAt(globalPoint);
- }
-
- if (!mouseWindow)
- return;
-
- mouseWidget = mouseWindow;
-
- if (app_do_modal && !qt_try_modal(mouseWindow, QEvent::Wheel) ) {
- qDebug() << "modal blocked wheel event" << mouseWindow;
- return;
- }
- QPoint p = mouseWindow->mapFromGlobal(globalPoint);
- QWidget *w = mouseWindow->childAt(p);
- if (w) {
- mouseWidget = w;
- p = mouseWidget->mapFromGlobal(globalPoint);
- }
-
- QWheelEvent ev(p, globalPoint, e->delta, buttons, QApplication::keyboardModifiers(),
- e->orient);
- QApplication::sendSpontaneousEvent(mouseWidget, &ev);
-}
-
-
-
-// Remember, Qt convention is: keyboard state is state *before*
-
-void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
-{
- QWidget *focusW = 0;
- if (self->inPopupMode()) {
- QWidget *popupW = qApp->activePopupWidget();
- focusW = popupW->focusWidget() ? popupW->focusWidget() : popupW;
- }
- if (!focusW)
- focusW = QApplication::focusWidget();
- if (!focusW) {
- focusW = e->widget.data();
- }
- if (!focusW)
- focusW = QApplication::activeWindow();
-
- //qDebug() << "handleKeyEvent" << hex << e->key() << e->modifiers() << e->text() << "widget" << focusW;
-
- if (!focusW)
- return;
- if (app_do_modal && !qt_try_modal(focusW, e->keyType))
- return;
-
- if (e->nativeScanCode || e->nativeVirtualKey || e->nativeModifiers) {
- QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount,
- e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers);
- QApplication::sendSpontaneousEvent(focusW, &ev);
- } else {
- QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount);
- QApplication::sendSpontaneousEvent(focusW, &ev);
- }
-}
-
-void QApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e)
-{
- QApplicationPrivate::dispatchEnterLeave(e->enter.data(),0);
- qt_last_mouse_receiver = e->enter.data();
-}
-
-void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e)
-{
- QApplicationPrivate::dispatchEnterLeave(0,qt_last_mouse_receiver);
-
- if (e->leave.data() && !e->leave.data()->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen
- QApplicationPrivate::dispatchEnterLeave(0, e->leave.data());
- qt_last_mouse_receiver = 0;
-
-}
-
-void QApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e)
-{
- QApplication::setActiveWindow(e->activated.data());
-}
-
-void QApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e)
-{
- if (e->tlw.isNull())
- return;
- QWidget *tlw = e->tlw.data();
- if (!tlw->isWindow())
- return; //geo of native child widgets is controlled by lighthouse
- //so we already have sent the events; besides this new rect
- //is not mapped to parent
-
- QRect newRect = e->newGeometry;
- QRect cr(tlw->geometry());
- bool isResize = cr.size() != newRect.size();
- bool isMove = cr.topLeft() != newRect.topLeft();
- tlw->data->crect = newRect;
- if (isResize) {
- QResizeEvent e(tlw->data->crect.size(), cr.size());
- QApplication::sendSpontaneousEvent(tlw, &e);
- tlw->update();
- }
-
- if (isMove) {
- //### frame geometry
- QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft());
- QApplication::sendSpontaneousEvent(tlw, &e);
- }
-}
-
-void QApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e)
-{
- if (e->topLevel.isNull()) {
- //qDebug() << "QApplicationPrivate::processCloseEvent NULL";
- return;
- }
- e->topLevel.data()->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
-}
-
-void QApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
-{
- translateRawTouchEvent(e->widget.data(), e->devType, e->points);
-}
-
-void QApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e)
-{
- // This operation only makes sense after the QApplication constructor runs
- if (QCoreApplication::startingUp())
- return;
-
- QApplication::desktop()->d_func()->updateScreenList();
- // signal anything listening for creation or deletion of screens
- QDesktopWidget *desktop = QApplication::desktop();
- emit desktop->screenCountChanged(e->count);
-}
-
-void QApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e)
-{
- // This operation only makes sense after the QApplication constructor runs
- if (QCoreApplication::startingUp())
- return;
-
- QApplication::desktop()->d_func()->updateScreenList();
-
- // signal anything listening for screen geometry changes
- QDesktopWidget *desktop = QApplication::desktop();
- emit desktop->resized(e->index);
-
- // make sure maximized and fullscreen windows are updated
- QWidgetList list = QApplication::topLevelWidgets();
- for (int i = list.size() - 1; i >= 0; --i) {
- QWidget *w = list.at(i);
- if (w->isFullScreen())
- w->d_func()->setFullScreenSize_helper();
- else if (w->isMaximized())
- w->d_func()->setMaxWindowState_helper();
- }
-}
-
-void QApplicationPrivate::reportAvailableGeometryChange(
- QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e)
-{
- // This operation only makes sense after the QApplication constructor runs
- if (QCoreApplication::startingUp())
- return;
-
- QApplication::desktop()->d_func()->updateScreenList();
-
- // signal anything listening for screen geometry changes
- QDesktopWidget *desktop = QApplication::desktop();
- emit desktop->workAreaResized(e->index);
-
- // make sure maximized and fullscreen windows are updated
- QWidgetList list = QApplication::topLevelWidgets();
- for (int i = list.size() - 1; i >= 0; --i) {
- QWidget *w = list.at(i);
- if (w->isFullScreen())
- w->d_func()->setFullScreenSize_helper();
- else if (w->isMaximized())
- w->d_func()->setMaxWindowState_helper();
- }
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
deleted file mode 100644
index 642d3e6afc..0000000000
--- a/src/gui/kernel/qapplication_qws.cpp
+++ /dev/null
@@ -1,3797 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglobal.h"
-#include "qlibrary.h"
-#include "qcursor.h"
-#include "qapplication.h"
-#include "private/qapplication_p.h"
-#include "qwidget.h"
-#include "qbitarray.h"
-#include "qpainter.h"
-#include "qpixmapcache.h"
-#include "qdatetime.h"
-#include "qtextcodec.h"
-#include "qdatastream.h"
-#include "qbuffer.h"
-#include "qsocketnotifier.h"
-#include "qsessionmanager.h"
-#include "qclipboard.h"
-#include "qbitmap.h"
-#include "qwssocket_qws.h"
-#include "qtransportauth_qws.h"
-#include "private/qtransportauth_qws_p.h"
-#include "qwsevent_qws.h"
-#include "private/qwscommand_qws_p.h"
-#include "qwsproperty_qws.h"
-#include "qscreen_qws.h"
-#include "qscreenproxy_qws.h"
-#include "qcopchannel_qws.h"
-#include "private/qlock_p.h"
-#include "private/qwslock_p.h"
-//#include "qmemorymanager_qws.h"
-#include "qwsmanager_qws.h"
-//#include "qwsregionmanager_qws.h"
-#include "qwindowsystem_qws.h"
-#include "private/qwindowsystem_p.h"
-#include "qdecorationfactory_qws.h"
-
-#include "qwsdisplay_qws.h"
-#include "private/qwsdisplay_qws_p.h"
-#include "private/qwsinputcontext_p.h"
-#include "qfile.h"
-#include "qhash.h"
-#include "qdesktopwidget.h"
-#include "qcolormap.h"
-#include "private/qcursor_p.h"
-#include "qsettings.h"
-#include "qdebug.h"
-#include "qeventdispatcher_qws_p.h"
-#if !defined(QT_NO_GLIB)
-# include "qeventdispatcher_glib_qws_p.h"
-#endif
-
-
-#include "private/qwidget_p.h"
-#include "private/qbackingstore_p.h"
-#include "private/qwindowsurface_qws_p.h"
-#include "private/qfont_p.h"
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <errno.h>
-#include <fcntl.h>
-#ifdef Q_OS_VXWORKS
-# include <sys/times.h>
-#else
-# include <sys/time.h>
-#endif
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <qvfbhdr.h>
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-#ifdef QT_NO_QSHM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#ifndef Q_OS_DARWIN
-# include <sys/sem.h>
-#endif
-#include <sys/socket.h>
-#else
-#include "private/qwssharedmemory_p.h"
-#endif
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_DIRECTPAINTER
-class QDirectPainter;
-extern void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type);
-#ifndef QT_NO_QWSEMBEDWIDGET
-extern void qt_directpainter_embedevent(QDirectPainter *dp,
- const QWSEmbedEvent *e);
-#endif
-#endif // QT_NO_DIRECTPAINTER
-
-const int qwsSharedRamSize = 1 * 1024; // misc data, written by server, read by clients
-
-extern QApplication::Type qt_appType;
-extern QDesktopWidget *qt_desktopWidget;
-
-//these used to be environment variables, they are initialized from
-//environment variables in
-
-bool qws_savefonts = false;
-bool qws_screen_is_interlaced=false; //### should be detected
-bool qws_shared_memory = false;
-bool qws_sw_cursor = true;
-bool qws_accel = true; // ### never set
-QByteArray qws_display_spec(":0");
-Q_GUI_EXPORT int qws_display_id = 0;
-Q_GUI_EXPORT int qws_client_id = 0;
-QWidget *qt_pressGrab = 0;
-QWidget *qt_mouseGrb = 0;
-int *qt_last_x = 0;
-int *qt_last_y = 0;
-
-static int mouse_x_root = -1;
-static int mouse_y_root = -1;
-static int mouse_state = 0;
-static int mouse_double_click_distance = 5;
-
-int qt_servershmid = -1;
-
-bool qws_overrideCursor = false;
-#ifndef QT_NO_QWS_MANAGER
-
-extern Q_GUI_EXPORT QWSServer *qwsServer;
-
-static QDecoration *qws_decoration = 0;
-#endif
-
-#if defined(QT_DEBUG)
-/*
-extern "C" void dumpmem(const char* m)
-{
- static int init=0;
- static int prev=0;
- FILE* f = fopen("/proc/meminfo","r");
- // char line[100];
- int total=0,used=0,free=0,shared=0,buffers=0,cached=0;
- fscanf(f,"%*[^M]Mem: %d %d %d %d %d %d",&total,&used,&free,&shared,&buffers,&cached);
- used -= buffers + cached;
- if (!init) {
- init=used;
- } else {
- printf("%40s: %+8d = %8d\n",m,used-init-prev,used-init);
- prev = used-init;
- }
- fclose(f);
-}
-*/
-#endif
-
-// Get the name of the directory where Qt for Embedded Linux temporary data should
-// live.
-QString qws_dataDir()
-{
- static QString result;
- if (!result.isEmpty())
- return result;
- result = QT_VFB_DATADIR(qws_display_id);
- QByteArray dataDir = result.toLocal8Bit();
-
-#if defined(Q_OS_INTEGRITY)
- /* ensure filesystem is ready before starting requests */
- WaitForFileSystemInitialization();
-#endif
-
- if (QT_MKDIR(dataDir, 0700)) {
- if (errno != EEXIST) {
- qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData());
- }
- }
-
- QT_STATBUF buf;
- if (QT_LSTAT(dataDir, &buf))
- qFatal("stat failed for Qt for Embedded Linux data directory: %s", dataDir.constData());
-
- if (!S_ISDIR(buf.st_mode))
- qFatal("%s is not a directory", dataDir.constData());
-
-#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS)
- if (buf.st_uid != getuid())
- qFatal("Qt for Embedded Linux data directory is not owned by user %d", getuid());
-
- if ((buf.st_mode & 0677) != 0600)
- qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData());
-#endif
-
- result.append("/");
- return result;
-}
-
-// Get the filename of the pipe Qt for Embedded Linux uses for server/client comms
-Q_GUI_EXPORT QString qws_qtePipeFilename()
-{
- qws_dataDir();
- return QTE_PIPE(qws_display_id);
-}
-
-static void setMaxWindowRect(const QRect &rect)
-{
- const QList<QScreen*> subScreens = qt_screen->subScreens();
- QScreen *screen = qt_screen;
- int screenNo = 0;
- for (int i = 0; i < subScreens.size(); ++i) {
- if (subScreens.at(i)->region().contains(rect)) {
- screen = subScreens.at(i);
- screenNo = i;
- break;
- }
- }
-
- QApplicationPrivate *ap = QApplicationPrivate::instance();
- ap->setMaxWindowRect(screen, screenNo, rect);
-}
-
-void QApplicationPrivate::setMaxWindowRect(const QScreen *screen, int screenNo,
- const QRect &rect)
-{
- if (maxWindowRects.value(screen) == rect)
- return;
-
- maxWindowRects[screen] = rect;
-
- // Re-resize any maximized windows
- QWidgetList l = QApplication::topLevelWidgets();
- for (int i = 0; i < l.size(); ++i) {
- QWidget *w = l.at(i);
- QScreen *s = w->d_func()->getScreen();
- if (w->isMaximized() && s == screen)
- w->d_func()->setMaxWindowState_helper();
- }
-
- if ( qt_desktopWidget ) // XXX workaround crash
- emit QApplication::desktop()->workAreaResized(screenNo);
-}
-
-#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
-
-typedef void (*TransformFunc)(QScreen *, int);
-#ifndef QT_NO_QWS_TRANSFORMED
-extern "C" void qws_setScreenTransformation(QScreen *, int);
-#endif
-static TransformFunc getTransformationFunction()
-{
- static TransformFunc func = 0;
-
- if (!func) {
-#ifdef QT_NO_QWS_TRANSFORMED
-# ifndef QT_NO_LIBRARY
- // symbol is not built into the library, search for the plugin
- const QStringList paths = QApplication::libraryPaths();
- foreach (const QString &path, paths) {
- const QString file = path + QLatin1String("/gfxdrivers/libqgfxtransformed");
- func = (TransformFunc)QLibrary::resolve(file,
- "qws_setScreenTransformation");
- if (func)
- break;
- }
-# endif
-#else
- func = qws_setScreenTransformation;
-#endif
- if (!func)
- func = (TransformFunc)-1;
- }
-
- if (func == (TransformFunc)-1)
- return 0;
-
- return func;
-}
-
-static void setScreenTransformation(int screenNo, int transformation)
-{
- QScreen *screen = QScreen::instance();
- const QList<QScreen*> subScreens = screen->subScreens();
-
- if (screenNo == -1)
- screenNo = 0;
-
- if (screenNo == -1 && !subScreens.isEmpty())
- screenNo = 0;
-
- if (subScreens.isEmpty() && screenNo == 0) {
- // nothing
- } else if (screenNo < 0 || screenNo >= subScreens.size()) {
- qWarning("setScreenTransformation: invalid screen %i", screenNo);
- return;
- }
-
- if (screenNo < subScreens.size())
- screen = subScreens.at(screenNo);
-
- QApplicationPrivate *ap = QApplicationPrivate::instance();
- ap->setScreenTransformation(screen, screenNo, transformation);
-}
-
-void QApplicationPrivate::setScreenTransformation(QScreen *screen,
- int screenNo,
- int transformation)
-{
- QScreen *transformed = screen;
-
- while (transformed->classId() == QScreen::ProxyClass)
- transformed = static_cast<QProxyScreen*>(transformed)->screen();
-
- if (transformed->classId() != QScreen::TransformedClass)
- return;
-
- TransformFunc setScreenTransformation = getTransformationFunction();
- if (!setScreenTransformation)
- return;
-
- setScreenTransformation(transformed, transformation);
-
- // need to re-configure() proxies bottom-up
- if (screen->classId() == QScreen::ProxyClass) {
- QList<QProxyScreen*> proxies;
- QScreen *s = screen;
-
- do {
- QProxyScreen *proxy = static_cast<QProxyScreen*>(s);
- proxies.append(proxy);
- s = proxy->screen();
- } while (s->classId() == QScreen::ProxyClass);
-
- do {
- QProxyScreen *proxy = proxies.takeLast();
- proxy->setScreen(proxy->screen()); // triggers configure()
- } while (!proxies.isEmpty());
- }
-
- if (qt_desktopWidget) { // XXX workaround crash for early screen transform events
- QDesktopWidget *desktop = QApplication::desktop();
-
- emit desktop->resized(screenNo);
- if (maxWindowRect(screen).isEmpty()) // not explicitly set
- emit desktop->workAreaResized(screenNo);
- }
-
- QWSServer *server = QWSServer::instance();
- if (server) {
- server->updateWindowRegions();
- QRegion r = screen->region();
- server->refresh(r);
- }
-
- // make sure maximized and fullscreen windows are updated
- QWidgetList list = QApplication::topLevelWidgets();
- for (int i = list.size() - 1; i >= 0; --i) {
- QWidget *w = list.at(i);
- if (w->isFullScreen())
- w->d_func()->setFullScreenSize_helper();
- else if (w->isMaximized())
- w->d_func()->setMaxWindowState_helper();
- }
-}
-
-#endif // QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
-
-/*****************************************************************************
- Internal variables and functions
- *****************************************************************************/
-
-
-static QString appName; // application name
-static const char *appFont = 0; // application font
-static const char *appBGCol = 0; // application bg color
-static const char *appFGCol = 0; // application fg color
-static const char *appBTNCol = 0; // application btn color
-static const char *mwGeometry = 0; // main widget geometry
-static const char *mwTitle = 0; // main widget title
-//static bool mwIconic = false; // main widget iconified
-
-static bool app_do_modal = false; // modal mode
-Q_GUI_EXPORT QWSDisplay *qt_fbdpy = 0; // QWS `display'
-QLock *QWSDisplay::lock = 0;
-
-static int mouseButtonPressed = 0; // last mouse button pressed
-static int mouseButtonPressTime = 0; // when was a button pressed
-static short mouseXPos, mouseYPos; // mouse position in act window
-
-extern QWidgetList *qt_modal_stack; // stack of modal widgets
-
-static QWidget *popupButtonFocus = 0;
-static QWidget *popupOfPopupButtonFocus = 0;
-static bool popupCloseDownMode = false;
-static bool popupGrabOk;
-static QPointer<QWidget> *mouseInWidget = 0;
-QPointer<QWidget> qt_last_mouse_receiver = 0;
-
-static bool sm_blockUserInput = false; // session management
-
-QWidget *qt_button_down = 0; // widget got last button-down
-WId qt_last_cursor = 0xffffffff; // Was -1, but WIds are unsigned
-
-class QWSMouseEvent;
-class QWSKeyEvent;
-
-class QETWidget : public QWidget // event translator widget
-{
-public:
- bool translateMouseEvent(const QWSMouseEvent *, int oldstate);
- bool translateKeyEvent(const QWSKeyEvent *, bool grab);
- bool translateRegionEvent(const QWSRegionEvent *);
-#ifndef QT_NO_QWSEMBEDWIDGET
- void translateEmbedEvent(const QWSEmbedEvent *event);
-#endif
- bool translateWheelEvent(const QWSMouseEvent *me);
- void repaintDecoration(QRegion r, bool post);
- void updateRegion();
-
- bool raiseOnClick()
- {
- // With limited windowmanagement/taskbar/etc., raising big windows
- // (eg. spreadsheet) over the top of everything else (eg. calculator)
- // is just annoying.
- return !isMaximized() && !isFullScreen();
- }
-};
-
-void QApplicationPrivate::createEventDispatcher()
-{
- Q_Q(QApplication);
-#if !defined(QT_NO_GLIB)
- if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported())
- eventDispatcher = (q->type() != QApplication::Tty
- ? new QWSEventDispatcherGlib(q)
- : new QEventDispatcherGlib(q));
- else
-#endif
- eventDispatcher = (q->type() != QApplication::Tty
- ? new QEventDispatcherQWS(q)
- : new QEventDispatcherUNIX(q));
-}
-
-// Single-process stuff. This should maybe move into qwindowsystem_qws.cpp
-
-static bool qws_single_process;
-static QList<QWSEvent*> incoming;
-static QList<QWSCommand*> outgoing;
-
-void qt_client_enqueue(const QWSEvent *event)
-{
- QWSEvent *copy = QWSEvent::factory(event->type);
- copy->copyFrom(event);
- incoming.append(copy);
-}
-
-QList<QWSCommand*> *qt_get_server_queue()
-{
- return &outgoing;
-}
-
-void qt_server_enqueue(const QWSCommand *command)
-{
- QWSCommand *copy = QWSCommand::factory(command->type);
- QT_TRY {
- copy->copyFrom(command);
- outgoing.append(copy);
- } QT_CATCH(...) {
- delete copy;
- QT_RETHROW;
- }
-}
-
-QWSDisplay::Data::Data(QObject* parent, bool singleProcess)
-{
-#ifdef QT_NO_QWS_MULTIPROCESS
- Q_UNUSED(parent);
- Q_UNUSED(singleProcess);
-#else
- if (singleProcess)
- csocket = 0;
- else {
- csocket = new QWSSocket(parent);
- QObject::connect(csocket, SIGNAL(disconnected()),
- qApp, SLOT(quit()));
- }
- clientLock = 0;
-#endif
- init();
-}
-
-QWSDisplay::Data::~Data()
-{
-// delete rgnMan; rgnMan = 0;
-// delete memorymanager; memorymanager = 0;
- qt_screen->disconnect();
- delete qt_screen; qt_screen = 0;
-#ifndef QT_NO_QWS_CURSOR
- delete qt_screencursor; qt_screencursor = 0;
-#endif
-#ifndef QT_NO_QWS_MULTIPROCESS
- shm.detach();
- if (csocket) {
- QWSCommand shutdownCmd(QWSCommand::Shutdown, 0, 0);
- shutdownCmd.write(csocket);
- csocket->flush(); // may be pending QCop message, eg.
- delete csocket;
- }
- delete clientLock;
- clientLock = 0;
-#endif
- delete connected_event;
- delete mouse_event;
- delete current_event;
- qDeleteAll(queue);
-#ifndef QT_NO_COP
- delete qcop_response;
-#endif
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-bool QWSDisplay::Data::lockClient(QWSLock::LockType type, int timeout)
-{
- return !clientLock || clientLock->lock(type, timeout);
-}
-
-void QWSDisplay::Data::unlockClient(QWSLock::LockType type)
-{
- if (clientLock) clientLock->unlock(type);
-}
-
-bool QWSDisplay::Data::waitClient(QWSLock::LockType type, int timeout)
-{
- return !clientLock || clientLock->wait(type, timeout);
-}
-
-QWSLock* QWSDisplay::Data::getClientLock()
-{
- return clientLock;
-}
-#endif // QT_NO_QWS_MULTIPROCESS
-
-void QWSDisplay::Data::flush()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket) {
- csocket->waitForReadyRead(0);
- csocket->flush();
- }
-#endif
-}
-
-#if 0
-void QWSDisplay::Data::debugQueue() {
- for (int i = 0; i < queue.size(); ++i) {
- QWSEvent *e = queue.at(i);
- qDebug( " ev %d type %d sl %d rl %d", i, e->type, e->simpleLen, e->rawLen);
- }
-}
-#endif
-
-bool QWSDisplay::Data::queueNotEmpty()
-{
- return mouse_event/*||region_event*/||queue.count() > 0;
-}
-QWSEvent* QWSDisplay::Data::dequeue()
-{
- QWSEvent *r=0;
- if (queue.count()) {
- r = queue.first();
- queue.removeFirst();
- if (r->type == QWSEvent::Region)
- region_events_count--;
- } else if (mouse_event) {
- r = mouse_event;
- mouse_event = 0;
-#ifdef QAPPLICATION_EXTRA_DEBUG
- mouse_event_count = 0;
-#endif
- }
- return r;
-}
-
-QWSEvent* QWSDisplay::Data::peek()
-{
- return queue.first();
-}
-
-bool QWSDisplay::Data::directServerConnection()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- return csocket == 0;
-#else
- return true;
-#endif
-}
-
-void QWSDisplay::Data::create(int n)
-{
- QWSCreateCommand cmd(n);
- sendCommand(cmd);
-}
-
-void QWSDisplay::Data::flushCommands()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket)
- csocket->flush();
-#endif
-}
-
-void QWSDisplay::Data::sendCommand(QWSCommand & cmd)
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket)
- cmd.write(csocket);
- else
-#endif
- qt_server_enqueue(&cmd);
-}
-
-void QWSDisplay::Data::sendSynchronousCommand(QWSCommand & cmd)
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket) {
- lockClient(QWSLock::Communication);
- cmd.write(csocket);
- bool ok = true;
- while (csocket->bytesToWrite() > 0) {
- if (!csocket->waitForBytesWritten(-1)) {
- qCritical("QWSDisplay::Data::sendSynchronousCommand: %s",
- qPrintable(csocket->errorString()));
- ok = false;
- break;
- }
- }
- if (ok)
- waitClient(QWSLock::Communication);
- } else
-#endif
- qt_server_enqueue(&cmd);
-}
-
-int QWSDisplay::Data::takeId()
-{
- int unusedIdCount = unused_identifiers.count();
- if (unusedIdCount <= 10)
- create(15);
- if (unusedIdCount == 0) {
- create(1); // Make sure we have an incoming id to wait for, just in case we're recursive
- waitForCreation();
- }
-
- return unused_identifiers.takeFirst();
-}
-
-void QWSDisplay::Data::setMouseFilter(void (*filter)(QWSMouseEvent*))
-{
- mouseFilter = filter;
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-QWSLock* QWSDisplay::Data::clientLock = 0;
-
-void Q_GUI_EXPORT qt_app_reinit( const QString& newAppName )
-{
- qt_fbdpy->d->reinit( newAppName );
-}
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
-class QDesktopWidget;
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSDisplay::Data::reinit( const QString& newAppName )
-{
- Q_ASSERT(csocket);
-
- delete connected_event;
- connected_event = 0;
- region_events_count = 0;
-// region_ack = 0;
- delete mouse_event;
- mouse_event = 0;
-// region_event = 0;
- region_offset_window = 0;
-#ifndef QT_NO_COP
- delete qcop_response;
- qcop_response = 0;
-#endif
- delete current_event;
- current_event = 0;
-#ifdef QAPPLICATION_EXTRA_DEBUG
- mouse_event_count = 0;
-#endif
- mouseFilter = 0;
-
- qt_desktopWidget = 0;
- delete QWSDisplay::Data::clientLock;
- QWSDisplay::Data::clientLock = 0;
-
- QString pipe = qws_qtePipeFilename();
-
- // QWS client
- // Cleanup all cached ids
- unused_identifiers.clear();
- delete csocket;
-
- appName = newAppName;
- qApp->setObjectName( appName );
-
- csocket = new QWSSocket();
- QObject::connect(csocket, SIGNAL(disconnected()),
- qApp, SLOT(quit()));
- csocket->connectToLocalFile(pipe);
-
- QWSDisplay::Data::clientLock = new QWSLock();
-
- QWSIdentifyCommand cmd;
- cmd.setId(appName, QWSDisplay::Data::clientLock->id());
-
-#ifndef QT_NO_SXE
- QTransportAuth *a = QTransportAuth::getInstance();
- QTransportAuth::Data *d = a->connectTransport(
- QTransportAuth::UnixStreamSock |
- QTransportAuth::Trusted,
- csocket->socketDescriptor());
- QAuthDevice *ad = a->authBuf( d, csocket );
- ad->setClient( csocket );
-
- cmd.write(ad);
-#else
- cmd.write(csocket);
-#endif
-
- // wait for connect confirmation
- waitForConnection();
-
- qws_client_id = connected_event->simpleData.clientId;
-
- if (!QWSDisplay::initLock(pipe, false))
- qFatal("Cannot get display lock");
-
- if (shm.attach(connected_event->simpleData.servershmid)) {
- sharedRam = static_cast<uchar *>(shm.address());
- QScreen *s = qt_get_screen(qws_display_id, qws_display_spec.constData());
- if (s)
- sharedRamSize += s->memoryNeeded(QLatin1String(qws_display_spec.constData()));
- } else {
- perror("QWSDisplay::Data::init");
- qFatal("Client can't attach to main ram memory.");
- }
-
- qApp->desktop();
-
- // We wait for creation mainly so that we can process important
- // initialization events such as MaxWindowRect that are sent
- // before object id creation. Waiting here avoids later window
- // resizing since we have the MWR before windows are displayed.
- waitForCreation();
-
- sharedRamSize -= sizeof(int);
- qt_last_x = reinterpret_cast<int *>(sharedRam + sharedRamSize);
- sharedRamSize -= sizeof(int);
- qt_last_y = reinterpret_cast<int *>(sharedRam + sharedRamSize);
-
-#ifndef QT_NO_COP
- QCopChannel::reregisterAll();
-#endif
- csocket->flush();
-}
-#endif
-
-void QWSDisplay::Data::init()
-{
- connected_event = 0;
- region_events_count = 0;
-// region_ack = 0;
- mouse_event = 0;
- mouse_state = -1;
- mouse_winid = 0;
-// region_event = 0;
- region_offset_window = 0;
-#ifndef QT_NO_COP
- qcop_response = 0;
-#endif
- current_event = 0;
-#ifdef QAPPLICATION_EXTRA_DEBUG
- mouse_event_count = 0;
-#endif
- mouseFilter = 0;
-
- QString pipe = qws_qtePipeFilename();
-
- sharedRamSize = qwsSharedRamSize;
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket) {
- // QWS client
-
- connectToPipe();
-
- QWSDisplay::Data::clientLock = new QWSLock();
-
- QWSIdentifyCommand cmd;
- cmd.setId(appName, QWSDisplay::Data::clientLock->id());
-#ifndef QT_NO_SXE
- QTransportAuth *a = QTransportAuth::getInstance();
- QTransportAuth::Data *d = a->connectTransport(
- QTransportAuth::UnixStreamSock |
- QTransportAuth::Trusted,
- csocket->socketDescriptor());
- QAuthDevice *ad = a->authBuf( d, csocket );
- ad->setClient( csocket );
- cmd.write(ad);
-#else
- cmd.write(csocket);
-#endif
-
- // create(30); // not necessary, server will send ids anyway
- waitForConnection();
-
- qws_client_id = connected_event->simpleData.clientId;
-
- // now we want to get the exact display spec to use if we haven't
- // specified anything.
- if (qws_display_spec.at(0) == ':')
- qws_display_spec = connected_event->display;
-
- if (!QWSDisplay::initLock(pipe, false))
- qFatal("Cannot get display lock");
-
- if (shm.attach(connected_event->simpleData.servershmid)) {
- sharedRam = static_cast<uchar *>(shm.address());
- QScreen *s = qt_get_screen(qws_display_id, qws_display_spec.constData());
- if (s)
- sharedRamSize += s->memoryNeeded(QLatin1String(qws_display_spec.constData()));
- } else {
- perror("QWSDisplay::Data::init");
- qFatal("Client can't attach to main ram memory.");
- }
-
- // We wait for creation mainly so that we can process important
- // initialization events such as MaxWindowRect that are sent
- // before object id creation. Waiting here avoids later window
- // resizing since we have the MWR before windows are displayed.
- waitForCreation();
- } else
-#endif
- {
- create(30);
-
- // QWS server
- if (!QWSDisplay::initLock(pipe, true))
- qFatal("Cannot get display lock");
-
- QScreen *s = qt_get_screen(qws_display_id, qws_display_spec.constData());
- if (s)
- sharedRamSize += s->memoryNeeded(QLatin1String(qws_display_spec.constData()));
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
- if (!shm.create(sharedRamSize)) {
- perror("Cannot create main ram shared memory\n");
- qFatal("Unable to allocate %d bytes of shared memory", sharedRamSize);
- }
- qt_servershmid = shm.id();
- sharedRam = static_cast<uchar *>(shm.address());
-#else
- sharedRam=static_cast<uchar *>(malloc(sharedRamSize));
-#endif
- // Need to zero index count at end of block, might as well zero
- // the rest too
- memset(sharedRam,0,sharedRamSize);
-
- QWSIdentifyCommand cmd;
- cmd.setId(appName, -1);
- qt_server_enqueue(&cmd);
- }
-
- // Allow some memory for the graphics driver too
- //### Note that sharedRamSize() has side effects; it must be called
- //### once, and only once, and before initDevice()
- sharedRamSize -= qt_screen->sharedRamSize(sharedRam+sharedRamSize);
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- if(!csocket)
-#endif
- {
- //QWS server process
- if (!qt_screen->initDevice())
- qFatal("Unable to initialize screen driver!");
- }
-
- sharedRamSize -= sizeof(int);
- qt_last_x = reinterpret_cast<int *>(sharedRam + sharedRamSize);
- sharedRamSize -= sizeof(int);
- qt_last_y = reinterpret_cast<int *>(sharedRam + sharedRamSize);
-
- /* Initialise framebuffer memory manager */
- /* Add 4k for luck and to avoid clobbering hardware cursor */
-// int screensize=qt_screen->screenSize();
-// memorymanager=new QMemoryManager(qt_screen->base()+screensize+4096,
-// qt_screen->totalSize()-(screensize+4096),0);
-
-// #ifndef QT_NO_QWS_MULTIPROCESS
-// rgnMan = new QWSRegionManager(pipe, csocket);
-// #else
-// rgnMan = new QWSRegionManager(pipe, 0); //####### not necessary
-// #endif
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket)
- csocket->flush();
-#endif
-}
-
-
-QWSEvent* QWSDisplay::Data::readMore()
-{
-#ifdef QT_NO_QWS_MULTIPROCESS
- return incoming.isEmpty() ? 0 : incoming.takeFirst();
-#else
- if (!csocket)
- return incoming.isEmpty() ? 0 : incoming.takeFirst();
- // read next event
- if (!current_event) {
- int event_type = qws_read_uint(csocket);
-
- if (event_type >= 0) {
- current_event = QWSEvent::factory(event_type);
- }
- }
-
- if (current_event) {
- if (current_event->read(csocket)) {
- // Finished reading a whole event.
- QWSEvent* result = current_event;
- current_event = 0;
- return result;
- }
- }
-
- // Not finished reading a whole event.
- return 0;
-#endif
-}
-
-void QWSDisplay::Data::fillQueue()
-{
- QWSServer::processEventQueue();
- QWSEvent *e = readMore();
-#ifndef QT_NO_QWS_MULTIPROCESS
- int bytesAvailable = csocket ? csocket->bytesAvailable() : 0;
- int bytesRead = 0;
-#endif
- while (e) {
-#ifndef QT_NO_QWS_MULTIPROCESS
- bytesRead += QWS_PROTOCOL_ITEM_SIZE((*e));
-#endif
- if (e->type == QWSEvent::Connected) {
- connected_event = static_cast<QWSConnectedEvent *>(e);
- return;
- } else if (e->type == QWSEvent::Creation) {
- QWSCreationEvent *ce = static_cast<QWSCreationEvent*>(e);
- int id = ce->simpleData.objectid;
- int count = ce->simpleData.count;
- for (int i = 0; i < count; ++i)
- unused_identifiers.append(id++);
- delete e;
- } else if (e->type == QWSEvent::Mouse) {
- if (!qt_screen) {
- delete e;
- } else {
- QWSMouseEvent *me = static_cast<QWSMouseEvent*>(e);
- if (mouseFilter)
- mouseFilter(me);
-#ifdef QAPPLICATION_EXTRA_DEBUG
- static const char *defaultAction= "INITIAL";
- const char * action = defaultAction;
-#endif
- delete mouse_event;
- if (mouse_winid != me->window ()
- || mouse_state != me->simpleData.state) {
- queue.append(me);
- mouse_winid = me->window();
- mouse_state = me->simpleData.state;
- mouse_event = 0;
-#ifdef QAPPLICATION_EXTRA_DEBUG
- mouse_event_count = 0;
- action = "ENQUEUE";
-#endif
- } else {
-#ifdef QAPPLICATION_EXTRA_DEBUG
- if (mouse_event)
- action = "COMPRESS";
- mouse_event_count++;
-#endif
- mouse_event = me;
- }
-#ifdef QAPPLICATION_EXTRA_DEBUG
- if (me->simpleData.state !=0 || action != defaultAction || mouse_event_count != 0)
- qDebug("fillQueue %s (%d,%d), state %x win %d count %d", action,
- me->simpleData.x_root, me->simpleData.y_root, me->simpleData.state,
- me->window(), mouse_event_count);
-#endif
- }
-#ifndef QT_NO_QWS_MULTIPROCESS
- } else if (e->type == QWSEvent::Region && clientLock) {
- // not really an unlock, decrements the semaphore
- region_events_count++;
- clientLock->unlock(QWSLock::RegionEvent);
- queue.append(e);
-#endif
-#ifndef QT_NO_QWS_PROPERTIES
- } else if (e->type == QWSEvent::PropertyReply) {
- QWSPropertyReplyEvent *pe = static_cast<QWSPropertyReplyEvent*>(e);
- int len = pe->simpleData.len;
- char *data;
- if (len <= 0) {
- data = 0;
- } else {
- data = new char[len];
- memcpy(data, pe->data, len) ;
- }
- QPaintDevice::qwsDisplay()->getPropertyLen = len;
- QPaintDevice::qwsDisplay()->getPropertyData = data;
- delete e;
-#endif // QT_NO_QWS_PROPERTIES
- } else if (e->type==QWSEvent::MaxWindowRect && qt_screen) {
- // Process this ASAP, in case new widgets are created (startup)
- setMaxWindowRect((static_cast<QWSMaxWindowRectEvent*>(e))->simpleData.rect);
- delete e;
-#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
- } else if (e->type == QWSEvent::ScreenTransformation) {
- QWSScreenTransformationEvent *pe = static_cast<QWSScreenTransformationEvent*>(e);
- setScreenTransformation(pe->simpleData.screen,
- pe->simpleData.transformation);
- delete e;
-#endif
-#ifndef QT_NO_COP
- } else if (e->type == QWSEvent::QCopMessage) {
- QWSQCopMessageEvent *pe = static_cast<QWSQCopMessageEvent*>(e);
- if (pe->simpleData.is_response) {
- qcop_response = pe;
- } else {
- queue.append(e);
- }
-#endif
- } else {
- queue.append(e);
- }
- //debugQueue();
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket && bytesRead >= bytesAvailable)
- break;
-#endif
- e = readMore();
- }
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-static int qws_connection_timeout = 5;
-
-void QWSDisplay::Data::connectToPipe()
-{
- Q_ASSERT(csocket);
-
- int timeout = qgetenv("QWS_CONNECTION_TIMEOUT").toInt();
- if (timeout)
- qws_connection_timeout = timeout;
-
- const QString pipe = qws_qtePipeFilename();
- int i = 0;
- while (!csocket->connectToLocalFile(pipe)) {
- if (++i > qws_connection_timeout) {
- qWarning("No Qt for Embedded Linux server appears to be running.");
- qWarning("If you want to run this program as a server,");
- qWarning("add the \"-qws\" command-line option.");
- exit(1);
- }
- sleep(1);
- }
-}
-
-void QWSDisplay::Data::waitForConnection()
-{
- connected_event = 0;
-
- for (int i = 0; i < qws_connection_timeout; i++) {
- fillQueue();
- if (connected_event)
- return;
- csocket->flush();
- csocket->waitForReadyRead(1000);
- }
-
- csocket->flush();
- if (!connected_event)
- qFatal("Did not receive a connection event from the qws server");
-}
-
-void QWSDisplay::Data::waitForRegionAck(int winId)
-{
- QWSEvent *ack = 0;
-
- if (csocket) { // GuiClient
- int i = 0;
- while (!ack) {
- fillQueue();
-
- while (i < queue.size()) {
- QWSEvent *e = queue.at(i);
- if (e->type == QWSEvent::Region && e->window() == winId) {
- ack = e;
- queue.removeAt(i);
- break;
- }
- ++i;
- }
-
- if (!ack) {
- csocket->flush();
- csocket->waitForReadyRead(1000);
- }
- }
- } else { // GuiServer
- fillQueue();
- for (int i = 0; i < queue.size(); /* nothing */) {
- QWSEvent *e = queue.at(i);
- if (e->type == QWSEvent::Region && e->window() == winId) {
- ack = e;
- queue.removeAt(i);
- break;
- }
- ++i;
- }
- if (!ack) // already processed
- return;
- }
-
- Q_ASSERT(ack);
-
- qApp->qwsProcessEvent(ack);
- delete ack;
- region_events_count--;
-}
-
-void QWSDisplay::Data::waitForRegionEvents(int winId, bool ungrabDisplay)
-{
- if (!clientLock)
- return;
-
- int removedEventsCount = 0;
-
- // fill queue with unreceived region events
- if (!clientLock->hasLock(QWSLock::RegionEvent)) {
- bool ungrabbed = false;
- if (ungrabDisplay && QWSDisplay::grabbed()) {
- QWSDisplay::ungrab();
- ungrabbed = true;
- }
-
- for (;;) {
- fillQueue();
- if (clientLock->hasLock(QWSLock::RegionEvent))
- break;
- csocket->flush();
- csocket->waitForReadyRead(1000);
- }
-
- if (ungrabbed)
- QWSDisplay::grab(true);
- }
-
- // check the queue for pending region events
- QWSEvent *regionEvent = 0;
- for (int i = 0; i < queue.size(); /* nothing */) {
- QWSEvent *e = queue.at(i);
- if (e->type == QWSEvent::Region && e->window() == winId) {
- QWSRegionEvent *re = static_cast<QWSRegionEvent*>(e);
- if (re->simpleData.type == QWSRegionEvent::Allocation) {
- delete regionEvent;
- regionEvent = re;
- }
- queue.removeAt(i);
- removedEventsCount++;
- } else {
- ++i;
- }
- }
-
- if (regionEvent) {
- qApp->qwsProcessEvent(regionEvent);
- delete regionEvent;
- }
- region_events_count -= removedEventsCount;
-}
-
-bool QWSDisplay::Data::hasPendingRegionEvents() const
-{
- if (clientLock && !clientLock->hasLock(QWSLock::RegionEvent))
- return true;
-
- return region_events_count > 0;
-}
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
-void QWSDisplay::Data::waitForCreation()
-{
- fillQueue();
-#ifndef QT_NO_QWS_MULTIPROCESS
- while (unused_identifiers.count() == 0) {
- if (csocket) {
- csocket->flush();
- csocket->waitForReadyRead(1000);
- }
- fillQueue();
- }
-#endif
-}
-
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSDisplay::Data::waitForPropertyReply()
-{
- if (!csocket)
- return;
- fillQueue();
- while (qt_fbdpy->getPropertyLen == -2) {
- csocket->flush();
- csocket->waitForReadyRead(1000);
- fillQueue();
- }
-}
-#endif
-
-#ifndef QT_NO_COP
-void QWSDisplay::Data::waitForQCopResponse()
-{
- for (;;) {
- fillQueue();
- if (qcop_response)
- break;
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (csocket) {
- csocket->flush();
- csocket->waitForReadyRead(1000);
- }
-#endif
- }
- queue.prepend(qcop_response);
- qcop_response = 0;
-}
-#endif
-
-/*!
- \class QWSDisplay
- \brief The QWSDisplay class provides a display for QWS; it is an internal class.
-
- \internal
-
- \ingroup qws
-*/
-
-QWSDisplay::QWSDisplay()
-{
- d = new Data(0, qws_single_process);
-}
-
-QWSDisplay::~QWSDisplay()
-{
- delete d;
- delete lock;
- lock = 0;
-}
-
-bool QWSDisplay::grabbed()
-{
- return lock->locked();
-}
-
-void QWSDisplay::grab()
-{
- lock->lock(QLock::Read);
-}
-
-void QWSDisplay::grab(bool write)
-{
- lock->lock(write ? QLock::Write : QLock::Read);
-
-}
-void QWSDisplay::ungrab()
-{
- lock->unlock();
-}
-
-#if 0
-QWSRegionManager *QWSDisplay::regionManager() const
-{
- return d->rgnMan;
-}
-#endif
-
-bool QWSDisplay::eventPending() const
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- d->flush();
-#endif
- d->fillQueue();
- return d->queueNotEmpty();
-}
-
-
-/*
- Caller must delete return value!
- */
-QWSEvent *QWSDisplay::getEvent()
-{
- d->fillQueue();
- Q_ASSERT(d->queueNotEmpty());
- QWSEvent* e = d->dequeue();
-
- return e;
-}
-
-uchar* QWSDisplay::frameBuffer() const { return qt_screen->base(); }
-int QWSDisplay::width() const { return qt_screen->width(); }
-int QWSDisplay::height() const { return qt_screen->height(); }
-int QWSDisplay::depth() const { return qt_screen->depth(); }
-int QWSDisplay::pixmapDepth() const { return qt_screen->pixmapDepth(); }
-bool QWSDisplay::supportsDepth(int depth) const { return qt_screen->supportsDepth(depth); }
-uchar *QWSDisplay::sharedRam() const { return d->sharedRam; }
-int QWSDisplay::sharedRamSize() const { return d->sharedRamSize; }
-
-#ifndef QT_NO_QWS_PROPERTIES
-
-void QWSDisplay::addProperty(int winId, int property)
-{
- QWSAddPropertyCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.property = property;
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::setProperty(int winId, int property, int mode, const QByteArray &data)
-{
- QWSSetPropertyCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.property = property;
- cmd.simpleData.mode = mode;
- cmd.setData(data.constData(), data.size());
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::setProperty(int winId, int property, int mode,
- const char * data)
-{
- QWSSetPropertyCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.property = property;
- cmd.simpleData.mode = mode;
- cmd.setData(data, strlen(data));
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::removeProperty(int winId, int property)
-{
- QWSRemovePropertyCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.property = property;
- d->sendCommand(cmd);
-}
-
-/*
- It is the caller's responsibility to delete[] \a data.
- */
-bool QWSDisplay::getProperty(int winId, int property, char *&data, int &len)
-{
- if (d->directServerConnection()) {
- const char *propertyData;
- bool retval = qwsServer->d_func()->get_property(winId, property, propertyData, len);
- if (len <= 0) {
- data = 0;
- } else {
- data = new char[len];
- memcpy(data, propertyData, len) ;
- }
- return retval;
- }
- QWSGetPropertyCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.property = property;
- d->sendCommand(cmd);
-
- getPropertyLen = -2;
- getPropertyData = 0;
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- d->waitForPropertyReply();
-#endif
-
- len = getPropertyLen;
- data = getPropertyData;
-
- getPropertyLen = -2;
- getPropertyData = 0;
-
- return len != -1;
-}
-
-#endif // QT_NO_QWS_PROPERTIES
-
-void QWSDisplay::setAltitude(int winId, int alt, bool fixed)
-{
- QWSChangeAltitudeCommand cmd;
-#ifdef QT_DEBUG
- memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind
-#endif
- cmd.simpleData.windowid = winId;
- cmd.simpleData.altitude = QWSChangeAltitudeCommand::Altitude(alt);
- cmd.simpleData.fixed = fixed;
- if (d->directServerConnection()) {
- qwsServer->d_func()->set_altitude(&cmd);
- } else {
- d->sendSynchronousCommand(cmd);
- }
-}
-
-void QWSDisplay::setOpacity(int winId, int opacity)
-{
- QWSSetOpacityCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.opacity = opacity;
- if (d->directServerConnection()) {
- qwsServer->d_func()->set_opacity(&cmd);
- } else {
- d->sendCommand(cmd);
- }
-}
-
-
-
-void QWSDisplay::requestFocus(int winId, bool get)
-{
- QWSRequestFocusCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.flag = get;
- if (d->directServerConnection())
- qwsServer->d_func()->request_focus(&cmd);
- else
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::setIdentity(const QString &appName)
-{
- QWSIdentifyCommand cmd;
-#ifdef QT_NO_QWS_MULTIPROCESS
- const int id = -1;
-#else
- const int id = QWSDisplay::Data::clientLock ? QWSDisplay::Data::clientLock->id() : -1;
-#endif
- cmd.setId(appName, id);
- if (d->directServerConnection())
- qwsServer->d_func()->set_identity(&cmd);
- else
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::nameRegion(int winId, const QString& n, const QString &c)
-{
- QWSRegionNameCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.setName(n, c);
- if (d->directServerConnection())
- qwsServer->d_func()->name_region(&cmd);
- else
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::requestRegion(int winId, const QString &surfaceKey,
- const QByteArray &surfaceData,
- const QRegion &region)
-{
- if (d->directServerConnection()) {
- qwsServer->d_func()->request_region(winId, surfaceKey,
- surfaceData, region);
- } else {
- QWSRegionCommand cmd;
- cmd.setData(winId, surfaceKey, surfaceData, region);
- d->sendSynchronousCommand(cmd);
- }
-}
-
-void QWSDisplay::repaintRegion(int winId, int windowFlags, bool opaque, QRegion r)
-{
- if (d->directServerConnection()) {
- qwsServer->d_func()->repaint_region(winId, windowFlags, opaque, r);
- } else {
- QVector<QRect> ra = r.rects();
-
- /*
- for (int i = 0; i < ra.size(); i++) {
- QRect r(ra[i]);
- qDebug("rect: %d %d %d %d", r.x(), r.y(), r.right(), r.bottom());
- }
- */
-
- QWSRepaintRegionCommand cmd;
- /* XXX QWSRegionCommand is padded out in a compiler dependent way.
- Zeroed out to avoid valgrind reporting uninitialized memory usage.
- */
-#ifdef QT_DEBUG
- memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind
-#endif
- cmd.simpleData.windowid = winId;
- cmd.simpleData.windowFlags = windowFlags;
- cmd.simpleData.opaque = opaque;
- cmd.simpleData.nrectangles = ra.count();
- cmd.setData(reinterpret_cast<const char *>(ra.constData()),
- ra.count() * sizeof(QRect), false);
-
- d->sendSynchronousCommand(cmd);
- }
-}
-
-
-void QWSDisplay::moveRegion(int winId, int dx, int dy)
-{
- QWSRegionMoveCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.dx = dx;
- cmd.simpleData.dy = dy;
-
- if (d->directServerConnection()) {
- qwsServer->d_func()->move_region(&cmd);
- } else {
- d->sendSynchronousCommand(cmd);
- }
-// d->offsetPendingExpose(winId, QPoint(cmd.simpleData.dx, cmd.simpleData.dy));
-}
-
-void QWSDisplay::destroyRegion(int winId)
-{
- QWSRegionDestroyCommand cmd;
- cmd.simpleData.windowid = winId;
- if (d->directServerConnection()) {
- qwsServer->d_func()->destroy_region(&cmd);
- } else {
- d->sendCommand(cmd);
- }
-}
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-void QWSDisplay::sendIMUpdate(int type, int winId, int widgetid)
-{
- QWSIMUpdateCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.widgetid = widgetid;
-
- cmd.simpleData.type = type;
-
- if (d->directServerConnection()) {
- qwsServer->d_func()->im_update(&cmd);
- } else {
- d->sendCommand(cmd);
- }
-}
-
-void QWSDisplay::sendIMResponse(int winId, int property, const QVariant &result)
-{
- QWSIMResponseCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.property = property;
-
- cmd.setResult(result);
-
- if (d->directServerConnection()) {
- qwsServer->d_func()->im_response(&cmd);
- } else {
- d->sendCommand(cmd);
- }
-}
-
-void QWSDisplay::resetIM()
-{
- sendIMUpdate(QWSInputMethod::Reset, -1, -1);
-}
-
-void QWSDisplay::sendIMMouseEvent(int index, bool isPress)
-{
- QWSIMMouseCommand cmd;
- cmd.simpleData.index = index;
- cmd.simpleData.state = isPress ? QWSServer::MousePress : QWSServer::MouseRelease;
- if (d->directServerConnection()) {
- qwsServer->d_func()->send_im_mouse(&cmd);
- } else {
- d->sendCommand(cmd);
- }
-}
-
-#endif
-
-int QWSDisplay::takeId()
-{
- return d->takeId();
-}
-
-bool QWSDisplay::initLock(const QString &filename, bool create)
-{
- if (!lock) {
- lock = new QLock(filename, 'd', create);
-
- if (!lock->isValid()) {
- delete lock;
- lock = 0;
- return false;
- }
- }
-
- return true;
-}
-
-void QWSDisplay::setSelectionOwner(int winId, const QTime &time)
-{
- QWSSetSelectionOwnerCommand cmd;
- cmd.simpleData.windowid = winId;
- cmd.simpleData.hour = time.hour();
- cmd.simpleData.minute = time.minute();
- cmd.simpleData.sec = time.second();
- cmd.simpleData.ms = time.msec();
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::convertSelection(int winId, int selectionProperty, const QString &mimeTypes)
-{
-#ifdef QT_NO_QWS_PROPERTIES
- Q_UNUSED(mimeTypes);
-#else
- // ### we need the atom/property thingy like in X here
- addProperty(winId, QT_QWS_PROPERTY_CONVERTSELECTION);
- setProperty(winId, QT_QWS_PROPERTY_CONVERTSELECTION,
- int(QWSPropertyManager::PropReplace), mimeTypes.toLatin1());
-#endif
- QWSConvertSelectionCommand cmd;
- cmd.simpleData.requestor = winId;
- cmd.simpleData.selection = selectionProperty;
- cmd.simpleData.mimeTypes = QT_QWS_PROPERTY_CONVERTSELECTION;
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::defineCursor(int id, const QBitmap &curs, const QBitmap &mask,
- int hotX, int hotY)
-{
- const QImage cursImg = curs.toImage().convertToFormat(QImage::Format_MonoLSB);
- const QImage maskImg = mask.toImage().convertToFormat(QImage::Format_MonoLSB);
-
- QWSDefineCursorCommand cmd;
- cmd.simpleData.width = curs.width();
- cmd.simpleData.height = curs.height();
- cmd.simpleData.hotX = hotX;
- cmd.simpleData.hotY = hotY;
- cmd.simpleData.id = id;
-
-
- // must copy each scanline since there might be gaps between them
- const int height = curs.height();
- const int width = curs.width();
- const int dst_bpl = (width + 7) / 8;
-
- int dataLen = dst_bpl * height;
- uchar *data = new uchar[dataLen*2];
- uchar *dst = data;
-
- int src_bpl = cursImg.bytesPerLine();
- const uchar *cursSrc = cursImg.bits();
- for (int i = 0; i < height; ++i) {
- memcpy(dst, cursSrc + i*src_bpl, dst_bpl);
- dst += dst_bpl;
- }
-
- src_bpl = maskImg.bytesPerLine();
- const uchar *maskSrc = maskImg.bits();
- for (int i = 0; i < height; ++i) {
- memcpy(dst, maskSrc + i*src_bpl, dst_bpl);
- dst += dst_bpl;
- }
-
- cmd.setData(reinterpret_cast<char*>(data), dataLen*2);
- delete [] data;
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::destroyCursor(int id)
-{
- QWSDefineCursorCommand cmd;
- cmd.simpleData.width = 0;
- cmd.simpleData.height = 0;
- cmd.simpleData.hotX = 0;
- cmd.simpleData.hotY = 0;
- cmd.simpleData.id = id;
- cmd.setData(0, 0);
-
- d->sendCommand(cmd);
-}
-
-#ifndef QT_NO_SOUND
-void QWSDisplay::playSoundFile(const QString& f)
-{
- QWSPlaySoundCommand cmd;
- cmd.setFileName(f);
- d->sendCommand(cmd);
-}
-#endif
-
-#ifndef QT_NO_COP
-void QWSDisplay::registerChannel(const QString& channel)
-{
- QWSQCopRegisterChannelCommand reg;
- reg.setChannel(channel);
- qt_fbdpy->d->sendCommand(reg);
-}
-
-void QWSDisplay::sendMessage(const QString &channel, const QString &msg,
- const QByteArray &data)
-{
- QWSQCopSendCommand com;
- com.setMessage(channel, msg, data);
- qt_fbdpy->d->sendCommand(com);
-}
-
-void QWSDisplay::flushCommands()
-{
- qt_fbdpy->d->flushCommands();
-}
-
-/*
- caller deletes result
-*/
-QWSQCopMessageEvent* QWSDisplay::waitForQCopResponse()
-{
- qt_fbdpy->d->waitForQCopResponse();
- QWSQCopMessageEvent *e = static_cast<QWSQCopMessageEvent*>(qt_fbdpy->d->dequeue());
- Q_ASSERT(e->type == QWSEvent::QCopMessage);
- return e;
-}
-#endif
-
-void QWSDisplay::sendFontCommand(int type, const QByteArray &fontName)
-{
- QWSFontCommand cmd;
- cmd.simpleData.type = type;
- cmd.setFontName(fontName);
- d->sendCommand(cmd);
-}
-
-void QWSDisplay::setWindowCaption(QWidget *w, const QString &c)
-{
- if (w->isWindow()) {
- nameRegion(w->internalWinId(), w->objectName(), c);
- static_cast<QETWidget *>(w)->repaintDecoration(qApp->desktop()->rect(), true);
- }
-}
-
-void QWSDisplay::selectCursor(QWidget *w, unsigned int cursId)
-{
- if (cursId != qt_last_cursor)
- {
- QWidget *top = w->window();
- qt_last_cursor = cursId;
- QWSSelectCursorCommand cmd;
- cmd.simpleData.windowid = top->internalWinId();
- cmd.simpleData.id = cursId;
- d->sendCommand(cmd);
- d->flush();
- }
-}
-
-void QWSDisplay::setCursorPosition(int x, int y)
-{
- QWSPositionCursorCommand cmd;
- cmd.simpleData.newX = x;
- cmd.simpleData.newY = y;
- d->sendCommand(cmd);
- d->flush();
-}
-
-void QWSDisplay::grabMouse(QWidget *w, bool grab)
-{
- QWidget *top = w->window();
- QWSGrabMouseCommand cmd;
-#ifdef QT_DEBUG
- memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind
-#endif
- cmd.simpleData.windowid = top->winId();
- cmd.simpleData.grab = grab;
- d->sendCommand(cmd);
- d->flush();
-}
-
-void QWSDisplay::grabKeyboard(QWidget *w, bool grab)
-{
- QWidget *top = w->window();
- QWSGrabKeyboardCommand cmd;
-#ifdef QT_DEBUG
- memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind
-#endif
- cmd.simpleData.windowid = top->winId();
- cmd.simpleData.grab = grab;
- d->sendCommand(cmd);
- d->flush();
-}
-
-QList<QWSWindowInfo> QWSDisplay::windowList()
-{
- QList<QWSWindowInfo> ret;
- if(d->directServerConnection()) {
- QList<QWSInternalWindowInfo*> * qin=QWSServer::windowList();
- for (int i = 0; i < qin->count(); ++i) {
- QWSInternalWindowInfo * qwi = qin->at(i);
- QWSWindowInfo tmp;
- tmp.winid = qwi->winid;
- tmp.clientid = qwi->clientid;
- tmp.name = QString(qwi->name);
- ret.append(tmp);
- }
- qDeleteAll(*qin);
- delete qin;
- }
- return ret;
-}
-
-int QWSDisplay::windowAt(const QPoint &p)
-{
- //### currently only implemented for the server process
- int ret = 0;
- if(d->directServerConnection()) {
- QWSWindow *win = qwsServer->windowAt(p);
- if (win)
- return win->winId();
- }
- return ret;
-}
-
-void QWSDisplay::setRawMouseEventFilter(void (*filter)(QWSMouseEvent *))
-{
- if (qt_fbdpy)
- qt_fbdpy->d->setMouseFilter(filter);
-}
-
-/*!
- \relates QScreen
-
- Here it is. \a transformation and \a screenNo
- */
-void QWSDisplay::setTransformation(int transformation, int screenNo)
-{
- QWSScreenTransformCommand cmd;
- cmd.setTransformation(screenNo, transformation);
- QWSDisplay::instance()->d->sendCommand(cmd);
-}
-
-static bool qt_try_modal(QWidget *, QWSEvent *);
-
-/*****************************************************************************
- qt_init() - initializes Qt/FB
- *****************************************************************************/
-
-static void qt_set_qws_resources()
-
-{
- if (QApplication::desktopSettingsAware())
- QApplicationPrivate::qws_apply_settings();
-
- if (appFont)
- QApplication::setFont(QFont(QString::fromLocal8Bit(appFont)));
-
- if (appBGCol || appBTNCol || appFGCol) {
- (void) QApplication::style(); // trigger creation of application style and system palettes
- QColor btn;
- QColor bg;
- QColor fg;
- if (appBGCol)
- bg = QColor(appBGCol);
- else
- bg = QApplicationPrivate::sys_pal->color(QPalette::Window);
- if (appFGCol)
- fg = QColor(appFGCol);
- else
- fg = QApplicationPrivate::sys_pal->color(QPalette::WindowText);
- if (appBTNCol)
- btn = QColor(appBTNCol);
- else
- btn = QApplicationPrivate::sys_pal->color(QPalette::Button);
-
- int h,s,v;
- fg.getHsv(&h,&s,&v);
- QColor base = Qt::white;
- bool bright_mode = false;
- if (v >= 255 - 50) {
- base = btn.darker(150);
- bright_mode = true;
- }
-
- QPalette pal(fg, btn, btn.lighter(), btn.darker(), btn.darker(150), fg, Qt::white, base, bg);
- if (bright_mode) {
- pal.setColor(QPalette::HighlightedText, base);
- pal.setColor(QPalette::Highlight, Qt::white);
- } else {
- pal.setColor(QPalette::HighlightedText, Qt::white);
- pal.setColor(QPalette::Highlight, Qt::darkBlue);
- }
- QColor disabled((fg.red() + btn.red()) / 2,
- (fg.green() + btn.green())/ 2,
- (fg.blue() + btn.blue()) / 2);
- pal.setColorGroup(QPalette::Disabled, disabled, btn, btn.lighter(125),
- btn.darker(), btn.darker(150), disabled, Qt::white, Qt::white, bg);
- if (bright_mode) {
- pal.setColor(QPalette::Disabled, QPalette::HighlightedText, base);
- pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::white);
- } else {
- pal.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::white);
- pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue);
- }
- QApplicationPrivate::setSystemPalette(pal);
-
- }
-}
-
-void QApplicationPrivate::initializeWidgetPaletteHash()
-{
-}
-
-/*! \internal
- apply the settings to the application
-*/
-bool QApplicationPrivate::qws_apply_settings()
-{
-#ifndef QT_NO_SETTINGS
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("Qt"));
-
- QStringList strlist;
- int i;
- QPalette pal(Qt::black);
- int groupCount = 0;
- strlist = settings.value(QLatin1String("Palette/active")).toStringList();
- if (strlist.count() == QPalette::NColorRoles) {
- ++groupCount;
- for (i = 0; i < QPalette::NColorRoles; i++)
- pal.setColor(QPalette::Active, (QPalette::ColorRole) i,
- QColor(strlist[i]));
- }
- strlist = settings.value(QLatin1String("Palette/inactive")).toStringList();
- if (strlist.count() == QPalette::NColorRoles) {
- ++groupCount;
- for (i = 0; i < QPalette::NColorRoles; i++)
- pal.setColor(QPalette::Inactive, (QPalette::ColorRole) i,
- QColor(strlist[i]));
- }
- strlist = settings.value(QLatin1String("Palette/disabled")).toStringList();
- if (strlist.count() == QPalette::NColorRoles) {
- ++groupCount;
- for (i = 0; i < QPalette::NColorRoles; i++)
- pal.setColor(QPalette::Disabled, (QPalette::ColorRole) i,
- QColor(strlist[i]));
- }
-
-
- if (groupCount == QPalette::NColorGroups)
- QApplicationPrivate::setSystemPalette(pal);
-
- QString str = settings.value(QLatin1String("font")).toString();
- if (!str.isEmpty()) {
- QFont font(QApplication::font());
- font.fromString(str);
- QApplicationPrivate::setSystemFont(font);
- }
-
- // read library (ie. plugin) path list
- QString libpathkey =
- QString::fromLatin1("%1.%2/libraryPath")
- .arg(QT_VERSION >> 16)
- .arg((QT_VERSION & 0xff00) >> 8);
- QStringList pathlist = settings.value(libpathkey).toString().split(QLatin1Char(':'));
-#ifndef QT_NO_LIBRARY
- if (! pathlist.isEmpty()) {
- QStringList::ConstIterator it = pathlist.constBegin();
- while (it != pathlist.constEnd())
- QApplication::addLibraryPath(*it++);
- }
-#endif
-
- // read new QStyle
- QString stylename = settings.value(QLatin1String("style")).toString();
- if (QCoreApplication::startingUp()) {
- if (!stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull())
- QApplicationPrivate::styleOverride = stylename;
- } else {
- QApplication::setStyle(stylename);
- }
-
- int num =
- settings.value(QLatin1String("doubleClickInterval"),
- QApplication::doubleClickInterval()).toInt();
- QApplication::setDoubleClickInterval(num);
-
- num =
- settings.value(QLatin1String("cursorFlashTime"),
- QApplication::cursorFlashTime()).toInt();
- QApplication::setCursorFlashTime(num);
-
-#ifndef QT_NO_WHEELEVENT
- num =
- settings.value(QLatin1String("wheelScrollLines"),
- QApplication::wheelScrollLines()).toInt();
- QApplication::setWheelScrollLines(num);
-#endif
-
- QString colorspec = settings.value(QLatin1String("colorSpec"),
- QVariant(QLatin1String("default"))).toString();
- if (colorspec == QLatin1String("normal"))
- QApplication::setColorSpec(QApplication::NormalColor);
- else if (colorspec == QLatin1String("custom"))
- QApplication::setColorSpec(QApplication::CustomColor);
- else if (colorspec == QLatin1String("many"))
- QApplication::setColorSpec(QApplication::ManyColor);
- else if (colorspec != QLatin1String("default"))
- colorspec = QLatin1String("default");
-
-#ifndef QT_NO_TEXTCODEC
- QString defaultcodec = settings.value(QLatin1String("defaultCodec"),
- QVariant(QLatin1String("none"))).toString();
- if (defaultcodec != QLatin1String("none")) {
- QTextCodec *codec = QTextCodec::codecForName(defaultcodec.toLatin1());
- if (codec)
- QTextCodec::setCodecForTr(codec);
- }
-#endif
-
- int w = settings.value(QLatin1String("globalStrut/width")).toInt();
- int h = settings.value(QLatin1String("globalStrut/height")).toInt();
- QSize strut(w, h);
- if (strut.isValid())
- QApplication::setGlobalStrut(strut);
-
- QStringList effects = settings.value(QLatin1String("GUIEffects")).toStringList();
- QApplication::setEffectEnabled(Qt::UI_General,
- effects.contains(QLatin1String("general")));
- QApplication::setEffectEnabled(Qt::UI_AnimateMenu,
- effects.contains(QLatin1String("animatemenu")));
- QApplication::setEffectEnabled(Qt::UI_FadeMenu,
- effects.contains(QLatin1String("fademenu")));
- QApplication::setEffectEnabled(Qt::UI_AnimateCombo,
- effects.contains(QLatin1String("animatecombo")));
- QApplication::setEffectEnabled(Qt::UI_AnimateTooltip,
- effects.contains(QLatin1String("animatetooltip")));
- QApplication::setEffectEnabled(Qt::UI_FadeTooltip,
- effects.contains(QLatin1String("fadetooltip")));
- QApplication::setEffectEnabled(Qt::UI_AnimateToolBox,
- effects.contains(QLatin1String("animatetoolbox")));
-
- settings.beginGroup(QLatin1String("Font Substitutions"));
- QStringList fontsubs = settings.childKeys();
- if (!fontsubs.isEmpty()) {
- QStringList::Iterator it = fontsubs.begin();
- for (; it != fontsubs.end(); ++it) {
- QString fam = *it;
- QStringList subs = settings.value(fam).toStringList();
- QFont::insertSubstitutions(fam, subs);
- }
- }
- settings.endGroup();
-
- settings.endGroup(); // Qt
-
- settings.beginGroup(QLatin1String("QWS Font Fallbacks"));
- if (!settings.childKeys().isEmpty()) {
- // from qfontdatabase_qws.cpp
- extern void qt_applyFontDatabaseSettings(const QSettings &);
- qt_applyFontDatabaseSettings(settings);
- }
- settings.endGroup();
-
- return true;
-#else
- return false;
-#endif // QT_NO_SETTINGS
-}
-
-
-
-static void init_display()
-{
- if (qt_fbdpy) return; // workaround server==client case
-
- // Connect to FB server
- qt_fbdpy = new QWSDisplay();
-
- // Get display parameters
- // Set paintdevice parameters
- // XXX initial info sent from server
- // Misc. initialization
-
- QColormap::initialize();
- QFont::initialize();
-#ifndef QT_NO_CURSOR
- QCursorData::initialize();
-#endif
-
- qApp->setObjectName(appName);
-
- if (!QApplicationPrivate::sys_font) {
-#ifdef QT_NO_FREETYPE
- QFont f = QFont(QLatin1String("helvetica"), 10);
-#else
- QFont f = QFont(QLatin1String("DejaVu Sans"), 12);
-#endif
- QApplicationPrivate::setSystemFont(f);
- }
- qt_set_qws_resources();
-}
-
-void qt_init_display()
-{
- qt_is_gui_used = true;
- qws_single_process = true;
- init_display();
-}
-
-static bool read_bool_env_var(const char *var, bool defaultvalue)
-{
- // returns true if env variable is set to non-zero
- // returns false if env var is set to zero
- // returns defaultvalue if env var not set
- char *x = ::getenv(var);
- return (x && *x) ? (strcmp(x,"0") != 0) : defaultvalue;
-}
-
-static int read_int_env_var(const char *var, int defaultvalue)
-{
- bool ok;
- int r = qgetenv(var).toInt(&ok);
- return ok ? r : defaultvalue;
-}
-
-void qt_init(QApplicationPrivate *priv, int type)
-{
-#ifdef QT_NO_QWS_MULTIPROCESS
- if (type == QApplication::GuiClient)
- type = QApplication::GuiServer;
-#endif
- if (type == QApplication::GuiServer)
- qt_is_gui_used = false; //we'll turn it on in a second
- qws_sw_cursor = read_bool_env_var("QWS_SW_CURSOR",qws_sw_cursor);
- qws_screen_is_interlaced = read_bool_env_var("QWS_INTERLACE",false);
-
- const char *display = ::getenv("QWS_DISPLAY");
- if (display)
- qws_display_spec = display; // since we setenv later!
-
- //qws_savefonts = qgetenv("QWS_SAVEFONTS") != 0;
- //qws_shared_memory = qgetenv("QWS_NOSHARED") == 0;
-
- mouse_double_click_distance = read_int_env_var("QWS_DBLCLICK_DISTANCE", 5);
-
- priv->inputContext = 0;
-
- int flags = 0;
- char *p;
- int argc = priv->argc;
- char **argv = priv->argv;
- int j;
-
- // Set application name
-
- if (argv && *argv) { //apparently, we allow people to pass 0 on the other platforms
- p = strrchr(argv[0], '/');
- appName = QString::fromLocal8Bit(p ? p + 1 : argv[0]);
- }
-
- // Get command line params
-
- j = argc ? 1 : 0;
- QString decoration;
- for (int i=1; i<argc; i++) {
- if (argv[i] && *argv[i] != '-') {
- argv[j++] = argv[i];
- continue;
- }
- QByteArray arg = argv[i];
- if (arg == "-fn" || arg == "-font") {
- if (++i < argc)
- appFont = argv[i];
- } else if (arg == "-bg" || arg == "-background") {
- if (++i < argc)
- appBGCol = argv[i];
- } else if (arg == "-btn" || arg == "-button") {
- if (++i < argc)
- appBTNCol = argv[i];
- } else if (arg == "-fg" || arg == "-foreground") {
- if (++i < argc)
- appFGCol = argv[i];
- } else if (arg == "-name") {
- if (++i < argc)
- appName = QString::fromLocal8Bit(argv[i]);
- } else if (arg == "-title") {
- if (++i < argc)
- mwTitle = argv[i];
- } else if (arg == "-geometry") {
- if (++i < argc)
- mwGeometry = argv[i];
- } else if (arg == "-shared") {
- qws_shared_memory = true;
- } else if (arg == "-noshared") {
- qws_shared_memory = false;
- } else if (arg == "-savefonts") {
- qws_savefonts = true;
- } else if (arg == "-nosavefonts") {
- qws_savefonts = false;
- } else if (arg == "-swcursor") {
- qws_sw_cursor = true;
- } else if (arg == "-noswcursor") {
- qws_sw_cursor = false;
- } else if (arg == "-keyboard") {
- flags &= ~QWSServer::DisableKeyboard;
- } else if (arg == "-nokeyboard") {
- flags |= QWSServer::DisableKeyboard;
- } else if (arg == "-mouse") {
- flags &= ~QWSServer::DisableMouse;
- } else if (arg == "-nomouse") {
- flags |= QWSServer::DisableMouse;
- } else if (arg == "-qws") {
- type = QApplication::GuiServer;
- } else if (arg == "-interlaced") {
- qws_screen_is_interlaced = true;
- } else if (arg == "-display") {
- if (++i < argc)
- qws_display_spec = argv[i];
- } else if (arg == "-decoration") {
- if (++i < argc)
- decoration = QString::fromLocal8Bit(argv[i]);
- } else {
- argv[j++] = argv[i];
- }
- }
- if(j < priv->argc) {
- priv->argv[j] = 0;
- priv->argc = j;
- }
-
- mouseInWidget = new QPointer<QWidget>;
-
- const QString disp = QString::fromLatin1(qws_display_spec);
- QRegExp regexp(QLatin1String(":(\\d+)$"));
- if (regexp.lastIndexIn(disp) != -1) {
- const QString capture = regexp.cap(1);
- bool ok = false;
- int id = capture.toInt(&ok);
- if (ok)
- qws_display_id = id;
- }
-
- if (type == QApplication::GuiServer) {
- qt_appType = QApplication::Type(type);
- qws_single_process = true;
- QWSServer::startup(flags);
- if (!display) // if not already set
- qputenv("QWS_DISPLAY", qws_display_spec);
- }
-
- if(qt_is_gui_used) {
- init_display();
-#ifndef QT_NO_QWS_MANAGER
- if (decoration.isEmpty() && !qws_decoration) {
- const QStringList keys = QDecorationFactory::keys();
- if (!keys.isEmpty())
- decoration = keys.first();
- }
- if (!decoration.isEmpty())
- qws_decoration = QApplication::qwsSetDecoration(decoration);
-#endif // QT_NO_QWS_MANAGER
-#ifndef QT_NO_QWS_INPUTMETHODS
- qApp->setInputContext(new QWSInputContext(qApp));
-#endif
- }
-
-/*### convert interlace style
- if (qws_screen_is_interlaced)
- QApplication::setStyle(new QInterlaceStyle);
-*/
-}
-
-/*****************************************************************************
- qt_cleanup() - cleans up when the application is finished
- *****************************************************************************/
-
-void qt_cleanup()
-{
- QPixmapCache::clear();
-#ifndef QT_NO_CURSOR
- QCursorData::cleanup();
-#endif
- QFont::cleanup();
- QColormap::cleanup();
-
- if (qws_single_process) {
- QWSServer::closedown();
- }
-
- qDeleteAll(outgoing);
- outgoing.clear();
- qDeleteAll(incoming);
- incoming.clear();
-
- if (qt_is_gui_used) {
- delete qt_fbdpy;
- }
- qt_fbdpy = 0;
-
-#ifndef QT_NO_QWS_MANAGER
- delete qws_decoration;
- qws_decoration = 0;
-#endif
-
- delete mouseInWidget;
- mouseInWidget = 0;
-
-#if !defined(QT_NO_IM)
- delete QApplicationPrivate::inputContext;
- QApplicationPrivate::inputContext = 0;
-#endif
-}
-
-
-/*****************************************************************************
- Platform specific global and internal functions
- *****************************************************************************/
-
-QString QApplicationPrivate::appName() const // get application name
-{
- return QT_PREPEND_NAMESPACE(appName);
-}
-
-/*****************************************************************************
- Platform specific QApplication members
- *****************************************************************************/
-
-#define NoValue 0x0000
-#define XValue 0x0001
-#define YValue 0x0002
-#define WidthValue 0x0004
-#define HeightValue 0x0008
-#define AllValues 0x000F
-#define XNegative 0x0010
-#define YNegative 0x0020
-
-/* Copyright notice for ReadInteger and parseGeometry
-
-Copyright (c) 1985, 1986, 1987 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from the X Consortium.
-
-*/
-/*
- * XParseGeometry parses strings of the form
- * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
- * width, height, xoffset, and yoffset are unsigned integers.
- * Example: "=80x24+300-49"
- * The equal sign is optional.
- * It returns a bitmask that indicates which of the four values
- * were actually found in the string. For each value found,
- * the corresponding argument is updated; for each value
- * not found, the corresponding argument is left unchanged.
- */
-
-static int
-ReadInteger(char *string, char **NextString)
-{
- register int Result = 0;
- int Sign = 1;
-
- if (*string == '+')
- string++;
- else if (*string == '-')
- {
- string++;
- Sign = -1;
- }
- for (; (*string >= '0') && (*string <= '9'); string++)
- {
- Result = (Result * 10) + (*string - '0');
- }
- *NextString = string;
- if (Sign >= 0)
- return Result;
- else
- return -Result;
-}
-
-static int parseGeometry(const char* string,
- int* x, int* y, int* width, int* height)
-{
- int mask = NoValue;
- register char *strind;
- unsigned int tempWidth=0, tempHeight=0;
- int tempX=0, tempY=0;
- char *nextCharacter;
-
- if (!string || (*string == '\0')) return mask;
- if (*string == '=')
- string++; /* ignore possible '=' at beg of geometry spec */
-
- strind = const_cast<char *>(string);
- if (*strind != '+' && *strind != '-' && *strind != 'x') {
- tempWidth = ReadInteger(strind, &nextCharacter);
- if (strind == nextCharacter)
- return 0;
- strind = nextCharacter;
- mask |= WidthValue;
- }
-
- if (*strind == 'x' || *strind == 'X') {
- strind++;
- tempHeight = ReadInteger(strind, &nextCharacter);
- if (strind == nextCharacter)
- return 0;
- strind = nextCharacter;
- mask |= HeightValue;
- }
-
- if ((*strind == '+') || (*strind == '-')) {
- if (*strind == '-') {
- strind++;
- tempX = -ReadInteger(strind, &nextCharacter);
- if (strind == nextCharacter)
- return 0;
- strind = nextCharacter;
- mask |= XNegative;
-
- }
- else
- { strind++;
- tempX = ReadInteger(strind, &nextCharacter);
- if (strind == nextCharacter)
- return 0;
- strind = nextCharacter;
- }
- mask |= XValue;
- if ((*strind == '+') || (*strind == '-')) {
- if (*strind == '-') {
- strind++;
- tempY = -ReadInteger(strind, &nextCharacter);
- if (strind == nextCharacter)
- return 0;
- strind = nextCharacter;
- mask |= YNegative;
-
- }
- else
- {
- strind++;
- tempY = ReadInteger(strind, &nextCharacter);
- if (strind == nextCharacter)
- return 0;
- strind = nextCharacter;
- }
- mask |= YValue;
- }
- }
-
- /* If strind isn't at the end of the string then it's an invalid
- geometry specification. */
-
- if (*strind != '\0') return 0;
-
- if (mask & XValue)
- *x = tempX;
- if (mask & YValue)
- *y = tempY;
- if (mask & WidthValue)
- *width = tempWidth;
- if (mask & HeightValue)
- *height = tempHeight;
- return mask;
-}
-
-#ifdef QT3_SUPPORT
-void QApplication::setMainWidget(QWidget *mainWidget)
-{
- QApplicationPrivate::main_widget = mainWidget;
- if (QApplicationPrivate::main_widget) // give WM command line
- QApplicationPrivate::applyQWSSpecificCommandLineArguments(QApplicationPrivate::main_widget);
-}
-#endif
-
-void QApplicationPrivate::applyQWSSpecificCommandLineArguments(QWidget *main_widget)
-{
- static bool beenHereDoneThat = false;
- if (beenHereDoneThat)
- return;
- beenHereDoneThat = true;
- if (qApp->windowIcon().isNull() && main_widget->testAttribute(Qt::WA_SetWindowIcon))
- qApp->setWindowIcon(main_widget->windowIcon());
- if (mwTitle) // && main_widget->windowTitle().isEmpty())
- main_widget->setWindowTitle(QString::fromLocal8Bit(mwTitle));
- if (mwGeometry) { // parse geometry
- int x = 0;
- int y = 0;
- int w = 0;
- int h = 0;
- int m = parseGeometry(mwGeometry, &x, &y, &w, &h);
- QSize minSize = main_widget->minimumSize();
- QSize maxSize = main_widget->maximumSize();
- if ((m & XValue) == 0)
- x = main_widget->geometry().x();
- if ((m & YValue) == 0)
- y = main_widget->geometry().y();
- if ((m & WidthValue) == 0)
- w = main_widget->width();
- if ((m & HeightValue) == 0)
- h = main_widget->height();
- w = qMin(w,maxSize.width());
- h = qMin(h,maxSize.height());
- w = qMax(w,minSize.width());
- h = qMax(h,minSize.height());
- if ((m & XNegative)) {
- x = qApp->desktop()->width() + x - w;
- x -= (main_widget->frameGeometry().width() - main_widget->width()) / 2;
- } else {
- x += (main_widget->geometry().x() - main_widget->x());
- }
- if ((m & YNegative)) {
- y = qApp->desktop()->height() + y - h;
- } else {
- y += (main_widget->geometry().y() - main_widget->y());
- }
-
- main_widget->setGeometry(x, y, w, h);
- }
-}
-
-/*****************************************************************************
- QApplication cursor stack
- *****************************************************************************/
-#ifndef QT_NO_CURSOR
-void QApplication::setOverrideCursor(const QCursor &cursor)
-{
- qApp->d_func()->cursor_list.prepend(cursor);
-
- QWidget *w = QWidget::mouseGrabber();
- if (!w && qt_last_x)
- w = topLevelAt(*qt_last_x, *qt_last_y);
- if (!w)
- w = desktop();
- QPaintDevice::qwsDisplay()->selectCursor(w, qApp->d_func()->cursor_list.first().handle());
-}
-
-void QApplication::restoreOverrideCursor()
-{
- if (qApp->d_func()->cursor_list.isEmpty())
- return;
- qApp->d_func()->cursor_list.removeFirst();
-
- QWidget *w = QWidget::mouseGrabber();
- if (!w && qt_last_x)
- w = topLevelAt(*qt_last_x, *qt_last_y);
- if (!w)
- w = desktop();
-
- int cursor_handle = Qt::ArrowCursor;
- if (qApp->d_func()->cursor_list.isEmpty()) {
- qws_overrideCursor = false;
- QWidget *upw = QApplication::widgetAt(*qt_last_x, *qt_last_y);
- if (upw)
- cursor_handle = upw->cursor().handle();
- } else {
- cursor_handle = qApp->d_func()->cursor_list.first().handle();
- }
- QPaintDevice::qwsDisplay()->selectCursor(w, cursor_handle);
-}
-#endif// QT_NO_CURSOR
-
-
-
-/*****************************************************************************
- Routines to find a Qt widget from a screen position
- *****************************************************************************/
-
-/*!
- \internal
-*/
-QWidget *QApplicationPrivate::findWidget(const QObjectList& list,
- const QPoint &pos, bool rec)
-{
- QWidget *w;
-
- for (int i = list.size()-1; i >= 0; --i) {
- if (list.at(i)->isWidgetType()) {
- w = static_cast<QWidget*>(list.at(i));
- if (w->isVisible() && !w->testAttribute(Qt::WA_TransparentForMouseEvents) && w->geometry().contains(pos)
- && (!w->d_func()->extra || w->d_func()->extra->mask.isEmpty() || w->d_func()->extra->mask.contains(pos - w->geometry().topLeft()) )) {
- if (!rec)
- return w;
- QWidget *c = w->childAt(w->mapFromParent(pos));
- return c ? c : w;
- }
- }
- }
- return 0;
-}
-
-
-QWidget *QApplication::topLevelAt(const QPoint &pos)
-{
- //### QWSDisplay::windowAt() is currently only implemented in the server process
- int winId = QPaintDevice::qwsDisplay()->windowAt(pos);
- if (winId !=0)
- return QWidget::find(winId);
-
-#if 1
- // fallback implementation for client processes
-//### This is slightly wrong: we have no guarantee that the list is in
-//### stacking order, so if the topmost window is transparent, we may
-//### return the wrong widget
-
- QWidgetList list = topLevelWidgets();
- for (int i = list.size()-1; i >= 0; --i) {
- QWidget *w = list[i];
- if (w != QApplication::desktop() &&
- w->isVisible() && w->d_func()->localAllocatedRegion().contains(w->mapFromParent(pos))
- )
- return w;
- }
-#endif
- return 0;
-}
-
-void QApplication::beep()
-{
-}
-
-void QApplication::alert(QWidget *, int)
-{
-}
-
-int QApplication::qwsProcessEvent(QWSEvent* event)
-{
- Q_D(QApplication);
- QScopedLoopLevelCounter loopLevelCounter(d->threadData);
- int oldstate = -1;
- bool isMove = false;
- if (event->type == QWSEvent::Mouse) {
- QWSMouseEvent::SimpleData &mouse = event->asMouse()->simpleData;
- isMove = mouse_x_root != mouse.x_root || mouse_y_root != mouse.y_root;
- oldstate = mouse_state;
- mouse_x_root = mouse.x_root;
- mouse_y_root = mouse.y_root;
- mouse_state = mouse.state;
- }
-
- long unused;
- if (filterEvent(event, &unused)) // send through app filter
- return 1;
-
- if (qwsEventFilter(event)) // send through app filter
- return 1;
-
-
-#ifndef QT_NO_QWS_PROPERTIES
- if (event->type == QWSEvent::PropertyNotify) {
- QWSPropertyNotifyEvent *e = static_cast<QWSPropertyNotifyEvent*>(event);
- if (e->simpleData.property == 424242) { // Clipboard
-#ifndef QT_NO_CLIPBOARD
- if (qt_clipboard) {
- QClipboardEvent e(reinterpret_cast<QEventPrivate*>(event));
- QApplication::sendEvent(qt_clipboard, &e);
- }
-#endif
- }
- }
-#endif //QT_NO_QWS_PROPERTIES
-#ifndef QT_NO_COP
- else if (event->type == QWSEvent::QCopMessage) {
- QWSQCopMessageEvent *e = static_cast<QWSQCopMessageEvent*>(event);
- QCopChannel::sendLocally(QLatin1String(e->channel), QLatin1String(e->message), e->data);
- return 0;
- }
-#endif
-#if !defined(QT_NO_QWS_QPF2)
- else if (event->type == QWSEvent::Font) {
- QWSFontEvent *e = static_cast<QWSFontEvent *>(event);
- if (e->simpleData.type == QWSFontEvent::FontRemoved) {
- QFontCache::instance()->removeEngineForFont(e->fontName);
- }
- }
-#endif
-
- QPointer<QETWidget> widget = static_cast<QETWidget*>(QWidget::find(WId(event->window())));
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- if (!widget) { // XXX: hw: hack for accessing subsurfaces
- extern QWSWindowSurface* qt_findWindowSurface(int);
- QWSWindowSurface *s = qt_findWindowSurface(event->window());
- if (s)
- widget = static_cast<QETWidget*>(s->window());
- }
-#endif
-
-#ifndef QT_NO_DIRECTPAINTER
- if (!widget && d->directPainters) {
- QDirectPainter *dp = d->directPainters->value(WId(event->window()));
- if (dp == 0) {
- } else if (event->type == QWSEvent::Region) {
- QWSRegionEvent *e = static_cast<QWSRegionEvent*>(event);
- QRegion reg;
- reg.setRects(e->rectangles, e->simpleData.nrectangles);
- qt_directpainter_region(dp, reg, e->simpleData.type);
- return 1;
-#ifndef QT_NO_QWSEMBEDWIDGET
- } else if (event->type == QWSEvent::Embed) {
- QWSEmbedEvent *e = static_cast<QWSEmbedEvent*>(event);
- qt_directpainter_embedevent(dp, e);
- return 1;
- #endif // QT_NO_QWSEMBEDWIDGET
- }
- }
-#endif // QT_NO_DIRECTPAINTER
-
-#ifndef QT_NO_QWS_MANAGER
- if (d->last_manager && event->type == QWSEvent::Mouse) {
- QPoint pos(event->asMouse()->simpleData.x_root, event->asMouse()->simpleData.y_root);
- if (!d->last_manager->cachedRegion().contains(pos)) {
- // MouseEvent not yet delivered, so QCursor::pos() is not yet updated, sending 2 x pos
- QMouseEvent outside(QEvent::MouseMove, pos, pos, Qt::NoButton, 0, 0);
- QApplication::sendSpontaneousEvent(d->last_manager, &outside);
- d->last_manager = 0;
- qt_last_cursor = 0xffffffff; //decoration is like another window; must redo cursor
- }
- }
-#endif // QT_NO_QWS_MANAGER
-
- QETWidget *keywidget=0;
- bool grabbed=false;
- if (event->type==QWSEvent::Key || event->type == QWSEvent::IMEvent || event->type == QWSEvent::IMQuery) {
- keywidget = static_cast<QETWidget*>(QWidget::keyboardGrabber());
- if (keywidget) {
- grabbed = true;
- } else {
- if (QWidget *popup = QApplication::activePopupWidget()) {
- if (popup->focusWidget())
- keywidget = static_cast<QETWidget*>(popup->focusWidget());
- else
- keywidget = static_cast<QETWidget*>(popup);
- } else if (QApplicationPrivate::focus_widget && QApplicationPrivate::focus_widget->isVisible())
- keywidget = static_cast<QETWidget*>(QApplicationPrivate::focus_widget);
- else if (widget)
- keywidget = static_cast<QETWidget*>(widget->window());
- }
- } else if (event->type==QWSEvent::MaxWindowRect) {
- QRect r = static_cast<QWSMaxWindowRectEvent*>(event)->simpleData.rect;
- setMaxWindowRect(r);
- return 0;
-#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
- } else if (event->type == QWSEvent::ScreenTransformation) {
- QWSScreenTransformationEvent *pe = static_cast<QWSScreenTransformationEvent*>(event);
- setScreenTransformation(pe->simpleData.screen,
- pe->simpleData.transformation);
- return 0;
-#endif
- } else if (widget && event->type==QWSEvent::Mouse) {
- // The mouse event is to one of my top-level widgets
- // which one?
- const int btnMask = Qt::LeftButton | Qt::RightButton | Qt::MidButton;
- QPoint p(event->asMouse()->simpleData.x_root,
- event->asMouse()->simpleData.y_root);
- int mouseButtonState = event->asMouse()->simpleData.state & btnMask;
- static int btnstate = 0;
-
- QETWidget *w = static_cast<QETWidget*>(QWidget::mouseGrabber());
- if (w && !mouseButtonState && qt_pressGrab == w)
- qt_pressGrab = 0;
-#ifndef QT_NO_QWS_MANAGER
- if (!w)
- w = static_cast<QETWidget*>(QWSManager::grabbedMouse());
-#endif
- if (w) {
- // Our mouse is grabbed - send it.
- widget = w;
- btnstate = mouseButtonState;
- } else {
- static QWidget *gw = 0;
- // Three jobs to do here:
- // 1. find the child widget this event belongs to.
- // 2. make sure the cursor is correct.
- // 3. handle implicit mouse grab due to button press.
- w = widget; // w is the widget the cursor is in.
-
- //### ??? alloc_region
- //#### why should we get events outside alloc_region ????
- if (1 /*widget->data->alloc_region.contains(dp) */) {
- // Find the child widget that the cursor is in.
- w = static_cast<QETWidget*>(widget->childAt(widget->mapFromParent(p)));
- if (!w)
- w = widget;
-#ifndef QT_NO_CURSOR
- // Update Cursor.
- if (!gw || gw != w || qt_last_cursor == 0xffffffff) {
- QCursor *curs = 0;
- if (!qApp->d_func()->cursor_list.isEmpty())
- curs = &qApp->d_func()->cursor_list.first();
- else if (w->d_func()->extraData())
- curs = w->d_func()->extraData()->curs;
- QWidget *pw = w;
- // If this widget has no cursor set, try parent.
- while (!curs) {
- pw = pw->parentWidget();
- if (!pw)
- break;
- if (pw->d_func()->extraData())
- curs = pw->d_func()->extraData()->curs;
- }
- if (!qws_overrideCursor) {
- if (curs)
- QPaintDevice::qwsDisplay()->selectCursor(widget, curs->handle());
- else
- QPaintDevice::qwsDisplay()->selectCursor(widget, Qt::ArrowCursor);
- }
- }
-#endif
- gw = w;
- } else {
- // This event is not for any of our widgets
- gw = 0;
- }
- if (mouseButtonState && !btnstate) {
- // The server has grabbed the mouse for us.
- // Remember which of my widgets has it.
- qt_pressGrab = w;
- if (!widget->isActiveWindow() &&
- (!app_do_modal || QApplication::activeModalWidget() == widget) &&
- !((widget->windowFlags() & Qt::FramelessWindowHint) || (widget->windowType() == Qt::Tool))) {
- widget->activateWindow();
- if (widget->raiseOnClick())
- widget->raise();
- }
- }
- btnstate = mouseButtonState;
- widget = w;
- }
- }
-
- if (!widget) { // don't know this window
- if (!QWidget::mouseGrabber()
-#ifndef QT_NO_QWS_MANAGER
- && !QWSManager::grabbedMouse()
-#endif
- ) {
- qt_last_cursor = 0xffffffff; // cursor can be changed by another application
- }
-
- QWidget* popup = QApplication::activePopupWidget();
- if (popup) {
-
- /*
- That is more than suboptimal. The real solution should
- do some keyevent and buttonevent translation, so that
- the popup still continues to work as the user expects.
- Unfortunately this translation is currently only
- possible with a known widget. I'll change that soon
- (Matthias).
- */
-
- // Danger - make sure we don't lock the server
- switch (event->type) {
- case QWSEvent::Mouse:
- case QWSEvent::Key:
- do {
- popup->close();
- } while ((popup = qApp->activePopupWidget()));
- return 1;
- }
- }
- if (event->type == QWSEvent::Mouse && *mouseInWidget) {
- QApplicationPrivate::dispatchEnterLeave(0, *mouseInWidget);
- (*mouseInWidget) = 0;
- }
- return -1;
- }
-
- if (app_do_modal) // modal event handling
- if (!qt_try_modal(widget, event)) {
- return 1;
- }
-
- if (widget->qwsEvent(event)) // send through widget filter
- return 1;
- switch (event->type) {
-
- case QWSEvent::Mouse: { // mouse event
- QWSMouseEvent *me = event->asMouse();
- QWSMouseEvent::SimpleData &mouse = me->simpleData;
-
- // Translate a QWS event into separate move
- // and press/release events
- // Beware of reentrancy: we can enter a modal state
- // inside translateMouseEvent
-
- if (isMove) {
- QWSMouseEvent move = *me;
- move.simpleData.state = oldstate;
- widget->translateMouseEvent(&move, oldstate);
- }
- if ((mouse.state&Qt::MouseButtonMask) != (oldstate&Qt::MouseButtonMask)) {
- widget->translateMouseEvent(me, oldstate);
- }
-
- if (mouse.delta != 0)
- widget->translateWheelEvent(me);
-
- if (qt_button_down && (mouse_state & Qt::MouseButtonMask) == 0)
- qt_button_down = 0;
-
- break;
- }
- case QWSEvent::Key: // keyboard event
- if (keywidget) // should always exist
- keywidget->translateKeyEvent(static_cast<QWSKeyEvent*>(event), grabbed);
- break;
-
-#ifndef QT_NO_QWS_INPUTMETHODS
- case QWSEvent::IMEvent:
- if (keywidget) // should always exist
- QWSInputContext::translateIMEvent(keywidget, static_cast<QWSIMEvent*>(event));
- break;
-
- case QWSEvent::IMQuery:
- if (keywidget) // should always exist
- QWSInputContext::translateIMQueryEvent(keywidget, static_cast<QWSIMQueryEvent*>(event));
- break;
-
- case QWSEvent::IMInit:
- QWSInputContext::translateIMInitEvent(static_cast<QWSIMInitEvent*>(event));
- break;
-#endif
- case QWSEvent::Region:
- widget->translateRegionEvent(static_cast<QWSRegionEvent*>(event));
- break;
- case QWSEvent::Focus:
- if ((static_cast<QWSFocusEvent*>(event))->simpleData.get_focus) {
- if (widget == static_cast<QWidget *>(desktop()))
- return true; // not interesting
- if (activeWindow() != widget) {
- setActiveWindow(widget);
- if (QApplicationPrivate::active_window)
- static_cast<QETWidget *>(QApplicationPrivate::active_window)->repaintDecoration(desktop()->rect(), false);
- if (widget && !d->inPopupMode()) {
- QWidget *w = widget->focusWidget();
- while (w && w->focusProxy())
- w = w->focusProxy();
- if (w && (w->focusPolicy() != Qt::NoFocus))
- w->setFocus();
- else
- widget->QWidget::focusNextPrevChild(true);
- if (!QApplicationPrivate::focus_widget) {
- if (widget->focusWidget())
- widget->focusWidget()->setFocus();
- else
- widget->window()->setFocus();
- }
- }
- }
- } else { // lost focus
- if (widget == static_cast<QWidget *>(desktop()))
- return true; // not interesting
- if (QApplicationPrivate::focus_widget) {
- QETWidget *old = static_cast<QETWidget *>(QApplicationPrivate::active_window);
- setActiveWindow(0);
- qt_last_cursor = 0xffffffff;
- //QApplicationPrivate::active_window = 0;
- if (old)
- old->repaintDecoration(desktop()->rect(), false);
- /* activateWindow() sends focus events
- QApplication::setFocusWidget(0);
- */
- }
- }
- break;
-
- case QWSEvent::WindowOperation:
- if (static_cast<QWidget *>(widget) == desktop())
- return true;
- switch ((static_cast<QWSWindowOperationEvent *>(event))->simpleData.op) {
- case QWSWindowOperationEvent::Show:
- widget->show();
- break;
- case QWSWindowOperationEvent::Hide:
- widget->hide();
- break;
- case QWSWindowOperationEvent::ShowMaximized:
- widget->showMaximized();
- break;
- case QWSWindowOperationEvent::ShowMinimized:
- widget->showMinimized();
- break;
- case QWSWindowOperationEvent::ShowNormal:
- widget->showNormal();
- break;
- case QWSWindowOperationEvent::Close:
- widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
- break;
- }
- break;
-#ifndef QT_NO_QWSEMBEDWIDGET
- case QWSEvent::Embed:
- widget->translateEmbedEvent(static_cast<QWSEmbedEvent*>(event));
- break;
-#endif
- default:
- break;
- }
-
- return 0;
-}
-
-bool QApplication::qwsEventFilter(QWSEvent *)
-{
- return false;
-}
-
-void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors)
-{
- if (start < 0 || start > 39) {
- qWarning("QApplication::qwsSetCustomColors: start < 0 || start > 39");
- return;
- }
- if (start + numColors > 40) {
- numColors = 40 - start;
- qWarning("QApplication::qwsSetCustomColors: Too many colors");
- }
- start += 216;
- for (int i = 0; i < numColors; i++) {
- qt_screen->set(start + i, qRed(colorTable[i]), qGreen(colorTable[i]),
- qBlue(colorTable[i]));
- }
-}
-
-#ifndef QT_NO_QWS_MANAGER
-QDecoration &QApplication::qwsDecoration()
-{
- return *qws_decoration;
-}
-
-void QApplication::qwsSetDecoration(QDecoration *dec)
-{
- if (dec) {
- delete qws_decoration;
- qws_decoration = dec;
- QWidgetList widgets = topLevelWidgets();
- for (int i = 0; i < widgets.size(); ++i) {
- QWidget *w = widgets[i];
- if (w->isVisible() && w != desktop()) {
- static_cast<QETWidget *>(w)->updateRegion();
- static_cast<QETWidget *>(w)->repaintDecoration(desktop()->rect(), false);
- if (w->isMaximized())
- w->showMaximized();
- }
- }
- }
-}
-
-QDecoration* QApplication::qwsSetDecoration(const QString &decoration)
-{
- QDecoration *decore = QDecorationFactory::create(decoration);
- if (!decore)
- return 0;
-
- qwsSetDecoration(decore);
- return decore;
-}
-
-#endif
-
-bool QApplicationPrivate::modalState()
-{
- return app_do_modal;
-}
-
-void QApplicationPrivate::enterModal_sys(QWidget *widget)
-{
- if (!qt_modal_stack)
- qt_modal_stack = new QWidgetList;
- qt_modal_stack->insert(0, widget);
- app_do_modal = true;
-}
-
-void QApplicationPrivate::leaveModal_sys(QWidget *widget)
-{
- if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
- if (qt_modal_stack->isEmpty()) {
- delete qt_modal_stack;
- qt_modal_stack = 0;
- }
- }
- app_do_modal = qt_modal_stack != 0;
-}
-
-static bool qt_try_modal(QWidget *widget, QWSEvent *event)
-{
- QWidget * top = 0;
-
- if (QApplicationPrivate::tryModalHelper(widget, &top))
- return true;
-
- bool block_event = false;
- bool paint_event = false;
-
- switch (event->type) {
- case QWSEvent::Focus:
- if (!static_cast<QWSFocusEvent*>(event)->simpleData.get_focus)
- break;
- // drop through
- case QWSEvent::Mouse: // disallow mouse/key events
- case QWSEvent::Key:
- block_event = true;
- break;
- }
-
- if (top->parentWidget() == 0 && (block_event || paint_event))
- top->raise();
-
- return !block_event;
-}
-
-static int openPopupCount = 0;
-void QApplicationPrivate::openPopup(QWidget *popup)
-{
- openPopupCount++;
- if (!popupWidgets) { // create list
- popupWidgets = new QWidgetList;
-
- /* only grab if you are the first/parent popup */
- QPaintDevice::qwsDisplay()->grabMouse(popup,true);
- QPaintDevice::qwsDisplay()->grabKeyboard(popup,true);
- popupGrabOk = true;
- }
- popupWidgets->append(popup); // add to end of list
-
- // popups are not focus-handled by the window system (the first
- // popup grabbed the keyboard), so we have to do that manually: A
- // new popup gets the focus
- if (popup->focusWidget()) {
- popup->focusWidget()->setFocus(Qt::PopupFocusReason);
- } else if (popupWidgets->count() == 1) { // this was the first popup
- if (QWidget *fw = QApplication::focusWidget()) {
- QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
- QApplication::sendEvent(fw, &e);
- }
- }
-}
-
-void QApplicationPrivate::closePopup(QWidget *popup)
-{
- if (!popupWidgets)
- return;
-
- popupWidgets->removeAll(popup);
- if (popup == popupOfPopupButtonFocus) {
- popupButtonFocus = 0;
- popupOfPopupButtonFocus = 0;
- }
- if (popupWidgets->count() == 0) { // this was the last popup
- popupCloseDownMode = true; // control mouse events
- delete popupWidgets;
- popupWidgets = 0;
- if (popupGrabOk) { // grabbing not disabled
- QPaintDevice::qwsDisplay()->grabMouse(popup,false);
- QPaintDevice::qwsDisplay()->grabKeyboard(popup,false);
- popupGrabOk = false;
- // XXX ungrab keyboard
- }
- if (active_window) {
- if (QWidget *fw = active_window->focusWidget()) {
- if (fw != QApplication::focusWidget()) {
- fw->setFocus(Qt::PopupFocusReason);
- } else {
- QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason);
- QApplication::sendEvent(fw, &e);
- }
- }
- }
- } else {
- // popups are not focus-handled by the window system (the
- // first popup grabbed the keyboard), so we have to do that
- // manually: A popup was closed, so the previous popup gets
- // the focus.
- QWidget* aw = popupWidgets->last();
- if (QWidget *fw = aw->focusWidget())
- fw->setFocus(Qt::PopupFocusReason);
- }
-}
-
-/*****************************************************************************
- Event translation; translates FB events to Qt events
- *****************************************************************************/
-
-//
-// Mouse event translation
-//
-// FB doesn't give mouse double click events, so we generate them by
-// comparing window, time and position between two mouse press events.
-//
-
-
-// Needed for QCursor::pos
-
-static const int AnyButton = (Qt::LeftButton | Qt::MidButton | Qt::RightButton);
-
-
-
-//
-// Wheel event translation
-//
-bool QETWidget::translateWheelEvent(const QWSMouseEvent *me)
-{
-#ifdef QT_NO_WHEELEVENT
- Q_UNUSED(me);
- return false;
-#else
- const QWSMouseEvent::SimpleData &mouse = me->simpleData;
-
- // Figure out wheeling direction:
- // Horizontal wheel w/o Alt
- // OR Vertical wheel w/ Alt ==> Horizontal wheeling
- // ..all other permutations ==> Vertical wheeling
- int axis = mouse.delta / 120; // WHEEL_DELTA?
- Qt::Orientation orient = ((axis == 2 || axis == -2) && ((mouse.state & Qt::AltModifier) == 0))
- ||((axis == 1 || axis == -1) && mouse.state & Qt::AltModifier)
- ? Qt::Horizontal : Qt::Vertical;
-
- QPoint mousePoint = QPoint(mouse.x_root, mouse.y_root);
-
- // send the event to the widget or its ancestors
- QWidget* popup = qApp->activePopupWidget();
- if (popup && window() != popup)
- popup->close();
- QWheelEvent we(mapFromGlobal(mousePoint), mousePoint, mouse.delta,
- Qt::MouseButtons(mouse.state & Qt::MouseButtonMask),
- Qt::KeyboardModifiers(mouse.state & Qt::KeyboardModifierMask), orient);
- if (QApplication::sendSpontaneousEvent(this, &we))
- return true;
-
- // send the event to the widget that has the focus or its ancestors, if different
- QWidget *w = this;
- if (w != qApp->focusWidget() && (w = qApp->focusWidget())) {
- QWidget* popup = qApp->activePopupWidget();
- if (popup && w != popup)
- popup->hide();
- if (QApplication::sendSpontaneousEvent(w, &we))
- return true;
- }
- return false;
-#endif
-}
-
-bool QETWidget::translateMouseEvent(const QWSMouseEvent *event, int prevstate)
-{
- static bool manualGrab = false;
- QPoint pos;
- QPoint globalPos;
- int button = 0;
-
- if (sm_blockUserInput) // block user interaction during session management
- return true;
- const QWSMouseEvent::SimpleData &mouse = event->simpleData;
- pos = mapFromGlobal(QPoint(mouse.x_root, mouse.y_root));
-// if (qt_last_x) {
-// *qt_last_x=mouse.x_root;
-// *qt_last_y=mouse.y_root;
-// }
- globalPos.rx() = mouse.x_root;
- globalPos.ry() = mouse.y_root;
-
- QEvent::Type type = QEvent::None;
-
- Qt::MouseButtons buttonstate = Qt::MouseButtons(mouse.state & Qt::MouseButtonMask);
- Qt::KeyboardModifiers keystate = Qt::KeyboardModifiers(mouse.state & Qt::KeyboardModifierMask);
-
- if (mouse.state == prevstate) {
- // mouse move
- type = QEvent::MouseMove;
- } else if ((mouse.state&AnyButton) != (prevstate&AnyButton)) {
- Qt::MouseButtons current_buttons = Qt::MouseButtons(prevstate&Qt::MouseButtonMask);
- for (button = Qt::LeftButton; !type && button <= Qt::MidButton; button<<=1) {
- if ((mouse.state&button) != (current_buttons&button)) {
- // button press or release
- current_buttons = Qt::MouseButtons(current_buttons ^ button);
-
-#ifndef QT_NO_QWS_INPUTMETHODS
- //############ We used to do a QInputContext::reset(oldFocus);
- // when we changed the focus widget. See change 93389 for where the
- // focus code went. The IM code was (after testing for ClickToFocus):
- //if (mouse.state&button && w != QInputContext::microFocusWidget()) //button press
- // QInputContext::reset(oldFocus);
-
-#endif
- if (mouse.state&button) { //button press
- qt_button_down = childAt(pos);
- if (!qt_button_down)
- qt_button_down = this;
- if (/*XXX mouseActWindow == this &&*/
- mouseButtonPressed == button &&
- long(mouse.time) -long(mouseButtonPressTime)
- < QApplication::doubleClickInterval() &&
- qAbs(mouse.x_root - mouseXPos) < mouse_double_click_distance &&
- qAbs(mouse.y_root - mouseYPos) < mouse_double_click_distance ) {
- type = QEvent::MouseButtonDblClick;
- mouseButtonPressTime -= 2000; // no double-click next time
- } else {
- type = QEvent::MouseButtonPress;
- mouseButtonPressTime = mouse.time;
- }
- mouseButtonPressed = button; // save event params for
- mouseXPos = globalPos.x(); // future double click tests
- mouseYPos = globalPos.y();
- } else { // mouse button released
- if (manualGrab) { // release manual grab
- manualGrab = false;
- // XXX XUngrabPointer(x11Display(), CurrentTime);
- }
-
- type = QEvent::MouseButtonRelease;
- }
- }
- }
- button >>= 1;
- }
- //XXX mouseActWindow = winId(); // save some event params
-
- if (type == 0) { // event consumed
- return false; //EXIT in the normal case
- }
-
- if (qApp->d_func()->inPopupMode()) { // in popup mode
- QWidget *popup = qApp->activePopupWidget();
- // in X11, this would be the window we are over.
- // in QWS this is the top level popup. to allow mouse
- // events to other widgets, need to go through qApp->QApplicationPrivate::popupWidgets.
- QSize s(qt_screen->width(), qt_screen->height());
- for (int i = 0; i < QApplicationPrivate::popupWidgets->size(); ++i) {
- QWidget *w = QApplicationPrivate::popupWidgets->at(i);
-
- if ((w->windowType() == Qt::Popup) && w->d_func()->localAllocatedRegion().contains(globalPos - w->geometry().topLeft()))
- {
- popup = w;
- break;
- }
- }
- pos = popup->mapFromGlobal(globalPos);
- bool releaseAfter = false;
- QWidget *popupChild = popup->childAt(pos);
- QWidget *popupTarget = popupChild ? popupChild : popup;
-
- if (popup != popupOfPopupButtonFocus){
- popupButtonFocus = 0;
- popupOfPopupButtonFocus = 0;
- }
-
- if (!popupTarget->isEnabled()) {
- return false; //EXIT special case
- }
-
- switch (type) {
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonDblClick:
- popupButtonFocus = popupChild;
- popupOfPopupButtonFocus = popup;
- break;
- case QEvent::MouseButtonRelease:
- releaseAfter = true;
- break;
- default:
- break; // nothing for mouse move
- }
-
- int oldOpenPopupCount = openPopupCount;
-
- if (popupButtonFocus) {
- QMouseEvent e(type, popupButtonFocus->mapFromGlobal(globalPos),
- globalPos, Qt::MouseButton(button), buttonstate, keystate);
- QApplication::sendSpontaneousEvent(popupButtonFocus, & e);
- if (releaseAfter) {
- popupButtonFocus = 0;
- popupOfPopupButtonFocus = 0;
- }
- } else if (popupChild) {
- QMouseEvent e(type, popupChild->mapFromGlobal(globalPos),
- globalPos, Qt::MouseButton(button), buttonstate, keystate);
- QApplication::sendSpontaneousEvent(popupChild, & e);
- } else {
- QMouseEvent e(type, pos, globalPos, Qt::MouseButton(button), buttonstate, keystate);
- QApplication::sendSpontaneousEvent(popupChild ? popupChild : popup, & e);
- }
-#ifndef QT_NO_CONTEXTMENU
- if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) {
- QWidget *popupEvent = popup;
- if(popupButtonFocus)
- popupEvent = popupButtonFocus;
- else if(popupChild)
- popupEvent = popupChild;
- QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, keystate);
- QApplication::sendSpontaneousEvent(popupEvent, &e);
- }
-#endif // QT_NO_CONTEXTMENU
-
- if (releaseAfter)
- qt_button_down = 0;
-
- } else { //qApp not in popup mode
- QWidget *widget = this;
- QWidget *w = QWidget::mouseGrabber();
- if (!w && qt_button_down)
- w = qt_button_down;
- if (w && w != this) {
- widget = w;
- pos = mapToGlobal(pos);
- pos = w->mapFromGlobal(pos);
- }
-
- if (popupCloseDownMode) {
- popupCloseDownMode = false;
- if ((windowType() == Qt::Popup)) // ignore replayed event
- return true; //EXIT
- }
-
- QPointer<QWidget> leaveAfterRelease = 0;
- if (type == QEvent::MouseButtonRelease &&
- (mouse.state & (~button) & (Qt::LeftButton |
- Qt::MidButton |
- Qt::RightButton)) == 0) {
- // Button released outside the widget -> leave the widget after the
- // release event has been delivered.
- if (widget == qt_button_down && (pos.x() < 0 || pos.y() < 0))
- leaveAfterRelease = qt_button_down;
- qt_button_down = 0;
- }
-
- int oldOpenPopupCount = openPopupCount;
-
- QMouseEvent e(type, pos, globalPos, Qt::MouseButton(button), buttonstate, keystate);
-#ifndef QT_NO_QWS_MANAGER
- if (widget->isWindow() && widget->d_func()->topData()->qwsManager
- && (widget->d_func()->topData()->qwsManager->region().contains(globalPos)
- || QWSManager::grabbedMouse() )) {
- if ((*mouseInWidget)) {
- QApplicationPrivate::dispatchEnterLeave(0, *mouseInWidget);
- (*mouseInWidget) = 0;
- }
- QApplication::sendSpontaneousEvent(widget->d_func()->topData()->qwsManager, &e);
- qApp->d_func()->last_manager = widget->d_func()->topData()->qwsManager;
- } else
-#endif
- {
- if (widget != (*mouseInWidget)) {
- QApplicationPrivate::dispatchEnterLeave(widget, *mouseInWidget);
- (*mouseInWidget) = widget;
- qt_last_mouse_receiver = widget;
- }
- QApplication::sendSpontaneousEvent(widget, &e);
- if (leaveAfterRelease && !QWidget::mouseGrabber()) {
- *mouseInWidget = QApplication::widgetAt(globalPos);
- qt_last_mouse_receiver = *mouseInWidget;
- QApplicationPrivate::dispatchEnterLeave(*mouseInWidget, leaveAfterRelease);
- leaveAfterRelease = 0;
- }
- }
-#ifndef QT_NO_CONTEXTMENU
- if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) {
- QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, keystate);
- QApplication::sendSpontaneousEvent(widget, &e);
- }
-#endif // QT_NO_CONTEXTMENU
- }
- return true;
-}
-
-
-bool QETWidget::translateKeyEvent(const QWSKeyEvent *event, bool grab) /* grab is used in the #ifdef */
-{
- int code = -1;
- //### Qt assumes keyboard state is state *before*, while QWS uses state after the event
- static Qt::KeyboardModifiers oldstate;
- Qt::KeyboardModifiers state = oldstate;
- oldstate = event->simpleData.modifiers;
-
- if (sm_blockUserInput) // block user interaction during session management
- return true;
-
- if (!isEnabled())
- return true;
-
- QEvent::Type type = event->simpleData.is_press ?
- QEvent::KeyPress : QEvent::KeyRelease;
- bool autor = event->simpleData.is_auto_repeat;
- QString text;
- char ascii = 0;
- if (event->simpleData.unicode) {
- QChar ch(event->simpleData.unicode);
- if (ch.unicode() != 0xffff)
- text += ch;
- ascii = ch.toLatin1();
- }
- code = event->simpleData.keycode;
-
-#if defined QT3_SUPPORT && !defined(QT_NO_SHORTCUT)
- if (type == QEvent::KeyPress && !grab
- && static_cast<QApplicationPrivate*>(qApp->d_ptr.data())->use_compat()) {
- // send accel events if the keyboard is not grabbed
- QKeyEvent a(type, code, state, text, autor, int(text.length()));
- if (static_cast<QApplicationPrivate*>(qApp->d_ptr.data())->qt_tryAccelEvent(this, &a))
- return true;
- }
-#else
- Q_UNUSED(grab);
-#endif
- if (!text.isEmpty() && testAttribute(Qt::WA_KeyCompression)) {
- // the widget wants key compression so it gets it
-
- // XXX not implemented
- }
-
- QKeyEvent e(type, code, state, text, autor, int(text.length()));
- return QApplication::sendSpontaneousEvent(this, &e);
-}
-
-bool QETWidget::translateRegionEvent(const QWSRegionEvent *event)
-{
- QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(windowSurface());
- Q_ASSERT(surface);
-
- QRegion region;
- region.setRects(event->rectangles, event->simpleData.nrectangles);
-
- switch (event->simpleData.type) {
- case QWSRegionEvent::Allocation:
- region.translate(-mapToGlobal(QPoint()));
- surface->setClipRegion(region);
- break;
-#ifdef QT_QWS_CLIENTBLIT
- case QWSRegionEvent::DirectPaint:
- surface->setDirectRegion(region, event->simpleData.id);
- break;
-#endif
- default:
- break;
- }
-
- return true;
-}
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-void QETWidget::translateEmbedEvent(const QWSEmbedEvent *event)
-{
- if (event->simpleData.type | QWSEmbedEvent::Region) {
- const QRegion region = event->region;
- setGeometry(region.boundingRect());
- setVisible(!region.isEmpty());
- }
-}
-#endif // QT_NO_QWSEMBEDWIDGET
-
-void QETWidget::repaintDecoration(QRegion r, bool post)
-{
- Q_UNUSED(post);
-#ifdef QT_NO_QWS_MANAGER
- Q_UNUSED(r);
-#else
- //please note that qwsManager is a QObject, not a QWidget.
- //therefore, normal ways of painting do not work.
- // However, it does listen to paint events.
-
- Q_D(QWidget);
- if (isWindow() && d->topData()->qwsManager && isVisible()) {
- QWSManager *manager = d->topData()->qwsManager;
- r &= manager->region();
- if (!r.isEmpty())
- manager->repaintRegion(QDecoration::All, QDecoration::Normal);
- }
-#endif
-}
-
-void QETWidget::updateRegion()
-{
- Q_D(QWidget);
-
- QTLWExtra *topextra = d->maybeTopData();
- if (!topextra)
- return;
-
- QRegion myregion = d->localRequestedRegion();
- myregion.translate(geometry().topLeft());
-
-#ifndef QT_NO_QWS_MANAGER
- QWSManager *manager = topextra->qwsManager;
- if (manager)
- myregion += manager->region();
-#endif
-
- QRect br(myregion.boundingRect());
- topextra->frameStrut.setCoords(d->data.crect.x() - br.x(),
- d->data.crect.y() - br.y(),
- br.right() - d->data.crect.right(),
- br.bottom() - d->data.crect.bottom());
-}
-
-void QApplication::setCursorFlashTime(int msecs)
-{
- QApplicationPrivate::cursor_flash_time = msecs;
-}
-
-
-int QApplication::cursorFlashTime()
-{
- return QApplicationPrivate::cursor_flash_time;
-}
-
-void QApplication::setDoubleClickInterval(int ms)
-{
- QApplicationPrivate::mouse_double_click_time = ms;
-}
-
-int QApplication::doubleClickInterval()
-{
- return QApplicationPrivate::mouse_double_click_time;
-}
-
-void QApplication::setKeyboardInputInterval(int ms)
-{
- QApplicationPrivate::keyboard_input_time = ms;
-}
-
-int QApplication::keyboardInputInterval()
-{
- return QApplicationPrivate::keyboard_input_time;
-}
-
-#ifndef QT_NO_WHEELEVENT
-void QApplication::setWheelScrollLines(int lines)
-{
- QApplicationPrivate::wheel_scroll_lines = lines;
-}
-
-int QApplication::wheelScrollLines()
-{
- return QApplicationPrivate::wheel_scroll_lines;
-}
-#endif
-
-void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
-{
- switch (effect) {
- case Qt::UI_AnimateMenu:
- QApplicationPrivate::animate_menu = enable;
- break;
- case Qt::UI_FadeMenu:
- if (enable)
- QApplicationPrivate::animate_menu = true;
- QApplicationPrivate::fade_menu = enable;
- break;
- case Qt::UI_AnimateCombo:
- QApplicationPrivate::animate_combo = enable;
- break;
- case Qt::UI_AnimateTooltip:
- QApplicationPrivate::animate_tooltip = enable;
- break;
- case Qt::UI_FadeTooltip:
- if (enable)
- QApplicationPrivate::animate_tooltip = true;
- QApplicationPrivate::fade_tooltip = enable;
- break;
- case Qt::UI_AnimateToolBox:
- QApplicationPrivate::animate_toolbox = enable;
- break;
- default:
- QApplicationPrivate::animate_ui = enable;
- break;
- }
-}
-
-bool QApplication::isEffectEnabled(Qt::UIEffect effect)
-{
- if (QColormap::instance().depth() < 16 || !QApplicationPrivate::animate_ui)
- return false;
-
- switch(effect) {
- case Qt::UI_AnimateMenu:
- return QApplicationPrivate::animate_menu;
- case Qt::UI_FadeMenu:
- return QApplicationPrivate::fade_menu;
- case Qt::UI_AnimateCombo:
- return QApplicationPrivate::animate_combo;
- case Qt::UI_AnimateTooltip:
- return QApplicationPrivate::animate_tooltip;
- case Qt::UI_FadeTooltip:
- return QApplicationPrivate::fade_tooltip;
- case Qt::UI_AnimateToolBox:
- return QApplicationPrivate::animate_toolbox;
- default:
- return QApplicationPrivate::animate_ui;
- }
-}
-
-void QApplication::setArgs(int c, char **v)
-{
- Q_D(QApplication);
- d->argc = c;
- d->argv = v;
-}
-
-void QApplicationPrivate::initializeMultitouch_sys()
-{ }
-void QApplicationPrivate::cleanupMultitouch_sys()
-{ }
-
-/* \internal
- This is used to clean up the qws server
- in case the QApplication constructor threw an exception
-*/
-QWSServerCleaner::~QWSServerCleaner()
-{
- if (qwsServer && qws_single_process)
- QWSServer::closedown();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index b55bdc684b..0a9e28ac8c 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -109,6 +109,7 @@ protected:
friend class QApplication;
friend class QApplicationPrivate;
+ friend class QGuiApplication;
friend class QBaseApplication;
friend class QDragManager;
friend class QMimeSource;
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index b8ce60e00d..89c0afa22d 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -64,14 +64,14 @@ bool QClipboard::event(QEvent *e)
const QMimeData* QClipboard::mimeData(Mode mode) const
{
- QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
if (!clipboard->supportsMode(mode)) return 0;
return clipboard->mimeData(mode);
}
void QClipboard::setMimeData(QMimeData* src, Mode mode)
{
- QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
if (!clipboard->supportsMode(mode)) return;
clipboard->setMimeData(src,mode);
@@ -81,7 +81,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode)
bool QClipboard::supportsMode(Mode mode) const
{
- QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
return clipboard->supportsMode(mode);
}
diff --git a/src/gui/kernel/qclipboard_qws.cpp b/src/gui/kernel/qclipboard_qws.cpp
deleted file mode 100644
index d50b412215..0000000000
--- a/src/gui/kernel/qclipboard_qws.cpp
+++ /dev/null
@@ -1,304 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qclipboard.h"
-
-#ifndef QT_NO_CLIPBOARD
-
-#include "qapplication.h"
-#include "qbitmap.h"
-#include "qdatetime.h"
-#include "qbuffer.h"
-#include "qwidget.h"
-#include "qevent.h"
-
-#include <qwsdisplay_qws.h>
-#include <qwsproperty_qws.h>
-#include <qwsevent_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-
-/*****************************************************************************
- Internal QClipboard functions for Qt for Embedded Linux
- *****************************************************************************/
-
-static const int TextClipboard=424242;
-static bool init = false;
-
-static inline void qwsInitClipboard()
-{
- //### this should go into QWSServer; it only needs to happen once.
- if( !init ) {
- QPaintDevice::qwsDisplay()->addProperty(0, TextClipboard);
- init = true;
- }
-}
-
-static QString qwsClipboardText()
-{
- char * data;
- int len;
- qwsInitClipboard();
- if( !QPaintDevice::qwsDisplay()->getProperty(0, TextClipboard, data, len) ) {
-// qDebug("Property received: %d bytes", len);
- }
-
- QString s((const QChar*)data, len/sizeof(QChar));
- // qDebug("Property received: '%s'", s.toAscii().constData());
- delete[] data;
- return s;
-}
-
-
-static void qwsSetClipboardText(const QString& s)
-{
- qwsInitClipboard();
- // qDebug("qwsSetClipboardText( %s )", s.toAscii().data());
- int len = s.length()*sizeof(QChar);
- QByteArray ba((const char*)s.unicode(), len);
- QPaintDevice::qwsDisplay()->
- setProperty(0, TextClipboard, QWSPropertyManager::PropReplace, ba);
-
-}
-
-class QClipboardData
-{
-public:
- QClipboardData();
- ~QClipboardData();
-
- void setSource(QMimeData* s)
- {
- if (s == src)
- return;
- delete src;
- src = s;
- }
- QMimeData* source()
- { return src; }
-#if 0
- void addTransferredPixmap(QPixmap pm)
- { /* TODO: queue them */
- transferred[tindex] = pm;
- tindex=(tindex+1)%2;
- }
- void clearTransfers()
- {
- transferred[0] = QPixmap();
- transferred[1] = QPixmap();
- }
-#endif
-
- void clear();
-
-private:
- QMimeData* src;
-
-#if 0
- QPixmap transferred[2];
- int tindex;
-#endif
-};
-
-QClipboardData::QClipboardData()
-{
- src = 0;
-#if 0
- tindex=0;
-#endif
-}
-
-QClipboardData::~QClipboardData()
-{
- delete src;
-}
-
-void QClipboardData::clear()
-{
- delete src;
- src = 0;
-}
-
-
-static QClipboardData *internalCbData = 0;
-
-static void cleanupClipboardData()
-{
- delete internalCbData;
- internalCbData = 0;
-}
-
-static QClipboardData *clipboardData()
-{
- if (internalCbData == 0) {
- internalCbData = new QClipboardData;
- qAddPostRoutine(cleanupClipboardData);
- }
- return internalCbData;
-}
-
-
-/*****************************************************************************
- QClipboard member functions for FB.
- *****************************************************************************/
-
-#if 0
-
-QString QClipboard::text() const
-{
- return qwsClipboardText();
-}
-
-void QClipboard::setText(const QString &text)
-{
- qwsSetClipboardText(text);
-}
-
-QString QClipboard::text(QString& subtype) const
-{
- QString r;
- if (subtype == "plain")
- r = text();
- return r;
-}
-
-#endif
-
-void QClipboard::clear(Mode mode)
-{
- setText(QString(), mode);
-}
-
-
-bool QClipboard::event(QEvent *e)
-{
- static bool recursionWatch = false;
- if (e->type() != QEvent::Clipboard || recursionWatch)
- return QObject::event(e);
-
- recursionWatch = true;
- QWSPropertyNotifyEvent *event = (QWSPropertyNotifyEvent *)(((QClipboardEvent *)e)->data());
- if (event && event->simpleData.state == QWSPropertyNotifyEvent::PropertyNewValue) {
- QClipboardData *d = clipboardData();
- QString t = qwsClipboardText();
- if( (d->source() == 0 && !t.isEmpty()) || (d->source() != 0 && d->source()->text() != t) ) {
- if( !d->source() )
- d->setSource(new QMimeData);
- d->source()->setText( t );
- emitChanged(QClipboard::Clipboard);
- }
- }
-
- recursionWatch = false;
- return true;
-}
-
-const QMimeData* QClipboard::mimeData(Mode mode) const
-{
- if (mode != Clipboard) return 0;
-
- QClipboardData *d = clipboardData();
- // Try and get data from QWSProperty if no mime data has been set on us.
- if( !d->source() ) {
- QString t = qwsClipboardText();
- if( !t.isEmpty() ) {
- QMimeData* nd = new QMimeData;
- nd->setText( t );
- d->setSource( nd );
- }
- }
- return d->source();
-}
-
-void QClipboard::setMimeData(QMimeData* src, Mode mode)
-{
- if (mode != Clipboard) return;
-
- QClipboardData *d = clipboardData();
-
- /* Propagate text data to other QWSClients */
-
- QString newText;
- if( src != 0 )
- newText = src->text();
- QString oldText;
- if( d->source() != 0 )
- oldText = d->source()->text();
-
- d->setSource(src);
-
- if( oldText != newText ) {
- if( d->source() == 0 ) {
- qwsSetClipboardText( QString() );
- } else {
- qwsSetClipboardText( d->source()->text() );
- }
- }
-
- emitChanged(QClipboard::Clipboard);
-}
-
-bool QClipboard::supportsMode(Mode mode) const
-{
- return (mode == Clipboard);
-}
-
-bool QClipboard::ownsMode(Mode mode) const
-{
- if (mode == Clipboard)
- qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!");
- return false;
-}
-
-void QClipboard::connectNotify( const char * )
-{
-}
-
-void QClipboard::ownerDestroyed()
-{
-}
-
-#endif // QT_NO_CLIPBOARD
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index c993763634..b47ec04d66 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -152,18 +152,6 @@ private:
#endif
};
-#ifdef QT3_SUPPORT
-// CursorShape is defined in X11/X.h
-#ifdef CursorShape
-#define X_CursorShape CursorShape
-#undef CursorShape
-#endif
-typedef Qt::CursorShape QCursorShape;
-#ifdef X_CursorShape
-#define CursorShape X_CursorShape
-#endif
-#endif
-
/*****************************************************************************
QCursor stream functions
*****************************************************************************/
diff --git a/src/gui/kernel/qcursor_qws.cpp b/src/gui/kernel/qcursor_qws.cpp
deleted file mode 100644
index 60674c9507..0000000000
--- a/src/gui/kernel/qcursor_qws.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcursor.h>
-#include <private/qcursor_p.h>
-#include <qbitmap.h>
-#include <qwsdisplay_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-#ifndef QT_NO_CURSOR
-
-static int nextCursorId = Qt::BitmapCursor;
-
-/*****************************************************************************
- Internal QCursorData class
- *****************************************************************************/
-
-QCursorData::QCursorData(Qt::CursorShape s)
- : cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s)
-{
- ref = 1;
-}
-
-QCursorData::~QCursorData()
-{
- delete bm;
- delete bmm;
- QT_TRY {
- QPaintDevice::qwsDisplay()->destroyCursor(id);
- } QT_CATCH(const std::bad_alloc &) {
- // do nothing.
- }
-}
-
-
-/*****************************************************************************
- Global cursors
- *****************************************************************************/
-
-int QCursor::handle() const
-{
- return d->id;
-}
-
-
-QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
-{
- if (!QCursorData::initialized)
- QCursorData::initialize();
- if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) {
- qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
- QCursorData *c = qt_cursorTable[0];
- c->ref.ref();
- return c;
- }
- QCursorData *d = new QCursorData;
- d->bm = new QBitmap(bitmap);
- d->bmm = new QBitmap(mask);
- d->cshape = Qt::BitmapCursor;
- d->id = ++nextCursorId;
- d->hx = hotX >= 0 ? hotX : bitmap.width() / 2;
- d->hy = hotY >= 0 ? hotY : bitmap.height() / 2;
-
- QPaintDevice::qwsDisplay()->defineCursor(d->id, *d->bm, *d->bmm, d->hx, d->hy);
- return d;
-}
-
-void QCursorData::update()
-{
-}
-
-#endif //QT_NO_CURSOR
-
-extern int *qt_last_x,*qt_last_y;
-
-QPoint QCursor::pos()
-{
- // This doesn't know about hotspots yet so we disable it
- //qt_accel_update_cursor();
- if (qt_last_x)
- return QPoint(*qt_last_x, *qt_last_y);
- else
- return QPoint();
-}
-
-void QCursor::setPos(int x, int y)
-{
- // Need to check, since some X servers generate null mouse move
- // events, causing looping in applications which call setPos() on
- // every mouse move event.
- //
- if (pos() == QPoint(x, y))
- return;
- QPaintDevice::qwsDisplay()->setCursorPosition(x, y);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdesktopwidget_qpa.cpp b/src/gui/kernel/qdesktopwidget_qpa.cpp
index 6257a8bc06..7b175dbe95 100644
--- a/src/gui/kernel/qdesktopwidget_qpa.cpp
+++ b/src/gui/kernel/qdesktopwidget_qpa.cpp
@@ -41,7 +41,6 @@
#include "qdesktopwidget.h"
#include "private/qapplication_p.h"
-#include "private/qgraphicssystem_p.h"
#include <QWidget>
#include "private/qwidget_p.h"
#include "private/qdesktopwidget_qpa_p.h"
@@ -52,8 +51,7 @@ QT_USE_NAMESPACE
void QDesktopWidgetPrivate::updateScreenList()
{
Q_Q(QDesktopWidget);
-
- QList<QPlatformScreen *> screenList = QApplicationPrivate::platformIntegration()->screens();
+ QList<QPlatformScreen *> screenList = QGuiApplicationPrivate::platformIntegration()->screens();
int targetLength = screenList.length();
int currentLength = screens.length();
@@ -99,7 +97,7 @@ QDesktopWidget::~QDesktopWidget()
bool QDesktopWidget::isVirtualDesktop() const
{
- return QApplicationPrivate::platformIntegration()->isVirtualDesktop();
+ return QGuiApplicationPrivate::platformIntegration()->isVirtualDesktop();
}
int QDesktopWidget::primaryScreen() const
@@ -109,7 +107,7 @@ int QDesktopWidget::primaryScreen() const
int QDesktopWidget::numScreens() const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return qMax(pi->screens().size(), 1);
}
@@ -123,7 +121,7 @@ QWidget *QDesktopWidget::screen(int screen)
const QRect QDesktopWidget::availableGeometry(int screenNo) const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
if (screenNo == -1)
screenNo = 0;
@@ -135,7 +133,7 @@ const QRect QDesktopWidget::availableGeometry(int screenNo) const
const QRect QDesktopWidget::screenGeometry(int screenNo) const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
if (screenNo == -1)
screenNo = 0;
@@ -159,7 +157,7 @@ int QDesktopWidget::screenNumber(const QWidget *w) const
int QDesktopWidget::screenNumber(const QPoint &p) const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
for (int i = 0; i < screens.size(); ++i)
diff --git a/src/gui/kernel/qdesktopwidget_qws.cpp b/src/gui/kernel/qdesktopwidget_qws.cpp
deleted file mode 100644
index 1e21845df6..0000000000
--- a/src/gui/kernel/qdesktopwidget_qws.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdesktopwidget.h"
-#include "qscreen_qws.h"
-#include "private/qapplication_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-QDesktopWidget::QDesktopWidget()
- : QWidget(0, Qt::Desktop)
-{
- setObjectName(QLatin1String("desktop"));
-}
-
-QDesktopWidget::~QDesktopWidget()
-{
-}
-
-bool QDesktopWidget::isVirtualDesktop() const
-{
- return true;
-}
-
-int QDesktopWidget::primaryScreen() const
-{
- return 0;
-}
-
-int QDesktopWidget::numScreens() const
-{
- QScreen *screen = QScreen::instance();
- if (!screen)
- return 0;
-
- const QList<QScreen*> subScreens = screen->subScreens();
- return qMax(subScreens.size(), 1);
-}
-
-QWidget *QDesktopWidget::screen(int)
-{
- return this;
-}
-
-const QRect QDesktopWidget::availableGeometry(int screenNo) const
-{
- const QScreen *screen = QScreen::instance();
- if (screenNo == -1)
- screenNo = 0;
- if (!screen || screenNo < 0)
- return QRect();
-
- const QList<QScreen*> subScreens = screen->subScreens();
- if (!subScreens.isEmpty()) {
- if (screenNo >= subScreens.size())
- return QRect();
- screen = subScreens.at(screenNo);
- }
-
- QApplicationPrivate *ap = QApplicationPrivate::instance();
- const QRect r = ap->maxWindowRect(screen);
- if (!r.isEmpty())
- return r;
-
- return screen->region().boundingRect();
-}
-
-const QRect QDesktopWidget::screenGeometry(int screenNo) const
-{
- const QScreen *screen = QScreen::instance();
- if (screenNo == -1)
- screenNo = 0;
- if (!screen || screenNo < 0)
- return QRect();
-
- const QList<QScreen*> subScreens = screen->subScreens();
- if (subScreens.size() == 0 && screenNo == 0)
- return screen->region().boundingRect();
-
- if (screenNo >= subScreens.size())
- return QRect();
-
- return subScreens.at(screenNo)->region().boundingRect();
-}
-
-int QDesktopWidget::screenNumber(const QWidget *w) const
-{
- if (!w)
- return 0;
-
- QRect frame = w->frameGeometry();
- if (!w->isWindow())
- frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0)));
- const QPoint midpoint = (frame.topLeft() + frame.bottomRight()) / 2;
- return screenNumber(midpoint);
-}
-
-int QDesktopWidget::screenNumber(const QPoint &p) const
-{
- const QScreen *screen = QScreen::instance();
- if (!screen || !screen->region().contains(p))
- return -1;
-
- const QList<QScreen*> subScreens = screen->subScreens();
- if (subScreens.size() == 0)
- return 0;
-
- for (int i = 0; i < subScreens.size(); ++i)
- if (subScreens.at(i)->region().contains(p))
- return i;
-
- return -1;
-}
-
-void QDesktopWidget::resizeEvent(QResizeEvent *)
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdnd_qws.cpp b/src/gui/kernel/qdnd_qpa.cpp
index b744c2f085..b744c2f085 100644
--- a/src/gui/kernel/qdnd_qws.cpp
+++ b/src/gui/kernel/qdnd_qpa.cpp
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index 1c59d41a94..9ff1543e51 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1350,10 +1350,6 @@ bool QDragManager::eventFilter(QObject * o, QEvent * e)
case QEvent::KeyRelease:
case QEvent::Wheel:
case QEvent::ShortcutOverride:
-#ifdef QT3_SUPPORT
- case QEvent::Accel:
- case QEvent::AccelAvailable:
-#endif
return true;
default:
return false;
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 277a5e845d..5f0cfd7d69 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -180,36 +180,6 @@ QMouseEvent::~QMouseEvent()
{
}
-#ifdef QT3_SUPPORT
-/*!
- Use QMouseEvent(\a type, \a pos, \a button, \c buttons, \c
- modifiers) instead, where \c buttons is \a state &
- Qt::MouseButtonMask and \c modifiers is \a state &
- Qt::KeyButtonMask.
-*/
-QMouseEvent::QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state)
- : QInputEvent(type), p(pos), b((Qt::MouseButton)button)
-{
- g = QCursor::pos();
- mouseState = Qt::MouseButtons((state ^ b) & Qt::MouseButtonMask);
- modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask);
-}
-
-/*!
- Use QMouseEvent(\a type, \a pos, \a globalPos, \a button,
- \c buttons, \c modifiers) instead, where
- \c buttons is \a state & Qt::MouseButtonMask and
- \c modifiers is \a state & Qt::KeyButtonMask.
-*/
-QMouseEvent::QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
- Qt::ButtonState button, int state)
- : QInputEvent(type), p(pos), g(globalPos), b((Qt::MouseButton)button)
-{
- mouseState = Qt::MouseButtons((state ^ b) & Qt::MouseButtonMask);
- modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask);
-}
-#endif
-
/*!
Constructs a mouse event object.
@@ -557,19 +527,6 @@ QWheelEvent::~QWheelEvent()
{
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the other constructors instead.
-*/
-QWheelEvent::QWheelEvent(const QPoint &pos, int delta, int state, Qt::Orientation orient)
- : QInputEvent(Wheel), p(pos), d(delta), o(orient)
-{
- g = QCursor::pos();
- mouseState = Qt::MouseButtons(state & Qt::MouseButtonMask);
- modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask);
-}
-#endif
-
/*!
Constructs a wheel event object.
@@ -587,18 +544,6 @@ QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), d(delta), mouseState(buttons), o(orient)
{}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the other constructors instead.
-*/
-QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state,
- Qt::Orientation orient)
- : QInputEvent(Wheel), p(pos), g(globalPos), d(delta), o(orient)
-{
- mouseState = Qt::MouseButtons(state & Qt::MouseButtonMask);
- modState = Qt::KeyboardModifiers(state & (int) Qt::KeyButtonMask);
-}
-#endif
#endif // QT_NO_WHEELEVENT
/*!
@@ -992,34 +937,6 @@ bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
\sa Qt::WA_KeyCompression
*/
-#ifdef QT3_SUPPORT
-/*!
- \fn QKeyEvent::QKeyEvent(Type type, int key, int ascii,
- int modifiers, const QString &text,
- bool autorep, ushort count)
-
- Use one of the other constructors instead.
-*/
-
-/*!
- \fn int QKeyEvent::ascii() const
-
- Use text() instead.
-*/
-
-/*!
- \fn Qt::ButtonState QKeyEvent::state() const
-
- Use QInputEvent::modifiers() instead.
-*/
-
-/*!
- \fn Qt::ButtonState QKeyEvent::stateAfter() const
-
- Use modifiers() instead.
-*/
-#endif
-
/*!
\class QFocusEvent
\brief The QFocusEvent class contains event parameters for widget focus
@@ -1090,23 +1007,6 @@ Qt::FocusReason QFocusEvent::reason() const
false.
*/
-#ifdef QT3_SUPPORT
-/*!
- \enum QFocusEvent::Reason
- \compat
-
- Use Qt::FocusReason instead.
-
- \value Mouse Same as Qt::MouseFocusReason.
- \value Tab Same as Qt::TabFocusReason.
- \value Backtab Same as Qt::BacktabFocusReason.
- \value MenuBar Same as Qt::MenuBarFocusReason.
- \value ActiveWindow Same as Qt::ActiveWindowFocusReason
- \value Other Same as Qt::OtherFocusReason
- \value Popup Same as Qt::PopupFocusReason
- \value Shortcut Same as Qt::ShortcutFocusReason
-*/
-#endif
/*!
\class QPaintEvent
@@ -1175,18 +1075,6 @@ QPaintEvent::QPaintEvent(const QRect &paintRect)
{}
-#ifdef QT3_SUPPORT
- /*!
- Constructs a paint event object with both a \a paintRegion and a
- \a paintRect, both of which represent the area of the widget that
- needs to be updated.
-
-*/
-QPaintEvent::QPaintEvent(const QRegion &paintRegion, const QRect &paintRect)
- : QEvent(Paint), m_rect(paintRect), m_region(paintRegion), m_erased(false)
-{}
-#endif
-
/*!
\internal
*/
@@ -1453,17 +1341,6 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPo
: QInputEvent(ContextMenu, modifiers), p(pos), gp(globalPos), reas(reason)
{}
-#ifdef QT3_SUPPORT
-/*!
- Constructs a context menu event with the given \a reason for the
- position specified by \a pos in widget coordinates and \a globalPos
- in global screen coordinates. \a dummy is ignored.
-*/
-QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
- int /* dummy */)
- : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason)
-{}
-#endif
/*! \internal */
QContextMenuEvent::~QContextMenuEvent()
@@ -1489,24 +1366,6 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
gp = QCursor::pos();
}
-#ifdef QT3_SUPPORT
-/*!
- Constructs a context menu event with the given \a reason for the
- position specified by \a pos in widget coordinates. \a dummy is
- ignored.
-*/
-QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, int /* dummy */)
- : QInputEvent(ContextMenu), p(pos), reas(reason)
-{
- gp = QCursor::pos();
-}
-
-Qt::ButtonState QContextMenuEvent::state() const
-{
- return Qt::ButtonState(int(QApplication::keyboardModifiers())|QApplication::mouseButtons());
-}
-#endif
-
/*!
\fn const QPoint &QContextMenuEvent::pos() const
@@ -2538,37 +2397,6 @@ void QDropEvent::setDropAction(Qt::DropAction action)
\sa setDropAction(), proposedAction(), {QEvent::accept()}{accept()}
*/
-#ifdef QT3_SUPPORT
-/*!
- Use dropAction() instead.
-
- The table below shows the correspondance between the return type
- of action() and the return type of dropAction().
-
- \table
- \header \i Old enum value \i New enum value
- \row \i QDropEvent::Copy \i Qt::CopyAction
- \row \i QDropEvent::Move \i Qt::MoveAction
- \row \i QDropEvent::Link \i Qt::LinkAction
- \row \i other \i Qt::CopyAction
- \endtable
-*/
-
-QT3_SUPPORT QDropEvent::Action QDropEvent::action() const
-{
- switch(drop_action) {
- case Qt::CopyAction:
- return Copy;
- case Qt::MoveAction:
- return Move;
- case Qt::LinkAction:
- return Link;
- default:
- return Copy;
- }
-}
-#endif
-
/*!
\fn void QDropEvent::setPoint(const QPoint &point)
\compat
@@ -3471,12 +3299,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
case QEvent::UngrabKeyboard:
n = "UngrabKeyboard";
break;
-#ifdef QT3_SUPPORT
- case QEvent::ChildInsertedRequest:
- n = "ChildInsertedRequest";
- break;
- case QEvent::ChildInserted: n = "ChildInserted";
-#endif
case QEvent::ChildAdded: n = n ? n : "ChildAdded";
case QEvent::ChildPolished: n = n ? n : "ChildPolished";
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
@@ -3628,60 +3450,6 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
{
}
-#ifdef QT3_SUPPORT
-
-/*!
- \class QMenubarUpdatedEvent
- \internal
- Event sent by QMenuBar to tell Q3Workspace to update itself.
-*/
-
-/*! \internal
-
-*/
-QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
-:QEvent(QEvent::MenubarUpdated), m_menuBar(menuBar) {}
-
-/*!
- \fn QMenuBar *QMenubarUpdatedEvent::menuBar()
- \internal
-*/
-
-/*!
- \fn bool operator==(QKeyEvent *e, QKeySequence::StandardKey key)
-
- \relates QKeyEvent
-
- Returns true if \a key is currently bound to the key combination
- specified by \a e.
-
- Equivalent to \c {e->matches(key)}.
-*/
-
-/*!
- \fn bool operator==(QKeySequence::StandardKey key, QKeyEvent *e)
-
- \relates QKeyEvent
-
- Returns true if \a key is currently bound to the key combination
- specified by \a e.
-
- Equivalent to \c {e->matches(key)}.
-*/
-
-/*!
- \internal
-
- \class QKeyEventEx
- \ingroup events
-
- \brief The QKeyEventEx class provides more extended information about a keyevent.
-
- This class is for internal use only, and exists to aid the shortcut system on
- various platforms to get all the information it needs.
-*/
-
-#endif
/*!
\class QTouchEvent
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 93c2bc53b6..6128db4a64 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -107,15 +107,6 @@ public:
inline bool hasExtendedInfo() const { return reinterpret_cast<const QMouseEvent *>(d) == this; }
QPointF posF() const;
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state);
- QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
- Qt::ButtonState button, int state);
- inline QT3_SUPPORT Qt::ButtonState state() const
- { return Qt::ButtonState((mouseState^b)|int(modifiers())); }
- inline QT3_SUPPORT Qt::ButtonState stateAfter() const
- { return Qt::ButtonState(int(mouseState)|int(modifiers())); }
-#endif
protected:
QPoint p, g;
Qt::MouseButton b;
@@ -158,14 +149,6 @@ public:
inline Qt::MouseButtons buttons() const { return mouseState; }
Qt::Orientation orientation() const { return o; }
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state,
- Qt::Orientation orient = Qt::Vertical);
- QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state,
- Qt::Orientation orient = Qt::Vertical);
- inline QT3_SUPPORT Qt::ButtonState state() const
- { return static_cast<Qt::ButtonState>(int(buttons())|int(modifiers())); }
-#endif
protected:
QPoint p;
QPoint g;
@@ -248,22 +231,6 @@ public:
quint32 nativeVirtualKey() const;
quint32 nativeModifiers() const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/,
- int modifiers, const QString& text = QString(),
- bool autorep = false, ushort count = 1)
- : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
- c(count), autor(autorep)
- {
- if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast)
- ignore();
- }
- inline QT3_SUPPORT int ascii() const
- { return (txt.length() ? txt.unicode()->toLatin1() : 0); }
- inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); }
- inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); }
-#endif
-
protected:
QString txt;
int k;
@@ -281,12 +248,6 @@ public:
inline bool gotFocus() const { return type() == FocusIn; }
inline bool lostFocus() const { return type() == FocusOut; }
-#ifdef QT3_SUPPORT
- enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason,
- Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason,
- ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason,
- Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason };
-#endif
Qt::FocusReason reason();
Qt::FocusReason reason() const;
@@ -305,12 +266,6 @@ public:
inline const QRect &rect() const { return m_rect; }
inline const QRegion &region() const { return m_region; }
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect);
- inline QT3_SUPPORT bool erased() const { return m_erased; }
- inline QT3_SUPPORT void setErased(bool b) { m_erased = b; }
-#endif
-
protected:
friend class QApplication;
friend class QCoreApplication;
@@ -414,12 +369,6 @@ public:
inline Reason reason() const { return Reason(reas); }
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int);
- QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int);
-
- QT3_SUPPORT Qt::ButtonState state() const;
-#endif
protected:
QPoint p;
QPoint gp;
@@ -502,16 +451,6 @@ public:
QByteArray encodedData(const char*) const;
bool provides(const char*) const;
// END QT3_SUPPORT
-#ifdef QT3_SUPPORT
- inline void accept() { QEvent::accept(); }
- inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
- inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); }
-
- enum Action { Copy, Link, Move, Private, UserAction = Private };
- QT3_SUPPORT Action action() const;
- inline QT3_SUPPORT void acceptAction(bool y = true) { if (y) { drop_action = default_action; accept(); } }
- inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; }
-#endif
protected:
@@ -542,10 +481,6 @@ public:
inline void accept(const QRect & r) { accept(); rect = r; }
inline void ignore(const QRect & r) { ignore(); rect = r; }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
-#endif
-
protected:
friend class QApplication;
QRect rect;
@@ -716,18 +651,6 @@ private:
Qt::WindowStates ostate;
};
-#ifdef QT3_SUPPORT
-class QMenuBar;
-class Q_GUI_EXPORT QMenubarUpdatedEvent: public QEvent
-{
-public:
- QMenubarUpdatedEvent(QMenuBar * const menBar);
- inline QMenuBar *menuBar() { return m_menuBar; }
-private:
- QMenuBar *m_menuBar;
-};
-#endif
-
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
#endif
diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp
index 603aa2dbe7..c63e94e8c8 100644
--- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp
+++ b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp
@@ -87,7 +87,7 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
delete event;
continue;
}
- QApplicationPrivate::processWindowSystemEvent(event);
+ QGuiApplicationPrivate::processWindowSystemEvent(event);
delete event;
}
@@ -135,7 +135,7 @@ bool QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
{
static bool init = false;
if (!init) {
- if (QApplicationPrivate::platformIntegration()->createEventLoopIntegration()) {
+ if (QGuiApplicationPrivate::platformIntegration()->createEventLoopIntegration()) {
qWarning("Eventloop integration is not supported by the glib event dispatcher");
qWarning("Use the UNIX event dispatcher by defining environment variable QT_NO_GLIB=1");
}
diff --git a/src/gui/kernel/qeventdispatcher_glib_qws.cpp b/src/gui/kernel/qeventdispatcher_glib_qws.cpp
deleted file mode 100644
index 7a800cea07..0000000000
--- a/src/gui/kernel/qeventdispatcher_glib_qws.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qeventdispatcher_glib_qws_p.h"
-
-#include "qapplication.h"
-
-#include "qplatformdefs.h"
-#include "qapplication.h"
-#include "private/qwscommand_qws_p.h"
-#include "qwsdisplay_qws.h"
-#include "qwsevent_qws.h"
-#include "qwindowsystem_qws.h"
-
-#include <glib.h>
-
-QT_BEGIN_NAMESPACE
-
-// from qapplication_qws.cpp
-extern QWSDisplay* qt_fbdpy; // QWS `display'
-
-//from qwindowsystem_qws.cpp
-extern QList<QWSCommand*> *qt_get_server_queue();
-
-struct GQWSEventSource
-{
- GSource source;
- QEventLoop::ProcessEventsFlags flags;
- QWSEventDispatcherGlib *q;
- QWSEventDispatcherGlibPrivate *d;
-};
-
-class QWSEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate
-{
- Q_DECLARE_PUBLIC(QWSEventDispatcherGlib)
-
-public:
- QWSEventDispatcherGlibPrivate();
- GQWSEventSource *qwsEventSource;
- QList<QWSEvent*> queuedUserInputEvents;
-};
-
-static gboolean qwsEventSourcePrepare(GSource *s, gint *timeout)
-{
- if (timeout)
- *timeout = -1;
- GQWSEventSource *source = reinterpret_cast<GQWSEventSource *>(s);
- return qt_fbdpy->eventPending() || !source->d->queuedUserInputEvents.isEmpty()
- || !qt_get_server_queue()->isEmpty() ;
-}
-
-static gboolean qwsEventSourceCheck(GSource *s)
-{
- GQWSEventSource *source = reinterpret_cast<GQWSEventSource *>(s);
- return qt_fbdpy->eventPending() || !source->d->queuedUserInputEvents.isEmpty()
- || !qt_get_server_queue()->isEmpty() ;
-}
-
-static gboolean qwsEventSourceDispatch(GSource *s, GSourceFunc callback, gpointer user_data)
-{
- GQWSEventSource *source = reinterpret_cast<GQWSEventSource *>(s);
-
- //??? ulong marker = XNextRequest(X11->display);
- do {
- QWSEvent *event;
- if (!(source->flags & QEventLoop::ExcludeUserInputEvents)
- && !source->d->queuedUserInputEvents.isEmpty()) {
- // process a pending user input event
- event = source->d->queuedUserInputEvents.takeFirst();
- } else if (qt_fbdpy->eventPending()) {
- event = qt_fbdpy->getEvent();
-
- if (source->flags & QEventLoop::ExcludeUserInputEvents) {
- // queue user input events
-
- if (event->type == QWSEvent::Mouse || event->type == QWSEvent::Key) {
- source->d->queuedUserInputEvents.append(event);
- continue;
- }
- }
- } else {
- // no event to process
- break;
- }
-
- // send through event filter
- if (source->q->filterEvent(event)) {
- delete event;
- continue;
- }
-
- bool ret = qApp->qwsProcessEvent(event) == 1;
- delete event;
- if (ret) {
- return true;
- }
-
- } while (qt_fbdpy->eventPending());
-
- if (callback)
- callback(user_data);
- return true;
-}
-
-static GSourceFuncs qwsEventSourceFuncs = {
- qwsEventSourcePrepare,
- qwsEventSourceCheck,
- qwsEventSourceDispatch,
- NULL,
- NULL,
- NULL
-};
-
-QWSEventDispatcherGlibPrivate::QWSEventDispatcherGlibPrivate()
-{
- qwsEventSource = reinterpret_cast<GQWSEventSource *>(g_source_new(&qwsEventSourceFuncs,
- sizeof(GQWSEventSource)));
- g_source_set_can_recurse(&qwsEventSource->source, true);
-
- qwsEventSource->flags = QEventLoop::AllEvents;
- qwsEventSource->q = 0;
- qwsEventSource->d = 0;
-
- g_source_attach(&qwsEventSource->source, mainContext);
-}
-
-QWSEventDispatcherGlib::QWSEventDispatcherGlib(QObject *parent)
- : QEventDispatcherGlib(*new QWSEventDispatcherGlibPrivate, parent)
-{
-}
-
-QWSEventDispatcherGlib::~QWSEventDispatcherGlib()
-{
- Q_D(QWSEventDispatcherGlib);
-
- g_source_destroy(&d->qwsEventSource->source);
- d->qwsEventSource = 0;
-}
-
-bool QWSEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
-{
- Q_D(QWSEventDispatcherGlib);
- QEventLoop::ProcessEventsFlags saved_flags = d->qwsEventSource->flags;
- d->qwsEventSource->flags = flags;
- bool returnValue = QEventDispatcherGlib::processEvents(flags);
- d->qwsEventSource->flags = saved_flags;
- return returnValue;
-}
-
-void QWSEventDispatcherGlib::startingUp()
-{
- Q_D(QWSEventDispatcherGlib);
- d->qwsEventSource->q = this;
- d->qwsEventSource->d = d;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qeventdispatcher_glib_qws_p.h b/src/gui/kernel/qeventdispatcher_glib_qws_p.h
deleted file mode 100644
index 66cb2fc9dc..0000000000
--- a/src/gui/kernel/qeventdispatcher_glib_qws_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSEVENTDISPATCHER_GLIB_P_H
-#define QWSEVENTDISPATCHER_GLIB_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/private/qeventdispatcher_glib_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSEventDispatcherGlibPrivate;
-
-class QWSEventDispatcherGlib : public QEventDispatcherGlib
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWSEventDispatcherGlib)
-
-public:
- explicit QWSEventDispatcherGlib(QObject *parent = 0);
- ~QWSEventDispatcherGlib();
-
- bool processEvents(QEventLoop::ProcessEventsFlags flags);
-
- void startingUp();
-};
-
-QT_END_NAMESPACE
-
-#endif // QWSEVENTDISPATCHER_GLIB_P_H
diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp
index de53618fa8..26c8745954 100644
--- a/src/gui/kernel/qeventdispatcher_qpa.cpp
+++ b/src/gui/kernel/qeventdispatcher_qpa.cpp
@@ -144,8 +144,8 @@ public:
if (!m_integrationInitialised) {
QEventDispatcherQPAPrivate *that = const_cast<QEventDispatcherQPAPrivate *>(this);
if (qApp && (qApp->thread() == QThread::currentThread())) { // guiThread
- if (QApplicationPrivate::platformIntegration()) {
- that->eventLoopIntegration = QApplicationPrivate::platformIntegration()->createEventLoopIntegration();
+ if (QGuiApplicationPrivate::platformIntegration()) {
+ that->eventLoopIntegration = QGuiApplicationPrivate::platformIntegration()->createEventLoopIntegration();
if (that->eventLoopIntegration) {
that->selectWorker = new SelectWorker(that);
that->barrierBeforeBlocking = new Rendezvous;
@@ -236,7 +236,7 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags)
}
nevents++;
- QApplicationPrivate::processWindowSystemEvent(event);
+ QGuiApplicationPrivate::processWindowSystemEvent(event);
delete event;
}
diff --git a/src/gui/kernel/qeventdispatcher_qws.cpp b/src/gui/kernel/qeventdispatcher_qws.cpp
deleted file mode 100644
index c5df07ea86..0000000000
--- a/src/gui/kernel/qeventdispatcher_qws.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-#include "qapplication.h"
-#include "private/qwscommand_qws_p.h"
-#include "qwsdisplay_qws.h"
-#include "qwsevent_qws.h"
-#include "qwindowsystem_qws.h"
-#include "qeventdispatcher_qws_p.h"
-#include "private/qeventdispatcher_unix_p.h"
-#ifndef QT_NO_THREAD
-# include "qmutex.h"
-#endif
-
-#include <errno.h>
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class QEventDispatcherQWSPrivate : public QEventDispatcherUNIXPrivate
-{
- Q_DECLARE_PUBLIC(QEventDispatcherQWS)
-public:
- inline QEventDispatcherQWSPrivate()
- { }
- QList<QWSEvent*> queuedUserInputEvents;
-};
-
-
-QEventDispatcherQWS::QEventDispatcherQWS(QObject *parent)
- : QEventDispatcherUNIX(*new QEventDispatcherQWSPrivate, parent)
-{ }
-
-QEventDispatcherQWS::~QEventDispatcherQWS()
-{ }
-
-
-
-// from qapplication_qws.cpp
-extern QWSDisplay* qt_fbdpy; // QWS `display'
-
-//#define ZERO_FOR_THE_MOMENT
-
-bool QEventDispatcherQWS::processEvents(QEventLoop::ProcessEventsFlags flags)
-{
- Q_D(QEventDispatcherQWS);
- // process events from the QWS server
- int nevents = 0;
-
- // handle gui and posted events
- d->interrupt = false;
- QApplication::sendPostedEvents();
-
- while (!d->interrupt) { // also flushes output buffer ###can be optimized
- QWSEvent *event;
- if (!(flags & QEventLoop::ExcludeUserInputEvents)
- && !d->queuedUserInputEvents.isEmpty()) {
- // process a pending user input event
- event = d->queuedUserInputEvents.takeFirst();
- } else if (qt_fbdpy->eventPending()) {
- event = qt_fbdpy->getEvent(); // get next event
- if (flags & QEventLoop::ExcludeUserInputEvents) {
- // queue user input events
- if (event->type == QWSEvent::Mouse || event->type == QWSEvent::Key) {
- d->queuedUserInputEvents.append(event);
- continue;
- }
- }
- } else {
- break;
- }
-
- if (filterEvent(event)) {
- delete event;
- continue;
- }
- nevents++;
-
- bool ret = qApp->qwsProcessEvent(event) == 1;
- delete event;
- if (ret) {
- return true;
- }
- }
-
- if (!d->interrupt) {
- extern QList<QWSCommand*> *qt_get_server_queue();
- if (!qt_get_server_queue()->isEmpty()) {
- QWSServer::processEventQueue();
- }
-
- if (QEventDispatcherUNIX::processEvents(flags))
- return true;
- }
- return (nevents > 0);
-}
-
-bool QEventDispatcherQWS::hasPendingEvents()
-{
- extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
- return qGlobalPostedEventsCount() || qt_fbdpy->eventPending();
-}
-
-void QEventDispatcherQWS::startingUp()
-{
-
-}
-
-void QEventDispatcherQWS::closingDown()
-{
-
-}
-
-void QEventDispatcherQWS::flush()
-{
- if(qApp)
- qApp->sendPostedEvents();
- (void)qt_fbdpy->eventPending(); // flush
-}
-
-
-int QEventDispatcherQWS::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- timeval *timeout)
-{
- return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/kernel/qeventdispatcher_qws_p.h
deleted file mode 100644
index e73ed6ce5e..0000000000
--- a/src/gui/kernel/qeventdispatcher_qws_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEVENTDISPATCHER_QWS_P_H
-#define QEVENTDISPATCHER_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qeventdispatcher_unix_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QEventDispatcherQWSPrivate;
-
-class QEventDispatcherQWS : public QEventDispatcherUNIX
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QEventDispatcherQWS)
-
-public:
- explicit QEventDispatcherQWS(QObject *parent = 0);
- ~QEventDispatcherQWS();
-
- bool processEvents(QEventLoop::ProcessEventsFlags flags);
- bool hasPendingEvents();
-
- void flush();
-
- void startingUp();
- void closingDown();
-
-protected:
- int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- timeval *timeout);
-};
-
-QT_END_NAMESPACE
-
-#endif // QEVENTDISPATCHER_QWS_P_H
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
new file mode 100644
index 0000000000..52303b929f
--- /dev/null
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -0,0 +1,925 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qguiapplication.h"
+
+#include "private/qguiapplication_p.h"
+#include "private/qplatformintegrationfactory_qpa_p.h"
+#include "private/qevent_p.h"
+
+#if !defined(QT_NO_GLIB)
+#include "qeventdispatcher_glib_qpa_p.h"
+#endif
+#include "qeventdispatcher_qpa_p.h"
+
+#include <QtCore/QAbstractEventDispatcher>
+#include <QtCore/private/qcoreapplication_p.h>
+#include <QtCore/private/qabstracteventdispatcher_p.h>
+#include <QtCore/qmutex.h>
+#include <QtDebug>
+
+#include <QtGui/QPlatformIntegration>
+#include <QtGui/QGenericPluginFactory>
+
+#include <QWindowSystemInterface>
+#include "private/qwindowsysteminterface_qpa_p.h"
+#include "private/qwindow_p.h"
+#include "private/qkeymapper_p.h"
+
+#ifndef QT_NO_CLIPBOARD
+#include <QtGui/QClipboard>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
+Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
+
+int QGuiApplicationPrivate::keyboard_input_time = 0;
+int QGuiApplicationPrivate::mouse_double_click_time = 0;
+
+QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
+
+QWidget *qt_button_down = 0; // widget got last button-down
+
+bool QGuiApplicationPrivate::app_do_modal = false;
+
+int qt_last_x = 0;
+int qt_last_y = 0;
+QPointer<QWidget> QGuiApplicationPrivate::qt_last_mouse_receiver = 0;
+
+QWidgetList QGuiApplicationPrivate::qt_modal_stack;
+
+Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton;
+ulong QGuiApplicationPrivate::mousePressTime = 0;
+Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
+int QGuiApplicationPrivate::mousePressX = 0;
+int QGuiApplicationPrivate::mousePressY = 0;
+int QGuiApplicationPrivate::mouse_double_click_distance = 5;
+
+static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
+static bool force_reverse = false;
+
+QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0;
+
+#ifndef QT_NO_CLIPBOARD
+QClipboard *QGuiApplicationPrivate::qt_clipboard = 0;
+#endif
+
+Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
+QFont *QGuiApplicationPrivate::app_font = 0;
+
+static bool qt_detectRTLLanguage()
+{
+ return force_reverse ^
+ (QApplication::tr("QT_LAYOUT_DIRECTION",
+ "Translate this string to the string 'LTR' in left-to-right"
+ " languages or to 'RTL' in right-to-left languages (such as Hebrew"
+ " and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
+}
+
+
+QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
+ : QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags))
+{
+ d_func()->init();
+
+ QCoreApplicationPrivate::eventDispatcher->startingUp();
+}
+
+QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
+ : QCoreApplication(p)
+{
+ d_func()->init();
+}
+
+QGuiApplication::~QGuiApplication()
+{
+ Q_D(QGuiApplication);
+ // flush clipboard contents
+ if (QGuiApplicationPrivate::qt_clipboard) {
+ QEvent event(QEvent::Clipboard);
+ QGuiApplication::sendEvent(QGuiApplicationPrivate::qt_clipboard, &event);
+ }
+
+ d->eventDispatcher->closingDown();
+ d->eventDispatcher = 0;
+
+ delete QGuiApplicationPrivate::qt_clipboard;
+ QGuiApplicationPrivate::qt_clipboard = 0;
+}
+
+QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
+ : QCoreApplicationPrivate(argc, argv, flags)
+{
+ self = this;
+}
+
+static void init_platform(const QString &name, const QString &platformPluginPath)
+{
+ QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath);
+ if (!QGuiApplicationPrivate::platform_integration) {
+ QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
+ QString fatalMessage =
+ QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name);
+ foreach(QString key, keys) {
+ fatalMessage.append(key + QString::fromLatin1("\n"));
+ }
+ qFatal("%s", fatalMessage.toLocal8Bit().constData());
+
+ }
+
+}
+
+static void init_plugins(const QList<QByteArray> pluginList)
+{
+ for (int i = 0; i < pluginList.count(); ++i) {
+ QByteArray pluginSpec = pluginList.at(i);
+ qDebug() << "init_plugins" << i << pluginSpec;
+ int colonPos = pluginSpec.indexOf(':');
+ QObject *plugin;
+ if (colonPos < 0)
+ plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString());
+ else
+ plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)),
+ QLatin1String(pluginSpec.mid(colonPos+1)));
+ qDebug() << " created" << plugin;
+ }
+}
+
+void QGuiApplicationPrivate::createEventDispatcher()
+{
+ Q_Q(QGuiApplication);
+#if !defined(QT_NO_GLIB)
+ if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported())
+ eventDispatcher = new QPAEventDispatcherGlib(q);
+ else
+#endif
+ eventDispatcher = new QEventDispatcherQPA(q);
+}
+
+void QGuiApplicationPrivate::init()
+{
+ QList<QByteArray> pluginList;
+ QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+ QByteArray platformName;
+#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
+ platformName = QT_QPA_DEFAULT_PLATFORM_NAME;
+#endif
+ QByteArray platformNameEnv = qgetenv("QT_QPA_PLATFORM");
+ if (!platformNameEnv.isEmpty()) {
+ platformName = platformNameEnv;
+ }
+
+ // Get command line params
+
+ int j = argc ? 1 : 0;
+ for (int i=1; i<argc; i++) {
+ if (argv[i] && *argv[i] != '-') {
+ argv[j++] = argv[i];
+ continue;
+ }
+ QByteArray arg = argv[i];
+ if (arg == "-platformpluginpath") {
+ if (++i < argc)
+ platformPluginPath = QLatin1String(argv[i]);
+ } else if (arg == "-platform") {
+ if (++i < argc)
+ platformName = argv[i];
+ } else if (arg == "-plugin") {
+ if (++i < argc)
+ pluginList << argv[i];
+ } else if (arg == "-reverse") {
+ force_reverse = true;
+ QGuiApplication::setLayoutDirection(Qt::RightToLeft);
+ } else {
+ argv[j++] = argv[i];
+ }
+ }
+
+ argv[j] = 0;
+ argc = j;
+
+#if 0
+ QByteArray pluginEnv = qgetenv("QT_QPA_PLUGINS");
+ if (!pluginEnv.isEmpty()) {
+ pluginList.append(pluginEnv.split(';'));
+ }
+#endif
+
+ init_platform(QLatin1String(platformName), platformPluginPath);
+ init_plugins(pluginList);
+
+ QFont::initialize();
+
+ is_app_running = true;
+}
+
+QGuiApplicationPrivate::~QGuiApplicationPrivate()
+{
+ delete platform_integration;
+ platform_integration = 0;
+
+ is_app_closing = true;
+ is_app_running = false;
+
+ QFont::cleanup();
+
+ layout_direction = Qt::LeftToRight;
+}
+
+#if 0
+#ifndef QT_NO_CURSOR
+QCursor *overrideCursor();
+void setOverrideCursor(const QCursor &);
+void changeOverrideCursor(const QCursor &);
+void restoreOverrideCursor();
+#endif
+
+static QFont font();
+static QFont font(const QWidget*);
+static QFont font(const char *className);
+static void setFont(const QFont &, const char* className = 0);
+static QFontMetrics fontMetrics();
+
+#ifndef QT_NO_CLIPBOARD
+static QClipboard *clipboard();
+#endif
+#endif
+
+Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
+{
+ return QGuiApplicationPrivate::modifier_buttons;
+}
+
+Qt::MouseButtons QGuiApplication::mouseButtons()
+{
+ return QGuiApplicationPrivate::mouse_buttons;
+}
+
+void QGuiApplication::setDoubleClickInterval(int ms)
+{
+ QGuiApplicationPrivate::mouse_double_click_time = ms;
+}
+
+int QGuiApplication::doubleClickInterval()
+{
+ return QGuiApplicationPrivate::mouse_double_click_time;
+}
+
+void QGuiApplication::setKeyboardInputInterval(int ms)
+{
+ QGuiApplicationPrivate::keyboard_input_time = ms;
+}
+
+int QGuiApplication::keyboardInputInterval()
+{
+ return QGuiApplicationPrivate::keyboard_input_time;
+}
+
+QPlatformNativeInterface *QGuiApplication::platformNativeInterface()
+{
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
+ return pi->nativeInterface();
+}
+
+int QGuiApplication::exec()
+{
+ return QCoreApplication::exec();
+}
+
+bool QGuiApplication::notify(QObject *object, QEvent *event)
+{
+ return QCoreApplication::notify(object, event);
+}
+
+bool QGuiApplication::event(QEvent *e)
+{
+ if(e->type() == QEvent::LanguageChange) {
+ setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight);
+ }
+ return QCoreApplication::event(e);
+}
+
+bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
+{
+ return QCoreApplication::compressEvent(event, receiver, postedEvents);
+}
+
+void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
+{
+ switch(e->type) {
+ case QWindowSystemInterfacePrivate::Mouse:
+ QGuiApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterfacePrivate::MouseEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Wheel:
+ QGuiApplicationPrivate::processWheelEvent(static_cast<QWindowSystemInterfacePrivate::WheelEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Key:
+ QGuiApplicationPrivate::processKeyEvent(static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Touch:
+ QGuiApplicationPrivate::processTouchEvent(static_cast<QWindowSystemInterfacePrivate::TouchEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::GeometryChange:
+ QGuiApplicationPrivate::processGeometryChangeEvent(static_cast<QWindowSystemInterfacePrivate::GeometryChangeEvent*>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Enter:
+ QGuiApplicationPrivate::processEnterEvent(static_cast<QWindowSystemInterfacePrivate::EnterEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Leave:
+ QGuiApplicationPrivate::processLeaveEvent(static_cast<QWindowSystemInterfacePrivate::LeaveEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::ActivatedWindow:
+ QGuiApplicationPrivate::processActivatedEvent(static_cast<QWindowSystemInterfacePrivate::ActivatedWindowEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Close:
+ QGuiApplicationPrivate::processCloseEvent(
+ static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::ScreenCountChange:
+ QGuiApplicationPrivate::reportScreenCount(
+ static_cast<QWindowSystemInterfacePrivate::ScreenCountEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::ScreenGeometry:
+ QGuiApplicationPrivate::reportGeometryChange(
+ static_cast<QWindowSystemInterfacePrivate::ScreenGeometryEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::ScreenAvailableGeometry:
+ QGuiApplicationPrivate::reportAvailableGeometryChange(
+ static_cast<QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *>(e));
+ break;
+ default:
+ qWarning() << "Unknown user input event type:" << e->type;
+ break;
+ }
+}
+
+void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e)
+{
+ // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons();
+ static QWeakPointer<QWidget> implicit_mouse_grabber;
+
+ QEvent::Type type;
+ // move first
+ Qt::MouseButtons stateChange = e->buttons ^ buttons;
+ if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
+ QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent =
+ new QWindowSystemInterfacePrivate::MouseEvent(e->window.data(), e->timestamp, e->localPos, e->globalPos, e->buttons);
+ QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop
+ stateChange = Qt::NoButton;
+ }
+
+ QWindow *window = e->window.data();
+
+ QWidget * tlw = 0;//window ? window->widget() : 0;
+
+ QPoint localPoint = e->localPos;
+ QPoint globalPoint = e->globalPos;
+ QWidget *mouseWindow = tlw;
+
+ Qt::MouseButton button = Qt::NoButton;
+
+ if (qt_last_x != globalPoint.x() || qt_last_y != globalPoint.y()) {
+ type = QEvent::MouseMove;
+ qt_last_x = globalPoint.x();
+ qt_last_y = globalPoint.y();
+ if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
+ qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
+ mousePressButton = Qt::NoButton;
+ }
+ else { // check to see if a new button has been pressed/released
+ for (int check = Qt::LeftButton;
+ check <= Qt::XButton2;
+ check = check << 1) {
+ if (check & stateChange) {
+ button = Qt::MouseButton(check);
+ break;
+ }
+ }
+ if (button == Qt::NoButton) {
+ // Ignore mouse events that don't change the current state
+ return;
+ }
+ buttons = e->buttons;
+ if (button & e->buttons) {
+ if ((e->timestamp - mousePressTime) < static_cast<ulong>(QGuiApplication::doubleClickInterval()) && button == mousePressButton) {
+ type = QEvent::MouseButtonDblClick;
+ mousePressButton = Qt::NoButton;
+ }
+ else {
+ type = QEvent::MouseButtonPress;
+ mousePressTime = e->timestamp;
+ mousePressButton = button;
+ mousePressX = qt_last_x;
+ mousePressY = qt_last_y;
+ }
+ }
+ else
+ type = QEvent::MouseButtonRelease;
+ }
+
+
+ if (window && !tlw) {
+ QMouseEvent ev(type, localPoint, globalPoint, button, buttons, QGuiApplication::keyboardModifiers());
+ QGuiApplication::sendSpontaneousEvent(window, &ev);
+ return;
+ }
+
+#if 0
+ if (self->inPopupMode()) {
+ //popup mouse handling is magical...
+ mouseWindow = qApp->activePopupWidget();
+
+ implicit_mouse_grabber.clear();
+ //### how should popup mode and implicit mouse grab interact?
+
+ } else if (tlw && app_do_modal && !qt_try_modal(tlw, QEvent::MouseButtonRelease) ) {
+ //even if we're blocked by modality, we should deliver the mouse release event..
+ //### this code is not completely correct: multiple buttons can be pressed simultaneously
+ if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) {
+ //qDebug() << "modal blocked mouse event to" << tlw;
+ return;
+ }
+ }
+#endif
+
+#if 0
+ // find the tlw if we didn't get it from the plugin
+ if (!mouseWindow) {
+ mouseWindow = QGuiApplication::topLevelAt(globalPoint);
+ }
+
+ if (!mouseWindow && !implicit_mouse_grabber)
+ mouseWindow = QGuiApplication::desktop();
+
+ if (mouseWindow && mouseWindow != tlw) {
+ //we did not get a sensible localPoint from the window system, so let's calculate it
+ localPoint = mouseWindow->mapFromGlobal(globalPoint);
+ }
+#endif
+
+ // which child should have it?
+ QWidget *mouseWidget = mouseWindow;
+ if (mouseWindow) {
+ QWidget *w = mouseWindow->childAt(localPoint);
+ if (w) {
+ mouseWidget = w;
+ }
+ }
+
+ //handle implicit mouse grab
+ if (type == QEvent::MouseButtonPress && !implicit_mouse_grabber) {
+ implicit_mouse_grabber = mouseWidget;
+
+ Q_ASSERT(mouseWindow);
+ mouseWindow->activateWindow(); //focus
+ } else if (implicit_mouse_grabber) {
+ mouseWidget = implicit_mouse_grabber.data();
+ mouseWindow = mouseWidget->window();
+#if 0
+ if (mouseWindow != tlw)
+ localPoint = mouseWindow->mapFromGlobal(globalPoint);
+#endif
+ }
+
+ if (!mouseWidget)
+ return;
+
+ Q_ASSERT(mouseWidget);
+
+ //localPoint is local to mouseWindow, but it needs to be local to mouseWidget
+ localPoint = mouseWidget->mapFrom(mouseWindow, localPoint);
+
+ if (buttons == Qt::NoButton) {
+ //qDebug() << "resetting mouse grabber";
+ implicit_mouse_grabber.clear();
+ }
+
+#if 0
+ if (mouseWidget != qt_last_mouse_receiver) {
+// dispatchEnterLeave(mouseWidget, qt_last_mouse_receiver);
+ qt_last_mouse_receiver = mouseWidget;
+ }
+#endif
+
+ // Remember, we might enter a modal event loop when sending the event,
+ // so think carefully before adding code below this point.
+
+ // qDebug() << "sending mouse ev." << ev.type() << localPoint << globalPoint << ev.button() << ev.buttons() << mouseWidget << "mouse grabber" << implicit_mouse_grabber;
+
+ QMouseEvent ev(type, localPoint, globalPoint, button, buttons, QGuiApplication::keyboardModifiers());
+
+#if 0
+ QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
+ foreach (QWeakPointer<QPlatformCursor> cursor, cursors) {
+ if (cursor)
+ cursor.data()->pointerEvent(ev);
+ }
+#endif
+
+// int oldOpenPopupCount = openPopupCount;
+ QGuiApplication::sendSpontaneousEvent(mouseWidget, &ev);
+
+#if 0
+#ifndef QT_NO_CONTEXTMENU
+ if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) {
+ QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, QGuiApplication::keyboardModifiers());
+ QGuiApplication::sendSpontaneousEvent(mouseWidget, &e);
+ }
+#endif // QT_NO_CONTEXTMENU
+#endif
+}
+
+
+//### there's a lot of duplicated logic here -- refactoring required!
+
+void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
+{
+// QPoint localPoint = ev.pos();
+ QPoint globalPoint = e->globalPos;
+// bool trustLocalPoint = !!tlw; //is there something the local point can be local to?
+
+ qt_last_x = globalPoint.x();
+ qt_last_y = globalPoint.y();
+
+ QWindow *window = e->window.data();
+ if (!window)
+ return;
+
+ QWidget *mouseWidget = 0;//window ? window->widget() : 0;
+
+ // find the tlw if we didn't get it from the plugin
+#if 0
+ if (!mouseWindow) {
+ mouseWindow = QGuiApplication::topLevelAt(globalPoint);
+ }
+#endif
+
+ if (!mouseWidget) {
+ QWheelEvent ev(e->localPos, e->globalPos, e->delta, buttons, QGuiApplication::keyboardModifiers(),
+ e->orient);
+ QGuiApplication::sendSpontaneousEvent(window, &ev);
+ return;
+ }
+
+#if 0
+ if (app_do_modal && !qt_try_modal(mouseWindow, QEvent::Wheel) ) {
+ qDebug() << "modal blocked wheel event" << mouseWindow;
+ return;
+ }
+ QPoint p = mouseWindow->mapFromGlobal(globalPoint);
+ QWidget *w = mouseWindow->childAt(p);
+ if (w) {
+ mouseWidget = w;
+ p = mouseWidget->mapFromGlobal(globalPoint);
+ }
+#endif
+
+ QWheelEvent ev(e->localPos, e->globalPos, e->delta, buttons, QGuiApplication::keyboardModifiers(),
+ e->orient);
+ QGuiApplication::sendSpontaneousEvent(mouseWidget, &ev);
+}
+
+
+
+// Remember, Qt convention is: keyboard state is state *before*
+
+void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
+{
+ QWindow *window = e->window.data();
+ if (!window)
+ return;
+
+ QObject *target = window;//window->widget() ? static_cast<QObject *>(window->widget()) : static_cast<QObject *>(window);
+
+#if 0
+ QWidget *focusW = 0;
+ if (self->inPopupMode()) {
+ QWidget *popupW = qApp->activePopupWidget();
+ focusW = popupW->focusWidget() ? popupW->focusWidget() : popupW;
+ }
+ if (!focusW)
+ focusW = QGuiApplication::focusWidget();
+ if (!focusW)
+ focusW = window->widget();
+ if (!focusW)
+ focusW = QGuiApplication::activeWindow();
+#endif
+
+ //qDebug() << "handleKeyEvent" << hex << e->key() << e->modifiers() << e->text() << "widget" << focusW;
+
+#if 0
+ if (!focusW)
+ return;
+ if (app_do_modal && !qt_try_modal(focusW, e->keyType))
+ return;
+#endif
+
+ if (e->nativeScanCode || e->nativeVirtualKey || e->nativeModifiers) {
+ QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount,
+ e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers);
+ QGuiApplication::sendSpontaneousEvent(target, &ev);
+ } else {
+ QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount);
+ QGuiApplication::sendSpontaneousEvent(target, &ev);
+ }
+}
+
+void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *)
+{
+// QGuiApplicationPrivate::dispatchEnterLeave(e->enter.data(),0);
+// qt_last_mouse_receiver = e->enter.data();
+}
+
+void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *)
+{
+// QGuiApplicationPrivate::dispatchEnterLeave(0,qt_last_mouse_receiver);
+
+#if 0
+ if (e->leave.data() && !e->leave.data()->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen
+ QGuiApplicationPrivate::dispatchEnterLeave(0, e->leave.data());
+#endif
+ qt_last_mouse_receiver = 0;
+
+}
+
+void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *)
+{
+// QGuiApplication::setActiveWindow(e->activated.data());
+}
+
+void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e)
+{
+ if (e->tlw.isNull())
+ return;
+
+ QWindow *window = e->tlw.data();
+ if (!window)
+ return;
+
+ QWidget *tlw = 0;//window->widget();
+ QObject *target = tlw ? static_cast<QObject *>(tlw) : static_cast<QObject *>(window);
+
+ QRect newRect = e->newGeometry;
+ QRect cr = tlw ? tlw->geometry() : window->geometry();
+
+ bool isResize = cr.size() != newRect.size();
+ bool isMove = cr.topLeft() != newRect.topLeft();
+
+ if (tlw && !tlw->isWindow())
+ return; //geo of native child widgets is controlled by lighthouse
+ //so we already have sent the events; besides this new rect
+ //is not mapped to parent
+
+
+ if (tlw)
+ tlw->data->crect = newRect;
+ else
+ window->d_func()->geometry = newRect;
+
+ if (isResize) {
+ QResizeEvent e(newRect.size(), cr.size());
+ QGuiApplication::sendSpontaneousEvent(target, &e);
+ if (tlw)
+ tlw->update();
+ }
+
+ if (isMove) {
+ //### frame geometry
+ QMoveEvent e(newRect.topLeft(), cr.topLeft());
+ QGuiApplication::sendSpontaneousEvent(target, &e);
+ }
+}
+
+void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e)
+{
+ if (e->window.isNull())
+ return;
+
+ QCloseEvent event;
+ QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
+}
+
+void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *)
+{
+// translateRawTouchEvent(e->widget.data(), e->devType, e->points);
+}
+
+void QGuiApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *)
+{
+ // This operation only makes sense after the QGuiApplication constructor runs
+ if (QCoreApplication::startingUp())
+ return;
+
+ //QGuiApplication::desktop()->d_func()->updateScreenList();
+ // signal anything listening for creation or deletion of screens
+ //QDesktopWidget *desktop = QGuiApplication::desktop();
+ //emit desktop->screenCountChanged(e->count);
+}
+
+void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *)
+{
+ // This operation only makes sense after the QGuiApplication constructor runs
+ if (QCoreApplication::startingUp())
+ return;
+
+#if 0
+ QGuiApplication::desktop()->d_func()->updateScreenList();
+
+ // signal anything listening for screen geometry changes
+ QDesktopWidget *desktop = QGuiApplication::desktop();
+ emit desktop->resized(e->index);
+
+ // make sure maximized and fullscreen windows are updated
+ QWidgetList list = QGuiApplication::topLevelWidgets();
+ for (int i = list.size() - 1; i >= 0; --i) {
+ QWidget *w = list.at(i);
+ if (w->isFullScreen())
+ w->d_func()->setFullScreenSize_helper();
+ else if (w->isMaximized())
+ w->d_func()->setMaxWindowState_helper();
+ }
+#endif
+}
+
+void QGuiApplicationPrivate::reportAvailableGeometryChange(
+ QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *)
+{
+ // This operation only makes sense after the QGuiApplication constructor runs
+ if (QCoreApplication::startingUp())
+ return;
+
+#if 0
+ QGuiApplication::desktop()->d_func()->updateScreenList();
+
+ // signal anything listening for screen geometry changes
+ QDesktopWidget *desktop = QGuiApplication::desktop();
+ emit desktop->workAreaResized(e->index);
+
+ // make sure maximized and fullscreen windows are updated
+ QWidgetList list = QGuiApplication::topLevelWidgets();
+ for (int i = list.size() - 1; i >= 0; --i) {
+ QWidget *w = list.at(i);
+ if (w->isFullScreen())
+ w->d_func()->setFullScreenSize_helper();
+ else if (w->isMaximized())
+ w->d_func()->setMaxWindowState_helper();
+ }
+#endif
+}
+
+#ifndef QT_NO_CLIPBOARD
+QClipboard * QGuiApplication::clipboard()
+{
+ if (QGuiApplicationPrivate::qt_clipboard == 0) {
+ if (!qApp) {
+ qWarning("QApplication: Must construct a QApplication before accessing a QClipboard");
+ return 0;
+ }
+ QGuiApplicationPrivate::qt_clipboard = new QClipboard(0);
+ }
+ return QGuiApplicationPrivate::qt_clipboard;
+}
+#endif
+
+QFont QGuiApplication::font()
+{
+ QMutexLocker locker(applicationFontMutex());
+ if (!QGuiApplicationPrivate::app_font)
+ QGuiApplicationPrivate::app_font = new QFont(QLatin1String("Helvetica"));
+ return *QGuiApplicationPrivate::app_font;
+}
+
+void QGuiApplication::setFont(const QFont &font)
+{
+ QMutexLocker locker(applicationFontMutex());
+ if (!QGuiApplicationPrivate::app_font)
+ QGuiApplicationPrivate::app_font = new QFont(font);
+ else
+ *QGuiApplicationPrivate::app_font = font;
+}
+
+/*!
+ \fn bool QGuiApplication::isRightToLeft()
+
+ Returns true if the application's layout direction is
+ Qt::RightToLeft; otherwise returns false.
+
+ \sa layoutDirection(), isLeftToRight()
+*/
+
+/*!
+ \fn bool QGuiApplication::isLeftToRight()
+
+ Returns true if the application's layout direction is
+ Qt::LeftToRight; otherwise returns false.
+
+ \sa layoutDirection(), isRightToLeft()
+*/
+
+void QGuiApplicationPrivate::notifyLayoutDirectionChange()
+{
+}
+
+/*!
+ \property QGuiApplication::layoutDirection
+ \brief the default layout direction for this application
+
+ On system start-up, the default layout direction depends on the
+ application's language.
+
+ \sa QWidget::layoutDirection, isLeftToRight(), isRightToLeft()
+ */
+
+void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction)
+{
+ if (layout_direction == direction || direction == Qt::LayoutDirectionAuto)
+ return;
+
+ layout_direction = direction;
+
+ QGuiApplicationPrivate::self->notifyLayoutDirectionChange();
+}
+
+Qt::LayoutDirection QGuiApplication::layoutDirection()
+{
+ return layout_direction;
+}
+
+/*!
+ \since 4.2
+
+ Returns the current keyboard input locale.
+*/
+QLocale QGuiApplication::keyboardInputLocale()
+{
+ if (!QGuiApplicationPrivate::checkInstance("keyboardInputLocale"))
+ return QLocale::c();
+ return qt_keymapper_private()->keyboardInputLocale;
+}
+
+/*!
+ \since 4.2
+
+ Returns the current keyboard input direction.
+*/
+Qt::LayoutDirection QGuiApplication::keyboardInputDirection()
+{
+ if (!QGuiApplicationPrivate::checkInstance("keyboardInputDirection"))
+ return Qt::LeftToRight;
+ return qt_keymapper_private()->keyboardInputDirection;
+}
+
+/*!
+ \since 4.5
+ \fn void QGuiApplication::fontDatabaseChanged()
+
+ This signal is emitted when application fonts are loaded or removed.
+
+ \sa QFontDatabase::addApplicationFont(),
+ QFontDatabase::addApplicationFontFromData(),
+ QFontDatabase::removeAllApplicationFonts(),
+ QFontDatabase::removeApplicationFont()
+*/
+
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
new file mode 100644
index 0000000000..16f56d0a51
--- /dev/null
+++ b/src/gui/kernel/qguiapplication.h
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGUIAPPLICATION_QPA_H
+#define QGUIAPPLICATION_QPA_H
+
+#include <QtCore/qcoreapplication.h>
+#include <QtGui/qwindowdefs.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qsize.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QGuiApplicationPrivate;
+class QPlatformNativeInterface;
+
+class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
+ Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval)
+ Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval)
+
+public:
+ QGuiApplication(int &argc, char **argv, int = ApplicationFlags);
+ virtual ~QGuiApplication();
+
+#if 0
+#ifndef QT_NO_CURSOR
+ static QCursor *overrideCursor();
+ static void setOverrideCursor(const QCursor &);
+ static void changeOverrideCursor(const QCursor &);
+ static void restoreOverrideCursor();
+#endif
+#endif
+
+ static QFont font();
+ static void setFont(const QFont &);
+
+#ifndef QT_NO_CLIPBOARD
+ static QClipboard *clipboard();
+#endif
+
+ static Qt::KeyboardModifiers keyboardModifiers();
+ static Qt::MouseButtons mouseButtons();
+
+ static void setDoubleClickInterval(int);
+ static int doubleClickInterval();
+
+ static void setKeyboardInputInterval(int);
+ static int keyboardInputInterval();
+
+ static void setLayoutDirection(Qt::LayoutDirection direction);
+ static Qt::LayoutDirection layoutDirection();
+
+ static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
+ static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
+
+ static QLocale keyboardInputLocale();
+ static Qt::LayoutDirection keyboardInputDirection();
+
+ static QPlatformNativeInterface *platformNativeInterface();
+
+ static int exec();
+ bool notify(QObject *, QEvent *);
+
+Q_SIGNALS:
+ void fontDatabaseChanged();
+
+protected:
+ bool event(QEvent *);
+ bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
+
+ QGuiApplication(QGuiApplicationPrivate &p);
+
+private:
+ Q_DISABLE_COPY(QGuiApplication)
+ Q_DECLARE_PRIVATE(QGuiApplication)
+
+#ifndef QT_NO_GESTURES
+ friend class QGestureManager;
+#endif
+ friend class QFontDatabasePrivate;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QGUIAPPLICATION_QPA_H
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
new file mode 100644
index 0000000000..2cc2e54f6c
--- /dev/null
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGUIAPPLICATION_QPA_P_H
+#define QGUIAPPLICATION_QPA_P_H
+
+#include <QtGui/qguiapplication.h>
+
+#include <QtCore/private/qcoreapplication_p.h>
+
+#include <QtCore/private/qthread_p.h>
+
+#include <QWindowSystemInterface>
+#include "private/qwindowsysteminterface_qpa_p.h"
+#include "QtGui/qplatformintegration_qpa.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QPlatformIntegration;
+
+class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
+{
+ Q_DECLARE_PUBLIC(QGuiApplication)
+public:
+ QGuiApplicationPrivate(int &argc, char **argv, int flags);
+ ~QGuiApplicationPrivate();
+
+ void createEventDispatcher();
+
+ virtual void notifyLayoutDirectionChange();
+
+ static int keyboard_input_time;
+ static int mouse_double_click_time;
+
+ static Qt::KeyboardModifiers modifier_buttons;
+ static Qt::MouseButtons mouse_buttons;
+
+ static QPlatformIntegration *platform_integration;
+
+ static QPlatformIntegration *platformIntegration()
+ { return platform_integration; }
+
+ static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
+ { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
+
+ static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e);
+ static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e);
+ static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e);
+ static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e);
+
+ static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e);
+
+ static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e);
+
+ static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e);
+ static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e);
+
+ static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e);
+
+ static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
+
+ static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e);
+ static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
+ static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
+
+ static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
+ {
+ if (!(alignment & Qt::AlignHorizontal_Mask))
+ alignment |= Qt::AlignLeft;
+ if ((alignment & Qt::AlignAbsolute) == 0 && (alignment & (Qt::AlignLeft | Qt::AlignRight))) {
+ if (direction == Qt::RightToLeft)
+ alignment ^= (Qt::AlignLeft | Qt::AlignRight);
+ alignment |= Qt::AlignAbsolute;
+ }
+ return alignment;
+ }
+
+
+ static bool app_do_modal;
+
+ static QPointer<QWidget> qt_last_mouse_receiver;
+
+ static QWidgetList qt_modal_stack;
+
+ static Qt::MouseButtons buttons;
+ static ulong mousePressTime;
+ static Qt::MouseButton mousePressButton;
+ static int mousePressX;
+ static int mousePressY;
+ static int mouse_double_click_distance;
+
+#ifndef QT_NO_CLIPBOARD
+ static QClipboard *qt_clipboard;
+#endif
+
+ static QFont *app_font;
+private:
+ void init();
+
+ static QGuiApplicationPrivate *self;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QGUIAPPLICATION_QPA_P_H
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index badff80834..ef0cfc987c 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -70,10 +70,6 @@
QT_BEGIN_NAMESPACE
-#ifdef QT3_SUPPORT
-extern QDataStream &qt_stream_out_qcolorgroup(QDataStream &s, const QColorGroup &g);
-extern QDataStream &qt_stream_in_qcolorgroup(QDataStream &s, QColorGroup &g);
-#endif
Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
@@ -107,11 +103,6 @@ static void construct(QVariant::Private *x, const void *copy)
case QVariant::Palette:
v_construct<QPalette>(x, copy);
break;
-#ifdef QT3_SUPPORT
- case QVariant::ColorGroup:
- v_construct<QColorGroup>(x, copy);
- break;
-#endif
#ifndef QT_NO_ICON
case QVariant::Icon:
v_construct<QIcon>(x, copy);
@@ -218,11 +209,6 @@ static void clear(QVariant::Private *d)
case QVariant::Palette:
v_clear<QPalette>(d);
break;
-#ifdef QT3_SUPPORT
- case QVariant::ColorGroup:
- v_clear<QColorGroup>(d);
- break;
-#endif
#ifndef QT_NO_ICON
case QVariant::Icon:
v_clear<QIcon>(d);
@@ -313,9 +299,6 @@ static bool isNull(const QVariant::Private *d)
case QVariant::Brush:
case QVariant::Color:
case QVariant::Palette:
-#ifdef QT3_SUPPORT
- case QVariant::ColorGroup:
-#endif
case QVariant::SizePolicy:
#ifndef QT_NO_SHORTCUT
case QVariant::KeySequence:
@@ -374,10 +357,6 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return *v_cast<QColor>(a) == *v_cast<QColor>(b);
case QVariant::Palette:
return *v_cast<QPalette>(a) == *v_cast<QPalette>(b);
-#ifdef QT3_SUPPORT
- case QVariant::ColorGroup:
- return *v_cast<QColorGroup>(a) == *v_cast<QColorGroup>(b);
-#endif
#ifndef QT_NO_ICON
case QVariant::Icon:
/* QIcon::operator==() cannot be reasonably implemented for QIcon,
@@ -688,9 +667,6 @@ extern Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeGuiHelper;
static const QLoad##TYPE qLoad##TYPE = qMetaTypeLoadHelper<TYPE>;
#endif
-#ifdef QT3_SUPPORT
-Q_DECL_METATYPE_HELPER(QColorGroup)
-#endif
Q_DECL_METATYPE_HELPER(QFont)
Q_DECL_METATYPE_HELPER(QPixmap)
Q_DECL_METATYPE_HELPER(QBrush)
@@ -745,11 +721,7 @@ Q_DECL_METATYPE_HELPER(QQuaternion)
#endif
static const QMetaTypeGuiHelper qVariantGuiHelper[] = {
-#ifdef QT3_SUPPORT
- Q_IMPL_METATYPE_HELPER(QColorGroup),
-#else
{0, 0, 0, 0},
-#endif
Q_IMPL_METATYPE_HELPER(QFont),
Q_IMPL_METATYPE_HELPER(QPixmap),
Q_IMPL_METATYPE_HELPER(QBrush),
diff --git a/src/gui/painting/qgraphicssystemplugin_p.h b/src/gui/kernel/qhexstring_p.h
index 1dafe82243..3c8d562756 100644
--- a/src/gui/painting/qgraphicssystemplugin_p.h
+++ b/src/gui/kernel/qhexstring_p.h
@@ -39,8 +39,14 @@
**
****************************************************************************/
-#ifndef QGRAPHICSSYSTEMPLUGIN_H
-#define QGRAPHICSSYSTEMPLUGIN_H
+#include <QtCore/qglobal.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qstring.h>
+#include <QtGui/qpolygon.h>
+#include <QtCore/qstringbuilder.h>
+
+#ifndef QHEXSTRING_P_H
+#define QHEXSTRING_P_H
//
// W A R N I N G
@@ -53,40 +59,40 @@
// We mean it.
//
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-
-class QGraphicsSystem;
-
-struct QGraphicsSystemFactoryInterface : public QFactoryInterface
+// internal helper. Converts an integer value to an unique string token
+template <typename T>
+ struct HexString
{
- virtual QGraphicsSystem *create(const QString &key) = 0;
-};
-
-#define QGraphicsSystemFactoryInterface_iid "com.trolltech.Qt.QGraphicsSystemFactoryInterface"
+ inline HexString(const T t)
+ : val(t)
+ {}
-Q_DECLARE_INTERFACE(QGraphicsSystemFactoryInterface, QGraphicsSystemFactoryInterface_iid)
+ inline void write(QChar *&dest) const
+ {
+ const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ const char *c = reinterpret_cast<const char *>(&val);
+ for (uint i = 0; i < sizeof(T); ++i) {
+ *dest++ = hexChars[*c & 0xf];
+ *dest++ = hexChars[(*c & 0xf0) >> 4];
+ ++c;
+ }
+ }
+ const T val;
+};
-class Q_GUI_EXPORT QGraphicsSystemPlugin : public QObject, public QGraphicsSystemFactoryInterface
+// specialization to enable fast concatenating of our string tokens to a string
+template <typename T>
+ struct QConcatenable<HexString<T> >
{
- Q_OBJECT
- Q_INTERFACES(QGraphicsSystemFactoryInterface:QFactoryInterface)
-public:
- explicit QGraphicsSystemPlugin(QObject *parent = 0);
- ~QGraphicsSystemPlugin();
-
- virtual QStringList keys() const = 0;
- virtual QGraphicsSystem *create(const QString &key) = 0;
+ typedef HexString<T> type;
+ enum { ExactSize = true };
+ static int size(const HexString<T> &) { return sizeof(T) * 2; }
+ static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
+ typedef QString ConvertTo;
};
QT_END_NAMESPACE
-QT_END_HEADER
-
-#endif // QGRAPHICSSYSTEMEPLUGIN_H
+#endif // QHEXSTRING_P_H
diff --git a/src/gui/kernel/qkeymapper_qws.cpp b/src/gui/kernel/qkeymapper_qpa.cpp
index 7e4114057f..7e4114057f 100644
--- a/src/gui/kernel/qkeymapper_qws.cpp
+++ b/src/gui/kernel/qkeymapper_qpa.cpp
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 9eabb89d29..c61501036a 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -161,9 +161,6 @@ public:
NoMatch,
PartialMatch,
ExactMatch
-#ifdef QT3_SUPPORT
- , Identical = ExactMatch
-#endif
};
QString toString(SequenceFormat format = PortableText) const;
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 490d442616..f0117b46e5 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -63,103 +63,6 @@ static QColor qt_mix_colors(QColor a, QColor b)
(a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2);
}
-#ifdef QT3_SUPPORT
-
-#ifndef QT_NO_DATASTREAM
-QDataStream &qt_stream_out_qcolorgroup(QDataStream &s, const QColorGroup &g)
-{
- if(s.version() == 1) {
- // Qt 1.x
- s << g.color(QPalette::Foreground) << g.color(QPalette::Background)
- << g.color(QPalette::Light) << g.color(QPalette::Dark)
- << g.color(QPalette::Mid) << g.color(QPalette::Text) << g.color(QPalette::Base);
- } else {
- int max = QPalette::NColorRoles;
- if (s.version() <= QDataStream::Qt_2_1)
- max = QPalette::HighlightedText + 1;
- else if (s.version() <= QDataStream::Qt_4_3)
- max = QPalette::AlternateBase + 1;
- for(int r = 0 ; r < max ; r++)
- s << g.brush((QPalette::ColorRole)r);
- }
- return s;
-}
-
-QDataStream &qt_stream_in_qcolorgroup(QDataStream &s, QColorGroup &g)
-{
- if(s.version() == 1) { // Qt 1.x
- QColor fg, bg, light, dark, mid, text, base;
- s >> fg >> bg >> light >> dark >> mid >> text >> base;
- QPalette p(bg);
- p.setColor(QPalette::Active, QPalette::Foreground, fg);
- p.setColor(QPalette::Active, QPalette::Light, light);
- p.setColor(QPalette::Active, QPalette::Dark, dark);
- p.setColor(QPalette::Active, QPalette::Mid, mid);
- p.setColor(QPalette::Active, QPalette::Text, text);
- p.setColor(QPalette::Active, QPalette::Base, base);
- g = p;
- g.setCurrentColorGroup(QPalette::Active);
- } else {
- int max = QPalette::NColorRoles;
- if (s.version() <= QDataStream::Qt_2_1)
- max = QPalette::HighlightedText + 1;
- else if (s.version() <= QDataStream::Qt_3_0)
- max = QPalette::LinkVisited + 1;
- else if (s.version() <= QDataStream::Qt_4_3)
- max = QPalette::AlternateBase + 1;
- QBrush tmp;
- for(int r = 0 ; r < max; r++) {
- s >> tmp;
- g.setBrush((QPalette::ColorRole)r, tmp);
- }
- }
- return s;
-}
-
-QDataStream &operator<<(QDataStream &s, const QColorGroup &g)
-{
- return qt_stream_out_qcolorgroup(s, g);
-}
-
-QDataStream &operator>>(QDataStream &s, QColorGroup &g)
-{
- return qt_stream_in_qcolorgroup(s, g);
-}
-#endif // QT_NO_DATASTREAM
-
-/*!
- Constructs a palette with the specified \a active, \a disabled and
- \a inactive color groups.
-*/
-QPalette::QPalette(const QColorGroup &active, const QColorGroup &disabled,
- const QColorGroup &inactive)
-{
- Q_ASSERT(QPalette::NColorRoles == QPalette::ToolTipText + 1);
- init();
- setColorGroup(Active, active);
- setColorGroup(Disabled, disabled);
- setColorGroup(Inactive, inactive);
-}
-
-QColorGroup QPalette::createColorGroup(ColorGroup cr) const
-{
- QColorGroup ret(*this);
- ret.setCurrentColorGroup(cr);
- return ret;
-}
-
-void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
-{
- setColorGroup(cg, g.brush(WindowText), g.brush(Button), g.brush(Light),
- g.brush(Dark), g.brush(Mid), g.brush(Text), g.brush(BrightText),
- g.brush(Base), g.brush(AlternateBase), g.brush(Window),
- g.brush(Midlight), g.brush(ButtonText), g.brush(Shadow),
- g.brush(Highlight), g.brush(HighlightedText), g.brush(Link),
- g.brush(LinkVisited), g.brush(ToolTipBase), g.brush(ToolTipText));
-}
-
-#endif // QT3_SUPPORT
-
/*!
\fn const QColor &QPalette::color(ColorRole role) const
@@ -897,27 +800,6 @@ bool QPalette::operator==(const QPalette &p) const
return true;
}
-#ifdef QT3_SUPPORT
-bool QColorGroup::operator==(const QColorGroup &other) const
-{
- if (isCopyOf(other))
- return true;
- for (int role = 0; role < int(NColorRoles); role++) {
- if(d->br[current_group][role] != other.d->br[other.current_group][role])
- return false;
- }
- return true;
-}
-
-/*!
- Returns the color group as a QVariant
-*/
-QColorGroup::operator QVariant() const
-{
- return QVariant(QVariant::ColorGroup, this);
-}
-#endif
-
/*!
\fn bool QPalette::isEqual(ColorGroup cg1, ColorGroup cg2) const
@@ -1205,202 +1087,5 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru
Use simple assignment instead.
*/
-/*!
- \fn QColorGroup QPalette::normal() const
- \obsolete
-
- Returns the active color group. Use active() instead.
-
- Use createColorGroup(Active) instead.
-*/
-
-/*!
- \fn void QPalette::setNormal(const QColorGroup &colorGroup)
-
- Sets the normal color group to \a colorGroup.
-
- \sa QColorGroup
-*/
-
-/*!
- \fn QColorGroup QPalette::active() const
-
- Returns the active color group.
- \sa QColorGroup
-*/
-
-/*!
- \fn QColorGroup QPalette::disabled() const
-
- Returns the disabled color group.
- \sa QColorGroup
-*/
-
-/*!
- \fn QColorGroup QPalette::inactive() const
-
- Returns the inactive color group.
- \sa QColorGroup
-*/
-
-/*!
- \fn void QPalette::setActive(const QColorGroup &colorGroup)
-
- Sets the active color group to \a colorGroup.
- \sa QColorGroup
-*/
-
-/*!
- \fn void QPalette::setDisabled(const QColorGroup &colorGroup)
-
- Sets the disabled color group to \a colorGroup.
- \sa QColorGroup
-*/
-
-/*!
- \fn void QPalette::setInactive(const QColorGroup &colorGroup)
-
- Sets the inactive color group.
- \sa QColorGroup
-*/
-
-/*! \class QColorGroup
- \brief The QColorGroup class contains color groups for each widget state.
- \compat
-*/
-
-/*! \fn QColorGroup::QColorGroup()
-
- Use QPalette() instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QBrush &foreground, const QBrush &button, \
- const QBrush &light, const QBrush &dark, const QBrush &mid, \
- const QBrush &text, const QBrush &bright_text,
- const QBrush &base, const QBrush &background)
-
- Use QPalette(\a foreground, \a button, \a light, \a dark, \a mid,
- \a text, \a bright_text, \a base, \a background) instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QColor &foreground, const QColor &background, \
- const QColor &light, const QColor &dark, const QColor &mid, \
- const QColor &text, const QColor &base)
-
- Use QColorGroup(\a foreground, \a background, \a light, \a dark,
- \a mid, \a text, \a base) instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QColorGroup &other)
-
- Use QPalette(\a other) instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QPalette &pal)
-
- Use QPalette(\a pal) instead.
-*/
-
-/*! \fn const QColor &QColorGroup::foreground() const
-
- Use QPalette::windowText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::button() const
-
- Use QPalette::button().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::light() const
-
- Use QPalette::light().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::dark() const
-
- Use QPalette::dark().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::mid() const
-
- Use QPalette::mid().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::text() const
-
- Use QPalette::text().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::base() const
-
- Use QPalette::base().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::background() const
-
- Use QPalette::window().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::midlight() const
-
- Use QPalette::midlight().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::brightText() const
-
- Use QPalette::brightText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::buttonText() const
-
- Use QPalette::buttonText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::shadow() const
-
- Use QPalette::shadow().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::highlight() const
-
- Use QPalette::highlight().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::highlightedText() const
-
- Use QPalette::highlightedText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::link() const
-
- Use QPalette::link().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::linkVisited() const
-
- Use QPalette::linkVisited().color() instead.
-*/
-
-/*! \fn QDataStream &operator<<(QDataStream &ds, const QColorGroup &colorGroup)
- \relates QColorGroup
- \compat
-*/
-
-/*! \fn QDataStream &operator>>(QDataStream &ds, QColorGroup &colorGroup)
- \relates QColorGroup
- \compat
-*/
-
-/*! \fn bool QColorGroup::operator==(const QColorGroup &other) const
-
- Returns true if this color group is equal to \a other; otherwise
- returns false.
-*/
-
-/*! \fn bool QColorGroup::operator!=(const QColorGroup &other) const
-
- Returns true if this color group is not equal to \a other;
- otherwise returns false.
-*/
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index dffd2cbec8..17f3d0f653 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -52,9 +52,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#ifdef QT3_SUPPORT
-class QColorGroup;
-#endif
class QPalettePrivate;
class QVariant;
@@ -72,9 +69,6 @@ public:
const QBrush &bright_text, const QBrush &base, const QBrush &window);
QPalette(const QColor &windowText, const QColor &window, const QColor &light,
const QColor &dark, const QColor &mid, const QColor &text, const QColor &base);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QPalette(const QColorGroup &active, const QColorGroup &disabled, const QColorGroup &inactive);
-#endif
QPalette(const QPalette &palette);
~QPalette();
QPalette &operator=(const QPalette &palette);
@@ -142,19 +136,6 @@ public:
inline const QBrush &link() const { return brush(Link); }
inline const QBrush &linkVisited() const { return brush(LinkVisited); }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT QPalette copy() const { QPalette p = *this; p.detach(); return p; }
- QT3_SUPPORT QColorGroup normal() const;
- inline QT3_SUPPORT void setNormal(const QColorGroup &cg) { setColorGroup(Active, cg); }
-
- QT3_SUPPORT QColorGroup active() const;
- QT3_SUPPORT QColorGroup disabled() const;
- QT3_SUPPORT QColorGroup inactive() const;
- inline QT3_SUPPORT void setActive(const QColorGroup &cg) { setColorGroup(Active, cg); }
- inline QT3_SUPPORT void setDisabled(const QColorGroup &cg) { setColorGroup(Disabled, cg); }
- inline QT3_SUPPORT void setInactive(const QColorGroup &cg) { setColorGroup(Inactive, cg); }
-#endif
-
bool operator==(const QPalette &p) const;
inline bool operator!=(const QPalette &p) const { return !(operator==(p)); }
bool isCopyOf(const QPalette &p) const;
@@ -184,11 +165,6 @@ private:
const QBrush &highlight, const QBrush &highlighted_text,
const QBrush &link, const QBrush &link_visited,
const QBrush &toolTipBase, const QBrush &toolTipText);
-#ifdef QT3_SUPPORT
- friend class QColorGroup;
- void setColorGroup(ColorGroup, const QColorGroup &);
- QColorGroup createColorGroup(ColorGroup) const;
-#endif
void init();
void detach();
@@ -206,55 +182,6 @@ inline void QPalette::setColor(ColorRole acr, const QColor &acolor)
inline void QPalette::setBrush(ColorRole acr, const QBrush &abrush)
{ setBrush(All, acr, abrush); }
-#ifdef QT3_SUPPORT
-class Q_GUI_EXPORT QColorGroup : public QPalette
-{
-public:
- inline QColorGroup() : QPalette() {}
- inline QColorGroup(const QBrush &foreground, const QBrush &button, const QBrush &light,
- const QBrush &dark, const QBrush &mid, const QBrush &text,
- const QBrush &bright_text, const QBrush &base, const QBrush &background)
- : QPalette(foreground, button, light, dark, mid, text, bright_text, base, background)
- {}
- inline QColorGroup(const QColor &foreground, const QColor &background, const QColor &light,
- const QColor &dark, const QColor &mid, const QColor &text, const QColor &base)
- : QPalette(foreground, background, light, dark, mid, text, base) {}
- inline QColorGroup(const QColorGroup &cg) : QPalette(cg) {}
- inline QColorGroup(const QPalette &pal) : QPalette(pal) {}
- bool operator==(const QColorGroup &other) const;
- inline bool operator!=(const QColorGroup &other) const { return !(operator==(other)); }
- operator QVariant() const;
-
- inline QT3_SUPPORT const QColor &foreground() const { return color(WindowText); }
- inline QT3_SUPPORT const QColor &button() const { return color(Button); }
- inline QT3_SUPPORT const QColor &light() const { return color(Light); }
- inline QT3_SUPPORT const QColor &dark() const { return color(Dark); }
- inline QT3_SUPPORT const QColor &mid() const { return color(Mid); }
- inline QT3_SUPPORT const QColor &text() const { return color(Text); }
- inline QT3_SUPPORT const QColor &base() const { return color(Base); }
- inline QT3_SUPPORT const QColor &background() const { return color(Window); }
- inline QT3_SUPPORT const QColor &midlight() const { return color(Midlight); }
- inline QT3_SUPPORT const QColor &brightText() const { return color(BrightText); }
- inline QT3_SUPPORT const QColor &buttonText() const { return color(ButtonText); }
- inline QT3_SUPPORT const QColor &shadow() const { return color(Shadow); }
- inline QT3_SUPPORT const QColor &highlight() const { return color(Highlight); }
- inline QT3_SUPPORT const QColor &highlightedText() const { return color(HighlightedText); }
- inline QT3_SUPPORT const QColor &link() const { return color(Link); }
- inline QT3_SUPPORT const QColor &linkVisited() const { return color(LinkVisited); }
-};
-
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QT3_SUPPORT QDataStream &operator<<(QDataStream &ds, const QColorGroup &cg);
-Q_GUI_EXPORT QT3_SUPPORT QDataStream &operator>>(QDataStream &ds, QColorGroup &cg);
-#endif
-
-inline QColorGroup QPalette::inactive() const { return createColorGroup(Inactive); }
-inline QColorGroup QPalette::disabled() const { return createColorGroup(Disabled); }
-inline QColorGroup QPalette::active() const { return createColorGroup(Active); }
-inline QColorGroup QPalette::normal() const { return createColorGroup(Active); }
-
-#endif
-
/*****************************************************************************
QPalette stream functions
*****************************************************************************/
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index 71d0e87444..18698b6457 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -85,7 +85,7 @@ public:
// input methods
virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
- virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0;
+ virtual void changeCursor(QCursor * widgetCursor, QWindow * widget) = 0;
protected:
QPlatformScreen* screen; // Where to request an update
diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp
index 181053223f..2177a01d9b 100644
--- a/src/gui/kernel/qplatformglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformglcontext_qpa.cpp
@@ -41,134 +41,6 @@
#include "qplatformglcontext_qpa.h"
-#include <QtCore/QThreadStorage>
-#include <QtCore/QThread>
-
-#include <QDebug>
-
-class QPlatformGLThreadContext
-{
-public:
- ~QPlatformGLThreadContext() {
- if (context)
- context->doneCurrent();
- }
- QPlatformGLContext *context;
-};
-
-static QThreadStorage<QPlatformGLThreadContext *> qplatformgl_context_storage;
-
-class QPlatformGLContextPrivate
-{
-public:
- QPlatformGLContextPrivate()
- :qGLContextHandle(0)
- {
- }
-
- virtual ~QPlatformGLContextPrivate()
- {
- //do not delete the QGLContext handle here as it is deleted in
- //QWidgetPrivate::deleteTLSysExtra()
- }
- void *qGLContextHandle;
- void (*qGLContextDeleteFunction)(void *handle);
- static QPlatformGLContext *staticSharedContext;
-
- static void setCurrentContext(QPlatformGLContext *context);
-};
-
-QPlatformGLContext *QPlatformGLContextPrivate::staticSharedContext = 0;
-
-void QPlatformGLContextPrivate::setCurrentContext(QPlatformGLContext *context)
-{
- QPlatformGLThreadContext *threadContext = qplatformgl_context_storage.localData();
- if (!threadContext) {
- if (!QThread::currentThread()) {
- qWarning("No QTLS available. currentContext wont work");
- return;
- }
- threadContext = new QPlatformGLThreadContext;
- qplatformgl_context_storage.setLocalData(threadContext);
- }
- threadContext->context = context;
-}
-
-/*!
- Returns the last context which called makeCurrent. This function is thread aware.
-*/
-const QPlatformGLContext* QPlatformGLContext::currentContext()
-{
- QPlatformGLThreadContext *threadContext = qplatformgl_context_storage.localData();
- if(threadContext) {
- return threadContext->context;
- }
- return 0;
-}
-
-/*!
- All subclasses needs to specify the platformWindow. It can be a null window.
-*/
-QPlatformGLContext::QPlatformGLContext()
- :d_ptr(new QPlatformGLContextPrivate())
-{
-}
-
-/*!
- If this is the current context for the thread, doneCurrent is called
-*/
-QPlatformGLContext::~QPlatformGLContext()
-{
- if (QPlatformGLContext::currentContext() == this) {
- doneCurrent();
- }
-
-}
-
-/*!
- Reimplement in subclass to do makeCurrent on native GL context
-*/
-void QPlatformGLContext::makeCurrent()
-{
- QPlatformGLContextPrivate::setCurrentContext(this);
-}
-
-/*!
- Reimplement in subclass to release current context.
- Typically this is calling makeCurrent with 0 "surface"
-*/
-void QPlatformGLContext::doneCurrent()
-{
- QPlatformGLContextPrivate::setCurrentContext(0);
-}
-
-/*
- internal: Needs to have a pointer to qGLContext. But since this is in QtGui we cant
- have any type information.
-*/
-void *QPlatformGLContext::qGLContextHandle() const
-{
- Q_D(const QPlatformGLContext);
- return d->qGLContextHandle;
-}
-
-void QPlatformGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *))
-{
- Q_D(QPlatformGLContext);
- d->qGLContextHandle = handle;
- d->qGLContextDeleteFunction = qGLContextDeleteFunction;
-}
-
-void QPlatformGLContext::deleteQGLContext()
-{
- Q_D(QPlatformGLContext);
- if (d->qGLContextDeleteFunction && d->qGLContextHandle) {
- d->qGLContextDeleteFunction(d->qGLContextHandle);
- d->qGLContextDeleteFunction = 0;
- d->qGLContextHandle = 0;
- }
-}
-
/*!
\class QPlatformGLContext
\since 4.8
diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h
index 28923a9457..fbd43b2b48 100644
--- a/src/gui/kernel/qplatformglcontext_qpa.h
+++ b/src/gui/kernel/qplatformglcontext_qpa.h
@@ -43,7 +43,7 @@
#define QPLATFORM_GL_CONTEXT_H
#include <QtCore/qnamespace.h>
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/qwindowformat_qpa.h>
QT_BEGIN_HEADER
@@ -51,36 +51,17 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-class QPlatformGLContextPrivate;
-
-class Q_OPENGL_EXPORT QPlatformGLContext
+class Q_GUI_EXPORT QPlatformGLContext
{
-Q_DECLARE_PRIVATE(QPlatformGLContext);
-
public:
- explicit QPlatformGLContext();
- virtual ~QPlatformGLContext();
+ virtual ~QPlatformGLContext() {}
- virtual void makeCurrent();
- virtual void doneCurrent();
+ virtual void makeCurrent() = 0;
+ virtual void doneCurrent() = 0;
virtual void swapBuffers() = 0;
- virtual void* getProcAddress(const QString& procName) = 0;
-
- virtual QPlatformWindowFormat platformWindowFormat() const = 0;
-
- const static QPlatformGLContext *currentContext();
-
-protected:
- QScopedPointer<QPlatformGLContextPrivate> d_ptr;
+ virtual void *getProcAddress(const QString& procName) = 0;
-private:
- //hack to make it work with QGLContext::CurrentContext
- friend class QGLContext;
- friend class QWidgetPrivate;
- void *qGLContextHandle() const;
- void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *));
- void deleteQGLContext();
- Q_DISABLE_COPY(QPlatformGLContext);
+ virtual QWindowFormat windowFormat() const = 0;
};
QT_END_NAMESPACE
@@ -88,4 +69,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QPLATFORM_GL_INTEGRATION_P_H
+#endif // QPLATFORM_GL_CONTEXT_H
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index d06272ce01..43080d297a 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QPlatformWindow;
-class QWindowSurface;
+class QWindow;
class QBlittable;
class QWidget;
class QPlatformEventLoopIntegration;
@@ -62,6 +62,7 @@ class QPlatformFontDatabase;
class QPlatformClipboard;
class QPlatformNativeInterface;
+
class Q_GUI_EXPORT QPlatformIntegration
{
public:
@@ -76,8 +77,8 @@ public:
// GraphicsSystem functions
virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0;
- virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0;
- virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0;
+ virtual QPlatformWindow *createPlatformWindow(QWindow *window) const = 0;
+ virtual QWindowSurface *createWindowSurface(QWindow *window, WId winId) const = 0;
// Window System functions
virtual QList<QPlatformScreen *> screens() const = 0;
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 281aeba302..f160ec2899 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -43,10 +43,10 @@
QT_BEGIN_NAMESPACE
-void *QPlatformNativeInterface::nativeResourceForWidget(const QByteArray &resource, QWidget *widget)
+void *QPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
{
Q_UNUSED(resource);
- Q_UNUSED(widget);
+ Q_UNUSED(window);
return 0;
}
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h
index b9d061982a..ff3eacf2e0 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.h
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.h
@@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-class QWidget;
+class QWindow;
class Q_GUI_EXPORT QPlatformNativeInterface
{
public:
- virtual void *nativeResourceForWidget(const QByteArray &resource, QWidget *widget);
+ virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index c9f3dc6f34..8b686781ab 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -84,12 +84,20 @@ QSize QPlatformScreen::physicalSize() const
Q_GUI_EXPORT extern QWidgetPrivate *qt_widget_private(QWidget *widget);
QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget)
{
+ int screenIndex = 0;
QWidget *window = widget->window();
QWidgetPrivate *windowPrivate = qt_widget_private(window);
- QTLWExtra * topData = windowPrivate->topData();
+ QTLWExtra * topData = windowPrivate->maybeTopData();
+ if (topData)
+ screenIndex = topData->screenIndex;
QPlatformIntegration *integration =
- QApplicationPrivate::platformIntegration();
- return integration->screens()[topData->screenIndex];
+ QGuiApplicationPrivate::platformIntegration();
+ return integration->screens()[screenIndex];
+}
+
+QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *)
+{
+ return QGuiApplicationPrivate::platformIntegration()->screens().at(0);
}
/*!
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index b3bb121331..cbaf5b9c47 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -77,6 +77,9 @@ public:
//jl: should this function be in QPlatformIntegration
//jl: maybe screenForWidget is a better name?
static QPlatformScreen *platformScreenForWidget(const QWidget *widget);
+
+ // temporary convenience
+ static QPlatformScreen *platformScreenForWindow(const QWindow *window);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index f3654b676d..7ec5221840 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -46,9 +46,8 @@
class QPlatformWindowPrivate
{
- QWidget *tlw;
+ QWindow *window;
QRect rect;
- Qt::WindowFlags flags;
friend class QPlatformWindow;
};
@@ -56,12 +55,11 @@ class QPlatformWindowPrivate
Constructs a platform window with the given top level widget.
*/
-QPlatformWindow::QPlatformWindow(QWidget *tlw)
+QPlatformWindow::QPlatformWindow(QWindow *window)
: d_ptr(new QPlatformWindowPrivate)
{
Q_D(QPlatformWindow);
- d->tlw = tlw;
- tlw->setPlatformWindow(this);
+ d->window = window;
}
/*!
@@ -74,10 +72,10 @@ QPlatformWindow::~QPlatformWindow()
/*!
Returnes the widget which belongs to the QPlatformWindow
*/
-QWidget *QPlatformWindow::widget() const
+QWindow *QPlatformWindow::window() const
{
Q_D(const QPlatformWindow);
- return d->tlw;
+ return d->window;
}
/*!
@@ -115,21 +113,10 @@ void QPlatformWindow::setVisible(bool visible)
*/
Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags)
{
- Q_D(QPlatformWindow);
- d->flags = flags;
return flags;
}
/*!
- Returns the effective window flags for this surface.
-*/
-Qt::WindowFlags QPlatformWindow::windowFlags() const
-{
- Q_D(const QPlatformWindow);
- return d->flags;
-}
-
-/*!
Reimplement in subclasses to return a handle to the native window
*/
WId QPlatformWindow::winId() const { return WId(0); }
@@ -150,7 +137,7 @@ void QPlatformWindow::setParent(const QPlatformWindow *parent)
/*!
Reimplement to set the window title to \a title
*/
-void QPlatformWindow::setWindowTitle(const QString &) {}
+void QPlatformWindow::setWindowTitle(const QString &title) { Q_UNUSED(title); }
/*!
Reimplement to be able to let Qt rais windows to the top of the desktop
@@ -186,7 +173,7 @@ void QPlatformWindow::setOpacity(qreal level)
*/
void QPlatformWindow::requestActivateWindow()
{
- QWindowSystemInterface::handleWindowActivated(widget());
+ QWindowSystemInterface::handleWindowActivated(window());
}
/*!
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index 41a4bac7e0..1730f3d85e 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -55,23 +55,22 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QPlatformWindowPrivate;
-class QWidget;
+class QWindow;
class QPlatformGLContext;
class Q_GUI_EXPORT QPlatformWindow
{
Q_DECLARE_PRIVATE(QPlatformWindow)
public:
- QPlatformWindow(QWidget *tlw);
+ QPlatformWindow(QWindow *window);
virtual ~QPlatformWindow();
- QWidget *widget() const;
+ QWindow *window() const;
virtual void setGeometry(const QRect &rect);
virtual QRect geometry() const;
virtual void setVisible(bool visible);
virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
- virtual Qt::WindowFlags windowFlags() const;
virtual WId winId() const;
virtual void setParent(const QPlatformWindow *window);
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp
deleted file mode 100644
index c165c8513a..0000000000
--- a/src/gui/kernel/qplatformwindowformat_qpa.cpp
+++ /dev/null
@@ -1,1008 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformwindowformat_qpa.h"
-
-#include <QtCore/QDebug>
-
-Q_GLOBAL_STATIC(QPlatformWindowFormat, q_platformwindow_default_format);
-
-class QPlatformWindowFormatPrivate
-{
-public:
- QPlatformWindowFormatPrivate()
- : ref(1)
- , opts(QPlatformWindowFormat::DoubleBuffer | QPlatformWindowFormat::DepthBuffer
- | QPlatformWindowFormat::Rgba | QPlatformWindowFormat::DirectRendering
- | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions
- | QPlatformWindowFormat::HasWindowSurface)
- , depthSize(-1)
- , accumSize(-1)
- , stencilSize(-1)
- , redSize(-1)
- , greenSize(-1)
- , blueSize(-1)
- , alphaSize(-1)
- , numSamples(-1)
- , swapInterval(-1)
- , windowApi(QPlatformWindowFormat::Raster)
- , sharedContext(0)
- {
- }
-
- QPlatformWindowFormatPrivate(const QPlatformWindowFormatPrivate *other)
- : ref(1),
- opts(other->opts),
- depthSize(other->depthSize),
- accumSize(other->accumSize),
- stencilSize(other->stencilSize),
- redSize(other->redSize),
- greenSize(other->greenSize),
- blueSize(other->blueSize),
- alphaSize(other->alphaSize),
- numSamples(other->numSamples),
- swapInterval(other->swapInterval),
- windowApi(other->windowApi),
- sharedContext(other->sharedContext)
- {
- }
- QAtomicInt ref;
- QPlatformWindowFormat::FormatOptions opts;
- int depthSize;
- int accumSize;
- int stencilSize;
- int redSize;
- int greenSize;
- int blueSize;
- int alphaSize;
- int numSamples;
- int swapInterval;
- QPlatformWindowFormat::WindowApi windowApi;
- QPlatformGLContext *sharedContext;
-};
-
-/*!
- \class QPlatformWindowFormat
- \brief The QPlatformWindowFormat class specifies the display format of an OpenGL
- rendering context and if possible attributes of the corresponding QPlatformWindow.
-
- \ingroup painting
-
- QWidget has a setter and getter function for QPlatformWindowFormat. These functions can be used
- by the application programmer to signal what kind of format he wants to the window and glcontext
- should have. However, it is not always possible to fulfill these requirements. The application
- programmer should therefore check the resulting QPlatformWindowFormat from QPlatformGLContext
- to see the format that was actually created.
-
- A display format has several characteristics:
- \list
- \i \link setDoubleBuffer() Double or single buffering.\endlink
- \i \link setDepth() Depth buffer.\endlink
- \i \link setRgba() RGBA or color index mode.\endlink
- \i \link setAlpha() Alpha channel.\endlink
- \i \link setAccum() Accumulation buffer.\endlink
- \i \link setStencil() Stencil buffer.\endlink
- \i \link setStereo() Stereo buffers.\endlink
- \i \link setDirectRendering() Direct rendering.\endlink
- \i \link setOverlay() Presence of an overlay.\endlink
- \i \link setPlane() Plane of an overlay.\endlink
- \i \link setSampleBuffers() Multisample buffers.\endlink
- \endlist
-
- You can also specify preferred bit depths for the color buffer,
- depth buffer, alpha buffer, accumulation buffer and the stencil
- buffer with the functions: setRedBufferSize(), setGreenBufferSize(),
- setBlueBufferSize(), setDepthBufferSize(), setAlphaBufferSize(),
- setAccumBufferSize() and setStencilBufferSize().
-
- Note that even if you specify that you prefer a 32 bit depth
- buffer (e.g. with setDepthBufferSize(32)), the format that is
- chosen may not have a 32 bit depth buffer, even if there is a
- format available with a 32 bit depth buffer. The main reason for
- this is how the system dependant picking algorithms work on the
- different platforms, and some format options may have higher
- precedence than others.
-
- You create and tell a QPlatformWindowFormat object what rendering options you
- want from an OpenGL rendering context.
-
- OpenGL drivers or accelerated hardware may or may not support
- advanced features such as alpha channel or stereographic viewing.
- If you request some features that the driver/hardware does not
- provide when you create a QGLWidget, you will get a rendering
- context with the nearest subset of features.
-
- There are different ways to define the display characteristics of
- a rendering context. One is to create a QPlatformWindowFormat and make it the
- default for the entire application:
- \snippet doc/src/snippets/code/src_opengl_qgl.cpp 0
-
- Or you can specify the desired format when creating an object of
- your QGLWidget subclass:
- \snippet doc/src/snippets/code/src_opengl_qgl.cpp 1
-
- After the widget has been created, you can find out which of the
- requested features the system was able to provide:
- \snippet doc/src/snippets/code/src_opengl_qgl.cpp 2
-
- \legalese
- OpenGL is a trademark of Silicon Graphics, Inc. in the
- United States and other countries.
- \endlegalese
-
- \sa QPlatformContext, QWidget
-*/
-
-/*!
- Constructs a QPlatformWindowFormat object with the following default settings:
- \list
- \i \link setDoubleBuffer() Double buffer:\endlink Enabled.
- \i \link setDepth() Depth buffer:\endlink Enabled.
- \i \link setRgba() RGBA:\endlink Enabled (i.e., color index disabled).
- \i \link setAlpha() Alpha channel:\endlink Disabled.
- \i \link setAccum() Accumulator buffer:\endlink Disabled.
- \i \link setStencil() Stencil buffer:\endlink Enabled.
- \i \link setStereo() Stereo:\endlink Disabled.
- \i \link setDirectRendering() Direct rendering:\endlink Enabled.
- \i \link setOverlay() Overlay:\endlink Disabled.
- \i \link setPlane() Plane:\endlink 0 (i.e., normal plane).
- \i \link setSampleBuffers() Multisample buffers:\endlink Disabled.
- \endlist
-*/
-
-QPlatformWindowFormat::QPlatformWindowFormat()
-{
- d = new QPlatformWindowFormatPrivate;
-}
-
-
-/*!
- Creates a QPlatformWindowFormat object that is a copy of the current
- defaultFormat().
-
- If \a options is not 0, the default format is modified by the
- specified format options. The \a options parameter should be
- QGL::FormatOption values OR'ed together.
-
- This constructor makes it easy to specify a certain desired format
- in classes derived from QGLWidget, for example:
- \snippet doc/src/snippets/code/src_opengl_qgl.cpp 3
-
- Note that there are QGL::FormatOption values to turn format settings
- both on and off, e.g. QGL::DepthBuffer and QGL::NoDepthBuffer,
- QGL::DirectRendering and QGL::IndirectRendering, etc.
-
- The \a plane parameter defaults to 0 and is the plane which this
- format should be associated with. Not all OpenGL implementations
- supports overlay/underlay rendering planes.
-
- \sa defaultFormat(), setOption(), setPlane()
-*/
-
-QPlatformWindowFormat::QPlatformWindowFormat(QPlatformWindowFormat::FormatOptions options)
-{
- d = new QPlatformWindowFormatPrivate;
- QPlatformWindowFormat::FormatOptions newOpts = options;
- d->opts = defaultFormat().d->opts;
- d->opts |= (newOpts & 0xffff);
- d->opts &= ~(newOpts >> 16);
-}
-
-/*!
- \internal
-*/
-void QPlatformWindowFormat::detach()
-{
- if (d->ref != 1) {
- QPlatformWindowFormatPrivate *newd = new QPlatformWindowFormatPrivate(d);
- if (!d->ref.deref())
- delete d;
- d = newd;
- }
-}
-
-/*!
- Constructs a copy of \a other.
-*/
-
-QPlatformWindowFormat::QPlatformWindowFormat(const QPlatformWindowFormat &other)
-{
- d = other.d;
- d->ref.ref();
-}
-
-/*!
- Assigns \a other to this object.
-*/
-
-QPlatformWindowFormat &QPlatformWindowFormat::operator=(const QPlatformWindowFormat &other)
-{
- if (d != other.d) {
- other.d->ref.ref();
- if (!d->ref.deref())
- delete d;
- d = other.d;
- }
- return *this;
-}
-
-/*!
- Destroys the QPlatformWindowFormat.
-*/
-QPlatformWindowFormat::~QPlatformWindowFormat()
-{
- if (!d->ref.deref())
- delete d;
-}
-
-/*!
- \fn bool QPlatformWindowFormat::doubleBuffer() const
-
- Returns true if double buffering is enabled; otherwise returns
- false. Double buffering is enabled by default.
-
- \sa setDoubleBuffer()
-*/
-
-/*!
- If \a enable is true sets double buffering; otherwise sets single
- buffering.
-
- Double buffering is enabled by default.
-
- Double buffering is a technique where graphics are rendered on an
- off-screen buffer and not directly to the screen. When the drawing
- has been completed, the program calls a swapBuffers() function to
- exchange the screen contents with the buffer. The result is
- flicker-free drawing and often better performance.
-
- \sa doubleBuffer(), QGLContext::swapBuffers(),
- QGLWidget::swapBuffers()
-*/
-
-void QPlatformWindowFormat::setDoubleBuffer(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::DoubleBuffer : QPlatformWindowFormat::SingleBuffer);
-}
-
-
-/*!
- \fn bool QPlatformWindowFormat::depth() const
-
- Returns true if the depth buffer is enabled; otherwise returns
- false. The depth buffer is enabled by default.
-
- \sa setDepth(), setDepthBufferSize()
-*/
-
-/*!
- If \a enable is true enables the depth buffer; otherwise disables
- the depth buffer.
-
- The depth buffer is enabled by default.
-
- The purpose of a depth buffer (or Z-buffering) is to remove hidden
- surfaces. Pixels are assigned Z values based on the distance to
- the viewer. A pixel with a high Z value is closer to the viewer
- than a pixel with a low Z value. This information is used to
- decide whether to draw a pixel or not.
-
- \sa depth(), setDepthBufferSize()
-*/
-
-void QPlatformWindowFormat::setDepth(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::DepthBuffer : QPlatformWindowFormat::NoDepthBuffer);
-}
-
-
-/*!
- \fn bool QPlatformWindowFormat::rgba() const
-
- Returns true if RGBA color mode is set. Returns false if color
- index mode is set. The default color mode is RGBA.
-
- \sa setRgba()
-*/
-
-/*!
- If \a enable is true sets RGBA mode. If \a enable is false sets
- color index mode.
-
- The default color mode is RGBA.
-
- RGBA is the preferred mode for most OpenGL applications. In RGBA
- color mode you specify colors as red + green + blue + alpha
- quadruplets.
-
- In color index mode you specify an index into a color lookup
- table.
-
- \sa rgba()
-*/
-
-void QPlatformWindowFormat::setRgba(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::Rgba : QPlatformWindowFormat::ColorIndex);
-}
-
-
-/*!
- \fn bool QPlatformWindowFormat::alpha() const
-
- Returns true if the alpha buffer in the framebuffer is enabled;
- otherwise returns false. The alpha buffer is disabled by default.
-
- \sa setAlpha(), setAlphaBufferSize()
-*/
-
-/*!
- If \a enable is true enables the alpha buffer; otherwise disables
- the alpha buffer.
-
- The alpha buffer is disabled by default.
-
- The alpha buffer is typically used for implementing transparency
- or translucency. The A in RGBA specifies the transparency of a
- pixel.
-
- \sa alpha(), setAlphaBufferSize()
-*/
-
-void QPlatformWindowFormat::setAlpha(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::AlphaChannel : QPlatformWindowFormat::NoAlphaChannel);
-}
-
-
-/*!
- \fn bool QPlatformWindowFormat::accum() const
-
- Returns true if the accumulation buffer is enabled; otherwise
- returns false. The accumulation buffer is disabled by default.
-
- \sa setAccum(), setAccumBufferSize()
-*/
-
-/*!
- If \a enable is true enables the accumulation buffer; otherwise
- disables the accumulation buffer.
-
- The accumulation buffer is disabled by default.
-
- The accumulation buffer is used to create blur effects and
- multiple exposures.
-
- \sa accum(), setAccumBufferSize()
-*/
-
-void QPlatformWindowFormat::setAccum(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::AccumBuffer : QPlatformWindowFormat::NoAccumBuffer);
-}
-
-
-/*!
- \fn bool QPlatformWindowFormat::stencil() const
-
- Returns true if the stencil buffer is enabled; otherwise returns
- false. The stencil buffer is enabled by default.
-
- \sa setStencil(), setStencilBufferSize()
-*/
-
-/*!
- If \a enable is true enables the stencil buffer; otherwise
- disables the stencil buffer.
-
- The stencil buffer is enabled by default.
-
- The stencil buffer masks certain parts of the drawing area so that
- masked parts are not drawn on.
-
- \sa stencil(), setStencilBufferSize()
-*/
-
-void QPlatformWindowFormat::setStencil(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::StencilBuffer: QPlatformWindowFormat::NoStencilBuffer);
-}
-
-
-/*!
- \fn bool QPlatformWindowFormat::stereo() const
-
- Returns true if stereo buffering is enabled; otherwise returns
- false. Stereo buffering is disabled by default.
-
- \sa setStereo()
-*/
-
-/*!
- If \a enable is true enables stereo buffering; otherwise disables
- stereo buffering.
-
- Stereo buffering is disabled by default.
-
- Stereo buffering provides extra color buffers to generate left-eye
- and right-eye images.
-
- \sa stereo()
-*/
-
-void QPlatformWindowFormat::setStereo(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::StereoBuffers : QPlatformWindowFormat::NoStereoBuffers);
-}
-
-
-/*!
- \fn bool QPlatformWindowFormat::directRendering() const
-
- Returns true if direct rendering is enabled; otherwise returns
- false.
-
- Direct rendering is enabled by default.
-
- \sa setDirectRendering()
-*/
-
-/*!
- If \a enable is true enables direct rendering; otherwise disables
- direct rendering.
-
- Direct rendering is enabled by default.
-
- Enabling this option will make OpenGL bypass the underlying window
- system and render directly from hardware to the screen, if this is
- supported by the system.
-
- \sa directRendering()
-*/
-
-void QPlatformWindowFormat::setDirectRendering(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::DirectRendering : QPlatformWindowFormat::IndirectRendering);
-}
-
-/*!
- \fn bool QPlatformWindowFormat::sampleBuffers() const
-
- Returns true if multisample buffer support is enabled; otherwise
- returns false.
-
- The multisample buffer is disabled by default.
-
- \sa setSampleBuffers()
-*/
-
-/*!
- If \a enable is true, a GL context with multisample buffer support
- is picked; otherwise ignored.
-
- \sa sampleBuffers(), setSamples(), samples()
-*/
-void QPlatformWindowFormat::setSampleBuffers(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::SampleBuffers : QPlatformWindowFormat::NoSampleBuffers);
-}
-
-/*!
- Returns the number of samples per pixel when multisampling is
- enabled. By default, the highest number of samples that is
- available is used.
-
- \sa setSampleBuffers(), sampleBuffers(), setSamples()
-*/
-int QPlatformWindowFormat::samples() const
-{
- return d->numSamples;
-}
-
-/*!
- Set the preferred number of samples per pixel when multisampling
- is enabled to \a numSamples. By default, the highest number of
- samples available is used.
-
- \sa setSampleBuffers(), sampleBuffers(), samples()
-*/
-void QPlatformWindowFormat::setSamples(int numSamples)
-{
- detach();
- if (numSamples < 0) {
- qWarning("QPlatformWindowFormat::setSamples: Cannot have negative number of samples per pixel %d", numSamples);
- return;
- }
- d->numSamples = numSamples;
- setSampleBuffers(numSamples > 0);
-}
-
-/*!
- \since 4.2
-
- Set the preferred swap interval. This can be used to sync the GL
- drawing into a system window to the vertical refresh of the screen.
- Setting an \a interval value of 0 will turn the vertical refresh syncing
- off, any value higher than 0 will turn the vertical syncing on.
-
- Under Windows and under X11, where the \c{WGL_EXT_swap_control}
- and \c{GLX_SGI_video_sync} extensions are used, the \a interval
- parameter can be used to set the minimum number of video frames
- that are displayed before a buffer swap will occur. In effect,
- setting the \a interval to 10, means there will be 10 vertical
- retraces between every buffer swap.
-
- Under Windows the \c{WGL_EXT_swap_control} extension has to be present,
- and under X11 the \c{GLX_SGI_video_sync} extension has to be present.
-*/
-void QPlatformWindowFormat::setSwapInterval(int interval)
-{
- detach();
- d->swapInterval = interval;
-}
-
-/*!
- \since 4.2
-
- Returns the currently set swap interval. -1 is returned if setting
- the swap interval isn't supported in the system GL implementation.
-*/
-int QPlatformWindowFormat::swapInterval() const
-{
- return d->swapInterval;
-}
-
-void QPlatformWindowFormat::setWindowApi(QPlatformWindowFormat::WindowApi api)
-{
- detach();
- d->windowApi = api;
-}
-
-QPlatformWindowFormat::WindowApi QPlatformWindowFormat::windowApi() const
-{
- return d->windowApi;
-}
-
-void QPlatformWindowFormat::setSharedContext(QPlatformGLContext *context)
-{
- d->sharedContext = context;
-}
-
-QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const
-{
- return d->sharedContext;
-}
-
-/*!
- \fn bool QPlatformWindowFormat::hasWindowSurface() const
-
- Returns true if the corresponding widget has an instance of QWindowSurface.
-
- Otherwise returns false.
-
- WindowSurface is enabled by default.
-
- \sa setOverlay()
-*/
-
-/*!
- If \a enable is true a top level QWidget will create a QWindowSurface at creation;
-
- otherwise the QWidget will only have a QPlatformWindow.
-
- This is useful for ie. QGLWidget where the QPlatformGLContext controls the surface.
-
- \sa hasOverlay()
-*/
-
-void QPlatformWindowFormat::setWindowSurface(bool enable)
-{
- setOption(enable ? QPlatformWindowFormat::HasWindowSurface : QPlatformWindowFormat::NoWindowSurface);
-}
-
-/*!
- Sets the format option to \a opt.
-
- \sa testOption()
-*/
-
-void QPlatformWindowFormat::setOption(QPlatformWindowFormat::FormatOptions opt)
-{
- detach();
- if (opt & 0xffff)
- d->opts |= opt;
- else
- d->opts &= ~(opt >> 16);
-}
-
-
-
-/*!
- Returns true if format option \a opt is set; otherwise returns false.
-
- \sa setOption()
-*/
-
-bool QPlatformWindowFormat::testOption(QPlatformWindowFormat::FormatOptions opt) const
-{
- if (opt & 0xffff)
- return (d->opts & opt) != 0;
- else
- return (d->opts & (opt >> 16)) == 0;
-}
-
-/*!
- Set the minimum depth buffer size to \a size.
-
- \sa depthBufferSize(), setDepth(), depth()
-*/
-void QPlatformWindowFormat::setDepthBufferSize(int size)
-{
- detach();
- if (size < 0) {
- qWarning("QPlatformWindowFormat::setDepthBufferSize: Cannot set negative depth buffer size %d", size);
- return;
- }
- d->depthSize = size;
- setDepth(size > 0);
-}
-
-/*!
- Returns the depth buffer size.
-
- \sa depth(), setDepth(), setDepthBufferSize()
-*/
-int QPlatformWindowFormat::depthBufferSize() const
-{
- return d->depthSize;
-}
-
-/*!
- \since 4.2
-
- Set the preferred red buffer size to \a size.
-
- \sa setGreenBufferSize(), setBlueBufferSize(), setAlphaBufferSize()
-*/
-void QPlatformWindowFormat::setRedBufferSize(int size)
-{
- detach();
- if (size < 0) {
- qWarning("QPlatformWindowFormat::setRedBufferSize: Cannot set negative red buffer size %d", size);
- return;
- }
- d->redSize = size;
-}
-
-/*!
- \since 4.2
-
- Returns the red buffer size.
-
- \sa setRedBufferSize()
-*/
-int QPlatformWindowFormat::redBufferSize() const
-{
- return d->redSize;
-}
-
-/*!
- \since 4.2
-
- Set the preferred green buffer size to \a size.
-
- \sa setRedBufferSize(), setBlueBufferSize(), setAlphaBufferSize()
-*/
-void QPlatformWindowFormat::setGreenBufferSize(int size)
-{
- detach();
- if (size < 0) {
- qWarning("QPlatformWindowFormat::setGreenBufferSize: Cannot set negative green buffer size %d", size);
- return;
- }
- d->greenSize = size;
-}
-
-/*!
- \since 4.2
-
- Returns the green buffer size.
-
- \sa setGreenBufferSize()
-*/
-int QPlatformWindowFormat::greenBufferSize() const
-{
- return d->greenSize;
-}
-
-/*!
- \since 4.2
-
- Set the preferred blue buffer size to \a size.
-
- \sa setRedBufferSize(), setGreenBufferSize(), setAlphaBufferSize()
-*/
-void QPlatformWindowFormat::setBlueBufferSize(int size)
-{
- detach();
- if (size < 0) {
- qWarning("QPlatformWindowFormat::setBlueBufferSize: Cannot set negative blue buffer size %d", size);
- return;
- }
- d->blueSize = size;
-}
-
-/*!
- \since 4.2
-
- Returns the blue buffer size.
-
- \sa setBlueBufferSize()
-*/
-int QPlatformWindowFormat::blueBufferSize() const
-{
- return d->blueSize;
-}
-
-/*!
- Set the preferred alpha buffer size to \a size.
- This function implicitly enables the alpha channel.
-
- \sa setRedBufferSize(), setGreenBufferSize(), alphaBufferSize()
-*/
-void QPlatformWindowFormat::setAlphaBufferSize(int size)
-{
- detach();
- if (size < 0) {
- qWarning("QPlatformWindowFormat::setAlphaBufferSize: Cannot set negative alpha buffer size %d", size);
- return;
- }
- d->alphaSize = size;
- setAlpha(size > 0);
-}
-
-/*!
- Returns the alpha buffer size.
-
- \sa alpha(), setAlpha(), setAlphaBufferSize()
-*/
-int QPlatformWindowFormat::alphaBufferSize() const
-{
- return d->alphaSize;
-}
-
-/*!
- Set the preferred accumulation buffer size, where \a size is the
- bit depth for each RGBA component.
-
- \sa accum(), setAccum(), accumBufferSize()
-*/
-void QPlatformWindowFormat::setAccumBufferSize(int size)
-{
- detach();
- if (size < 0) {
- qWarning("QPlatformWindowFormat::setAccumBufferSize: Cannot set negative accumulate buffer size %d", size);
- return;
- }
- d->accumSize = size;
- setAccum(size > 0);
-}
-
-/*!
- Returns the accumulation buffer size.
-
- \sa setAccumBufferSize(), accum(), setAccum()
-*/
-int QPlatformWindowFormat::accumBufferSize() const
-{
- return d->accumSize;
-}
-
-/*!
- Set the preferred stencil buffer size to \a size.
-
- \sa stencilBufferSize(), setStencil(), stencil()
-*/
-void QPlatformWindowFormat::setStencilBufferSize(int size)
-{
- detach();
- if (size < 0) {
- qWarning("QPlatformWindowFormat::setStencilBufferSize: Cannot set negative stencil buffer size %d", size);
- return;
- }
- d->stencilSize = size;
- setStencil(size > 0);
-}
-
-/*!
- Returns the stencil buffer size.
-
- \sa stencil(), setStencil(), setStencilBufferSize()
-*/
-int QPlatformWindowFormat::stencilBufferSize() const
-{
- return d->stencilSize;
-}
-
-/*!
- Returns the default QPlatformWindowFormat for the application. All QGLWidget
- objects that are created use this format unless another format is
- specified, e.g. when they are constructed.
-
- If no special default format has been set using
- setDefaultFormat(), the default format is the same as that created
- with QPlatformWindowFormat().
-
- \sa setDefaultFormat()
-*/
-
-QPlatformWindowFormat QPlatformWindowFormat::defaultFormat()
-{
- return *q_platformwindow_default_format();
-}
-
-/*!
- Sets a new default QPlatformWindowFormat for the application to \a f. For
- example, to set single buffering as the default instead of double
- buffering, your main() might contain code like this:
- \snippet doc/src/snippets/code/src_opengl_qgl.cpp 4
-
- \sa defaultFormat()
-*/
-
-void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f)
-{
- *q_platformwindow_default_format() = f;
-}
-
-
-/*!
- Returns the default QPlatformWindowFormat for overlay contexts.
-
- The default overlay format is:
- \list
- \i \link setDoubleBuffer() Double buffer:\endlink Disabled.
- \i \link setDepth() Depth buffer:\endlink Disabled.
- \i \link setRgba() RGBA:\endlink Disabled (i.e., color index enabled).
- \i \link setAlpha() Alpha channel:\endlink Disabled.
- \i \link setAccum() Accumulator buffer:\endlink Disabled.
- \i \link setStencil() Stencil buffer:\endlink Disabled.
- \i \link setStereo() Stereo:\endlink Disabled.
- \i \link setDirectRendering() Direct rendering:\endlink Enabled.
- \i \link setOverlay() Overlay:\endlink Disabled.
- \i \link setSampleBuffers() Multisample buffers:\endlink Disabled.
- \i \link setPlane() Plane:\endlink 1 (i.e., first overlay plane).
- \endlist
-
- \sa setDefaultFormat()
-*/
-
-//QPlatformWindowFormat QPlatformWindowFormat::defaultOverlayFormat()
-//{
-// return *defaultOverlayFormatInstance();
-//}
-
-///*!
-// Sets a new default QPlatformWindowFormat for overlay contexts to \a f. This
-// format is used whenever a QGLWidget is created with a format that
-// hasOverlay() enabled.
-
-// For example, to get a double buffered overlay context (if
-// available), use code like this:
-
-// \snippet doc/src/snippets/code/src_opengl_qgl.cpp 5
-
-// As usual, you can find out after widget creation whether the
-// underlying OpenGL system was able to provide the requested
-// specification:
-
-// \snippet doc/src/snippets/code/src_opengl_qgl.cpp 6
-
-// \sa defaultOverlayFormat()
-//*/
-
-//void QPlatformWindowFormat::setDefaultOverlayFormat(const QPlatformWindowFormat &f)
-//{
-// QPlatformWindowFormat *defaultFormat = defaultOverlayFormatInstance();
-// *defaultFormat = f;
-// // Make sure the user doesn't request that the overlays themselves
-// // have overlays, since it is unlikely that the system supports
-// // infinitely many planes...
-// defaultFormat->setOverlay(false);
-//}
-
-
-/*!
- Returns true if all the options of the two QPlatformWindowFormat objects
- \a a and \a b are equal; otherwise returns false.
-
- \relates QPlatformWindowFormat
-*/
-
-bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b)
-{
- return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts
- && a.d->alphaSize == b.d->alphaSize
- && a.d->accumSize == b.d->accumSize
- && a.d->stencilSize == b.d->stencilSize
- && a.d->depthSize == b.d->depthSize
- && a.d->redSize == b.d->redSize
- && a.d->greenSize == b.d->greenSize
- && a.d->blueSize == b.d->blueSize
- && a.d->numSamples == b.d->numSamples
- && a.d->swapInterval == b.d->swapInterval
- && a.d->windowApi == b.d->windowApi);
-}
-
-
-/*!
- Returns false if all the options of the two QPlatformWindowFormat objects
- \a a and \a b are equal; otherwise returns true.
-
- \relates QPlatformWindowFormat
-*/
-
-bool operator!=(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b)
-{
- return !(a == b);
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QPlatformWindowFormat &f)
-{
- const QPlatformWindowFormatPrivate * const d = f.d;
-
- dbg.nospace() << "QGLFormat("
- << "options " << d->opts
- << ", depthBufferSize " << d->depthSize
- << ", accumBufferSize " << d->accumSize
- << ", stencilBufferSize " << d->stencilSize
- << ", redBufferSize " << d->redSize
- << ", greenBufferSize " << d->greenSize
- << ", blueBufferSize " << d->blueSize
- << ", alphaBufferSize " << d->alphaSize
- << ", samples " << d->numSamples
- << ", swapInterval " << d->swapInterval
- << ')';
-
- return dbg.space();
-}
-#endif
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h
deleted file mode 100644
index ba21ba4626..0000000000
--- a/src/gui/kernel/qplatformwindowformat_qpa.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QPLATFORMWINDOWFORMAT_QPA_H
-#define QPLATFORMWINDOWFORMAT_QPA_H
-
-#include <QtGui/QPlatformWindow>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QPlatformWindowFormatPrivate;
-
-class Q_GUI_EXPORT QPlatformWindowFormat
-{
-public:
- enum FormatOption {
- DoubleBuffer = 0x0001,
- DepthBuffer = 0x0002,
- Rgba = 0x0004,
- AlphaChannel = 0x0008,
- AccumBuffer = 0x0010,
- StencilBuffer = 0x0020,
- StereoBuffers = 0x0040,
- DirectRendering = 0x0080,
- HasOverlay = 0x0100,
- SampleBuffers = 0x0200,
- DeprecatedFunctions = 0x0400,
- HasWindowSurface = 0x0800,
- SingleBuffer = DoubleBuffer << 16,
- NoDepthBuffer = DepthBuffer << 16,
- ColorIndex = Rgba << 16,
- NoAlphaChannel = AlphaChannel << 16,
- NoAccumBuffer = AccumBuffer << 16,
- NoStencilBuffer = StencilBuffer << 16,
- NoStereoBuffers = StereoBuffers << 16,
- IndirectRendering = DirectRendering << 16,
- NoOverlay = HasOverlay << 16,
- NoSampleBuffers = SampleBuffers << 16,
- NoDeprecatedFunctions = DeprecatedFunctions << 16,
- NoWindowSurface = HasWindowSurface << 16
-
- };
- Q_DECLARE_FLAGS(FormatOptions, FormatOption)
-
- enum WindowApi {
- Raster,
- OpenGL,
- OpenVG
- };
-
- QPlatformWindowFormat();
- QPlatformWindowFormat(FormatOptions options);
- QPlatformWindowFormat(const QPlatformWindowFormat &other);
- QPlatformWindowFormat &operator=(const QPlatformWindowFormat &other);
- ~QPlatformWindowFormat();
-
- void setDepthBufferSize(int size);
- int depthBufferSize() const;
-
- void setAccumBufferSize(int size);
- int accumBufferSize() const;
-
- void setRedBufferSize(int size);
- int redBufferSize() const;
-
- void setGreenBufferSize(int size);
- int greenBufferSize() const;
-
- void setBlueBufferSize(int size);
- int blueBufferSize() const;
-
- void setAlphaBufferSize(int size);
- int alphaBufferSize() const;
-
- void setStencilBufferSize(int size);
- int stencilBufferSize() const;
-
- void setSampleBuffers(bool enable);
- bool sampleBuffers() const;
-
- void setSamples(int numSamples);
- int samples() const;
-
- void setSwapInterval(int interval);
- int swapInterval() const;
-
- void setWindowApi(QPlatformWindowFormat::WindowApi api);
- WindowApi windowApi() const;
-
- void setSharedContext(QPlatformGLContext *context);
- QPlatformGLContext *sharedGLContext() const;
-
- bool doubleBuffer() const;
- void setDoubleBuffer(bool enable);
- bool depth() const;
- void setDepth(bool enable);
- bool rgba() const;
- void setRgba(bool enable);
- bool alpha() const;
- void setAlpha(bool enable);
- bool accum() const;
- void setAccum(bool enable);
- bool stencil() const;
- void setStencil(bool enable);
- bool stereo() const;
- void setStereo(bool enable);
- bool directRendering() const;
- void setDirectRendering(bool enable);
- bool hasWindowSurface() const;
- void setWindowSurface(bool enable);
-
- void setOption(QPlatformWindowFormat::FormatOptions opt);
- bool testOption(QPlatformWindowFormat::FormatOptions opt) const;
-
- static QPlatformWindowFormat defaultFormat();
- static void setDefaultFormat(const QPlatformWindowFormat& f);
-
-private:
- QPlatformWindowFormatPrivate *d;
-
- void detach();
-
- friend Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
- friend Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
-#ifndef QT_NO_DEBUG_STREAM
- friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QPlatformWindowFormat &);
-#endif
-};
-
-Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
-Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QPlatformWindowFormat &);
-#endif
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::FormatOptions)
-
-inline bool QPlatformWindowFormat::doubleBuffer() const
-{
- return testOption(QPlatformWindowFormat::DoubleBuffer);
-}
-
-inline bool QPlatformWindowFormat::depth() const
-{
- return testOption(QPlatformWindowFormat::DepthBuffer);
-}
-
-inline bool QPlatformWindowFormat::rgba() const
-{
- return testOption(QPlatformWindowFormat::Rgba);
-}
-
-inline bool QPlatformWindowFormat::alpha() const
-{
- return testOption(QPlatformWindowFormat::AlphaChannel);
-}
-
-inline bool QPlatformWindowFormat::accum() const
-{
- return testOption(QPlatformWindowFormat::AccumBuffer);
-}
-
-inline bool QPlatformWindowFormat::stencil() const
-{
- return testOption(QPlatformWindowFormat::StencilBuffer);
-}
-
-inline bool QPlatformWindowFormat::stereo() const
-{
- return testOption(QPlatformWindowFormat::StereoBuffers);
-}
-
-inline bool QPlatformWindowFormat::directRendering() const
-{
- return testOption(QPlatformWindowFormat::DirectRendering);
-}
-
-inline bool QPlatformWindowFormat::hasWindowSurface() const
-{
- return testOption(QPlatformWindowFormat::HasWindowSurface);
-}
-
-inline bool QPlatformWindowFormat::sampleBuffers() const
-{
- return testOption(QPlatformWindowFormat::SampleBuffers);
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif //QPLATFORMWINDOWFORMAT_QPA_H
diff --git a/src/gui/kernel/qsessionmanager_qpa.cpp b/src/gui/kernel/qsessionmanager_qpa.cpp
index 68685b4fed..0730204720 100644
--- a/src/gui/kernel/qsessionmanager_qpa.cpp
+++ b/src/gui/kernel/qsessionmanager_qpa.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qsessionmanager.h>
+#include <qapplication.h>
#include <private/qobject_p.h>
#include <qapplication.h>
diff --git a/src/gui/kernel/qsessionmanager_qws.cpp b/src/gui/kernel/qsessionmanager_qws.cpp
deleted file mode 100644
index e355d055ad..0000000000
--- a/src/gui/kernel/qsessionmanager_qws.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qsessionmanager.h>
-
-#ifndef QT_NO_SESSIONMANAGER
-
-QT_BEGIN_NAMESPACE
-
-class QSessionManagerPrivate : public QObjectPrivate
-{
-public:
- QSessionManagerPrivate(QSessionManager *m, const QString &id,
- const QString &key);
-
- QStringList restartCommand;
- QStringList discardCommand;
- const QString sessionId;
- const QString sessionKey;
- QSessionManager::RestartHint restartHint;
-};
-
-QSessionManagerPrivate::QSessionManagerPrivate(QSessionManager*,
- const QString &id,
- const QString &key)
- : QObjectPrivate(), sessionId(id), sessionKey(key)
-{
-}
-
-QSessionManager::QSessionManager(QApplication *app, QString &id, QString &key)
- : QObject(*new QSessionManagerPrivate(this, id, key), app)
-{
- Q_D(QSessionManager);
- d->restartHint = RestartIfRunning;
-}
-
-QSessionManager::~QSessionManager()
-{
-}
-
-QString QSessionManager::sessionId() const
-{
- Q_D(const QSessionManager);
- return d->sessionId;
-}
-
-QString QSessionManager::sessionKey() const
-{
- Q_D(const QSessionManager);
- return d->sessionKey;
-}
-
-
-bool QSessionManager::allowsInteraction()
-{
- return false;
-}
-
-bool QSessionManager::allowsErrorInteraction()
-{
- return false;
-}
-
-void QSessionManager::release()
-{
-}
-
-void QSessionManager::cancel()
-{
-}
-
-void QSessionManager::setRestartHint(QSessionManager::RestartHint hint)
-{
- Q_D(QSessionManager);
- d->restartHint = hint;
-}
-
-QSessionManager::RestartHint QSessionManager::restartHint() const
-{
- Q_D(const QSessionManager);
- return d->restartHint;
-}
-
-void QSessionManager::setRestartCommand(const QStringList &command)
-{
- Q_D(QSessionManager);
- d->restartCommand = command;
-}
-
-QStringList QSessionManager::restartCommand() const
-{
- Q_D(const QSessionManager);
- return d->restartCommand;
-}
-
-void QSessionManager::setDiscardCommand(const QStringList &command)
-{
- Q_D(QSessionManager);
- d->discardCommand = command;
-}
-
-QStringList QSessionManager::discardCommand() const
-{
- Q_D(const QSessionManager);
- return d->discardCommand;
-}
-
-void QSessionManager::setManagerProperty(const QString &name,
- const QString &value)
-{
- Q_UNUSED(name);
- Q_UNUSED(value);
-}
-
-void QSessionManager::setManagerProperty(const QString &name,
- const QStringList &value)
-{
- Q_UNUSED(name);
- Q_UNUSED(value);
-}
-
-bool QSessionManager::isPhase2() const
-{
- return false;
-}
-
-void QSessionManager::requestPhase2()
-{
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_SESSIONMANAGER
diff --git a/src/gui/kernel/qsound.cpp b/src/gui/kernel/qsound.cpp
index a61310a4eb..55a98758c3 100644
--- a/src/gui/kernel/qsound.cpp
+++ b/src/gui/kernel/qsound.cpp
@@ -189,29 +189,6 @@ QSound::QSound(const QString& filename, QObject* parent)
server().init(this);
}
-#ifdef QT3_SUPPORT
-/*!
- \obsolete
-
- Constructs a QSound object from the file specified by the given \a
- filename and with the given \a parent and \a name. Use the
- QSound() construcor and QObject::setObjectName() instead.
-
- \oldcode
- QSound *mySound = new QSound(filename, parent, name);
- \newcode
- QSounc *mySound = new QSound(filename, parent);
- mySound->setObjectName(name);
- \endcode
-*/
-QSound::QSound(const QString& filename, QObject* parent, const char* name)
- : QObject(*new QSoundPrivate(filename), parent)
-{
- setObjectName(QString::fromAscii(name));
- server().init(this);
-}
-#endif
-
/*!
Destroys this sound object. If the sound is not finished playing,
the stop() function is called before the sound object is
diff --git a/src/gui/kernel/qsound.h b/src/gui/kernel/qsound.h
index 70957762b2..a0d058011a 100644
--- a/src/gui/kernel/qsound.h
+++ b/src/gui/kernel/qsound.h
@@ -76,11 +76,6 @@ public Q_SLOTS:
void play();
void stop();
-public:
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QSound(const QString& filename, QObject* parent, const char* name);
- static inline QT3_SUPPORT bool available() { return isAvailable(); }
-#endif
private:
Q_DECLARE_PRIVATE(QSound)
friend class QAuServer;
diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp
deleted file mode 100644
index c48347bf76..0000000000
--- a/src/gui/kernel/qsound_qws.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-
-#ifndef QT_NO_SOUND
-
-#include "qsound.h"
-#include "qpaintdevice.h"
-#include "qwsdisplay_qws.h"
-#include "qsound_p.h"
-
-#include "qsoundqss_qws.h"
-
-#include "qhash.h"
-#include "qfileinfo.h"
-
-#include "qbytearray.h"
-#include "quuid.h"
-#include "qdatastream.h"
-#include "qcopchannel_qws.h"
-#include "qbuffer.h"
-
-
-QT_BEGIN_NAMESPACE
-
-#ifdef MEDIA_SERVER
-
-#define SERVER_CHANNEL "QPE/MediaServer"
-
-class QCopMessage : public QDataStream
-{
-public:
- QCopMessage( const QString& channel, const QString& message )
- : QDataStream( new QBuffer ), m_channel( channel ), m_message( message )
- {
- device()->open( QIODevice::WriteOnly );
- }
-
- ~QCopMessage()
- {
- QCopChannel::send( m_channel, m_message, ((QBuffer*)device())->buffer() );
- delete device();
- }
-
-private:
- QString m_channel;
- QString m_message;
-};
-
-#endif // MEDIA_SERVER
-
-class QAuServerQWS;
-
-class QAuBucketQWS : public QObject, public QAuBucket
-{
- Q_OBJECT
-public:
- QAuBucketQWS( QAuServerQWS*, QSound*, QObject* parent = 0 );
-
- ~QAuBucketQWS();
-
-#ifndef MEDIA_SERVER
- int id() const { return id_; }
-#endif
-
- QSound* sound() const { return sound_; }
-
-#ifdef MEDIA_SERVER
- void play();
-
- void stop();
-#endif
-
-signals:
- // Only for Media Server
- void done( QAuBucketQWS* );
-
-private slots:
- // Only for Media Server
- void processMessage( const QString& msg, const QByteArray& data );
-
-private:
-#ifdef MEDIA_SERVER
- QCopChannel *m_channel;
- QUuid m_id;
-#endif
-
-#ifndef MEDIA_SERVER
- int id_;
-#endif
- QSound *sound_;
- QAuServerQWS *server_;
-
- static int next;
-};
-
-int QAuBucketQWS::next = 0;
-
-class QAuServerQWS : public QAuServer
-{
- Q_OBJECT
-public:
- QAuServerQWS( QObject* parent );
-
- void init( QSound* s )
- {
- QAuBucketQWS *bucket = new QAuBucketQWS( this, s );
-#ifdef MEDIA_SERVER
- connect( bucket, SIGNAL(done(QAuBucketQWS*)),
- this, SLOT(complete(QAuBucketQWS*)) );
-#endif
- setBucket( s, bucket );
- }
-
-#ifndef MEDIA_SERVER
- // Register bucket
- void insert( QAuBucketQWS *bucket )
- {
- buckets.insert( bucket->id(), bucket );
- }
-
- // Remove bucket from register
- void remove( QAuBucketQWS *bucket )
- {
- buckets.remove( bucket->id() );
- }
-#endif
-
- void play( QSound* s )
- {
- QString filepath = QFileInfo( s->fileName() ).absoluteFilePath();
-#if defined(QT_NO_QWS_SOUNDSERVER)
- server->playFile( bucket( s )->id(), filepath );
-#elif defined(MEDIA_SERVER)
- bucket( s )->play();
-#else
- client->play( bucket( s )->id(), filepath );
-#endif
- }
-
- void stop( QSound* s )
- {
-#if defined(QT_NO_QWS_SOUNDSERVER)
- server->stopFile( bucket( s )->id() );
-#elif defined(MEDIA_SERVER)
- bucket( s )->stop();
-#else
- client->stop( bucket( s )->id() );
-#endif
- }
-
- bool okay() { return true; }
-
-private slots:
- // Continue playing sound if loops remain
- void complete( int id )
- {
-#ifndef MEDIA_SERVER
- QAuBucketQWS *bucket = find( id );
- if( bucket ) {
- QSound *sound = bucket->sound();
- if( decLoop( sound ) ) {
- play( sound );
- }
- }
-#else
- Q_UNUSED(id);
-#endif
- }
-
- // Only for Media Server
- void complete( QAuBucketQWS* bucket )
- {
-#ifndef MEDIA_SERVER
- Q_UNUSED(bucket);
-#else
- QSound *sound = bucket->sound();
- if( decLoop( sound ) ) {
- play( sound );
- }
-#endif
- }
-
-protected:
- QAuBucketQWS* bucket( QSound *s )
- {
- return (QAuBucketQWS*)QAuServer::bucket( s );
- }
-
-private:
-#ifndef MEDIA_SERVER
- // Find registered bucket with given id, return null if none found
- QAuBucketQWS* find( int id )
- {
- QHash<int, QAuBucketQWS*>::Iterator it = buckets.find( id );
- if( it != buckets.end() ) {
- return it.value();
- }
-
- return 0;
- }
-
- QHash<int, QAuBucketQWS*> buckets; // ### possible problem with overlapping keys
-
-#ifdef QT_NO_QWS_SOUNDSERVER
- QWSSoundServer *server;
-#else
- QWSSoundClient *client;
-#endif
-
-#endif // MEDIA_SERVER
-};
-
-QAuServerQWS::QAuServerQWS(QObject* parent) :
- QAuServer(parent)
-{
-#ifndef MEDIA_SERVER
- setObjectName(QLatin1String("qauserverqws"));
-
-#ifdef QT_NO_QWS_SOUNDSERVER
- server = new QWSSoundServer( this ); // ### only suitable for single application
-
- connect( server, SIGNAL(soundCompleted(int)),
- this, SLOT(complete(int)) );
-#else
- client = new QWSSoundClient( this ); // ### requires successful connection
-
- connect( client, SIGNAL(soundCompleted(int)),
- this, SLOT(complete(int)) );
-#endif
-
-#endif // MEDIA_SERVER
-}
-
-QAuBucketQWS::QAuBucketQWS( QAuServerQWS *server, QSound *sound, QObject* parent )
- : QObject( parent ), sound_( sound ), server_( server )
-{
-#ifdef MEDIA_SERVER
- m_id = QUuid::createUuid();
-
- sound->setObjectName( m_id.toString() );
-
- m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id, this );
- connect( m_channel, SIGNAL(received(QString,QByteArray)),
- this, SLOT(processMessage(QString,QByteArray)) );
-
- {
- QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("subscribe(QUuid)") );
- message << m_id;
- }
-
- {
- QString filepath = QFileInfo( sound_->fileName() ).absoluteFilePath();
- QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("open(QUuid,QString)") );
- message << m_id << filepath;
- }
-#else
- id_ = next++;
- server_->insert( this );
-#endif
-}
-
-#ifdef MEDIA_SERVER
-void QAuBucketQWS::play()
-{
- QString filepath = QFileInfo( sound_->fileName() ).absoluteFilePath();
-
- QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("play(QUuid)") );
- message << m_id;
-}
-
-void QAuBucketQWS::stop()
-{
- QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("stop(QUuid)") );
- message << m_id;
-}
-#endif // MEDIA_SERVER
-
-void QAuBucketQWS::processMessage( const QString& msg, const QByteArray& data )
-{
- Q_UNUSED(data);
-#ifndef MEDIA_SERVER
- Q_UNUSED(msg);
-#else
- if( msg == QLatin1String("done()") ) {
- emit done( this );
- }
-#endif
-}
-
-QAuBucketQWS::~QAuBucketQWS()
-{
-#ifdef MEDIA_SERVER
- QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("revoke(QUuid)") );
- message << m_id;
-#else
- server_->remove( this );
-#endif
-}
-
-
-QAuServer* qt_new_audio_server()
-{
- return new QAuServerQWS(qApp);
-}
-
-#include "qsound_qws.moc"
-
-#endif // QT_NO_SOUND
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 5705214762..0c9e523951 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -78,6 +78,7 @@
#endif
#if defined(Q_WS_QPA)
#include "qplatformwindow_qpa.h"
+#include "private/qwidgetwindow_qpa_p.h"
#endif
#include "qpainter.h"
#include "qtooltip.h"
@@ -120,7 +121,6 @@
#include "private/qabstractscrollarea_p.h"
#include "private/qevent_p.h"
-#include "private/qgraphicssystem_p.h"
#include "private/qgesturemanager_p.h"
#ifdef QT_KEYPAD_NAVIGATION
@@ -160,11 +160,7 @@ static inline bool qRectIntersects(const QRect &r1, const QRect &r2)
static inline bool hasBackingStoreSupport()
{
-#ifdef Q_WS_MAC
- return QApplicationPrivate::graphicsSystem() != 0;
-#else
return true;
-#endif
}
#ifdef Q_WS_MAC
@@ -358,9 +354,9 @@ QWidgetPrivate::~QWidgetPrivate()
class QDummyWindowSurface : public QWindowSurface
{
public:
- QDummyWindowSurface(QWidget *window) : QWindowSurface(window) {}
- QPaintDevice *paintDevice() { return window(); }
- void flush(QWidget *, const QRegion &, const QPoint &) {}
+ QDummyWindowSurface(QWindow *window) : QWindowSurface(window) {}
+ QPaintDevice *paintDevice() { return static_cast<QWidgetWindow *>(window())->widget(); }
+ void flush(QWindow *, const QRegion &, const QPoint &) {}
};
QWindowSurface *QWidgetPrivate::createDefaultWindowSurface()
@@ -370,14 +366,12 @@ QWindowSurface *QWidgetPrivate::createDefaultWindowSurface()
QWindowSurface *surface;
#ifndef QT_NO_PROPERTIES
if (q->property("_q_DummyWindowSurface").toBool()) {
- surface = new QDummyWindowSurface(q);
+ surface = new QDummyWindowSurface(q->windowHandle());
} else
#endif
{
- if (QApplicationPrivate::graphicsSystem())
- surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q);
- else
- surface = createDefaultWindowSurface_sys();
+ QWindow *win = topData()->window;
+ surface = QGuiApplicationPrivate::platformIntegration()->createWindowSurface(win, win->winId());
}
return surface;
@@ -1307,7 +1301,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
#elif defined(Q_WS_QPA)
if (desktopWidget) {
int screen = desktopWidget->d_func()->topData()->screenIndex;
- QPlatformIntegration *platform = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *platform = QGuiApplicationPrivate::platformIntegration();
platform->moveToScreen(q, screen);
}
#else
@@ -1761,11 +1755,6 @@ void QWidgetPrivate::createTLExtra()
static int count = 0;
qDebug() << "tlextra" << ++count;
#endif
-#if defined(Q_WS_QPA)
- x->platformWindow = 0;
- x->platformWindowFormat = QPlatformWindowFormat::defaultFormat();
- x->screenIndex = 0;
-#endif
}
}
@@ -2327,26 +2316,6 @@ void QWidgetPrivate::updateIsTranslucent()
#endif
}
-/*!
- \fn void QPixmap::fill(const QWidget *widget, const QPoint &offset)
-
- Fills the pixmap with the \a widget's background color or pixmap
- according to the given offset.
-
- The QPoint \a offset defines a point in widget coordinates to
- which the pixmap's top-left pixel will be mapped to. This is only
- significant if the widget has a background pixmap; otherwise the
- pixmap will simply be filled with the background color of the
- widget.
-*/
-
-void QPixmap::fill( const QWidget *widget, const QPoint &off )
-{
- QPainter p(this);
- p.translate(-off);
- widget->d_func()->paintBackground(&p, QRect(off, size()));
-}
-
static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush)
{
Q_ASSERT(painter);
@@ -5570,7 +5539,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (!sharedPainter)
paintEngine->d_func()->systemRect = QRect();
else
- paintEngine->d_func()->currentClipWidget = 0;
+ paintEngine->d_func()->currentClipDevice = 0;
paintEngine->d_func()->systemClip = QRegion();
}
q->setAttribute(Qt::WA_WState_InPaintEvent, false);
@@ -10787,6 +10756,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
QApplication::sendEvent(this, &e);
break; }
case Qt::WA_NativeWindow: {
+#if defined(Q_WS_QPA)
+ d->createTLExtra();
+#endif
#ifndef QT_NO_IM
QWidget *focusWidget = d->effectiveFocusWidget();
QInputContext *ic = 0;
@@ -11700,11 +11672,6 @@ void QWidget::languageChange() { } // compat
\endcode
*/
-/*!
- \fn QColorGroup QWidget::colorGroup() const
-
- Use QColorGroup(palette()) instead.
-*/
/*!
\fn QWidget *QWidget::parentWidget(bool sameWindow) const
@@ -12519,6 +12486,37 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
\a m is the metric to get.
*/
+void QWidget::init(QPainter *painter) const
+{
+ const QPalette &pal = palette();
+ painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 0);
+ painter->d_func()->state->bgBrush = pal.brush(backgroundRole());
+ QFont f(font(), const_cast<QWidget *>(this));
+ painter->d_func()->state->deviceFont = f;
+ painter->d_func()->state->font = f;
+}
+
+QPaintDevice *QWidget::redirected(QPoint *offset) const
+{
+ return d_func()->redirected(offset);
+}
+
+QPainter *QWidget::sharedPainter() const
+{
+ // Someone sent a paint event directly to the widget
+ if (!d_func()->redirectDev)
+ return 0;
+
+ QPainter *sp = d_func()->sharedPainter();
+ if (!sp || !sp->isActive())
+ return 0;
+
+ if (sp->paintEngine()->paintDevice() != d_func()->redirectDev)
+ return 0;
+
+ return sp;
+}
+
/*!
\fn void QWidget::setMask(const QRegion &region)
\overload
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 7d4726ed6d..d14e8652be 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -57,7 +57,8 @@
#include <QtGui/qkeysequence.h>
#ifdef Q_WS_QPA //should this go somewhere else?
-#include <QtGui/qplatformwindowformat_qpa.h>
+#include <QtGui/qwindow.h>
+#include <QtGui/qwindowformat_qpa.h>
#endif
#ifdef QT_INCLUDE_COMPAT
@@ -635,11 +636,8 @@ public:
QWindowSurface *windowSurface() const;
#if defined(Q_WS_QPA)
- void setPlatformWindow(QPlatformWindow *window);
- QPlatformWindow *platformWindow() const;
-
- void setPlatformWindowFormat(const QPlatformWindowFormat &format);
- QPlatformWindowFormat platformWindowFormat() const;
+ void setWindowHandle(QWindow *window);
+ QWindow *windowHandle() const;
friend class QDesktopScreenWidget;
#endif
@@ -704,6 +702,9 @@ protected:
virtual void changeEvent(QEvent *);
int metric(PaintDeviceMetric) const;
+ void init(QPainter *painter) const;
+ QPaintDevice *redirected(QPoint *offset) const;
+ QPainter *sharedPainter() const;
virtual void inputMethodEvent(QInputMethodEvent *);
public:
@@ -739,6 +740,8 @@ private:
friend class QWidgetBackingStore;
friend class QApplication;
friend class QApplicationPrivate;
+ friend class QGuiApplication;
+ friend class QGuiApplicationPrivate;
friend class QBaseApplication;
friend class QPainter;
friend class QPainterPrivate;
@@ -761,6 +764,7 @@ private:
friend class QGraphicsProxyWidgetPrivate;
friend class QStyleSheetStyle;
friend struct QWidgetExceptionCleaner;
+ friend class QWidgetWindow;
#ifndef QT_NO_GESTURES
friend class QGestureManager;
friend class QWinNativePanGestureRecognizer;
@@ -854,7 +858,6 @@ public:
const QT3_SUPPORT QPixmap *backgroundPixmap() const;
void QT3_SUPPORT setBackgroundPixmap(const QPixmap &);
QT3_SUPPORT void setBackgroundColor(const QColor &);
- QT3_SUPPORT QColorGroup colorGroup() const;
QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const;
inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); }
inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); }
@@ -1051,8 +1054,6 @@ inline QWidget *QWidget::parentWidget(bool sameWindow) const
return 0;
return static_cast<QWidget *>(QObject::parent());
}
-inline QColorGroup QWidget::colorGroup() const
-{ return QColorGroup(palette()); }
inline void QWidget::setPaletteForegroundColor(const QColor &c)
{ QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); }
inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); }
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 919f8bc3da..7826cab795 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -103,7 +103,7 @@ class QWSManager;
class QCoreGraphicsPaintEnginePrivate;
#endif
#if defined(Q_WS_QPA)
-class QPlatformWindow;
+class QWidgetWindow;
#endif
class QPaintEngine;
class QPixmap;
@@ -233,8 +233,7 @@ struct QTLWExtra {
uint inExpose : 1; // Prevents drawing recursion
uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency
#elif defined(Q_WS_QPA)
- QPlatformWindow *platformWindow;
- QPlatformWindowFormat platformWindowFormat;
+ QWidgetWindow *window;
quint32 screenIndex; // index in qplatformscreenlist
#endif
};
diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp
index 001810e0f4..8c55708429 100644
--- a/src/gui/kernel/qwidget_qpa.cpp
+++ b/src/gui/kernel/qwidget_qpa.cpp
@@ -44,7 +44,7 @@
#include "QtGui/qapplication.h"
#include "QtGui/private/qbackingstore_p.h"
#include "QtGui/private/qwidget_p.h"
-#include "QtGui/private/qgraphicssystem_p.h"
+#include "QtGui/private/qwidgetwindow_qpa_p.h"
#include "QtGui/private/qapplication_p.h"
#include "QtGui/qdesktopwidget.h"
#include "QtGui/qplatformwindow_qpa.h"
@@ -54,7 +54,7 @@
QT_BEGIN_NAMESPACE
-void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWidget *parentWidget)
+void q_createNativeChildrenAndSetParent(QWindow *parentWindow, const QWidget *parentWidget)
{
QObjectList children = parentWidget->children();
for (int i = 0; i < children.size(); i++) {
@@ -62,11 +62,11 @@ void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWi
const QWidget *childWidget = qobject_cast<const QWidget *>(children.at(i));
if (childWidget) { // should not be necessary
if (childWidget->testAttribute(Qt::WA_NativeWindow)) {
- if (!childWidget->platformWindow())
+ if (!childWidget->windowHandle())
childWidget->winId();
}
- if (childWidget->platformWindow()) {
- childWidget->platformWindow()->setParent(parentWindow);
+ if (childWidget->windowHandle()) {
+ childWidget->windowHandle()->setParent(parentWindow);
} else {
q_createNativeChildrenAndSetParent(parentWindow,childWidget);
}
@@ -90,38 +90,39 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
return; // we only care about real toplevels
QWindowSurface *surface = q->windowSurface();
- QPlatformWindow *platformWindow = q->platformWindow();
- if (!platformWindow) {
- platformWindow = QApplicationPrivate::platformIntegration()->createPlatformWindow(q);
- }
- Q_ASSERT(platformWindow);
+ QWindow *win = topData()->window;
+
+ win->setWindowFlags(data.window_flags);
+ win->setGeometry(q->geometry());
+ win->create();
+
+ data.window_flags = win->windowFlags();
if (!surface ) {
- if (platformWindow && q->platformWindowFormat().hasWindowSurface()) {
- surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId());
+ if (win) {
+ surface = QGuiApplicationPrivate::platformIntegration()->createWindowSurface(win, win->winId());
+ q->setWindowSurface(surface);
} else {
q->setAttribute(Qt::WA_PaintOnScreen,true);
}
}
- data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags);
+ setWinId(win->winId());
- setWinId(q->platformWindow()->winId());
-
- //first check children. and create them if necessary
- q_createNativeChildrenAndSetParent(q->platformWindow(),q);
+// first check children. and create them if necessary
+ q_createNativeChildrenAndSetParent(q->windowHandle(),q);
//if we we have a parent, then set correct parent;
if (!q->isWindow()) {
if (QWidget *nativeParent = q->nativeParentWidget()) {
- if (nativeParent->platformWindow()) {
- platformWindow->setParent(nativeParent->platformWindow());
+ if (nativeParent->windowHandle()) {
+ win->setParent(nativeParent->windowHandle());
}
}
}
- QApplicationPrivate::platformIntegration()->moveToScreen(q, topData()->screenIndex);
+ QGuiApplicationPrivate::platformIntegration()->moveToScreen(q, topData()->screenIndex);
// qDebug() << "create_sys" << q << q->internalWinId();
}
@@ -142,7 +143,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
for (int i = 0; i < childList.size(); i++) {
QWidget *widget = qobject_cast<QWidget *>(childList.at(i));
if (widget && widget->testAttribute(Qt::WA_NativeWindow)) {
- if (widget->platformWindow()) {
+ if (widget->windowHandle()) {
widget->destroy();
}
}
@@ -177,10 +178,10 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
if (parent != newparent) {
QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function???
- if (q->platformWindow() && newparent) {
- QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget();
- if (parentWithWindow && parentWithWindow->platformWindow()) {
- q->platformWindow()->setParent(parentWithWindow->platformWindow());
+ if (q->windowHandle() && newparent) {
+ QWidget * parentWithWindow = newparent->windowHandle()? newparent : newparent->nativeParentWidget();
+ if (parentWithWindow && parentWithWindow->windowHandle()) {
+ q->windowHandle()->setParent(parentWithWindow->windowHandle());
}
}
@@ -195,8 +196,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
}
bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
-
- // Reparenting toplevel to child
+
+ // Reparenting toplevel to child
if (!(f&Qt::Window) && (oldFlags&Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) {
//qDebug() << "setParent_sys() change from toplevel";
q->destroy();
@@ -207,12 +208,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
q->setAttribute(Qt::WA_WState_Visible, false);
q->setAttribute(Qt::WA_WState_Hidden, false);
- if (f & Qt::Window) {
- //qDebug() << "setParent_sys" << q << newparent << hex << f;
- if (QPlatformWindow *window = q->platformWindow())
- data.window_flags = window->setWindowFlags(data.window_flags);
- }
-
if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden)
q->setAttribute(Qt::WA_WState_Hidden);
q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
@@ -223,7 +218,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
maybeTopData()->screenIndex = targetScreen;
// only if it is already created
if (q->testAttribute(Qt::WA_WState_Created)) {
- QPlatformIntegration *platform = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *platform = QGuiApplicationPrivate::platformIntegration();
platform->moveToScreen(q, targetScreen);
}
}
@@ -284,7 +279,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
if (!q->isWindow())
return;
- if (QPlatformWindow *window = q->platformWindow())
+ if (QWindow *window = q->windowHandle())
window->setWindowTitle(caption);
}
@@ -371,8 +366,8 @@ QWidget *QWidget::keyboardGrabber()
void QWidget::activateWindow()
{
- if (platformWindow())
- platformWindow()->requestActivateWindow();
+ if (windowHandle())
+ windowHandle()->requestActivateWindow();
}
void QWidgetPrivate::show_sys()
@@ -386,7 +381,7 @@ void QWidgetPrivate::show_sys()
QApplication::postEvent(q, new QUpdateLaterEvent(q->rect()));
- QPlatformWindow *window = q->platformWindow();
+ QWindow *window = q->windowHandle();
if (window) {
QRect geomRect = q->geometry();
if (!q->isWindow()) {
@@ -419,7 +414,7 @@ void QWidgetPrivate::hide_sys()
}
return;
}
- if (QPlatformWindow *window = q->platformWindow()) {
+ if (QWindow *window = q->windowHandle()) {
window->setVisible(false);
}
@@ -526,7 +521,7 @@ void QWidgetPrivate::raise_sys()
{
Q_Q(QWidget);
if (q->isWindow()) {
- q->platformWindow()->raise();
+ q->windowHandle()->raise();
}
}
@@ -535,7 +530,7 @@ void QWidgetPrivate::lower_sys()
Q_Q(QWidget);
if (q->isWindow()) {
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- q->platformWindow()->lower();
+ q->windowHandle()->lower();
} else if (QWidget *p = q->parentWidget()) {
setDirtyOpaqueRegion();
p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
@@ -585,12 +580,12 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
data.crect = r;
if (q->isVisible()) {
- if (q->platformWindow()) {
+ if (q->windowHandle()) {
if (q->isWindow()) {
- q->platformWindow()->setGeometry(q->geometry());
+ q->windowHandle()->setGeometry(q->geometry());
} else {
QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint());
- q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size()));
+ q->windowHandle()->setGeometry(QRect(posInNativeParent,r.size()));
}
const QWidgetBackingStore *bs = maybeBackingStore();
if (bs->windowSurface) {
@@ -611,7 +606,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (isResize) {
QResizeEvent e(r.size(), olds);
QApplication::sendEvent(q, &e);
- if (q->platformWindow())
+ if (q->windowHandle())
q->update();
}
} else { // not visible
@@ -681,64 +676,18 @@ int QWidget::metric(PaintDeviceMetric m) const
/*!
\preliminary
- Sets the window to be the \a window specified.
- The QWidget takes ownership of the \a surface.
-*/
-void QWidget::setPlatformWindow(QPlatformWindow *window)
-{
- Q_D(QWidget);
-
- QTLWExtra *topData = d->topData();
- if (topData->platformWindow == window)
- return;
-
- delete topData->platformWindow;
- topData->platformWindow = window;
-}
-
-/*!
- \preliminary
-
Returns the QPlatformWindow this widget will be drawn into.
*/
-QPlatformWindow *QWidget::platformWindow() const
+QWindow *QWidget::windowHandle() const
{
Q_D(const QWidget);
QTLWExtra *extra = d->maybeTopData();
- if (extra && extra->platformWindow)
- return extra->platformWindow;
+ if (extra && extra->window)
+ return extra->window;
return 0;
}
-void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format)
-{
- if (isWindow() || testAttribute(Qt::WA_NativeWindow)) {
- Q_D(QWidget);
- QTLWExtra *topData = d->topData();
- topData->platformWindowFormat = format;
- if (testAttribute(Qt::WA_WState_Created)) {
- bool wasVisible = testAttribute(Qt::WA_WState_Visible);
- destroy();
- d->create_sys(0,true,true);
- if (wasVisible)
- topData->platformWindow->setVisible(true);
- }
- }
-}
-
-QPlatformWindowFormat QWidget::platformWindowFormat() const
-{
- Q_D(const QWidget);
-
- QTLWExtra *extra = d->maybeTopData();
- if (extra){
- return extra->platformWindowFormat;
- } else {
- return QPlatformWindowFormat::defaultFormat();
- }
-}
-
void QWidgetPrivate::createSysExtra()
{
}
@@ -750,6 +699,9 @@ void QWidgetPrivate::deleteSysExtra()
void QWidgetPrivate::createTLSysExtra()
{
+ Q_Q(QWidget);
+ extra->topextra->screenIndex = 0;
+ extra->topextra->window = new QWidgetWindow(q);
}
void QWidgetPrivate::deleteTLSysExtra()
@@ -759,14 +711,13 @@ void QWidgetPrivate::deleteTLSysExtra()
//delete the qglcontext before we delete the qplatformglcontext.
//One unfortunate thing about this is that we potentially create a glContext just to
//delete it straight afterwards.
- if (extra->topextra->platformWindow) {
- if (QPlatformGLContext *context = extra->topextra->platformWindow->glContext()) {
- context->deleteQGLContext();
- }
+ if (extra->topextra->window) {
+ extra->topextra->window->destroy();
}
setWinId(0);
- delete extra->topextra->platformWindow;
- extra->topextra->platformWindow = 0;
+ //hmmm. should we delete window..
+ delete extra->topextra->window;
+ extra->topextra->window = 0;
}
}
@@ -789,7 +740,7 @@ void QWidgetPrivate::updateFrameStrut()
void QWidgetPrivate::setWindowOpacity_sys(qreal level)
{
Q_Q(QWidget);
- q->platformWindow()->setOpacity(level);
+ q->windowHandle()->setOpacity(level);
}
void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
@@ -807,11 +758,9 @@ QPaintEngine *QWidget::paintEngine() const
QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
{
- Q_Q(QWidget);
- if (q->platformWindowFormat().hasWindowSurface())
- return QApplicationPrivate::platformIntegration()->createWindowSurface(q,0);
- else
- return 0;
+ //This function should not be called.
+ Q_ASSERT(false);
+ return 0;
}
void QWidgetPrivate::setModal_sys()
@@ -868,7 +817,7 @@ void qt_qpa_set_cursor(QWidget * w, bool force)
} while (0);
foreach (QWeakPointer<QPlatformCursor> cursor, QPlatformCursorPrivate::getInstances())
if (cursor)
- cursor.data()->changeCursor(&cursorCursor, cursorWidget);
+ cursor.data()->changeCursor(&cursorCursor, cursorWidget->windowHandle());
}
#endif //QT_NO_CURSOR
diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp
deleted file mode 100644
index 86ebc04165..0000000000
--- a/src/gui/kernel/qwidget_qws.cpp
+++ /dev/null
@@ -1,1221 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcursor.h"
-#include "qapplication.h"
-#include "qapplication_p.h"
-#include "qpainter.h"
-#include "qbitmap.h"
-#include "qimage.h"
-#include "qhash.h"
-#include "qstack.h"
-#include "qlayout.h"
-#include "qtextcodec.h"
-#include "qinputcontext.h"
-#include "qdesktopwidget.h"
-
-#include "qwsdisplay_qws.h"
-#include "private/qwsdisplay_qws_p.h"
-#include "qscreen_qws.h"
-#include "qwsmanager_qws.h"
-#include <private/qwsmanager_p.h>
-#include <private/qbackingstore_p.h>
-#include <private/qwindowsurface_qws_p.h>
-#include <private/qwslock_p.h>
-#include "qpaintengine.h"
-
-#include "qdebug.h"
-
-#include "qwidget_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-extern int *qt_last_x;
-extern int *qt_last_y;
-extern WId qt_last_cursor;
-extern bool qws_overrideCursor;
-extern QWidget *qt_pressGrab;
-extern QWidget *qt_mouseGrb;
-
-static QWidget *keyboardGrb = 0;
-
-static int takeLocalId()
-{
- static int n=-1000;
- return --n;
-}
-
-class QWSServer;
-extern QWSServer *qwsServer;
-
-static inline bool isServerProcess()
-{
- return (qwsServer != 0);
-}
-
-/*****************************************************************************
- QWidget member functions
- *****************************************************************************/
-
-void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/)
-{
- Q_Q(QWidget);
- Qt::WindowType type = q->windowType();
-
- // Make sure the WindowTitleHint is on if any of the title bar hints are set
- // Note: This might be moved to cross-platform QWidgetPrivate::adjustFlags()
- if ( !(data.window_flags & Qt::CustomizeWindowHint) && (
- (data.window_flags & Qt::WindowSystemMenuHint) ||
- (data.window_flags & Qt::WindowContextHelpButtonHint) ||
- (data.window_flags & Qt::WindowMinimizeButtonHint) ||
- (data.window_flags & Qt::WindowMaximizeButtonHint) ||
- (data.window_flags & Qt::WindowCloseButtonHint) ) ) {
- data.window_flags |= Qt::WindowTitleHint;
- }
-
- // Decoration plugins on QWS don't support switching on the close button on its own
- if (data.window_flags & Qt::WindowCloseButtonHint)
- data.window_flags |= Qt::WindowSystemMenuHint;
-
- Qt::WindowFlags flags = data.window_flags;
-
- data.alloc_region_index = -1;
-
- // we don't have a "Drawer" window type
- if (type == Qt::Drawer) {
- type = Qt::Widget;
- flags &= ~Qt::WindowType_Mask;
- }
-
-
- bool topLevel = (flags & Qt::Window);
- bool popup = (type == Qt::Popup);
- bool dialog = (type == Qt::Dialog
- || type == Qt::Sheet
- || (flags & Qt::MSWindowsFixedSizeDialogHint));
- bool desktop = (type == Qt::Desktop);
- bool tool = (type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip);
-
-
-#ifndef QT_NO_WARNING_OUTPUT
- static bool toolWarningShown = false;
- if (!toolWarningShown && type == Qt::Tool && !(flags & Qt::FramelessWindowHint)) {
- qWarning("Qt for Embedded Linux " QT_VERSION_STR " does not support tool windows with frames.\n"
- "This behavior will change in a later release. To ensure compatibility with\n"
- "future versions, use (Qt::Tool | Qt::FramelessWindowHint).");
- toolWarningShown = true;
- }
-#endif
-
- WId id;
- QWSDisplay* dpy = QWidget::qwsDisplay();
-
- if (!window) // always initialize
- initializeWindow = true;
-
- // use the size of the primary screen to determine the default window size
- QList<QScreen *> screens = qt_screen->subScreens();
- if (screens.isEmpty())
- screens.append(qt_screen);
- int sw = screens[0]->width();
- int sh = screens[0]->height();
-
- if (desktop) { // desktop widget
- dialog = popup = false; // force these flags off
- data.crect.setRect(0, 0, sw, sh);
- } else if (topLevel && !q->testAttribute(Qt::WA_Resized)) {
- int width = sw / 2;
- int height = 4 * sh / 10;
- if (extra) {
- width = qMax(qMin(width, extra->maxw), extra->minw);
- height = qMax(qMin(height, extra->maxh), extra->minh);
- }
- data.crect.setSize(QSize(width, height));
- }
-
- if (window) { // override the old window
- id = window;
- setWinId(window);
- } else if (desktop) { // desktop widget
- id = (WId)-2; // id = root window
-#if 0
- QWidget *otherDesktop = q->find(id); // is there another desktop?
- if (otherDesktop && otherDesktop->testWFlags(Qt::WPaintDesktop)) {
- otherDesktop->d_func()->setWinId(0); // remove id from widget mapper
- setWinId(id); // make sure otherDesktop is
- otherDesktop->d_func()->setWinId(id); // found first
- } else
-#endif
- {
- setWinId(id);
- }
- } else {
- id = topLevel ? dpy->takeId() : takeLocalId();
- setWinId(id); // set widget id/handle + hd
- }
-
-
- bool hasFrame = true;
- if (topLevel) {
- if (desktop || popup || tool || q->testAttribute(Qt::WA_DontShowOnScreen))
- hasFrame = false;
- else
- hasFrame = !(flags & Qt::FramelessWindowHint);
- }
- if (desktop) {
- q->setAttribute(Qt::WA_WState_Visible);
- } else if (topLevel) { // set X cursor
- //QCursor *oc = QApplication::overrideCursor();
- if (initializeWindow) {
- //XXX XDefineCursor(dpy, winid, oc ? oc->handle() : cursor().handle());
- }
- QWidget::qwsDisplay()->nameRegion(q->internalWinId(), q->objectName(), q->windowTitle());
- }
-
- if (topLevel) {
- createTLExtra();
- QTLWExtra *topextra = extra->topextra;
-#ifndef QT_NO_QWS_MANAGER
- if (hasFrame) {
- // get size of wm decoration and make the old crect the new frect
- QRect cr = data.crect;
- QRegion r = QApplication::qwsDecoration().region(q, cr) | cr;
- QRect br(r.boundingRect());
- topextra->frameStrut.setCoords(cr.x() - br.x(),
- cr.y() - br.y(),
- br.right() - cr.right(),
- br.bottom() - cr.bottom());
- if (!q->testAttribute(Qt::WA_Moved) || topextra->posFromMove)
- data.crect.translate(topextra->frameStrut.left(), topextra->frameStrut.top());
- if (!topData()->qwsManager) {
- topData()->qwsManager = new QWSManager(q);
- if((q->data->window_state & ~Qt::WindowActive) == Qt::WindowMaximized)
- topData()->qwsManager->maximize();
- }
-
- } else if (topData()->qwsManager) {
- delete topData()->qwsManager;
- topData()->qwsManager = 0;
- data.crect.translate(-topextra->frameStrut.left(), -topextra->frameStrut.top());
- topextra->frameStrut.setCoords(0, 0, 0, 0);
- }
-#endif
- if (!topextra->caption.isEmpty())
- setWindowTitle_helper(topextra->caption);
-
- //XXX If we are session managed, inform the window manager about it
- } else {
- if (extra && extra->topextra) { // already allocated due to reparent?
- extra->topextra->frameStrut.setCoords(0, 0, 0, 0);
- }
- //updateRequestedRegion(mapToGlobal(QPoint(0,0)));
- }
-}
-
-
-void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
-{
- Q_D(QWidget);
- d->aboutToDestroy();
- if (!isWindow() && parentWidget())
- parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
-
- d->deactivateWidgetCleanup();
- if (testAttribute(Qt::WA_WState_Created)) {
- setAttribute(Qt::WA_WState_Created, false);
- QObjectList childObjects = children();
- for (int i = 0; i < childObjects.size(); ++i) {
- QObject *obj = childObjects.at(i);
- if (obj->isWidgetType())
- static_cast<QWidget*>(obj)->destroy(destroySubWindows,
- destroySubWindows);
- }
- releaseMouse();
- if (qt_pressGrab == this)
- qt_pressGrab = 0;
-
- if (keyboardGrb == this)
- releaseKeyboard();
- if (testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal
- QApplicationPrivate::leaveModal(this);
- else if ((windowType() == Qt::Popup))
- qApp->d_func()->closePopup(this);
-#ifndef QT_NO_IM
- if (d->ic) {
- delete d->ic;
- d->ic =0;
- } else {
- // release previous focus information participating with
- // preedit preservation of qic -- while we still have a winId
- QInputContext *qic = QApplicationPrivate::inputContext;
- if (qic)
- qic->widgetDestroyed(this);
- }
-#endif //QT_NO_IM
-
- if ((windowType() == Qt::Desktop)) {
- } else {
- if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) {
- d->hide_sys();
- }
- if (destroyWindow && isWindow()) {
- if (d->extra && d->extra->topextra && d->extra->topextra->backingStore)
- d->extra->topextra->backingStore->windowSurface->setGeometry(QRect());
- qwsDisplay()->destroyRegion(internalWinId());
- }
- }
- QT_TRY {
- d->setWinId(0);
- } QT_CATCH (const std::bad_alloc &) {
- // swallow - destructors must not throw
- }
- }
-}
-
-
-void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
-{
- Q_Q(QWidget);
- bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
- if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
- q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
-#ifndef QT_NO_CURSOR
- QCursor oldcurs;
- bool setcurs=q->testAttribute(Qt::WA_SetCursor);
- if (setcurs) {
- oldcurs = q->cursor();
- q->unsetCursor();
- }
-#endif
-
- WId old_winid = data.winid;
- if ((q->windowType() == Qt::Desktop))
- old_winid = 0;
-
- if (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_WState_Created))
- hide_sys();
-
- setWinId(0);
-
- if (parent != newparent) {
- QWidget *oldparent = q->parentWidget();
- QObjectPrivate::setParent_helper(newparent);
- if (oldparent) {
-// oldparent->d_func()->setChildrenAllocatedDirty();
-// oldparent->data->paintable_region_dirty = true;
- }
- if (newparent) {
-// newparent->d_func()->setChildrenAllocatedDirty();
-// newparent->data->paintable_region_dirty = true;
- //@@@@@@@
- }
- }
- Qt::FocusPolicy fp = q->focusPolicy();
- QSize s = q->size();
- //QBrush bgc = background(); // save colors
- bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
-
- data.window_flags = f;
- q->setAttribute(Qt::WA_WState_Created, false);
- q->setAttribute(Qt::WA_WState_Visible, false);
- q->setAttribute(Qt::WA_WState_Hidden, false);
- adjustFlags(data.window_flags, q);
- // keep compatibility with previous versions, we need to preserve the created state
- // (but we recreate the winId for the widget being reparented, again for compatibility)
- if (wasCreated || (!q->isWindow() && newparent->testAttribute(Qt::WA_WState_Created)))
- createWinId();
- if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden)
- q->setAttribute(Qt::WA_WState_Hidden);
- q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
-
- if (q->isWindow()) {
- QRect fs = frameStrut();
- data.crect = QRect(fs.left(), fs.top(), s.width(), s.height());
- if ((data.window_flags & Qt::FramelessWindowHint) && extra && extra->topextra)
- extra->topextra->frameStrut.setCoords(0, 0, 0, 0);
- } else {
- data.crect = QRect(0, 0, s.width(), s.height());
- }
-
- q->setFocusPolicy(fp);
- if (extra && !extra->mask.isEmpty()) {
- QRegion r = extra->mask;
- extra->mask = QRegion();
- q->setMask(r);
- }
- if ((int)old_winid > 0) {
- QWidget::qwsDisplay()->destroyRegion(old_winid);
- extra->topextra->backingStore->windowSurface->setGeometry(QRect());
- }
-#ifndef QT_NO_CURSOR
- if (setcurs) {
- q->setCursor(oldcurs);
- }
-#endif
-}
-
-
-QPoint QWidget::mapToGlobal(const QPoint &pos) const
-{
- int x=pos.x(), y=pos.y();
- const QWidget* w = this;
- while (w) {
- x += w->data->crect.x();
- y += w->data->crect.y();
- w = w->isWindow() ? 0 : w->parentWidget();
- }
- return QPoint(x, y);
-}
-
-QPoint QWidget::mapFromGlobal(const QPoint &pos) const
-{
- int x=pos.x(), y=pos.y();
- const QWidget* w = this;
- while (w) {
- x -= w->data->crect.x();
- y -= w->data->crect.y();
- w = w->isWindow() ? 0 : w->parentWidget();
- }
- return QPoint(x, y);
-}
-
-#if 0 // #####
-void QWidget::setMicroFocusHint(int x, int y, int width, int height,
- bool text, QFont *)
-{
- if (QRect(x, y, width, height) != microFocusHint()) {
- d->createExtra();
- d->extra->micro_focus_hint.setRect(x, y, width, height);
- }
-#ifndef QT_NO_QWS_INPUTMETHODS
- if (text) {
- QWidget *tlw = window();
- int winid = tlw->internalWinId();
- QPoint p(x, y + height);
- QPoint gp = mapToGlobal(p);
-
- QRect r = QRect(mapToGlobal(QPoint(0,0)),
- size());
-
- r.setBottom(tlw->geometry().bottom());
-
- //qDebug("QWidget::setMicroFocusHint %d %d %d %d", r.x(),
- // r.y(), r.width(), r.height());
- QInputContext::setMicroFocusWidget(this);
-
- qwsDisplay()->setIMInfo(winid, gp.x(), gp.y(), r);
-
- //send font info, ###if necessary
- qwsDisplay()->setInputFont(winid, font());
- }
-#endif
-}
-#endif
-
-void QWidgetPrivate::updateSystemBackground() {}
-
-#ifndef QT_NO_CURSOR
-void QWidgetPrivate::setCursor_sys(const QCursor &cursor)
-{
- Q_UNUSED(cursor);
- Q_Q(QWidget);
- if (q->isVisible())
- updateCursor();
-}
-
-void QWidgetPrivate::unsetCursor_sys()
-{
- Q_Q(QWidget);
- if (q->isVisible())
- updateCursor();
-}
-#endif //QT_NO_CURSOR
-
-void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
-{
- Q_Q(QWidget);
- QWidget::qwsDisplay()->setWindowCaption(q, caption);
-}
-
-void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/)
-{
-#if 0
- QTLWExtra* x = d->topData();
- delete x->icon;
- x->icon = 0;
- QBitmap mask;
- if (unscaledPixmap.isNull()) {
- } else {
- QImage unscaledIcon = unscaledPixmap.toImage();
- QPixmap pixmap =
- QPixmap::fromImage(unscaledIcon.scale(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
- x->icon = new QPixmap(pixmap);
- mask = pixmap.mask() ? *pixmap.mask() : pixmap.createHeuristicMask();
- }
-#endif
-}
-
-void QWidgetPrivate::setWindowIconText_sys(const QString &iconText)
-{
- Q_UNUSED(iconText);
-}
-
-void QWidget::grabMouse()
-{
- if (qt_mouseGrb)
- qt_mouseGrb->releaseMouse();
-
- qwsDisplay()->grabMouse(this,true);
-
- qt_mouseGrb = this;
- qt_pressGrab = 0;
-}
-
-#ifndef QT_NO_CURSOR
-void QWidget::grabMouse(const QCursor &cursor)
-{
- if (qt_mouseGrb)
- qt_mouseGrb->releaseMouse();
-
- qwsDisplay()->grabMouse(this,true);
- qwsDisplay()->selectCursor(this, cursor.handle());
- qt_mouseGrb = this;
- qt_pressGrab = 0;
-}
-#endif
-
-void QWidget::releaseMouse()
-{
- if (qt_mouseGrb == this) {
- qwsDisplay()->grabMouse(this,false);
- qt_mouseGrb = 0;
- }
-}
-
-void QWidget::grabKeyboard()
-{
- if (keyboardGrb)
- keyboardGrb->releaseKeyboard();
- qwsDisplay()->grabKeyboard(this, true);
- keyboardGrb = this;
-}
-
-void QWidget::releaseKeyboard()
-{
- if (keyboardGrb == this) {
- qwsDisplay()->grabKeyboard(this, false);
- keyboardGrb = 0;
- }
-}
-
-
-QWidget *QWidget::mouseGrabber()
-{
- if (qt_mouseGrb)
- return qt_mouseGrb;
- return qt_pressGrab;
-}
-
-
-QWidget *QWidget::keyboardGrabber()
-{
- return keyboardGrb;
-}
-
-void QWidget::activateWindow()
-{
- QWidget *tlw = window();
- if (tlw->isVisible()) {
- Q_ASSERT(tlw->testAttribute(Qt::WA_WState_Created));
- qwsDisplay()->requestFocus(tlw->internalWinId(), true);
- }
-}
-
-void QWidgetPrivate::show_sys()
-{
- Q_Q(QWidget);
- q->setAttribute(Qt::WA_Mapped);
- if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
- invalidateBuffer(q->rect());
- return;
- }
-
- if (q->isWindow()) {
-
-
- if (!q->testAttribute(Qt::WA_ShowWithoutActivating)
- && q->windowType() != Qt::Popup
- && q->windowType() != Qt::Tool
- && q->windowType() != Qt::ToolTip) {
- QWidget::qwsDisplay()->requestFocus(data.winid,true);
- }
-
-
- if (QWindowSurface *surface = q->windowSurface()) {
- const QRect frameRect = q->frameGeometry();
- if (surface->geometry() != frameRect)
- surface->setGeometry(frameRect);
- }
-
- QRegion r = localRequestedRegion();
-#ifndef QT_NO_QWS_MANAGER
- if (extra && extra->topextra && extra->topextra->qwsManager) {
- r.translate(data.crect.topLeft());
- r += extra->topextra->qwsManager->region();
- r.translate(-data.crect.topLeft());
- }
-#endif
- data.fstrut_dirty = true;
- invalidateBuffer(r);
- bool staysontop =
- (q->windowFlags() & Qt::WindowStaysOnTopHint)
- || q->windowType() == Qt::Popup;
- if (!staysontop && q->parentWidget()) { // if our parent stays on top, so must we
- QWidget *ptl = q->parentWidget()->window();
- if (ptl && (ptl->windowFlags() & Qt::WindowStaysOnTopHint))
- staysontop = true;
- }
-
- QWSChangeAltitudeCommand::Altitude altitude;
- altitude = staysontop ? QWSChangeAltitudeCommand::StaysOnTop : QWSChangeAltitudeCommand::Raise;
- QWidget::qwsDisplay()->setAltitude(data.winid, altitude, true);
- if (!q->objectName().isEmpty()) {
- QWidget::qwsDisplay()->setWindowCaption(q, q->windowTitle());
- }
- }
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- else if ( extra && extra->topextra && extra->topextra->windowSurface) {
- QWSWindowSurface *surface;
- surface = static_cast<QWSWindowSurface*>(q->windowSurface());
- const QPoint p = q->mapToGlobal(QPoint());
- surface->setGeometry(QRect(p, q->size()));
- }
-#endif
-
- if (!q->window()->data->in_show) {
- invalidateBuffer(q->rect());
- }
-}
-
-
-void QWidgetPrivate::hide_sys()
-{
- Q_Q(QWidget);
- deactivateWidgetCleanup();
-
- if (q->isWindow()) {
- q->releaseMouse();
-// requestWindowRegion(QRegion());
-
- if (extra->topextra->backingStore)
- extra->topextra->backingStore->releaseBuffer();
-
-
- QWidget::qwsDisplay()->requestFocus(data.winid,false);
- } else {
- QWidget *p = q->parentWidget();
- if (p &&p->isVisible()) {
- invalidateBuffer(q->rect());
- }
- }
-}
-
-
-
-static Qt::WindowStates effectiveState(Qt::WindowStates state)
- {
- if (state & Qt::WindowMinimized)
- return Qt::WindowMinimized;
- else if (state & Qt::WindowFullScreen)
- return Qt::WindowFullScreen;
- else if (state & Qt::WindowMaximized)
- return Qt::WindowMaximized;
- return Qt::WindowNoState;
- }
-
-void QWidgetPrivate::setMaxWindowState_helper()
-{
- // in_set_window_state is usually set in setWindowState(), but this
- // function is used in other functions as well
- // (e.g QApplicationPrivate::setMaxWindowRect())
- const uint old_state = data.in_set_window_state;
- data.in_set_window_state = 1;
-
-#ifndef QT_NO_QWS_MANAGER
- if (extra && extra->topextra && extra->topextra->qwsManager)
- extra->topextra->qwsManager->maximize();
- else
-#endif
- {
- Q_Q(QWidget);
- const QDesktopWidget *desktop = QApplication::desktop();
- const int screen = desktop->screenNumber(q);
- const QRect maxWindowRect = desktop->availableGeometry(screen);
- q->setGeometry(maxWindowRect);
- }
- data.in_set_window_state = old_state;
-}
-
-void QWidgetPrivate::setFullScreenSize_helper()
-{
- Q_Q(QWidget);
-
- const uint old_state = data.in_set_window_state;
- data.in_set_window_state = 1;
-
- const QRect screen = qApp->desktop()->screenGeometry(qApp->desktop()->screenNumber(q));
- q->move(screen.topLeft());
- q->resize(screen.size());
-
- data.in_set_window_state = old_state;
-}
-
-void QWidget::setWindowState(Qt::WindowStates newstate)
-{
- Q_D(QWidget);
- Qt::WindowStates oldstate = windowState();
- if (oldstate == newstate)
- return;
- if (isWindow() && !testAttribute(Qt::WA_WState_Created))
- create();
-
- data->window_state = newstate;
- data->in_set_window_state = 1;
- bool needShow = false;
- Qt::WindowStates newEffectiveState = effectiveState(newstate);
- Qt::WindowStates oldEffectiveState = effectiveState(oldstate);
- if (isWindow() && newEffectiveState != oldEffectiveState) {
- d->createTLExtra();
- if (oldEffectiveState == Qt::WindowNoState) { //normal
- d->topData()->normalGeometry = geometry();
- } else if (oldEffectiveState == Qt::WindowFullScreen) {
- setParent(0, d->topData()->savedFlags);
- needShow = true;
- } else if (oldEffectiveState == Qt::WindowMinimized) {
- needShow = true;
- }
-
- if (newEffectiveState == Qt::WindowMinimized) {
- //### not ideal...
- hide();
- needShow = false;
- } else if (newEffectiveState == Qt::WindowFullScreen) {
- d->topData()->savedFlags = windowFlags();
- setParent(0, Qt::FramelessWindowHint | (windowFlags() & Qt::WindowStaysOnTopHint));
- d->setFullScreenSize_helper();
- raise();
- needShow = true;
- } else if (newEffectiveState == Qt::WindowMaximized) {
- createWinId();
- d->setMaxWindowState_helper();
- } else { //normal
- QRect r = d->topData()->normalGeometry;
- if (r.width() >= 0) {
- d->topData()->normalGeometry = QRect(0,0,-1,-1);
- setGeometry(r);
- }
- }
- }
- data->in_set_window_state = 0;
-
- if (needShow)
- show();
-
- if (newstate & Qt::WindowActive)
- activateWindow();
-
- QWindowStateChangeEvent e(oldstate);
- QApplication::sendEvent(this, &e);
-}
-
-void QWidgetPrivate::setFocus_sys()
-{
-
-}
-
-void QWidgetPrivate::raise_sys()
-{
- Q_Q(QWidget);
- //@@@ transaction
- if (q->isWindow()) {
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QWidget::qwsDisplay()->setAltitude(q->internalWinId(),
- QWSChangeAltitudeCommand::Raise);
- // XXX: subsurfaces?
-#ifdef QT_NO_WINDOWGROUPHINT
-#else
- QObjectList childObjects = q->children();
- if (!childObjects.isEmpty()) {
- QWidgetList toraise;
- for (int i = 0; i < childObjects.size(); ++i) {
- QObject *obj = childObjects.at(i);
- if (obj->isWidgetType()) {
- QWidget* w = static_cast<QWidget*>(obj);
- if (w->isWindow())
- toraise.append(w);
- }
- }
-
- for (int i = 0; i < toraise.size(); ++i) {
- QWidget *w = toraise.at(i);
- if (w->isVisible())
- w->raise();
- }
- }
-#endif // QT_NO_WINDOWGROUPHINT
- }
-}
-
-void QWidgetPrivate::lower_sys()
-{
- Q_Q(QWidget);
- if (q->isWindow()) {
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QWidget::qwsDisplay()->setAltitude(data.winid,
- QWSChangeAltitudeCommand::Lower);
- } else if (QWidget *p = q->parentWidget()) {
- setDirtyOpaqueRegion();
- p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
- }
-}
-
-void QWidgetPrivate::stackUnder_sys(QWidget*)
-{
- Q_Q(QWidget);
- if (QWidget *p = q->parentWidget()) {
- setDirtyOpaqueRegion();
- p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
- }
-}
-
-void QWidgetPrivate::moveSurface(QWindowSurface *surface, const QPoint &offset)
-{
- QWSWindowSurface *s = static_cast<QWSWindowSurface*>(surface);
- if (!s->move(offset))
- s->invalidateBuffer();
-
- QWSDisplay::instance()->moveRegion(s->winId(), offset.x(), offset.y());
-}
-
-void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
-{
- Q_Q(QWidget);
- if (extra) { // any size restrictions?
- w = qMin(w,extra->maxw);
- h = qMin(h,extra->maxh);
- w = qMax(w,extra->minw);
- h = qMax(h,extra->minh);
- }
-
- QPoint oldp = q->geometry().topLeft();
- QSize olds = q->size();
- QRect r(x, y, w, h);
-
- bool isResize = olds != r.size();
- isMove = oldp != r.topLeft(); //### why do we have isMove as a parameter?
-
- // We only care about stuff that changes the geometry, or may
- // cause the window manager to change its state
- if (r.size() == olds && oldp == r.topLeft())
- return;
-
- if (!data.in_set_window_state) {
- q->data->window_state &= ~Qt::WindowMaximized;
- q->data->window_state &= ~Qt::WindowFullScreen;
- if (q->isWindow())
- topData()->normalGeometry = QRect(0, 0, -1, -1);
- }
- QPoint oldPos = q->pos();
- data.crect = r;
-
- if ((q->windowType() == Qt::Desktop))
- return;
-
- if (q->isVisible()) {
-
- bool toplevelMove = false;
- QWSWindowSurface *surface = 0;
-
- if (q->isWindow()) {
- //### ConfigPending not implemented, do we need it?
- //setAttribute(Qt::WA_WState_ConfigPending);
- const QWidgetBackingStore *bs = maybeBackingStore();
- if (bs)
- surface = static_cast<QWSWindowSurface*>(bs->windowSurface);
- if (isMove && !isResize && surface) {
- const QPoint offset(x - oldp.x(), y - oldp.y());
- moveSurface(surface, offset);
- toplevelMove = true; //server moves window, but we must send moveEvent, which might trigger painting
-
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- QList<QWindowSurface*> surfaces = bs->subSurfaces;
- for (int i = 0; i < surfaces.size(); ++i)
- moveSurface(surfaces.at(i), offset);
-#endif
- } else {
- updateFrameStrut();
- }
- }
-
- if (!toplevelMove) {
- if (q->isWindow()) {
- if (surface)
- surface->setGeometry(q->frameGeometry());
- else
- invalidateBuffer(q->rect()); //###
-
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- // XXX: should not resize subsurfaces. Children within a layout
- // will be resized automatically while children with a static
- // geometry should get a new clip region instead.
- const QRect clipRect = q->geometry();
- QWidgetBackingStore *bs = maybeBackingStore();
- QList<QWindowSurface*> surfaces = bs->subSurfaces;
- for (int i = 0; i < surfaces.size(); ++i) {
- QWSWindowSurface *s = static_cast<QWSWindowSurface*>(surfaces.at(i));
- QRect srect = s->geometry();
- s->setGeometry(clipRect & srect);
- }
-#endif
- }
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- // XXX: merge this case with the isWindow() case
- else if (maybeTopData() && maybeTopData()->windowSurface) {
- QWSWindowSurface *surface;
- surface = static_cast<QWSWindowSurface*>(q->windowSurface());
- if (isMove && !isResize) {
- moveSurface(surface, QPoint(x - oldp.x(), y - oldp.y()));
- } else {
- const QPoint p = q->mapToGlobal(QPoint());
- surface->setGeometry(QRect(p, QSize(w, h)));
- }
- }
-#endif
- else {
- if (isMove && !isResize)
- moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y());
- else
- invalidateBuffer_resizeHelper(oldPos, olds);
- }
- }
-
- //### must have frame geometry correct before sending move/resize events
- if (isMove) {
- QMoveEvent e(q->pos(), oldPos);
- QApplication::sendEvent(q, &e);
- }
- if (isResize) {
- QResizeEvent e(r.size(), olds);
- QApplication::sendEvent(q, &e);
- }
-
- } else { // not visible
- if (isMove && q->pos() != oldPos)
- q->setAttribute(Qt::WA_PendingMoveEvent, true);
- if (isResize)
- q->setAttribute(Qt::WA_PendingResizeEvent, true);
- }
-}
-
-void QWidgetPrivate::setConstraints_sys()
-{
-}
-
-QScreen* QWidgetPrivate::getScreen() const
-{
- Q_Q(const QWidget);
-
- const QList<QScreen*> subScreens = qt_screen->subScreens();
- if (subScreens.isEmpty() || q->windowType() == Qt::Desktop)
- return qt_screen;
-
- const int screen = QApplication::desktop()->screenNumber(q);
-
- return qt_screen->subScreens().at(screen < 0 ? 0 : screen);
-}
-
-void QWidgetPrivate::scroll_sys(int dx, int dy)
-{
- Q_Q(QWidget);
- scrollChildren(dx, dy);
- scrollRect(q->rect(), dx, dy);
-}
-
-void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
-{
- scrollRect(r, dx, dy);
-}
-
-int QWidget::metric(PaintDeviceMetric m) const
-{
- Q_D(const QWidget);
-
- int val;
- if (m == PdmWidth) {
- val = data->crect.width();
- } else if (m == PdmWidthMM) {
- const QScreen *screen = d->getScreen();
- val = data->crect.width() * screen->physicalWidth() / screen->width();
- } else if (m == PdmHeight) {
- val = data->crect.height();
- } else if (m == PdmHeightMM) {
- const QScreen *screen = d->getScreen();
- val = data->crect.height() * screen->physicalHeight() / screen->height();
- } else if (m == PdmDepth) {
- return qwsDisplay()->depth();
- } else if (m == PdmDpiX || m == PdmPhysicalDpiX) {
- if (d->extra && d->extra->customDpiX)
- return d->extra->customDpiX;
- else if (d->parent)
- return static_cast<QWidget *>(d->parent)->metric(m);
- const QScreen *screen = d->getScreen();
- return qRound(screen->width() / double(screen->physicalWidth() / 25.4));
- } else if (m == PdmDpiY || m == PdmPhysicalDpiY) {
- if (d->extra && d->extra->customDpiY)
- return d->extra->customDpiY;
- else if (d->parent)
- return static_cast<QWidget *>(d->parent)->metric(m);
- const QScreen *screen = d->getScreen();
- return qRound(screen->height() / double(screen->physicalHeight() / 25.4));
- } else if (m == PdmNumColors) {
- QScreen *screen = d->getScreen();
- int ret = screen->colorCount();
- if (!ret) {
- const int depth = qwsDisplay()->depth();
- switch (depth) {
- case 1:
- ret = 2;
- break;
- case 8:
- ret = 256;
- break;
- case 16:
- ret = 65536;
- break;
- case 24:
- ret = 16777216;
- break;
- case 32:
- ret = 2147483647;
- break;
- }
- }
- return ret;
- } else {
- val = QPaintDevice::metric(m);// XXX
- }
- return val;
-}
-
-void QWidgetPrivate::createSysExtra()
-{
-}
-
-void QWidgetPrivate::deleteSysExtra()
-{
-}
-
-void QWidgetPrivate::createTLSysExtra()
-{
-#ifndef QT_NO_QWS_MANAGER
- extra->topextra->qwsManager = 0;
-#endif
-}
-
-void QWidgetPrivate::deleteTLSysExtra()
-{
-}
-
-void QWidgetPrivate::registerDropSite(bool on)
-{
- Q_UNUSED(on);
-}
-
-QRegion QWidgetPrivate::localRequestedRegion() const
-{
- Q_Q(const QWidget);
- QRegion r(q->rect());
- if (extra && !extra->mask.isEmpty())
- r &= extra->mask;
-
- return r;
-}
-
-QRegion QWidgetPrivate::localAllocatedRegion() const
-{
- Q_Q(const QWidget);
-
- QWidgetBackingStore *wbs = q->window()->d_func()->maybeBackingStore();
-
- QWindowSurface *ws = wbs ? wbs->windowSurface : 0;
- if (!ws)
- return QRegion();
- QRegion r = static_cast<QWSWindowSurface*>(ws)->clipRegion();
- if (!q->isWindow()) {
- QPoint off = q->mapTo(q->window(), QPoint());
- r &= localRequestedRegion().translated(off);
- r.translate(-off);
- }
- return r;
-}
-
-inline bool QRect::intersects(const QRect &r) const
-{
- return (qMax(x1, r.x1) <= qMin(x2, r.x2) &&
- qMax(y1, r.y1) <= qMin(y2, r.y2));
-}
-
-void QWidgetPrivate::setMask_sys(const QRegion &region)
-{
- Q_UNUSED(region);
- Q_Q(QWidget);
-
- if (!q->isVisible() || !q->isWindow())
- return;
-
- data.fstrut_dirty = true;
- invalidateBuffer(q->rect());
- QWindowSurface *surface = extra->topextra->backingStore->windowSurface;
- if (surface) {
- // QWSWindowSurface::setGeometry() returns without doing anything
- // if old geom == new geom. Therefore, we need to reset the old value.
- surface->QWindowSurface::setGeometry(QRect());
- surface->setGeometry(q->frameGeometry());
- }
-}
-
-void QWidgetPrivate::updateFrameStrut()
-{
- Q_Q(QWidget);
-
- if(!q->isVisible() || (q->windowType() == Qt::Desktop)) {
- data.fstrut_dirty = q->isVisible();
- return;
- }
-
-#ifndef QT_NO_QWS_MANAGER
- if (extra && extra->topextra && extra->topextra->qwsManager) {
- QTLWExtra *topextra = extra->topextra;
- const QRect oldFrameStrut = topextra->frameStrut;
- const QRect contents = data.crect;
- QRegion r = localRequestedRegion().translated(contents.topLeft());
- r += extra->topextra->qwsManager->region();
- const QRect frame = r.boundingRect();
-
- topextra->frameStrut.setCoords(contents.left() - frame.left(),
- contents.top() - frame.top(),
- frame.right() - contents.right(),
- frame.bottom() - contents.bottom());
- topextra->qwsManager->repaintRegion(QDecoration::All, QDecoration::Normal);
- }
-#endif
- data.fstrut_dirty = false;
-}
-
-#ifndef QT_NO_CURSOR
-void QWidgetPrivate::updateCursor() const
-{
- Q_Q(const QWidget);
-
- if (QApplication::overrideCursor())
- return;
-
- if (qt_last_x
- && (!QWidget::mouseGrabber() || QWidget::mouseGrabber() == q)
- && qt_last_cursor != (WId)q->cursor().handle())
- {
- const QPoint pos(*qt_last_x, *qt_last_y);
- const QPoint offset = q->mapToGlobal(QPoint());
- if (!localAllocatedRegion().contains(pos - offset))
- return;
-
- const QWidget *w = q->childAt(q->mapFromGlobal(pos));
- if (!w || w->cursor().handle() == q->cursor().handle())
- QWidget::qwsDisplay()->selectCursor(const_cast<QWidget*>(q),
- q->cursor().handle());
- }
-}
-#endif
-
-void QWidgetPrivate::setWindowOpacity_sys(qreal level)
-{
- Q_Q(QWidget);
- Q_UNUSED(level);
- createWinId();
- QWidget::qwsDisplay()->setOpacity(q->data->winid, topData()->opacity);
-}
-
-//static QSingleCleanupHandler<QWSPaintEngine> qt_paintengine_cleanup_handler;
-//static QWSPaintEngine *qt_widget_paintengine = 0;
-QPaintEngine *QWidget::paintEngine() const
-{
- qWarning("QWidget::paintEngine: Should no longer be called");
- return 0; //##### @@@
-// if (!qt_widget_paintengine) {
-// qt_widget_paintengine = new QRasterPaintEngine();
-// qt_paintengine_cleanup_handler.set(&qt_widget_paintengine);
-// }
-// if (qt_widget_paintengine->isActive()) {
-// if (d->extraPaintEngine)
-// return d->extraPaintEngine;
-// const_cast<QWidget *>(this)->d_func()->extraPaintEngine = new QRasterPaintEngine();
-// return d->extraPaintEngine;
-// }
-// return qt_widget_paintengine;
-}
-
-QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
-{
- Q_Q(QWidget);
- if (q->windowType() == Qt::Desktop)
- return 0;
- q->ensurePolished();
- return qt_screen->createSurface(q);
-}
-
-void QWidgetPrivate::setModal_sys()
-{
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidgetwindow_qpa.cpp b/src/gui/kernel/qwidgetwindow_qpa.cpp
new file mode 100644
index 0000000000..a58a03774e
--- /dev/null
+++ b/src/gui/kernel/qwidgetwindow_qpa.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetwindow_qpa_p.h"
+
+#include "private/qwidget_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QWidgetWindow::QWidgetWindow(QWidget *widget)
+ : m_widget(widget)
+{
+}
+
+bool QWidgetWindow::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::Close:
+ handleCloseEvent(static_cast<QCloseEvent *>(event));
+ return true;
+
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ handleKeyEvent(static_cast<QKeyEvent *>(event));
+ return true;
+
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseButtonDblClick:
+ handleMouseEvent(static_cast<QMouseEvent *>(event));
+ return true;
+
+ case QEvent::Move:
+ handleMoveEvent(static_cast<QMoveEvent *>(event));
+ return true;
+
+ case QEvent::Resize:
+ handleResizeEvent(static_cast<QResizeEvent *>(event));
+ return true;
+
+ case QEvent::Wheel:
+ handleWheelEvent(static_cast<QWheelEvent *>(event));
+ return true;
+
+ default:
+ break;
+ }
+
+ return m_widget->event(event) || QWindow::event(event);
+}
+
+void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
+{
+ // which child should have it?
+ QWidget *widget = m_implicit_mouse_grabber ? m_implicit_mouse_grabber.data() : m_widget->childAt(event->pos());
+
+ // TODO: make sure mouse release is delivered to same widget that got the press event
+
+ if (!widget)
+ widget = m_widget;
+
+ if (event->type() == QEvent::MouseButtonPress && !m_implicit_mouse_grabber)
+ m_implicit_mouse_grabber = widget;
+
+ if (event->buttons() == Qt::NoButton)
+ m_implicit_mouse_grabber.clear();
+
+ QPoint mapped = widget->mapFrom(m_widget, event->pos());
+
+ QMouseEvent translated(event->type(), mapped, event->globalPos(), event->button(), event->buttons(), event->modifiers());
+ QGuiApplication::sendSpontaneousEvent(widget, &translated);
+}
+
+void QWidgetWindow::handleKeyEvent(QKeyEvent *event)
+{
+ QWidget *widget = m_widget->focusWidget();
+
+ if (!widget)
+ widget = m_widget;
+
+ QGuiApplication::sendSpontaneousEvent(widget, event);
+}
+
+void QWidgetWindow::handleMoveEvent(QMoveEvent *event)
+{
+ m_widget->data->crect = geometry();
+ QGuiApplication::sendSpontaneousEvent(m_widget, event);
+}
+
+void QWidgetWindow::handleResizeEvent(QResizeEvent *event)
+{
+ m_widget->data->crect = geometry();
+ QGuiApplication::sendSpontaneousEvent(m_widget, event);
+}
+
+void QWidgetWindow::handleCloseEvent(QCloseEvent *)
+{
+ m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
+}
+
+void QWidgetWindow::handleWheelEvent(QWheelEvent *event)
+{
+ // which child should have it?
+ QWidget *widget = m_widget->childAt(event->pos());
+
+ if (!widget)
+ widget = m_widget;
+
+ QPoint mapped = widget->mapFrom(m_widget, event->pos());
+
+ QWheelEvent translated(mapped, event->globalPos(), event->delta(), event->buttons(), event->modifiers(), event->orientation());
+ QGuiApplication::sendSpontaneousEvent(widget, &translated);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/embedded/qwsembedwidget.h b/src/gui/kernel/qwidgetwindow_qpa_p.h
index 50237a6963..7a3ff46e65 100644
--- a/src/gui/embedded/qwsembedwidget.h
+++ b/src/gui/kernel/qwidgetwindow_qpa_p.h
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#ifndef QWSEMBEDWIDGET_H
-#define QWSEMBEDWIDGET_H
+#ifndef QWIDGETWINDOW_QPA_P_H
+#define QWIDGETWINDOW_QPA_P_H
-#include <QtGui/qwidget.h>
+#include <QtGui/qwindow.h>
-#ifndef QT_NO_QWSEMBEDWIDGET
+#include <QtCore/private/qobject_p.h>
QT_BEGIN_HEADER
@@ -52,31 +52,31 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-class QWSEmbedWidgetPrivate;
-
-class Q_GUI_EXPORT QWSEmbedWidget : public QWidget
+class QWidgetWindow : public QWindow
{
Q_OBJECT
-
public:
- QWSEmbedWidget(WId winId, QWidget *parent = 0);
- ~QWSEmbedWidget();
+ QWidgetWindow(QWidget *widget);
+
+ QWidget *widget() const { return m_widget; }
protected:
- bool eventFilter(QObject *object, QEvent *event);
- void changeEvent(QEvent *event);
- void resizeEvent(QResizeEvent *event);
- void moveEvent(QMoveEvent *event);
- void hideEvent(QHideEvent *event);
- void showEvent(QShowEvent *event);
+ bool event(QEvent *);
+
+ void handleCloseEvent(QCloseEvent *);
+ void handleKeyEvent(QKeyEvent *);
+ void handleMouseEvent(QMouseEvent *);
+ void handleMoveEvent(QMoveEvent *);
+ void handleResizeEvent(QResizeEvent *);
+ void handleWheelEvent(QWheelEvent *);
private:
- Q_DECLARE_PRIVATE(QWSEmbedWidget)
+ QWidget *m_widget;
+ QWeakPointer<QWidget> m_implicit_mouse_grabber;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QT_NO_QWSEMBEDWIDGET
-#endif // QWSEMBEDWIDGET_H
+#endif // QWIDGETWINDOW_QPA_P_H
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
new file mode 100644
index 0000000000..92b62e9276
--- /dev/null
+++ b/src/gui/kernel/qwindow.cpp
@@ -0,0 +1,458 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwindow.h"
+
+#include "qplatformwindow_qpa.h"
+#include "qwindowformat_qpa.h"
+#include "qplatformglcontext_qpa.h"
+#include "qwindowcontext_qpa.h"
+
+#include "qwindow_p.h"
+#include "qapplication_p.h"
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QWindow::QWindow(QWindow *parent)
+ : QObject(*new QWindowPrivate())
+{
+ if (parent) {
+ setParent(parent);
+ }
+}
+
+QWindow::~QWindow()
+{
+ destroy();
+}
+
+void QWindow::setVisible(bool visible)
+{
+ Q_D(QWindow);
+ if (!d->platformWindow) {
+ create();
+ }
+ d->platformWindow->setVisible(visible);
+}
+
+bool QWindow::visible() const
+{
+ Q_D(const QWindow);
+
+ return d->visible;
+}
+
+void QWindow::create()
+{
+ Q_D(QWindow);
+ if (!d->platformWindow) {
+ d->platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(this);
+ d->windowFlags = d->platformWindow->setWindowFlags(d->windowFlags);
+ if (!d->windowTitle.isNull())
+ d->platformWindow->setWindowTitle(d->windowTitle);
+ }
+ Q_ASSERT(d->platformWindow);
+
+ QObjectList childObjects = children();
+ for (int i = 0; i < childObjects.size(); i ++) {
+ QObject *object = childObjects.at(i);
+ if(object->isWindowType()) {
+ QWindow *window = static_cast<QWindow *>(object);
+ window->setParent(this);
+ }
+ }
+}
+
+WId QWindow::winId() const
+{
+ Q_D(const QWindow);
+ if(!d->platformWindow)
+ const_cast<QWindow *>(this)->create();
+ return d->platformWindow->winId();
+}
+
+/**
+ Sets the parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the parent window.
+ Setting parent to be 0(NULL) means map it as a top level window. If the parent window has grabbed its window system resources, then the current window will also grab its window system resources.
+ **/
+
+void QWindow::setParent(QWindow *parent)
+{
+ Q_D(QWindow);
+
+ if (d->parent == parent)
+ return;
+
+ QObject::setParent(parent);
+
+ if (parent) {
+ if (parent->d_func()->platformWindow) {
+ if(!d->platformWindow) {
+ create();
+ }
+ d->platformWindow->setParent(parent->d_func()->platformWindow);
+ d->parent = parent;
+ }
+ } else {
+ d->parent = 0;
+ if (d->parentWindow) {
+ d->platformWindow->setParent(0);
+ }
+ }
+
+}
+
+void QWindow::setWindowFormat(const QWindowFormat &format)
+{
+ Q_D(QWindow);
+ d->requestedFormat = format;
+}
+
+QWindowFormat QWindow::requestedWindowFormat() const
+{
+ Q_D(const QWindow);
+ return d->requestedFormat;
+}
+
+QWindowFormat QWindow::actualWindowFormat() const
+{
+ return glContext()->handle()->windowFormat();
+}
+
+void QWindow::setSurfaceType(SurfaceType type)
+{
+ Q_D(QWindow);
+ d->surfaceType = type;
+}
+
+QWindow::SurfaceType QWindow::surfaceType() const
+{
+ Q_D(const QWindow);
+ return d->surfaceType;
+}
+
+void QWindow::setWindowFlags(Qt::WindowFlags flags)
+{
+ Q_D(QWindow);
+ if (d->platformWindow)
+ d->windowFlags = d->platformWindow->setWindowFlags(flags);
+ else
+ d->windowFlags = flags;
+}
+
+Qt::WindowFlags QWindow::windowFlags() const
+{
+ Q_D(const QWindow);
+ return d->windowFlags;
+}
+
+void QWindow::setWindowTitle(const QString &title)
+{
+ Q_D(QWindow);
+ d->windowTitle = title;
+ if (d->platformWindow) {
+ d->platformWindow->setWindowTitle(title);
+ }
+}
+
+QString QWindow::windowTitle() const
+{
+ Q_D(const QWindow);
+ return d->windowTitle;
+}
+
+void QWindow::raise()
+{
+ Q_D(QWindow);
+ if (d->platformWindow) {
+ d->platformWindow->raise();
+ }
+}
+
+void QWindow::lower()
+{
+ Q_D(QWindow);
+ if (d->platformWindow) {
+ d->platformWindow->lower();
+ }
+}
+
+void QWindow::setOpacity(qreal level)
+{
+ Q_D(QWindow);
+ if (d->platformWindow) {
+ d->platformWindow->setOpacity(level);
+ }
+}
+
+void QWindow::requestActivateWindow()
+{
+ Q_D(QWindow);
+ if (d->platformWindow) {
+ d->platformWindow->requestActivateWindow();
+ }
+}
+
+Qt::WindowStates QWindow::windowState() const
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+ return Qt::WindowNoState;
+}
+
+void QWindow::setWindowState(Qt::WindowStates state)
+{
+ Q_UNUSED(state);
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+QSize QWindow::minimumSize() const
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+ return QSize();
+}
+
+QSize QWindow::maximumSize() const
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+ return QSize();
+}
+
+void QWindow::setMinimumSize(const QSize &size) const
+{
+ Q_UNUSED(size);
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+void QWindow::setMaximumSize(const QSize &size) const
+{
+ Q_UNUSED(size);
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+void QWindow::setGeometry(const QRect &rect)
+{
+ Q_D(QWindow);
+ d->geometry = rect;
+ if (d->platformWindow) {
+ d->platformWindow->setGeometry(rect);
+ }
+}
+
+QRect QWindow::geometry() const
+{
+ Q_D(const QWindow);
+ return d->geometry;
+}
+
+void QWindow::setWindowIcon(const QImage &icon) const
+{
+ Q_UNUSED(icon);
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+QWindowContext * QWindow::glContext() const
+{
+ Q_D(const QWindow);
+ if (d->platformWindow && !d->glContext)
+ const_cast<QWindowPrivate *>(d)->glContext = new QWindowContext(const_cast<QWindow *>(this));
+ return d->glContext;
+}
+
+void QWindow::setRequestFormat(const QWindowFormat &format)
+{
+ Q_D(QWindow);
+ d->requestedFormat = format;
+}
+
+QWindowFormat QWindow::format() const
+{
+ return QWindowFormat();
+}
+
+void QWindow::destroy()
+{
+ Q_D(QWindow);
+ if (d->glContext) {
+ d->glContext->deleteQGLContext();
+ }
+ delete d->glContext;
+ d->glContext = 0;
+ delete d->platformWindow;
+ d->platformWindow = 0;
+}
+
+QPlatformWindow *QWindow::handle() const
+{
+ Q_D(const QWindow);
+ return d->platformWindow;
+}
+
+QWindowSurface *QWindow::surface() const
+{
+ Q_D(const QWindow);
+ return d->surface;
+}
+
+void QWindow::showMinimized()
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+void QWindow::showMaximized()
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+void QWindow::showFullScreen()
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+void QWindow::showNormal()
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+bool QWindow::close()
+{
+ //should we have close?
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+ return true;
+}
+
+void QWindow::resizeEvent(QResizeEvent *)
+{
+}
+
+void QWindow::showEvent(QShowEvent *)
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+void QWindow::hideEvent(QHideEvent *)
+{
+ qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+}
+
+bool QWindow::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::MouseMove:
+ mouseMoveEvent(static_cast<QMouseEvent*>(event));
+ break;
+
+ case QEvent::MouseButtonPress:
+ mousePressEvent(static_cast<QMouseEvent*>(event));
+ break;
+
+ case QEvent::MouseButtonRelease:
+ mouseReleaseEvent(static_cast<QMouseEvent*>(event));
+ break;
+
+ case QEvent::MouseButtonDblClick:
+ mouseDoubleClickEvent(static_cast<QMouseEvent*>(event));
+ break;
+
+ case QEvent::Resize:
+ resizeEvent(static_cast<QResizeEvent*>(event));
+ break;
+
+ case QEvent::KeyPress:
+ keyPressEvent(static_cast<QKeyEvent *>(event));
+ break;
+
+ case QEvent::KeyRelease:
+ keyReleaseEvent(static_cast<QKeyEvent *>(event));
+ break;
+
+#ifndef QT_NO_WHEELEVENT
+ case QEvent::Wheel:
+ wheelEvent(static_cast<QWheelEvent*>(event));
+ break;
+#endif
+
+ case QEvent::Close:
+ destroy();
+ break;
+
+ default:
+ return QObject::event(event);
+ }
+ return true;
+}
+
+void QWindow::keyPressEvent(QKeyEvent *)
+{
+}
+
+void QWindow::keyReleaseEvent(QKeyEvent *)
+{
+}
+
+void QWindow::inputMethodEvent(QInputMethodEvent *)
+{
+}
+
+void QWindow::mousePressEvent(QMouseEvent *)
+{
+}
+
+void QWindow::mouseReleaseEvent(QMouseEvent *)
+{
+}
+
+void QWindow::mouseDoubleClickEvent(QMouseEvent *)
+{
+}
+
+void QWindow::mouseMoveEvent(QMouseEvent *)
+{
+}
+
+#ifndef QT_NO_WHEELEVENT
+void QWindow::wheelEvent(QWheelEvent *)
+{
+}
+#endif //QT_NO_WHEELEVENT
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
new file mode 100644
index 0000000000..f2fde2d532
--- /dev/null
+++ b/src/gui/kernel/qwindow.h
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOW_QPA_H
+#define QWINDOW_QPA_H
+
+#include <QtCore/QObject>
+#include <QtCore/QEvent>
+#include <QtGui/qwindowformat_qpa.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QWindowPrivate;
+
+class QResizeEvent;
+class QShowEvent;
+class QHideEvent;
+class QKeyEvent;
+class QInputMethodEvent;
+class QMouseEvent;
+#ifndef QT_NO_WHEELEVENT
+class QWheelEvent;
+#endif
+
+class QPlatformWindow;
+class QWindowContext;
+class QWindowSurface;
+
+class Q_GUI_EXPORT QWindow : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWindow)
+
+ Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
+
+public:
+ enum SurfaceType {
+ RasterSurface,
+ OpenGLSurface
+ };
+
+ QWindow(QWindow *parent = 0);
+ virtual ~QWindow();
+
+ void setVisible(bool visible);
+ bool visible() const;
+
+ void create();
+
+ WId winId() const;
+
+ QWindow *parent() const;
+ void setParent(QWindow *parent);
+
+ QWindow *topLevelWindow() const;
+
+ void setWindowFormat(const QWindowFormat &format);
+ QWindowFormat requestedWindowFormat() const;
+ QWindowFormat actualWindowFormat() const;
+
+ void setSurfaceType(SurfaceType type);
+ SurfaceType surfaceType() const;
+
+ void setWindowFlags(Qt::WindowFlags flags);
+ Qt::WindowFlags windowFlags() const;
+
+ QString windowTitle() const;
+
+ void setOpacity(qreal level);
+ void requestActivateWindow();
+
+ Qt::WindowStates windowState() const;
+ void setWindowState(Qt::WindowStates state);
+
+ QSize minimumSize() const;
+ QSize maximumSize() const;
+
+ void setMinimumSize(const QSize &size) const;
+ void setMaximumSize(const QSize &size) const;
+
+ void setGeometry(const QRect &rect);
+ QRect geometry() const;
+
+ void setWindowIcon(const QImage &icon) const;
+
+ QWindowContext *glContext() const;
+
+ void setRequestFormat(const QWindowFormat &format);
+ QWindowFormat format() const;
+
+ void destroy();
+
+ QPlatformWindow *handle() const;
+ QWindowSurface *surface() const;
+
+public Q_SLOTS:
+ inline void show() { setVisible(true); }
+ inline void hide() { setVisible(false); }
+
+ void showMinimized();
+ void showMaximized();
+ void showFullScreen();
+ void showNormal();
+
+ bool close();
+ void raise();
+ void lower();
+
+ void setWindowTitle(const QString &);
+
+Q_SIGNALS:
+ void backBufferReady();
+
+protected:
+ virtual void resizeEvent(QResizeEvent *);
+
+ virtual void showEvent(QShowEvent *);
+ virtual void hideEvent(QHideEvent *);
+
+ virtual bool event(QEvent *);
+ virtual void keyPressEvent(QKeyEvent *);
+ virtual void keyReleaseEvent(QKeyEvent *);
+ virtual void inputMethodEvent(QInputMethodEvent *);
+ virtual void mousePressEvent(QMouseEvent *);
+ virtual void mouseReleaseEvent(QMouseEvent *);
+ virtual void mouseDoubleClickEvent(QMouseEvent *);
+ virtual void mouseMoveEvent(QMouseEvent *);
+#ifndef QT_NO_WHEELEVENT
+ virtual void wheelEvent(QWheelEvent *);
+#endif
+
+private:
+ Q_DISABLE_COPY(QWindow)
+
+ friend class QGuiApplication;
+ friend class QGuiApplicationPrivate;
+ friend class QWindowSurface;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QWINDOW_QPA_H
diff --git a/src/gui/embedded/qdecorationstyled_qws.h b/src/gui/kernel/qwindow_p.h
index ed697c0cd2..304ab3bc49 100644
--- a/src/gui/embedded/qdecorationstyled_qws.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -39,10 +39,12 @@
**
****************************************************************************/
-#ifndef QDECORATIONSTYLED_QWS_H
-#define QDECORATIONSTYLED_QWS_H
+#ifndef QWINDOW_QPA_P_H
+#define QWINDOW_QPA_P_H
-#include <QtGui/qdecorationdefault_qws.h>
+#include <QtGui/qwindow.h>
+
+#include <QtCore/private/qobject_p.h>
QT_BEGIN_HEADER
@@ -50,24 +52,40 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#if !defined(QT_NO_QWS_DECORATION_STYLED) || defined(QT_PLUGIN)
-
-class Q_GUI_EXPORT QDecorationStyled : public QDecorationDefault
+class QWindowPrivate : public QObjectPrivate
{
public:
- QDecorationStyled();
- virtual ~QDecorationStyled();
+ QWindowPrivate()
+ : QObjectPrivate()
+ , windowFlags(Qt::Window)
+ , surfaceType(QWindow::RasterSurface)
+ , platformWindow(0)
+ , visible(false)
+ , glContext(0)
+ , surface(0)
+ {
+ isWindow = true;
+ }
+
+ ~QWindowPrivate()
+ {
+ }
- QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All);
- bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All,
- DecorationState state = Normal);
- int titleBarHeight(const QWidget *widget);
+ Qt::WindowFlags windowFlags;
+ QWindow::SurfaceType surfaceType;
+ QWindow *parentWindow;
+ QPlatformWindow *platformWindow;
+ bool visible;
+ QWindowFormat requestedFormat;
+ QString windowTitle;
+ QRect geometry;
+ QWindowContext *glContext;
+ QWindowSurface *surface;
};
-#endif // QT_NO_QWS_DECORATION_STYLED
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QDECORATIONSTYLED_QWS_H
+#endif // QWINDOW_QPA_P_H
diff --git a/src/gui/kernel/qwindowcontext_qpa.cpp b/src/gui/kernel/qwindowcontext_qpa.cpp
new file mode 100644
index 0000000000..f121e846b2
--- /dev/null
+++ b/src/gui/kernel/qwindowcontext_qpa.cpp
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplatformglcontext_qpa.h"
+#include "qwindowcontext_qpa.h"
+#include "qwindow.h"
+
+#include <QtCore/QThreadStorage>
+#include <QtCore/QThread>
+
+#include <QDebug>
+
+class QWindowThreadContext
+{
+public:
+ ~QWindowThreadContext() {
+ if (context)
+ context->doneCurrent();
+ }
+ QWindowContext *context;
+};
+
+static QThreadStorage<QWindowThreadContext *> qwindow_context_storage;
+
+class QWindowContextPrivate
+{
+public:
+ QWindowContextPrivate()
+ :qGLContextHandle(0)
+ {
+ }
+
+ virtual ~QWindowContextPrivate()
+ {
+ //do not delete the QGLContext handle here as it is deleted in
+ //QWidgetPrivate::deleteTLSysExtra()
+ }
+ void *qGLContextHandle;
+ void (*qGLContextDeleteFunction)(void *handle);
+ QPlatformGLContext *platformGLContext;
+ static QWindowContext *staticSharedContext;
+
+ static void setCurrentContext(QWindowContext *context);
+};
+
+QWindowContext *QWindowContextPrivate::staticSharedContext = 0;
+
+void QWindowContextPrivate::setCurrentContext(QWindowContext *context)
+{
+ QWindowThreadContext *threadContext = qwindow_context_storage.localData();
+ if (!threadContext) {
+ if (!QThread::currentThread()) {
+ qWarning("No QTLS available. currentContext wont work");
+ return;
+ }
+ threadContext = new QWindowThreadContext;
+ qwindow_context_storage.setLocalData(threadContext);
+ }
+ threadContext->context = context;
+}
+
+/*!
+ Returns the last context which called makeCurrent. This function is thread aware.
+*/
+QWindowContext* QWindowContext::currentContext()
+{
+ QWindowThreadContext *threadContext = qwindow_context_storage.localData();
+ if(threadContext) {
+ return threadContext->context;
+ }
+ return 0;
+}
+
+QPlatformGLContext *QWindowContext::handle() const
+{
+ Q_D(const QWindowContext);
+ return d->platformGLContext;
+}
+
+/*!
+ All subclasses needs to specify the platformWindow. It can be a null window.
+*/
+QWindowContext::QWindowContext(QWindow *window)
+ :d_ptr(new QWindowContextPrivate())
+{
+ Q_D(QWindowContext);
+ Q_ASSERT(window);
+ if (!window->handle())
+ window->create();
+ d->platformGLContext = window->handle()->glContext();
+}
+
+/*!
+ If this is the current context for the thread, doneCurrent is called
+*/
+QWindowContext::~QWindowContext()
+{
+ if (QWindowContext::currentContext() == this) {
+ doneCurrent();
+ }
+
+}
+
+/*!
+ Reimplement in subclass to do makeCurrent on native GL context
+*/
+void QWindowContext::makeCurrent()
+{
+ Q_D(QWindowContext);
+ QWindowContextPrivate::setCurrentContext(this);
+ d->platformGLContext->makeCurrent();
+}
+
+/*!
+ Reimplement in subclass to release current context.
+ Typically this is calling makeCurrent with 0 "surface"
+*/
+void QWindowContext::doneCurrent()
+{
+ Q_D(QWindowContext);
+ d->platformGLContext->doneCurrent();
+ QWindowContextPrivate::setCurrentContext(0);
+}
+
+void QWindowContext::swapBuffers()
+{
+ Q_D(QWindowContext);
+ d->platformGLContext->swapBuffers();
+}
+
+void (*QWindowContext::getProcAddress(const QByteArray &procName)) ()
+{
+ Q_D(QWindowContext);
+ void *result = d->platformGLContext->getProcAddress(QString::fromAscii(procName.constData()));
+ return (void (*)())result;
+}
+
+/*
+ internal: Needs to have a pointer to qGLContext. But since this is in QtGui we cant
+ have any type information.
+*/
+void *QWindowContext::qGLContextHandle() const
+{
+ Q_D(const QWindowContext);
+ return d->qGLContextHandle;
+}
+
+void QWindowContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *))
+{
+ Q_D(QWindowContext);
+ d->qGLContextHandle = handle;
+ d->qGLContextDeleteFunction = qGLContextDeleteFunction;
+}
+
+void QWindowContext::deleteQGLContext()
+{
+ Q_D(QWindowContext);
+ if (d->qGLContextDeleteFunction && d->qGLContextHandle) {
+ d->qGLContextDeleteFunction(d->qGLContextHandle);
+ d->qGLContextDeleteFunction = 0;
+ d->qGLContextHandle = 0;
+ }
+}
diff --git a/src/opengl/qglwindowsurface_qws_p.h b/src/gui/kernel/qwindowcontext_qpa.h
index 41d77e8e2d..c16666a7f4 100644
--- a/src/opengl/qglwindowsurface_qws_p.h
+++ b/src/gui/kernel/qwindowcontext_qpa.h
@@ -39,52 +39,52 @@
**
****************************************************************************/
-#ifndef QGLWINDOWSURFACE_QWS_P_H
-#define QGLWINDOWSURFACE_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QWSGLWindowSurface class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-#include <QPaintDevice>
-#include "private/qwindowsurface_qws_p.h"
+#ifndef QWINDOWCONTEXT_H
+#define QWINDOWCONTEXT_H
+
+#include <QtCore/qnamespace.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QPaintDevice;
-class QPoint;
-class QRegion;
-class QSize;
-class QWidget;
-class QGLContext;
+QT_MODULE(Gui)
-class QWSGLWindowSurfacePrivate;
+class QWindowContextPrivate;
+class QPlatformGLContext;
-class Q_OPENGL_EXPORT QWSGLWindowSurface : public QWSWindowSurface
+class Q_GUI_EXPORT QWindowContext
{
- Q_DECLARE_PRIVATE(QWSGLWindowSurface)
-
+Q_DECLARE_PRIVATE(QWindowContext);
public:
- QWSGLWindowSurface(QWidget *widget);
- QWSGLWindowSurface();
- ~QWSGLWindowSurface();
+ ~QWindowContext();
+
+ void makeCurrent();
+ void doneCurrent();
+ void swapBuffers();
+ void (*getProcAddress(const QByteArray &procName)) ();
+
+ static QWindowContext *currentContext();
- QGLContext *context() const;
- void setContext(QGLContext *context);
+ QPlatformGLContext *handle() const;
private:
- QWSGLWindowSurfacePrivate *d_ptr;
-};
+ QWindowContext(QWindow *window);
+
+ QScopedPointer<QWindowContextPrivate> d_ptr;
+ //hack to make it work with QGLContext::CurrentContext
+ friend class QGLContext;
+ friend class QWidgetPrivate;
+ friend class QWindow;
+ void *qGLContextHandle() const;
+ void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *));
+ void deleteQGLContext();
+ Q_DISABLE_COPY(QWindowContext);
+};
QT_END_NAMESPACE
-#endif // QGLWINDOWSURFACE_QWS_P_H
+QT_END_HEADER
+
+#endif // QWINDOWCONTEXT_H
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index ab8af5fbb2..dd6d13a338 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -57,9 +57,6 @@ class QWidget;
class QDialog;
class QColor;
class QPalette;
-#ifdef QT3_SUPPORT
-class QColorGroup;
-#endif
class QCursor;
class QPoint;
class QSize;
diff --git a/src/gui/kernel/qwindowformat_qpa.cpp b/src/gui/kernel/qwindowformat_qpa.cpp
new file mode 100644
index 0000000000..03ccba7b07
--- /dev/null
+++ b/src/gui/kernel/qwindowformat_qpa.cpp
@@ -0,0 +1,406 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwindowformat_qpa.h"
+
+#include "qplatformglcontext_qpa.h"
+
+#include <QtCore/QDebug>
+
+class QWindowFormatPrivate
+{
+public:
+ QWindowFormatPrivate()
+ : ref(1)
+ , opts(QWindowFormat::DoubleBuffer | QWindowFormat::WindowSurface)
+ , redBufferSize(-1)
+ , greenBufferSize(-1)
+ , blueBufferSize(-1)
+ , alphaBufferSize(-1)
+ , depthSize(-1)
+ , stencilSize(-1)
+ , swapBehavior(QWindowFormat::DefaultSwapBehavior)
+ , numSamples(-1)
+ , sharedContext(0)
+ {
+ }
+
+ QWindowFormatPrivate(const QWindowFormatPrivate *other)
+ : ref(1),
+ opts(other->opts),
+ redBufferSize(other->redBufferSize),
+ greenBufferSize(other->greenBufferSize),
+ blueBufferSize(other->blueBufferSize),
+ alphaBufferSize(other->alphaBufferSize),
+ depthSize(other->depthSize),
+ stencilSize(other->stencilSize),
+ swapBehavior(other->swapBehavior),
+ numSamples(other->numSamples),
+ sharedContext(other->sharedContext)
+ {
+ }
+ QAtomicInt ref;
+ QWindowFormat::FormatOptions opts;
+ int redBufferSize;
+ int greenBufferSize;
+ int blueBufferSize;
+ int alphaBufferSize;
+ int depthSize;
+ int stencilSize;
+ QWindowFormat::SwapBehavior swapBehavior;
+ int numSamples;
+ QWindowContext *sharedContext;
+};
+
+QWindowFormat::QWindowFormat()
+{
+ d = new QWindowFormatPrivate;
+}
+
+QWindowFormat::QWindowFormat(QWindowFormat::FormatOptions options)
+{
+ d = new QWindowFormatPrivate;
+ d->opts = options;
+}
+
+/*!
+ \internal
+*/
+void QWindowFormat::detach()
+{
+ if (d->ref != 1) {
+ QWindowFormatPrivate *newd = new QWindowFormatPrivate(d);
+ if (!d->ref.deref())
+ delete d;
+ d = newd;
+ }
+}
+
+/*!
+ Constructs a copy of \a other.
+*/
+
+QWindowFormat::QWindowFormat(const QWindowFormat &other)
+{
+ d = other.d;
+ d->ref.ref();
+}
+
+/*!
+ Assigns \a other to this object.
+*/
+
+QWindowFormat &QWindowFormat::operator=(const QWindowFormat &other)
+{
+ if (d != other.d) {
+ other.d->ref.ref();
+ if (!d->ref.deref())
+ delete d;
+ d = other.d;
+ }
+ return *this;
+}
+
+/*!
+ Destroys the QWindowFormat.
+*/
+QWindowFormat::~QWindowFormat()
+{
+ if (!d->ref.deref())
+ delete d;
+}
+
+/*!
+ \fn bool QWindowFormat::stereo() const
+
+ Returns true if stereo buffering is enabled; otherwise returns
+ false. Stereo buffering is disabled by default.
+
+ \sa setStereo()
+*/
+
+/*!
+ If \a enable is true enables stereo buffering; otherwise disables
+ stereo buffering.
+
+ Stereo buffering is disabled by default.
+
+ Stereo buffering provides extra color buffers to generate left-eye
+ and right-eye images.
+
+ \sa stereo()
+*/
+
+void QWindowFormat::setStereo(bool enable)
+{
+ if (enable) {
+ d->opts |= QWindowFormat::StereoBuffers;
+ } else {
+ d->opts &= ~QWindowFormat::StereoBuffers;
+ }
+}
+
+/*!
+ Returns the number of samples per pixel when multisampling is
+ enabled. By default, the highest number of samples that is
+ available is used.
+
+ \sa setSampleBuffers(), sampleBuffers(), setSamples()
+*/
+int QWindowFormat::samples() const
+{
+ return d->numSamples;
+}
+
+/*!
+ Set the preferred number of samples per pixel when multisampling
+ is enabled to \a numSamples. By default, the highest number of
+ samples available is used.
+
+ \sa setSampleBuffers(), sampleBuffers(), samples()
+*/
+void QWindowFormat::setSamples(int numSamples)
+{
+ detach();
+ d->numSamples = numSamples;
+}
+
+
+
+void QWindowFormat::setSharedContext(QWindowContext *context)
+{
+ d->sharedContext = context;
+}
+
+QWindowContext *QWindowFormat::sharedContext() const
+{
+ return d->sharedContext;
+}
+
+/*!
+ \fn bool QWindowFormat::hasWindowSurface() const
+
+ Returns true if the corresponding widget has an instance of QWindowSurface.
+
+ Otherwise returns false.
+
+ WindowSurface is enabled by default.
+
+ \sa setOverlay()
+*/
+
+void QWindowFormat::setWindowSurface(bool enable)
+{
+ if (enable) {
+ d->opts |= QWindowFormat::WindowSurface;
+ } else {
+ d->opts &= ~QWindowFormat::WindowSurface;
+ }
+}
+
+/*!
+ Sets the format option to \a opt.
+
+ \sa testOption()
+*/
+
+void QWindowFormat::setOption(QWindowFormat::FormatOptions opt)
+{
+ detach();
+ d->opts |= opt;
+}
+
+/*!
+ Returns true if format option \a opt is set; otherwise returns false.
+
+ \sa setOption()
+*/
+
+bool QWindowFormat::testOption(QWindowFormat::FormatOptions opt) const
+{
+ return d->opts & opt;
+}
+
+/*!
+ Set the minimum depth buffer size to \a size.
+
+ \sa depthBufferSize(), setDepth(), depth()
+*/
+void QWindowFormat::setDepthBufferSize(int size)
+{
+ detach();
+ d->depthSize = size;
+}
+
+/*!
+ Returns the depth buffer size.
+
+ \sa depth(), setDepth(), setDepthBufferSize()
+*/
+int QWindowFormat::depthBufferSize() const
+{
+ return d->depthSize;
+}
+
+void QWindowFormat::setSwapBehavior(SwapBehavior behavior)
+{
+ d->swapBehavior = behavior;
+}
+
+QWindowFormat::SwapBehavior QWindowFormat::swapBehavior() const
+{
+ return d->swapBehavior;
+}
+
+bool QWindowFormat::hasAlpha() const
+{
+ return d->alphaBufferSize > 0;
+}
+
+/*!
+ Set the preferred stencil buffer size to \a size.
+
+ \sa stencilBufferSize(), setStencil(), stencil()
+*/
+void QWindowFormat::setStencilBufferSize(int size)
+{
+ detach();
+ d->stencilSize = size;
+}
+
+/*!
+ Returns the stencil buffer size.
+
+ \sa stencil(), setStencil(), setStencilBufferSize()
+*/
+int QWindowFormat::stencilBufferSize() const
+{
+ return d->stencilSize;
+}
+
+int QWindowFormat::redBufferSize() const
+{
+ return d->redBufferSize;
+}
+
+int QWindowFormat::greenBufferSize() const
+{
+ return d->greenBufferSize;
+}
+
+int QWindowFormat::blueBufferSize() const
+{
+ return d->blueBufferSize;
+}
+
+int QWindowFormat::alphaBufferSize() const
+{
+ return d->alphaBufferSize;
+}
+
+void QWindowFormat::setRedBufferSize(int size)
+{
+ d->redBufferSize = size;
+}
+
+void QWindowFormat::setGreenBufferSize(int size)
+{
+ d->greenBufferSize = size;
+}
+
+void QWindowFormat::setBlueBufferSize(int size)
+{
+ d->blueBufferSize = size;
+}
+
+void QWindowFormat::setAlphaBufferSize(int size)
+{
+ d->alphaBufferSize = size;
+}
+
+bool operator==(const QWindowFormat& a, const QWindowFormat& b)
+{
+ return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts
+ && a.d->stencilSize == b.d->stencilSize
+ && a.d->redBufferSize == b.d->redBufferSize
+ && a.d->greenBufferSize == b.d->greenBufferSize
+ && a.d->blueBufferSize == b.d->blueBufferSize
+ && a.d->alphaBufferSize == b.d->alphaBufferSize
+ && a.d->depthSize == b.d->depthSize
+ && a.d->numSamples == b.d->numSamples
+ && a.d->swapBehavior == b.d->swapBehavior
+ && a.d->sharedContext == b.d->sharedContext);
+}
+
+
+/*!
+ Returns false if all the options of the two QWindowFormat objects
+ \a a and \a b are equal; otherwise returns true.
+
+ \relates QWindowFormat
+*/
+
+bool operator!=(const QWindowFormat& a, const QWindowFormat& b)
+{
+ return !(a == b);
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QWindowFormat &f)
+{
+ const QWindowFormatPrivate * const d = f.d;
+
+ dbg.nospace() << "QWindowFormat("
+ << "options " << d->opts
+ << ", depthBufferSize " << d->depthSize
+ << ", redBufferSize " << d->redBufferSize
+ << ", greenBufferSize " << d->greenBufferSize
+ << ", blueBufferSize " << d->blueBufferSize
+ << ", alphaBufferSize " << d->alphaBufferSize
+ << ", stencilBufferSize " << d->stencilSize
+ << ", samples " << d->numSamples
+ << ", swapBehavior " << d->swapBehavior
+ << ", sharedContext " << d->sharedContext
+ << ')';
+
+ return dbg.space();
+}
+#endif
diff --git a/src/gui/kernel/qwindowformat_qpa.h b/src/gui/kernel/qwindowformat_qpa.h
new file mode 100644
index 0000000000..9bc2ccdfaa
--- /dev/null
+++ b/src/gui/kernel/qwindowformat_qpa.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QPLATFORMWINDOWFORMAT_QPA_H
+#define QPLATFORMWINDOWFORMAT_QPA_H
+
+#include <QtGui/QPlatformWindow>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QWindowContext;
+class QWindowFormatPrivate;
+
+class Q_GUI_EXPORT QWindowFormat
+{
+public:
+ enum FormatOption {
+ StereoBuffers = 0x0001,
+ WindowSurface = 0x0002
+ };
+ Q_DECLARE_FLAGS(FormatOptions, FormatOption)
+
+ enum SwapBehavior {
+ DefaultSwapBehavior,
+ SingleBuffer,
+ DoubleBuffer,
+ TripleBuffer
+ };
+
+ enum OpenGLContextProfile {
+ NoProfile,
+ CoreProfile,
+ CompatibilityProfile
+ };
+
+ QWindowFormat();
+ QWindowFormat(FormatOptions options);
+ QWindowFormat(const QWindowFormat &other);
+ QWindowFormat &operator=(const QWindowFormat &other);
+ ~QWindowFormat();
+
+ void setDepthBufferSize(int size);
+ int depthBufferSize() const;
+
+ void setStencilBufferSize(int size);
+ int stencilBufferSize() const;
+
+ void setRedBufferSize(int size);
+ int redBufferSize() const;
+ void setGreenBufferSize(int size);
+ int greenBufferSize() const;
+ void setBlueBufferSize(int size);
+ int blueBufferSize() const;
+ void setAlphaBufferSize(int size);
+ int alphaBufferSize() const;
+
+ void setSamples(int numSamples);
+ int samples() const;
+
+ void setSwapBehavior(SwapBehavior behavior);
+ SwapBehavior swapBehavior() const;
+
+ bool hasAlpha() const;
+
+ void setProfile(OpenGLContextProfile profile);
+ OpenGLContextProfile profile() const;
+
+ void setSharedContext(QWindowContext *context);
+ QWindowContext *sharedContext() const;
+
+ bool stereo() const;
+ void setStereo(bool enable);
+ bool windowSurface() const;
+ void setWindowSurface(bool enable);
+
+ void setOption(QWindowFormat::FormatOptions opt);
+ bool testOption(QWindowFormat::FormatOptions opt) const;
+
+private:
+ QWindowFormatPrivate *d;
+
+ void detach();
+
+ friend Q_GUI_EXPORT bool operator==(const QWindowFormat&, const QWindowFormat&);
+ friend Q_GUI_EXPORT bool operator!=(const QWindowFormat&, const QWindowFormat&);
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QWindowFormat &);
+#endif
+};
+
+Q_GUI_EXPORT bool operator==(const QWindowFormat&, const QWindowFormat&);
+Q_GUI_EXPORT bool operator!=(const QWindowFormat&, const QWindowFormat&);
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QWindowFormat &);
+#endif
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowFormat::FormatOptions)
+
+inline bool QWindowFormat::stereo() const
+{
+ return testOption(QWindowFormat::StereoBuffers);
+}
+
+inline bool QWindowFormat::windowSurface() const
+{
+ return testOption(QWindowFormat::WindowSurface);
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif //QPLATFORMWINDOWFORMAT_QPA_H
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 740bb82ccc..fd143c3ab8 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -56,51 +56,37 @@ QTime QWindowSystemInterfacePrivate::eventTime;
QList<QWindowSystemInterfacePrivate::WindowSystemEvent *> QWindowSystemInterfacePrivate::windowSystemEventQueue;
QMutex QWindowSystemInterfacePrivate::queueMutex;
-extern QPointer<QWidget> qt_last_mouse_receiver;
+extern QPointer<QWindow> qt_last_mouse_receiver;
-void QWindowSystemInterface::handleEnterEvent(QWidget *tlw)
+void QWindowSystemInterface::handleEnterEvent(QWindow *tlw)
{
if (tlw) {
- QWidgetData *data = qt_qwidget_data(tlw);
- if (data->in_destructor)
- return;
-
QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
}
-void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw)
+void QWindowSystemInterface::handleLeaveEvent(QWindow *tlw)
{
- if (tlw) {
- QWidgetData *data = qt_qwidget_data(tlw);
- if (data->in_destructor)
- return;
- }
QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleWindowActivated(QWidget *tlw)
+void QWindowSystemInterface::handleWindowActivated(QWindow *tlw)
{
QWindowSystemInterfacePrivate::ActivatedWindowEvent *e = new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect)
+void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect)
{
- if (tlw) {
- QWidgetData *data = qt_qwidget_data(tlw);
- if (data->in_destructor)
- return;
- }
QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleCloseEvent(QWidget *tlw)
+void QWindowSystemInterface::handleCloseEvent(QWindow *tlw)
{
if (tlw) {
QWindowSystemInterfacePrivate::CloseEvent *e =
@@ -115,42 +101,31 @@ void QWindowSystemInterface::handleCloseEvent(QWidget *tlw)
*/
-void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) {
+void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleMouseEvent(w, time, local, global, b);
}
-void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+void QWindowSystemInterface::handleMouseEvent(QWindow *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
{
- if (tlw) {
- QWidgetData *data = qt_qwidget_data(tlw);
- if (data->in_destructor)
- tlw = 0;
- }
QWindowSystemInterfacePrivate::MouseEvent * e =
new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
+void QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleKeyEvent(w, time, t, k, mods, text, autorep, count);
}
-void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
+void QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
- if (tlw) {
- QWidgetData *data = qt_qwidget_data(tlw);
- if (data->in_destructor)
- tlw = 0;
- }
-
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
+void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text, bool autorep,
@@ -161,38 +136,26 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *w, QEvent::Type typ
text, autorep, count);
}
-void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, int key,
+void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, int key,
Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text, bool autorep,
ushort count)
{
- if (tlw) {
- QWidgetData *data = qt_qwidget_data(tlw);
- if (data->in_destructor)
- tlw = 0;
- }
-
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,
nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) {
+void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleWheelEvent(w, time, local, global, d, o);
}
-void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
{
- if (tlw) {
- QWidgetData *data = qt_qwidget_data(tlw);
- if (data->in_destructor)
- tlw = 0;
- }
-
QWindowSystemInterfacePrivate::WheelEvent *e =
new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
@@ -229,12 +192,12 @@ void QWindowSystemInterfacePrivate::queueWindowSystemEvent(QWindowSystemInterfac
dispatcher->wakeUp();
}
-void QWindowSystemInterface::handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points) {
+void QWindowSystemInterface::handleTouchEvent(QWindow *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTouchEvent(w, time, type, devType, points);
}
-void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points)
+void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points)
{
if (!points.size()) // Touch events must have at least one point
return;
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index a882fc15b6..bd8139933c 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -44,7 +44,7 @@
#include <QtCore/QTime>
#include <QtGui/qwindowdefs.h>
#include <QtCore/QEvent>
-#include <QtGui/QWidget>
+#include <QtGui/QWindow>
#include <QtCore/QWeakPointer>
#include <QtCore/QMutex>
#include <QtGui/QTouchEvent>
@@ -58,25 +58,25 @@ QT_MODULE(Gui)
class Q_GUI_EXPORT QWindowSystemInterface
{
public:
- static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
- static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
+ static void handleMouseEvent(QWindow *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
+ static void handleMouseEvent(QWindow *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b);
- static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
- static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
+ static void handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
+ static void handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
- static void handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
+ static void handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
ushort count = 1);
- static void handleExtendedKeyEvent(QWidget *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
+ static void handleExtendedKeyEvent(QWindow *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
ushort count = 1);
- static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
- static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
+ static void handleWheelEvent(QWindow *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
+ static void handleWheelEvent(QWindow *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o);
struct TouchPoint {
int id; // for application use
@@ -87,14 +87,14 @@ public:
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
};
- static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
- static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
+ static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
+ static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points);
- static void handleGeometryChange(QWidget *w, const QRect &newRect);
- static void handleCloseEvent(QWidget *w);
- static void handleEnterEvent(QWidget *w);
- static void handleLeaveEvent(QWidget *w);
- static void handleWindowActivated(QWidget *w);
+ static void handleGeometryChange(QWindow *w, const QRect &newRect);
+ static void handleCloseEvent(QWindow *w);
+ static void handleEnterEvent(QWindow *w);
+ static void handleLeaveEvent(QWindow *w);
+ static void handleWindowActivated(QWindow *w);
// Changes to the screen
static void handleScreenGeometryChange(int screenIndex);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 6be86ad9a5..30adecc405 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -73,55 +73,55 @@ public:
class CloseEvent : public WindowSystemEvent {
public:
- CloseEvent(QWidget *tlw)
- : WindowSystemEvent(Close), topLevel(tlw) { }
- QWeakPointer<QWidget> topLevel;
+ CloseEvent(QWindow *w)
+ : WindowSystemEvent(Close), window(w) { }
+ QWeakPointer<QWindow> window;
};
class GeometryChangeEvent : public WindowSystemEvent {
public:
- GeometryChangeEvent(QWidget *tlw, const QRect &newGeometry)
+ GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry)
: WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry)
{ }
- QWeakPointer<QWidget> tlw;
+ QWeakPointer<QWindow> tlw;
QRect newGeometry;
};
class EnterEvent : public WindowSystemEvent {
public:
- EnterEvent(QWidget *enter)
+ EnterEvent(QWindow *enter)
: WindowSystemEvent(Enter), enter(enter)
{ }
- QWeakPointer<QWidget> enter;
+ QWeakPointer<QWindow> enter;
};
class LeaveEvent : public WindowSystemEvent {
public:
- LeaveEvent(QWidget *leave)
+ LeaveEvent(QWindow *leave)
: WindowSystemEvent(Leave), leave(leave)
{ }
- QWeakPointer<QWidget> leave;
+ QWeakPointer<QWindow> leave;
};
class ActivatedWindowEvent : public WindowSystemEvent {
public:
- ActivatedWindowEvent(QWidget *activatedWindow)
+ ActivatedWindowEvent(QWindow *activatedWindow)
: WindowSystemEvent(ActivatedWindow), activated(activatedWindow)
{ }
- QWeakPointer<QWidget> activated;
+ QWeakPointer<QWindow> activated;
};
class UserEvent : public WindowSystemEvent {
public:
- UserEvent(QWidget * w, ulong time, EventType t)
- : WindowSystemEvent(t), widget(w), timestamp(time) { }
- QWeakPointer<QWidget> widget;
+ UserEvent(QWindow * w, ulong time, EventType t)
+ : WindowSystemEvent(t), window(w), timestamp(time) { }
+ QWeakPointer<QWindow> window;
unsigned long timestamp;
};
class MouseEvent : public UserEvent {
public:
- MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
+ MouseEvent(QWindow * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b)
: UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { }
QPoint localPos;
QPoint globalPos;
@@ -130,7 +130,7 @@ public:
class WheelEvent : public UserEvent {
public:
- WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
+ WheelEvent(QWindow *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o)
: UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { }
int delta;
QPoint localPos;
@@ -140,11 +140,11 @@ public:
class KeyEvent : public UserEvent {
public:
- KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
+ KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
:UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep),
repeatCount(count), modifiers(mods), keyType(t),
nativeScanCode(0), nativeVirtualKey(0), nativeModifiers(0) { }
- KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods,
+ KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods,
quint32 nativeSC, quint32 nativeVK, quint32 nativeMods,
const QString & text = QString(), bool autorep = false, ushort count = 1)
:UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep),
@@ -163,7 +163,7 @@ public:
class TouchEvent : public UserEvent {
public:
- TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList<QTouchEvent::TouchPoint> &p)
+ TouchEvent(QWindow *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList<QTouchEvent::TouchPoint> &p)
:UserEvent(w, time, Touch), devType(d), points(p), touchType(t) { }
QTouchEvent::DeviceType devType;
QList<QTouchEvent::TouchPoint> points;
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 65e7af4742..a05c99a610 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -8,7 +8,6 @@ HEADERS += \
painting/qcolormap.h \
painting/qdrawutil.h \
painting/qemulationpaintengine_p.h \
- painting/qgraphicssystem_p.h \
painting/qmatrix.h \
painting/qmemrotate_p.h \
painting/qoutlinemapper_p.h \
@@ -29,8 +28,6 @@ HEADERS += \
painting/qpolygon.h \
painting/qpolygonclipper_p.h \
painting/qprintengine.h \
- painting/qprintengine_pdf_p.h \
- painting/qprintengine_ps_p.h \
painting/qprinter.h \
painting/qprinter_p.h \
painting/qprinterinfo.h \
@@ -43,7 +40,6 @@ HEADERS += \
painting/qtextureglyphcache_p.h \
painting/qtransform.h \
painting/qwindowsurface_p.h \
- painting/qwmatrix.h \
painting/qpaintbuffer_p.h
@@ -56,7 +52,6 @@ SOURCES += \
painting/qcssutil.cpp \
painting/qdrawutil.cpp \
painting/qemulationpaintengine.cpp \
- painting/qgraphicssystem.cpp \
painting/qmatrix.cpp \
painting/qmemrotate.cpp \
painting/qoutlinemapper.cpp \
@@ -72,7 +67,6 @@ SOURCES += \
painting/qpen.cpp \
painting/qpolygon.cpp \
painting/qprintengine_pdf.cpp \
- painting/qprintengine_ps.cpp \
painting/qprinter.cpp \
painting/qprinterinfo.cpp \
painting/qrasterizer.cpp \
@@ -114,28 +108,6 @@ win32 {
!win32-borland:!wince*:LIBS += -lmsimg32
}
-embedded {
- HEADERS += \
- painting/qgraphicssystem_qws_p.h \
-
- SOURCES += \
- painting/qgraphicssystem_qws.cpp \
-
-} else: if(!qpa) {
- HEADERS += \
- painting/qgraphicssystem_raster_p.h \
- painting/qgraphicssystem_runtime_p.h \
- painting/qgraphicssystemfactory_p.h \
- painting/qgraphicssystemplugin_p.h \
- painting/qwindowsurface_raster_p.h
-
- SOURCES += \
- painting/qgraphicssystem_raster.cpp \
- painting/qgraphicssystem_runtime.cpp \
- painting/qgraphicssystemfactory.cpp \
- painting/qgraphicssystemplugin.cpp \
- painting/qwindowsurface_raster.cpp
-}
unix:x11 {
HEADERS += \
@@ -147,17 +119,15 @@ unix:x11 {
painting/qpaintengine_x11.cpp
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
HEADERS += \
painting/qpaintengine_mac_p.h \
- painting/qgraphicssystem_mac_p.h \
painting/qprintengine_mac_p.h
SOURCES += \
painting/qcolormap_mac.cpp \
painting/qpaintdevice_mac.cpp \
painting/qpaintengine_mac.cpp \
- painting/qgraphicssystem_mac.cpp \
painting/qprinterinfo_mac.cpp
OBJECTIVE_SOURCES += \
painting/qprintengine_mac.mm \
@@ -170,23 +140,11 @@ unix:!mac:!symbian|qpa {
painting/qprinterinfo_unix.cpp
}
-win32|x11|mac|embedded|qpa|symbian {
+win32|x11|mac|qpa|symbian {
SOURCES += painting/qbackingstore.cpp
HEADERS += painting/qbackingstore_p.h
}
-embedded {
- contains(QT_CONFIG,qtopia) {
- DEFINES += QTOPIA_PRINTENGINE
- HEADERS += painting/qprintengine_qws_p.h
- SOURCES += painting/qprintengine_qws.cpp
- }
-
- SOURCES += \
- painting/qcolormap_qws.cpp \
- painting/qpaintdevice_qws.cpp
-}
-
qpa {
SOURCES += \
painting/qcolormap_qpa.cpp \
@@ -203,7 +161,7 @@ symbian {
painting/qpaintengine_s60_p.h
}
-x11|embedded|qpa {
+x11|qpa {
contains(QT_CONFIG,qtopia) {
DEFINES += QT_NO_CUPS QT_NO_LPR
} else {
@@ -228,29 +186,8 @@ if(mmx|3dnow|sse|sse2|iwmmxt) {
IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp
}
-x11 {
- HEADERS += painting/qwindowsurface_x11_p.h
- SOURCES += painting/qwindowsurface_x11.cpp
-}
-
-!embedded:!qpa:mac {
- HEADERS += painting/qwindowsurface_mac_p.h \
- painting/qunifiedtoolbarsurface_mac_p.h
- SOURCES += painting/qwindowsurface_mac.cpp \
- painting/qunifiedtoolbarsurface_mac.cpp
-}
-
-embedded {
- HEADERS += painting/qwindowsurface_qws_p.h
- SOURCES += painting/qwindowsurface_qws.cpp
-}
-
-
-
symbian {
- HEADERS += painting/qwindowsurface_s60_p.h \
- painting/qdrawhelper_arm_simd_p.h
- SOURCES += painting/qwindowsurface_s60.cpp
+ HEADERS += painting/qdrawhelper_arm_simd_p.h
armccIfdefBlock = \
"$${LITERAL_HASH}if defined(ARMV6)" \
"MACRO QT_HAVE_ARM_SIMD" \
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 42c1c354b6..1ee66f09cc 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -53,13 +53,10 @@
#include <QtGui/qgraphicsproxywidget.h>
#include <private/qwidget_p.h>
-#include <private/qwindowsurface_raster_p.h>
#include <private/qapplication_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qgraphicseffect_p.h>
-#include "qgraphicssystem_p.h"
-
#ifdef Q_WS_QWS
#include <QtGui/qwsmanager_qws.h>
#include <private/qwsmanager_p.h>
@@ -114,9 +111,9 @@ static inline void qt_flush(QWidget *widget, const QRegion &region, QWindowSurfa
}
}
if (widget != tlw)
- windowSurface->flush(widget, region, tlwOffset + widget->mapTo(tlw, QPoint()));
+ windowSurface->flush(widget->windowHandle(), region, tlwOffset + widget->mapTo(tlw, QPoint()));
else
- windowSurface->flush(widget, region, tlwOffset);
+ windowSurface->flush(widget->windowHandle(), region, tlwOffset);
}
#ifndef QT_NO_PAINT_DEBUG
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index bf5764a609..aec03bc544 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -48,7 +48,7 @@
#include "qline.h"
#include "qdebug.h"
#include <QtCore/qcoreapplication.h>
-#include "private/qstylehelper_p.h"
+#include "private/qhexstring_p.h"
#include <QtCore/qnumeric.h>
QT_BEGIN_NAMESPACE
@@ -712,36 +712,6 @@ void QBrush::setColor(const QColor &c)
Sets the brush color to the given \a color.
*/
-
-#ifdef QT3_SUPPORT
-
-/*!
- \fn void QBrush::setPixmap(const QPixmap &pixmap)
-
- \compat
-
- Sets a custom pattern for this brush.
-
- Use setTexture() instead.
-*/
-
-/*!
- \fn QPixmap *QBrush::pixmap() const
-
- Returns a pointer to the custom brush pattern.
-
- Use texture() instead.
-*/
-QPixmap *QBrush::pixmap() const
-{
- if (d->style != Qt::TexturePattern)
- return 0;
- QTexturedBrushData *data = static_cast<QTexturedBrushData*>(d.data());
- QPixmap &pixmap = data->pixmap();
- return pixmap.isNull() ? 0 : &pixmap;
-}
-#endif
-
/*!
\fn QPixmap QBrush::texture() const
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 8b313196db..89be376ad9 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -126,12 +126,6 @@ public:
bool operator==(const QBrush &b) const;
inline bool operator!=(const QBrush &b) const { return !(operator==(b)); }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT operator const QColor&() const;
- QT3_SUPPORT QPixmap *pixmap() const;
- inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap) { setTexture(pixmap); }
-#endif
-
private:
#if defined(Q_WS_X11)
friend class QX11PaintEngine;
@@ -185,10 +179,6 @@ inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
inline QTransform QBrush::transform() const { return d->transform; }
inline bool QBrush::isDetached() const { return d->ref == 1; }
-#ifdef QT3_SUPPORT
-inline QBrush::operator const QColor&() const { return d->color; }
-#endif
-
/*******************************************************************************
* QGradients
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index ff6c24ee9e..1a6b090f63 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2463,30 +2463,6 @@ void QColor::invalidate()
ct.argb.pad = 0;
}
-#ifdef QT3_SUPPORT
-
-/*!
- Returns the pixel value used by the underlying window system to refer to a
- color.
-
- Use QColormap::pixel() instead.
-
- \oldcode
- QColor myColor;
- uint pixel = myColor.pixel(screen);
- \newcode
- QColormap cmap = QColormap::instance(screen);
- uint pixel = cmap.pixel(*this);
- \endcode
-*/
-uint QColor::pixel(int screen) const
-{
- QColormap cmap = QColormap::instance(screen);
- return cmap.pixel(*this);
-}
-
-#endif // QT3_SUPPORT
-
/*****************************************************************************
QColor stream functions
*****************************************************************************/
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index af7248ce8c..38fce2500d 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -208,30 +208,9 @@ public:
static void setAllowX11ColorNames(bool enabled);
#endif
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT_CONSTRUCTOR QColor(int x, int y, int z, Spec colorSpec)
- { if (colorSpec == Hsv) setHsv(x, y, z); else setRgb(x, y, z); }
-
- inline QT3_SUPPORT void rgb(int *r, int *g, int *b) const
- { getRgb(r, g, b); }
- inline QT3_SUPPORT void hsv(int *h, int *s, int *v) const
- { getHsv(h, s, v); }
-
- inline QT3_SUPPORT void setRgba(int r, int g, int b, int a)
- { setRgb(r, g, b, a); }
- inline QT3_SUPPORT void getRgba(int *r, int *g, int *b, int *a) const
- { getRgb(r, g, b, a); }
-
- QT3_SUPPORT uint pixel(int screen = -1) const;
-#endif
-
static bool isValidColor(const QString &name);
private:
-#ifndef QT3_SUPPORT
- // do not allow a spec to be used as an alpha value
- QColor(int, int, int, Spec);
-#endif
void invalidate();
bool setColorFromString(const QString &name);
diff --git a/src/gui/painting/qcolormap_qpa.cpp b/src/gui/painting/qcolormap_qpa.cpp
index f66607bb05..24015a0497 100644
--- a/src/gui/painting/qcolormap_qpa.cpp
+++ b/src/gui/painting/qcolormap_qpa.cpp
@@ -42,8 +42,7 @@
#include "qcolormap.h"
#include "qcolor.h"
#include "qpaintdevice.h"
-#include "private/qapplication_p.h"
-#include "private/qgraphicssystem_p.h"
+#include "private/qguiapplication_p.h"
QT_BEGIN_NAMESPACE
@@ -67,7 +66,7 @@ void QColormap::initialize()
{
screenMap = new QColormapPrivate;
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen*> screens = pi->screens();
screenMap->depth = screens.at(0)->depth();
diff --git a/src/gui/painting/qcolormap_qws.cpp b/src/gui/painting/qcolormap_qws.cpp
deleted file mode 100644
index 5c0933d6eb..0000000000
--- a/src/gui/painting/qcolormap_qws.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcolormap.h"
-#include "qcolor.h"
-#include "qpaintdevice.h"
-#include "qscreen_qws.h"
-#include "qwsdisplay_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-class QColormapPrivate
-{
-public:
- inline QColormapPrivate()
- : ref(1), mode(QColormap::Direct), depth(0), numcolors(0)
- { }
-
- QAtomicInt ref;
-
- QColormap::Mode mode;
- int depth;
- int numcolors;
-};
-
-static QColormapPrivate *screenMap = 0;
-
-void QColormap::initialize()
-{
- screenMap = new QColormapPrivate;
-
- screenMap->depth = QPaintDevice::qwsDisplay()->depth();
- if (screenMap->depth < 8) {
- screenMap->mode = QColormap::Indexed;
- screenMap->numcolors = 256;
- } else {
- screenMap->mode = QColormap::Direct;
- screenMap->numcolors = -1;
- }
-}
-
-void QColormap::cleanup()
-{
- delete screenMap;
- screenMap = 0;
-}
-
-QColormap QColormap::instance(int /*screen*/)
-{
- return QColormap();
-}
-
-QColormap::QColormap()
- : d(screenMap)
-{ d->ref.ref(); }
-
-QColormap::QColormap(const QColormap &colormap)
- :d (colormap.d)
-{ d->ref.ref(); }
-
-QColormap::~QColormap()
-{
- if (!d->ref.deref())
- delete d;
-}
-
-QColormap::Mode QColormap::mode() const
-{ return d->mode; }
-
-
-int QColormap::depth() const
-{ return d->depth; }
-
-
-int QColormap::size() const
-{
- return d->numcolors;
-}
-
-uint QColormap::pixel(const QColor &color) const
-{
- QRgb rgb = color.rgba();
- if (d->mode == QColormap::Direct) {
- switch(d->depth) {
- case 16:
- return qt_convRgbTo16(rgb);
- case 24:
- case 32:
- {
- const int r = qRed(rgb);
- const int g = qGreen(rgb);
- const int b = qBlue(rgb);
- const int red_shift = 16;
- const int green_shift = 8;
- const int red_mask = 0xff0000;
- const int green_mask = 0x00ff00;
- const int blue_mask = 0x0000ff;
- const int tg = g << green_shift;
-#ifdef QT_QWS_DEPTH_32_BGR
- if (qt_screen->pixelType() == QScreen::BGRPixel) {
- const int tb = b << red_shift;
- return 0xff000000 | (r & blue_mask) | (tg & green_mask) | (tb & red_mask);
- }
-#endif
- const int tr = r << red_shift;
- return 0xff000000 | (b & blue_mask) | (tg & green_mask) | (tr & red_mask);
- }
- }
- }
- return qt_screen->alloc(qRed(rgb), qGreen(rgb), qBlue(rgb));
-}
-
-const QColor QColormap::colorAt(uint pixel) const
-{
- if (d->mode == Direct) {
- if (d->depth == 16) {
- pixel = qt_conv16ToRgb(pixel);
- }
- const int red_shift = 16;
- const int green_shift = 8;
- const int red_mask = 0xff0000;
- const int green_mask = 0x00ff00;
- const int blue_mask = 0x0000ff;
-#ifdef QT_QWS_DEPTH_32_BGR
- if (qt_screen->pixelType() == QScreen::BGRPixel) {
- return QColor((pixel & blue_mask),
- (pixel & green_mask) >> green_shift,
- (pixel & red_mask) >> red_shift);
- }
-#endif
- return QColor((pixel & red_mask) >> red_shift,
- (pixel & green_mask) >> green_shift,
- (pixel & blue_mask));
- }
- Q_ASSERT_X(int(pixel) < qt_screen->colorCount(), "QColormap::colorAt", "pixel out of bounds of palette");
- return QColor(qt_screen->clut()[pixel]);
-}
-
-const QVector<QColor> QColormap::colormap() const
-{
- return QVector<QColor>();
-}
-
-QColormap &QColormap::operator=(const QColormap &colormap)
-{ qAtomicAssign(d, colormap.d); return *this; }
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 3553b6064d..333b433bb5 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -3415,9 +3415,6 @@ static
void drawBufferSpan(QSpanData *data, const uint *buffer, int bufsize,
int x, int y, int length, uint const_alpha)
{
-#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
- data->rasterEngine->drawBufferSpan(buffer, bufsize, x, y, length, const_alpha);
-#else
Q_UNUSED(data);
Q_UNUSED(buffer);
Q_UNUSED(bufsize);
@@ -3425,7 +3422,6 @@ void drawBufferSpan(QSpanData *data, const uint *buffer, int bufsize,
Q_UNUSED(y);
Q_UNUSED(length);
Q_UNUSED(const_alpha);
-#endif
}
#if !defined(Q_CC_SUN)
@@ -3453,18 +3449,6 @@ void blend_color_generic(int count, const QSpan *spans, void *userData)
}
}
-#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
-static void blend_color_generic_callback(int count, const QSpan *spans, void *userData)
-{
- // ### Falcon
- Q_UNUSED(count);
- Q_UNUSED(spans);
- Q_UNUSED(userData);
-// QSpanData *data = reinterpret_cast<QSpanData*>(userData);
-// data->rasterEngine->drawColorSpans(spans, count, data->solid.color);
-}
-#endif // QT_NO_RASTERCALLBACKS
-
static void blend_color_argb(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
@@ -5087,65 +5071,30 @@ void QT_FASTCALL blendUntransformed(int count, const QSpan *spans, void *userDat
static void blend_untransformed_rgb888(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_24)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_RGB888)
- blendUntransformed<qrgb888, qrgb888>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_argb6666(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendUntransformed<qargb6666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendUntransformed<qargb6666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_rgb666(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendUntransformed<qrgb666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendUntransformed<qrgb666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_argb8565(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_16)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
- blendUntransformed<qargb8565, qargb8565>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB16)
- blendUntransformed<qargb8565, qrgb565>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_rgb565(int count, const QSpan *spans,
void *userData)
{
-#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16)
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
@@ -5153,68 +5102,31 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans,
else if (data->texture.format == QImage::Format_RGB16)
blendUntransformed<qrgb565, qrgb565>(count, spans, userData);
else
-#endif
blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_argb8555(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendUntransformed<qargb8555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendUntransformed<qargb8555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_rgb555(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendUntransformed<qrgb555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendUntransformed<qrgb555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_argb4444(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendUntransformed<qargb4444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendUntransformed<qargb4444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
static void blend_untransformed_rgb444(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendUntransformed<qrgb444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendUntransformed<qrgb444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_untransformed_generic<RegularSpans>(count, spans, userData);
+ blend_untransformed_generic<RegularSpans>(count, spans, userData);
}
template <SpanMethod spanMethod>
@@ -5430,61 +5342,26 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void *
static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_24)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_RGB888)
- blendTiled<qrgb888, qrgb888>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTiled<qargb6666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTiled<qargb6666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTiled<qrgb666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTiled<qrgb666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_16)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
- blendTiled<qargb8565, qargb8565>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB16)
- blendTiled<qargb8565, qrgb565>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData)
{
-#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16)
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
@@ -5492,64 +5369,27 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData)
else if (data->texture.format == QImage::Format_RGB16)
blendTiled<qrgb565, qrgb565>(count, spans, userData);
else
-#endif
blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTiled<qargb8555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTiled<qargb8555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTiled<qrgb555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTiled<qrgb555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTiled<qargb4444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTiled<qargb4444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTiled<qrgb444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTiled<qrgb444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_tiled_generic<RegularSpans>(count, spans, userData);
+ blend_tiled_generic<RegularSpans>(count, spans, userData);
}
template <class DST, class SRC>
@@ -5777,62 +5617,27 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan
static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_24)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_RGB888)
- blendTransformedBilinear<qrgb888, qrgb888>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTransformedBilinear<qargb6666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTransformedBilinear<qargb6666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTransformedBilinear<qrgb666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTransformedBilinear<qrgb666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_16)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
- blendTransformedBilinear<qargb8565, qargb8565>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB16)
- blendTransformedBilinear<qargb8565, qrgb565>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans,
void *userData)
{
-#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16)
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
if (data->texture.format == QImage::Format_RGB16)
@@ -5840,64 +5645,27 @@ static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans,
else if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
blendTransformedBilinear<qrgb565, qargb8565>(count, spans, userData);
else
-#endif
blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTransformedBilinear<qargb8555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTransformedBilinear<qargb8555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTransformedBilinear<qrgb555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTransformedBilinear<qrgb555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTransformedBilinear<qargb4444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTransformedBilinear<qargb4444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTransformedBilinear<qrgb444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTransformedBilinear<qrgb444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
template <SpanMethod spanMethod>
@@ -6170,65 +5938,30 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformed(int count, const QSpan *spans,
static void blend_transformed_rgb888(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_24)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_RGB888)
- blendTransformed<qrgb888, qrgb888>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_argb6666(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTransformed<qargb6666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTransformed<qargb6666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_rgb666(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTransformed<qrgb666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTransformed<qrgb666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_argb8565(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_16)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
- blendTransformed<qargb8565, qargb8565>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB16)
- blendTransformed<qargb8565, qrgb565>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_rgb565(int count, const QSpan *spans,
void *userData)
{
-#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16)
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
@@ -6236,68 +5969,31 @@ static void blend_transformed_rgb565(int count, const QSpan *spans,
else if (data->texture.format == QImage::Format_RGB16)
blendTransformed<qrgb565, qrgb565>(count, spans, userData);
else
-#endif
blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_argb8555(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTransformed<qargb8555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTransformed<qargb8555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_rgb555(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTransformed<qrgb555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTransformed<qrgb555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_argb4444(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTransformed<qargb4444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTransformed<qargb4444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_rgb444(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTransformed<qrgb444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTransformed<qrgb444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
template <SpanMethod spanMethod>
@@ -6585,65 +6281,30 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedTiled(int count, const QSpan *sp
static void blend_transformed_tiled_rgb888(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_24)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_RGB888)
- blendTransformedTiled<qrgb888, qrgb888>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_argb6666(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTransformedTiled<qargb6666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTransformedTiled<qargb6666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_rgb666(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_18)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB6666_Premultiplied)
- blendTransformedTiled<qrgb666, qargb6666>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB666)
- blendTransformedTiled<qrgb666, qrgb666>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_argb8565(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_16)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
- blendTransformedTiled<qargb8565, qargb8565>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB16)
- blendTransformedTiled<qargb8565, qrgb565>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_rgb565(int count, const QSpan *spans,
void *userData)
{
-#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16)
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
if (data->texture.format == QImage::Format_ARGB8565_Premultiplied)
@@ -6651,68 +6312,31 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans,
else if (data->texture.format == QImage::Format_RGB16)
blendTransformedTiled<qrgb565, qrgb565>(count, spans, userData);
else
-#endif
blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_argb8555(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTransformedTiled<qargb8555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTransformedTiled<qargb8555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_rgb555(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_15)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB8555_Premultiplied)
- blendTransformedTiled<qrgb555, qargb8555>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB555)
- blendTransformedTiled<qrgb555, qrgb555>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_argb4444(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTransformedTiled<qargb4444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTransformedTiled<qargb4444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
static void blend_transformed_tiled_rgb444(int count, const QSpan *spans,
void *userData)
{
-#if defined(QT_QWS_DEPTH_12)
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
-
- if (data->texture.format == QImage::Format_ARGB4444_Premultiplied)
- blendTransformedTiled<qrgb444, qargb4444>(count, spans, userData);
- else if (data->texture.format == QImage::Format_RGB444)
- blendTransformedTiled<qrgb444, qrgb444>(count, spans, userData);
- else
-#endif
- blend_src_generic<RegularSpans>(count, spans, userData);
+ blend_src_generic<RegularSpans>(count, spans, userData);
}
# define SPANFUNC_POINTER(Name, Arg) Name<Arg>
@@ -6836,125 +6460,6 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
}
};
-#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
-static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImageFormats] = {
- // Untransformed
- {
- 0, // Invalid
- blend_untransformed_generic<CallbackSpans>, // Mono
- blend_untransformed_generic<CallbackSpans>, // MonoLsb
- blend_untransformed_generic<CallbackSpans>, // Indexed8
- blend_untransformed_generic<CallbackSpans>, // RGB32
- blend_untransformed_generic<CallbackSpans>, // ARGB32
- blend_untransformed_argb<CallbackSpans>, // ARGB32_Premultiplied
- blend_untransformed_generic<CallbackSpans>, // RGB16
- blend_untransformed_generic<CallbackSpans>, // ARGB8565_Premultiplied
- blend_untransformed_generic<CallbackSpans>, // RGB666
- blend_untransformed_generic<CallbackSpans>, // ARGB6666_Premultiplied
- blend_untransformed_generic<CallbackSpans>, // RGB555
- blend_untransformed_generic<CallbackSpans>, // ARGB8555_Premultiplied
- blend_untransformed_generic<CallbackSpans>, // RGB888
- blend_untransformed_generic<CallbackSpans>, // RGB444
- blend_untransformed_generic<CallbackSpans> // ARGB4444_Premultiplied
- },
- // Tiled
- {
- 0, // Invalid
- blend_tiled_generic<CallbackSpans>, // Mono
- blend_tiled_generic<CallbackSpans>, // MonoLsb
- blend_tiled_generic<CallbackSpans>, // Indexed8
- blend_tiled_generic<CallbackSpans>, // RGB32
- blend_tiled_generic<CallbackSpans>, // ARGB32
- blend_tiled_argb<CallbackSpans>, // ARGB32_Premultiplied
- blend_tiled_generic<CallbackSpans>, // RGB16
- blend_tiled_generic<CallbackSpans>, // ARGB8565_Premultiplied
- blend_tiled_generic<CallbackSpans>, // RGB666
- blend_tiled_generic<CallbackSpans>, // ARGB6666_Premultiplied
- blend_tiled_generic<CallbackSpans>, // RGB555
- blend_tiled_generic<CallbackSpans>, // ARGB8555_Premultiplied
- blend_tiled_generic<CallbackSpans>, // RGB888
- blend_tiled_generic<CallbackSpans>, // RGB444
- blend_tiled_generic<CallbackSpans> // ARGB4444_Premultiplied
- },
- // Transformed
- {
- 0, // Invalid
- blend_src_generic<CallbackSpans>, // Mono
- blend_src_generic<CallbackSpans>, // MonoLsb
- blend_src_generic<CallbackSpans>, // Indexed8
- blend_src_generic<CallbackSpans>, // RGB32
- blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_argb<CallbackSpans>, // ARGB32_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB16
- blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB666
- blend_src_generic<CallbackSpans>, // ARGB6666_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB555
- blend_src_generic<CallbackSpans>, // ARGB8555_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB888
- blend_src_generic<CallbackSpans>, // RGB444
- blend_src_generic<CallbackSpans>, // ARGB4444_Premultiplied
- },
- // TransformedTiled
- {
- 0,
- blend_src_generic<CallbackSpans>, // Mono
- blend_src_generic<CallbackSpans>, // MonoLsb
- blend_src_generic<CallbackSpans>, // Indexed8
- blend_src_generic<CallbackSpans>, // RGB32
- blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_tiled_argb<CallbackSpans>, // ARGB32_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB16
- blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB666
- blend_src_generic<CallbackSpans>, // ARGB6666_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB555
- blend_src_generic<CallbackSpans>, // ARGB8555_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB888
- blend_src_generic<CallbackSpans>, // RGB444
- blend_src_generic<CallbackSpans> // ARGB4444_Premultiplied
- },
- // Bilinear
- {
- 0,
- blend_src_generic<CallbackSpans>, // Mono
- blend_src_generic<CallbackSpans>, // MonoLsb
- blend_src_generic<CallbackSpans>, // Indexed8
- blend_src_generic<CallbackSpans>, // RGB32
- blend_src_generic<CallbackSpans>, // ARGB32
- blend_src_generic<CallbackSpans>, // ARGB32_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB16
- blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB666
- blend_src_generic<CallbackSpans>, // ARGB6666_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB555
- blend_src_generic<CallbackSpans>, // ARGB8555_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB888
- blend_src_generic<CallbackSpans>, // RGB444
- blend_src_generic<CallbackSpans> // ARGB4444_Premultiplied
- },
- // BilinearTiled
- {
- 0,
- blend_src_generic<CallbackSpans>, // Mono
- blend_src_generic<CallbackSpans>, // MonoLsb
- blend_src_generic<CallbackSpans>, // Indexed8
- blend_src_generic<CallbackSpans>, // RGB32
- blend_src_generic<CallbackSpans>, // ARGB32
- blend_src_generic<CallbackSpans>, // ARGB32_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB16
- blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB666
- blend_src_generic<CallbackSpans>, // ARGB6666_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB555
- blend_src_generic<CallbackSpans>, // ARGB8555_Premultiplied
- blend_src_generic<CallbackSpans>, // RGB888
- blend_src_generic<CallbackSpans>, // RGB444
- blend_src_generic<CallbackSpans> // ARGB4444_Premultiplied
- }
-};
-#endif // QT_NO_RASTERCALLBACKS
-
void qBlendTexture(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
@@ -6962,15 +6467,6 @@ void qBlendTexture(int count, const QSpan *spans, void *userData)
proc(count, spans, userData);
}
-#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
-void qBlendTextureCallback(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- ProcessSpans proc = processTextureSpansCallback[getBlendType(data)][data->rasterBuffer->format];
- proc(count, spans, userData);
-}
-#endif // QT_NO_RASTERCALLBACKS
-
template <class DST>
inline void qt_bitmapblit_template(QRasterBuffer *rasterBuffer,
int x, int y, quint32 color,
@@ -7620,106 +7116,6 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
}
};
-#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
-DrawHelper qDrawHelperCallback[QImage::NImageFormats] =
-{
- // Format_Invalid,
- { 0, 0, 0, 0, 0, 0 },
- // Format_Mono,
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_MonoLSB,
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_Indexed8,
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_RGB32,
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_ARGB32,
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_ARGB32_Premultiplied
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_RGB16
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_ARGB8565_Premultiplied
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_RGB666
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_ARGB6666_Premultiplied
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_RGB555
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_ARGB8555_Premultiplied
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_RGB888
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_RGB444
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- },
- // Format_ARGB4444_Premultiplied
- {
- blend_color_generic_callback,
- blend_src_generic<CallbackSpans>,
- 0, 0, 0, 0
- }
-};
-#endif
-
-
-
#if defined(Q_CC_MSVC) && !defined(_MIPS_)
template <class DST, class SRC>
inline void qt_memfill_template(DST *dest, SRC color, int count)
@@ -8009,64 +7405,4 @@ static void qt_memfill16_setup(quint16 *dest, quint16 value, int count)
qt_memfill16(dest, value, count);
}
-#ifdef QT_QWS_DEPTH_GENERIC
-
-int qrgb::bpp = 0;
-int qrgb::len_red = 0;
-int qrgb::len_green = 0;
-int qrgb::len_blue = 0;
-int qrgb::len_alpha = 0;
-int qrgb::off_red = 0;
-int qrgb::off_green = 0;
-int qrgb::off_blue = 0;
-int qrgb::off_alpha = 0;
-
-template <typename SRC>
-Q_STATIC_TEMPLATE_FUNCTION inline void qt_rectconvert_rgb(qrgb *dest, const SRC *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- quint8 *dest8 = reinterpret_cast<quint8*>(dest)
- + y * dstStride + x * qrgb::bpp;
-
- srcStride = srcStride / sizeof(SRC) - width;
- dstStride -= (width * qrgb::bpp);
-
- for (int j = 0; j < height; ++j) {
- for (int i = 0; i < width; ++i) {
- const quint32 v = qt_convertToRgb<SRC>(*src++);
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- for (int j = qrgb::bpp - 1; j >= 0; --j)
- *dest8++ = (v >> (8 * j)) & 0xff;
-#else
- for (int j = 0; j < qrgb::bpp; ++j)
- *dest8++ = (v >> (8 * j)) & 0xff;
-#endif
- }
-
- dest8 += dstStride;
- src += srcStride;
- }
-}
-
-template <>
-void qt_rectconvert(qrgb *dest, const quint32 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_rgb<quint32>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-template <>
-void qt_rectconvert(qrgb *dest, const quint16 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride)
-{
- qt_rectconvert_rgb<quint16>(dest, src, x, y, width, height,
- dstStride, srcStride);
-}
-
-#endif // QT_QWS_DEPTH_GENERIC
-
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index d4e731bbb2..a16a9bec51 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -64,10 +64,6 @@
#include "private/qrasterdefs_p.h"
#include <private/qsimd_p.h>
-#ifdef Q_WS_QWS
-#include "QtGui/qscreen_qws.h"
-#endif
-
QT_BEGIN_NAMESPACE
#if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL)
@@ -170,10 +166,6 @@ extern MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3];
extern DrawHelper qDrawHelper[QImage::NImageFormats];
void qBlendTexture(int count, const QSpan *spans, void *userData);
-#if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
-extern DrawHelper qDrawHelperCallback[QImage::NImageFormats];
-void qBlendTextureCallback(int count, const QSpan *spans, void *userData);
-#endif
typedef void (QT_FASTCALL *CompositionFunction)(uint *dest, const uint *src, int length, uint const_alpha);
typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
@@ -231,11 +223,7 @@ struct QGradientData
QConicalGradientData conical;
};
-#ifdef Q_WS_QWS
-#define GRADIENT_STOPTABLE_SIZE 256
-#else
#define GRADIENT_STOPTABLE_SIZE 1024
-#endif
uint* colorTable; //[GRADIENT_STOPTABLE_SIZE];
@@ -272,9 +260,6 @@ struct QSpanData
~QSpanData() { delete tempImage; }
QRasterBuffer *rasterBuffer;
-#ifdef Q_WS_QWS
- QRasterPaintEngine *rasterEngine;
-#endif
ProcessSpans blend;
ProcessSpans unclipped_blend;
BitmapBlitFunc bitmapBlit;
@@ -1238,37 +1223,6 @@ inline quint32 qt_colorConvert(qrgb888 color, quint32 dummy)
return quint32(color);
}
-#ifdef QT_QWS_DEPTH_8
-template <>
-inline quint8 qt_colorConvert(quint32 color, quint8 dummy)
-{
- Q_UNUSED(dummy);
-
- uchar r = ((qRed(color) & 0xf8) + 0x19) / 0x33;
- uchar g = ((qGreen(color) &0xf8) + 0x19) / 0x33;
- uchar b = ((qBlue(color) &0xf8) + 0x19) / 0x33;
-
- return r*6*6 + g*6 + b;
-}
-
-template <>
-inline quint8 qt_colorConvert(quint16 color, quint8 dummy)
-{
- Q_UNUSED(dummy);
-
- uchar r = (color & 0xf800) >> (11-3);
- uchar g = (color & 0x07c0) >> (6-3);
- uchar b = (color & 0x001f) << 3;
-
- uchar tr = (r + 0x19) / 0x33;
- uchar tg = (g + 0x19) / 0x33;
- uchar tb = (b + 0x19) / 0x33;
-
- return tr*6*6 + tg*6 + tb;
-}
-
-#endif // QT_QWS_DEPTH_8
-
// hw: endianess??
class quint24
{
@@ -1505,84 +1459,6 @@ qrgb444 qrgb444::byte_mul(quint8 a) const
return result;
}
-#ifdef QT_QWS_DEPTH_GENERIC
-
-struct qrgb
-{
-public:
- static int bpp;
- static int len_red;
- static int len_green;
- static int len_blue;
- static int len_alpha;
- static int off_red;
- static int off_green;
- static int off_blue;
- static int off_alpha;
-} Q_PACKED;
-
-template <typename SRC>
-Q_STATIC_TEMPLATE_FUNCTION inline quint32 qt_convertToRgb(SRC color);
-
-template <>
-inline quint32 qt_convertToRgb(quint32 color)
-{
- const int r = qRed(color) >> (8 - qrgb::len_red);
- const int g = qGreen(color) >> (8 - qrgb::len_green);
- const int b = qBlue(color) >> (8 - qrgb::len_blue);
- const int a = qAlpha(color) >> (8 - qrgb::len_alpha);
- const quint32 v = (r << qrgb::off_red)
- | (g << qrgb::off_green)
- | (b << qrgb::off_blue)
- | (a << qrgb::off_alpha);
-
- return v;
-}
-
-template <>
-inline quint32 qt_convertToRgb(quint16 color)
-{
- return qt_convertToRgb(qt_colorConvert<quint32, quint16>(color, 0));
-}
-
-class qrgb_generic16
-{
-public:
- inline qrgb_generic16(quint32 color)
- {
- const int r = qRed(color) >> (8 - qrgb::len_red);
- const int g = qGreen(color) >> (8 - qrgb::len_green);
- const int b = qBlue(color) >> (8 - qrgb::len_blue);
- const int a = qAlpha(color) >> (8 - qrgb::len_alpha);
- data = (r << qrgb::off_red)
- | (g << qrgb::off_green)
- | (b << qrgb::off_blue)
- | (a << qrgb::off_alpha);
- }
-
- inline operator quint16 () { return data; }
- inline quint32 operator<<(int shift) const { return data << shift; }
-
-private:
- quint16 data;
-} Q_PACKED;
-
-template <>
-inline qrgb_generic16 qt_colorConvert(quint32 color, qrgb_generic16 dummy)
-{
- Q_UNUSED(dummy);
- return qrgb_generic16(color);
-}
-
-template <>
-inline qrgb_generic16 qt_colorConvert(quint16 color, qrgb_generic16 dummy)
-{
- Q_UNUSED(dummy);
- return qrgb_generic16(qt_colorConvert<quint32, quint16>(color, 0));
-}
-
-#endif // QT_QWS_DEPTH_GENERIC
-
template <class T>
void qt_memfill(T *dest, T value, int count);
@@ -1790,16 +1666,6 @@ QT_RECTCONVERT_TRIVIAL_IMPL(qargb4444)
QT_RECTCONVERT_TRIVIAL_IMPL(qrgb444)
#undef QT_RECTCONVERT_TRIVIAL_IMPL
-#ifdef QT_QWS_DEPTH_GENERIC
-template <> void qt_rectconvert(qrgb *dest, const quint32 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride);
-
-template <> void qt_rectconvert(qrgb *dest, const quint16 *src,
- int x, int y, int width, int height,
- int dstStride, int srcStride);
-#endif // QT_QWS_DEPTH_GENERIC
-
#define QT_MEMFILL_UINT(dest, length, color) \
qt_memfill<quint32>(dest, color, length);
@@ -1862,16 +1728,6 @@ inline ushort qConvertRgb32To16(uint c)
| (((c) >> 8) & 0xf800);
}
-#if defined(Q_WS_QWS) || (QT_VERSION >= 0x040400)
-inline quint32 qConvertRgb32To16x2(quint64 c)
-{
- c = (((c) >> 3) & Q_UINT64_C(0x001f0000001f))
- | (((c) >> 5) & Q_UINT64_C(0x07e0000007e0))
- | (((c) >> 8) & Q_UINT64_C(0xf8000000f800));
- return c | (c >> 16);
-}
-#endif
-
inline QRgb qConvertRgb16To32(uint c)
{
return 0xff000000
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 89474d9679..c674da8394 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -42,13 +42,12 @@
#include "qdrawutil.h"
#include "qbitmap.h"
#include "qpixmapcache.h"
-#include "qapplication.h"
#include "qpainter.h"
#include "qpalette.h"
#include <private/qpaintengineex_p.h>
#include <qvarlengtharray.h>
#include <qmath.h>
-#include <private/qstylehelper_p.h>
+#include <private/qhexstring_p.h>
QT_BEGIN_NAMESPACE
@@ -743,312 +742,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
lineWidth, fill);
}
-#ifdef QT3_SUPPORT
-static void qDrawWinArrow(QPainter *p, Qt::ArrowType type, bool down,
- int x, int y, int w, int h,
- const QPalette &pal, bool enabled)
-{
- QPolygon a; // arrow polygon
- switch (type) {
- case Qt::UpArrow:
- a.setPoints(7, -3,1, 3,1, -2,0, 2,0, -1,-1, 1,-1, 0,-2);
- break;
- case Qt::DownArrow:
- a.setPoints(7, -3,-1, 3,-1, -2,0, 2,0, -1,1, 1,1, 0,2);
- break;
- case Qt::LeftArrow:
- a.setPoints(7, 1,-3, 1,3, 0,-2, 0,2, -1,-1, -1,1, -2,0);
- break;
- case Qt::RightArrow:
- a.setPoints(7, -1,-3, -1,3, 0,-2, 0,2, 1,-1, 1,1, 2,0);
- break;
- default:
- break;
- }
- if (a.isEmpty())
- return;
-
- if (down) {
- x++;
- y++;
- }
-
- QPen savePen = p->pen(); // save current pen
- if (down)
- p->setBrushOrigin(p->brushOrigin() + QPoint(1,1));
- p->fillRect(x, y, w, h, pal.brush(QPalette::Button));
- if (down)
- p->setBrushOrigin(p->brushOrigin() - QPoint(1,1));
- if (enabled) {
- a.translate(x+w/2, y+h/2);
- p->setPen(pal.foreground().color());
- p->drawLine(a.at(0), a.at(1));
- p->drawLine(a.at(2), a.at(2));
- p->drawPoint(a[6]);
- } else {
- a.translate(x+w/2+1, y+h/2+1);
- p->setPen(pal.light().color());
- p->drawLine(a.at(0), a.at(1));
- p->drawLine(a.at(2), a.at(2));
- p->drawPoint(a[6]);
- a.translate(-1, -1);
- p->setPen(pal.mid().color());
- p->drawLine(a.at(0), a.at(1));
- p->drawLine(a.at(2), a.at(2));
- p->drawPoint(a[6]);
- }
- p->setPen(savePen); // restore pen
-}
-#endif // QT3_SUPPORT
-
-#if defined(Q_CC_MSVC)
-#pragma warning(disable: 4244)
-#endif
-
-#ifdef QT3_SUPPORT
-#ifndef QT_NO_STYLE_MOTIF
-// motif arrows look the same whether they are used or not
-// is this correct?
-static void qDrawMotifArrow(QPainter *p, Qt::ArrowType type, bool down,
- int x, int y, int w, int h,
- const QPalette &pal, bool)
-{
- QPolygon bFill; // fill polygon
- QPolygon bTop; // top shadow.
- QPolygon bBot; // bottom shadow.
- QPolygon bLeft; // left shadow.
- QTransform matrix; // xform matrix
- bool vertical = type == Qt::UpArrow || type == Qt::DownArrow;
- bool horizontal = !vertical;
- int dim = w < h ? w : h;
- int colspec = 0x0000; // color specification array
-
- if (dim < 2) // too small arrow
- return;
-
- if (dim > 3) {
- if (dim > 6)
- bFill.resize(dim & 1 ? 3 : 4);
- bTop.resize((dim/2)*2);
- bBot.resize(dim & 1 ? dim + 1 : dim);
- bLeft.resize(dim > 4 ? 4 : 2);
- bLeft.putPoints(0, 2, 0,0, 0,dim-1);
- if (dim > 4)
- bLeft.putPoints(2, 2, 1,2, 1,dim-3);
- bTop.putPoints(0, 4, 1,0, 1,1, 2,1, 3,1);
- bBot.putPoints(0, 4, 1,dim-1, 1,dim-2, 2,dim-2, 3,dim-2);
-
- for(int i=0; i<dim/2-2 ; i++) {
- bTop.putPoints(i*2+4, 2, 2+i*2,2+i, 5+i*2, 2+i);
- bBot.putPoints(i*2+4, 2, 2+i*2,dim-3-i, 5+i*2,dim-3-i);
- }
- if (dim & 1) // odd number size: extra line
- bBot.putPoints(dim-1, 2, dim-3,dim/2, dim-1,dim/2);
- if (dim > 6) { // dim>6: must fill interior
- bFill.putPoints(0, 2, 1,dim-3, 1,2);
- if (dim & 1) // if size is an odd number
- bFill.setPoint(2, dim - 3, dim / 2);
- else
- bFill.putPoints(2, 2, dim-4,dim/2-1, dim-4,dim/2);
- }
- }
- else {
- if (dim == 3) { // 3x3 arrow pattern
- bLeft.setPoints(4, 0,0, 0,2, 1,1, 1,1);
- bTop .setPoints(2, 1,0, 1,0);
- bBot .setPoints(2, 1,2, 2,1);
- }
- else { // 2x2 arrow pattern
- bLeft.setPoints(2, 0,0, 0,1);
- bTop .setPoints(2, 1,0, 1,0);
- bBot .setPoints(2, 1,1, 1,1);
- }
- }
-
- if (type == Qt::UpArrow || type == Qt::LeftArrow) {
- matrix.translate(x, y);
- if (vertical) {
- matrix.translate(0, h - 1);
- matrix.rotate(-90);
- } else {
- matrix.translate(w - 1, h - 1);
- matrix.rotate(180);
- }
- if (down)
- colspec = horizontal ? 0x2334 : 0x2343;
- else
- colspec = horizontal ? 0x1443 : 0x1434;
- }
- else if (type == Qt::DownArrow || type == Qt::RightArrow) {
- matrix.translate(x, y);
- if (vertical) {
- matrix.translate(w-1, 0);
- matrix.rotate(90);
- }
- if (down)
- colspec = horizontal ? 0x2443 : 0x2434;
- else
- colspec = horizontal ? 0x1334 : 0x1343;
- }
-
- const QColor *cols[5];
- cols[0] = 0;
- cols[1] = &pal.button().color();
- cols[2] = &pal.mid().color();
- cols[3] = &pal.light().color();
- cols[4] = &pal.dark().color();
-#define CMID *cols[(colspec>>12) & 0xf]
-#define CLEFT *cols[(colspec>>8) & 0xf]
-#define CTOP *cols[(colspec>>4) & 0xf]
-#define CBOT *cols[colspec & 0xf]
-
- QPen savePen = p->pen(); // save current pen
- QBrush saveBrush = p->brush(); // save current brush
- QTransform wxm = p->transform();
- QPen pen(Qt::NoPen);
- const QBrush &brush = pal.brush(QPalette::Button);
-
- p->setPen(pen);
- p->setBrush(brush);
- p->setTransform(matrix, true); // set transformation matrix
- p->drawPolygon(bFill); // fill arrow
- p->setBrush(Qt::NoBrush); // don't fill
-
- p->setPen(CLEFT);
- p->drawLines(bLeft);
- p->setPen(CTOP);
- p->drawLines(bTop);
- p->setPen(CBOT);
- p->drawLines(bBot);
-
- p->setTransform(wxm);
- p->setBrush(saveBrush); // restore brush
- p->setPen(savePen); // restore pen
-
-#undef CMID
-#undef CLEFT
-#undef CTOP
-#undef CBOT
-}
-#endif // QT_NO_STYLE_MOTIF
-
-QRect qItemRect(QPainter *p, Qt::GUIStyle gs,
- int x, int y, int w, int h,
- int flags,
- bool enabled,
- const QPixmap *pixmap,
- const QString& text, int len)
-{
- QRect result;
-
- if (pixmap) {
- if ((flags & Qt::AlignVCenter) == Qt::AlignVCenter)
- y += h/2 - pixmap->height()/2;
- else if ((flags & Qt::AlignBottom) == Qt::AlignBottom)
- y += h - pixmap->height();
- if ((flags & Qt::AlignRight) == Qt::AlignRight)
- x += w - pixmap->width();
- else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter)
- x += w/2 - pixmap->width()/2;
- else if ((flags & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft())
- x += w - pixmap->width();
- result = QRect(x, y, pixmap->width(), pixmap->height());
- } else if (!text.isNull() && p) {
- result = p->boundingRect(QRect(x, y, w, h), flags, text.left(len));
- if (gs == Qt::WindowsStyle && !enabled) {
- result.setWidth(result.width()+1);
- result.setHeight(result.height()+1);
- }
- } else {
- result = QRect(x, y, w, h);
- }
-
- return result;
-}
-
-void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down,
- int x, int y, int w, int h,
- const QPalette &pal, bool enabled)
-{
- switch (style) {
- case Qt::WindowsStyle:
- qDrawWinArrow(p, type, down, x, y, w, h, pal, enabled);
- break;
-#ifndef QT_NO_STYLE_MOTIF
- case Qt::MotifStyle:
- qDrawMotifArrow(p, type, down, x, y, w, h, pal, enabled);
- break;
-#endif
- default:
- qWarning("qDrawArrow: Requested unsupported GUI style");
- }
-}
-
-void qDrawItem(QPainter *p, Qt::GUIStyle gs,
- int x, int y, int w, int h,
- int flags,
- const QPalette &pal, bool enabled,
- const QPixmap *pixmap,
- const QString& text, int len , const QColor* penColor)
-{
- p->setPen(penColor?*penColor:pal.foreground().color());
- if (pixmap) {
- QPixmap pm(*pixmap);
- bool clip = (flags & Qt::TextDontClip) == 0;
- if (clip) {
- if (pm.width() < w && pm.height() < h)
- clip = false;
- else
- p->setClipRect(x, y, w, h);
- }
- if ((flags & Qt::AlignVCenter) == Qt::AlignVCenter)
- y += h/2 - pm.height()/2;
- else if ((flags & Qt::AlignBottom) == Qt::AlignBottom)
- y += h - pm.height();
- if ((flags & Qt::AlignRight) == Qt::AlignRight)
- x += w - pm.width();
- else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter)
- x += w/2 - pm.width()/2;
- else if (((flags & Qt::AlignLeft) != Qt::AlignLeft) && QApplication::isRightToLeft()) // Qt::AlignAuto && rightToLeft
- x += w - pm.width();
-
- if (!enabled) {
- if (pm.hasAlphaChannel()) { // pixmap with a mask
- pm = pm.mask();
- } else if (pm.depth() == 1) { // monochrome pixmap, no mask
- ;
-#ifndef QT_NO_IMAGE_HEURISTIC_MASK
- } else { // color pixmap, no mask
- QString k = QLatin1Literal("$qt-drawitem")
- % HexString<qint64>(pm.cacheKey());
-
- if (!QPixmapCache::find(k, pm)) {
- pm = pm.createHeuristicMask();
- pm.setMask((QBitmap&)pm);
- QPixmapCache::insert(k, pm);
- }
-#endif
- }
- if (gs == Qt::WindowsStyle) {
- p->setPen(pal.light().color());
- p->drawPixmap(x+1, y+1, pm);
- p->setPen(pal.text().color());
- }
- }
- p->drawPixmap(x, y, pm);
- if (clip)
- p->setClipping(false);
- } else if (!text.isNull()) {
- if (gs == Qt::WindowsStyle && !enabled) {
- p->setPen(pal.light().color());
- p->drawText(x+1, y+1, w, h, flags, text.left(len));
- p->setPen(pal.text().color());
- }
- p->drawText(x, y, w, h, flags, text.left(len));
- }
-}
-
-#endif
/*!
\class QTileRules
diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h
index 20b558d411..f46f720f2c 100644
--- a/src/gui/painting/qdrawutil.h
+++ b/src/gui/painting/qdrawutil.h
@@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QPainter;
-#ifndef QT3_SUPPORT
-class QColorGroup;
-#endif
class QPalette;
class QPoint;
class QColor;
@@ -115,23 +112,6 @@ Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
int lineWidth = 1, const QBrush *fill = 0);
-#ifdef QT3_SUPPORT
-//
-// Use QStyle::itemRect(), QStyle::drawItem() and QStyle::drawArrow() instead.
-//
-Q_GUI_EXPORT QT3_SUPPORT QRect qItemRect(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h,
- int flags, bool enabled,
- const QPixmap *pixmap, const QString& text, int len=-1);
-
-Q_GUI_EXPORT QT3_SUPPORT void qDrawItem(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h,
- int flags, const QPalette &pal, bool enabled,
- const QPixmap *pixmap, const QString& text,
- int len=-1, const QColor* penColor = 0);
-
-Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down,
- int x, int y, int w, int h,
- const QPalette &pal, bool enabled);
-#endif
struct QTileRules
{
diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp
deleted file mode 100644
index 171ef46f98..0000000000
--- a/src/gui/painting/qgraphicssystem.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_p.h"
-
-#ifdef Q_WS_X11
-# include <private/qpixmap_x11_p.h>
-#endif
-#if defined(Q_WS_WIN)
-# include <private/qpixmap_raster_p.h>
-#endif
-#ifdef Q_WS_MAC
-# include <private/qpixmap_mac_p.h>
-#endif
-#ifdef Q_WS_QPA
-# include <QtGui/private/qapplication_p.h>
-#endif
-#ifdef Q_OS_SYMBIAN
-# include <private/qpixmap_s60_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QGraphicsSystem::~QGraphicsSystem()
-{
-}
-
-QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType type)
-{
-#ifdef Q_WS_QWS
- Q_UNUSED(type);
-#endif
-#if defined(Q_WS_X11)
- return new QX11PixmapData(type);
-#elif defined(Q_WS_WIN)
- return new QRasterPixmapData(type);
-#elif defined(Q_WS_MAC)
- return new QMacPixmapData(type);
-#elif defined(Q_WS_QPA)
- return QApplicationPrivate::platformIntegration()->createPixmapData(type);
-#elif defined(Q_OS_SYMBIAN)
- return new QS60PixmapData(type);
-#elif !defined(Q_WS_QWS)
-#error QGraphicsSystem::createDefaultPixmapData() not implemented
-#endif
- return 0;
-}
-
-QPixmapData *QGraphicsSystem::createPixmapData(QPixmapData *origin)
-{
- return createPixmapData(origin->pixelType());
-}
-
-void QGraphicsSystem::releaseCachedResources()
-{
- // Do nothing here
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_mac.cpp b/src/gui/painting/qgraphicssystem_mac.cpp
deleted file mode 100644
index 4f0be1f86a..0000000000
--- a/src/gui/painting/qgraphicssystem_mac.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_mac_p.h"
-
-#include <private/qpixmap_mac_p.h>
-#include <private/qwindowsurface_mac_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QPixmapData *QCoreGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
- return new QMacPixmapData(type);
-}
-
-QWindowSurface *QCoreGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- return new QMacWindowSurface(widget);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_mac_p.h b/src/gui/painting/qgraphicssystem_mac_p.h
deleted file mode 100644
index 4d2eae84d7..0000000000
--- a/src/gui/painting/qgraphicssystem_mac_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_MAC_P_H
-#define QGRAPHICSSYSTEM_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qgraphicssystem_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QCoreGraphicsSystem : public QGraphicsSystem
-{
-public:
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h
deleted file mode 100644
index 0f99a311a6..0000000000
--- a/src/gui/painting/qgraphicssystem_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_P_H
-#define QGRAPHICSSYSTEM_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qpixmapdata_p.h"
-#include "private/qwindowsurface_p.h"
-#include "private/qpaintengine_blitter_p.h"
-
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-class QPixmapFilter;
-class QBlittable;
-
-class Q_GUI_EXPORT QGraphicsSystem
-{
-public:
- virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0;
- virtual QPixmapData *createPixmapData(QPixmapData *origin);
- virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0;
-
- virtual ~QGraphicsSystem();
-
- //### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed
- // to have a graphics system.
- static QPixmapData *createDefaultPixmapData(QPixmapData::PixelType type);
-
- virtual void releaseCachedResources();
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/painting/qgraphicssystem_qws.cpp b/src/gui/painting/qgraphicssystem_qws.cpp
deleted file mode 100644
index 40f9ad4839..0000000000
--- a/src/gui/painting/qgraphicssystem_qws.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qscreen_qws.h>
-#include "qgraphicssystem_qws_p.h"
-#include <private/qpixmap_raster_p.h>
-#include <private/qwindowsurface_qws_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QPixmapData *QWSGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
- if (screen->pixmapDataFactory())
- return screen->pixmapDataFactory()->create(type); //### For 4.4 compatibility
- else
- return new QRasterPixmapData(type);
-}
-
-QWindowSurface *QWSGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- return screen->createSurface(widget);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_qws_p.h b/src/gui/painting/qgraphicssystem_qws_p.h
deleted file mode 100644
index 92b92628cd..0000000000
--- a/src/gui/painting/qgraphicssystem_qws_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_QWS_P_H
-#define QGRAPHICSSYSTEM_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qgraphicssystem_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QWSGraphicsSystem : public QGraphicsSystem
-{
-public:
-
- QWSGraphicsSystem()
- : screen(QScreen::instance()) {}
-
- QWSGraphicsSystem(QScreen* s)
- : screen(s) {}
-
- virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-
-private:
- QScreen* screen;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/painting/qgraphicssystem_raster.cpp b/src/gui/painting/qgraphicssystem_raster.cpp
deleted file mode 100644
index 69bf588292..0000000000
--- a/src/gui/painting/qgraphicssystem_raster.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_raster_p.h"
-
-#ifdef Q_OS_SYMBIAN
-#include "private/qpixmap_s60_p.h"
-#include "private/qwindowsurface_s60_p.h"
-#else
-#include "private/qpixmap_raster_p.h"
-#include "private/qwindowsurface_raster_p.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QPixmapData *QRasterGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
-#ifdef Q_OS_SYMBIAN
- return new QS60PixmapData(type);
-#else
- return new QRasterPixmapData(type);
-#endif
-}
-
-QWindowSurface *QRasterGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
-#ifdef Q_OS_SYMBIAN
- return new QS60WindowSurface(widget);
-#else
- return new QRasterWindowSurface(widget);
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_raster_p.h b/src/gui/painting/qgraphicssystem_raster_p.h
deleted file mode 100644
index a66c56903f..0000000000
--- a/src/gui/painting/qgraphicssystem_raster_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_RASTER_P_H
-#define QGRAPHICSSYSTEM_RASTER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qgraphicssystem_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QRasterGraphicsSystem : public QGraphicsSystem
-{
-public:
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp
deleted file mode 100644
index d1dd7ef392..0000000000
--- a/src/gui/painting/qgraphicssystem_runtime.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qgraphicssystem_runtime_p.h>
-#include <private/qgraphicssystem_raster_p.h>
-#include <private/qgraphicssystemfactory_p.h>
-#include <private/qapplication_p.h>
-#include <private/qwidget_p.h>
-#include <QtCore/QDebug>
-#include <QtCore/QTimer>
-#include <QtGui/QBitmap>
-
-QT_BEGIN_NAMESPACE
-
-static int qt_pixmap_serial = 0;
-
-#define READBACK(f) \
- f \
- readBackInfo();
-
-
-class QDeferredGraphicsSystemChange : public QObject
-{
- Q_OBJECT
-
-public:
- QDeferredGraphicsSystemChange(QRuntimeGraphicsSystem *gs, const QString& graphicsSystemName)
- : m_graphicsSystem(gs), m_graphicsSystemName(graphicsSystemName)
- {
- }
-
- void launch()
- {
- QTimer::singleShot(0, this, SLOT(doChange()));
- }
-
-private slots:
-
- void doChange()
- {
- m_graphicsSystem->setGraphicsSystem(m_graphicsSystemName);
- deleteLater();
- }
-
-private:
-
- QRuntimeGraphicsSystem *m_graphicsSystem;
- QString m_graphicsSystemName;
-};
-
-QRuntimePixmapData::QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type)
- : QPixmapData(type, RuntimeClass), m_graphicsSystem(gs)
-{
- setSerialNumber(++qt_pixmap_serial);
-}
-
-QRuntimePixmapData::~QRuntimePixmapData()
-{
- if (QApplicationPrivate::graphics_system)
- m_graphicsSystem->removePixmapData(this);
- delete m_data;
-}
-
-void QRuntimePixmapData::readBackInfo()
-{
- w = m_data->width();
- h = m_data->height();
- d = m_data->depth();
- is_null = m_data->isNull();
-}
-
-
-QPixmapData *QRuntimePixmapData::createCompatiblePixmapData() const
-{
- QRuntimePixmapData *rtData = new QRuntimePixmapData(m_graphicsSystem, pixelType());
- rtData->m_data = m_data->createCompatiblePixmapData();
- return rtData;
-}
-
-
-void QRuntimePixmapData::resize(int width, int height)
-{
- READBACK(
- m_data->resize(width, height);
- )
-}
-
-
-void QRuntimePixmapData::fromImage(const QImage &image,
- Qt::ImageConversionFlags flags)
-{
- READBACK(
- m_data->fromImage(image, flags);
- )
-}
-
-
-bool QRuntimePixmapData::fromFile(const QString &filename, const char *format,
- Qt::ImageConversionFlags flags)
-{
- bool success(false);
- READBACK(
- success = m_data->fromFile(filename, format, flags);
- )
- return success;
-}
-
-bool QRuntimePixmapData::fromData(const uchar *buffer, uint len, const char *format,
- Qt::ImageConversionFlags flags)
-{
- bool success(false);
- READBACK(
- success = m_data->fromData(buffer, len, format, flags);
- )
- return success;
-}
-
-
-void QRuntimePixmapData::copy(const QPixmapData *data, const QRect &rect)
-{
- if (data->runtimeData()) {
- READBACK(
- m_data->copy(data->runtimeData(), rect);
- )
- } else {
- READBACK(
- m_data->copy(data, rect);
- )
- }
-}
-
-bool QRuntimePixmapData::scroll(int dx, int dy, const QRect &rect)
-{
- return m_data->scroll(dx, dy, rect);
-}
-
-
-int QRuntimePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
-{
- return m_data->metric(metric);
-}
-
-void QRuntimePixmapData::fill(const QColor &color)
-{
- return m_data->fill(color);
-}
-
-QBitmap QRuntimePixmapData::mask() const
-{
- return m_data->mask();
-}
-
-void QRuntimePixmapData::setMask(const QBitmap &mask)
-{
- READBACK(
- m_data->setMask(mask);
- )
-}
-
-bool QRuntimePixmapData::hasAlphaChannel() const
-{
- return m_data->hasAlphaChannel();
-}
-
-QPixmap QRuntimePixmapData::transformed(const QTransform &matrix,
- Qt::TransformationMode mode) const
-{
- return m_data->transformed(matrix, mode);
-}
-
-void QRuntimePixmapData::setAlphaChannel(const QPixmap &alphaChannel)
-{
- READBACK(
- m_data->setAlphaChannel(alphaChannel);
- )
-}
-
-QPixmap QRuntimePixmapData::alphaChannel() const
-{
- return m_data->alphaChannel();
-}
-
-QImage QRuntimePixmapData::toImage() const
-{
- return m_data->toImage();
-}
-
-QPaintEngine* QRuntimePixmapData::paintEngine() const
-{
- return m_data->paintEngine();
-}
-
-QImage* QRuntimePixmapData::buffer()
-{
- return m_data->buffer();
-}
-
-#if defined(Q_OS_SYMBIAN)
-void* QRuntimePixmapData::toNativeType(NativeType type)
-{
- return m_data->toNativeType(type);
-}
-
-void QRuntimePixmapData::fromNativeType(void *pixmap, NativeType type)
-{
- m_data->fromNativeType(pixmap, type);
- readBackInfo();
-}
-#endif
-
-QPixmapData* QRuntimePixmapData::runtimeData() const
-{
- return m_data;
-}
-
-QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window)
- : QWindowSurface(window), m_graphicsSystem(gs)
-{
-
-}
-
-QRuntimeWindowSurface::~QRuntimeWindowSurface()
-{
- if (QApplicationPrivate::graphics_system)
- m_graphicsSystem->removeWindowSurface(this);
-}
-
-QPaintDevice *QRuntimeWindowSurface::paintDevice()
-{
- return m_windowSurface->paintDevice();
-}
-
-void QRuntimeWindowSurface::flush(QWidget *widget, const QRegion &region,
- const QPoint &offset)
-{
- m_windowSurface->flush(widget, region, offset);
-
- int destroyPolicy = m_graphicsSystem->windowSurfaceDestroyPolicy();
- if(m_pendingWindowSurface &&
- destroyPolicy == QRuntimeGraphicsSystem::DestroyAfterFirstFlush) {
-#ifdef QT_DEBUG
- qDebug() << "QRuntimeWindowSurface::flush() - destroy pending window surface";
-#endif
- m_pendingWindowSurface.reset();
- }
-}
-
-void QRuntimeWindowSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
- m_windowSurface->setGeometry(rect);
-}
-
-bool QRuntimeWindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- return m_windowSurface->scroll(area, dx, dy);
-}
-
-void QRuntimeWindowSurface::beginPaint(const QRegion &rgn)
-{
- m_windowSurface->beginPaint(rgn);
-}
-
-void QRuntimeWindowSurface::endPaint(const QRegion &rgn)
-{
- m_windowSurface->endPaint(rgn);
-}
-
-QImage* QRuntimeWindowSurface::buffer(const QWidget *widget)
-{
- return m_windowSurface->buffer(widget);
-}
-
-QPixmap QRuntimeWindowSurface::grabWidget(const QWidget *widget, const QRect& rectangle) const
-{
- return m_windowSurface->grabWidget(widget, rectangle);
-}
-
-QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const
-{
- return m_windowSurface->offset(widget);
-}
-
-QWindowSurface::WindowSurfaceFeatures QRuntimeWindowSurface::features() const
-{
- return m_windowSurface->features();
-}
-
-QRuntimeGraphicsSystem::QRuntimeGraphicsSystem()
- : m_windowSurfaceDestroyPolicy(DestroyImmediately),
- m_graphicsSystem(0)
-{
- QApplicationPrivate::runtime_graphics_system = true;
-
-#ifdef QT_DEFAULT_RUNTIME_SYSTEM
- m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM);
- if (m_graphicsSystemName.isNull())
-#endif
- m_graphicsSystemName = QLatin1String("raster");
-
-#ifdef Q_OS_SYMBIAN
- m_windowSurfaceDestroyPolicy = DestroyAfterFirstFlush;
-#endif
-
- m_graphicsSystem = QGraphicsSystemFactory::create(m_graphicsSystemName);
-
- QApplicationPrivate::graphics_system_name = QLatin1String("runtime");
-}
-
-
-QPixmapData *QRuntimeGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
- Q_ASSERT(m_graphicsSystem);
- QPixmapData *data = m_graphicsSystem->createPixmapData(type);
-
- QRuntimePixmapData *rtData = new QRuntimePixmapData(this, type);
- rtData->m_data = data;
- m_pixmapDatas << rtData;
-
- return rtData;
-}
-
-QWindowSurface *QRuntimeGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- Q_ASSERT(m_graphicsSystem);
- QRuntimeWindowSurface *rtSurface = new QRuntimeWindowSurface(this, widget);
- rtSurface->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget));
- widget->setWindowSurface(rtSurface);
- m_windowSurfaces << rtSurface;
- return rtSurface;
-}
-
-void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name)
-{
- if (m_graphicsSystemName == name)
- return;
-#ifdef QT_DEBUG
- qDebug() << "QRuntimeGraphicsSystem::setGraphicsSystem( " << name << " )";
-#endif
- QGraphicsSystem *oldSystem = m_graphicsSystem;
- m_graphicsSystem = QGraphicsSystemFactory::create(name);
- m_graphicsSystemName = name;
-
- Q_ASSERT(m_graphicsSystem);
-
- m_pendingGraphicsSystemName = QString();
-
- for (int i = 0; i < m_pixmapDatas.size(); ++i) {
- QRuntimePixmapData *proxy = m_pixmapDatas.at(i);
- QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data);
- newData->fromImage(proxy->m_data->toImage(), Qt::NoOpaqueDetection);
- delete proxy->m_data;
- proxy->m_data = newData;
- proxy->readBackInfo();
- }
-
- for (int i = 0; i < m_windowSurfaces.size(); ++i) {
- QRuntimeWindowSurface *proxy = m_windowSurfaces.at(i);
- QWidget *widget = proxy->m_windowSurface->window();
-
- if(m_windowSurfaceDestroyPolicy == DestroyAfterFirstFlush)
- proxy->m_pendingWindowSurface.reset(proxy->m_windowSurface.take());
-
- QWindowSurface *newWindowSurface = m_graphicsSystem->createWindowSurface(widget);
- newWindowSurface->setGeometry(proxy->geometry());
-
- proxy->m_windowSurface.reset(newWindowSurface);
- qt_widget_private(widget)->invalidateBuffer(widget->rect());
- }
-
- delete oldSystem;
-}
-
-void QRuntimeGraphicsSystem::removePixmapData(QRuntimePixmapData *pixmapData) const
-{
- int index = m_pixmapDatas.lastIndexOf(pixmapData);
- m_pixmapDatas.removeAt(index);
-}
-
-void QRuntimeGraphicsSystem::removeWindowSurface(QRuntimeWindowSurface *windowSurface) const
-{
- int index = m_windowSurfaces.lastIndexOf(windowSurface);
- m_windowSurfaces.removeAt(index);
-}
-
-#include "qgraphicssystem_runtime.moc"
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h
deleted file mode 100644
index 26d3777ad9..0000000000
--- a/src/gui/painting/qgraphicssystem_runtime_p.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_RUNTIME_P_H
-#define QGRAPHICSSYSTEM_RUNTIME_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qgraphicssystem_p.h"
-
-#include <private/qpixmapdata_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QRuntimeGraphicsSystem;
-
-class Q_GUI_EXPORT QRuntimePixmapData : public QPixmapData {
-public:
- QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type);
- ~QRuntimePixmapData();
-
- virtual QPixmapData *createCompatiblePixmapData() const;
- virtual void resize(int width, int height);
- virtual void fromImage(const QImage &image,
- Qt::ImageConversionFlags flags);
-
- virtual bool fromFile(const QString &filename, const char *format,
- Qt::ImageConversionFlags flags);
- virtual bool fromData(const uchar *buffer, uint len, const char *format,
- Qt::ImageConversionFlags flags);
-
- virtual void copy(const QPixmapData *data, const QRect &rect);
- virtual bool scroll(int dx, int dy, const QRect &rect);
-
- virtual int metric(QPaintDevice::PaintDeviceMetric metric) const;
- virtual void fill(const QColor &color);
- virtual QBitmap mask() const;
- virtual void setMask(const QBitmap &mask);
- virtual bool hasAlphaChannel() const;
- virtual QPixmap transformed(const QTransform &matrix,
- Qt::TransformationMode mode) const;
- virtual void setAlphaChannel(const QPixmap &alphaChannel);
- virtual QPixmap alphaChannel() const;
- virtual QImage toImage() const;
- virtual QPaintEngine *paintEngine() const;
-
- virtual QImage *buffer();
-
- void readBackInfo();
-
- QPixmapData *m_data;
-
-#if defined(Q_OS_SYMBIAN)
- void* toNativeType(NativeType type);
- void fromNativeType(void* pixmap, NativeType type);
-#endif
-
- virtual QPixmapData *runtimeData() const;
-
-private:
- const QRuntimeGraphicsSystem *m_graphicsSystem;
-
-};
-
-class QRuntimeWindowSurface : public QWindowSurface {
-public:
- QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window);
- ~QRuntimeWindowSurface();
-
- virtual QPaintDevice *paintDevice();
- virtual void flush(QWidget *widget, const QRegion &region,
- const QPoint &offset);
- virtual void setGeometry(const QRect &rect);
-
- virtual bool scroll(const QRegion &area, int dx, int dy);
-
- virtual void beginPaint(const QRegion &);
- virtual void endPaint(const QRegion &);
-
- virtual QImage* buffer(const QWidget *widget);
- virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const;
-
- virtual QPoint offset(const QWidget *widget) const;
-
- virtual WindowSurfaceFeatures features() const;
-
- QScopedPointer<QWindowSurface> m_windowSurface;
- QScopedPointer<QWindowSurface> m_pendingWindowSurface;
-
-private:
- const QRuntimeGraphicsSystem *m_graphicsSystem;
-};
-
-class QRuntimeGraphicsSystem : public QGraphicsSystem
-{
-public:
-
- enum WindowSurfaceDestroyPolicy
- {
- DestroyImmediately,
- DestroyAfterFirstFlush
- };
-
-public:
- QRuntimeGraphicsSystem();
-
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-
- void removePixmapData(QRuntimePixmapData *pixmapData) const;
- void removeWindowSurface(QRuntimeWindowSurface *windowSurface) const;
-
- void setGraphicsSystem(const QString &name);
- QString graphicsSystemName() const { return m_graphicsSystemName; }
-
- void setWindowSurfaceDestroyPolicy(WindowSurfaceDestroyPolicy policy)
- {
- m_windowSurfaceDestroyPolicy = policy;
- }
-
- int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; }
-
-
-private:
- int m_windowSurfaceDestroyPolicy;
- QGraphicsSystem *m_graphicsSystem;
- mutable QList<QRuntimePixmapData *> m_pixmapDatas;
- mutable QList<QRuntimeWindowSurface *> m_windowSurfaces;
- QString m_graphicsSystemName;
-
- QString m_pendingGraphicsSystemName;
-
- friend class QRuntimePixmapData;
- friend class QRuntimeWindowSurface;
- friend class QMeeGoGraphicsSystem;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp
deleted file mode 100644
index 62a60d77c0..0000000000
--- a/src/gui/painting/qgraphicssystemfactory.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystemfactory_p.h"
-#include "qgraphicssystemplugin_p.h"
-#include "private/qfactoryloader_p.h"
-#include "qmutex.h"
-
-#include "qapplication.h"
-#include <private/qapplication_p.h>
-#include "qgraphicssystem_raster_p.h"
-#include "qgraphicssystem_runtime_p.h"
-#include "qdebug.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QGraphicsSystemFactoryInterface_iid, QLatin1String("/graphicssystems"), Qt::CaseInsensitive))
-#endif
-
-QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key)
-{
- QGraphicsSystem *ret = 0;
- QString system = key.toLower();
-
-#if defined (QT_GRAPHICSSYSTEM_OPENGL)
- if (system.isEmpty()) {
- system = QLatin1String("opengl");
- }
-#elif defined (QT_GRAPHICSSYSTEM_OPENVG)
- if (system.isEmpty()) {
- system = QLatin1String("openvg");
- }
-#elif defined (QT_GRAPHICSSYSTEM_RUNTIME)
- if (system.isEmpty()) {
- system = QLatin1String("runtime");
- }
-#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11)
- if (system.isEmpty()) {
- system = QLatin1String("raster");
- }
-#endif
-
- QApplicationPrivate::graphics_system_name = system;
- if (system == QLatin1String("raster"))
- return new QRasterGraphicsSystem;
- else if (system == QLatin1String("runtime"))
- return new QRuntimeGraphicsSystem;
- else if (system.isEmpty() || system == QLatin1String("native"))
- return 0;
-
-#ifndef QT_NO_LIBRARY
- if (!ret) {
- if (QGraphicsSystemFactoryInterface *factory = qobject_cast<QGraphicsSystemFactoryInterface*>(loader()->instance(system)))
- ret = factory->create(system);
- }
-#endif
-
- if (!ret)
- qWarning() << "Unable to load graphicssystem" << system;
-
- return ret;
-}
-
-/*!
- Returns the list of valid keys, i.e. the keys this factory can
- create styles for.
-
- \sa create()
-*/
-QStringList QGraphicsSystemFactory::keys()
-{
-#ifndef QT_NO_LIBRARY
- QStringList list = loader()->keys();
-#else
- QStringList list;
-#endif
- if (!list.contains(QLatin1String("Raster")))
- list << QLatin1String("raster");
- return list;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/gui/painting/qgraphicssystemfactory_p.h b/src/gui/painting/qgraphicssystemfactory_p.h
deleted file mode 100644
index 8a2e2b14e0..0000000000
--- a/src/gui/painting/qgraphicssystemfactory_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEMFACTORY_H
-#define QGRAPHICSSYSTEMFACTORY_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QGraphicsSystem;
-
-class QGraphicsSystemFactory
-{
-public:
- static QStringList keys();
- static QGraphicsSystem *create(const QString&);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QGRAPHICSSYSTEMFACTORY_H
-
diff --git a/src/gui/painting/qgraphicssystemplugin.cpp b/src/gui/painting/qgraphicssystemplugin.cpp
deleted file mode 100644
index 8eb1278373..0000000000
--- a/src/gui/painting/qgraphicssystemplugin.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystemplugin_p.h"
-#include "qgraphicssystem_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QGraphicsSystemPlugin::QGraphicsSystemPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-QGraphicsSystemPlugin::~QGraphicsSystemPlugin()
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index 38f78e1a46..a7523fd3cb 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -731,42 +731,6 @@ QPainterPath QMatrix::map(const QPainterPath &path) const
}
/*!
- \fn QRegion QMatrix::mapToRegion(const QRect &rectangle) const
-
- Returns the transformed rectangle \a rectangle as a QRegion
- object. A rectangle which has been rotated or sheared may result
- in a non-rectangular region being returned.
-
- Use the mapToPolygon() or map() function instead.
-*/
-#ifdef QT3_SUPPORT
-QRegion QMatrix::mapToRegion(const QRect &rect) const
-{
- QRegion result;
- if (isIdentity()) {
- result = rect;
- } else if (m12() == 0.0F && m21() == 0.0F) {
- int x = qRound(m11()*rect.x() + dx());
- int y = qRound(m22()*rect.y() + dy());
- int w = qRound(m11()*rect.width());
- int h = qRound(m22()*rect.height());
- if (w < 0) {
- w = -w;
- x -= w - 1;
- }
- if (h < 0) {
- h = -h;
- y -= h - 1;
- }
- result = QRect(x, y, w, h);
- } else {
- result = QRegion(mapToPolygon(rect));
- }
- return result;
-
-}
-#endif
-/*!
\fn QPolygon QMatrix::mapToPolygon(const QRect &rectangle) const
Creates and returns a QPolygon representation of the given \a
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 898cfa4cf2..90b641ac91 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -118,12 +118,6 @@ public:
operator QVariant() const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT QMatrix invert(bool *invertible=0) const { return inverted(invertible); }
- inline QT3_SUPPORT QRect map(const QRect &r) const { return mapRect(r); }
- QT3_SUPPORT QRegion mapToRegion(const QRect &r) const;
-#endif
-
private:
inline QMatrix(bool)
: _m11(1.)
@@ -193,12 +187,6 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &);
Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &);
#endif
-#ifdef QT3_SUPPORT
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <QtGui/qwmatrix.h>
-QT_END_INCLUDE_NAMESPACE
-#endif
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index f2ba7f0744..8a0ccfb5f2 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -67,6 +67,20 @@ int QPaintDevice::metric(PaintDeviceMetric) const
}
#endif
+void QPaintDevice::init(QPainter *) const
+{
+}
+
+QPaintDevice *QPaintDevice::redirected(QPoint *) const
+{
+ return 0;
+}
+
+QPainter *QPaintDevice::sharedPainter() const
+{
+ return 0;
+}
+
Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric)
{
return device->metric(metric);
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 67db3f653f..0d584bff07 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -105,61 +105,22 @@ public:
protected:
QPaintDevice();
virtual int metric(PaintDeviceMetric metric) const;
+ virtual void init(QPainter *painter) const;
+ virtual QPaintDevice *redirected(QPoint *offset) const;
+ virtual QPainter *sharedPainter() const;
ushort painters; // refcount
private:
Q_DISABLE_COPY(QPaintDevice)
-#if defined(Q_WS_X11) && defined(QT3_SUPPORT)
-public:
- QT3_SUPPORT Display *x11Display() const;
- QT3_SUPPORT int x11Screen() const;
- QT3_SUPPORT int x11Depth() const;
- QT3_SUPPORT int x11Cells() const;
- QT3_SUPPORT Qt::HANDLE x11Colormap() const;
- QT3_SUPPORT bool x11DefaultColormap() const;
- QT3_SUPPORT void *x11Visual() const;
- QT3_SUPPORT bool x11DefaultVisual() const;
-
- static QT3_SUPPORT Display *x11AppDisplay();
- static QT3_SUPPORT int x11AppScreen();
- static QT3_SUPPORT int x11AppDepth(int screen = -1);
- static QT3_SUPPORT int x11AppCells(int screen = -1);
- static QT3_SUPPORT Qt::HANDLE x11AppRootWindow(int screen = -1);
- static QT3_SUPPORT Qt::HANDLE x11AppColormap(int screen = -1);
- static QT3_SUPPORT void *x11AppVisual(int screen = -1);
- static QT3_SUPPORT bool x11AppDefaultColormap(int screen =-1);
- static QT3_SUPPORT bool x11AppDefaultVisual(int screen =-1);
- static QT3_SUPPORT int x11AppDpiX(int screen = -1);
- static QT3_SUPPORT int x11AppDpiY(int screen = -1);
- static QT3_SUPPORT void x11SetAppDpiX(int, int);
- static QT3_SUPPORT void x11SetAppDpiY(int, int);
-#endif
-
friend class QPainter;
+ friend class QPainterPrivate;
friend class QFontEngineMac;
friend class QX11PaintEngine;
friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric);
};
-#ifdef QT3_SUPPORT
-QT3_SUPPORT Q_GUI_EXPORT
-void bitBlt(QPaintDevice *dst, int dx, int dy,
- const QPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
- bool ignoreMask=false);
-
-QT3_SUPPORT Q_GUI_EXPORT
-void bitBlt(QPaintDevice *dst, int dx, int dy,
- const QImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
- int conversion_flags=0);
-
-QT3_SUPPORT Q_GUI_EXPORT
-void bitBlt(QPaintDevice *dst, const QPoint &dp,
- const QPaintDevice *src, const QRect &sr=QRect(0,0,-1,-1),
- bool ignoreMask=false);
-#endif
-
/*****************************************************************************
Inline functions
*****************************************************************************/
diff --git a/src/gui/painting/qpaintdevice_qws.cpp b/src/gui/painting/qpaintdevice_qws.cpp
deleted file mode 100644
index 6f9433ab62..0000000000
--- a/src/gui/painting/qpaintdevice_qws.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpaintdevice.h"
-#include "qpainter.h"
-#include "qwidget.h"
-#include "qbitmap.h"
-#include "qapplication.h"
-#include "qwsdisplay_qws.h"
-
-QT_BEGIN_NAMESPACE
-
-QWSDisplay *QPaintDevice::qwsDisplay()
-{
- return qt_fbdpy;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintdevice_x11.cpp b/src/gui/painting/qpaintdevice_x11.cpp
index b6be0761c5..690dea99d7 100644
--- a/src/gui/painting/qpaintdevice_x11.cpp
+++ b/src/gui/painting/qpaintdevice_x11.cpp
@@ -81,118 +81,4 @@ const Q_GUI_EXPORT QX11Info *qt_x11Info(const QPaintDevice *pd)
return 0;
}
-
-
-#ifdef QT3_SUPPORT
-
-Display *QPaintDevice::x11Display() const
-{
- return X11->display;
-}
-
-int QPaintDevice::x11Screen() const
-{
- const QX11Info *info = qt_x11Info(this);
- if (info)
- return info->screen();
- return QX11Info::appScreen();
-}
-
-void *QPaintDevice::x11Visual() const
-{
- const QX11Info *info = qt_x11Info(this);
- if (info)
- return info->visual();
- return QX11Info::appVisual();
-}
-
-int QPaintDevice::x11Depth() const
-{
- const QX11Info *info = qt_x11Info(this);
- if (info)
- return info->depth();
- return QX11Info::appDepth();
-}
-
-int QPaintDevice::x11Cells() const
-{
- const QX11Info *info = qt_x11Info(this);
- if (info)
- return info->cells();
- return QX11Info::appCells();
-}
-
-Qt::HANDLE QPaintDevice::x11Colormap() const
-{
- const QX11Info *info = qt_x11Info(this);
- if (info)
- return info->colormap();
- return QX11Info::appColormap();
-}
-
-bool QPaintDevice::x11DefaultColormap() const
-{
- const QX11Info *info = qt_x11Info(this);
- if (info)
- return info->defaultColormap();
- return QX11Info::appDefaultColormap();
-}
-
-bool QPaintDevice::x11DefaultVisual() const
-{
- const QX11Info *info = qt_x11Info(this);
- if (info)
- return info->defaultVisual();
- return QX11Info::appDefaultVisual();
-}
-
-void *QPaintDevice::x11AppVisual(int screen)
-{ return QX11Info::appVisual(screen); }
-
-Qt::HANDLE QPaintDevice::x11AppColormap(int screen)
-{ return QX11Info::appColormap(screen); }
-
-Display *QPaintDevice::x11AppDisplay()
-{ return QX11Info::display(); }
-
-int QPaintDevice::x11AppScreen()
-{ return QX11Info::appScreen(); }
-
-int QPaintDevice::x11AppDepth(int screen)
-{ return QX11Info::appDepth(screen); }
-
-int QPaintDevice::x11AppCells(int screen)
-{ return QX11Info::appCells(screen); }
-
-Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen)
-{ return QX11Info::appRootWindow(screen); }
-
-bool QPaintDevice::x11AppDefaultColormap(int screen)
-{ return QX11Info::appDefaultColormap(screen); }
-
-bool QPaintDevice::x11AppDefaultVisual(int screen)
-{ return QX11Info::appDefaultVisual(screen); }
-
-void QPaintDevice::x11SetAppDpiX(int dpi, int screen)
-{
- QX11Info::setAppDpiX(dpi, screen);
-}
-
-void QPaintDevice::x11SetAppDpiY(int dpi, int screen)
-{
- QX11Info::setAppDpiY(dpi, screen);
-}
-
-int QPaintDevice::x11AppDpiX(int screen)
-{
- return QX11Info::appDpiX(screen);
-}
-
-int QPaintDevice::x11AppDpiY(int screen)
-{
- return QX11Info::appDpiY(screen);
-}
-#endif
-
-
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 6eb09e5966..97736263ed 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -43,7 +43,6 @@
#include "qpainter_p.h"
#include "qpolygon.h"
#include "qbitmap.h"
-#include "qapplication.h"
#include <qdebug.h>
#include <qmath.h>
#include <private/qtextengine_p.h>
@@ -139,7 +138,7 @@ QString QTextItem::text() const
QFont QTextItem::font() const
{
const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
- return ti->f ? *ti->f : QApplication::font();
+ return ti->f ? *ti->f : QGuiApplication::font();
}
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 500748e159..88028b2137 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -44,7 +44,6 @@
#include "private/qblittable_p.h"
#include "private/qpaintengine_raster_p.h"
#include "private/qpainter_p.h"
-#include "private/qapplication_p.h"
#include "private/qpixmap_blitter_p.h"
#ifndef QT_NO_BLITTABLE
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index d6aaffc254..c444663904 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -66,7 +66,7 @@ class QPaintEnginePrivate
{
Q_DECLARE_PUBLIC(QPaintEngine)
public:
- QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipWidget(0), hasSystemTransform(0),
+ QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipDevice(0), hasSystemTransform(0),
hasSystemViewport(0) {}
virtual ~QPaintEnginePrivate() { }
QPaintDevice *pdev;
@@ -75,7 +75,7 @@ public:
QRect systemRect;
QRegion systemViewport;
QTransform systemTransform;
- QWidget *currentClipWidget;
+ QPaintDevice *currentClipDevice;
uint hasSystemTransform : 1;
uint hasSystemViewport : 1;
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 69025436c2..9c86172753 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -51,7 +51,6 @@
#include <qpainterpath.h>
#include <qdebug.h>
#include <qhash.h>
-#include <qlabel.h>
#include <qbitmap.h>
#include <qmath.h>
@@ -86,14 +85,6 @@
# include <private/qt_mac_p.h>
# include <private/qpixmap_mac_p.h>
# include <private/qpaintengine_mac_p.h>
-#elif defined(Q_WS_QWS)
-# if !defined(QT_NO_FREETYPE)
-# include <private/qfontengine_ft_p.h>
-# endif
-# if !defined(QT_NO_QWS_QPF2)
-# include <private/qfontengine_qpf_p.h>
-# endif
-# include <private/qabstractfontengine_p.h>
#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
# include <private/qfontengine_s60_p.h>
#elif defined(Q_WS_QPA)
@@ -384,11 +375,6 @@ void QRasterPaintEngine::init()
case QInternal::Image:
format = d->rasterBuffer->prepare(static_cast<QImage *>(d->device));
break;
-#ifdef Q_WS_QWS
- case QInternal::CustomRaster:
- d->rasterBuffer->prepare(static_cast<QCustomRasterPaintDevice*>(d->device));
- break;
-#endif
default:
qWarning("QRasterPaintEngine: unsupported target device %d\n", d->device->devType());
d->device = 0;
@@ -986,13 +972,6 @@ void QRasterPaintEngine::clipEnabledChanged()
}
}
-#ifdef Q_WS_QWS
-void QRasterPaintEnginePrivate::prepare(QCustomRasterPaintDevice *device)
-{
- rasterBuffer->prepare(device);
-}
-#endif
-
void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
const QImage &img,
SrcOverBlendFunc func,
@@ -3456,22 +3435,6 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
QFontEngine *fontEngine = ti.fontEngine;
-#if defined(Q_WS_QWS)
- if (fontEngine->type() == QFontEngine::Box) {
- fontEngine->draw(this, qFloor(p.x()), qFloor(p.y()), ti);
- return;
- }
-
- if (s->matrix.type() < QTransform::TxScale
- && (fontEngine->type() == QFontEngine::QPF1 || fontEngine->type() == QFontEngine::QPF2
- || (fontEngine->type() == QFontEngine::Proxy
- && !(static_cast<QProxyFontEngine *>(fontEngine)->drawAsOutline()))
- )) {
- fontEngine->draw(this, qFloor(p.x()), qFloor(p.y()), ti);
- return;
- }
-#endif // Q_WS_QWS
-
#ifdef Q_WS_QPA
if (s->matrix.type() < QTransform::TxScale) {
@@ -3501,14 +3464,6 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE)
-#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2)
- if (fontEngine->type() == QFontEngine::QPF2) {
- QFontEngine *renderingEngine = static_cast<QFontEngineQPF *>(fontEngine)->renderingEngine();
- if (renderingEngine)
- fontEngine = renderingEngine;
- }
-#endif
-
if (fontEngine->type() != QFontEngine::Freetype) {
QPaintEngineEx::drawTextItem(p, ti);
return;
@@ -3878,59 +3833,6 @@ QPoint QRasterPaintEngine::coordinateOffset() const
return QPoint(0, 0);
}
-/*!
- Draws the given color \a spans with the specified \a color. The \a
- count parameter specifies the number of spans.
-
- The default implementation does nothing; reimplement this function
- to draw the given color \a spans with the specified \a color. Note
- that this function \e must be reimplemented if the framebuffer is
- not memory-mapped.
-
- \sa drawBufferSpan()
-*/
-#if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
-void QRasterPaintEngine::drawColorSpans(const QSpan *spans, int count, uint color)
-{
- Q_UNUSED(spans);
- Q_UNUSED(count);
- Q_UNUSED(color);
- qFatal("QRasterPaintEngine::drawColorSpans must be reimplemented on "
- "a non memory-mapped device");
-}
-
-/*!
- \fn void QRasterPaintEngine::drawBufferSpan(const uint *buffer, int size, int x, int y, int length, uint alpha)
-
- Draws the given \a buffer.
-
- The default implementation does nothing; reimplement this function
- to draw a buffer that contains more than one color. Note that this
- function \e must be reimplemented if the framebuffer is not
- memory-mapped.
-
- The \a size parameter specifies the total size of the given \a
- buffer, while the \a length parameter specifies the number of
- pixels to draw. The buffer's position is given by (\a x, \a
- y). The provided \a alpha value is added to each pixel in the
- buffer when drawing.
-
- \sa drawColorSpans()
-*/
-void QRasterPaintEngine::drawBufferSpan(const uint *buffer, int bufsize,
- int x, int y, int length, uint const_alpha)
-{
- Q_UNUSED(buffer);
- Q_UNUSED(bufsize);
- Q_UNUSED(x);
- Q_UNUSED(y);
- Q_UNUSED(length);
- Q_UNUSED(const_alpha);
- qFatal("QRasterPaintEngine::drawBufferSpan must be reimplemented on "
- "a non memory-mapped device");
-}
-#endif // Q_WS_QWS
-
void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fg)
{
Q_ASSERT(fg);
@@ -4378,127 +4280,6 @@ void QRasterBuffer::resetBuffer(int val)
memset(m_buffer, val, m_height*bytes_per_line);
}
-
-#if defined(Q_WS_QWS)
-void QRasterBuffer::prepare(QCustomRasterPaintDevice *device)
-{
- m_buffer = reinterpret_cast<uchar*>(device->memory());
- m_width = qMin(QT_RASTER_COORD_LIMIT, device->width());
- m_height = qMin(QT_RASTER_COORD_LIMIT, device->height());
- bytes_per_pixel = device->depth() / 8;
- bytes_per_line = device->bytesPerLine();
- format = device->format();
-#ifndef QT_NO_RASTERCALLBACKS
- if (!m_buffer)
- drawHelper = qDrawHelperCallback + format;
- else
-#endif
- drawHelper = qDrawHelper + format;
-}
-
-int QCustomRasterPaintDevice::metric(PaintDeviceMetric m) const
-{
- switch (m) {
- case PdmWidth:
- return widget->frameGeometry().width();
- case PdmHeight:
- return widget->frameGeometry().height();
- default:
- break;
- }
-
- return qt_paint_device_metric(widget, m);
-}
-
-int QCustomRasterPaintDevice::bytesPerLine() const
-{
- return (width() * depth() + 7) / 8;
-}
-
-#elif defined(Q_OS_SYMBIAN)
-
-void QRasterBuffer::prepareBuffer(int /* width */, int /* height */)
-{
-}
-
-#endif // Q_OS_SYMBIAN
-
-/*!
- \class QCustomRasterPaintDevice
- \preliminary
- \ingroup qws
- \since 4.2
-
- \brief The QCustomRasterPaintDevice class is provided to activate
- hardware accelerated paint engines in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- In \l{Qt for Embedded Linux}, painting is a pure software
- implementation. But starting with Qt 4.2, it is
- possible to add an accelerated graphics driver to take advantage
- of available hardware resources.
-
- Hardware acceleration is accomplished by creating a custom screen
- driver, accelerating the copying from memory to the screen, and
- implementing a custom paint engine accelerating the various
- painting operations. Then a custom paint device (derived from the
- QCustomRasterPaintDevice class) and a custom window surface
- (derived from QWSWindowSurface) must be implemented to make
- \l{Qt for Embedded Linux} aware of the accelerated driver.
-
- See the \l {Adding an Accelerated Graphics Driver to Qt for Embedded Linux}
- documentation for details.
-
- \sa QRasterPaintEngine, QPaintDevice
-*/
-
-/*!
- \fn QCustomRasterPaintDevice::QCustomRasterPaintDevice(QWidget *widget)
-
- Constructs a custom raster based paint device for the given
- top-level \a widget.
-*/
-
-/*!
- \fn int QCustomRasterPaintDevice::bytesPerLine() const
-
- Returns the number of bytes per line in the framebuffer. Note that
- this number might be larger than the framebuffer width.
-*/
-
-/*!
- \fn int QCustomRasterPaintDevice::devType() const
- \internal
-*/
-
-/*!
- \fn QImage::Format QCustomRasterPaintDevice::format() const
-
- Returns the format of the device's memory buffet.
-
- The default format is QImage::Format_ARGB32_Premultiplied. The
- only other valid format is QImage::Format_RGB16.
-*/
-
-/*!
- \fn void * QCustomRasterPaintDevice::memory () const
-
- Returns a pointer to the paint device's memory buffer, or 0 if no
- such buffer exists.
-*/
-
-/*!
- \fn int QCustomRasterPaintDevice::metric ( PaintDeviceMetric m ) const
- \reimp
-*/
-
-/*!
- \fn QSize QCustomRasterPaintDevice::size () const
- \internal
-*/
-
-
QClipData::QClipData(int height)
{
clipSpanHeight = height;
@@ -5145,9 +4926,6 @@ Q_GLOBAL_STATIC(QGradientCache, qt_gradient_cache)
void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe)
{
rasterBuffer = rb;
-#ifdef Q_WS_QWS
- rasterEngine = const_cast<QRasterPaintEngine *>(pe);
-#endif
type = None;
txop = 0;
bilinear = false;
@@ -5292,16 +5070,7 @@ void QSpanData::adjustSpanMethods()
unclipped_blend = rasterBuffer->drawHelper->blendGradient;
break;
case Texture:
-#ifdef Q_WS_QWS
-#ifndef QT_NO_RASTERCALLBACKS
- if (!rasterBuffer->buffer())
- unclipped_blend = qBlendTextureCallback;
- else
-#endif
- unclipped_blend = qBlendTexture;
-#else
unclipped_blend = qBlendTexture;
-#endif
if (!texture.imageData)
unclipped_blend = 0;
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 52f51fab16..0cffabea23 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -72,7 +72,6 @@ class QOutlineMapper;
class QRasterPaintEnginePrivate;
class QRasterBuffer;
class QClipData;
-class QCustomRasterPaintDevice;
class QRasterPaintEngineState : public QPainterState
{
@@ -129,11 +128,7 @@ public:
/*******************************************************************************
* QRasterPaintEngine
*/
-class
-#ifdef Q_WS_QWS
-Q_GUI_EXPORT
-#endif
-QRasterPaintEngine : public QPaintEngineEx
+class QRasterPaintEngine : public QPaintEngineEx
{
Q_DECLARE_PRIVATE(QRasterPaintEngine)
public:
@@ -244,12 +239,6 @@ public:
QPoint coordinateOffset() const;
-#if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS)
- virtual void drawColorSpans(const QSpan *spans, int count, uint color);
- virtual void drawBufferSpan(const uint *buffer, int bufsize,
- int x, int y, int length, uint const_alpha);
-#endif
-
protected:
QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *);
private:
@@ -296,11 +285,7 @@ private:
/*******************************************************************************
* QRasterPaintEnginePrivate
*/
-class
-#ifdef Q_WS_QWS
-Q_GUI_EXPORT
-#endif
-QRasterPaintEnginePrivate : public QPaintEngineExPrivate
+class QRasterPaintEnginePrivate : public QPaintEngineExPrivate
{
Q_DECLARE_PUBLIC(QRasterPaintEngine)
public:
@@ -333,10 +318,6 @@ public:
ProcessSpans getBrushFunc(const QRect &rect, const QSpanData *data) const;
ProcessSpans getBrushFunc(const QRectF &rect, const QSpanData *data) const;
-#ifdef Q_WS_QWS
- void prepare(QCustomRasterPaintDevice *);
-#endif
-
inline const QClipData *clip() const;
void initializeRasterizer(QSpanData *data);
@@ -384,11 +365,7 @@ public:
};
-class
-#ifdef Q_WS_QWS
-Q_GUI_EXPORT
-#endif
-QClipData {
+class QClipData {
public:
QClipData(int height);
~QClipData();
@@ -465,41 +442,10 @@ inline void QClipData::appendSpans(const QSpan *s, int num)
count += num;
}
-#ifdef Q_WS_QWS
-class Q_GUI_EXPORT QCustomRasterPaintDevice : public QPaintDevice
-{
-public:
- QCustomRasterPaintDevice(QWidget *w) : widget(w) {}
-
- int devType() const { return QInternal::CustomRaster; }
-
- virtual int metric(PaintDeviceMetric m) const;
-
- virtual void* memory() const { return 0; }
-
- virtual QImage::Format format() const {
- return QImage::Format_ARGB32_Premultiplied;
- }
-
- virtual int bytesPerLine() const;
-
- virtual QSize size() const {
- return static_cast<QRasterPaintEngine*>(paintEngine())->size();
- }
-
-private:
- QWidget *widget;
-};
-#endif // Q_WS_QWS
-
/*******************************************************************************
* QRasterBuffer
*/
-class
-#ifdef Q_WS_QWS
-Q_GUI_EXPORT
-#endif
-QRasterBuffer
+class QRasterBuffer
{
public:
QRasterBuffer() : m_width(0), m_height(0), m_buffer(0) { init(); }
@@ -510,9 +456,6 @@ public:
QImage::Format prepare(QImage *image);
QImage::Format prepare(QPixmap *pix);
-#ifdef Q_WS_QWS
- void prepare(QCustomRasterPaintDevice *device);
-#endif
void prepare(int w, int h);
void prepareBuffer(int w, int h);
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 94828fba53..1256996491 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -79,7 +79,7 @@
#include <private/qtessellator_p.h>
#endif
-#include <private/qstylehelper_p.h>
+#include <private/qhexstring_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index b7686fa7fe..929685db53 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -56,9 +56,6 @@
#include "qpixmapcache.h"
#include "qpolygon.h"
#include "qtextlayout.h"
-#include "qwidget.h"
-#include "qapplication.h"
-#include "qstyle.h"
#include "qthread.h"
#include "qvarlengtharray.h"
#include "qstatictext.h"
@@ -69,12 +66,12 @@
#include <private/qemulationpaintengine_p.h>
#include <private/qpainterpath_p.h>
#include <private/qtextengine_p.h>
-#include <private/qwidget_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qmath_p.h>
#include <private/qstatictext_p.h>
#include <private/qglyphs_p.h>
-#include <private/qstylehelper_p.h>
+#include <private/qhexstring_p.h>
+#include <private/qguiapplication_p.h>
#include <private/qrawfont_p.h>
QT_BEGIN_NAMESPACE
@@ -250,34 +247,10 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
Q_ASSERT(q);
Q_ASSERT(pdev);
- if (pdev->devType() != QInternal::Widget)
+ QPainter *sp = pdev->sharedPainter();
+ if (!sp)
return false;
- QWidget *widget = static_cast<QWidget *>(pdev);
- Q_ASSERT(widget);
-
- // Someone either called QPainter::setRedirected in the widget's paint event
- // right before this painter was created (or begin was called) or
- // sent a paint event directly to the widget.
- if (!widget->d_func()->redirectDev)
- return false;
-
- QPainter *sp = widget->d_func()->sharedPainter();
- if (!sp || !sp->isActive())
- return false;
-
- if (sp->paintEngine()->paintDevice() != widget->d_func()->redirectDev)
- return false;
-
- // Check if we're attempting to paint outside a paint event.
- if (!sp->d_ptr->engine->hasFeature(QPaintEngine::PaintOutsidePaintEvent)
- && !widget->testAttribute(Qt::WA_PaintOutsidePaintEvent)
- && !widget->testAttribute(Qt::WA_WState_InPaintEvent)) {
-
- qWarning("QPainter::begin: Widget painting can only begin as a result of a paintEvent");
- return false;
- }
-
// Save the current state of the shared painter and assign
// the current d_ptr to the shared painter's d_ptr.
sp->save();
@@ -301,14 +274,14 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
Q_ASSERT(q->d_ptr->state);
// Now initialize the painter with correct widget properties.
- q->initFrom(widget);
+ q->initFrom(pdev);
QPoint offset;
- widget->d_func()->redirected(&offset);
+ pdev->redirected(&offset);
offset += q->d_ptr->engine->coordinateOffset();
// Update system rect.
- q->d_ptr->state->ww = q->d_ptr->state->vw = widget->width();
- q->d_ptr->state->wh = q->d_ptr->state->vh = widget->height();
+ q->d_ptr->state->ww = q->d_ptr->state->vw = pdev->width();
+ q->d_ptr->state->wh = q->d_ptr->state->vh = pdev->height();
// Update matrix.
if (q->d_ptr->state->WxF) {
@@ -322,13 +295,13 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
q->d_ptr->updateMatrix();
QPaintEnginePrivate *enginePrivate = q->d_ptr->engine->d_func();
- if (enginePrivate->currentClipWidget == widget) {
+ if (enginePrivate->currentClipDevice == pdev) {
enginePrivate->systemStateChanged();
return true;
}
// Update system transform and clip.
- enginePrivate->currentClipWidget = widget;
+ enginePrivate->currentClipDevice = pdev;
enginePrivate->setSystemTransform(q->d_ptr->state->matrix);
return true;
}
@@ -1371,10 +1344,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
only use the format types QImage::Format_ARGB32_Premultiplied,
QImage::Format_RGB32 or QImage::Format_RGB16. Any other format,
including QImage::Format_ARGB32, has significantly worse
- performance. This engine is also used by default on Windows and on
- QWS. It can be used as default graphics system on any
- OS/hardware/software combination by passing \c {-graphicssystem
- raster} on the command line
+ performance. This engine is used by default for QWidget and QPixmap.
\o OpenGL 2.0 (ES) - This backend is the primary backend for
hardware accelerated graphics. It can be run on desktop machines
@@ -1542,8 +1512,8 @@ QPainter::~QPainter()
QPaintDevice *QPainter::device() const
{
Q_D(const QPainter);
- if (isActive() && d->engine->d_func()->currentClipWidget)
- return d->engine->d_func()->currentClipWidget;
+ if (isActive() && d->engine->d_func()->currentClipDevice)
+ return d->engine->d_func()->currentClipDevice;
return d->original_device;
}
@@ -1562,25 +1532,23 @@ bool QPainter::isActive() const
/*!
Initializes the painters pen, background and font to the same as
- the given \a widget. This function is called automatically when the
- painter is opened on a QWidget.
+ the given \a paint device.
+
+ \obsolete
\sa begin(), {QPainter#Settings}{Settings}
*/
-void QPainter::initFrom(const QWidget *widget)
+void QPainter::initFrom(const QPaintDevice *device)
{
- Q_ASSERT_X(widget, "QPainter::initFrom(const QWidget *widget)", "Widget cannot be 0");
+ Q_ASSERT_X(device, "QPainter::initFrom(const QPaintDevice *device)", "QPaintDevice cannot be 0");
Q_D(QPainter);
if (!d->engine) {
qWarning("QPainter::initFrom: Painter not active, aborted");
return;
}
- const QPalette &pal = widget->palette();
- d->state->pen = QPen(pal.brush(widget->foregroundRole()), 0);
- d->state->bgBrush = pal.brush(widget->backgroundRole());
- d->state->deviceFont = QFont(widget->font(), const_cast<QWidget*> (widget));
- d->state->font = d->state->deviceFont;
+ device->init(this);
+
if (d->extended) {
d->extended->penChanged();
} else if (d->engine) {
@@ -1753,22 +1721,9 @@ bool QPainter::begin(QPaintDevice *pd)
d->helper_device = pd;
d->original_device = pd;
- QPaintDevice *rpd = 0;
QPoint redirectionOffset;
- // We know for sure that redirection is broken when the widget is inside
- // its paint event, so it's safe to use our hard-coded redirection. However,
- // there IS one particular case we still need to support, and that's
- // when people call QPainter::setRedirected in the widget's paint event right
- // before any painter is created (or QPainter::begin is called). In that
- // particular case our hard-coded redirection is restored and the redirection
- // is retrieved from QPainter::redirected (as before).
- if (pd->devType() == QInternal::Widget)
- rpd = static_cast<QWidget *>(pd)->d_func()->redirected(&redirectionOffset);
-
- if (!rpd)
- rpd = redirected(pd, &redirectionOffset);
-
+ QPaintDevice *rpd = pd->redirected(&redirectionOffset);
if (rpd)
pd = rpd;
@@ -1811,6 +1766,8 @@ bool QPainter::begin(QPaintDevice *pd)
d->engine->state = d->state;
switch (pd->devType()) {
+#if 0
+ // is this needed any more??
case QInternal::Widget:
{
const QWidget *widget = static_cast<const QWidget *>(pd);
@@ -1818,13 +1775,6 @@ bool QPainter::begin(QPaintDevice *pd)
const bool paintOutsidePaintEvent = widget->testAttribute(Qt::WA_PaintOutsidePaintEvent);
const bool inPaintEvent = widget->testAttribute(Qt::WA_WState_InPaintEvent);
- if(!d->engine->hasFeature(QPaintEngine::PaintOutsidePaintEvent)
- && !paintOutsidePaintEvent && !inPaintEvent) {
- qWarning("QPainter::begin: Widget painting can only begin as a "
- "result of a paintEvent");
- qt_cleanup_painter_state(d);
- return false;
- }
// Adjust offset for alien widgets painting outside the paint event.
if (!inPaintEvent && paintOutsidePaintEvent && !widget->internalWinId()
@@ -1834,6 +1784,7 @@ bool QPainter::begin(QPaintDevice *pd)
}
break;
}
+#endif
case QInternal::Pixmap:
{
QPixmap *pm = static_cast<QPixmap *>(pd);
@@ -1894,8 +1845,7 @@ bool QPainter::begin(QPaintDevice *pd)
// Copy painter properties from original paint device,
// required for QPixmap::grabWidget()
if (d->original_device->devType() == QInternal::Widget) {
- QWidget *widget = static_cast<QWidget *>(d->original_device);
- initFrom(widget);
+ initFrom(d->original_device);
} else {
d->state->layoutDirection = Qt::LayoutDirectionAuto;
// make sure we have a font compatible with the paintdevice
@@ -4608,82 +4558,6 @@ void QPainter::drawChord(const QRectF &r, int a, int alen)
startAngle and \a spanAngle.
*/
-#ifdef QT3_SUPPORT
-/*!
- \fn void QPainter::drawLineSegments(const QPolygon &polygon, int
- index, int count)
-
- Draws \a count separate lines from points defined by the \a
- polygon, starting at \a{polygon}\e{[index]} (\a index defaults to
- 0). If \a count is -1 (the default) all points until the end of
- the array are used.
-
- Use drawLines() combined with QPolygon::constData() instead.
-
- \oldcode
- QPainter painter(this);
- painter.drawLineSegments(polygon, index, count);
- \newcode
- int lineCount = (count == -1) ? (polygon.size() - index) / 2 : count;
-
- QPainter painter(this);
- painter.drawLines(polygon.constData() + index * 2, lineCount);
- \endcode
-*/
-
-void QPainter::drawLineSegments(const QPolygon &a, int index, int nlines)
-{
-#ifdef QT_DEBUG_DRAW
- if (qt_show_painter_debug_output)
- printf("QPainter::drawLineSegments(), count=%d\n", a.size()/2);
-#endif
- Q_D(QPainter);
-
- if (!d->engine)
- return;
-
- if (nlines < 0)
- nlines = a.size()/2 - index/2;
- if (index + nlines*2 > (int)a.size())
- nlines = (a.size() - index)/2;
- if (nlines < 1 || index < 0)
- return;
-
- if (d->extended) {
- // FALCON: Use QVectorPath
- QVector<QLineF> lines;
- for (int i=index; i<index + nlines*2; i+=2)
- lines << QLineF(a.at(i), a.at(i+1));
- d->extended->drawLines(lines.data(), lines.size());
- return;
- }
-
- d->updateState(d->state);
-
- QVector<QLineF> lines;
- if (d->state->emulationSpecifier) {
- if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
- && d->state->matrix.type() == QTransform::TxTranslate) {
- QPointF offset(d->state->matrix.dx(), d->state->matrix.dy());
- for (int i=index; i<index + nlines*2; i+=2)
- lines << QLineF(a.at(i) + offset, a.at(i+1) + offset);
- } else {
- QPainterPath linesPath;
- for (int i=index; i<index + nlines*2; i+=2) {
- linesPath.moveTo(a.at(i));
- linesPath.lineTo(a.at(i+1));
- }
- d->draw_helper(linesPath, QPainterPrivate::StrokeDraw);
- return;
- }
- } else {
- for (int i=index; i<index + nlines*2; i+=2)
- lines << QLineF(a.at(i), a.at(i+1));
- }
-
- d->engine->drawLines(lines.data(), lines.size());
-}
-#endif // QT3_SUPPORT
/*!
Draws the first \a lineCount lines in the array \a lines
@@ -6457,7 +6331,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
const qreal underlinePos = pos.y() + qCeil(underlineOffset) - aliasedCoordinateDelta;
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
- underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle));
+ underlineStyle = QTextCharFormat::SpellCheckUnderline; // ### Qt5 QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle));
}
if (underlineStyle == QTextCharFormat::WaveUnderline) {
@@ -7496,307 +7370,6 @@ void QPainter::setViewTransformEnabled(bool enable)
d->updateMatrix();
}
-#ifdef QT3_SUPPORT
-
-/*!
- \obsolete
-
- Use the worldTransform() combined with QTransform::dx() instead.
-
- \oldcode
- QPainter painter(this);
- qreal x = painter.translationX();
- \newcode
- QPainter painter(this);
- qreal x = painter.worldTransform().dx();
- \endcode
-*/
-qreal QPainter::translationX() const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::translationX: Painter not active");
- return 0.0;
- }
- return d->state->worldMatrix.dx();
-}
-
-/*!
- \obsolete
-
- Use the worldTransform() combined with QTransform::dy() instead.
-
- \oldcode
- QPainter painter(this);
- qreal y = painter.translationY();
- \newcode
- QPainter painter(this);
- qreal y = painter.worldTransform().dy();
- \endcode
-*/
-qreal QPainter::translationY() const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::translationY: Painter not active");
- return 0.0;
- }
- return d->state->worldMatrix.dy();
-}
-
-/*!
- \fn void QPainter::map(int x, int y, int *rx, int *ry) const
-
- \internal
-
- Sets (\a{rx}, \a{ry}) to the point that results from applying the
- painter's current transformation on the point (\a{x}, \a{y}).
-*/
-void QPainter::map(int x, int y, int *rx, int *ry) const
-{
- QPoint p(x, y);
- p = p * combinedMatrix();
- *rx = p.x();
- *ry = p.y();
-}
-
-/*!
- \fn QPoint QPainter::xForm(const QPoint &point) const
-
- Use combinedTransform() instead.
-*/
-
-QPoint QPainter::xForm(const QPoint &p) const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::xForm: Painter not active");
- return QPoint();
- }
- if (d->state->matrix.type() == QTransform::TxNone)
- return p;
- return p * combinedMatrix();
-}
-
-
-/*!
- \fn QRect QPainter::xForm(const QRect &rectangle) const
- \overload
-
- Use combinedTransform() instead of this function and call
- mapRect() on the result to obtain a QRect.
-*/
-
-QRect QPainter::xForm(const QRect &r) const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::xForm: Painter not active");
- return QRect();
- }
- if (d->state->matrix.type() == QTransform::TxNone)
- return r;
- return combinedMatrix().mapRect(r);
-}
-
-/*!
- \fn QPolygon QPainter::xForm(const QPolygon &polygon) const
- \overload
-
- Use combinedTransform() instead.
-*/
-
-QPolygon QPainter::xForm(const QPolygon &a) const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::xForm: Painter not active");
- return QPolygon();
- }
- if (d->state->matrix.type() == QTransform::TxNone)
- return a;
- return a * combinedMatrix();
-}
-
-/*!
- \fn QPolygon QPainter::xForm(const QPolygon &polygon, int index, int count) const
- \overload
-
- Use combinedTransform() combined with QPolygon::mid() instead.
-
- \oldcode
- QPainter painter(this);
- QPolygon transformed = painter.xForm(polygon, index, count)
- \newcode
- QPainter painter(this);
- QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform();
- \endcode
-*/
-
-QPolygon QPainter::xForm(const QPolygon &av, int index, int npoints) const
-{
- int lastPoint = npoints < 0 ? av.size() : index+npoints;
- QPolygon a(lastPoint-index);
- memcpy(a.data(), av.data()+index, (lastPoint-index)*sizeof(QPoint));
- return a * combinedMatrix();
-}
-
-/*!
- \fn QPoint QPainter::xFormDev(const QPoint &point) const
- \overload
- \obsolete
-
- Use combinedTransform() combined with QTransform::inverted() instead.
-
- \oldcode
- QPainter painter(this);
- QPoint transformed = painter.xFormDev(point);
- \newcode
- QPainter painter(this);
- QPoint transformed = point * painter.combinedTransform().inverted();
- \endcode
-*/
-
-QPoint QPainter::xFormDev(const QPoint &p) const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::xFormDev: Painter not active");
- return QPoint();
- }
- if(d->state->matrix.type() == QTransform::TxNone)
- return p;
- return p * combinedMatrix().inverted();
-}
-
-/*!
- \fn QRect QPainter::xFormDev(const QRect &rectangle) const
- \overload
- \obsolete
-
- Use combinedTransform() combined with QTransform::inverted() instead.
-
- \oldcode
- QPainter painter(this);
- QRect transformed = painter.xFormDev(rectangle);
- \newcode
- QPainter painter(this);
- QRegion region = QRegion(rectangle) * painter.combinedTransform().inverted();
- QRect transformed = region.boundingRect();
- \endcode
-*/
-
-QRect QPainter::xFormDev(const QRect &r) const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::xFormDev: Painter not active");
- return QRect();
- }
- if (d->state->matrix.type() == QTransform::TxNone)
- return r;
- return combinedMatrix().inverted().mapRect(r);
-}
-
-/*!
- \overload
-
- \fn QPoint QPainter::xFormDev(const QPolygon &polygon) const
- \obsolete
-
- Use combinedTransform() combined with QTransform::inverted() instead.
-
- \oldcode
- QPainter painter(this);
- QPolygon transformed = painter.xFormDev(rectangle);
- \newcode
- QPainter painter(this);
- QPolygon transformed = polygon * painter.combinedTransform().inverted();
- \endcode
-*/
-
-QPolygon QPainter::xFormDev(const QPolygon &a) const
-{
- Q_D(const QPainter);
- if (!d->engine) {
- qWarning("QPainter::xFormDev: Painter not active");
- return QPolygon();
- }
- if (d->state->matrix.type() == QTransform::TxNone)
- return a;
- return a * combinedMatrix().inverted();
-}
-
-/*!
- \fn QPolygon QPainter::xFormDev(const QPolygon &polygon, int index, int count) const
- \overload
- \obsolete
-
- Use combinedTransform() combined with QPolygon::mid() and QTransform::inverted() instead.
-
- \oldcode
- QPainter painter(this);
- QPolygon transformed = painter.xFormDev(polygon, index, count);
- \newcode
- QPainter painter(this);
- QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform().inverted();
- \endcode
-*/
-
-QPolygon QPainter::xFormDev(const QPolygon &ad, int index, int npoints) const
-{
- Q_D(const QPainter);
- int lastPoint = npoints < 0 ? ad.size() : index+npoints;
- QPolygon a(lastPoint-index);
- memcpy(a.data(), ad.data()+index, (lastPoint-index)*sizeof(QPoint));
- if (d->state->matrix.type() == QTransform::TxNone)
- return a;
- return a * combinedMatrix().inverted();
-}
-
-/*!
- \fn void QPainter::drawCubicBezier(const QPolygon &controlPoints, int index)
-
- Draws a cubic Bezier curve defined by the \a controlPoints,
- starting at \a{controlPoints}\e{[index]} (\a index defaults to 0).
- Points after \a{controlPoints}\e{[index + 3]} are ignored. Nothing
- happens if there aren't enough control points.
-
- Use strokePath() instead.
-
- \oldcode
- QPainter painter(this);
- painter.drawCubicBezier(controlPoints, index)
- \newcode
- QPainterPath path;
- path.moveTo(controlPoints.at(index));
- path.cubicTo(controlPoints.at(index+1),
- controlPoints.at(index+2),
- controlPoints.at(index+3));
-
- QPainter painter(this);
- painter.strokePath(path, painter.pen());
- \endcode
-*/
-void QPainter::drawCubicBezier(const QPolygon &a, int index)
-{
- Q_D(QPainter);
-
- if (!d->engine)
- return;
-
- if ((int)a.size() - index < 4) {
- qWarning("QPainter::drawCubicBezier: Cubic Bezier needs 4 control "
- "points");
- return;
- }
-
- QPainterPath path;
- path.moveTo(a.at(index));
- path.cubicTo(a.at(index+1), a.at(index+2), a.at(index+3));
- strokePath(path, d->state->pen);
-}
-#endif
struct QPaintDeviceRedirection
{
@@ -7847,29 +7420,7 @@ void QPainter::setRedirected(const QPaintDevice *device,
{
Q_ASSERT(device != 0);
- bool hadInternalWidgetRedirection = false;
- if (device->devType() == QInternal::Widget) {
- const QWidgetPrivate *widgetPrivate = static_cast<const QWidget *>(device)->d_func();
- // This is the case when the widget is in a paint event.
- if (widgetPrivate->redirectDev) {
- // Remove internal redirection and put it back into the global redirection list.
- QPoint oldOffset;
- QPaintDevice *oldReplacement = widgetPrivate->redirected(&oldOffset);
- const_cast<QWidgetPrivate *>(widgetPrivate)->restoreRedirected();
- setRedirected(device, oldReplacement, oldOffset);
- hadInternalWidgetRedirection = true;
- }
- }
-
- QPoint roffset;
- QPaintDevice *rdev = redirected(replacement, &roffset);
-
- QMutexLocker locker(globalRedirectionsMutex());
- QPaintDeviceRedirectionList *redirections = globalRedirections();
- Q_ASSERT(redirections != 0);
- *redirections += QPaintDeviceRedirection(device, rdev ? rdev : replacement, offset + roffset,
- hadInternalWidgetRedirection ? redirections->size() - 1 : -1);
- globalRedirectionAtomic()->ref();
+ qWarning() << "QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead";
}
/*!
@@ -7891,29 +7442,7 @@ void QPainter::setRedirected(const QPaintDevice *device,
*/
void QPainter::restoreRedirected(const QPaintDevice *device)
{
- Q_ASSERT(device != 0);
- QMutexLocker locker(globalRedirectionsMutex());
- QPaintDeviceRedirectionList *redirections = globalRedirections();
- Q_ASSERT(redirections != 0);
- for (int i = redirections->size()-1; i >= 0; --i) {
- if (redirections->at(i) == device) {
- globalRedirectionAtomic()->deref();
- const int internalWidgetRedirectionIndex = redirections->at(i).internalWidgetRedirectionIndex;
- redirections->removeAt(i);
- // Restore the internal widget redirection, i.e. remove it from the global
- // redirection list and put it back into QWidgetPrivate. The index is only set when
- // someone call QPainter::setRedirected in a widget's paint event and we internally
- // have a redirection set (typically set in QWidgetPrivate::drawWidget).
- if (internalWidgetRedirectionIndex >= 0) {
- Q_ASSERT(internalWidgetRedirectionIndex < redirections->size());
- const QPaintDeviceRedirection &redirectionDevice = redirections->at(internalWidgetRedirectionIndex);
- QWidget *widget = static_cast<QWidget *>(const_cast<QPaintDevice *>(device));
- widget->d_func()->setRedirected(redirectionDevice.replacement, redirectionDevice.offset);
- redirections->removeAt(internalWidgetRedirectionIndex);
- }
- return;
- }
- }
+ qWarning() << "QPainter::restoreRedirected(): ignoring call to deprecated function, use QWidget::render() instead";
}
/*!
@@ -7935,28 +7464,6 @@ void QPainter::restoreRedirected(const QPaintDevice *device)
*/
QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset)
{
- Q_ASSERT(device != 0);
-
- if (device->devType() == QInternal::Widget) {
- const QWidgetPrivate *widgetPrivate = static_cast<const QWidget *>(device)->d_func();
- if (widgetPrivate->redirectDev)
- return widgetPrivate->redirected(offset);
- }
-
- if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0)
- return 0;
-
- QMutexLocker locker(globalRedirectionsMutex());
- QPaintDeviceRedirectionList *redirections = globalRedirections();
- Q_ASSERT(redirections != 0);
- for (int i = redirections->size()-1; i >= 0; --i)
- if (redirections->at(i) == device) {
- if (offset)
- *offset = redirections->at(i).offset;
- return redirections->at(i).replacement;
- }
- if (offset)
- *offset = QPoint(0, 0);
return 0;
}
@@ -8041,7 +7548,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
else
layout_direction = Qt::LeftToRight;
- tf = QStyle::visualAlignment(layout_direction, QFlag(tf));
+ tf = QGuiApplicationPrivate::visualAlignment(layout_direction, QFlag(tf));
bool isRightToLeft = layout_direction == Qt::RightToLeft;
bool expandtabs = ((tf & Qt::TextExpandTabs) &&
@@ -8301,7 +7808,7 @@ QPainterState::QPainterState()
wx(0), wy(0), ww(0), wh(0), vx(0), vy(0), vw(0), vh(0),
opacity(1), WxF(false), VxF(false), clipEnabled(true),
bgMode(Qt::TransparentMode), painter(0),
- layoutDirection(QApplication::layoutDirection()),
+ layoutDirection(QGuiApplication::layoutDirection()),
composition_mode(QPainter::CompositionMode_SourceOver),
emulationSpecifier(0), changeFlags(0)
{
@@ -8331,7 +7838,7 @@ void QPainterState::init(QPainter *p) {
clipInfo.clear();
worldMatrix.reset();
matrix.reset();
- layoutDirection = QApplication::layoutDirection();
+ layoutDirection = QGuiApplication::layoutDirection();
composition_mode = QPainter::CompositionMode_SourceOver;
emulationSpecifier = 0;
dirtyFlags = 0;
@@ -8340,45 +7847,6 @@ void QPainterState::init(QPainter *p) {
opacity = 1;
}
-#ifdef QT3_SUPPORT
-static void bitBlt_helper(QPaintDevice *dst, const QPoint &dp,
- const QPaintDevice *src, const QRect &sr, bool)
-{
- Q_ASSERT(dst);
- Q_ASSERT(src);
-
- if (src->devType() == QInternal::Pixmap) {
- const QPixmap *pixmap = static_cast<const QPixmap *>(src);
- QPainter pt(dst);
- pt.drawPixmap(dp, *pixmap, sr);
-
- } else {
- qWarning("QPainter: bitBlt only works when source is of type pixmap");
- }
-}
-
-void bitBlt(QPaintDevice *dst, int dx, int dy,
- const QPaintDevice *src, int sx, int sy, int sw, int sh,
- bool ignoreMask )
-{
- bitBlt_helper(dst, QPoint(dx, dy), src, QRect(sx, sy, sw, sh), ignoreMask);
-}
-
-void bitBlt(QPaintDevice *dst, const QPoint &dp, const QPaintDevice *src, const QRect &sr, bool ignoreMask)
-{
- bitBlt_helper(dst, dp, src, sr, ignoreMask);
-}
-
-void bitBlt(QPaintDevice *dst, int dx, int dy,
- const QImage *src, int sx, int sy, int sw, int sh, int fl)
-{
- Qt::ImageConversionFlags flags(fl);
- QPixmap srcPixmap = QPixmap::fromImage(*src, flags);
- bitBlt_helper(dst, QPoint(dx, dy), &srcPixmap, QRect(sx, sy, sw, sh), false);
-}
-
-#endif // QT3_SUPPORT
-
/*!
\fn void QPainter::setBackgroundColor(const QColor &color)
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index 4b2c447cca..9ef39e8ab7 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -133,7 +133,7 @@ public:
bool end();
bool isActive() const;
- void initFrom(const QWidget *widget);
+ void initFrom(const QPaintDevice *device);
enum CompositionMode {
CompositionMode_SourceOver,
@@ -464,85 +464,13 @@ public:
void beginNativePainting();
void endNativePainting();
-#ifdef QT3_SUPPORT
-
- inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); }
- inline QT3_SUPPORT const QColor &backgroundColor() const { return background().color(); }
-
- inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int pos, int len)
- { drawText(x, y, s.mid(pos, len)); }
- inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int pos, int len)
- { drawText(p, s.mid(pos, len)); }
- inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int len)
- { drawText(x, y, s.left(len)); }
- inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int len)
- { drawText(p, s.left(len)); }
- inline QT3_SUPPORT void drawText(const QRect &r, int flags, const QString &str, int len, QRect *br=0)
- { drawText(r, flags, str.left(len), br); }
- inline QT3_SUPPORT void drawText(int x, int y, int w, int h, int flags, const QString &text, int len, QRect *br=0)
- { drawText(QRect(x, y, w, h), flags, text.left(len), br); }
- inline QT3_SUPPORT QRect boundingRect(const QRect &rect, int flags, const QString &text, int len)
- { return boundingRect(rect, flags, text.left(len)); }
- inline QT3_SUPPORT QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, int len)
- { return boundingRect(QRect(x, y, w, h), flags, text.left(len)); }
-
- inline QT3_SUPPORT bool begin(QPaintDevice *pdev, const QWidget *init)
- { bool ret = begin(pdev); initFrom(init); return ret; }
- QT3_SUPPORT void drawPoints(const QPolygon &pa, int index, int npoints = -1)
- { drawPoints(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
-
- QT3_SUPPORT void drawCubicBezier(const QPolygon &pa, int index = 0);
-
- QT3_SUPPORT void drawLineSegments(const QPolygon &points, int index = 0, int nlines = -1);
-
- inline QT3_SUPPORT void drawPolyline(const QPolygon &pa, int index, int npoints = -1)
- { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
-
- inline QT3_SUPPORT void drawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1)
- { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints,
- winding ? Qt::WindingFill : Qt::OddEvenFill); }
-
- inline QT3_SUPPORT void drawPolygon(const QPolygonF &polygon, bool winding, int index = 0,
- int npoints = -1)
- { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints,
- winding ? Qt::WindingFill : Qt::OddEvenFill); }
-
- inline QT3_SUPPORT void drawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1)
- { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); }
- inline QT3_SUPPORT void drawConvexPolygon(const QPolygon &pa, int index, int npoints = -1)
- { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
-
- static inline QT3_SUPPORT void redirect(QPaintDevice *pdev, QPaintDevice *replacement)
- { setRedirected(pdev, replacement); }
- static inline QT3_SUPPORT QPaintDevice *redirect(QPaintDevice *pdev)
- { return const_cast<QPaintDevice*>(redirected(pdev)); }
-
- inline QT3_SUPPORT void setWorldXForm(bool enabled) { setMatrixEnabled(enabled); }
- inline QT3_SUPPORT bool hasWorldXForm() const { return matrixEnabled(); }
- inline QT3_SUPPORT void resetXForm() { resetTransform(); }
-
- inline QT3_SUPPORT void setViewXForm(bool enabled) { setViewTransformEnabled(enabled); }
- inline QT3_SUPPORT bool hasViewXForm() const { return viewTransformEnabled(); }
-
- QT3_SUPPORT void map(int x, int y, int *rx, int *ry) const;
- QT3_SUPPORT QPoint xForm(const QPoint &) const; // map virtual -> deviceb
- QT3_SUPPORT QRect xForm(const QRect &) const;
- QT3_SUPPORT QPolygon xForm(const QPolygon &) const;
- QT3_SUPPORT QPolygon xForm(const QPolygon &, int index, int npoints) const;
- QT3_SUPPORT QPoint xFormDev(const QPoint &) const; // map device -> virtual
- QT3_SUPPORT QRect xFormDev(const QRect &) const;
- QT3_SUPPORT QPolygon xFormDev(const QPolygon &) const;
- QT3_SUPPORT QPolygon xFormDev(const QPolygon &, int index, int npoints) const;
- QT3_SUPPORT qreal translationX() const;
- QT3_SUPPORT qreal translationY() const;
-#endif
-
private:
Q_DISABLE_COPY(QPainter)
friend class Q3Painter;
QScopedPointer<QPainterPrivate> d_ptr;
+ friend class QWidget;
friend class QFontEngine;
friend class QFontEngineBox;
friend class QFontEngineFT;
diff --git a/src/gui/painting/qprintengine_ps.cpp b/src/gui/painting/qprintengine_ps.cpp
deleted file mode 100644
index d55d532fdb..0000000000
--- a/src/gui/painting/qprintengine_ps.cpp
+++ /dev/null
@@ -1,972 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-
-#include <private/qprintengine_ps_p.h>
-#include <private/qpainter_p.h>
-#include <private/qfontengine_p.h>
-#include <private/qpaintengine_p.h>
-#include <private/qpdf_p.h>
-
-#ifndef QT_NO_PRINTER
-
-#include "qprinter.h"
-#include "qpainter.h"
-#include "qapplication.h"
-#include "qpixmap.h"
-#include "qimage.h"
-#include "qdatetime.h"
-#include "qstring.h"
-#include "qbytearray.h"
-#include "qhash.h"
-#include "qbuffer.h"
-#include "qsettings.h"
-#include "qmap.h"
-#include "qbitmap.h"
-#include "qregion.h"
-#include "qimagewriter.h"
-#include <private/qpainterpath_p.h>
-#include <qdebug.h>
-#include <private/qdrawhelper_p.h>
-#include <private/qmutexpool_p.h>
-
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#include <limits.h>
-
-QT_BEGIN_NAMESPACE
-
-static bool qt_gen_epsf = false;
-
-void qt_generate_epsf(bool b)
-{
- qt_gen_epsf = b;
-}
-
-static const char *const ps_header =
-"/BD{bind def}bind def/d2{dup dup}BD/ED{exch def}BD/D0{0 ED}BD/F{setfont}BD\n"
-"/RL{rlineto}BD/CM{currentmatrix}BD/SM{setmatrix}BD/TR{translate}BD/SD\n"
-"{setdash}BD/SC{aload pop setrgbcolor}BD/CR{currentfile read pop}BD/i{index}\n"
-"BD/scs{setcolorspace}BD/DB{dict dup begin}BD/DE{end def}BD/ie{ifelse}BD/gs\n"
-"{gsave}BD/gr{grestore}BD/w{setlinewidth}BD/d{setdash}BD/J{setlinecap}BD/j\n"
-"{setlinejoin}BD/scn{3 array astore/BCol exch def}BD/SCN{3 array astore/PCol\n"
-"exch def}BD/cm{6 array astore concat}BD/m{moveto}BD/l{lineto}BD/c{curveto}BD\n"
-"/h{closepath}BD/W{clip}BD/W*{eoclip}BD/n{newpath}BD/q{gsave 10 dict begin}BD\n"
-"/Q{end grestore}BD/re{4 2 roll m dup 0 exch RL exch 0 RL 0 exch neg RL h}BD\n"
-"/S{gs PCol SC stroke gr n}BD/BT{gsave 10 dict begin/_m matrix CM def BCol\n"
-"SC}BD/ET{end grestore}BD/Tf{/_fs ED findfont[_fs 0 0 _fs 0 0]makefont F}BD\n"
-"/Tm{6 array astore concat}BD/Td{translate}BD/Tj{0 0 m show}BD/BDC{pop pop}BD\n"
-"/EMC{}BD/BSt 0 def/WFi false def/BCol[1 1 1]def/PCol[0 0 0]def/BDArr[0.94\n"
-"0.88 0.63 0.50 0.37 0.12 0.06]def/level3{/languagelevel where{pop\n"
-"languagelevel 3 ge}{false}ie}BD/QCIgray D0/QCIcolor D0/QCIindex D0/QCI{\n"
-"/colorimage where{pop false 3 colorimage}{exec/QCIcolor ED/QCIgray QCIcolor\n"
-"length 3 idiv string def 0 1 QCIcolor length 3 idiv 1 sub{/QCIindex ED/_x\n"
-"QCIindex 3 mul def QCIgray QCIindex QCIcolor _x get 0.30 mul QCIcolor _x 1\n"
-"add get 0.59 mul QCIcolor _x 2 add get 0.11 mul add add cvi put}for QCIgray\n"
-"image}ie}BD/di{gs TR 1 i 1 eq{pop pop false 3 1 roll BCol SC imagemask}{dup\n"
-"false ne{level3}{false}ie{/_ma ED 8 eq{/_dc[0 1]def/DeviceGray}{/_dc[0 1 0 1\n"
-"0 1]def/DeviceRGB}ie scs/_im ED/_mt ED/_h ED/_w ED <</ImageType 3/DataDict\n"
-"<</ImageType 1/Width _w/Height _h/ImageMatrix _mt/DataSource _im\n"
-"/BitsPerComponent 8/Decode _dc >>/MaskDict <</ImageType 1/Width _w/Height _h\n"
-"/ImageMatrix _mt/DataSource _ma/BitsPerComponent 1/Decode[0 1]>>\n"
-"/InterleaveType 3 >> image}{pop 8 4 1 roll 8 eq{image}{QCI}ie}ie}ie gr}BD/BF\n"
-"{gs BSt 1 eq{BCol SC WFi{fill}{eofill}ie}if BSt 2 ge BSt 8 le and{BDArr BSt\n"
-"2 sub get/_sc ED BCol{1. exch sub _sc mul 1. exch sub}forall 3 array astore\n"
-"SC WFi{fill}{eofill}ie}if BSt 9 ge BSt 14 le and{WFi{W}{W*}ie pathbbox 3 i 3\n"
-"i TR 4 2 roll 3 2 roll exch sub/_h ED sub/_w ED BCol SC 0.3 w n BSt 9 eq BSt\n"
-"11 eq or{0 4 _h{dup 0 exch m _w exch l}for}if BSt 10 eq BSt 11 eq or{0 4 _w{\n"
-"dup 0 m _h l}for}if BSt 12 eq BSt 14 eq or{_w _h gt{0 6 _w _h add{dup 0 m _h\n"
-"sub _h l}for}{0 6 _w _h add{dup 0 exch m _w sub _w exch l}for}ie}if BSt 13\n"
-"eq BSt 14 eq or{_w _h gt{0 6 _w _h add{dup _h m _h sub 0 l}for}{0 6 _w _h\n"
-"add{dup _w exch m _w sub 0 exch l}for}ie}if stroke}if BSt 15 eq{}if BSt 24\n"
-"eq{}if gr}BD/f{/WFi true def BF n}BD/f*{/WFi false def BF n}BD/B{/WFi true\n"
-"def BF S n}BD/B*{/WFi false def BF S n}BD/QI{/C save def pageinit q n}BD/QP{\n"
-"Q C restore showpage}BD/SPD{/setpagedevice where{<< 3 1 roll >>\n"
-"setpagedevice}{pop pop}ie}BD/T1AddMapping{10 dict begin/glyphs ED/fnt ED\n"
-"/current fnt/NumGlyphs get def/CMap fnt/CMap get def 0 1 glyphs length 1 sub\n"
-"{glyphs exch get/gn ED current dup 256 mod/min ED 256 idiv/maj ED CMap dup\n"
-"maj get dup null eq{pop 256 array 0 1 255{1 i exch/.notdef put}for}if dup\n"
-"min gn put maj exch put/current current 1 add def}for fnt/CMap CMap put fnt\n"
-"/NumGlyphs current put end}def/T1AddGlyphs{10 dict begin/glyphs ED/fnt ED\n"
-"/current fnt/NumGlyphs get def/CMap fnt/CMap get def/CharStrings fnt\n"
-"/CharStrings get def 0 1 glyphs length 2 idiv 1 sub{2 mul dup glyphs exch\n"
-"get/gn ED 1 add glyphs exch get/cs ED current dup 256 mod/min ED 256 idiv\n"
-"/maj ED CMap dup maj get dup null eq{pop 256 array 0 1 255{1 i exch/.notdef\n"
-"put}for}if dup min gn put maj exch put CharStrings gn cs put/current current\n"
-"1 add def}for fnt/CharStrings CharStrings put fnt/CMap CMap put fnt\n"
-"/NumGlyphs current put end}def/StringAdd{1 i length 1 i length add string 3\n"
-"1 roll 2 i 0 3 i putinterval 2 i 2 i length 2 i putinterval pop pop}def\n"
-"/T1Setup{10 dict begin dup/FontName ED (-Base) StringAdd cvx cvn/Font ED\n"
-"/MaxPage Font/NumGlyphs get 1 sub 256 idiv def/FDepVector MaxPage 1 add\n"
-"array def/Encoding MaxPage 1 add array def 0 1 MaxPage{dup Encoding exch dup\n"
-"put dup/Page ED FontName (-) StringAdd exch 20 string cvs StringAdd cvn Font\n"
-"0 dict copy d2/CMap get Page get/Encoding exch put definefont FDepVector\n"
-"exch Page exch put}for FontName cvn <</FontType 0/FMapType 2/FontMatrix[1 0\n"
-"0 1 0 0]/Encoding Encoding/FDepVector FDepVector >> definefont pop end}def\n";
-
-
-
-// ------------------------------End of static data ----------------------------------
-
-// make sure DSC comments are not longer than 255 chars per line.
-static QByteArray wrapDSC(const QByteArray &str)
-{
- QByteArray dsc = str.simplified();
- const int wrapAt = 254;
- QByteArray wrapped;
- if (dsc.length() < wrapAt)
- wrapped = dsc;
- else {
- wrapped = dsc.left(wrapAt);
- QByteArray tmp = dsc.mid(wrapAt);
- while (tmp.length() > wrapAt-3) {
- wrapped += "\n%%+" + tmp.left(wrapAt-3);
- tmp = tmp.mid(wrapAt-3);
- }
- wrapped += "\n%%+" + tmp;
- }
- return wrapped + '\n';
-}
-
-// ----------------------------- Internal class declarations -----------------------------
-
-QPSPrintEnginePrivate::QPSPrintEnginePrivate(QPrinter::PrinterMode m)
- : QPdfBaseEnginePrivate(m),
- printerState(QPrinter::Idle), hugeDocument(false), headerDone(false)
-{
- useAlphaEngine = true;
- postscript = true;
-
- firstPage = true;
-
-#ifndef QT_NO_SETTINGS
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("Qt"));
- embedFonts = settings.value(QLatin1String("embedFonts"), true).toBool();
-#else
- embedFonts = true;
-#endif
-}
-
-QPSPrintEnginePrivate::~QPSPrintEnginePrivate()
-{
-}
-
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <qdebug.h>
-QT_END_INCLUDE_NAMESPACE
-
-static void ps_r7(QPdf::ByteStream& stream, const char * s, int l)
-{
- int i = 0;
- uchar line[84];
- int col = 0;
-
- while(i < l) {
- line[col++] = s[i++];
- if (i < l - 1 && col >= 76) {
- line[col++] = '\n';
- line[col++] = '\0';
- stream << (const char *)line;
- col = 0;
- }
- }
- if (col > 0) {
- while((col&3) != 0)
- line[col++] = '%'; // use a comment as padding
- line[col++] = '\n';
- line[col++] = '\0';
- stream << (const char *)line;
- }
-}
-
-static QByteArray runlengthEncode(const QByteArray &input)
-{
- if (!input.length())
- return input;
-
- const char *data = input.constData();
-
- QByteArray out;
- int start = 0;
- char last = *data;
-
- enum State {
- Undef,
- Equal,
- Diff
- };
- State state = Undef;
-
- int i = 1;
- int written = 0;
- while (1) {
- bool flush = (i == input.size());
- if (!flush) {
- switch(state) {
- case Undef:
- state = (last == data[i]) ? Equal : Diff;
- break;
- case Equal:
- if (data[i] != last)
- flush = true;
- break;
- case Diff:
- if (data[i] == last) {
- --i;
- flush = true;
- }
- }
- }
- if (flush || i - start == 128) {
- int size = i - start;
- if (state == Equal) {
- out.append((char)(uchar)(257-size));
- out.append(last);
- written += size;
- } else {
- out.append((char)(uchar)size-1);
- while (start < i)
- out.append(data[start++]);
- written += size;
- }
- state = Undef;
- start = i;
- if (i == input.size())
- break;
- }
- last = data[i];
- ++i;
- };
- out.append((char)(uchar)128);
- return out;
-}
-
-enum format {
- Raw,
- Runlength,
- DCT
-};
-static const char *const filters[3] = {
- " ",
- "/RunLengthDecode filter ",
- "/DCTDecode filter "
-};
-
-static QByteArray compressHelper(const QImage &image, bool gray, int *format)
-{
- // we can't use premultiplied here
- QByteArray pixelData;
- int depth = image.depth();
-
- Q_ASSERT(image.format() != QImage::Format_ARGB32_Premultiplied);
-
- if (depth != 1 && !gray && QImageWriter::supportedImageFormats().contains("jpeg")) {
- QBuffer buffer(&pixelData);
- QImageWriter writer(&buffer, "jpeg");
- writer.setQuality(94);
- writer.write(image);
- *format = DCT;
- } else {
- int width = image.width();
- int height = image.height();
- int size = width*height;
-
- if (depth == 1)
- size = (width+7)/8*height;
- else if (!gray)
- size = size*3;
-
- pixelData.resize(size);
- uchar *pixel = (uchar *)pixelData.data();
- int i = 0;
- if (depth == 1) {
- QImage::Format format = image.format();
- memset(pixel, 0xff, size);
- for(int y=0; y < height; y++) {
- const uchar * s = image.scanLine(y);
- for(int x=0; x < width; x++) {
- // need to copy bit for bit...
- bool b = (format == QImage::Format_MonoLSB) ?
- (*(s + (x >> 3)) >> (x & 7)) & 1 :
- (*(s + (x >> 3)) << (x & 7)) & 0x80 ;
- if (b)
- pixel[i >> 3] ^= (0x80 >> (i & 7));
- i++;
- }
- // we need to align to 8 bit here
- i = (i+7) & 0xffffff8;
- }
- } else if (depth == 8) {
- for(int y=0; y < height; y++) {
- const uchar * s = image.scanLine(y);
- for(int x=0; x < width; x++) {
- QRgb rgb = image.color(s[x]);
- if (gray) {
- pixel[i] = (unsigned char) qGray(rgb);
- i++;
- } else {
- pixel[i] = (unsigned char) qRed(rgb);
- pixel[i+1] = (unsigned char) qGreen(rgb);
- pixel[i+2] = (unsigned char) qBlue(rgb);
- i += 3;
- }
- }
- }
- } else {
- for(int y=0; y < height; y++) {
- QRgb * s = (QRgb*)(image.scanLine(y));
- for(int x=0; x < width; x++) {
- QRgb rgb = (*s++);
- if (gray) {
- pixel[i] = (unsigned char) qGray(rgb);
- i++;
- } else {
- pixel[i] = (unsigned char) qRed(rgb);
- pixel[i+1] = (unsigned char) qGreen(rgb);
- pixel[i+2] = (unsigned char) qBlue(rgb);
- i += 3;
- }
- }
- }
- }
- *format = Raw;
- if (depth == 1) {
- pixelData = runlengthEncode(pixelData);
- *format = Runlength;
- }
- }
- QByteArray outarr = QPdf::ascii85Encode(pixelData);
- return outarr;
-}
-
-void QPSPrintEnginePrivate::drawImageHelper(qreal x, qreal y, qreal w, qreal h, const QImage &img,
- const QImage &mask, bool gray, qreal scaleX, qreal scaleY)
-{
- Q_UNUSED(h);
- Q_UNUSED(w);
- int width = img.width();
- int height = img.height();
-
- QByteArray out;
- int size = 0;
- const char *bits;
-
- if (!mask.isNull()) {
- int format;
- out = compressHelper(mask, true, &format);
- size = (width+7)/8*height;
- *currentPage << "/mask currentfile/ASCII85Decode filter"
- << filters[format]
- << size << " string readstring\n";
- ps_r7(*currentPage, out, out.size());
- *currentPage << " pop def\n";
- }
- if (img.depth() == 1) {
- size = (width+7)/8*height;
- bits = "1 ";
- } else if (gray) {
- size = width*height;
- bits = "8 ";
- } else {
- size = width*height*3;
- bits = "24 ";
- }
-
- int format;
- out = compressHelper(img, gray, &format);
- *currentPage << "/sl currentfile/ASCII85Decode filter"
- << filters[format]
- << size << " string readstring\n";
- ps_r7(*currentPage, out, out.size());
- *currentPage << " pop def\n";
- *currentPage << width << ' ' << height << '[' << scaleX << " 0 0 " << scaleY << " 0 0]sl "
- << bits << (!mask.isNull() ? "mask " : "false ")
- << x << ' ' << y << " di\n";
-}
-
-
-void QPSPrintEnginePrivate::drawImage(qreal x, qreal y, qreal w, qreal h,
- const QImage &image, const QImage &msk)
-{
- if (!w || !h || image.isNull()) return;
-
- QImage img(image);
- QImage mask(msk);
-
- if (image.format() == QImage::Format_ARGB32_Premultiplied)
- img = image.convertToFormat(QImage::Format_ARGB32);
-
- if (!msk.isNull() && msk.format() == QImage::Format_ARGB32_Premultiplied)
- mask = msk.convertToFormat(QImage::Format_ARGB32);
-
- int width = img.width();
- int height = img.height();
- qreal scaleX = width/w;
- qreal scaleY = height/h;
-
- bool gray = (colorMode == QPrinter::GrayScale) || img.allGray();
- int splitSize = 21830 * (gray ? 3 : 1);
- if (width * height > splitSize) { // 65535/3, tolerance for broken printers
- int images, subheight;
- images = (width * height + splitSize - 1) / splitSize;
- subheight = (height + images-1) / images;
- while (subheight * width > splitSize) {
- images++;
- subheight = (height + images-1) / images;
- }
- int suby = 0;
- const QImage constImg(img);
- const QImage constMask(mask);
- while(suby < height) {
- qreal subImageHeight = qMin(subheight, height-suby);
- const QImage subImage(constImg.scanLine(suby), width, subImageHeight,
- constImg.bytesPerLine(), constImg.format());
- const QImage subMask = mask.isNull() ? mask : QImage(constMask.scanLine(suby), width, subImageHeight,
- constMask.bytesPerLine(), constMask.format());
- drawImageHelper(x, y + suby/scaleY, w, subImageHeight/scaleY,
- subImage, subMask, gray, scaleX, scaleY);
- suby += subheight;
- }
- } else {
- drawImageHelper(x, y, width, height, img, mask, gray, scaleX, scaleY);
- }
-}
-
-void QPSPrintEnginePrivate::emitHeader(bool finished)
-{
- QPSPrintEngine *q = static_cast<QPSPrintEngine *>(q_ptr);
- QPrinter *printer = static_cast<QPrinter*>(pdev);
-
- if (creator.isEmpty())
- creator = QLatin1String("Qt " QT_VERSION_STR);
-
- QByteArray header;
- QPdf::ByteStream s(&header);
-
- qreal scale = 72. / ((qreal) q->metric(QPaintDevice::PdmDpiY));
- QRect pageRect = this->pageRect();
- QRect paperRect = this->paperRect();
- int mtop = pageRect.top() - paperRect.top();
- int mleft = pageRect.left() - paperRect.left();
- int mbottom = paperRect.bottom() - pageRect.bottom();
- int mright = paperRect.right() - pageRect.right();
- int width = pageRect.width();
- int height = pageRect.height();
- if (finished && pageCount == 1 && copies == 1 &&
- ((fullPage && qt_gen_epsf) || (outputFileName.endsWith(QLatin1String(".eps")))))
- {
- // According to the EPSF 3.0 spec it is required that the PS
- // version is PS-Adobe-3.0
- s << "%!PS-Adobe-3.0";
- if (!boundingBox.isValid())
- boundingBox.setRect(0, 0, width, height);
- if (orientation == QPrinter::Landscape) {
- if (!fullPage)
- boundingBox.translate(-mleft, -mtop);
- s << " EPSF-3.0\n%%BoundingBox: "
- << int((printer->height() - boundingBox.bottom())*scale) // llx
- << int((printer->width() - boundingBox.right())*scale - 1) // lly
- << int((printer->height() - boundingBox.top())*scale + 1) // urx
- << int((printer->width() - boundingBox.left())*scale); // ury
- } else {
- if (!fullPage)
- boundingBox.translate(mleft, -mtop);
- s << " EPSF-3.0\n%%BoundingBox: "
- << int((boundingBox.left())*scale)
- << int((printer->height() - boundingBox.bottom())*scale - 1)
- << int((boundingBox.right())*scale + 1)
- << int((printer->height() - boundingBox.top())*scale);
- }
- } else {
- s << "%!PS-Adobe-1.0";
- int w = width + (fullPage ? 0 : mleft + mright);
- int h = height + (fullPage ? 0 : mtop + mbottom);
- w = (int)(w*scale);
- h = (int)(h*scale);
- // set a bounding box according to the DSC
- if (orientation == QPrinter::Landscape)
- s << "\n%%BoundingBox: 0 0 " << h << w;
- else
- s << "\n%%BoundingBox: 0 0 " << w << h;
- }
- s << '\n' << wrapDSC("%%Creator: " + creator.toUtf8());
- if (!title.isEmpty())
- s << wrapDSC("%%Title: " + title.toUtf8());
-#ifndef QT_NO_DATESTRING
- s << "%%CreationDate: " << QDateTime::currentDateTime().toString().toUtf8();
-#endif
- s << "\n%%Orientation: ";
- if (orientation == QPrinter::Landscape)
- s << "Landscape";
- else
- s << "Portrait";
-
- s << "\n%%Pages: (atend)"
- "\n%%DocumentFonts: (atend)"
- "\n%%EndComments\n"
-
- "%%BeginProlog\n"
- "% Prolog copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).\n"
- "% You may copy this prolog in any way that is directly related to this document.\n"
- "% For other use of this prolog, see your licensing agreement for Qt.\n"
- << ps_header << '\n';
-
-
- s << "/pageinit {\n";
- if (!fullPage) {
- if (orientation == QPrinter::Portrait)
- s << mleft*scale << mbottom*scale << "translate\n";
- else
- s << mtop*scale << mleft*scale << "translate\n";
- }
- if (orientation == QPrinter::Portrait) {
- s << "% " << printer->widthMM() << '*' << printer->heightMM()
- << "mm (portrait)\n0 " << height*scale
- << "translate " << scale << '-' << scale << "scale } def\n";
- } else {
- s << "% " << printer->heightMM() << '*' << printer->widthMM()
- << " mm (landscape)\n 90 rotate " << scale << '-' << scale << "scale } def\n";
- }
- s << "%%EndProlog\n";
-
- outDevice->write(header);
- headerDone = true;
-}
-
-
-void QPSPrintEnginePrivate::emitPages()
-{
- if (!hugeDocument) {
- for (QHash<QFontEngine::FaceId, QFontSubset *>::const_iterator it = fonts.constBegin();
- it != fonts.constEnd(); ++it)
- outDevice->write((*it)->toType1());
- }
-
- QIODevice *content = buffer.stream();
- // Write the page contents in chunks.
- while (!content->atEnd()) {
- QByteArray buf = content->read(currentPage->chunkSize());
- if (!buf.isEmpty())
- outDevice->write(buf);
- }
- content = currentPage->stream();
- // Write the page contents in chunks.
- while (!content->atEnd()) {
- QByteArray buf = content->read(currentPage->chunkSize());
- if (!buf.isEmpty())
- outDevice->write(buf);
- }
- outDevice->write(trailer);
-
- buffer.clear();
- currentPage->clear();
- trailer = QByteArray();
- hugeDocument = true;
-}
-
-
-#ifdef Q_WS_QWS
-static const int max_in_memory_size = 2000000;
-#else
-static const int max_in_memory_size = 32000000;
-#endif
-
-void QPSPrintEnginePrivate::flushPage(bool last)
-{
- if (!last && currentPage->stream()->size() == 0)
- return;
-
- QPdf::ByteStream e(&trailer);
- buffer << "%%Page: "
- << pageCount << pageCount << "\n"
- "%%BeginPageSetup\n"
- "QI\n";
- if (hugeDocument) {
- for (QHash<QFontEngine::FaceId, QFontSubset *>::const_iterator it = fonts.constBegin();
- it != fonts.constEnd(); ++it) {
- if (currentPage->fonts.contains((*it)->object_id)) {
- if ((*it)->downloaded_glyphs == 0) {
- buffer << (*it)->toType1();
- (*it)->downloaded_glyphs = 0;
- } else {
- buffer << (*it)->type1AddedGlyphs();
- }
- }
- }
- }
- for (int i = 0; i < currentPage->fonts.size(); ++i)
- buffer << "(F" << QByteArray::number(currentPage->fonts.at(i)) << ") T1Setup\n";
-
- buffer << "%%EndPageSetup\nq\n";
- e << "\nQ QP\n";
- if (last || hugeDocument
- || buffer.stream()->size() + currentPage->stream()->size() > max_in_memory_size) {
-// qDebug("emiting header at page %d", pageCount);
- if (!headerDone)
- emitHeader(last);
- emitPages();
- } else {
- buffer << *currentPage << e;
- currentPage->clear();
- trailer.clear();
- }
- pageCount++;
-}
-
-// ================ PSPrinter class ========================
-
-QPSPrintEngine::QPSPrintEngine(QPrinter::PrinterMode m)
- : QPdfBaseEngine(*(new QPSPrintEnginePrivate(m)),
- PrimitiveTransform
- | PatternTransform
- | PixmapTransform
- | PainterPaths
- | PatternBrush
- )
-{
-}
-
-static void ignoreSigPipe(bool b)
-{
-#ifndef QT_NO_LPR
- static struct sigaction *users_sigpipe_handler = 0;
- static int lockCount = 0;
-
-#ifndef QT_NO_THREAD
- QMutexLocker locker(QMutexPool::globalInstanceGet(&users_sigpipe_handler));
-#endif
-
- if (b) {
- if (lockCount++ > 0)
- return;
-
- if (users_sigpipe_handler != 0)
- return; // already ignoring sigpipe
-
- users_sigpipe_handler = new struct sigaction;
- struct sigaction tmp_sigpipe_handler;
- tmp_sigpipe_handler.sa_handler = SIG_IGN;
- sigemptyset(&tmp_sigpipe_handler.sa_mask);
- tmp_sigpipe_handler.sa_flags = 0;
-
- if (sigaction(SIGPIPE, &tmp_sigpipe_handler, users_sigpipe_handler) == -1) {
- delete users_sigpipe_handler;
- users_sigpipe_handler = 0;
- }
- }
- else {
- if (--lockCount > 0)
- return;
-
- if (users_sigpipe_handler == 0)
- return; // not ignoring sigpipe
-
- if (sigaction(SIGPIPE, users_sigpipe_handler, 0) == -1)
- qWarning("QPSPrintEngine: Could not restore SIGPIPE handler");
-
- delete users_sigpipe_handler;
- users_sigpipe_handler = 0;
- }
-#else
- Q_UNUSED(b);
-#endif
-}
-QPSPrintEngine::~QPSPrintEngine()
-{
- Q_D(QPSPrintEngine);
- if (d->fd >= 0)
-#if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400
- ::_close(d->fd);
-#else
- ::close(d->fd);
-#endif
-}
-
-bool QPSPrintEngine::begin(QPaintDevice *pdev)
-{
- Q_D(QPSPrintEngine);
-
- if (d->fd >= 0)
- return true;
-
- if (d->useAlphaEngine) {
- QAlphaPaintEngine::begin(pdev);
- if (!continueCall())
- return true;
- }
-
- if(!QPdfBaseEngine::begin(pdev)) {
- d->printerState = QPrinter::Error;
- return false;
- }
-
- d->pageCount = 1; // initialize state
-
- d->pen = QPen(Qt::black);
- d->brush = Qt::NoBrush;
- d->hasPen = true;
- d->hasBrush = false;
- d->clipEnabled = false;
- d->allClipped = false;
- d->boundingBox = QRect();
- d->fontsUsed = "";
- d->hugeDocument = false;
- d->simplePen = false;
-
- setActive(true);
- d->printerState = QPrinter::Active;
-
- newPage();
-
- return true;
-}
-
-bool QPSPrintEngine::end()
-{
- Q_D(QPSPrintEngine);
-
- if (d->useAlphaEngine) {
- QAlphaPaintEngine::end();
- if (!continueCall())
- return true;
- }
-
- // we're writing to lp/lpr through a pipe, we don't want to crash with SIGPIPE
- // if lp/lpr dies
- ignoreSigPipe(true);
- d->flushPage(true);
- QByteArray trailer;
- QPdf::ByteStream s(&trailer);
- s << "%%Trailer\n"
- "%%Pages: " << d->pageCount - 1 << '\n' <<
- wrapDSC("%%DocumentFonts: " + d->fontsUsed);
- s << "%%EOF\n";
- d->outDevice->write(trailer);
-
- QPdfBaseEngine::end();
- ignoreSigPipe(false);
-
- d->firstPage = true;
- d->headerDone = false;
-
- setActive(false);
- d->printerState = QPrinter::Idle;
- d->pdev = 0;
-
- return true;
-}
-
-void QPSPrintEngine::setBrush()
-{
- Q_D(QPSPrintEngine);
-#if 0
- bool specifyColor;
- int gStateObject = 0;
- int patternObject = d->addBrushPattern(brush, d->stroker.matrix, brushOrigin, &specifyColor, &gStateObject);
-
- *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs ");
- if (specifyColor) {
- QColor rgba = brush.color();
- *d->currentPage << rgba.redF()
- << rgba.greenF()
- << rgba.blueF();
- }
- if (patternObject)
- *d->currentPage << "/Pat" << patternObject;
- *d->currentPage << "scn\n";
-#endif
- QColor rgba = d->brush.color();
- if (d->colorMode == QPrinter::GrayScale) {
- qreal gray = qGray(rgba.rgba())/255.;
- *d->currentPage << gray << gray << gray;
- } else {
- *d->currentPage << rgba.redF()
- << rgba.greenF()
- << rgba.blueF();
- }
- *d->currentPage << "scn\n"
- << "/BSt " << d->brush.style() << "def\n";
-}
-
-void QPSPrintEngine::drawImageInternal(const QRectF &r, QImage image, bool bitmap)
-{
- Q_D(QPSPrintEngine);
- if (d->clipEnabled && d->allClipped)
- return;
- if (bitmap && image.depth() != 1)
- bitmap = false;
- QImage mask;
- // the below is not necessary since it's handled by the alpha
- // engine
- if (!d->useAlphaEngine && !bitmap) {
- if (image.format() == QImage::Format_Mono || image.format() == QImage::Format_MonoLSB)
- image = image.convertToFormat(QImage::Format_Indexed8);
- if (image.hasAlphaChannel()) {
- // get better alpha dithering
- int xscale = image.width();
- xscale *= xscale <= 800 ? 4 : (xscale <= 1600 ? 2 : 1);
- int yscale = image.height();
- yscale *= yscale <= 800 ? 4 : (yscale <= 1600 ? 2 : 1);
- image = image.scaled(xscale, yscale);
- mask = image.createAlphaMask(Qt::OrderedAlphaDither);
- }
- }
- *d->currentPage << "q\n";
- if(!d->simplePen)
- *d->currentPage << QPdf::generateMatrix(d->stroker.matrix);
- QBrush b = d->brush;
- if (image.depth() == 1) {
- // set current pen as brush
- d->brush = d->pen.brush();
- setBrush();
- }
- d->drawImage(r.x(), r.y(), r.width(), r.height(), image, mask);
- *d->currentPage << "Q\n";
- d->brush = b;
-}
-
-
-void QPSPrintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr,
- Qt::ImageConversionFlags)
-{
- Q_D(QPSPrintEngine);
-
- if (d->useAlphaEngine) {
- QAlphaPaintEngine::drawImage(r, img, sr);
- if (!continueCall())
- return;
- }
- QImage image = img.copy(sr.toRect());
- drawImageInternal(r, image, false);
-}
-
-void QPSPrintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
-{
- Q_D(QPSPrintEngine);
-
- if (d->useAlphaEngine) {
- QAlphaPaintEngine::drawPixmap(r, pm, sr);
- if (!continueCall())
- return;
- }
-
- QImage img = pm.copy(sr.toRect()).toImage();
- drawImageInternal(r, img, true);
-}
-
-void QPSPrintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &p)
-{
- Q_D(QPSPrintEngine);
-
- if (d->useAlphaEngine) {
- QAlphaPaintEngine::drawTiledPixmap(r, pixmap, p);
- if (!continueCall())
- return;
- }
-
- if (d->clipEnabled && d->allClipped)
- return;
- // ### Optimize implementation!
- qreal yPos = r.y();
- qreal yOff = p.y();
- while(yPos < r.y() + r.height()) {
- qreal drawH = pixmap.height() - yOff; // Cropping first row
- if (yPos + drawH > r.y() + r.height()) // Cropping last row
- drawH = r.y() + r.height() - yPos;
- qreal xPos = r.x();
- qreal xOff = p.x();
- while(xPos < r.x() + r.width()) {
- qreal drawW = pixmap.width() - xOff; // Cropping first column
- if (xPos + drawW > r.x() + r.width()) // Cropping last column
- drawW = r.x() + r.width() - xPos;
- // ########
- painter()->drawPixmap(QPointF(xPos, yPos).toPoint(), pixmap,
- QRectF(xOff, yOff, drawW, drawH).toRect());
- xPos += drawW;
- xOff = 0;
- }
- yPos += drawH;
- yOff = 0;
- }
-
-}
-
-bool QPSPrintEngine::newPage()
-{
- Q_D(QPSPrintEngine);
-
- if (!d->firstPage && d->useAlphaEngine)
- flushAndInit();
-
- // we're writing to lp/lpr through a pipe, we don't want to crash with SIGPIPE
- // if lp/lpr dies
- ignoreSigPipe(true);
- if (!d->firstPage)
- d->flushPage();
- d->firstPage = false;
- ignoreSigPipe(false);
-
- delete d->currentPage;
- d->currentPage = new QPdfPage;
- d->stroker.stream = d->currentPage;
-
- return QPdfBaseEngine::newPage();
-}
-
-bool QPSPrintEngine::abort()
-{
- // ### abort!?!
- return false;
-}
-
-QPrinter::PrinterState QPSPrintEngine::printerState() const
-{
- Q_D(const QPSPrintEngine);
- return d->printerState;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PRINTER
diff --git a/src/gui/painting/qprintengine_ps_p.h b/src/gui/painting/qprintengine_ps_p.h
deleted file mode 100644
index a1185d7867..0000000000
--- a/src/gui/painting/qprintengine_ps_p.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPRINTENGINE_PS_P_H
-#define QPRINTENGINE_PS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qpsprinter.cpp and qprinter_x11.cpp.
-// This header file may change from version to version without notice,
-// or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QT_NO_PRINTER
-
-#include "private/qpdf_p.h"
-#include "qplatformdefs.h"
-#include "QtCore/qlibrary.h"
-#include "QtCore/qstringlist.h"
-#include "QtCore/qhash.h"
-#include "QtCore/qabstractitemmodel.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPrinter;
-class QPSPrintEnginePrivate;
-
-class QPSPrintEngine : public QPdfBaseEngine
-{
- Q_DECLARE_PRIVATE(QPSPrintEngine)
-public:
- // QPrinter uses these
- explicit QPSPrintEngine(QPrinter::PrinterMode m);
- ~QPSPrintEngine();
-
-
- virtual bool begin(QPaintDevice *pdev);
- virtual bool end();
-
- void setBrush();
-
- virtual void drawImage(const QRectF &r, const QImage &img, const QRectF &sr, Qt::ImageConversionFlags);
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
-
- virtual void drawImageInternal(const QRectF &r, QImage img, bool bitmap);
-
- virtual QPaintEngine::Type type() const { return QPaintEngine::PostScript; }
-
- virtual bool newPage();
- virtual bool abort();
-
- virtual QPrinter::PrinterState printerState() const;
-
- virtual Qt::HANDLE handle() const { return 0; }
-
-private:
- Q_DISABLE_COPY(QPSPrintEngine)
-};
-
-class QPSPrintEnginePrivate : public QPdfBaseEnginePrivate {
-public:
- QPSPrintEnginePrivate(QPrinter::PrinterMode m);
- ~QPSPrintEnginePrivate();
-
- void emitHeader(bool finished);
- void emitPages();
- void drawImage(qreal x, qreal y, qreal w, qreal h, const QImage &img, const QImage &mask);
- void flushPage(bool last = false);
- void drawImageHelper(qreal x, qreal y, qreal w, qreal h, const QImage &img, const QImage &mask,
- bool gray, qreal scaleX, qreal scaleY);
-
- int pageCount;
- bool epsf;
- QByteArray fontsUsed;
-
- // stores the descriptions of the n first pages.
- QPdf::ByteStream buffer;
- QByteArray trailer;
-
- bool firstPage;
-
- QRect boundingBox;
-
- QPrinter::PrinterState printerState;
- bool hugeDocument;
- bool headerDone;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PRINTER
-
-#endif // QPRINTENGINE_PS_P_H
diff --git a/src/gui/painting/qprintengine_qws.cpp b/src/gui/painting/qprintengine_qws.cpp
deleted file mode 100644
index 1aef2c68cf..0000000000
--- a/src/gui/painting/qprintengine_qws.cpp
+++ /dev/null
@@ -1,886 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qprintengine_qws_p.h>
-
-#ifndef QT_NO_PRINTER
-
-#include <private/qpaintengine_raster_p.h>
-#include <qimage.h>
-#include <qfile.h>
-#include <qdebug.h>
-#include <QCopChannel>
-
-QT_BEGIN_NAMESPACE
-
-#define MM(n) int((n * 720 + 127) / 254)
-#define IN(n) int(n * 72)
-
-extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size);
-
-QtopiaPrintEngine::QtopiaPrintEngine(QPrinter::PrinterMode mode)
- : QPaintEngine(*(new QtopiaPrintEnginePrivate( mode )))
-{
- d_func()->initialize();
-}
-
-bool QtopiaPrintEngine::begin(QPaintDevice *)
-{
- Q_D(QtopiaPrintEngine);
- Q_ASSERT_X(d->printerState == QPrinter::Idle, "QtopiaPrintEngine", "printer already active");
-
- // Create a new off-screen monochrome image to handle the drawing process.
- QSize size = paperRect().size();
- if ( d->pageImage )
- delete d->pageImage;
- d->pageImage = new QImage( size, QImage::Format_RGB32 );
- if ( !(d->pageImage) )
- return false;
-
- // Recreate the paint engine on the new image.
- delete d->_paintEngine;
- d->_paintEngine = 0;
- d->paintEngine()->state = state;
-
- // Begin the paint process on the image.
- if (!d->paintEngine()->begin(d->pageImage))
- return false;
-
- // Clear the first page to all-white.
- clearPage();
-
- // Clear the print buffer and output the image header.
- d->buffer.clear();
- d->writeG3FaxHeader();
-
- // The print engine is currently active.
- d->printerState = QPrinter::Active;
- return true;
-}
-
-bool QtopiaPrintEngine::end()
-{
- Q_D(QtopiaPrintEngine);
-
- d->paintEngine()->end();
-
- // Flush the last page.
- flushPage();
-
- // Output the fax data to a file (TODO: send to the print queuing daemon).
- QString filename;
- if ( !d->outputFileName.isEmpty() )
- filename = QString::fromLocal8Bit(qgetenv("HOME").constData()) + QLatin1String("/Documents/") + d->outputFileName;
- else
- filename = QString::fromLocal8Bit(qgetenv("HOME").constData()) + QLatin1String("/tmp/qwsfax.tiff");
-
- setProperty(QPrintEngine::PPK_OutputFileName, filename);
- QFile file( filename );
- if ( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) {
- qDebug( "Failed to open %s for printer output",
- filename.toLatin1().constData() );
- } else {
- file.write( d->buffer.data() );
- file.close();
- }
-
- // Free up the memory for the image buffer.
- d->buffer.clear();
-
- // Finalize the print job.
- d->printerState = QPrinter::Idle;
-
- // call qcop service
- QMap<QString, QVariant> map;
- for ( int x = 0; x <= QPrintEngine::PPK_Duplex; x++ )
- map.insert( QString::number(x), property((QPrintEngine::PrintEnginePropertyKey)(x)));
- QVariant variant(map);
-
- QByteArray data;
- QDataStream out(&data, QIODevice::WriteOnly);
- out << variant;
- QCopChannel::send(QLatin1String("QPE/Service/Print"), QLatin1String("print(QVariant)"), data);
-
- return true;
-}
-
-QPaintEngine *QtopiaPrintEngine::paintEngine() const
-{
- return const_cast<QtopiaPrintEnginePrivate *>(d_func())->paintEngine();
-}
-
-void QtopiaPrintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
-{
- Q_D(QtopiaPrintEngine);
- Q_ASSERT(d->printerState == QPrinter::Active);
- d->paintEngine()->drawPixmap(r, pm, sr);
-}
-
-void QtopiaPrintEngine::drawTextItem(const QPointF &p, const QTextItem &ti)
-{
- Q_D(QtopiaPrintEngine);
- Q_ASSERT(d->printerState == QPrinter::Active);
- d->paintEngine()->drawTextItem(p, ti);
-}
-
-void QtopiaPrintEngine::updateState(const QPaintEngineState &state)
-{
- Q_D(QtopiaPrintEngine);
- d->paintEngine()->updateState(state);
-}
-
-QRect QtopiaPrintEngine::paperRect() const
-{
- QSizeF s = qt_paperSizeToQSizeF(d_func()->paperSize);
- s.rwidth() = MM(s.width());
- s.rheight() = MM(s.height());
- int w = qRound(s.width()*d_func()->resolution/72.);
- int h = qRound(s.height()*d_func()->resolution/72.);
- if (d_func()->orientation == QPrinter::Portrait)
- return QRect(0, 0, w, h);
- else
- return QRect(0, 0, h, w);
-}
-
-QRect QtopiaPrintEngine::pageRect() const
-{
- QRect r = paperRect();
- if (d_func()->fullPage)
- return r;
- // would be nice to get better margins than this.
- return QRect(d_func()->resolution/3, d_func()->resolution/3, r.width()-2*d_func()->resolution/3, r.height()-2*d_func()->resolution/3);
-}
-
-bool QtopiaPrintEngine::newPage()
-{
- flushPage();
- clearPage();
- ++(d_func()->pageNumber);
- return true;
-}
-
-bool QtopiaPrintEngine::abort()
-{
- return false;
-}
-
-QPrinter::PrinterState QtopiaPrintEngine::printerState() const
-{
- return d_func()->printerState;
-}
-
-int QtopiaPrintEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
-{
- int val;
- QRect r = d_func()->fullPage ? paperRect() : pageRect();
- switch (metricType) {
- case QPaintDevice::PdmWidth:
- val = r.width();
- break;
- case QPaintDevice::PdmHeight:
- val = r.height();
- break;
- case QPaintDevice::PdmDpiX:
- val = d_func()->resolution;
- break;
- case QPaintDevice::PdmDpiY:
- val = d_func()->resolution;
- break;
- case QPaintDevice::PdmPhysicalDpiX:
- case QPaintDevice::PdmPhysicalDpiY:
- val = QT_QWS_PRINTER_DEFAULT_DPI;
- break;
- case QPaintDevice::PdmWidthMM:
- val = qRound(r.width()*25.4/d_func()->resolution);
- break;
- case QPaintDevice::PdmHeightMM:
- val = qRound(r.height()*25.4/d_func()->resolution);
- break;
- case QPaintDevice::PdmNumColors:
- val = 2;
- break;
- case QPaintDevice::PdmDepth:
- val = 1;
- break;
- default:
- qWarning("QtopiaPrintEngine::metric: Invalid metric command");
- return 0;
- }
- return val;
-}
-
-QVariant QtopiaPrintEngine::property(PrintEnginePropertyKey key) const
-{
- Q_D(const QtopiaPrintEngine);
- QVariant ret;
-
- switch (key) {
- case PPK_CollateCopies:
- ret = d->collateCopies;
- break;
- case PPK_ColorMode:
- ret = d->colorMode;
- break;
- case PPK_Creator:
- ret = d->creator;
- break;
- case PPK_DocumentName:
- ret = d->docName;
- break;
- case PPK_FullPage:
- ret = d->fullPage;
- break;
- case PPK_CopyCount: // fallthrough
- case PPK_NumberOfCopies:
- ret = d->numCopies;
- break;
- case PPK_SupportsMultipleCopies:
- ret = false;
- break;
- case PPK_Orientation:
- ret = d->orientation;
- break;
- case PPK_OutputFileName:
- ret = d->outputFileName;
- break;
- case PPK_PageOrder:
- ret = d->pageOrder;
- break;
- case PPK_PageRect:
- ret = pageRect();
- break;
- case PPK_PaperSize:
- ret = d->paperSize;
- break;
- case PPK_PaperRect:
- ret = paperRect();
- break;
- case PPK_PaperSource:
- ret = d->paperSource;
- break;
- case PPK_PrinterName:
- ret = d->printerName;
- break;
- case PPK_PrinterProgram:
- ret = d->printProgram;
- break;
- case PPK_Resolution:
- ret = d->resolution;
- break;
- case PPK_SupportedResolutions:
- ret = QList<QVariant>() << QT_QWS_PRINTER_DEFAULT_DPI;
- break;
- default:
- break;
- }
- return ret;
-}
-
-void QtopiaPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
-{
- Q_D(QtopiaPrintEngine);
- switch (key) {
- case PPK_CollateCopies:
- d->collateCopies = value.toBool();
- break;
- case PPK_ColorMode:
- d->colorMode = QPrinter::ColorMode(value.toInt());
- break;
- case PPK_Creator:
- d->creator = value.toString();
- break;
- case PPK_DocumentName:
- d->docName = value.toString();
- break;
- case PPK_FullPage:
- d->fullPage = value.toBool();
- break;
- case PPK_CopyCount: // fallthrough
- case PPK_NumberOfCopies:
- d->numCopies = value.toInt();
- break;
- case PPK_Orientation:
- d->orientation = QPrinter::Orientation(value.toInt());
- break;
- case PPK_OutputFileName:
- d->outputFileName = value.toString();
- break;
- case PPK_PageOrder:
- d->pageOrder = QPrinter::PageOrder(value.toInt());
- break;
- case PPK_PaperSize:
- d->paperSize = QPrinter::PaperSize(value.toInt());
- break;
- case PPK_PaperSource:
- d->paperSource = QPrinter::PaperSource(value.toInt());
- case PPK_PrinterName:
- d->printerName = value.toString();
- break;
- case PPK_PrinterProgram:
- d->printProgram = value.toString();
- break;
- case PPK_Resolution:
- d->resolution = value.toInt();
- break;
- default:
- break;
- }
-}
-
-void QtopiaPrintEngine::clearPage()
-{
- d_func()->pageImage->fill(QColor(255, 255, 255).rgb());
-}
-
-void QtopiaPrintEngine::flushPage()
-{
- d_func()->writeG3FaxPage();
-}
-
-QtopiaPrintEnginePrivate::~QtopiaPrintEnginePrivate()
-{
- if ( pageImage )
- delete pageImage;
-}
-
-void QtopiaPrintEnginePrivate::initialize()
-{
- _paintEngine = 0;
-}
-
-QPaintEngine *QtopiaPrintEnginePrivate::paintEngine()
-{
- if (!_paintEngine)
- _paintEngine = new QRasterPaintEngine(pageImage);
- return _paintEngine;
-}
-
-void QtopiaPrintEnginePrivate::writeG3FaxHeader()
-{
- // Write the TIFF file magic number (little-endian TIFF).
- buffer.append( (char)'I' );
- buffer.append( (char)'I' );
- buffer.append( (char)42 );
- buffer.append( (char)0 );
-
- // Leave a place-holder for the IFD offset of the first page.
- ifdPatch = buffer.size();
- buffer.append( (int)0 );
-}
-
-// Tag values, from RFC 2301.
-#define TIFF_IFD_NEW_SUB_FILE_TYPE 254
-#define TIFF_IFD_IMAGE_WIDTH 256
-#define TIFF_IFD_IMAGE_LENGTH 257
-#define TIFF_IFD_BITS_PER_SAMPLE 258
-#define TIFF_IFD_COMPRESSION 259
-#define TIFF_IFD_PHOTOMETRIC_INTERP 262
-#define TIFF_IFD_FILL_ORDER 266
-#define TIFF_IFD_STRIP_OFFSETS 273
-#define TIFF_IFD_ORIENTATION 274
-#define TIFF_IFD_SAMPLES_PER_PIXEL 277
-#define TIFF_IFD_ROWS_PER_STRIP 278
-#define TIFF_IFD_STRIP_BYTE_COUNTS 279
-#define TIFF_IFD_X_RESOLUTION 282
-#define TIFF_IFD_Y_RESOLUTION 283
-#define TIFF_IFD_PLANAR_CONFIG 284
-#define TIFF_IFD_T4_OPTIONS 292
-#define TIFF_IFD_RESOLUTION_UNIT 296
-#define TIFF_IFD_PAGE_NUMBER 297
-#define TIFF_IFD_CLEAN_FAX_DATA 327
-
-// IFD type values.
-#define TIFF_TYPE_SHORT 3
-#define TIFF_TYPE_LONG 4
-#define TIFF_TYPE_RATIONAL 5
-
-// Construct a SHORT pair from two values.
-#define TIFF_SHORT_PAIR(a,b) (((a) & 0xFFFF) | ((b) << 16))
-
-// Width of a FAX page in pixels, in the baseline specification from RFC 2301.
-// This must be hard-wired, as per the RFC. We truncate any pixels that
-// are beyond this limit, or pad lines to reach this limit.
-#define TIFF_FAX_WIDTH 1728
-
-void QtopiaPrintEnginePrivate::writeG3FaxPage()
-{
- // Pad the image file to a word boundary, just in case.
- buffer.pad();
-
- // Back-patch the IFD link for the previous page.
- buffer.patch( ifdPatch, buffer.size() );
-
- // Output the contents of the IFD for this page (these must be
- // in ascending order of tag value).
- buffer.append( (short)19 ); // Number of IFD entries.
- writeG3IFDEntry( TIFF_IFD_NEW_SUB_FILE_TYPE, TIFF_TYPE_LONG, 1, 2 );
- writeG3IFDEntry( TIFF_IFD_IMAGE_WIDTH, TIFF_TYPE_LONG, 1, TIFF_FAX_WIDTH );
- writeG3IFDEntry
- ( TIFF_IFD_IMAGE_LENGTH, TIFF_TYPE_LONG, 1, pageImage->height() );
- writeG3IFDEntry( TIFF_IFD_BITS_PER_SAMPLE, TIFF_TYPE_SHORT, 1, 1 );
- writeG3IFDEntry( TIFF_IFD_COMPRESSION, TIFF_TYPE_SHORT, 1, 3 );
- writeG3IFDEntry( TIFF_IFD_PHOTOMETRIC_INTERP, TIFF_TYPE_SHORT, 1, 0 );
- writeG3IFDEntry( TIFF_IFD_FILL_ORDER, TIFF_TYPE_SHORT, 1, 1 );
- int stripOffsets =
- writeG3IFDEntry( TIFF_IFD_STRIP_OFFSETS, TIFF_TYPE_LONG, 1, 0 );
- writeG3IFDEntry( TIFF_IFD_ORIENTATION, TIFF_TYPE_SHORT, 1, 1 );
- writeG3IFDEntry( TIFF_IFD_SAMPLES_PER_PIXEL, TIFF_TYPE_SHORT, 1, 1 );
- writeG3IFDEntry
- ( TIFF_IFD_ROWS_PER_STRIP, TIFF_TYPE_LONG, 1, pageImage->height() );
- int stripBytes = writeG3IFDEntry
- ( TIFF_IFD_STRIP_BYTE_COUNTS, TIFF_TYPE_LONG, 1, 0 );
- int xres =
- writeG3IFDEntry( TIFF_IFD_X_RESOLUTION, TIFF_TYPE_RATIONAL, 1, 0 );
- int yres =
- writeG3IFDEntry( TIFF_IFD_Y_RESOLUTION, TIFF_TYPE_RATIONAL, 1, 0 );
- writeG3IFDEntry( TIFF_IFD_PLANAR_CONFIG, TIFF_TYPE_SHORT, 1, 1 );
- writeG3IFDEntry( TIFF_IFD_T4_OPTIONS, TIFF_TYPE_LONG, 1, 2 );
- writeG3IFDEntry( TIFF_IFD_RESOLUTION_UNIT, TIFF_TYPE_SHORT, 1, 2 );
- writeG3IFDEntry( TIFF_IFD_PAGE_NUMBER, TIFF_TYPE_SHORT, 2,
- TIFF_SHORT_PAIR( pageNumber, 0 ) );
- writeG3IFDEntry( TIFF_IFD_CLEAN_FAX_DATA, TIFF_TYPE_SHORT, 1, 0 );
-
- // Leave a place-holder for the IFD offset of the next page.
- ifdPatch = buffer.size();
- buffer.append( (int)0 );
-
- // Output the X and Y resolutions, as rational values (usually 200/1).
- buffer.patch( xres, buffer.size() );
- buffer.append( (int)resolution );
- buffer.append( (int)1 );
- buffer.patch( yres, buffer.size() );
- buffer.append( (int)resolution );
- buffer.append( (int)1 );
-
- // We are now at the start of the image data - set the strip offset.
- int start = buffer.size();
- buffer.patch( stripOffsets, start );
-
- // Output the image data.
- int width = pageImage->width();
- QImage::Format imageFormat = pageImage->format();
- for ( int y = 0; y < pageImage->height(); ++y ) {
- unsigned char *scan = pageImage->scanLine(y);
- int prev, pixel, len;
- writeG3EOL();
- prev = 0;
- len = 0;
-
- uint currentColor = qRgb(255, 255, 255); // start with white
-
- for ( int x = 0; x < width && x < TIFF_FAX_WIDTH; ++x ) {
- if ( imageFormat == QImage::Format_RGB32 ) {
- // read color of the current pixel
- uint *p = (uint *)scan + x;
-
- if ( *p == currentColor ) { // if it is the same color
- len++; // imcrement length
- } else { // otherwise write color into the buffer
- if ( len > 0 ) {
- if ( currentColor == qRgb(0, 0, 0) )
- writeG3BlackRun( len );
- else
- writeG3WhiteRun( len );
- }
- // initialise length and color;
- len = 1;
- currentColor = *p;
- }
- } else if ( imageFormat == QImage::Format_Mono ) {
- pixel = ((scan[x >> 3] & (1 << (x & 7))) != 0);
- if ( pixel != prev ) {
- if ( prev ) {
- writeG3BlackRun( len );
- } else {
- writeG3WhiteRun( len );
- }
- prev = pixel;
- len = 1;
- } else {
- ++len;
- }
- }
- }
-
- if ( imageFormat == QImage::Format_RGB32 ) {
- // Output the last run on the line, and pad to TIFF_FAX_WIDTH.
- if ( len != 0 ) {
- if ( currentColor == qRgb(0, 0, 0) )
- writeG3BlackRun( len );
- else
- writeG3WhiteRun( len );
- }
- if ( width < TIFF_FAX_WIDTH )
- writeG3WhiteRun( TIFF_FAX_WIDTH - width );
- } else if ( imageFormat == QImage::Format_Mono ) {
- if ( len != 0 ) {
- if ( prev ) {
- writeG3BlackRun( len );
- if ( width < TIFF_FAX_WIDTH ) {
- writeG3WhiteRun( TIFF_FAX_WIDTH - width );
- }
- } else {
- if ( width < TIFF_FAX_WIDTH ) {
- writeG3WhiteRun( len + ( TIFF_FAX_WIDTH - width ) );
- } else {
- writeG3WhiteRun( len );
- }
- }
- }
- }
- }
-
- // Flush the last partial byte, which is padded with zero fill bits.
- if ( partialBits > 0 ) {
- buffer.append( (char)( partialByte << ( 8 - partialBits ) ) );
- partialByte = 0;
- partialBits = 0;
- }
-
- // end of page add six EOLs
- for ( int i = 0; i < 6; i++ )
- writeG3EOL();
-
- // Update the byte count for the image data strip.
- buffer.patch( stripBytes, buffer.size() - start );
-}
-
-int QtopiaPrintEnginePrivate::writeG3IFDEntry
- ( int tag, int type, int count, int value )
-{
- buffer.append( (short)tag );
- buffer.append( (short)type );
- buffer.append( count );
- buffer.append( value );
- return buffer.size() - 4; // Offset of the value for back-patching.
-}
-
-void QtopiaPrintEnginePrivate::writeG3Code( int code, int bits )
-{
- partialByte = ( ( partialByte << bits ) | code );
- partialBits += bits;
- while ( partialBits >= 8 ) {
- partialBits -= 8;
- buffer.append( (char)( partialByte >> partialBits ) );
- }
-}
-
-void QtopiaPrintEnginePrivate::writeG3WhiteRun( int len )
-{
- static struct {
- unsigned short code;
- unsigned short bits;
- } whiteCodes[64 + 27] = {
- {0x0035, 8}, // 0
- {0x0007, 6},
- {0x0007, 4},
- {0x0008, 4},
- {0x000B, 4},
- {0x000C, 4},
- {0x000E, 4},
- {0x000F, 4},
- {0x0013, 5}, // 8
- {0x0014, 5},
- {0x0007, 5},
- {0x0008, 5},
- {0x0008, 6},
- {0x0003, 6},
- {0x0034, 6},
- {0x0035, 6},
- {0x002A, 6}, // 16
- {0x002B, 6},
- {0x0027, 7},
- {0x000C, 7},
- {0x0008, 7},
- {0x0017, 7},
- {0x0003, 7},
- {0x0004, 7},
- {0x0028, 7}, // 24
- {0x002B, 7},
- {0x0013, 7},
- {0x0024, 7},
- {0x0018, 7},
- {0x0002, 8},
- {0x0003, 8},
- {0x001A, 8},
- {0x001B, 8}, // 32
- {0x0012, 8},
- {0x0013, 8},
- {0x0014, 8},
- {0x0015, 8},
- {0x0016, 8},
- {0x0017, 8},
- {0x0028, 8},
- {0x0029, 8}, // 40
- {0x002A, 8},
- {0x002B, 8},
- {0x002C, 8},
- {0x002D, 8},
- {0x0004, 8},
- {0x0005, 8},
- {0x000A, 8},
- {0x000B, 8}, // 48
- {0x0052, 8},
- {0x0053, 8},
- {0x0054, 8},
- {0x0055, 8},
- {0x0024, 8},
- {0x0025, 8},
- {0x0058, 8},
- {0x0059, 8}, // 56
- {0x005A, 8},
- {0x005B, 8},
- {0x004A, 8},
- {0x004B, 8},
- {0x0032, 8},
- {0x0033, 8},
- {0x0034, 8},
- {0x001B, 5}, // Make up codes: 64
- {0x0012, 5}, // 128
- {0x0017, 6}, // 192
- {0x0037, 7}, // 256
- {0x0036, 8}, // 320
- {0x0037, 8}, // 384
- {0x0064, 8}, // 448
- {0x0065, 8}, // 512
- {0x0068, 8}, // 576
- {0x0067, 8}, // 640
- {0x00CC, 9}, // 704
- {0x00CD, 9}, // 768
- {0x00D2, 9}, // 832
- {0x00D3, 9}, // 896
- {0x00D4, 9}, // 960
- {0x00D5, 9}, // 1024
- {0x00D6, 9}, // 1088
- {0x00D7, 9}, // 1152
- {0x00D8, 9}, // 1216
- {0x00D9, 9}, // 1280
- {0x00DA, 9}, // 1344
- {0x00DB, 9}, // 1408
- {0x0098, 9}, // 1472
- {0x0099, 9}, // 1536
- {0x009A, 9}, // 1600
- {0x0018, 6}, // 1664
- {0x009B, 9}, // 1728
- };
- if ( len >= 64 ) {
- int index = 63 + (len >> 6);
- writeG3Code( whiteCodes[index].code, whiteCodes[index].bits );
- len &= 63;
- }
- writeG3Code( whiteCodes[len].code, whiteCodes[len].bits );
-}
-
-void QtopiaPrintEnginePrivate::writeG3BlackRun( int len )
-{
- static struct {
- unsigned short code;
- unsigned short bits;
- } blackCodes[64 + 27] = {
- {0x0037, 10}, // 0
- {0x0002, 3},
- {0x0003, 2},
- {0x0002, 2},
- {0x0003, 3},
- {0x0003, 4},
- {0x0002, 4},
- {0x0003, 5},
- {0x0005, 6}, // 8
- {0x0004, 6},
- {0x0004, 7},
- {0x0005, 7},
- {0x0007, 7},
- {0x0004, 8},
- {0x0007, 8},
- {0x0018, 9},
- {0x0017, 10}, // 16
- {0x0018, 10},
- {0x0008, 10},
- {0x0067, 11},
- {0x0068, 11},
- {0x006C, 11},
- {0x0037, 11},
- {0x0028, 11},
- {0x0017, 11}, // 24
- {0x0018, 11},
- {0x00CA, 12},
- {0x00CB, 12},
- {0x00CC, 12},
- {0x00CD, 12},
- {0x0068, 12},
- {0x0069, 12},
- {0x006A, 12}, // 32
- {0x006B, 12},
- {0x00D2, 12},
- {0x00D3, 12},
- {0x00D4, 12},
- {0x00D5, 12},
- {0x00D6, 12},
- {0x00D7, 12},
- {0x006C, 12}, // 40
- {0x006D, 12},
- {0x00DA, 12},
- {0x00DB, 12},
- {0x0054, 12},
- {0x0055, 12},
- {0x0056, 12},
- {0x0057, 12},
- {0x0064, 12}, // 48
- {0x0065, 12},
- {0x0052, 12},
- {0x0053, 12},
- {0x0024, 12},
- {0x0037, 12},
- {0x0038, 12},
- {0x0027, 12},
- {0x0028, 12}, // 56
- {0x0058, 12},
- {0x0059, 12},
- {0x002B, 12},
- {0x002C, 12},
- {0x005A, 12},
- {0x0066, 12},
- {0x0067, 12},
- {0x000F, 10}, // Make up codes: 64
- {0x00C8, 12}, // 128
- {0x00C9, 12}, // 192
- {0x005B, 12}, // 256
- {0x0033, 12}, // 320
- {0x0034, 12}, // 384
- {0x0035, 12}, // 448
- {0x006C, 13}, // 512
- {0x006D, 13}, // 576
- {0x004A, 13}, // 640
- {0x004B, 13}, // 704
- {0x004C, 13}, // 768
- {0x004D, 13}, // 832
- {0x0072, 13}, // 896
- {0x0073, 13}, // 960
- {0x0074, 13}, // 1024
- {0x0075, 13}, // 1088
- {0x0076, 13}, // 1152
- {0x0077, 13}, // 1216
- {0x0052, 13}, // 1280
- {0x0053, 13}, // 1344
- {0x0054, 13}, // 1408
- {0x0055, 13}, // 1472
- {0x005A, 13}, // 1536
- {0x005B, 13}, // 1600
- {0x0064, 13}, // 1664
- {0x0065, 13}, // 1728
- };
- if ( len >= 64 ) {
- int index = 63 + (len >> 6);
- writeG3Code( blackCodes[index].code, blackCodes[index].bits );
- len &= 63;
- }
- writeG3Code( blackCodes[len].code, blackCodes[len].bits );
-}
-
-void QtopiaPrintEnginePrivate::writeG3EOL()
-{
- int bitToPad;
- if ( partialBits <= 4 ) {
- bitToPad = 4 - partialBits;
- } else {
- bitToPad = 8 - partialBits + 4;
- }
-
- partialByte = ((partialByte << (bitToPad + 12)) | 0x0001);
- partialBits += bitToPad + 12;
-
- while ( partialBits >= 8 ) {
- partialBits -= 8;
- buffer.append( (char)(partialByte >> partialBits ) );
- }
-// writeG3Code( 0x0001, 12 );
-}
-
-void QtopiaPrintBuffer::append( short value )
-{
- if ( _bigEndian ) {
- _data.append( (char)(value >> 8) );
- _data.append( (char)value );
- } else {
- _data.append( (char)value );
- _data.append( (char)(value >> 8) );
- }
-}
-
-void QtopiaPrintBuffer::append( int value )
-{
- if ( _bigEndian ) {
- _data.append( (char)(value >> 24) );
- _data.append( (char)(value >> 16) );
- _data.append( (char)(value >> 8) );
- _data.append( (char)value );
- } else {
- _data.append( (char)value );
- _data.append( (char)(value >> 8) );
- _data.append( (char)(value >> 16) );
- _data.append( (char)(value >> 24) );
- }
-}
-
-void QtopiaPrintBuffer::patch( int posn, int value )
-{
- if ( _bigEndian ) {
- _data[posn] = (char)(value >> 24);
- _data[posn + 1] = (char)(value >> 16);
- _data[posn + 2] = (char)(value >> 8);
- _data[posn + 3] = (char)value;
- } else {
- _data[posn] = (char)value;
- _data[posn + 1] = (char)(value >> 8);
- _data[posn + 2] = (char)(value >> 16);
- _data[posn + 3] = (char)(value >> 24);
- }
-}
-
-void QtopiaPrintBuffer::pad()
-{
- while ( ( _data.size() % 4 ) != 0 )
- _data.append( (char)0 );
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PRINTER
diff --git a/src/gui/painting/qprintengine_qws_p.h b/src/gui/painting/qprintengine_qws_p.h
deleted file mode 100644
index 59cbe3eba8..0000000000
--- a/src/gui/painting/qprintengine_qws_p.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPRINTENGINE_QWS_P_H
-#define QPRINTENGINE_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtGui/qprinter.h"
-
-#ifndef QT_NO_PRINTER
-
-#include "QtGui/qprintengine.h"
-#include "QtCore/qbytearray.h"
-#include "private/qpaintengine_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QtopiaPrintEnginePrivate;
-class QRasterPaintEngine;
-class QPrinterPrivate;
-class QImage;
-
-class QtopiaPrintEngine : public QPaintEngine, public QPrintEngine
-{
- Q_DECLARE_PRIVATE(QtopiaPrintEngine)
-public:
- QtopiaPrintEngine(QPrinter::PrinterMode mode);
-
- // override QWSPaintEngine
- bool begin(QPaintDevice *dev);
- bool end();
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- void drawTextItem(const QPointF &p, const QTextItem &ti);
- QPaintEngine::Type type() const { return QPaintEngine::X11; }
-
- QPaintEngine *paintEngine() const;
-
- void updateState(const QPaintEngineState &state);
-
- QRect paperRect() const;
- QRect pageRect() const;
-
- bool newPage();
- bool abort();
-
- QPrinter::PrinterState printerState() const;
-
- int metric(QPaintDevice::PaintDeviceMetric metricType) const;
-
- QVariant property(PrintEnginePropertyKey key) const;
- void setProperty(PrintEnginePropertyKey key, const QVariant &value);
-
-private:
- friend class QPrintDialog;
- friend class QPageSetupDialog;
-
- void clearPage();
- void flushPage();
-};
-
-class QtopiaPrintBuffer
-{
-public:
- QtopiaPrintBuffer( bool bigEndian=FALSE ) { _bigEndian = bigEndian; }
- ~QtopiaPrintBuffer() {}
-
- const QByteArray& data() const { return _data; }
-
- int size() const { return _data.size(); }
-
- void clear() { _data.clear(); }
-
- void append( char value ) { _data.append( value ); }
- void append( short value );
- void append( int value );
- void append( const QByteArray& array ) { _data.append( array ); }
-
- void patch( int posn, int value );
-
- void pad();
-
-private:
- QByteArray _data;
- bool _bigEndian;
-};
-
-#define QT_QWS_PRINTER_DEFAULT_DPI 200
-
-class QtopiaPrintEnginePrivate : public QPaintEnginePrivate
-{
- Q_DECLARE_PUBLIC(QtopiaPrintEngine)
-public:
- QtopiaPrintEnginePrivate(QPrinter::PrinterMode m) :
- mode(m),
- printerState(QPrinter::Idle),
- orientation(QPrinter::Portrait),
- paperSize(QPrinter::A4),
- pageOrder(QPrinter::FirstPageFirst),
- colorMode(QPrinter::GrayScale),
- paperSource(QPrinter::OnlyOne),
- resolution(QT_QWS_PRINTER_DEFAULT_DPI),
- _paintEngine(0),
- numCopies(1),
- outputToFile(false),
- fullPage(false),
- collateCopies(false),
- pageNumber(0),
- pageImage(0),
- partialByte(0),
- partialBits(0)
- {
- }
- ~QtopiaPrintEnginePrivate();
-
- void initialize();
- QPaintEngine *paintEngine();
-
- QPrinter::PrinterMode mode;
-
- QString printerName;
- QString outputFileName;
- QString printProgram;
- QString docName;
- QString creator;
-
- QPrinter::PrinterState printerState;
-
- QPrinter::Orientation orientation;
- QPrinter::PaperSize paperSize;
- QPrinter::PageOrder pageOrder;
- QPrinter::ColorMode colorMode;
- QPrinter::PaperSource paperSource;
-
- int resolution;
- QPaintEngine *_paintEngine;
- int numCopies;
-
- bool outputToFile;
- bool fullPage;
- bool collateCopies;
-
- int pageNumber;
-
- QImage *pageImage;
-
- QtopiaPrintBuffer buffer;
-
- // Definitions that are only relevant to G3FAX output.
- int ifdPatch;
- int partialByte;
- int partialBits;
- void writeG3FaxHeader();
- void writeG3FaxPage();
- int writeG3IFDEntry( int tag, int type, int count, int value );
- void writeG3Code( int code, int bits );
- void writeG3WhiteRun( int len );
- void writeG3BlackRun( int len );
- void writeG3EOL();
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PRINTER
-
-#endif // QPRINTENGINE_QWS_P_H
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index 5111bf4e2d..5f93a2c735 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -45,7 +45,7 @@
#include "qprinterinfo.h"
#include "qlist.h"
#include <qpagesetupdialog.h>
-#include <qapplication.h>
+#include <qcoreapplication.h>
#include <qfileinfo.h>
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
#include "private/qcups_p.h"
@@ -60,7 +60,6 @@
#elif defined (QTOPIA_PRINTENGINE)
#include <private/qprintengine_qws_p.h>
#endif
-#include <private/qprintengine_ps_p.h>
#if defined(Q_WS_X11)
#include <private/qt_x11_p.h>
@@ -73,10 +72,6 @@
#include <qpicture.h>
#include <private/qpaintengine_preview_p.h>
-#if defined(QT3_SUPPORT)
-# include "qprintdialog.h"
-#endif // QT3_SUPPORT
-
QT_BEGIN_NAMESPACE
#define ABORT_IF_ACTIVE(location) \
@@ -164,7 +159,7 @@ void QPrinterPrivate::createDefaultEngines()
#if !defined (QTOPIA_PRINTENGINE)
#if defined (Q_OS_UNIX) && ! defined (Q_WS_MAC)
if(outputFormat == QPrinter::NativeFormat) {
- realOutputFormat = QPrinter::PostScriptFormat;
+ realOutputFormat = QPrinter::PdfFormat;
}
#endif
#endif
@@ -194,12 +189,6 @@ void QPrinterPrivate::createDefaultEngines()
printEngine = pdfEngine;
}
break;
- case QPrinter::PostScriptFormat: {
- QPSPrintEngine *psEngine = new QPSPrintEngine(printerMode);
- paintEngine = psEngine;
- printEngine = psEngine;
- }
- break;
}
use_default_engine = true;
had_default_engines = true;
@@ -260,7 +249,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke
When printing directly to a printer on Windows or Mac OS X, QPrinter uses
the built-in printer drivers. On X11, QPrinter uses the
\l{Common Unix Printing System (CUPS)} or the standard Unix \l lpr utility
- to send PostScript or PDF output to the printer. As an alternative,
+ to send PDF output to the printer. As an alternative,
the printProgram() function can be used to specify the command or utility
to use instead of the system default.
@@ -347,8 +336,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke
printer code.
\value HighResolution On Windows, sets the printer resolution to that
- defined for the printer in use. For PostScript printing, sets the
- resolution of the PostScript driver to 1200 dpi.
+ defined for the printer in use. For PDF printing, sets the
+ resolution of the PDF driver to 1200 dpi.
\note When rendering text on a QPrinter device, it is important
to realize that the size of text, when specified in points, is
@@ -627,9 +616,9 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode)
void QPrinter::init(PrinterMode mode)
{
#if !defined(Q_WS_X11)
- if (!qApp) {
+ if (!QCoreApplication::instance()) {
#else
- if (!qApp || !X11) {
+ if (!QCoreApplication::instance() || !X11) {
#endif
qFatal("QPrinter: Must construct a QApplication before a QPaintDevice");
return;
@@ -709,9 +698,6 @@ QPrinter::~QPrinter()
\value PdfFormat QPrinter will generate its output as a searchable PDF file.
This mode is the default when printing to a file.
- \value PostScriptFormat QPrinter will generate its output as in the PostScript format.
- (This feature was introduced in Qt 4.2.)
-
\sa outputFormat(), setOutputFormat(), setOutputFileName()
*/
@@ -753,7 +739,7 @@ void QPrinter::setOutputFormat(OutputFormat format)
if (def_engine)
delete oldPrintEngine;
- if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat)
+ if (d->outputFormat == QPrinter::PdfFormat)
d->validPrinter = true;
#else
Q_UNUSED(format);
@@ -803,20 +789,15 @@ void QPrinter::setPrinterName(const QString &name)
ABORT_IF_ACTIVE("QPrinter::setPrinterName");
#if defined(Q_OS_UNIX) && !defined(QT_NO_CUPS)
- if(d->use_default_engine
- && d->outputFormat == QPrinter::NativeFormat) {
- if (QCUPSSupport::cupsVersion() >= 10200
- && QCUPSSupport::printerHasPPD(name.toLocal8Bit().constData()))
- setOutputFormat(QPrinter::PdfFormat);
- else
- setOutputFormat(QPrinter::PostScriptFormat);
+ if(d->use_default_engine && d->outputFormat == QPrinter::NativeFormat) {
+ setOutputFormat(QPrinter::PdfFormat);
d->outputFormat = QPrinter::NativeFormat;
}
#endif
QList<QPrinterInfo> prnList = QPrinterInfo::availablePrinters();
if (name.isEmpty()) {
- d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat;
+ d->validPrinter = d->outputFormat == QPrinter::PdfFormat;
} else {
d->validPrinter = false;
for (int i = 0; i < prnList.size(); ++i) {
@@ -836,7 +817,7 @@ void QPrinter::setPrinterName(const QString &name)
\since 4.4
Returns true if the printer currently selected is a valid printer
- in the system, or a pure PDF/PostScript printer; otherwise returns false.
+ in the system, or a pure PDF printer; otherwise returns false.
To detect other failures check the output of QPainter::begin() or QPrinter::newPage().
@@ -902,13 +883,12 @@ QString QPrinter::outputFileName() const
Setting a null or empty name (0 or "") disables printing to a file.
Setting a non-empty name enables printing to a file.
- This can change the value of outputFormat(). If the file name has the
- suffix ".ps" then PostScript is automatically selected as output format.
+ This can change the value of outputFormat().
If the file name has the ".pdf" suffix PDF is generated. If the file name
- has a suffix other than ".ps" and ".pdf", the output format used is the
+ has a suffix other than ".pdf", the output format used is the
one set with setOutputFormat().
- QPrinter uses Qt's cross-platform PostScript or PDF print engines
+ QPrinter uses Qt's cross-platform PDF print engines
respectively. If you can produce this format natively, for example
Mac OS X can generate PDF's from its print engine, set the output format
back to NativeFormat.
@@ -922,9 +902,7 @@ void QPrinter::setOutputFileName(const QString &fileName)
ABORT_IF_ACTIVE("QPrinter::setOutputFileName");
QFileInfo fi(fileName);
- if (!fi.suffix().compare(QLatin1String("ps"), Qt::CaseInsensitive))
- setOutputFormat(QPrinter::PostScriptFormat);
- else if (!fi.suffix().compare(QLatin1String("pdf"), Qt::CaseInsensitive))
+ if (!fi.suffix().compare(QLatin1String("pdf"), Qt::CaseInsensitive))
setOutputFormat(QPrinter::PdfFormat);
else if (fileName.isEmpty())
setOutputFormat(QPrinter::NativeFormat);
@@ -956,7 +934,7 @@ QString QPrinter::printProgram() const
Sets the name of the program that should do the print job to \a
printProg.
- On X11, this function sets the program to call with the PostScript
+ On X11, this function sets the program to call with the PDF
output. On other platforms, it has no effect.
\sa printProgram()
@@ -1798,9 +1776,9 @@ int QPrinter::winPageSize() const
Returns a list of the resolutions (a list of dots-per-inch
integers) that the printer says it supports.
- For X11 where all printing is directly to postscript, this
+ For X11 where all printing is directly to PDF, this
function will always return a one item list containing only the
- postscript resolution, i.e., 72 (72 dpi -- but see PrinterMode).
+ PDF resolution, i.e., 72 (72 dpi -- but see PrinterMode).
*/
QList<int> QPrinter::supportedResolutions() const
{
@@ -2103,161 +2081,6 @@ QPrinter::PrintRange QPrinter::printRange() const
return PrintRange(d->printRange);
}
-#if defined(QT3_SUPPORT)
-
-void QPrinter::setOutputToFile(bool f)
-{
- if (f) {
- if (outputFileName().isEmpty())
- setOutputFileName(QLatin1String("untitled_printer_document"));
- } else {
- setOutputFileName(QString());
- }
-}
-
-bool qt_compat_QPrinter_printSetup(QPrinter *printer, QPrinterPrivate *pd, QWidget *parent)
-{
- Q_UNUSED(pd);
- QPrintDialog dlg(printer, parent);
- return dlg.exec() != 0;
-}
-
-
-#ifdef Q_WS_MAC
-bool qt_compat_QPrinter_pageSetup(QPrinter *p, QWidget *parent)
-{
- QPageSetupDialog psd(p, parent);
- return psd.exec() != 0;
-}
-
-/*!
- Executes a page setup dialog so that the user can configure the type of
- page used for printing. Returns true if the contents of the dialog are
- accepted; returns false if the dialog is canceled.
-*/
-bool QPrinter::pageSetup(QWidget *parent)
-{
- return qt_compat_QPrinter_pageSetup(this, parent);
-}
-
-/*!
- Executes a print setup dialog so that the user can configure the printing
- process. Returns true if the contents of the dialog are accepted; returns
- false if the dialog is canceled.
-*/
-bool QPrinter::printSetup(QWidget *parent)
-{
- Q_D(QPrinter);
- return qt_compat_QPrinter_printSetup(this, d, parent);
-}
-#endif // Q_WS_MAC
-
-/*!
- Use QPrintDialog instead.
-
- \oldcode
- if (printer->setup(parent))
- ...
- \newcode
- QPrintDialog dialog(printer, parent);
- if (dialog.exec())
- ...
- \endcode
-*/
-bool QPrinter::setup(QWidget *parent)
-{
- Q_D(QPrinter);
- return qt_compat_QPrinter_printSetup(this, d, parent)
-#ifdef Q_WS_MAC
- && qt_compat_QPrinter_pageSetup(this, parent);
-#endif
- ;
-}
-
-/*!
- Use QPrintDialog::minPage() instead.
-*/
-int QPrinter::minPage() const
-{
- Q_D(const QPrinter);
- return d->minPage;
-}
-
-/*!
- Use QPrintDialog::maxPage() instead.
-*/
-int QPrinter::maxPage() const
-{
- Q_D(const QPrinter);
- return d->maxPage;
-}
-
-/*!
- Use QPrintDialog::setMinMax() instead.
-*/
-void QPrinter::setMinMax( int minPage, int maxPage )
-{
- Q_D(QPrinter);
- Q_ASSERT_X(minPage <= maxPage, "QPrinter::setMinMax",
- "'min' must be less than or equal to 'max'");
- d->minPage = minPage;
- d->maxPage = maxPage;
- d->options |= QPrintDialog::PrintPageRange;
-}
-
-/*!
- Returns true if the printer is set up to collate copies of printed documents;
- otherwise returns false.
-
- Use QPrintDialog::isOptionEnabled(QPrintDialog::PrintCollateCopies)
- instead.
-
- \sa collateCopies()
-*/
-bool QPrinter::collateCopiesEnabled() const
-{
- Q_D(const QPrinter);
- return (d->options & QPrintDialog::PrintCollateCopies);
-}
-
-/*!
- Use QPrintDialog::setOption(QPrintDialog::PrintCollateCopies)
- or QPrintDialog::setOptions(QPrintDialog::options()
- & ~QPrintDialog::PrintCollateCopies) instead, depending on \a
- enable.
-*/
-void QPrinter::setCollateCopiesEnabled(bool enable)
-{
- Q_D(QPrinter);
-
- if (enable)
- d->options |= QPrintDialog::PrintCollateCopies;
- else
- d->options &= ~QPrintDialog::PrintCollateCopies;
-}
-
-/*!
- Use QPrintDialog instead.
-*/
-void QPrinter::setOptionEnabled( PrinterOption option, bool enable )
-{
- Q_D(QPrinter);
- if (enable)
- d->options |= QPrintDialog::PrintDialogOption(1 << option);
- else
- d->options &= ~QPrintDialog::PrintDialogOption(1 << option);
-}
-
-/*!
- Use QPrintDialog instead.
-*/
-bool QPrinter::isOptionEnabled( PrinterOption option ) const
-{
- Q_D(const QPrinter);
- return (d->options & QPrintDialog::PrintDialogOption(option));
-}
-
-#endif // QT3_SUPPORT
/*!
\class QPrintEngine
diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h
index 6a5d0b7566..8b4dcb3857 100644
--- a/src/gui/painting/qprinter.h
+++ b/src/gui/painting/qprinter.h
@@ -121,7 +121,7 @@ public:
Aborted,
Error };
- enum OutputFormat { NativeFormat, PdfFormat, PostScriptFormat };
+ enum OutputFormat { NativeFormat, PdfFormat };
// ### Qt 5: Merge with QAbstractPrintDialog::PrintRange
enum PrintRange { AllPages, Selection, PageRange, CurrentPage };
@@ -143,10 +143,6 @@ public:
DuplexShortSide
};
-#ifdef QT3_SUPPORT
- enum PrinterOption { PrintToFile, PrintSelection, PrintPageRange };
-#endif // QT3_SUPPORT
-
void setOutputFormat(OutputFormat format);
OutputFormat outputFormat() const;
@@ -259,33 +255,6 @@ public:
void setPageMargins(qreal left, qreal top, qreal right, qreal bottom, Unit unit);
void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, Unit unit) const;
-#ifdef QT3_SUPPORT
-#ifdef Q_WS_MAC
- QT3_SUPPORT bool pageSetup(QWidget *parent = 0);
- QT3_SUPPORT bool printSetup(QWidget *parent = 0);
-#endif
-
- QT3_SUPPORT bool setup(QWidget *parent = 0);
-
- QT3_SUPPORT void setMinMax(int minPage, int maxPage);
- QT3_SUPPORT int minPage() const;
- QT3_SUPPORT int maxPage() const;
-
- QT3_SUPPORT void setCollateCopiesEnabled(bool);
- QT3_SUPPORT bool collateCopiesEnabled() const;
-
- QT3_SUPPORT void setOptionEnabled(PrinterOption, bool enable);
- QT3_SUPPORT bool isOptionEnabled(PrinterOption) const;
-
- inline QT3_SUPPORT QSize margins() const;
- inline QT3_SUPPORT void margins(uint *top, uint *left, uint *bottom, uint *right) const;
-
- inline QT3_SUPPORT bool aborted() { return printerState() == Aborted; }
-
- QT3_SUPPORT void setOutputToFile(bool);
- inline QT3_SUPPORT bool outputToFile() const { return !outputFileName().isEmpty(); }
-#endif
-
protected:
int metric(PaintDeviceMetric) const;
void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine);
@@ -305,29 +274,6 @@ private:
friend class QPageSetupWidget;
};
-#ifdef QT3_SUPPORT
-inline QSize QPrinter::margins() const
-{
- QRect page = pageRect();
- QRect paper = paperRect();
- return QSize(page.left() - paper.left(), page.top() - paper.top());
-}
-
-inline void QPrinter::margins(uint *top, uint *left, uint *bottom, uint *right) const
-{
- QRect page = pageRect();
- QRect paper = paperRect();
- if (top)
- *top = page.top() - paper.top();
- if (left)
- *left = page.left() - paper.left();
- if (bottom)
- *bottom = paper.bottom() - page.bottom();
- if (right)
- *right = paper.right() - page.right();
-}
-#endif
-
#endif // QT_NO_PRINTER
QT_END_NAMESPACE
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index d713346902..ae9dc63a8f 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -252,17 +252,6 @@ QRegion::QRegion(int x, int y, int w, int h, RegionType t)
d = tmp.d;
}
-#ifdef QT3_SUPPORT
-/*!
- Use the constructor tha takes a Qt::FillRule as the second
- argument instead.
-*/
-QRegion::QRegion(const QPolygon &pa, bool winding)
-{
- new (this) QRegion(pa, winding ? Qt::WindingFill : Qt::OddEvenFill);
-}
-#endif
-
/*!
\fn QRegion::~QRegion()
\internal
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 1cd38d41b8..3093dc08c4 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -74,9 +74,6 @@ public:
QRegion(int x, int y, int w, int h, RegionType t = Rectangle);
QRegion(const QRect &r, RegionType t = Rectangle);
QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QRegion(const QPolygon &pa, bool winding);
-#endif
QRegion(const QRegion &region);
QRegion(const QBitmap &bitmap);
~QRegion();
@@ -86,9 +83,6 @@ public:
{ qSwap(d, other.d); return *this; }
#endif
inline void swap(QRegion &other) { qSwap(d, other.d); }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT bool isNull() const { return isEmpty(); }
-#endif
bool isEmpty() const;
bool contains(const QPoint &p) const;
diff --git a/src/gui/painting/qregion_qws.cpp b/src/gui/painting/qregion_qws.cpp
deleted file mode 100644
index dca46d3ec0..0000000000
--- a/src/gui/painting/qregion_qws.cpp
+++ /dev/null
@@ -1,3183 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// XXX - add appropriate friendship relationships
-#define private public
-#include "qregion.h"
-#undef private
-#include "qpainterpath.h"
-#include "qpolygon.h"
-#include "qbuffer.h"
-#include "qimage.h"
-#include <qdebug.h>
-#include "qbitmap.h"
-#include <stdlib.h>
-#include <qatomic.h>
-#include <qsemaphore.h>
-
-QT_BEGIN_NAMESPACE
-
-class QFastMutex
-{
- QAtomicInt contenders;
- QSemaphore semaphore;
-public:
- inline QFastMutex()
- : contenders(0), semaphore(0)
- { }
- inline void lock()
- {
- if (contenders.fetchAndAddAcquire(1) != 0) {
- semaphore.acquire();
- contenders.deref();
- }
- }
- inline bool tryLock()
- {
- return contenders.testAndSetAcquire(0, 1);
- }
- inline void unlock()
- {
- if (!contenders.testAndSetRelease(1, 0))
- semaphore.release();
- }
-};
-
-
-/*
- * 1 if r1 contains r2
- * 0 if r1 does not completely contain r2
- */
-#define CONTAINSCHECK(r1, r2) \
- ((r2).left() >= (r1).left() && (r2).right() <= (r1).right() && \
- (r2).top() >= (r1).top() && (r2).bottom() <= (r1).bottom())
-
-/*
- * clip region
- */
-struct QRegionPrivate : public QRegion::QRegionData {
- enum { Single, Vector } mode;
- int numRects;
- QVector<QRect> rects;
- QRect single;
- QRect extents;
- QRect innerRect;
- union {
- int innerArea;
- QRegionPrivate *next;
- };
-
- inline void vector()
- {
- if(mode != Vector && numRects) {
- if(rects.size() < 1) rects.resize(1);
- rects[0] = single;
- }
- mode = Vector;
- }
-
- inline QRegionPrivate() : mode(Single), numRects(0), innerArea(-1) {}
- inline QRegionPrivate(const QRect &r) : mode(Single) {
- numRects = 1;
-// rects[0] = r;
- single = r;
- extents = r;
- innerRect = r;
- innerArea = r.width() * r.height();
- }
-
- inline QRegionPrivate(const QRegionPrivate &r) {
- mode = r.mode;
- rects = r.rects;
- single = r.single;
- numRects = r.numRects;
- extents = r.extents;
- innerRect = r.innerRect;
- innerArea = r.innerArea;
- }
-
- inline QRegionPrivate &operator=(const QRegionPrivate &r) {
- mode = r.mode;
- rects = r.rects;
- single = r.single;
- numRects = r.numRects;
- extents = r.extents;
- innerRect = r.innerRect;
- innerArea = r.innerArea;
- return *this;
- }
-
- /*
- * Returns true if r is guaranteed to be fully contained in this region.
- * A false return value does not guarantee the opposite.
- */
- inline bool contains(const QRegionPrivate &r) const {
- const QRect &r1 = innerRect;
- const QRect &r2 = r.extents;
- return CONTAINSCHECK(r1, r2);
- }
-
- inline void updateInnerRect(const QRect &rect) {
- const int area = rect.width() * rect.height();
- if (area > innerArea) {
- innerArea = area;
- innerRect = rect;
- }
- }
-
- void append(const QRegionPrivate *r);
- void prepend(const QRegionPrivate *r);
- inline bool canAppend(const QRegionPrivate *r) const;
- inline bool canPrepend(const QRegionPrivate *r) const;
-};
-
-static QRegionPrivate *qt_nextRegionPtr = 0;
-static QFastMutex qt_nextRegionLock;
-
-static QRegionPrivate *qt_allocRegionMemory()
-{
- QRegionPrivate *rv = 0;
- qt_nextRegionLock.lock();
-
- if(qt_nextRegionPtr) {
- rv = qt_nextRegionPtr;
- qt_nextRegionPtr = rv->next;
- } else {
- qt_nextRegionPtr =
- (QRegionPrivate *)malloc(256 * sizeof(QRegionPrivate));
- for(int ii = 0; ii < 256; ++ii) {
- if(ii == 255) {
- qt_nextRegionPtr[ii].next = 0;
- } else {
- qt_nextRegionPtr[ii].next = &qt_nextRegionPtr[ii + 1];
- }
- }
-
- rv = qt_nextRegionPtr;
- qt_nextRegionPtr = rv->next;
- }
-
- qt_nextRegionLock.unlock();
- return rv;
-}
-
-static void qt_freeRegionMemory(QRegionPrivate *rp)
-{
- qt_nextRegionLock.lock();
- rp->next = qt_nextRegionPtr;
- qt_nextRegionPtr = rp;
- qt_nextRegionLock.unlock();
-}
-
-static QRegionPrivate *qt_allocRegion()
-{
- QRegionPrivate *mem = qt_allocRegionMemory();
- return new (mem) QRegionPrivate;
-}
-
-static QRegionPrivate *qt_allocRegion(const QRect &r)
-{
- QRegionPrivate *mem = qt_allocRegionMemory();
- return new (mem) QRegionPrivate(r);
-}
-
-static QRegionPrivate *qt_allocRegion(const QRegionPrivate &r)
-{
- QRegionPrivate *mem = qt_allocRegionMemory();
- return new (mem) QRegionPrivate(r);
-}
-
-void qt_freeRegion(QRegionPrivate *rp)
-{
- rp->~QRegionPrivate();
- qt_freeRegionMemory(rp);
-// delete rp;
-}
-
-static inline bool isEmptyHelper(const QRegionPrivate *preg)
-{
- return !preg || preg->numRects == 0;
-}
-
-void QRegionPrivate::append(const QRegionPrivate *r)
-{
- Q_ASSERT(!isEmptyHelper(r));
-
- vector();
- QRect *destRect = rects.data() + numRects;
- const QRect *srcRect = (r->mode==Vector)?r->rects.constData():&r->single;
- int numAppend = r->numRects;
-
- // test for merge in x direction
- {
- const QRect *rFirst = srcRect;
- QRect *myLast = rects.data() + (numRects - 1);
- if (rFirst->top() == myLast->top()
- && rFirst->height() == myLast->height()
- && rFirst->left() == (myLast->right() + 1))
- {
- myLast->setWidth(myLast->width() + rFirst->width());
- updateInnerRect(*myLast);
- ++srcRect;
- --numAppend;
- }
- }
-
- // append rectangles
- const int newNumRects = numRects + numAppend;
- if (newNumRects > rects.size()) {
- rects.resize(newNumRects);
- destRect = rects.data() + numRects;
- }
- memcpy(destRect, srcRect, numAppend * sizeof(QRect));
-
- // update inner rectangle
- if (innerArea < r->innerArea) {
- innerArea = r->innerArea;
- innerRect = r->innerRect;
- }
-
- // update extents
- destRect = &extents;
- srcRect = &r->extents;
- extents.setCoords(qMin(destRect->left(), srcRect->left()),
- qMin(destRect->top(), srcRect->top()),
- qMax(destRect->right(), srcRect->right()),
- qMax(destRect->bottom(), srcRect->bottom()));
-
- numRects = newNumRects;
-}
-
-void QRegionPrivate::prepend(const QRegionPrivate *r)
-{
-#if 1
- Q_UNUSED(r);
-#else
- // XXX ak: does not respect vectorization of region
-
- Q_ASSERT(!isEmpty(r));
-
- // move existing rectangles
- memmove(rects.data() + r->numRects, rects.constData(),
- numRects * sizeof(QRect));
-
- // prepend new rectangles
- memcpy(rects.data(), r->rects.constData(), r->numRects * sizeof(QRect));
-
- // update inner rectangle
- if (innerArea < r->innerArea) {
- innerArea = r->innerArea;
- innerRect = r->innerRect;
- }
-
- // update extents
- destRect = &extents;
- srcRect = &r->extents;
- extents.setCoords(qMin(destRect->left(), srcRect->left()),
- qMin(destRect->top(), srcRect->top()),
- qMax(destRect->right(), srcRect->right()),
- qMax(destRect->bottom(), srcRect->bottom()));
-
- numRects = newNumRects;
-#endif
-}
-
-bool QRegionPrivate::canAppend(const QRegionPrivate *r) const
-{
- Q_ASSERT(!isEmptyHelper(r));
-
- const QRect *rFirst = (r->mode==Vector)?r->rects.constData():&r->single;
- const QRect *myLast = (mode==Vector)?(rects.constData() + (numRects - 1)):&single;
- // XXX: possible improvements:
- // - nFirst->top() == myLast->bottom() + 1, must possibly merge bands
- if (rFirst->top() > (myLast->bottom() + 1)
- || (rFirst->top() == myLast->top()
- && rFirst->height() == myLast->height()
- && rFirst->left() > myLast->right()))
- {
- return true;
- }
-
- return false;
-}
-
-bool QRegionPrivate::canPrepend(const QRegionPrivate *r) const
-{
-#if 1
- Q_UNUSED(r);
- return false;
-#else
- return r->canAppend(this);
-#endif
-}
-
-#if defined(Q_WS_X11)
-QT_BEGIN_INCLUDE_NAMESPACE
-# include "qregion_x11.cpp"
-QT_END_INCLUDE_NAMESPACE
-#elif defined(Q_WS_MAC)
-QT_BEGIN_INCLUDE_NAMESPACE
-# include "qregion_mac.cpp"
-QT_END_INCLUDE_NAMESPACE
-#elif defined(Q_WS_QWS)
-static QRegionPrivate qrp;
-QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp};
-#endif
-
-typedef void (*OverlapFunc)(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End,
- register const QRect *r2, const QRect *r2End, register int y1, register int y2);
-typedef void (*NonOverlapFunc)(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd,
- register int y1, register int y2);
-
-static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2);
-static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest);
-static void miRegionOp(register QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2,
- OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func,
- NonOverlapFunc nonOverlap2Func);
-
-#define RectangleOut 0
-#define RectangleIn 1
-#define RectanglePart 2
-#define EvenOddRule 0
-#define WindingRule 1
-
-// START OF region.h extract
-/* $XConsortium: region.h,v 11.14 94/04/17 20:22:20 rws Exp $ */
-/************************************************************************
-
-Copyright (c) 1987 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from the X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-
-#ifndef _XREGION_H
-#define _XREGION_H
-
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <limits.h>
-QT_END_INCLUDE_NAMESPACE
-
-/* 1 if two BOXs overlap.
- * 0 if two BOXs do not overlap.
- * Remember, x2 and y2 are not in the region
- */
-#define EXTENTCHECK(r1, r2) \
- ((r1)->right() >= (r2)->left() && \
- (r1)->left() <= (r2)->right() && \
- (r1)->bottom() >= (r2)->top() && \
- (r1)->top() <= (r2)->bottom())
-
-/*
- * update region extents
- */
-#define EXTENTS(r,idRect){\
- if((r)->left() < (idRect)->extents.left())\
- (idRect)->extents.setLeft((r)->left());\
- if((r)->top() < (idRect)->extents.top())\
- (idRect)->extents.setTop((r)->top());\
- if((r)->right() > (idRect)->extents.right())\
- (idRect)->extents.setRight((r)->right());\
- if((r)->bottom() > (idRect)->extents.bottom())\
- (idRect)->extents.setBottom((r)->bottom());\
- }
-
-/*
- * Check to see if there is enough memory in the present region.
- */
-#define MEMCHECK(dest, rect, firstrect){\
- if ((dest).numRects >= ((dest).rects.size()-1)){\
- firstrect.resize(firstrect.size() * 2); \
- (rect) = (firstrect).data() + (dest).numRects;\
- }\
- }
-
-
-/*
- * number of points to buffer before sending them off
- * to scanlines(): Must be an even number
- */
-#define NUMPTSTOBUFFER 200
-
-/*
- * used to allocate buffers for points and link
- * the buffers together
- */
-typedef struct _POINTBLOCK {
- QPoint pts[NUMPTSTOBUFFER];
- struct _POINTBLOCK *next;
-} POINTBLOCK;
-
-#endif
-// END OF region.h extract
-
-// START OF Region.c extract
-/* $XConsortium: Region.c /main/30 1996/10/22 14:21:24 kaleb $ */
-/************************************************************************
-
-Copyright (c) 1987, 1988 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from the X Consortium.
-
-
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-/*
- * The functions in this file implement the Region abstraction, similar to one
- * used in the X11 sample server. A Region is simply an area, as the name
- * implies, and is implemented as a "y-x-banded" array of rectangles. To
- * explain: Each Region is made up of a certain number of rectangles sorted
- * by y coordinate first, and then by x coordinate.
- *
- * Furthermore, the rectangles are banded such that every rectangle with a
- * given upper-left y coordinate (y1) will have the same lower-right y
- * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it
- * will span the entire vertical distance of the band. This means that some
- * areas that could be merged into a taller rectangle will be represented as
- * several shorter rectangles to account for shorter rectangles to its left
- * or right but within its "vertical scope".
- *
- * An added constraint on the rectangles is that they must cover as much
- * horizontal area as possible. E.g. no two rectangles in a band are allowed
- * to touch.
- *
- * Whenever possible, bands will be merged together to cover a greater vertical
- * distance (and thus reduce the number of rectangles). Two bands can be merged
- * only if the bottom of one touches the top of the other and they have
- * rectangles in the same places (of the same width, of course). This maintains
- * the y-x-banding that's so nice to have...
- */
-/* $XFree86: xc/lib/X11/Region.c,v 1.1.1.2.2.2 1998/10/04 15:22:50 hohndel Exp $ */
-
-static void UnionRectWithRegion(register const QRect *rect, const QRegionPrivate *source,
- QRegionPrivate &dest)
-{
- if (!rect->width() || !rect->height())
- return;
-
- QRegionPrivate region(*rect);
-
- Q_ASSERT(EqualRegion(source, &dest));
- Q_ASSERT(!isEmptyHelper(&region));
-
- if (dest.numRects == 0)
- dest = region;
- else if (dest.canAppend(&region))
- dest.append(&region);
- else
- UnionRegion(&region, source, dest);
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSetExtents --
- * Reset the extents and innerRect of a region to what they should be.
- * Called by miSubtract and miIntersect b/c they can't figure it out
- * along the way or do so easily, as miUnion can.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The region's 'extents' and 'innerRect' structure is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-static void miSetExtents(QRegionPrivate &dest)
-{
- register const QRect *pBox,
- *pBoxEnd;
- register QRect *pExtents;
-
- dest.innerRect.setCoords(0, 0, -1, -1);
- dest.innerArea = -1;
- if (dest.numRects == 0) {
- dest.extents.setCoords(0, 0, 0, 0);
- return;
- }
-
- pExtents = &dest.extents;
- pBox = (dest.mode==QRegionPrivate::Vector)?(dest.rects.constData()):(&dest.single);
- pBoxEnd = (dest.mode==QRegionPrivate::Vector)?(&pBox[dest.numRects - 1]):(&dest.single);
-
- /*
- * Since pBox is the first rectangle in the region, it must have the
- * smallest y1 and since pBoxEnd is the last rectangle in the region,
- * it must have the largest y2, because of banding. Initialize x1 and
- * x2 from pBox and pBoxEnd, resp., as good things to initialize them
- * to...
- */
- pExtents->setLeft(pBox->left());
- pExtents->setTop(pBox->top());
- pExtents->setRight(pBoxEnd->right());
- pExtents->setBottom(pBoxEnd->bottom());
-
- Q_ASSERT(pExtents->top() <= pExtents->bottom());
- while (pBox <= pBoxEnd) {
- if (pBox->left() < pExtents->left())
- pExtents->setLeft(pBox->left());
- if (pBox->right() > pExtents->right())
- pExtents->setRight(pBox->right());
- dest.updateInnerRect(*pBox);
- ++pBox;
- }
- Q_ASSERT(pExtents->left() <= pExtents->right());
-}
-
-/* TranslateRegion(pRegion, x, y)
- translates in place
- added by raymond
-*/
-
-static void OffsetRegion(register QRegionPrivate &region, register int x, register int y)
-{
- register int nbox;
- register QRect *pbox;
-
- if(region.mode == QRegionPrivate::Single) {
- region.single.translate(x, y);
- } else {
- pbox = region.rects.data();
- nbox = region.numRects;
-
- while (nbox--) {
- pbox->translate(x, y);
- ++pbox;
- }
- }
- region.extents.translate(x, y);
- region.innerRect.translate(x, y);
-}
-
-/*======================================================================
- * Region Intersection
- *====================================================================*/
-/*-
- *-----------------------------------------------------------------------
- * miIntersectO --
- * Handle an overlapping band for miIntersect.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * Rectangles may be added to the region.
- *
- *-----------------------------------------------------------------------
- */
-static void miIntersectO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End,
- register const QRect *r2, const QRect *r2End, int y1, int y2)
-{
- register int x1;
- register int x2;
- register QRect *pNextRect;
-
- pNextRect = dest.rects.data() + dest.numRects;
-
- while (r1 != r1End && r2 != r2End) {
- x1 = qMax(r1->left(), r2->left());
- x2 = qMin(r1->right(), r2->right());
-
- /*
- * If there's any overlap between the two rectangles, add that
- * overlap to the new region.
- * There's no need to check for subsumption because the only way
- * such a need could arise is if some region has two rectangles
- * right next to each other. Since that should never happen...
- */
- if (x1 <= x2) {
- Q_ASSERT(y1 <= y2);
- MEMCHECK(dest, pNextRect, dest.rects)
- pNextRect->setCoords(x1, y1, x2, y2);
- ++dest.numRects;
- ++pNextRect;
- }
-
- /*
- * Need to advance the pointers. Shift the one that extends
- * to the right the least, since the other still has a chance to
- * overlap with that region's next rectangle, if you see what I mean.
- */
- if (r1->right() < r2->right()) {
- ++r1;
- } else if (r2->right() < r1->right()) {
- ++r2;
- } else {
- ++r1;
- ++r2;
- }
- }
-}
-
-/*======================================================================
- * Generic Region Operator
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miCoalesce --
- * Attempt to merge the boxes in the current band with those in the
- * previous one. Used only by miRegionOp.
- *
- * Results:
- * The new index for the previous band.
- *
- * Side Effects:
- * If coalescing takes place:
- * - rectangles in the previous band will have their y2 fields
- * altered.
- * - dest.numRects will be decreased.
- *
- *-----------------------------------------------------------------------
- */
-static int miCoalesce(register QRegionPrivate &dest, int prevStart, int curStart)
-{
- register QRect *pPrevBox; /* Current box in previous band */
- register QRect *pCurBox; /* Current box in current band */
- register QRect *pRegEnd; /* End of region */
- int curNumRects; /* Number of rectangles in current band */
- int prevNumRects; /* Number of rectangles in previous band */
- int bandY1; /* Y1 coordinate for current band */
- QRect *rData = dest.rects.data();
-
- pRegEnd = rData + dest.numRects;
-
- pPrevBox = rData + prevStart;
- prevNumRects = curStart - prevStart;
-
- /*
- * Figure out how many rectangles are in the current band. Have to do
- * this because multiple bands could have been added in miRegionOp
- * at the end when one region has been exhausted.
- */
- pCurBox = rData + curStart;
- bandY1 = pCurBox->top();
- for (curNumRects = 0; pCurBox != pRegEnd && pCurBox->top() == bandY1; ++curNumRects) {
- ++pCurBox;
- }
-
- if (pCurBox != pRegEnd) {
- /*
- * If more than one band was added, we have to find the start
- * of the last band added so the next coalescing job can start
- * at the right place... (given when multiple bands are added,
- * this may be pointless -- see above).
- */
- --pRegEnd;
- while ((pRegEnd - 1)->top() == pRegEnd->top())
- --pRegEnd;
- curStart = pRegEnd - rData;
- pRegEnd = rData + dest.numRects;
- }
-
- if (curNumRects == prevNumRects && curNumRects != 0) {
- pCurBox -= curNumRects;
- /*
- * The bands may only be coalesced if the bottom of the previous
- * matches the top scanline of the current.
- */
- if (pPrevBox->bottom() == pCurBox->top() - 1) {
- /*
- * Make sure the bands have boxes in the same places. This
- * assumes that boxes have been added in such a way that they
- * cover the most area possible. I.e. two boxes in a band must
- * have some horizontal space between them.
- */
- do {
- if (pPrevBox->left() != pCurBox->left() || pPrevBox->right() != pCurBox->right()) {
- // The bands don't line up so they can't be coalesced.
- return curStart;
- }
- ++pPrevBox;
- ++pCurBox;
- --prevNumRects;
- } while (prevNumRects != 0);
-
- dest.numRects -= curNumRects;
- pCurBox -= curNumRects;
- pPrevBox -= curNumRects;
-
- /*
- * The bands may be merged, so set the bottom y of each box
- * in the previous band to that of the corresponding box in
- * the current band.
- */
- do {
- pPrevBox->setBottom(pCurBox->bottom());
- dest.updateInnerRect(*pPrevBox);
- ++pPrevBox;
- ++pCurBox;
- curNumRects -= 1;
- } while (curNumRects != 0);
-
- /*
- * If only one band was added to the region, we have to backup
- * curStart to the start of the previous band.
- *
- * If more than one band was added to the region, copy the
- * other bands down. The assumption here is that the other bands
- * came from the same region as the current one and no further
- * coalescing can be done on them since it's all been done
- * already... curStart is already in the right place.
- */
- if (pCurBox == pRegEnd) {
- curStart = prevStart;
- } else {
- do {
- *pPrevBox++ = *pCurBox++;
- dest.updateInnerRect(*pPrevBox);
- } while (pCurBox != pRegEnd);
- }
- }
- }
- return curStart;
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionOp --
- * Apply an operation to two regions. Called by miUnion, miInverse,
- * miSubtract, miIntersect...
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The new region is overwritten.
- *
- * Notes:
- * The idea behind this function is to view the two regions as sets.
- * Together they cover a rectangle of area that this function divides
- * into horizontal bands where points are covered only by one region
- * or by both. For the first case, the nonOverlapFunc is called with
- * each the band and the band's upper and lower extents. For the
- * second, the overlapFunc is called to process the entire band. It
- * is responsible for clipping the rectangles in the band, though
- * this function provides the boundaries.
- * At the end of each band, the new region is coalesced, if possible,
- * to reduce the number of rectangles in the region.
- *
- *-----------------------------------------------------------------------
- */
-static void miRegionOp(register QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2,
- OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func,
- NonOverlapFunc nonOverlap2Func)
-{
- register const QRect *r1; // Pointer into first region
- register const QRect *r2; // Pointer into 2d region
- const QRect *r1End; // End of 1st region
- const QRect *r2End; // End of 2d region
- register int ybot; // Bottom of intersection
- register int ytop; // Top of intersection
- int prevBand; // Index of start of previous band in dest
- int curBand; // Index of start of current band in dest
- register const QRect *r1BandEnd; // End of current band in r1
- register const QRect *r2BandEnd; // End of current band in r2
- int top; // Top of non-overlapping band
- int bot; // Bottom of non-overlapping band
-
- /*
- * Initialization:
- * set r1, r2, r1End and r2End appropriately, preserve the important
- * parts of the destination region until the end in case it's one of
- * the two source regions, then mark the "new" region empty, allocating
- * another array of rectangles for it to use.
- */
- r1 = (reg1->mode==QRegionPrivate::Vector)?reg1->rects.data():&reg1->single;
- r2 = (reg2->mode==QRegionPrivate::Vector)?reg2->rects.data():&reg2->single;
- r1End = r1 + reg1->numRects;
- r2End = r2 + reg2->numRects;
-
- dest.vector();
- QVector<QRect> oldRects = dest.rects;
-
- dest.numRects = 0;
-
- /*
- * Allocate a reasonable number of rectangles for the new region. The idea
- * is to allocate enough so the individual functions don't need to
- * reallocate and copy the array, which is time consuming, yet we don't
- * have to worry about using too much memory. I hope to be able to
- * nuke the realloc() at the end of this function eventually.
- */
- dest.rects.resize(qMax(reg1->numRects,reg2->numRects) * 2);
-
- /*
- * Initialize ybot and ytop.
- * In the upcoming loop, ybot and ytop serve different functions depending
- * on whether the band being handled is an overlapping or non-overlapping
- * band.
- * In the case of a non-overlapping band (only one of the regions
- * has points in the band), ybot is the bottom of the most recent
- * intersection and thus clips the top of the rectangles in that band.
- * ytop is the top of the next intersection between the two regions and
- * serves to clip the bottom of the rectangles in the current band.
- * For an overlapping band (where the two regions intersect), ytop clips
- * the top of the rectangles of both regions and ybot clips the bottoms.
- */
- if (reg1->extents.top() < reg2->extents.top())
- ybot = reg1->extents.top() - 1;
- else
- ybot = reg2->extents.top() - 1;
-
- /*
- * prevBand serves to mark the start of the previous band so rectangles
- * can be coalesced into larger rectangles. qv. miCoalesce, above.
- * In the beginning, there is no previous band, so prevBand == curBand
- * (curBand is set later on, of course, but the first band will always
- * start at index 0). prevBand and curBand must be indices because of
- * the possible expansion, and resultant moving, of the new region's
- * array of rectangles.
- */
- prevBand = 0;
-
- do {
- curBand = dest.numRects;
-
- /*
- * This algorithm proceeds one source-band (as opposed to a
- * destination band, which is determined by where the two regions
- * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
- * rectangle after the last one in the current band for their
- * respective regions.
- */
- r1BandEnd = r1;
- while (r1BandEnd != r1End && r1BandEnd->top() == r1->top())
- ++r1BandEnd;
-
- r2BandEnd = r2;
- while (r2BandEnd != r2End && r2BandEnd->top() == r2->top())
- ++r2BandEnd;
-
- /*
- * First handle the band that doesn't intersect, if any.
- *
- * Note that attention is restricted to one band in the
- * non-intersecting region at once, so if a region has n
- * bands between the current position and the next place it overlaps
- * the other, this entire loop will be passed through n times.
- */
- if (r1->top() < r2->top()) {
- top = qMax(r1->top(), ybot + 1);
- bot = qMin(r1->bottom(), r2->top() - 1);
-
- if (nonOverlap1Func != 0 && bot >= top)
- (*nonOverlap1Func)(dest, r1, r1BandEnd, top, bot);
- ytop = r2->top();
- } else if (r2->top() < r1->top()) {
- top = qMax(r2->top(), ybot + 1);
- bot = qMin(r2->bottom(), r1->top() - 1);
-
- if (nonOverlap2Func != 0 && bot >= top)
- (*nonOverlap2Func)(dest, r2, r2BandEnd, top, bot);
- ytop = r1->top();
- } else {
- ytop = r1->top();
- }
-
- /*
- * If any rectangles got added to the region, try and coalesce them
- * with rectangles from the previous band. Note we could just do
- * this test in miCoalesce, but some machines incur a not
- * inconsiderable cost for function calls, so...
- */
- if (dest.numRects != curBand)
- prevBand = miCoalesce(dest, prevBand, curBand);
-
- /*
- * Now see if we've hit an intersecting band. The two bands only
- * intersect if ybot >= ytop
- */
- ybot = qMin(r1->bottom(), r2->bottom());
- curBand = dest.numRects;
- if (ybot >= ytop)
- (*overlapFunc)(dest, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
-
- if (dest.numRects != curBand)
- prevBand = miCoalesce(dest, prevBand, curBand);
-
- /*
- * If we've finished with a band (y2 == ybot) we skip forward
- * in the region to the next band.
- */
- if (r1->bottom() == ybot)
- r1 = r1BandEnd;
- if (r2->bottom() == ybot)
- r2 = r2BandEnd;
- } while (r1 != r1End && r2 != r2End);
-
- /*
- * Deal with whichever region still has rectangles left.
- */
- curBand = dest.numRects;
- if (r1 != r1End) {
- if (nonOverlap1Func != 0) {
- do {
- r1BandEnd = r1;
- while (r1BandEnd < r1End && r1BandEnd->top() == r1->top())
- ++r1BandEnd;
- (*nonOverlap1Func)(dest, r1, r1BandEnd, qMax(r1->top(), ybot + 1), r1->bottom());
- r1 = r1BandEnd;
- } while (r1 != r1End);
- }
- } else if ((r2 != r2End) && (nonOverlap2Func != 0)) {
- do {
- r2BandEnd = r2;
- while (r2BandEnd < r2End && r2BandEnd->top() == r2->top())
- ++r2BandEnd;
- (*nonOverlap2Func)(dest, r2, r2BandEnd, qMax(r2->top(), ybot + 1), r2->bottom());
- r2 = r2BandEnd;
- } while (r2 != r2End);
- }
-
- if (dest.numRects != curBand)
- (void)miCoalesce(dest, prevBand, curBand);
-
- /*
- * A bit of cleanup. To keep regions from growing without bound,
- * we shrink the array of rectangles to match the new number of
- * rectangles in the region.
- *
- * Only do this stuff if the number of rectangles allocated is more than
- * twice the number of rectangles in the region (a simple optimization).
- */
- if (qMax(4, dest.numRects) < (dest.rects.size() >> 1))
- dest.rects.resize(dest.numRects);
-}
-
-/*======================================================================
- * Region Union
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miUnionNonO --
- * Handle a non-overlapping band for the union operation. Just
- * Adds the rectangles into the region. Doesn't have to check for
- * subsumption or anything.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * dest.numRects is incremented and the final rectangles overwritten
- * with the rectangles we're passed.
- *
- *-----------------------------------------------------------------------
- */
-
-static void miUnionNonO(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd,
- register int y1, register int y2)
-{
- register QRect *pNextRect;
-
- pNextRect = dest.rects.data() + dest.numRects;
-
- Q_ASSERT(y1 <= y2);
-
- while (r != rEnd) {
- Q_ASSERT(r->left() <= r->right());
- MEMCHECK(dest, pNextRect, dest.rects)
- pNextRect->setCoords(r->left(), y1, r->right(), y2);
- dest.numRects++;
- ++pNextRect;
- ++r;
- }
-}
-
-
-/*-
- *-----------------------------------------------------------------------
- * miUnionO --
- * Handle an overlapping band for the union operation. Picks the
- * left-most rectangle each time and merges it into the region.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * Rectangles are overwritten in dest.rects and dest.numRects will
- * be changed.
- *
- *-----------------------------------------------------------------------
- */
-
-static void miUnionO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End,
- register const QRect *r2, const QRect *r2End, register int y1, register int y2)
-{
- register QRect *pNextRect;
-
- pNextRect = dest.rects.data() + dest.numRects;
-
-#define MERGERECT(r) \
- if ((dest.numRects != 0) && \
- (pNextRect[-1].top() == y1) && \
- (pNextRect[-1].bottom() == y2) && \
- (pNextRect[-1].right() >= r->left()-1)) { \
- if (pNextRect[-1].right() < r->right()) { \
- pNextRect[-1].setRight(r->right()); \
- dest.updateInnerRect(pNextRect[-1]); \
- Q_ASSERT(pNextRect[-1].left() <= pNextRect[-1].right()); \
- } \
- } else { \
- MEMCHECK(dest, pNextRect, dest.rects) \
- pNextRect->setCoords(r->left(), y1, r->right(), y2); \
- dest.updateInnerRect(*pNextRect); \
- dest.numRects++; \
- pNextRect++; \
- } \
- r++;
-
- Q_ASSERT(y1 <= y2);
- while (r1 != r1End && r2 != r2End) {
- if (r1->left() < r2->left()) {
- MERGERECT(r1)
- } else {
- MERGERECT(r2)
- }
- }
-
- if (r1 != r1End) {
- do {
- MERGERECT(r1)
- } while (r1 != r1End);
- } else {
- while (r2 != r2End) {
- MERGERECT(r2)
- }
- }
-}
-
-static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest)
-{
- Q_ASSERT(!isEmptyHelper(reg1) && !isEmptyHelper(reg2));
- Q_ASSERT(!reg1->contains(*reg2));
- Q_ASSERT(!reg2->contains(*reg1));
- Q_ASSERT(!EqualRegion(reg1, reg2));
- Q_ASSERT(!reg1->canAppend(reg2));
- Q_ASSERT(!reg2->canAppend(reg1));
-
- if (reg1->innerArea > reg2->innerArea) {
- dest.innerArea = reg1->innerArea;
- dest.innerRect = reg1->innerRect;
- } else {
- dest.innerArea = reg2->innerArea;
- dest.innerRect = reg2->innerRect;
- }
- miRegionOp(dest, reg1, reg2, miUnionO, miUnionNonO, miUnionNonO);
-
- dest.extents.setCoords(qMin(reg1->extents.left(), reg2->extents.left()),
- qMin(reg1->extents.top(), reg2->extents.top()),
- qMax(reg1->extents.right(), reg2->extents.right()),
- qMax(reg1->extents.bottom(), reg2->extents.bottom()));
-}
-
-/*======================================================================
- * Region Subtraction
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtractNonO --
- * Deal with non-overlapping band for subtraction. Any parts from
- * region 2 we discard. Anything from region 1 we add to the region.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * dest may be affected.
- *
- *-----------------------------------------------------------------------
- */
-
-static void miSubtractNonO1(register QRegionPrivate &dest, register const QRect *r,
- const QRect *rEnd, register int y1, register int y2)
-{
- register QRect *pNextRect;
-
- pNextRect = dest.rects.data() + dest.numRects;
-
- Q_ASSERT(y1<=y2);
-
- while (r != rEnd) {
- Q_ASSERT(r->left() <= r->right());
- MEMCHECK(dest, pNextRect, dest.rects)
- pNextRect->setCoords(r->left(), y1, r->right(), y2);
- ++dest.numRects;
- ++pNextRect;
- ++r;
- }
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtractO --
- * Overlapping band subtraction. x1 is the left-most point not yet
- * checked.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * dest may have rectangles added to it.
- *
- *-----------------------------------------------------------------------
- */
-
-static void miSubtractO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End,
- register const QRect *r2, const QRect *r2End, register int y1, register int y2)
-{
- register QRect *pNextRect;
- register int x1;
-
- x1 = r1->left();
-
- Q_ASSERT(y1 <= y2);
- pNextRect = dest.rects.data() + dest.numRects;
-
- while (r1 != r1End && r2 != r2End) {
- if (r2->right() < x1) {
- /*
- * Subtrahend missed the boat: go to next subtrahend.
- */
- ++r2;
- } else if (r2->left() <= x1) {
- /*
- * Subtrahend precedes minuend: nuke left edge of minuend.
- */
- x1 = r2->right() + 1;
- if (x1 > r1->right()) {
- /*
- * Minuend completely covered: advance to next minuend and
- * reset left fence to edge of new minuend.
- */
- ++r1;
- if (r1 != r1End)
- x1 = r1->left();
- } else {
- // Subtrahend now used up since it doesn't extend beyond minuend
- ++r2;
- }
- } else if (r2->left() <= r1->right()) {
- /*
- * Left part of subtrahend covers part of minuend: add uncovered
- * part of minuend to region and skip to next subtrahend.
- */
- Q_ASSERT(x1 < r2->left());
- MEMCHECK(dest, pNextRect, dest.rects)
- pNextRect->setCoords(x1, y1, r2->left() - 1, y2);
- ++dest.numRects;
- ++pNextRect;
-
- x1 = r2->right() + 1;
- if (x1 > r1->right()) {
- /*
- * Minuend used up: advance to new...
- */
- ++r1;
- if (r1 != r1End)
- x1 = r1->left();
- } else {
- // Subtrahend used up
- ++r2;
- }
- } else {
- /*
- * Minuend used up: add any remaining piece before advancing.
- */
- if (r1->right() >= x1) {
- MEMCHECK(dest, pNextRect, dest.rects)
- pNextRect->setCoords(x1, y1, r1->right(), y2);
- ++dest.numRects;
- ++pNextRect;
- }
- ++r1;
- if (r1 != r1End)
- x1 = r1->left();
- }
- }
-
- /*
- * Add remaining minuend rectangles to region.
- */
- while (r1 != r1End) {
- Q_ASSERT(x1 <= r1->right());
- MEMCHECK(dest, pNextRect, dest.rects)
- pNextRect->setCoords(x1, y1, r1->right(), y2);
- ++dest.numRects;
- ++pNextRect;
-
- ++r1;
- if (r1 != r1End)
- x1 = r1->left();
- }
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtract --
- * Subtract regS from regM and leave the result in regD.
- * S stands for subtrahend, M for minuend and D for difference.
- *
- * Side Effects:
- * regD is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-
-static void SubtractRegion(QRegionPrivate *regM, QRegionPrivate *regS,
- register QRegionPrivate &dest)
-{
- Q_ASSERT(!isEmptyHelper(regM));
- Q_ASSERT(!isEmptyHelper(regS));
- Q_ASSERT(EXTENTCHECK(&regM->extents, &regS->extents));
- Q_ASSERT(!regS->contains(*regM));
- Q_ASSERT(!EqualRegion(regM, regS));
-
- miRegionOp(dest, regM, regS, miSubtractO, miSubtractNonO1, 0);
-
- /*
- * Can't alter dest's extents before we call miRegionOp because
- * it might be one of the source regions and miRegionOp depends
- * on the extents of those regions being the unaltered. Besides, this
- * way there's no checking against rectangles that will be nuked
- * due to coalescing, so we have to examine fewer rectangles.
- */
- miSetExtents(dest);
-}
-
-static void XorRegion(QRegionPrivate *sra, QRegionPrivate *srb, QRegionPrivate &dest)
-{
- Q_ASSERT(!isEmptyHelper(sra) && !isEmptyHelper(srb));
- Q_ASSERT(EXTENTCHECK(&sra->extents, &srb->extents));
- Q_ASSERT(!EqualRegion(sra, srb));
-
- QRegionPrivate tra, trb;
-
- if (!srb->contains(*sra))
- SubtractRegion(sra, srb, tra);
- if (!sra->contains(*srb))
- SubtractRegion(srb, sra, trb);
-
- Q_ASSERT(isEmptyHelper(&trb) || !tra.contains(trb));
- Q_ASSERT(isEmptyHelper(&tra) || !trb.contains(tra));
-
- if (isEmptyHelper(&tra)) {
- dest = trb;
- } else if (isEmptyHelper(&trb)) {
- dest = tra;
- } else if (tra.canAppend(&trb)) {
- dest = tra;
- dest.append(&trb);
- } else if (trb.canAppend(&tra)) {
- dest = trb;
- dest.append(&tra);
- } else {
- UnionRegion(&tra, &trb, dest);
- }
-}
-
-/*
- * Check to see if two regions are equal
- */
-static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2)
-{
- if (r1->numRects != r2->numRects) {
- return false;
- } else if (r1->numRects == 0) {
- return true;
- } else if (r1->extents != r2->extents) {
- return false;
- } else if (r1->mode == QRegionPrivate::Single && r2->mode == QRegionPrivate::Single) {
- return r1->single == r2->single;
- } else {
- const QRect *rr1 = (r1->mode==QRegionPrivate::Vector)?r1->rects.constData():&r1->single;
- const QRect *rr2 = (r2->mode==QRegionPrivate::Vector)?r2->rects.constData():&r2->single;
- for (int i = 0; i < r1->numRects; ++i, ++rr1, ++rr2) {
- if (*rr1 != *rr2)
- return false;
- }
- }
-
- return true;
-}
-
-static bool PointInRegion(QRegionPrivate *pRegion, int x, int y)
-{
- int i;
-
- if (pRegion->mode == QRegionPrivate::Single)
- return pRegion->single.contains(x, y);
- if (isEmptyHelper(pRegion))
- return false;
- if (!pRegion->extents.contains(x, y))
- return false;
- if (pRegion->innerRect.contains(x, y))
- return true;
- for (i = 0; i < pRegion->numRects; ++i) {
- if (pRegion->rects[i].contains(x, y))
- return true;
- }
- return false;
-}
-
-static bool RectInRegion(register QRegionPrivate *region, int rx, int ry, uint rwidth, uint rheight)
-{
- register const QRect *pbox;
- register const QRect *pboxEnd;
- QRect rect(rx, ry, rwidth, rheight);
- register QRect *prect = &rect;
- int partIn, partOut;
-
- if (!region || region->numRects == 0 || !EXTENTCHECK(&region->extents, prect))
- return RectangleOut;
-
- partOut = false;
- partIn = false;
-
- /* can stop when both partOut and partIn are true, or we reach prect->y2 */
- for (pbox = (region->mode==QRegionPrivate::Vector)?region->rects.constData():&region->single, pboxEnd = pbox + region->numRects;
- pbox < pboxEnd; ++pbox) {
- if (pbox->bottom() < ry)
- continue;
-
- if (pbox->top() > ry) {
- partOut = true;
- if (partIn || pbox->top() > prect->bottom())
- break;
- ry = pbox->top();
- }
-
- if (pbox->right() < rx)
- continue; /* not far enough over yet */
-
- if (pbox->left() > rx) {
- partOut = true; /* missed part of rectangle to left */
- if (partIn)
- break;
- }
-
- if (pbox->left() <= prect->right()) {
- partIn = true; /* definitely overlap */
- if (partOut)
- break;
- }
-
- if (pbox->right() >= prect->right()) {
- ry = pbox->bottom() + 1; /* finished with this band */
- if (ry > prect->bottom())
- break;
- rx = prect->left(); /* reset x out to left again */
- } else {
- /*
- * Because boxes in a band are maximal width, if the first box
- * to overlap the rectangle doesn't completely cover it in that
- * band, the rectangle must be partially out, since some of it
- * will be uncovered in that band. partIn will have been set true
- * by now...
- */
- break;
- }
- }
- return partIn ? ((ry <= prect->bottom()) ? RectanglePart : RectangleIn) : RectangleOut;
-}
-// END OF Region.c extract
-// START OF poly.h extract
-/* $XConsortium: poly.h,v 1.4 94/04/17 20:22:19 rws Exp $ */
-/************************************************************************
-
-Copyright (c) 1987 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from the X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-
-/*
- * This file contains a few macros to help track
- * the edge of a filled object. The object is assumed
- * to be filled in scanline order, and thus the
- * algorithm used is an extension of Bresenham's line
- * drawing algorithm which assumes that y is always the
- * major axis.
- * Since these pieces of code are the same for any filled shape,
- * it is more convenient to gather the library in one
- * place, but since these pieces of code are also in
- * the inner loops of output primitives, procedure call
- * overhead is out of the question.
- * See the author for a derivation if needed.
- */
-
-
-/*
- * In scan converting polygons, we want to choose those pixels
- * which are inside the polygon. Thus, we add .5 to the starting
- * x coordinate for both left and right edges. Now we choose the
- * first pixel which is inside the pgon for the left edge and the
- * first pixel which is outside the pgon for the right edge.
- * Draw the left pixel, but not the right.
- *
- * How to add .5 to the starting x coordinate:
- * If the edge is moving to the right, then subtract dy from the
- * error term from the general form of the algorithm.
- * If the edge is moving to the left, then add dy to the error term.
- *
- * The reason for the difference between edges moving to the left
- * and edges moving to the right is simple: If an edge is moving
- * to the right, then we want the algorithm to flip immediately.
- * If it is moving to the left, then we don't want it to flip until
- * we traverse an entire pixel.
- */
-#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
- int dx; /* local storage */ \
-\
- /* \
- * if the edge is horizontal, then it is ignored \
- * and assumed not to be processed. Otherwise, do this stuff. \
- */ \
- if ((dy) != 0) { \
- xStart = (x1); \
- dx = (x2) - xStart; \
- if (dx < 0) { \
- m = dx / (dy); \
- m1 = m - 1; \
- incr1 = -2 * dx + 2 * (dy) * m1; \
- incr2 = -2 * dx + 2 * (dy) * m; \
- d = 2 * m * (dy) - 2 * dx - 2 * (dy); \
- } else { \
- m = dx / (dy); \
- m1 = m + 1; \
- incr1 = 2 * dx - 2 * (dy) * m1; \
- incr2 = 2 * dx - 2 * (dy) * m; \
- d = -2 * m * (dy) + 2 * dx; \
- } \
- } \
-}
-
-#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
- if (m1 > 0) { \
- if (d > 0) { \
- minval += m1; \
- d += incr1; \
- } \
- else { \
- minval += m; \
- d += incr2; \
- } \
- } else {\
- if (d >= 0) { \
- minval += m1; \
- d += incr1; \
- } \
- else { \
- minval += m; \
- d += incr2; \
- } \
- } \
-}
-
-
-/*
- * This structure contains all of the information needed
- * to run the bresenham algorithm.
- * The variables may be hardcoded into the declarations
- * instead of using this structure to make use of
- * register declarations.
- */
-typedef struct {
- int minor_axis; /* minor axis */
- int d; /* decision variable */
- int m, m1; /* slope and slope+1 */
- int incr1, incr2; /* error increments */
-} BRESINFO;
-
-
-#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
- BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \
- bres.m, bres.m1, bres.incr1, bres.incr2)
-
-#define BRESINCRPGONSTRUCT(bres) \
- BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2)
-
-
-
-/*
- * These are the data structures needed to scan
- * convert regions. Two different scan conversion
- * methods are available -- the even-odd method, and
- * the winding number method.
- * The even-odd rule states that a point is inside
- * the polygon if a ray drawn from that point in any
- * direction will pass through an odd number of
- * path segments.
- * By the winding number rule, a point is decided
- * to be inside the polygon if a ray drawn from that
- * point in any direction passes through a different
- * number of clockwise and counter-clockwise path
- * segments.
- *
- * These data structures are adapted somewhat from
- * the algorithm in (Foley/Van Dam) for scan converting
- * polygons.
- * The basic algorithm is to start at the top (smallest y)
- * of the polygon, stepping down to the bottom of
- * the polygon by incrementing the y coordinate. We
- * keep a list of edges which the current scanline crosses,
- * sorted by x. This list is called the Active Edge Table (AET)
- * As we change the y-coordinate, we update each entry in
- * in the active edge table to reflect the edges new xcoord.
- * This list must be sorted at each scanline in case
- * two edges intersect.
- * We also keep a data structure known as the Edge Table (ET),
- * which keeps track of all the edges which the current
- * scanline has not yet reached. The ET is basically a
- * list of ScanLineList structures containing a list of
- * edges which are entered at a given scanline. There is one
- * ScanLineList per scanline at which an edge is entered.
- * When we enter a new edge, we move it from the ET to the AET.
- *
- * From the AET, we can implement the even-odd rule as in
- * (Foley/Van Dam).
- * The winding number rule is a little trickier. We also
- * keep the EdgeTableEntries in the AET linked by the
- * nextWETE (winding EdgeTableEntry) link. This allows
- * the edges to be linked just as before for updating
- * purposes, but only uses the edges linked by the nextWETE
- * link as edges representing spans of the polygon to
- * drawn (as with the even-odd rule).
- */
-
-/*
- * for the winding number rule
- */
-#define CLOCKWISE 1
-#define COUNTERCLOCKWISE -1
-
-typedef struct _EdgeTableEntry {
- int ymax; /* ycoord at which we exit this edge. */
- BRESINFO bres; /* Bresenham info to run the edge */
- struct _EdgeTableEntry *next; /* next in the list */
- struct _EdgeTableEntry *back; /* for insertion sort */
- struct _EdgeTableEntry *nextWETE; /* for winding num rule */
- int ClockWise; /* flag for winding number rule */
-} EdgeTableEntry;
-
-
-typedef struct _ScanLineList{
- int scanline; /* the scanline represented */
- EdgeTableEntry *edgelist; /* header node */
- struct _ScanLineList *next; /* next in the list */
-} ScanLineList;
-
-
-typedef struct {
- int ymax; /* ymax for the polygon */
- int ymin; /* ymin for the polygon */
- ScanLineList scanlines; /* header node */
-} EdgeTable;
-
-
-/*
- * Here is a struct to help with storage allocation
- * so we can allocate a big chunk at a time, and then take
- * pieces from this heap when we need to.
- */
-#define SLLSPERBLOCK 25
-
-typedef struct _ScanLineListBlock {
- ScanLineList SLLs[SLLSPERBLOCK];
- struct _ScanLineListBlock *next;
-} ScanLineListBlock;
-
-
-
-/*
- *
- * a few macros for the inner loops of the fill code where
- * performance considerations don't allow a procedure call.
- *
- * Evaluate the given edge at the given scanline.
- * If the edge has expired, then we leave it and fix up
- * the active edge table; otherwise, we increment the
- * x value to be ready for the next scanline.
- * The winding number rule is in effect, so we must notify
- * the caller when the edge has been removed so he
- * can reorder the Winding Active Edge Table.
- */
-#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \
- if (pAET->ymax == y) { /* leaving this edge */ \
- pPrevAET->next = pAET->next; \
- pAET = pPrevAET->next; \
- fixWAET = 1; \
- if (pAET) \
- pAET->back = pPrevAET; \
- } \
- else { \
- BRESINCRPGONSTRUCT(pAET->bres) \
- pPrevAET = pAET; \
- pAET = pAET->next; \
- } \
-}
-
-
-/*
- * Evaluate the given edge at the given scanline.
- * If the edge has expired, then we leave it and fix up
- * the active edge table; otherwise, we increment the
- * x value to be ready for the next scanline.
- * The even-odd rule is in effect.
- */
-#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
- if (pAET->ymax == y) { /* leaving this edge */ \
- pPrevAET->next = pAET->next; \
- pAET = pPrevAET->next; \
- if (pAET) \
- pAET->back = pPrevAET; \
- } \
- else { \
- BRESINCRPGONSTRUCT(pAET->bres) \
- pPrevAET = pAET; \
- pAET = pAET->next; \
- } \
-}
-// END OF poly.h extract
-// START OF PolyReg.c extract
-/* $XConsortium: PolyReg.c,v 11.23 94/11/17 21:59:37 converse Exp $ */
-/************************************************************************
-
-Copyright (c) 1987 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from the X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-/* $XFree86: xc/lib/X11/PolyReg.c,v 1.1.1.2.8.2 1998/10/04 15:22:49 hohndel Exp $ */
-
-#define LARGE_COORDINATE 1000000
-#define SMALL_COORDINATE -LARGE_COORDINATE
-
-/*
- * InsertEdgeInET
- *
- * Insert the given edge into the edge table.
- * First we must find the correct bucket in the
- * Edge table, then find the right slot in the
- * bucket. Finally, we can insert it.
- *
- */
-static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
- ScanLineListBlock **SLLBlock, int *iSLLBlock)
-{
- register EdgeTableEntry *start, *prev;
- register ScanLineList *pSLL, *pPrevSLL;
- ScanLineListBlock *tmpSLLBlock;
-
- /*
- * find the right bucket to put the edge into
- */
- pPrevSLL = &ET->scanlines;
- pSLL = pPrevSLL->next;
- while (pSLL && (pSLL->scanline < scanline)) {
- pPrevSLL = pSLL;
- pSLL = pSLL->next;
- }
-
- /*
- * reassign pSLL (pointer to ScanLineList) if necessary
- */
- if ((!pSLL) || (pSLL->scanline > scanline)) {
- if (*iSLLBlock > SLLSPERBLOCK-1)
- {
- tmpSLLBlock =
- (ScanLineListBlock *)malloc(sizeof(ScanLineListBlock));
- (*SLLBlock)->next = tmpSLLBlock;
- tmpSLLBlock->next = (ScanLineListBlock *)NULL;
- *SLLBlock = tmpSLLBlock;
- *iSLLBlock = 0;
- }
- pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
-
- pSLL->next = pPrevSLL->next;
- pSLL->edgelist = (EdgeTableEntry *)NULL;
- pPrevSLL->next = pSLL;
- }
- pSLL->scanline = scanline;
-
- /*
- * now insert the edge in the right bucket
- */
- prev = 0;
- start = pSLL->edgelist;
- while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) {
- prev = start;
- start = start->next;
- }
- ETE->next = start;
-
- if (prev)
- prev->next = ETE;
- else
- pSLL->edgelist = ETE;
-}
-
-/*
- * CreateEdgeTable
- *
- * This routine creates the edge table for
- * scan converting polygons.
- * The Edge Table (ET) looks like:
- *
- * EdgeTable
- * --------
- * | ymax | ScanLineLists
- * |scanline|-->------------>-------------->...
- * -------- |scanline| |scanline|
- * |edgelist| |edgelist|
- * --------- ---------
- * | |
- * | |
- * V V
- * list of ETEs list of ETEs
- *
- * where ETE is an EdgeTableEntry data structure,
- * and there is one ScanLineList per scanline at
- * which an edge is initially entered.
- *
- */
-
-static void CreateETandAET(register int count, register const QPoint *pts,
- EdgeTable *ET, EdgeTableEntry *AET, register EdgeTableEntry *pETEs,
- ScanLineListBlock *pSLLBlock)
-{
- register const QPoint *top,
- *bottom,
- *PrevPt,
- *CurrPt;
- int iSLLBlock = 0;
- int dy;
-
- if (count < 2)
- return;
-
- /*
- * initialize the Active Edge Table
- */
- AET->next = 0;
- AET->back = 0;
- AET->nextWETE = 0;
- AET->bres.minor_axis = SMALL_COORDINATE;
-
- /*
- * initialize the Edge Table.
- */
- ET->scanlines.next = 0;
- ET->ymax = SMALL_COORDINATE;
- ET->ymin = LARGE_COORDINATE;
- pSLLBlock->next = 0;
-
- PrevPt = &pts[count - 1];
-
- /*
- * for each vertex in the array of points.
- * In this loop we are dealing with two vertices at
- * a time -- these make up one edge of the polygon.
- */
- while (count--) {
- CurrPt = pts++;
-
- /*
- * find out which point is above and which is below.
- */
- if (PrevPt->y() > CurrPt->y()) {
- bottom = PrevPt;
- top = CurrPt;
- pETEs->ClockWise = 0;
- } else {
- bottom = CurrPt;
- top = PrevPt;
- pETEs->ClockWise = 1;
- }
-
- /*
- * don't add horizontal edges to the Edge table.
- */
- if (bottom->y() != top->y()) {
- pETEs->ymax = bottom->y() - 1; /* -1 so we don't get last scanline */
-
- /*
- * initialize integer edge algorithm
- */
- dy = bottom->y() - top->y();
- BRESINITPGONSTRUCT(dy, top->x(), bottom->x(), pETEs->bres)
-
- InsertEdgeInET(ET, pETEs, top->y(), &pSLLBlock, &iSLLBlock);
-
- if (PrevPt->y() > ET->ymax)
- ET->ymax = PrevPt->y();
- if (PrevPt->y() < ET->ymin)
- ET->ymin = PrevPt->y();
- ++pETEs;
- }
-
- PrevPt = CurrPt;
- }
-}
-
-/*
- * loadAET
- *
- * This routine moves EdgeTableEntries from the
- * EdgeTable into the Active Edge Table,
- * leaving them sorted by smaller x coordinate.
- *
- */
-
-static void loadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs)
-{
- register EdgeTableEntry *pPrevAET;
- register EdgeTableEntry *tmp;
-
- pPrevAET = AET;
- AET = AET->next;
- while (ETEs) {
- while (AET && AET->bres.minor_axis < ETEs->bres.minor_axis) {
- pPrevAET = AET;
- AET = AET->next;
- }
- tmp = ETEs->next;
- ETEs->next = AET;
- if (AET)
- AET->back = ETEs;
- ETEs->back = pPrevAET;
- pPrevAET->next = ETEs;
- pPrevAET = ETEs;
-
- ETEs = tmp;
- }
-}
-
-/*
- * computeWAET
- *
- * This routine links the AET by the
- * nextWETE (winding EdgeTableEntry) link for
- * use by the winding number rule. The final
- * Active Edge Table (AET) might look something
- * like:
- *
- * AET
- * ---------- --------- ---------
- * |ymax | |ymax | |ymax |
- * | ... | |... | |... |
- * |next |->|next |->|next |->...
- * |nextWETE| |nextWETE| |nextWETE|
- * --------- --------- ^--------
- * | | |
- * V-------------------> V---> ...
- *
- */
-static void computeWAET(register EdgeTableEntry *AET)
-{
- register EdgeTableEntry *pWETE;
- register int inside = 1;
- register int isInside = 0;
-
- AET->nextWETE = 0;
- pWETE = AET;
- AET = AET->next;
- while (AET) {
- if (AET->ClockWise)
- ++isInside;
- else
- --isInside;
-
- if (!inside && !isInside || inside && isInside) {
- pWETE->nextWETE = AET;
- pWETE = AET;
- inside = !inside;
- }
- AET = AET->next;
- }
- pWETE->nextWETE = 0;
-}
-
-/*
- * InsertionSort
- *
- * Just a simple insertion sort using
- * pointers and back pointers to sort the Active
- * Edge Table.
- *
- */
-
-static int InsertionSort(register EdgeTableEntry *AET)
-{
- register EdgeTableEntry *pETEchase;
- register EdgeTableEntry *pETEinsert;
- register EdgeTableEntry *pETEchaseBackTMP;
- register int changed = 0;
-
- AET = AET->next;
- while (AET) {
- pETEinsert = AET;
- pETEchase = AET;
- while (pETEchase->back->bres.minor_axis > AET->bres.minor_axis)
- pETEchase = pETEchase->back;
-
- AET = AET->next;
- if (pETEchase != pETEinsert) {
- pETEchaseBackTMP = pETEchase->back;
- pETEinsert->back->next = AET;
- if (AET)
- AET->back = pETEinsert->back;
- pETEinsert->next = pETEchase;
- pETEchase->back->next = pETEinsert;
- pETEchase->back = pETEinsert;
- pETEinsert->back = pETEchaseBackTMP;
- changed = 1;
- }
- }
- return changed;
-}
-
-/*
- * Clean up our act.
- */
-static void FreeStorage(register ScanLineListBlock *pSLLBlock)
-{
- register ScanLineListBlock *tmpSLLBlock;
-
- while (pSLLBlock) {
- tmpSLLBlock = pSLLBlock->next;
- free(pSLLBlock);
- pSLLBlock = tmpSLLBlock;
- }
-}
-
-/*
- * Create an array of rectangles from a list of points.
- * If indeed these things (POINTS, RECTS) are the same,
- * then this proc is still needed, because it allocates
- * storage for the array, which was allocated on the
- * stack by the calling procedure.
- *
- */
-static void PtsToRegion(register int numFullPtBlocks, register int iCurPtBlock,
- POINTBLOCK *FirstPtBlock, QRegionPrivate *reg)
-{
- register QRect *rects;
- register QPoint *pts;
- register POINTBLOCK *CurPtBlock;
- register int i;
- register QRect *extents;
- register int numRects;
-
- extents = &reg->extents;
- numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1;
-
- reg->rects.resize(numRects);
-
- CurPtBlock = FirstPtBlock;
- rects = reg->rects.data() - 1;
- numRects = 0;
- extents->setLeft(INT_MAX);
- extents->setRight(INT_MIN);
- reg->innerArea = -1;
-
- for (; numFullPtBlocks >= 0; --numFullPtBlocks) {
- /* the loop uses 2 points per iteration */
- i = NUMPTSTOBUFFER >> 1;
- if (!numFullPtBlocks)
- i = iCurPtBlock >> 1;
- if(i) {
- for (pts = CurPtBlock->pts; i--; pts += 2) {
- if (pts->x() == pts[1].x())
- continue;
- if (numRects && pts->x() == rects->left() && pts->y() == rects->bottom() + 1
- && pts[1].x() == rects->right()+1 && (numRects == 1 || rects[-1].top() != rects->top())
- && (i && pts[2].y() > pts[1].y())) {
- rects->setBottom(pts[1].y());
- reg->updateInnerRect(*rects);
- continue;
- }
- ++numRects;
- ++rects;
- rects->setCoords(pts->x(), pts->y(), pts[1].x() - 1, pts[1].y());
- if (rects->left() < extents->left())
- extents->setLeft(rects->left());
- if (rects->right() > extents->right())
- extents->setRight(rects->right());
- reg->updateInnerRect(*rects);
- }
- }
- CurPtBlock = CurPtBlock->next;
- }
-
- if (numRects) {
- extents->setTop(reg->rects[0].top());
- extents->setBottom(rects->bottom());
- } else {
- extents->setCoords(0, 0, 0, 0);
- }
- reg->numRects = numRects;
-}
-
-/*
- * polytoregion
- *
- * Scan converts a polygon by returning a run-length
- * encoding of the resultant bitmap -- the run-length
- * encoding is in the form of an array of rectangles.
- */
-static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule,
- QRegionPrivate *region)
- //Point *Pts; /* the pts */
- //int Count; /* number of pts */
- //int rule; /* winding rule */
-{
- register EdgeTableEntry *pAET; /* Active Edge Table */
- register int y; /* current scanline */
- register int iPts = 0; /* number of pts in buffer */
- register EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/
- register ScanLineList *pSLL; /* current scanLineList */
- register QPoint *pts; /* output buffer */
- EdgeTableEntry *pPrevAET; /* ptr to previous AET */
- EdgeTable ET; /* header node for ET */
- EdgeTableEntry AET; /* header node for AET */
- EdgeTableEntry *pETEs; /* EdgeTableEntries pool */
- ScanLineListBlock SLLBlock; /* header for scanlinelist */
- int fixWAET = false;
- POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */
- POINTBLOCK *tmpPtBlock;
- int numFullPtBlocks = 0;
-
- region->vector();
-
- /* special case a rectangle */
- if (((Count == 4) ||
- ((Count == 5) && (Pts[4].x() == Pts[0].x()) && (Pts[4].y() == Pts[0].y())))
- && (((Pts[0].y() == Pts[1].y()) && (Pts[1].x() == Pts[2].x()) && (Pts[2].y() == Pts[3].y())
- && (Pts[3].x() == Pts[0].x())) || ((Pts[0].x() == Pts[1].x())
- && (Pts[1].y() == Pts[2].y()) && (Pts[2].x() == Pts[3].x())
- && (Pts[3].y() == Pts[0].y())))) {
- int x = qMin(Pts[0].x(), Pts[2].x());
- region->extents.setLeft(x);
- int y = qMin(Pts[0].y(), Pts[2].y());
- region->extents.setTop(y);
- region->extents.setWidth(qMax(Pts[0].x(), Pts[2].x()) - x);
- region->extents.setHeight(qMax(Pts[0].y(), Pts[2].y()) - y);
- if ((region->extents.left() <= region->extents.right()) &&
- (region->extents.top() <= region->extents.bottom())) {
- region->numRects = 1;
- region->rects.resize(1);
- region->rects[0] = region->extents;
- region->innerRect = region->extents;
- region->innerArea = region->innerRect.width() * region->innerRect.height();
- }
- return region;
- }
-
- if (!(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count))))
- return 0;
-
- pts = FirstPtBlock.pts;
- CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock);
- pSLL = ET.scanlines.next;
- curPtBlock = &FirstPtBlock;
-
- if (rule == EvenOddRule) {
- /*
- * for each scanline
- */
- for (y = ET.ymin; y < ET.ymax; ++y) {
- /*
- * Add a new edge to the active edge table when we
- * get to the next edge.
- */
- if (pSLL && y == pSLL->scanline) {
- loadAET(&AET, pSLL->edgelist);
- pSLL = pSLL->next;
- }
- pPrevAET = &AET;
- pAET = AET.next;
-
- /*
- * for each active edge
- */
- while (pAET) {
- pts->setX(pAET->bres.minor_axis);
- pts->setY(y);
- ++pts;
- ++iPts;
-
- /*
- * send out the buffer
- */
- if (iPts == NUMPTSTOBUFFER) {
- tmpPtBlock = (POINTBLOCK *)malloc(sizeof(POINTBLOCK));
- curPtBlock->next = tmpPtBlock;
- curPtBlock = tmpPtBlock;
- pts = curPtBlock->pts;
- ++numFullPtBlocks;
- iPts = 0;
- }
- EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
- }
- InsertionSort(&AET);
- }
- } else {
- /*
- * for each scanline
- */
- for (y = ET.ymin; y < ET.ymax; ++y) {
- /*
- * Add a new edge to the active edge table when we
- * get to the next edge.
- */
- if (pSLL && y == pSLL->scanline) {
- loadAET(&AET, pSLL->edgelist);
- computeWAET(&AET);
- pSLL = pSLL->next;
- }
- pPrevAET = &AET;
- pAET = AET.next;
- pWETE = pAET;
-
- /*
- * for each active edge
- */
- while (pAET) {
- /*
- * add to the buffer only those edges that
- * are in the Winding active edge table.
- */
- if (pWETE == pAET) {
- pts->setX(pAET->bres.minor_axis);
- pts->setY(y);
- ++pts;
- ++iPts;
-
- /*
- * send out the buffer
- */
- if (iPts == NUMPTSTOBUFFER) {
- tmpPtBlock = static_cast<POINTBLOCK *>(malloc(sizeof(POINTBLOCK)));
- curPtBlock->next = tmpPtBlock;
- curPtBlock = tmpPtBlock;
- pts = curPtBlock->pts;
- ++numFullPtBlocks;
- iPts = 0;
- }
- pWETE = pWETE->nextWETE;
- }
- EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET)
- }
-
- /*
- * recompute the winding active edge table if
- * we just resorted or have exited an edge.
- */
- if (InsertionSort(&AET) || fixWAET) {
- computeWAET(&AET);
- fixWAET = false;
- }
- }
- }
- FreeStorage(SLLBlock.next);
- PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region);
- for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) {
- tmpPtBlock = curPtBlock->next;
- free(curPtBlock);
- curPtBlock = tmpPtBlock;
- }
- free(pETEs);
- return region;
-}
-// END OF PolyReg.c extract
-
-QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap, QRegionPrivate *region)
-{
- region->vector();
-
- QImage image = bitmap.toImage();
-
- QRect xr;
-
-#define AddSpan \
- { \
- xr.setCoords(prev1, y, x-1, y); \
- UnionRectWithRegion(&xr, region, *region); \
- }
-
- const uchar zero = 0;
- bool little = image.format() == QImage::Format_MonoLSB;
-
- int x,
- y;
- for (y = 0; y < image.height(); ++y) {
- uchar *line = image.scanLine(y);
- int w = image.width();
- uchar all = zero;
- int prev1 = -1;
- for (x = 0; x < w;) {
- uchar byte = line[x / 8];
- if (x > w - 8 || byte!=all) {
- if (little) {
- for (int b = 8; b > 0 && x < w; --b) {
- if (!(byte & 0x01) == !all) {
- // More of the same
- } else {
- // A change.
- if (all!=zero) {
- AddSpan
- all = zero;
- } else {
- prev1 = x;
- all = ~zero;
- }
- }
- byte >>= 1;
- ++x;
- }
- } else {
- for (int b = 8; b > 0 && x < w; --b) {
- if (!(byte & 0x80) == !all) {
- // More of the same
- } else {
- // A change.
- if (all != zero) {
- AddSpan
- all = zero;
- } else {
- prev1 = x;
- all = ~zero;
- }
- }
- byte <<= 1;
- ++x;
- }
- }
- } else {
- x += 8;
- }
- }
- if (all != zero) {
- AddSpan
- }
- }
-#undef AddSpan
-
- return region;
-}
-
-/*
- Constructs an empty region.
-
- \sa isEmpty()
-*/
-
-QRegion::QRegion()
- : d(&shared_empty)
-{
- d->ref.ref();
-}
-
-/*
- \overload
-
- Create a region based on the rectange \a r with region type \a t.
-
- If the rectangle is invalid a null region will be created.
-
- \sa QRegion::RegionType
-*/
-
-QRegion::QRegion(const QRect &r, RegionType t)
-{
- if (r.isEmpty()) {
- d = &shared_empty;
- d->ref.ref();
- } else {
-// d = new QRegionData;
- QRegionPrivate *rp = 0;
- if (t == Rectangle) {
-// rp = new QRegionPrivate(r);
- rp = qt_allocRegion(r);
- } else if (t == Ellipse) {
- QPainterPath path;
- path.addEllipse(r.x(), r.y(), r.width(), r.height());
- QPolygon a = path.toSubpathPolygons().at(0).toPolygon();
- rp = qt_allocRegion();
-// rp = new QRegionPrivate;
- PolygonRegion(a.constData(), a.size(), EvenOddRule, rp);
- }
- d = rp;
- d->ref = 1;
-#if defined(Q_WS_X11)
- d->rgn = 0;
- d->xrectangles = 0;
-#elif defined(Q_WS_MAC)
- d->rgn = 0;
-#endif
- d->qt_rgn = rp;
- }
-}
-
-/*
- Constructs a polygon region from the point array \a a with the fill rule
- specified by \a fillRule.
-
- If \a fillRule is \l{Qt::WindingFill}, the polygon region is defined
- using the winding algorithm; if it is \l{Qt::OddEvenFill}, the odd-even fill
- algorithm is used.
-
- \warning This constructor can be used to create complex regions that will
- slow down painting when used.
-*/
-
-QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule)
-{
- if (a.count() > 2) {
- //d = new QRegionData;
- // QRegionPrivate *rp = new QRegionPrivate;
- QRegionPrivate *rp = qt_allocRegion();
- PolygonRegion(a.constData(), a.size(),
- fillRule == Qt::WindingFill ? WindingRule : EvenOddRule, rp);
- d = rp;
- d->ref = 1;
-#if defined(Q_WS_X11)
- d->rgn = 0;
- d->xrectangles = 0;
-#elif defined(Q_WS_MAC)
- d->rgn = 0;
-#endif
- d->qt_rgn = rp;
- } else {
- d = &shared_empty;
- d->ref.ref();
- }
-}
-
-
-/*
- Constructs a new region which is equal to region \a r.
-*/
-
-QRegion::QRegion(const QRegion &r)
-{
- d = r.d;
- d->ref.ref();
-}
-
-
-/*
- Constructs a region from the bitmap \a bm.
-
- The resulting region consists of the pixels in bitmap \a bm that
- are Qt::color1, as if each pixel was a 1 by 1 rectangle.
-
- This constructor may create complex regions that will slow down
- painting when used. Note that drawing masked pixmaps can be done
- much faster using QPixmap::setMask().
-*/
-QRegion::QRegion(const QBitmap &bm)
-{
- if (bm.isNull()) {
- d = &shared_empty;
- d->ref.ref();
- } else {
- // d = new QRegionData;
-// QRegionPrivate *rp = new QRegionPrivate;
- QRegionPrivate *rp = qt_allocRegion();
-
- qt_bitmapToRegion(bm, rp);
- d = rp;
- d->ref = 1;
-#if defined(Q_WS_X11)
- d->rgn = 0;
- d->xrectangles = 0;
-#elif defined(Q_WS_MAC)
- d->rgn = 0;
-#endif
- d->qt_rgn = rp;
- }
-}
-
-void QRegion::cleanUp(QRegion::QRegionData *x)
-{
- // delete x->qt_rgn;
-#if defined(Q_WS_X11)
- if (x->rgn)
- XDestroyRegion(x->rgn);
- if (x->xrectangles)
- free(x->xrectangles);
-#elif defined(Q_WS_MAC)
- if (x->rgn)
- qt_mac_dispose_rgn(x->rgn);
-#endif
- if(x->qt_rgn) {
-// delete x->qt_rgn;
- qt_freeRegion(x->qt_rgn);
- } else {
- delete x;
- }
-}
-
-/*
- Destroys the region.
-*/
-
-QRegion::~QRegion()
-{
- if (!d->ref.deref())
- cleanUp(d);
-}
-
-
-/*
- Assigns \a r to this region and returns a reference to the region.
-*/
-
-QRegion &QRegion::operator=(const QRegion &r)
-{
- r.d->ref.ref();
- if (!d->ref.deref())
- cleanUp(d);
- d = r.d;
- return *this;
-}
-
-
-/*
- \internal
-*/
-
-QRegion QRegion::copy() const
-{
- QRegion r;
- QRegionData *x = 0; // new QRegionData;
- QRegionPrivate *rp = 0;
- if (d->qt_rgn)
-// rp = new QRegionPrivate(*d->qt_rgn);
- rp = qt_allocRegion(*d->qt_rgn);
- else
- rp = qt_allocRegion();
- x = rp;
- x->qt_rgn = rp;
- x->ref = 1;
-#if defined(Q_WS_X11)
- x->rgn = 0;
- x->xrectangles = 0;
-#elif defined(Q_WS_MAC)
- x->rgn = 0;
-#endif
-
- if (!r.d->ref.deref())
- cleanUp(r.d);
- r.d = x;
- return r;
-}
-
-/*
- Returns true if the region is empty; otherwise returns false. An
- empty region is a region that contains no points.
-
- Example:
- \snippet doc/src/snippets/code/src.gui.painting.qregion_qws.cpp 0
-*/
-
-bool QRegion::isEmpty() const
-{
- return d == &shared_empty || d->qt_rgn->numRects == 0;
-}
-
-
-/*
- Returns true if the region contains the point \a p; otherwise
- returns false.
-*/
-
-bool QRegion::contains(const QPoint &p) const
-{
- return PointInRegion(d->qt_rgn, p.x(), p.y());
-}
-
-/*
- \overload
-
- Returns true if the region overlaps the rectangle \a r; otherwise
- returns false.
-*/
-
-bool QRegion::contains(const QRect &r) const
-{
- if(!d->qt_rgn)
- return false;
- if(d->qt_rgn->mode == QRegionPrivate::Single)
- return d->qt_rgn->single.contains(r);
-
- return RectInRegion(d->qt_rgn, r.left(), r.top(), r.width(), r.height()) != RectangleOut;
-}
-
-
-
-/*
- Translates (moves) the region \a dx along the X axis and \a dy
- along the Y axis.
-*/
-
-void QRegion::translate(int dx, int dy)
-{
- if ((dx == 0 && dy == 0) || isEmptyHelper(d->qt_rgn))
- return;
-
- detach();
- OffsetRegion(*d->qt_rgn, dx, dy);
-#if defined(Q_WS_X11)
- if (d->xrectangles) {
- free(d->xrectangles);
- d->xrectangles = 0;
- }
-#elif defined(Q_WS_MAC)
- if(d->rgn) {
- qt_mac_dispose_rgn(d->rgn);
- d->rgn = 0;
- }
-#endif
-}
-
-/*
- \fn QRegion QRegion::unite(const QRegion &r) const
- \obsolete
-
- Use united(\a r) instead.
-*/
-
-/*
- \fn QRegion QRegion::united(const QRegion &r) const
- \since 4.2
-
- Returns a region which is the union of this region and \a r.
-
- \img runion.png Region Union
-
- The figure shows the union of two elliptical regions.
-
- \sa intersected(), subtracted(), xored()
-*/
-
-QRegion QRegion::unite(const QRegion &r) const
-{
- if (isEmptyHelper(d->qt_rgn))
- return r;
- if (isEmptyHelper(r.d->qt_rgn))
- return *this;
-
- if (d->qt_rgn->contains(*r.d->qt_rgn)) {
- return *this;
- } else if (r.d->qt_rgn->contains(*d->qt_rgn)) {
- return r;
- } else if (d->qt_rgn->canAppend(r.d->qt_rgn)) {
- QRegion result(*this);
- result.detach();
- result.d->qt_rgn->append(r.d->qt_rgn);
- return result;
- } else if (r.d->qt_rgn->canAppend(d->qt_rgn)) {
- QRegion result(r);
- result.detach();
- result.d->qt_rgn->append(d->qt_rgn);
- return result;
- } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) {
- return *this;
- } else {
- QRegion result;
- result.detach();
- UnionRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn);
- return result;
- }
-}
-
-QRegion& QRegion::operator+=(const QRegion &r)
-{
- if (isEmptyHelper(d->qt_rgn))
- return *this = r;
- if (isEmptyHelper(r.d->qt_rgn))
- return *this;
-
- if (d->qt_rgn->contains(*r.d->qt_rgn)) {
- return *this;
- } else if (r.d->qt_rgn->contains(*d->qt_rgn)) {
- return *this = r;
- } else if (d->qt_rgn->canAppend(r.d->qt_rgn)) {
- detach();
- d->qt_rgn->append(r.d->qt_rgn);
- return *this;
- } else if (d->qt_rgn->canPrepend(r.d->qt_rgn)) {
- detach();
- d->qt_rgn->prepend(r.d->qt_rgn);
- return *this;
- } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) {
- return *this;
- }
-
- return *this = unite(r);
-}
-
-/*
- \fn QRegion QRegion::intersect(const QRegion &r) const
- \obsolete
-
- Use intersected(\a r) instead.
-*/
-
-/*
- \fn QRegion QRegion::intersected(const QRegion &r) const
- \since 4.2
-
- Returns a region which is the intersection of this region and \a r.
-
- \img rintersect.png Region Intersection
-
- The figure shows the intersection of two elliptical regions.
-*/
-
-QRegion QRegion::intersect(const QRegion &r) const
-{
- if (isEmptyHelper(d->qt_rgn) || isEmptyHelper(r.d->qt_rgn)
- || !EXTENTCHECK(&d->qt_rgn->extents, &r.d->qt_rgn->extents))
- return QRegion();
-
- /* this is fully contained in r */
- if (r.d->qt_rgn->contains(*d->qt_rgn))
- return *this;
-
- /* r is fully contained in this */
- if (d->qt_rgn->contains(*r.d->qt_rgn))
- return r;
-
- if(r.d->qt_rgn->mode == QRegionPrivate::Single &&
- d->qt_rgn->mode == QRegionPrivate::Single)
- return QRegion(r.d->qt_rgn->single.intersected(d->qt_rgn->single));
-#ifdef QT_GREENPHONE_OPT
- else if(r.d->qt_rgn->mode == QRegionPrivate::Single)
- return intersect(r.d->qt_rgn->single);
- else if(d->qt_rgn->mode == QRegionPrivate::Single)
- return r.intersect(d->qt_rgn->single);
-#endif
-
- QRegion result;
- result.detach();
- miRegionOp(*result.d->qt_rgn, d->qt_rgn, r.d->qt_rgn, miIntersectO, 0, 0);
-
- /*
- * Can't alter dest's extents before we call miRegionOp because
- * it might be one of the source regions and miRegionOp depends
- * on the extents of those regions being the same. Besides, this
- * way there's no checking against rectangles that will be nuked
- * due to coalescing, so we have to examine fewer rectangles.
- */
- miSetExtents(*result.d->qt_rgn);
- return result;
-}
-
-#ifdef QT_GREENPHONE_OPT
-/*
- \overload
- */
-QRegion QRegion::intersect(const QRect &r) const
-{
- // No intersection
- if(r.isEmpty() || isEmpty() || !EXTENTCHECK(&r, &d->qt_rgn->extents))
- return QRegion();
-
- // This is fully contained in r
- if(CONTAINSCHECK(r, d->qt_rgn->extents))
- return *this;
-
- // r is fully contained in this
- if(CONTAINSCHECK(d->qt_rgn->innerRect, r))
- return QRegion(r);
-
- if(d->qt_rgn->mode == QRegionPrivate::Single) {
- return QRegion(d->qt_rgn->single & r);
- } else {
- QRegion rv(*this);
- rv.detach();
-
- rv.d->qt_rgn->extents &= r;
- rv.d->qt_rgn->innerRect &= r;
- rv.d->qt_rgn->innerArea = rv.d->qt_rgn->innerRect.height() *
- rv.d->qt_rgn->innerRect.width();
-
- int numRects = 0;
- for(int ii = 0; ii < rv.d->qt_rgn->numRects; ++ii) {
- QRect result = rv.d->qt_rgn->rects[ii] & r;
- if(!result.isEmpty())
- rv.d->qt_rgn->rects[numRects++] = result;
- }
- rv.d->qt_rgn->numRects = numRects;
- return rv;
- }
-}
-
-/*
- \overload
- */
-const QRegion QRegion::operator&(const QRect &r) const
-{
- return intersect(r);
-}
-
-/*
- \overload
- */
-QRegion& QRegion::operator&=(const QRect &r)
-{
- if(isEmpty() || CONTAINSCHECK(r, d->qt_rgn->extents)) {
- // Do nothing
- } else if(r.isEmpty() || !EXTENTCHECK(&r, &d->qt_rgn->extents)) {
- *this = QRegion();
- } else if(CONTAINSCHECK(d->qt_rgn->innerRect, r)) {
- *this = QRegion(r);
- } else {
- detach();
- if(d->qt_rgn->mode == QRegionPrivate::Single) {
- QRect result = d->qt_rgn->single & r;
- d->qt_rgn->single = result;
- d->qt_rgn->extents = result;
- d->qt_rgn->innerRect = result;
- d->qt_rgn->innerArea = result.height() * result.width();
- } else {
- d->qt_rgn->extents &= r;
- d->qt_rgn->innerRect &= r;
- d->qt_rgn->innerArea = d->qt_rgn->innerRect.height() *
- d->qt_rgn->innerRect.width();
-
- int numRects = 0;
- for(int ii = 0; ii < d->qt_rgn->numRects; ++ii) {
- QRect result = d->qt_rgn->rects[ii] & r;
- if(!result.isEmpty())
- d->qt_rgn->rects[numRects++] = result;
- }
- d->qt_rgn->numRects = numRects;
- }
- }
- return *this;
-}
-#endif
-
-/*
- \fn QRegion QRegion::subtract(const QRegion &r) const
- \obsolete
-
- Use subtracted(\a r) instead.
-*/
-
-/*
- \fn QRegion QRegion::subtracted(const QRegion &r) const
- \since 4.2
-
- Returns a region which is \a r subtracted from this region.
-
- \img rsubtract.png Region Subtraction
-
- The figure shows the result when the ellipse on the right is
- subtracted from the ellipse on the left (\c {left - right}).
-
- \sa intersected(), united(), xored()
-*/
-
-QRegion QRegion::subtract(const QRegion &r) const
-{
- if (isEmptyHelper(d->qt_rgn) || isEmptyHelper(r.d->qt_rgn))
- return *this;
- if (r.d->qt_rgn->contains(*d->qt_rgn))
- return QRegion();
- if (!EXTENTCHECK(&d->qt_rgn->extents, &r.d->qt_rgn->extents))
- return *this;
- if (EqualRegion(d->qt_rgn, r.d->qt_rgn))
- return QRegion();
-
- QRegion result;
- result.detach();
- SubtractRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn);
- return result;
-}
-
-/*
- \fn QRegion QRegion::eor(const QRegion &r) const
- \obsolete
-
- Use xored(\a r) instead.
-*/
-
-/*
- \fn QRegion QRegion::xored(const QRegion &r) const
- \since 4.2
-
- Returns a region which is the exclusive or (XOR) of this region
- and \a r.
-
- \img rxor.png Region XORed
-
- The figure shows the exclusive or of two elliptical regions.
-
- \sa intersected(), united(), subtracted()
-*/
-
-QRegion QRegion::eor(const QRegion &r) const
-{
- if (isEmptyHelper(d->qt_rgn)) {
- return r;
- } else if (isEmptyHelper(r.d->qt_rgn)) {
- return *this;
- } else if (!EXTENTCHECK(&d->qt_rgn->extents, &r.d->qt_rgn->extents)) {
- return (*this + r);
- } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) {
- return QRegion();
- } else {
- QRegion result;
- result.detach();
- XorRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn);
- return result;
- }
-}
-
-/*
- Returns the bounding rectangle of this region. An empty region
- gives a rectangle that is QRect::isNull().
-*/
-
-QRect QRegion::boundingRect() const
-{
- if (isEmpty())
- return QRect();
- return d->qt_rgn->extents;
-}
-
-/* \internal
- Returns true if \a rect is guaranteed to be fully contained in \a region.
- A false return value does not guarantee the opposite.
-*/
-bool qt_region_strictContains(const QRegion &region, const QRect &rect)
-{
- if (isEmptyHelper(region.d->qt_rgn) || !rect.isValid())
- return false;
-
-#if 0 // TEST_INNERRECT
- static bool guard = false;
- if (guard)
- return QRect();
- guard = true;
- QRegion inner = region.d->qt_rgn->innerRect;
- Q_ASSERT((inner - region).isEmpty());
- guard = false;
-
- int maxArea = 0;
- for (int i = 0; i < region.d->qt_rgn->numRects; ++i) {
- const QRect r = region.d->qt_rgn->rects.at(i);
- if (r.width() * r.height() > maxArea)
- maxArea = r.width() * r.height();
- }
-
- if (maxArea > region.d->qt_rgn->innerArea) {
- qDebug() << "not largest rectangle" << region << region.d->qt_rgn->innerRect;
- }
- Q_ASSERT(maxArea <= region.d->qt_rgn->innerArea);
-#endif
-
- const QRect r1 = region.d->qt_rgn->innerRect;
- return (rect.left() >= r1.left() && rect.right() <= r1.right()
- && rect.top() >= r1.top() && rect.bottom() <= r1.bottom());
-}
-
-/*
- Returns an array of non-overlapping rectangles that make up the
- region.
-
- The union of all the rectangles is equal to the original region.
-*/
-QVector<QRect> QRegion::rects() const
-{
- if (d->qt_rgn) {
- d->qt_rgn->vector();
- d->qt_rgn->rects.resize(d->qt_rgn->numRects);
- return d->qt_rgn->rects;
- } else {
- return QVector<QRect>();
- }
-}
-
-/*
- \fn void QRegion::setRects(const QRect *rects, int number)
-
- Sets the region using the array of rectangles specified by \a rects and
- \a number.
- The rectangles \e must be optimally Y-X sorted and follow these restrictions:
-
- \list
- \o The rectangles must not intersect.
- \o All rectangles with a given top coordinate must have the same height.
- \o No two rectangles may abut horizontally (they should be combined
- into a single wider rectangle in that case).
- \o The rectangles must be sorted in ascending order, with Y as the major
- sort key and X as the minor sort key.
- \endlist
- \omit
- Only some platforms have these restrictions (Qt for Embedded Linux, X11 and Mac OS X).
- \endomit
-*/
-void QRegion::setRects(const QRect *rects, int num)
-{
- *this = QRegion();
- if (!rects || num == 0 || (num == 1 && rects->isEmpty()))
- return;
-
- detach();
-
- if(num == 1) {
- d->qt_rgn->single = *rects;
- d->qt_rgn->mode = QRegionPrivate::Single;
- d->qt_rgn->numRects = num;
- d->qt_rgn->extents = *rects;
- d->qt_rgn->innerRect = *rects;
- } else {
- d->qt_rgn->mode = QRegionPrivate::Vector;
- d->qt_rgn->rects.resize(num);
- d->qt_rgn->numRects = num;
- int left = INT_MAX,
- right = INT_MIN,
- top = INT_MAX,
- bottom = INT_MIN;
- for (int i = 0; i < num; ++i) {
- const QRect &rect = rects[i];
- d->qt_rgn->rects[i] = rect;
- left = qMin(rect.left(), left);
- right = qMax(rect.right(), right);
- top = qMin(rect.top(), top);
- bottom = qMax(rect.bottom(), bottom);
- d->qt_rgn->updateInnerRect(rect);
- }
- d->qt_rgn->extents = QRect(QPoint(left, top), QPoint(right, bottom));
- }
-}
-
-/*
- Returns true if the region is equal to \a r; otherwise returns
- false.
-*/
-
-bool QRegion::operator==(const QRegion &r) const
-{
- if (!d->qt_rgn || !r.d->qt_rgn)
- return r.d->qt_rgn == d->qt_rgn;
-
- if (d == r.d)
- return true;
- else
- return EqualRegion(d->qt_rgn, r.d->qt_rgn);
-}
-
-#ifdef QT_GREENPHONE_OPT
-bool QRegion::isRect() const
-{
- return d->qt_rgn && d->qt_rgn->mode == QRegionPrivate::Single;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
deleted file mode 100644
index 3876c3d1a2..0000000000
--- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qunifiedtoolbarsurface_mac_p.h"
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <private/qbackingstore_p.h>
-#include <private/qmainwindowlayout_p.h>
-
-#include <QDebug>
-
-#ifdef QT_MAC_USE_COCOA
-
-QT_BEGIN_NAMESPACE
-
-QUnifiedToolbarSurface::QUnifiedToolbarSurface(QWidget *widget)
- : QRasterWindowSurface(widget, false), d_ptr(new QUnifiedToolbarSurfacePrivate)
-{
- d_ptr->image = 0;
- d_ptr->inSetGeometry = false;
-
- setGeometry(QRect(QPoint(0, 0), QSize(widget->width(), 100))); // FIXME: Fix height.
-}
-
-QUnifiedToolbarSurface::~QUnifiedToolbarSurface()
-{
- if (d_ptr->image)
- delete d_ptr->image;
-}
-
-QPaintDevice *QUnifiedToolbarSurface::paintDevice()
-{
- return &d_ptr->image->image;
-}
-
-void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, QWidget *parent_toolbar, const QPoint &offset)
-{
- if (object != 0) {
- if (object->isWidgetType()) {
- QWidget *widget = qobject_cast<QWidget *>(object);
-
- // We redirect the painting only if the widget is in the same window
- // and is not a window in itself.
- if (!(widget->windowType() & Qt::Window)) {
- widget->d_func()->unifiedSurface = this;
- widget->d_func()->isInUnifiedToolbar = true;
- widget->d_func()->toolbar_offset = offset;
- widget->d_func()->toolbar_ancestor = parent_toolbar;
-
- for (int i = 0; i < object->children().size(); ++i) {
- recursiveRedirect(object->children().at(i), parent_toolbar, offset);
- }
- }
- }
- }
-}
-
-void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offset)
-{
- setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME
- recursiveRedirect(toolbar, toolbar, offset);
-}
-
-// We basically undo what we set in recursiveRedirect().
-void QUnifiedToolbarSurface::recursiveRemoval(QObject *object)
-{
- if (object != 0) {
- if (object->isWidgetType()) {
- QWidget *widget = qobject_cast<QWidget *>(object);
-
- // If it's a pop-up or something similar, we don't redirect it.
- if (widget->windowType() & Qt::Window)
- return;
-
- widget->d_func()->unifiedSurface = 0;
- widget->d_func()->isInUnifiedToolbar = false;
- widget->d_func()->toolbar_offset = QPoint();
- widget->d_func()->toolbar_ancestor = 0;
- }
-
- for (int i = 0; i < object->children().size(); ++i) {
- recursiveRemoval(object->children().at(i));
- }
- }
-}
-
-void QUnifiedToolbarSurface::removeToolbar(QToolBar *toolbar)
-{
- recursiveRemoval(toolbar);
-}
-
-void QUnifiedToolbarSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
- Q_D(QUnifiedToolbarSurface);
- d->inSetGeometry = true;
- if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height())
- prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
- d->inSetGeometry = false;
-
- // FIXME: set unified toolbar height.
-}
-
-void QUnifiedToolbarSurface::beginPaint(const QRegion &rgn)
-{
- QPainter p(&d_ptr->image->image);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = rgn.rects();
- const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- p.fillRect(*it, blank);
- }
-}
-
-void QUnifiedToolbarSurface::updateToolbarOffset(QWidget *widget)
-{
- QMainWindowLayout *mlayout = qobject_cast<QMainWindowLayout*> (widget->window()->layout());
- mlayout->updateUnifiedToolbarOffset();
-}
-
-void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
-{
- Q_UNUSED(region);
- Q_UNUSED(offset);
-
- this->flush(widget);
-}
-
-void QUnifiedToolbarSurface::flush(QWidget *widget)
-{
- Q_D(QUnifiedToolbarSurface);
-
- if (!d->image)
- return;
-
- if (widget->d_func()->flushRequested) {
- // We call display: directly to avoid flickering in the toolbar.
- qt_mac_display(widget);
- }
-}
-
-void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget)
-{
- Q_D(QUnifiedToolbarSurface);
-
- int width = geometry().width();
- int height = 100; // FIXME
- if (d->image) {
- width = qMax(d->image->width(), width);
- height = qMax(d->image->height(), height);
- }
-
- if (width == 0 || height == 0) {
- delete d->image;
- d->image = 0;
- return;
- }
-
- QNativeImage *oldImage = d->image;
-
- d->image = new QNativeImage(width, height, format, false, widget);
-
- if (oldImage && d->inSetGeometry && hasStaticContents()) {
- // Make sure we use the const version of bits() (no detach).
- const uchar *src = const_cast<const QImage &>(oldImage->image).bits();
- uchar *dst = d->image->image.bits();
-
- const int srcBytesPerLine = oldImage->image.bytesPerLine();
- const int dstBytesPerLine = d->image->image.bytesPerLine();
- const int bytesPerPixel = oldImage->image.depth() >> 3;
-
- QRegion staticRegion(staticContents());
- // Make sure we're inside the boundaries of the old image.
- staticRegion &= QRect(0, 0, oldImage->image.width(), oldImage->image.height());
- const QVector<QRect> &rects = staticRegion.rects();
- const QRect *srcRect = rects.constData();
-
- // Copy the static content of the old image into the new one.
- int numRectsLeft = rects.size();
- do {
- const int bytesOffset = srcRect->x() * bytesPerPixel;
- const int dy = srcRect->y();
-
- // Adjust src and dst to point to the right offset.
- const uchar *s = src + dy * srcBytesPerLine + bytesOffset;
- uchar *d = dst + dy * dstBytesPerLine + bytesOffset;
- const int numBytes = srcRect->width() * bytesPerPixel;
-
- int numScanLinesLeft = srcRect->height();
- do {
- ::memcpy(d, s, numBytes);
- d += dstBytesPerLine;
- s += srcBytesPerLine;
- } while (--numScanLinesLeft);
-
- ++srcRect;
- } while (--numRectsLeft);
- }
-
- delete oldImage;
-}
-
-CGContextRef QUnifiedToolbarSurface::imageContext()
-{
- Q_D(QUnifiedToolbarSurface);
- return d->image->cg;
-}
-
-void QUnifiedToolbarSurface::renderToolbar(QWidget *widget, bool forceFlush)
-{
- QWidget *toolbar = widget->d_func()->toolbar_ancestor;
-
- updateToolbarOffset(toolbar);
- QRect beginPaintRect(toolbar->d_func()->toolbar_offset.x(), toolbar->d_func()->toolbar_offset.y(), toolbar->geometry().width(), toolbar->geometry().height());
- QRegion beginPaintRegion(beginPaintRect);
-
- beginPaint(beginPaintRegion);
- toolbar->render(paintDevice(), toolbar->d_func()->toolbar_offset, QRegion(toolbar->geometry()), QWidget::DrawChildren);
- toolbar->d_func()->flushRequested = true;
-
- if (forceFlush)
- flush(toolbar);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
deleted file mode 100644
index 0a7ebf1759..0000000000
--- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QUNIFIEDTOOLBARSURFACE_MAC_P_H
-#define QUNIFIEDTOOLBARSURFACE_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qwindowsurface_raster_p.h>
-#include <QWidget>
-#include <QToolBar>
-#include <private/qwidget_p.h>
-#include <private/qnativeimage_p.h>
-
-#ifdef QT_MAC_USE_COCOA
-
-QT_BEGIN_NAMESPACE
-
-class QNativeImage;
-
-
-class QUnifiedToolbarSurfacePrivate
-{
-public:
- QNativeImage *image;
- uint inSetGeometry : 1;
-};
-
-class Q_GUI_EXPORT QUnifiedToolbarSurface : public QRasterWindowSurface
-{
-public:
- QUnifiedToolbarSurface(QWidget *widget);
- ~QUnifiedToolbarSurface();
-
- void flush(QWidget *widget);
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void setGeometry(const QRect &rect);
- void beginPaint(const QRegion &rgn);
- void insertToolbar(QWidget *toolbar, const QPoint &offset);
- void removeToolbar(QToolBar *toolbar);
- void updateToolbarOffset(QWidget *widget);
- void renderToolbar(QWidget *widget, bool forceFlush = false);
- void recursiveRedirect(QObject *widget, QWidget *parent_toolbar, const QPoint &offset);
-
- QPaintDevice *paintDevice();
- CGContextRef imageContext();
-
-private:
- void prepareBuffer(QImage::Format format, QWidget *widget);
- void recursiveRemoval(QObject *object);
-
- Q_DECLARE_PRIVATE(QUnifiedToolbarSurface)
- QScopedPointer<QUnifiedToolbarSurfacePrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_MAC_USE_COCOA
-
-#endif // QUNIFIEDTOOLBARSURFACE_MAC_P_H
diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp
index 0fb9bf78a9..13d152175d 100644
--- a/src/gui/painting/qwindowsurface.cpp
+++ b/src/gui/painting/qwindowsurface.cpp
@@ -40,29 +40,26 @@
****************************************************************************/
#include <private/qwindowsurface_p.h>
-#include <qwidget.h>
-#include <private/qwidget_p.h>
-#include <private/qbackingstore_p.h>
-#include <private/qapplication_p.h>
+#include <qwindow.h>
+#include <private/qwindow_p.h>
QT_BEGIN_NAMESPACE
class QWindowSurfacePrivate
{
public:
- QWindowSurfacePrivate(QWidget *w)
+ QWindowSurfacePrivate(QWindow *w)
: window(w)
{
}
- QWidget *window;
+ QWindow *window;
#if !defined(Q_WS_QPA)
QRect geometry;
#else
QSize size;
#endif //Q_WS_QPA
QRegion staticContents;
- QList<QImage*> bufferImages;
};
/*!
@@ -96,10 +93,10 @@ public:
*/
/*!
- \fn void QWindowSurface::flush(QWidget *widget, const QRegion &region,
+ \fn void QWindowSurface::flush(QWindow *window, const QRegion &region,
const QPoint &offset)
- Flushes the given \a region from the specified \a widget onto the
+ Flushes the given \a region from the specified \a window onto the
screen.
Note that the \a offset parameter is currently unused.
@@ -114,13 +111,11 @@ public:
/*!
Constructs an empty surface for the given top-level \a window.
*/
-QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface)
+QWindowSurface::QWindowSurface(QWindow *window, bool /*setDefaultSurface*/)
: d_ptr(new QWindowSurfacePrivate(window))
{
- if (!QApplicationPrivate::runtime_graphics_system) {
- if(setDefaultSurface && window)
- window->setWindowSurface(this);
- }
+ if (window)
+ window->d_func()->surface = this;
}
/*!
@@ -128,8 +123,8 @@ QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface)
*/
QWindowSurface::~QWindowSurface()
{
- if (d_ptr->window)
- d_ptr->window->d_func()->extra->topextra->windowSurface = 0;
+// if (d_ptr->window)
+// d_ptr->window->d_func()->extra->topextra->windowSurface = 0;
delete d_ptr;
}
@@ -137,7 +132,7 @@ QWindowSurface::~QWindowSurface()
Returns a pointer to the top-level window associated with this
surface.
*/
-QWidget* QWindowSurface::window() const
+QWindow* QWindowSurface::window() const
{
return d_ptr->window;
}
@@ -148,9 +143,6 @@ void QWindowSurface::beginPaint(const QRegion &)
void QWindowSurface::endPaint(const QRegion &)
{
-// QApplication::syncX();
- qDeleteAll(d_ptr->bufferImages);
- d_ptr->bufferImages.clear();
}
#if !defined(Q_WS_QPA)
@@ -211,67 +203,35 @@ bool QWindowSurface::scroll(const QRegion &area, int dx, int dy)
}
/*!
- Returns a QImage pointer which represents the actual buffer the \a widget
- is drawn into or 0 if this is unavailable.
-
- You must call beginPaint() before you call this function and the returned
- pointer is only valid until endPaint() is called.
-*/
-QImage* QWindowSurface::buffer(const QWidget *widget)
-{
- if (widget->window() != window())
- return 0;
-
- QPaintDevice *pdev = paintDevice();
- if (!pdev || pdev->devType() != QInternal::Image)
- return 0;
-
- const QPoint off = offset(widget);
- QImage *img = static_cast<QImage*>(pdev);
-
- QRect rect(off, widget->size());
- rect &= QRect(QPoint(), img->size());
-
- if (rect.isEmpty())
- return 0;
-
- img = new QImage(img->scanLine(rect.y()) + rect.x() * img->depth() / 8,
- rect.width(), rect.height(),
- img->bytesPerLine(), img->format());
- d_ptr->bufferImages.append(img);
-
- return img;
-}
-
-/*!
Returns a QPixmap generated from the part of the backing store
- corresponding to \a widget. Returns a null QPixmap if an error
+ corresponding to \a window. Returns a null QPixmap if an error
occurs. The contents of the pixmap are only defined for the regions
- of \a widget that have received paint events since the last resize
+ of \a window that have received paint events since the last resize
of the backing store.
- If \a rectangle is a null rectangle (the default), the entire widget
+ If \a rectangle is a null rectangle (the default), the entire window
is grabbed. Otherwise, the grabbed area is limited to \a rectangle.
The default implementation uses QWindowSurface::buffer().
- \sa QPixmap::grabWidget()
+ \sa QPixmap::grabWindow()
*/
-QPixmap QWindowSurface::grabWidget(const QWidget *widget, const QRect &rectangle) const
+QPixmap QWindowSurface::grabWindow(const QWindow *, const QRect &) const
{
QPixmap result;
- if (widget->window() != window())
+#if 0
+ if (window->window() != window())
return result;
- const QImage *img = const_cast<QWindowSurface *>(this)->buffer(widget->window());
+ const QImage *img = const_cast<QWindowSurface *>(this)->buffer(window->window());
if (!img || img->isNull())
return result;
- QRect rect = rectangle.isEmpty() ? widget->rect() : (widget->rect() & rectangle);
+ QRect rect = rectangle.isEmpty() ? window->rect() : (window->rect() & rectangle);
- rect.translate(offset(widget) - offset(widget->window()));
+ rect.translate(offset(window) - offset(window->window()));
rect &= QRect(QPoint(), img->size());
if (rect.isEmpty())
@@ -283,27 +243,28 @@ QPixmap QWindowSurface::grabWidget(const QWidget *widget, const QRect &rectangle
subimg.detach(); //### expensive -- maybe we should have a real SubImage that shares reference count
result = QPixmap::fromImage(subimg);
+#endif
return result;
}
/*!
- Returns the offset of \a widget in the coordinates of this
+ Returns the offset of \a window in the coordinates of this
window surface.
*/
-QPoint QWindowSurface::offset(const QWidget *widget) const
+QPoint QWindowSurface::offset(const QWindow *) const
{
- QWidget *window = d_ptr->window;
- QPoint offset = widget->mapTo(window, QPoint());
-#ifdef Q_WS_QWS
- offset += window->geometry().topLeft() - window->frameGeometry().topLeft();
+ QPoint offset;
+#if 0
+ QWindow *window = d_ptr->window;
+ QPoint offset = window->mapTo(window, QPoint());
#endif
return offset;
}
/*!
- \fn QRect QWindowSurface::rect(const QWidget *widget) const
+ \fn QRect QWindowSurface::rect(const QWindow *window) const
- Returns the rectangle for \a widget in the coordinates of this
+ Returns the rectangle for \a window in the coordinates of this
window surface.
*/
diff --git a/src/gui/painting/qwindowsurface_mac.cpp b/src/gui/painting/qwindowsurface_mac.cpp
deleted file mode 100644
index 620a50f3ea..0000000000
--- a/src/gui/painting/qwindowsurface_mac.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowsurface_mac_p.h"
-
-#include <private/qt_mac_p.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <QtGui/qwidget.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QMacWindowSurfacePrivate
-{
- QWidget *widget;
- QPixmap device;
-};
-
-QMacWindowSurface::QMacWindowSurface(QWidget *widget)
- : QWindowSurface(widget), d_ptr(new QMacWindowSurfacePrivate)
-{
- d_ptr->widget = widget;
-}
-
-QMacWindowSurface::~QMacWindowSurface()
-{
- delete d_ptr;
-}
-
-QPaintDevice *QMacWindowSurface::paintDevice()
-{
- return &d_ptr->device;
-}
-
-void QMacWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
-{
- Q_UNUSED(offset);
-
- // Get a context for the widget.
-#ifndef QT_MAC_USE_COCOA
- CGContextRef context;
- CGrafPtr port = GetWindowPort(qt_mac_window_for(widget));
- QDBeginCGContext(port, &context);
-#else
- extern CGContextRef qt_mac_graphicsContextFor(QWidget *);
- CGContextRef context = qt_mac_graphicsContextFor(widget);
-#endif
- CGContextRetain(context);
- CGContextSaveGState(context);
-
- // Flip context.
- CGContextTranslateCTM(context, 0, widget->height());
- CGContextScaleCTM(context, 1, -1);
-
- // Clip to region.
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect &rect = rects.at(i);
- CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
- }
- CGContextClip(context);
-
- // Draw the image onto the window.
- const CGRect dest = CGRectMake(0, 0, widget->width(), widget->height());
- const CGImageRef image = d_ptr->device.toMacCGImageRef();
- qt_mac_drawCGImage(context, &dest, image);
- CFRelease(image);
-
- // Restore context.
- CGContextRestoreGState(context);
-#ifndef QT_MAC_USE_COCOA
- QDEndCGContext(port, &context);
-#else
- CGContextFlush(context);
-#endif
- CGContextRelease(context);
-}
-
-void QMacWindowSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
- const QSize size = rect.size();
- if (d_ptr->device.size() != size)
- d_ptr->device = QPixmap(size);
-}
-
-bool QMacWindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- if (d_ptr->device.size().isNull())
- return false;
-
- QCFType<CGImageRef> image = d_ptr->device.toMacCGImageRef();
- const QRect rect(area.boundingRect());
- const CGRect dest = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
- QCFType<CGImageRef> subimage = CGImageCreateWithImageInRect(image, dest);
- QCFType<CGContextRef> context = qt_mac_cg_context(&d_ptr->device);
- CGContextTranslateCTM(context, dx, dy);
- qt_mac_drawCGImage(context, &dest, subimage);
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qwindowsurface_mac_p.h b/src/gui/painting/qwindowsurface_mac_p.h
deleted file mode 100644
index fd68b1fe91..0000000000
--- a/src/gui/painting/qwindowsurface_mac_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSURFACE_MAC_P_H
-#define QWINDOWSURFACE_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-#include "private/qwindowsurface_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPaintDevice;
-class QPoint;
-class QRegion;
-class QWidget;
-struct QMacWindowSurfacePrivate;
-
-class QMacWindowSurface : public QWindowSurface
-{
-public:
- QMacWindowSurface(QWidget *widget);
- ~QMacWindowSurface();
-
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void setGeometry(const QRect &rect);
- bool scroll(const QRegion &area, int dx, int dy);
-
-private:
- QMacWindowSurfacePrivate *d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSURFACE_MAC_P_H
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index a3fea67f24..835aae77d4 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -53,7 +53,7 @@
// We mean it.
//
-#include <QtGui/qwidget.h>
+#include <QtGui/qwindow.h>
QT_BEGIN_NAMESPACE
@@ -76,18 +76,18 @@ public:
};
Q_DECLARE_FLAGS(WindowSurfaceFeatures, WindowSurfaceFeature)
- QWindowSurface(QWidget *window, bool setDefaultSurface = true);
+ QWindowSurface(QWindow *window, bool setDefaultSurface = true);
virtual ~QWindowSurface();
- QWidget *window() const;
+ QWindow *window() const;
virtual QPaintDevice *paintDevice() = 0;
- // 'widget' can be a child widget, in which case 'region' is in child widget coordinates and
- // offset is the (child) widget's offset in relation to the window surface. On QWS, 'offset'
- // can be larger than just the offset from the top-level widget as there may also be window
+ // 'window' can be a child window, in which case 'region' is in child window coordinates and
+ // offset is the (child) window's offset in relation to the window surface. On QWS, 'offset'
+ // can be larger than just the offset from the top-level window as there may also be window
// decorations which are painted into the window surface.
- virtual void flush(QWidget *widget, const QRegion &region, const QPoint &offset) = 0;
+ virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset) = 0;
#if !defined(Q_WS_QPA)
virtual void setGeometry(const QRect &rect);
QRect geometry() const;
@@ -102,11 +102,10 @@ public:
virtual void beginPaint(const QRegion &);
virtual void endPaint(const QRegion &);
- virtual QImage* buffer(const QWidget *widget);
- virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const;
+ virtual QPixmap grabWindow(const QWindow *window, const QRect& rectangle = QRect()) const;
- virtual QPoint offset(const QWidget *widget) const;
- inline QRect rect(const QWidget *widget) const;
+ virtual QPoint offset(const QWindow *window) const;
+ inline QRect rect(const QWindow *window) const;
bool hasFeature(WindowSurfaceFeature feature) const;
virtual WindowSurfaceFeatures features() const;
@@ -123,9 +122,9 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowSurface::WindowSurfaceFeatures)
-inline QRect QWindowSurface::rect(const QWidget *widget) const
+inline QRect QWindowSurface::rect(const QWindow *window) const
{
- return widget->rect().translated(offset(widget));
+ return window->geometry().translated(offset(window));
}
inline bool QWindowSurface::hasFeature(WindowSurfaceFeature feature) const
diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp
deleted file mode 100644
index cb293cb135..0000000000
--- a/src/gui/painting/qwindowsurface_qws.cpp
+++ /dev/null
@@ -1,1433 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowsurface_qws_p.h"
-#include <qwidget.h>
-#include <qscreen_qws.h>
-#include <qwsmanager_qws.h>
-#include <qapplication.h>
-#include <qwsdisplay_qws.h>
-#include <qrgb.h>
-#include <qpaintengine.h>
-#include <qdesktopwidget.h>
-#include <private/qapplication_p.h>
-#include <private/qwsdisplay_qws_p.h>
-#include <private/qwidget_p.h>
-#include <private/qwsmanager_p.h>
-#include <private/qwslock_p.h>
-#include <private/qbackingstore_p.h>
-#include <stdio.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-
-typedef QMap<int, QWSWindowSurface*> SurfaceMap;
-Q_GLOBAL_STATIC(SurfaceMap, winIdToSurfaceMap);
-
-QWSWindowSurface* qt_findWindowSurface(int winId)
-{
- return winIdToSurfaceMap()->value(winId);
-}
-
-static void qt_insertWindowSurface(int winId, QWSWindowSurface *surface)
-{
- if (!surface)
- winIdToSurfaceMap()->remove(winId);
- else
- winIdToSurfaceMap()->insert(winId, surface);
-}
-
-#endif // Q_BACKINGSTORE_SUBSURFACES
-
-inline bool isWidgetOpaque(const QWidget *w)
-{
- return w->d_func()->isOpaque && !w->testAttribute(Qt::WA_TranslucentBackground);
-}
-
-static inline QScreen *getScreen(const QWidget *w)
-{
- const QList<QScreen*> subScreens = qt_screen->subScreens();
- if (subScreens.isEmpty())
- return qt_screen;
-
- const int screen = QApplication::desktop()->screenNumber(w);
-
- return qt_screen->subScreens().at(screen < 0 ? 0 : screen);
-}
-
-static int bytesPerPixel(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_Invalid:
- return 0;
-#ifndef QT_NO_DEBUG
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- qFatal("QWSWindowSurface: Invalid backingstore format: %i",
- int(format));
-#endif
- case QImage::Format_Indexed8:
- return 1;
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- return 4;
- case QImage::Format_RGB16:
- case QImage::Format_RGB555:
- case QImage::Format_RGB444:
- case QImage::Format_ARGB4444_Premultiplied:
- return 2;
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_RGB666:
- case QImage::Format_RGB888:
- return 3;
- default:
-#ifndef QT_NO_DEBUG
- qFatal("QWSWindowSurface: Invalid backingstore format: %i",
- int(format));
-#endif
- return 0;
- }
-}
-
-static inline int nextMulOf4(int n)
-{
- return ((n + 3) & 0xfffffffc);
-}
-
-static inline void setImageMetrics(QImage &img, QWidget *window) {
- QScreen *myScreen = getScreen(window);
- if (myScreen) {
- int dpmx = myScreen->width()*1000 / myScreen->physicalWidth();
- int dpmy = myScreen->height()*1000 / myScreen->physicalHeight();
- img.setDotsPerMeterX(dpmx);
- img.setDotsPerMeterY(dpmy);
- }
-}
-
-void QWSWindowSurface::invalidateBuffer()
-{
-
- QWidget *win = window();
- if (win) {
- win->d_func()->invalidateBuffer(win->rect());
-#ifndef QT_NO_QWS_MANAGER
- QTLWExtra *topextra = win->d_func()->extra->topextra;
- QWSManager *manager = topextra->qwsManager;
- if (manager)
- manager->d_func()->dirtyRegion(QDecoration::All,
- QDecoration::Normal);
-#endif
- }
-}
-
-QWSWindowSurfacePrivate::QWSWindowSurfacePrivate()
- : flags(0),
-#ifdef QT_QWS_CLIENTBLIT
- directId(-1),
-#endif
- winId(0)
-{
-}
-
-void QWSWindowSurfacePrivate::setWinId(int id)
-{
- winId = id;
-}
-
-int QWSWindowSurface::winId() const
-{
- // XXX: the widget winId may change during the lifetime of the widget!!!
-
- const QWidget *win = window();
- if (win && win->isWindow())
- return win->internalWinId();
-
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- if (!d_ptr->winId) {
- QWSWindowSurface *that = const_cast<QWSWindowSurface*>(this);
- QWSDisplay *display = QWSDisplay::instance();
- const int id = display->takeId();
- qt_insertWindowSurface(id, that);
- that->d_ptr->winId = id;
-
- if (win)
- display->nameRegion(id, win->objectName(), win->windowTitle());
- else
- display->nameRegion(id, QString(), QString());
-
- display->setAltitude(id, 1, true); // XXX
- }
-#endif
-
- return d_ptr->winId;
-}
-
-void QWSWindowSurface::setWinId(int id)
-{
- d_ptr->winId = id;
-}
-
-/*!
- \class QWSWindowSurface
- \since 4.2
- \ingroup qws
- \preliminary
- \internal
-
- \brief The QWSWindowSurface class provides the drawing area for top-level
- windows in Qt for Embedded Linux.
-
- Note that this class is only available in Qt for Embedded Linux.
-
- In \l{Qt for Embedded Linux}, the default behavior is for each client to
- render its widgets into memory while the server is responsible for
- putting the contents of the memory onto the
- screen. QWSWindowSurface is used by the window system to implement
- the associated memory allocation.
-
- When a screen update is required, the server runs through all the
- top-level windows that intersect with the region that is about to
- be updated, and ensures that the associated clients have updated
- their memory buffer. Then the server uses the screen driver to
- copy the content of the memory to the screen. To locate the
- relevant parts of memory, the driver is provided with the list of
- top-level windows that intersect with the given region. Associated
- with each of the top-level windows there is a window surface
- representing the drawing area of the window.
-
- When deriving from the QWSWindowSurface class, e.g., when adding
- an \l {Adding an Accelerated Graphics Driver to Qt for Embedded Linux}
- {accelerated graphics driver}, there are several pure virtual
- functions that must be implemented. In addition, QWSWindowSurface
- provides several virtual functions that can be reimplemented to
- customize the drawing process.
-
- \tableofcontents
-
- \section1 Pure Virtual Functions
-
- There are in fact two window surface instances for each top-level
- window; one used by the application when drawing a window, and
- another used by the server application to perform window
- compositioning. Implement the attach() to create the server-side
- representation of the surface. The data() function must be
- implemented to provide the required data.
-
- Implement the key() function to uniquely identify the surface
- class, and the isValid() function to determine is a surface
- corresponds to a given widget.
-
- The geometry() function must be implemented to let the window
- system determine the area required by the window surface
- (QWSWindowSurface also provides a corresponding virtual
- setGeometry() function that is called whenever the area necessary
- for the top-level window to be drawn, changes). The image()
- function is called by the window system during window
- compositioning, and must be implemented to return an image of the
- top-level window.
-
- Finally, the paintDevice() function must be implemented to return
- the appropriate paint device, and the scroll() function must be
- implemented to scroll the given region of the surface the given
- number of pixels.
-
- \section1 Virtual Functions
-
- When painting onto the surface, the window system will always call
- the beginPaint() function before any painting operations are
- performed. Likewise the endPaint() function is automatically
- called when the painting is done. Reimplement the painterOffset()
- function to alter the offset that is applied when drawing.
-
- The window system uses the flush() function to put a given region
- of the widget onto the screen, and the release() function to
- deallocate the screen region corresponding to this window surface.
-
- \section1 Other Members
-
- QWSWindowSurface provides the window() function returning a
- pointer to the top-level window the surface is representing. The
- currently visible region of the associated widget can be retrieved
- and set using the clipRegion() and setClipRegion() functions,
- respectively.
-
- When the window system performs the window compositioning, it uses
- the SurfaceFlag enum describing the surface content. The currently
- set surface flags can be retrieved and altered using the
- surfaceFlags() and setSurfaceFlags() functions. In addition,
- QWSWindowSurface provides the isBuffered(), isOpaque() and
- isRegionReserved() convenience functions.
-
- \sa {Qt for Embedded Linux Architecture#Drawing on Screen}{Qt for
- Embedded Linux Architecture}
-*/
-
-/*!
- \enum QWSWindowSurface::SurfaceFlag
-
- This enum is used to describe the window surface's contents. It
- is used by the screen driver to handle region allocation and
- composition.
-
- \value RegionReserved The surface contains a reserved area. Once
- allocated, a reserved area can not not be changed by the window
- system, i.e., no other widgets can be drawn on top of this.
-
- \value Buffered
- The surface is in a memory area which is not part of a framebuffer.
- (A top-level window with QWidget::windowOpacity() other than 1.0 must use
- a buffered surface in order to making blending with the background work.)
-
- \value Opaque
- The surface contains only opaque pixels.
-
- \sa surfaceFlags(), setSurfaceFlags()
-*/
-
-/*!
- \fn bool QWSWindowSurface::isValid() const
- \since 4.3
-
- Implement this function to return true if the surface is a valid
- surface for the given top-level \a window; otherwise return
- false.
-
- \sa window(), key()
-*/
-
-/*!
- \fn QString QWSWindowSurface::key() const
-
- Implement this function to return a string that uniquely
- identifies the class of this surface.
-
- \sa window(), isValid()
-*/
-
-/*!
- \fn QByteArray QWSWindowSurface::permanentState() const
- \since 4.3
-
- Implement this function to return the data required for creating a
- server-side representation of the surface.
-
- \sa attach()
-*/
-
-/*!
- \fn void QWSWindowSurface::setPermanentState(const QByteArray &data)
- \since 4.3
-
- Implement this function to attach a server-side surface instance
- to the corresponding client side instance using the given \a
- data. Return true if successful; otherwise return false.
-
- \sa data()
-*/
-
-/*!
- \fn const QImage QWSWindowSurface::image() const
-
- Implement this function to return an image of the top-level window.
-
- \sa geometry()
-*/
-
-/*!
- \fn bool QWSWindowSurface::isRegionReserved() const
-
- Returns true if the QWSWindowSurface::RegionReserved is set; otherwise
- returns false.
-
- \sa surfaceFlags()
-*/
-
-/*!
- \fn bool QWSWindowSurface::isBuffered() const
-
- Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
-
- \sa surfaceFlags()
-*/
-
-/*!
- \fn bool QWSWindowSurface::isOpaque() const
-
- Returns true if the QWSWindowSurface::Opaque is set; otherwise
- returns false.
-
- \sa surfaceFlags()
-*/
-
-
-/*!
- Constructs an empty surface.
-*/
-QWSWindowSurface::QWSWindowSurface()
- : QWindowSurface(0), d_ptr(new QWSWindowSurfacePrivate)
-{
-}
-
-/*!
- Constructs an empty surface for the given top-level \a widget.
-*/
-QWSWindowSurface::QWSWindowSurface(QWidget *widget)
- : QWindowSurface(widget), d_ptr(new QWSWindowSurfacePrivate)
-{
-}
-
-QWSWindowSurface::~QWSWindowSurface()
-{
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- if (d_ptr->winId)
- winIdToSurfaceMap()->remove(d_ptr->winId);
-#endif
-
- delete d_ptr;
-}
-
-/*!
- Returns the offset to be used when painting.
-
- \sa paintDevice()
-*/
-QPoint QWSWindowSurface::painterOffset() const
-{
- const QWidget *w = window();
- if (!w)
- return QPoint();
- return w->geometry().topLeft() - w->frameGeometry().topLeft();
-}
-
-void QWSWindowSurface::beginPaint(const QRegion &)
-{
- lock();
-}
-
-void QWSWindowSurface::endPaint(const QRegion &)
-{
- unlock();
-}
-
-// XXX: documentation!!!
-QByteArray QWSWindowSurface::transientState() const
-{
- return QByteArray();
-}
-
-QByteArray QWSWindowSurface::permanentState() const
-{
- return QByteArray();
-}
-
-void QWSWindowSurface::setTransientState(const QByteArray &state)
-{
- Q_UNUSED(state);
-}
-
-void QWSWindowSurface::setPermanentState(const QByteArray &state)
-{
- Q_UNUSED(state);
-}
-
-bool QWSWindowSurface::lock(int timeout)
-{
- Q_UNUSED(timeout);
- return true;
-}
-
-void QWSWindowSurface::unlock()
-{
-}
-
-#ifdef QT_QWS_CLIENTBLIT
-/*! \internal */
-const QRegion QWSWindowSurface::directRegion() const
-{
- return d_ptr->direct;
-}
-
-/*! \internal */
-int QWSWindowSurface::directRegionId() const
-{
- return d_ptr->directId;
-}
-
-/*! \internal */
-void QWSWindowSurface::setDirectRegion(const QRegion &r, int id)
-{
- d_ptr->direct = r;
- d_ptr->directId = id;
-}
-#endif
-
-/*!
- Returns the region currently visible on the screen.
-
- \sa setClipRegion()
-*/
-const QRegion QWSWindowSurface::clipRegion() const
-{
- return d_ptr->clip;
-}
-
-/*!
- Sets the region currently visible on the screen to be the given \a
- clip region.
-
- \sa clipRegion()
-*/
-void QWSWindowSurface::setClipRegion(const QRegion &clip)
-{
- if (clip == d_ptr->clip)
- return;
-
- QRegion expose = (clip - d_ptr->clip);
- d_ptr->clip = clip;
-
- if (expose.isEmpty() || clip.isEmpty())
- return; // No repaint or flush required.
-
- QWidget *win = window();
- if (!win)
- return;
-
- if (isBuffered()) {
- // No repaint required. Flush exposed area via the backing store.
- win->d_func()->syncBackingStore(expose);
- return;
- }
-
-#ifndef QT_NO_QWS_MANAGER
- // Invalidate exposed decoration area.
- if (win && win->isWindow()) {
- QTLWExtra *topextra = win->d_func()->extra->topextra;
- if (QWSManager *manager = topextra->qwsManager) {
- QRegion decorationExpose(manager->region());
- decorationExpose.translate(-win->geometry().topLeft());
- decorationExpose &= expose;
- if (!decorationExpose.isEmpty()) {
- expose -= decorationExpose;
- manager->d_func()->dirtyRegion(QDecoration::All, QDecoration::Normal, decorationExpose);
- }
- }
- }
-#endif
-
- // Invalidate exposed widget area.
- win->d_func()->invalidateBuffer(expose);
-}
-
-/*!
- Returns the surface flags describing the contents of this surface.
-
- \sa isBuffered(), isOpaque(), isRegionReserved()
-*/
-QWSWindowSurface::SurfaceFlags QWSWindowSurface::surfaceFlags() const
-{
- return d_ptr->flags;
-}
-
-/*!
- Sets the surface flags describing the contents of this surface, to
- be the given \a flags.
-
- \sa surfaceFlags()
-*/
-void QWSWindowSurface::setSurfaceFlags(SurfaceFlags flags)
-{
- d_ptr->flags = flags;
-}
-
-void QWSWindowSurface::setGeometry(const QRect &rect)
-{
- QRegion mask = rect;
-
- const QWidget *win = window();
- if (win) {
-#ifndef QT_NO_QWS_MANAGER
- if (win->isWindow()) {
- QTLWExtra *topextra = win->d_func()->extra->topextra;
- QWSManager *manager = topextra->qwsManager;
-
- if (manager) {
- // The frame geometry is the bounding rect of manager->region,
- // which could be too much, so we need to clip.
- mask &= (manager->region() + win->geometry());
- }
- }
-#endif
-
- const QRegion winMask = win->mask();
- if (!winMask.isEmpty())
- mask &= winMask.translated(win->geometry().topLeft());
- }
-
- setGeometry(rect, mask);
-}
-
-void QWSWindowSurface::setGeometry(const QRect &rect, const QRegion &mask)
-{
- if (rect == geometry()) // XXX: && mask == prevMask
- return;
-
- const bool isResize = rect.size() != geometry().size();
- const bool needsRepaint = isResize || !isBuffered();
-
- QWindowSurface::setGeometry(rect);
-
- const QRegion region = mask & rect;
- QWidget *win = window();
- // Only request regions for widgets visible on the screen.
- // (Added the !win check for compatibility reasons, because
- // there was no "if (win)" check before).
- const bool requestQWSRegion = !win || !win->testAttribute(Qt::WA_DontShowOnScreen);
- if (requestQWSRegion)
- QWidget::qwsDisplay()->requestRegion(winId(), key(), permanentState(), region);
-
- if (needsRepaint)
- invalidateBuffer();
-
- if (!requestQWSRegion) {
- // We didn't request a region, hence we won't get a QWSRegionEvent::Allocation
- // event back from the server so we set the clip directly. We have to
- // do this after the invalidateBuffer() call above, as it might trigger a
- // backing store sync, resulting in too many update requests.
- setClipRegion(region);
- }
-}
-
-static inline void flushUpdate(QWidget *widget, const QRegion &region,
- const QPoint &offset)
-{
-#ifdef QT_NO_PAINT_DEBUG
- Q_UNUSED(widget);
- Q_UNUSED(region);
- Q_UNUSED(offset);
-#else
- static int delay = -1;
-
- if (delay == -1)
- delay = qgetenv("QT_FLUSH_UPDATE").toInt() * 10;
-
- if (delay == 0)
- return;
-
- static QWSYellowSurface surface(true);
- surface.setDelay(delay);
- surface.flush(widget, region, offset);
-#endif // QT_NO_PAINT_DEBUG
-}
-
-void QWSWindowSurface::flush(QWidget *widget, const QRegion &region,
- const QPoint &offset)
-{
- const QWidget *win = window();
- if (!win)
- return;
-
-#ifndef QT_NO_GRAPHICSVIEW
- QWExtra *extra = win->d_func()->extra;
- if (extra && extra->proxyWidget)
- return;
-#endif //QT_NO_GRAPHICSVIEW
-
- Q_UNUSED(offset);
-
- const bool opaque = isOpaque();
-#ifdef QT_QWS_DISABLE_FLUSHCLIPPING
- QRegion toFlush = region;
-#else
- QRegion toFlush = region & d_ptr->clip;
-#endif
-
- if (!toFlush.isEmpty()) {
- flushUpdate(widget, toFlush, QPoint(0, 0));
- QPoint globalZero = win->mapToGlobal(QPoint(0, 0));
- toFlush.translate(globalZero);
-
-#ifdef QT_QWS_CLIENTBLIT
- bool needRepaint = true;
- if (opaque) {
- QScreen* widgetScreen = getScreen(widget);
- if (widgetScreen->supportsBlitInClients()) {
-
- QWSDisplay::grab();
- if(directRegion().intersected(toFlush) == toFlush) {
- QPoint translate = -globalZero + painterOffset() + geometry().topLeft();
- QRegion flushRegion = toFlush.translated(translate);
- widgetScreen->blit(image(), geometry().topLeft(), flushRegion);
- widgetScreen->setDirty(toFlush.boundingRect());
- needRepaint = false;
- }
- QWSDisplay::ungrab();
- }
- }
-
- if(needRepaint)
-#endif
- win->qwsDisplay()->repaintRegion(winId(), win->windowFlags(), opaque, toFlush);
- }
-}
-
-/*!
- Move the surface with the given \a offset.
-
- A subclass may reimplement this function to enable accelerated window move.
- It must return true if the move was successful and no repaint is necessary,
- false otherwise.
-
- The default implementation updates the QWindowSurface geometry and
- returns true if the surface is buffered; false otherwise.
-
- This function is called by the window system on the client instance.
-
- \sa isBuffered()
-*/
-bool QWSWindowSurface::move(const QPoint &offset)
-{
- QWindowSurface::setGeometry(geometry().translated(offset));
- return isBuffered();
-}
-
-/*!
- Move the surface with the given \a offset.
-
- The new visible region after the window move is given by \a newClip
- in screen coordinates.
-
- A subclass may reimplement this function to enable accelerated window move.
- The returned region indicates the area that still needs to be composed
- on the screen.
-
- The default implementation updates the QWindowSurface geometry and
- returns the union of the old and new geometry.
-
- This function is called by the window system on the server instance.
-*/
-QRegion QWSWindowSurface::move(const QPoint &offset, const QRegion &newClip)
-{
- const QRegion oldGeometry = geometry();
- QWindowSurface::setGeometry(geometry().translated(offset));
- return oldGeometry + newClip;
-}
-
-void QWSWindowSurface::releaseSurface()
-{
-}
-
-bool QWSMemorySurface::lock(int timeout)
-{
- Q_UNUSED(timeout);
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (memlock && !memlock->lock(QWSLock::BackingStore))
- return false;
-#endif
-#ifndef QT_NO_THREAD
- threadLock.lock();
-#endif
- return true;
-}
-
-void QWSMemorySurface::unlock()
-{
-#ifndef QT_NO_THREAD
- threadLock.unlock();
-#endif
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (memlock)
- memlock->unlock(QWSLock::BackingStore);
-#endif
-}
-
-QWSMemorySurface::QWSMemorySurface()
- : QWSWindowSurface()
-#ifndef QT_NO_QWS_MULTIPROCESS
- , memlock(0)
-#endif
-{
- setSurfaceFlags(Buffered);
-}
-
-QWSMemorySurface::QWSMemorySurface(QWidget *w)
- : QWSWindowSurface(w)
-{
- SurfaceFlags flags = Buffered;
- if (isWidgetOpaque(w))
- flags |= Opaque;
- setSurfaceFlags(flags);
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- memlock = QWSDisplay::Data::getClientLock();
-#endif
-}
-
-QWSMemorySurface::~QWSMemorySurface()
-{
-}
-
-
-QImage::Format
-QWSMemorySurface::preferredImageFormat(const QWidget *widget) const
-{
- QScreen *screen = getScreen(widget);
- const int depth = screen->depth();
- const bool opaque = isWidgetOpaque(widget);
-
- if (!opaque) {
- if (depth <= 12)
- return QImage::Format_ARGB4444_Premultiplied;
- else if (depth <= 15)
- return QImage::Format_ARGB8555_Premultiplied;
- else if (depth <= 16)
- return QImage::Format_ARGB8565_Premultiplied;
- else if (depth <= 18)
- return QImage::Format_ARGB6666_Premultiplied;
- else
- return QImage::Format_ARGB32_Premultiplied;
- }
-
- QImage::Format format = screen->pixelFormat();
- if (format > QImage::Format_Indexed8) // ### assumes all new image formats supports a QPainter
- return format;
-
- if (depth <= 12)
- return QImage::Format_RGB444;
- else if (depth <= 15)
- return QImage::Format_RGB555;
- else if (depth <= 16)
- return QImage::Format_RGB16;
- else if (depth <= 18)
- return QImage::Format_RGB666;
- else if (depth <= 24)
- return QImage::Format_RGB888;
- else
- return QImage::Format_ARGB32_Premultiplied;
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSMemorySurface::setLock(int lockId)
-{
- if (memlock && memlock->id() == lockId)
- return;
- delete memlock;
- memlock = (lockId == -1 ? 0 : new QWSLock(lockId));
- return;
-}
-#endif // QT_NO_QWS_MULTIPROCESS
-
-bool QWSMemorySurface::isValid() const
-{
- if (img.isNull())
- return true;
-
- const QWidget *win = window();
- if (preferredImageFormat(win) != img.format())
- return false;
-
- if (isOpaque() != isWidgetOpaque(win)) // XXX: use QWidgetPrivate::isOpaque()
- return false;
-
- return true;
-}
-
-// ### copied from qwindowsurface_raster.cpp -- should be cross-platform
-void QWSMemorySurface::beginPaint(const QRegion &rgn)
-{
- if (!isWidgetOpaque(window())) {
- QPainter p(&img);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = rgn.rects();
- const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- QRect r = *it;
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- r.translate(painterOffset());
-#endif
- p.fillRect(r, blank);
- }
- }
- QWSWindowSurface::beginPaint(rgn);
-}
-
-// from qwindowsurface.cpp
-extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
-
-bool QWSMemorySurface::scroll(const QRegion &area, int dx, int dy)
-{
- const QVector<QRect> rects = area.rects();
- for (int i = 0; i < rects.size(); ++i)
- qt_scrollRectInImage(img, rects.at(i), QPoint(dx, dy));
-
- return true;
-}
-
-QPoint QWSMemorySurface::painterOffset() const
-{
- const QWidget *w = window();
- if (!w)
- return QPoint();
-
- if (w->mask().isEmpty())
- return QWSWindowSurface::painterOffset();
-
- const QRegion region = w->mask()
- & w->frameGeometry().translated(-w->geometry().topLeft());
- return -region.boundingRect().topLeft();
-}
-
-QWSLocalMemSurface::QWSLocalMemSurface()
- : QWSMemorySurface(), mem(0), memsize(0)
-{
-}
-
-QWSLocalMemSurface::QWSLocalMemSurface(QWidget *w)
- : QWSMemorySurface(w), mem(0), memsize(0)
-{
-}
-
-QWSLocalMemSurface::~QWSLocalMemSurface()
-{
- if (memsize)
- delete[] mem;
-}
-
-void QWSLocalMemSurface::setGeometry(const QRect &rect)
-{
- QSize size = rect.size();
-
- QWidget *win = window();
- if (win && !win->mask().isEmpty()) {
- const QRegion region = win->mask()
- & rect.translated(-win->geometry().topLeft());
- size = region.boundingRect().size();
- }
-
- uchar *deleteLater = 0;
- // In case of a Hide event we need to delete the memory after sending the
- // event to the server in order to let the server animate the event.
- if (size.isEmpty()) {
- deleteLater = mem;
- mem = 0;
- }
-
- if (img.size() != size) {
- delete[] mem;
- if (size.isEmpty()) {
- mem = 0;
- img = QImage();
- } else {
- const QImage::Format format = preferredImageFormat(win);
- const int bpl = nextMulOf4(bytesPerPixel(format) * size.width());
- const int memsize = bpl * size.height();
- mem = new uchar[memsize];
- img = QImage(mem, size.width(), size.height(), bpl, format);
- setImageMetrics(img, win);
- }
- }
-
- QWSWindowSurface::setGeometry(rect);
- delete[] deleteLater;
-}
-
-QByteArray QWSLocalMemSurface::permanentState() const
-{
- QByteArray array;
- array.resize(sizeof(uchar*) + 3 * sizeof(int) +
- sizeof(SurfaceFlags));
-
- char *ptr = array.data();
-
- *reinterpret_cast<uchar**>(ptr) = mem;
- ptr += sizeof(uchar*);
-
- reinterpret_cast<int*>(ptr)[0] = img.width();
- reinterpret_cast<int*>(ptr)[1] = img.height();
- ptr += 2 * sizeof(int);
-
- *reinterpret_cast<int *>(ptr) = img.format();
- ptr += sizeof(int);
-
- *reinterpret_cast<SurfaceFlags*>(ptr) = surfaceFlags();
-
- return array;
-}
-
-void QWSLocalMemSurface::setPermanentState(const QByteArray &data)
-{
- int width;
- int height;
- QImage::Format format;
- SurfaceFlags flags;
-
- const char *ptr = data.constData();
-
- mem = *reinterpret_cast<uchar* const*>(ptr);
- ptr += sizeof(uchar*);
-
- width = reinterpret_cast<const int*>(ptr)[0];
- height = reinterpret_cast<const int*>(ptr)[1];
- ptr += 2 * sizeof(int);
-
- format = QImage::Format(*reinterpret_cast<const int*>(ptr));
- ptr += sizeof(int);
-
- flags = *reinterpret_cast<const SurfaceFlags*>(ptr);
-
- const int bpl = nextMulOf4(bytesPerPixel(format) * width);
- QWSMemorySurface::img = QImage(mem, width, height, bpl, format);
- setSurfaceFlags(flags);
-}
-
-void QWSLocalMemSurface::releaseSurface()
-{
- mem = 0;
- img = QImage();
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-QWSSharedMemSurface::QWSSharedMemSurface()
- : QWSMemorySurface()
-{
-}
-
-QWSSharedMemSurface::QWSSharedMemSurface(QWidget *widget)
- : QWSMemorySurface(widget)
-{
-}
-
-QWSSharedMemSurface::~QWSSharedMemSurface()
-{
- // mem.detach() is done automatically by ~QSharedMemory
-}
-
-bool QWSSharedMemSurface::setMemory(int memId)
-{
- if (mem.id() == memId)
- return true;
-
- mem.detach();
- if (!mem.attach(memId)) {
- perror("QWSSharedMemSurface: attaching to shared memory");
- qCritical("QWSSharedMemSurface: Error attaching to"
- " shared memory 0x%x", memId);
- return false;
- }
-
- return true;
-}
-
-#ifdef QT_QWS_CLIENTBLIT
-void QWSSharedMemSurface::setDirectRegion(const QRegion &r, int id)
-{
- QWSMemorySurface::setDirectRegion(r, id);
- if(mem.address())
- *(uint *)mem.address() = id;
-}
-
-const QRegion QWSSharedMemSurface::directRegion() const
-{
- QWSSharedMemory *cmem = const_cast<QWSSharedMemory *>(&mem);
- if (cmem->address() && ((int*)cmem->address())[0] == directRegionId())
- return QWSMemorySurface::directRegion();
- else
- return QRegion();
-}
-#endif
-
-void QWSSharedMemSurface::setPermanentState(const QByteArray &data)
-{
- int memId;
- int width;
- int height;
- int lockId;
- QImage::Format format;
- SurfaceFlags flags;
-
- const int *ptr = reinterpret_cast<const int*>(data.constData());
-
- memId = ptr[0];
- width = ptr[1];
- height = ptr[2];
- lockId = ptr[3];
- format = QImage::Format(ptr[4]);
- flags = SurfaceFlags(ptr[5]);
-
- setSurfaceFlags(flags);
- setMemory(memId);
- setLock(lockId);
-
-#ifdef QT_QWS_CLIENTBLIT
- uchar *base = static_cast<uchar*>(mem.address()) + sizeof(uint);
-#else
- uchar *base = static_cast<uchar*>(mem.address());
-#endif
- const int bpl = nextMulOf4(bytesPerPixel(format) * width);
- QWSMemorySurface::img = QImage(base, width, height, bpl, format);
-}
-
-void QWSSharedMemSurface::setGeometry(const QRect &rect)
-{
- const QSize size = rect.size();
- if (img.size() != size) {
- if (size.isEmpty()) {
- mem.detach();
- img = QImage();
- } else {
- mem.detach();
-
- QWidget *win = window();
- const QImage::Format format = preferredImageFormat(win);
- const int bpl = nextMulOf4(bytesPerPixel(format) * size.width());
-#ifdef QT_QWS_CLIENTBLIT
- const int imagesize = bpl * size.height() + sizeof(uint);
-#else
- const int imagesize = bpl * size.height();
-#endif
- if (!mem.create(imagesize)) {
- perror("QWSSharedMemSurface::setGeometry allocating shared memory");
- qFatal("Error creating shared memory of size %d", imagesize);
- }
-#ifdef QT_QWS_CLIENTBLIT
- *((uint *)mem.address()) = 0;
- uchar *base = static_cast<uchar*>(mem.address()) + sizeof(uint);
-#else
- uchar *base = static_cast<uchar*>(mem.address());
-#endif
- img = QImage(base, size.width(), size.height(), bpl, format);
- setImageMetrics(img, win);
- }
- }
-
- QWSWindowSurface::setGeometry(rect);
-}
-
-QByteArray QWSSharedMemSurface::permanentState() const
-{
- QByteArray array;
- array.resize(6 * sizeof(int));
-
- int *ptr = reinterpret_cast<int*>(array.data());
-
- ptr[0] = mem.id();
- ptr[1] = img.width();
- ptr[2] = img.height();
- ptr[3] = (memlock ? memlock->id() : -1);
- ptr[4] = int(img.format());
- ptr[5] = int(surfaceFlags());
-
- return array;
-}
-
-void QWSSharedMemSurface::releaseSurface()
-{
- mem.detach();
- img = QImage();
-}
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
-#ifndef QT_NO_PAINTONSCREEN
-
-QWSOnScreenSurface::QWSOnScreenSurface(QWidget *w)
- : QWSMemorySurface(w)
-{
- attachToScreen(getScreen(w));
- setSurfaceFlags(Opaque);
-}
-
-QWSOnScreenSurface::QWSOnScreenSurface()
- : QWSMemorySurface()
-{
- setSurfaceFlags(Opaque);
-}
-
-void QWSOnScreenSurface::attachToScreen(const QScreen *s)
-{
- screen = s;
- uchar *base = screen->base();
- QImage::Format format = screen->pixelFormat();
-
- if (format == QImage::Format_Invalid || format == QImage::Format_Indexed8) {
- //### currently we have no paint engine for indexed image formats
- qFatal("QWSOnScreenSurface::attachToScreen(): screen depth %d "
- "not implemented", screen->depth());
- return;
- }
- QWSMemorySurface::img = QImage(base, screen->width(), screen->height(),
- screen->linestep(), format );
-}
-
-QWSOnScreenSurface::~QWSOnScreenSurface()
-{
-}
-
-QPoint QWSOnScreenSurface::painterOffset() const
-{
- return geometry().topLeft() + QWSWindowSurface::painterOffset();
-}
-
-bool QWSOnScreenSurface::isValid() const
-{
- const QWidget *win = window();
- if (screen != getScreen(win))
- return false;
- if (img.isNull())
- return false;
- return QScreen::isWidgetPaintOnScreen(win);
-}
-
-QByteArray QWSOnScreenSurface::permanentState() const
-{
- QByteArray array;
- array.resize(sizeof(int));
- int *ptr = reinterpret_cast<int*>(array.data());
- ptr[0] = QApplication::desktop()->screenNumber(window());
- return array;
-}
-
-void QWSOnScreenSurface::setPermanentState(const QByteArray &data)
-{
- const int *ptr = reinterpret_cast<const int*>(data.constData());
- const int screenNo = ptr[0];
-
- QScreen *screen = qt_screen;
- if (screenNo > 0)
- screen = qt_screen->subScreens().at(screenNo);
- attachToScreen(screen);
-}
-
-#endif // QT_NO_PAINTONSCREEN
-
-#ifndef QT_NO_PAINT_DEBUG
-
-QWSYellowSurface::QWSYellowSurface(bool isClient)
- : QWSWindowSurface(), delay(10)
-{
- if (isClient) {
- setWinId(QWidget::qwsDisplay()->takeId());
- QWidget::qwsDisplay()->nameRegion(winId(),
- QLatin1String("Debug flush paint"),
- QLatin1String("Silly yellow thing"));
- QWidget::qwsDisplay()->setAltitude(winId(), 1, true);
- }
- setSurfaceFlags(Buffered);
-}
-
-QWSYellowSurface::~QWSYellowSurface()
-{
-}
-
-QByteArray QWSYellowSurface::permanentState() const
-{
- QByteArray array;
- array.resize(2 * sizeof(int));
-
- int *ptr = reinterpret_cast<int*>(array.data());
- ptr[0] = surfaceSize.width();
- ptr[1] = surfaceSize.height();
-
- return array;
-}
-
-void QWSYellowSurface::setPermanentState(const QByteArray &data)
-{
- const int *ptr = reinterpret_cast<const int*>(data.constData());
-
- const int width = ptr[0];
- const int height = ptr[1];
-
- img = QImage(width, height, QImage::Format_ARGB32);
- img.fill(qRgba(255,255,31,127));
-}
-
-void QWSYellowSurface::flush(QWidget *widget, const QRegion &region,
- const QPoint &offset)
-{
- Q_UNUSED(offset);
-
- QWSDisplay *display = QWidget::qwsDisplay();
- QRegion rgn = region;
-
- if (widget)
- rgn.translate(widget->mapToGlobal(QPoint(0, 0)));
-
- surfaceSize = region.boundingRect().size();
-
- const int id = winId();
- display->requestRegion(id, key(), permanentState(), rgn);
- display->setAltitude(id, 1, true);
- display->repaintRegion(id, 0, false, rgn);
-
- ::usleep(500 * delay);
- display->requestRegion(id, key(), permanentState(), QRegion());
- ::usleep(500 * delay);
-}
-
-#endif // QT_NO_PAINT_DEBUG
-
-#ifndef QT_NO_DIRECTPAINTER
-
-static inline QScreen *getPrimaryScreen()
-{
- QScreen *screen = QScreen::instance();
- if (!screen->base()) {
- QList<QScreen*> subScreens = screen->subScreens();
- if (subScreens.size() < 1)
- return 0;
- screen = subScreens.at(0);
- }
- return screen;
-}
-
-QWSDirectPainterSurface::QWSDirectPainterSurface(bool isClient,
- QDirectPainter::SurfaceFlag flags)
- : QWSWindowSurface(), flushingRegionEvents(false), doLocking(false)
-{
- setSurfaceFlags(Opaque);
- synchronous = (flags == QDirectPainter::ReservedSynchronous);
-
- if (isClient) {
- setWinId(QWidget::qwsDisplay()->takeId());
- QWidget::qwsDisplay()->nameRegion(winId(),
- QLatin1String("QDirectPainter reserved space"),
- QLatin1String("reserved"));
- } else {
- setWinId(0);
- }
- _screen = QScreen::instance();
- if (!_screen->base()) {
- QList<QScreen*> subScreens = _screen->subScreens();
- if (subScreens.size() < 1)
- _screen = 0;
- else
- _screen = subScreens.at(0);
- }
-}
-
-QWSDirectPainterSurface::~QWSDirectPainterSurface()
-{
- if (winId() && QWSDisplay::instance()) // make sure not in QApplication destructor
- QWidget::qwsDisplay()->destroyRegion(winId());
-}
-
-void QWSDirectPainterSurface::setRegion(const QRegion &region)
-{
- const int id = winId();
- QWidget::qwsDisplay()->requestRegion(id, key(), permanentState(), region);
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (synchronous)
- QWSDisplay::instance()->d->waitForRegionAck(id);
-#endif
-}
-
-void QWSDirectPainterSurface::flush(QWidget *, const QRegion &r, const QPoint &)
-{
- QWSDisplay::instance()->repaintRegion(winId(), 0, true, r);
-}
-
-QByteArray QWSDirectPainterSurface::permanentState() const
-{
- QByteArray res;
- if (isRegionReserved())
- res.append( 'r');
- return res;
-}
-
-void QWSDirectPainterSurface::setPermanentState(const QByteArray &ba)
-{
- if (ba.size() > 0 && ba.at(0) == 'r')
- setReserved();
- setSurfaceFlags(surfaceFlags() | Opaque);
-}
-
-void QWSDirectPainterSurface::beginPaint(const QRegion &region)
-{
- QWSWindowSurface::beginPaint(region);
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (!synchronous) {
- flushingRegionEvents = true;
- QWSDisplay::instance()->d->waitForRegionEvents(winId(), doLocking);
- flushingRegionEvents = false;
- }
-#endif
-}
-
-bool QWSDirectPainterSurface::hasPendingRegionEvents() const
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- if (synchronous)
- return false;
-
- return QWSDisplay::instance()->d->hasPendingRegionEvents();
-#else
- return false;
-#endif
-}
-
-bool QWSDirectPainterSurface::lock(int timeout)
-{
-#ifndef QT_NO_THREAD
- threadLock.lock();
-#endif
- Q_UNUSED(timeout);
- if (doLocking)
- QWSDisplay::grab(true);
- return true;
-}
-
-void QWSDirectPainterSurface::unlock()
-{
- if (doLocking)
- QWSDisplay::ungrab();
-#ifndef QT_NO_THREAD
- threadLock.unlock();
-#endif
-}
-
-#endif // QT_NO_DIRECTPAINTER
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qwindowsurface_qws_p.h b/src/gui/painting/qwindowsurface_qws_p.h
deleted file mode 100644
index fd56c814a3..0000000000
--- a/src/gui/painting/qwindowsurface_qws_p.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSURFACE_QWS_P_H
-#define QWINDOWSURFACE_QWS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwindowsurface_p.h"
-#include <qregion.h>
-#include <qimage.h>
-#include <qdirectpainter_qws.h>
-#include <qmutex.h>
-#include <private/qwssharedmemory_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QScreen;
-class QWSWindowSurfacePrivate;
-
-class Q_GUI_EXPORT QWSWindowSurface : public QWindowSurface
-{
-public:
- QWSWindowSurface();
- QWSWindowSurface(QWidget *widget);
- ~QWSWindowSurface();
-
- virtual bool isValid() const = 0;
-
- virtual void setGeometry(const QRect &rect);
- virtual void setGeometry(const QRect &rect, const QRegion &mask);
- virtual void flush(QWidget *widget, const QRegion &region,
- const QPoint &offset);
-
- virtual bool move(const QPoint &offset);
- virtual QRegion move(const QPoint &offset, const QRegion &newClip);
-
- virtual QPoint painterOffset() const; // remove!!!
-
- virtual void beginPaint(const QRegion &);
- virtual void endPaint(const QRegion &);
-
- virtual bool lock(int timeout = -1);
- virtual void unlock();
-
- virtual QString key() const = 0;
-
- // XXX: not good enough
- virtual QByteArray transientState() const;
- virtual QByteArray permanentState() const;
- virtual void setTransientState(const QByteArray &state);
- virtual void setPermanentState(const QByteArray &state);
-
- virtual QImage image() const = 0;
- virtual QPaintDevice *paintDevice() = 0;
-
- const QRegion clipRegion() const;
- void setClipRegion(const QRegion &);
-
-#ifdef QT_QWS_CLIENTBLIT
- virtual const QRegion directRegion() const;
- virtual int directRegionId() const;
- virtual void setDirectRegion(const QRegion &, int);
-#endif
-
- enum SurfaceFlag {
- RegionReserved = 0x1,
- Buffered = 0x2,
- Opaque = 0x4
- };
- Q_DECLARE_FLAGS(SurfaceFlags, SurfaceFlag)
-
- SurfaceFlags surfaceFlags() const;
-
- inline bool isRegionReserved() const {
- return surfaceFlags() & RegionReserved;
- }
- inline bool isBuffered() const { return surfaceFlags() & Buffered; }
- inline bool isOpaque() const { return surfaceFlags() & Opaque; }
-
- int winId() const;
- virtual void releaseSurface();
-
-protected:
- void setSurfaceFlags(SurfaceFlags type);
- void setWinId(int id);
-
-private:
- friend class QWidgetPrivate;
-
- void invalidateBuffer();
-
- QWSWindowSurfacePrivate *d_ptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QWSWindowSurface::SurfaceFlags)
-
-class QWSWindowSurfacePrivate
-{
-public:
- QWSWindowSurfacePrivate();
-
- void setWinId(int id);
-
- QWSWindowSurface::SurfaceFlags flags;
- QRegion clip;
-#ifdef QT_QWS_CLIENTBLIT
- QRegion direct;
- int directId;
-#endif
-
- int winId;
-};
-
-class QWSLock;
-
-class Q_GUI_EXPORT QWSMemorySurface : public QWSWindowSurface
-{
-public:
- QWSMemorySurface();
- QWSMemorySurface(QWidget *widget);
- ~QWSMemorySurface();
-
- bool isValid() const;
-
- QPaintDevice *paintDevice() { return &img; }
- bool scroll(const QRegion &area, int dx, int dy);
-
- QImage image() const { return img; }
- QPoint painterOffset() const;
-
- void beginPaint(const QRegion &rgn);
-
- bool lock(int timeout = -1);
- void unlock();
-
-protected:
- QImage::Format preferredImageFormat(const QWidget *widget) const;
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- void setLock(int lockId);
- QWSLock *memlock;
-#endif
-#ifndef QT_NO_THREAD
- QMutex threadLock;
-#endif
-
- QImage img;
-};
-
-class Q_GUI_EXPORT QWSLocalMemSurface : public QWSMemorySurface
-{
-public:
- QWSLocalMemSurface();
- QWSLocalMemSurface(QWidget *widget);
- ~QWSLocalMemSurface();
-
- void setGeometry(const QRect &rect);
-
- QString key() const { return QLatin1String("mem"); }
- QByteArray permanentState() const;
-
- void setPermanentState(const QByteArray &data);
- virtual void releaseSurface();
-protected:
- uchar *mem;
- int memsize;
-};
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-class Q_GUI_EXPORT QWSSharedMemSurface : public QWSMemorySurface
-{
-public:
- QWSSharedMemSurface();
- QWSSharedMemSurface(QWidget *widget);
- ~QWSSharedMemSurface();
-
- void setGeometry(const QRect &rect);
-
- QString key() const { return QLatin1String("shm"); }
- QByteArray permanentState() const;
-
- void setPermanentState(const QByteArray &data);
-
-#ifdef QT_QWS_CLIENTBLIT
- virtual void setDirectRegion(const QRegion &, int);
- virtual const QRegion directRegion() const;
-#endif
- virtual void releaseSurface();
-
-private:
- bool setMemory(int memId);
-
- QWSSharedMemory mem;
-};
-#endif // QT_NO_QWS_MULTIPROCESS
-
-#ifndef QT_NO_PAINTONSCREEN
-class Q_GUI_EXPORT QWSOnScreenSurface : public QWSMemorySurface
-{
-public:
- QWSOnScreenSurface();
- QWSOnScreenSurface(QWidget *widget);
- ~QWSOnScreenSurface();
-
- bool isValid() const;
- QPoint painterOffset() const;
-
- QString key() const { return QLatin1String("OnScreen"); }
- QByteArray permanentState() const;
-
- void setPermanentState(const QByteArray &data);
-
-private:
- void attachToScreen(const QScreen *screen);
-
- const QScreen *screen;
-};
-#endif // QT_NO_PAINTONSCREEN
-
-#ifndef QT_NO_PAINT_DEBUG
-class Q_GUI_EXPORT QWSYellowSurface : public QWSWindowSurface
-{
-public:
- QWSYellowSurface(bool isClient = false);
- ~QWSYellowSurface();
-
- void setDelay(int msec) { delay = msec; }
-
- bool isValid() const { return true; }
-
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
-
- QString key() const { return QLatin1String("Yellow"); }
- QByteArray permanentState() const;
-
- void setPermanentState(const QByteArray &data);
-
- QPaintDevice *paintDevice() { return &img; }
- QImage image() const { return img; }
-
-private:
- int delay;
- QSize surfaceSize; // client side
- QImage img; // server side
-};
-#endif // QT_NO_PAINT_DEBUG
-
-#ifndef QT_NO_DIRECTPAINTER
-
-class QScreen;
-
-class Q_GUI_EXPORT QWSDirectPainterSurface : public QWSWindowSurface
-{
-public:
- QWSDirectPainterSurface(bool isClient = false,
- QDirectPainter::SurfaceFlag flags = QDirectPainter::NonReserved);
- ~QWSDirectPainterSurface();
-
- void setReserved() { setSurfaceFlags(RegionReserved); }
-
- void setGeometry(const QRect &rect) { setRegion(rect); }
-
- void setRegion(const QRegion &region);
- QRegion region() const { return clipRegion(); }
-
- void flush(QWidget*, const QRegion &, const QPoint &);
-
- bool isValid() const { return false; }
-
- QString key() const { return QLatin1String("DirectPainter"); }
- QByteArray permanentState() const;
-
- void setPermanentState(const QByteArray &);
-
- QImage image() const { return QImage(); }
- QPaintDevice *paintDevice() { return 0; }
-
- // hw: get rid of this
- WId windowId() const { return static_cast<WId>(winId()); }
-
- QScreen *screen() const { return _screen; }
-
- void beginPaint(const QRegion &);
- bool lock(int timeout = -1);
- void unlock();
-
- void setLocking(bool b) { doLocking = b; }
-
- bool hasPendingRegionEvents() const;
-
-private:
- QScreen *_screen;
-#ifndef QT_NO_THREAD
- QMutex threadLock;
-#endif
-
- friend void qt_directpainter_region(QDirectPainter*, const QRegion&, int);
- bool flushingRegionEvents;
- bool synchronous;
- bool doLocking;
-};
-
-#endif // QT_NO_DIRECTPAINTER
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSURFACE_QWS_P_H
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
deleted file mode 100644
index 9860841640..0000000000
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ /dev/null
@@ -1,487 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qdebug.h>
-
-#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
-#ifdef Q_WS_WIN
-#include <qlibrary.h>
-#include <qt_windows.h>
-#endif
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qwidget.h>
-
-#include "private/qwindowsurface_raster_p.h"
-#include "private/qnativeimage_p.h"
-#include "private/qwidget_p.h"
-
-#ifdef Q_WS_X11
-#include "private/qpixmap_x11_p.h"
-#include "private/qt_x11_p.h"
-#include "private/qwidget_p.h"
-#include "qx11info_x11.h"
-#endif
-#include "private/qdrawhelper_p.h"
-
-#ifdef Q_WS_MAC
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <QMainWindow>
-#include <private/qmainwindowlayout_p.h>
-#include <QToolBar>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QRasterWindowSurfacePrivate
-{
-public:
- QNativeImage *image;
-
-#ifdef Q_WS_X11
- GC gc;
-#ifndef QT_NO_MITSHM
- uint needsSync : 1;
-#endif
-#ifndef QT_NO_XRENDER
- uint translucentBackground : 1;
-#endif
-#endif
- uint inSetGeometry : 1;
-};
-
-QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurface)
- : QWindowSurface(window, setDefaultSurface), d_ptr(new QRasterWindowSurfacePrivate)
-{
-#ifdef Q_WS_X11
- d_ptr->gc = XCreateGC(X11->display, window->handle(), 0, 0);
-#ifndef QT_NO_XRENDER
- d_ptr->translucentBackground = X11->use_xrender
- && window->x11Info().depth() == 32;
-#endif
-#ifndef QT_NO_MITHSM
- d_ptr->needsSync = false;
-#endif
-#endif
- d_ptr->image = 0;
- d_ptr->inSetGeometry = false;
-
-#ifdef QT_MAC_USE_COCOA
- needsFlush = false;
- regionToFlush = QRegion();
-#endif // QT_MAC_USE_COCOA
-}
-
-
-QRasterWindowSurface::~QRasterWindowSurface()
-{
-#ifdef Q_WS_X11
- XFreeGC(X11->display, d_ptr->gc);
-#endif
- if (d_ptr->image)
- delete d_ptr->image;
-}
-
-
-QPaintDevice *QRasterWindowSurface::paintDevice()
-{
- return &d_ptr->image->image;
-}
-
-#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
-void QRasterWindowSurface::syncX()
-{
- // delay writing to the backbuffer until we know for sure X is done reading from it
- if (d_ptr->needsSync) {
- XSync(X11->display, false);
- d_ptr->needsSync = false;
- }
-}
-#endif
-
-void QRasterWindowSurface::beginPaint(const QRegion &rgn)
-{
-#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
- syncX();
-#endif
-
-#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
- if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) {
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied)
- prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
-#endif
- QPainter p(&d_ptr->image->image);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = rgn.rects();
- const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- p.fillRect(*it, blank);
- }
- }
-#else
- Q_UNUSED(rgn);
-#endif
-}
-
-void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
-{
- Q_D(QRasterWindowSurface);
-
- // Not ready for painting yet, bail out. This can happen in
- // QWidget::create_sys()
- if (!d->image || rgn.rectCount() == 0)
- return;
-
-#ifdef Q_WS_WIN
- QRect br = rgn.boundingRect();
-
-#ifndef Q_WS_WINCE
- if (!qt_widget_private(window())->isOpaque
- && window()->testAttribute(Qt::WA_TranslucentBackground)
- && (qt_widget_private(window())->data.window_flags & Qt::FramelessWindowHint))
- {
- QRect r = window()->frameGeometry();
- QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft();
- QRect dirtyRect = br.translated(offset + frameOffset);
-
- SIZE size = {r.width(), r.height()};
- POINT ptDst = {r.x(), r.y()};
- POINT ptSrc = {0, 0};
- BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA};
- RECT dirty = {dirtyRect.x(), dirtyRect.y(),
- dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
- Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty};
- ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info);
- } else
-#endif
- {
- QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
-
- HDC widget_dc = widget->getDC();
-
- QRect wbr = br.translated(-wOffset);
- BitBlt(widget_dc, wbr.x(), wbr.y(), wbr.width(), wbr.height(),
- d->image->hdc, br.x() + offset.x(), br.y() + offset.y(), SRCCOPY);
- widget->releaseDC(widget_dc);
- }
-
-#ifndef QT_NO_DEBUG
- static bool flush = !qgetenv("QT_FLUSH_WINDOWSURFACE").isEmpty();
- if (flush) {
- SelectObject(qt_win_display_dc(), GetStockObject(BLACK_BRUSH));
- Rectangle(qt_win_display_dc(), 0, 0, d->image->width() + 2, d->image->height() + 2);
- BitBlt(qt_win_display_dc(), 1, 1, d->image->width(), d->image->height(),
- d->image->hdc, 0, 0, SRCCOPY);
- }
-#endif
-
-#endif
-
-#ifdef Q_WS_X11
- extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp
- extern QWidgetData* qt_widget_data(QWidget *);
- QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
-
- if (widget->window() != window()) {
- XFreeGC(X11->display, d_ptr->gc);
- d_ptr->gc = XCreateGC(X11->display, widget->handle(), 0, 0);
- }
-
- QRegion wrgn(rgn);
- if (!wOffset.isNull())
- wrgn.translate(-wOffset);
- QRect wbr = wrgn.boundingRect();
-
- if (wrgn.rectCount() != 1) {
- int num;
- XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
- XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded);
- }
-
- QRect br = rgn.boundingRect().translated(offset);
-#ifndef QT_NO_MITSHM
- if (d_ptr->image->xshmpm) {
- XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
- br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y());
- d_ptr->needsSync = true;
- } else if (d_ptr->image->xshmimg) {
- const QImage &src = d->image->image;
- br = br.intersected(src.rect());
- XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg,
- br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False);
- d_ptr->needsSync = true;
- } else
-#endif
- {
- const QImage &src = d->image->image;
- br = br.intersected(src.rect());
- if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) {
- Q_ASSERT(src.depth() >= 16);
- const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8),
- br.width(), br.height(), src.bytesPerLine(), src.format());
- QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType);
- data->xinfo = widget->x11Info();
- data->fromImage(sub_src, Qt::NoOpaqueDetection);
- QPixmap pm = QPixmap(data);
- XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wbr.x(), wbr.y());
- } else {
- // qpaintengine_x11.cpp
- extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth);
- qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
- }
- }
-
- if (wrgn.rectCount() != 1)
- XSetClipMask(X11->display, d_ptr->gc, XNone);
-#endif // FALCON
-
-#ifdef Q_WS_MAC
-
- Q_UNUSED(offset);
-
- // This is mainly done for native components like native "open file" dialog.
- if (widget->testAttribute(Qt::WA_DontShowOnScreen)) {
- return;
- }
-
-#ifdef QT_MAC_USE_COCOA
-
- this->needsFlush = true;
- this->regionToFlush += rgn;
-
- // The actual flushing will be processed in [view drawRect:rect]
- qt_mac_setNeedsDisplay(widget);
-
-#else
- // Get a context for the widget.
- CGContextRef context;
- CGrafPtr port = GetWindowPort(qt_mac_window_for(widget));
- QDBeginCGContext(port, &context);
- CGContextRetain(context);
- CGContextSaveGState(context);
-
- // Flip context.
- CGContextTranslateCTM(context, 0, widget->height());
- CGContextScaleCTM(context, 1, -1);
-
- // Clip to region.
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect &rect = rects.at(i);
- CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
- }
- CGContextClip(context);
-
- QRect r = rgn.boundingRect();
- const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height());
- CGImageRef image = CGBitmapContextCreateImage(d->image->cg);
- CGImageRef subImage = CGImageCreateWithImageInRect(image, area);
-
- qt_mac_drawCGImage(context, &area, subImage);
-
- CGImageRelease(subImage);
- CGImageRelease(image);
-
- QDEndCGContext(port, &context);
-
- // Restore context.
- CGContextRestoreGState(context);
- CGContextRelease(context);
-#endif // QT_MAC_USE_COCOA
-
-#endif // Q_WS_MAC
-
-#ifdef Q_OS_SYMBIAN
- Q_UNUSED(widget);
- Q_UNUSED(rgn);
- Q_UNUSED(offset);
-#endif
-}
-
-void QRasterWindowSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
- Q_D(QRasterWindowSurface);
- d->inSetGeometry = true;
- if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) {
-#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
-#ifndef Q_WS_WIN
- if (d_ptr->translucentBackground)
-#else
- if (!qt_widget_private(window())->isOpaque)
-#endif
- prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
- else
-#endif
- prepareBuffer(QNativeImage::systemFormat(), window());
- }
- d->inSetGeometry = false;
-
-#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- QMainWindow* mWindow = qobject_cast<QMainWindow*>(window());
- if (mWindow) {
- QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
- QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList;
-
- for (int i = 0; i < toolbarList.size(); ++i) {
- QToolBar* toolbar = toolbarList.at(i);
- if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) {
- QWidget* tbWidget = (QWidget*) toolbar;
- if (tbWidget->d_func()->unifiedSurface) {
- tbWidget->d_func()->unifiedSurface->setGeometry(rect);
- }
- }
- }
- }
-#endif // Q_WS_MAC && QT_MAC_USE_COCOA
-
-}
-
-// from qwindowsurface.cpp
-extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
-
-bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
-#ifdef Q_WS_WIN
- Q_D(QRasterWindowSurface);
-
- if (!d->image || !d->image->hdc)
- return false;
-
- QRect rect = area.boundingRect();
- BitBlt(d->image->hdc, rect.x()+dx, rect.y()+dy, rect.width(), rect.height(),
- d->image->hdc, rect.x(), rect.y(), SRCCOPY);
-
- return true;
-#else
- Q_D(QRasterWindowSurface);
-
- if (!d->image || d->image->image.isNull())
- return false;
-
-#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
- syncX();
-#endif
-
- const QVector<QRect> rects = area.rects();
- for (int i = 0; i < rects.size(); ++i)
- qt_scrollRectInImage(d->image->image, rects.at(i), QPoint(dx, dy));
-
- return true;
-#endif
-}
-
-QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const
-{
- return QWindowSurface::AllFeatures;
-}
-
-void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget)
-{
- Q_D(QRasterWindowSurface);
-
- int width = window()->width();
- int height = window()->height();
- if (d->image) {
- width = qMax(d->image->width(), width);
- height = qMax(d->image->height(), height);
- }
-
- if (width == 0 || height == 0) {
- delete d->image;
- d->image = 0;
- return;
- }
-
- QNativeImage *oldImage = d->image;
-
- d->image = new QNativeImage(width, height, format, false, widget);
-
- if (oldImage && d->inSetGeometry && hasStaticContents()) {
- // Make sure we use the const version of bits() (no detach).
- const uchar *src = const_cast<const QImage &>(oldImage->image).bits();
- uchar *dst = d->image->image.bits();
-
- const int srcBytesPerLine = oldImage->image.bytesPerLine();
- const int dstBytesPerLine = d->image->image.bytesPerLine();
- const int bytesPerPixel = oldImage->image.depth() >> 3;
-
- QRegion staticRegion(staticContents());
- // Make sure we're inside the boundaries of the old image.
- staticRegion &= QRect(0, 0, oldImage->image.width(), oldImage->image.height());
- const QVector<QRect> &rects = staticRegion.rects();
- const QRect *srcRect = rects.constData();
-
- // Copy the static content of the old image into the new one.
- int numRectsLeft = rects.size();
- do {
- const int bytesOffset = srcRect->x() * bytesPerPixel;
- const int dy = srcRect->y();
-
- // Adjust src and dst to point to the right offset.
- const uchar *s = src + dy * srcBytesPerLine + bytesOffset;
- uchar *d = dst + dy * dstBytesPerLine + bytesOffset;
- const int numBytes = srcRect->width() * bytesPerPixel;
-
- int numScanLinesLeft = srcRect->height();
- do {
- ::memcpy(d, s, numBytes);
- d += dstBytesPerLine;
- s += srcBytesPerLine;
- } while (--numScanLinesLeft);
-
- ++srcRect;
- } while (--numRectsLeft);
- }
-
- delete oldImage;
-}
-
-#ifdef QT_MAC_USE_COCOA
-CGContextRef QRasterWindowSurface::imageContext()
-{
- Q_D(QRasterWindowSurface);
- return d->image->cg;
-}
-#endif // QT_MAC_USE_COCOA
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h
deleted file mode 100644
index 06abcd3a4a..0000000000
--- a/src/gui/painting/qwindowsurface_raster_p.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSURFACE_RASTER_P_H
-#define QWINDOWSURFACE_RASTER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-#include "private/qwindowsurface_p.h"
-
-#ifdef QT_MAC_USE_COCOA
-# include <private/qt_cocoa_helpers_mac_p.h>
-#endif // QT_MAC_USE_COCOA
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_WS_WIN
-#define Q_WS_EX_LAYERED 0x00080000 // copied from WS_EX_LAYERED in winuser.h
-#define Q_LWA_ALPHA 0x00000002 // copied from LWA_ALPHA in winuser.h
-#define Q_ULW_ALPHA 0x00000002 // copied from ULW_ALPHA in winuser.h
-#define Q_AC_SRC_ALPHA 0x00000001 // copied from AC_SRC_ALPHA in winuser.h
-
-struct Q_UPDATELAYEREDWINDOWINFO {
- DWORD cbSize;
- HDC hdcDst;
- const POINT *pptDst;
- const SIZE *psize;
- HDC hdcSrc;
- const POINT *pptSrc;
- COLORREF crKey;
- const BLENDFUNCTION *pblend;
- DWORD dwFlags;
- const RECT *prcDirty;
-};
-
-typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst,
- const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey,
- const BLENDFUNCTION *pblend, DWORD dwflags);
-typedef BOOL (WINAPI *PtrUpdateLayeredWindowIndirect)(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *pULWInfo);
-extern PtrUpdateLayeredWindow ptrUpdateLayeredWindow;
-extern PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect;
-#endif
-
-class QPaintDevice;
-class QPoint;
-class QRegion;
-class QRegion;
-class QSize;
-class QWidget;
-class QRasterWindowSurfacePrivate;
-class QNativeImage;
-
-class Q_GUI_EXPORT QRasterWindowSurface : public QWindowSurface
-{
-public:
- QRasterWindowSurface(QWidget *widget, bool setDefaultSurface = true);
- ~QRasterWindowSurface();
-
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void beginPaint(const QRegion &rgn);
- void setGeometry(const QRect &rect);
- bool scroll(const QRegion &area, int dx, int dy);
- WindowSurfaceFeatures features() const;
-
-#ifdef QT_MAC_USE_COCOA
- CGContextRef imageContext();
-
- bool needsFlush;
- QRegion regionToFlush;
-#endif // QT_MAC_USE_COCOA
-
-private:
-#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
- void syncX();
-#endif
- void prepareBuffer(QImage::Format format, QWidget *widget);
- Q_DECLARE_PRIVATE(QRasterWindowSurface)
- QScopedPointer<QRasterWindowSurfacePrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSURFACE_RASTER_P_H
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
deleted file mode 100644
index 9fa01edf7d..0000000000
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
-
-#include <QtGui/qpaintdevice.h>
-#include <private/qwidget_p.h>
-#include <private/qwindowsurface_s60_p.h>
-#include <private/qpixmap_s60_p.h>
-#include <private/qt_s60_p.h>
-#include <private/qapplication_p.h>
-#include <private/qdrawhelper_p.h>
-
-#ifdef QT_GRAPHICSSYSTEM_RUNTIME
-#include <private/qgraphicssystem_runtime_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-struct QS60WindowSurfacePrivate
-{
- QPixmap device;
- QList<QImage*> bufferImages;
-};
-
-TDisplayMode displayMode(bool opaque)
-{
- TDisplayMode mode = S60->screenDevice()->DisplayMode();
- if (opaque) {
- mode = EColor16MU;
- } else {
- if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3)
- mode = Q_SYMBIAN_ECOLOR16MAP; // Symbian^3 WServ has support for ARGB32_PRE
- else
- mode = EColor16MA; // Symbian prior to Symbian^3 sw accelerates EColor16MA
- }
- return mode;
-}
-
-bool blitWriteAlpha(QWidgetPrivate *widgetPrivate)
-{
- QWExtra *extra = widgetPrivate->extraData();
- return extra ? extra->nativePaintMode == QWExtra::BlitWriteAlpha : false;
-}
-
-QS60WindowSurface::QS60WindowSurface(QWidget* widget)
- : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
-{
- QWidgetPrivate *widgetPrivate = qt_widget_private(widget);
- const bool opaque = widgetPrivate->isOpaque && !blitWriteAlpha(widgetPrivate);
- TDisplayMode mode = displayMode(opaque);
- // We create empty CFbsBitmap here -> it will be resized in setGeometry
- CFbsBitmap *bitmap = new CFbsBitmap; // CBase derived object needs check on new
- Q_CHECK_PTR(bitmap);
- qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
-
- QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
- if (data) {
- data->fromSymbianBitmap(bitmap, true);
- d_ptr->device = QPixmap(data);
- }
-}
-
-QS60WindowSurface::~QS60WindowSurface()
-{
-#if defined(QT_GRAPHICSSYSTEM_RUNTIME) && defined(Q_SYMBIAN_SUPPORTS_SURFACES)
- if(QApplicationPrivate::runtime_graphics_system) {
- QRuntimeGraphicsSystem *runtimeGraphicsSystem =
- static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system);
- if(runtimeGraphicsSystem->graphicsSystemName() == QLatin1String("openvg")) {
-
- // Graphics system has been switched from raster to openvg.
- // Issue empty redraw to clear the UI surface
-
- QWidget *w = window();
- if (w->testAttribute(Qt::WA_WState_Created)) {
- RWindow *const window = static_cast<RWindow *>(w->winId()->DrawableWindow());
- window->BeginRedraw();
- window->EndRedraw();
- }
- }
- }
-#endif
-
- delete d_ptr;
-}
-
-void QS60WindowSurface::beginPaint(const QRegion &rgn)
-{
-#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
- S60->wsSession().Finish();
-#endif
-
- QWidgetPrivate *windowPrivate = qt_widget_private(window());
- if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) {
- QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data());
-
- TDisplayMode mode = displayMode(false);
- if (pixmapData->cfbsBitmap->DisplayMode() != mode)
- pixmapData->convertToDisplayMode(mode);
-
- pixmapData->beginDataAccess();
-
- if (!windowPrivate->isOpaque) {
- QPainter p(&pixmapData->image);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = rgn.rects();
- const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- p.fillRect(*it, blank);
- }
- }
-
- pixmapData->endDataAccess();
- }
-}
-
-void QS60WindowSurface::endPaint(const QRegion &)
-{
- qDeleteAll(d_ptr->bufferImages);
- d_ptr->bufferImages.clear();
-}
-
-QImage* QS60WindowSurface::buffer(const QWidget *widget)
-{
- if (widget->window() != window())
- return 0;
-
- QPaintDevice *pdev = paintDevice();
- if (!pdev)
- return 0;
-
- const QPoint off = offset(widget);
- QImage *img = &(static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image);
-
- QRect rect(off, widget->size());
- rect &= QRect(QPoint(), img->size());
-
- if (rect.isEmpty())
- return 0;
-
- img = new QImage(img->scanLine(rect.y()) + rect.x() * img->depth() / 8,
- rect.width(), rect.height(),
- img->bytesPerLine(), img->format());
- d_ptr->bufferImages.append(img);
-
- return img;
-}
-
-void QS60WindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &)
-{
- QWidget *window = widget->window();
- Q_ASSERT(window);
- QTLWExtra *topExtra = window->d_func()->maybeTopData();
- Q_ASSERT(topExtra);
- QRect qr = region.boundingRect();
- if (!topExtra->inExpose) {
- topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again
- TRect tr = qt_QRect2TRect(qr);
- widget->winId()->DrawNow(tr);
- topExtra->inExpose = false;
- } else {
- // This handles the case when syncBackingStore updates content outside of the
- // original drawing rectangle. This might happen if there are pending update()
- // events at the same time as we get a Draw() from Symbian.
- QRect drawRect = qt_TRect2QRect(widget->winId()->DrawableWindow()->GetDrawRect());
- if (!drawRect.contains(qr))
- widget->winId()->DrawDeferred();
- }
-}
-
-bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- QRect rect = area.boundingRect();
-
- if (dx == 0 && dy == 0)
- return false;
-
- if (d_ptr->device.isNull())
- return false;
-
- QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data());
- data->scroll(dx, dy, rect);
-
- return true;
-}
-
-QPaintDevice* QS60WindowSurface::paintDevice()
-{
- return &d_ptr->device;
-}
-
-void QS60WindowSurface::setGeometry(const QRect& rect)
-{
- if (rect == geometry())
- return;
-
- QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data());
- data->resize(rect.width(), rect.height());
-
- QWindowSurface::setGeometry(rect);
-}
-
-QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const
-{
- return QWindowSurface::AllFeatures;
-}
-
-CFbsBitmap* QS60WindowSurface::symbianBitmap() const
-{
- QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data());
- return data->cfbsBitmap;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h
deleted file mode 100644
index 25018d86e2..0000000000
--- a/src/gui/painting/qwindowsurface_s60_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSURFACE_S60_P_H
-#define QWINDOWSURFACE_S60_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-#include "private/qwindowsurface_p.h"
-
-class CFbsBitmap;
-
-QT_BEGIN_NAMESPACE
-
-struct QS60WindowSurfacePrivate;
-
-class QS60WindowSurface : public QWindowSurface
-{
-public:
- QS60WindowSurface(QWidget *widget);
- ~QS60WindowSurface();
-
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- bool scroll(const QRegion &area, int dx, int dy);
-
- void beginPaint(const QRegion &);
- void endPaint(const QRegion &);
-
- QImage* buffer(const QWidget *widget);
-
- void setGeometry(const QRect &rect);
-
- WindowSurfaceFeatures features() const;
-
- CFbsBitmap *symbianBitmap() const;
-
-private:
- QS60WindowSurfacePrivate* d_ptr;
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSURFACE_S60_P_H
diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp
deleted file mode 100644
index deb83b452c..0000000000
--- a/src/gui/painting/qwindowsurface_x11.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/QPaintDevice>
-#include <QtGui/QPainter>
-#include <QtGui/QPixmap>
-#include <QtGui/QWidget>
-
-#include "private/qt_x11_p.h"
-#include "private/qpixmap_x11_p.h"
-#include "private/qwidget_p.h"
-#include "qx11info_x11.h"
-#include "qwindowsurface_x11_p.h"
-
-QT_BEGIN_NAMESPACE
-
-extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp
-
-struct QX11WindowSurfacePrivate
-{
- QWidget *widget;
- QPixmap device;
-#ifndef QT_NO_XRENDER
- bool translucentBackground;
-#endif
-};
-
-QX11WindowSurface::QX11WindowSurface(QWidget *widget)
- : QWindowSurface(widget), d_ptr(new QX11WindowSurfacePrivate), gc(0)
-{
- d_ptr->widget = widget;
-#ifndef QT_NO_XRENDER
- d_ptr->translucentBackground = X11->use_xrender
- && widget->x11Info().depth() == 32;
-#endif
-}
-
-
-QX11WindowSurface::~QX11WindowSurface()
-{
- delete d_ptr;
- if (gc) {
- XFreeGC(X11->display, gc);
- gc = 0;
- }
-}
-
-QPaintDevice *QX11WindowSurface::paintDevice()
-{
- return &d_ptr->device;
-}
-
-void QX11WindowSurface::beginPaint(const QRegion &rgn)
-{
-#ifndef QT_NO_XRENDER
- Q_ASSERT(!d_ptr->device.isNull());
-
- if (d_ptr->translucentBackground) {
- if (d_ptr->device.depth() != 32)
- static_cast<QX11PixmapData *>(d_ptr->device.data_ptr().data())->convertToARGB32();
- ::Picture src = X11->getSolidFill(d_ptr->device.x11Info().screen(), Qt::transparent);
- ::Picture dst = d_ptr->device.x11PictureHandle();
- const QVector<QRect> rects = rgn.rects();
- const int w = d_ptr->device.width();
- const int h = d_ptr->device.height();
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it)
- XRenderComposite(X11->display, PictOpSrc, src, 0, dst,
- 0, 0, w, h, it->x(), it->y(),
- it->width(), it->height());
- }
-#endif
-}
-
-void QX11WindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
-{
- if (d_ptr->device.isNull())
- return;
-
- QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
- QRegion wrgn(rgn);
- QRect br = rgn.boundingRect();
- if (!wOffset.isNull())
- wrgn.translate(-wOffset);
- QRect wbr = wrgn.boundingRect();
-
- int num;
- XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
- if (num <= 0)
- return;
-// qDebug() << "XSetClipRectangles";
-// for (int i = 0; i < num; ++i)
-// qDebug() << ' ' << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height;
- if (num != 1)
- XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded);
- XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc,
- br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y());
- if (num != 1)
- XSetClipMask(X11->display, gc, XNone);
-}
-
-void QX11WindowSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
-
- const QSize size = rect.size();
-
- if (d_ptr->device.size() == size || size.width() <= 0 || size.height() <= 0)
- return;
-#ifndef QT_NO_XRENDER
- if (d_ptr->translucentBackground) {
- QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen());
-
- QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType);
- data->xinfo = d_ptr->widget->x11Info();
- data->resize(size.width(), size.height());
- d_ptr->device = QPixmap(data);
- } else
-#endif
- {
- QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen());
-
- QX11PixmapData *oldData = static_cast<QX11PixmapData *>(d_ptr->device.pixmapData());
-
- if (oldData && !(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) {
- // Copy the content of the old pixmap into the new one.
- QX11PixmapData *newData = new QX11PixmapData(QPixmapData::PixmapType);
- newData->resize(size.width(), size.height());
- Q_ASSERT(oldData->d == newData->d);
-
- QRegion staticRegion(staticContents());
- // Make sure we're inside the boundaries of the old pixmap.
- staticRegion &= QRect(0, 0, oldData->w, oldData->h);
- const QRect boundingRect(staticRegion.boundingRect());
- const int dx = boundingRect.x();
- const int dy = boundingRect.y();
-
- int num;
- XRectangle *rects = (XRectangle *)qt_getClipRects(staticRegion, num);
- GC tmpGc = XCreateGC(X11->display, oldData->hd, 0, 0);
- XSetClipRectangles(X11->display, tmpGc, 0, 0, rects, num, YXBanded);
- XCopyArea(X11->display, oldData->hd, newData->hd, tmpGc,
- dx, dy, qMin(boundingRect.width(), size.width()),
- qMin(boundingRect.height(), size.height()), dx, dy);
- XFreeGC(X11->display, tmpGc);
- newData->flags &= ~QX11PixmapData::Uninitialized;
-
- d_ptr->device = QPixmap(newData);
- } else {
- d_ptr->device = QPixmap(size);
- }
- }
-
- if (gc) {
- XFreeGC(X11->display, gc);
- gc = 0;
- }
- if (!d_ptr->device.isNull()) {
- gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0);
- XSetGraphicsExposures(X11->display, gc, False);
- }
-}
-
-bool QX11WindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- QRect rect = area.boundingRect();
-
- if (d_ptr->device.isNull())
- return false;
-
- GC gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0);
- XCopyArea(X11->display, d_ptr->device.handle(), d_ptr->device.handle(), gc,
- rect.x(), rect.y(), rect.width(), rect.height(),
- rect.x()+dx, rect.y()+dy);
- XFreeGC(X11->display, gc);
-
- return true;
-}
-
-QPixmap QX11WindowSurface::grabWidget(const QWidget *widget,
- const QRect& rect) const
-{
- if (!widget || d_ptr->device.isNull())
- return QPixmap();
-
- QRect srcRect;
-
- // make sure the rect is inside the widget & clip to widget's rect
- if (!rect.isEmpty())
- srcRect = rect & widget->rect();
- else
- srcRect = widget->rect();
-
- if (srcRect.isEmpty())
- return QPixmap();
-
- // If it's a child widget we have to translate the coordinates
- if (widget != window())
- srcRect.translate(widget->mapTo(window(), QPoint(0, 0)));
-
- QPixmap::x11SetDefaultScreen(widget->x11Info().screen());
- QPixmap px(srcRect.width(), srcRect.height());
-
- GC tmpGc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0);
-
- // Copy srcRect from the backing store to the new pixmap
- XSetGraphicsExposures(X11->display, tmpGc, False);
- XCopyArea(X11->display, d_ptr->device.handle(), px.handle(), tmpGc,
- srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height(), 0, 0);
-
- XFreeGC(X11->display, tmpGc);
-
- return px;
-}
-
-QWindowSurface::WindowSurfaceFeatures QX11WindowSurface::features() const
-{
- WindowSurfaceFeatures features = QWindowSurface::PartialUpdates | QWindowSurface::PreservedContents;
-#ifndef QT_NO_XRENDER
- if (!d_ptr->translucentBackground)
- features |= QWindowSurface::StaticContents;
-#else
- features |= QWindowSurface::StaticContents;
-#endif
- return features;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qwindowsurface_x11_p.h b/src/gui/painting/qwindowsurface_x11_p.h
deleted file mode 100644
index df76f986ff..0000000000
--- a/src/gui/painting/qwindowsurface_x11_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSURFACE_X11_P_H
-#define QWINDOWSURFACE_X11_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-#include "private/qwindowsurface_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPaintDevice;
-class QPoint;
-class QRegion;
-class QRegion;
-class QSize;
-class QWidget;
-struct QX11WindowSurfacePrivate;
-
-class QX11WindowSurface : public QWindowSurface
-{
-public:
- QX11WindowSurface(QWidget *widget);
- ~QX11WindowSurface();
-
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
-
- void beginPaint(const QRegion &rgn);
- void setGeometry(const QRect &rect);
- bool scroll(const QRegion &area, int dx, int dy);
- QPixmap grabWidget(const QWidget *widget,
- const QRect& rectangle = QRect()) const;
- WindowSurfaceFeatures features() const;
-
-private:
- QX11WindowSurfacePrivate *d_ptr;
- GC gc;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSURFACE_X11_P_H
diff --git a/src/gui/painting/qwmatrix.h b/src/gui/painting/qwmatrix.h
deleted file mode 100644
index c4f4c75405..0000000000
--- a/src/gui/painting/qwmatrix.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWMATRIX_H
-#define QWMATRIX_H
-
-#include <QtGui/qmatrix.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if defined(QT3_SUPPORT)
-typedef QMatrix QWMatrix;
-#endif
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWMATRIX_H
diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp
index 2a0de3c1c7..031c135158 100644
--- a/src/gui/statemachine/qguistatemachine.cpp
+++ b/src/gui/statemachine/qguistatemachine.cpp
@@ -155,15 +155,6 @@ static QEvent *cloneEvent(QEvent *e)
return new QChildEvent(*static_cast<QChildEvent*>(e));
case QEvent::ChildPolished:
return new QChildEvent(*static_cast<QChildEvent*>(e));
-#ifdef QT3_SUPPORT
- case QEvent::ChildInsertedRequest:
- return new QEvent(*e);
- case QEvent::ChildInserted:
- return new QChildEvent(*static_cast<QChildEvent*>(e));
- case QEvent::LayoutHint:
- Q_ASSERT_X(false, "cloneEvent()", "not implemented");
- break;
-#endif
case QEvent::ChildRemoved:
return new QChildEvent(*static_cast<QChildEvent*>(e));
case QEvent::ShowWindowRequest:
@@ -266,15 +257,6 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::ShortcutOverride:
return new QKeyEvent(*static_cast<QKeyEvent*>(e));
-#ifdef QT3_SUPPORT
- case QEvent::Accel:
- Q_ASSERT_X(false, "cloneEvent()", "not implemented");
- break;
- case QEvent::AccelAvailable:
- Q_ASSERT_X(false, "cloneEvent()", "not implemented");
- break;
-#endif
-
#ifndef QT_NO_WHATSTHIS
case QEvent::WhatsThisClicked:
return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e));
@@ -321,11 +303,6 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::AcceptDropsChange:
return new QEvent(*e);
-#ifdef QT3_SUPPORT
- case QEvent::MenubarUpdated:
- return new QMenubarUpdatedEvent(*static_cast<QMenubarUpdatedEvent*>(e));
-#endif
-
case QEvent::ZeroTimerEvent:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index dd816d379c..ecb5ee51a1 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -47,6 +47,7 @@
#include "qpixmapcache.h"
#include "qstyleoption.h"
#include "private/qstyle_p.h"
+#include "private/qguiapplication_p.h"
#ifndef QT_NO_DEBUG
#include "qdebug.h"
#endif
@@ -2096,14 +2097,7 @@ QRect QStyle::alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment
*/
Qt::Alignment QStyle::visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
{
- if (!(alignment & Qt::AlignHorizontal_Mask))
- alignment |= Qt::AlignLeft;
- if ((alignment & Qt::AlignAbsolute) == 0 && (alignment & (Qt::AlignLeft | Qt::AlignRight))) {
- if (direction == Qt::RightToLeft)
- alignment ^= (Qt::AlignLeft | Qt::AlignRight);
- alignment |= Qt::AlignAbsolute;
- }
- return alignment;
+ return QGuiApplicationPrivate::visualAlignment(direction, alignment);
}
/*!
@@ -2187,34 +2181,6 @@ int QStyle::sliderValueFromPosition(int min, int max, int pos, int span, bool up
// pos <= span < sqrt(INT_MAX+0.0625)+0.25 ~ sqrt(INT_MAX)
}
-/*### \fn void QStyle::drawItem(QPainter *p, const QRect &r,
- int flags, const QColorGroup &colorgroup, bool enabled,
- const QString &text, int len = -1,
- const QColor *penColor = 0) const
-
- Use one of the drawItem() overloads that takes a QPalette instead
- of a QColorGroup.
-*/
-
-/*### \fn void QStyle::drawItem(QPainter *p, const QRect &r,
- int flags, const QColorGroup colorgroup, bool enabled,
- const QPixmap &pixmap,
- const QColor *penColor = 0) const
-
- Use one of the drawItem() overloads that takes a QPalette instead
- of a QColorGroup.
-*/
-
-/*### \fn void QStyle::drawItem(QPainter *p, const QRect &r,
- int flags, const QColorGroup colorgroup, bool enabled,
- const QPixmap *pixmap,
- const QString &text, int len = -1,
- const QColor *penColor = 0) const
-
- Use one of the drawItem() overloads that takes a QPalette instead
- of a QColorGroup.
-*/
-
/*!
Returns the style's standard palette.
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 27587e30ac..6aeb71c103 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -59,6 +59,8 @@
// We mean it.
//
+#include <private/qhexstring_p.h>
+
QT_BEGIN_NAMESPACE
class QPainter;
@@ -81,37 +83,6 @@ namespace QStyleHelper
int bottom = 0);
}
-// internal helper. Converts an integer value to an unique string token
-template <typename T>
- struct HexString
-{
- inline HexString(const T t)
- : val(t)
- {}
-
- inline void write(QChar *&dest) const
- {
- const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
- const char *c = reinterpret_cast<const char *>(&val);
- for (uint i = 0; i < sizeof(T); ++i) {
- *dest++ = hexChars[*c & 0xf];
- *dest++ = hexChars[(*c & 0xf0) >> 4];
- ++c;
- }
- }
- const T val;
-};
-
-// specialization to enable fast concatenating of our string tokens to a string
-template <typename T>
- struct QConcatenable<HexString<T> >
-{
- typedef HexString<T> type;
- enum { ExactSize = true };
- static int size(const HexString<T> &) { return sizeof(T) * 2; }
- static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
- typedef QString ConvertTo;
-};
QT_END_NAMESPACE
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index b6eeec9af8..35347c24e7 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -35,7 +35,7 @@ contains( styles, all ) {
styles = mac windows windowsxp windowsvista
}
-x11|embedded|qpa|!macx-*:styles -= mac
+x11|qpa|!macx-*:styles -= mac
x11{
QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE
diff --git a/src/gui/text/qabstractfontengine_qws.cpp b/src/gui/text/qabstractfontengine_qws.cpp
deleted file mode 100644
index 7cb868f655..0000000000
--- a/src/gui/text/qabstractfontengine_qws.cpp
+++ /dev/null
@@ -1,776 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractfontengine_qws.h"
-#include "qabstractfontengine_p.h"
-
-#include <private/qtextengine_p.h>
-#include <private/qpaintengine_raster_p.h>
-
-#include <qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-class QFontEngineInfoPrivate
-{
-public:
- inline QFontEngineInfoPrivate()
- : pixelSize(0), weight(QFont::Normal), style(QFont::StyleNormal)
- {}
-
- QString family;
- qreal pixelSize;
- int weight;
- QFont::Style style;
- QList<QFontDatabase::WritingSystem> writingSystems;
-};
-
-/*!
- \class QFontEngineInfo
- \preliminary
- \brief The QFontEngineInfo class describes a specific font provided by a font engine plugin.
- \since 4.3
- \ingroup qws
-
- \tableofcontents
-
- QFontEngineInfo is used to describe a request of a font to a font engine plugin as well as to
- describe the actual fonts a plugin provides.
-
- \sa QAbstractFontEngine, QFontEnginePlugin
-*/
-
-/*!
- Constructs a new empty QFontEngineInfo.
-*/
-QFontEngineInfo::QFontEngineInfo()
-{
- d = new QFontEngineInfoPrivate;
-}
-
-/*!
- Constructs a new QFontEngineInfo with the specified \a family.
- The resulting object represents a freely scalable font with normal
- weight and style.
-*/
-QFontEngineInfo::QFontEngineInfo(const QString &family)
-{
- d = new QFontEngineInfoPrivate;
- d->family = family;
-}
-
-/*!
- Creates a new font engine info object with the same attributes as \a other.
-*/
-QFontEngineInfo::QFontEngineInfo(const QFontEngineInfo &other)
- : d(new QFontEngineInfoPrivate(*other.d))
-{
-}
-
-/*!
- Assigns \a other to this font engine info object, and returns a reference
- to this.
-*/
-QFontEngineInfo &QFontEngineInfo::operator=(const QFontEngineInfo &other)
-{
- *d = *other.d;
- return *this;
-}
-
-/*!
- Destroys this QFontEngineInfo object.
-*/
-QFontEngineInfo::~QFontEngineInfo()
-{
- delete d;
-}
-
-/*!
- \property QFontEngineInfo::family
- the family name of the font
-*/
-
-void QFontEngineInfo::setFamily(const QString &family)
-{
- d->family = family;
-}
-
-QString QFontEngineInfo::family() const
-{
- return d->family;
-}
-
-/*!
- \property QFontEngineInfo::pixelSize
- the pixel size of the font
-
- A pixel size of 0 represents a freely scalable font.
-*/
-
-void QFontEngineInfo::setPixelSize(qreal size)
-{
- d->pixelSize = size;
-}
-
-qreal QFontEngineInfo::pixelSize() const
-{
- return d->pixelSize;
-}
-
-/*!
- \property QFontEngineInfo::weight
- the weight of the font
-
- The value should be from the \l{QFont::Weight} enumeration.
-*/
-
-void QFontEngineInfo::setWeight(int weight)
-{
- d->weight = weight;
-}
-
-int QFontEngineInfo::weight() const
-{
- return d->weight;
-}
-
-/*!
- \property QFontEngineInfo::style
- the style of the font
-*/
-
-void QFontEngineInfo::setStyle(QFont::Style style)
-{
- d->style = style;
-}
-
-QFont::Style QFontEngineInfo::style() const
-{
- return d->style;
-}
-
-/*!
- \property QFontEngineInfo::writingSystems
- the writing systems supported by the font
-
- An empty list means that any writing system is supported.
-*/
-
-QList<QFontDatabase::WritingSystem> QFontEngineInfo::writingSystems() const
-{
- return d->writingSystems;
-}
-
-void QFontEngineInfo::setWritingSystems(const QList<QFontDatabase::WritingSystem> &writingSystems)
-{
- d->writingSystems = writingSystems;
-}
-
-class QFontEnginePluginPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QFontEnginePlugin)
-
- QString foundry;
-};
-
-/*!
- \class QFontEnginePlugin
- \preliminary
- \brief The QFontEnginePlugin class is the base class for font engine factory plugins in Qt for Embedded Linux.
- \since 4.3
- \ingroup qws
- \ingroup plugins
-
- \tableofcontents
-
- QFontEnginePlugin is provided by font engine plugins to create
- instances of subclasses of QAbstractFontEngine.
-
- The member functions create() and availableFontEngines() must be
- implemented.
-
- \sa QAbstractFontEngine, QFontEngineInfo
-*/
-
-/*!
- Creates a font engine plugin that creates font engines with the
- specified \a foundry and \a parent.
-*/
-QFontEnginePlugin::QFontEnginePlugin(const QString &foundry, QObject *parent)
- : QObject(*new QFontEnginePluginPrivate, parent)
-{
- Q_D(QFontEnginePlugin);
- d->foundry = foundry;
-}
-
-/*!
- Destroys this font engine plugin.
-*/
-QFontEnginePlugin::~QFontEnginePlugin()
-{
-}
-
-/*!
- Returns a list of foundries the font engine plugin provides.
- The default implementation returns the foundry specified with the constructor.
-*/
-QStringList QFontEnginePlugin::keys() const
-{
- Q_D(const QFontEnginePlugin);
- return QStringList(d->foundry);
-}
-
-/*!
- \fn QAbstractFontEngine *QFontEnginePlugin::create(const QFontEngineInfo &info)
-
- Implemented in subclasses to create a new font engine that provides a font that
- matches \a info.
-*/
-
-/*!
- \fn QList<QFontEngineInfo> QFontEnginePlugin::availableFontEngines() const
-
- Implemented in subclasses to return a list of QFontEngineInfo objects that represents all font
- engines the plugin can create.
-*/
-
-class QAbstractFontEnginePrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QAbstractFontEngine)
-public:
-};
-
-//The <classname> class is|provides|contains|specifies...
-/*!
- \class QAbstractFontEngine
- \preliminary
- \brief The QAbstractFontEngine class is the base class for font engine plugins in Qt for Embedded Linux.
- \since 4.3
- \ingroup qws
-
- \tableofcontents
-
- QAbstractFontEngine is implemented by font engine plugins through QFontEnginePlugin.
-
- \sa QFontEnginePlugin, QFontEngineInfo
-*/
-
-/*!
- \enum QAbstractFontEngine::Capability
-
- This enum describes the capabilities of a font engine.
-
- \value CanRenderGlyphs_Gray The font engine can render individual glyphs into 8 bpp images.
- \value CanRenderGlyphs_Mono The font engine can render individual glyphs into 1 bpp images.
- \value CanRenderGlyphs The font engine can render individual glyphs into images.
- \value CanOutlineGlyphs The font engine can convert glyphs to painter paths.
-*/
-
-/*!
- \enum QAbstractFontEngine::FontProperty
-
- This enum describes the properties of a font provided by a font engine.
-
- \value Ascent The ascent of the font, specified as a 26.6 fixed point value.
- \value Descent The descent of the font, specified as a 26.6 fixed point value.
- \value Leading The leading of the font, specified as a 26.6 fixed point value.
- \value XHeight The 'x' height of the font, specified as a 26.6 fixed point value.
- \value AverageCharWidth The average character width of the font, specified as a 26.6 fixed point value.
- \value LineThickness The thickness of the underline and strikeout lines for the font, specified as a 26.6 fixed point value.
- \value UnderlinePosition The distance from the base line to the underline position for the font, specified as a 26.6 fixed point value.
- \value MaxCharWidth The width of the widest character in the font, specified as a 26.6 fixed point value.
- \value MinLeftBearing The minimum left bearing of the font, specified as a 26.6 fixed point value.
- \value MinRightBearing The maximum right bearing of the font, specified as a 26.6 fixed point value.
- \value GlyphCount The number of glyphs in the font, specified as an integer value.
- \value CacheGlyphsHint A boolean value specifying whether rendered glyphs should be cached by Qt.
- \value OutlineGlyphsHint A boolean value specifying whether the font engine prefers outline drawing over image rendering for uncached glyphs.
-*/
-
-/*!
- \enum QAbstractFontEngine::TextShapingFlag
-
- This enum describes flags controlling conversion of characters to glyphs and their metrics.
-
- \value RightToLeft The text is used in a right-to-left context.
- \value ReturnDesignMetrics Return font design metrics instead of pixel metrics.
-*/
-
-/*!
- \typedef QAbstractFontEngine::Fixed
-
- This type is \c int, interpreted as a 26.6 fixed point value.
-*/
-
-/*!
- \class QAbstractFontEngine::GlyphMetrics
- \brief QAbstractFontEngine::GlyphMetrics defines the metrics of a single glyph.
- \preliminary
- \since 4.3
-*/
-
-/*!
- \variable QAbstractFontEngine::GlyphMetrics::x
-
- The horizontal offset from the origin.
-*/
-
-/*!
- \fn QAbstractFontEngine::GlyphMetrics::GlyphMetrics()
-
- Constructs an empty glyph metrics object with all values
- set to zero.
-*/
-
-/*!
- \variable QAbstractFontEngine::GlyphMetrics::y
-
- The vertical offset from the origin (baseline).
-*/
-
-/*!
- \variable QAbstractFontEngine::GlyphMetrics::width
-
- The width of the glyph.
-*/
-
-/*!
- \variable QAbstractFontEngine::GlyphMetrics::height
-
- The height of the glyph.
-*/
-
-/*!
- \variable QAbstractFontEngine::GlyphMetrics::advance
-
- The advance of the glyph.
-*/
-
-/*!
- \class QAbstractFontEngine::FixedPoint
- \brief QAbstractFontEngine::FixedPoint defines a point in the place using 26.6 fixed point precision.
- \preliminary
- \since 4.3
-*/
-
-/*!
- \variable QAbstractFontEngine::FixedPoint::x
-
- The x coordinate of this point.
-*/
-
-/*!
- \variable QAbstractFontEngine::FixedPoint::y
-
- The y coordinate of this point.
-*/
-
-/*!
- Constructs a new QAbstractFontEngine with the given \a parent.
-*/
-QAbstractFontEngine::QAbstractFontEngine(QObject *parent)
- : QObject(*new QAbstractFontEnginePrivate, parent)
-{
-}
-
-/*!
- Destroys this QAbstractFontEngine object.
-*/
-QAbstractFontEngine::~QAbstractFontEngine()
-{
-}
-
-/*!
- \fn QAbstractFontEngine::Capabilities QAbstractFontEngine::capabilities() const
-
- Implemented in subclasses to specify the font engine's capabilities. The return value
- may be cached by the caller and is expected not to change during the lifetime of the
- font engine.
-*/
-
-/*!
- \fn QVariant QAbstractFontEngine::fontProperty(FontProperty property) const
-
- Implemented in subclasses to return the value of the font attribute \a property. The return
- value may be cached by the caller and is expected not to change during the lifetime of the font
- engine.
-*/
-
-/*!
- \fn bool QAbstractFontEngine::convertStringToGlyphIndices(const QChar *string, int length, uint *glyphs, int *numGlyphs, TextShapingFlags flags) const
-
- Implemented in subclasses to convert the characters specified by \a string and \a length to
- glyph indicies, using \a flags. The glyph indicies should be returned in the \a glyphs array
- provided by the caller. The maximum size of \a glyphs is specified by the value pointed to by \a
- numGlyphs. If successful, the subclass implementation sets the value pointed to by \a numGlyphs
- to the actual number of glyph indices generated, and returns true. Otherwise, e.g. if there is
- not enough space in the provided \a glyphs array, it should set \a numGlyphs to the number of
- glyphs needed for the conversion and return false.
-*/
-
-/*!
- \fn void QAbstractFontEngine::getGlyphAdvances(const uint *glyphs, int numGlyphs, Fixed *advances, TextShapingFlags flags) const
-
- Implemented in subclasses to retrieve the advances of the array specified by \a glyphs and \a
- numGlyphs, using \a flags. The result is returned in \a advances, which is allocated by the
- caller and contains \a numGlyphs elements.
-*/
-
-/*!
- \fn QAbstractFontEngine::GlyphMetrics QAbstractFontEngine::glyphMetrics(uint glyph) const
-
- Implemented in subclass to return the metrics for \a glyph.
-*/
-
-/*!
- Implemented in subclasses to render the specified \a glyph into a \a buffer with the given \a depth ,
- \a bytesPerLine and \a height.
-
- Returns true if rendering succeeded, false otherwise.
-*/
-bool QAbstractFontEngine::renderGlyph(uint glyph, int depth, int bytesPerLine, int height, uchar *buffer)
-{
- Q_UNUSED(glyph)
- Q_UNUSED(depth)
- Q_UNUSED(bytesPerLine)
- Q_UNUSED(height)
- Q_UNUSED(buffer)
- qWarning("QAbstractFontEngine: renderGlyph is not implemented in font plugin!");
- return false;
-}
-
-/*!
- Implemented in subclasses to add the outline of the glyphs specified by \a glyphs and \a
- numGlyphs at the specified \a positions to the painter path \a path.
-*/
-void QAbstractFontEngine::addGlyphOutlinesToPath(uint *glyphs, int numGlyphs, FixedPoint *positions, QPainterPath *path)
-{
- Q_UNUSED(glyphs)
- Q_UNUSED(numGlyphs)
- Q_UNUSED(positions)
- Q_UNUSED(path)
- qWarning("QAbstractFontEngine: addGlyphOutlinesToPath is not implemented in font plugin!");
-}
-
-/*
-bool QAbstractFontEngine::supportsExtension(Extension extension) const
-{
- Q_UNUSED(extension)
- return false;
-}
-
-QVariant QAbstractFontEngine::extension(Extension extension, const QVariant &argument)
-{
- Q_UNUSED(argument)
- Q_UNUSED(extension)
- return QVariant();
-}
-*/
-
-QProxyFontEngine::QProxyFontEngine(QAbstractFontEngine *customEngine, const QFontDef &def)
- : engine(customEngine)
-{
- fontDef = def;
- engineCapabilities = engine->capabilities();
-}
-
-QProxyFontEngine::~QProxyFontEngine()
-{
- delete engine;
-}
-
-bool QProxyFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
-{
- if (*nglyphs < len) {
- *nglyphs = len;
- return false;
- }
-
- QVarLengthArray<uint> glyphIndicies(*nglyphs);
- if (!engine->convertStringToGlyphIndices(str, len, glyphIndicies.data(), nglyphs, QAbstractFontEngine::TextShapingFlags(int(flags))))
- return false;
-
- // ### use memcopy instead
- for (int i = 0; i < *nglyphs; ++i) {
- glyphs->glyphs[i] = glyphIndicies[i];
- }
- glyphs->numGlyphs = *nglyphs;
-
- recalcAdvances(glyphs, flags);
- return true;
-}
-
-void QProxyFontEngine::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
-{
- const int nglyphs = glyphs->numGlyphs;
-
- QVarLengthArray<QAbstractFontEngine::Fixed> advances(nglyphs);
- engine->getGlyphAdvances(glyphs->glyphs, nglyphs, advances.data(), QAbstractFontEngine::TextShapingFlags(int(flags)));
-
-
- // ### use memcopy instead
- for (int i = 0; i < nglyphs; ++i) {
- glyphs->advances_x[i] = QFixed::fromFixed(advances[i]);
- glyphs->advances_y[i] = 0;
- }
-}
-
-
-static QImage alphaMapFromPath(QFontEngine *fe, glyph_t glyph)
-{
- glyph_metrics_t gm = fe->boundingBox(glyph);
- int glyph_x = qFloor(gm.x.toReal());
- int glyph_y = qFloor(gm.y.toReal());
- int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x;
- int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y;
-
- if (glyph_width <= 0 || glyph_height <= 0)
- return QImage();
- QFixedPoint pt;
- pt.x = 0;
- pt.y = -glyph_y; // the baseline
- QPainterPath path;
- QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
- im.fill(Qt::transparent);
- QPainter p(&im);
- p.setRenderHint(QPainter::Antialiasing);
- fe->addGlyphsToPath(&glyph, &pt, 1, &path, 0);
- p.setPen(Qt::NoPen);
- p.setBrush(Qt::black);
- p.drawPath(path);
- p.end();
-
- QImage indexed(im.width(), im.height(), QImage::Format_Indexed8);
- QVector<QRgb> colors(256);
- for (int i=0; i<256; ++i)
- colors[i] = qRgba(0, 0, 0, i);
- indexed.setColorTable(colors);
-
- for (int y=0; y<im.height(); ++y) {
- uchar *dst = (uchar *) indexed.scanLine(y);
- uint *src = (uint *) im.scanLine(y);
- for (int x=0; x<im.width(); ++x)
- dst[x] = qAlpha(src[x]);
- }
-
- return indexed;
-}
-
-
-QImage QProxyFontEngine::alphaMapForGlyph(glyph_t glyph)
-{
- if (!(engineCapabilities & QAbstractFontEngine::CanRenderGlyphs_Gray))
- return alphaMapFromPath(this, glyph);
-
- QAbstractFontEngine::GlyphMetrics metrics = engine->glyphMetrics(glyph);
- if (metrics.width <= 0 || metrics.height <= 0)
- return QImage();
-
- QImage img(metrics.width >> 6, metrics.height >> 6, QImage::Format_Indexed8);
-
- // ### we should have QImage::Format_GrayScale8
- static QVector<QRgb> colorMap;
- if (colorMap.isEmpty()) {
- colorMap.resize(256);
- for (int i=0; i<256; ++i)
- colorMap[i] = qRgba(0, 0, 0, i);
- }
-
- img.setColorTable(colorMap);
-
- engine->renderGlyph(glyph, /*depth*/8, img.bytesPerLine(), img.height(), img.bits());
-
- return img;
-}
-
-void QProxyFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags)
-{
- if (engineCapabilities & QAbstractFontEngine::CanOutlineGlyphs)
- engine->addGlyphOutlinesToPath(glyphs, nglyphs, reinterpret_cast<QAbstractFontEngine::FixedPoint *>(positions), path);
- else
- QFontEngine::addGlyphsToPath(glyphs, positions, nglyphs, path, flags);
-}
-
-glyph_metrics_t QProxyFontEngine::boundingBox(const QGlyphLayout &glyphs)
-{
- if (glyphs.numGlyphs == 0)
- return glyph_metrics_t();
-
- QFixed w = 0;
- for (int i = 0; i < glyphs.numGlyphs; ++i)
- w += glyphs.effectiveAdvance(i);
-
- return glyph_metrics_t(0, -ascent(), w, ascent() + descent(), w, 0);
-}
-
-glyph_metrics_t QProxyFontEngine::boundingBox(glyph_t glyph)
-{
- glyph_metrics_t m;
-
- QAbstractFontEngine::GlyphMetrics metrics = engine->glyphMetrics(glyph);
- m.x = QFixed::fromFixed(metrics.x);
- m.y = QFixed::fromFixed(metrics.y);
- m.width = QFixed::fromFixed(metrics.width);
- m.height = QFixed::fromFixed(metrics.height);
- m.xoff = QFixed::fromFixed(metrics.advance);
-
- return m;
-}
-
-QFixed QProxyFontEngine::ascent() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::Ascent).toInt());
-}
-
-QFixed QProxyFontEngine::descent() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::Descent).toInt());
-}
-
-QFixed QProxyFontEngine::leading() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::Leading).toInt());
-}
-
-QFixed QProxyFontEngine::xHeight() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::XHeight).toInt());
-}
-
-QFixed QProxyFontEngine::averageCharWidth() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::AverageCharWidth).toInt());
-}
-
-QFixed QProxyFontEngine::lineThickness() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::LineThickness).toInt());
-}
-
-QFixed QProxyFontEngine::underlinePosition() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::UnderlinePosition).toInt());
-}
-
-qreal QProxyFontEngine::maxCharWidth() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::MaxCharWidth).toInt()).toReal();
-}
-
-qreal QProxyFontEngine::minLeftBearing() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::MinLeftBearing).toInt()).toReal();
-}
-
-qreal QProxyFontEngine::minRightBearing() const
-{
- return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::MinRightBearing).toInt()).toReal();
-}
-
-int QProxyFontEngine::glyphCount() const
-{
- return engine->fontProperty(QAbstractFontEngine::GlyphCount).toInt();
-}
-
-bool QProxyFontEngine::canRender(const QChar *string, int len)
-{
- QVarLengthArray<uint> glyphs(len);
- int numGlyphs = len;
-
- if (!engine->convertStringToGlyphIndices(string, len, glyphs.data(), &numGlyphs, /*flags*/0))
- return false;
-
- for (int i = 0; i < numGlyphs; ++i)
- if (!glyphs[i])
- return false;
-
- return true;
-}
-
-void QProxyFontEngine::draw(QPaintEngine *p, qreal _x, qreal _y, const QTextItemInt &si)
-{
- QPaintEngineState *pState = p->state;
- QRasterPaintEngine *paintEngine = static_cast<QRasterPaintEngine*>(p);
-
- QTransform matrix = pState->transform();
- matrix.translate(_x, _y);
- QFixed x = QFixed::fromReal(matrix.dx());
- QFixed y = QFixed::fromReal(matrix.dy());
-
- QVarLengthArray<QFixedPoint> positions;
- QVarLengthArray<glyph_t> glyphs;
- getGlyphPositions(si.glyphs, matrix, si.flags, glyphs, positions);
- if (glyphs.size() == 0)
- return;
-
- for(int i = 0; i < glyphs.size(); i++) {
- QImage glyph = alphaMapForGlyph(glyphs[i]);
- if (glyph.isNull())
- continue;
-
- if (glyph.format() != QImage::Format_Indexed8
- && glyph.format() != QImage::Format_Mono)
- continue;
-
- QAbstractFontEngine::GlyphMetrics metrics = engine->glyphMetrics(glyphs[i]);
-
- int depth = glyph.format() == QImage::Format_Mono ? 1 : 8;
- paintEngine->alphaPenBlt(glyph.bits(), glyph.bytesPerLine(), depth,
- qRound(positions[i].x + QFixed::fromFixed(metrics.x)),
- qRound(positions[i].y + QFixed::fromFixed(metrics.y)),
- glyph.width(), glyph.height());
- }
-}
-
-/*
- * This is only called when we use the proxy fontengine directly (without sharing the rendered
- * glyphs). So we prefer outline rendering over rendering of unshared glyphs. That decision is
- * done in qfontdatabase_qws.cpp by looking at the ShareGlyphsHint and the pixel size of the font.
- */
-bool QProxyFontEngine::drawAsOutline() const
-{
- if (!(engineCapabilities & QAbstractFontEngine::CanOutlineGlyphs))
- return false;
-
- QVariant outlineHint = engine->fontProperty(QAbstractFontEngine::OutlineGlyphsHint);
- return !outlineHint.isValid() || outlineHint.toBool();
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/text/qabstractfontengine_qws.h b/src/gui/text/qabstractfontengine_qws.h
deleted file mode 100644
index dfc15dcf5d..0000000000
--- a/src/gui/text/qabstractfontengine_qws.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTFONTENGINE_QWS_H
-#define QABSTRACTFONTENGINE_QWS_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qfactoryinterface.h>
-#include <QtGui/qpaintengine.h>
-#include <QtGui/qfontdatabase.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QFontEngineInfoPrivate;
-
-class Q_GUI_EXPORT QFontEngineInfo
-{
-public:
- QDOC_PROPERTY(QString family READ family WRITE setFamily)
- QDOC_PROPERTY(qreal pixelSize READ pixelSize WRITE setPixelSize)
- QDOC_PROPERTY(int weight READ weight WRITE setWeight)
- QDOC_PROPERTY(QFont::Style style READ style WRITE setStyle)
- QDOC_PROPERTY(QList<QFontDatabase::WritingSystem> writingSystems READ writingSystems WRITE setWritingSystems)
-
- QFontEngineInfo();
- explicit QFontEngineInfo(const QString &family);
- QFontEngineInfo(const QFontEngineInfo &other);
- QFontEngineInfo &operator=(const QFontEngineInfo &other);
- ~QFontEngineInfo();
-
- void setFamily(const QString &name);
- QString family() const;
-
- void setPixelSize(qreal size);
- qreal pixelSize() const;
-
- void setWeight(int weight);
- int weight() const;
-
- void setStyle(QFont::Style style);
- QFont::Style style() const;
-
- QList<QFontDatabase::WritingSystem> writingSystems() const;
- void setWritingSystems(const QList<QFontDatabase::WritingSystem> &writingSystems);
-
-private:
- QFontEngineInfoPrivate *d;
-};
-
-class QAbstractFontEngine;
-
-struct Q_GUI_EXPORT QFontEngineFactoryInterface : public QFactoryInterface
-{
- virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0;
- virtual QList<QFontEngineInfo> availableFontEngines() const = 0;
-};
-
-#define QFontEngineFactoryInterface_iid "com.trolltech.Qt.QFontEngineFactoryInterface"
-Q_DECLARE_INTERFACE(QFontEngineFactoryInterface, QFontEngineFactoryInterface_iid)
-
-class QFontEnginePluginPrivate;
-
-class Q_GUI_EXPORT QFontEnginePlugin : public QObject, public QFontEngineFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QFontEngineFactoryInterface:QFactoryInterface)
-public:
- QFontEnginePlugin(const QString &foundry, QObject *parent = 0);
- ~QFontEnginePlugin();
-
- virtual QStringList keys() const;
-
- virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0;
- virtual QList<QFontEngineInfo> availableFontEngines() const = 0;
-
-private:
- Q_DECLARE_PRIVATE(QFontEnginePlugin)
- Q_DISABLE_COPY(QFontEnginePlugin)
-};
-
-class QAbstractFontEnginePrivate;
-
-class Q_GUI_EXPORT QAbstractFontEngine : public QObject
-{
- Q_OBJECT
-public:
- enum Capability {
- CanOutlineGlyphs = 1,
- CanRenderGlyphs_Mono = 2,
- CanRenderGlyphs_Gray = 4,
- CanRenderGlyphs = CanRenderGlyphs_Mono | CanRenderGlyphs_Gray
- };
- Q_DECLARE_FLAGS(Capabilities, Capability)
-
- explicit QAbstractFontEngine(QObject *parent = 0);
- ~QAbstractFontEngine();
-
- typedef int Fixed; // 26.6
-
- struct FixedPoint
- {
- Fixed x;
- Fixed y;
- };
-
- struct GlyphMetrics
- {
- inline GlyphMetrics()
- : x(0), y(0), width(0), height(0),
- advance(0) {}
- Fixed x;
- Fixed y;
- Fixed width;
- Fixed height;
- Fixed advance;
- };
-
- enum FontProperty {
- Ascent,
- Descent,
- Leading,
- XHeight,
- AverageCharWidth,
- LineThickness,
- UnderlinePosition,
- MaxCharWidth,
- MinLeftBearing,
- MinRightBearing,
- GlyphCount,
-
- // hints
- CacheGlyphsHint,
- OutlineGlyphsHint
- };
-
- // keep in sync with QTextEngine::ShaperFlag!!
- enum TextShapingFlag {
- RightToLeft = 0x0001,
- ReturnDesignMetrics = 0x0002
- };
- Q_DECLARE_FLAGS(TextShapingFlags, TextShapingFlag)
-
- virtual Capabilities capabilities() const = 0;
- virtual QVariant fontProperty(FontProperty property) const = 0;
-
- virtual bool convertStringToGlyphIndices(const QChar *string, int length, uint *glyphs, int *numGlyphs, TextShapingFlags flags) const = 0;
-
- virtual void getGlyphAdvances(const uint *glyphs, int numGlyphs, Fixed *advances, TextShapingFlags flags) const = 0;
-
- virtual GlyphMetrics glyphMetrics(uint glyph) const = 0;
-
- virtual bool renderGlyph(uint glyph, int depth, int bytesPerLine, int height, uchar *buffer);
-
- virtual void addGlyphOutlinesToPath(uint *glyphs, int numGlyphs, FixedPoint *positions, QPainterPath *path);
-
- /*
- enum Extension {
- GetTrueTypeTable
- };
-
- virtual bool supportsExtension(Extension extension) const;
- virtual QVariant extension(Extension extension, const QVariant &argument = QVariant());
- */
-
-private:
- Q_DECLARE_PRIVATE(QAbstractFontEngine)
- Q_DISABLE_COPY(QAbstractFontEngine)
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::Capabilities)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::TextShapingFlags)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index b8cfb1f902..dd5dfdaf81 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -48,7 +48,7 @@
#include "qpainter.h"
#include "qhash.h"
#include "qdatastream.h"
-#include "qapplication.h"
+#include "qguiapplication.h"
#include "qstringlist.h"
#include "qthread.h"
@@ -77,7 +77,7 @@
#endif
#ifdef Q_WS_QPA
#include <QtGui/qplatformscreen_qpa.h>
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#endif
#include <QMutexLocker>
@@ -180,9 +180,9 @@ Q_GUI_EXPORT int qt_defaultDpiX()
screen = subScreens.at(0);
dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4)));
#elif defined(Q_WS_QPA)
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
if (pi) {
- QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0);
+ QPlatformScreen *screen = pi->screens().at(0);
const QSize screenSize = screen->geometry().size();
const QSize physicalSize = screen->physicalSize();
dpi = qRound(screenSize.width() / (physicalSize.width() / qreal(25.4)));
@@ -219,9 +219,9 @@ Q_GUI_EXPORT int qt_defaultDpiY()
screen = subScreens.at(0);
dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4)));
#elif defined(Q_WS_QPA)
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
if (pi) {
- QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0);
+ QPlatformScreen *screen = pi->screens().at(0);
const QSize screenSize = screen->geometry().size();
const QSize physicalSize = screen->physicalSize();
dpi = qRound(screenSize.height() / (physicalSize.height() / qreal(25.4)));
@@ -448,9 +448,9 @@ QFontEngineData::~QFontEngineData()
Use QFontMetrics to get measurements, e.g. the pixel length of a
string using QFontMetrics::width().
- Note that a QApplication instance must exist before a QFont can be
+ Note that a QGuiApplication instance must exist before a QFont can be
used. You can set the application's default font with
- QApplication::setFont().
+ QGuiApplication::setFont().
If a chosen font does not include all the characters that
need to be displayed, QFont will try to find the characters in the
@@ -781,10 +781,10 @@ void QFont::detach()
/*!
Constructs a font object that uses the application's default font.
- \sa QApplication::setFont(), QApplication::font()
+ \sa QGuiApplication::setFont(), QGuiApplication::font()
*/
QFont::QFont()
- : d(QApplication::font().d.data()), resolve_mask(0)
+ : d(QGuiApplication::font().d.data()), resolve_mask(0)
{
}
@@ -804,7 +804,7 @@ QFont::QFont()
algorithm.
\sa Weight, setFamily(), setPointSize(), setWeight(), setItalic(),
- setStyleHint() QApplication::font()
+ setStyleHint() QGuiApplication::font()
*/
QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
: d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved)
@@ -1096,18 +1096,6 @@ int QFont::pixelSize() const
return d->request.pixelSize;
}
-#ifdef QT3_SUPPORT
-/*! \obsolete
-
- Sets the logical pixel height of font characters when shown on
- the screen to \a pixelSize.
-*/
-void QFont::setPixelSizeFloat(qreal pixelSize)
-{
- setPixelSize((int)pixelSize);
-}
-#endif
-
/*!
\fn bool QFont::italic() const
@@ -1875,43 +1863,6 @@ QFont QFont::resolve(const QFont &other) const
\internal
*/
-#ifdef QT3_SUPPORT
-
-/*! \obsolete
-
- Please use QApplication::font() instead.
-*/
-QFont QFont::defaultFont()
-{
- return QApplication::font();
-}
-
-/*! \obsolete
-
- Please use QApplication::setFont() instead.
-*/
-void QFont::setDefaultFont(const QFont &f)
-{
- QApplication::setFont(f);
-}
-
-/*!
- \fn qreal QFont::pointSizeFloat() const
- \compat
-
- Use pointSizeF() instead.
-*/
-
-/*!
- \fn void QFont::setPointSizeFloat(qreal size)
- \compat
-
- Use setPointSizeF() instead.
-*/
-#endif
-
-
-
/*****************************************************************************
QFont substitution management
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 0c7b6f8de8..194e3ad34a 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -283,14 +283,6 @@ public:
inline uint resolve() const { return resolve_mask; }
inline void resolve(uint mask) { resolve_mask = mask; }
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT QFont defaultFont();
- static QT3_SUPPORT void setDefaultFont(const QFont &);
- QT3_SUPPORT void setPixelSizeFloat(qreal);
- QT3_SUPPORT qreal pointSizeFloat() const { return pointSizeF(); }
- QT3_SUPPORT void setPointSizeFloat(qreal size) { setPointSizeF(size); }
-#endif
-
private:
QFont(QFontPrivate *);
diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp
index ff12da8d97..981c313201 100644
--- a/src/gui/text/qfont_qpa.cpp
+++ b/src/gui/text/qfont_qpa.cpp
@@ -39,14 +39,14 @@
**
****************************************************************************/
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/QPlatformFontDatabase>
QT_BEGIN_NAMESPACE
void QFont::initialize()
{
- QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
}
void QFont::cleanup()
@@ -90,7 +90,7 @@ QString QFont::defaultFamily() const
familyName = QString::fromLatin1("helvetica");
}
- QStringList list = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QFont::StyleHint(d->request.styleHint),QUnicodeTables::Common);
+ QStringList list = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QFont::StyleHint(d->request.styleHint),QUnicodeTables::Common);
if (list.size()) {
familyName = list.at(0);
}
diff --git a/src/gui/text/qfont_qws.cpp b/src/gui/text/qfont_qws.cpp
deleted file mode 100644
index ea2a944432..0000000000
--- a/src/gui/text/qfont_qws.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwidget.h"
-#include "qpainter.h"
-#include "qfont_p.h"
-#include <private/qunicodetables_p.h>
-#include "qfontdatabase.h"
-#include "qtextcodec.h"
-#include "qapplication.h"
-#include "qfile.h"
-#include "qtextstream.h"
-#include "qmap.h"
-//#include "qmemorymanager_qws.h"
-#include "qtextengine_p.h"
-#include "qfontengine_p.h"
-#if !defined(QT_NO_FREETYPE)
-#include "qfontengine_ft_p.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-void QFont::initialize()
-{ }
-
-void QFont::cleanup()
-{
- QFontCache::cleanup();
-}
-
-
-/*****************************************************************************
- QFont member functions
- *****************************************************************************/
-
-Qt::HANDLE QFont::handle() const
-{
-#ifndef QT_NO_FREETYPE
- return freetypeFace();
-#endif
- return 0;
-}
-
-FT_Face QFont::freetypeFace() const
-{
-#ifndef QT_NO_FREETYPE
- QFontEngine *engine = d->engineForScript(QUnicodeTables::Common);
- if (engine->type() == QFontEngine::Multi)
- engine = static_cast<QFontEngineMulti *>(engine)->engine(0);
- if (engine->type() == QFontEngine::Freetype) {
- const QFontEngineFT *ft = static_cast<const QFontEngineFT *>(engine);
- return ft->non_locked_face();
- }
-#endif
- return 0;
-}
-
-QString QFont::rawName() const
-{
- return QLatin1String("unknown");
-}
-
-void QFont::setRawName(const QString &)
-{
-}
-
-QString QFont::defaultFamily() const
-{
- switch(d->request.styleHint) {
- case QFont::Times:
- return QString::fromLatin1("times");
- case QFont::Courier:
- case QFont::Monospace:
- return QString::fromLatin1("courier");
- case QFont::Decorative:
- return QString::fromLatin1("old english");
- case QFont::Helvetica:
- case QFont::System:
- default:
- return QString::fromLatin1("helvetica");
- }
-}
-
-QString QFont::lastResortFamily() const
-{
- return QString::fromLatin1("helvetica");
-}
-
-QString QFont::lastResortFont() const
-{
- qFatal("QFont::lastResortFont: Cannot find any reasonable font");
- // Shut compiler up
- return QString();
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 36b0ea9b68..0381286f10 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -43,7 +43,7 @@
#include "qfontdatabase.h"
#include "qdebug.h"
#include "qalgorithms.h"
-#include "qapplication.h"
+#include "qguiapplication.h"
#include "qvarlengtharray.h" // here or earlier - workaround for VC++6
#include "qthread.h"
#include "qmutex.h"
@@ -51,7 +51,7 @@
#include "qfontengine_p.h"
#ifdef Q_WS_QPA
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qplatformfontdatabase_qpa.h>
#include "qabstractfileengine.h"
#endif
@@ -103,34 +103,34 @@ static int getFontWeight(const QString &weightString)
// Test in decreasing order of commonness
if (s == QLatin1String("medium") ||
s == QLatin1String("normal")
- || s.compare(QApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
return QFont::Normal;
if (s == QLatin1String("bold")
- || s.compare(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
return QFont::Bold;
if (s == QLatin1String("demibold") || s == QLatin1String("demi bold")
- || s.compare(QApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
return QFont::DemiBold;
if (s == QLatin1String("black")
- || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
return QFont::Black;
if (s == QLatin1String("light"))
return QFont::Light;
if (s.contains(QLatin1String("bold"))
- || s.contains(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
+ || s.contains(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
if (s.contains(QLatin1String("demi"))
- || s.compare(QApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
return (int) QFont::DemiBold;
return (int) QFont::Bold;
}
if (s.contains(QLatin1String("light"))
- || s.compare(QApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
return (int) QFont::Light;
if (s.contains(QLatin1String("black"))
- || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
return (int) QFont::Black;
return (int) QFont::Normal;
@@ -264,7 +264,7 @@ struct QtFontStyle
pixelSizes[count].fileName.~QByteArray();
#endif
#if defined (Q_WS_QPA)
- QPlatformIntegration *integration = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
if (integration) { //on shut down there will be some that we don't release.
integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);
}
@@ -297,10 +297,10 @@ QtFontStyle::Key::Key(const QString &styleString)
weight = getFontWeight(styleString);
if (styleString.contains(QLatin1String("Italic"))
- || styleString.contains(QApplication::translate("QFontDatabase", "Italic")))
+ || styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic")))
style = QFont::StyleItalic;
else if (styleString.contains(QLatin1String("Oblique"))
- || styleString.contains(QApplication::translate("QFontDatabase", "Oblique")))
+ || styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique")))
style = QFont::StyleOblique;
}
@@ -748,7 +748,7 @@ void QFontDatabasePrivate::invalidate()
{
QFontCache::instance()->clear();
free();
- emit static_cast<QApplication *>(QApplication::instance())->fontDatabaseChanged();
+ emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
}
QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create)
@@ -1506,21 +1506,21 @@ static QString styleStringHelper(int weight, QFont::Style style)
{
QString result;
if (weight >= QFont::Black)
- result = QApplication::translate("QFontDatabase", "Black");
+ result = QCoreApplication::translate("QFontDatabase", "Black");
else if (weight >= QFont::Bold)
- result = QApplication::translate("QFontDatabase", "Bold");
+ result = QCoreApplication::translate("QFontDatabase", "Bold");
else if (weight >= QFont::DemiBold)
- result = QApplication::translate("QFontDatabase", "Demi Bold");
+ result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
else if (weight < QFont::Normal)
- result = QApplication::translate("QFontDatabase", "Light");
+ result = QCoreApplication::translate("QFontDatabase", "Light");
if (style == QFont::StyleItalic)
- result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Italic");
+ result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
else if (style == QFont::StyleOblique)
- result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Oblique");
+ result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
if (result.isEmpty())
- result = QApplication::translate("QFontDatabase", "Normal");
+ result = QCoreApplication::translate("QFontDatabase", "Normal");
return result.simplified();
}
@@ -2002,7 +2002,7 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
QtFontFoundry allStyles(foundryName);
QtFontFamily *f = d->family(familyName);
- if (!f) return QApplication::font();
+ if (!f) return QGuiApplication::font();
for (int j = 0; j < f->count; j++) {
QtFontFoundry *foundry = f->foundries[j];
@@ -2016,7 +2016,7 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
QtFontStyle *s = bestStyle(&allStyles, styleKey);
if (!s) // no styles found?
- return QApplication::font();
+ return QGuiApplication::font();
QFont fnt(family, pointSize, s->key.weight);
fnt.setStyle((QFont::Style)s->key.style);
return fnt;
@@ -2326,7 +2326,7 @@ QString QFontDatabase::writingSystemName(WritingSystem writingSystem)
Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter");
break;
}
- return QApplication::translate("QFontDatabase", name);
+ return QCoreApplication::translate("QFontDatabase", name);
}
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index ae1130eadc..c9ca5dcb60 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -45,10 +45,6 @@
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
#include <QtGui/qfont.h>
-#ifdef QT3_SUPPORT
-#include <QtCore/qstringlist.h>
-#include <QtCore/qlist.h>
-#endif
QT_BEGIN_HEADER
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 7bcce56ac8..fcf87f6379 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -45,7 +45,7 @@
#include "qfontengine_qpa_p.h"
#include "qplatformdefs.h"
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qplatformfontdatabase_qpa.h>
#include <QtCore/qmath.h>
@@ -82,7 +82,7 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou
static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script)
{
- QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
+ QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
QFontDatabasePrivate *db = privateDb();
QStringList::iterator i;
@@ -109,28 +109,11 @@ static void initializeDb()
if (!initialized) {
//init by asking for the platformfontdb for the first time :)
- QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
initialized = true;
}
}
-#ifndef QT_NO_SETTINGS
-// called from qapplication_qws.cpp
-void qt_applyFontDatabaseSettings(const QSettings &settings)
-{
- initializeDb();
- QFontDatabasePrivate *db = privateDb();
- for (int i = 0; i < db->count; ++i) {
- QtFontFamily *family = db->families[i];
- if (settings.contains(family->name))
- family->fallbackFamilies = settings.value(family->name).toStringList();
- }
-
- if (settings.contains(QLatin1String("Global Fallbacks")))
- db->fallbackFamilies = settings.value(QLatin1String("Global Fallbacks")).toStringList();
-}
-#endif // QT_NO_SETTINGS
-
static inline void load(const QString & = QString(), int = -1)
{
initializeDb();
@@ -155,7 +138,7 @@ QFontEngine *loadSingleEngine(int script,
QFontCache::Key key(def,script);
QFontEngine *engine = QFontCache::instance()->findEngine(key);
if (!engine) {
- QPlatformFontDatabase *pfdb = QApplicationPrivate::platformIntegration()->fontDatabase();
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle);
if (engine) {
QFontCache::Key key(def,script);
@@ -200,7 +183,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
{
QFontDatabasePrivate *db = privateDb();
- fnt->families = QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
+ fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
db->reregisterAppFonts = true;
}
@@ -360,7 +343,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
family_list = familyList(req);
// add the default family
- QString defaultFamily = QApplication::font().family();
+ QString defaultFamily = QGuiApplication::font().family();
if (! family_list.contains(defaultFamily))
family_list << defaultFamily;
diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp
deleted file mode 100644
index d076de05d3..0000000000
--- a/src/gui/text/qfontdatabase_qws.cpp
+++ /dev/null
@@ -1,975 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdir.h"
-#if defined(Q_WS_QWS)
-#include "qscreen_qws.h" //so we can check for rotation
-#include "qwindowsystem_qws.h"
-#endif
-#include "qlibraryinfo.h"
-#include "qabstractfileengine.h"
-#include <QtCore/qsettings.h>
-#if !defined(QT_NO_FREETYPE)
-#include "qfontengine_ft_p.h"
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#endif
-#include "qfontengine_qpf_p.h"
-#include "private/qfactoryloader_p.h"
-#include "private/qcore_unix_p.h" // overrides QT_OPEN
-#include "qabstractfontengine_qws.h"
-#include "qabstractfontengine_p.h"
-#include <qdatetime.h>
-#include "qplatformdefs.h"
-
-// for mmap
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#ifdef QT_FONTS_ARE_RESOURCES
-#include <qresource.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QFontEngineFactoryInterface_iid, QLatin1String("/fontengines"), Qt::CaseInsensitive))
-#endif
-
-const quint8 DatabaseVersion = 4;
-
-// QFontDatabasePrivate::addFont() went into qfontdatabase.cpp
-
-#ifndef QT_NO_QWS_QPF2
-void QFontDatabasePrivate::addQPF2File(const QByteArray &file)
-{
-#ifndef QT_FONTS_ARE_RESOURCES
- struct stat st;
- if (stat(file.constData(), &st))
- return;
- int f = QT_OPEN(file, O_RDONLY, 0);
- if (f < 0)
- return;
- const uchar *data = (const uchar *)mmap(0, st.st_size, PROT_READ, MAP_SHARED, f, 0);
- const int dataSize = st.st_size;
-#else
- QResource res(QLatin1String(file.constData()));
- const uchar *data = res.data();
- const int dataSize = res.size();
- //qDebug() << "addQPF2File" << file << data;
-#endif
- if (data && data != (const uchar *)MAP_FAILED) {
- if (QFontEngineQPF::verifyHeader(data, dataSize)) {
- QString fontName = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_FontName).toString();
- int pixelSize = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_PixelSize).toInt();
- QVariant weight = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_Weight);
- QVariant style = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_Style);
- QByteArray writingSystemBits = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_WritingSystems).toByteArray();
-
- if (!fontName.isEmpty() && pixelSize) {
- int fontWeight = 50;
- if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt)
- fontWeight = weight.toInt();
-
- bool italic = static_cast<QFont::Style>(style.toInt()) & QFont::StyleItalic;
-
- QList<QFontDatabase::WritingSystem> writingSystems;
- for (int i = 0; i < writingSystemBits.count(); ++i) {
- uchar currentByte = writingSystemBits.at(i);
- for (int j = 0; j < 8; ++j) {
- if (currentByte & 1)
- writingSystems << QFontDatabase::WritingSystem(i * 8 + j);
- currentByte >>= 1;
- }
- }
-
- addFont(fontName, /*foundry*/ "prerendered", fontWeight, italic,
- pixelSize, file, /*fileIndex*/ 0,
- /*antialiased*/ true, writingSystems);
- }
- } else {
- qDebug() << "header verification of QPF2 font" << file << "failed. maybe it is corrupt?";
- }
-#ifndef QT_FONTS_ARE_RESOURCES
- munmap((void *)data, st.st_size);
-#endif
- }
-#ifndef QT_FONTS_ARE_RESOURCES
- QT_CLOSE(f);
-#endif
-}
-#endif // QT_NO_QWS_QPF2
-
-// QFontDatabasePrivate::addTTFile() went into qfontdatabase.cpp
-
-static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt);
-
-extern QString qws_fontCacheDir();
-
-#ifndef QT_FONTS_ARE_RESOURCES
-bool QFontDatabasePrivate::loadFromCache(const QString &fontPath)
-{
-#ifdef Q_WS_QWS
- const bool weAreTheServer = QWSServer::instance();
-#else
- const bool weAreTheServer = true; // assume single-process
-#endif
-
- QString fontDirFile = fontPath + QLatin1String("/fontdir");
-
- QFile binaryDb(qws_fontCacheDir() + QLatin1String("/fontdb"));
-
- if (weAreTheServer) {
- QDateTime dbTimeStamp = QFileInfo(binaryDb.fileName()).lastModified();
-
- QDateTime fontPathTimeStamp = QFileInfo(fontPath).lastModified();
- if (dbTimeStamp < fontPathTimeStamp)
- return false; // let the caller create the cache
-
- if (QFile::exists(fontDirFile)) {
- QDateTime fontDirTimeStamp = QFileInfo(fontDirFile).lastModified();
- if (dbTimeStamp < fontDirTimeStamp)
- return false;
- }
- }
-
- if (!binaryDb.open(QIODevice::ReadOnly)) {
- if (weAreTheServer)
- return false; // let the caller create the cache
- qFatal("QFontDatabase::loadFromCache: Could not open font database cache!");
- }
-
- QDataStream stream(&binaryDb);
- quint8 version = 0;
- quint8 dataStreamVersion = 0;
- stream >> version >> dataStreamVersion;
- if (version != DatabaseVersion || dataStreamVersion != stream.version()) {
- if (weAreTheServer)
- return false; // let the caller create the cache
- qFatal("QFontDatabase::loadFromCache: Wrong version of the font database cache detected. Found %d/%d expected %d/%d",
- version, dataStreamVersion, DatabaseVersion, stream.version());
- }
-
- QString originalFontPath;
- stream >> originalFontPath;
- if (originalFontPath != fontPath) {
- if (weAreTheServer)
- return false; // let the caller create the cache
- qFatal("QFontDatabase::loadFromCache: Font path doesn't match. Found %s in database, expected %s", qPrintable(originalFontPath), qPrintable(fontPath));
- }
-
- QString familyname;
- stream >> familyname;
- //qDebug() << "populating database from" << binaryDb.fileName();
- while (!familyname.isEmpty() && !stream.atEnd()) {
- QString foundryname;
- int weight;
- quint8 italic;
- int pixelSize;
- QByteArray file;
- int fileIndex;
- quint8 antialiased;
- quint8 writingSystemCount;
-
- QList<QFontDatabase::WritingSystem> writingSystems;
-
- stream >> foundryname >> weight >> italic >> pixelSize
- >> file >> fileIndex >> antialiased >> writingSystemCount;
-
- for (quint8 i = 0; i < writingSystemCount; ++i) {
- quint8 ws;
- stream >> ws;
- writingSystems.append(QFontDatabase::WritingSystem(ws));
- }
-
- addFont(familyname, foundryname.toLatin1().constData(), weight, italic, pixelSize, file, fileIndex, antialiased,
- writingSystems);
-
- stream >> familyname;
- }
-
- stream >> fallbackFamilies;
- //qDebug() << "fallback families from cache:" << fallbackFamilies;
- return true;
-}
-#endif // QT_FONTS_ARE_RESOURCES
-
-/*!
- \internal
-*/
-
-static QString qwsFontPath()
-{
- QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QWS_FONTDIR"));
- if (fontpath.isEmpty()) {
-#ifdef QT_FONTS_ARE_RESOURCES
- fontpath = QLatin1String(":/qt/fonts");
-#else
-#ifndef QT_NO_SETTINGS
- fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
- fontpath += QLatin1String("/fonts");
-#else
- fontpath = QLatin1String("/lib/fonts");
-#endif
-#endif //QT_FONTS_ARE_RESOURCES
- }
-
- return fontpath;
-}
-
-#if defined(QFONTDATABASE_DEBUG) && defined(QT_FONTS_ARE_RESOURCES)
-class FriendlyResource : public QResource
-{
-public:
- bool isDir () const { return QResource::isDir(); }
- bool isFile () const { return QResource::isFile(); }
- QStringList children () const { return QResource::children(); }
-};
-#endif
-/*!
- \internal
-*/
-static void initializeDb()
-{
- QFontDatabasePrivate *db = privateDb();
- if (!db || db->count)
- return;
-
- QString fontpath = qwsFontPath();
-#ifndef QT_FONTS_ARE_RESOURCES
- QString fontDirFile = fontpath + QLatin1String("/fontdir");
-
- if(!QFile::exists(fontpath)) {
- qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?",
- fontpath.toLocal8Bit().constData());
- }
-
- const bool loaded = db->loadFromCache(fontpath);
-
- if (db->reregisterAppFonts) {
- db->reregisterAppFonts = false;
- for (int i = 0; i < db->applicationFonts.count(); ++i)
- if (!db->applicationFonts.at(i).families.isEmpty()) {
- registerFont(&db->applicationFonts[i]);
- }
- }
-
- if (loaded)
- return;
-
- QString dbFileName = qws_fontCacheDir() + QLatin1String("/fontdb");
-
- QFile binaryDb(dbFileName + QLatin1String(".tmp"));
- binaryDb.open(QIODevice::WriteOnly | QIODevice::Truncate);
- db->stream = new QDataStream(&binaryDb);
- *db->stream << DatabaseVersion << quint8(db->stream->version()) << fontpath;
-// qDebug() << "creating binary database at" << binaryDb.fileName();
-
- // Load in font definition file
- FILE* fontdef=fopen(fontDirFile.toLocal8Bit().constData(),"r");
- if (fontdef) {
- char buf[200]="";
- char name[200]="";
- char render[200]="";
- char file[200]="";
- char isitalic[10]="";
- char flags[10]="";
- do {
- fgets(buf,200,fontdef);
- if (buf[0] != '#') {
- int weight=50;
- int size=0;
- sscanf(buf,"%s %s %s %s %d %d %s",name,file,render,isitalic,&weight,&size,flags);
- QString filename;
- if (file[0] != '/')
- filename.append(fontpath).append(QLatin1Char('/'));
- filename += QLatin1String(file);
- bool italic = isitalic[0] == 'y';
- bool smooth = QByteArray(flags).contains('s');
- if (file[0] && QFile::exists(filename))
- db->addFont(QString::fromUtf8(name), /*foundry*/"", weight, italic, size/10, QFile::encodeName(filename), /*fileIndex*/ 0, smooth);
- }
- } while (!feof(fontdef));
- fclose(fontdef);
- }
-
-
- QDir dir(fontpath, QLatin1String("*.qpf"));
- for (int i=0; i<int(dir.count()); i++) {
- int u0 = dir[i].indexOf(QLatin1Char('_'));
- int u1 = dir[i].indexOf(QLatin1Char('_'), u0+1);
- int u2 = dir[i].indexOf(QLatin1Char('_'), u1+1);
- int u3 = dir[i].indexOf(QLatin1Char('.'), u1+1);
- if (u2 < 0) u2 = u3;
-
- QString familyname = dir[i].left(u0);
- int pixelSize = dir[i].mid(u0+1,u1-u0-1).toInt()/10;
- bool italic = dir[i].mid(u2-1,1) == QLatin1String("i");
- int weight = dir[i].mid(u1+1,u2-u1-1-(italic?1:0)).toInt();
-
- db->addFont(familyname, /*foundry*/ "qt", weight, italic, pixelSize, QFile::encodeName(dir.absoluteFilePath(dir[i])),
- /*fileIndex*/ 0, /*antialiased*/ true);
- }
-
-#ifndef QT_NO_FREETYPE
- dir.setNameFilters(QStringList() << QLatin1String("*.ttf")
- << QLatin1String("*.ttc") << QLatin1String("*.pfa")
- << QLatin1String("*.pfb"));
- dir.refresh();
- for (int i = 0; i < int(dir.count()); ++i) {
- const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
-// qDebug() << "looking at" << file;
- db->addTTFile(file);
- }
-#endif
-
-#ifndef QT_NO_QWS_QPF2
- dir.setNameFilters(QStringList() << QLatin1String("*.qpf2"));
- dir.refresh();
- for (int i = 0; i < int(dir.count()); ++i) {
- const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
-// qDebug() << "looking at" << file;
- db->addQPF2File(file);
- }
-#endif
-
-#else //QT_FONTS_ARE_RESOURCES
-#ifdef QFONTDATABASE_DEBUG
- {
- QResource fontdir(fontpath);
- FriendlyResource *fr = static_cast<FriendlyResource*>(&fontdir);
- qDebug() << "fontdir" << fr->isValid() << fr->isDir() << fr->children();
-
- }
-#endif
-#ifndef QT_NO_QWS_QPF2
- QDir dir(fontpath, QLatin1String("*.qpf2"));
- for (int i = 0; i < int(dir.count()); ++i) {
- const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
- //qDebug() << "looking at" << file;
- db->addQPF2File(file);
- }
-#endif
-#endif //QT_FONTS_ARE_RESOURCES
-
-
-#ifdef QFONTDATABASE_DEBUG
- // print the database
- for (int f = 0; f < db->count; f++) {
- QtFontFamily *family = db->families[f];
- FD_DEBUG("'%s' %s", qPrintable(family->name), (family->fixedPitch ? "fixed" : ""));
-#if 0
- for (int i = 0; i < QFont::LastPrivateScript; ++i) {
- FD_DEBUG("\t%s: %s", qPrintable(QFontDatabase::scriptName((QFont::Script) i)),
- ((family->scripts[i] & QtFontFamily::Supported) ? "Supported" :
- (family->scripts[i] & QtFontFamily::UnSupported) == QtFontFamily::UnSupported ?
- "UnSupported" : "Unknown"));
- }
-#endif
-
- for (int fd = 0; fd < family->count; fd++) {
- QtFontFoundry *foundry = family->foundries[fd];
- FD_DEBUG("\t\t'%s'", qPrintable(foundry->name));
- for (int s = 0; s < foundry->count; s++) {
- QtFontStyle *style = foundry->styles[s];
- FD_DEBUG("\t\t\tstyle: style=%d weight=%d\n"
- "\t\t\tstretch=%d",
- style->key.style, style->key.weight,
- style->key.stretch);
- if (style->smoothScalable)
- FD_DEBUG("\t\t\t\tsmooth scalable");
- else if (style->bitmapScalable)
- FD_DEBUG("\t\t\t\tbitmap scalable");
- if (style->pixelSizes) {
- FD_DEBUG("\t\t\t\t%d pixel sizes", style->count);
- for (int z = 0; z < style->count; ++z) {
- QtFontSize *size = style->pixelSizes + z;
- FD_DEBUG("\t\t\t\t size %5d",
- size->pixelSize);
- }
- }
- }
- }
- }
-#endif // QFONTDATABASE_DEBUG
-
-#ifndef QT_NO_LIBRARY
- QStringList pluginFoundries = loader()->keys();
-// qDebug() << "plugin foundries:" << pluginFoundries;
- for (int i = 0; i < pluginFoundries.count(); ++i) {
- const QString foundry(pluginFoundries.at(i));
-
- QFontEngineFactoryInterface *factory = qobject_cast<QFontEngineFactoryInterface *>(loader()->instance(foundry));
- if (!factory) {
- qDebug() << "Could not load plugin for foundry" << foundry;
- continue;
- }
-
- QList<QFontEngineInfo> fonts = factory->availableFontEngines();
- for (int i = 0; i < fonts.count(); ++i) {
- QFontEngineInfo info = fonts.at(i);
-
- int weight = info.weight();
- if (weight <= 0)
- weight = QFont::Normal;
-
- db->addFont(info.family(), foundry.toLatin1().constData(),
- weight, info.style() != QFont::StyleNormal,
- qRound(info.pixelSize()), /*file*/QByteArray(),
- /*fileIndex*/0, /*antiAliased*/true,
- info.writingSystems());
- }
- }
-#endif
-
-#ifndef QT_FONTS_ARE_RESOURCES
- // the empty string/familyname signifies the end of the font list.
- *db->stream << QString();
-#endif
- {
- bool coveredWritingSystems[QFontDatabase::WritingSystemsCount] = { 0 };
-
- db->fallbackFamilies.clear();
-
- for (int i = 0; i < db->count; ++i) {
- QtFontFamily *family = db->families[i];
- bool add = false;
- if (family->count == 0)
- continue;
- if (family->bogusWritingSystems)
- continue;
- for (int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) {
- if (coveredWritingSystems[ws])
- continue;
- if (family->writingSystems[ws] & QtFontFamily::Supported) {
- coveredWritingSystems[ws] = true;
- add = true;
- }
- }
- if (add)
- db->fallbackFamilies << family->name;
- }
- //qDebug() << "fallbacks on the server:" << db->fallbackFamilies;
-#ifndef QT_FONTS_ARE_RESOURCES
- *db->stream << db->fallbackFamilies;
-#endif
- }
-#ifndef QT_FONTS_ARE_RESOURCES
- delete db->stream;
- db->stream = 0;
- QFile::remove(dbFileName);
- binaryDb.rename(dbFileName);
-#endif
-}
-
-// called from qwindowsystem_qws.cpp
-void qt_qws_init_fontdb()
-{
- initializeDb();
-}
-
-#ifndef QT_NO_SETTINGS
-// called from qapplication_qws.cpp
-void qt_applyFontDatabaseSettings(const QSettings &settings)
-{
- initializeDb();
- QFontDatabasePrivate *db = privateDb();
- for (int i = 0; i < db->count; ++i) {
- QtFontFamily *family = db->families[i];
- if (settings.contains(family->name))
- family->fallbackFamilies = settings.value(family->name).toStringList();
- }
-
- if (settings.contains(QLatin1String("Global Fallbacks")))
- db->fallbackFamilies = settings.value(QLatin1String("Global Fallbacks")).toStringList();
-}
-#endif // QT_NO_SETTINGS
-
-static inline void load(const QString & = QString(), int = -1)
-{
- initializeDb();
-}
-
-#ifndef QT_NO_FREETYPE
-
-#if (FREETYPE_MAJOR*10000+FREETYPE_MINOR*100+FREETYPE_PATCH) >= 20105
-#define X_SIZE(face,i) ((face)->available_sizes[i].x_ppem)
-#define Y_SIZE(face,i) ((face)->available_sizes[i].y_ppem)
-#else
-#define X_SIZE(face,i) ((face)->available_sizes[i].width << 6)
-#define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6)
-#endif
-
-#endif // QT_NO_FREETYPE
-
-static
-QFontEngine *loadSingleEngine(int script, const QFontPrivate *fp,
- const QFontDef &request,
- QtFontFamily *family, QtFontFoundry *foundry,
- QtFontStyle *style, QtFontSize *size)
-{
- Q_UNUSED(script);
- Q_UNUSED(fp);
-#ifdef QT_NO_FREETYPE
- Q_UNUSED(foundry);
-#endif
-#ifdef QT_NO_QWS_QPF
- Q_UNUSED(family);
-#endif
- Q_ASSERT(size);
-
- int pixelSize = size->pixelSize;
- if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE))
- pixelSize = request.pixelSize;
-
-#ifndef QT_NO_QWS_QPF2
- if (foundry->name == QLatin1String("prerendered")) {
-#ifdef QT_FONTS_ARE_RESOURCES
- QResource res(QLatin1String(size->fileName.constData()));
- if (res.isValid()) {
- QFontEngineQPF *fe = new QFontEngineQPF(request, res.data(), res.size());
- if (fe->isValid())
- return fe;
- delete fe;
- qDebug() << "fontengine is not valid! " << size->fileName;
- } else {
- qDebug() << "Resource not valid" << size->fileName;
- }
-#else
- int f = ::open(size->fileName, O_RDONLY, 0);
- if (f >= 0) {
- QFontEngineQPF *fe = new QFontEngineQPF(request, f);
- if (fe->isValid())
- return fe;
- delete fe; // will close f
- qDebug() << "fontengine is not valid!";
- }
-#endif
- } else
-#endif
- if ( foundry->name != QLatin1String("qt") ) { ///#### is this the best way????
- QString file = QFile::decodeName(size->fileName);
-
- QFontDef def = request;
- def.pixelSize = pixelSize;
-
-#ifdef QT_NO_QWS_SHARE_FONTS
- bool shareFonts = false;
-#else
- static bool dontShareFonts = !qgetenv("QWS_NO_SHARE_FONTS").isEmpty();
- bool shareFonts = !dontShareFonts;
-#endif
-
- QScopedPointer<QFontEngine> engine;
-
-#ifndef QT_NO_LIBRARY
- QFontEngineFactoryInterface *factory = qobject_cast<QFontEngineFactoryInterface *>(loader()->instance(foundry->name));
- if (factory) {
- QFontEngineInfo info;
- info.setFamily(request.family);
- info.setPixelSize(request.pixelSize);
- info.setStyle(QFont::Style(request.style));
- info.setWeight(request.weight);
- // #### antialiased
-
- QAbstractFontEngine *customEngine = factory->create(info);
- if (customEngine) {
- engine.reset(new QProxyFontEngine(customEngine, def));
-
- if (shareFonts) {
- QVariant hint = customEngine->fontProperty(QAbstractFontEngine::CacheGlyphsHint);
- if (hint.isValid())
- shareFonts = hint.toBool();
- else
- shareFonts = (pixelSize < 64);
- }
- }
- }
-#endif // QT_NO_LIBRARY
- if ((engine.isNull() && !file.isEmpty() && QFile::exists(file)) || privateDb()->isApplicationFont(file)) {
- QFontEngine::FaceId faceId;
- faceId.filename = file.toLocal8Bit();
- faceId.index = size->fileIndex;
-
-#ifndef QT_NO_FREETYPE
-
- QScopedPointer<QFontEngineFT> fte(new QFontEngineFT(def));
- bool antialias = style->antialiased && !(request.styleStrategy & QFont::NoAntialias);
- if (fte->init(faceId, antialias,
- antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono)) {
-#ifdef QT_NO_QWS_QPF2
- return fte.take();
-#else
- // try to distinguish between bdf and ttf fonts we can pre-render
- // and don't try to share outline fonts
- shareFonts = shareFonts
- && !fte->defaultGlyphs()->outline_drawing
- && !fte->getSfntTable(MAKE_TAG('h', 'e', 'a', 'd')).isEmpty();
- engine.reset(fte.take());
-#endif
- }
-#endif // QT_NO_FREETYPE
- }
- if (!engine.isNull()) {
-#if !defined(QT_NO_QWS_QPF2) && !defined(QT_FONTS_ARE_RESOURCES)
- if (shareFonts) {
- QScopedPointer<QFontEngineQPF> fe(new QFontEngineQPF(def, -1, engine.data()));
- engine.take();
- if (fe->isValid())
- return fe.take();
- qWarning("Initializing QFontEngineQPF failed for %s", qPrintable(file));
- engine.reset(fe->takeRenderingEngine());
- }
-#endif
- return engine.take();
- }
- } else
- {
-#ifndef QT_NO_QWS_QPF
- QString fn = qwsFontPath();
- fn += QLatin1Char('/');
- fn += family->name.toLower()
- + QLatin1Char('_') + QString::number(pixelSize*10)
- + QLatin1Char('_') + QString::number(style->key.weight)
- + (style->key.style == QFont::StyleItalic ?
- QLatin1String("i.qpf") : QLatin1String(".qpf"));
- //###rotation ###
-
- QFontEngine *fe = new QFontEngineQPF1(request, fn);
- return fe;
-#endif // QT_NO_QWS_QPF
- }
- return new QFontEngineBox(pixelSize);
-}
-
-static
-QFontEngine *loadEngine(int script, const QFontPrivate *fp,
- const QFontDef &request,
- QtFontFamily *family, QtFontFoundry *foundry,
- QtFontStyle *style, QtFontSize *size)
-{
- QScopedPointer<QFontEngine> engine(loadSingleEngine(script, fp, request, family, foundry,
- style, size));
-#ifndef QT_NO_QWS_QPF
- if (!engine.isNull()
- && script == QUnicodeTables::Common
- && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) {
-
- QStringList fallbacks = privateDb()->fallbackFamilies;
-
- if (family && !family->fallbackFamilies.isEmpty())
- fallbacks = family->fallbackFamilies;
-
- QFontEngine *fe = new QFontEngineMultiQWS(engine.data(), script, fallbacks);
- engine.take();
- engine.reset(fe);
- }
-#endif
- return engine.take();
-}
-
-static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
-{
- QFontDatabasePrivate *db = privateDb();
-#ifdef QT_NO_FREETYPE
- Q_UNUSED(fnt);
-#else
- fnt->families = db->addTTFile(QFile::encodeName(fnt->fileName), fnt->data);
- db->fallbackFamilies += fnt->families;
-#endif
- db->reregisterAppFonts = true;
-}
-
-bool QFontDatabase::removeApplicationFont(int handle)
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- QFontDatabasePrivate *db = privateDb();
- if (handle < 0 || handle >= db->applicationFonts.count())
- return false;
-
- db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont();
-
- db->reregisterAppFonts = true;
- db->invalidate();
- return true;
-}
-
-bool QFontDatabase::removeAllApplicationFonts()
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- QFontDatabasePrivate *db = privateDb();
- if (db->applicationFonts.isEmpty())
- return false;
-
- db->applicationFonts.clear();
- db->invalidate();
- return true;
-}
-
-bool QFontDatabase::supportsThreadedFontRendering()
-{
- return true;
-}
-
-/*!
- \internal
-*/
-QFontEngine *
-QFontDatabase::findFont(int script, const QFontPrivate *fp,
- const QFontDef &request)
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- const int force_encoding_id = -1;
-
- if (!privateDb()->count)
- initializeDb();
-
- QScopedPointer<QFontEngine> fe;
- if (fp) {
- if (fp->rawMode) {
- fe.reset(loadEngine(script, fp, request, 0, 0, 0, 0));
-
- // if we fail to load the rawmode font, use a 12pixel box engine instead
- if (fe.isNull())
- fe.reset(new QFontEngineBox(12));
- return fe.take();
- }
-
- QFontCache::Key key(request, script);
- fe.reset(QFontCache::instance()->findEngine(key));
- if (! fe.isNull())
- return fe.take();
- }
-
- QString family_name, foundry_name;
- QtFontStyle::Key styleKey;
- styleKey.style = request.style;
- styleKey.weight = request.weight;
- styleKey.stretch = request.stretch;
- char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
-
- parseFontName(request.family, foundry_name, family_name);
-
- FM_DEBUG("QFontDatabase::findFont\n"
- " request:\n"
- " family: %s [%s], script: %d\n"
- " weight: %d, style: %d\n"
- " stretch: %d\n"
- " pixelSize: %g\n"
- " pitch: %c",
- family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(),
- foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(),
- script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
-
- if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
- fe.reset(new QTestFontEngine(request.pixelSize));
- fe->fontDef = request;
- }
-
- if (fe.isNull())
- {
- QtFontDesc desc;
- match(script, request, family_name, foundry_name, force_encoding_id, &desc);
-
- if (desc.family != 0 && desc.foundry != 0 && desc.style != 0
- ) {
- FM_DEBUG(" BEST:\n"
- " family: %s [%s]\n"
- " weight: %d, style: %d\n"
- " stretch: %d\n"
- " pixelSize: %d\n"
- " pitch: %c\n"
- " encoding: %d\n",
- desc.family->name.toLatin1().constData(),
- desc.foundry->name.isEmpty() ? "-- none --" : desc.foundry->name.toLatin1().constData(),
- desc.style->key.weight, desc.style->key.style,
- desc.style->key.stretch, desc.size ? desc.size->pixelSize : 0xffff,
- 'p', 0
- );
-
- fe.reset(loadEngine(script, fp, request, desc.family, desc.foundry, desc.style, desc.size
- ));
- } else {
- FM_DEBUG(" NO MATCH FOUND\n");
- }
- if (! fe.isNull())
- initFontDef(desc, request, &fe->fontDef);
- }
-
-#ifndef QT_NO_FREETYPE
- if (! fe.isNull()) {
- if (scriptRequiresOpenType(script) && fe->type() == QFontEngine::Freetype) {
- HB_Face hbFace = static_cast<QFontEngineFT *>(fe.data())->harfbuzzFace();
- if (!hbFace || !hbFace->supported_scripts[script]) {
- FM_DEBUG(" OpenType support missing for script\n");
- fe.reset(0);
- }
- }
- }
-#endif
-
- if (! fe.isNull()) {
- if (fp) {
- QFontDef def = request;
- if (def.family.isEmpty()) {
- def.family = fp->request.family;
- def.family = def.family.left(def.family.indexOf(QLatin1Char(',')));
- }
- QFontCache::Key key(def, script);
- QFontCache::instance()->insertEngine(key, fe.data());
- }
- }
-
- if (fe.isNull()) {
- if (!request.family.isEmpty())
- return 0;
-
- FM_DEBUG("returning box engine");
-
- fe.reset(new QFontEngineBox(request.pixelSize));
-
- if (fp) {
- QFontCache::Key key(request, script);
- QFontCache::instance()->insertEngine(key, fe.data());
- }
- }
-
- if (fp && fp->dpi > 0) {
- fe->fontDef.pointSize = qreal(double((fe->fontDef.pixelSize * 72) / fp->dpi));
- } else {
- fe->fontDef.pointSize = request.pointSize;
- }
-
- return fe.take();
-}
-
-void QFontDatabase::load(const QFontPrivate *d, int script)
-{
- QFontDef req = d->request;
-
- if (req.pixelSize == -1)
- req.pixelSize = qRound(req.pointSize*d->dpi/72);
- if (req.pointSize < 0)
- req.pointSize = req.pixelSize*72.0/d->dpi;
-
- if (!d->engineData) {
- QFontCache::Key key(req, script);
-
- // look for the requested font in the engine data cache
- d->engineData = QFontCache::instance()->findEngineData(key);
-
- if (!d->engineData) {
- // create a new one
- d->engineData = new QFontEngineData;
- QT_TRY {
- QFontCache::instance()->insertEngineData(key, d->engineData);
- } QT_CATCH(...) {
- delete d->engineData;
- d->engineData = 0;
- QT_RETHROW;
- }
- } else {
- d->engineData->ref.ref();
- }
- }
-
- // the cached engineData could have already loaded the engine we want
- if (d->engineData->engines[script]) return;
-
- // double scale = 1.0; // ### TODO: fix the scale calculations
-
- // list of families to try
- QStringList family_list;
-
- if (!req.family.isEmpty()) {
- family_list = req.family.split(QLatin1Char(','));
-
- // append the substitute list for each family in family_list
- QStringList subs_list;
- QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd();
- for (; it != end; ++it)
- subs_list += QFont::substitutes(*it);
- family_list += subs_list;
-
- // append the default fallback font for the specified script
- // family_list << ... ; ###########
-
- // add the default family
- QString defaultFamily = QApplication::font().family();
- if (! family_list.contains(defaultFamily))
- family_list << defaultFamily;
-
- // add QFont::defaultFamily() to the list, for compatibility with
- // previous versions
- family_list << QApplication::font().defaultFamily();
- }
-
- // null family means find the first font matching the specified script
- family_list << QString();
-
- // load the font
- QFontEngine *engine = 0;
- QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd();
- for (; !engine && it != end; ++it) {
- req.family = *it;
-
- engine = QFontDatabase::findFont(script, d, req);
- if (engine && (engine->type()==QFontEngine::Box) && !req.family.isEmpty())
- engine = 0;
- }
-
- engine->ref.ref();
- d->engineData->engines[script] = engine;
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index 851bb5964c..b1d25b7d0f 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -46,7 +46,6 @@
#include <QtCore/QDir>
#include <QtCore/QBuffer>
-#include <QtGui/private/qapplication_p.h>
#include <QtGui/QPlatformFontDatabase>
#include <QtGui/private/qpaintengine_raster_p.h>
diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp
deleted file mode 100644
index b71c4a7aba..0000000000
--- a/src/gui/text/qfontengine_qws.cpp
+++ /dev/null
@@ -1,665 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfontengine_p.h"
-#include <private/qunicodetables_p.h>
-#include <qwsdisplay_qws.h>
-#include <qvarlengtharray.h>
-#include <private/qpainter_p.h>
-#include <private/qpaintengine_raster_p.h>
-#include <private/qpdf_p.h>
-#include "qtextengine_p.h"
-#include "private/qcore_unix_p.h" // overrides QT_OPEN
-
-#include <qdebug.h>
-
-
-#ifndef QT_NO_QWS_QPF
-
-#include "qfile.h"
-#include "qdir.h"
-
-#define QT_USE_MMAP
-#include <stdlib.h>
-
-#ifdef QT_USE_MMAP
-// for mmap
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <errno.h>
-
-# if defined(QT_LINUXBASE) && !defined(MAP_FILE)
- // LSB 3.2 does not define MAP_FILE
-# define MAP_FILE 0
-# endif
-
-#endif
-
-#endif // QT_NO_QWS_QPF
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_QWS_QPF
-QT_BEGIN_INCLUDE_NAMESPACE
-#include "qplatformdefs.h"
-QT_END_INCLUDE_NAMESPACE
-
-static inline unsigned int getChar(const QChar *str, int &i, const int len)
-{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
- }
- return uc;
-}
-
-#define FM_SMOOTH 1
-
-
-class Q_PACKED QPFGlyphMetrics {
-
-public:
- quint8 linestep;
- quint8 width;
- quint8 height;
- quint8 flags;
-
- qint8 bearingx; // Difference from pen position to glyph's left bbox
- quint8 advance; // Difference between pen positions
- qint8 bearingy; // Used for putting characters on baseline
-
- qint8 reserved; // Do not use
-
- // Flags:
- // RendererOwnsData - the renderer is responsible for glyph data
- // memory deletion otherwise QPFGlyphTree must
- // delete [] the data when the glyph is deleted.
- enum Flags { RendererOwnsData=0x01 };
-};
-
-class QPFGlyph {
-public:
- QPFGlyph() { metrics=0; data=0; }
- QPFGlyph(QPFGlyphMetrics* m, uchar* d) :
- metrics(m), data(d) { }
- ~QPFGlyph() {}
-
- QPFGlyphMetrics* metrics;
- uchar* data;
-};
-
-struct Q_PACKED QPFFontMetrics{
- qint8 ascent,descent;
- qint8 leftbearing,rightbearing;
- quint8 maxwidth;
- qint8 leading;
- quint8 flags;
- quint8 underlinepos;
- quint8 underlinewidth;
- quint8 reserved3;
-};
-
-
-class QPFGlyphTree {
-public:
- /* reads in a tree like this:
-
- A-Z
- / \
- 0-9 a-z
-
- etc.
-
- */
- glyph_t min,max;
- QPFGlyphTree* less;
- QPFGlyphTree* more;
- QPFGlyph* glyph;
-public:
-#ifdef QT_USE_MMAP
- QPFGlyphTree(uchar*& data)
- {
- read(data);
- }
-#else
- QPFGlyphTree(QIODevice& f)
- {
- read(f);
- }
-#endif
-
- ~QPFGlyphTree()
- {
- // NOTE: does not delete glyph[*].metrics or .data.
- // the caller does this (only they know who owns
- // the data). See clear().
- delete less;
- delete more;
- delete [] glyph;
- }
-
- bool inFont(glyph_t g) const
- {
- if ( g < min ) {
- if ( !less )
- return false;
- return less->inFont(g);
- } else if ( g > max ) {
- if ( !more )
- return false;
- return more->inFont(g);
- }
- return true;
- }
-
- QPFGlyph* get(glyph_t g)
- {
- if ( g < min ) {
- if ( !less )
- return 0;
- return less->get(g);
- } else if ( g > max ) {
- if ( !more )
- return 0;
- return more->get(g);
- }
- return &glyph[g - min];
- }
- int totalChars() const
- {
- if ( !this ) return 0;
- return max-min+1 + less->totalChars() + more->totalChars();
- }
- int weight() const
- {
- if ( !this ) return 0;
- return 1 + less->weight() + more->weight();
- }
-
- void dump(int indent=0)
- {
- for (int i=0; i<indent; i++) printf(" ");
- printf("%d..%d",min,max);
- //if ( indent == 0 )
- printf(" (total %d)",totalChars());
- printf("\n");
- if ( less ) less->dump(indent+1);
- if ( more ) more->dump(indent+1);
- }
-
-private:
- QPFGlyphTree()
- {
- }
-
-#ifdef QT_USE_MMAP
- void read(uchar*& data)
- {
- // All node data first
- readNode(data);
- // Then all non-video data
- readMetrics(data);
- // Then all video data
- readData(data);
- }
-#else
- void read(QIODevice& f)
- {
- // All node data first
- readNode(f);
- // Then all non-video data
- readMetrics(f);
- // Then all video data
- readData(f);
- }
-#endif
-
-#ifdef QT_USE_MMAP
- void readNode(uchar*& data)
- {
- uchar rw = *data++;
- uchar cl = *data++;
- min = (rw << 8) | cl;
- rw = *data++;
- cl = *data++;
- max = (rw << 8) | cl;
- int flags = *data++;
- if ( flags & 1 )
- less = new QPFGlyphTree;
- else
- less = 0;
- if ( flags & 2 )
- more = new QPFGlyphTree;
- else
- more = 0;
- int n = max-min+1;
- glyph = new QPFGlyph[n];
-
- if ( less )
- less->readNode(data);
- if ( more )
- more->readNode(data);
- }
-#else
- void readNode(QIODevice& f)
- {
- char rw;
- char cl;
- f.getChar(&rw);
- f.getChar(&cl);
- min = (rw << 8) | cl;
- f.getChar(&rw);
- f.getChar(&cl);
- max = (rw << 8) | cl;
- char flags;
- f.getChar(&flags);
- if ( flags & 1 )
- less = new QPFGlyphTree;
- else
- less = 0;
- if ( flags & 2 )
- more = new QPFGlyphTree;
- else
- more = 0;
- int n = max-min+1;
- glyph = new QPFGlyph[n];
-
- if ( less )
- less->readNode(f);
- if ( more )
- more->readNode(f);
- }
-#endif
-
-#ifdef QT_USE_MMAP
- void readMetrics(uchar*& data)
- {
- int n = max-min+1;
- for (int i=0; i<n; i++) {
- glyph[i].metrics = (QPFGlyphMetrics*)data;
- data += sizeof(QPFGlyphMetrics);
- }
- if ( less )
- less->readMetrics(data);
- if ( more )
- more->readMetrics(data);
- }
-#else
- void readMetrics(QIODevice& f)
- {
- int n = max-min+1;
- for (int i=0; i<n; i++) {
- glyph[i].metrics = new QPFGlyphMetrics;
- f.read((char*)glyph[i].metrics, sizeof(QPFGlyphMetrics));
- }
- if ( less )
- less->readMetrics(f);
- if ( more )
- more->readMetrics(f);
- }
-#endif
-
-#ifdef QT_USE_MMAP
- void readData(uchar*& data)
- {
- int n = max-min+1;
- for (int i=0; i<n; i++) {
- QSize s( glyph[i].metrics->width, glyph[i].metrics->height );
- //######### s = qt_screen->mapToDevice( s );
- uint datasize = glyph[i].metrics->linestep * s.height();
- glyph[i].data = data; data += datasize;
- }
- if ( less )
- less->readData(data);
- if ( more )
- more->readData(data);
- }
-#else
- void readData(QIODevice& f)
- {
- int n = max-min+1;
- for (int i=0; i<n; i++) {
- QSize s( glyph[i].metrics->width, glyph[i].metrics->height );
- //############### s = qt_screen->mapToDevice( s );
- uint datasize = glyph[i].metrics->linestep * s.height();
- glyph[i].data = new uchar[datasize]; // ### deleted?
- f.read((char*)glyph[i].data, datasize);
- }
- if ( less )
- less->readData(f);
- if ( more )
- more->readData(f);
- }
-#endif
-
-};
-
-class QFontEngineQPF1Data
-{
-public:
- QPFFontMetrics fm;
- QPFGlyphTree *tree;
- void *mmapStart;
- size_t mmapLength;
-};
-
-#if defined(Q_OS_INTEGRITY)
-static void *qt_mmap(void *start, size_t length, int /*prot*/, int /*flags*/, int fd, off_t offset)
-{
- // INTEGRITY cannot mmap local files - load it into a local buffer
- if (::lseek(fd, offset, SEEK_SET) == -1) {
-# if defined(DEBUG_FONTENGINE)
- perror("lseek failed");
-# endif
- }
- void *buf = malloc(length);
- if (::read(fd, buf, length) != (ssize_t)length) {
-# if defined(DEBUG_FONTENGINE)
- perror("read failed");
-# endif
- }
-
- return buf;
-}
-#else
-static inline void *qt_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
-{
- return mmap(start, length, prot, flags, fd, offset);
-}
-#endif
-
-
-
-QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn)
-{
- cache_cost = 1;
-
- int f = QT_OPEN( QFile::encodeName(fn), O_RDONLY, 0);
- Q_ASSERT(f>=0);
- QT_STATBUF st;
- if ( QT_FSTAT( f, &st ) )
- qFatal("Failed to stat %s",QFile::encodeName(fn).data());
- uchar* data = (uchar*)qt_mmap( 0, // any address
- st.st_size, // whole file
- PROT_READ, // read-only memory
-#if defined(Q_OS_INTEGRITY)
- 0,
-#elif !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX4) && !defined(Q_OS_VXWORKS)
- MAP_FILE | MAP_PRIVATE, // swap-backed map from file
-#else
- MAP_PRIVATE,
-#endif
- f, 0 ); // from offset 0 of f
-#if !defined(MAP_FAILED) && (defined(Q_OS_QNX4) || defined(Q_OS_INTEGRITY))
-#define MAP_FAILED ((void *)-1)
-#endif
- if ( !data || data == (uchar*)MAP_FAILED )
- qFatal("Failed to mmap %s",QFile::encodeName(fn).data());
- QT_CLOSE(f);
-
- d = new QFontEngineQPF1Data;
- d->mmapStart = data;
- d->mmapLength = st.st_size;
- memcpy(reinterpret_cast<char*>(&d->fm),data,sizeof(d->fm));
-
- data += sizeof(d->fm);
- d->tree = new QPFGlyphTree(data);
- glyphFormat = (d->fm.flags & FM_SMOOTH) ? QFontEngineGlyphCache::Raster_A8
- : QFontEngineGlyphCache::Raster_Mono;
-#if 0
- qDebug() << "font file" << fn
- << "ascent" << d->fm.ascent << "descent" << d->fm.descent
- << "leftbearing" << d->fm.leftbearing
- << "rightbearing" << d->fm.rightbearing
- << "maxwidth" << d->fm.maxwidth
- << "leading" << d->fm.leading
- << "flags" << d->fm.flags
- << "underlinepos" << d->fm.underlinepos
- << "underlinewidth" << d->fm.underlinewidth;
-#endif
-}
-
-QFontEngineQPF1::~QFontEngineQPF1()
-{
- if (d->mmapStart)
- munmap(d->mmapStart, d->mmapLength);
- delete d->tree;
- delete d;
-}
-
-
-bool QFontEngineQPF1::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
-{
- if(*nglyphs < len) {
- *nglyphs = len;
- return false;
- }
- *nglyphs = 0;
-
- bool mirrored = flags & QTextEngine::RightToLeft;
- for(int i = 0; i < len; i++) {
- unsigned int uc = getChar(str, i, len);
- if (mirrored)
- uc = QChar::mirroredChar(uc);
- glyphs->glyphs[*nglyphs] = uc < 0x10000 ? uc : 0;
- ++*nglyphs;
- }
-
- glyphs->numGlyphs = *nglyphs;
-
- if (flags & QTextEngine::GlyphIndicesOnly)
- return true;
-
- recalcAdvances(glyphs, flags);
-
- return true;
-}
-
-void QFontEngineQPF1::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const
-{
- for(int i = 0; i < glyphs->numGlyphs; i++) {
- QPFGlyph *glyph = d->tree->get(glyphs->glyphs[i]);
-
- glyphs->advances_x[i] = glyph ? glyph->metrics->advance : 0;
- glyphs->advances_y[i] = 0;
-
- if (!glyph)
- glyphs->glyphs[i] = 0;
- }
-}
-
-void QFontEngineQPF1::draw(QPaintEngine *p, qreal _x, qreal _y, const QTextItemInt &si)
-{
- QPaintEngineState *pState = p->state;
- QRasterPaintEngine *paintEngine = static_cast<QRasterPaintEngine*>(p);
-
- QTransform matrix = pState->transform();
- matrix.translate(_x, _y);
- QFixed x = QFixed::fromReal(matrix.dx());
- QFixed y = QFixed::fromReal(matrix.dy());
-
- QVarLengthArray<QFixedPoint> positions;
- QVarLengthArray<glyph_t> glyphs;
- getGlyphPositions(si.glyphs, matrix, si.flags, glyphs, positions);
- if (glyphs.size() == 0)
- return;
-
- int depth = (d->fm.flags & FM_SMOOTH) ? 8 : 1;
- for(int i = 0; i < glyphs.size(); i++) {
- const QPFGlyph *glyph = d->tree->get(glyphs[i]);
- if (!glyph)
- continue;
-
- int bpl = glyph->metrics->linestep;
-
- if(glyph->data)
- paintEngine->alphaPenBlt(glyph->data, bpl, depth,
- qRound(positions[i].x) + glyph->metrics->bearingx,
- qRound(positions[i].y) - glyph->metrics->bearingy,
- glyph->metrics->width,glyph->metrics->height);
- }
-}
-
-
-QImage QFontEngineQPF1::alphaMapForGlyph(glyph_t g)
-{
- const QPFGlyph *glyph = d->tree->get(g);
- if (!glyph)
- return QImage();
-
- int mono = !(d->fm.flags & FM_SMOOTH);
-
- const uchar *bits = glyph->data;//((const uchar *) glyph);
-
- QImage image;
- if (mono) {
- image = QImage((glyph->metrics->width+7)&~7, glyph->metrics->height, QImage::Format_Mono);
- image.setColor(0, qRgba(0, 0, 0, 0));
- image.setColor(1, qRgba(0, 0, 0, 255));
- } else {
- image = QImage(glyph->metrics->width, glyph->metrics->height, QImage::Format_Indexed8);
- for (int j=0; j<256; ++j)
- image.setColor(j, qRgba(0, 0, 0, j));
- }
- for (int i=0; i<glyph->metrics->height; ++i) {
- memcpy(image.scanLine(i), bits, glyph->metrics->linestep);
- bits += glyph->metrics->linestep;
- }
- return image;
-}
-
-
-
-void QFontEngineQPF1::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags)
-{
- addBitmapFontToPath(x, y, glyphs, path, flags);
-}
-
-glyph_metrics_t QFontEngineQPF1::boundingBox(const QGlyphLayout &glyphs)
-{
- if (glyphs.numGlyphs == 0)
- return glyph_metrics_t();
-
- QFixed w = 0;
- for (int i = 0; i < glyphs.numGlyphs; ++i)
- w += glyphs.effectiveAdvance(i);
- return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0);
-}
-
-glyph_metrics_t QFontEngineQPF1::boundingBox(glyph_t glyph)
-{
- const QPFGlyph *g = d->tree->get(glyph);
- if (!g)
- return glyph_metrics_t();
- Q_ASSERT(g);
- return glyph_metrics_t(g->metrics->bearingx, -g->metrics->bearingy,
- g->metrics->width, g->metrics->height,
- g->metrics->advance, 0);
-}
-
-QFixed QFontEngineQPF1::ascent() const
-{
- return d->fm.ascent;
-}
-
-QFixed QFontEngineQPF1::descent() const
-{
- return d->fm.descent;
-}
-
-QFixed QFontEngineQPF1::leading() const
-{
- return d->fm.leading;
-}
-
-qreal QFontEngineQPF1::maxCharWidth() const
-{
- return d->fm.maxwidth;
-}
-/*
-const char *QFontEngineQPF1::name() const
-{
- return "qt";
-}
-*/
-bool QFontEngineQPF1::canRender(const QChar *str, int len)
-{
- for(int i = 0; i < len; i++)
- if (!d->tree->inFont(str[i].unicode()))
- return false;
- return true;
-}
-
-QFontEngine::Type QFontEngineQPF1::type() const
-{
- return QPF1;
-}
-
-qreal QFontEngineQPF1::minLeftBearing() const
-{
- return d->fm.leftbearing;
-}
-
-qreal QFontEngineQPF1::minRightBearing() const
-{
- return d->fm.rightbearing;
-}
-
-QFixed QFontEngineQPF1::underlinePosition() const
-{
- return d->fm.underlinepos;
-}
-
-QFixed QFontEngineQPF1::lineThickness() const
-{
- return d->fm.underlinewidth;
-}
-
-#endif //QT_NO_QWS_QPF
-
-QT_END_NAMESPACE
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 5fe8676993..56e5a5c6bb 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -122,15 +122,6 @@ public:
inline bool operator !=(const QFontMetrics &other) { return !operator==(other); } // 5.0 - remove me
inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); }
-#ifdef QT3_SUPPORT
- inline QRect boundingRect(const QString &text, int len) const
- { return boundingRect(text.left(len)); }
- inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString& str, int len,
- int tabstops=0, int *tabarray=0) const
- { return boundingRect(QRect(x, y, w, h), flags, str.left(len), tabstops, tabarray); }
- inline QSize size(int flags, const QString& str, int len, int tabstops=0, int *tabarray=0) const
- { return size(flags, str.left(len), tabstops, tabarray); }
-#endif
private:
#if defined(Q_WS_MAC)
friend class QFontPrivate;
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 5bee497a3e..397180cb2a 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -45,8 +45,6 @@
#include <private/qfontengine_p.h>
#include <qabstracttextdocumentlayout.h>
-#include <QtGui/qapplication.h>
-
QT_BEGIN_NAMESPACE
/*!
diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h
index 31fa843a3a..dce0ca90a5 100644
--- a/src/gui/text/qtextcontrol_p.h
+++ b/src/gui/text/qtextcontrol_p.h
@@ -64,11 +64,6 @@
#include <QtGui/qtextdocumentfragment.h>
#include <QtGui/qclipboard.h>
-#ifdef QT3_SUPPORT
-#include <QtGui/qtextobject.h>
-#include <QtGui/qtextlayout.h>
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 9169955617..910a439aec 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -58,7 +58,6 @@
#include <qfile.h>
#include <qfileinfo.h>
#include <qdir.h>
-#include <qapplication.h>
#include "qtextcontrol_p.h"
#include "qfont_p.h"
#include "private/qtextedit_p.h"
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 130f012639..450f7e100a 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -46,6 +46,7 @@
#include "qtextlist.h"
#include "qtextengine_p.h"
#include "private/qcssutil_p.h"
+#include "private/qguiapplication_p.h"
#include "qabstracttextdocumentlayout_p.h"
#include "qcssparser_p.h"
@@ -57,7 +58,6 @@
#include <qdebug.h>
#include <qvarlengtharray.h>
#include <limits.h>
-#include <qstyle.h>
#include <qbasictimer.h>
#include "private/qfunctions_p.h"
@@ -2572,7 +2572,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
Qt::Alignment align = docPrivate->defaultTextOption.alignment();
if (blockFormat.hasProperty(QTextFormat::BlockAlignment))
align = blockFormat.alignment();
- option.setAlignment(QStyle::visualAlignment(dir, align)); // for paragraph that are RTL, alignment is auto-reversed;
+ option.setAlignment(QGuiApplicationPrivate::visualAlignment(dir, align)); // for paragraph that are RTL, alignment is auto-reversed;
if (blockFormat.nonBreakableLines() || document->pageSize().width() < 0) {
option.setWrapMode(QTextOption::ManualWrap);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index ff27bc673f..b0713bb0e4 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -53,7 +53,7 @@
#include "qstring.h"
#include <private/qunicodetables_p.h>
#include "qtextdocument_p.h"
-#include <qapplication.h>
+#include <qguiapplication.h>
#include <stdlib.h>
@@ -1606,7 +1606,7 @@ bool QTextEngine::isRightToLeft() const
itemize();
// this places the cursor in the right position depending on the keyboard layout
if (layoutData->string.isEmpty())
- return QApplication::keyboardInputDirection() == Qt::RightToLeft;
+ return QGuiApplication::keyboardInputDirection() == Qt::RightToLeft;
return layoutData->string.isRightToLeft();
}
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 3513a280c6..9252e89922 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1406,7 +1406,7 @@ void QTextHtmlParserNode::applyBackgroundImage(const QString &url, const QTextDo
if (!url.isEmpty() && resourceProvider) {
QVariant val = resourceProvider->resource(QTextDocument::ImageResource, url);
- if (qApp->thread() != QThread::currentThread()) {
+ if (QCoreApplication::instance()->thread() != QThread::currentThread()) {
// must use images in non-GUI threads
if (val.type() == QVariant::Image) {
QImage image = qvariant_cast<QImage>(val);
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index bbff79cbc6..7cfaa3c88c 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -42,7 +42,7 @@
#include "qtextimagehandler_p.h"
-#include <qapplication.h>
+#include <qcoreapplication.h>
#include <qtextformat.h>
#include <qpainter.h>
#include <qdebug.h>
@@ -210,7 +210,7 @@ QSizeF QTextImageHandler::intrinsicSize(QTextDocument *doc, int posInDocument, c
Q_UNUSED(posInDocument)
const QTextImageFormat imageFormat = format.toImageFormat();
- if (qApp->thread() != QThread::currentThread())
+ if (QCoreApplication::instance()->thread() != QThread::currentThread())
return getImageSize(doc, imageFormat);
return getPixmapSize(doc, imageFormat);
}
@@ -220,7 +220,7 @@ void QTextImageHandler::drawObject(QPainter *p, const QRectF &rect, QTextDocumen
Q_UNUSED(posInDocument)
const QTextImageFormat imageFormat = format.toImageFormat();
- if (qApp->thread() != QThread::currentThread()) {
+ if (QCoreApplication::instance()->thread() != QThread::currentThread()) {
const QImage image = getImage(doc, imageFormat);
p->drawImage(rect, image, image.rect());
} else {
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index cb5ba0e672..551ef69203 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -43,14 +43,12 @@
#include "qtextengine_p.h"
#include <qfont.h>
-#include <qapplication.h>
#include <qpainter.h>
#include <qvarlengtharray.h>
#include <qtextformat.h>
#include <qabstracttextdocumentlayout.h>
#include "qtextdocument_p.h"
#include "qtextformat_p.h"
-#include "qstyleoption.h"
#include "qpainterpath.h"
#include "qglyphs.h"
#include "qglyphs_p.h"
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index 2b8e735305..b3358fa7b0 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qtextoption.h"
-#include "qapplication.h"
+#include "qguiapplication.h"
#include "qlist.h"
QT_BEGIN_NAMESPACE
@@ -82,7 +82,7 @@ QTextOption::QTextOption(Qt::Alignment alignment)
tab(-1),
d(0)
{
- direction = QApplication::layoutDirection();
+ direction = QGuiApplication::layoutDirection();
}
/*!
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index e5d57d069d..ba6ddb32f0 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -103,7 +103,7 @@ unix:x11 {
text/qrawfont_ft.cpp
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
HEADERS += \
text/qfontengine_mac_p.h
OBJECTIVE_HEADERS += \
@@ -119,22 +119,6 @@ unix:x11 {
}
}
-embedded {
- SOURCES += \
- text/qfont_qws.cpp \
- text/qfontengine_qws.cpp \
- text/qfontengine_ft.cpp \
- text/qfontengine_qpf.cpp \
- text/qabstractfontengine_qws.cpp \
- text/qrawfont_ft.cpp
- HEADERS += \
- text/qfontengine_ft_p.h \
- text/qfontengine_qpf_p.h \
- text/qabstractfontengine_qws.h \
- text/qabstractfontengine_p.h
- DEFINES += QT_NO_FONTCONFIG
-}
-
qpa {
SOURCES += \
text/qfont_qpa.cpp \
@@ -232,9 +216,7 @@ contains(QT_CONFIG, freetype) {
DEFINES += FT2_BUILD_LIBRARY FT_CONFIG_OPTION_SYSTEM_ZLIB
- embedded:CONFIG += opentype
} else:contains(QT_CONFIG, system-freetype) {
- embedded:CONFIG += opentype
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
LIBS_PRIVATE += -lfreetype
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index cb5a3ef560..2c2c3308ca 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -46,7 +46,7 @@
#include <qdebug.h>
#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
-#include "qdesktopservices_qws.cpp"
+#include "qdesktopservices_qpa.cpp"
#elif defined(Q_WS_X11)
#include "qdesktopservices_x11.cpp"
#elif defined(Q_WS_WIN)
diff --git a/src/gui/util/qdesktopservices_qws.cpp b/src/gui/util/qdesktopservices_qpa.cpp
index 324fa51a62..324fa51a62 100644
--- a/src/gui/util/qdesktopservices_qws.cpp
+++ b/src/gui/util/qdesktopservices_qpa.cpp
diff --git a/src/gui/util/qsystemtrayicon_qws.cpp b/src/gui/util/qsystemtrayicon_qpa.cpp
index 48f8fe8922..48f8fe8922 100644
--- a/src/gui/util/qsystemtrayicon_qws.cpp
+++ b/src/gui/util/qsystemtrayicon_qpa.cpp
diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri
index 2814a2d30a..db8e06555f 100644
--- a/src/gui/util/util.pri
+++ b/src/gui/util/util.pri
@@ -41,12 +41,12 @@ unix:x11 {
util/qsystemtrayicon_x11.cpp
}
-embedded|qpa {
+qpa {
SOURCES += \
- util/qsystemtrayicon_qws.cpp
+ util/qsystemtrayicon_qpa.cpp
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm
}
diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri
index 669b83830f..4cbcbe3983 100644
--- a/src/gui/widgets/widgets.pri
+++ b/src/gui/widgets/widgets.pri
@@ -144,7 +144,7 @@ SOURCES += \
widgets/qplaintextedit.cpp \
widgets/qprintpreviewwidget.cpp
-!embedded:!qpa:mac {
+!qpa:mac {
HEADERS += widgets/qmacnativewidget_mac.h \
widgets/qmaccocoaviewcontainer_mac.h
OBJECTIVE_HEADERS += widgets/qcocoatoolbardelegate_mac_p.h \
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 849bd9ebc7..2aee4333ef 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -15,7 +15,7 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
include(../qbase.pri)
-!win32:!embedded:!mac:!symbian:!qpa:CONFIG += x11
+!win32:!mac:!symbian:!qpa:CONFIG += x11
contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles1):CONFIG += opengles1
contains(QT_CONFIG, opengles2):CONFIG += opengles2
@@ -53,7 +53,6 @@ SOURCES += qgl.cpp \
HEADERS += qglshaderprogram.h \
qglpixmapfilter_p.h \
qgraphicsshadereffect_p.h \
- qgraphicssystem_gl_p.h \
qwindowsurface_gl_p.h \
qpixmapdata_gl_p.h \
gl2paintengineex/qglgradientcache_p.h \
@@ -71,7 +70,6 @@ SOURCES += qgl.cpp \
SOURCES += qglshaderprogram.cpp \
qglpixmapfilter.cpp \
qgraphicsshadereffect.cpp \
- qgraphicssystem_gl.cpp \
qwindowsurface_gl.cpp \
qpixmapdata_gl.cpp \
gl2paintengineex/qglgradientcache.cpp \
@@ -109,7 +107,6 @@ x11 {
contains(QT_CONFIG, fontconfig) {
contains(QT_CONFIG, system-freetype) {
- embedded:CONFIG += opentype
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
LIBS_PRIVATE += -lfreetype
@@ -142,24 +139,6 @@ wince*: {
HEADERS += qgl_egl_p.h
}
-embedded {
- SOURCES += qgl_qws.cpp \
- qglpixelbuffer_egl.cpp \
- qglscreen_qws.cpp \
- qglwindowsurface_qws.cpp \
- qgl_egl.cpp
-
- HEADERS += qglscreen_qws.h \
- qglwindowsurface_qws_p.h \
- qgl_egl_p.h
-
- contains(QT_CONFIG, fontconfig) {
- include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
- } else {
- DEFINES *= QT_NO_FREETYPE
- }
-}
-
symbian {
DEFINES += QGL_USE_TEXTURE_POOL QGL_NO_PRESERVED_SWAP
SOURCES -= qpixmapdata_gl.cpp
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 4cb976f3c2..f64c24b503 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1711,7 +1711,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
vi = 0;
#endif
#if defined(Q_WS_QPA)
- platformContext = 0;
+ windowContext = 0;
#endif
#if !defined(QT_NO_EGL)
ownsEglContext = false;
@@ -3330,7 +3330,7 @@ bool QGLContext::create(const QGLContext* shareContext)
{
Q_D(QGLContext);
#ifdef Q_WS_QPA
- if (!d->paintDevice && !d->platformContext)
+ if (!d->paintDevice && !d->windowContext)
#else
if (!d->paintDevice)
#endif
@@ -3420,8 +3420,8 @@ void QGLContext::setInitialized(bool on)
const QGLContext* QGLContext::currentContext()
{
#ifdef Q_WS_QPA
- if (const QPlatformGLContext *threadContext = QPlatformGLContext::currentContext()) {
- return QGLContext::fromPlatformGLContext(const_cast<QPlatformGLContext *>(threadContext));
+ if (const QWindowContext *threadContext = QWindowContext::currentContext()) {
+ return QGLContext::fromWindowContext(const_cast<QWindowContext *>(threadContext));
}
return 0;
#else
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index dfd1ae1824..730e52ba8f 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -49,7 +49,7 @@
#include <QtCore/qscopedpointer.h>
#ifdef Q_WS_QPA
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
#endif
QT_BEGIN_HEADER
@@ -283,8 +283,8 @@ public:
static OpenGLVersionFlags openGLVersionFlags();
#if defined(Q_WS_QPA)
- static QGLFormat fromPlatformWindowFormat(const QPlatformWindowFormat &format);
- static QPlatformWindowFormat toPlatformWindowFormat(const QGLFormat &format);
+ static QGLFormat fromWindowFormat(const QWindowFormat &format);
+ static QWindowFormat toWindowFormat(const QGLFormat &format);
#endif
private:
QGLFormatPrivate *d;
@@ -397,7 +397,7 @@ public:
static const QGLContext* currentContext();
#ifdef Q_WS_QPA
- static QGLContext *fromPlatformGLContext(QPlatformGLContext *platformContext);
+ static QGLContext *fromWindowContext(QWindowContext *platformContext);
#endif
protected:
virtual bool chooseContext(const QGLContext* shareContext = 0);
@@ -429,7 +429,7 @@ protected:
private:
#ifdef Q_WS_QPA
- QGLContext(QPlatformGLContext *platformContext);
+ QGLContext(QWindowContext *windowContext);
#endif
QScopedPointer<QGLContextPrivate> d_ptr;
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 46683c742e..26b2ab3a90 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -69,7 +69,7 @@
#endif
#if defined(Q_WS_QPA)
-#include <QtGui/QPlatformGLContext>
+#include <QtGui/QWindowContext>
#endif
QT_BEGIN_NAMESPACE
@@ -375,7 +375,7 @@ public:
#endif
#if defined(Q_WS_QPA)
- QPlatformGLContext *platformContext;
+ QWindowContext *windowContext;
void setupSharing();
#elif defined(Q_WS_X11) || defined(Q_WS_MAC)
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 994344c6eb..004d6c8314 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -45,81 +45,68 @@
#include <QDebug>
#include <QtGui/private/qapplication_p.h>
+#include <QtGui/QPlatformGLContext>
#include <QtGui/QPlatformWindow>
+#include <QtGui/QWindowContext>
#include "qgl.h"
#include "qgl_p.h"
QT_BEGIN_NAMESPACE
-QGLFormat QGLFormat::fromPlatformWindowFormat(const QPlatformWindowFormat &format)
+QGLFormat QGLFormat::fromWindowFormat(const QWindowFormat &format)
{
QGLFormat retFormat;
- retFormat.setAccum(format.accum());
- if (format.accumBufferSize() >= 0)
- retFormat.setAccumBufferSize(format.accumBufferSize());
- retFormat.setAlpha(format.alpha());
if (format.alphaBufferSize() >= 0)
retFormat.setAlphaBufferSize(format.alphaBufferSize());
if (format.blueBufferSize() >= 0)
retFormat.setBlueBufferSize(format.blueBufferSize());
- retFormat.setDepth(format.depth());
- if (format.depthBufferSize() >= 0)
- retFormat.setDepthBufferSize(format.depthBufferSize());
- retFormat.setDirectRendering(format.directRendering());
- retFormat.setDoubleBuffer(format.doubleBuffer());
if (format.greenBufferSize() >= 0)
retFormat.setGreenBufferSize(format.greenBufferSize());
if (format.redBufferSize() >= 0)
retFormat.setRedBufferSize(format.redBufferSize());
- retFormat.setRgba(format.rgba());
- retFormat.setSampleBuffers(format.sampleBuffers());
- retFormat.setSamples(format.sampleBuffers());
- retFormat.setStencil(format.stencil());
- if (format.stencilBufferSize() >= 0)
+ if (format.depthBufferSize() >= 0)
+ retFormat.setDepthBufferSize(format.depthBufferSize());
+ if (format.samples() > 1) {
+ retFormat.setSampleBuffers(format.samples());
+ retFormat.setSamples(true);
+ }
+ if (format.stencilBufferSize() > 0) {
+ retFormat.setStencil(true);
retFormat.setStencilBufferSize(format.stencilBufferSize());
+ }
+ retFormat.setDoubleBuffer(format.swapBehavior() != QWindowFormat::SingleBuffer);
retFormat.setStereo(format.stereo());
- retFormat.setSwapInterval(format.swapInterval());
return retFormat;
}
-QPlatformWindowFormat QGLFormat::toPlatformWindowFormat(const QGLFormat &format)
+QWindowFormat QGLFormat::toWindowFormat(const QGLFormat &format)
{
- QPlatformWindowFormat retFormat;
- retFormat.setAccum(format.accum());
- if (format.accumBufferSize() >= 0)
- retFormat.setAccumBufferSize(format.accumBufferSize());
- retFormat.setAlpha(format.alpha());
+ QWindowFormat retFormat;
if (format.alphaBufferSize() >= 0)
retFormat.setAlphaBufferSize(format.alphaBufferSize());
if (format.blueBufferSize() >= 0)
retFormat.setBlueBufferSize(format.blueBufferSize());
- retFormat.setDepth(format.depth());
- if (format.depthBufferSize() >= 0)
- retFormat.setDepthBufferSize(format.depthBufferSize());
- retFormat.setDirectRendering(format.directRendering());
- retFormat.setDoubleBuffer(format.doubleBuffer());
if (format.greenBufferSize() >= 0)
retFormat.setGreenBufferSize(format.greenBufferSize());
if (format.redBufferSize() >= 0)
retFormat.setRedBufferSize(format.redBufferSize());
- retFormat.setRgba(format.rgba());
- retFormat.setSampleBuffers(format.sampleBuffers());
- if (format.samples() >= 0)
+ if (format.depthBufferSize() >= 0)
+ retFormat.setDepthBufferSize(format.depthBufferSize());
+ retFormat.setSwapBehavior(format.doubleBuffer() ? QWindowFormat::DoubleBuffer : QWindowFormat::DefaultSwapBehavior);
+ if (format.sampleBuffers() && format.samples() > 1)
retFormat.setSamples(format.samples());
- retFormat.setStencil(format.stencil());
- if (format.stencilBufferSize() >= 0)
+ if (format.stencil() && format.stencilBufferSize() > 0)
retFormat.setStencilBufferSize(format.stencilBufferSize());
retFormat.setStereo(format.stereo());
- retFormat.setSwapInterval(format.swapInterval());
return retFormat;
}
void QGLContextPrivate::setupSharing() {
Q_Q(QGLContext);
- QPlatformGLContext *sharedPlatformGLContext = platformContext->platformWindowFormat().sharedGLContext();
- if (sharedPlatformGLContext) {
- QGLContext *actualSharedContext = QGLContext::fromPlatformGLContext(sharedPlatformGLContext);
+ QWindowContext *sharedContext = windowContext->handle()->windowFormat().sharedContext();
+ if (sharedContext) {
+ QGLContext *actualSharedContext = QGLContext::fromWindowContext(sharedContext);
sharing = true;
QGLContextGroup::addShare(q,actualSharedContext);
}
@@ -144,23 +131,23 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
d->valid = false;
}else {
QWidget *widget = static_cast<QWidget *>(d->paintDevice);
- if (!widget->platformWindow()){
+ if (!widget->windowHandle()->handle()) {
QGLFormat glformat = format();
- QPlatformWindowFormat winFormat = QGLFormat::toPlatformWindowFormat(glformat);
+ QWindowFormat winFormat = QGLFormat::toWindowFormat(glformat);
if (shareContext) {
- winFormat.setSharedContext(shareContext->d_func()->platformContext);
+ winFormat.setSharedContext(shareContext->d_func()->windowContext);
}
- winFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
+ widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
winFormat.setWindowSurface(false);
- widget->setPlatformWindowFormat(winFormat);
+ widget->windowHandle()->setWindowFormat(winFormat);
widget->winId();//make window
}
- d->platformContext = widget->platformWindow()->glContext();
- Q_ASSERT(d->platformContext);
- d->glFormat = QGLFormat::fromPlatformWindowFormat(d->platformContext->platformWindowFormat());
- d->valid =(bool) d->platformContext;
+ d->windowContext = widget->windowHandle()->glContext();
+ Q_ASSERT(d->windowContext);
+ d->glFormat = QGLFormat::fromWindowFormat(d->windowContext->handle()->windowFormat());
+ d->valid =(bool) d->windowContext;
if (d->valid) {
- d->platformContext->setQGLContextHandle(this,qDeleteQGLContext);
+ d->windowContext->setQGLContextHandle(this,qDeleteQGLContext);
}
d->setupSharing();
}
@@ -182,15 +169,15 @@ void QGLContext::reset()
d->transpColor = QColor();
d->initDone = false;
QGLContextGroup::removeShare(this);
- if (d->platformContext) {
- d->platformContext->setQGLContextHandle(0,0);
+ if (d->windowContext) {
+ d->windowContext->setQGLContextHandle(0,0);
}
}
void QGLContext::makeCurrent()
{
Q_D(QGLContext);
- d->platformContext->makeCurrent();
+ d->windowContext->makeCurrent();
if (!d->workaroundsCached) {
d->workaroundsCached = true;
@@ -205,19 +192,19 @@ void QGLContext::makeCurrent()
void QGLContext::doneCurrent()
{
Q_D(QGLContext);
- d->platformContext->doneCurrent();
+ d->windowContext->doneCurrent();
}
void QGLContext::swapBuffers() const
{
Q_D(const QGLContext);
- d->platformContext->swapBuffers();
+ d->windowContext->swapBuffers();
}
void *QGLContext::getProcAddress(const QString &procName) const
{
Q_D(const QGLContext);
- return d->platformContext->getProcAddress(procName);
+ return (void *)d->windowContext->getProcAddress(procName.toAscii());
}
void QGLWidget::setContext(QGLContext *context,
@@ -275,33 +262,32 @@ void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase)
class QGLTemporaryContextPrivate
{
public:
- QWidget *widget;
- QPlatformGLContext *context;
+ QWindow *window;
+ QWindowContext *context;
};
QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
: d(new QGLTemporaryContextPrivate)
{
- d->context = const_cast<QPlatformGLContext *>(QPlatformGLContext::currentContext());
+ d->context = const_cast<QWindowContext *>(QWindowContext::currentContext());
if (d->context)
d->context->doneCurrent();
- d->widget = new QWidget;
- d->widget->setGeometry(0,0,3,3);
- QPlatformWindowFormat format = d->widget->platformWindowFormat();
- format.setWindowApi(QPlatformWindowFormat::OpenGL);
- format.setWindowSurface(false);
- d->widget->setPlatformWindowFormat(format);
- d->widget->winId();
-
- d->widget->platformWindow()->glContext()->makeCurrent();
+
+ d->window = new QWindow;
+ d->window->setGeometry(QRect(0, 0, 3, 3));
+ d->window->setSurfaceType(QWindow::OpenGLSurface);
+ d->window->create();
+
+ d->window->glContext()->makeCurrent();
}
QGLTemporaryContext::~QGLTemporaryContext()
{
- d->widget->platformWindow()->glContext()->doneCurrent();
if (d->context)
d->context->makeCurrent();
- delete d->widget;
+ else
+ d->window->glContext()->doneCurrent();
+ delete d->window;
}
@@ -367,25 +353,25 @@ void QGLWidget::setColormap(const QGLColormap & c)
Q_UNUSED(c);
}
-QGLContext::QGLContext(QPlatformGLContext *platformContext)
+QGLContext::QGLContext(QWindowContext *windowContext)
: d_ptr(new QGLContextPrivate(this))
{
Q_D(QGLContext);
- d->init(0,QGLFormat::fromPlatformWindowFormat(platformContext->platformWindowFormat()));
- d->platformContext = platformContext;
- d->platformContext->setQGLContextHandle(this,qDeleteQGLContext);
+ d->init(0,QGLFormat::fromWindowFormat(windowContext->handle()->windowFormat()));
+ d->windowContext = windowContext;
+ d->windowContext->setQGLContextHandle(this,qDeleteQGLContext);
d->valid = true;
d->setupSharing();
}
-QGLContext *QGLContext::fromPlatformGLContext(QPlatformGLContext *platformContext)
+QGLContext *QGLContext::fromWindowContext(QWindowContext *windowContext)
{
- if (!platformContext)
+ if (!windowContext)
return 0;
- if (platformContext->qGLContextHandle()) {
- return reinterpret_cast<QGLContext *>(platformContext->qGLContextHandle());
+ if (windowContext->qGLContextHandle()) {
+ return reinterpret_cast<QGLContext *>(windowContext->qGLContextHandle());
}
- QGLContext *glContext = new QGLContext(platformContext);
+ QGLContext *glContext = new QGLContext(windowContext);
//Dont call create on context. This can cause the platformFormat to be set on the widget, which
//will cause the platformWindow to be recreated.
return glContext;
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
deleted file mode 100644
index 6ad2774eaf..0000000000
--- a/src/opengl/qgl_qws.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgl.h"
-#include "qgl_egl_p.h"
-#include "qglpixelbuffer.h"
-
-#include <qglscreen_qws.h>
-#include <qscreenproxy_qws.h>
-#include <private/qglwindowsurface_qws_p.h>
-
-#include <private/qbackingstore_p.h>
-#include <private/qfont_p.h>
-#include <private/qfontengine_p.h>
-#include <private/qgl_p.h>
-#include <private/qpaintengine_opengl_p.h>
-#include <qpixmap.h>
-#include <qtimer.h>
-#include <qapplication.h>
-#include <qstack.h>
-#include <qdesktopwidget.h>
-#include <qdebug.h>
-#include <qvarlengtharray.h>
-
-QT_BEGIN_NAMESPACE
-
-static QGLScreen *glScreenForDevice(QPaintDevice *device)
-{
- QScreen *screen = qt_screen;
- if (screen->classId() == QScreen::MultiClass) {
- int screenNumber;
- if (device && device->devType() == QInternal::Widget)
- screenNumber = qApp->desktop()->screenNumber(static_cast<QWidget *>(device));
- else
- screenNumber = 0;
- screen = screen->subScreens()[screenNumber];
- }
- while (screen->classId() == QScreen::ProxyClass ||
- screen->classId() == QScreen::TransformedClass) {
- screen = static_cast<QProxyScreen *>(screen)->screen();
- }
- if (screen->classId() == QScreen::GLClass)
- return static_cast<QGLScreen *>(screen);
- else
- return 0;
-}
-
-/*
- QGLTemporaryContext implementation
-*/
-
-class QGLTemporaryContextPrivate
-{
-public:
- QGLWidget *widget;
-};
-
-QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
- : d(new QGLTemporaryContextPrivate)
-{
- d->widget = new QGLWidget;
- d->widget->makeCurrent();
-}
-
-QGLTemporaryContext::~QGLTemporaryContext()
-{
- delete d->widget;
-}
-
-/*****************************************************************************
- QOpenGL debug facilities
- *****************************************************************************/
-//#define DEBUG_OPENGL_REGION_UPDATE
-
-bool QGLFormat::hasOpenGLOverlays()
-{
- QGLScreen *glScreen = glScreenForDevice(0);
- if (glScreen)
- return (glScreen->options() & QGLScreen::Overlays);
- else
- return false;
-}
-
-static EGLSurface qt_egl_create_surface
- (QEglContext *context, QPaintDevice *device,
- const QEglProperties *properties = 0)
-{
- // Get the screen surface functions, which are used to create native ids.
- QGLScreen *glScreen = glScreenForDevice(device);
- if (!glScreen)
- return EGL_NO_SURFACE;
- QGLScreenSurfaceFunctions *funcs = glScreen->surfaceFunctions();
- if (!funcs)
- return EGL_NO_SURFACE;
-
- // Create the native drawable for the paint device.
- int devType = device->devType();
- EGLNativePixmapType pixmapDrawable = 0;
- EGLNativeWindowType windowDrawable = 0;
- bool ok;
- if (devType == QInternal::Pixmap) {
- ok = funcs->createNativePixmap(static_cast<QPixmap *>(device), &pixmapDrawable);
- } else if (devType == QInternal::Image) {
- ok = funcs->createNativeImage(static_cast<QImage *>(device), &pixmapDrawable);
- } else {
- ok = funcs->createNativeWindow(static_cast<QWidget *>(device), &windowDrawable);
- }
- if (!ok) {
- qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable");
- return EGL_NO_SURFACE;
- }
-
- // Create the EGL surface to draw into, based on the native drawable.
- const int *props;
- if (properties)
- props = properties->properties();
- else
- props = 0;
- EGLSurface surf;
- if (devType == QInternal::Widget) {
- surf = eglCreateWindowSurface
- (context->display(), context->config(), windowDrawable, props);
- } else {
- surf = eglCreatePixmapSurface
- (context->display(), context->config(), pixmapDrawable, props);
- }
- if (surf == EGL_NO_SURFACE)
- qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
- return surf;
-}
-
-bool QGLContext::chooseContext(const QGLContext* shareContext)
-{
- Q_D(QGLContext);
-
- // Validate the device.
- if (!device())
- return false;
- int devType = device()->devType();
- if (devType != QInternal::Pixmap && devType != QInternal::Image && devType != QInternal::Widget) {
- qWarning("QGLContext::chooseContext(): Cannot create QGLContext's for paint device type %d", devType);
- return false;
- }
-
- // Get the display and initialize it.
- d->eglContext = new QEglContext();
- d->ownsEglContext = true;
- d->eglContext->setApi(QEgl::OpenGL);
-
- // Construct the configuration we need for this surface.
- QEglProperties configProps;
- qt_eglproperties_set_glformat(configProps, d->glFormat);
- configProps.setDeviceType(devType);
- configProps.setPaintDeviceFormat(device());
- configProps.setRenderableType(QEgl::OpenGL);
-
- // Search for a matching configuration, reducing the complexity
- // each time until we get something that matches.
- if (!d->eglContext->chooseConfig(configProps)) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
-
- // Inform the higher layers about the actual format properties.
- qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config());
-
- // Create a new context for the configuration.
- if (!d->eglContext->createContext
- (shareContext ? shareContext->d_func()->eglContext : 0)) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
- d->sharing = d->eglContext->isSharing();
- if (d->sharing && shareContext)
- const_cast<QGLContext *>(shareContext)->d_func()->sharing = true;
-
-#if defined(EGL_VERSION_1_1)
- if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget)
- eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval());
-#endif
-
- // Create the EGL surface to draw into. We cannot use
- // QEglContext::createSurface() because it does not have
- // access to the QGLScreen.
- d->eglSurface = qt_egl_create_surface(d->eglContext, device());
- if (d->eglSurface == EGL_NO_SURFACE) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
-
- return true;
-}
-
-
-bool QGLWidget::event(QEvent *e)
-{
- return QWidget::event(e);
-}
-
-
-void QGLWidget::resizeEvent(QResizeEvent *)
-{
- Q_D(QGLWidget);
- if (!isValid())
- return;
- makeCurrent();
- if (!d->glcx->initialized())
- glInit();
- resizeGL(width(), height());
- //handle overlay
-}
-
-const QGLContext* QGLWidget::overlayContext() const
-{
- return 0;
-}
-
-void QGLWidget::makeOverlayCurrent()
-{
- //handle overlay
-}
-
-void QGLWidget::updateOverlayGL()
-{
- //handle overlay
-}
-
-void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, bool deleteOldContext)
-{
- Q_D(QGLWidget);
- if(context == 0) {
- qWarning("QGLWidget::setContext: Cannot set null context");
- return;
- }
-
- if(d->glcx)
- d->glcx->doneCurrent();
- QGLContext* oldcx = d->glcx;
- d->glcx = context;
- if(!d->glcx->isValid())
- d->glcx->create(shareContext ? shareContext : oldcx);
- if(deleteOldContext)
- delete oldcx;
-}
-
-void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget)
-{
- Q_Q(QGLWidget);
-
- QGLScreen *glScreen = glScreenForDevice(q);
- if (glScreen) {
- wsurf = static_cast<QWSGLWindowSurface*>(glScreen->createSurface(q));
- q->setWindowSurface(wsurf);
- }
-
- initContext(context, shareWidget);
-
- if(q->isValid() && glcx->format().hasOverlay()) {
- //no overlay
- qWarning("QtOpenGL ES doesn't currently support overlays");
- }
-}
-
-void QGLWidgetPrivate::cleanupColormaps()
-{
-}
-
-const QGLColormap & QGLWidget::colormap() const
-{
- return d_func()->cmap;
-}
-
-void QGLWidget::setColormap(const QGLColormap &)
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index aa075617bb..ed0d82a49a 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -46,7 +46,6 @@
#include "private/qpixmapdata_p.h"
#include "private/qimagepixmapcleanuphooks_p.h"
#include "qglpixmapfilter_p.h"
-#include "qgraphicssystem_gl_p.h"
#include "qpaintengine_opengl_p.h"
#include "qcache.h"
diff --git a/src/opengl/qglscreen_qws.cpp b/src/opengl/qglscreen_qws.cpp
deleted file mode 100644
index badb581844..0000000000
--- a/src/opengl/qglscreen_qws.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGLScreen>
-#include <QGLContext>
-#include <QGLWidget>
-#include "private/qglwindowsurface_qws_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGLScreenPrivate
-{
-public:
- QGLScreen::Options options;
- QGLScreenSurfaceFunctions *functions;
-};
-
-/*!
- \internal
- \preliminary
- \class QGLScreen
-
- \brief This class encapsulates an OpenGL screen driver.
-*/
-
-QGLScreen::QGLScreen(int displayId)
- : QScreen(displayId, GLClass), d_ptr(new QGLScreenPrivate)
-{
- d_ptr->options = NoOptions;
- d_ptr->functions = new QGLScreenSurfaceFunctions();
-}
-
-QGLScreen::~QGLScreen()
-{
- delete d_ptr->functions;
- delete d_ptr;
-}
-
-/*!
- \since 4.3
- \obsolete
-
- Initializes the \a context and sets up the QGLWindowSurface of the
- QWidget of \a context based on the parameters of \a context and
- based on its own requirements. The format() of \a context needs
- to be updated with the actual parameters of the OpenGLES drawable
- that was set up.
-
- \a shareContext is used in the same way as for QGLContext. It is
- the context with which \a context shares display lists and texture
- ids etc. The window surface must be set up so that this sharing
- works.
-
- Returns true in case of success and false if it is not possible to
- create the necessary OpenGLES drawable/context.
-
- Since 4.4.2, this function will be not be called if options()
- indicates that a native window or pixmap drawable can be created
- via the functions in the surfaceFunctions() object.
-
- This function is obsolete in Qt 4.5 and higher. Use surfaceFunctions()
- instead.
-
- \sa options(), surfaceFunctions()
-*/
-bool
-QGLScreen::chooseContext(QGLContext *context, const QGLContext *shareContext)
-{
- Q_UNUSED(context);
- Q_UNUSED(shareContext);
- return false;
-}
-
-/*!
- \enum QGLScreen::Option
- This enum defines options that can be set on QGLScreen instances.
-
- \value NoOptions There are no special options on the screen. This is the default.
- \value NativeWindows Native windows can be created with QGLScreenSurfaceFunctions::createNativeWindow().
- \value NativePixmaps Native pixmaps can be created with QGLScreenSurfaceFunctions::createNativePixmap().
- \value NativeImages Native images can be created with QGLScreenSurfaceFunctions::createNativeImage().
- \value Overlays The screen supports GL overlays.
-*/
-
-/*!
- \since 4.4.2
-
- Returns the options associated with this QGLScreen.
-
- \sa setOptions()
-*/
-QGLScreen::Options QGLScreen::options() const
-{
- return d_ptr->options;
-}
-
-/*!
- \since 4.4.2
-
- Sets the options associated with this QGLScreen to \a value.
-
- \sa options()
-*/
-void QGLScreen::setOptions(QGLScreen::Options value)
-{
- d_ptr->options = value;
-}
-
-/*!
- \since 4.4.2
-
- Returns the surface functions object for this QGLScreen.
-
- \sa setSurfaceFunctions()
-*/
-QGLScreenSurfaceFunctions *QGLScreen::surfaceFunctions() const
-{
- return d_ptr->functions;
-}
-
-/*!
- \since 4.4.2
-
- Sets the surface functions object for this QGLScreen to \a functions.
- The QGLScreen will take over ownership of \a functions and delete
- it when the QGLScreen is deleted.
-
- \sa setSurfaceFunctions()
-*/
-void QGLScreen::setSurfaceFunctions(QGLScreenSurfaceFunctions *functions)
-{
- if (functions && functions != d_ptr->functions) {
- delete d_ptr->functions;
- d_ptr->functions = functions;
- }
-}
-
-/*!
- \internal
- \preliminary
- \class QGLScreenSurfaceFunctions
- \brief The QGLScreenSurfaceFunctions class encapsulates the functions for creating native windows and pixmaps for OpenGL ES.
-*/
-
-/*!
- \since 4.4.2
-
- Creates a native OpenGLES drawable for the surface of \a widget and
- returns it in \a native. Returns true if the OpenGLES drawable could
- be created, or false if windows are not supported.
-
- This function will be called if the NativeWindows option is set on
- the screen.
-
- \sa createNativePixmap(), createNativeImage(), QGLScreen::options()
-*/
-bool QGLScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNativeWindowType *native)
-{
- Q_UNUSED(widget);
- Q_UNUSED(native);
- return false;
-}
-
-/*!
- \since 4.4.2
-
- Creates a native OpenGLES drawable for directly rendering into
- \a pixmap and returns it in \a native. Returns true if the OpenGLES
- drawable could be created, or false if direct rendering into pixmaps
- is not supported.
-
- This function will be called if the NativePixmaps option is set on
- the screen.
-
- \sa createNativeWindow(), createNativeImage(), QGLScreen::options()
-*/
-bool QGLScreenSurfaceFunctions::createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native)
-{
- Q_UNUSED(pixmap);
- Q_UNUSED(native);
- return false;
-}
-
-/*!
- \since 4.4.2
-
- Creates a native OpenGLES drawable for directly rendering into
- \a image and returns it in \a native. Returns true if the OpenGLES
- drawable could be created, or false if direct rendering into images
- is not supported.
-
- This function will be called if the NativeImages option is set on
- the screen.
-
- \sa createNativeWindow(), createNativePixmap(), QGLScreen::options()
-*/
-bool QGLScreenSurfaceFunctions::createNativeImage(QImage *image, EGLNativePixmapType *native)
-{
- Q_UNUSED(image);
- Q_UNUSED(native);
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/opengl/qglscreen_qws.h b/src/opengl/qglscreen_qws.h
deleted file mode 100644
index 1fefc1ce6e..0000000000
--- a/src/opengl/qglscreen_qws.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENEGL_P_H
-#define QSCREENEGL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QScreenEGL class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/QScreen>
-#include <QtOpenGL/qgl.h>
-#if defined(QT_OPENGL_ES_2)
-#include <EGL/egl.h>
-#else
-#include <GLES/egl.h>
-#endif
-#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED)
-#undef EGLNativeWindowType
-#undef EGLNativePixmapType
-#undef EGLNativeDisplayType
-typedef NativeWindowType EGLNativeWindowType;
-typedef NativePixmapType EGLNativePixmapType;
-typedef NativeDisplayType EGLNativeDisplayType;
-#define QEGL_NATIVE_TYPES_DEFINED 1
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(OpenGL)
-
-class QGLScreenPrivate;
-
-class Q_OPENGL_EXPORT QGLScreenSurfaceFunctions
-{
-public:
- virtual bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native);
- virtual bool createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native);
- virtual bool createNativeImage(QImage *image, EGLNativePixmapType *native);
-};
-
-class Q_OPENGL_EXPORT QGLScreen : public QScreen
-{
- Q_DECLARE_PRIVATE(QGLScreen)
-public:
- QGLScreen(int displayId);
- virtual ~QGLScreen();
-
- enum Option
- {
- NoOptions = 0,
- NativeWindows = 1,
- NativePixmaps = 2,
- NativeImages = 4,
- Overlays = 8
- };
- Q_DECLARE_FLAGS(Options, Option)
-
- QGLScreen::Options options() const;
-
- virtual bool chooseContext(QGLContext *context, const QGLContext *shareContext);
- virtual bool hasOpenGL() = 0;
-
- QGLScreenSurfaceFunctions *surfaceFunctions() const;
-
-protected:
- void setOptions(QGLScreen::Options value);
- void setSurfaceFunctions(QGLScreenSurfaceFunctions *functions);
-
-private:
- QGLScreenPrivate *d_ptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QGLScreen::Options)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSCREENEGL_P_H
diff --git a/src/opengl/qglwindowsurface_qws.cpp b/src/opengl/qglwindowsurface_qws.cpp
deleted file mode 100644
index 8d1d733d79..0000000000
--- a/src/opengl/qglwindowsurface_qws.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/QPaintDevice>
-#include <QtGui/QWidget>
-#include <QtOpenGL/QGLWidget>
-#include "private/qglwindowsurface_qws_p.h"
-#include "private/qpaintengine_opengl_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QWSGLWindowSurface
- \since 4.3
- \ingroup qws
- \preliminary
-
- \brief The QWSGLWindowSurface class provides the drawing area for top-level
- windows with Qt for Embedded Linux on EGL/OpenGL ES. It also provides the
- drawing area for \l{QGLWidget}s whether they are top-level windows or
- children of another QWidget.
-
- Note that this class is only available in Qt for Embedded Linux and only
- available if Qt is configured with OpenGL support.
-*/
-
-class QWSGLWindowSurfacePrivate
-{
-public:
- QWSGLWindowSurfacePrivate() :
- qglContext(0), ownsContext(false) {}
-
- QGLContext *qglContext;
- bool ownsContext;
-};
-
-/*!
- Constructs an empty QWSGLWindowSurface for the given top-level \a window.
- The window surface is later initialized from chooseContext() and resources for it
- is typically allocated in setGeometry().
-*/
-QWSGLWindowSurface::QWSGLWindowSurface(QWidget *window)
- : QWSWindowSurface(window),
- d_ptr(new QWSGLWindowSurfacePrivate)
-{
-}
-
-/*!
- Constructs an empty QWSGLWindowSurface.
-*/
-QWSGLWindowSurface::QWSGLWindowSurface()
- : d_ptr(new QWSGLWindowSurfacePrivate)
-{
-}
-
-/*!
- Destroys the QWSGLWindowSurface object and frees any
- allocated resources.
- */
-QWSGLWindowSurface::~QWSGLWindowSurface()
-{
- Q_D(QWSGLWindowSurface);
- if (d->ownsContext)
- delete d->qglContext;
- delete d;
-}
-
-/*!
- Returns the QGLContext of the window surface.
-*/
-QGLContext *QWSGLWindowSurface::context() const
-{
- Q_D(const QWSGLWindowSurface);
- if (!d->qglContext) {
- QWSGLWindowSurface *that = const_cast<QWSGLWindowSurface*>(this);
- that->setContext(new QGLContext(QGLFormat::defaultFormat()));
- that->d_func()->ownsContext = true;
- }
- return d->qglContext;
-}
-
-/*!
- Sets the QGLContext for this window surface to \a context.
-*/
-void QWSGLWindowSurface::setContext(QGLContext *context)
-{
- Q_D(QWSGLWindowSurface);
- if (d->ownsContext) {
- delete d->qglContext;
- d->ownsContext = false;
- }
- d->qglContext = context;
-}
-
-QT_END_NAMESPACE
diff --git a/src/opengl/qgraphicssystem_gl.cpp b/src/opengl/qgraphicssystem_gl.cpp
deleted file mode 100644
index 0aa3c2e6c7..0000000000
--- a/src/opengl/qgraphicssystem_gl.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_gl_p.h"
-#include <QGraphicsView>
-
-#include "private/qpixmap_raster_p.h"
-#include "private/qpixmapdata_gl_p.h"
-#include "private/qwindowsurface_gl_p.h"
-#include "private/qgl_p.h"
-#include <private/qwindowsurface_raster_p.h>
-
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
-#include "private/qpixmapdata_x11gl_p.h"
-#include "private/qwindowsurface_x11gl_p.h"
-#endif
-
-#if defined(Q_OS_SYMBIAN)
-#include <QtGui/private/qapplication_p.h>
-#endif
-
-#ifdef QGL_USE_TEXTURE_POOL
-#include "private/qgltexturepool_p.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-extern QGLWidget *qt_gl_getShareWidget();
-
-QPixmapData *QGLGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
- return new QGLPixmapData(type);
-}
-
-QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
-#ifdef Q_WS_WIN
- // On Windows the QGLWindowSurface class can't handle
- // drop shadows and native effects, e.g. fading a menu in/out using
- // top level window opacity.
- if (widget->windowType() == Qt::Popup)
- return new QRasterWindowSurface(widget);
-#endif
-
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
- if (m_useX11GL && QX11GLPixmapData::hasX11GLPixmaps()) {
- // If the widget is a QGraphicsView which will be re-drawing the entire
- // scene each frame anyway, we should use QGLWindowSurface as this may
- // provide proper buffer flipping, which should be faster than QX11GL's
- // blitting approach:
- QGraphicsView* qgv = qobject_cast<QGraphicsView*>(widget);
- if (qgv && qgv->viewportUpdateMode() == QGraphicsView::FullViewportUpdate)
- return new QGLWindowSurface(widget);
- else
- return new QX11GLWindowSurface(widget);
- }
-#endif
-
-#if defined(Q_OS_SYMBIAN)
- if (!QApplicationPrivate::instance()->useTranslucentEGLSurfaces) {
- QWidgetPrivate *d = qt_widget_private(widget);
- if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground))
- return d->createDefaultWindowSurface_sys();
- }
-#endif
-
- return new QGLWindowSurface(widget);
-}
-#ifdef QGL_USE_TEXTURE_POOL
-void QGLGraphicsSystem::releaseCachedResources()
-{
- QGLTexturePool::instance()->hibernate();
-}
-#endif
-QT_END_NAMESPACE
-
diff --git a/src/opengl/qgraphicssystem_gl_p.h b/src/opengl/qgraphicssystem_gl_p.h
deleted file mode 100644
index 5829dccea9..0000000000
--- a/src/opengl/qgraphicssystem_gl_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_RASTER_P_H
-#define QGRAPHICSSYSTEM_RASTER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qgraphicssystem_p.h"
-
-#include <QMap>
-
-QT_BEGIN_NAMESPACE
-
-class Q_OPENGL_EXPORT QGLGraphicsSystem : public QGraphicsSystem
-{
-public:
- QGLGraphicsSystem(bool useX11GL);
-
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-
-#ifdef QGL_USE_TEXTURE_POOL
- void releaseCachedResources();
-#endif
-private:
- bool m_useX11GL;
-};
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 56e2c3b517..0abf4ba005 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -68,7 +68,6 @@
#include <private/qgl_p.h>
#include <private/qglpixelbuffer_p.h>
-#include <private/qgraphicssystem_gl_p.h>
#include <private/qpaintengineex_opengl2_p.h>
#include <private/qpixmapdata_gl_p.h>
@@ -86,97 +85,11 @@
#include <private/qeglcontext_p.h>
#endif
-QT_BEGIN_NAMESPACE
-
-//
-// QGLGraphicsSystem
-//
-#ifdef Q_WS_WIN
-extern Q_GUI_EXPORT bool qt_win_owndc_required;
+#ifdef Q_WS_QPA
+#include <qplatformscreen_qpa.h>
#endif
-QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
- : QGraphicsSystem(), m_useX11GL(useX11GL)
-{
-#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
- // only override the system defaults if the user hasn't already
- // picked a visual
- if (X11->visual == 0 && X11->visual_id == -1 && X11->visual_class == -1) {
- // find a double buffered, RGBA visual that supports OpenGL
- // and set that as the default visual for windows in Qt
- int i = 0;
- int spec[16];
- spec[i++] = GLX_RGBA;
- spec[i++] = GLX_DOUBLEBUFFER;
-
- if (!qgetenv("QT_GL_SWAPBUFFER_PRESERVE").isNull()) {
- spec[i++] = GLX_DEPTH_SIZE;
- spec[i++] = 8;
- spec[i++] = GLX_STENCIL_SIZE;
- spec[i++] = 8;
- spec[i++] = GLX_SAMPLE_BUFFERS_ARB;
- spec[i++] = 1;
- spec[i++] = GLX_SAMPLES_ARB;
- spec[i++] = 4;
- }
- spec[i++] = XNone;
-
- XVisualInfo *vi = glXChooseVisual(X11->display, X11->defaultScreen, spec);
- if (vi) {
- X11->visual_id = vi->visualid;
- X11->visual_class = vi->c_class;
-
- QGLFormat format;
- int res;
- glXGetConfig(X11->display, vi, GLX_LEVEL, &res);
- format.setPlane(res);
- glXGetConfig(X11->display, vi, GLX_DOUBLEBUFFER, &res);
- format.setDoubleBuffer(res);
- glXGetConfig(X11->display, vi, GLX_DEPTH_SIZE, &res);
- format.setDepth(res);
- if (format.depth())
- format.setDepthBufferSize(res);
- glXGetConfig(X11->display, vi, GLX_RGBA, &res);
- format.setRgba(res);
- glXGetConfig(X11->display, vi, GLX_RED_SIZE, &res);
- format.setRedBufferSize(res);
- glXGetConfig(X11->display, vi, GLX_GREEN_SIZE, &res);
- format.setGreenBufferSize(res);
- glXGetConfig(X11->display, vi, GLX_BLUE_SIZE, &res);
- format.setBlueBufferSize(res);
- glXGetConfig(X11->display, vi, GLX_ALPHA_SIZE, &res);
- format.setAlpha(res);
- if (format.alpha())
- format.setAlphaBufferSize(res);
- glXGetConfig(X11->display, vi, GLX_ACCUM_RED_SIZE, &res);
- format.setAccum(res);
- if (format.accum())
- format.setAccumBufferSize(res);
- glXGetConfig(X11->display, vi, GLX_STENCIL_SIZE, &res);
- format.setStencil(res);
- if (format.stencil())
- format.setStencilBufferSize(res);
- glXGetConfig(X11->display, vi, GLX_STEREO, &res);
- format.setStereo(res);
- glXGetConfig(X11->display, vi, GLX_SAMPLE_BUFFERS_ARB, &res);
- format.setSampleBuffers(res);
- if (format.sampleBuffers()) {
- glXGetConfig(X11->display, vi, GLX_SAMPLES_ARB, &res);
- format.setSamples(res);
- }
-
- QGLWindowSurface::surfaceFormat = format;
- XFree(vi);
-
- printf("using visual class %x, id %x\n", X11->visual_class, X11->visual_id);
- }
- }
-#elif defined(Q_WS_WIN)
- QGLWindowSurface::surfaceFormat.setDoubleBuffer(true);
-
- qt_win_owndc_required = true;
-#endif
-}
+QT_BEGIN_NAMESPACE
//
// QGLWindowSurface
@@ -353,7 +266,31 @@ QGLContext* QGLWindowSurfaceGLPaintDevice::context() const
int QGLWindowSurfaceGLPaintDevice::metric(PaintDeviceMetric m) const
{
- return qt_paint_device_metric(d->q_ptr->window(), m);
+ QWindow *window = d->q_ptr->window();
+ QPlatformScreen *screen = QPlatformScreen::platformScreenForWindow(window);
+ if (!screen) {
+ if (m == PdmDpiX || m == PdmDpiY)
+ return 72;
+ }
+ int val;
+ if (m == PdmWidth) {
+ val = window->geometry().width();
+ } else if (m == PdmWidthMM) {
+ val = window->geometry().width() * screen->physicalSize().width() / screen->geometry().width();
+ } else if (m == PdmHeight) {
+ val = window->geometry().height();
+ } else if (m == PdmHeightMM) {
+ val = window->geometry().height() * screen->physicalSize().height() / screen->geometry().height();
+ } else if (m == PdmDepth) {
+ val = screen->depth();
+ } else if (m == PdmDpiX || m == PdmPhysicalDpiX) {
+ val = qRound(screen->geometry().width() / double(screen->physicalSize().width() / 25.4));
+ } else if (m == PdmDpiY || m == PdmPhysicalDpiY) {
+ val = qRound(screen->geometry().height() / double(screen->physicalSize().height() / 25.4));
+ } else {
+ val = 1 << qMax(24, screen->depth());
+ }
+ return val;
}
QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const
@@ -361,7 +298,7 @@ QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const
return qt_qgl_paint_engine();
}
-QGLWindowSurface::QGLWindowSurface(QWidget *window)
+QGLWindowSurface::QGLWindowSurface(QWindow *window)
: QWindowSurface(window), d_ptr(new QGLWindowSurfacePrivate)
{
// Q_ASSERT(window->isTopLevel());
@@ -422,6 +359,7 @@ QGLWindowSurface::~QGLWindowSurface()
void QGLWindowSurface::deleted(QObject *object)
{
+#if 0
QWidget *widget = qobject_cast<QWidget *>(object);
if (widget) {
if (widget == window()) {
@@ -444,10 +382,12 @@ void QGLWindowSurface::deleted(QObject *object)
}
#endif
}
+#endif
}
-void QGLWindowSurface::hijackWindow(QWidget *widget)
+void QGLWindowSurface::hijackWindow(QWindow *window)
{
+#if 0
QWidgetPrivate *widgetPrivate = widget->d_func();
widgetPrivate->createExtra();
if (widgetPrivate->extraData()->glContext)
@@ -505,6 +445,7 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
#ifndef Q_OS_SYMBIAN
qDebug() << "hijackWindow() context created for" << widget << d_ptr->contexts.size();
#endif
+#endif
}
QGLContext *QGLWindowSurface::context() const
@@ -522,8 +463,10 @@ QPaintDevice *QGLWindowSurface::paintDevice()
if (d_ptr->ctx)
return &d_ptr->glDevice;
+#if 0
QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext);
ctx->makeCurrent();
+#endif
Q_ASSERT(d_ptr->fbo);
return d_ptr->fbo;
@@ -594,8 +537,9 @@ static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport,
}
-void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
+void QGLWindowSurface::flush(QWindow *window, const QRegion &rgn, const QPoint &offset)
{
+#if 0
//### Find out why d_ptr->geometry_updated isn't always false.
// flush() should not be called when d_ptr->geometry_updated is true. It assumes that either
// d_ptr->fbo or d_ptr->pb is allocated and has the correct size.
@@ -847,7 +791,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
ctx->swapBuffers();
else
glFlush();
-
+#endif
d_ptr->did_paint = false;
}
@@ -867,6 +811,7 @@ void QGLWindowSurface::resize(const QSize &size)
#endif
void QGLWindowSurface::updateGeometry() {
+#if 0
if (!d_ptr->geometry_updated)
return;
d_ptr->geometry_updated = false;
@@ -1001,6 +946,7 @@ void QGLWindowSurface::updateGeometry() {
#endif
d_ptr->ctx = ctx;
d_ptr->ctx->d_ptr->internal_context = true;
+#endif
}
bool QGLWindowSurface::initializeOffscreenTexture(const QSize &size)
@@ -1022,6 +968,7 @@ bool QGLWindowSurface::initializeOffscreenTexture(const QSize &size)
bool QGLWindowSurface::scroll(const QRegion &area, int dx, int dy)
{
+#if 0
// this code randomly fails currently for unknown reasons
return false;
@@ -1050,7 +997,7 @@ bool QGLWindowSurface::scroll(const QRegion &area, int dx, int dy)
glBindTexture(target, 0);
drawTexture(br.translated(dx, dy), d_ptr->tex_id, window()->size());
-
+#endif
return true;
}
@@ -1115,26 +1062,6 @@ static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize,
#endif
}
-QImage *QGLWindowSurface::buffer(const QWidget *widget)
-{
- QImage image;
-
- if (d_ptr->pb)
- image = d_ptr->pb->toImage();
- else if (d_ptr->fbo)
- image = d_ptr->fbo->toImage();
-
- if (image.isNull())
- return 0;
-
- QRect rect = widget->rect();
- rect.translate(widget->mapTo(widget->window(), QPoint()));
-
- QImage subImage = image.copy(rect);
- d_ptr->buffers << subImage;
- return &d_ptr->buffers.last();
-}
-
QWindowSurface::WindowSurfaceFeatures QGLWindowSurface::features() const
{
WindowSurfaceFeatures features = 0;
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index c71ce59c4d..8dc3a4583a 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
class QPaintDevice;
class QPoint;
class QRegion;
-class QWidget;
+class QWindow;
struct QGLWindowSurfacePrivate;
Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget();
@@ -84,11 +84,11 @@ class Q_OPENGL_EXPORT QGLWindowSurface : public QObject, public QWindowSurface /
{
Q_OBJECT
public:
- QGLWindowSurface(QWidget *window);
+ QGLWindowSurface(QWindow *window);
~QGLWindowSurface();
QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset);
#if !defined(Q_WS_QPA)
void setGeometry(const QRect &rect);
@@ -102,8 +102,6 @@ public:
void beginPaint(const QRegion &region);
void endPaint(const QRegion &region);
- QImage *buffer(const QWidget *widget);
-
WindowSurfaceFeatures features() const;
QGLContext *context() const;
@@ -117,7 +115,7 @@ private slots:
void deleted(QObject *object);
private:
- void hijackWindow(QWidget *widget);
+ void hijackWindow(QWindow *window);
bool initializeOffscreenTexture(const QSize &size);
QGLWindowSurfacePrivate *d_ptr;
diff --git a/src/plugins/decorations/decorations.pro b/src/plugins/decorations/decorations.pro
deleted file mode 100644
index 3d6912e77c..0000000000
--- a/src/plugins/decorations/decorations.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-contains(decoration-plugins, default) :SUBDIRS += default
-contains(decoration-plugins, styled) :SUBDIRS += styled
-contains(decoration-plugins, windows) :SUBDIRS += windows
diff --git a/src/plugins/decorations/default/default.pro b/src/plugins/decorations/default/default.pro
deleted file mode 100644
index a30899a62b..0000000000
--- a/src/plugins/decorations/default/default.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TARGET = qdecorationdefault
-include(../../qpluginbase.pri)
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qdecorationdefault_qws.h
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qdecorationdefault_qws.cpp
-
-DESTDIR = $$QT.gui.plugins/decorations
-target.path += $$[QT_INSTALL_PLUGINS]/decorations
-INSTALLS += target
diff --git a/src/plugins/decorations/default/main.cpp b/src/plugins/decorations/default/main.cpp
deleted file mode 100644
index fda6004eaa..0000000000
--- a/src/plugins/decorations/default/main.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qdecorationplugin_qws.h>
-#include <qdecorationdefault_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-class DecorationDefault : public QDecorationPlugin
-{
-public:
- DecorationDefault();
-
- QStringList keys() const;
- QDecoration *create(const QString&);
-};
-
-DecorationDefault::DecorationDefault()
- : QDecorationPlugin()
-{
-}
-
-QStringList DecorationDefault::keys() const
-{
- return (QStringList() << QLatin1String("Default"));
-}
-
-QDecoration* DecorationDefault::create(const QString& s)
-{
- if (s.toLower() == QLatin1String("default"))
- return new QDecorationDefault();
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(qdecorationdefault, DecorationDefault)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/decorations/styled/main.cpp b/src/plugins/decorations/styled/main.cpp
deleted file mode 100644
index da00adc971..0000000000
--- a/src/plugins/decorations/styled/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qdecorationplugin_qws.h>
-#include <qdecorationstyled_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-class DecorationStyled : public QDecorationPlugin
-{
-public:
- DecorationStyled();
-
- QStringList keys() const;
- QDecoration *create(const QString&);
-};
-
-DecorationStyled::DecorationStyled() : QDecorationPlugin()
-{
-}
-
-QStringList DecorationStyled::keys() const
-{
- return (QStringList() << QLatin1String("Styled"));
-}
-
-QDecoration* DecorationStyled::create(const QString& s)
-{
- if (s.toLower() != QLatin1String("styled"))
- return 0;
-
- qDebug("creatign styled decoration");
-
- return new QDecorationStyled;
-}
-
-Q_EXPORT_PLUGIN2(qdecorationstyled, DecorationStyled)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/decorations/styled/styled.pro b/src/plugins/decorations/styled/styled.pro
deleted file mode 100644
index 151ef88178..0000000000
--- a/src/plugins/decorations/styled/styled.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = qdecorationstyled
-include(../../qpluginbase.pri)
-
-DESTDIR = $$QT.gui.plugins/decorations
-target.path += $$[QT_INSTALL_PLUGINS]/decorations
-INSTALLS += target
-
-DEFINES += QT_QWS_DECORATION_STYLED
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qdecorationstyled_qws.h
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qdecorationstyled_qws.cpp
-
diff --git a/src/plugins/decorations/windows/main.cpp b/src/plugins/decorations/windows/main.cpp
deleted file mode 100644
index 0c7fd4b125..0000000000
--- a/src/plugins/decorations/windows/main.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qdecorationplugin_qws.h>
-#include <qdecorationwindows_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-class DecorationWindows : public QDecorationPlugin
-{
-public:
- DecorationWindows();
-
- QStringList keys() const;
- QDecoration *create(const QString&);
-};
-
-DecorationWindows::DecorationWindows()
- : QDecorationPlugin()
-{
-}
-
-QStringList DecorationWindows::keys() const
-{
- return (QStringList() << QLatin1String("Windows"));
-}
-
-QDecoration* DecorationWindows::create(const QString& s)
-{
- if (s.toLower() == QLatin1String("windows"))
- return new QDecorationWindows();
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(qdecorationwindows, DecorationWindows)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/decorations/windows/windows.pro b/src/plugins/decorations/windows/windows.pro
deleted file mode 100644
index 7f788a3d7e..0000000000
--- a/src/plugins/decorations/windows/windows.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TARGET = qdecorationwindows
-include(../../qpluginbase.pri)
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qdecorationwindows_qws.h
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qdecorationwindows_qws.cpp
-
-DESTDIR = $$QT.gui.plugins/decorations
-target.path += $$[QT_INSTALL_PLUGINS]/decorations
-INSTALLS += target
diff --git a/src/plugins/gfxdrivers/ahi/ahi.pro b/src/plugins/gfxdrivers/ahi/ahi.pro
deleted file mode 100644
index 3abe2a76cc..0000000000
--- a/src/plugins/gfxdrivers/ahi/ahi.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qahiscreen
-include(../../qpluginbase.pri)
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
-
-HEADERS = qscreenahi_qws.h
-
-SOURCES = qscreenahi_qws.cpp \
- qscreenahiplugin.cpp
-
-LIBS += -lahi
diff --git a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.cpp b/src/plugins/gfxdrivers/ahi/qscreenahi_qws.cpp
deleted file mode 100644
index aa28b0eeec..0000000000
--- a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.cpp
+++ /dev/null
@@ -1,598 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreenahi_qws.h"
-
-#ifndef QT_NO_QWS_AHI
-
-#include <QtGui/qcolor.h>
-#include <QtGui/qapplication.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qvarlengtharray.h>
-#include <private/qwssignalhandler_p.h>
-
-#include <ahi.h>
-
-//#define QAHISCREEN_DEBUG
-
-static int depthForPixelFormat(const AhiPixelFormat_t format)
-{
- switch (format) {
- case AhiPix1bpp:
- return 1;
- case AhiPix2bpp:
- return 2;
- case AhiPix4bpp:
- return 4;
- case AhiPix8bpp_332RGB:
- case AhiPix8bpp:
- return 8;
- case AhiPix16bpp_444RGB:
- return 12;
- case AhiPix16bpp_555RGB:
- return 15;
- case AhiPix16bpp_565RGB:
- return 16;
- case AhiPix32bpp_8888ARGB:
- case AhiPix32bpp_8888BGRA:
- return 32;
- default:
- return 0;
- }
-}
-
-static AhiPixelFormat_t pixelFormatForImageFormat(const QImage::Format format)
-{
- switch (format) {
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- return AhiPix1bpp;
- case QImage::Format_Indexed8:
- return AhiPix8bpp;
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- return AhiPix32bpp_8888ARGB;
- case QImage::Format_RGB16:
- return AhiPix16bpp_565RGB;
- case QImage::Format_RGB555:
- return AhiPix16bpp_555RGB;
- case QImage::Format_ARGB4444_Premultiplied:
- case QImage::Format_RGB444:
- return AhiPix16bpp_444RGB;
- default:
- return AhiPixelFormatMax;
- }
-}
-
-class QAhiScreenCursor : public QScreenCursor
-{
-public:
- QAhiScreenCursor(QScreen *screen, AhiDevCtx_t context);
-
- void set(const QImage &image, int hotx, int hoty);
- void move(int x, int y);
- void show();
- void hide();
-
-private:
- QScreen *screen;
- AhiDevCtx_t context;
-};
-
-QAhiScreenCursor::QAhiScreenCursor(QScreen *s, AhiDevCtx_t c)
- : QScreenCursor(), screen(s), context(c)
-{
- hwaccel = true;
- supportsAlpha = true;
-
- if (enable)
- show();
- else
- hide();
-}
-
-void QAhiScreenCursor::set(const QImage &image, int hotx, int hoty)
-{
- if (image.isNull()) {
- QScreenCursor::set(image, hotx, hoty);
- return;
- }
-
- if (image.format() != QImage::Format_MonoLSB) {
- set(image.convertToFormat(QImage::Format_MonoLSB), hotx, hoty);
- return;
- }
-
- AhiPixelFormat_t pixFmt = pixelFormatForImageFormat(image.format());
-
- if (pixFmt >= AhiPixelFormatMax) { // generic fallback
- QImage::Format toFormat = screen->pixelFormat();
- if (toFormat == QImage::Format_Invalid)
- toFormat = QImage::Format_ARGB32;
- set(image.convertToFormat(toFormat), hotx, hoty);
- return;
- }
-
- AhiPoint_t hotSpot = { hotx, hoty };
- AhiSize_t bitmapSize = { image.width(), image.height() };
- AhiBitmap_t bitmap = { bitmapSize, (void*)(image.bits()),
- image.bytesPerLine(), pixFmt };
-
- AhiSts_t status;
- status = AhiDispCursorSet(context, AhiCursor1, &bitmap, &hotSpot,
- image.serialNumber(), 0);
- if (status != AhiStsOk)
- qWarning("QAhiScreenCursor::set(): AhiDispCursorSet failed: %x",
- status);
-
- QScreenCursor::set(image, hotx, hoty);
-}
-
-void QAhiScreenCursor::move(int x, int y)
-{
- AhiPoint_t pos = { x, y };
- AhiSts_t status = AhiDispCursorPos(context, AhiCursor1, &pos, 0);
- if (status != AhiStsOk)
- qWarning("QAhiScreenCursor::move(): error setting mouse position: %x",
- status);
- QScreenCursor::move(x, y);
-}
-
-void QAhiScreenCursor::show()
-{
- AhiSts_t status;
- status = AhiDispCursorState(context, AhiCursor1, AhiCursorStateOn, 0);
- if (status != AhiStsOk)
- qWarning("QAhiScreenCursor::show(): error setting state: %x", status);
- QScreenCursor::show();
-}
-
-void QAhiScreenCursor::hide()
-{
- AhiDispCursorState(context, AhiCursor1, AhiCursorStateOff, 0);
- QScreenCursor::hide();
-}
-
-class QAhiScreenPrivate : public QObject
-{
-public:
- QAhiScreenPrivate();
- ~QAhiScreenPrivate();
-
- bool setMode(AhiDispMode_t mode);
-
- AhiDevCtx_t context;
- AhiSurf_t surface;
- QAhiScreenCursor *cursor;
-};
-
-QT_BEGIN_NAMESPACE
-
-QAhiScreenPrivate::QAhiScreenPrivate()
- : context(0), surface(0), cursor(0)
-{
-#ifndef QT_NO_QWS_SIGNALHANDLER
- QWSSignalHandler::instance()->addObject(this);
-#endif
-}
-
-QAhiScreenPrivate::~QAhiScreenPrivate()
-{
- delete cursor;
-
- if (surface) {
- AhiSurfFree(context, surface);
- surface = 0;
- }
- if (context) {
- AhiDevClose(context);
- context = 0;
- }
- AhiTerm();
-}
-
-bool QAhiScreenPrivate::setMode(AhiDispMode_t mode)
-{
- AhiSts_t status;
-
- status = AhiDispModeSet(context, &mode, 0);
- if (status != AhiStsOk) {
- qCritical("QAhiScreenPrivate::setMode(): AhiDispModeSet failed: %x",
- status);
- return false;
- }
-
- if (surface) {
- AhiSurfFree(context, surface);
- surface = 0;
- }
- status = AhiSurfAlloc(context, &surface, &mode.size, mode.pixFmt,
- AHIFLAG_SURFFIXED);
- if (status != AhiStsOk) {
- qCritical("QAhiScreenPrivate::setMode(): AhisurfAlloc failed: %x",
- status);
- return false;
- }
-
- status = AhiDispSurfSet(context, surface, 0);
- if (status != AhiStsOk) {
- qCritical("QAhiScreenPrivate::setMode(): AhiDispSurfSet failed: %x",
- status);
- return false;
- }
-
- return true;
-}
-
-QAhiScreen::QAhiScreen(int displayId)
- : QScreen(displayId), d_ptr(new QAhiScreenPrivate)
-{
-}
-
-QAhiScreen::~QAhiScreen()
-{
- delete d_ptr;
-}
-
-bool QAhiScreen::configure()
-{
- AhiSurfInfo_t surfaceInfo;
- AhiSts_t status;
-
- status = AhiSurfInfo(d_ptr->context, d_ptr->surface, &surfaceInfo);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::configure(): AhiSurfInfo failed: %x", status);
- return false;
- }
-
- QScreen::data = 0;
- QScreen::w = QScreen::dw = surfaceInfo.size.cx;
- QScreen::h = QScreen::dh = surfaceInfo.size.cy;
- QScreen::lstep = surfaceInfo.stride;
- QScreen::size = surfaceInfo.sizeInBytes;
-
- switch (surfaceInfo.pixFmt) {
- case AhiPix1bpp:
- setPixelFormat(QImage::Format_Mono);
- QScreen::d = 1;
- break;
- case AhiPix4bpp:
- QScreen::d = 4;
- break;
- case AhiPix8bpp_332RGB:
- case AhiPix8bpp:
- QScreen::d = 8;
- break;
- case AhiPix16bpp_444RGB:
- setPixelFormat(QImage::Format_RGB444);
- QScreen::d = 12;
- break;
- case AhiPix16bpp_555RGB:
- setPixelFormat(QImage::Format_RGB555);
- QScreen::d = 15;
- break;
- case AhiPix16bpp_565RGB:
- setPixelFormat(QImage::Format_RGB16);
- QScreen::d = 16;
- break;
- case AhiPix2bpp:
- QScreen::d = 2;
- break;
- case AhiPix32bpp_8888ARGB:
- setPixelFormat(QImage::Format_ARGB32);
- // fallthrough
- case AhiPix32bpp_8888BGRA:
- QScreen::d = 32;
- break;
- default:
- qCritical("QAhiScreen::configure(): Unknown pixel format: %x",
- surfaceInfo.pixFmt);
- return false;
- }
-
- const int dpi = 72;
- QScreen::physWidth = qRound(QScreen::dw * 25.4 / dpi);
- QScreen::physHeight = qRound(QScreen::dh * 25.4 / dpi);
-
- return true;
-}
-
-bool QAhiScreen::connect(const QString &displaySpec)
-{
- Q_UNUSED(displaySpec);
-
- AhiSts_t status;
-
- status = AhiInit(0);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::connect(): AhiInit failed: %x", status);
- return false;
- }
-
- AhiDev_t device;
- AhiDevInfo_t info;
-
- status = AhiDevEnum(&device, &info, 0);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::connect(): AhiDevEnum failed: %x", status);
- return false;
- }
-#ifdef QAHISCREEN_DEBUG
- {
- int displayNo = 0;
- AhiDevInfo_t dispInfo = info;
- qDebug("AHI supported devices:");
- do {
- qDebug(" %2i: %s, sw version: %s (rev %u)\n"
- " chip: 0x%x (rev %u), mem: %i (%i/%i), bus: 0x%x",
- displayNo, dispInfo.name,
- dispInfo.swVersion, uint(dispInfo.swRevision),
- uint(dispInfo.chipId), uint(dispInfo.revisionId),
- uint(dispInfo.totalMemory),
- uint(dispInfo.internalMemSize),
- uint(dispInfo.externalMemSize),
- uint(dispInfo.cpuBusInterfaceMode));
- status = AhiDevEnum(&device, &info, ++displayNo);
- } while (status == AhiStsOk);
- }
-#endif
-
- status = AhiDevOpen(&d_ptr->context, device, "qscreenahi",
- AHIFLAG_USERLEVEL);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::connect(): AhiDevOpen failed: %x", status);
- return false;
- }
-
- AhiDispMode_t mode;
-
- status = AhiDispModeEnum(d_ptr->context, &mode, 0);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::connect(): AhiDispModeEnum failed: %x", status);
- return false;
- }
-
-#ifdef QAHISCREEN_DEBUG
- {
- int modeNo = 0;
- AhiDispMode_t modeInfo = mode;
- qDebug("AHI supported modes:");
- do {
- qDebug(" %2i: %ux%u, fmt: %i, %u Hz, rot: %i, mirror: %i",
- modeNo, uint(modeInfo.size.cx), uint(modeInfo.size.cy),
- modeInfo.pixFmt, uint(modeInfo.frequency),
- modeInfo.rotation, modeInfo.mirror);
- status = AhiDispModeEnum(d_ptr->context, &modeInfo, ++modeNo);
- } while (status == AhiStsOk);
- }
-#endif
-
- if (QApplication::type() == QApplication::GuiServer) {
- if (!d_ptr->setMode(mode))
- return false;
- } else {
- status = AhiDispSurfGet(d_ptr->context, &d_ptr->surface);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::connect(): AhiDispSurfGet failed: %x",
- status);
- return false;
- }
-
- status = AhiDispModeGet(d_ptr->context, &mode);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::context(): AhiDispModeGet failed: %x",
- status);
- return false;
- }
- }
-
- return configure();
-}
-
-void QAhiScreen::disconnect()
-{
- AhiSurfFree(d_ptr->context, d_ptr->surface);
- d_ptr->surface = 0;
- AhiDevClose(d_ptr->context);
- d_ptr->context = 0;
- AhiTerm();
-}
-
-bool QAhiScreen::initDevice()
-{
- QScreenCursor::initSoftwareCursor();
-
- AhiSts_t status = AhiDispState(d_ptr->context, AhiDispStateOn, 0);
- if (status != AhiStsOk) {
- qCritical("QAhiScreen::connect(): AhiDispState failed: %x", status);
- return false;
- }
-
- return true;
-}
-
-void QAhiScreen::shutdownDevice()
-{
- AhiDispState(d_ptr->context, AhiDispStateOff, 0);
-}
-
-void QAhiScreen::setMode(int width, int height, int depth)
-{
- int modeNo = 0;
- AhiDispMode_t mode;
- AhiSts_t status = AhiStsOk;
-
- while (status == AhiStsOk) {
- status = AhiDispModeEnum(d_ptr->context, &mode, modeNo);
- if (mode.size.cx == uint(width) &&
- mode.size.cy == uint(height) &&
- depthForPixelFormat(mode.pixFmt) == depth)
- {
- d_ptr->setMode(mode);
- configure();
- return;
- }
- }
-}
-
-void QAhiScreen::blit(const QImage &image, const QPoint &topLeft,
- const QRegion &reg)
-{
- AhiPixelFormat_t pixFmt = pixelFormatForImageFormat(image.format());
-
- if (pixFmt >= AhiPixelFormatMax) { // generic fallback
- QImage::Format toFormat = pixelFormat();
- if (toFormat == QImage::Format_Invalid)
- toFormat = QImage::Format_ARGB32;
- blit(image.convertToFormat(toFormat), topLeft, reg);
- return;
- }
-
- AhiSts_t status;
-
- status = AhiDrawSurfDstSet(d_ptr->context, d_ptr->surface, 0);
- if (status != AhiStsOk) {
- qWarning("QAhiScreen::blit(): AhiDrawSurfDstSet failed: %x", status);
- return;
- }
-
- const QVector<QRect> rects = (reg & region()).rects();
- const int numRects = rects.size();
- QVarLengthArray<AhiPoint_t, 8> src(numRects);
- QVarLengthArray<AhiRect_t, 8> dest(numRects);
-
- for (int i = 0; i < numRects; ++i) {
- const QRect rect = rects.at(i);
-
- src[i].x = rect.x() - topLeft.x();
- src[i].y = rect.y() - topLeft.y();
- dest[i].left = rect.left();
- dest[i].top = rect.top();
- dest[i].right = rect.x() + rect.width();
- dest[i].bottom = rect.y() + rect.height();
- }
-
- AhiSize_t bitmapSize = { image.width(), image.height() };
- AhiBitmap_t bitmap = { bitmapSize, (void*)(image.bits()),
- image.bytesPerLine(), pixFmt };
-
- status = AhiDrawRopSet(d_ptr->context, AHIMAKEROP3(AHIROPSRCCOPY));
- if (status != AhiStsOk) {
- qWarning("QAhiScreen::blit(): AhiDrawRopSet failed: %x", status);
- return;
- }
-
- for (int i = 0; i < numRects; ++i) {
- status = AhiDrawBitmapBlt(d_ptr->context, &dest[i], &src[i],
- &bitmap, 0, 0);
- if (status != AhiStsOk) {
- qWarning("QAhiScreen::blit(): AhiDrawBitmapBlt failed: %x",
- status);
- break;
- }
- }
-}
-
-void QAhiScreen::solidFill(const QColor &color, const QRegion &reg)
-{
- AhiSts_t status = AhiStsOk;
-
- switch (pixelFormat()) {
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB32:
- case QImage::Format_RGB32:
- status = AhiDrawBrushFgColorSet(d_ptr->context, color.rgba());
- break;
- case QImage::Format_RGB16:
- status = AhiDrawBrushFgColorSet(d_ptr->context, qt_convRgbTo16(color.rgb()));
- break;
- default:
- qFatal("QAhiScreen::solidFill(): Not implemented for pixel format %d",
- int(pixelFormat()));
- break;
- }
-
- if (status != AhiStsOk) {
- qWarning("QAhiScreen::solidFill(): AhiDrawBrushFgColorSet failed: %x",
- status);
- return;
- }
-
- status = AhiDrawBrushSet(d_ptr->context, 0, 0, 0, AHIFLAG_BRUSHSOLID);
- if (status != AhiStsOk) {
- qWarning("QAhiScreen::solidFill(): AhiDrawBrushSet failed: %x",
- status);
- return;
- }
-
- status = AhiDrawRopSet(d_ptr->context, AHIMAKEROP3(AHIROPPATCOPY));
- if (status != AhiStsOk) {
- qWarning("QAhiScreen::solidFill(): AhiDrawRopSet failed: %x", status);
- return;
- }
-
- status = AhiDrawSurfDstSet(d_ptr->context, d_ptr->surface, 0);
- if (status != AhiStsOk) {
- qWarning("QAhiScreen::solidFill(): AhiDrawSurfDst failed: %x", status);
- return;
- }
-
- const QVector<QRect> rects = (reg & region()).rects();
- QVarLengthArray<AhiRect_t> ahiRects(rects.size());
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect rect = rects.at(i);
- ahiRects[i].left = rect.left();
- ahiRects[i].top = rect.top();
- ahiRects[i].right = rect.x() + rect.width();
- ahiRects[i].bottom = rect.y() + rect.height();
- }
-
- status = AhiDrawBitBltMulti(d_ptr->context, ahiRects.data(),
- 0, ahiRects.size());
- if (status != AhiStsOk)
- qWarning("QAhiScreen::solidFill(): AhiDrawBitBlt failed: %x", status);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_AHI
diff --git a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.h b/src/plugins/gfxdrivers/ahi/qscreenahi_qws.h
deleted file mode 100644
index ec947f4dc6..0000000000
--- a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAHISCREEN_H
-#define QAHISCREEN_H
-
-#include <QtGui/qscreenlinuxfb_qws.h>
-
-#ifndef QT_NO_QWS_AHI
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QAhiScreenPrivate;
-
-class QAhiScreen : public QScreen
-{
-public:
- QAhiScreen(int displayId);
- ~QAhiScreen();
-
- bool connect(const QString &displaySpec);
- void disconnect();
- bool initDevice();
- void shutdownDevice();
- void setMode(int width, int height, int depth);
-
- void blit(const QImage &image, const QPoint &topLeft,
- const QRegion &region);
- void solidFill(const QColor &color, const QRegion &region);
-
-private:
- bool configure();
-
- QAhiScreenPrivate *d_ptr;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_AHI
-#endif // QAHISCREEN_H
diff --git a/src/plugins/gfxdrivers/ahi/qscreenahiplugin.cpp b/src/plugins/gfxdrivers/ahi/qscreenahiplugin.cpp
deleted file mode 100644
index 7fdb7789b8..0000000000
--- a/src/plugins/gfxdrivers/ahi/qscreenahiplugin.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreenahi_qws.h"
-
-#include <QScreenDriverPlugin>
-#include <QStringList>
-
-class QAhiScreenPlugin : public QScreenDriverPlugin
-{
-public:
- QAhiScreenPlugin();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-
-QAhiScreenPlugin::QAhiScreenPlugin()
- : QScreenDriverPlugin()
-{
-}
-
-QStringList QAhiScreenPlugin::keys() const
-{
- return (QStringList() << "ahi");
-}
-
-QScreen* QAhiScreenPlugin::create(const QString& driver, int displayId)
-{
- if (driver.toLower() != "ahi")
- return 0;
-
- return new QAhiScreen(displayId);
-}
-
-Q_EXPORT_PLUGIN2(qahiscreen, QAhiScreenPlugin)
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
deleted file mode 100644
index 54d11ca159..0000000000
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TARGET = qdirectfbscreen
-include(../../qpluginbase.pri)
-include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri)
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
-
-SOURCES += qdirectfbscreenplugin.cpp
-
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
-LIBS += $$QT_LIBS_DIRECTFB
-DEFINES += $$QT_DEFINES_DIRECTFB
-contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
deleted file mode 100644
index 5c6842edca..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
+++ /dev/null
@@ -1,436 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbkeyboard.h"
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-#include "qdirectfbscreen.h"
-#include <qobject.h>
-#include <qsocketnotifier.h>
-#include <qhash.h>
-
-#include <directfb.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-QT_BEGIN_NAMESPACE
-
-class KeyMap : public QHash<DFBInputDeviceKeySymbol, Qt::Key>
-{
-public:
- KeyMap();
-};
-
-Q_GLOBAL_STATIC(KeyMap, keymap);
-
-class QDirectFBKeyboardHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboardHandler *handler);
- ~QDirectFBKeyboardHandlerPrivate();
-
- void suspend();
- void resume();
-
-private:
- QDirectFBKeyboardHandler *handler;
- IDirectFBEventBuffer *eventBuffer;
- QSocketNotifier *keyboardNotifier;
- DFBEvent event;
- int bytesRead;
- int lastUnicode, lastKeycode;
- Qt::KeyboardModifiers lastModifiers;
-private Q_SLOTS:
- void readKeyboardData();
-};
-
-QDirectFBKeyboardHandlerPrivate::QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboardHandler *h)
- : handler(h), eventBuffer(0), keyboardNotifier(0), bytesRead(0),
- lastUnicode(0), lastKeycode(0), lastModifiers(0)
-{
- Q_ASSERT(qt_screen);
-
- IDirectFB *fb = QDirectFBScreen::instance()->dfb();
- if (!fb) {
- qCritical("QDirectFBKeyboardHandler: DirectFB not initialized");
- return;
- }
-
- DFBResult result;
- result = fb->CreateInputEventBuffer(fb, DICAPS_KEYS, DFB_TRUE,
- &eventBuffer);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBKeyboardHandler: "
- "Unable to create input event buffer", result);
- return;
- }
-
- int fd;
- result = eventBuffer->CreateFileDescriptor(eventBuffer, &fd);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBKeyboardHandler: "
- "Unable to create file descriptor", result);
- return;
- }
-
- int flags = ::fcntl(fd, F_GETFL, 0);
- ::fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-
- memset(&event, 0, sizeof(event));
-
- keyboardNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
- connect(keyboardNotifier, SIGNAL(activated(int)),
- this, SLOT(readKeyboardData()));
- resume();
-}
-
-void QDirectFBKeyboardHandlerPrivate::suspend()
-{
- keyboardNotifier->setEnabled(false);
-}
-
-void QDirectFBKeyboardHandlerPrivate::resume()
-{
- eventBuffer->Reset(eventBuffer);
- keyboardNotifier->setEnabled(true);
-}
-
-QDirectFBKeyboardHandlerPrivate::~QDirectFBKeyboardHandlerPrivate()
-{
- if (eventBuffer)
- eventBuffer->Release(eventBuffer);
-}
-
-void QDirectFBKeyboardHandlerPrivate::readKeyboardData()
-{
- if(!qt_screen)
- return;
-
- for (;;) {
- // GetEvent returns DFB_UNSUPPORTED after CreateFileDescriptor().
- // This seems stupid and I really hope it's a bug which will be fixed.
-
- // DFBResult ret = eventBuffer->GetEvent(eventBuffer, &event);
-
- char *buf = reinterpret_cast<char*>(&event);
- int ret = ::read(keyboardNotifier->socket(),
- buf + bytesRead, sizeof(DFBEvent) - bytesRead);
- if (ret == -1) {
- if (errno != EAGAIN)
- qWarning("QDirectFBKeyboardHandlerPrivate::readKeyboardData(): %s",
- strerror(errno));
- return;
- }
-
- Q_ASSERT(ret >= 0);
- bytesRead += ret;
- if (bytesRead < int(sizeof(DFBEvent)))
- break;
- bytesRead = 0;
-
- Q_ASSERT(event.clazz == DFEC_INPUT);
-
- const DFBInputEvent input = event.input;
-
- Qt::KeyboardModifiers modifiers = Qt::NoModifier;
-
- // Not implemented:
- // if (input.modifiers & DIMM_SUPER)
- // if (input.modifiers & DIMM_HYPER)
-
- if (!(input.flags & DIEF_KEYSYMBOL) ||
- !(input.flags & DIEF_KEYID) ||
- !(input.type & (DIET_KEYPRESS|DIET_KEYRELEASE)))
- {
- static bool first = true;
- if (first) {
- qWarning("QDirectFBKeyboardHandler - Getting unexpected non-keyboard related events");
- first = false;
- }
- break;
- }
-
- if (input.flags & DIEF_MODIFIERS) {
- if (input.modifiers & DIMM_SHIFT)
- modifiers |= Qt::ShiftModifier;
- if (input.modifiers & DIMM_CONTROL)
- modifiers |= Qt::ControlModifier;
- if (input.modifiers & DIMM_ALT)
- modifiers |= Qt::AltModifier;
- if (input.modifiers & DIMM_ALTGR)
- modifiers |= Qt::AltModifier;
- if (input.modifiers & DIMM_META)
- modifiers |= Qt::MetaModifier;
- }
-
-
- const bool press = input.type & DIET_KEYPRESS;
- DFBInputDeviceKeySymbol symbol = input.key_symbol;
- int unicode = -1;
- int keycode = 0;
-
- keycode = keymap()->value(symbol);
- if (DFB_KEY_TYPE(symbol) == DIKT_UNICODE)
- unicode = symbol;
-
- if (unicode != -1 || keycode != 0) {
- bool autoRepeat = false;
- if (press) {
- if (unicode == lastUnicode && keycode == lastKeycode && modifiers == lastModifiers) {
- autoRepeat = true;
- } else {
- lastUnicode = unicode;
- lastKeycode = keycode;
- lastModifiers = modifiers;
- }
- } else {
- lastUnicode = lastKeycode = -1;
- lastModifiers = 0;
- }
- if (autoRepeat) {
- handler->processKeyEvent(unicode, keycode,
- modifiers, false, autoRepeat);
-
- }
-
- handler->processKeyEvent(unicode, keycode,
- modifiers, press, autoRepeat);
- }
- }
-}
-
-QDirectFBKeyboardHandler::QDirectFBKeyboardHandler(const QString &device)
- : QWSKeyboardHandler()
-{
- Q_UNUSED(device);
- d = new QDirectFBKeyboardHandlerPrivate(this);
-}
-
-QDirectFBKeyboardHandler::~QDirectFBKeyboardHandler()
-{
- delete d;
-}
-
-KeyMap::KeyMap()
-{
- insert(DIKS_BACKSPACE , Qt::Key_Backspace);
- insert(DIKS_TAB , Qt::Key_Tab);
- insert(DIKS_RETURN , Qt::Key_Return);
- insert(DIKS_ESCAPE , Qt::Key_Escape);
- insert(DIKS_DELETE , Qt::Key_Delete);
-
- insert(DIKS_CURSOR_LEFT , Qt::Key_Left);
- insert(DIKS_CURSOR_RIGHT , Qt::Key_Right);
- insert(DIKS_CURSOR_UP , Qt::Key_Up);
- insert(DIKS_CURSOR_DOWN , Qt::Key_Down);
- insert(DIKS_INSERT , Qt::Key_Insert);
- insert(DIKS_HOME , Qt::Key_Home);
- insert(DIKS_END , Qt::Key_End);
- insert(DIKS_PAGE_UP , Qt::Key_PageUp);
- insert(DIKS_PAGE_DOWN , Qt::Key_PageDown);
- insert(DIKS_PRINT , Qt::Key_Print);
- insert(DIKS_PAUSE , Qt::Key_Pause);
- insert(DIKS_SELECT , Qt::Key_Select);
- insert(DIKS_GOTO , Qt::Key_OpenUrl);
- insert(DIKS_CLEAR , Qt::Key_Clear);
- insert(DIKS_MENU , Qt::Key_Menu);
- insert(DIKS_HELP , Qt::Key_Help);
-
- insert(DIKS_INTERNET , Qt::Key_HomePage);
- insert(DIKS_MAIL , Qt::Key_LaunchMail);
- insert(DIKS_FAVORITES , Qt::Key_Favorites);
-
- insert(DIKS_BACK , Qt::Key_Back);
- insert(DIKS_FORWARD , Qt::Key_Forward);
- insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp);
- insert(DIKS_VOLUME_DOWN , Qt::Key_VolumeDown);
- insert(DIKS_MUTE , Qt::Key_VolumeMute);
- insert(DIKS_PLAYPAUSE , Qt::Key_Pause);
- insert(DIKS_PLAY , Qt::Key_MediaPlay);
- insert(DIKS_STOP , Qt::Key_MediaStop);
- insert(DIKS_RECORD , Qt::Key_MediaRecord);
- insert(DIKS_PREVIOUS , Qt::Key_MediaPrevious);
- insert(DIKS_NEXT , Qt::Key_MediaNext);
-
- insert(DIKS_F1 , Qt::Key_F1);
- insert(DIKS_F2 , Qt::Key_F2);
- insert(DIKS_F3 , Qt::Key_F3);
- insert(DIKS_F4 , Qt::Key_F4);
- insert(DIKS_F5 , Qt::Key_F5);
- insert(DIKS_F6 , Qt::Key_F6);
- insert(DIKS_F7 , Qt::Key_F7);
- insert(DIKS_F8 , Qt::Key_F8);
- insert(DIKS_F9 , Qt::Key_F9);
- insert(DIKS_F10 , Qt::Key_F10);
- insert(DIKS_F11 , Qt::Key_F11);
- insert(DIKS_F12 , Qt::Key_F12);
-
- insert(DIKS_SHIFT , Qt::Key_Shift);
- insert(DIKS_CONTROL , Qt::Key_Control);
- insert(DIKS_ALT , Qt::Key_Alt);
- insert(DIKS_ALTGR , Qt::Key_AltGr);
-
- insert(DIKS_META , Qt::Key_Meta);
- insert(DIKS_SUPER , Qt::Key_Super_L); // ???
- insert(DIKS_HYPER , Qt::Key_Hyper_L); // ???
-
- insert(DIKS_CAPS_LOCK , Qt::Key_CapsLock);
- insert(DIKS_NUM_LOCK , Qt::Key_NumLock);
- insert(DIKS_SCROLL_LOCK , Qt::Key_ScrollLock);
-
- insert(DIKS_DEAD_ABOVEDOT , Qt::Key_Dead_Abovedot);
- insert(DIKS_DEAD_ABOVERING , Qt::Key_Dead_Abovering);
- insert(DIKS_DEAD_ACUTE , Qt::Key_Dead_Acute);
- insert(DIKS_DEAD_BREVE , Qt::Key_Dead_Breve);
- insert(DIKS_DEAD_CARON , Qt::Key_Dead_Caron);
- insert(DIKS_DEAD_CEDILLA , Qt::Key_Dead_Cedilla);
- insert(DIKS_DEAD_CIRCUMFLEX , Qt::Key_Dead_Circumflex);
- insert(DIKS_DEAD_DIAERESIS , Qt::Key_Dead_Diaeresis);
- insert(DIKS_DEAD_DOUBLEACUTE , Qt::Key_Dead_Doubleacute);
- insert(DIKS_DEAD_GRAVE , Qt::Key_Dead_Grave);
- insert(DIKS_DEAD_IOTA , Qt::Key_Dead_Iota);
- insert(DIKS_DEAD_MACRON , Qt::Key_Dead_Macron);
- insert(DIKS_DEAD_OGONEK , Qt::Key_Dead_Ogonek);
- insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound);
- insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde);
- insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound);
- insert(DIKS_SPACE , Qt::Key_Space);
- insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam);
- insert(DIKS_QUOTATION , Qt::Key_QuoteDbl);
- insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign);
- insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar);
- insert(DIKS_PERCENT_SIGN , Qt::Key_Percent);
- insert(DIKS_AMPERSAND , Qt::Key_Ampersand);
- insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe);
- insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft);
- insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight);
- insert(DIKS_ASTERISK , Qt::Key_Asterisk);
- insert(DIKS_PLUS_SIGN , Qt::Key_Plus);
- insert(DIKS_COMMA , Qt::Key_Comma);
- insert(DIKS_MINUS_SIGN , Qt::Key_Minus);
- insert(DIKS_PERIOD , Qt::Key_Period);
- insert(DIKS_SLASH , Qt::Key_Slash);
- insert(DIKS_0 , Qt::Key_0);
- insert(DIKS_1 , Qt::Key_1);
- insert(DIKS_2 , Qt::Key_2);
- insert(DIKS_3 , Qt::Key_3);
- insert(DIKS_4 , Qt::Key_4);
- insert(DIKS_5 , Qt::Key_5);
- insert(DIKS_6 , Qt::Key_6);
- insert(DIKS_7 , Qt::Key_7);
- insert(DIKS_8 , Qt::Key_8);
- insert(DIKS_9 , Qt::Key_9);
- insert(DIKS_COLON , Qt::Key_Colon);
- insert(DIKS_SEMICOLON , Qt::Key_Semicolon);
- insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less);
- insert(DIKS_EQUALS_SIGN , Qt::Key_Equal);
- insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater);
- insert(DIKS_QUESTION_MARK , Qt::Key_Question);
- insert(DIKS_AT , Qt::Key_At);
- insert(DIKS_CAPITAL_A , Qt::Key_A);
- insert(DIKS_CAPITAL_B , Qt::Key_B);
- insert(DIKS_CAPITAL_C , Qt::Key_C);
- insert(DIKS_CAPITAL_D , Qt::Key_D);
- insert(DIKS_CAPITAL_E , Qt::Key_E);
- insert(DIKS_CAPITAL_F , Qt::Key_F);
- insert(DIKS_CAPITAL_G , Qt::Key_G);
- insert(DIKS_CAPITAL_H , Qt::Key_H);
- insert(DIKS_CAPITAL_I , Qt::Key_I);
- insert(DIKS_CAPITAL_J , Qt::Key_J);
- insert(DIKS_CAPITAL_K , Qt::Key_K);
- insert(DIKS_CAPITAL_L , Qt::Key_L);
- insert(DIKS_CAPITAL_M , Qt::Key_M);
- insert(DIKS_CAPITAL_N , Qt::Key_N);
- insert(DIKS_CAPITAL_O , Qt::Key_O);
- insert(DIKS_CAPITAL_P , Qt::Key_P);
- insert(DIKS_CAPITAL_Q , Qt::Key_Q);
- insert(DIKS_CAPITAL_R , Qt::Key_R);
- insert(DIKS_CAPITAL_S , Qt::Key_S);
- insert(DIKS_CAPITAL_T , Qt::Key_T);
- insert(DIKS_CAPITAL_U , Qt::Key_U);
- insert(DIKS_CAPITAL_V , Qt::Key_V);
- insert(DIKS_CAPITAL_W , Qt::Key_W);
- insert(DIKS_CAPITAL_X , Qt::Key_X);
- insert(DIKS_CAPITAL_Y , Qt::Key_Y);
- insert(DIKS_CAPITAL_Z , Qt::Key_Z);
- insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft);
- insert(DIKS_BACKSLASH , Qt::Key_Backslash);
- insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight);
- insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum);
- insert(DIKS_UNDERSCORE , Qt::Key_Underscore);
- insert(DIKS_SMALL_A , Qt::Key_A);
- insert(DIKS_SMALL_B , Qt::Key_B);
- insert(DIKS_SMALL_C , Qt::Key_C);
- insert(DIKS_SMALL_D , Qt::Key_D);
- insert(DIKS_SMALL_E , Qt::Key_E);
- insert(DIKS_SMALL_F , Qt::Key_F);
- insert(DIKS_SMALL_G , Qt::Key_G);
- insert(DIKS_SMALL_H , Qt::Key_H);
- insert(DIKS_SMALL_I , Qt::Key_I);
- insert(DIKS_SMALL_J , Qt::Key_J);
- insert(DIKS_SMALL_K , Qt::Key_K);
- insert(DIKS_SMALL_L , Qt::Key_L);
- insert(DIKS_SMALL_M , Qt::Key_M);
- insert(DIKS_SMALL_N , Qt::Key_N);
- insert(DIKS_SMALL_O , Qt::Key_O);
- insert(DIKS_SMALL_P , Qt::Key_P);
- insert(DIKS_SMALL_Q , Qt::Key_Q);
- insert(DIKS_SMALL_R , Qt::Key_R);
- insert(DIKS_SMALL_S , Qt::Key_S);
- insert(DIKS_SMALL_T , Qt::Key_T);
- insert(DIKS_SMALL_U , Qt::Key_U);
- insert(DIKS_SMALL_V , Qt::Key_V);
- insert(DIKS_SMALL_W , Qt::Key_W);
- insert(DIKS_SMALL_X , Qt::Key_X);
- insert(DIKS_SMALL_Y , Qt::Key_Y);
- insert(DIKS_SMALL_Z , Qt::Key_Z);
- insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft);
- insert(DIKS_VERTICAL_BAR , Qt::Key_Bar);
- insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight);
- insert(DIKS_TILDE , Qt::Key_AsciiTilde);
-}
-
-QT_END_NAMESPACE
-#include "qdirectfbkeyboard.moc"
-#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
deleted file mode 100644
index 49c1c18b22..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECTFBKEYBOARD_H
-#define QDIRECTFBKEYBOARD_H
-
-#include <qglobal.h>
-#include <QtGui/qkbd_qws.h>
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QDirectFBKeyboardHandlerPrivate;
-
-class QDirectFBKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- QDirectFBKeyboardHandler(const QString &device);
- ~QDirectFBKeyboardHandler();
-
-private:
- QDirectFBKeyboardHandlerPrivate *d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_DIRECTFB
-
-QT_END_HEADER
-
-#endif // QDIRECTFBKEYBOARD_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
deleted file mode 100644
index 3999b85afb..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbmouse.h"
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-#include "qdirectfbscreen.h"
-#include <qsocketnotifier.h>
-
-#include <directfb.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDirectFBMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler *h);
- ~QDirectFBMouseHandlerPrivate();
-
- void setEnabled(bool on);
-private:
- QDirectFBMouseHandler *handler;
- IDirectFBEventBuffer *eventBuffer;
-#ifndef QT_NO_DIRECTFB_LAYER
- IDirectFBDisplayLayer *layer;
-#endif
- QSocketNotifier *mouseNotifier;
-
- QPoint prevPoint;
- Qt::MouseButtons prevbuttons;
-
- DFBEvent event;
- uint bytesRead;
-
-private Q_SLOTS:
- void readMouseData();
-};
-
-QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler *h)
- : handler(h), eventBuffer(0)
-{
- DFBResult result;
-
- QScreen *screen = QScreen::instance();
- if (!screen) {
- qCritical("QDirectFBMouseHandler: no screen instance found");
- return;
- }
-
- IDirectFB *fb = QDirectFBScreen::instance()->dfb();
- if (!fb) {
- qCritical("QDirectFBMouseHandler: DirectFB not initialized");
- return;
- }
-
-#ifndef QT_NO_DIRECTFB_LAYER
- layer = QDirectFBScreen::instance()->dfbDisplayLayer();
- if (!layer) {
- qCritical("QDirectFBMouseHandler: Unable to get primary display layer");
- return;
- }
-#endif
-
- DFBInputDeviceCapabilities caps;
- caps = DICAPS_BUTTONS | DICAPS_AXES;
- result = fb->CreateInputEventBuffer(fb, caps, DFB_TRUE, &eventBuffer);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBMouseHandler: "
- "Unable to create input event buffer", result);
- return;
- }
-
- int fd;
- result = eventBuffer->CreateFileDescriptor(eventBuffer, &fd);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBMouseHandler: "
- "Unable to create file descriptor", result);
- return;
- }
-
- int flags = fcntl(fd, F_GETFL, 0);
- fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-
- // DirectFB seems to assume that the mouse always starts centered
- prevPoint = QPoint(screen->deviceWidth() / 2, screen->deviceHeight() / 2);
- prevbuttons = Qt::NoButton;
- memset(&event, 0, sizeof(event));
- bytesRead = 0;
-
- mouseNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
- setEnabled(true);
-}
-
-QDirectFBMouseHandlerPrivate::~QDirectFBMouseHandlerPrivate()
-{
- if (eventBuffer)
- eventBuffer->Release(eventBuffer);
-}
-
-void QDirectFBMouseHandlerPrivate::setEnabled(bool on)
-{
- if (mouseNotifier->isEnabled() != on) {
-#ifndef QT_NO_DIRECTFB_LAYER
- DFBResult result;
- result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: "
- "Unable to set cooperative level", result);
- }
- result = layer->EnableCursor(layer, on ? 1 : 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: "
- "Unable to enable cursor", result);
- }
-
- result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cooperative level", result);
- }
-
- layer->SetCooperativeLevel(layer, DLSCL_SHARED);
-#endif
- mouseNotifier->setEnabled(on);
- }
-}
-
-void QDirectFBMouseHandlerPrivate::readMouseData()
-{
- if (!QScreen::instance())
- return;
-
- for (;;) {
- // GetEvent returns DFB_UNSUPPORTED after CreateFileDescriptor().
- // This seems stupid and I really hope it's a bug which will be fixed.
-
- // DFBResult ret = eventBuffer->GetEvent(eventBuffer, &event);
-
- char *buf = reinterpret_cast<char*>(&event);
- int ret = ::read(mouseNotifier->socket(),
- buf + bytesRead, sizeof(DFBEvent) - bytesRead);
- if (ret == -1) {
- if (errno == EINTR)
- continue;
- if (errno == EAGAIN)
- return;
- qWarning("QDirectFBMouseHandlerPrivate::readMouseData(): %s",
- strerror(errno));
- return;
- }
-
- Q_ASSERT(ret >= 0);
- bytesRead += ret;
- if (bytesRead < sizeof(DFBEvent))
- break;
- bytesRead = 0;
-
- Q_ASSERT(event.clazz == DFEC_INPUT);
-
- const DFBInputEvent input = event.input;
- int x = prevPoint.x();
- int y = prevPoint.y();
- int wheel = 0;
-
- if (input.type == DIET_AXISMOTION) {
-#if defined(QT_NO_DIRECTFB_LAYER) || defined(QT_DIRECTFB_WINDOW_AS_CURSOR)
- if (input.flags & DIEF_AXISABS) {
- switch (input.axis) {
- case DIAI_X: x = input.axisabs; break;
- case DIAI_Y: y = input.axisabs; break;
- default:
- qWarning("QDirectFBMouseHandlerPrivate::readMouseData: "
- "unknown axis (absolute) %d", input.axis);
- break;
- }
- } else if (input.flags & DIEF_AXISREL) {
- switch (input.axis) {
- case DIAI_X: x += input.axisrel; break;
- case DIAI_Y: y += input.axisrel; break;
- case DIAI_Z: wheel = -120 * input.axisrel; break;
- default:
- qWarning("QDirectFBMouseHandlerPrivate::readMouseData: "
- "unknown axis (releative) %d", input.axis);
- }
- }
-#else
- if (input.axis == DIAI_X || input.axis == DIAI_Y) {
- DFBResult result = layer->GetCursorPosition(layer, &x, &y);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBMouseHandler::readMouseData",
- result);
- }
- } else if (input.axis == DIAI_Z) {
- Q_ASSERT(input.flags & DIEF_AXISREL);
- wheel = input.axisrel;
- wheel *= -120;
- }
-#endif
- }
-
- Qt::MouseButtons buttons = Qt::NoButton;
- if (input.flags & DIEF_BUTTONS) {
- if (input.buttons & DIBM_LEFT)
- buttons |= Qt::LeftButton;
- if (input.buttons & DIBM_MIDDLE)
- buttons |= Qt::MidButton;
- if (input.buttons & DIBM_RIGHT)
- buttons |= Qt::RightButton;
- }
-
- QPoint p = QPoint(x, y);
- handler->limitToScreen(p);
-
- if (p == prevPoint && wheel == 0 && buttons == prevbuttons)
- continue;
-
- prevPoint = p;
- prevbuttons = buttons;
-
- handler->mouseChanged(p, buttons, wheel);
- }
-}
-
-QDirectFBMouseHandler::QDirectFBMouseHandler(const QString &driver,
- const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QDirectFBMouseHandlerPrivate(this);
-}
-
-QDirectFBMouseHandler::~QDirectFBMouseHandler()
-{
- delete d;
-}
-
-void QDirectFBMouseHandler::suspend()
-{
- d->setEnabled(false);
-}
-
-void QDirectFBMouseHandler::resume()
-{
- d->setEnabled(true);
-}
-
-QT_END_NAMESPACE
-#include "qdirectfbmouse.moc"
-#endif // QT_NO_QWS_DIRECTFB
-
-
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
deleted file mode 100644
index ac0fcadfaa..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECTFBMOUSE_H
-#define QDIRECTFBMOUSE_H
-
-#include <qglobal.h>
-#include <QtGui/qmouse_qws.h>
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QDirectFBMouseHandlerPrivate;
-
-class QDirectFBMouseHandler : public QWSMouseHandler
-{
-public:
- explicit QDirectFBMouseHandler(const QString &driver = QString(),
- const QString &device = QString());
- ~QDirectFBMouseHandler();
-
- void suspend();
- void resume();
-protected:
- QDirectFBMouseHandlerPrivate *d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-#endif // QT_NO_QWS_DIRECTFB
-#endif // QDIRECTFBMOUSE_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
deleted file mode 100644
index 10f1bb3f46..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbscreen.h"
-#include "qdirectfbpaintdevice.h"
-#include "qdirectfbpaintengine.h"
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-QT_BEGIN_NAMESPACE
-
-QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr)
- : QCustomRasterPaintDevice(0), dfbSurface(0), screen(scr),
- bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), imageFormat(QImage::Format_Invalid)
-{
-#ifdef QT_DIRECTFB_SUBSURFACE
- subSurface = 0;
- syncPending = false;
-#endif
-}
-
-QDirectFBPaintDevice::~QDirectFBPaintDevice()
-{
- if (QDirectFBScreen::instance()) {
- unlockSurface();
-#ifdef QT_DIRECTFB_SUBSURFACE
- releaseSubSurface();
-#endif
- if (dfbSurface) {
- screen->releaseDFBSurface(dfbSurface);
- }
- }
- delete engine;
-}
-
-IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const
-{
- return dfbSurface;
-}
-
-bool QDirectFBPaintDevice::lockSurface(DFBSurfaceLockFlags lockFlags)
-{
- if (lockFlgs && (lockFlags & ~lockFlgs))
- unlockSurface();
- if (!mem) {
- Q_ASSERT(dfbSurface);
-#ifdef QT_DIRECTFB_SUBSURFACE
- if (!subSurface) {
- DFBResult result;
- subSurface = screen->getSubSurface(dfbSurface, QRect(), QDirectFBScreen::TrackSurface, &result);
- if (result != DFB_OK || !subSurface) {
- DirectFBError("Couldn't create sub surface", result);
- return false;
- }
- }
- IDirectFBSurface *surface = subSurface;
-#else
- IDirectFBSurface *surface = dfbSurface;
-#endif
- Q_ASSERT(surface);
- mem = QDirectFBScreen::lockSurface(surface, lockFlags, &bpl);
- lockFlgs = lockFlags;
- Q_ASSERT(mem);
- Q_ASSERT(bpl > 0);
- const QSize s = size();
- lockedImage = QImage(mem, s.width(), s.height(), bpl,
- QDirectFBScreen::getImageFormat(dfbSurface));
- return true;
- }
-#ifdef QT_DIRECTFB_SUBSURFACE
- if (syncPending) {
- syncPending = false;
- screen->waitIdle();
- }
-#endif
- return false;
-}
-
-void QDirectFBPaintDevice::unlockSurface()
-{
- if (QDirectFBScreen::instance() && lockFlgs) {
-#ifdef QT_DIRECTFB_SUBSURFACE
- IDirectFBSurface *surface = subSurface;
-#else
- IDirectFBSurface *surface = dfbSurface;
-#endif
- if (surface) {
- surface->Unlock(surface);
- lockFlgs = static_cast<DFBSurfaceLockFlags>(0);
- mem = 0;
- }
- }
-}
-
-void *QDirectFBPaintDevice::memory() const
-{
- return mem;
-}
-
-QImage::Format QDirectFBPaintDevice::format() const
-{
- return imageFormat;
-}
-
-int QDirectFBPaintDevice::bytesPerLine() const
-{
- Q_ASSERT(!mem || bpl != -1);
- return bpl;
-}
-
-QSize QDirectFBPaintDevice::size() const
-{
- int w, h;
- dfbSurface->GetSize(dfbSurface, &w, &h);
- return QSize(w, h);
-}
-
-int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
-{
- if (!dfbSurface)
- return 0;
-
- switch (metric) {
- case QPaintDevice::PdmWidth:
- case QPaintDevice::PdmHeight:
- return (metric == PdmWidth ? size().width() : size().height());
- case QPaintDevice::PdmWidthMM:
- return (size().width() * 1000) / dotsPerMeterX();
- case QPaintDevice::PdmHeightMM:
- return (size().height() * 1000) / dotsPerMeterY();
- case QPaintDevice::PdmPhysicalDpiX:
- case QPaintDevice::PdmDpiX:
- return (dotsPerMeterX() * 254) / 10000; // 0.0254 meters-per-inch
- case QPaintDevice::PdmPhysicalDpiY:
- case QPaintDevice::PdmDpiY:
- return (dotsPerMeterY() * 254) / 10000; // 0.0254 meters-per-inch
- case QPaintDevice::PdmDepth:
- return QDirectFBScreen::depth(imageFormat);
- case QPaintDevice::PdmNumColors: {
- if (!lockedImage.isNull())
- return lockedImage.colorCount();
-
- DFBResult result;
- IDirectFBPalette *palette = 0;
- unsigned int numColors = 0;
-
- result = dfbSurface->GetPalette(dfbSurface, &palette);
- if ((result != DFB_OK) || !palette)
- return 0;
-
- result = palette->GetSize(palette, &numColors);
- palette->Release(palette);
- if (result != DFB_OK)
- return 0;
-
- return numColors;
- }
- default:
- qCritical("QDirectFBPaintDevice::metric(): Unhandled metric!");
- return 0;
- }
-}
-
-QPaintEngine *QDirectFBPaintDevice::paintEngine() const
-{
- return engine;
-}
-
-#ifdef QT_DIRECTFB_SUBSURFACE
-void QDirectFBPaintDevice::releaseSubSurface()
-{
- Q_ASSERT(QDirectFBScreen::instance());
- if (subSurface) {
- unlockSurface();
- screen->releaseDFBSurface(subSurface);
- subSurface = 0;
- }
-}
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
deleted file mode 100644
index 71a7a8e104..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECTFBPAINTDEVICE_H
-#define QDIRECTFBPAINTDEVICE_H
-
-#include <private/qpaintengine_raster_p.h>
-#include "qdirectfbscreen.h"
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-// Inherited by both window surface and pixmap
-class QDirectFBPaintEngine;
-class QDirectFBPaintDevice : public QCustomRasterPaintDevice
-{
-public:
- ~QDirectFBPaintDevice();
-
- virtual IDirectFBSurface *directFBSurface() const;
-
- bool lockSurface(DFBSurfaceLockFlags lockFlags);
- void unlockSurface();
-
- // Reimplemented from QCustomRasterPaintDevice:
- void *memory() const;
- QImage::Format format() const;
- int bytesPerLine() const;
- QSize size() const;
- int metric(QPaintDevice::PaintDeviceMetric metric) const;
- DFBSurfaceLockFlags lockFlags() const { return lockFlgs; }
- QPaintEngine *paintEngine() const;
-protected:
- QDirectFBPaintDevice(QDirectFBScreen *scr);
- inline int dotsPerMeterX() const
- {
- return (screen->deviceWidth() * 1000) / screen->physicalWidth();
- }
- inline int dotsPerMeterY() const
- {
- return (screen->deviceHeight() * 1000) / screen->physicalHeight();
- }
-
- IDirectFBSurface *dfbSurface;
-#ifdef QT_DIRECTFB_SUBSURFACE
- void releaseSubSurface();
- IDirectFBSurface *subSurface;
- friend class QDirectFBPaintEnginePrivate;
- bool syncPending;
-#endif
- QImage lockedImage;
- QDirectFBScreen *screen;
- int bpl;
- DFBSurfaceLockFlags lockFlgs;
- uchar *mem;
- QDirectFBPaintEngine *engine;
- QImage::Format imageFormat;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_DIRECTFB
-#endif //QDIRECTFBPAINTDEVICE_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
deleted file mode 100644
index 6d6fb02a68..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ /dev/null
@@ -1,1430 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbpaintengine.h"
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-#include "qdirectfbwindowsurface.h"
-#include "qdirectfbscreen.h"
-#include "qdirectfbpixmap.h"
-#include <directfb.h>
-#include <qtransform.h>
-#include <qvarlengtharray.h>
-#include <qcache.h>
-#include <qmath.h>
-#include <private/qpixmapdata_p.h>
-#include <private/qpixmap_raster_p.h>
-#include <private/qimagepixmapcleanuphooks_p.h>
-
-
-QT_BEGIN_NAMESPACE
-
-class SurfaceCache;
-class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
-{
-public:
- enum TransformationTypeFlags {
- Matrix_NegativeScale = 0x100,
- Matrix_RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject),
- Matrix_BlitsUnsupported = (Matrix_NegativeScale|Matrix_RectsUnsupported)
- };
-
- inline static uint getTransformationType(const QTransform &transform)
- {
- int ret = transform.type();
- if (qMin(transform.m11(), transform.m22()) < 0) {
- ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale;
- }
- return ret;
- }
-
- enum CompositionModeStatus {
- PorterDuff_None = 0x0,
- PorterDuff_Supported = 0x1,
- PorterDuff_PremultiplyColors = 0x2,
- PorterDuff_AlwaysBlend = 0x4
- };
-
- enum ClipType {
- ClipUnset,
- NoClip,
- RectClip,
- RegionClip,
- ComplexClip
- };
-
- QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p);
- ~QDirectFBPaintEnginePrivate();
-
- inline void setTransform(const QTransform &transforma);
- inline void setPen(const QPen &pen);
- inline void setCompositionMode(QPainter::CompositionMode mode);
- inline void setRenderHints(QPainter::RenderHints hints);
-
- inline void setDFBColor(const QColor &color);
-
- inline void lock();
- inline void unlock();
- static inline void unlock(QDirectFBPaintDevice *device);
-
- inline bool isSimpleBrush(const QBrush &brush) const;
-
- void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos, const QTransform &pixmapTransform);
- void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src);
-
- inline bool supportsStretchBlit() const;
-
- inline void updateClip();
- virtual void systemStateChanged();
-
- static IDirectFBSurface *getSurface(const QImage &img, bool *release);
-
-#ifdef QT_DIRECTFB_IMAGECACHE
- static inline int cacheCost(const QImage &img) { return img.width() * img.height() * img.depth() / 8; }
-#endif
-
- enum BlitFlag {
- HasAlpha = 0x1,
- Premultiplied = 0x2
- };
- void prepareForBlit(uint blitFlags);
-
- IDirectFBSurface *surface;
-
- bool antialiased;
- bool simplePen;
-
- uint transformationType; // this is QTransform::type() + Matrix_NegativeScale if qMin(transform.m11(), transform.m22()) < 0
-
- SurfaceCache *surfaceCache;
- IDirectFB *fb;
- quint8 opacity;
-
- ClipType clipType;
- QDirectFBPaintDevice *dfbDevice;
- uint compositionModeStatus;
- bool isPremultiplied;
-
- bool inClip;
- QRect currentClip;
-
- QDirectFBPaintEngine *q;
-};
-
-class SurfaceCache
-{
-public:
- SurfaceCache() : surface(0), buffer(0), bufsize(0) {}
- ~SurfaceCache() { clear(); }
- IDirectFBSurface *getSurface(const uint *buf, int size);
- void clear();
-private:
- IDirectFBSurface *surface;
- uint *buffer;
- int bufsize;
-};
-
-
-#ifdef QT_DIRECTFB_IMAGECACHE
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <private/qimage_p.h>
-QT_END_INCLUDE_NAMESPACE
-struct CachedImage
-{
- IDirectFBSurface *surface;
- ~CachedImage()
- {
- if (surface && QDirectFBScreen::instance()) {
- QDirectFBScreen::instance()->releaseDFBSurface(surface);
- }
- }
-};
-static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
-#endif
-
-#define VOID_ARG() static_cast<bool>(false)
-enum PaintOperation {
- DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004,
- DRAW_PIXMAP = 0x0008, DRAW_TILED_PIXMAP = 0x0010, STROKE_PATH = 0x0020,
- DRAW_PATH = 0x0040, DRAW_POINTS = 0x0080, DRAW_ELLIPSE = 0x0100,
- DRAW_POLYGON = 0x0200, DRAW_TEXT = 0x0400, FILL_PATH = 0x0800,
- FILL_RECT = 0x1000, DRAW_COLORSPANS = 0x2000, DRAW_ROUNDED_RECT = 0x4000,
- DRAW_STATICTEXT = 0x8000, ALL = 0xffff
-};
-
-enum { RasterWarn = 1, RasterDisable = 2 };
-static inline uint rasterFallbacksMask(PaintOperation op)
-{
- uint ret = 0;
-#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
- if (op & QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)
- ret |= RasterWarn;
-#endif
-#ifdef QT_DIRECTFB_DISABLE_RASTERFALLBACKS
- if (op & QT_DIRECTFB_DISABLE_RASTERFALLBACKS)
- ret |= RasterDisable;
-#endif
- static int warningMask = -1;
- static int disableMask = -1;
- if (warningMask < 0) {
- struct {
- const char *name;
- PaintOperation operation;
- } const operations[] = {
- { "DRAW_RECTS", DRAW_RECTS },
- { "DRAW_LINES", DRAW_LINES },
- { "DRAW_IMAGE", DRAW_IMAGE },
- { "DRAW_PIXMAP", DRAW_PIXMAP },
- { "DRAW_TILED_PIXMAP", DRAW_TILED_PIXMAP },
- { "STROKE_PATH", STROKE_PATH },
- { "DRAW_PATH", DRAW_PATH },
- { "DRAW_POINTS", DRAW_POINTS },
- { "DRAW_ELLIPSE", DRAW_ELLIPSE },
- { "DRAW_POLYGON", DRAW_POLYGON },
- { "DRAW_TEXT", DRAW_TEXT },
- { "FILL_PATH", FILL_PATH },
- { "FILL_RECT", FILL_RECT },
- { "DRAW_COLORSPANS", DRAW_COLORSPANS },
- { "DRAW_ROUNDED_RECT", DRAW_ROUNDED_RECT },
- { "ALL", ALL },
- { 0, ALL }
- };
-
- QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
- QString::SkipEmptyParts);
- QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
- QString::SkipEmptyParts);
- warningMask = 0;
- disableMask = 0;
- if (!warning.isEmpty() || !disable.isEmpty()) {
- for (int i=0; operations[i].name; ++i) {
- const QString name = QString::fromLatin1(operations[i].name);
- int idx = warning.indexOf(name);
- if (idx != -1) {
- warningMask |= operations[i].operation;
- warning.erase(warning.begin() + idx);
- }
- idx = disable.indexOf(name);
- if (idx != -1) {
- disableMask |= operations[i].operation;
- disable.erase(disable.begin() + idx);
- }
- }
- }
- if (!warning.isEmpty()) {
- qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s",
- qPrintable(warning.join(QLatin1String("|"))));
- }
- if (!disable.isEmpty()) {
- qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s",
- qPrintable(disable.join(QLatin1String("|"))));
- }
- }
- if (op & warningMask)
- ret |= RasterWarn;
- if (op & disableMask)
- ret |= RasterDisable;
- return ret;
-}
-
-template <typename device, typename T1, typename T2, typename T3>
-static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
- uint transformationType, bool simplePen,
- uint clipType, uint compositionModeStatus,
- const char *nameOne, const T1 &one,
- const char *nameTwo, const T2 &two,
- const char *nameThree, const T3 &three);
-
-#define RASTERFALLBACK(op, one, two, three) \
- { \
- static const uint rasterFallbacks = rasterFallbacksMask(op); \
- switch (rasterFallbacks) { \
- case 0: break; \
- case RasterWarn: \
- rasterFallbackWarn("Falling back to raster engine for", \
- __FUNCTION__, \
- state()->painter->device(), \
- d_func()->transformationType, \
- d_func()->simplePen, \
- d_func()->clipType, \
- d_func()->compositionModeStatus, \
- #one, one, #two, two, #three, three); \
- break; \
- case RasterDisable|RasterWarn: \
- rasterFallbackWarn("Disabled raster engine operation", \
- __FUNCTION__, \
- state()->painter->device(), \
- d_func()->transformationType, \
- d_func()->simplePen, \
- d_func()->clipType, \
- d_func()->compositionModeStatus, \
- #one, one, #two, two, #three, three); \
- case RasterDisable: \
- return; \
- } \
- }
-
-template <class T>
-static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface);
-template <class T>
-static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
-template <class T>
-static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
-
-#define CLIPPED_PAINT(operation) { \
- d->unlock(); \
- DFBRegion clipRegion; \
- switch (d->clipType) { \
- case QDirectFBPaintEnginePrivate::NoClip: \
- case QDirectFBPaintEnginePrivate::RectClip: \
- operation; \
- break; \
- case QDirectFBPaintEnginePrivate::RegionClip: { \
- Q_ASSERT(d->clip()); \
- const QVector<QRect> cr = d->clip()->clipRegion.rects(); \
- const int size = cr.size(); \
- for (int i=0; i<size; ++i) { \
- d->currentClip = cr.at(i); \
- clipRegion.x1 = d->currentClip.x(); \
- clipRegion.y1 = d->currentClip.y(); \
- clipRegion.x2 = d->currentClip.right(); \
- clipRegion.y2 = d->currentClip.bottom(); \
- d->surface->SetClip(d->surface, &clipRegion); \
- operation; \
- } \
- d->updateClip(); \
- break; } \
- case QDirectFBPaintEnginePrivate::ComplexClip: \
- case QDirectFBPaintEnginePrivate::ClipUnset: \
- qFatal("CLIPPED_PAINT internal error %d", d->clipType); \
- break; \
- } \
- }
-
-
-QDirectFBPaintEngine::QDirectFBPaintEngine(QPaintDevice *device)
- : QRasterPaintEngine(*(new QDirectFBPaintEnginePrivate(this)), device)
-{
-}
-
-QDirectFBPaintEngine::~QDirectFBPaintEngine()
-{
-}
-
-bool QDirectFBPaintEngine::begin(QPaintDevice *device)
-{
- Q_D(QDirectFBPaintEngine);
- if (device->devType() == QInternal::CustomRaster) {
- d->dfbDevice = static_cast<QDirectFBPaintDevice*>(device);
- } else if (device->devType() == QInternal::Pixmap) {
- QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData();
- Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
- QDirectFBPixmapData *dfbPixmapData = static_cast<QDirectFBPixmapData*>(data);
- QDirectFBPaintEnginePrivate::unlock(dfbPixmapData);
- d->dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData);
- }
-
- if (d->dfbDevice)
- d->surface = d->dfbDevice->directFBSurface();
-
- if (!d->surface) {
- qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x",
- device->devType());
- }
- d->isPremultiplied = QDirectFBScreen::isPremultiplied(d->dfbDevice->format());
-
- d->prepare(d->dfbDevice);
- gccaps = AllFeatures;
- d->setCompositionMode(state()->composition_mode);
-
- return QRasterPaintEngine::begin(device);
-}
-
-bool QDirectFBPaintEngine::end()
-{
- Q_D(QDirectFBPaintEngine);
- d->unlock();
- d->dfbDevice = 0;
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- d->surface->ReleaseSource(d->surface);
-#endif
- d->currentClip = QRect();
- d->surface->SetClip(d->surface, NULL);
- d->surface = 0;
- return QRasterPaintEngine::end();
-}
-
-void QDirectFBPaintEngine::clipEnabledChanged()
-{
- Q_D(QDirectFBPaintEngine);
- QRasterPaintEngine::clipEnabledChanged();
- d->updateClip();
-}
-
-void QDirectFBPaintEngine::penChanged()
-{
- Q_D(QDirectFBPaintEngine);
- d->setPen(state()->pen);
-
- QRasterPaintEngine::penChanged();
-}
-
-void QDirectFBPaintEngine::opacityChanged()
-{
- Q_D(QDirectFBPaintEngine);
- d->opacity = quint8(state()->opacity * 255);
- QRasterPaintEngine::opacityChanged();
-}
-
-void QDirectFBPaintEngine::compositionModeChanged()
-{
- Q_D(QDirectFBPaintEngine);
- d->setCompositionMode(state()->compositionMode());
- QRasterPaintEngine::compositionModeChanged();
-}
-
-void QDirectFBPaintEngine::renderHintsChanged()
-{
- Q_D(QDirectFBPaintEngine);
- d->setRenderHints(state()->renderHints);
- QRasterPaintEngine::renderHintsChanged();
-}
-
-void QDirectFBPaintEngine::transformChanged()
-{
- Q_D(QDirectFBPaintEngine);
- d->setTransform(state()->matrix);
- QRasterPaintEngine::transformChanged();
-}
-
-void QDirectFBPaintEngine::setState(QPainterState *state)
-{
- Q_D(QDirectFBPaintEngine);
- QRasterPaintEngine::setState(state);
- d->setPen(state->pen);
- d->opacity = quint8(state->opacity * 255);
- d->setCompositionMode(state->compositionMode());
- d->setTransform(state->transform());
- d->setRenderHints(state->renderHints);
- if (d->surface)
- d->updateClip();
-}
-
-void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
-{
- Q_D(QDirectFBPaintEngine);
- const bool wasInClip = d->inClip;
- d->inClip = true;
- QRasterPaintEngine::clip(path, op);
- if (!wasInClip) {
- d->inClip = false;
- d->updateClip();
- }
-}
-
-void QDirectFBPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
-{
- Q_D(QDirectFBPaintEngine);
- const bool wasInClip = d->inClip;
- d->inClip = true;
- QRasterPaintEngine::clip(region, op);
- if (!wasInClip) {
- d->inClip = false;
- d->updateClip();
- }
-}
-
-void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
-{
- Q_D(QDirectFBPaintEngine);
- const bool wasInClip = d->inClip;
- d->inClip = true;
- QRasterPaintEngine::clip(rect, op);
- if (!wasInClip) {
- d->inClip = false;
- d->updateClip();
- }
-}
-
-void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
-{
- Q_D(QDirectFBPaintEngine);
- const QPen &pen = state()->pen;
- const QBrush &brush = state()->brush;
- if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen)
- return;
-
- if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
- || !d->simplePen
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !d->isSimpleBrush(brush)
- || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
- RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
- d->lock();
- QRasterPaintEngine::drawRects(rects, rectCount);
- return;
- }
-
- if (brush.style() != Qt::NoBrush) {
- d->setDFBColor(brush.color());
- CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
- }
-
- if (pen.style() != Qt::NoPen) {
- d->setDFBColor(pen.color());
- CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
- }
-}
-
-void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
-{
- Q_D(QDirectFBPaintEngine);
- const QPen &pen = state()->pen;
- const QBrush &brush = state()->brush;
- if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen)
- return;
-
- if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
- || !d->simplePen
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !d->isSimpleBrush(brush)
- || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
- RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
- d->lock();
- QRasterPaintEngine::drawRects(rects, rectCount);
- return;
- }
-
- if (brush.style() != Qt::NoBrush) {
- d->setDFBColor(brush.color());
- CLIPPED_PAINT(fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
- }
-
- if (pen.style() != Qt::NoPen) {
- d->setDFBColor(pen.color());
- CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRectF>)(rects, rectCount, state()->matrix, d->surface));
- }
-}
-
-void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
-{
- Q_D(QDirectFBPaintEngine);
-
- const QPen &pen = state()->pen;
- if (!d->simplePen
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
- RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
- d->lock();
- QRasterPaintEngine::drawLines(lines, lineCount);
- return;
- }
-
- if (pen.style() != Qt::NoPen) {
- d->setDFBColor(pen.color());
- CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLine>)(lines, lineCount, state()->matrix, d->surface));
- }
-}
-
-void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
-{
- Q_D(QDirectFBPaintEngine);
-
- const QPen &pen = state()->pen;
- if (!d->simplePen
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
- RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
- d->lock();
- QRasterPaintEngine::drawLines(lines, lineCount);
- return;
- }
-
- if (pen.style() != Qt::NoPen) {
- d->setDFBColor(pen.color());
- CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLineF>)(lines, lineCount, state()->matrix, d->surface));
- }
-}
-
-void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
- const QRectF &sr,
- Qt::ImageConversionFlags flags)
-{
- Q_D(QDirectFBPaintEngine);
- Q_UNUSED(flags);
-
- /* This is hard to read. The way it works is like this:
-
- - If you do not have support for preallocated surfaces and do not use an
- image cache we always fall back to raster engine.
-
- - If it's rotated/sheared/mirrored (negative scale) or we can't
- clip it we fall back to raster engine.
-
- - If we don't cache the image, but we do have support for
- preallocated surfaces we fall back to the raster engine if the
- image is in a format DirectFB can't handle.
-
- - If we do cache the image but don't have support for preallocated
- images and the cost of caching the image (bytes used) is higher
- than the max image cache size we fall back to raster engine.
- */
-
-#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
- || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())
-#ifndef QT_DIRECTFB_IMAGECACHE
- || (QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN)
-#elif defined QT_NO_DIRECTFB_PREALLOCATED
- || (QDirectFBPaintEnginePrivate::cacheCost(image) > imageCache.maxCost())
-#endif
- )
-#endif
- {
- RASTERFALLBACK(DRAW_IMAGE, r, image.size(), sr);
- d->lock();
- QRasterPaintEngine::drawImage(r, image, sr, flags);
- return;
- }
-#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- bool release;
- IDirectFBSurface *imgSurface = d->getSurface(image, &release);
- uint blitFlags = 0;
- if (image.hasAlphaChannel())
- blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha;
- if (QDirectFBScreen::isPremultiplied(image.format()))
- blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied;
- d->prepareForBlit(blitFlags);
- CLIPPED_PAINT(d->blit(r, imgSurface, sr));
- if (release) {
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- d->surface->ReleaseSource(d->surface);
-#endif
- imgSurface->Release(imgSurface);
- }
-#endif
-}
-
-void QDirectFBPaintEngine::drawImage(const QPointF &p, const QImage &img)
-{
- drawImage(QRectF(p, img.size()), img, img.rect());
-}
-
-void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
- const QRectF &sr)
-{
- Q_D(QDirectFBPaintEngine);
-
- if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
- RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
- d->lock();
- QRasterPaintEngine::drawPixmap(r, pixmap, sr);
- } else {
- QPixmapData *data = pixmap.pixmapData();
- Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
- QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
- || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())) {
- RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
- const QImage *img = dfbData->buffer();
- d->lock();
- QRasterPaintEngine::drawImage(r, *img, sr);
- } else {
- QDirectFBPaintEnginePrivate::unlock(dfbData);
- IDirectFBSurface *s = dfbData->directFBSurface();
- uint blitFlags = 0;
- if (pixmap.hasAlphaChannel())
- blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha;
- if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat()))
- blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied;
-
- d->prepareForBlit(blitFlags);
- CLIPPED_PAINT(d->blit(r, s, sr));
- }
- }
-}
-
-void QDirectFBPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
-{
- drawPixmap(QRectF(p, pm.size()), pm, pm.rect());
-}
-
-void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
- const QPixmap &pixmap,
- const QPointF &offset)
-{
- Q_D(QDirectFBPaintEngine);
- if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
- RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
- d->lock();
- QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset);
- } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
- || (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
- RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
- QPixmapData *pixmapData = pixmap.pixmapData();
- Q_ASSERT(pixmapData->classId() == QPixmapData::DirectFBClass);
- QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(pixmapData);
- const QImage *img = dfbData->buffer();
- d->lock();
- QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType);
- data->fromImage(*img, Qt::AutoColor);
- const QPixmap pix(data);
- QRasterPaintEngine::drawTiledPixmap(r, pix, offset);
- } else {
- QTransform transform(state()->matrix);
- CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset, transform));
- }
-}
-
-
-void QDirectFBPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
-{
- RASTERFALLBACK(STROKE_PATH, path, VOID_ARG(), VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::stroke(path, pen);
-}
-
-void QDirectFBPaintEngine::drawPath(const QPainterPath &path)
-{
- RASTERFALLBACK(DRAW_PATH, path, VOID_ARG(), VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawPath(path);
-}
-
-void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount)
-{
- RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawPoints(points, pointCount);
-}
-
-void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount)
-{
- RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawPoints(points, pointCount);
-}
-
-void QDirectFBPaintEngine::drawEllipse(const QRectF &rect)
-{
- RASTERFALLBACK(DRAW_ELLIPSE, rect, VOID_ARG(), VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawEllipse(rect);
-}
-
-void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount,
- PolygonDrawMode mode)
-{
- RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawPolygon(points, pointCount, mode);
-}
-
-void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount,
- PolygonDrawMode mode)
-{
- RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawPolygon(points, pointCount, mode);
-}
-
-void QDirectFBPaintEngine::drawTextItem(const QPointF &p,
- const QTextItem &textItem)
-{
- RASTERFALLBACK(DRAW_TEXT, p, textItem.text(), VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawTextItem(p, textItem);
-}
-
-void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
-{
- if (brush.style() == Qt::NoBrush)
- return;
- RASTERFALLBACK(FILL_PATH, path, brush, VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::fill(path, brush);
-}
-
-void QDirectFBPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
-{
- RASTERFALLBACK(DRAW_ROUNDED_RECT, rect, xrad, yrad);
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawRoundedRect(rect, xrad, yrad, mode);
-}
-
-void QDirectFBPaintEngine::drawStaticTextItem(QStaticTextItem *item)
-{
- RASTERFALLBACK(DRAW_STATICTEXT, item, VOID_ARG(), VOID_ARG());
- Q_D(QDirectFBPaintEngine);
- d->lock();
- QRasterPaintEngine::drawStaticTextItem(item);
-}
-
-void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
-{
- Q_D(QDirectFBPaintEngine);
- if (brush.style() == Qt::NoBrush)
- return;
- if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) {
- switch (brush.style()) {
- case Qt::SolidPattern: {
- const QColor color = brush.color();
- if (!color.isValid())
- return;
-
- if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported
- || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
- break;
- }
- d->setDFBColor(color);
- const QRect r = state()->matrix.mapRect(rect).toRect();
- CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
- return; }
-
- case Qt::TexturePattern: {
- const QPointF &brushOrigin = state()->brushOrigin;
- const QTransform stateTransform = state()->matrix;
- QTransform transform(stateTransform);
- transform.translate(brushOrigin.x(), brushOrigin.y());
- transform = brush.transform() * transform;
- if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
- || (QDirectFBPaintEnginePrivate::getTransformationType(transform) & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || (!d->supportsStretchBlit() && transform.isScaling())) {
- break;
- }
-
- const QPixmap texture = brush.texture();
- if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass)
- break;
-
- CLIPPED_PAINT(d->drawTiledPixmap(stateTransform.mapRect(rect), texture, rect.topLeft() - brushOrigin, transform));
- return; }
- default:
- break;
- }
- }
- RASTERFALLBACK(FILL_RECT, rect, brush, VOID_ARG());
- d->lock();
- QRasterPaintEngine::fillRect(rect, brush);
-}
-
-void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
-{
- if (!color.isValid())
- return;
- Q_D(QDirectFBPaintEngine);
- if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
- || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
- || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) {
- RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
- d->lock();
- QRasterPaintEngine::fillRect(rect, color);
- } else {
- d->setDFBColor(color);
- const QRect r = state()->matrix.mapRect(rect).toRect();
- CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
- }
-}
-
-void QDirectFBPaintEngine::drawBufferSpan(const uint *buffer, int bufsize,
- int x, int y, int length,
- uint const_alpha)
-{
- Q_D(QDirectFBPaintEngine);
- IDirectFBSurface *src = d->surfaceCache->getSurface(buffer, bufsize);
- // ### how does this play with setDFBColor
- src->SetColor(src, 0, 0, 0, const_alpha);
- const DFBRectangle rect = { 0, 0, length, 1 };
- d->surface->Blit(d->surface, src, &rect, x, y);
-}
-
-#ifdef QT_DIRECTFB_IMAGECACHE
-static void cachedImageCleanupHook(qint64 key)
-{
- delete imageCache.take(key);
-}
-void QDirectFBPaintEngine::initImageCache(int size)
-{
- Q_ASSERT(size >= 0);
- imageCache.setMaxCost(size);
- QImagePixmapCleanupHooks::instance()->addImageHook(cachedImageCleanupHook);
-}
-
-#endif // QT_DIRECTFB_IMAGECACHE
-
-// ---- QDirectFBPaintEnginePrivate ----
-
-
-QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p)
- : surface(0), antialiased(false), simplePen(false),
- transformationType(0), opacity(255),
- clipType(ClipUnset), dfbDevice(0),
- compositionModeStatus(0), isPremultiplied(false), inClip(false), q(p)
-{
- fb = QDirectFBScreen::instance()->dfb();
- surfaceCache = new SurfaceCache;
-}
-
-QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate()
-{
- delete surfaceCache;
-}
-
-bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const
-{
- return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased);
-}
-
-void QDirectFBPaintEnginePrivate::lock()
-{
- // We will potentially get a new pointer to the buffer after a
- // lock so we need to call the base implementation of prepare so
- // it updates its rasterBuffer to point to the new buffer address.
- Q_ASSERT(dfbDevice);
- if (dfbDevice->lockSurface(DSLF_READ|DSLF_WRITE)) {
- prepare(dfbDevice);
- }
-}
-
-void QDirectFBPaintEnginePrivate::unlock()
-{
- Q_ASSERT(dfbDevice);
-#ifdef QT_DIRECTFB_SUBSURFACE
- dfbDevice->syncPending = true;
-#else
- QDirectFBPaintEnginePrivate::unlock(dfbDevice);
-#endif
-}
-
-void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device)
-{
-#ifdef QT_NO_DIRECTFB_SUBSURFACE
- Q_ASSERT(device);
- device->unlockSurface();
-#else
- Q_UNUSED(device);
-#endif
-}
-
-void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform)
-{
- transformationType = getTransformationType(transform);
- setPen(q->state()->pen);
-}
-
-void QDirectFBPaintEnginePrivate::setPen(const QPen &pen)
-{
- if (pen.style() == Qt::NoPen) {
- simplePen = true;
- } else if (pen.style() == Qt::SolidLine
- && !antialiased
- && pen.brush().style() == Qt::SolidPattern
- && pen.widthF() <= 1.0
- && (transformationType < QTransform::TxScale || pen.isCosmetic())) {
- simplePen = true;
- } else {
- simplePen = false;
- }
-}
-
-void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode)
-{
- if (!surface)
- return;
-
- static const bool forceRasterFallBack = qgetenv("QT_DIRECTFB_FORCE_RASTER").toInt() > 0;
- if (forceRasterFallBack) {
- compositionModeStatus = PorterDuff_None;
- return;
- }
-
- compositionModeStatus = PorterDuff_Supported|PorterDuff_PremultiplyColors|PorterDuff_AlwaysBlend;
- switch (mode) {
- case QPainter::CompositionMode_Clear:
- surface->SetPorterDuff(surface, DSPD_CLEAR);
- break;
- case QPainter::CompositionMode_Source:
- surface->SetPorterDuff(surface, DSPD_SRC);
- compositionModeStatus &= ~PorterDuff_AlwaysBlend;
- if (!isPremultiplied)
- compositionModeStatus &= ~PorterDuff_PremultiplyColors;
- break;
- case QPainter::CompositionMode_SourceOver:
- compositionModeStatus &= ~PorterDuff_AlwaysBlend;
- surface->SetPorterDuff(surface, DSPD_SRC_OVER);
- break;
- case QPainter::CompositionMode_DestinationOver:
- surface->SetPorterDuff(surface, DSPD_DST_OVER);
- break;
- case QPainter::CompositionMode_SourceIn:
- surface->SetPorterDuff(surface, DSPD_SRC_IN);
- if (!isPremultiplied)
- compositionModeStatus &= ~PorterDuff_PremultiplyColors;
- break;
- case QPainter::CompositionMode_DestinationIn:
- surface->SetPorterDuff(surface, DSPD_DST_IN);
- break;
- case QPainter::CompositionMode_SourceOut:
- surface->SetPorterDuff(surface, DSPD_SRC_OUT);
- break;
- case QPainter::CompositionMode_DestinationOut:
- surface->SetPorterDuff(surface, DSPD_DST_OUT);
- break;
- case QPainter::CompositionMode_Destination:
- surface->SetSrcBlendFunction(surface, DSBF_ZERO);
- surface->SetDstBlendFunction(surface, DSBF_ONE);
- break;
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- case QPainter::CompositionMode_SourceAtop:
- surface->SetPorterDuff(surface, DSPD_SRC_ATOP);
- break;
- case QPainter::CompositionMode_DestinationAtop:
- surface->SetPorterDuff(surface, DSPD_DST_ATOP);
- break;
- case QPainter::CompositionMode_Plus:
- surface->SetPorterDuff(surface, DSPD_ADD);
- break;
- case QPainter::CompositionMode_Xor:
- surface->SetPorterDuff(surface, DSPD_XOR);
- break;
-#endif
- default:
- compositionModeStatus = PorterDuff_None;
- break;
- }
-}
-
-void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints)
-{
- const bool old = antialiased;
- antialiased = bool(hints & QPainter::Antialiasing);
- if (old != antialiased) {
- setPen(q->state()->pen);
- }
-}
-
-void QDirectFBPaintEnginePrivate::prepareForBlit(uint flags)
-{
- DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX;
- if (flags & Premultiplied)
- blittingFlags |= DSBLIT_SRC_PREMULTIPLY;
- if (flags & HasAlpha)
- blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL;
- if (opacity != 255) {
- blittingFlags |= DSBLIT_BLEND_COLORALPHA;
- surface->SetColor(surface, 0xff, 0xff, 0xff, opacity);
- }
-
- surface->SetBlittingFlags(surface, blittingFlags);
-}
-
-static inline uint ALPHA_MUL(uint x, uint a)
-{
- uint t = x * a;
- t = ((t + (t >> 8) + 0x80) >> 8) & 0xff;
- return t;
-}
-
-void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color)
-{
- Q_ASSERT(surface);
- Q_ASSERT(compositionModeStatus & PorterDuff_Supported);
- const quint8 alpha = (opacity == 255 ?
- color.alpha() : ALPHA_MUL(color.alpha(), opacity));
- QColor col;
- if (compositionModeStatus & PorterDuff_PremultiplyColors) {
- col = QColor(ALPHA_MUL(color.red(), alpha),
- ALPHA_MUL(color.green(), alpha),
- ALPHA_MUL(color.blue(), alpha),
- alpha);
- } else {
- col = QColor(color.red(), color.green(), color.blue(), alpha);
- }
- surface->SetColor(surface, col.red(), col.green(), col.blue(), col.alpha());
- surface->SetDrawingFlags(surface, alpha == 255 && !(compositionModeStatus & PorterDuff_AlwaysBlend) ? DSDRAW_NOFX : DSDRAW_BLEND);
-}
-
-IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release)
-{
-#ifdef QT_NO_DIRECTFB_IMAGECACHE
- *release = true;
- return QDirectFBScreen::instance()->createDFBSurface(img, img.format(), QDirectFBScreen::DontTrackSurface);
-#else
- const qint64 key = img.cacheKey();
- *release = false;
- if (imageCache.contains(key)) {
- return imageCache[key]->surface;
- }
-
- const int cost = cacheCost(img);
- const bool cache = cost <= imageCache.maxCost();
- QDirectFBScreen *screen = QDirectFBScreen::instance();
- const QImage::Format format = (img.format() == screen->alphaPixmapFormat() || QDirectFBPixmapData::hasAlphaChannel(img)
- ? screen->alphaPixmapFormat() : screen->pixelFormat());
-
- IDirectFBSurface *surface = screen->createDFBSurface(img, format,
- cache
- ? QDirectFBScreen::TrackSurface
- : QDirectFBScreen::DontTrackSurface);
- if (cache) {
- CachedImage *cachedImage = new CachedImage;
- const_cast<QImage&>(img).data_ptr()->is_cached = true;
- cachedImage->surface = surface;
- imageCache.insert(key, cachedImage, cost);
- } else {
- *release = true;
- }
- return surface;
-#endif
-}
-
-
-void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, const QRectF &src)
-{
- const QRect sr = src.toRect();
- const QRect dr = q->state()->matrix.mapRect(dest).toRect();
- if (dr.isEmpty())
- return;
- const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() };
- DFBResult result;
-
- if (dr.size() == sr.size()) {
- result = surface->Blit(surface, s, &sRect, dr.x(), dr.y());
- } else {
- Q_ASSERT(supportsStretchBlit());
- const DFBRectangle dRect = { dr.x(), dr.y(), dr.width(), dr.height() };
- result = surface->StretchBlit(surface, s, &sRect, &dRect);
- }
- if (result != DFB_OK)
- DirectFBError("QDirectFBPaintEngine::drawPixmap()", result);
-}
-
-static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset)
-{
- qreal pos = rect_pos - offset;
- while (pos > rect_pos)
- pos -= pixmapSize;
- while (pos + pixmapSize < rect_pos)
- pos += pixmapSize;
- return pos;
-}
-
-void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap,
- const QPointF &off, const QTransform &pixmapTransform)
-{
- const QTransform &transform = q->state()->matrix;
- Q_ASSERT(!(getTransformationType(transform) & Matrix_BlitsUnsupported) &&
- !(getTransformationType(pixmapTransform) & Matrix_BlitsUnsupported));
- const QRect destinationRect = transform.mapRect(dest).toRect().normalized();
- QRect newClip = destinationRect;
- if (!currentClip.isEmpty())
- newClip &= currentClip;
-
- if (newClip.isNull())
- return;
-
- const DFBRegion clip = {
- newClip.x(),
- newClip.y(),
- newClip.right(),
- newClip.bottom()
- };
- surface->SetClip(surface, &clip);
-
- QPointF offset = pixmapTransform.inverted().map(off);
- Q_ASSERT(transform.type() <= QTransform::TxScale);
- QPixmapData *data = pixmap.pixmapData();
- Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
- QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
- uint blitFlags = 0;
- if (dfbData->hasAlphaChannel())
- blitFlags |= HasAlpha;
- if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat()))
- blitFlags |= Premultiplied;
- prepareForBlit(blitFlags);
- QDirectFBPaintEnginePrivate::unlock(dfbData);
- const QSize pixmapSize = dfbData->size();
- if (transform.isScaling() || pixmapTransform.isScaling()) {
- Q_ASSERT(supportsStretchBlit());
- Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0);
- offset.rx() *= transform.m11();
- offset.ry() *= transform.m22();
-
- const QSizeF mappedSize(pixmapSize.width() * pixmapTransform.m11(), pixmapSize.height() * pixmapTransform.m22());
- qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
- const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
- while (y <= destinationRect.bottom()) {
- qreal x = startX;
- while (x <= destinationRect.right()) {
- const DFBRectangle destination = { qRound(x), qRound(y), mappedSize.width(), mappedSize.height() };
- surface->StretchBlit(surface, sourceSurface, 0, &destination);
- x += mappedSize.width();
- }
- y += mappedSize.height();
- }
- } else {
- qreal y = fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
- const qreal startX = fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
- int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1;
- if (startX != destinationRect.x())
- ++horizontal;
- int vertical = qMax(1, destinationRect.height() / pixmapSize.height()) + 1;
- if (y != destinationRect.y())
- ++vertical;
-
- const int maxCount = (vertical * horizontal);
- QVarLengthArray<DFBRectangle, 16> sourceRects(maxCount);
- QVarLengthArray<DFBPoint, 16> points(maxCount);
-
- int i = 0;
- while (y <= destinationRect.bottom()) {
- Q_ASSERT(i < maxCount);
- qreal x = startX;
- while (x <= destinationRect.right()) {
- points[i].x = qRound(x);
- points[i].y = qRound(y);
- sourceRects[i].x = 0;
- sourceRects[i].y = 0;
- sourceRects[i].w = int(pixmapSize.width());
- sourceRects[i].h = int(pixmapSize.height());
- x += pixmapSize.width();
- ++i;
- }
- y += pixmapSize.height();
- }
- surface->BatchBlit(surface, sourceSurface, sourceRects.constData(), points.constData(), i);
- }
-
- if (currentClip.isEmpty()) {
- surface->SetClip(surface, 0);
- } else {
- const DFBRegion clip = {
- currentClip.x(),
- currentClip.y(),
- currentClip.right(),
- currentClip.bottom()
- };
- surface->SetClip(surface, &clip);
- }
-}
-
-void QDirectFBPaintEnginePrivate::updateClip()
-{
- Q_ASSERT(surface);
- currentClip = QRect();
- const QClipData *clipData = clip();
- if (!clipData || !clipData->enabled) {
- surface->SetClip(surface, NULL);
- clipType = NoClip;
- } else if (clipData->hasRectClip) {
- const DFBRegion r = {
- clipData->clipRect.x(),
- clipData->clipRect.y(),
- clipData->clipRect.right(),
- clipData->clipRect.bottom()
- };
- surface->SetClip(surface, &r);
- currentClip = clipData->clipRect.normalized();
- // ### is this guaranteed to always be normalized?
- clipType = RectClip;
- } else if (clipData->hasRegionClip) {
- clipType = RegionClip;
- } else {
- clipType = ComplexClip;
- }
-}
-
-bool QDirectFBPaintEnginePrivate::supportsStretchBlit() const
-{
-#ifdef QT_DIRECTFB_STRETCHBLIT
- return !(q->state()->renderHints & QPainter::SmoothPixmapTransform);
-#else
- return false;
-#endif
-}
-
-
-void QDirectFBPaintEnginePrivate::systemStateChanged()
-{
- QRasterPaintEnginePrivate::systemStateChanged();
- updateClip();
-}
-
-IDirectFBSurface *SurfaceCache::getSurface(const uint *buf, int size)
-{
- if (buffer == buf && bufsize == size)
- return surface;
-
- clear();
-
- const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size);
- surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface, 0);
- if (!surface)
- qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface");
-
- buffer = const_cast<uint*>(buf);
- bufsize = size;
-
- return surface;
-}
-
-void SurfaceCache::clear()
-{
- if (surface && QDirectFBScreen::instance())
- QDirectFBScreen::instance()->releaseDFBSurface(surface);
- surface = 0;
- buffer = 0;
- bufsize = 0;
-}
-
-
-static inline QRect mapRect(const QTransform &transform, const QRect &rect) { return transform.mapRect(rect); }
-static inline QRect mapRect(const QTransform &transform, const QRectF &rect) { return transform.mapRect(rect).toRect(); }
-static inline QLine map(const QTransform &transform, const QLine &line) { return transform.map(line); }
-static inline QLine map(const QTransform &transform, const QLineF &line) { return transform.map(line).toLine(); }
-template <class T>
-static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface)
-{
- if (n == 1) {
- const QLine l = map(transform, lines[0]);
- surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2());
- } else {
- QVarLengthArray<DFBRegion, 32> lineArray(n);
- for (int i=0; i<n; ++i) {
- const QLine l = map(transform, lines[i]);
- lineArray[i].x1 = l.x1();
- lineArray[i].y1 = l.y1();
- lineArray[i].x2 = l.x2();
- lineArray[i].y2 = l.y2();
- }
- surface->DrawLines(surface, lineArray.constData(), n);
- }
-}
-
-template <class T>
-static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
-{
- if (n == 1) {
- const QRect r = mapRect(transform, rects[0]);
- surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height());
- } else {
- QVarLengthArray<DFBRectangle, 32> rectArray(n);
- for (int i=0; i<n; ++i) {
- const QRect r = mapRect(transform, rects[i]);
- rectArray[i].x = r.x();
- rectArray[i].y = r.y();
- rectArray[i].w = r.width();
- rectArray[i].h = r.height();
- }
- surface->FillRectangles(surface, rectArray.constData(), n);
- }
-}
-
-template <class T>
-static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
-{
- for (int i=0; i<n; ++i) {
- const QRect r = mapRect(transform, rects[i]);
- surface->DrawRectangle(surface, r.x(), r.y(), r.width(), r.height());
- }
-}
-
-template <typename T> inline const T *ptr(const T &t) { return &t; }
-template <> inline const bool* ptr<bool>(const bool &) { return 0; }
-template <typename device, typename T1, typename T2, typename T3>
-static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
- uint transformationType, bool simplePen,
- uint clipType, uint compositionModeStatus,
- const char *nameOne, const T1 &one,
- const char *nameTwo, const T2 &two,
- const char *nameThree, const T3 &three)
-{
- QString out;
- QDebug dbg(&out);
- dbg << msg << (QByteArray(func) + "()") << "painting on";
- if (dev->devType() == QInternal::Widget) {
- dbg << static_cast<const QWidget*>(dev);
- } else {
- dbg << dev << "of type" << dev->devType();
- }
-
- dbg << QString::fromLatin1("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0'))
- << "simplePen" << simplePen
- << "clipType" << clipType
- << "compositionModeStatus" << compositionModeStatus;
-
- const T1 *t1 = ptr(one);
- const T2 *t2 = ptr(two);
- const T3 *t3 = ptr(three);
-
- if (t1) {
- dbg << nameOne << *t1;
- if (t2) {
- dbg << nameTwo << *t2;
- if (t3) {
- dbg << nameThree << *t3;
- }
- }
- }
- qWarning("%s", qPrintable(out));
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
deleted file mode 100644
index 1908f3ad32..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPAINTENGINE_DIRECTFB_P_H
-#define QPAINTENGINE_DIRECTFB_P_H
-
-#include <QtGui/qpaintengine.h>
-#include <private/qpaintengine_raster_p.h>
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QDirectFBPaintEnginePrivate;
-
-class QDirectFBPaintEngine : public QRasterPaintEngine
-{
- Q_DECLARE_PRIVATE(QDirectFBPaintEngine)
-public:
- QDirectFBPaintEngine(QPaintDevice *device);
- virtual ~QDirectFBPaintEngine();
-
- virtual bool begin(QPaintDevice *device);
- virtual bool end();
-
- virtual void drawRects(const QRect *rects, int rectCount);
- virtual void drawRects(const QRectF *rects, int rectCount);
-
- virtual void fillRect(const QRectF &r, const QBrush &brush);
- virtual void fillRect(const QRectF &r, const QColor &color);
-
- virtual void drawLines(const QLine *line, int lineCount);
- virtual void drawLines(const QLineF *line, int lineCount);
-
- virtual void drawImage(const QPointF &p, const QImage &img);
- virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags falgs = Qt::AutoColor);
-
- virtual void drawPixmap(const QPointF &p, const QPixmap &pm);
- virtual void drawPixmap(const QRectF &r, const QPixmap &pixmap, const QRectF &sr);
- virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
-
- virtual void drawBufferSpan(const uint *buffer, int bufsize,
- int x, int y, int length, uint const_alpha);
-
- virtual void stroke(const QVectorPath &path, const QPen &pen);
- virtual void drawPath(const QPainterPath &path);
- virtual void drawPoints(const QPointF *points, int pointCount);
- virtual void drawPoints(const QPoint *points, int pointCount);
- virtual void drawEllipse(const QRectF &rect);
- virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
- virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
- virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
- virtual void fill(const QVectorPath &path, const QBrush &brush);
- virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode);
-
- virtual void clipEnabledChanged();
- virtual void penChanged();
- virtual void opacityChanged();
- virtual void compositionModeChanged();
- virtual void renderHintsChanged();
- virtual void transformChanged();
-
- virtual void setState(QPainterState *state);
-
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
- virtual void clip(const QRegion &region, Qt::ClipOperation op);
- virtual void clip(const QRect &rect, Qt::ClipOperation op);
-
- virtual void drawStaticTextItem(QStaticTextItem *item);
-
- static void initImageCache(int size);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_DIRECTFB
-
-#endif // QPAINTENGINE_DIRECTFB_P_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
deleted file mode 100644
index eaff74a41c..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ /dev/null
@@ -1,588 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbpixmap.h"
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-#include "qdirectfbscreen.h"
-#include "qdirectfbpaintengine.h"
-
-#include <QtGui/qbitmap.h>
-#include <QtCore/qfile.h>
-#include <directfb.h>
-
-
-QT_BEGIN_NAMESPACE
-
-static int global_ser_no = 0;
-
-QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType)
- : QPixmapData(pixelType, DirectFBClass), QDirectFBPaintDevice(screen),
- alpha(false)
-{
- setSerialNumber(0);
-}
-
-QDirectFBPixmapData::~QDirectFBPixmapData()
-{
-}
-
-void QDirectFBPixmapData::resize(int width, int height)
-{
- if (width <= 0 || height <= 0) {
- invalidate();
- return;
- }
-
- imageFormat = screen->pixelFormat();
- dfbSurface = screen->createDFBSurface(QSize(width, height),
- imageFormat,
- QDirectFBScreen::TrackSurface);
- d = QDirectFBScreen::depth(imageFormat);
- alpha = false;
- if (!dfbSurface) {
- invalidate();
- qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface");
- return;
- }
-
- w = width;
- h = height;
- is_null = (w <= 0 || h <= 0);
- setSerialNumber(++global_ser_no);
-}
-
-#ifdef QT_DIRECTFB_OPAQUE_DETECTION
-// mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels)
-static bool checkForAlphaPixels(const QImage &img)
-{
- const uchar *bits = img.bits();
- const int bytes_per_line = img.bytesPerLine();
- const uchar *end_bits = bits + bytes_per_line;
- const int width = img.width();
- const int height = img.height();
- switch (img.format()) {
- case QImage::Format_Indexed8:
- return img.hasAlphaChannel();
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- for (int y=0; y<height; ++y) {
- for (int x=0; x<width; ++x) {
- if ((((uint *)bits)[x] & 0xff000000) != 0xff000000) {
- return true;
- }
- }
- bits += bytes_per_line;
- }
- break;
-
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- for (int y=0; y<height; ++y) {
- while (bits < end_bits) {
- if (bits[0] != 0) {
- return true;
- }
- bits += 3;
- }
- bits = end_bits;
- end_bits += bytes_per_line;
- }
- break;
-
- case QImage::Format_ARGB6666_Premultiplied:
- for (int y=0; y<height; ++y) {
- while (bits < end_bits) {
- if ((bits[0] & 0xfc) != 0) {
- return true;
- }
- bits += 3;
- }
- bits = end_bits;
- end_bits += bytes_per_line;
- }
- break;
-
- case QImage::Format_ARGB4444_Premultiplied:
- for (int y=0; y<height; ++y) {
- while (bits < end_bits) {
- if ((bits[0] & 0xf0) != 0) {
- return true;
- }
- bits += 2;
- }
- bits = end_bits;
- end_bits += bytes_per_line;
- }
- break;
-
- default:
- break;
- }
-
- return false;
-}
-#endif // QT_DIRECTFB_OPAQUE_DETECTION
-
-bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags)
-{
- if (img.depth() == 1)
- return true;
-#ifdef QT_DIRECTFB_OPAQUE_DETECTION
- return ((flags & Qt::NoOpaqueDetection) ? img.hasAlphaChannel() : checkForAlphaPixels(img));
-#else
- Q_UNUSED(flags);
- return img.hasAlphaChannel();
-#endif
-}
-
-#ifdef QT_DIRECTFB_IMAGEPROVIDER
-bool QDirectFBPixmapData::fromFile(const QString &filename, const char *format,
- Qt::ImageConversionFlags flags)
-{
- if (!QFile::exists(filename))
- return false;
- if (flags == Qt::AutoColor) {
- if (filename.startsWith(QLatin1Char(':'))) { // resource
- QFile file(filename);
- if (!file.open(QIODevice::ReadOnly))
- return false;
- const QByteArray data = file.readAll();
- file.close();
- return fromData(reinterpret_cast<const uchar*>(data.constData()), data.size(), format, flags);
- } else {
- DFBDataBufferDescription description;
- description.flags = DBDESC_FILE;
- const QByteArray fileNameData = filename.toLocal8Bit();
- description.file = fileNameData.constData();
- if (fromDataBufferDescription(description)) {
- return true;
- }
- // fall back to Qt
- }
- }
- return QPixmapData::fromFile(filename, format, flags);
-}
-
-bool QDirectFBPixmapData::fromData(const uchar *buffer, uint len, const char *format,
- Qt::ImageConversionFlags flags)
-{
- if (flags == Qt::AutoColor) {
- DFBDataBufferDescription description;
- description.flags = DBDESC_MEMORY;
- description.memory.data = buffer;
- description.memory.length = len;
- if (fromDataBufferDescription(description))
- return true;
- // fall back to Qt
- }
- return QPixmapData::fromData(buffer, len, format, flags);
-}
-
-template <typename T> struct QDirectFBInterfaceCleanupHandler
-{
- static void cleanup(T *t) { if (t) t->Release(t); }
-};
-
-template <typename T>
-class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >
-{
-public:
- QDirectFBPointer(T *t = 0)
- : QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >(t)
- {}
-};
-
-bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription)
-{
- IDirectFB *dfb = screen->dfb();
- Q_ASSERT(dfb);
- DFBResult result = DFB_OK;
- IDirectFBDataBuffer *dataBufferPtr;
- if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result);
- return false;
- }
- QDirectFBPointer<IDirectFBDataBuffer> dataBuffer(dataBufferPtr);
-
- IDirectFBImageProvider *providerPtr;
- if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK)
- return false;
-
- QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr);
-
- DFBImageDescription imageDescription;
- result = provider->GetImageDescription(provider.data(), &imageDescription);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result);
- return false;
- }
-
- if (imageDescription.caps & DICAPS_COLORKEY) {
- return false;
- }
-
- DFBSurfaceDescription surfaceDescription;
- if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result);
- return false;
- }
-
- alpha = imageDescription.caps & DICAPS_ALPHACHANNEL;
- imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
-
- dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height),
- imageFormat, QDirectFBScreen::TrackSurface);
-
- result = provider->RenderTo(provider.data(), dfbSurface, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result);
- return false;
- }
-
- w = surfaceDescription.width;
- h = surfaceDescription.height;
- is_null = (w <= 0 || h <= 0);
- d = QDirectFBScreen::depth(imageFormat);
- setSerialNumber(++global_ser_no);
-
-#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
- screen->setDirectFBImageProvider(providerPtr);
- provider.take();
-#endif
-
- return true;
-}
-
-#endif
-
-void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
-{
- alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags);
- imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
-
- QImage image;
- if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) {
- image = img.convertToFormat(imageFormat, flags);
- flags = Qt::AutoColor;
- } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) {
- image = img.convertToFormat(imageFormat, flags);
- } else if (img.format() != imageFormat) {
- image = img.convertToFormat(imageFormat, flags);
- } else {
- image = img;
- }
-
- dfbSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::NoPreallocated | QDirectFBScreen::TrackSurface);
- if (!dfbSurface) {
- qWarning("QDirectFBPixmapData::fromImage()");
- invalidate();
- return;
- }
-
- w = image.width();
- h = image.height();
- is_null = (w <= 0 || h <= 0);
- d = QDirectFBScreen::depth(imageFormat);
- setSerialNumber(++global_ser_no);
-#ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION
- Q_UNUSED(flags);
-#endif
-}
-
-void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
-{
- if (data->classId() != DirectFBClass) {
- QPixmapData::copy(data, rect);
- return;
- }
-
- const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data);
-#ifdef QT_NO_DIRECTFB_SUBSURFACE
- if (otherData->lockFlags()) {
- const_cast<QDirectFBPixmapData*>(otherData)->unlockSurface();
- }
-#endif
- IDirectFBSurface *src = otherData->directFBSurface();
- alpha = data->hasAlphaChannel();
- imageFormat = (alpha
- ? QDirectFBScreen::instance()->alphaPixmapFormat()
- : QDirectFBScreen::instance()->pixelFormat());
-
-
- dfbSurface = screen->createDFBSurface(rect.size(), imageFormat,
- QDirectFBScreen::TrackSurface);
- if (!dfbSurface) {
- qWarning("QDirectFBPixmapData::copy()");
- invalidate();
- return;
- }
-
- if (alpha) {
- dfbSurface->Clear(dfbSurface, 0, 0, 0, 0);
- dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL);
- } else {
- dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
- }
- const DFBRectangle blitRect = { rect.x(), rect.y(),
- rect.width(), rect.height() };
- w = rect.width();
- h = rect.height();
- d = otherData->d;
- is_null = (w <= 0 || h <= 0);
- unlockSurface();
- DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0);
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- dfbSurface->ReleaseSource(dfbSurface);
-#endif
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::copy()", result);
- invalidate();
- return;
- }
-
- setSerialNumber(++global_ser_no);
-}
-
-static inline bool isOpaqueFormat(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_RGB32:
- case QImage::Format_RGB16:
- case QImage::Format_RGB666:
- case QImage::Format_RGB555:
- case QImage::Format_RGB888:
- case QImage::Format_RGB444:
- return true;
- default:
- break;
- }
- return false;
-}
-
-void QDirectFBPixmapData::fill(const QColor &color)
-{
- if (!serialNumber())
- return;
-
- Q_ASSERT(dfbSurface);
-
- alpha |= (color.alpha() < 255);
-
- if (alpha && isOpaqueFormat(imageFormat)) {
- QSize size;
- dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight());
- screen->releaseDFBSurface(dfbSurface);
- imageFormat = screen->alphaPixmapFormat();
- d = QDirectFBScreen::depth(imageFormat);
- dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface);
- setSerialNumber(++global_ser_no);
- if (!dfbSurface) {
- qWarning("QDirectFBPixmapData::fill()");
- invalidate();
- return;
- }
- }
-
- dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha());
-}
-
-QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
- Qt::TransformationMode mode) const
-{
- QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
-#ifdef QT_NO_DIRECTFB_SUBSURFACE
- if (lockFlags())
- that->unlockSurface();
-#endif
-
- if (!dfbSurface || transform.type() != QTransform::TxScale
- || mode != Qt::FastTransformation)
- {
- const QImage *image = that->buffer();
- Q_ASSERT(image);
- const QImage transformed = image->transformed(transform, mode);
- QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
- data->fromImage(transformed, Qt::AutoColor);
- return QPixmap(data);
- }
-
- const QSize size = transform.mapRect(QRect(0, 0, w, h)).size();
- if (size.isEmpty())
- return QPixmap();
-
- QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
- data->setSerialNumber(++global_ser_no);
- DFBSurfaceBlittingFlags flags = DSBLIT_NOFX;
- data->alpha = alpha;
- if (alpha) {
- flags = DSBLIT_BLEND_ALPHACHANNEL;
- }
- data->dfbSurface = screen->createDFBSurface(size,
- imageFormat,
- QDirectFBScreen::TrackSurface);
- if (flags & DSBLIT_BLEND_ALPHACHANNEL) {
- data->dfbSurface->Clear(data->dfbSurface, 0, 0, 0, 0);
- }
- data->dfbSurface->SetBlittingFlags(data->dfbSurface, flags);
-
- const DFBRectangle destRect = { 0, 0, size.width(), size.height() };
- data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect);
- data->w = size.width();
- data->h = size.height();
- data->is_null = (data->w <= 0 || data->h <= 0);
-
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- data->dfbSurface->ReleaseSource(data->dfbSurface);
-#endif
- return QPixmap(data);
-}
-
-QImage QDirectFBPixmapData::toImage() const
-{
- if (!dfbSurface)
- return QImage();
-
-#if 0
- // In later versions of DirectFB one can set a flag to tell
- // DirectFB not to move the surface to videomemory. When that
- // happens we can use this (hopefully faster) codepath
-#ifndef QT_NO_DIRECTFB_PREALLOCATED
- QImage ret(w, h, QDirectFBScreen::getImageFormat(dfbSurface));
- if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) {
- if (hasAlphaChannel()) {
- imgSurface->SetBlittingFlags(imgSurface, DSBLIT_BLEND_ALPHACHANNEL);
- imgSurface->Clear(imgSurface, 0, 0, 0, 0);
- } else {
- imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX);
- }
- imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0);
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- imgSurface->ReleaseSource(imgSurface);
-#endif
- imgSurface->Release(imgSurface);
- return ret;
- }
-#endif
-#endif
-
- QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
- const QImage *img = that->buffer();
- return img->copy();
-}
-
-/* This is QPixmapData::paintEngine(), not QPaintDevice::paintEngine() */
-
-QPaintEngine *QDirectFBPixmapData::paintEngine() const
-{
- if (!engine) {
- // QDirectFBPixmapData is also a QCustomRasterPaintDevice, so pass
- // that to the paint engine:
- QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
- that->engine = new QDirectFBPaintEngine(that);
- }
- return engine;
-}
-
-QImage *QDirectFBPixmapData::buffer()
-{
- if (!lockFlgs) {
- lockSurface(DSLF_READ|DSLF_WRITE);
- }
- Q_ASSERT(lockFlgs);
- Q_ASSERT(!lockedImage.isNull());
- return &lockedImage;
-}
-
-
-bool QDirectFBPixmapData::scroll(int dx, int dy, const QRect &rect)
-{
- if (!dfbSurface) {
- return false;
- }
- unlockSurface();
- DFBResult result = dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::scroll", result);
- return false;
- }
- result = dfbSurface->SetPorterDuff(dfbSurface, DSPD_NONE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::scroll", result);
- return false;
- }
-
- const DFBRectangle source = { rect.x(), rect.y(), rect.width(), rect.height() };
- result = dfbSurface->Blit(dfbSurface, dfbSurface, &source, source.x + dx, source.y + dy);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::scroll", result);
- return false;
- }
-
- return true;
-}
-
-void QDirectFBPixmapData::invalidate()
-{
- if (dfbSurface) {
- screen->releaseDFBSurface(dfbSurface);
- dfbSurface = 0;
- }
- setSerialNumber(0);
- alpha = false;
- d = w = h = 0;
- is_null = true;
- imageFormat = QImage::Format_Invalid;
-}
-
-Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap)
-{
- const QPixmapData *data = pixmap.pixmapData();
- if (!data || data->classId() != QPixmapData::DirectFBClass)
- return 0;
- const QDirectFBPixmapData *dfbData = static_cast<const QDirectFBPixmapData*>(data);
- return dfbData->directFBSurface();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
deleted file mode 100644
index f8e3fa1d84..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECTFBPIXMAP_H
-#define QDIRECTFBPIXMAP_H
-
-#include <qglobal.h>
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-#include <QtGui/private/qpixmapdata_p.h>
-#include <QtGui/private/qpaintengine_raster_p.h>
-#include "qdirectfbpaintdevice.h"
-#include <directfb.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QDirectFBPaintEngine;
-
-class QDirectFBPixmapData : public QPixmapData, public QDirectFBPaintDevice
-{
-public:
- QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType);
- ~QDirectFBPixmapData();
-
- // Re-implemented from QPixmapData:
- virtual void resize(int width, int height);
- virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
-#ifdef QT_DIRECTFB_IMAGEPROVIDER
- virtual bool fromFile(const QString &filename, const char *format,
- Qt::ImageConversionFlags flags);
- virtual bool fromData(const uchar *buffer, uint len, const char *format,
- Qt::ImageConversionFlags flags);
-#endif
- virtual void copy(const QPixmapData *data, const QRect &rect);
- virtual void fill(const QColor &color);
- virtual QPixmap transformed(const QTransform &matrix,
- Qt::TransformationMode mode) const;
- virtual QImage toImage() const;
- virtual QPaintEngine *paintEngine() const;
- virtual QImage *buffer();
- virtual bool scroll(int dx, int dy, const QRect &rect);
- // Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice
- virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); }
-
- inline QImage::Format pixelFormat() const { return imageFormat; }
- inline bool hasAlphaChannel() const { return alpha; }
- static bool hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor);
-private:
-#ifdef QT_DIRECTFB_IMAGEPROVIDER
- bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer);
-#endif
- void invalidate();
- bool alpha;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_DIRECTFB
-
-#endif // QDIRECTFBPIXMAP_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
deleted file mode 100644
index ff15078ee4..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ /dev/null
@@ -1,1819 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbscreen.h"
-#include "qdirectfbwindowsurface.h"
-#include "qdirectfbpixmap.h"
-#include "qdirectfbmouse.h"
-#include "qdirectfbkeyboard.h"
-#include <QtGui/qwsdisplay_qws.h>
-#include <QtGui/qcolor.h>
-#include <QtGui/qapplication.h>
-#include <QtGui/qwindowsystem_qws.h>
-#include <QtGui/private/qgraphicssystem_qws_p.h>
-#include <QtGui/private/qwssignalhandler_p.h>
-#include <QtCore/qvarlengtharray.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qrect.h>
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-QT_BEGIN_NAMESPACE
-
-class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem
-{
- Q_OBJECT
-public:
- QDirectFBScreenPrivate(QDirectFBScreen *qptr);
- ~QDirectFBScreenPrivate();
-
- void setFlipFlags(const QStringList &args);
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
-public slots:
-#ifdef QT_DIRECTFB_WM
- void onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event);
-#endif
-public:
- IDirectFB *dfb;
- DFBSurfaceFlipFlags flipFlags;
- QDirectFBScreen::DirectFBFlags directFBFlags;
- QImage::Format alphaPixmapFormat;
- IDirectFBScreen *dfbScreen;
-#ifdef QT_NO_DIRECTFB_WM
- IDirectFBSurface *primarySurface;
- QColor backgroundColor;
-#endif
-#ifndef QT_NO_DIRECTFB_LAYER
- IDirectFBDisplayLayer *dfbLayer;
-#endif
- QSet<IDirectFBSurface*> allocatedSurfaces;
-
-#ifndef QT_NO_DIRECTFB_MOUSE
- QDirectFBMouseHandler *mouse;
-#endif
-#ifndef QT_NO_DIRECTFB_KEYBOARD
- QDirectFBKeyboardHandler *keyboard;
-#endif
-#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
- IDirectFBImageProvider *imageProvider;
-#endif
- IDirectFBSurface *cursorSurface;
- qint64 cursorImageKey;
-
- QDirectFBScreen *q;
- static QDirectFBScreen *instance;
-};
-
-QDirectFBScreen *QDirectFBScreenPrivate::instance = 0;
-
-QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
- : QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE),
- directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid),
- dfbScreen(0)
-#ifdef QT_NO_DIRECTFB_WM
- , primarySurface(0)
-#endif
-#ifndef QT_NO_DIRECTFB_LAYER
- , dfbLayer(0)
-#endif
-#ifndef QT_NO_DIRECTFB_MOUSE
- , mouse(0)
-#endif
-#ifndef QT_NO_DIRECTFB_KEYBOARD
- , keyboard(0)
-#endif
-#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
- , imageProvider(0)
-#endif
- , cursorSurface(0)
- , cursorImageKey(0)
- , q(qptr)
-{
-#ifndef QT_NO_QWS_SIGNALHANDLER
- QWSSignalHandler::instance()->addObject(this);
-#endif
-#ifdef QT_DIRECTFB_WM
- connect(QWSServer::instance(), SIGNAL(windowEvent(QWSWindow*,QWSServer::WindowEvent)),
- this, SLOT(onWindowEvent(QWSWindow*,QWSServer::WindowEvent)));
-#endif
-}
-
-QDirectFBScreenPrivate::~QDirectFBScreenPrivate()
-{
-#ifndef QT_NO_DIRECTFB_MOUSE
- delete mouse;
-#endif
-#ifndef QT_NO_DIRECTFB_KEYBOARD
- delete keyboard;
-#endif
-#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
- if (imageProvider)
- imageProvider->Release(imageProvider);
-#endif
-
- for (QSet<IDirectFBSurface*>::const_iterator it = allocatedSurfaces.begin(); it != allocatedSurfaces.end(); ++it) {
- (*it)->Release(*it);
- }
-
-#ifdef QT_NO_DIRECTFB_WM
- if (primarySurface)
- primarySurface->Release(primarySurface);
-#endif
-
-#ifndef QT_NO_DIRECTFB_LAYER
- if (dfbLayer)
- dfbLayer->Release(dfbLayer);
-#endif
-
- if (dfbScreen)
- dfbScreen->Release(dfbScreen);
-
- if (dfb)
- dfb->Release(dfb);
-}
-
-IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *resultPtr)
-{
- if (image.isNull()) // assert?
- return 0;
-
- if (QDirectFBScreen::getSurfacePixelFormat(format) == DSPF_UNKNOWN) {
- format = QDirectFBPixmapData::hasAlphaChannel(image) ? d_ptr->alphaPixmapFormat : pixelFormat();
- }
- if (image.format() != format) {
- return createDFBSurface(image.convertToFormat(format), format, options | NoPreallocated, resultPtr);
- }
-
- DFBSurfaceDescription description;
- memset(&description, 0, sizeof(DFBSurfaceDescription));
- description.width = image.width();
- description.height = image.height();
- description.flags = DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT;
- initSurfaceDescriptionPixelFormat(&description, format);
- bool doMemCopy = true;
-#ifdef QT_DIRECTFB_PREALLOCATED
- if (!(options & NoPreallocated)) {
- doMemCopy = false;
- description.flags |= DSDESC_PREALLOCATED;
- description.preallocated[0].data = const_cast<uchar*>(image.bits());
- description.preallocated[0].pitch = image.bytesPerLine();
- description.preallocated[1].data = 0;
- description.preallocated[1].pitch = 0;
- }
-#endif
- DFBResult result;
- IDirectFBSurface *surface = createDFBSurface(description, options, &result);
- if (resultPtr)
- *resultPtr = result;
- if (!surface) {
- DirectFBError("Couldn't create surface createDFBSurface(QImage, QImage::Format, SurfaceCreationOptions)", result);
- return 0;
- }
- if (doMemCopy) {
- int bplDFB;
- uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bplDFB);
- if (mem) {
- const int height = image.height();
- const int bplQt = image.bytesPerLine();
- if (bplQt == bplDFB && bplQt == (image.width() * image.depth() / 8)) {
- memcpy(mem, image.bits(), image.byteCount());
- } else {
- for (int i=0; i<height; ++i) {
- memcpy(mem, image.scanLine(i), bplQt);
- mem += bplDFB;
- }
- }
- surface->Unlock(surface);
- }
- }
-#ifdef QT_DIRECTFB_PALETTE
- if (image.colorCount() != 0 && surface)
- QDirectFBScreen::setSurfaceColorTable(surface, image);
-#endif
- return surface;
-}
-
-IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src,
- QImage::Format format,
- SurfaceCreationOptions options,
- DFBResult *result)
-{
- Q_ASSERT(src);
- QSize size;
- src->GetSize(src, &size.rwidth(), &size.rheight());
- IDirectFBSurface *surface = createDFBSurface(size, format, options, result);
- DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlphaChannel(surface)
- ? DSBLIT_BLEND_ALPHACHANNEL
- : DSBLIT_NOFX;
- if (flags & DSBLIT_BLEND_ALPHACHANNEL)
- surface->Clear(surface, 0, 0, 0, 0);
-
- surface->SetBlittingFlags(surface, flags);
- surface->Blit(surface, src, 0, 0, 0);
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- surface->ReleaseSource(surface);
-#endif
- return surface;
-}
-
-IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
- QImage::Format format,
- SurfaceCreationOptions options,
- DFBResult *result)
-{
- DFBSurfaceDescription desc;
- memset(&desc, 0, sizeof(DFBSurfaceDescription));
- desc.flags |= DSDESC_WIDTH|DSDESC_HEIGHT;
- if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format))
- return 0;
- desc.width = size.width();
- desc.height = size.height();
- return createDFBSurface(desc, options, result);
-}
-
-IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options, DFBResult *resultPtr)
-{
- DFBResult tmp;
- DFBResult &result = (resultPtr ? *resultPtr : tmp);
- result = DFB_OK;
- IDirectFBSurface *newSurface = 0;
-
- if (!d_ptr->dfb) {
- qWarning("QDirectFBScreen::createDFBSurface() - not connected");
- return 0;
- }
-
- if (d_ptr->directFBFlags & VideoOnly
- && !(desc.flags & DSDESC_PREALLOCATED)
- && (!(desc.flags & DSDESC_CAPS) || !(desc.caps & DSCAPS_SYSTEMONLY))) {
- // Add the video only capability. This means the surface will be created in video ram
- if (!(desc.flags & DSDESC_CAPS)) {
- desc.caps = DSCAPS_VIDEOONLY;
- desc.flags |= DSDESC_CAPS;
- } else {
- desc.caps |= DSCAPS_VIDEOONLY;
- }
- result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface);
- if (result != DFB_OK
-#ifdef QT_NO_DEBUG
- && (desc.flags & DSDESC_CAPS) && (desc.caps & DSCAPS_PRIMARY)
-#endif
- ) {
- qWarning("QDirectFBScreen::createDFBSurface() Failed to create surface in video memory!\n"
- " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s",
- desc.flags, desc.caps, desc.width, desc.height,
- desc.pixelformat, DFB_PIXELFORMAT_INDEX(desc.pixelformat),
- desc.preallocated[0].data, desc.preallocated[0].pitch,
- DirectFBErrorString(result));
- }
- desc.caps &= ~DSCAPS_VIDEOONLY;
- }
-
- if (d_ptr->directFBFlags & SystemOnly)
- desc.caps |= DSCAPS_SYSTEMONLY;
-
- if (!newSurface)
- result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface);
-
- if (result != DFB_OK) {
- qWarning("QDirectFBScreen::createDFBSurface() Failed!\n"
- " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s",
- desc.flags, desc.caps, desc.width, desc.height,
- desc.pixelformat, DFB_PIXELFORMAT_INDEX(desc.pixelformat),
- desc.preallocated[0].data, desc.preallocated[0].pitch,
- DirectFBErrorString(result));
- return 0;
- }
-
- Q_ASSERT(newSurface);
-
- if (options & TrackSurface) {
- d_ptr->allocatedSurfaces.insert(newSurface);
- }
-
- return newSurface;
-}
-
-#ifdef QT_DIRECTFB_SUBSURFACE
-IDirectFBSurface *QDirectFBScreen::getSubSurface(IDirectFBSurface *surface,
- const QRect &rect,
- SurfaceCreationOptions options,
- DFBResult *resultPtr)
-{
- Q_ASSERT(!(options & NoPreallocated));
- Q_ASSERT(surface);
- DFBResult res;
- DFBResult &result = (resultPtr ? *resultPtr : res);
- IDirectFBSurface *subSurface = 0;
- if (rect.isNull()) {
- result = surface->GetSubSurface(surface, 0, &subSurface);
- } else {
- const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
- result = surface->GetSubSurface(surface, &subRect, &subSurface);
- }
- if (result != DFB_OK) {
- DirectFBError("Can't get sub surface", result);
- } else if (options & TrackSurface) {
- d_ptr->allocatedSurfaces.insert(subSurface);
- }
- return subSurface;
-}
-#endif
-
-
-void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface)
-{
- Q_ASSERT(QDirectFBScreen::instance());
- Q_ASSERT(surface);
- surface->Release(surface);
- if (!d_ptr->allocatedSurfaces.remove(surface))
- qWarning("QDirectFBScreen::releaseDFBSurface() - %p not in list", surface);
-
- //qDebug("Released surface at %p. New count = %d", surface, d_ptr->allocatedSurfaces.count());
-}
-
-QDirectFBScreen::DirectFBFlags QDirectFBScreen::directFBFlags() const
-{
- return d_ptr->directFBFlags;
-}
-
-IDirectFB *QDirectFBScreen::dfb()
-{
- return d_ptr->dfb;
-}
-
-#ifdef QT_NO_DIRECTFB_WM
-IDirectFBSurface *QDirectFBScreen::primarySurface()
-{
- return d_ptr->primarySurface;
-}
-#endif
-
-#ifndef QT_NO_DIRECTFB_LAYER
-IDirectFBDisplayLayer *QDirectFBScreen::dfbDisplayLayer()
-{
- return d_ptr->dfbLayer;
-}
-#endif
-
-DFBSurfacePixelFormat QDirectFBScreen::getSurfacePixelFormat(QImage::Format format)
-{
- switch (format) {
-#ifndef QT_NO_DIRECTFB_PALETTE
- case QImage::Format_Indexed8:
- return DSPF_LUT8;
-#endif
- case QImage::Format_RGB888:
- return DSPF_RGB24;
- case QImage::Format_ARGB4444_Premultiplied:
- return DSPF_ARGB4444;
-#if (Q_DIRECTFB_VERSION >= 0x010100)
- case QImage::Format_RGB444:
- return DSPF_RGB444;
- case QImage::Format_RGB555:
- return DSPF_RGB555;
-#endif
- case QImage::Format_RGB16:
- return DSPF_RGB16;
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- case QImage::Format_ARGB6666_Premultiplied:
- return DSPF_ARGB6666;
- case QImage::Format_RGB666:
- return DSPF_RGB18;
-#endif
- case QImage::Format_RGB32:
- return DSPF_RGB32;
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB32:
- return DSPF_ARGB;
- default:
- return DSPF_UNKNOWN;
- };
-}
-
-QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface)
-{
- DFBSurfacePixelFormat format;
- surface->GetPixelFormat(surface, &format);
-
- switch (format) {
- case DSPF_LUT8:
- return QImage::Format_Indexed8;
- case DSPF_RGB24:
- return QImage::Format_RGB888;
- case DSPF_ARGB4444:
- return QImage::Format_ARGB4444_Premultiplied;
-#if (Q_DIRECTFB_VERSION >= 0x010100)
- case DSPF_RGB444:
- return QImage::Format_RGB444;
- case DSPF_RGB555:
-#endif
- case DSPF_ARGB1555:
- return QImage::Format_RGB555;
- case DSPF_RGB16:
- return QImage::Format_RGB16;
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- case DSPF_ARGB6666:
- return QImage::Format_ARGB6666_Premultiplied;
- case DSPF_RGB18:
- return QImage::Format_RGB666;
-#endif
- case DSPF_RGB32:
- return QImage::Format_RGB32;
- case DSPF_ARGB: {
- DFBSurfaceCapabilities caps;
- const DFBResult result = surface->GetCapabilities(surface, &caps);
- Q_ASSERT(result == DFB_OK);
- Q_UNUSED(result);
- return (caps & DSCAPS_PREMULTIPLIED
- ? QImage::Format_ARGB32_Premultiplied
- : QImage::Format_ARGB32); }
- default:
- break;
- }
- return QImage::Format_Invalid;
-}
-
-DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer,
- int length)
-{
- DFBSurfaceDescription description;
- memset(&description, 0, sizeof(DFBSurfaceDescription));
-
- description.flags = DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT|DSDESC_PREALLOCATED;
- description.caps = DSCAPS_PREMULTIPLIED;
- description.width = length;
- description.height = 1;
- description.pixelformat = DSPF_ARGB;
- description.preallocated[0].data = (void*)buffer;
- description.preallocated[0].pitch = length * sizeof(uint);
- description.preallocated[1].data = 0;
- description.preallocated[1].pitch = 0;
- return description;
-}
-
-#ifndef QT_NO_DIRECTFB_PALETTE
-void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface,
- const QImage &image)
-{
- if (!surface)
- return;
-
- const int numColors = image.colorCount();
- if (numColors == 0)
- return;
-
- QVarLengthArray<DFBColor, 256> colors(numColors);
- for (int i = 0; i < numColors; ++i) {
- QRgb c = image.color(i);
- colors[i].a = qAlpha(c);
- colors[i].r = qRed(c);
- colors[i].g = qGreen(c);
- colors[i].b = qBlue(c);
- }
-
- IDirectFBPalette *palette;
- DFBResult result;
- result = surface->GetPalette(surface, &palette);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::setSurfaceColorTable GetPalette",
- result);
- return;
- }
- result = palette->SetEntries(palette, colors.data(), numColors, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::setSurfaceColorTable SetEntries",
- result);
- }
- palette->Release(palette);
-}
-
-#endif // QT_NO_DIRECTFB_PALETTE
-
-#if defined QT_DIRECTFB_CURSOR
-class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor
-{
-public:
- QDirectFBScreenCursor();
- virtual void set(const QImage &image, int hotx, int hoty);
- virtual void move(int x, int y);
- virtual void show();
- virtual void hide();
-private:
-#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR
- ~QDirectFBScreenCursor();
- bool createWindow();
- IDirectFBWindow *window;
-#endif
- IDirectFBDisplayLayer *layer;
-};
-
-QDirectFBScreenCursor::QDirectFBScreenCursor()
-{
- IDirectFB *fb = QDirectFBScreen::instance()->dfb();
- if (!fb)
- qFatal("QDirectFBScreenCursor: DirectFB not initialized");
-
- layer = QDirectFBScreen::instance()->dfbDisplayLayer();
- Q_ASSERT(layer);
-
- enable = false;
- hwaccel = true;
- supportsAlpha = true;
-#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR
- window = 0;
- DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set cooperative level", result);
- }
- result = layer->SetCursorOpacity(layer, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set cursor opacity", result);
- }
-
- result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set cooperative level", result);
- }
-#endif
-}
-
-#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR
-QDirectFBScreenCursor::~QDirectFBScreenCursor()
-{
- if (window) {
- window->Release(window);
- window = 0;
- }
-}
-
-bool QDirectFBScreenCursor::createWindow()
-{
- Q_ASSERT(!window);
- Q_ASSERT(!cursor.isNull());
- DFBWindowDescription description;
- memset(&description, 0, sizeof(DFBWindowDescription));
- description.flags = DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_CAPS|DWDESC_PIXELFORMAT|DWDESC_SURFACE_CAPS;
- description.width = cursor.width();
- description.height = cursor.height();
- description.posx = pos.x() - hotspot.x();
- description.posy = pos.y() - hotspot.y();
-#if (Q_DIRECTFB_VERSION >= 0x010100)
- description.flags |= DWDESC_OPTIONS;
- description.options = DWOP_GHOST|DWOP_ALPHACHANNEL;
-#endif
- description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER;
- const QImage::Format format = QDirectFBScreen::instance()->alphaPixmapFormat();
- description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);
- if (QDirectFBScreen::isPremultiplied(format))
- description.surface_caps = DSCAPS_PREMULTIPLIED;
-
- DFBResult result = layer->CreateWindow(layer, &description, &window);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::createWindow: Unable to create window", result);
- return false;
- }
- result = window->SetOpacity(window, 255);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set opacity ", result);
- return false;
- }
-
- result = window->SetStackingClass(window, DWSC_UPPER);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set stacking class ", result);
- return false;
- }
-
- result = window->RaiseToTop(window);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::createWindow: Unable to raise window ", result);
- return false;
- }
-
- return true;
-}
-#endif
-
-void QDirectFBScreenCursor::move(int x, int y)
-{
- pos = QPoint(x, y);
-#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR
- if (window) {
- const QPoint p = pos - hotspot;
- DFBResult result = window->MoveTo(window, p.x(), p.y());
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::move: Unable to move window", result);
- }
- }
-#else
- layer->WarpCursor(layer, x, y);
-#endif
-}
-
-void QDirectFBScreenCursor::hide()
-{
- if (enable) {
- enable = false;
- DFBResult result;
-#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR
- result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set cooperative level", result);
- }
- result = layer->SetCursorOpacity(layer, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set cursor opacity", result);
- }
- result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set cooperative level", result);
- }
-#else
- if (window) {
- result = window->SetOpacity(window, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::hide: "
- "Unable to set window opacity", result);
- }
- }
-#endif
- }
-}
-
-void QDirectFBScreenCursor::show()
-{
- if (!enable) {
- enable = true;
- DFBResult result;
- result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cooperative level", result);
- }
- result = layer->SetCursorOpacity(layer,
-#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR
- 0
-#else
- 255
-#endif
- );
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cursor shape", result);
- }
- result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cooperative level", result);
- }
-#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR
- if (window) {
- DFBResult result = window->SetOpacity(window, 255);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set window opacity", result);
- }
- }
-#endif
- }
-}
-
-void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty)
-{
- QDirectFBScreen *screen = QDirectFBScreen::instance();
- if (!screen)
- return;
-
- if (image.isNull()) {
- cursor = QImage();
- hide();
- } else {
- cursor = image.convertToFormat(screen->alphaPixmapFormat());
- size = cursor.size();
- hotspot = QPoint(hotx, hoty);
- DFBResult result = DFB_OK;
- IDirectFBSurface *surface = screen->createDFBSurface(cursor, screen->alphaPixmapFormat(),
- QDirectFBScreen::DontTrackSurface, &result);
- if (!surface) {
- DirectFBError("QDirectFBScreenCursor::set: Unable to create surface", result);
- return;
- }
-#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR
- result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cooperative level", result);
- }
- result = layer->SetCursorShape(layer, surface, hotx, hoty);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cursor shape", result);
- }
- result = layer->SetCooperativeLevel(layer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::show: "
- "Unable to set cooperative level", result);
- }
-#else
- if (window || createWindow()) {
- QSize windowSize;
- result = window->GetSize(window, &windowSize.rwidth(), &windowSize.rheight());
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: "
- "Unable to get window size", result);
- }
- result = window->Resize(window, size.width(), size.height());
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: Unable to resize window", result);
- }
-
- IDirectFBSurface *windowSurface;
- result = window->GetSurface(window, &windowSurface);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: Unable to get window surface", result);
- } else {
- result = windowSurface->Clear(windowSurface, 0, 0, 0, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: Unable to clear surface", result);
- }
-
- result = windowSurface->Blit(windowSurface, surface, 0, 0, 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: Unable to blit to surface", result);
- }
- }
- result = windowSurface->Flip(windowSurface, 0, DSFLIP_NONE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::set: Unable to flip window", result);
- }
-
- windowSurface->Release(windowSurface);
- }
-#endif
- surface->Release(surface);
- show();
- }
-
-}
-#endif // QT_DIRECTFB_CURSOR
-
-QDirectFBScreen::QDirectFBScreen(int display_id)
- : QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this))
-{
- QDirectFBScreenPrivate::instance = this;
-}
-
-QDirectFBScreen::~QDirectFBScreen()
-{
- if (QDirectFBScreenPrivate::instance == this)
- QDirectFBScreenPrivate::instance = 0;
- delete d_ptr;
-}
-
-QDirectFBScreen *QDirectFBScreen::instance()
-{
- return QDirectFBScreenPrivate::instance;
-}
-
-int QDirectFBScreen::depth(DFBSurfacePixelFormat format)
-{
- switch (format) {
- case DSPF_A1:
- return 1;
- case DSPF_A8:
- case DSPF_RGB332:
- case DSPF_LUT8:
- case DSPF_ALUT44:
- return 8;
- case DSPF_I420:
- case DSPF_YV12:
- case DSPF_NV12:
- case DSPF_NV21:
-#if (Q_DIRECTFB_VERSION >= 0x010100)
- case DSPF_RGB444:
-#endif
- return 12;
-#if (Q_DIRECTFB_VERSION >= 0x010100)
- case DSPF_RGB555:
- return 15;
-#endif
- case DSPF_ARGB1555:
- case DSPF_RGB16:
- case DSPF_YUY2:
- case DSPF_UYVY:
- case DSPF_NV16:
- case DSPF_ARGB2554:
- case DSPF_ARGB4444:
- return 16;
- case DSPF_RGB24:
- return 24;
- case DSPF_RGB32:
- case DSPF_ARGB:
- case DSPF_AiRGB:
- return 32;
- case DSPF_UNKNOWN:
- default:
- return 0;
- };
- return 0;
-}
-
-int QDirectFBScreen::depth(QImage::Format format)
-{
- int depth = 0;
- switch(format) {
- case QImage::Format_Invalid:
- case QImage::NImageFormats:
- Q_ASSERT(false);
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- depth = 1;
- break;
- case QImage::Format_Indexed8:
- depth = 8;
- break;
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- depth = 32;
- break;
- case QImage::Format_RGB555:
- case QImage::Format_RGB16:
- case QImage::Format_RGB444:
- case QImage::Format_ARGB4444_Premultiplied:
- depth = 16;
- break;
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_RGB888:
- depth = 24;
- break;
- }
- return depth;
-}
-
-void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args)
-{
- QRegExp flipRegexp(QLatin1String("^flip=([\\w,]*)$"));
- int index = args.indexOf(flipRegexp);
- if (index >= 0) {
- const QStringList flips = flipRegexp.cap(1).split(QLatin1Char(','),
- QString::SkipEmptyParts);
- flipFlags = DSFLIP_NONE;
- foreach(const QString &flip, flips) {
- if (flip == QLatin1String("wait"))
- flipFlags |= DSFLIP_WAIT;
- else if (flip == QLatin1String("blit"))
- flipFlags |= DSFLIP_BLIT;
- else if (flip == QLatin1String("onsync"))
- flipFlags |= DSFLIP_ONSYNC;
- else if (flip == QLatin1String("pipeline"))
- flipFlags |= DSFLIP_PIPELINE;
- else
- qWarning("QDirectFBScreen: Unknown flip argument: %s",
- qPrintable(flip));
- }
- } else {
- flipFlags = DSFLIP_BLIT|DSFLIP_ONSYNC;
- }
-}
-
-#ifdef QT_DIRECTFB_WM
-void QDirectFBScreenPrivate::onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event)
-{
- if (event == QWSServer::Raise) {
- QWSWindowSurface *windowSurface = window->windowSurface();
- if (windowSurface && windowSurface->key() == QLatin1String("directfb")) {
- static_cast<QDirectFBWindowSurface*>(windowSurface)->raise();
- }
- }
-}
-#endif
-
-QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType type) const
-{
- if (type == QPixmapData::BitmapType)
- return QWSGraphicsSystem::createPixmapData(type);
-
- return new QDirectFBPixmapData(q, type);
-}
-
-#if (Q_DIRECTFB_VERSION >= 0x000923)
-#ifdef QT_NO_DEBUG
-struct FlagDescription;
-static const FlagDescription *accelerationDescriptions = 0;
-static const FlagDescription *blitDescriptions = 0;
-static const FlagDescription *drawDescriptions = 0;
-#else
-struct FlagDescription {
- const char *name;
- uint flag;
-};
-
-static const FlagDescription accelerationDescriptions[] = {
- { "DFXL_NONE", DFXL_NONE },
- { "DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE },
- { "DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE },
- { "DFXL_DRAWLINE", DFXL_DRAWLINE },
- { "DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE },
- { "DFXL_BLIT", DFXL_BLIT },
- { "DFXL_STRETCHBLIT", DFXL_STRETCHBLIT },
- { "DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES },
- { "DFXL_DRAWSTRING", DFXL_DRAWSTRING },
- { 0, 0 }
-};
-
-static const FlagDescription blitDescriptions[] = {
- { "DSBLIT_NOFX", DSBLIT_NOFX },
- { "DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL },
- { "DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA },
- { "DSBLIT_COLORIZE", DSBLIT_COLORIZE },
- { "DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY },
- { "DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY },
- { "DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY },
- { "DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
- { "DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
- { "DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
-#if (Q_DIRECTFB_VERSION >= 0x000923)
- { "DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
- { "DSBLIT_XOR", DSBLIT_XOR },
-#endif
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- { "DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
-#endif
- { 0, 0 }
-};
-
-static const FlagDescription drawDescriptions[] = {
- { "DSDRAW_NOFX", DSDRAW_NOFX },
- { "DSDRAW_BLEND", DSDRAW_BLEND },
- { "DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY },
- { "DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY },
- { "DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY },
- { "DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY },
- { "DSDRAW_XOR", DSDRAW_XOR },
- { 0, 0 }
-};
-#endif
-
-static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags)
-{
-#ifdef QT_NO_DEBUG
- Q_UNUSED(mask);
- Q_UNUSED(flags);
- return QByteArray("");
-#else
- if (!mask)
- return flags[0].name;
-
- QStringList list;
- for (int i=1; flags[i].name; ++i) {
- if (mask & flags[i].flag) {
- list.append(QString::fromLatin1(flags[i].name));
- }
- }
- Q_ASSERT(!list.isEmpty());
- return (QLatin1Char(' ') + list.join(QLatin1String("|"))).toLatin1();
-#endif
-}
-static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
-{
- DFBResult result;
- DFBGraphicsDeviceDescription dev;
-
- result = fb->GetDeviceDescription(fb, &dev);
- if (result != DFB_OK) {
- DirectFBError("Error reading graphics device description", result);
- return;
- }
-
- DFBSurfacePixelFormat pixelFormat;
- primarySurface->GetPixelFormat(primarySurface, &pixelFormat);
-
- qDebug("Device: %s (%s), Driver: %s v%i.%i (%s) Pixelformat: %d (%d)\n"
- "acceleration: 0x%x%s\nblit: 0x%x%s\ndraw: 0x%0x%s\nvideo: %iKB\n",
- dev.name, dev.vendor, dev.driver.name, dev.driver.major,
- dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat),
- QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask,
- flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
- dev.blitting_flags, flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
- dev.drawing_flags, flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
- (dev.video_memory >> 10));
-}
-#endif
-
-static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value)
-{
- Q_ASSERT(value);
- QRegExp rx(QString::fromLatin1("%1=?(\\d+)").arg(variable));
- rx.setCaseSensitivity(Qt::CaseInsensitive);
- if (arguments.indexOf(rx) != -1) {
- *value = rx.cap(1).toInt();
- return true;
- }
- return false;
-}
-
-static inline QColor colorFromName(const QString &name)
-{
- QRegExp rx(QLatin1String("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])"));
- rx.setCaseSensitivity(Qt::CaseInsensitive);
- if (rx.exactMatch(name)) {
- Q_ASSERT(rx.captureCount() == 4);
- int ints[4];
- int i;
- for (i=0; i<4; ++i) {
- bool ok;
- ints[i] = rx.cap(i + 1).toUInt(&ok, 16);
- if (!ok || ints[i] > 255)
- break;
- }
- if (i == 4)
- return QColor(ints[0], ints[1], ints[2], ints[3]);
- }
- return QColor(name);
-}
-
-bool QDirectFBScreen::connect(const QString &displaySpec)
-{
- DFBResult result = DFB_OK;
-
- { // pass command line arguments to DirectFB
- const QStringList args = QCoreApplication::arguments();
- int argc = args.size();
- char **argv = new char*[argc];
-
- for (int i = 0; i < argc; ++i)
- argv[i] = qstrdup(args.at(i).toLocal8Bit().constData());
-
- result = DirectFBInit(&argc, &argv);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen: error initializing DirectFB",
- result);
- }
- delete[] argv;
- }
-
- const QStringList displayArgs = displaySpec.split(QLatin1Char(':'),
- QString::SkipEmptyParts);
-
- d_ptr->setFlipFlags(displayArgs);
-
- result = DirectFBCreate(&d_ptr->dfb);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen: error creating DirectFB interface",
- result);
- return false;
- }
-
- if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive))
- d_ptr->directFBFlags |= VideoOnly;
-
- if (displayArgs.contains(QLatin1String("systemonly"), Qt::CaseInsensitive)) {
- if (d_ptr->directFBFlags & VideoOnly) {
- qWarning("QDirectFBScreen: error. videoonly and systemonly are mutually exclusive");
- } else {
- d_ptr->directFBFlags |= SystemOnly;
- }
- }
-
- if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) {
- d_ptr->directFBFlags |= BoundingRectFlip;
- } else if (displayArgs.contains(QLatin1String("nopartialflip"), Qt::CaseInsensitive)) {
- d_ptr->directFBFlags |= NoPartialFlip;
- }
-
-#ifdef QT_DIRECTFB_IMAGECACHE
- int imageCacheSize = 4 * 1024 * 1024; // 4 MB
- setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize);
- QDirectFBPaintEngine::initImageCache(imageCacheSize);
-#endif
-
-#ifndef QT_NO_DIRECTFB_WM
- if (displayArgs.contains(QLatin1String("fullscreen")))
-#endif
- d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN);
-
- const bool forcePremultiplied = displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive);
-
- DFBSurfaceDescription description;
- memset(&description, 0, sizeof(DFBSurfaceDescription));
- IDirectFBSurface *surface;
-
-#ifdef QT_NO_DIRECTFB_WM
- description.flags = DSDESC_CAPS;
- if (::setIntOption(displayArgs, QLatin1String("width"), &description.width))
- description.flags |= DSDESC_WIDTH;
- if (::setIntOption(displayArgs, QLatin1String("height"), &description.height))
- description.flags |= DSDESC_HEIGHT;
-
- description.caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE;
- struct {
- const char *name;
- const DFBSurfaceCapabilities cap;
- } const capabilities[] = {
- { "static_alloc", DSCAPS_STATIC_ALLOC },
- { "triplebuffer", DSCAPS_TRIPLE },
- { "interlaced", DSCAPS_INTERLACED },
- { "separated", DSCAPS_SEPARATED },
-// { "depthbuffer", DSCAPS_DEPTH }, // only makes sense with TextureTriangles which are not supported
- { 0, DSCAPS_NONE }
- };
- for (int i=0; capabilities[i].name; ++i) {
- if (displayArgs.contains(QString::fromLatin1(capabilities[i].name), Qt::CaseInsensitive))
- description.caps |= capabilities[i].cap;
- }
-
- if (forcePremultiplied) {
- description.caps |= DSCAPS_PREMULTIPLIED;
- }
-
- // We don't track the primary surface as it's released in disconnect
- d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface, &result);
- if (!d_ptr->primarySurface) {
- DirectFBError("QDirectFBScreen: error creating primary surface",
- result);
- return false;
- }
-
- surface = d_ptr->primarySurface;
-#else
- description.flags = DSDESC_WIDTH|DSDESC_HEIGHT;
- description.width = description.height = 1;
- surface = createDFBSurface(description, DontTrackSurface, &result);
- if (!surface) {
- DirectFBError("QDirectFBScreen: error creating surface", result);
- return false;
- }
-#endif
- // Work out what format we're going to use for surfaces with an alpha channel
- QImage::Format pixelFormat = QDirectFBScreen::getImageFormat(surface);
- d_ptr->alphaPixmapFormat = pixelFormat;
-
- switch (pixelFormat) {
- case QImage::Format_RGB666:
- d_ptr->alphaPixmapFormat = QImage::Format_ARGB6666_Premultiplied;
- break;
- case QImage::Format_RGB444:
- d_ptr->alphaPixmapFormat = QImage::Format_ARGB4444_Premultiplied;
- break;
- case QImage::Format_RGB32:
- pixelFormat = d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied;
- // ### Format_RGB32 doesn't work so well with Qt. Force ARGB32 for windows/pixmaps
- break;
- case QImage::Format_Indexed8:
- qWarning("QDirectFBScreen::connect(). Qt/DirectFB does not work with the LUT8 pixelformat.");
- return false;
- case QImage::NImageFormats:
- case QImage::Format_Invalid:
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- case QImage::Format_RGB888:
- case QImage::Format_RGB16:
- case QImage::Format_RGB555:
- d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied;
- break;
- case QImage::Format_ARGB32:
- if (forcePremultiplied)
- d_ptr->alphaPixmapFormat = pixelFormat = QImage::Format_ARGB32_Premultiplied;
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB4444_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- // works already
- break;
- }
- setPixelFormat(pixelFormat);
- QScreen::d = QDirectFBScreen::depth(pixelFormat);
- data = 0;
- lstep = 0;
- size = 0;
-
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get screen!", result);
- return false;
- }
- const QString qws_size = QString::fromLatin1(qgetenv("QWS_SIZE"));
- if (!qws_size.isEmpty()) {
- QRegExp rx(QLatin1String("(\\d+)x(\\d+)"));
- if (!rx.exactMatch(qws_size)) {
- qWarning("QDirectFBScreen::connect: Can't parse QWS_SIZE=\"%s\"", qPrintable(qws_size));
- } else {
- int *ints[2] = { &w, &h };
- for (int i=0; i<2; ++i) {
- *ints[i] = rx.cap(i + 1).toInt();
- if (*ints[i] <= 0) {
- qWarning("QDirectFBScreen::connect: %s is not a positive integer",
- qPrintable(rx.cap(i + 1)));
- w = h = 0;
- break;
- }
- }
- }
- }
-
- setIntOption(displayArgs, QLatin1String("width"), &w);
- setIntOption(displayArgs, QLatin1String("height"), &h);
-
-#ifndef QT_NO_DIRECTFB_LAYER
- int layerId = DLID_PRIMARY;
- setIntOption(displayArgs, QLatin1String("layerid"), &layerId);
-
- result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, static_cast<DFBDisplayLayerID>(layerId),
- &d_ptr->dfbLayer);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get display layer!", result);
- return false;
- }
- result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen);
-#else
- result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen);
-#endif
-
- if (w <= 0 || h <= 0) {
-#ifdef QT_NO_DIRECTFB_WM
- result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h);
-#elif (Q_DIRECTFB_VERSION >= 0x010000)
- IDirectFBSurface *layerSurface;
- if (d_ptr->dfbLayer->GetSurface(d_ptr->dfbLayer, &layerSurface) == DFB_OK) {
- result = layerSurface->GetSize(layerSurface, &w, &h);
- layerSurface->Release(layerSurface);
- }
- if (w <= 0 || h <= 0) {
- result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
- }
-#else
- qWarning("QDirectFBScreen::connect: DirectFB versions prior to 1.0 do not offer a way\n"
- "query the size of the primary surface in windowed mode. You have to specify\n"
- "the size of the display using QWS_SIZE=[0-9]x[0-9] or\n"
- "QWS_DISPLAY=directfb:width=[0-9]:height=[0-9]");
- return false;
-#endif
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get screen size!", result);
- return false;
- }
- }
-
-
- dw = w;
- dh = h;
-
- Q_ASSERT(dw != 0 && dh != 0);
-
- physWidth = physHeight = -1;
- setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth);
- setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight);
- const int dpi = 72;
- if (physWidth < 0)
- physWidth = qRound(dw * 25.4 / dpi);
- if (physHeight < 0)
- physHeight = qRound(dh * 25.4 / dpi);
-
- setGraphicsSystem(d_ptr);
-
-#if (Q_DIRECTFB_VERSION >= 0x000923)
- if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
- printDirectFBInfo(d_ptr->dfb, surface);
-#endif
-#ifdef QT_DIRECTFB_WM
- surface->Release(surface);
- QColor backgroundColor;
-#else
- QColor &backgroundColor = d_ptr->backgroundColor;
-#endif
-
- QRegExp backgroundColorRegExp(QLatin1String("bgcolor=(.+)"));
- backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive);
- if (displayArgs.indexOf(backgroundColorRegExp) != -1) {
- backgroundColor = colorFromName(backgroundColorRegExp.cap(1));
- }
-#ifdef QT_NO_DIRECTFB_WM
- if (!backgroundColor.isValid())
- backgroundColor = Qt::green;
- d_ptr->primarySurface->Clear(d_ptr->primarySurface, backgroundColor.red(),
- backgroundColor.green(), backgroundColor.blue(),
- backgroundColor.alpha());
- d_ptr->primarySurface->Flip(d_ptr->primarySurface, 0, d_ptr->flipFlags);
-#else
- if (backgroundColor.isValid()) {
- DFBResult result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_ADMINISTRATIVE);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect "
- "Unable to set cooperative level", result);
- }
- result = d_ptr->dfbLayer->SetBackgroundColor(d_ptr->dfbLayer, backgroundColor.red(), backgroundColor.green(),
- backgroundColor.blue(), backgroundColor.alpha());
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::connect: "
- "Unable to set background color", result);
- }
-
- result = d_ptr->dfbLayer->SetBackgroundMode(d_ptr->dfbLayer, DLBM_COLOR);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreenCursor::connect: "
- "Unable to set background mode", result);
- }
-
- result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_SHARED);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect "
- "Unable to set cooperative level", result);
- }
-
- }
-#endif
-
- return true;
-}
-
-void QDirectFBScreen::disconnect()
-{
-#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
- if (d_ptr->imageProvider)
- d_ptr->imageProvider->Release(d_ptr->imageProvider);
-#endif
-#ifdef QT_NO_DIRECTFB_WM
- d_ptr->primarySurface->Release(d_ptr->primarySurface);
- d_ptr->primarySurface = 0;
-#endif
-
- foreach (IDirectFBSurface *surf, d_ptr->allocatedSurfaces)
- surf->Release(surf);
- d_ptr->allocatedSurfaces.clear();
-
-#ifndef QT_NO_DIRECTFB_LAYER
- d_ptr->dfbLayer->Release(d_ptr->dfbLayer);
- d_ptr->dfbLayer = 0;
-#endif
-
- d_ptr->dfbScreen->Release(d_ptr->dfbScreen);
- d_ptr->dfbScreen = 0;
-
- d_ptr->dfb->Release(d_ptr->dfb);
- d_ptr->dfb = 0;
-}
-
-bool QDirectFBScreen::initDevice()
-{
-#ifndef QT_NO_DIRECTFB_MOUSE
- if (qgetenv("QWS_MOUSE_PROTO").isEmpty()) {
- QWSServer::instance()->setDefaultMouse("None");
- d_ptr->mouse = new QDirectFBMouseHandler;
- }
-#endif
-#ifndef QT_NO_DIRECTFB_KEYBOARD
- if (qgetenv("QWS_KEYBOARD").isEmpty()) {
- QWSServer::instance()->setDefaultKeyboard("None");
- d_ptr->keyboard = new QDirectFBKeyboardHandler(QString());
- }
-#endif
-
-#ifdef QT_DIRECTFB_CURSOR
- qt_screencursor = new QDirectFBScreenCursor;
-#elif !defined QT_NO_QWS_CURSOR
- QScreenCursor::initSoftwareCursor();
-#endif
- return true;
-}
-
-void QDirectFBScreen::shutdownDevice()
-{
-#ifndef QT_NO_DIRECTFB_MOUSE
- delete d_ptr->mouse;
- d_ptr->mouse = 0;
-#endif
-#ifndef QT_NO_DIRECTFB_KEYBOARD
- delete d_ptr->keyboard;
- d_ptr->keyboard = 0;
-#endif
-
-#ifndef QT_NO_QWS_CURSOR
- delete qt_screencursor;
- qt_screencursor = 0;
-#endif
-}
-
-void QDirectFBScreen::setMode(int width, int height, int depth)
-{
- d_ptr->dfb->SetVideoMode(d_ptr->dfb, width, height, depth);
-}
-
-void QDirectFBScreen::blank(bool on)
-{
- d_ptr->dfbScreen->SetPowerMode(d_ptr->dfbScreen,
- (on ? DSPM_ON : DSPM_SUSPEND));
-}
-
-QWSWindowSurface *QDirectFBScreen::createSurface(QWidget *widget) const
-{
-#ifdef QT_NO_DIRECTFB_WM
- if (QApplication::type() == QApplication::GuiServer) {
- return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget);
- } else {
- return QScreen::createSurface(widget);
- }
-#else
- return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget);
-#endif
-}
-
-QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const
-{
- if (key == QLatin1String("directfb")) {
- return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this));
- }
- return QScreen::createSurface(key);
-}
-
-#if defined QT_NO_DIRECTFB_WM
-struct PaintCommand {
- PaintCommand() : dfbSurface(0), windowOpacity(255), blittingFlags(DSBLIT_NOFX) {}
- IDirectFBSurface *dfbSurface;
- QImage image;
- QPoint windowPosition;
- QRegion source;
- quint8 windowOpacity;
- DFBSurfaceBlittingFlags blittingFlags;
-};
-
-static inline void initParameters(DFBRectangle &source, const QRect &sourceGlobal, const QPoint &pos)
-{
- source.x = sourceGlobal.x() - pos.x();
- source.y = sourceGlobal.y() - pos.y();
- source.w = sourceGlobal.width();
- source.h = sourceGlobal.height();
-}
-#endif
-
-void QDirectFBScreen::exposeRegion(QRegion r, int)
-{
- Q_UNUSED(r);
-#if defined QT_NO_DIRECTFB_WM
-
- r &= region();
- if (r.isEmpty()) {
- return;
- }
- r = r.boundingRect();
-
- IDirectFBSurface *primary = d_ptr->primarySurface;
- const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows();
- QVarLengthArray<PaintCommand, 4> commands(windows.size());
- QRegion region = r;
- int idx = 0;
- for (int i=0; i<windows.size(); ++i) {
- QWSWindowSurface *surface = windows.at(i)->windowSurface();
- if (!surface)
- continue;
-
- const QRect windowGeometry = surface->geometry();
- const QRegion intersection = region & windowGeometry;
- if (intersection.isEmpty()) {
- continue;
- }
-
- PaintCommand &cmd = commands[idx];
-
- if (surface->key() == QLatin1String("directfb")) {
- const QDirectFBWindowSurface *ws = static_cast<QDirectFBWindowSurface*>(surface);
- cmd.dfbSurface = ws->directFBSurface();
-
- if (!cmd.dfbSurface) {
- continue;
- }
- } else {
- cmd.image = surface->image();
- if (cmd.image.isNull()) {
- continue;
- }
- }
- ++idx;
-
- cmd.windowPosition = windowGeometry.topLeft();
- cmd.source = intersection;
- if (windows.at(i)->isOpaque()) {
- region -= intersection;
- if (region.isEmpty())
- break;
- } else {
- cmd.windowOpacity = windows.at(i)->opacity();
- cmd.blittingFlags = cmd.windowOpacity == 255
- ? DSBLIT_BLEND_ALPHACHANNEL
- : (DSBLIT_BLEND_ALPHACHANNEL|DSBLIT_BLEND_COLORALPHA);
- }
- }
-
- solidFill(d_ptr->backgroundColor, region);
-
- while (idx > 0) {
- const PaintCommand &cmd = commands[--idx];
- Q_ASSERT(cmd.dfbSurface || !cmd.image.isNull());
- IDirectFBSurface *surface;
- if (cmd.dfbSurface) {
- surface = cmd.dfbSurface;
- } else {
- Q_ASSERT(!cmd.image.isNull());
- DFBResult result;
- surface = createDFBSurface(cmd.image, cmd.image.format(), DontTrackSurface, &result);
- Q_ASSERT((result != DFB_OK) == !surface);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::exposeRegion: Can't create surface from image", result);
- continue;
- }
- }
-
- primary->SetBlittingFlags(primary, cmd.blittingFlags);
- if (cmd.blittingFlags & DSBLIT_BLEND_COLORALPHA) {
- primary->SetColor(primary, 0xff, 0xff, 0xff, cmd.windowOpacity);
- }
- const QRegion &region = cmd.source;
- const int rectCount = region.rectCount();
- DFBRectangle source;
- if (rectCount == 1) {
- ::initParameters(source, region.boundingRect(), cmd.windowPosition);
- primary->Blit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y);
- } else {
- const QVector<QRect> rects = region.rects();
- for (int i=0; i<rectCount; ++i) {
- ::initParameters(source, rects.at(i), cmd.windowPosition);
- primary->Blit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y);
- }
- }
- if (surface != cmd.dfbSurface) {
- surface->Release(surface);
- }
- }
-
- primary->SetColor(primary, 0xff, 0xff, 0xff, 0xff);
-
-#if defined QT_NO_DIRECTFB_CURSOR and !defined QT_NO_QWS_CURSOR
- if (QScreenCursor *cursor = QScreenCursor::instance()) {
- const QRect cursorRectangle = cursor->boundingRect();
- if (cursor->isVisible() && !cursor->isAccelerated() && r.intersects(cursorRectangle)) {
- const QImage image = cursor->image();
- if (image.cacheKey() != d_ptr->cursorImageKey) {
- if (d_ptr->cursorSurface) {
- releaseDFBSurface(d_ptr->cursorSurface);
- }
- d_ptr->cursorSurface = createDFBSurface(image, image.format(), QDirectFBScreen::TrackSurface);
- d_ptr->cursorImageKey = image.cacheKey();
- }
-
- Q_ASSERT(d_ptr->cursorSurface);
- primary->SetBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL);
- primary->Blit(primary, d_ptr->cursorSurface, 0, cursorRectangle.x(), cursorRectangle.y());
- }
- }
-#endif
- flipSurface(primary, d_ptr->flipFlags, r, QPoint());
- primary->SetBlittingFlags(primary, DSBLIT_NOFX);
-#endif
-}
-
-void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
-{
-#ifdef QT_DIRECTFB_WM
- Q_UNUSED(color);
- Q_UNUSED(region);
-#else
- QDirectFBScreen::solidFill(d_ptr->primarySurface, color, region);
-#endif
-}
-
-static inline void clearRect(IDirectFBSurface *surface, const QColor &color, const QRect &rect)
-{
- Q_ASSERT(surface);
- const DFBRegion region = { rect.left(), rect.top(), rect.right(), rect.bottom() };
- // could just reinterpret_cast this to a DFBRegion
- surface->SetClip(surface, &region);
- surface->Clear(surface, color.red(), color.green(), color.blue(), color.alpha());
-}
-
-void QDirectFBScreen::solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion &region)
-{
- if (region.isEmpty())
- return;
-
- const int n = region.rectCount();
- if (n == 1) {
- clearRect(surface, color, region.boundingRect());
- } else {
- const QVector<QRect> rects = region.rects();
- for (int i=0; i<n; ++i) {
- clearRect(surface, color, rects.at(i));
- }
- }
- surface->SetClip(surface, 0);
-}
-
-QImage::Format QDirectFBScreen::alphaPixmapFormat() const
-{
- return d_ptr->alphaPixmapFormat;
-}
-
-bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description,
- QImage::Format format)
-{
- const DFBSurfacePixelFormat pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);
- if (pixelformat == DSPF_UNKNOWN)
- return false;
- description->flags |= DSDESC_PIXELFORMAT;
- description->pixelformat = pixelformat;
- if (QDirectFBScreen::isPremultiplied(format)) {
- if (!(description->flags & DSDESC_CAPS)) {
- description->caps = DSCAPS_PREMULTIPLIED;
- description->flags |= DSDESC_CAPS;
- } else {
- description->caps |= DSCAPS_PREMULTIPLIED;
- }
- }
- return true;
-}
-
-uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl)
-{
- void *mem = 0;
- const DFBResult result = surface->Lock(surface, flags, &mem, bpl);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::lockSurface()", result);
- }
-
- return reinterpret_cast<uchar*>(mem);
-}
-
-static inline bool isFullUpdate(IDirectFBSurface *surface, const QRegion &region, const QPoint &offset)
-{
- if (offset == QPoint(0, 0) && region.rectCount() == 1) {
- QSize size;
- surface->GetSize(surface, &size.rwidth(), &size.rheight());
- if (region.boundingRect().size() == size)
- return true;
- }
- return false;
-}
-
-void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
- const QRegion &region, const QPoint &offset)
-{
- if (d_ptr->directFBFlags & NoPartialFlip
- || (!(flipFlags & DSFLIP_BLIT) && QT_PREPEND_NAMESPACE(isFullUpdate(surface, region, offset)))) {
- surface->Flip(surface, 0, flipFlags);
- } else {
- if (!(d_ptr->directFBFlags & BoundingRectFlip) && region.rectCount() > 1) {
- const QVector<QRect> rects = region.rects();
- const DFBSurfaceFlipFlags nonWaitFlags = flipFlags & ~DSFLIP_WAIT;
- for (int i=0; i<rects.size(); ++i) {
- const QRect &r = rects.at(i);
- const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(),
- r.right() + offset.x(),
- r.bottom() + offset.y() };
- surface->Flip(surface, &dfbReg, i + 1 < rects.size() ? nonWaitFlags : flipFlags);
- }
- } else {
- const QRect r = region.boundingRect();
- const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(),
- r.right() + offset.x(),
- r.bottom() + offset.y() };
- surface->Flip(surface, &dfbReg, flipFlags);
- }
- }
-}
-
-#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider)
-{
- Q_ASSERT(provider);
- if (d_ptr->imageProvider)
- d_ptr->imageProvider->Release(d_ptr->imageProvider);
- d_ptr->imageProvider = provider;
-}
-#endif
-
-void QDirectFBScreen::waitIdle()
-{
- d_ptr->dfb->WaitIdle(d_ptr->dfb);
-}
-
-#ifdef QT_DIRECTFB_WM
-IDirectFBWindow *QDirectFBScreen::windowForWidget(const QWidget *widget) const
-{
- if (widget) {
- const QWSWindowSurface *surface = static_cast<const QWSWindowSurface*>(widget->windowSurface());
- if (surface && surface->key() == QLatin1String("directfb")) {
- return static_cast<const QDirectFBWindowSurface*>(surface)->directFBWindow();
- }
- }
- return 0;
-}
-#endif
-
-IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const
-{
- Q_ASSERT(widget);
- if (!widget->isVisible() || widget->size().isNull())
- return 0;
-
- const QWSWindowSurface *surface = static_cast<const QWSWindowSurface*>(widget->windowSurface());
- if (surface && surface->key() == QLatin1String("directfb")) {
- return static_cast<const QDirectFBWindowSurface*>(surface)->surfaceForWidget(widget, rect);
- }
- return 0;
-}
-
-#ifdef QT_DIRECTFB_SUBSURFACE
-IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const
-{
- Q_ASSERT(widget);
- QRect rect;
- IDirectFBSurface *surface = surfaceForWidget(widget, &rect);
- IDirectFBSurface *subSurface = 0;
- if (surface) {
- if (!area.isNull())
- rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0)));
- if (!rect.isNull()) {
- const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
- const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result);
- }
- }
- }
- return subSurface;
-}
-#endif
-
-Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_widget(const QWidget *widget, QRect *rect)
-{
- return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->surfaceForWidget(widget, rect) : 0;
-}
-#ifdef QT_DIRECTFB_SUBSURFACE
-Q_GUI_EXPORT IDirectFBSurface *qt_directfb_subsurface_for_widget(const QWidget *widget, const QRect &area)
-{
- return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->subSurfaceForWidget(widget, area) : 0;
-}
-#endif
-#ifdef QT_DIRECTFB_WM
-Q_GUI_EXPORT IDirectFBWindow *qt_directfb_window_for_widget(const QWidget *widget)
-{
- return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->windowForWidget(widget) : 0;
-}
-
-#endif
-
-QT_END_NAMESPACE
-
-#include "qdirectfbscreen.moc"
-#endif // QT_NO_QWS_DIRECTFB
-
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
deleted file mode 100644
index 0e9098df3b..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECTFBSCREEN_H
-#define QDIRECTFBSCREEN_H
-
-#include <qglobal.h>
-#ifndef QT_NO_QWS_DIRECTFB
-#include <QtGui/qscreen_qws.h>
-#include <directfb.h>
-#include <directfb_version.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if !defined QT_DIRECTFB_SUBSURFACE && !defined QT_NO_DIRECTFB_SUBSURFACE
-#define QT_NO_DIRECTFB_SUBSURFACE
-#endif
-#if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER
-#define QT_DIRECTFB_LAYER
-#endif
-#if !defined QT_NO_DIRECTFB_WM && !defined QT_DIRECTFB_WM
-#define QT_DIRECTFB_WM
-#endif
-#if !defined QT_DIRECTFB_IMAGECACHE && !defined QT_NO_DIRECTFB_IMAGECACHE
-#define QT_NO_DIRECTFB_IMAGECACHE
-#endif
-#if !defined QT_NO_DIRECTFB_IMAGEPROVIDER && !defined QT_DIRECTFB_IMAGEPROVIDER
-#define QT_DIRECTFB_IMAGEPROVIDER
-#endif
-#if !defined QT_NO_DIRECTFB_STRETCHBLIT && !defined QT_DIRECTFB_STRETCHBLIT
-#define QT_DIRECTFB_STRETCHBLIT
-#endif
-#if !defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && !defined QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-#define QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-#endif
-#if !defined QT_DIRECTFB_WINDOW_AS_CURSOR && !defined QT_NO_DIRECTFB_WINDOW_AS_CURSOR
-#define QT_NO_DIRECTFB_WINDOW_AS_CURSOR
-#endif
-#if !defined QT_DIRECTFB_PALETTE && !defined QT_NO_DIRECTFB_PALETTE
-#define QT_NO_DIRECTFB_PALETTE
-#endif
-#if !defined QT_NO_DIRECTFB_PREALLOCATED && !defined QT_DIRECTFB_PREALLOCATED
-#define QT_DIRECTFB_PREALLOCATED
-#endif
-#if !defined QT_NO_DIRECTFB_MOUSE && !defined QT_DIRECTFB_MOUSE
-#define QT_DIRECTFB_MOUSE
-#endif
-#if !defined QT_NO_DIRECTFB_KEYBOARD && !defined QT_DIRECTFB_KEYBOARD
-#define QT_DIRECTFB_KEYBOARD
-#endif
-#if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION
-#define QT_DIRECTFB_OPAQUE_DETECTION
-#endif
-#ifndef QT_NO_QWS_CURSOR
-#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR
-#define QT_DIRECTFB_CURSOR
-#elif defined QT_DIRECTFB_LAYER
-#define QT_DIRECTFB_CURSOR
-#endif
-#endif
-#ifndef QT_DIRECTFB_CURSOR
-#define QT_NO_DIRECTFB_CURSOR
-#endif
-#if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM
-#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM
-#endif
-#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && defined QT_NO_DIRECTFB_IMAGEPROVIDER
-#error QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE requires QT_DIRECTFB_IMAGEPROVIDER to be defined
-#endif
-#if defined QT_DIRECTFB_WINDOW_AS_CURSOR && defined QT_NO_DIRECTFB_WM
-#error QT_DIRECTFB_WINDOW_AS_CURSOR requires QT_DIRECTFB_WM to be defined
-#endif
-
-#define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERSION << 8) | DIRECTFB_MICRO_VERSION)
-
-#define DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(F) \
- static inline F operator~(F f) { return F(~int(f)); } \
- static inline F operator&(F left, F right) { return F(int(left) & int(right)); } \
- static inline F operator|(F left, F right) { return F(int(left) | int(right)); } \
- static inline F &operator|=(F &left, F right) { left = (left | right); return left; } \
- static inline F &operator&=(F &left, F right) { left = (left & right); return left; }
-
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBInputDeviceCapabilities);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowDescriptionFlags);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowCapabilities);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowOptions);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDescriptionFlags);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceCapabilities);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceLockFlags);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceBlittingFlags);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDrawingFlags);
-DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceFlipFlags);
-
-class QDirectFBScreenPrivate;
-class Q_GUI_EXPORT QDirectFBScreen : public QScreen
-{
-public:
- QDirectFBScreen(int display_id);
- ~QDirectFBScreen();
-
- enum DirectFBFlag {
- NoFlags = 0x00,
- VideoOnly = 0x01,
- SystemOnly = 0x02,
- BoundingRectFlip = 0x04,
- NoPartialFlip = 0x08
- };
-
- Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag);
-
- DirectFBFlags directFBFlags() const;
-
- bool connect(const QString &displaySpec);
- void disconnect();
- bool initDevice();
- void shutdownDevice();
-
- void exposeRegion(QRegion r, int changing);
- void solidFill(const QColor &color, const QRegion &region);
- static void solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion &region);
-
- void setMode(int width, int height, int depth);
- void blank(bool on);
-
- QWSWindowSurface *createSurface(QWidget *widget) const;
- QWSWindowSurface *createSurface(const QString &key) const;
-
- static QDirectFBScreen *instance();
- void waitIdle();
- IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
-#ifdef QT_DIRECTFB_SUBSURFACE
- IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const;
-#endif
- IDirectFB *dfb();
-#ifdef QT_DIRECTFB_WM
- IDirectFBWindow *windowForWidget(const QWidget *widget) const;
-#else
- IDirectFBSurface *primarySurface();
-#endif
-#ifndef QT_NO_DIRECTFB_LAYER
- IDirectFBDisplayLayer *dfbDisplayLayer();
-#endif
-
- // Track surface creation/release so we can release all on exit
- enum SurfaceCreationOption {
- DontTrackSurface = 0x1,
- TrackSurface = 0x2,
- NoPreallocated = 0x4
- };
- Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption);
- IDirectFBSurface *createDFBSurface(const QImage &image,
- QImage::Format format,
- SurfaceCreationOptions options,
- DFBResult *result = 0);
- IDirectFBSurface *createDFBSurface(const QSize &size,
- QImage::Format format,
- SurfaceCreationOptions options,
- DFBResult *result = 0);
- IDirectFBSurface *copyDFBSurface(IDirectFBSurface *src,
- QImage::Format format,
- SurfaceCreationOptions options,
- DFBResult *result = 0);
- IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc,
- SurfaceCreationOptions options,
- DFBResult *result);
-#ifdef QT_DIRECTFB_SUBSURFACE
- IDirectFBSurface *getSubSurface(IDirectFBSurface *surface,
- const QRect &rect,
- SurfaceCreationOptions options,
- DFBResult *result);
-#endif
-
- void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
- const QRegion &region, const QPoint &offset);
- void releaseDFBSurface(IDirectFBSurface *surface);
-
- using QScreen::depth;
- static int depth(DFBSurfacePixelFormat format);
- static int depth(QImage::Format format);
-
- static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format);
- static DFBSurfaceDescription getSurfaceDescription(const uint *buffer,
- int length);
- static QImage::Format getImageFormat(IDirectFBSurface *surface);
- static bool initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format);
- static inline bool isPremultiplied(QImage::Format format);
- static inline bool hasAlphaChannel(DFBSurfacePixelFormat format);
- static inline bool hasAlphaChannel(IDirectFBSurface *surface);
- QImage::Format alphaPixmapFormat() const;
-
-#ifndef QT_NO_DIRECTFB_PALETTE
- static void setSurfaceColorTable(IDirectFBSurface *surface,
- const QImage &image);
-#endif
-
- static uchar *lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl = 0);
-#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
- void setDirectFBImageProvider(IDirectFBImageProvider *provider);
-#endif
-private:
- QDirectFBScreenPrivate *d_ptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions);
-Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::DirectFBFlags);
-
-inline bool QDirectFBScreen::isPremultiplied(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_ARGB4444_Premultiplied:
- return true;
- default:
- break;
- }
- return false;
-}
-
-inline bool QDirectFBScreen::hasAlphaChannel(DFBSurfacePixelFormat format)
-{
- switch (format) {
- case DSPF_ARGB1555:
- case DSPF_ARGB:
- case DSPF_LUT8:
- case DSPF_AiRGB:
- case DSPF_A1:
- case DSPF_ARGB2554:
- case DSPF_ARGB4444:
-#if (Q_DIRECTFB_VERSION >= 0x000923)
- case DSPF_AYUV:
-#endif
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- case DSPF_A4:
- case DSPF_ARGB1666:
- case DSPF_ARGB6666:
- case DSPF_LUT2:
-#endif
- return true;
- default:
- return false;
- }
-}
-
-inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface)
-{
- Q_ASSERT(surface);
- DFBSurfacePixelFormat format;
- surface->GetPixelFormat(surface, &format);
- return QDirectFBScreen::hasAlphaChannel(format);
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_DIRECTFB
-#endif // QDIRECTFBSCREEN_H
-
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
deleted file mode 100644
index 742c857e9e..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbscreen.h"
-
-#include <QtGui/qscreendriverplugin_qws.h>
-#include <QtCore/qstringlist.h>
-#ifndef QT_NO_QWS_DIRECTFB
-
-class DirectFBScreenDriverPlugin : public QScreenDriverPlugin
-{
-public:
- DirectFBScreenDriverPlugin();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-
-DirectFBScreenDriverPlugin::DirectFBScreenDriverPlugin()
- : QScreenDriverPlugin()
-{
-}
-
-QStringList DirectFBScreenDriverPlugin::keys() const
-{
- return (QStringList() << "directfb");
-}
-
-QScreen* DirectFBScreenDriverPlugin::create(const QString& driver,
- int displayId)
-{
- if (driver.toLower() != "directfb")
- return 0;
-
- return new QDirectFBScreen(displayId);
-}
-
-Q_EXPORT_PLUGIN2(qdirectfbscreen, DirectFBScreenDriverPlugin)
-
-#endif
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
deleted file mode 100644
index 9a94c30d8c..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ /dev/null
@@ -1,506 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdirectfbwindowsurface.h"
-#include "qdirectfbscreen.h"
-#include "qdirectfbpaintengine.h"
-
-#include <private/qwidget_p.h>
-#include <qwidget.h>
-#include <qwindowsystem_qws.h>
-#include <qpaintdevice.h>
-#include <qvarlengtharray.h>
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-QT_BEGIN_NAMESPACE
-
-QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr)
- : QDirectFBPaintDevice(scr)
-#ifndef QT_NO_DIRECTFB_WM
- , dfbWindow(0)
-#endif
- , flipFlags(flip)
- , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
- , flushPending(false)
-{
-#ifdef QT_NO_DIRECTFB_WM
- mode = Offscreen;
-#endif
- setSurfaceFlags(Opaque | Buffered);
-#ifdef QT_DIRECTFB_TIMING
- frames = 0;
- timer.start();
-#endif
-}
-
-QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget)
- : QWSWindowSurface(widget), QDirectFBPaintDevice(scr)
-#ifndef QT_NO_DIRECTFB_WM
- , dfbWindow(0)
-#endif
- , flipFlags(flip)
- , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
- , flushPending(false)
-{
- SurfaceFlags flags = 0;
- if (!widget || widget->window()->windowOpacity() == 0xff)
- flags |= Opaque;
-#ifdef QT_NO_DIRECTFB_WM
- if (widget && widget->testAttribute(Qt::WA_PaintOnScreen)) {
- flags = RegionReserved;
- mode = Primary;
- } else {
- mode = Offscreen;
- flags = Buffered;
- }
-#endif
- setSurfaceFlags(flags);
-#ifdef QT_DIRECTFB_TIMING
- frames = 0;
- timer.start();
-#endif
-}
-
-QDirectFBWindowSurface::~QDirectFBWindowSurface()
-{
- releaseSurface();
- // these are not tracked by QDirectFBScreen so we don't want QDirectFBPaintDevice to release it
-}
-
-bool QDirectFBWindowSurface::isValid() const
-{
- return true;
-}
-
-#ifdef QT_DIRECTFB_WM
-void QDirectFBWindowSurface::raise()
-{
- if (IDirectFBWindow *window = directFBWindow()) {
- window->RaiseToTop(window);
- }
-}
-
-IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const
-{
- return dfbWindow;
-}
-
-void QDirectFBWindowSurface::createWindow(const QRect &rect)
-{
- IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
- if (!layer)
- qFatal("QDirectFBWindowSurface: Unable to get primary display layer!");
-
- updateIsOpaque();
-
- DFBWindowDescription description;
- memset(&description, 0, sizeof(DFBWindowDescription));
-
- description.flags = DWDESC_CAPS|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT;
- description.caps = DWCAPS_NODECORATION;
- description.surface_caps = DSCAPS_NONE;
- imageFormat = screen->pixelFormat();
-
- if (!(surfaceFlags() & Opaque)) {
- imageFormat = screen->alphaPixmapFormat();
- description.caps |= DWCAPS_ALPHACHANNEL;
-#if (Q_DIRECTFB_VERSION >= 0x010200)
- description.flags |= DWDESC_OPTIONS;
- description.options |= DWOP_ALPHACHANNEL;
-#endif
- }
- description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(imageFormat);
- description.posx = rect.x();
- description.posy = rect.y();
- description.width = rect.width();
- description.height = rect.height();
-
- if (QDirectFBScreen::isPremultiplied(imageFormat))
- description.surface_caps = DSCAPS_PREMULTIPLIED;
-
- if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
- description.surface_caps |= DSCAPS_VIDEOONLY;
-
- DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow);
-
- if (result != DFB_OK)
- DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result);
-
- if (window()) {
- if (window()->windowFlags() & Qt::WindowStaysOnTopHint) {
- dfbWindow->SetStackingClass(dfbWindow, DWSC_UPPER);
- }
- DFBWindowID winid;
- result = dfbWindow->GetID(dfbWindow, &winid);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBWindowSurface::createWindow. Can't get ID", result);
- } else {
- window()->setProperty("_q_DirectFBWindowID", winid);
- }
- }
-
- Q_ASSERT(!dfbSurface);
- dfbWindow->GetSurface(dfbWindow, &dfbSurface);
-}
-
-static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
-{
- DFBResult result = DFB_OK;
- const bool isMove = old.isEmpty() || rect.topLeft() != old.topLeft();
- const bool isResize = rect.size() != old.size();
-
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- if (isResize && isMove) {
- result = dfbWindow->SetBounds(dfbWindow, rect.x(), rect.y(),
- rect.width(), rect.height());
- } else if (isResize) {
- result = dfbWindow->Resize(dfbWindow,
- rect.width(), rect.height());
- } else if (isMove) {
- result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y());
- }
-#else
- if (isResize) {
- result = dfbWindow->Resize(dfbWindow,
- rect.width(), rect.height());
- }
- if (isMove) {
- result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y());
- }
-#endif
- return result;
-}
-#endif // QT_NO_DIRECTFB_WM
-
-void QDirectFBWindowSurface::setGeometry(const QRect &rect)
-{
- const QRect oldRect = geometry();
- if (oldRect == rect)
- return;
-
- IDirectFBSurface *oldSurface = dfbSurface;
- const bool sizeChanged = oldRect.size() != rect.size();
- if (sizeChanged) {
- delete engine;
- engine = 0;
- releaseSurface();
- Q_ASSERT(!dfbSurface);
- }
-
- if (rect.isNull()) {
-#ifndef QT_NO_DIRECTFB_WM
- if (dfbWindow) {
- if (window())
- window()->setProperty("_q_DirectFBWindowID", QVariant());
-
- dfbWindow->Release(dfbWindow);
- dfbWindow = 0;
- }
-#endif
- Q_ASSERT(!dfbSurface);
-#ifdef QT_DIRECTFB_SUBSURFACE
- Q_ASSERT(!subSurface);
-#endif
- } else {
-#ifdef QT_DIRECTFB_WM
- if (!dfbWindow) {
- createWindow(rect);
- } else {
- setWindowGeometry(dfbWindow, oldRect, rect);
- Q_ASSERT(!sizeChanged || !dfbSurface);
- if (sizeChanged)
- dfbWindow->GetSurface(dfbWindow, &dfbSurface);
- }
-#else
- IDirectFBSurface *primarySurface = screen->primarySurface();
- DFBResult result = DFB_OK;
- if (mode == Primary) {
- Q_ASSERT(primarySurface);
- if (rect == screen->region().boundingRect()) {
- dfbSurface = primarySurface;
- } else {
- const DFBRectangle r = { rect.x(), rect.y(),
- rect.width(), rect.height() };
- result = primarySurface->GetSubSurface(primarySurface, &r, &dfbSurface);
- }
- } else { // mode == Offscreen
- if (!dfbSurface) {
- dfbSurface = screen->createDFBSurface(rect.size(), surfaceFlags() & Opaque ? screen->pixelFormat() : screen->alphaPixmapFormat(),
- QDirectFBScreen::DontTrackSurface);
- }
- }
- if (result != DFB_OK)
- DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result);
-#endif
- }
- if (oldSurface != dfbSurface) {
- imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
- }
-
- if (oldRect.size() != rect.size()) {
- QWSWindowSurface::setGeometry(rect);
- } else {
- QWindowSurface::setGeometry(rect);
- }
-}
-
-QByteArray QDirectFBWindowSurface::permanentState() const
-{
- QByteArray state(sizeof(SurfaceFlags) + sizeof(DFBWindowID), 0);
- char *ptr = state.data();
- SurfaceFlags flags = surfaceFlags();
- memcpy(ptr, &flags, sizeof(SurfaceFlags));
- ptr += sizeof(SurfaceFlags);
- DFBWindowID did = (DFBWindowID)(-1);
- if (dfbWindow)
- dfbWindow->GetID(dfbWindow, &did);
- memcpy(ptr, &did, sizeof(DFBWindowID));
- return state;
-}
-
-void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
-{
- const char *ptr = state.constData();
- IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
- SurfaceFlags flags;
- memcpy(&flags, ptr, sizeof(SurfaceFlags));
-
- setSurfaceFlags(flags);
- ptr += sizeof(SurfaceFlags);
- DFBWindowID id;
- memcpy(&id, ptr, sizeof(DFBWindowID));
- if (dfbSurface)
- dfbSurface->Release(dfbSurface);
- if (id != (DFBWindowID)-1) {
- IDirectFBWindow *dw;
- layer->GetWindow(layer, id, &dw);
- if (dw->GetSurface(dw, &dfbSurface) != DFB_OK)
- dfbSurface = 0;
- dw->Release(dw);
- }
- else {
- dfbSurface = 0;
- }
-}
-
-bool QDirectFBWindowSurface::scroll(const QRegion &region, int dx, int dy)
-{
- if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.rectCount() != 1)
- return false;
- if (flushPending) {
- dfbSurface->Flip(dfbSurface, 0, DSFLIP_BLIT);
- } else {
- flushPending = true;
- }
- dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
- const QRect r = region.boundingRect();
- const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() };
- dfbSurface->Blit(dfbSurface, dfbSurface, &rect, r.x() + dx, r.y() + dy);
- return true;
-}
-
-bool QDirectFBWindowSurface::move(const QPoint &moveBy)
-{
- setGeometry(geometry().translated(moveBy));
- return true;
-}
-
-void QDirectFBWindowSurface::setOpaque(bool opaque)
-{
- SurfaceFlags flags = surfaceFlags();
- if (opaque != (flags & Opaque)) {
- if (opaque) {
- flags |= Opaque;
- } else {
- flags &= ~Opaque;
- }
- setSurfaceFlags(flags);
- }
-}
-
-
-void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
- const QPoint &offset)
-{
- QWidget *win = window();
- if (!win)
- return;
-
-#if !defined(QT_NO_QWS_PROXYSCREEN) && !defined(QT_NO_GRAPHICSVIEW)
- QWExtra *extra = qt_widget_private(widget)->extraData();
- if (extra && extra->proxyWidget)
- return;
-#else
- Q_UNUSED(widget);
-#endif
-
- const quint8 windowOpacity = quint8(win->windowOpacity() * 0xff);
- const QRect windowGeometry = geometry();
-#ifdef QT_DIRECTFB_WM
- quint8 currentOpacity;
- Q_ASSERT(dfbWindow);
- dfbWindow->GetOpacity(dfbWindow, &currentOpacity);
- if (currentOpacity != windowOpacity) {
- dfbWindow->SetOpacity(dfbWindow, windowOpacity);
- }
-
- screen->flipSurface(dfbSurface, flipFlags, region, offset);
-#else
- setOpaque(windowOpacity == 0xff);
- if (mode == Offscreen) {
- screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0);
- } else {
- screen->flipSurface(dfbSurface, flipFlags, region, offset);
- }
-#endif
-
-#ifdef QT_DIRECTFB_TIMING
- enum { Secs = 3 };
- ++frames;
- if (timer.elapsed() >= Secs * 1000) {
- qDebug("%d fps", int(double(frames) / double(Secs)));
- frames = 0;
- timer.restart();
- }
-#endif
- flushPending = false;
-}
-
-void QDirectFBWindowSurface::beginPaint(const QRegion &region)
-{
- if (!engine) {
- engine = new QDirectFBPaintEngine(this);
- }
-
- if (dfbSurface) {
- const QWidget *win = window();
- if (win && win->testAttribute(Qt::WA_NoSystemBackground)) {
- QDirectFBScreen::solidFill(dfbSurface, Qt::transparent, region);
- }
- }
- flushPending = true;
-}
-
-void QDirectFBWindowSurface::endPaint(const QRegion &)
-{
-#ifdef QT_NO_DIRECTFB_SUBSURFACE
- unlockSurface();
-#endif
-}
-
-IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const
-{
- return dfbSurface;
-}
-
-
-IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const
-{
- Q_ASSERT(widget);
- if (!dfbSurface)
- return 0;
- QWidget *win = window();
- Q_ASSERT(win);
- if (rect) {
- if (win == widget) {
- *rect = widget->rect();
- } else {
- *rect = QRect(widget->mapTo(win, QPoint(0, 0)), widget->size());
- }
- }
-
- Q_ASSERT(win == widget || win->isAncestorOf(widget));
- return dfbSurface;
-}
-
-void QDirectFBWindowSurface::releaseSurface()
-{
- if (dfbSurface) {
-#ifdef QT_DIRECTFB_SUBSURFACE
- releaseSubSurface();
-#else
- unlockSurface();
-#endif
-#ifdef QT_NO_DIRECTFB_WM
- Q_ASSERT(screen->primarySurface());
- if (dfbSurface != screen->primarySurface())
-#endif
-
- dfbSurface->Release(dfbSurface);
- dfbSurface = 0;
- }
-}
-
-void QDirectFBWindowSurface::updateIsOpaque()
-{
- const QWidget *win = window();
- Q_ASSERT(win);
- if (win->testAttribute(Qt::WA_OpaquePaintEvent) || win->testAttribute(Qt::WA_PaintOnScreen)) {
- setOpaque(true);
- return;
- }
-
- if (qFuzzyCompare(static_cast<float>(win->windowOpacity()), 1.0f)) {
- const QPalette &pal = win->palette();
-
- if (win->autoFillBackground()) {
- const QBrush &autoFillBrush = pal.brush(win->backgroundRole());
- if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) {
- setOpaque(true);
- return;
- }
- }
-
- if (win->isWindow() && !win->testAttribute(Qt::WA_NoSystemBackground)) {
- const QBrush &windowBrush = win->palette().brush(QPalette::Window);
- if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) {
- setOpaque(true);
- return;
- }
- }
- }
- setOpaque(false);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
deleted file mode 100644
index 75d462b523..0000000000
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDIRECFBWINDOWSURFACE_H
-#define QDIRECFBWINDOWSURFACE_H
-
-#include "qdirectfbpaintengine.h"
-#include "qdirectfbpaintdevice.h"
-#include "qdirectfbscreen.h"
-
-#ifndef QT_NO_QWS_DIRECTFB
-
-#include <private/qpaintengine_raster_p.h>
-#include <private/qwindowsurface_qws_p.h>
-
-#ifdef QT_DIRECTFB_TIMING
-#include <qdatetime.h>
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice
-{
-public:
- QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen *scr);
- QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen *scr, QWidget *widget);
- ~QDirectFBWindowSurface();
-
-#ifdef QT_DIRECTFB_WM
- void raise();
-#endif
- bool isValid() const;
-
- void setGeometry(const QRect &rect);
-
- QString key() const { return QLatin1String("directfb"); }
- QByteArray permanentState() const;
- void setPermanentState(const QByteArray &state);
-
- bool scroll(const QRegion &area, int dx, int dy);
-
- bool move(const QPoint &offset);
-
- QImage image() const { return QImage(); }
- QPaintDevice *paintDevice() { return this; }
-
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
-
- void beginPaint(const QRegion &);
- void endPaint(const QRegion &);
-
- IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
- IDirectFBSurface *directFBSurface() const;
-#ifdef QT_DIRECTFB_WM
- IDirectFBWindow *directFBWindow() const;
-#endif
-private:
- void updateIsOpaque();
- void setOpaque(bool opaque);
- void releaseSurface();
-
-#ifdef QT_DIRECTFB_WM
- void createWindow(const QRect &rect);
- IDirectFBWindow *dfbWindow;
-#else
- enum Mode {
- Primary,
- Offscreen
- } mode;
-#endif
-
- DFBSurfaceFlipFlags flipFlags;
- bool boundingRectFlip;
- bool flushPending;
-#ifdef QT_DIRECTFB_TIMING
- int frames;
- QTime timer;
-#endif
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_DIRECTFB
-
-#endif // QDIRECFBWINDOWSURFACE_H
diff --git a/src/plugins/gfxdrivers/eglnullws/README b/src/plugins/gfxdrivers/eglnullws/README
deleted file mode 100644
index 80b88c7e01..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/README
+++ /dev/null
@@ -1,48 +0,0 @@
-EGL NullWS QScreen Driver
-=========================
-
-If your application draws everything within a single full-screen QGLWidget then
-you may wish to use this QScreen plugin driver. This driver simply returns 0
-(as a EGLNativeWindowType value) when asked by the QtOpenGl module to create a
-native window. Some OpenGL ES implementations (including PowerVR) interpret this
-to mean that a full-screen OpenGL context is desired without any windowing
-support (NullWS).
-
-To tell a Qt/Embedded application to use this driver use the -display command
-line option or the QWS_DISPLAY environment variable. The following driver
-options are supported:
-
-size=WIDTHxHEIGHT Screen size reported by the driver
-format=FORMAT Screen format
-
-Run with '-display eglnullws:help' to get a full list of options (including a
-list of supported format strings).
-
-If you choose a screen format that is not supported by the hardware then the
-QtOpenGl module will write out a list of supported EGL configurations. Use
-one of the supported screen formats from this list.
-
-Using this driver with PowerVR hardware
----------------------------------------
-
-Using this plugin with PowerVR hardware should give a significant speedup
-compared to running with the Qt powervr driver (with a full-screen QGLWidget).
-This is because sacrificing the window system allows less work to be done in
-order to get graphics on the screen. Using this driver also avoids the memory
-fragmentation issues present in the powervr driver and avoids any direct
-dependencies on the deprecated PVR2D API from Imagination Technologies.
-
-To use this driver ensure you have /etc/powervr.ini with contents similar to
-this:
-
-[default]
-WindowSystem=libpvrPVR2D_FLIPWSEGL.so
-
-This driver will also function with libpvrPVR2D_FRONTWSEGL.so, but that draws
-straight into the framebuffer and will therefore cause flickering (it can be
-useful for performance testing though). The flip plugin uses triple buffering,
-so you will need to set the virtual vertical resolution of your framebuffer to
-be three times the physical vertical resolution of your screen. This can be
-done with 'fbset -vyres'. Failure to do this can cause system crashes. You
-should also ensure that the plugin you choose in powervr.ini is in your library
-path (it may just silently default to the flip plugin if not).
diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullws.pro b/src/plugins/gfxdrivers/eglnullws/eglnullws.pro
deleted file mode 100644
index 30cebab41a..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/eglnullws.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TARGET = qeglnullws
-include(../../qpluginbase.pri)
-
-CONFIG += warn_on
-QT += opengl
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
-
-HEADERS = eglnullwsscreen.h \
- eglnullwsscreenplugin.h \
- eglnullwswindowsurface.h
-
-SOURCES = eglnullwsscreen.cpp \
- eglnullwsscreenplugin.cpp \
- eglnullwswindowsurface.cpp
diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp
deleted file mode 100644
index d090e857ad..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "eglnullwsscreen.h"
-#include "eglnullwswindowsurface.h"
-#include "eglnullwsscreenplugin.h"
-
-#include <QHash>
-#include <QDebug>
-
-namespace
-{
- class EGLNullWSScreenSurfaceFunctions : public QGLScreenSurfaceFunctions
- {
- public:
- virtual bool createNativeWindow(QWidget *, EGLNativeWindowType *native)
- { *native = 0; return true; }
- };
-}
-
-EGLNullWSScreen::EGLNullWSScreen(int displayId) : QGLScreen(displayId) {}
-
-EGLNullWSScreen::~EGLNullWSScreen() {}
-
-bool EGLNullWSScreen::initDevice()
-{
- setSurfaceFunctions(new EGLNullWSScreenSurfaceFunctions);
- return true;
-}
-
-static const QHash<QString, QImage::Format> formatDictionary()
-{
- QHash<QString, QImage::Format> dictionary;
- dictionary["rgb32"] = QImage::Format_RGB32;
- dictionary["argb32"] = QImage::Format_ARGB32;
- dictionary["rgb16"] = QImage::Format_RGB16;
- dictionary["rgb666"] = QImage::Format_RGB666;
- dictionary["rgb555"] = QImage::Format_RGB555;
- dictionary["rgb888"] = QImage::Format_RGB888;
- dictionary["rgb444"] = QImage::Format_RGB444;
- return dictionary;
-}
-
-static int depthForFormat(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_RGB32: return 32;
- case QImage::Format_ARGB32: return 32;
- case QImage::Format_RGB16: return 16;
- case QImage::Format_RGB666: return 24;
- case QImage::Format_RGB555: return 16;
- case QImage::Format_RGB888: return 24;
- case QImage::Format_RGB444: return 16;
- default:
- Q_ASSERT_X(false, "EGLNullWSScreen", "Unknown format");
- return -1;
- }
-}
-
-static void printHelp(const QHash<QString, QImage::Format> &formatDictionary)
-{
- QByteArray formatsBuf;
- QTextStream(&formatsBuf) << QStringList(formatDictionary.keys()).join(", ");
- qWarning(
- "%s: Valid options are:\n"
- "size=WIDTHxHEIGHT Screen size reported by this driver\n"
- "format=FORMAT Screen format, where FORMAT is one of the following:\n"
- " %s\n",
- PluginName,
- formatsBuf.constData());
-}
-
-bool EGLNullWSScreen::connect(const QString &displaySpec)
-{
- const QStringList args = displaySpec.section(':', 1).split(':', QString::SkipEmptyParts);
- const QHash<QString, QImage::Format> formatDict = formatDictionary();
- Q_FOREACH(const QString arg, args) {
- const QString optionName = arg.section('=', 0, 0);
- const QString optionArg = arg.section('=', 1);
- if (optionName == QLatin1String("size")) {
- w = optionArg.section('x', 0, 0).toInt();
- h = optionArg.section('x', 1, 1).toInt();
- } else if (optionName == QLatin1String("format")) {
- if (formatDict.contains(optionArg))
- setPixelFormat(formatDict.value(optionArg));
- else
- printHelp(formatDict);
- } else {
- printHelp(formatDict);
- }
- }
-
- if (w == 0 || h == 0) {
- w = 640;
- h = 480;
- qWarning("%s: Using default screen size %dx%d", PluginName, w, h);
- }
- dw = w;
- dh = h;
-
- if (pixelFormat() == QImage::Format_Invalid) {
- qWarning("%s: Using default screen format argb32", PluginName);
- setPixelFormat(QImage::Format_ARGB32);
- }
- d = depthForFormat(pixelFormat());
-
- static const int Dpi = 120;
- static const qreal ScalingFactor = static_cast<qreal>(25.4) / Dpi;
- physWidth = qRound(dw * ScalingFactor);
- physHeight = qRound(dh * ScalingFactor);
-
- return true;
-}
-
-void EGLNullWSScreen::disconnect() {}
-
-void EGLNullWSScreen::shutdownDevice() {}
-
-void EGLNullWSScreen::setMode(int /*width*/, int /*height*/, int /*depth*/) {}
-
-void EGLNullWSScreen::blank(bool /*on*/) {}
-
-void EGLNullWSScreen::exposeRegion(QRegion /*r*/, int /*changing*/) {}
-
-QWSWindowSurface* EGLNullWSScreen::createSurface(QWidget *widget) const
-{
- if (qobject_cast<QGLWidget*>(widget)) {
- return new EGLNullWSWindowSurface(widget);
- } else {
- qWarning("%s: Creating non-GL surface", PluginName);
- return QScreen::createSurface(widget);
- }
-}
-
-QWSWindowSurface* EGLNullWSScreen::createSurface(const QString &key) const
-{
- if (key == QLatin1String("eglnullws")) {
- return new EGLNullWSWindowSurface;
- } else {
- qWarning("%s: Creating non-GL surface", PluginName);
- return QScreen::createSurface(key);
- }
-}
diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h
deleted file mode 100644
index 08ba2fa0cc..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef EGLNULLWSSCREEN
-#define EGLNULLWSSCREEN
-
-#include <QGLScreen>
-
-class EGLNullWSScreen : public QGLScreen
-{
-public:
- EGLNullWSScreen(int displayId);
- ~EGLNullWSScreen();
-
- bool initDevice();
- bool connect(const QString &displaySpec);
- void disconnect();
- void shutdownDevice();
-
- void setMode(int width, int height, int depth);
- void blank(bool on);
-
- void exposeRegion(QRegion r, int changing);
-
- QWSWindowSurface* createSurface(QWidget *widget) const;
- QWSWindowSurface* createSurface(const QString &key) const;
-
- bool hasOpenGL() { return true; }
-};
-
-#endif // EGLNULLWSSCREEN
diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp
deleted file mode 100644
index f7080333f8..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "eglnullwsscreenplugin.h"
-#include "eglnullwsscreen.h"
-
-#include <QScreenDriverPlugin>
-#include <QStringList>
-
-class EGLNullWSScreenPlugin : public QScreenDriverPlugin
-{
-public:
- virtual QStringList keys() const;
- virtual QScreen *create(const QString& driver, int displayId);
-};
-
-QStringList EGLNullWSScreenPlugin::keys() const
-{
- return QStringList() << QLatin1String(PluginName);
-}
-
-QScreen *EGLNullWSScreenPlugin::create(const QString& driver, int displayId)
-{
- return (driver.toLower() == QLatin1String(PluginName) ?
- new EGLNullWSScreen(displayId) : 0);
-}
-
-Q_EXPORT_PLUGIN2(qeglnullws, EGLNullWSScreenPlugin)
diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h
deleted file mode 100644
index 64a362374d..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef EGLNULLWSSCREENPLUGIN_H
-#define EGLNULLWSSCREENPLUGIN_H
-
-const char *const PluginName = "eglnullws";
-
-#endif // EGLNULLWSSCREENPLUGIN_H
diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp
deleted file mode 100644
index 8af4d406a5..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "eglnullwswindowsurface.h"
-#include "eglnullwsscreenplugin.h"
-
-#include <QGLWidget>
-
-static const QWSWindowSurface::SurfaceFlags Flags
- = QWSWindowSurface::RegionReserved | QWSWindowSurface::RegionReserved;
-
-EGLNullWSWindowSurface::EGLNullWSWindowSurface(QWidget *w)
- :
- QWSGLWindowSurface(w),
- widget(w)
-{
- setSurfaceFlags(Flags);
-}
-
-EGLNullWSWindowSurface::EGLNullWSWindowSurface()
- : widget(0)
-{
- setSurfaceFlags(Flags);
-}
-
-EGLNullWSWindowSurface::~EGLNullWSWindowSurface() {}
-
-QString EGLNullWSWindowSurface::key() const
-{
- return QLatin1String(PluginName);
-}
-
-QPaintDevice *EGLNullWSWindowSurface::paintDevice()
-{
- return widget;
-}
-
-bool EGLNullWSWindowSurface::isValid() const
-{
- return qobject_cast<QGLWidget *>(window());
-}
-
-QImage EGLNullWSWindowSurface::image() const
-{
- return QImage();
-}
diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h b/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h
deleted file mode 100644
index 793d3256d6..0000000000
--- a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef EGLNULLWSWINDOWSURFACE_H
-#define EGLNULLWSWINDOWSURFACE_H
-
-#include <private/qglwindowsurface_qws_p.h>
-
-class EGLNullWSWindowSurface : public QWSGLWindowSurface
-{
-public:
- EGLNullWSWindowSurface(QWidget *widget);
- EGLNullWSWindowSurface();
- virtual ~EGLNullWSWindowSurface();
-
- virtual QString key() const;
- virtual QPaintDevice *paintDevice();
- virtual bool isValid() const;
- virtual QImage image() const;
-
-private:
- QWidget *widget;
-};
-
-#endif // EGLNULLWSWINDOWSURFACE_H
diff --git a/src/plugins/gfxdrivers/gfxdrivers.pro b/src/plugins/gfxdrivers/gfxdrivers.pro
deleted file mode 100644
index 1f38942a50..0000000000
--- a/src/plugins/gfxdrivers/gfxdrivers.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = subdirs
-contains(gfx-plugins, ahi) :SUBDIRS += ahi
-contains(gfx-plugins, directfb) :SUBDIRS += directfb
-contains(gfx-plugins, linuxfb) :SUBDIRS += linuxfb
-contains(gfx-plugins, qvfb) :SUBDIRS += qvfb
-contains(gfx-plugins, vnc) :SUBDIRS += vnc
-contains(gfx-plugins, transformed) :SUBDIRS += transformed
-contains(gfx-plugins, svgalib) :SUBDIRS += svgalib
-contains(gfx-plugins, powervr) :SUBDIRS += powervr
-contains(gfx-plugins, eglnullws) :SUBDIRS += eglnullws
diff --git a/src/plugins/gfxdrivers/linuxfb/linuxfb.pro b/src/plugins/gfxdrivers/linuxfb/linuxfb.pro
deleted file mode 100644
index c1cdc0eda7..0000000000
--- a/src/plugins/gfxdrivers/linuxfb/linuxfb.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qscreenlinuxfb
-include(../../qpluginbase.pri)
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_LINUXFB
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qscreenlinuxfb_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qscreenlinuxfb_qws.cpp
diff --git a/src/plugins/gfxdrivers/linuxfb/main.cpp b/src/plugins/gfxdrivers/linuxfb/main.cpp
deleted file mode 100644
index 6ea7b9ca24..0000000000
--- a/src/plugins/gfxdrivers/linuxfb/main.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qscreendriverplugin_qws.h>
-#include <qscreenlinuxfb_qws.h>
-#include <qstringlist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QScreenLinuxFbPlugin : public QScreenDriverPlugin
-{
-public:
- QScreenLinuxFbPlugin();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-
-QScreenLinuxFbPlugin::QScreenLinuxFbPlugin()
- : QScreenDriverPlugin()
-{
-}
-
-QStringList QScreenLinuxFbPlugin::keys() const
-{
- QStringList list;
- list << QLatin1String("LinuxFb");
- return list;
-}
-
-QScreen* QScreenLinuxFbPlugin::create(const QString& driver, int displayId)
-{
- if (driver.toLower() == QLatin1String("linuxfb"))
- return new QLinuxFbScreen(displayId);
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(qscreenlinuxfb, QScreenLinuxFbPlugin)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro b/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro
deleted file mode 100644
index 595cf45301..0000000000
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TEMPLATE = lib
-TARGET = pvrQWSWSEGL
-CONFIG += dll warn_on
-CONFIG -= qt
-
-HEADERS+=\
- pvrqwsdrawable.h \
- pvrqwsdrawable_p.h
-
-SOURCES+=\
- pvrqwsdrawable.c \
- pvrqwswsegl.c
-
-INCLUDEPATH += $$QMAKE_INCDIR_EGL
-
-for(p, QMAKE_LIBDIR_EGL) {
- exists($$p):LIBS += -L$$p
-}
-
-LIBS += -lpvr2d
-
-DESTDIR = $$QMAKE_LIBDIR_QT
-target.path = $$[QT_INSTALL_LIBS]
-INSTALLS += target
-
-include(../powervr.pri) \ No newline at end of file
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
deleted file mode 100644
index 8dc0120fe1..0000000000
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
+++ /dev/null
@@ -1,830 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pvrqwsdrawable_p.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <linux/fb.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-PvrQwsDisplay pvrQwsDisplay;
-
-static void pvrQwsDestroyDrawableForced(PvrQwsDrawable *drawable);
-
-/* Initialize the /dev/fbN device for a specific screen */
-static int pvrQwsInitFbScreen(int screen)
-{
- struct fb_var_screeninfo var;
- struct fb_fix_screeninfo fix;
- unsigned long start;
- unsigned long length;
- int width, height, stride;
- PVR2DFORMAT format;
- void *mapped;
- int fd, bytesPerPixel;
- char name[64];
- PVR2DMEMINFO *memInfo;
- unsigned long pageAddresses[2];
-
- /* Bail out if already initialized, or the number is incorrect */
- if (screen < 0 || screen >= PVRQWS_MAX_SCREENS)
- return 0;
- if (pvrQwsDisplay.screens[screen].initialized)
- return 1;
-
- /* Open the framebuffer and fetch its properties */
- sprintf(name, "/dev/fb%d", screen);
- fd = open(name, O_RDWR, 0);
- if (fd < 0) {
- perror(name);
- return 0;
- }
- if (ioctl(fd, FBIOGET_VSCREENINFO, &var) < 0) {
- perror("FBIOGET_VSCREENINFO");
- close(fd);
- return 0;
- }
- if (ioctl(fd, FBIOGET_FSCREENINFO, &fix) < 0) {
- perror("FBIOGET_FSCREENINFO");
- close(fd);
- return 0;
- }
- width = var.xres;
- height = var.yres;
- bytesPerPixel = var.bits_per_pixel / 8;
- stride = fix.line_length;
- format = PVR2D_1BPP;
- if (var.bits_per_pixel == 16) {
- if (var.red.length == 5 && var.green.length == 6 &&
- var.blue.length == 5 && var.red.offset == 11 &&
- var.green.offset == 5 && var.blue.offset == 0) {
- format = PVR2D_RGB565;
- }
- if (var.red.length == 4 && var.green.length == 4 &&
- var.blue.length == 4 && var.transp.length == 4 &&
- var.red.offset == 8 && var.green.offset == 4 &&
- var.blue.offset == 0 && var.transp.offset == 12) {
- format = PVR2D_ARGB4444;
- }
- } else if (var.bits_per_pixel == 32) {
- if (var.red.length == 8 && var.green.length == 8 &&
- var.blue.length == 8 && var.transp.length == 8 &&
- var.red.offset == 16 && var.green.offset == 8 &&
- var.blue.offset == 0 && var.transp.offset == 24) {
- format = PVR2D_ARGB8888;
- }
- }
- if (format == PVR2D_1BPP) {
- fprintf(stderr, "%s: could not find a suitable PVR2D pixel format\n", name);
- close(fd);
- return 0;
- }
- start = fix.smem_start;
- length = var.xres_virtual * var.yres_virtual * bytesPerPixel;
-
- if (screen == 0) {
- /* We use PVR2DGetFrameBuffer to map the first screen.
- On some chipsets it is more reliable than using PVR2DMemWrap */
- mapped = 0;
- memInfo = 0;
- } else {
- /* Other screens: map the framebuffer region into memory */
- mapped = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (!mapped || mapped == (void *)(-1)) {
- perror("mmap");
- close(fd);
- return 0;
- }
-
- /* Allocate a PVR2D memory region for the framebuffer */
- memInfo = 0;
- if (pvrQwsDisplay.context) {
- pageAddresses[0] = start & 0xFFFFF000;
- pageAddresses[1] = 0;
- if (PVR2DMemWrap
- (pvrQwsDisplay.context, mapped, PVR2D_WRAPFLAG_CONTIGUOUS,
- length, pageAddresses, &memInfo) != PVR2D_OK) {
- munmap(mapped, length);
- close(fd);
- return 0;
- }
- }
- }
-
- /* We don't need the file descriptor any more */
- close(fd);
-
- /* The framebuffer is ready, so initialize the PvrQwsScreenInfo */
- pvrQwsDisplay.screens[screen].screenRect.x = 0;
- pvrQwsDisplay.screens[screen].screenRect.y = 0;
- pvrQwsDisplay.screens[screen].screenRect.width = width;
- pvrQwsDisplay.screens[screen].screenRect.height = height;
- pvrQwsDisplay.screens[screen].screenStride = stride;
- pvrQwsDisplay.screens[screen].pixelFormat = format;
- pvrQwsDisplay.screens[screen].bytesPerPixel = bytesPerPixel;
- pvrQwsDisplay.screens[screen].screenDrawable = 0;
- if (mapped) {
- /* Don't set these fields if mapped is 0, because PVR2DGetFrameBuffer
- may have already been called and set them */
- pvrQwsDisplay.screens[screen].frameBuffer = memInfo;
- pvrQwsDisplay.screens[screen].mapped = mapped;
- }
- pvrQwsDisplay.screens[screen].mappedLength = length;
- pvrQwsDisplay.screens[screen].screenStart = start;
- pvrQwsDisplay.screens[screen].needsUnmap = (mapped != 0);
- pvrQwsDisplay.screens[screen].initialized = 1;
- return 1;
-}
-
-/* Called when a new drawable is added to ensure that we have a
- PVR2D context and framebuffer PVR2DMEMINFO blocks */
-static int pvrQwsAddDrawable(void)
-{
- int numDevs, screen;
- PVR2DDEVICEINFO *devs;
- unsigned long devId;
- unsigned long pageAddresses[2];
- PVR2DMEMINFO *memInfo;
- PVR2DDISPLAYINFO displayInfo;
-
- /* Bail out early if this is not the first drawable */
- if (pvrQwsDisplay.numDrawables > 0) {
- ++(pvrQwsDisplay.numDrawables);
- return 1;
- }
-
- /* Find the first PVR2D device in the system and open it */
- numDevs = PVR2DEnumerateDevices(0);
- if (numDevs <= 0)
- return 0;
- devs = (PVR2DDEVICEINFO *)malloc(sizeof(PVR2DDEVICEINFO) * numDevs);
- if (!devs)
- return 0;
- if (PVR2DEnumerateDevices(devs) != PVR2D_OK) {
- free(devs);
- return 0;
- }
- devId = devs[0].ulDevID;
- free(devs);
- if (PVR2DCreateDeviceContext(devId, &pvrQwsDisplay.context, 0) != PVR2D_OK)
- return 0;
- pvrQwsDisplay.numFlipBuffers = 0;
- pvrQwsDisplay.flipChain = 0;
- if (PVR2DGetDeviceInfo(pvrQwsDisplay.context, &displayInfo) == PVR2D_OK) {
- if (displayInfo.ulMaxFlipChains > 0 && displayInfo.ulMaxBuffersInChain > 0)
- pvrQwsDisplay.numFlipBuffers = displayInfo.ulMaxBuffersInChain;
- if (pvrQwsDisplay.numFlipBuffers > PVRQWS_MAX_FLIP_BUFFERS)
- pvrQwsDisplay.numFlipBuffers = PVRQWS_MAX_FLIP_BUFFERS;
- }
-
- /* Create the PVR2DMEMINFO blocks for the active framebuffers */
- for (screen = 0; screen < PVRQWS_MAX_SCREENS; ++screen) {
- if (screen != 0 && pvrQwsDisplay.screens[screen].mapped) {
- pageAddresses[0]
- = pvrQwsDisplay.screens[screen].screenStart & 0xFFFFF000;
- pageAddresses[1] = 0;
- if (PVR2DMemWrap
- (pvrQwsDisplay.context,
- pvrQwsDisplay.screens[screen].mapped,
- PVR2D_WRAPFLAG_CONTIGUOUS,
- pvrQwsDisplay.screens[screen].mappedLength,
- pageAddresses, &memInfo) != PVR2D_OK) {
- PVR2DDestroyDeviceContext(pvrQwsDisplay.context);
- pvrQwsDisplay.context = 0;
- return 0;
- }
- pvrQwsDisplay.screens[screen].frameBuffer = memInfo;
- } else if (screen == 0) {
- if (PVR2DGetFrameBuffer
- (pvrQwsDisplay.context,
- PVR2D_FB_PRIMARY_SURFACE, &memInfo) != PVR2D_OK) {
- fprintf(stderr, "QWSWSEGL: could not get the primary framebuffer surface\n");
- PVR2DDestroyDeviceContext(pvrQwsDisplay.context);
- pvrQwsDisplay.context = 0;
- return 0;
- }
- pvrQwsDisplay.screens[screen].frameBuffer = memInfo;
- pvrQwsDisplay.screens[screen].mapped = memInfo->pBase;
- }
- }
-
- /* Create a flip chain for the screen if supported by the hardware */
- pvrQwsDisplay.usePresentBlit = 0;
- if (pvrQwsDisplay.numFlipBuffers > 0) {
- long stride = 0;
- unsigned long flipId = 0;
- unsigned long numBuffers;
- if (PVR2DCreateFlipChain(pvrQwsDisplay.context, 0,
- //PVR2D_CREATE_FLIPCHAIN_SHARED |
- //PVR2D_CREATE_FLIPCHAIN_QUERY,
- pvrQwsDisplay.numFlipBuffers,
- pvrQwsDisplay.screens[0].screenRect.width,
- pvrQwsDisplay.screens[0].screenRect.height,
- pvrQwsDisplay.screens[0].pixelFormat,
- &stride, &flipId, &(pvrQwsDisplay.flipChain))
- == PVR2D_OK) {
- pvrQwsDisplay.screens[0].screenStride = stride;
- PVR2DGetFlipChainBuffers(pvrQwsDisplay.context,
- pvrQwsDisplay.flipChain,
- &numBuffers,
- pvrQwsDisplay.flipBuffers);
- } else {
- pvrQwsDisplay.flipChain = 0;
- pvrQwsDisplay.numFlipBuffers = 0;
- }
-
- /* PVR2DPresentBlt is a little more reliable than PVR2DBlt
- when flip chains are present, even if we cannot create a
- flip chain at the moment */
- pvrQwsDisplay.usePresentBlit = 1;
- }
-
- /* The context is ready to go */
- ++(pvrQwsDisplay.numDrawables);
- return 1;
-}
-
-/* Called when the last drawable is destroyed. The PVR2D context
- will be destroyed but the raw framebuffer memory will stay mapped */
-static void pvrQwsDestroyContext(void)
-{
- int screen;
- for (screen = 0; screen < PVRQWS_MAX_SCREENS; ++screen) {
- if (pvrQwsDisplay.screens[screen].frameBuffer) {
- PVR2DMemFree
- (pvrQwsDisplay.context,
- pvrQwsDisplay.screens[screen].frameBuffer);
- pvrQwsDisplay.screens[screen].frameBuffer = 0;
- }
- }
-
- if (pvrQwsDisplay.numFlipBuffers > 0)
- PVR2DDestroyFlipChain(pvrQwsDisplay.context, pvrQwsDisplay.flipChain);
- PVR2DDestroyDeviceContext(pvrQwsDisplay.context);
- pvrQwsDisplay.context = 0;
- pvrQwsDisplay.flipChain = 0;
- pvrQwsDisplay.numFlipBuffers = 0;
- pvrQwsDisplay.usePresentBlit = 0;
-}
-
-int pvrQwsDisplayOpen(void)
-{
- int screen;
-
- /* If the display is already open, increase reference count and return */
- if (pvrQwsDisplay.refCount > 0) {
- ++(pvrQwsDisplay.refCount);
- return 1;
- }
-
- /* Open the framebuffer and map it directly */
- if (!pvrQwsInitFbScreen(0)) {
- --(pvrQwsDisplay.refCount);
- return 0;
- }
-
- /* Clear the other screens. We will create them if they are referenced */
- for (screen = 1; screen < PVRQWS_MAX_SCREENS; ++screen)
- memset(&(pvrQwsDisplay.screens[screen]), 0, sizeof(PvrQwsScreenInfo));
-
- /* The display is open and ready */
- ++(pvrQwsDisplay.refCount);
- return 1;
-}
-
-void pvrQwsDisplayClose(void)
-{
- int screen;
-
- if (pvrQwsDisplay.refCount == 0)
- return;
- if (--(pvrQwsDisplay.refCount) > 0)
- return;
-
- /* Prevent pvrQwsDestroyContext from being called for the time being */
- ++pvrQwsDisplay.numDrawables;
-
- /* Free the screens */
- for (screen = 0; screen < PVRQWS_MAX_SCREENS; ++screen) {
- PvrQwsScreenInfo *info = &(pvrQwsDisplay.screens[screen]);
- if (info->screenDrawable)
- pvrQwsDestroyDrawableForced(info->screenDrawable);
- if (info->frameBuffer)
- PVR2DMemFree(pvrQwsDisplay.context, info->frameBuffer);
- if (info->mapped && info->needsUnmap)
- munmap(info->mapped, info->mappedLength);
- }
-
- /* Now it is safe to destroy the PVR2D context */
- --pvrQwsDisplay.numDrawables;
- if (pvrQwsDisplay.context)
- PVR2DDestroyDeviceContext(pvrQwsDisplay.context);
-
- memset(&pvrQwsDisplay, 0, sizeof(pvrQwsDisplay));
-}
-
-int pvrQwsDisplayIsOpen(void)
-{
- return (pvrQwsDisplay.refCount > 0);
-}
-
-/* Ensure that a specific screen has been initialized */
-static int pvrQwsEnsureScreen(int screen)
-{
- if (screen < 0 || screen >= PVRQWS_MAX_SCREENS)
- return 0;
- if (!screen)
- return 1;
- return pvrQwsInitFbScreen(screen);
-}
-
-PvrQwsDrawable *pvrQwsScreenWindow(int screen)
-{
- PvrQwsDrawable *drawable;
-
- if (!pvrQwsEnsureScreen(screen))
- return 0;
-
- drawable = pvrQwsDisplay.screens[screen].screenDrawable;
- if (drawable)
- return drawable;
-
- drawable = (PvrQwsDrawable *)calloc(1, sizeof(PvrQwsDrawable));
- if (!drawable)
- return 0;
-
- drawable->type = PvrQwsScreen;
- drawable->screen = screen;
- drawable->pixelFormat = pvrQwsDisplay.screens[screen].pixelFormat;
- drawable->rect = pvrQwsDisplay.screens[screen].screenRect;
- drawable->visibleRects[0] = drawable->rect;
- drawable->numVisibleRects = 1;
- drawable->isFullScreen = 1;
-
- if (!pvrQwsAddDrawable()) {
- free(drawable);
- return 0;
- }
-
- pvrQwsDisplay.screens[screen].screenDrawable = drawable;
-
- return drawable;
-}
-
-PvrQwsDrawable *pvrQwsCreateWindow(int screen, long winId, const PvrQwsRect *rect)
-{
- PvrQwsDrawable *drawable;
-
- if (!pvrQwsEnsureScreen(screen))
- return 0;
-
- drawable = (PvrQwsDrawable *)calloc(1, sizeof(PvrQwsDrawable));
- if (!drawable)
- return 0;
-
- drawable->type = PvrQwsWindow;
- drawable->winId = winId;
- drawable->refCount = 1;
- drawable->screen = screen;
- drawable->pixelFormat = pvrQwsDisplay.screens[screen].pixelFormat;
- drawable->rect = *rect;
-
- if (!pvrQwsAddDrawable()) {
- free(drawable);
- return 0;
- }
-
- drawable->nextWinId = pvrQwsDisplay.firstWinId;
- pvrQwsDisplay.firstWinId = drawable;
-
- return drawable;
-}
-
-PvrQwsDrawable *pvrQwsFetchWindow(long winId)
-{
- PvrQwsDrawable *drawable = pvrQwsDisplay.firstWinId;
- while (drawable != 0 && drawable->winId != winId)
- drawable = drawable->nextWinId;
-
- if (drawable)
- ++(drawable->refCount);
- return drawable;
-}
-
-int pvrQwsReleaseWindow(PvrQwsDrawable *drawable)
-{
- if (drawable->type == PvrQwsWindow)
- return (--(drawable->refCount) <= 0);
- else
- return 0;
-}
-
-PvrQwsDrawable *pvrQwsCreatePixmap(int width, int height, int screen)
-{
- PvrQwsDrawable *drawable;
-
- if (!pvrQwsEnsureScreen(screen))
- return 0;
-
- drawable = (PvrQwsDrawable *)calloc(1, sizeof(PvrQwsDrawable));
- if (!drawable)
- return 0;
-
- drawable->type = PvrQwsPixmap;
- drawable->screen = screen;
- drawable->pixelFormat = pvrQwsDisplay.screens[screen].pixelFormat;
- drawable->rect.x = 0;
- drawable->rect.y = 0;
- drawable->rect.width = width;
- drawable->rect.height = height;
-
- if (!pvrQwsAddDrawable()) {
- free(drawable);
- return 0;
- }
-
- return drawable;
-}
-
-static void pvrQwsDestroyDrawableForced(PvrQwsDrawable *drawable)
-{
- /* Remove the drawable from the display's winId list */
- PvrQwsDrawable *current = pvrQwsDisplay.firstWinId;
- PvrQwsDrawable *prev = 0;
- while (current != 0 && current != drawable) {
- prev = current;
- current = current->nextWinId;
- }
- if (current != 0) {
- if (prev)
- prev->nextWinId = current->nextWinId;
- else
- pvrQwsDisplay.firstWinId = current->nextWinId;
- }
-
- pvrQwsFreeBuffers(drawable);
- free(drawable);
-
- --pvrQwsDisplay.numDrawables;
- if (pvrQwsDisplay.numDrawables == 0)
- pvrQwsDestroyContext();
-}
-
-void pvrQwsDestroyDrawable(PvrQwsDrawable *drawable)
-{
- if (drawable && drawable->type != PvrQwsScreen)
- pvrQwsDestroyDrawableForced(drawable);
-}
-
-PvrQwsDrawableType pvrQwsGetDrawableType(PvrQwsDrawable *drawable)
-{
- return drawable->type;
-}
-
-void pvrQwsSetVisibleRegion
- (PvrQwsDrawable *drawable, const PvrQwsRect *rects, int numRects)
-{
- int index, indexOut;
- PvrQwsRect *rect;
- PvrQwsRect *screenRect;
-
- /* Visible regions don't make sense for pixmaps */
- if (drawable->type == PvrQwsPixmap)
- return;
-
- /* Restrict the number of rectangles to prevent buffer overflow */
- if (numRects > PVRQWS_MAX_VISIBLE_RECTS)
- numRects = PVRQWS_MAX_VISIBLE_RECTS;
- if (numRects > 0)
- memcpy(drawable->visibleRects, rects, numRects * sizeof(PvrQwsRect));
-
- /* Convert the rectangles into screen-relative co-ordinates and
- then clamp them to the screen boundaries. If any of the
- clamped rectangles are empty, remove them from the list */
- screenRect = &(pvrQwsDisplay.screens[drawable->screen].screenRect);
- indexOut = 0;
- for (index = 0, rect = drawable->visibleRects; index < numRects; ++index, ++rect) {
- if (rect->x < 0) {
- rect->width += rect->x;
- rect->x = 0;
- if (rect->width < 0)
- rect->width = 0;
- } else if (rect->x >= screenRect->width) {
- rect->x = screenRect->width;
- rect->width = 0;
- }
- if ((rect->x + rect->width) > screenRect->width) {
- rect->width = screenRect->width - rect->x;
- }
- if (rect->y < 0) {
- rect->height += rect->y;
- rect->y = 0;
- if (rect->height < 0)
- rect->height = 0;
- } else if (rect->y >= screenRect->height) {
- rect->y = screenRect->height;
- rect->height = 0;
- }
- if ((rect->y + rect->height) > screenRect->height) {
- rect->height = screenRect->height - rect->y;
- }
- if (rect->width > 0 && rect->height > 0) {
- if (index != indexOut)
- drawable->visibleRects[indexOut] = *rect;
- ++indexOut;
- }
- }
- drawable->numVisibleRects = indexOut;
-}
-
-void pvrQwsClearVisibleRegion(PvrQwsDrawable *drawable)
-{
- if (drawable->type != PvrQwsPixmap)
- drawable->numVisibleRects = 0;
-}
-
-void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect)
-{
- /* We can only change the geometry of window drawables */
- if (drawable->type != PvrQwsWindow)
- return;
-
- /* If the position has changed, then clear the visible region */
- if (drawable->rect.x != rect->x || drawable->rect.y != rect->y) {
- drawable->rect.x = rect->x;
- drawable->rect.y = rect->y;
- drawable->numVisibleRects = 0;
- }
-
- /* If the size has changed, then clear the visible region and
- invalidate the drawable's buffers. Invalidating the buffers
- will force EGL to recreate the drawable, which will then
- allocate new buffers for the new size */
- if (drawable->rect.width != rect->width ||
- drawable->rect.height != rect->height) {
- drawable->rect.width = rect->width;
- drawable->rect.height = rect->height;
- drawable->numVisibleRects = 0;
- pvrQwsInvalidateBuffers(drawable);
- }
-}
-
-void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect)
-{
- *rect = drawable->rect;
-}
-
-void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle)
-{
- if (drawable->rotationAngle != angle) {
- drawable->rotationAngle = angle;
-
- /* Force the buffers to be recreated if the rotation angle changes */
- pvrQwsInvalidateBuffers(drawable);
- }
-}
-
-int pvrQwsGetStride(PvrQwsDrawable *drawable)
-{
- if (drawable->backBuffersValid)
- return drawable->strideBytes;
- else
- return 0;
-}
-
-PvrQwsPixelFormat pvrQwsGetPixelFormat(PvrQwsDrawable *drawable)
-{
- return (PvrQwsPixelFormat)(drawable->pixelFormat);
-}
-
-void *pvrQwsGetRenderBuffer(PvrQwsDrawable *drawable)
-{
- if (drawable->backBuffersValid)
- return drawable->backBuffers[drawable->currentBackBuffer]->pBase;
- else
- return 0;
-}
-
-int pvrQwsAllocBuffers(PvrQwsDrawable *drawable)
-{
- int index;
- int numBuffers = PVRQWS_MAX_BACK_BUFFERS;
- if (drawable->type == PvrQwsPixmap)
- numBuffers = 1;
- if (drawable->backBuffers[0]) {
- if (drawable->backBuffersValid)
- return 1;
- if (!drawable->usingFlipBuffers) {
- for (index = 0; index < numBuffers; ++index)
- PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]);
- }
- }
- drawable->stridePixels = (drawable->rect.width + 31) & ~31;
- drawable->strideBytes =
- drawable->stridePixels *
- pvrQwsDisplay.screens[drawable->screen].bytesPerPixel;
- drawable->usingFlipBuffers =
- (pvrQwsDisplay.numFlipBuffers > 0 && drawable->isFullScreen);
- if (drawable->usingFlipBuffers) {
- if (numBuffers > (int)(pvrQwsDisplay.numFlipBuffers))
- numBuffers = pvrQwsDisplay.numFlipBuffers;
- for (index = 0; index < numBuffers; ++index)
- drawable->backBuffers[index] = pvrQwsDisplay.flipBuffers[index];
- } else {
- for (index = 0; index < numBuffers; ++index) {
- if (PVR2DMemAlloc(pvrQwsDisplay.context,
- drawable->strideBytes * drawable->rect.height,
- 128, 0,
- &(drawable->backBuffers[index])) != PVR2D_OK) {
- while (--index >= 0)
- PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]);
- memset(drawable->backBuffers, 0, sizeof(drawable->backBuffers));
- drawable->backBuffersValid = 0;
- return 0;
- }
- }
- }
- for (index = numBuffers; index < PVRQWS_MAX_BACK_BUFFERS; ++index) {
- drawable->backBuffers[index] = drawable->backBuffers[0];
- }
- drawable->backBuffersValid = 1;
- drawable->currentBackBuffer = 0;
- return 1;
-}
-
-void pvrQwsFreeBuffers(PvrQwsDrawable *drawable)
-{
- int index;
- int numBuffers = PVRQWS_MAX_BACK_BUFFERS;
- if (drawable->type == PvrQwsPixmap)
- numBuffers = 1;
- if (!drawable->usingFlipBuffers) {
- for (index = 0; index < numBuffers; ++index) {
- if (drawable->backBuffers[index])
- PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]);
- }
- }
- memset(drawable->backBuffers, 0, sizeof(drawable->backBuffers));
- drawable->backBuffersValid = 0;
- drawable->usingFlipBuffers = 0;
-}
-
-void pvrQwsInvalidateBuffers(PvrQwsDrawable *drawable)
-{
- drawable->backBuffersValid = 0;
-}
-
-int pvrQwsGetBuffers
- (PvrQwsDrawable *drawable, PVR2DMEMINFO **source, PVR2DMEMINFO **render)
-{
- if (!drawable->backBuffersValid)
- return 0;
- *render = drawable->backBuffers[drawable->currentBackBuffer];
- *source = drawable->backBuffers
- [(drawable->currentBackBuffer + PVRQWS_MAX_BACK_BUFFERS - 1) %
- PVRQWS_MAX_BACK_BUFFERS];
- return 1;
-}
-
-int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly)
-{
- PVR2DMEMINFO *buffer;
- PvrQwsRect *rect;
- int index;
-
- /* Bail out if the back buffers have been invalidated */
- if (!drawable->backBuffersValid)
- return 0;
-
- /* If there is a swap function, then use that instead */
- if (drawable->swapFunction) {
- (*(drawable->swapFunction))(drawable, drawable->userData, repaintOnly);
- if (!repaintOnly) {
- drawable->currentBackBuffer
- = (drawable->currentBackBuffer + 1) % PVRQWS_MAX_BACK_BUFFERS;
- }
- return 1;
- }
-
- /* Iterate through the visible rectangles and blit them to the screen */
- if (!repaintOnly) {
- index = drawable->currentBackBuffer;
- } else {
- index = (drawable->currentBackBuffer + PVRQWS_MAX_BACK_BUFFERS - 1)
- % PVRQWS_MAX_BACK_BUFFERS;
- }
- buffer = drawable->backBuffers[index];
- rect = drawable->visibleRects;
- if (drawable->usingFlipBuffers) {
- PVR2DPresentFlip(pvrQwsDisplay.context, pvrQwsDisplay.flipChain, buffer, 0);
- } else if (pvrQwsDisplay.usePresentBlit && drawable->numVisibleRects > 0) {
- PVR2DRECT pvrRects[PVRQWS_MAX_VISIBLE_RECTS];
- for (index = 0; index < drawable->numVisibleRects; ++index, ++rect) {
- pvrRects[index].left = rect->x;
- pvrRects[index].top = rect->y;
- pvrRects[index].right = rect->x + rect->width;
- pvrRects[index].bottom = rect->y + rect->height;
- }
- for (index = 0; index < drawable->numVisibleRects; index += 4) {
- int numClip = drawable->numVisibleRects - index;
- if (numClip > 4) /* No more than 4 clip rects at a time */
- numClip = 4;
- PVR2DSetPresentBltProperties
- (pvrQwsDisplay.context,
- PVR2D_PRESENT_PROPERTY_SRCSTRIDE |
- PVR2D_PRESENT_PROPERTY_DSTSIZE |
- PVR2D_PRESENT_PROPERTY_DSTPOS |
- PVR2D_PRESENT_PROPERTY_CLIPRECTS,
- drawable->strideBytes,
- drawable->rect.width, drawable->rect.height,
- drawable->rect.x, drawable->rect.y,
- numClip, pvrRects + index, 0);
- PVR2DPresentBlt(pvrQwsDisplay.context, buffer, 0);
- }
- PVR2DQueryBlitsComplete(pvrQwsDisplay.context, buffer, 1);
- } else {
- /* TODO: use PVR2DBltClipped for faster transfers of clipped windows */
- PVR2DBLTINFO blit;
- for (index = 0; index < drawable->numVisibleRects; ++index, ++rect) {
- memset(&blit, 0, sizeof(blit));
-
- blit.CopyCode = PVR2DROPcopy;
- blit.BlitFlags = PVR2D_BLIT_DISABLE_ALL;
-
- blit.pSrcMemInfo = buffer;
- blit.SrcStride = drawable->strideBytes;
- blit.SrcX = rect->x - drawable->rect.x;
- blit.SrcY = rect->y - drawable->rect.y;
- blit.SizeX = rect->width;
- blit.SizeY = rect->height;
- blit.SrcFormat = drawable->pixelFormat;
-
- blit.pDstMemInfo = pvrQwsDisplay.screens[drawable->screen].frameBuffer;
- blit.DstStride = pvrQwsDisplay.screens[drawable->screen].screenStride;
- blit.DstX = rect->x;
- blit.DstY = rect->y;
- blit.DSizeX = rect->width;
- blit.DSizeY = rect->height;
- blit.DstFormat = pvrQwsDisplay.screens[drawable->screen].pixelFormat;
-
- PVR2DBlt(pvrQwsDisplay.context, &blit);
- }
- }
-
- /* Swap the buffers */
- if (!repaintOnly) {
- drawable->currentBackBuffer
- = (drawable->currentBackBuffer + 1) % PVRQWS_MAX_BACK_BUFFERS;
- }
- return 1;
-}
-
-void pvrQwsSetSwapFunction
- (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData)
-{
- drawable->swapFunction = func;
- drawable->userData = userData;
-}
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
deleted file mode 100644
index 8c8cc27018..0000000000
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PVRQWSDRAWABLE_H
-#define PVRQWSDRAWABLE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- int x, y, width, height;
-} PvrQwsRect;
-
-typedef enum
-{
- PvrQwsScreen,
- PvrQwsWindow,
- PvrQwsPixmap
-
-} PvrQwsDrawableType;
-
-typedef enum
-{
- PvrQws_1BPP = 0,
- PvrQws_RGB565,
- PvrQws_ARGB4444,
- PvrQws_RGB888,
- PvrQws_ARGB8888,
- PvrQws_VGAEMU
-
-} PvrQwsPixelFormat;
-
-typedef struct _PvrQwsDrawable PvrQwsDrawable;
-
-typedef void (*PvrQwsSwapFunction)
- (PvrQwsDrawable *drawable, void *userData, int repaintOnly);
-
-/* Open the display and prepare for window operations. The display
- can be opened multiple times and each time is reference counted.
- The display will be finally closed when the same number of
- calls to pvrQwsDisplayClose() have been encountered */
-int pvrQwsDisplayOpen(void);
-
-/* Close the display */
-void pvrQwsDisplayClose(void);
-
-/* Determine if the display is already open */
-int pvrQwsDisplayIsOpen(void);
-
-/* Create a window that represents a particular framebuffer screen.
- Initially the visible region will be the whole screen. If the screen
- window has already been created, then will return the same value */
-PvrQwsDrawable *pvrQwsScreenWindow(int screen);
-
-/* Create a top-level window on a particular framebuffer screen.
- Initially the window will not have a visible region */
-PvrQwsDrawable *pvrQwsCreateWindow(int screen, long winId, const PvrQwsRect *rect);
-
-/* Fetch an existing window for a window id and increase its refcount */
-PvrQwsDrawable *pvrQwsFetchWindow(long winId);
-
-/* Release the refcount on a window. Returns 1 if refcount is zero */
-int pvrQwsReleaseWindow(PvrQwsDrawable *drawable);
-
-/* Create an off-screen pixmap */
-PvrQwsDrawable *pvrQwsCreatePixmap(int width, int height, int screen);
-
-/* Destroy a previously-created drawable. Will not destroy screens. */
-void pvrQwsDestroyDrawable(PvrQwsDrawable *drawable);
-
-/* Get a drawable's type */
-PvrQwsDrawableType pvrQwsGetDrawableType(PvrQwsDrawable *drawable);
-
-/* Sets the visible region for a window or screen drawable. Pixels within
- the specified rectangles will be copied to the framebuffer when the window
- or screen is swapped. The rectangles should be in global co-ordinates */
-void pvrQwsSetVisibleRegion
- (PvrQwsDrawable *drawable, const PvrQwsRect *rects, int numRects);
-
-/* Clear the visible region for a window or screen drawable,
- effectively removing it from the screen */
-void pvrQwsClearVisibleRegion(PvrQwsDrawable *drawable);
-
-/* Set the geometry for a drawable. This can only be used on windows */
-void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect);
-
-/* Get the current geometry for a drawable */
-void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect);
-
-/* Set the rotation angle in degrees */
-void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle);
-
-/* Get the line stride for a drawable. Returns zero if the buffers
- are not allocated or have been invalidated */
-int pvrQwsGetStride(PvrQwsDrawable *drawable);
-
-/* Get the pixel format for a drawable */
-PvrQwsPixelFormat pvrQwsGetPixelFormat(PvrQwsDrawable *drawable);
-
-/* Get a pointer to the beginning of a drawable's current render buffer.
- Returns null if the buffers are not allocated or have been invalidated */
-void *pvrQwsGetRenderBuffer(PvrQwsDrawable *drawable);
-
-/* Allocate the buffers associated with a drawable. We allocate one buffer
- for pixmaps, and several for windows and screens */
-int pvrQwsAllocBuffers(PvrQwsDrawable *drawable);
-
-/* Free the buffers associated with a drawable */
-void pvrQwsFreeBuffers(PvrQwsDrawable *drawable);
-
-/* Invalidate the buffers associated with a drawable. The buffers will
- still be allocated but the next attempt to swap the buffers will fail */
-void pvrQwsInvalidateBuffers(PvrQwsDrawable *drawable);
-
-/* Swap the back buffers for a window or screen and copy to the framebuffer */
-int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly);
-
-/* Set the swap function for a drawable. When pvrQwsSwapBuffers()
- is called on the drawable, the supplied function will be called
- instead of copying the drawable contents to the screen. This allows
- higher-level compositors to know when a drawable has changed.
- The swap function can be set to null to return to normal processing */
-void pvrQwsSetSwapFunction
- (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
deleted file mode 100644
index 3ad0693e02..0000000000
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PVRQWSDRAWABLE_P_H
-#define PVRQWSDRAWABLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// reasons. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <pvr2d.h>
-#include "pvrqwsdrawable.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define PVRQWS_MAX_VISIBLE_RECTS 32
-#define PVRQWS_MAX_SCREENS 1
-#define PVRQWS_MAX_BACK_BUFFERS 2
-#define PVRQWS_MAX_FLIP_BUFFERS 2
-
-typedef struct {
-
- PvrQwsRect screenRect;
- int screenStride;
- PVR2DFORMAT pixelFormat;
- int bytesPerPixel;
- PVR2DMEMINFO *frameBuffer;
- PvrQwsDrawable *screenDrawable;
- void *mapped;
- int mappedLength;
- unsigned long screenStart;
- int needsUnmap;
- int initialized;
-
-} PvrQwsScreenInfo;
-
-typedef struct {
-
- int refCount;
- PvrQwsScreenInfo screens[PVRQWS_MAX_SCREENS];
- PVR2DCONTEXTHANDLE context;
- int numDrawables;
- unsigned long numFlipBuffers;
- PVR2DFLIPCHAINHANDLE flipChain;
- PVR2DMEMINFO *flipBuffers[PVRQWS_MAX_FLIP_BUFFERS];
- int usePresentBlit;
- PvrQwsDrawable *firstWinId;
-
-} PvrQwsDisplay;
-
-extern PvrQwsDisplay pvrQwsDisplay;
-
-struct _PvrQwsDrawable
-{
- PvrQwsDrawableType type;
- long winId;
- int refCount;
- PvrQwsRect rect;
- int screen;
- PVR2DFORMAT pixelFormat;
- PvrQwsRect visibleRects[PVRQWS_MAX_VISIBLE_RECTS];
- int numVisibleRects;
- PVR2DMEMINFO *backBuffers[PVRQWS_MAX_BACK_BUFFERS];
- int currentBackBuffer;
- int backBuffersValid;
- int usingFlipBuffers;
- int isFullScreen;
- int strideBytes;
- int stridePixels;
- int rotationAngle;
- PvrQwsSwapFunction swapFunction;
- void *userData;
- PvrQwsDrawable *nextWinId;
-
-};
-
-/* Get the current source and render buffers for a drawable */
-int pvrQwsGetBuffers
- (PvrQwsDrawable *drawable, PVR2DMEMINFO **source, PVR2DMEMINFO **render);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
deleted file mode 100644
index f861838e90..0000000000
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <GLES/eglplatform.h>
-#include <wsegl.h>
-#include <pvr2d.h>
-#include <string.h>
-#include <sys/mman.h>
-#include "pvrqwsdrawable_p.h"
-
-#define WSEGL_UNUSED(x) (void)x;
-
-// If the PVR2D version is not specified, then assume MBX-style headers.
-// If the version is defined, then we assume that we have SGX-style headers.
-#if !defined(PVR2D_REV_MAJOR)
-#define WSEGL_CAP_WINDOWS_USE_HW_SYNC WSEGL_CAP_WINDOWS_USE_MBX_SYNC
-#define WSEGL_CAP_PIXMAPS_USE_HW_SYNC WSEGL_CAP_PIXMAPS_USE_MBX_SYNC
-#endif
-
-/* Capability information for the display */
-static WSEGLCaps const wseglDisplayCaps[] = {
- {WSEGL_CAP_WINDOWS_USE_HW_SYNC, 1},
- {WSEGL_CAP_PIXMAPS_USE_HW_SYNC, 1},
- {WSEGL_NO_CAPS, 0}
-};
-
-/* Configuration information for the display */
-static WSEGLConfig wseglDisplayConfigs[] = {
- {WSEGL_DRAWABLE_WINDOW, WSEGL_PIXELFORMAT_565, WSEGL_FALSE,
- 0, 0, 0, WSEGL_OPAQUE, 0},
- {WSEGL_DRAWABLE_PIXMAP, WSEGL_PIXELFORMAT_565, WSEGL_FALSE,
- 0, 0, 0, WSEGL_OPAQUE, 0},
- {WSEGL_NO_DRAWABLE, 0, 0, 0, 0, 0, 0, 0}
-};
-
-/* Determine if nativeDisplay is a valid display handle */
-static WSEGLError wseglIsDisplayValid(NativeDisplayType nativeDisplay)
-{
- /* We only have the default display in this system */
- if (nativeDisplay == WSEGL_DEFAULT_DISPLAY)
- return WSEGL_SUCCESS;
- else
- return WSEGL_BAD_NATIVE_DISPLAY;
-}
-
-/* Initialize a native display for use with WSEGL */
-static WSEGLError wseglInitializeDisplay
- (NativeDisplayType nativeDisplay, WSEGLDisplayHandle *display,
- const WSEGLCaps **caps, WSEGLConfig **configs)
-{
- WSEGLPixelFormat pixelFormat;
-
- /* Bail out if the native display is incorrect */
- if (nativeDisplay != WSEGL_DEFAULT_DISPLAY)
- return WSEGL_CANNOT_INITIALISE;
-
- /* Open the PVR/QWS display, which will initialize the framebuffer */
- if (!pvrQwsDisplayOpen())
- return WSEGL_CANNOT_INITIALISE;
-
- /* Convert the PVR2D pixel format into a WSEGL pixel format */
- switch (pvrQwsDisplay.screens[0].pixelFormat) {
- case PVR2D_RGB565:
- pixelFormat = WSEGL_PIXELFORMAT_565;
- break;
-
- case PVR2D_ARGB4444:
- pixelFormat = WSEGL_PIXELFORMAT_4444;
- break;
-
- case PVR2D_ARGB8888:
- pixelFormat = WSEGL_PIXELFORMAT_8888;
- break;
-
- default:
- pvrQwsDisplayClose();
- return WSEGL_CANNOT_INITIALISE;
- }
- wseglDisplayConfigs[0].ePixelFormat = pixelFormat;
- wseglDisplayConfigs[1].ePixelFormat = pixelFormat;
-
- /* The display has been initialized */
- *display = (WSEGLDisplayHandle)&pvrQwsDisplay;
- *caps = wseglDisplayCaps;
- *configs = wseglDisplayConfigs;
- return WSEGL_SUCCESS;
-}
-
-/* Close the WSEGL display */
-static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display)
-{
- if (display == (WSEGLDisplayHandle)&pvrQwsDisplay)
- pvrQwsDisplayClose();
- return WSEGL_SUCCESS;
-}
-
-static WSEGLRotationAngle wseglRotationValue(int degrees)
-{
- switch (degrees) {
- case 90: return WSEGL_ROTATE_90;
- case 180: return WSEGL_ROTATE_180;
- case 270: return WSEGL_ROTATE_270;
- default: return WSEGL_ROTATE_0;
- }
-}
-
-/* Create the WSEGL drawable version of a native window */
-static WSEGLError wseglCreateWindowDrawable
- (WSEGLDisplayHandle display, WSEGLConfig *config,
- WSEGLDrawableHandle *drawable, NativeWindowType nativeWindow,
- WSEGLRotationAngle *rotationAngle)
-{
- PvrQwsDrawable *draw;
-
- WSEGL_UNUSED(display);
- WSEGL_UNUSED(config);
-
- /* Check for special handles that indicate framebuffer screens */
- if (nativeWindow >= (NativeWindowType)0 &&
- nativeWindow < (NativeWindowType)PVRQWS_MAX_SCREENS) {
- PvrQwsDrawable *screen = pvrQwsScreenWindow((int)nativeWindow);
- if (!screen)
- return WSEGL_OUT_OF_MEMORY;
- *drawable = (WSEGLDrawableHandle)screen;
- if (!pvrQwsAllocBuffers(screen))
- return WSEGL_OUT_OF_MEMORY;
- *rotationAngle = wseglRotationValue(screen->rotationAngle);
- return WSEGL_SUCCESS;
- }
-
- /* The native window is the winId - fetch the underlying drawable */
- draw = pvrQwsFetchWindow((long)nativeWindow);
- if (!draw)
- return WSEGL_BAD_DRAWABLE;
-
- /* The drawable is ready to go */
- *drawable = (WSEGLDrawableHandle)draw;
- *rotationAngle = wseglRotationValue(draw->rotationAngle);
- if (!pvrQwsAllocBuffers(draw))
- return WSEGL_OUT_OF_MEMORY;
- return WSEGL_SUCCESS;
-}
-
-/* Create the WSEGL drawable version of a native pixmap */
-static WSEGLError wseglCreatePixmapDrawable
- (WSEGLDisplayHandle display, WSEGLConfig *config,
- WSEGLDrawableHandle *drawable, NativePixmapType nativePixmap,
- WSEGLRotationAngle *rotationAngle)
-{
- WSEGL_UNUSED(display);
- WSEGL_UNUSED(config);
- if (!nativePixmap)
- return WSEGL_BAD_NATIVE_PIXMAP;
- if (!pvrQwsAllocBuffers((PvrQwsDrawable *)nativePixmap))
- return WSEGL_OUT_OF_MEMORY;
- *drawable = (WSEGLDrawableHandle)nativePixmap;
- *rotationAngle = WSEGL_ROTATE_0;
- return WSEGL_SUCCESS;
-}
-
-/* Delete a specific drawable */
-static WSEGLError wseglDeleteDrawable(WSEGLDrawableHandle _drawable)
-{
- PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable;
- if (!drawable || drawable->type == PvrQwsScreen)
- return WSEGL_SUCCESS;
- if (pvrQwsDisplay.numFlipBuffers == 0)
- pvrQwsFreeBuffers(drawable);
- if (pvrQwsReleaseWindow(drawable))
- pvrQwsDestroyDrawable(drawable);
- return WSEGL_SUCCESS;
-}
-
-/* Swap the contents of a drawable to the screen */
-static WSEGLError wseglSwapDrawable
- (WSEGLDrawableHandle _drawable, unsigned long data)
-{
- WSEGL_UNUSED(data);
- PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable;
- if (drawable->type != PvrQwsPixmap && !pvrQwsSwapBuffers(drawable, 0))
- return WSEGL_BAD_DRAWABLE;
- else
- return WSEGL_SUCCESS;
-}
-
-/* Set the swap interval of a window drawable */
-static WSEGLError wseglSwapControlInterval
- (WSEGLDrawableHandle drawable, unsigned long interval)
-{
- WSEGL_UNUSED(drawable);
- if (pvrQwsDisplay.flipChain) {
- PVR2DSetPresentFlipProperties
- (pvrQwsDisplay.context, pvrQwsDisplay.flipChain,
- PVR2D_PRESENT_PROPERTY_INTERVAL, 0, 0, 0, NULL, interval);
- }
- return WSEGL_SUCCESS;
-}
-
-/* Flush native rendering requests on a drawable */
-static WSEGLError wseglWaitNative
- (WSEGLDrawableHandle drawable, unsigned long engine)
-{
- WSEGL_UNUSED(drawable);
- if (engine == WSEGL_DEFAULT_NATIVE_ENGINE)
- return WSEGL_SUCCESS;
- else
- return WSEGL_BAD_NATIVE_ENGINE;
-}
-
-/* Copy color data from a drawable to a native pixmap */
-static WSEGLError wseglCopyFromDrawable
- (WSEGLDrawableHandle _drawable, NativePixmapType nativePixmap)
-{
- PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable;
- PvrQwsDrawable *pixmap = (PvrQwsDrawable *)nativePixmap;
- PVR2DBLTINFO blit;
-
- if (!drawable || !drawable->backBuffersValid)
- return WSEGL_BAD_NATIVE_WINDOW;
- if (!pixmap || !pixmap->backBuffersValid)
- return WSEGL_BAD_NATIVE_PIXMAP;
-
- memset(&blit, 0, sizeof(blit));
-
- blit.CopyCode = PVR2DROPcopy;
- blit.BlitFlags = PVR2D_BLIT_DISABLE_ALL;
-
- blit.pSrcMemInfo = drawable->backBuffers[drawable->currentBackBuffer];
- blit.SrcStride = drawable->strideBytes;
- blit.SrcX = 0;
- blit.SrcY = 0;
- blit.SizeX = drawable->rect.width;
- blit.SizeY = drawable->rect.height;
- blit.SrcFormat = drawable->pixelFormat;
-
- blit.pDstMemInfo = pixmap->backBuffers[pixmap->currentBackBuffer];
- blit.DstStride = pixmap->strideBytes;
- blit.DstX = 0;
- blit.DstY = 0;
- blit.DSizeX = pixmap->rect.width;
- blit.DSizeY = pixmap->rect.height;
- blit.DstFormat = pixmap->pixelFormat;
-
- PVR2DBlt(pvrQwsDisplay.context, &blit);
- PVR2DQueryBlitsComplete
- (pvrQwsDisplay.context, pixmap->backBuffers[pixmap->currentBackBuffer], 1);
-
- return WSEGL_SUCCESS;
-}
-
-/* Copy color data from a PBuffer to a native pixmap */
-static WSEGLError wseglCopyFromPBuffer
- (void *address, unsigned long width, unsigned long height,
- unsigned long stride, WSEGLPixelFormat format,
- NativePixmapType nativePixmap)
-{
- PvrQwsDrawable *pixmap = (PvrQwsDrawable *)nativePixmap;
- PVR2DFORMAT pixelFormat;
-
- if (!pixmap)
- return WSEGL_BAD_NATIVE_PIXMAP;
-
- /* We can only copy under certain conditions */
- switch (format) {
- case WSEGL_PIXELFORMAT_565:
- pixelFormat = PVR2D_RGB565; break;
- case WSEGL_PIXELFORMAT_4444:
- pixelFormat = PVR2D_ARGB4444; break;
- case WSEGL_PIXELFORMAT_8888:
- pixelFormat = PVR2D_ARGB8888; break;
- default:
- return WSEGL_BAD_CONFIG;
- }
- if (width > (unsigned long)(pixmap->rect.width) ||
- height > (unsigned long)(pixmap->rect.height) ||
- pixelFormat != pixmap->pixelFormat) {
- return WSEGL_BAD_CONFIG;
- }
-
- /* We'd like to use PVR2DBlt to do this, but there is no easy way
- to map the virtual "address" into physical space to be able
- to use the hardware assist. Use memcpy to do the work instead.
- Note: PBuffer's are upside down, so we copy from the bottom up */
- char *srcaddr = (char *)address;
- char *dstaddr = (char *)(pixmap->backBuffers[pixmap->currentBackBuffer]->pBase);
- int dststride = pixmap->strideBytes;
- int srcwidth = ((int)width) * pvrQwsDisplay.screens[0].bytesPerPixel;
- srcaddr += height * stride;
- while (height > 0) {
- srcaddr -= (int)stride;
- memcpy(dstaddr, srcaddr, srcwidth);
- dstaddr += dststride;
- --height;
- }
- return WSEGL_SUCCESS;
-}
-
-/* Return the parameters of a drawable that are needed by the EGL layer */
-static WSEGLError wseglGetDrawableParameters
- (WSEGLDrawableHandle _drawable, WSEGLDrawableParams *sourceParams,
- WSEGLDrawableParams *renderParams)
-{
- PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable;
- PVR2DMEMINFO *source, *render;
- WSEGLPixelFormat pixelFormat;
-
- if (!pvrQwsGetBuffers(drawable, &source, &render))
- return WSEGL_BAD_DRAWABLE;
-
- switch (drawable->pixelFormat) {
- case PVR2D_RGB565:
- default:
- pixelFormat = WSEGL_PIXELFORMAT_565;
- break;
-
- case PVR2D_ARGB4444:
- pixelFormat = WSEGL_PIXELFORMAT_4444;
- break;
-
- case PVR2D_ARGB8888:
- pixelFormat = WSEGL_PIXELFORMAT_8888;
- break;
- }
-
- sourceParams->ui32Width = drawable->rect.width;
- sourceParams->ui32Height = drawable->rect.height;
- sourceParams->ui32Stride = drawable->stridePixels;
- sourceParams->ePixelFormat = pixelFormat;
- sourceParams->pvLinearAddress = source->pBase;
- sourceParams->ui32HWAddress = source->ui32DevAddr;
- sourceParams->hPrivateData = source->hPrivateData;
-
- renderParams->ui32Width = drawable->rect.width;
- renderParams->ui32Height = drawable->rect.height;
- renderParams->ui32Stride = drawable->stridePixels;
- renderParams->ePixelFormat = pixelFormat;
- renderParams->pvLinearAddress = render->pBase;
- renderParams->ui32HWAddress = render->ui32DevAddr;
- renderParams->hPrivateData = render->hPrivateData;
-
- return WSEGL_SUCCESS;
-}
-
-static WSEGL_FunctionTable const wseglFunctions = {
- WSEGL_VERSION,
- wseglIsDisplayValid,
- wseglInitializeDisplay,
- wseglCloseDisplay,
- wseglCreateWindowDrawable,
- wseglCreatePixmapDrawable,
- wseglDeleteDrawable,
- wseglSwapDrawable,
- wseglSwapControlInterval,
- wseglWaitNative,
- wseglCopyFromDrawable,
- wseglCopyFromPBuffer,
- wseglGetDrawableParameters
-};
-
-/* Return the table of WSEGL functions to the EGL implementation */
-const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void)
-{
- return &wseglFunctions;
-}
diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README
deleted file mode 100644
index 513e7f5e9e..0000000000
--- a/src/plugins/gfxdrivers/powervr/README
+++ /dev/null
@@ -1,66 +0,0 @@
-PowerVR QScreen Driver
-======================
-
-This QScreen plugin driver allows the QtOpenGl module to integrate with PowerVR
-hardware from Imagination Technologies. Using this plugin, applications may use
-QGLWidget & QGLPixelBuffer with OpenGL ES. The integration with PowerVR drivers
-is built as two libraries: The actual QScreen plugin used by Qt (in the
-pvreglscreen directory) and a WSEGL plugin for the PowerVR drivers (in the
-QWSWSEGL directory).
-
-Qt/Embedded needs to be configured with the QT_QWS_CLIENTBLIT and
-QT_NO_QWS_CURSOR defines.
-
-The PowerVR drivers provide the WSEGL plugin API to allow window systems such as
-QWS to integrate correctly. In order to use the integration, the WSEGL plugin
-(libpvrQWSWSEGL.so, usually installed into the Qt library directory) must be in
-the LD library path. The PowerVR driver also needs to be told which WSEGL library
-to use. This is done by creating/modifying /etc/powervr.ini:
-
-[default]
-WindowSystem=libpvrQWSWSEGL.so
-
-Note: It is important that the /etc/powervr.ini file not contain ^M (Ctrl-M) DOS
-end of line markers at the end of its lines. If ^M markers are present, then the
-libpvrQWSWSEGL.so driver will not be loaded and the default null Linux driver
-will be loaded silently instead. Make sure that the end of line markers are
-strictly Unix-style markers.
-
-
-***************************************************************************
-* IMPORTANT: To build the QScreen plugin and the WSEGL library it depends *
-* on, the pvr2d.h, wsegl.h headers for your platform are required. You *
-* can find a copy of these headers in src/3rdparty/powervr for SGX based *
-* platforms like the TI OMAP3xxx. They probably will not work on MBX *
-* because of differences in the layout of certain PVR2D structures. *
-* You can tell Qt where to find the actual headers for your system by *
-* setting QMAKE_INCDIR_POWERVR in the mkspec. *
-***************************************************************************
-
-When you start a Qt/Embedded application, you should modify the QWS_DISPLAY
-environment variable to use the "powervr" driver instead of "LinuxFb". For
-example, if your original QWS_DISPLAY variable was:
-
- LinuxFb:mmWidth40:mmHeight54:0
-
-then it should be changed to:
-
- powervr:mmWidth40:mmHeight54:0
-
-To test the OpenGL ES integration, you can use the hellogl_es example and run it
-on the device with:
-
- hellogl_es -qws
-
-The driver also supports screen rotation if Qt is configured with the
--qt-gfx-transformed option and the QWS_DISPLAY variable is wrapped in a
-"Transformed" declaration:
-
- Transformed:powervr:mmWidth40:mmHeight54:Rot90:0
-
-Know Issues:
- * A QGLWidget may not have window decorations if it is a top-level window.
- * On some platforms, starting a QWS application after the system has been up
- for a long time may cause the driver to fail. This is due to fragmentation
- of main memory prevening older PowerVR drivers from allocating a contiguous
- region of phyical RAM for the GL surface.
diff --git a/src/plugins/gfxdrivers/powervr/powervr.pri b/src/plugins/gfxdrivers/powervr/powervr.pri
deleted file mode 100644
index 9df8c0ed5b..0000000000
--- a/src/plugins/gfxdrivers/powervr/powervr.pri
+++ /dev/null
@@ -1,2 +0,0 @@
-
-INCLUDEPATH += $$QMAKE_INCDIR_POWERVR
diff --git a/src/plugins/gfxdrivers/powervr/powervr.pro b/src/plugins/gfxdrivers/powervr/powervr.pro
deleted file mode 100644
index f31ad042d8..0000000000
--- a/src/plugins/gfxdrivers/powervr/powervr.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = QWSWSEGL pvreglscreen
-CONFIG += ordered
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
deleted file mode 100644
index c981e0d300..0000000000
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
+++ /dev/null
@@ -1,351 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pvreglscreen.h"
-#include "pvreglwindowsurface.h"
-#include "pvrqwsdrawable_p.h"
-#include <QRegExp>
-#include <qwindowsystem_qws.h>
-#ifndef QT_NO_QWS_TRANSFORMED
-#include <qscreentransformed_qws.h>
-#endif
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/kd.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-//![0]
-PvrEglScreen::PvrEglScreen(int displayId)
- : QGLScreen(displayId)
-{
- setOptions(NativeWindows);
- setSupportsBlitInClients(true);
- setSurfaceFunctions(new PvrEglScreenSurfaceFunctions(this, displayId));
-//![0]
- fd = -1;
- ttyfd = -1;
- doGraphicsMode = true;
- oldKdMode = KD_TEXT;
- parent = 0;
-
- // Make sure that the EGL layer is initialized and the drivers loaded.
- EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY);
- if (!eglInitialize(dpy, 0, 0))
- qWarning("Could not initialize EGL display - are the drivers loaded?");
-
- // Make sure that screen 0 is initialized.
- pvrQwsScreenWindow(0);
-}
-
-PvrEglScreen::~PvrEglScreen()
-{
- if (fd >= 0)
- ::close(fd);
-}
-
-bool PvrEglScreen::initDevice()
-{
- openTty();
- return true;
-}
-
-bool PvrEglScreen::connect(const QString &displaySpec)
-{
- if (!pvrQwsDisplayOpen())
- return false;
-
- // Initialize the QScreen properties.
- data = (uchar *)(pvrQwsDisplay.screens[0].mapped);
- w = pvrQwsDisplay.screens[0].screenRect.width;
- h = pvrQwsDisplay.screens[0].screenRect.height;
- lstep = pvrQwsDisplay.screens[0].screenStride;
- dw = w;
- dh = h;
- size = h * lstep;
- mapsize = size;
- switch (pvrQwsDisplay.screens[0].pixelFormat) {
- case PVR2D_RGB565:
- d = 16;
- setPixelFormat(QImage::Format_RGB16);
- break;
- case PVR2D_ARGB4444:
- d = 16;
- setPixelFormat(QImage::Format_ARGB4444_Premultiplied);
- break;
- case PVR2D_ARGB8888:
- d = 32;
- setPixelFormat(QImage::Format_ARGB32_Premultiplied);
- break;
- default:
- pvrQwsDisplayClose();
- qWarning("PvrEglScreen::connect: unsupported pixel format %d", (int)(pvrQwsDisplay.screens[0].pixelFormat));
- return false;
- }
-
- // Handle display physical size spec.
- QStringList displayArgs = displaySpec.split(QLatin1Char(':'));
- QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)"));
- int dimIdxW = displayArgs.indexOf(mmWidthRx);
- QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)"));
- int dimIdxH = displayArgs.indexOf(mmHeightRx);
- if (dimIdxW >= 0) {
- mmWidthRx.exactMatch(displayArgs.at(dimIdxW));
- physWidth = mmWidthRx.cap(1).toInt();
- if (dimIdxH < 0)
- physHeight = dh*physWidth/dw;
- }
- if (dimIdxH >= 0) {
- mmHeightRx.exactMatch(displayArgs.at(dimIdxH));
- physHeight = mmHeightRx.cap(1).toInt();
- if (dimIdxW < 0)
- physWidth = dw*physHeight/dh;
- }
- if (dimIdxW < 0 && dimIdxH < 0) {
- const int dpi = 72;
- physWidth = qRound(dw * 25.4 / dpi);
- physHeight = qRound(dh * 25.4 / dpi);
- }
-
- // Find the name of the tty device to use.
- QRegExp ttyRegExp(QLatin1String("tty=(.*)"));
- if (displayArgs.indexOf(ttyRegExp) != -1)
- ttyDevice = ttyRegExp.cap(1);
- if (displayArgs.contains(QLatin1String("nographicsmodeswitch")))
- doGraphicsMode = false;
-
- // The screen is ready.
- return true;
-}
-
-void PvrEglScreen::disconnect()
-{
- pvrQwsDisplayClose();
-}
-
-void PvrEglScreen::shutdownDevice()
-{
- closeTty();
-}
-
-void PvrEglScreen::blit(const QImage &img, const QPoint &topLeft, const QRegion &region)
-{
- QGLScreen::blit(img, topLeft, region);
- sync();
-}
-
-void PvrEglScreen::solidFill(const QColor &color, const QRegion &region)
-{
- QGLScreen::solidFill(color, region);
- sync();
-}
-
-bool PvrEglScreen::chooseContext
- (QGLContext *context, const QGLContext *shareContext)
-{
- // We use PvrEglScreenSurfaceFunctions instead.
- Q_UNUSED(context);
- Q_UNUSED(shareContext);
- return false;
-}
-
-bool PvrEglScreen::hasOpenGL()
-{
- return true;
-}
-
-//![1]
-QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const
-{
- if (qobject_cast<QGLWidget*>(widget))
- return new PvrEglWindowSurface(widget, (PvrEglScreen *)this, displayId);
-
- return QScreen::createSurface(widget);
-}
-
-QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const
-{
- if (key == QLatin1String("PvrEgl"))
- return new PvrEglWindowSurface();
-
- return QScreen::createSurface(key);
-}
-//![1]
-
-#ifndef QT_NO_QWS_TRANSFORMED
-
-static const QScreen *parentScreen
- (const QScreen *current, const QScreen *lookingFor)
-{
- if (!current)
- return 0;
- switch (current->classId()) {
- case QScreen::ProxyClass:
- case QScreen::TransformedClass: {
- const QScreen *child =
- static_cast<const QProxyScreen *>(current)->screen();
- if (child == lookingFor)
- return current;
- else
- return parentScreen(child, lookingFor);
- }
- // Not reached.
-
- case QScreen::MultiClass: {
- QList<QScreen *> screens = current->subScreens();
- foreach (QScreen *screen, screens) {
- if (screen == lookingFor)
- return current;
- const QScreen *parent = parentScreen(screen, lookingFor);
- if (parent)
- return parent;
- }
- }
- break;
-
- default: break;
- }
- return 0;
-}
-
-int PvrEglScreen::transformation() const
-{
- // We need to search for our parent screen, which is assumed to be
- // "Transformed". If it isn't, then there is no transformation.
- // There is no direct method to get the parent screen so we need
- // to search every screen until we find ourselves.
- if (!parent && qt_screen != this)
- parent = parentScreen(qt_screen, this);
- if (!parent)
- return 0;
- if (parent->classId() != QScreen::TransformedClass)
- return 0;
- return 90 * static_cast<const QTransformedScreen *>(parent)
- ->transformOrientation();
-}
-
-#else
-
-int PvrEglScreen::transformation() const
-{
- return 0;
-}
-
-#endif
-
-void PvrEglScreen::sync()
-{
- // Put code here to synchronize 2D and 3D operations if necessary.
-}
-
-void PvrEglScreen::openTty()
-{
- const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0};
-
- if (ttyDevice.isEmpty()) {
- for (const char * const *dev = devs; *dev; ++dev) {
- ttyfd = ::open(*dev, O_RDWR);
- if (ttyfd != -1)
- break;
- }
- } else {
- ttyfd = ::open(ttyDevice.toAscii().constData(), O_RDWR);
- }
-
- if (ttyfd == -1)
- return;
-
- ::fcntl(ttyfd, F_SETFD, FD_CLOEXEC);
-
- if (doGraphicsMode) {
- ioctl(ttyfd, KDGETMODE, &oldKdMode);
- if (oldKdMode != KD_GRAPHICS) {
- int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS);
- if (ret == -1)
- doGraphicsMode = false;
- }
- }
-
- // No blankin' screen, no blinkin' cursor!, no cursor!
- const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c";
- ::write(ttyfd, termctl, sizeof(termctl));
-}
-
-void PvrEglScreen::closeTty()
-{
- if (ttyfd == -1)
- return;
-
- if (doGraphicsMode)
- ioctl(ttyfd, KDSETMODE, oldKdMode);
-
- // Blankin' screen, blinkin' cursor!
- const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c";
- ::write(ttyfd, termctl, sizeof(termctl));
-
- ::close(ttyfd);
- ttyfd = -1;
-}
-
-//![2]
-bool PvrEglScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNativeWindowType *native)
-{
-//![2]
- QWSWindowSurface *surface =
- static_cast<QWSWindowSurface *>(widget->windowSurface());
- if (!surface) {
- // The widget does not have a surface yet, so give it one.
- surface = new PvrEglWindowSurface(widget, screen, displayId);
- widget->setWindowSurface(surface);
- } else if (surface->key() != QLatin1String("PvrEgl")) {
- // The application has attached a QGLContext to an ordinary QWidget.
- // Replace the widget's window surface with a new one that can do GL.
- QRect geometry = widget->frameGeometry();
- geometry.moveTo(widget->mapToGlobal(QPoint(0, 0)));
- surface = new PvrEglWindowSurface(widget, screen, displayId);
- surface->setGeometry(geometry);
- widget->setWindowSurface(surface);
- widget->setAttribute(Qt::WA_NoSystemBackground, true);
- }
- PvrEglWindowSurface *nsurface = static_cast<PvrEglWindowSurface*>(surface);
- *native = (EGLNativeWindowType)(nsurface->nativeDrawable());
- return true;
-}
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h
deleted file mode 100644
index efb2406771..0000000000
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PVREGLSCREEN_H
-#define PVREGLSCREEN_H
-
-#include <QScreen>
-#include <QGLScreen>
-#include "pvrqwsdrawable.h"
-
-class PvrEglScreen;
-
-class PvrEglScreenSurfaceFunctions : public QGLScreenSurfaceFunctions
-{
-public:
- PvrEglScreenSurfaceFunctions(PvrEglScreen *s, int screenNum)
- : screen(s), displayId(screenNum) {}
-
- bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native);
-
-private:
- PvrEglScreen *screen;
- int displayId;
-};
-
-class PvrEglScreen : public QGLScreen
-{
-public:
- PvrEglScreen(int displayId);
- ~PvrEglScreen();
-
- bool initDevice();
- bool connect(const QString &displaySpec);
- void disconnect();
- void shutdownDevice();
- void setMode(int, int, int) {}
-
- void blit(const QImage &img, const QPoint &topLeft, const QRegion &region);
- void solidFill(const QColor &color, const QRegion &region);
-
- bool chooseContext(QGLContext *context, const QGLContext *shareContext);
- bool hasOpenGL();
-
- QWSWindowSurface* createSurface(QWidget *widget) const;
- QWSWindowSurface* createSurface(const QString &key) const;
-
- int transformation() const;
-
-private:
- void sync();
- void openTty();
- void closeTty();
-
- int fd;
- int ttyfd, oldKdMode;
- QString ttyDevice;
- bool doGraphicsMode;
- mutable const QScreen *parent;
-};
-
-#endif
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro
deleted file mode 100644
index 2b5212a6b3..0000000000
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-TEMPLATE = lib
-TARGET = qgfxpvregl
-CONFIG += qt plugin warn_on
-QT += opengl
-
-LIBS += -lpvrQWSWSEGL
-
-DEFINES += QT_QWS_CLIENTBLIT
-
-INCLUDEPATH += ../QWSWSEGL
-
-
-HEADERS = \
- pvreglscreen.h \
- pvreglwindowsurface.h
-
-SOURCES = \
- pvreglscreenplugin.cpp \
- pvreglscreen.cpp \
- pvreglwindowsurface.cpp
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
-
-include(../powervr.pri) \ No newline at end of file
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreenplugin.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreenplugin.cpp
deleted file mode 100644
index 872285e818..0000000000
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreenplugin.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pvreglscreen.h"
-
-#include <QScreenDriverPlugin>
-#include <QStringList>
-
-class PvrEglScreenPlugin : public QScreenDriverPlugin
-{
-public:
- PvrEglScreenPlugin();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-
-PvrEglScreenPlugin::PvrEglScreenPlugin()
- : QScreenDriverPlugin()
-{
-}
-
-QStringList PvrEglScreenPlugin::keys() const
-{
- return (QStringList() << "powervr");
-}
-
-QScreen* PvrEglScreenPlugin::create(const QString& driver, int displayId)
-{
- if (driver.toLower() != "powervr")
- return 0;
-
- return new PvrEglScreen(displayId);
-}
-
-Q_EXPORT_PLUGIN2(qgfxpvregl, PvrEglScreenPlugin)
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
deleted file mode 100644
index 43648159c8..0000000000
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pvreglwindowsurface.h"
-#include "pvreglscreen.h"
-#include <QScreen>
-#include <QDebug>
-#include <QWSDisplay>
-
-PvrEglWindowSurface::PvrEglWindowSurface
- (QWidget *widget, PvrEglScreen *screen, int screenNum)
- : QWSGLWindowSurface(widget)
-{
- setSurfaceFlags(QWSWindowSurface::Opaque);
-
- this->widget = widget;
- this->screen = screen;
- this->pdevice = 0;
-
- QPoint pos = offset(widget);
- QSize size = widget->size();
-
- PvrQwsRect pvrRect;
- pvrRect.x = pos.x();
- pvrRect.y = pos.y();
- pvrRect.width = size.width();
- pvrRect.height = size.height();
- transformRects(&pvrRect, 1);
-
- // Try to recover a previous PvrQwsDrawable object for the widget
- // if there is one. This can happen when a PvrEglWindowSurface
- // is created for a widget, bound to a EGLSurface, and then destroyed.
- // When a new PvrEglWindowSurface is created for the widget, it will
- // pick up the previous PvrQwsDrawable if the EGLSurface has not been
- // destroyed in the meantime.
- drawable = pvrQwsFetchWindow((long)widget);
- if (drawable)
- pvrQwsSetGeometry(drawable, &pvrRect);
- else
- drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect);
- pvrQwsSetRotation(drawable, screen->transformation());
-}
-
-PvrEglWindowSurface::PvrEglWindowSurface()
- : QWSGLWindowSurface()
-{
- setSurfaceFlags(QWSWindowSurface::Opaque);
- drawable = 0;
- widget = 0;
- screen = 0;
- pdevice = 0;
-}
-
-PvrEglWindowSurface::~PvrEglWindowSurface()
-{
- // Release the PvrQwsDrawable. If it is bound to an EGLSurface,
- // then it will stay around until a new PvrEglWindowSurface is
- // created for the widget. If it is not bound to an EGLSurface,
- // it will be destroyed immediately.
- if (drawable && pvrQwsReleaseWindow(drawable))
- pvrQwsDestroyDrawable(drawable);
-
- delete pdevice;
-}
-
-bool PvrEglWindowSurface::isValid() const
-{
- return (widget != 0);
-}
-
-void PvrEglWindowSurface::setGeometry(const QRect &rect)
-{
- if (drawable) {
- // XXX: adjust for the screen offset.
- PvrQwsRect pvrRect;
- pvrRect.x = rect.x();
- pvrRect.y = rect.y();
- pvrRect.width = rect.width();
- pvrRect.height = rect.height();
- transformRects(&pvrRect, 1);
- pvrQwsSetGeometry(drawable, &pvrRect);
- pvrQwsSetRotation(drawable, screen->transformation());
- }
- QWSGLWindowSurface::setGeometry(rect);
-}
-
-bool PvrEglWindowSurface::move(const QPoint &offset)
-{
- QRect rect = geometry().translated(offset);
- if (drawable) {
- PvrQwsRect pvrRect;
- pvrRect.x = rect.x();
- pvrRect.y = rect.y();
- pvrRect.width = rect.width();
- pvrRect.height = rect.height();
- transformRects(&pvrRect, 1);
- pvrQwsSetGeometry(drawable, &pvrRect);
- pvrQwsSetRotation(drawable, screen->transformation());
- }
- return QWSGLWindowSurface::move(offset);
-}
-
-QByteArray PvrEglWindowSurface::permanentState() const
-{
- // Nothing interesting to pass to the server just yet.
- return QByteArray();
-}
-
-void PvrEglWindowSurface::setPermanentState(const QByteArray &state)
-{
- Q_UNUSED(state);
-}
-
-void PvrEglWindowSurface::flush
- (QWidget *widget, const QRegion &region, const QPoint &offset)
-{
- // The GL paint engine is responsible for the swapBuffers() call.
- // If we were to call the base class's implementation of flush()
- // then it would fetch the image() and manually blit it to the
- // screeen instead of using the fast PVR2D blit.
- Q_UNUSED(widget);
- Q_UNUSED(region);
- Q_UNUSED(offset);
-}
-
-QImage PvrEglWindowSurface::image() const
-{
- if (drawable) {
- PvrQwsRect pvrRect;
- pvrQwsGetGeometry(drawable, &pvrRect);
- void *data = pvrQwsGetRenderBuffer(drawable);
- if (data) {
- return QImage((uchar *)data, pvrRect.width, pvrRect.height,
- pvrQwsGetStride(drawable), screen->pixelFormat());
- }
- }
- return QImage(16, 16, screen->pixelFormat());
-}
-
-QPaintDevice *PvrEglWindowSurface::paintDevice()
-{
- return widget;
-}
-
-void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id)
-{
- QWSGLWindowSurface::setDirectRegion(r, id);
-
- if (!drawable)
- return;
-
- // Clip the region to the window boundaries in case the child
- // is partially outside the geometry of the parent.
- QWidget *window = widget->window();
- QRegion region = r;
- if (widget != window) {
- QRect rect = window->geometry();
- rect.moveTo(window->mapToGlobal(QPoint(0, 0)));
- region = region.intersect(rect);
- }
-
- if (region.isEmpty()) {
- pvrQwsClearVisibleRegion(drawable);
- } else if (region.rectCount() == 1) {
- QRect rect = region.boundingRect();
- PvrQwsRect pvrRect;
- pvrRect.x = rect.x();
- pvrRect.y = rect.y();
- pvrRect.width = rect.width();
- pvrRect.height = rect.height();
- transformRects(&pvrRect, 1);
- pvrQwsSetVisibleRegion(drawable, &pvrRect, 1);
- pvrQwsSetRotation(drawable, screen->transformation());
- if (!pvrQwsSwapBuffers(drawable, 1))
- screen->solidFill(QColor(0, 0, 0), region);
- } else {
- QVector<QRect> rects = region.rects();
- PvrQwsRect *pvrRects = new PvrQwsRect [rects.size()];
- for (int index = 0; index < rects.size(); ++index) {
- QRect rect = rects[index];
- pvrRects[index].x = rect.x();
- pvrRects[index].y = rect.y();
- pvrRects[index].width = rect.width();
- pvrRects[index].height = rect.height();
- }
- transformRects(pvrRects, rects.size());
- pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size());
- pvrQwsSetRotation(drawable, screen->transformation());
- if (!pvrQwsSwapBuffers(drawable, 1))
- screen->solidFill(QColor(0, 0, 0), region);
- delete [] pvrRects;
- }
-}
-
-void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const
-{
- switch (screen->transformation()) {
- case 0: break;
-
- case 90:
- {
- for (int index = 0; index < count; ++index) {
- int x = rects[index].y;
- int y = screen->height() - (rects[index].x + rects[index].width);
- rects[index].x = x;
- rects[index].y = y;
- qSwap(rects[index].width, rects[index].height);
- }
- }
- break;
-
- case 180:
- {
- for (int index = 0; index < count; ++index) {
- int x = screen->width() - (rects[index].x + rects[index].width);
- int y = screen->height() - (rects[index].y + rects[index].height);
- rects[index].x = x;
- rects[index].y = y;
- }
- }
- break;
-
- case 270:
- {
- for (int index = 0; index < count; ++index) {
- int x = screen->width() - (rects[index].y + rects[index].height);
- int y = rects[index].x;
- rects[index].x = x;
- rects[index].y = y;
- qSwap(rects[index].width, rects[index].height);
- }
- }
- break;
- }
-}
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h
deleted file mode 100644
index 9f5600c136..0000000000
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PVREGLWINDOWSURFACE_H
-#define PVREGLWINDOWSURFACE_H
-
-#include <private/qglwindowsurface_qws_p.h>
-#include "pvrqwsdrawable.h"
-
-class PvrEglScreen;
-
-class PvrEglWindowSurface : public QWSGLWindowSurface
-{
-public:
- PvrEglWindowSurface(QWidget *widget, PvrEglScreen *screen, int screenNum);
- PvrEglWindowSurface();
- ~PvrEglWindowSurface();
-
- QString key() const { return QLatin1String("PvrEgl"); }
-
- bool isValid() const;
-
- void setGeometry(const QRect &rect);
- bool move(const QPoint &offset);
-
- QByteArray permanentState() const;
- void setPermanentState(const QByteArray &state);
-
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
-
- QImage image() const;
- QPaintDevice *paintDevice();
-
- void setDirectRegion(const QRegion &region, int id);
-
- long nativeDrawable() const { return (long)widget; }
-
-private:
- QWidget *widget;
- PvrQwsDrawable *drawable;
- PvrEglScreen *screen;
- QPaintDevice *pdevice;
-
- void transformRects(PvrQwsRect *rects, int count) const;
-};
-
-#endif
diff --git a/src/plugins/gfxdrivers/qvfb/main.cpp b/src/plugins/gfxdrivers/qvfb/main.cpp
deleted file mode 100644
index fb275818b9..0000000000
--- a/src/plugins/gfxdrivers/qvfb/main.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qscreendriverplugin_qws.h>
-#include <qscreenvfb_qws.h>
-#include <qstringlist.h>
-
-#ifndef QT_NO_LIBRARY
-QT_BEGIN_NAMESPACE
-
-class ScreenVfbDriver : public QScreenDriverPlugin
-{
-public:
- ScreenVfbDriver();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-
-ScreenVfbDriver::ScreenVfbDriver()
-: QScreenDriverPlugin()
-{
-}
-
-QStringList ScreenVfbDriver::keys() const
-{
- QStringList list;
- list << "QVFb";
- return list;
-}
-
-QScreen* ScreenVfbDriver::create(const QString& driver, int displayId)
-{
- if (driver.toLower() == "qvfb")
- return new QVFbScreen(displayId);
-
- return 0;
-}
-
-Q_EXPORT_STATIC_PLUGIN(ScreenVfbDriver)
-Q_EXPORT_PLUGIN2(qscreenvfb, ScreenVfbDriver)
-
-QT_END_NAMESPACE
-#endif //QT_NO_LIBRARY
diff --git a/src/plugins/gfxdrivers/qvfb/qvfb.pro b/src/plugins/gfxdrivers/qvfb/qvfb.pro
deleted file mode 100644
index e45319db87..0000000000
--- a/src/plugins/gfxdrivers/qvfb/qvfb.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET = qscreenvfb
-include(../../qpluginbase.pri)
-
-DEFINES += QT_QWS_QVFB QT_QWS_MOUSE_QVFB QT_QWS_KBD_QVFB
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-HEADERS = \
- $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.h \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.h \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
diff --git a/src/plugins/gfxdrivers/transformed/main.cpp b/src/plugins/gfxdrivers/transformed/main.cpp
deleted file mode 100644
index da619bb3e5..0000000000
--- a/src/plugins/gfxdrivers/transformed/main.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qscreendriverplugin_qws.h>
-#include <qscreentransformed_qws.h>
-#include <qstringlist.h>
-#ifndef QT_NO_LIBRARY
-QT_BEGIN_NAMESPACE
-
-class GfxTransformedDriver : public QScreenDriverPlugin
-{
-public:
- GfxTransformedDriver();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-
-GfxTransformedDriver::GfxTransformedDriver()
-: QScreenDriverPlugin()
-{
-}
-
-QStringList GfxTransformedDriver::keys() const
-{
- QStringList list;
- list << "Transformed";
- return list;
-}
-
-QScreen* GfxTransformedDriver::create(const QString& driver, int displayId)
-{
-#ifndef QT_NO_QWS_TRANSFORMED
- if (driver.toLower() == "transformed")
- return new QTransformedScreen(displayId);
-#else //QT_NO_QWS_TRANSFORMED
- printf("QT buildt with QT_NO_QWS_TRANSFORMED. No screen driver returned\n");
-#endif //QT_NO_QWS_TRANSFORMED
- return 0;
-}
-
-Q_EXPORT_STATIC_PLUGIN(GfxTransformedDriver)
-Q_EXPORT_PLUGIN2(qgfxtransformed, GfxTransformedDriver)
-
-QT_END_NAMESPACE
-#endif //QT_NO_LIBRARY
diff --git a/src/plugins/gfxdrivers/transformed/transformed.pro b/src/plugins/gfxdrivers/transformed/transformed.pro
deleted file mode 100644
index f6e07704b3..0000000000
--- a/src/plugins/gfxdrivers/transformed/transformed.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = qgfxtransformed
-include(../../qpluginbase.pri)
-
-DEFINES += QT_QWS_TRANSFORMED
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qscreentransformed_qws.h
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qscreentransformed_qws.cpp
-
-target.path=$$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
diff --git a/src/plugins/gfxdrivers/vnc/main.cpp b/src/plugins/gfxdrivers/vnc/main.cpp
deleted file mode 100644
index 65c6cf25c6..0000000000
--- a/src/plugins/gfxdrivers/vnc/main.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qscreendriverplugin_qws.h>
-#include <qscreenvnc_qws.h>
-#include <qstringlist.h>
-
-#ifndef QT_NO_LIBRARY
-QT_BEGIN_NAMESPACE
-
-class GfxVncDriver : public QScreenDriverPlugin
-{
-public:
- GfxVncDriver();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-
-GfxVncDriver::GfxVncDriver()
-: QScreenDriverPlugin()
-{
-}
-
-QStringList GfxVncDriver::keys() const
-{
- QStringList list;
- list << "VNC";
- return list;
-}
-
-QScreen* GfxVncDriver::create(const QString& driver, int displayId)
-{
-#ifndef QT_NO_QWS_VNC
- if (driver.toLower() == "vnc")
- return new QVNCScreen(displayId);
-#else //QT_NO_QWS_VNC
- printf("QT buildt with QT_NO_QWS_VNC. No screen driver returned\n");
-#endif //QT_NO_QWS_VNC
- return 0;
-}
-
-Q_EXPORT_STATIC_PLUGIN(GfxVncDriver)
-Q_EXPORT_PLUGIN2(qgfxvnc, GfxVncDriver)
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_LIBRARY
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h b/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h
deleted file mode 100644
index 9a02072815..0000000000
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h
+++ /dev/null
@@ -1,524 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENVNC_P_H
-#define QSCREENVNC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qscreenvnc_qws.h"
-
-#ifndef QT_NO_QWS_VNC
-
-#include <QtCore/qvarlengtharray.h>
-#include <QtCore/qsharedmemory.h>
-#include <QtNetwork/qtcpsocket.h>
-#include <QtNetwork/qtcpserver.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVNCServer;
-
-#ifndef QT_NO_QWS_CURSOR
-class QVNCCursor : public QProxyScreenCursor
-{
-public:
- QVNCCursor(QVNCScreen *s);
- ~QVNCCursor();
-
- void hide();
- void show();
- void set(const QImage &image, int hotx, int hoty);
- void move(int x, int y);
-
-private:
- void setDirty(const QRect &r) const;
- QVNCScreen *screen;
-};
-
-class QVNCClientCursor : public QProxyScreenCursor
-{
-public:
- QVNCClientCursor(QVNCServer *s);
- ~QVNCClientCursor();
-
- void set(const QImage &image, int hotx, int hoty);
- void write() const;
-
-private:
- QVNCServer *server;
-};
-#endif // QT_NO_QWS_CURSOR
-
-#define MAP_TILE_SIZE 16
-#define MAP_WIDTH 1280 / MAP_TILE_SIZE
-#define MAP_HEIGHT 1024 / MAP_TILE_SIZE
-
-class QVNCDirtyMap
-{
-public:
- QVNCDirtyMap(QScreen *screen);
- virtual ~QVNCDirtyMap();
-
- void reset();
- bool dirty(int x, int y) const;
- virtual void setDirty(int x, int y, bool force = false) = 0;
- void setClean(int x, int y);
-
- int bytesPerPixel;
-
- int numDirty;
- int mapWidth;
- int mapHeight;
-
-protected:
- uchar *map;
- QScreen *screen;
- uchar *buffer;
- int bufferWidth;
- int bufferHeight;
- int bufferStride;
- int numTiles;
-};
-
-template <class T>
-class QVNCDirtyMapOptimized : public QVNCDirtyMap
-{
-public:
- QVNCDirtyMapOptimized(QScreen *screen) : QVNCDirtyMap(screen) {}
- ~QVNCDirtyMapOptimized() {}
-
- void setDirty(int x, int y, bool force = false);
-};
-
-class QRfbRect
-{
-public:
- QRfbRect() {}
- QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h) {
- x = _x; y = _y; w = _w; h = _h;
- }
-
- void read(QTcpSocket *s);
- void write(QTcpSocket *s) const;
-
- quint16 x;
- quint16 y;
- quint16 w;
- quint16 h;
-};
-
-class QRfbPixelFormat
-{
-public:
- static int size() { return 16; }
-
- void read(QTcpSocket *s);
- void write(QTcpSocket *s);
-
- int bitsPerPixel;
- int depth;
- bool bigEndian;
- bool trueColor;
- int redBits;
- int greenBits;
- int blueBits;
- int redShift;
- int greenShift;
- int blueShift;
-};
-
-class QRfbServerInit
-{
-public:
- QRfbServerInit() { name = 0; }
- ~QRfbServerInit() { delete[] name; }
-
- int size() const { return QRfbPixelFormat::size() + 8 + strlen(name); }
- void setName(const char *n);
-
- void read(QTcpSocket *s);
- void write(QTcpSocket *s);
-
- quint16 width;
- quint16 height;
- QRfbPixelFormat format;
- char *name;
-};
-
-class QRfbSetEncodings
-{
-public:
- bool read(QTcpSocket *s);
-
- quint16 count;
-};
-
-class QRfbFrameBufferUpdateRequest
-{
-public:
- bool read(QTcpSocket *s);
-
- char incremental;
- QRfbRect rect;
-};
-
-class QRfbKeyEvent
-{
-public:
- bool read(QTcpSocket *s);
-
- char down;
- int keycode;
- int unicode;
-};
-
-class QRfbPointerEvent
-{
-public:
- bool read(QTcpSocket *s);
-
- uint buttons;
- quint16 x;
- quint16 y;
-};
-
-class QRfbClientCutText
-{
-public:
- bool read(QTcpSocket *s);
-
- quint32 length;
-};
-
-class QVNCScreenPrivate : public QObject
-{
-public:
- QVNCScreenPrivate(QVNCScreen *parent);
- ~QVNCScreenPrivate();
-
- void setDirty(const QRect &rect, bool force = false);
- void configure();
-
- qreal dpiX;
- qreal dpiY;
- bool doOnScreenSurface;
- QVNCDirtyMap *dirty;
- int refreshRate;
- QVNCServer *vncServer;
-
-#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY)
- QSharedMemory shm;
-#endif
-
- QVNCScreen *q_ptr;
-
- bool noDisablePainting;
-};
-
-class QRfbEncoder
-{
-public:
- QRfbEncoder(QVNCServer *s) : server(s) {}
- virtual ~QRfbEncoder() {}
-
- virtual void write() = 0;
-
-protected:
- QVNCServer *server;
-};
-
-class QRfbRawEncoder : public QRfbEncoder
-{
-public:
- QRfbRawEncoder(QVNCServer *s) : QRfbEncoder(s) {}
-
- void write();
-
-private:
- QByteArray buffer;
-};
-
-template <class SRC> class QRfbHextileEncoder;
-
-template <class SRC>
-class QRfbSingleColorHextile
-{
-public:
- QRfbSingleColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
- bool read(const uchar *data, int width, int height, int stride);
- void write(QTcpSocket *socket) const;
-
-private:
- QRfbHextileEncoder<SRC> *encoder;
-};
-
-template <class SRC>
-class QRfbDualColorHextile
-{
-public:
- QRfbDualColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
- bool read(const uchar *data, int width, int height, int stride);
- void write(QTcpSocket *socket) const;
-
-private:
- struct Rect {
- quint8 xy;
- quint8 wh;
- } Q_PACKED rects[8 * 16];
-
- quint8 numRects;
- QRfbHextileEncoder<SRC> *encoder;
-
-private:
- inline int lastx() const { return rectx(numRects); }
- inline int lasty() const { return recty(numRects); }
- inline int rectx(int r) const { return rects[r].xy >> 4; }
- inline int recty(int r) const { return rects[r].xy & 0x0f; }
- inline int width(int r) const { return (rects[r].wh >> 4) + 1; }
- inline int height(int r) const { return (rects[r].wh & 0x0f) + 1; }
-
- inline void setX(int r, int x) {
- rects[r].xy = (x << 4) | (rects[r].xy & 0x0f);
- }
- inline void setY(int r, int y) {
- rects[r].xy = (rects[r].xy & 0xf0) | y;
- }
- inline void setWidth(int r, int width) {
- rects[r].wh = ((width - 1) << 4) | (rects[r].wh & 0x0f);
- }
- inline void setHeight(int r, int height) {
- rects[r].wh = (rects[r].wh & 0xf0) | (height - 1);
- }
-
- inline void setWidth(int width) { setWidth(numRects, width); }
- inline void setHeight(int height) { setHeight(numRects, height); }
- inline void setX(int x) { setX(numRects, x); }
- inline void setY(int y) { setY(numRects, y); }
- void next();
-};
-
-template <class SRC>
-class QRfbMultiColorHextile
-{
-public:
- QRfbMultiColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
- bool read(const uchar *data, int width, int height, int stride);
- void write(QTcpSocket *socket) const;
-
-private:
- inline quint8* rect(int r) {
- return rects.data() + r * (bpp + 2);
- }
- inline const quint8* rect(int r) const {
- return rects.constData() + r * (bpp + 2);
- }
- inline void setX(int r, int x) {
- quint8 *ptr = rect(r) + bpp;
- *ptr = (x << 4) | (*ptr & 0x0f);
- }
- inline void setY(int r, int y) {
- quint8 *ptr = rect(r) + bpp;
- *ptr = (*ptr & 0xf0) | y;
- }
- void setColor(SRC color);
- inline int rectx(int r) const {
- const quint8 *ptr = rect(r) + bpp;
- return *ptr >> 4;
- }
- inline int recty(int r) const {
- const quint8 *ptr = rect(r) + bpp;
- return *ptr & 0x0f;
- }
- inline void setWidth(int r, int width) {
- quint8 *ptr = rect(r) + bpp + 1;
- *ptr = ((width - 1) << 4) | (*ptr & 0x0f);
- }
- inline void setHeight(int r, int height) {
- quint8 *ptr = rect(r) + bpp + 1;
- *ptr = (*ptr & 0xf0) | (height - 1);
- }
-
- bool beginRect();
- void endRect();
-
- static const int maxRectsSize = 16 * 16;
- QVarLengthArray<quint8, maxRectsSize> rects;
-
- quint8 bpp;
- quint8 numRects;
- QRfbHextileEncoder<SRC> *encoder;
-};
-
-template <class SRC>
-class QRfbHextileEncoder : public QRfbEncoder
-{
-public:
- QRfbHextileEncoder(QVNCServer *s);
- void write();
-
-private:
- enum SubEncoding {
- Raw = 1,
- BackgroundSpecified = 2,
- ForegroundSpecified = 4,
- AnySubrects = 8,
- SubrectsColoured = 16
- };
-
- QByteArray buffer;
- QRfbSingleColorHextile<SRC> singleColorHextile;
- QRfbDualColorHextile<SRC> dualColorHextile;
- QRfbMultiColorHextile<SRC> multiColorHextile;
-
- SRC bg;
- SRC fg;
- bool newBg;
- bool newFg;
-
- friend class QRfbSingleColorHextile<SRC>;
- friend class QRfbDualColorHextile<SRC>;
- friend class QRfbMultiColorHextile<SRC>;
-};
-
-class QVNCServer : public QObject
-{
- Q_OBJECT
-public:
- QVNCServer(QVNCScreen *screen);
- QVNCServer(QVNCScreen *screen, int id);
- ~QVNCServer();
-
- void setDirty();
- void setDirtyCursor() { dirtyCursor = true; setDirty(); }
- inline bool isConnected() const { return state == Connected; }
- inline void setRefreshRate(int rate) { refreshRate = rate; }
-
- enum ClientMsg { SetPixelFormat = 0,
- FixColourMapEntries = 1,
- SetEncodings = 2,
- FramebufferUpdateRequest = 3,
- KeyEvent = 4,
- PointerEvent = 5,
- ClientCutText = 6 };
-
- enum ServerMsg { FramebufferUpdate = 0,
- SetColourMapEntries = 1 };
-
- void convertPixels(char *dst, const char *src, int count) const;
-
- inline int clientBytesPerPixel() const {
- return pixelFormat.bitsPerPixel / 8;
- }
-
- inline QVNCScreen* screen() const { return qvnc_screen; }
- inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->d_ptr->dirty; }
- inline QTcpSocket* clientSocket() const { return client; }
- QImage screenImage() const;
- inline bool doPixelConversion() const { return needConversion; }
-#ifndef QT_NO_QWS_CURSOR
- inline bool hasClientCursor() const { return qvnc_cursor != 0; }
-#endif
-
-private:
- void setPixelFormat();
- void setEncodings();
- void frameBufferUpdateRequest();
- void pointerEvent();
- void keyEvent();
- void clientCutText();
- bool pixelConversionNeeded() const;
-
-private slots:
- void newConnection();
- void readClient();
- void checkUpdate();
- void discardClient();
-
-private:
- void init(uint port);
- enum ClientState { Unconnected, Protocol, Init, Connected };
- QTimer *timer;
- QTcpServer *serverSocket;
- QTcpSocket *client;
- ClientState state;
- quint8 msgType;
- bool handleMsg;
- QRfbPixelFormat pixelFormat;
- Qt::KeyboardModifiers keymod;
- int encodingsPending;
- int cutTextPending;
- uint supportCopyRect : 1;
- uint supportRRE : 1;
- uint supportCoRRE : 1;
- uint supportHextile : 1;
- uint supportZRLE : 1;
- uint supportCursor : 1;
- uint supportDesktopSize : 1;
- bool wantUpdate;
- bool sameEndian;
- bool needConversion;
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- bool swapBytes;
-#endif
- bool dirtyCursor;
- int refreshRate;
- QVNCScreen *qvnc_screen;
-#ifndef QT_NO_QWS_CURSOR
- QVNCClientCursor *qvnc_cursor;
-#endif
-
- QRfbEncoder *encoder;
-};
-
-
-QT_END_NAMESPACE
-#endif // QT_NO_QWS_VNC
-#endif // QSCREENVNC_P_H
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
deleted file mode 100644
index 63e06659aa..0000000000
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
+++ /dev/null
@@ -1,2338 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscreenvnc_qws.h"
-
-#ifndef QT_NO_QWS_VNC
-
-#include "qscreenvnc_p.h"
-#include "qwindowsystem_qws.h"
-#include "qwsdisplay_qws.h"
-#include "qscreendriverfactory_qws.h"
-#include <QtCore/qtimer.h>
-#include <QtCore/qregexp.h>
-#include <QtGui/qwidget.h>
-#include <QtGui/qpolygon.h>
-#include <QtGui/qpainter.h>
-#include <qdebug.h>
-#include <private/qwindowsurface_qws_p.h>
-#include <private/qwssignalhandler_p.h>
-#include <private/qwidget_p.h>
-#include <private/qdrawhelper_p.h>
-
-#include <stdlib.h>
-
-QT_BEGIN_NAMESPACE
-
-//#define QT_QWS_VNC_DEBUG
-
-extern QString qws_qtePipeFilename();
-
-#ifndef QT_NO_QWS_CURSOR
-
-QVNCCursor::QVNCCursor(QVNCScreen *s)
- : screen(s)
-{
- if (qt_screencursor)
- setScreenCursor(qt_screencursor);
- else
- hwaccel = true;
-}
-
-QVNCCursor::~QVNCCursor()
-{
- if (screenCursor())
- qt_screencursor = screenCursor();
-}
-
-void QVNCCursor::setDirty(const QRect &r) const
-{
- screen->d_ptr->setDirty(r, true);
-}
-
-void QVNCCursor::hide()
-{
- QProxyScreenCursor::hide();
- if (enable)
- setDirty(boundingRect());
-}
-
-void QVNCCursor::show()
-{
- QProxyScreenCursor::show();
- if (enable)
- setDirty(boundingRect());
-}
-
-void QVNCCursor::set(const QImage &image, int hotx, int hoty)
-{
- QRegion dirty = boundingRect();
- QProxyScreenCursor::set(image, hotx, hoty);
- dirty |= boundingRect();
- if (enable && hwaccel && !screen->d_ptr->vncServer->hasClientCursor()) {
- const QVector<QRect> rects = dirty.rects();
- for (int i = 0; i < rects.size(); ++i)
- setDirty(rects.at(i));
- }
-}
-
-void QVNCCursor::move(int x, int y)
-{
- if (enable && hwaccel && !screen->d_ptr->vncServer->hasClientCursor()) {
- QRegion dirty = boundingRect();
- QProxyScreenCursor::move(x, y);
- dirty |= boundingRect();
- if (enable) {
- const QVector<QRect> rects = dirty.rects();
- for (int i = 0; i < rects.size(); ++i)
- setDirty(rects.at(i));
- }
- } else {
- QProxyScreenCursor::move(x, y);
- }
-}
-
-QVNCClientCursor::QVNCClientCursor(QVNCServer *s)
- : server(s)
-{
- setScreenCursor(qt_screencursor);
- Q_ASSERT(hwaccel);
- qt_screencursor = this; // hw: XXX
-
- set(image(), hotspot.x(), hotspot.y());
-}
-
-QVNCClientCursor::~QVNCClientCursor()
-{
- qt_screencursor = screenCursor();
-}
-
-void QVNCClientCursor::set(const QImage &image, int hotx, int hoty)
-{
- QScreenCursor::set(image, hotx, hoty);
- server->setDirtyCursor();
-}
-
-void QVNCClientCursor::write() const
-{
- QTcpSocket *socket = server->clientSocket();
-
- // FramebufferUpdate header
- {
- const quint16 tmp[6] = { htons(0),
- htons(1),
- htons(hotspot.x()), htons(hotspot.y()),
- htons(cursor.width()),
- htons(cursor.height()) };
- socket->write((char*)tmp, sizeof(tmp));
-
- const quint32 encoding = htonl(-239);
- socket->write((char*)(&encoding), sizeof(encoding));
- }
-
- if (cursor.isNull())
- return;
-
- // write pixels
- Q_ASSERT(cursor.hasAlphaChannel());
- const QImage img = cursor.convertToFormat(server->screen()->pixelFormat());
- const int n = server->clientBytesPerPixel() * img.width();
- char *buffer = new char[n];
- for (int i = 0; i < img.height(); ++i) {
- server->convertPixels(buffer, (const char*)img.scanLine(i), img.width());
- socket->write(buffer, n);
- }
- delete[] buffer;
-
- // write mask
- const QImage bitmap = cursor.createAlphaMask().convertToFormat(QImage::Format_Mono);
- Q_ASSERT(bitmap.depth() == 1);
- Q_ASSERT(bitmap.size() == img.size());
- const int width = (bitmap.width() + 7) / 8;
- for (int i = 0; i < bitmap.height(); ++i)
- socket->write((const char*)bitmap.scanLine(i), width);
-}
-
-#endif // QT_NO_QWS_CURSOR
-
-QVNCScreenPrivate::QVNCScreenPrivate(QVNCScreen *parent)
- : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25),
- vncServer(0), q_ptr(parent), noDisablePainting(false)
-{
-#ifdef QT_BUILD_INTERNAL
- noDisablePainting = (qgetenv("QT_VNC_NO_DISABLEPAINTING").toInt() > 0);
-#endif
-#ifndef QT_NO_QWS_SIGNALHANDLER
- QWSSignalHandler::instance()->addObject(this);
-#endif
-}
-
-QVNCScreenPrivate::~QVNCScreenPrivate()
-{
-#if defined(QT_NO_QWS_MULTIPROCESS) || defined(QT_NO_SHAREDMEMORY)
- if (q_ptr->screen())
- return;
-
- delete[] q_ptr->data;
- q_ptr->data = 0;
-#else
- shm.detach();
-#endif
-}
-
-void QVNCScreenPrivate::configure()
-{
- if (q_ptr->screen())
- return;
-
- q_ptr->lstep = q_ptr->dw * ((q_ptr->d + 7) / 8);
- q_ptr->size = q_ptr->h * q_ptr->lstep;
- q_ptr->mapsize = q_ptr->size;
- q_ptr->physWidth = qRound(q_ptr->dw * qreal(25.4) / dpiX);
- q_ptr->physHeight = qRound(q_ptr->dh * qreal(25.4) / dpiY);
-
- switch (q_ptr->d) {
- case 1:
- q_ptr->setPixelFormat(QImage::Format_Mono); //### LSB???
- break;
- case 8:
- q_ptr->setPixelFormat(QImage::Format_Indexed8);
- break;
- case 12:
- q_ptr->setPixelFormat(QImage::Format_RGB444);
- break;
- case 15:
- q_ptr->setPixelFormat(QImage::Format_RGB555);
- break;
- case 16:
- q_ptr->setPixelFormat(QImage::Format_RGB16);
- break;
- case 18:
- q_ptr->setPixelFormat(QImage::Format_RGB666);
- break;
- case 24:
- q_ptr->setPixelFormat(QImage::Format_RGB888);
- break;
- case 32:
- q_ptr->setPixelFormat(QImage::Format_ARGB32_Premultiplied);
- break;
- }
-
-#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY)
- if (q_ptr->size != shm.size()) {
- shm.detach();
- const QString key = qws_qtePipeFilename() +
- QString().sprintf("_vnc_%d_%d",
- q_ptr->displayId, q_ptr->size);
- shm.setKey(key);
- if (QApplication::type() == QApplication::GuiServer) {
- if (!shm.create(q_ptr->size)) {
- qWarning() << "QVNCScreen could not create shared memory:"
- << shm.errorString();
- if (!shm.attach()) {
- qWarning() << "QVNCScreen could not attach to shared memory:"
- << shm.errorString();
- }
- }
- } else if (!shm.attach()) {
- qWarning() << "QVNCScreen could not attach to shared memory:"
- << shm.errorString();
- }
- q_ptr->data = reinterpret_cast<uchar*>(shm.data());
- }
-#else
- if (q_ptr->data)
- delete[] q_ptr->data;
- q_ptr->data = new uchar[q_ptr->size];
-#endif
-}
-
-//===========================================================================
-
-static const struct {
- int keysym;
- int keycode;
-} keyMap[] = {
- { 0xff08, Qt::Key_Backspace },
- { 0xff09, Qt::Key_Tab },
- { 0xff0d, Qt::Key_Return },
- { 0xff1b, Qt::Key_Escape },
- { 0xff63, Qt::Key_Insert },
- { 0xffff, Qt::Key_Delete },
- { 0xff50, Qt::Key_Home },
- { 0xff57, Qt::Key_End },
- { 0xff55, Qt::Key_PageUp },
- { 0xff56, Qt::Key_PageDown },
- { 0xff51, Qt::Key_Left },
- { 0xff52, Qt::Key_Up },
- { 0xff53, Qt::Key_Right },
- { 0xff54, Qt::Key_Down },
- { 0xffbe, Qt::Key_F1 },
- { 0xffbf, Qt::Key_F2 },
- { 0xffc0, Qt::Key_F3 },
- { 0xffc1, Qt::Key_F4 },
- { 0xffc2, Qt::Key_F5 },
- { 0xffc3, Qt::Key_F6 },
- { 0xffc4, Qt::Key_F7 },
- { 0xffc5, Qt::Key_F8 },
- { 0xffc6, Qt::Key_F9 },
- { 0xffc7, Qt::Key_F10 },
- { 0xffc8, Qt::Key_F11 },
- { 0xffc9, Qt::Key_F12 },
- { 0xffe1, Qt::Key_Shift },
- { 0xffe2, Qt::Key_Shift },
- { 0xffe3, Qt::Key_Control },
- { 0xffe4, Qt::Key_Control },
- { 0xffe7, Qt::Key_Meta },
- { 0xffe8, Qt::Key_Meta },
- { 0xffe9, Qt::Key_Alt },
- { 0xffea, Qt::Key_Alt },
-
- { 0xffb0, Qt::Key_0 },
- { 0xffb1, Qt::Key_1 },
- { 0xffb2, Qt::Key_2 },
- { 0xffb3, Qt::Key_3 },
- { 0xffb4, Qt::Key_4 },
- { 0xffb5, Qt::Key_5 },
- { 0xffb6, Qt::Key_6 },
- { 0xffb7, Qt::Key_7 },
- { 0xffb8, Qt::Key_8 },
- { 0xffb9, Qt::Key_9 },
-
- { 0xff8d, Qt::Key_Return },
- { 0xffaa, Qt::Key_Asterisk },
- { 0xffab, Qt::Key_Plus },
- { 0xffad, Qt::Key_Minus },
- { 0xffae, Qt::Key_Period },
- { 0xffaf, Qt::Key_Slash },
-
- { 0xff95, Qt::Key_Home },
- { 0xff96, Qt::Key_Left },
- { 0xff97, Qt::Key_Up },
- { 0xff98, Qt::Key_Right },
- { 0xff99, Qt::Key_Down },
- { 0xff9a, Qt::Key_PageUp },
- { 0xff9b, Qt::Key_PageDown },
- { 0xff9c, Qt::Key_End },
- { 0xff9e, Qt::Key_Insert },
- { 0xff9f, Qt::Key_Delete },
-
- { 0, 0 }
-};
-
-void QRfbRect::read(QTcpSocket *s)
-{
- quint16 buf[4];
- s->read((char*)buf, 8);
- x = ntohs(buf[0]);
- y = ntohs(buf[1]);
- w = ntohs(buf[2]);
- h = ntohs(buf[3]);
-}
-
-void QRfbRect::write(QTcpSocket *s) const
-{
- quint16 buf[4];
- buf[0] = htons(x);
- buf[1] = htons(y);
- buf[2] = htons(w);
- buf[3] = htons(h);
- s->write((char*)buf, 8);
-}
-
-void QRfbPixelFormat::read(QTcpSocket *s)
-{
- char buf[16];
- s->read(buf, 16);
- bitsPerPixel = buf[0];
- depth = buf[1];
- bigEndian = buf[2];
- trueColor = buf[3];
-
- quint16 a = ntohs(*(quint16 *)(buf + 4));
- redBits = 0;
- while (a) { a >>= 1; redBits++; }
-
- a = ntohs(*(quint16 *)(buf + 6));
- greenBits = 0;
- while (a) { a >>= 1; greenBits++; }
-
- a = ntohs(*(quint16 *)(buf + 8));
- blueBits = 0;
- while (a) { a >>= 1; blueBits++; }
-
- redShift = buf[10];
- greenShift = buf[11];
- blueShift = buf[12];
-}
-
-void QRfbPixelFormat::write(QTcpSocket *s)
-{
- char buf[16];
- buf[0] = bitsPerPixel;
- buf[1] = depth;
- buf[2] = bigEndian;
- buf[3] = trueColor;
-
- quint16 a = 0;
- for (int i = 0; i < redBits; i++) a = (a << 1) | 1;
- *(quint16 *)(buf + 4) = htons(a);
-
- a = 0;
- for (int i = 0; i < greenBits; i++) a = (a << 1) | 1;
- *(quint16 *)(buf + 6) = htons(a);
-
- a = 0;
- for (int i = 0; i < blueBits; i++) a = (a << 1) | 1;
- *(quint16 *)(buf + 8) = htons(a);
-
- buf[10] = redShift;
- buf[11] = greenShift;
- buf[12] = blueShift;
- s->write(buf, 16);
-}
-
-
-void QRfbServerInit::setName(const char *n)
-{
- delete[] name;
- name = new char [strlen(n) + 1];
- strcpy(name, n);
-}
-
-void QRfbServerInit::read(QTcpSocket *s)
-{
- s->read((char *)&width, 2);
- width = ntohs(width);
- s->read((char *)&height, 2);
- height = ntohs(height);
- format.read(s);
-
- quint32 len;
- s->read((char *)&len, 4);
- len = ntohl(len);
-
- name = new char [len + 1];
- s->read(name, len);
- name[len] = '\0';
-}
-
-void QRfbServerInit::write(QTcpSocket *s)
-{
- quint16 t = htons(width);
- s->write((char *)&t, 2);
- t = htons(height);
- s->write((char *)&t, 2);
- format.write(s);
- quint32 len = strlen(name);
- len = htonl(len);
- s->write((char *)&len, 4);
- s->write(name, strlen(name));
-}
-
-bool QRfbSetEncodings::read(QTcpSocket *s)
-{
- if (s->bytesAvailable() < 3)
- return false;
-
- char tmp;
- s->read(&tmp, 1); // padding
- s->read((char *)&count, 2);
- count = ntohs(count);
-
- return true;
-}
-
-bool QRfbFrameBufferUpdateRequest::read(QTcpSocket *s)
-{
- if (s->bytesAvailable() < 9)
- return false;
-
- s->read(&incremental, 1);
- rect.read(s);
-
- return true;
-}
-
-bool QRfbKeyEvent::read(QTcpSocket *s)
-{
- if (s->bytesAvailable() < 7)
- return false;
-
- s->read(&down, 1);
- quint16 tmp;
- s->read((char *)&tmp, 2); // padding
-
- quint32 key;
- s->read((char *)&key, 4);
- key = ntohl(key);
-
- unicode = 0;
- keycode = 0;
- int i = 0;
- while (keyMap[i].keysym && !keycode) {
- if (keyMap[i].keysym == (int)key)
- keycode = keyMap[i].keycode;
- i++;
- }
-
- if (keycode >= ' ' && keycode <= '~')
- unicode = keycode;
-
- if (!keycode) {
- if (key <= 0xff) {
- unicode = key;
- if (key >= 'a' && key <= 'z')
- keycode = Qt::Key_A + key - 'a';
- else if (key >= ' ' && key <= '~')
- keycode = Qt::Key_Space + key - ' ';
- }
- }
-
- return true;
-}
-
-bool QRfbPointerEvent::read(QTcpSocket *s)
-{
- if (s->bytesAvailable() < 5)
- return false;
-
- char buttonMask;
- s->read(&buttonMask, 1);
- buttons = 0;
- if (buttonMask & 1)
- buttons |= Qt::LeftButton;
- if (buttonMask & 2)
- buttons |= Qt::MidButton;
- if (buttonMask & 4)
- buttons |= Qt::RightButton;
-
- quint16 tmp;
- s->read((char *)&tmp, 2);
- x = ntohs(tmp);
- s->read((char *)&tmp, 2);
- y = ntohs(tmp);
-
- return true;
-}
-
-bool QRfbClientCutText::read(QTcpSocket *s)
-{
- if (s->bytesAvailable() < 7)
- return false;
-
- char tmp[3];
- s->read(tmp, 3); // padding
- s->read((char *)&length, 4);
- length = ntohl(length);
-
- return true;
-}
-
-//===========================================================================
-
-QVNCServer::QVNCServer(QVNCScreen *screen)
- : qvnc_screen(screen)
-{
- init(5900);
-}
-
-QVNCServer::QVNCServer(QVNCScreen *screen, int id)
- : qvnc_screen(screen)
-{
- init(5900 + id);
-}
-
-void QVNCServer::init(uint port)
-{
- handleMsg = false;
- client = 0;
- encodingsPending = 0;
- cutTextPending = 0;
- keymod = 0;
- state = Unconnected;
- dirtyCursor = false;
-
- refreshRate = 25;
- timer = new QTimer(this);
- timer->setSingleShot(true);
- connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
-
- serverSocket = new QTcpServer(this);
- if (!serverSocket->listen(QHostAddress::Any, port))
- qDebug() << "QVNCServer could not connect:" << serverSocket->errorString();
- else
- qDebug("QVNCServer created on port %d", port);
-
- connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection()));
-
-#ifndef QT_NO_QWS_CURSOR
- qvnc_cursor = 0;
-#endif
- encoder = 0;
-}
-
-QVNCServer::~QVNCServer()
-{
- delete encoder;
- encoder = 0;
- delete client;
- client = 0;
-#ifndef QT_NO_QWS_CURSOR
- delete qvnc_cursor;
- qvnc_cursor = 0;
-#endif
-}
-
-void QVNCServer::setDirty()
-{
- if (state == Connected && !timer->isActive() &&
- ((dirtyMap()->numDirty > 0) || dirtyCursor)) {
- timer->start();
- }
-}
-
-void QVNCServer::newConnection()
-{
- if (client)
- delete client;
-
- client = serverSocket->nextPendingConnection();
- connect(client,SIGNAL(readyRead()),this,SLOT(readClient()));
- connect(client,SIGNAL(disconnected()),this,SLOT(discardClient()));
- handleMsg = false;
- encodingsPending = 0;
- cutTextPending = 0;
- supportHextile = false;
- wantUpdate = false;
-
- timer->start(1000 / refreshRate);
- dirtyMap()->reset();
-
- // send protocol version
- const char *proto = "RFB 003.003\n";
- client->write(proto, 12);
- state = Protocol;
-
- if (!qvnc_screen->screen() && !qvnc_screen->d_ptr->noDisablePainting)
- QWSServer::instance()->enablePainting(true);
-}
-
-void QVNCServer::readClient()
-{
- switch (state) {
- case Protocol:
- if (client->bytesAvailable() >= 12) {
- char proto[13];
- client->read(proto, 12);
- proto[12] = '\0';
- qDebug("Client protocol version %s", proto);
- // No authentication
- quint32 auth = htonl(1);
- client->write((char *) &auth, sizeof(auth));
- state = Init;
- }
- break;
-
- case Init:
- if (client->bytesAvailable() >= 1) {
- quint8 shared;
- client->read((char *) &shared, 1);
-
- // Server Init msg
- QRfbServerInit sim;
- QRfbPixelFormat &format = sim.format;
- switch (qvnc_screen->depth()) {
- case 32:
- format.bitsPerPixel = 32;
- format.depth = 32;
- format.bigEndian = 0;
- format.trueColor = true;
- format.redBits = 8;
- format.greenBits = 8;
- format.blueBits = 8;
- format.redShift = 16;
- format.greenShift = 8;
- format.blueShift = 0;
- break;
-
- case 24:
- format.bitsPerPixel = 24;
- format.depth = 24;
- format.bigEndian = 0;
- format.trueColor = true;
- format.redBits = 8;
- format.greenBits = 8;
- format.blueBits = 8;
- format.redShift = 16;
- format.greenShift = 8;
- format.blueShift = 0;
- break;
-
- case 18:
- format.bitsPerPixel = 24;
- format.depth = 18;
- format.bigEndian = 0;
- format.trueColor = true;
- format.redBits = 6;
- format.greenBits = 6;
- format.blueBits = 6;
- format.redShift = 12;
- format.greenShift = 6;
- format.blueShift = 0;
- break;
-
- case 16:
- format.bitsPerPixel = 16;
- format.depth = 16;
- format.bigEndian = 0;
- format.trueColor = true;
- format.redBits = 5;
- format.greenBits = 6;
- format.blueBits = 5;
- format.redShift = 11;
- format.greenShift = 5;
- format.blueShift = 0;
- break;
-
- case 15:
- format.bitsPerPixel = 16;
- format.depth = 15;
- format.bigEndian = 0;
- format.trueColor = true;
- format.redBits = 5;
- format.greenBits = 5;
- format.blueBits = 5;
- format.redShift = 10;
- format.greenShift = 5;
- format.blueShift = 0;
- break;
-
- case 12:
- format.bitsPerPixel = 16;
- format.depth = 12;
- format.bigEndian = 0;
- format.trueColor = true;
- format.redBits = 4;
- format.greenBits = 4;
- format.blueBits = 4;
- format.redShift = 8;
- format.greenShift = 4;
- format.blueShift = 0;
- break;
-
- case 8:
- case 4:
- format.bitsPerPixel = 8;
- format.depth = 8;
- format.bigEndian = 0;
- format.trueColor = false;
- format.redBits = 0;
- format.greenBits = 0;
- format.blueBits = 0;
- format.redShift = 0;
- format.greenShift = 0;
- format.blueShift = 0;
- break;
-
- default:
- qDebug("QVNC cannot drive depth %d", qvnc_screen->depth());
- discardClient();
- return;
- }
- sim.width = qvnc_screen->deviceWidth();
- sim.height = qvnc_screen->deviceHeight();
- sim.setName("Qt for Embedded Linux VNC Server");
- sim.write(client);
- state = Connected;
- }
- break;
-
- case Connected:
- do {
- if (!handleMsg) {
- client->read((char *)&msgType, 1);
- handleMsg = true;
- }
- if (handleMsg) {
- switch (msgType ) {
- case SetPixelFormat:
- setPixelFormat();
- break;
- case FixColourMapEntries:
- qDebug("Not supported: FixColourMapEntries");
- handleMsg = false;
- break;
- case SetEncodings:
- setEncodings();
- break;
- case FramebufferUpdateRequest:
- frameBufferUpdateRequest();
- break;
- case KeyEvent:
- keyEvent();
- break;
- case PointerEvent:
- pointerEvent();
- break;
- case ClientCutText:
- clientCutText();
- break;
- default:
- qDebug("Unknown message type: %d", (int)msgType);
- handleMsg = false;
- }
- }
- } while (!handleMsg && client->bytesAvailable());
- break;
- default:
- break;
- }
-}
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-bool QVNCScreen::swapBytes() const
-{
- if (depth() != 16)
- return false;
-
- if (screen())
- return screen()->frameBufferLittleEndian();
- return frameBufferLittleEndian();
-}
-#endif
-
-void QVNCServer::setPixelFormat()
-{
- if (client->bytesAvailable() >= 19) {
- char buf[3];
- client->read(buf, 3); // just padding
- pixelFormat.read(client);
-#ifdef QT_QWS_VNC_DEBUG
- qDebug("Want format: %d %d %d %d %d %d %d %d %d %d",
- int(pixelFormat.bitsPerPixel),
- int(pixelFormat.depth),
- int(pixelFormat.bigEndian),
- int(pixelFormat.trueColor),
- int(pixelFormat.redBits),
- int(pixelFormat.greenBits),
- int(pixelFormat.blueBits),
- int(pixelFormat.redShift),
- int(pixelFormat.greenShift),
- int(pixelFormat.blueShift));
-#endif
- if (!pixelFormat.trueColor) {
- qDebug("Can only handle true color clients");
- discardClient();
- }
- handleMsg = false;
- sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!pixelFormat.bigEndian;
- needConversion = pixelConversionNeeded();
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- swapBytes = qvnc_screen->swapBytes();
-#endif
- }
-}
-
-void QVNCServer::setEncodings()
-{
- QRfbSetEncodings enc;
-
- if (!encodingsPending && enc.read(client)) {
- encodingsPending = enc.count;
- if (!encodingsPending)
- handleMsg = false;
- }
-
- if (encoder) {
- delete encoder;
- encoder = 0;
- }
-
- enum Encodings {
- Raw = 0,
- CopyRect = 1,
- RRE = 2,
- CoRRE = 4,
- Hextile = 5,
- ZRLE = 16,
- Cursor = -239,
- DesktopSize = -223
- };
-
- if (encodingsPending && (unsigned)client->bytesAvailable() >=
- encodingsPending * sizeof(quint32)) {
- for (int i = 0; i < encodingsPending; ++i) {
- qint32 enc;
- client->read((char *)&enc, sizeof(qint32));
- enc = ntohl(enc);
-#ifdef QT_QWS_VNC_DEBUG
- qDebug("QVNCServer::setEncodings: %d", enc);
-#endif
- switch (enc) {
- case Raw:
- if (!encoder) {
- encoder = new QRfbRawEncoder(this);
-#ifdef QT_QWS_VNC_DEBUG
- qDebug("QVNCServer::setEncodings: using raw");
-#endif
- }
- break;
- case CopyRect:
- supportCopyRect = true;
- break;
- case RRE:
- supportRRE = true;
- break;
- case CoRRE:
- supportCoRRE = true;
- break;
- case Hextile:
- supportHextile = true;
- if (encoder)
- break;
- switch (qvnc_screen->depth()) {
-#ifdef QT_QWS_DEPTH_8
- case 8:
- encoder = new QRfbHextileEncoder<quint8>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_12
- case 12:
- encoder = new QRfbHextileEncoder<qrgb444>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_15
- case 15:
- encoder = new QRfbHextileEncoder<qrgb555>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_16
- case 16:
- encoder = new QRfbHextileEncoder<quint16>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_18
- case 18:
- encoder = new QRfbHextileEncoder<qrgb666>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_24
- case 24:
- encoder = new QRfbHextileEncoder<qrgb888>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_32
- case 32:
- encoder = new QRfbHextileEncoder<quint32>(this);
- break;
-#endif
- default:
- break;
- }
-#ifdef QT_QWS_VNC_DEBUG
- qDebug("QVNCServer::setEncodings: using hextile");
-#endif
- break;
- case ZRLE:
- supportZRLE = true;
- break;
- case Cursor:
- supportCursor = true;
-#ifndef QT_NO_QWS_CURSOR
- if (!qvnc_screen->screen() || qt_screencursor->isAccelerated()) {
- delete qvnc_cursor;
- qvnc_cursor = new QVNCClientCursor(this);
- }
-#endif
- break;
- case DesktopSize:
- supportDesktopSize = true;
- break;
- default:
- break;
- }
- }
- handleMsg = false;
- encodingsPending = 0;
- }
-
- if (!encoder) {
- encoder = new QRfbRawEncoder(this);
-#ifdef QT_QWS_VNC_DEBUG
- qDebug("QVNCServer::setEncodings: fallback using raw");
-#endif
- }
-}
-
-void QVNCServer::frameBufferUpdateRequest()
-{
- QRfbFrameBufferUpdateRequest ev;
-
- if (ev.read(client)) {
- if (!ev.incremental) {
- QRect r(ev.rect.x, ev.rect.y, ev.rect.w, ev.rect.h);
- r.translate(qvnc_screen->offset());
- qvnc_screen->d_ptr->setDirty(r, true);
- }
- wantUpdate = true;
- checkUpdate();
- handleMsg = false;
- }
-}
-
-void QVNCServer::pointerEvent()
-{
- QRfbPointerEvent ev;
- if (ev.read(client)) {
- const QPoint offset = qvnc_screen->offset();
- QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons);
- handleMsg = false;
- }
-}
-
-void QVNCServer::keyEvent()
-{
- QRfbKeyEvent ev;
-
- if (ev.read(client)) {
- if (ev.keycode == Qt::Key_Shift)
- keymod = ev.down ? keymod | Qt::ShiftModifier :
- keymod & ~Qt::ShiftModifier;
- else if (ev.keycode == Qt::Key_Control)
- keymod = ev.down ? keymod | Qt::ControlModifier :
- keymod & ~Qt::ControlModifier;
- else if (ev.keycode == Qt::Key_Alt)
- keymod = ev.down ? keymod | Qt::AltModifier :
- keymod & ~Qt::AltModifier;
- if (ev.unicode || ev.keycode)
- QWSServer::sendKeyEvent(ev.unicode, ev.keycode, keymod, ev.down, false);
- handleMsg = false;
- }
-}
-
-void QVNCServer::clientCutText()
-{
- QRfbClientCutText ev;
-
- if (cutTextPending == 0 && ev.read(client)) {
- cutTextPending = ev.length;
- if (!cutTextPending)
- handleMsg = false;
- }
-
- if (cutTextPending && client->bytesAvailable() >= cutTextPending) {
- char *text = new char [cutTextPending+1];
- client->read(text, cutTextPending);
- delete [] text;
- cutTextPending = 0;
- handleMsg = false;
- }
-}
-
-// stride in bytes
-template <class SRC>
-bool QRfbSingleColorHextile<SRC>::read(const uchar *data,
- int width, int height, int stride)
-{
- const int depth = encoder->server->screen()->depth();
- if (width % (depth / 8)) // hw: should rather fallback to simple loop
- return false;
-
- static int alwaysFalse = qgetenv("QT_VNC_NOCHECKFILL").toInt();
- if (alwaysFalse)
- return false;
-
- switch (depth) {
- case 4: {
- const quint8 *data8 = reinterpret_cast<const quint8*>(data);
- if ((data8[0] & 0xf) != (data8[0] >> 4))
- return false;
- width /= 2;
- } // fallthrough
- case 8: {
- const quint8 *data8 = reinterpret_cast<const quint8*>(data);
- if (data8[0] != data8[1])
- return false;
- width /= 2;
- } // fallthrough
- case 12:
- case 15:
- case 16: {
- const quint16 *data16 = reinterpret_cast<const quint16*>(data);
- if (data16[0] != data16[1])
- return false;
- width /= 2;
- } // fallthrough
- case 18:
- case 24:
- case 32: {
- const quint32 *data32 = reinterpret_cast<const quint32*>(data);
- const quint32 first = data32[0];
- const int linestep = (stride / sizeof(quint32)) - width;
- for (int y = 0; y < height; ++y) {
- for (int x = 0; x < width; ++x) {
- if (*(data32++) != first)
- return false;
- }
- data32 += linestep;
- }
- break;
- }
- default:
- return false;
- }
-
- SRC color = reinterpret_cast<const SRC*>(data)[0];
- encoder->newBg |= (color != encoder->bg);
- encoder->bg = color;
- return true;
-}
-
-template <class SRC>
-void QRfbSingleColorHextile<SRC>::write(QTcpSocket *socket) const
-{
- if (true || encoder->newBg) {
- const int bpp = encoder->server->clientBytesPerPixel();
- const int padding = 3;
- QVarLengthArray<char> buffer(padding + 1 + bpp);
- buffer[padding] = 2; // BackgroundSpecified
- encoder->server->convertPixels(buffer.data() + padding + 1,
- reinterpret_cast<char*>(&encoder->bg),
- 1);
- socket->write(buffer.data() + padding, bpp + 1);
-// encoder->newBg = false;
- } else {
- char subenc = 0;
- socket->write(&subenc, 1);
- }
-}
-
-template <class SRC>
-bool QRfbDualColorHextile<SRC>::read(const uchar *data,
- int width, int height, int stride)
-{
- const SRC *ptr = reinterpret_cast<const SRC*>(data);
- const int linestep = (stride / sizeof(SRC)) - width;
-
- SRC c1;
- SRC c2 = 0;
- int n1 = 0;
- int n2 = 0;
- int x = 0;
- int y = 0;
-
- c1 = *ptr;
-
- // find second color
- while (y < height) {
- while (x < width) {
- if (*ptr == c1) {
- ++n1;
- } else {
- c2 = *ptr;
- goto found_second_color;
- }
- ++ptr;
- ++x;
- }
- x = 0;
- ptr += linestep;
- ++y;
- }
-
-found_second_color:
- // finish counting
- while (y < height) {
- while (x < width) {
- if (*ptr == c1) {
- ++n1;
- } else if (*ptr == c2) {
- ++n2;
- } else {
- return false;
- }
- ++ptr;
- ++x;
- }
- x = 0;
- ptr += linestep;
- ++y;
- }
-
- if (n2 > n1) {
- const quint32 tmpC = c1;
- c1 = c2;
- c2 = tmpC;
- }
-
- encoder->newBg |= (c1 != encoder->bg);
- encoder->newFg |= (c2 != encoder->fg);
-
- encoder->bg = c1;
- encoder->fg = c2;
-
- // create map
- bool inRect = false;
- numRects = 0;
- ptr = reinterpret_cast<const SRC*>(data);
- for (y = 0; y < height; ++y) {
- for (x = 0; x < width; ++x) {
- if (inRect && *ptr == encoder->bg) {
- // rect finished
- setWidth(x - lastx());
- next();
- inRect = false;
- } else if (!inRect && *ptr == encoder->fg) {
- // rect start
- setX(x);
- setY(y);
- setHeight(1);
- inRect = true;
- }
- ++ptr;
- }
- if (inRect) {
- // finish rect
- setWidth(width - lastx());
- next();
- inRect = false;
- }
- ptr += linestep;
- }
-
- return true;
-}
-
-template <class SRC>
-void QRfbDualColorHextile<SRC>::write(QTcpSocket *socket) const
-{
- const int bpp = encoder->server->clientBytesPerPixel();
- const int padding = 3;
- QVarLengthArray<char> buffer(padding + 2 * bpp + sizeof(char) + sizeof(numRects));
- char &subenc = buffer[padding];
- int n = padding + sizeof(subenc);
-
- subenc = 0x8; // AnySubrects
-
- if (encoder->newBg) {
- subenc |= 0x2; // Background
- encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->bg, 1);
- n += bpp;
-// encoder->newBg = false;
- }
-
- if (encoder->newFg) {
- subenc |= 0x4; // Foreground
- encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->fg, 1);
- n += bpp;
-// encoder->newFg = false;
- }
- buffer[n] = numRects;
- n += sizeof(numRects);
-
- socket->write(buffer.data() + padding, n - padding);
- socket->write((char*)rects, numRects * sizeof(Rect));
-}
-
-template <class SRC>
-void QRfbDualColorHextile<SRC>::next()
-{
- for (int r = numRects - 1; r >= 0; --r) {
- if (recty(r) == lasty())
- continue;
- if (recty(r) < lasty() - 1) // only search previous scanline
- break;
- if (rectx(r) == lastx() && width(r) == width(numRects)) {
- ++rects[r].wh;
- return;
- }
- }
- ++numRects;
-}
-
-template <class SRC>
-inline void QRfbMultiColorHextile<SRC>::setColor(SRC color)
-{
- encoder->server->convertPixels(reinterpret_cast<char*>(rect(numRects)),
- (const char*)&color, 1);
-}
-
-template <class SRC>
-inline bool QRfbMultiColorHextile<SRC>::beginRect()
-{
- if ((rects.size() + bpp + 2) > maxRectsSize)
- return false;
- rects.resize(rects.size() + bpp + 2);
- return true;
-}
-
-template <class SRC>
-inline void QRfbMultiColorHextile<SRC>::endRect()
-{
- setHeight(numRects, 1);
- ++numRects;
-}
-
-template <class SRC>
-bool QRfbMultiColorHextile<SRC>::read(const uchar *data,
- int width, int height, int stride)
-{
- const SRC *ptr = reinterpret_cast<const SRC*>(data);
- const int linestep = (stride / sizeof(SRC)) - width;
-
- bpp = encoder->server->clientBytesPerPixel();
-
- if (encoder->newBg)
- encoder->bg = ptr[0];
-
- const SRC bg = encoder->bg;
- SRC color = bg;
- bool inRect = false;
-
- numRects = 0;
- rects.clear();
-
- for (int y = 0; y < height; ++y) {
- for (int x = 0; x < width; ++x) {
- if (inRect && *ptr != color) { // end rect
- setWidth(numRects, x - rectx(numRects));
- endRect();
- inRect = false;
- }
-
- if (!inRect && *ptr != bg) { // begin rect
- if (!beginRect())
- return false;
- inRect = true;
- color = *ptr;
- setColor(color);
- setX(numRects, x);
- setY(numRects, y);
- }
- ++ptr;
- }
- if (inRect) { // end rect
- setWidth(numRects, width - rectx(numRects));
- endRect();
- inRect = false;
- }
- ptr += linestep;
- }
-
- return true;
-}
-
-template <class SRC>
-void QRfbMultiColorHextile<SRC>::write(QTcpSocket *socket) const
-{
- const int padding = 3;
- QVarLengthArray<quint8> buffer(bpp + padding + sizeof(quint8) + sizeof(numRects));
-
- quint8 &subenc = buffer[padding];
- int n = padding + sizeof(quint8);
-
- subenc = 8 | 16; // AnySubrects | SubrectsColoured
-
- if (encoder->newBg) {
- subenc |= 0x2; // Background
- encoder->server->convertPixels(reinterpret_cast<char*>(buffer.data() + n),
- reinterpret_cast<const char*>(&encoder->bg),
- 1);
- n += bpp;
-// encoder->newBg = false;
- }
-
- buffer[n] = numRects;
- n += sizeof(numRects);
-
- socket->write(reinterpret_cast<const char*>(buffer.data() + padding),
- n - padding);
- socket->write(reinterpret_cast<const char*>(rects.constData()),
- rects.size());
-}
-
-bool QVNCServer::pixelConversionNeeded() const
-{
- if (!sameEndian)
- return true;
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- if (qvnc_screen->swapBytes())
- return true;
-#endif
-
- const int screendepth = qvnc_screen->depth();
- if (screendepth != pixelFormat.bitsPerPixel)
- return true;
-
- switch (screendepth) {
- case 32:
- case 24:
- return false;
- case 18:
- return (pixelFormat.redBits == 6
- && pixelFormat.greenBits == 6
- && pixelFormat.blueBits == 6);
- case 16:
- return (pixelFormat.redBits == 5
- && pixelFormat.greenBits == 6
- && pixelFormat.blueBits == 5);
- case 15:
- return (pixelFormat.redBits == 5
- && pixelFormat.greenBits == 5
- && pixelFormat.blueBits == 5);
- case 12:
- return (pixelFormat.redBits == 4
- && pixelFormat.greenBits == 4
- && pixelFormat.blueBits == 4);
- }
- return true;
-}
-
-// count: number of pixels
-void QVNCServer::convertPixels(char *dst, const char *src, int count) const
-{
- const int screendepth = qvnc_screen->depth();
- const bool isBgr = qvnc_screen->pixelType() == QScreen::BGRPixel;
-
- // cutoffs
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- if (!swapBytes)
-#endif
- if (sameEndian) {
- if (screendepth == pixelFormat.bitsPerPixel) { // memcpy cutoffs
-
- switch (screendepth) {
- case 32:
- memcpy(dst, src, count * sizeof(quint32));
- return;
- case 16:
- if (pixelFormat.redBits == 5
- && pixelFormat.greenBits == 6
- && pixelFormat.blueBits == 5)
- {
- memcpy(dst, src, count * sizeof(quint16));
- return;
- }
- }
- } else if (screendepth == 16 && pixelFormat.bitsPerPixel == 32) {
-#if defined(__i386__) // Currently fails on ARM if dst is not 4 byte aligned
- const quint32 *src32 = reinterpret_cast<const quint32*>(src);
- quint32 *dst32 = reinterpret_cast<quint32*>(dst);
- int count32 = count * sizeof(quint16) / sizeof(quint32);
- while (count32--) {
- const quint32 s = *src32++;
- quint32 result1;
- quint32 result2;
-
- // red
- result1 = ((s & 0xf8000000) | ((s & 0xe0000000) >> 5)) >> 8;
- result2 = ((s & 0x0000f800) | ((s & 0x0000e000) >> 5)) << 8;
-
- // green
- result1 |= ((s & 0x07e00000) | ((s & 0x06000000) >> 6)) >> 11;
- result2 |= ((s & 0x000007e0) | ((s & 0x00000600) >> 6)) << 5;
-
- // blue
- result1 |= ((s & 0x001f0000) | ((s & 0x001c0000) >> 5)) >> 13;
- result2 |= ((s & 0x0000001f) | ((s & 0x0000001c) >> 5)) << 3;
-
- *dst32++ = result2;
- *dst32++ = result1;
- }
- if (count & 0x1) {
- const quint16 *src16 = reinterpret_cast<const quint16*>(src);
- *dst32 = qt_conv16ToRgb(src16[count - 1]);
- }
- return;
-#endif
- }
- }
-
- const int bytesPerPixel = (pixelFormat.bitsPerPixel + 7) / 8;
-
-// nibble = 0;
-
- for (int i = 0; i < count; ++i) {
- int r, g, b;
-
- switch (screendepth) {
-#if 0
- case 4: {
- if (!nibble) {
- r = ((*src) & 0x0f) << 4;
- } else {
- r = (*src) & 0xf0;
- src++;
- }
- nibble = !nibble;
- g = b = r;
- break;
- }
-#endif
- case 8: {
- QRgb rgb = qvnc_screen->clut()[int(*src)];
- r = qRed(rgb);
- g = qGreen(rgb);
- b = qBlue(rgb);
- src++;
- break;
- }
-#ifdef QT_QWS_DEPTH_12
- case 12: {
- quint32 p = quint32(*reinterpret_cast<const qrgb444*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb444);
- break;
- }
-#endif
-#ifdef QT_QWS_DEPTH_15
- case 15: {
- quint32 p = quint32(*reinterpret_cast<const qrgb555*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb555);
- break;
- }
-#endif
- case 16: {
- quint16 p = *reinterpret_cast<const quint16*>(src);
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- if (swapBytes)
- p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8);
-#endif
- r = (p >> 11) & 0x1f;
- g = (p >> 5) & 0x3f;
- b = p & 0x1f;
- r <<= 3;
- g <<= 2;
- b <<= 3;
- src += sizeof(quint16);
- break;
- }
-#ifdef QT_QWS_DEPTH_18
- case 18: {
- quint32 p = quint32(*reinterpret_cast<const qrgb666*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb666);
- break;
- }
-#endif
-#ifdef QT_QWS_DEPTH_24
- case 24: {
- quint32 p = quint32(*reinterpret_cast<const qrgb888*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb888);
- break;
- }
-#endif
- case 32: {
- quint32 p = *reinterpret_cast<const quint32*>(src);
- r = (p >> 16) & 0xff;
- g = (p >> 8) & 0xff;
- b = p & 0xff;
- src += sizeof(quint32);
- break;
- }
- default: {
- r = g = b = 0;
- qDebug("QVNCServer: don't support %dbpp display", screendepth);
- return;
- }
- }
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- if (swapBytes ^ isBgr)
-#else
- if (isBgr)
-#endif
- qSwap(r, b);
-
- r >>= (8 - pixelFormat.redBits);
- g >>= (8 - pixelFormat.greenBits);
- b >>= (8 - pixelFormat.blueBits);
-
- int pixel = (r << pixelFormat.redShift) |
- (g << pixelFormat.greenShift) |
- (b << pixelFormat.blueShift);
-
- if (sameEndian || pixelFormat.bitsPerPixel == 8) {
- memcpy(dst, &pixel, bytesPerPixel); // XXX: do a simple for-loop instead?
- dst += bytesPerPixel;
- continue;
- }
-
-
- if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
- switch (pixelFormat.bitsPerPixel) {
- case 16:
- pixel = (((pixel & 0x0000ff00) << 8) |
- ((pixel & 0x000000ff) << 24));
- break;
- case 32:
- pixel = (((pixel & 0xff000000) >> 24) |
- ((pixel & 0x00ff0000) >> 8) |
- ((pixel & 0x0000ff00) << 8) |
- ((pixel & 0x000000ff) << 24));
- break;
- default:
- qDebug("Cannot handle %d bpp client", pixelFormat.bitsPerPixel);
- }
- } else { // QSysInfo::ByteOrder == QSysInfo::LittleEndian
- switch (pixelFormat.bitsPerPixel) {
- case 16:
- pixel = (((pixel & 0xff000000) >> 8) |
- ((pixel & 0x00ff0000) << 8));
- break;
- case 32:
- pixel = (((pixel & 0xff000000) >> 24) |
- ((pixel & 0x00ff0000) >> 8) |
- ((pixel & 0x0000ff00) << 8) |
- ((pixel & 0x000000ff) << 24));
- break;
- default:
- qDebug("Cannot handle %d bpp client",
- pixelFormat.bitsPerPixel);
- break;
- }
- }
- memcpy(dst, &pixel, bytesPerPixel); // XXX: simple for-loop instead?
- dst += bytesPerPixel;
- }
-}
-
-#ifndef QT_NO_QWS_CURSOR
-static void blendCursor(QImage &image, const QRect &imageRect)
-{
- const QRect cursorRect = qt_screencursor->boundingRect();
- const QRect intersection = (cursorRect & imageRect);
- const QRect destRect = intersection.translated(-imageRect.topLeft());
- const QRect srcRect = intersection.translated(-cursorRect.topLeft());
-
- QPainter painter(&image);
- painter.drawImage(destRect, qt_screencursor->image(), srcRect);
- painter.end();
-}
-#endif // QT_NO_QWS_CURSOR
-
-QVNCDirtyMap::QVNCDirtyMap(QScreen *s)
- : bytesPerPixel(0), numDirty(0), screen(s)
-{
- bytesPerPixel = (screen->depth() + 7) / 8;
- bufferWidth = screen->deviceWidth();
- bufferHeight = screen->deviceHeight();
- bufferStride = bufferWidth * bytesPerPixel;
- buffer = new uchar[bufferHeight * bufferStride];
-
- mapWidth = (bufferWidth + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE;
- mapHeight = (bufferHeight + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE;
- numTiles = mapWidth * mapHeight;
- map = new uchar[numTiles];
-}
-
-QVNCDirtyMap::~QVNCDirtyMap()
-{
- delete[] map;
- delete[] buffer;
-}
-
-void QVNCDirtyMap::reset()
-{
- memset(map, 1, numTiles);
- memset(buffer, 0, bufferHeight * bufferStride);
- numDirty = numTiles;
-}
-
-inline bool QVNCDirtyMap::dirty(int x, int y) const
-{
- return map[y * mapWidth + x];
-}
-
-inline void QVNCDirtyMap::setClean(int x, int y)
-{
- map[y * mapWidth + x] = 0;
- --numDirty;
-}
-
-template <class T>
-void QVNCDirtyMapOptimized<T>::setDirty(int tileX, int tileY, bool force)
-{
- static bool alwaysForce = qgetenv("QT_VNC_NO_COMPAREBUFFER").toInt();
- if (alwaysForce)
- force = true;
-
- bool changed = false;
-
- if (!force) {
- const int lstep = screen->linestep();
- const int startX = tileX * MAP_TILE_SIZE;
- const int startY = tileY * MAP_TILE_SIZE;
- const uchar *scrn = screen->base()
- + startY * lstep + startX * bytesPerPixel;
- uchar *old = buffer + startY * bufferStride + startX * sizeof(T);
-
- const int tileHeight = (startY + MAP_TILE_SIZE > bufferHeight ?
- bufferHeight - startY : MAP_TILE_SIZE);
- const int tileWidth = (startX + MAP_TILE_SIZE > bufferWidth ?
- bufferWidth - startX : MAP_TILE_SIZE);
- const bool doInlines = (tileWidth == MAP_TILE_SIZE);
-
- int y = tileHeight;
-
- if (doInlines) { // hw: memcmp/memcpy is inlined when using constants
- while (y) {
- if (memcmp(old, scrn, sizeof(T) * MAP_TILE_SIZE)) {
- changed = true;
- break;
- }
- scrn += lstep;
- old += bufferStride;
- --y;
- }
-
- while (y) {
- memcpy(old, scrn, sizeof(T) * MAP_TILE_SIZE);
- scrn += lstep;
- old += bufferStride;
- --y;
- }
- } else {
- while (y) {
- if (memcmp(old, scrn, sizeof(T) * tileWidth)) {
- changed = true;
- break;
- }
- scrn += lstep;
- old += bufferStride;
- --y;
- }
-
- while (y) {
- memcpy(old, scrn, sizeof(T) * tileWidth);
- scrn += lstep;
- old += bufferStride;
- --y;
- }
- }
- }
-
- const int mapIndex = tileY * mapWidth + tileX;
- if ((force || changed) && !map[mapIndex]) {
- map[mapIndex] = 1;
- ++numDirty;
- }
-}
-
-template <class SRC>
-QRfbHextileEncoder<SRC>::QRfbHextileEncoder(QVNCServer *s)
- : QRfbEncoder(s),
- singleColorHextile(this), dualColorHextile(this), multiColorHextile(this)
-{
-}
-
-/*
- \internal
- Send dirty rects using hextile encoding.
-*/
-template <class SRC>
-void QRfbHextileEncoder<SRC>::write()
-{
- QWSDisplay::grab(true);
-
- QVNCDirtyMap *map = server->dirtyMap();
- QTcpSocket *socket = server->clientSocket();
-
- const quint32 encoding = htonl(5); // hextile encoding
- const int bytesPerPixel = server->clientBytesPerPixel();
-
- {
- const char tmp[2] = { 0, 0 }; // msg type, padding
- socket->write(tmp, sizeof(tmp));
- }
- {
- const quint16 count = htons(map->numDirty);
- socket->write((char *)&count, sizeof(count));
- }
-
- if (map->numDirty <= 0) {
- QWSDisplay::ungrab();
- return;
- }
-
- newBg = true;
- newFg = true;
-
- const QImage screenImage = server->screenImage();
- QRfbRect rect(0, 0, MAP_TILE_SIZE, MAP_TILE_SIZE);
-
- for (int y = 0; y < map->mapHeight; ++y) {
- if (rect.y + MAP_TILE_SIZE > server->screen()->height())
- rect.h = server->screen()->height() - rect.y;
- rect.w = MAP_TILE_SIZE;
- for (int x = 0; x < map->mapWidth; ++x) {
- if (!map->dirty(x, y))
- continue;
- map->setClean(x, y);
-
- rect.x = x * MAP_TILE_SIZE;
- if (rect.x + MAP_TILE_SIZE > server->screen()->deviceWidth())
- rect.w = server->screen()->deviceWidth() - rect.x;
- rect.write(socket);
-
- socket->write((char *)&encoding, sizeof(encoding));
-
- const uchar *screendata = screenImage.scanLine(rect.y)
- + rect.x * screenImage.depth() / 8;
- int linestep = screenImage.bytesPerLine();
-
-#ifndef QT_NO_QWS_CURSOR
- // hardware cursors must be blended with the screen memory
- const bool doBlendCursor = qt_screencursor
- && !server->hasClientCursor()
- && qt_screencursor->isAccelerated();
- QImage tileImage;
- if (doBlendCursor) {
- const QRect tileRect(rect.x, rect.y, rect.w, rect.h);
- const QRect cursorRect = qt_screencursor->boundingRect()
- .translated(-server->screen()->offset());
- if (tileRect.intersects(cursorRect)) {
- tileImage = screenImage.copy(tileRect);
- blendCursor(tileImage,
- tileRect.translated(server->screen()->offset()));
- screendata = tileImage.bits();
- linestep = tileImage.bytesPerLine();
- }
- }
-#endif // QT_NO_QWS_CURSOR
-
- if (singleColorHextile.read(screendata, rect.w, rect.h, linestep)) {
- singleColorHextile.write(socket);
- } else if (dualColorHextile.read(screendata, rect.w, rect.h, linestep)) {
- dualColorHextile.write(socket);
- } else if (multiColorHextile.read(screendata, rect.w, rect.h, linestep)) {
- multiColorHextile.write(socket);
- } else if (server->doPixelConversion()) {
- const int bufferSize = rect.w * rect.h * bytesPerPixel + 1;
- const int padding = sizeof(quint32) - sizeof(char);
- buffer.resize(bufferSize + padding);
-
- buffer[padding] = 1; // Raw subencoding
-
- // convert pixels
- char *b = buffer.data() + padding + 1;
- const int bstep = rect.w * bytesPerPixel;
- for (int i = 0; i < rect.h; ++i) {
- server->convertPixels(b, (const char*)screendata, rect.w);
- screendata += linestep;
- b += bstep;
- }
- socket->write(buffer.constData() + padding, bufferSize);
- } else {
- quint8 subenc = 1; // Raw subencoding
- socket->write((char *)&subenc, 1);
-
- // send pixels
- for (int i = 0; i < rect.h; ++i) {
- socket->write((const char*)screendata,
- rect.w * bytesPerPixel);
- screendata += linestep;
- }
- }
- }
- if (socket->state() == QAbstractSocket::UnconnectedState)
- break;
- rect.y += MAP_TILE_SIZE;
- }
- socket->flush();
- Q_ASSERT(map->numDirty == 0);
-
- QWSDisplay::ungrab();
-}
-
-void QRfbRawEncoder::write()
-{
- QWSDisplay::grab(false);
-
- QVNCDirtyMap *map = server->dirtyMap();
- QTcpSocket *socket = server->clientSocket();
-
- const int bytesPerPixel = server->clientBytesPerPixel();
-
- // create a region from the dirty rects and send the region's merged rects.
- QRegion rgn;
- if (map) {
- for (int y = 0; y < map->mapHeight; ++y) {
- for (int x = 0; x < map->mapWidth; ++x) {
- if (!map->dirty(x, y))
- continue;
- rgn += QRect(x * MAP_TILE_SIZE, y * MAP_TILE_SIZE,
- MAP_TILE_SIZE, MAP_TILE_SIZE);
- map->setClean(x, y);
- }
- }
-
- rgn &= QRect(0, 0, server->screen()->deviceWidth(),
- server->screen()->deviceHeight());
- }
- const QVector<QRect> rects = rgn.rects();
-
- {
- const char tmp[2] = { 0, 0 }; // msg type, padding
- socket->write(tmp, sizeof(tmp));
- }
-
- {
- const quint16 count = htons(rects.size());
- socket->write((char *)&count, sizeof(count));
- }
-
- if (rects.size() <= 0) {
- QWSDisplay::ungrab();
- return;
- }
-
- const QImage screenImage = server->screenImage();
-
- for (int i = 0; i < rects.size(); ++i) {
- const QRect tileRect = rects.at(i);
- const QRfbRect rect(tileRect.x(), tileRect.y(),
- tileRect.width(), tileRect.height());
- rect.write(socket);
-
- const quint32 encoding = htonl(0); // raw encoding
- socket->write((char *)&encoding, sizeof(encoding));
-
- int linestep = screenImage.bytesPerLine();
- const uchar *screendata = screenImage.scanLine(rect.y)
- + rect.x * screenImage.depth() / 8;
-
-#ifndef QT_NO_QWS_CURSOR
- // hardware cursors must be blended with the screen memory
- const bool doBlendCursor = qt_screencursor
- && !server->hasClientCursor()
- && qt_screencursor->isAccelerated();
- QImage tileImage;
- if (doBlendCursor) {
- const QRect cursorRect = qt_screencursor->boundingRect()
- .translated(-server->screen()->offset());
- if (tileRect.intersects(cursorRect)) {
- tileImage = screenImage.copy(tileRect);
- blendCursor(tileImage,
- tileRect.translated(server->screen()->offset()));
- screendata = tileImage.bits();
- linestep = tileImage.bytesPerLine();
- }
- }
-#endif // QT_NO_QWS_CURSOR
-
- if (server->doPixelConversion()) {
- const int bufferSize = rect.w * rect.h * bytesPerPixel;
- if (bufferSize > buffer.size())
- buffer.resize(bufferSize);
-
- // convert pixels
- char *b = buffer.data();
- const int bstep = rect.w * bytesPerPixel;
- for (int i = 0; i < rect.h; ++i) {
- server->convertPixels(b, (const char*)screendata, rect.w);
- screendata += linestep;
- b += bstep;
- }
- socket->write(buffer.constData(), bufferSize);
- } else {
- for (int i = 0; i < rect.h; ++i) {
- socket->write((const char*)screendata, rect.w * bytesPerPixel);
- screendata += linestep;
- }
- }
- if (socket->state() == QAbstractSocket::UnconnectedState)
- break;
- }
- socket->flush();
-
- QWSDisplay::ungrab();
-}
-
-inline QImage QVNCServer::screenImage() const
-{
- return QImage(qvnc_screen->base(), qvnc_screen->deviceWidth(),
- qvnc_screen->deviceHeight(), qvnc_screen->linestep(),
- qvnc_screen->pixelFormat());
-}
-
-void QVNCServer::checkUpdate()
-{
- if (!wantUpdate)
- return;
-
- if (dirtyCursor) {
-#ifndef QT_NO_QWS_CURSOR
- Q_ASSERT(qvnc_cursor);
- qvnc_cursor->write();
-#endif
- dirtyCursor = false;
- wantUpdate = false;
- return;
- }
-
- if (dirtyMap()->numDirty > 0) {
- if (encoder)
- encoder->write();
- wantUpdate = false;
- }
-}
-
-void QVNCServer::discardClient()
-{
- timer->stop();
- state = Unconnected;
- delete encoder;
- encoder = 0;
-#ifndef QT_NO_QWS_CURSOR
- delete qvnc_cursor;
- qvnc_cursor = 0;
-#endif
- if (!qvnc_screen->screen() && !qvnc_screen->d_ptr->noDisablePainting && QWSServer::instance())
- QWSServer::instance()->enablePainting(false);
-}
-
-
-//===========================================================================
-
-/*!
- \class QVNCScreen
- \internal
- \ingroup qws
-
- \brief The QVNCScreen class implements a screen driver for VNC
- servers.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
- Custom screen drivers can be added by subclassing the QScreen
- class, using the QScreenDriverFactory class to dynamically load
- the driver into the application.
-
- The VNC protocol allows you to view and interact with the
- computer's display from anywhere on the network. See the
- \l{The VNC Protocol and Qt for Embedded Linux}{VNC protocol}
- documentation for more details.
-
- The default implementation of QVNCScreen inherits QLinuxFbScreen,
- but any QScreen subclass, or QScreen itself, can serve as its base
- class. This is easily achieved by manipulating the \c
- VNCSCREEN_BASE definition in the header file.
-
- \sa QScreen, {Running Applications}
-*/
-
-/*!
- \fn QVNCScreen::QVNCScreen(int displayId)
-
- Constructs a QVNCScreen object. The \a displayId argument
- identifies the Qt for Embedded Linux server to connect to.
-*/
-QVNCScreen::QVNCScreen(int display_id)
- : QProxyScreen(display_id, VNCClass)
-{
- d_ptr = new QVNCScreenPrivate(this);
-}
-
-/*!
- Destroys this QVNCScreen object.
-*/
-QVNCScreen::~QVNCScreen()
-{
- delete d_ptr;
-}
-
-/*!
- \reimp
-*/
-void QVNCScreen::setDirty(const QRect &rect)
-{
- d_ptr->setDirty(rect);
-}
-
-void QVNCScreenPrivate::setDirty(const QRect& rect, bool force)
-{
- if (rect.isEmpty())
- return;
-
- if (q_ptr->screen())
- q_ptr->screen()->setDirty(rect);
-
- if (!vncServer || !vncServer->isConnected())
- return;
-
- const QRect r = rect.translated(-q_ptr->offset());
- const int x1 = r.x() / MAP_TILE_SIZE;
- int y = r.y() / MAP_TILE_SIZE;
- for (; (y <= r.bottom() / MAP_TILE_SIZE) && y < dirty->mapHeight; y++)
- for (int x = x1; (x <= r.right() / MAP_TILE_SIZE) && x < dirty->mapWidth; x++)
- dirty->setDirty(x, y, force);
-
- vncServer->setDirty();
-}
-
-static int getDisplayId(const QString &spec)
-{
- QRegExp regexp(QLatin1String(":(\\d+)\\b"));
- if (regexp.lastIndexIn(spec) != -1) {
- const QString capture = regexp.cap(1);
- return capture.toInt();
- }
- return 0;
-}
-
-/*!
- \reimp
-*/
-bool QVNCScreen::connect(const QString &displaySpec)
-{
- QString dspec = displaySpec;
- if (dspec.startsWith(QLatin1String("vnc:"), Qt::CaseInsensitive))
- dspec = dspec.mid(QString::fromLatin1("vnc:").size());
- else if (dspec.compare(QLatin1String("vnc"), Qt::CaseInsensitive) == 0)
- dspec = QString();
-
- const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
- if (dspec.endsWith(displayIdSpec))
- dspec = dspec.left(dspec.size() - displayIdSpec.size());
-
- QStringList args = dspec.split(QLatin1Char(':'),
- QString::SkipEmptyParts);
- QRegExp refreshRegexp(QLatin1String("^refreshrate=(\\d+)$"));
- int index = args.indexOf(refreshRegexp);
- if (index >= 0) {
- d_ptr->refreshRate = refreshRegexp.cap(1).toInt();
- args.removeAt(index);
- dspec = args.join(QLatin1String(":"));
- }
-
- QString driver = dspec;
- int colon = driver.indexOf(QLatin1Char(':'));
- if (colon >= 0)
- driver.truncate(colon);
-
- if (QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive)) {
- const int id = getDisplayId(dspec);
- QScreen *s = qt_get_screen(id, dspec.toLatin1().constData());
- if (s->pixelFormat() == QImage::Format_Indexed8
- || s->pixelFormat() == QImage::Format_Invalid && s->depth() == 8)
- qFatal("QVNCScreen: unsupported screen format");
- setScreen(s);
- } else { // create virtual screen
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- QScreen::setFrameBufferLittleEndian(false);
-#endif
-
- d = qgetenv("QWS_DEPTH").toInt();
- if (!d)
- d = 16;
-
- QByteArray str = qgetenv("QWS_SIZE");
- if(!str.isEmpty()) {
- sscanf(str.constData(), "%dx%d", &w, &h);
- dw = w;
- dh = h;
- } else {
- dw = w = 640;
- dh = h = 480;
- }
-
- const QStringList args = displaySpec.split(QLatin1Char(':'),
- QString::SkipEmptyParts);
-
- if (args.contains(QLatin1String("paintonscreen"), Qt::CaseInsensitive))
- d_ptr->doOnScreenSurface = true;
-
- QRegExp depthRegexp(QLatin1String("^depth=(\\d+)$"));
- if (args.indexOf(depthRegexp) != -1)
- d = depthRegexp.cap(1).toInt();
-
- QRegExp sizeRegexp(QLatin1String("^size=(\\d+)x(\\d+)$"));
- if (args.indexOf(sizeRegexp) != -1) {
- dw = w = sizeRegexp.cap(1).toInt();
- dh = h = sizeRegexp.cap(2).toInt();
- }
-
- // Handle display physical size spec.
- QRegExp mmWidthRegexp(QLatin1String("^mmWidth=?(\\d+)$"));
- if (args.indexOf(mmWidthRegexp) != -1) {
- const int mmWidth = mmWidthRegexp.cap(1).toInt();
- if (mmWidth > 0)
- d_ptr->dpiX = dw * 25.4 / mmWidth;
- }
- QRegExp mmHeightRegexp(QLatin1String("^mmHeight=?(\\d+)$"));
- if (args.indexOf(mmHeightRegexp) != -1) {
- const int mmHeight = mmHeightRegexp.cap(1).toInt();
- if (mmHeight > 0)
- d_ptr->dpiY = dh * 25.4 / mmHeight;
- }
- QRegExp dpiRegexp(QLatin1String("^dpi=(\\d+)(?:,(\\d+))?$"));
- if (args.indexOf(dpiRegexp) != -1) {
- const qreal dpiX = dpiRegexp.cap(1).toFloat();
- const qreal dpiY = dpiRegexp.cap(2).toFloat();
- if (dpiX > 0)
- d_ptr->dpiX = dpiX;
- d_ptr->dpiY = (dpiY > 0 ? dpiY : dpiX);
- }
-
- if (args.contains(QLatin1String("noDisablePainting")))
- d_ptr->noDisablePainting = true;
-
- QWSServer::setDefaultMouse("None");
- QWSServer::setDefaultKeyboard("None");
-
- d_ptr->configure();
- }
-
- // XXX
- qt_screen = this;
-
- return true;
-}
-
-/*!
- \reimp
-*/
-void QVNCScreen::disconnect()
-{
- QProxyScreen::disconnect();
-#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY)
- d_ptr->shm.detach();
-#endif
-}
-
-/*!
- \reimp
-*/
-bool QVNCScreen::initDevice()
-{
- if (!QProxyScreen::screen() && d == 4) {
- screencols = 16;
- int val = 0;
- for (int idx = 0; idx < 16; idx++, val += 17) {
- screenclut[idx] = qRgb(val, val, val);
- }
- }
- d_ptr->vncServer = new QVNCServer(this, displayId);
- d_ptr->vncServer->setRefreshRate(d_ptr->refreshRate);
-
- switch (depth()) {
-#ifdef QT_QWS_DEPTH_32
- case 32:
- d_ptr->dirty = new QVNCDirtyMapOptimized<quint32>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_24
- case 24:
- d_ptr->dirty = new QVNCDirtyMapOptimized<qrgb888>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_18
- case 18:
- d_ptr->dirty = new QVNCDirtyMapOptimized<qrgb666>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_16
- case 16:
- d_ptr->dirty = new QVNCDirtyMapOptimized<quint16>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_15
- case 15:
- d_ptr->dirty = new QVNCDirtyMapOptimized<qrgb555>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_12
- case 12:
- d_ptr->dirty = new QVNCDirtyMapOptimized<qrgb444>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_8
- case 8:
- d_ptr->dirty = new QVNCDirtyMapOptimized<quint8>(this);
- break;
-#endif
- default:
- qWarning("QVNCScreen::initDevice: No support for screen depth %d",
- depth());
- d_ptr->dirty = 0;
- return false;
- }
-
-
- const bool ok = QProxyScreen::initDevice();
-#ifndef QT_NO_QWS_CURSOR
- qt_screencursor = new QVNCCursor(this);
-#endif
- if (QProxyScreen::screen())
- return ok;
-
- // Disable painting if there is only 1 display and nothing is attached to the VNC server
- if (!d_ptr->noDisablePainting)
- QWSServer::instance()->enablePainting(false);
-
- return true;
-}
-
-/*!
- \reimp
-*/
-void QVNCScreen::shutdownDevice()
-{
- QProxyScreen::shutdownDevice();
- delete d_ptr->vncServer;
- delete d_ptr->dirty;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_VNC
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h
deleted file mode 100644
index 646109f5ef..0000000000
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCREENVNC_QWS_H
-#define QSCREENVNC_QWS_H
-
-#include <QtGui/qscreenproxy_qws.h>
-
-#ifndef QT_NO_QWS_VNC
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QVNCScreenPrivate;
-
-class QVNCScreen : public QProxyScreen
-{
-public:
- explicit QVNCScreen(int display_id);
- virtual ~QVNCScreen();
-
- bool initDevice();
- bool connect(const QString &displaySpec);
- void disconnect();
- void shutdownDevice();
-
- void setDirty(const QRect&);
-
-private:
- friend class QVNCCursor;
- friend class QVNCClientCursor;
- friend class QVNCServer;
- friend class QVNCScreenPrivate;
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
- bool swapBytes() const;
-#endif
-
- QVNCScreenPrivate *d_ptr;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWS_VNC
-#endif // QSCREENVNC_QWS_H
diff --git a/src/plugins/gfxdrivers/vnc/vnc.pro b/src/plugins/gfxdrivers/vnc/vnc.pro
deleted file mode 100644
index 48bad8c6e3..0000000000
--- a/src/plugins/gfxdrivers/vnc/vnc.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qgfxvnc
-include(../../qpluginbase.pri)
-
-DEFINES += QT_QWS_VNC
-
-DESTDIR = $$QT.gui.plugins/gfxdrivers
-
-HEADERS = \
- qscreenvnc_qws.h \
- qscreenvnc_p.h
-
-SOURCES = main.cpp \
- qscreenvnc_qws.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro
deleted file mode 100644
index 5c99291047..0000000000
--- a/src/plugins/graphicssystems/graphicssystems.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += trace
-!wince*:contains(QT_CONFIG, opengl):SUBDIRS += opengl
-contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) {
- SUBDIRS += openvg
-}
-
-contains(QT_CONFIG, shivavg) {
- # Only works under X11 at present
- !win32:!embedded:!mac:SUBDIRS += shivavg
-}
-
-!win32:!embedded:!mac:!symbian:CONFIG += x11
-
-x11:contains(QT_CONFIG, opengles2):contains(QT_CONFIG, egl):SUBDIRS += meego
diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp
deleted file mode 100644
index 2561c22ff6..0000000000
--- a/src/plugins/graphicssystems/meego/dithering.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// Implements two dithering methods:
-//
-// * convertRGBA32_to_RGB565
-//
-// This is implemented using Ordered Bayer Dithering. The code has been adapted
-// from QX11PixmapData::fromImage. This method was originally implemented using
-// Floyd-Steinberg dithering but was later changed to Ordered Dithering because
-// of the better quality of the results.
-//
-// * convertRGBA32_to_RGBA4444
-//
-// This is implemented using Floyd-Steinberg dithering.
-//
-// The alghorithm used here is not the fastest possible but it's prolly fast enough:
-// uses look-up tables, integer-only arthmetics and works in one pass on two lines
-// at a time. It's a high-quality dithering using 1/8 diffusion precission.
-// Each channel (RGBA) is diffused independently and alpha is dithered too.
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <QVarLengthArray>
-
-// Gets a component (red = 1, green = 2...) from a RGBA data structure.
-// data is unsigned char. stride is the number of bytes per line.
-#define GET_RGBA_COMPONENT(data, x, y, stride, c) (data[(y * stride) + (x << 2) + c])
-
-// Writes a new pixel with r, g, b to data in 565 16bit format. Data is a short.
-#define PUT_565(data, x, y, width, r, g, b) (data[(y * width) + x] = (r << 11) | (g << 5) | b)
-
-// Writes a new pixel with r, g, b, a to data in 4444 RGBA 16bit format. Data is a short.
-#define PUT_4444(data, x, y, width, r, g, b, a) (data[(y * width) + x] = (r << 12) | (g << 8) | (b << 4) | a)
-
-// Writes(ads) a new value to the diffusion accumulator. accumulator is a short.
-// x, y is a position in the accumulation buffer. y can be 0 or 1 -- we operate on two lines at time.
-#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x >= 0) accumulator[(y * width) + x] += v
-
-// Clamps a value to be in 0..255 range.
-#define CLAMP_256(v) if (v > 255) v = 255; if (v < 0) v = 0;
-
-// Converts incoming RGB32 (QImage::Format_RGB32) to RGB565. Returns the newly allocated data.
-unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride)
-{
- static bool thresholdMapInitialized = false;
- static int thresholdMap[16][16];
-
- if (!thresholdMapInitialized) {
- int i;
- int j;
- int n;
-
- thresholdMap[0][0] = 0;
- thresholdMap[1][0] = 2;
- thresholdMap[0][1] = 3;
- thresholdMap[1][1] = 1;
-
- for (n=2; n<16; n*=2) {
- for (i=0; i<n; i++) {
- for (j=0; j<n; j++) {
- thresholdMap[i][j] *= 4;
- thresholdMap[i+n][j] = thresholdMap[i][j] + 2;
- thresholdMap[i][j+n] = thresholdMap[i][j] + 3;
- thresholdMap[i+n][j+n] = thresholdMap[i][j] + 1;
- }
- }
- }
-
- thresholdMapInitialized = true;
- }
-
- // Output line stride. Aligned to 4 bytes.
- int alignedWidth = width;
- if (alignedWidth % 2 > 0)
- alignedWidth++;
-
- // Will store output
- unsigned short *out = (unsigned short *)malloc (alignedWidth * height * 2);
-
- int x;
- int y;
- int threshold;
-
- // For each line...
- for (y = 0; y < height; y++) {
-
- // For each column....
- for (x = 0; x < width; x++) {
-
- int r = GET_RGBA_COMPONENT(in, x, y, stride, 0);
- int g = GET_RGBA_COMPONENT(in, x, y, stride, 1);
- int b = GET_RGBA_COMPONENT(in, x, y, stride, 2);
-
- threshold = thresholdMap[x%16][y%16];
-
- if (r <= (255-(1<<3)) && ((r<<5) & 255) > threshold) r += (1<<3);
- if (g <= (255-(1<<2)) && ((g<<6) & 255) > threshold) g += (1<<2);
- if (b <= (255-(1<<3)) && ((b<<5) & 255) > threshold) b += (1<<3);
-
- // Write the newly produced pixel
- PUT_565(out, x, y, alignedWidth, ((b >> 3) & 0x1f), ((g >> 2) & 0x3f), ((r >> 3) & 0x1f));
- }
- }
-
- return out;
-}
-
-// Converts incoming RGBA32 (QImage::Format_ARGB32_Premultiplied) to RGB565. Returns the newly allocated data.
-// This function is similar (yet different) to the _565 variant but it makes sense to duplicate it here for simplicity.
-// The output has each scan line aligned to 4 bytes (as expected by GL by default).
-unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride)
-{
- // Output line stride. Aligned to 4 bytes.
- int alignedWidth = width;
- if (alignedWidth % 2 > 0)
- alignedWidth++;
-
- // Will store output
- unsigned short *out = (unsigned short *) malloc(alignedWidth * 2 * height);
-
- // Lookup tables for the 8bit => 4bit conversion
- unsigned char lookup_8bit_to_4bit[256];
- short lookup_8bit_to_4bit_diff[256];
-
- // Macros for the conversion using the lookup table.
- #define CONVERT_8BIT_TO_4BIT(v) (lookup_8bit_to_4bit[v])
- #define DIFF_8BIT_TO_4BIT(v) (lookup_8bit_to_4bit_diff[v])
-
- int i;
- int x, y, c; // Pixel we're processing. c is component number (0, 1, 2, 3 for r, b, b, a)
- short component[4]; // Stores the new components (r, g, b, a) for pixel produced during conversion
- short diff; // The difference between the converted value and the original one. To be accumulated.
- QVarLengthArray <short> accumulatorData(4 * width * 2); // Data for three acumulators for r, g, b. Each accumulator is two lines.
- short *accumulator[4]; // Helper for accessing the accumulator on a per-channel basis more easily.
- accumulator[0] = accumulatorData.data();
- accumulator[1] = accumulatorData.data() + width;
- accumulator[2] = accumulatorData.data() + (width * 2);
- accumulator[3] = accumulatorData.data() + (width * 3);
-
- // Produce the conversion lookup tables.
- for (i = 0; i < 256; i++) {
- lookup_8bit_to_4bit[i] = round(i / 16.0);
- // Before bitshifts: (i * 8) - (... * 16 * 8)
- lookup_8bit_to_4bit_diff[i] = (i << 3) - (lookup_8bit_to_4bit[i] << 7);
-
- if (lookup_8bit_to_4bit[i] > 15)
- lookup_8bit_to_4bit[i] = 15;
- }
-
- // Clear the accumulators
- memset(accumulator[0], 0, width * 4);
- memset(accumulator[1], 0, width * 4);
- memset(accumulator[2], 0, width * 4);
- memset(accumulator[3], 0, width * 4);
-
- // For each line...
- for (y = 0; y < height; y++) {
-
- // For each component (r, g, b, a)...
- memcpy(accumulator[0], accumulator[0] + width, width * 2);
- memset(accumulator[0] + width, 0, width * 2);
-
- memcpy(accumulator[1], accumulator[1] + width, width * 2);
- memset(accumulator[1] + width, 0, width * 2);
-
- memcpy(accumulator[2], accumulator[2] + width, width * 2);
- memset(accumulator[2] + width, 0, width * 2);
-
- memcpy(accumulator[3], accumulator[3] + width, width * 2);
- memset(accumulator[3] + width, 0, width * 2);
-
- // For each column....
- for (x = 0; x < width; x++) {
-
- // For each component (r, g, b, a)...
- for (c = 0; c < 4; c++) {
-
- // Get the 8bit value from the original image
- component[c] = GET_RGBA_COMPONENT(in, x, y, stride, c);
-
- // Add the diffusion for this pixel we stored in the accumulator.
- // >> 7 because the values in accumulator are stored * 128
- component[c] += accumulator[c][x] >> 7;
-
- // Make sure we're not over the boundaries.
- CLAMP_256(component[c]);
-
- // Store the difference from converting 8bit => 4bit and the orig pixel.
- // Convert 8bit => 4bit.
- diff = DIFF_8BIT_TO_4BIT(component[c]);
- component[c] = CONVERT_8BIT_TO_4BIT(component[c]);
-
- // Distribute the difference according to the matrix in the
- // accumulation bufffer.
- ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7);
- ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3);
- ACCUMULATE(accumulator[c], x, 1, width, diff * 5);
- ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1);
- }
-
- // Write the newly produced pixel
- PUT_4444(out, x, y, alignedWidth, component[0], component[1], component[2], component[3]);
- }
- }
-
- return out;
-}
-
-unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride)
-{
- unsigned char *out = (unsigned char *) malloc(stride * height);
-
- // For each line...
- for (int y = 0; y < height; y++) {
- // For each column
- for (int x = 0; x < width; x++) {
- out[(stride * y) + (x * 4) + 0] = in[(stride * y) + (x * 4) + 2];
- out[(stride * y) + (x * 4) + 1] = in[(stride * y) + (x * 4) + 1];
- out[(stride * y) + (x * 4) + 2] = in[(stride * y) + (x * 4) + 0];
- out[(stride * y) + (x * 4) + 3] = in[(stride * y) + (x * 4) + 3];
- }
- }
-
- return out;
-}
diff --git a/src/plugins/graphicssystems/meego/meego.pro b/src/plugins/graphicssystems/meego/meego.pro
deleted file mode 100644
index c497ba2eb6..0000000000
--- a/src/plugins/graphicssystems/meego/meego.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = qmeegographicssystem
-include(../../qpluginbase.pri)
-
-QT += gui opengl
-
-DESTDIR = $$QT.gui.plugins/graphicssystems
-
-HEADERS = qmeegographicssystem.h qmeegopixmapdata.h qmeegoextensions.h qmeegorasterpixmapdata.h qmeegolivepixmapdata.h
-SOURCES = qmeegographicssystem.cpp qmeegographicssystem.h qmeegographicssystemplugin.h qmeegographicssystemplugin.cpp qmeegopixmapdata.h qmeegopixmapdata.cpp qmeegoextensions.h qmeegoextensions.cpp qmeegorasterpixmapdata.h qmeegorasterpixmapdata.cpp qmeegolivepixmapdata.cpp qmeegolivepixmapdata.h dithering.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
-INSTALLS += target
-
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
deleted file mode 100644
index fb82747062..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmeegoextensions.h"
-#include <private/qeglcontext_p.h>
-#include <private/qpixmapdata_gl_p.h>
-
-bool QMeeGoExtensions::initialized = false;
-bool QMeeGoExtensions::hasImageShared = false;
-bool QMeeGoExtensions::hasSurfaceScaling = false;
-bool QMeeGoExtensions::hasLockSurface = false;
-bool QMeeGoExtensions::hasFenceSync = false;
-
-/* Extension funcs */
-
-typedef EGLBoolean (EGLAPIENTRY *eglQueryImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint, EGLint*);
-typedef EGLNativeSharedImageTypeNOK (EGLAPIENTRY *eglCreateSharedImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint*);
-typedef EGLBoolean (EGLAPIENTRY *eglDestroySharedImageNOKFunc)(EGLDisplay, EGLNativeSharedImageTypeNOK);
-typedef EGLBoolean (EGLAPIENTRY *eglSetSurfaceScalingNOKFunc)(EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint);
-typedef EGLBoolean (EGLAPIENTRY *eglLockSurfaceKHRFunc)(EGLDisplay, EGLSurface, const EGLint*);
-typedef EGLBoolean (EGLAPIENTRY *eglUnlockSurfaceKHRFunc)(EGLDisplay, EGLSurface);
-typedef EGLSyncKHR (EGLAPIENTRY *eglCreateSyncKHRFunc)(EGLDisplay, EGLenum, const EGLint*);
-typedef EGLBoolean (EGLAPIENTRY *eglDestroySyncKHRFunc)(EGLDisplay, EGLSyncKHR);
-typedef EGLint (EGLAPIENTRY *eglClientWaitSyncKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR);
-typedef EGLBoolean (EGLAPIENTRY *eglGetSyncAttribKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLint*);
-
-static eglQueryImageNOKFunc _eglQueryImageNOK = 0;
-static eglCreateSharedImageNOKFunc _eglCreateSharedImageNOK = 0;
-static eglDestroySharedImageNOKFunc _eglDestroySharedImageNOK = 0;
-static eglSetSurfaceScalingNOKFunc _eglSetSurfaceScalingNOK = 0;
-static eglLockSurfaceKHRFunc _eglLockSurfaceKHR = 0;
-static eglUnlockSurfaceKHRFunc _eglUnlockSurfaceKHR = 0;
-static eglCreateSyncKHRFunc _eglCreateSyncKHR = 0;
-static eglDestroySyncKHRFunc _eglDestroySyncKHR = 0;
-static eglClientWaitSyncKHRFunc _eglClientWaitSyncKHR = 0;
-static eglGetSyncAttribKHRFunc _eglGetSyncAttribKHR = 0;
-
-/* Public */
-
-void QMeeGoExtensions::ensureInitialized()
-{
- if (!initialized)
- initialize();
-
- initialized = true;
-}
-
-EGLNativeSharedImageTypeNOK QMeeGoExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props)
-{
- if (!hasImageShared)
- qFatal("EGL_NOK_image_shared not found but trying to use capability!");
-
- return _eglCreateSharedImageNOK(dpy, image, props);
-}
-
-bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v)
-{
- if (!hasImageShared)
- qFatal("EGL_NOK_image_shared not found but trying to use capability!");
-
- return _eglQueryImageNOK(dpy, image, prop, v);
-}
-
-bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img)
-{
- if (!hasImageShared)
- qFatal("EGL_NOK_image_shared not found but trying to use capability!");
-
- return _eglDestroySharedImageNOK(dpy, img);
-}
-
-bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height)
-{
- if (!hasSurfaceScaling)
- qFatal("EGL_NOK_surface_scaling not found but trying to use capability!");
-
- return _eglSetSurfaceScalingNOK(dpy, surface, x, y, width, height);
-}
-
-bool QMeeGoExtensions::eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
-{
- if (!hasLockSurface)
- qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!");
-
- return _eglLockSurfaceKHR(display, surface, attrib_list);
-}
-
-bool QMeeGoExtensions::eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
-{
- if (!hasLockSurface)
- qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!");
-
- return _eglUnlockSurfaceKHR(display, surface);
-}
-
-EGLSyncKHR QMeeGoExtensions::eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
-{
- if (!hasFenceSync)
- qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
-
- return _eglCreateSyncKHR(dpy, type, attrib_list);
-}
-
-bool QMeeGoExtensions::eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
-{
- if (!hasFenceSync)
- qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
-
- return _eglDestroySyncKHR(dpy, sync);
-}
-
-EGLint QMeeGoExtensions::eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
-{
- if (!hasFenceSync)
- qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
-
- return _eglClientWaitSyncKHR(dpy, sync, flags, timeout);
-}
-
-EGLBoolean QMeeGoExtensions::eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
-{
- if (!hasFenceSync)
- qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
-
- return _eglGetSyncAttribKHR(dpy, sync, attribute, value);
-}
-
-/* Private */
-
-void QMeeGoExtensions::initialize()
-{
- QGLContext *ctx = (QGLContext *) QGLContext::currentContext();
- qt_resolve_eglimage_gl_extensions(ctx);
-
- if (QEgl::hasExtension("EGL_NOK_image_shared")) {
- qDebug("MeegoGraphics: found EGL_NOK_image_shared");
- _eglQueryImageNOK = (eglQueryImageNOKFunc) eglGetProcAddress("eglQueryImageNOK");
- _eglCreateSharedImageNOK = (eglCreateSharedImageNOKFunc) eglGetProcAddress("eglCreateSharedImageNOK");
- _eglDestroySharedImageNOK = (eglDestroySharedImageNOKFunc) eglGetProcAddress("eglDestroySharedImageNOK");
- _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR");
- _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR");
-
- Q_ASSERT(_eglQueryImageNOK && _eglCreateSharedImageNOK && _eglDestroySharedImageNOK);
- hasImageShared = true;
- }
-
- if (QEgl::hasExtension("EGL_NOK_surface_scaling")) {
- qDebug("MeegoGraphics: found EGL_NOK_surface_scaling");
- _eglSetSurfaceScalingNOK = (eglSetSurfaceScalingNOKFunc) eglGetProcAddress("eglSetSurfaceScalingNOK");
-
- Q_ASSERT(_eglSetSurfaceScalingNOK);
- hasSurfaceScaling = true;
- }
-
- if (QEgl::hasExtension("EGL_KHR_lock_surface2")) {
- qDebug("MeegoGraphics: found EGL_KHR_lock_surface2");
- _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR");
- _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR");
-
- Q_ASSERT(_eglLockSurfaceKHR && _eglUnlockSurfaceKHR);
- hasLockSurface = true;
- }
-
- if (QEgl::hasExtension("EGL_KHR_fence_sync")) {
- qDebug("MeegoGraphics: found EGL_KHR_fence_sync");
- _eglCreateSyncKHR = (eglCreateSyncKHRFunc) eglGetProcAddress("eglCreateSyncKHR");
- _eglDestroySyncKHR = (eglDestroySyncKHRFunc) eglGetProcAddress("eglDestroySyncKHR");
- _eglClientWaitSyncKHR = (eglClientWaitSyncKHRFunc) eglGetProcAddress("eglClientWaitSyncKHR");
- _eglGetSyncAttribKHR = (eglGetSyncAttribKHRFunc) eglGetProcAddress("eglGetSyncAttribKHR");
-
- Q_ASSERT(_eglCreateSyncKHR && _eglDestroySyncKHR && _eglClientWaitSyncKHR && _eglGetSyncAttribKHR);
- hasFenceSync = true;
- }
-}
-
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h
deleted file mode 100644
index 76d3fec4cf..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegoextensions.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MEXTENSIONS_H
-#define MEXTENSIONS_H
-
-#include <private/qgl_p.h>
-#include <private/qeglcontext_p.h>
-#include <private/qpixmapdata_gl_p.h>
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-/* Extensions decls */
-
-#ifndef EGL_SHARED_IMAGE_NOK
-#define EGL_SHARED_IMAGE_NOK 0x30DA
-typedef void* EGLNativeSharedImageTypeNOK;
-#endif
-
-#ifndef EGL_GL_TEXTURE_2D_KHR
-#define EGL_GL_TEXTURE_2D_KHR 0x30B1
-#endif
-
-#ifndef EGL_FIXED_WIDTH_NOK
-#define EGL_FIXED_WIDTH_NOK 0x30DB
-#define EGL_FIXED_HEIGHT_NOK 0x30DC
-#endif
-
-#ifndef EGL_BITMAP_POINTER_KHR
-#define EGL_BITMAP_POINTER_KHR 0x30C6
-#define EGL_BITMAP_PITCH_KHR 0x30C7
-#endif
-
-#ifndef EGL_MAP_PRESERVE_PIXELS_KHR
-#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
-#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
-#define EGL_READ_SURFACE_BIT_KHR 0x0001
-#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
-#endif
-
-#ifndef EGL_SYNC_FENCE_KHR
-#define EGL_SYNC_FENCE_KHR 0x30F9
-#define EGL_SYNC_TYPE_KHR 0x30F7
-#define EGL_SYNC_STATUS_KHR 0x30F1
-#define EGL_SYNC_CONDITION_KHR 0x30F8
-#define EGL_SIGNALED_KHR 0x30F2
-#define EGL_UNSIGNALED_KHR 0x30F3
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
-#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
-#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
-#define EGL_CONDITION_SATISFIED_KHR 0x30F6
-#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
-typedef void* EGLSyncKHR;
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
-#endif
-
-/* Class */
-
-class QMeeGoExtensions
-{
-public:
- static void ensureInitialized();
-
- static EGLNativeSharedImageTypeNOK eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props);
- static bool eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v);
- static bool eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img);
- static bool eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height);
- static bool eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
- static bool eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface);
- static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
- static bool eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
- static EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
- static EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-
-private:
- static void initialize();
-
- static bool initialized;
- static bool hasImageShared;
- static bool hasSurfaceScaling;
- static bool hasLockSurface;
- static bool hasFenceSync;
-};
-
-#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
deleted file mode 100644
index fdb72de648..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include <private/qpixmap_raster_p.h>
-#include <private/qwindowsurface_gl_p.h>
-#include <private/qwindowsurface_raster_p.h>
-#include <private/qegl_p.h>
-#include <private/qglextensions_p.h>
-#include <private/qgl_p.h>
-#include <private/qimagepixmapcleanuphooks_p.h>
-#include <private/qapplication_p.h>
-#include <private/qgraphicssystem_runtime_p.h>
-#include <private/qimage_p.h>
-#include <private/qeglproperties_p.h>
-#include <private/qeglcontext_p.h>
-#include <private/qpixmap_x11_p.h>
-
-#include "qmeegopixmapdata.h"
-#include "qmeegolivepixmapdata.h"
-#include "qmeegographicssystem.h"
-#include "qmeegoextensions.h"
-
-#include <QTimer>
-
-bool QMeeGoGraphicsSystem::surfaceWasCreated = false;
-
-QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps;
-
-QList<QMeeGoSwitchCallback> QMeeGoGraphicsSystem::switchCallbacks;
-
-QMeeGoGraphicsSystem::SwitchPolicy QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::AutomaticSwitch;
-
-QMeeGoGraphicsSystem::QMeeGoGraphicsSystem()
-{
- qDebug("Using the meego graphics system");
-}
-
-QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem()
-{
- qDebug("Meego graphics system destroyed");
- qt_destroy_gl_share_widget();
-}
-
-class QMeeGoGraphicsSystemSwitchHandler : public QObject
-{
- Q_OBJECT
-public:
- QMeeGoGraphicsSystemSwitchHandler();
-
- void addWidget(QWidget *widget);
- bool eventFilter(QObject *, QEvent *);
-
- void handleMapNotify();
-
-private slots:
- void removeWidget(QObject *object);
- void switchToRaster();
- void switchToMeeGo();
-
-private:
- int visibleWidgets() const;
-
-private:
- QList<QWidget *> m_widgets;
-};
-
-typedef bool(*QX11FilterFunction)(XEvent *event);
-Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func);
-
-static bool x11EventFilter(XEvent *event);
-
-QMeeGoGraphicsSystemSwitchHandler::QMeeGoGraphicsSystemSwitchHandler()
-{
- qt_installX11EventFilter(x11EventFilter);
-}
-
-void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget)
-{
- if (widget != qt_gl_share_widget() && !m_widgets.contains(widget)) {
- widget->installEventFilter(this);
- connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(removeWidget(QObject *)));
- m_widgets << widget;
- }
-}
-
-void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify()
-{
- if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
- QTimer::singleShot(0, this, SLOT(switchToMeeGo()));
-}
-
-void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object)
-{
- m_widgets.removeOne(static_cast<QWidget *>(object));
- if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
- QTimer::singleShot(0, this, SLOT(switchToRaster()));
-}
-
-void QMeeGoGraphicsSystemSwitchHandler::switchToRaster()
-{
- QMeeGoGraphicsSystem::switchToRaster();
-}
-
-void QMeeGoGraphicsSystemSwitchHandler::switchToMeeGo()
-{
- QMeeGoGraphicsSystem::switchToMeeGo();
-}
-
-int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const
-{
- int count = 0;
- for (int i = 0; i < m_widgets.size(); ++i)
- count += m_widgets.at(i)->isVisible() && !(m_widgets.at(i)->windowState() & Qt::WindowMinimized);
- return count;
-}
-
-bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *event)
-{
- if (event->type() == QEvent::WindowStateChange
- && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
- {
- QWindowStateChangeEvent *change = static_cast<QWindowStateChangeEvent *>(event);
- QWidget *widget = static_cast<QWidget *>(object);
-
- Qt::WindowStates current = widget->windowState();
- Qt::WindowStates old = change->oldState();
-
- // did minimized flag change?
- if ((current ^ old) & Qt::WindowMinimized) {
- if (current & Qt::WindowMinimized) {
- if (visibleWidgets() == 0)
- QMeeGoGraphicsSystem::switchToRaster();
- } else {
- if (visibleWidgets() > 0)
- QMeeGoGraphicsSystem::switchToMeeGo();
- }
- }
- }
-
- // resume processing of event
- return false;
-}
-
-Q_GLOBAL_STATIC(QMeeGoGraphicsSystemSwitchHandler, switch_handler)
-
-bool x11EventFilter(XEvent *event)
-{
- if (event->type == MapNotify)
- switch_handler()->handleMapNotify();
- return false;
-}
-
-QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- QGLWidget *shareWidget = qt_gl_share_widget();
-
- if (!shareWidget)
- return new QRasterWindowSurface(widget);
-
- QGLShareContextScope ctx(shareWidget->context());
-
- if (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime"))
- switch_handler()->addWidget(widget);
-
- QMeeGoGraphicsSystem::surfaceWasCreated = true;
- QWindowSurface *surface = new QGLWindowSurface(widget);
- return surface;
-}
-
-QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
- return new QRasterPixmapData(type);
-}
-
-QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData *origin)
-{
- // If the pixmap is a raster type...
- // and if the pixmap pointer matches our mapping...
- // create a shared image instead with the given handle.
-
- if (!origin->isNull() && origin->classId() == QPixmapData::RasterClass) {
- QRasterPixmapData *rasterClass = static_cast <QRasterPixmapData *> (origin);
- void *rawResource = static_cast <void *> (rasterClass->buffer()->data_ptr()->data);
-
- if (QMeeGoPixmapData::sharedImagesMap.contains(rawResource))
- return new QMeeGoPixmapData();
- }
-
- return new QRasterPixmapData(origin->pixelType());
-}
-
-QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd)
-{
- QString name = QApplicationPrivate::instance()->graphics_system_name;
- if (name == "runtime") {
- QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system;
- QRuntimePixmapData *rt = new QRuntimePixmapData(rsystem, pmd->pixelType());;
- rt->m_data = pmd;
- rt->readBackInfo();
- rsystem->m_pixmapDatas << rt;
- return rt;
- } else
- return pmd;
-}
-
-void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/)
-{
- if (QMeeGoGraphicsSystem::surfaceWasCreated) {
- qWarning("Trying to set surface fixed size but surface already created!");
- return;
- }
-
-#ifdef QT_WAS_PATCHED
- QEglProperties *properties = new QEglProperties();
- properties->setValue(EGL_FIXED_WIDTH_NOK, width);
- properties->setValue(EGL_FIXED_HEIGHT_NOK, height);
- QGLContextPrivate::setExtraWindowSurfaceCreationProps(properties);
-#endif
-}
-
-void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height)
-{
- QMeeGoExtensions::ensureInitialized();
- QMeeGoExtensions::eglSetSurfaceScalingNOK(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->currentSurface, x, y, width, height);
-}
-
-void QMeeGoGraphicsSystem::setTranslucent(bool translucent)
-{
- if (QMeeGoGraphicsSystem::surfaceWasCreated) {
- qWarning("Trying to set translucency but surface already created!");
- return;
- }
-
- QGLWindowSurface::surfaceFormat.setSampleBuffers(false);
- QGLWindowSurface::surfaceFormat.setSamples(0);
- QGLWindowSurface::surfaceFormat.setAlpha(translucent);
-}
-
-QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
-{
- if (softImage.format() != QImage::Format_ARGB32_Premultiplied &&
- softImage.format() != QImage::Format_RGB32) {
- qFatal("For egl shared images, the soft image has to be ARGB32_Premultiplied or RGB32");
- return NULL;
- }
-
- if (QMeeGoGraphicsSystem::meeGoRunning()) {
- QMeeGoPixmapData *pmd = new QMeeGoPixmapData;
- pmd->fromEGLSharedImage(handle, softImage);
- return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
- } else {
- QRasterPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType);
- pmd->fromImage(softImage, Qt::NoFormatConversion);
-
- // Make sure that the image was not converted in any way
- if (pmd->buffer()->data_ptr()->data !=
- const_cast<QImage &>(softImage).data_ptr()->data)
- qFatal("Iternal misalignment of raster data detected. Prolly a QImage copy fail.");
-
- QMeeGoPixmapData::registerSharedImage(handle, softImage);
- return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
- }
-}
-
-void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap)
-{
- QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData();
-
- // Basic sanity check to make sure this is really a QMeeGoPixmapData...
- if (pmd->classId() != QPixmapData::OpenGLClass)
- qFatal("Trying to updated EGLSharedImage pixmap but it's not really a shared image pixmap!");
-
- pmd->updateFromSoftImage();
-}
-
-QPixmapData *QMeeGoGraphicsSystem::pixmapDataWithGLTexture(int w, int h)
-{
- QGLPixmapData *pmd = new QGLPixmapData(QPixmapData::PixmapType);
- pmd->resize(w, h);
- return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
-}
-
-bool QMeeGoGraphicsSystem::meeGoRunning()
-{
- return runningGraphicsSystemName() == "meego";
-}
-
-QPixmapData* QMeeGoGraphicsSystem::pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format)
-{
- return new QMeeGoLivePixmapData(w, h, format);
-}
-
-QPixmapData* QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(Qt::HANDLE handle)
-{
- return new QMeeGoLivePixmapData(handle);
-}
-
-QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap, void* fenceSync)
-{
- QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
- return pixmapData->lock(fenceSync);
-}
-
-bool QMeeGoGraphicsSystem::releaseLiveTexture(QPixmap *pixmap, QImage *image)
-{
- QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
- return pixmapData->release(image);
-}
-
-Qt::HANDLE QMeeGoGraphicsSystem::getLiveTextureHandle(QPixmap *pixmap)
-{
- QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
- return pixmapData->handle();
-}
-
-void* QMeeGoGraphicsSystem::createFenceSync()
-{
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
- QMeeGoExtensions::ensureInitialized();
- return QMeeGoExtensions::eglCreateSyncKHR(QEgl::display(), EGL_SYNC_FENCE_KHR, NULL);
-}
-
-void QMeeGoGraphicsSystem::destroyFenceSync(void *fenceSync)
-{
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
- QMeeGoExtensions::ensureInitialized();
- QMeeGoExtensions::eglDestroySyncKHR(QEgl::display(), fenceSync);
-}
-
-QString QMeeGoGraphicsSystem::runningGraphicsSystemName()
-{
- if (!QApplicationPrivate::instance()) {
- qWarning("Querying graphics system but application not running yet!");
- return QString();
- }
-
- QString name = QApplicationPrivate::instance()->graphics_system_name;
- if (name == QLatin1String("runtime")) {
- QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system;
- name = rsystem->graphicsSystemName();
- }
-
- return name;
-}
-
-void QMeeGoGraphicsSystem::switchToMeeGo()
-{
- if (switchPolicy == NoSwitch || meeGoRunning())
- return;
-
- if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
- qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system.");
- else {
- triggerSwitchCallbacks(0, "meego");
-
- QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
- app->setGraphicsSystem(QLatin1String("meego"));
-
- triggerSwitchCallbacks(1, "meego");
- }
-}
-
-void QMeeGoGraphicsSystem::switchToRaster()
-{
- if (switchPolicy == NoSwitch || runningGraphicsSystemName() == QLatin1String("raster"))
- return;
-
- if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
- qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system.");
- else {
- triggerSwitchCallbacks(0, "raster");
-
- QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
- app->setGraphicsSystem(QLatin1String("raster"));
-
- QMeeGoLivePixmapData::invalidateSurfaces();
-
- triggerSwitchCallbacks(1, "raster");
- }
-}
-
-void QMeeGoGraphicsSystem::registerSwitchCallback(QMeeGoSwitchCallback callback)
-{
- switchCallbacks << callback;
-}
-
-void QMeeGoGraphicsSystem::triggerSwitchCallbacks(int type, const char *name)
-{
- for (int i = 0; i < switchCallbacks.size(); ++i)
- switchCallbacks.at(i)(type, name);
-}
-
-/* C API */
-
-int qt_meego_image_to_egl_shared_image(const QImage &image)
-{
- return QMeeGoPixmapData::imageToEGLSharedImage(image);
-}
-
-QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage)
-{
- return QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(handle, softImage);
-}
-
-QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h)
-{
- return QMeeGoGraphicsSystem::pixmapDataWithGLTexture(w, h);
-}
-
-bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle)
-{
- return QMeeGoPixmapData::destroyEGLSharedImage(handle);
-}
-
-void qt_meego_set_surface_fixed_size(int width, int height)
-{
- QMeeGoGraphicsSystem::setSurfaceFixedSize(width, height);
-}
-
-void qt_meego_set_surface_scaling(int x, int y, int width, int height)
-{
- QMeeGoGraphicsSystem::setSurfaceScaling(x, y, width, height);
-}
-
-void qt_meego_set_translucent(bool translucent)
-{
- QMeeGoGraphicsSystem::setTranslucent(translucent);
-}
-
-void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap)
-{
- QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(pixmap);
-}
-
-QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format)
-{
- return QMeeGoGraphicsSystem::pixmapDataWithNewLiveTexture(w, h, format);
-}
-
-QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle)
-{
- return QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(handle);
-}
-
-QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync)
-{
- return QMeeGoGraphicsSystem::lockLiveTexture(pixmap, fenceSync);
-}
-
-bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image)
-{
- return QMeeGoGraphicsSystem::releaseLiveTexture(pixmap, image);
-}
-
-Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap)
-{
- return QMeeGoGraphicsSystem::getLiveTextureHandle(pixmap);
-}
-
-void* qt_meego_create_fence_sync(void)
-{
- return QMeeGoGraphicsSystem::createFenceSync();
-}
-
-void qt_meego_destroy_fence_sync(void* fs)
-{
- return QMeeGoGraphicsSystem::destroyFenceSync(fs);
-}
-
-void qt_meego_invalidate_live_surfaces(void)
-{
- return QMeeGoLivePixmapData::invalidateSurfaces();
-}
-
-void qt_meego_switch_to_raster(void)
-{
- QMeeGoGraphicsSystem::switchToRaster();
-}
-
-void qt_meego_switch_to_meego(void)
-{
- QMeeGoGraphicsSystem::switchToMeeGo();
-}
-
-void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback)
-{
- QMeeGoGraphicsSystem::registerSwitchCallback(callback);
-}
-
-void qt_meego_set_switch_policy(int policy)
-{
- QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::SwitchPolicy(policy);
-}
-
-#include "qmeegographicssystem.moc"
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
deleted file mode 100644
index 352842546f..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MGRAPHICSSYSTEM_H
-#define MGRAPHICSSYSTEM_H
-
-#include <private/qgraphicssystem_p.h>
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-extern "C" typedef void (*QMeeGoSwitchCallback)(int type, const char *name);
-
-class QMeeGoGraphicsSystem : public QGraphicsSystem
-{
-public:
- enum SwitchPolicy { AutomaticSwitch, ManualSwitch, NoSwitch };
-
- QMeeGoGraphicsSystem();
- ~QMeeGoGraphicsSystem();
-
- virtual QWindowSurface *createWindowSurface(QWidget *widget) const;
- virtual QPixmapData *createPixmapData(QPixmapData::PixelType) const;
- virtual QPixmapData *createPixmapData(QPixmapData *origin);
-
- static QPixmapData *wrapPixmapData(QPixmapData *pmd);
- static void setSurfaceFixedSize(int width, int height);
- static void setSurfaceScaling(int x, int y, int width, int height);
- static void setTranslucent(bool translucent);
-
- static QPixmapData *pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
- static QPixmapData *pixmapDataFromEGLImage(Qt::HANDLE handle);
- static QPixmapData *pixmapDataWithGLTexture(int w, int h);
- static void updateEGLSharedImagePixmap(QPixmap *pixmap);
-
- static QPixmapData *pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format);
- static QPixmapData *pixmapDataFromLiveTextureHandle(Qt::HANDLE handle);
- static QImage *lockLiveTexture(QPixmap* pixmap, void* fenceSync);
- static bool releaseLiveTexture(QPixmap *pixmap, QImage *image);
- static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap);
-
- static void* createFenceSync();
- static void destroyFenceSync(void* fenceSync);
-
- static void switchToRaster();
- static void switchToMeeGo();
- static QString runningGraphicsSystemName();
-
- static void registerSwitchCallback(QMeeGoSwitchCallback callback);
-
- static SwitchPolicy switchPolicy;
-
-private:
- static bool meeGoRunning();
- static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap);
- static void destroySurfaceForLiveTexturePixmap(QPixmapData* pmd);
- static void triggerSwitchCallbacks(int type, const char *name);
-
- static bool surfaceWasCreated;
- static QHash<Qt::HANDLE, QPixmap*> liveTexturePixmaps;
- static QList<QMeeGoSwitchCallback> switchCallbacks;
-};
-
-/* C api */
-
-extern "C" {
- Q_DECL_EXPORT int qt_meego_image_to_egl_shared_image(const QImage &image);
- Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage);
- Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h);
- Q_DECL_EXPORT void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap);
- Q_DECL_EXPORT bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle);
- Q_DECL_EXPORT void qt_meego_set_surface_fixed_size(int width, int height);
- Q_DECL_EXPORT void qt_meego_set_surface_scaling(int x, int y, int width, int height);
- Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent);
- Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format);
- Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle);
- Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync);
- Q_DECL_EXPORT bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image);
- Q_DECL_EXPORT Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap);
- Q_DECL_EXPORT void* qt_meego_create_fence_sync(void);
- Q_DECL_EXPORT void qt_meego_destroy_fence_sync(void* fs);
- Q_DECL_EXPORT void qt_meego_invalidate_live_surfaces(void);
- Q_DECL_EXPORT void qt_meego_switch_to_raster(void);
- Q_DECL_EXPORT void qt_meego_switch_to_meego(void);
- Q_DECL_EXPORT void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback);
- Q_DECL_EXPORT void qt_meego_set_switch_policy(int policy);
-}
-
-#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp
deleted file mode 100644
index c7410c2b88..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include "qmeegographicssystemplugin.h"
-#include "qmeegographicssystem.h"
-
-QStringList QMeeGoGraphicsSystemPlugin::keys() const
-{
- QStringList list;
- list << "meego";
- return list;
-}
-
-QGraphicsSystem *QMeeGoGraphicsSystemPlugin::create(const QString&)
-{
- return new QMeeGoGraphicsSystem;
-}
-
-Q_EXPORT_PLUGIN2(meego, QMeeGoGraphicsSystemPlugin)
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h
deleted file mode 100644
index 1fc884476a..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MGRAPHICSSYSTEMPLUGIN_H
-#define MGRAPHICSSYSTEMPLUGIN_H
-
-#include <private/qgraphicssystemplugin_p.h>
-
-class QMeeGoGraphicsSystemPlugin : public QGraphicsSystemPlugin
-{
-public:
- virtual QStringList keys() const;
- virtual QGraphicsSystem *create(const QString&);
-};
-
-#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
deleted file mode 100644
index b6ba7ec29f..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmeegolivepixmapdata.h"
-#include "qmeegorasterpixmapdata.h"
-#include <private/qimage_p.h>
-#include <private/qwindowsurface_gl_p.h>
-#include <private/qeglcontext_p.h>
-#include <private/qapplication_p.h>
-#include <private/qgraphicssystem_runtime_p.h>
-#include <private/qpixmap_x11_p.h>
-#include <stdio.h>
-
-static QMeeGoLivePixmapDataList all_live_pixmaps;
-
-static EGLint lock_attribs[] = {
- EGL_MAP_PRESERVE_PIXELS_KHR, EGL_TRUE,
- EGL_LOCK_USAGE_HINT_KHR, EGL_READ_SURFACE_BIT_KHR | EGL_WRITE_SURFACE_BIT_KHR,
- EGL_NONE
-};
-
-static EGLint preserved_attribs[] = {
- EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
- EGL_NONE
-};
-
-// as copied from qwindowsurface.cpp
-void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
-{
- // make sure we don't detach
- uchar *mem = const_cast<uchar*>(const_cast<const QImage &>(img).bits());
-
- int lineskip = img.bytesPerLine();
- int depth = img.depth() >> 3;
-
- const QRect imageRect(0, 0, img.width(), img.height());
- const QRect r = rect & imageRect & imageRect.translated(-offset);
- const QPoint p = rect.topLeft() + offset;
-
- if (r.isEmpty())
- return;
-
- const uchar *src;
- uchar *dest;
-
- if (r.top() < p.y()) {
- src = mem + r.bottom() * lineskip + r.left() * depth;
- dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth;
- lineskip = -lineskip;
- } else {
- src = mem + r.top() * lineskip + r.left() * depth;
- dest = mem + p.y() * lineskip + p.x() * depth;
- }
-
- const int w = r.width();
- int h = r.height();
- const int bytes = w * depth;
-
- // overlapping segments?
- if (offset.y() == 0 && qAbs(offset.x()) < w) {
- do {
- ::memmove(dest, src, bytes);
- dest += lineskip;
- src += lineskip;
- } while (--h);
- } else {
- do {
- ::memcpy(dest, src, bytes);
- dest += lineskip;
- src += lineskip;
- } while (--h);
- }
-}
-
-/* Public */
-
-QMeeGoLivePixmapData::QMeeGoLivePixmapData(int w, int h, QImage::Format format) : QGLPixmapData(QPixmapData::PixmapType)
-{
- QImage image(w, h, format);
- QX11PixmapData *pmd = new QX11PixmapData(QPixmapData::PixmapType);
- pmd->fromImage(image, Qt::NoOpaqueDetection);
- backingX11Pixmap = new QPixmap(pmd);
-
- initializeThroughEGLImage();
-
- pos = all_live_pixmaps.insert(all_live_pixmaps.begin(), this);
-}
-
-QMeeGoLivePixmapData::QMeeGoLivePixmapData(Qt::HANDLE h) : QGLPixmapData(QPixmapData::PixmapType)
-{
- backingX11Pixmap = new QPixmap(QPixmap::fromX11Pixmap(h));
- initializeThroughEGLImage();
-
- pos = all_live_pixmaps.insert(all_live_pixmaps.begin(), this);
-}
-
-QMeeGoLivePixmapData::~QMeeGoLivePixmapData()
-{
- delete backingX11Pixmap;
- all_live_pixmaps.erase(pos);
-}
-
-void QMeeGoLivePixmapData::initializeThroughEGLImage()
-{
- if (texture()->id != 0)
- return;
-
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
- QMeeGoExtensions::ensureInitialized();
-
- EGLImageKHR eglImage = EGL_NO_IMAGE_KHR;
- GLuint newTextureId = 0;
-
- eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
- (EGLClientBuffer) backingX11Pixmap->handle(), preserved_attribs);
-
- if (eglImage == EGL_NO_IMAGE_KHR) {
- qWarning("eglCreateImageKHR failed (live texture)!");
- return;
- }
-
- glGenTextures(1, &newTextureId);
- glBindTexture(GL_TEXTURE_2D, newTextureId);
-
- glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (EGLImageKHR) eglImage);
- if (glGetError() == GL_NO_ERROR) {
- resize(backingX11Pixmap->width(), backingX11Pixmap->height());
- texture()->id = newTextureId;
- texture()->options &= ~QGLContext::InvertedYBindOption;
- m_hasAlpha = backingX11Pixmap->hasAlphaChannel();
- } else {
- qWarning("Failed to create a texture from an egl image (live texture)!");
- glDeleteTextures(1, &newTextureId);
- }
-
- QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
-}
-
-QPixmapData *QMeeGoLivePixmapData::createCompatiblePixmapData() const
-{
- qWarning("Create compatible called on live pixmap! Expect fail soon...");
- return new QMeeGoRasterPixmapData(pixelType());
-}
-
-QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync)
-{
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
- QMeeGoExtensions::ensureInitialized();
-
- if (fenceSync) {
- QMeeGoExtensions::eglClientWaitSyncKHR(QEgl::display(),
- fenceSync,
- EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
- EGL_FOREVER_KHR);
- }
-
- void *data = 0;
- int pitch = 0;
- int surfaceWidth = 0;
- int surfaceHeight = 0;
- EGLSurface surface = 0;
- QImage::Format format;
- lockedImage = QImage();
-
- surface = getSurfaceForBackingPixmap();
- if (! QMeeGoExtensions::eglLockSurfaceKHR(QEgl::display(), surface, lock_attribs)) {
- qWarning("Failed to lock surface (live texture)!");
- return &lockedImage;
- }
-
- eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_POINTER_KHR, (EGLint*) &data);
- eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_PITCH_KHR, (EGLint*) &pitch);
- eglQuerySurface(QEgl::display(), surface, EGL_WIDTH, (EGLint*) &surfaceWidth);
- eglQuerySurface(QEgl::display(), surface, EGL_HEIGHT, (EGLint*) &surfaceHeight);
-
- // Ok, here we know we just support those two formats. Real solution would be:
- // query also the format.
- if (backingX11Pixmap->depth() > 16)
- format = QImage::Format_ARGB32_Premultiplied;
- else
- format = QImage::Format_RGB16;
-
- if (data == NULL || pitch == 0) {
- qWarning("Failed to query the live texture!");
- return &lockedImage;
- }
-
- if (width() != surfaceWidth || height() != surfaceHeight) {
- qWarning("Live texture dimensions don't match!");
- QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), surface);
- return &lockedImage;
- }
-
- lockedImage = QImage((uchar *) data, width(), height(), pitch, format);
- return &lockedImage;
-}
-
-bool QMeeGoLivePixmapData::release(QImage* /*img*/)
-{
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
- QMeeGoExtensions::ensureInitialized();
-
- if (QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), getSurfaceForBackingPixmap())) {
- lockedImage = QImage();
- return true;
- } else {
- lockedImage = QImage();
- return false;
- }
-}
-
-Qt::HANDLE QMeeGoLivePixmapData::handle()
-{
- return backingX11Pixmap->handle();
-}
-
-bool QMeeGoLivePixmapData::scroll(int dx, int dy, const QRect &rect)
-{
- lock(NULL);
-
- if (!lockedImage.isNull())
- qt_scrollRectInImage(lockedImage, rect, QPoint(dx, dy));
-
- release(&lockedImage);
- return true;
-}
-
-EGLSurface QMeeGoLivePixmapData::getSurfaceForBackingPixmap()
-{
- initializeThroughEGLImage();
-
- // This code is a crative remix of the stuff that can be found in the
- // Qt's TFP implementation in /src/opengl/qgl_x11egl.cpp ::bindiTextureFromNativePixmap
- QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(backingX11Pixmap->data_ptr().data());
- Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class);
- bool hasAlpha = pixmapData->hasAlphaChannel();
-
- if (pixmapData->gl_surface &&
- hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha))
- return pixmapData->gl_surface;
-
- // Check to see if the surface is still valid
- if (pixmapData->gl_surface &&
- hasAlpha != ((pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha) > 0)) {
- // Surface is invalid!
- destroySurfaceForPixmapData(pixmapData);
- }
-
- if (pixmapData->gl_surface == 0) {
- EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap,
- QEgl::OpenGL,
- hasAlpha ? QEgl::Translucent : QEgl::NoOptions);
-
- pixmapData->gl_surface = (void*)QEgl::createSurface(backingX11Pixmap, config);
-
- if (hasAlpha)
- pixmapData->flags |= QX11PixmapData::GlSurfaceCreatedWithAlpha;
- else
- pixmapData->flags &= ~QX11PixmapData::GlSurfaceCreatedWithAlpha;
-
- if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE)
- return NULL;
- }
-
- return pixmapData->gl_surface;
-}
-
-void QMeeGoLivePixmapData::destroySurfaceForPixmapData(QPixmapData* pmd)
-{
- Q_ASSERT(pmd->classId() == QPixmapData::X11Class);
- QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
- if (pixmapData->gl_surface) {
- eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface);
- pixmapData->gl_surface = 0;
- }
-}
-
-void QMeeGoLivePixmapData::invalidateSurfaces()
-{
- foreach (QMeeGoLivePixmapData *data, all_live_pixmaps) {
- QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(data->backingX11Pixmap->data_ptr().data());
- *data->texture() = QGLTexture();
- pixmapData->gl_surface = 0;
- }
-}
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
deleted file mode 100644
index 616b33cc95..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MLIVEPIXMAPDATA_H
-#define MLIVEPIXMAPDATA_H
-
-#include <QLinkedList>
-#include <private/qpixmapdata_gl_p.h>
-#include "qmeegoextensions.h"
-
-class QMeeGoLivePixmapData;
-typedef QLinkedList<QMeeGoLivePixmapData *> QMeeGoLivePixmapDataList;
-
-class QMeeGoLivePixmapData : public QGLPixmapData
-{
-public:
- QMeeGoLivePixmapData(int w, int h, QImage::Format format);
- QMeeGoLivePixmapData(Qt::HANDLE h);
- ~QMeeGoLivePixmapData();
-
- QPixmapData *createCompatiblePixmapData() const;
- bool scroll(int dx, int dy, const QRect &rect);
-
- void initializeThroughEGLImage();
-
- QImage* lock(EGLSyncKHR fenceSync);
- bool release(QImage *img);
- Qt::HANDLE handle();
-
- EGLSurface getSurfaceForBackingPixmap();
- void destroySurfaceForPixmapData(QPixmapData* pmd);
-
- QPixmap *backingX11Pixmap;
- QImage lockedImage;
- QMeeGoLivePixmapDataList::Iterator pos;
-
- static void invalidateSurfaces();
-};
-
-#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
deleted file mode 100644
index ba3799fc33..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmeegopixmapdata.h"
-#include "qmeegoextensions.h"
-#include "qmeegorasterpixmapdata.h"
-#include <private/qimage_p.h>
-#include <private/qwindowsurface_gl_p.h>
-#include <private/qeglcontext_p.h>
-#include <private/qapplication_p.h>
-#include <private/qgraphicssystem_runtime_p.h>
-
-// from dithering.cpp
-extern unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride);
-extern unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride);
-extern unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride);
-
-static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE };
-
-QHash <void*, QMeeGoImageInfo*> QMeeGoPixmapData::sharedImagesMap;
-
-/* Public */
-
-QMeeGoPixmapData::QMeeGoPixmapData() : QGLPixmapData(QPixmapData::PixmapType)
-{
-}
-
-void QMeeGoPixmapData::fromTexture(GLuint textureId, int w, int h, bool alpha)
-{
- resize(w, h);
- texture()->id = textureId;
- m_hasAlpha = alpha;
- softImage = QImage();
-}
-
-QImage QMeeGoPixmapData::toImage() const
-{
- return softImage;
-}
-
-void QMeeGoPixmapData::fromImage(const QImage &image,
- Qt::ImageConversionFlags flags)
-{
- void *rawResource = static_cast <void *> (((QImage &) image).data_ptr()->data);
-
- if (sharedImagesMap.contains(rawResource)) {
- QMeeGoImageInfo *info = sharedImagesMap.value(rawResource);
- fromEGLSharedImage(info->handle, image);
- } else {
- // This should *never* happen since the graphics system should never
- // create a QMeeGoPixmapData for an origin that doesn't contain a raster
- // image we know about. But...
- qWarning("QMeeGoPixmapData::fromImage called on non-know resource. Falling back...");
- QGLPixmapData::fromImage(image, flags);
- }
-}
-
-void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si)
-{
- if (si.isNull())
- qFatal("Trying to build pixmap with an empty/null softimage!");
-
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
-
- QMeeGoExtensions::ensureInitialized();
-
- bool textureIsBound = false;
- GLuint newTextureId;
- GLint newWidth, newHeight;
-
- glGenTextures(1, &newTextureId);
- glBindTexture(GL_TEXTURE_2D, newTextureId);
-
- EGLImageKHR image = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_SHARED_IMAGE_NOK,
- (EGLClientBuffer)handle, preserved_image_attribs);
-
- if (image != EGL_NO_IMAGE_KHR) {
- glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
- GLint err = glGetError();
- if (err == GL_NO_ERROR)
- textureIsBound = true;
-
- QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_WIDTH, &newWidth);
- QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_HEIGHT, &newHeight);
-
- QEgl::eglDestroyImageKHR(QEgl::display(), image);
- }
-
- if (textureIsBound) {
- fromTexture(newTextureId, newWidth, newHeight,
- (si.hasAlphaChannel() && const_cast<QImage &>(si).data_ptr()->checkForAlphaPixels()));
- texture()->options &= ~QGLContext::InvertedYBindOption;
- softImage = si;
- QMeeGoPixmapData::registerSharedImage(handle, softImage);
- } else {
- qWarning("Failed to create a texture from a shared image!");
- glDeleteTextures(1, &newTextureId);
- }
-}
-
-Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image)
-{
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
-
- QMeeGoExtensions::ensureInitialized();
-
- GLuint textureId;
-
- glGenTextures(1, &textureId);
- glBindTexture(GL_TEXTURE_2D, textureId);
- if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()) {
- void *converted = convertBGRA32_to_RGBA32(image.bits(), image.width(), image.height(), image.bytesPerLine());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, converted);
- free(converted);
- } else {
- void *converted = convertRGB32_to_RGB565(image.bits(), image.width(), image.height(), image.bytesPerLine());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, converted);
- free(converted);
- }
-
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-
- glBindTexture(GL_TEXTURE_2D, textureId);
- EGLImageKHR eglimage = QEgl::eglCreateImageKHR(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->context(),
- EGL_GL_TEXTURE_2D_KHR,
- (EGLClientBuffer) textureId,
- preserved_image_attribs);
- glDeleteTextures(1, &textureId);
- if (eglimage) {
- EGLNativeSharedImageTypeNOK handle = QMeeGoExtensions::eglCreateSharedImageNOK(QEgl::display(), eglimage, NULL);
- QEgl::eglDestroyImageKHR(QEgl::display(), eglimage);
- return (Qt::HANDLE) handle;
- } else {
- qWarning("Failed to create shared image from pixmap/texture!");
- return 0;
- }
-}
-
-void QMeeGoPixmapData::updateFromSoftImage()
-{
- // FIXME That's broken with recent 16bit textures changes.
- m_dirty = true;
- m_source = softImage;
- ensureCreated();
-
- if (softImage.width() != w || softImage.height() != h)
- qWarning("Ooops, looks like softImage changed dimensions since last updated! Corruption ahead?!");
-}
-
-bool QMeeGoPixmapData::destroyEGLSharedImage(Qt::HANDLE h)
-{
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
- QMeeGoExtensions::ensureInitialized();
-
- QMutableHashIterator <void*, QMeeGoImageInfo*> i(sharedImagesMap);
- while (i.hasNext()) {
- i.next();
- if (i.value()->handle == h)
- i.remove();
- }
-
- return QMeeGoExtensions::eglDestroySharedImageNOK(QEgl::display(), (EGLNativeSharedImageTypeNOK) h);
-}
-
-void QMeeGoPixmapData::registerSharedImage(Qt::HANDLE handle, const QImage &si)
-{
- void *raw = static_cast <void *> (((QImage) si).data_ptr()->data);
- QMeeGoImageInfo *info;
-
- if (! sharedImagesMap.contains(raw)) {
- info = new QMeeGoImageInfo;
- info->handle = handle;
- info->rawFormat = si.format();
- sharedImagesMap.insert(raw, info);
- } else {
- info = sharedImagesMap.value(raw);
- if (info->handle != handle || info->rawFormat != si.format())
- qWarning("Inconsistency detected: overwriting entry in sharedImagesMap but handle/format different");
- }
-}
-
-QPixmapData *QMeeGoPixmapData::createCompatiblePixmapData() const
-{
- return new QMeeGoRasterPixmapData(pixelType());
-}
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h
deleted file mode 100644
index a3d3bbb0b5..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MPIXMAPDATA_H
-#define MPIXMAPDATA_H
-
-#include <private/qpixmapdata_gl_p.h>
-
-struct QMeeGoImageInfo
-{
- Qt::HANDLE handle;
- QImage::Format rawFormat;
-};
-
-class QMeeGoPixmapData : public QGLPixmapData
-{
-public:
- QMeeGoPixmapData();
- void fromTexture(GLuint textureId, int w, int h, bool alpha);
- QPixmapData *createCompatiblePixmapData() const;
-
- virtual void fromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
- virtual void fromImage (const QImage &image, Qt::ImageConversionFlags flags);
- virtual QImage toImage() const;
- virtual void updateFromSoftImage();
-
- QImage softImage;
-
- static QHash <void*, QMeeGoImageInfo*> sharedImagesMap;
-
- static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
- static bool destroyEGLSharedImage(Qt::HANDLE h);
- static void registerSharedImage(Qt::HANDLE handle, const QImage &si);
-};
-
-#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.cpp
deleted file mode 100644
index 5b8f23e453..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmeegorasterpixmapdata.h"
-
-/* Public */
-
-QMeeGoRasterPixmapData::QMeeGoRasterPixmapData() : QRasterPixmapData(QPixmapData::PixmapType)
-{
-}
-
-QMeeGoRasterPixmapData::QMeeGoRasterPixmapData(QPixmapData::PixelType t) : QRasterPixmapData(t)
-{
-}
-
-void QMeeGoRasterPixmapData::copy(const QPixmapData *data, const QRect &rect)
-{
- if (data->classId() == QPixmapData::OpenGLClass)
- fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection);
- else
- QRasterPixmapData::copy(data, rect);
-}
diff --git a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.h b/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.h
deleted file mode 100644
index 4320659fe9..0000000000
--- a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MRASTERPIXMAPDATA_H
-#define MRASTERPIXMAPDATA_H
-
-#include <private/qpixmap_raster_p.h>
-
-class QMeeGoRasterPixmapData : public QRasterPixmapData
-{
-public:
- QMeeGoRasterPixmapData();
- QMeeGoRasterPixmapData(QPixmapData::PixelType t);
- void copy(const QPixmapData *data, const QRect &rect);
-};
-
-#endif
diff --git a/src/plugins/graphicssystems/opengl/main.cpp b/src/plugins/graphicssystems/opengl/main.cpp
deleted file mode 100644
index 4c8f928d66..0000000000
--- a/src/plugins/graphicssystems/opengl/main.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qgraphicssystemplugin_p.h>
-#include <private/qgraphicssystem_gl_p.h>
-#include <qgl.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGLGraphicsSystemPlugin : public QGraphicsSystemPlugin
-{
-public:
- QStringList keys() const;
- QGraphicsSystem *create(const QString&);
-};
-
-QStringList QGLGraphicsSystemPlugin::keys() const
-{
- QStringList list;
- list << QLatin1String("OpenGL") << QLatin1String("OpenGL1");
-#if !defined(QT_OPENGL_ES_1)
- list << QLatin1String("OpenGL2");
-#endif
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
- list << QLatin1String("X11GL");
-#endif
- return list;
-}
-
-QGraphicsSystem* QGLGraphicsSystemPlugin::create(const QString& system)
-{
- if (system.toLower() == QLatin1String("opengl1")) {
- QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
- return new QGLGraphicsSystem(false);
- }
-
-#if !defined(QT_OPENGL_ES_1)
- if (system.toLower() == QLatin1String("opengl2")) {
- QGL::setPreferredPaintEngine(QPaintEngine::OpenGL2);
- return new QGLGraphicsSystem(false);
- }
-#endif
-
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
- if (system.toLower() == QLatin1String("x11gl"))
- return new QGLGraphicsSystem(true);
-#endif
-
- if (system.toLower() == QLatin1String("opengl"))
- return new QGLGraphicsSystem(false);
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(opengl, QGLGraphicsSystemPlugin)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/opengl/opengl.pro b/src/plugins/graphicssystems/opengl/opengl.pro
deleted file mode 100644
index 30c88271b6..0000000000
--- a/src/plugins/graphicssystems/opengl/opengl.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = qglgraphicssystem
-include(../../qpluginbase.pri)
-
-QT += core-private gui-private opengl-private
-
-DESTDIR = $$QT.gui.plugins/graphicssystems
-
-SOURCES = main.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
-INSTALLS += target
-
-symbian: TARGET.UID3 = 0x2002131B
diff --git a/src/plugins/graphicssystems/openvg/main.cpp b/src/plugins/graphicssystems/openvg/main.cpp
deleted file mode 100644
index 6cf368aba8..0000000000
--- a/src/plugins/graphicssystems/openvg/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qgraphicssystemplugin_p.h>
-#include "qgraphicssystem_vg_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin
-{
-public:
- QStringList keys() const;
- QGraphicsSystem *create(const QString&);
-};
-
-QStringList QVGGraphicsSystemPlugin::keys() const
-{
- QStringList list;
- list << "OpenVG";
- return list;
-}
-
-QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system)
-{
- if (system.toLower() == "openvg")
- return new QVGGraphicsSystem;
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/openvg/openvg.pro b/src/plugins/graphicssystems/openvg/openvg.pro
deleted file mode 100644
index 6f8b13907a..0000000000
--- a/src/plugins/graphicssystems/openvg/openvg.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qvggraphicssystem
-include(../../qpluginbase.pri)
-
-QT += openvg
-
-DESTDIR = $$QT.gui.plugins/graphicssystems
-
-SOURCES = main.cpp qgraphicssystem_vg.cpp
-HEADERS = qgraphicssystem_vg_p.h
-
-target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
-INSTALLS += target
-
-symbian: TARGET.UID3 = 0x2001E62C
diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp
deleted file mode 100644
index 4b4f677026..0000000000
--- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_vg_p.h"
-#include <QtOpenVG/private/qpixmapdata_vg_p.h>
-#include <QtOpenVG/private/qwindowsurface_vg_p.h>
-#include <QtOpenVG/private/qvgimagepool_p.h>
-#if defined(Q_OS_SYMBIAN)
-#include <QtGui/private/qwidget_p.h>
-#endif
-#include <QtGui/private/qapplication_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QVGGraphicsSystem::QVGGraphicsSystem()
-{
- QApplicationPrivate::graphics_system_name = QLatin1String("openvg");
-}
-
-QPixmapData *QVGGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
-#if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QVG_NO_PIXMAP_DATA)
- // Pixmaps can use QVGPixmapData; bitmaps must use raster.
- if (type == QPixmapData::PixmapType)
- return new QVGPixmapData(type);
- else
- return new QRasterPixmapData(type);
-#else
- return new QRasterPixmapData(type);
-#endif
-}
-
-QWindowSurface *QVGGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
-#if defined(Q_OS_SYMBIAN)
- if (!QApplicationPrivate::instance()->useTranslucentEGLSurfaces) {
- QWidgetPrivate *d = qt_widget_private(widget);
- if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground))
- return d->createDefaultWindowSurface_sys();
- }
-#endif
- return new QVGWindowSurface(widget);
-}
-
-void QVGGraphicsSystem::releaseCachedResources()
-{
- QVGImagePool::instance()->hibernate();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h
deleted file mode 100644
index 9c9b3e2b2e..0000000000
--- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_VG_P_H
-#define QGRAPHICSSYSTEM_VG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qgraphicssystem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVGGraphicsSystem : public QGraphicsSystem
-{
-public:
- QVGGraphicsSystem();
-
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-
- void releaseCachedResources();
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/graphicssystems/shivavg/README b/src/plugins/graphicssystems/shivavg/README
deleted file mode 100644
index 15ee7101e8..0000000000
--- a/src/plugins/graphicssystems/shivavg/README
+++ /dev/null
@@ -1,8 +0,0 @@
-
-This graphics system uses ShivaVG (http://sourceforge.net/projects/shivavg)
-to perform OpenVG rendering on X11 systems. The graphics system name for
-the "-graphicssystem" command-line option is "ShivaVG".
-
-ShivaVG support is experimental, mostly to demonstrate how to integrate
-non-EGL OpenVG engines into the system. It will probably not produce
-good output.
diff --git a/src/plugins/graphicssystems/shivavg/main.cpp b/src/plugins/graphicssystems/shivavg/main.cpp
deleted file mode 100644
index 2a95ed6afe..0000000000
--- a/src/plugins/graphicssystems/shivavg/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qgraphicssystemplugin_p.h>
-#include "shivavggraphicssystem.h"
-
-QT_BEGIN_NAMESPACE
-
-class ShivaVGGraphicsSystemPlugin : public QGraphicsSystemPlugin
-{
-public:
- QStringList keys() const;
- QGraphicsSystem *create(const QString&);
-};
-
-QStringList ShivaVGGraphicsSystemPlugin::keys() const
-{
- QStringList list;
- list << "ShivaVG";
- return list;
-}
-
-QGraphicsSystem* ShivaVGGraphicsSystemPlugin::create(const QString& system)
-{
- if (system.toLower() == "shivavg")
- return new ShivaVGGraphicsSystem;
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(shivavg, ShivaVGGraphicsSystemPlugin)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/shivavg/shivavg.pro b/src/plugins/graphicssystems/shivavg/shivavg.pro
deleted file mode 100644
index 6bf9d7a975..0000000000
--- a/src/plugins/graphicssystems/shivavg/shivavg.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qshivavggraphicssystem
-include(../../qpluginbase.pri)
-
-QT += openvg
-
-DESTDIR = $$QT.gui.plugins/graphicssystems
-
-SOURCES = main.cpp shivavggraphicssystem.cpp shivavgwindowsurface.cpp
-HEADERS = shivavggraphicssystem.h shivavgwindowsurface.h
-
-target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
-INSTALLS += target
diff --git a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.cpp b/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.cpp
deleted file mode 100644
index ee6a15d894..0000000000
--- a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "shivavggraphicssystem.h"
-#include "shivavgwindowsurface.h"
-#include <QtGui/private/qpixmap_raster_p.h>
-
-QT_BEGIN_NAMESPACE
-
-ShivaVGGraphicsSystem::ShivaVGGraphicsSystem()
-{
-}
-
-QPixmapData *ShivaVGGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
- return new QRasterPixmapData(type);
-}
-
-QWindowSurface *ShivaVGGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- return new ShivaVGWindowSurface(widget);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.h b/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.h
deleted file mode 100644
index b51bd73abc..0000000000
--- a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHIVAVGGRAPHICSSYSTEM_H
-#define SHIVAVGGRAPHICSSYSTEM_H
-
-#include <QtGui/private/qgraphicssystem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class ShivaVGGraphicsSystem : public QGraphicsSystem
-{
-public:
- ShivaVGGraphicsSystem();
-
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp b/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp
deleted file mode 100644
index 8e7a3e169f..0000000000
--- a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#define GL_GLEXT_PROTOTYPES
-#include "shivavgwindowsurface.h"
-#include <QtOpenVG/private/qpaintengine_vg_p.h>
-#if defined(Q_WS_X11)
-#include "private/qt_x11_p.h"
-#include "qx11info_x11.h"
-#include <GL/glx.h>
-
-extern QX11Info *qt_x11Info(const QPaintDevice *pd);
-#endif
-
-// Define this to use framebuffer objects.
-//#define QVG_USE_FBO 1
-
-#include <vg/openvg.h>
-
-QT_BEGIN_NAMESPACE
-
-class QShivaContext
-{
-public:
- QShivaContext();
- ~QShivaContext();
-
- bool makeCurrent(ShivaVGWindowSurfacePrivate *surface);
- void doneCurrent();
-
- bool initialized;
- QSize currentSize;
- ShivaVGWindowSurfacePrivate *currentSurface;
-};
-
-Q_GLOBAL_STATIC(QShivaContext, shivaContext);
-
-class ShivaVGWindowSurfacePrivate
-{
-public:
- ShivaVGWindowSurfacePrivate()
- : isCurrent(false)
- , needsResize(true)
- , engine(0)
-#if defined(QVG_USE_FBO)
- , fbo(0)
- , texture(0)
-#endif
-#if defined(Q_WS_X11)
- , drawable(0)
- , context(0)
-#endif
- {
- }
- ~ShivaVGWindowSurfacePrivate();
-
- void ensureContext(QWidget *widget);
-
- QSize size;
- bool isCurrent;
- bool needsResize;
- QVGPaintEngine *engine;
-#if defined(QVG_USE_FBO)
- GLuint fbo;
- GLuint texture;
-#endif
-#if defined(Q_WS_X11)
- GLXDrawable drawable;
- GLXContext context;
-#endif
-};
-
-QShivaContext::QShivaContext()
- : initialized(false)
- , currentSurface(0)
-{
-}
-
-QShivaContext::~QShivaContext()
-{
- if (initialized)
- vgDestroyContextSH();
-}
-
-bool QShivaContext::makeCurrent(ShivaVGWindowSurfacePrivate *surface)
-{
- if (currentSurface)
- currentSurface->isCurrent = false;
- surface->isCurrent = true;
- currentSurface = surface;
- currentSize = surface->size;
-#if defined(Q_WS_X11)
- glXMakeCurrent(X11->display, surface->drawable, surface->context);
-#endif
- if (!initialized) {
- if (!vgCreateContextSH(currentSize.width(), currentSize.height())) {
- qWarning("vgCreateContextSH(%d, %d): could not create context", currentSize.width(), currentSize.height());
- return false;
- }
- initialized = true;
- } else {
- vgResizeSurfaceSH(currentSize.width(), currentSize.height());
- }
-#if defined(QVG_USE_FBO)
- if (surface->fbo)
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, surface->fbo);
- else
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-#endif
- return true;
-}
-
-void QShivaContext::doneCurrent()
-{
- if (currentSurface) {
- currentSurface->isCurrent = false;
- currentSurface = 0;
- }
-#if defined(Q_WS_X11)
- glXMakeCurrent(X11->display, 0, 0);
-#endif
-}
-
-ShivaVGWindowSurfacePrivate::~ShivaVGWindowSurfacePrivate()
-{
-#if defined(QVG_USE_FBO)
- if (fbo) {
- glDeleteTextures(1, &texture);
- glDeleteFramebuffersEXT(1, &fbo);
- }
-#endif
-}
-
-void ShivaVGWindowSurfacePrivate::ensureContext(QWidget *widget)
-{
-#if defined(Q_WS_X11)
- Window win = widget->winId();
- if (win != drawable) {
- if (context)
- glXDestroyContext(X11->display, context);
- drawable = win;
- }
- if (context == 0) {
- const QX11Info *xinfo = qt_x11Info(widget);
- int spec[64];
- int i = 0;
- spec[i++] = GLX_DOUBLEBUFFER;
- spec[i++] = GLX_DEPTH_SIZE;
- spec[i++] = 1;
- spec[i++] = GLX_STENCIL_SIZE;
- spec[i++] = 1;
- spec[i++] = GLX_RGBA;
- spec[i++] = GLX_RED_SIZE;
- spec[i++] = 1;
- spec[i++] = GLX_GREEN_SIZE;
- spec[i++] = 1;
- spec[i++] = GLX_BLUE_SIZE;
- spec[i++] = 1;
- spec[i++] = GLX_SAMPLE_BUFFERS_ARB;
- spec[i++] = 1;
- spec[i++] = GLX_SAMPLES_ARB;
- spec[i++] = 4;
- spec[i] = XNone;
- XVisualInfo *visual = glXChooseVisual
- (xinfo->display(), xinfo->screen(), spec);
- context = glXCreateContext(X11->display, visual, 0, True);
- if (!context)
- qWarning("glXCreateContext: could not create GL context for VG rendering");
- }
-#else
- Q_UNUSED(widget);
-#endif
-#if defined(QVG_USE_FBO)
- if (needsResize && fbo) {
-#if defined(Q_WS_X11)
- glXMakeCurrent(X11->display, drawable, context);
-#endif
- glDeleteTextures(1, &texture);
- glDeleteFramebuffersEXT(1, &fbo);
-#if defined(Q_WS_X11)
- glXMakeCurrent(X11->display, 0, 0);
-#endif
- fbo = 0;
- texture = 0;
- }
- if (!fbo) {
-#if defined(Q_WS_X11)
- glXMakeCurrent(X11->display, drawable, context);
-#endif
- glGenFramebuffersEXT(1, &fbo);
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
-
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, size.width(), size.height(), 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glFramebufferTexture2DEXT
- (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D,
- texture, 0);
-
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-#if defined(Q_WS_X11)
- glXMakeCurrent(X11->display, 0, 0);
-#endif
- }
-#endif
- needsResize = false;
-}
-
-ShivaVGWindowSurface::ShivaVGWindowSurface(QWidget *window)
- : QWindowSurface(window), d_ptr(new ShivaVGWindowSurfacePrivate)
-{
-}
-
-ShivaVGWindowSurface::~ShivaVGWindowSurface()
-{
- if (d_ptr->isCurrent) {
- shivaContext()->doneCurrent();
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- }
-#if defined(Q_WS_X11)
- if (d_ptr->context)
- glXDestroyContext(X11->display, d_ptr->context);
-#endif
- delete d_ptr;
-}
-
-QPaintDevice *ShivaVGWindowSurface::paintDevice()
-{
- d_ptr->ensureContext(window());
- shivaContext()->makeCurrent(d_ptr);
- glClearDepth(0.0f);
- glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- return this;
-}
-
-void ShivaVGWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
-{
- Q_UNUSED(region);
- Q_UNUSED(offset);
- QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget();
- d_ptr->ensureContext(parent);
- QShivaContext *context = shivaContext();
- if (!d_ptr->isCurrent)
- context->makeCurrent(d_ptr);
-#if defined(QVG_USE_FBO)
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- if (d_ptr->fbo) {
- static GLfloat const vertices[][2] = {
- {-1, -1}, {1, -1}, {1, 1}, {-1, 1}
- };
- static GLfloat const texCoords[][2] = {
- {0, 0}, {1, 0}, {1, 1}, {0, 1}
- };
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glVertexPointer(2, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- glBindTexture(GL_TEXTURE_2D, d_ptr->texture);
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, 0);
- }
-#endif
-#if defined(Q_WS_X11)
- glXSwapBuffers(X11->display, d_ptr->drawable);
-#endif
- context->doneCurrent();
-}
-
-void ShivaVGWindowSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
- d_ptr->needsResize = true;
- d_ptr->size = rect.size();
-}
-
-bool ShivaVGWindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- return QWindowSurface::scroll(area, dx, dy);
-}
-
-void ShivaVGWindowSurface::beginPaint(const QRegion &region)
-{
- // Nothing to do here.
- Q_UNUSED(region);
-}
-
-void ShivaVGWindowSurface::endPaint(const QRegion &region)
-{
- // Nothing to do here.
- Q_UNUSED(region);
-}
-
-Q_GLOBAL_STATIC(QVGPaintEngine, sharedPaintEngine);
-
-QPaintEngine *ShivaVGWindowSurface::paintEngine() const
-{
- if (!d_ptr->engine)
- d_ptr->engine = sharedPaintEngine();
- return d_ptr->engine;
-}
-
-int ShivaVGWindowSurface::metric(PaintDeviceMetric met) const
-{
- return qt_paint_device_metric(window(), met);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.h b/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.h
deleted file mode 100644
index 8b1649ab17..0000000000
--- a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHIVAVGWINDOWSURFACE_H
-#define SHIVAVGWINDOWSURFACE_H
-
-#include <QtGui/private/qwindowsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class ShivaVGWindowSurfacePrivate;
-
-class ShivaVGWindowSurface : public QWindowSurface, public QPaintDevice
-{
-public:
- ShivaVGWindowSurface(QWidget *window);
- virtual ~ShivaVGWindowSurface();
-
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void setGeometry(const QRect &rect);
- bool scroll(const QRegion &area, int dx, int dy);
-
- void beginPaint(const QRegion &region);
- void endPaint(const QRegion &region);
-
- QPaintEngine *paintEngine() const;
-
-protected:
- int metric(PaintDeviceMetric metric) const;
-
-private:
- ShivaVGWindowSurfacePrivate *d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/graphicssystems/trace/main.cpp b/src/plugins/graphicssystems/trace/main.cpp
deleted file mode 100644
index 2a84d0bdce..0000000000
--- a/src/plugins/graphicssystems/trace/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qgraphicssystemplugin_p.h>
-#include "qgraphicssystem_trace_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QTraceGraphicsSystemPlugin : public QGraphicsSystemPlugin
-{
-public:
- QStringList keys() const;
- QGraphicsSystem *create(const QString&);
-};
-
-QStringList QTraceGraphicsSystemPlugin::keys() const
-{
- return QStringList(QLatin1String("Trace"));
-}
-
-QGraphicsSystem* QTraceGraphicsSystemPlugin::create(const QString& system)
-{
- if (system.toLower() == QLatin1String("trace"))
- return new QTraceGraphicsSystem;
-
- return 0;
-}
-
-Q_EXPORT_PLUGIN2(trace, QTraceGraphicsSystemPlugin)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
deleted file mode 100644
index 62b6992f84..0000000000
--- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_trace_p.h"
-#include <private/qpixmap_raster_p.h>
-#include <private/qpaintbuffer_p.h>
-#include <private/qwindowsurface_raster_p.h>
-
-#include <QFile>
-#include <QPainter>
-#include <QtDebug>
-
-QT_BEGIN_NAMESPACE
-
-class QTraceWindowSurface : public QRasterWindowSurface
-{
-public:
- QTraceWindowSurface(QWidget *widget);
- ~QTraceWindowSurface();
-
- QPaintDevice *paintDevice();
- void beginPaint(const QRegion &rgn);
- void endPaint(const QRegion &rgn);
-
- bool scroll(const QRegion &area, int dx, int dy);
-
-private:
- QPaintBuffer *buffer;
- QList<QRegion> updates;
-
- qulonglong winId;
-};
-
-QTraceWindowSurface::QTraceWindowSurface(QWidget *widget)
- : QRasterWindowSurface(widget)
- , buffer(0)
- , winId(0)
-{
-}
-
-QTraceWindowSurface::~QTraceWindowSurface()
-{
- if (buffer) {
- QFile outputFile(QString(QLatin1String("qtgraphics-%0.trace")).arg(winId));
- if (outputFile.open(QIODevice::WriteOnly)) {
- QDataStream out(&outputFile);
- out.setFloatingPointPrecision(QDataStream::SinglePrecision);
-
- out.writeBytes("qttraceV2", 9);
-
- uint version = 1;
-
- out << version << *buffer << updates;
- }
- delete buffer;
- }
-}
-
-QPaintDevice *QTraceWindowSurface::paintDevice()
-{
- if (!buffer) {
- buffer = new QPaintBuffer;
-#ifdef Q_WS_QPA
- buffer->setBoundingRect(QRect(QPoint(), size()));
-#else
- buffer->setBoundingRect(geometry());
-#endif
- }
- return buffer;
-}
-
-void QTraceWindowSurface::beginPaint(const QRegion &rgn)
-{
- // ensure paint buffer is created
- paintDevice();
- buffer->beginNewFrame();
-
- QRasterWindowSurface::beginPaint(rgn);
-}
-
-void QTraceWindowSurface::endPaint(const QRegion &rgn)
-{
- QPainter p(QRasterWindowSurface::paintDevice());
- buffer->draw(&p, buffer->numFrames()-1);
- p.end();
-
- winId = (qulonglong)window()->winId();
-
- updates << rgn;
-
- QRasterWindowSurface::endPaint(rgn);
-}
-
-bool QTraceWindowSurface::scroll(const QRegion &, int, int)
-{
- // TODO: scrolling should also be streamed and replayed
- // to test scrolling performance
- return false;
-}
-
-QTraceGraphicsSystem::QTraceGraphicsSystem()
-{
-}
-
-QPixmapData *QTraceGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
-{
- return new QRasterPixmapData(type);
-}
-
-QWindowSurface *QTraceGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- return new QTraceWindowSurface(widget);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h b/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h
deleted file mode 100644
index e5ab4af147..0000000000
--- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_TRACE_P_H
-#define QGRAPHICSSYSTEM_TRACE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qgraphicssystem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QTraceGraphicsSystem : public QGraphicsSystem
-{
-public:
- QTraceGraphicsSystem();
-
- QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/graphicssystems/trace/trace.pro b/src/plugins/graphicssystems/trace/trace.pro
deleted file mode 100644
index b31beb35f8..0000000000
--- a/src/plugins/graphicssystems/trace/trace.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = qtracegraphicssystem
-include(../../qpluginbase.pri)
-
-QT += core-private gui-private network
-
-DESTDIR = $$QT.gui.plugins/graphicssystems
-symbian:TARGET.UID3 = 0x2002130E
-
-SOURCES = main.cpp qgraphicssystem_trace.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
-INSTALLS += target
-INCLUDEPATH += ../../../3rdparty/harfbuzz/src
diff --git a/src/plugins/kbddrivers/kbddrivers.pro b/src/plugins/kbddrivers/kbddrivers.pro
deleted file mode 100644
index dbab47b366..0000000000
--- a/src/plugins/kbddrivers/kbddrivers.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-contains(kbd-plugins, linuxinput): SUBDIRS += linuxinput
diff --git a/src/plugins/kbddrivers/linuxinput/linuxinput.pro b/src/plugins/kbddrivers/linuxinput/linuxinput.pro
deleted file mode 100644
index c0af91c7f0..0000000000
--- a/src/plugins/kbddrivers/linuxinput/linuxinput.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qlinuxinputkbddriver
-include(../../qpluginbase.pri)
-
-DESTDIR = $$QT.gui.plugins/kbddrivers
-target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_KBD_LINUXINPUT
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qkbdlinuxinput_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qkbdlinuxinput_qws.cpp
-
diff --git a/src/plugins/kbddrivers/linuxinput/main.cpp b/src/plugins/kbddrivers/linuxinput/main.cpp
deleted file mode 100644
index 2158b3fac7..0000000000
--- a/src/plugins/kbddrivers/linuxinput/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qkbddriverplugin_qws.h>
-#include <qkbdlinuxinput_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-class QLinuxInputKbdDriver : public QKbdDriverPlugin
-{
-public:
- QLinuxInputKbdDriver();
-
- QStringList keys() const;
- QWSKeyboardHandler* create(const QString &driver, const QString &device);
-};
-
-QLinuxInputKbdDriver::QLinuxInputKbdDriver()
- : QKbdDriverPlugin()
-{
-}
-
-QStringList QLinuxInputKbdDriver::keys() const
-{
- return (QStringList() << QLatin1String("LinuxInput"));
-}
-
-QWSKeyboardHandler* QLinuxInputKbdDriver::create(const QString &driver,
- const QString &device)
-{
- Q_UNUSED(device);
- if (driver.compare(QLatin1String("LinuxInput"), Qt::CaseInsensitive))
- return 0;
- return new QWSLinuxInputKeyboardHandler(device);
-}
-
-Q_EXPORT_PLUGIN2(qwslinuxinputkbddriver, QLinuxInputKbdDriver)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/mousedrivers/linuxtp/linuxtp.pro b/src/plugins/mousedrivers/linuxtp/linuxtp.pro
deleted file mode 100644
index b8e26b4483..0000000000
--- a/src/plugins/mousedrivers/linuxtp/linuxtp.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qlinuxtpmousedriver
-include(../../qpluginbase.pri)
-
-DESTDIR = $$QT.gui.plugins/mousedrivers
-target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_MOUSE_LINUXTP
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qmouselinuxtp_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qmouselinuxtp_qws.cpp
-
diff --git a/src/plugins/mousedrivers/linuxtp/main.cpp b/src/plugins/mousedrivers/linuxtp/main.cpp
deleted file mode 100644
index 7ac358d4ce..0000000000
--- a/src/plugins/mousedrivers/linuxtp/main.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qmousedriverplugin_qws.h>
-#include <qmouselinuxtp_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-class QLinuxTPMouseDriver : public QMouseDriverPlugin
-{
-public:
- QLinuxTPMouseDriver();
-
- QStringList keys() const;
- QWSMouseHandler* create(const QString &driver, const QString &device);
-};
-
-QLinuxTPMouseDriver::QLinuxTPMouseDriver()
- : QMouseDriverPlugin()
-{
-}
-
-QStringList QLinuxTPMouseDriver::keys() const
-{
- return (QStringList() << "LinuxTP");
-}
-
-QWSMouseHandler* QLinuxTPMouseDriver::create(const QString &driver,
- const QString &device)
-{
- if (driver.compare(QLatin1String("LinuxTP"), Qt::CaseInsensitive))
- return 0;
- return new QWSLinuxTPMouseHandler(driver, device);
-}
-
-Q_EXPORT_PLUGIN2(qwslinuxtpmousehandler, QLinuxTPMouseDriver)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/mousedrivers/mousedrivers.pro b/src/plugins/mousedrivers/mousedrivers.pro
deleted file mode 100644
index f89682b880..0000000000
--- a/src/plugins/mousedrivers/mousedrivers.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-contains(mouse-plugins, linuxtp): SUBDIRS += linuxtp
-contains(mouse-plugins, pc): SUBDIRS += pc
-contains(mouse-plugins, tslib): SUBDIRS += tslib
-contains(mouse-plugins, linuxinput): SUBDIRS += linuxinput
diff --git a/src/plugins/mousedrivers/pc/main.cpp b/src/plugins/mousedrivers/pc/main.cpp
deleted file mode 100644
index d87ac77e6a..0000000000
--- a/src/plugins/mousedrivers/pc/main.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qmousedriverplugin_qws.h>
-#include <qmousepc_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-class QPcMouseDriver : public QMouseDriverPlugin
-{
-public:
- QPcMouseDriver();
-
- QStringList keys() const;
- QWSMouseHandler* create(const QString &driver, const QString &device);
-};
-
-QPcMouseDriver::QPcMouseDriver()
- : QMouseDriverPlugin()
-{
-}
-
-QStringList QPcMouseDriver::keys() const
-{
- return (QStringList()
- << QLatin1String("Auto")
- << QLatin1String("IntelliMouse")
- << QLatin1String("Microsoft")
- << QLatin1String("MouseSystems")
- << QLatin1String("MouseMan"));
-}
-
-QWSMouseHandler* QPcMouseDriver::create(const QString &driver,
- const QString &device)
-{
- if (!keys().contains(driver, Qt::CaseInsensitive))
- return 0;
- return new QWSPcMouseHandler(driver, device);
-}
-
-Q_EXPORT_PLUGIN2(qwspcmousehandler, QPcMouseDriver)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/mousedrivers/pc/pc.pro b/src/plugins/mousedrivers/pc/pc.pro
deleted file mode 100644
index d38e3fe5d1..0000000000
--- a/src/plugins/mousedrivers/pc/pc.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qpcmousedriver
-include(../../qpluginbase.pri)
-
-DESTDIR = $$QT.gui.plugins/mousedrivers
-target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers
-INSTALLS += target
-
-DEFINES += QT_QWS_MOUSE_PC
-
-HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qmousepc_qws.h
-
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousepc_qws.cpp
-
diff --git a/src/plugins/mousedrivers/tslib/main.cpp b/src/plugins/mousedrivers/tslib/main.cpp
deleted file mode 100644
index d21315422b..0000000000
--- a/src/plugins/mousedrivers/tslib/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qmousedriverplugin_qws.h>
-#include <qmousetslib_qws.h>
-
-QT_BEGIN_NAMESPACE
-
-class TslibMouseDriver : public QMouseDriverPlugin
-{
-public:
- TslibMouseDriver();
-
- QStringList keys() const;
- QWSMouseHandler* create(const QString &driver, const QString &device);
-};
-
-TslibMouseDriver::TslibMouseDriver()
- : QMouseDriverPlugin()
-{
-}
-
-QStringList TslibMouseDriver::keys() const
-{
- return (QStringList() << "tslib");
-}
-
-QWSMouseHandler* TslibMouseDriver::create(const QString &driver,
- const QString &device)
-{
- if (driver.toLower() != "tslib")
- return 0;
- return new QWSTslibMouseHandler(driver, device);
-}
-
-Q_EXPORT_STATIC_PLUGIN(TslibMouseDriver)
-Q_EXPORT_PLUGIN2(qwstslibmousehandler, TslibMouseDriver)
-
-QT_END_NAMESPACE
diff --git a/src/plugins/mousedrivers/tslib/tslib.pro b/src/plugins/mousedrivers/tslib/tslib.pro
deleted file mode 100644
index e2fa013fdb..0000000000
--- a/src/plugins/mousedrivers/tslib/tslib.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qtslibmousedriver
-include(../../qpluginbase.pri)
-
-DESTDIR = $$QT.gui.plugins/mousedrivers
-
-HEADERS = \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousedriverplugin_qws.h \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousetslib_qws.h
-SOURCES = main.cpp \
- $$QT_SOURCE_TREE/src/gui/embedded/qmousetslib_qws.cpp
-
-LIBS += -lts
-
-target.path += $$[QT_INSTALL_PLUGINS]/mousedrivers
-INSTALLS += target
-
diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp
index df7abc1401..f3ce0fa809 100644
--- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp
+++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp
@@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE
-QVector<EGLint> q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format)
+QVector<EGLint> q_createConfigAttributesFromFormat(const QWindowFormat &format)
{
int redSize = format.redBufferSize();
int greenSize = format.greenBufferSize();
@@ -53,17 +53,6 @@ QVector<EGLint> q_createConfigAttributesFromFormat(const QPlatformWindowFormat &
int stencilSize = format.stencilBufferSize();
int sampleCount = format.samples();
- // QPlatformWindowFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that
- // type has been requested. So we must check QPlatformWindowFormat's booleans too if size is -1:
- if (format.alpha() && alphaSize <= 0)
- alphaSize = 1;
- if (format.depth() && depthSize <= 0)
- depthSize = 1;
- if (format.stencil() && stencilSize <= 0)
- stencilSize = 1;
- if (format.sampleBuffers() && sampleCount <= 0)
- sampleCount = 1;
-
// We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide
// the best performance. The EGL config selection algorithm is a bit stange in this regard:
// The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard
@@ -82,14 +71,14 @@ QVector<EGLint> q_createConfigAttributesFromFormat(const QPlatformWindowFormat &
// if the application sets the red/green/blue size to 5/6/5 on the QPlatformWindowFormat,
// they will probably get a 32-bit config, even when there's an RGB565 config available.
- // Now normalize the values so -1 becomes 0
- redSize = redSize > 0 ? redSize : 0;
- greenSize = greenSize > 0 ? greenSize : 0;
- blueSize = blueSize > 0 ? blueSize : 0;
- alphaSize = alphaSize > 0 ? alphaSize : 0;
- depthSize = depthSize > 0 ? depthSize : 0;
- stencilSize = stencilSize > 0 ? stencilSize : 0;
- sampleCount = sampleCount > 0 ? sampleCount : 0;
+// // Now normalize the values so -1 becomes 0
+// redSize = redSize > 0 ? redSize : 0;
+// greenSize = greenSize > 0 ? greenSize : 0;
+// blueSize = blueSize > 0 ? blueSize : 0;
+// alphaSize = alphaSize > 0 ? alphaSize : 0;
+// depthSize = depthSize > 0 ? depthSize : 0;
+// stencilSize = stencilSize > 0 ? stencilSize : 0;
+// sampleCount = sampleCount > 0 ? sampleCount : 0;
QVector<EGLint> configAttributes;
@@ -206,7 +195,7 @@ bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes)
return false;
}
-EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat, int surfaceType)
+EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QWindowFormat &format, bool highestPixelFormat, int surfaceType)
{
EGLConfig cfg = 0;
QVector<EGLint> configureAttributes = q_createConfigAttributesFromFormat(format);
@@ -214,11 +203,7 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW
configureAttributes.append(surfaceType);
configureAttributes.append(EGL_RENDERABLE_TYPE);
- if (format.windowApi() == QPlatformWindowFormat::OpenVG) {
- configureAttributes.append(EGL_OPENVG_BIT);
- } else {
- configureAttributes.append(EGL_OPENGL_ES2_BIT);
- }
+ configureAttributes.append(EGL_OPENGL_ES2_BIT);
configureAttributes.append(EGL_NONE);
do {
@@ -272,9 +257,9 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW
return 0;
}
-QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config)
+QWindowFormat q_windowFormatFromConfig(EGLDisplay display, const EGLConfig config)
{
- QPlatformWindowFormat format;
+ QWindowFormat format;
EGLint redSize = 0;
EGLint greenSize = 0;
EGLint blueSize = 0;
@@ -282,7 +267,6 @@ QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, con
EGLint depthSize = 0;
EGLint stencilSize = 0;
EGLint sampleCount = 0;
- EGLint level = 0;
eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize);
eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize);
@@ -291,7 +275,6 @@ QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, con
eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize);
eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize);
eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount);
- eglGetConfigAttrib(display, config, EGL_LEVEL, &level);
format.setRedBufferSize(redSize);
format.setGreenBufferSize(greenSize);
@@ -300,10 +283,7 @@ QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, con
format.setDepthBufferSize(depthSize);
format.setStencilBufferSize(stencilSize);
format.setSamples(sampleCount);
- format.setDirectRendering(true); // All EGL contexts are direct-rendered
- format.setRgba(true); // EGL doesn't support colour index rendering
format.setStereo(false); // EGL doesn't support stereo buffers
- format.setAccumBufferSize(0); // EGL doesn't support accululation buffers
// Clear the EGL error state because some of the above may
// have errored out because the attribute is not applicable
diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h
index c7d3d61ae5..d0863219ab 100644
--- a/src/plugins/platforms/eglconvenience/qeglconvenience.h
+++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h
@@ -43,16 +43,16 @@
#define QEGLCONVENIENCE_H
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
#include <QtCore/QVector>
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
-QVector<EGLint> q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format);
+QVector<EGLint> q_createConfigAttributesFromFormat(const QWindowFormat &format);
bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes);
-EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT);
-QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config);
+EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QWindowFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT);
+QWindowFormat q_windowFormatFromConfig(EGLDisplay display, const EGLConfig config);
bool q_hasEglExtension(EGLDisplay display,const char* extensionName);
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
index ae5215f320..30dd86215d 100644
--- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
+++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
@@ -66,7 +66,7 @@ QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, E
qFatal("EGL error");
}
- m_windowFormat = qt_qPlatformWindowFormatFromConfig(display,config);
+ m_windowFormat = q_windowFormatFromConfig(display,config);
}
QEGLPlatformContext::~QEGLPlatformContext()
@@ -88,7 +88,6 @@ QEGLPlatformContext::~QEGLPlatformContext()
void QEGLPlatformContext::makeCurrent()
{
- QPlatformGLContext::makeCurrent();
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglContext::makeCurrent: %p\n",this);
#endif
@@ -118,7 +117,6 @@ void QEGLPlatformContext::makeCurrent()
}
void QEGLPlatformContext::doneCurrent()
{
- QPlatformGLContext::doneCurrent();
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglContext::doneCurrent:%p\n",this);
#endif
@@ -146,7 +144,7 @@ void* QEGLPlatformContext::getProcAddress(const QString& procName)
return (void *)eglGetProcAddress(qPrintable(procName));
}
-QPlatformWindowFormat QEGLPlatformContext::platformWindowFormat() const
+QWindowFormat QEGLPlatformContext::windowFormat() const
{
return m_windowFormat;
}
diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
index 69835d7eb4..048fd72215 100644
--- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
+++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
@@ -56,7 +56,7 @@ public:
void swapBuffers();
void* getProcAddress(const QString& procName);
- QPlatformWindowFormat platformWindowFormat() const;
+ QWindowFormat windowFormat() const;
EGLContext eglContext() const;
private:
@@ -65,7 +65,7 @@ private:
EGLSurface m_eglSurface;
EGLenum m_eglApi;
- QPlatformWindowFormat m_windowFormat;
+ QWindowFormat m_windowFormat;
};
#endif //QOPENKODEGLINTEGRATION_H
diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
index 7cee3e2ea1..abf7b83e04 100644
--- a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
+++ b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
@@ -66,7 +66,7 @@ enum {
#undef FontChange
#endif
-QVector<int> qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit)
+QVector<int> qglx_buildSpec(const QWindowFormat &format, int drawableBit)
{
QVector<int> spec(48);
int i = 0;
@@ -75,54 +75,37 @@ QVector<int> qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit
spec[i++] = 0;
spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = drawableBit;
- if (format.rgba()) {
- spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT;
- spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize();
- spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize();
- spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize();
- if (format.alpha()) {
- spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize();
- }
-
- spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
- spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
- spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
-
- if (format.alpha()) {
- spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
- }
-
- } else {
- spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works....
- spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8;
+ spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT;
+ spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize();
+ spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize();
+ spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize();
+ if (format.hasAlpha()) {
+ spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize();
}
- spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False;
+ spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.swapBehavior() != QWindowFormat::SingleBuffer ? True : False;
spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False;
- if (format.depth()) {
- spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize();
- }
+ spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize();
- if (format.stencil()) {
- spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
- }
- if (format.sampleBuffers()) {
+ spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
+
+ if (format.samples() > 1) {
spec[i++] = GLX_SAMPLE_BUFFERS_ARB;
spec[i++] = 1;
spec[i++] = GLX_SAMPLES_ARB;
- spec[i++] = format.samples() == -1 ? 4 : format.samples();
+ spec[i++] = format.samples();
}
spec[i++] = XNone;
return spec;
}
-GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindowFormat &format, int drawableBit)
+GLXFBConfig qglx_findConfig(Display *display, int screen , const QWindowFormat &format, int drawableBit)
{
bool reduced = true;
GLXFBConfig chosenConfig = 0;
- QPlatformWindowFormat reducedFormat = format;
+ QWindowFormat reducedFormat = format;
while (!chosenConfig && reduced) {
QVector<int> spec = qglx_buildSpec(reducedFormat, drawableBit);
int confcount = 0;
@@ -133,7 +116,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow
for (int i = 0; i < confcount; i++) {
chosenConfig = configs[i];
// Make sure we try to get an ARGB visual if the format asked for an alpha:
- if (reducedFormat.alpha()) {
+ if (reducedFormat.hasAlpha()) {
int alphaSize;
glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
if (alphaSize > 0)
@@ -145,7 +128,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow
XFree(configs);
}
- reducedFormat = qglx_reducePlatformWindowFormat(reducedFormat,&reduced);
+ reducedFormat = qglx_reduceWindowFormat(reducedFormat,&reduced);
}
if (!chosenConfig)
@@ -154,16 +137,16 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow
return chosenConfig;
}
-XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format)
+XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QWindowFormat &format)
{
GLXFBConfig config = qglx_findConfig(display,screen,format);
XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display,config);
return visualInfo;
}
-QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx)
+QWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext)
{
- QPlatformWindowFormat format;
+ QWindowFormat format;
int redSize = 0;
int greenSize = 0;
int blueSize = 0;
@@ -172,16 +155,9 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB
int stencilSize = 0;
int sampleBuffers = 0;
int sampleCount = 0;
- int level = 0;
- int rgba = 0;
int stereo = 0;
- int accumSizeA = 0;
- int accumSizeR = 0;
- int accumSizeG = 0;
- int accumSizeB = 0;
XVisualInfo *vi = glXGetVisualFromFBConfig(display,config);
- glXGetConfig(display,vi,GLX_RGBA,&rgba);
XFree(vi);
glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize);
glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize);
@@ -190,12 +166,7 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB
glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize);
glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize);
glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers);
- glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level);
glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB);
format.setRedBufferSize(redSize);
format.setGreenBufferSize(greenSize);
@@ -203,39 +174,31 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB
format.setAlphaBufferSize(alphaSize);
format.setDepthBufferSize(depthSize);
format.setStencilBufferSize(stencilSize);
- format.setSampleBuffers(sampleBuffers);
- if (format.sampleBuffers()) {
+ if (sampleBuffers) {
glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount);
format.setSamples(sampleCount);
}
- format.setDirectRendering(glXIsDirect(display, ctx));
- format.setRgba(rgba);
format.setStereo(stereo);
- format.setAccumBufferSize(accumSizeB);
return format;
}
-QPlatformWindowFormat qglx_reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced)
+QWindowFormat qglx_reduceWindowFormat(const QWindowFormat &format, bool *reduced)
{
- QPlatformWindowFormat retFormat = format;
+ QWindowFormat retFormat = format;
*reduced = true;
- if (retFormat.sampleBuffers()) {
- retFormat.setSampleBuffers(false);
+ if (retFormat.samples() > 1) {
+ retFormat.setSamples(0);
} else if (retFormat.stereo()) {
retFormat.setStereo(false);
- } else if (retFormat.accum()) {
- retFormat.setAccum(false);
- }else if (retFormat.stencil()) {
- retFormat.setStencil(false);
- }else if (retFormat.alpha()) {
- retFormat.setAlpha(false);
- }else if (retFormat.depth()) {
- retFormat.setDepth(false);
- }else if (retFormat.doubleBuffer()) {
- retFormat.setDoubleBuffer(false);
+ }else if (retFormat.stencilBufferSize() > 0) {
+ retFormat.setStencilBufferSize(0);
+ }else if (retFormat.hasAlpha()) {
+ retFormat.setAlphaBufferSize(0);
+ }else if (retFormat.depthBufferSize() > 0) {
+ retFormat.setDepthBufferSize(0);
}else{
*reduced = false;
}
diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.h b/src/plugins/platforms/glxconvenience/qglxconvenience.h
index 2c59dbb324..765a08a39d 100644
--- a/src/plugins/platforms/glxconvenience/qglxconvenience.h
+++ b/src/plugins/platforms/glxconvenience/qglxconvenience.h
@@ -42,15 +42,15 @@
#ifndef QGLXCONVENIENCE_H
#define QGLXCONVENIENCE_H
-#include <QPlatformWindowFormat>
+#include <QWindowFormat>
#include <X11/Xlib.h>
#include <GL/glx.h>
-XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format);
-GLXFBConfig qglx_findConfig(Display *display, int screen, const QPlatformWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
-QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context);
-QVector<int> qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
-QPlatformWindowFormat qglx_reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced);
+XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QWindowFormat &format);
+GLXFBConfig qglx_findConfig(Display *display, int screen, const QWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
+QWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context);
+QVector<int> qglx_buildSpec(const QWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
+QWindowFormat qglx_reduceWindowFormat(const QWindowFormat &format, bool *reduced);
#endif // QGLXCONVENIENCE_H
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 3a545e4e5c..1fb4f01c1e 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -69,14 +69,14 @@ QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type)
return new QRasterPixmapData(type);
}
-QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWidget *widget, WId winId) const
+QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const
{
- Q_UNUSED(winId);
- return new QPlatformWindow(widget);
+ Q_UNUSED(window);
+ return new QPlatformWindow(window);
}
-QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget, WId winId) const
+QWindowSurface *QMinimalIntegration::createWindowSurface(QWindow *window, WId winId) const
{
Q_UNUSED(winId);
- return new QMinimalWindowSurface(widget);
+ return new QMinimalWindowSurface(window);
}
diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h
index 5f93443b8c..7191441b91 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.h
+++ b/src/plugins/platforms/minimal/qminimalintegration.h
@@ -72,8 +72,8 @@ public:
bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
- QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const;
+ QWindowSurface *createWindowSurface(QWindow *window, WId winId) const;
QList<QPlatformScreen *> screens() const { return mScreens; }
diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp b/src/plugins/platforms/minimal/qminimalwindowsurface.cpp
index dd8c9b7045..8e15da930f 100644
--- a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp
+++ b/src/plugins/platforms/minimal/qminimalwindowsurface.cpp
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-QMinimalWindowSurface::QMinimalWindowSurface(QWidget *window)
+QMinimalWindowSurface::QMinimalWindowSurface(QWindow *window)
: QWindowSurface(window)
{
//qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this;
@@ -62,9 +62,9 @@ QPaintDevice *QMinimalWindowSurface::paintDevice()
return &mImage;
}
-void QMinimalWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
+void QMinimalWindowSurface::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
- Q_UNUSED(widget);
+ Q_UNUSED(window);
Q_UNUSED(region);
Q_UNUSED(offset);
diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.h b/src/plugins/platforms/minimal/qminimalwindowsurface.h
index bfeeacadc9..88ed279590 100644
--- a/src/plugins/platforms/minimal/qminimalwindowsurface.h
+++ b/src/plugins/platforms/minimal/qminimalwindowsurface.h
@@ -45,17 +45,18 @@
#include <QtGui/private/qwindowsurface_p.h>
#include <QtGui/QPlatformWindow>
+#include <QtGui/QImage>
QT_BEGIN_NAMESPACE
class QMinimalWindowSurface : public QWindowSurface
{
public:
- QMinimalWindowSurface(QWidget *window);
+ QMinimalWindowSurface(QWindow *window);
~QMinimalWindowSurface();
QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset);
void resize(const QSize &size);
private:
diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h
index ac16039c9d..bb829a15fb 100644
--- a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h
+++ b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h
@@ -44,7 +44,7 @@
class QWaylandWindow;
class QWaylandDisplay;
-class QWidget;
+class QWindow;
class QWaylandGLIntegration
{
@@ -54,7 +54,7 @@ public:
virtual void initialize() = 0;
- virtual QWaylandWindow *createEglWindow(QWidget *widget) = 0;
+ virtual QWaylandWindow *createEglWindow(QWindow *window) = 0;
static QWaylandGLIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay);
};
diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
index ebe4c7bf86..3fc063aab7 100644
--- a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
@@ -47,6 +47,7 @@
#include <QtOpenGL/QGLFramebufferObject>
#include <QtOpenGL/QGLContext>
+#include <QPlatformGLContext>
#include <QtOpenGL/private/qglengineshadermanager_p.h>
@@ -133,9 +134,9 @@ static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport,
drawTexture(r, texture, texSize, sourceRect);
}
-QWaylandGLWindowSurface::QWaylandGLWindowSurface(QWidget *window)
+QWaylandGLWindowSurface::QWaylandGLWindowSurface(QWindow *window)
: QWindowSurface(window)
- , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display())
+ , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display())
, mPaintDevice(0)
{
@@ -153,30 +154,29 @@ QPaintDevice *QWaylandGLWindowSurface::paintDevice()
void QWaylandGLWindowSurface::beginPaint(const QRegion &)
{
- window()->platformWindow()->glContext()->makeCurrent();
+ window()->handle()->glContext()->makeCurrent();
glClearColor(0,0,0,0xff);
glClear(GL_COLOR_BUFFER_BIT);
}
-void QWaylandGLWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
+void QWaylandGLWindowSurface::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
Q_UNUSED(offset);
Q_UNUSED(region);
- QWaylandWindow *ww = (QWaylandWindow *) widget->platformWindow();
-
+
if (mPaintDevice->isBound())
mPaintDevice->release();
QRect rect(0,0,size().width(),size().height());
- QGLContext *ctx = QGLContext::fromPlatformGLContext(ww->glContext());
+ QGLContext *ctx = QGLContext::fromWindowContext(window->glContext());
blitTexture(ctx,mPaintDevice->texture(),size(),mPaintDevice->size(),rect,rect);
- ww->glContext()->swapBuffers();
+ window->glContext()->swapBuffers();
}
void QWaylandGLWindowSurface::resize(const QSize &size)
{
QWindowSurface::resize(size);
- window()->platformWindow()->glContext()->makeCurrent();
+ window()->glContext()->makeCurrent();
delete mPaintDevice;
mPaintDevice = new QGLFramebufferObject(size);
}
diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h
index 8d53b42a56..1de449b4dc 100644
--- a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h
+++ b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h
@@ -51,13 +51,13 @@ class QGLFramebufferObject;
class QWaylandGLWindowSurface : public QWindowSurface
{
public:
- QWaylandGLWindowSurface(QWidget *window);
+ QWaylandGLWindowSurface(QWindow *window);
~QWaylandGLWindowSurface();
void beginPaint(const QRegion &);
QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset);
void resize(const QSize &size);
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp
index d63087d934..6971459659 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp
@@ -97,8 +97,6 @@ QWaylandReadbackEglContext::~QWaylandReadbackEglContext()
void QWaylandReadbackEglContext::makeCurrent()
{
- QPlatformGLContext::makeCurrent();
-
mWindow->waitForFrameSync();
eglMakeCurrent(mEglIntegration->eglDisplay(),mPixmapSurface,mPixmapSurface,mContext);
@@ -114,7 +112,7 @@ void QWaylandReadbackEglContext::swapBuffers()
{
eglSwapBuffers(mEglIntegration->eglDisplay(),mPixmapSurface);
- if (QPlatformGLContext::currentContext() != this) {
+ if (QWindowContext::currentContext().handle() != this) {
makeCurrent();
}
@@ -145,7 +143,7 @@ void * QWaylandReadbackEglContext::getProcAddress(const QString &procName)
QPlatformWindowFormat QWaylandReadbackEglContext::platformWindowFormat() const
{
- return qt_qPlatformWindowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
+ return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
}
void QWaylandReadbackEglContext::geometryChanged()
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h
index ac682759e9..1540b92080 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h
+++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h
@@ -43,7 +43,6 @@
#define QWAYLANDREADBACKEGLGLCONTEXT_H
#include <QPlatformGLContext>
-#include <QtGui/QWidget>
#include "qwaylandreadbackeglintegration.h"
#include "qwaylandreadbackeglwindow.h"
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp
index 20f7ffb609..8a3d769e65 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp
@@ -81,7 +81,7 @@ void QWaylandReadbackEglIntegration::initialize()
}
}
-QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWidget *widget)
+QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWindow *window)
{
return new QWaylandReadbackEglWindow(widget,this);
}
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h
index 84fa64fd34..767634bbc2 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h
+++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h
@@ -48,7 +48,6 @@
#include <QtCore/QDataStream>
#include <QtCore/QMetaType>
#include <QtCore/QVariant>
-#include <QtGui/QWidget>
#include <X11/Xlib.h>
@@ -61,7 +60,7 @@ public:
~QWaylandReadbackEglIntegration();
void initialize();
- QWaylandWindow *createEglWindow(QWidget *widget);
+ QWaylandWindow *createEglWindow(QWindow *window);
QWaylandDisplay *waylandDisplay() const;
Display *xDisplay() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp
index 2ae212ba67..134f431c3d 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp
@@ -43,7 +43,7 @@
#include "qwaylandreadbackeglcontext.h"
-QWaylandReadbackEglWindow::QWaylandReadbackEglWindow(QWidget *window, QWaylandReadbackEglIntegration *eglIntegration)
+QWaylandReadbackEglWindow::QWaylandReadbackEglWindow(QWindow *window, QWaylandReadbackEglIntegration *eglIntegration)
: QWaylandShmWindow(window)
, mEglIntegration(eglIntegration)
, mContext(0)
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h
index 453ad27cd9..6fd09659dc 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h
+++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h
@@ -50,7 +50,7 @@ class QWaylandReadbackEglContext;
class QWaylandReadbackEglWindow : public QWaylandShmWindow
{
public:
- QWaylandReadbackEglWindow(QWidget *window, QWaylandReadbackEglIntegration *eglIntegration);
+ QWaylandReadbackEglWindow(QWindow *window, QWaylandReadbackEglIntegration *eglIntegration);
WindowType windowType() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp
index 08c5cf6c51..5bafd418df 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp
@@ -85,8 +85,6 @@ QWaylandReadbackGlxContext::QWaylandReadbackGlxContext(QWaylandReadbackGlxIntegr
void QWaylandReadbackGlxContext::makeCurrent()
{
- QPlatformGLContext::makeCurrent();
-
glXMakeCurrent(mGlxIntegration->xDisplay(),mGlxPixmap,mContext);
}
@@ -97,7 +95,7 @@ void QWaylandReadbackGlxContext::doneCurrent()
void QWaylandReadbackGlxContext::swapBuffers()
{
- if (QPlatformGLContext::currentContext() != this) {
+ if (QWindowContext::currentContext().handle() != this) {
makeCurrent();
}
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp
index 4651f0c30e..25422d6c4f 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp
@@ -66,9 +66,9 @@ void QWaylandReadbackGlxIntegration::initialize()
{
}
-QWaylandWindow * QWaylandReadbackGlxIntegration::createEglWindow(QWidget *widget)
+QWaylandWindow * QWaylandReadbackGlxIntegration::createEglWindow(QWindow *window)
{
- return new QWaylandReadbackGlxWindow(widget,this);
+ return new QWaylandReadbackGlxWindow(window,this);
}
QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay)
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h
index 9056393905..c706da7f79 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h
+++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h
@@ -48,7 +48,7 @@
#include <QtCore/QDataStream>
#include <QtCore/QMetaType>
#include <QtCore/QVariant>
-#include <QtGui/QWidget>
+#include <QtGui/QWindow>
#include <X11/Xlib.h>
@@ -60,7 +60,7 @@ public:
void initialize();
- QWaylandWindow *createEglWindow(QWidget *widget);
+ QWaylandWindow *createEglWindow(QWindow *window);
QWaylandDisplay *waylandDisplay() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp
index ca1603c649..f095862227 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp
@@ -41,7 +41,7 @@
#include "qwaylandreadbackglxwindow.h"
-QWaylandReadbackGlxWindow::QWaylandReadbackGlxWindow(QWidget *window, QWaylandReadbackGlxIntegration *glxIntegration)
+QWaylandReadbackGlxWindow::QWaylandReadbackGlxWindow(QWindow *window, QWaylandReadbackGlxIntegration *glxIntegration)
: QWaylandShmWindow(window)
, mGlxIntegration(glxIntegration)
, mContext(0)
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h
index 4d7bb3ee74..47a1ce9ab4 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h
+++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h
@@ -49,7 +49,7 @@
class QWaylandReadbackGlxWindow : public QWaylandShmWindow
{
public:
- QWaylandReadbackGlxWindow(QWidget *window, QWaylandReadbackGlxIntegration *glxIntegration);
+ QWaylandReadbackGlxWindow(QWindow *window, QWaylandReadbackGlxIntegration *glxIntegration);
WindowType windowType() const;
QPlatformGLContext *glContext() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp
index ddd17636c1..ac58312310 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp
@@ -73,7 +73,7 @@ void QWaylandEglIntegration::initialize()
}
}
-QWaylandWindow *QWaylandEglIntegration::createEglWindow(QWidget *window)
+QWaylandWindow *QWaylandEglIntegration::createEglWindow(QWindow *window)
{
return new QWaylandEglWindow(window);
}
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h
index 3a26f97b32..66e272353a 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h
@@ -47,7 +47,7 @@
#include "qwaylandeglinclude.h"
class QWaylandWindow;
-class QWidget;
+class QWindow;
class QWaylandEglIntegration : public QWaylandGLIntegration
{
@@ -57,7 +57,7 @@ public:
void initialize();
- QWaylandWindow *createEglWindow(QWidget *window);
+ QWaylandWindow *createEglWindow(QWindow *window);
EGLDisplay eglDisplay() const;
struct wl_egl_display *nativeDisplay() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp
index cf52f39d15..ad8786fd50 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp
@@ -44,7 +44,7 @@
#include "qwaylandscreen.h"
#include "qwaylandglcontext.h"
-QWaylandEglWindow::QWaylandEglWindow(QWidget *window)
+QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
: QWaylandWindow(window)
, mGLContext(0)
, mWaylandEglWindow(0)
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h
index 856321dec8..ddc7a5af6e 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h
@@ -51,7 +51,7 @@ class QWaylandGLContext;
class QWaylandEglWindow : public QWaylandWindow
{
public:
- QWaylandEglWindow(QWidget *window);
+ QWaylandEglWindow(QWindow *window);
~QWaylandEglWindow();
WindowType windowType() const;
void setGeometry(const QRect &rect);
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
index d293019909..d8cff1f8c1 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
@@ -55,7 +55,7 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindo
, mEglDisplay(eglDisplay)
, mSurface(EGL_NO_SURFACE)
, mConfig(q_configFromQPlatformWindowFormat(mEglDisplay,format,true))
- , mFormat(qt_qPlatformWindowFormatFromConfig(mEglDisplay,mConfig))
+ , mFormat(q_windowFormatFromConfig(mEglDisplay,mConfig))
{
QPlatformGLContext *sharePlatformContext = 0;
sharePlatformContext = format.sharedGLContext();
@@ -90,7 +90,6 @@ QWaylandGLContext::~QWaylandGLContext()
void QWaylandGLContext::makeCurrent()
{
- QPlatformGLContext::makeCurrent();
if (mSurface == EGL_NO_SURFACE) {
qWarning("makeCurrent with EGL_NO_SURFACE");
}
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp
index 92acf752e4..21b369d0ae 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp
@@ -75,8 +75,6 @@ QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(QWaylandXCompositeEGL
void QWaylandXCompositeEGLContext::makeCurrent()
{
- QPlatformGLContext::makeCurrent();
-
eglMakeCurrent(mEglIntegration->eglDisplay(),mEglWindowSurface,mEglWindowSurface,mContext);
}
@@ -102,7 +100,7 @@ void * QWaylandXCompositeEGLContext::getProcAddress(const QString &procName)
QPlatformWindowFormat QWaylandXCompositeEGLContext::platformWindowFormat() const
{
- return qt_qPlatformWindowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
+ return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
}
void QWaylandXCompositeEGLContext::sync_function(void *data)
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp
index 7537b52d59..6f7428024a 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp
@@ -70,9 +70,9 @@ void QWaylandXCompositeEGLIntegration::initialize()
{
}
-QWaylandWindow * QWaylandXCompositeEGLIntegration::createEglWindow(QWidget *widget)
+QWaylandWindow * QWaylandXCompositeEGLIntegration::createEglWindow(QWindow *window)
{
- return new QWaylandXCompositeEGLWindow(widget,this);
+ return new QWaylandXCompositeEGLWindow(window,this);
}
Display * QWaylandXCompositeEGLIntegration::xDisplay() const
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h
index 590ae3754c..8edaa2becd 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h
@@ -49,7 +49,7 @@
#include <QtCore/QDataStream>
#include <QtCore/QMetaType>
#include <QtCore/QVariant>
-#include <QtGui/QWidget>
+#include <QtGui/QWindow>
#include <QWaitCondition>
@@ -66,7 +66,7 @@ public:
void initialize();
- QWaylandWindow *createEglWindow(QWidget *widget);
+ QWaylandWindow *createEglWindow(QWindow *window);
QWaylandDisplay *waylandDisplay() const;
struct wl_xcomposite *waylandXComposite() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp
index 1c9d36fe92..19cbbd2d49 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp
@@ -43,7 +43,7 @@
#include <QtCore/QDebug>
-QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWidget *window, QWaylandXCompositeEGLIntegration *glxIntegration)
+QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration)
: QWaylandWindow(window)
, mGlxIntegration(glxIntegration)
, mContext(0)
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h
index fc33b32322..111e751815 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h
@@ -49,7 +49,7 @@
class QWaylandXCompositeEGLWindow : public QWaylandWindow
{
public:
- QWaylandXCompositeEGLWindow(QWidget *window, QWaylandXCompositeEGLIntegration *glxIntegration);
+ QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration);
WindowType windowType() const;
QPlatformGLContext *glContext() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp
index caf51170a6..39316adf6c 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp
@@ -46,6 +46,7 @@
#include "wayland-xcomposite-client-protocol.h"
#include <QtCore/QDebug>
+#include <QtGui/QRegion>
#include <X11/extensions/Xcomposite.h>
@@ -55,7 +56,7 @@ QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(QWaylandXCompositeGLX
, mWindow(window)
, mBuffer(0)
, mXWindow(0)
- , mConfig(qglx_findConfig(glxIntegration->xDisplay(),glxIntegration->screen(),window->widget()->platformWindowFormat()))
+ , mConfig(qglx_findConfig(glxIntegration->xDisplay(),glxIntegration->screen(),window->window()->format()))
, mWaitingForSyncCallback(false)
{
XVisualInfo *visualInfo = glXGetVisualFromFBConfig(glxIntegration->xDisplay(),mConfig);
@@ -66,7 +67,6 @@ QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(QWaylandXCompositeGLX
void QWaylandXCompositeGLXContext::makeCurrent()
{
- QPlatformGLContext::makeCurrent();
glXMakeCurrent(mGlxIntegration->xDisplay(),mXWindow,mContext);
}
@@ -90,7 +90,7 @@ void * QWaylandXCompositeGLXContext::getProcAddress(const QString &procName)
return (void *) glXGetProcAddress(reinterpret_cast<GLubyte *>(procName.toLatin1().data()));
}
-QPlatformWindowFormat QWaylandXCompositeGLXContext::platformWindowFormat() const
+QWindowFormat QWaylandXCompositeGLXContext::windowFormat() const
{
return qglx_platformWindowFromGLXFBConfig(mGlxIntegration->xDisplay(),mConfig,mContext);
}
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h
index eb2e5a518e..2a94bd1c00 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h
@@ -64,7 +64,7 @@ public:
void swapBuffers();
void* getProcAddress(const QString& procName);
- QPlatformWindowFormat platformWindowFormat() const;
+ QWindowFormat windowFormat() const;
void geometryChanged();
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp
index 5cb6ef336b..03b00da910 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp
@@ -70,9 +70,9 @@ void QWaylandXCompositeGLXIntegration::initialize()
{
}
-QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWidget *widget)
+QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window)
{
- return new QWaylandXCompositeGLXWindow(widget,this);
+ return new QWaylandXCompositeGLXWindow(window,this);
}
Display * QWaylandXCompositeGLXIntegration::xDisplay() const
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h
index 24a40167e2..4f53449915 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h
@@ -49,7 +49,7 @@
#include <QtCore/QDataStream>
#include <QtCore/QMetaType>
#include <QtCore/QVariant>
-#include <QtGui/QWidget>
+#include <QtGui/QWindow>
#include <X11/Xlib.h>
@@ -63,7 +63,7 @@ public:
void initialize();
- QWaylandWindow *createEglWindow(QWidget *widget);
+ QWaylandWindow *createEglWindow(QWindow *window);
QWaylandDisplay *waylandDisplay() const;
struct wl_xcomposite *waylandXComposite() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp
index db0f254a20..40b72186f0 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp
@@ -43,7 +43,7 @@
#include <QtCore/QDebug>
-QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWidget *window, QWaylandXCompositeGLXIntegration *glxIntegration)
+QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration)
: QWaylandWindow(window)
, mGlxIntegration(glxIntegration)
, mContext(0)
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h
index 536153dbcf..f1bab465d4 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h
@@ -49,7 +49,7 @@
class QWaylandXCompositeGLXWindow : public QWaylandWindow
{
public:
- QWaylandXCompositeGLXWindow(QWidget *window, QWaylandXCompositeGLXIntegration *glxIntegration);
+ QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration);
WindowType windowType() const;
QPlatformGLContext *glContext() const;
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp
index 4b0d3a073f..81c18058dd 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp
@@ -42,6 +42,7 @@
#include "qwaylandxcompositebuffer.h"
#include "wayland-client.h"
+#include "wayland-xcomposite-client-protocol.h"
QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(wl_xcomposite *xcomposite, uint32_t window, const QSize &size, wl_visual *visual)
:mSize(size)
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h
index b346651957..c51f6bbf4c 100644
--- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h
+++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h
@@ -43,8 +43,10 @@
#define QWAYLANDXCOMPOSITEBUFFER_H
#include "qwaylandbuffer.h"
+#include <stdint.h>
-#include "wayland-xcomposite-client-protocol.h"
+struct wl_xcomposite;
+struct wl_visual;
class QWaylandXCompositeBuffer : public QWaylandBuffer
{
diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp
index 614686f971..72274a28f9 100644
--- a/src/plugins/platforms/wayland/qwaylandcursor.cpp
+++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp
@@ -108,11 +108,11 @@ QWaylandCursor::QWaylandCursor(QWaylandScreen *screen)
{
}
-void QWaylandCursor::changeCursor(QCursor *cursor, QWidget *widget)
+void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window)
{
const struct pointer_image *p;
- if (widget == NULL)
+ if (window == NULL)
return;
p = NULL;
diff --git a/src/plugins/platforms/wayland/qwaylandcursor.h b/src/plugins/platforms/wayland/qwaylandcursor.h
index 254cb9473a..9f7d871249 100644
--- a/src/plugins/platforms/wayland/qwaylandcursor.h
+++ b/src/plugins/platforms/wayland/qwaylandcursor.h
@@ -52,7 +52,7 @@ class QWaylandCursor : QPlatformCursor {
public:
QWaylandCursor(QWaylandScreen *screen);
- void changeCursor(QCursor *cursor, QWidget *widget);
+ void changeCursor(QCursor *cursor, QWindow *window);
QWaylandShmBuffer *mBuffer;
QWaylandDisplay *mDisplay;
};
diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
index f9e7c95861..de541f7d64 100644
--- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
+++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
@@ -110,7 +110,7 @@ void QWaylandInputDevice::inputHandleMotion(void *data,
inputDevice->mSurfacePos = QPoint(surface_x, surface_y);
inputDevice->mGlobalPos = QPoint(x, y);
inputDevice->mTime = time;
- QWindowSystemInterface::handleMouseEvent(window->widget(),
+ QWindowSystemInterface::handleMouseEvent(window->window(),
time,
inputDevice->mSurfacePos,
inputDevice->mGlobalPos,
@@ -152,7 +152,7 @@ void QWaylandInputDevice::inputHandleButton(void *data,
inputDevice->mButtons &= ~qt_button;
inputDevice->mTime = time;
- QWindowSystemInterface::handleMouseEvent(window->widget(),
+ QWindowSystemInterface::handleMouseEvent(window->window(),
time,
inputDevice->mSurfacePos,
inputDevice->mGlobalPos,
@@ -269,7 +269,7 @@ void QWaylandInputDevice::inputHandleKey(void *data,
sym = translateKey(sym, s, sizeof s);
if (window) {
- QWindowSystemInterface::handleKeyEvent(window->widget(),
+ QWindowSystemInterface::handleKeyEvent(window->window(),
time, type, sym,
inputDevice->mModifiers,
QString::fromLatin1(s));
@@ -292,13 +292,13 @@ void QWaylandInputDevice::inputHandlePointerFocus(void *data,
if (inputDevice->mPointerFocus) {
window = inputDevice->mPointerFocus;
- QWindowSystemInterface::handleLeaveEvent(window->widget());
+ QWindowSystemInterface::handleLeaveEvent(window->window());
inputDevice->mPointerFocus = NULL;
}
if (surface) {
window = (QWaylandWindow *) wl_surface_get_user_data(surface);
- QWindowSystemInterface::handleEnterEvent(window->widget());
+ QWindowSystemInterface::handleEnterEvent(window->window());
inputDevice->mPointerFocus = window;
}
@@ -330,7 +330,7 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data,
if (surface) {
window = (QWaylandWindow *) wl_surface_get_user_data(surface);
inputDevice->mKeyboardFocus = window;
- QWindowSystemInterface::handleWindowActivated(window->widget());
+ QWindowSystemInterface::handleWindowActivated(window->window());
} else {
inputDevice->mKeyboardFocus = NULL;
QWindowSystemInterface::handleWindowActivated(0);
diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp
index b6401f6d06..8636865854 100644
--- a/src/plugins/platforms/wayland/qwaylandintegration.cpp
+++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp
@@ -50,7 +50,7 @@
#include <QtGui/QWindowSystemInterface>
#include <QtGui/QPlatformCursor>
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
#include <QtGui/private/qpixmap_raster_p.h>
#ifdef QT_WAYLAND_GL_SUPPORT
@@ -96,27 +96,25 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type)
return new QRasterPixmapData(type);
}
-QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWidget *widget, WId winId) const
+QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
{
- Q_UNUSED(winId);
#ifdef QT_WAYLAND_GL_SUPPORT
- bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL);
+ bool useOpenGL = mUseOpenGL || window->surfaceType() == QWindow::OpenGLSurface;
if (useOpenGL)
- return mDisplay->eglIntegration()->createEglWindow(widget);
+ return mDisplay->eglIntegration()->createEglWindow(window);
#endif
- return new QWaylandShmWindow(widget);
+ return new QWaylandShmWindow(window);
}
-QWindowSurface *QWaylandIntegration::createWindowSurface(QWidget *widget, WId winId) const
+QWindowSurface *QWaylandIntegration::createWindowSurface(QWindow *window, WId winId) const
{
Q_UNUSED(winId);
- Q_UNUSED(winId);
#ifdef QT_WAYLAND_GL_SUPPORT
- bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL);
+ bool useOpenGL = mUseOpenGL || window->surfaceType() == QWindow::OpenGLSurface;
if (useOpenGL)
- return new QWaylandGLWindowSurface(widget);
+ return new QWaylandGLWindowSurface(window);
#endif
- return new QWaylandShmWindowSurface(widget);
+ return new QWaylandShmWindowSurface(window);
}
QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const
diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h
index 71f6d9c7b3..57e2d8b69b 100644
--- a/src/plugins/platforms/wayland/qwaylandintegration.h
+++ b/src/plugins/platforms/wayland/qwaylandintegration.h
@@ -56,8 +56,8 @@ public:
bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
- QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const;
+ QWindowSurface *createWindowSurface(QWindow *window, WId winId) const;
QList<QPlatformScreen *> screens() const;
diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp
index 4f50cb61e6..8888f256ce 100644
--- a/src/plugins/platforms/wayland/qwaylandscreen.cpp
+++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp
@@ -81,9 +81,9 @@ QImage::Format QWaylandScreen::format() const
return mFormat;
}
-QWaylandScreen * QWaylandScreen::waylandScreenFromWidget(QWidget *widget)
+QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window)
{
- QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWidget(widget);
+ QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window);
return static_cast<QWaylandScreen *>(platformScreen);
}
diff --git a/src/plugins/platforms/wayland/qwaylandscreen.h b/src/plugins/platforms/wayland/qwaylandscreen.h
index 7784646da9..ec52e37166 100644
--- a/src/plugins/platforms/wayland/qwaylandscreen.h
+++ b/src/plugins/platforms/wayland/qwaylandscreen.h
@@ -62,7 +62,7 @@ public:
wl_visual *visual() const;
- static QWaylandScreen *waylandScreenFromWidget(QWidget *widget);
+ static QWaylandScreen *waylandScreenFromWindow(QWindow *window);
private:
QWaylandDisplay *mWaylandDisplay;
diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp
index 34f4436f25..69e5076a50 100644
--- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp
+++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp
@@ -91,10 +91,10 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void)
wl_buffer_destroy(mBuffer);
}
-QWaylandShmWindowSurface::QWaylandShmWindowSurface(QWidget *window)
+QWaylandShmWindowSurface::QWaylandShmWindowSurface(QWindow *window)
: QWindowSurface(window)
, mBuffer(0)
- , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display())
+ , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display())
{
}
@@ -109,27 +109,27 @@ QPaintDevice *QWaylandShmWindowSurface::paintDevice()
void QWaylandShmWindowSurface::beginPaint(const QRegion &)
{
- QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->platformWindow());
+ QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->handle());
Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm);
waylandWindow->waitForFrameSync();
}
-void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
+void QWaylandShmWindowSurface::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
- Q_UNUSED(widget);
+ Q_UNUSED(window);
Q_UNUSED(offset);
- QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->platformWindow());
+ QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window->handle());
Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm);
waylandWindow->damage(region);
}
void QWaylandShmWindowSurface::resize(const QSize &size)
{
- QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->platformWindow());
+ QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->handle());
Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm);
QWindowSurface::resize(size);
- QImage::Format format = QPlatformScreen::platformScreenForWidget(window())->format();
+ QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format();
if (mBuffer != NULL && mBuffer->size() == size)
return;
diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.h b/src/plugins/platforms/wayland/qwaylandshmsurface.h
index b29ceaf1b8..ce3e5ff5b9 100644
--- a/src/plugins/platforms/wayland/qwaylandshmsurface.h
+++ b/src/plugins/platforms/wayland/qwaylandshmsurface.h
@@ -44,7 +44,7 @@
#include "qwaylandbuffer.h"
#include <QtGui/private/qwindowsurface_p.h>
-
+#include <QtGui/QImage>
#include <QtGui/QPlatformWindow>
QT_BEGIN_NAMESPACE
@@ -65,11 +65,11 @@ private:
class QWaylandShmWindowSurface : public QWindowSurface
{
public:
- QWaylandShmWindowSurface(QWidget *window);
+ QWaylandShmWindowSurface(QWindow *window);
~QWaylandShmWindowSurface();
QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset);
void resize(const QSize &size);
void beginPaint(const QRegion &);
diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp
index c083e58305..c298668dfe 100644
--- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp
@@ -47,8 +47,8 @@
#include <QtCore/QDebug>
-QWaylandShmWindow::QWaylandShmWindow(QWidget *widget)
- : QWaylandWindow(widget)
+QWaylandShmWindow::QWaylandShmWindow(QWindow *window)
+ : QWaylandWindow(window)
{
newSurfaceCreated();
}
diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow.h
index 5dc6351c46..473c6df2ee 100644
--- a/src/plugins/platforms/wayland/qwaylandshmwindow.h
+++ b/src/plugins/platforms/wayland/qwaylandshmwindow.h
@@ -48,7 +48,7 @@
class QWaylandShmWindow : public QWaylandWindow
{
public:
- QWaylandShmWindow(QWidget *widget);
+ QWaylandShmWindow(QWindow *window);
~QWaylandShmWindow();
WindowType windowType() const;
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index 53f2f483e9..b30cd4ab16 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -46,14 +46,14 @@
#include "qwaylandinputdevice.h"
#include "qwaylandscreen.h"
-#include <QtGui/QWidget>
+#include <QtGui/QWindow>
#include <QtGui/QWindowSystemInterface>
#include <QDebug>
-QWaylandWindow::QWaylandWindow(QWidget *window)
+QWaylandWindow::QWaylandWindow(QWindow *window)
: QPlatformWindow(window)
- , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display())
+ , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display())
, mBuffer(0)
, mWaitingForFrameSync(false)
{
@@ -109,7 +109,7 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges,
setGeometry(geometry);
- QWindowSystemInterface::handleGeometryChange(widget(), geometry);
+ QWindowSystemInterface::handleGeometryChange(window(), geometry);
}
void QWaylandWindow::attach(QWaylandBuffer *buffer)
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h
index 47d49a70d9..53bfcc7bd6 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.h
+++ b/src/plugins/platforms/wayland/qwaylandwindow.h
@@ -59,7 +59,7 @@ public:
Egl
};
- QWaylandWindow(QWidget *window);
+ QWaylandWindow(QWindow *window);
~QWaylandWindow();
virtual WindowType windowType() const = 0;
diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp
index dbbfa67d8f..e208769336 100644
--- a/src/plugins/platforms/xcb/qdri2context.cpp
+++ b/src/plugins/platforms/xcb/qdri2context.cpp
@@ -146,7 +146,6 @@ QDri2Context::~QDri2Context()
void QDri2Context::makeCurrent()
{
- QPlatformGLContext::makeCurrent();
Q_D(QDri2Context);
eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext);
@@ -156,7 +155,6 @@ void QDri2Context::makeCurrent()
void QDri2Context::doneCurrent()
{
- QPlatformGLContext::doneCurrent();
Q_D(QDri2Context);
eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT);
}
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 190221c5f4..5640944ac3 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -50,6 +50,8 @@
#include <X11/Xutil.h>
#include <GL/glx.h>
+#include <QtGui/QWindowContext>
+
#include "qglxintegration.h"
#include "qglxconvenience.h"
@@ -57,18 +59,17 @@
#include <dlfcn.h>
#endif
-QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QPlatformWindowFormat &format)
+QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QWindowFormat &format)
: QPlatformGLContext()
, m_screen(screen)
, m_drawable((Drawable)window)
, m_context(0)
{
Q_XCB_NOOP(m_screen->connection());
- const QPlatformGLContext *sharePlatformContext;
- sharePlatformContext = format.sharedGLContext();
+ const QWindowContext *shareContext = format.sharedContext();
GLXContext shareGlxContext = 0;
- if (sharePlatformContext)
- shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext();
+ if (shareContext)
+ shareGlxContext = static_cast<const QGLXContext*>(shareContext->handle())->glxContext();
GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),format);
m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, shareGlxContext, TRUE);
@@ -93,7 +94,6 @@ QGLXContext::~QGLXContext()
void QGLXContext::makeCurrent()
{
Q_XCB_NOOP(m_screen->connection());
- QPlatformGLContext::makeCurrent();
glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), m_drawable, m_context);
Q_XCB_NOOP(m_screen->connection());
}
@@ -101,7 +101,6 @@ void QGLXContext::makeCurrent()
void QGLXContext::doneCurrent()
{
Q_XCB_NOOP(m_screen->connection());
- QPlatformGLContext::doneCurrent();
glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0);
Q_XCB_NOOP(m_screen->connection());
}
@@ -148,7 +147,7 @@ void* QGLXContext::getProcAddress(const QString& procName)
return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.toLatin1().data()));
}
-QPlatformWindowFormat QGLXContext::platformWindowFormat() const
+QWindowFormat QGLXContext::windowFormat() const
{
return m_windowFormat;
}
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 99b72a04b5..4450083959 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -45,7 +45,7 @@
#include "qxcbwindow.h"
#include <QtGui/QPlatformGLContext>
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
#include <QtCore/QMutex>
@@ -54,7 +54,7 @@
class QGLXContext : public QPlatformGLContext
{
public:
- QGLXContext(Window window, QXcbScreen *xd, const QPlatformWindowFormat &format);
+ QGLXContext(Window window, QXcbScreen *xd, const QWindowFormat &format);
~QGLXContext();
virtual void makeCurrent();
@@ -64,13 +64,13 @@ public:
GLXContext glxContext() const { return m_context; }
- QPlatformWindowFormat platformWindowFormat() const;
+ QWindowFormat windowFormat() const;
private:
QXcbScreen *m_screen;
Drawable m_drawable;
GLXContext m_context;
- QPlatformWindowFormat m_windowFormat;
+ QWindowFormat m_windowFormat;
QGLXContext (QXcbScreen *screen, Drawable drawable, GLXContext context);
};
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 7ad12fe8b1..5a2a033b4c 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -143,22 +143,26 @@ QXcbConnection::~QXcbConnection()
delete m_keyboard;
}
-QXcbWindow *platformWindowFromId(xcb_window_t id)
+void QXcbConnection::addWindow(xcb_window_t id, QXcbWindow *window)
{
- QWidget *widget = QWidget::find(id);
- if (widget)
- return static_cast<QXcbWindow *>(widget->platformWindow());
- return 0;
+ m_mapper.insert(id, window);
}
-#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, window, handler) \
+void QXcbConnection::removeWindow(xcb_window_t id)
+{
+ m_mapper.remove(id);
+}
+
+QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id)
+{
+ return m_mapper.value(id, 0);
+}
+
+#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \
{ \
event_t *e = (event_t *)event; \
- if (QXcbWindow *platformWindow = platformWindowFromId(e->window)) { \
- QObjectPrivate *d = QObjectPrivate::get(platformWindow->widget()); \
- if (!d->wasDeleted) \
- platformWindow->handler(e); \
- } \
+ if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) \
+ platformWindow->handler(e); \
} \
break;
@@ -166,7 +170,7 @@ break;
{ \
event_t *e = (event_t *)event; \
if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) \
- m_keyboard->handler(platformWindow->widget(), e); \
+ m_keyboard->handler(platformWindow->window(), e); \
} \
break;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 6b5f81047d..cbdfff7e15 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -44,6 +44,7 @@
#include <xcb/xcb.h>
+#include <QHash>
#include <QList>
#include <QObject>
#include <QVector>
@@ -51,6 +52,9 @@
#define Q_XCB_DEBUG
class QXcbScreen;
+class QXcbWindow;
+
+typedef QHash<xcb_window_t, QXcbWindow *> WindowMapper;
namespace QXcbAtom {
enum Atom {
@@ -255,6 +259,9 @@ public:
void sync();
void handleXcbError(xcb_generic_error_t *error);
+ void addWindow(xcb_window_t id, QXcbWindow *window);
+ void removeWindow(xcb_window_t id);
+
private slots:
void processXcbEvents();
@@ -264,6 +271,7 @@ private:
#ifdef XCB_USE_DRI2
void initializeDri2();
#endif
+ QXcbWindow *platformWindowFromId(xcb_window_t id);
xcb_connection_t *m_connection;
const xcb_setup_t *m_setup;
@@ -303,6 +311,8 @@ private:
template <typename cookie_t>
friend cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file, int line);
#endif
+
+ WindowMapper m_mapper;
};
#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display()))
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 9df5f14114..7aa3b3f1ba 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -87,16 +87,15 @@ QPixmapData *QXcbIntegration::createPixmapData(QPixmapData::PixelType type) cons
return new QRasterPixmapData(type);
}
-QPlatformWindow *QXcbIntegration::createPlatformWindow(QWidget *widget, WId winId) const
+QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
{
- Q_UNUSED(winId);
- return new QXcbWindow(widget);
+ return new QXcbWindow(window);
}
-QWindowSurface *QXcbIntegration::createWindowSurface(QWidget *widget, WId winId) const
+QWindowSurface *QXcbIntegration::createWindowSurface(QWindow *window, WId winId) const
{
Q_UNUSED(winId);
- return new QXcbWindowSurface(widget);
+ return new QXcbWindowSurface(window);
}
QList<QPlatformScreen *> QXcbIntegration::screens() const
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index d27fd716ab..0de6f15657 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -57,8 +57,8 @@ public:
bool hasCapability(Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
- QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const;
+ QWindowSurface *createWindowSurface(QWindow *window, WId winId) const;
QList<QPlatformScreen *> screens() const;
void moveToScreen(QWidget *window, int screen);
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index f501c00e94..b6e95392a6 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -913,7 +913,7 @@ QXcbKeyboard::~QXcbKeyboard()
// #define XCB_KEYBOARD_DEBUG
-void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time)
+void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time)
{
int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0;
@@ -954,17 +954,17 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycod
QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count);
- QWindowSystemInterface::handleExtendedKeyEvent(widget, time, type, qtcode, modifiers, code, 0, state, string.left(count));
+ QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers, code, 0, state, string.left(count));
}
-void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event)
+void QXcbKeyboard::handleKeyPressEvent(QWindow *window, const xcb_key_press_event_t *event)
{
- handleKeyEvent(widget, QEvent::KeyPress, event->detail, event->state, event->time);
+ handleKeyEvent(window, QEvent::KeyPress, event->detail, event->state, event->time);
}
-void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event)
+void QXcbKeyboard::handleKeyReleaseEvent(QWindow *window, const xcb_key_release_event_t *event)
{
- handleKeyEvent(widget, QEvent::KeyRelease, event->detail, event->state, event->time);
+ handleKeyEvent(window, QEvent::KeyRelease, event->detail, event->state, event->time);
}
void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event)
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index ddade79d51..ee951bfd4b 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -48,21 +48,23 @@
#include <QEvent>
+class QWindow;
+
class QXcbKeyboard : public QXcbObject
{
public:
QXcbKeyboard(QXcbConnection *connection);
~QXcbKeyboard();
- void handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event);
- void handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event);
+ void handleKeyPressEvent(QWindow *window, const xcb_key_press_event_t *event);
+ void handleKeyReleaseEvent(QWindow *window, const xcb_key_release_event_t *event);
void handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event);
Qt::KeyboardModifiers translateModifiers(int s);
private:
- void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
+ void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
int translateKeySym(uint key) const;
QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers,
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index b2ca1beb6e..8e2e099492 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -48,6 +48,8 @@
#include <QtCore/QDebug>
+#include <QtGui/qwindowcontext_qpa.h>
+
#if defined(XCB_USE_EGL)
#include "../eglconvenience/qeglplatformcontext.h"
#elif defined (XCB_USE_DRI2)
@@ -71,29 +73,29 @@ public:
Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap)
-void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget)
+void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
{
QByteArray lowerCaseResource = resourceString.toLower();
ResourceType resource = qXcbResourceMap()->value(lowerCaseResource);
void *result = 0;
switch(resource) {
case Display:
- result = displayForWidget(widget);
+ result = displayForWindow(window);
break;
case EglDisplay:
- result = eglDisplayForWidget(widget);
+ result = eglDisplayForWindow(window);
break;
case Connection:
- result = connectionForWidget(widget);
+ result = connectionForWindow(window);
break;
case Screen:
- result = qPlatformScreenForWidget(widget);
+ result = qPlatformScreenForWindow(window);
break;
case GraphicsDevice:
- result = graphicsDeviceForWidget(widget);
+ result = graphicsDeviceForWindow(window);
break;
case EglContext:
- result = eglContextForWidget(widget);
+ result = eglContextForWindow(window);
break;
default:
result = 0;
@@ -101,75 +103,70 @@ void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceStr
return result;
}
-QXcbScreen *QXcbNativeInterface::qPlatformScreenForWidget(QWidget *widget)
+QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window)
{
QXcbScreen *screen;
- if (widget) {
- screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(widget));
+ if (window) {
+ screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWindow(window));
}else {
screen = static_cast<QXcbScreen *>(QApplicationPrivate::platformIntegration()->screens()[0]);
}
return screen;
}
-void *QXcbNativeInterface::displayForWidget(QWidget *widget)
+void *QXcbNativeInterface::displayForWindow(QWindow *window)
{
#if defined(XCB_USE_XLIB)
- QXcbScreen *screen = qPlatformScreenForWidget(widget);
+ QXcbScreen *screen = qPlatformScreenForWindow(window);
return screen->connection()->xlib_display();
#else
- Q_UNUSED(widget);
+ Q_UNUSED(window);
return 0;
#endif
}
-void *QXcbNativeInterface::eglDisplayForWidget(QWidget *widget)
+void *QXcbNativeInterface::eglDisplayForWindow(QWindow *window)
{
#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL)
- QXcbScreen *screen = qPlatformScreenForWidget(widget);
+ QXcbScreen *screen = qPlatformScreenForWindow(window);
return screen->connection()->egl_display();
#else
- Q_UNUSED(widget)
+ Q_UNUSED(window)
return 0;
#endif
}
-void *QXcbNativeInterface::connectionForWidget(QWidget *widget)
+void *QXcbNativeInterface::connectionForWindow(QWindow *window)
{
- QXcbScreen *screen = qPlatformScreenForWidget(widget);
+ QXcbScreen *screen = qPlatformScreenForWindow(window);
return screen->xcb_connection();
}
-void *QXcbNativeInterface::screenForWidget(QWidget *widget)
+void *QXcbNativeInterface::screenForWindow(QWindow *window)
{
- QXcbScreen *screen = qPlatformScreenForWidget(widget);
+ QXcbScreen *screen = qPlatformScreenForWindow(window);
return screen->screen();
}
-void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget)
+void *QXcbNativeInterface::graphicsDeviceForWindow(QWindow *window)
{
#if defined(XCB_USE_DRI2)
- QXcbScreen *screen = qPlatformScreenForWidget(widget);
+ QXcbScreen *screen = qPlatformScreenForWindow(window);
QByteArray deviceName = screen->connection()->dri2DeviceName();
return deviceName.data();
#else
- Q_UNUSED(widget);
+ Q_UNUSED(window);
return 0;
#endif
}
-void * QXcbNativeInterface::eglContextForWidget(QWidget *widget)
+void * QXcbNativeInterface::eglContextForWindow(QWindow *window)
{
- Q_ASSERT(widget);
- if (!widget->platformWindow()) {
- qDebug() << "QPlatformWindow does not exist for widget" << widget
- << "cannot return EGLContext";
- return 0;
- }
- QPlatformGLContext *platformContext = widget->platformWindow()->glContext();
+ Q_ASSERT(window);
+ QPlatformGLContext *platformContext = window->glContext()->handle();
if (!platformContext) {
- qDebug() << "QPlatformWindow" << widget->platformWindow() << "does not have a glContext"
+ qDebug() << "QWindow" << window << "does not have a glContext"
<< "cannot return EGLContext";
return 0;
}
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index f60905cc3d..5cf3d8c6a6 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -59,17 +59,17 @@ public:
EglContext
};
- void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget);
+ void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window);
- void *displayForWidget(QWidget *widget);
- void *eglDisplayForWidget(QWidget *widget);
- void *connectionForWidget(QWidget *widget);
- void *screenForWidget(QWidget *widget);
- void *graphicsDeviceForWidget(QWidget *widget);
- void *eglContextForWidget(QWidget *widget);
+ void *displayForWindow(QWindow *window);
+ void *eglDisplayForWindow(QWindow *window);
+ void *connectionForWindow(QWindow *window);
+ void *screenForWindow(QWindow *window);
+ void *graphicsDeviceForWindow(QWindow *window);
+ void *eglContextForWindow(QWindow *window);
private:
- static QXcbScreen *qPlatformScreenForWidget(QWidget *widget);
+ static QXcbScreen *qPlatformScreenForWindow(QWindow *window);
};
#endif // QXCBNATIVEINTERFACE_H
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 0456638ab9..b0df622b33 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -85,11 +85,11 @@ static inline bool isTransient(const QWidget *w)
&& !w->testAttribute(Qt::WA_X11BypassTransientForHint));
}
-QXcbWindow::QXcbWindow(QWidget *tlw)
- : QPlatformWindow(tlw)
+QXcbWindow::QXcbWindow(QWindow *window)
+ : QPlatformWindow(window)
, m_context(0)
{
- m_screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(tlw));
+ m_screen = static_cast<QXcbScreen *>(QGuiApplicationPrivate::platformIntegration()->screens().at(0));
setConnection(m_screen->connection());
@@ -111,15 +111,17 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
| XCB_EVENT_MASK_FOCUS_CHANGE
};
+ QRect rect = window->geometry();
+
#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL)
- if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL
- && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
+ if (window->surfaceType() == QWindow::OpenGLSurface
+ && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
{
#if defined(XCB_USE_GLX)
- XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), tlw->platformWindowFormat());
+ XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window->requestedWindowFormat());
#elif defined(XCB_USE_EGL)
EGLDisplay eglDisplay = connection()->egl_display();
- EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,tlw->platformWindowFormat(),true);
+ EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,window->requestedWindowFormat(),true);
VisualID id = QXlibEglIntegration::getCompatibleVisualId(DISPLAY_FROM_XCB(this), eglDisplay, eglConfig);
XVisualInfo visualInfoTemplate;
@@ -135,7 +137,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
XSetWindowAttributes a;
a.colormap = cmap;
- m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), tlw->x(), tlw->y(), tlw->width(), tlw->height(),
+ m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), rect.x(), rect.y(), rect.width(), rect.height(),
0, visualInfo->depth, InputOutput, visualInfo->visual,
CWColormap, &a);
@@ -152,10 +154,10 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
XCB_COPY_FROM_PARENT, // depth -- same as root
m_window, // window id
m_screen->root(), // parent window id
- tlw->x(),
- tlw->y(),
- tlw->width(),
- tlw->height(),
+ rect.x(),
+ rect.y(),
+ rect.width(),
+ rect.height(),
0, // border width
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
m_screen->screen()->root_visual, // visual
@@ -165,6 +167,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
printf("created regular window: %d\n", m_window);
}
+ connection()->addWindow(m_window, this);
+
Q_XCB_CALL(xcb_change_window_attributes(xcb_connection(), m_window, mask, values));
xcb_atom_t properties[4];
@@ -176,7 +180,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
if (m_screen->syncRequestSupported())
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
- if (tlw->windowFlags() & Qt::WindowContextHelpButtonHint)
+ if (window->windowFlags() & Qt::WindowContextHelpButtonHint)
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP);
Q_XCB_CALL(xcb_change_property(xcb_connection(),
@@ -204,7 +208,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
&m_syncCounter));
}
- if (isTransient(tlw) && tlw->parentWidget()) {
+#if 0
+ if (tlw && isTransient(tlw) && tlw->parentWidget()) {
// ICCCM 4.1.2.6
QWidget *p = tlw->parentWidget()->window();
xcb_window_t parentWindow = p->winId();
@@ -213,6 +218,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
1, &parentWindow));
}
+#endif
// set the PID to let the WM kill the application if unresponsive
long pid = getpid();
@@ -226,6 +232,7 @@ QXcbWindow::~QXcbWindow()
delete m_context;
if (m_screen->syncRequestSupported())
Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter));
+ connection()->removeWindow(m_window);
Q_XCB_CALL(xcb_destroy_window(xcb_connection(), m_window));
}
@@ -243,7 +250,8 @@ void QXcbWindow::setVisible(bool visible)
{
xcb_wm_hints_t hints;
if (visible) {
- if (widget()->isMinimized())
+ // TODO: QWindow::isMinimized() or similar
+ if (window()->windowState() & Qt::WindowMinimized)
xcb_wm_hints_set_iconic(&hints);
else
xcb_wm_hints_set_normal(&hints);
@@ -406,7 +414,7 @@ Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
Q_XCB_CALL(xcb_change_window_attributes(xcb_connection(), m_window, mask, values));
}
- return QPlatformWindow::setWindowFlags(flags);
+ return flags;
}
void QXcbWindow::setNetWmWindowTypes(Qt::WindowFlags flags)
@@ -453,7 +461,7 @@ WId QXcbWindow::winId() const
void QXcbWindow::setParent(const QPlatformWindow *parent)
{
QPoint topLeft = geometry().topLeft();
- Q_XCB_CALL(xcb_reparent_window(xcb_connection(), window(), static_cast<const QXcbWindow *>(parent)->window(), topLeft.x(), topLeft.y()));
+ Q_XCB_CALL(xcb_reparent_window(xcb_connection(), xcb_window(), static_cast<const QXcbWindow *>(parent)->xcb_window(), topLeft.x(), topLeft.y()));
}
void QXcbWindow::setWindowTitle(const QString &title)
@@ -498,10 +506,10 @@ QPlatformGLContext *QXcbWindow::glContext() const
if (!m_context) {
#if defined(XCB_USE_GLX)
QXcbWindow *that = const_cast<QXcbWindow *>(this);
- that->m_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat());
+ that->m_context = new QGLXContext(m_window, m_screen, window()->requestedWindowFormat());
#elif defined(XCB_USE_EGL)
EGLDisplay display = connection()->egl_display();
- EGLConfig config = q_configFromQPlatformWindowFormat(display,widget()->platformWindowFormat(),true);
+ EGLConfig config = q_configFromQPlatformWindowFormat(display,window()->requestedWindowFormat(),true);
QVector<EGLint> eglContextAttrs;
eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
eglContextAttrs.append(2);
@@ -520,11 +528,11 @@ QPlatformGLContext *QXcbWindow::glContext() const
void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event)
{
- QWindowSurface *surface = widget()->windowSurface();
+ QWindowSurface *surface = window()->surface();
if (surface) {
QRect rect(event->x, event->y, event->width, event->height);
- surface->flush(widget(), rect, QPoint());
+ surface->flush(window(), rect, QPoint());
}
}
@@ -532,7 +540,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
{
if (event->format == 32 && event->type == atom(QXcbAtom::WM_PROTOCOLS)) {
if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) {
- QWindowSystemInterface::handleCloseEvent(widget());
+ QWindowSystemInterface::handleCloseEvent(window());
} else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_PING)) {
xcb_client_message_event_t reply = *event;
@@ -568,7 +576,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
return;
QPlatformWindow::setGeometry(rect);
- QWindowSystemInterface::handleGeometryChange(widget(), rect);
+ QWindowSystemInterface::handleGeometryChange(window(), rect);
#if XCB_USE_DRI2
if (m_context)
@@ -616,7 +624,7 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event)
&& (modifiers & Qt::AltModifier))
|| (event->detail == 6 || event->detail == 7));
- QWindowSystemInterface::handleWheelEvent(widget(), event->time,
+ QWindowSystemInterface::handleWheelEvent(window(), event->time,
local, global, delta, hor ? Qt::Horizontal : Qt::Vertical);
return;
}
@@ -647,22 +655,22 @@ void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_times
buttons ^= button; // X event uses state *before*, Qt uses state *after*
- QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons);
+ QWindowSystemInterface::handleMouseEvent(window(), time, local, global, buttons);
}
void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *)
{
- QWindowSystemInterface::handleEnterEvent(widget());
+ QWindowSystemInterface::handleEnterEvent(window());
}
void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *)
{
- QWindowSystemInterface::handleLeaveEvent(widget());
+ QWindowSystemInterface::handleLeaveEvent(window());
}
void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *)
{
- QWindowSystemInterface::handleWindowActivated(widget());
+ QWindowSystemInterface::handleWindowActivated(window());
}
void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index e049837253..3ed58b33d3 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -43,7 +43,7 @@
#define QXCBWINDOW_H
#include <QtGui/QPlatformWindow>
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
#include <xcb/xcb.h>
#include <xcb/sync.h>
@@ -55,7 +55,7 @@ class QXcbScreen;
class QXcbWindow : public QXcbObject, public QPlatformWindow
{
public:
- QXcbWindow(QWidget *tlw);
+ QXcbWindow(QWindow *window);
~QXcbWindow();
void setGeometry(const QRect &rect);
@@ -73,7 +73,7 @@ public:
QPlatformGLContext *glContext() const;
- xcb_window_t window() const { return m_window; }
+ xcb_window_t xcb_window() const { return m_window; }
void handleExposeEvent(const xcb_expose_event_t *event);
void handleClientMessageEvent(const xcb_client_message_event_t *event);
diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp
index 718f09383c..a371d2dd06 100644
--- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp
@@ -167,12 +167,12 @@ void QXcbShmImage::preparePaint(const QRegion &region)
}
}
-QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface)
- : QWindowSurface(widget, setDefaultSurface)
+QXcbWindowSurface::QXcbWindowSurface(QWindow *window, bool setDefaultSurface)
+ : QWindowSurface(window, setDefaultSurface)
, m_image(0)
, m_syncingResize(false)
{
- QXcbScreen *screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(widget));
+ QXcbScreen *screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWindow(window));
setConnection(screen->connection());
}
@@ -195,7 +195,7 @@ void QXcbWindowSurface::endPaint(const QRegion &)
{
}
-void QXcbWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
+void QXcbWindowSurface::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
QRect bounds = region.boundingRect();
@@ -204,14 +204,11 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoi
Q_XCB_NOOP(connection());
- QXcbWindow *window = static_cast<QXcbWindow *>(widget->window()->platformWindow());
-
- extern QWidgetData* qt_widget_data(QWidget *);
- QPoint widgetOffset = qt_qwidget_data(widget)->wrect.topLeft();
+ QXcbWindow *platformWindow = static_cast<QXcbWindow *>(window->handle());
QVector<QRect> rects = region.rects();
for (int i = 0; i < rects.size(); ++i)
- m_image->put(window->window(), rects.at(i).topLeft() - widgetOffset, rects.at(i).translated(offset));
+ m_image->put(platformWindow->xcb_window(), rects.at(i).topLeft(), rects.at(i).translated(offset));
Q_XCB_NOOP(connection());
@@ -219,7 +216,7 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoi
xcb_flush(xcb_connection());
connection()->sync();
m_syncingResize = false;
- window->updateSyncRequestCounter();
+ platformWindow->updateSyncRequestCounter();
}
}
@@ -231,7 +228,7 @@ void QXcbWindowSurface::resize(const QSize &size)
Q_XCB_NOOP(connection());
QWindowSurface::resize(size);
- QXcbScreen *screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(window()));
+ QXcbScreen *screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWindow(window()));
delete m_image;
m_image = new QXcbShmImage(screen, size);
diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h
index 23d32ef445..60ed7497db 100644
--- a/src/plugins/platforms/xcb/qxcbwindowsurface.h
+++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h
@@ -53,11 +53,11 @@ class QXcbShmImage;
class QXcbWindowSurface : public QXcbObject, public QWindowSurface
{
public:
- QXcbWindowSurface(QWidget *widget, bool setDefaultSurface = true);
+ QXcbWindowSurface(QWindow *widget, bool setDefaultSurface = true);
~QXcbWindowSurface();
QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset);
void resize(const QSize &size);
bool scroll(const QRegion &area, int dx, int dy);
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index c1aff35428..6950114aaa 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -7,8 +7,6 @@ unix:!symbian {
SUBDIRS *= codecs
}
!contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats
-!embedded:!qpa:SUBDIRS *= graphicssystems
-embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers
!win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods
!symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible
symbian:SUBDIRS += s60