mirror of https://github.com/adamdruppe/arsd.git
more helpers for x migration stuff
This commit is contained in:
parent
922635a5dd
commit
29789f61bf
13
minigui.d
13
minigui.d
|
@ -1131,6 +1131,13 @@ class Widget {
|
||||||
foreach(child; children)
|
foreach(child; children)
|
||||||
child.discardXConnectionState();
|
child.discardXConnectionState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void recreateXConnectionState() {
|
||||||
|
|
||||||
|
foreach(child; children)
|
||||||
|
child.discardXConnectionState();
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -2482,6 +2489,12 @@ class Window : Widget {
|
||||||
|
|
||||||
///
|
///
|
||||||
this(SimpleWindow win) {
|
this(SimpleWindow win) {
|
||||||
|
|
||||||
|
static if(UsingSimpledisplayX11) {
|
||||||
|
win.discardAdditionalConnectionState = &discardXConnectionState;
|
||||||
|
win.recreateAdditionalConnectionState = &recreateXConnectionState;
|
||||||
|
}
|
||||||
|
|
||||||
tabStop = false;
|
tabStop = false;
|
||||||
super(null);
|
super(null);
|
||||||
this.win = win;
|
this.win = win;
|
||||||
|
|
|
@ -1073,15 +1073,29 @@ class SimpleWindow : CapableOfHandlingNativeEvent {
|
||||||
if(_parent !is null && _parent.stateDiscarded)
|
if(_parent !is null && _parent.stateDiscarded)
|
||||||
_parent.recreateAfterDisconnect();
|
_parent.recreateAfterDisconnect();
|
||||||
|
|
||||||
|
bool wasHidden = hidden;
|
||||||
|
|
||||||
|
activeScreenPainter = null; // should already be done but just to confirm
|
||||||
|
|
||||||
impl.createWindow(_width, _height, _title, openglMode, _parent);
|
impl.createWindow(_width, _height, _title, openglMode, _parent);
|
||||||
|
|
||||||
|
if(recreateAdditionalConnectionState)
|
||||||
|
recreateAdditionalConnectionState();
|
||||||
|
|
||||||
|
hidden = wasHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool stateDiscarded;
|
bool stateDiscarded;
|
||||||
void discardConnectionState() {
|
void discardConnectionState() {
|
||||||
if(XDisplayConnection.display)
|
if(XDisplayConnection.display)
|
||||||
impl.dispose(); // if display is already null, it is hopeless to try to destroy stuff on it anyway
|
impl.dispose(); // if display is already null, it is hopeless to try to destroy stuff on it anyway
|
||||||
|
if(discardAdditionalConnectionState)
|
||||||
|
discardAdditionalConnectionState();
|
||||||
stateDiscarded = true;
|
stateDiscarded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void delegate() discardAdditionalConnectionState;
|
||||||
|
void delegate() recreateAdditionalConnectionState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue