download qinputcontext_x11.cpp
Language: C++
License: GPL
Copyright: (C) 2000-2003 Trolltech AS. All rights reserved.
LOC: 388
Project Info
FacturaLUX
Server: SourceForge
Type: cvs
...rototipo\src\qt\src\kernel\
   makepsheader.pl
   q1xcompatibility.h
   qabstractlayout.cpp
   qabstractlayout.h
   qaccel.cpp
   qaccel.h
   qaccessible.cpp
   qaccessible.h
   qapplication.cpp
   qapplication.h
   qapplication_p.h
   qapplication_x11.cpp
   qasyncimageio.cpp
   qasyncimageio.h
   qasyncio.cpp
   qasyncio.h
   qbitmap.cpp
   qbitmap.h
   qbrush.h
   qclipboard.cpp
   qclipboard.h
   qclipboard_x11.cpp
   qcolor.cpp
   qcolor.h
   qcolor_p.cpp
   qcolor_p.h
   qcolor_x11.cpp
   qcomplextext.cpp
   qcomplextext_p.h
   qconnection.cpp
   qconnection.h
   qcursor.cpp
   qcursor.h
   qcursor_x11.cpp
   qdesktopwidget.h
   qdesktopwidget_x11.cpp
   qdnd_x11.cpp
   qdragobject.cpp
   qdragobject.h
   qdrawutil.cpp
   qdrawutil.h
   qdropsite.cpp
   qdropsite.h
   qevent.cpp
   qevent.h
   qeventloop.cpp
   qeventloop.h
   qeventloop_p.h
   qeventloop_unix.cpp
   qeventloop_x11.cpp
   qfocusdata.cpp
   qfocusdata.h
   qfont.cpp
   qfont.h
   qfont_x11.cpp
   qfontdata_p.h
   qfontdatabase.cpp
   qfontdatabase.h
   qfontdatabase_x11.cpp
   qfontengine_p.h
   qfontengine_x11.cpp
   qfontinfo.h
   qfontmetrics.h
   qgif.h
   qgplugin.cpp
   qgplugin.h
   qguardedptr.cpp
   qguardedptr.h
   qiconset.cpp
   qiconset.h
   qimage.cpp
   qimage.h
   qimageformatinterface_p.h
   qimageformatplugin.cpp
   qimageformatplugin.h
   qinputcontext_p.h
   qinputcontext_x11.cpp
   qinternal.cpp
   qinternal_p.h
   qjpegio.cpp
   qjpegio.h
   qkeycode.h
   qkeysequence.cpp
   qkeysequence.h
   qlayout.cpp
   qlayout.h
   qlayoutengine.cpp
   qlayoutengine_p.h
   qlocalfs.cpp
   qlocalfs.h
   qlock.cpp
   qlock_p.h
   qmetaobject.cpp
   qmetaobject.h
   qmime.cpp
   qmime.h
   qmngio.cpp
   qmngio.h
   qmotifdnd_x11.cpp
   qmovie.cpp
   qmovie.h
   qnamespace.h
   qnetworkprotocol.cpp
   qnetworkprotocol.h
   qobject.cpp
   qobject.h
   qobjectcleanuphandler.cpp
   qobjectcleanuphandler.h
   qobjectdefs.h
   qobjectdict.h
   qobjectlist.h
   qpaintdevice.h
   qpaintdevice_x11.cpp
   qpaintdevicedefs.h
   qpaintdevicemetrics.cpp
   qpaintdevicemetrics.h
   qpainter.cpp
   qpainter.h
   qpainter_p.h
   qpainter_x11.cpp
   qpalette.cpp
   qpalette.h
   qpen.h
   qpicture.cpp
   qpicture.h
   qpixmap.cpp
   qpixmap.h
   qpixmap_x11.cpp
   qpixmapcache.cpp
   qpixmapcache.h
   qpngio.cpp
   qpngio.h
   qpoint.cpp
   qpoint.h
   qpointarray.cpp
   qpointarray.h
   qpolygonscanner.cpp
   qpolygonscanner.h
   qprinter.cpp
   qprinter.h
   qprinter_p.h
   qprinter_unix.cpp
   qprocess.cpp
   qprocess.h
   qprocess_unix.cpp
   qpsprinter.cpp
   qpsprinter.ps
   qpsprinter_p.h
   qrect.cpp
   qrect.h
   qregion.cpp
   qregion.h
   qregion_x11.cpp
   qrichtext.cpp
   qrichtext_p.cpp
   qrichtext_p.h
   qscriptengine.cpp
   qscriptengine_p.h
   qscriptengine_x11.cpp
   qsession.h
   qsessionmanager.h
   qsharedmemory_p.cpp
   qsharedmemory_p.h
   qsignal.cpp
   qsignal.h
   qsignalmapper.cpp
   qsignalmapper.h
   qsignalslotimp.h
   qsimplerichtext.cpp
   qsimplerichtext.h
   qsize.cpp
   qsize.h
   qsizegrip.cpp
   qsizegrip.h
   qsizepolicy.h
   qsocketnotifier.cpp
   qsocketnotifier.h
   qsound.cpp
   qsound.h
   qsound_x11.cpp
   qstyle.cpp
   qstyle.h
   qstylesheet.cpp
   qstylesheet.h
   qt.h
   qt_compat.pri
   qt_gfx.pri
   qt_kernel.pri
   qt_x11.pri
   qt_x11_p.h
   qtaddons_x11.cpp
   qtextengine.cpp
   qtextengine_p.h
   qtextengine_unix.cpp
   qtextlayout.cpp
   qtextlayout_p.h
   qthread.cpp
   qthread.h
   qthread_unix.cpp
   qtimer.cpp
   qtimer.h
   qtranslator.cpp
   qtranslator.h
   qucomextra.cpp
   qucomextra_p.h
   qurl.cpp
   qurl.h
   qurlinfo.cpp
   qurlinfo.h
   qurloperator.cpp
   qurloperator.h
   qvariant.cpp
   qvariant.h
   qvfbhdr.h
   qwidget.cpp
   qwidget.h
   qwidget_p.h
   qwidget_x11.cpp
   qwidgetcreate_x11.cpp
   qwidgetintdict.h
   qwidgetlist.h
   qwindow.cpp
   qwindow.h
   qwindowdefs.h
   qwmatrix.cpp
   qwmatrix.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
