mirror of https://github.com/adamdruppe/arsd.git
more ime fixes and cursor placement support for embedded termnial
This commit is contained in:
parent
e6eac2c2cf
commit
56fe895a81
20
minigui.d
20
minigui.d
|
@ -3485,6 +3485,20 @@ struct WidgetPainter {
|
|||
this.screenPainter.setFont(font);
|
||||
}
|
||||
|
||||
/++
|
||||
EXPERIMENTAL. subject to change.
|
||||
|
||||
When you draw a cursor, you can draw this to notify your window of where it is,
|
||||
for IME systems to use.
|
||||
+/
|
||||
void notifyCursorPosition(int x, int y, int width, int height) {
|
||||
if(auto a = drawingUpon.parentWindow)
|
||||
if(auto w = a.inputProxy) {
|
||||
w.setIMEPopupLocation(x + screenPainter.originX + width, y + screenPainter.originY + height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
ScreenPainter screenPainter;
|
||||
/// Forward to the screen painter for other methods
|
||||
|
@ -8134,7 +8148,7 @@ class Window : Widget {
|
|||
// for input proxy
|
||||
auto display = XDisplayConnection.get;
|
||||
auto inputProxy = XCreateSimpleWindow(display, win.window, -1, -1, 1, 1, 0, 0, 0);
|
||||
XSelectInput(display, inputProxy, EventMask.KeyPressMask | EventMask.KeyReleaseMask);
|
||||
XSelectInput(display, inputProxy, EventMask.KeyPressMask | EventMask.KeyReleaseMask | EventMask.FocusChangeMask);
|
||||
XMapWindow(display, inputProxy);
|
||||
//import std.stdio; writefln("input proxy: 0x%0x", inputProxy);
|
||||
this.inputProxy = new SimpleWindow(inputProxy);
|
||||
|
@ -11535,6 +11549,10 @@ else version(custom_widgets)
|
|||
alias EditableTextWidgetParent = ScrollableWidget; ///
|
||||
else static assert(0);
|
||||
|
||||
/+
|
||||
This awful thing has to be rewritten. And it needs to takecare of parentWindow.inputProxy.setIMEPopupLocation too
|
||||
+/
|
||||
|
||||
/// Contains the implementation of text editing
|
||||
abstract class EditableTextWidget : EditableTextWidgetParent {
|
||||
this(Widget parent) {
|
||||
|
|
|
@ -28,6 +28,7 @@ class NanoVegaWidget : OpenGlWidget {
|
|||
};
|
||||
|
||||
win.visibleForTheFirstTime = delegate() {
|
||||
win.setAsCurrentOpenGlContext();
|
||||
nvg = nvgCreateContext();
|
||||
if(nvg is null) throw new Exception("cannot initialize NanoVega");
|
||||
};
|
||||
|
|
|
@ -2216,7 +2216,8 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
|||
imePopupLocation = location;
|
||||
updateIMEPopupLocation();
|
||||
} else {
|
||||
throw new NotYetImplementedException();
|
||||
// this is non-fatal at this point... but still wanna find it when i search for NotYetImplementedException at least
|
||||
// throw new NotYetImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4550,8 +4551,8 @@ class NotificationAreaIcon : CapableOfHandlingNativeEvent {
|
|||
case 3: mb = MouseButton.right; break; // right
|
||||
case 4: mb = MouseButton.wheelUp; break; // scroll up
|
||||
case 5: mb = MouseButton.wheelDown; break; // scroll down
|
||||
case 6: break; // idk
|
||||
case 7: break; // idk
|
||||
case 6: break; // scroll left...
|
||||
case 7: break; // scroll right...
|
||||
case 8: mb = MouseButton.backButton; break;
|
||||
case 9: mb = MouseButton.forwardButton; break;
|
||||
default:
|
||||
|
@ -9028,6 +9029,18 @@ struct ScreenPainter {
|
|||
copyActiveOriginals();
|
||||
}
|
||||
|
||||
/++
|
||||
EXPERIMENTAL. subject to change.
|
||||
|
||||
When you draw a cursor, you can draw this to notify your window of where it is,
|
||||
for IME systems to use.
|
||||
+/
|
||||
void notifyCursorPosition(int x, int y, int width, int height) {
|
||||
if(auto w = cast(SimpleWindow) window) {
|
||||
w.setIMEPopupLocation(x + _originX + width, y + _originY + height);
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
If you are using manual invalidations, this informs the
|
||||
window system that a section needs to be redrawn.
|
||||
|
@ -15496,9 +15509,10 @@ version(X11) {
|
|||
|
||||
if(win.setRequestedInputFocus !is null) {
|
||||
auto s = win.setRequestedInputFocus();
|
||||
if(s !is null)
|
||||
if(s !is null) {
|
||||
setTo = s;
|
||||
}
|
||||
}
|
||||
|
||||
assert(setTo !is null);
|
||||
|
||||
|
|
|
@ -4894,6 +4894,8 @@ mixin template SdpyDraw() {
|
|||
}
|
||||
painter.rasterOp = RasterOp.normal;
|
||||
|
||||
painter.notifyCursorPosition(posx, posy, cursorWidth, cursorHeight);
|
||||
|
||||
// since the cursor draws over the cell, we need to make sure it is redrawn each time too
|
||||
auto buffer = alternateScreenActive ? (&alternateScreen) : (&normalScreen);
|
||||
if(cursorX >= 0 && cursorY >= 0 && cursorY < screenHeight && cursorX < screenWidth) {
|
||||
|
|
Loading…
Reference in New Issue