3483 |
} |
} |
3484 |
|
|
3485 |
DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, |
DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, |
3486 |
doc: /* Returns the vendor ID string of the X server of display DISPLAY. |
doc: /* Returns the "vendor ID" string of the X server of display DISPLAY. |
3487 |
|
\(Labelling every distributor as a "vendor" embodies the false assumption |
3488 |
|
that operating systems cannot be developed and distributed noncommercially.) |
3489 |
The optional argument DISPLAY specifies which display to ask about. |
The optional argument DISPLAY specifies which display to ask about. |
3490 |
DISPLAY should be either a frame or a display name (a string). |
DISPLAY should be either a frame or a display name (a string). |
3491 |
If omitted or nil, that stands for the selected frame's display. */) |
If omitted or nil, that stands for the selected frame's display. */) |
3502 |
DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, |
DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, |
3503 |
doc: /* Returns the version numbers of the X server of display DISPLAY. |
doc: /* Returns the version numbers of the X server of display DISPLAY. |
3504 |
The value is a list of three integers: the major and minor |
The value is a list of three integers: the major and minor |
3505 |
version numbers of the X Protocol in use, and the vendor-specific release |
version numbers of the X Protocol in use, and the distributor-specific release |
3506 |
number. See also the function `x-server-vendor'. |
number. See also the function `x-server-vendor'. |
3507 |
|
|
3508 |
The optional argument DISPLAY specifies which display to ask about. |
The optional argument DISPLAY specifies which display to ask about. |
5090 |
} |
} |
5091 |
|
|
5092 |
|
|
5093 |
DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, |
DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, |
5094 |
doc: /* Read file name, prompting with PROMPT in directory DIR. |
doc: /* Read file name, prompting with PROMPT in directory DIR. |
5095 |
Use a file selection dialog. |
Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file |
5096 |
Select DEFAULT-FILENAME in the dialog's file selection box, if |
selection box, if specified. If MUSTMATCH is non-nil, the returned file |
5097 |
specified. Don't let the user enter a file name in the file |
or directory must exist. ONLY-DIR-P is ignored." */) |
5098 |
selection dialog's entry field, if MUSTMATCH is non-nil. */) |
(prompt, dir, default_filename, mustmatch, only_dir_p) |
5099 |
(prompt, dir, default_filename, mustmatch) |
Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; |
|
Lisp_Object prompt, dir, default_filename, mustmatch; |
|
5100 |
{ |
{ |
5101 |
int result; |
int result; |
5102 |
struct frame *f = SELECTED_FRAME (); |
struct frame *f = SELECTED_FRAME (); |
5103 |
Lisp_Object file = Qnil; |
Lisp_Object file = Qnil; |
5104 |
Widget dialog, text, list, help; |
Widget dialog, text, help; |
5105 |
Arg al[10]; |
Arg al[10]; |
5106 |
int ac = 0; |
int ac = 0; |
5107 |
extern XtAppContext Xt_app_con; |
extern XtAppContext Xt_app_con; |
5108 |
XmString dir_xmstring, pattern_xmstring; |
XmString dir_xmstring, pattern_xmstring; |
5109 |
int count = SPECPDL_INDEX (); |
int count = SPECPDL_INDEX (); |
5110 |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
5111 |
|
|
5112 |
GCPRO5 (prompt, dir, default_filename, mustmatch, file); |
GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); |
5113 |
CHECK_STRING (prompt); |
CHECK_STRING (prompt); |
5114 |
CHECK_STRING (dir); |
CHECK_STRING (dir); |
5115 |
|
|
5142 |
XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb, |
XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb, |
5143 |
(XtPointer) &result); |
(XtPointer) &result); |
5144 |
|
|
5145 |
/* Disable the help button since we can't display help. */ |
/* Remove the help button since we can't display help. */ |
5146 |
help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); |
help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); |
5147 |
XtSetSensitive (help, False); |
XtUnmanageChild (help); |
5148 |
|
|
5149 |
/* Mark OK button as default. */ |
/* Mark OK button as default. */ |
5150 |
XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON), |
XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON), |
5166 |
/* Manage the dialog, so that list boxes get filled. */ |
/* Manage the dialog, so that list boxes get filled. */ |
5167 |
XtManageChild (dialog); |
XtManageChild (dialog); |
5168 |
|
|
|
/* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME |
|
|
must include the path for this to work. */ |
|
|
list = XmFileSelectionBoxGetChild (dialog, XmDIALOG_LIST); |
|
5169 |
if (STRINGP (default_filename)) |
if (STRINGP (default_filename)) |
5170 |
{ |
{ |
5171 |
XmString default_xmstring; |
XmString default_xmstring; |
5172 |
int item_pos; |
Widget wtext = XmFileSelectionBoxGetChild (dialog, XmDIALOG_TEXT); |
5173 |
|
Widget list = XmFileSelectionBoxGetChild (dialog, XmDIALOG_LIST); |
5174 |
|
|
5175 |
default_xmstring |
XmTextPosition last_pos = XmTextFieldGetLastPosition (wtext); |
5176 |
= XmStringCreateLocalized (SDATA (default_filename)); |
XmTextFieldReplace (wtext, 0, last_pos, |
5177 |
|
(SDATA (Ffile_name_nondirectory (default_filename)))); |
5178 |
|
|
5179 |
if (!XmListItemExists (list, default_xmstring)) |
/* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME |
5180 |
{ |
must include the path for this to work. */ |
5181 |
/* Add a new item if DEFAULT_FILENAME is not in the list. */ |
|
5182 |
XmListAddItem (list, default_xmstring, 0); |
default_xmstring = XmStringCreateLocalized (SDATA (default_filename)); |
|
item_pos = 0; |
|
|
} |
|
|
else |
|
|
item_pos = XmListItemPos (list, default_xmstring); |
|
|
XmStringFree (default_xmstring); |
|
5183 |
|
|
5184 |
/* Select the item and scroll it into view. */ |
if (XmListItemExists (list, default_xmstring)) |
5185 |
XmListSelectPos (list, item_pos, True); |
{ |
5186 |
XmListSetPos (list, item_pos); |
int item_pos = XmListItemPos (list, default_xmstring); |
5187 |
|
/* Select the item and scroll it into view. */ |
5188 |
|
XmListSelectPos (list, item_pos, True); |
5189 |
|
XmListSetPos (list, item_pos); |
5190 |
|
} |
5191 |
|
|
5192 |
|
XmStringFree (default_xmstring); |
5193 |
} |
} |
5194 |
|
|
5195 |
/* Process events until the user presses Cancel or OK. */ |
/* Process events until the user presses Cancel or OK. */ |
5233 |
|
|
5234 |
#ifdef USE_GTK |
#ifdef USE_GTK |
5235 |
|
|
5236 |
DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, |
DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, |
5237 |
"Read file name, prompting with PROMPT in directory DIR.\n\ |
doc: /* Read file name, prompting with PROMPT in directory DIR. |
5238 |
Use a file selection dialog.\n\ |
Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file |
5239 |
Select DEFAULT-FILENAME in the dialog's file selection box, if\n\ |
selection box, if specified. If MUSTMATCH is non-nil, the returned file |
5240 |
specified. Don't let the user enter a file name in the file\n\ |
or directory must exist. If ONLY-DIR-P is non-nil, the user can only select |
5241 |
selection dialog's entry field, if MUSTMATCH is non-nil.") |
directories. */) |
5242 |
(prompt, dir, default_filename, mustmatch) |
(prompt, dir, default_filename, mustmatch, only_dir_p) |
5243 |
Lisp_Object prompt, dir, default_filename, mustmatch; |
Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; |
5244 |
{ |
{ |
5245 |
FRAME_PTR f = SELECTED_FRAME (); |
FRAME_PTR f = SELECTED_FRAME (); |
5246 |
char *fn; |
char *fn; |
5247 |
Lisp_Object file = Qnil; |
Lisp_Object file = Qnil; |
5248 |
int count = specpdl_ptr - specpdl; |
int count = specpdl_ptr - specpdl; |
5249 |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
5250 |
char *cdef_file; |
char *cdef_file; |
5251 |
|
|
5252 |
GCPRO5 (prompt, dir, default_filename, mustmatch, file); |
GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); |
5253 |
CHECK_STRING (prompt); |
CHECK_STRING (prompt); |
5254 |
CHECK_STRING (dir); |
CHECK_STRING (dir); |
5255 |
|
|
5263 |
else |
else |
5264 |
cdef_file = SDATA (dir); |
cdef_file = SDATA (dir); |
5265 |
|
|
5266 |
fn = xg_get_file_name (f, SDATA (prompt), cdef_file, ! NILP (mustmatch)); |
fn = xg_get_file_name (f, SDATA (prompt), cdef_file, |
5267 |
|
! NILP (mustmatch), |
5268 |
|
! NILP (only_dir_p)); |
5269 |
|
|
5270 |
if (fn) |
if (fn) |
5271 |
{ |
{ |