comparison src/device-x.c @ 187:b405438285a2 r20-3b20

Import from CVS: tag r20-3b20
author cvs
date Mon, 13 Aug 2007 09:56:28 +0200
parents 3d6bfa290dbd
children f53b5ca2e663
comparison
equal deleted inserted replaced
186:24ac94803b48 187:b405438285a2
66 static XrmOptionDescRec emacs_options[] = 66 static XrmOptionDescRec emacs_options[] =
67 { 67 {
68 {"-geometry", ".geometry", XrmoptionSepArg, NULL}, 68 {"-geometry", ".geometry", XrmoptionSepArg, NULL},
69 {"-iconic", ".iconic", XrmoptionNoArg, "yes"}, 69 {"-iconic", ".iconic", XrmoptionNoArg, "yes"},
70 70
71 {"-internal-border-width", "*EmacsFrame.internalBorderWidth", 71 {"-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL},
72 XrmoptionSepArg, NULL}, 72 {"-ib", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL},
73 {"-ib", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL}, 73 {"-scrollbar-width", "*EmacsFrame.scrollBarWidth", XrmoptionSepArg, NULL},
74 {"-scrollbar-width", "*EmacsFrame.scrollBarWidth", XrmoptionSepArg, NULL}, 74 {"-scrollbar-height", "*EmacsFrame.scrollBarHeight", XrmoptionSepArg, NULL},
75 {"-scrollbar-height", "*EmacsFrame.scrollBarHeight", XrmoptionSepArg, NULL},
76 75
77 /* #### Beware! If the type of the shell changes, update this. */ 76 /* #### Beware! If the type of the shell changes, update this. */
78 {"-T", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, 77 {"-T", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL},
79 {"-wn", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, 78 {"-wn", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL},
80 {"-title", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, 79 {"-title", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL},
81 80
82 {"-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL}, 81 {"-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL},
83 {"-in", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL}, 82 {"-in", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL},
84 {"-mc", "*pointerColor", XrmoptionSepArg, NULL}, 83 {"-mc", "*pointerColor", XrmoptionSepArg, NULL},
85 {"-cr", "*cursorColor", XrmoptionSepArg, NULL}, 84 {"-cr", "*cursorColor", XrmoptionSepArg, NULL},
86 {"-fontset", "*FontSet", XrmoptionSepArg, NULL}, 85 {"-fontset", "*FontSet", XrmoptionSepArg, NULL},
87 }; 86 };
88 87
89 static void validify_resource_string (char *str); 88 static void validify_resource_string (char *str);
90 89
91 /* Functions to synchronize mirroring resources and specifiers */ 90 /* Functions to synchronize mirroring resources and specifiers */
299 { 298 {
300 Arg al[3]; 299 Arg al[3];
301 Widget shell = DEVICE_XT_APP_SHELL (d); 300 Widget shell = DEVICE_XT_APP_SHELL (d);
302 301
303 XtSetArg (al [0], XtNmappedWhenManaged, False); 302 XtSetArg (al [0], XtNmappedWhenManaged, False);
304 XtSetArg (al [1],XtNwidth, 1); 303 XtSetArg (al [1], XtNwidth, 1);
305 XtSetArg (al [2],XtNheight, 1); 304 XtSetArg (al [2], XtNheight, 1);
306 XtSetValues (shell, al, 3); 305 XtSetValues (shell, al, 3);
307 XtRealizeWidget (shell); 306 XtRealizeWidget (shell);
308 307
309 { 308 {
310 int new_argc; 309 int new_argc;
349 } 348 }
350 349
351 static void 350 static void
352 x_mark_device (struct device *d, void (*markobj) (Lisp_Object)) 351 x_mark_device (struct device *d, void (*markobj) (Lisp_Object))
353 { 352 {
354 ((markobj) (DEVICE_X_DATA (d)->WM_COMMAND_frame)); 353 ((markobj) (DEVICE_X_WM_COMMAND_FRAME (d)));
354 ((markobj) (DEVICE_X_DATA (d)->x_keysym_map_hashtable));
355 } 355 }
356 356
357 357
358 /************************************************************************/ 358 /************************************************************************/
359 /* closing an X connection */ 359 /* closing an X connection */
1213 */ 1213 */
1214 (device)) 1214 (device))
1215 { 1215 {
1216 Display *dpy = get_x_display (device); 1216 Display *dpy = get_x_display (device);
1217 1217
1218 return list3 (make_int (ProtocolVersion (dpy)), 1218 return list3 (make_int (ProtocolVersion (dpy)),
1219 make_int (ProtocolRevision (dpy)), 1219 make_int (ProtocolRevision (dpy)),
1220 make_int (VendorRelease (dpy))); 1220 make_int (VendorRelease (dpy)));
1221 } 1221 }
1222 1222
1223 DEFUN ("x-valid-keysym-name-p", Fx_valid_keysym_name_p, 1, 1, 0, /* 1223 DEFUN ("x-valid-keysym-name-p", Fx_valid_keysym_name_p, 1, 1, 0, /*
1224 Return true if KEYSYM names a keysym that the X library knows about. 1224 Return true if KEYSYM names a keysym that the X library knows about.
1225 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in 1225 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
1233 GET_C_STRING_CTEXT_DATA_ALLOCA (keysym, keysym_ext); 1233 GET_C_STRING_CTEXT_DATA_ALLOCA (keysym, keysym_ext);
1234 1234
1235 return XStringToKeysym (keysym_ext) ? Qt : Qnil; 1235 return XStringToKeysym (keysym_ext) ? Qt : Qnil;
1236 } 1236 }
1237 1237
1238 DEFUN ("x-keysym-on-keyboard-p", Fx_keysym_on_keyboard_p, 1, 2, 0, /* 1238 DEFUN ("x-keysym-hashtable", Fx_keysym_hashtable, 0, 1, 0, /*
1239 Return a hashtable which contains a hash key for all keysyms which
1240 name keys on the keyboard. See `x-keysym-on-keyboard-p'.
1241 */
1242 (device))
1243 {
1244 struct device *d = decode_device (device);
1245 if (!DEVICE_X_P (d))
1246 signal_simple_error ("Not an X device", device);
1247
1248 return DEVICE_X_DATA (d)->x_keysym_map_hashtable;
1249 }
1250
1251 DEFUN ("x-keysym-on-keyboard-sans-modifiers-p",
1252 Fx_keysym_on_keyboard_sans_modifiers_p, 1, 2, 0, /*
1239 Return true if KEYSYM names a key on the keyboard of DEVICE. 1253 Return true if KEYSYM names a key on the keyboard of DEVICE.
1240 More precisely, return true if pressing a physical key 1254 More precisely, return true if pressing a physical key
1241 on the keyboard of DEVICE without any modifier keys generates KEYSYM. 1255 on the keyboard of DEVICE without any modifier keys generates KEYSYM.
1242 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in 1256 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
1243 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system. 1257 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system.
1244 */ 1258 */
1245 (keysym, device)) 1259 (keysym, device))
1246 { 1260 {
1247 struct device *d = decode_device(device); 1261 struct device *d = decode_device (device);
1248 CONST char *keysym_string;
1249 KeySym keysym_KeySym;
1250 KeySym *keysym_ptr, *keysym_last;
1251 int min_code, max_code, keysyms_per_code;
1252
1253 if (!DEVICE_X_P (d)) 1262 if (!DEVICE_X_P (d))
1254 signal_simple_error ("Not an X device", device); 1263 signal_simple_error ("Not an X device", device);
1255 CHECK_STRING (keysym); 1264 CHECK_STRING (keysym);
1256 GET_C_STRING_CTEXT_DATA_ALLOCA (keysym, keysym_string); 1265
1257 keysym_KeySym = XStringToKeysym (keysym_string); 1266 return (EQ (Qsans_modifiers,
1258 if (!keysym_KeySym) /* Invalid keysym */ 1267 Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASHTABLE (d), Qnil)) ?
1259 return Qnil; 1268 Qt : Qnil);
1260 1269 }
1261 XDisplayKeycodes (DEVICE_X_DISPLAY (d), &min_code, &max_code); 1270
1262 keysyms_per_code = DEVICE_X_DATA (d)->x_keysym_map_keysyms_per_code; 1271
1263 keysym_ptr = DEVICE_X_DATA (d)->x_keysym_map; 1272 DEFUN ("x-keysym-on-keyboard-p", Fx_keysym_on_keyboard_p, 1, 2, 0, /*
1264 keysym_last = keysym_ptr + (max_code - min_code) * keysyms_per_code; 1273 Return true if KEYSYM names a key on the keyboard of DEVICE.
1265 for ( ; keysym_ptr <= keysym_last; keysym_ptr += keysyms_per_code) 1274 More precisely, return true if some keystroke (possibly including modifiers)
1266 { 1275 on the keyboard of DEVICE keys generates KEYSYM.
1267 if (keysym_KeySym == *keysym_ptr) 1276 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
1268 return Qt; 1277 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system.
1269 } 1278 */
1270 1279 (keysym, device))
1271 return Qnil; 1280 {
1281 struct device *d = decode_device (device);
1282
1283 if (!DEVICE_X_P (d))
1284 signal_simple_error ("Not an X device", device);
1285 CHECK_STRING (keysym);
1286
1287 return (NILP (Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASHTABLE (d), Qnil)) ?
1288 Qnil : Qt);
1272 } 1289 }
1273 1290
1274 1291
1275 /************************************************************************/ 1292 /************************************************************************/
1276 /* grabs and ungrabs */ 1293 /* grabs and ungrabs */
1414 DEFSUBR (Fdefault_x_device); 1431 DEFSUBR (Fdefault_x_device);
1415 DEFSUBR (Fx_display_visual_class); 1432 DEFSUBR (Fx_display_visual_class);
1416 DEFSUBR (Fx_server_vendor); 1433 DEFSUBR (Fx_server_vendor);
1417 DEFSUBR (Fx_server_version); 1434 DEFSUBR (Fx_server_version);
1418 DEFSUBR (Fx_valid_keysym_name_p); 1435 DEFSUBR (Fx_valid_keysym_name_p);
1436 DEFSUBR (Fx_keysym_hashtable);
1419 DEFSUBR (Fx_keysym_on_keyboard_p); 1437 DEFSUBR (Fx_keysym_on_keyboard_p);
1438 DEFSUBR (Fx_keysym_on_keyboard_sans_modifiers_p);
1420 1439
1421 DEFSUBR (Fx_grab_pointer); 1440 DEFSUBR (Fx_grab_pointer);
1422 DEFSUBR (Fx_ungrab_pointer); 1441 DEFSUBR (Fx_ungrab_pointer);
1423 DEFSUBR (Fx_grab_keyboard); 1442 DEFSUBR (Fx_grab_keyboard);
1424 DEFSUBR (Fx_ungrab_keyboard); 1443 DEFSUBR (Fx_ungrab_keyboard);