Skip to content

Commit

Permalink
cursor fix; conditional flags for IME support until it lands upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatao Li committed Jul 22, 2021
1 parent 4adeb99 commit 6a39e69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Views/Cursor.xaml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type Cursor() as this =
(* reconfigure the cursor *)
showCursor true
cursorTimerRun blinkon this.ViewModel.blinkwait
// this.InvalidateVisual()
this.InvalidateVisual()

let setCursorAnimation() =
let transitions = Transitions()
Expand Down
4 changes: 4 additions & 0 deletions Views/Grid.xaml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,11 @@ type Grid() as this =
this.PointerWheelChanged |> subscribeAndHandleInput(fun e vm -> vm.OnMouseWheel e this)
]
AvaloniaXamlLoader.Load(this)
#if HAS_IME_SUPPORT
static do
InputElement.TextInputMethodClientRequestedEvent.AddClassHandler<Grid>(fun grid e ->
e.Client <- grid) |> ignore
#endif

override this.Render ctx =
if isNull grid_fb then
Expand Down Expand Up @@ -427,6 +429,7 @@ type Grid() as this =
with get (): obj = this.GetValue(ViewModelProperty) :> obj
and set (v: obj): unit = this.SetValue(ViewModelProperty, v) |> ignore

#if HAS_IME_SUPPORT
interface ITextInputMethodClient with
member _.SupportsPreedit = false
member _.SupportsSurroundingText = false
Expand All @@ -442,6 +445,7 @@ type Grid() as this =
[<CLIEvent>] member _.CursorRectangleChanged: IEvent<EventHandler,EventArgs> = ev_cursor_rect_changed.Publish
[<CLIEvent>] member _.TextViewVisualChanged: IEvent<EventHandler,EventArgs> = ev_text_view_visual_changed.Publish
[<CLIEvent>] member _.ActiveStateChanged: IEvent<EventHandler,EventArgs> = ev_active_state_changed.Publish
#endif

member this.GridId
with get () = this.GetValue(GridIdProperty)
Expand Down

0 comments on commit 6a39e69

Please sign in to comment.