Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ long gtk_draw (long widget, long cairo) {
return result;
}

@Override
void gtk4_draw (long widget, long cairo, Rectangle bounds) {
if ((state & OBSCURED) != 0) return;
super.gtk4_draw (widget, cairo, bounds);
drawCaretInFocus(widget, cairo);
}

void drawCaretInFocus(long widget, long cairo) {
/*
* blink is needed to be checked as gtk_draw() signals sent from other parts of the canvas
Expand All @@ -197,7 +204,9 @@ private void drawCaret(long widget, long cairo) {
Cairo.cairo_save(cairo);

if (caret.image != null && !caret.image.isDisposed() && caret.image.mask == 0) {
Cairo.cairo_set_source_rgb(cairo, 1, 1, 1);
if (!GTK.GTK4) {
Cairo.cairo_set_source_rgb(cairo, 1, 1, 1);
}
Cairo.cairo_set_operator(cairo, Cairo.CAIRO_OPERATOR_DIFFERENCE);
long surface = Cairo.cairo_get_target(cairo);
int nWidth = 0;
Expand All @@ -215,7 +224,9 @@ private void drawCaret(long widget, long cairo) {
Cairo.cairo_set_source_surface(cairo, caret.image.surface, 0, 0);
Cairo.cairo_paint(cairo);
} else {
Cairo.cairo_set_source_rgb(cairo, 1, 1, 1);
if (!GTK.GTK4) {
Cairo.cairo_set_source_rgb(cairo, 1, 1, 1);
}
Cairo.cairo_set_operator(cairo, Cairo.CAIRO_OPERATOR_DIFFERENCE);
int nWidth = caret.width, nHeight = caret.height;
if (nWidth <= 0) nWidth = Caret.DEFAULT_WIDTH;
Expand Down Expand Up @@ -248,6 +259,15 @@ long gtk_focus_out_event (long widget, long event) {
return result;
}

@Override
void gtk4_focus_window_event(long handle, long event) {
if(event == SWT.FocusIn) {
gtk_focus_in_event (handle, event);
if (caret != null) caret.setFocus ();
}
else gtk_focus_out_event(handle, event);
}

@Override
long gtk_preedit_changed (long imcontext) {
if (ime != null) {
Expand Down
Loading