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,
pack = false;
}
- if (!pack)
+ if (pack)
viewport.setPreferredSize(new Dimension(w,h));
if (viewport.getExtendedState() == JFrame.MAXIMIZED_BOTH) {
cc = cc_;
setSize(width, height);
im = new PixelBufferImage(width, height, cc, this);
- im.image.setAccelerationPriority(1);
cursor = new Cursor();
cursorBacking = new ManagedPixelBuffer();
// 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);
// 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();
int h = cc.cp.height;
hideLocalCursor();
setSize(w, h);
- synchronized (this) {
+ synchronized (im) {
im.resize(w, h);
}
}
int h = invalidBottom - y;
invalidRect = false;
- synchronized (this) {
+ synchronized (im) {
im.put(x, y, w, h, graphics);
}
}
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);
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);
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()) {
// - 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();
// 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;
}
}
- private void showLocalCursor() {
+ synchronized private void showLocalCursor() {
if (cursorAvailable && !cursorVisible) {
if (!im.getPF().equal(cursor.getPF()) ||
cursor.width() == 0 || cursor.height() == 0) {
// 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