summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2011-10-12 20:51:05 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2011-10-12 20:51:05 +0000
commit552f3db5f5bf2a4e3af28edad741395e1681e575 (patch)
tree9809ae85f4c8c6f7cdd378c7fa62891f3159d4b2 /java
parent4426f00f07daeae0361dcb13b21474128f98d872 (diff)
downloadtigervnc-552f3db5f5bf2a4e3af28edad741395e1681e575.tar.gz
tigervnc-552f3db5f5bf2a4e3af28edad741395e1681e575.zip
Revert a change from yesterday that broke the viewer (setAccelerationPriority). Fix some more issues with window sizing and scaling. Trying to eliminate unnecessary synchronization.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4725 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java')
-rw-r--r--java/com/tigervnc/vncviewer/CConn.java10
-rw-r--r--java/com/tigervnc/vncviewer/DesktopWindow.java34
-rw-r--r--java/com/tigervnc/vncviewer/PixelBufferImage.java2
3 files changed, 24 insertions, 22 deletions
diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java
index 089d241a..a485f339 100644
--- a/java/com/tigervnc/vncviewer/CConn.java
+++ b/java/com/tigervnc/vncviewer/CConn.java
@@ -85,8 +85,12 @@ class ViewportFrame extends JFrame
sp.setSize(new Dimension(cc.desktop.scaledWidth,
cc.desktop.scaledHeight));
sp.validate();
- if (getExtendedState() != JFrame.MAXIMIZED_BOTH)
- pack();
+ if (getExtendedState() != JFrame.MAXIMIZED_BOTH &&
+ scaleString.equals("FixedRatio")) {
+ int w = cc.desktop.scaledWidth + getInsets().left + getInsets().right;
+ int h = cc.desktop.scaledHeight + getInsets().top + getInsets().bottom;
+ setSize(w, h);
+ }
if (cc.desktop.cursor != null) {
Cursor cursor = cc.desktop.cursor;
cc.setCursor(cursor.width(),cursor.height(),cursor.hotspot,
@@ -512,7 +516,7 @@ public class CConn extends CConnection
pack = false;
}
- if (!pack)
+ if (pack)
viewport.setPreferredSize(new Dimension(w,h));
if (viewport.getExtendedState() == JFrame.MAXIMIZED_BOTH) {
diff --git a/java/com/tigervnc/vncviewer/DesktopWindow.java b/java/com/tigervnc/vncviewer/DesktopWindow.java
index 8bf718b1..978368de 100644
--- a/java/com/tigervnc/vncviewer/DesktopWindow.java
+++ b/java/com/tigervnc/vncviewer/DesktopWindow.java
@@ -55,7 +55,6 @@ class DesktopWindow extends JPanel implements
cc = cc_;
setSize(width, height);
im = new PixelBufferImage(width, height, cc, this);
- im.image.setAccelerationPriority(1);
cursor = new Cursor();
cursorBacking = new ManagedPixelBuffer();
@@ -85,7 +84,7 @@ class DesktopWindow extends JPanel implements
// DesktopWindow has actually been made visible so that getGraphics() ought
// to work.
- public void initGraphics() {
+ synchronized public void initGraphics() {
cc.viewport.g = cc.viewport.getGraphics();
graphics = getComponentGraphics(cc.viewport.g);
prepareImage(im.image, scaledWidth, scaledHeight, this);
@@ -111,8 +110,9 @@ class DesktopWindow extends JPanel implements
// might be being altered by the GUI thread. However it's only a single
// boolean and it doesn't matter if we get the wrong value anyway.
- synchronized(this) {
- if (!cc.viewer.useLocalCursor.getValue()) return;
+ synchronized(cc.viewer.useLocalCursor) {
+ if (!cc.viewer.useLocalCursor.getValue())
+ return;
}
hideLocalCursor();
@@ -211,7 +211,7 @@ class DesktopWindow extends JPanel implements
int h = cc.cp.height;
hideLocalCursor();
setSize(w, h);
- synchronized (this) {
+ synchronized (im) {
im.resize(w, h);
}
}
@@ -224,7 +224,7 @@ class DesktopWindow extends JPanel implements
int h = invalidBottom - y;
invalidRect = false;
- synchronized (this) {
+ synchronized (im) {
im.put(x, y, w, h, graphics);
}
}
@@ -258,7 +258,7 @@ class DesktopWindow extends JPanel implements
final public void fillRect(int x, int y, int w, int h, int pix)
{
if (overlapsCursor(x, y, w, h)) hideLocalCursor();
- synchronized (this) {
+ synchronized (im) {
im.fillRect(x, y, w, h, pix);
}
invalidate(x, y, w, h);
@@ -269,7 +269,7 @@ class DesktopWindow extends JPanel implements
final public void imageRect(int x, int y, int w, int h,
int[] pix) {
if (overlapsCursor(x, y, w, h)) hideLocalCursor();
- synchronized (this) {
+ synchronized (im) {
im.imageRect(x, y, w, h, pix);
}
invalidate(x, y, w, h);
@@ -281,7 +281,7 @@ class DesktopWindow extends JPanel implements
int srcX, int srcY) {
if (overlapsCursor(x, y, w, h) || overlapsCursor(srcX, srcY, w, h))
hideLocalCursor();
- synchronized (this) {
+ synchronized (im) {
im.copyRect(x, y, w, h, srcX, srcY);
}
if (!cc.viewer.fastCopyRect.getValue()) {
@@ -407,7 +407,7 @@ class DesktopWindow extends JPanel implements
// - Render the cursor!
if (e.getX() != cursorPosX || e.getY() != cursorPosY) {
hideLocalCursor();
- synchronized(this) {
+ synchronized(im) {
if (e.getX() >= 0 && e.getX() < im.width() &&
e.getY() >= 0 && e.getY() < im.height()) {
cursorPosX = e.getX();
@@ -473,7 +473,7 @@ class DesktopWindow extends JPanel implements
// Note that mutex MUST be held when hideLocalCursor() and showLocalCursor()
// are called.
- private void hideLocalCursor() {
+ synchronized private void hideLocalCursor() {
// - Blit the cursor backing store over the cursor
if (cursorVisible) {
cursorVisible = false;
@@ -484,7 +484,7 @@ class DesktopWindow extends JPanel implements
}
}
- private void showLocalCursor() {
+ synchronized private void showLocalCursor() {
if (cursorAvailable && !cursorVisible) {
if (!im.getPF().equal(cursor.getPF()) ||
cursor.width() == 0 || cursor.height() == 0) {
@@ -522,15 +522,13 @@ class DesktopWindow extends JPanel implements
// run() is executed by the setColourMapEntriesTimerThread - it sleeps for
// 100ms before actually updating the colourmap.
- public void run() {
+ synchronized public void run() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
- synchronized (this) {
- im.updateColourMap();
- im.put(0, 0, im.width(), im.height(), graphics);
- setColourMapEntriesTimerThread = null;
- }
+ im.updateColourMap();
+ im.put(0, 0, im.width(), im.height(), graphics);
+ setColourMapEntriesTimerThread = null;
}
// access to cc by different threads is specified in CConn
diff --git a/java/com/tigervnc/vncviewer/PixelBufferImage.java b/java/com/tigervnc/vncviewer/PixelBufferImage.java
index bb7e0e48..ef0eed86 100644
--- a/java/com/tigervnc/vncviewer/PixelBufferImage.java
+++ b/java/com/tigervnc/vncviewer/PixelBufferImage.java
@@ -63,7 +63,7 @@ public class PixelBufferImage extends PixelBuffer implements ImageProducer
width_ = w;
height_ = h;
image = desktop.createImage(this);
- //image.setAccelerationPriority(1);
+ image.setAccelerationPriority(1);
data = new int[width() * height()];