mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
Track all XIC:s and destroy them explicitly to work around xfree86 bug.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14485 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7ad3a88b9b
commit
fb35644e9c
3 changed files with 42 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-09-19 00:33 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
* Header/x11/XGInputServer.h, Source/x11/XIMInputServer.m: Track
|
||||||
|
all created XIC:s and destroy them explicitly.
|
||||||
|
|
||||||
2002-09-18 19:59 Alexander Malmberg <alexander@malmberg.org>
|
2002-09-18 19:59 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/art/blit.h, Source/art/blit.m, Source/art/composite.m:
|
* Source/art/blit.h, Source/art/blit.m, Source/art/composite.m:
|
||||||
|
|
|
@ -45,6 +45,13 @@
|
||||||
XIMStyle xim_style;
|
XIMStyle xim_style;
|
||||||
NSMutableData *dbuf;
|
NSMutableData *dbuf;
|
||||||
NSStringEncoding encoding;
|
NSStringEncoding encoding;
|
||||||
|
|
||||||
|
/* Track the XIC:s and destroy them explicitly to work around an XFree86
|
||||||
|
bug:
|
||||||
|
http://www.xfree86.org/pipermail/xpert/2002-June/018370.html
|
||||||
|
*/
|
||||||
|
XIC *xics;
|
||||||
|
int num_xics;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithDelegate: (id)aDelegate
|
- (id) initWithDelegate: (id)aDelegate
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "x11/XGInputServer.h"
|
#include "x11/XGInputServer.h"
|
||||||
#include <X11/Xlocale.h>
|
#include <X11/Xlocale.h>
|
||||||
|
|
||||||
|
|
||||||
@interface XIMInputServer (XIMPrivate)
|
@interface XIMInputServer (XIMPrivate)
|
||||||
- (BOOL) ximInit: (Display *)dpy;
|
- (BOOL) ximInit: (Display *)dpy;
|
||||||
- (void) ximClose;
|
- (void) ximClose;
|
||||||
|
@ -109,6 +110,7 @@
|
||||||
DESTROY(server_name);
|
DESTROY(server_name);
|
||||||
DESTROY(dbuf);
|
DESTROY(dbuf);
|
||||||
[self ximClose];
|
[self ximClose];
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
@ -277,7 +279,17 @@
|
||||||
|
|
||||||
- (void) ximClose
|
- (void) ximClose
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0;i<num_xics;i++)
|
||||||
|
{
|
||||||
|
XDestroyIC(xics[i]);
|
||||||
|
}
|
||||||
|
free(xics);
|
||||||
|
num_xics=0;
|
||||||
|
xics=NULL;
|
||||||
|
|
||||||
NSDebugLLog(@"XIM", @"Closed XIM\n");
|
NSDebugLLog(@"XIM", @"Closed XIM\n");
|
||||||
|
|
||||||
if (xim)
|
if (xim)
|
||||||
XCloseIM(xim);
|
XCloseIM(xim);
|
||||||
xim=NULL;
|
xim=NULL;
|
||||||
|
@ -316,6 +328,9 @@
|
||||||
xim_style, NULL);
|
xim_style, NULL);
|
||||||
if (xic==NULL)
|
if (xic==NULL)
|
||||||
NSDebugLLog(@"XIM", @"Can't create the input context.\n");
|
NSDebugLLog(@"XIM", @"Can't create the input context.\n");
|
||||||
|
|
||||||
|
xics = realloc(xics, sizeof(XIC) * (num_xics + 1));
|
||||||
|
xics[num_xics++] = xic;
|
||||||
return xic;
|
return xic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +345,21 @@
|
||||||
|
|
||||||
- (void) ximCloseIC: (XIC)xic
|
- (void) ximCloseIC: (XIC)xic
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < num_xics; i++)
|
||||||
|
{
|
||||||
|
if (xics[i] == xic)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == num_xics)
|
||||||
|
{
|
||||||
|
NSLog(@"internal error in ximCloseIC: can't find XIC in list");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
for (i++; i < num_xics; i++)
|
||||||
|
xics[i - 1] = xics[i];
|
||||||
|
num_xics--;
|
||||||
|
|
||||||
XDestroyIC(xic);
|
XDestroyIC(xic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue