Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 3607830 Runtime checks that Xkb is available in the X server before trying to use. Adapted from patch from Brian Griffin. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a243315217cfd8f17a094b36e081a73b |
User & Date: | dgp 2013-04-01 17:50:50 |
References
2020-02-05
| ||
19:36 | • Ticket [3551802f] Use the Xkb API to simply Tk's keyboard event handling status still Open with 3 other changes artifact: d00e566c user: fvogel | |
2020-02-04
| ||
20:43 | • Ticket [3551802f]: 6 changes artifact: 78e81006 user: fvogel | |
Context
2013-04-01
| ||
17:53 | silence compiler warning check-in: 43d0360d user: dgp tags: trunk | |
17:50 | 3607830 Runtime checks that Xkb is available in the X server before trying to use. Adapted from patch from Brian Griffin. check-in: a2433152 user: dgp tags: trunk | |
17:14 | Bring back test window-2.9. No longer hangs. check-in: 918a5e87 user: dgp tags: trunk | |
17:12 | 3607830 Runtime checks that Xkb is available in the X server before trying to use. Adapted from patch from Brian Griffin. check-in: 9b8bdc81 user: dgp tags: core-8-5-branch | |
Changes
Changes to ChangeLog.
1 2 3 4 5 6 7 8 9 10 11 | 2013-04-01 Don Porter <[email protected]> * tests/window.test: Bring back test window-2.9. No longer hangs. 2013-03-27 Jan Nijtmans <[email protected]> * library/button.tcl: [Bug 3608074]: Add <<Invoke>> bindings to * library/listbox.tcl: Button's, Listbox and Menu. * library/menu.tcl: * doc/event.n: Document <<Invoke>>, <<ThemeChanged>>, * doc/ttk_panedwindow.n: <<EnteredChild>> (ttk_pandedwindow only) and | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 2013-04-01 Don Porter <[email protected]> * tests/window.test: Bring back test window-2.9. No longer hangs. * generic/tkInt.h: [Bug 3607830] Runtime checks that Xkb is * unix/tkUnixEvent.c: available in the X server before trying to * unix/tkUnixKey.c: use. Adapted from patch from Brian Griffin. 2013-03-27 Jan Nijtmans <[email protected]> * library/button.tcl: [Bug 3608074]: Add <<Invoke>> bindings to * library/listbox.tcl: Button's, Listbox and Menu. * library/menu.tcl: * doc/event.n: Document <<Invoke>>, <<ThemeChanged>>, * doc/ttk_panedwindow.n: <<EnteredChild>> (ttk_pandedwindow only) and |
︙ | ︙ |
Changes to generic/tkInt.h.
︙ | ︙ | |||
522 523 524 525 526 527 528 529 530 531 532 533 534 535 | * Indicates that we are in a pointer warp */ #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0) #define TK_DISPLAY_USE_IM (1 << 1) #define TK_DISPLAY_WM_TRACING (1 << 3) #define TK_DISPLAY_IN_WARP (1 << 4) /* * One of the following structures exists for each error handler created by a * call to Tk_CreateErrorHandler. The structure is managed by tkError.c. */ typedef struct TkErrorHandler { | > | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | * Indicates that we are in a pointer warp */ #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0) #define TK_DISPLAY_USE_IM (1 << 1) #define TK_DISPLAY_WM_TRACING (1 << 3) #define TK_DISPLAY_IN_WARP (1 << 4) #define TK_DISPLAY_USE_XKB (1 << 5) /* * One of the following structures exists for each error handler created by a * call to Tk_CreateErrorHandler. The structure is managed by tkError.c. */ typedef struct TkErrorHandler { |
︙ | ︙ |
Changes to unix/tkUnixEvent.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include <signal.h> /* * The following static indicates whether this module has been initialized in * the current thread. */ typedef struct ThreadSpecificData { | > > > > > > > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkUnixInt.h" #include <signal.h> #ifdef HAVE_XKBKEYCODETOKEYSYM # include <X11/XKBlib.h> /* Work around stupid un-const-ified Xkb headers. Grrrrr.... */ # define XkbOpenDisplay(D,V,E,M,m,R) \ (XkbOpenDisplay)((char *)(D),(V),(E),(M),(m),(R)) #else # define XkbOpenDisplay(D,V,E,M,m,R) (NULL) #endif /* * The following static indicates whether this module has been initialized in * the current thread. */ typedef struct ThreadSpecificData { |
︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | TkDisplay * TkpOpenDisplay( const char *displayNameStr) { TkDisplay *dispPtr; Display *display; #ifdef TCL_THREADS static int xinited = 0; TCL_DECLARE_MUTEX(xinitMutex); if (!xinited) { Tcl_MutexLock(&xinitMutex); if (!xinited) { /* Necessary for threaded apps, of no consequence otherwise */ /* need only be called once, but must be called before *any* */ /* Xlib call is made. */ XInitThreads(); xinited = 1; } Tcl_MutexUnlock(&xinitMutex); } #endif | > > > > > > > > > > > > > > > > > | > > > > > > | 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 | TkDisplay * TkpOpenDisplay( const char *displayNameStr) { TkDisplay *dispPtr; Display *display; int event = 0; int error = 0; int major = 1; int minor = 0; int reason = 0; unsigned int use_xkb = 0; #ifdef TCL_THREADS static int xinited = 0; TCL_DECLARE_MUTEX(xinitMutex); if (!xinited) { Tcl_MutexLock(&xinitMutex); if (!xinited) { /* Necessary for threaded apps, of no consequence otherwise */ /* need only be called once, but must be called before *any* */ /* Xlib call is made. */ XInitThreads(); xinited = 1; } Tcl_MutexUnlock(&xinitMutex); } #endif /* ** Bug [3607830]: Before using Xkb, it must be initialized and confirmed ** that the serve supports it. The XkbOpenDisplay call ** will perform this check and return NULL if the extension ** is not supported. */ display = XkbOpenDisplay(displayNameStr, &event, &error, &major, &minor, &reason); if (display == NULL) { /*fprintf(stderr,"event=%d error=%d major=%d minor=%d reason=%d\nDisabling xkb\n", event, error, major, minor, reason);*/ display = XOpenDisplay(displayNameStr); } else { use_xkb = TK_DISPLAY_USE_XKB; /*fprintf(stderr, "Using xkb %d.%d\n", major, minor);*/ } if (display == NULL) { return NULL; } dispPtr = ckalloc(sizeof(TkDisplay)); memset(dispPtr, 0, sizeof(TkDisplay)); dispPtr->display = display; dispPtr->flags |= use_xkb; #ifdef TK_USE_INPUT_METHODS OpenIM(dispPtr); #endif Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE, DisplayFileProc, dispPtr); return dispPtr; } |
︙ | ︙ |
Changes to unix/tkUnixKey.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #ifdef HAVE_XKBKEYCODETOKEYSYM # include <X11/XKBlib.h> #else # define XkbKeycodeToKeysym(D,K,G,L) XKeycodeToKeysym(D,K,L) #endif /* * Prototypes for local functions defined in this file: */ /* *---------------------------------------------------------------------- | > > > > > > > > > | 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 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" /* ** Bug [3607830]: Before using Xkb, it must be initialized. TkpOpenDisplay ** does this and sets the USE_XKB flag if xkb is supported. ** (should this be function ptr?) */ #ifdef HAVE_XKBKEYCODETOKEYSYM # include <X11/XKBlib.h> #else # define XkbKeycodeToKeysym(D,K,G,L) XKeycodeToKeysym(D,K,L) #endif #define TkKeycodeToKeysym(D,K,G,L) \ ((D)->flags & TK_DISPLAY_USE_XKB) ? \ XkbKeycodeToKeysym((D)->display,K,G,L) : \ XKeycodeToKeysym((D)->display,K,L) /* * Prototypes for local functions defined in this file: */ /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
212 213 214 215 216 217 218 | kePtr->charValueLen = len; memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1); return Tcl_DStringValue(dsPtr); } /* * When mapping from a keysym to a keycode, need information about the | | | | > > | | | | | | | < < | | | < | 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 | kePtr->charValueLen = len; memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1); return Tcl_DStringValue(dsPtr); } /* * When mapping from a keysym to a keycode, need information about the * modifier state to be used so that when they call TkKeycodeToKeysym taking * into account the xkey.state, they will get back the original keysym. */ void TkpSetKeycodeAndState( Tk_Window tkwin, KeySym keySym, XEvent *eventPtr) { TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; int state; KeyCode keycode; if (keySym == NoSymbol) { keycode = 0; } else { keycode = XKeysymToKeycode(dispPtr->display, keySym); } eventPtr->xkey.keycode = keycode; if (keycode != 0) { for (state = 0; state < 4; state++) { if (XLookupKeysym(&eventPtr->xkey, state) == keySym) { if (state & 1) { eventPtr->xkey.state |= ShiftMask; } if (state & 2) { eventPtr->xkey.state |= dispPtr->modeModMask; } break; } } } eventPtr->xkey.keycode = keycode; } /* |
︙ | ︙ | |||
324 325 326 327 328 329 330 | index = 2; } if ((eventPtr->xkey.state & ShiftMask) || ((dispPtr->lockUsage != LU_IGNORE) && (eventPtr->xkey.state & LockMask))) { index += 1; } | | | | | 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 | index = 2; } if ((eventPtr->xkey.state & ShiftMask) || ((dispPtr->lockUsage != LU_IGNORE) && (eventPtr->xkey.state & LockMask))) { index += 1; } sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode, 0, index); /* * Special handling: if the key was shifted because of Lock, but lock is * only caps lock, not shift lock, and the shifted keysym isn't upper-case * alphabetic, then switch back to the unshifted keysym. */ if ((index & 1) && !(eventPtr->xkey.state & ShiftMask) && (dispPtr->lockUsage == LU_CAPS)) { if (!(((sym >= XK_A) && (sym <= XK_Z)) || ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) || ((sym >= XK_Ooblique) && (sym <= XK_Thorn)))) { index &= ~1; sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode, 0, index); } } /* * Another bit of special handling: if this is a shifted key and there is * no keysym defined, then use the keysym for the unshifted key. */ if ((index & 1) && (sym == NoSymbol)) { sym = TkKeycodeToKeysym(dispPtr, eventPtr->xkey.keycode, 0, index & ~1); } return sym; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
400 401 402 403 404 405 406 | dispPtr->lockUsage = LU_IGNORE; codePtr = modMapPtr->modifiermap + modMapPtr->max_keypermod*LockMapIndex; for (count = modMapPtr->max_keypermod; count > 0; count--, codePtr++) { if (*codePtr == 0) { continue; } | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | dispPtr->lockUsage = LU_IGNORE; codePtr = modMapPtr->modifiermap + modMapPtr->max_keypermod*LockMapIndex; for (count = modMapPtr->max_keypermod; count > 0; count--, codePtr++) { if (*codePtr == 0) { continue; } keysym = TkKeycodeToKeysym(dispPtr, *codePtr, 0, 0); if (keysym == XK_Shift_Lock) { dispPtr->lockUsage = LU_SHIFT; break; } if (keysym == XK_Caps_Lock) { dispPtr->lockUsage = LU_CAPS; break; |
︙ | ︙ | |||
426 427 428 429 430 431 432 | dispPtr->altModMask = 0; codePtr = modMapPtr->modifiermap; max = 8 * modMapPtr->max_keypermod; for (i = 0; i < max; i++, codePtr++) { if (*codePtr == 0) { continue; } | | | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | dispPtr->altModMask = 0; codePtr = modMapPtr->modifiermap; max = 8 * modMapPtr->max_keypermod; for (i = 0; i < max; i++, codePtr++) { if (*codePtr == 0) { continue; } keysym = TkKeycodeToKeysym(dispPtr, *codePtr, 0, 0); if (keysym == XK_Mode_switch) { dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod); } if ((keysym == XK_Meta_L) || (keysym == XK_Meta_R)) { dispPtr->metaModMask |= ShiftMask << (i/modMapPtr->max_keypermod); } if ((keysym == XK_Alt_L) || (keysym == XK_Alt_R)) { |
︙ | ︙ |