~ubuntu-branches/ubuntu/wily/tk8.6/wily

« back to all changes in this revision

Viewing changes to unix/tkUnixEvent.c

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2013-10-05 11:59:47 UTC
  • mfrom: (8.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20131005115947-fuy2i0zetr6iuyn3
Added the libtk8.6-dbg package with libtk8.6 debug symbols in it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
#include "tkUnixInt.h"
14
14
#include <signal.h>
 
15
#ifdef HAVE_XKBKEYCODETOKEYSYM
 
16
#  include <X11/XKBlib.h>
 
17
#else
 
18
#  define XkbOpenDisplay(D,V,E,M,m,R) (V),(E),(M),(m),(R),(NULL)
 
19
#endif
15
20
 
16
21
/*
17
22
 * The following static indicates whether this module has been initialized in
116
121
    const char *displayNameStr)
117
122
{
118
123
    TkDisplay *dispPtr;
119
 
    Display *display = XOpenDisplay(displayNameStr);
 
124
    Display *display;
 
125
    int event = 0;
 
126
    int error = 0;
 
127
    int major = 1;
 
128
    int minor = 0;
 
129
    int reason = 0;
 
130
    unsigned int use_xkb = 0;
 
131
    /* Disabled, until we have a better test. See [Bug 3613668] */
 
132
#if 0 && defined(XKEYCODETOKEYSYM_IS_DEPRECATED) && defined(TCL_THREADS)
 
133
    static int xinited = 0;
 
134
    static Tcl_Mutex xinitMutex = NULL;
 
135
 
 
136
    if (!xinited) {
 
137
        Tcl_MutexLock(&xinitMutex);
 
138
        if (!xinited) {
 
139
            /* Necessary for threaded apps, of no consequence otherwise  */
 
140
            /* need only be called once, but must be called before *any* */
 
141
            /* Xlib call is made. If xinitMutex is still NULL after the  */
 
142
            /* Tcl_MutexLock call, Tcl was compiled without threads so   */
 
143
            /* we cannot use XInitThreads() either.                      */
 
144
            if (xinitMutex != NULL){
 
145
                XInitThreads();
 
146
            }
 
147
            xinited = 1;
 
148
        }
 
149
        Tcl_MutexUnlock(&xinitMutex);
 
150
    }
 
151
#endif
 
152
 
 
153
    /*
 
154
    ** Bug [3607830]: Before using Xkb, it must be initialized and confirmed
 
155
    **                that the serve supports it.  The XkbOpenDisplay call
 
156
    **                will perform this check and return NULL if the extension
 
157
    **                is not supported.
 
158
    **
 
159
    ** Work around un-const-ified Xkb headers using (char *) cast.
 
160
    */
 
161
    display = XkbOpenDisplay((char *)displayNameStr, &event, &error, &major,
 
162
            &minor, &reason);
 
163
 
 
164
    if (display == NULL) {
 
165
        /*fprintf(stderr,"event=%d error=%d major=%d minor=%d reason=%d\nDisabling xkb\n",
 
166
        event, error, major, minor, reason);*/
 
167
        display  = XOpenDisplay(displayNameStr);
 
168
    } else {
 
169
        use_xkb = TK_DISPLAY_USE_XKB;
 
170
        /*fprintf(stderr, "Using xkb %d.%d\n", major, minor);*/
 
171
    }
120
172
 
121
173
    if (display == NULL) {
122
174
        return NULL;
124
176
    dispPtr = ckalloc(sizeof(TkDisplay));
125
177
    memset(dispPtr, 0, sizeof(TkDisplay));
126
178
    dispPtr->display = display;
 
179
    dispPtr->flags |= use_xkb;
127
180
#ifdef TK_USE_INPUT_METHODS
128
181
    OpenIM(dispPtr);
129
182
#endif