summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-03-06 23:09:12 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-03-06 23:09:12 (GMT)
commit7bbe7bbdc8405dd7b5a98b9399ed599fd12d3aaa (patch)
treebbe130f0a845fa7fe7033b241089e66847a10591 /generic
parentf802dd59b9fdec91f7178bfb7bcaa2ab2818739c (diff)
parent8701bf597e98498ab4d757caa5a2bb9dd46a0554 (diff)
downloadtk-7bbe7bbdc8405dd7b5a98b9399ed599fd12d3aaa.zip
tk-7bbe7bbdc8405dd7b5a98b9399ed599fd12d3aaa.tar.gz
tk-7bbe7bbdc8405dd7b5a98b9399ed599fd12d3aaa.tar.bz2
merge core-8-6-branch
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.h3
-rw-r--r--generic/tkEvent.c13
-rw-r--r--generic/tkImgPNG.c4
-rw-r--r--generic/tkInt.h6
-rw-r--r--generic/tkTextDisp.c2
-rw-r--r--generic/tkWindow.c9
6 files changed, 31 insertions, 6 deletions
diff --git a/generic/tk.h b/generic/tk.h
index 69a0858..29c6fb9 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -814,6 +814,9 @@ typedef struct Tk_FakeWin {
int minReqWidth;
int minReqHeight;
char *dummy20; /* geometryMaster */
+#ifdef TK_USE_INPUT_METHODS
+ int dummy21;
+#endif /* TK_USE_INPUT_METHODS */
} Tk_FakeWin;
/*
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 95aeda1..d058e7c 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -356,6 +356,7 @@ CreateXIC(
/* XCreateIC failed. */
return;
}
+ winPtr->ximGeneration = dispPtr->ximGeneration;
/*
* Adjust the window's event mask if the IM requires it.
@@ -1288,6 +1289,14 @@ Tk_HandleEvent(
*/
#ifdef TK_USE_INPUT_METHODS
+ /*
+ * If the XIC has been invalidated, it must be recreated.
+ */
+ if (winPtr->dispPtr->ximGeneration != winPtr->ximGeneration) {
+ winPtr->flags &= ~TK_CHECKED_IC;
+ winPtr->inputContext = NULL;
+ }
+
if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) {
if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
winPtr->flags |= TK_CHECKED_IC;
@@ -1295,7 +1304,9 @@ Tk_HandleEvent(
CreateXIC(winPtr);
}
}
- if (eventPtr->type == FocusIn && winPtr->inputContext != NULL) {
+ if ((eventPtr->type == FocusIn) &&
+ (winPtr->dispPtr->inputMethod != NULL) &&
+ (winPtr->inputContext != NULL)) {
XSetICFocus(winPtr->inputContext);
}
}
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index c6e3029..6e64afa 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -2245,10 +2245,10 @@ ApplyAlpha(
p += offset;
if (16 == pngPtr->bitDepth) {
- register int channel;
+ register unsigned int channel;
while (p < endPtr) {
- channel = (unsigned char)
+ channel = (unsigned int)
(((p[0] << 8) | p[1]) * pngPtr->alpha);
*p++ = (unsigned char) (channel >> 8);
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 1615a81..f00d833 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -508,6 +508,9 @@ typedef struct TkDisplay {
int iconDataSize; /* Size of default iconphoto image data. */
unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
+#ifdef TK_USE_INPUT_METHODS
+ int ximGeneration; /* Used to invalidate XIC */
+#endif /* TK_USE_INPUT_METHODS */
} TkDisplay;
/*
@@ -809,6 +812,9 @@ typedef struct TkWindow {
int minReqWidth; /* Minimum requested width. */
int minReqHeight; /* Minimum requested height. */
char *geometryMaster;
+#ifdef TK_USE_INPUT_METHODS
+ int ximGeneration; /* Used to invalidate XIC */
+#endif /* TK_USE_INPUT_METHODS */
} TkWindow;
/*
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 095bb5e..371e910 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -8793,7 +8793,7 @@ FinalizeBaseChunk(
#if TK_DRAW_IN_CONTEXT
newwidth = 0;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
- if (newwidth != chunkPtr->width) {
+ if (newwidth < chunkPtr->width) {
widthAdjust += newwidth - chunkPtr->width;
chunkPtr->width = newwidth;
}
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 20b4f20..690a841 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -355,6 +355,9 @@ CreateTopLevelWindow(
* Set the flags specified in the call.
*/
+#ifdef TK_USE_INPUT_METHODS
+ winPtr->ximGeneration = 0;
+#endif /*TK_USE_INPUT_METHODS*/
winPtr->flags |= flags;
/*
@@ -650,6 +653,7 @@ TkAllocWindow(
winPtr->flags = 0;
winPtr->handlerList = NULL;
#ifdef TK_USE_INPUT_METHODS
+ winPtr->ximGeneration = 0;
winPtr->inputContext = NULL;
#endif /* TK_USE_INPUT_METHODS */
winPtr->tagPtr = NULL;
@@ -1442,10 +1446,11 @@ Tk_DestroyWindow(
UnlinkWindow(winPtr);
TkEventDeadWindow(winPtr);
#ifdef TK_USE_INPUT_METHODS
- if (winPtr->inputContext != NULL) {
+ if (winPtr->inputContext != NULL &&
+ winPtr->ximGeneration == winPtr->dispPtr->ximGeneration) {
XDestroyIC(winPtr->inputContext);
- winPtr->inputContext = NULL;
}
+ winPtr->inputContext = NULL;
#endif /* TK_USE_INPUT_METHODS */
if (winPtr->tagPtr != NULL) {
TkFreeBindingTags(winPtr);