applied dr_evil's maximized patch

This commit is contained in:
Brian Matzon 2012-02-06 20:35:25 +00:00
parent 57798b6727
commit d813fcfaa8
1 changed files with 14 additions and 6 deletions

View File

@ -125,6 +125,7 @@ final class WindowsDisplay implements DisplayImplementation {
private static final int SW_SHOWMINNOACTIVE = 7; private static final int SW_SHOWMINNOACTIVE = 7;
private static final int SW_SHOWDEFAULT = 10; private static final int SW_SHOWDEFAULT = 10;
private static final int SW_RESTORE = 9; private static final int SW_RESTORE = 9;
private static final int SW_MAXIMIZE = 3;
private static final int ICON_SMALL = 0; private static final int ICON_SMALL = 0;
private static final int ICON_BIG = 1; private static final int ICON_BIG = 1;
@ -176,10 +177,11 @@ final class WindowsDisplay implements DisplayImplementation {
private boolean mode_set; private boolean mode_set;
private boolean isMinimized; private boolean isMinimized;
private boolean isFocused; private boolean isFocused;
private boolean did_maximize; private boolean redoMakeContextCurrent;
private boolean inAppActivate; private boolean inAppActivate;
private boolean resized; private boolean resized;
private boolean resizable; private boolean resizable;
private boolean maximized;
private int width; private int width;
private int height; private int height;
@ -202,7 +204,8 @@ final class WindowsDisplay implements DisplayImplementation {
is_dirty = false; is_dirty = false;
isMinimized = false; isMinimized = false;
isFocused = false; isFocused = false;
did_maximize = false; redoMakeContextCurrent = false;
maximized = false;
this.parent = parent; this.parent = parent;
hasParent = parent != null; hasParent = parent != null;
long parent_hwnd = parent != null ? getHwnd(parent) : 0; long parent_hwnd = parent != null ? getHwnd(parent) : 0;
@ -327,11 +330,15 @@ final class WindowsDisplay implements DisplayImplementation {
restoreDisplayMode(); restoreDisplayMode();
} }
if (parent == null) { if (parent == null) {
showWindow(getHwnd(), SW_RESTORE); if(maximized) {
showWindow(getHwnd(), SW_MAXIMIZE);
} else {
showWindow(getHwnd(), SW_RESTORE);
}
setForegroundWindow(getHwnd()); setForegroundWindow(getHwnd());
setFocus(getHwnd()); setFocus(getHwnd());
} }
did_maximize = true; redoMakeContextCurrent = true;
if (Display.isFullscreen()) if (Display.isFullscreen())
updateClipping(); updateClipping();
} else if (Display.isFullscreen()) { } else if (Display.isFullscreen()) {
@ -485,8 +492,8 @@ final class WindowsDisplay implements DisplayImplementation {
if (parent != null && parent.isFocusOwner()) { if (parent != null && parent.isFocusOwner()) {
setFocus(getHwnd()); setFocus(getHwnd());
} }
if (did_maximize) { if (redoMakeContextCurrent) {
did_maximize = false; redoMakeContextCurrent = false;
/** /**
* WORKAROUND: * WORKAROUND:
* Making the context current (redundantly) when the window * Making the context current (redundantly) when the window
@ -867,6 +874,7 @@ final class WindowsDisplay implements DisplayImplementation {
switch ((int)wParam) { switch ((int)wParam) {
case SIZE_RESTORED: case SIZE_RESTORED:
case SIZE_MAXIMIZED: case SIZE_MAXIMIZED:
maximized = ((int)wParam) == SIZE_MAXIMIZED;
resized = true; resized = true;
updateWidthAndHeight(); updateWidthAndHeight();
setMinimized(false); setMinimized(false);