[education/rkward] rkward/rbackend/rkwarddevice: Fix integer divisions (thanks to aacid)

Thomas Friedrichsmeier null at kde.org
Mon Mar 28 12:10:22 BST 2022


Git commit d3127c6b07643c1db14d8608dc83eaad374f91b8 by Thomas Friedrichsmeier.
Committed on 28/03/2022 at 11:10.
Pushed by tfry into branch 'master'.

Fix integer divisions (thanks to aacid)

M  +2    -2    rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp

https://invent.kde.org/education/rkward/commit/d3127c6b07643c1db14d8608dc83eaad374f91b8

diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
index 744373d5..9b76d8ef 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
@@ -35,7 +35,7 @@
 
 #include "../../debug.h"
 
-double RKGraphicsDeviceFrontendTransmitter::lwdscale = 72/96;
+double RKGraphicsDeviceFrontendTransmitter::lwdscale = 72.0/96;
 RKGraphicsDeviceFrontendTransmitter::RKGraphicsDeviceFrontendTransmitter () : QObject () {
 	RK_TRACE (GRAPHICS_DEVICE);
 
@@ -265,7 +265,7 @@ void RKGraphicsDeviceFrontendTransmitter::newData () {
 					RK_DEBUG (GRAPHICS_DEVICE, DL_INFO, "DPI for device %d: %d by %d", devnum+1, desktop->physicalDpiX (), desktop->physicalDpiY ());
 					streamer.writeOutBuffer ();
 					// Actually, this is only needed once, but where to put it...
-					RKGraphicsDeviceFrontendTransmitter::lwdscale = desktop->physicalDpiX () / 96;   // taken from devX11.c
+					RKGraphicsDeviceFrontendTransmitter::lwdscale = ((double) desktop->physicalDpiX()) / 96;   // taken from devX11.c
 				} else {
 					if (devnum) RK_DEBUG (GRAPHICS_DEVICE, DL_ERROR, "Received transmission of type %d for unknown device number %d. Skipping.", opcode, devnum+1);
 					sendDummyReply (opcode);


More information about the rkward-tracker mailing list