mirror of https://github.com/adamdruppe/arsd.git
more gui
This commit is contained in:
parent
213c441059
commit
d3841ee50f
|
@ -11158,7 +11158,7 @@ class TextLabel : Widget {
|
||||||
override int minWidth() { return 32; }
|
override int minWidth() { return 32; }
|
||||||
|
|
||||||
override int flexBasisHeight() { return minHeight(); }
|
override int flexBasisHeight() { return minHeight(); }
|
||||||
override int flexBasisWidth() { return cast(int) label_.length * 7; }
|
override int flexBasisWidth() { return defaultTextWidth(label); }
|
||||||
|
|
||||||
string label_;
|
string label_;
|
||||||
|
|
||||||
|
@ -11216,9 +11216,10 @@ class TextLabel : Widget {
|
||||||
TextAlignment alignment;
|
TextAlignment alignment;
|
||||||
|
|
||||||
version(custom_widgets)
|
version(custom_widgets)
|
||||||
override void paint(WidgetPainter painter) {
|
override Rectangle paintContent(WidgetPainter painter, const Rectangle bounds) {
|
||||||
painter.outlineColor = getComputedStyle().foregroundColor;
|
painter.outlineColor = getComputedStyle().foregroundColor;
|
||||||
painter.drawText(Point(0, 0), this.label, Point(width, height), alignment);
|
painter.drawText(Point(0, 0), this.label, Point(width, height), alignment);
|
||||||
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1851,7 +1851,7 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
);
|
);
|
||||||
+/
|
+/
|
||||||
}
|
}
|
||||||
// import std.stdio; writeln("Here", MonitorInfo.info);
|
// import std.stdio; writeln("Here", MonitorInfo.info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1894,6 +1894,7 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
|
|
||||||
static MonitorInfo[] info;
|
static MonitorInfo[] info;
|
||||||
}
|
}
|
||||||
|
bool screenPositionKnown;
|
||||||
int screenPositionX;
|
int screenPositionX;
|
||||||
int screenPositionY;
|
int screenPositionY;
|
||||||
void updateActualDpi(bool loadingNow = false) {
|
void updateActualDpi(bool loadingNow = false) {
|
||||||
|
@ -14811,9 +14812,28 @@ version(X11) {
|
||||||
if(auto win = event.window in SimpleWindow.nativeMapping) {
|
if(auto win = event.window in SimpleWindow.nativeMapping) {
|
||||||
//version(sdddd) { import std.stdio; writeln(" w=", event.width, "; h=", event.height); }
|
//version(sdddd) { import std.stdio; writeln(" w=", event.width, "; h=", event.height); }
|
||||||
|
|
||||||
win.screenPositionX = event.x;
|
/+
|
||||||
win.screenPositionY = event.y;
|
The ICCCM says window managers must send a synthetic event when the window
|
||||||
win.updateActualDpi();
|
is moved but NOT when it is resized. In the resize case, an event is sent
|
||||||
|
with position (0, 0) which can be wrong and break the dpi calculations.
|
||||||
|
|
||||||
|
So we only consider the synthetic events from the WM and otherwise
|
||||||
|
need to wait for some other event to get the position which... sucks.
|
||||||
|
|
||||||
|
I'd rather not have windows changing their layout on mouse motion after
|
||||||
|
switching monitors... might be forced to but for now just ignoring it.
|
||||||
|
|
||||||
|
Easiest way to switch monitors without sending a size position is by
|
||||||
|
maximize or fullscreen in a setup like mine, but on most setups those
|
||||||
|
work on the monitor it is already living on, so it should be ok most the
|
||||||
|
time.
|
||||||
|
+/
|
||||||
|
if(event.send_event) {
|
||||||
|
win.screenPositionKnown = true;
|
||||||
|
win.screenPositionX = event.x;
|
||||||
|
win.screenPositionY = event.y;
|
||||||
|
win.updateActualDpi();
|
||||||
|
}
|
||||||
|
|
||||||
recordX11ResizeAsync(display, *win, event.width, event.height);
|
recordX11ResizeAsync(display, *win, event.width, event.height);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue