diff options
| author | Richard M. Stallman | 1994-01-26 05:19:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-01-26 05:19:51 +0000 |
| commit | 9ef48a9decdf3b33c0e341c589dc8ce0229e0e48 (patch) | |
| tree | 37e5d939860e0c5ef6294bf55930ff756c8fc2bc /src | |
| parent | 3e285e4daacc9943cb399bf27d86737c6fee8ad2 (diff) | |
| download | emacs-9ef48a9decdf3b33c0e341c589dc8ce0229e0e48.tar.gz emacs-9ef48a9decdf3b33c0e341c589dc8ce0229e0e48.zip | |
Find lwlib.h in ../lwlib.
(store_class_hints): Function deleted.
(Fx_create_frame): Bind x-resource-name to explicit title.
(Qx_resource_name): Declared.
(syms_of_xfns): Set up Qx_resource_name.
(x_window): Fix error message.
(x_any_window_to_frame): New function.
(x_window_to_frame, x_window): Handle USE_X_TOOLKIT.
(x_set_icon_type, x_set_menu_bar_lines, x_set_name): Likewise.
(store_class_hints, hack_wm_protocols): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 271 |
1 files changed, 252 insertions, 19 deletions
diff --git a/src/xfns.c b/src/xfns.c index 99373481b54..4b5de9329c9 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -48,6 +48,34 @@ extern void abort (); | |||
| 48 | #include "[.bitmaps]gray.xbm" | 48 | #include "[.bitmaps]gray.xbm" |
| 49 | #endif | 49 | #endif |
| 50 | 50 | ||
| 51 | #ifdef USE_X_TOOLKIT | ||
| 52 | #include <X11/Shell.h> | ||
| 53 | |||
| 54 | #include <X11/Xaw/Paned.h> | ||
| 55 | #include <X11/Xaw/Label.h> | ||
| 56 | |||
| 57 | #ifdef USG | ||
| 58 | #undef USG /* ####KLUDGE for Solaris 2.2 and up */ | ||
| 59 | #include <X11/Xos.h> | ||
| 60 | #define USG | ||
| 61 | #else | ||
| 62 | #include <X11/Xos.h> | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #include "widget.h" | ||
| 66 | |||
| 67 | #include "../lwlib/lwlib.h" | ||
| 68 | |||
| 69 | /* The one and only application context associated with the connection | ||
| 70 | to the one and only X display that Emacs uses. */ | ||
| 71 | XtAppContext Xt_app_con; | ||
| 72 | |||
| 73 | /* The one and only application shell. Emacs screens are popup shells of this | ||
| 74 | application. */ | ||
| 75 | Widget Xt_app_shell; | ||
| 76 | |||
| 77 | #endif /* USE_X_TOOLKIT */ | ||
| 78 | |||
| 51 | #define min(a,b) ((a) < (b) ? (a) : (b)) | 79 | #define min(a,b) ((a) < (b) ? (a) : (b)) |
| 52 | #define max(a,b) ((a) > (b) ? (a) : (b)) | 80 | #define max(a,b) ((a) > (b) ? (a) : (b)) |
| 53 | 81 | ||
| @@ -195,6 +223,7 @@ Lisp_Object Qvertical_scroll_bars; | |||
| 195 | Lisp_Object Qvisibility; | 223 | Lisp_Object Qvisibility; |
| 196 | Lisp_Object Qwindow_id; | 224 | Lisp_Object Qwindow_id; |
| 197 | Lisp_Object Qx_frame_parameter; | 225 | Lisp_Object Qx_frame_parameter; |
| 226 | Lisp_Object Qx_resource_name; | ||
| 198 | 227 | ||
| 199 | /* The below are defined in frame.c. */ | 228 | /* The below are defined in frame.c. */ |
| 200 | extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; | 229 | extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; |
| @@ -230,12 +259,57 @@ x_window_to_frame (wdesc) | |||
| 230 | if (XGCTYPE (frame) != Lisp_Frame) | 259 | if (XGCTYPE (frame) != Lisp_Frame) |
| 231 | continue; | 260 | continue; |
| 232 | f = XFRAME (frame); | 261 | f = XFRAME (frame); |
| 262 | #ifdef USE_X_TOOLKIT | ||
| 263 | if (f->display.nothing == 1) | ||
| 264 | return 0; | ||
| 265 | if (f->display.x->edit_widget | ||
| 266 | && XtWindow (f->display.x->edit_widget) == wdesc | ||
| 267 | || f->display.x->icon_desc == wdesc) | ||
| 268 | return f; | ||
| 269 | #else /* not USE_X_TOOLKIT */ | ||
| 233 | if (FRAME_X_WINDOW (f) == wdesc | 270 | if (FRAME_X_WINDOW (f) == wdesc |
| 234 | || f->display.x->icon_desc == wdesc) | 271 | || f->display.x->icon_desc == wdesc) |
| 235 | return f; | 272 | return f; |
| 273 | #endif /* not USE_X_TOOLKIT */ | ||
| 274 | } | ||
| 275 | return 0; | ||
| 276 | } | ||
| 277 | |||
| 278 | #ifdef USE_X_TOOLKIT | ||
| 279 | /* Like x_window_to_frame but also compares the window with the widget's | ||
| 280 | windows. */ | ||
| 281 | |||
| 282 | struct frame * | ||
| 283 | x_any_window_to_frame (wdesc) | ||
| 284 | int wdesc; | ||
| 285 | { | ||
| 286 | Lisp_Object tail, frame; | ||
| 287 | struct frame *f; | ||
| 288 | struct x_display *x; | ||
| 289 | |||
| 290 | for (tail = Vframe_list; XGCTYPE (tail) == Lisp_Cons; | ||
| 291 | tail = XCONS (tail)->cdr) | ||
| 292 | { | ||
| 293 | frame = XCONS (tail)->car; | ||
| 294 | if (XGCTYPE (frame) != Lisp_Frame) | ||
| 295 | continue; | ||
| 296 | f = XFRAME (frame); | ||
| 297 | if (f->display.nothing == 1) | ||
| 298 | return 0; | ||
| 299 | x = f->display.x; | ||
| 300 | /* This frame matches if the window is any of its widgets. */ | ||
| 301 | if (wdesc == XtWindow (x->widget) | ||
| 302 | || wdesc == XtWindow (x->column_widget) | ||
| 303 | || wdesc == XtWindow (x->edit_widget)) | ||
| 304 | return f; | ||
| 305 | /* Match if the window is this frame's menubar. */ | ||
| 306 | if (x->menubar_widget | ||
| 307 | && wdesc == XtWindow (x->menubar_widget)) | ||
| 308 | return f; | ||
| 236 | } | 309 | } |
| 237 | return 0; | 310 | return 0; |
| 238 | } | 311 | } |
| 312 | #endif /* USE_X_TOOLKIT */ | ||
| 239 | 313 | ||
| 240 | 314 | ||
| 241 | /* Connect the frame-parameter names for X frames | 315 | /* Connect the frame-parameter names for X frames |
| @@ -856,6 +930,9 @@ x_set_icon_type (f, arg, oldval) | |||
| 856 | /* If the window was unmapped (and its icon was mapped), | 930 | /* If the window was unmapped (and its icon was mapped), |
| 857 | the new icon is not mapped, so map the window in its stead. */ | 931 | the new icon is not mapped, so map the window in its stead. */ |
| 858 | if (FRAME_VISIBLE_P (f)) | 932 | if (FRAME_VISIBLE_P (f)) |
| 933 | #ifdef USE_X_TOOLKIT | ||
| 934 | XtPopup (f->display.x->widget, XtGrabNone); | ||
| 935 | #endif | ||
| 859 | XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); | 936 | XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 860 | 937 | ||
| 861 | XFlushQueue (); | 938 | XFlushQueue (); |
| @@ -993,8 +1070,21 @@ x_set_menu_bar_lines (f, value, oldval) | |||
| 993 | else | 1070 | else |
| 994 | nlines = 0; | 1071 | nlines = 0; |
| 995 | 1072 | ||
| 1073 | #ifdef USE_X_TOOLKIT | ||
| 1074 | FRAME_MENU_BAR_LINES (f) = 0; | ||
| 1075 | if (nlines) | ||
| 1076 | FRAME_EXTERNAL_MENU_BAR (f) = 1; | ||
| 1077 | else | ||
| 1078 | { | ||
| 1079 | if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | ||
| 1080 | XtDestroyWidget (f->display.x->menubar_widget); | ||
| 1081 | FRAME_EXTERNAL_MENU_BAR (f) = 0; | ||
| 1082 | f->display.x->menubar_widget = 0; | ||
| 1083 | } | ||
| 1084 | #else /* not USE_X_TOOLKIT */ | ||
| 996 | FRAME_MENU_BAR_LINES (f) = nlines; | 1085 | FRAME_MENU_BAR_LINES (f) = nlines; |
| 997 | x_set_menu_bar_lines_1 (f->root_window, nlines - olines); | 1086 | x_set_menu_bar_lines_1 (f->root_window, nlines - olines); |
| 1087 | #endif /* not USE_X_TOOLKIT */ | ||
| 998 | } | 1088 | } |
| 999 | 1089 | ||
| 1000 | /* Change the name of frame F to NAME. If NAME is nil, set F's name to | 1090 | /* Change the name of frame F to NAME. If NAME is nil, set F's name to |
| @@ -1041,7 +1131,6 @@ x_set_name (f, name, explicit) | |||
| 1041 | if (FRAME_X_WINDOW (f)) | 1131 | if (FRAME_X_WINDOW (f)) |
| 1042 | { | 1132 | { |
| 1043 | BLOCK_INPUT; | 1133 | BLOCK_INPUT; |
| 1044 | |||
| 1045 | #ifdef HAVE_X11R4 | 1134 | #ifdef HAVE_X11R4 |
| 1046 | { | 1135 | { |
| 1047 | XTextProperty text; | 1136 | XTextProperty text; |
| @@ -1049,16 +1138,21 @@ x_set_name (f, name, explicit) | |||
| 1049 | text.encoding = XA_STRING; | 1138 | text.encoding = XA_STRING; |
| 1050 | text.format = 8; | 1139 | text.format = 8; |
| 1051 | text.nitems = XSTRING (name)->size; | 1140 | text.nitems = XSTRING (name)->size; |
| 1141 | #ifdef USE_X_TOOLKIT | ||
| 1142 | XSetWMName (x_current_display, XtWindow (f->display.x->widget), &text); | ||
| 1143 | XSetWMIconName (x_current_display, XtWindow (f->display.x->widget), | ||
| 1144 | &text); | ||
| 1145 | #else /* not USE_X_TOOLKIT */ | ||
| 1052 | XSetWMName (x_current_display, FRAME_X_WINDOW (f), &text); | 1146 | XSetWMName (x_current_display, FRAME_X_WINDOW (f), &text); |
| 1053 | XSetWMIconName (x_current_display, FRAME_X_WINDOW (f), &text); | 1147 | XSetWMIconName (x_current_display, FRAME_X_WINDOW (f), &text); |
| 1148 | #endif /* not USE_X_TOOLKIT */ | ||
| 1054 | } | 1149 | } |
| 1055 | #else | 1150 | #else /* not HAVE_X11R4 */ |
| 1056 | XSetIconName (XDISPLAY FRAME_X_WINDOW (f), | 1151 | XSetIconName (XDISPLAY FRAME_X_WINDOW (f), |
| 1057 | XSTRING (name)->data); | 1152 | XSTRING (name)->data); |
| 1058 | XStoreName (XDISPLAY FRAME_X_WINDOW (f), | 1153 | XStoreName (XDISPLAY FRAME_X_WINDOW (f), |
| 1059 | XSTRING (name)->data); | 1154 | XSTRING (name)->data); |
| 1060 | #endif | 1155 | #endif /* not HAVE_X11R4 */ |
| 1061 | |||
| 1062 | UNBLOCK_INPUT; | 1156 | UNBLOCK_INPUT; |
| 1063 | } | 1157 | } |
| 1064 | 1158 | ||
| @@ -1153,6 +1247,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 1153 | register char *value; | 1247 | register char *value; |
| 1154 | char *name_key; | 1248 | char *name_key; |
| 1155 | char *class_key; | 1249 | char *class_key; |
| 1250 | Lisp_Object resname; | ||
| 1156 | 1251 | ||
| 1157 | check_x (); | 1252 | check_x (); |
| 1158 | 1253 | ||
| @@ -1167,12 +1262,13 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 1167 | error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | 1262 | error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); |
| 1168 | 1263 | ||
| 1169 | validate_x_resource_name (); | 1264 | validate_x_resource_name (); |
| 1265 | resname = Vx_resource_name; | ||
| 1170 | 1266 | ||
| 1171 | if (NILP (component)) | 1267 | if (NILP (component)) |
| 1172 | { | 1268 | { |
| 1173 | /* Allocate space for the components, the dots which separate them, | 1269 | /* Allocate space for the components, the dots which separate them, |
| 1174 | and the final '\0'. */ | 1270 | and the final '\0'. */ |
| 1175 | name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | 1271 | name_key = (char *) alloca (XSTRING (resname)->size |
| 1176 | + XSTRING (attribute)->size | 1272 | + XSTRING (attribute)->size |
| 1177 | + 2); | 1273 | + 2); |
| 1178 | class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | 1274 | class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) |
| @@ -1180,7 +1276,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 1180 | + 2); | 1276 | + 2); |
| 1181 | 1277 | ||
| 1182 | sprintf (name_key, "%s.%s", | 1278 | sprintf (name_key, "%s.%s", |
| 1183 | XSTRING (Vx_resource_name)->data, | 1279 | XSTRING (resname)->data, |
| 1184 | XSTRING (attribute)->data); | 1280 | XSTRING (attribute)->data); |
| 1185 | sprintf (class_key, "%s.%s", | 1281 | sprintf (class_key, "%s.%s", |
| 1186 | EMACS_CLASS, | 1282 | EMACS_CLASS, |
| @@ -1188,7 +1284,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 1188 | } | 1284 | } |
| 1189 | else | 1285 | else |
| 1190 | { | 1286 | { |
| 1191 | name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | 1287 | name_key = (char *) alloca (XSTRING (resname)->size |
| 1192 | + XSTRING (component)->size | 1288 | + XSTRING (component)->size |
| 1193 | + XSTRING (attribute)->size | 1289 | + XSTRING (attribute)->size |
| 1194 | + 3); | 1290 | + 3); |
| @@ -1199,7 +1295,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 1199 | + 3); | 1295 | + 3); |
| 1200 | 1296 | ||
| 1201 | sprintf (name_key, "%s.%s.%s", | 1297 | sprintf (name_key, "%s.%s.%s", |
| 1202 | XSTRING (Vx_resource_name)->data, | 1298 | XSTRING (resname)->data, |
| 1203 | XSTRING (component)->data, | 1299 | XSTRING (component)->data, |
| 1204 | XSTRING (attribute)->data); | 1300 | XSTRING (attribute)->data); |
| 1205 | sprintf (class_key, "%s.%s.%s", | 1301 | sprintf (class_key, "%s.%s.%s", |
| @@ -1269,7 +1365,7 @@ The defaults are specified in the file `~/.Xdefaults'.") | |||
| 1269 | } | 1365 | } |
| 1270 | 1366 | ||
| 1271 | #define Fx_get_resource(attribute, class, component, subclass) \ | 1367 | #define Fx_get_resource(attribute, class, component, subclass) \ |
| 1272 | Fx_get_default(attribute) | 1368 | Fx_get_default (attribute) |
| 1273 | 1369 | ||
| 1274 | #endif /* X10 */ | 1370 | #endif /* X10 */ |
| 1275 | 1371 | ||
| @@ -1545,15 +1641,143 @@ XSetWMProtocols (dpy, w, protocols, count) | |||
| 1545 | (unsigned char *) protocols, count); | 1641 | (unsigned char *) protocols, count); |
| 1546 | return True; | 1642 | return True; |
| 1547 | } | 1643 | } |
| 1548 | #endif /* !HAVE_X11R4 && !HAVE_XSETWMPROTOCOLS */ | 1644 | #endif /* not HAVE_X11R4 && not HAVE_XSETWMPROTOCOLS */ |
| 1645 | |||
| 1646 | #ifdef USE_X_TOOLKIT | ||
| 1647 | |||
| 1648 | /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS | ||
| 1649 | and WM_DELETE_WINDOW, then add them. (They may already be present | ||
| 1650 | because of the toolkit (Motif adds them, for example, but Xt doesn't). */ | ||
| 1651 | |||
| 1652 | static void | ||
| 1653 | hack_wm_protocols (widget) | ||
| 1654 | Widget widget; | ||
| 1655 | { | ||
| 1656 | Display *dpy = XtDisplay (widget); | ||
| 1657 | Window w = XtWindow (widget); | ||
| 1658 | int need_delete = 1; | ||
| 1659 | int need_focus = 1; | ||
| 1660 | |||
| 1661 | BLOCK_INPUT; | ||
| 1662 | { | ||
| 1663 | Atom type, *atoms = 0; | ||
| 1664 | int format = 0; | ||
| 1665 | unsigned long nitems = 0; | ||
| 1666 | unsigned long bytes_after; | ||
| 1667 | |||
| 1668 | if (Success == XGetWindowProperty (dpy, w, Xatom_wm_protocols, | ||
| 1669 | 0, 100, False, XA_ATOM, | ||
| 1670 | &type, &format, &nitems, &bytes_after, | ||
| 1671 | (unsigned char **) &atoms) | ||
| 1672 | && format == 32 && type == XA_ATOM) | ||
| 1673 | while (nitems > 0) | ||
| 1674 | { | ||
| 1675 | nitems--; | ||
| 1676 | if (atoms [nitems] == Xatom_wm_delete_window) need_delete = 0; | ||
| 1677 | else if (atoms [nitems] == Xatom_wm_take_focus) need_focus = 0; | ||
| 1678 | } | ||
| 1679 | if (atoms) XFree ((char *) atoms); | ||
| 1680 | } | ||
| 1681 | { | ||
| 1682 | Atom props [10]; | ||
| 1683 | int count = 0; | ||
| 1684 | if (need_delete) props [count++] = Xatom_wm_delete_window; | ||
| 1685 | if (need_focus) props [count++] = Xatom_wm_take_focus; | ||
| 1686 | if (count) | ||
| 1687 | XChangeProperty (dpy, w, Xatom_wm_protocols, XA_ATOM, 32, PropModeAppend, | ||
| 1688 | (unsigned char *) props, count); | ||
| 1689 | } | ||
| 1690 | UNBLOCK_INPUT; | ||
| 1691 | } | ||
| 1692 | #endif | ||
| 1693 | |||
| 1694 | /* Create and set up the X window or widget for frame F. */ | ||
| 1549 | 1695 | ||
| 1550 | static void | 1696 | static void |
| 1551 | x_window (f) | 1697 | x_window (f) |
| 1552 | struct frame *f; | 1698 | struct frame *f; |
| 1553 | { | 1699 | { |
| 1700 | XClassHint class_hints; | ||
| 1701 | |||
| 1702 | #ifdef USE_X_TOOLKIT | ||
| 1703 | Widget shell_widget; | ||
| 1704 | Widget pane_widget; | ||
| 1705 | Widget screen_widget; | ||
| 1706 | char* name; | ||
| 1707 | Arg al [25]; | ||
| 1708 | int ac; | ||
| 1709 | |||
| 1710 | BLOCK_INPUT; | ||
| 1711 | |||
| 1712 | if (STRINGP (f->name)) | ||
| 1713 | name = (char*) XSTRING (f->name)->data; | ||
| 1714 | else | ||
| 1715 | name = "emacs"; | ||
| 1716 | |||
| 1717 | ac = 0; | ||
| 1718 | XtSetArg (al[ac], XtNallowShellResize, 1); ac++; | ||
| 1719 | XtSetArg (al[ac], XtNinput, 1); ac++; | ||
| 1720 | XtSetArg (al[ac], XtNx, f->display.x->left_pos); ac++; | ||
| 1721 | XtSetArg (al[ac], XtNy, f->display.x->top_pos); ac++; | ||
| 1722 | shell_widget = XtCreatePopupShell ("shell", | ||
| 1723 | topLevelShellWidgetClass, | ||
| 1724 | Xt_app_shell, al, ac); | ||
| 1725 | |||
| 1726 | /* maybe_set_screen_title_format (shell_widget); */ | ||
| 1727 | |||
| 1728 | |||
| 1729 | ac = 0; | ||
| 1730 | XtSetArg (al[ac], XtNborderWidth, 0); ac++; | ||
| 1731 | pane_widget = XtCreateWidget ("pane", | ||
| 1732 | panedWidgetClass, | ||
| 1733 | shell_widget, al, ac); | ||
| 1734 | |||
| 1735 | /* mappedWhenManaged to false tells to the paned window to not map/unmap | ||
| 1736 | * the emacs screen when changing menubar. This reduces flickering a lot. | ||
| 1737 | */ | ||
| 1738 | |||
| 1739 | ac = 0; | ||
| 1740 | XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++; | ||
| 1741 | XtSetArg (al[ac], XtNshowGrip, 0); ac++; | ||
| 1742 | XtSetArg (al[ac], XtNallowResize, 1); ac++; | ||
| 1743 | XtSetArg (al[ac], XtNresizeToPreferred, 1); ac++; | ||
| 1744 | XtSetArg (al[ac], XtNemacsFrame, f); ac++; | ||
| 1745 | screen_widget = XtCreateWidget (name, | ||
| 1746 | emacsFrameClass, | ||
| 1747 | pane_widget, al, ac); | ||
| 1748 | |||
| 1749 | f->display.x->edit_widget = screen_widget; | ||
| 1750 | f->display.x->widget = shell_widget; | ||
| 1751 | f->display.x->column_widget = pane_widget; | ||
| 1752 | |||
| 1753 | XtManageChild (screen_widget); | ||
| 1754 | XtManageChild (pane_widget); | ||
| 1755 | XtRealizeWidget (shell_widget); | ||
| 1756 | |||
| 1757 | FRAME_X_WINDOW (f) = XtWindow (screen_widget); | ||
| 1758 | |||
| 1759 | validate_x_resource_name (); | ||
| 1760 | class_hints.res_name = (char *) XSTRING (Vx_resource_name)->data; | ||
| 1761 | class_hints.res_class = EMACS_CLASS; | ||
| 1762 | XSetClassHint (x_current_display, XtWindow (shell_widget), &class_hints); | ||
| 1763 | |||
| 1764 | hack_wm_protocols (shell_widget); | ||
| 1765 | |||
| 1766 | /* Do a stupid property change to force the server to generate a | ||
| 1767 | propertyNotify event so that the event_stream server timestamp will | ||
| 1768 | be initialized to something relevant to the time we created the window. | ||
| 1769 | */ | ||
| 1770 | XChangeProperty (XtDisplay (screen_widget), XtWindow (screen_widget), | ||
| 1771 | Xatom_wm_protocols, XA_ATOM, 32, PropModeAppend, | ||
| 1772 | (unsigned char*) NULL, 0); | ||
| 1773 | |||
| 1774 | XtMapWidget (screen_widget); | ||
| 1775 | |||
| 1776 | #else /* not USE_X_TOOLKIT */ | ||
| 1777 | |||
| 1554 | XSetWindowAttributes attributes; | 1778 | XSetWindowAttributes attributes; |
| 1555 | unsigned long attribute_mask; | 1779 | unsigned long attribute_mask; |
| 1556 | XClassHint class_hints; | 1780 | |
| 1557 | 1781 | ||
| 1558 | attributes.background_pixel = f->display.x->background_pixel; | 1782 | attributes.background_pixel = f->display.x->background_pixel; |
| 1559 | attributes.border_pixel = f->display.x->border_pixel; | 1783 | attributes.border_pixel = f->display.x->border_pixel; |
| @@ -1595,6 +1819,8 @@ x_window (f) | |||
| 1595 | XSetWMProtocols (x_current_display, FRAME_X_WINDOW (f), | 1819 | XSetWMProtocols (x_current_display, FRAME_X_WINDOW (f), |
| 1596 | &Xatom_wm_delete_window, 1); | 1820 | &Xatom_wm_delete_window, 1); |
| 1597 | 1821 | ||
| 1822 | #endif /* not USE_X_TOOLKIT */ | ||
| 1823 | |||
| 1598 | /* x_set_name normally ignores requests to set the name if the | 1824 | /* x_set_name normally ignores requests to set the name if the |
| 1599 | requested name is the same as the current name. This is the one | 1825 | requested name is the same as the current name. This is the one |
| 1600 | place where that assumption isn't correct; f->name is set, but | 1826 | place where that assumption isn't correct; f->name is set, but |
| @@ -1610,10 +1836,11 @@ x_window (f) | |||
| 1610 | 1836 | ||
| 1611 | XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), | 1837 | XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), |
| 1612 | f->display.x->text_cursor); | 1838 | f->display.x->text_cursor); |
| 1839 | |||
| 1613 | UNBLOCK_INPUT; | 1840 | UNBLOCK_INPUT; |
| 1614 | 1841 | ||
| 1615 | if (FRAME_X_WINDOW (f) == 0) | 1842 | if (FRAME_X_WINDOW (f) == 0) |
| 1616 | error ("Unable to create window."); | 1843 | error ("Unable to create window"); |
| 1617 | } | 1844 | } |
| 1618 | 1845 | ||
| 1619 | /* Handle the icon stuff for this window. Perhaps later we might | 1846 | /* Handle the icon stuff for this window. Perhaps later we might |
| @@ -1676,13 +1903,13 @@ x_make_gc (f) | |||
| 1676 | BLOCK_INPUT; | 1903 | BLOCK_INPUT; |
| 1677 | 1904 | ||
| 1678 | /* Create the GC's of this frame. | 1905 | /* Create the GC's of this frame. |
| 1679 | Note that many default values are used. */ | 1906 | Note that many default values are used. */ |
| 1680 | 1907 | ||
| 1681 | /* Normal video */ | 1908 | /* Normal video */ |
| 1682 | gc_values.font = f->display.x->font->fid; | 1909 | gc_values.font = f->display.x->font->fid; |
| 1683 | gc_values.foreground = f->display.x->foreground_pixel; | 1910 | gc_values.foreground = f->display.x->foreground_pixel; |
| 1684 | gc_values.background = f->display.x->background_pixel; | 1911 | gc_values.background = f->display.x->background_pixel; |
| 1685 | gc_values.line_width = 0; /* Means 1 using fast algorithm. */ | 1912 | gc_values.line_width = 0; /* Means 1 using fast algorithm. */ |
| 1686 | f->display.x->normal_gc = XCreateGC (x_current_display, | 1913 | f->display.x->normal_gc = XCreateGC (x_current_display, |
| 1687 | FRAME_X_WINDOW (f), | 1914 | FRAME_X_WINDOW (f), |
| 1688 | GCLineWidth | GCFont | 1915 | GCLineWidth | GCFont |
| @@ -1698,7 +1925,7 @@ x_make_gc (f) | |||
| 1698 | | GCLineWidth, | 1925 | | GCLineWidth, |
| 1699 | &gc_values); | 1926 | &gc_values); |
| 1700 | 1927 | ||
| 1701 | /* Cursor has cursor-color background, background-color foreground. */ | 1928 | /* Cursor has cursor-color background, background-color foreground. */ |
| 1702 | gc_values.foreground = f->display.x->background_pixel; | 1929 | gc_values.foreground = f->display.x->background_pixel; |
| 1703 | gc_values.background = f->display.x->cursor_pixel; | 1930 | gc_values.background = f->display.x->cursor_pixel; |
| 1704 | gc_values.fill_style = FillOpaqueStippled; | 1931 | gc_values.fill_style = FillOpaqueStippled; |
| @@ -1713,7 +1940,7 @@ x_make_gc (f) | |||
| 1713 | 1940 | ||
| 1714 | /* Create the gray border tile used when the pointer is not in | 1941 | /* Create the gray border tile used when the pointer is not in |
| 1715 | the frame. Since this depends on the frame's pixel values, | 1942 | the frame. Since this depends on the frame's pixel values, |
| 1716 | this must be done on a per-frame basis. */ | 1943 | this must be done on a per-frame basis. */ |
| 1717 | f->display.x->border_tile | 1944 | f->display.x->border_tile |
| 1718 | = (XCreatePixmapFromBitmapData | 1945 | = (XCreatePixmapFromBitmapData |
| 1719 | (x_current_display, ROOT_WINDOW, | 1946 | (x_current_display, ROOT_WINDOW, |
| @@ -1745,6 +1972,7 @@ be shared by the new frame.") | |||
| 1745 | int minibuffer_only = 0; | 1972 | int minibuffer_only = 0; |
| 1746 | long window_prompting = 0; | 1973 | long window_prompting = 0; |
| 1747 | int width, height; | 1974 | int width, height; |
| 1975 | int count = specpdl_ptr - specpdl; | ||
| 1748 | 1976 | ||
| 1749 | check_x (); | 1977 | check_x (); |
| 1750 | 1978 | ||
| @@ -1781,6 +2009,8 @@ be shared by the new frame.") | |||
| 1781 | { | 2009 | { |
| 1782 | f->name = name; | 2010 | f->name = name; |
| 1783 | f->explicit_name = 1; | 2011 | f->explicit_name = 1; |
| 2012 | /* use the frame's title when getting resources for this frame. */ | ||
| 2013 | specbind (Qx_resource_name, name); | ||
| 1784 | } | 2014 | } |
| 1785 | 2015 | ||
| 1786 | XSET (frame, Lisp_Frame, f); | 2016 | XSET (frame, Lisp_Frame, f); |
| @@ -1820,6 +2050,7 @@ be shared by the new frame.") | |||
| 1820 | x_default_parameter (f, parms, Qfont, font, | 2050 | x_default_parameter (f, parms, Qfont, font, |
| 1821 | "font", "Font", string); | 2051 | "font", "Font", string); |
| 1822 | } | 2052 | } |
| 2053 | |||
| 1823 | x_default_parameter (f, parms, Qborder_width, make_number (2), | 2054 | x_default_parameter (f, parms, Qborder_width, make_number (2), |
| 1824 | "borderwidth", "BorderWidth", number); | 2055 | "borderwidth", "BorderWidth", number); |
| 1825 | /* This defaults to 2 in order to match xterm. We recognize either | 2056 | /* This defaults to 2 in order to match xterm. We recognize either |
| @@ -1915,7 +2146,7 @@ be shared by the new frame.") | |||
| 1915 | ; | 2146 | ; |
| 1916 | } | 2147 | } |
| 1917 | 2148 | ||
| 1918 | return frame; | 2149 | return unbind_to (count, frame); |
| 1919 | #else /* X10 */ | 2150 | #else /* X10 */ |
| 1920 | struct frame *f; | 2151 | struct frame *f; |
| 1921 | Lisp_Object frame, tem; | 2152 | Lisp_Object frame, tem; |
| @@ -2755,8 +2986,8 @@ outline_region (f, gc, top_x, top_y, bottom_x, bottom_y) | |||
| 2755 | register int font_h = FONT_HEIGHT (f->display.x->font); | 2986 | register int font_h = FONT_HEIGHT (f->display.x->font); |
| 2756 | int y = top_y; | 2987 | int y = top_y; |
| 2757 | int x = line_len (y); | 2988 | int x = line_len (y); |
| 2758 | XPoint *pixel_points = (XPoint *) | 2989 | XPoint *pixel_points |
| 2759 | alloca (((bottom_y - top_y + 2) * 4) * sizeof (XPoint)); | 2990 | = (XPoint *) alloca (((bottom_y - top_y + 2) * 4) * sizeof (XPoint)); |
| 2760 | register XPoint *this_point = pixel_points; | 2991 | register XPoint *this_point = pixel_points; |
| 2761 | 2992 | ||
| 2762 | /* Do the horizontal top line/lines */ | 2993 | /* Do the horizontal top line/lines */ |
| @@ -3797,6 +4028,8 @@ syms_of_xfns () | |||
| 3797 | staticpro (&Qwindow_id); | 4028 | staticpro (&Qwindow_id); |
| 3798 | Qx_frame_parameter = intern ("x-frame-parameter"); | 4029 | Qx_frame_parameter = intern ("x-frame-parameter"); |
| 3799 | staticpro (&Qx_frame_parameter); | 4030 | staticpro (&Qx_frame_parameter); |
| 4031 | Qx_resource_name = intern ("x-resource-name"); | ||
| 4032 | staticpro (&Qx_resource_name); | ||
| 3800 | /* This is the end of symbol initialization. */ | 4033 | /* This is the end of symbol initialization. */ |
| 3801 | 4034 | ||
| 3802 | Fput (Qundefined_color, Qerror_conditions, | 4035 | Fput (Qundefined_color, Qerror_conditions, |