From e1a4be46164489d07c5c6b658c9ab7716d88880f Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 4 Feb 2025 12:44:41 -0500 Subject: [PATCH] Viewer: Add a space after the synchronized keyword This seems to be the more common convention, since synchronized is a keyword (like if or catch) rather than a function. --- java/com/turbovnc/rfb/CConnection.java | 2 +- .../com/turbovnc/vncviewer/BIPixelBuffer.java | 4 +-- java/com/turbovnc/vncviewer/CConn.java | 4 +-- java/com/turbovnc/vncviewer/Viewport.java | 12 ++++---- java/com/turbovnc/vncviewer/VncViewer.java | 30 +++++++++---------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/java/com/turbovnc/rfb/CConnection.java b/java/com/turbovnc/rfb/CConnection.java index e659e8308..8be296303 100644 --- a/java/com/turbovnc/rfb/CConnection.java +++ b/java/com/turbovnc/rfb/CConnection.java @@ -383,7 +383,7 @@ public void fence(int flags, int len, byte[] data) { // We cannot guarantee any synchronisation at this level flags = 0; - synchronized(this) { + synchronized (this) { writer().writeFence(flags, len, data); } } diff --git a/java/com/turbovnc/vncviewer/BIPixelBuffer.java b/java/com/turbovnc/vncviewer/BIPixelBuffer.java index a47b9c490..79fb3b982 100644 --- a/java/com/turbovnc/vncviewer/BIPixelBuffer.java +++ b/java/com/turbovnc/vncviewer/BIPixelBuffer.java @@ -99,7 +99,7 @@ public void imageRect(int x, int y, int w, int h, Object pix) { if (pix instanceof Image) { Image img = (Image)pix; clip = new Rectangle(x, y, w, h); - synchronized(clip) { + synchronized (clip) { tk.prepareImage(img, -1, -1, this); try { clip.wait(1000); @@ -143,7 +143,7 @@ public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, } else { if ((infoflags & ALLBITS) != 0) { if (clip != null) { - synchronized(clip) { + synchronized (clip) { Graphics2D graphics = (Graphics2D)image.getGraphics(); graphics.drawImage(img, clip.x, clip.y, clip.width, clip.height, null); diff --git a/java/com/turbovnc/vncviewer/CConn.java b/java/com/turbovnc/vncviewer/CConn.java index 21169f1d4..6c87182b9 100644 --- a/java/com/turbovnc/vncviewer/CConn.java +++ b/java/com/turbovnc/vncviewer/CConn.java @@ -203,7 +203,7 @@ void deleteWindow(boolean disposeViewport) { // block. public void blockCallback() { try { - synchronized(this) { + synchronized (this) { wait(0, 50000); } } catch (InterruptedException e) { @@ -362,7 +362,7 @@ public void run() { SystemException.checkException(e); throw new SystemException(e); } - synchronized(viewer) { + synchronized (viewer) { viewer.notify(); } } diff --git a/java/com/turbovnc/vncviewer/Viewport.java b/java/com/turbovnc/vncviewer/Viewport.java index ba4fd2a25..5fdf17582 100644 --- a/java/com/turbovnc/vncviewer/Viewport.java +++ b/java/com/turbovnc/vncviewer/Viewport.java @@ -489,7 +489,7 @@ public void setupExtInputHelper() { if (Helper.isAvailable() && cc.cp.supportsGII && x11dpy == 0) { try { if (Utils.isMac()) { - synchronized(VncViewer.class) { + synchronized (VncViewer.class) { setupExtInput(); } } else @@ -597,7 +597,7 @@ public void cleanupExtInputHelper() { } try { if (Utils.isMac()) { - synchronized(VncViewer.class) { + synchronized (VncViewer.class) { cleanupExtInput(); } } else @@ -642,7 +642,7 @@ boolean processExtInputEventHelper(int type) { boolean retval = false; if (Helper.isAvailable() && cc.cp.supportsGII && !Utils.isMac()) { boolean isExtEvent = false; - synchronized(lastEvent) { + synchronized (lastEvent) { try { isExtEvent = processExtInputEvent(type); } catch (UnsatisfiedLinkError e) { @@ -698,7 +698,7 @@ void handleTabletProximityEvent(final boolean enteringProximity, if (devices == null) return; - synchronized(lastEvent) { + synchronized (lastEvent) { if (enteringProximity) { switch (pointingDeviceType) { case 1: // pen @@ -730,7 +730,7 @@ boolean handleTabletEvent(final int type, final double x, final double y, if (devices == null || windowID != x11win) return false; - synchronized(lastEvent) { + synchronized (lastEvent) { if (lastEvent.deviceID < 0) // No prior proximity event was received, so we don't know which // tablet device is generating this event. Punt to the regular @@ -747,7 +747,7 @@ boolean handleTabletEvent(final int type, final double x, final double y, SwingUtilities.invokeLater( new Runnable() { public void run() { - synchronized(lastEvent) { + synchronized (lastEvent) { Dimension winSize = sp.getSize(); java.awt.Point spOffset = sp.getViewport().getViewPosition(); ExtInputDevice dev = null; diff --git a/java/com/turbovnc/vncviewer/VncViewer.java b/java/com/turbovnc/vncviewer/VncViewer.java index 66c3bcfc3..b5ab690f2 100644 --- a/java/com/turbovnc/vncviewer/VncViewer.java +++ b/java/com/turbovnc/vncviewer/VncViewer.java @@ -117,7 +117,7 @@ static class MyInvocationHandler implements InvocationHandler { public Object invoke(Object proxy, Method method, Object[] args) { try { if (method.getName().equals("openFiles") && args[0] != null) { - synchronized(VncViewer.class) { + synchronized (VncViewer.class) { Class ofEventClass = Utils.JAVA_VERSION >= 9 ? Class.forName("java.awt.desktop.OpenFilesEvent") : Class.forName("com.apple.eawt.AppEvent$OpenFilesEvent"); @@ -228,7 +228,7 @@ static void setLookAndFeel() { // This allows us to trap Command-Q and shut things down properly. Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { - synchronized(VncViewer.conns) { + synchronized (VncViewer.conns) { for (CConn cc : VncViewer.conns) cc.close(false); VncViewer.conns.clear(); @@ -274,7 +274,7 @@ static void setGlobalInsets() { if (Utils.isX11()) { frame.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { - synchronized(frame) { + synchronized (frame) { if (frame.isVisible() && frame.getExtendedState() == JFrame.NORMAL) { insets = frame.getInsets(); @@ -285,7 +285,7 @@ public void componentResized(ComponentEvent e) { }); frame.setExtendedState(JFrame.NORMAL); frame.setVisible(true); - synchronized(frame) { + synchronized (frame) { while (insets == null) frame.wait(); } @@ -353,7 +353,7 @@ public static void setBlitterDefaults() { static void startViewer(String[] argv) { VncViewer viewer = new VncViewer(argv); if (Utils.isMac()) { - synchronized(VncViewer.class) { + synchronized (VncViewer.class) { if (fileName != null) { try { Params.load(fileName); @@ -368,7 +368,7 @@ static void startViewer(String[] argv) { } viewer.start(); try { - synchronized(viewer) { + synchronized (viewer) { viewer.wait(); } } catch (InterruptedException e) { @@ -602,7 +602,7 @@ public static void tileWindows() { Rectangle workArea = CConn.getMaxSpannedSize(true); int nTilesX, nTilesY; - synchronized(conns) { + synchronized (conns) { nTilesX = nTilesY = (int)Math.sqrt(conns.size()); if (nTilesX * nTilesY < conns.size()) { nTilesX++; @@ -686,7 +686,7 @@ void reportException(Exception e, boolean reconnect) { if (reconnect && pane.getValue() == dlgOptions[0]) start(); else { - synchronized(this) { + synchronized (this) { this.notify(); } } @@ -795,7 +795,7 @@ else if (opts.port > 0) if (cc == null) { cc = new CConn(this, sock); if (benchFile == null) { - synchronized(conns) { + synchronized (conns) { conns.add(cc); } } @@ -846,7 +846,7 @@ else if (opts.port > 0) cc.state() == CConnection.RFBSTATE_INITIALISATION) cc.close(true); } - synchronized(conns) { + synchronized (conns) { conns.remove(cc); } } @@ -859,13 +859,13 @@ else if (opts.port > 0) if (cc != null) { cc.deleteWindow(true); cc.closeSocket(); - synchronized(conns) { + synchronized (conns) { conns.remove(cc); } } } else { cc.closeSocket(); - synchronized(conns) { + synchronized (conns) { conns.remove(cc); } cc = null; @@ -1027,20 +1027,20 @@ else if (Params.span.getValue().toLowerCase().startsWith("al")) // Is the keyboard grabbed by any TurboVNC Viewer window? public static boolean isKeyboardGrabbed() { - synchronized(VncViewer.class) { + synchronized (VncViewer.class) { return grabOwner != null; } } // Is the keyboard grabbed by a specific TurboVNC Viewer window? public static boolean isKeyboardGrabbed(Viewport viewport) { - synchronized(VncViewer.class) { + synchronized (VncViewer.class) { return grabOwner == viewport; } } public static void setGrabOwner(Viewport viewport) { - synchronized(VncViewer.class) { + synchronized (VncViewer.class) { grabOwner = viewport; } }