comparison src/frame.c @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 98528da0b7fc
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
970 else 970 else
971 return 0; 971 return 0;
972 } 972 }
973 973
974 static int 974 static int
975 frame_matches_frametype (Lisp_Object frame, Lisp_Object type) 975 frame_matches_frame_spec (Lisp_Object frame, Lisp_Object type)
976 { 976 {
977 struct frame *f = XFRAME (frame); 977 struct frame *f = XFRAME (frame);
978 978
979 if (WINDOWP (type)) 979 if (WINDOWP (type))
980 { 980 {
1031 1031
1032 return 1; 1032 return 1;
1033 } 1033 }
1034 1034
1035 int 1035 int
1036 device_matches_console_spec (Lisp_Object device, Lisp_Object console) 1036 device_matches_device_spec (Lisp_Object device, Lisp_Object device_spec)
1037 { 1037 {
1038 if (EQ (console, Qwindow_system)) 1038 if (EQ (device_spec, Qwindow_system))
1039 return DEVICE_WIN_P (XDEVICE (device)); 1039 return DEVICE_WIN_P (XDEVICE (device));
1040 if (DEVICEP (console)) 1040 if (DEVICEP (device_spec))
1041 return EQ (device, console); 1041 return EQ (device, device_spec);
1042 if (CONSOLEP (console)) 1042 if (CONSOLEP (device_spec))
1043 return EQ (DEVICE_CONSOLE (XDEVICE (device)), console); 1043 return EQ (DEVICE_CONSOLE (XDEVICE (device)), device_spec);
1044 if (valid_console_type_p (console)) 1044 if (valid_console_type_p (device_spec))
1045 return EQ (DEVICE_TYPE (XDEVICE (device)), console); 1045 return EQ (DEVICE_TYPE (XDEVICE (device)), device_spec);
1046 return 1; 1046 return 1;
1047 } 1047 }
1048 1048
1049 /* Return the next frame in the frame list after FRAME. 1049 /* Return the next frame in the frame list after FRAME.
1050 FRAMETYPE and CONSOLE control which frames and devices 1050 WHICH-FRAMES and WHICH-DEVICES control which frames and devices
1051 are considered; see `next-frame'. */ 1051 are considered; see `next-frame'. */
1052 1052
1053 Lisp_Object 1053 Lisp_Object
1054 next_frame (Lisp_Object frame, Lisp_Object frametype, Lisp_Object console) 1054 next_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices)
1055 { 1055 {
1056 Lisp_Object first = Qnil; 1056 Lisp_Object first = Qnil;
1057 Lisp_Object devcons, concons; 1057 Lisp_Object devcons, concons;
1058 int passed = 0; 1058 int passed = 0;
1059 1059
1062 DEVICE_LOOP_NO_BREAK (devcons, concons) 1062 DEVICE_LOOP_NO_BREAK (devcons, concons)
1063 { 1063 {
1064 Lisp_Object device = XCAR (devcons); 1064 Lisp_Object device = XCAR (devcons);
1065 Lisp_Object frmcons; 1065 Lisp_Object frmcons;
1066 1066
1067 if (!device_matches_console_spec (device, console)) 1067 if (!device_matches_device_spec (device, which_devices))
1068 { 1068 {
1069 if (EQ (device, FRAME_DEVICE (XFRAME (frame)))) 1069 if (EQ (device, FRAME_DEVICE (XFRAME (frame))))
1070 passed = 1; 1070 passed = 1;
1071 continue; 1071 continue;
1072 } 1072 }
1075 { 1075 {
1076 Lisp_Object f = XCAR (frmcons); 1076 Lisp_Object f = XCAR (frmcons);
1077 1077
1078 if (passed) 1078 if (passed)
1079 { 1079 {
1080 if (frame_matches_frametype (f, frametype)) 1080 if (frame_matches_frame_spec (f, which_frames))
1081 return f; 1081 return f;
1082 } 1082 }
1083 else 1083 else
1084 { 1084 {
1085 if (EQ (frame, f)) 1085 if (EQ (frame, f))
1086 { 1086 {
1087 passed = 1; 1087 passed = 1;
1088 } 1088 }
1089 else 1089 else
1090 { 1090 {
1091 if (NILP (first) && frame_matches_frametype (f, frametype)) 1091 if (NILP (first) && frame_matches_frame_spec (f, which_frames))
1092 first = f; 1092 first = f;
1093 } 1093 }
1094 } 1094 }
1095 } 1095 }
1096 } 1096 }
1105 acceptable frame in the list, return it. */ 1105 acceptable frame in the list, return it. */
1106 return first; 1106 return first;
1107 } 1107 }
1108 1108
1109 /* Return the previous frame in the frame list before FRAME. 1109 /* Return the previous frame in the frame list before FRAME.
1110 FRAMETYPE and CONSOLE control which frames and devices 1110 WHICH-FRAMES and WHICH-DEVICES control which frames and devices
1111 are considered; see `next-frame'. */ 1111 are considered; see `next-frame'. */
1112 1112
1113 Lisp_Object 1113 Lisp_Object
1114 previous_frame (Lisp_Object frame, Lisp_Object frametype, Lisp_Object console) 1114 previous_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices)
1115 { 1115 {
1116 Lisp_Object devcons, concons; 1116 Lisp_Object devcons, concons;
1117 Lisp_Object last = Qnil; 1117 Lisp_Object last = Qnil;
1118 1118
1119 CHECK_LIVE_FRAME (frame); 1119 CHECK_LIVE_FRAME (frame);
1121 DEVICE_LOOP_NO_BREAK (devcons, concons) 1121 DEVICE_LOOP_NO_BREAK (devcons, concons)
1122 { 1122 {
1123 Lisp_Object device = XCAR (devcons); 1123 Lisp_Object device = XCAR (devcons);
1124 Lisp_Object frmcons; 1124 Lisp_Object frmcons;
1125 1125
1126 if (!device_matches_console_spec (device, console)) 1126 if (!device_matches_device_spec (device, which_devices))
1127 { 1127 {
1128 if (EQ (device, FRAME_DEVICE (XFRAME (frame))) 1128 if (EQ (device, FRAME_DEVICE (XFRAME (frame)))
1129 && !NILP (last)) 1129 && !NILP (last))
1130 return last; 1130 return last;
1131 continue; 1131 continue;
1140 if (!NILP (last)) 1140 if (!NILP (last))
1141 return last; 1141 return last;
1142 } 1142 }
1143 else 1143 else
1144 { 1144 {
1145 if (frame_matches_frametype (f, frametype)) 1145 if (frame_matches_frame_spec (f, which_frames))
1146 last = f; 1146 last = f;
1147 } 1147 }
1148 } 1148 }
1149 } 1149 }
1150 1150
1159 return last; 1159 return last;
1160 } 1160 }
1161 1161
1162 DEFUN ("next-frame", Fnext_frame, 0, 3, 0, /* 1162 DEFUN ("next-frame", Fnext_frame, 0, 3, 0, /*
1163 Return the next frame of the right type in the frame list after FRAME. 1163 Return the next frame of the right type in the frame list after FRAME.
1164 FRAMETYPE controls which frames are eligible to be returned; all 1164 WHICH-FRAMES controls which frames are eligible to be returned; all
1165 others will be skipped. Note that if there is only one eligible 1165 others will be skipped. Note that if there is only one eligible
1166 frame, then `next-frame' called repeatedly will always return 1166 frame, then `next-frame' called repeatedly will always return
1167 the same frame, and if there is no eligible frame, then FRAME is 1167 the same frame, and if there is no eligible frame, then FRAME is
1168 returned. 1168 returned.
1169 1169
1170 Possible values for FRAMETYPE are 1170 Possible values for WHICH-FRAMES are
1171 1171
1172 'visible Consider only frames that are visible. 1172 'visible Consider only frames that are visible.
1173 'iconic Consider only frames that are iconic. 1173 'iconic Consider only frames that are iconic.
1174 'invisible Consider only frames that are invisible 1174 'invisible Consider only frames that are invisible
1175 (this is different from iconic). 1175 (this is different from iconic).
1183 frames. 1183 frames.
1184 'invisible-iconic-nomini Like `invisible-iconic' but omits minibuffer-only 1184 'invisible-iconic-nomini Like `invisible-iconic' but omits minibuffer-only
1185 frames. 1185 frames.
1186 any other value Consider all frames. 1186 any other value Consider all frames.
1187 1187
1188 If FRAMETYPE is omitted, 'nomini is used. A FRAMETYPE of 0 (a number) 1188 If WHICH-FRAMES is omitted, 'nomini is used. A value for WHICH-FRAMES
1189 is treated like 'iconic, for backwards compatibility. 1189 of 0 (a number) is treated like 'iconic, for backwards compatibility.
1190 1190
1191 If FRAMETYPE is a window, include only its own frame and any frame now 1191 If WHICH-FRAMES is a window, include only its own frame and any frame
1192 using that window as the minibuffer. 1192 now using that window as the minibuffer.
1193 1193
1194 Optional third argument CONSOLE controls which consoles or devices the 1194 The optional third argument WHICH-DEVICES further clarifies on which
1195 returned frame may be on. If CONSOLE is a console, return frames only 1195 devices to search for frames as specified by WHICH-FRAMES.
1196 on that console. If CONSOLE is a device, return frames only on that 1196 If nil or omitted, search all devices on FRAME's console.
1197 device. If CONSOLE is a console type, return frames only on consoles 1197 If a device, only search that device.
1198 of that type. If CONSOLE is 'window-system, return any frames on any 1198 If a console, search all devices on that console.
1199 window-system consoles. If CONSOLE is nil or omitted, return frames only 1199 If a device type, search all devices of that type.
1200 on the FRAME's console. Otherwise, all frames are considered. 1200 If `window-system', search all window-system devices.
1201 */ 1201 Any other non-nil value means search all devices.
1202 (frame, frametype, console)) 1202 */
1203 (frame, which_frames, which_devices))
1203 { 1204 {
1204 XSETFRAME (frame, decode_frame (frame)); 1205 XSETFRAME (frame, decode_frame (frame));
1205 1206
1206 return next_frame (frame, frametype, console); 1207 return next_frame (frame, which_frames, which_devices);
1207 } 1208 }
1208 1209
1209 DEFUN ("previous-frame", Fprevious_frame, 0, 3, 0, /* 1210 DEFUN ("previous-frame", Fprevious_frame, 0, 3, 0, /*
1210 Return the next frame of the right type in the frame list after FRAME. 1211 Return the next frame of the right type in the frame list after FRAME.
1211 FRAMETYPE controls which frames are eligible to be returned; all 1212 WHICH-FRAMES controls which frames are eligible to be returned; all
1212 others will be skipped. Note that if there is only one eligible 1213 others will be skipped. Note that if there is only one eligible
1213 frame, then `previous-frame' called repeatedly will always return 1214 frame, then `previous-frame' called repeatedly will always return
1214 the same frame, and if there is no eligible frame, then FRAME is 1215 the same frame, and if there is no eligible frame, then FRAME is
1215 returned. 1216 returned.
1216 1217
1217 See `next-frame' for an explanation of the FRAMETYPE and CONSOLE 1218 See `next-frame' for an explanation of the WHICH-FRAMES and WHICH-DEVICES
1218 arguments. 1219 arguments.
1219 */ 1220 */
1220 (frame, frametype, console)) 1221 (frame, which_frames, which_devices))
1221 { 1222 {
1222 XSETFRAME (frame, decode_frame (frame)); 1223 XSETFRAME (frame, decode_frame (frame));
1223 1224
1224 return previous_frame (frame, frametype, console); 1225 return previous_frame (frame, which_frames, which_devices);
1225 } 1226 }
1226 1227
1227 /* Return any frame for which PREDICATE is non-zero, or return Qnil 1228 /* Return any frame for which PREDICATE is non-zero, or return Qnil
1228 if there aren't any. */ 1229 if there aren't any. */
1229 1230
2403 return Qnil; 2404 return Qnil;
2404 } 2405 }
2405 2406
2406 DEFUN ("frame-property", Fframe_property, 2, 3, 0, /* 2407 DEFUN ("frame-property", Fframe_property, 2, 3, 0, /*
2407 Return FRAME's value for property PROPERTY. 2408 Return FRAME's value for property PROPERTY.
2409 Return DEFAULT if there is no such property.
2408 See `set-frame-properties' for the built-in property names. 2410 See `set-frame-properties' for the built-in property names.
2409 */ 2411 */
2410 (frame, property, default_)) 2412 (frame, property, default_))
2411 { 2413 {
2412 struct frame *f = decode_frame (frame); 2414 struct frame *f = decode_frame (frame);
2598 DEFUN ("set-frame-height", Fset_frame_height, 2, 3, 0, /* 2600 DEFUN ("set-frame-height", Fset_frame_height, 2, 3, 0, /*
2599 Specify that the frame FRAME has LINES lines. 2601 Specify that the frame FRAME has LINES lines.
2600 Optional third arg non-nil means that redisplay should use LINES lines 2602 Optional third arg non-nil means that redisplay should use LINES lines
2601 but that the idea of the actual height of the frame should not be changed. 2603 but that the idea of the actual height of the frame should not be changed.
2602 */ 2604 */
2603 (frame, rows, pretend)) 2605 (frame, lines, pretend))
2604 { 2606 {
2605 struct frame *f = decode_frame (frame); 2607 struct frame *f = decode_frame (frame);
2606 int height, width; 2608 int height, width;
2607 XSETFRAME (frame, f); 2609 XSETFRAME (frame, f);
2608 CHECK_INT (rows); 2610 CHECK_INT (lines);
2609 2611
2610 if (window_system_pixelated_geometry (frame)) 2612 if (window_system_pixelated_geometry (frame))
2611 { 2613 {
2612 char_to_real_pixel_size (f, 0, XINT (rows), 0, &height); 2614 char_to_real_pixel_size (f, 0, XINT (lines), 0, &height);
2613 width = FRAME_PIXWIDTH (f); 2615 width = FRAME_PIXWIDTH (f);
2614 } 2616 }
2615 else 2617 else
2616 { 2618 {
2617 height = XINT (rows); 2619 height = XINT (lines);
2618 width = FRAME_WIDTH (f); 2620 width = FRAME_WIDTH (f);
2619 } 2621 }
2620 2622
2621 internal_set_frame_size (f, width, height, !NILP (pretend)); 2623 internal_set_frame_size (f, width, height, !NILP (pretend));
2622 return frame; 2624 return frame;
2648 internal_set_frame_size (f, width, height, !NILP (pretend)); 2650 internal_set_frame_size (f, width, height, !NILP (pretend));
2649 return frame; 2651 return frame;
2650 } 2652 }
2651 2653
2652 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /* 2654 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /*
2653 Set the size of FRAME to COLS by ROWS. 2655 Set the size of FRAME to COLS by ROWS, measured in characters.
2654 Optional fourth arg non-nil means that redisplay should use COLS by ROWS 2656 Optional fourth arg non-nil means that redisplay should use COLS by ROWS
2655 but that the idea of the actual size of the frame should not be changed. 2657 but that the idea of the actual size of the frame should not be changed.
2656 */ 2658 */
2657 (frame, cols, rows, pretend)) 2659 (frame, cols, rows, pretend))
2658 { 2660 {