Commit db3864e5 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

winemac.drv: Allow mac IME to clear text in system input method.

parent 3736c367
......@@ -702,6 +702,13 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
[self invalidateHasGLDescendant];
}
- (void) clearMarkedText
{
[markedText deleteCharactersInRange:NSMakeRange(0, [markedText length])];
markedTextSelection = NSMakeRange(0, 0);
[[self inputContext] discardMarkedText];
}
- (void) completeText:(NSString*)text
{
macdrv_event* event;
......@@ -716,9 +723,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
macdrv_release_event(event);
[markedText deleteCharactersInRange:NSMakeRange(0, [markedText length])];
markedTextSelection = NSMakeRange(0, 0);
[[self inputContext] discardMarkedText];
[self clearMarkedText];
}
- (void) didAddSubview:(NSView*)subview
......@@ -3907,3 +3912,18 @@ void macdrv_send_text_input_event(int pressed, unsigned int flags, int repeat, i
macdrv_release_event(event);
});
}
void macdrv_clear_ime_text(void)
{
OnMainThreadAsync(^{
WineWindow* window = (WineWindow*)[NSApp keyWindow];
if (![window isKindOfClass:[WineWindow class]])
{
window = (WineWindow*)[NSApp mainWindow];
if (![window isKindOfClass:[WineWindow class]])
window = [[WineApplicationController sharedController] frontWineWindow];
}
if (window)
[[window contentView] clearMarkedText];
});
}
......@@ -76,7 +76,6 @@ static UINT WM_MSIME_RECONVERT;
static UINT WM_MSIME_QUERYPOSITION;
static UINT WM_MSIME_DOCUMENTFEED;
static HIMC RealIMC(HIMC hIMC)
{
if (hIMC == FROM_MACDRV)
......@@ -840,6 +839,7 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
TRACE("NI_COMPOSITIONSTR: CPS_CANCEL\n");
macdrv_clear_ime_text();
if (lpIMC->hCompStr)
ImmDestroyIMCC(lpIMC->hCompStr);
......
......@@ -580,4 +580,6 @@ extern void macdrv_destroy_status_item(macdrv_status_item s) DECLSPEC_HIDDEN;
extern void macdrv_set_status_item_image(macdrv_status_item s, CGImageRef cgimage) DECLSPEC_HIDDEN;
extern void macdrv_set_status_item_tooltip(macdrv_status_item s, CFStringRef cftip) DECLSPEC_HIDDEN;
extern void macdrv_clear_ime_text(void) DECLSPEC_HIDDEN;
#endif /* __WINE_MACDRV_COCOA_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment