comparison src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java @ 432:a80d190a9fc1

trying to fix fitScreen
author Nozomi
date Wed, 08 Jun 2016 21:18:38 +0900
parents 7eaa95ca7e45
children ff7fa81f3616
comparison
equal deleted inserted replaced
431:7eaa95ca7e45 432:a80d190a9fc1
879 879
880 final JButton fitScreenButton = buttonsBar.createButton("fit-screen", "Fit Screen", new ActionListener() { 880 final JButton fitScreenButton = buttonsBar.createButton("fit-screen", "Fit Screen", new ActionListener() {
881 @Override 881 @Override
882 public void actionPerformed(ActionEvent e) { 882 public void actionPerformed(ActionEvent e) {
883 fitScreen(); 883 fitScreen();
884 /*
884 if (!viewer.getRfb().isTreeManager()) { 885 if (!viewer.getRfb().isTreeManager()) {
885 context.sendMessage(new RequestSingleDisplaySize()); 886 context.sendMessage(new RequestSingleDisplaySize());
886 } 887 }
888 */
887 } 889 }
888 }); 890 });
889 891
890 ModifierButtonEventListener modifierButtonListener = new ModifierButtonEventListener(); 892 ModifierButtonEventListener modifierButtonListener = new ModifierButtonEventListener();
891 modifierButtonListener.addButton(KeyEvent.VK_CONTROL, ctrlButton); 893 modifierButtonListener.addButton(KeyEvent.VK_CONTROL, ctrlButton);
1012 int thatScreenY = (int) presenter.getY(); 1014 int thatScreenY = (int) presenter.getY();
1013 1015
1014 int singleWidth = viewer.getRfb().getSingleWidth() * viewer.getRfb().getRetinaScale(); 1016 int singleWidth = viewer.getRfb().getSingleWidth() * viewer.getRfb().getRetinaScale();
1015 int singleHeight = viewer.getRfb().getSingleHeight() * viewer.getRfb().getRetinaScale(); 1017 int singleHeight = viewer.getRfb().getSingleHeight() * viewer.getRfb().getRetinaScale();
1016 frame.setSize(thisScreenWidth, thisScreenHeight); 1018 frame.setSize(thisScreenWidth, thisScreenHeight);
1017 Rectangle visible = new Rectangle(thatScreenX,thatScreenY,thisScreenWidth,thisScreenHeight);
1018 scroller.scrollRectToVisible(visible);
1019 uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, singleWidth, singleHeight); 1019 uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, singleWidth, singleHeight);
1020 final Rectangle visible = new Rectangle(thatScreenX,thatScreenY,thisScreenWidth,thisScreenHeight);
1021 SwingUtilities.invokeLater(new Runnable(){
1022 public void run() {
1023 scroller.scrollRectToVisible(visible);
1024 }
1025 });
1020 } 1026 }
1021 1027
1022 private void sendCtrlAltDel(ProtocolContext context) { 1028 private void sendCtrlAltDel(ProtocolContext context) {
1023 context.sendMessage(new KeyEventMessage(Keymap.K_CTRL_LEFT, true)); 1029 context.sendMessage(new KeyEventMessage(Keymap.K_CTRL_LEFT, true));
1024 context.sendMessage(new KeyEventMessage(Keymap.K_ALT_LEFT, true)); 1030 context.sendMessage(new KeyEventMessage(Keymap.K_ALT_LEFT, true));