mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
XIM - attempt to fix position
git-svn-id: svn://ultimatepp.org/upp/trunk@1304 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
8bb22bc9c9
commit
9e2f119174
2 changed files with 29 additions and 2 deletions
|
|
@ -721,6 +721,7 @@ private:
|
|||
|
||||
void StartPopupGrab();
|
||||
static void EndPopupGrab();
|
||||
static void SyncIMPosition();
|
||||
|
||||
friend bool GetMouseRight();
|
||||
friend bool GetMouseLeft();
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ void Ctrl::TimerAndPaint() {
|
|||
SyncCaret();
|
||||
AnimateCaret();
|
||||
XSync(Xdisplay, false);
|
||||
SyncIMPosition();
|
||||
}
|
||||
|
||||
bool Ctrl::ProcessEvent(bool *)
|
||||
|
|
@ -417,7 +418,7 @@ void Ctrl::Create0(Ctrl *owner, bool redirect, bool savebits)
|
|||
cw.owner = owner;
|
||||
|
||||
cw.xic = xim ? XCreateIC(xim,
|
||||
XNInputStyle, XIMPreeditNothing|XIMStatusNothing,
|
||||
XNInputStyle, XIMPreeditPosition|XIMStatusNothing,
|
||||
XNClientWindow, w,
|
||||
NULL)
|
||||
: NULL;
|
||||
|
|
@ -445,6 +446,8 @@ void Ctrl::Create0(Ctrl *owner, bool redirect, bool savebits)
|
|||
}
|
||||
|
||||
RefreshLayoutDeep();
|
||||
|
||||
SyncIMPosition();
|
||||
}
|
||||
|
||||
void Ctrl::WndDestroy0()
|
||||
|
|
@ -489,7 +492,10 @@ void Ctrl::WndDestroy0()
|
|||
int q = Xwindow().Find(focusWindow);
|
||||
if(q >= 0) {
|
||||
XIC xic = Xwindow()[q].xic;
|
||||
XSetICFocus(xic);
|
||||
if(xic) {
|
||||
XSetICFocus(xic);
|
||||
SyncIMPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -830,6 +836,26 @@ void Ctrl::FocusSync()
|
|||
}
|
||||
}
|
||||
|
||||
void Ctrl::SyncIMPosition()
|
||||
{
|
||||
if(!focusWindow)
|
||||
return;
|
||||
int q = Xwindow().Find(focusWindow);
|
||||
if(q < 0)
|
||||
return;
|
||||
XWindow& xw = Xwindow()[q];
|
||||
XIC xic = xw.xic;
|
||||
if(xw.xic && xw.ctrl) {
|
||||
XVaNestedList preedit_attr;
|
||||
XPoint spot;
|
||||
spot.x = xw.ctrl->caretx + xw.ctrl->caretcx;
|
||||
spot.y = xw.ctrl->carety + xw.ctrl->caretcy;
|
||||
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
|
||||
XSetICValues(xw.xic, XNPreeditAttributes, preedit_attr, NULL);
|
||||
XFree(preedit_attr);
|
||||
}
|
||||
}
|
||||
|
||||
void Ctrl::AnimateCaret()
|
||||
{
|
||||
GuiLock __;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue