From 1ff04d1b8a7b8358b8d3ffcf28b57ade52241058 Mon Sep 17 00:00:00 2001 From: Brian Hinz Date: Thu, 28 Nov 2013 16:26:08 +0000 Subject: [PATCH] Added 'contrib' folder to store patches necessary to build external dependecies, distribution-specific packaging files, etc. Also added a delimiter to the end of the fltk patch script defined in BUILDING.txt to make it easier to parse this script out for automated builds. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5139 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- BUILDING.txt | 34 + .../deb/ubuntu-precise/debian/changelog | 31 + .../packages/deb/ubuntu-precise/debian/compat | 1 + .../deb/ubuntu-precise/debian/control | 70 + .../deb/ubuntu-precise/debian/copyright | 116 + .../ubuntu-precise/debian/get-orig-source.sh | 38 + .../debian/local/vncserver.service | 111 + .../debian/local/vncserver.sysconfig | 19 + .../deb/ubuntu-precise/debian/patch_fltk.sh | 52 + .../debian/patches/100_rethrow_signals.patch | 26 + .../debian/patches/504_tigervnc-cookie.patch | 36 + .../debian/patches/510_tigervnc11-ldnow.patch | 11 + .../patches/511_tigervnc11-gethomedir.patch | 19 + .../patches/513_tigervnc11-rh692048.patch | 43 + .../patches/516_tigervnc-xorg-manpages.patch | 10 + .../deb/ubuntu-precise/debian/patches/series | 12 + .../packages/deb/ubuntu-precise/debian/rules | 290 +++ .../deb/ubuntu-precise/debian/source/format | 1 + .../debian/tigervncserver.postinst | 30 + .../debian/tigervncserver.prerm | 19 + .../debian/xtigervncviewer.menu | 5 + .../debian/xtigervncviewer.postinst | 18 + .../debian/xtigervncviewer.prerm | 11 + .../rpm/el5/SOURCES/cve-2011-4818-extra.patch | 114 + .../rpm/el5/SOURCES/cve-2011-4818.patch | 1271 ++++++++++ .../el5/SOURCES/dont-forward-keycode-0.patch | 51 + .../el5/SOURCES/fltk-1.3.x-clipboard.patch | 106 + .../el5/SOURCES/fltk-1.3.x-screen_num.patch | 131 + .../rpm/el5/SOURCES/fltk-1_v2.3.0-modal.patch | 75 + .../SOURCES/fltk-1_v2.3.x-clipboard-osx.patch | 44 + .../fltk-1_v2.3.x-clipboard-win32.patch | 99 + .../rpm/el5/SOURCES/fltk-1_v3.3.0-icons.patch | 645 +++++ .../fltk-1_v3.3.x-clipboard-win32-fix.patch | 135 + .../el5/SOURCES/fltk-1_v3.3.x-multihead.patch | 468 ++++ .../fltk-1_v4.3.x-keyboard-win32.patch | 256 ++ .../SOURCES/fltk-1_v4.3.x-keyboard-x11.patch | 286 +++ .../SOURCES/fltk-1_v5.3.x-clipboard-x11.patch | 350 +++ .../el5/SOURCES/fltk-1_v5.3.x-cursor.patch | 1623 ++++++++++++ .../SOURCES/fltk-1_v6.3.x-clipboard-x11.patch | 355 +++ .../SOURCES/fltk-1_v6.3.x-keyboard-osx.patch | 375 +++ .../freetype-2.1.10-enable-ft2-bci.patch | 11 + .../SOURCES/freetype-2.2.1-enable-valid.patch | 20 + .../SOURCES/freetype-2.3.0-enable-spr.patch | 11 + .../freetype-2.3.11-CVE-2010-1797.patch | 101 + .../freetype-2.3.11-CVE-2010-2498.patch | 35 + .../freetype-2.3.11-CVE-2010-2499.patch | 39 + .../freetype-2.3.11-CVE-2010-2500.patch | 31 + .../freetype-2.3.11-CVE-2010-2519.patch | 23 + .../freetype-2.3.11-CVE-2010-2520.patch | 13 + .../freetype-2.3.11-CVE-2010-2805.patch | 11 + .../freetype-2.3.11-CVE-2010-2806.patch | 41 + .../freetype-2.3.11-CVE-2010-2808.patch | 21 + .../freetype-2.3.11-CVE-2010-3311.patch | 37 + .../freetype-2.3.11-CVE-2010-3855.patch | 20 + .../freetype-2.3.11-CVE-2011-0226.patch | 108 + .../freetype-2.3.11-CVE-2011-3256.patch | 92 + .../freetype-2.3.11-CVE-2011-3439.patch | 76 + .../freetype-2.3.11-CVE-2012-1126.patch | 20 + .../freetype-2.3.11-CVE-2012-1127.patch | 43 + .../freetype-2.3.11-CVE-2012-1130.patch | 21 + .../freetype-2.3.11-CVE-2012-1131.patch | 40 + .../freetype-2.3.11-CVE-2012-1132.patch | 130 + .../freetype-2.3.11-CVE-2012-1134.patch | 26 + .../freetype-2.3.11-CVE-2012-1136.patch | 49 + .../freetype-2.3.11-CVE-2012-1137.patch | 11 + .../freetype-2.3.11-CVE-2012-1139.patch | 33 + .../freetype-2.3.11-CVE-2012-1140.patch | 53 + .../freetype-2.3.11-CVE-2012-1141.patch | 17 + .../freetype-2.3.11-CVE-2012-1142.patch | 27 + .../freetype-2.3.11-CVE-2012-1143.patch | 67 + .../freetype-2.3.11-CVE-2012-1144.patch | 22 + ...freetype-2.3.11-array-initialization.patch | 12 + .../freetype-2.3.11-bdf-overflow.patch | 11 + .../rpm/el5/SOURCES/freetype-multilib.patch | 18 + .../rpm/el5/SOURCES/intel-revert-vbl.patch | 21 + .../libX11-1.3.1-creategc-man-page.patch | 14 + .../el5/SOURCES/libXext-1.1-XAllocID.patch | 35 + .../el5/SOURCES/libXt-1.0.2-libsm-fix.patch | 11 + .../rpm/el5/SOURCES/libdrm-2.4.0-no-bc.patch | 54 + .../SOURCES/libdrm-make-dri-perms-okay.patch | 12 + .../libdrm-nouveau-better-relocs.patch | 295 +++ .../libdrm-nouveau-drop-rendering.patch | 103 + .../libdrm-nouveau-restart-pushbuf.patch | 50 + .../rpm/el5/SOURCES/libdrm-page-flip.patch | 174 ++ ...enc-1.0.0-get-fontdir-from-pkgconfig.patch | 13 + .../SOURCES/mesa-7.1-nukeglthread-debug.patch | 15 + .../el5/SOURCES/mesa-7.1-osmesa-version.patch | 12 + .../SOURCES/mesa-7.6-glx13-app-warning.patch | 28 + .../mesa-7.6-hush-vblank-warning.patch | 12 + .../rpm/el5/SOURCES/mesa-no-mach64.patch | 46 + .../packages/rpm/el5/SOURCES/pixmap_v2.patch | 554 +++++ .../SOURCES/tigervnc-ac-compatibility.patch | 15 + .../rpm/el5/SOURCES/tigervnc-cookie.patch | 37 + ...rg-1.7.5-remove-copyisolatin1lowered.patch | 33 + .../el5/SOURCES/tigervnc11-gethomedir.patch | 20 + .../rpm/el5/SOURCES/tigervnc11-ldnow.patch | 12 + .../rpm/el5/SOURCES/tigervnc11-rh692048.patch | 44 + .../rpm/el5/SOURCES/vncserver.service | 91 + .../rpm/el5/SOURCES/vncserver.sysconfig | 19 + .../rpm/el5/SOURCES/vncviewer.desktop | 11 + .../rpm/el5/SOURCES/xserver-1.1.1-pam.patch | 51 + .../xserver-1.4.99-pic-libxf86config.patch | 18 + .../xserver-1.4.99-ssh-isnt-local.patch | 48 + .../SOURCES/xserver-1.5.0-bg-none-root.patch | 155 ++ .../xserver-1.5.0-projector-fb-size.patch | 32 + .../SOURCES/xserver-1.5.1-mode-debug.patch | 26 + .../el5/SOURCES/xserver-1.6.0-displayfd.patch | 172 ++ .../xserver-1.6.0-less-acpi-brokenness.patch | 31 + .../el5/SOURCES/xserver-1.6.1-nouveau.patch | 108 + .../xserver-1.6.99-default-modes.patch | 35 + ...erver-1.6.99-hush-prerelease-warning.patch | 25 + ...xserver-1.6.99-randr-error-debugging.patch | 42 + .../el5/SOURCES/xserver-1.6.99-right-of.patch | 172 ++ .../xserver-1.7.0-glx-versioning.patch | 233 ++ .../xserver-1.7.0-randr-gamma-restore.patch | 65 + .../SOURCES/xserver-1.7.1-gamma-kdm-fix.patch | 34 + .../SOURCES/xserver-1.7.1-glx14-swrast.patch | 26 + .../el5/SOURCES/xserver-1.7.1-libcrypto.patch | 35 + .../el5/SOURCES/xserver-1.7.1-multilib.patch | 55 + .../xserver-1.7.3-no-free-on-abort.patch | 65 + .../SOURCES/xserver-1.7.4-dpms-timeouts.patch | 29 + .../xserver-1.7.4-qxl-autoconfig.patch | 26 + .../rpm/el5/SOURCES/xserver-1.7.4-z-now.patch | 25 + .../SOURCES/xserver-1.7.6-default-modes.patch | 367 +++ ...7.6-deviceevent-coordinates-xinerama.patch | 37 + .../xserver-1.7.6-export-dix-functions.patch | 58 + ...rver-1.7.6-export-more-dix-functions.patch | 26 + .../xserver-1.7.6-no-connected-outputs.patch | 142 ++ .../SOURCES/xserver-1.7.6-pointerkeys.patch | 255 ++ .../xserver-1.7.6-randr-vt-switch.patch | 41 + .../xserver-1.7.7-classic-default-mode.patch | 74 + .../xserver-1.7.7-compresize-fix.patch | 319 +++ .../xserver-1.7.7-ddc-probe-less.patch | 30 + .../xserver-1.7.7-device-mode-list.patch | 31 + .../xserver-1.7.7-dga-master-keyboard.patch | 43 + .../xserver-1.7.7-event-mask-revert.patch | 137 ++ .../SOURCES/xserver-1.7.7-exa-master.patch | 2183 +++++++++++++++++ .../xserver-1.7.7-fix-randr-rotation.patch | 108 + ...xserver-1.7.7-improve-mode-selection.patch | 114 + .../xserver-1.7.7-int10-reserved-areas.patch | 166 ++ .../el5/SOURCES/xserver-1.7.7-lid-hack.patch | 130 + .../xserver-1.7.7-make-ephyr-resize.patch | 176 ++ .../xserver-1.7.7-modifier-keycount.patch | 58 + ...server-1.7.7-postfix-DCE-PointerKeys.patch | 118 + ...rver-1.7.7-property-generation-reset.patch | 83 + ...server-1.7.7-randr-cursor-dead-zones.patch | 381 +++ .../SOURCES/xserver-1.7.7-randr-initial.patch | 37 + ...-1.7.7-release-xtest-on-phys-buttons.patch | 93 + .../xserver-1.7.7-reset-unused-classes.patch | 71 + .../xserver-1.7.7-sd-keyboard-controls.patch | 40 + .../SOURCES/xserver-1.7.7-showopts-segv.patch | 37 + .../SOURCES/xserver-1.7.7-xephyr-24bpp.patch | 83 + .../SOURCES/xserver-1.7.7-xkb-geom-copy.patch | 114 + .../xserver-1.7.7-xkb-invalid-writes.patch | 67 + ...-1.7.7-xkb-lockedPtrBtns-state-merge.patch | 160 ++ ...rver-1.7.7-xkb-pointerkeys-on-master.patch | 47 + .../xserver-1.7.7-xkb-purge-includes.patch | 38 + .../xserver-1.7.7-xkb-rename-fakebutton.patch | 398 +++ .../xtrans-1.0.3-avoid-gethostname.patch | 11 + contrib/packages/rpm/el5/SPECS/tigervnc.spec | 1585 ++++++++++++ .../el6/SOURCES/fltk-1.3.x-clipboard.patch | 106 + .../el6/SOURCES/fltk-1.3.x-screen_num.patch | 131 + .../rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch | 75 + .../SOURCES/fltk-1_v2.3.x-clipboard-osx.patch | 44 + .../fltk-1_v2.3.x-clipboard-win32.patch | 99 + .../rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch | 645 +++++ .../fltk-1_v3.3.x-clipboard-win32-fix.patch | 135 + .../el6/SOURCES/fltk-1_v3.3.x-multihead.patch | 468 ++++ .../fltk-1_v4.3.x-keyboard-win32.patch | 256 ++ .../SOURCES/fltk-1_v4.3.x-keyboard-x11.patch | 286 +++ .../SOURCES/fltk-1_v5.3.x-clipboard-x11.patch | 350 +++ .../el6/SOURCES/fltk-1_v5.3.x-cursor.patch | 1623 ++++++++++++ .../SOURCES/fltk-1_v6.3.x-clipboard-x11.patch | 355 +++ .../SOURCES/fltk-1_v6.3.x-keyboard-osx.patch | 375 +++ .../packages/rpm/el6/SOURCES/pixmap_v2.patch | 554 +++++ .../rpm/el6/SOURCES/tigervnc-cookie.patch | 37 + .../el6/SOURCES/tigervnc-xorg-manpages.patch | 10 + .../el6/SOURCES/tigervnc11-gethomedir.patch | 20 + .../rpm/el6/SOURCES/tigervnc11-ldnow.patch | 12 + .../rpm/el6/SOURCES/tigervnc11-rh692048.patch | 44 + .../rpm/el6/SOURCES/vncserver.service | 155 ++ .../rpm/el6/SOURCES/vncserver.sysconfig | 19 + .../rpm/el6/SOURCES/vncviewer.desktop | 11 + contrib/packages/rpm/el6/SPECS/tigervnc.spec | 734 ++++++ ...-feature-from-TigerVNC-to-optionally.patch | 67 + ...nds-on-some-Carbon-functions-so-we-n.patch | 26 + ...-CMAKE_REQUIRED_LIBRARIES-after-chec.patch | 30 + ...str-2917-fix-macosx-10.6-build-issue.patch | 11 + 188 files changed, 26452 insertions(+) create mode 100644 contrib/packages/deb/ubuntu-precise/debian/changelog create mode 100644 contrib/packages/deb/ubuntu-precise/debian/compat create mode 100644 contrib/packages/deb/ubuntu-precise/debian/control create mode 100644 contrib/packages/deb/ubuntu-precise/debian/copyright create mode 100755 contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh create mode 100644 contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service create mode 100644 contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig create mode 100755 contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh create mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch create mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/504_tigervnc-cookie.patch create mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/510_tigervnc11-ldnow.patch create mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/511_tigervnc11-gethomedir.patch create mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/513_tigervnc11-rh692048.patch create mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch create mode 100644 contrib/packages/deb/ubuntu-precise/debian/patches/series create mode 100755 contrib/packages/deb/ubuntu-precise/debian/rules create mode 100644 contrib/packages/deb/ubuntu-precise/debian/source/format create mode 100644 contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst create mode 100644 contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm create mode 100644 contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu create mode 100644 contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst create mode 100644 contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm create mode 100644 contrib/packages/rpm/el5/SOURCES/cve-2011-4818-extra.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/cve-2011-4818.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/dont-forward-keycode-0.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-clipboard.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-screen_num.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.0-modal.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.0-icons.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-multihead.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-cursor.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/intel-revert-vbl.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libX11-1.3.1-creategc-man-page.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libXext-1.1-XAllocID.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libXt-1.0.2-libsm-fix.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libdrm-2.4.0-no-bc.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libdrm-make-dri-perms-okay.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-better-relocs.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-drop-rendering.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-restart-pushbuf.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libdrm-page-flip.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/libfontenc-1.0.0-get-fontdir-from-pkgconfig.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/mesa-7.1-nukeglthread-debug.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/mesa-7.1-osmesa-version.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/mesa-7.6-glx13-app-warning.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/mesa-7.6-hush-vblank-warning.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/mesa-no-mach64.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/pixmap_v2.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc-ac-compatibility.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc-cookie.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc-xorg-1.7.5-remove-copyisolatin1lowered.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc11-gethomedir.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc11-ldnow.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc11-rh692048.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/vncserver.service create mode 100644 contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig create mode 100644 contrib/packages/rpm/el5/SOURCES/vncviewer.desktop create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.1.1-pam.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-pic-libxf86config.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-ssh-isnt-local.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-bg-none-root.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-projector-fb-size.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.5.1-mode-debug.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-displayfd.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-less-acpi-brokenness.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.6.1-nouveau.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-default-modes.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-hush-prerelease-warning.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-randr-error-debugging.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-right-of.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-glx-versioning.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-randr-gamma-restore.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-gamma-kdm-fix.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-glx14-swrast.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-libcrypto.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-multilib.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.3-no-free-on-abort.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-dpms-timeouts.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-qxl-autoconfig.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-z-now.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-default-modes.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-deviceevent-coordinates-xinerama.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-dix-functions.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-more-dix-functions.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-no-connected-outputs.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-pointerkeys.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-randr-vt-switch.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-classic-default-mode.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-compresize-fix.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-ddc-probe-less.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-device-mode-list.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-dga-master-keyboard.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-event-mask-revert.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-exa-master.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-fix-randr-rotation.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-improve-mode-selection.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-int10-reserved-areas.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-lid-hack.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-make-ephyr-resize.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-modifier-keycount.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-postfix-DCE-PointerKeys.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-property-generation-reset.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-cursor-dead-zones.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-initial.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-release-xtest-on-phys-buttons.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-reset-unused-classes.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-sd-keyboard-controls.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-showopts-segv.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xephyr-24bpp.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-geom-copy.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-invalid-writes.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-lockedPtrBtns-state-merge.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-pointerkeys-on-master.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-purge-includes.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-rename-fakebutton.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/xtrans-1.0.3-avoid-gethostname.patch create mode 100644 contrib/packages/rpm/el5/SPECS/tigervnc.spec create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/tigervnc-cookie.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/tigervnc11-gethomedir.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/tigervnc11-ldnow.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/tigervnc11-rh692048.patch create mode 100644 contrib/packages/rpm/el6/SOURCES/vncserver.service create mode 100644 contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig create mode 100644 contrib/packages/rpm/el6/SOURCES/vncviewer.desktop create mode 100644 contrib/packages/rpm/el6/SPECS/tigervnc.spec create mode 100644 contrib/patches/0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch create mode 100644 contrib/patches/0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch create mode 100644 contrib/patches/0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch create mode 100644 contrib/patches/0004-str-2917-fix-macosx-10.6-build-issue.patch diff --git a/BUILDING.txt b/BUILDING.txt index de0cae2f..4ed06671 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -138,6 +138,8 @@ apply_patch 2816 fltk-1_v3.3.0-icons.patch apply_patch 2860 fltk-1.3.x-screen_num.patch apply_patch 2860 fltk-1_v3.3.x-multihead.patch +### END SCRIPT ### + 3. Use CMake to build FLTK using the same procedures described below for building TigerVNC. The recipes in the "Build Recipes" section also apply. If you want optimized code, make sure to build with @@ -662,3 +664,35 @@ MinGW Build on Linux -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \ {source_directory} make + + +=============================== +Distribution-Specific Packaging +=============================== + + +RPM Packages for RHEL / CentOS +------------------------------ + +The RPM spec files and patches used to create the nightly builds +and releases can be found in the "contrib/rpm/el{5,6}" directories +of the TigerVNC subversion trunk. All external source tarballs +must be fetched manually and placed into the 'SOURCES' directory +under the rpmbuild root. Additonally, the following macros need +to be defined: + + EL6: + %debug_package %{nil} + + EL5: + %dist .el5 + %_smp_mflags -j3 + %debug_package %{nil} + %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot + + +Debian packages for Ubuntu 12.04LTS +----------------------------------- +The debian folder used to create the nightly builds and releases +can be found in the "contrib/deb/ubuntu-precise" directory of the +TigerVNC subversion trunk. diff --git a/contrib/packages/deb/ubuntu-precise/debian/changelog b/contrib/packages/deb/ubuntu-precise/debian/changelog new file mode 100644 index 00000000..28fc3c92 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/changelog @@ -0,0 +1,31 @@ +tigervnc (1.3.0-3ubuntu1) precise; urgency=low + + * Build Xvnc against native upstream xorg sources, using native config + options. Use distro-specific fltk1.3 sources. + + -- Brian P. Hinz Sun, 14 Jul 2013 15:22:28 -0400 + +tigervnc (1.3.0-3) precise; urgency=low + + * Additional dependencies (derived from ldd | dpkg -S). + + -- Brian P. Hinz Sun, 07 Jul 2013 11:01:33 -0400 + +tigervnc (1.3.0-2) precise; urgency=low + + * Added build dependencies to improve font support in viewer. + + -- Brian P. Hinz Sun, 07 Jul 2013 10:44:05 -0400 + +tigervnc (1.3.0-1) precise; urgency=low + + * Removed java viewer from server package. Fixed typo in server + dependencies. + + -- Brian P. Hinz Sun, 07 Jul 2013 09:55:44 -0400 + +tigervnc (1.3.0) precise; urgency=low + + * Initial release. + + -- Brian P. Hinz Fri, 05 Jul 2013 00:47:02 -0400 diff --git a/contrib/packages/deb/ubuntu-precise/debian/compat b/contrib/packages/deb/ubuntu-precise/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/compat @@ -0,0 +1 @@ +9 diff --git a/contrib/packages/deb/ubuntu-precise/debian/control b/contrib/packages/deb/ubuntu-precise/debian/control new file mode 100644 index 00000000..5520343f --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/control @@ -0,0 +1,70 @@ +Source: tigervnc +Section: x11 +Priority: optional +Maintainer: Brian P. Hinz +Standards-Version: 3.8.4 +Build-Depends: debhelper (>> 7.1), zlib1g-dev, libjpeg-turbo8-dev, libxaw7-dev (>> 4.1.0), perl-modules, xfonts-base, xutils-dev, libx11-dev, libxau-dev, libxext-dev, libxi-dev, libxkbfile-dev, libxmu-dev, libxt-dev, x11proto-core-dev, cmake (>> 2.8), libgnutls-dev, libpam0g-dev, libpng-dev, automake, autoconf, libtool, pkg-config, libpixman-1-dev, x11proto-bigreqs-dev, x11proto-composite-dev, x11proto-damage-dev, x11proto-dri2-dev, x11proto-fixes-dev, x11proto-fonts-dev, x11proto-gl-dev, x11proto-input-dev, x11proto-kb-dev, x11proto-randr-dev, x11proto-render-dev, x11proto-resource-dev, x11proto-scrnsaver-dev, x11proto-video-dev, x11proto-xcmisc-dev, x11proto-xext-dev, x11proto-xf86bigfont-dev, x11proto-xf86dga-dev, x11proto-xf86dri-dev, x11proto-xf86misc-dev, x11proto-xf86vidmode-dev, x11proto-xinerama-dev, libosmesa6-dev, libgl1-mesa-dev, libgl1-mesa-dri, libgl1-mesa-glx, libxfont-dev, x11proto-record-dev, default-jdk, libxtst-dev, libxft-dev, libexpat1-dev, libfontconfig1-dev, libxrender-dev, libt1-dev, libpciaccess-dev, curl, bzip2, quilt +Homepage: http://www.tigervnc.com + +Package: tigervncserver +Architecture: amd64 i386 +Provides: xserver, vnc-server +Depends: x11-common | xserver-common, x11-utils, xauth, libbz2-1.0, libc6, libfontenc1, libfreetype6, libgcc1, libgcrypt11, libgl1-mesa-dri, libgnutls26, libgpg-error0, libjpeg-turbo8, libp11-kit0, libpam0g, libpixman-1-0, libstdc++6, libtasn1-3, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxfont1, libxtst6, zlib1g +Recommends: xfonts-base, x11-xserver-utils +Suggests: xtigervncviewer, tigervnc-java +Description: virtual network computing server software + Virtual Network Computing (VNC) is a remote display system which allows you to + view and interact with a virtual desktop environment that is running on another + computer on the network. Using VNC, you can run graphical applications on a + remote machine and send only the display from these applications to your local + machine. VNC is platform-independent and supports a wide variety of operating + systems and architectures as both servers and clients. + . + TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code + bases. TigerVNC started as a next-generation development effort for TightVNC + on Unix and Linux platforms, but it split from its parent project in early 2009 + so that TightVNC could focus on Windows platforms. TigerVNC supports a variant + of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo + JPEG codec. + +Package: xtigervncviewer +Architecture: amd64 i386 +Provides: vncviewer, vnc-viewer +Depends: libc6, libexpat1, libfontconfig1, libfreetype6, libgcc1, libgcrypt11, libgnutls26, libgpg-error0, libjpeg-turbo8, libp11-kit0, libpng12-0, libstdc++6, libtasn1-3, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxft2, libxrender1, zlib1g +Recommends: xfonts-base +Suggests: tigervncserver, ssh +Description: virtual network computing client software for X + Virtual Network Computing (VNC) is a remote display system which allows you to + view and interact with a virtual desktop environment that is running on another + computer on the network. Using VNC, you can run graphical applications on a + remote machine and send only the display from these applications to your local + machine. VNC is platform-independent and supports a wide variety of operating + systems and architectures as both servers and clients. + . + TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code + bases. TigerVNC started as a next-generation development effort for TightVNC + on Unix and Linux platforms, but it split from its parent project in early 2009 + so that TightVNC could focus on Windows platforms. TigerVNC supports a variant + of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo + JPEG codec. + +Package: tigervnc-java +Architecture: any +Suggests: tigervncserver +Provides: vncviewer, vnc-viewer +Depends: default-jre +Description: TigerVNC java applet + Virtual Network Computing (VNC) is a remote display system which allows you to + view and interact with a virtual desktop environment that is running on another + computer on the network. Using VNC, you can run graphical applications on a + remote machine and send only the display from these applications to your local + machine. VNC is platform-independent and supports a wide variety of operating + systems and architectures as both servers and clients. + . + TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org code + bases. TigerVNC started as a next-generation development effort for TightVNC + on Unix and Linux platforms, but it split from its parent project in early 2009 + so that TightVNC could focus on Windows platforms. TigerVNC supports a variant + of Tight encoding that is greatly accelerated by the use of the libjpeg-turbo + JPEG codec. + diff --git a/contrib/packages/deb/ubuntu-precise/debian/copyright b/contrib/packages/deb/ubuntu-precise/debian/copyright new file mode 100644 index 00000000..003dcc49 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/copyright @@ -0,0 +1,116 @@ +This package was packaged for Debian by Brian P. Hinz +on Tue, 02 Jul 2013 21:33:24 +0500 using the tightvnc package as a base. + +It was downloaded from: + http://www.tigervnc.org/ + +COPYRIGHT: +========== + +TigerVNC is + + Copyright (C) 1999 AT&T Laboratories Cambridge + Copyright (C) 2002-2005 RealVNC Ltd. + Copyright (C) 2000-2006 TightVNC Group + Copyright (C) 2005-2006 Martin Koegler + Copyright (C) 2005-2006 Sun Microsystems, Inc. + Copyright (C) 2006 OCCAM Financial Technology + Copyright (C) 2000-2008 Constantin Kaplinsky + Copyright (C) 2004-2009 Peter Astrand for Cendio AB + Copyright (C) 2010 Antoine Martin + Copyright (C) 2010 m-privacy GmbH + Copyright (C) 2009-2011 D. R. Commander + Copyright (C) 2009-2011 Pierre Ossman for Cendio AB + Copyright (C) 2004, 2009-2011 Red Hat, Inc. + Copyright (C) 2009-2011 TigerVNC Team + All Rights Reserved. + +This software is distributed under the GNU General Public Licence as published +by the Free Software Foundation. See the file LICENCE.TXT for the conditions +under which this software is made available. TigerVNC also contains code from +other sources. See the Acknowledgements section below, and the individual +source files, for details of the conditions under which they are made +available. + +ACKNOWLEDGEMENTS +================ + +This distribution contains zlib compression software. This is: + + Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). + + +This distribution contains public domain DES software by Richard Outerbridge. +This is: + + Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. + (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. + + +This distribution contains software from the X Window System. This is: + + Copyright 1987, 1988, 1998 The Open Group + + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation. + + 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 + OPEN GROUP 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 Open Group 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 Open Group. + + + 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. diff --git a/contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh b/contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh new file mode 100755 index 00000000..64b26155 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/get-orig-source.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +#curl -L -o tigervnc-1.3.0.tar.bz2 "http://downloads.sourceforge.net/project/tigervnc/tigervnc/1.3.0/tigervnc-1.3.0.tar.bz2" +#tar xjf tigervnc-*.tar.bz2 +#rm tigervnc-*.tar.bz2 +curl -OL http://sourceforge.net/code-snapshots/svn/t/ti/tigervnc/code/tigervnc-code-5136-trunk.zip +unzip tigervnc-code-*-trunk.zip +mv tigervnc-code-*-trunk tigervnc-1.3.80 +rm tigervnc-code-*-trunk.zip +pushd tigervnc-* +curl -L -o fltk-1.3.2-source.tar.gz 'http://anonscm.debian.org/gitweb/?p=users/ucko/fltk1.3.git;a=snapshot;h=HEAD;sf=tgz' +tar xzf fltk-*-source.tar.gz +rm fltk-*-source.tar.gz +mv fltk1.3-* fltk-1.3.2 +pushd fltk-* +sh ../../debian/patch_fltk.sh +find . -name "*.orig" -exec rm {} \; +popd +curl -L -o xorg-server-1.11.4-0ubuntu10.3.tar.gz 'http://anonscm.debian.org/gitweb/?p=pkg-xorg/xserver/xorg-server.git;a=snapshot;h=cbf435a091906484112f5c4cf35b17738e779ce9;sf=tgz' +tar xzf xorg-server-*.tar.gz +rm xorg-server-*.tar.gz +pushd xorg-server-* +QUILT_PATCHES=debian/patches quilt push -a +popd +cp -r xorg-server-*/* unix/xserver +rm -rf xorg-server-* +pushd unix/xserver +for all in `find . -type f -perm -001`; do + chmod -x "$all" +done +patch -p1 -b --suffix .vnc < ../xserver111.patch +popd +popd +if [ -e tigervnc_1.3.80.orig.tar.gz ] ; then + rm tigervnc_1.3.80.orig.tar.gz +fi +tar czf tigervnc_1.3.80.orig.tar.gz tigervnc-1.3.80 +rm -rf tigervnc-1.3.80 diff --git a/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service b/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service new file mode 100644 index 00000000..887750d4 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.service @@ -0,0 +1,111 @@ +#!/bin/bash + +# Scripted by Maxim Heijndijk + +# chkconfig: 2345 91 35 +# description: Starts and stops vncserver. \ +# Used to provide remote X administration services. + +### BEGIN INIT INFO +# Provides: vncservers +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Required-Start: networking +# Required-Stop: networking +# Short-Description: Starts and stops vncserver +# Description: Used to provide remote X administration services. +### END INIT INFO + +# Source function library. + +. /lib/lsb/init-functions + +VNCSERVERS="" + +[ -f /etc/default/vncservers ] && . /etc/default/vncservers || exit 0 + +start() { + + ulimit -S -c 0 >/dev/null 2>&1 + + RETVAL=0 + + for display in ${VNCSERVERS}; do + + eval cd ~${display##*:} + + if [ -e ".vnc/passwd" ]; then + + log_begin_msg "Starting VNC Server for user ${display##*:}:" + + unset BASH_ENV ENV + + su ${display##*:} -c "cd ~${display##*:} && vncserver :${display%%:*}" + + RETVAL="$?" + + if [ "$RETVAL" -ne 0 ]; then + + log_end_msg 1 + + break + + else + + log_end_msg 0 + + fi + + else + + log_begin_msg "Not starting VNC Server for user ${display##*:}.\n File \"~${display##*:}/.vnc/passwd\" not found.\n Create a password file for the VNC server with vncpasswd" + + log_end_msg 1 + + fi + + done + + [ "$RETVAL" -eq 0 ] && touch "/var/lock/vncserver" + +} + +stop() { + + unset BASH_ENV ENV + + for display in ${VNCSERVERS}; do + + log_begin_msg "Shutting down VNC Server for user ${display##*:}: " + + su ${display##*:} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 + + RETVAL="$?" + + [ "$RETVAL" -eq 0 ] && log_end_msg 0 || log_end_msg 1 + + done + + [ -f "/var/lock/vncserver" ] && rm -f "/var/lock/vncserver" + +} + +case "$1" in + + start) start + ;; + + stop) stop + ;; + + restart|reload) stop + start + ;; + + *) echo $"Usage: $0 {start|stop|restart}" + exit 1 + ;; + +esac + +exit 0 diff --git a/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig b/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig new file mode 100644 index 00000000..5940a1e7 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/local/vncserver.sysconfig @@ -0,0 +1,19 @@ +# The VNCSERVERS variable is a list of display:user pairs. +# +# Uncomment the lines below to start a VNC server on display :2 +# as my 'myusername' (adjust this to your own). You will also +# need to set a VNC password; run 'man vncpasswd' to see how +# to do that. +# +# DO NOT RUN THIS SERVICE if your local area network is +# untrusted! For a secure way of using VNC, see this URL: +# http://kbase.redhat.com/faq/docs/DOC-7028 + +# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. + +# Use "-localhost" to prevent remote VNC clients connecting except when +# doing so through a secure tunnel. See the "-via" option in the +# `man vncviewer' manual page. + +# VNCSERVERS="2:myusername" +# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh b/contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh new file mode 100755 index 00000000..a2dc0f08 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patch_fltk.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -e +apply_patch() +{ + rm -f $2 + curl -OL http://www.fltk.org/strfiles/$1/$2 + patch -p1 < $2 +} + +# Export dead key information from FLTK to the apps +# http://www.fltk.org/str.php?L2599 +apply_patch 2599 fltk-1_v4.3.x-keyboard-x11.patch +apply_patch 2599 fltk-1_v4.3.x-keyboard-win32.patch +apply_patch 2599 fltk-1_v6.3.x-keyboard-osx.patch + +# Notify applications of changes to the clipboard +# http://www.fltk.org/str.php?L2636 +apply_patch 2636 fltk-1.3.x-clipboard.patch +apply_patch 2636 fltk-1_v6.3.x-clipboard-x11.patch +apply_patch 2636 fltk-1_v3.3.x-clipboard-win32-fix.patch +apply_patch 2636 fltk-1_v2.3.x-clipboard-win32.patch +apply_patch 2636 fltk-1_v2.3.x-clipboard-osx.patch + +# Ability to convert a Fl_Pixmap to a Fl_RGB_Image +# http://www.fltk.org/str.php?L2659 +apply_patch 2659 pixmap_v2.patch + +# Support for custom cursors +# http://www.fltk.org/str.php?L2660 +apply_patch 2660 fltk-1_v5.3.x-cursor.patch + +# Improve modality interaction with WM +# http://www.fltk.org/str.php?L2802 +apply_patch 2802 fltk-1_v2.3.0-modal.patch + +# Window icons +# http://www.fltk.org/str.php?L2816 +apply_patch 2816 fltk-1_v3.3.0-icons.patch + +# Multihead +# http://fltk.org/str.php?L2860 +apply_patch 2860 fltk-1.3.x-screen_num.patch +apply_patch 2860 fltk-1_v3.3.x-multihead.patch + +# Apply DRC's patches to FLTK +curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=1' -o 0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch +curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=2' -o 0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch +curl -L 'https://sourceforge.net/mailarchive/attachment.php?list_name=tigervnc-devel&message_id=512DD1FE.7090609%40users.sourceforge.net&counter=3' -o 0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch + +patch -p1 -i 0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch +patch -p1 -i 0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch +patch -p1 -i 0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch new file mode 100644 index 00000000..7c2e6d05 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patches/100_rethrow_signals.patch @@ -0,0 +1,26 @@ +--- a/unix/xserver/hw/vnc/xvnc.cc 2013-07-14 14:05:29.963390223 -0400 ++++ b/unix/xserver/hw/vnc/xvnc.cc 2013-07-14 14:04:12.840357191 -0400 +@@ -250,7 +250,7 @@ + #if XORG < 111 + AbortDDX() + #else +-AbortDDX(enum ExitCode error) ++SigAbortDDX(int signo, enum ExitCode error) + #endif + { + #if XORG < 111 +@@ -260,6 +260,14 @@ + #endif + } + ++#if XORG >= 111 ++void ++AbortDDX(enum ExitCode error) ++{ ++ SigAbortDDX(0, error); ++} ++#endif ++ + #ifdef __DARWIN__ + void + DarwinHandleGUI(int argc, char *argv[]) diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/504_tigervnc-cookie.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/504_tigervnc-cookie.patch new file mode 100644 index 00000000..1fc93c86 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patches/504_tigervnc-cookie.patch @@ -0,0 +1,36 @@ +--- a/unix/vncserver 2009-11-12 11:39:54.000000000 +0100 ++++ b/unix/vncserver 2009-12-21 16:15:01.907799091 +0100 +@@ -189,27 +189,12 @@ $vncPort = 5900 + $displayNumber; + $desktopLog = "$vncUserDir/$host:$displayNumber.log"; + unlink($desktopLog); + +-# Make an X server cookie - use /dev/urandom on systems that have it, +-# otherwise use perl's random number generator, seeded with the sum +-# of the current time, our PID and part of the encrypted form of the password. +- +-my $cookie = ""; +-if (open(URANDOM, '<', '/dev/urandom')) { +- my $randata; +- if (sysread(URANDOM, $randata, 16) == 16) { +- $cookie = unpack 'h*', $randata; +- } +- close(URANDOM); +-} +-if ($cookie eq "") { +- srand(time+$$+unpack("L",`cat $vncUserDir/passwd`)); +- for (1..16) { +- $cookie .= sprintf("%02x", int(rand(256)) % 256); +- } +-} +- +-system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); +-system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); ++# Make an X server cookie - use mcookie ++$cookie = `/usr/bin/mcookie`; ++open (XAUTH, "|xauth -f $xauthorityFile source -"); ++print XAUTH "add $host:$displayNumber . $cookie\n"; ++print XAUTH "add $host/unix:$displayNumber . $cookie\n"; ++close XAUTH; + + if ($opt{'-name'}) { + $desktopName = $opt{'-name'}; diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/510_tigervnc11-ldnow.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/510_tigervnc11-ldnow.patch new file mode 100644 index 00000000..e8e99b50 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patches/510_tigervnc11-ldnow.patch @@ -0,0 +1,11 @@ +--- a/unix/xserver/hw/vnc/Makefile.am 2011-10-31 09:14:40.000000000 +0100 ++++ b/unix/xserver/hw/vnc/Makefile.am 2012-08-22 15:51:47.013241342 +0200 +@@ -53,7 +53,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I + -I$(top_srcdir)/include \ + ${XSERVERLIBS_CFLAGS} -I$(includedir) + +-libvnc_la_LDFLAGS = -module -avoid-version ++libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now + + libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) + diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/511_tigervnc11-gethomedir.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/511_tigervnc11-gethomedir.patch new file mode 100644 index 00000000..208608c6 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patches/511_tigervnc11-gethomedir.patch @@ -0,0 +1,19 @@ +--- a/unix/xserver/hw/vnc/Makefile.am 2012-08-22 15:52:01.876216608 +0200 ++++ b/unix/xserver/hw/vnc/Makefile.am 2012-08-22 15:52:45.973143684 +0200 +@@ -5,6 +5,7 @@ RFB_LIB=$(LIB_DIR)/rfb/librfb.la + RDR_LIB=$(LIB_DIR)/rdr/librdr.la + NETWORK_LIB=$(LIB_DIR)/network/libnetwork.la + XREGION_LIB=$(LIB_DIR)/Xregion/libXregion.la ++OS_LIB=$(LIB_DIR)/os/libos.la + COMMON_LIBS=$(NETWORK_LIB) $(RFB_LIB) $(RDR_LIB) $(XREGION_LIB) + + noinst_LTLIBRARIES = libvnccommon.la +@@ -55,7 +56,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I + + libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now + +-libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) ++libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) $(OS_LIB) + + EXTRA_DIST = Xvnc.man + diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/513_tigervnc11-rh692048.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/513_tigervnc11-rh692048.patch new file mode 100644 index 00000000..f93bec33 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patches/513_tigervnc11-rh692048.patch @@ -0,0 +1,43 @@ +--- a/common/rfb/SecurityClient.cxx 2011-02-21 14:14:16.000000000 +0100 ++++ b/common/rfb/SecurityClient.cxx 2011-03-31 09:47:34.519099718 +0200 +@@ -45,7 +45,7 @@ StringParameter SecurityClient::secTypes + ("SecurityTypes", + "Specify which security scheme to use (None, VncAuth)", + #ifdef HAVE_GNUTLS +- "X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", ++ "VeNCrypt,X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", + #else + "VncAuth,None", + #endif +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx.rh690245 2011-02-21 14:14:16.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx 2011-03-31 09:47:34.519099718 +0200 +@@ -67,7 +67,6 @@ const std::list Security::GetEn + list result; + list::iterator i; + +- result.push_back(secTypeVeNCrypt); + for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) + if (*i < 0x100) + result.push_back(*i); +@@ -105,8 +104,6 @@ bool Security::IsSupported(U32 secType) + for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) + if (*i == secType) + return true; +- if (secType == secTypeVeNCrypt) +- return true; + + return false; + } +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx.rh690245 2011-02-21 14:50:17.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx 2011-03-31 10:06:43.595362302 +0200 +@@ -39,7 +39,7 @@ StringParameter SecurityServer::secTypes + ("SecurityTypes", + "Specify which security scheme to use (None, VncAuth)", + #ifdef HAVE_GNUTLS +- "VncAuth,TLSVnc", ++ "VncAuth", + #else + "VncAuth", + #endif diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch b/contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch new file mode 100644 index 00000000..4575f6a9 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patches/516_tigervnc-xorg-manpages.patch @@ -0,0 +1,10 @@ +--- a/unix/xserver/man/Makefile.am 2013-03-30 17:51:01.707258746 -0400 ++++ b/unix/xserver/man/Makefile.am 2013-03-30 17:51:47.606569692 -0400 +@@ -2,5 +2,7 @@ + # (i.e. those handled in the os/utils.c options processing instead of in + # the DDX-level options processing) + ++if ENABLE_DOCS + include $(top_srcdir)/manpages.am + appman_PRE = Xserver.man ++endif ENABLE_DOCS diff --git a/contrib/packages/deb/ubuntu-precise/debian/patches/series b/contrib/packages/deb/ubuntu-precise/debian/patches/series new file mode 100644 index 00000000..2e5a026a --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/patches/series @@ -0,0 +1,12 @@ +## Patches with a number < 100 are applied in debian. +## Ubuntu patches start with 100. + +# Ubuntu patches +100_rethrow_signals.patch + +# Upstream patches +504_tigervnc-cookie.patch +510_tigervnc11-ldnow.patch +511_tigervnc11-gethomedir.patch +513_tigervnc11-rh692048.patch +516_tigervnc-xorg-manpages.patch diff --git a/contrib/packages/deb/ubuntu-precise/debian/rules b/contrib/packages/deb/ubuntu-precise/debian/rules new file mode 100755 index 00000000..432ec5e4 --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/rules @@ -0,0 +1,290 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +#DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +#DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags += --build=$(DEB_HOST_GNU_TYPE) +else + confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) +endif +SOURCE_NAME := tigervnc +SOURCE_VERSION := $(shell dpkg-parsechangelog | awk -F': ' '/^Version: / {print $$2}') +BUILDER=For technical support please see http://sourceforge.net/projects/tigervnc/support + + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g -O2 -fPIC +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +export CC = gcc + +get-orig-source: $(SOURCE_NAME)_$(SOURCE_VERSION).orig.tar.gz + @ + +$(SOURCE_NAME)_$(SOURCE_VERSION).orig.tar.gz: + $(CURDIR)/get-orig-source.sh + +configure: config-stamp +config-stamp: + dh_testdir + # Add here commands to configure the package. + (cd fltk-*;cmake -G"Unix Makefiles" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + -DOPTION_PREFIX_LIB=/usr/lib \ + -DOPTION_PREFIX_CONFIG=/usr/lib \ + -DOPTION_BUILD_EXAMPLES=off \ + -DOPTION_USE_SYSTEM_LIBPNG=on;make) + cmake -G"Unix Makefiles" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DFLTK_LIBRARIES="$(CURDIR)/fltk-1.3.2/lib/libfltk.a;$(CURDIR)/fltk-1.3.2/lib/libfltk_images.a;-lpng" \ + -DFLTK_INCLUDE_DIR=$(CURDIR)/fltk-1.3.2 + (cd unix/xserver; \ + export PIXMANINCDIR=/usr/include/pixman-1; \ + autoreconf -fiv; \ + ./configure --prefix=/usr \ + --disable-silent-rules \ + --disable-static \ + --without-dtrace \ + --disable-strict-compilation \ + --disable-debug \ + --disable-unit-tests \ + --with-int10=x86emu \ + --with-extra-module-dir="/usr/lib/${DEB_HOST_MULTIARCH}/xorg/extra-modules,/usr/lib/xorg/extra-modules" \ + --with-os-vendor="$(VENDOR)" \ + --with-builderstring="$(SOURCE_NAME) $(SOURCE_VERSION) ($(BUILDER))" \ + --with-xkb-path=/usr/share/X11/xkb \ + --with-xkb-output=/var/lib/xkb \ + --with-default-xkb-rules=evdev \ + --disable-devel-docs \ + --disable-install-libxf86config \ + --enable-mitshm \ + --enable-xres \ + --disable-xcsecurity \ + --disable-xcalibrate \ + --disable-tslib \ + --enable-dbe \ + --disable-xf86bigfont \ + --disable-dpms \ + --disable-config-dbus \ + --disable-config-hal \ + --disable-config-udev \ + --disable-xorg \ + --disable-xquartz \ + --disable-xwin \ + --disable-xfake \ + --disable-install-setuid \ + --enable-gestures \ + --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,built-ins" \ + --enable-aiglx \ + --enable-glx-tls \ + --enable-registry \ + --enable-composite \ + --enable-record \ + --enable-xv \ + --enable-xvmc \ + --enable-dga \ + --enable-screensaver \ + --enable-xdmcp \ + --enable-xdm-auth-1 \ + --enable-glx \ + --disable-dri --enable-dri2 \ + --disable-xinerama \ + --enable-xf86vidmode \ + --enable-xace \ + --disable-selinux \ + --enable-xfree86-utils \ + --disable-dmx \ + --disable-xvfb \ + --disable-xnest \ + --disable-kdrive \ + --disable-xephyr \ + --enable-xfbdev \ + --with-sha1=libgcrypt \ + --enable-xcsecurity \ + --disable-docs \ + --disable-selective-werror) + touch config-stamp + +build-arch: config-stamp build-arch-stamp +build-arch-stamp: + dh_testdir + + # Add here command to compile/build the package. + # Build first things. + # Build Xvnc + make LDFLAGS="-lpng" + (cd unix/xserver;make) + + touch build-arch-stamp + +build-indep: config-stamp build-indep-stamp +build-indep-stamp: + dh_testdir + + # Add here command to compile/build the arch indep package. + # It's ok not to do anything here, if you don't need to build + # anything for this package. + #/usr/bin/docbook-to-man debian/vnc.sgml > vnc.1 + (cd media;make) + (cd java;cmake -G"Unix Makefiles";make) + + touch build-indep-stamp + +build: build-arch build-indep + +clean: + dh_testdir + dh_testroot + rm -f build-arch-stamp build-indep-stamp config-stamp + + # Add here commands to clean up after the build process. + dh_clean + (cd fltk-*; $(MAKE) distclean; rm configure) + (if [ -e Makefile ] ; then $(MAKE) clean ; fi) + (cd unix/xserver; if [ -e Makefile ] ; then $(MAKE) clean ; fi) + +install: DH_OPTIONS= +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_prep + dh_installdirs + # Add here commands to install the package into debian/vnc. + # tigervncserver + make install DESTDIR=$(CURDIR)/debian/tigervncserver + (cd unix/xserver/hw/vnc; make install DESTDIR=$(CURDIR)/debian/tigervncserver) + mv $(CURDIR)/debian/tigervncserver/usr/bin/Xvnc \ + $(CURDIR)/debian/tigervncserver/usr/bin/Xtigervnc + mv $(CURDIR)/debian/tigervncserver/usr/bin/vncconfig \ + $(CURDIR)/debian/tigervncserver/usr/bin/tigervncconfig + mv $(CURDIR)/debian/tigervncserver/usr/bin/vncpasswd \ + $(CURDIR)/debian/tigervncserver/usr/bin/tigervncpasswd + mv $(CURDIR)/debian/tigervncserver/usr/bin/vncserver \ + $(CURDIR)/debian/tigervncserver/usr/bin/tigervncserver + mv $(CURDIR)/debian/tigervncserver/usr/bin/x0vncserver \ + $(CURDIR)/debian/tigervncserver/usr/bin/x0tigervncserver + mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncconfig.1 \ + $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncconfig.1 + mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncpasswd.1 \ + $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncpasswd.1 + mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncserver.1 \ + $(CURDIR)/debian/tigervncserver/usr/share/man/man1/tigervncserver.1 + mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0vncserver.1 \ + $(CURDIR)/debian/tigervncserver/usr/share/man/man1/x0tigervncserver.1 + mv $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xvnc.1 \ + $(CURDIR)/debian/tigervncserver/usr/share/man/man1/Xtigervnc.1 + mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-* \ + $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver + rm $(CURDIR)/debian/tigervncserver/usr/lib/xorg/modules/extensions/libvnc.la + rm $(CURDIR)/debian/tigervncserver/usr/bin/vncviewer + rm $(CURDIR)/debian/tigervncserver/usr/share/man/man1/vncviewer.1 + install -o root -g root -m 755 -D $(CURDIR)/debian/local/vncserver.service \ + $(CURDIR)/debian/tigervncserver/etc/init.d/vncserver + install -o root -g root -m 644 -D $(CURDIR)/debian/local/vncserver.sysconfig \ + $(CURDIR)/debian/tigervncserver/etc/default/vncservers + # xtigervncviewer + (cd vncviewer; make install DESTDIR=$(CURDIR)/debian/xtigervncviewer) + # Install desktop stuff + mv $(CURDIR)/debian/xtigervncviewer/usr/bin/vncviewer \ + $(CURDIR)/debian/xtigervncviewer/usr/bin/xtigervncviewer + mv $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1/vncviewer.1 \ + $(CURDIR)/debian/xtigervncviewer/usr/share/man/man1/xtigervncviewer.1 + install -o root -g root -m 644 -D media/icons/tigervnc_16.png \ + $(CURDIR)/debian/xtigervncviewer/usr/share/icons/hicolor/16x16/apps/tigervnc.png + install -o root -g root -m 644 -D media/icons/tigervnc_22.png \ + $(CURDIR)/debian/xtigervncviewer/usr/share/icons/hicolor/22x22/apps/tigervnc.png + install -o root -g root -m 644 -D media/icons/tigervnc_24.png \ + $(CURDIR)/debian/xtigervncviewer/usr/share/icons/hicolor/24x24/apps/tigervnc.png + install -o root -g root -m 644 -D media/icons/tigervnc_32.png \ + $(CURDIR)/debian/xtigervncviewer/usr/share/icons/hicolor/32x32/apps/tigervnc.png + install -o root -g root -m 644 -D media/icons/tigervnc_48.png \ + $(CURDIR)/debian/xtigervncviewer/usr/share/icons/hicolor/48x48/apps/tigervnc.png + install -o root -g root -m 644 -D media/icons/tigervnc.svg \ + $(CURDIR)/debian/xtigervncviewer/usr/share/icons/hicolor/scalable/apps/tigervnc.svg + # tigervnc-java + mkdir -p $(CURDIR)/debian/tigervnc-java/usr/share + (cd java; make install DESTDIR=$(CURDIR)/debian/tigervnc-java/usr/share) + #dh_movefiles + +# Build architecture-independent files here. +# Pass -i to all debhelper commands in this target to reduce clutter. +binary-indep: build install + +binary-indep-keep: + dh_testdir -i + dh_testroot -i +# dh_installdebconf -i + dh_install + dh_installdocs -i + dh_installexamples -i + dh_installmenu -i +# dh_installlogrotate -i +# dh_installemacsen -i +# dh_installpam -i +# dh_installmime -i +# dh_installinit -i + dh_installcron -i + dh_installman -i + dh_installinfo -i +# dh_undocumented -i + dh_installchangelogs -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_perl -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir -a + dh_testroot -a +# dh_installdebconf -a + dh_installdocs -a +# dh_installexamples -a + dh_installmenu -a +# dh_installlogrotate -a +# dh_installemacsen -a +# dh_installpam -a +# dh_installmime -a + dh_install + dh_installinit -a +# dh_installcron -a + dh_installman -a + dh_installinfo -a +# dh_undocumented -a + dh_installchangelogs -a + # Remove empty directories + dh_strip -a + dh_link -a + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a + dh_installdeb -a + dh_perl -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install get-orig-source diff --git a/contrib/packages/deb/ubuntu-precise/debian/source/format b/contrib/packages/deb/ubuntu-precise/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst b/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst new file mode 100644 index 00000000..aaed2f6b --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.postinst @@ -0,0 +1,30 @@ +#!/bin/sh -e + +if [ "$1" = "configure" ]; then + MAN=/usr/share/man/man1 + BIN=/usr/bin + update-alternatives --install \ + $BIN/vncserver vncserver $BIN/tigervncserver 64 \ + --slave \ + $MAN/vncserver.1.gz vncserver.1.gz $MAN/tigervncserver.1.gz + update-alternatives --install \ + $BIN/Xvnc Xvnc $BIN/Xtigervnc 74 \ + --slave \ + $MAN/Xvnc.1.gz Xvnc.1.gz $MAN/Xtigervnc.1.gz + update-alternatives --install \ + $BIN/x0vncserver x0vncserver $BIN/x0tigervncserver 74 \ + --slave \ + $MAN/x0vncserver.1.gz x0vncserver.1.gz $MAN/x0tigervncserver.1.gz + update-alternatives --install \ + $BIN/vncpasswd vncpasswd $BIN/tigervncpasswd 74 \ + --slave \ + $MAN/vncpasswd.1.gz vncpasswd.1.gz $MAN/tigervncpasswd.1.gz + update-alternatives --install \ + $BIN/vncconfig vncconfig $BIN/tigervncconfig 64 \ + --slave \ + $MAN/vncconfig.1.gz vncconfig.1.gz $MAN/tigervncconfig.1.gz +fi + +#DEBHELPER# + +exit 0 diff --git a/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm b/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm new file mode 100644 index 00000000..108b177d --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/tigervncserver.prerm @@ -0,0 +1,19 @@ +#!/bin/sh -e + +if [ "$1" = "remove" ] ; then + BIN=/usr/bin + update-alternatives --remove \ + vncserver $BIN/tigervncserver + update-alternatives --remove \ + Xvnc $BIN/Xtigervnc + update-alternatives --remove \ + x0vncserver $BIN/x0tigervncserver + update-alternatives --remove \ + vncpasswd $BIN/tigervncpasswd + update-alternatives --remove \ + tigervncconfig $BIN/tigervncconfig +fi + +#DEBHELPER# + +exit 0 diff --git a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu new file mode 100644 index 00000000..aac942ca --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.menu @@ -0,0 +1,5 @@ +?package(xtigervncviewer):needs="x11" \ + section="Applications/Network/Communication" \ + hints="VNC,remote-control"\ + title="xtigervncviewer" \ + command="/usr/bin/xtigervncviewer" diff --git a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst new file mode 100644 index 00000000..4df0c65f --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.postinst @@ -0,0 +1,18 @@ +#!/bin/sh -e + +if [ "$1" = "configure" ]; then + MAN=/usr/share/man/man1 + BIN=/usr/bin + update-alternatives --install \ + $BIN/vncviewer vncviewer $BIN/xtigervncviewer 74 \ + --slave \ + $MAN/vncviewer.1.gz vncviewer.1.gz $MAN/xtigervncviewer.1.gz \ + --slave \ + $MAN/xvncviewer.1.gz xvncviewer.1.gz $MAN/xtigervncviewer.1.gz \ + --slave \ + $BIN/xvncviewer xvncviewer $BIN/xtigervncviewer +fi + +#DEBHELPER# + +exit 0 diff --git a/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm new file mode 100644 index 00000000..7a51fd2c --- /dev/null +++ b/contrib/packages/deb/ubuntu-precise/debian/xtigervncviewer.prerm @@ -0,0 +1,11 @@ +#!/bin/sh -e + +if [ "$1" = "remove" ] ; then + BIN=/usr/bin + update-alternatives --remove \ + vncviewer $BIN/xtigervncviewer +fi + +#DEBHELPER# + +exit 0 diff --git a/contrib/packages/rpm/el5/SOURCES/cve-2011-4818-extra.patch b/contrib/packages/rpm/el5/SOURCES/cve-2011-4818-extra.patch new file mode 100644 index 00000000..5f81b4b7 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/cve-2011-4818-extra.patch @@ -0,0 +1,114 @@ +From ef2807731903ff05a618fe2cbd532fe2472f7d0d Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 27 Sep 2011 14:56:00 -0400 +Subject: [PATCH] CVE-2011-4818: Additional coverage for swap barriers and + hyperpipe + +These have since been dropped, so the straight backport does not cover +these cases. + +Signed-off-by: Adam Jackson +--- + glx/glxcmds.c | 30 ++++++++++++++++++++++++------ + 1 files changed, 24 insertions(+), 6 deletions(-) + +diff --git a/glx/glxcmds.c b/glx/glxcmds.c +index 922a6c1..fd0df31 100644 +--- a/glx/glxcmds.c ++++ b/glx/glxcmds.c +@@ -2204,6 +2204,8 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) + int screen, rc; + __GLXscreen *pGlxScreen; + ++ REQUEST_SIZE_MATCH(xGLXBindSwapBarrierSGIXReq); ++ + rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess); + pGlxScreen = glxGetScreen(pDraw->pScreen); + if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) { +@@ -2233,9 +2235,13 @@ int __glXDisp_QueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) + (xGLXQueryMaxSwapBarriersSGIXReq *) pc; + xGLXQueryMaxSwapBarriersSGIXReply reply; + int screen = req->screen; ++ int err; + __GLXscreen *pGlxScreen; + +- pGlxScreen = glxGetScreen(screenInfo.screens[screen]); ++ REQUEST_SIZE_MATCH(xGLXQueryMaxSwapBarriersSGIXReq); ++ if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) ++ return err; ++ + if (pGlxScreen->swapBarrierFuncs) + reply.max = pGlxScreen->swapBarrierFuncs->queryMaxSwapBarriersFunc(screen); + else +@@ -2265,14 +2271,17 @@ int __glXDisp_QueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc) + xGLXQueryHyperpipeNetworkSGIXReply reply; + int screen = req->screen; + void *rdata = NULL; +- ++ int err; + int length=0; + int npipes=0; + + int n= 0; + __GLXscreen *pGlxScreen; + +- pGlxScreen = glxGetScreen(screenInfo.screens[screen]); ++ REQUEST_SIZE_MATCH(xGLXQueryHyperpipeNetworkSGIXReq); ++ ++ if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) ++ return err; + if (pGlxScreen->hyperpipeFuncs) { + rdata = + (pGlxScreen->hyperpipeFuncs->queryHyperpipeNetworkFunc(screen, &npipes, &n)); +@@ -2308,11 +2317,14 @@ int __glXDisp_DestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc) + int screen = req->screen; + int success = GLX_BAD_HYPERPIPE_SGIX; + int hpId ; ++ int err; + __GLXscreen *pGlxScreen; + + hpId = req->hpId; + +- pGlxScreen = glxGetScreen(screenInfo.screens[screen]); ++ REQUEST_SIZE_MATCH(xGLXDestroyHyperpipeConfigSGIXReq); ++ if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) ++ return err; + if (pGlxScreen->hyperpipeFuncs) { + success = pGlxScreen->hyperpipeFuncs->destroyHyperpipeConfigFunc(screen, hpId); + } +@@ -2346,11 +2358,14 @@ int __glXDisp_QueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) + int npipes=0; + int n= 0; + int hpId; ++ int err; + __GLXscreen *pGlxScreen; + + hpId = req->hpId; + +- pGlxScreen = glxGetScreen(screenInfo.screens[screen]); ++ REQUEST_SIZE_MATCH(xGLXQueryHyperpipeConfigSGIXReq); ++ if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) ++ return err; + if (pGlxScreen->hyperpipeFuncs) { + rdata = pGlxScreen->hyperpipeFuncs->queryHyperpipeConfigFunc(screen, hpId,&npipes, &n); + } +@@ -2387,12 +2402,15 @@ int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) + xGLXHyperpipeConfigSGIXReply reply; + int screen = req->screen; + void *rdata; ++ int err; + + int npipes=0, networkId; + int hpId=-1; + __GLXscreen *pGlxScreen; + +- pGlxScreen = glxGetScreen(screenInfo.screens[screen]); ++ REQUEST_SIZE_MATCH(xGLXHyperpipeConfigSGIXReq); ++ if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) ++ return err; + networkId = (int)req->networkId; + npipes = (int)req->npipes; + rdata = (void *)(req +1); +-- +1.7.6 + diff --git a/contrib/packages/rpm/el5/SOURCES/cve-2011-4818.patch b/contrib/packages/rpm/el5/SOURCES/cve-2011-4818.patch new file mode 100644 index 00000000..51d30472 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/cve-2011-4818.patch @@ -0,0 +1,1271 @@ +From 39c693703e080d0f6a0fa23898ae2680af2a556b Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 27 Sep 2011 11:31:13 -0400 +Subject: [PATCH] CVE-2011-4818: Multiple input sanitization flaws in GLX and + Render + +Signed-off-by: Adam Jackson +--- + glx/glxcmds.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++++---- + glx/glxcmdsswap.c | 171 +++++++++++++++++++++++++++++++++++++++++++--- + glx/xfont.c | 2 + + render/render.c | 8 ++ + 4 files changed, 353 insertions(+), 23 deletions(-) + +diff --git a/glx/glxcmds.c b/glx/glxcmds.c +index ba4c123..922a6c1 100644 +--- a/glx/glxcmds.c ++++ b/glx/glxcmds.c +@@ -57,7 +57,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) + /* + ** Check if screen exists. + */ +- if (screen >= screenInfo.numScreens) { ++ if (screen < 0 || screen >= screenInfo.numScreens) { + client->errorValue = screen; + *err = BadValue; + return FALSE; +@@ -311,11 +311,14 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, + + int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + __GLXconfig *config; + __GLXscreen *pGlxScreen; + int err; + ++ REQUEST_SIZE_MATCH(xGLXCreateContextReq); ++ + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) + return err; + if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err)) +@@ -327,11 +330,14 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLXconfig *config; + __GLXscreen *pGlxScreen; + int err; + ++ REQUEST_SIZE_MATCH(xGLXCreateNewContextReq); ++ + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) + return err; + if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) +@@ -343,12 +349,15 @@ int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + __GLXconfig *config; + __GLXscreen *pGlxScreen; + int err; + ++ REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq); ++ + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) + return err; + if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) +@@ -359,10 +368,13 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) + } + int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; + __GLXcontext *glxc; + int err; + ++ REQUEST_SIZE_MATCH(xGLXDestroyContextReq); ++ + if (!validGlxContext(cl->client, req->context, DixDestroyAccess, + &glxc, &err)) + return err; +@@ -674,24 +686,33 @@ DoMakeCurrent(__GLXclientState *cl, + + int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXMakeCurrentReq); ++ + return DoMakeCurrent( cl, req->drawable, req->drawable, + req->context, req->oldContextTag ); + } + + int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq); ++ + return DoMakeCurrent( cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ); + } + + int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq); ++ + return DoMakeCurrent( cl, req->drawable, req->readable, + req->context, req->oldContextTag ); + } +@@ -704,6 +725,8 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc) + __GLXcontext *glxc; + int err; + ++ REQUEST_SIZE_MATCH(xGLXIsDirectReq); ++ + if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err)) + return err; + +@@ -728,6 +751,8 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc) + xGLXQueryVersionReply reply; + GLuint major, minor; + ++ REQUEST_SIZE_MATCH(xGLXQueryVersionReq); ++ + major = req->majorVersion; + minor = req->minorVersion; + (void)major; +@@ -754,11 +779,15 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc; +- GLXContextTag tag = req->contextTag; ++ GLXContextTag tag; + __GLXcontext *glxc = NULL; + int error; + ++ REQUEST_SIZE_MATCH(xGLXWaitGLReq); ++ ++ tag = req->contextTag; + if (tag) { + glxc = __glXLookupContextByTag(cl, tag); + if (!glxc) +@@ -778,11 +807,15 @@ int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXWaitXReq *req = (xGLXWaitXReq *)pc; +- GLXContextTag tag = req->contextTag; ++ GLXContextTag tag; + __GLXcontext *glxc = NULL; + int error; + ++ REQUEST_SIZE_MATCH(xGLXWaitXReq); ++ ++ tag = req->contextTag; + if (tag) { + glxc = __glXLookupContextByTag(cl, tag); + if (!glxc) +@@ -802,13 +835,19 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) + { + ClientPtr client = cl->client; + xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; +- GLXContextID source = req->source; +- GLXContextID dest = req->dest; +- GLXContextTag tag = req->contextTag; +- unsigned long mask = req->mask; ++ GLXContextID source; ++ GLXContextID dest; ++ GLXContextTag tag; ++ unsigned long mask; + __GLXcontext *src, *dst; + int error; + ++ REQUEST_SIZE_MATCH(xGLXCopyContextReq); ++ ++ source = req->source; ++ dest = req->dest; ++ tag = req->contextTag; ++ mask = req->mask; + if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error)) + return error; + if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error)) +@@ -891,6 +930,8 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq); ++ + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) + return err; + +@@ -1070,13 +1111,18 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen) + + int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; ++ REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq); + return DoGetFBConfigs(cl, req->screen); + } + + int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; ++ /* work around mesa bug, don't use REQUEST_SIZE_MATCH */ ++ REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq); + return DoGetFBConfigs(cl, req->screen); + } + +@@ -1202,11 +1248,14 @@ determineTextureTarget(ClientPtr client, XID glxDrawableID, + + int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + __GLXconfig *config; + __GLXscreen *pGlxScreen; + int err; + ++ REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq); ++ + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) + return err; + if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err)) +@@ -1218,11 +1267,19 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + __GLXconfig *config; + __GLXscreen *pGlxScreen; + int err; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq); ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3); ++ + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) + return err; + if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) +@@ -1241,12 +1298,15 @@ int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + __GLXconfig *config; + __GLXscreen *pGlxScreen; + int err; + ++ REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq); ++ + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) + return err; + if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) +@@ -1273,15 +1333,23 @@ static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type) + + int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq); ++ + return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP); + } + + int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc; + ++ /* should be REQUEST_SIZE_MATCH, but mesa's glXDestroyPixmap used to set ++ * length to 3 instead of 2 */ ++ REQUEST_AT_LEAST_SIZE(xGLXDestroyPixmapReq); ++ + return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP); + } + +@@ -1310,10 +1378,18 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, + + int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; + CARD32 *attrs; + int width, height, i; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq); ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3); ++ + attrs = (CARD32 *) (req + 1); + width = 0; + height = 0; +@@ -1339,23 +1415,32 @@ int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq); ++ + return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, + req->width, req->height, req->pbuffer); + } + + int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq); ++ + return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER); + } + + int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq); ++ + return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER); + } + +@@ -1386,18 +1471,40 @@ DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable, + + int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXChangeDrawableAttributesReq *req = + (xGLXChangeDrawableAttributesReq *) pc; + ++ REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq); ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++#if 0 ++ /* mesa sends an additional 8 bytes */ ++ REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3); ++#else ++ if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len) ++ return BadLength; ++#endif ++ + return DoChangeDrawableAttributes(cl->client, req->drawable, + req->numAttribs, (CARD32 *) (req + 1)); + } + + int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXChangeDrawableAttributesSGIXReq *req = + (xGLXChangeDrawableAttributesSGIXReq *)pc; + ++ REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq); ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3); ++ + return DoChangeDrawableAttributes(cl->client, req->drawable, + req->numAttribs, (CARD32 *) (req + 1)); + } +@@ -1411,6 +1518,15 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) + DrawablePtr pDraw; + int err; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq); ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3); ++ ++ LEGAL_NEW_RESOURCE(req->glxwindow, client); ++ + if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) + return err; + if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err)) +@@ -1431,8 +1547,12 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; + ++ /* mesa's glXDestroyWindow used to set length to 3 instead of 2 */ ++ REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq); ++ + return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW); + } + +@@ -1448,12 +1568,16 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc) + { + ClientPtr client = cl->client; + xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; +- GLXContextTag tag = req->contextTag; +- XID drawId = req->drawable; ++ GLXContextTag tag; ++ XID drawId; + __GLXcontext *glxc = NULL; + __GLXdrawable *pGlxDraw; + int error; + ++ REQUEST_SIZE_MATCH(xGLXSwapBuffersReq); ++ ++ tag = req->contextTag; ++ drawId = req->drawable; + if (tag) { + glxc = __glXLookupContextByTag(cl, tag); + if (!glxc) { +@@ -1534,15 +1658,21 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId) + + int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq); ++ + return DoQueryContext(cl, req->context); + } + + int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; + ++ REQUEST_SIZE_MATCH(xGLXQueryContextReq); ++ + return DoQueryContext(cl, req->context); + } + +@@ -1555,11 +1685,21 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) + GLXDrawable drawId; + int buffer; + int error; ++ CARD32 num_attribs; ++ ++ if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len) ++ return BadLength; + + pc += __GLX_VENDPRIV_HDR_SIZE; + + drawId = *((CARD32 *) (pc)); + buffer = *((INT32 *) (pc + 4)); ++ num_attribs = *((CARD32 *) (pc + 8)); ++ if (num_attribs > (UINT32_MAX >> 3)) { ++ client->errorValue = num_attribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 12 + (num_attribs << 3)); + + if (buffer != GLX_FRONT_LEFT_EXT) + return __glXError(GLXBadPixmap); +@@ -1590,6 +1730,8 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) + int buffer; + int error; + ++ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); ++ + pc += __GLX_VENDPRIV_HDR_SIZE; + + drawId = *((CARD32 *) (pc)); +@@ -1625,6 +1767,8 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) + (void) client; + (void) req; + ++ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20); ++ + pc += __GLX_VENDPRIV_HDR_SIZE; + + drawId = *((CARD32 *) (pc)); +@@ -1713,16 +1857,23 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId) + + int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; + ++ /* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */ ++ REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq); ++ + return DoGetDrawableAttributes(cl, req->drawable); + } + + int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetDrawableAttributesSGIXReq *req = + (xGLXGetDrawableAttributesSGIXReq *)pc; + ++ REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq); ++ + return DoGetDrawableAttributes(cl, req->drawable); + } + +@@ -1747,6 +1898,8 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc) + __GLXcontext *glxc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXRenderReq); ++ + req = (xGLXRenderReq *) pc; + if (client->swapped) { + __GLX_SWAP_SHORT(&req->length); +@@ -1767,6 +1920,9 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc) + __GLXdispatchRenderProcPtr proc; + int err; + ++ if (left < sizeof(__GLXrenderHeader)) ++ return BadLength; ++ + /* + ** Verify that the header length and the overall length agree. + ** Also, each command must be word aligned. +@@ -2277,10 +2433,12 @@ int __glXDisp_HyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; + GLint vendorcode = req->vendorCode; + __GLXdispatchVendorPrivProcPtr proc; + ++ REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); + + proc = (__GLXdispatchVendorPrivProcPtr) + __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info, +@@ -2296,10 +2454,12 @@ int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; + GLint vendorcode = req->vendorCode; + __GLXdispatchVendorPrivProcPtr proc; + ++ REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); + + proc = (__GLXdispatchVendorPrivProcPtr) + __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info, +@@ -2322,6 +2482,8 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc) + char *buf; + int err; + ++ REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq); ++ + if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) + return err; + +@@ -2361,6 +2523,8 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) + int err; + char ver_str[16]; + ++ REQUEST_SIZE_MATCH(xGLXQueryServerStringReq); ++ + if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) + return err; + +@@ -2408,15 +2572,20 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) + + int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; + const char *buf; + ++ REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); ++ ++ buf = (const char *)(req+1); ++ if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq))) ++ return BadLength; ++ + cl->GLClientmajorVersion = req->major; + cl->GLClientminorVersion = req->minor; +- if (cl->GLClientextensions) +- xfree(cl->GLClientextensions); +- buf = (const char *)(req+1); +- cl->GLClientextensions = xstrdup(buf); ++ free(cl->GLClientextensions); ++ cl->GLClientextensions = strdup(buf); + + return Success; + } +diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c +index c414dc8..5947e64 100644 +--- a/glx/glxcmdsswap.c ++++ b/glx/glxcmdsswap.c +@@ -61,9 +61,12 @@ + + int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXCreateContextReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->visual); +@@ -75,9 +78,12 @@ int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXCreateNewContextReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); +@@ -90,10 +96,13 @@ int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); +@@ -106,9 +115,12 @@ int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXDestroyContextReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + +@@ -117,9 +129,12 @@ int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXMakeCurrentReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->context); +@@ -130,9 +145,12 @@ int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readdrawable); +@@ -144,9 +162,12 @@ int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readable); +@@ -158,9 +179,12 @@ int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXIsDirectReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + +@@ -169,9 +193,12 @@ int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXQueryVersionReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->majorVersion); + __GLX_SWAP_INT(&req->minorVersion); +@@ -181,9 +208,12 @@ int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXWaitGLReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + +@@ -192,9 +222,12 @@ int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXWaitXReq *req = (xGLXWaitXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXWaitXReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + +@@ -203,9 +236,12 @@ int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXCopyContextReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->source); + __GLX_SWAP_INT(&req->dest); +@@ -216,36 +252,48 @@ int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq); ++ + __GLX_SWAP_INT(&req->screen); + return __glXDisp_GetVisualConfigs(cl, pc); + } + + int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq); ++ + __GLX_SWAP_INT(&req->screen); + return __glXDisp_GetFBConfigs(cl, pc); + } + + int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq); ++ + __GLX_SWAP_INT(&req->screen); + return __glXDisp_GetFBConfigsSGIX(cl, pc); + } + + int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->visual); +@@ -257,29 +305,41 @@ int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + CARD32 *attribs; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + __GLX_SWAP_INT(&req->numAttribs); ++ ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3); + attribs = (CARD32*)(req + 1); +- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); ++ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); + + return __glXDisp_CreatePixmap(cl, pc); + } + + int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); +@@ -291,9 +351,12 @@ int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc + + int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->glxpixmap); + +@@ -302,9 +365,12 @@ int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->glxpixmap); + +@@ -313,9 +379,12 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXQueryContextReq); ++ + __GLX_SWAP_INT(&req->context); + + return __glXDisp_QueryContext(cl, pc); +@@ -323,26 +392,38 @@ int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + CARD32 *attribs; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq); ++ + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pbuffer); + __GLX_SWAP_INT(&req->numAttribs); ++ ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3); + attribs = (CARD32*)(req + 1); +- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); ++ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); + + return __glXDisp_CreatePbuffer(cl, pc); + } + + int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq); ++ + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pbuffer); +@@ -354,9 +435,12 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq); ++ + __GLX_SWAP_INT(&req->pbuffer); + + return __glXDisp_DestroyPbuffer(cl, pc); +@@ -364,9 +448,12 @@ int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq); ++ + __GLX_SWAP_INT(&req->pbuffer); + + return __glXDisp_DestroyGLXPbufferSGIX(cl, pc); +@@ -374,16 +461,27 @@ int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXChangeDrawableAttributesReq *req = + (xGLXChangeDrawableAttributesReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + CARD32 *attribs; + ++ REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq); ++ + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->numAttribs); ++ ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len) ++ return BadLength; ++ + attribs = (CARD32*)(req + 1); +- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); ++ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); + + return __glXDisp_ChangeDrawableAttributes(cl, pc); + } +@@ -391,43 +489,64 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) + int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl, + GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXChangeDrawableAttributesSGIXReq *req = + (xGLXChangeDrawableAttributesSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + CARD32 *attribs; + ++ REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq); ++ + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->numAttribs); ++ ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3); + attribs = (CARD32*)(req + 1); +- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); ++ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); + + return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc); + } + + int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + CARD32 *attribs; + ++ REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq); ++ + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->window); + __GLX_SWAP_INT(&req->glxwindow); + __GLX_SWAP_INT(&req->numAttribs); ++ ++ if (req->numAttribs > (UINT32_MAX >> 3)) { ++ client->errorValue = req->numAttribs; ++ return BadValue; ++ } ++ REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3); + attribs = (CARD32*)(req + 1); +- __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); ++ __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); + + return __glXDisp_CreateWindow(cl, pc); + } + + int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq); ++ + __GLX_SWAP_INT(&req->glxwindow); + + return __glXDisp_DestroyWindow(cl, pc); +@@ -435,9 +554,12 @@ int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXSwapBuffersReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->drawable); +@@ -447,9 +569,12 @@ int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXUseXFontReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->font); +@@ -463,9 +588,12 @@ int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + +@@ -474,9 +602,12 @@ int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXQueryServerStringReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->name); +@@ -486,9 +617,12 @@ int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->major); + __GLX_SWAP_INT(&req->minor); +@@ -499,9 +633,12 @@ int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + +@@ -510,33 +647,41 @@ int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; + GLXDrawable *drawId; + int *buffer; +- ++ CARD32 *num_attribs; + __GLX_DECLARE_SWAP_VARIABLES; + ++ if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len) ++ return BadLength; ++ + pc += __GLX_VENDPRIV_HDR_SIZE; + + drawId = ((GLXDrawable *) (pc)); + buffer = ((int *) (pc + 4)); ++ num_attribs = ((CARD32 *) (pc + 8)); + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(drawId); + __GLX_SWAP_INT(buffer); ++ __GLX_SWAP_INT(num_attribs); + + return __glXDisp_BindTexImageEXT(cl, (GLbyte *)pc); + } + + int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; + GLXDrawable *drawId; + int *buffer; +- + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); ++ + pc += __GLX_VENDPRIV_HDR_SIZE; + + drawId = ((GLXDrawable *) (pc)); +@@ -552,12 +697,14 @@ int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; + GLXDrawable *drawId; + int *buffer; +- + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20); ++ + (void) drawId; + (void) buffer; + +@@ -577,11 +724,13 @@ int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc; + CARD32 *data; +- + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq); ++ + data = (CARD32 *) (req + 1); + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); +@@ -592,10 +741,12 @@ int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) + + int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) + { ++ ClientPtr client = cl->client; + xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; +- + __GLX_DECLARE_SWAP_VARIABLES; + ++ REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq); ++ + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + +diff --git a/glx/xfont.c b/glx/xfont.c +index b8b466d..5d5b4c3 100644 +--- a/glx/xfont.c ++++ b/glx/xfont.c +@@ -160,6 +160,8 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc) + __GLXcontext *cx; + int error; + ++ REQUEST_SIZE_MATCH(xGLXUseXFontReq); ++ + req = (xGLXUseXFontReq *) pc; + cx = __glXForceCurrent(cl, req->contextTag, &error); + if (!cx) { +diff --git a/render/render.c b/render/render.c +index 3f7edf7..b78c75b 100644 +--- a/render/render.c ++++ b/render/render.c +@@ -1085,6 +1085,14 @@ ProcRenderAddGlyphs (ClientPtr client) + gi = (xGlyphInfo *) (gids + nglyphs); + bits = (CARD8 *) (gi + nglyphs); + remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs; ++ ++ /* protect against bad nglyphs */ ++ if (gi < stuff || gi > ((CARD32 *)stuff + client->req_len) || ++ bits < stuff || bits > ((CARD32 *)stuff + client->req_len)) { ++ err = BadLength; ++ goto bail; ++ } ++ + for (i = 0; i < nglyphs; i++) + { + size_t padded_width; +-- +1.7.6 + diff --git a/contrib/packages/rpm/el5/SOURCES/dont-forward-keycode-0.patch b/contrib/packages/rpm/el5/SOURCES/dont-forward-keycode-0.patch new file mode 100644 index 00000000..36d38b29 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/dont-forward-keycode-0.patch @@ -0,0 +1,51 @@ +--- libX11-1.0.3/modules/im/ximcp/imDefLkup.c.dont-forward-keycode-0 2006-06-22 17:22:22.000000000 -0400 ++++ libX11-1.0.3/modules/im/ximcp/imDefLkup.c 2006-09-20 17:57:49.000000000 -0400 +@@ -332,6 +332,17 @@ + XEvent *ev, + Bool sync) + { ++ /* ++ * Don't forward a key event which has keycode=0. ++ * keycode=0 is reserved for special purpose to let Xmb/wcLookupString() ++ * functions know that there is a commited string available from IM. ++ */ ++ if (((ev->type == KeyPress) || (ev->type == KeyRelease))) { ++ if (((XKeyEvent *)ev)->keycode == 0) { ++ return True; ++ } ++ } ++ + #ifdef EXT_FORWARD + if (((ev->type == KeyPress) || (ev->type == KeyRelease))) + if (_XimExtForwardKeyEvent(ic, (XKeyEvent *)ev, sync)) +@@ -605,6 +616,19 @@ + Xfree(info->keysym); + ic->private.proto.commit_info = info->next; + Xfree(info); ++ ++ /* ++ * "Commit" uses fabricated flag to process a commited string ++ * from IM engine. ++ * Turn off the fabricated flag here (unregister the commited ++ * information function). Otherwise, next regular key press ++ * event will be ignored at _XimProtoKeypressFilter() and it ++ * will not be passed to IM engine. ++ */ ++ if (IS_FABLICATED(ic)) { ++ UNMARK_FABLICATED(ic); ++ } ++ + return; + } + +--- libX11-1.0.3/modules/im/ximcp/imDefFlt.c.dont-forward-keycode-0 2006-06-22 17:22:22.000000000 -0400 ++++ libX11-1.0.3/modules/im/ximcp/imDefFlt.c 2006-09-20 17:57:49.000000000 -0400 +@@ -147,7 +147,7 @@ + Xim im = (Xim)ic->core.im; + #endif + +- if (IS_FABLICATED(ic)) { ++ if ((ev->keycode == 0) || IS_FABLICATED(ic)) { + _XimPendingFilter(ic); + UNMARK_FABLICATED(ic); + return NOTFILTERD; diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-clipboard.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-clipboard.patch new file mode 100644 index 00000000..3f12bc53 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-clipboard.patch @@ -0,0 +1,106 @@ +diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H +--- fltk-1.3.x-r8659/FL/Fl.H.orig 2011-05-17 16:25:56.671744548 +0200 ++++ fltk-1.3.x-r8659/FL/Fl.H 2011-05-17 16:26:05.709101536 +0200 +@@ -108,6 +108,9 @@ typedef int (*Fl_Args_Handler)(int argc, + \see Fl::event_dispatch(Fl_Event_Dispatch) */ + typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w); + ++/** Signature of add_clipboard_notify functions passed as parameters */ ++typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data); ++ + /** @} */ /* group callback_functions */ + + +@@ -744,6 +747,19 @@ public: + */ + static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent + /** ++ FLTK will call the registered callback whenever there is a change to the ++ selection buffer or the clipboard. The source argument indicates which ++ of the two has changed. Only changes by other applications are reported. ++ \note Some systems require polling to monitor the clipboard and may ++ therefore have some delay in detecting changes. ++ */ ++ static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data); ++ /** ++ Stop calling the specified callback when there are changes to the selection ++ buffer or the clipboard. ++ */ ++ static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h); ++ /** + Initiate a Drag And Drop operation. The selection buffer should be + filled with relevant data before calling this method. FLTK will + then initiate the system wide drag and drop handling. Dropped data +diff -up fltk-1.3.x-r8659/src/Fl.cxx.orig fltk-1.3.x-r8659/src/Fl.cxx +--- fltk-1.3.x-r8659/src/Fl.cxx.orig 2011-05-18 15:20:26.667291459 +0200 ++++ fltk-1.3.x-r8659/src/Fl.cxx 2011-05-18 16:31:15.522026086 +0200 +@@ -430,6 +430,69 @@ static char in_idle; + #endif + + //////////////////////////////////////////////////////////////// ++// Clipboard notifications ++ ++struct Clipboard_Notify { ++ Fl_Clipboard_Notify_Handler handler; ++ void *data; ++ struct Clipboard_Notify *next; ++}; ++ ++static struct Clipboard_Notify *clip_notify_list = NULL; ++ ++extern void fl_clipboard_notify_change(); // in Fl_.cxx ++ ++void Fl::add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data) { ++ struct Clipboard_Notify *node; ++ ++ remove_clipboard_notify(h); ++ ++ node = new Clipboard_Notify; ++ ++ node->handler = h; ++ node->data = data; ++ node->next = clip_notify_list; ++ ++ clip_notify_list = node; ++ ++ fl_clipboard_notify_change(); ++} ++ ++void Fl::remove_clipboard_notify(Fl_Clipboard_Notify_Handler h) { ++ struct Clipboard_Notify *node, **prev; ++ ++ node = clip_notify_list; ++ prev = &clip_notify_list; ++ while (node != NULL) { ++ if (node->handler == h) { ++ *prev = node->next; ++ delete node; ++ ++ fl_clipboard_notify_change(); ++ ++ return; ++ } ++ ++ prev = &node->next; ++ node = node->next; ++ } ++} ++ ++bool fl_clipboard_notify_empty(void) { ++ return clip_notify_list == NULL; ++} ++ ++void fl_trigger_clipboard_notify(int source) { ++ struct Clipboard_Notify *node; ++ ++ node = clip_notify_list; ++ while (node != NULL) { ++ node->handler(source, node->data); ++ node = node->next; ++ } ++} ++ ++//////////////////////////////////////////////////////////////// + // wait/run/check/ready: + + void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-screen_num.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-screen_num.patch new file mode 100644 index 00000000..c157af61 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1.3.x-screen_num.patch @@ -0,0 +1,131 @@ +diff -up fltk-1.3.0r9619/FL/Fl.H.screen_num fltk-1.3.0r9619/FL/Fl.H +--- fltk-1.3.0r9619/FL/Fl.H.screen_num 2012-07-03 13:49:28.663085580 +0200 ++++ fltk-1.3.0r9619/FL/Fl.H 2012-07-03 13:49:28.731084402 +0200 +@@ -806,6 +806,8 @@ public: + static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my); + static void screen_xywh(int &X, int &Y, int &W, int &H, int n); + static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh); ++ static int screen_num(int x, int y); ++ static int screen_num(int x, int y, int w, int h); + static void screen_dpi(float &h, float &v, int n=0); + static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my); + static void screen_work_area(int &X, int &Y, int &W, int &H, int n); +diff -up fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num fltk-1.3.0r9619/src/screen_xywh.cxx +--- fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.0r9619/src/screen_xywh.cxx 2012-07-03 13:58:01.947195396 +0200 +@@ -215,21 +215,6 @@ int Fl::screen_count() { + return num_screens ? num_screens : 1; + } + +-static int find_screen_with_point(int mx, int my) { +- int screen = 0; +- if (num_screens < 0) screen_init(); +- +- for (int i = 0; i < num_screens; i ++) { +- int sx, sy, sw, sh; +- Fl::screen_xywh(sx, sy, sw, sh, i); +- if ((mx >= sx) && (mx < (sx+sw)) && (my >= sy) && (my < (sy+sh))) { +- screen = i; +- break; +- } +- } +- return screen; +-} +- + /** + Gets the bounding box of a screen + that contains the specified screen position \p mx, \p my +@@ -237,7 +222,7 @@ static int find_screen_with_point(int mx + \param[in] mx, my the absolute screen position + */ + void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) { +- screen_xywh(X, Y, W, H, find_screen_with_point(mx, my)); ++ screen_xywh(X, Y, W, H, screen_num(mx, my)); + } + + +@@ -248,7 +233,7 @@ void Fl::screen_xywh(int &X, int &Y, int + \param[in] mx, my the absolute screen position + */ + void Fl::screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my) { +- screen_work_area(X, Y, W, H, find_screen_with_point(mx, my)); ++ screen_work_area(X, Y, W, H, screen_num(mx, my)); + } + + /** +@@ -321,6 +306,38 @@ void Fl::screen_xywh(int &X, int &Y, int + #endif // WIN32 + } + ++/** ++ Gets the screen bounding rect for the screen ++ which intersects the most with the rectangle ++ defined by \p mx, \p my, \p mw, \p mh. ++ \param[out] X,Y,W,H the corresponding screen bounding box ++ \param[in] mx, my, mw, mh the rectangle to search for intersection with ++ \see void screen_xywh(int &X, int &Y, int &W, int &H, int n) ++ */ ++void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) { ++ screen_xywh(X, Y, W, H, screen_num(mx, my, mw, mh)); ++} ++ ++/** ++ Gets the screen number of a screen ++ that contains the specified screen position \p x, \p y ++ \param[in] x, y the absolute screen position ++*/ ++int Fl::screen_num(int x, int y) { ++ int screen = 0; ++ if (num_screens < 0) screen_init(); ++ ++ for (int i = 0; i < num_screens; i ++) { ++ int sx, sy, sw, sh; ++ Fl::screen_xywh(sx, sy, sw, sh, i); ++ if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) { ++ screen = i; ++ break; ++ } ++ } ++ return screen; ++} ++ + static inline float fl_intersection(int x1, int y1, int w1, int h1, + int x2, int y2, int w2, int h2) { + if(x1+w1 < x2 || x2+w2 < x1 || y1+h1 < y2 || y2+h2 < y1) +@@ -333,30 +350,27 @@ static inline float fl_intersection(int + } + + /** +- Gets the screen bounding rect for the screen ++ Gets the screen number for the screen + which intersects the most with the rectangle +- defined by \p mx, \p my, \p mw, \p mh. +- \param[out] X,Y,W,H the corresponding screen bounding box +- \param[in] mx, my, mw, mh the rectangle to search for intersection with +- \see void screen_xywh(int &X, int &Y, int &W, int &H, int n) ++ defined by \p x, \p y, \p w, \p h. ++ \param[in] x, y, w, h the rectangle to search for intersection with + */ +-void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) { ++int Fl::screen_num(int x, int y, int w, int h) { + int best_screen = 0; + float best_intersection = 0.; + for(int i = 0; i < Fl::screen_count(); i++) { + int sx, sy, sw, sh; + Fl::screen_xywh(sx, sy, sw, sh, i); +- float sintersection = fl_intersection(mx, my, mw, mh, sx, sy, sw, sh); ++ float sintersection = fl_intersection(x, y, w, h, sx, sy, sw, sh); + if(sintersection > best_intersection) { + best_screen = i; + best_intersection = sintersection; + } + } +- screen_xywh(X, Y, W, H, best_screen); ++ return best_screen; + } + + +- + /** + Gets the screen resolution in dots-per-inch for the given screen. + \param[out] h, v horizontal and vertical resolution diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.0-modal.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.0-modal.patch new file mode 100644 index 00000000..7b1b7913 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.0-modal.patch @@ -0,0 +1,75 @@ +diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm +--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-19 12:54:43.694231638 +0200 ++++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-19 12:57:05.899048602 +0200 +@@ -697,12 +697,9 @@ + return NO; // prevent the caption to be redrawn as active on click + // when another modal window is currently the key win + +- return !(w->tooltip_window() || w->menu_window()); ++ return !w->tooltip_window(); + } + +-// TODO see if we really need a canBecomeMainWindow ... +-#if 0 +- + - (BOOL)canBecomeMainWindow + { + if (Fl::modal_ && (Fl::modal_ != w)) +@@ -711,7 +708,6 @@ + + return !(w->tooltip_window() || w->menu_window()); + } +-#endif + + @end + +diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx +--- fltk-1.3.0r9619.org/src/Fl_win32.cxx 2012-06-19 12:54:43.696231735 +0200 ++++ fltk-1.3.0r9619/src/Fl_win32.cxx 2012-06-19 12:54:43.803236862 +0200 +@@ -1065,6 +1065,10 @@ + break; + + case WM_SETFOCUS: ++ if ((Fl::modal_) && (Fl::modal_ != window)) { ++ SetFocus(fl_xid(Fl::modal_)); ++ return 0; ++ } + Fl::handle(FL_FOCUS, window); + break; + +@@ -1826,6 +1830,11 @@ + Fl::e_number = old_event; + w->redraw(); // force draw to happen + } ++ ++ // Needs to be done before ShowWindow() to get the correct behaviour ++ // when we get WM_SETFOCUS. ++ if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} ++ + // If we've captured the mouse, we dont want to activate any + // other windows from the code, or we lose the capture. + ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE : +@@ -1843,7 +1852,6 @@ + } + } + +- if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} + return x; + } + +diff -bur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx +--- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-19 12:54:43.697231783 +0200 ++++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-19 12:54:43.804236911 +0200 +@@ -2101,6 +2101,12 @@ + while (wp->parent()) wp = wp->window(); + XSetTransientForHint(fl_display, xp->xid, fl_xid(wp)); + if (!wp->visible()) showit = 0; // guess that wm will not show it ++ if (win->modal()) { ++ Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0); ++ Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_MODAL", 0); ++ XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32, ++ PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1); ++ } + } + + // Make sure that borderless windows do not show in the task bar diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch new file mode 100644 index 00000000..22e69396 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch @@ -0,0 +1,44 @@ +diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm +--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-18 19:24:30.971688769 +0200 ++++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-18 19:25:25.700310375 +0200 +@@ -1319,9 +1319,13 @@ + } + @end + ++static void clipboard_check(void); ++ + @implementation FLApplication + + (void)sendEvent:(NSEvent *)theEvent + { ++ // update clipboard status ++ clipboard_check(); + NSEventType type = [theEvent type]; + if (type == NSLeftMouseDown) { + fl_lock_function(); +@@ -2790,6 +2794,26 @@ + PasteboardCreate(kPasteboardClipboard, &myPasteboard); + } + ++extern void fl_trigger_clipboard_notify(int source); ++ ++void fl_clipboard_notify_change() { ++ // No need to do anything here... ++} ++ ++static void clipboard_check(void) ++{ ++ PasteboardSyncFlags flags; ++ ++ allocatePasteboard(); ++ flags = PasteboardSynchronize(myPasteboard); ++ ++ if (!(flags & kPasteboardModified)) ++ return; ++ if (flags & kPasteboardClientIsOwner) ++ return; ++ ++ fl_trigger_clipboard_notify(1); ++} + + /* + * create a selection diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch new file mode 100644 index 00000000..ac94779c --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch @@ -0,0 +1,99 @@ +diff -ur fltk-1.3.0r9110.org/src/Fl.cxx fltk-1.3.0r9110/src/Fl.cxx +--- fltk-1.3.0r9110.org/src/Fl.cxx 2012-06-17 19:47:09.988183253 +0200 ++++ fltk-1.3.0r9110/src/Fl.cxx 2012-06-17 19:47:10.127189919 +0200 +@@ -1421,6 +1421,7 @@ + // hide() destroys the X window, it does not do unmap! + + #if defined(WIN32) ++extern void fl_clipboard_notify_untarget(HWND wnd); + extern void fl_update_clipboard(void); + #elif USE_XFT + extern void fl_destroy_xft_draw(Window); +@@ -1471,6 +1472,8 @@ + // to destroy the window that owns the selection. + if (GetClipboardOwner()==ip->xid) + fl_update_clipboard(); ++ // Make sure we unlink this window from the clipboard chain ++ fl_clipboard_notify_untarget(ip->xid); + // Send a message to myself so that I'll get out of the event loop... + PostMessage(ip->xid, WM_APP, 0, 0); + if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc); +diff -ur fltk-1.3.0r9110.org/src/Fl_win32.cxx fltk-1.3.0r9110/src/Fl_win32.cxx +--- fltk-1.3.0r9110.org/src/Fl_win32.cxx 2012-06-17 19:47:09.987183205 +0200 ++++ fltk-1.3.0r9110/src/Fl_win32.cxx 2012-06-17 19:47:19.069618739 +0200 +@@ -646,6 +646,38 @@ + } + } + ++static HWND clipboard_wnd = 0; ++static HWND next_clipboard_wnd = 0; ++ ++static bool initial_clipboard = true; ++ ++void fl_clipboard_notify_change() { ++ // No need to do anything here... ++} ++ ++void fl_clipboard_notify_target(HWND wnd) { ++ if (clipboard_wnd) ++ return; ++ ++ // We get one fake WM_DRAWCLIPBOARD immediately, which we therefore ++ // need to ignore. ++ initial_clipboard = true; ++ ++ clipboard_wnd = wnd; ++ next_clipboard_wnd = SetClipboardViewer(wnd); ++} ++ ++void fl_clipboard_notify_untarget(HWND wnd) { ++ if (wnd != clipboard_wnd) ++ return; ++ ++ ChangeClipboardChain(wnd, next_clipboard_wnd); ++ clipboard_wnd = next_clipboard_wnd = 0; ++ ++ if (Fl::first_window()) ++ fl_clipboard_notify_target(fl_xid(Fl::first_window())); ++} ++ + //////////////////////////////////////////////////////////////// + char fl_is_ime = 0; + void fl_get_codepage() +@@ -1327,6 +1359,27 @@ + Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); + return 0; + ++ case WM_CHANGECBCHAIN: ++ if ((hWnd == clipboard_wnd) && ++ (next_clipboard_wnd == (HWND)wParam)) { ++ next_clipboard_wnd = (HWND)lParam; ++ return 0; ++ } ++ break; ++ ++ case WM_DRAWCLIPBOARD: ++ // When the clipboard moves between two FLTK windows, ++ // fl_i_own_selection will temporarily be false as we are ++ // processing this message. Hence the need to use fl_find(). ++ if (!initial_clipboard && !fl_find(GetClipboardOwner())) ++ fl_trigger_clipboard_notify(1); ++ initial_clipboard = false; ++ ++ if (next_clipboard_wnd) ++ SendMessage(next_clipboard_wnd, WM_DRAWCLIPBOARD, wParam, lParam); ++ ++ return 0; ++ + default: + if (Fl::handle(0,0)) return 0; + break; +@@ -1685,6 +1738,8 @@ + x->next = Fl_X::first; + Fl_X::first = x; + ++ fl_clipboard_notify_target(x->xid); ++ + x->wait_for_expose = 1; + if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;} + if (showit) { diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.0-icons.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.0-icons.patch new file mode 100644 index 00000000..20b30b8b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.0-icons.patch @@ -0,0 +1,645 @@ +diff -ur fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H +--- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:49:55.554353925 +0100 +@@ -22,6 +22,10 @@ + #ifndef Fl_Window_H + #define Fl_Window_H + ++#ifdef WIN32 ++#include ++#endif ++ + #include "Fl_Group.H" + + #define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this +@@ -73,9 +77,19 @@ + friend class Fl_X; + Fl_X *i; // points at the system-specific stuff + ++ struct icon_data { ++ const void *legacy_icon; ++ Fl_RGB_Image **icons; ++ int count; ++#ifdef WIN32 ++ HICON big_icon; ++ HICON small_icon; ++#endif ++ }; ++ + const char* iconlabel_; + char* xclass_; +- const void* icon_; ++ struct icon_data *icon_; + // size_range stuff: + int minw, minh, maxw, maxh; + int dw, dh, aspect; +@@ -121,6 +135,8 @@ + */ + int force_position() const { return ((flags() & FORCE_POSITION)?1:0); } + ++ void free_icons(); ++ + public: + + /** +@@ -350,6 +366,18 @@ + static const char *default_xclass(); + const char* xclass() const; + void xclass(const char* c); ++ ++ static void default_icon(const Fl_RGB_Image*); ++ static void default_icons(const Fl_RGB_Image*[], int); ++ void icon(const Fl_RGB_Image*); ++ void icons(const Fl_RGB_Image*[], int); ++ ++#ifdef WIN32 ++ static void default_icons(HICON big_icon, HICON small_icon); ++ void icons(HICON big_icon, HICON small_icon); ++#endif ++ ++ /* for legacy compatibility */ + const void* icon() const; + void icon(const void * ic); + +diff -ur fltk-1.3.2.org/FL/mac.H fltk-1.3.2/FL/mac.H +--- fltk-1.3.2.org/FL/mac.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/mac.H 2013-01-16 10:49:55.554353925 +0100 +@@ -120,6 +120,9 @@ + void collapse(void); + WindowRef window_ref(void); + void set_key_window(void); ++ // OS X doesn't have per window icons ++ static void set_default_icons(const Fl_RGB_Image*[], int) {}; ++ void set_icons() {}; + int set_cursor(Fl_Cursor); + int set_cursor(const Fl_RGB_Image*, int, int); + static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); +diff -ur fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H +--- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/win32.H 2013-01-16 10:49:55.555355617 +0100 +@@ -84,6 +84,9 @@ + void flush() {w->flush();} + void set_minmax(LPMINMAXINFO minmax); + void mapraise(); ++ static void set_default_icons(const Fl_RGB_Image*[], int); ++ static void set_default_icons(HICON, HICON); ++ void set_icons(); + int set_cursor(Fl_Cursor); + int set_cursor(const Fl_RGB_Image*, int, int); + static Fl_X* make(Fl_Window*); +diff -ur fltk-1.3.2.org/FL/x.H fltk-1.3.2/FL/x.H +--- fltk-1.3.2.org/FL/x.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/x.H 2013-01-16 10:49:55.555355617 +0100 +@@ -154,6 +154,8 @@ + static Fl_X* i(const Fl_Window* wi) {return wi->i;} + void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} + void sendxjunk(); ++ static void set_default_icons(const Fl_RGB_Image*[], int); ++ void set_icons(); + int set_cursor(Fl_Cursor); + int set_cursor(const Fl_RGB_Image*, int, int); + static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); +diff -ur fltk-1.3.2.org/src/Fl.cxx fltk-1.3.2/src/Fl.cxx +--- fltk-1.3.2.org/src/Fl.cxx 2013-01-16 10:49:40.895228113 +0100 ++++ fltk-1.3.2/src/Fl.cxx 2013-01-16 10:49:55.556137979 +0100 +@@ -1530,6 +1530,8 @@ + if (xclass_) { + free(xclass_); + } ++ free_icons(); ++ delete icon_; + } + + // FL_SHOW and FL_HIDE are called whenever the visibility of this widget +diff -ur fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx +--- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:49:40.911227539 +0100 ++++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:49:55.556137979 +0100 +@@ -1804,6 +1804,8 @@ + ); + if (lab) free(lab); + ++ x->set_icons(); ++ + if (w->fullscreen_active()) { + /* We need to make sure that the fullscreen is created on the + default monitor, ie the desktop where the shortcut is located +@@ -2034,71 +2036,19 @@ + + //////////////////////////////////////////////////////////////// + +-#ifndef IDC_HAND +-# define IDC_HAND MAKEINTRESOURCE(32649) +-#endif // !IDC_HAND +- +-int Fl_X::set_cursor(Fl_Cursor c) { +- LPSTR n; +- HCURSOR new_cursor; +- +- if (c == FL_CURSOR_NONE) +- new_cursor = NULL; +- else { +- switch (c) { +- case FL_CURSOR_ARROW: n = IDC_ARROW; break; +- case FL_CURSOR_CROSS: n = IDC_CROSS; break; +- case FL_CURSOR_WAIT: n = IDC_WAIT; break; +- case FL_CURSOR_INSERT: n = IDC_IBEAM; break; +- case FL_CURSOR_HAND: n = IDC_HAND; break; +- case FL_CURSOR_HELP: n = IDC_HELP; break; +- case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; +- case FL_CURSOR_N: +- case FL_CURSOR_S: +- // FIXME: Should probably have fallbacks for these instead +- case FL_CURSOR_NS: n = IDC_SIZENS; break; +- case FL_CURSOR_NE: +- case FL_CURSOR_SW: +- // FIXME: Dito. +- case FL_CURSOR_NESW: n = IDC_SIZENESW; break; +- case FL_CURSOR_E: +- case FL_CURSOR_W: +- // FIXME: Dito. +- case FL_CURSOR_WE: n = IDC_SIZEWE; break; +- case FL_CURSOR_SE: +- case FL_CURSOR_NW: +- // FIXME: Dito. +- case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; +- default: +- return 0; +- } +- +- new_cursor = LoadCursor(NULL, n); +- if (new_cursor == NULL) +- return 0; +- } +- +- if ((cursor != NULL) && custom_cursor) +- DestroyIcon(cursor); +- +- cursor = new_cursor; +- custom_cursor = 0; +- +- SetCursor(cursor); +- +- return 1; +-} +- +-int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon=true, ++ int hotx = 0, int hoty = 0) { + BITMAPV5HEADER bi; + HBITMAP bitmap, mask; + DWORD *bits; +- HCURSOR new_cursor; ++ HICON icon; + ++ if (!is_icon) { + if ((hotx < 0) || (hotx >= image->w())) +- return 0; ++ return NULL; + if ((hoty < 0) || (hoty >= image->h())) +- return 0; ++ return NULL; ++ } + + memset(&bi, 0, sizeof(BITMAPV5HEADER)); + +@@ -2120,7 +2070,7 @@ + ReleaseDC(NULL, hdc); + + if (bits == NULL) +- return 0; ++ return NULL; + + const uchar *i = (const uchar*)*image->data(); + for (int y = 0;y < image->h();y++) { +@@ -2149,22 +2099,206 @@ + mask = CreateBitmap(image->w(),image->h(),1,1,NULL); + if (mask == NULL) { + DeleteObject(bitmap); +- return 0; ++ return NULL; + } + + ICONINFO ii; + +- ii.fIcon = FALSE; ++ ii.fIcon = is_icon; + ii.xHotspot = hotx; + ii.yHotspot = hoty; + ii.hbmMask = mask; + ii.hbmColor = bitmap; + +- new_cursor = CreateIconIndirect(&ii); ++ icon = CreateIconIndirect(&ii); + + DeleteObject(bitmap); + DeleteObject(mask); + ++ if (icon == NULL) ++ return NULL; ++ ++ return icon; ++} ++ ++//////////////////////////////////////////////////////////////// ++ ++static HICON default_big_icon = NULL; ++static HICON default_small_icon = NULL; ++ ++const Fl_RGB_Image *find_best_icon(int ideal_width, ++ const Fl_RGB_Image *icons[], int count) { ++ const Fl_RGB_Image *best; ++ ++ best = NULL; ++ ++ for (int i = 0;i < count;i++) { ++ if (best == NULL) ++ best = icons[i]; ++ else { ++ if (best->w() < ideal_width) { ++ if (icons[i]->w() > best->w()) ++ best = icons[i]; ++ } else { ++ if ((icons[i]->w() >= ideal_width) && ++ (icons[i]->w() < best->w())) ++ best = icons[i]; ++ } ++ } ++ } ++ ++ return best; ++} ++ ++void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) { ++ const Fl_RGB_Image *best_big, *best_small; ++ ++ if (default_big_icon != NULL) ++ DestroyIcon(default_big_icon); ++ if (default_small_icon != NULL) ++ DestroyIcon(default_small_icon); ++ ++ best_big = find_best_icon(GetSystemMetrics(SM_CXICON), icons, count); ++ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), icons, count); ++ ++ if (best_big != NULL) ++ default_big_icon = image_to_icon(best_big); ++ else ++ default_big_icon = NULL; ++ ++ if (best_small != NULL) ++ default_small_icon = image_to_icon(best_small); ++ else ++ default_small_icon = NULL; ++} ++ ++void Fl_X::set_default_icons(HICON big_icon, HICON small_icon) { ++ if (default_big_icon != NULL) ++ DestroyIcon(default_big_icon); ++ if (default_small_icon != NULL) ++ DestroyIcon(default_small_icon); ++ ++ if (big_icon != NULL) ++ default_big_icon = CopyIcon(big_icon); ++ if (small_icon != NULL) ++ default_small_icon = CopyIcon(small_icon); ++} ++ ++void Fl_X::set_icons() { ++ HICON big_icon, small_icon; ++ ++ big_icon = NULL; ++ small_icon = NULL; ++ ++ if (w->icon_->count) { ++ const Fl_RGB_Image *best_big, *best_small; ++ ++ best_big = find_best_icon(GetSystemMetrics(SM_CXICON), ++ (const Fl_RGB_Image **)w->icon_->icons, ++ w->icon_->count); ++ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), ++ (const Fl_RGB_Image **)w->icon_->icons, ++ w->icon_->count); ++ ++ if (best_big != NULL) ++ big_icon = image_to_icon(best_big); ++ if (best_small != NULL) ++ small_icon = image_to_icon(best_small); ++ } else { ++ big_icon = default_big_icon; ++ small_icon = default_small_icon; ++ } ++ ++ if (big_icon != NULL) ++ SendMessage(xid, WM_SETICON, ICON_BIG, (LPARAM)big_icon); ++ if (small_icon != NULL) ++ SendMessage(xid, WM_SETICON, ICON_SMALL, (LPARAM)small_icon); ++ ++ if (w->icon_->count) { ++ if (big_icon != NULL) ++ DestroyIcon(big_icon); ++ if (small_icon != NULL) ++ DestroyIcon(small_icon); ++ } ++} ++ ++void Fl_Window::default_icons(HICON big_icon, HICON small_icon) { ++ Fl_X::set_default_icons(big_icon, small_icon); ++} ++ ++void Fl_Window::icons(HICON big_icon, HICON small_icon) { ++ free_icons(); ++ ++ if (big_icon != NULL) ++ icon_->big_icon = CopyIcon(big_icon); ++ if (small_icon != NULL) ++ icon_->small_icon = CopyIcon(small_icon); ++ ++ if (i) ++ i->set_icons(); ++} ++ ++//////////////////////////////////////////////////////////////// ++ ++#ifndef IDC_HAND ++# define IDC_HAND MAKEINTRESOURCE(32649) ++#endif // !IDC_HAND ++ ++int Fl_X::set_cursor(Fl_Cursor c) { ++ LPSTR n; ++ HCURSOR new_cursor; ++ ++ if (c == FL_CURSOR_NONE) ++ new_cursor = NULL; ++ else { ++ switch (c) { ++ case FL_CURSOR_ARROW: n = IDC_ARROW; break; ++ case FL_CURSOR_CROSS: n = IDC_CROSS; break; ++ case FL_CURSOR_WAIT: n = IDC_WAIT; break; ++ case FL_CURSOR_INSERT: n = IDC_IBEAM; break; ++ case FL_CURSOR_HAND: n = IDC_HAND; break; ++ case FL_CURSOR_HELP: n = IDC_HELP; break; ++ case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; ++ case FL_CURSOR_N: ++ case FL_CURSOR_S: ++ // FIXME: Should probably have fallbacks for these instead ++ case FL_CURSOR_NS: n = IDC_SIZENS; break; ++ case FL_CURSOR_NE: ++ case FL_CURSOR_SW: ++ // FIXME: Dito. ++ case FL_CURSOR_NESW: n = IDC_SIZENESW; break; ++ case FL_CURSOR_E: ++ case FL_CURSOR_W: ++ // FIXME: Dito. ++ case FL_CURSOR_WE: n = IDC_SIZEWE; break; ++ case FL_CURSOR_SE: ++ case FL_CURSOR_NW: ++ // FIXME: Dito. ++ case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; ++ default: ++ return 0; ++ } ++ ++ new_cursor = LoadCursor(NULL, n); ++ if (new_cursor == NULL) ++ return 0; ++ } ++ ++ if ((cursor != NULL) && custom_cursor) ++ DestroyIcon(cursor); ++ ++ cursor = new_cursor; ++ custom_cursor = 0; ++ ++ SetCursor(cursor); ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ HCURSOR new_cursor; ++ ++ new_cursor = image_to_icon(image, false, hotx, hoty); + if (new_cursor == NULL) + return 0; + +diff -ur fltk-1.3.2.org/src/Fl_Window.cxx fltk-1.3.2/src/Fl_Window.cxx +--- fltk-1.3.2.org/src/Fl_Window.cxx 2013-01-16 10:49:40.908130903 +0100 ++++ fltk-1.3.2/src/Fl_Window.cxx 2013-01-16 10:49:55.557353865 +0100 +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include "flstring.h" +@@ -45,7 +46,8 @@ + } + i = 0; + xclass_ = 0; +- icon_ = 0; ++ icon_ = new icon_data; ++ memset(icon_, 0, sizeof(*icon_)); + iconlabel_ = 0; + resizable(0); + size_range_set = 0; +@@ -264,16 +266,68 @@ + } + } + ++void Fl_Window::default_icon(const Fl_RGB_Image *icon) { ++ default_icons(&icon, 1); ++} ++ ++void Fl_Window::default_icons(const Fl_RGB_Image **icons, int count) { ++ Fl_X::set_default_icons(icons, count); ++} ++ ++void Fl_Window::icon(const Fl_RGB_Image *icon) { ++ icons(&icon, 1); ++} ++ ++void Fl_Window::icons(const Fl_RGB_Image **icons, int count) { ++ free_icons(); ++ ++ if (count > 0) { ++ icon_->icons = new Fl_RGB_Image*[count]; ++ icon_->count = count; ++ // FIXME: Fl_RGB_Image lacks const modifiers on methods ++ for (int i = 0;i < count;i++) ++ icon_->icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])->copy(); ++ } ++ ++ if (i) ++ i->set_icons(); ++} ++ + /** Gets the current icon window target dependent data. */ + const void *Fl_Window::icon() const { +- return icon_; ++ return icon_->legacy_icon; + } + + /** Sets the current icon window target dependent data. */ + void Fl_Window::icon(const void * ic) { +- icon_ = ic; ++ free_icons(); ++ icon_->legacy_icon = ic; + } + ++void Fl_Window::free_icons() { ++ int i; ++ ++ icon_->legacy_icon = 0L; ++ ++ if (icon_->icons) { ++ for (i = 0;i < icon_->count;i++) ++ delete icon_->icons[i]; ++ delete [] icon_->icons; ++ icon_->icons = 0L; ++ } ++ ++ icon_->count = 0; ++ ++#ifdef WIN32 ++ if (icon_->big_icon) ++ DestroyIcon(icon_->big_icon); ++ if (icon_->small_icon) ++ DestroyIcon(icon_->small_icon); ++ ++ icon_->big_icon = NULL; ++ icon_->small_icon = NULL; ++#endif ++} + + // + // End of "$Id: Fl_Window.cxx 9706 2012-11-06 20:46:14Z matt $". +diff -ur fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:49:40.912227213 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:49:55.558137113 +0100 +@@ -345,6 +345,7 @@ + Atom fl_NET_WM_STATE; + Atom fl_NET_WM_STATE_FULLSCREEN; + Atom fl_NET_WORKAREA; ++Atom fl_NET_WM_ICON; + + /* + X defines 32-bit-entities to have a format value of max. 32, +@@ -709,6 +710,7 @@ + fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0); + fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0); + fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0); ++ fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0); + + if (sizeof(Atom) < 4) + atom_bits = sizeof(Atom) * 8; +@@ -2138,12 +2140,14 @@ + fl_show_iconic = 0; + showit = 0; + } +- if (win->icon()) { +- hints->icon_pixmap = (Pixmap)win->icon(); ++ if (win->icon_->legacy_icon) { ++ hints->icon_pixmap = (Pixmap)win->icon_->legacy_icon; + hints->flags |= IconPixmapHint; + } + XSetWMHints(fl_display, xp->xid, hints); + XFree(hints); ++ ++ xp->set_icons(); + } + + // set the window type for menu and tooltip windows to avoid animations (compiz) +@@ -2263,6 +2267,93 @@ + + //////////////////////////////////////////////////////////////// + ++static unsigned long *default_net_wm_icons = 0L; ++static size_t default_net_wm_icons_size = 0; ++ ++void icons_to_property(const Fl_RGB_Image *icons[], int count, ++ unsigned long **property, size_t *len) { ++ size_t sz; ++ unsigned long *data; ++ ++ sz = 0; ++ for (int i = 0;i < count;i++) ++ sz += 2 + icons[i]->w() * icons[i]->h(); ++ ++ // FIXME: Might want to sort the icons ++ ++ *property = data = new unsigned long[sz]; ++ *len = sz; ++ ++ for (int i = 0;i < count;i++) { ++ const Fl_RGB_Image *image; ++ ++ image = icons[i]; ++ ++ data[0] = image->w(); ++ data[1] = image->h(); ++ data += 2; ++ ++ const uchar *in = (const uchar*)*image->data(); ++ for (int y = 0;y < image->h();y++) { ++ for (int x = 0;x < image->w();x++) { ++ switch (image->d()) { ++ case 1: ++ *data = ( 0xff<<24) | (in[0]<<16) | (in[0]<<8) | in[0]; ++ break; ++ case 2: ++ *data = (in[1]<<24) | (in[0]<<16) | (in[0]<<8) | in[0]; ++ break; ++ case 3: ++ *data = ( 0xff<<24) | (in[0]<<16) | (in[1]<<8) | in[2]; ++ break; ++ case 4: ++ *data = (in[3]<<24) | (in[0]<<16) | (in[1]<<8) | in[2]; ++ break; ++ } ++ in += image->d(); ++ data++; ++ } ++ in += image->ld(); ++ } ++ } ++} ++ ++void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) { ++ if (default_net_wm_icons) { ++ delete [] default_net_wm_icons; ++ default_net_wm_icons = 0L; ++ default_net_wm_icons_size = 0; ++ } ++ ++ if (count > 0) ++ icons_to_property(icons, count, ++ &default_net_wm_icons, &default_net_wm_icons_size); ++} ++ ++void Fl_X::set_icons() { ++ unsigned long *net_wm_icons; ++ size_t net_wm_icons_size; ++ ++ if (w->icon_->count) { ++ icons_to_property((const Fl_RGB_Image **)w->icon_->icons, w->icon_->count, ++ &net_wm_icons, &net_wm_icons_size); ++ } else { ++ net_wm_icons = default_net_wm_icons; ++ net_wm_icons_size = default_net_wm_icons_size; ++ } ++ ++ XChangeProperty (fl_display, xid, fl_NET_WM_ICON, XA_CARDINAL, 32, ++ PropModeReplace, (unsigned char*) net_wm_icons, net_wm_icons_size); ++ ++ if (w->icon_->count) { ++ delete [] net_wm_icons; ++ net_wm_icons = 0L; ++ net_wm_icons_size = 0; ++ } ++} ++ ++//////////////////////////////////////////////////////////////// ++ + int Fl_X::set_cursor(Fl_Cursor c) { + unsigned int shape; + Cursor xc; diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch new file mode 100644 index 00000000..b41af794 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch @@ -0,0 +1,135 @@ +diff -ur fltk-1.3.0r9110.org/src/Fl_win32.cxx fltk-1.3.0r9110/src/Fl_win32.cxx +--- fltk-1.3.0r9110.org/src/Fl_win32.cxx 2012-06-17 19:42:02.169422400 +0200 ++++ fltk-1.3.0r9110/src/Fl_win32.cxx 2012-06-17 19:43:38.286031455 +0200 +@@ -543,6 +543,37 @@ + const char* GetValue() const { return(out); } + }; + ++void fl_update_clipboard(void) { ++ Fl_Window *w1 = Fl::first_window(); ++ if (!w1) ++ return; ++ ++ HWND hwnd = fl_xid(w1); ++ ++ if (!OpenClipboard(hwnd)) ++ return; ++ ++ EmptyClipboard(); ++ ++ int utf16_len = fl_utf8toUtf16(fl_selection_buffer[1], ++ fl_selection_length[1], 0, 0); ++ ++ HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc. ++ LPVOID memLock = GlobalLock(hMem); ++ ++ fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], ++ (unsigned short*) memLock, utf16_len + 1); ++ ++ GlobalUnlock(hMem); ++ SetClipboardData(CF_UNICODETEXT, hMem); ++ ++ CloseClipboard(); ++ ++ // In case Windows managed to lob of a WM_DESTROYCLIPBOARD during ++ // the above. ++ fl_i_own_selection[1] = 1; ++} ++ + // call this when you create a selection: + void Fl::copy(const char *stuff, int len, int clipboard) { + if (!stuff || len<0) return; +@@ -560,25 +591,9 @@ + memcpy(fl_selection_buffer[clipboard], stuff, len); + fl_selection_buffer[clipboard][len] = 0; // needed for direct paste + fl_selection_length[clipboard] = len; +- if (clipboard) { +- // set up for "delayed rendering": +- if (OpenClipboard(NULL)) { +- // if the system clipboard works, use it +- int utf16_len = fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], 0, 0); +- EmptyClipboard(); +- HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc. +- LPVOID memLock = GlobalLock(hMem); +- fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len + 1); +- GlobalUnlock(hMem); +- SetClipboardData(CF_UNICODETEXT, hMem); +- CloseClipboard(); +- GlobalFree(hMem); +- fl_i_own_selection[clipboard] = 0; +- } else { +- // only if it fails, instruct paste() to use the internal buffers +- fl_i_own_selection[clipboard] = 1; +- } +- } ++ fl_i_own_selection[clipboard] = 1; ++ if (clipboard) ++ fl_update_clipboard(); + } + + // Call this when a "paste" operation happens: +@@ -1307,33 +1322,6 @@ + fl_i_own_selection[1] = 0; + return 1; + +- case WM_RENDERALLFORMATS: +- fl_i_own_selection[1] = 0; +- // Windoze seems unhappy unless I do these two steps. Documentation +- // seems to vary on whether opening the clipboard is necessary or +- // is in fact wrong: +- CloseClipboard(); +- OpenClipboard(NULL); +- // fall through... +- case WM_RENDERFORMAT: { +- HANDLE h; +- +-// int l = fl_utf_nb_char((unsigned char*)fl_selection_buffer[1], fl_selection_length[1]); +- int l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], NULL, 0); // Pass NULL buffer to query length required +- h = GlobalAlloc(GHND, (l+1) * sizeof(unsigned short)); +- if (h) { +- unsigned short *g = (unsigned short*) GlobalLock(h); +-// fl_utf2unicode((unsigned char *)fl_selection_buffer[1], fl_selection_length[1], (xchar*)g); +- l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], g, (l+1)); +- g[l] = 0; +- GlobalUnlock(h); +- SetClipboardData(CF_UNICODETEXT, h); +- } +- +- // Windoze also seems unhappy if I don't do this. Documentation very +- // unclear on what is correct: +- if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard(); +- return 1;} + case WM_DISPLAYCHANGE: // occurs when screen configuration (number, position) changes + Fl::call_screen_init(); + Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); +diff -ur fltk-1.3.0r9110.org/src/Fl.cxx fltk-1.3.0r9110/src/Fl.cxx +--- fltk-1.3.0r9110.org/src/Fl.cxx 2012-06-17 19:42:02.173422595 +0200 ++++ fltk-1.3.0r9110/src/Fl.cxx 2012-06-17 19:42:02.317429497 +0200 +@@ -1420,7 +1420,9 @@ + //////////////////////////////////////////////////////////////// + // hide() destroys the X window, it does not do unmap! + +-#if !defined(WIN32) && USE_XFT ++#if defined(WIN32) ++extern void fl_update_clipboard(void); ++#elif USE_XFT + extern void fl_destroy_xft_draw(Window); + #endif + +@@ -1467,14 +1469,8 @@ + #if defined(WIN32) + // this little trick keeps the current clipboard alive, even if we are about + // to destroy the window that owns the selection. +- if (GetClipboardOwner()==ip->xid) { +- Fl_Window *w1 = Fl::first_window(); +- if (w1 && OpenClipboard(fl_xid(w1))) { +- EmptyClipboard(); +- SetClipboardData(CF_TEXT, NULL); +- CloseClipboard(); +- } +- } ++ if (GetClipboardOwner()==ip->xid) ++ fl_update_clipboard(); + // Send a message to myself so that I'll get out of the event loop... + PostMessage(ip->xid, WM_APP, 0, 0); + if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc); diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-multihead.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-multihead.patch new file mode 100644 index 00000000..e4a010aa --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v3.3.x-multihead.patch @@ -0,0 +1,468 @@ +diff -urp fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H +--- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:52:33.017228122 +0100 ++++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:52:47.876478968 +0100 +@@ -54,7 +54,7 @@ class Fl_RGB_Image; + class FL_EXPORT Fl_Window : public Fl_Group { + + static char *default_xclass_; +- // Note: we must use separate statements for each of the following 4 variables, ++ // Note: we must use separate statements for each of the following 8 variables, + // with the static attribute, otherwise MS VC++ 2008/2010 complains :-( + // AlbrechtS 04/2012 + #if FLTK_ABI_VERSION < 10301 +@@ -73,6 +73,22 @@ class FL_EXPORT Fl_Window : public Fl_Gr + static // when these members are static, ABI compatibility with 1.3.0 is respected + #endif + int no_fullscreen_h; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_top; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_bottom; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_left; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_right; + + friend class Fl_X; + Fl_X *i; // points at the system-specific stuff +@@ -430,13 +446,15 @@ public: + */ + void show(int argc, char **argv); + /** +- Makes the window completely fill the screen, without any window +- manager border visible. You must use fullscreen_off() to undo +- this. ++ Makes the window completely fill one or more screens, without any ++ window manager border visible. You must use fullscreen_off() to ++ undo this. + + \note On some platforms, this can result in the keyboard being + grabbed. The window may also be recreated, meaning hide() and + show() will be called. ++ ++ \see void Fl_Window::fullscreen_screens() + */ + void fullscreen(); + /** +@@ -453,6 +471,17 @@ public: + */ + unsigned int fullscreen_active() const { return flags() & FULLSCREEN; } + /** ++ Sets which screens should be used when this window is in fullscreen ++ mode. The window will be resized to the top of the screen with index ++ \p top, the bottom of the screen with index \p bottom, etc. ++ ++ If this method is never called, or if any argument is < 0, then the ++ window will be resized to fill the screen it is currently on. ++ ++ \see void Fl_Window::fullscreen() ++ */ ++ void fullscreen_screens(int top, int bottom, int left, int right); ++ /** + Iconifies the window. If you call this when shown() is false + it will show() it as an icon. If the window is already + iconified this does nothing. +diff -urp fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H +--- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:52:33.017228122 +0100 ++++ fltk-1.3.2/FL/win32.H 2013-01-16 10:52:47.876478968 +0100 +@@ -80,6 +80,7 @@ public: + static Fl_X* i(const Fl_Window* w) {return w->i;} + static int fake_X_wm(const Fl_Window* w,int &X, int &Y, + int &bt,int &bx,int &by); ++ void make_fullscreen(int X, int Y, int W, int H); + void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} + void flush() {w->flush();} + void set_minmax(LPMINMAXINFO minmax); +diff -urp fltk-1.3.2.org/src/Fl_cocoa.mm fltk-1.3.2/src/Fl_cocoa.mm +--- fltk-1.3.2.org/src/Fl_cocoa.mm 2013-01-16 10:52:33.014229574 +0100 ++++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-16 10:52:47.877480606 +0100 +@@ -2438,9 +2438,32 @@ void Fl_X::make(Fl_Window* w) + + NSRect crect; + if (w->fullscreen_active()) { +- int sx, sy, sw, sh; +- Fl::screen_xywh(sx, sy, sw, sh, w->x(), w->y(), w->w(), w->h()); +- w->resize(sx, sy, sw, sh); ++ int top, bottom, left, right; ++ int sx, sy, sw, sh, X, Y, W, H; ++ ++ top = w->fullscreen_screen_top; ++ bottom = w->fullscreen_screen_bottom; ++ left = w->fullscreen_screen_left; ++ right = w->fullscreen_screen_right; ++ ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ top = Fl::screen_num(w->x(), w->y(), w->w(), w->h()); ++ bottom = top; ++ left = top; ++ right = top; ++ } ++ ++ Fl::screen_xywh(sx, sy, sw, sh, top); ++ Y = sy; ++ Fl::screen_xywh(sx, sy, sw, sh, bottom); ++ H = sy + sh - Y; ++ Fl::screen_xywh(sx, sy, sw, sh, left); ++ X = sx; ++ Fl::screen_xywh(sx, sy, sw, sh, right); ++ W = sx + sw - X; ++ ++ w->resize(X, Y, W, H); ++ + winstyle = NSBorderlessWindowMask; + winlevel = NSStatusWindowLevel; + } +diff -urp fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx +--- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:52:33.019230734 +0100 ++++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:52:47.878480504 +0100 +@@ -1493,7 +1493,6 @@ int Fl_X::fake_X_wm(const Fl_Window* w,i + Y+=yoff; + + if (w->fullscreen_active()) { +- X = Y = 0; + bx = by = bt = 0; + } + +@@ -1547,19 +1546,42 @@ void Fl_Window::resize(int X,int Y,int W + } + } + +-static void make_fullscreen(Fl_Window *w, Window xid, int X, int Y, int W, int H) { ++void Fl_X::make_fullscreen(int X, int Y, int W, int H) { ++ int top, bottom, left, right; + int sx, sy, sw, sh; +- Fl::screen_xywh(sx, sy, sw, sh, X, Y, W, H); ++ ++ top = w->fullscreen_screen_top; ++ bottom = w->fullscreen_screen_bottom; ++ left = w->fullscreen_screen_left; ++ right = w->fullscreen_screen_right; ++ ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ top = Fl::screen_num(X, Y, W, H); ++ bottom = top; ++ left = top; ++ right = top; ++ } ++ ++ Fl::screen_xywh(sx, sy, sw, sh, top); ++ Y = sy; ++ Fl::screen_xywh(sx, sy, sw, sh, bottom); ++ H = sy + sh - Y; ++ Fl::screen_xywh(sx, sy, sw, sh, left); ++ X = sx; ++ Fl::screen_xywh(sx, sy, sw, sh, right); ++ W = sx + sw - X; ++ + DWORD flags = GetWindowLong(xid, GWL_STYLE); + flags = flags & ~(WS_THICKFRAME|WS_CAPTION); + SetWindowLong(xid, GWL_STYLE, flags); ++ + // SWP_NOSENDCHANGING is so that we can override size limits +- SetWindowPos(xid, HWND_TOP, sx, sy, sw, sh, SWP_NOSENDCHANGING | SWP_FRAMECHANGED); ++ SetWindowPos(xid, HWND_TOP, X, Y, W, H, SWP_NOSENDCHANGING | SWP_FRAMECHANGED); + } + + void Fl_Window::fullscreen_x() { + _set_fullscreen(); +- make_fullscreen(this, fl_xid(this), x(), y(), w(), h()); ++ i->make_fullscreen(x(), y(), w(), h()); + Fl::handle(FL_FULLSCREEN, this); + } + +@@ -1814,8 +1836,8 @@ Fl_X* Fl_X::make(Fl_Window* w) { + monitor the window was placed on. */ + RECT rect; + GetWindowRect(x->xid, &rect); +- make_fullscreen(w, x->xid, rect.left, rect.top, +- rect.right - rect.left, rect.bottom - rect.top); ++ x->make_fullscreen(rect.left, rect.top, ++ rect.right - rect.left, rect.bottom - rect.top); + } + + x->next = Fl_X::first; +diff -urp fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx fltk-1.3.2/src/Fl_Window_fullscreen.cxx +--- fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx 2012-11-06 21:46:14.000000000 +0100 ++++ fltk-1.3.2/src/Fl_Window_fullscreen.cxx 2013-01-16 10:52:47.879480608 +0100 +@@ -36,6 +36,10 @@ int Fl_Window::no_fullscreen_x = 0; + int Fl_Window::no_fullscreen_y = 0; + int Fl_Window::no_fullscreen_w = 0; + int Fl_Window::no_fullscreen_h = 0; ++int Fl_Window::fullscreen_screen_top = -1; ++int Fl_Window::fullscreen_screen_bottom = -1; ++int Fl_Window::fullscreen_screen_left = -1; ++int Fl_Window::fullscreen_screen_right = -1; + #endif + + void Fl_Window::border(int b) { +@@ -95,6 +99,23 @@ void Fl_Window::fullscreen_off() { + fullscreen_off(no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h); + } + ++void Fl_Window::fullscreen_screens(int top, int bottom, int left, int right) { ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ fullscreen_screen_top = -1; ++ fullscreen_screen_bottom = -1; ++ fullscreen_screen_left = -1; ++ fullscreen_screen_right = -1; ++ } else { ++ fullscreen_screen_top = top; ++ fullscreen_screen_bottom = bottom; ++ fullscreen_screen_left = left; ++ fullscreen_screen_right = right; ++ } ++ ++ if (shown() && (flags() & Fl_Widget::FULLSCREEN)) ++ fullscreen_x(); ++} ++ + + // + // End of "$Id: Fl_Window_fullscreen.cxx 9706 2012-11-06 20:46:14Z matt $". +diff -urp fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:52:33.020228202 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:52:47.880480556 +0100 +@@ -344,6 +344,7 @@ Atom fl_NET_WM_ICON_NAME; // utf8 aware + Atom fl_NET_SUPPORTING_WM_CHECK; + Atom fl_NET_WM_STATE; + Atom fl_NET_WM_STATE_FULLSCREEN; ++Atom fl_NET_WM_FULLSCREEN_MONITORS; + Atom fl_NET_WORKAREA; + Atom fl_NET_WM_ICON; + +@@ -709,6 +710,7 @@ void fl_open_display(Display* d) { + fl_NET_SUPPORTING_WM_CHECK = XInternAtom(d, "_NET_SUPPORTING_WM_CHECK", 0); + fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0); + fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0); ++ fl_NET_WM_FULLSCREEN_MONITORS = XInternAtom(d, "_NET_WM_FULLSCREEN_MONITORS", 0); + fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0); + fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0); + +@@ -1872,22 +1874,30 @@ void Fl_Window::resize(int X,int Y,int W + #define _NET_WM_STATE_ADD 1 /* add/set property */ + #define _NET_WM_STATE_TOGGLE 2 /* toggle property */ + +-static void send_wm_state_event(Window wnd, int add, Atom prop) { ++static void send_wm_event(Window wnd, Atom message, ++ unsigned long d0, unsigned long d1=0, ++ unsigned long d2=0, unsigned long d3=0, ++ unsigned long d4=0) { + XEvent e; + e.xany.type = ClientMessage; + e.xany.window = wnd; +- e.xclient.message_type = fl_NET_WM_STATE; ++ e.xclient.message_type = message; + e.xclient.format = 32; +- e.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; +- e.xclient.data.l[1] = prop; +- e.xclient.data.l[2] = 0; +- e.xclient.data.l[3] = 0; +- e.xclient.data.l[4] = 0; ++ e.xclient.data.l[0] = d0; ++ e.xclient.data.l[1] = d1; ++ e.xclient.data.l[2] = d2; ++ e.xclient.data.l[3] = d3; ++ e.xclient.data.l[4] = d4; + XSendEvent(fl_display, RootWindow(fl_display, fl_screen), + 0, SubstructureNotifyMask | SubstructureRedirectMask, + &e); + } + ++static void send_wm_state_event(Window wnd, int add, Atom prop) { ++ send_wm_event(wnd, fl_NET_WM_STATE, ++ add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE, prop); ++} ++ + int Fl_X::ewmh_supported() { + static int result = -1; + +@@ -1911,6 +1921,22 @@ int Fl_X::ewmh_supported() { + /* Change an existing window to fullscreen */ + void Fl_Window::fullscreen_x() { + if (Fl_X::ewmh_supported()) { ++ int top, bottom, left, right; ++ ++ top = fullscreen_screen_top; ++ bottom = fullscreen_screen_bottom; ++ left = fullscreen_screen_left; ++ right = fullscreen_screen_right; ++ ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ top = Fl::screen_num(x(), y(), w(), h()); ++ bottom = top; ++ left = top; ++ right = top; ++ } ++ ++ send_wm_event(fl_xid(this), fl_NET_WM_FULLSCREEN_MONITORS, ++ top, bottom, left, right); + send_wm_state_event(fl_xid(this), 1, fl_NET_WM_STATE_FULLSCREEN); + } else { + _set_fullscreen(); +@@ -1997,7 +2023,7 @@ void Fl_X::make_xid(Fl_Window* win, XVis + // force the window to be on-screen. Usually the X window manager + // does this, but a few don't, so we do it here for consistency: + int scr_x, scr_y, scr_w, scr_h; +- Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y); ++ Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y, W, H); + + if (win->border()) { + // ensure border is on screen: +@@ -2026,6 +2052,23 @@ void Fl_X::make_xid(Fl_Window* win, XVis + return; + } + ++ // Compute which screen(s) we should be on if we want to go fullscreen ++ int fullscreen_top, fullscreen_bottom, fullscreen_left, fullscreen_right; ++ ++ fullscreen_top = win->fullscreen_screen_top; ++ fullscreen_bottom = win->fullscreen_screen_bottom; ++ fullscreen_left = win->fullscreen_screen_left; ++ fullscreen_right = win->fullscreen_screen_right; ++ ++ if ((fullscreen_top < 0) || (fullscreen_bottom < 0) || ++ (fullscreen_left < 0) || (fullscreen_right < 0)) { ++ fullscreen_top = Fl::screen_num(X, Y, W, H); ++ fullscreen_bottom = fullscreen_top; ++ fullscreen_left = fullscreen_top; ++ fullscreen_right = fullscreen_top; ++ } ++ ++ + ulong root = win->parent() ? + fl_xid(win->window()) : RootWindow(fl_display, fl_screen); + +@@ -2049,9 +2092,17 @@ void Fl_X::make_xid(Fl_Window* win, XVis + // border, and cannot grab without an existing window. Besides, + // there is no clear_override(). + if (win->flags() & Fl_Widget::FULLSCREEN && !Fl_X::ewmh_supported()) { ++ int sx, sy, sw, sh; + attr.override_redirect = 1; + mask |= CWOverrideRedirect; +- Fl::screen_xywh(X, Y, W, H, X, Y, W, H); ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_left); ++ X = sx; ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_right); ++ W = sx + sw - X; ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_top); ++ Y = sy; ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_bottom); ++ H = sy + sh - Y; + } + + if (fl_background_pixel >= 0) { +@@ -2122,6 +2173,13 @@ void Fl_X::make_xid(Fl_Window* win, XVis + + // If asked for, create fullscreen + if (win->flags() & Fl_Widget::FULLSCREEN && Fl_X::ewmh_supported()) { ++ unsigned long data[4]; ++ data[0] = fullscreen_top; ++ data[1] = fullscreen_bottom; ++ data[2] = fullscreen_left; ++ data[3] = fullscreen_right; ++ XChangeProperty (fl_display, xp->xid, fl_NET_WM_FULLSCREEN_MONITORS, XA_ATOM, 32, ++ PropModeReplace, (unsigned char*) data, 4); + XChangeProperty (fl_display, xp->xid, fl_NET_WM_STATE, XA_ATOM, 32, + PropModeAppend, (unsigned char*) &fl_NET_WM_STATE_FULLSCREEN, 1); + } +diff -urp fltk-1.3.2.org/test/fullscreen.cxx fltk-1.3.2/test/fullscreen.cxx +--- fltk-1.3.2.org/test/fullscreen.cxx 2012-06-14 17:09:46.000000000 +0200 ++++ fltk-1.3.2/test/fullscreen.cxx 2013-01-16 10:52:47.881104801 +0100 +@@ -127,7 +127,7 @@ class fullscreen_window : public Fl_Sing + fullscreen_window(int W, int H, const char *t=0); + int handle (int e); + Fl_Toggle_Light_Button *b3; +- ++ Fl_Toggle_Light_Button *b4; + }; + + fullscreen_window::fullscreen_window(int W, int H, const char *t) : Fl_Single_Window(W, H, t) { +@@ -170,23 +170,54 @@ void border_cb(Fl_Widget *o, void *p) { + #endif + } + +-int px,py,pw,ph; + Fl_Button *border_button; + void fullscreen_cb(Fl_Widget *o, void *p) { + Fl_Window *w = (Fl_Window *)p; + int d = ((Fl_Button *)o)->value(); + if (d) { +- px = w->x(); +- py = w->y(); +- pw = w->w(); +- ph = w->h(); ++ if (((fullscreen_window*)w)->b4->value()) { ++ int top, bottom, left, right; ++ int top_y, bottom_y, left_x, right_x; ++ ++ int sx, sy, sw, sh; ++ ++ top = bottom = left = right = 0; ++ ++ Fl::screen_xywh(sx, sy, sw, sh, 0); ++ top_y = sy; ++ bottom_y = sy + sh; ++ left_x = sx; ++ right_x = sx + sw; ++ ++ for (int i = 1;i < Fl::screen_count();i++) { ++ Fl::screen_xywh(sx, sy, sw, sh, i); ++ if (sy < top_y) { ++ top = i; ++ top_y = sy; ++ } ++ if ((sy + sh) > bottom_y) { ++ bottom = i; ++ bottom_y = sy + sh; ++ } ++ if (sx < left_x) { ++ left = i; ++ left_x = sx; ++ } ++ if ((sx + sw) > right_x) { ++ right = i; ++ right_x = sx + sw; ++ } ++ } ++ ++ w->fullscreen_screens(top, bottom, left, right); ++ } else { ++ w->fullscreen_screens(-1, -1, -1, -1); ++ } + w->fullscreen(); +- w->override(); + #ifndef WIN32 // update our border state in case border was turned off + border_button->value(w->border()); + #endif + } else { +- //w->fullscreen_off(px,py,pw,ph); + w->fullscreen_off(); + } + } +@@ -219,7 +250,7 @@ void exit_cb(Fl_Widget *, void *) { + exit(0); + } + +-#define NUMB 7 ++#define NUMB 8 + + int twowindow = 0; + int initfull = 0; +@@ -284,6 +315,9 @@ int main(int argc, char **argv) { + window.b3->callback(fullscreen_cb,w); + y+=30; + ++ window.b4 = new Fl_Toggle_Light_Button(50,y,window.w()-60,30,"All Screens"); ++ y+=30; ++ + Fl_Button eb(50,y,window.w()-60,30,"Exit"); + eb.callback(exit_cb); + y+=30; diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch new file mode 100644 index 00000000..c29d3b97 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch @@ -0,0 +1,256 @@ +diff -ur fltk-1.3.0r9293.org/src/Fl_win32.cxx fltk-1.3.0r9293/src/Fl_win32.cxx +--- fltk-1.3.0r9293.org/src/Fl_win32.cxx 2012-06-18 09:07:56.522314557 +0200 ++++ fltk-1.3.0r9293/src/Fl_win32.cxx 2012-06-18 09:08:07.392836285 +0200 +@@ -87,6 +87,8 @@ + static Fl_Display_Device fl_gdi_display(&fl_gdi_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_gdi_display; // the platform display + ++bool use_simple_keyboard = false; ++ + // dynamic wsock dll handling api: + #if defined(__CYGWIN__) && !defined(SOCKET) + # define SOCKET int +@@ -120,6 +122,8 @@ + * size and link dependencies. + */ + static HMODULE s_imm_module = 0; ++typedef BOOL (WINAPI* flTypeImmAssociateContextEx)(HWND, HIMC, DWORD); ++static flTypeImmAssociateContextEx flImmAssociateContextEx = 0; + typedef HIMC (WINAPI* flTypeImmGetContext)(HWND); + static flTypeImmGetContext flImmGetContext = 0; + typedef BOOL (WINAPI* flTypeImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); +@@ -135,6 +139,7 @@ + if (!s_imm_module) + Fl::fatal("FLTK Lib Error: IMM32.DLL file not found!\n\n" + "Please check your input method manager library accessibility."); ++ flImmAssociateContextEx = (flTypeImmAssociateContextEx)GetProcAddress(s_imm_module, "ImmAssociateContextEx"); + flImmGetContext = (flTypeImmGetContext)GetProcAddress(s_imm_module, "ImmGetContext"); + flImmSetCompositionWindow = (flTypeImmSetCompositionWindow)GetProcAddress(s_imm_module, "ImmSetCompositionWindow"); + flImmReleaseContext = (flTypeImmReleaseContext)GetProcAddress(s_imm_module, "ImmReleaseContext"); +@@ -413,7 +418,12 @@ + } + } + +- TranslateMessage(&fl_msg); ++ // Don't bother with key to character translation as we do ++ // it manually for simpley keyboard widgets. In fact, calling ++ // TranslateMessage() just makes it more difficult as it sets ++ // a bunch of internal state. ++ if (!use_simple_keyboard) ++ TranslateMessage(&fl_msg); + DispatchMessageW(&fl_msg); + have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE); + } +@@ -638,6 +648,49 @@ + } + } + ++void fl_update_focus(void) ++{ ++ Fl_Widget *focus; ++ Fl_Window *win; ++ ++ get_imm_module(); ++ ++ focus = Fl::grab(); ++ if (!focus) ++ focus = Fl::focus(); ++ if (!focus) ++ return; ++ ++ // Grabs are special in that events are sent to the first ++ // available window ++ if (focus == Fl::grab()) ++ win = Fl::first_window(); ++ else { ++ win = focus->as_window(); ++ if (!win) ++ win = focus->window(); ++ } ++ ++ if (!win) { ++ Fl::warning("Cannot find window for widget receiving focus"); ++ return; ++ } ++ ++ // No Win32 window created yet ++ if (!Fl_X::i(win) || !fl_xid(win)) ++ return; ++ ++ if (focus->simple_keyboard()) { ++ use_simple_keyboard = true; ++ if (flImmGetContext(fl_xid(win)) != 0) ++ flImmAssociateContextEx(fl_xid(win), 0, 0); ++ } else { ++ use_simple_keyboard = false; ++ if (flImmGetContext(fl_xid(win)) == 0) ++ flImmAssociateContextEx(fl_xid(win), 0, IACE_DEFAULT); ++ } ++} ++ + HWND fl_capture; + + static int mouse_event(Fl_Window *window, int what, int button, +@@ -785,6 +838,27 @@ + return extended ? extendedlut[vk] : vklut[vk]; + } + ++static xchar msdead2fltk(xchar in) ++{ ++ switch (in) { ++ case 0x0060: // GRAVE ACCENT ++ return 0x0300; // COMBINING GRAVE ACCENT ++ case 0x00b4: // ACUTE ACCENT ++ return 0x0301; // COMBINING ACUTE ACCENT ++ case 0x005e: // CIRCUMFLEX ACCENT ++ return 0x0302; // COMBINING CIRCUMFLEX ACCENT ++ case 0x007e: // TILDE ++ return 0x0303; // COMBINING TILDE ++ case 0x00a8: // DIAERESIS ++ return 0x0308; // COMBINING DIAERESIS ++ // FIXME: Windows dead key behaviour isn't documented and I don't have ++ // any more keyboards to test with... ++ } ++ ++ // hope that Windows gave us something proper to begin with ++ return in; ++} ++ + #if USE_COLORMAP + extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx + #endif +@@ -846,6 +920,8 @@ + //fl_msg.pt = ??? + //fl_msg.lPrivate = ??? + ++ MSG fl_orig_msg = fl_msg; ++ + Fl_Window *window = fl_find(hWnd); + + if (window) switch (uMsg) { +@@ -1025,23 +1101,82 @@ + if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK; + Fl::e_state = state; + static char buffer[1024]; +- if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { + ++ if (use_simple_keyboard) { ++ BYTE keystate[256]; ++ WCHAR wbuf[8]; ++ int ret; ++ ++ // I'm not sure if we ever get WM_CHAR (& friends) without an initial ++ // WM_KEYDOWN (& friends), but if we do then we should not send such ++ // side band events to simple keyboard widgets. ++ if ((fl_orig_msg.message != WM_KEYDOWN) && ++ (fl_orig_msg.message != WM_SYSKEYDOWN) && ++ (fl_orig_msg.message != WM_KEYUP) && ++ (fl_orig_msg.message != WM_SYSKEYUP)) ++ break; ++ ++ GetKeyboardState(keystate); ++ ++ // Pressing Ctrl wreaks havoc with the symbol lookup, so turn that off. ++ // But AltGr shows up as Ctrl+Alt in Windows, so keep Ctrl if Alt is ++ // active. ++ if (!(keystate[VK_MENU] & 0x80)) ++ keystate[VK_CONTROL] = keystate[VK_LCONTROL] = keystate[VK_RCONTROL] = 0; ++ ++ // We cannot inspect or modify Windows' internal state of the keyboard ++ // so we have to try to infer information from ToUnicode() and wedge ++ // things into a known state. ++ for (int i = 0;i < 2;i++) { ++ ret = ToUnicode(fl_orig_msg.wParam, 0, keystate, wbuf, ++ sizeof(wbuf)/sizeof(wbuf[0]), 0); ++ ++ // No symbol for this key (or unexpected length) ++ if ((ret == 0) || (ret < -1)) { ++ buffer[0] = 0; ++ Fl::e_length = 0; ++ break; ++ } ++ ++ // A dead key. Convert this to a Unicode combining character so ++ // that the application can tell the difference between dead and ++ // normal keys. ++ if (ret == -1) { ++ xchar u = (xchar) msdead2fltk(wbuf[0]); ++ Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); ++ buffer[Fl::e_length] = 0; ++ break; ++ } ++ ++ // If we have two characters (or more) from ToUnicode(), that's ++ // an invalid sequence. One character chould mean a proper symbol, ++ // or it could mean a composed one. In both cases we need to call ++ // ToUnicode() again to get something sane. ++ if (i == 0) ++ continue; ++ ++ // We should now have something sane. Give whatever we have to the ++ // application. ++ Fl::e_length = fl_utf8fromwc(buffer, 1024, wbuf, ret); ++ buffer[Fl::e_length] = 0; ++ } ++ } else if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { + xchar u = (xchar) wParam; + // Fl::e_length = fl_unicode2utf(&u, 1, buffer); + Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); + buffer[Fl::e_length] = 0; ++ } else { ++ buffer[0] = 0; ++ Fl::e_length = 0; ++ } + +- +- } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { +- if (state & FL_NUM_LOCK) { +- // Convert to regular keypress... +- buffer[0] = Fl::e_keysym-FL_KP; +- Fl::e_length = 1; +- } else { +- // Convert to special keypress... +- buffer[0] = 0; +- Fl::e_length = 0; ++ // The keypad area is a bit odd in that we need to change the keysym ++ // to properly indicate what the user meant, unlike other keys where ++ // we normally change the text and keep keysym stable. ++ if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { ++ // The initial mapping tables give us a keysym that corresponds to ++ // numlock being on, so we only do something when it is off. ++ if (!(state & FL_NUM_LOCK)) { + switch (Fl::e_keysym) { + case FL_KP + '0' : + Fl::e_keysym = FL_Insert; +@@ -1073,30 +1208,10 @@ + case FL_KP + '.' : + Fl::e_keysym = FL_Delete; + break; +- case FL_KP + '/' : +- case FL_KP + '*' : +- case FL_KP + '-' : +- case FL_KP + '+' : +- buffer[0] = Fl::e_keysym-FL_KP; +- Fl::e_length = 1; +- break; + } + } +- } else if ((lParam & (1<<31))==0) { +-#ifdef FLTK_PREVIEW_DEAD_KEYS +- if ((lParam & (1<<24))==0) { // clear if dead key (always?) +- xchar u = (xchar) wParam; +- Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); +- buffer[Fl::e_length] = 0; +- } else { // set if "extended key" (never printable?) +- buffer[0] = 0; +- Fl::e_length = 0; +- } +-#else +- buffer[0] = 0; +- Fl::e_length = 0; +-#endif + } ++ + Fl::e_text = buffer; + if (lParam & (1<<31)) { // key up events. + if (Fl::handle(FL_KEYUP, window)) return 0; diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch new file mode 100644 index 00000000..cabc0f1c --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch @@ -0,0 +1,286 @@ +diff -ur fltk-1.3.0r9619.org/FL/Fl_Widget.H fltk-1.3.0r9619/FL/Fl_Widget.H +--- fltk-1.3.0r9619.org/FL/Fl_Widget.H 2012-04-23 22:12:06.000000000 +0200 ++++ fltk-1.3.0r9619/FL/Fl_Widget.H 2012-06-18 13:46:07.302320825 +0200 +@@ -171,6 +171,7 @@ + GROUP_RELATIVE = 1<<16, ///< position this widget relative to the parent group, not to the window + COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget + FULLSCREEN = 1<<18, ///< a fullscreen window (Fl_Window) ++ SIMPLE_KEYBOARD = 1<<19, ///< the widget wants simple, consistent keypresses and not advanced input (like character composition and CJK input) + // (space for more flags) + USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions + USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions +@@ -776,6 +777,35 @@ + */ + void clear_changed() {flags_ &= ~CHANGED;} + ++ /** ++ Returns if the widget sees a simplified keyboard model or not. ++ ++ Normally widgets get a full-featured keyboard model that is geared ++ towards text input. This includes support for compose sequences and ++ advanced input methods, commonly used for asian writing system. This ++ system however has downsides in that extra graphic can be presented ++ to the user and that a physical key press doesn't correspond directly ++ to a FLTK event. ++ ++ Widgets that need a direct correspondence between actual key events ++ and those seen by the widget can swith to the simplified keyboard ++ model. ++ ++ \retval 0 if the widget uses the normal keyboard model ++ \see set_changed(), clear_changed() ++ */ ++ unsigned int simple_keyboard() const {return flags_&SIMPLE_KEYBOARD;} ++ ++ /** Marks a widget to use the simple keyboard model. ++ \see changed(), clear_changed() ++ */ ++ void set_simple_keyboard() {flags_ |= SIMPLE_KEYBOARD;} ++ ++ /** Marks a widget to use the normal keyboard model. ++ \see changed(), set_changed() ++ */ ++ void set_normal_keyboard() {flags_ &= ~SIMPLE_KEYBOARD;} ++ + /** Gives the widget the keyboard focus. + Tries to make this widget be the Fl::focus() widget, by first sending + it an FL_FOCUS event, and if it returns non-zero, setting +diff -ur fltk-1.3.0r9619.org/src/Fl.cxx fltk-1.3.0r9619/src/Fl.cxx +--- fltk-1.3.0r9619.org/src/Fl.cxx 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.0r9619/src/Fl.cxx 2012-06-18 13:46:07.303320877 +0200 +@@ -70,6 +70,8 @@ + extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle); + #endif // WIN32 + ++extern void fl_update_focus(void); ++ + // + // Globals... + // +@@ -876,6 +878,8 @@ + fl_oldfocus = p; + } + e_number = old_event; ++ // let the platform code do what it needs ++ fl_update_focus(); + } + } + +diff -ur fltk-1.3.0r9619.org/src/Fl_grab.cxx fltk-1.3.0r9619/src/Fl_grab.cxx +--- fltk-1.3.0r9619.org/src/Fl_grab.cxx 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.0r9619/src/Fl_grab.cxx 2012-06-18 13:46:07.303320877 +0200 +@@ -29,6 +29,7 @@ + // override_redirect, it does similar things on WIN32. + + extern void fl_fix_focus(); // in Fl.cxx ++void fl_update_focus(void); + + #ifdef WIN32 + // We have to keep track of whether we have captured the mouse, since +@@ -80,6 +81,7 @@ + #endif + } + grab_ = win; ++ fl_update_focus(); + } else { + if (grab_) { + #ifdef WIN32 +@@ -98,6 +100,7 @@ + XFlush(fl_display); + #endif + grab_ = 0; ++ fl_update_focus(); + fl_fix_focus(); + } + } +diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx +--- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-18 13:46:07.205316173 +0200 ++++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-18 13:46:18.216844629 +0200 +@@ -298,6 +298,7 @@ + Colormap fl_colormap; + XIM fl_xim_im = 0; + XIC fl_xim_ic = 0; ++Window fl_xim_win = 0; + char fl_is_over_the_spot = 0; + static XRectangle status_area; + +@@ -583,6 +584,65 @@ + if(xim_styles) XFree(xim_styles); + } + ++void fl_xim_deactivate(void); ++ ++void fl_xim_activate(Window xid) ++{ ++ if (!fl_xim_im) ++ return; ++ ++ // If the focused window has changed, then use the brute force method ++ // of completely recreating the input context. ++ if (fl_xim_win != xid) { ++ fl_xim_deactivate(); ++ ++ fl_new_ic(); ++ fl_xim_win = xid; ++ ++ XSetICValues(fl_xim_ic, ++ XNFocusWindow, fl_xim_win, ++ XNClientWindow, fl_xim_win, ++ NULL); ++ } ++ ++ fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); ++} ++ ++void fl_xim_deactivate(void) ++{ ++ if (!fl_xim_ic) ++ return; ++ ++ XDestroyIC(fl_xim_ic); ++ fl_xim_ic = NULL; ++ ++ fl_xim_win = 0; ++} ++ ++extern Fl_Window *fl_xfocus; ++ ++void fl_update_focus(void) ++{ ++ Fl_Widget *focus; ++ ++ focus = Fl::grab(); ++ if (!focus) ++ focus = Fl::focus(); ++ if (!focus) ++ return; ++ ++ if (focus->simple_keyboard()) { ++ fl_xim_deactivate(); ++ } else { ++ // fl_xfocus should always be set if something has focus, but let's ++ // play it safe ++ if (!fl_xfocus || !fl_xid(fl_xfocus)) ++ return; ++ ++ fl_xim_activate(fl_xid(fl_xfocus)); ++ } ++} ++ + void fl_open_display() { + if (fl_display) return; + +@@ -917,10 +977,9 @@ + XEvent xevent = thisevent; + fl_xevent = &thisevent; + Window xid = xevent.xany.window; +- static Window xim_win = 0; + + if (fl_xim_ic && xevent.type == DestroyNotify && +- xid != xim_win && !fl_find(xid)) ++ xid != fl_xim_win && !fl_find(xid)) + { + XIM xim_im; + xim_im = XOpenIM(fl_display, NULL, NULL, NULL); +@@ -935,48 +994,10 @@ + return 0; + } + +- if (fl_xim_ic && (xevent.type == FocusIn)) +- { +-#define POOR_XIM +-#ifdef POOR_XIM +- if (xim_win != xid) +- { +- xim_win = xid; +- XDestroyIC(fl_xim_ic); +- fl_xim_ic = NULL; +- fl_new_ic(); +- XSetICValues(fl_xim_ic, +- XNFocusWindow, xevent.xclient.window, +- XNClientWindow, xid, +- NULL); +- } +- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); +-#else +- if (Fl::first_window() && Fl::first_window()->modal()) { +- Window x = fl_xid(Fl::first_window()); +- if (x != xim_win) { +- xim_win = x; +- XSetICValues(fl_xim_ic, +- XNFocusWindow, xim_win, +- XNClientWindow, xim_win, +- NULL); +- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); +- } +- } else if (xim_win != xid && xid) { +- xim_win = xid; +- XSetICValues(fl_xim_ic, +- XNFocusWindow, xevent.xclient.window, +- XNClientWindow, xid, +- //XNFocusWindow, xim_win, +- //XNClientWindow, xim_win, +- NULL); +- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); +- } +-#endif ++ if (fl_xim_ic) { ++ if (XFilterEvent((XEvent *)&xevent, 0)) ++ return 1; + } +- +- if ( XFilterEvent((XEvent *)&xevent, 0) ) +- return(1); + + #if USE_XRANDR + if( XRRUpdateConfiguration_f && xevent.type == randrEventBase + RRScreenChangeNotify) { +@@ -1326,15 +1347,15 @@ + //static XComposeStatus compose; + len = XLookupString((XKeyEvent*)&(xevent.xkey), + buffer, buffer_len, &keysym, 0/*&compose*/); +- if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets +- // force it to type a character (not sure if this ever is needed): +- // if (!len) {buffer[0] = char(keysym); len = 1;} +- len = fl_utf8encode(XKeysymToUcs(keysym), buffer); +- if (len < 1) len = 1; +- // ignore all effects of shift on the keysyms, which makes it a lot +- // easier to program shortcuts and is Windoze-compatible: +- keysym = XKeycodeToKeysym(fl_display, keycode, 0); +- } ++ // XLookupString() is only defined to return Latin-1 (although it ++ // often gives you more). To be safe, use our own lookups based on ++ // keysym. ++ len = fl_utf8encode(XKeysymToUcs(keysym), buffer); ++ if (len < 1) ++ len = 1; ++ // ignore all effects of shift on the keysyms, which makes it a lot ++ // easier to program shortcuts and is Windoze-compatable: ++ keysym = XKeycodeToKeysym(fl_display, keycode, 0); + } + // MRS: Can't use Fl::event_state(FL_CTRL) since the state is not + // set until set_event_xy() is called later... +diff -ur fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c fltk-1.3.0r9619/src/xutf8/imKStoUCS.c +--- fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c 2009-03-13 23:43:43.000000000 +0100 ++++ fltk-1.3.0r9619/src/xutf8/imKStoUCS.c 2012-06-18 13:46:07.304320930 +0200 +@@ -266,6 +266,12 @@ + 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ + }; + ++static unsigned short const keysym_to_unicode_fe50_fe60[] = { ++ 0x0300, 0x0301, 0x0302, 0x0303, 0x0304, 0x0306, 0x0307, 0x0308, /* 0xfe50-0xfe57 */ ++ 0x030a, 0x030b, 0x030c, 0x0327, 0x0328, 0x1da5, 0x3099, 0x309a, /* 0xfe58-0xfe5f */ ++ 0x0323 /* 0xfe60-0xfe67 */ ++}; ++ + unsigned int + KeySymToUcs4(KeySym keysym) + { +@@ -315,6 +321,8 @@ + return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; + else if (keysym > 0x209f && keysym < 0x20ad) + return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; ++ else if (keysym > 0xfe4f && keysym < 0xfe61) ++ return keysym_to_unicode_fe50_fe60[keysym - 0xfe50]; + else + return 0; + } diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch new file mode 100644 index 00000000..467160f0 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch @@ -0,0 +1,350 @@ +diff -up fltk-1.3.2/CMakeLists.txt.clp-x11 fltk-1.3.2/CMakeLists.txt +--- fltk-1.3.2/CMakeLists.txt.clp-x11 2012-09-13 16:19:01.000000000 +0200 ++++ fltk-1.3.2/CMakeLists.txt 2013-01-30 15:56:25.810663430 +0100 +@@ -515,6 +515,20 @@ else() + endif(OPTION_USE_XINERAMA) + + ####################################################################### ++if(X11_Xfixes_FOUND) ++ option(OPTION_USE_XFIXES "use lib XFIXES" ON) ++endif(X11_Xfixes_FOUND) ++ ++if(OPTION_USE_XFIXES) ++ set(HAVE_XFIXES ${X11_Xfixes_FOUND}) ++ include_directories(${X11_Xfixes_INCLUDE_PATH}) ++ list(APPEND FLTK_LDLIBS -lXfixes) ++ set(FLTK_XFIXES_FOUND TRUE) ++else() ++ set(FLTK_XFIXES_FOUND FALSE) ++endif(OPTION_USE_XFIXES) ++ ++####################################################################### + if(X11_Xft_FOUND) + option(OPTION_USE_XFT "use lib Xft" ON) + endif(X11_Xft_FOUND) +diff -up fltk-1.3.2/configh.cmake.in.clp-x11 fltk-1.3.2/configh.cmake.in +--- fltk-1.3.2/configh.cmake.in.clp-x11 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/configh.cmake.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#cmakedefine01 HAVE_XFIXES ++ ++/* + * __APPLE_QUARTZ__: + * + * If __APPLE_QUARTZ__ is defined, FLTK will be +diff -up fltk-1.3.2/configh.in.clp-x11 fltk-1.3.2/configh.in +--- fltk-1.3.2/configh.in.clp-x11 2011-10-04 11:21:47.000000000 +0200 ++++ fltk-1.3.2/configh.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#define HAVE_XFIXES 0 ++ ++/* + * __APPLE_QUARTZ__: + * + * All Apple implementations are now based on Quartz and Cocoa, +diff -up fltk-1.3.2/configure.in.clp-x11 fltk-1.3.2/configure.in +--- fltk-1.3.2/configure.in.clp-x11 2013-01-30 15:56:25.802663573 +0100 ++++ fltk-1.3.2/configure.in 2013-01-30 15:56:25.810663430 +0100 +@@ -999,6 +999,16 @@ case $uname_GUI in + LIBS="-lXext $LIBS") + fi + ++ dnl Check for the Xfixes extension unless disabled... ++ AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]]) ++ ++ if test x$enable_xfixes != xno; then ++ AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),, ++ [#include ]) ++ AC_CHECK_LIB(Xfixes, XFixesQueryExtension, ++ LIBS="-lXfixes $LIBS") ++ fi ++ + dnl Check for overlay visuals... + AC_PATH_PROG(XPROP, xprop) + AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, +diff -up fltk-1.3.2/fluid/CMakeLists.txt.clp-x11 fltk-1.3.2/fluid/CMakeLists.txt +diff -up fltk-1.3.2/src/CMakeLists.txt.clp-x11 fltk-1.3.2/src/CMakeLists.txt +--- fltk-1.3.2/src/CMakeLists.txt.clp-x11 2013-01-30 16:06:00.785430590 +0100 ++++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:06:17.883126642 +0100 +@@ -243,6 +243,10 @@ if(HAVE_XINERAMA) + target_link_libraries(fltk ${X11_Xinerama_LIB}) + endif(HAVE_XINERAMA) + ++if(HAVE_XFIXES) ++ target_link_libraries(fltk ${X11_Xfixes_LIB}) ++endif(HAVE_XFIXES) ++ + if(USE_XFT) + target_link_libraries(fltk ${X11_Xft_LIB}) + endif(USE_XFT) +diff -up fltk-1.3.2/src/Fl_x.cxx.clp-x11 fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2/src/Fl_x.cxx.clp-x11 2013-01-30 15:56:25.793663733 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:03:37.355981103 +0100 +@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp + static int randrEventBase; // base of RandR-defined events + #endif + ++# if HAVE_XFIXES ++# include ++static int xfixes_event_base = 0; ++static bool have_xfixes = false; ++# endif ++ + static Fl_Xlib_Graphics_Driver fl_xlib_driver; + static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display +@@ -307,6 +313,9 @@ static Atom WM_PROTOCOLS; + static Atom fl_MOTIF_WM_HINTS; + static Atom TARGETS; + static Atom CLIPBOARD; ++static Atom TIMESTAMP; ++static Atom PRIMARY_TIMESTAMP; ++static Atom CLIPBOARD_TIMESTAMP; + Atom fl_XdndAware; + Atom fl_XdndSelection; + Atom fl_XdndEnter; +@@ -667,6 +676,9 @@ void fl_open_display(Display* d) { + fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0); + TARGETS = XInternAtom(d, "TARGETS", 0); + CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0); ++ TIMESTAMP = XInternAtom(d, "TIMESTAMP", 0); ++ PRIMARY_TIMESTAMP = XInternAtom(d, "PRIMARY_TIMESTAMP", 0); ++ CLIPBOARD_TIMESTAMP = XInternAtom(d, "CLIPBOARD_TIMESTAMP", 0); + fl_XdndAware = XInternAtom(d, "XdndAware", 0); + fl_XdndSelection = XInternAtom(d, "XdndSelection", 0); + fl_XdndEnter = XInternAtom(d, "XdndEnter", 0); +@@ -713,6 +725,15 @@ void fl_open_display(Display* d) { + #if !USE_COLORMAP + Fl::visual(FL_RGB); + #endif ++ ++#if HAVE_XFIXES ++ int error_base; ++ if (XFixesQueryExtension(fl_display, &xfixes_event_base, &error_base)) ++ have_xfixes = true; ++ else ++ have_xfixes = false; ++#endif ++ + #if USE_XRANDR + void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY); + if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY); +@@ -901,6 +922,102 @@ void Fl::copy(const char *stuff, int len + } + + //////////////////////////////////////////////////////////////// ++// Code for tracking clipboard changes: ++ ++static Time primary_timestamp = -1; ++static Time clipboard_timestamp = -1; ++ ++extern bool fl_clipboard_notify_empty(void); ++extern void fl_trigger_clipboard_notify(int source); ++ ++static void poll_clipboard_owner(void) { ++ Window xid; ++ ++#if HAVE_XFIXES ++ // No polling needed with Xfixes ++ if (have_xfixes) ++ return; ++#endif ++ ++ // No one is interested, so no point polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ // We need a window for this to work ++ if (!Fl::first_window()) ++ return; ++ xid = fl_xid(Fl::first_window()); ++ if (!xid) ++ return; ++ ++ // Request an update of the selection time for both the primary and ++ // clipboard selections. Magic continues when we get a SelectionNotify. ++ if (!fl_i_own_selection[0]) ++ XConvertSelection(fl_display, XA_PRIMARY, TIMESTAMP, PRIMARY_TIMESTAMP, ++ xid, fl_event_time); ++ if (!fl_i_own_selection[1]) ++ XConvertSelection(fl_display, CLIPBOARD, TIMESTAMP, CLIPBOARD_TIMESTAMP, ++ xid, fl_event_time); ++} ++ ++static void clipboard_timeout(void *data) ++{ ++ // No one is interested, so stop polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ poll_clipboard_owner(); ++ ++ Fl::repeat_timeout(0.5, clipboard_timeout); ++} ++ ++static void handle_clipboard_timestamp(int clipboard, Time time) ++{ ++ Time *timestamp; ++ ++ timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp; ++ ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ // Initial scan, just store the value ++ if (*timestamp == (Time)-1) { ++ *timestamp = time; ++ return; ++ } ++ } ++ ++ // Same selection ++ if (time == *timestamp) ++ return; ++ ++ *timestamp = time; ++ ++ // Something happened! Let's tell someone! ++ fl_trigger_clipboard_notify(clipboard); ++} ++ ++void fl_clipboard_notify_change() { ++ // Reset the timestamps if we've going idle so that you don't ++ // get a bogus immediate trigger next time they're activated. ++ if (fl_clipboard_notify_empty()) { ++ primary_timestamp = -1; ++ clipboard_timestamp = -1; ++ } else { ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ poll_clipboard_owner(); ++ ++ if (!Fl::has_timeout(clipboard_timeout)) ++ Fl::add_timeout(0.5, clipboard_timeout); ++ } ++ } ++} ++ ++//////////////////////////////////////////////////////////////// + + const XEvent* fl_xevent; // the current x event + ulong fl_event_time; // the last timestamp from an x event +@@ -1024,7 +1141,6 @@ int fl_handle(const XEvent& thisevent) + return 0; + + case SelectionNotify: { +- if (!fl_selection_requestor) return 0; + static unsigned char* buffer = 0; + if (buffer) {XFree(buffer); buffer = 0;} + long bytesread = 0; +@@ -1040,6 +1156,19 @@ int fl_handle(const XEvent& thisevent) + bytesread/4, 65536, 1, 0, + &actual, &format, &count, &remaining, + &portion)) break; // quit on error ++ ++ if ((fl_xevent->xselection.property == PRIMARY_TIMESTAMP) || ++ (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)) { ++ if (portion && format == 32 && count == 1) { ++ Time t = *(unsigned int*)portion; ++ if (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP) ++ handle_clipboard_timestamp(1, t); ++ else ++ handle_clipboard_timestamp(0, t); ++ } ++ return true; ++ } ++ + if (actual == TARGETS || actual == XA_ATOM) { + Atom type = XA_STRING; + for (unsigned i = 0; ixselectionclear.selection == CLIPBOARD; + fl_i_own_selection[clipboard] = 0; ++ poll_clipboard_owner(); + return 1;} + + case SelectionRequest: { +@@ -1308,6 +1441,9 @@ int fl_handle(const XEvent& thisevent) + case FocusIn: + if (fl_xim_ic) XSetICFocus(fl_xim_ic); + event = FL_FOCUS; ++ // If the user has toggled from another application to this one, ++ // then it's a good time to check for clipboard changes. ++ poll_clipboard_owner(); + break; + + case FocusOut: +@@ -1676,6 +1812,25 @@ int fl_handle(const XEvent& thisevent) + } + } + ++#if HAVE_XFIXES ++ switch (xevent.type - xfixes_event_base) { ++ case XFixesSelectionNotify: { ++ // Someone feeding us bogus events? ++ if (!have_xfixes) ++ return true; ++ ++ XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)&xevent; ++ ++ if ((selection_notify->selection == XA_PRIMARY) && !fl_i_own_selection[0]) ++ handle_clipboard_timestamp(0, selection_notify->selection_timestamp); ++ else if ((selection_notify->selection == CLIPBOARD) && !fl_i_own_selection[1]) ++ handle_clipboard_timestamp(1, selection_notify->selection_timestamp); ++ ++ return true; ++ } ++ } ++#endif ++ + return Fl::handle(event, window); + } + +@@ -1995,6 +2150,16 @@ void Fl_X::make_xid(Fl_Window* win, XVis + XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1); + } + ++#if HAVE_XFIXES ++ // register for clipboard change notifications ++ if (have_xfixes && !win->parent()) { ++ XFixesSelectSelectionInput(fl_display, xp->xid, XA_PRIMARY, ++ XFixesSetSelectionOwnerNotifyMask); ++ XFixesSelectSelectionInput(fl_display, xp->xid, CLIPBOARD, ++ XFixesSetSelectionOwnerNotifyMask); ++ } ++#endif ++ + XMapWindow(fl_display, xp->xid); + if (showit) { + win->set_visible(); +diff -up fltk-1.3.2/test/CMakeLists.txt.clp-x11 fltk-1.3.2/test/CMakeLists.txt diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-cursor.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-cursor.patch new file mode 100644 index 00000000..8e990505 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v5.3.x-cursor.patch @@ -0,0 +1,1623 @@ +diff -up fltk-1.3.2/CMakeLists.txt.cursor fltk-1.3.2/CMakeLists.txt +--- fltk-1.3.2/CMakeLists.txt.cursor 2013-01-30 16:07:59.510320246 +0100 ++++ fltk-1.3.2/CMakeLists.txt 2013-01-30 16:07:59.528319926 +0100 +@@ -529,6 +529,20 @@ else() + endif(OPTION_USE_XFIXES) + + ####################################################################### ++if(X11_Xcursor_FOUND) ++ option(OPTION_USE_XCURSOR "use lib XCURSOR" ON) ++endif(X11_Xcursor_FOUND) ++ ++if(OPTION_USE_XCURSOR) ++ set(HAVE_XCURSOR ${X11_Xcursor_FOUND}) ++ include_directories(${X11_Xcursor_INCLUDE_PATH}) ++ list(APPEND FLTK_LDLIBS -lXcursor) ++ set(FLTK_XCURSOR_FOUND TRUE) ++else() ++ set(FLTK_XCURSOR_FOUND FALSE) ++endif(OPTION_USE_XCURSOR) ++ ++####################################################################### + if(X11_Xft_FOUND) + option(OPTION_USE_XFT "use lib Xft" ON) + endif(X11_Xft_FOUND) +diff -up fltk-1.3.2/configh.cmake.in.cursor fltk-1.3.2/configh.cmake.in +--- fltk-1.3.2/configh.cmake.in.cursor 2013-01-30 16:07:59.510320246 +0100 ++++ fltk-1.3.2/configh.cmake.in 2013-01-30 16:07:59.529319908 +0100 +@@ -116,6 +116,14 @@ + #cmakedefine01 HAVE_XFIXES + + /* ++ * HAVE_XCURSOR: ++ * ++ * Do we have the X cursor library? ++ */ ++ ++#cmakedefine01 HAVE_XCURSOR ++ ++/* + * __APPLE_QUARTZ__: + * + * If __APPLE_QUARTZ__ is defined, FLTK will be +diff -up fltk-1.3.2/configh.in.cursor fltk-1.3.2/configh.in +--- fltk-1.3.2/configh.in.cursor 2013-01-30 16:07:59.510320246 +0100 ++++ fltk-1.3.2/configh.in 2013-01-30 16:07:59.529319908 +0100 +@@ -116,6 +116,14 @@ + #define HAVE_XFIXES 0 + + /* ++ * HAVE_XCURSOR: ++ * ++ * Do we have the X cursor library? ++ */ ++ ++#define HAVE_XCURSOR 0 ++ ++/* + * __APPLE_QUARTZ__: + * + * All Apple implementations are now based on Quartz and Cocoa, +diff -up fltk-1.3.2/configure.in.cursor fltk-1.3.2/configure.in +--- fltk-1.3.2/configure.in.cursor 2013-01-30 16:07:59.511320228 +0100 ++++ fltk-1.3.2/configure.in 2013-01-30 16:07:59.529319908 +0100 +@@ -1009,6 +1009,16 @@ case $uname_GUI in + LIBS="-lXfixes $LIBS") + fi + ++ dnl Check for the Xcursor library unless disabled... ++ AC_ARG_ENABLE(xcursor, [ --enable-xcursor turn on Xcursor support [default=yes]]) ++ ++ if test x$enable_xcursor != xno; then ++ AC_CHECK_HEADER(X11/Xcursor/Xcursor.h, AC_DEFINE(HAVE_XCURSOR),, ++ [#include ]) ++ AC_CHECK_LIB(Xcursor, XcursorImageCreate, ++ LIBS="-lXcursor $LIBS") ++ fi ++ + dnl Check for overlay visuals... + AC_PATH_PROG(XPROP, xprop) + AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, +diff -up fltk-1.3.2/FL/Enumerations.H.cursor fltk-1.3.2/FL/Enumerations.H +--- fltk-1.3.2/FL/Enumerations.H.cursor 2013-01-30 16:07:59.486320673 +0100 ++++ fltk-1.3.2/FL/Enumerations.H 2013-01-30 16:07:59.530319891 +0100 +@@ -879,35 +879,36 @@ inline Fl_Color fl_color_cube(int r, int + + /** The following constants define the mouse cursors that are available in FLTK. + +- The double-headed arrows are bitmaps provided by FLTK on X, the others +- are provided by system-defined cursors. ++ Cursors are provided by the system when available, or bitmaps built into ++ FLTK as a fallback. + + \todo enum Fl_Cursor needs maybe an image. + */ + enum Fl_Cursor { + FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */ +- FL_CURSOR_ARROW = 35, /**< an arrow pointer. */ +- FL_CURSOR_CROSS = 66, /**< crosshair. */ +- FL_CURSOR_WAIT = 76, /**< watch or hourglass. */ +- FL_CURSOR_INSERT = 77, /**< I-beam. */ +- FL_CURSOR_HAND = 31, /**< hand (uparrow on MSWindows). */ +- FL_CURSOR_HELP = 47, /**< question mark. */ +- FL_CURSOR_MOVE = 27, /**< 4-pointed arrow. */ +- // fltk provides bitmaps for these: +- FL_CURSOR_NS = 78, /**< up/down arrow. */ +- FL_CURSOR_WE = 79, /**< left/right arrow. */ +- FL_CURSOR_NWSE = 80, /**< diagonal arrow. */ +- FL_CURSOR_NESW = 81, /**< diagonal arrow. */ +- FL_CURSOR_NONE =255, /**< invisible. */ +- // for back compatibility (non MSWindows ones): +- FL_CURSOR_N = 70, /**< for back compatibility. */ +- FL_CURSOR_NE = 69, /**< for back compatibility. */ +- FL_CURSOR_E = 49, /**< for back compatibility. */ +- FL_CURSOR_SE = 8, /**< for back compatibility. */ +- FL_CURSOR_S = 9, /**< for back compatibility. */ +- FL_CURSOR_SW = 7, /**< for back compatibility. */ +- FL_CURSOR_W = 36, /**< for back compatibility. */ +- FL_CURSOR_NW = 68 /**< for back compatibility. */ ++ FL_CURSOR_ARROW = 1, /**< an arrow pointer. */ ++ FL_CURSOR_CROSS = 2, /**< crosshair. */ ++ FL_CURSOR_WAIT = 3, /**< busy indicator (e.g. hourglass). */ ++ FL_CURSOR_INSERT = 4, /**< I-beam. */ ++ FL_CURSOR_HAND = 5, /**< pointing hand. */ ++ FL_CURSOR_HELP = 6, /**< question mark pointer. */ ++ FL_CURSOR_MOVE = 7, /**< 4-pointed arrow or hand. */ ++ ++ /* Resize indicators */ ++ FL_CURSOR_NS = 101, /**< up/down resize. */ ++ FL_CURSOR_WE = 102, /**< left/right resize. */ ++ FL_CURSOR_NWSE = 103, /**< diagonal resize. */ ++ FL_CURSOR_NESW = 104, /**< diagonal resize. */ ++ FL_CURSOR_NE = 110, /**< upwards, right resize. */ ++ FL_CURSOR_N = 111, /**< upwards resize. */ ++ FL_CURSOR_NW = 112, /**< upwards, left resize. */ ++ FL_CURSOR_E = 113, /**< leftwards resize. */ ++ FL_CURSOR_W = 114, /**< rightwards resize. */ ++ FL_CURSOR_SE = 115, /**< downwards, right resize. */ ++ FL_CURSOR_S = 116, /**< downwards resize. */ ++ FL_CURSOR_SW = 117, /**< downwards, left resize. */ ++ ++ FL_CURSOR_NONE = 255, /**< invisible. */ + }; + /*@}*/ // group: Cursors + +diff -up fltk-1.3.2/FL/fl_draw.H.cursor fltk-1.3.2/FL/fl_draw.H +--- fltk-1.3.2/FL/fl_draw.H.cursor 2012-05-08 18:15:34.000000000 +0200 ++++ fltk-1.3.2/FL/fl_draw.H 2013-01-30 16:07:59.530319891 +0100 +@@ -751,7 +751,8 @@ FL_EXPORT const char* fl_shortcut_label( + FL_EXPORT unsigned int fl_old_shortcut(const char* s); + FL_EXPORT void fl_overlay_rect(int x,int y,int w,int h); + FL_EXPORT void fl_overlay_clear(); +-FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg=FL_BLACK, Fl_Color bg=FL_WHITE); ++FL_EXPORT void fl_cursor(Fl_Cursor); ++FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg, Fl_Color bg=FL_WHITE); + FL_EXPORT const char* fl_expand_text(const char* from, char* buf, int maxbuf, + double maxw, int& n, double &width, + int wrap, int draw_symbols = 0); +diff -up fltk-1.3.2/FL/Fl_Window.H.cursor fltk-1.3.2/FL/Fl_Window.H +--- fltk-1.3.2/FL/Fl_Window.H.cursor 2012-11-06 21:46:14.000000000 +0100 ++++ fltk-1.3.2/FL/Fl_Window.H 2013-01-30 16:07:59.531319873 +0100 +@@ -28,6 +28,7 @@ + #define FL_DOUBLE_WINDOW 0xF1 ///< double window type id + + class Fl_X; ++class Fl_RGB_Image; + + /** + This widget produces an actual window. This can either be a main +@@ -81,7 +82,6 @@ class FL_EXPORT Fl_Window : public Fl_Gr + uchar size_range_set; + // cursor stuff + Fl_Cursor cursor_default; +- Fl_Color cursor_fg, cursor_bg; + void size_range_(); + void _Fl_Window(); // constructor innards + void fullscreen_x(); // platform-specific part of sending a window to full screen +@@ -466,14 +466,17 @@ public: + is different. + + The type Fl_Cursor is an enumeration defined in . +- (Under X you can get any XC_cursor value by passing +- Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are +- not implemented on WIN32. + +- For back compatibility only. ++ \see cursor(const Fl_RGB_Image*, int, int), default_cursor() + */ +- void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent +- void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); ++ void cursor(Fl_Cursor); ++ void cursor(const Fl_RGB_Image*, int, int); ++ void default_cursor(Fl_Cursor); ++ ++ /* for legacy compatibility */ ++ void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); ++ void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); ++ + static void default_callback(Fl_Window*, void* v); + + /** Returns the window width including any frame added by the window manager. +diff -up fltk-1.3.2/FL/mac.H.cursor fltk-1.3.2/FL/mac.H +--- fltk-1.3.2/FL/mac.H.cursor 2012-11-13 15:45:42.000000000 +0100 ++++ fltk-1.3.2/FL/mac.H 2013-01-30 16:07:59.531319873 +0100 +@@ -120,7 +120,8 @@ public: + void collapse(void); + WindowRef window_ref(void); + void set_key_window(void); +- void set_cursor(Fl_Cursor); ++ int set_cursor(Fl_Cursor); ++ int set_cursor(const Fl_RGB_Image*, int, int); + static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); + static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel); + static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h); +diff -up fltk-1.3.2/FL/win32.H.cursor fltk-1.3.2/FL/win32.H +--- fltk-1.3.2/FL/win32.H.cursor 2012-03-12 12:55:50.000000000 +0100 ++++ fltk-1.3.2/FL/win32.H 2013-01-30 16:07:59.531319873 +0100 +@@ -73,6 +73,7 @@ public: + int wait_for_expose; + HDC private_dc; // used for OpenGL + HCURSOR cursor; ++ int custom_cursor; + HDC saved_hdc; // saves the handle of the DC currently loaded + // static variables, static functions and member functions + static Fl_X* first; +@@ -83,6 +84,8 @@ public: + void flush() {w->flush();} + void set_minmax(LPMINMAXINFO minmax); + void mapraise(); ++ int set_cursor(Fl_Cursor); ++ int set_cursor(const Fl_RGB_Image*, int, int); + static Fl_X* make(Fl_Window*); + }; + extern FL_EXPORT HCURSOR fl_default_cursor; +diff -up fltk-1.3.2/FL/x.H.cursor fltk-1.3.2/FL/x.H +--- fltk-1.3.2/FL/x.H.cursor 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.2/FL/x.H 2013-01-30 16:07:59.532319855 +0100 +@@ -154,6 +154,8 @@ public: + static Fl_X* i(const Fl_Window* wi) {return wi->i;} + void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} + void sendxjunk(); ++ int set_cursor(Fl_Cursor); ++ int set_cursor(const Fl_RGB_Image*, int, int); + static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); + static Fl_X* set_xid(Fl_Window*, Window); + // kludges to get around protection: +diff -up fltk-1.3.2/src/CMakeLists.txt.cursor fltk-1.3.2/src/CMakeLists.txt +--- fltk-1.3.2/src/CMakeLists.txt.cursor 2013-01-30 16:09:11.981032475 +0100 ++++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:09:26.497774461 +0100 +@@ -247,6 +247,10 @@ if(HAVE_XFIXES) + target_link_libraries(fltk ${X11_Xfixes_LIB}) + endif(HAVE_XFIXES) + ++if(HAVE_XCURSOR) ++ target_link_libraries(fltk ${X11_Xcursor_LIB}) ++endif(HAVE_XCURSOR) ++ + if(USE_XFT) + target_link_libraries(fltk ${X11_Xft_LIB}) + endif(USE_XFT) +diff -up fltk-1.3.2/src/Fl_cocoa.mm.cursor fltk-1.3.2/src/Fl_cocoa.mm +--- fltk-1.3.2/src/Fl_cocoa.mm.cursor 2013-01-30 16:07:59.522320033 +0100 ++++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-30 16:07:59.533319837 +0100 +@@ -98,7 +98,6 @@ Fl_Display_Device *Fl_Display_Device::_d + CGContextRef fl_gc = 0; + void *fl_system_menu; // this is really a NSMenu* + Fl_Sys_Menu_Bar *fl_sys_menu_bar = 0; +-void *fl_default_cursor; // this is really a NSCursor* + void *fl_capture = 0; // (NSWindow*) we need this to compensate for a missing(?) mouse capture + bool fl_show_iconic; // true if called from iconize() - shows the next created window in collapsed state + //int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR +@@ -1392,8 +1391,6 @@ void fl_open_display() { + dequeue:YES]; + while (ign_event); + +- fl_default_cursor = [NSCursor arrowCursor]; +- + // bring the application into foreground without a 'CARB' resource + Boolean same_psn; + ProcessSerialNumber cur_psn, front_psn; +@@ -1698,6 +1695,7 @@ static void q_set_window_title(NSWindow + - (void)drawRect:(NSRect)rect; + - (BOOL)acceptsFirstResponder; + - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent; ++- (void)resetCursorRects; + - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; + - (void)mouseUp:(NSEvent *)theEvent; + - (void)rightMouseUp:(NSEvent *)theEvent; +@@ -1756,6 +1754,16 @@ static void q_set_window_title(NSWindow + Fl_Window *first = Fl::first_window(); + return (first == w || !first->modal()); + } ++- (void)resetCursorRects { ++ Fl_Window *w = [(FLWindow*)[self window] getFl_Window]; ++ Fl_X *i = Fl_X::i(w); ++ // We have to have at least one cursor rect for invalidateCursorRectsForView ++ // to work, hence the "else" clause. ++ if (i->cursor) ++ [self addCursorRect:[self visibleRect] cursor:(NSCursor*)i->cursor]; ++ else ++ [self addCursorRect:[self visibleRect] cursor:[NSCursor arrowCursor]]; ++} + - (void)mouseUp:(NSEvent *)theEvent { + cocoaMouseHandler(theEvent); + } +@@ -2331,7 +2339,7 @@ void Fl_X::make(Fl_Window* w) + x->other_xid = 0; + x->region = 0; + x->subRegion = 0; +- x->cursor = fl_default_cursor; ++ x->cursor = NULL; + x->gc = 0; // stay 0 for Quickdraw; fill with CGContext for Quartz + Fl_Window *win = w->window(); + Fl_X *xo = Fl_X::i(win); +@@ -2427,7 +2435,7 @@ void Fl_X::make(Fl_Window* w) + x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows + x->region = 0; + x->subRegion = 0; +- x->cursor = fl_default_cursor; ++ x->cursor = NULL; + x->xidChildren = 0; + x->xidNext = 0; + x->gc = 0; +@@ -2974,6 +2982,10 @@ void Fl_X::map() { + Fl_X::relink(w, w->window() ); + w->redraw(); + } ++ if (cursor) { ++ [(NSCursor*)cursor release]; ++ cursor = NULL; ++ } + } + + void Fl_X::unmap() { +@@ -3078,68 +3090,106 @@ static NSImage *CGBitmapContextToNSImage + return [image autorelease]; + } + +-static NSCursor *PrepareCursor(NSCursor *cursor, CGContextRef (*f)() ) ++int Fl_X::set_cursor(Fl_Cursor c) + { +- if (cursor == nil) { +- CGContextRef c = f(); +- NSImage *image = CGBitmapContextToNSImage(c); +- fl_delete_offscreen( (Fl_Offscreen)c ); +- NSPoint pt = {[image size].width/2, [image size].height/2}; +- cursor = [[NSCursor alloc] initWithImage:image hotSpot:pt]; ++ if (cursor) { ++ [(NSCursor*)cursor release]; ++ cursor = NULL; + } +- return cursor; +-} + +-void Fl_X::set_cursor(Fl_Cursor c) +-{ +- NSCursor *icrsr; + switch (c) { +- case FL_CURSOR_CROSS: icrsr = [NSCursor crosshairCursor]; break; +- case FL_CURSOR_WAIT: +- static NSCursor *watch = nil; +- watch = PrepareCursor(watch, &Fl_X::watch_cursor_image); +- icrsr = watch; +- break; +- case FL_CURSOR_INSERT: icrsr = [NSCursor IBeamCursor]; break; +- case FL_CURSOR_N: icrsr = [NSCursor resizeUpCursor]; break; +- case FL_CURSOR_S: icrsr = [NSCursor resizeDownCursor]; break; +- case FL_CURSOR_NS: icrsr = [NSCursor resizeUpDownCursor]; break; +- case FL_CURSOR_HELP: +- static NSCursor *help = nil; +- help = PrepareCursor(help, &Fl_X::help_cursor_image); +- icrsr = help; +- break; +- case FL_CURSOR_HAND: icrsr = [NSCursor pointingHandCursor]; break; +- case FL_CURSOR_MOVE: icrsr = [NSCursor openHandCursor]; break; +- case FL_CURSOR_NE: +- case FL_CURSOR_SW: +- case FL_CURSOR_NESW: +- static NSCursor *nesw = nil; +- nesw = PrepareCursor(nesw, &Fl_X::nesw_cursor_image); +- icrsr = nesw; +- break; +- case FL_CURSOR_E: icrsr = [NSCursor resizeRightCursor]; break; +- case FL_CURSOR_W: icrsr = [NSCursor resizeLeftCursor]; break; +- case FL_CURSOR_WE: icrsr = [NSCursor resizeLeftRightCursor]; break; +- case FL_CURSOR_SE: +- case FL_CURSOR_NW: +- case FL_CURSOR_NWSE: +- static NSCursor *nwse = nil; +- nwse = PrepareCursor(nwse, &Fl_X::nwse_cursor_image); +- icrsr = nwse; +- break; +- case FL_CURSOR_NONE: +- static NSCursor *none = nil; +- none = PrepareCursor(none, &Fl_X::none_cursor_image); +- icrsr = none; +- break; +- case FL_CURSOR_ARROW: +- case FL_CURSOR_DEFAULT: +- default: icrsr = [NSCursor arrowCursor]; +- break; ++ case FL_CURSOR_ARROW: cursor = [NSCursor arrowCursor]; break; ++ case FL_CURSOR_CROSS: cursor = [NSCursor crosshairCursor]; break; ++ case FL_CURSOR_INSERT: cursor = [NSCursor IBeamCursor]; break; ++ case FL_CURSOR_HAND: cursor = [NSCursor pointingHandCursor]; break; ++ case FL_CURSOR_MOVE: cursor = [NSCursor openHandCursor]; break; ++ case FL_CURSOR_NS: cursor = [NSCursor resizeUpDownCursor]; break; ++ case FL_CURSOR_WE: cursor = [NSCursor resizeLeftRightCursor]; break; ++ case FL_CURSOR_N: cursor = [NSCursor resizeUpCursor]; break; ++ case FL_CURSOR_E: cursor = [NSCursor resizeRightCursor]; break; ++ case FL_CURSOR_W: cursor = [NSCursor resizeLeftCursor]; break; ++ case FL_CURSOR_S: cursor = [NSCursor resizeDownCursor]; break; ++ default: ++ return 0; ++ } ++ ++ [(NSCursor*)cursor retain]; ++ ++ [(NSWindow*)xid invalidateCursorRectsForView:[(NSWindow*)xid contentView]]; ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ if (cursor) { ++ [(NSCursor*)cursor release]; ++ cursor = NULL; ++ } ++ ++ if ((hotx < 0) || (hotx >= image->w())) ++ return 0; ++ if ((hoty < 0) || (hoty >= image->h())) ++ return 0; ++ ++ // OS X >= 10.6 can create a NSImage from a CGImage, but we need to ++ // support older versions, hence this pesky handling. ++ ++ NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] ++ initWithBitmapDataPlanes:NULL ++ pixelsWide:image->w() ++ pixelsHigh:image->h() ++ bitsPerSample:8 ++ samplesPerPixel:image->d() ++ hasAlpha:!(image->d() & 1) ++ isPlanar:NO ++ colorSpaceName:(image->d()<=2) ? NSDeviceWhiteColorSpace : NSDeviceRGBColorSpace ++ bytesPerRow:(image->w() * image->d()) ++ bitsPerPixel:(image->d()*8)]; ++ ++ // Alpha needs to be premultiplied for this format ++ ++ const uchar *i = (const uchar*)*image->data(); ++ unsigned char *o = [bitmap bitmapData]; ++ for (int y = 0;y < image->h();y++) { ++ if (image->d() & 1) { ++ for (int x = 0;x < image->w();x++) { ++ unsigned int alpha; ++ if (image->d() == 4) { ++ alpha = i[3]; ++ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); ++ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); ++ } ++ ++ alpha = i[1]; ++ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); ++ *o++ = alpha; ++ i++; ++ } ++ } else { ++ // No alpha, so we can just copy everything directly. ++ int len = image->w() * image->d(); ++ memcpy(o, i, len); ++ o += len; ++ i += len; ++ } ++ i += image->ld(); + } +- [icrsr set]; +- cursor = icrsr; ++ ++ NSImage *nsimage = [[NSImage alloc] ++ initWithSize:NSMakeSize(image->w(), image->h())]; ++ ++ [nsimage addRepresentation:bitmap]; ++ ++ cursor = [[NSCursor alloc] ++ initWithImage:nsimage ++ hotSpot:NSMakePoint(hotx, hoty)]; ++ ++ [(NSWindow*)xid invalidateCursorRectsForView:[(NSWindow*)xid contentView]]; ++ ++ [bitmap release]; ++ [nsimage release]; ++ ++ return 1; + } + + @interface FLaboutItemTarget : NSObject +diff -up fltk-1.3.2/src/fl_cursor.cxx.cursor fltk-1.3.2/src/fl_cursor.cxx +--- fltk-1.3.2/src/fl_cursor.cxx.cursor 2012-03-12 12:55:50.000000000 +0100 ++++ fltk-1.3.2/src/fl_cursor.cxx 2013-01-30 16:07:59.534319820 +0100 +@@ -24,297 +24,165 @@ + + #include + #include ++#include ++#include + #include +-#if !defined(WIN32) && !defined(__APPLE__) +-# include +-#endif + #include + ++#include "fl_cursor_wait.xpm" ++#include "fl_cursor_help.xpm" ++#include "fl_cursor_nwse.xpm" ++#include "fl_cursor_nesw.xpm" ++#include "fl_cursor_none.xpm" ++ + /** + Sets the cursor for the current window to the specified shape and colors. + The cursors are defined in the header file. + */ ++void fl_cursor(Fl_Cursor c) { ++ if (Fl::first_window()) Fl::first_window()->cursor(c); ++} ++ ++/* For back compatibility only. */ + void fl_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { +- if (Fl::first_window()) Fl::first_window()->cursor(c,fg,bg); ++ fl_cursor(c); + } ++ ++ + /** +- Sets the default window cursor as well as its color. ++ Sets the default window cursor. This is the cursor that will be used ++ after the mouse pointer leaves a widget with a custom cursor set. + +- For back compatibility only. ++ \see cursor(const Fl_RGB_Image*, int, int), default_cursor() + */ +-void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { +-// if (c == FL_CURSOR_DEFAULT) c = FL_CURSOR_ARROW; +- ++void Fl_Window::default_cursor(Fl_Cursor c) { + cursor_default = c; +- cursor_fg = fg; +- cursor_bg = bg; ++ cursor(c); ++} ++ ++ ++void fallback_cursor(Fl_Window *w, Fl_Cursor c) { ++ const char **xpm; ++ int hotx, hoty; ++ ++ // The standard arrow is our final fallback, so something is broken ++ // if we get called back here with that as an argument. ++ if (c == FL_CURSOR_ARROW) ++ return; ++ ++ switch (c) { ++ case FL_CURSOR_WAIT: ++ xpm = (const char**)fl_cursor_wait_xpm; ++ hotx = 8; ++ hoty = 15; ++ break; ++ case FL_CURSOR_HELP: ++ xpm = (const char**)fl_cursor_help_xpm; ++ hotx = 1; ++ hoty = 3; ++ break; ++ case FL_CURSOR_NWSE: ++ xpm = (const char**)fl_cursor_nwse_xpm; ++ hotx = 7; ++ hoty = 7; ++ break; ++ case FL_CURSOR_NESW: ++ xpm = (const char**)fl_cursor_nesw_xpm; ++ hotx = 7; ++ hoty = 7; ++ break; ++ case FL_CURSOR_NONE: ++ xpm = (const char**)fl_cursor_none_xpm; ++ hotx = 0; ++ hoty = 0; ++ break; ++ default: ++ w->cursor(FL_CURSOR_ARROW); ++ return; ++ } + +- cursor(c, fg, bg); ++ Fl_Pixmap pxm(xpm); ++ Fl_RGB_Image image(&pxm); ++ ++ w->cursor(&image, hotx, hoty); + } + +-#ifdef WIN32 + +-# ifndef IDC_HAND +-# define IDC_HAND MAKEINTRESOURCE(32649) +-# endif // !IDC_HAND ++void Fl_Window::cursor(Fl_Cursor c) { ++ int ret; + +-void Fl_Window::cursor(Fl_Cursor c, Fl_Color c1, Fl_Color c2) { +- if (!shown()) return; + // the cursor must be set for the top level window, not for subwindows + Fl_Window *w = window(), *toplevel = this; +- while (w) { toplevel = w; w = w->window(); } +- if (toplevel != this) { toplevel->cursor(c, c1, c2); return; } +- // now set the actual cursor +- if (c == FL_CURSOR_DEFAULT) { +- c = cursor_default; +- } +- if (c > FL_CURSOR_NESW) { +- i->cursor = 0; +- } else if (c == FL_CURSOR_DEFAULT) { +- i->cursor = fl_default_cursor; +- } else { +- LPSTR n; +- switch (c) { +- case FL_CURSOR_ARROW: n = IDC_ARROW; break; +- case FL_CURSOR_CROSS: n = IDC_CROSS; break; +- case FL_CURSOR_WAIT: n = IDC_WAIT; break; +- case FL_CURSOR_INSERT: n = IDC_IBEAM; break; +- case FL_CURSOR_HELP: n = IDC_HELP; break; +- case FL_CURSOR_HAND: { +- OSVERSIONINFO osvi; +- +- // Get the OS version: Windows 98 and 2000 have a standard +- // hand cursor. +- memset(&osvi, 0, sizeof(OSVERSIONINFO)); +- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); +- GetVersionEx(&osvi); +- +- if (osvi.dwMajorVersion > 4 || +- (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion > 0 && +- osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)) n = IDC_HAND; +- else n = IDC_UPARROW; +- } break; +- case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; +- case FL_CURSOR_N: +- case FL_CURSOR_S: +- case FL_CURSOR_NS: n = IDC_SIZENS; break; +- case FL_CURSOR_NE: +- case FL_CURSOR_SW: +- case FL_CURSOR_NESW: n = IDC_SIZENESW; break; +- case FL_CURSOR_E: +- case FL_CURSOR_W: +- case FL_CURSOR_WE: n = IDC_SIZEWE; break; +- case FL_CURSOR_SE: +- case FL_CURSOR_NW: +- case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; +- default: n = IDC_NO; break; +- } +- i->cursor = LoadCursor(NULL, n); ++ ++ while (w) { ++ toplevel = w; ++ w = w->window(); + } +- SetCursor(i->cursor); +-} + +-#elif defined(__APPLE__) ++ if (toplevel != this) { ++ toplevel->cursor(c); ++ return; ++ } + +-#ifdef __BIG_ENDIAN__ +-# define E(x) x +-#elif defined __LITTLE_ENDIAN__ +-// Don't worry. This will be resolved at compile time +-# define E(x) (x>>8)|((x<<8)&0xff00) +-#else +-# error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined" +-#endif +- +-CGContextRef Fl_X::help_cursor_image(void) +-{ +- int w = 20, h = 20; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- fl_color(FL_BLACK); +- fl_font(FL_COURIER_BOLD, 20); +- fl_draw("?", 1, h-1); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} ++ if (c == FL_CURSOR_DEFAULT) ++ c = cursor_default; + +-CGContextRef Fl_X::none_cursor_image(void) +-{ +- int w = 20, h = 20; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} ++ if (!i) ++ return; + +-CGContextRef Fl_X::watch_cursor_image(void) +-{ +- int w, h, r = 5; +- w = 2*r+6; +- h = 4*r; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- CGContextTranslateCTM( (CGContextRef)off, w/2, h/2); +- fl_color(FL_WHITE); +- fl_circle(0, 0, r+1); +- fl_color(FL_BLACK); +- fl_rectf(int(-r*0.7), int(-r*1.7), int(1.4*r), int(3.4*r)); +- fl_rectf(r-1, -1, 3, 3); +- fl_color(FL_WHITE); +- fl_pie(-r, -r, 2*r, 2*r, 0, 360); +- fl_color(FL_BLACK); +- fl_circle(0,0,r); +- fl_xyline(0, 0, int(-r*.7)); +- fl_xyline(0, 0, 0, int(-r*.7)); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} ++ ret = i->set_cursor(c); ++ if (ret) ++ return; + +-CGContextRef Fl_X::nesw_cursor_image(void) +-{ +- int c = 7, r = 2*c; +- int w = r, h = r; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- CGContextTranslateCTM( (CGContextRef)off, 0, h); +- CGContextScaleCTM( (CGContextRef)off, 1, -1); +- fl_color(FL_BLACK); +- fl_polygon(0, 0, c, 0, 0, c); +- fl_polygon(r, r, r, r-c, r-c, r); +- fl_line_style(FL_SOLID, 2, 0); +- fl_line(0,1, r,r+1); +- fl_line_style(FL_SOLID, 0, 0); +- fl_end_offscreen(); +- return (CGContextRef)off; ++ fallback_cursor(this, c); + } + +-CGContextRef Fl_X::nwse_cursor_image(void) +-{ +- int c = 7, r = 2*c; +- int w = r, h = r; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- CGContextTranslateCTM( (CGContextRef)off, 0, h); +- CGContextScaleCTM( (CGContextRef)off, 1, -1); +- fl_color(FL_BLACK); +- fl_polygon(r-1, 0, r-1, c, r-1-c, 0); +- fl_polygon(-1, r, c-1, r, -1, r-c); +- fl_line_style(FL_SOLID, 2, 0); +- fl_line(r-1,1, -1,r+1); +- fl_line_style(FL_SOLID, 0, 0); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} +- +-void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { +- if (c == FL_CURSOR_DEFAULT) { +- c = cursor_default; +- } +- if (i) i->set_cursor(c); +-} ++/** ++ Changes the cursor for this window. This always calls the system, if ++ you are changing the cursor a lot you may want to keep track of how ++ you set it in a static variable and call this only if the new cursor ++ is different. + +-#else ++ The default cursor will be used if the provided image cannot be used ++ as a cursor. + +-// I like the MSWindows resize cursors, so I duplicate them here: ++ \see cursor(Fl_Cursor), default_cursor() ++*/ ++void Fl_Window::cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ int ret; + +-#define CURSORSIZE 16 +-#define HOTXY 7 +-static struct TableEntry { +- uchar bits[CURSORSIZE*CURSORSIZE/8]; +- uchar mask[CURSORSIZE*CURSORSIZE/8]; +- Cursor cursor; +-} table[] = { +- {{ // FL_CURSOR_NS +- 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0x80, 0x01, 0x80, 0x01, +- 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, +- 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00}, +- { +- 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0xc0, 0x03, +- 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xf0, 0x0f, +- 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}}, +- {{ // FL_CURSOR_EW +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, +- 0x0c, 0x30, 0xfe, 0x7f, 0xfe, 0x7f, 0x0c, 0x30, 0x08, 0x10, 0x00, 0x00, +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, +- { +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1c, 0x38, +- 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, +- {{ // FL_CURSOR_NWSE +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x38, 0x00, 0x78, 0x00, +- 0xe8, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x17, 0x00, 0x1e, 0x00, 0x1c, +- 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, +- { +- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x7c, 0x00, 0xfc, 0x00, +- 0xfc, 0x01, 0xec, 0x03, 0xc0, 0x37, 0x80, 0x3f, 0x00, 0x3f, 0x00, 0x3e, +- 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00}}, +- {{ // FL_CURSOR_NESW +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x1c, 0x00, 0x1e, +- 0x00, 0x17, 0x80, 0x03, 0xc0, 0x01, 0xe8, 0x00, 0x78, 0x00, 0x38, 0x00, +- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, +- { +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3f, +- 0x80, 0x3f, 0xc0, 0x37, 0xec, 0x03, 0xfc, 0x01, 0xfc, 0x00, 0x7c, 0x00, +- 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00}}, +- {{0}, {0}} // FL_CURSOR_NONE & unknown +-}; ++ // the cursor must be set for the top level window, not for subwindows ++ Fl_Window *w = window(), *toplevel = this; + +-void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { +- if (!shown()) return; +- Cursor xc; +- int deleteit = 0; +- if (c == FL_CURSOR_DEFAULT) { +- c = cursor_default; +- fg = cursor_fg; +- bg = cursor_bg; ++ while (w) { ++ toplevel = w; ++ w = w->window(); + } + +- if (!c) { +- xc = None; +- } else { +- if (c >= FL_CURSOR_NS) { +- TableEntry *q = (c > FL_CURSOR_NESW) ? table+4 : table+(c-FL_CURSOR_NS); +- if (!(q->cursor)) { +- XColor dummy = { 0 }; +- Pixmap p = XCreateBitmapFromData(fl_display, +- RootWindow(fl_display, fl_screen), (const char*)(q->bits), +- CURSORSIZE, CURSORSIZE); +- Pixmap m = XCreateBitmapFromData(fl_display, +- RootWindow(fl_display, fl_screen), (const char*)(q->mask), +- CURSORSIZE, CURSORSIZE); +- q->cursor = XCreatePixmapCursor(fl_display, p,m,&dummy, &dummy, +- HOTXY, HOTXY); +- XFreePixmap(fl_display, m); +- XFreePixmap(fl_display, p); +- } +- xc = q->cursor; +- } else { +- xc = XCreateFontCursor(fl_display, (c-1)*2); +- deleteit = 1; +- } +- XColor fgc; +- uchar r,g,b; +- Fl::get_color(fg,r,g,b); +- fgc.red = r<<8; fgc.green = g<<8; fgc.blue = b<<8; +- XColor bgc; +- Fl::get_color(bg,r,g,b); +- bgc.red = r<<8; bgc.green = g<<8; bgc.blue = b<<8; +- XRecolorCursor(fl_display, xc, &fgc, &bgc); ++ if (toplevel != this) { ++ toplevel->cursor(image, hotx, hoty); ++ return; + } +- XDefineCursor(fl_display, fl_xid(this), xc); +- if (deleteit) XFreeCursor(fl_display, xc); ++ ++ if (!i) ++ return; ++ ++ ret = i->set_cursor(image, hotx, hoty); ++ if (ret) ++ return; ++ ++ cursor(FL_CURSOR_DEFAULT); + } + +-#endif ++/* For back compatibility only. */ ++void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { ++ cursor(c); ++}; ++ ++void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color, Fl_Color) { ++ default_cursor(c); ++}; ++ + + // + // End of "$Id: fl_cursor.cxx 9278 2012-03-12 11:55:50Z manolo $". +diff -up fltk-1.3.2/src/fl_cursor_help.xpm.cursor fltk-1.3.2/src/fl_cursor_help.xpm +--- fltk-1.3.2/src/fl_cursor_help.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_help.xpm 2013-01-30 16:07:59.534319820 +0100 +@@ -0,0 +1,95 @@ ++/* XPM */ ++static const char * fl_cursor_help_xpm[] = { ++"16 27 65 1", ++" c None", ++". c #FFFFFF", ++"+ c #E2E2E2", ++"@ c #1C1C1C", ++"# c #E7E7E7", ++"$ c #000000", ++"% c #212121", ++"& c #EAEAEA", ++"* c #262626", ++"= c #EDEDED", ++"- c #2C2C2C", ++"; c #F0F0F0", ++"> c #333333", ++", c #F1F1F1", ++"' c #393939", ++") c #F3F3F3", ++"! c #404040", ++"~ c #484848", ++"{ c #F4F4F4", ++"] c #050505", ++"^ c #202020", ++"/ c #707070", ++"( c #F5F5F5", ++"_ c #040404", ++": c #E1E1E1", ++"< c #EEEEEE", ++"[ c #EFEFEF", ++"} c #FEFEFE", ++"| c #3D3D3D", ++"1 c #7E7E7E", ++"2 c #696969", ++"3 c #414141", ++"4 c #131313", ++"5 c #080808", ++"6 c #454545", ++"7 c #F2F2F2", ++"8 c #878787", ++"9 c #7D7D7D", ++"0 c #101010", ++"a c #111111", ++"b c #FDFDFD", ++"c c #8A8A8A", ++"d c #E6E6E6", ++"e c #7B7B7B", ++"f c #4C4C4C", ++"g c #5C5C5C", ++"h c #9F9F9F", ++"i c #F9F9F9", ++"j c #F7F7F7", ++"k c #B1B1B1", ++"l c #2E2E2E", ++"m c #767676", ++"n c #DCDCDC", ++"o c #DEDEDE", ++"p c #C7C7C7", ++"q c #1B1B1B", ++"r c #6B6B6B", ++"s c #575757", ++"t c #797979", ++"u c #020202", ++"v c #010101", ++"w c #FBFBFB", ++"x c #D7D7D7", ++"y c #D8D8D8", ++"z c #060606", ++" ", ++". ", ++".+ ", ++".@# ", ++".$%& ", ++".$$*= ", ++".$$$-; ", ++".$$$$>, ", ++".$$$$$') ", ++".$$$$$$!) ", ++".$$$$$$$~{ ", ++".$$$$]^^^/( ", ++".$$$$_:(<<[} ", ++".$$|1$2< ", ++".$3,(45[ ", ++".67 78$9, ", ++".7 {0a( .... ", ++"b ,c5[defgh, ", ++" )ijk_la$m.", ++" no.p$q.", ++" .r$s.", ++" .t$-= ", ++" 7uv+ ", ++" wxy. ", ++" :$z. ", ++" :$z. ", ++" .... "}; +diff -up fltk-1.3.2/src/fl_cursor_nesw.xpm.cursor fltk-1.3.2/src/fl_cursor_nesw.xpm +--- fltk-1.3.2/src/fl_cursor_nesw.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_nesw.xpm 2013-01-30 16:07:59.534319820 +0100 +@@ -0,0 +1,46 @@ ++/* XPM */ ++static const char * fl_cursor_nesw_xpm[] = { ++"15 15 28 1", ++" c None", ++". c #FFFFFF", ++"+ c #767676", ++"@ c #000000", ++"# c #4E4E4E", ++"$ c #0C0C0C", ++"% c #494949", ++"& c #4D4D4D", ++"* c #1B1B1B", ++"= c #515151", ++"- c #646464", ++"; c #363636", ++"> c #6A6A6A", ++", c #545454", ++"' c #585858", ++") c #242424", ++"! c #797979", ++"~ c #2E2E2E", ++"{ c #444444", ++"] c #3B3B3B", ++"^ c #0A0A0A", ++"/ c #595959", ++"( c #F7F7F7", ++"_ c #080808", ++": c #6B6B6B", ++"< c #FDFDFD", ++"[ c #FCFCFC", ++"} c #FEFEFE", ++" ..........", ++" .+@@@@@@.", ++" .#@@@@@.", ++" .$@@@@.", ++" .%@@@@@.", ++". .&@@@*@@.", ++".. .=@@@-.;@.", ++".>. .,@@@'. .).", ++".@!.'@@@#. ..", ++".@@~@@@{. .", ++".@@@@@]. ", ++".@@@@^. ", ++".@@@@@/( ", ++".______:( ", ++"<[[[[[[[[} "}; +diff -up fltk-1.3.2/src/fl_cursor_none.xpm.cursor fltk-1.3.2/src/fl_cursor_none.xpm +--- fltk-1.3.2/src/fl_cursor_none.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_none.xpm 2013-01-30 16:07:59.534319820 +0100 +@@ -0,0 +1,19 @@ ++/* XPM */ ++static const char * fl_cursor_none_xpm[] = { ++"15 15 1 1", ++" c None", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" "}; +diff -up fltk-1.3.2/src/fl_cursor_nwse.xpm.cursor fltk-1.3.2/src/fl_cursor_nwse.xpm +--- fltk-1.3.2/src/fl_cursor_nwse.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_nwse.xpm 2013-01-30 16:07:59.535319802 +0100 +@@ -0,0 +1,46 @@ ++/* XPM */ ++static const char * fl_cursor_nwse_xpm[] = { ++"15 15 28 1", ++" c None", ++". c #FFFFFF", ++"+ c #000000", ++"@ c #767676", ++"# c #4E4E4E", ++"$ c #0C0C0C", ++"% c #494949", ++"& c #1B1B1B", ++"* c #4D4D4D", ++"= c #363636", ++"- c #646464", ++"; c #515151", ++"> c #242424", ++", c #585858", ++"' c #545454", ++") c #6A6A6A", ++"! c #797979", ++"~ c #444444", ++"{ c #2E2E2E", ++"] c #3B3B3B", ++"^ c #0A0A0A", ++"/ c #F7F7F7", ++"( c #595959", ++"_ c #6B6B6B", ++": c #080808", ++"< c #FEFEFE", ++"[ c #FCFCFC", ++"} c #FDFDFD", ++".......... ", ++".++++++@. ", ++".+++++#. ", ++".++++$. ", ++".+++++%. ", ++".++&+++*. .", ++".+=.-+++;. ..", ++".>. .,+++'. .).", ++".. .#+++,.!+.", ++". .~+++{++.", ++" .]+++++.", ++" .^++++.", ++" /(+++++.", ++" /_::::::.", ++" <[[[[[[[[}"}; +diff -up fltk-1.3.2/src/fl_cursor_wait.xpm.cursor fltk-1.3.2/src/fl_cursor_wait.xpm +--- fltk-1.3.2/src/fl_cursor_wait.xpm.cursor 2013-01-30 16:07:59.535319802 +0100 ++++ fltk-1.3.2/src/fl_cursor_wait.xpm 2013-01-30 16:07:59.535319802 +0100 +@@ -0,0 +1,72 @@ ++/* XPM */ ++static const char * fl_cursor_wait_xpm[] = { ++"17 32 37 1", ++" c None", ++". c #FFFFFF", ++"+ c #2E2E2E", ++"@ c #202020", ++"# c #F1F1F1", ++"$ c #2D2D2D", ++"% c #000000", ++"& c #EDEDED", ++"* c #585858", ++"= c #575757", ++"- c #FBFBFB", ++"; c #848484", ++"> c #B8B8B8", ++", c #E5E5E5", ++"' c #F7F7F7", ++") c #181818", ++"! c #F0F0F0", ++"~ c #616161", ++"{ c #B7B7B7", ++"] c #F5F5F5", ++"^ c #050505", ++"/ c #D4D4D4", ++"( c #EEEEEE", ++"_ c #595959", ++": c #7B7B7B", ++"< c #E9E9E9", ++"[ c #131313", ++"} c #E3E3E3", ++"| c #767676", ++"1 c #505050", ++"2 c #F3F3F3", ++"3 c #2A2A2A", ++"4 c #070707", ++"5 c #343434", ++"6 c #939393", ++"7 c #191919", ++"8 c #6A6A6A", ++".................", ++".+@@@@@@@@@@@@@+.", ++".................", ++" #$%%%%%%%%%%%$# ", ++" &*%%%%%%%%%%%=& ", ++" -;%%%%%%%%%%%;- ", ++" >%%%%%%%%%%%> ", ++" ,%%%%%%%%%%%, ", ++" ')%%%%%%%%%)' ", ++" !~%%%%%%%%%~! ", ++" {%%%%%%%%%{ ", ++" ]^/...../^] ", ++" (_:.....:_( ", ++" <[}...}[< ", ++" !|1...1|! ", ++" 2[3.3[2 ", ++" 2[%.%[2 ", ++" !|%%.%%|! ", ++" <4%%.%%4< ", ++" (_%%%.%%%_( ", ++" ]^%%%.%%%^] ", ++" {%%%%.%%%%{ ", ++" !~%%%%.%%%%~! ", ++" ')%%%%.%%%%)' ", ++" ,%%56{.{65%%, ", ++" >%*.......*%> ", ++" -;7&.......&7;- ", ++" &*8.........8=& ", ++" #$%%%%%%%%%%%$# ", ++".................", ++".+@@@@@@@@@@@@@+.", ++"................."}; +diff -up fltk-1.3.2/src/Fl_win32.cxx.cursor fltk-1.3.2/src/Fl_win32.cxx +--- fltk-1.3.2/src/Fl_win32.cxx.cursor 2013-01-30 16:07:59.519320086 +0100 ++++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-30 16:07:59.536319784 +0100 +@@ -1633,7 +1633,6 @@ void fl_fix_focus(); // in Fl.cxx + + char fl_show_iconic; // hack for Fl_Window::iconic() + // int fl_background_pixel = -1; // color to use for background +-HCURSOR fl_default_cursor; + UINT fl_wake_msg = 0; + int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR + +@@ -1682,7 +1681,7 @@ Fl_X* Fl_X::make(Fl_Window* w) { + if (!w->icon()) + w->icon((void *)LoadIcon(NULL, IDI_APPLICATION)); + wcw.hIcon = wcw.hIconSm = (HICON)w->icon(); +- wcw.hCursor = fl_default_cursor = LoadCursor(NULL, IDC_ARROW); ++ wcw.hCursor = LoadCursor(NULL, IDC_ARROW); + //uchar r,g,b; Fl::get_color(FL_GRAY,r,g,b); + //wc.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(r,g,b)); + wcw.hbrBackground = NULL; +@@ -1774,7 +1773,8 @@ Fl_X* Fl_X::make(Fl_Window* w) { + x->setwindow(w); + x->region = 0; + x->private_dc = 0; +- x->cursor = fl_default_cursor; ++ x->cursor = LoadCursor(NULL, IDC_ARROW); ++ x->custom_cursor = 0; + if (!fl_codepage) fl_get_codepage(); + + WCHAR *lab = NULL; +@@ -2025,6 +2025,153 @@ void Fl_Window::label(const char *name,c + } + + //////////////////////////////////////////////////////////////// ++ ++#ifndef IDC_HAND ++# define IDC_HAND MAKEINTRESOURCE(32649) ++#endif // !IDC_HAND ++ ++int Fl_X::set_cursor(Fl_Cursor c) { ++ LPSTR n; ++ HCURSOR new_cursor; ++ ++ if (c == FL_CURSOR_NONE) ++ new_cursor = NULL; ++ else { ++ switch (c) { ++ case FL_CURSOR_ARROW: n = IDC_ARROW; break; ++ case FL_CURSOR_CROSS: n = IDC_CROSS; break; ++ case FL_CURSOR_WAIT: n = IDC_WAIT; break; ++ case FL_CURSOR_INSERT: n = IDC_IBEAM; break; ++ case FL_CURSOR_HAND: n = IDC_HAND; break; ++ case FL_CURSOR_HELP: n = IDC_HELP; break; ++ case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; ++ case FL_CURSOR_N: ++ case FL_CURSOR_S: ++ // FIXME: Should probably have fallbacks for these instead ++ case FL_CURSOR_NS: n = IDC_SIZENS; break; ++ case FL_CURSOR_NE: ++ case FL_CURSOR_SW: ++ // FIXME: Dito. ++ case FL_CURSOR_NESW: n = IDC_SIZENESW; break; ++ case FL_CURSOR_E: ++ case FL_CURSOR_W: ++ // FIXME: Dito. ++ case FL_CURSOR_WE: n = IDC_SIZEWE; break; ++ case FL_CURSOR_SE: ++ case FL_CURSOR_NW: ++ // FIXME: Dito. ++ case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; ++ default: ++ return 0; ++ } ++ ++ new_cursor = LoadCursor(NULL, n); ++ if (new_cursor == NULL) ++ return 0; ++ } ++ ++ if ((cursor != NULL) && custom_cursor) ++ DestroyIcon(cursor); ++ ++ cursor = new_cursor; ++ custom_cursor = 0; ++ ++ SetCursor(cursor); ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ BITMAPV5HEADER bi; ++ HBITMAP bitmap, mask; ++ DWORD *bits; ++ HCURSOR new_cursor; ++ ++ if ((hotx < 0) || (hotx >= image->w())) ++ return 0; ++ if ((hoty < 0) || (hoty >= image->h())) ++ return 0; ++ ++ memset(&bi, 0, sizeof(BITMAPV5HEADER)); ++ ++ bi.bV5Size = sizeof(BITMAPV5HEADER); ++ bi.bV5Width = image->w(); ++ bi.bV5Height = -image->h(); // Negative for top-down ++ bi.bV5Planes = 1; ++ bi.bV5BitCount = 32; ++ bi.bV5Compression = BI_BITFIELDS; ++ bi.bV5RedMask = 0x00FF0000; ++ bi.bV5GreenMask = 0x0000FF00; ++ bi.bV5BlueMask = 0x000000FF; ++ bi.bV5AlphaMask = 0xFF000000; ++ ++ HDC hdc; ++ ++ hdc = GetDC(NULL); ++ bitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); ++ ReleaseDC(NULL, hdc); ++ ++ if (bits == NULL) ++ return 0; ++ ++ const uchar *i = (const uchar*)*image->data(); ++ for (int y = 0;y < image->h();y++) { ++ for (int x = 0;x < image->w();x++) { ++ switch (image->d()) { ++ case 1: ++ *bits = (0xff<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 2: ++ *bits = (i[1]<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 3: ++ *bits = (0xff<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ case 4: ++ *bits = (i[3]<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ } ++ i += image->d(); ++ bits++; ++ } ++ i += image->ld(); ++ } ++ ++ // A mask bitmap is still needed even though it isn't used ++ mask = CreateBitmap(image->w(),image->h(),1,1,NULL); ++ if (mask == NULL) { ++ DeleteObject(bitmap); ++ return 0; ++ } ++ ++ ICONINFO ii; ++ ++ ii.fIcon = FALSE; ++ ii.xHotspot = hotx; ++ ii.yHotspot = hoty; ++ ii.hbmMask = mask; ++ ii.hbmColor = bitmap; ++ ++ new_cursor = CreateIconIndirect(&ii); ++ ++ DeleteObject(bitmap); ++ DeleteObject(mask); ++ ++ if (new_cursor == NULL) ++ return 0; ++ ++ if ((cursor != NULL) && custom_cursor) ++ DestroyIcon(cursor); ++ ++ cursor = new_cursor; ++ custom_cursor = 1; ++ ++ SetCursor(cursor); ++ ++ return 1; ++} ++ ++//////////////////////////////////////////////////////////////// + // Implement the virtual functions for the base Fl_Window class: + + // If the box is a filled rectangle, we can make the redisplay *look* +diff -up fltk-1.3.2/src/Fl_Window.cxx.cursor fltk-1.3.2/src/Fl_Window.cxx +--- fltk-1.3.2/src/Fl_Window.cxx.cursor 2012-11-06 21:46:14.000000000 +0100 ++++ fltk-1.3.2/src/Fl_Window.cxx 2013-01-30 16:07:59.536319784 +0100 +@@ -62,8 +62,6 @@ void Fl_Window::_Fl_Window() { + Fl_Window::Fl_Window(int X,int Y,int W, int H, const char *l) + : Fl_Group(X, Y, W, H, l) { + cursor_default = FL_CURSOR_DEFAULT; +- cursor_fg = FL_BLACK; +- cursor_bg = FL_WHITE; + + _Fl_Window(); + set_flag(FORCE_POSITION); +@@ -73,8 +71,6 @@ Fl_Window::Fl_Window(int W, int H, const + // fix common user error of a missing end() with current(0): + : Fl_Group((Fl_Group::current(0),0), 0, W, H, l) { + cursor_default = FL_CURSOR_DEFAULT; +- cursor_fg = FL_BLACK; +- cursor_bg = FL_WHITE; + + _Fl_Window(); + clear_visible(); +diff -up fltk-1.3.2/src/Fl_x.cxx.cursor fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2/src/Fl_x.cxx.cursor 2013-01-30 16:07:59.512320211 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:07:59.537319766 +0100 +@@ -59,6 +59,11 @@ static int xfixes_event_base = 0; + static bool have_xfixes = false; + # endif + ++# include ++ ++# if HAVE_XCURSOR ++# include ++# endif + static Fl_Xlib_Graphics_Driver fl_xlib_driver; + static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display +@@ -2259,6 +2264,94 @@ void Fl_Window::size_range_() { + } + + //////////////////////////////////////////////////////////////// ++ ++int Fl_X::set_cursor(Fl_Cursor c) { ++ unsigned int shape; ++ Cursor xc; ++ ++ switch (c) { ++ case FL_CURSOR_ARROW: shape = XC_left_ptr; break; ++ case FL_CURSOR_CROSS: shape = XC_tcross; break; ++ case FL_CURSOR_WAIT: shape = XC_watch; break; ++ case FL_CURSOR_INSERT: shape = XC_xterm; break; ++ case FL_CURSOR_HAND: shape = XC_hand2; break; ++ case FL_CURSOR_HELP: shape = XC_question_arrow; break; ++ case FL_CURSOR_MOVE: shape = XC_fleur; break; ++ case FL_CURSOR_NS: shape = XC_sb_v_double_arrow; break; ++ case FL_CURSOR_WE: shape = XC_sb_h_double_arrow; break; ++ case FL_CURSOR_NE: shape = XC_top_right_corner; break; ++ case FL_CURSOR_N: shape = XC_top_side; break; ++ case FL_CURSOR_NW: shape = XC_top_left_corner; break; ++ case FL_CURSOR_E: shape = XC_right_side; break; ++ case FL_CURSOR_W: shape = XC_left_side; break; ++ case FL_CURSOR_SE: shape = XC_bottom_right_corner; break; ++ case FL_CURSOR_S: shape = XC_bottom_side; break; ++ case FL_CURSOR_SW: shape = XC_bottom_left_corner; break; ++ default: ++ return 0; ++ } ++ ++ xc = XCreateFontCursor(fl_display, shape); ++ XDefineCursor(fl_display, xid, xc); ++ XFreeCursor(fl_display, xc); ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++#if ! HAVE_XCURSOR ++ return 0; ++#else ++ XcursorImage *cursor; ++ Cursor xc; ++ ++ if ((hotx < 0) || (hotx >= image->w())) ++ return 0; ++ if ((hoty < 0) || (hoty >= image->h())) ++ return 0; ++ ++ cursor = XcursorImageCreate(image->w(), image->h()); ++ if (!cursor) ++ return 0; ++ ++ const uchar *i = (const uchar*)*image->data(); ++ XcursorPixel *o = cursor->pixels; ++ for (int y = 0;y < image->h();y++) { ++ for (int x = 0;x < image->w();x++) { ++ switch (image->d()) { ++ case 1: ++ *o = (0xff<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 2: ++ *o = (i[1]<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 3: ++ *o = (0xff<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ case 4: ++ *o = (i[3]<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ } ++ i += image->d(); ++ o++; ++ } ++ i += image->ld(); ++ } ++ ++ cursor->xhot = hotx; ++ cursor->yhot = hoty; ++ ++ xc = XcursorImageLoadCursor(fl_display, cursor); ++ XDefineCursor(fl_display, xid, xc); ++ XFreeCursor(fl_display, xc); ++ ++ XcursorImageDestroy(cursor); ++ ++ return 1; ++#endif ++} ++ ++//////////////////////////////////////////////////////////////// + + // returns pointer to the filename, or null if name ends with '/' + const char *fl_filename_name(const char *name) { +diff -up fltk-1.3.2/test/cursor.cxx.cursor fltk-1.3.2/test/cursor.cxx +--- fltk-1.3.2/test/cursor.cxx.cursor 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/test/cursor.cxx 2013-01-30 16:07:59.537319766 +0100 +@@ -23,8 +23,6 @@ + #include + #include + +-Fl_Color fg = FL_BLACK; +-Fl_Color bg = FL_WHITE; + Fl_Cursor cursor = FL_CURSOR_DEFAULT; + + Fl_Hor_Value_Slider *cursor_slider; +@@ -32,7 +30,7 @@ Fl_Hor_Value_Slider *cursor_slider; + void choice_cb(Fl_Widget *, void *v) { + cursor = (Fl_Cursor)(fl_intptr_t)v; + cursor_slider->value(cursor); +- fl_cursor(cursor,fg,bg); ++ fl_cursor(cursor); + } + + Fl_Menu_Item choices[] = { +@@ -48,8 +46,6 @@ Fl_Menu_Item choices[] = { + {"FL_CURSOR_WE",0,choice_cb,(void*)FL_CURSOR_WE}, + {"FL_CURSOR_NWSE",0,choice_cb,(void*)FL_CURSOR_NWSE}, + {"FL_CURSOR_NESW",0,choice_cb,(void*)FL_CURSOR_NESW}, +- {"FL_CURSOR_NONE",0,choice_cb,(void*)FL_CURSOR_NONE}, +-#if 0 + {"FL_CURSOR_N",0,choice_cb,(void*)FL_CURSOR_N}, + {"FL_CURSOR_NE",0,choice_cb,(void*)FL_CURSOR_NE}, + {"FL_CURSOR_E",0,choice_cb,(void*)FL_CURSOR_E}, +@@ -58,26 +54,14 @@ Fl_Menu_Item choices[] = { + {"FL_CURSOR_SW",0,choice_cb,(void*)FL_CURSOR_SW}, + {"FL_CURSOR_W",0,choice_cb,(void*)FL_CURSOR_W}, + {"FL_CURSOR_NW",0,choice_cb,(void*)FL_CURSOR_NW}, +-#endif ++ {"FL_CURSOR_NONE",0,choice_cb,(void*)FL_CURSOR_NONE}, + {0} + }; + + void setcursor(Fl_Widget *o, void *) { + Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; + cursor = Fl_Cursor((int)slider->value()); +- fl_cursor(cursor,fg,bg); +-} +- +-void setfg(Fl_Widget *o, void *) { +- Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; +- fg = Fl_Color((int)slider->value()); +- fl_cursor(cursor,fg,bg); +-} +- +-void setbg(Fl_Widget *o, void *) { +- Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; +- bg = Fl_Color((int)slider->value()); +- fl_cursor(cursor,fg,bg); ++ fl_cursor(cursor); + } + + // draw the label without any ^C or \nnn conversions: +@@ -103,29 +87,11 @@ int main(int argc, char **argv) { + slider1.align(FL_ALIGN_LEFT); + slider1.step(1); + slider1.precision(0); +- slider1.bounds(0,100); ++ slider1.bounds(0,255); + slider1.value(0); + slider1.callback(setcursor); + slider1.value(cursor); + +- Fl_Hor_Value_Slider slider2(80,220,310,30,"fgcolor:"); +- slider2.align(FL_ALIGN_LEFT); +- slider2.step(1); +- slider2.precision(0); +- slider2.bounds(0,255); +- slider2.value(0); +- slider2.callback(setfg); +- slider2.value(fg); +- +- Fl_Hor_Value_Slider slider3(80,260,310,30,"bgcolor:"); +- slider3.align(FL_ALIGN_LEFT); +- slider3.step(1); +- slider3.precision(0); +- slider3.bounds(0,255); +- slider3.value(0); +- slider3.callback(setbg); +- slider3.value(bg); +- + #if 0 + // draw the manual's diagram of cursors... + window.size(400,800); diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch new file mode 100644 index 00000000..9e253a3f --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch @@ -0,0 +1,355 @@ +diff -up fltk-1.3.2/CMakeLists.txt.clp-x11 fltk-1.3.2/CMakeLists.txt +--- fltk-1.3.2/CMakeLists.txt.clp-x11 2012-09-13 16:19:01.000000000 +0200 ++++ fltk-1.3.2/CMakeLists.txt 2013-01-30 15:56:25.810663430 +0100 +@@ -515,6 +515,20 @@ else() + endif(OPTION_USE_XINERAMA) + + ####################################################################### ++if(X11_Xfixes_FOUND) ++ option(OPTION_USE_XFIXES "use lib XFIXES" ON) ++endif(X11_Xfixes_FOUND) ++ ++if(OPTION_USE_XFIXES) ++ set(HAVE_XFIXES ${X11_Xfixes_FOUND}) ++ include_directories(${X11_Xfixes_INCLUDE_PATH}) ++ list(APPEND FLTK_LDLIBS -lXfixes) ++ set(FLTK_XFIXES_FOUND TRUE) ++else() ++ set(FLTK_XFIXES_FOUND FALSE) ++endif(OPTION_USE_XFIXES) ++ ++####################################################################### + if(X11_Xft_FOUND) + option(OPTION_USE_XFT "use lib Xft" ON) + endif(X11_Xft_FOUND) +diff -up fltk-1.3.2/configh.cmake.in.clp-x11 fltk-1.3.2/configh.cmake.in +--- fltk-1.3.2/configh.cmake.in.clp-x11 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/configh.cmake.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#cmakedefine01 HAVE_XFIXES ++ ++/* + * __APPLE_QUARTZ__: + * + * If __APPLE_QUARTZ__ is defined, FLTK will be +diff -up fltk-1.3.2/configh.in.clp-x11 fltk-1.3.2/configh.in +--- fltk-1.3.2/configh.in.clp-x11 2011-10-04 11:21:47.000000000 +0200 ++++ fltk-1.3.2/configh.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#define HAVE_XFIXES 0 ++ ++/* + * __APPLE_QUARTZ__: + * + * All Apple implementations are now based on Quartz and Cocoa, +diff -up fltk-1.3.2/configure.in.clp-x11 fltk-1.3.2/configure.in +--- fltk-1.3.2/configure.in.clp-x11 2013-01-30 15:56:25.802663573 +0100 ++++ fltk-1.3.2/configure.in 2013-01-30 15:56:25.810663430 +0100 +@@ -999,6 +999,16 @@ case $uname_GUI in + LIBS="-lXext $LIBS") + fi + ++ dnl Check for the Xfixes extension unless disabled... ++ AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]]) ++ ++ if test x$enable_xfixes != xno; then ++ AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),, ++ [#include ]) ++ AC_CHECK_LIB(Xfixes, XFixesQueryExtension, ++ LIBS="-lXfixes $LIBS") ++ fi ++ + dnl Check for overlay visuals... + AC_PATH_PROG(XPROP, xprop) + AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, +diff -up fltk-1.3.2/fluid/CMakeLists.txt.clp-x11 fltk-1.3.2/fluid/CMakeLists.txt +diff -up fltk-1.3.2/src/CMakeLists.txt.clp-x11 fltk-1.3.2/src/CMakeLists.txt +--- fltk-1.3.2/src/CMakeLists.txt.clp-x11 2013-01-30 16:06:00.785430590 +0100 ++++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:06:17.883126642 +0100 +@@ -243,6 +243,10 @@ if(HAVE_XINERAMA) + target_link_libraries(fltk ${X11_Xinerama_LIB}) + endif(HAVE_XINERAMA) + ++if(HAVE_XFIXES) ++ target_link_libraries(fltk ${X11_Xfixes_LIB}) ++endif(HAVE_XFIXES) ++ + if(USE_XFT) + target_link_libraries(fltk ${X11_Xft_LIB}) + endif(USE_XFT) +diff -up fltk-1.3.2/src/Fl_x.cxx.clp-x11 fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2/src/Fl_x.cxx.clp-x11 2013-01-30 15:56:25.793663733 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:03:37.355981103 +0100 +@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp + static int randrEventBase; // base of RandR-defined events + #endif + ++# if HAVE_XFIXES ++# include ++static int xfixes_event_base = 0; ++static bool have_xfixes = false; ++# endif ++ + static Fl_Xlib_Graphics_Driver fl_xlib_driver; + static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display +@@ -307,6 +313,9 @@ static Atom WM_PROTOCOLS; + static Atom fl_MOTIF_WM_HINTS; + static Atom TARGETS; + static Atom CLIPBOARD; ++static Atom TIMESTAMP; ++static Atom PRIMARY_TIMESTAMP; ++static Atom CLIPBOARD_TIMESTAMP; + Atom fl_XdndAware; + Atom fl_XdndSelection; + Atom fl_XdndEnter; +@@ -667,6 +676,9 @@ void fl_open_display(Display* d) { + fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0); + TARGETS = XInternAtom(d, "TARGETS", 0); + CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0); ++ TIMESTAMP = XInternAtom(d, "TIMESTAMP", 0); ++ PRIMARY_TIMESTAMP = XInternAtom(d, "PRIMARY_TIMESTAMP", 0); ++ CLIPBOARD_TIMESTAMP = XInternAtom(d, "CLIPBOARD_TIMESTAMP", 0); + fl_XdndAware = XInternAtom(d, "XdndAware", 0); + fl_XdndSelection = XInternAtom(d, "XdndSelection", 0); + fl_XdndEnter = XInternAtom(d, "XdndEnter", 0); +@@ -713,6 +725,15 @@ void fl_open_display(Display* d) { + #if !USE_COLORMAP + Fl::visual(FL_RGB); + #endif ++ ++#if HAVE_XFIXES ++ int error_base; ++ if (XFixesQueryExtension(fl_display, &xfixes_event_base, &error_base)) ++ have_xfixes = true; ++ else ++ have_xfixes = false; ++#endif ++ + #if USE_XRANDR + void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY); + if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY); +@@ -901,6 +922,107 @@ void Fl::copy(const char *stuff, int len + } + + //////////////////////////////////////////////////////////////// ++// Code for tracking clipboard changes: ++ ++static Time primary_timestamp = -1; ++static Time clipboard_timestamp = -1; ++ ++extern bool fl_clipboard_notify_empty(void); ++extern void fl_trigger_clipboard_notify(int source); ++ ++static void poll_clipboard_owner(void) { ++ Window xid; ++ ++#if HAVE_XFIXES ++ // No polling needed with Xfixes ++ if (have_xfixes) ++ return; ++#endif ++ ++ // No one is interested, so no point polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ // We need a window for this to work ++ if (!Fl::first_window()) ++ return; ++ xid = fl_xid(Fl::first_window()); ++ if (!xid) ++ return; ++ ++ // Request an update of the selection time for both the primary and ++ // clipboard selections. Magic continues when we get a SelectionNotify. ++ if (!fl_i_own_selection[0]) ++ XConvertSelection(fl_display, XA_PRIMARY, TIMESTAMP, PRIMARY_TIMESTAMP, ++ xid, fl_event_time); ++ if (!fl_i_own_selection[1]) ++ XConvertSelection(fl_display, CLIPBOARD, TIMESTAMP, CLIPBOARD_TIMESTAMP, ++ xid, fl_event_time); ++} ++ ++static void clipboard_timeout(void *data) ++{ ++ // No one is interested, so stop polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ poll_clipboard_owner(); ++ ++ Fl::repeat_timeout(0.5, clipboard_timeout); ++} ++ ++static void handle_clipboard_timestamp(int clipboard, Time time) ++{ ++ Time *timestamp; ++ ++ timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp; ++ ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ // Initial scan, just store the value ++ if (*timestamp == (Time)-1) { ++ *timestamp = time; ++ return; ++ } ++ } ++ ++ // Same selection ++ if (time == *timestamp) ++ return; ++ ++ *timestamp = time; ++ ++ // The clipboard change is the event that caused us to request ++ // the clipboard data, so use that time as the latest event. ++ if (time > fl_event_time) ++ fl_event_time = time; ++ ++ // Something happened! Let's tell someone! ++ fl_trigger_clipboard_notify(clipboard); ++} ++ ++void fl_clipboard_notify_change() { ++ // Reset the timestamps if we've going idle so that you don't ++ // get a bogus immediate trigger next time they're activated. ++ if (fl_clipboard_notify_empty()) { ++ primary_timestamp = -1; ++ clipboard_timestamp = -1; ++ } else { ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ poll_clipboard_owner(); ++ ++ if (!Fl::has_timeout(clipboard_timeout)) ++ Fl::add_timeout(0.5, clipboard_timeout); ++ } ++ } ++} ++ ++//////////////////////////////////////////////////////////////// + + const XEvent* fl_xevent; // the current x event + ulong fl_event_time; // the last timestamp from an x event +@@ -1024,7 +1141,6 @@ int fl_handle(const XEvent& thisevent) + return 0; + + case SelectionNotify: { +- if (!fl_selection_requestor) return 0; + static unsigned char* buffer = 0; + if (buffer) {XFree(buffer); buffer = 0;} + long bytesread = 0; +@@ -1040,6 +1156,19 @@ int fl_handle(const XEvent& thisevent) + bytesread/4, 65536, 1, 0, + &actual, &format, &count, &remaining, + &portion)) break; // quit on error ++ ++ if ((fl_xevent->xselection.property == PRIMARY_TIMESTAMP) || ++ (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)) { ++ if (portion && format == 32 && count == 1) { ++ Time t = *(unsigned int*)portion; ++ if (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP) ++ handle_clipboard_timestamp(1, t); ++ else ++ handle_clipboard_timestamp(0, t); ++ } ++ return true; ++ } ++ + if (actual == TARGETS || actual == XA_ATOM) { + Atom type = XA_STRING; + for (unsigned i = 0; ixselectionclear.selection == CLIPBOARD; + fl_i_own_selection[clipboard] = 0; ++ poll_clipboard_owner(); + return 1;} + + case SelectionRequest: { +@@ -1308,6 +1441,9 @@ int fl_handle(const XEvent& thisevent) + case FocusIn: + if (fl_xim_ic) XSetICFocus(fl_xim_ic); + event = FL_FOCUS; ++ // If the user has toggled from another application to this one, ++ // then it's a good time to check for clipboard changes. ++ poll_clipboard_owner(); + break; + + case FocusOut: +@@ -1676,6 +1812,25 @@ int fl_handle(const XEvent& thisevent) + } + } + ++#if HAVE_XFIXES ++ switch (xevent.type - xfixes_event_base) { ++ case XFixesSelectionNotify: { ++ // Someone feeding us bogus events? ++ if (!have_xfixes) ++ return true; ++ ++ XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)&xevent; ++ ++ if ((selection_notify->selection == XA_PRIMARY) && !fl_i_own_selection[0]) ++ handle_clipboard_timestamp(0, selection_notify->selection_timestamp); ++ else if ((selection_notify->selection == CLIPBOARD) && !fl_i_own_selection[1]) ++ handle_clipboard_timestamp(1, selection_notify->selection_timestamp); ++ ++ return true; ++ } ++ } ++#endif ++ + return Fl::handle(event, window); + } + +@@ -1995,6 +2150,16 @@ void Fl_X::make_xid(Fl_Window* win, XVis + XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1); + } + ++#if HAVE_XFIXES ++ // register for clipboard change notifications ++ if (have_xfixes && !win->parent()) { ++ XFixesSelectSelectionInput(fl_display, xp->xid, XA_PRIMARY, ++ XFixesSetSelectionOwnerNotifyMask); ++ XFixesSelectSelectionInput(fl_display, xp->xid, CLIPBOARD, ++ XFixesSetSelectionOwnerNotifyMask); ++ } ++#endif ++ + XMapWindow(fl_display, xp->xid); + if (showit) { + win->set_visible(); +diff -up fltk-1.3.2/test/CMakeLists.txt.clp-x11 fltk-1.3.2/test/CMakeLists.txt diff --git a/contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch b/contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch new file mode 100644 index 00000000..cf13aad7 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch @@ -0,0 +1,375 @@ +diff -ur fltk-1.3.0r9619.org/configure.in fltk-1.3.0r9619/configure.in +--- fltk-1.3.0r9619.org/configure.in 2012-04-22 04:45:09.000000000 +0200 ++++ fltk-1.3.0r9619/configure.in 2012-06-18 13:47:33.290447462 +0200 +@@ -865,6 +865,8 @@ + Darwin*) + # MacOS X uses Cocoa for graphics. + LIBS="$LIBS -framework Cocoa" ++ # And some Carbon for keyboard handling ++ LIBS="$LIBS -framework Carbon" + + if test x$have_pthread = xyes; then + AC_DEFINE(HAVE_PTHREAD) +diff -ur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm +--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-16 10:49:52.000000000 +0200 ++++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-18 13:47:42.944910782 +0200 +@@ -53,6 +53,7 @@ + #include + + #import ++#import + + #ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h + #if defined(__LP64__) && __LP64__ +@@ -114,6 +115,8 @@ + extern Fl_Window* fl_xmousewin; + #endif + ++bool use_simple_keyboard = false; ++ + enum { FLTKTimerEvent = 1, FLTKDataReadyEvent }; + + +@@ -130,6 +133,39 @@ + { + } + ++// Undocumented voodoo. Taken from Mozilla. ++#define ENABLE_ROMAN_KYBDS_ONLY -23 ++ ++void fl_update_focus(void) ++{ ++ Fl_Widget *focus; ++ ++ focus = Fl::grab(); ++ if (!focus) ++ focus = Fl::focus(); ++ if (!focus) ++ return; ++ ++ if (focus->simple_keyboard()) ++ use_simple_keyboard = true; ++ else ++ use_simple_keyboard = false; ++ ++ // Force a "Roman" or "ASCII" keyboard, which both the Mozilla and ++ // Safari people seem to think implies turning off advanced IME stuff ++ // (see nsTSMManager::SyncKeyScript in Mozilla and enableSecureTextInput ++ // in Safari/Webcore). Should be good enough for us then... ++#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) ++ CFArrayRef inputSources = TISCreateASCIICapableInputSourceList(); ++ TSMSetDocumentProperty(TSMGetActiveDocument(), ++ kTSMDocumentEnabledInputSourcesPropertyTag, ++ sizeof(CFArrayRef), &inputSources); ++ CFRelease(inputSources); ++#else ++ KeyScript(use_simple_keyboard ? ENABLE_ROMAN_KYBDS_ONLY : smKeyEnableKybds); ++#endif ++} ++ + /* + * Mac keyboard lookup table + */ +@@ -908,6 +944,25 @@ + } + @end + ++static const char* cocoaDead2FLTK(const char *in) ++{ ++ if (strcmp(in, "\140") == 0) // GRAVE ACCENT ++ return "\314\200"; // COMBINING GRAVE ACCENT ++ if (strcmp(in, "\302\264") == 0) // ACUTE ACCENT ++ return "\314\201"; // COMBINING ACUTE ACCENT ++ if (strcmp(in, "\136") == 0) // CIRCUMFLEX ACCENT ++ return "\314\202"; // COMBINING CIRCUMFLEX ACCENT ++ if (strcmp(in, "\176") == 0) // TILDE ++ return "\314\203"; // COMBINING TILDE ++ if (strcmp(in, "\302\250") == 0) // DIAERESIS ++ return "\314\210"; // COMBINING DIAERESIS ++ // FIXME: OS X dead key behaviour isn't documented and I don't have ++ // any more keyboards to test with... ++ ++ // hope that OS X gave us something proper to begin with ++ return in; ++} ++ + /* + Handle cocoa keyboard events + Events during a character composition sequence: +@@ -1648,6 +1703,7 @@ + - (void)rightMouseDragged:(NSEvent *)theEvent; + - (void)otherMouseDragged:(NSEvent *)theEvent; + - (void)scrollWheel:(NSEvent *)theEvent; +++ (NSString *)keyTranslate:(UInt16)keyCode withModifierFlags:(UInt32)modifierFlags; + - (BOOL)handleKeyDown:(NSEvent *)theEvent; + - (void)keyDown:(NSEvent *)theEvent; + - (void)keyUp:(NSEvent *)theEvent; +@@ -1726,6 +1782,130 @@ + - (void)scrollWheel:(NSEvent *)theEvent { + cocoaMouseWheelHandler(theEvent); + } +++ (NSString *)keyTranslate:(UInt16)keyCode withModifierFlags:(UInt32)modifierFlags { ++ const UCKeyboardLayout *layout; ++ OSStatus err; ++ ++ layout = NULL; ++ ++#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) ++ TISInputSourceRef keyboard; ++ CFDataRef uchr; ++ ++ keyboard = TISCopyCurrentKeyboardInputSource(); ++ uchr = (CFDataRef)TISGetInputSourceProperty(keyboard, ++ kTISPropertyUnicodeKeyLayoutData); ++ if (uchr == NULL) ++ return nil; ++ ++ layout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr); ++#else ++ KeyboardLayoutRef old_layout; ++ int kind; ++ ++ err = KLGetCurrentKeyboardLayout(&old_layout); ++ if (err != noErr) ++ return nil; ++ ++ err = KLGetKeyboardLayoutProperty(old_layout, kKLKind, ++ (const void**)&kind); ++ if (err != noErr) ++ return nil; ++ ++ // Old, crufty layout format? ++ if (kind == kKLKCHRKind) { ++ void *kchr_layout; ++ ++ UInt32 chars, state; ++ char buf[3]; ++ ++ unichar result[16]; ++ ByteCount in_len, out_len; ++ ++ err = KLGetKeyboardLayoutProperty(old_layout, kKLKCHRData, ++ (const void**)&kchr_layout); ++ if (err != noErr) ++ return nil; ++ ++ state = 0; ++ ++ keyCode &= 0x7f; ++ modifierFlags &= 0xff00; ++ ++ chars = KeyTranslate(kchr_layout, keyCode | modifierFlags, &state); ++ ++ buf[0] = (chars >> 16) & 0xff; ++ buf[1] = chars & 0xff; ++ buf[2] = '\0'; ++ ++ if (buf[0] == '\0') { ++ buf[0] = buf[1]; ++ buf[1] = '\0'; ++ } ++ ++ // The data is now in some layout specific encoding. Need to convert ++ // this to unicode. ++ ++ ScriptCode script; ++ TextEncoding encoding; ++ TECObjectRef converter; ++ ++ script = (ScriptCode)GetScriptManagerVariable(smKeyScript); ++ ++ err = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare, ++ kTextRegionDontCare, NULL, ++ &encoding); ++ if (err != noErr) ++ return nil; ++ ++ err = TECCreateConverter(&converter, encoding, kTextEncodingUnicodeV4_0); ++ if (err != noErr) ++ return nil; ++ ++ in_len = strlen(buf); ++ out_len = sizeof(result); ++ ++ err = TECConvertText(converter, (ConstTextPtr)buf, in_len, &in_len, ++ (TextPtr)result, out_len, &out_len); ++ ++ TECDisposeConverter(converter); ++ ++ if (err != noErr) ++ return nil; ++ ++ return [NSString stringWithCharacters:result ++ length:(out_len / sizeof(unichar))]; ++ } ++ ++ if ((kind != kKLKCHRuchrKind) && (kind != kKLuchrKind)) ++ return nil; ++ ++ err = KLGetKeyboardLayoutProperty(old_layout, kKLuchrData, ++ (const void**)&layout); ++ if (err != noErr) ++ return nil; ++#endif ++ ++ if (layout == NULL) ++ return nil; ++ ++ UInt32 dead_state; ++ UniCharCount max_len, actual_len; ++ UniChar string[255]; ++ ++ dead_state = 0; ++ max_len = sizeof(string)/sizeof(*string); ++ ++ modifierFlags = (modifierFlags >> 8) & 0xff; ++ ++ err = UCKeyTranslate(layout, keyCode, kUCKeyActionDown, modifierFlags, ++ LMGetKbdType(), 0, &dead_state, max_len, &actual_len, ++ string); ++ if (err != noErr) ++ return nil; ++ ++ return [NSString stringWithCharacters:string length:actual_len]; ++} + - (BOOL)handleKeyDown:(NSEvent *)theEvent { + //NSLog(@"handleKeyDown"); + fl_lock_function(); +@@ -1752,14 +1932,47 @@ + break; + } + } +- if (!no_text_key && !(Fl::e_state & FL_META) ) { +- // Don't send cmd- to interpretKeyEvents because it beeps. ++ if (!no_text_key) { ++ // The simple keyboard model will ignore insertText, so we need to grab ++ // the symbol directly from the event. Note that we still use setMarkedText. ++ if (use_simple_keyboard) { ++ NSString *simple_chars; ++ UInt32 modifiers; ++ ++ // We want a "normal" symbol out of the event, which basically means ++ // we only respect the shift and alt/altgr modifiers. Cocoa can help ++ // us if we only wanted shift, but as we also want alt/altgr, we'll ++ // have to do some lookup ourselves. This matches our behaviour on ++ // other platforms. ++ ++ modifiers = 0; ++ if ([theEvent modifierFlags] & NSAlphaShiftKeyMask) ++ modifiers |= alphaLock; ++ if ([theEvent modifierFlags] & NSShiftKeyMask) ++ modifiers |= shiftKey; ++ if ([theEvent modifierFlags] & NSAlternateKeyMask) ++ modifiers |= optionKey; ++ ++ simple_chars = [FLView keyTranslate:[theEvent keyCode] ++ withModifierFlags:modifiers]; ++ if (simple_chars == nil) { ++ // Something went wrong. Fall back to what Cocoa gave us... ++ simple_chars = [theEvent charactersIgnoringModifiers]; ++ } ++ ++ [FLView prepareEtext:simple_chars]; ++ } ++ + // Then we can let the OS have a stab at it and see if it thinks it + // should result in some text +- NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; +- in_key_event = true; +- [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; +- in_key_event = false; ++ ++ // Don't send cmd- to interpretKeyEvents because it beeps. ++ if (!(Fl::e_state & FL_META)) { ++ NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; ++ in_key_event = true; ++ [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; ++ in_key_event = false; ++ } + } + //NSLog(@"to text=%@ l=%d", [NSString stringWithUTF8String:Fl::e_text], Fl::e_length); + int handled = Fl::handle(FL_KEYDOWN, window); +@@ -1937,21 +2150,30 @@ + //NSLog(@"insertText: received=%@",received); + + if (!in_key_event) fl_lock_function(); ++ ++ // Simple keyboard widgets do not want these side channel inputs. ++ if (use_simple_keyboard) ++ goto end; ++ + [FLView prepareEtext:received]; ++ + // We can get called outside of key events (e.g. from the character +- // palette). Transform such actions to FL_PASTE events. ++ // palette). We need to fake our own key event at that point. + if (!in_key_event) { + Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; +- Fl::handle(FL_PASTE, target); ++ Fl::e_keysym = Fl::e_original_keysym = 0; ++ Fl::handle(FL_KEYDOWN, target); + // for some reason, the window does not redraw until the next mouse move or button push + // sending a 'redraw()' or 'awake()' does not solve the issue! + Fl::flush(); + } ++ ++end: + if (!in_key_event) fl_unlock_function(); + } + + - (void)setMarkedText:(id)aString selectedRange:(NSRange)newSelection { +- NSString *received; ++ NSString *received, *current, *aggregate; + if (newSelection.location == 0) { + [self unmarkText]; + return; +@@ -1962,11 +2184,47 @@ + received = (NSString*)aString; + } + //NSLog(@"setMarkedText: %@ %d %d",received,newSelection.location,newSelection.length); ++ ++ fl_lock_function(); ++ ++ // Simple keyboard widgets generally do not want these side channel ++ // inputs, but we have no other way of getting dead keys so we make ++ // an exception in that case. ++ if (use_simple_keyboard) { ++ if (in_key_event && (Fl::e_length == 0)) { ++ [FLView prepareEtext:received]; ++ ++ Fl::e_text = (char*)cocoaDead2FLTK(Fl::e_text); ++ Fl::e_length = strlen(Fl::e_text); ++ } ++ goto end; ++ } ++ + // This code creates the OS X behaviour of seeing dead keys as things + // are being composed. ++ // ++ // Note: The concatenation thing is because of how OS X deals with ++ // invalid sequences. At that point it will spit out one call ++ // to insertText with the now aborted sequence, and one new ++ // call to setMarkedText with the new sequence. Since we want ++ // both to be visible, we need to concatenate. + next_compose_length = newSelection.location; +- [FLView prepareEtext:received]; +- //NSLog(@"Fl::e_text=%@ Fl::e_length=%d next_compose_length=%d", received, Fl::e_length, next_compose_length); ++ current = [NSString stringWithUTF8String:Fl::e_text]; ++ aggregate = [current stringByAppendingString:received]; ++ ++ [FLView prepareEtext:aggregate]; ++ //NSLog(@"Fl::e_text=%@ Fl::e_length=%d next_compose_length=%d", aggregate, Fl::e_length, next_compose_length); ++ ++ // We can get called outside of key events (e.g. from the character ++ // palette). We need to fake our own key event at that point. ++ if (!in_key_event) { ++ Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; ++ Fl::e_keysym = Fl::e_original_keysym = 0; ++ Fl::handle(FL_KEYDOWN, target); ++ } ++ ++end: ++ fl_unlock_function(); + } + + - (void)unmarkText { diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch new file mode 100644 index 00000000..b1766a0c --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.1.10-enable-ft2-bci.patch @@ -0,0 +1,11 @@ +--- freetype-2.1.10/include/freetype/config/ftoption.h.enable-ft2-bci 2005-10-12 13:50:40.000000000 -0400 ++++ freetype-2.1.10/include/freetype/config/ftoption.h 2005-10-12 14:18:50.000000000 -0400 +@@ -436,7 +436,7 @@ + /* Do not #undef this macro here, since the build system might */ + /* define it for certain configurations only. */ + /* */ +-/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ ++#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + + + /*************************************************************************/ diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch new file mode 100644 index 00000000..c78b6b70 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.2.1-enable-valid.patch @@ -0,0 +1,20 @@ +--- freetype-2.2.1/modules.cfg.orig 2006-07-07 21:01:09.000000000 -0400 ++++ freetype-2.2.1/modules.cfg 2006-07-07 21:01:54.000000000 -0400 +@@ -110,7 +110,7 @@ + AUX_MODULES += cache + + # TrueType GX/AAT table validation. Needs ftgxval.c below. +-# AUX_MODULES += gxvalid ++AUX_MODULES += gxvalid + + # Support for streams compressed with gzip (files with suffix .gz). + # +@@ -124,7 +124,7 @@ + + # OpenType table validation. Needs ftotval.c below. + # +-# AUX_MODULES += otvalid ++AUX_MODULES += otvalid + + # Auxiliary PostScript driver component to share common code. + # diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch new file mode 100644 index 00000000..8432e28a --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.0-enable-spr.patch @@ -0,0 +1,11 @@ +--- freetype-2.3.0/include/freetype/config/ftoption.h.spf 2007-01-18 14:27:34.000000000 -0500 ++++ freetype-2.3.0/include/freetype/config/ftoption.h 2007-01-18 14:27:48.000000000 -0500 +@@ -92,7 +92,7 @@ + /* This is done to allow FreeType clients to run unmodified, forcing */ + /* them to display normal gray-level anti-aliased glyphs. */ + /* */ +-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ ++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + + /*************************************************************************/ diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch new file mode 100644 index 00000000..c2d79d1d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-1797.patch @@ -0,0 +1,101 @@ +--- freetype-2.3.11/src/cff/cffgload.c.CVE-2010-1797-2 2009-09-10 17:52:21.000000000 +0200 ++++ freetype-2.3.11/src/cff/cffgload.c 2010-08-11 13:39:32.000000000 +0200 +@@ -2358,8 +2358,11 @@ + return CFF_Err_Unimplemented_Feature; + } + +- decoder->top = args; ++ decoder->top = args; + ++ if ( decoder->top - stack >= CFF_MAX_OPERANDS ) ++ goto Stack_Overflow; ++ + } /* general operator processing */ + + } /* while ip < limit */ +@@ -2627,48 +2630,54 @@ + /* now load the unscaled outline */ + error = cff_get_glyph_data( face, glyph_index, + &charstring, &charstring_len ); +- if ( !error ) +- { +- error = cff_decoder_prepare( &decoder, size, glyph_index ); +- if ( !error ) +- { +- error = cff_decoder_parse_charstrings( &decoder, +- charstring, +- charstring_len ); ++ if ( error ) ++ goto Glyph_Build_Finished; ++ ++ error = cff_decoder_prepare( &decoder, size, glyph_index ); ++ if ( error ) ++ goto Glyph_Build_Finished; + +- cff_free_glyph_data( face, &charstring, charstring_len ); ++ error = cff_decoder_parse_charstrings( &decoder, ++ charstring, ++ charstring_len ); ++ ++ cff_free_glyph_data( face, &charstring, charstring_len ); ++ ++ if ( error ) ++ goto Glyph_Build_Finished; + + + #ifdef FT_CONFIG_OPTION_INCREMENTAL +- /* Control data and length may not be available for incremental */ +- /* fonts. */ +- if ( face->root.internal->incremental_interface ) +- { +- glyph->root.control_data = 0; +- glyph->root.control_len = 0; +- } +- else ++ /* Control data and length may not be available for incremental */ ++ /* fonts. */ ++ if ( face->root.internal->incremental_interface ) ++ { ++ glyph->root.control_data = 0; ++ glyph->root.control_len = 0; ++ } ++ else + #endif /* FT_CONFIG_OPTION_INCREMENTAL */ + +- /* We set control_data and control_len if charstrings is loaded. */ +- /* See how charstring loads at cff_index_access_element() in */ +- /* cffload.c. */ +- { +- CFF_Index csindex = &cff->charstrings_index; ++ /* We set control_data and control_len if charstrings is loaded. */ ++ /* See how charstring loads at cff_index_access_element() in */ ++ /* cffload.c. */ ++ { ++ CFF_Index csindex = &cff->charstrings_index; + + +- if ( csindex->offsets ) +- { +- glyph->root.control_data = csindex->bytes + +- csindex->offsets[glyph_index] - 1; +- glyph->root.control_len = charstring_len; +- } +- } ++ if ( csindex->offsets ) ++ { ++ glyph->root.control_data = csindex->bytes + ++ csindex->offsets[glyph_index] - 1; ++ glyph->root.control_len = charstring_len; + } + } + +- /* save new glyph tables */ +- cff_builder_done( &decoder.builder ); ++ Glyph_Build_Finished: ++ /* save new glyph tables, if no error */ ++ if ( !error ) ++ cff_builder_done( &decoder.builder ); ++ /* XXX: anything to do for broken glyph entry? */ + } + + #ifdef FT_CONFIG_OPTION_INCREMENTAL diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch new file mode 100644 index 00000000..fede8423 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2498.patch @@ -0,0 +1,35 @@ +--- freetype-2.3.11/src/pshinter/pshalgo.c 2009-07-03 15:28:24.000000000 +0200 ++++ freetype-2.3.11/src/pshinter/pshalgo.c 2010-07-13 13:14:22.000000000 +0200 +@@ -4,7 +4,8 @@ + /* */ + /* PostScript hinting algorithm (body). */ + /* */ +-/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ ++/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 */ ++/* by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used */ +@@ -1690,7 +1691,10 @@ + /* process secondary hints to `selected' points */ + if ( num_masks > 1 && glyph->num_points > 0 ) + { +- first = mask->end_point; ++ /* the `endchar' op can reduce the number of points */ ++ first = mask->end_point > glyph->num_points ++ ? glyph->num_points ++ : mask->end_point; + mask++; + for ( ; num_masks > 1; num_masks--, mask++ ) + { +@@ -1698,7 +1702,9 @@ + FT_Int count; + + +- next = mask->end_point; ++ next = mask->end_point > glyph->num_points ++ ? glyph->num_points ++ : mask->end_point; + count = next - first; + if ( count > 0 ) + { diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch new file mode 100644 index 00000000..5455fa04 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2499.patch @@ -0,0 +1,39 @@ +--- freetype-2.3.11/src/base/ftobjs.c 2009-09-02 08:42:41.000000000 +0200 ++++ freetype-2.3.11/src/base/ftobjs.c 2010-07-12 16:39:13.000000000 +0200 +@@ -1531,6 +1531,8 @@ + len += rlen; + else + { ++ if ( pfb_lenpos + 3 > pfb_len + 2 ) ++ goto Exit2; + pfb_data[pfb_lenpos ] = (FT_Byte)( len ); + pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 ); + pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 ); +@@ -1539,6 +1541,8 @@ + if ( ( flags >> 8 ) == 5 ) /* End of font mark */ + break; + ++ if ( pfb_pos + 6 > pfb_len + 2 ) ++ goto Exit2; + pfb_data[pfb_pos++] = 0x80; + + type = flags >> 8; +@@ -1553,12 +1557,18 @@ + } + + error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen ); ++ if ( error ) ++ goto Exit2; + pfb_pos += rlen; + } + ++ if ( pfb_pos + 2 > pfb_len + 2 ) ++ goto Exit2; + pfb_data[pfb_pos++] = 0x80; + pfb_data[pfb_pos++] = 3; + ++ if ( pfb_lenpos + 3 > pfb_len + 2 ) ++ goto Exit2; + pfb_data[pfb_lenpos ] = (FT_Byte)( len ); + pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 ); + pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 ); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch new file mode 100644 index 00000000..afc906d8 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2500.patch @@ -0,0 +1,31 @@ +--- freetype-2.3.11/src/smooth/ftgrays.c 2009-07-31 18:45:19.000000000 +0200 ++++ freetype-2.3.11/src/smooth/ftgrays.c 2010-07-13 10:26:58.000000000 +0200 +@@ -1189,7 +1189,7 @@ + /* first of all, compute the scanline offset */ + p = (unsigned char*)map->buffer - y * map->pitch; + if ( map->pitch >= 0 ) +- p += ( map->rows - 1 ) * map->pitch; ++ p += (unsigned)( ( map->rows - 1 ) * map->pitch ); + + for ( ; count > 0; count--, spans++ ) + { +--- freetype-2.3.11/src/smooth/ftsmooth.c 2009-07-31 18:45:19.000000000 +0200 ++++ freetype-2.3.11/src/smooth/ftsmooth.c 2010-07-13 10:26:58.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* Anti-aliasing renderer interface (body). */ + /* */ +-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */ ++/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -200,7 +200,7 @@ + + /* Required check is ( pitch * height < FT_ULONG_MAX ), */ + /* but we care realistic cases only. Always pitch <= width. */ +- if ( width > 0xFFFFU || height > 0xFFFFU ) ++ if ( width > 0x7FFFU || height > 0x7FFFU ) + { + FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n", + width, height )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch new file mode 100644 index 00000000..49a639c1 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2519.patch @@ -0,0 +1,23 @@ +--- freetype-2.3.11/src/base/ftobjs.c 2010-07-12 17:03:47.000000000 +0200 ++++ freetype-2.3.11/src/base/ftobjs.c 2010-07-12 17:07:06.000000000 +0200 +@@ -1526,7 +1526,19 @@ + goto Exit; + if ( FT_READ_USHORT( flags ) ) + goto Exit; +- rlen -= 2; /* the flags are part of the resource */ ++ FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n", ++ i, offsets[i], rlen, flags )); ++ ++ if ( ( flags >> 8 ) == 0 ) /* Comment, should not be loaded */ ++ continue; ++ ++ /* the flags are part of the resource, so rlen >= 2. */ ++ /* but some fonts declare rlen = 0 for empty fragment */ ++ if ( rlen > 2 ) ++ rlen -= 2; ++ else ++ rlen = 0; ++ + if ( ( flags >> 8 ) == type ) + len += rlen; + else diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch new file mode 100644 index 00000000..32cd3d8e --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2520.patch @@ -0,0 +1,13 @@ +--- freetype-2.3.11/src/truetype/ttinterp.c 2009-07-31 18:45:19.000000000 +0200 ++++ freetype-2.3.11/src/truetype/ttinterp.c 2010-07-15 14:44:23.000000000 +0200 +@@ -6466,8 +6466,8 @@ + end_point = CUR.pts.contours[contour] - CUR.pts.first_point; + first_point = point; + +- if ( CUR.pts.n_points <= end_point ) +- end_point = CUR.pts.n_points; ++ if ( BOUNDS ( end_point, CUR.pts.n_points ) ) ++ end_point = CUR.pts.n_points - 1; + + while ( point <= end_point && ( CUR.pts.tags[point] & mask ) == 0 ) + point++; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch new file mode 100644 index 00000000..74ff6be9 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2805.patch @@ -0,0 +1,11 @@ +--- freetype-2.3.11/src/base/ftstream.c 2009-08-03 19:51:40.000000000 +0200 ++++ freetype-2.3.11/src/base/ftstream.c 2010-09-30 13:46:08.000000000 +0200 +@@ -275,7 +275,7 @@ + { + /* check current and new position */ + if ( stream->pos >= stream->size || +- stream->pos + count > stream->size ) ++ stream->size - stream->pos < count ) + { + FT_ERROR(( "FT_Stream_EnterFrame:" + " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n", diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch new file mode 100644 index 00000000..564d6d3a --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2806.patch @@ -0,0 +1,41 @@ +--- freetype-2.3.11/src/type42/t42parse.c 2009-07-03 15:28:24.000000000 +0200 ++++ freetype-2.3.11/src/type42/t42parse.c 2010-09-23 12:15:56.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* Type 42 font parser (body). */ + /* */ +-/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ ++/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ + /* Roberto Alameda. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -575,6 +575,12 @@ + } + + string_size = T1_ToInt( parser ); ++ if ( string_size < 0 ) ++ { ++ FT_ERROR(( "t42_parse_sfnts: invalid string size\n" )); ++ error = T42_Err_Invalid_File_Format; ++ goto Fail; ++ } + + T1_Skip_PS_Token( parser ); /* `RD' */ + if ( parser->root.error ) +@@ -582,13 +588,14 @@ + + string_buf = parser->root.cursor + 1; /* one space after `RD' */ + +- parser->root.cursor += string_size + 1; +- if ( parser->root.cursor >= limit ) ++ if ( limit - parser->root.cursor < string_size ) + { + FT_ERROR(( "t42_parse_sfnts: too many binary data\n" )); + error = T42_Err_Invalid_File_Format; + goto Fail; + } ++ else ++ parser->root.cursor += string_size + 1; + } + + if ( !string_buf ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch new file mode 100644 index 00000000..a68a06fe --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-2808.patch @@ -0,0 +1,21 @@ +--- freetype-2.3.11/src/base/ftobjs.c 2010-09-30 13:58:50.000000000 +0200 ++++ freetype-2.3.11/src/base/ftobjs.c 2010-09-30 13:59:31.000000000 +0200 +@@ -1529,6 +1529,7 @@ + FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n", + i, offsets[i], rlen, flags )); + ++ /* postpone the check of rlen longer than buffer until FT_Stream_Read() */ + if ( ( flags >> 8 ) == 0 ) /* Comment, should not be loaded */ + continue; + +@@ -1568,6 +1569,10 @@ + pfb_data[pfb_pos++] = 0; + } + ++ error = FT_Err_Cannot_Open_Resource; ++ if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len ) ++ goto Exit2; ++ + error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen ); + if ( error ) + goto Exit2; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch new file mode 100644 index 00000000..36455910 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3311.patch @@ -0,0 +1,37 @@ +--- freetype-2.3.11/src/base/ftstream.c 2010-09-30 14:12:38.000000000 +0200 ++++ freetype-2.3.11/src/base/ftstream.c 2010-09-30 14:12:59.000000000 +0200 +@@ -59,8 +59,17 @@ + { + FT_Error error = FT_Err_Ok; + ++ /* note that seeking to the first position after the file is valid */ ++ if ( pos > stream->size ) ++ { ++ FT_ERROR(( "FT_Stream_Seek:" ++ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", ++ pos, stream->size )); + +- if ( stream->read ) ++ error = FT_Err_Invalid_Stream_Operation; ++ } ++ ++ if ( !error && stream->read ) + { + if ( stream->read( stream, pos, 0, 0 ) ) + { +@@ -71,15 +80,6 @@ + error = FT_Err_Invalid_Stream_Operation; + } + } +- /* note that seeking to the first position after the file is valid */ +- else if ( pos > stream->size ) +- { +- FT_ERROR(( "FT_Stream_Seek:" +- " invalid i/o; pos = 0x%lx, size = 0x%lx\n", +- pos, stream->size )); +- +- error = FT_Err_Invalid_Stream_Operation; +- } + + if ( !error ) + stream->pos = pos; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch new file mode 100644 index 00000000..31c61443 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2010-3855.patch @@ -0,0 +1,20 @@ +--- freetype-2.3.11/src/truetype/ttgxvar.c.orig 2009-07-31 18:45:19.000000000 +0200 ++++ freetype-2.3.11/src/truetype/ttgxvar.c 2010-10-22 08:52:37.000000000 +0200 +@@ -157,7 +157,7 @@ + runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK; + first = points[i++] = FT_GET_USHORT(); + +- if ( runcnt < 1 ) ++ if ( runcnt < 1 || i + runcnt >= n ) + goto Exit; + + /* first point not included in runcount */ +@@ -168,7 +168,7 @@ + { + first = points[i++] = FT_GET_BYTE(); + +- if ( runcnt < 1 ) ++ if ( runcnt < 1 || i + runcnt >= n ) + goto Exit; + + for ( j = 0; j < runcnt; ++j ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch new file mode 100644 index 00000000..d610b90f --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-0226.patch @@ -0,0 +1,108 @@ +--- freetype-2.3.11/src/psaux/t1decode.c 2009-09-29 19:51:31.000000000 +0200 ++++ freetype-2.3.11/src/psaux/t1decode.c 2011-07-20 14:39:24.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* PostScript Type 1 decoding routines (body). */ + /* */ +-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ ++/* Copyright 2000-2011 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -27,6 +27,8 @@ + + #include "psauxerr.h" + ++/* ensure proper sign extension */ ++#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) ) + + /*************************************************************************/ + /* */ +@@ -665,7 +667,7 @@ + if ( large_int ) + FT_TRACE4(( " %ld", value )); + else +- FT_TRACE4(( " %ld", (FT_Int32)( value >> 16 ) )); ++ FT_TRACE4(( " %ld", Fix2Int( value ) )); + #endif + + *top++ = value; +@@ -687,8 +689,8 @@ + + top -= 2; + +- subr_no = (FT_Int)( top[1] >> 16 ); +- arg_cnt = (FT_Int)( top[0] >> 16 ); ++ subr_no = Fix2Int( top[1] ); ++ arg_cnt = Fix2Int( top[0] ); + + /***********************************************************/ + /* */ +@@ -861,7 +863,7 @@ + if ( arg_cnt != 1 || blend == NULL ) + goto Unexpected_OtherSubr; + +- idx = (FT_Int)( top[0] >> 16 ); ++ idx = Fix2Int( top[0] ); + + if ( idx < 0 || + idx + blend->num_designs > decoder->len_buildchar ) +@@ -929,7 +931,7 @@ + if ( arg_cnt != 2 || blend == NULL ) + goto Unexpected_OtherSubr; + +- idx = (FT_Int)( top[1] >> 16 ); ++ idx = Fix2Int( top[1] ); + + if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; +@@ -950,7 +952,7 @@ + if ( arg_cnt != 1 || blend == NULL ) + goto Unexpected_OtherSubr; + +- idx = (FT_Int)( top[0] >> 16 ); ++ idx = Fix2Int( top[0] ); + + if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) + goto Unexpected_OtherSubr; +@@ -1008,11 +1010,15 @@ + break; + + default: +- FT_ERROR(( "t1_decoder_parse_charstrings:" +- " unknown othersubr [%d %d], wish me luck\n", +- arg_cnt, subr_no )); +- unknown_othersubr_result_cnt = arg_cnt; +- break; ++ if ( arg_cnt >= 0 && subr_no >= 0 ) ++ { ++ FT_ERROR(( "t1_decoder_parse_charstrings:" ++ " unknown othersubr [%d %d], wish me luck\n", ++ arg_cnt, subr_no )); ++ unknown_othersubr_result_cnt = arg_cnt; ++ break; ++ } ++ /* fall through */ + + Unexpected_OtherSubr: + FT_ERROR(( "t1_decoder_parse_charstrings:" +@@ -1138,8 +1144,8 @@ + top[0], + top[1], + top[2], +- (FT_Int)( top[3] >> 16 ), +- (FT_Int)( top[4] >> 16 ) ); ++ Fix2Int( top[3] ), ++ Fix2Int( top[4] ) ); + + case op_sbw: + FT_TRACE4(( " sbw" )); +@@ -1313,7 +1319,7 @@ + + FT_TRACE4(( " callsubr" )); + +- idx = (FT_Int)( top[0] >> 16 ); ++ idx = Fix2Int( top[0] ); + if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs ) + { + FT_ERROR(( "t1_decoder_parse_charstrings:" diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch new file mode 100644 index 00000000..d81f442d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3256.patch @@ -0,0 +1,92 @@ +--- freetype-2.3.11/src/base/ftbitmap.c 2009-07-31 18:45:18.000000000 +0200 ++++ freetype-2.3.11/src/base/ftbitmap.c 2011-10-19 12:25:26.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* FreeType utility functions for bitmaps (body). */ + /* */ +-/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */ ++/* Copyright 2004-2009, 2011 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -417,6 +417,10 @@ + + target->pitch = source->width + pad; + ++ if ( target->pitch > 0 && ++ target->rows > FT_ULONG_MAX / target->pitch ) ++ return FT_Err_Invalid_Argument; ++ + if ( target->rows * target->pitch > old_size && + FT_QREALLOC( target->buffer, + old_size, target->rows * target->pitch ) ) +--- freetype-2.3.11/src/psaux/t1decode.c 2011-10-19 12:25:26.000000000 +0200 ++++ freetype-2.3.11/src/psaux/t1decode.c 2011-10-19 12:25:26.000000000 +0200 +@@ -748,6 +748,13 @@ + if ( arg_cnt != 0 ) + goto Unexpected_OtherSubr; + ++ if ( decoder->flex_state == 0 ) ++ { ++ FT_ERROR(( "t1_decoder_parse_charstrings:" ++ " missing flex start\n" )); ++ goto Syntax_Error; ++ } ++ + /* note that we should not add a point for index 0; */ + /* this will move our current position to the flex */ + /* point without adding any point to the outline */ +--- freetype-2.3.11/src/raster/ftrend1.c 2009-07-03 15:28:24.000000000 +0200 ++++ freetype-2.3.11/src/raster/ftrend1.c 2011-10-19 13:26:02.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* The FreeType glyph rasterizer interface (body). */ + /* */ +-/* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */ ++/* Copyright 1996-2003, 2005, 2006, 2011 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -25,6 +25,7 @@ + + #include "rasterrs.h" + ++#define FT_USHORT_MAX USHRT_MAX + + /* initialize renderer -- init its raster */ + static FT_Error +@@ -168,6 +169,13 @@ + + width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); + height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); ++ ++ if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) ++ { ++ error = Raster_Err_Invalid_Argument; ++ goto Exit; ++ } ++ + bitmap = &slot->bitmap; + memory = render->root.memory; + +--- freetype-2.3.11/src/truetype/ttgxvar.c 2011-10-19 12:25:26.000000000 +0200 ++++ freetype-2.3.11/src/truetype/ttgxvar.c 2011-10-19 12:25:26.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* TrueType GX Font Variation loader */ + /* */ +-/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */ ++/* Copyright 2004-2011 by */ + /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -1473,6 +1473,9 @@ + { + for ( j = 0; j < point_count; ++j ) + { ++ if ( localpoints[j] >= n_points ) ++ continue; ++ + delta_xy[localpoints[j]].x += FT_MulFix( deltas_x[j], apply ); + delta_xy[localpoints[j]].y += FT_MulFix( deltas_y[j], apply ); + } diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch new file mode 100644 index 00000000..ee365b25 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2011-3439.patch @@ -0,0 +1,76 @@ +--- freetype-2.3.11/src/cid/cidload.c 2009-07-03 15:28:24.000000000 +0200 ++++ freetype-2.3.11/src/cid/cidload.c 2011-11-15 12:58:41.000000000 +0100 +@@ -4,7 +4,7 @@ + /* */ + /* CID-keyed Type1 font loader (body). */ + /* */ +-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */ ++/* Copyright 1996-2006, 2009, 2011 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -110,7 +110,7 @@ + CID_FaceDict dict; + + +- if ( parser->num_dict < 0 ) ++ if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts ) + { + FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n", + keyword->ident )); +@@ -158,7 +158,7 @@ + FT_Fixed temp_scale; + + +- if ( parser->num_dict >= 0 ) ++ if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) + { + dict = face->cid.font_dicts + parser->num_dict; + matrix = &dict->font_matrix; +@@ -249,7 +249,7 @@ + CID_FaceDict dict; + + +- if ( parser->num_dict >= 0 ) ++ if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) + { + dict = face->cid.font_dicts + parser->num_dict; + +@@ -413,12 +413,25 @@ + FT_Byte* p; + + ++ /* Check for possible overflow. */ ++ if ( num_subrs == FT_UINT_MAX ) ++ { ++ error = CID_Err_Syntax_Error; ++ goto Fail; ++ } ++ + /* reallocate offsets array if needed */ + if ( num_subrs + 1 > max_offsets ) + { + FT_UInt new_max = FT_PAD_CEIL( num_subrs + 1, 4 ); + + ++ if ( new_max <= max_offsets ) ++ { ++ error = CID_Err_Syntax_Error; ++ goto Fail; ++ } ++ + if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) ) + goto Fail; + +@@ -436,6 +449,11 @@ + + FT_FRAME_EXIT(); + ++ /* offsets must be ordered */ ++ for ( count = 1; count <= num_subrs; count++ ) ++ if ( offsets[count - 1] > offsets[count] ) ++ goto Fail; ++ + /* now, compute the size of subrs charstrings, */ + /* allocate, and read them */ + data_len = offsets[num_subrs] - offsets[0]; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch new file mode 100644 index 00000000..2a2e0c58 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1126.patch @@ -0,0 +1,20 @@ +--- freetype-2.3.11/src/bdf/bdflib.c 2009-09-12 23:14:25.000000000 +0200 ++++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:19:23.000000000 +0200 +@@ -1,6 +1,6 @@ + /* + * Copyright 2000 Computing Research Labs, New Mexico State University +- * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 ++ * Copyright 2001-2012 + * Francesco Zappa Nardelli + * + * Permission is hereby granted, free of charge, to any person obtaining a +@@ -1235,7 +1235,8 @@ + ep = line + linelen; + + /* Trim the leading whitespace if it exists. */ +- *sp++ = 0; ++ if ( *sp ) ++ *sp++ = 0; + while ( *sp && + ( *sp == ' ' || *sp == '\t' ) ) + sp++; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch new file mode 100644 index 00000000..a529f190 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1127.patch @@ -0,0 +1,43 @@ +--- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:20:31.000000000 +0200 ++++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:22:28.000000000 +0200 +@@ -1092,6 +1092,7 @@ + #define ACMSG13 "Glyph %ld extra rows removed.\n" + #define ACMSG14 "Glyph %ld extra columns removed.\n" + #define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n" ++#define ACMSG16 "Glyph %ld missing columns padded with zero bits.\n" + + /* Error messages. */ + #define ERRMSG1 "[line %ld] Missing \"%s\" line.\n" +@@ -1695,18 +1696,31 @@ + for ( i = 0; i < nibbles; i++ ) + { + c = line[i]; ++ if ( !c ) ++ break; + *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); + if ( i + 1 < nibbles && ( i & 1 ) ) + *++bp = 0; + } + ++ /* If any line has not enough columns, */ ++ /* indicate they have been padded with zero bits. */ ++ if ( i < nibbles && ++ !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) ++ { ++ FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding )); ++ p->flags |= _BDF_GLYPH_WIDTH_CHECK; ++ font->modified = 1; ++ } ++ + /* Remove possible garbage at the right. */ + mask_index = ( glyph->bbx.width * p->font->bpp ) & 7; + if ( glyph->bbx.width ) + *bp &= nibble_mask[mask_index]; + + /* If any line has extra columns, indicate they have been removed. */ +- if ( ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && ++ if ( i == nibbles && ++ ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && + !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) + { + FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch new file mode 100644 index 00000000..4d2f9a87 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1130.patch @@ -0,0 +1,21 @@ +--- freetype-2.3.11/src/pcf/pcfread.c 2009-10-10 19:32:28.000000000 +0200 ++++ freetype-2.3.11/src/pcf/pcfread.c 2012-03-28 10:29:54.000000000 +0200 +@@ -2,7 +2,7 @@ + + FreeType font driver for pcf fonts + +- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by ++ Copyright 2000-2010, 2012 by + Francesco Zappa Nardelli + + Permission is hereby granted, free of charge, to any person obtaining a copy +@@ -495,7 +495,8 @@ THE SOFTWARE. + goto Bail; + } + +- if ( FT_NEW_ARRAY( strings, string_size ) ) ++ /* allocate one more byte so that we have a final null byte */ ++ if ( FT_NEW_ARRAY( strings, string_size + 1 ) ) + goto Bail; + + error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size ); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch new file mode 100644 index 00000000..cfbd7488 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1131.patch @@ -0,0 +1,40 @@ +--- freetype-2.3.11/src/smooth/ftsmooth.c 2012-03-28 10:30:52.000000000 +0200 ++++ freetype-2.3.11/src/smooth/ftsmooth.c 2012-03-28 10:33:13.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* Anti-aliasing renderer interface (body). */ + /* */ +-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ ++/* Copyright 2000-2006, 2009-2012 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -105,7 +105,7 @@ + FT_Error error; + FT_Outline* outline = NULL; + FT_BBox cbox; +- FT_UInt width, height, height_org, width_org, pitch; ++ FT_Pos width, height, height_org, width_org, pitch; + FT_Bitmap* bitmap; + FT_Memory memory; + FT_Int hmul = mode == FT_RENDER_MODE_LCD; +@@ -140,8 +140,8 @@ + cbox.xMax = FT_PIX_CEIL( cbox.xMax ); + cbox.yMax = FT_PIX_CEIL( cbox.yMax ); + +- width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); +- height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); ++ width = ( cbox.xMax - cbox.xMin ) >> 6; ++ height = ( cbox.yMax - cbox.yMin ) >> 6; + bitmap = &slot->bitmap; + memory = render->root.memory; + +@@ -200,7 +200,7 @@ + + /* Required check is ( pitch * height < FT_ULONG_MAX ), */ + /* but we care realistic cases only. Always pitch <= width. */ +- if ( width > 0x7FFFU || height > 0x7FFFU ) ++ if ( width > 0x7FFF || height > 0x7FFF ) + { + FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n", + width, height )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch new file mode 100644 index 00000000..550da7fa --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1132.patch @@ -0,0 +1,130 @@ +--- freetype-2.3.11/src/psaux/psobjs.c 2009-07-31 18:45:18.000000000 +0200 ++++ freetype-2.3.11/src/psaux/psobjs.c 2012-04-03 13:14:05.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* Auxiliary functions for PostScript fonts (body). */ + /* */ +-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ ++/* Copyright 1996-2012 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -589,7 +589,7 @@ + } + + Exit: +- if ( cur == parser->cursor ) ++ if ( cur < limit && cur == parser->cursor ) + { + FT_ERROR(( "ps_parser_skip_PS_token:" + " current token is `%c' which is self-delimiting\n" +--- freetype-2.3.11/src/type1/t1load.c 2009-09-01 08:07:32.000000000 +0200 ++++ freetype-2.3.11/src/type1/t1load.c 2012-04-03 13:14:30.000000000 +0200 +@@ -71,6 +71,13 @@ + #include "t1errors.h" + + ++#ifdef FT_CONFIG_OPTION_INCREMENTAL ++#define IS_INCREMENTAL ( face->root.internal->incremental_interface != 0 ) ++#else ++#define IS_INCREMENTAL 0 ++#endif ++ ++ + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ +@@ -1027,7 +1034,8 @@ + static int + read_binary_data( T1_Parser parser, + FT_Long* size, +- FT_Byte** base ) ++ FT_Byte** base, ++ FT_Bool incremental ) + { + FT_Byte* cur; + FT_Byte* limit = parser->root.limit; +@@ -1057,8 +1065,12 @@ + return !parser->root.error; + } + +- FT_ERROR(( "read_binary_data: invalid size field\n" )); +- parser->root.error = T1_Err_Invalid_File_Format; ++ if( !incremental ) ++ { ++ FT_ERROR(( "read_binary_data: invalid size field\n" )); ++ parser->root.error = T1_Err_Invalid_File_Format; ++ } ++ + return 0; + } + +@@ -1379,15 +1391,17 @@ + FT_Byte* base; + + +- /* If the next token isn't `dup' we are done. */ +- if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) ++ /* If we are out of data, or if the next token isn't `dup', */ ++ /* we are done. */ ++ if ( parser->root.cursor + 4 >= parser->root.limit || ++ ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) + break; + + T1_Skip_PS_Token( parser ); /* `dup' */ + + idx = T1_ToInt( parser ); + +- if ( !read_binary_data( parser, &size, &base ) ) ++ if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) + return; + + /* The binary string is followed by one token, e.g. `NP' */ +@@ -1399,7 +1413,8 @@ + return; + T1_Skip_Spaces ( parser ); + +- if ( ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) ++ if ( parser->root.cursor + 4 < parser->root.limit && ++ ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) + { + T1_Skip_PS_Token( parser ); /* skip `put' */ + T1_Skip_Spaces ( parser ); +@@ -1572,7 +1587,7 @@ + cur++; /* skip `/' */ + len = parser->root.cursor - cur; + +- if ( !read_binary_data( parser, &size, &base ) ) ++ if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) + return; + + /* for some non-standard fonts like `Optima' which provides */ +@@ -1861,7 +1876,7 @@ + + + parser->root.cursor = start_binary; +- if ( !read_binary_data( parser, &s, &b ) ) ++ if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) + return T1_Err_Invalid_File_Format; + have_integer = 0; + } +@@ -1874,7 +1889,7 @@ + + + parser->root.cursor = start_binary; +- if ( !read_binary_data( parser, &s, &b ) ) ++ if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) + return T1_Err_Invalid_File_Format; + have_integer = 0; + } +@@ -2148,9 +2163,7 @@ + type1->subrs_len = loader.subrs.lengths; + } + +-#ifdef FT_CONFIG_OPTION_INCREMENTAL +- if ( !face->root.internal->incremental_interface ) +-#endif ++ if ( !IS_INCREMENTAL ) + if ( !loader.charstrings.init ) + { + FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" )); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch new file mode 100644 index 00000000..ca51f26f --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1134.patch @@ -0,0 +1,26 @@ +--- freetype-2.3.11/src/type1/t1parse.c 2009-07-03 15:28:24.000000000 +0200 ++++ freetype-2.3.11/src/type1/t1parse.c 2012-03-28 10:39:25.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* Type 1 parser (body). */ + /* */ +-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by */ ++/* Copyright 1996-2005, 2008, 2009, 2012 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -464,6 +464,14 @@ + /* we now decrypt the encoded binary private dictionary */ + psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665U ); + ++ if ( parser->private_len < 4 ) ++ { ++ FT_ERROR(( "T1_Get_Private_Dict:" ++ " invalid private dictionary section\n" )); ++ error = T1_Err_Invalid_File_Format; ++ goto Fail; ++ } ++ + /* replace the four random bytes at the beginning with whitespace */ + parser->private_dict[0] = ' '; + parser->private_dict[1] = ' '; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch new file mode 100644 index 00000000..fb017b64 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1136.patch @@ -0,0 +1,49 @@ +--- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:40:25.000000000 +0200 ++++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:44:30.000000000 +0200 +@@ -1736,12 +1736,7 @@ + if ( ft_memcmp( line, "SWIDTH", 6 ) == 0 ) + { + if ( !( p->flags & _BDF_ENCODING ) ) +- { +- /* Missing ENCODING field. */ +- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); +- error = BDF_Err_Missing_Encoding_Field; +- goto Exit; +- } ++ goto Missing_Encoding; + + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + if ( error ) +@@ -1756,6 +1751,9 @@ + /* Expect the DWIDTH (scalable width) field next. */ + if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 ) + { ++ if ( !( p->flags & _BDF_ENCODING ) ) ++ goto Missing_Encoding; ++ + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + if ( error ) + goto Exit; +@@ -1781,6 +1779,9 @@ + /* Expect the BBX field next. */ + if ( ft_memcmp( line, "BBX", 3 ) == 0 ) + { ++ if ( !( p->flags & _BDF_ENCODING ) ) ++ goto Missing_Encoding; ++ + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); + if ( error ) + goto Exit; +@@ -1880,6 +1881,12 @@ + } + + error = BDF_Err_Invalid_File_Format; ++ goto Exit; ++ ++ Missing_Encoding: ++ /* Missing ENCODING field. */ ++ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); ++ error = BDF_Err_Missing_Encoding_Field; + + Exit: + return error; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch new file mode 100644 index 00000000..9086a78d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1137.patch @@ -0,0 +1,11 @@ +--- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:46:09.000000000 +0200 ++++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:45:50.000000000 +0200 +@@ -424,7 +424,7 @@ + if ( num_items > list->size ) + { + unsigned long oldsize = list->size; /* same as _bdf_list_t.size */ +- unsigned long newsize = oldsize + ( oldsize >> 1 ) + 4; ++ unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5; + unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) ); + FT_Memory memory = list->memory; + diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch new file mode 100644 index 00000000..4b27341f --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1139.patch @@ -0,0 +1,33 @@ +--- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:49:56.000000000 +0200 ++++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 10:51:40.000000000 +0200 +@@ -785,7 +785,7 @@ + }; + + +-#define isdigok( m, d ) (m[(d) >> 3] & ( 1 << ( (d) & 7 ) ) ) ++#define isdigok( m, d ) (m[(unsigned char)(d) >> 3] & ( 1 << ( (d) & 7 ) ) ) + + + /* Routine to convert an ASCII string into an unsigned long integer. */ +@@ -1696,7 +1696,7 @@ + for ( i = 0; i < nibbles; i++ ) + { + c = line[i]; +- if ( !c ) ++ if ( !isdigok( hdigits, c ) ) + break; + *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); + if ( i + 1 < nibbles && ( i & 1 ) ) +@@ -1719,9 +1719,9 @@ + *bp &= nibble_mask[mask_index]; + + /* If any line has extra columns, indicate they have been removed. */ +- if ( i == nibbles && +- ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && +- !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) ++ if ( i == nibbles && ++ isdigok( hdigits, line[nibbles] ) && ++ !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) + { + FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); + p->flags |= _BDF_GLYPH_WIDTH_CHECK; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch new file mode 100644 index 00000000..91381275 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1140.patch @@ -0,0 +1,53 @@ +--- freetype-2.3.11/src/psaux/psconv.c 2009-07-31 18:45:18.000000000 +0200 ++++ freetype-2.3.11/src/psaux/psconv.c 2012-03-28 10:55:16.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* Some convenience conversions (body). */ + /* */ +-/* Copyright 2006, 2008, 2009 by */ ++/* Copyright 2006, 2008, 2009, 2012 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -79,7 +79,7 @@ + FT_Bool sign = 0; + + +- if ( p == limit || base < 2 || base > 36 ) ++ if ( p >= limit || base < 2 || base > 36 ) + return 0; + + if ( *p == '-' || *p == '+' ) +@@ -150,7 +150,7 @@ + FT_Bool sign = 0; + + +- if ( p == limit ) ++ if ( p >= limit ) + return 0; + + if ( *p == '-' || *p == '+' ) +@@ -346,7 +346,11 @@ + + #if 1 + +- p = *cursor; ++ p = *cursor; ++ ++ if ( p >= limit ) ++ return 0; ++ + if ( n > (FT_UInt)( limit - p ) ) + n = (FT_UInt)( limit - p ); + +@@ -434,6 +438,10 @@ + #if 1 + + p = *cursor; ++ ++ if ( p >= limit ) ++ return 0; ++ + if ( n > (FT_UInt)(limit - p) ) + n = (FT_UInt)(limit - p); + diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch new file mode 100644 index 00000000..2a6f29ca --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1141.patch @@ -0,0 +1,17 @@ +--- freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 11:53:32.000000000 +0200 ++++ freetype-2.3.11/src/bdf/bdflib.c 2012-03-28 11:54:12.000000000 +0200 +@@ -520,6 +520,14 @@ + + /* Initialize the list. */ + list->used = 0; ++ if ( list->size ) ++ { ++ list->field[0] = (char*)empty; ++ list->field[1] = (char*)empty; ++ list->field[2] = (char*)empty; ++ list->field[3] = (char*)empty; ++ list->field[4] = (char*)empty; ++ } + + /* If the line is empty, then simply return. */ + if ( linelen == 0 || line[0] == 0 ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch new file mode 100644 index 00000000..5337d4bb --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1142.patch @@ -0,0 +1,27 @@ +--- freetype-2.3.11/src/winfonts/winfnt.c 2009-07-31 18:45:19.000000000 +0200 ++++ freetype-2.3.11/src/winfonts/winfnt.c 2012-03-28 11:57:05.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* FreeType font driver for Windows FNT/FON files */ + /* */ +-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */ ++/* Copyright 1996-2004, 2006-2012 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* Copyright 2003 Huw D M Davies for Codeweavers */ + /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ +@@ -825,7 +825,14 @@ + root->charmap = root->charmaps[0]; + } + +- /* setup remaining flags */ ++ /* set up remaining flags */ ++ ++ if ( font->header.last_char < font->header.first_char ) ++ { ++ FT_TRACE2(( "invalid number of glyphs\n" )); ++ error = FNT_Err_Invalid_File_Format; ++ goto Fail; ++ } + + /* reserve one slot for the .notdef glyph at index 0 */ + root->num_glyphs = font->header.last_char - diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch new file mode 100644 index 00000000..551aeb95 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1143.patch @@ -0,0 +1,67 @@ +--- freetype-2.3.11/src/base/ftcalc.c 2009-07-31 18:45:18.000000000 +0200 ++++ freetype-2.3.11/src/base/ftcalc.c 2012-03-28 11:59:17.000000000 +0200 +@@ -4,7 +4,7 @@ + /* */ + /* Arithmetic computations (body). */ + /* */ +-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ ++/* Copyright 1996-2006, 2008, 2012 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -307,7 +307,7 @@ + q <<= 1; + r |= lo >> 31; + +- if ( r >= (FT_UInt32)y ) ++ if ( r >= y ) + { + r -= y; + q |= 1; +@@ -373,7 +373,7 @@ + if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 ) + a = ( a * b + ( c >> 1 ) ) / c; + +- else if ( c > 0 ) ++ else if ( (FT_Int32)c > 0 ) + { + FT_Int64 temp, temp2; + +@@ -412,7 +412,7 @@ + if ( a <= 46340L && b <= 46340L && c > 0 ) + a = a * b / c; + +- else if ( c > 0 ) ++ else if ( (FT_Int32)c > 0 ) + { + FT_Int64 temp; + +@@ -544,7 +544,7 @@ + s = (FT_Int32)a; a = FT_ABS( a ); + s ^= (FT_Int32)b; b = FT_ABS( b ); + +- if ( b == 0 ) ++ if ( (FT_UInt32)b == 0 ) + { + /* check for division by 0 */ + q = (FT_UInt32)0x7FFFFFFFL; +@@ -552,15 +552,16 @@ + else if ( ( a >> 16 ) == 0 ) + { + /* compute result directly */ +- q = (FT_UInt32)( (a << 16) + (b >> 1) ) / (FT_UInt32)b; ++ q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b; + } + else + { + /* we need more bits; we have to do it by hand */ + FT_Int64 temp, temp2; + +- temp.hi = (FT_Int32) (a >> 16); +- temp.lo = (FT_UInt32)(a << 16); ++ ++ temp.hi = (FT_Int32) ( a >> 16 ); ++ temp.lo = (FT_UInt32)( a << 16 ); + temp2.hi = 0; + temp2.lo = (FT_UInt32)( b >> 1 ); + FT_Add64( &temp, &temp2, &temp ); diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch new file mode 100644 index 00000000..62b47c22 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-CVE-2012-1144.patch @@ -0,0 +1,22 @@ +--- freetype-2.3.11/src/truetype/ttgload.c 2009-09-08 07:06:51.000000000 +0200 ++++ freetype-2.3.11/src/truetype/ttgload.c 2012-03-28 12:01:04.000000000 +0200 +@@ -267,14 +267,17 @@ + if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit ) + goto Invalid_Outline; + +- prev_cont = FT_NEXT_USHORT( p ); ++ prev_cont = FT_NEXT_SHORT( p ); + + if ( n_contours > 0 ) + cont[0] = prev_cont; + ++ if ( prev_cont < 0 ) ++ goto Invalid_Outline; ++ + for ( cont++; cont < cont_limit; cont++ ) + { +- cont[0] = FT_NEXT_USHORT( p ); ++ cont[0] = FT_NEXT_SHORT( p ); + if ( cont[0] <= prev_cont ) + { + /* unordered contours: this is invalid */ diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch new file mode 100644 index 00000000..254354b7 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-array-initialization.patch @@ -0,0 +1,12 @@ +--- freetype-2.3.11/src/base/ftoutln.c 2009-03-14 14:45:26.000000000 +0100 ++++ freetype-2.3.11/src/base/ftoutln.c 2012-04-03 11:03:35.000000000 +0200 +@@ -990,7 +990,8 @@ + + int i; + FT_Pos ray_y[3]; +- FT_Orientation result[3]; ++ FT_Orientation result[3] = ++ { FT_ORIENTATION_NONE, FT_ORIENTATION_NONE, FT_ORIENTATION_NONE }; + + + if ( !outline || outline->n_points <= 0 ) diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch new file mode 100644 index 00000000..88e34198 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-2.3.11-bdf-overflow.patch @@ -0,0 +1,11 @@ +--- freetype-2.3.11/src/bdf/bdflib.c 2012-04-02 16:24:56.000000000 +0200 ++++ freetype-2.3.11/src/bdf/bdflib.c 2012-04-02 16:25:33.000000000 +0200 +@@ -1870,7 +1870,7 @@ + glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3; + + bitmap_size = glyph->bpr * glyph->bbx.height; +- if ( bitmap_size > 0xFFFFU ) ++ if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU ) + { + FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno )); + error = BDF_Err_Bbx_Too_Big; diff --git a/contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch b/contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch new file mode 100644 index 00000000..f369adb7 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/freetype-multilib.patch @@ -0,0 +1,18 @@ +--- freetype-2.2.1/builds/unix/freetype-config.in.multilib 2006-07-27 18:50:40.000000000 -0400 ++++ freetype-2.2.1/builds/unix/freetype-config.in 2006-07-27 18:58:13.000000000 -0400 +@@ -9,11 +9,11 @@ + # indicate that you have read the license and understand and accept it + # fully. + +-prefix=@prefix@ +-exec_prefix=@exec_prefix@ ++prefix=`pkg-config --variable prefix freetype2` ++exec_prefix=`pkg-config --variable exec_prefix freetype2` + exec_prefix_set=no +-includedir=@includedir@ +-libdir=@libdir@ ++includedir=`pkg-config --variable includedir freetype2` ++libdir=`pkg-config --variable libdir freetype2` + enable_shared=@build_libtool_libs@ + wl=@wl@ + hardcode_libdir_flag_spec='@hardcode_libdir_flag_spec@' diff --git a/contrib/packages/rpm/el5/SOURCES/intel-revert-vbl.patch b/contrib/packages/rpm/el5/SOURCES/intel-revert-vbl.patch new file mode 100644 index 00000000..03944147 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/intel-revert-vbl.patch @@ -0,0 +1,21 @@ +commit 532d2051245a1d8afe7ca236f1d966d555bb121a +Author: Dave Airlie +Date: Fri Sep 12 17:21:25 2008 +1000 + + Revert "intel: sync to vblank by default" + + This reverts commit e9bf3e4cc9a7e4bcd4c45bd707541d26ecdf0409. + +diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c +index c193830..f02192d 100644 +--- a/src/mesa/drivers/dri/intel/intel_screen.c ++++ b/src/mesa/drivers/dri/intel/intel_screen.c +@@ -55,7 +55,7 @@ PUBLIC const char __driConfigOptions[] = + DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) +- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_ALWAYS_SYNC) ++ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + /* Options correspond to DRI_CONF_BO_REUSE_DISABLED, + * DRI_CONF_BO_REUSE_ALL + */ diff --git a/contrib/packages/rpm/el5/SOURCES/libX11-1.3.1-creategc-man-page.patch b/contrib/packages/rpm/el5/SOURCES/libX11-1.3.1-creategc-man-page.patch new file mode 100644 index 00000000..69f71573 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libX11-1.3.1-creategc-man-page.patch @@ -0,0 +1,14 @@ +diff -up libX11-1.3.1/man/XCreateGC.man.fix-XCreateGC_manpage libX11-1.3.1/man/XCreateGC.man +--- libX11-1.3.1/man/XCreateGC.man.fix-XCreateGC_manpage 2010-04-12 19:19:13.860497216 +0200 ++++ libX11-1.3.1/man/XCreateGC.man 2010-04-12 19:23:16.872621817 +0200 +@@ -151,8 +151,8 @@ XCreateGC, XCopyGC, XChangeGC, XGetGCVal + GC XCreateGC\^(\^Display *\fIdisplay\fP\^, Drawable \fId\fP\^, unsigned long + \fIvaluemask\fP\^, XGCValues *\^\fIvalues\fP\^); + .HP +-int XCopyGC\^(\^Display *\fIdisplay\fP\^, GC \fIsrc\fP\^, GC \fIdest\fP\^, +-unsigned long \fIvaluemask\fP\^); ++int XCopyGC\^(\^Display *\fIdisplay\fP\^, GC \fIsrc\fP\^, ++unsigned long \fIvaluemask\fP\^, GC \fIdest\fP\^); + .HP + int XChangeGC\^(\^Display *\fIdisplay\fP\^, GC \fIgc\fP\^, unsigned long + \fIvaluemask\fP\^, XGCValues *\^\fIvalues\fP\^); diff --git a/contrib/packages/rpm/el5/SOURCES/libXext-1.1-XAllocID.patch b/contrib/packages/rpm/el5/SOURCES/libXext-1.1-XAllocID.patch new file mode 100644 index 00000000..d5256338 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libXext-1.1-XAllocID.patch @@ -0,0 +1,35 @@ +From 956fd30e1046e5779ac0b6c07ec4f0e87250869a Mon Sep 17 00:00:00 2001 +From: Jamey Sharp +Date: Wed, 7 Oct 2009 19:31:21 -0700 +Subject: [PATCH] XAllocID must only be called with the Display lock held. + +This patch makes XShmAttach follow the same XID allocation pattern used in +other stubs, such as XShmCreatePixmap. + +Reported-by: +Signed-off-by: Jamey Sharp +--- + src/XShm.c | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +diff --git a/src/XShm.c b/src/XShm.c +index 922b4cb..38efa9f 100644 +--- a/src/XShm.c ++++ b/src/XShm.c +@@ -235,12 +235,11 @@ Status XShmAttach(Display *dpy, XShmSegmentInfo *shminfo) + + ShmCheckExtension (dpy, info, 0); + +- shminfo->shmseg = XAllocID(dpy); + LockDisplay(dpy); + GetReq(ShmAttach, req); + req->reqType = info->codes->major_opcode; + req->shmReqType = X_ShmAttach; +- req->shmseg = shminfo->shmseg; ++ req->shmseg = shminfo->shmseg = XAllocID(dpy); + req->shmid = shminfo->shmid; + req->readOnly = shminfo->readOnly ? xTrue : xFalse; + UnlockDisplay(dpy); +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/libXt-1.0.2-libsm-fix.patch b/contrib/packages/rpm/el5/SOURCES/libXt-1.0.2-libsm-fix.patch new file mode 100644 index 00000000..309aea8d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libXt-1.0.2-libsm-fix.patch @@ -0,0 +1,11 @@ +--- libXt-1.0.2/xt.pc.in.libsm-fix 2006-06-28 14:56:37.000000000 -0400 ++++ libXt-1.0.2/xt.pc.in 2006-06-28 14:56:51.000000000 -0400 +@@ -7,7 +7,7 @@ + Name: Xt + Description: X Toolkit Library + Version: @VERSION@ +-Requires: xproto x11 sm ++Requires: xproto x11 + Requires.private: x11 sm + Cflags: -I${includedir} + Libs: -L${libdir} -lXt diff --git a/contrib/packages/rpm/el5/SOURCES/libdrm-2.4.0-no-bc.patch b/contrib/packages/rpm/el5/SOURCES/libdrm-2.4.0-no-bc.patch new file mode 100644 index 00000000..c09acc58 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libdrm-2.4.0-no-bc.patch @@ -0,0 +1,54 @@ +diff -up libdrm-20080814/libdrm/xf86drm.c.no-bc libdrm-20080814/libdrm/xf86drm.c +--- libdrm-20080814/libdrm/xf86drm.c.no-bc 2008-08-14 15:43:09.000000000 +1000 ++++ libdrm-20080814/libdrm/xf86drm.c 2008-08-14 15:45:09.000000000 +1000 +@@ -396,11 +396,6 @@ int drmAvailable(void) + int fd; + + if ((fd = drmOpenMinor(0, 1, DRM_NODE_RENDER)) < 0) { +-#ifdef __linux__ +- /* Try proc for backward Linux compatibility */ +- if (!access("/proc/dri/0", R_OK)) +- return 1; +-#endif + return 0; + } + +@@ -519,38 +514,6 @@ static int drmOpenByName(const char *nam + } + } + +-#ifdef __linux__ +- /* Backward-compatibility /proc support */ +- for (i = 0; i < 8; i++) { +- char proc_name[64], buf[512]; +- char *driver, *pt, *devstring; +- int retcode; +- +- sprintf(proc_name, "/proc/dri/%d/name", i); +- if ((fd = open(proc_name, 0, 0)) >= 0) { +- retcode = read(fd, buf, sizeof(buf)-1); +- close(fd); +- if (retcode) { +- buf[retcode-1] = '\0'; +- for (driver = pt = buf; *pt && *pt != ' '; ++pt) +- ; +- if (*pt) { /* Device is next */ +- *pt = '\0'; +- if (!strcmp(driver, name)) { /* Match */ +- for (devstring = ++pt; *pt && *pt != ' '; ++pt) +- ; +- if (*pt) { /* Found busid */ +- return drmOpenByBusid(++pt); +- } else { /* No busid */ +- return drmOpenDevice(strtol(devstring, NULL, 0),i, DRM_NODE_RENDER); +- } +- } +- } +- } +- } +- } +-#endif +- + return -1; + } + diff --git a/contrib/packages/rpm/el5/SOURCES/libdrm-make-dri-perms-okay.patch b/contrib/packages/rpm/el5/SOURCES/libdrm-make-dri-perms-okay.patch new file mode 100644 index 00000000..d9913c49 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libdrm-make-dri-perms-okay.patch @@ -0,0 +1,12 @@ +diff -up libdrm-20080303/libdrm/xf86drm.h.da libdrm-20080303/libdrm/xf86drm.h +--- libdrm-20080303/libdrm/xf86drm.h.da 2008-03-19 15:26:31.000000000 +1000 ++++ libdrm-20080303/libdrm/xf86drm.h 2008-03-19 15:26:46.000000000 +1000 +@@ -45,7 +45,7 @@ + /* Default /dev/dri directory permissions 0755 */ + #define DRM_DEV_DIRMODE \ + (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) +-#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) ++#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) + + #define DRM_DIR_NAME "/dev/dri" + #define DRM_DEV_NAME "%s/card%d" diff --git a/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-better-relocs.patch b/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-better-relocs.patch new file mode 100644 index 00000000..343d3608 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-better-relocs.patch @@ -0,0 +1,295 @@ +diff --git a/libdrm/nouveau/nouveau_bo.c b/libdrm/nouveau/nouveau_bo.c +index b7e6d86..85fc14f 100644 +--- a/libdrm/nouveau/nouveau_bo.c ++++ b/libdrm/nouveau/nouveau_bo.c +@@ -607,6 +607,7 @@ nouveau_bo_emit_buffer(struct nouveau_channel *chan, struct nouveau_bo *bo) + pbbo = nvpb->buffers + nvpb->nr_buffers++; + nvbo->pending = pbbo; + nvbo->pending_channel = chan; ++ nvbo->pending_refcnt = 0; + + nouveau_bo_ref(bo, &ref); + pbbo->user_priv = (uint64_t)(unsigned long)ref; +diff --git a/libdrm/nouveau/nouveau_private.h b/libdrm/nouveau/nouveau_private.h +index 9ce87fb..784afc9 100644 +--- a/libdrm/nouveau/nouveau_private.h ++++ b/libdrm/nouveau/nouveau_private.h +@@ -52,6 +52,9 @@ struct nouveau_pushbuf_priv { + unsigned *pushbuf; + unsigned size; + ++ unsigned marker; ++ unsigned marker_relocs; ++ + struct drm_nouveau_gem_pushbuf_bo *buffers; + unsigned nr_buffers; + struct drm_nouveau_gem_pushbuf_reloc *relocs; +@@ -99,6 +102,7 @@ struct nouveau_bo_priv { + /* Tracking */ + struct drm_nouveau_gem_pushbuf_bo *pending; + struct nouveau_channel *pending_channel; ++ int pending_refcnt; + int write_marker; + + /* Userspace object */ +diff --git a/libdrm/nouveau/nouveau_pushbuf.c b/libdrm/nouveau/nouveau_pushbuf.c +index d434a5f..90250c0 100644 +--- a/libdrm/nouveau/nouveau_pushbuf.c ++++ b/libdrm/nouveau/nouveau_pushbuf.c +@@ -60,17 +60,17 @@ nouveau_pushbuf_emit_reloc(struct nouveau_channel *chan, void *ptr, + uint32_t flags, uint32_t vor, uint32_t tor) + { + struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(chan->pushbuf); ++ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); + struct drm_nouveau_gem_pushbuf_reloc *r; + struct drm_nouveau_gem_pushbuf_bo *pbbo; + uint32_t domains = 0; + + if (nvpb->nr_relocs >= NOUVEAU_GEM_MAX_RELOCS) { + fprintf(stderr, "too many relocs!!\n"); +- assert(0); + return -ENOMEM; + } + +- if (nouveau_bo(bo)->user && (flags & NOUVEAU_BO_WR)) { ++ if (nvbo->user && (flags & NOUVEAU_BO_WR)) { + fprintf(stderr, "write to user buffer!!\n"); + return -EINVAL; + } +@@ -78,16 +78,21 @@ nouveau_pushbuf_emit_reloc(struct nouveau_channel *chan, void *ptr, + pbbo = nouveau_bo_emit_buffer(chan, bo); + if (!pbbo) { + fprintf(stderr, "buffer emit fail :(\n"); +- assert(0); + return -ENOMEM; + } + ++ nvbo->pending_refcnt++; ++ + if (flags & NOUVEAU_BO_VRAM) + domains |= NOUVEAU_GEM_DOMAIN_VRAM; + if (flags & NOUVEAU_BO_GART) + domains |= NOUVEAU_GEM_DOMAIN_GART; ++ ++ if (!(pbbo->valid_domains & domains)) { ++ fprintf(stderr, "no valid domains remain!\n"); ++ return -EINVAL; ++ } + pbbo->valid_domains &= domains; +- assert(pbbo->valid_domains); + + assert(flags & NOUVEAU_BO_RDWR); + if (flags & NOUVEAU_BO_RD) { +@@ -95,7 +100,7 @@ nouveau_pushbuf_emit_reloc(struct nouveau_channel *chan, void *ptr, + } + if (flags & NOUVEAU_BO_WR) { + pbbo->write_domains |= domains; +- nouveau_bo(bo)->write_marker = 1; ++ nvbo->write_marker = 1; + } + + r = nvpb->relocs + nvpb->nr_relocs++; +@@ -322,18 +327,25 @@ restart_push: + /* Update presumed offset/domain for any buffers that moved. + * Dereference all buffers on validate list + */ +- for (i = 0; i < nvpb->nr_buffers; i++) { +- struct drm_nouveau_gem_pushbuf_bo *pbbo = &nvpb->buffers[i]; ++ for (i = 0; i < nvpb->nr_relocs; i++) { ++ struct drm_nouveau_gem_pushbuf_reloc *r = &nvpb->relocs[i]; ++ struct drm_nouveau_gem_pushbuf_bo *pbbo = ++ &nvpb->buffers[r->bo_index]; + struct nouveau_bo *bo = (void *)(unsigned long)pbbo->user_priv; ++ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); ++ ++ if (--nvbo->pending_refcnt) ++ continue; + + if (pbbo->presumed_ok == 0) { +- nouveau_bo(bo)->domain = pbbo->presumed_domain; +- nouveau_bo(bo)->offset = pbbo->presumed_offset; ++ nvbo->domain = pbbo->presumed_domain; ++ nvbo->offset = pbbo->presumed_offset; + } + +- nouveau_bo(bo)->pending = NULL; ++ nvbo->pending = NULL; + nouveau_bo_ref(NULL, &bo); + } ++ + nvpb->nr_buffers = 0; + nvpb->nr_relocs = 0; + +@@ -343,6 +355,57 @@ restart_push: + if (chan->flush_notify) + chan->flush_notify(chan); + ++ nvpb->marker = 0; + return ret; + } + ++int ++nouveau_pushbuf_marker_emit(struct nouveau_channel *chan, ++ unsigned wait_dwords, unsigned wait_relocs) ++{ ++ struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(chan->pushbuf); ++ ++ if (AVAIL_RING(chan) < wait_dwords) ++ return nouveau_pushbuf_flush(chan, wait_dwords); ++ ++ if (nvpb->nr_relocs + wait_relocs >= NOUVEAU_GEM_MAX_RELOCS) ++ return nouveau_pushbuf_flush(chan, wait_dwords); ++ ++ nvpb->marker = nvpb->base.cur - nvpb->pushbuf; ++ nvpb->marker_relocs = nvpb->nr_relocs; ++ return 0; ++} ++ ++void ++nouveau_pushbuf_marker_undo(struct nouveau_channel *chan) ++{ ++ struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(chan->pushbuf); ++ unsigned i; ++ ++ if (!nvpb->marker) ++ return; ++ ++ /* undo any relocs/buffers added to the list since last marker */ ++ for (i = nvpb->marker_relocs; i < nvpb->nr_relocs; i++) { ++ struct drm_nouveau_gem_pushbuf_reloc *r = &nvpb->relocs[i]; ++ struct drm_nouveau_gem_pushbuf_bo *pbbo = ++ &nvpb->buffers[r->bo_index]; ++ struct nouveau_bo *bo = (void *)(unsigned long)pbbo->user_priv; ++ struct nouveau_bo_priv *nvbo = nouveau_bo(bo); ++ ++ if (--nvbo->pending_refcnt) ++ continue; ++ ++ nvbo->pending = NULL; ++ nouveau_bo_ref(NULL, &bo); ++ nvpb->nr_buffers--; ++ } ++ nvpb->nr_relocs = nvpb->marker_relocs; ++ ++ /* reset pushbuf back to last marker */ ++ nvpb->base.cur = nvpb->pushbuf + nvpb->marker; ++ nvpb->base.remaining = nvpb->size - nvpb->marker; ++ nvpb->marker = 0; ++} ++ ++ +diff --git a/libdrm/nouveau/nouveau_pushbuf.h b/libdrm/nouveau/nouveau_pushbuf.h +index 3c746ed..c7ac8c4 100644 +--- a/libdrm/nouveau/nouveau_pushbuf.h ++++ b/libdrm/nouveau/nouveau_pushbuf.h +@@ -40,11 +40,30 @@ int + nouveau_pushbuf_flush(struct nouveau_channel *, unsigned min); + + int ++nouveau_pushbuf_marker_emit(struct nouveau_channel *chan, ++ unsigned wait_dwords, unsigned wait_relocs); ++ ++void ++nouveau_pushbuf_marker_undo(struct nouveau_channel *chan); ++ ++int + nouveau_pushbuf_emit_reloc(struct nouveau_channel *, void *ptr, + struct nouveau_bo *, uint32_t data, uint32_t data2, + uint32_t flags, uint32_t vor, uint32_t tor); + + /* Push buffer access macros */ ++static __inline__ int ++MARK_RING(struct nouveau_channel *chan, unsigned dwords, unsigned relocs) ++{ ++ return nouveau_pushbuf_marker_emit(chan, dwords, relocs); ++} ++ ++static __inline__ void ++MARK_UNDO(struct nouveau_channel *chan) ++{ ++ nouveau_pushbuf_marker_undo(chan); ++} ++ + static __inline__ void + OUT_RING(struct nouveau_channel *chan, unsigned data) + { +@@ -116,62 +135,62 @@ BIND_RING(struct nouveau_channel *chan, struct nouveau_grobj *gr, unsigned sc) + OUT_RING (chan, gr->handle); + } + +-static __inline__ void ++static __inline__ int + OUT_RELOC(struct nouveau_channel *chan, struct nouveau_bo *bo, + unsigned data, unsigned flags, unsigned vor, unsigned tor) + { +- nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, bo, +- data, 0, flags, vor, tor); ++ return nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, bo, ++ data, 0, flags, vor, tor); + } + +-static __inline__ void ++static __inline__ int + OUT_RELOC2(struct nouveau_channel *chan, struct nouveau_bo *bo, + unsigned data, unsigned data2, unsigned flags, + unsigned vor, unsigned tor) + { +- nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, bo, +- data, data2, flags, vor, tor); ++ return nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, bo, ++ data, data2, flags, vor, tor); + } + + /* Raw data + flags depending on FB/TT buffer */ +-static __inline__ void ++static __inline__ int + OUT_RELOCd(struct nouveau_channel *chan, struct nouveau_bo *bo, + unsigned data, unsigned flags, unsigned vor, unsigned tor) + { +- OUT_RELOC(chan, bo, data, flags | NOUVEAU_BO_OR, vor, tor); ++ return OUT_RELOC(chan, bo, data, flags | NOUVEAU_BO_OR, vor, tor); + } + + /* FB/TT object handle */ +-static __inline__ void ++static __inline__ int + OUT_RELOCo(struct nouveau_channel *chan, struct nouveau_bo *bo, + unsigned flags) + { +- OUT_RELOC(chan, bo, 0, flags | NOUVEAU_BO_OR, +- chan->vram->handle, chan->gart->handle); ++ return OUT_RELOC(chan, bo, 0, flags | NOUVEAU_BO_OR, ++ chan->vram->handle, chan->gart->handle); + } + + /* Low 32-bits of offset */ +-static __inline__ void ++static __inline__ int + OUT_RELOCl(struct nouveau_channel *chan, struct nouveau_bo *bo, + unsigned delta, unsigned flags) + { +- OUT_RELOC(chan, bo, delta, flags | NOUVEAU_BO_LOW, 0, 0); ++ return OUT_RELOC(chan, bo, delta, flags | NOUVEAU_BO_LOW, 0, 0); + } + + /* Low 32-bits of offset + GPU linear access range info */ +-static __inline__ void ++static __inline__ int + OUT_RELOCr(struct nouveau_channel *chan, struct nouveau_bo *bo, + unsigned delta, unsigned size, unsigned flags) + { +- OUT_RELOC2(chan, bo, delta, size, flags | NOUVEAU_BO_LOW, 0, 0); ++ return OUT_RELOC2(chan, bo, delta, size, flags | NOUVEAU_BO_LOW, 0, 0); + } + + /* High 32-bits of offset */ +-static __inline__ void ++static __inline__ int + OUT_RELOCh(struct nouveau_channel *chan, struct nouveau_bo *bo, + unsigned delta, unsigned flags) + { +- OUT_RELOC(chan, bo, delta, flags | NOUVEAU_BO_HIGH, 0, 0); ++ return OUT_RELOC(chan, bo, delta, flags | NOUVEAU_BO_HIGH, 0, 0); + } + + #endif diff --git a/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-drop-rendering.patch b/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-drop-rendering.patch new file mode 100644 index 00000000..fe414f75 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-drop-rendering.patch @@ -0,0 +1,103 @@ +diff --git a/libdrm/nouveau/nouveau_private.h b/libdrm/nouveau/nouveau_private.h +index 67144e3..9ce87fb 100644 +--- a/libdrm/nouveau/nouveau_private.h ++++ b/libdrm/nouveau/nouveau_private.h +@@ -41,6 +41,7 @@ + struct nouveau_pushbuf_priv { + struct nouveau_pushbuf base; + ++ int no_aper_update; + int use_cal; + uint32_t cal_suffix0; + uint32_t cal_suffix1; +diff --git a/libdrm/nouveau/nouveau_pushbuf.c b/libdrm/nouveau/nouveau_pushbuf.c +index fbcddd7..d434a5f 100644 +--- a/libdrm/nouveau/nouveau_pushbuf.c ++++ b/libdrm/nouveau/nouveau_pushbuf.c +@@ -202,10 +202,17 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan) + req.channel = chan->id; + req.handle = 0; + ret = drmCommandWriteRead(nouveau_device(dev)->fd, +- DRM_NOUVEAU_GEM_PUSHBUF_CALL, ++ DRM_NOUVEAU_GEM_PUSHBUF_CALL2, + &req, sizeof(req)); +- if (ret) +- return; ++ if (ret) { ++ ret = drmCommandWriteRead(nouveau_device(dev)->fd, ++ DRM_NOUVEAU_GEM_PUSHBUF_CALL2, ++ &req, sizeof(req)); ++ if (ret) ++ return; ++ ++ nvpb->no_aper_update = 1; ++ } + + for (i = 0; i < CALPB_BUFFERS; i++) { + ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, +@@ -282,14 +289,18 @@ restart_cal: + nvpb->current_offset; + req.suffix0 = nvpb->cal_suffix0; + req.suffix1 = nvpb->cal_suffix1; +- ret = drmCommandWriteRead(nvdev->fd, +- DRM_NOUVEAU_GEM_PUSHBUF_CALL, ++ ret = drmCommandWriteRead(nvdev->fd, nvpb->no_aper_update ? ++ DRM_NOUVEAU_GEM_PUSHBUF_CALL : ++ DRM_NOUVEAU_GEM_PUSHBUF_CALL2, + &req, sizeof(req)); + if (ret == -EAGAIN) + goto restart_cal; + nvpb->cal_suffix0 = req.suffix0; + nvpb->cal_suffix1 = req.suffix1; +- assert(ret == 0); ++ if (!nvpb->no_aper_update) { ++ nvdev->base.vm_vram_size = req.vram_available; ++ nvdev->base.vm_gart_size = req.gart_available; ++ } + } else { + struct drm_nouveau_gem_pushbuf req; + +@@ -305,7 +316,6 @@ restart_push: + &req, sizeof(req)); + if (ret == -EAGAIN) + goto restart_push; +- assert(ret == 0); + } + + +@@ -328,12 +338,11 @@ restart_push: + nvpb->nr_relocs = 0; + + /* Allocate space for next push buffer */ +- ret = nouveau_pushbuf_space(chan, min); +- assert(!ret); ++ assert(!nouveau_pushbuf_space(chan, min)); + + if (chan->flush_notify) + chan->flush_notify(chan); + +- return 0; ++ return ret; + } + +diff --git a/shared-core/nouveau_drm.h b/shared-core/nouveau_drm.h +index 2050357..1e67c44 100644 +--- a/shared-core/nouveau_drm.h ++++ b/shared-core/nouveau_drm.h +@@ -155,6 +155,9 @@ struct drm_nouveau_gem_pushbuf_call { + uint64_t relocs; + uint32_t suffix0; + uint32_t suffix1; ++ /* below only accessed for CALL2 */ ++ uint64_t vram_available; ++ uint64_t gart_available; + }; + + struct drm_nouveau_gem_pin { +@@ -212,5 +215,6 @@ struct drm_nouveau_sarea { + #define DRM_NOUVEAU_GEM_CPU_PREP 0x45 + #define DRM_NOUVEAU_GEM_CPU_FINI 0x46 + #define DRM_NOUVEAU_GEM_INFO 0x47 ++#define DRM_NOUVEAU_GEM_PUSHBUF_CALL2 0x48 + + #endif /* __NOUVEAU_DRM_H__ */ diff --git a/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-restart-pushbuf.patch b/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-restart-pushbuf.patch new file mode 100644 index 00000000..408a519c --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libdrm-nouveau-restart-pushbuf.patch @@ -0,0 +1,50 @@ +From 67628aa39dd74807989492af5451a3a5c0232e39 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Tue, 20 Oct 2009 12:57:46 +1000 +Subject: [PATCH] nouveau: retry if pushbuf ioctl interrupted by signal + +Signed-off-by: Ben Skeggs +--- + libdrm/nouveau/nouveau_pushbuf.c | 6 ++++++ + 1 files changed, 6 insertions(+), 0 deletions(-) + +diff --git a/libdrm/nouveau/nouveau_pushbuf.c b/libdrm/nouveau/nouveau_pushbuf.c +index 1192e22..fbcddd7 100644 +--- a/libdrm/nouveau/nouveau_pushbuf.c ++++ b/libdrm/nouveau/nouveau_pushbuf.c +@@ -270,6 +270,7 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min) + if (nvpb->base.remaining > 2) /* space() will fixup if not */ + nvpb->base.remaining -= 2; + ++restart_cal: + req.channel = chan->id; + req.handle = nvpb->buffer[nvpb->current]->handle; + req.offset = nvpb->current_offset * 4; +@@ -284,12 +285,15 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min) + ret = drmCommandWriteRead(nvdev->fd, + DRM_NOUVEAU_GEM_PUSHBUF_CALL, + &req, sizeof(req)); ++ if (ret == -EAGAIN) ++ goto restart_cal; + nvpb->cal_suffix0 = req.suffix0; + nvpb->cal_suffix1 = req.suffix1; + assert(ret == 0); + } else { + struct drm_nouveau_gem_pushbuf req; + ++restart_push: + req.channel = chan->id; + req.nr_dwords = nvpb->size - nvpb->base.remaining; + req.dwords = (uint64_t)(unsigned long)nvpb->pushbuf; +@@ -299,6 +303,8 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min) + req.relocs = (uint64_t)(unsigned long)nvpb->relocs; + ret = drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_PUSHBUF, + &req, sizeof(req)); ++ if (ret == -EAGAIN) ++ goto restart_push; + assert(ret == 0); + } + +-- +1.6.5.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/libdrm-page-flip.patch b/contrib/packages/rpm/el5/SOURCES/libdrm-page-flip.patch new file mode 100644 index 00000000..ba4d39f5 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libdrm-page-flip.patch @@ -0,0 +1,174 @@ +diff --git a/libdrm/xf86drm.h b/libdrm/xf86drm.h +index c1d173c..67bea37 100644 +--- a/libdrm/xf86drm.h ++++ b/libdrm/xf86drm.h +@@ -667,4 +667,22 @@ extern void drmMsg(const char *format, ...); + extern int drmSetMaster(int fd); + extern int drmDropMaster(int fd); + ++#define DRM_EVENT_CONTEXT_VERSION 1 ++ ++typedef struct _drmEventContext { ++ ++ /* This struct is versioned so we can add more pointers if we ++ * add more events. */ ++ int version; ++ ++ void (*page_flip_handler)(int fd, ++ unsigned int frame, ++ unsigned int tv_sec, ++ unsigned int tv_usec, ++ void *user_data); ++ ++} drmEventContext, *drmEventContextPtr; ++ ++extern int drmHandleEvent(int fd, drmEventContextPtr evctx); ++ + #endif +diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c +index ea11207..f601a00 100644 +--- a/libdrm/xf86drmMode.c ++++ b/libdrm/xf86drmMode.c +@@ -664,3 +664,56 @@ int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, + + return 0; + } ++ ++int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id, void *user_data) ++{ ++ struct drm_mode_page_flip flip; ++ ++ flip.fb_id = fb_id; ++ flip.crtc_id = crtc_id; ++ flip.user_data = VOID2U64(user_data); ++ flip.flags = 0; ++ ++ return drmIoctl(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip); ++} ++ ++int drmHandleEvent(int fd, drmEventContextPtr evctx) ++{ ++ char buffer[1024]; ++ int len, i; ++ struct drm_event *e; ++ struct drm_event_page_flip *page_flip; ++ ++ /* The DRM read semantics guarantees that we always get only ++ * complete events. */ ++ ++ len = read(fd, buffer, sizeof buffer); ++ if (len == 0) ++ return 0; ++ if (len < sizeof *e) ++ return -1; ++ ++ i = 0; ++ while (i < len) { ++ e = (struct drm_event *) &buffer[i]; ++ switch (e->type) { ++ case DRM_EVENT_MODE_PAGE_FLIP: ++ if (evctx->version < 1 || ++ evctx->page_flip_handler == NULL) ++ break; ++ page_flip = (struct drm_event_page_flip *) e; ++ evctx->page_flip_handler(fd, ++ page_flip->frame, ++ page_flip->tv_sec, ++ page_flip->tv_usec, ++ U642VOID (page_flip->user_data)); ++ break; ++ ++ default: ++ break; ++ } ++ i += e->length; ++ } ++ ++ return 0; ++} +diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h +index 62304bb..fe64707 100644 +--- a/libdrm/xf86drmMode.h ++++ b/libdrm/xf86drmMode.h +@@ -259,8 +259,6 @@ typedef struct _drmModeConnector { + uint32_t *encoders; /**< List of encoder ids */ + } drmModeConnector, *drmModeConnectorPtr; + +- +- + extern void drmModeFreeModeInfo( drmModeModeInfoPtr ptr ); + extern void drmModeFreeResources( drmModeResPtr ptr ); + extern void drmModeFreeFB( drmModeFBPtr ptr ); +@@ -362,3 +360,4 @@ extern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, + uint16_t *red, uint16_t *green, uint16_t *blue); + extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, + uint16_t *red, uint16_t *green, uint16_t *blue); ++extern int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id, void *user_data); +diff --git a/shared-core/drm.h b/shared-core/drm.h +index 97fab9a..8b504cb 100644 +--- a/shared-core/drm.h ++++ b/shared-core/drm.h +@@ -1113,6 +1113,7 @@ struct drm_gem_open { + #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) + #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) + #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, uint32_t) ++#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOW( 0xB0, struct drm_mode_page_flip) + + /*@}*/ + +@@ -1128,6 +1129,30 @@ struct drm_gem_open { + #define DRM_COMMAND_BASE 0x40 + #define DRM_COMMAND_END 0xA0 + ++/** ++ * Header for events written back to userspace on the drm fd. The ++ * type defines the type of event, the length specifies the total ++ * length of the event (including the header), and user_data is ++ * typically a 64 bit value passed with the ioctl that triggered the ++ * event. A read on the drm fd will always only return complete ++ * events, that is, if for example the read buffer is 100 bytes, and ++ * there are two 64 byte events pending, only one will be returned. ++ */ ++struct drm_event { ++ uint32_t type; ++ uint32_t length; ++}; ++ ++#define DRM_EVENT_MODE_PAGE_FLIP 0x01 ++ ++struct drm_event_page_flip { ++ struct drm_event base; ++ uint64_t user_data; ++ uint32_t tv_sec; ++ uint32_t tv_usec; ++ uint32_t frame; ++}; ++ + /* typedef area */ + #ifndef __KERNEL__ + typedef struct drm_clip_rect drm_clip_rect_t; +diff --git a/shared-core/drm_mode.h b/shared-core/drm_mode.h +index 9b92733..bebe4e7 100644 +--- a/shared-core/drm_mode.h ++++ b/shared-core/drm_mode.h +@@ -270,4 +270,20 @@ struct drm_mode_crtc_lut { + uint64_t blue; + }; + ++#define DRM_MODE_PAGE_FLIP_WAIT (1<<0) /* block on previous page flip */ ++#define DRM_MODE_PAGE_FLIP_FLAGS_MASK (DRM_MODE_PAGE_FLIP_WAIT) ++ ++struct drm_mode_page_flip { ++ /** Handle of new front buffer */ ++ uint32_t fb_id; ++ uint32_t crtc_id; ++ ++ /* 64 bit cookie returned to userspace in the page flip event. */ ++ uint64_t user_data; ++ /** ++ * page flip flags (wait on flip only for now) ++ */ ++ uint32_t flags; ++}; ++ + #endif diff --git a/contrib/packages/rpm/el5/SOURCES/libfontenc-1.0.0-get-fontdir-from-pkgconfig.patch b/contrib/packages/rpm/el5/SOURCES/libfontenc-1.0.0-get-fontdir-from-pkgconfig.patch new file mode 100644 index 00000000..ceaf43f6 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/libfontenc-1.0.0-get-fontdir-from-pkgconfig.patch @@ -0,0 +1,13 @@ +diff --git ./configure.ac ./configure.ac +index fc28ef9..63ef0c8 100644 +--- ./configure.ac ++++ ./configure.ac +@@ -37,7 +37,7 @@ AC_PROG_CC + AC_PROG_LIBTOOL + XORG_CWARNFLAGS + +-encodingsdir=${libdir}/X11/fonts/encodings ++encodingsdir=$(pkg-config --variable=fontdir fontutil)/encodings + AC_ARG_WITH(encodingsdir, AC_HELP_STRING([--with-encodingsdir=], + [Path to font encodings]), [encodingsdir="$withval"]) + ENCODINGSDIR="$encodingsdir" diff --git a/contrib/packages/rpm/el5/SOURCES/mesa-7.1-nukeglthread-debug.patch b/contrib/packages/rpm/el5/SOURCES/mesa-7.1-nukeglthread-debug.patch new file mode 100644 index 00000000..3df6e9a3 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/mesa-7.1-nukeglthread-debug.patch @@ -0,0 +1,15 @@ +diff -up Mesa-7.1/src/mesa/drivers/dri/intel/intel_fbo.c.intel-glthread Mesa-7.1/src/mesa/drivers/dri/intel/intel_fbo.c +--- Mesa-7.1/src/mesa/drivers/dri/intel/intel_fbo.c.intel-glthread 2008-08-25 10:49:40.000000000 -0400 ++++ Mesa-7.1/src/mesa/drivers/dri/intel/intel_fbo.c 2008-08-28 14:26:17.000000000 -0400 +@@ -633,11 +633,6 @@ intel_render_texture(GLcontext * ctx, + return; + } + +- DBG("Begin render texture tid %x tex=%u w=%d h=%d refcount=%d\n", +- _glthread_GetID(), +- att->Texture->Name, newImage->Width, newImage->Height, +- irb->Base.RefCount); +- + /* point the renderbufer's region to the texture image region */ + intel_image = intel_texture_image(newImage); + if (irb->region != intel_image->mt->region) { diff --git a/contrib/packages/rpm/el5/SOURCES/mesa-7.1-osmesa-version.patch b/contrib/packages/rpm/el5/SOURCES/mesa-7.1-osmesa-version.patch new file mode 100644 index 00000000..177c0c3b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/mesa-7.1-osmesa-version.patch @@ -0,0 +1,12 @@ +diff -up Mesa-7.1/src/mesa/drivers/osmesa/Makefile.jx Mesa-7.1/src/mesa/drivers/osmesa/Makefile +--- Mesa-7.1/src/mesa/drivers/osmesa/Makefile.jx 2008-08-28 14:05:47.000000000 -0400 ++++ Mesa-7.1/src/mesa/drivers/osmesa/Makefile 2008-08-28 14:07:13.000000000 -0400 +@@ -46,7 +46,7 @@ osmesa8: $(TOP)/lib/$(OSMESA_LIB_NAME) + + $(TOP)/lib/$(OSMESA_LIB_NAME): $(OBJECTS) + $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ +- -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ ++ -major 6 -minor 5 -patch 3 \ + -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \ + $(OSMESA_LIB_DEPS) $(OBJECTS) diff --git a/contrib/packages/rpm/el5/SOURCES/mesa-7.6-glx13-app-warning.patch b/contrib/packages/rpm/el5/SOURCES/mesa-7.6-glx13-app-warning.patch new file mode 100644 index 00000000..c23bc0e5 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/mesa-7.6-glx13-app-warning.patch @@ -0,0 +1,28 @@ +diff -up mesa-20091030/src/glx/x11/glx_pbuffer.c.jx mesa-20091030/src/glx/x11/glx_pbuffer.c +--- mesa-20091030/src/glx/x11/glx_pbuffer.c.jx 2009-10-29 21:12:50.000000000 -0400 ++++ mesa-20091030/src/glx/x11/glx_pbuffer.c 2009-11-17 14:56:07.000000000 -0500 +@@ -35,6 +35,8 @@ + #include + #include + #include ++#include ++#include + #include "glapi.h" + #include "glxextensions.h" + #include "glcontextmodes.h" +@@ -56,10 +58,13 @@ warn_GLX_1_3(Display *dpy, const char *f + __GLXdisplayPrivate *priv = __glXInitialize(dpy); + + if (priv->minorVersion < 3) { ++ char buf[PATH_MAX]; ++ if (readlink("/proc/self/exe", buf, PATH_MAX) == -1) ++ buf[0] = '\0'; + fprintf(stderr, +- "WARNING: Application calling GLX 1.3 function \"%s\" " ++ "WARNING: Application %s calling GLX 1.3 function \"%s\" " + "when GLX 1.3 is not supported! This is an application bug!\n", +- function_name); ++ buf, function_name); + } + } + diff --git a/contrib/packages/rpm/el5/SOURCES/mesa-7.6-hush-vblank-warning.patch b/contrib/packages/rpm/el5/SOURCES/mesa-7.6-hush-vblank-warning.patch new file mode 100644 index 00000000..8ef007b1 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/mesa-7.6-hush-vblank-warning.patch @@ -0,0 +1,12 @@ +diff -up mesa-20090813/src/mesa/drivers/dri/common/vblank.c.jx mesa-20090813/src/mesa/drivers/dri/common/vblank.c +--- mesa-20090813/src/mesa/drivers/dri/common/vblank.c.jx 2009-08-13 09:28:01.000000000 -0400 ++++ mesa-20090813/src/mesa/drivers/dri/common/vblank.c 2009-09-08 14:07:51.000000000 -0400 +@@ -256,7 +256,7 @@ static int do_wait( drmVBlank * vbl, GLu + if ( ret != 0 ) { + static GLboolean first_time = GL_TRUE; + +- if ( first_time ) { ++ if (0) { + fprintf(stderr, + "%s: drmWaitVBlank returned %d, IRQs don't seem to be" + " working correctly.\nTry adjusting the vblank_mode" diff --git a/contrib/packages/rpm/el5/SOURCES/mesa-no-mach64.patch b/contrib/packages/rpm/el5/SOURCES/mesa-no-mach64.patch new file mode 100644 index 00000000..b8d32723 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/mesa-no-mach64.patch @@ -0,0 +1,46 @@ +diff -up mesa-20091030/configure.ac.da mesa-20091030/configure.ac +--- mesa-20091030/configure.ac.da 2009-10-30 11:12:50.000000000 +1000 ++++ mesa-20091030/configure.ac 2009-10-30 14:53:02.000000000 +1000 +@@ -716,7 +716,7 @@ if test "$mesa_driver" = dri; then + # because there is no x86-64 system where they could *ever* + # be used. + if test "x$DRI_DIRS" = "xyes"; then +- DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \ ++ DRI_DIRS="i915 i965 mga r128 r200 r300 r600 radeon \ + savage tdfx unichrome swrast" + fi + ;; +@@ -724,13 +724,13 @@ if test "$mesa_driver" = dri; then + # Build only the drivers for cards that exist on PowerPC. + # At some point MGA will be added, but not yet. + if test "x$DRI_DIRS" = "xyes"; then +- DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast" ++ DRI_DIRS="r128 r200 r300 r600 radeon tdfx swrast" + fi + ;; + sparc*) + # Build only the drivers for cards that exist on sparc` + if test "x$DRI_DIRS" = "xyes"; then +- DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast" ++ DRI_DIRS="r128 r200 r300 r600 radeon ffb swrast" + fi + ;; + esac +@@ -749,7 +749,7 @@ if test "$mesa_driver" = dri; then + # ffb and gamma are missing because they have not been converted + # to use the new interface. + if test "x$DRI_DIRS" = "xyes"; then +- DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \ ++ DRI_DIRS="i810 i915 i965 mga r128 r200 r300 r600 radeon tdfx \ + unichrome savage sis swrast" + fi + ;; +@@ -768,7 +768,7 @@ if test "$mesa_driver" = dri; then + + # default drivers + if test "x$DRI_DIRS" = "xyes"; then +- DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \ ++ DRI_DIRS="i810 i915 i965 mga r128 r200 r300 r600 radeon \ + savage sis tdfx unichrome ffb swrast" + fi + diff --git a/contrib/packages/rpm/el5/SOURCES/pixmap_v2.patch b/contrib/packages/rpm/el5/SOURCES/pixmap_v2.patch new file mode 100644 index 00000000..30315138 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/pixmap_v2.patch @@ -0,0 +1,554 @@ +diff -ur fltk-1.3.2.org/FL/Fl_Image.H fltk-1.3.2/FL/Fl_Image.H +--- fltk-1.3.2.org/FL/Fl_Image.H 2012-11-09 17:02:08.000000000 +0100 ++++ fltk-1.3.2/FL/Fl_Image.H 2013-01-16 14:40:51.543230638 +0100 +@@ -26,6 +26,7 @@ + #include + + class Fl_Widget; ++class Fl_Pixmap; + struct Fl_Menu_Item; + struct Fl_Label; + +@@ -203,6 +204,7 @@ + */ + Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) : + Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);} ++ Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY); + virtual ~Fl_RGB_Image(); + virtual Fl_Image *copy(int W, int H); + Fl_Image *copy() { return copy(w(), h()); } +diff -ur fltk-1.3.2.org/src/fl_draw_pixmap.cxx fltk-1.3.2/src/fl_draw_pixmap.cxx +--- fltk-1.3.2.org/src/fl_draw_pixmap.cxx 2012-04-22 05:09:31.000000000 +0200 ++++ fltk-1.3.2/src/fl_draw_pixmap.cxx 2013-01-16 14:40:51.542230588 +0100 +@@ -58,99 +58,6 @@ + return 1; + } + +-#ifdef U64 +- +-// The callback from fl_draw_image to get a row of data passes this: +-struct pixmap_data { +- int w, h; +- const uchar*const* data; +- union { +- U64 colors[256]; +- U64* byte1[256]; +- }; +-}; +- +-// callback for 1 byte per pixel: +-static void cb1(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+x; +- U64* q = (U64*)buf; +- for (int X=w; X>0; X-=2, p += 2) { +- if (X>1) { +-# if WORDS_BIGENDIAN +- *q++ = (d.colors[p[0]]<<32) | d.colors[p[1]]; +-# else +- *q++ = (d.colors[p[1]]<<32) | d.colors[p[0]]; +-# endif +- } else { +-# if WORDS_BIGENDIAN +- *q++ = d.colors[p[0]]<<32; +-# else +- *q++ = d.colors[p[0]]; +-# endif +- } +- } +-} +- +-// callback for 2 bytes per pixel: +-static void cb2(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+2*x; +- U64* q = (U64*)buf; +- for (int X=w; X>0; X-=2) { +- U64* colors = d.byte1[*p++]; +- int index = *p++; +- if (X>1) { +- U64* colors1 = d.byte1[*p++]; +- int index1 = *p++; +-# if WORDS_BIGENDIAN +- *q++ = (colors[index]<<32) | colors1[index1]; +-# else +- *q++ = (colors1[index1]<<32) | colors[index]; +-# endif +- } else { +-# if WORDS_BIGENDIAN +- *q++ = colors[index]<<32; +-# else +- *q++ = colors[index]; +-# endif +- } +- } +-} +- +-#else // U32 +- +-// The callback from fl_draw_image to get a row of data passes this: +-struct pixmap_data { +- int w, h; +- const uchar*const* data; +- union { +- U32 colors[256]; +- U32* byte1[256]; +- }; +-}; +- +-// callback for 1 byte per pixel: +-static void cb1(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+x; +- U32* q = (U32*)buf; +- for (int X=w; X--;) *q++ = d.colors[*p++]; +-} +- +-// callback for 2 bytes per pixel: +-static void cb2(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+2*x; +- U32* q = (U32*)buf; +- for (int X=w; X--;) { +- U32* colors = d.byte1[*p++]; +- *q++ = colors[*p++]; +- } +-} +- +-#endif // U64 else U32 +- + uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here + + /** +@@ -200,34 +107,33 @@ + } + #endif + +-/** +- Draw XPM image data, with the top-left corner at the given position. +- \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg) +- */ +-int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { +- pixmap_data d; +- if (!fl_measure_pixmap(cdata, d.w, d.h)) return 0; ++int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { ++ int w, h; + const uchar*const* data = (const uchar*const*)(cdata+1); + int transparent_index = -1; ++ ++ if (!fl_measure_pixmap(cdata, w, h)) ++ return 0; ++ ++ if ((chars_per_pixel < 1) || (chars_per_pixel > 2)) ++ return 0; ++ ++ uchar colors[1<<(chars_per_pixel*8)][4]; ++ + #ifdef WIN32 + uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the RGB of the transparent color + color_count = 0; + used_colors = (uchar *)malloc(abs(ncolors)*3*sizeof(uchar)); + #endif + +- if (ncolors < 0) { // FLTK (non standard) compressed colormap ++ if (ncolors < 0) { ++ // FLTK (non standard) compressed colormap + ncolors = -ncolors; + const uchar *p = *data++; + // if first color is ' ' it is transparent (put it later to make + // it not be transparent): + if (*p == ' ') { +- uchar* c = (uchar*)&d.colors[(int)' ']; +-#ifdef U64 +- *(U64*)c = 0; +-# if WORDS_BIGENDIAN +- c += 4; +-# endif +-#endif ++ uchar* c = colors[(int)' ']; + transparent_index = ' '; + Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0; + #ifdef WIN32 +@@ -238,13 +144,7 @@ + } + // read all the rest of the colors: + for (int i=0; i < ncolors; i++) { +- uchar* c = (uchar*)&d.colors[*p++]; +-#ifdef U64 +- *(U64*)c = 0; +-# if WORDS_BIGENDIAN +- c += 4; +-# endif +-#endif ++ uchar* c = colors[*p++]; + #ifdef WIN32 + used_colors[3*color_count] = *p; + used_colors[3*color_count+1] = *(p+1); +@@ -254,69 +154,44 @@ + *c++ = *p++; + *c++ = *p++; + *c++ = *p++; +-#ifdef __APPLE_QUARTZ__ + *c = 255; +-#else +- *c = 0; +-#endif + } +- } else { // normal XPM colormap with names +- if (chars_per_pixel>1) memset(d.byte1, 0, sizeof(d.byte1)); ++ } else { ++ // normal XPM colormap with names + for (int i=0; i1) { +-#ifdef U64 +- U64* colors = d.byte1[ind]; +- if (!colors) colors = d.byte1[ind] = new U64[256]; +-#else +- U32* colors = d.byte1[ind]; +- if (!colors) colors = d.byte1[ind] = new U32[256]; +-#endif +- c = (uchar*)&colors[*p]; +- ind = (ind<<8)|*p++; +- } else { +- c = (uchar *)&d.colors[ind]; +- } ++ if (chars_per_pixel>1) ++ ind = (ind<<8)|*p++; ++ c = colors[ind]; + // look for "c word", or last word if none: + const uchar *previous_word = p; + for (;;) { +- while (*p && isspace(*p)) p++; +- uchar what = *p++; +- while (*p && !isspace(*p)) p++; +- while (*p && isspace(*p)) p++; +- if (!*p) {p = previous_word; break;} +- if (what == 'c') break; +- previous_word = p; +- while (*p && !isspace(*p)) p++; ++ while (*p && isspace(*p)) p++; ++ uchar what = *p++; ++ while (*p && !isspace(*p)) p++; ++ while (*p && isspace(*p)) p++; ++ if (!*p) {p = previous_word; break;} ++ if (what == 'c') break; ++ previous_word = p; ++ while (*p && !isspace(*p)) p++; + } +-#ifdef U64 +- *(U64*)c = 0; +-# if WORDS_BIGENDIAN +- c += 4; +-# endif +-#endif +-#ifdef __APPLE_QUARTZ__ +- c[3] = 255; +-#endif + int parse = fl_parse_color((const char*)p, c[0], c[1], c[2]); ++ c[3] = 255; + if (parse) { + #ifdef WIN32 +- used_colors[3*color_count] = c[0]; +- used_colors[3*color_count+1] = c[1]; +- used_colors[3*color_count+2] = c[2]; +- color_count++; ++ used_colors[3*color_count] = c[0]; ++ used_colors[3*color_count+1] = c[1]; ++ used_colors[3*color_count+2] = c[2]; ++ color_count++; + #endif +- } +- else { ++ } else { + // assume "None" or "#transparent" for any errors +- // "bg" should be transparent... +- Fl::get_color(bg, c[0], c[1], c[2]); +-#ifdef __APPLE_QUARTZ__ ++ // "bg" should be transparent... ++ Fl::get_color(bg, c[0], c[1], c[2]); + c[3] = 0; +-#endif + transparent_index = ind; + #ifdef WIN32 + transparent_c = c; +@@ -324,7 +199,6 @@ + } + } + } +- d.data = data; + #ifdef WIN32 + if (transparent_c) { + make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]); +@@ -334,77 +208,76 @@ + make_unused_color(r, g, b); + } + #endif ++ ++ U32 *q = (U32*)out; ++ for (int Y = 0; Y < h; Y++) { ++ const uchar* p = data[Y]; ++ if (chars_per_pixel <= 1) { ++ for (int X = 0; X < w; X++) ++ memcpy(q++, colors[*p++], 4); ++ } else { ++ for (int X = 0; X < w; X++) { ++ int ind = (*p++)<<8; ++ ind |= *p++; ++ memcpy(q++, colors[ind], 4); ++ } ++ } ++ } + ++ return 1; ++} ++ ++/** ++ Draw XPM image data, with the top-left corner at the given position. ++ \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg) ++ */ ++int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { ++ int w, h; ++ ++ if (!fl_measure_pixmap(cdata, w, h)) ++ return 0; ++ ++ uchar buffer[w*h*4]; ++ ++ if (!fl_convert_pixmap(cdata, buffer, bg)) ++ return 0; ++ ++ // FIXME: Hack until fl_draw_image() supports alpha properly + #ifdef __APPLE_QUARTZ__ + if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) { +- U32 *array = new U32[d.w * d.h], *q = array; +- for (int Y = 0; Y < d.h; Y++) { +- const uchar* p = data[Y]; +- if (chars_per_pixel <= 1) { +- for (int X = 0; X < d.w; X++) { +- *q++ = d.colors[*p++]; +- } +- } else { +- for (int X = 0; X < d.w; X++) { +- U32* colors = (U32*)d.byte1[*p++]; +- *q++ = colors[*p++]; +- } +- } +- } +- Fl_RGB_Image* rgb = new Fl_RGB_Image((uchar*)array, d.w, d.h, 4); ++ Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4); + rgb->draw(x, y); + delete rgb; +- delete[] array; +- } +- else { ++ } else { + #endif // __APPLE_QUARTZ__ +- + // build the mask bitmap used by Fl_Pixmap: +- if (fl_mask_bitmap && transparent_index >= 0) { +- int W = (d.w+7)/8; +- uchar* bitmap = new uchar[W * d.h]; ++ if (fl_mask_bitmap) { ++ int W = (w+7)/8; ++ uchar* bitmap = new uchar[W * h]; + *fl_mask_bitmap = bitmap; +- for (int Y = 0; Y < d.h; Y++) { +- const uchar* p = data[Y]; +- if (chars_per_pixel <= 1) { +- int dw = d.w; +- for (int X = 0; X < W; X++) { +- uchar b = (dw-->0 && *p++ != transparent_index); +- if (dw-->0 && *p++ != transparent_index) b |= 2; +- if (dw-->0 && *p++ != transparent_index) b |= 4; +- if (dw-->0 && *p++ != transparent_index) b |= 8; +- if (dw-->0 && *p++ != transparent_index) b |= 16; +- if (dw-->0 && *p++ != transparent_index) b |= 32; +- if (dw-->0 && *p++ != transparent_index) b |= 64; +- if (dw-->0 && *p++ != transparent_index) b |= 128; ++ const uchar *p = &buffer[3]; ++ uchar b = 0; ++ for (int Y = 0; Y < h; Y++) { ++ b = 0; ++ for (int X = 0, bit = 1; X < w; X++, p += 4) { ++ if (*p > 127) b |= bit; ++ bit <<= 1; ++ if (bit > 0x80 || X == w-1) { + *bitmap++ = b; +- } +- } else { +- uchar b = 0, bit = 1; +- for (int X = 0; X < d.w; X++) { +- int ind = *p++; +- ind = (ind<<8) | (*p++); +- if (ind != transparent_index) b |= bit; +- +- if (bit < 128) bit <<= 1; +- else { +- *bitmap++ = b; +- b = 0; +- bit = 1; ++ bit = 1; ++ b = 0; + } + } +- +- if (bit > 1) *bitmap++ = b; + } +- } ++ + } + +- fl_draw_image(chars_per_pixel==1 ? cb1 : cb2, &d, x, y, d.w, d.h, 4); ++ fl_draw_image(buffer, x, y, w, h, 4); ++ + #ifdef __APPLE_QUARTZ__ + } + #endif + +- if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete[] d.byte1[i]; + return 1; + } + +diff -ur fltk-1.3.2.org/src/Fl_Image.cxx fltk-1.3.2/src/Fl_Image.cxx +--- fltk-1.3.2.org/src/Fl_Image.cxx 2012-11-09 17:02:08.000000000 +0100 ++++ fltk-1.3.2/src/Fl_Image.cxx 2013-01-16 14:41:38.404162795 +0100 +@@ -165,7 +165,22 @@ + // + size_t Fl_RGB_Image::max_size_ = ~((size_t)0); + +-/** The destructor free all memory and server resources that are used by the image. */ ++int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg); ++ ++/** The constructor creates a new RGBA image from the specified Fl_Pixmap. ++ ++ The RGBA image is built fully opaque except for the transparent area ++ of the pixmap that is assigned the \par bg color with full transparency */ ++Fl_RGB_Image::Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg): ++ Fl_Image(pxm->w(), pxm->h(), 4), id_(0), mask_(0) ++{ ++ array = new uchar[w() * h() * d()]; ++ alloc_array = 1; ++ fl_convert_pixmap(pxm->data(), (uchar*)array, bg); ++ data((const char **)&array, 1); ++} ++ ++/** The destructor frees all memory and server resources that are used by the image. */ + Fl_RGB_Image::~Fl_RGB_Image() { + uncache(); + if (alloc_array) delete[] (uchar *)array; +diff -ur fltk-1.3.2.org/src/ps_image.cxx fltk-1.3.2/src/ps_image.cxx +--- fltk-1.3.2.org/src/ps_image.cxx 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/src/ps_image.cxx 2013-01-16 14:40:51.541228080 +0100 +@@ -185,72 +185,38 @@ + + extern uchar **fl_mask_bitmap; + ++struct callback_data { ++ const uchar *data; ++ int D, LD; ++}; + +-void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { +- double x = ix, y = iy, w = iw, h = ih; + +- if (D<3){ //mono +- draw_image_mono(data, ix, iy, iw, ih, D, LD); +- return; +- } ++static void draw_image_cb(void *data, int x, int y, int w, uchar *buf) { ++ struct callback_data *cb_data; ++ const uchar *curdata; + ++ cb_data = (struct callback_data*)data; ++ curdata = cb_data->data + x*cb_data->D + y*cb_data->LD; + +- int i,j, k; ++ memcpy(buf, curdata, w*cb_data->D); ++} + +- fprintf(output,"save\n"); + +- const char * interpol; +- if (lang_level_>1){ +- if (interpolate_) +- interpol="true"; +- else +- interpol="false"; +- if (mask && lang_level_>2) +- fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol); +- else +- fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol); +- } else +- fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih); ++void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { ++ if (D<3){ //mono ++ draw_image_mono(data, ix, iy, iw, ih, D, LD); ++ return; ++ } + ++ struct callback_data cb_data; + + if (!LD) LD = iw*D; +- uchar *curmask=mask; +- +- for (j=0; j3) { //can do mixing using bg_* colors) +- unsigned int a2 = curdata[3]; //must be int +- unsigned int a = 255-a2; +- r = (a2 * r + bg_r * a)/255; +- g = (a2 * g + bg_g * a)/255; +- b = (a2 * b + bg_b * a)/255; +- } +- if (!(i%40)) fprintf(output, "\n"); +- fprintf(output, "%.2x%.2x%.2x", r, g, b); +- curdata +=D; +- } +- fprintf(output,"\n"); +- +- } +- +- fprintf(output," >\nrestore\n" ); + ++ cb_data.data = data; ++ cb_data.D = D; ++ cb_data.LD = LD; + ++ draw_image(draw_image_cb, &cb_data, ix, iy, iw, ih, D); + } + + void Fl_PostScript_Graphics_Driver::draw_image(Fl_Draw_Image_Cb call, void *data, int ix, int iy, int iw, int ih, int D) { +@@ -325,6 +291,14 @@ + uchar g = curdata[1]; + uchar b = curdata[2]; + ++ if (lang_level_<3 && D>3) { //can do mixing using bg_* colors) ++ unsigned int a2 = curdata[3]; //must be int ++ unsigned int a = 255-a2; ++ r = (a2 * r + bg_r * a)/255; ++ g = (a2 * g + bg_g * a)/255; ++ b = (a2 * b + bg_b * a)/255; ++ } ++ + if (!(i%40)) fputs("\n", output); + fprintf(output, "%.2x%.2x%.2x", r, g, b); + diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc-ac-compatibility.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc-ac-compatibility.patch new file mode 100644 index 00000000..d1b41338 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc-ac-compatibility.patch @@ -0,0 +1,15 @@ +diff --git a/m4/shave.m4 b/m4/shave.m4 +index 01cb5c7..0dfde6c 100644 +--- a/m4/shave.m4 ++++ b/m4/shave.m4 +@@ -32,8 +32,8 @@ AC_DEFUN([SHAVE_INIT], + if test x"$enable_shave" = xyes; then + dnl where can we find the shave scripts? + m4_if([$1],, +- [shavedir="$ac_pwd"], +- [shavedir="$ac_pwd/$1"]) ++ [shavedir=`pwd`], ++ [shavedir=`pwd`/$1]) + AC_SUBST(shavedir) + + dnl make is now quiet diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc-cookie.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc-cookie.patch new file mode 100644 index 00000000..c066a5f8 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc-cookie.patch @@ -0,0 +1,37 @@ +diff -up tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie tigervnc-1.0.90-20091221svn3929/unix/vncserver +--- tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie 2009-11-12 11:39:54.000000000 +0100 ++++ tigervnc-1.0.90-20091221svn3929/unix/vncserver 2009-12-21 16:15:01.907799091 +0100 +@@ -189,27 +189,12 @@ $vncPort = 5900 + $displayNumber; + $desktopLog = "$vncUserDir/$host:$displayNumber.log"; + unlink($desktopLog); + +-# Make an X server cookie - use /dev/urandom on systems that have it, +-# otherwise use perl's random number generator, seeded with the sum +-# of the current time, our PID and part of the encrypted form of the password. +- +-my $cookie = ""; +-if (open(URANDOM, '<', '/dev/urandom')) { +- my $randata; +- if (sysread(URANDOM, $randata, 16) == 16) { +- $cookie = unpack 'h*', $randata; +- } +- close(URANDOM); +-} +-if ($cookie eq "") { +- srand(time+$$+unpack("L",`cat $vncUserDir/passwd`)); +- for (1..16) { +- $cookie .= sprintf("%02x", int(rand(256)) % 256); +- } +-} +- +-system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); +-system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); ++# Make an X server cookie - use mcookie ++$cookie = `/usr/bin/mcookie`; ++open (XAUTH, "|xauth -f $xauthorityFile source -"); ++print XAUTH "add $host:$displayNumber . $cookie\n"; ++print XAUTH "add $host/unix:$displayNumber . $cookie\n"; ++close XAUTH; + + if ($opt{'-name'}) { + $desktopName = $opt{'-name'}; diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc-xorg-1.7.5-remove-copyisolatin1lowered.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc-xorg-1.7.5-remove-copyisolatin1lowered.patch new file mode 100644 index 00000000..31505288 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc-xorg-1.7.5-remove-copyisolatin1lowered.patch @@ -0,0 +1,33 @@ +--- a/dix/dixutils.c 2012-06-28 11:06:25.676773000 -0400 ++++ b/dix/dixutils.c 2012-06-28 11:07:05.224177000 -0400 +@@ -165,16 +165,6 @@ + } + + +-void +-CopyISOLatin1Lowered(unsigned char *dest, unsigned char *source, int length) +-{ +- int i; +- +- for (i = 0; i < length; i++, source++, dest++) +- *dest = ISOLatin1ToLower (*source); +- *dest = '\0'; +-} +- + int + CompareISOLatin1Lowered(unsigned char *s1, int s1len, + unsigned char *s2, int s2len) +--- a/include/dix.h 2012-06-28 11:07:38.135955000 -0400 ++++ b/include/dix.h 2012-06-28 11:07:45.120547000 -0400 +@@ -173,11 +173,6 @@ + extern _X_HIDDEN Bool CreateConnectionBlock(void); + /* dixutils.c */ + +-extern _X_EXPORT void CopyISOLatin1Lowered( +- unsigned char * /*dest*/, +- unsigned char * /*source*/, +- int /*length*/); +- + extern _X_EXPORT int CompareISOLatin1Lowered( + unsigned char * /*a*/, + int alen, diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc11-gethomedir.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc11-gethomedir.patch new file mode 100644 index 00000000..fd07be3b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc11-gethomedir.patch @@ -0,0 +1,20 @@ +diff -up tigervnc-1.0.90/unix/xserver/hw/vnc/Makefile.am.gethomedir tigervnc-1.0.90/unix/xserver/hw/vnc/Makefile.am +--- tigervnc-1.0.90/unix/xserver/hw/vnc/Makefile.am.gethomedir 2011-03-22 10:53:05.206429397 +0100 ++++ tigervnc-1.0.90/unix/xserver/hw/vnc/Makefile.am 2011-03-22 10:53:30.550388457 +0100 +@@ -5,6 +5,7 @@ RFB_LIB=$(LIB_DIR)/rfb/librfb.la + RDR_LIB=$(LIB_DIR)/rdr/librdr.la $(GNUTLS_LDFLAGS) + NETWORK_LIB=$(LIB_DIR)/network/libnetwork.la + XREGION_LIB=$(LIB_DIR)/Xregion/libXregion.la ++OS_LIB=$(LIB_DIR)/os/libos.la + COMMON_LIBS=$(NETWORK_LIB) $(RFB_LIB) $(RDR_LIB) $(XREGION_LIB) + + noinst_LTLIBRARIES = libvnccommon.la +@@ -52,7 +53,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I + + libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now + +-libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) ++libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) $(OS_LIB) + + EXTRA_DIST = Xvnc.man + diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc11-ldnow.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc11-ldnow.patch new file mode 100644 index 00000000..0db5d883 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc11-ldnow.patch @@ -0,0 +1,12 @@ +diff -up tigervnc-1.0.90-20100721svn4113/unix/xserver/hw/vnc/Makefile.am.ldnow tigervnc-1.0.90-20100721svn4113/unix/xserver/hw/vnc/Makefile.am +--- tigervnc-1.0.90-20100721svn4113/unix/xserver/hw/vnc/Makefile.am.ldnow 2010-05-18 15:48:02.000000000 +0200 ++++ tigervnc-1.0.90-20100721svn4113/unix/xserver/hw/vnc/Makefile.am 2010-07-21 17:05:45.242942531 +0200 +@@ -50,7 +50,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I + -I$(top_srcdir)/hw/xfree86/os-support/bus \ + -I$(includedir)/pixman-1 -I$(includedir) + +-libvnc_la_LDFLAGS = -module -avoid-version ++libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now + + libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) + diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc11-rh692048.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc11-rh692048.patch new file mode 100644 index 00000000..924c1cf6 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc11-rh692048.patch @@ -0,0 +1,44 @@ +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx.rh690245 2011-02-21 14:14:16.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx 2011-03-31 09:47:34.519099718 +0200 +@@ -45,7 +45,7 @@ StringParameter SecurityClient::secTypes + ("SecurityTypes", + "Specify which security scheme to use (None, VncAuth)", + #ifdef HAVE_GNUTLS +- "X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", ++ "VeNCrypt,X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", + #else + "VncAuth,None", + #endif +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx.rh690245 2011-02-21 14:14:16.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx 2011-03-31 09:47:34.519099718 +0200 +@@ -67,7 +67,6 @@ const std::list Security::GetEn + list result; + list::iterator i; + +- result.push_back(secTypeVeNCrypt); + for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) + if (*i < 0x100) + result.push_back(*i); +@@ -105,8 +104,6 @@ bool Security::IsSupported(U32 secType) + for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) + if (*i == secType) + return true; +- if (secType == secTypeVeNCrypt) +- return true; + + return false; + } +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx.rh690245 2011-02-21 14:50:17.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx 2011-03-31 10:06:43.595362302 +0200 +@@ -39,7 +39,7 @@ StringParameter SecurityServer::secTypes + ("SecurityTypes", + "Specify which security scheme to use (None, VncAuth)", + #ifdef HAVE_GNUTLS +- "VncAuth,TLSVnc", ++ "VncAuth", + #else + "VncAuth", + #endif diff --git a/contrib/packages/rpm/el5/SOURCES/vncserver.service b/contrib/packages/rpm/el5/SOURCES/vncserver.service new file mode 100644 index 00000000..fb4c0de1 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/vncserver.service @@ -0,0 +1,91 @@ +#!/bin/bash +# +# Init file for TigerVNC Server +# +# Written by Dag Wieers +# +# chkconfig: - 91 35 +# description: TigerVNC remote X administration daemon. +# +# processname: Xvnc + +source /etc/rc.d/init.d/functions +source /etc/sysconfig/network + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 1 + +[ -x /usr/bin/Xvnc ] || exit 1 + +### Default variables +SYSCONFIG="/etc/sysconfig/vncservers" +VNCSERVERS="" + +### Read configuration +[ -r "$SYSCONFIG" ] && source "$SYSCONFIG" + +RETVAL=0 +prog="Xvnc" +desc="TigerVNC remote administration daemon" + +start() { + echo -n $"Starting $desc ($prog):" + ulimit -S -c 0 &>/dev/null + for display in ${VNCSERVERS}; do + echo -n "${display} " + unset BASH_ENV ENV + initlog $INITLOG_ARGS -c \ + "su ${display##*:} -c \"cd ~${display##*:} && [ -f .vnc/passwd ] && vncserver :${display%:*} ${VNCSERVERARGS[${display%:*}]}\"" + RETVAL=$? + [ "$RETVAL" -ne 0 ] && break + done + [ "$RETVAL" -eq 0 ] && success $"vncserver startup" || failure $"vncserver start" + echo + [ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/$prog + return $RETVAL +} + +stop() { + echo -n $"Shutting down $desc ($prog): " + for display in ${VNCSERVERS}; do + echo -n "${display} " + unset BASH_ENV ENV + initlog $INITLOG_ARGS -c \ + "su ${display##*:} -c \"vncserver -kill :${display%:*}\" &>/dev/null" + done + RETVAL=$? + [ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || failure $"vncserver shutdown" + echo + [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/$prog + return $RETVAL +} + +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + condrestart) + [ -e /var/lock/subsys/$prog ] && restart + RETVAL=$? + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|condrestart|status}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig b/contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig new file mode 100644 index 00000000..5940a1e7 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/vncserver.sysconfig @@ -0,0 +1,19 @@ +# The VNCSERVERS variable is a list of display:user pairs. +# +# Uncomment the lines below to start a VNC server on display :2 +# as my 'myusername' (adjust this to your own). You will also +# need to set a VNC password; run 'man vncpasswd' to see how +# to do that. +# +# DO NOT RUN THIS SERVICE if your local area network is +# untrusted! For a secure way of using VNC, see this URL: +# http://kbase.redhat.com/faq/docs/DOC-7028 + +# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. + +# Use "-localhost" to prevent remote VNC clients connecting except when +# doing so through a secure tunnel. See the "-via" option in the +# `man vncviewer' manual page. + +# VNCSERVERS="2:myusername" +# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/rpm/el5/SOURCES/vncviewer.desktop b/contrib/packages/rpm/el5/SOURCES/vncviewer.desktop new file mode 100644 index 00000000..fab46f0a --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/vncviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=TigerVNC Viewer +Name[fr]=Visionneur TigerVNC +Comment=Connect to VNC server and display remote desktop +Comment[fr]=Se connecter à un serveur VNC et afficher le bureau distant +Exec=/usr/bin/vncviewer +Icon=tigervnc +Terminal=false +Type=Application +StartupWMClass=TigerVNC Viewer: Connection Details +Categories=Network;RemoteAccess; diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.1.1-pam.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.1.1-pam.patch new file mode 100644 index 00000000..cce82ea1 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.1.1-pam.patch @@ -0,0 +1,51 @@ +From 89d271cc1cb8214252a213bee37318a82d0e1db4 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 24 May 2010 16:55:24 -0400 +Subject: [PATCH] Build with PAM support + +--- + configure.ac | 2 ++ + hw/dmx/Makefile.am | 1 + + os/utils.c | 1 + + 3 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 776a3ae..b057af9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -310,6 +310,8 @@ AC_CHECK_HEADER([execinfo.h],[ + ])] + ) + ++SYS_LIBS="-lpam_misc -lpam" ++ + dnl --------------------------------------------------------------------------- + dnl Bus options and CPU capabilities. Replaces logic in + dnl hw/xfree86/os-support/bus/Makefile.am, among others. +diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am +index 3c59320..bbf0eb1 100644 +--- a/hw/dmx/Makefile.am ++++ b/hw/dmx/Makefile.am +@@ -83,6 +83,7 @@ Xdmx_SOURCES = dmx.c \ + XDMX_LIBS = \ + @XDMX_LIBS@ \ + $(GLX_LIBS) \ ++ -lpam_misc -lpam \ + input/libdmxinput.a \ + config/libdmxconfig.a + +diff --git a/os/utils.c b/os/utils.c +index 4b43325..38d2732 100644 +--- a/os/utils.c ++++ b/os/utils.c +@@ -1838,6 +1838,7 @@ CheckUserParameters(int argc, char **argv, char **envp) + * usually only done for setuid servers (uid != euid). + */ + ++#define USE_PAM 1 + #ifdef USE_PAM + #include + #include +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-pic-libxf86config.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-pic-libxf86config.patch new file mode 100644 index 00000000..48d2e229 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-pic-libxf86config.patch @@ -0,0 +1,18 @@ +From 4306b434038de7e2b17d3c4a6cfd87db469d3bda Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 10 Dec 2007 11:26:57 -0500 +Subject: [PATCH] Build libxf86config with -fPIC. + +diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am +index b8fab28..ed831c9 100644 +--- a/hw/xfree86/parser/Makefile.am ++++ b/hw/xfree86/parser/Makefile.am +@@ -33,7 +33,7 @@ libxf86config_a_SOURCES = \ + $(INTERNAL_SOURCES) + libxf86config_a_CFLAGS = $(AM_CFLAGS) + +-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) ++AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) -fPIC -fvisibility=hidden + + EXTRA_DIST = \ + Configint.h \ diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-ssh-isnt-local.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-ssh-isnt-local.patch new file mode 100644 index 00000000..d532fe1d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.4.99-ssh-isnt-local.patch @@ -0,0 +1,48 @@ +From 4306b434038de7e2b17d3c4a6cfd87db469d3bda Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 10 Dec 2007 11:26:57 -0500 +Subject: [PATCH] Hack for proper MIT-SHM rejection for ssh-forwarded clients. + +--- + Xext/shm.c | 15 +++++++++++++++ + 1 files changed, 15 insertions(+), 0 deletions(-) + +diff --git a/Xext/shm.c b/Xext/shm.c +index 5937a03..5376c19 100644 +--- a/Xext/shm.c ++++ b/Xext/shm.c +@@ -381,8 +381,21 @@ + mode_t mask; + int uidset = 0, gidset = 0; + LocalClientCredRec *lcc; ++ Bool is_ssh = FALSE; + + if (GetLocalClientCreds(client, &lcc) != -1) { ++#ifdef linux ++ if (lcc->fieldsSet & LCC_PID_SET) { ++ /* ssh isn't actually a local client */ ++ char exe[64], buf[64]; ++ ++ memset(buf, 0, 64); ++ snprintf(exe, 64, "/proc/%d/exe", lcc->pid); ++ readlink(exe, buf, 63); ++ if (strstr(buf, "/ssh")) ++ is_ssh = TRUE; ++ } ++#endif + + if (lcc->fieldsSet & LCC_UID_SET) { + uid = lcc->euid; +@@ -401,6 +414,9 @@ + } + #endif + FreeLocalClientCreds(lcc); ++ ++ if (is_ssh) ++ return -1; + + if (uidset) { + /* User id 0 always gets access */ +-- +1.5.3.4 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-bg-none-root.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-bg-none-root.patch new file mode 100644 index 00000000..097b085a --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-bg-none-root.patch @@ -0,0 +1,155 @@ +From b4e4b980663692a3af5787eeaf2d48eb6c0188ed Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Tue, 4 Aug 2009 14:45:58 +1000 +Subject: [PATCH] Add nr for background=none root + +--- + dix/globals.c | 1 + + dix/window.c | 12 +++++++----- + hw/xfree86/common/xf86Init.c | 11 +++++++++++ + hw/xfree86/common/xf86str.h | 5 ++++- + include/opaque.h | 1 + + os/utils.c | 3 +++ + 6 files changed, 27 insertions(+), 6 deletions(-) + +diff --git a/dix/globals.c b/dix/globals.c +index c24a94f..907a5e8 100644 +--- a/dix/globals.c ++++ b/dix/globals.c +@@ -124,6 +124,7 @@ FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in + CursorPtr rootCursor; + Bool party_like_its_1989 = FALSE; + Bool whiteRoot = FALSE; ++Bool bgNoneRoot = FALSE; + + int cursorScreenDevPriv[MAXSCREENS]; + +diff --git a/dix/window.c b/dix/window.c +index 32e26d9..0bf1d52 100644 +--- a/dix/window.c ++++ b/dix/window.c +@@ -466,22 +466,24 @@ InitRootWindow(WindowPtr pWin) + pWin->optional->cursor = rootCursor; + rootCursor->refcnt++; + ++ pWin->backingStore = defaultBackingStore; ++ pWin->forcedBS = (defaultBackingStore != NotUseful); + + if (party_like_its_1989) { + MakeRootTile(pWin); + backFlag |= CWBackPixmap; ++ pScreen->ChangeWindowAttributes(pWin, backFlag); ++ } else if (bgNoneRoot) { ++ /* nothing, handled in xf86CreateRootWindow */ + } else { + if (whiteRoot) + pWin->background.pixel = pScreen->whitePixel; + else + pWin->background.pixel = pScreen->blackPixel; + backFlag |= CWBackPixel; +- } + +- pWin->backingStore = defaultBackingStore; +- pWin->forcedBS = (defaultBackingStore != NotUseful); +- /* We SHOULD check for an error value here XXX */ +- (*pScreen->ChangeWindowAttributes)(pWin, backFlag); ++ pScreen->ChangeWindowAttributes(pWin, backFlag); ++ } + + MapWindow(pWin, serverClient); + } +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index e84da4e..2a0f47a 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -77,6 +77,7 @@ + #ifdef RENDER + #include "picturestr.h" + #endif ++#include "xace.h" + + #include "xf86VGAarbiter.h" + #include "globals.h" +@@ -234,6 +235,7 @@ xf86CreateRootWindow(WindowPtr pWin) + int ret = TRUE; + int err = Success; + ScreenPtr pScreen = pWin->drawable.pScreen; ++ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RootWinPropPtr pProp; + CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) + dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); +@@ -285,6 +287,15 @@ xf86CreateRootWindow(WindowPtr pWin) + } + } + ++ if (bgNoneRoot && pScrn->canDoBGNoneRoot) { ++ pWin->backgroundState = XaceBackgroundNoneState(pWin); ++ pWin->background.pixel = pScreen->whitePixel; ++ pScreen->ChangeWindowAttributes(pWin, CWBackPixmap | CWBorderPixel | CWCursor | CWBackingStore); ++ } else { ++ pWin->background.pixel = pScreen->blackPixel; ++ pScreen->ChangeWindowAttributes(pWin, CWBackPixel | CWBorderPixel | CWCursor | CWBackingStore); ++ } ++ + DebugF("xf86CreateRootWindow() returns %d\n", ret); + return (ret); + } +diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h +index 5c3ee44..e3c7841 100644 +--- a/hw/xfree86/common/xf86str.h ++++ b/hw/xfree86/common/xf86str.h +@@ -516,7 +516,7 @@ typedef struct _confdrirec { + } confDRIRec, *confDRIPtr; + + /* These values should be adjusted when new fields are added to ScrnInfoRec */ +-#define NUM_RESERVED_INTS 16 ++#define NUM_RESERVED_INTS 15 + #define NUM_RESERVED_POINTERS 14 + #define NUM_RESERVED_FUNCS 11 + +@@ -800,6 +800,9 @@ typedef struct _ScrnInfoRec { + ClockRangesPtr clockRanges; + int adjustFlags; + ++ /* -nr support */ ++ int canDoBGNoneRoot; ++ + /* + * These can be used when the minor ABI version is incremented. + * The NUM_* parameters must be reduced appropriately to keep the +diff --git a/include/opaque.h b/include/opaque.h +index b3c7c70..fcc8c95 100644 +--- a/include/opaque.h ++++ b/include/opaque.h +@@ -71,6 +71,7 @@ extern _X_EXPORT Bool defeatAccessControl; + extern _X_EXPORT long maxBigRequestSize; + extern _X_EXPORT Bool party_like_its_1989; + extern _X_EXPORT Bool whiteRoot; ++extern _X_EXPORT Bool bgNoneRoot; + + extern _X_EXPORT Bool CoreDump; + +diff --git a/os/utils.c b/os/utils.c +index 00abd63..7bfdf8b 100644 +--- a/os/utils.c ++++ b/os/utils.c +@@ -514,6 +514,7 @@ void UseMsg(void) + #endif + ErrorF("-nolisten string don't listen on protocol\n"); + ErrorF("-noreset don't reset after last client exists\n"); ++ ErrorF("-nr create root window with no background\n"); + ErrorF("-reset reset after last client exists\n"); + ErrorF("-p # screen-saver pattern duration (minutes)\n"); + ErrorF("-pn accept failure to listen on all ports\n"); +@@ -861,6 +862,8 @@ ProcessCommandLine(int argc, char *argv[]) + defaultBackingStore = WhenMapped; + else if ( strcmp( argv[i], "-wr") == 0) + whiteRoot = TRUE; ++ else if ( strcmp( argv[i], "-nr") == 0) ++ bgNoneRoot = TRUE; + else if ( strcmp( argv[i], "-maxbigreqsize") == 0) { + if(++i < argc) { + long reqSizeArg = atol(argv[i]); +-- +1.6.0.6 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-projector-fb-size.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-projector-fb-size.patch new file mode 100644 index 00000000..c6178b87 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.5.0-projector-fb-size.patch @@ -0,0 +1,32 @@ +From dc5cedd61e00afec33cbfaa7fdfbb6c357074dbd Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= +Date: Thu, 11 Sep 2008 12:51:31 -0400 +Subject: [PATCH] Make room for an external monitor if we have enough video RAM + +--- + hw/xfree86/modes/xf86Crtc.c | 9 +++++++++ + 1 files changed, 9 insertions(+), 0 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 4de7e05..9bcf81b 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -987,6 +987,15 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp, + if (crtc_height > height) + height = crtc_height; + } ++ ++ /* Make room for an external monitor if we have enough video ram */ ++ if (scrn->videoRam >= 65536) ++ width += 1920; ++ else if (scrn->videoRam >= 32768) ++ width += 1280; ++ else if (scrn->videoRam >= 16384) ++ width += 1024; ++ + if (config->maxWidth && width > config->maxWidth) width = config->maxWidth; + if (config->maxHeight && height > config->maxHeight) height = config->maxHeight; + if (config->minWidth && width < config->minWidth) width = config->minWidth; +-- +1.6.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.5.1-mode-debug.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.5.1-mode-debug.patch new file mode 100644 index 00000000..11fe5ada --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.5.1-mode-debug.patch @@ -0,0 +1,26 @@ +From 079910986a1b8f5042e16ee2ba3ad9ed843b67ca Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 7 Oct 2008 11:09:14 -0400 +Subject: [PATCH] Force ModeDebug on. + +--- + hw/xfree86/modes/xf86Crtc.c | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 9bcf81b..a953c8a 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -2084,8 +2084,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + xf86ProcessOptions (scrn->scrnIndex, + scrn->options, + config->options); +- config->debug_modes = xf86ReturnOptValBool (config->options, +- OPTION_MODEDEBUG, FALSE); ++ config->debug_modes = TRUE; + + if (scrn->display->virtualX) + width = scrn->display->virtualX; +-- +1.6.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-displayfd.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-displayfd.patch new file mode 100644 index 00000000..09e7b496 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-displayfd.patch @@ -0,0 +1,172 @@ +From 1766352059d0db67bff3f7dd0820563a30f54858 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Thu, 18 Jun 2009 16:56:41 +1000 +Subject: [PATCH] displayfd hack + +--- + dix/globals.c | 1 + + include/opaque.h | 1 + + os/connection.c | 72 ++++++++++++++++++++++++++++++++++++----------------- + os/utils.c | 11 ++++++++ + 4 files changed, 62 insertions(+), 23 deletions(-) + +diff --git a/dix/globals.c b/dix/globals.c +index 907a5e8..c1e64d3 100644 +--- a/dix/globals.c ++++ b/dix/globals.c +@@ -135,6 +135,7 @@ int defaultColorVisualClass = -1; + int monitorResolution = 0; + + char *display; ++int displayfd; + char *ConnectionInfo; + + CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; +diff --git a/include/opaque.h b/include/opaque.h +index fcc8c95..2a08e2d 100644 +--- a/include/opaque.h ++++ b/include/opaque.h +@@ -50,6 +50,7 @@ extern _X_EXPORT int ScreenSaverAllowExposures; + extern _X_EXPORT int defaultScreenSaverBlanking; + extern _X_EXPORT int defaultScreenSaverAllowExposures; + extern _X_EXPORT char *display; ++extern _X_EXPORT int displayfd; + + extern _X_EXPORT int defaultBackingStore; + extern _X_EXPORT Bool disableBackingStore; +diff --git a/os/connection.c b/os/connection.c +index 0c72b67..05d95c4 100644 +--- a/os/connection.c ++++ b/os/connection.c +@@ -146,6 +146,7 @@ Bool NewOutputPending; /* not yet attempted to write some new output */ + Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ + + static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ ++static char dynamic_display[7]; + Bool PartialNetwork; /* continue even if unable to bind all addrs */ + static Pid_t ParentProcess; + +@@ -357,9 +358,23 @@ NotifyParentProcess(void) + kill (ParentProcess, SIGUSR1); + } + } ++ if (dynamic_display[0]) ++ write(displayfd, dynamic_display, strlen(dynamic_display)); + #endif + } + ++static Bool ++TryCreateSocket(int num, int *partial) ++{ ++ char port[20]; ++ ++ sprintf(port, "%d", num); ++ ++ return _XSERVTransMakeAllCOTSServerListeners(port, partial, ++ &ListenTransCount, ++ &ListenTransConns); ++} ++ + /***************** + * CreateWellKnownSockets + * At initialization, create the sockets to listen on for new clients. +@@ -370,7 +385,6 @@ CreateWellKnownSockets(void) + { + int i; + int partial; +- char port[20]; + + FD_ZERO(&AllSockets); + FD_ZERO(&AllClients); +@@ -385,32 +399,44 @@ CreateWellKnownSockets(void) + + FD_ZERO (&WellKnownConnections); + +- sprintf (port, "%d", atoi (display)); +- +- if ((_XSERVTransMakeAllCOTSServerListeners (port, &partial, +- &ListenTransCount, &ListenTransConns) >= 0) && +- (ListenTransCount >= 1)) ++ if (display) + { +- if (!PartialNetwork && partial) +- { +- FatalError ("Failed to establish all listening sockets"); +- } +- else ++ if (TryCreateSocket(atoi(display), &partial) && ++ (ListenTransCount >= 1)) ++ if (!PartialNetwork && partial) ++ FatalError ("Failed to establish all listening sockets"); ++ } ++ else /* -displayfd */ ++ { ++ Bool found = 0; ++ for (i = 0; i < 65535 - 1024; i++) + { +- ListenTransFds = xalloc (ListenTransCount * sizeof (int)); +- +- for (i = 0; i < ListenTransCount; i++) ++ if (!TryCreateSocket(i, &partial) && !partial) + { +- int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i]); +- +- ListenTransFds[i] = fd; +- FD_SET (fd, &WellKnownConnections); +- +- if (!_XSERVTransIsLocal (ListenTransConns[i])) +- { +- DefineSelf (fd); +- } ++ found = 1; ++ break; + } ++ else ++ CloseWellKnownConnections(); ++ } ++ if (!found) ++ FatalError("Failed to find a socket to listen on"); ++ sprintf(dynamic_display, "%d\n", i); ++ display = dynamic_display; ++ } ++ ++ ListenTransFds = xalloc (ListenTransCount * sizeof (int)); ++ ++ for (i = 0; i < ListenTransCount; i++) ++ { ++ int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i]); ++ ++ ListenTransFds[i] = fd; ++ FD_SET (fd, &WellKnownConnections); ++ ++ if (!_XSERVTransIsLocal (ListenTransConns[i])) ++ { ++ DefineSelf (fd); + } + } + +diff --git a/os/utils.c b/os/utils.c +index 7bfdf8b..37a93b1 100644 +--- a/os/utils.c ++++ b/os/utils.c +@@ -678,6 +678,17 @@ ProcessCommandLine(int argc, char *argv[]) + else + UseMsg(); + } ++ else if (strcmp(argv[i], "-displayfd") == 0) ++ { ++ if (++i < argc) ++ { ++ displayfd = atoi(argv[i]); ++ display = NULL; ++ nolock = TRUE; ++ } ++ else ++ UseMsg(); ++ } + #ifdef DPMSExtension + else if ( strcmp( argv[i], "dpms") == 0) + /* ignored for compatibility */ ; +-- +1.6.3.rc1.2.g0164.dirty + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-less-acpi-brokenness.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-less-acpi-brokenness.patch new file mode 100644 index 00000000..cc80e6ce --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.0-less-acpi-brokenness.patch @@ -0,0 +1,31 @@ +From a8079882f1884edc62a9de28af915bd8b65dfbbe Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 11 Mar 2009 14:02:11 -0400 +Subject: [PATCH] Don't build the ACPI code. + +No good can come of this. +--- + configure.ac | 2 -- + 1 files changed, 0 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 72ae67e..04716f8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1269,13 +1269,11 @@ if test "x$XORG" = xyes; then + case $host_cpu in + ia64*) + linux_ia64=yes +- linux_acpi="yes" + ;; + alpha*) + linux_alpha=yes + ;; + i*86|amd64*|x86_64*) +- linux_acpi="yes" + ;; + *) + ;; +-- +1.6.1.3 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.6.1-nouveau.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.1-nouveau.patch new file mode 100644 index 00000000..c6428ec1 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.1-nouveau.patch @@ -0,0 +1,108 @@ +From b3872657c551d884141196cb098f53d3c01d1d3d Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Tue, 23 Jun 2009 13:52:23 +1000 +Subject: [PATCH] autoconfig: select nouveau by default for NVIDIA GPUs + +Also, don't treat DRI setup failure as an error for nouveau. +--- + glx/glxdri.c | 7 +++++-- + glx/glxdri2.c | 7 +++++-- + hw/xfree86/common/xf86AutoConfig.c | 27 ++++++++++++++++++++++++++- + 3 files changed, 36 insertions(+), 5 deletions(-) + +diff --git a/glx/glxdri.c b/glx/glxdri.c +index 5fb75a4..45c79c9 100644 +--- a/glx/glxdri.c ++++ b/glx/glxdri.c +@@ -967,6 +967,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + const __DRIconfig **driConfigs; + const __DRIextension **extensions; + int i; ++ int from = X_ERROR; + + if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") || + !DRIQueryDirectRenderingCapable(pScreen, &isCapable) || +@@ -1046,7 +1047,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + + screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); + if (screen->driver == NULL) { +- LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n", ++ if (!strcmp(driverName, "nouveau")) ++ from = X_INFO; ++ LogMessage(from, "AIGLX error: dlopen of %s failed (%s)\n", + filename, dlerror()); + goto handle_error; + } +@@ -1183,7 +1186,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + + xfree(screen); + +- LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n"); ++ LogMessage(from, "AIGLX: reverting to software rendering\n"); + + return NULL; + } +diff --git a/glx/glxdri2.c b/glx/glxdri2.c +index 529b2df..ff4490b 100644 +--- a/glx/glxdri2.c ++++ b/glx/glxdri2.c +@@ -587,6 +587,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + const __DRIextension **extensions; + const __DRIconfig **driConfigs; + int i; ++ int from = X_ERROR; + + screen = xcalloc(1, sizeof *screen); + if (screen == NULL) +@@ -613,7 +614,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + + screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); + if (screen->driver == NULL) { +- LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n", ++ if (!strcmp(driverName, "nouveau")) ++ from = X_INFO; ++ LogMessage(from, "AIGLX error: dlopen of %s failed (%s)\n", + filename, dlerror()); + goto handle_error; + } +@@ -692,7 +695,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + + xfree(screen); + +- LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n"); ++ LogMessage(from, "AIGLX: reverting to software rendering\n"); + + return NULL; + } +diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c +index bc4c80b..d8fa80f 100644 +--- a/hw/xfree86/common/xf86AutoConfig.c ++++ b/hw/xfree86/common/xf86AutoConfig.c +@@ -180,7 +180,23 @@ videoPtrToDriverList(struct pci_device *dev, + break; + case 0x102b: driverList[0] = "mga"; break; + case 0x10c8: driverList[0] = "neomagic"; break; +- case 0x10de: case 0x12d2: driverList[0] = "nv"; break; ++ case 0x10de: case 0x12d2: ++ switch (dev->device_id) { ++ /* NV1 */ ++ case 0x0008: ++ case 0x0009: ++ driverList[0] = "vesa"; ++ break; ++ /* NV3 */ ++ case 0x0018: ++ case 0x0019: ++ driverList[0] = "nv"; ++ break; ++ default: ++ driverList[0] = "nouveau"; ++ break; ++ } ++ break; + case 0x1106: driverList[0] = "openchrome"; break; + case 0x1163: driverList[0] = "rendition"; break; + case 0x5333: +-- +1.6.2.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-default-modes.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-default-modes.patch new file mode 100644 index 00000000..782cc69e --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-default-modes.patch @@ -0,0 +1,35 @@ +From 50552b0ee81b23b997bebd798b19b4a7e234a55f Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Fri, 21 Aug 2009 13:51:45 -0400 +Subject: [PATCH] tweak default mode list yet again + +--- + hw/xfree86/modes/xf86Crtc.c | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 4f14a75..c6fd910 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -1567,7 +1567,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) + int min_clock = 0; + int max_clock = 0; + double clock; +- Bool add_default_modes = TRUE; ++ Bool add_default_modes; + enum { sync_config, sync_edid, sync_default } sync_source = sync_default; + + while (output->probed_modes != NULL) +@@ -1610,6 +1610,9 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) + } + + output_modes = (*output->funcs->get_modes) (output); ++ ++ /* if the driver found modes, don't second-guess it */ ++ add_default_modes = (output_modes == NULL); + + edid_monitor = output->MonInfo; + +-- +1.6.4 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-hush-prerelease-warning.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-hush-prerelease-warning.patch new file mode 100644 index 00000000..21ba9532 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-hush-prerelease-warning.patch @@ -0,0 +1,25 @@ +From e9a81cb99315cf4c5325b276b802c659b9f04045 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 15 Sep 2009 10:33:40 -0400 +Subject: [PATCH] Hush prerelease warning. + +--- + hw/xfree86/common/xf86Init.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index 056e46d..3cdbdf4 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -132,7 +132,7 @@ static Bool formatsDone = FALSE; + static void + xf86PrintBanner(void) + { +-#if PRE_RELEASE ++#if 0 + ErrorF("\n" + "This is a pre-release version of the X server from " XVENDORNAME ".\n" + "It is not supported in any way.\n" +-- +1.6.4.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-randr-error-debugging.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-randr-error-debugging.patch new file mode 100644 index 00000000..c5d66860 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-randr-error-debugging.patch @@ -0,0 +1,42 @@ +From 16be69ef1e2ea9f19cd596b99b5ede7567d374b8 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 27 Jul 2009 16:52:42 -0400 +Subject: [PATCH 11/16] additional randr debugging + +--- + randr/randr.c | 16 +++++++++++++++- + 1 files changed, 15 insertions(+), 1 deletions(-) + +diff --git a/randr/randr.c b/randr/randr.c +index 1c1d0c4..accf614 100644 +--- a/randr/randr.c ++++ b/randr/randr.c +@@ -477,10 +477,24 @@ RRVerticalRefresh (xRRModeInfo *mode) + static int + ProcRRDispatch (ClientPtr client) + { ++ int ret; + REQUEST(xReq); + if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data]) + return BadRequest; +- return (*ProcRandrVector[stuff->data]) (client); ++ ret = ProcRandrVector[stuff->data](client); ++ ++ if (ret) { ++ int i; ++ ErrorF("RANDR failure: %d (extension base %d)\n", ret, RRErrorBase); ++ for (i = 0; i < stuff->length; i++) { ++ ErrorF("%08x ", *(((unsigned int *)stuff) + i)); ++ if ((i+1) % 4 == 0) ++ ErrorF("\n"); ++ } ++ ErrorF("\n"); ++ } ++ ++ return ret; + } + + static int +-- +1.6.4.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-right-of.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-right-of.patch new file mode 100644 index 00000000..06c11831 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.6.99-right-of.patch @@ -0,0 +1,172 @@ +From 1766ae8a69daa06730e41d094fdddf53db3a1a9e Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 28 Jul 2009 11:07:13 -0400 +Subject: [PATCH] RANDR: right-of placement by default + +[Enhanced to add a new prefer clone option for drivers. This +allows for servers like RN50 where two heads are disjoint. - airlied] + +[Enhanced to ignore rightof on single crtc cards - airlied] +--- + hw/xfree86/common/xf86str.h | 9 ++++- + hw/xfree86/modes/xf86Crtc.c | 77 +++++++++++++++++++++++++++++++++++++++---- + 2 files changed, 77 insertions(+), 9 deletions(-) + +diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h +index 5c3aa00..8224668 100644 +--- a/hw/xfree86/common/xf86str.h ++++ b/hw/xfree86/common/xf86str.h +@@ -503,10 +503,13 @@ typedef struct _confdrirec { + } confDRIRec, *confDRIPtr; + + /* These values should be adjusted when new fields are added to ScrnInfoRec */ +-#define NUM_RESERVED_INTS 15 ++#define NUM_RESERVED_INTS 14 + #define NUM_RESERVED_POINTERS 14 + #define NUM_RESERVED_FUNCS 11 + ++/* let clients know they can use this */ ++#define XF86_SCRN_HAS_PREFER_CLONE 1 ++ + typedef pointer (*funcPointer)(void); + + /* flags for depth 24 pixmap options */ +@@ -672,7 +675,6 @@ typedef void xf86SetOverscanProc (ScrnInfoPtr, int); + * are to be dependent on compile-time defines. + */ + +- + typedef struct _ScrnInfoRec { + int driverVersion; + char * driverName; /* canonical name used in */ +@@ -778,6 +780,9 @@ typedef struct _ScrnInfoRec { + /* -nr support */ + int canDoBGNoneRoot; + ++ /* initial rightof support disable */ ++ int preferClone; ++ + /* + * These can be used when the minor ABI version is incremented. + * The NUM_* parameters must be reduced appropriately to keep the +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index a66c979..4d14f57 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -1146,6 +1146,15 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes) + int o; + int min_x, min_y; + ++ /* check for initial right-of heuristic */ ++ for (o = 0; o < config->num_output; o++) ++ { ++ xf86OutputPtr output = config->output[o]; ++ ++ if (output->initial_x || output->initial_y) ++ return TRUE; ++ } ++ + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; +@@ -2028,6 +2037,60 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect) + return match; + } + ++static int ++numEnabledOutputs(xf86CrtcConfigPtr config, Bool *enabled) ++{ ++ int i = 0, p; ++ ++ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ; ++ ++ return i; ++} ++ ++static Bool ++xf86TargetRightOf(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, ++ DisplayModePtr *modes, Bool *enabled, ++ int width, int height) ++{ ++ int o; ++ int w = 0; ++ ++ if (config->num_crtc == 1) ++ return FALSE; ++ ++ if (scrn->preferClone) ++ return FALSE; ++ ++ if (numEnabledOutputs(config, enabled) < 2) ++ return FALSE; ++ ++ for (o = -1; nextEnabledOutput(config, enabled, &o); ) { ++ DisplayModePtr mode = ++ xf86OutputHasPreferredMode(config->output[o], width, height); ++ ++ if (!mode) ++ return FALSE; ++ ++ w += mode->HDisplay; ++ } ++ ++ if (w > width) ++ return FALSE; ++ ++ w = 0; ++ for (o = -1; nextEnabledOutput(config, enabled, &o); ) { ++ DisplayModePtr mode = ++ xf86OutputHasPreferredMode(config->output[o], width, height); ++ ++ config->output[o]->initial_x = w; ++ w += mode->HDisplay; ++ ++ modes[o] = mode; ++ } ++ ++ return TRUE; ++} ++ + static Bool + xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + DisplayModePtr *modes, Bool *enabled, +@@ -2085,13 +2148,9 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + * biggest mode for its aspect ratio, assuming one exists. + */ + if (!ret) do { +- int i = 0; + float aspect = 0.0; + +- /* count the number of enabled outputs */ +- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ; +- +- if (i != 1) ++ if (numEnabledOutputs(config, enabled) != 1) + break; + + p = -1; +@@ -2378,6 +2437,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + + if (xf86TargetUserpref(scrn, config, modes, enabled, width, height)) + xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n"); ++ else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height)) ++ xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n"); + else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height)) + xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n"); + else if (xf86TargetAspect(scrn, config, modes, enabled, width, height)) +@@ -2394,8 +2455,10 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + config->output[o]->name); + else + xf86DrvMsg (scrn->scrnIndex, X_INFO, +- "Output %s using initial mode %s\n", +- config->output[o]->name, modes[o]->name); ++ "Output %s using initial mode %s +%d+%d\n", ++ config->output[o]->name, modes[o]->name, ++ config->output[o]->initial_x, ++ config->output[o]->initial_y); + } + + /* +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-glx-versioning.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-glx-versioning.patch new file mode 100644 index 00000000..c8a1c309 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-glx-versioning.patch @@ -0,0 +1,233 @@ +From 3ef4be8129f78afd5566a9e5d0fb901449dcb771 Mon Sep 17 00:00:00 2001 +From: Ian Romanick +Date: Tue, 29 Sep 2009 16:43:43 -0700 +Subject: [PATCH] GLX: Enable GLX 1.4 on DRI2 + +this squashes 4 commits +(cherry picked from commit ad5c0d9efa47476ed5cf75c82265c73919e468b4) +(cherry picked from commit cb54cf1b3e8c4109541cfb698542c00f2473e731) +(cherry picked from commit 4c6bfa2c09ae2b0cffdf9211a6dfbcaefe0366b5) +(cherry picked from commit 9bf2ff4faf730913de3073f346646a8727be41d4) +--- + glx/glxcmds.c | 12 ++++++++---- + glx/glxdri2.c | 12 ++++++++++++ + glx/glxext.c | 8 +++++++- + glx/glxscreens.c | 15 ++++++++++++--- + glx/glxscreens.h | 11 +++++++++++ + glx/glxserver.h | 3 +++ + glx/indirect_texture_compression.c | 4 ++-- + include/protocol-versions.h | 2 +- + 8 files changed, 56 insertions(+), 11 deletions(-) + +diff --git a/glx/glxcmds.c b/glx/glxcmds.c +index b1061a8..ba4c123 100644 +--- a/glx/glxcmds.c ++++ b/glx/glxcmds.c +@@ -50,7 +50,6 @@ + #include "indirect_dispatch.h" + #include "indirect_table.h" + #include "indirect_util.h" +-#include "protocol-versions.h" + + static int + validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) +@@ -739,8 +738,8 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc) + ** client if it wants to work with older clients; however, in this + ** implementation the server just returns its version number. + */ +- reply.majorVersion = SERVER_GLX_MAJOR_VERSION; +- reply.minorVersion = SERVER_GLX_MINOR_VERSION; ++ reply.majorVersion = glxMajorVersion; ++ reply.minorVersion = glxMinorVersion; + reply.length = 0; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; +@@ -2360,6 +2359,7 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) + char *buf; + __GLXscreen *pGlxScreen; + int err; ++ char ver_str[16]; + + if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) + return err; +@@ -2369,7 +2369,11 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) + ptr = pGlxScreen->GLXvendor; + break; + case GLX_VERSION: +- ptr = pGlxScreen->GLXversion; ++ /* Return to the server version rather than the screen version ++ * to prevent confusion when they do not match. ++ */ ++ snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion); ++ ptr = ver_str; + break; + case GLX_EXTENSIONS: + ptr = pGlxScreen->GLXextensions; +diff --git a/glx/glxdri2.c b/glx/glxdri2.c +index ed7fb4c..ed7dc80 100644 +--- a/glx/glxdri2.c ++++ b/glx/glxdri2.c +@@ -685,6 +685,18 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + screen->base.GLXextensions); + } + ++ /* We're going to assume (perhaps incorrectly?) that all DRI2-enabled ++ * drivers support the required extensions for GLX 1.4. The extensions ++ * we're assuming are: ++ * ++ * - GLX_SGI_make_current_read (1.3) ++ * - GLX_SGIX_fbconfig (1.3) ++ * - GLX_SGIX_pbuffer (1.3) ++ * - GLX_ARB_multisample (1.4) ++ */ ++ screen->base.GLXmajor = 1; ++ screen->base.GLXminor = 4; ++ + screen->enterVT = pScrn->EnterVT; + pScrn->EnterVT = glxDRIEnterVT; + screen->leaveVT = pScrn->LeaveVT; +diff --git a/glx/glxext.c b/glx/glxext.c +index 19d70d4..9f9c0ed 100644 +--- a/glx/glxext.c ++++ b/glx/glxext.c +@@ -360,12 +360,18 @@ void GlxExtensionInit(void) + pScreen = screenInfo.screens[i]; + + for (p = __glXProviderStack; p != NULL; p = p->next) { +- if (p->screenProbe(pScreen) != NULL) { ++ __GLXscreen *glxScreen; ++ ++ glxScreen = p->screenProbe(pScreen); ++ if (glxScreen != NULL) { ++ if (glxScreen->GLXminor < glxMinorVersion) ++ glxMinorVersion = glxScreen->GLXminor; + LogMessage(X_INFO, + "GLX: Initialized %s GL provider for screen %d\n", + p->name, i); + break; + } ++ + } + + if (!p) +diff --git a/glx/glxscreens.c b/glx/glxscreens.c +index 7d29d31..674e2c6 100644 +--- a/glx/glxscreens.c ++++ b/glx/glxscreens.c +@@ -42,6 +42,7 @@ + #include "glxserver.h" + #include "glxutil.h" + #include "glxext.h" ++#include "protocol-versions.h" + + static int glxScreenPrivateKeyIndex; + static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKeyIndex; +@@ -162,7 +163,8 @@ static const char GLServerExtensions[] = + ** supported across all screens in a multi-screen system. + */ + static char GLXServerVendorName[] = "SGI"; +-static char GLXServerVersion[] = "1.2"; ++unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION; ++unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION; + static char GLXServerExtensions[] = + "GLX_ARB_multisample " + "GLX_EXT_visual_info " +@@ -378,9 +380,17 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) + pGlxScreen->pScreen = pScreen; + pGlxScreen->GLextensions = xstrdup(GLServerExtensions); + pGlxScreen->GLXvendor = xstrdup(GLXServerVendorName); +- pGlxScreen->GLXversion = xstrdup(GLXServerVersion); + pGlxScreen->GLXextensions = xstrdup(GLXServerExtensions); + ++ /* All GLX providers must support all of the functionality required for at ++ * least GLX 1.2. If the provider supports a higher version, the GLXminor ++ * version can be changed in the provider's screen-probe routine. For ++ * most providers, the screen-probe routine is the caller of this ++ * function. ++ */ ++ pGlxScreen->GLXmajor = 1; ++ pGlxScreen->GLXminor = 2; ++ + pGlxScreen->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = glxCloseScreen; + pGlxScreen->DestroyWindow = pScreen->DestroyWindow; +@@ -454,7 +464,6 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) + void __glXScreenDestroy(__GLXscreen *screen) + { + xfree(screen->GLXvendor); +- xfree(screen->GLXversion); + xfree(screen->GLXextensions); + xfree(screen->GLextensions); + } +diff --git a/glx/glxscreens.h b/glx/glxscreens.h +index 3c1bdd4..bff4363 100644 +--- a/glx/glxscreens.h ++++ b/glx/glxscreens.h +@@ -161,6 +161,17 @@ struct __GLXscreen { + char *GLXversion; + char *GLXextensions; + ++ /** ++ * \name GLX version supported by this screen. ++ * ++ * Since the GLX version advertised by the server is for the whole server, ++ * the GLX protocol code uses the minimum version supported on all screens. ++ */ ++ /*@{*/ ++ unsigned GLXmajor; ++ unsigned GLXminor; ++ /*@}*/ ++ + Bool (*CloseScreen)(int index, ScreenPtr pScreen); + Bool (*DestroyWindow)(WindowPtr pWindow); + }; +diff --git a/glx/glxserver.h b/glx/glxserver.h +index 4aa8c2e..80f1b28 100644 +--- a/glx/glxserver.h ++++ b/glx/glxserver.h +@@ -248,4 +248,7 @@ extern int __glXImageSize(GLenum format, GLenum type, + GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, + GLint alignment); + ++extern unsigned glxMajorVersion; ++extern unsigned glxMinorVersion; ++ + #endif /* !__GLX_server_h__ */ +diff --git a/glx/indirect_texture_compression.c b/glx/indirect_texture_compression.c +index 25c6eb3..5f44d7b 100644 +--- a/glx/indirect_texture_compression.c ++++ b/glx/indirect_texture_compression.c +@@ -52,7 +52,7 @@ int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *p + const GLenum target = *(GLenum *)(pc + 0); + const GLint level = *(GLint *)(pc + 4); + GLint compsize = 0; +- char *answer, answerBuffer[200]; ++ char *answer = NULL, answerBuffer[200]; + + CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize)); + +@@ -92,7 +92,7 @@ int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyt + const GLenum target = (GLenum) bswap_32( *(int *)(pc + 0) ); + const GLint level = (GLint ) bswap_32( *(int *)(pc + 4) ); + GLint compsize = 0; +- char *answer, answerBuffer[200]; ++ char *answer = NULL, answerBuffer[200]; + + CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize)); + +diff --git a/include/protocol-versions.h b/include/protocol-versions.h +index da9770c..d688c66 100644 +--- a/include/protocol-versions.h ++++ b/include/protocol-versions.h +@@ -61,7 +61,7 @@ + + /* GLX */ + #define SERVER_GLX_MAJOR_VERSION 1 +-#define SERVER_GLX_MINOR_VERSION 2 ++#define SERVER_GLX_MINOR_VERSION 4 + + /* Xinerama */ + #define SERVER_PANORAMIX_MAJOR_VERSION 1 +-- +1.6.5.rc2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-randr-gamma-restore.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-randr-gamma-restore.patch new file mode 100644 index 00000000..81e025f0 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.0-randr-gamma-restore.patch @@ -0,0 +1,65 @@ +From 18d2bd8cb513a0436739916620532247f13dbf03 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Thu, 8 Oct 2009 15:25:24 -0400 +Subject: [PATCH] randr gamma reload hack + +--- + hw/xfree86/loader/sdksyms.c | 4 ++++ + hw/xfree86/modes/xf86RandR12.c | 6 ++++++ + 2 files changed, 10 insertions(+), 0 deletions(-) + +diff --git a/hw/xfree86/loader/sdksyms.c b/hw/xfree86/loader/sdksyms.c +index 12af6b7..656d07b 100644 +--- a/hw/xfree86/loader/sdksyms.c ++++ b/hw/xfree86/loader/sdksyms.c +@@ -1056,6 +1056,8 @@ _X_HIDDEN void *xorg_symbols[] = { + (void *) &noXFree86VidModeExtension, + (void *) &noXFixesExtension, + (void *) &noPanoramiXExtension, ++ (void *) &noSELinuxExtension, ++ (void *) &selinuxEnforcingState, + (void *) &noXvExtension, + (void *) &noDRI2Extension, + (void *) &defaultTextFont, +@@ -1069,6 +1071,7 @@ _X_HIDDEN void *xorg_symbols[] = { + (void *) &defaultScreenSaverBlanking, + (void *) &defaultScreenSaverAllowExposures, + (void *) &display, ++ (void *) &displayfd, + (void *) &defaultBackingStore, + (void *) &disableBackingStore, + (void *) &enableBackingStore, +@@ -1078,6 +1081,7 @@ _X_HIDDEN void *xorg_symbols[] = { + (void *) &maxBigRequestSize, + (void *) &party_like_its_1989, + (void *) &whiteRoot, ++ (void *) &bgNoneRoot, + (void *) &CoreDump, + (void *) &DontPropagateMasks, + (void *) &screenIsSaved, +diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c +index 6ea9d26..41bac11 100644 +--- a/hw/xfree86/modes/xf86RandR12.c ++++ b/hw/xfree86/modes/xf86RandR12.c +@@ -1746,12 +1746,18 @@ xf86RandR12EnterVT (int screen_index, int flags) + { + ScreenPtr pScreen = screenInfo.screens[screen_index]; + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ++ rrScrPrivPtr rp = rrGetScrPriv(pScreen); + + if (randrp->orig_EnterVT) { + if (!randrp->orig_EnterVT (screen_index, flags)) + return FALSE; + } + ++ /* reload gamma */ ++ int i; ++ for (i = 0; i < rp->numCrtcs; i++) ++ xf86RandR12CrtcSetGamma(pScreen, rp->crtcs[i]); ++ + return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */ + } + +-- +1.6.5.rc2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-gamma-kdm-fix.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-gamma-kdm-fix.patch new file mode 100644 index 00000000..c62837e4 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-gamma-kdm-fix.patch @@ -0,0 +1,34 @@ +From acc64ce5be7383c09e88a23aab06ebc2403f2ca3 Mon Sep 17 00:00:00 2001 +From: Bill Nottingham +Date: Fri, 6 Nov 2009 10:32:27 +1000 +Subject: [PATCH] fix KDM gamma issue on vt switch + +--- + hw/xfree86/modes/xf86RandR12.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c +index 6ea9d26..ece12b9 100644 +--- a/hw/xfree86/modes/xf86RandR12.c ++++ b/hw/xfree86/modes/xf86RandR12.c +@@ -1761,6 +1761,7 @@ xf86RandR12Init12 (ScreenPtr pScreen) + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + rrScrPrivPtr rp = rrGetScrPriv(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ++ int i; + + rp->rrGetInfo = xf86RandR12GetInfo12; + rp->rrScreenSetSize = xf86RandR12ScreenSetSize; +@@ -1790,6 +1791,9 @@ xf86RandR12Init12 (ScreenPtr pScreen) + */ + if (!xf86RandR12SetInfo12 (pScreen)) + return FALSE; ++ for (i = 0; i < rp->numCrtcs; i++) { ++ xf86RandR12CrtcGetGamma(pScreen, rp->crtcs[i]); ++ } + return TRUE; + } + +-- +1.6.5.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-glx14-swrast.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-glx14-swrast.patch new file mode 100644 index 00000000..2c518025 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-glx14-swrast.patch @@ -0,0 +1,26 @@ +From 25a0107768c9f25e8edc5e423ca8b1d0813f2d04 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 24 Nov 2009 13:38:46 -0500 +Subject: [PATCH] Enable GLX 1.4 for swrast + +--- + glx/glxdriswrast.c | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c +index 44f658f..20f9f90 100644 +--- a/glx/glxdriswrast.c ++++ b/glx/glxdriswrast.c +@@ -510,6 +510,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) + + __glXScreenInit(&screen->base, pScreen); + ++ screen->base.GLXmajor = 1; ++ screen->base.GLXminor = 4; ++ + LogMessage(X_INFO, + "AIGLX: Loaded and initialized %s\n", filename); + +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-libcrypto.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-libcrypto.patch new file mode 100644 index 00000000..c271855a --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-libcrypto.patch @@ -0,0 +1,35 @@ +From 8875112f5c57ec5d575e717c5638fbc919145efb Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 16 Nov 2009 18:01:26 -0500 +Subject: [PATCH] configure: Only link against libcrypto + +openssl.pc will link you against libssl, which we don't need, and which +brings in another seven libraries we also don't need. This is still +bogus, we're really only trying to get a SHA1 routine, we could link it +statically and be even better off. +--- + configure.ac | 6 ------ + 1 files changed, 0 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f69f97e..254d33d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1297,14 +1297,8 @@ if test "x$SHA1_LIB" = "x" ; then + fi + + if test "x$SHA1_LIB" = "x" ; then +- PKG_CHECK_EXISTS([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes], +- [HAVE_OPENSSL_PKC=no]) +- if test "x$HAVE_OPENSSL_PKC" = xyes; then +- REQUIRED_LIBS="$REQUIRED_LIBS openssl" +- else + AC_CHECK_LIB([crypto], [SHA1_Init], [SHA1_LIB="-lcrypto"], + [AC_MSG_ERROR([OpenSSL must be installed in order to build the X server.])]) +- fi + fi + + PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS]) +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-multilib.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-multilib.patch new file mode 100644 index 00000000..64359991 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.1-multilib.patch @@ -0,0 +1,55 @@ +From 6d9585ba6a5784328de479c6b648d7b7d6cec64c Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Thu, 29 Oct 2009 19:04:10 -0400 +Subject: [PATCH] multilib fix for -devel subpackage + +--- + include/colormapst.h | 4 ++-- + include/xorg-server.h.in | 7 ++++--- + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/include/colormapst.h b/include/colormapst.h +index f1fc8eb..274cd65 100644 +--- a/include/colormapst.h ++++ b/include/colormapst.h +@@ -103,12 +103,12 @@ typedef struct _ColormapRec + { + VisualPtr pVisual; + short class; /* PseudoColor or DirectColor */ +-#if defined(_XSERVER64) ++#ifdef __LP64__ + short pad0; + XID pad1; + #endif + XID mid; /* client's name for colormap */ +-#if defined(_XSERVER64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN) ++#if defined(__LP64__) && (X_BYTE_ORDER == X_LITTLE_ENDIAN) + XID pad2; + #endif + ScreenPtr pScreen; /* screen map is associated with */ +diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in +index 76cab16..081b8f3 100644 +--- a/include/xorg-server.h.in ++++ b/include/xorg-server.h.in +@@ -157,9 +157,6 @@ + /* Name of X server */ + #undef __XSERVERNAME__ + +-/* Define to 1 if unsigned long is 64 bits. */ +-#undef _XSERVER64 +- + /* Building vgahw module */ + #undef WITH_VGAHW + +@@ -187,4 +184,8 @@ + /* X Access Control Extension */ + #undef XACE + ++#ifdef __LP64__ ++#define _XSERVER64 1 ++#endif ++ + #endif /* _XORG_SERVER_H_ */ +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.3-no-free-on-abort.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.3-no-free-on-abort.patch new file mode 100644 index 00000000..6630d055 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.3-no-free-on-abort.patch @@ -0,0 +1,65 @@ +From 3bf24ed9e1c81116c851ba2408b9c37a51a5dc62 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Thu, 7 Jan 2010 11:33:43 -0500 +Subject: [PATCH] hack to make abnormal exit not call free() + +--- + dix/globals.c | 2 ++ + include/misc.h | 2 ++ + os/log.c | 1 + + os/utils.c | 3 +++ + 4 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/dix/globals.c b/dix/globals.c +index c1e64d3..a1eac08 100644 +--- a/dix/globals.c ++++ b/dix/globals.c +@@ -61,6 +61,8 @@ SOFTWARE. + #include "dixstruct.h" + #include "os.h" + ++Bool omg_wtf_aborting = FALSE; ++ + ScreenInfo screenInfo; + KeybdCtrl defaultKeyboardControl = { + DEFAULT_KEYBOARD_CLICK, +diff --git a/include/misc.h b/include/misc.h +index 877c682..2b3cf2e 100644 +--- a/include/misc.h ++++ b/include/misc.h +@@ -286,4 +286,6 @@ typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ + extern _X_EXPORT unsigned long globalSerialNumber; + extern _X_EXPORT unsigned long serverGeneration; + ++extern _X_EXPORT Bool omg_wtf_aborting; ++ + #endif /* MISC_H */ +diff --git a/os/log.c b/os/log.c +index 8108890..79b86f3 100644 +--- a/os/log.c ++++ b/os/log.c +@@ -395,6 +395,7 @@ void AbortServer(void) __attribute__((noreturn)); + void + AbortServer(void) + { ++ omg_wtf_aborting = 1; + #ifdef XF86BIGFONT + XF86BigfontCleanup(); + #endif +diff --git a/os/utils.c b/os/utils.c +index 1d1712d..04177aa 100644 +--- a/os/utils.c ++++ b/os/utils.c +@@ -1164,6 +1164,9 @@ XNFrealloc(pointer ptr, unsigned long amount) + void + Xfree(pointer ptr) + { ++ if (omg_wtf_aborting) ++ return; ++ + if (ptr) + free(ptr); + } +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-dpms-timeouts.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-dpms-timeouts.patch new file mode 100644 index 00000000..80765e29 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-dpms-timeouts.patch @@ -0,0 +1,29 @@ +From 4704b4d3d60bc40dcb9fbd050ca1ffdf42cbeaf9 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Fri, 12 Feb 2010 14:34:28 -0500 +Subject: [PATCH] Inherit the DPMS timeouts from -s + +--- + dix/main.c | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/dix/main.c b/dix/main.c +index f96245a..d887f5c 100644 +--- a/dix/main.c ++++ b/dix/main.c +@@ -159,9 +159,9 @@ int main(int argc, char *argv[], char *envp[]) + ScreenSaverBlanking = defaultScreenSaverBlanking; + ScreenSaverAllowExposures = defaultScreenSaverAllowExposures; + #ifdef DPMSExtension +- DPMSStandbyTime = DEFAULT_SCREEN_SAVER_TIME; +- DPMSSuspendTime = DEFAULT_SCREEN_SAVER_TIME; +- DPMSOffTime = DEFAULT_SCREEN_SAVER_TIME; ++ DPMSStandbyTime = defaultScreenSaverTime; ++ DPMSSuspendTime = defaultScreenSaverTime; ++ DPMSOffTime = defaultScreenSaverTime; + DPMSEnabled = TRUE; + DPMSPowerLevel = 0; + #endif +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-qxl-autoconfig.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-qxl-autoconfig.patch new file mode 100644 index 00000000..3d99c60d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-qxl-autoconfig.patch @@ -0,0 +1,26 @@ +From 4b24f52e58824442e534ea97a137ecac819a9c6f Mon Sep 17 00:00:00 2001 +From: Soren Sandmann +Date: Tue, 9 Feb 2010 11:25:29 -0500 +Subject: [PATCH] Add Red Hat's PCI ID and make it point to the QXL driver. + +--- + hw/xfree86/common/xf86AutoConfig.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c +index d7c0399..e3e605e 100644 +--- a/hw/xfree86/common/xf86AutoConfig.c ++++ b/hw/xfree86/common/xf86AutoConfig.c +@@ -210,7 +210,8 @@ videoPtrToDriverList(struct pci_device *dev, + } + break; + case 0x1106: driverList[0] = "openchrome"; break; +- case 0x1163: driverList[0] = "rendition"; break; ++ case 0x1b36: driverList[0] = "qxl"; break; ++ case 0x1163: driverList[0] = "rendition"; break; + case 0x5333: + switch (dev->device_id) + { +-- +1.6.6 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-z-now.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-z-now.patch new file mode 100644 index 00000000..f81367e3 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.4-z-now.patch @@ -0,0 +1,25 @@ +From 4de049b00ebb12864dc59764afd907fc7d28ba01 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 13 Jan 2010 11:19:12 -0500 +Subject: [PATCH] Link Xorg with -z now + +--- + hw/xfree86/Makefile.am | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am +index 914e11f..20da8c4 100644 +--- a/hw/xfree86/Makefile.am ++++ b/hw/xfree86/Makefile.am +@@ -74,7 +74,7 @@ DISTCLEANFILES = libxorg.c xorg.c + Xorg_DEPENDENCIES = libxorg.la + Xorg_LDADD = $(MAIN_LIB) libxorg.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) + +-Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) ++Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Wl,-z,now + + BUILT_SOURCES = xorg.conf.example + DISTCLEANFILES += xorg.conf.example xorg.conf.example.pre +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-default-modes.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-default-modes.patch new file mode 100644 index 00000000..495765e8 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-default-modes.patch @@ -0,0 +1,367 @@ +From 9edbc4bd615311f4eefe13a54b7c7b7e34b3645a Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 26 Apr 2010 14:57:23 -0400 +Subject: [PATCH] modes: Combine xf86DefaultModes and DMTModes + +DMTModes is what xf86DefaultModes was always meant to be. Smash the two +together, leaving aliases in place for the old names to make it easy on +external modules. + +Signed-off-by: Adam Jackson +--- + hw/xfree86/common/Makefile.am | 10 +--- + hw/xfree86/common/extramodes | 27 --------- + hw/xfree86/common/modeline2c.awk | 93 ------------------------------- + hw/xfree86/common/vesamodes | 111 -------------------------------------- + hw/xfree86/common/xf86Config.c | 3 +- + hw/xfree86/common/xf86Priv.h | 2 +- + hw/xfree86/modes/xf86EdidModes.c | 5 ++- + hw/xfree86/modes/xf86Modes.c | 2 +- + 8 files changed, 9 insertions(+), 244 deletions(-) + delete mode 100644 hw/xfree86/common/extramodes + delete mode 100644 hw/xfree86/common/modeline2c.awk + delete mode 100644 hw/xfree86/common/vesamodes + +diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am +index ad27210..9bf0c73 100644 +--- a/hw/xfree86/common/Makefile.am ++++ b/hw/xfree86/common/Makefile.am +@@ -23,14 +23,6 @@ RANDRSOURCES = xf86RandR.c + + BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES) + +-MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes +- +-xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES) +- cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@ +- echo >> $@ +- +-BUILT_SOURCES = xf86DefModeSet.c +- + AM_LDFLAGS = -r + libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \ + xf86Cursor.c $(DGASOURCES) xf86DPMS.c \ +@@ -40,7 +32,7 @@ libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \ + xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ + xf86Mode.c xorgHelper.c \ + $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) +-nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h ++nodist_libcommon_la_SOURCES = xf86Build.h + + INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ + -I$(srcdir)/../loader -I$(srcdir)/../parser \ +diff --git a/hw/xfree86/common/extramodes b/hw/xfree86/common/extramodes +deleted file mode 100644 +index 4505026..0000000 +--- a/hw/xfree86/common/extramodes ++++ /dev/null +@@ -1,27 +0,0 @@ +-// +-// Extra modes to include as default modes in the X server. +-// +-// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.5 2002/06/05 19:43:05 dawes Exp $ +-// +- +-# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz +-ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync +- +-# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz +-ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync +- +-# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz +-ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync +- +-# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz +-Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync +- +-# 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz +-Modeline "2048x1536" 266.95 2048 2200 2424 2800 1536 1537 1540 1589 -hsync +vsync +- +-# 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz +-Modeline "2048x1536" 340.48 2048 2216 2440 2832 1536 1537 1540 1603 -hsync +vsync +- +-# 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz +-Modeline "2048x1536" 388.04 2048 2216 2440 2832 1536 1537 1540 1612 -hsync +vsync +- +diff --git a/hw/xfree86/common/modeline2c.awk b/hw/xfree86/common/modeline2c.awk +deleted file mode 100644 +index 038e7e9..0000000 +--- a/hw/xfree86/common/modeline2c.awk ++++ /dev/null +@@ -1,93 +0,0 @@ +-#!/usr/bin/awk -f +-# +-# Copyright (c) 2007 Joerg Sonnenberger . +-# All rights reserved. +-# +-# Based on Perl script by Dirk Hohndel. +-# +-# Redistribution and use in source and binary forms, with or without +-# modification, are permitted provided that the following conditions +-# are met: +-# +-# 1. Redistributions of source code must retain the above copyright +-# notice, this list of conditions and the following disclaimer. +-# 2. Redistributions in binary form must reproduce the above copyright +-# notice, this list of conditions and the following disclaimer in +-# the documentation and/or other materials provided with the +-# distribution. +-# +-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +-# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, +-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-# SUCH DAMAGE. +-# +-# Usage: modeline2c.awk < modefile > xf86DefModeSet.c +-# +- +-BEGIN { +- flagsdict[""] = "0" +- +- flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC" +- flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC" +- flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC" +- flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC" +- flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE" +- flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE" +- flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE" +- flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE" +- +- print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at" +- print " * modeline2c.awk */" +- print "" +- print "/*" +- print " * Author: Joerg Sonnenberger " +- print " * Based on Perl script from Dirk Hohndel " +- print " */" +- print "" +- print "#ifdef HAVE_XORG_CONFIG_H" +- print "#include " +- print "#endif" +- print "" +- print "#include \"xf86.h\"" +- print "#include \"xf86Config.h\"" +- print "#include \"xf86Priv.h\"" +- print "#include \"xf86_OSlib.h\"" +- print "" +- print "#include \"globals.h\"" +- print "" +- print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT" +- print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0" +- print "" +- print "const DisplayModeRec xf86DefaultModes [] = {" +- +- modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n" +- modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+" +-} +- +-/^[mM][oO][dD][eE][lL][iI][nN][eE]/ { +- flags = $0 +- gsub(modeline_data, "", flags) +- flags = tolower(flags) +- printf(modeline, $3 * 1000, $4, $5, $6, $7, +- $8, $9, $10, $11, flagsdict[flags]) +- # Half-width double scanned modes +- printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2, +- $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN") +-} +- +-/^#/ { +- print "/*" substr($0, 2) " */" +-} +- +-END { +- print "};" +- printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);" +-} +diff --git a/hw/xfree86/common/vesamodes b/hw/xfree86/common/vesamodes +deleted file mode 100644 +index 2bc8862..0000000 +--- a/hw/xfree86/common/vesamodes ++++ /dev/null +@@ -1,111 +0,0 @@ +-// +-// Default modes distilled from +-// "VESA and Industry Standards and Guide for Computer Display Monitor +-// Timing", version 1.0, revision 0.8, adopted September 17, 1998. +-// +-// $XFree86: xc/programs/Xserver/hw/xfree86/etc/vesamodes,v 1.3 1999/11/16 03:28:03 tsi Exp $ +- +- +-# 640x350 @ 85Hz (VESA) hsync: 37.9kHz +-ModeLine "640x350" 31.5 640 672 736 832 350 382 385 445 +hsync -vsync +- +-# 640x400 @ 85Hz (VESA) hsync: 37.9kHz +-ModeLine "640x400" 31.5 640 672 736 832 400 401 404 445 -hsync +vsync +- +-# 720x400 @ 85Hz (VESA) hsync: 37.9kHz +-ModeLine "720x400" 35.5 720 756 828 936 400 401 404 446 -hsync +vsync +- +-# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz +-ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync +- +-# 640x480 @ 72Hz (VESA) hsync: 37.9kHz +-ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520 -hsync -vsync +- +-# 640x480 @ 75Hz (VESA) hsync: 37.5kHz +-ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync +- +-# 640x480 @ 85Hz (VESA) hsync: 43.3kHz +-ModeLine "640x480" 36.0 640 696 752 832 480 481 484 509 -hsync -vsync +- +-# 800x600 @ 56Hz (VESA) hsync: 35.2kHz +-ModeLine "800x600" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync +- +-# 800x600 @ 60Hz (VESA) hsync: 37.9kHz +-ModeLine "800x600" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync +- +-# 800x600 @ 72Hz (VESA) hsync: 48.1kHz +-ModeLine "800x600" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync +- +-# 800x600 @ 75Hz (VESA) hsync: 46.9kHz +-ModeLine "800x600" 49.5 800 816 896 1056 600 601 604 625 +hsync +vsync +- +-# 800x600 @ 85Hz (VESA) hsync: 53.7kHz +-ModeLine "800x600" 56.3 800 832 896 1048 600 601 604 631 +hsync +vsync +- +-# 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz +-ModeLine "1024x768" 44.9 1024 1032 1208 1264 768 768 776 817 +hsync +vsync Interlace +- +-# 1024x768 @ 60Hz (VESA) hsync: 48.4kHz +-ModeLine "1024x768" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync +- +-# 1024x768 @ 70Hz (VESA) hsync: 56.5kHz +-ModeLine "1024x768" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync +- +-# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz +-ModeLine "1024x768" 78.75 1024 1040 1136 1312 768 769 772 800 +hsync +vsync +- +-# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz +-ModeLine "1024x768" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync +- +-# 1152x864 @ 75Hz (VESA) hsync: 67.5kHz +-ModeLine "1152x864" 108.0 1152 1216 1344 1600 864 865 868 900 +hsync +vsync +- +-# 1280x960 @ 60Hz (VESA) hsync: 60.0kHz +-ModeLine "1280x960" 108.0 1280 1376 1488 1800 960 961 964 1000 +hsync +vsync +- +-# 1280x960 @ 85Hz (VESA) hsync: 85.9kHz +-ModeLine "1280x960" 148.5 1280 1344 1504 1728 960 961 964 1011 +hsync +vsync +- +-# 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz +-ModeLine "1280x1024" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync +- +-# 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz +-ModeLine "1280x1024" 135.0 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync +- +-# 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz +-ModeLine "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync +- +-# 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz +-ModeLine "1600x1200" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync +- +-# 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz +-ModeLine "1600x1200" 175.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync +- +-# 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz +-ModeLine "1600x1200" 189.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync +- +-# 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz +-ModeLine "1600x1200" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync +- +-# 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz +-ModeLine "1600x1200" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync +- +-# 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz +-ModeLine "1792x1344" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync +- +-# 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz +-ModeLine "1792x1344" 261.0 1792 1888 2104 2456 1344 1345 1348 1417 -hsync +vsync +- +-# 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz +-ModeLine "1856x1392" 218.3 1856 1952 2176 2528 1392 1393 1396 1439 -hsync +vsync +- +-# 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz +-ModeLine "1856x1392" 288.0 1856 1984 2208 2560 1392 1393 1396 1500 -hsync +vsync +- +-# 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz +-ModeLine "1920x1440" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -hsync +vsync +- +-# 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz +-ModeLine "1920x1440" 297.0 1920 2064 2288 2640 1440 1441 1444 1500 -hsync +vsync +- +- +diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c +index 6fbf613..d3dcce2 100644 +--- a/hw/xfree86/common/xf86Config.c ++++ b/hw/xfree86/common/xf86Config.c +@@ -2367,7 +2367,8 @@ addDefaultModes(MonPtr monitorp) + + for (i = 0; i < xf86NumDefaultModes; i++) + { +- mode = xf86DuplicateMode(&xf86DefaultModes[i]); ++ mode = xf86DuplicateMode(&DMTModes[i]); ++ mode->type = M_T_DEFAULT; + if (!modeIsPresent(mode, monitorp)) + { + monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode); +diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h +index 3bb1571..0ba7ffa 100644 +--- a/hw/xfree86/common/xf86Priv.h ++++ b/hw/xfree86/common/xf86Priv.h +@@ -129,7 +129,7 @@ extern _X_EXPORT Bool xf86PathIsSafe(const char *path); + + /* xf86DefaultModes */ + +-extern _X_EXPORT const DisplayModeRec xf86DefaultModes[]; ++extern _X_EXPORT const DisplayModeRec DMTModes[]; + extern _X_EXPORT const int xf86NumDefaultModes; + + /* xf86Configure.c */ +diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c +index b057d7d..4da0da5 100644 +--- a/hw/xfree86/modes/xf86EdidModes.c ++++ b/hw/xfree86/modes/xf86EdidModes.c +@@ -425,6 +425,9 @@ const DisplayModeRec DMTModes[] = { + { MODEPREFIX, 505250, 2560, 2768, 3048, 3536, 0, 1600, 1603, 1609, 1682, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 2560x1600@85Hz */ + { MODEPREFIX, 552750, 2560, 2608, 2640, 2720, 0, 1600, 1603, 1609, 1694, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 2560x1600@120Hz RB */ + }; ++/* name compat */ ++extern _X_EXPORT const DisplayModeRec xf86DefaultModes[] __attribute__((alias("DMTModes"))); ++const int xf86NumDefaultModes = sizeof(DMTModes) / sizeof(DisplayModeRec); + + #define LEVEL_DMT 0 + #define LEVEL_GTF 1 +@@ -459,7 +462,7 @@ FindDMTMode(int hsize, int vsize, int refresh, Bool rb) + int i; + const DisplayModeRec *ret; + +- for (i = 0; i < sizeof(DMTModes) / sizeof(DisplayModeRec); i++) { ++ for (i = 0; i < xf86NumDefaultModes; i++) { + ret = &DMTModes[i]; + + if (!rb && xf86ModeIsReduced(ret)) +diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c +index 862a473..2935405 100644 +--- a/hw/xfree86/modes/xf86Modes.c ++++ b/hw/xfree86/modes/xf86Modes.c +@@ -682,7 +682,7 @@ xf86GetDefaultModes (void) + + for (i = 0; i < xf86NumDefaultModes; i++) + { +- const DisplayModeRec *defMode = &xf86DefaultModes[i]; ++ const DisplayModeRec *defMode = &DMTModes[i]; + + mode = xf86DuplicateMode(defMode); + head = xf86ModesAdd(head, mode); +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-deviceevent-coordinates-xinerama.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-deviceevent-coordinates-xinerama.patch new file mode 100644 index 00000000..6dc9a016 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-deviceevent-coordinates-xinerama.patch @@ -0,0 +1,37 @@ +From 21ed660f30a3f96c787ab00a16499e0fb034b2ad Mon Sep 17 00:00:00 2001 +From: Chris Humbert +Date: Fri, 7 May 2010 17:02:43 +1000 +Subject: [PATCH] dix: make DeviceEvent coordinates signed for Xinerama. #24986 + +With Xinerama enabled, event coordinates are relative to Screen 0, so +they can be negative. The new DeviceEvent's coordinates are of type +uint16_t, making screens above and to the left of Screen 0 unusable. + +X.Org Bug 24986 + +Signed-off-by: Chris Humbert +Reviewed-by: Peter Hutterer +Signed-off-by: Keith Packard +--- + include/eventstr.h | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/eventstr.h b/include/eventstr.h +index 79685c1..433227e 100644 +--- a/include/eventstr.h ++++ b/include/eventstr.h +@@ -91,9 +91,9 @@ struct _DeviceEvent + uint32_t button; /**< Button number */ + uint32_t key; /**< Key code */ + } detail; +- uint16_t root_x; /**< Pos relative to root window in integral data */ ++ int16_t root_x; /**< Pos relative to root window in integral data */ + float root_x_frac; /**< Pos relative to root window in frac part */ +- uint16_t root_y; /**< Pos relative to root window in integral part */ ++ int16_t root_y; /**< Pos relative to root window in integral part */ + float root_y_frac; /**< Pos relative to root window in frac part */ + uint8_t buttons[(MAX_BUTTONS + 7)/8]; /**< Button mask */ + struct { +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-dix-functions.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-dix-functions.patch new file mode 100644 index 00000000..4bfedfd9 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-dix-functions.patch @@ -0,0 +1,58 @@ +From 7bdea0bb8f38dba2d214482301de981c3260450d Mon Sep 17 00:00:00 2001 +From: Adam Tkac +Date: Mon, 22 Mar 2010 14:52:29 +0100 +Subject: [PATCH] dix: Export AllocDevicePair GetPointerEvents, GetKeyboardEvents and generate_modkeymap functions from Xorg. + +Those functions are used by TigerVNC libvnc.so module which doesn't +use standard XInput infrastructure but uses same functions like, +for example, XTest devices. + +Signed-off-by: Adam Tkac +Signed-off-by: Peter Hutterer +--- + include/input.h | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/input.h b/include/input.h +index 8561308..63f981e 100644 +--- a/include/input.h ++++ b/include/input.h +@@ -432,7 +432,7 @@ extern void CreateClassesChangedEvent(EventListPtr event, + DeviceIntPtr master, + DeviceIntPtr slave, + int type); +-extern int GetPointerEvents( ++extern _X_EXPORT int GetPointerEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, +@@ -442,7 +442,7 @@ extern int GetPointerEvents( + int num_valuators, + int *valuators); + +-extern int GetKeyboardEvents( ++extern _X_EXPORT int GetKeyboardEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, +@@ -493,7 +493,7 @@ extern int AttachDevice(ClientPtr client, + extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); + extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); + +-extern int AllocDevicePair(ClientPtr client, ++extern _X_EXPORT int AllocDevicePair(ClientPtr client, + char* name, + DeviceIntPtr* ptr, + DeviceIntPtr* keybd, +@@ -505,7 +505,7 @@ extern void DeepCopyDeviceClasses(DeviceIntPtr from, + DeviceChangedEvent *dce); + + /* Helper functions. */ +-extern int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, ++extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, + KeyCode **modkeymap, int *max_keys_per_mod); + extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map, + int max_keys_per_mod); +-- +1.6.6.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-more-dix-functions.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-more-dix-functions.patch new file mode 100644 index 00000000..9592a952 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-export-more-dix-functions.patch @@ -0,0 +1,26 @@ +From 6db7cc3d3f750bbb1c170f8fe538e9fb75bc5b34 Mon Sep 17 00:00:00 2001 +From: Adam Tkac +Date: Wed, 14 Apr 2010 12:16:26 +0200 +Subject: [PATCH] Export XkbCopyDeviceKeymap from Xorg, it is needed by VNC. + +Signed-off-by: Adam Tkac +--- + include/xkbsrv.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index ebc7cdb..dc3142a 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -936,7 +936,7 @@ extern Bool XkbCopyKeymap( + XkbDescPtr /* dst */, + XkbDescPtr /* src */); + +-extern Bool XkbCopyDeviceKeymap( ++extern _X_EXPORT Bool XkbCopyDeviceKeymap( + DeviceIntPtr /* dst */, + DeviceIntPtr /* src */); + +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-no-connected-outputs.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-no-connected-outputs.patch new file mode 100644 index 00000000..3ee85424 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-no-connected-outputs.patch @@ -0,0 +1,142 @@ +From b27f93c6dbe0a6e416db2c65738e996c70a403c1 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Thu, 6 May 2010 12:55:34 +1000 +Subject: [PATCH] xf86: allow for no outputs connected at startup operation. + +When nothing is connected at startup and we canGrow, allow the server to start with a 1024x768 framebuffer, and when the drivers send hotplug events this will expand to the correct size dynamically. + +Signed-off-by: Dave Airlie +--- + hw/xfree86/modes/xf86Crtc.c | 66 ++++++++++++++++++++++++++++++------------ + 1 files changed, 47 insertions(+), 19 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 571ffd0..99082ec 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -48,6 +48,8 @@ + + #include "xf86xv.h" + ++#define NO_OUTPUT_DEFAULT_WIDTH 1024 ++#define NO_OUTPUT_DEFAULT_HEIGHT 768 + /* + * Initialize xf86CrtcConfig structure + */ +@@ -1946,7 +1948,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) + #endif + } + +-static void ++static Bool + xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + Bool *enabled) + { +@@ -1961,8 +1963,10 @@ xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + "No outputs definitely connected, trying again...\n"); + + for (o = 0; o < config->num_output; o++) +- enabled[o] = xf86OutputEnabled(config->output[o], FALSE); ++ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], FALSE); + } ++ ++ return any_enabled; + } + + static Bool +@@ -2409,6 +2413,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + Bool *enabled; + int width, height; + int i = scrn->scrnIndex; ++ Bool have_outputs = TRUE; ++ Bool ret; + + /* Set up the device options */ + config->options = xnfalloc (sizeof (xf86DeviceOptions)); +@@ -2433,20 +2439,26 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr)); + enabled = xnfcalloc (config->num_output, sizeof (Bool)); + +- xf86CollectEnabledOutputs(scrn, config, enabled); +- +- if (xf86TargetUserpref(scrn, config, modes, enabled, width, height)) +- xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n"); +- else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height)) +- xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n"); +- else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height)) +- xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n"); +- else if (xf86TargetAspect(scrn, config, modes, enabled, width, height)) +- xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n"); +- else if (xf86TargetFallback(scrn, config, modes, enabled, width, height)) +- xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n"); +- else +- xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n"); ++ ret = xf86CollectEnabledOutputs(scrn, config, enabled); ++ if (ret == FALSE && canGrow) { ++ xf86DrvMsg(i, X_WARNING, "Unable to find connected outputs - setting %dx%d initial framebuffer\n", ++ NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT); ++ have_outputs = FALSE; ++ } ++ else { ++ if (xf86TargetUserpref(scrn, config, modes, enabled, width, height)) ++ xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n"); ++ else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height)) ++ xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n"); ++ else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height)) ++ xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n"); ++ else if (xf86TargetAspect(scrn, config, modes, enabled, width, height)) ++ xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n"); ++ else if (xf86TargetFallback(scrn, config, modes, enabled, width, height)) ++ xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n"); ++ else ++ xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n"); ++ } + + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + if (!modes[o]) +@@ -2479,7 +2491,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + /* + * Assign CRTCs to fit output configuration + */ +- if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height)) ++ if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height)) + { + xfree (crtcs); + xfree (modes); +@@ -2541,6 +2553,13 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + */ + xf86DefaultScreenLimits (scrn, &width, &height, canGrow); + ++ if (have_outputs == FALSE) { ++ if (width < NO_OUTPUT_DEFAULT_WIDTH && height < NO_OUTPUT_DEFAULT_HEIGHT) { ++ width = NO_OUTPUT_DEFAULT_WIDTH; ++ height = NO_OUTPUT_DEFAULT_HEIGHT; ++ } ++ } ++ + scrn->display->virtualX = width; + scrn->display->virtualY = height; + } +@@ -2566,8 +2585,17 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) + width, height); + } + +- /* Mirror output modes to scrn mode list */ +- xf86SetScrnInfoModes (scrn); ++ if (have_outputs) { ++ /* Mirror output modes to scrn mode list */ ++ xf86SetScrnInfoModes (scrn); ++ } else { ++ /* Clear any existing modes from scrn->modes */ ++ while (scrn->modes != NULL) ++ xf86DeleteMode(&scrn->modes, scrn->modes); ++ scrn->modes = xf86ModesAdd(scrn->modes, ++ xf86CVTMode(width, height, 60, 0, 0)); ++ } ++ + + xfree (crtcs); + xfree (modes); +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-pointerkeys.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-pointerkeys.patch new file mode 100644 index 00000000..79167a9b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-pointerkeys.patch @@ -0,0 +1,255 @@ +From 08cfb3f0e91a6055072b257f2701d3ec935c14ad Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 13 Apr 2010 14:41:07 +1000 +Subject: [PATCH 1/3] xkb: Post PointerKeys through the XTEST device. + +Posting an event through a master device may cause pointer jumps once +lastSlave == master, caused by double scaling. To avoid this, post the fake +event generated by XKB through the XTEST device instead. + +Fedora bug #560356 +Tested-by: Andrew McNabb + +Signed-off-by: Peter Hutterer +Reviewed-by: Daniel Stone +--- + xkb/ddxDevBtn.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c +index 94630d1..3bee84b 100644 +--- a/xkb/ddxDevBtn.c ++++ b/xkb/ddxDevBtn.c +@@ -51,13 +51,13 @@ XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) + /* If dev is a slave device, and the SD is attached, do nothing. If we'd + * post through the attached master pointer we'd get duplicate events. + * +- * if dev is a master keyboard, post through the master pointer. ++ * if dev is a master keyboard, post through the XTEST device + * + * if dev is a floating slave, post through the device itself. + */ + + if (IsMaster(dev)) +- ptr = GetMaster(dev, MASTER_POINTER); ++ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); + else if (!dev->u.master) + ptr = dev; + else +-- +1.6.6.1 + +From f2fe7f8ef94e800be70d0a179c7b27327008d8dd Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 14 Apr 2010 10:51:41 +1000 +Subject: [PATCH 2/3] xkb: Guard against SIGIO updates during PointerKeys. + +In theory, an event coming in during GPE could reset our lastSlave, leading +to rather interesting events lateron. + +Signed-off-by: Peter Hutterer +Reviewed-by: Simon Thum +Reviewed-by: Daniel Stone +--- + xkb/ddxDevBtn.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c +index 3bee84b..b8a222d 100644 +--- a/xkb/ddxDevBtn.c ++++ b/xkb/ddxDevBtn.c +@@ -64,11 +64,12 @@ XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) + return; + + events = InitEventList(GetMaximumEventsNum()); ++ OsBlockSignals(); + nevents = GetPointerEvents(events, ptr, + press ? ButtonPress : ButtonRelease, button, + 0 /* flags */, 0 /* first */, + 0 /* num_val */, NULL); +- ++ OsReleaseSignals(); + + for (i = 0; i < nevents; i++) + mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); +-- +1.6.6.1 + +From ec98f743d4f04da6228e5a089515febbcf627af8 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 13 Apr 2010 14:44:59 +1000 +Subject: [PATCH 3/3] xkb: use GPE for XKB fake motion events. + +Section 4.6.1 of the XKB spec says that "the initial event always moves the +cursor the distance specified in the action [...]", so skip the +POINTER_ACCELERATE flag for GPE, it would cause double-acceleration. + +Potential regression - GPE expects the coordinates to be either relative or +both. XKB in theory allows for x to be relative and y to be absolute (or +vice versa). Let's pretend that scenario has no users. + +Signed-off-by: Peter Hutterer +Reviewed-by: Simon Thum +Reviewed-by: Daniel Stone +--- + include/xkbsrv.h | 1 + + xkb/ddxFakeMtn.c | 100 ++++++++++++----------------------------------------- + xkb/xkbActions.c | 4 +- + 3 files changed, 26 insertions(+), 79 deletions(-) + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index ebc7cdb..a19cb43 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -787,6 +787,7 @@ extern _X_EXPORT void XkbDDXUpdateDeviceIndicators( + ); + + extern _X_EXPORT void XkbDDXFakePointerMotion( ++ DeviceIntPtr /* dev */, + unsigned int /* flags */, + int /* x */, + int /* y */ +diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c +index f90d209..b383716 100644 +--- a/xkb/ddxFakeMtn.c ++++ b/xkb/ddxFakeMtn.c +@@ -28,91 +28,37 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. + #include + #endif + +-#include +-#include +-#include +-#include + #include "inputstr.h" +-#include "scrnintstr.h" +-#include "windowstr.h" + #include +-#include +- +-#ifdef PANORAMIX +-#include "panoramiX.h" +-#include "panoramiXsrv.h" +-#endif +- +-#include "mipointer.h" +-#include "mipointrst.h" ++#include "mi.h" + + void +-XkbDDXFakePointerMotion(unsigned flags,int x,int y) ++XkbDDXFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) + { +-int oldX,oldY; +-ScreenPtr pScreen, oldScreen; +- +- GetSpritePosition(inputInfo.pointer, &oldX, &oldY); +- pScreen = oldScreen = GetSpriteWindow(inputInfo.pointer)->drawable.pScreen; +- +-#ifdef PANORAMIX +- if (!noPanoramiXExtension) { +- BoxRec box; +- int i; ++ EventListPtr events; ++ int nevents, i; ++ DeviceIntPtr ptr; ++ int gpe_flags = 0; + +- if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], +- oldX, oldY, &box)) { +- FOR_NSCREENS(i) { +- if(i == pScreen->myNum) +- continue; +- if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], +- oldX, oldY, &box)) { +- pScreen = screenInfo.screens[i]; +- break; +- } +- } +- } +- oldScreen = pScreen; +- +- if (flags&XkbSA_MoveAbsoluteX) +- oldX= x; +- else oldX+= x; +- if (flags&XkbSA_MoveAbsoluteY) +- oldY= y; +- else oldY+= y; ++ if (!dev->u.master) ++ ptr = dev; ++ else ++ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); + +- if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], +- oldX, oldY, &box)) { +- FOR_NSCREENS(i) { +- if(i == pScreen->myNum) +- continue; +- if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], +- oldX, oldY, &box)) { +- pScreen = screenInfo.screens[i]; +- break; +- } +- } +- } +- oldX -= panoramiXdataPtr[pScreen->myNum].x; +- oldY -= panoramiXdataPtr[pScreen->myNum].y; +- } ++ if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) ++ gpe_flags = POINTER_ABSOLUTE; + else +-#endif +- { +- if (flags&XkbSA_MoveAbsoluteX) +- oldX= x; +- else oldX+= x; +- if (flags&XkbSA_MoveAbsoluteY) +- oldY= y; +- else oldY+= y; ++ gpe_flags = POINTER_RELATIVE; ++ ++ events = InitEventList(GetMaximumEventsNum()); ++ OsBlockSignals(); ++ nevents = GetPointerEvents(events, ptr, ++ MotionNotify, 0, ++ gpe_flags, 0, 2, (int[]){x, y}); ++ OsReleaseSignals(); + +-#define GetScreenPrivate(s) ((miPointerScreenPtr)dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey)) +- (*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen) +- (&pScreen, &oldX, &oldY); +- } ++ for (i = 0; i < nevents; i++) ++ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); + +- if (pScreen != oldScreen) +- NewCurrentScreen(inputInfo.pointer, pScreen, oldX, oldY); +- if (pScreen->SetCursorPosition) +- (*pScreen->SetCursorPosition)(inputInfo.pointer, pScreen, oldX, oldY, TRUE); ++ FreeEventList(events, GetMaximumEventsNum()); + } +diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c +index b0ab427..663f033 100644 +--- a/xkb/xkbActions.c ++++ b/xkb/xkbActions.c +@@ -479,7 +479,7 @@ int dx,dy; + dx= xkbi->mouseKeysDX; + dy= xkbi->mouseKeysDY; + } +- XkbDDXFakePointerMotion(xkbi->mouseKeysFlags,dx,dy); ++ XkbDDXFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy); + return xkbi->desc->ctrls->mk_interval; + } + +@@ -507,7 +507,7 @@ Bool accel; + accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0); + x= XkbPtrActionX(&pAction->ptr); + y= XkbPtrActionY(&pAction->ptr); +- XkbDDXFakePointerMotion(pAction->ptr.flags,x,y); ++ XkbDDXFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y); + AccessXCancelRepeatKey(xkbi,keycode); + xkbi->mouseKeysAccel= accel&& + (xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask); +-- +1.6.6.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-randr-vt-switch.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-randr-vt-switch.patch new file mode 100644 index 00000000..d2e6d71b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.6-randr-vt-switch.patch @@ -0,0 +1,41 @@ +From 41bdb6c003cca3ef0ff88d9c7de318115bab1ba2 Mon Sep 17 00:00:00 2001 +From: Pierre-Loup A. Griffais +Date: Wed, 21 Apr 2010 18:11:05 -0700 +Subject: [PATCH] xf86: Don't crash when switching modes through RandR without owning the VT. + +While VT-switched, FB access is disabled and should remain so. Trying to switch +modes in that state would re-enable it, potentially causing crashes if trying +to access it before the driver has recovered from the mode switch. + +Signed-off-by: Pierre-Loup A. Griffais +Reviewed-by: Adam Jackson +Signed-off-by: Keith Packard +--- + hw/xfree86/common/xf86RandR.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c +index 02dcc34..d4beb2c 100644 +--- a/hw/xfree86/common/xf86RandR.c ++++ b/hw/xfree86/common/xf86RandR.c +@@ -163,7 +163,7 @@ xf86RandRSetMode (ScreenPtr pScreen, + WindowPtr pRoot = WindowTable[pScreen->myNum]; + Bool ret = TRUE; + +- if (pRoot) ++ if (pRoot && scrp->vtSema) + (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE); + if (useVirtual) + { +@@ -229,7 +229,7 @@ xf86RandRSetMode (ScreenPtr pScreen, + */ + xf86SetViewport (pScreen, pScreen->width, pScreen->height); + xf86SetViewport (pScreen, 0, 0); +- if (pRoot) ++ if (pRoot && scrp->vtSema) + (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE); + return ret; + } +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-classic-default-mode.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-classic-default-mode.patch new file mode 100644 index 00000000..bc72157b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-classic-default-mode.patch @@ -0,0 +1,74 @@ +From 5f34853d6f936e8a1a317a59972b07e3f191d1ab Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 15 Nov 2010 11:25:13 +1000 +Subject: [PATCH] xfree86: Bump classic driver default to 1024x768 + +Signed-off-by: Adam Jackson +Signed-off-by: Peter Hutterer +Reviewed-by: Keith Packard +Signed-off-by: Keith Packard +--- + hw/xfree86/common/xf86Mode.c | 21 ++++++++++++++++----- + 1 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c +index d03310e..54fe021 100644 +--- a/hw/xfree86/common/xf86Mode.c ++++ b/hw/xfree86/common/xf86Mode.c +@@ -1402,6 +1402,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + strategy &= ~LOOKUP_OPTIONAL_TOLERANCES; + } else { + const char *type = ""; ++ Bool specified = FALSE; + + if (scrp->monitor->nHsync <= 0) { + if (numTimings > 0) { +@@ -1412,11 +1413,13 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + } + } else { + scrp->monitor->hsync[0].lo = 31.5; +- scrp->monitor->hsync[0].hi = 37.9; ++ scrp->monitor->hsync[0].hi = 48.0; + scrp->monitor->nHsync = 1; + } + type = "default "; +- } ++ } else { ++ specified = TRUE; ++ } + for (i = 0; i < scrp->monitor->nHsync; i++) { + if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi) + xf86DrvMsg(scrp->scrnIndex, X_INFO, +@@ -1445,7 +1448,9 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + scrp->monitor->nVrefresh = 1; + } + type = "default "; +- } ++ } else { ++ specified = TRUE; ++ } + for (i = 0; i < scrp->monitor->nVrefresh; i++) { + if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi) + xf86DrvMsg(scrp->scrnIndex, X_INFO, +@@ -1459,10 +1464,16 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + scrp->monitor->vrefresh[i].lo, + scrp->monitor->vrefresh[i].hi); + } ++ ++ type = ""; ++ if (!scrp->monitor->maxPixClock && !specified) { ++ type = "default "; ++ scrp->monitor->maxPixClock = 65000.0; ++ } + if (scrp->monitor->maxPixClock) { + xf86DrvMsg(scrp->scrnIndex, X_INFO, +- "%s: Using maximum pixel clock of %.2f MHz\n", +- scrp->monitor->id, ++ "%s: Using %smaximum pixel clock of %.2f MHz\n", ++ scrp->monitor->id, type, + (float)scrp->monitor->maxPixClock / 1000.0); + } + } +-- +1.7.3.4 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-compresize-fix.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-compresize-fix.patch new file mode 100644 index 00000000..a211093f --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-compresize-fix.patch @@ -0,0 +1,319 @@ +From 08bc76d60fdd39cf6d09e28070f37a0ad620adab Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Fri, 4 Jun 2010 11:02:58 +1000 +Subject: [PATCH 2/8] composite fixes backported + +squashes three upstream patches +composite: use config notify hook to do pixmap resize. (v3) - backported to avoid ABI breakage +composite: initialise pOldPixmap to NullPixmap at alloc time. +composite: fix freeing of old pixmap until after move/resize/cbw + +misapplied - fixup +--- + composite/compalloc.c | 1 + + composite/compinit.c | 3 +- + composite/compint.h | 11 ++-- + composite/compwindow.c | 124 +++++++++++++++-------------------------------- + dix/window.c | 18 +++++++- + include/window.h | 11 ++++ + 6 files changed, 77 insertions(+), 91 deletions(-) + +diff --git a/composite/compalloc.c b/composite/compalloc.c +index 73adc72..8a6beb9 100644 +--- a/composite/compalloc.c ++++ b/composite/compalloc.c +@@ -143,6 +143,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) + cw->oldy = COMP_ORIGIN_INVALID; + cw->damageRegistered = FALSE; + cw->damaged = FALSE; ++ cw->pOldPixmap = NullPixmap; + dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw); + } + ccw->next = cw->clients; +diff --git a/composite/compinit.c b/composite/compinit.c +index e8b563d..2ee9332 100644 +--- a/composite/compinit.c ++++ b/composite/compinit.c +@@ -69,6 +69,7 @@ compCloseScreen (int index, ScreenPtr pScreen) + pScreen->InstallColormap = cs->InstallColormap; + pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes; + pScreen->ReparentWindow = cs->ReparentWindow; ++ + pScreen->MoveWindow = cs->MoveWindow; + pScreen->ResizeWindow = cs->ResizeWindow; + pScreen->ChangeBorderWidth = cs->ChangeBorderWidth; +@@ -389,6 +390,6 @@ compScreenInit (ScreenPtr pScreen) + dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs); + + RegisterRealChildHeadProc(CompositeRealChildHead); +- ++ RegisterCompositeConfigNotifyProc(compConfigNotify); + return TRUE; + } +diff --git a/composite/compint.h b/composite/compint.h +index 845a196..a959ad5 100644 +--- a/composite/compint.h ++++ b/composite/compint.h +@@ -126,14 +126,11 @@ typedef struct _CompScreen { + RealizeWindowProcPtr RealizeWindow; + UnrealizeWindowProcPtr UnrealizeWindow; + ClipNotifyProcPtr ClipNotify; +- /* +- * Called from ConfigureWindow, these +- * three track changes to the offscreen storage +- * geometry +- */ ++ + MoveWindowProcPtr MoveWindow; + ResizeWindowProcPtr ResizeWindow; + ChangeBorderWidthProcPtr ChangeBorderWidth; ++ + /* + * Reparenting has an effect on Subwindows redirect + */ +@@ -316,4 +313,8 @@ CompositeRealChildHead (WindowPtr pWin); + int + DeleteWindowNoInputDevices(pointer value, XID wid); + ++int ++compConfigNotify(WindowPtr pWin, int x, int y, int w, int h, ++ int bw, WindowPtr pSib); ++ + #endif /* _COMPINT_H_ */ +diff --git a/composite/compwindow.c b/composite/compwindow.c +index 2f5a717..550df39 100644 +--- a/composite/compwindow.c ++++ b/composite/compwindow.c +@@ -334,37 +334,9 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent) + return FALSE; + } + +-void +-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) ++static void compFreeOldPixmap(WindowPtr pWin) + { + ScreenPtr pScreen = pWin->drawable.pScreen; +- CompScreenPtr cs = GetCompScreen (pScreen); +- +- compCheckTree (pScreen); +- if (pWin->redirectDraw != RedirectDrawNone) +- { +- WindowPtr pParent; +- int draw_x, draw_y; +- unsigned int w, h, bw; +- +- /* if this is a root window, can't be moved */ +- if (!(pParent = pWin->parent)) +- return; +- +- bw = wBorderWidth (pWin); +- draw_x = pParent->drawable.x + x + (int)bw; +- draw_y = pParent->drawable.y + y + (int)bw; +- w = pWin->drawable.width; +- h = pWin->drawable.height; +- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); +- } +- compCheckTree (pScreen); +- +- pScreen->MoveWindow = cs->MoveWindow; +- (*pScreen->MoveWindow) (pWin, x, y, pSib, kind); +- cs->MoveWindow = pScreen->MoveWindow; +- pScreen->MoveWindow = compMoveWindow; +- + if (pWin->redirectDraw != RedirectDrawNone) + { + CompWindowPtr cw = GetCompWindow (pWin); +@@ -374,7 +346,19 @@ compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) + cw->pOldPixmap = NullPixmap; + } + } ++} ++void ++compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) ++{ ++ ScreenPtr pScreen = pWin->drawable.pScreen; ++ CompScreenPtr cs = GetCompScreen (pScreen); ++ ++ pScreen->MoveWindow = cs->MoveWindow; ++ (*pScreen->MoveWindow) (pWin, x, y, pSib, kind); ++ cs->MoveWindow = pScreen->MoveWindow; ++ pScreen->MoveWindow = compMoveWindow; + ++ compFreeOldPixmap(pWin); + compCheckTree (pScreen); + } + +@@ -385,37 +369,12 @@ compResizeWindow (WindowPtr pWin, int x, int y, + ScreenPtr pScreen = pWin->drawable.pScreen; + CompScreenPtr cs = GetCompScreen (pScreen); + +- compCheckTree (pScreen); +- if (pWin->redirectDraw != RedirectDrawNone) +- { +- WindowPtr pParent; +- int draw_x, draw_y; +- unsigned int bw; +- +- /* if this is a root window, can't be moved */ +- if (!(pParent = pWin->parent)) +- return; +- +- bw = wBorderWidth (pWin); +- draw_x = pParent->drawable.x + x + (int)bw; +- draw_y = pParent->drawable.y + y + (int)bw; +- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); +- } +- compCheckTree (pScreen); +- + pScreen->ResizeWindow = cs->ResizeWindow; + (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib); + cs->ResizeWindow = pScreen->ResizeWindow; + pScreen->ResizeWindow = compResizeWindow; +- if (pWin->redirectDraw != RedirectDrawNone) +- { +- CompWindowPtr cw = GetCompWindow (pWin); +- if (cw->pOldPixmap) +- { +- (*pScreen->DestroyPixmap) (cw->pOldPixmap); +- cw->pOldPixmap = NullPixmap; +- } +- } ++ ++ compFreeOldPixmap(pWin); + compCheckTree (pWin->drawable.pScreen); + } + +@@ -425,38 +384,12 @@ compChangeBorderWidth (WindowPtr pWin, unsigned int bw) + ScreenPtr pScreen = pWin->drawable.pScreen; + CompScreenPtr cs = GetCompScreen (pScreen); + +- compCheckTree (pScreen); +- if (pWin->redirectDraw != RedirectDrawNone) +- { +- WindowPtr pParent; +- int draw_x, draw_y; +- unsigned int w, h; +- +- /* if this is a root window, can't be moved */ +- if (!(pParent = pWin->parent)) +- return; +- +- draw_x = pWin->drawable.x; +- draw_y = pWin->drawable.y; +- w = pWin->drawable.width; +- h = pWin->drawable.height; +- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); +- } +- compCheckTree (pScreen); +- + pScreen->ChangeBorderWidth = cs->ChangeBorderWidth; + (*pScreen->ChangeBorderWidth) (pWin, bw); + cs->ChangeBorderWidth = pScreen->ChangeBorderWidth; + pScreen->ChangeBorderWidth = compChangeBorderWidth; +- if (pWin->redirectDraw != RedirectDrawNone) +- { +- CompWindowPtr cw = GetCompWindow (pWin); +- if (cw->pOldPixmap) +- { +- (*pScreen->DestroyPixmap) (cw->pOldPixmap); +- cw->pOldPixmap = NullPixmap; +- } +- } ++ ++ compFreeOldPixmap(pWin); + compCheckTree (pWin->drawable.pScreen); + } + +@@ -822,3 +755,26 @@ CompositeRealChildHead (WindowPtr pWin) + return pChildBefore; + } + } ++ ++int ++compConfigNotify(WindowPtr pWin, int x, int y, int w, int h, ++ int bw, WindowPtr pSib) ++{ ++ ScreenPtr pScreen = pWin->drawable.pScreen; ++ WindowPtr pParent = pWin->parent; ++ int draw_x, draw_y; ++ Bool alloc_ret; ++ ++ if (pWin->redirectDraw == RedirectDrawNone) ++ return Success; ++ ++ compCheckTree (pScreen); ++ ++ draw_x = pParent->drawable.x + x + bw; ++ draw_y = pParent->drawable.y + y + bw; ++ alloc_ret = compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); ++ ++ if (alloc_ret == FALSE) ++ return BadAlloc; ++ return Success; ++} +diff --git a/dix/window.c b/dix/window.c +index e191f09..e4c850f 100644 +--- a/dix/window.c ++++ b/dix/window.c +@@ -2104,6 +2104,13 @@ ReflectStackChange( + WindowsRestructured (); + } + ++static compositeConfigNotifyProcPtr compositeConfigNotify; ++void ++RegisterCompositeConfigNotifyProc(compositeConfigNotifyProcPtr proc) ++{ ++ compositeConfigNotify = proc; ++} ++ + /***** + * ConfigureWindow + *****/ +@@ -2220,7 +2227,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) + else + pSib = pWin->nextSib; + +- + if ((!pWin->overrideRedirect) && + (RedirectSend(pParent) + )) +@@ -2305,6 +2311,16 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) + return(Success); + + ActuallyDoSomething: ++ if (compositeConfigNotify) ++ { ++ int ret; ++ ret = compositeConfigNotify(pWin, x, y, w, h, bw, pSib); ++ if (ret) { ++ client->errorValue = 0; ++ return ret; ++ } ++ } ++ + if (SubStrSend(pWin, pParent)) + { + memset(&event, 0, sizeof(xEvent)); +diff --git a/include/window.h b/include/window.h +index 6fb2f8c..ea2edab 100644 +--- a/include/window.h ++++ b/include/window.h +@@ -266,4 +266,15 @@ extern _X_EXPORT void DisableMapUnmapEvents( + extern _X_EXPORT void EnableMapUnmapEvents( + WindowPtr /* pWin */ ); + ++typedef int (* compositeConfigNotifyProcPtr)( ++ WindowPtr /* pWin */, ++ int /* x */, ++ int /* y */, ++ int /* w */, ++ int /* h */, ++ int /* bw */, ++ WindowPtr /*pSib*/); ++ ++_X_EXPORT void RegisterCompositeConfigNotifyProc(compositeConfigNotifyProcPtr proc); ++ + #endif /* WINDOW_H */ +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-ddc-probe-less.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-ddc-probe-less.patch new file mode 100644 index 00000000..3fe7e4f7 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-ddc-probe-less.patch @@ -0,0 +1,30 @@ +From 872e6e49882d655c4e7dd7914e0bf34480a8c30b Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 9 Aug 2010 14:33:55 -0400 +Subject: [PATCH] ddc: Don't probe for DDC/CI or EEPROM, some monitors hate that + +Those monitors are garbage, of course. + +Signed-off-by: Adam Jackson +--- + hw/xfree86/ddc/ddc.c | 4 ---- + 1 files changed, 0 insertions(+), 4 deletions(-) + +diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c +index 6fad9fb..df46689 100644 +--- a/hw/xfree86/ddc/ddc.c ++++ b/hw/xfree86/ddc/ddc.c +@@ -311,10 +311,6 @@ DDC2Init(int scrnIndex, I2CBusPtr pBus) + dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2"); + if (xf86I2CProbeAddress(pBus, 0x0060)) + DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register"); +- if (xf86I2CProbeAddress(pBus, 0x0062)) +- DDC2MakeDevice(pBus, 0x0062, "EDID EEPROM interface"); +- if (xf86I2CProbeAddress(pBus, 0x006E)) +- DDC2MakeDevice(pBus, 0x006E, "DDC control interface"); + + return dev; + } +-- +1.7.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-device-mode-list.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-device-mode-list.patch new file mode 100644 index 00000000..b1328b70 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-device-mode-list.patch @@ -0,0 +1,31 @@ +From 532529ced48ff4338cfd7317fa795e9bbf0a2d80 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 9 Jun 2010 15:41:09 +1000 +Subject: [PATCH] Xi: only list the device mode in XIQueryDevice, not the proximity bit. + +The mode is either Absolute or Relative, the mode field in the +ValuatorClassRec also stores the proximity bit on the second bit for XI 1.x +clients, returning bad data to clients that just check for (mode == +Absolute) or for (mode == Relative). + +Signed-off-by: Peter Hutterer +--- + Xi/xiquerydevice.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c +index 435868d..4849286 100644 +--- a/Xi/xiquerydevice.c ++++ b/Xi/xiquerydevice.c +@@ -346,7 +346,7 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber, + info->value.frac = (int)(v->axisVal[axisnumber] * (1 << 16) * (1 << 16)); + info->resolution = v->axes[axisnumber].resolution; + info->number = axisnumber; +- info->mode = v->mode; /* Server doesn't have per-axis mode yet */ ++ info->mode = v->mode & DeviceMode; /* Server doesn't have per-axis mode yet */ + info->sourceid = v->sourceid; + + if (!reportState) +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-dga-master-keyboard.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-dga-master-keyboard.patch new file mode 100644 index 00000000..2e12cc24 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-dga-master-keyboard.patch @@ -0,0 +1,43 @@ +From 374fca17a231d6ea39154e8dfb881d4c7f3f5c4d Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 16 Apr 2010 16:35:22 +1000 +Subject: [PATCH] xfree86: dga needs to use the master keyboard state (#27573) + +GetPairedDevice() may not always return the keyboard, resulting in a +null-pointer dereference when accessing the XKB state. +For floating devices, the GetMaster() returns the device itself. + +X.Org Bug 27573 + +Signed-off-by: Peter Hutterer +Reviewed-by: Daniel Stone +Tested-by: Ben Hutchings +(cherry picked from commit 10de9e8ee37265a35ceeceb2007d711da70d4f2d) +--- + hw/xfree86/common/xf86DGA.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c +index 804fd37..5d8addb 100644 +--- a/hw/xfree86/common/xf86DGA.c ++++ b/hw/xfree86/common/xf86DGA.c +@@ -1088,13 +1088,15 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse) + ButtonClassPtr butc = mouse->button; + DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + DeviceEvent ev; ++ DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD); + + memset(&ev, 0, sizeof(ev)); + ev.header = ET_Internal; + ev.length = sizeof(ev); + ev.type = event->subtype; + ev.corestate = butc->state; +- ev.corestate |= XkbStateFieldFromRec(&GetPairedDevice(mouse)->key->xkbInfo->state); ++ if (master && master->key) ++ ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state); + + UpdateDeviceState(mouse, &ev); + +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-event-mask-revert.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-event-mask-revert.patch new file mode 100644 index 00000000..315a8eb1 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-event-mask-revert.patch @@ -0,0 +1,137 @@ +From 32fc04c9f8b38627ef13d4640d22563eb18d3de6 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 24 Jun 2010 12:52:53 +1000 +Subject: [PATCH] Revert "dix: use the event mask of the grab for TryClientEvents." + +Behaviour of earlier X servers was to deliver the ButtonPress event +unconditionally, regardless of the actual event mask being set. This is +documented in the protocol: +"This request establishes a passive grab. In the future, the pointer is +actively grabbed as described in GrabPointer, the last-pointer-grab time is +set to the time at which the button was pressed (as transmitted in the +ButtonPress event), and the ButtonPress event is reported if all of the +following conditions are true: + " + +Thus, a GrabButton event will always deliver the button press event, a +GrabKey always the key press event, etc. Same goes for XI and XI2. + +Reproducible with a simple client requesting a button grab in the form of: + XGrabButton(dpy, AnyButton, AnyModifier, win, True, ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, None, None); + +On servers before MPX/XI2, the client will receive a button press and +release event. On current servers, the client receives only the release. +Clients that expect the press event to be delivered unconditionally. + +XTS Xlib13 XGrabButton 5/39 now passes. + +This reverts commit 48585bd1e3e98db0f3df1ecc68022510216e00cc. +Effectively reverts commit 1c612acca8568fcdf9761d23f112adaf4d496f1b as well, +the code introduced with 1c612 is not needed anymore. + +Conflicts: + + dix/events.c + +Signed-off-by: Peter Hutterer +Acked-by: Daniel Stone +Reviewed-by: Keith Packard +--- + dix/events.c | 52 ++-------------------------------------------------- + 1 files changed, 2 insertions(+), 50 deletions(-) + +diff --git a/dix/events.c b/dix/events.c +index 44c4624..9d35b22 100644 +--- a/dix/events.c ++++ b/dix/events.c +@@ -3440,7 +3440,6 @@ CheckPassiveGrabsOnWindow( + { + DeviceIntPtr gdev; + XkbSrvInfoPtr xkbi = NULL; +- Mask mask = 0; + + gdev= grab->modifierDevice; + if (grab->grabtype == GRABTYPE_CORE) +@@ -3555,9 +3554,6 @@ CheckPassiveGrabsOnWindow( + } + xE = &core; + count = 1; +- mask = grab->eventMask; +- if (grab->ownerEvents) +- mask |= pWin->eventMask; + } else if (match & XI2_MATCH) + { + rc = EventToXI2((InternalEvent*)event, &xE); +@@ -3569,34 +3565,6 @@ CheckPassiveGrabsOnWindow( + continue; + } + count = 1; +- +- /* FIXME: EventToXI2 returns NULL for enter events, so +- * dereferencing the event is bad. Internal event types are +- * aligned with core events, so the else clause is valid. +- * long-term we should use internal events for enter/focus +- * as well */ +- if (xE) +- mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8]; +- else if (event->type == XI_Enter || event->type == XI_FocusIn) +- mask = grab->xi2mask[device->id][event->type/8]; +- +- if (grab->ownerEvents && wOtherInputMasks(grab->window)) +- { +- InputClientsPtr icp = +- wOtherInputMasks(grab->window)->inputClients; +- +- while(icp) +- { +- if (rClient(icp) == rClient(grab)) +- { +- int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type; +- mask |= icp->xi2mask[device->id][evtype/8]; +- break; +- } +- +- icp = icp->next; +- } +- } + } else + { + rc = EventToXI((InternalEvent*)event, &xE, &count); +@@ -3607,23 +3575,6 @@ CheckPassiveGrabsOnWindow( + "(%d, %d).\n", device->name, event->type, rc); + continue; + } +- mask = grab->eventMask; +- if (grab->ownerEvents && wOtherInputMasks(grab->window)) +- { +- InputClientsPtr icp = +- wOtherInputMasks(grab->window)->inputClients; +- +- while(icp) +- { +- if (rClient(icp) == rClient(grab)) +- { +- mask |= icp->mask[device->id]; +- break; +- } +- +- icp = icp->next; +- } +- } + } + + (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); +@@ -3632,7 +3583,8 @@ CheckPassiveGrabsOnWindow( + { + FixUpEventFromWindow(device, xE, grab->window, None, TRUE); + +- TryClientEvents(rClient(grab), device, xE, count, mask, ++ TryClientEvents(rClient(grab), device, xE, count, ++ GetEventFilter(device, xE), + GetEventFilter(device, xE), grab); + } + +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-exa-master.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-exa-master.patch new file mode 100644 index 00000000..73f7ab39 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-exa-master.patch @@ -0,0 +1,2183 @@ +From 9f493b930ef99253ba7e37dc280daff6738b6401 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 26 May 2010 11:15:00 -0500 +Subject: exa master + +produced with git diff xorg-server-1.7.6..master exa/ + +Future diffs of this form will probably have to be careful about the +devPrivates rework. + +diff --git a/exa/exa.c b/exa/exa.c +index b8f0419..46a850f 100644 +--- a/exa/exa.c ++++ b/exa/exa.c +@@ -233,19 +233,19 @@ exaPixmapIsPinned (PixmapPtr pPix) + } + + /** +- * exaPixmapIsOffscreen() is used to determine if a pixmap is in offscreen ++ * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen + * memory, meaning that acceleration could probably be done to it, and that it + * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it + * with the CPU. + * + * Note that except for UploadToScreen()/DownloadFromScreen() (which explicitly + * deal with moving pixmaps in and out of system memory), EXA will give drivers +- * pixmaps as arguments for which exaPixmapIsOffscreen() is TRUE. ++ * pixmaps as arguments for which exaPixmapHasGpuCopy() is TRUE. + * + * @return TRUE if the given drawable is in framebuffer memory. + */ + Bool +-exaPixmapIsOffscreen(PixmapPtr pPixmap) ++exaPixmapHasGpuCopy(PixmapPtr pPixmap) + { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + ExaScreenPriv(pScreen); +@@ -253,16 +253,16 @@ exaPixmapIsOffscreen(PixmapPtr pPixmap) + if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS)) + return FALSE; + +- return (*pExaScr->pixmap_is_offscreen)(pPixmap); ++ return (*pExaScr->pixmap_has_gpu_copy)(pPixmap); + } + + /** +- * exaDrawableIsOffscreen() is a convenience wrapper for exaPixmapIsOffscreen(). ++ * exaDrawableIsOffscreen() is a convenience wrapper for exaPixmapHasGpuCopy(). + */ + Bool + exaDrawableIsOffscreen (DrawablePtr pDrawable) + { +- return exaPixmapIsOffscreen (exaGetDrawablePixmap (pDrawable)); ++ return exaPixmapHasGpuCopy (exaGetDrawablePixmap (pDrawable)); + } + + /** +@@ -276,14 +276,14 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp) + + exaGetDrawableDeltas (pDrawable, pPixmap, xp, yp); + +- if (exaPixmapIsOffscreen (pPixmap)) ++ if (exaPixmapHasGpuCopy (pPixmap)) + return pPixmap; + else + return NULL; + } + + /** +- * Returns TRUE if pixmap can be accessed offscreen. ++ * Returns TRUE if the pixmap GPU copy is being accessed. + */ + Bool + ExaDoPrepareAccess(PixmapPtr pPixmap, int index) +@@ -291,7 +291,7 @@ ExaDoPrepareAccess(PixmapPtr pPixmap, int index) + ScreenPtr pScreen = pPixmap->drawable.pScreen; + ExaScreenPriv (pScreen); + ExaPixmapPriv(pPixmap); +- Bool offscreen; ++ Bool has_gpu_copy, ret; + int i; + + if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS)) +@@ -304,7 +304,7 @@ ExaDoPrepareAccess(PixmapPtr pPixmap, int index) + for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) { + if (pExaScr->access[i].pixmap == pPixmap) { + pExaScr->access[i].count++; +- return TRUE; ++ return pExaScr->access[i].retval; + } + } + +@@ -321,31 +321,35 @@ ExaDoPrepareAccess(PixmapPtr pPixmap, int index) + pPixmap->devPrivate.ptr)); + } + +- offscreen = exaPixmapIsOffscreen(pPixmap); ++ has_gpu_copy = exaPixmapHasGpuCopy(pPixmap); + +- if (offscreen && pExaPixmap->fb_ptr) ++ if (has_gpu_copy && pExaPixmap->fb_ptr) { + pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr; +- else ++ ret = TRUE; ++ } else { + pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr; ++ ret = FALSE; ++ } + + /* Store so we can handle repeated / nested calls. */ + pExaScr->access[index].pixmap = pPixmap; + pExaScr->access[index].count = 1; + +- if (!offscreen) +- return FALSE; ++ if (!has_gpu_copy) ++ goto out; + + exaWaitSync (pScreen); + + if (pExaScr->info->PrepareAccess == NULL) +- return TRUE; ++ goto out; + + if (index >= EXA_PREPARE_AUX_DEST && + !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) { + if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) + FatalError("Unsupported AUX indices used on a pinned pixmap.\n"); + exaMoveOutPixmap (pPixmap); +- return FALSE; ++ ret = FALSE; ++ goto out; + } + + if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) { +@@ -353,11 +357,15 @@ ExaDoPrepareAccess(PixmapPtr pPixmap, int index) + !(pExaScr->info->flags & EXA_MIXED_PIXMAPS)) + FatalError("Driver failed PrepareAccess on a pinned pixmap.\n"); + exaMoveOutPixmap (pPixmap); +- +- return FALSE; ++ ret = FALSE; ++ goto out; + } + +- return TRUE; ++ ret = TRUE; ++ ++out: ++ pExaScr->access[index].retval = ret; ++ return ret; + } + + /** +@@ -409,18 +417,15 @@ exaFinishAccess(DrawablePtr pDrawable, int index) + + /* Catch unbalanced Prepare/FinishAccess calls. */ + if (i == EXA_NUM_PREPARE_INDICES) +- EXA_FatalErrorDebug(("EXA bug: FinishAccess called without PrepareAccess for pixmap 0x%p.\n", +- pPixmap)); ++ EXA_FatalErrorDebugWithRet(("EXA bug: FinishAccess called without PrepareAccess for pixmap 0x%p.\n", ++ pPixmap),); + + pExaScr->access[i].pixmap = NULL; + + /* We always hide the devPrivate.ptr. */ + pPixmap->devPrivate.ptr = NULL; + +- if (pExaScr->finish_access) +- pExaScr->finish_access(pPixmap, index); +- +- if (!pExaScr->info->FinishAccess || !exaPixmapIsOffscreen(pPixmap)) ++ if (!pExaScr->info->FinishAccess || !exaPixmapHasGpuCopy(pPixmap)) + return; + + if (i >= EXA_PREPARE_AUX_DEST && +@@ -695,10 +700,18 @@ ExaBlockHandler(int screenNum, pointer blockData, pointer pTimeout, + ScreenPtr pScreen = screenInfo.screens[screenNum]; + ExaScreenPriv(pScreen); + ++ /* Move any deferred results from a software fallback to the driver pixmap */ ++ if (pExaScr->deferred_mixed_pixmap) ++ exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap); ++ + unwrap(pExaScr, pScreen, BlockHandler); + (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); + wrap(pExaScr, pScreen, BlockHandler, ExaBlockHandler); + ++ /* The rest only applies to classic EXA */ ++ if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) ++ return; ++ + /* Try and keep the offscreen memory area tidy every now and then (at most + * once per second) when the server has been idle for at least 100ms. + */ +@@ -740,9 +753,7 @@ static Bool + exaCloseScreen(int i, ScreenPtr pScreen) + { + ExaScreenPriv(pScreen); +-#ifdef RENDER + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); +-#endif + + if (ps->Glyphs == exaGlyphs) + exaGlyphsFini(pScreen); +@@ -765,18 +776,14 @@ exaCloseScreen(int i, ScreenPtr pScreen) + unwrap(pExaScr, pScreen, ChangeWindowAttributes); + unwrap(pExaScr, pScreen, BitmapToRegion); + unwrap(pExaScr, pScreen, CreateScreenResources); +-#ifdef RENDER +- if (ps) { +- unwrap(pExaScr, ps, Composite); +- if (pExaScr->SavedGlyphs) +- unwrap(pExaScr, ps, Glyphs); +- unwrap(pExaScr, ps, Trapezoids); +- unwrap(pExaScr, ps, Triangles); +- unwrap(pExaScr, ps, AddTraps); +- } +-#endif ++ unwrap(pExaScr, ps, Composite); ++ if (pExaScr->SavedGlyphs) ++ unwrap(pExaScr, ps, Glyphs); ++ unwrap(pExaScr, ps, Trapezoids); ++ unwrap(pExaScr, ps, Triangles); ++ unwrap(pExaScr, ps, AddTraps); + +- xfree (pExaScr); ++ free(pExaScr); + + return (*pScreen->CloseScreen) (i, pScreen); + } +@@ -787,14 +794,14 @@ exaCloseScreen(int i, ScreenPtr pScreen) + * without breaking ABI between EXA and the drivers. The driver's + * responsibility is to check beforehand that the EXA module has a matching + * major number and sufficient minor. Drivers are responsible for freeing the +- * driver structure using xfree(). ++ * driver structure using free(). + * + * @return a newly allocated, zero-filled driver structure + */ + ExaDriverPtr + exaDriverAlloc(void) + { +- return xcalloc(1, sizeof(ExaDriverRec)); ++ return calloc(1, sizeof(ExaDriverRec)); + } + + /** +@@ -812,9 +819,7 @@ exaDriverInit (ScreenPtr pScreen, + ExaDriverPtr pScreenInfo) + { + ExaScreenPrivPtr pExaScr; +-#ifdef RENDER + PictureScreenPtr ps; +-#endif + + if (!pScreenInfo) + return FALSE; +@@ -882,11 +887,9 @@ exaDriverInit (ScreenPtr pScreen, + pScreenInfo->maxPitchPixels = pScreenInfo->maxX; + } + +-#ifdef RENDER + ps = GetPictureScreenIfSet(pScreen); +-#endif + +- pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1); ++ pExaScr = calloc(sizeof (ExaScreenPrivRec), 1); + if (!pExaScr) { + LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n", + pScreen->myNum); +@@ -912,10 +915,12 @@ exaDriverInit (ScreenPtr pScreen, + * Replace various fb screen functions + */ + if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) && +- !(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) { ++ (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) || ++ (pExaScr->info->flags & EXA_MIXED_PIXMAPS))) + wrap(pExaScr, pScreen, BlockHandler, ExaBlockHandler); ++ if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) && ++ !(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) + wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler); +- } + wrap(pExaScr, pScreen, CreateGC, exaCreateGC); + wrap(pExaScr, pScreen, CloseScreen, exaCloseScreen); + wrap(pExaScr, pScreen, GetImage, exaGetImage); +@@ -925,16 +930,17 @@ exaDriverInit (ScreenPtr pScreen, + wrap(pExaScr, pScreen, BitmapToRegion, exaBitmapToRegion); + wrap(pExaScr, pScreen, CreateScreenResources, exaCreateScreenResources); + +-#ifdef RENDER + if (ps) { + wrap(pExaScr, ps, Composite, exaComposite); +- if (pScreenInfo->PrepareComposite) ++ if (pScreenInfo->PrepareComposite) { + wrap(pExaScr, ps, Glyphs, exaGlyphs); ++ } else { ++ wrap(pExaScr, ps, Glyphs, ExaCheckGlyphs); ++ } + wrap(pExaScr, ps, Trapezoids, exaTrapezoids); + wrap(pExaScr, ps, Triangles, exaTriangles); + wrap(pExaScr, ps, AddTraps, ExaCheckAddTraps); + } +-#endif + + #ifdef MITSHM + /* +@@ -959,32 +965,29 @@ exaDriverInit (ScreenPtr pScreen, + wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed); + wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_mixed); + pExaScr->do_migration = exaDoMigration_mixed; +- pExaScr->pixmap_is_offscreen = exaPixmapIsOffscreen_mixed; ++ pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_mixed; + pExaScr->do_move_in_pixmap = exaMoveInPixmap_mixed; + pExaScr->do_move_out_pixmap = NULL; + pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed; +- pExaScr->finish_access = exaFinishAccess_mixed; + } else { + wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver); + wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver); + wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_driver); + pExaScr->do_migration = NULL; +- pExaScr->pixmap_is_offscreen = exaPixmapIsOffscreen_driver; ++ pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_driver; + pExaScr->do_move_in_pixmap = NULL; + pExaScr->do_move_out_pixmap = NULL; + pExaScr->prepare_access_reg = NULL; +- pExaScr->finish_access = NULL; + } + } else { + wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic); + wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic); + wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_classic); + pExaScr->do_migration = exaDoMigration_classic; +- pExaScr->pixmap_is_offscreen = exaPixmapIsOffscreen_classic; ++ pExaScr->pixmap_has_gpu_copy = exaPixmapHasGpuCopy_classic; + pExaScr->do_move_in_pixmap = exaMoveInPixmap_classic; + pExaScr->do_move_out_pixmap = exaMoveOutPixmap_classic; + pExaScr->prepare_access_reg = exaPrepareAccessReg_classic; +- pExaScr->finish_access = NULL; + } + if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) { + LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %lu bytes\n", +diff --git a/exa/exa.h b/exa/exa.h +index 4b39473..8c93d15 100644 +--- a/exa/exa.h ++++ b/exa/exa.h +@@ -624,13 +624,13 @@ typedef struct _ExaDriver { + + /** + * PixmapIsOffscreen() is an optional driver replacement to +- * exaPixmapIsOffscreen(). Set to NULL if you want the standard behaviour +- * of exaPixmapIsOffscreen(). ++ * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour ++ * of exaPixmapHasGpuCopy(). + * + * @param pPix the pixmap + * @return TRUE if the given drawable is in framebuffer memory. + * +- * exaPixmapIsOffscreen() is used to determine if a pixmap is in offscreen ++ * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen + * memory, meaning that acceleration could probably be done to it, and that it + * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it + * with the CPU. +diff --git a/exa/exa_accel.c b/exa/exa_accel.c +index d4eae89..4164ff7 100644 +--- a/exa/exa_accel.c ++++ b/exa/exa_accel.c +@@ -157,6 +157,10 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, + if (pExaScr->fallback_counter || pExaPixmap->accel_blocked || !pExaScr->info->UploadToScreen) + return FALSE; + ++ /* If there's a system copy, we want to save the result there */ ++ if (pExaPixmap->pDamage) ++ return FALSE; ++ + /* Don't bother with under 8bpp, XYPixmaps. */ + if (format != ZPixmap || bpp < 8) + return FALSE; +@@ -390,7 +394,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable, + exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y); + exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y); + +- rects = xalloc(nbox * sizeof(xRectangle)); ++ rects = malloc(nbox * sizeof(xRectangle)); + + if (rects) { + int i; +@@ -413,7 +417,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable, + ordering = CT_UNSORTED; + + srcregion = RECTS_TO_REGION(pScreen, nbox, rects, ordering); +- xfree(rects); ++ free(rects); + + if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask, + pGC->fillStyle, pGC->alu, +@@ -482,9 +486,9 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable, + goto fallback; + } + +- if (exaPixmapIsOffscreen(pDstPixmap)) { ++ if (exaPixmapHasGpuCopy(pDstPixmap)) { + /* Normal blitting. */ +- if (exaPixmapIsOffscreen(pSrcPixmap)) { ++ if (exaPixmapHasGpuCopy(pSrcPixmap)) { + if (!(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, reverse ? -1 : 1, + upsidedown ? -1 : 1, + pGC ? pGC->alu : GXcopy, +@@ -504,8 +508,11 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable, + + (*pExaScr->info->DoneCopy) (pDstPixmap); + exaMarkSync (pDstDrawable->pScreen); +- /* UTS: mainly for SHM PutImage's secondary path. */ +- } else if (pSrcExaPixmap->sys_ptr) { ++ /* UTS: mainly for SHM PutImage's secondary path. ++ * ++ * Only taking this path for directly accessible pixmaps. ++ */ ++ } else if (!pDstExaPixmap->pDamage && pSrcExaPixmap->sys_ptr) { + int bpp = pSrcDrawable->bitsPerPixel; + int src_stride = exaGetPixmapPitch(pSrcPixmap); + CARD8 *src = NULL; +@@ -619,7 +626,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + return; + } + +- prect = xalloc(sizeof(xRectangle) * npt); ++ prect = malloc(sizeof(xRectangle) * npt); + for (i = 0; i < npt; i++) { + prect[i].x = ppt[i].x; + prect[i].y = ppt[i].y; +@@ -631,7 +638,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + prect[i].height = 1; + } + pGC->ops->PolyFillRect(pDrawable, pGC, npt, prect); +- xfree(prect); ++ free(prect); + } + + /** +@@ -660,7 +667,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + return; + } + +- prect = xalloc(sizeof(xRectangle) * (npt - 1)); ++ prect = malloc(sizeof(xRectangle) * (npt - 1)); + x1 = ppt[0].x; + y1 = ppt[0].y; + /* If we have any non-horizontal/vertical, fall back. */ +@@ -674,7 +681,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + } + + if (x1 != x2 && y1 != y2) { +- xfree(prect); ++ free(prect); + ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt); + return; + } +@@ -698,7 +705,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + y1 = y2; + } + pGC->ops->PolyFillRect(pDrawable, pGC, npt - 1, prect); +- xfree(prect); ++ free(prect); + } + + /** +@@ -730,7 +737,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, + } + } + +- prect = xalloc(sizeof(xRectangle) * nseg); ++ prect = malloc(sizeof(xRectangle) * nseg); + for (i = 0; i < nseg; i++) { + if (pSeg[i].x1 < pSeg[i].x2) { + prect[i].x = pSeg[i].x1; +@@ -756,7 +763,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, + } + } + pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect); +- xfree(prect); ++ free(prect); + } + + static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, +@@ -835,7 +842,7 @@ exaPolyFillRect(DrawablePtr pDrawable, + exaDoMigration (pixmaps, 1, TRUE); + } + +- if (!exaPixmapIsOffscreen (pPixmap) || ++ if (!exaPixmapHasGpuCopy (pPixmap) || + !(*pExaScr->info->PrepareSolid) (pPixmap, + pGC->alu, + pGC->planemask, +@@ -1017,7 +1024,7 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel, + exaDoMigration (pixmaps, 1, TRUE); + } + +- if (exaPixmapIsOffscreen (pPixmap) && ++ if (exaPixmapHasGpuCopy (pPixmap) && + (*pExaScr->info->PrepareSolid) (pPixmap, alu, planemask, pixel)) + { + int nbox; +@@ -1040,6 +1047,7 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel, + pDrawable->width == 1 && pDrawable->height == 1 && + pDrawable->bitsPerPixel != 24) { + ExaPixmapPriv(pPixmap); ++ RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage); + + switch (pDrawable->bitsPerPixel) { + case 32: +@@ -1054,6 +1062,9 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel, + + REGION_UNION(pScreen, &pExaPixmap->validSys, &pExaPixmap->validSys, + pRegion); ++ REGION_UNION(pScreen, &pExaPixmap->validFB, &pExaPixmap->validFB, ++ pRegion); ++ REGION_SUBTRACT(pScreen, pending_damage, pending_damage, pRegion); + } + + ret = TRUE; +@@ -1120,7 +1131,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile, + + pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); + +- if (!pPixmap || !exaPixmapIsOffscreen(pTile)) ++ if (!pPixmap || !exaPixmapHasGpuCopy(pTile)) + return FALSE; + + if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 1, 1, alu, planemask)) +@@ -1254,35 +1265,16 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h, + { + ExaScreenPriv (pDrawable->pScreen); + PixmapPtr pPix = exaGetDrawablePixmap (pDrawable); ++ ExaPixmapPriv(pPix); + int xoff, yoff; + Bool ok; + + if (pExaScr->fallback_counter || pExaScr->swappedOut) + goto fallback; + +- exaGetDrawableDeltas (pDrawable, pPix, &xoff, &yoff); +- +- if (pExaScr->do_migration) { +- BoxRec Box; +- RegionRec Reg; +- ExaMigrationRec pixmaps[1]; +- +- Box.x1 = pDrawable->y + x + xoff; +- Box.y1 = pDrawable->y + y + yoff; +- Box.x2 = Box.x1 + w; +- Box.y2 = Box.y1 + h; +- +- REGION_INIT(pScreen, &Reg, &Box, 1); +- +- pixmaps[0].as_dst = FALSE; +- pixmaps[0].as_src = TRUE; +- pixmaps[0].pPix = pPix; +- pixmaps[0].pReg = &Reg; +- +- exaDoMigration(pixmaps, 1, FALSE); +- +- REGION_UNINIT(pScreen, &Reg); +- } ++ /* If there's a system copy, we want to save the result there */ ++ if (pExaPixmap->pDamage) ++ goto fallback; + + pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); + +diff --git a/exa/exa_classic.c b/exa/exa_classic.c +index 12f3987..e1ead6c 100644 +--- a/exa/exa_classic.c ++++ b/exa/exa_classic.c +@@ -38,7 +38,7 @@ ExaGetPixmapAddress(PixmapPtr p) + { + ExaPixmapPriv(p); + +- if (pExaPixmap->offscreen && pExaPixmap->fb_ptr) ++ if (pExaPixmap->use_gpu_copy && pExaPixmap->fb_ptr) + return pExaPixmap->fb_ptr; + else + return pExaPixmap->sys_ptr; +@@ -90,7 +90,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, + pExaPixmap->sys_pitch = pPixmap->devKind; + + pPixmap->devPrivate.ptr = NULL; +- pExaPixmap->offscreen = FALSE; ++ pExaPixmap->use_gpu_copy = FALSE; + + pExaPixmap->fb_ptr = NULL; + exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp); +@@ -148,7 +148,7 @@ Bool + exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData) + { +- ScreenPtr pScreen = pPixmap->drawable.pScreen; ++ ScreenPtr pScreen; + ExaScreenPrivPtr pExaScr; + ExaPixmapPrivPtr pExaPixmap; + Bool ret; +@@ -156,6 +156,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept + if (!pPixmap) + return FALSE; + ++ pScreen = pPixmap->drawable.pScreen; + pExaScr = ExaGetScreenPriv(pScreen); + pExaPixmap = ExaGetPixmapPriv(pPixmap); + +@@ -168,7 +169,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept + + /* Classic EXA: + * - Framebuffer. +- * - Scratch pixmap with offscreen memory. ++ * - Scratch pixmap with gpu memory. + */ + if (pExaScr->info->memoryBase && pPixData) { + if ((CARD8 *)pPixData >= pExaScr->info->memoryBase && +@@ -176,7 +177,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept + pExaScr->info->memorySize) { + pExaPixmap->fb_ptr = pPixData; + pExaPixmap->fb_pitch = devKind; +- pExaPixmap->offscreen = TRUE; ++ pExaPixmap->use_gpu_copy = TRUE; + } + } + +@@ -189,7 +190,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int dept + } + + /* Pixmaps subject to ModifyPixmapHeader will be pinned to system or +- * offscreen memory, so there's no need to track damage. ++ * gpu memory, so there's no need to track damage. + */ + if (pExaPixmap->pDamage) { + DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); +@@ -248,7 +249,7 @@ exaDestroyPixmap_classic (PixmapPtr pPixmap) + } + + Bool +-exaPixmapIsOffscreen_classic(PixmapPtr pPixmap) ++exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap) + { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + ExaScreenPriv(pScreen); +@@ -260,7 +261,7 @@ exaPixmapIsOffscreen_classic(PixmapPtr pPixmap) + ret = pExaScr->info->PixmapIsOffscreen(pPixmap); + pPixmap->devPrivate.ptr = NULL; + } else +- ret = (pExaPixmap->offscreen && pExaPixmap->fb_ptr); ++ ret = (pExaPixmap->use_gpu_copy && pExaPixmap->fb_ptr); + + return ret; + } +diff --git a/exa/exa_driver.c b/exa/exa_driver.c +index f55c300..abe79ba 100644 +--- a/exa/exa_driver.c ++++ b/exa/exa_driver.c +@@ -71,8 +71,8 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, + + bpp = pPixmap->drawable.bitsPerPixel; + +- /* Set this before driver hooks, to allow for !offscreen pixmaps. +- * !offscreen pixmaps have a valid pointer at all times. ++ /* Set this before driver hooks, to allow for driver pixmaps without gpu ++ * memory to back it. These pixmaps have a valid pointer at all times. + */ + pPixmap->devPrivate.ptr = NULL; + +@@ -126,7 +126,7 @@ Bool + exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData) + { +- ScreenPtr pScreen = pPixmap->drawable.pScreen; ++ ScreenPtr pScreen; + ExaScreenPrivPtr pExaScr; + ExaPixmapPrivPtr pExaPixmap; + Bool ret; +@@ -134,6 +134,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth + if (!pPixmap) + return FALSE; + ++ pScreen = pPixmap->drawable.pScreen; + pExaScr = ExaGetScreenPriv(pScreen); + pExaPixmap = ExaGetPixmapPriv(pPixmap); + +@@ -157,8 +158,9 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth + ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth, + bitsPerPixel, devKind, pPixData); + /* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL. +- * If pPixmap->devPrivate.ptr is non-NULL, then we've got a non-offscreen pixmap. +- * We need to store the pointer, because PrepareAccess won't be called. ++ * If pPixmap->devPrivate.ptr is non-NULL, then we've got a ++ * !has_gpu_copy pixmap. We need to store the pointer, ++ * because PrepareAccess won't be called. + */ + if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) { + pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr; +@@ -208,7 +210,7 @@ exaDestroyPixmap_driver (PixmapPtr pPixmap) + } + + Bool +-exaPixmapIsOffscreen_driver(PixmapPtr pPixmap) ++exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap) + { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + ExaScreenPriv(pScreen); +diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c +index bf097c3..b09db46 100644 +--- a/exa/exa_glyphs.c ++++ b/exa/exa_glyphs.c +@@ -128,12 +128,12 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen, + } + + if (cache->hashEntries) { +- xfree(cache->hashEntries); ++ free(cache->hashEntries); + cache->hashEntries = NULL; + } + + if (cache->glyphs) { +- xfree(cache->glyphs); ++ free(cache->glyphs); + cache->glyphs = NULL; + } + cache->glyphCount = 0; +@@ -213,8 +213,8 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, + + cache->picture = pPicture; + cache->picture->refcnt++; +- cache->hashEntries = xalloc(sizeof(int) * cache->hashSize); +- cache->glyphs = xalloc(sizeof(ExaCachedGlyphRec) * cache->size); ++ cache->hashEntries = malloc(sizeof(int) * cache->hashSize); ++ cache->glyphs = malloc(sizeof(ExaCachedGlyphRec) * cache->size); + cache->glyphCount = 0; + + if (!cache->hashEntries || !cache->glyphs) +@@ -352,11 +352,11 @@ exaGlyphCacheHashRemove(ExaGlyphCachePtr cache, + + /* The most efficient thing to way to upload the glyph to the screen + * is to use the UploadToScreen() driver hook; this allows us to +- * pipeline glyph uploads and to avoid creating offscreen pixmaps for ++ * pipeline glyph uploads and to avoid creating gpu backed pixmaps for + * glyphs that we'll never use again. + * +- * If we can't do it with UploadToScreen (because the glyph is offscreen, etc), +- * we fall back to CompositePicture. ++ * If we can't do it with UploadToScreen (because the glyph has a gpu copy, ++ * etc), we fall back to CompositePicture. + * + * We need to damage the cache pixmap manually in either case because the damage + * layer unwrapped the picture screen before calling exaGlyphs. +@@ -364,7 +364,8 @@ exaGlyphCacheHashRemove(ExaGlyphCachePtr cache, + static void + exaGlyphCacheUploadGlyph(ScreenPtr pScreen, + ExaGlyphCachePtr cache, +- int pos, ++ int x, ++ int y, + GlyphPtr pGlyph) + { + ExaScreenPriv(pScreen); +@@ -378,7 +379,7 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen, + + /* If the glyph pixmap is already uploaded, no point in doing + * things this way */ +- if (exaPixmapIsOffscreen(pGlyphPixmap)) ++ if (exaPixmapHasGpuCopy(pGlyphPixmap)) + goto composite; + + /* UploadToScreen only works if bpp match */ +@@ -388,7 +389,7 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen, + if (pExaScr->do_migration) { + ExaMigrationRec pixmaps[1]; + +- /* cache pixmap must be offscreen. */ ++ /* cache pixmap must have a gpu copy. */ + pixmaps[0].as_dst = TRUE; + pixmaps[0].as_src = FALSE; + pixmaps[0].pPix = pCachePixmap; +@@ -396,13 +397,13 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen, + exaDoMigration (pixmaps, 1, TRUE); + } + +- if (!exaPixmapIsOffscreen(pCachePixmap)) ++ if (!exaPixmapHasGpuCopy(pCachePixmap)) + goto composite; + +- /* CACHE_{X,Y} are in pixmap coordinates, no need for cache{X,Y}off */ ++ /* x,y are in pixmap coordinates, no need for cache{X,Y}off */ + if (pExaScr->info->UploadToScreen(pCachePixmap, +- CACHE_X(pos), +- CACHE_Y(pos), ++ x, ++ y, + pGlyph->info.width, + pGlyph->info.height, + (char *)pExaPixmap->sys_ptr, +@@ -416,18 +417,18 @@ composite: + cache->picture, + 0, 0, + 0, 0, +- CACHE_X(pos), +- CACHE_Y(pos), ++ x, ++ y, + pGlyph->info.width, + pGlyph->info.height); + + damage: + /* The cache pixmap isn't a window, so no need to offset coordinates. */ + exaPixmapDirty (pCachePixmap, +- CACHE_X(pos), +- CACHE_Y(pos), +- CACHE_X(pos) + cache->glyphWidth, +- CACHE_Y(pos) + cache->glyphHeight); ++ x, ++ y, ++ x + cache->glyphWidth, ++ y + cache->glyphHeight); + } + + static ExaGlyphCacheResult +@@ -446,6 +447,7 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, + { + ExaCompositeRectPtr rect; + int pos; ++ int x, y; + + if (buffer->mask && buffer->mask != cache->picture) + return ExaGlyphNeedFlush; +@@ -462,10 +464,14 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, + pos = exaGlyphCacheHashLookup(cache, pGlyph); + if (pos != -1) { + DBG_GLYPH_CACHE((" found existing glyph at %d\n", pos)); ++ x = CACHE_X(pos); ++ y = CACHE_Y(pos); + } else { + if (cache->glyphCount < cache->size) { + /* Space remaining; we fill from the start */ + pos = cache->glyphCount; ++ x = CACHE_X(pos); ++ y = CACHE_Y(pos); + cache->glyphCount++; + DBG_GLYPH_CACHE((" storing glyph in free space at %d\n", pos)); + +@@ -477,14 +483,12 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, + * the cache + */ + pos = cache->evictionPosition; ++ x = CACHE_X(pos); ++ y = CACHE_Y(pos); + DBG_GLYPH_CACHE((" evicting glyph at %d\n", pos)); + if (buffer->count) { +- int x, y; + int i; + +- x = CACHE_X(pos); +- y = CACHE_Y(pos); +- + for (i = 0; i < buffer->count; i++) { + if (pSrc ? + (buffer->rects[i].xMask == x && buffer->rects[i].yMask == y) : +@@ -503,7 +507,7 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, + cache->evictionPosition = rand() % cache->size; + } + +- exaGlyphCacheUploadGlyph(pScreen, cache, pos, pGlyph); ++ exaGlyphCacheUploadGlyph(pScreen, cache, x, y, pGlyph); + } + + buffer->mask = cache->picture; +@@ -514,13 +518,13 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, + { + rect->xSrc = xSrc; + rect->ySrc = ySrc; +- rect->xMask = CACHE_X(pos); +- rect->yMask = CACHE_Y(pos); ++ rect->xMask = x; ++ rect->yMask = y; + } + else + { +- rect->xSrc = CACHE_X(pos); +- rect->ySrc = CACHE_Y(pos); ++ rect->xSrc = x; ++ rect->ySrc = y; + rect->xMask = 0; + rect->yMask = 0; + } +diff --git a/exa/exa_migration_classic.c b/exa/exa_migration_classic.c +index 6d7b9f5..871679f 100644 +--- a/exa/exa_migration_classic.c ++++ b/exa/exa_migration_classic.c +@@ -75,6 +75,9 @@ exaPixmapIsDirty (PixmapPtr pPix) + if (pExaPixmap == NULL) + EXA_FatalErrorDebugWithRet(("EXA bug: exaPixmapIsDirty was called on a non-exa pixmap.\n"), TRUE); + ++ if (!pExaPixmap->pDamage) ++ return FALSE; ++ + return REGION_NOTEMPTY (pScreen, DamageRegion(pExaPixmap->pDamage)) || + !REGION_EQUAL(pScreen, &pExaPixmap->validSys, &pExaPixmap->validFB); + } +@@ -111,7 +114,7 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc, + ExaPixmapPriv (pPixmap); + RegionPtr damage = DamageRegion (pExaPixmap->pDamage); + RegionRec CopyReg; +- Bool save_offscreen; ++ Bool save_use_gpu_copy; + int save_pitch; + BoxPtr pBox; + int nbox; +@@ -119,7 +122,7 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc, + Bool need_sync = FALSE; + + /* Damaged bits are valid in current copy but invalid in other one */ +- if (pExaPixmap->offscreen) { ++ if (pExaPixmap->use_gpu_copy) { + REGION_UNION(pScreen, &pExaPixmap->validFB, &pExaPixmap->validFB, + damage); + REGION_SUBTRACT(pScreen, &pExaPixmap->validSys, &pExaPixmap->validSys, +@@ -200,9 +203,9 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc, + pBox = REGION_RECTS(&CopyReg); + nbox = REGION_NUM_RECTS(&CopyReg); + +- save_offscreen = pExaPixmap->offscreen; ++ save_use_gpu_copy = pExaPixmap->use_gpu_copy; + save_pitch = pPixmap->devKind; +- pExaPixmap->offscreen = TRUE; ++ pExaPixmap->use_gpu_copy = TRUE; + pPixmap->devKind = pExaPixmap->fb_pitch; + + while (nbox--) { +@@ -242,7 +245,7 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc, + pBox++; + } + +- pExaPixmap->offscreen = save_offscreen; ++ pExaPixmap->use_gpu_copy = save_use_gpu_copy; + pPixmap->devKind = save_pitch; + + /* Try to prevent source valid region from growing too many rects by +@@ -351,7 +354,7 @@ exaDoMoveInPixmap (ExaMigrationPtr migrate) + + exaCopyDirtyToFb (migrate); + +- if (exaPixmapIsOffscreen(pPixmap)) ++ if (exaPixmapHasGpuCopy(pPixmap)) + return; + + DBG_MIGRATE (("-> %p (0x%x) (%dx%d) (%c)\n", pPixmap, +@@ -361,7 +364,7 @@ exaDoMoveInPixmap (ExaMigrationPtr migrate) + pPixmap->drawable.height, + exaPixmapIsDirty(pPixmap) ? 'd' : 'c')); + +- pExaPixmap->offscreen = TRUE; ++ pExaPixmap->use_gpu_copy = TRUE; + + pPixmap->devKind = pExaPixmap->fb_pitch; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; +@@ -392,7 +395,7 @@ exaDoMoveOutPixmap (ExaMigrationPtr migrate) + + exaCopyDirtyToSys (migrate); + +- if (exaPixmapIsOffscreen(pPixmap)) { ++ if (exaPixmapHasGpuCopy(pPixmap)) { + + DBG_MIGRATE (("<- %p (%p) (%dx%d) (%c)\n", pPixmap, + (void*)(ExaGetPixmapPriv(pPixmap)->area ? +@@ -401,7 +404,7 @@ exaDoMoveOutPixmap (ExaMigrationPtr migrate) + pPixmap->drawable.height, + exaPixmapIsDirty(pPixmap) ? 'd' : 'c')); + +- pExaPixmap->offscreen = FALSE; ++ pExaPixmap->use_gpu_copy = FALSE; + + pPixmap->devKind = pExaPixmap->sys_pitch; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; +@@ -468,12 +471,12 @@ exaMigrateTowardFb (ExaMigrationPtr migrate) + pExaPixmap->score++; + + if (pExaPixmap->score >= EXA_PIXMAP_SCORE_MOVE_IN && +- !exaPixmapIsOffscreen(pPixmap)) ++ !exaPixmapHasGpuCopy(pPixmap)) + { + exaDoMoveInPixmap(migrate); + } + +- if (exaPixmapIsOffscreen(pPixmap)) { ++ if (exaPixmapHasGpuCopy(pPixmap)) { + exaCopyDirtyToFb (migrate); + ExaOffscreenMarkUsed (pPixmap); + } else +@@ -504,7 +507,7 @@ exaMigrateTowardSys (ExaMigrationPtr migrate) + if (pExaPixmap->score <= EXA_PIXMAP_SCORE_MOVE_OUT && pExaPixmap->area) + exaDoMoveOutPixmap(migrate); + +- if (exaPixmapIsOffscreen(pPixmap)) { ++ if (exaPixmapHasGpuCopy(pPixmap)) { + exaCopyDirtyToFb (migrate); + ExaOffscreenMarkUsed (pPixmap); + } else +@@ -523,7 +526,7 @@ exaAssertNotDirty (PixmapPtr pPixmap) + RegionRec ValidReg; + int dst_pitch, src_pitch, cpp, y, nbox, save_pitch; + BoxPtr pBox; +- Bool ret = TRUE, save_offscreen; ++ Bool ret = TRUE, save_use_gpu_copy; + + if (exaPixmapIsPinned(pPixmap) || pExaPixmap->area == NULL) + return ret; +@@ -542,9 +545,9 @@ exaAssertNotDirty (PixmapPtr pPixmap) + src_pitch = pExaPixmap->fb_pitch; + cpp = pPixmap->drawable.bitsPerPixel / 8; + +- save_offscreen = pExaPixmap->offscreen; ++ save_use_gpu_copy = pExaPixmap->use_gpu_copy; + save_pitch = pPixmap->devKind; +- pExaPixmap->offscreen = TRUE; ++ pExaPixmap->use_gpu_copy = TRUE; + pPixmap->devKind = pExaPixmap->fb_pitch; + + if (!ExaDoPrepareAccess(pPixmap, EXA_PREPARE_SRC)) +@@ -579,7 +582,7 @@ exaAssertNotDirty (PixmapPtr pPixmap) + skip: + exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); + +- pExaPixmap->offscreen = save_offscreen; ++ pExaPixmap->use_gpu_copy = save_use_gpu_copy; + pPixmap->devKind = save_pitch; + + out: +@@ -618,7 +621,7 @@ exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel) + */ + for (i = 0; i < npixmaps; i++) { + if (exaPixmapIsPinned (pixmaps[i].pPix) && +- !exaPixmapIsOffscreen (pixmaps[i].pPix)) ++ !exaPixmapHasGpuCopy (pixmaps[i].pPix)) + { + EXA_FALLBACK(("Pixmap %p (%dx%d) pinned in sys\n", pixmaps[i].pPix, + pixmaps[i].pPix->drawable.width, +@@ -680,7 +683,7 @@ exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel) + } + + for (i = 0; i < npixmaps; i++) { +- if (exaPixmapIsOffscreen(pixmaps[i].pPix)) { ++ if (exaPixmapHasGpuCopy(pixmaps[i].pPix)) { + /* Found one in FB, so move all to FB. */ + for (j = 0; j < npixmaps; j++) + exaMigrateTowardFb(pixmaps + i); +@@ -709,12 +712,12 @@ exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel) + + /* If we couldn't fit everything in, abort */ + for (i = 0; i < npixmaps; i++) { +- if (!exaPixmapIsOffscreen(pixmaps[i].pPix)) { ++ if (!exaPixmapHasGpuCopy(pixmaps[i].pPix)) { + return; + } + } + +- /* Yay, everything's offscreen, mark memory as used */ ++ /* Yay, everything has a gpu copy, mark memory as used */ + for (i = 0; i < npixmaps; i++) { + ExaOffscreenMarkUsed (pixmaps[i].pPix); + } +diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c +index 52b18b4..fb47151 100644 +--- a/exa/exa_migration_mixed.c ++++ b/exa/exa_migration_mixed.c +@@ -80,7 +80,7 @@ exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel) + */ + for (i = 0; i < npixmaps; i++) { + if (exaPixmapIsPinned (pixmaps[i].pPix) && +- !exaPixmapIsOffscreen (pixmaps[i].pPix)) ++ !exaPixmapHasGpuCopy (pixmaps[i].pPix)) + { + can_accel = FALSE; + break; +@@ -98,12 +98,26 @@ exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel) + if (!pExaPixmap->driverPriv) + exaCreateDriverPixmap_mixed(pPixmap); + +- if (pExaPixmap->pDamage && exaPixmapIsOffscreen(pPixmap)) { ++ if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) { ++ ExaScreenPriv(pPixmap->drawable.pScreen); ++ ++ /* This pitch is needed for proper acceleration. For some reason ++ * there are pixmaps without pDamage and a bad fb_pitch value. ++ * So setting devKind when only exaPixmapHasGpuCopy() is true ++ * causes corruption. Pixmaps without pDamage are not migrated ++ * and should have a valid devKind at all times, so that's why this ++ * isn't causing problems. Pixmaps have their gpu pitch set the ++ * first time in the MPH call from exaCreateDriverPixmap_mixed(). ++ */ + pPixmap->devKind = pExaPixmap->fb_pitch; + exaCopyDirtyToFb(pixmaps + i); ++ ++ if (pExaScr->deferred_mixed_pixmap == pPixmap && ++ !pixmaps[i].as_dst && !pixmaps[i].pReg) ++ pExaScr->deferred_mixed_pixmap = NULL; + } + +- pExaPixmap->offscreen = exaPixmapIsOffscreen(pPixmap); ++ pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap); + } + } + +@@ -120,17 +134,68 @@ exaMoveInPixmap_mixed(PixmapPtr pPixmap) + exaDoMigration(pixmaps, 1, TRUE); + } + ++void ++exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure) ++{ ++ PixmapPtr pPixmap = closure; ++ ExaPixmapPriv(pPixmap); ++ ++ /* Move back results of software rendering on system memory copy of mixed driver ++ * pixmap (see exaPrepareAccessReg_mixed). ++ * ++ * Defer moving the destination back into the driver pixmap, to try and save ++ * overhead on multiple subsequent software fallbacks. ++ */ ++ if (!pExaPixmap->use_gpu_copy && exaPixmapHasGpuCopy(pPixmap)) { ++ ExaScreenPriv(pPixmap->drawable.pScreen); ++ ++ if (pExaScr->deferred_mixed_pixmap && ++ pExaScr->deferred_mixed_pixmap != pPixmap) ++ exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap); ++ pExaScr->deferred_mixed_pixmap = pPixmap; ++ } ++} ++ + /* With mixed pixmaps, if we fail to get direct access to the driver pixmap, we + * use the DownloadFromScreen hook to retrieve contents to a copy in system + * memory, perform software rendering on that and move back the results with the +- * UploadToScreen hook (see exaFinishAccess_mixed). ++ * UploadToScreen hook (see exaDamageReport_mixed). + */ + void + exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg) + { +- if (!ExaDoPrepareAccess(pPixmap, index)) { +- ExaPixmapPriv(pPixmap); +- Bool is_offscreen = exaPixmapIsOffscreen(pPixmap); ++ ExaPixmapPriv(pPixmap); ++ Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap); ++ Bool success; ++ ++ success = ExaDoPrepareAccess(pPixmap, index); ++ ++ if (success && has_gpu_copy && pExaPixmap->pDamage) { ++ /* You cannot do accelerated operations while a buffer is mapped. */ ++ exaFinishAccess(&pPixmap->drawable, index); ++ /* Update the gpu view of both deferred destination pixmaps and of ++ * source pixmaps that were migrated with a bounding region. ++ */ ++ exaMoveInPixmap_mixed(pPixmap); ++ success = ExaDoPrepareAccess(pPixmap, index); ++ ++ if (success) { ++ /* We have a gpu pixmap that can be accessed, we don't need the cpu ++ * copy anymore. Drivers that prefer DFS, should fail prepare ++ * access. ++ */ ++ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); ++ DamageDestroy(pExaPixmap->pDamage); ++ pExaPixmap->pDamage = NULL; ++ ++ free(pExaPixmap->sys_ptr); ++ pExaPixmap->sys_ptr = NULL; ++ ++ return; ++ } ++ } ++ ++ if (!success) { + ExaMigrationRec pixmaps[1]; + + /* Do we need to allocate our system buffer? */ +@@ -152,12 +217,14 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg) + pixmaps[0].pPix = pPixmap; + pixmaps[0].pReg = pReg; + +- if (!pExaPixmap->pDamage && (is_offscreen || !exaPixmapIsPinned(pPixmap))) { ++ if (!pExaPixmap->pDamage && ++ (has_gpu_copy || !exaPixmapIsPinned(pPixmap))) { + Bool as_dst = pixmaps[0].as_dst; + + /* Set up damage tracking */ +- pExaPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone, +- TRUE, pPixmap->drawable.pScreen, ++ pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL, ++ DamageReportNonEmpty, TRUE, ++ pPixmap->drawable.pScreen, + pPixmap); + + DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage); +@@ -165,7 +232,7 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg) + /* This is used by exa to optimize migration. */ + DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE); + +- if (is_offscreen) { ++ if (has_gpu_copy) { + exaPixmapDirty(pPixmap, 0, 0, pPixmap->drawable.width, + pPixmap->drawable.height); + +@@ -177,34 +244,18 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg) + pixmaps[0].as_src = TRUE; + pixmaps[0].pReg = NULL; + } +- pPixmap->devKind = pExaPixmap->fb_pitch; + exaCopyDirtyToSys(pixmaps); + } + + if (as_dst) + exaPixmapDirty(pPixmap, 0, 0, pPixmap->drawable.width, + pPixmap->drawable.height); +- } else if (is_offscreen) { +- pPixmap->devKind = pExaPixmap->fb_pitch; ++ } else if (has_gpu_copy) + exaCopyDirtyToSys(pixmaps); +- } + + pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr; + pPixmap->devKind = pExaPixmap->sys_pitch; +- pExaPixmap->offscreen = FALSE; ++ pExaPixmap->use_gpu_copy = FALSE; + } + } + +-/* Move back results of software rendering on system memory copy of mixed driver +- * pixmap (see exaPrepareAccessReg_mixed). +- */ +-void exaFinishAccess_mixed(PixmapPtr pPixmap, int index) +-{ +- ExaPixmapPriv(pPixmap); +- +- if (pExaPixmap->pDamage && exaPixmapIsOffscreen(pPixmap) && +- !pExaPixmap->offscreen) { +- DamageRegionProcessPending(&pPixmap->drawable); +- exaMoveInPixmap_mixed(pPixmap); +- } +-} +diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c +index 47adad7..49e04f2 100644 +--- a/exa/exa_mixed.c ++++ b/exa/exa_mixed.c +@@ -93,9 +93,25 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, + /* A scratch pixmap will become a driver pixmap right away. */ + if (!w || !h) { + exaCreateDriverPixmap_mixed(pPixmap); +- pExaPixmap->offscreen = exaPixmapIsOffscreen(pPixmap); +- } else +- pExaPixmap->offscreen = FALSE; ++ pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap); ++ } else { ++ pExaPixmap->use_gpu_copy = FALSE; ++ ++ if (w == 1 && h == 1) { ++ pExaPixmap->sys_ptr = malloc((pPixmap->drawable.bitsPerPixel + 7) / 8); ++ ++ /* Set up damage tracking */ ++ pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL, ++ DamageReportNonEmpty, TRUE, ++ pPixmap->drawable.pScreen, ++ pPixmap); ++ ++ DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage); ++ /* This ensures that pending damage reflects the current operation. */ ++ /* This is used by exa to optimize migration. */ ++ DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE); ++ } ++ } + + /* During a fallback we must prepare access. */ + if (pExaScr->fallback_counter) +@@ -108,14 +124,15 @@ Bool + exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData) + { +- ScreenPtr pScreen = pPixmap->drawable.pScreen; ++ ScreenPtr pScreen; + ExaScreenPrivPtr pExaScr; + ExaPixmapPrivPtr pExaPixmap; +- Bool ret, is_offscreen; ++ Bool ret, has_gpu_copy; + + if (!pPixmap) + return FALSE; + ++ pScreen = pPixmap->drawable.pScreen; + pExaScr = ExaGetScreenPriv(pScreen); + pExaPixmap = ExaGetPixmapPriv(pPixmap); + +@@ -131,22 +148,58 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, + pExaPixmap->driverPriv = NULL; + } + +- pExaPixmap->offscreen = FALSE; ++ pExaPixmap->use_gpu_copy = FALSE; + pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED; + } + +- if (pExaPixmap->driverPriv) { +- if (width > 0 && height > 0 && bitsPerPixel > 0) { ++ has_gpu_copy = exaPixmapHasGpuCopy(pPixmap); ++ ++ if (width <= 0) ++ width = pPixmap->drawable.width; ++ ++ if (height <= 0) ++ height = pPixmap->drawable.height; ++ ++ if (bitsPerPixel <= 0) { ++ if (depth <= 0) ++ bitsPerPixel = pPixmap->drawable.bitsPerPixel; ++ else ++ bitsPerPixel = BitsPerPixel(depth); ++ } ++ ++ if (depth <= 0) ++ depth = pPixmap->drawable.depth; ++ ++ if (width != pPixmap->drawable.width || ++ height != pPixmap->drawable.height || ++ depth != pPixmap->drawable.depth || ++ bitsPerPixel != pPixmap->drawable.bitsPerPixel) { ++ if (pExaPixmap->driverPriv) { + exaSetFbPitch(pExaScr, pExaPixmap, + width, height, bitsPerPixel); + + exaSetAccelBlock(pExaScr, pExaPixmap, + width, height, bitsPerPixel); ++ REGION_EMPTY(pScreen, &pExaPixmap->validFB); + } ++ ++ /* Need to re-create system copy if there's also a GPU copy */ ++ if (has_gpu_copy && pExaPixmap->sys_ptr) { ++ free(pExaPixmap->sys_ptr); ++ pExaPixmap->sys_ptr = NULL; ++ pExaPixmap->sys_pitch = devKind > 0 ? devKind : ++ PixmapBytePad(width, depth); ++ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); ++ DamageDestroy(pExaPixmap->pDamage); ++ pExaPixmap->pDamage = NULL; ++ REGION_EMPTY(pScreen, &pExaPixmap->validSys); ++ ++ if (pExaScr->deferred_mixed_pixmap == pPixmap) ++ pExaScr->deferred_mixed_pixmap = NULL; ++ } + } + +- is_offscreen = exaPixmapIsOffscreen(pPixmap); +- if (is_offscreen) { ++ if (has_gpu_copy) { + pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr; + pPixmap->devKind = pExaPixmap->fb_pitch; + } else { +@@ -168,7 +221,7 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, + swap(pExaScr, pScreen, ModifyPixmapHeader); + + out: +- if (is_offscreen) { ++ if (has_gpu_copy) { + pExaPixmap->fb_ptr = pPixmap->devPrivate.ptr; + pExaPixmap->fb_pitch = pPixmap->devKind; + } else { +@@ -196,6 +249,9 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) + if (pExaScr->fallback_counter) + exaFinishAccess(&pPixmap->drawable, -1); + ++ if (pExaScr->deferred_mixed_pixmap == pPixmap) ++ pExaScr->deferred_mixed_pixmap = NULL; ++ + if (pExaPixmap->driverPriv) + pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv); + pExaPixmap->driverPriv = NULL; +@@ -216,7 +272,7 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap) + } + + Bool +-exaPixmapIsOffscreen_mixed(PixmapPtr pPixmap) ++exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap) + { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + ExaScreenPriv(pScreen); +diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c +index 2ec4174..5abe3b8 100644 +--- a/exa/exa_offscreen.c ++++ b/exa/exa_offscreen.c +@@ -245,7 +245,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, + /* save extra space in new area */ + if (real_size < area->size) + { +- ExaOffscreenArea *new_area = xalloc (sizeof (ExaOffscreenArea)); ++ ExaOffscreenArea *new_area = malloc(sizeof (ExaOffscreenArea)); + if (!new_area) + return NULL; + new_area->base_offset = area->base_offset; +@@ -408,7 +408,7 @@ ExaOffscreenMerge (ExaScreenPrivPtr pExaScr, ExaOffscreenArea *area) + area->next->prev = area; + else + pExaScr->info->offScreenAreas->prev = area; +- xfree (next); ++ free(next); + + pExaScr->numOffscreenAvailable--; + } +@@ -499,7 +499,7 @@ ExaOffscreenDefragment (ScreenPtr pScreen) + return NULL; + + pExaDstPix = ExaGetPixmapPriv (pDstPix); +- pExaDstPix->offscreen = TRUE; ++ pExaDstPix->use_gpu_copy = TRUE; + + for (area = pExaScr->info->offScreenAreas->prev; + area != pExaScr->info->offScreenAreas; +@@ -508,7 +508,7 @@ ExaOffscreenDefragment (ScreenPtr pScreen) + ExaOffscreenArea *prev = area->prev; + PixmapPtr pSrcPix; + ExaPixmapPrivPtr pExaSrcPix; +- Bool save_offscreen; ++ Bool save_use_gpu_copy; + int save_pitch; + + if (area->state != ExaOffscreenAvail || +@@ -553,10 +553,10 @@ ExaOffscreenDefragment (ScreenPtr pScreen) + continue; + } + +- save_offscreen = pExaSrcPix->offscreen; ++ save_use_gpu_copy = pExaSrcPix->use_gpu_copy; + save_pitch = pSrcPix->devKind; + +- pExaSrcPix->offscreen = TRUE; ++ pExaSrcPix->use_gpu_copy = TRUE; + pSrcPix->devKind = pExaSrcPix->fb_pitch; + + pDstPix->drawable.width = pSrcPix->drawable.width; +@@ -566,7 +566,7 @@ ExaOffscreenDefragment (ScreenPtr pScreen) + pDstPix->drawable.bitsPerPixel = pSrcPix->drawable.bitsPerPixel; + + if (!pExaScr->info->PrepareCopy (pSrcPix, pDstPix, -1, -1, GXcopy, ~0)) { +- pExaSrcPix->offscreen = save_offscreen; ++ pExaSrcPix->use_gpu_copy = save_use_gpu_copy; + pSrcPix->devKind = save_pitch; + area = prev; + continue; +@@ -623,7 +623,7 @@ ExaOffscreenDefragment (ScreenPtr pScreen) + #endif + + pExaSrcPix->fb_ptr = pExaDstPix->fb_ptr; +- pExaSrcPix->offscreen = save_offscreen; ++ pExaSrcPix->use_gpu_copy = save_use_gpu_copy; + pSrcPix->devKind = save_pitch; + } + +@@ -655,7 +655,7 @@ exaOffscreenInit (ScreenPtr pScreen) + ExaOffscreenArea *area; + + /* Allocate a big free area */ +- area = xalloc (sizeof (ExaOffscreenArea)); ++ area = malloc(sizeof (ExaOffscreenArea)); + + if (!area) + return FALSE; +@@ -691,6 +691,6 @@ ExaOffscreenFini (ScreenPtr pScreen) + while ((area = pExaScr->info->offScreenAreas)) + { + pExaScr->info->offScreenAreas = area->next; +- xfree (area); ++ free(area); + } + } +diff --git a/exa/exa_priv.h b/exa/exa_priv.h +index 7d035d4..14c99e9 100644 +--- a/exa/exa_priv.h ++++ b/exa/exa_priv.h +@@ -50,10 +50,8 @@ + #include "dix.h" + #include "fb.h" + #include "fboverlay.h" +-#ifdef RENDER + #include "fbpict.h" + #include "glyphstr.h" +-#endif + #include "damage.h" + + #define DEBUG_TRACE_FALL 0 +@@ -165,19 +163,17 @@ typedef struct { + BitmapToRegionProcPtr SavedBitmapToRegion; + CreateScreenResourcesProcPtr SavedCreateScreenResources; + ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader; +-#ifdef RENDER ++ SourceValidateProcPtr SavedSourceValidate; + CompositeProcPtr SavedComposite; + TrianglesProcPtr SavedTriangles; + GlyphsProcPtr SavedGlyphs; + TrapezoidsProcPtr SavedTrapezoids; + AddTrapsProcPtr SavedAddTraps; +-#endif + void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); +- Bool (*pixmap_is_offscreen) (PixmapPtr pPixmap); ++ Bool (*pixmap_has_gpu_copy) (PixmapPtr pPixmap); + void (*do_move_in_pixmap) (PixmapPtr pPixmap); + void (*do_move_out_pixmap) (PixmapPtr pPixmap); + void (*prepare_access_reg)(PixmapPtr pPixmap, int index, RegionPtr pReg); +- void (*finish_access)(PixmapPtr pPixmap, int index); + + Bool swappedOut; + enum ExaMigrationHeuristic migration; +@@ -188,11 +184,13 @@ typedef struct { + unsigned numOffscreenAvailable; + CARD32 lastDefragment; + CARD32 nextDefragment; ++ PixmapPtr deferred_mixed_pixmap; + + /* Reference counting for accessed pixmaps */ + struct { + PixmapPtr pixmap; + int count; ++ Bool retval; + } access[EXA_NUM_PREPARE_INDICES]; + + /* Holds information on fallbacks that cannot be relayed otherwise. */ +@@ -200,6 +198,15 @@ typedef struct { + unsigned int fallback_counter; + + ExaGlyphCacheRec glyphCaches[EXA_NUM_GLYPH_CACHES]; ++ ++ /** ++ * Regions affected by fallback composite source / mask operations. ++ */ ++ ++ RegionRec srcReg; ++ RegionRec maskReg; ++ PixmapPtr srcPix; ++ + } ExaScreenPrivRec, *ExaScreenPrivPtr; + + /* +@@ -282,7 +289,7 @@ extern DevPrivateKey exaGCPrivateKey; + typedef struct { + ExaOffscreenArea *area; + int score; /**< score for the move-in vs move-out heuristic */ +- Bool offscreen; ++ Bool use_gpu_copy; + + CARD8 *sys_ptr; /**< pointer to pixmap data in system memory */ + int sys_pitch; /**< pitch of pixmap in system memory */ +@@ -488,7 +495,6 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, + + extern const GCOps exaOps; + +-#ifdef RENDER + void + ExaCheckComposite (CARD8 op, + PicturePtr pSrc, +@@ -502,7 +508,17 @@ ExaCheckComposite (CARD8 op, + INT16 yDst, + CARD16 width, + CARD16 height); +-#endif ++ ++void ++ExaCheckGlyphs (CARD8 op, ++ PicturePtr pSrc, ++ PicturePtr pDst, ++ PictFormatPtr maskFormat, ++ INT16 xSrc, ++ INT16 ySrc, ++ int nlist, ++ GlyphListPtr list, ++ GlyphPtr *glyphs); + + /* exa_offscreen.c */ + void +@@ -538,7 +554,7 @@ exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap, + int *xp, int *yp); + + Bool +-exaPixmapIsOffscreen(PixmapPtr p); ++exaPixmapHasGpuCopy(PixmapPtr p); + + PixmapPtr + exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp); +@@ -575,7 +591,7 @@ Bool + exaDestroyPixmap_classic (PixmapPtr pPixmap); + + Bool +-exaPixmapIsOffscreen_classic(PixmapPtr pPixmap); ++exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap); + + /* exa_driver.c */ + PixmapPtr +@@ -590,7 +606,7 @@ Bool + exaDestroyPixmap_driver (PixmapPtr pPixmap); + + Bool +-exaPixmapIsOffscreen_driver(PixmapPtr pPixmap); ++exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap); + + /* exa_mixed.c */ + PixmapPtr +@@ -605,7 +621,7 @@ Bool + exaDestroyPixmap_mixed(PixmapPtr pPixmap); + + Bool +-exaPixmapIsOffscreen_mixed(PixmapPtr pPixmap); ++exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap); + + /* exa_migration_mixed.c */ + void +@@ -618,10 +634,10 @@ void + exaMoveInPixmap_mixed(PixmapPtr pPixmap); + + void +-exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg); ++exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure); + + void +-exaFinishAccess_mixed(PixmapPtr pPixmap, int index); ++exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg); + + /* exa_render.c */ + Bool +diff --git a/exa/exa_render.c b/exa/exa_render.c +index db355d6..b7f383f 100644 +--- a/exa/exa_render.c ++++ b/exa/exa_render.c +@@ -30,7 +30,6 @@ + + #include "exa_priv.h" + +-#ifdef RENDER + #include "mipict.h" + + #if DEBUG_TRACE_FALL +@@ -320,7 +319,7 @@ exaTryDriverSolidFill(PicturePtr pSrc, + exaDoMigration(pixmaps, 1, TRUE); + } + +- if (!exaPixmapIsOffscreen(pDstPix)) { ++ if (!exaPixmapHasGpuCopy(pDstPix)) { + REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); + return 0; + } +@@ -540,7 +539,7 @@ exaCompositeRects(CARD8 op, + /* We have to manage the damage ourselves, since CompositeRects isn't + * something in the screen that can be managed by the damage extension, + * and EXA depends on damage to track what needs to be migrated between +- * offscreen and onscreen. ++ * the gpu and the cpu. + */ + + /* Compute the overall extents of the composited region - we're making +@@ -752,7 +751,7 @@ exaTryDriverComposite(CARD8 op, + } + } + +- if (!exaPixmapIsOffscreen(pDstPix)) { ++ if (!exaPixmapHasGpuCopy(pDstPix)) { + REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); + return 0; + } +@@ -1072,7 +1071,6 @@ done: + if (pMask) + pMask->repeat = saveMaskRepeat; + } +-#endif + + /** + * Same as miCreateAlphaPicture, except it uses ExaCheckPolyFillRect instead +diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c +index 9bc765a..402d76d 100644 +--- a/exa/exa_unaccel.c ++++ b/exa/exa_unaccel.c +@@ -23,9 +23,7 @@ + + #include "exa_priv.h" + +-#ifdef RENDER + #include "mipict.h" +-#endif + + /* + * These functions wrap the low-level fb rendering functions and +@@ -123,11 +121,36 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, + Bool upsidedown, Pixel bitplane, void *closure) + { ++ RegionRec reg; ++ int xoff, yoff; + EXA_PRE_FALLBACK_GC(pGC); + EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst, + exaDrawableLocation(pSrc), exaDrawableLocation(pDst))); +- exaPrepareAccess (pDst, EXA_PREPARE_DEST); +- exaPrepareAccess (pSrc, EXA_PREPARE_SRC); ++ ++ if (pExaScr->prepare_access_reg) { ++ PixmapPtr pPixmap = exaGetDrawablePixmap(pSrc); ++ ++ exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff); ++ REGION_INIT(pScreen, ®, pbox, nbox); ++ REGION_TRANSLATE(pScreen, ®, xoff + dx, yoff + dy); ++ pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, ®); ++ REGION_UNINIT(pScreen, ®); ++ } else ++ exaPrepareAccess (pSrc, EXA_PREPARE_SRC); ++ ++ if (pExaScr->prepare_access_reg && ++ !exaGCReadsDestination(pDst, pGC->planemask, pGC->fillStyle, ++ pGC->alu, pGC->clientClipType)) { ++ PixmapPtr pPixmap = exaGetDrawablePixmap(pDst); ++ ++ exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff); ++ REGION_INIT(pScreen, ®, pbox, nbox); ++ REGION_TRANSLATE(pScreen, ®, xoff, yoff); ++ pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST, ®); ++ REGION_UNINIT(pScreen, ®); ++ } else ++ exaPrepareAccess (pDst, EXA_PREPARE_DEST); ++ + /* This will eventually call fbCopyNtoN, with some calculation overhead. */ + while (nbox--) { + pGC->ops->CopyArea (pSrc, pDst, pGC, pbox->x1 - pSrc->x + dx, pbox->y1 - pSrc->y + dy, +@@ -139,6 +162,40 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + EXA_POST_FALLBACK_GC(pGC); + } + ++static void ++ExaFallbackPrepareReg(DrawablePtr pDrawable, ++ GCPtr pGC, ++ int x, int y, int width, int height, ++ int index, Bool checkReads) ++{ ++ ScreenPtr pScreen = pDrawable->pScreen; ++ ExaScreenPriv(pScreen); ++ ++ if (pExaScr->prepare_access_reg && ++ !(checkReads && exaGCReadsDestination(pDrawable, ++ pGC->planemask, ++ pGC->fillStyle, ++ pGC->alu, ++ pGC->clientClipType))) { ++ BoxRec box; ++ RegionRec reg; ++ int xoff, yoff; ++ PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable); ++ ++ exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff); ++ box.x1 = pDrawable->x + x + xoff; ++ box.y1 = pDrawable->y + y + yoff; ++ box.x2 = box.x1 + width; ++ box.y2 = box.y1 + height; ++ ++ REGION_INIT(pScreen, ®, &box, 1); ++ pExaScr->prepare_access_reg(pPixmap, index, ®); ++ REGION_UNINIT(pScreen, ®); ++ } else ++ exaPrepareAccess(pDrawable, index); ++} ++ ++ + RegionPtr + ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty) +@@ -148,8 +205,10 @@ ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + EXA_PRE_FALLBACK_GC(pGC); + EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst, + exaDrawableLocation(pSrc), exaDrawableLocation(pDst))); +- exaPrepareAccess (pDst, EXA_PREPARE_DEST); +- exaPrepareAccess (pSrc, EXA_PREPARE_SRC); ++ ExaFallbackPrepareReg(pSrc, pGC, srcx, srcy, w, h, ++ EXA_PREPARE_SRC, FALSE); ++ ExaFallbackPrepareReg(pDst, pGC, dstx, dsty, w, h, ++ EXA_PREPARE_DEST, TRUE); + ret = pGC->ops->CopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); + exaFinishAccess (pSrc, EXA_PREPARE_SRC); + exaFinishAccess (pDst, EXA_PREPARE_DEST); +@@ -168,8 +227,10 @@ ExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + EXA_PRE_FALLBACK_GC(pGC); + EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst, + exaDrawableLocation(pSrc), exaDrawableLocation(pDst))); +- exaPrepareAccess (pDst, EXA_PREPARE_DEST); +- exaPrepareAccess (pSrc, EXA_PREPARE_SRC); ++ ExaFallbackPrepareReg(pSrc, pGC, srcx, srcy, w, h, ++ EXA_PREPARE_SRC, FALSE); ++ ExaFallbackPrepareReg(pDst, pGC, dstx, dsty, w, h, ++ EXA_PREPARE_DEST, TRUE); + ret = pGC->ops->CopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, + bitPlane); + exaFinishAccess (pSrc, EXA_PREPARE_SRC); +@@ -295,8 +356,10 @@ ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap, + EXA_FALLBACK(("from %p to %p (%c,%c)\n", pBitmap, pDrawable, + exaDrawableLocation(&pBitmap->drawable), + exaDrawableLocation(pDrawable))); +- exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); +- exaPrepareAccess (&pBitmap->drawable, EXA_PREPARE_SRC); ++ ExaFallbackPrepareReg(pDrawable, pGC, x, y, w, h, ++ EXA_PREPARE_DEST, TRUE); ++ ExaFallbackPrepareReg(&pBitmap->drawable, pGC, 0, 0, w, h, ++ EXA_PREPARE_SRC, FALSE); + exaPrepareAccessGC (pGC); + pGC->ops->PushPixels (pGC, pBitmap, pDrawable, w, h, x, y); + exaFinishAccessGC (pGC); +@@ -313,8 +376,18 @@ ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) + EXA_PRE_FALLBACK(pScreen); + EXA_FALLBACK(("from %p\n", pWin)); + +- /* being both src and dest, src is safest. */ +- exaPrepareAccess(pDrawable, EXA_PREPARE_SRC); ++ /* Only need the source bits, the destination region will be overwritten */ ++ if (pExaScr->prepare_access_reg) { ++ PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin); ++ int xoff, yoff; ++ ++ exaGetDrawableDeltas(&pWin->drawable, pPixmap, &xoff, &yoff); ++ REGION_TRANSLATE(pScreen, prgnSrc, xoff, yoff); ++ pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, prgnSrc); ++ REGION_TRANSLATE(pScreen, prgnSrc, -xoff, -yoff); ++ } else ++ exaPrepareAccess(pDrawable, EXA_PREPARE_SRC); ++ + swap(pExaScr, pScreen, CopyWindow); + pScreen->CopyWindow (pWin, ptOldOrg, prgnSrc); + swap(pExaScr, pScreen, CopyWindow); +@@ -327,29 +400,12 @@ ExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, + unsigned int format, unsigned long planeMask, char *d) + { + ScreenPtr pScreen = pDrawable->pScreen; +- PixmapPtr pPix = exaGetDrawablePixmap (pDrawable); + EXA_PRE_FALLBACK(pScreen); + EXA_FALLBACK(("from %p (%c)\n", pDrawable, + exaDrawableLocation(pDrawable))); + +- if (pExaScr->prepare_access_reg) { +- int xoff, yoff; +- BoxRec Box; +- RegionRec Reg; +- +- exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff); +- +- Box.x1 = pDrawable->y + x + xoff; +- Box.y1 = pDrawable->y + y + yoff; +- Box.x2 = Box.x1 + w; +- Box.y2 = Box.y1 + h; +- +- REGION_INIT(pScreen, &Reg, &Box, 1); +- +- pExaScr->prepare_access_reg(pPix, EXA_PREPARE_SRC, &Reg); +- } else +- exaPrepareAccess(pDrawable, EXA_PREPARE_SRC); +- ++ ExaFallbackPrepareReg(pDrawable, NULL, x, y, w, h, ++ EXA_PREPARE_SRC, FALSE); + swap(pExaScr, pScreen, GetImage); + pScreen->GetImage (pDrawable, x, y, w, h, format, planeMask, d); + swap(pExaScr, pScreen, GetImage); +@@ -377,6 +433,175 @@ ExaCheckGetSpans (DrawablePtr pDrawable, + EXA_POST_FALLBACK(pScreen); + } + ++static void ++ExaSrcValidate(DrawablePtr pDrawable, ++ int x, ++ int y, ++ int width, ++ int height) ++{ ++ ScreenPtr pScreen = pDrawable->pScreen; ++ ExaScreenPriv(pScreen); ++ PixmapPtr pPix = exaGetDrawablePixmap (pDrawable); ++ BoxRec box; ++ RegionRec reg; ++ RegionPtr dst; ++ int xoff, yoff; ++ ++ exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff); ++ ++ box.x1 = x + xoff; ++ box.y1 = y + yoff; ++ box.x2 = box.x1 + width; ++ box.y2 = box.y1 + height; ++ ++ dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg : ++ &pExaScr->maskReg; ++ ++ REGION_INIT(pScreen, ®, &box, 1); ++ REGION_UNION(pScreen, dst, dst, ®); ++ REGION_UNINIT(pScreen, ®); ++ ++ if (pExaScr->SavedSourceValidate) { ++ swap(pExaScr, pScreen, SourceValidate); ++ pScreen->SourceValidate(pDrawable, x, y, width, height); ++ swap(pExaScr, pScreen, SourceValidate); ++ } ++} ++ ++static Bool ++ExaPrepareCompositeReg(ScreenPtr pScreen, ++ CARD8 op, ++ PicturePtr pSrc, ++ PicturePtr pMask, ++ PicturePtr pDst, ++ INT16 xSrc, ++ INT16 ySrc, ++ INT16 xMask, ++ INT16 yMask, ++ INT16 xDst, ++ INT16 yDst, ++ CARD16 width, ++ CARD16 height) ++{ ++ RegionRec region; ++ RegionPtr dstReg = NULL; ++ RegionPtr srcReg = NULL; ++ RegionPtr maskReg = NULL; ++ PixmapPtr pSrcPix = NULL; ++ PixmapPtr pMaskPix = NULL; ++ PixmapPtr pDstPix; ++ ExaScreenPriv(pScreen); ++ Bool ret; ++ ++ ++ REGION_NULL(pScreen, ®ion); ++ ++ if (pSrc->pDrawable) { ++ pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable); ++ REGION_NULL(pScreen, &pExaScr->srcReg); ++ srcReg = &pExaScr->srcReg; ++ pExaScr->srcPix = pSrcPix; ++ if (pSrc != pDst) ++ REGION_TRANSLATE(pScreen, pSrc->pCompositeClip, ++ -pSrc->pDrawable->x, ++ -pSrc->pDrawable->y); ++ } ++ ++ if (pMask && pMask->pDrawable) { ++ pMaskPix = exaGetDrawablePixmap(pMask->pDrawable); ++ REGION_NULL(pScreen, &pExaScr->maskReg); ++ maskReg = &pExaScr->maskReg; ++ if (pMask != pDst && pMask != pSrc) ++ REGION_TRANSLATE(pScreen, pMask->pCompositeClip, ++ -pMask->pDrawable->x, ++ -pMask->pDrawable->y); ++ } ++ ++ REGION_TRANSLATE(pScreen, pDst->pCompositeClip, ++ -pDst->pDrawable->x, ++ -pDst->pDrawable->y); ++ ++ pExaScr->SavedSourceValidate = ExaSrcValidate; ++ swap(pExaScr, pScreen, SourceValidate); ++ ret = miComputeCompositeRegion (®ion, pSrc, pMask, pDst, ++ xSrc, ySrc, xMask, yMask, ++ xDst, ++ yDst, ++ width, height); ++ swap(pExaScr, pScreen, SourceValidate); ++ ++ REGION_TRANSLATE(pScreen, pDst->pCompositeClip, ++ pDst->pDrawable->x, ++ pDst->pDrawable->y); ++ if (pSrc->pDrawable && pSrc != pDst) ++ REGION_TRANSLATE(pScreen, pSrc->pCompositeClip, ++ pSrc->pDrawable->x, ++ pSrc->pDrawable->y); ++ if (pMask && pMask->pDrawable && pMask != pDst && pMask != pSrc) ++ REGION_TRANSLATE(pScreen, pMask->pCompositeClip, ++ pMask->pDrawable->x, ++ pMask->pDrawable->y); ++ ++ if (!ret) { ++ if (srcReg) ++ REGION_UNINIT(pScreen, srcReg); ++ if (maskReg) ++ REGION_UNINIT(pScreen, maskReg); ++ ++ return FALSE; ++ } ++ ++ /** ++ * Don't limit alphamaps readbacks for now until we've figured out how that ++ * should be done. ++ */ ++ ++ if (pSrc->alphaMap && pSrc->alphaMap->pDrawable) ++ pExaScr->prepare_access_reg(exaGetDrawablePixmap(pSrc->alphaMap->pDrawable), ++ EXA_PREPARE_AUX_SRC, ++ NULL); ++ if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable) ++ pExaScr->prepare_access_reg(exaGetDrawablePixmap(pMask->alphaMap->pDrawable), ++ EXA_PREPARE_AUX_MASK, ++ NULL); ++ ++ if (pSrcPix) ++ pExaScr->prepare_access_reg(pSrcPix, ++ EXA_PREPARE_SRC, ++ srcReg); ++ ++ if (pMaskPix) ++ pExaScr->prepare_access_reg(pMaskPix, ++ EXA_PREPARE_MASK, ++ maskReg); ++ ++ if (srcReg) ++ REGION_UNINIT(pScreen, srcReg); ++ if (maskReg) ++ REGION_UNINIT(pScreen, maskReg); ++ ++ pDstPix = exaGetDrawablePixmap(pDst->pDrawable); ++ if (!exaOpReadsDestination(op)) { ++ int xoff; ++ int yoff; ++ ++ exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &xoff, &yoff); ++ REGION_TRANSLATE(pScreen, ®ion, pDst->pDrawable->x + xoff, ++ pDst->pDrawable->y + yoff); ++ dstReg = ®ion; ++ } ++ ++ if (pDst->alphaMap && pDst->alphaMap->pDrawable) ++ pExaScr->prepare_access_reg(exaGetDrawablePixmap(pDst->alphaMap->pDrawable), ++ EXA_PREPARE_AUX_DEST, ++ dstReg); ++ pExaScr->prepare_access_reg(pDstPix, EXA_PREPARE_DEST, dstReg); ++ ++ REGION_UNINIT(pScreen, ®ion); ++ return TRUE; ++} ++ + void + ExaCheckComposite (CARD8 op, + PicturePtr pSrc, +@@ -392,56 +617,39 @@ ExaCheckComposite (CARD8 op, + CARD16 height) + { + ScreenPtr pScreen = pDst->pDrawable->pScreen; +-#ifdef RENDER + PictureScreenPtr ps = GetPictureScreen(pScreen); +-#endif /* RENDER */ +- RegionRec region; +- int xoff, yoff; + EXA_PRE_FALLBACK(pScreen); + +- REGION_NULL(pScreen, ®ion); +- +- /* We need to prepare access to any separate alpha maps first, in case the +- * driver doesn't support EXA_PREPARE_AUX*, in which case EXA_PREPARE_SRC +- * may be used for moving them out. +- */ +- if (pSrc->alphaMap && pSrc->alphaMap->pDrawable) +- exaPrepareAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC); +- if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable) +- exaPrepareAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK); +- +- if (!exaOpReadsDestination(op) && pExaScr->prepare_access_reg) { +- PixmapPtr pDstPix; +- +- if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, +- xSrc, ySrc, xMask, yMask, xDst, yDst, +- width, height)) +- goto skip; +- +- pDstPix = exaGetDrawablePixmap(pDst->pDrawable); +- exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &xoff, &yoff); +- REGION_TRANSLATE(pScreen, ®ion, xoff, yoff); ++ if (pExaScr->prepare_access_reg) { ++ if (!ExaPrepareCompositeReg(pScreen, op, pSrc, pMask, pDst, xSrc, ++ ySrc, xMask, yMask, xDst, yDst, width, ++ height)) ++ goto out_no_clip; ++ } else { + +- if (pDst->alphaMap && pDst->alphaMap->pDrawable) +- pExaScr->prepare_access_reg(exaGetDrawablePixmap(pDst->alphaMap->pDrawable), +- EXA_PREPARE_AUX_DEST, ®ion); ++ /* We need to prepare access to any separate alpha maps first, ++ * in case the driver doesn't support EXA_PREPARE_AUX*, ++ * in which case EXA_PREPARE_SRC may be used for moving them out. ++ */ + +- pExaScr->prepare_access_reg(pDstPix, EXA_PREPARE_DEST, ®ion); +- } else { ++ if (pSrc->alphaMap && pSrc->alphaMap->pDrawable) ++ exaPrepareAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC); ++ if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable) ++ exaPrepareAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK); + if (pDst->alphaMap && pDst->alphaMap->pDrawable) + exaPrepareAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST); + + exaPrepareAccess (pDst->pDrawable, EXA_PREPARE_DEST); +- } + +- EXA_FALLBACK(("from picts %p/%p to pict %p\n", +- pSrc, pMask, pDst)); ++ EXA_FALLBACK(("from picts %p/%p to pict %p\n", ++ pSrc, pMask, pDst)); ++ ++ if (pSrc->pDrawable != NULL) ++ exaPrepareAccess (pSrc->pDrawable, EXA_PREPARE_SRC); ++ if (pMask && pMask->pDrawable != NULL) ++ exaPrepareAccess (pMask->pDrawable, EXA_PREPARE_MASK); ++ } + +- if (pSrc->pDrawable != NULL) +- exaPrepareAccess (pSrc->pDrawable, EXA_PREPARE_SRC); +- if (pMask && pMask->pDrawable != NULL) +- exaPrepareAccess (pMask->pDrawable, EXA_PREPARE_MASK); +-#ifdef RENDER + swap(pExaScr, ps, Composite); + ps->Composite (op, + pSrc, +@@ -456,7 +664,6 @@ ExaCheckComposite (CARD8 op, + width, + height); + swap(pExaScr, ps, Composite); +-#endif /* RENDER */ + if (pMask && pMask->pDrawable != NULL) + exaFinishAccess (pMask->pDrawable, EXA_PREPARE_MASK); + if (pSrc->pDrawable != NULL) +@@ -464,14 +671,34 @@ ExaCheckComposite (CARD8 op, + exaFinishAccess (pDst->pDrawable, EXA_PREPARE_DEST); + if (pDst->alphaMap && pDst->alphaMap->pDrawable) + exaFinishAccess(pDst->alphaMap->pDrawable, EXA_PREPARE_AUX_DEST); +- +-skip: + if (pSrc->alphaMap && pSrc->alphaMap->pDrawable) + exaFinishAccess(pSrc->alphaMap->pDrawable, EXA_PREPARE_AUX_SRC); + if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable) + exaFinishAccess(pMask->alphaMap->pDrawable, EXA_PREPARE_AUX_MASK); + +- REGION_UNINIT(pScreen, ®ion); ++out_no_clip: ++ EXA_POST_FALLBACK(pScreen); ++} ++ ++/** ++ * Avoid migration ping-pong when using a mask. ++ */ ++void ++ExaCheckGlyphs (CARD8 op, ++ PicturePtr pSrc, ++ PicturePtr pDst, ++ PictFormatPtr maskFormat, ++ INT16 xSrc, ++ INT16 ySrc, ++ int nlist, ++ GlyphListPtr list, ++ GlyphPtr *glyphs) ++{ ++ ScreenPtr pScreen = pDst->pDrawable->pScreen; ++ EXA_PRE_FALLBACK(pScreen); ++ ++ miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); ++ + EXA_POST_FALLBACK(pScreen); + } + +@@ -483,19 +710,15 @@ ExaCheckAddTraps (PicturePtr pPicture, + xTrap *traps) + { + ScreenPtr pScreen = pPicture->pDrawable->pScreen; +-#ifdef RENDER + PictureScreenPtr ps = GetPictureScreen(pScreen); +-#endif /* RENDER */ + EXA_PRE_FALLBACK(pScreen); + + EXA_FALLBACK(("to pict %p (%c)\n", + exaDrawableLocation(pPicture->pDrawable))); + exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); +-#ifdef RENDER + swap(pExaScr, ps, AddTraps); + ps->AddTraps (pPicture, x_off, y_off, ntrap, traps); + swap(pExaScr, ps, AddTraps); +-#endif /* RENDER */ + exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); + EXA_POST_FALLBACK(pScreen); + } diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-fix-randr-rotation.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-fix-randr-rotation.patch new file mode 100644 index 00000000..191d4f9f --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-fix-randr-rotation.patch @@ -0,0 +1,108 @@ +From d66172eb30398176ee64eaf5841887c76cbac06f Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Mon, 21 Jun 2010 09:55:39 +1000 +Subject: [PATCH] rotation: fix cursor and overlap of one pixel. + +Commit 77c7a64e8885696665556c9fbcb3cffb552e367a was introduced to fix a cursor off by one on Intel hw, however it also move the whole crtc into an off by one +position and you could see gnom-eshell overlapping. + +This commit reverts that and instead fixes the cursor hotspot translation to +work like pixman does. We add 0.5 to the cursor vector before translating, +and floor the value afterwards. + +Thanks to Soeren (ssp) for pointing out where the real problem was after explaning how pixman translates points. + +Signed-off-by: Dave Airlie +--- + hw/xfree86/modes/xf86Cursors.c | 9 ++++++--- + randr/rrtransform.c | 28 ++++++++++++++-------------- + 2 files changed, 20 insertions(+), 17 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c +index 385848b..483f62d 100644 +--- a/hw/xfree86/modes/xf86Cursors.c ++++ b/hw/xfree86/modes/xf86Cursors.c +@@ -327,10 +327,13 @@ xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) + xf86CursorScreenKey); + struct pict_f_vector v; + +- v.v[0] = x + ScreenPriv->HotX; v.v[1] = y + ScreenPriv->HotY; v.v[2] = 1; ++ v.v[0] = (x + ScreenPriv->HotX) + 0.5; ++ v.v[1] = (y + ScreenPriv->HotY) + 0.5; ++ v.v[2] = 1; + pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v); +- x = floor (v.v[0] + 0.5); +- y = floor (v.v[1] + 0.5); ++ /* cursor will have 0.5 added to it already so floor is sufficent */ ++ x = floor (v.v[0]); ++ y = floor (v.v[1]); + /* + * Transform position of cursor upper left corner + */ +diff --git a/randr/rrtransform.c b/randr/rrtransform.c +index 06f6298..53de3b8 100644 +--- a/randr/rrtransform.c ++++ b/randr/rrtransform.c +@@ -185,21 +185,21 @@ RRTransformCompute (int x, + break; + case RR_Rotate_90: + f_rot_cos = 0; f_rot_sin = 1; +- f_rot_dx = height-1; f_rot_dy = 0; ++ f_rot_dx = height; f_rot_dy = 0; + rot_cos = F ( 0); rot_sin = F ( 1); +- rot_dx = F (height-1); rot_dy = F (0); ++ rot_dx = F ( height); rot_dy = F (0); + break; + case RR_Rotate_180: + f_rot_cos = -1; f_rot_sin = 0; +- f_rot_dx = width - 1; f_rot_dy = height - 1; ++ f_rot_dx = width; f_rot_dy = height; + rot_cos = F (-1); rot_sin = F ( 0); +- rot_dx = F (width-1); rot_dy = F ( height-1); ++ rot_dx = F (width); rot_dy = F ( height); + break; + case RR_Rotate_270: + f_rot_cos = 0; f_rot_sin = -1; +- f_rot_dx = 0; f_rot_dy = width-1; ++ f_rot_dx = 0; f_rot_dy = width; + rot_cos = F ( 0); rot_sin = F (-1); +- rot_dx = F ( 0); rot_dy = F ( width-1); ++ rot_dx = F ( 0); rot_dy = F ( width); + break; + } + +@@ -222,11 +222,11 @@ RRTransformCompute (int x, + f_scale_x = -1; + scale_x = F(-1); + if (rotation & (RR_Rotate_0|RR_Rotate_180)) { +- f_scale_dx = width-1; +- scale_dx = F(width-1); ++ f_scale_dx = width; ++ scale_dx = F(width); + } else { +- f_scale_dx = height-1; +- scale_dx = F(height-1); ++ f_scale_dx = height; ++ scale_dx = F(height); + } + } + if (rotation & RR_Reflect_Y) +@@ -234,11 +234,11 @@ RRTransformCompute (int x, + f_scale_y = -1; + scale_y = F(-1); + if (rotation & (RR_Rotate_0|RR_Rotate_180)) { +- f_scale_dy = height-1; +- scale_dy = F(height-1); ++ f_scale_dy = height; ++ scale_dy = F(height); + } else { +- f_scale_dy = width-1; +- scale_dy = F(width-1); ++ f_scale_dy = width; ++ scale_dy = F(width); + } + } + +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-improve-mode-selection.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-improve-mode-selection.patch new file mode 100644 index 00000000..e6375736 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-improve-mode-selection.patch @@ -0,0 +1,114 @@ +From 6a18acbe113c5ce0108fb07bcd6cc5aeefcc5f6f Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Wed, 23 Jun 2010 15:01:08 -0400 +Subject: [PATCH] modes: improve aspect ratio match for classic drivers + +The X server tries to infer the aspect ratio of the screen, and estimates the +virtual size of the screen as the largest mode in the combined list of modes +given then runs through the mode list checking it against the sync ranges from +the monitor and the driver's ValidMode hook. +In doing so it might filter away all modes that exactly match the earlier +aspect ratio guess in which case the server picks the mode with the next most +area by pixel count. + +The following patch changes the logic, and instead of picking the largest +area, it looks first in the builtin modes, the driver modes and at last the +rest of modes which includes the default modes. + +This way, if there is no mode matching the initial mode, we do not end up +picking a random mode and prefer instead a user defined or a monitor mode. + +As the virtual size is changed, the line pitch also needs to be recalculated. +--- + hw/xfree86/common/xf86Mode.c | 64 ++++++++++++++++++++++++++++++++++++++--- + 1 files changed, 59 insertions(+), 5 deletions(-) + +diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c +index 4a948d7..da50b27 100644 +--- a/hw/xfree86/common/xf86Mode.c ++++ b/hw/xfree86/common/xf86Mode.c +@@ -1665,8 +1665,6 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + numModes++; + } + +-#undef _VIRTUALX +- + /* + * If we estimated the virtual size above, we may have filtered away all + * the modes that maximally match that size; scan again to find out and +@@ -1681,13 +1679,69 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + } + } + if (vx < virtX || vy < virtY) { ++ const int types[] = { ++ M_T_BUILTIN | M_T_PREFERRED, ++ M_T_BUILTIN, ++ M_T_DRIVER | M_T_PREFERRED, ++ M_T_DRIVER, ++ 0 ++ }; ++ const int ntypes = sizeof(types) / sizeof(int); ++ int n; ++ ++ /* ++ * We did not find the estimated virtual size. So now we want to ++ * find the largest mode available, but we want to search in the ++ * modes in the order of "types" listed above. ++ */ ++ for (n = 0; n < ntypes; n++) { ++ int type = types[n]; ++ ++ vx = 0; vy = 0; ++ for (p = scrp->modes; p; p = p->next) { ++ /* scan through the modes in the sort order above */ ++ if ((p->type & type) != type) ++ continue; ++ if (p->HDisplay > vx && p->VDisplay > vy) { ++ vx = p->HDisplay; ++ vy = p->VDisplay; ++ } ++ } ++ if (vx && vy) ++ /* Found one */ ++ break; ++ } + xf86DrvMsg(scrp->scrnIndex, X_WARNING, + "Shrinking virtual size estimate from %dx%d to %dx%d\n", + virtX, virtY, vx, vy); +- virtX = vx; ++ virtX = _VIRTUALX(vx); + virtY = vy; +- linePitch = miScanLineWidth(vx, vy, minPitch, apertureSize, +- BankFormat, pitchInc); ++ for (p = scrp->modes; p; p = p->next) { ++ if (numModes > 0) { ++ if (p->HDisplay > virtX) ++ p->status = MODE_VIRTUAL_X; ++ if (p->VDisplay > virtY) ++ p->status = MODE_VIRTUAL_Y; ++ if (p->status != MODE_OK) { ++ numModes--; ++ printModeRejectMessage(scrp->scrnIndex, p, p->status); ++ } ++ } ++ } ++ if (linePitches != NULL) { ++ for (i = 0; linePitches[i] != 0; i++) { ++ if ((linePitches[i] >= virtX) && ++ (linePitches[i] == ++ miScanLineWidth(virtX, virtY, linePitches[i], ++ apertureSize, BankFormat, pitchInc))) { ++ linePitch = linePitches[i]; ++ break; ++ } ++ } ++ } else { ++ linePitch = miScanLineWidth(virtX, virtY, minPitch, ++ apertureSize, BankFormat, pitchInc); ++ } + } + } + +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-int10-reserved-areas.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-int10-reserved-areas.patch new file mode 100644 index 00000000..e30d9b08 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-int10-reserved-areas.patch @@ -0,0 +1,166 @@ +From 4a315630356aa7f4d99ded9d2e61f134dcde61d1 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 13 Jul 2010 12:06:40 -0400 +Subject: [PATCH] int10: Map up to one e820 reserved area if it looks like we need it + +Apparently some sandybridge machines put the int10 vector into code +that's below 0xa0000. Nice work guys. + +Signed-off-by: Adam Jackson +--- + hw/xfree86/int10/generic.c | 11 ++++- + hw/xfree86/int10/helper_mem.c | 98 ++++++++++++++++++++++++++++++++++++++--- + 2 files changed, 100 insertions(+), 9 deletions(-) + +diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c +index 9d39e99..7ca2100 100644 +--- a/hw/xfree86/int10/generic.c ++++ b/hw/xfree86/int10/generic.c +@@ -394,9 +394,16 @@ xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) + # define HIGH_BASE SYS_BIOS + #endif + # define SYS(addr) ((addr) >= HIGH_OFFSET) ++ ++extern void *rht_reserved_range; ++extern CARD32 rht_reserved_low, rht_reserved_high; ++ + #define V_ADDR(addr) \ +- (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) \ +- : (((char*)(INTPriv(pInt)->base) + addr))) ++ (SYS(addr) ? \ ++ ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) : \ ++ ((rht_reserved_range && addr >= rht_reserved_low && addr <= rht_reserved_high) ? \ ++ ((char *)rht_reserved_range + (addr - rht_reserved_low)) : \ ++ ((char*)(INTPriv(pInt)->base) + addr))) + #define VRAM_ADDR(addr) (addr - V_RAM) + #define VRAM_BASE (INTPriv(pInt)->vRam) + +diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c +index 6f6ecc2..c4f20d8 100644 +--- a/hw/xfree86/int10/helper_mem.c ++++ b/hw/xfree86/int10/helper_mem.c +@@ -9,6 +9,12 @@ + + #include + #include ++#include ++#include ++#include ++#include ++#include ++#include + + #include "xf86.h" + #include "xf86_OSproc.h" +@@ -281,15 +287,92 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt) + return location_type; + } + ++/* ++ * This should be in the Int10Priv, but we can't get there from here. ++ * And it's a horrible layering violation to be setting up maps _here_ ++ * instead of from the xf86ExtendedInitInt10 top level, but it's a ++ * rather large refactor to do that. ++ * ++ * Namespaced to avoid collisions with drivers, not that that's likely. ++ */ ++_X_EXPORT void *rht_reserved_range; ++_X_EXPORT CARD32 rht_reserved_low, rht_reserved_high; ++ ++#define rht_align(x) ((x) & ~4095) ++ ++static Bool ++check_segment(xf86Int10InfoPtr pInt, CARD32 x) ++{ ++ int fd, low, high; ++ char *b, buf[1024]; + +-#define CHECK_V_SEGMENT_RANGE(x) \ +- if (((x) << 4) < V_BIOS) { \ +- xf86DrvMsg(pInt->scrnIndex, X_ERROR, \ +- "V_BIOS address 0x%lx out of range\n", \ +- (unsigned long)(x) << 4); \ +- return FALSE; \ ++ x <<= 4; ++ ++ if (x >= V_BIOS) ++ return TRUE; ++ ++ fd = open("/proc/iomem", O_RDONLY); ++ if (fd == -1) ++ goto out; ++ ++ read(fd, buf, sizeof(buf)); ++ close(fd); ++ buf[1023] = '\0'; ++ ++ b = buf; ++ while (1) { ++ char junk[80]; ++ if (sscanf(b, " %x-%x : %s", &low, &high, junk) != 3) ++ break; ++ ++ if (low >= (1 << 20)) ++ break; ++ ++ if (low && x >= low && x <= high && !strncmp(junk, "reserved", 8)) { ++ /* oh god, here we go */ ++ int mem; ++ ++ if (rht_reserved_range) { ++ if (rht_reserved_low == rht_align(low) && rht_reserved_high == high) ++ /* re-map, probably server regen, no problem */ ++ return TRUE; ++ xf86DrvMsg(pInt->scrnIndex, X_ERROR, ++ "Multiple reserved ranges. Please file a bug\n"); ++ return FALSE; ++ } ++ ++ mem = open("/dev/mem", O_RDWR); ++ if (mem == -1) ++ return FALSE; ++ ++ rht_reserved_range = mmap(NULL, high + 1 - rht_align(low), ++ PROT_READ | PROT_WRITE, ++ MAP_SHARED, mem, rht_align(low)); ++ close(mem); ++ if (rht_reserved_range == MAP_FAILED) { ++ xf86DrvMsg(pInt->scrnIndex, X_ERROR, ++ "Failed to map reserved region at 0x%x\n", low); ++ return FALSE; ++ } ++ ++ rht_reserved_low = rht_align(low); ++ rht_reserved_high = high; ++ ++ return TRUE; ++ } ++ ++ b = strchr(b + 1, '\n'); ++ if (!b) ++ break; + } + ++out: ++ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "V_BIOS address 0x%lx out of range\n", ++ (unsigned long)(x)); ++ ++ return FALSE; ++} ++ + Bool + xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base) + { +@@ -310,7 +393,8 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base) + + cs = segments[i]; + +- CHECK_V_SEGMENT_RANGE(cs); ++ if (!check_segment(pInt, cs)) ++ return FALSE; + vbiosMem = (unsigned char *)base + (cs << 4); + if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) { + break; +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-lid-hack.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-lid-hack.patch new file mode 100644 index 00000000..9cf1f442 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-lid-hack.patch @@ -0,0 +1,130 @@ +From a7083389e14221c0ed6bff00e4006b9a0b1f7e4d Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 27 Jul 2010 14:56:29 -0400 +Subject: [PATCH] modes: Account for lid status, sometimes, if the devil chicken says so + +Signed-off-by: Adam Jackson +--- + hw/xfree86/modes/xf86Crtc.c | 80 ++++++++++++++++++++++++++++++++++++++---- + 1 files changed, 72 insertions(+), 8 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 06d1fc2..7a849e1 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -32,6 +32,11 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include + + #include "xf86.h" + #include "xf86DDC.h" +@@ -1515,11 +1520,44 @@ GuessRangeFromModes(MonPtr mon, DisplayModePtr mode) + mon->vrefresh[0].lo = 58.0; + } + ++static int ++lvds_lid_status(void) ++{ ++ glob_t g = {0, }; ++ int ret = XF86OutputStatusConnected; ++#ifdef linux ++ int fd; ++ char buf[80]; ++ ++ memset(buf, '\0', sizeof(buf)); ++ ++ if (glob("/proc/acpi/button/lid/*/state", GLOB_NOSORT, NULL, &g) != 0) ++ goto out; ++ ++ if (g.gl_pathc != 1) ++ goto out; ++ ++ fd = open(g.gl_pathv[0], O_RDONLY); ++ if (fd == -1) ++ goto out; ++ ++ read(fd, buf, sizeof(buf)-1); ++ close(fd); ++ if (strstr(buf, "closed")) ++ ret = XF86OutputStatusDisconnected; ++#endif ++ ++out: ++ globfree(&g); ++ return ret; ++} ++ + void + xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) + { + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int o; ++ int num_connected = 0; + + /* When canGrow was TRUE in the initial configuration we have to + * compare against the maximum values so that we don't drop modes. +@@ -1531,6 +1569,40 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) + maxY = config->maxHeight; + } + ++ /* clean the mode list */ ++ for (o = 0; o < config->num_output; o++) ++ { ++ xf86OutputPtr output = config->output[o]; ++ while (output->probed_modes != NULL) ++ xf86DeleteMode(&output->probed_modes, output->probed_modes); ++ } ++ ++ /* scan for connectivity */ ++ for (o = 0; o < config->num_output; o++) ++ { ++ xf86OutputPtr output = config->output[o]; ++ output->status = output->funcs->detect(output); ++ ++ if (output->status == XF86OutputStatusConnected) ++ num_connected++; ++ } ++ ++ /* ++ * Hack for LVDS/eDP. We want to consider these disconnected if the ++ * lid is closed, but only if more than one output is connected (lest ++ * we darken the only available output, since lid status is unreliable) ++ */ ++ if (num_connected > 1) ++ { ++ for (o = 0; o < config->num_output; o++) ++ { ++ xf86OutputPtr output = config->output[o]; ++ if (strstr(output->name, "LVDS") || strstr(output->name, "eDP")) ++ if (output->status == XF86OutputStatusConnected) ++ output->status = lvds_lid_status(); ++ } ++ } ++ + /* Probe the list of modes for each output. */ + for (o = 0; o < config->num_output; o++) + { +@@ -1547,14 +1619,6 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) + Bool add_default_modes; + enum { sync_config, sync_edid, sync_default } sync_source = sync_default; + +- while (output->probed_modes != NULL) +- xf86DeleteMode(&output->probed_modes, output->probed_modes); +- +- /* +- * Check connection status +- */ +- output->status = (*output->funcs->detect)(output); +- + if (output->status == XF86OutputStatusDisconnected) + { + xf86OutputSetEDID (output, NULL); +-- +1.7.1.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-make-ephyr-resize.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-make-ephyr-resize.patch new file mode 100644 index 00000000..189cbc73 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-make-ephyr-resize.patch @@ -0,0 +1,176 @@ +From 4822319b9d771f54bc26cec7a9941c6e60202d63 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Wed, 23 Jun 2010 15:55:00 +1000 +Subject: [PATCH] make ephyr resizeable (600505) + +Author is Vic Lee +taken from +https://bugs.freedesktop.org/show_bug.cgi?id=25804 + +--- + hw/kdrive/ephyr/ephyr.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ + hw/kdrive/ephyr/hostx.c | 24 +++++++++++++--------- + hw/kdrive/ephyr/hostx.h | 10 ++++++++- + 3 files changed, 72 insertions(+), 11 deletions(-) + +diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c +index 254fcbc..14ab591 100644 +--- a/hw/kdrive/ephyr/ephyr.c ++++ b/hw/kdrive/ephyr/ephyr.c +@@ -578,6 +578,8 @@ ephyrRandRSetConfig (ScreenPtr pScreen, + if (wasEnabled) + KdEnableScreen (pScreen); + ++ RRScreenSizeNotify(pScreen); ++ + return TRUE; + + bail4: +@@ -610,6 +612,45 @@ ephyrRandRInit (ScreenPtr pScreen) + pScrPriv->rrSetConfig = ephyrRandRSetConfig; + return TRUE; + } ++ ++static Bool ++ephyrResizeScreen (ScreenPtr pScreen, ++ int newwidth, ++ int newheight) ++{ ++ KdScreenPriv(pScreen); ++ KdScreenInfo *screen = pScreenPriv->screen; ++ RRScreenSize size = {0}; ++ Bool ret; ++ int t; ++ ++ if (screen->randr & (RR_Rotate_90|RR_Rotate_270)) ++ { ++ t = newwidth; ++ newwidth = newheight; ++ newheight = t; ++ } ++ ++ if (newwidth == screen->width && newheight == screen->height) ++ { ++ return FALSE; ++ } ++ ++ size.width = newwidth; ++ size.height = newheight; ++ ++ ret = ephyrRandRSetConfig (pScreen, screen->randr, 0, &size); ++ if (ret) ++ { ++ RROutputPtr output; ++ ++ output = RRFirstOutput(pScreen); ++ if (!output) return FALSE; ++ RROutputSetModes(output, NULL, 0, 0); ++ } ++ ++ return ret; ++} + #endif + + Bool +@@ -1008,6 +1049,14 @@ ephyrPoll(void) + break; + #endif /* XF86DRI */ + ++#ifdef RANDR ++ case EPHYR_EV_CONFIGURE: ++ ephyrResizeScreen (screenInfo.screens[ev.data.configure.screen], ++ ev.data.configure.width, ++ ev.data.configure.height); ++ break; ++#endif /* RANDR */ ++ + default: + break; + } +diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c +index d546370..cdb019d 100644 +--- a/hw/kdrive/ephyr/hostx.c ++++ b/hw/kdrive/ephyr/hostx.c +@@ -348,7 +348,8 @@ hostx_init (void) + |PointerMotionMask + |KeyPressMask + |KeyReleaseMask +- |ExposureMask; ++ |ExposureMask ++ |StructureNotifyMask; + + EPHYR_DBG("mark"); + +@@ -642,7 +643,6 @@ hostx_screen_init (EphyrScreenInfo screen, + { + int bitmap_pad; + Bool shm_success = False; +- XSizeHints *size_hints; + + struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen); + if (!host_screen) +@@ -729,14 +729,6 @@ hostx_screen_init (EphyrScreenInfo screen, + + XResizeWindow (HostX.dpy, host_screen->win, width, height); + +- /* Ask the WM to keep our size static */ +- size_hints = XAllocSizeHints(); +- size_hints->max_width = size_hints->min_width = width; +- size_hints->max_height = size_hints->min_height = height; +- size_hints->flags = PMinSize|PMaxSize; +- XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints); +- XFree(size_hints); +- + XMapWindow(HostX.dpy, host_screen->win); + + XSync(HostX.dpy, False); +@@ -1054,6 +1046,18 @@ hostx_get_event(EphyrHostXEvent *ev) + ev->data.key_up.scancode = xev.xkey.keycode; + return 1; + ++ case ConfigureNotify: ++ { ++ struct EphyrHostScreen *host_screen = ++ host_screen_from_window (xev.xconfigure.window); ++ ev->type = EPHYR_EV_CONFIGURE; ++ ev->data.configure.width = xev.xconfigure.width; ++ ev->data.configure.height = xev.xconfigure.height; ++ ev->data.configure.window = xev.xconfigure.window; ++ ev->data.configure.screen = host_screen->mynum; ++ return 1; ++ } ++ + default: + break; + +diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h +index e65e0c9..69e3ceb 100644 +--- a/hw/kdrive/ephyr/hostx.h ++++ b/hw/kdrive/ephyr/hostx.h +@@ -48,7 +48,8 @@ typedef enum EphyrHostXEventType + EPHYR_EV_MOUSE_RELEASE, + EPHYR_EV_KEY_PRESS, + EPHYR_EV_KEY_RELEASE, +- EPHYR_EV_EXPOSE ++ EPHYR_EV_EXPOSE, ++ EPHYR_EV_CONFIGURE + } + EphyrHostXEventType; + +@@ -93,6 +94,13 @@ struct EphyrHostXEvent + int window; + } expose; + ++ struct configure { ++ int width; ++ int height; ++ int screen; ++ int window; ++ } configure; ++ + } data; + + int key_state; +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-modifier-keycount.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-modifier-keycount.patch new file mode 100644 index 00000000..5f607fe3 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-modifier-keycount.patch @@ -0,0 +1,58 @@ +From dab76a0ce7d784133313f743d2bf876c1bd7f5e5 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 10 Jun 2010 12:21:36 +1000 +Subject: [PATCH] Xi: don't copy the modifier key count when copying device classes (#25480) + +The modifier key count is maintained by the XKB layer and +increased/decreased for all modifiers that set state. + +Test case, MD/SD modifier key count in comment: +1. keyboard 1: press and hold Shift_L # SD:1 MD:1 +2. keyboard 2: press and release Shift_L # SD:1,0 MD:1,0 + # SD:1 MD:1 +3. keyboard 1: release Shift_L # SD:0 MD:1 +4. keyboard 1: press and release Shift_L # SD:1,0 MD:2,1 + +The modifier is now logically down on the MD but not on keyboard 1 or +keyboard 2. + +XKB is layered in before the DIX, it increases/decreases the modifier key +count accordingly. In the above example, during (2), the MD gets the key +release and thus clears the modifier bit. (3) doesn't forward the release to +the MD because it is already cleared. The copy of modifierKeysDown when the +lastSlave changes however increases the counter for the held key. On (4), +the press and release are both forwarded to the MD, causing a offset by 1 +and thus do not clear the logical modifier state. + +X.Org Bug 25480 + +Signed-off-by: Peter Hutterer +Acked-by: Daniel Stone +--- + Xi/exevents.c | 4 ---- + 1 files changed, 0 insertions(+), 4 deletions(-) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index e680f6f..566b0ef 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -196,16 +196,12 @@ void + CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) + { + KeyClassPtr mk = master->key; +- KeyClassPtr dk = device->key; +- int i; + + if (device == master) + return; + + mk->sourceid = device->id; + +- for (i = 0; i < 8; i++) +- mk->modifierKeyCount[i] = dk->modifierKeyCount[i]; + + if (!XkbCopyDeviceKeymap(master, device)) + FatalError("Couldn't pivot keymap from device to core!\n"); +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-postfix-DCE-PointerKeys.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-postfix-DCE-PointerKeys.patch new file mode 100644 index 00000000..6f3906dd --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-postfix-DCE-PointerKeys.patch @@ -0,0 +1,118 @@ +From 31aebe89b716989e81e5de889e4f7e03d154a482 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Mon, 26 Jul 2010 10:48:41 +1000 +Subject: [PATCH] xkb: post-fix PointerKeys button events with a DeviceChangedEvent. + +commit 14327858391ebe929b806efb53ad79e789361883 + xkb: release XTEST pointer buttons on physical releases. (#28808) +revealed a bug with the XTEST/PointerKeys interaction. + +Events resulting from PointerKeys are injected into the event processing +stream, not appended to the event queue. The events generated for the fake +button press include a DeviceChangedEvent (DCE), a raw button event and the +button event itself. The DCE causes the master to switch classes to the +attached XTEST pointer device. + +Once the fake button is processed, normal event processing continues with +events in the EQ. The master still contains the XTEST classes, causing some +events to be dropped if e.g. the number of valuators of the event in the +queue exceeds the XTEST device's number of valuators. + +Example: the EQ contains the following events, processed one-by-one, left to +right. + +[DCE (dev)][Btn down][Btn up][Motion][Motion][...] + ^ XkbFakeDeviceButton injects [DCE (XTEST)][Btn up] + +Thus the event sequence processed looks like this: + +[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][Motion][Motion][...] + +The first DCE causes the master to switch to the device. The button up event +injects a DCE to the XTEST device, causing the following Motion events to be +processed with the master still being on XTEST classes. + +This patch post-fixes the injected event sequence with a DCE to restore the +classes of the original slave device, resulting in an event sequence like +this: +[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][DCE (dev)][Motion][Motion] + +Note that this is a simplified description. The event sequence injected by +the PointerKeys code is injected for the master device only and the matching +slave device that caused the injection has already finished processing on +the slave. Furthermore, the injection happens as part of the the XKB layer, +before the unwrapping of the processInputProc takes us into the DIX where +the DCE is actually handled. + +Bug reproducible with a device that reports more than 2 valuators. Simply +cause button releases on the device and wait for a "too many valuators" +warning message. + +Signed-off-by: Peter Hutterer +--- + xkb/xkbActions.c | 28 +++++++++++++++++++++------- + 1 files changed, 21 insertions(+), 7 deletions(-) + +diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c +index 33ad5c5..0bbca29 100644 +--- a/xkb/xkbActions.c ++++ b/xkb/xkbActions.c +@@ -1366,34 +1366,48 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) + { + EventListPtr events; + int nevents, i; +- DeviceIntPtr ptr; ++ DeviceIntPtr ptr, mpointer, lastSlave; + + /* If dev is a slave device, and the SD is attached, do nothing. If we'd + * post through the attached master pointer we'd get duplicate events. + * + * if dev is a master keyboard, post through the XTEST device +- * + * if dev is a floating slave, post through the device itself. ++ * ++ * The event is injected into the event processing, not the EQ. Thus, ++ * ensure that we restore the master after the event sequence to the ++ * original set of classes. Otherwise, the master remains on the XTEST ++ * classes and drops events that don't fit into the XTEST layout (e.g. ++ * events with more than 2 valuators). ++ * To do so, we remember the lastSlave that posted through the master ++ * and add a DeviceChangedEvent to the end of the list. + */ + +- if (IsMaster(dev)) +- ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); +- else if (!dev->u.master) ++ if (IsMaster(dev)) { ++ mpointer = GetMaster(dev, MASTER_POINTER); ++ lastSlave = mpointer->u.lastSlave; ++ ptr = GetXTestDevice(mpointer); ++ } else if (!dev->u.master) + ptr = dev; + else + return; + +- events = InitEventList(GetMaximumEventsNum()); ++ /* xkb fake device buttons are one-shot events. Force a DCE after they ++ * happen to restore the device to it's previous source */ ++ events = InitEventList(GetMaximumEventsNum() + 1); + OsBlockSignals(); + nevents = GetPointerEvents(events, ptr, + press ? ButtonPress : ButtonRelease, button, + 0 /* flags */, 0 /* first */, + 0 /* num_val */, NULL); ++ if (IsMaster(dev) && (lastSlave && lastSlave != ptr)) ++ CreateClassesChangedEvent(&events[nevents++], mpointer, ++ lastSlave, DEVCHANGE_POINTER_EVENT); + OsReleaseSignals(); + + + for (i = 0; i < nevents; i++) + mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); + +- FreeEventList(events, GetMaximumEventsNum()); ++ FreeEventList(events, GetMaximumEventsNum() + 1); + } +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-property-generation-reset.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-property-generation-reset.patch new file mode 100644 index 00000000..c8105f73 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-property-generation-reset.patch @@ -0,0 +1,83 @@ +From 3743ce98a24b3e3767b2a278af8d888e4e8bd335 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 7 May 2010 16:22:12 +1000 +Subject: [PATCH] Xi: reset the known properties at the end of the server generation. + +NOTE: this has a second patch squashed in, see +http://lists.freedesktop.org/archives/xorg-devel/2010-June/009838.html + + +Properties allocated through XIGetKnownProperty() aren't reset on the second +server generation but keep the old value. As a result, wrong Atoms are +supplied to the driver, resulting in potential data corruption or weird +error message. + +Reproducible by running "xlsatom | grep FLOAT" twice on a plain X server. +The second X server generation won't have the FLOAT atom defined anymore, +despite the users of this atom not noticing any errors. + +Signed-off-by: Peter Hutterer +Reviewed-by: Julien Cristau +Signed-off-by: Keith Packard +--- + Xi/extinit.c | 3 ++- + Xi/xiproperty.c | 9 +++++++++ + Xi/xiproperty.h | 3 +++ + 3 files changed, 14 insertions(+), 1 deletions(-) + +diff --git a/Xi/extinit.c b/Xi/extinit.c +index 0c12919..daa79f6 100644 +--- a/Xi/extinit.c ++++ b/Xi/extinit.c +@@ -1123,7 +1123,6 @@ RestoreExtensionEvents(void) + static void + IResetProc(ExtensionEntry * unused) + { +- + ReplySwapVector[IReqCode] = ReplyNotSwappd; + EventSwapVector[DeviceValuator] = NotImplemented; + EventSwapVector[DeviceKeyPress] = NotImplemented; +@@ -1302,6 +1301,8 @@ XInputExtensionInit(void) + + inputInfo.all_devices = &xi_all_devices; + inputInfo.all_master_devices = &xi_all_master_devices; ++ ++ XIResetProperties(); + } else { + FatalError("IExtensionInit: AddExtensions failed\n"); + } +diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c +index ea66c54..2482171 100644 +--- a/Xi/xiproperty.c ++++ b/Xi/xiproperty.c +@@ -392,6 +392,15 @@ XIGetKnownProperty(char *name) + return 0; + } + ++void ++XIResetProperties(void) ++{ ++ int i; ++ ++ for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++) ++ dev_properties[i].type = None; ++} ++ + /** + * Convert the given property's value(s) into @nelem_return integer values and + * store them in @buf_return. If @nelem_return is larger than the number of +diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h +index 69b41fa..d8b8863 100644 +--- a/Xi/xiproperty.h ++++ b/Xi/xiproperty.h +@@ -62,4 +62,7 @@ void SRepXIListProperties(ClientPtr client, int size, + xXIListPropertiesReply *rep); + void SRepXIGetProperty(ClientPtr client, int size, + xXIGetPropertyReply *rep); ++ ++void XIResetProperties(void); ++ + #endif /* XIPROPERTY_H */ +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-cursor-dead-zones.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-cursor-dead-zones.patch new file mode 100644 index 00000000..975b1cd0 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-cursor-dead-zones.patch @@ -0,0 +1,381 @@ +From ca589bdc757401aebd7daa0dafaa860b5c8ec15a Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Thu, 5 Aug 2010 13:45:22 -0400 +Subject: [PATCH 1/2] randr: Add additional cursor constraint logic + +Signed-off-by: Adam Jackson +--- + include/scrnintstr.h | 11 +++- + mi/mibstore.c | 1 - + mi/mipointer.c | 3 + + mi/mipointrst.h | 4 +- + mi/miscrinit.c | 1 - + randr/randr.c | 2 + + randr/randrstr.h | 4 + + randr/rrcrtc.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 8 files changed, 207 insertions(+), 5 deletions(-) + +diff --git a/include/scrnintstr.h b/include/scrnintstr.h +index ab50e7a..1e2d645 100644 +--- a/include/scrnintstr.h ++++ b/include/scrnintstr.h +@@ -446,6 +446,11 @@ typedef void (* DeviceCursorCleanupProcPtr)( + DeviceIntPtr /* pDev */, + ScreenPtr /* pScreen */); + ++typedef struct _miPointer *miPointerPtr; ++ ++typedef void (*ConstrainCursorHarderProcPtr)( ++ miPointerPtr, ScreenPtr, int *, int *); ++ + typedef struct _Screen { + int myNum; /* index of this instance in Screens[] */ + ATOM id; +@@ -506,9 +511,13 @@ typedef struct _Screen { + CreatePixmapProcPtr CreatePixmap; + DestroyPixmapProcPtr DestroyPixmap; + +- /* Backing store procedures */ ++ /* Reuse the SDA slot for CCH for minimal ABI hassle */ ++ ConstrainCursorHarderProcPtr ConstrainCursorHarder; + ++ /* Backing store procedures */ ++#if 0 + SaveDoomedAreasProcPtr SaveDoomedAreas; ++#endif + RestoreAreasProcPtr RestoreAreas; + ExposeCopyProcPtr ExposeCopy; + TranslateBackingStoreProcPtr TranslateBackingStore; +diff --git a/mi/mibstore.c b/mi/mibstore.c +index 262b494..1388189 100644 +--- a/mi/mibstore.c ++++ b/mi/mibstore.c +@@ -40,7 +40,6 @@ + void + miInitializeBackingStore (ScreenPtr pScreen) + { +- pScreen->SaveDoomedAreas = NULL; + pScreen->RestoreAreas = NULL; + pScreen->ExposeCopy = NULL; + pScreen->TranslateBackingStore = NULL; +diff --git a/mi/mipointer.c b/mi/mipointer.c +index e1f63be..3c4552a 100644 +--- a/mi/mipointer.c ++++ b/mi/mipointer.c +@@ -534,6 +534,9 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y) + if (*y >= pPointer->limits.y2) + *y = pPointer->limits.y2 - 1; + ++ if (pScreen->ConstrainCursorHarder) ++ pScreen->ConstrainCursorHarder(pPointer, pScreen, x, y); ++ + if (pPointer->x == *x && pPointer->y == *y && + pPointer->pScreen == pScreen) + return; +diff --git a/mi/mipointrst.h b/mi/mipointrst.h +index bd9c24a..f643c01 100644 +--- a/mi/mipointrst.h ++++ b/mi/mipointrst.h +@@ -35,7 +35,7 @@ in this Software without prior written authorization from The Open Group. + #include "mipointer.h" + #include "scrnintstr.h" + +-typedef struct { ++typedef struct _miPointer { + ScreenPtr pScreen; /* current screen */ + ScreenPtr pSpriteScreen;/* screen containing current sprite */ + CursorPtr pCursor; /* current cursor */ +@@ -44,7 +44,7 @@ typedef struct { + Bool confined; /* pointer can't change screens */ + int x, y; /* hot spot location */ + int devx, devy; /* sprite position */ +-} miPointerRec, *miPointerPtr; ++} miPointerRec /* , *miPointerPtr */; + + typedef struct { + miPointerSpriteFuncPtr spriteFuncs; /* sprite-specific methods */ +diff --git a/mi/miscrinit.c b/mi/miscrinit.c +index 96113d6..71a3e07 100644 +--- a/mi/miscrinit.c ++++ b/mi/miscrinit.c +@@ -281,7 +281,6 @@ miScreenInit( + pScreen->SetShape = miSetShape; + pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; + +- pScreen->SaveDoomedAreas = 0; + pScreen->RestoreAreas = 0; + pScreen->ExposeCopy = 0; + pScreen->TranslateBackingStore = 0; +diff --git a/randr/randr.c b/randr/randr.c +index a21753f..3489d7e 100644 +--- a/randr/randr.c ++++ b/randr/randr.c +@@ -269,6 +269,8 @@ Bool RRScreenInit(ScreenPtr pScreen) + + wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen); + ++ pScreen->ConstrainCursorHarder = RRConstrainCursorHarder; ++ + pScrPriv->numOutputs = 0; + pScrPriv->outputs = NULL; + pScrPriv->numCrtcs = 0; +diff --git a/randr/randrstr.h b/randr/randrstr.h +index 975fe33..e30dfd0 100644 +--- a/randr/randrstr.h ++++ b/randr/randrstr.h +@@ -299,6 +299,7 @@ typedef struct _rrScrPriv { + int rate; + int size; + #endif ++ Bool discontiguous; + } rrScrPrivRec, *rrScrPrivPtr; + + extern _X_EXPORT DevPrivateKey rrPrivKey; +@@ -731,6 +732,9 @@ ProcRRGetPanning (ClientPtr client); + int + ProcRRSetPanning (ClientPtr client); + ++void ++RRConstrainCursorHarder (miPointerPtr, ScreenPtr, int *, int *); ++ + /* rrdispatch.c */ + extern _X_EXPORT Bool + RRClientKnowsRates (ClientPtr pClient); +diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c +index 0e14b36..2a4f884 100644 +--- a/randr/rrcrtc.c ++++ b/randr/rrcrtc.c +@@ -1,5 +1,6 @@ + /* + * Copyright © 2006 Keith Packard ++ * Copyright 2010 Red Hat, Inc + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that +@@ -23,6 +24,7 @@ + #include "randrstr.h" + #include "swaprep.h" + #include "registry.h" ++#include "mipointrst.h" + + RESTYPE RRCrtcType; + +@@ -295,6 +297,102 @@ RRCrtcPendingProperties (RRCrtcPtr crtc) + return FALSE; + } + ++/* overlapping counts as adjacent */ ++static Bool ++crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b) ++{ ++ int al = a->x, ar = a->x + a->mode->mode.width; ++ int bl = b->x, br = b->x + b->mode->mode.width; ++ int at = a->y, ab = a->y + a->mode->mode.height; ++ int bt = b->y, bb = b->y + b->mode->mode.height; ++ ++ int cl = max(al, bl); ++ int cr = min(ar, br); ++ int ct = max(at, ct); ++ int cb = min(ab, bb); ++ ++ return (cl <= cr) && (ct <= cb); ++} ++ ++/* ++ * This isn't really multiplication, but we don't need it to be. All ++ * we need is a boolean for connectivity, not an integer for number of ++ * paths. As a result we can scale to gratuitously large n without ++ * worrying about integer overflow. ++ */ ++static Bool ++matrix_pseudomultiply(char *left, const char *right, int n) ++{ ++ int i, j, k; ++ char *res = calloc(1, n * n); ++ ++ if (!res) ++ return FALSE; ++ ++ for (i = 0; i < n; i++) ++ for (j = 0; j < n; j++) ++ for (k = 0; k < n; k++) ++ res[i*n + j] |= left[i*n + k] && right[k*n + j]; ++ ++ memcpy(left, res, n * n); ++ ++ free(res); ++ ++ return TRUE; ++} ++ ++static void ++RRComputeContiguity (ScreenPtr pScreen) ++{ ++ rrScrPriv(pScreen); ++ Bool discontiguous = TRUE; ++ int i, j, n = pScrPriv->numCrtcs; ++ RRCrtcPtr a, b; ++ char *matrix = NULL, *m = NULL; ++ ++ matrix = calloc(1, n*n); ++ m = calloc(1, n*n); ++ if (!matrix || !m) ++ goto out; ++ ++ /* compute adjacency matrix; everything is adjacent with itself */ ++ for (i = 0; i < n; i++) { ++ a = pScrPriv->crtcs[i]; ++ ++ if (!a->mode) ++ continue; ++ ++ for (j = 0; j < n; j++) { ++ b = pScrPriv->crtcs[j]; ++ ++ if (!b->mode) ++ continue; ++ ++ if (a == b || crtcs_adjacent(a, b)) ++ matrix[i*n + j] = 1; ++ } ++ } ++ ++ memcpy(m, matrix, n*n); ++ ++ /* raise it to the n-1th; finds connected paths */ ++ for (i = 0; i < n-1; i++) ++ if (!matrix_pseudomultiply(m, matrix, n)) ++ goto out; ++ ++ /* check for connectivity */ ++ for (i = 0; i < n; i++) ++ if (pScrPriv->crtcs[i]->mode && !m[i]) ++ goto out; ++ ++ discontiguous = FALSE; ++ ++out: ++ free(matrix); ++ free(m); ++ pScrPriv->discontiguous = discontiguous; ++} ++ + /* + * Request that the Crtc be reconfigured + */ +@@ -309,6 +407,7 @@ RRCrtcSet (RRCrtcPtr crtc, + { + ScreenPtr pScreen = crtc->pScreen; + Bool ret = FALSE; ++ Bool recompute = TRUE; + rrScrPriv(pScreen); + + /* See if nothing changed */ +@@ -322,6 +421,7 @@ RRCrtcSet (RRCrtcPtr crtc, + !RRCrtcPendingTransform (crtc)) + { + ret = TRUE; ++ recompute = FALSE; + } + else + { +@@ -384,6 +484,10 @@ RRCrtcSet (RRCrtcPtr crtc, + RRPostPendingProperties (outputs[o]); + } + } ++ ++ if (recompute) ++ RRComputeContiguity(pScreen); ++ + return ret; + } + +@@ -1387,3 +1491,85 @@ ProcRRGetCrtcTransform (ClientPtr client) + xfree(reply); + return client->noClientException; + } ++ ++static void ++crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom) ++{ ++ *left = crtc->x; ++ *top = crtc->y; ++ ++ switch (crtc->rotation) { ++ case RR_Rotate_0: ++ case RR_Rotate_180: ++ *right = crtc->x + crtc->mode->mode.width; ++ *bottom = crtc->y + crtc->mode->mode.height; ++ return; ++ case RR_Rotate_90: ++ case RR_Rotate_270: ++ *right = crtc->x + crtc->mode->mode.height; ++ *bottom = crtc->y + crtc->mode->mode.width; ++ default: ++ return; ++ } ++} ++ ++void ++RRConstrainCursorHarder(miPointerPtr pDev, ScreenPtr pScreen, int *x, int *y) ++{ ++ rrScrPriv (pScreen); ++ int i; ++ ++ /* intentional dead space -> let it float */ ++ if (pScrPriv->discontiguous) ++ return; ++ ++ /* if we're moving inside a crtc, we're fine */ ++ for (i = 0; i < pScrPriv->numCrtcs; i++) { ++ RRCrtcPtr crtc = pScrPriv->crtcs[i]; ++ ++ int left, right, top, bottom; ++ ++ if (!crtc->mode) ++ continue; ++ ++ crtc_bounds(crtc, &left, &right, &top, &bottom); ++ ++ if ((*x >= left) && (*x <= right) && (*y >= top) && (*y <= bottom)) ++ return; ++ } ++ ++ /* if we're trying to escape, clamp to the CRTC we're coming from */ ++ for (i = 0; i < pScrPriv->numCrtcs; i++) { ++ RRCrtcPtr crtc = pScrPriv->crtcs[i]; ++ int nx = pDev->x; ++ int ny = pDev->y; ++ int left, right, top, bottom; ++ ++ if (!crtc->mode) ++ continue; ++ ++ crtc_bounds(crtc, &left, &right, &top, &bottom); ++ ++ if ((nx >= left) && (nx <= right) && (ny >= top) && (ny <= bottom)) { ++ if ((*x <= left) || (*x >= right)) { ++ int dx = *x - nx; ++ ++ if (dx > 0) ++ *x = right; ++ else if (dx < 0) ++ *x = left; ++ } ++ ++ if ((*y <= top) || (*y >= bottom)) { ++ int dy = *y - ny; ++ ++ if (dy > 0) ++ *y = bottom; ++ else if (dy < 0) ++ *y = top; ++ } ++ ++ return; ++ } ++ } ++} +-- +1.7.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-initial.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-initial.patch new file mode 100644 index 00000000..1004f611 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-randr-initial.patch @@ -0,0 +1,37 @@ +From 96cf3862b5807857dd39e55fa4b2d95ab7978708 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Mon, 7 Jun 2010 10:10:10 +1000 +Subject: [PATCH] randr: prevent an unnecessary screen resize with multiple displays + +crtc->{x,y} is always 0 when xf86DefaultScreenLimits() is called, so we +calculate too small an area for the initial framebuffer and force a resize +to happen. + +This commit fixes the code to use desired{X,Y} instead, which contains the +initial output positions. + +Signed-off-by: Ben Skeggs +Reviewed-by: Dave Airlie +Reviewed-by: Keith Packard +--- + hw/xfree86/modes/xf86Crtc.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c +index 304d503..cd978ae 100644 +--- a/hw/xfree86/modes/xf86Crtc.c ++++ b/hw/xfree86/modes/xf86Crtc.c +@@ -1038,8 +1038,8 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp, + + if (crtc->enabled) + { +- crtc_width = crtc->x + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation); +- crtc_height = crtc->y + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation); ++ crtc_width = crtc->desiredX + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation); ++ crtc_height = crtc->desiredY + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation); + } + if (!canGrow) { + for (o = 0; o < config->num_output; o++) +-- +1.7.0.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-release-xtest-on-phys-buttons.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-release-xtest-on-phys-buttons.patch new file mode 100644 index 00000000..6f561a86 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-release-xtest-on-phys-buttons.patch @@ -0,0 +1,93 @@ +From 005073e94bde03b52ae8f5b6ae98abc2f75f7355 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 1 Jul 2010 12:44:57 +1000 +Subject: [PATCH] xkb: release XTEST pointer buttons on physical releases. + +If a button release event is posted for the MD pointer, post a release event +through the matching XTEST device. This way, a client who posts a button +press through the XTEST extension cannot inadvertedly lock the button. + +This behaviour is required for historical reasons, until server 1.7 the core +pointer would release a button press on physical events, regardless of the +XTEST state. + +Signed-off-by: Peter Hutterer +--- + include/xkbsrv.h | 6 ++++++ + xkb/xkbAccessX.c | 20 +++++++------------- + xkb/xkbActions.c | 4 ++-- + 3 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index aab833f..7a5d351 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -941,6 +941,12 @@ extern int XkbGetEffectiveGroup( + extern void XkbMergeLockedPtrBtns( + DeviceIntPtr /* master */); + ++extern void XkbFakeDeviceButton( ++ DeviceIntPtr /* dev */, ++ int /* press */, ++ int /* button */); ++ ++ + #include "xkbfile.h" + #include "xkbrules.h" + +diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c +index 670f368..dae85f3 100644 +--- a/xkb/xkbAccessX.c ++++ b/xkb/xkbAccessX.c +@@ -710,19 +710,13 @@ DeviceEvent *event = &ev->device_event; + if (xkbi) { + xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7)); + +- /* Merge this MD's lockedPtrButtons with the one of all +- * attached slave devices. +- * The DIX uses a merged button state for MDs, not +- * releasing buttons until the last SD has released +- * thenm. If we unconditionally clear the +- * lockedPtrButtons bit on the MD, a PointerKeys button +- * release on the SD keyboard won't generate the required fake button +- * event on the XTEST pointer, thus never processing the +- * button event in the DIX and the XTEST pointer's +- * buttons stay down - result is a stuck button. +- */ +- if (IsMaster(dev)) +- XkbMergeLockedPtrBtns(dev); ++ if (IsMaster(dev)) ++ { ++ DeviceIntPtr source; ++ dixLookupDevice(&source, event->sourceid, serverClient, DixWriteAccess); ++ if (!IsXTestDevice(source, GetMaster(dev, MASTER_POINTER))) ++ XkbFakeDeviceButton(dev, FALSE, event->detail.key); ++ } + } + + changed |= XkbPointerButtonMask; +diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c +index e68b782..33ad5c5 100644 +--- a/xkb/xkbActions.c ++++ b/xkb/xkbActions.c +@@ -46,7 +46,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. + static int xkbDevicePrivateKeyIndex; + DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKeyIndex; + +-static void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button); ++void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button); + static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y); + + void +@@ -1361,7 +1361,7 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) + FreeEventList(events, GetMaximumEventsNum()); + } + +-static void ++void + XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) + { + EventListPtr events; +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-reset-unused-classes.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-reset-unused-classes.patch new file mode 100644 index 00000000..e22fae90 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-reset-unused-classes.patch @@ -0,0 +1,71 @@ +From 742150bab3b2d184a8ff7b6224151c2bb395aab6 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Wed, 28 Jul 2010 14:24:59 +1000 +Subject: [PATCH] Xi: reset the unused classes pointer after copying + +After copying the unused_classes into the device, reset the original +pointer. Otherwise we have two pointers pointing to the same field and both +get freed on device removal. + +Some classes already have this behaviour since 51c8fd69. + +Signed-off-by: Fedora X Ninjas +--- + Xi/exevents.c | 6 ++++++ + 1 files changed, 6 insertions(+), 0 deletions(-) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index 566b0ef..a6160dd 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -227,6 +227,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) + classes = dixLookupPrivate(&to->devPrivates, + UnusedClassesPrivateKey); + to->intfeed = classes->intfeed; ++ classes->intfeed = NULL; + } + + i = &to->intfeed; +@@ -263,6 +264,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) + classes = dixLookupPrivate(&to->devPrivates, + UnusedClassesPrivateKey); + to->stringfeed = classes->stringfeed; ++ classes->stringfeed = NULL; + } + + s = &to->stringfeed; +@@ -299,6 +301,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) + classes = dixLookupPrivate(&to->devPrivates, + UnusedClassesPrivateKey); + to->bell = classes->bell; ++ classes->bell = NULL; + } + + b = &to->bell; +@@ -336,6 +339,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) + classes = dixLookupPrivate(&to->devPrivates, + UnusedClassesPrivateKey); + to->leds = classes->leds; ++ classes->leds = NULL; + } + + l = &to->leds; +@@ -387,6 +391,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) + to->kbdfeed = classes->kbdfeed; + if (!to->kbdfeed) + InitKeyboardDeviceStruct(to, NULL, NULL, NULL); ++ classes->kbdfeed = NULL; + } + + k = &to->kbdfeed; +@@ -517,6 +522,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) + classes = dixLookupPrivate(&to->devPrivates, + UnusedClassesPrivateKey); + to->ptrfeed = classes->ptrfeed; ++ classes->ptrfeed = NULL; + } + + p = &to->ptrfeed; +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-sd-keyboard-controls.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-sd-keyboard-controls.patch new file mode 100644 index 00000000..93a49f0b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-sd-keyboard-controls.patch @@ -0,0 +1,40 @@ +From 03d384b3f37bb6213d52589955eb658985998c5e Mon Sep 17 00:00:00 2001 +From: Nicolas George +Date: Wed, 2 Jun 2010 13:40:51 +0200 +Subject: [PATCH] Change keyboard controls on slave keyboards (#27926) + +Makes the use of IsMaster in ProcChangeKeyboardControl consistent with other +similar loops. + +Signed-off-by: Nicolas George +Reviewed-by: Peter Hutterer +Signed-off-by: Peter Hutterer +--- + dix/devices.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dix/devices.c b/dix/devices.c +index 87b6dc7..1037e42 100644 +--- a/dix/devices.c ++++ b/dix/devices.c +@@ -1956,7 +1956,7 @@ ProcChangeKeyboardControl (ClientPtr client) + keyboard = PickKeyboard(client); + + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { +- if ((pDev == keyboard || (!IsMaster(keyboard) && pDev->u.master == keyboard)) && ++ if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) && + pDev->kbdfeed && pDev->kbdfeed->CtrlProc) { + ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); + if (ret != Success) +@@ -1965,7 +1965,7 @@ ProcChangeKeyboardControl (ClientPtr client) + } + + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { +- if ((pDev == keyboard || (!IsMaster(keyboard) && pDev->u.master == keyboard)) && ++ if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) && + pDev->kbdfeed && pDev->kbdfeed->CtrlProc) { + ret = DoChangeKeyboardControl(client, pDev, vlist, vmask); + if (ret != Success) +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-showopts-segv.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-showopts-segv.patch new file mode 100644 index 00000000..18fec5f3 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-showopts-segv.patch @@ -0,0 +1,37 @@ +From 657d9ece7d8198a5ee9cef3cbbef2c1b81766e77 Mon Sep 17 00:00:00 2001 +From: Alan Coopersmith +Date: Sat, 12 Jun 2010 08:19:16 -0700 +Subject: [PATCH] Don't coredump on "X -showopts" (bug 25874) + +Don't try walking the xf86ConfigLayout.screens table if it's empty +https://bugs.freedesktop.org/show_bug.cgi?id=25874 + +Signed-off-by: Alan Coopersmith +Reviewed-by: Tiago Vignatti +Signed-off-by: Keith Packard +(cherry picked from commit b8615d592700b7be319c04cc0563fdeb5a266534) +--- + hw/xfree86/common/xf86Helper.c | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c +index 1cc1526..512b39e 100644 +--- a/hw/xfree86/common/xf86Helper.c ++++ b/hw/xfree86/common/xf86Helper.c +@@ -1447,6 +1447,13 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist) + if (xf86DoConfigure && xf86DoConfigurePass1) return 1; + + /* ++ * This can happen when running Xorg -showopts and a module like ati ++ * or vmware tries to load its submodules when xf86ConfigLayout is empty ++ */ ++ if (!xf86ConfigLayout.screens) ++ return 0; ++ ++ /* + * This is a very important function that matches the device sections + * as they show up in the config file with the drivers that the server + * loads at run time. +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xephyr-24bpp.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xephyr-24bpp.patch new file mode 100644 index 00000000..61c84a67 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xephyr-24bpp.patch @@ -0,0 +1,83 @@ +From bb0c8f36cca4027be3f70cfea63516508170e1f8 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 12 Jul 2010 10:01:53 -0400 +Subject: [PATCH] kdrive/ephyr: Fix crash on 24bpp host framebuffer + +bytes_per_line in the XImage will (more or less) reflect the pixmap +format of the server. On 24bpp servers it will be approximately 3*width +(plus scanline padding); we were assuming depth 24 always meant 32bpp, +so the exposure painting in root window map would walk off the end of +the image and crash. + +Signed-off-by: Adam Jackson +--- + hw/kdrive/ephyr/ephyr.c | 9 ++++++--- + hw/kdrive/ephyr/hostx.c | 4 +++- + hw/kdrive/ephyr/hostx.h | 2 +- + 3 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c +index 14ab591..a6057db 100644 +--- a/hw/kdrive/ephyr/ephyr.c ++++ b/hw/kdrive/ephyr/ephyr.c +@@ -234,8 +234,6 @@ ephyrMapFramebuffer (KdScreenInfo *screen) + KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height); + KdSetPointerMatrix (&m); + +- priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2; +- + /* point the framebuffer to the data in an XImage */ + /* If fakexa is enabled, allocate a larger buffer so that fakexa has space to + * put offscreen pixmaps. +@@ -245,7 +243,12 @@ ephyrMapFramebuffer (KdScreenInfo *screen) + else + buffer_height = 3 * screen->height; + +- priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height); ++ priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height, &priv->bytes_per_line); ++ ++ /* laaaaaame */ ++ if (screen->fb[0].depth == 24) ++ if (priv->bytes_per_line < (screen->width * 4)) ++ screen->fb[0].bitsPerPixel = 24; + + screen->memory_base = (CARD8 *) (priv->base); + screen->memory_size = priv->bytes_per_line * buffer_height; +diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c +index cdb019d..874c754 100644 +--- a/hw/kdrive/ephyr/hostx.c ++++ b/hw/kdrive/ephyr/hostx.c +@@ -639,7 +639,7 @@ hostx_set_cmap_entry(unsigned char idx, + void* + hostx_screen_init (EphyrScreenInfo screen, + int width, int height, +- int buffer_height) ++ int buffer_height, int *bytes_per_line) + { + int bitmap_pad; + Bool shm_success = False; +@@ -727,6 +727,8 @@ hostx_screen_init (EphyrScreenInfo screen, + malloc (host_screen->ximg->bytes_per_line * buffer_height); + } + ++ *bytes_per_line = host_screen->ximg->bytes_per_line; ++ + XResizeWindow (HostX.dpy, host_screen->win, width, height); + + XMapWindow(HostX.dpy, host_screen->win); +diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h +index 69e3ceb..b0627da 100644 +--- a/hw/kdrive/ephyr/hostx.h ++++ b/hw/kdrive/ephyr/hostx.h +@@ -203,7 +203,7 @@ hostx_set_cmap_entry(unsigned char idx, + void* + hostx_screen_init (EphyrScreenInfo screen, + int width, int height, +- int buffer_height); ++ int buffer_height, int *bytes_per_line); + + void + hostx_paint_rect(EphyrScreenInfo screen, +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-geom-copy.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-geom-copy.patch new file mode 100644 index 00000000..5db9cec4 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-geom-copy.patch @@ -0,0 +1,114 @@ +From 34fa79f3f914b6a739d101cd78b7dbda6eca4760 Mon Sep 17 00:00:00 2001 +From: Dirk Wallenstein +Date: Sat, 17 Apr 2010 21:36:23 +0200 +Subject: [PATCH] xkb: Fix omissions in geometry initialization #27679 + +_XkbCopyGeom did not copy all of the data from the source geometry. This +resulted in failures when trying to obtain the keymap from a server +where the default geometry has not been replaced by a custom +configuration. + +Signed-off-by: Dirk Wallenstein +Reviewed-by: Daniel Stone +Signed-off-by: Peter Hutterer +--- + xkb/xkbUtils.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 1 files changed, 39 insertions(+), 2 deletions(-) + +diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c +index 1abb5a8..fe093a4 100644 +--- a/xkb/xkbUtils.c ++++ b/xkb/xkbUtils.c +@@ -1601,6 +1601,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + else { + dcolor->spec = xstrdup(scolor->spec); + } ++ dcolor->pixel = scolor->pixel; + } + + dst->geom->num_colors = dst->geom->sz_colors; +@@ -1672,6 +1673,8 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + + memcpy(doutline->points, soutline->points, + soutline->num_points * sizeof(XkbPointRec)); ++ ++ doutline->corner_radius = soutline->corner_radius; + } + + doutline->num_points = soutline->num_points; +@@ -1681,6 +1684,36 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + + dshape->num_outlines = sshape->num_outlines; + dshape->sz_outlines = sshape->num_outlines; ++ dshape->name = sshape->name; ++ dshape->bounds = sshape->bounds; ++ ++ dshape->approx = NULL; ++ if (sshape->approx && sshape->num_outlines > 0) { ++ ++ const ptrdiff_t approx_idx = ++ sshape->approx - sshape->outlines; ++ ++ if (approx_idx < dshape->num_outlines) { ++ dshape->approx = dshape->outlines + approx_idx; ++ } else { ++ LogMessage(X_WARNING, "XKB: approx outline " ++ "index is out of range\n"); ++ } ++ } ++ ++ dshape->primary = NULL; ++ if (sshape->primary && sshape->num_outlines > 0) { ++ ++ const ptrdiff_t primary_idx = ++ sshape->primary - sshape->outlines; ++ ++ if (primary_idx < dshape->num_outlines) { ++ dshape->primary = dshape->outlines + primary_idx; ++ } else { ++ LogMessage(X_WARNING, "XKB: primary outline " ++ "index is out of range\n"); ++ } ++ } + } + + dst->geom->num_shapes = src->geom->num_shapes; +@@ -1784,6 +1817,10 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + } + drow->num_keys = srow->num_keys; + drow->sz_keys = srow->num_keys; ++ drow->top = srow->top; ++ drow->left = srow->left; ++ drow->vertical = srow->vertical; ++ drow->bounds = srow->bounds; + } + + if (ssection->num_doodads) { +@@ -1802,6 +1839,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + ddoodad = dsection->doodads; + k < ssection->num_doodads; + k++, sdoodad++, ddoodad++) { ++ memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); + if (sdoodad->any.type == XkbTextDoodad) { + if (sdoodad->text.text) + ddoodad->text.text = +@@ -1815,7 +1853,6 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + ddoodad->logo.logo_name = + xstrdup(sdoodad->logo.logo_name); + } +- ddoodad->any.type = sdoodad->any.type; + } + dsection->overlays = NULL; + dsection->sz_overlays = 0; +@@ -1880,7 +1917,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + ddoodad = dst->geom->doodads; + i < src->geom->num_doodads; + i++, sdoodad++, ddoodad++) { +- ddoodad->any.type = sdoodad->any.type; ++ memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); + if (sdoodad->any.type == XkbTextDoodad) { + if (sdoodad->text.text) + ddoodad->text.text = xstrdup(sdoodad->text.text); +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-invalid-writes.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-invalid-writes.patch new file mode 100644 index 00000000..5f1bb781 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-invalid-writes.patch @@ -0,0 +1,67 @@ +From d68eb105421d4b88b1489ac954085dea4c99fc24 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Wed, 9 Jun 2010 16:38:20 +1000 +Subject: [PATCH] xkb: fix invalid memory writes in _XkbCopyGeom. + +Classic strlen/strcpy mistake of + foo = malloc(strlen(bar)); + strcpy(foo, bar); + +Testcase: valgrind Xephyr :1 + +==8591== Invalid write of size 1 +==8591== at 0x4A0638F: strcpy (mc_replace_strmem.c:311) +==8591== by 0x605593: _XkbCopyGeom (xkbUtils.c:1994) +==8591== by 0x605973: XkbCopyKeymap (xkbUtils.c:2118) +==8591== by 0x6122B3: InitKeyboardDeviceStruct (xkbInit.c:560) +==8591== by 0x4472E2: CoreKeyboardProc (devices.c:577) +==8591== by 0x447162: ActivateDevice (devices.c:530) +==8591== by 0x4475D6: InitCoreDevices (devices.c:672) +==8591== by 0x4449EE: main (main.c:254) +==8591== Address 0x6f96505 is 0 bytes after a block of size 53 alloc'd +==8591== at 0x4A0515D: malloc (vg_replace_malloc.c:195) +==8591== by 0x6054B7: _XkbCopyGeom (xkbUtils.c:1980) +==8591== by 0x605973: XkbCopyKeymap (xkbUtils.c:2118) +==8591== by 0x6122B3: InitKeyboardDeviceStruct (xkbInit.c:560) +==8591== by 0x4472E2: CoreKeyboardProc (devices.c:577) +==8591== by 0x447162: ActivateDevice (devices.c:530) +==8591== by 0x4475D6: InitCoreDevices (devices.c:672) +==8591== by 0x4449EE: main (main.c:254) + +Reported-by: Dave Airlie +Signed-off-by: Peter Hutterer +Reviewed-by-and-apologised-for: Daniel Stone +Signed-off-by: Keith Packard + +Conflicts: + + xkb/xkbUtils.c +--- + xkb/xkbUtils.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c +index 30ec438..1abb5a8 100644 +--- a/xkb/xkbUtils.c ++++ b/xkb/xkbUtils.c +@@ -1940,7 +1940,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + /* font */ + if (src->geom->label_font) { + if (!dst->geom->label_font) { +- tmp = xalloc(strlen(src->geom->label_font)); ++ tmp = xalloc(strlen(src->geom->label_font) + 1); + if (!tmp) + return FALSE; + dst->geom->label_font = tmp; +@@ -1948,7 +1948,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) + else if (strlen(src->geom->label_font) != + strlen(dst->geom->label_font)) { + tmp = xrealloc(dst->geom->label_font, +- strlen(src->geom->label_font)); ++ strlen(src->geom->label_font) + 1); + if (!tmp) + return FALSE; + dst->geom->label_font = tmp; +-- +1.6.5.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-lockedPtrBtns-state-merge.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-lockedPtrBtns-state-merge.patch new file mode 100644 index 00000000..607c3e2c --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-lockedPtrBtns-state-merge.patch @@ -0,0 +1,160 @@ +From 2ee9103f13e0ed3729aed93cdedc723067335e68 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Wed, 30 Jun 2010 09:21:22 +1000 +Subject: [PATCH 4/4] xkb: merge lockedPtrButtons state from all attached SDs. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Problem: +lockedPtrButtons keeps the state of the buttons locked by a PointerKeys button +press. Unconditionally clearing the bits may cause stuck buttons in this +sequence of events: + +1. type Shift + NumLock to enable PointerKeys +2. type 0/Ins on keypad to emulate Button 1 press + → button1 press event to client +3. press and release button 1 on physical mouse + → button1 release event to client + +Button 1 on the MD is now stuck and cannot be released. + +Cause: +XKB PointerKeys button events are posted through the XTEST pointer device. +Once a press is generated, the XTEST device's button is down. The DIX merges +the button state of all attached SDs, hence the MD will have a button down +while the XTEST device has a button down. + +PointerKey button events are only generated on the master device to avoid +duplicate events (see XkbFakeDeviceButton()). If the MD has the +lockedPtrButtons bit cleared by a release event on a physical device, no +such event is generated when a keyboard device triggers the PointerKey +ButtonRelease trigger. Since the event - if generated - is posted through +the XTEST pointer device, lack of a generated ButtonRelease event on the +XTEST pointer device means the button is never released, resulting in the +stuck button observed above. + +Solution: +This patch merges the MD's lockedPtrButtons with the one of all attached +slave devices on release events. Thus, as long as one attached keyboard has +a lockedPtrButtons bit set, this bit is kept in the MD. Once a PointerKey +button is released on all keyboards, the matching release event is emulated +from the MD through the XTEST pointer device, thus also releasing the button +in the DIX. + +Signed-off-by: Peter Hutterer + +Conflicts: + + xkb/xkbActions.c + +Signed-off-by: Fedora X Ninjas +--- + include/xkbsrv.h | 3 +++ + xkb/xkbAccessX.c | 18 +++++++++++++++++- + xkb/xkbActions.c | 10 ++++++++++ + xkb/xkbUtils.c | 26 ++++++++++++++++++++++++++ + 4 files changed, 56 insertions(+), 1 deletions(-) + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index c2da3f3..aab833f 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -938,6 +938,9 @@ extern int XkbGetEffectiveGroup( + XkbStatePtr /* xkbstate */, + CARD8 /* keycode */); + ++extern void XkbMergeLockedPtrBtns( ++ DeviceIntPtr /* master */); ++ + #include "xkbfile.h" + #include "xkbrules.h" + +diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c +index 0d8e4eb..670f368 100644 +--- a/xkb/xkbAccessX.c ++++ b/xkb/xkbAccessX.c +@@ -707,8 +707,24 @@ DeviceEvent *event = &ev->device_event; + changed |= XkbPointerButtonMask; + } + else if (event->type == ET_ButtonRelease) { +- if (xkbi) ++ if (xkbi) { + xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7)); ++ ++ /* Merge this MD's lockedPtrButtons with the one of all ++ * attached slave devices. ++ * The DIX uses a merged button state for MDs, not ++ * releasing buttons until the last SD has released ++ * thenm. If we unconditionally clear the ++ * lockedPtrButtons bit on the MD, a PointerKeys button ++ * release on the SD keyboard won't generate the required fake button ++ * event on the XTEST pointer, thus never processing the ++ * button event in the DIX and the XTEST pointer's ++ * buttons stay down - result is a stuck button. ++ */ ++ if (IsMaster(dev)) ++ XkbMergeLockedPtrBtns(dev); ++ } ++ + changed |= XkbPointerButtonMask; + } + +diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c +index 3f57202..e68b782 100644 +--- a/xkb/xkbActions.c ++++ b/xkb/xkbActions.c +@@ -626,6 +626,16 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, + break; + } + xkbi->lockedPtrButtons&= ~(1<device)) ++ { ++ XkbMergeLockedPtrBtns(xkbi->device); ++ /* One SD still has lock set, don't post event */ ++ if ((xkbi->lockedPtrButtons & (1 << button)) != 0) ++ break; ++ } ++ ++ /* fallthrough */ + case XkbSA_PtrBtn: + XkbFakeDeviceButton(xkbi->device, 0, button); + break; +diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c +index fe093a4..6294858 100644 +--- a/xkb/xkbUtils.c ++++ b/xkb/xkbUtils.c +@@ -2190,3 +2190,29 @@ XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode) + + return effectiveGroup; + } ++ ++/* Merge the lockedPtrButtons from all attached SDs for the given master ++ * device into the MD's state. ++ */ ++void ++XkbMergeLockedPtrBtns(DeviceIntPtr master) ++{ ++ DeviceIntPtr d = inputInfo.devices; ++ XkbSrvInfoPtr xkbi = NULL; ++ ++ if (!IsMaster(master)) ++ return; ++ ++ if (!master->key) ++ return; ++ ++ xkbi = master->key->xkbInfo; ++ xkbi->lockedPtrButtons = 0; ++ ++ for (; d; d = d->next) { ++ if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key) ++ continue; ++ ++ xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons; ++ } ++} +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-pointerkeys-on-master.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-pointerkeys-on-master.patch new file mode 100644 index 00000000..8be9770c --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-pointerkeys-on-master.patch @@ -0,0 +1,47 @@ +From cd73cd8cdd64b73e0d371d90843a78fb5fa471bd Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 29 Jun 2010 15:24:51 +1000 +Subject: [PATCH 3/4] xkb: emulate PointerKeys events only on the master device. + +This patch replicates the behaviour for button events. Only generate a +PointerKeys motion event on the master device, not on the slave device. +Fixes the current issue of PointerKey motion events generating key events as +well. + +Signed-off-by: Peter Hutterer +--- + xkb/xkbActions.c | 9 ++++----- + 1 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c +index 8d70a55..3f57202 100644 +--- a/xkb/xkbActions.c ++++ b/xkb/xkbActions.c +@@ -496,9 +496,6 @@ _XkbFilterPointerMove( XkbSrvInfoPtr xkbi, + int x,y; + Bool accel; + +- if (xkbi->device == inputInfo.keyboard) +- return 0; +- + if (filter->keycode==0) { /* initial press */ + filter->keycode = keycode; + filter->active = 1; +@@ -1329,10 +1326,12 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) + DeviceIntPtr ptr; + int gpe_flags = 0; + +- if (!dev->u.master) ++ if (IsMaster(dev)) ++ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); ++ else if (!dev->u.master) + ptr = dev; + else +- ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); ++ return; + + if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) + gpe_flags = POINTER_ABSOLUTE; +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-purge-includes.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-purge-includes.patch new file mode 100644 index 00000000..dc38339b --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-purge-includes.patch @@ -0,0 +1,38 @@ +From e2bebcd40bf5826eeba90e1242e2b946b2d2265e Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 14 Apr 2010 09:48:53 +1000 +Subject: [PATCH 1/4] xkb: purge unneeded includes from ddxDevBtn.c + +Signed-off-by: Peter Hutterer +Reviewed-by: Daniel Stone +Reviewed-by: Dan Nicholson +--- + xkb/ddxDevBtn.c | 9 --------- + 1 files changed, 0 insertions(+), 9 deletions(-) + +diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c +index b8a222d..b8a1255 100644 +--- a/xkb/ddxDevBtn.c ++++ b/xkb/ddxDevBtn.c +@@ -28,18 +28,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. + #include + #endif + +-#include +-#include +-#include +-#include + #include "inputstr.h" +-#include "scrnintstr.h" +-#include "windowstr.h" +-#include "eventstr.h" + #include + #include "mi.h" +-#include +-#include + + void + XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-rename-fakebutton.patch b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-rename-fakebutton.patch new file mode 100644 index 00000000..cb21c69d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xserver-1.7.7-xkb-rename-fakebutton.patch @@ -0,0 +1,398 @@ +From 6c5ac8e2258c5d23d04f5799c0471b8404a717ec Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Tue, 29 Jun 2010 14:29:04 +1000 +Subject: [PATCH 2/4] xkb: rename XkbFakeDeviceButton and XkbFakeDeviceMotion, move into xkbActions.c + +The name XkbDDXFakeDeviceButton and XkbDDXFakeDeviceMotion is somewhat +misleading, there's no DDX involved in the game at all anymore. + +This removes XkbFakeDeviceMotion and XkbFakeDeviceButton from the API where +it arguably shouldn't have been in the first place. + +Signed-off-by: Peter Hutterer +Reviewed-by: Daniel Stone +Reviewed-by: Dan Nicholson + +Conflicts: + + xkb/xkbActions.c +--- + include/xkbsrv.h | 13 ------- + xkb/Makefile.am | 4 +-- + xkb/ddxDevBtn.c | 69 -------------------------------------- + xkb/ddxFakeMtn.c | 64 ----------------------------------- + xkb/xkbActions.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++------- + 5 files changed, 85 insertions(+), 162 deletions(-) + delete mode 100644 xkb/ddxDevBtn.c + delete mode 100644 xkb/ddxFakeMtn.c + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index de8ec90..c2da3f3 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -786,19 +786,6 @@ extern _X_EXPORT void XkbDDXUpdateDeviceIndicators( + CARD32 /* newState */ + ); + +-extern _X_EXPORT void XkbDDXFakePointerMotion( +- DeviceIntPtr /* dev */, +- unsigned int /* flags */, +- int /* x */, +- int /* y */ +-); +- +-extern _X_EXPORT void XkbDDXFakeDeviceButton( +- DeviceIntPtr /* dev */, +- Bool /* press */, +- int /* button */ +-); +- + extern _X_EXPORT int XkbDDXTerminateServer( + DeviceIntPtr /* dev */, + KeyCode /* key */, +diff --git a/xkb/Makefile.am b/xkb/Makefile.am +index b85ee8a..c88fbd0 100644 +--- a/xkb/Makefile.am ++++ b/xkb/Makefile.am +@@ -6,11 +6,9 @@ AM_CFLAGS = $(DIX_CFLAGS) \ + DDX_SRCS = \ + ddxBeep.c \ + ddxCtrls.c \ +- ddxFakeMtn.c \ + ddxLEDs.c \ + ddxLoad.c \ +- ddxList.c \ +- ddxDevBtn.c ++ ddxList.c + + DIX_SRCS = \ + xkb.c \ +diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c +deleted file mode 100644 +index b8a1255..0000000 +--- a/xkb/ddxDevBtn.c ++++ /dev/null +@@ -1,69 +0,0 @@ +-/************************************************************ +-Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. +- +-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 Silicon Graphics not be +-used in advertising or publicity pertaining to distribution +-of the software without specific prior written permission. +-Silicon Graphics makes no representation about the suitability +-of this software for any purpose. It is provided "as is" +-without any express or implied warranty. +- +-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +-GRAPHICS 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. +- +-********************************************************/ +- +-#ifdef HAVE_DIX_CONFIG_H +-#include +-#endif +- +-#include "inputstr.h" +-#include +-#include "mi.h" +- +-void +-XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) +-{ +- EventListPtr events; +- int nevents, i; +- DeviceIntPtr ptr; +- +- /* If dev is a slave device, and the SD is attached, do nothing. If we'd +- * post through the attached master pointer we'd get duplicate events. +- * +- * if dev is a master keyboard, post through the XTEST device +- * +- * if dev is a floating slave, post through the device itself. +- */ +- +- if (IsMaster(dev)) +- ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); +- else if (!dev->u.master) +- ptr = dev; +- else +- return; +- +- events = InitEventList(GetMaximumEventsNum()); +- OsBlockSignals(); +- nevents = GetPointerEvents(events, ptr, +- press ? ButtonPress : ButtonRelease, button, +- 0 /* flags */, 0 /* first */, +- 0 /* num_val */, NULL); +- OsReleaseSignals(); +- +- for (i = 0; i < nevents; i++) +- mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); +- +- FreeEventList(events, GetMaximumEventsNum()); +-} +diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c +deleted file mode 100644 +index b383716..0000000 +--- a/xkb/ddxFakeMtn.c ++++ /dev/null +@@ -1,64 +0,0 @@ +-/************************************************************ +-Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. +- +-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 Silicon Graphics not be +-used in advertising or publicity pertaining to distribution +-of the software without specific prior written permission. +-Silicon Graphics makes no representation about the suitability +-of this software for any purpose. It is provided "as is" +-without any express or implied warranty. +- +-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +-GRAPHICS 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. +- +-********************************************************/ +- +-#ifdef HAVE_DIX_CONFIG_H +-#include +-#endif +- +-#include "inputstr.h" +-#include +-#include "mi.h" +- +-void +-XkbDDXFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) +-{ +- EventListPtr events; +- int nevents, i; +- DeviceIntPtr ptr; +- int gpe_flags = 0; +- +- if (!dev->u.master) +- ptr = dev; +- else +- ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); +- +- if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) +- gpe_flags = POINTER_ABSOLUTE; +- else +- gpe_flags = POINTER_RELATIVE; +- +- events = InitEventList(GetMaximumEventsNum()); +- OsBlockSignals(); +- nevents = GetPointerEvents(events, ptr, +- MotionNotify, 0, +- gpe_flags, 0, 2, (int[]){x, y}); +- OsReleaseSignals(); +- +- for (i = 0; i < nevents; i++) +- mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); +- +- FreeEventList(events, GetMaximumEventsNum()); +-} +diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c +index 663f033..8d70a55 100644 +--- a/xkb/xkbActions.c ++++ b/xkb/xkbActions.c +@@ -40,11 +40,15 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. + #include + #include "xkb.h" + #include ++#include "mi.h" + #define EXTENSION_EVENT_BASE 64 + + static int xkbDevicePrivateKeyIndex; + DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKeyIndex; + ++static void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button); ++static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y); ++ + void + xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, + pointer data) +@@ -479,7 +483,7 @@ int dx,dy; + dx= xkbi->mouseKeysDX; + dy= xkbi->mouseKeysDY; + } +- XkbDDXFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy); ++ XkbFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy); + return xkbi->desc->ctrls->mk_interval; + } + +@@ -507,7 +511,7 @@ Bool accel; + accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0); + x= XkbPtrActionX(&pAction->ptr); + y= XkbPtrActionY(&pAction->ptr); +- XkbDDXFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y); ++ XkbFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y); + AccessXCancelRepeatKey(xkbi,keycode); + xkbi->mouseKeysAccel= accel&& + (xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask); +@@ -554,7 +558,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, + ((pAction->btn.flags&XkbSA_LockNoLock)==0)) { + xkbi->lockedPtrButtons|= (1<device, 1, button); ++ XkbFakeDeviceButton(xkbi->device, 1, button); + filter->upAction.type= XkbSA_NoAction; + } + break; +@@ -565,12 +569,12 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, + if (pAction->btn.count>0) { + nClicks= pAction->btn.count; + for (i=0;idevice, 1, button); +- XkbDDXFakeDeviceButton(xkbi->device, 0, button); ++ XkbFakeDeviceButton(xkbi->device, 1, button); ++ XkbFakeDeviceButton(xkbi->device, 0, button); + } + filter->upAction.type= XkbSA_NoAction; + } +- else XkbDDXFakeDeviceButton(xkbi->device, 1, button); ++ else XkbFakeDeviceButton(xkbi->device, 1, button); + } + break; + case XkbSA_SetPtrDflt: +@@ -626,7 +630,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, + } + xkbi->lockedPtrButtons&= ~(1<device, 0, button); ++ XkbFakeDeviceButton(xkbi->device, 0, button); + break; + } + filter->active = 0; +@@ -964,7 +968,7 @@ int button; + if ((pAction->devbtn.flags&XkbSA_LockNoLock)|| + BitIsOn(dev->button->down, button)) + return 0; +- XkbDDXFakeDeviceButton(dev,True,button); ++ XkbFakeDeviceButton(dev,TRUE,button); + filter->upAction.type= XkbSA_NoAction; + break; + case XkbSA_DeviceBtn: +@@ -972,12 +976,12 @@ int button; + int nClicks,i; + nClicks= pAction->btn.count; + for (i=0;iupAction.type= XkbSA_NoAction; + } +- else XkbDDXFakeDeviceButton(dev,True,button); ++ else XkbFakeDeviceButton(dev,TRUE,button); + break; + } + } +@@ -996,10 +1000,10 @@ int button; + if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)|| + !BitIsOn(dev->button->down, button)) + return 0; +- XkbDDXFakeDeviceButton(dev,False,button); ++ XkbFakeDeviceButton(dev,FALSE,button); + break; + case XkbSA_DeviceBtn: +- XkbDDXFakeDeviceButton(dev,False,button); ++ XkbFakeDeviceButton(dev,FALSE,button); + break; + } + filter->active = 0; +@@ -1317,3 +1321,70 @@ xkbStateNotify sn; + return; + } + ++static void ++XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) ++{ ++ EventListPtr events; ++ int nevents, i; ++ DeviceIntPtr ptr; ++ int gpe_flags = 0; ++ ++ if (!dev->u.master) ++ ptr = dev; ++ else ++ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); ++ ++ if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) ++ gpe_flags = POINTER_ABSOLUTE; ++ else ++ gpe_flags = POINTER_RELATIVE; ++ ++ events = InitEventList(GetMaximumEventsNum()); ++ OsBlockSignals(); ++ nevents = GetPointerEvents(events, ptr, ++ MotionNotify, 0, ++ gpe_flags, 0, 2, (int[]){x, y}); ++ OsReleaseSignals(); ++ ++ for (i = 0; i < nevents; i++) ++ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); ++ ++ FreeEventList(events, GetMaximumEventsNum()); ++} ++ ++static void ++XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) ++{ ++ EventListPtr events; ++ int nevents, i; ++ DeviceIntPtr ptr; ++ ++ /* If dev is a slave device, and the SD is attached, do nothing. If we'd ++ * post through the attached master pointer we'd get duplicate events. ++ * ++ * if dev is a master keyboard, post through the XTEST device ++ * ++ * if dev is a floating slave, post through the device itself. ++ */ ++ ++ if (IsMaster(dev)) ++ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); ++ else if (!dev->u.master) ++ ptr = dev; ++ else ++ return; ++ ++ events = InitEventList(GetMaximumEventsNum()); ++ OsBlockSignals(); ++ nevents = GetPointerEvents(events, ptr, ++ press ? ButtonPress : ButtonRelease, button, ++ 0 /* flags */, 0 /* first */, ++ 0 /* num_val */, NULL); ++ OsReleaseSignals(); ++ ++ ++ for (i = 0; i < nevents; i++) ++ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); ++ ++ FreeEventList(events, GetMaximumEventsNum()); ++} +-- +1.7.1 + diff --git a/contrib/packages/rpm/el5/SOURCES/xtrans-1.0.3-avoid-gethostname.patch b/contrib/packages/rpm/el5/SOURCES/xtrans-1.0.3-avoid-gethostname.patch new file mode 100644 index 00000000..5d474d5d --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/xtrans-1.0.3-avoid-gethostname.patch @@ -0,0 +1,11 @@ +diff -up xtrans-1.0.3/Xtransutil.c.jx xtrans-1.0.3/Xtransutil.c +--- xtrans-1.0.3/Xtransutil.c.jx 2006-12-06 11:08:53.000000000 -0500 ++++ xtrans-1.0.3/Xtransutil.c 2007-10-01 14:53:43.000000000 -0400 +@@ -271,6 +271,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ci + case AF_UNIX: + { + struct sockaddr_un *saddr = (struct sockaddr_un *) addr; ++ strcpy(hostnamebuf, "unix"); + networkId = (char *) xalloc (3 + strlen (transName) + + strlen (hostnamebuf) + strlen (saddr->sun_path)); + sprintf (networkId, "%s/%s:%s", transName, diff --git a/contrib/packages/rpm/el5/SPECS/tigervnc.spec b/contrib/packages/rpm/el5/SPECS/tigervnc.spec new file mode 100644 index 00000000..f2e58b63 --- /dev/null +++ b/contrib/packages/rpm/el5/SPECS/tigervnc.spec @@ -0,0 +1,1585 @@ +%define _default_patch_fuzz 2 +%define snap 20131128svn5139 +%define mesa_version 7.7.1 + +Name: tigervnc +Version: 1.3.80 +Release: 17%{?snap:.%{snap}}%{?dist} +Summary: A TigerVNC remote display system + +Group: User Interface/Desktops +License: GPLv2+ +Packager: Brian P. Hinz +URL: http://www.tigervnc.com + +Source0: %{name}-%{version}%{?snap:-%{snap}}.tar.bz2 +Source1: vncserver.service +Source2: vncserver.sysconfig +Source6: vncviewer.desktop +Source11: http://fltk.org/pub/fltk/1.3.2/fltk-1.3.2-source.tar.gz +Source12: http://downloads.sourceforge.net/project/libjpeg-turbo/1.3.0/libjpeg-turbo-1.3.0.tar.gz + +# http://ftp.redhat.com/pub/redhat/linux/enterprise/6Client/en/os/SRPMS/xorg-x11-proto-devel-7.6-13.el6.src.rpm +# http://ftp.redhat.com/pub/redhat/linux/enterprise/6Client/en/os/SRPMS/ +Source99: http://xcb.freedesktop.org/dist/libpthread-stubs-0.3.tar.bz2 +Source100: http://www.x.org/releases/X11R7.5/src/lib/libICE-1.0.6.tar.bz2 +Source101: http://www.x.org/releases/X11R7.5/src/lib/libSM-1.1.1.tar.bz2 +Source102: http://www.x.org/releases/X11R7.5/src/lib/libX11-1.3.2.tar.bz2 +Source103: http://www.x.org/releases/X11R7.5/src/lib/libXScrnSaver-1.2.0.tar.bz2 +Source104: http://www.x.org/releases/X11R7.5/src/lib/libXau-1.0.5.tar.bz2 +Source105: http://www.x.org/releases/X11R7.5/src/lib/libXaw-1.0.7.tar.bz2 +Source106: http://www.x.org/releases/X11R7.5/src/lib/libXcomposite-0.4.1.tar.bz2 +Source107: http://www.x.org/releases/X11R7.5/src/lib/libXcursor-1.1.10.tar.bz2 +Source108: http://www.x.org/releases/X11R7.5/src/lib/libXdamage-1.1.2.tar.bz2 +Source109: http://www.x.org/releases/X11R7.5/src/lib/libXdmcp-1.0.3.tar.bz2 +Source110: http://www.x.org/releases/individual/lib/libXext-1.1.tar.bz2 +Source111: http://www.x.org/releases/X11R7.5/src/lib/libXfixes-4.0.4.tar.bz2 +Source112: http://www.x.org/releases/X11R7.5/src/lib/libXfont-1.4.1.tar.bz2 +Source113: http://www.x.org/releases/X11R7.5/src/lib/libXft-2.1.14.tar.bz2 +Source114: http://www.x.org/releases/X11R7.5/src/lib/libXi-1.3.tar.bz2 +Source115: http://www.x.org/releases/X11R7.5/src/lib/libXinerama-1.1.tar.bz2 +Source116: http://www.x.org/releases/X11R7.5/src/lib/libXmu-1.0.5.tar.bz2 +Source117: http://www.x.org/releases/X11R7.5/src/lib/libXpm-3.5.8.tar.bz2 +Source118: http://www.x.org/releases/X11R7.5/src/lib/libXrandr-1.3.0.tar.bz2 +Source119: http://www.x.org/releases/X11R7.5/src/lib/libXrender-0.9.5.tar.bz2 +Source120: http://www.x.org/releases/X11R7.5/src/lib/libXt-1.0.7.tar.bz2 +Source121: http://www.x.org/releases/X11R7.5/src/lib/libXtst-1.1.0.tar.bz2 +Source122: http://www.x.org/releases/X11R7.5/src/lib/libXv-1.0.5.tar.bz2 +Source123: http://www.x.org/releases/X11R7.5/src/lib/libXvMC-1.0.5.tar.bz2 +Source124: http://www.x.org/releases/X11R7.5/src/lib/libXxf86dga-1.1.1.tar.bz2 +Source125: http://www.x.org/releases/X11R7.5/src/lib/libXxf86vm-1.1.0.tar.bz2 +Source126: http://www.x.org/releases/X11R7.5/src/lib/libfontenc-1.0.5.tar.bz2 +Source127: http://www.x.org/releases/X11R7.5/src/lib/libpciaccess-0.10.9.tar.bz2 +Source128: http://www.x.org/releases/X11R7.5/src/lib/libxkbfile-1.0.6.tar.bz2 +Source129: http://www.x.org/releases/X11R7.5/src/lib/xtrans-1.2.5.tar.bz2 +Source130: http://xorg.freedesktop.org/archive/individual/proto/bigreqsproto-1.1.0.tar.bz2 +Source131: http://xorg.freedesktop.org/archive/individual/proto/compositeproto-0.4.1.tar.bz2 +Source132: http://xorg.freedesktop.org/archive/individual/proto/damageproto-1.2.0.tar.bz2 +Source133: http://xorg.freedesktop.org/archive/individual/proto/evieext-1.1.1.tar.bz2 +Source134: http://xorg.freedesktop.org/archive/individual/proto/fixesproto-5.0.tar.bz2 +Source135: http://xorg.freedesktop.org/archive/individual/proto/fontsproto-2.1.0.tar.bz2 +Source136: http://xorg.freedesktop.org/archive/individual/proto/glproto-1.4.12.tar.bz2 +Source137: http://xorg.freedesktop.org/archive/individual/proto/inputproto-2.0.2.tar.bz2 +Source138: http://xorg.freedesktop.org/archive/individual/proto/kbproto-1.0.5.tar.bz2 +Source139: http://xorg.freedesktop.org/archive/individual/proto/randrproto-1.3.1.tar.bz2 +#Source139: http://xorg.freedesktop.org/archive/individual/proto/randrproto-20110224-git105a161.tar.bz2 +Source140: http://xorg.freedesktop.org/archive/individual/proto/recordproto-1.14.1.tar.bz2 +Source141: http://xorg.freedesktop.org/archive/individual/proto/renderproto-0.11.1.tar.bz2 +Source142: http://xorg.freedesktop.org/archive/individual/proto/resourceproto-1.2.0.tar.bz2 +Source143: http://xorg.freedesktop.org/archive/individual/proto/scrnsaverproto-1.2.1.tar.bz2 +Source144: http://xorg.freedesktop.org/archive/individual/proto/videoproto-2.3.1.tar.bz2 +Source145: http://xorg.freedesktop.org/archive/individual/proto/xcmiscproto-1.2.1.tar.bz2 +Source146: http://xorg.freedesktop.org/archive/individual/proto/xextproto-7.2.0.tar.bz2 +Source147: http://xorg.freedesktop.org/archive/individual/proto/xf86bigfontproto-1.2.0.tar.bz2 +Source148: http://xorg.freedesktop.org/archive/individual/proto/xf86dgaproto-2.1.tar.bz2 +Source149: http://xorg.freedesktop.org/archive/individual/proto/xf86driproto-2.1.1.tar.bz2 +Source150: http://xorg.freedesktop.org/archive/individual/proto/xf86miscproto-0.9.3.tar.bz2 +Source151: http://xorg.freedesktop.org/archive/individual/proto/xf86vidmodeproto-2.3.1.tar.bz2 +Source152: http://xorg.freedesktop.org/archive/individual/proto/xineramaproto-1.2.1.tar.bz2 +Source153: http://xorg.freedesktop.org/archive/individual/proto/xproto-7.0.22.tar.bz2 +Source154: http://xorg.freedesktop.org/archive/individual/proto/dri2proto-2.3.tar.bz2 + +#Source130: http://www.x.org/releases/X11R7.5/src/proto/bigreqsproto-1.1.0.tar.bz2 +#Source131: http://www.x.org/releases/X11R7.5/src/proto/compositeproto-0.4.1.tar.bz2 +#Source132: http://www.x.org/releases/X11R7.5/src/proto/damageproto-1.2.0.tar.bz2 +#Source133: http://www.x.org/releases/X11R7.5/src/proto/dri2proto-2.3.tar.bz2 +#Source134: http://www.x.org/releases/X11R7.5/src/proto/fixesproto-5.0.tar.bz2 +#Source135: http://www.x.org/releases/X11R7.5/src/proto/fontsproto-2.1.0.tar.bz2 +#Source136: http://www.x.org/releases/X11R7.5/src/proto/glproto-1.4.12.tar.bz2 +#Source137: http://www.x.org/releases/X11R7.5/src/proto/inputproto-2.0.2.tar.bz2 +#Source138: http://www.x.org/releases/X11R7.5/src/proto/kbproto-1.0.5.tar.bz2 +#Source139: http://www.x.org/releases/X11R7.5/src/proto/randrproto-20110224-git105a161.tar.bz2 +#Source140: http://www.x.org/releases/X11R7.5/src/proto/recordproto-1.14.1.tar.bz2 +#Source141: http://www.x.org/releases/X11R7.5/src/proto/renderproto-0.11.1.tar.bz2 +#Source142: http://www.x.org/releases/X11R7.5/src/proto/resourceproto-1.2.0.tar.bz2 +#Source143: http://www.x.org/releases/X11R7.5/src/proto/scrnsaverproto-1.2.1.tar.bz2 +#Source144: http://www.x.org/releases/X11R7.5/src/proto/videoproto-2.3.1.tar.bz2 +#Source145: http://www.x.org/releases/X11R7.5/src/proto/xcmiscproto-1.2.1.tar.bz2 +#Source146: http://www.x.org/releases/X11R7.5/src/proto/xextproto-7.2.0.tar.bz2 +#Source147: http://www.x.org/releases/X11R7.5/src/proto/xf86bigfontproto-1.2.0.tar.bz2 +#Source148: http://www.x.org/releases/X11R7.5/src/proto/xf86dgaproto-2.1.tar.bz2 +#Source149: http://www.x.org/releases/X11R7.5/src/proto/xf86driproto-2.1.1.tar.bz2 +#Source150: http://www.x.org/releases/X11R7.5/src/proto/xf86vidmodeproto-2.3.1.tar.bz2 +#Source151: http://www.x.org/releases/X11R7.5/src/proto/xproto-7.0.22.tar.bz2 + +Source155: http://www.x.org/releases/individual/util/util-macros-1.4.1.tar.bz2 +Source156: http://www.x.org/pub/individual/xserver/xorg-server-1.7.7.tar.bz2 +#Source157: ftp://ftp.x.org/pub/individual/app/xauth-1.0.2.tar.bz2 +#Source158: http://www.x.org/releases/X11R7.5/src/everything/xkbutils-1.0.2.tar.bz2 +Source159: http://dri.freedesktop.org/libdrm/libdrm-2.4.15.tar.bz2 +Source160: http://downloads.sourceforge.net/project/freetype/freetype2/2.3.11/freetype-2.3.11.tar.bz2 +Source161: ftp://ftp.freedesktop.org/pub/mesa/older-versions/7.x/%{mesa_version}/MesaLib-%{mesa_version}.tar.bz2 +Source162: http://cgit.freedesktop.org/pixman/snapshot/pixman-0.26.0.tar.gz +Source163: http://www.x.org/releases/X11R7.5/src/lib/libXres-1.0.4.tar.bz2 +Source164: http://www.x.org/releases/individual/lib/libXxf86misc-1.0.2.tar.bz2 + +# FIXME: +# need to apply any patches in from the F12 srpms +#http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/source/SRPMS/mesa-7.6-0.13.fc12.src.rpm +#http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/source/SRPMS/pixman-0.16.2-1.fc12.src.rpm +#http://vault.centos.org/6.3/os/Source/SPackages/pixman-0.18.4-1.el6_0.1.src.rpm +#http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/12/Everything/source/SRPMS/libdrm-2.4.15-4.fc12.src.rpm +#http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/source/SRPMS/freetype-2.3.9-6.fc12.src.rpm + +BuildRoot: %{_tmppath}/%{name}-%{version}%{?snap:-%{snap}}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: automake >= 1.7, autoconf >= 2.57, libtool >= 1.4, gettext >= 0.14.4, gettext-devel >= 0.14.4, bison-devel +BuildRequires: openssl-devel +BuildRequires: desktop-file-utils, java-devel, jpackage-utils +BuildRequires: gnutls-devel, pam-devel +BuildRequires: cmake28 +BuildRequires: pkgconfig >= 0.20 +BuildRequires: gcc44, gcc44-c++ +BuildRequires: glibc-devel, libstdc++-devel, libpng-devel + +BuildRequires: openmotif-devel +Requires: openmotif, openmotif22 +Requires(post): initscripts chkconfig coreutils +Requires(postun):coreutils +Requires: hicolor-icon-theme +Requires: tigervnc-license + +Provides: vnc = 4.1.3-2, vnc-libs = 4.1.3-2 +Obsoletes: vnc < 4.1.3-2, vnc-libs < 4.1.3-2 +Provides: tightvnc = 1.5.0-0.15.20090204svn3586 +Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586 + +Patch4: tigervnc-cookie.patch +Patch10: tigervnc11-ldnow.patch +Patch11: tigervnc11-gethomedir.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=692048 +Patch13: tigervnc11-rh692048.patch + +Patch101: tigervnc-ac-compatibility.patch +Patch102: tigervnc-xorg-1.7.5-remove-copyisolatin1lowered.patch + +# Export dead key information from FLTK to the apps +# http://www.fltk.org/str.php?L2599 +Patch110: http://www.fltk.org/strfiles/2599/fltk-1_v4.3.x-keyboard-x11.patch +Patch111: http://www.fltk.org/strfiles/2599/fltk-1_v4.3.x-keyboard-win32.patch +Patch112: http://www.fltk.org/strfiles/2599/fltk-1_v6.3.x-keyboard-osx.patch + +# Notify applications of changes to the clipboard +# http://www.fltk.org/str.php?L2636 +Patch113: http://www.fltk.org/strfiles/2636/fltk-1.3.x-clipboard.patch +Patch114: http://www.fltk.org/strfiles/2636/fltk-1_v6.3.x-clipboard-x11.patch +Patch115: http://www.fltk.org/strfiles/2636/fltk-1_v3.3.x-clipboard-win32-fix.patch +Patch116: http://www.fltk.org/strfiles/2636/fltk-1_v2.3.x-clipboard-win32.patch +Patch117: http://www.fltk.org/strfiles/2636/fltk-1_v2.3.x-clipboard-osx.patch + +# Ability to convert a Fl_Pixmap to a Fl_RGB_Image +# http://www.fltk.org/str.php?L2659 +Patch118: http://www.fltk.org/strfiles/2659/pixmap_v2.patch + +# Support for custom cursors +# http://www.fltk.org/str.php?L2660 +Patch119: http://www.fltk.org/strfiles/2660/fltk-1_v5.3.x-cursor.patch + +# Improve modality interaction with WM +# http://www.fltk.org/str.php?L2802 +Patch120: http://www.fltk.org/strfiles/2802/fltk-1_v2.3.0-modal.patch + +# Window icons +# http://www.fltk.org/str.php?L2816 +Patch121: http://www.fltk.org/strfiles/2816/fltk-1_v3.3.0-icons.patch + +# Multihead +# http://fltk.org/str.php?L2860 +Patch122: http://www.fltk.org/strfiles/2860/fltk-1.3.x-screen_num.patch +Patch123: http://www.fltk.org/strfiles/2860/fltk-1_v3.3.x-multihead.patch + +# Patches from libdrm-2.4.15-4.fc12.src.rpm +# hardcode the 666 instead of 660 for device nodes +Patch133: libdrm-make-dri-perms-okay.patch +# remove backwards compat not needed on Fedora +Patch134: libdrm-2.4.0-no-bc.patch + +Patch135: libdrm-page-flip.patch + +# nouveau: retry pushbuf ioctl if interrupted by signal +Patch136: libdrm-nouveau-restart-pushbuf.patch +# nouveau: drop rendering on floor rather than asserting if flush fails +Patch137: libdrm-nouveau-drop-rendering.patch +# nouveau: improve reloc API to allow better error handling +Patch138: libdrm-nouveau-better-relocs.patch + +# patches from mesa-7.11-5.el6.src.rpm +# ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Client/en/os/SRPMS/mesa-7.11-5.el6.src.rpm +Patch141: mesa-7.1-osmesa-version.patch +Patch142: mesa-7.1-nukeglthread-debug.patch +Patch143: mesa-no-mach64.patch + +#Patch147: mesa-7.1-link-shared.patch +Patch149: intel-revert-vbl.patch +#Patch1410: r600-fix-tfp.patch + +#Patch1413: mesa-7.5-sparc64.patch + +Patch1430: mesa-7.6-hush-vblank-warning.patch +Patch1431: mesa-7.6-glx13-app-warning.patch + +#Patch1440: r300g-no-llvm.patch + +# 7.11 branch backport +#Patch1460: mesa-7.11-b9c7773e.patch + +# not on 7.11 branch yet +#Patch1470: mesa-7.11-gen6-depth-stalls.patch + +#Patch1480: mesa-r600g-new-pciids.patch +#Patch1481: mesa-7.11-ivybridge-server-pci-ids.patch + +# Patches from EL6 xorg-x11-server-1.7.7 source RPM +# ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Client/en/os/SRPMS/xorg-x11-server-1.7.7-29.el6_1.2.src.rpm +Patch5: xserver-1.4.99-pic-libxf86config.patch +Patch6: xserver-1.7.4-z-now.patch + +# OpenGL compositing manager feature/optimization patches. +Patch103: xserver-1.5.0-bg-none-root.patch + +Patch2014: xserver-1.5.0-projector-fb-size.patch + +# Trivial things to never merge upstream ever: +# This really could be done prettier. +Patch5002: xserver-1.4.99-ssh-isnt-local.patch + +# force mode debugging on for randr 1.2 drivers +Patch6002: xserver-1.5.1-mode-debug.patch + +# don't build the (broken) acpi code +Patch6011: xserver-1.6.0-less-acpi-brokenness.patch + +# Make autoconfiguration chose nouveau driver for NVIDIA GPUs +Patch6016: xserver-1.6.1-nouveau.patch + +# ajax needs to upstream this +Patch6027: xserver-1.6.0-displayfd.patch +Patch6028: xserver-1.6.99-randr-error-debugging.patch +Patch6030: xserver-1.6.99-right-of.patch +Patch6033: xserver-1.6.99-default-modes.patch +Patch6044: xserver-1.6.99-hush-prerelease-warning.patch +Patch6045: xserver-1.7.0-randr-gamma-restore.patch + +Patch6047: xserver-1.7.0-glx-versioning.patch +#Patch6048: xserver-1.7.0-exa-fix-mixed.patch +Patch6049: xserver-1.7.1-multilib.patch +Patch6051: xserver-1.7.1-gamma-kdm-fix.patch +Patch6052: xserver-1.7.1-libcrypto.patch +Patch6066: xserver-1.7.1-glx14-swrast.patch + +Patch6067: xserver-1.7.7-exa-master.patch + +Patch6070: xserver-1.7.3-no-free-on-abort.patch +# 558613 +Patch6075: xserver-1.7.4-qxl-autoconfig.patch +# 516918 +Patch6076: xserver-1.7.4-dpms-timeouts.patch +Patch6077: xserver-1.7.6-export-dix-functions.patch +Patch6078: xserver-1.7.6-export-more-dix-functions.patch + +# 583544 - Pointer jumps to lower-right corner when clicking mousekeys +Patch6087: xserver-1.7.6-pointerkeys.patch + +Patch7002: xserver-1.7.6-no-connected-outputs.patch +# 586926 - randr change while off vt +Patch7003: xserver-1.7.6-randr-vt-switch.patch +# 582710 - pam support +Patch7004: xserver-1.1.1-pam.patch +# 584927 - xinerama coordinate sign fix +Patch7005: xserver-1.7.6-deviceevent-coordinates-xinerama.patch +# 585371 - default mode list unification +Patch7006: xserver-1.7.6-default-modes.patch +# 586567 - big window crash when try to resize +Patch7007: xserver-1.7.7-compresize-fix.patch +# 602080 - fix unnecessary fb resize in multi-head configurations +Patch7008: xserver-1.7.7-randr-initial.patch +# 600180 - Buffer overflow in XKB geometry copying code. +Patch7009: xserver-1.7.7-xkb-invalid-writes.patch +# 600116 - Properties are not reset in the second server generation +Patch7010: xserver-1.7.7-property-generation-reset.patch +# 594523 - Wrong axis mode for absolute axes +Patch7011: xserver-1.7.7-device-mode-list.patch +# 602511 - Stuck modifiers when using multiple keyboards or XTEST +Patch7012: xserver-1.7.7-modifier-keycount.patch +# 588640 - XKEYBOARD Warning: Duplicate shape name "" +Patch7013: xserver-1.7.7-xkb-geom-copy.patch +# 574486 - Dual head setup overlaps one pixel +Patch7014: xserver-1.7.7-fix-randr-rotation.patch +# 600505 - Xephyr utility should be resizeable +Patch7015: xserver-1.7.7-make-ephyr-resize.patch +# 604057 - fix aspect match for classic drivers +Patch7016: xserver-1.7.7-improve-mode-selection.patch +# 607045 - DGA client can crash the server +Patch7017: xserver-1.7.7-dga-master-keyboard.patch +# 607410 - Reproducible stuck grab on server +Patch7018: xserver-1.7.7-event-mask-revert.patch +# 607051 - Keyboard bell settings don't apply to keyboards. +Patch7019: xserver-1.7.7-sd-keyboard-controls.patch +# 607022 - segfault during Xorg -showopts +Patch7020: xserver-1.7.7-showopts-segv.patch +# Related 607150 +Patch7021: xserver-1.7.7-xkb-purge-includes.patch +# Related 607150 +Patch7022: xserver-1.7.7-xkb-rename-fakebutton.patch +# Related 607150 +Patch7023: xserver-1.7.7-xkb-pointerkeys-on-master.patch +# 607150 - Mouse button never releases when xkb PointerKeys are used +Patch7024: xserver-1.7.7-xkb-lockedPtrBtns-state-merge.patch +# 607150 - Mouse button never releases when xkb PointerKeys are used, part2 +Patch7025: xserver-1.7.7-release-xtest-on-phys-buttons.patch +# 581505 - Xephyr crashes inside kvm-qemu virtual host +Patch7026: xserver-1.7.7-xephyr-24bpp.patch +# 605302 - vesa doesn't work on intel gen6 +Patch7027: xserver-1.7.7-int10-reserved-areas.patch +# 618422 - Wrong handling of devices with more than 2 valuators +Patch7028: xserver-1.7.7-postfix-DCE-PointerKeys.patch +# related 618422, Patch7028 +Patch7029: xserver-1.7.7-reset-unused-classes.patch +# 601319 - LVDS activated when notebook lid is closed +Patch7030: xserver-1.7.7-lid-hack.patch +# 585283 - xrandr allows mouse to move into non-existant screen locations +Patch7031: xserver-1.7.7-randr-cursor-dead-zones.patch +# 620333 - mga shows blank screen when X server starts +Patch7032: xserver-1.7.7-ddc-probe-less.patch +# 638234 - Bump classic driver default resolution to 1024x768 +Patch7033: xserver-1.7.7-classic-default-mode.patch + +Patch8000: cve-2011-4818.patch +Patch8001: cve-2011-4818-extra.patch + +# Add -lm when linking X demos +Patch9020: freetype-2.1.10-enable-ft2-bci.patch +Patch9021: freetype-2.3.0-enable-spr.patch + +# Enable otvalid and gxvalid modules +Patch9046: freetype-2.2.1-enable-valid.patch + +# Fix multilib conflicts +Patch9088: freetype-multilib.patch + +Patch9089: freetype-2.3.11-CVE-2010-2498.patch +Patch9090: freetype-2.3.11-CVE-2010-2499.patch +Patch9091: freetype-2.3.11-CVE-2010-2500.patch +Patch9092: freetype-2.3.11-CVE-2010-2519.patch +Patch9093: freetype-2.3.11-CVE-2010-2520.patch +#Patch9094: freetype-2.3.11-CVE-2010-2527.patch +#Patch9095: freetype-2.3.11-axis-name-overflow.patch +Patch9096: freetype-2.3.11-CVE-2010-1797.patch +Patch9097: freetype-2.3.11-CVE-2010-2805.patch +Patch9098: freetype-2.3.11-CVE-2010-2806.patch +Patch9099: freetype-2.3.11-CVE-2010-2808.patch +Patch9100: freetype-2.3.11-CVE-2010-3311.patch +Patch9101: freetype-2.3.11-CVE-2010-3855.patch +Patch9102: freetype-2.3.11-CVE-2011-0226.patch +Patch9103: freetype-2.3.11-CVE-2011-3256.patch +Patch9104: freetype-2.3.11-CVE-2011-3439.patch +Patch9105: freetype-2.3.11-CVE-2012-1126.patch +Patch9106: freetype-2.3.11-CVE-2012-1127.patch +Patch9107: freetype-2.3.11-CVE-2012-1130.patch +Patch9108: freetype-2.3.11-CVE-2012-1131.patch +Patch9109: freetype-2.3.11-CVE-2012-1132.patch +Patch9110: freetype-2.3.11-CVE-2012-1134.patch +Patch9111: freetype-2.3.11-CVE-2012-1136.patch +Patch9112: freetype-2.3.11-CVE-2012-1137.patch +Patch9113: freetype-2.3.11-CVE-2012-1139.patch +Patch9114: freetype-2.3.11-CVE-2012-1140.patch +Patch9115: freetype-2.3.11-CVE-2012-1141.patch +Patch9116: freetype-2.3.11-CVE-2012-1142.patch +Patch9117: freetype-2.3.11-CVE-2012-1143.patch +Patch9118: freetype-2.3.11-CVE-2012-1144.patch +Patch9119: freetype-2.3.11-bdf-overflow.patch +Patch9120: freetype-2.3.11-array-initialization.patch + +Patch10001: xtrans-1.0.3-avoid-gethostname.patch + +Patch10102: dont-forward-keycode-0.patch +Patch10103: libX11-1.3.1-creategc-man-page.patch + +Patch10201: libXext-1.1-XAllocID.patch + +Patch10301: libfontenc-1.0.0-get-fontdir-from-pkgconfig.patch + +Patch10400: libXt-1.0.2-libsm-fix.patch + +%description +Virtual Network Computing (VNC) is a remote display system which +allows you to view a computing 'desktop' environment not only on the +machine where it is running, but from anywhere on the Internet and +from a wide variety of machine architectures. This package contains a +client which will allow you to connect to other desktops running a VNC +server. + +%package server +Summary: A TigerVNC server +Group: User Interface/X +Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 +Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 +Provides: tightvnc-server = 1.5.0-0.15.20090204svn3586 +Obsoletes: tightvnc-server < 1.5.0-0.15.20090204svn3586 +Requires: perl +Requires: tigervnc-server-minimal +Requires: xorg-x11-xauth + +%description server +The VNC system allows you to access the same desktop from a wide +variety of platforms. This package includes set of utilities +which make usage of TigerVNC server more user friendly. It also +contains x0vncserver program which can export your active +X session. + +%package server-minimal +Summary: A minimal installation of TigerVNC server +Group: User Interface/X +Requires(post): chkconfig +Requires(preun):chkconfig +Requires(preun):initscripts +Requires(postun):initscripts + +Requires: xkeyboard-config, xorg-x11-xkb-utils +Requires: tigervnc-license + +%description server-minimal +The VNC system allows you to access the same desktop from a wide +variety of platforms. This package contains minimal installation +of TigerVNC server, allowing others to access the desktop on your +machine. + +%ifnarch s390 s390x +%package server-module +Summary: TigerVNC module to Xorg +Group: User Interface/X +Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 +Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 +Provides: tightvnc-server-module = 1.5.0-0.15.20090204svn3586 +Obsoletes: tightvnc-server-module < 1.5.0-0.15.20090204svn3586 +Requires: xorg-x11-server-Xorg +Requires: tigervnc-license +BuildRequires: nasm >= 2.04 + +%description server-module +This package contains libvnc.so module to X server, allowing others +to access the desktop on your machine. +%endif + +%package server-applet +Summary: Java TigerVNC viewer applet for TigerVNC server +Group: User Interface/X +Requires: tigervnc-server, java, jpackage-utils +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + +%description server-applet +The Java TigerVNC viewer applet for web browsers. Install this package to allow +clients to use web browser when connect to the TigerVNC server. + +%package license +Summary: License of TigerVNC suite +Group: User Interface/X +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + +%description license +This package contains license of the TigerVNC suite + +%package icons +Summary: Icons for TigerVNC viewer +Group: User Interface/X +%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6 || 0%{?centos} >= 6 +BuildArch: noarch +%endif + +%description icons +This package contains icons for TigerVNC viewer + +%prep +rm -rf %{_builddir}/%{name}-%{version}%{?snap:-%{snap}} +%setup -q -n %{name}-%{version}%{?snap:-%{snap}} + +# sed -i -e 's/80/0/g' CMakeLists.txt +%patch4 -p1 -b .cookie +%patch10 -p1 -b .ldnow +%patch11 -p1 -b .gethomedir +%patch13 -p1 -b .rh692048 + +tar xzf %SOURCE11 +pushd fltk-* +%patch110 -p1 -b .keyboard-x11 +%patch111 -p1 -b .keyboard-win32 +%patch112 -p1 -b .keyboard-osx +%patch113 -p1 -b .clipboard +%patch114 -p1 -b .clipboard-x11 +%patch115 -p1 -b .clipboard-win32-fix +%patch116 -p1 -b .clipboard-win32 +%patch117 -p1 -b .clipboard-osx +%patch118 -p1 -b .pixmap +%patch119 -p1 -b .cursor +%patch120 -p1 -b .modal +%patch121 -p1 -b .icons +%patch122 -p1 -b .screen_num +%patch123 -p1 -b .multihead +popd + +tar xzf %SOURCE12 + +mkdir xorg +pushd xorg +tar xjf %SOURCE99 +tar xjf %SOURCE100 +tar xjf %SOURCE101 +tar xjf %SOURCE102 +tar xjf %SOURCE103 +tar xjf %SOURCE104 +tar xjf %SOURCE105 +tar xjf %SOURCE106 +tar xjf %SOURCE107 +tar xjf %SOURCE108 +tar xjf %SOURCE109 +tar xjf %SOURCE110 +tar xjf %SOURCE111 +tar xjf %SOURCE112 +tar xjf %SOURCE113 +tar xjf %SOURCE114 +tar xjf %SOURCE115 +tar xjf %SOURCE116 +tar xjf %SOURCE117 +tar xjf %SOURCE118 +tar xjf %SOURCE119 +tar xjf %SOURCE120 +tar xjf %SOURCE121 +tar xjf %SOURCE122 +tar xjf %SOURCE123 +tar xjf %SOURCE124 +tar xjf %SOURCE125 +tar xjf %SOURCE126 +tar xjf %SOURCE127 +tar xjf %SOURCE128 +tar xjf %SOURCE129 +tar xjf %SOURCE130 +tar xjf %SOURCE131 +tar xjf %SOURCE132 +tar xjf %SOURCE133 +tar xjf %SOURCE134 +tar xjf %SOURCE135 +tar xjf %SOURCE136 +tar xjf %SOURCE137 +tar xjf %SOURCE138 +tar xjf %SOURCE139 +tar xjf %SOURCE140 +tar xjf %SOURCE141 +tar xjf %SOURCE142 +tar xjf %SOURCE143 +tar xjf %SOURCE144 +tar xjf %SOURCE145 +tar xjf %SOURCE146 +tar xjf %SOURCE147 +tar xjf %SOURCE148 +tar xjf %SOURCE149 +tar xjf %SOURCE150 +tar xjf %SOURCE151 +tar xjf %SOURCE152 +tar xjf %SOURCE153 +tar xjf %SOURCE154 +tar xjf %SOURCE155 +tar xjf %SOURCE156 +#tar xjf %SOURCE157 +#tar xjf %SOURCE158 +tar xjf %SOURCE159 +tar xjf %SOURCE160 +tar xjf %SOURCE161 +tar xzf %SOURCE162 +tar xjf %SOURCE163 +tar xjf %SOURCE164 +popd +cp -a unix/xserver xorg/xserver +cp -a xorg/xorg-server-1.*/* xorg/xserver +pushd xorg +pushd libdrm-* +%patch133 -p1 -b .forceperms +%patch134 -p1 -b .no-bc +%patch135 -p1 -b .page-flip +%patch136 -p1 -b .nouveau-pbrestart +%patch137 -p1 -b .nouveau-drop +%patch138 -p1 -b .nouveau-relocs +popd +pushd Mesa-* +%patch141 -p1 -b .osmesa +%patch142 -p1 -b .intel-glthread +%patch143 -p1 -b .no-mach64 +#%patch147 -p1 -b .dricore +%patch149 -p1 -b .intel-vbl +#%patch1410 -p1 -b .r600_tfp +#%patch1413 -p1 -b .sparc64 +%patch1430 -p1 -b .vblank-warning +%patch1431 -p1 -b .glx13-warning +#%patch1440 -p1 -b .r300g +#%patch1460 -p1 + +#%patch1470 -p1 -b .depth-stall + +#%patch1480 -p1 -b .r600gpciids +#%patch1481 -p1 -b .ivbpciid +popd + +pushd freetype-* +%patch9020 -p1 -b .enable-ft2-bci +%patch9021 -p1 -b .enable-spr + +# Enable otvalid and gxvalid modules +%patch9046 -p1 -b .enable-valid + +# Fix multilib conflicts +%patch9088 -p1 -b .multilib + +%patch9089 -p1 -b .CVE-2010-2498 +%patch9090 -p1 -b .CVE-2010-2499 +%patch9091 -p1 -b .CVE-2010-2500 +%patch9092 -p1 -b .CVE-2010-2519 +%patch9093 -p1 -b .CVE-2010-2520 +%patch9096 -p1 -b .CVE-2010-1797 +%patch9097 -p1 -b .CVE-2010-2805 +%patch9098 -p1 -b .CVE-2010-2806 +%patch9099 -p1 -b .CVE-2010-2808 +%patch9100 -p1 -b .CVE-2010-3311 +%patch9101 -p1 -b .CVE-2010-3855 +%patch9102 -p1 -b .CVE-2011-0226 +%patch9103 -p1 -b .CVE-2011-3256 +%patch9104 -p1 -b .CVE-2011-3439 +%patch9105 -p1 -b .CVE-2012-1126 +%patch9106 -p1 -b .CVE-2012-1127 +%patch9107 -p1 -b .CVE-2012-1130 +%patch9108 -p1 -b .CVE-2012-1131 +%patch9109 -p1 -b .CVE-2012-1132 +%patch9110 -p1 -b .CVE-2012-1134 +%patch9111 -p1 -b .CVE-2012-1136 +%patch9112 -p1 -b .CVE-2012-1137 +%patch9113 -p1 -b .CVE-2012-1139 +%patch9114 -p1 -b .CVE-2012-1140 +%patch9115 -p1 -b .CVE-2012-1141 +%patch9116 -p1 -b .CVE-2012-1142 +%patch9117 -p1 -b .CVE-2012-1143 +%patch9118 -p1 -b .CVE-2012-1144 +%patch9119 -p1 -b .bdf-overflow +%patch9120 -p1 -b .array-initialization +popd + +pushd xtrans-* +%patch10001 -p1 -b .my-name-is-unix +popd + +pushd libX11-* +%patch10102 -p1 -b .dont-forward-keycode-0 +%patch10103 -p1 -b .manual +popd + +pushd libXext-* +%patch10201 -p1 +popd + +pushd libfontenc-* +%patch10301 -p0 -b .get-fontdir-from-pkgconfig +popd + +pushd libXt-* +%patch10400 -p1 -b .libsm-fix +popd + +pushd xserver +patch -p1 < %{_builddir}/%{name}-%{version}%{?snap:-%{snap}}/unix/xserver17.patch + +for all in `find %{_builddir}/%{name}-%{version}%{?snap:-%{snap}}/unix/xorg-7.5-patches/ -type f |grep '.*\.patch$'`; do + echo Applying $all + patch -p1 < $all +done +%patch101 -p1 -b .ac-compatibility +%patch102 -p1 -b .CopyISOLatin1Lowered + +%patch5 -p1 -b .xserver-1.4.99-pic-libxf86config +%patch6 -p1 -b .xserver-1.7.4-z-now + +# OpenGL compositing manager feature/optimization patches. +%patch103 -p1 -b .xserver-1.5.0-bg-none-root + +%patch2014 -p1 -b .xserver-1.5.0-projector-fb-size + +# Trivial things to never merge upstream ever: +# This really could be done prettier. +%patch5002 -p1 -b .xserver-1.4.99-ssh-isnt-local + +# force mode debugging on for randr 1.2 drivers +%patch6002 -p1 -b .xserver-1.5.1-mode-debug + +# don't build the (broken) acpi code +%patch6011 -p1 -b .xserver-1.6.0-less-acpi-brokenness + +# Make autoconfiguration chose nouveau driver for NVIDIA GPUs +%patch6016 -p1 -b .xserver-1.6.1-nouveau + +# ajax needs to upstream this +%patch6027 -p1 -b .xserver-1.6.0-displayfd +%patch6028 -p1 -b .xserver-1.6.99-randr-error-debugging +%patch6030 -p1 -b .xserver-1.6.99-right-of +%patch6033 -p1 -b .xserver-1.6.99-default-modes +%patch6044 -p1 -b .xserver-1.6.99-hush-prerelease-warning +%patch6045 -p1 -b .xserver-1.7.0-randr-gamma-restore + +%patch6047 -p1 -b .xserver-1.7.0-glx-versioning +#%patch6048 -p1 -b .xserver-1.7.0-exa-fix-mixed +%patch6049 -p1 -b .xserver-1.7.1-multilib +%patch6051 -p1 -b .xserver-1.7.1-gamma-kdm-fix +%patch6052 -p1 -b .xserver-1.7.1-libcrypto +%patch6066 -p1 -b .xserver-1.7.1-glx14-swrast + +%patch6067 -p1 -b .xserver-1.7.7-exa-master + +%patch6070 -p1 -b .xserver-1.7.3-no-free-on-abort +# 558613 +%patch6075 -p1 -b .xserver-1.7.4-qxl-autoconfig +# 516918 +%patch6076 -p1 -b .xserver-1.7.4-dpms-timeouts +%patch6077 -p1 -b .xserver-1.7.6-export-dix-functions +%patch6078 -p1 -b .xserver-1.7.6-export-more-dix-functions + +# 583544 - Pointer jumps to lower-right corner when clicking mousekeys +%patch6087 -p1 -b .xserver-1.7.6-pointerkeys + +%patch7002 -p1 -b .xserver-1.7.6-no-connected-outputs +# 586926 - randr change while off vt +%patch7003 -p1 -b .xserver-1.7.6-randr-vt-switch +# 582710 - pam support +%patch7004 -p1 -b .xserver-1.1.1-pam +# 584927 - xinerama coordinate sign fix +%patch7005 -p1 -b .xserver-1.7.6-deviceevent-coordinates-xinerama +# 585371 - default mode list unification +%patch7006 -p1 -b .xserver-1.7.6-default-modes +# 586567 - big window crash when try to resize +%patch7007 -p1 -b .xserver-1.7.7-compresize-fix +# 602080 - fix unnecessary fb resize in multi-head configurations +%patch7008 -p1 -b .xserver-1.7.7-randr-initial +# 600180 - Buffer overflow in XKB geometry copying code. +%patch7009 -p1 -b .xserver-1.7.7-xkb-invalid-writes +# 600116 - Properties are not reset in the second server generation +%patch7010 -p1 -b .xserver-1.7.7-property-generation-reset +# 594523 - Wrong axis mode for absolute axes +%patch7011 -p1 -b .xserver-1.7.7-device-mode-list +# 602511 - Stuck modifiers when using multiple keyboards or XTEST +%patch7012 -p1 -b .xserver-1.7.7-modifier-keycount +# 588640 - XKEYBOARD Warning: Duplicate shape name "" +%patch7013 -p1 -b .xserver-1.7.7-xkb-geom-copy +# 574486 - Dual head setup overlaps one pixel +%patch7014 -p1 -b .xserver-1.7.7-fix-randr-rotation +# 600505 - Xephyr utility should be resizeable +%patch7015 -p1 -b .xserver-1.7.7-make-ephyr-resize +# 604057 - fix aspect match for classic drivers +%patch7016 -p1 -b .xserver-1.7.7-improve-mode-selection +# 607045 - DGA client can crash the server +%patch7017 -p1 -b .xserver-1.7.7-dga-master-keyboard +# 607410 - Reproducible stuck grab on server +%patch7018 -p1 -b .xserver-1.7.7-event-mask-revert +# 607051 - Keyboard bell settings don't apply to keyboards. +%patch7019 -p1 -b .xserver-1.7.7-sd-keyboard-controls +# 607022 - segfault during Xorg -showopts +%patch7020 -p1 -b .xserver-1.7.7-showopts-segv +# Related 607150 +%patch7021 -p1 -b .xserver-1.7.7-xkb-purge-includes +# Related 607150 +%patch7022 -p1 -b .xserver-1.7.7-xkb-rename-fakebutton +# Related 607150 +%patch7023 -p1 -b .xserver-1.7.7-xkb-pointerkeys-on-master +# 607150 - Mouse button never releases when xkb PointerKeys are used +%patch7024 -p1 -b .xserver-1.7.7-xkb-lockedPtrBtns-state-merge +# 607150 - Mouse button never releases when xkb PointerKeys are used, part2 +%patch7025 -p1 -b .xserver-1.7.7-release-xtest-on-phys-buttons +# 581505 - Xephyr crashes inside kvm-qemu virtual host +%patch7026 -p1 -b .xserver-1.7.7-xephyr-24bpp +# 605302 - vesa doesn't work on intel gen6 +%patch7027 -p1 -b .xserver-1.7.7-int10-reserved-areas +# 618422 - Wrong handling of devices with more than 2 valuators +%patch7028 -p1 -b .xserver-1.7.7-postfix-DCE-PointerKeys +# related 618422, Patch7028 +%patch7029 -p1 -b .xserver-1.7.7-reset-unused-classes +# 601319 - LVDS activated when notebook lid is closed +%patch7030 -p1 -b .xserver-1.7.7-lid-hack +# 585283 - xrandr allows mouse to move into non-existant screen locations +%patch7031 -p1 -b .xserver-1.7.7-randr-cursor-dead-zones +# 620333 - mga shows blank screen when X server starts +%patch7032 -p1 -b .xserver-1.7.7-ddc-probe-less +# 638234 - Bump classic driver default resolution to 1024x768 +%patch7033 -p1 -b .xserver-1.7.7-classic-default-mode + +%patch8000 -p1 -b .cve-2011-4818 +%patch8001 -p1 -b .cve-2011-4818-extra +popd + +popd + +%build +%define tigervnc_src_dir %{_builddir}/%{name}-%{version}%{?snap:-%{snap}} +%define static_lib_buildroot %{tigervnc_src_dir}/build +export CC=gcc44 +export CXX=g++44 +export CFLAGS="$RPM_OPT_FLAGS" +export CXXFLAGS="$CFLAGS" + +echo "*** Building fltk ***" +pushd fltk-* +export CFLAGS="$RPM_OPT_FLAGS" +export CXXFLAGS="$CFLAGS -static-libgcc" +%{cmake28} -G"Unix Makefiles" \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DCMAKE_BUILD_TYPE=Release \ + -DOPTION_PREFIX_LIB=%{_libdir} \ + -DOPTION_PREFIX_CONFIG=%{_libdir} \ + -DOPTION_USE_THREADS=off \ + -DOPTION_BUILD_EXAMPLES=off \ + -DOPTION_USE_SYSTEM_LIBPNG=on +make %{?_smp_mflags} +popd + +echo "*** Building libjpeg-turbo ***" +pushd libjpeg-turbo-* +export CFLAGS="$RPM_OPT_FLAGS -fPIC" +export CXXFLAGS="$CFLAGS -static-libgcc" +./configure --prefix=%{_prefix} --libdir=%{_libdir} --disable-nls --enable-static --disable-shared +make %{?_smp_mflags} DESTDIR=%{static_lib_buildroot} install +popd + +echo "*** Building VNC ***" +export CFLAGS="$RPM_OPT_FLAGS -fPIC" +export CXXFLAGS="$CFLAGS" +%{cmake28} -G"Unix Makefiles" \ + -DBUILD_STATIC=1 \ + -DUSE_INCLUDED_ZLIB=1 \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DFLTK_LIBRARIES="%{tigervnc_src_dir}/fltk-1.3.2/lib/libfltk.a;%{tigervnc_src_dir}/fltk-1.3.2/lib/libfltk_images.a;`g++ -print-file-name=libpng.a`" \ + -DFLTK_FLUID_EXECUTABLE=%{tigervnc_src_dir}/fltk-1.3.2/bin/fluid \ + -DFLTK_INCLUDE_DIR=%{tigervnc_src_dir}/fltk-1.3.2 \ + -DJPEG_INCLUDE_DIR=%{static_lib_buildroot}%{_includedir} \ + -DJPEG_LIBRARY=%{static_lib_buildroot}%{_libdir}/libjpeg.a \ + -DGNUTLS_LIBRARY='%{_libdir}/libgnutls.a;%{_libdir}/libgcrypt.a;%{_libdir}/libgpg-error.a' +make %{?_smp_mflags} + +echo "*** Building Xorg ***" +%define xorg_buildroot %{tigervnc_src_dir}/xorg.build +mkdir -p %{xorg_buildroot}%{_libdir} +pushd %{xorg_buildroot}%{_libdir} +ln -s `g++ -print-file-name=libstdc++.a` +ln -s `g++ -print-file-name=libcrypto.a` +ln -s `g++ -print-file-name=libz.a` +ln -s `g++ -print-file-name=libgcc.a` +popd +export CFLAGS="$RPM_OPT_FLAGS -fPIC -I%{xorg_buildroot}%{_includedir}" +export CXXFLAGS="$RPM_OPT_FLAGS -fPIC -I%{xorg_buildroot}%{_includedir} -static-libgcc" +export LDFLAGS="-L%{xorg_buildroot}%{_libdir} $LDFLAGS" +export ACLOCAL="aclocal -I %{xorg_buildroot}%{_datadir}/aclocal" +export PKG_CONFIG_PATH="%{xorg_buildroot}%{_libdir}/pkgconfig:%{xorg_buildroot}%{_datadir}/pkgconfig" +pushd xorg +pushd util-macros-* +echo "Building macros" +./configure --prefix=/usr --libdir=%{_libdir} --disable-nls --enable-static --disable-shared +make DESTDIR=%{xorg_buildroot} install +find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir='%{_libdir}'|libdir='%{xorg_buildroot}%{_libdir}'|" {} \; +find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; +find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=/usr|prefix=%{xorg_buildroot}%{_prefix}|" {} \; +popd + +echo "*** Building freetype ***" +pushd freetype-* +./configure --prefix=/usr --libdir=%{_libdir} --enable-static --disable-shared --with-libtool=/usr/bin/libtool --disable-nls CFLAGS="$CFLAGS -fno-strict-aliasing" +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' builds/unix/libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' builds/unix/libtool +make DESTDIR=%{xorg_buildroot} install +find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir='%{_libdir}'|libdir='%{xorg_buildroot}%{_libdir}'|" {} \; +find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; +find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=/usr|prefix=%{xorg_buildroot}%{_prefix}|" {} \; +# fix multilib issues +%ifarch x86_64 s390x ia64 ppc64 alpha sparc64 +%define wordsize 64 +%else +%define wordsize 32 +%endif + +mv %{xorg_buildroot}%{_includedir}/freetype2/freetype/config/ftconfig.h \ + %{xorg_buildroot}%{_includedir}/freetype2/freetype/config/ftconfig-%{wordsize}.h +cat >%{xorg_buildroot}%{_includedir}/freetype2/freetype/config/ftconfig.h < + +#if __WORDSIZE == 32 +# include "ftconfig-32.h" +#elif __WORDSIZE == 64 +# include "ftconfig-64.h" +#else +# error "unexpected value for __WORDSIZE macro" +#endif + +#endif +EOF +popd + +modules="\ + dri2proto \ + glproto \ + xf86vidmodeproto \ + xextproto \ + xproto \ + kbproto \ + inputproto \ + xcmiscproto \ + bigreqsproto \ + xf86bigfontproto \ + fixesproto \ + damageproto \ + xf86driproto \ + randrproto \ + renderproto \ + scrnsaverproto \ + resourceproto \ + fontsproto \ + videoproto \ + compositeproto \ + xineramaproto \ + xf86dgaproto \ + recordproto \ + xtrans \ + libXau \ + libXdmcp \ + libpthread-stubs \ + libX11 \ + libXext \ + libfontenc \ + libICE \ + libSM \ + libXt \ + libXmu \ + libXpm \ + libXaw \ + libXfixes \ + libXcomposite \ + libXrender \ + libXdamage \ + libXcursor \ + libXfont \ + libXft \ + libXi \ + libXinerama \ + libxkbfile \ + libXrandr \ + libXres \ + libXtst \ + libXv \ + libXxf86dga \ + libXxf86vm \ + libXxf86misc \ + libpciaccess \ + pixman \ + libdrm" + +for module in ${modules}; do + extraoptions="" + pushd ${module}-* + echo ====================== + echo configuring ${module} + echo ====================== +%ifarch i386 i686 + if [ "${module}" = "libdrm" ]; then + export CFLAGS=`echo $CFLAGS | sed -e 's/-march=i*86/-march=native/'` + fi +%endif + if [ "${module}" = "libXaw" ]; then + extraoptions="${extraoptions} --disable-xaw8 --disable-xaw6" + fi + #if [ "${module}" = "randrproto" ]; then + # ./autogen.sh + #fi + if [ "${module}" = "libX11" ]; then + extraoptions="${extraoptions} --without-xcb --disable-specs --disable-dependency-tracking" + fi + if [ "${module}" = "libSM" ]; then + extraoptions="${extraoptions} --without-libuuid" + fi + if [ "${module}" = "pixman" ]; then + extraoptions="${extraoptions} --disable-gtk" + aclocal -I %{xorg_buildroot}%{_datadir}/aclocal + autoconf + autoreconf -fiv + fi + if [ "${module}" = "libXfont" ]; then + extraoptions="${extraoptions} --with-freetype-config=%{xorg_buildroot}%{_bindir}/freetype-config" + fi + ./configure --prefix=/usr --libdir=%{_libdir} ${extraoptions} --enable-static --disable-shared + echo ====================== + echo building ${module} + echo ====================== + make DESTDIR=%{xorg_buildroot} install + find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir='%{_libdir}'|libdir='%{xorg_buildroot}%{_libdir}'|" {} \; + find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; + find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=/usr|prefix=%{xorg_buildroot}%{_prefix}|" {} \; + popd +done + +# build mesa +echo "*** Building Mesa ***" +pushd Mesa-* +%ifarch %{ix86} +# i do not have words for how much the assembly dispatch code infuriates me +%define _mesa_flags --enable-pic --disable-asm +%else +%define _mesa_flags --enable-pic +%endif +export CFLAGS="$RPM_OPT_FLAGS -fvisibility=hidden -Os" +export CXXFLAGS="$RPM_OPT_FLAGS -fvisibility=hidden -Os -static-libgcc" + +# Need to set cfghost? +./configure \ + --prefix=/usr \ + --libdir=%{_libdir} \ + --enable-motif \ + --with-driver=dri \ + --with-dri-drivers=swrast \ + --with-dri-driverdir=%{_libdir}/dri \ + --with-gallium-drivers="" \ + --without-demos \ + --disable-driglx-direct \ + --disable-egl \ + --disable-glut \ + --disable-gallium \ + --disable-gl-osmesa \ + --disable-gallium-intel \ + --disable-gallium-radeon \ + --disable-gallium-nouveau \ + %{_mesa_flags} + +# Mesa build fails to install libGLU* if 'make install' is run before 'make' +make DESTDIR=%{xorg_buildroot} +make DESTDIR=%{xorg_buildroot} install +find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir='%{_libdir}'|libdir='%{xorg_buildroot}%{_libdir}'|" {} \; +find %{xorg_buildroot}%{_prefix} -type f -name "*.la" -exec sed -i -e "s|libdir=%{_libdir}|libdir=%{xorg_buildroot}%{_libdir}|" {} \; +find %{xorg_buildroot}%{_prefix} -type f -name "*.pc" -exec sed -i -e "s|prefix=/usr|prefix=%{xorg_buildroot}%{_prefix}|" {} \; +#rm %{xorg_buildroot}%{_libdir}/dri/libdricore.so +popd + +popd +pushd xorg/xserver +export CFLAGS="$RPM_OPT_FLAGS -fPIC -I%{xorg_buildroot}%{_includedir}" +export CXXFLAGS="$RPM_OPT_FLAGS -fPIC -I%{xorg_buildroot}%{_includedir} -static-libgcc" +export PIXMANINCDIR=%{xorg_buildroot}%{_includedir}/pixman-1 +autoreconf -fiv + +./configure --prefix=/usr --libdir=%{_libdir} --mandir=%{_datadir}/man \ + --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \ + --disable-xwin --disable-xephyr --disable-kdrive --with-pic \ + --disable-xinerama \ + --with-int10=x86emu \ + --enable-xdmcp \ + --enable-composite \ + --disable-xgl \ + --disable-xglx \ + --enable-freetype \ + --with-fontdir=%{_datadir}/X11/fonts \ + --with-xkb-output=%{_localstatedir}/lib/xkb \ + --enable-install-libxf86config \ + --enable-glx --disable-dri --enable-dri2 \ + --disable-config-dbus \ + --disable-config-hal \ + --disable-config-udev \ + --with-dri-driver-path=%{_libdir}/dri \ + --without-dtrace \ + --disable-unit-tests \ + --disable-devel-docs \ + --with-sha1=libgcrypt SHA1_LIB=-lcrypto \ + --disable-shared \ + --enable-static \ + --disable-record \ + --enable-aiglx \ + --disable-xvmc \ + --enable-dga \ + --disable-screensaver \ + --enable-xdm-auth-1 \ + --enable-xf86vidmode \ + --enable-xcsecurity \ + --enable-appgroup \ + --enable-xevie \ + --enable-evi \ + --enable-multibuffer \ + --enable-xf86bigfont \ + --disable-dpms \ + --disable-ipv6 \ + --with-mesa-source=%{tigervnc_src_dir}/xorg/Mesa-%{mesa_version} \ + --with-freetype-config=%{xorg_buildroot}%{_bindir}/freetype-config \ + --disable-maintainer-mode + +sed -i -e 's/^ECHO/echo/' ./libtool + +make TIGERVNC_SRCDIR=%{tigervnc_src_dir} %{?_smp_mflags} +popd + +# Build icons +pushd media +make +popd + +# Build Java applet +pushd java +%{cmake28} . +make +popd + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT + +pushd xorg/xserver/hw/vnc +make install DESTDIR=$RPM_BUILD_ROOT +popd + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/vncserver +install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/vncservers + +# Install desktop stuff +mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,24x24,48x48}/apps + +pushd media/icons +for s in 16 24 48; do +install -m644 tigervnc_$s.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x$s/apps/tigervnc.png +done +popd + +mkdir $RPM_BUILD_ROOT%{_datadir}/applications +desktop-file-install \ + --dir $RPM_BUILD_ROOT%{_datadir}/applications \ + --vendor="" \ + %{SOURCE6} + +# Install Java applet +pushd java +mkdir -p $RPM_BUILD_ROOT%{_datadir}/vnc/classes +install -m755 VncViewer.jar $RPM_BUILD_ROOT%{_datadir}/vnc/classes +install -m644 com/tigervnc/vncviewer/index.vnc $RPM_BUILD_ROOT%{_datadir}/vnc/classes +popd + +%find_lang %{name} %{name}.lang + +# remove unwanted files +rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.la +rm -f $RPM_BUILD_ROOT%{_libdir}/dri/libdricore.so + +%ifarch s390 s390x %{?rhel:ppc ppc64} +rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.so +%endif + +# move files to correct location +mkdir -p $RPM_BUILD_ROOT%{_libdir}/dri +cp %{xorg_buildroot}%{_libdir}/dri/* $RPM_BUILD_ROOT%{_libdir}/dri/ + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +touch -c %{_datadir}/icons/hicolor +if [ -x %{_bindir}/gtk-update-icon-cache ]; then + %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : +fi + +%postun +touch -c %{_datadir}/icons/hicolor +if [ -x %{_bindir}/gtk-update-icon-cache ]; then + %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : +fi + +%post server +/sbin/chkconfig --add vncserver + +%preun server +if [ $1 -eq 0 ]; then + /sbin/service vncserver stop &>/dev/null || : + /sbin/chkconfig --del vncserver +fi + +%postun server +/sbin/service vncserver condrestart &>/dev/null || : + +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc README.txt +%{_bindir}/vncviewer +%{_datadir}/applications/* +%{_mandir}/man1/vncviewer.1* + +%files server +%defattr(-,root,root,-) +%config(noreplace) %{_sysconfdir}/sysconfig/vncservers +%config(noreplace) %{_sysconfdir}/init.d/vncserver +%{_bindir}/x0vncserver +%{_bindir}/vncserver +%{_mandir}/man1/vncserver.1* +%{_mandir}/man1/x0vncserver.1* + +%files server-minimal +%defattr(-,root,root,-) +%{_bindir}/vncconfig +%{_bindir}/vncpasswd +%{_bindir}/Xvnc +%{_mandir}/man1/Xvnc.1* +%{_mandir}/man1/vncpasswd.1* +%{_mandir}/man1/vncconfig.1* +%{_libdir}/dri/swrast_dri.so + +%ifnarch s390 s390x +%files server-module +%defattr(-,root,root,-) +%{_libdir}/xorg/modules/extensions/libvnc.a +%endif + +%files server-applet +%defattr(-,root,root,-) +%doc java/com/tigervnc/vncviewer/README +%{_datadir}/vnc/classes/* + +%files license +%defattr(-,root,root,-) +%doc LICENCE.TXT + +%files icons +%defattr(-,root,root,-) +%{_datadir}/icons/hicolor/*/apps/* + +%changelog +* Thu Nov 28 2013 Brian P. Hinz 1.3.80-17.20131128svn5139 +- Bumped version to 1.3.80 +- Cleaned up linter warnings + +* Thu Jul 05 2013 Brian P. Hinz 1.3.0 +- Upstream 1.3.0 release +- Conditional-ized %snap for release + +* Fri Jun 14 2013 Brian P. Hinz 1.2.90-14.20130531svn5120 +- Update libjpeg-turbo to 1.3.0 + +* Fri May 24 2013 Brian P. Hinz 1.2.90-14.20130524svn5114 +- Improve spec file portability + +* Fri May 17 2013 Brian P. Hinz 1.2.90-13.20130425svn5087 +- Improve portability with more static linking + +* Thu Apr 04 2013 Brian P. Hinz 1.2.80-12.20130330svn5066 +- Added conditional -march arg to libdrm-intel to allow building on i386 +- Fixed version to reflect upstream pre-release versioning + +* Sat Mar 30 2013 Brian P. Hinz 1.2.0-11.20130330svn5066 +- Updated to TigerVNC svn 5066 +- Updated fltk to 1.3.2 and updated fltk patches per BUILDING.txt +- Fixed vncserver init script & config file which had been overwritten by + systemd versions. + +* Wed Nov 28 2012 Brian P. Hinz 1.2.0-7.20120915svn4999 +- Changed BuildRequires to cmake28 +- Set PIXMANINCDIR when building Xvnc + +* Tue Sep 18 2012 Brian P. Hinz 1.2.0-6.20120915svn4999 +- Applied icon support patch + +* Sat Sep 15 2012 Brian P. Hinz 1.2.0-5.20120915svn4999 +- Update to TigerVNC svn r4999 snapshot +- Build a static libjpeg-turbo to remove the external dependency +- Applied Cendio's Fltk patches, except for the icon patch which I cannot get to build + without creating undefined reference errors during linking + +* Thu Jul 19 2012 Brian P. Hinz 1.2.0-4.20120719svn4941 +- Update to TigerVNC svn r4941 snapshot +- Removed border-hook.patch since it's been committed + +* Wed Jul 18 2012 Brian P. Hinz 1.2.0-3.20120715svn4937 +- Update to TigerVNC svn r4937 snapshot +- Applied border-hook.patch from devel list to fix bug #3415308 +- Use build order recommended by cgit.freedesktop.org/xorg/util/modular/tree/build.sh +- Removed tigervnc11-rh692048.patch as it seems to break support for VeNCrypt + +* Sun Jul 15 2012 Brian P. Hinz 1.2.0-1.20120715svn4935 +- Adapted spec file for building static linked binary on RHEL5 from F16 + spec file and DRC's build-xorg script included in src tarball. +- Update to TigerVNC svn r4935 snapshot +- Need to use inkscape on RHEL5 because convert is broken + +* Tue Nov 22 2011 Adam Tkac - 1.1.0-3 +- don't build X.Org devel docs (#755782) +- applet: BR generic java-devel instead of java-gcj-devel (#755783) +- use runuser to start Xvnc in systemd service file (#754259) +- don't attepmt to restart Xvnc session during update/erase (#753216) + +* Fri Nov 11 2011 Adam Tkac - 1.1.0-2 +- libvnc.so: don't use unexported GetMaster function (#744881) +- remove nasm buildreq + +* Mon Sep 12 2011 Adam Tkac - 1.1.0-1 +- update to 1.1.0 +- update the xorg11 patch +- patches merged + - tigervnc11-glx.patch + - tigervnc11-CVE-2011-1775.patch + - 0001-Use-memmove-instead-of-memcpy-in-fbblt.c-when-memory.patch + +* Thu Jul 28 2011 Adam Tkac - 1.0.90-6 +- add systemd service file and remove legacy SysV initscript (#717227) + +* Tue May 12 2011 Adam Tkac - 1.0.90-5 +- make Xvnc buildable against X.Org 1.11 + +* Tue May 10 2011 Adam Tkac - 1.0.90-4 +- viewer can send password without proper validation of X.509 certs + (CVE-2011-1775) + +* Wed Apr 13 2011 Adam Tkac - 1.0.90-3 +- fix wrong usage of memcpy which caused screen artifacts (#652590) +- don't point to inaccessible link in sysconfig/vncservers (#644975) + +* Fri Apr 08 2011 Adam Tkac - 1.0.90-2 +- improve compatibility with vinagre client (#692048) + +* Tue Mar 22 2011 Adam Tkac - 1.0.90-1 +- update to 1.0.90 + +* Wed Feb 09 2011 Fedora Release Engineering - 1.0.90-0.32.20110117svn4237 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 17 2011 Adam Tkac 1.0.90-0.31.20110117svn4237 +- fix libvnc.so module loading + +* Mon Jan 17 2011 Adam Tkac 1.0.90-0.30.20110117svn4237 +- update to r4237 +- patches merged + - tigervnc11-optionsdialog.patch + - tigervnc11-rh607866.patch + +* Fri Jan 14 2011 Adam Tkac 1.0.90-0.29.20101208svn4225 +- improve patch for keyboard issues + +* Fri Jan 14 2011 Adam Tkac 1.0.90-0.28.20101208svn4225 +- attempt to fix various keyboard-related issues (key repeating etc) + +* Fri Jan 07 2011 Adam Tkac 1.0.90-0.27.20101208svn4225 +- render "Ok" and "Cancel" buttons in the options dialog correctly + +* Wed Dec 15 2010 Jan Görig 1.0.90-0.26.20101208svn4225 +- added vncserver lock file (#662784) + +* Fri Dec 10 2010 Adam Tkac 1.0.90-0.25.20101208svn4225 +- update to r4225 +- patches merged + - tigervnc11-rh611677.patch + - tigervnc11-rh633931.patch + - tigervnc11-xorg1.10.patch +- enable VeNCrypt and PAM support + +* Mon Dec 06 2010 Adam Tkac 1.0.90-0.24.20100813svn4123 +- rebuild against xserver 1.10.X +- 0001-Return-Success-from-generate_modkeymap-when-max_keys.patch merged + +* Wed Sep 29 2010 jkeating - 1.0.90-0.23.20100813svn4123 +- Rebuilt for gcc bug 634757 + +* Tue Sep 21 2010 Adam Tkac 1.0.90-0.22.20100420svn4030 +- drop xorg-x11-fonts-misc dependency (#636170) + +* Tue Sep 21 2010 Adam Tkac 1.0.90-0.21.20100420svn4030 +- improve patch for #633645 (fix tcsh incompatibilities) + +* Thu Sep 16 2010 Adam Tkac 1.0.90-0.20.20100813svn4123 +- press fake modifiers correctly (#633931) +- supress unneeded debug information emitted from initscript (#633645) + +* Wed Aug 25 2010 Adam Tkac 1.0.90-0.19.20100813svn4123 +- separate Xvnc, vncpasswd and vncconfig to -server-minimal subpkg (#626946) +- move license to separate subpkg and Requires it from main subpkgs +- Xvnc: handle situations when no modifiers exist well (#611677) + +* Fri Aug 13 2010 Adam Tkac 1.0.90-0.18.20100813svn4123 +- update to r4123 (#617973) +- add perl requires to -server subpkg (#619791) + +* Thu Jul 22 2010 Adam Tkac 1.0.90-0.17.20100721svn4113 +- update to r4113 +- patches merged + - tigervnc11-rh586406.patch + - tigervnc11-libvnc.patch + - tigervnc11-rh597172.patch + - tigervnc11-rh600070.patch + - tigervnc11-options.patch +- don't own %%{_datadir}/icons directory (#614301) +- minor improvements in the .desktop file (#616340) +- bundled libjpeg configure requires nasm; is executed even if system-wide + libjpeg is used + +* Fri Jul 02 2010 Adam Tkac 1.0.90-0.16.20100420svn4030 +- build against system-wide libjpeg-turbo (#494458) +- build no longer requires nasm + +* Mon Jun 28 2010 Adam Tkac 1.0.90-0.15.20100420svn4030 +- vncserver: accept <+optname> option when specified as the first one + +* Thu Jun 24 2010 Adam Tkac 1.0.90-0.14.20100420svn4030 +- fix memory leak in Xvnc input code (#597172) +- don't crash when receive negative encoding (#600070) +- explicitly disable udev configuration support +- add gettext-autopoint to BR + +* Mon Jun 14 2010 Adam Tkac 1.0.90-0.13.20100420svn4030 +- update URL about SSH tunneling in the sysconfig file (#601996) + +* Fri Jun 11 2010 Adam Tkac 1.0.90-0.12.20100420svn4030 +- use newer gettext +- autopoint now uses git instead of cvs, adjust BuildRequires appropriately + +* Thu May 13 2010 Adam Tkac 1.0.90-0.11.20100420svn4030 +- link libvnc.so "now" to catch "undefined symbol" errors during Xorg startup +- use always XkbConvertCase instead of XConvertCase (#580159, #586406) +- don't link libvnc.so against libXi.la, libdix.la and libxkb.la; use symbols + from Xorg instead + +* Thu May 13 2010 Adam Tkac 1.0.90-0.10.20100420svn4030 +- update to r4030 snapshot +- patches merged to upstream + - tigervnc11-rh522369.patch + - tigervnc11-rh551262.patch + - tigervnc11-r4002.patch + - tigervnc11-r4014.patch + +* Thu Apr 08 2010 Adam Tkac 1.0.90-0.9.20100219svn3993 +- add server-applet subpackage which contains Java vncviewer applet +- fix Java applet; it didn't work when run from web browser +- add xorg-x11-xkb-utils to server Requires + +* Fri Mar 12 2010 Adam Tkac 1.0.90-0.8.20100219svn3993 +- add French translation to vncviewer.desktop (thanks to Alain Portal) + +* Thu Mar 04 2010 Adam Tkac 1.0.90-0.7.20100219svn3993 +- don't crash during pixel format change (#522369, #551262) + +* Mon Mar 01 2010 Adam Tkac 1.0.90-0.6.20100219svn3993 +- add mesa-dri-drivers and xkeyboard-config to -server Requires +- update to r3993 1.0.90 snapshot + - tigervnc11-noexecstack.patch merged + - tigervnc11-xorg18.patch merged + - xserver18.patch is no longer needed + +* Wed Jan 27 2010 Jan Gorig 1.0.90-0.5.20091221svn3929 +- initscript LSB compliance fixes (#523974) + +* Fri Jan 22 2010 Adam Tkac 1.0.90-0.4.20091221svn3929 +- mark stack as non-executable in jpeg ASM code +- add xorg-x11-xauth to Requires +- add support for X.Org 1.8 +- drop shave sources, they are no longer needed + +* Thu Jan 21 2010 Adam Tkac 1.0.90-0.3.20091221svn3929 +- drop tigervnc-xorg25909.patch, it has been merged to X.Org upstream + +* Thu Jan 07 2010 Adam Tkac 1.0.90-0.2.20091221svn3929 +- add patch for upstream X.Org issue #25909 +- add libXdmcp-devel to build requires to build Xvnc with XDMCP support (#552322) + +* Mon Dec 21 2009 Adam Tkac 1.0.90-0.1.20091221svn3929 +- update to 1.0.90 snapshot +- patches merged + - tigervnc10-compat.patch + - tigervnc10-rh510185.patch + - tigervnc10-rh524340.patch + - tigervnc10-rh516274.patch + +* Mon Oct 26 2009 Adam Tkac 1.0.0-3 +- create Xvnc keyboard mapping before first keypress (#516274) + +* Thu Oct 08 2009 Adam Tkac 1.0.0-2 +- update underlying X source to 1.6.4-0.3.fc11 +- remove bogus '-nohttpd' parameter from /etc/sysconfig/vncservers (#525629) +- initscript LSB compliance fixes (#523974) +- improve -LowColorSwitch documentation and handling (#510185) +- honor dotWhenNoCursor option (and it's changes) every time (#524340) + +* Fri Aug 28 2009 Adam Tkac 1.0.0-1 +- update to 1.0.0 +- tigervnc10-rh495457.patch merged to upstream + +* Mon Aug 24 2009 Karsten Hopp 0.0.91-0.17 +- fix ifnarch s390x for server-module + +* Fri Aug 21 2009 Tomas Mraz - 0.0.91-0.16 +- rebuilt with new openssl + +* Tue Aug 04 2009 Adam Tkac 0.0.91-0.15 +- make Xvnc compilable + +* Sun Jul 26 2009 Fedora Release Engineering - 0.0.91-0.14.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 13 2009 Adam Tkac 0.0.91-0.13.1 +- don't write warning when initscript is called with condrestart param (#508367) + +* Tue Jun 23 2009 Adam Tkac 0.0.91-0.13 +- temporary use F11 Xserver base to make Xvnc compilable +- BuildRequires: libXi-devel +- don't ship tigervnc-server-module on s390/s390x + +* Mon Jun 22 2009 Adam Tkac 0.0.91-0.12 +- fix local rendering of cursor (#495457) + +* Thu Jun 18 2009 Adam Tkac 0.0.91-0.11 +- update to 0.0.91 (1.0.0 RC1) +- patches merged + - tigervnc10-rh499401.patch + - tigervnc10-rh497592.patch + - tigervnc10-rh501832.patch +- after discusion in upstream drop tigervnc-bounds.patch +- configure flags cleanup + +* Thu May 21 2009 Adam Tkac 0.0.90-0.10 +- rebuild against 1.6.1.901 X server (#497835) +- disable i18n, vncviewer is not UTF-8 compatible (#501832) + +* Mon May 18 2009 Adam Tkac 0.0.90-0.9 +- fix vncpasswd crash on long passwords (#499401) +- start session dbus daemon correctly (#497592) + +* Mon May 11 2009 Adam Tkac 0.0.90-0.8.1 +- remove merged tigervnc-manminor.patch + +* Tue May 05 2009 Adam Tkac 0.0.90-0.8 +- update to 0.0.90 + +* Thu Apr 30 2009 Adam Tkac 0.0.90-0.7.20090427svn3789 +- server package now requires xorg-x11-fonts-misc (#498184) + +* Mon Apr 27 2009 Adam Tkac 0.0.90-0.6.20090427svn3789 +- update to r3789 + - tigervnc-rh494801.patch merged +- tigervnc-newfbsize.patch is no longer needed +- fix problems when vncviewer and Xvnc run on different endianess (#496653) +- UltraVNC and TightVNC clients work fine again (#496786) + +* Wed Apr 08 2009 Adam Tkac 0.0.90-0.5.20090403svn3751 +- workaround broken fontpath handling in vncserver script (#494801) + +* Fri Apr 03 2009 Adam Tkac 0.0.90-0.4.20090403svn3751 +- update to r3751 +- patches merged + - tigervnc-xclients.patch + - tigervnc-clipboard.patch + - tigervnc-rh212985.patch +- basic RandR support in Xvnc (resize of the desktop) +- use built-in libjpeg (SSE2/MMX accelerated encoding on x86 platform) +- use Tight encoding by default +- use TigerVNC icons + +* Tue Mar 03 2009 Adam Tkac 0.0.90-0.3.20090303svn3631 +- update to r3631 + +* Tue Mar 03 2009 Adam Tkac 0.0.90-0.2.20090302svn3621 +- package review related fixes + +* Mon Mar 02 2009 Adam Tkac 0.0.90-0.1.20090302svn3621 +- initial package, r3621 diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch new file mode 100644 index 00000000..3f12bc53 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-clipboard.patch @@ -0,0 +1,106 @@ +diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H +--- fltk-1.3.x-r8659/FL/Fl.H.orig 2011-05-17 16:25:56.671744548 +0200 ++++ fltk-1.3.x-r8659/FL/Fl.H 2011-05-17 16:26:05.709101536 +0200 +@@ -108,6 +108,9 @@ typedef int (*Fl_Args_Handler)(int argc, + \see Fl::event_dispatch(Fl_Event_Dispatch) */ + typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w); + ++/** Signature of add_clipboard_notify functions passed as parameters */ ++typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data); ++ + /** @} */ /* group callback_functions */ + + +@@ -744,6 +747,19 @@ public: + */ + static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent + /** ++ FLTK will call the registered callback whenever there is a change to the ++ selection buffer or the clipboard. The source argument indicates which ++ of the two has changed. Only changes by other applications are reported. ++ \note Some systems require polling to monitor the clipboard and may ++ therefore have some delay in detecting changes. ++ */ ++ static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data); ++ /** ++ Stop calling the specified callback when there are changes to the selection ++ buffer or the clipboard. ++ */ ++ static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h); ++ /** + Initiate a Drag And Drop operation. The selection buffer should be + filled with relevant data before calling this method. FLTK will + then initiate the system wide drag and drop handling. Dropped data +diff -up fltk-1.3.x-r8659/src/Fl.cxx.orig fltk-1.3.x-r8659/src/Fl.cxx +--- fltk-1.3.x-r8659/src/Fl.cxx.orig 2011-05-18 15:20:26.667291459 +0200 ++++ fltk-1.3.x-r8659/src/Fl.cxx 2011-05-18 16:31:15.522026086 +0200 +@@ -430,6 +430,69 @@ static char in_idle; + #endif + + //////////////////////////////////////////////////////////////// ++// Clipboard notifications ++ ++struct Clipboard_Notify { ++ Fl_Clipboard_Notify_Handler handler; ++ void *data; ++ struct Clipboard_Notify *next; ++}; ++ ++static struct Clipboard_Notify *clip_notify_list = NULL; ++ ++extern void fl_clipboard_notify_change(); // in Fl_.cxx ++ ++void Fl::add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data) { ++ struct Clipboard_Notify *node; ++ ++ remove_clipboard_notify(h); ++ ++ node = new Clipboard_Notify; ++ ++ node->handler = h; ++ node->data = data; ++ node->next = clip_notify_list; ++ ++ clip_notify_list = node; ++ ++ fl_clipboard_notify_change(); ++} ++ ++void Fl::remove_clipboard_notify(Fl_Clipboard_Notify_Handler h) { ++ struct Clipboard_Notify *node, **prev; ++ ++ node = clip_notify_list; ++ prev = &clip_notify_list; ++ while (node != NULL) { ++ if (node->handler == h) { ++ *prev = node->next; ++ delete node; ++ ++ fl_clipboard_notify_change(); ++ ++ return; ++ } ++ ++ prev = &node->next; ++ node = node->next; ++ } ++} ++ ++bool fl_clipboard_notify_empty(void) { ++ return clip_notify_list == NULL; ++} ++ ++void fl_trigger_clipboard_notify(int source) { ++ struct Clipboard_Notify *node; ++ ++ node = clip_notify_list; ++ while (node != NULL) { ++ node->handler(source, node->data); ++ node = node->next; ++ } ++} ++ ++//////////////////////////////////////////////////////////////// + // wait/run/check/ready: + + void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch new file mode 100644 index 00000000..c157af61 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1.3.x-screen_num.patch @@ -0,0 +1,131 @@ +diff -up fltk-1.3.0r9619/FL/Fl.H.screen_num fltk-1.3.0r9619/FL/Fl.H +--- fltk-1.3.0r9619/FL/Fl.H.screen_num 2012-07-03 13:49:28.663085580 +0200 ++++ fltk-1.3.0r9619/FL/Fl.H 2012-07-03 13:49:28.731084402 +0200 +@@ -806,6 +806,8 @@ public: + static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my); + static void screen_xywh(int &X, int &Y, int &W, int &H, int n); + static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh); ++ static int screen_num(int x, int y); ++ static int screen_num(int x, int y, int w, int h); + static void screen_dpi(float &h, float &v, int n=0); + static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my); + static void screen_work_area(int &X, int &Y, int &W, int &H, int n); +diff -up fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num fltk-1.3.0r9619/src/screen_xywh.cxx +--- fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.0r9619/src/screen_xywh.cxx 2012-07-03 13:58:01.947195396 +0200 +@@ -215,21 +215,6 @@ int Fl::screen_count() { + return num_screens ? num_screens : 1; + } + +-static int find_screen_with_point(int mx, int my) { +- int screen = 0; +- if (num_screens < 0) screen_init(); +- +- for (int i = 0; i < num_screens; i ++) { +- int sx, sy, sw, sh; +- Fl::screen_xywh(sx, sy, sw, sh, i); +- if ((mx >= sx) && (mx < (sx+sw)) && (my >= sy) && (my < (sy+sh))) { +- screen = i; +- break; +- } +- } +- return screen; +-} +- + /** + Gets the bounding box of a screen + that contains the specified screen position \p mx, \p my +@@ -237,7 +222,7 @@ static int find_screen_with_point(int mx + \param[in] mx, my the absolute screen position + */ + void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) { +- screen_xywh(X, Y, W, H, find_screen_with_point(mx, my)); ++ screen_xywh(X, Y, W, H, screen_num(mx, my)); + } + + +@@ -248,7 +233,7 @@ void Fl::screen_xywh(int &X, int &Y, int + \param[in] mx, my the absolute screen position + */ + void Fl::screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my) { +- screen_work_area(X, Y, W, H, find_screen_with_point(mx, my)); ++ screen_work_area(X, Y, W, H, screen_num(mx, my)); + } + + /** +@@ -321,6 +306,38 @@ void Fl::screen_xywh(int &X, int &Y, int + #endif // WIN32 + } + ++/** ++ Gets the screen bounding rect for the screen ++ which intersects the most with the rectangle ++ defined by \p mx, \p my, \p mw, \p mh. ++ \param[out] X,Y,W,H the corresponding screen bounding box ++ \param[in] mx, my, mw, mh the rectangle to search for intersection with ++ \see void screen_xywh(int &X, int &Y, int &W, int &H, int n) ++ */ ++void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) { ++ screen_xywh(X, Y, W, H, screen_num(mx, my, mw, mh)); ++} ++ ++/** ++ Gets the screen number of a screen ++ that contains the specified screen position \p x, \p y ++ \param[in] x, y the absolute screen position ++*/ ++int Fl::screen_num(int x, int y) { ++ int screen = 0; ++ if (num_screens < 0) screen_init(); ++ ++ for (int i = 0; i < num_screens; i ++) { ++ int sx, sy, sw, sh; ++ Fl::screen_xywh(sx, sy, sw, sh, i); ++ if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) { ++ screen = i; ++ break; ++ } ++ } ++ return screen; ++} ++ + static inline float fl_intersection(int x1, int y1, int w1, int h1, + int x2, int y2, int w2, int h2) { + if(x1+w1 < x2 || x2+w2 < x1 || y1+h1 < y2 || y2+h2 < y1) +@@ -333,30 +350,27 @@ static inline float fl_intersection(int + } + + /** +- Gets the screen bounding rect for the screen ++ Gets the screen number for the screen + which intersects the most with the rectangle +- defined by \p mx, \p my, \p mw, \p mh. +- \param[out] X,Y,W,H the corresponding screen bounding box +- \param[in] mx, my, mw, mh the rectangle to search for intersection with +- \see void screen_xywh(int &X, int &Y, int &W, int &H, int n) ++ defined by \p x, \p y, \p w, \p h. ++ \param[in] x, y, w, h the rectangle to search for intersection with + */ +-void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) { ++int Fl::screen_num(int x, int y, int w, int h) { + int best_screen = 0; + float best_intersection = 0.; + for(int i = 0; i < Fl::screen_count(); i++) { + int sx, sy, sw, sh; + Fl::screen_xywh(sx, sy, sw, sh, i); +- float sintersection = fl_intersection(mx, my, mw, mh, sx, sy, sw, sh); ++ float sintersection = fl_intersection(x, y, w, h, sx, sy, sw, sh); + if(sintersection > best_intersection) { + best_screen = i; + best_intersection = sintersection; + } + } +- screen_xywh(X, Y, W, H, best_screen); ++ return best_screen; + } + + +- + /** + Gets the screen resolution in dots-per-inch for the given screen. + \param[out] h, v horizontal and vertical resolution diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch new file mode 100644 index 00000000..7b1b7913 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.0-modal.patch @@ -0,0 +1,75 @@ +diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm +--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-19 12:54:43.694231638 +0200 ++++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-19 12:57:05.899048602 +0200 +@@ -697,12 +697,9 @@ + return NO; // prevent the caption to be redrawn as active on click + // when another modal window is currently the key win + +- return !(w->tooltip_window() || w->menu_window()); ++ return !w->tooltip_window(); + } + +-// TODO see if we really need a canBecomeMainWindow ... +-#if 0 +- + - (BOOL)canBecomeMainWindow + { + if (Fl::modal_ && (Fl::modal_ != w)) +@@ -711,7 +708,6 @@ + + return !(w->tooltip_window() || w->menu_window()); + } +-#endif + + @end + +diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx +--- fltk-1.3.0r9619.org/src/Fl_win32.cxx 2012-06-19 12:54:43.696231735 +0200 ++++ fltk-1.3.0r9619/src/Fl_win32.cxx 2012-06-19 12:54:43.803236862 +0200 +@@ -1065,6 +1065,10 @@ + break; + + case WM_SETFOCUS: ++ if ((Fl::modal_) && (Fl::modal_ != window)) { ++ SetFocus(fl_xid(Fl::modal_)); ++ return 0; ++ } + Fl::handle(FL_FOCUS, window); + break; + +@@ -1826,6 +1830,11 @@ + Fl::e_number = old_event; + w->redraw(); // force draw to happen + } ++ ++ // Needs to be done before ShowWindow() to get the correct behaviour ++ // when we get WM_SETFOCUS. ++ if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} ++ + // If we've captured the mouse, we dont want to activate any + // other windows from the code, or we lose the capture. + ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE : +@@ -1843,7 +1852,6 @@ + } + } + +- if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} + return x; + } + +diff -bur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx +--- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-19 12:54:43.697231783 +0200 ++++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-19 12:54:43.804236911 +0200 +@@ -2101,6 +2101,12 @@ + while (wp->parent()) wp = wp->window(); + XSetTransientForHint(fl_display, xp->xid, fl_xid(wp)); + if (!wp->visible()) showit = 0; // guess that wm will not show it ++ if (win->modal()) { ++ Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0); ++ Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_MODAL", 0); ++ XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32, ++ PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1); ++ } + } + + // Make sure that borderless windows do not show in the task bar diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch new file mode 100644 index 00000000..22e69396 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-osx.patch @@ -0,0 +1,44 @@ +diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm +--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-18 19:24:30.971688769 +0200 ++++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-18 19:25:25.700310375 +0200 +@@ -1319,9 +1319,13 @@ + } + @end + ++static void clipboard_check(void); ++ + @implementation FLApplication + + (void)sendEvent:(NSEvent *)theEvent + { ++ // update clipboard status ++ clipboard_check(); + NSEventType type = [theEvent type]; + if (type == NSLeftMouseDown) { + fl_lock_function(); +@@ -2790,6 +2794,26 @@ + PasteboardCreate(kPasteboardClipboard, &myPasteboard); + } + ++extern void fl_trigger_clipboard_notify(int source); ++ ++void fl_clipboard_notify_change() { ++ // No need to do anything here... ++} ++ ++static void clipboard_check(void) ++{ ++ PasteboardSyncFlags flags; ++ ++ allocatePasteboard(); ++ flags = PasteboardSynchronize(myPasteboard); ++ ++ if (!(flags & kPasteboardModified)) ++ return; ++ if (flags & kPasteboardClientIsOwner) ++ return; ++ ++ fl_trigger_clipboard_notify(1); ++} + + /* + * create a selection diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch new file mode 100644 index 00000000..ac94779c --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v2.3.x-clipboard-win32.patch @@ -0,0 +1,99 @@ +diff -ur fltk-1.3.0r9110.org/src/Fl.cxx fltk-1.3.0r9110/src/Fl.cxx +--- fltk-1.3.0r9110.org/src/Fl.cxx 2012-06-17 19:47:09.988183253 +0200 ++++ fltk-1.3.0r9110/src/Fl.cxx 2012-06-17 19:47:10.127189919 +0200 +@@ -1421,6 +1421,7 @@ + // hide() destroys the X window, it does not do unmap! + + #if defined(WIN32) ++extern void fl_clipboard_notify_untarget(HWND wnd); + extern void fl_update_clipboard(void); + #elif USE_XFT + extern void fl_destroy_xft_draw(Window); +@@ -1471,6 +1472,8 @@ + // to destroy the window that owns the selection. + if (GetClipboardOwner()==ip->xid) + fl_update_clipboard(); ++ // Make sure we unlink this window from the clipboard chain ++ fl_clipboard_notify_untarget(ip->xid); + // Send a message to myself so that I'll get out of the event loop... + PostMessage(ip->xid, WM_APP, 0, 0); + if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc); +diff -ur fltk-1.3.0r9110.org/src/Fl_win32.cxx fltk-1.3.0r9110/src/Fl_win32.cxx +--- fltk-1.3.0r9110.org/src/Fl_win32.cxx 2012-06-17 19:47:09.987183205 +0200 ++++ fltk-1.3.0r9110/src/Fl_win32.cxx 2012-06-17 19:47:19.069618739 +0200 +@@ -646,6 +646,38 @@ + } + } + ++static HWND clipboard_wnd = 0; ++static HWND next_clipboard_wnd = 0; ++ ++static bool initial_clipboard = true; ++ ++void fl_clipboard_notify_change() { ++ // No need to do anything here... ++} ++ ++void fl_clipboard_notify_target(HWND wnd) { ++ if (clipboard_wnd) ++ return; ++ ++ // We get one fake WM_DRAWCLIPBOARD immediately, which we therefore ++ // need to ignore. ++ initial_clipboard = true; ++ ++ clipboard_wnd = wnd; ++ next_clipboard_wnd = SetClipboardViewer(wnd); ++} ++ ++void fl_clipboard_notify_untarget(HWND wnd) { ++ if (wnd != clipboard_wnd) ++ return; ++ ++ ChangeClipboardChain(wnd, next_clipboard_wnd); ++ clipboard_wnd = next_clipboard_wnd = 0; ++ ++ if (Fl::first_window()) ++ fl_clipboard_notify_target(fl_xid(Fl::first_window())); ++} ++ + //////////////////////////////////////////////////////////////// + char fl_is_ime = 0; + void fl_get_codepage() +@@ -1327,6 +1359,27 @@ + Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); + return 0; + ++ case WM_CHANGECBCHAIN: ++ if ((hWnd == clipboard_wnd) && ++ (next_clipboard_wnd == (HWND)wParam)) { ++ next_clipboard_wnd = (HWND)lParam; ++ return 0; ++ } ++ break; ++ ++ case WM_DRAWCLIPBOARD: ++ // When the clipboard moves between two FLTK windows, ++ // fl_i_own_selection will temporarily be false as we are ++ // processing this message. Hence the need to use fl_find(). ++ if (!initial_clipboard && !fl_find(GetClipboardOwner())) ++ fl_trigger_clipboard_notify(1); ++ initial_clipboard = false; ++ ++ if (next_clipboard_wnd) ++ SendMessage(next_clipboard_wnd, WM_DRAWCLIPBOARD, wParam, lParam); ++ ++ return 0; ++ + default: + if (Fl::handle(0,0)) return 0; + break; +@@ -1685,6 +1738,8 @@ + x->next = Fl_X::first; + Fl_X::first = x; + ++ fl_clipboard_notify_target(x->xid); ++ + x->wait_for_expose = 1; + if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;} + if (showit) { diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch new file mode 100644 index 00000000..20b30b8b --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.0-icons.patch @@ -0,0 +1,645 @@ +diff -ur fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H +--- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:49:55.554353925 +0100 +@@ -22,6 +22,10 @@ + #ifndef Fl_Window_H + #define Fl_Window_H + ++#ifdef WIN32 ++#include ++#endif ++ + #include "Fl_Group.H" + + #define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this +@@ -73,9 +77,19 @@ + friend class Fl_X; + Fl_X *i; // points at the system-specific stuff + ++ struct icon_data { ++ const void *legacy_icon; ++ Fl_RGB_Image **icons; ++ int count; ++#ifdef WIN32 ++ HICON big_icon; ++ HICON small_icon; ++#endif ++ }; ++ + const char* iconlabel_; + char* xclass_; +- const void* icon_; ++ struct icon_data *icon_; + // size_range stuff: + int minw, minh, maxw, maxh; + int dw, dh, aspect; +@@ -121,6 +135,8 @@ + */ + int force_position() const { return ((flags() & FORCE_POSITION)?1:0); } + ++ void free_icons(); ++ + public: + + /** +@@ -350,6 +366,18 @@ + static const char *default_xclass(); + const char* xclass() const; + void xclass(const char* c); ++ ++ static void default_icon(const Fl_RGB_Image*); ++ static void default_icons(const Fl_RGB_Image*[], int); ++ void icon(const Fl_RGB_Image*); ++ void icons(const Fl_RGB_Image*[], int); ++ ++#ifdef WIN32 ++ static void default_icons(HICON big_icon, HICON small_icon); ++ void icons(HICON big_icon, HICON small_icon); ++#endif ++ ++ /* for legacy compatibility */ + const void* icon() const; + void icon(const void * ic); + +diff -ur fltk-1.3.2.org/FL/mac.H fltk-1.3.2/FL/mac.H +--- fltk-1.3.2.org/FL/mac.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/mac.H 2013-01-16 10:49:55.554353925 +0100 +@@ -120,6 +120,9 @@ + void collapse(void); + WindowRef window_ref(void); + void set_key_window(void); ++ // OS X doesn't have per window icons ++ static void set_default_icons(const Fl_RGB_Image*[], int) {}; ++ void set_icons() {}; + int set_cursor(Fl_Cursor); + int set_cursor(const Fl_RGB_Image*, int, int); + static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); +diff -ur fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H +--- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/win32.H 2013-01-16 10:49:55.555355617 +0100 +@@ -84,6 +84,9 @@ + void flush() {w->flush();} + void set_minmax(LPMINMAXINFO minmax); + void mapraise(); ++ static void set_default_icons(const Fl_RGB_Image*[], int); ++ static void set_default_icons(HICON, HICON); ++ void set_icons(); + int set_cursor(Fl_Cursor); + int set_cursor(const Fl_RGB_Image*, int, int); + static Fl_X* make(Fl_Window*); +diff -ur fltk-1.3.2.org/FL/x.H fltk-1.3.2/FL/x.H +--- fltk-1.3.2.org/FL/x.H 2013-01-16 10:49:40.904228200 +0100 ++++ fltk-1.3.2/FL/x.H 2013-01-16 10:49:55.555355617 +0100 +@@ -154,6 +154,8 @@ + static Fl_X* i(const Fl_Window* wi) {return wi->i;} + void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} + void sendxjunk(); ++ static void set_default_icons(const Fl_RGB_Image*[], int); ++ void set_icons(); + int set_cursor(Fl_Cursor); + int set_cursor(const Fl_RGB_Image*, int, int); + static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); +diff -ur fltk-1.3.2.org/src/Fl.cxx fltk-1.3.2/src/Fl.cxx +--- fltk-1.3.2.org/src/Fl.cxx 2013-01-16 10:49:40.895228113 +0100 ++++ fltk-1.3.2/src/Fl.cxx 2013-01-16 10:49:55.556137979 +0100 +@@ -1530,6 +1530,8 @@ + if (xclass_) { + free(xclass_); + } ++ free_icons(); ++ delete icon_; + } + + // FL_SHOW and FL_HIDE are called whenever the visibility of this widget +diff -ur fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx +--- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:49:40.911227539 +0100 ++++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:49:55.556137979 +0100 +@@ -1804,6 +1804,8 @@ + ); + if (lab) free(lab); + ++ x->set_icons(); ++ + if (w->fullscreen_active()) { + /* We need to make sure that the fullscreen is created on the + default monitor, ie the desktop where the shortcut is located +@@ -2034,71 +2036,19 @@ + + //////////////////////////////////////////////////////////////// + +-#ifndef IDC_HAND +-# define IDC_HAND MAKEINTRESOURCE(32649) +-#endif // !IDC_HAND +- +-int Fl_X::set_cursor(Fl_Cursor c) { +- LPSTR n; +- HCURSOR new_cursor; +- +- if (c == FL_CURSOR_NONE) +- new_cursor = NULL; +- else { +- switch (c) { +- case FL_CURSOR_ARROW: n = IDC_ARROW; break; +- case FL_CURSOR_CROSS: n = IDC_CROSS; break; +- case FL_CURSOR_WAIT: n = IDC_WAIT; break; +- case FL_CURSOR_INSERT: n = IDC_IBEAM; break; +- case FL_CURSOR_HAND: n = IDC_HAND; break; +- case FL_CURSOR_HELP: n = IDC_HELP; break; +- case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; +- case FL_CURSOR_N: +- case FL_CURSOR_S: +- // FIXME: Should probably have fallbacks for these instead +- case FL_CURSOR_NS: n = IDC_SIZENS; break; +- case FL_CURSOR_NE: +- case FL_CURSOR_SW: +- // FIXME: Dito. +- case FL_CURSOR_NESW: n = IDC_SIZENESW; break; +- case FL_CURSOR_E: +- case FL_CURSOR_W: +- // FIXME: Dito. +- case FL_CURSOR_WE: n = IDC_SIZEWE; break; +- case FL_CURSOR_SE: +- case FL_CURSOR_NW: +- // FIXME: Dito. +- case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; +- default: +- return 0; +- } +- +- new_cursor = LoadCursor(NULL, n); +- if (new_cursor == NULL) +- return 0; +- } +- +- if ((cursor != NULL) && custom_cursor) +- DestroyIcon(cursor); +- +- cursor = new_cursor; +- custom_cursor = 0; +- +- SetCursor(cursor); +- +- return 1; +-} +- +-int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon=true, ++ int hotx = 0, int hoty = 0) { + BITMAPV5HEADER bi; + HBITMAP bitmap, mask; + DWORD *bits; +- HCURSOR new_cursor; ++ HICON icon; + ++ if (!is_icon) { + if ((hotx < 0) || (hotx >= image->w())) +- return 0; ++ return NULL; + if ((hoty < 0) || (hoty >= image->h())) +- return 0; ++ return NULL; ++ } + + memset(&bi, 0, sizeof(BITMAPV5HEADER)); + +@@ -2120,7 +2070,7 @@ + ReleaseDC(NULL, hdc); + + if (bits == NULL) +- return 0; ++ return NULL; + + const uchar *i = (const uchar*)*image->data(); + for (int y = 0;y < image->h();y++) { +@@ -2149,22 +2099,206 @@ + mask = CreateBitmap(image->w(),image->h(),1,1,NULL); + if (mask == NULL) { + DeleteObject(bitmap); +- return 0; ++ return NULL; + } + + ICONINFO ii; + +- ii.fIcon = FALSE; ++ ii.fIcon = is_icon; + ii.xHotspot = hotx; + ii.yHotspot = hoty; + ii.hbmMask = mask; + ii.hbmColor = bitmap; + +- new_cursor = CreateIconIndirect(&ii); ++ icon = CreateIconIndirect(&ii); + + DeleteObject(bitmap); + DeleteObject(mask); + ++ if (icon == NULL) ++ return NULL; ++ ++ return icon; ++} ++ ++//////////////////////////////////////////////////////////////// ++ ++static HICON default_big_icon = NULL; ++static HICON default_small_icon = NULL; ++ ++const Fl_RGB_Image *find_best_icon(int ideal_width, ++ const Fl_RGB_Image *icons[], int count) { ++ const Fl_RGB_Image *best; ++ ++ best = NULL; ++ ++ for (int i = 0;i < count;i++) { ++ if (best == NULL) ++ best = icons[i]; ++ else { ++ if (best->w() < ideal_width) { ++ if (icons[i]->w() > best->w()) ++ best = icons[i]; ++ } else { ++ if ((icons[i]->w() >= ideal_width) && ++ (icons[i]->w() < best->w())) ++ best = icons[i]; ++ } ++ } ++ } ++ ++ return best; ++} ++ ++void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) { ++ const Fl_RGB_Image *best_big, *best_small; ++ ++ if (default_big_icon != NULL) ++ DestroyIcon(default_big_icon); ++ if (default_small_icon != NULL) ++ DestroyIcon(default_small_icon); ++ ++ best_big = find_best_icon(GetSystemMetrics(SM_CXICON), icons, count); ++ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), icons, count); ++ ++ if (best_big != NULL) ++ default_big_icon = image_to_icon(best_big); ++ else ++ default_big_icon = NULL; ++ ++ if (best_small != NULL) ++ default_small_icon = image_to_icon(best_small); ++ else ++ default_small_icon = NULL; ++} ++ ++void Fl_X::set_default_icons(HICON big_icon, HICON small_icon) { ++ if (default_big_icon != NULL) ++ DestroyIcon(default_big_icon); ++ if (default_small_icon != NULL) ++ DestroyIcon(default_small_icon); ++ ++ if (big_icon != NULL) ++ default_big_icon = CopyIcon(big_icon); ++ if (small_icon != NULL) ++ default_small_icon = CopyIcon(small_icon); ++} ++ ++void Fl_X::set_icons() { ++ HICON big_icon, small_icon; ++ ++ big_icon = NULL; ++ small_icon = NULL; ++ ++ if (w->icon_->count) { ++ const Fl_RGB_Image *best_big, *best_small; ++ ++ best_big = find_best_icon(GetSystemMetrics(SM_CXICON), ++ (const Fl_RGB_Image **)w->icon_->icons, ++ w->icon_->count); ++ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), ++ (const Fl_RGB_Image **)w->icon_->icons, ++ w->icon_->count); ++ ++ if (best_big != NULL) ++ big_icon = image_to_icon(best_big); ++ if (best_small != NULL) ++ small_icon = image_to_icon(best_small); ++ } else { ++ big_icon = default_big_icon; ++ small_icon = default_small_icon; ++ } ++ ++ if (big_icon != NULL) ++ SendMessage(xid, WM_SETICON, ICON_BIG, (LPARAM)big_icon); ++ if (small_icon != NULL) ++ SendMessage(xid, WM_SETICON, ICON_SMALL, (LPARAM)small_icon); ++ ++ if (w->icon_->count) { ++ if (big_icon != NULL) ++ DestroyIcon(big_icon); ++ if (small_icon != NULL) ++ DestroyIcon(small_icon); ++ } ++} ++ ++void Fl_Window::default_icons(HICON big_icon, HICON small_icon) { ++ Fl_X::set_default_icons(big_icon, small_icon); ++} ++ ++void Fl_Window::icons(HICON big_icon, HICON small_icon) { ++ free_icons(); ++ ++ if (big_icon != NULL) ++ icon_->big_icon = CopyIcon(big_icon); ++ if (small_icon != NULL) ++ icon_->small_icon = CopyIcon(small_icon); ++ ++ if (i) ++ i->set_icons(); ++} ++ ++//////////////////////////////////////////////////////////////// ++ ++#ifndef IDC_HAND ++# define IDC_HAND MAKEINTRESOURCE(32649) ++#endif // !IDC_HAND ++ ++int Fl_X::set_cursor(Fl_Cursor c) { ++ LPSTR n; ++ HCURSOR new_cursor; ++ ++ if (c == FL_CURSOR_NONE) ++ new_cursor = NULL; ++ else { ++ switch (c) { ++ case FL_CURSOR_ARROW: n = IDC_ARROW; break; ++ case FL_CURSOR_CROSS: n = IDC_CROSS; break; ++ case FL_CURSOR_WAIT: n = IDC_WAIT; break; ++ case FL_CURSOR_INSERT: n = IDC_IBEAM; break; ++ case FL_CURSOR_HAND: n = IDC_HAND; break; ++ case FL_CURSOR_HELP: n = IDC_HELP; break; ++ case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; ++ case FL_CURSOR_N: ++ case FL_CURSOR_S: ++ // FIXME: Should probably have fallbacks for these instead ++ case FL_CURSOR_NS: n = IDC_SIZENS; break; ++ case FL_CURSOR_NE: ++ case FL_CURSOR_SW: ++ // FIXME: Dito. ++ case FL_CURSOR_NESW: n = IDC_SIZENESW; break; ++ case FL_CURSOR_E: ++ case FL_CURSOR_W: ++ // FIXME: Dito. ++ case FL_CURSOR_WE: n = IDC_SIZEWE; break; ++ case FL_CURSOR_SE: ++ case FL_CURSOR_NW: ++ // FIXME: Dito. ++ case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; ++ default: ++ return 0; ++ } ++ ++ new_cursor = LoadCursor(NULL, n); ++ if (new_cursor == NULL) ++ return 0; ++ } ++ ++ if ((cursor != NULL) && custom_cursor) ++ DestroyIcon(cursor); ++ ++ cursor = new_cursor; ++ custom_cursor = 0; ++ ++ SetCursor(cursor); ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ HCURSOR new_cursor; ++ ++ new_cursor = image_to_icon(image, false, hotx, hoty); + if (new_cursor == NULL) + return 0; + +diff -ur fltk-1.3.2.org/src/Fl_Window.cxx fltk-1.3.2/src/Fl_Window.cxx +--- fltk-1.3.2.org/src/Fl_Window.cxx 2013-01-16 10:49:40.908130903 +0100 ++++ fltk-1.3.2/src/Fl_Window.cxx 2013-01-16 10:49:55.557353865 +0100 +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include "flstring.h" +@@ -45,7 +46,8 @@ + } + i = 0; + xclass_ = 0; +- icon_ = 0; ++ icon_ = new icon_data; ++ memset(icon_, 0, sizeof(*icon_)); + iconlabel_ = 0; + resizable(0); + size_range_set = 0; +@@ -264,16 +266,68 @@ + } + } + ++void Fl_Window::default_icon(const Fl_RGB_Image *icon) { ++ default_icons(&icon, 1); ++} ++ ++void Fl_Window::default_icons(const Fl_RGB_Image **icons, int count) { ++ Fl_X::set_default_icons(icons, count); ++} ++ ++void Fl_Window::icon(const Fl_RGB_Image *icon) { ++ icons(&icon, 1); ++} ++ ++void Fl_Window::icons(const Fl_RGB_Image **icons, int count) { ++ free_icons(); ++ ++ if (count > 0) { ++ icon_->icons = new Fl_RGB_Image*[count]; ++ icon_->count = count; ++ // FIXME: Fl_RGB_Image lacks const modifiers on methods ++ for (int i = 0;i < count;i++) ++ icon_->icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])->copy(); ++ } ++ ++ if (i) ++ i->set_icons(); ++} ++ + /** Gets the current icon window target dependent data. */ + const void *Fl_Window::icon() const { +- return icon_; ++ return icon_->legacy_icon; + } + + /** Sets the current icon window target dependent data. */ + void Fl_Window::icon(const void * ic) { +- icon_ = ic; ++ free_icons(); ++ icon_->legacy_icon = ic; + } + ++void Fl_Window::free_icons() { ++ int i; ++ ++ icon_->legacy_icon = 0L; ++ ++ if (icon_->icons) { ++ for (i = 0;i < icon_->count;i++) ++ delete icon_->icons[i]; ++ delete [] icon_->icons; ++ icon_->icons = 0L; ++ } ++ ++ icon_->count = 0; ++ ++#ifdef WIN32 ++ if (icon_->big_icon) ++ DestroyIcon(icon_->big_icon); ++ if (icon_->small_icon) ++ DestroyIcon(icon_->small_icon); ++ ++ icon_->big_icon = NULL; ++ icon_->small_icon = NULL; ++#endif ++} + + // + // End of "$Id: Fl_Window.cxx 9706 2012-11-06 20:46:14Z matt $". +diff -ur fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:49:40.912227213 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:49:55.558137113 +0100 +@@ -345,6 +345,7 @@ + Atom fl_NET_WM_STATE; + Atom fl_NET_WM_STATE_FULLSCREEN; + Atom fl_NET_WORKAREA; ++Atom fl_NET_WM_ICON; + + /* + X defines 32-bit-entities to have a format value of max. 32, +@@ -709,6 +710,7 @@ + fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0); + fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0); + fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0); ++ fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0); + + if (sizeof(Atom) < 4) + atom_bits = sizeof(Atom) * 8; +@@ -2138,12 +2140,14 @@ + fl_show_iconic = 0; + showit = 0; + } +- if (win->icon()) { +- hints->icon_pixmap = (Pixmap)win->icon(); ++ if (win->icon_->legacy_icon) { ++ hints->icon_pixmap = (Pixmap)win->icon_->legacy_icon; + hints->flags |= IconPixmapHint; + } + XSetWMHints(fl_display, xp->xid, hints); + XFree(hints); ++ ++ xp->set_icons(); + } + + // set the window type for menu and tooltip windows to avoid animations (compiz) +@@ -2263,6 +2267,93 @@ + + //////////////////////////////////////////////////////////////// + ++static unsigned long *default_net_wm_icons = 0L; ++static size_t default_net_wm_icons_size = 0; ++ ++void icons_to_property(const Fl_RGB_Image *icons[], int count, ++ unsigned long **property, size_t *len) { ++ size_t sz; ++ unsigned long *data; ++ ++ sz = 0; ++ for (int i = 0;i < count;i++) ++ sz += 2 + icons[i]->w() * icons[i]->h(); ++ ++ // FIXME: Might want to sort the icons ++ ++ *property = data = new unsigned long[sz]; ++ *len = sz; ++ ++ for (int i = 0;i < count;i++) { ++ const Fl_RGB_Image *image; ++ ++ image = icons[i]; ++ ++ data[0] = image->w(); ++ data[1] = image->h(); ++ data += 2; ++ ++ const uchar *in = (const uchar*)*image->data(); ++ for (int y = 0;y < image->h();y++) { ++ for (int x = 0;x < image->w();x++) { ++ switch (image->d()) { ++ case 1: ++ *data = ( 0xff<<24) | (in[0]<<16) | (in[0]<<8) | in[0]; ++ break; ++ case 2: ++ *data = (in[1]<<24) | (in[0]<<16) | (in[0]<<8) | in[0]; ++ break; ++ case 3: ++ *data = ( 0xff<<24) | (in[0]<<16) | (in[1]<<8) | in[2]; ++ break; ++ case 4: ++ *data = (in[3]<<24) | (in[0]<<16) | (in[1]<<8) | in[2]; ++ break; ++ } ++ in += image->d(); ++ data++; ++ } ++ in += image->ld(); ++ } ++ } ++} ++ ++void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) { ++ if (default_net_wm_icons) { ++ delete [] default_net_wm_icons; ++ default_net_wm_icons = 0L; ++ default_net_wm_icons_size = 0; ++ } ++ ++ if (count > 0) ++ icons_to_property(icons, count, ++ &default_net_wm_icons, &default_net_wm_icons_size); ++} ++ ++void Fl_X::set_icons() { ++ unsigned long *net_wm_icons; ++ size_t net_wm_icons_size; ++ ++ if (w->icon_->count) { ++ icons_to_property((const Fl_RGB_Image **)w->icon_->icons, w->icon_->count, ++ &net_wm_icons, &net_wm_icons_size); ++ } else { ++ net_wm_icons = default_net_wm_icons; ++ net_wm_icons_size = default_net_wm_icons_size; ++ } ++ ++ XChangeProperty (fl_display, xid, fl_NET_WM_ICON, XA_CARDINAL, 32, ++ PropModeReplace, (unsigned char*) net_wm_icons, net_wm_icons_size); ++ ++ if (w->icon_->count) { ++ delete [] net_wm_icons; ++ net_wm_icons = 0L; ++ net_wm_icons_size = 0; ++ } ++} ++ ++//////////////////////////////////////////////////////////////// ++ + int Fl_X::set_cursor(Fl_Cursor c) { + unsigned int shape; + Cursor xc; diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch new file mode 100644 index 00000000..b41af794 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-clipboard-win32-fix.patch @@ -0,0 +1,135 @@ +diff -ur fltk-1.3.0r9110.org/src/Fl_win32.cxx fltk-1.3.0r9110/src/Fl_win32.cxx +--- fltk-1.3.0r9110.org/src/Fl_win32.cxx 2012-06-17 19:42:02.169422400 +0200 ++++ fltk-1.3.0r9110/src/Fl_win32.cxx 2012-06-17 19:43:38.286031455 +0200 +@@ -543,6 +543,37 @@ + const char* GetValue() const { return(out); } + }; + ++void fl_update_clipboard(void) { ++ Fl_Window *w1 = Fl::first_window(); ++ if (!w1) ++ return; ++ ++ HWND hwnd = fl_xid(w1); ++ ++ if (!OpenClipboard(hwnd)) ++ return; ++ ++ EmptyClipboard(); ++ ++ int utf16_len = fl_utf8toUtf16(fl_selection_buffer[1], ++ fl_selection_length[1], 0, 0); ++ ++ HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc. ++ LPVOID memLock = GlobalLock(hMem); ++ ++ fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], ++ (unsigned short*) memLock, utf16_len + 1); ++ ++ GlobalUnlock(hMem); ++ SetClipboardData(CF_UNICODETEXT, hMem); ++ ++ CloseClipboard(); ++ ++ // In case Windows managed to lob of a WM_DESTROYCLIPBOARD during ++ // the above. ++ fl_i_own_selection[1] = 1; ++} ++ + // call this when you create a selection: + void Fl::copy(const char *stuff, int len, int clipboard) { + if (!stuff || len<0) return; +@@ -560,25 +591,9 @@ + memcpy(fl_selection_buffer[clipboard], stuff, len); + fl_selection_buffer[clipboard][len] = 0; // needed for direct paste + fl_selection_length[clipboard] = len; +- if (clipboard) { +- // set up for "delayed rendering": +- if (OpenClipboard(NULL)) { +- // if the system clipboard works, use it +- int utf16_len = fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], 0, 0); +- EmptyClipboard(); +- HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc. +- LPVOID memLock = GlobalLock(hMem); +- fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len + 1); +- GlobalUnlock(hMem); +- SetClipboardData(CF_UNICODETEXT, hMem); +- CloseClipboard(); +- GlobalFree(hMem); +- fl_i_own_selection[clipboard] = 0; +- } else { +- // only if it fails, instruct paste() to use the internal buffers +- fl_i_own_selection[clipboard] = 1; +- } +- } ++ fl_i_own_selection[clipboard] = 1; ++ if (clipboard) ++ fl_update_clipboard(); + } + + // Call this when a "paste" operation happens: +@@ -1307,33 +1322,6 @@ + fl_i_own_selection[1] = 0; + return 1; + +- case WM_RENDERALLFORMATS: +- fl_i_own_selection[1] = 0; +- // Windoze seems unhappy unless I do these two steps. Documentation +- // seems to vary on whether opening the clipboard is necessary or +- // is in fact wrong: +- CloseClipboard(); +- OpenClipboard(NULL); +- // fall through... +- case WM_RENDERFORMAT: { +- HANDLE h; +- +-// int l = fl_utf_nb_char((unsigned char*)fl_selection_buffer[1], fl_selection_length[1]); +- int l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], NULL, 0); // Pass NULL buffer to query length required +- h = GlobalAlloc(GHND, (l+1) * sizeof(unsigned short)); +- if (h) { +- unsigned short *g = (unsigned short*) GlobalLock(h); +-// fl_utf2unicode((unsigned char *)fl_selection_buffer[1], fl_selection_length[1], (xchar*)g); +- l = fl_utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], g, (l+1)); +- g[l] = 0; +- GlobalUnlock(h); +- SetClipboardData(CF_UNICODETEXT, h); +- } +- +- // Windoze also seems unhappy if I don't do this. Documentation very +- // unclear on what is correct: +- if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard(); +- return 1;} + case WM_DISPLAYCHANGE: // occurs when screen configuration (number, position) changes + Fl::call_screen_init(); + Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL); +diff -ur fltk-1.3.0r9110.org/src/Fl.cxx fltk-1.3.0r9110/src/Fl.cxx +--- fltk-1.3.0r9110.org/src/Fl.cxx 2012-06-17 19:42:02.173422595 +0200 ++++ fltk-1.3.0r9110/src/Fl.cxx 2012-06-17 19:42:02.317429497 +0200 +@@ -1420,7 +1420,9 @@ + //////////////////////////////////////////////////////////////// + // hide() destroys the X window, it does not do unmap! + +-#if !defined(WIN32) && USE_XFT ++#if defined(WIN32) ++extern void fl_update_clipboard(void); ++#elif USE_XFT + extern void fl_destroy_xft_draw(Window); + #endif + +@@ -1467,14 +1469,8 @@ + #if defined(WIN32) + // this little trick keeps the current clipboard alive, even if we are about + // to destroy the window that owns the selection. +- if (GetClipboardOwner()==ip->xid) { +- Fl_Window *w1 = Fl::first_window(); +- if (w1 && OpenClipboard(fl_xid(w1))) { +- EmptyClipboard(); +- SetClipboardData(CF_TEXT, NULL); +- CloseClipboard(); +- } +- } ++ if (GetClipboardOwner()==ip->xid) ++ fl_update_clipboard(); + // Send a message to myself so that I'll get out of the event loop... + PostMessage(ip->xid, WM_APP, 0, 0); + if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc); diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch new file mode 100644 index 00000000..e4a010aa --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v3.3.x-multihead.patch @@ -0,0 +1,468 @@ +diff -urp fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H +--- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:52:33.017228122 +0100 ++++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:52:47.876478968 +0100 +@@ -54,7 +54,7 @@ class Fl_RGB_Image; + class FL_EXPORT Fl_Window : public Fl_Group { + + static char *default_xclass_; +- // Note: we must use separate statements for each of the following 4 variables, ++ // Note: we must use separate statements for each of the following 8 variables, + // with the static attribute, otherwise MS VC++ 2008/2010 complains :-( + // AlbrechtS 04/2012 + #if FLTK_ABI_VERSION < 10301 +@@ -73,6 +73,22 @@ class FL_EXPORT Fl_Window : public Fl_Gr + static // when these members are static, ABI compatibility with 1.3.0 is respected + #endif + int no_fullscreen_h; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_top; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_bottom; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_left; ++#if FLTK_ABI_VERSION < 10302 ++ static // when these members are static, ABI compatibility with 1.3.0 is respected ++#endif ++ int fullscreen_screen_right; + + friend class Fl_X; + Fl_X *i; // points at the system-specific stuff +@@ -430,13 +446,15 @@ public: + */ + void show(int argc, char **argv); + /** +- Makes the window completely fill the screen, without any window +- manager border visible. You must use fullscreen_off() to undo +- this. ++ Makes the window completely fill one or more screens, without any ++ window manager border visible. You must use fullscreen_off() to ++ undo this. + + \note On some platforms, this can result in the keyboard being + grabbed. The window may also be recreated, meaning hide() and + show() will be called. ++ ++ \see void Fl_Window::fullscreen_screens() + */ + void fullscreen(); + /** +@@ -453,6 +471,17 @@ public: + */ + unsigned int fullscreen_active() const { return flags() & FULLSCREEN; } + /** ++ Sets which screens should be used when this window is in fullscreen ++ mode. The window will be resized to the top of the screen with index ++ \p top, the bottom of the screen with index \p bottom, etc. ++ ++ If this method is never called, or if any argument is < 0, then the ++ window will be resized to fill the screen it is currently on. ++ ++ \see void Fl_Window::fullscreen() ++ */ ++ void fullscreen_screens(int top, int bottom, int left, int right); ++ /** + Iconifies the window. If you call this when shown() is false + it will show() it as an icon. If the window is already + iconified this does nothing. +diff -urp fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H +--- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:52:33.017228122 +0100 ++++ fltk-1.3.2/FL/win32.H 2013-01-16 10:52:47.876478968 +0100 +@@ -80,6 +80,7 @@ public: + static Fl_X* i(const Fl_Window* w) {return w->i;} + static int fake_X_wm(const Fl_Window* w,int &X, int &Y, + int &bt,int &bx,int &by); ++ void make_fullscreen(int X, int Y, int W, int H); + void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} + void flush() {w->flush();} + void set_minmax(LPMINMAXINFO minmax); +diff -urp fltk-1.3.2.org/src/Fl_cocoa.mm fltk-1.3.2/src/Fl_cocoa.mm +--- fltk-1.3.2.org/src/Fl_cocoa.mm 2013-01-16 10:52:33.014229574 +0100 ++++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-16 10:52:47.877480606 +0100 +@@ -2438,9 +2438,32 @@ void Fl_X::make(Fl_Window* w) + + NSRect crect; + if (w->fullscreen_active()) { +- int sx, sy, sw, sh; +- Fl::screen_xywh(sx, sy, sw, sh, w->x(), w->y(), w->w(), w->h()); +- w->resize(sx, sy, sw, sh); ++ int top, bottom, left, right; ++ int sx, sy, sw, sh, X, Y, W, H; ++ ++ top = w->fullscreen_screen_top; ++ bottom = w->fullscreen_screen_bottom; ++ left = w->fullscreen_screen_left; ++ right = w->fullscreen_screen_right; ++ ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ top = Fl::screen_num(w->x(), w->y(), w->w(), w->h()); ++ bottom = top; ++ left = top; ++ right = top; ++ } ++ ++ Fl::screen_xywh(sx, sy, sw, sh, top); ++ Y = sy; ++ Fl::screen_xywh(sx, sy, sw, sh, bottom); ++ H = sy + sh - Y; ++ Fl::screen_xywh(sx, sy, sw, sh, left); ++ X = sx; ++ Fl::screen_xywh(sx, sy, sw, sh, right); ++ W = sx + sw - X; ++ ++ w->resize(X, Y, W, H); ++ + winstyle = NSBorderlessWindowMask; + winlevel = NSStatusWindowLevel; + } +diff -urp fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx +--- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:52:33.019230734 +0100 ++++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:52:47.878480504 +0100 +@@ -1493,7 +1493,6 @@ int Fl_X::fake_X_wm(const Fl_Window* w,i + Y+=yoff; + + if (w->fullscreen_active()) { +- X = Y = 0; + bx = by = bt = 0; + } + +@@ -1547,19 +1546,42 @@ void Fl_Window::resize(int X,int Y,int W + } + } + +-static void make_fullscreen(Fl_Window *w, Window xid, int X, int Y, int W, int H) { ++void Fl_X::make_fullscreen(int X, int Y, int W, int H) { ++ int top, bottom, left, right; + int sx, sy, sw, sh; +- Fl::screen_xywh(sx, sy, sw, sh, X, Y, W, H); ++ ++ top = w->fullscreen_screen_top; ++ bottom = w->fullscreen_screen_bottom; ++ left = w->fullscreen_screen_left; ++ right = w->fullscreen_screen_right; ++ ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ top = Fl::screen_num(X, Y, W, H); ++ bottom = top; ++ left = top; ++ right = top; ++ } ++ ++ Fl::screen_xywh(sx, sy, sw, sh, top); ++ Y = sy; ++ Fl::screen_xywh(sx, sy, sw, sh, bottom); ++ H = sy + sh - Y; ++ Fl::screen_xywh(sx, sy, sw, sh, left); ++ X = sx; ++ Fl::screen_xywh(sx, sy, sw, sh, right); ++ W = sx + sw - X; ++ + DWORD flags = GetWindowLong(xid, GWL_STYLE); + flags = flags & ~(WS_THICKFRAME|WS_CAPTION); + SetWindowLong(xid, GWL_STYLE, flags); ++ + // SWP_NOSENDCHANGING is so that we can override size limits +- SetWindowPos(xid, HWND_TOP, sx, sy, sw, sh, SWP_NOSENDCHANGING | SWP_FRAMECHANGED); ++ SetWindowPos(xid, HWND_TOP, X, Y, W, H, SWP_NOSENDCHANGING | SWP_FRAMECHANGED); + } + + void Fl_Window::fullscreen_x() { + _set_fullscreen(); +- make_fullscreen(this, fl_xid(this), x(), y(), w(), h()); ++ i->make_fullscreen(x(), y(), w(), h()); + Fl::handle(FL_FULLSCREEN, this); + } + +@@ -1814,8 +1836,8 @@ Fl_X* Fl_X::make(Fl_Window* w) { + monitor the window was placed on. */ + RECT rect; + GetWindowRect(x->xid, &rect); +- make_fullscreen(w, x->xid, rect.left, rect.top, +- rect.right - rect.left, rect.bottom - rect.top); ++ x->make_fullscreen(rect.left, rect.top, ++ rect.right - rect.left, rect.bottom - rect.top); + } + + x->next = Fl_X::first; +diff -urp fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx fltk-1.3.2/src/Fl_Window_fullscreen.cxx +--- fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx 2012-11-06 21:46:14.000000000 +0100 ++++ fltk-1.3.2/src/Fl_Window_fullscreen.cxx 2013-01-16 10:52:47.879480608 +0100 +@@ -36,6 +36,10 @@ int Fl_Window::no_fullscreen_x = 0; + int Fl_Window::no_fullscreen_y = 0; + int Fl_Window::no_fullscreen_w = 0; + int Fl_Window::no_fullscreen_h = 0; ++int Fl_Window::fullscreen_screen_top = -1; ++int Fl_Window::fullscreen_screen_bottom = -1; ++int Fl_Window::fullscreen_screen_left = -1; ++int Fl_Window::fullscreen_screen_right = -1; + #endif + + void Fl_Window::border(int b) { +@@ -95,6 +99,23 @@ void Fl_Window::fullscreen_off() { + fullscreen_off(no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h); + } + ++void Fl_Window::fullscreen_screens(int top, int bottom, int left, int right) { ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ fullscreen_screen_top = -1; ++ fullscreen_screen_bottom = -1; ++ fullscreen_screen_left = -1; ++ fullscreen_screen_right = -1; ++ } else { ++ fullscreen_screen_top = top; ++ fullscreen_screen_bottom = bottom; ++ fullscreen_screen_left = left; ++ fullscreen_screen_right = right; ++ } ++ ++ if (shown() && (flags() & Fl_Widget::FULLSCREEN)) ++ fullscreen_x(); ++} ++ + + // + // End of "$Id: Fl_Window_fullscreen.cxx 9706 2012-11-06 20:46:14Z matt $". +diff -urp fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:52:33.020228202 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:52:47.880480556 +0100 +@@ -344,6 +344,7 @@ Atom fl_NET_WM_ICON_NAME; // utf8 aware + Atom fl_NET_SUPPORTING_WM_CHECK; + Atom fl_NET_WM_STATE; + Atom fl_NET_WM_STATE_FULLSCREEN; ++Atom fl_NET_WM_FULLSCREEN_MONITORS; + Atom fl_NET_WORKAREA; + Atom fl_NET_WM_ICON; + +@@ -709,6 +710,7 @@ void fl_open_display(Display* d) { + fl_NET_SUPPORTING_WM_CHECK = XInternAtom(d, "_NET_SUPPORTING_WM_CHECK", 0); + fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0); + fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0); ++ fl_NET_WM_FULLSCREEN_MONITORS = XInternAtom(d, "_NET_WM_FULLSCREEN_MONITORS", 0); + fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0); + fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0); + +@@ -1872,22 +1874,30 @@ void Fl_Window::resize(int X,int Y,int W + #define _NET_WM_STATE_ADD 1 /* add/set property */ + #define _NET_WM_STATE_TOGGLE 2 /* toggle property */ + +-static void send_wm_state_event(Window wnd, int add, Atom prop) { ++static void send_wm_event(Window wnd, Atom message, ++ unsigned long d0, unsigned long d1=0, ++ unsigned long d2=0, unsigned long d3=0, ++ unsigned long d4=0) { + XEvent e; + e.xany.type = ClientMessage; + e.xany.window = wnd; +- e.xclient.message_type = fl_NET_WM_STATE; ++ e.xclient.message_type = message; + e.xclient.format = 32; +- e.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; +- e.xclient.data.l[1] = prop; +- e.xclient.data.l[2] = 0; +- e.xclient.data.l[3] = 0; +- e.xclient.data.l[4] = 0; ++ e.xclient.data.l[0] = d0; ++ e.xclient.data.l[1] = d1; ++ e.xclient.data.l[2] = d2; ++ e.xclient.data.l[3] = d3; ++ e.xclient.data.l[4] = d4; + XSendEvent(fl_display, RootWindow(fl_display, fl_screen), + 0, SubstructureNotifyMask | SubstructureRedirectMask, + &e); + } + ++static void send_wm_state_event(Window wnd, int add, Atom prop) { ++ send_wm_event(wnd, fl_NET_WM_STATE, ++ add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE, prop); ++} ++ + int Fl_X::ewmh_supported() { + static int result = -1; + +@@ -1911,6 +1921,22 @@ int Fl_X::ewmh_supported() { + /* Change an existing window to fullscreen */ + void Fl_Window::fullscreen_x() { + if (Fl_X::ewmh_supported()) { ++ int top, bottom, left, right; ++ ++ top = fullscreen_screen_top; ++ bottom = fullscreen_screen_bottom; ++ left = fullscreen_screen_left; ++ right = fullscreen_screen_right; ++ ++ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { ++ top = Fl::screen_num(x(), y(), w(), h()); ++ bottom = top; ++ left = top; ++ right = top; ++ } ++ ++ send_wm_event(fl_xid(this), fl_NET_WM_FULLSCREEN_MONITORS, ++ top, bottom, left, right); + send_wm_state_event(fl_xid(this), 1, fl_NET_WM_STATE_FULLSCREEN); + } else { + _set_fullscreen(); +@@ -1997,7 +2023,7 @@ void Fl_X::make_xid(Fl_Window* win, XVis + // force the window to be on-screen. Usually the X window manager + // does this, but a few don't, so we do it here for consistency: + int scr_x, scr_y, scr_w, scr_h; +- Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y); ++ Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y, W, H); + + if (win->border()) { + // ensure border is on screen: +@@ -2026,6 +2052,23 @@ void Fl_X::make_xid(Fl_Window* win, XVis + return; + } + ++ // Compute which screen(s) we should be on if we want to go fullscreen ++ int fullscreen_top, fullscreen_bottom, fullscreen_left, fullscreen_right; ++ ++ fullscreen_top = win->fullscreen_screen_top; ++ fullscreen_bottom = win->fullscreen_screen_bottom; ++ fullscreen_left = win->fullscreen_screen_left; ++ fullscreen_right = win->fullscreen_screen_right; ++ ++ if ((fullscreen_top < 0) || (fullscreen_bottom < 0) || ++ (fullscreen_left < 0) || (fullscreen_right < 0)) { ++ fullscreen_top = Fl::screen_num(X, Y, W, H); ++ fullscreen_bottom = fullscreen_top; ++ fullscreen_left = fullscreen_top; ++ fullscreen_right = fullscreen_top; ++ } ++ ++ + ulong root = win->parent() ? + fl_xid(win->window()) : RootWindow(fl_display, fl_screen); + +@@ -2049,9 +2092,17 @@ void Fl_X::make_xid(Fl_Window* win, XVis + // border, and cannot grab without an existing window. Besides, + // there is no clear_override(). + if (win->flags() & Fl_Widget::FULLSCREEN && !Fl_X::ewmh_supported()) { ++ int sx, sy, sw, sh; + attr.override_redirect = 1; + mask |= CWOverrideRedirect; +- Fl::screen_xywh(X, Y, W, H, X, Y, W, H); ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_left); ++ X = sx; ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_right); ++ W = sx + sw - X; ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_top); ++ Y = sy; ++ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_bottom); ++ H = sy + sh - Y; + } + + if (fl_background_pixel >= 0) { +@@ -2122,6 +2173,13 @@ void Fl_X::make_xid(Fl_Window* win, XVis + + // If asked for, create fullscreen + if (win->flags() & Fl_Widget::FULLSCREEN && Fl_X::ewmh_supported()) { ++ unsigned long data[4]; ++ data[0] = fullscreen_top; ++ data[1] = fullscreen_bottom; ++ data[2] = fullscreen_left; ++ data[3] = fullscreen_right; ++ XChangeProperty (fl_display, xp->xid, fl_NET_WM_FULLSCREEN_MONITORS, XA_ATOM, 32, ++ PropModeReplace, (unsigned char*) data, 4); + XChangeProperty (fl_display, xp->xid, fl_NET_WM_STATE, XA_ATOM, 32, + PropModeAppend, (unsigned char*) &fl_NET_WM_STATE_FULLSCREEN, 1); + } +diff -urp fltk-1.3.2.org/test/fullscreen.cxx fltk-1.3.2/test/fullscreen.cxx +--- fltk-1.3.2.org/test/fullscreen.cxx 2012-06-14 17:09:46.000000000 +0200 ++++ fltk-1.3.2/test/fullscreen.cxx 2013-01-16 10:52:47.881104801 +0100 +@@ -127,7 +127,7 @@ class fullscreen_window : public Fl_Sing + fullscreen_window(int W, int H, const char *t=0); + int handle (int e); + Fl_Toggle_Light_Button *b3; +- ++ Fl_Toggle_Light_Button *b4; + }; + + fullscreen_window::fullscreen_window(int W, int H, const char *t) : Fl_Single_Window(W, H, t) { +@@ -170,23 +170,54 @@ void border_cb(Fl_Widget *o, void *p) { + #endif + } + +-int px,py,pw,ph; + Fl_Button *border_button; + void fullscreen_cb(Fl_Widget *o, void *p) { + Fl_Window *w = (Fl_Window *)p; + int d = ((Fl_Button *)o)->value(); + if (d) { +- px = w->x(); +- py = w->y(); +- pw = w->w(); +- ph = w->h(); ++ if (((fullscreen_window*)w)->b4->value()) { ++ int top, bottom, left, right; ++ int top_y, bottom_y, left_x, right_x; ++ ++ int sx, sy, sw, sh; ++ ++ top = bottom = left = right = 0; ++ ++ Fl::screen_xywh(sx, sy, sw, sh, 0); ++ top_y = sy; ++ bottom_y = sy + sh; ++ left_x = sx; ++ right_x = sx + sw; ++ ++ for (int i = 1;i < Fl::screen_count();i++) { ++ Fl::screen_xywh(sx, sy, sw, sh, i); ++ if (sy < top_y) { ++ top = i; ++ top_y = sy; ++ } ++ if ((sy + sh) > bottom_y) { ++ bottom = i; ++ bottom_y = sy + sh; ++ } ++ if (sx < left_x) { ++ left = i; ++ left_x = sx; ++ } ++ if ((sx + sw) > right_x) { ++ right = i; ++ right_x = sx + sw; ++ } ++ } ++ ++ w->fullscreen_screens(top, bottom, left, right); ++ } else { ++ w->fullscreen_screens(-1, -1, -1, -1); ++ } + w->fullscreen(); +- w->override(); + #ifndef WIN32 // update our border state in case border was turned off + border_button->value(w->border()); + #endif + } else { +- //w->fullscreen_off(px,py,pw,ph); + w->fullscreen_off(); + } + } +@@ -219,7 +250,7 @@ void exit_cb(Fl_Widget *, void *) { + exit(0); + } + +-#define NUMB 7 ++#define NUMB 8 + + int twowindow = 0; + int initfull = 0; +@@ -284,6 +315,9 @@ int main(int argc, char **argv) { + window.b3->callback(fullscreen_cb,w); + y+=30; + ++ window.b4 = new Fl_Toggle_Light_Button(50,y,window.w()-60,30,"All Screens"); ++ y+=30; ++ + Fl_Button eb(50,y,window.w()-60,30,"Exit"); + eb.callback(exit_cb); + y+=30; diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch new file mode 100644 index 00000000..c29d3b97 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-win32.patch @@ -0,0 +1,256 @@ +diff -ur fltk-1.3.0r9293.org/src/Fl_win32.cxx fltk-1.3.0r9293/src/Fl_win32.cxx +--- fltk-1.3.0r9293.org/src/Fl_win32.cxx 2012-06-18 09:07:56.522314557 +0200 ++++ fltk-1.3.0r9293/src/Fl_win32.cxx 2012-06-18 09:08:07.392836285 +0200 +@@ -87,6 +87,8 @@ + static Fl_Display_Device fl_gdi_display(&fl_gdi_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_gdi_display; // the platform display + ++bool use_simple_keyboard = false; ++ + // dynamic wsock dll handling api: + #if defined(__CYGWIN__) && !defined(SOCKET) + # define SOCKET int +@@ -120,6 +122,8 @@ + * size and link dependencies. + */ + static HMODULE s_imm_module = 0; ++typedef BOOL (WINAPI* flTypeImmAssociateContextEx)(HWND, HIMC, DWORD); ++static flTypeImmAssociateContextEx flImmAssociateContextEx = 0; + typedef HIMC (WINAPI* flTypeImmGetContext)(HWND); + static flTypeImmGetContext flImmGetContext = 0; + typedef BOOL (WINAPI* flTypeImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); +@@ -135,6 +139,7 @@ + if (!s_imm_module) + Fl::fatal("FLTK Lib Error: IMM32.DLL file not found!\n\n" + "Please check your input method manager library accessibility."); ++ flImmAssociateContextEx = (flTypeImmAssociateContextEx)GetProcAddress(s_imm_module, "ImmAssociateContextEx"); + flImmGetContext = (flTypeImmGetContext)GetProcAddress(s_imm_module, "ImmGetContext"); + flImmSetCompositionWindow = (flTypeImmSetCompositionWindow)GetProcAddress(s_imm_module, "ImmSetCompositionWindow"); + flImmReleaseContext = (flTypeImmReleaseContext)GetProcAddress(s_imm_module, "ImmReleaseContext"); +@@ -413,7 +418,12 @@ + } + } + +- TranslateMessage(&fl_msg); ++ // Don't bother with key to character translation as we do ++ // it manually for simpley keyboard widgets. In fact, calling ++ // TranslateMessage() just makes it more difficult as it sets ++ // a bunch of internal state. ++ if (!use_simple_keyboard) ++ TranslateMessage(&fl_msg); + DispatchMessageW(&fl_msg); + have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE); + } +@@ -638,6 +648,49 @@ + } + } + ++void fl_update_focus(void) ++{ ++ Fl_Widget *focus; ++ Fl_Window *win; ++ ++ get_imm_module(); ++ ++ focus = Fl::grab(); ++ if (!focus) ++ focus = Fl::focus(); ++ if (!focus) ++ return; ++ ++ // Grabs are special in that events are sent to the first ++ // available window ++ if (focus == Fl::grab()) ++ win = Fl::first_window(); ++ else { ++ win = focus->as_window(); ++ if (!win) ++ win = focus->window(); ++ } ++ ++ if (!win) { ++ Fl::warning("Cannot find window for widget receiving focus"); ++ return; ++ } ++ ++ // No Win32 window created yet ++ if (!Fl_X::i(win) || !fl_xid(win)) ++ return; ++ ++ if (focus->simple_keyboard()) { ++ use_simple_keyboard = true; ++ if (flImmGetContext(fl_xid(win)) != 0) ++ flImmAssociateContextEx(fl_xid(win), 0, 0); ++ } else { ++ use_simple_keyboard = false; ++ if (flImmGetContext(fl_xid(win)) == 0) ++ flImmAssociateContextEx(fl_xid(win), 0, IACE_DEFAULT); ++ } ++} ++ + HWND fl_capture; + + static int mouse_event(Fl_Window *window, int what, int button, +@@ -785,6 +838,27 @@ + return extended ? extendedlut[vk] : vklut[vk]; + } + ++static xchar msdead2fltk(xchar in) ++{ ++ switch (in) { ++ case 0x0060: // GRAVE ACCENT ++ return 0x0300; // COMBINING GRAVE ACCENT ++ case 0x00b4: // ACUTE ACCENT ++ return 0x0301; // COMBINING ACUTE ACCENT ++ case 0x005e: // CIRCUMFLEX ACCENT ++ return 0x0302; // COMBINING CIRCUMFLEX ACCENT ++ case 0x007e: // TILDE ++ return 0x0303; // COMBINING TILDE ++ case 0x00a8: // DIAERESIS ++ return 0x0308; // COMBINING DIAERESIS ++ // FIXME: Windows dead key behaviour isn't documented and I don't have ++ // any more keyboards to test with... ++ } ++ ++ // hope that Windows gave us something proper to begin with ++ return in; ++} ++ + #if USE_COLORMAP + extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx + #endif +@@ -846,6 +920,8 @@ + //fl_msg.pt = ??? + //fl_msg.lPrivate = ??? + ++ MSG fl_orig_msg = fl_msg; ++ + Fl_Window *window = fl_find(hWnd); + + if (window) switch (uMsg) { +@@ -1025,23 +1101,82 @@ + if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK; + Fl::e_state = state; + static char buffer[1024]; +- if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { + ++ if (use_simple_keyboard) { ++ BYTE keystate[256]; ++ WCHAR wbuf[8]; ++ int ret; ++ ++ // I'm not sure if we ever get WM_CHAR (& friends) without an initial ++ // WM_KEYDOWN (& friends), but if we do then we should not send such ++ // side band events to simple keyboard widgets. ++ if ((fl_orig_msg.message != WM_KEYDOWN) && ++ (fl_orig_msg.message != WM_SYSKEYDOWN) && ++ (fl_orig_msg.message != WM_KEYUP) && ++ (fl_orig_msg.message != WM_SYSKEYUP)) ++ break; ++ ++ GetKeyboardState(keystate); ++ ++ // Pressing Ctrl wreaks havoc with the symbol lookup, so turn that off. ++ // But AltGr shows up as Ctrl+Alt in Windows, so keep Ctrl if Alt is ++ // active. ++ if (!(keystate[VK_MENU] & 0x80)) ++ keystate[VK_CONTROL] = keystate[VK_LCONTROL] = keystate[VK_RCONTROL] = 0; ++ ++ // We cannot inspect or modify Windows' internal state of the keyboard ++ // so we have to try to infer information from ToUnicode() and wedge ++ // things into a known state. ++ for (int i = 0;i < 2;i++) { ++ ret = ToUnicode(fl_orig_msg.wParam, 0, keystate, wbuf, ++ sizeof(wbuf)/sizeof(wbuf[0]), 0); ++ ++ // No symbol for this key (or unexpected length) ++ if ((ret == 0) || (ret < -1)) { ++ buffer[0] = 0; ++ Fl::e_length = 0; ++ break; ++ } ++ ++ // A dead key. Convert this to a Unicode combining character so ++ // that the application can tell the difference between dead and ++ // normal keys. ++ if (ret == -1) { ++ xchar u = (xchar) msdead2fltk(wbuf[0]); ++ Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); ++ buffer[Fl::e_length] = 0; ++ break; ++ } ++ ++ // If we have two characters (or more) from ToUnicode(), that's ++ // an invalid sequence. One character chould mean a proper symbol, ++ // or it could mean a composed one. In both cases we need to call ++ // ToUnicode() again to get something sane. ++ if (i == 0) ++ continue; ++ ++ // We should now have something sane. Give whatever we have to the ++ // application. ++ Fl::e_length = fl_utf8fromwc(buffer, 1024, wbuf, ret); ++ buffer[Fl::e_length] = 0; ++ } ++ } else if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { + xchar u = (xchar) wParam; + // Fl::e_length = fl_unicode2utf(&u, 1, buffer); + Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); + buffer[Fl::e_length] = 0; ++ } else { ++ buffer[0] = 0; ++ Fl::e_length = 0; ++ } + +- +- } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { +- if (state & FL_NUM_LOCK) { +- // Convert to regular keypress... +- buffer[0] = Fl::e_keysym-FL_KP; +- Fl::e_length = 1; +- } else { +- // Convert to special keypress... +- buffer[0] = 0; +- Fl::e_length = 0; ++ // The keypad area is a bit odd in that we need to change the keysym ++ // to properly indicate what the user meant, unlike other keys where ++ // we normally change the text and keep keysym stable. ++ if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { ++ // The initial mapping tables give us a keysym that corresponds to ++ // numlock being on, so we only do something when it is off. ++ if (!(state & FL_NUM_LOCK)) { + switch (Fl::e_keysym) { + case FL_KP + '0' : + Fl::e_keysym = FL_Insert; +@@ -1073,30 +1208,10 @@ + case FL_KP + '.' : + Fl::e_keysym = FL_Delete; + break; +- case FL_KP + '/' : +- case FL_KP + '*' : +- case FL_KP + '-' : +- case FL_KP + '+' : +- buffer[0] = Fl::e_keysym-FL_KP; +- Fl::e_length = 1; +- break; + } + } +- } else if ((lParam & (1<<31))==0) { +-#ifdef FLTK_PREVIEW_DEAD_KEYS +- if ((lParam & (1<<24))==0) { // clear if dead key (always?) +- xchar u = (xchar) wParam; +- Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); +- buffer[Fl::e_length] = 0; +- } else { // set if "extended key" (never printable?) +- buffer[0] = 0; +- Fl::e_length = 0; +- } +-#else +- buffer[0] = 0; +- Fl::e_length = 0; +-#endif + } ++ + Fl::e_text = buffer; + if (lParam & (1<<31)) { // key up events. + if (Fl::handle(FL_KEYUP, window)) return 0; diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch new file mode 100644 index 00000000..cabc0f1c --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v4.3.x-keyboard-x11.patch @@ -0,0 +1,286 @@ +diff -ur fltk-1.3.0r9619.org/FL/Fl_Widget.H fltk-1.3.0r9619/FL/Fl_Widget.H +--- fltk-1.3.0r9619.org/FL/Fl_Widget.H 2012-04-23 22:12:06.000000000 +0200 ++++ fltk-1.3.0r9619/FL/Fl_Widget.H 2012-06-18 13:46:07.302320825 +0200 +@@ -171,6 +171,7 @@ + GROUP_RELATIVE = 1<<16, ///< position this widget relative to the parent group, not to the window + COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget + FULLSCREEN = 1<<18, ///< a fullscreen window (Fl_Window) ++ SIMPLE_KEYBOARD = 1<<19, ///< the widget wants simple, consistent keypresses and not advanced input (like character composition and CJK input) + // (space for more flags) + USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions + USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions +@@ -776,6 +777,35 @@ + */ + void clear_changed() {flags_ &= ~CHANGED;} + ++ /** ++ Returns if the widget sees a simplified keyboard model or not. ++ ++ Normally widgets get a full-featured keyboard model that is geared ++ towards text input. This includes support for compose sequences and ++ advanced input methods, commonly used for asian writing system. This ++ system however has downsides in that extra graphic can be presented ++ to the user and that a physical key press doesn't correspond directly ++ to a FLTK event. ++ ++ Widgets that need a direct correspondence between actual key events ++ and those seen by the widget can swith to the simplified keyboard ++ model. ++ ++ \retval 0 if the widget uses the normal keyboard model ++ \see set_changed(), clear_changed() ++ */ ++ unsigned int simple_keyboard() const {return flags_&SIMPLE_KEYBOARD;} ++ ++ /** Marks a widget to use the simple keyboard model. ++ \see changed(), clear_changed() ++ */ ++ void set_simple_keyboard() {flags_ |= SIMPLE_KEYBOARD;} ++ ++ /** Marks a widget to use the normal keyboard model. ++ \see changed(), set_changed() ++ */ ++ void set_normal_keyboard() {flags_ &= ~SIMPLE_KEYBOARD;} ++ + /** Gives the widget the keyboard focus. + Tries to make this widget be the Fl::focus() widget, by first sending + it an FL_FOCUS event, and if it returns non-zero, setting +diff -ur fltk-1.3.0r9619.org/src/Fl.cxx fltk-1.3.0r9619/src/Fl.cxx +--- fltk-1.3.0r9619.org/src/Fl.cxx 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.0r9619/src/Fl.cxx 2012-06-18 13:46:07.303320877 +0200 +@@ -70,6 +70,8 @@ + extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle); + #endif // WIN32 + ++extern void fl_update_focus(void); ++ + // + // Globals... + // +@@ -876,6 +878,8 @@ + fl_oldfocus = p; + } + e_number = old_event; ++ // let the platform code do what it needs ++ fl_update_focus(); + } + } + +diff -ur fltk-1.3.0r9619.org/src/Fl_grab.cxx fltk-1.3.0r9619/src/Fl_grab.cxx +--- fltk-1.3.0r9619.org/src/Fl_grab.cxx 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.0r9619/src/Fl_grab.cxx 2012-06-18 13:46:07.303320877 +0200 +@@ -29,6 +29,7 @@ + // override_redirect, it does similar things on WIN32. + + extern void fl_fix_focus(); // in Fl.cxx ++void fl_update_focus(void); + + #ifdef WIN32 + // We have to keep track of whether we have captured the mouse, since +@@ -80,6 +81,7 @@ + #endif + } + grab_ = win; ++ fl_update_focus(); + } else { + if (grab_) { + #ifdef WIN32 +@@ -98,6 +100,7 @@ + XFlush(fl_display); + #endif + grab_ = 0; ++ fl_update_focus(); + fl_fix_focus(); + } + } +diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx +--- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-18 13:46:07.205316173 +0200 ++++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-18 13:46:18.216844629 +0200 +@@ -298,6 +298,7 @@ + Colormap fl_colormap; + XIM fl_xim_im = 0; + XIC fl_xim_ic = 0; ++Window fl_xim_win = 0; + char fl_is_over_the_spot = 0; + static XRectangle status_area; + +@@ -583,6 +584,65 @@ + if(xim_styles) XFree(xim_styles); + } + ++void fl_xim_deactivate(void); ++ ++void fl_xim_activate(Window xid) ++{ ++ if (!fl_xim_im) ++ return; ++ ++ // If the focused window has changed, then use the brute force method ++ // of completely recreating the input context. ++ if (fl_xim_win != xid) { ++ fl_xim_deactivate(); ++ ++ fl_new_ic(); ++ fl_xim_win = xid; ++ ++ XSetICValues(fl_xim_ic, ++ XNFocusWindow, fl_xim_win, ++ XNClientWindow, fl_xim_win, ++ NULL); ++ } ++ ++ fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); ++} ++ ++void fl_xim_deactivate(void) ++{ ++ if (!fl_xim_ic) ++ return; ++ ++ XDestroyIC(fl_xim_ic); ++ fl_xim_ic = NULL; ++ ++ fl_xim_win = 0; ++} ++ ++extern Fl_Window *fl_xfocus; ++ ++void fl_update_focus(void) ++{ ++ Fl_Widget *focus; ++ ++ focus = Fl::grab(); ++ if (!focus) ++ focus = Fl::focus(); ++ if (!focus) ++ return; ++ ++ if (focus->simple_keyboard()) { ++ fl_xim_deactivate(); ++ } else { ++ // fl_xfocus should always be set if something has focus, but let's ++ // play it safe ++ if (!fl_xfocus || !fl_xid(fl_xfocus)) ++ return; ++ ++ fl_xim_activate(fl_xid(fl_xfocus)); ++ } ++} ++ + void fl_open_display() { + if (fl_display) return; + +@@ -917,10 +977,9 @@ + XEvent xevent = thisevent; + fl_xevent = &thisevent; + Window xid = xevent.xany.window; +- static Window xim_win = 0; + + if (fl_xim_ic && xevent.type == DestroyNotify && +- xid != xim_win && !fl_find(xid)) ++ xid != fl_xim_win && !fl_find(xid)) + { + XIM xim_im; + xim_im = XOpenIM(fl_display, NULL, NULL, NULL); +@@ -935,48 +994,10 @@ + return 0; + } + +- if (fl_xim_ic && (xevent.type == FocusIn)) +- { +-#define POOR_XIM +-#ifdef POOR_XIM +- if (xim_win != xid) +- { +- xim_win = xid; +- XDestroyIC(fl_xim_ic); +- fl_xim_ic = NULL; +- fl_new_ic(); +- XSetICValues(fl_xim_ic, +- XNFocusWindow, xevent.xclient.window, +- XNClientWindow, xid, +- NULL); +- } +- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); +-#else +- if (Fl::first_window() && Fl::first_window()->modal()) { +- Window x = fl_xid(Fl::first_window()); +- if (x != xim_win) { +- xim_win = x; +- XSetICValues(fl_xim_ic, +- XNFocusWindow, xim_win, +- XNClientWindow, xim_win, +- NULL); +- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); +- } +- } else if (xim_win != xid && xid) { +- xim_win = xid; +- XSetICValues(fl_xim_ic, +- XNFocusWindow, xevent.xclient.window, +- XNClientWindow, xid, +- //XNFocusWindow, xim_win, +- //XNClientWindow, xim_win, +- NULL); +- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height); +- } +-#endif ++ if (fl_xim_ic) { ++ if (XFilterEvent((XEvent *)&xevent, 0)) ++ return 1; + } +- +- if ( XFilterEvent((XEvent *)&xevent, 0) ) +- return(1); + + #if USE_XRANDR + if( XRRUpdateConfiguration_f && xevent.type == randrEventBase + RRScreenChangeNotify) { +@@ -1326,15 +1347,15 @@ + //static XComposeStatus compose; + len = XLookupString((XKeyEvent*)&(xevent.xkey), + buffer, buffer_len, &keysym, 0/*&compose*/); +- if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets +- // force it to type a character (not sure if this ever is needed): +- // if (!len) {buffer[0] = char(keysym); len = 1;} +- len = fl_utf8encode(XKeysymToUcs(keysym), buffer); +- if (len < 1) len = 1; +- // ignore all effects of shift on the keysyms, which makes it a lot +- // easier to program shortcuts and is Windoze-compatible: +- keysym = XKeycodeToKeysym(fl_display, keycode, 0); +- } ++ // XLookupString() is only defined to return Latin-1 (although it ++ // often gives you more). To be safe, use our own lookups based on ++ // keysym. ++ len = fl_utf8encode(XKeysymToUcs(keysym), buffer); ++ if (len < 1) ++ len = 1; ++ // ignore all effects of shift on the keysyms, which makes it a lot ++ // easier to program shortcuts and is Windoze-compatable: ++ keysym = XKeycodeToKeysym(fl_display, keycode, 0); + } + // MRS: Can't use Fl::event_state(FL_CTRL) since the state is not + // set until set_event_xy() is called later... +diff -ur fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c fltk-1.3.0r9619/src/xutf8/imKStoUCS.c +--- fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c 2009-03-13 23:43:43.000000000 +0100 ++++ fltk-1.3.0r9619/src/xutf8/imKStoUCS.c 2012-06-18 13:46:07.304320930 +0200 +@@ -266,6 +266,12 @@ + 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ + }; + ++static unsigned short const keysym_to_unicode_fe50_fe60[] = { ++ 0x0300, 0x0301, 0x0302, 0x0303, 0x0304, 0x0306, 0x0307, 0x0308, /* 0xfe50-0xfe57 */ ++ 0x030a, 0x030b, 0x030c, 0x0327, 0x0328, 0x1da5, 0x3099, 0x309a, /* 0xfe58-0xfe5f */ ++ 0x0323 /* 0xfe60-0xfe67 */ ++}; ++ + unsigned int + KeySymToUcs4(KeySym keysym) + { +@@ -315,6 +321,8 @@ + return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; + else if (keysym > 0x209f && keysym < 0x20ad) + return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; ++ else if (keysym > 0xfe4f && keysym < 0xfe61) ++ return keysym_to_unicode_fe50_fe60[keysym - 0xfe50]; + else + return 0; + } diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch new file mode 100644 index 00000000..467160f0 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-clipboard-x11.patch @@ -0,0 +1,350 @@ +diff -up fltk-1.3.2/CMakeLists.txt.clp-x11 fltk-1.3.2/CMakeLists.txt +--- fltk-1.3.2/CMakeLists.txt.clp-x11 2012-09-13 16:19:01.000000000 +0200 ++++ fltk-1.3.2/CMakeLists.txt 2013-01-30 15:56:25.810663430 +0100 +@@ -515,6 +515,20 @@ else() + endif(OPTION_USE_XINERAMA) + + ####################################################################### ++if(X11_Xfixes_FOUND) ++ option(OPTION_USE_XFIXES "use lib XFIXES" ON) ++endif(X11_Xfixes_FOUND) ++ ++if(OPTION_USE_XFIXES) ++ set(HAVE_XFIXES ${X11_Xfixes_FOUND}) ++ include_directories(${X11_Xfixes_INCLUDE_PATH}) ++ list(APPEND FLTK_LDLIBS -lXfixes) ++ set(FLTK_XFIXES_FOUND TRUE) ++else() ++ set(FLTK_XFIXES_FOUND FALSE) ++endif(OPTION_USE_XFIXES) ++ ++####################################################################### + if(X11_Xft_FOUND) + option(OPTION_USE_XFT "use lib Xft" ON) + endif(X11_Xft_FOUND) +diff -up fltk-1.3.2/configh.cmake.in.clp-x11 fltk-1.3.2/configh.cmake.in +--- fltk-1.3.2/configh.cmake.in.clp-x11 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/configh.cmake.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#cmakedefine01 HAVE_XFIXES ++ ++/* + * __APPLE_QUARTZ__: + * + * If __APPLE_QUARTZ__ is defined, FLTK will be +diff -up fltk-1.3.2/configh.in.clp-x11 fltk-1.3.2/configh.in +--- fltk-1.3.2/configh.in.clp-x11 2011-10-04 11:21:47.000000000 +0200 ++++ fltk-1.3.2/configh.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#define HAVE_XFIXES 0 ++ ++/* + * __APPLE_QUARTZ__: + * + * All Apple implementations are now based on Quartz and Cocoa, +diff -up fltk-1.3.2/configure.in.clp-x11 fltk-1.3.2/configure.in +--- fltk-1.3.2/configure.in.clp-x11 2013-01-30 15:56:25.802663573 +0100 ++++ fltk-1.3.2/configure.in 2013-01-30 15:56:25.810663430 +0100 +@@ -999,6 +999,16 @@ case $uname_GUI in + LIBS="-lXext $LIBS") + fi + ++ dnl Check for the Xfixes extension unless disabled... ++ AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]]) ++ ++ if test x$enable_xfixes != xno; then ++ AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),, ++ [#include ]) ++ AC_CHECK_LIB(Xfixes, XFixesQueryExtension, ++ LIBS="-lXfixes $LIBS") ++ fi ++ + dnl Check for overlay visuals... + AC_PATH_PROG(XPROP, xprop) + AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, +diff -up fltk-1.3.2/fluid/CMakeLists.txt.clp-x11 fltk-1.3.2/fluid/CMakeLists.txt +diff -up fltk-1.3.2/src/CMakeLists.txt.clp-x11 fltk-1.3.2/src/CMakeLists.txt +--- fltk-1.3.2/src/CMakeLists.txt.clp-x11 2013-01-30 16:06:00.785430590 +0100 ++++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:06:17.883126642 +0100 +@@ -243,6 +243,10 @@ if(HAVE_XINERAMA) + target_link_libraries(fltk ${X11_Xinerama_LIB}) + endif(HAVE_XINERAMA) + ++if(HAVE_XFIXES) ++ target_link_libraries(fltk ${X11_Xfixes_LIB}) ++endif(HAVE_XFIXES) ++ + if(USE_XFT) + target_link_libraries(fltk ${X11_Xft_LIB}) + endif(USE_XFT) +diff -up fltk-1.3.2/src/Fl_x.cxx.clp-x11 fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2/src/Fl_x.cxx.clp-x11 2013-01-30 15:56:25.793663733 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:03:37.355981103 +0100 +@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp + static int randrEventBase; // base of RandR-defined events + #endif + ++# if HAVE_XFIXES ++# include ++static int xfixes_event_base = 0; ++static bool have_xfixes = false; ++# endif ++ + static Fl_Xlib_Graphics_Driver fl_xlib_driver; + static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display +@@ -307,6 +313,9 @@ static Atom WM_PROTOCOLS; + static Atom fl_MOTIF_WM_HINTS; + static Atom TARGETS; + static Atom CLIPBOARD; ++static Atom TIMESTAMP; ++static Atom PRIMARY_TIMESTAMP; ++static Atom CLIPBOARD_TIMESTAMP; + Atom fl_XdndAware; + Atom fl_XdndSelection; + Atom fl_XdndEnter; +@@ -667,6 +676,9 @@ void fl_open_display(Display* d) { + fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0); + TARGETS = XInternAtom(d, "TARGETS", 0); + CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0); ++ TIMESTAMP = XInternAtom(d, "TIMESTAMP", 0); ++ PRIMARY_TIMESTAMP = XInternAtom(d, "PRIMARY_TIMESTAMP", 0); ++ CLIPBOARD_TIMESTAMP = XInternAtom(d, "CLIPBOARD_TIMESTAMP", 0); + fl_XdndAware = XInternAtom(d, "XdndAware", 0); + fl_XdndSelection = XInternAtom(d, "XdndSelection", 0); + fl_XdndEnter = XInternAtom(d, "XdndEnter", 0); +@@ -713,6 +725,15 @@ void fl_open_display(Display* d) { + #if !USE_COLORMAP + Fl::visual(FL_RGB); + #endif ++ ++#if HAVE_XFIXES ++ int error_base; ++ if (XFixesQueryExtension(fl_display, &xfixes_event_base, &error_base)) ++ have_xfixes = true; ++ else ++ have_xfixes = false; ++#endif ++ + #if USE_XRANDR + void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY); + if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY); +@@ -901,6 +922,102 @@ void Fl::copy(const char *stuff, int len + } + + //////////////////////////////////////////////////////////////// ++// Code for tracking clipboard changes: ++ ++static Time primary_timestamp = -1; ++static Time clipboard_timestamp = -1; ++ ++extern bool fl_clipboard_notify_empty(void); ++extern void fl_trigger_clipboard_notify(int source); ++ ++static void poll_clipboard_owner(void) { ++ Window xid; ++ ++#if HAVE_XFIXES ++ // No polling needed with Xfixes ++ if (have_xfixes) ++ return; ++#endif ++ ++ // No one is interested, so no point polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ // We need a window for this to work ++ if (!Fl::first_window()) ++ return; ++ xid = fl_xid(Fl::first_window()); ++ if (!xid) ++ return; ++ ++ // Request an update of the selection time for both the primary and ++ // clipboard selections. Magic continues when we get a SelectionNotify. ++ if (!fl_i_own_selection[0]) ++ XConvertSelection(fl_display, XA_PRIMARY, TIMESTAMP, PRIMARY_TIMESTAMP, ++ xid, fl_event_time); ++ if (!fl_i_own_selection[1]) ++ XConvertSelection(fl_display, CLIPBOARD, TIMESTAMP, CLIPBOARD_TIMESTAMP, ++ xid, fl_event_time); ++} ++ ++static void clipboard_timeout(void *data) ++{ ++ // No one is interested, so stop polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ poll_clipboard_owner(); ++ ++ Fl::repeat_timeout(0.5, clipboard_timeout); ++} ++ ++static void handle_clipboard_timestamp(int clipboard, Time time) ++{ ++ Time *timestamp; ++ ++ timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp; ++ ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ // Initial scan, just store the value ++ if (*timestamp == (Time)-1) { ++ *timestamp = time; ++ return; ++ } ++ } ++ ++ // Same selection ++ if (time == *timestamp) ++ return; ++ ++ *timestamp = time; ++ ++ // Something happened! Let's tell someone! ++ fl_trigger_clipboard_notify(clipboard); ++} ++ ++void fl_clipboard_notify_change() { ++ // Reset the timestamps if we've going idle so that you don't ++ // get a bogus immediate trigger next time they're activated. ++ if (fl_clipboard_notify_empty()) { ++ primary_timestamp = -1; ++ clipboard_timestamp = -1; ++ } else { ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ poll_clipboard_owner(); ++ ++ if (!Fl::has_timeout(clipboard_timeout)) ++ Fl::add_timeout(0.5, clipboard_timeout); ++ } ++ } ++} ++ ++//////////////////////////////////////////////////////////////// + + const XEvent* fl_xevent; // the current x event + ulong fl_event_time; // the last timestamp from an x event +@@ -1024,7 +1141,6 @@ int fl_handle(const XEvent& thisevent) + return 0; + + case SelectionNotify: { +- if (!fl_selection_requestor) return 0; + static unsigned char* buffer = 0; + if (buffer) {XFree(buffer); buffer = 0;} + long bytesread = 0; +@@ -1040,6 +1156,19 @@ int fl_handle(const XEvent& thisevent) + bytesread/4, 65536, 1, 0, + &actual, &format, &count, &remaining, + &portion)) break; // quit on error ++ ++ if ((fl_xevent->xselection.property == PRIMARY_TIMESTAMP) || ++ (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)) { ++ if (portion && format == 32 && count == 1) { ++ Time t = *(unsigned int*)portion; ++ if (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP) ++ handle_clipboard_timestamp(1, t); ++ else ++ handle_clipboard_timestamp(0, t); ++ } ++ return true; ++ } ++ + if (actual == TARGETS || actual == XA_ATOM) { + Atom type = XA_STRING; + for (unsigned i = 0; ixselectionclear.selection == CLIPBOARD; + fl_i_own_selection[clipboard] = 0; ++ poll_clipboard_owner(); + return 1;} + + case SelectionRequest: { +@@ -1308,6 +1441,9 @@ int fl_handle(const XEvent& thisevent) + case FocusIn: + if (fl_xim_ic) XSetICFocus(fl_xim_ic); + event = FL_FOCUS; ++ // If the user has toggled from another application to this one, ++ // then it's a good time to check for clipboard changes. ++ poll_clipboard_owner(); + break; + + case FocusOut: +@@ -1676,6 +1812,25 @@ int fl_handle(const XEvent& thisevent) + } + } + ++#if HAVE_XFIXES ++ switch (xevent.type - xfixes_event_base) { ++ case XFixesSelectionNotify: { ++ // Someone feeding us bogus events? ++ if (!have_xfixes) ++ return true; ++ ++ XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)&xevent; ++ ++ if ((selection_notify->selection == XA_PRIMARY) && !fl_i_own_selection[0]) ++ handle_clipboard_timestamp(0, selection_notify->selection_timestamp); ++ else if ((selection_notify->selection == CLIPBOARD) && !fl_i_own_selection[1]) ++ handle_clipboard_timestamp(1, selection_notify->selection_timestamp); ++ ++ return true; ++ } ++ } ++#endif ++ + return Fl::handle(event, window); + } + +@@ -1995,6 +2150,16 @@ void Fl_X::make_xid(Fl_Window* win, XVis + XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1); + } + ++#if HAVE_XFIXES ++ // register for clipboard change notifications ++ if (have_xfixes && !win->parent()) { ++ XFixesSelectSelectionInput(fl_display, xp->xid, XA_PRIMARY, ++ XFixesSetSelectionOwnerNotifyMask); ++ XFixesSelectSelectionInput(fl_display, xp->xid, CLIPBOARD, ++ XFixesSetSelectionOwnerNotifyMask); ++ } ++#endif ++ + XMapWindow(fl_display, xp->xid); + if (showit) { + win->set_visible(); +diff -up fltk-1.3.2/test/CMakeLists.txt.clp-x11 fltk-1.3.2/test/CMakeLists.txt diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch new file mode 100644 index 00000000..8e990505 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v5.3.x-cursor.patch @@ -0,0 +1,1623 @@ +diff -up fltk-1.3.2/CMakeLists.txt.cursor fltk-1.3.2/CMakeLists.txt +--- fltk-1.3.2/CMakeLists.txt.cursor 2013-01-30 16:07:59.510320246 +0100 ++++ fltk-1.3.2/CMakeLists.txt 2013-01-30 16:07:59.528319926 +0100 +@@ -529,6 +529,20 @@ else() + endif(OPTION_USE_XFIXES) + + ####################################################################### ++if(X11_Xcursor_FOUND) ++ option(OPTION_USE_XCURSOR "use lib XCURSOR" ON) ++endif(X11_Xcursor_FOUND) ++ ++if(OPTION_USE_XCURSOR) ++ set(HAVE_XCURSOR ${X11_Xcursor_FOUND}) ++ include_directories(${X11_Xcursor_INCLUDE_PATH}) ++ list(APPEND FLTK_LDLIBS -lXcursor) ++ set(FLTK_XCURSOR_FOUND TRUE) ++else() ++ set(FLTK_XCURSOR_FOUND FALSE) ++endif(OPTION_USE_XCURSOR) ++ ++####################################################################### + if(X11_Xft_FOUND) + option(OPTION_USE_XFT "use lib Xft" ON) + endif(X11_Xft_FOUND) +diff -up fltk-1.3.2/configh.cmake.in.cursor fltk-1.3.2/configh.cmake.in +--- fltk-1.3.2/configh.cmake.in.cursor 2013-01-30 16:07:59.510320246 +0100 ++++ fltk-1.3.2/configh.cmake.in 2013-01-30 16:07:59.529319908 +0100 +@@ -116,6 +116,14 @@ + #cmakedefine01 HAVE_XFIXES + + /* ++ * HAVE_XCURSOR: ++ * ++ * Do we have the X cursor library? ++ */ ++ ++#cmakedefine01 HAVE_XCURSOR ++ ++/* + * __APPLE_QUARTZ__: + * + * If __APPLE_QUARTZ__ is defined, FLTK will be +diff -up fltk-1.3.2/configh.in.cursor fltk-1.3.2/configh.in +--- fltk-1.3.2/configh.in.cursor 2013-01-30 16:07:59.510320246 +0100 ++++ fltk-1.3.2/configh.in 2013-01-30 16:07:59.529319908 +0100 +@@ -116,6 +116,14 @@ + #define HAVE_XFIXES 0 + + /* ++ * HAVE_XCURSOR: ++ * ++ * Do we have the X cursor library? ++ */ ++ ++#define HAVE_XCURSOR 0 ++ ++/* + * __APPLE_QUARTZ__: + * + * All Apple implementations are now based on Quartz and Cocoa, +diff -up fltk-1.3.2/configure.in.cursor fltk-1.3.2/configure.in +--- fltk-1.3.2/configure.in.cursor 2013-01-30 16:07:59.511320228 +0100 ++++ fltk-1.3.2/configure.in 2013-01-30 16:07:59.529319908 +0100 +@@ -1009,6 +1009,16 @@ case $uname_GUI in + LIBS="-lXfixes $LIBS") + fi + ++ dnl Check for the Xcursor library unless disabled... ++ AC_ARG_ENABLE(xcursor, [ --enable-xcursor turn on Xcursor support [default=yes]]) ++ ++ if test x$enable_xcursor != xno; then ++ AC_CHECK_HEADER(X11/Xcursor/Xcursor.h, AC_DEFINE(HAVE_XCURSOR),, ++ [#include ]) ++ AC_CHECK_LIB(Xcursor, XcursorImageCreate, ++ LIBS="-lXcursor $LIBS") ++ fi ++ + dnl Check for overlay visuals... + AC_PATH_PROG(XPROP, xprop) + AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, +diff -up fltk-1.3.2/FL/Enumerations.H.cursor fltk-1.3.2/FL/Enumerations.H +--- fltk-1.3.2/FL/Enumerations.H.cursor 2013-01-30 16:07:59.486320673 +0100 ++++ fltk-1.3.2/FL/Enumerations.H 2013-01-30 16:07:59.530319891 +0100 +@@ -879,35 +879,36 @@ inline Fl_Color fl_color_cube(int r, int + + /** The following constants define the mouse cursors that are available in FLTK. + +- The double-headed arrows are bitmaps provided by FLTK on X, the others +- are provided by system-defined cursors. ++ Cursors are provided by the system when available, or bitmaps built into ++ FLTK as a fallback. + + \todo enum Fl_Cursor needs maybe an image. + */ + enum Fl_Cursor { + FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */ +- FL_CURSOR_ARROW = 35, /**< an arrow pointer. */ +- FL_CURSOR_CROSS = 66, /**< crosshair. */ +- FL_CURSOR_WAIT = 76, /**< watch or hourglass. */ +- FL_CURSOR_INSERT = 77, /**< I-beam. */ +- FL_CURSOR_HAND = 31, /**< hand (uparrow on MSWindows). */ +- FL_CURSOR_HELP = 47, /**< question mark. */ +- FL_CURSOR_MOVE = 27, /**< 4-pointed arrow. */ +- // fltk provides bitmaps for these: +- FL_CURSOR_NS = 78, /**< up/down arrow. */ +- FL_CURSOR_WE = 79, /**< left/right arrow. */ +- FL_CURSOR_NWSE = 80, /**< diagonal arrow. */ +- FL_CURSOR_NESW = 81, /**< diagonal arrow. */ +- FL_CURSOR_NONE =255, /**< invisible. */ +- // for back compatibility (non MSWindows ones): +- FL_CURSOR_N = 70, /**< for back compatibility. */ +- FL_CURSOR_NE = 69, /**< for back compatibility. */ +- FL_CURSOR_E = 49, /**< for back compatibility. */ +- FL_CURSOR_SE = 8, /**< for back compatibility. */ +- FL_CURSOR_S = 9, /**< for back compatibility. */ +- FL_CURSOR_SW = 7, /**< for back compatibility. */ +- FL_CURSOR_W = 36, /**< for back compatibility. */ +- FL_CURSOR_NW = 68 /**< for back compatibility. */ ++ FL_CURSOR_ARROW = 1, /**< an arrow pointer. */ ++ FL_CURSOR_CROSS = 2, /**< crosshair. */ ++ FL_CURSOR_WAIT = 3, /**< busy indicator (e.g. hourglass). */ ++ FL_CURSOR_INSERT = 4, /**< I-beam. */ ++ FL_CURSOR_HAND = 5, /**< pointing hand. */ ++ FL_CURSOR_HELP = 6, /**< question mark pointer. */ ++ FL_CURSOR_MOVE = 7, /**< 4-pointed arrow or hand. */ ++ ++ /* Resize indicators */ ++ FL_CURSOR_NS = 101, /**< up/down resize. */ ++ FL_CURSOR_WE = 102, /**< left/right resize. */ ++ FL_CURSOR_NWSE = 103, /**< diagonal resize. */ ++ FL_CURSOR_NESW = 104, /**< diagonal resize. */ ++ FL_CURSOR_NE = 110, /**< upwards, right resize. */ ++ FL_CURSOR_N = 111, /**< upwards resize. */ ++ FL_CURSOR_NW = 112, /**< upwards, left resize. */ ++ FL_CURSOR_E = 113, /**< leftwards resize. */ ++ FL_CURSOR_W = 114, /**< rightwards resize. */ ++ FL_CURSOR_SE = 115, /**< downwards, right resize. */ ++ FL_CURSOR_S = 116, /**< downwards resize. */ ++ FL_CURSOR_SW = 117, /**< downwards, left resize. */ ++ ++ FL_CURSOR_NONE = 255, /**< invisible. */ + }; + /*@}*/ // group: Cursors + +diff -up fltk-1.3.2/FL/fl_draw.H.cursor fltk-1.3.2/FL/fl_draw.H +--- fltk-1.3.2/FL/fl_draw.H.cursor 2012-05-08 18:15:34.000000000 +0200 ++++ fltk-1.3.2/FL/fl_draw.H 2013-01-30 16:07:59.530319891 +0100 +@@ -751,7 +751,8 @@ FL_EXPORT const char* fl_shortcut_label( + FL_EXPORT unsigned int fl_old_shortcut(const char* s); + FL_EXPORT void fl_overlay_rect(int x,int y,int w,int h); + FL_EXPORT void fl_overlay_clear(); +-FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg=FL_BLACK, Fl_Color bg=FL_WHITE); ++FL_EXPORT void fl_cursor(Fl_Cursor); ++FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg, Fl_Color bg=FL_WHITE); + FL_EXPORT const char* fl_expand_text(const char* from, char* buf, int maxbuf, + double maxw, int& n, double &width, + int wrap, int draw_symbols = 0); +diff -up fltk-1.3.2/FL/Fl_Window.H.cursor fltk-1.3.2/FL/Fl_Window.H +--- fltk-1.3.2/FL/Fl_Window.H.cursor 2012-11-06 21:46:14.000000000 +0100 ++++ fltk-1.3.2/FL/Fl_Window.H 2013-01-30 16:07:59.531319873 +0100 +@@ -28,6 +28,7 @@ + #define FL_DOUBLE_WINDOW 0xF1 ///< double window type id + + class Fl_X; ++class Fl_RGB_Image; + + /** + This widget produces an actual window. This can either be a main +@@ -81,7 +82,6 @@ class FL_EXPORT Fl_Window : public Fl_Gr + uchar size_range_set; + // cursor stuff + Fl_Cursor cursor_default; +- Fl_Color cursor_fg, cursor_bg; + void size_range_(); + void _Fl_Window(); // constructor innards + void fullscreen_x(); // platform-specific part of sending a window to full screen +@@ -466,14 +466,17 @@ public: + is different. + + The type Fl_Cursor is an enumeration defined in . +- (Under X you can get any XC_cursor value by passing +- Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are +- not implemented on WIN32. + +- For back compatibility only. ++ \see cursor(const Fl_RGB_Image*, int, int), default_cursor() + */ +- void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent +- void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); ++ void cursor(Fl_Cursor); ++ void cursor(const Fl_RGB_Image*, int, int); ++ void default_cursor(Fl_Cursor); ++ ++ /* for legacy compatibility */ ++ void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); ++ void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); ++ + static void default_callback(Fl_Window*, void* v); + + /** Returns the window width including any frame added by the window manager. +diff -up fltk-1.3.2/FL/mac.H.cursor fltk-1.3.2/FL/mac.H +--- fltk-1.3.2/FL/mac.H.cursor 2012-11-13 15:45:42.000000000 +0100 ++++ fltk-1.3.2/FL/mac.H 2013-01-30 16:07:59.531319873 +0100 +@@ -120,7 +120,8 @@ public: + void collapse(void); + WindowRef window_ref(void); + void set_key_window(void); +- void set_cursor(Fl_Cursor); ++ int set_cursor(Fl_Cursor); ++ int set_cursor(const Fl_RGB_Image*, int, int); + static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); + static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel); + static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h); +diff -up fltk-1.3.2/FL/win32.H.cursor fltk-1.3.2/FL/win32.H +--- fltk-1.3.2/FL/win32.H.cursor 2012-03-12 12:55:50.000000000 +0100 ++++ fltk-1.3.2/FL/win32.H 2013-01-30 16:07:59.531319873 +0100 +@@ -73,6 +73,7 @@ public: + int wait_for_expose; + HDC private_dc; // used for OpenGL + HCURSOR cursor; ++ int custom_cursor; + HDC saved_hdc; // saves the handle of the DC currently loaded + // static variables, static functions and member functions + static Fl_X* first; +@@ -83,6 +84,8 @@ public: + void flush() {w->flush();} + void set_minmax(LPMINMAXINFO minmax); + void mapraise(); ++ int set_cursor(Fl_Cursor); ++ int set_cursor(const Fl_RGB_Image*, int, int); + static Fl_X* make(Fl_Window*); + }; + extern FL_EXPORT HCURSOR fl_default_cursor; +diff -up fltk-1.3.2/FL/x.H.cursor fltk-1.3.2/FL/x.H +--- fltk-1.3.2/FL/x.H.cursor 2012-03-23 17:47:53.000000000 +0100 ++++ fltk-1.3.2/FL/x.H 2013-01-30 16:07:59.532319855 +0100 +@@ -154,6 +154,8 @@ public: + static Fl_X* i(const Fl_Window* wi) {return wi->i;} + void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} + void sendxjunk(); ++ int set_cursor(Fl_Cursor); ++ int set_cursor(const Fl_RGB_Image*, int, int); + static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); + static Fl_X* set_xid(Fl_Window*, Window); + // kludges to get around protection: +diff -up fltk-1.3.2/src/CMakeLists.txt.cursor fltk-1.3.2/src/CMakeLists.txt +--- fltk-1.3.2/src/CMakeLists.txt.cursor 2013-01-30 16:09:11.981032475 +0100 ++++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:09:26.497774461 +0100 +@@ -247,6 +247,10 @@ if(HAVE_XFIXES) + target_link_libraries(fltk ${X11_Xfixes_LIB}) + endif(HAVE_XFIXES) + ++if(HAVE_XCURSOR) ++ target_link_libraries(fltk ${X11_Xcursor_LIB}) ++endif(HAVE_XCURSOR) ++ + if(USE_XFT) + target_link_libraries(fltk ${X11_Xft_LIB}) + endif(USE_XFT) +diff -up fltk-1.3.2/src/Fl_cocoa.mm.cursor fltk-1.3.2/src/Fl_cocoa.mm +--- fltk-1.3.2/src/Fl_cocoa.mm.cursor 2013-01-30 16:07:59.522320033 +0100 ++++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-30 16:07:59.533319837 +0100 +@@ -98,7 +98,6 @@ Fl_Display_Device *Fl_Display_Device::_d + CGContextRef fl_gc = 0; + void *fl_system_menu; // this is really a NSMenu* + Fl_Sys_Menu_Bar *fl_sys_menu_bar = 0; +-void *fl_default_cursor; // this is really a NSCursor* + void *fl_capture = 0; // (NSWindow*) we need this to compensate for a missing(?) mouse capture + bool fl_show_iconic; // true if called from iconize() - shows the next created window in collapsed state + //int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR +@@ -1392,8 +1391,6 @@ void fl_open_display() { + dequeue:YES]; + while (ign_event); + +- fl_default_cursor = [NSCursor arrowCursor]; +- + // bring the application into foreground without a 'CARB' resource + Boolean same_psn; + ProcessSerialNumber cur_psn, front_psn; +@@ -1698,6 +1695,7 @@ static void q_set_window_title(NSWindow + - (void)drawRect:(NSRect)rect; + - (BOOL)acceptsFirstResponder; + - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent; ++- (void)resetCursorRects; + - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; + - (void)mouseUp:(NSEvent *)theEvent; + - (void)rightMouseUp:(NSEvent *)theEvent; +@@ -1756,6 +1754,16 @@ static void q_set_window_title(NSWindow + Fl_Window *first = Fl::first_window(); + return (first == w || !first->modal()); + } ++- (void)resetCursorRects { ++ Fl_Window *w = [(FLWindow*)[self window] getFl_Window]; ++ Fl_X *i = Fl_X::i(w); ++ // We have to have at least one cursor rect for invalidateCursorRectsForView ++ // to work, hence the "else" clause. ++ if (i->cursor) ++ [self addCursorRect:[self visibleRect] cursor:(NSCursor*)i->cursor]; ++ else ++ [self addCursorRect:[self visibleRect] cursor:[NSCursor arrowCursor]]; ++} + - (void)mouseUp:(NSEvent *)theEvent { + cocoaMouseHandler(theEvent); + } +@@ -2331,7 +2339,7 @@ void Fl_X::make(Fl_Window* w) + x->other_xid = 0; + x->region = 0; + x->subRegion = 0; +- x->cursor = fl_default_cursor; ++ x->cursor = NULL; + x->gc = 0; // stay 0 for Quickdraw; fill with CGContext for Quartz + Fl_Window *win = w->window(); + Fl_X *xo = Fl_X::i(win); +@@ -2427,7 +2435,7 @@ void Fl_X::make(Fl_Window* w) + x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows + x->region = 0; + x->subRegion = 0; +- x->cursor = fl_default_cursor; ++ x->cursor = NULL; + x->xidChildren = 0; + x->xidNext = 0; + x->gc = 0; +@@ -2974,6 +2982,10 @@ void Fl_X::map() { + Fl_X::relink(w, w->window() ); + w->redraw(); + } ++ if (cursor) { ++ [(NSCursor*)cursor release]; ++ cursor = NULL; ++ } + } + + void Fl_X::unmap() { +@@ -3078,68 +3090,106 @@ static NSImage *CGBitmapContextToNSImage + return [image autorelease]; + } + +-static NSCursor *PrepareCursor(NSCursor *cursor, CGContextRef (*f)() ) ++int Fl_X::set_cursor(Fl_Cursor c) + { +- if (cursor == nil) { +- CGContextRef c = f(); +- NSImage *image = CGBitmapContextToNSImage(c); +- fl_delete_offscreen( (Fl_Offscreen)c ); +- NSPoint pt = {[image size].width/2, [image size].height/2}; +- cursor = [[NSCursor alloc] initWithImage:image hotSpot:pt]; ++ if (cursor) { ++ [(NSCursor*)cursor release]; ++ cursor = NULL; + } +- return cursor; +-} + +-void Fl_X::set_cursor(Fl_Cursor c) +-{ +- NSCursor *icrsr; + switch (c) { +- case FL_CURSOR_CROSS: icrsr = [NSCursor crosshairCursor]; break; +- case FL_CURSOR_WAIT: +- static NSCursor *watch = nil; +- watch = PrepareCursor(watch, &Fl_X::watch_cursor_image); +- icrsr = watch; +- break; +- case FL_CURSOR_INSERT: icrsr = [NSCursor IBeamCursor]; break; +- case FL_CURSOR_N: icrsr = [NSCursor resizeUpCursor]; break; +- case FL_CURSOR_S: icrsr = [NSCursor resizeDownCursor]; break; +- case FL_CURSOR_NS: icrsr = [NSCursor resizeUpDownCursor]; break; +- case FL_CURSOR_HELP: +- static NSCursor *help = nil; +- help = PrepareCursor(help, &Fl_X::help_cursor_image); +- icrsr = help; +- break; +- case FL_CURSOR_HAND: icrsr = [NSCursor pointingHandCursor]; break; +- case FL_CURSOR_MOVE: icrsr = [NSCursor openHandCursor]; break; +- case FL_CURSOR_NE: +- case FL_CURSOR_SW: +- case FL_CURSOR_NESW: +- static NSCursor *nesw = nil; +- nesw = PrepareCursor(nesw, &Fl_X::nesw_cursor_image); +- icrsr = nesw; +- break; +- case FL_CURSOR_E: icrsr = [NSCursor resizeRightCursor]; break; +- case FL_CURSOR_W: icrsr = [NSCursor resizeLeftCursor]; break; +- case FL_CURSOR_WE: icrsr = [NSCursor resizeLeftRightCursor]; break; +- case FL_CURSOR_SE: +- case FL_CURSOR_NW: +- case FL_CURSOR_NWSE: +- static NSCursor *nwse = nil; +- nwse = PrepareCursor(nwse, &Fl_X::nwse_cursor_image); +- icrsr = nwse; +- break; +- case FL_CURSOR_NONE: +- static NSCursor *none = nil; +- none = PrepareCursor(none, &Fl_X::none_cursor_image); +- icrsr = none; +- break; +- case FL_CURSOR_ARROW: +- case FL_CURSOR_DEFAULT: +- default: icrsr = [NSCursor arrowCursor]; +- break; ++ case FL_CURSOR_ARROW: cursor = [NSCursor arrowCursor]; break; ++ case FL_CURSOR_CROSS: cursor = [NSCursor crosshairCursor]; break; ++ case FL_CURSOR_INSERT: cursor = [NSCursor IBeamCursor]; break; ++ case FL_CURSOR_HAND: cursor = [NSCursor pointingHandCursor]; break; ++ case FL_CURSOR_MOVE: cursor = [NSCursor openHandCursor]; break; ++ case FL_CURSOR_NS: cursor = [NSCursor resizeUpDownCursor]; break; ++ case FL_CURSOR_WE: cursor = [NSCursor resizeLeftRightCursor]; break; ++ case FL_CURSOR_N: cursor = [NSCursor resizeUpCursor]; break; ++ case FL_CURSOR_E: cursor = [NSCursor resizeRightCursor]; break; ++ case FL_CURSOR_W: cursor = [NSCursor resizeLeftCursor]; break; ++ case FL_CURSOR_S: cursor = [NSCursor resizeDownCursor]; break; ++ default: ++ return 0; ++ } ++ ++ [(NSCursor*)cursor retain]; ++ ++ [(NSWindow*)xid invalidateCursorRectsForView:[(NSWindow*)xid contentView]]; ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ if (cursor) { ++ [(NSCursor*)cursor release]; ++ cursor = NULL; ++ } ++ ++ if ((hotx < 0) || (hotx >= image->w())) ++ return 0; ++ if ((hoty < 0) || (hoty >= image->h())) ++ return 0; ++ ++ // OS X >= 10.6 can create a NSImage from a CGImage, but we need to ++ // support older versions, hence this pesky handling. ++ ++ NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] ++ initWithBitmapDataPlanes:NULL ++ pixelsWide:image->w() ++ pixelsHigh:image->h() ++ bitsPerSample:8 ++ samplesPerPixel:image->d() ++ hasAlpha:!(image->d() & 1) ++ isPlanar:NO ++ colorSpaceName:(image->d()<=2) ? NSDeviceWhiteColorSpace : NSDeviceRGBColorSpace ++ bytesPerRow:(image->w() * image->d()) ++ bitsPerPixel:(image->d()*8)]; ++ ++ // Alpha needs to be premultiplied for this format ++ ++ const uchar *i = (const uchar*)*image->data(); ++ unsigned char *o = [bitmap bitmapData]; ++ for (int y = 0;y < image->h();y++) { ++ if (image->d() & 1) { ++ for (int x = 0;x < image->w();x++) { ++ unsigned int alpha; ++ if (image->d() == 4) { ++ alpha = i[3]; ++ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); ++ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); ++ } ++ ++ alpha = i[1]; ++ *o++ = (unsigned char)((unsigned int)*i++ * alpha / 255); ++ *o++ = alpha; ++ i++; ++ } ++ } else { ++ // No alpha, so we can just copy everything directly. ++ int len = image->w() * image->d(); ++ memcpy(o, i, len); ++ o += len; ++ i += len; ++ } ++ i += image->ld(); + } +- [icrsr set]; +- cursor = icrsr; ++ ++ NSImage *nsimage = [[NSImage alloc] ++ initWithSize:NSMakeSize(image->w(), image->h())]; ++ ++ [nsimage addRepresentation:bitmap]; ++ ++ cursor = [[NSCursor alloc] ++ initWithImage:nsimage ++ hotSpot:NSMakePoint(hotx, hoty)]; ++ ++ [(NSWindow*)xid invalidateCursorRectsForView:[(NSWindow*)xid contentView]]; ++ ++ [bitmap release]; ++ [nsimage release]; ++ ++ return 1; + } + + @interface FLaboutItemTarget : NSObject +diff -up fltk-1.3.2/src/fl_cursor.cxx.cursor fltk-1.3.2/src/fl_cursor.cxx +--- fltk-1.3.2/src/fl_cursor.cxx.cursor 2012-03-12 12:55:50.000000000 +0100 ++++ fltk-1.3.2/src/fl_cursor.cxx 2013-01-30 16:07:59.534319820 +0100 +@@ -24,297 +24,165 @@ + + #include + #include ++#include ++#include + #include +-#if !defined(WIN32) && !defined(__APPLE__) +-# include +-#endif + #include + ++#include "fl_cursor_wait.xpm" ++#include "fl_cursor_help.xpm" ++#include "fl_cursor_nwse.xpm" ++#include "fl_cursor_nesw.xpm" ++#include "fl_cursor_none.xpm" ++ + /** + Sets the cursor for the current window to the specified shape and colors. + The cursors are defined in the header file. + */ ++void fl_cursor(Fl_Cursor c) { ++ if (Fl::first_window()) Fl::first_window()->cursor(c); ++} ++ ++/* For back compatibility only. */ + void fl_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { +- if (Fl::first_window()) Fl::first_window()->cursor(c,fg,bg); ++ fl_cursor(c); + } ++ ++ + /** +- Sets the default window cursor as well as its color. ++ Sets the default window cursor. This is the cursor that will be used ++ after the mouse pointer leaves a widget with a custom cursor set. + +- For back compatibility only. ++ \see cursor(const Fl_RGB_Image*, int, int), default_cursor() + */ +-void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { +-// if (c == FL_CURSOR_DEFAULT) c = FL_CURSOR_ARROW; +- ++void Fl_Window::default_cursor(Fl_Cursor c) { + cursor_default = c; +- cursor_fg = fg; +- cursor_bg = bg; ++ cursor(c); ++} ++ ++ ++void fallback_cursor(Fl_Window *w, Fl_Cursor c) { ++ const char **xpm; ++ int hotx, hoty; ++ ++ // The standard arrow is our final fallback, so something is broken ++ // if we get called back here with that as an argument. ++ if (c == FL_CURSOR_ARROW) ++ return; ++ ++ switch (c) { ++ case FL_CURSOR_WAIT: ++ xpm = (const char**)fl_cursor_wait_xpm; ++ hotx = 8; ++ hoty = 15; ++ break; ++ case FL_CURSOR_HELP: ++ xpm = (const char**)fl_cursor_help_xpm; ++ hotx = 1; ++ hoty = 3; ++ break; ++ case FL_CURSOR_NWSE: ++ xpm = (const char**)fl_cursor_nwse_xpm; ++ hotx = 7; ++ hoty = 7; ++ break; ++ case FL_CURSOR_NESW: ++ xpm = (const char**)fl_cursor_nesw_xpm; ++ hotx = 7; ++ hoty = 7; ++ break; ++ case FL_CURSOR_NONE: ++ xpm = (const char**)fl_cursor_none_xpm; ++ hotx = 0; ++ hoty = 0; ++ break; ++ default: ++ w->cursor(FL_CURSOR_ARROW); ++ return; ++ } + +- cursor(c, fg, bg); ++ Fl_Pixmap pxm(xpm); ++ Fl_RGB_Image image(&pxm); ++ ++ w->cursor(&image, hotx, hoty); + } + +-#ifdef WIN32 + +-# ifndef IDC_HAND +-# define IDC_HAND MAKEINTRESOURCE(32649) +-# endif // !IDC_HAND ++void Fl_Window::cursor(Fl_Cursor c) { ++ int ret; + +-void Fl_Window::cursor(Fl_Cursor c, Fl_Color c1, Fl_Color c2) { +- if (!shown()) return; + // the cursor must be set for the top level window, not for subwindows + Fl_Window *w = window(), *toplevel = this; +- while (w) { toplevel = w; w = w->window(); } +- if (toplevel != this) { toplevel->cursor(c, c1, c2); return; } +- // now set the actual cursor +- if (c == FL_CURSOR_DEFAULT) { +- c = cursor_default; +- } +- if (c > FL_CURSOR_NESW) { +- i->cursor = 0; +- } else if (c == FL_CURSOR_DEFAULT) { +- i->cursor = fl_default_cursor; +- } else { +- LPSTR n; +- switch (c) { +- case FL_CURSOR_ARROW: n = IDC_ARROW; break; +- case FL_CURSOR_CROSS: n = IDC_CROSS; break; +- case FL_CURSOR_WAIT: n = IDC_WAIT; break; +- case FL_CURSOR_INSERT: n = IDC_IBEAM; break; +- case FL_CURSOR_HELP: n = IDC_HELP; break; +- case FL_CURSOR_HAND: { +- OSVERSIONINFO osvi; +- +- // Get the OS version: Windows 98 and 2000 have a standard +- // hand cursor. +- memset(&osvi, 0, sizeof(OSVERSIONINFO)); +- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); +- GetVersionEx(&osvi); +- +- if (osvi.dwMajorVersion > 4 || +- (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion > 0 && +- osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)) n = IDC_HAND; +- else n = IDC_UPARROW; +- } break; +- case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; +- case FL_CURSOR_N: +- case FL_CURSOR_S: +- case FL_CURSOR_NS: n = IDC_SIZENS; break; +- case FL_CURSOR_NE: +- case FL_CURSOR_SW: +- case FL_CURSOR_NESW: n = IDC_SIZENESW; break; +- case FL_CURSOR_E: +- case FL_CURSOR_W: +- case FL_CURSOR_WE: n = IDC_SIZEWE; break; +- case FL_CURSOR_SE: +- case FL_CURSOR_NW: +- case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; +- default: n = IDC_NO; break; +- } +- i->cursor = LoadCursor(NULL, n); ++ ++ while (w) { ++ toplevel = w; ++ w = w->window(); + } +- SetCursor(i->cursor); +-} + +-#elif defined(__APPLE__) ++ if (toplevel != this) { ++ toplevel->cursor(c); ++ return; ++ } + +-#ifdef __BIG_ENDIAN__ +-# define E(x) x +-#elif defined __LITTLE_ENDIAN__ +-// Don't worry. This will be resolved at compile time +-# define E(x) (x>>8)|((x<<8)&0xff00) +-#else +-# error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined" +-#endif +- +-CGContextRef Fl_X::help_cursor_image(void) +-{ +- int w = 20, h = 20; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- fl_color(FL_BLACK); +- fl_font(FL_COURIER_BOLD, 20); +- fl_draw("?", 1, h-1); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} ++ if (c == FL_CURSOR_DEFAULT) ++ c = cursor_default; + +-CGContextRef Fl_X::none_cursor_image(void) +-{ +- int w = 20, h = 20; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} ++ if (!i) ++ return; + +-CGContextRef Fl_X::watch_cursor_image(void) +-{ +- int w, h, r = 5; +- w = 2*r+6; +- h = 4*r; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- CGContextTranslateCTM( (CGContextRef)off, w/2, h/2); +- fl_color(FL_WHITE); +- fl_circle(0, 0, r+1); +- fl_color(FL_BLACK); +- fl_rectf(int(-r*0.7), int(-r*1.7), int(1.4*r), int(3.4*r)); +- fl_rectf(r-1, -1, 3, 3); +- fl_color(FL_WHITE); +- fl_pie(-r, -r, 2*r, 2*r, 0, 360); +- fl_color(FL_BLACK); +- fl_circle(0,0,r); +- fl_xyline(0, 0, int(-r*.7)); +- fl_xyline(0, 0, 0, int(-r*.7)); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} ++ ret = i->set_cursor(c); ++ if (ret) ++ return; + +-CGContextRef Fl_X::nesw_cursor_image(void) +-{ +- int c = 7, r = 2*c; +- int w = r, h = r; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- CGContextTranslateCTM( (CGContextRef)off, 0, h); +- CGContextScaleCTM( (CGContextRef)off, 1, -1); +- fl_color(FL_BLACK); +- fl_polygon(0, 0, c, 0, 0, c); +- fl_polygon(r, r, r, r-c, r-c, r); +- fl_line_style(FL_SOLID, 2, 0); +- fl_line(0,1, r,r+1); +- fl_line_style(FL_SOLID, 0, 0); +- fl_end_offscreen(); +- return (CGContextRef)off; ++ fallback_cursor(this, c); + } + +-CGContextRef Fl_X::nwse_cursor_image(void) +-{ +- int c = 7, r = 2*c; +- int w = r, h = r; +- Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); +- fl_begin_offscreen(off); +- CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +- fl_rectf(0,0,w,h); +- CGContextTranslateCTM( (CGContextRef)off, 0, h); +- CGContextScaleCTM( (CGContextRef)off, 1, -1); +- fl_color(FL_BLACK); +- fl_polygon(r-1, 0, r-1, c, r-1-c, 0); +- fl_polygon(-1, r, c-1, r, -1, r-c); +- fl_line_style(FL_SOLID, 2, 0); +- fl_line(r-1,1, -1,r+1); +- fl_line_style(FL_SOLID, 0, 0); +- fl_end_offscreen(); +- return (CGContextRef)off; +-} +- +-void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { +- if (c == FL_CURSOR_DEFAULT) { +- c = cursor_default; +- } +- if (i) i->set_cursor(c); +-} ++/** ++ Changes the cursor for this window. This always calls the system, if ++ you are changing the cursor a lot you may want to keep track of how ++ you set it in a static variable and call this only if the new cursor ++ is different. + +-#else ++ The default cursor will be used if the provided image cannot be used ++ as a cursor. + +-// I like the MSWindows resize cursors, so I duplicate them here: ++ \see cursor(Fl_Cursor), default_cursor() ++*/ ++void Fl_Window::cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ int ret; + +-#define CURSORSIZE 16 +-#define HOTXY 7 +-static struct TableEntry { +- uchar bits[CURSORSIZE*CURSORSIZE/8]; +- uchar mask[CURSORSIZE*CURSORSIZE/8]; +- Cursor cursor; +-} table[] = { +- {{ // FL_CURSOR_NS +- 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0x80, 0x01, 0x80, 0x01, +- 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, +- 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00}, +- { +- 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0xc0, 0x03, +- 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xf0, 0x0f, +- 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}}, +- {{ // FL_CURSOR_EW +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, +- 0x0c, 0x30, 0xfe, 0x7f, 0xfe, 0x7f, 0x0c, 0x30, 0x08, 0x10, 0x00, 0x00, +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, +- { +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1c, 0x38, +- 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, +- {{ // FL_CURSOR_NWSE +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x38, 0x00, 0x78, 0x00, +- 0xe8, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x17, 0x00, 0x1e, 0x00, 0x1c, +- 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, +- { +- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x7c, 0x00, 0xfc, 0x00, +- 0xfc, 0x01, 0xec, 0x03, 0xc0, 0x37, 0x80, 0x3f, 0x00, 0x3f, 0x00, 0x3e, +- 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00}}, +- {{ // FL_CURSOR_NESW +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x1c, 0x00, 0x1e, +- 0x00, 0x17, 0x80, 0x03, 0xc0, 0x01, 0xe8, 0x00, 0x78, 0x00, 0x38, 0x00, +- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, +- { +- 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3f, +- 0x80, 0x3f, 0xc0, 0x37, 0xec, 0x03, 0xfc, 0x01, 0xfc, 0x00, 0x7c, 0x00, +- 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00}}, +- {{0}, {0}} // FL_CURSOR_NONE & unknown +-}; ++ // the cursor must be set for the top level window, not for subwindows ++ Fl_Window *w = window(), *toplevel = this; + +-void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { +- if (!shown()) return; +- Cursor xc; +- int deleteit = 0; +- if (c == FL_CURSOR_DEFAULT) { +- c = cursor_default; +- fg = cursor_fg; +- bg = cursor_bg; ++ while (w) { ++ toplevel = w; ++ w = w->window(); + } + +- if (!c) { +- xc = None; +- } else { +- if (c >= FL_CURSOR_NS) { +- TableEntry *q = (c > FL_CURSOR_NESW) ? table+4 : table+(c-FL_CURSOR_NS); +- if (!(q->cursor)) { +- XColor dummy = { 0 }; +- Pixmap p = XCreateBitmapFromData(fl_display, +- RootWindow(fl_display, fl_screen), (const char*)(q->bits), +- CURSORSIZE, CURSORSIZE); +- Pixmap m = XCreateBitmapFromData(fl_display, +- RootWindow(fl_display, fl_screen), (const char*)(q->mask), +- CURSORSIZE, CURSORSIZE); +- q->cursor = XCreatePixmapCursor(fl_display, p,m,&dummy, &dummy, +- HOTXY, HOTXY); +- XFreePixmap(fl_display, m); +- XFreePixmap(fl_display, p); +- } +- xc = q->cursor; +- } else { +- xc = XCreateFontCursor(fl_display, (c-1)*2); +- deleteit = 1; +- } +- XColor fgc; +- uchar r,g,b; +- Fl::get_color(fg,r,g,b); +- fgc.red = r<<8; fgc.green = g<<8; fgc.blue = b<<8; +- XColor bgc; +- Fl::get_color(bg,r,g,b); +- bgc.red = r<<8; bgc.green = g<<8; bgc.blue = b<<8; +- XRecolorCursor(fl_display, xc, &fgc, &bgc); ++ if (toplevel != this) { ++ toplevel->cursor(image, hotx, hoty); ++ return; + } +- XDefineCursor(fl_display, fl_xid(this), xc); +- if (deleteit) XFreeCursor(fl_display, xc); ++ ++ if (!i) ++ return; ++ ++ ret = i->set_cursor(image, hotx, hoty); ++ if (ret) ++ return; ++ ++ cursor(FL_CURSOR_DEFAULT); + } + +-#endif ++/* For back compatibility only. */ ++void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { ++ cursor(c); ++}; ++ ++void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color, Fl_Color) { ++ default_cursor(c); ++}; ++ + + // + // End of "$Id: fl_cursor.cxx 9278 2012-03-12 11:55:50Z manolo $". +diff -up fltk-1.3.2/src/fl_cursor_help.xpm.cursor fltk-1.3.2/src/fl_cursor_help.xpm +--- fltk-1.3.2/src/fl_cursor_help.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_help.xpm 2013-01-30 16:07:59.534319820 +0100 +@@ -0,0 +1,95 @@ ++/* XPM */ ++static const char * fl_cursor_help_xpm[] = { ++"16 27 65 1", ++" c None", ++". c #FFFFFF", ++"+ c #E2E2E2", ++"@ c #1C1C1C", ++"# c #E7E7E7", ++"$ c #000000", ++"% c #212121", ++"& c #EAEAEA", ++"* c #262626", ++"= c #EDEDED", ++"- c #2C2C2C", ++"; c #F0F0F0", ++"> c #333333", ++", c #F1F1F1", ++"' c #393939", ++") c #F3F3F3", ++"! c #404040", ++"~ c #484848", ++"{ c #F4F4F4", ++"] c #050505", ++"^ c #202020", ++"/ c #707070", ++"( c #F5F5F5", ++"_ c #040404", ++": c #E1E1E1", ++"< c #EEEEEE", ++"[ c #EFEFEF", ++"} c #FEFEFE", ++"| c #3D3D3D", ++"1 c #7E7E7E", ++"2 c #696969", ++"3 c #414141", ++"4 c #131313", ++"5 c #080808", ++"6 c #454545", ++"7 c #F2F2F2", ++"8 c #878787", ++"9 c #7D7D7D", ++"0 c #101010", ++"a c #111111", ++"b c #FDFDFD", ++"c c #8A8A8A", ++"d c #E6E6E6", ++"e c #7B7B7B", ++"f c #4C4C4C", ++"g c #5C5C5C", ++"h c #9F9F9F", ++"i c #F9F9F9", ++"j c #F7F7F7", ++"k c #B1B1B1", ++"l c #2E2E2E", ++"m c #767676", ++"n c #DCDCDC", ++"o c #DEDEDE", ++"p c #C7C7C7", ++"q c #1B1B1B", ++"r c #6B6B6B", ++"s c #575757", ++"t c #797979", ++"u c #020202", ++"v c #010101", ++"w c #FBFBFB", ++"x c #D7D7D7", ++"y c #D8D8D8", ++"z c #060606", ++" ", ++". ", ++".+ ", ++".@# ", ++".$%& ", ++".$$*= ", ++".$$$-; ", ++".$$$$>, ", ++".$$$$$') ", ++".$$$$$$!) ", ++".$$$$$$$~{ ", ++".$$$$]^^^/( ", ++".$$$$_:(<<[} ", ++".$$|1$2< ", ++".$3,(45[ ", ++".67 78$9, ", ++".7 {0a( .... ", ++"b ,c5[defgh, ", ++" )ijk_la$m.", ++" no.p$q.", ++" .r$s.", ++" .t$-= ", ++" 7uv+ ", ++" wxy. ", ++" :$z. ", ++" :$z. ", ++" .... "}; +diff -up fltk-1.3.2/src/fl_cursor_nesw.xpm.cursor fltk-1.3.2/src/fl_cursor_nesw.xpm +--- fltk-1.3.2/src/fl_cursor_nesw.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_nesw.xpm 2013-01-30 16:07:59.534319820 +0100 +@@ -0,0 +1,46 @@ ++/* XPM */ ++static const char * fl_cursor_nesw_xpm[] = { ++"15 15 28 1", ++" c None", ++". c #FFFFFF", ++"+ c #767676", ++"@ c #000000", ++"# c #4E4E4E", ++"$ c #0C0C0C", ++"% c #494949", ++"& c #4D4D4D", ++"* c #1B1B1B", ++"= c #515151", ++"- c #646464", ++"; c #363636", ++"> c #6A6A6A", ++", c #545454", ++"' c #585858", ++") c #242424", ++"! c #797979", ++"~ c #2E2E2E", ++"{ c #444444", ++"] c #3B3B3B", ++"^ c #0A0A0A", ++"/ c #595959", ++"( c #F7F7F7", ++"_ c #080808", ++": c #6B6B6B", ++"< c #FDFDFD", ++"[ c #FCFCFC", ++"} c #FEFEFE", ++" ..........", ++" .+@@@@@@.", ++" .#@@@@@.", ++" .$@@@@.", ++" .%@@@@@.", ++". .&@@@*@@.", ++".. .=@@@-.;@.", ++".>. .,@@@'. .).", ++".@!.'@@@#. ..", ++".@@~@@@{. .", ++".@@@@@]. ", ++".@@@@^. ", ++".@@@@@/( ", ++".______:( ", ++"<[[[[[[[[} "}; +diff -up fltk-1.3.2/src/fl_cursor_none.xpm.cursor fltk-1.3.2/src/fl_cursor_none.xpm +--- fltk-1.3.2/src/fl_cursor_none.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_none.xpm 2013-01-30 16:07:59.534319820 +0100 +@@ -0,0 +1,19 @@ ++/* XPM */ ++static const char * fl_cursor_none_xpm[] = { ++"15 15 1 1", ++" c None", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" ", ++" "}; +diff -up fltk-1.3.2/src/fl_cursor_nwse.xpm.cursor fltk-1.3.2/src/fl_cursor_nwse.xpm +--- fltk-1.3.2/src/fl_cursor_nwse.xpm.cursor 2013-01-30 16:07:59.534319820 +0100 ++++ fltk-1.3.2/src/fl_cursor_nwse.xpm 2013-01-30 16:07:59.535319802 +0100 +@@ -0,0 +1,46 @@ ++/* XPM */ ++static const char * fl_cursor_nwse_xpm[] = { ++"15 15 28 1", ++" c None", ++". c #FFFFFF", ++"+ c #000000", ++"@ c #767676", ++"# c #4E4E4E", ++"$ c #0C0C0C", ++"% c #494949", ++"& c #1B1B1B", ++"* c #4D4D4D", ++"= c #363636", ++"- c #646464", ++"; c #515151", ++"> c #242424", ++", c #585858", ++"' c #545454", ++") c #6A6A6A", ++"! c #797979", ++"~ c #444444", ++"{ c #2E2E2E", ++"] c #3B3B3B", ++"^ c #0A0A0A", ++"/ c #F7F7F7", ++"( c #595959", ++"_ c #6B6B6B", ++": c #080808", ++"< c #FEFEFE", ++"[ c #FCFCFC", ++"} c #FDFDFD", ++".......... ", ++".++++++@. ", ++".+++++#. ", ++".++++$. ", ++".+++++%. ", ++".++&+++*. .", ++".+=.-+++;. ..", ++".>. .,+++'. .).", ++".. .#+++,.!+.", ++". .~+++{++.", ++" .]+++++.", ++" .^++++.", ++" /(+++++.", ++" /_::::::.", ++" <[[[[[[[[}"}; +diff -up fltk-1.3.2/src/fl_cursor_wait.xpm.cursor fltk-1.3.2/src/fl_cursor_wait.xpm +--- fltk-1.3.2/src/fl_cursor_wait.xpm.cursor 2013-01-30 16:07:59.535319802 +0100 ++++ fltk-1.3.2/src/fl_cursor_wait.xpm 2013-01-30 16:07:59.535319802 +0100 +@@ -0,0 +1,72 @@ ++/* XPM */ ++static const char * fl_cursor_wait_xpm[] = { ++"17 32 37 1", ++" c None", ++". c #FFFFFF", ++"+ c #2E2E2E", ++"@ c #202020", ++"# c #F1F1F1", ++"$ c #2D2D2D", ++"% c #000000", ++"& c #EDEDED", ++"* c #585858", ++"= c #575757", ++"- c #FBFBFB", ++"; c #848484", ++"> c #B8B8B8", ++", c #E5E5E5", ++"' c #F7F7F7", ++") c #181818", ++"! c #F0F0F0", ++"~ c #616161", ++"{ c #B7B7B7", ++"] c #F5F5F5", ++"^ c #050505", ++"/ c #D4D4D4", ++"( c #EEEEEE", ++"_ c #595959", ++": c #7B7B7B", ++"< c #E9E9E9", ++"[ c #131313", ++"} c #E3E3E3", ++"| c #767676", ++"1 c #505050", ++"2 c #F3F3F3", ++"3 c #2A2A2A", ++"4 c #070707", ++"5 c #343434", ++"6 c #939393", ++"7 c #191919", ++"8 c #6A6A6A", ++".................", ++".+@@@@@@@@@@@@@+.", ++".................", ++" #$%%%%%%%%%%%$# ", ++" &*%%%%%%%%%%%=& ", ++" -;%%%%%%%%%%%;- ", ++" >%%%%%%%%%%%> ", ++" ,%%%%%%%%%%%, ", ++" ')%%%%%%%%%)' ", ++" !~%%%%%%%%%~! ", ++" {%%%%%%%%%{ ", ++" ]^/...../^] ", ++" (_:.....:_( ", ++" <[}...}[< ", ++" !|1...1|! ", ++" 2[3.3[2 ", ++" 2[%.%[2 ", ++" !|%%.%%|! ", ++" <4%%.%%4< ", ++" (_%%%.%%%_( ", ++" ]^%%%.%%%^] ", ++" {%%%%.%%%%{ ", ++" !~%%%%.%%%%~! ", ++" ')%%%%.%%%%)' ", ++" ,%%56{.{65%%, ", ++" >%*.......*%> ", ++" -;7&.......&7;- ", ++" &*8.........8=& ", ++" #$%%%%%%%%%%%$# ", ++".................", ++".+@@@@@@@@@@@@@+.", ++"................."}; +diff -up fltk-1.3.2/src/Fl_win32.cxx.cursor fltk-1.3.2/src/Fl_win32.cxx +--- fltk-1.3.2/src/Fl_win32.cxx.cursor 2013-01-30 16:07:59.519320086 +0100 ++++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-30 16:07:59.536319784 +0100 +@@ -1633,7 +1633,6 @@ void fl_fix_focus(); // in Fl.cxx + + char fl_show_iconic; // hack for Fl_Window::iconic() + // int fl_background_pixel = -1; // color to use for background +-HCURSOR fl_default_cursor; + UINT fl_wake_msg = 0; + int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR + +@@ -1682,7 +1681,7 @@ Fl_X* Fl_X::make(Fl_Window* w) { + if (!w->icon()) + w->icon((void *)LoadIcon(NULL, IDI_APPLICATION)); + wcw.hIcon = wcw.hIconSm = (HICON)w->icon(); +- wcw.hCursor = fl_default_cursor = LoadCursor(NULL, IDC_ARROW); ++ wcw.hCursor = LoadCursor(NULL, IDC_ARROW); + //uchar r,g,b; Fl::get_color(FL_GRAY,r,g,b); + //wc.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(r,g,b)); + wcw.hbrBackground = NULL; +@@ -1774,7 +1773,8 @@ Fl_X* Fl_X::make(Fl_Window* w) { + x->setwindow(w); + x->region = 0; + x->private_dc = 0; +- x->cursor = fl_default_cursor; ++ x->cursor = LoadCursor(NULL, IDC_ARROW); ++ x->custom_cursor = 0; + if (!fl_codepage) fl_get_codepage(); + + WCHAR *lab = NULL; +@@ -2025,6 +2025,153 @@ void Fl_Window::label(const char *name,c + } + + //////////////////////////////////////////////////////////////// ++ ++#ifndef IDC_HAND ++# define IDC_HAND MAKEINTRESOURCE(32649) ++#endif // !IDC_HAND ++ ++int Fl_X::set_cursor(Fl_Cursor c) { ++ LPSTR n; ++ HCURSOR new_cursor; ++ ++ if (c == FL_CURSOR_NONE) ++ new_cursor = NULL; ++ else { ++ switch (c) { ++ case FL_CURSOR_ARROW: n = IDC_ARROW; break; ++ case FL_CURSOR_CROSS: n = IDC_CROSS; break; ++ case FL_CURSOR_WAIT: n = IDC_WAIT; break; ++ case FL_CURSOR_INSERT: n = IDC_IBEAM; break; ++ case FL_CURSOR_HAND: n = IDC_HAND; break; ++ case FL_CURSOR_HELP: n = IDC_HELP; break; ++ case FL_CURSOR_MOVE: n = IDC_SIZEALL; break; ++ case FL_CURSOR_N: ++ case FL_CURSOR_S: ++ // FIXME: Should probably have fallbacks for these instead ++ case FL_CURSOR_NS: n = IDC_SIZENS; break; ++ case FL_CURSOR_NE: ++ case FL_CURSOR_SW: ++ // FIXME: Dito. ++ case FL_CURSOR_NESW: n = IDC_SIZENESW; break; ++ case FL_CURSOR_E: ++ case FL_CURSOR_W: ++ // FIXME: Dito. ++ case FL_CURSOR_WE: n = IDC_SIZEWE; break; ++ case FL_CURSOR_SE: ++ case FL_CURSOR_NW: ++ // FIXME: Dito. ++ case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break; ++ default: ++ return 0; ++ } ++ ++ new_cursor = LoadCursor(NULL, n); ++ if (new_cursor == NULL) ++ return 0; ++ } ++ ++ if ((cursor != NULL) && custom_cursor) ++ DestroyIcon(cursor); ++ ++ cursor = new_cursor; ++ custom_cursor = 0; ++ ++ SetCursor(cursor); ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++ BITMAPV5HEADER bi; ++ HBITMAP bitmap, mask; ++ DWORD *bits; ++ HCURSOR new_cursor; ++ ++ if ((hotx < 0) || (hotx >= image->w())) ++ return 0; ++ if ((hoty < 0) || (hoty >= image->h())) ++ return 0; ++ ++ memset(&bi, 0, sizeof(BITMAPV5HEADER)); ++ ++ bi.bV5Size = sizeof(BITMAPV5HEADER); ++ bi.bV5Width = image->w(); ++ bi.bV5Height = -image->h(); // Negative for top-down ++ bi.bV5Planes = 1; ++ bi.bV5BitCount = 32; ++ bi.bV5Compression = BI_BITFIELDS; ++ bi.bV5RedMask = 0x00FF0000; ++ bi.bV5GreenMask = 0x0000FF00; ++ bi.bV5BlueMask = 0x000000FF; ++ bi.bV5AlphaMask = 0xFF000000; ++ ++ HDC hdc; ++ ++ hdc = GetDC(NULL); ++ bitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); ++ ReleaseDC(NULL, hdc); ++ ++ if (bits == NULL) ++ return 0; ++ ++ const uchar *i = (const uchar*)*image->data(); ++ for (int y = 0;y < image->h();y++) { ++ for (int x = 0;x < image->w();x++) { ++ switch (image->d()) { ++ case 1: ++ *bits = (0xff<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 2: ++ *bits = (i[1]<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 3: ++ *bits = (0xff<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ case 4: ++ *bits = (i[3]<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ } ++ i += image->d(); ++ bits++; ++ } ++ i += image->ld(); ++ } ++ ++ // A mask bitmap is still needed even though it isn't used ++ mask = CreateBitmap(image->w(),image->h(),1,1,NULL); ++ if (mask == NULL) { ++ DeleteObject(bitmap); ++ return 0; ++ } ++ ++ ICONINFO ii; ++ ++ ii.fIcon = FALSE; ++ ii.xHotspot = hotx; ++ ii.yHotspot = hoty; ++ ii.hbmMask = mask; ++ ii.hbmColor = bitmap; ++ ++ new_cursor = CreateIconIndirect(&ii); ++ ++ DeleteObject(bitmap); ++ DeleteObject(mask); ++ ++ if (new_cursor == NULL) ++ return 0; ++ ++ if ((cursor != NULL) && custom_cursor) ++ DestroyIcon(cursor); ++ ++ cursor = new_cursor; ++ custom_cursor = 1; ++ ++ SetCursor(cursor); ++ ++ return 1; ++} ++ ++//////////////////////////////////////////////////////////////// + // Implement the virtual functions for the base Fl_Window class: + + // If the box is a filled rectangle, we can make the redisplay *look* +diff -up fltk-1.3.2/src/Fl_Window.cxx.cursor fltk-1.3.2/src/Fl_Window.cxx +--- fltk-1.3.2/src/Fl_Window.cxx.cursor 2012-11-06 21:46:14.000000000 +0100 ++++ fltk-1.3.2/src/Fl_Window.cxx 2013-01-30 16:07:59.536319784 +0100 +@@ -62,8 +62,6 @@ void Fl_Window::_Fl_Window() { + Fl_Window::Fl_Window(int X,int Y,int W, int H, const char *l) + : Fl_Group(X, Y, W, H, l) { + cursor_default = FL_CURSOR_DEFAULT; +- cursor_fg = FL_BLACK; +- cursor_bg = FL_WHITE; + + _Fl_Window(); + set_flag(FORCE_POSITION); +@@ -73,8 +71,6 @@ Fl_Window::Fl_Window(int W, int H, const + // fix common user error of a missing end() with current(0): + : Fl_Group((Fl_Group::current(0),0), 0, W, H, l) { + cursor_default = FL_CURSOR_DEFAULT; +- cursor_fg = FL_BLACK; +- cursor_bg = FL_WHITE; + + _Fl_Window(); + clear_visible(); +diff -up fltk-1.3.2/src/Fl_x.cxx.cursor fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2/src/Fl_x.cxx.cursor 2013-01-30 16:07:59.512320211 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:07:59.537319766 +0100 +@@ -59,6 +59,11 @@ static int xfixes_event_base = 0; + static bool have_xfixes = false; + # endif + ++# include ++ ++# if HAVE_XCURSOR ++# include ++# endif + static Fl_Xlib_Graphics_Driver fl_xlib_driver; + static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display +@@ -2259,6 +2264,94 @@ void Fl_Window::size_range_() { + } + + //////////////////////////////////////////////////////////////// ++ ++int Fl_X::set_cursor(Fl_Cursor c) { ++ unsigned int shape; ++ Cursor xc; ++ ++ switch (c) { ++ case FL_CURSOR_ARROW: shape = XC_left_ptr; break; ++ case FL_CURSOR_CROSS: shape = XC_tcross; break; ++ case FL_CURSOR_WAIT: shape = XC_watch; break; ++ case FL_CURSOR_INSERT: shape = XC_xterm; break; ++ case FL_CURSOR_HAND: shape = XC_hand2; break; ++ case FL_CURSOR_HELP: shape = XC_question_arrow; break; ++ case FL_CURSOR_MOVE: shape = XC_fleur; break; ++ case FL_CURSOR_NS: shape = XC_sb_v_double_arrow; break; ++ case FL_CURSOR_WE: shape = XC_sb_h_double_arrow; break; ++ case FL_CURSOR_NE: shape = XC_top_right_corner; break; ++ case FL_CURSOR_N: shape = XC_top_side; break; ++ case FL_CURSOR_NW: shape = XC_top_left_corner; break; ++ case FL_CURSOR_E: shape = XC_right_side; break; ++ case FL_CURSOR_W: shape = XC_left_side; break; ++ case FL_CURSOR_SE: shape = XC_bottom_right_corner; break; ++ case FL_CURSOR_S: shape = XC_bottom_side; break; ++ case FL_CURSOR_SW: shape = XC_bottom_left_corner; break; ++ default: ++ return 0; ++ } ++ ++ xc = XCreateFontCursor(fl_display, shape); ++ XDefineCursor(fl_display, xid, xc); ++ XFreeCursor(fl_display, xc); ++ ++ return 1; ++} ++ ++int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { ++#if ! HAVE_XCURSOR ++ return 0; ++#else ++ XcursorImage *cursor; ++ Cursor xc; ++ ++ if ((hotx < 0) || (hotx >= image->w())) ++ return 0; ++ if ((hoty < 0) || (hoty >= image->h())) ++ return 0; ++ ++ cursor = XcursorImageCreate(image->w(), image->h()); ++ if (!cursor) ++ return 0; ++ ++ const uchar *i = (const uchar*)*image->data(); ++ XcursorPixel *o = cursor->pixels; ++ for (int y = 0;y < image->h();y++) { ++ for (int x = 0;x < image->w();x++) { ++ switch (image->d()) { ++ case 1: ++ *o = (0xff<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 2: ++ *o = (i[1]<<24) | (i[0]<<16) | (i[0]<<8) | i[0]; ++ break; ++ case 3: ++ *o = (0xff<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ case 4: ++ *o = (i[3]<<24) | (i[0]<<16) | (i[1]<<8) | i[2]; ++ break; ++ } ++ i += image->d(); ++ o++; ++ } ++ i += image->ld(); ++ } ++ ++ cursor->xhot = hotx; ++ cursor->yhot = hoty; ++ ++ xc = XcursorImageLoadCursor(fl_display, cursor); ++ XDefineCursor(fl_display, xid, xc); ++ XFreeCursor(fl_display, xc); ++ ++ XcursorImageDestroy(cursor); ++ ++ return 1; ++#endif ++} ++ ++//////////////////////////////////////////////////////////////// + + // returns pointer to the filename, or null if name ends with '/' + const char *fl_filename_name(const char *name) { +diff -up fltk-1.3.2/test/cursor.cxx.cursor fltk-1.3.2/test/cursor.cxx +--- fltk-1.3.2/test/cursor.cxx.cursor 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/test/cursor.cxx 2013-01-30 16:07:59.537319766 +0100 +@@ -23,8 +23,6 @@ + #include + #include + +-Fl_Color fg = FL_BLACK; +-Fl_Color bg = FL_WHITE; + Fl_Cursor cursor = FL_CURSOR_DEFAULT; + + Fl_Hor_Value_Slider *cursor_slider; +@@ -32,7 +30,7 @@ Fl_Hor_Value_Slider *cursor_slider; + void choice_cb(Fl_Widget *, void *v) { + cursor = (Fl_Cursor)(fl_intptr_t)v; + cursor_slider->value(cursor); +- fl_cursor(cursor,fg,bg); ++ fl_cursor(cursor); + } + + Fl_Menu_Item choices[] = { +@@ -48,8 +46,6 @@ Fl_Menu_Item choices[] = { + {"FL_CURSOR_WE",0,choice_cb,(void*)FL_CURSOR_WE}, + {"FL_CURSOR_NWSE",0,choice_cb,(void*)FL_CURSOR_NWSE}, + {"FL_CURSOR_NESW",0,choice_cb,(void*)FL_CURSOR_NESW}, +- {"FL_CURSOR_NONE",0,choice_cb,(void*)FL_CURSOR_NONE}, +-#if 0 + {"FL_CURSOR_N",0,choice_cb,(void*)FL_CURSOR_N}, + {"FL_CURSOR_NE",0,choice_cb,(void*)FL_CURSOR_NE}, + {"FL_CURSOR_E",0,choice_cb,(void*)FL_CURSOR_E}, +@@ -58,26 +54,14 @@ Fl_Menu_Item choices[] = { + {"FL_CURSOR_SW",0,choice_cb,(void*)FL_CURSOR_SW}, + {"FL_CURSOR_W",0,choice_cb,(void*)FL_CURSOR_W}, + {"FL_CURSOR_NW",0,choice_cb,(void*)FL_CURSOR_NW}, +-#endif ++ {"FL_CURSOR_NONE",0,choice_cb,(void*)FL_CURSOR_NONE}, + {0} + }; + + void setcursor(Fl_Widget *o, void *) { + Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; + cursor = Fl_Cursor((int)slider->value()); +- fl_cursor(cursor,fg,bg); +-} +- +-void setfg(Fl_Widget *o, void *) { +- Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; +- fg = Fl_Color((int)slider->value()); +- fl_cursor(cursor,fg,bg); +-} +- +-void setbg(Fl_Widget *o, void *) { +- Fl_Hor_Value_Slider *slider = (Fl_Hor_Value_Slider *)o; +- bg = Fl_Color((int)slider->value()); +- fl_cursor(cursor,fg,bg); ++ fl_cursor(cursor); + } + + // draw the label without any ^C or \nnn conversions: +@@ -103,29 +87,11 @@ int main(int argc, char **argv) { + slider1.align(FL_ALIGN_LEFT); + slider1.step(1); + slider1.precision(0); +- slider1.bounds(0,100); ++ slider1.bounds(0,255); + slider1.value(0); + slider1.callback(setcursor); + slider1.value(cursor); + +- Fl_Hor_Value_Slider slider2(80,220,310,30,"fgcolor:"); +- slider2.align(FL_ALIGN_LEFT); +- slider2.step(1); +- slider2.precision(0); +- slider2.bounds(0,255); +- slider2.value(0); +- slider2.callback(setfg); +- slider2.value(fg); +- +- Fl_Hor_Value_Slider slider3(80,260,310,30,"bgcolor:"); +- slider3.align(FL_ALIGN_LEFT); +- slider3.step(1); +- slider3.precision(0); +- slider3.bounds(0,255); +- slider3.value(0); +- slider3.callback(setbg); +- slider3.value(bg); +- + #if 0 + // draw the manual's diagram of cursors... + window.size(400,800); diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch new file mode 100644 index 00000000..9e253a3f --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-clipboard-x11.patch @@ -0,0 +1,355 @@ +diff -up fltk-1.3.2/CMakeLists.txt.clp-x11 fltk-1.3.2/CMakeLists.txt +--- fltk-1.3.2/CMakeLists.txt.clp-x11 2012-09-13 16:19:01.000000000 +0200 ++++ fltk-1.3.2/CMakeLists.txt 2013-01-30 15:56:25.810663430 +0100 +@@ -515,6 +515,20 @@ else() + endif(OPTION_USE_XINERAMA) + + ####################################################################### ++if(X11_Xfixes_FOUND) ++ option(OPTION_USE_XFIXES "use lib XFIXES" ON) ++endif(X11_Xfixes_FOUND) ++ ++if(OPTION_USE_XFIXES) ++ set(HAVE_XFIXES ${X11_Xfixes_FOUND}) ++ include_directories(${X11_Xfixes_INCLUDE_PATH}) ++ list(APPEND FLTK_LDLIBS -lXfixes) ++ set(FLTK_XFIXES_FOUND TRUE) ++else() ++ set(FLTK_XFIXES_FOUND FALSE) ++endif(OPTION_USE_XFIXES) ++ ++####################################################################### + if(X11_Xft_FOUND) + option(OPTION_USE_XFT "use lib Xft" ON) + endif(X11_Xft_FOUND) +diff -up fltk-1.3.2/configh.cmake.in.clp-x11 fltk-1.3.2/configh.cmake.in +--- fltk-1.3.2/configh.cmake.in.clp-x11 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/configh.cmake.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#cmakedefine01 HAVE_XFIXES ++ ++/* + * __APPLE_QUARTZ__: + * + * If __APPLE_QUARTZ__ is defined, FLTK will be +diff -up fltk-1.3.2/configh.in.clp-x11 fltk-1.3.2/configh.in +--- fltk-1.3.2/configh.in.clp-x11 2011-10-04 11:21:47.000000000 +0200 ++++ fltk-1.3.2/configh.in 2013-01-30 15:56:25.810663430 +0100 +@@ -108,6 +108,14 @@ + #define USE_XDBE HAVE_XDBE + + /* ++ * HAVE_XFIXES: ++ * ++ * Do we have the X fixes extension? ++ */ ++ ++#define HAVE_XFIXES 0 ++ ++/* + * __APPLE_QUARTZ__: + * + * All Apple implementations are now based on Quartz and Cocoa, +diff -up fltk-1.3.2/configure.in.clp-x11 fltk-1.3.2/configure.in +--- fltk-1.3.2/configure.in.clp-x11 2013-01-30 15:56:25.802663573 +0100 ++++ fltk-1.3.2/configure.in 2013-01-30 15:56:25.810663430 +0100 +@@ -999,6 +999,16 @@ case $uname_GUI in + LIBS="-lXext $LIBS") + fi + ++ dnl Check for the Xfixes extension unless disabled... ++ AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]]) ++ ++ if test x$enable_xfixes != xno; then ++ AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),, ++ [#include ]) ++ AC_CHECK_LIB(Xfixes, XFixesQueryExtension, ++ LIBS="-lXfixes $LIBS") ++ fi ++ + dnl Check for overlay visuals... + AC_PATH_PROG(XPROP, xprop) + AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, +diff -up fltk-1.3.2/fluid/CMakeLists.txt.clp-x11 fltk-1.3.2/fluid/CMakeLists.txt +diff -up fltk-1.3.2/src/CMakeLists.txt.clp-x11 fltk-1.3.2/src/CMakeLists.txt +--- fltk-1.3.2/src/CMakeLists.txt.clp-x11 2013-01-30 16:06:00.785430590 +0100 ++++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:06:17.883126642 +0100 +@@ -243,6 +243,10 @@ if(HAVE_XINERAMA) + target_link_libraries(fltk ${X11_Xinerama_LIB}) + endif(HAVE_XINERAMA) + ++if(HAVE_XFIXES) ++ target_link_libraries(fltk ${X11_Xfixes_LIB}) ++endif(HAVE_XFIXES) ++ + if(USE_XFT) + target_link_libraries(fltk ${X11_Xft_LIB}) + endif(USE_XFT) +diff -up fltk-1.3.2/src/Fl_x.cxx.clp-x11 fltk-1.3.2/src/Fl_x.cxx +--- fltk-1.3.2/src/Fl_x.cxx.clp-x11 2013-01-30 15:56:25.793663733 +0100 ++++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:03:37.355981103 +0100 +@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp + static int randrEventBase; // base of RandR-defined events + #endif + ++# if HAVE_XFIXES ++# include ++static int xfixes_event_base = 0; ++static bool have_xfixes = false; ++# endif ++ + static Fl_Xlib_Graphics_Driver fl_xlib_driver; + static Fl_Display_Device fl_xlib_display(&fl_xlib_driver); + Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display +@@ -307,6 +313,9 @@ static Atom WM_PROTOCOLS; + static Atom fl_MOTIF_WM_HINTS; + static Atom TARGETS; + static Atom CLIPBOARD; ++static Atom TIMESTAMP; ++static Atom PRIMARY_TIMESTAMP; ++static Atom CLIPBOARD_TIMESTAMP; + Atom fl_XdndAware; + Atom fl_XdndSelection; + Atom fl_XdndEnter; +@@ -667,6 +676,9 @@ void fl_open_display(Display* d) { + fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0); + TARGETS = XInternAtom(d, "TARGETS", 0); + CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0); ++ TIMESTAMP = XInternAtom(d, "TIMESTAMP", 0); ++ PRIMARY_TIMESTAMP = XInternAtom(d, "PRIMARY_TIMESTAMP", 0); ++ CLIPBOARD_TIMESTAMP = XInternAtom(d, "CLIPBOARD_TIMESTAMP", 0); + fl_XdndAware = XInternAtom(d, "XdndAware", 0); + fl_XdndSelection = XInternAtom(d, "XdndSelection", 0); + fl_XdndEnter = XInternAtom(d, "XdndEnter", 0); +@@ -713,6 +725,15 @@ void fl_open_display(Display* d) { + #if !USE_COLORMAP + Fl::visual(FL_RGB); + #endif ++ ++#if HAVE_XFIXES ++ int error_base; ++ if (XFixesQueryExtension(fl_display, &xfixes_event_base, &error_base)) ++ have_xfixes = true; ++ else ++ have_xfixes = false; ++#endif ++ + #if USE_XRANDR + void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY); + if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY); +@@ -901,6 +922,107 @@ void Fl::copy(const char *stuff, int len + } + + //////////////////////////////////////////////////////////////// ++// Code for tracking clipboard changes: ++ ++static Time primary_timestamp = -1; ++static Time clipboard_timestamp = -1; ++ ++extern bool fl_clipboard_notify_empty(void); ++extern void fl_trigger_clipboard_notify(int source); ++ ++static void poll_clipboard_owner(void) { ++ Window xid; ++ ++#if HAVE_XFIXES ++ // No polling needed with Xfixes ++ if (have_xfixes) ++ return; ++#endif ++ ++ // No one is interested, so no point polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ // We need a window for this to work ++ if (!Fl::first_window()) ++ return; ++ xid = fl_xid(Fl::first_window()); ++ if (!xid) ++ return; ++ ++ // Request an update of the selection time for both the primary and ++ // clipboard selections. Magic continues when we get a SelectionNotify. ++ if (!fl_i_own_selection[0]) ++ XConvertSelection(fl_display, XA_PRIMARY, TIMESTAMP, PRIMARY_TIMESTAMP, ++ xid, fl_event_time); ++ if (!fl_i_own_selection[1]) ++ XConvertSelection(fl_display, CLIPBOARD, TIMESTAMP, CLIPBOARD_TIMESTAMP, ++ xid, fl_event_time); ++} ++ ++static void clipboard_timeout(void *data) ++{ ++ // No one is interested, so stop polling ++ if (fl_clipboard_notify_empty()) ++ return; ++ ++ poll_clipboard_owner(); ++ ++ Fl::repeat_timeout(0.5, clipboard_timeout); ++} ++ ++static void handle_clipboard_timestamp(int clipboard, Time time) ++{ ++ Time *timestamp; ++ ++ timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp; ++ ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ // Initial scan, just store the value ++ if (*timestamp == (Time)-1) { ++ *timestamp = time; ++ return; ++ } ++ } ++ ++ // Same selection ++ if (time == *timestamp) ++ return; ++ ++ *timestamp = time; ++ ++ // The clipboard change is the event that caused us to request ++ // the clipboard data, so use that time as the latest event. ++ if (time > fl_event_time) ++ fl_event_time = time; ++ ++ // Something happened! Let's tell someone! ++ fl_trigger_clipboard_notify(clipboard); ++} ++ ++void fl_clipboard_notify_change() { ++ // Reset the timestamps if we've going idle so that you don't ++ // get a bogus immediate trigger next time they're activated. ++ if (fl_clipboard_notify_empty()) { ++ primary_timestamp = -1; ++ clipboard_timestamp = -1; ++ } else { ++#if HAVE_XFIXES ++ if (!have_xfixes) ++#endif ++ { ++ poll_clipboard_owner(); ++ ++ if (!Fl::has_timeout(clipboard_timeout)) ++ Fl::add_timeout(0.5, clipboard_timeout); ++ } ++ } ++} ++ ++//////////////////////////////////////////////////////////////// + + const XEvent* fl_xevent; // the current x event + ulong fl_event_time; // the last timestamp from an x event +@@ -1024,7 +1141,6 @@ int fl_handle(const XEvent& thisevent) + return 0; + + case SelectionNotify: { +- if (!fl_selection_requestor) return 0; + static unsigned char* buffer = 0; + if (buffer) {XFree(buffer); buffer = 0;} + long bytesread = 0; +@@ -1040,6 +1156,19 @@ int fl_handle(const XEvent& thisevent) + bytesread/4, 65536, 1, 0, + &actual, &format, &count, &remaining, + &portion)) break; // quit on error ++ ++ if ((fl_xevent->xselection.property == PRIMARY_TIMESTAMP) || ++ (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)) { ++ if (portion && format == 32 && count == 1) { ++ Time t = *(unsigned int*)portion; ++ if (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP) ++ handle_clipboard_timestamp(1, t); ++ else ++ handle_clipboard_timestamp(0, t); ++ } ++ return true; ++ } ++ + if (actual == TARGETS || actual == XA_ATOM) { + Atom type = XA_STRING; + for (unsigned i = 0; ixselectionclear.selection == CLIPBOARD; + fl_i_own_selection[clipboard] = 0; ++ poll_clipboard_owner(); + return 1;} + + case SelectionRequest: { +@@ -1308,6 +1441,9 @@ int fl_handle(const XEvent& thisevent) + case FocusIn: + if (fl_xim_ic) XSetICFocus(fl_xim_ic); + event = FL_FOCUS; ++ // If the user has toggled from another application to this one, ++ // then it's a good time to check for clipboard changes. ++ poll_clipboard_owner(); + break; + + case FocusOut: +@@ -1676,6 +1812,25 @@ int fl_handle(const XEvent& thisevent) + } + } + ++#if HAVE_XFIXES ++ switch (xevent.type - xfixes_event_base) { ++ case XFixesSelectionNotify: { ++ // Someone feeding us bogus events? ++ if (!have_xfixes) ++ return true; ++ ++ XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)&xevent; ++ ++ if ((selection_notify->selection == XA_PRIMARY) && !fl_i_own_selection[0]) ++ handle_clipboard_timestamp(0, selection_notify->selection_timestamp); ++ else if ((selection_notify->selection == CLIPBOARD) && !fl_i_own_selection[1]) ++ handle_clipboard_timestamp(1, selection_notify->selection_timestamp); ++ ++ return true; ++ } ++ } ++#endif ++ + return Fl::handle(event, window); + } + +@@ -1995,6 +2150,16 @@ void Fl_X::make_xid(Fl_Window* win, XVis + XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1); + } + ++#if HAVE_XFIXES ++ // register for clipboard change notifications ++ if (have_xfixes && !win->parent()) { ++ XFixesSelectSelectionInput(fl_display, xp->xid, XA_PRIMARY, ++ XFixesSetSelectionOwnerNotifyMask); ++ XFixesSelectSelectionInput(fl_display, xp->xid, CLIPBOARD, ++ XFixesSetSelectionOwnerNotifyMask); ++ } ++#endif ++ + XMapWindow(fl_display, xp->xid); + if (showit) { + win->set_visible(); +diff -up fltk-1.3.2/test/CMakeLists.txt.clp-x11 fltk-1.3.2/test/CMakeLists.txt diff --git a/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch b/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch new file mode 100644 index 00000000..cf13aad7 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/fltk-1_v6.3.x-keyboard-osx.patch @@ -0,0 +1,375 @@ +diff -ur fltk-1.3.0r9619.org/configure.in fltk-1.3.0r9619/configure.in +--- fltk-1.3.0r9619.org/configure.in 2012-04-22 04:45:09.000000000 +0200 ++++ fltk-1.3.0r9619/configure.in 2012-06-18 13:47:33.290447462 +0200 +@@ -865,6 +865,8 @@ + Darwin*) + # MacOS X uses Cocoa for graphics. + LIBS="$LIBS -framework Cocoa" ++ # And some Carbon for keyboard handling ++ LIBS="$LIBS -framework Carbon" + + if test x$have_pthread = xyes; then + AC_DEFINE(HAVE_PTHREAD) +diff -ur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm +--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-16 10:49:52.000000000 +0200 ++++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-18 13:47:42.944910782 +0200 +@@ -53,6 +53,7 @@ + #include + + #import ++#import + + #ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h + #if defined(__LP64__) && __LP64__ +@@ -114,6 +115,8 @@ + extern Fl_Window* fl_xmousewin; + #endif + ++bool use_simple_keyboard = false; ++ + enum { FLTKTimerEvent = 1, FLTKDataReadyEvent }; + + +@@ -130,6 +133,39 @@ + { + } + ++// Undocumented voodoo. Taken from Mozilla. ++#define ENABLE_ROMAN_KYBDS_ONLY -23 ++ ++void fl_update_focus(void) ++{ ++ Fl_Widget *focus; ++ ++ focus = Fl::grab(); ++ if (!focus) ++ focus = Fl::focus(); ++ if (!focus) ++ return; ++ ++ if (focus->simple_keyboard()) ++ use_simple_keyboard = true; ++ else ++ use_simple_keyboard = false; ++ ++ // Force a "Roman" or "ASCII" keyboard, which both the Mozilla and ++ // Safari people seem to think implies turning off advanced IME stuff ++ // (see nsTSMManager::SyncKeyScript in Mozilla and enableSecureTextInput ++ // in Safari/Webcore). Should be good enough for us then... ++#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) ++ CFArrayRef inputSources = TISCreateASCIICapableInputSourceList(); ++ TSMSetDocumentProperty(TSMGetActiveDocument(), ++ kTSMDocumentEnabledInputSourcesPropertyTag, ++ sizeof(CFArrayRef), &inputSources); ++ CFRelease(inputSources); ++#else ++ KeyScript(use_simple_keyboard ? ENABLE_ROMAN_KYBDS_ONLY : smKeyEnableKybds); ++#endif ++} ++ + /* + * Mac keyboard lookup table + */ +@@ -908,6 +944,25 @@ + } + @end + ++static const char* cocoaDead2FLTK(const char *in) ++{ ++ if (strcmp(in, "\140") == 0) // GRAVE ACCENT ++ return "\314\200"; // COMBINING GRAVE ACCENT ++ if (strcmp(in, "\302\264") == 0) // ACUTE ACCENT ++ return "\314\201"; // COMBINING ACUTE ACCENT ++ if (strcmp(in, "\136") == 0) // CIRCUMFLEX ACCENT ++ return "\314\202"; // COMBINING CIRCUMFLEX ACCENT ++ if (strcmp(in, "\176") == 0) // TILDE ++ return "\314\203"; // COMBINING TILDE ++ if (strcmp(in, "\302\250") == 0) // DIAERESIS ++ return "\314\210"; // COMBINING DIAERESIS ++ // FIXME: OS X dead key behaviour isn't documented and I don't have ++ // any more keyboards to test with... ++ ++ // hope that OS X gave us something proper to begin with ++ return in; ++} ++ + /* + Handle cocoa keyboard events + Events during a character composition sequence: +@@ -1648,6 +1703,7 @@ + - (void)rightMouseDragged:(NSEvent *)theEvent; + - (void)otherMouseDragged:(NSEvent *)theEvent; + - (void)scrollWheel:(NSEvent *)theEvent; +++ (NSString *)keyTranslate:(UInt16)keyCode withModifierFlags:(UInt32)modifierFlags; + - (BOOL)handleKeyDown:(NSEvent *)theEvent; + - (void)keyDown:(NSEvent *)theEvent; + - (void)keyUp:(NSEvent *)theEvent; +@@ -1726,6 +1782,130 @@ + - (void)scrollWheel:(NSEvent *)theEvent { + cocoaMouseWheelHandler(theEvent); + } +++ (NSString *)keyTranslate:(UInt16)keyCode withModifierFlags:(UInt32)modifierFlags { ++ const UCKeyboardLayout *layout; ++ OSStatus err; ++ ++ layout = NULL; ++ ++#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) ++ TISInputSourceRef keyboard; ++ CFDataRef uchr; ++ ++ keyboard = TISCopyCurrentKeyboardInputSource(); ++ uchr = (CFDataRef)TISGetInputSourceProperty(keyboard, ++ kTISPropertyUnicodeKeyLayoutData); ++ if (uchr == NULL) ++ return nil; ++ ++ layout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr); ++#else ++ KeyboardLayoutRef old_layout; ++ int kind; ++ ++ err = KLGetCurrentKeyboardLayout(&old_layout); ++ if (err != noErr) ++ return nil; ++ ++ err = KLGetKeyboardLayoutProperty(old_layout, kKLKind, ++ (const void**)&kind); ++ if (err != noErr) ++ return nil; ++ ++ // Old, crufty layout format? ++ if (kind == kKLKCHRKind) { ++ void *kchr_layout; ++ ++ UInt32 chars, state; ++ char buf[3]; ++ ++ unichar result[16]; ++ ByteCount in_len, out_len; ++ ++ err = KLGetKeyboardLayoutProperty(old_layout, kKLKCHRData, ++ (const void**)&kchr_layout); ++ if (err != noErr) ++ return nil; ++ ++ state = 0; ++ ++ keyCode &= 0x7f; ++ modifierFlags &= 0xff00; ++ ++ chars = KeyTranslate(kchr_layout, keyCode | modifierFlags, &state); ++ ++ buf[0] = (chars >> 16) & 0xff; ++ buf[1] = chars & 0xff; ++ buf[2] = '\0'; ++ ++ if (buf[0] == '\0') { ++ buf[0] = buf[1]; ++ buf[1] = '\0'; ++ } ++ ++ // The data is now in some layout specific encoding. Need to convert ++ // this to unicode. ++ ++ ScriptCode script; ++ TextEncoding encoding; ++ TECObjectRef converter; ++ ++ script = (ScriptCode)GetScriptManagerVariable(smKeyScript); ++ ++ err = UpgradeScriptInfoToTextEncoding(script, kTextLanguageDontCare, ++ kTextRegionDontCare, NULL, ++ &encoding); ++ if (err != noErr) ++ return nil; ++ ++ err = TECCreateConverter(&converter, encoding, kTextEncodingUnicodeV4_0); ++ if (err != noErr) ++ return nil; ++ ++ in_len = strlen(buf); ++ out_len = sizeof(result); ++ ++ err = TECConvertText(converter, (ConstTextPtr)buf, in_len, &in_len, ++ (TextPtr)result, out_len, &out_len); ++ ++ TECDisposeConverter(converter); ++ ++ if (err != noErr) ++ return nil; ++ ++ return [NSString stringWithCharacters:result ++ length:(out_len / sizeof(unichar))]; ++ } ++ ++ if ((kind != kKLKCHRuchrKind) && (kind != kKLuchrKind)) ++ return nil; ++ ++ err = KLGetKeyboardLayoutProperty(old_layout, kKLuchrData, ++ (const void**)&layout); ++ if (err != noErr) ++ return nil; ++#endif ++ ++ if (layout == NULL) ++ return nil; ++ ++ UInt32 dead_state; ++ UniCharCount max_len, actual_len; ++ UniChar string[255]; ++ ++ dead_state = 0; ++ max_len = sizeof(string)/sizeof(*string); ++ ++ modifierFlags = (modifierFlags >> 8) & 0xff; ++ ++ err = UCKeyTranslate(layout, keyCode, kUCKeyActionDown, modifierFlags, ++ LMGetKbdType(), 0, &dead_state, max_len, &actual_len, ++ string); ++ if (err != noErr) ++ return nil; ++ ++ return [NSString stringWithCharacters:string length:actual_len]; ++} + - (BOOL)handleKeyDown:(NSEvent *)theEvent { + //NSLog(@"handleKeyDown"); + fl_lock_function(); +@@ -1752,14 +1932,47 @@ + break; + } + } +- if (!no_text_key && !(Fl::e_state & FL_META) ) { +- // Don't send cmd- to interpretKeyEvents because it beeps. ++ if (!no_text_key) { ++ // The simple keyboard model will ignore insertText, so we need to grab ++ // the symbol directly from the event. Note that we still use setMarkedText. ++ if (use_simple_keyboard) { ++ NSString *simple_chars; ++ UInt32 modifiers; ++ ++ // We want a "normal" symbol out of the event, which basically means ++ // we only respect the shift and alt/altgr modifiers. Cocoa can help ++ // us if we only wanted shift, but as we also want alt/altgr, we'll ++ // have to do some lookup ourselves. This matches our behaviour on ++ // other platforms. ++ ++ modifiers = 0; ++ if ([theEvent modifierFlags] & NSAlphaShiftKeyMask) ++ modifiers |= alphaLock; ++ if ([theEvent modifierFlags] & NSShiftKeyMask) ++ modifiers |= shiftKey; ++ if ([theEvent modifierFlags] & NSAlternateKeyMask) ++ modifiers |= optionKey; ++ ++ simple_chars = [FLView keyTranslate:[theEvent keyCode] ++ withModifierFlags:modifiers]; ++ if (simple_chars == nil) { ++ // Something went wrong. Fall back to what Cocoa gave us... ++ simple_chars = [theEvent charactersIgnoringModifiers]; ++ } ++ ++ [FLView prepareEtext:simple_chars]; ++ } ++ + // Then we can let the OS have a stab at it and see if it thinks it + // should result in some text +- NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; +- in_key_event = true; +- [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; +- in_key_event = false; ++ ++ // Don't send cmd- to interpretKeyEvents because it beeps. ++ if (!(Fl::e_state & FL_META)) { ++ NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; ++ in_key_event = true; ++ [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; ++ in_key_event = false; ++ } + } + //NSLog(@"to text=%@ l=%d", [NSString stringWithUTF8String:Fl::e_text], Fl::e_length); + int handled = Fl::handle(FL_KEYDOWN, window); +@@ -1937,21 +2150,30 @@ + //NSLog(@"insertText: received=%@",received); + + if (!in_key_event) fl_lock_function(); ++ ++ // Simple keyboard widgets do not want these side channel inputs. ++ if (use_simple_keyboard) ++ goto end; ++ + [FLView prepareEtext:received]; ++ + // We can get called outside of key events (e.g. from the character +- // palette). Transform such actions to FL_PASTE events. ++ // palette). We need to fake our own key event at that point. + if (!in_key_event) { + Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; +- Fl::handle(FL_PASTE, target); ++ Fl::e_keysym = Fl::e_original_keysym = 0; ++ Fl::handle(FL_KEYDOWN, target); + // for some reason, the window does not redraw until the next mouse move or button push + // sending a 'redraw()' or 'awake()' does not solve the issue! + Fl::flush(); + } ++ ++end: + if (!in_key_event) fl_unlock_function(); + } + + - (void)setMarkedText:(id)aString selectedRange:(NSRange)newSelection { +- NSString *received; ++ NSString *received, *current, *aggregate; + if (newSelection.location == 0) { + [self unmarkText]; + return; +@@ -1962,11 +2184,47 @@ + received = (NSString*)aString; + } + //NSLog(@"setMarkedText: %@ %d %d",received,newSelection.location,newSelection.length); ++ ++ fl_lock_function(); ++ ++ // Simple keyboard widgets generally do not want these side channel ++ // inputs, but we have no other way of getting dead keys so we make ++ // an exception in that case. ++ if (use_simple_keyboard) { ++ if (in_key_event && (Fl::e_length == 0)) { ++ [FLView prepareEtext:received]; ++ ++ Fl::e_text = (char*)cocoaDead2FLTK(Fl::e_text); ++ Fl::e_length = strlen(Fl::e_text); ++ } ++ goto end; ++ } ++ + // This code creates the OS X behaviour of seeing dead keys as things + // are being composed. ++ // ++ // Note: The concatenation thing is because of how OS X deals with ++ // invalid sequences. At that point it will spit out one call ++ // to insertText with the now aborted sequence, and one new ++ // call to setMarkedText with the new sequence. Since we want ++ // both to be visible, we need to concatenate. + next_compose_length = newSelection.location; +- [FLView prepareEtext:received]; +- //NSLog(@"Fl::e_text=%@ Fl::e_length=%d next_compose_length=%d", received, Fl::e_length, next_compose_length); ++ current = [NSString stringWithUTF8String:Fl::e_text]; ++ aggregate = [current stringByAppendingString:received]; ++ ++ [FLView prepareEtext:aggregate]; ++ //NSLog(@"Fl::e_text=%@ Fl::e_length=%d next_compose_length=%d", aggregate, Fl::e_length, next_compose_length); ++ ++ // We can get called outside of key events (e.g. from the character ++ // palette). We need to fake our own key event at that point. ++ if (!in_key_event) { ++ Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; ++ Fl::e_keysym = Fl::e_original_keysym = 0; ++ Fl::handle(FL_KEYDOWN, target); ++ } ++ ++end: ++ fl_unlock_function(); + } + + - (void)unmarkText { diff --git a/contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch b/contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch new file mode 100644 index 00000000..30315138 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/pixmap_v2.patch @@ -0,0 +1,554 @@ +diff -ur fltk-1.3.2.org/FL/Fl_Image.H fltk-1.3.2/FL/Fl_Image.H +--- fltk-1.3.2.org/FL/Fl_Image.H 2012-11-09 17:02:08.000000000 +0100 ++++ fltk-1.3.2/FL/Fl_Image.H 2013-01-16 14:40:51.543230638 +0100 +@@ -26,6 +26,7 @@ + #include + + class Fl_Widget; ++class Fl_Pixmap; + struct Fl_Menu_Item; + struct Fl_Label; + +@@ -203,6 +204,7 @@ + */ + Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) : + Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);} ++ Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY); + virtual ~Fl_RGB_Image(); + virtual Fl_Image *copy(int W, int H); + Fl_Image *copy() { return copy(w(), h()); } +diff -ur fltk-1.3.2.org/src/fl_draw_pixmap.cxx fltk-1.3.2/src/fl_draw_pixmap.cxx +--- fltk-1.3.2.org/src/fl_draw_pixmap.cxx 2012-04-22 05:09:31.000000000 +0200 ++++ fltk-1.3.2/src/fl_draw_pixmap.cxx 2013-01-16 14:40:51.542230588 +0100 +@@ -58,99 +58,6 @@ + return 1; + } + +-#ifdef U64 +- +-// The callback from fl_draw_image to get a row of data passes this: +-struct pixmap_data { +- int w, h; +- const uchar*const* data; +- union { +- U64 colors[256]; +- U64* byte1[256]; +- }; +-}; +- +-// callback for 1 byte per pixel: +-static void cb1(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+x; +- U64* q = (U64*)buf; +- for (int X=w; X>0; X-=2, p += 2) { +- if (X>1) { +-# if WORDS_BIGENDIAN +- *q++ = (d.colors[p[0]]<<32) | d.colors[p[1]]; +-# else +- *q++ = (d.colors[p[1]]<<32) | d.colors[p[0]]; +-# endif +- } else { +-# if WORDS_BIGENDIAN +- *q++ = d.colors[p[0]]<<32; +-# else +- *q++ = d.colors[p[0]]; +-# endif +- } +- } +-} +- +-// callback for 2 bytes per pixel: +-static void cb2(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+2*x; +- U64* q = (U64*)buf; +- for (int X=w; X>0; X-=2) { +- U64* colors = d.byte1[*p++]; +- int index = *p++; +- if (X>1) { +- U64* colors1 = d.byte1[*p++]; +- int index1 = *p++; +-# if WORDS_BIGENDIAN +- *q++ = (colors[index]<<32) | colors1[index1]; +-# else +- *q++ = (colors1[index1]<<32) | colors[index]; +-# endif +- } else { +-# if WORDS_BIGENDIAN +- *q++ = colors[index]<<32; +-# else +- *q++ = colors[index]; +-# endif +- } +- } +-} +- +-#else // U32 +- +-// The callback from fl_draw_image to get a row of data passes this: +-struct pixmap_data { +- int w, h; +- const uchar*const* data; +- union { +- U32 colors[256]; +- U32* byte1[256]; +- }; +-}; +- +-// callback for 1 byte per pixel: +-static void cb1(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+x; +- U32* q = (U32*)buf; +- for (int X=w; X--;) *q++ = d.colors[*p++]; +-} +- +-// callback for 2 bytes per pixel: +-static void cb2(void*v, int x, int y, int w, uchar* buf) { +- pixmap_data& d = *(pixmap_data*)v; +- const uchar* p = d.data[y]+2*x; +- U32* q = (U32*)buf; +- for (int X=w; X--;) { +- U32* colors = d.byte1[*p++]; +- *q++ = colors[*p++]; +- } +-} +- +-#endif // U64 else U32 +- + uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here + + /** +@@ -200,34 +107,33 @@ + } + #endif + +-/** +- Draw XPM image data, with the top-left corner at the given position. +- \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg) +- */ +-int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { +- pixmap_data d; +- if (!fl_measure_pixmap(cdata, d.w, d.h)) return 0; ++int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) { ++ int w, h; + const uchar*const* data = (const uchar*const*)(cdata+1); + int transparent_index = -1; ++ ++ if (!fl_measure_pixmap(cdata, w, h)) ++ return 0; ++ ++ if ((chars_per_pixel < 1) || (chars_per_pixel > 2)) ++ return 0; ++ ++ uchar colors[1<<(chars_per_pixel*8)][4]; ++ + #ifdef WIN32 + uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the RGB of the transparent color + color_count = 0; + used_colors = (uchar *)malloc(abs(ncolors)*3*sizeof(uchar)); + #endif + +- if (ncolors < 0) { // FLTK (non standard) compressed colormap ++ if (ncolors < 0) { ++ // FLTK (non standard) compressed colormap + ncolors = -ncolors; + const uchar *p = *data++; + // if first color is ' ' it is transparent (put it later to make + // it not be transparent): + if (*p == ' ') { +- uchar* c = (uchar*)&d.colors[(int)' ']; +-#ifdef U64 +- *(U64*)c = 0; +-# if WORDS_BIGENDIAN +- c += 4; +-# endif +-#endif ++ uchar* c = colors[(int)' ']; + transparent_index = ' '; + Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0; + #ifdef WIN32 +@@ -238,13 +144,7 @@ + } + // read all the rest of the colors: + for (int i=0; i < ncolors; i++) { +- uchar* c = (uchar*)&d.colors[*p++]; +-#ifdef U64 +- *(U64*)c = 0; +-# if WORDS_BIGENDIAN +- c += 4; +-# endif +-#endif ++ uchar* c = colors[*p++]; + #ifdef WIN32 + used_colors[3*color_count] = *p; + used_colors[3*color_count+1] = *(p+1); +@@ -254,69 +154,44 @@ + *c++ = *p++; + *c++ = *p++; + *c++ = *p++; +-#ifdef __APPLE_QUARTZ__ + *c = 255; +-#else +- *c = 0; +-#endif + } +- } else { // normal XPM colormap with names +- if (chars_per_pixel>1) memset(d.byte1, 0, sizeof(d.byte1)); ++ } else { ++ // normal XPM colormap with names + for (int i=0; i1) { +-#ifdef U64 +- U64* colors = d.byte1[ind]; +- if (!colors) colors = d.byte1[ind] = new U64[256]; +-#else +- U32* colors = d.byte1[ind]; +- if (!colors) colors = d.byte1[ind] = new U32[256]; +-#endif +- c = (uchar*)&colors[*p]; +- ind = (ind<<8)|*p++; +- } else { +- c = (uchar *)&d.colors[ind]; +- } ++ if (chars_per_pixel>1) ++ ind = (ind<<8)|*p++; ++ c = colors[ind]; + // look for "c word", or last word if none: + const uchar *previous_word = p; + for (;;) { +- while (*p && isspace(*p)) p++; +- uchar what = *p++; +- while (*p && !isspace(*p)) p++; +- while (*p && isspace(*p)) p++; +- if (!*p) {p = previous_word; break;} +- if (what == 'c') break; +- previous_word = p; +- while (*p && !isspace(*p)) p++; ++ while (*p && isspace(*p)) p++; ++ uchar what = *p++; ++ while (*p && !isspace(*p)) p++; ++ while (*p && isspace(*p)) p++; ++ if (!*p) {p = previous_word; break;} ++ if (what == 'c') break; ++ previous_word = p; ++ while (*p && !isspace(*p)) p++; + } +-#ifdef U64 +- *(U64*)c = 0; +-# if WORDS_BIGENDIAN +- c += 4; +-# endif +-#endif +-#ifdef __APPLE_QUARTZ__ +- c[3] = 255; +-#endif + int parse = fl_parse_color((const char*)p, c[0], c[1], c[2]); ++ c[3] = 255; + if (parse) { + #ifdef WIN32 +- used_colors[3*color_count] = c[0]; +- used_colors[3*color_count+1] = c[1]; +- used_colors[3*color_count+2] = c[2]; +- color_count++; ++ used_colors[3*color_count] = c[0]; ++ used_colors[3*color_count+1] = c[1]; ++ used_colors[3*color_count+2] = c[2]; ++ color_count++; + #endif +- } +- else { ++ } else { + // assume "None" or "#transparent" for any errors +- // "bg" should be transparent... +- Fl::get_color(bg, c[0], c[1], c[2]); +-#ifdef __APPLE_QUARTZ__ ++ // "bg" should be transparent... ++ Fl::get_color(bg, c[0], c[1], c[2]); + c[3] = 0; +-#endif + transparent_index = ind; + #ifdef WIN32 + transparent_c = c; +@@ -324,7 +199,6 @@ + } + } + } +- d.data = data; + #ifdef WIN32 + if (transparent_c) { + make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]); +@@ -334,77 +208,76 @@ + make_unused_color(r, g, b); + } + #endif ++ ++ U32 *q = (U32*)out; ++ for (int Y = 0; Y < h; Y++) { ++ const uchar* p = data[Y]; ++ if (chars_per_pixel <= 1) { ++ for (int X = 0; X < w; X++) ++ memcpy(q++, colors[*p++], 4); ++ } else { ++ for (int X = 0; X < w; X++) { ++ int ind = (*p++)<<8; ++ ind |= *p++; ++ memcpy(q++, colors[ind], 4); ++ } ++ } ++ } + ++ return 1; ++} ++ ++/** ++ Draw XPM image data, with the top-left corner at the given position. ++ \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg) ++ */ ++int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { ++ int w, h; ++ ++ if (!fl_measure_pixmap(cdata, w, h)) ++ return 0; ++ ++ uchar buffer[w*h*4]; ++ ++ if (!fl_convert_pixmap(cdata, buffer, bg)) ++ return 0; ++ ++ // FIXME: Hack until fl_draw_image() supports alpha properly + #ifdef __APPLE_QUARTZ__ + if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) { +- U32 *array = new U32[d.w * d.h], *q = array; +- for (int Y = 0; Y < d.h; Y++) { +- const uchar* p = data[Y]; +- if (chars_per_pixel <= 1) { +- for (int X = 0; X < d.w; X++) { +- *q++ = d.colors[*p++]; +- } +- } else { +- for (int X = 0; X < d.w; X++) { +- U32* colors = (U32*)d.byte1[*p++]; +- *q++ = colors[*p++]; +- } +- } +- } +- Fl_RGB_Image* rgb = new Fl_RGB_Image((uchar*)array, d.w, d.h, 4); ++ Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4); + rgb->draw(x, y); + delete rgb; +- delete[] array; +- } +- else { ++ } else { + #endif // __APPLE_QUARTZ__ +- + // build the mask bitmap used by Fl_Pixmap: +- if (fl_mask_bitmap && transparent_index >= 0) { +- int W = (d.w+7)/8; +- uchar* bitmap = new uchar[W * d.h]; ++ if (fl_mask_bitmap) { ++ int W = (w+7)/8; ++ uchar* bitmap = new uchar[W * h]; + *fl_mask_bitmap = bitmap; +- for (int Y = 0; Y < d.h; Y++) { +- const uchar* p = data[Y]; +- if (chars_per_pixel <= 1) { +- int dw = d.w; +- for (int X = 0; X < W; X++) { +- uchar b = (dw-->0 && *p++ != transparent_index); +- if (dw-->0 && *p++ != transparent_index) b |= 2; +- if (dw-->0 && *p++ != transparent_index) b |= 4; +- if (dw-->0 && *p++ != transparent_index) b |= 8; +- if (dw-->0 && *p++ != transparent_index) b |= 16; +- if (dw-->0 && *p++ != transparent_index) b |= 32; +- if (dw-->0 && *p++ != transparent_index) b |= 64; +- if (dw-->0 && *p++ != transparent_index) b |= 128; ++ const uchar *p = &buffer[3]; ++ uchar b = 0; ++ for (int Y = 0; Y < h; Y++) { ++ b = 0; ++ for (int X = 0, bit = 1; X < w; X++, p += 4) { ++ if (*p > 127) b |= bit; ++ bit <<= 1; ++ if (bit > 0x80 || X == w-1) { + *bitmap++ = b; +- } +- } else { +- uchar b = 0, bit = 1; +- for (int X = 0; X < d.w; X++) { +- int ind = *p++; +- ind = (ind<<8) | (*p++); +- if (ind != transparent_index) b |= bit; +- +- if (bit < 128) bit <<= 1; +- else { +- *bitmap++ = b; +- b = 0; +- bit = 1; ++ bit = 1; ++ b = 0; + } + } +- +- if (bit > 1) *bitmap++ = b; + } +- } ++ + } + +- fl_draw_image(chars_per_pixel==1 ? cb1 : cb2, &d, x, y, d.w, d.h, 4); ++ fl_draw_image(buffer, x, y, w, h, 4); ++ + #ifdef __APPLE_QUARTZ__ + } + #endif + +- if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete[] d.byte1[i]; + return 1; + } + +diff -ur fltk-1.3.2.org/src/Fl_Image.cxx fltk-1.3.2/src/Fl_Image.cxx +--- fltk-1.3.2.org/src/Fl_Image.cxx 2012-11-09 17:02:08.000000000 +0100 ++++ fltk-1.3.2/src/Fl_Image.cxx 2013-01-16 14:41:38.404162795 +0100 +@@ -165,7 +165,22 @@ + // + size_t Fl_RGB_Image::max_size_ = ~((size_t)0); + +-/** The destructor free all memory and server resources that are used by the image. */ ++int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg); ++ ++/** The constructor creates a new RGBA image from the specified Fl_Pixmap. ++ ++ The RGBA image is built fully opaque except for the transparent area ++ of the pixmap that is assigned the \par bg color with full transparency */ ++Fl_RGB_Image::Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg): ++ Fl_Image(pxm->w(), pxm->h(), 4), id_(0), mask_(0) ++{ ++ array = new uchar[w() * h() * d()]; ++ alloc_array = 1; ++ fl_convert_pixmap(pxm->data(), (uchar*)array, bg); ++ data((const char **)&array, 1); ++} ++ ++/** The destructor frees all memory and server resources that are used by the image. */ + Fl_RGB_Image::~Fl_RGB_Image() { + uncache(); + if (alloc_array) delete[] (uchar *)array; +diff -ur fltk-1.3.2.org/src/ps_image.cxx fltk-1.3.2/src/ps_image.cxx +--- fltk-1.3.2.org/src/ps_image.cxx 2011-07-19 06:49:30.000000000 +0200 ++++ fltk-1.3.2/src/ps_image.cxx 2013-01-16 14:40:51.541228080 +0100 +@@ -185,72 +185,38 @@ + + extern uchar **fl_mask_bitmap; + ++struct callback_data { ++ const uchar *data; ++ int D, LD; ++}; + +-void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { +- double x = ix, y = iy, w = iw, h = ih; + +- if (D<3){ //mono +- draw_image_mono(data, ix, iy, iw, ih, D, LD); +- return; +- } ++static void draw_image_cb(void *data, int x, int y, int w, uchar *buf) { ++ struct callback_data *cb_data; ++ const uchar *curdata; + ++ cb_data = (struct callback_data*)data; ++ curdata = cb_data->data + x*cb_data->D + y*cb_data->LD; + +- int i,j, k; ++ memcpy(buf, curdata, w*cb_data->D); ++} + +- fprintf(output,"save\n"); + +- const char * interpol; +- if (lang_level_>1){ +- if (interpolate_) +- interpol="true"; +- else +- interpol="false"; +- if (mask && lang_level_>2) +- fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol); +- else +- fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol); +- } else +- fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih); ++void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { ++ if (D<3){ //mono ++ draw_image_mono(data, ix, iy, iw, ih, D, LD); ++ return; ++ } + ++ struct callback_data cb_data; + + if (!LD) LD = iw*D; +- uchar *curmask=mask; +- +- for (j=0; j3) { //can do mixing using bg_* colors) +- unsigned int a2 = curdata[3]; //must be int +- unsigned int a = 255-a2; +- r = (a2 * r + bg_r * a)/255; +- g = (a2 * g + bg_g * a)/255; +- b = (a2 * b + bg_b * a)/255; +- } +- if (!(i%40)) fprintf(output, "\n"); +- fprintf(output, "%.2x%.2x%.2x", r, g, b); +- curdata +=D; +- } +- fprintf(output,"\n"); +- +- } +- +- fprintf(output," >\nrestore\n" ); + ++ cb_data.data = data; ++ cb_data.D = D; ++ cb_data.LD = LD; + ++ draw_image(draw_image_cb, &cb_data, ix, iy, iw, ih, D); + } + + void Fl_PostScript_Graphics_Driver::draw_image(Fl_Draw_Image_Cb call, void *data, int ix, int iy, int iw, int ih, int D) { +@@ -325,6 +291,14 @@ + uchar g = curdata[1]; + uchar b = curdata[2]; + ++ if (lang_level_<3 && D>3) { //can do mixing using bg_* colors) ++ unsigned int a2 = curdata[3]; //must be int ++ unsigned int a = 255-a2; ++ r = (a2 * r + bg_r * a)/255; ++ g = (a2 * g + bg_g * a)/255; ++ b = (a2 * b + bg_b * a)/255; ++ } ++ + if (!(i%40)) fputs("\n", output); + fprintf(output, "%.2x%.2x%.2x", r, g, b); + diff --git a/contrib/packages/rpm/el6/SOURCES/tigervnc-cookie.patch b/contrib/packages/rpm/el6/SOURCES/tigervnc-cookie.patch new file mode 100644 index 00000000..c066a5f8 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/tigervnc-cookie.patch @@ -0,0 +1,37 @@ +diff -up tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie tigervnc-1.0.90-20091221svn3929/unix/vncserver +--- tigervnc-1.0.90-20091221svn3929/unix/vncserver.cookie 2009-11-12 11:39:54.000000000 +0100 ++++ tigervnc-1.0.90-20091221svn3929/unix/vncserver 2009-12-21 16:15:01.907799091 +0100 +@@ -189,27 +189,12 @@ $vncPort = 5900 + $displayNumber; + $desktopLog = "$vncUserDir/$host:$displayNumber.log"; + unlink($desktopLog); + +-# Make an X server cookie - use /dev/urandom on systems that have it, +-# otherwise use perl's random number generator, seeded with the sum +-# of the current time, our PID and part of the encrypted form of the password. +- +-my $cookie = ""; +-if (open(URANDOM, '<', '/dev/urandom')) { +- my $randata; +- if (sysread(URANDOM, $randata, 16) == 16) { +- $cookie = unpack 'h*', $randata; +- } +- close(URANDOM); +-} +-if ($cookie eq "") { +- srand(time+$$+unpack("L",`cat $vncUserDir/passwd`)); +- for (1..16) { +- $cookie .= sprintf("%02x", int(rand(256)) % 256); +- } +-} +- +-system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); +-system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); ++# Make an X server cookie - use mcookie ++$cookie = `/usr/bin/mcookie`; ++open (XAUTH, "|xauth -f $xauthorityFile source -"); ++print XAUTH "add $host:$displayNumber . $cookie\n"; ++print XAUTH "add $host/unix:$displayNumber . $cookie\n"; ++close XAUTH; + + if ($opt{'-name'}) { + $desktopName = $opt{'-name'}; diff --git a/contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch b/contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch new file mode 100644 index 00000000..229cf3f1 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/tigervnc-xorg-manpages.patch @@ -0,0 +1,10 @@ +--- unix/xserver/man/Makefile.am 2013-03-30 17:51:01.707258746 -0400 ++++ unix/xserver/man/Makefile.am 2013-03-30 17:51:47.606569692 -0400 +@@ -2,5 +2,7 @@ + # (i.e. those handled in the os/utils.c options processing instead of in + # the DDX-level options processing) + ++if ENABLE_DOCS + include $(top_srcdir)/manpages.am + appman_PRE = Xserver.man ++endif ENABLE_DOCS diff --git a/contrib/packages/rpm/el6/SOURCES/tigervnc11-gethomedir.patch b/contrib/packages/rpm/el6/SOURCES/tigervnc11-gethomedir.patch new file mode 100644 index 00000000..0a4252d9 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/tigervnc11-gethomedir.patch @@ -0,0 +1,20 @@ +diff -up tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.gethomedir tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am +--- tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.gethomedir 2012-08-22 15:52:01.876216608 +0200 ++++ tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am 2012-08-22 15:52:45.973143684 +0200 +@@ -5,6 +5,7 @@ RFB_LIB=$(LIB_DIR)/rfb/librfb.la + RDR_LIB=$(LIB_DIR)/rdr/librdr.la + NETWORK_LIB=$(LIB_DIR)/network/libnetwork.la + XREGION_LIB=$(LIB_DIR)/Xregion/libXregion.la ++OS_LIB=$(LIB_DIR)/os/libos.la + COMMON_LIBS=$(NETWORK_LIB) $(RFB_LIB) $(RDR_LIB) $(XREGION_LIB) + + noinst_LTLIBRARIES = libvnccommon.la +@@ -55,7 +56,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I + + libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now + +-libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) ++libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) $(OS_LIB) + + EXTRA_DIST = Xvnc.man + diff --git a/contrib/packages/rpm/el6/SOURCES/tigervnc11-ldnow.patch b/contrib/packages/rpm/el6/SOURCES/tigervnc11-ldnow.patch new file mode 100644 index 00000000..f6edd098 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/tigervnc11-ldnow.patch @@ -0,0 +1,12 @@ +diff -up tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.ldnow tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am +--- tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am.ldnow 2011-10-31 09:14:40.000000000 +0100 ++++ tigervnc-1.2.0/unix/xserver/hw/vnc/Makefile.am 2012-08-22 15:51:47.013241342 +0200 +@@ -53,7 +53,7 @@ libvnc_la_CPPFLAGS = $(XVNC_CPPFLAGS) -I + -I$(top_srcdir)/include \ + ${XSERVERLIBS_CFLAGS} -I$(includedir) + +-libvnc_la_LDFLAGS = -module -avoid-version ++libvnc_la_LDFLAGS = -module -avoid-version -Wl,-z,now + + libvnc_la_LIBADD = libvnccommon.la $(COMMON_LIBS) + diff --git a/contrib/packages/rpm/el6/SOURCES/tigervnc11-rh692048.patch b/contrib/packages/rpm/el6/SOURCES/tigervnc11-rh692048.patch new file mode 100644 index 00000000..924c1cf6 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/tigervnc11-rh692048.patch @@ -0,0 +1,44 @@ +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx.rh690245 2011-02-21 14:14:16.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityClient.cxx 2011-03-31 09:47:34.519099718 +0200 +@@ -45,7 +45,7 @@ StringParameter SecurityClient::secTypes + ("SecurityTypes", + "Specify which security scheme to use (None, VncAuth)", + #ifdef HAVE_GNUTLS +- "X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", ++ "VeNCrypt,X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None", + #else + "VncAuth,None", + #endif +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx.rh690245 2011-02-21 14:14:16.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/Security.cxx 2011-03-31 09:47:34.519099718 +0200 +@@ -67,7 +67,6 @@ const std::list Security::GetEn + list result; + list::iterator i; + +- result.push_back(secTypeVeNCrypt); + for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) + if (*i < 0x100) + result.push_back(*i); +@@ -105,8 +104,6 @@ bool Security::IsSupported(U32 secType) + for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) + if (*i == secType) + return true; +- if (secType == secTypeVeNCrypt) +- return true; + + return false; + } +diff -up tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx.rh690245 tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx +--- tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx.rh690245 2011-02-21 14:50:17.000000000 +0100 ++++ tigervnc-1.0.90-20110314svn4359/common/rfb/SecurityServer.cxx 2011-03-31 10:06:43.595362302 +0200 +@@ -39,7 +39,7 @@ StringParameter SecurityServer::secTypes + ("SecurityTypes", + "Specify which security scheme to use (None, VncAuth)", + #ifdef HAVE_GNUTLS +- "VncAuth,TLSVnc", ++ "VncAuth", + #else + "VncAuth", + #endif diff --git a/contrib/packages/rpm/el6/SOURCES/vncserver.service b/contrib/packages/rpm/el6/SOURCES/vncserver.service new file mode 100644 index 00000000..880261fd --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/vncserver.service @@ -0,0 +1,155 @@ +#!/bin/bash +# +# chkconfig: - 91 35 +# description: Starts and stops vncserver. \ +# used to provide remote X administration services. + +### BEGIN INIT INFO +# Provides: vncserver +# Required-Start: $network $named +# Required-Stop: $network $named +# Default-Start: +# Default-Stop: 0 1 2 3 4 5 6 +# Short-Description: start|stop|restart|try-restart|status|force-reload vncserver +# Description: control vncserver which exports your desktop +### END INIT INFO + +# Source function library. +. /etc/init.d/functions + +[ -r /etc/sysconfig/vncservers ] && . /etc/sysconfig/vncservers + +prog=$"VNC server" + +RETVAL=0 + +start() { + [ "$EUID" != "0" ] && exit 4 + + # Source networking configuration. + . /etc/sysconfig/network + + # Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 1 + + [ -x /usr/bin/vncserver ] || exit 5 + [ -x /usr/bin/Xvnc ] || exit 5 + + echo -n $"Starting $prog: " + RETVAL=0 + if [ ! -d /tmp/.X11-unix ] + then + mkdir -m 1777 /tmp/.X11-unix || : + restorecon /tmp/.X11-unix 2>/dev/null || : + fi + + for display in ${VNCSERVERS} + do + SERVS=1 + echo -n "${display} " + DISP="${display%%:*}" + USER="${display##*:}" + VNCUSERARGS="${VNCSERVERARGS[${DISP}]}" + runuser -l ${USER} -c \ + "cd ~${USER} && + if [ -r .vnc/passwd ]; then + vncserver :${DISP} ${VNCUSERARGS} + else + echo + echo VNC password for user ${USER} is not configured + exit 1; + fi;" + RETVAL=$? + [ "$RETVAL" -eq 0 ] || break + done + if [ -z "$SERVS" ]; then + echo -n "no displays configured " + failure + RETVAL=6 + else + if [ "$RETVAL" -eq 0 ]; then + success $"vncserver startup" + touch /var/lock/subsys/Xvnc + else + failure $"vncserver start" + fi + fi + echo + +# As written in https://bugzilla.redhat.com/show_bug.cgi?id=523974 (LSB +# compliance) start of already running service is OK. + [ "$RETVAL" -eq 98 ] && RETVAL=0 + + return "$RETVAL" +} + +stop() { + [ "$EUID" != "0" ] && exit 4 + + echo -n $"Shutting down $prog: " + + status Xvnc > /dev/null 2>&1 + RETVAL=$? + + # 3 means service is already stopped + if ! [ "$RETVAL" -eq 3 ]; then + for display in ${VNCSERVERS}; do + echo -n "${display} " + export USER="${display##*:}" + runuser ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1 + done + RETVAL=$? + else + let RETVAL=0 + fi + + [ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \ + failure $"vncserver shutdown" + echo + [ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/Xvnc + return "$RETVAL" +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + sleep 3 + start + ;; + condrestart) +# https://bugzilla.redhat.com/show_bug.cgi?id=508367 +# echo "condrestart is obsolete, use try-restart instead" + if [ -e /var/lock/subsys/Xvnc ]; then + stop + sleep 3 + start + fi + ;; + try-restart) + if [ -e /var/lock/subsys/Xvnc ]; then + stop + sleep 3 + start + fi + ;; + status) + status Xvnc + RETVAL=$? + ;; + reload) + exit 3 + ;; + *) + echo $"Usage: $0 {start|stop|restart|try-restart|status|force-reload}" + exit 2 +esac + +exit "$RETVAL" + diff --git a/contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig b/contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig new file mode 100644 index 00000000..5940a1e7 --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/vncserver.sysconfig @@ -0,0 +1,19 @@ +# The VNCSERVERS variable is a list of display:user pairs. +# +# Uncomment the lines below to start a VNC server on display :2 +# as my 'myusername' (adjust this to your own). You will also +# need to set a VNC password; run 'man vncpasswd' to see how +# to do that. +# +# DO NOT RUN THIS SERVICE if your local area network is +# untrusted! For a secure way of using VNC, see this URL: +# http://kbase.redhat.com/faq/docs/DOC-7028 + +# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. + +# Use "-localhost" to prevent remote VNC clients connecting except when +# doing so through a secure tunnel. See the "-via" option in the +# `man vncviewer' manual page. + +# VNCSERVERS="2:myusername" +# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" diff --git a/contrib/packages/rpm/el6/SOURCES/vncviewer.desktop b/contrib/packages/rpm/el6/SOURCES/vncviewer.desktop new file mode 100644 index 00000000..fab46f0a --- /dev/null +++ b/contrib/packages/rpm/el6/SOURCES/vncviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=TigerVNC Viewer +Name[fr]=Visionneur TigerVNC +Comment=Connect to VNC server and display remote desktop +Comment[fr]=Se connecter à un serveur VNC et afficher le bureau distant +Exec=/usr/bin/vncviewer +Icon=tigervnc +Terminal=false +Type=Application +StartupWMClass=TigerVNC Viewer: Connection Details +Categories=Network;RemoteAccess; diff --git a/contrib/packages/rpm/el6/SPECS/tigervnc.spec b/contrib/packages/rpm/el6/SPECS/tigervnc.spec new file mode 100644 index 00000000..e33f0a3b --- /dev/null +++ b/contrib/packages/rpm/el6/SPECS/tigervnc.spec @@ -0,0 +1,734 @@ +%define snap 20131128svn5139 + +Name: tigervnc +Version: 1.3.80 +Release: 17%{?snap:.%{snap}}%{?dist} +Summary: A TigerVNC remote display system + +Group: User Interface/Desktops +License: GPLv2+ +Packager: Brian P. Hinz +URL: http://www.tigervnc.com + +Source0: %{name}-%{version}%{?snap:-%{snap}}.tar.bz2 +Source1: vncserver.service +Source2: vncserver.sysconfig +Source6: vncviewer.desktop +Source11: http://fltk.org/pub/fltk/1.3.2/fltk-1.3.2-source.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: libX11-devel, automake, autoconf, libtool, gettext, gettext-devel +BuildRequires: libXext-devel, xorg-x11-server-source, libXi-devel +BuildRequires: xorg-x11-xtrans-devel, xorg-x11-util-macros, libXtst-devel +BuildRequires: libdrm-devel, libXt-devel, pixman-devel libXfont-devel +BuildRequires: libxkbfile-devel, openssl-devel, libpciaccess-devel +BuildRequires: mesa-libGL-devel, libXinerama-devel, ImageMagick +BuildRequires: freetype-devel, libXdmcp-devel +BuildRequires: desktop-file-utils, java-devel, jpackage-utils +BuildRequires: libjpeg-turbo-devel, gnutls-devel, pam-devel +BuildRequires: cmake28 + +BuildRequires: openmotif-devel +Requires: openmotif, openmotif22 +Requires(post): initscripts chkconfig coreutils +Requires(postun): coreutils +Requires: libjpeg-turbo +Requires: hicolor-icon-theme +Requires: tigervnc-license +Requires: tigervnc-icons + +Provides: vnc = 4.1.3-2, vnc-libs = 4.1.3-2 +Obsoletes: vnc < 4.1.3-2, vnc-libs < 4.1.3-2 +Provides: tightvnc = 1.5.0-0.15.20090204svn3586 +Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586 + +Patch4: tigervnc-cookie.patch +Patch10: tigervnc11-ldnow.patch +Patch11: tigervnc11-gethomedir.patch +Patch13: tigervnc11-rh692048.patch +Patch16: tigervnc-xorg-manpages.patch + +# Export dead key information from FLTK to the apps +# http://www.fltk.org/str.php?L2599 +Patch110: http://www.fltk.org/strfiles/2599/fltk-1_v4.3.x-keyboard-x11.patch +Patch111: http://www.fltk.org/strfiles/2599/fltk-1_v4.3.x-keyboard-win32.patch +Patch112: http://www.fltk.org/strfiles/2599/fltk-1_v6.3.x-keyboard-osx.patch + +# Notify applications of changes to the clipboard +# http://www.fltk.org/str.php?L2636 +Patch113: http://www.fltk.org/strfiles/2636/fltk-1.3.x-clipboard.patch +Patch114: http://www.fltk.org/strfiles/2636/fltk-1_v6.3.x-clipboard-x11.patch +Patch115: http://www.fltk.org/strfiles/2636/fltk-1_v3.3.x-clipboard-win32-fix.patch +Patch116: http://www.fltk.org/strfiles/2636/fltk-1_v2.3.x-clipboard-win32.patch +Patch117: http://www.fltk.org/strfiles/2636/fltk-1_v2.3.x-clipboard-osx.patch + +# Ability to convert a Fl_Pixmap to a Fl_RGB_Image +# http://www.fltk.org/str.php?L2659 +Patch118: http://www.fltk.org/strfiles/2659/pixmap_v2.patch + +# Support for custom cursors +# http://www.fltk.org/str.php?L2660 +Patch119: http://www.fltk.org/strfiles/2660/fltk-1_v5.3.x-cursor.patch + +# Improve modality interaction with WM +# http://www.fltk.org/str.php?L2802 +Patch120: http://www.fltk.org/strfiles/2802/fltk-1_v2.3.0-modal.patch + +# Window icons +# http://www.fltk.org/str.php?L2816 +Patch121: http://www.fltk.org/strfiles/2816/fltk-1_v3.3.0-icons.patch + +# Multihead +# http://fltk.org/str.php?L2860 +Patch122: http://www.fltk.org/strfiles/2860/fltk-1.3.x-screen_num.patch +Patch123: http://www.fltk.org/strfiles/2860/fltk-1_v3.3.x-multihead.patch + +%description +Virtual Network Computing (VNC) is a remote display system which +allows you to view a computing 'desktop' environment not only on the +machine where it is running, but from anywhere on the Internet and +from a wide variety of machine architectures. This package contains a +client which will allow you to connect to other desktops running a VNC +server. + +%package server +Summary: A TigerVNC server +Group: User Interface/X +Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 +Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 +Provides: tightvnc-server = 1.5.0-0.15.20090204svn3586 +Obsoletes: tightvnc-server < 1.5.0-0.15.20090204svn3586 +Requires: perl +Requires: tigervnc-server-minimal +Requires: xorg-x11-xauth + +%description server +The VNC system allows you to access the same desktop from a wide +variety of platforms. This package includes set of utilities +which make usage of TigerVNC server more user friendly. It also +contains x0vncserver program which can export your active +X session. + +%package server-minimal +Summary: A minimal installation of TigerVNC server +Group: User Interface/X +Requires(post): chkconfig +Requires(preun):chkconfig +Requires(preun):initscripts +Requires(postun):initscripts + +Requires: mesa-dri-drivers, xkeyboard-config, xorg-x11-xkb-utils +Requires: tigervnc-license + +%description server-minimal +The VNC system allows you to access the same desktop from a wide +variety of platforms. This package contains minimal installation +of TigerVNC server, allowing others to access the desktop on your +machine. + +%ifnarch s390 s390x %{?rhel:ppc ppc64} +%package server-module +Summary: TigerVNC module to Xorg +Group: User Interface/X +Provides: vnc-server = 4.1.3-2, vnc-libs = 4.1.3-2 +Obsoletes: vnc-server < 4.1.3-2, vnc-libs < 4.1.3-2 +Provides: tightvnc-server-module = 1.5.0-0.15.20090204svn3586 +Obsoletes: tightvnc-server-module < 1.5.0-0.15.20090204svn3586 +Requires: xorg-x11-server-Xorg +Requires: tigervnc-license + +%description server-module +This package contains libvnc.so module to X server, allowing others +to access the desktop on your machine. +%endif + +%package server-applet +Summary: Java TigerVNC viewer applet for TigerVNC server +Group: User Interface/X +Requires: tigervnc-server, java, jpackage-utils +BuildArch: noarch + +%description server-applet +The Java TigerVNC viewer applet for web browsers. Install this package to allow +clients to use web browser when connect to the TigerVNC server. + +%package license +Summary: License of TigerVNC suite +Group: User Interface/X +BuildArch: noarch + +%description license +This package contains license of the TigerVNC suite + +%package icons +Summary: Icons for TigerVNC viewer +Group: User Interface/X +BuildArch: noarch + +%description icons +This package contains icons for TigerVNC viewer + +%prep +%setup -q -n %{name}-%{version}%{?snap:-%{snap}} + +# sed -i -e 's/80/0/g' CMakeLists.txt +%patch4 -p1 -b .cookie +%patch10 -p1 -b .ldnow +%patch11 -p1 -b .gethomedir +%patch13 -p1 -b .rh692048 + +tar xzf %SOURCE11 +pushd fltk-* +%patch110 -p1 -b .keyboard-x11 +%patch111 -p1 -b .keyboard-win32 +%patch112 -p1 -b .keyboard-osx +%patch113 -p1 -b .clipboard +%patch114 -p1 -b .clipboard-x11 +%patch115 -p1 -b .clipboard-win32-fix +%patch116 -p1 -b .clipboard-win32 +%patch117 -p1 -b .clipboard-osx +%patch118 -p1 -b .pixmap +%patch119 -p1 -b .cursor +%patch120 -p1 -b .modal +%patch121 -p1 -b .icons +%patch122 -p1 -b .screen_num +%patch123 -p1 -b .multihead +popd + +cp -r /usr/share/xorg-x11-server-source/* unix/xserver +pushd unix/xserver +for all in `find . -type f -perm -001`; do + chmod -x "$all" +done +patch -p1 -b --suffix .vnc < ../xserver113.patch +popd + +%patch16 -p0 -b .man + +%build +%define tigervnc_src_dir %{_builddir}/%{name}-%{version}%{?snap:-%{snap}} +%define static_lib_buildroot %{tigervnc_src_dir}/build +%ifarch sparcv9 sparc64 s390 s390x +export CFLAGS="$RPM_OPT_FLAGS -fPIC" +%else +export CFLAGS="$RPM_OPT_FLAGS -fpic" +%endif +export CXXFLAGS="$CFLAGS" + +echo "*** Building fltk ***" +pushd fltk-* +%{cmake28} -G"Unix Makefiles" \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DCMAKE_BUILD_TYPE=Release \ + -DOPTION_PREFIX_LIB=%{_libdir} \ + -DOPTION_PREFIX_CONFIG=%{_libdir} \ + -DOPTION_BUILD_EXAMPLES=off \ + -DOPTION_USE_SYSTEM_LIBPNG=on +make %{?_smp_mflags} +popd + +%{cmake28} -G"Unix Makefiles" \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DFLTK_LIBRARIES="%{tigervnc_src_dir}/fltk-1.3.2/lib/libfltk.a;%{tigervnc_src_dir}/fltk-1.3.2/lib/libfltk_images.a;-lpng" \ + -DFLTK_INCLUDE_DIR=%{tigervnc_src_dir}/fltk-1.3.2 +make LDFLAGS="-lpng" %{?_smp_mflags} + +pushd unix/xserver +autoreconf -fiv +%configure \ + --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \ + --disable-xwin --disable-xephyr --disable-kdrive --with-pic \ + --disable-static --disable-xinerama \ + --with-default-font-path="catalogue:%{_sysconfdir}/X11/fontpath.d,built-ins" \ + --with-serverconfig-path=/usr/%{_libdir}/xorg \ + --with-fontrootdir=%{_datadir}/X11/fonts \ + --with-xkb-output=%{_localstatedir}/lib/xkb \ + --enable-install-libxf86config \ + --enable-glx --disable-dri --enable-dri2 \ + --disable-config-dbus \ + --disable-config-hal \ + --disable-config-udev \ + --without-dtrace \ + --disable-unit-tests \ + --disable-docs \ + --disable-devel-docs \ + --disable-selective-werror + +make %{?_smp_mflags} +popd + +# Build icons +pushd media +make +popd + +# Build Java applet +pushd java +%{cmake28} . +make +popd + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT + +pushd unix/xserver/hw/vnc +make install DESTDIR=$RPM_BUILD_ROOT +popd + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/vncserver +install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/vncservers + +# Install desktop stuff +mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,24x24,48x48}/apps + +pushd media/icons +for s in 16 24 48; do +install -m644 tigervnc_$s.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x$s/apps/tigervnc.png +done +popd + +mkdir $RPM_BUILD_ROOT%{_datadir}/applications +desktop-file-install \ + --dir $RPM_BUILD_ROOT%{_datadir}/applications \ + %{SOURCE6} + +# Install Java applet +pushd java +mkdir -p $RPM_BUILD_ROOT%{_datadir}/vnc/classes +install -m755 VncViewer.jar $RPM_BUILD_ROOT%{_datadir}/vnc/classes +install -m644 com/tigervnc/vncviewer/index.vnc $RPM_BUILD_ROOT%{_datadir}/vnc/classes +popd + +%find_lang %{name} %{name}.lang + +# remove unwanted files +rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.la + +%ifarch s390 s390x %{?rhel:ppc ppc64} +rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/extensions/libvnc.so +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +touch -c %{_datadir}/icons/hicolor +if [ -x %{_bindir}/gtk-update-icon-cache ]; then + %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : +fi + +%postun +touch -c %{_datadir}/icons/hicolor +if [ -x %{_bindir}/gtk-update-icon-cache ]; then + %{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor || : +fi + +%post server +/sbin/chkconfig --add vncserver + +%triggerun -- tigervnc-server < 1.0.90-6 +/sbin/service vncserver stop &>/dev/null || : +/sbin/chkconfig --del vncserver >/dev/null 2>&1 || : + +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc README.txt +%{_bindir}/vncviewer +%{_datadir}/applications/* +%{_mandir}/man1/vncviewer.1* + +%files server +%defattr(-,root,root,-) +%config(noreplace) %{_sysconfdir}/sysconfig/vncservers +%config(noreplace) %{_sysconfdir}/init.d/vncserver +%{_bindir}/x0vncserver +%{_bindir}/vncserver +%{_mandir}/man1/vncserver.1* +%{_mandir}/man1/x0vncserver.1* + +%files server-minimal +%defattr(-,root,root,-) +%{_bindir}/vncconfig +%{_bindir}/vncpasswd +%{_bindir}/Xvnc +%{_mandir}/man1/Xvnc.1* +%{_mandir}/man1/vncpasswd.1* +%{_mandir}/man1/vncconfig.1* + +%ifnarch s390 s390x %{?rhel:ppc ppc64} +%files server-module +%defattr(-,root,root,-) +%{_libdir}/xorg/modules/extensions/libvnc.so +%endif + +%files server-applet +%defattr(-,root,root,-) +%doc java/com/tigervnc/vncviewer/README +%{_datadir}/vnc/classes/* + +%files license +%defattr(-,root,root,-) +%doc LICENCE.TXT + +%files icons +%defattr(-,root,root,-) +%{_datadir}/icons/hicolor/*/apps/* + +%changelog +* Thu Nov 28 2013 Brian P. Hinz 1.3.80-17.20131128svn5139 +- Bumped version to 1.3.80 +- Cleaned up linter warnings + +* Thu Jul 05 2013 Brian P. Hinz 1.3.0 +- Upstream 1.3.0 release +- Conditional-ized %snap for release + +* Thu Apr 04 2013 Brian P. Hinz 1.2.90-12.20130524svn5114 +- Improve spec file portability + +* Thu Apr 04 2013 Brian P. Hinz 1.2.80-12.20130330svn5066 +- Adapted from fedora for el6 + +* Thu Mar 14 2013 Adam Tkac - 1.2.80-0.10.20130314svn5065 +- include /etc/X11/xorg.conf.d/10-libvnc.conf sample configuration (#712482) +- vncserver now honors specified -geometry parameter (#755947) + +* Tue Mar 12 2013 Adam Tkac - 1.2.80-0.9.20130307svn5060 +- update to r5060 +- split icons to separate package to avoid multilib issues + +* Thu Jan 24 2013 Adam Tkac 1.2.80-0.8.20130124svn5036 +- update to r5036 (#892351) + +* Wed Jan 16 2013 Adam Tkac 1.2.80-0.7.20121126svn5015 +- rebuild + +* Tue Dec 04 2012 Adam Tkac 1.2.80-0.6.20121126svn5015 +- rebuild against new fltk + +* Mon Nov 26 2012 Adam Tkac 1.2.80-0.5.20121126svn5015 +- update to r5015 +- build with -fpic instead of -fPIC on all archs except s390/sparc + +* Wed Nov 7 2012 Peter Robinson 1.2.80-0.4.20120905svn4996 +- Build with -fPIC to fix FTBFS on ARM + +* Wed Oct 31 2012 Adam Jackson 1.2.80-0.3.20120905svn4996 +- tigervnc12-xorg113-glx.patch: Fix to only init glx on the first server + generation + +* Fri Sep 28 2012 Adam Jackson 1.2.80-0.2.20120905svn4996 +- tigervnc12-xorg113-glx.patch: Re-enable GLX against xserver 1.13 + +* Fri Aug 17 2012 Adam Tkac 1.2.80-0.1.20120905svn4996 +- update to 1.2.80 +- remove deprecated patches + - tigervnc-102434.patch + - tigervnc-viewer-reparent.patch + - tigervnc11-java7.patch +- patches merged + - tigervnc11-xorg111.patch + - tigervnc11-xorg112.patch + +* Fri Aug 10 2012 Dave Airlie 1.1.0-10 +- fix build against newer X server + +* Mon Jul 23 2012 Adam Jackson 1.1.0-9 +- Build with the Composite extension for feature parity with other X servers + +* Sat Jul 21 2012 Fedora Release Engineering - 1.1.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Thu Jul 19 2012 Dave Airlie 1.1.0-7 +- fix building against X.org 1.13 + +* Wed Apr 04 2012 Adam Jackson 1.1.0-6 +- RHEL exclusion for -server-module on ppc* too + +* Mon Mar 26 2012 Adam Tkac - 1.1.0-5 +- clean Xvnc's /tmp environment in service file before startup +- fix building against the latest JAVA 7 and X.Org 1.12 + +* Sat Jan 14 2012 Fedora Release Engineering - 1.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Nov 22 2011 Adam Tkac - 1.1.0-3 +- don't build X.Org devel docs (#755782) +- applet: BR generic java-devel instead of java-gcj-devel (#755783) +- use runuser to start Xvnc in systemd service file (#754259) +- don't attepmt to restart Xvnc session during update/erase (#753216) + +* Fri Nov 11 2011 Adam Tkac - 1.1.0-2 +- libvnc.so: don't use unexported GetMaster function (#744881) +- remove nasm buildreq + +* Mon Sep 12 2011 Adam Tkac - 1.1.0-1 +- update to 1.1.0 +- update the xorg11 patch +- patches merged + - tigervnc11-glx.patch + - tigervnc11-CVE-2011-1775.patch + - 0001-Use-memmove-instead-of-memcpy-in-fbblt.c-when-memory.patch + +* Thu Jul 28 2011 Adam Tkac - 1.0.90-6 +- add systemd service file and remove legacy SysV initscript (#717227) + +* Tue May 12 2011 Adam Tkac - 1.0.90-5 +- make Xvnc buildable against X.Org 1.11 + +* Tue May 10 2011 Adam Tkac - 1.0.90-4 +- viewer can send password without proper validation of X.509 certs + (CVE-2011-1775) + +* Wed Apr 13 2011 Adam Tkac - 1.0.90-3 +- fix wrong usage of memcpy which caused screen artifacts (#652590) +- don't point to inaccessible link in sysconfig/vncservers (#644975) + +* Fri Apr 08 2011 Adam Tkac - 1.0.90-2 +- improve compatibility with vinagre client (#692048) + +* Tue Mar 22 2011 Adam Tkac - 1.0.90-1 +- update to 1.0.90 + +* Wed Feb 09 2011 Fedora Release Engineering - 1.0.90-0.32.20110117svn4237 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 17 2011 Adam Tkac 1.0.90-0.31.20110117svn4237 +- fix libvnc.so module loading + +* Mon Jan 17 2011 Adam Tkac 1.0.90-0.30.20110117svn4237 +- update to r4237 +- patches merged + - tigervnc11-optionsdialog.patch + - tigervnc11-rh607866.patch + +* Fri Jan 14 2011 Adam Tkac 1.0.90-0.29.20101208svn4225 +- improve patch for keyboard issues + +* Fri Jan 14 2011 Adam Tkac 1.0.90-0.28.20101208svn4225 +- attempt to fix various keyboard-related issues (key repeating etc) + +* Fri Jan 07 2011 Adam Tkac 1.0.90-0.27.20101208svn4225 +- render "Ok" and "Cancel" buttons in the options dialog correctly + +* Wed Dec 15 2010 Jan Görig 1.0.90-0.26.20101208svn4225 +- added vncserver lock file (#662784) + +* Fri Dec 10 2010 Adam Tkac 1.0.90-0.25.20101208svn4225 +- update to r4225 +- patches merged + - tigervnc11-rh611677.patch + - tigervnc11-rh633931.patch + - tigervnc11-xorg1.10.patch +- enable VeNCrypt and PAM support + +* Mon Dec 06 2010 Adam Tkac 1.0.90-0.24.20100813svn4123 +- rebuild against xserver 1.10.X +- 0001-Return-Success-from-generate_modkeymap-when-max_keys.patch merged + +* Wed Sep 29 2010 jkeating - 1.0.90-0.23.20100813svn4123 +- Rebuilt for gcc bug 634757 + +* Tue Sep 21 2010 Adam Tkac 1.0.90-0.22.20100420svn4030 +- drop xorg-x11-fonts-misc dependency (#636170) + +* Tue Sep 21 2010 Adam Tkac 1.0.90-0.21.20100420svn4030 +- improve patch for #633645 (fix tcsh incompatibilities) + +* Thu Sep 16 2010 Adam Tkac 1.0.90-0.20.20100813svn4123 +- press fake modifiers correctly (#633931) +- supress unneeded debug information emitted from initscript (#633645) + +* Wed Aug 25 2010 Adam Tkac 1.0.90-0.19.20100813svn4123 +- separate Xvnc, vncpasswd and vncconfig to -server-minimal subpkg (#626946) +- move license to separate subpkg and Requires it from main subpkgs +- Xvnc: handle situations when no modifiers exist well (#611677) + +* Fri Aug 13 2010 Adam Tkac 1.0.90-0.18.20100813svn4123 +- update to r4123 (#617973) +- add perl requires to -server subpkg (#619791) + +* Thu Jul 22 2010 Adam Tkac 1.0.90-0.17.20100721svn4113 +- update to r4113 +- patches merged + - tigervnc11-rh586406.patch + - tigervnc11-libvnc.patch + - tigervnc11-rh597172.patch + - tigervnc11-rh600070.patch + - tigervnc11-options.patch +- don't own %%{_datadir}/icons directory (#614301) +- minor improvements in the .desktop file (#616340) +- bundled libjpeg configure requires nasm; is executed even if system-wide + libjpeg is used + +* Fri Jul 02 2010 Adam Tkac 1.0.90-0.16.20100420svn4030 +- build against system-wide libjpeg-turbo (#494458) +- build no longer requires nasm + +* Mon Jun 28 2010 Adam Tkac 1.0.90-0.15.20100420svn4030 +- vncserver: accept <+optname> option when specified as the first one + +* Thu Jun 24 2010 Adam Tkac 1.0.90-0.14.20100420svn4030 +- fix memory leak in Xvnc input code (#597172) +- don't crash when receive negative encoding (#600070) +- explicitly disable udev configuration support +- add gettext-autopoint to BR + +* Mon Jun 14 2010 Adam Tkac 1.0.90-0.13.20100420svn4030 +- update URL about SSH tunneling in the sysconfig file (#601996) + +* Fri Jun 11 2010 Adam Tkac 1.0.90-0.12.20100420svn4030 +- use newer gettext +- autopoint now uses git instead of cvs, adjust BuildRequires appropriately + +* Thu May 13 2010 Adam Tkac 1.0.90-0.11.20100420svn4030 +- link libvnc.so "now" to catch "undefined symbol" errors during Xorg startup +- use always XkbConvertCase instead of XConvertCase (#580159, #586406) +- don't link libvnc.so against libXi.la, libdix.la and libxkb.la; use symbols + from Xorg instead + +* Thu May 13 2010 Adam Tkac 1.0.90-0.10.20100420svn4030 +- update to r4030 snapshot +- patches merged to upstream + - tigervnc11-rh522369.patch + - tigervnc11-rh551262.patch + - tigervnc11-r4002.patch + - tigervnc11-r4014.patch + +* Thu Apr 08 2010 Adam Tkac 1.0.90-0.9.20100219svn3993 +- add server-applet subpackage which contains Java vncviewer applet +- fix Java applet; it didn't work when run from web browser +- add xorg-x11-xkb-utils to server Requires + +* Fri Mar 12 2010 Adam Tkac 1.0.90-0.8.20100219svn3993 +- add French translation to vncviewer.desktop (thanks to Alain Portal) + +* Thu Mar 04 2010 Adam Tkac 1.0.90-0.7.20100219svn3993 +- don't crash during pixel format change (#522369, #551262) + +* Mon Mar 01 2010 Adam Tkac 1.0.90-0.6.20100219svn3993 +- add mesa-dri-drivers and xkeyboard-config to -server Requires +- update to r3993 1.0.90 snapshot + - tigervnc11-noexecstack.patch merged + - tigervnc11-xorg18.patch merged + - xserver18.patch is no longer needed + +* Wed Jan 27 2010 Jan Gorig 1.0.90-0.5.20091221svn3929 +- initscript LSB compliance fixes (#523974) + +* Fri Jan 22 2010 Adam Tkac 1.0.90-0.4.20091221svn3929 +- mark stack as non-executable in jpeg ASM code +- add xorg-x11-xauth to Requires +- add support for X.Org 1.8 +- drop shave sources, they are no longer needed + +* Thu Jan 21 2010 Adam Tkac 1.0.90-0.3.20091221svn3929 +- drop tigervnc-xorg25909.patch, it has been merged to X.Org upstream + +* Thu Jan 07 2010 Adam Tkac 1.0.90-0.2.20091221svn3929 +- add patch for upstream X.Org issue #25909 +- add libXdmcp-devel to build requires to build Xvnc with XDMCP support (#552322) + +* Mon Dec 21 2009 Adam Tkac 1.0.90-0.1.20091221svn3929 +- update to 1.0.90 snapshot +- patches merged + - tigervnc10-compat.patch + - tigervnc10-rh510185.patch + - tigervnc10-rh524340.patch + - tigervnc10-rh516274.patch + +* Mon Oct 26 2009 Adam Tkac 1.0.0-3 +- create Xvnc keyboard mapping before first keypress (#516274) + +* Thu Oct 08 2009 Adam Tkac 1.0.0-2 +- update underlying X source to 1.6.4-0.3.fc11 +- remove bogus '-nohttpd' parameter from /etc/sysconfig/vncservers (#525629) +- initscript LSB compliance fixes (#523974) +- improve -LowColorSwitch documentation and handling (#510185) +- honor dotWhenNoCursor option (and it's changes) every time (#524340) + +* Fri Aug 28 2009 Adam Tkac 1.0.0-1 +- update to 1.0.0 +- tigervnc10-rh495457.patch merged to upstream + +* Mon Aug 24 2009 Karsten Hopp 0.0.91-0.17 +- fix ifnarch s390x for server-module + +* Fri Aug 21 2009 Tomas Mraz - 0.0.91-0.16 +- rebuilt with new openssl + +* Tue Aug 04 2009 Adam Tkac 0.0.91-0.15 +- make Xvnc compilable + +* Sun Jul 26 2009 Fedora Release Engineering - 0.0.91-0.14.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 13 2009 Adam Tkac 0.0.91-0.13.1 +- don't write warning when initscript is called with condrestart param (#508367) + +* Tue Jun 23 2009 Adam Tkac 0.0.91-0.13 +- temporary use F11 Xserver base to make Xvnc compilable +- BuildRequires: libXi-devel +- don't ship tigervnc-server-module on s390/s390x + +* Mon Jun 22 2009 Adam Tkac 0.0.91-0.12 +- fix local rendering of cursor (#495457) + +* Thu Jun 18 2009 Adam Tkac 0.0.91-0.11 +- update to 0.0.91 (1.0.0 RC1) +- patches merged + - tigervnc10-rh499401.patch + - tigervnc10-rh497592.patch + - tigervnc10-rh501832.patch +- after discusion in upstream drop tigervnc-bounds.patch +- configure flags cleanup + +* Thu May 21 2009 Adam Tkac 0.0.90-0.10 +- rebuild against 1.6.1.901 X server (#497835) +- disable i18n, vncviewer is not UTF-8 compatible (#501832) + +* Mon May 18 2009 Adam Tkac 0.0.90-0.9 +- fix vncpasswd crash on long passwords (#499401) +- start session dbus daemon correctly (#497592) + +* Mon May 11 2009 Adam Tkac 0.0.90-0.8.1 +- remove merged tigervnc-manminor.patch + +* Tue May 05 2009 Adam Tkac 0.0.90-0.8 +- update to 0.0.90 + +* Thu Apr 30 2009 Adam Tkac 0.0.90-0.7.20090427svn3789 +- server package now requires xorg-x11-fonts-misc (#498184) + +* Mon Apr 27 2009 Adam Tkac 0.0.90-0.6.20090427svn3789 +- update to r3789 + - tigervnc-rh494801.patch merged +- tigervnc-newfbsize.patch is no longer needed +- fix problems when vncviewer and Xvnc run on different endianess (#496653) +- UltraVNC and TightVNC clients work fine again (#496786) + +* Wed Apr 08 2009 Adam Tkac 0.0.90-0.5.20090403svn3751 +- workaround broken fontpath handling in vncserver script (#494801) + +* Fri Apr 03 2009 Adam Tkac 0.0.90-0.4.20090403svn3751 +- update to r3751 +- patches merged + - tigervnc-xclients.patch + - tigervnc-clipboard.patch + - tigervnc-rh212985.patch +- basic RandR support in Xvnc (resize of the desktop) +- use built-in libjpeg (SSE2/MMX accelerated encoding on x86 platform) +- use Tight encoding by default +- use TigerVNC icons + +* Tue Mar 03 2009 Adam Tkac 0.0.90-0.3.20090303svn3631 +- update to r3631 + +* Tue Mar 03 2009 Adam Tkac 0.0.90-0.2.20090302svn3621 +- package review related fixes + +* Mon Mar 02 2009 Adam Tkac 0.0.90-0.1.20090302svn3621 +- initial package, r3621 diff --git a/contrib/patches/0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch b/contrib/patches/0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch new file mode 100644 index 00000000..9aac0372 --- /dev/null +++ b/contrib/patches/0001-Add-BUILD_STATIC-feature-from-TigerVNC-to-optionally.patch @@ -0,0 +1,67 @@ +>From 7a15d1c9a908afe429c1aba1c27516d18bdea299 Mon Sep 17 00:00:00 2001 +From: DRC +Date: Tue, 26 Feb 2013 03:37:12 -0600 +Subject: [PATCH 1/4] Add BUILD_STATIC feature from TigerVNC to (optionally) + prevent FLTK from depending on libgcc and libstdc++ + +--- + CMakeLists.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 43 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a1ee285..7d9d94b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -150,6 +150,49 @@ mark_as_advanced(LIB_CAIRO LIB_fontconfig LIB_freetype) + mark_as_advanced(LIB_GL LIB_MesaGL) + mark_as_advanced(LIB_jpeg LIB_png LIB_zlib) + ++# This ensures that we don't depend on libstdc++ or libgcc ++if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND NOT CYGWIN) ++ option(BUILD_STATIC ++ "Link statically against libgcc and libstdc++, if possible" OFF) ++ if(BUILD_STATIC) ++ # For some reason, simply passing ${CMAKE_CXX_FLAGS} to the compiler in ++ # execute_process() doesn't work. Grrr... ++ if(CMAKE_SIZEOF_VOID_P MATCHES 8) ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -m64 ++ --print-file-name=libstdc++.a OUTPUT_VARIABLE LIBSTDCPLUSPLUS ++ RESULT_VARIABLE RESULT) ++ else() ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -m32 ++ --print-file-name=libstdc++.a OUTPUT_VARIABLE LIBSTDCPLUSPLUS ++ RESULT_VARIABLE RESULT) ++ endif() ++ string(REGEX REPLACE "\n" "" LIBSTDCPLUSPLUS ${LIBSTDCPLUSPLUS}) ++ if(RESULT MATCHES 0 AND LIBSTDCPLUSPLUS) ++ message(STATUS "Linking with static libstdc++:\n ${LIBSTDCPLUSPLUS}") ++ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/staticlib) ++ execute_process(COMMAND ${CMAKE_COMMAND} -E remove ++ ${CMAKE_BINARY_DIR}/staticlib/libstdc++.a) ++ if(MINGW) ++ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ++ ${LIBSTDCPLUSPLUS} ${CMAKE_BINARY_DIR}/staticlib/libstdc++.a) ++ else() ++ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ++ ${LIBSTDCPLUSPLUS} ${CMAKE_BINARY_DIR}/staticlib/libstdc++.a) ++ endif() ++ set(CMAKE_EXE_LINKER_FLAGS ++ "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_BINARY_DIR}/staticlib") ++ set(CMAKE_SHARED_LINKER_FLAGS ++ "${CMAKE_SHARED_LINKER_FLAGS} -L${CMAKE_BINARY_DIR}/staticlib") ++ else() ++ message(WARNING Cannot find static libstdc++. TigerVNC will depend on dynamic libstdc++.) ++ endif() ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc") ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc") ++ set(CMAKE_SHARED_LINKER_FLAGS ++ "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc") ++ endif() ++endif() ++ + ####################################################################### + # functions + include(CheckFunctionExists) +-- +1.8.1.3 + diff --git a/contrib/patches/0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch b/contrib/patches/0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch new file mode 100644 index 00000000..6607d578 --- /dev/null +++ b/contrib/patches/0002-Fl_cocoa.mm-depends-on-some-Carbon-functions-so-we-n.patch @@ -0,0 +1,26 @@ +>From bf06cdf83375c11a47bddc3683143b3e2c0fdfcb Mon Sep 17 00:00:00 2001 +From: DRC +Date: Tue, 26 Feb 2013 03:38:45 -0600 +Subject: [PATCH 2/4] Fl_cocoa.mm depends on some Carbon functions, so we need + to include that framework. + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7d9d94b..cae895e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,7 +51,7 @@ if(APPLE) + set(HAVE_STRTOLL 1) + set(HAVE_STRCASECMP 1) + set(HAVE_DIRENT_H 1) +- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa") ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa -framework Carbon") + endif(APPLE) + + if(WIN32) +-- +1.8.1.3 + diff --git a/contrib/patches/0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch b/contrib/patches/0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch new file mode 100644 index 00000000..4d824d75 --- /dev/null +++ b/contrib/patches/0003-We-need-to-unset-CMAKE_REQUIRED_LIBRARIES-after-chec.patch @@ -0,0 +1,30 @@ +>From bb02d8426a9a279df76376313349c17774030753 Mon Sep 17 00:00:00 2001 +From: DRC +Date: Tue, 26 Feb 2013 04:01:36 -0600 +Subject: [PATCH 3/4] We need to unset CMAKE_REQUIRED_LIBRARIES after checking + for the libpng functions. Otherwise, under certain circumstances (known to + be an issue when building on OS X with the in-tree libpng implementation), + the scandir() function check will fail, leaving HAVE_SCANDIR unset, and the + build will subsequently fail. + +--- + CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cae895e..0984aae 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,6 +210,9 @@ if(LIB_png) + endif(LIB_png) + CHECK_FUNCTION_EXISTS(png_get_valid HAVE_PNG_GET_VALID) + CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha HAVE_PNG_SET_TRNS_TO_ALPHA) ++if(LIB_png) ++ set(CMAKE_REQUIRED_LIBRARIES "") ++endif(LIB_png) + + CHECK_FUNCTION_EXISTS(scandir HAVE_SCANDIR) + CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) +-- +1.8.1.3 + diff --git a/contrib/patches/0004-str-2917-fix-macosx-10.6-build-issue.patch b/contrib/patches/0004-str-2917-fix-macosx-10.6-build-issue.patch new file mode 100644 index 00000000..6ebc4089 --- /dev/null +++ b/contrib/patches/0004-str-2917-fix-macosx-10.6-build-issue.patch @@ -0,0 +1,11 @@ +--- fltk-1.3.2.org/src/Fl_cocoa.mm 2013-01-16 11:32:11.788478228 +0100 ++++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-16 11:32:55.824101285 +0100 +@@ -3727,7 +3727,7 @@ CGImageRef Fl_X::CGImage_from_window_rec + CGImageRef img; + if (fl_mac_os_version >= 100500) { + NSBitmapImageRep *bitmap = rect_to_NSBitmapImageRep(win, x, y, w, h); +- img = [bitmap CGImage]; // requires Mac OS 10.5 ++ img = (CGImageRef)[bitmap CGImage]; // requires Mac OS 10.5 + CGImageRetain(img); + [bitmap release]; + } -- 2.39.5