Attempt to repaint entire windows on resize and window move. Updated
window move detection to use proper window position variables.
This commit is contained in:
parent
2e356bb986
commit
1d1e7b1910
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -1,9 +1,11 @@
|
||||
package sig;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.PointerInfo;
|
||||
import java.awt.Toolkit;
|
||||
@ -166,23 +168,17 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent ev) {
|
||||
sigIRC.windowX = sigIRC.window.getX();
|
||||
sigIRC.windowY = sigIRC.window.getY();
|
||||
sigIRC.windowWidth = sigIRC.window.getWidth();
|
||||
sigIRC.windowHeight = sigIRC.window.getHeight();
|
||||
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
||||
sigIRC.config.setInteger("windowY", sigIRC.windowY);
|
||||
sigIRC.config.setInteger("windowWidth", sigIRC.windowWidth);
|
||||
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
|
||||
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
|
||||
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
||||
sigIRC.config.saveProperties();
|
||||
UpdateComponent(ev.getComponent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent ev) {
|
||||
sigIRC.windowX = sigIRC.window.getX();
|
||||
sigIRC.windowY = sigIRC.window.getY();
|
||||
UpdateComponent(ev.getComponent());
|
||||
}
|
||||
|
||||
public static void UpdateComponent(Component com) {
|
||||
sigIRC.windowX = (int)sigIRC.window.getLocationOnScreen().getX();
|
||||
sigIRC.windowY = (int)sigIRC.window.getLocationOnScreen().getY();
|
||||
sigIRC.windowWidth = sigIRC.window.getWidth();
|
||||
sigIRC.windowHeight = sigIRC.window.getHeight();
|
||||
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
||||
@ -191,6 +187,8 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
||||
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
|
||||
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
|
||||
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
||||
com.repaint();
|
||||
sigIRC.panel.repaint();
|
||||
sigIRC.config.saveProperties();
|
||||
}
|
||||
|
||||
|
||||
@ -243,6 +243,7 @@ public class ScrollingText {
|
||||
sigIRC.emoticon_queue.clear();
|
||||
for (Emoticon e : sigIRC.emoticons) {
|
||||
//System.out.println("Checking for emoticon "+e.getEmoteName());
|
||||
try {
|
||||
if (e.getEmoteName().equals(word)) {
|
||||
if (e instanceof SubEmoticon) {
|
||||
SubEmoticon se = (SubEmoticon)e;
|
||||
@ -257,6 +258,9 @@ public class ScrollingText {
|
||||
space = basemsg.indexOf(" ", marker+1);
|
||||
break;
|
||||
}
|
||||
} catch (NullPointerException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
marker=space;
|
||||
} else {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
package sig;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
@ -10,12 +11,29 @@ public class UpdateEvent implements ActionListener{
|
||||
long lasttime = System.currentTimeMillis();
|
||||
int avgfps = 30;
|
||||
int counter = 0;
|
||||
int windowUpdateCounter=30;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
if (ev!=null) {
|
||||
UpdateScrollingText();
|
||||
UpdateAuthenticationCountdownMessage();
|
||||
UpdateWindowPosition();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateWindowPosition() {
|
||||
if (windowUpdateCounter--<=0) {
|
||||
if (sigIRC.lastWindowX!=(int)sigIRC.window.getLocationOnScreen().getX() ||
|
||||
sigIRC.lastWindowY!=(int)sigIRC.window.getLocationOnScreen().getY()) {
|
||||
sigIRC.lastWindowX = (int)sigIRC.window.getLocationOnScreen().getX();
|
||||
sigIRC.lastWindowY = (int)sigIRC.window.getLocationOnScreen().getY();
|
||||
//Trigger Window Update.
|
||||
for (Component c : sigIRC.window.getComponents()) {
|
||||
MyPanel.UpdateComponent(c);
|
||||
}
|
||||
}
|
||||
windowUpdateCounter=30;
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,8 +58,8 @@ public class UpdateEvent implements ActionListener{
|
||||
} else
|
||||
if (last_autosave>=AUTOSAVETIMER) {
|
||||
last_autosave=0;
|
||||
sigIRC.windowX = sigIRC.window.getX();
|
||||
sigIRC.windowY = sigIRC.window.getY();
|
||||
sigIRC.windowX = (int)sigIRC.window.getLocationOnScreen().getX();
|
||||
sigIRC.windowY = (int)sigIRC.window.getLocationOnScreen().getY();
|
||||
sigIRC.windowWidth = sigIRC.window.getWidth();
|
||||
sigIRC.windowHeight = sigIRC.window.getHeight();
|
||||
sigIRC.config.setInteger("windowX", sigIRC.windowX);
|
||||
|
||||
@ -111,6 +111,9 @@ public class sigIRC{
|
||||
public static long channel_id = -1;
|
||||
public static int lastSubEmoteUpdate = -1;
|
||||
|
||||
static int lastWindowX = 0;
|
||||
static int lastWindowY = 0;
|
||||
|
||||
public static Twitch manager = new Twitch();
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user