diff --git a/SOURCES/tigervnc-check-endianness-when-constructing-platformpixelbuffer.patch b/SOURCES/tigervnc-check-endianness-when-constructing-platformpixelbuffer.patch deleted file mode 100644 index 2accecf..0000000 --- a/SOURCES/tigervnc-check-endianness-when-constructing-platformpixelbuffer.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 86cec815e444842411f82c12b2c039ec455f2179 Mon Sep 17 00:00:00 2001 -From: Jan Grulich -Date: Wed, 8 Aug 2018 15:29:23 +0200 -Subject: Check endianness when constructing PlatformPixelBuffer() - - -diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx -index a2b506df..b5c94d57 100644 ---- a/vncviewer/PlatformPixelBuffer.cxx -+++ b/vncviewer/PlatformPixelBuffer.cxx -@@ -34,8 +34,8 @@ - static rfb::LogWriter vlog("PlatformPixelBuffer"); - - PlatformPixelBuffer::PlatformPixelBuffer(int width, int height) : -- FullFramePixelBuffer(rfb::PixelFormat(32, 24, false, true, -- 255, 255, 255, 16, 8, 0), -+ FullFramePixelBuffer(rfb::PixelFormat(32, 24, ImageByteOrder(fl_display) == MSBFirst, -+ true, 255, 255, 255, 16, 8, 0), - width, height, 0, stride), - Surface(width, height) - #if !defined(WIN32) && !defined(__APPLE__) diff --git a/SOURCES/tigervnc-fix-rendering-on-big-endian-systems.patch b/SOURCES/tigervnc-fix-rendering-on-big-endian-systems.patch new file mode 100644 index 0000000..87a0c79 --- /dev/null +++ b/SOURCES/tigervnc-fix-rendering-on-big-endian-systems.patch @@ -0,0 +1,51 @@ +diff --git a/vncviewer/Surface_X11.cxx b/vncviewer/Surface_X11.cxx +index 3523da3..6562634 100644 +--- a/vncviewer/Surface_X11.cxx ++++ b/vncviewer/Surface_X11.cxx +@@ -109,6 +109,7 @@ void Surface::blend(Surface* dst, int src_x, int src_y, int x, int y, int w, int + + void Surface::alloc() + { ++ XRenderPictFormat templ; + XRenderPictFormat* format; + + // Might not be open at this point +@@ -117,7 +118,37 @@ void Surface::alloc() + pixmap = XCreatePixmap(fl_display, XDefaultRootWindow(fl_display), + width(), height(), 32); + +- format = XRenderFindStandardFormat(fl_display, PictStandardARGB32); ++ // Our code assumes a BGRA byte order, regardless of what the endian ++ // of the machine is or the native byte order of XImage, so make sure ++ // we find such a format ++ templ.type = PictTypeDirect; ++ templ.depth = 32; ++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++ templ.direct.alpha = 0; ++ templ.direct.red = 8; ++ templ.direct.green = 16; ++ templ.direct.blue = 24; ++#else ++ templ.direct.alpha = 24; ++ templ.direct.red = 16; ++ templ.direct.green = 8; ++ templ.direct.blue = 0; ++#endif ++ templ.direct.alphaMask = 0xff; ++ templ.direct.redMask = 0xff; ++ templ.direct.greenMask = 0xff; ++ templ.direct.blueMask = 0xff; ++ ++ format = XRenderFindFormat(fl_display, PictFormatType | PictFormatDepth | ++ PictFormatRed | PictFormatRedMask | ++ PictFormatGreen | PictFormatGreenMask | ++ PictFormatBlue | PictFormatBlueMask | ++ PictFormatAlpha | PictFormatAlphaMask, ++ &templ, 0); ++ ++ if (!format) ++ throw rdr::Exception("XRenderFindFormat"); ++ + picture = XRenderCreatePicture(fl_display, pixmap, format, 0, NULL); + + visFormat = XRenderFindVisualFormat(fl_display, fl_visual->visual); diff --git a/SOURCES/tigervnc-kill-session-after-logout.patch b/SOURCES/tigervnc-kill-session-after-logout.patch deleted file mode 100644 index da265d0..0000000 --- a/SOURCES/tigervnc-kill-session-after-logout.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/unix/vncserver b/unix/vncserver -index b6e18c2..6b07218 100755 ---- a/unix/vncserver -+++ b/unix/vncserver -@@ -63,7 +63,8 @@ $defaultXStartup - = ("#!/bin/sh\n\n". - "unset SESSION_MANAGER\n". - "unset DBUS_SESSION_BUS_ADDRESS\n". -- "exec /etc/X11/xinit/xinitrc\n"); -+ "/etc/X11/xinit/xinitrc\n". -+ "vncserver -kill \$DISPLAY\n"); - - $defaultConfig - = ("## Supported server options to pass to vncserver upon invocation can be listed\n". diff --git a/SOURCES/tigervnc-reduce-size-of-context-menu-hint.patch b/SOURCES/tigervnc-reduce-size-of-context-menu-hint.patch new file mode 100644 index 0000000..6923213 --- /dev/null +++ b/SOURCES/tigervnc-reduce-size-of-context-menu-hint.patch @@ -0,0 +1,50 @@ +From 9fbf94db8b85eeee1d233089243a0da71f5b544f Mon Sep 17 00:00:00 2001 +From: Pierre Ossman +Date: Thu, 19 Jul 2018 13:10:08 +0200 +Subject: Reduce size of context menu hint + +It can get a bit intrusive for experienced users, so try to reduce +the impact of it. + +diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx +index e8750b4e..d5edfb87 100644 +--- a/vncviewer/DesktopWindow.cxx ++++ b/vncviewer/DesktopWindow.cxx +@@ -498,6 +498,9 @@ void DesktopWindow::menuOverlay(void* data) + + void DesktopWindow::setOverlay(const char* text, ...) + { ++ const Fl_Fontsize fontsize = 16; ++ const int margin = 10; ++ + va_list ap; + char textbuf[1024]; + +@@ -528,22 +531,22 @@ void DesktopWindow::setOverlay(const char* text, ...) + fl_gc = XDefaultGC(fl_display, 0); + #endif + +- fl_font(FL_HELVETICA, FL_NORMAL_SIZE * 2); ++ fl_font(FL_HELVETICA, fontsize); + w = 0; + fl_measure(textbuf, w, h); + + // Margins +- w += 80; +- h += 40; ++ w += margin * 2 * 2; ++ h += margin * 2; + + surface = new Fl_Image_Surface(w, h); + surface->set_current(); + + fl_rectf(0, 0, w, h, 0, 0, 0); + +- fl_font(FL_HELVETICA, FL_NORMAL_SIZE * 2); ++ fl_font(FL_HELVETICA, fontsize); + fl_color(FL_WHITE); +- fl_draw(textbuf, 40, 20 + fl_height() - fl_descent()); ++ fl_draw(textbuf, 0, 0, w, h, FL_ALIGN_CENTER); + + imageText = surface->image(); + delete surface; diff --git a/SOURCES/tigervnc-release-pointer-grab-when-cursor-leaves-window.patch b/SOURCES/tigervnc-release-pointer-grab-when-cursor-leaves-window.patch new file mode 100644 index 0000000..3002876 --- /dev/null +++ b/SOURCES/tigervnc-release-pointer-grab-when-cursor-leaves-window.patch @@ -0,0 +1,182 @@ +diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx +index f5ae425..cec8a68 100644 +--- a/vncviewer/DesktopWindow.cxx ++++ b/vncviewer/DesktopWindow.cxx +@@ -65,6 +65,7 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name, + : Fl_Window(w, h), cc(cc_), offscreen(NULL), overlay(NULL), + firstUpdate(true), + delayedFullscreen(false), delayedDesktopSize(false), ++ keyboardGrabbed(false), mouseGrabbed(false), + statsLastFrame(0), statsLastPixels(0), statsLastPosition(0), + statsGraph(NULL) + { +@@ -630,9 +631,18 @@ int DesktopWindow::handle(int event) + break; + + case FL_ENTER: ++ if (keyboardGrabbed) ++ grabPointer(); + case FL_LEAVE: + case FL_DRAG: + case FL_MOVE: ++ // We don't get FL_LEAVE with a grabbed pointer, so check manually ++ if (mouseGrabbed) { ++ if ((Fl::event_x() < 0) || (Fl::event_x() >= w()) || ++ (Fl::event_y() < 0) || (Fl::event_y() >= h())) { ++ ungrabPointer(); ++ } ++ } + if (fullscreen_active()) { + if (((viewport->x() < 0) && (Fl::event_x() < EDGE_SCROLL_SIZE)) || + ((viewport->x() + viewport->w() > w()) && (Fl::event_x() > w() - EDGE_SCROLL_SIZE)) || +@@ -677,6 +687,16 @@ int DesktopWindow::fltkHandle(int event, Fl_Window *win) + case FL_UNFOCUS: + dw->ungrabKeyboard(); + break; ++ ++ case FL_RELEASE: ++ // We usually fail to grab the mouse if a mouse button was ++ // pressed when we gained focus (e.g. clicking on our window), ++ // so we may need to try again when the button is released. ++ // (We do it here rather than handle() because a window does not ++ // see FL_RELEASE events if a child widget grabs it first) ++ if (dw->keyboardGrabbed && !dw->mouseGrabbed) ++ dw->grabPointer(); ++ break; + } + } + +@@ -757,14 +777,18 @@ void DesktopWindow::grabKeyboard() + int ret; + + ret = win32_enable_lowlevel_keyboard(fl_xid(this)); +- if (ret != 0) ++ if (ret != 0) { + vlog.error(_("Failure grabbing keyboard")); ++ return; ++ } + #elif defined(__APPLE__) + int ret; + + ret = cocoa_capture_display(this, fullScreenAllMonitors); +- if (ret != 0) ++ if (ret != 0) { + vlog.error(_("Failure grabbing keyboard")); ++ return; ++ } + #else + int ret; + +@@ -784,18 +808,9 @@ void DesktopWindow::grabKeyboard() + } else { + vlog.error(_("Failure grabbing keyboard")); + } ++ return; + } + +- // We also need to grab the pointer as some WMs like to grab buttons +- // combined with modifies (e.g. Alt+Button0 in metacity). +- ret = XGrabPointer(fl_display, fl_xid(this), True, +- ButtonPressMask|ButtonReleaseMask| +- ButtonMotionMask|PointerMotionMask, +- GrabModeAsync, GrabModeAsync, +- None, None, CurrentTime); +- if (ret) +- vlog.error(_("Failure grabbing mouse")); +- + // Xorg 1.20+ generates FocusIn/FocusOut even when there is no actual + // change of focus. This causes us to get stuck in an endless loop + // grabbing and ungrabbing the keyboard. Avoid this by filtering out +@@ -806,6 +821,11 @@ void DesktopWindow::grabKeyboard() + vlog.debug("Ignored synthetic focus event cause by grab change"); + } + #endif ++ ++ keyboardGrabbed = true; ++ ++ if (contains(Fl::belowmouse())) ++ grabPointer(); + } + + +@@ -813,6 +833,10 @@ void DesktopWindow::ungrabKeyboard() + { + Fl::remove_timeout(handleGrab, this); + ++ keyboardGrabbed = false; ++ ++ ungrabPointer(); ++ + #if defined(WIN32) + win32_disable_lowlevel_keyboard(fl_xid(this)); + #elif defined(__APPLE__) +@@ -827,7 +851,6 @@ void DesktopWindow::ungrabKeyboard() + + serial = XNextRequest(fl_display); + +- XUngrabPointer(fl_display, CurrentTime); + XUngrabKeyboard(fl_display, CurrentTime); + + // See grabKeyboard() +@@ -839,6 +862,38 @@ void DesktopWindow::ungrabKeyboard() + #endif + } + ++void DesktopWindow::grabPointer() ++{ ++#if !defined(WIN32) && !defined(__APPLE__) ++ int ret; ++ ++ // We also need to grab the pointer as some WMs like to grab buttons ++ // combined with modifies (e.g. Alt+Button0 in metacity). ++ ret = XGrabPointer(fl_display, fl_xid(this), True, ++ ButtonPressMask|ButtonReleaseMask| ++ ButtonMotionMask|PointerMotionMask, ++ GrabModeAsync, GrabModeAsync, ++ None, None, CurrentTime); ++ if (ret) { ++ // Having a button pressed prevents us from grabbing, we make ++ // a new attempt in fltkHandle() ++ if (ret == AlreadyGrabbed) ++ return; ++ vlog.error(_("Failure grabbing mouse")); ++ return; ++ } ++#endif ++ ++ mouseGrabbed = true; ++} ++ ++void DesktopWindow::ungrabPointer() ++{ ++ mouseGrabbed = false; ++#if !defined(WIN32) && !defined(__APPLE__) ++ XUngrabPointer(fl_display, CurrentTime); ++#endif ++} + + void DesktopWindow::handleGrab(void *data) + { +diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h +index 4224699..2135be8 100644 +--- a/vncviewer/DesktopWindow.h ++++ b/vncviewer/DesktopWindow.h +@@ -84,6 +84,8 @@ private: + + void grabKeyboard(); + void ungrabKeyboard(); ++ void grabPointer(); ++ void ungrabPointer(); + + static void handleGrab(void *data); + +@@ -120,6 +122,9 @@ private: + bool delayedFullscreen; + bool delayedDesktopSize; + ++ bool keyboardGrabbed; ++ bool mouseGrabbed; ++ + struct statsEntry { + unsigned fps; + unsigned pps; diff --git a/SOURCES/tigervnc-xstartup.patch b/SOURCES/tigervnc-xstartup.patch index 38440d1..740c583 100644 --- a/SOURCES/tigervnc-xstartup.patch +++ b/SOURCES/tigervnc-xstartup.patch @@ -1,7 +1,8 @@ -diff -up tigervnc-1.3.0/unix/vncserver.xstartup tigervnc-1.3.0/unix/vncserver ---- tigervnc-1.3.0/unix/vncserver.xstartup 2014-02-10 14:52:39.902673875 +0000 -+++ tigervnc-1.3.0/unix/vncserver 2014-02-10 14:53:30.398847723 +0000 -@@ -59,27 +59,7 @@ $defaultXStartup +diff --git a/unix/vncserver b/unix/vncserver +index bb4f2feb..b038dd3b 100755 +--- a/unix/vncserver ++++ b/unix/vncserver +@@ -58,27 +58,14 @@ $defaultXStartup = ("#!/bin/sh\n\n". "unset SESSION_MANAGER\n". "unset DBUS_SESSION_BUS_ADDRESS\n". @@ -26,8 +27,14 @@ diff -up tigervnc-1.3.0/unix/vncserver.xstartup tigervnc-1.3.0/unix/vncserver - "xsetroot -solid grey\n". - "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n". - "twm &\n"); -+ "exec /etc/X11/xinit/xinitrc\n"); - ++ "/etc/X11/xinit/xinitrc\n". ++ "# Assume either Gnome or KDE will be started by default when installed\n". ++ "# We want to kill the session automatically in this case when user logs out. In case you modify\n". ++ "# /etc/X11/xinit/Xclients or ~/.Xclients yourself to achieve a different result, then you should\n". ++ "# be responsible to modify below code to avoid that your session will be automatically killed\n". ++ "if [ -e /usr/bin/gnome-session -o -e /usr/bin/startkde ]; then\n". ++ " vncserver -kill \$DISPLAY\n". ++ "fi\n"); + $defaultConfig = ("## Supported server options to pass to vncserver upon invocation can be listed\n". - diff --git a/SPECS/tigervnc.spec b/SPECS/tigervnc.spec index 04ac796..25460ce 100644 --- a/SPECS/tigervnc.spec +++ b/SPECS/tigervnc.spec @@ -1,6 +1,6 @@ Name: tigervnc Version: 1.8.0 -Release: 13%{?dist} +Release: 17%{?dist} Summary: A TigerVNC remote display system Group: User Interface/Desktops @@ -56,12 +56,13 @@ Patch8: tigervnc-1.3.1-do-not-die-when-port-is-already-taken.patch Patch9: tigervnc-let-user-know-about-not-using-view-only-password.patch Patch10: tigervnc-working-tls-on-fips-systems.patch Patch11: tigervnc-broken-scrolling.patch -Patch12: tigervnc-kill-session-after-logout.patch +Patch12: tigervnc-reduce-size-of-context-menu-hint.patch Patch13: tigervnc-support-xorg120.patch Patch14: tigervnc-ignore-fake-focus-events-from-xgrabkeyboard.patch Patch15: tigervnc-use-current-server-time-for-ungrab.patch -Patch16: tigervnc-check-endianness-when-constructing-platformpixelbuffer.patch +Patch16: tigervnc-fix-rendering-on-big-endian-systems.patch Patch17: tigervnc-xvnc-update-manpage.patch +Patch18: tigervnc-release-pointer-grab-when-cursor-leaves-window.patch # This is tigervnc-%{version}/unix/xserver116.patch rebased on the latest xorg Patch100: tigervnc-xserver120.patch @@ -179,6 +180,7 @@ popd %patch4 -p1 -b .cursor # Clearer xstartup file (bug #923655). +# Bug 1646889 - Tigervnc not starting on RHEL 7.6 server without -noxstartup option %patch6 -p1 -b .xstartup # CVE-2014-8240 tigervnc: integer overflow flaw, leading to a heap-based @@ -197,8 +199,7 @@ popd # Bug 1499018 - bump scrolling is broken in tigervnc 1.8.0 %patch11 -p1 -b .broken-scrolling -# Bug 1259757 - unable to log out from vnc session -%patch12 -p1 -b .kill-session-after-logout +%patch12 -p1 -b .reduce-size-of-context-menu-hint %patch13 -p1 -b .support-xorg120 @@ -206,10 +207,12 @@ popd %patch15 -p1 -b .use-current-server-time-for-ungrab -%patch16 -p1 -b .check-endianness-when-constructing-platformpixelbuffer +%patch16 -p1 -b .fix-rendering-on-big-endian-systems %patch17 -p1 -b .xvnc-update-manpage +%patch18 -p1 -b .release-pointer-grab-when-cursor-leaves-window + %build %ifarch sparcv9 sparc64 s390 s390x export CFLAGS="$RPM_OPT_FLAGS -fPIC" @@ -373,10 +376,29 @@ fi %{_datadir}/icons/hicolor/*/apps/* %changelog +* Mon Feb 18 2019 Jan Grulich - 1.8.0-17 +- Release pointer grab when cursor leaves window + Resolves: bz#1664801 + +* Mon Jan 21 2019 Jan Grulich - 1.8.0-16 +- Automatically kill session only when gnome or kde is installed + Resolves: bz#1646889 + +* Mon Jan 14 2019 Jan Grulich - 1.8.0-15 +- Reduce size of context menu hint + Resolves: bz#1491608 + +* Mon Jan 14 2019 Jan Grulich - 1.8.0-14 +- Fix rendering on big endian system + Resolves: bz#1618777 + + Do not automatically kill sessions + Resolves: bz#1646889 + * Wed Aug 29 2018 Jan Grulich - 1.8.0-13 - Add one remaining option to Xvnc manpage Resolves: bz#1601880 - + * Wed Aug 29 2018 Jan Grulich - 1.8.0-12 - Add missing options to Xvnc manpage Resolves: bz#1601880