/****************************************************************************
** $Id: qinputcontext_x11.cpp,v 1.1 2003/12/04 08:17:59 falbujer Exp $
**
** Implementation of QInputContext class
**
** Copyright (C) 2000-2003 Trolltech AS.  All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses for Unix/X11 may use this file in accordance with the Qt Commercial
** License Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
**   information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/

#include "qplatformdefs.h"

#include "qapplication.h"
#include "qwidget.h"
#include "qinputcontext_p.h"

#include <stdlib.h>
#include <limits.h>


bool qt_compose_emptied = FALSE;

#if !defined(QT_NO_XIM)

#define XK_MISCELLANY
#define XK_LATIN1
#include <X11/keysymdef.h>

// #define QT_XIM_DEBUG

// from qapplication_x11.cpp
extern XIM	qt_xim;
extern XIMStyle	qt_xim_style;

/* The cache here is needed, as X11 leaks a few kb for every
   XFreeFontSet call, so we avoid creating and deletion of fontsets as
   much as possible
*/
static XFontSet fontsetCache[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
static int fontsetRefCount = 0;

static const char * const fontsetnames[] = {
    "-*-fixed-medium-r-*-*-16-*,-*-*-medium-r-*-*-16-*",
    "-*-fixed-medium-i-*-*-16-*,-*-*-medium-i-*-*-16-*",
    "-*-fixed-bold-r-*-*-16-*,-*-*-bold-r-*-*-16-*",
    "-*-fixed-bold-i-*-*-16-*,-*-*-bold-i-*-*-16-*",
    "-*-fixed-medium-r-*-*-24-*,-*-*-medium-r-*-*-24-*",
    "-*-fixed-medium-i-*-*-24-*,-*-*-medium-i-*-*-24-*",
    "-*-fixed-bold-r-*-*-24-*,-*-*-bold-r-*-*-24-*",
    "-*-fixed-bold-i-*-*-24-*,-*-*-bold-i-*-*-24-*"
};

static XFontSet getFontSet( const QFont &f )
{
    int i = 0;
    if (f.italic())
	i |= 1;
    if (f.bold())
	i |= 2;

    if ( f.pointSize() > 20 )
	i += 4;

    if ( !fontsetCache[i] ) {
	Display* dpy = QPaintDevice::x11AppDisplay();
	int missCount;
	char** missList;
	fontsetCache[i] = XCreateFontSet(dpy, fontsetnames[i], &missList, &missCount, 0);
	if(missCount > 0)
	    XFreeStringList(missList);
	if ( !fontsetCache[i] ) {
	    fontsetCache[i] = XCreateFontSet(dpy,  "-*-fixed-*-*-*-*-16-*", &missList, &missCount, 0);
	    if(missCount > 0)
		XFreeStringList(missList);
	    if ( !fontsetCache[i] )
		fontsetCache[i] = (XFontSet)-1;
	}
    }
    return (fontsetCache[i] == (XFontSet)-1) ? 0 : fontsetCache[i];
}


#ifdef Q_C_CALLBACKS
extern "C" {
#endif // Q_C_CALLBACKS

    static int xic_start_callback(XIC, XPointer client_data, XPointer) {
	QInputContext *qic = (QInputContext *) client_data;
	if (! qic) {
#ifdef QT_XIM_DEBUG
	    qDebug("compose start: no qic");
#endif // QT_XIM_DEBUG

	    return 0;
	}

	qic->composing = TRUE;
	qic->text = QString::null;
	qic->focusWidget = 0;

	if ( qic->selectedChars.size() < 128 )
	    qic->selectedChars.resize( 128 );
	qic->selectedChars.fill( 0 );

#ifdef QT_XIM_DEBUG
	qDebug("compose start");
#endif // QT_XIM_DEBUG

	return 0;
    }

    static int xic_draw_callback(XIC, XPointer client_data, XPointer call_data) {
	QInputContext *qic = (QInputContext *) client_data;
	if (! qic) {
#ifdef QT_XIM_DEBUG
	    qDebug("compose event: invalid compose event %p", qic);
#endif // QT_XIM_DEBUG

	    return 0;
	}

	bool send_imstart = FALSE;
	if (qApp->focusWidget() != qic->focusWidget && qic->text.isEmpty()) {
	    if (qic->focusWidget) {
#ifdef QT_XIM_DEBUG
		qDebug( "sending IMEnd (empty) to %p", qic->focusWidget );
#endif // QT_XIM_DEBUG

		QIMEvent endevent(QEvent::IMEnd, QString::null, -1);
		QApplication::sendEvent(qic->focusWidget, &endevent);
	    }

	    qic->text = QString::null;
	    qic->focusWidget = qApp->focusWidget();
	    qic->composing = FALSE;

	    if ( qic->selectedChars.size() < 128 )
		qic->selectedChars.resize( 128 );
	    qic->selectedChars.fill( 0 );

	    if (qic->focusWidget) {
		qic->composing = TRUE;
		send_imstart = TRUE;
	    }
	}

	if (! qic->composing || ! qic->focusWidget) {
#ifdef QT_XIM_DEBUG
	    qDebug("compose event: invalid compose event %d %p",
		   qic->composing, qic->focusWidget);
#endif // QT_XIM_DEBUG

	    return 0;
	}

	XIMPreeditDrawCallbackStruct *drawstruct =
	    (XIMPreeditDrawCallbackStruct *) call_data;
	XIMText *text = (XIMText *) drawstruct->text;
	int cursor = drawstruct->caret, sellen = 0;

	if ( ! drawstruct->caret && ! drawstruct->chg_first &&
	     ! drawstruct->chg_length && ! text ) {
	    // nothing to do
	    return 0;
	}

	if (text) {
	    char *str = 0;
	    if (text->encoding_is_wchar) {
		int l = wcstombs(NULL, text->string.wide_char, text->length);
		if (l != -1) {
		    str = new char[l + 1];
		    wcstombs(str, text->string.wide_char, l);
		    str[l] = 0;
		}
	    } else
		str = text->string.multi_byte;

	    if (! str)
		return 0;

	    QString s = QString::fromLocal8Bit(str);

	    if (text->encoding_is_wchar)
		delete [] str;

	    if (drawstruct->chg_length < 0)
		qic->text.replace(drawstruct->chg_first, UINT_MAX, s);
	    else
		qic->text.replace(drawstruct->chg_first, drawstruct->chg_length, s);

	    if ( qic->selectedChars.size() < qic->text.length() ) {
		// expand the selectedChars array if the compose string is longer
		uint from = qic->selectedChars.size();
		qic->selectedChars.resize( qic->text.length() );
		for ( uint x = from; from < qic->selectedChars.size(); ++x )
		    qic->selectedChars[x] = 0;
	    }

	    uint x;
	    bool *p = qic->selectedChars.data() + drawstruct->chg_first;
	    // determine if the changed chars are selected based on text->feedback
	    for ( x = 0; x < s.length(); ++x )
		*p++ = ( text->feedback ? ( text->feedback[x] & XIMReverse ) : 0 );

	    // figure out where the selection starts, and how long it is
	    p = qic->selectedChars.data();
	    bool started = FALSE;
	    for ( x = 0; x < qic->selectedChars.size(); ++x ) {
		if ( started ) {
		    if ( *p ) ++sellen;
		    else break;
		} else {
		    if ( *p ) {
			cursor = x;
			started = TRUE;
			sellen = 1;
		    }
		}
		++p;
	    }
	} else {
	    if (drawstruct->chg_length == 0)
		drawstruct->chg_length = -1;

	    qic->text.remove(drawstruct->chg_first, drawstruct->chg_length);
	    qt_compose_emptied = qic->text.isEmpty();
	    if ( qt_compose_emptied ) {
#ifdef QT_XIM_DEBUG
		qDebug( "compose emptied" );
#endif // QT_XIM_DEBUG

		// don't send an empty compose, since we will send an IMEnd with
		// either the correct compose text (or null text if the user has
		// cancelled the compose or deleted all chars).
		return 0;
	    }
	}

	if ( send_imstart ) {
#ifdef QT_XIM_DEBUG
            qDebug( "sending IMStart to %p", qic->focusWidget );
#endif // QT_XIM_DEBUG

	    qt_compose_emptied = FALSE;
	    QIMEvent startevent(QEvent::IMStart, QString::null, -1);
	    QApplication::sendEvent(qic->focusWidget, &startevent);
	}

#ifdef QT_XIM_DEBUG
	qDebug( "sending IMCompose to %p with %d chars",
                qic->focusWidget, qic->text.length() );
#endif // QT_XIM_DEBUG

	QIMComposeEvent event( QEvent::IMCompose, qic->text, cursor, sellen );
	QApplication::sendEvent(qic->focusWidget, &event);
	return 0;
    }

    static int xic_done_callback(XIC, XPointer client_data, XPointer) {
	QInputContext *qic = (QInputContext *) client_data;
	if (! qic)
	    return 0;

	if (qic->composing && qic->focusWidget) {
#ifdef QT_XIM_DEBUG
	    qDebug( "sending IMEnd (empty) to %p", qic->focusWidget );
#endif // QT_XIM_DEBUG

       	    QIMEvent event(QEvent::IMEnd, QString::null, -1);
	    QApplication::sendEvent(qic->focusWidget, &event);
	}

	qic->composing = FALSE;
	qic->focusWidget = 0;

	if ( qic->selectedChars.size() < 128 )
	    qic->selectedChars.resize( 128 );
	qic->selectedChars.fill( 0 );

	return 0;
    }

#ifdef Q_C_CALLBACKS
}
#endif // Q_C_CALLBACKS

#endif // !QT_NO_XIM



QInputContext::QInputContext(QWidget *widget)
    : ic(0), focusWidget(0), composing(FALSE), fontset(0)
{
#if !defined(QT_NO_XIM)
    fontsetRefCount++;
    if (! qt_xim) {
	qWarning("QInputContext: no input method context available");
	return;
    }

    if (! widget->isTopLevel()) {
	qWarning("QInputContext: cannot create input context for non-toplevel widgets");
	return;
    }

    XPoint spot;
    XRectangle rect;
    XVaNestedList preedit_attr = 0;
    XIMCallback startcallback, drawcallback, donecallback;

    font = widget->font();
    fontset = getFontSet( font );

    if (qt_xim_style & XIMPreeditArea) {
	rect.x = 0;
	rect.y = 0;
	rect.width = widget->width();
	rect.height = widget->height();

	preedit_attr = XVaCreateNestedList(0,
					   XNArea, &rect,
					   XNFontSet, fontset,
					   (char *) 0);
    } else if (qt_xim_style & XIMPreeditPosition) {
	spot.x = 1;
	spot.y = 1;

	preedit_attr = XVaCreateNestedList(0,
					   XNSpotLocation, &spot,
					   XNFontSet, fontset,
					   (char *) 0);
    } else if (qt_xim_style & XIMPreeditCallbacks) {
	startcallback.client_data = (XPointer) this;
	startcallback.callback = (XIMProc) xic_start_callback;
	drawcallback.client_data = (XPointer) this;
	drawcallback.callback = (XIMProc)xic_draw_callback;
	donecallback.client_data = (XPointer) this;
	donecallback.callback = (XIMProc) xic_done_callback;

	preedit_attr = XVaCreateNestedList(0,
					   XNPreeditStartCallback, &startcallback,
					   XNPreeditDrawCallback, &drawcallback,
					   XNPreeditDoneCallback, &donecallback,
					   (char *) 0);
    }

    if (preedit_attr) {
	ic = XCreateIC(qt_xim,
		       XNInputStyle, qt_xim_style,
		       XNClientWindow, widget->winId(),
		       XNPreeditAttributes, preedit_attr,
		       (char *) 0);
	XFree(preedit_attr);
    } else
	ic = XCreateIC(qt_xim,
		       XNInputStyle, qt_xim_style,
		       XNClientWindow, widget->winId(),
		       (char *) 0);

    if (! ic)
	qFatal("Failed to create XIM input context!");

    // when resetting the input context, preserve the input state
    (void) XSetICValues((XIC) ic, XNResetState, XIMPreserveState, (char *) 0);
#endif // !QT_NO_XIM
}


QInputContext::~QInputContext()
{

#if !defined(QT_NO_XIM)
    if (ic)
	XDestroyIC((XIC) ic);

    if ( --fontsetRefCount == 0 ) {
	Display *dpy = QPaintDevice::x11AppDisplay();
	for ( int i = 0; i < 8; i++ ) {
	    if ( fontsetCache[i] && fontsetCache[i] != (XFontSet)-1 ) {
		XFreeFontSet(dpy, fontsetCache[i]);
		fontsetCache[i] = 0;
	    }
	}
    }

#endif // !QT_NO_XIM

    ic = 0;
    focusWidget = 0;
    composing = FALSE;
}


void QInputContext::reset()
{
#if !defined(QT_NO_XIM)
    if (focusWidget && composing && ! text.isNull()) {
#ifdef QT_XIM_DEBUG
	qDebug("QInputContext::reset: composing - sending IMEnd (empty) to %p",
	       focusWidget);
#endif // QT_XIM_DEBUG

	QIMEvent endevent(QEvent::IMEnd, QString::null, -1);
	QApplication::sendEvent(focusWidget, &endevent);
	focusWidget = 0;
	text = QString::null;
	if ( selectedChars.size() < 128 )
	    selectedChars.resize( 128 );
	selectedChars.fill( 0 );

	char *mb = XmbResetIC((XIC) ic);
	if (mb)
	    XFree(mb);
    }
#endif // !QT_NO_XIM
}


void QInputContext::setComposePosition(int x, int y)
{
#if !defined(QT_NO_XIM)
    if (qt_xim && ic) {
	XPoint point;
	point.x = x;
	point.y = y;

	XVaNestedList preedit_attr =
	    XVaCreateNestedList(0,
				XNSpotLocation, &point,

				(char *) 0);
	XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
	XFree(preedit_attr);
    }
#endif // !QT_NO_XIM
}


void QInputContext::setComposeArea(int x, int y, int w, int h)
{
#if !defined(QT_NO_XIM)
    if (qt_xim && ic) {
	XRectangle rect;
	rect.x = x;
	rect.y = y;
	rect.width = w;
	rect.height = h;

	XVaNestedList preedit_attr = XVaCreateNestedList(0,
							 XNArea, &rect,

							 (char *) 0);
	XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
	XFree(preedit_attr);
    }
#endif
}


int QInputContext::lookupString(XKeyEvent *event, QCString &chars,
				KeySym *key, Status *status) const
{
    int count = 0;

#if !defined(QT_NO_XIM)
    if (qt_xim && ic) {
	count = XmbLookupString((XIC) ic, event, chars.data(),
				chars.size(), key, status);

	if ((*status) == XBufferOverflow ) {
	    chars.resize(count + 1);
	    count = XmbLookupString((XIC) ic, event, chars.data(),
				    chars.size(), key, status);
	}
    }

#endif // QT_NO_XIM

    return count;
}

void QInputContext::setFocus()
{
#if !defined(QT_NO_XIM)
    if (qt_xim && ic)
	XSetICFocus((XIC) ic);
#endif // !QT_NO_XIM
}

void QInputContext::setXFontSet(const QFont &f)
{
#if !defined(QT_NO_XIM)
    if (font == f) return; // nothing to do
    font = f;

    XFontSet fs = getFontSet(font);
    if (fontset == fs) return; // nothing to do
    fontset = fs;

    XVaNestedList preedit_attr = XVaCreateNestedList(0, XNFontSet, fontset, (char *) 0);
    XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
    XFree(preedit_attr);
#else
    Q_UNUSED( f );
#endif
}

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us