diff options
| author | Juri Linkov | 2019-09-25 00:50:58 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-09-25 00:50:58 +0300 |
| commit | 8f268bb9bfbaee9f32e7179d56958ef30d66851f (patch) | |
| tree | 955b990b39a86e209550c245a78160d56e79729f /src | |
| parent | 39255b9b4de0b036568b64d7170ba8076d96be1d (diff) | |
| download | emacs-8f268bb9bfbaee9f32e7179d56958ef30d66851f.tar.gz emacs-8f268bb9bfbaee9f32e7179d56958ef30d66851f.zip | |
Revert an attempt to implement a non‐native tab bar on NS.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsfns.m | 55 | ||||
| -rw-r--r-- | src/nsmenu.m | 316 | ||||
| -rw-r--r-- | src/nsterm.h | 65 | ||||
| -rw-r--r-- | src/nsterm.m | 136 | ||||
| -rw-r--r-- | src/xterm.c | 1 |
5 files changed, 14 insertions, 559 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index 308586ef5a8..184fd71678e 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -614,43 +614,8 @@ ns_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 614 | static void | 614 | static void |
| 615 | ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | 615 | ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) |
| 616 | { | 616 | { |
| 617 | /* Currently, when the tab bar changes state, the frame is resized. | 617 | /* Currently unimplemented. */ |
| 618 | |||
| 619 | TODO: It would be better if this didn't occur when 1) the frame | ||
| 620 | is full height or maximized or 2) when specified by | ||
| 621 | `frame-inhibit-implied-resize'. */ | ||
| 622 | int nlines; | ||
| 623 | |||
| 624 | NSTRACE ("ns_set_tab_bar_lines"); | 618 | NSTRACE ("ns_set_tab_bar_lines"); |
| 625 | |||
| 626 | if (FRAME_MINIBUF_ONLY_P (f)) | ||
| 627 | return; | ||
| 628 | |||
| 629 | if (RANGED_FIXNUMP (0, value, INT_MAX)) | ||
| 630 | nlines = XFIXNAT (value); | ||
| 631 | else | ||
| 632 | nlines = 0; | ||
| 633 | |||
| 634 | if (nlines) | ||
| 635 | update_frame_tab_bar (f); | ||
| 636 | |||
| 637 | { | ||
| 638 | int inhibit | ||
| 639 | = ((f->after_make_frame | ||
| 640 | && !f->tab_bar_resized | ||
| 641 | && (EQ (frame_inhibit_implied_resize, Qt) | ||
| 642 | || (CONSP (frame_inhibit_implied_resize) | ||
| 643 | && !NILP (Fmemq (Qtab_bar_lines, | ||
| 644 | frame_inhibit_implied_resize)))) | ||
| 645 | && NILP (get_frame_param (f, Qfullscreen))) | ||
| 646 | ? 0 | ||
| 647 | : 2); | ||
| 648 | |||
| 649 | NSTRACE_MSG ("inhibit:%d", inhibit); | ||
| 650 | |||
| 651 | frame_size_history_add (f, Qupdate_frame_tab_bar, 0, 0, Qnil); | ||
| 652 | adjust_frame_size (f, -1, -1, inhibit, 0, Qtab_bar_lines); | ||
| 653 | } | ||
| 654 | } | 619 | } |
| 655 | 620 | ||
| 656 | 621 | ||
| @@ -1331,10 +1296,6 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 1331 | NILP (Vmenu_bar_mode) | 1296 | NILP (Vmenu_bar_mode) |
| 1332 | ? make_fixnum (0) : make_fixnum (1), | 1297 | ? make_fixnum (0) : make_fixnum (1), |
| 1333 | NULL, NULL, RES_TYPE_NUMBER); | 1298 | NULL, NULL, RES_TYPE_NUMBER); |
| 1334 | gui_default_parameter (f, parms, Qtab_bar_lines, | ||
| 1335 | NILP (Vtab_bar_mode) | ||
| 1336 | ? make_fixnum (0) : make_fixnum (1), | ||
| 1337 | NULL, NULL, RES_TYPE_NUMBER); | ||
| 1338 | gui_default_parameter (f, parms, Qtool_bar_lines, | 1299 | gui_default_parameter (f, parms, Qtool_bar_lines, |
| 1339 | NILP (Vtool_bar_mode) | 1300 | NILP (Vtool_bar_mode) |
| 1340 | ? make_fixnum (0) : make_fixnum (1), | 1301 | ? make_fixnum (0) : make_fixnum (1), |
| @@ -1346,7 +1307,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |||
| 1346 | RES_TYPE_STRING); | 1307 | RES_TYPE_STRING); |
| 1347 | 1308 | ||
| 1348 | parms = get_geometry_from_preferences (dpyinfo, parms); | 1309 | parms = get_geometry_from_preferences (dpyinfo, parms); |
| 1349 | window_prompting = gui_figure_window_size (f, parms, true, true, | 1310 | window_prompting = gui_figure_window_size (f, parms, false, true, |
| 1350 | &x_width, &x_height); | 1311 | &x_width, &x_height); |
| 1351 | 1312 | ||
| 1352 | tem = gui_display_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, | 1313 | tem = gui_display_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, |
| @@ -2839,10 +2800,6 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute) | |||
| 2839 | int native_right = f->left_pos + outer_width - border; | 2800 | int native_right = f->left_pos + outer_width - border; |
| 2840 | int native_bottom = f->top_pos + outer_height - border; | 2801 | int native_bottom = f->top_pos + outer_height - border; |
| 2841 | int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f); | 2802 | int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f); |
| 2842 | int tab_bar_height = FRAME_TABBAR_HEIGHT (f); | ||
| 2843 | int tab_bar_width = (tab_bar_height | ||
| 2844 | ? outer_width - 2 * internal_border_width | ||
| 2845 | : 0); | ||
| 2846 | int tool_bar_height = FRAME_TOOLBAR_HEIGHT (f); | 2803 | int tool_bar_height = FRAME_TOOLBAR_HEIGHT (f); |
| 2847 | int tool_bar_width = (tool_bar_height | 2804 | int tool_bar_width = (tool_bar_height |
| 2848 | ? outer_width - 2 * internal_border_width | 2805 | ? outer_width - 2 * internal_border_width |
| @@ -2858,7 +2815,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute) | |||
| 2858 | native_right, native_bottom); | 2815 | native_right, native_bottom); |
| 2859 | else if (EQ (attribute, Qinner_edges)) | 2816 | else if (EQ (attribute, Qinner_edges)) |
| 2860 | return list4i (native_left + internal_border_width, | 2817 | return list4i (native_left + internal_border_width, |
| 2861 | native_top + tab_bar_height + tool_bar_height + internal_border_width, | 2818 | native_top + tool_bar_height + internal_border_width, |
| 2862 | native_right - internal_border_width, | 2819 | native_right - internal_border_width, |
| 2863 | native_bottom - internal_border_width); | 2820 | native_bottom - internal_border_width); |
| 2864 | else | 2821 | else |
| @@ -2877,9 +2834,6 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute) | |||
| 2877 | Fcons (make_fixnum (0), make_fixnum (title_height))), | 2834 | Fcons (make_fixnum (0), make_fixnum (title_height))), |
| 2878 | Fcons (Qmenu_bar_external, Qnil), | 2835 | Fcons (Qmenu_bar_external, Qnil), |
| 2879 | Fcons (Qmenu_bar_size, Fcons (make_fixnum (0), make_fixnum (0))), | 2836 | Fcons (Qmenu_bar_size, Fcons (make_fixnum (0), make_fixnum (0))), |
| 2880 | Fcons (Qtab_bar_size, | ||
| 2881 | Fcons (make_fixnum (tab_bar_width), | ||
| 2882 | make_fixnum (tab_bar_height))), | ||
| 2883 | Fcons (Qtool_bar_external, | 2837 | Fcons (Qtool_bar_external, |
| 2884 | FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil), | 2838 | FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil), |
| 2885 | Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)), | 2839 | Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)), |
| @@ -2917,9 +2871,6 @@ and width values are in pixels. | |||
| 2917 | `menu-bar-size' is a cons of the width and height of the menu bar of | 2871 | `menu-bar-size' is a cons of the width and height of the menu bar of |
| 2918 | FRAME. | 2872 | FRAME. |
| 2919 | 2873 | ||
| 2920 | `tab-bar-size' is a cons of the width and height of the tab bar of | ||
| 2921 | FRAME. | ||
| 2922 | |||
| 2923 | `tool-bar-external', if non-nil, means the tool bar is external (never | 2874 | `tool-bar-external', if non-nil, means the tool bar is external (never |
| 2924 | included in the inner edges of FRAME). | 2875 | included in the inner edges of FRAME). |
| 2925 | 2876 | ||
diff --git a/src/nsmenu.m b/src/nsmenu.m index 3faa3f27087..817f8cff184 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -993,322 +993,6 @@ ns_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 993 | 993 | ||
| 994 | /* ========================================================================== | 994 | /* ========================================================================== |
| 995 | 995 | ||
| 996 | Tabbar: externally-called functions | ||
| 997 | |||
| 998 | ========================================================================== */ | ||
| 999 | |||
| 1000 | void | ||
| 1001 | free_frame_tab_bar (struct frame *f) | ||
| 1002 | /* -------------------------------------------------------------------------- | ||
| 1003 | Under NS we just hide the tabbar until it might be needed again. | ||
| 1004 | -------------------------------------------------------------------------- */ | ||
| 1005 | { | ||
| 1006 | EmacsView *view = FRAME_NS_VIEW (f); | ||
| 1007 | |||
| 1008 | NSTRACE ("free_frame_tab_bar"); | ||
| 1009 | |||
| 1010 | block_input (); | ||
| 1011 | view->wait_for_tab_bar = NO; | ||
| 1012 | |||
| 1013 | /* Note: This triggers an animation, which calls windowDidResize | ||
| 1014 | repeatedly. */ | ||
| 1015 | f->output_data.ns->in_animation = 1; | ||
| 1016 | [[view tabbar] setVisible: NO]; | ||
| 1017 | f->output_data.ns->in_animation = 0; | ||
| 1018 | |||
| 1019 | unblock_input (); | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | void | ||
| 1023 | update_frame_tab_bar (struct frame *f) | ||
| 1024 | /* -------------------------------------------------------------------------- | ||
| 1025 | Update tabbar contents. | ||
| 1026 | -------------------------------------------------------------------------- */ | ||
| 1027 | { | ||
| 1028 | int i, k = 0; | ||
| 1029 | EmacsView *view = FRAME_NS_VIEW (f); | ||
| 1030 | EmacsTabbar *tabbar = [view tabbar]; | ||
| 1031 | int oldh; | ||
| 1032 | |||
| 1033 | NSTRACE ("update_frame_tab_bar"); | ||
| 1034 | |||
| 1035 | if (view == nil || tabbar == nil) return; | ||
| 1036 | block_input (); | ||
| 1037 | |||
| 1038 | oldh = FRAME_TABBAR_HEIGHT (f); | ||
| 1039 | |||
| 1040 | #ifdef NS_IMPL_COCOA | ||
| 1041 | [tabbar clearActive]; | ||
| 1042 | #else | ||
| 1043 | [tabbar clearAll]; | ||
| 1044 | #endif | ||
| 1045 | |||
| 1046 | /* Update EmacsTabbar as in GtkUtils, build items list. */ | ||
| 1047 | for (i = 0; i < f->n_tab_bar_items; ++i) | ||
| 1048 | { | ||
| 1049 | #define TABPROP(IDX) AREF (f->tab_bar_items, \ | ||
| 1050 | i * TAB_BAR_ITEM_NSLOTS + (IDX)) | ||
| 1051 | |||
| 1052 | BOOL enabled_p = !NILP (TABPROP (TAB_BAR_ITEM_ENABLED_P)); | ||
| 1053 | int idx; | ||
| 1054 | ptrdiff_t img_id; | ||
| 1055 | struct image *img; | ||
| 1056 | Lisp_Object image; | ||
| 1057 | Lisp_Object helpObj; | ||
| 1058 | const char *helpText; | ||
| 1059 | |||
| 1060 | /* Check if this is a separator. */ | ||
| 1061 | if (EQ (TABPROP (TAB_BAR_ITEM_TYPE), Qt)) | ||
| 1062 | { | ||
| 1063 | /* Skip separators. Newer macOS don't show them, and on | ||
| 1064 | GNUstep they are wide as a button, thus overflowing the | ||
| 1065 | tabbar most of the time. */ | ||
| 1066 | continue; | ||
| 1067 | } | ||
| 1068 | |||
| 1069 | /* If image is a vector, choose the image according to the | ||
| 1070 | button state. */ | ||
| 1071 | image = TABPROP (TAB_BAR_ITEM_IMAGES); | ||
| 1072 | if (VECTORP (image)) | ||
| 1073 | { | ||
| 1074 | /* NS tabbar auto-computes disabled and selected images. */ | ||
| 1075 | idx = TAB_BAR_IMAGE_ENABLED_SELECTED; | ||
| 1076 | eassert (ASIZE (image) >= idx); | ||
| 1077 | image = AREF (image, idx); | ||
| 1078 | } | ||
| 1079 | else | ||
| 1080 | { | ||
| 1081 | idx = -1; | ||
| 1082 | } | ||
| 1083 | helpObj = TABPROP (TAB_BAR_ITEM_HELP); | ||
| 1084 | if (NILP (helpObj)) | ||
| 1085 | helpObj = TABPROP (TAB_BAR_ITEM_CAPTION); | ||
| 1086 | helpText = NILP (helpObj) ? "" : SSDATA (helpObj); | ||
| 1087 | |||
| 1088 | /* Ignore invalid image specifications. */ | ||
| 1089 | if (!valid_image_p (image)) | ||
| 1090 | { | ||
| 1091 | /* Don't log anything, GNUS makes invalid images all the time. */ | ||
| 1092 | continue; | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | img_id = lookup_image (f, image); | ||
| 1096 | img = IMAGE_FROM_ID (f, img_id); | ||
| 1097 | prepare_image_for_display (f, img); | ||
| 1098 | |||
| 1099 | if (img->load_failed_p || img->pixmap == nil) | ||
| 1100 | { | ||
| 1101 | NSLog (@"Could not prepare tabbar image for display."); | ||
| 1102 | continue; | ||
| 1103 | } | ||
| 1104 | |||
| 1105 | [tabbar addDisplayItemWithImage: img->pixmap | ||
| 1106 | idx: k++ | ||
| 1107 | tag: i | ||
| 1108 | helpText: helpText | ||
| 1109 | enabled: enabled_p]; | ||
| 1110 | #undef TABPROP | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | if (![tabbar isVisible]) | ||
| 1114 | { | ||
| 1115 | f->output_data.ns->in_animation = 1; | ||
| 1116 | [tabbar setVisible: YES]; | ||
| 1117 | f->output_data.ns->in_animation = 0; | ||
| 1118 | } | ||
| 1119 | |||
| 1120 | #ifdef NS_IMPL_COCOA | ||
| 1121 | if ([tabbar changed]) | ||
| 1122 | { | ||
| 1123 | /* Inform app that tabbar has changed. */ | ||
| 1124 | NSDictionary *dict = [tabbar configurationDictionary]; | ||
| 1125 | NSMutableDictionary *newDict = [dict mutableCopy]; | ||
| 1126 | NSEnumerator *keys = [[dict allKeys] objectEnumerator]; | ||
| 1127 | id key; | ||
| 1128 | while ((key = [keys nextObject]) != nil) | ||
| 1129 | { | ||
| 1130 | NSObject *val = [dict objectForKey: key]; | ||
| 1131 | if ([val isKindOfClass: [NSArray class]]) | ||
| 1132 | { | ||
| 1133 | [newDict setObject: | ||
| 1134 | [tabbar tabbarDefaultItemIdentifiers: tabbar] | ||
| 1135 | forKey: key]; | ||
| 1136 | break; | ||
| 1137 | } | ||
| 1138 | } | ||
| 1139 | [tabbar setConfigurationFromDictionary: newDict]; | ||
| 1140 | [newDict release]; | ||
| 1141 | } | ||
| 1142 | #endif | ||
| 1143 | |||
| 1144 | if (oldh != FRAME_TABBAR_HEIGHT (f)) | ||
| 1145 | [view updateFrameSize:YES]; | ||
| 1146 | if (view->wait_for_tab_bar && FRAME_TABBAR_HEIGHT (f) > 0) | ||
| 1147 | { | ||
| 1148 | view->wait_for_tab_bar = NO; | ||
| 1149 | [view setNeedsDisplay: YES]; | ||
| 1150 | } | ||
| 1151 | |||
| 1152 | unblock_input (); | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | |||
| 1156 | /* ========================================================================== | ||
| 1157 | |||
| 1158 | Tabbar: class implementation | ||
| 1159 | |||
| 1160 | ========================================================================== */ | ||
| 1161 | |||
| 1162 | @implementation EmacsTabbar | ||
| 1163 | |||
| 1164 | - (instancetype)initForView: (EmacsView *)view withIdentifier: (NSString *)identifier | ||
| 1165 | { | ||
| 1166 | NSTRACE ("[EmacsTabbar initForView: withIdentifier:]"); | ||
| 1167 | |||
| 1168 | self = [super initWithIdentifier: identifier]; | ||
| 1169 | emacsView = view; | ||
| 1170 | [self setDisplayMode: NSToolbarDisplayModeIconOnly]; | ||
| 1171 | [self setSizeMode: NSToolbarSizeModeSmall]; | ||
| 1172 | [self setDelegate: self]; | ||
| 1173 | identifierToItem = [[NSMutableDictionary alloc] initWithCapacity: 10]; | ||
| 1174 | activeIdentifiers = [[NSMutableArray alloc] initWithCapacity: 8]; | ||
| 1175 | prevIdentifiers = nil; | ||
| 1176 | prevEnablement = enablement = 0L; | ||
| 1177 | return self; | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | - (void)dealloc | ||
| 1181 | { | ||
| 1182 | NSTRACE ("[EmacsTabbar dealloc]"); | ||
| 1183 | |||
| 1184 | [prevIdentifiers release]; | ||
| 1185 | [activeIdentifiers release]; | ||
| 1186 | [identifierToItem release]; | ||
| 1187 | [super dealloc]; | ||
| 1188 | } | ||
| 1189 | |||
| 1190 | - (void) clearActive | ||
| 1191 | { | ||
| 1192 | NSTRACE ("[EmacsTabbar clearActive]"); | ||
| 1193 | |||
| 1194 | [prevIdentifiers release]; | ||
| 1195 | prevIdentifiers = [activeIdentifiers copy]; | ||
| 1196 | [activeIdentifiers removeAllObjects]; | ||
| 1197 | prevEnablement = enablement; | ||
| 1198 | enablement = 0L; | ||
| 1199 | } | ||
| 1200 | |||
| 1201 | - (void) clearAll | ||
| 1202 | { | ||
| 1203 | NSTRACE ("[EmacsTabbar clearAll]"); | ||
| 1204 | |||
| 1205 | [self clearActive]; | ||
| 1206 | while ([[self items] count] > 0) | ||
| 1207 | [self removeItemAtIndex: 0]; | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | - (BOOL) changed | ||
| 1211 | { | ||
| 1212 | NSTRACE ("[EmacsTabbar changed]"); | ||
| 1213 | |||
| 1214 | return [activeIdentifiers isEqualToArray: prevIdentifiers] && | ||
| 1215 | enablement == prevEnablement ? NO : YES; | ||
| 1216 | } | ||
| 1217 | |||
| 1218 | - (void) addDisplayItemWithImage: (EmacsImage *)img | ||
| 1219 | idx: (int)idx | ||
| 1220 | tag: (int)tag | ||
| 1221 | helpText: (const char *)help | ||
| 1222 | enabled: (BOOL)enabled | ||
| 1223 | { | ||
| 1224 | NSTRACE ("[EmacsTabbar addDisplayItemWithImage: ...]"); | ||
| 1225 | |||
| 1226 | /* 1) come up w/identifier */ | ||
| 1227 | NSString *identifier | ||
| 1228 | = [NSString stringWithFormat: @"%lu", (unsigned long)[img hash]]; | ||
| 1229 | [activeIdentifiers addObject: identifier]; | ||
| 1230 | |||
| 1231 | /* 2) create / reuse item */ | ||
| 1232 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; | ||
| 1233 | if (item == nil) | ||
| 1234 | { | ||
| 1235 | item = [[[NSToolbarItem alloc] initWithItemIdentifier: identifier] | ||
| 1236 | autorelease]; | ||
| 1237 | [item setImage: img]; | ||
| 1238 | [item setTabTip: [NSString stringWithUTF8String: help]]; | ||
| 1239 | [item setTarget: emacsView]; | ||
| 1240 | [item setAction: @selector (tabbarClicked:)]; | ||
| 1241 | [identifierToItem setObject: item forKey: identifier]; | ||
| 1242 | } | ||
| 1243 | |||
| 1244 | #ifdef NS_IMPL_GNUSTEP | ||
| 1245 | [self insertItemWithItemIdentifier: identifier atIndex: idx]; | ||
| 1246 | #endif | ||
| 1247 | |||
| 1248 | [item setTag: tag]; | ||
| 1249 | [item setEnabled: enabled]; | ||
| 1250 | |||
| 1251 | /* 3) update state */ | ||
| 1252 | enablement = (enablement << 1) | (enabled == YES); | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | /* This overrides super's implementation, which automatically sets | ||
| 1256 | all items to enabled state (for some reason). */ | ||
| 1257 | - (void)validateVisibleItems | ||
| 1258 | { | ||
| 1259 | NSTRACE ("[EmacsTabbar validateVisibleItems]"); | ||
| 1260 | } | ||
| 1261 | |||
| 1262 | |||
| 1263 | /* delegate methods */ | ||
| 1264 | |||
| 1265 | - (NSToolbarItem *)tabbar: (NSToolbar *)tabbar | ||
| 1266 | itemForItemIdentifier: (NSString *)itemIdentifier | ||
| 1267 | willBeInsertedIntoTabbar: (BOOL)flag | ||
| 1268 | { | ||
| 1269 | NSTRACE ("[EmacsTabbar tabbar: ...]"); | ||
| 1270 | |||
| 1271 | /* Look up NSToolbarItem by identifier and return... */ | ||
| 1272 | return [identifierToItem objectForKey: itemIdentifier]; | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | - (NSArray *)tabbarDefaultItemIdentifiers: (NSToolbar *)tabbar | ||
| 1276 | { | ||
| 1277 | NSTRACE ("[EmacsTabbar tabbarDefaultItemIdentifiers:]"); | ||
| 1278 | |||
| 1279 | /* Return entire set. */ | ||
| 1280 | return activeIdentifiers; | ||
| 1281 | } | ||
| 1282 | |||
| 1283 | /* for configuration palette (not yet supported) */ | ||
| 1284 | - (NSArray *)tabbarAllowedItemIdentifiers: (NSToolbar *)tabbar | ||
| 1285 | { | ||
| 1286 | NSTRACE ("[EmacsTabbar tabbarAllowedItemIdentifiers:]"); | ||
| 1287 | |||
| 1288 | /* return entire set... */ | ||
| 1289 | return activeIdentifiers; | ||
| 1290 | //return [identifierToItem allKeys]; | ||
| 1291 | } | ||
| 1292 | |||
| 1293 | - (void)setVisible:(BOOL)shown | ||
| 1294 | { | ||
| 1295 | NSTRACE ("[EmacsTabbar setVisible:%d]", shown); | ||
| 1296 | |||
| 1297 | [super setVisible:shown]; | ||
| 1298 | } | ||
| 1299 | |||
| 1300 | |||
| 1301 | /* optional and unneeded */ | ||
| 1302 | /* - tabbarWillAddItem: (NSNotification *)notification { } */ | ||
| 1303 | /* - tabbarDidRemoveItem: (NSNotification *)notification { } */ | ||
| 1304 | /* - (NSArray *)tabbarSelectableItemIdentifiers: (NSToolbar *)tabbar */ | ||
| 1305 | |||
| 1306 | @end /* EmacsTabbar */ | ||
| 1307 | |||
| 1308 | |||
| 1309 | |||
| 1310 | /* ========================================================================== | ||
| 1311 | |||
| 1312 | Toolbar: externally-called functions | 996 | Toolbar: externally-called functions |
| 1313 | 997 | ||
| 1314 | ========================================================================== */ | 998 | ========================================================================== */ |
diff --git a/src/nsterm.h b/src/nsterm.h index fc1745877d2..9773eb3e662 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -397,7 +397,6 @@ typedef id instancetype; | |||
| 397 | 397 | ||
| 398 | ========================================================================== */ | 398 | ========================================================================== */ |
| 399 | 399 | ||
| 400 | @class EmacsTabbar; | ||
| 401 | @class EmacsToolbar; | 400 | @class EmacsToolbar; |
| 402 | 401 | ||
| 403 | #ifdef NS_IMPL_COCOA | 402 | #ifdef NS_IMPL_COCOA |
| @@ -422,18 +421,14 @@ typedef id instancetype; | |||
| 422 | struct frame *emacsframe; | 421 | struct frame *emacsframe; |
| 423 | int rows, cols; | 422 | int rows, cols; |
| 424 | int scrollbarsNeedingUpdate; | 423 | int scrollbarsNeedingUpdate; |
| 425 | EmacsTabbar *tabbar; | ||
| 426 | EmacsToolbar *toolbar; | 424 | EmacsToolbar *toolbar; |
| 427 | NSRect ns_userRect; | 425 | NSRect ns_userRect; |
| 428 | BOOL wait_for_tab_bar; | ||
| 429 | BOOL wait_for_tool_bar; | 426 | BOOL wait_for_tool_bar; |
| 430 | } | 427 | } |
| 431 | 428 | ||
| 432 | /* AppKit-side interface */ | 429 | /* AppKit-side interface */ |
| 433 | - (instancetype)menuDown: (id)sender; | 430 | - (instancetype)menuDown: (id)sender; |
| 434 | - (instancetype)tabbarClicked: (id)item; | ||
| 435 | - (instancetype)toolbarClicked: (id)item; | 431 | - (instancetype)toolbarClicked: (id)item; |
| 436 | - (instancetype)toggleTabbar: (id)sender; | ||
| 437 | - (instancetype)toggleToolbar: (id)sender; | 432 | - (instancetype)toggleToolbar: (id)sender; |
| 438 | - (void)keyDown: (NSEvent *)theEvent; | 433 | - (void)keyDown: (NSEvent *)theEvent; |
| 439 | - (void)mouseDown: (NSEvent *)theEvent; | 434 | - (void)mouseDown: (NSEvent *)theEvent; |
| @@ -442,11 +437,9 @@ typedef id instancetype; | |||
| 442 | 437 | ||
| 443 | /* Emacs-side interface */ | 438 | /* Emacs-side interface */ |
| 444 | - (instancetype) initFrameFromEmacs: (struct frame *) f; | 439 | - (instancetype) initFrameFromEmacs: (struct frame *) f; |
| 445 | - (void) createTabbar: (struct frame *)f; | ||
| 446 | - (void) createToolbar: (struct frame *)f; | 440 | - (void) createToolbar: (struct frame *)f; |
| 447 | - (void) setRows: (int) r andColumns: (int) c; | 441 | - (void) setRows: (int) r andColumns: (int) c; |
| 448 | - (void) setWindowClosing: (BOOL)closing; | 442 | - (void) setWindowClosing: (BOOL)closing; |
| 449 | - (EmacsTabbar *) tabbar; | ||
| 450 | - (EmacsToolbar *) toolbar; | 443 | - (EmacsToolbar *) toolbar; |
| 451 | - (void) deleteWorkingText; | 444 | - (void) deleteWorkingText; |
| 452 | - (void) updateFrameSize: (BOOL) delay; | 445 | - (void) updateFrameSize: (BOOL) delay; |
| @@ -519,45 +512,6 @@ typedef id instancetype; | |||
| 519 | 512 | ||
| 520 | /* ========================================================================== | 513 | /* ========================================================================== |
| 521 | 514 | ||
| 522 | Tabbar | ||
| 523 | |||
| 524 | ========================================================================== */ | ||
| 525 | |||
| 526 | @class EmacsImage; | ||
| 527 | |||
| 528 | #ifdef NS_IMPL_COCOA | ||
| 529 | @interface EmacsTabbar : NSToolbar <NSToolbarDelegate> | ||
| 530 | #else | ||
| 531 | @interface EmacsTabbar : NSToolbar | ||
| 532 | #endif | ||
| 533 | { | ||
| 534 | EmacsView *emacsView; | ||
| 535 | NSMutableDictionary *identifierToItem; | ||
| 536 | NSMutableArray *activeIdentifiers; | ||
| 537 | NSArray *prevIdentifiers; | ||
| 538 | unsigned long enablement, prevEnablement; | ||
| 539 | } | ||
| 540 | - (instancetype) initForView: (EmacsView *)view withIdentifier: (NSString *)identifier; | ||
| 541 | - (void) clearActive; | ||
| 542 | - (void) clearAll; | ||
| 543 | - (BOOL) changed; | ||
| 544 | - (void) addDisplayItemWithImage: (EmacsImage *)img | ||
| 545 | idx: (int)idx | ||
| 546 | tag: (int)tag | ||
| 547 | helpText: (const char *)help | ||
| 548 | enabled: (BOOL)enabled; | ||
| 549 | |||
| 550 | /* delegate methods */ | ||
| 551 | - (NSToolbarItem *)tabbar: (NSToolbar *)tabbar | ||
| 552 | itemForItemIdentifier: (NSString *)itemIdentifier | ||
| 553 | willBeInsertedIntoTabbar: (BOOL)flag; | ||
| 554 | - (NSArray *)tabbarDefaultItemIdentifiers: (NSToolbar *)tabbar; | ||
| 555 | - (NSArray *)tabbarAllowedItemIdentifiers: (NSToolbar *)tabbar; | ||
| 556 | @end | ||
| 557 | |||
| 558 | |||
| 559 | /* ========================================================================== | ||
| 560 | |||
| 561 | Toolbar | 515 | Toolbar |
| 562 | 516 | ||
| 563 | ========================================================================== */ | 517 | ========================================================================== */ |
| @@ -799,7 +753,6 @@ extern EmacsMenu *svcsMenu; | |||
| 799 | #define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12) | 753 | #define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12) |
| 800 | #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13) | 754 | #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13) |
| 801 | #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14) | 755 | #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14) |
| 802 | #define KEY_NS_TOGGLE_TABBAR ((1<<28)|(0<<16)|15) | ||
| 803 | 756 | ||
| 804 | /* Could use list to store these, but rest of emacs has a big infrastructure | 757 | /* Could use list to store these, but rest of emacs has a big infrastructure |
| 805 | for managing a table of bitmap "records". */ | 758 | for managing a table of bitmap "records". */ |
| @@ -970,7 +923,6 @@ struct ns_output | |||
| 970 | NSColor *cursor_color; | 923 | NSColor *cursor_color; |
| 971 | NSColor *foreground_color; | 924 | NSColor *foreground_color; |
| 972 | NSColor *background_color; | 925 | NSColor *background_color; |
| 973 | EmacsTabbar *tabbar; | ||
| 974 | EmacsToolbar *toolbar; | 926 | EmacsToolbar *toolbar; |
| 975 | #else | 927 | #else |
| 976 | void *view; | 928 | void *view; |
| @@ -978,7 +930,6 @@ struct ns_output | |||
| 978 | void *cursor_color; | 930 | void *cursor_color; |
| 979 | void *foreground_color; | 931 | void *foreground_color; |
| 980 | void *background_color; | 932 | void *background_color; |
| 981 | void *tabbar; | ||
| 982 | void *toolbar; | 933 | void *toolbar; |
| 983 | #endif | 934 | #endif |
| 984 | 935 | ||
| @@ -1023,9 +974,6 @@ struct ns_output | |||
| 1023 | /* The height of the titlebar decoration (included in NSWindow's frame). */ | 974 | /* The height of the titlebar decoration (included in NSWindow's frame). */ |
| 1024 | int titlebar_height; | 975 | int titlebar_height; |
| 1025 | 976 | ||
| 1026 | /* The height of the tabbar if displayed, else 0. */ | ||
| 1027 | int tabbar_height; | ||
| 1028 | |||
| 1029 | /* The height of the toolbar if displayed, else 0. */ | 977 | /* The height of the toolbar if displayed, else 0. */ |
| 1030 | int toolbar_height; | 978 | int toolbar_height; |
| 1031 | 979 | ||
| @@ -1081,16 +1029,6 @@ struct x_output | |||
| 1081 | [[FRAME_NS_VIEW (f) window] frame] \ | 1029 | [[FRAME_NS_VIEW (f) window] frame] \ |
| 1082 | styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]))) | 1030 | styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]))) |
| 1083 | 1031 | ||
| 1084 | /* Compute pixel height of the tabbar. */ | ||
| 1085 | #define FRAME_TABBAR_HEIGHT(f) \ | ||
| 1086 | (([[FRAME_NS_VIEW (f) window] tabbar] == nil \ | ||
| 1087 | || ! [[FRAME_NS_VIEW (f) window] tabbar].isVisible) ? \ | ||
| 1088 | 0 \ | ||
| 1089 | : (int)(NSHeight([NSWindow contentRectForFrameRect: \ | ||
| 1090 | [[FRAME_NS_VIEW (f) window] frame] \ | ||
| 1091 | styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]) \ | ||
| 1092 | - NSHeight([[[FRAME_NS_VIEW (f) window] contentView] frame]))) | ||
| 1093 | |||
| 1094 | /* Compute pixel height of the toolbar. */ | 1032 | /* Compute pixel height of the toolbar. */ |
| 1095 | #define FRAME_TOOLBAR_HEIGHT(f) \ | 1033 | #define FRAME_TOOLBAR_HEIGHT(f) \ |
| 1096 | (([[FRAME_NS_VIEW (f) window] toolbar] == nil \ | 1034 | (([[FRAME_NS_VIEW (f) window] toolbar] == nil \ |
| @@ -1231,8 +1169,6 @@ extern const char *ns_get_defaults_value (const char *key); | |||
| 1231 | extern void ns_init_locale (void); | 1169 | extern void ns_init_locale (void); |
| 1232 | 1170 | ||
| 1233 | /* in nsmenu */ | 1171 | /* in nsmenu */ |
| 1234 | extern void update_frame_tab_bar (struct frame *f); | ||
| 1235 | extern void free_frame_tab_bar (struct frame *f); | ||
| 1236 | extern void update_frame_tool_bar (struct frame *f); | 1172 | extern void update_frame_tool_bar (struct frame *f); |
| 1237 | extern void free_frame_tool_bar (struct frame *f); | 1173 | extern void free_frame_tool_bar (struct frame *f); |
| 1238 | extern Lisp_Object find_and_return_menu_selection (struct frame *f, | 1174 | extern Lisp_Object find_and_return_menu_selection (struct frame *f, |
| @@ -1340,7 +1276,6 @@ extern char gnustep_base_version[]; /* version tracking */ | |||
| 1340 | #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) | 1276 | #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) |
| 1341 | #define NSApplicationPresentationFullScreen (1 << 10) | 1277 | #define NSApplicationPresentationFullScreen (1 << 10) |
| 1342 | #define NSApplicationPresentationAutoHideToolbar (1 << 11) | 1278 | #define NSApplicationPresentationAutoHideToolbar (1 << 11) |
| 1343 | #define NSApplicationPresentationAutoHideTabbar (1 << 12) | ||
| 1344 | #define NSAppKitVersionNumber10_7 1138 | 1279 | #define NSAppKitVersionNumber10_7 1138 |
| 1345 | #endif /* !defined (MAC_OS_X_VERSION_10_7) */ | 1280 | #endif /* !defined (MAC_OS_X_VERSION_10_7) */ |
| 1346 | 1281 | ||
diff --git a/src/nsterm.m b/src/nsterm.m index ff2d195d2fa..c8094d0ee37 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1088,15 +1088,11 @@ ns_update_begin (struct frame *f) | |||
| 1088 | 1088 | ||
| 1089 | if ([view isFullscreen] && [view fsIsNative]) | 1089 | if ([view isFullscreen] && [view fsIsNative]) |
| 1090 | { | 1090 | { |
| 1091 | // Fix reappearing tool bar or tab bar in fullscreen for Mac OS X 10.7 | 1091 | // Fix reappearing tool bar in fullscreen for Mac OS X 10.7 |
| 1092 | BOOL tarbar_visible = NO; | 1092 | BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO; |
| 1093 | NSToolbar *tabbar = [FRAME_NS_VIEW (f) tabbar]; | ||
| 1094 | if (! tarbar_visible != ! [tabbar isVisible]) | ||
| 1095 | [tabbar setVisible: tarbar_visible]; | ||
| 1096 | BOOL toolbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO; | ||
| 1097 | NSToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; | 1093 | NSToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; |
| 1098 | if (! toolbar_visible != ! [toolbar isVisible]) | 1094 | if (! tbar_visible != ! [toolbar isVisible]) |
| 1099 | [toolbar setVisible: toolbar_visible]; | 1095 | [toolbar setVisible: tbar_visible]; |
| 1100 | } | 1096 | } |
| 1101 | #endif | 1097 | #endif |
| 1102 | } | 1098 | } |
| @@ -1687,7 +1683,7 @@ ns_set_offset (struct frame *f, int xoff, int yoff, int change_grav) | |||
| 1687 | f->top_pos = f->size_hint_flags & YNegative | 1683 | f->top_pos = f->size_hint_flags & YNegative |
| 1688 | ? ([screen visibleFrame].size.height + f->top_pos | 1684 | ? ([screen visibleFrame].size.height + f->top_pos |
| 1689 | - FRAME_PIXEL_HEIGHT (f) - FRAME_NS_TITLEBAR_HEIGHT (f) | 1685 | - FRAME_PIXEL_HEIGHT (f) - FRAME_NS_TITLEBAR_HEIGHT (f) |
| 1690 | - FRAME_TABBAR_HEIGHT (f) - FRAME_TOOLBAR_HEIGHT (f)) | 1686 | - FRAME_TOOLBAR_HEIGHT (f)) |
| 1691 | : f->top_pos; | 1687 | : f->top_pos; |
| 1692 | #ifdef NS_IMPL_GNUSTEP | 1688 | #ifdef NS_IMPL_GNUSTEP |
| 1693 | if (f->left_pos < 100) | 1689 | if (f->left_pos < 100) |
| @@ -1705,7 +1701,7 @@ ns_set_offset (struct frame *f, int xoff, int yoff, int change_grav) | |||
| 1705 | f->left_pos = FRAME_PIXEL_WIDTH (parent) - FRAME_PIXEL_WIDTH (f) + f->left_pos; | 1701 | f->left_pos = FRAME_PIXEL_WIDTH (parent) - FRAME_PIXEL_WIDTH (f) + f->left_pos; |
| 1706 | 1702 | ||
| 1707 | if (f->top_pos < 0) | 1703 | if (f->top_pos < 0) |
| 1708 | f->top_pos = FRAME_PIXEL_HEIGHT (parent) + FRAME_TABBAR_HEIGHT (parent) + FRAME_TOOLBAR_HEIGHT (parent) | 1704 | f->top_pos = FRAME_PIXEL_HEIGHT (parent) + FRAME_TOOLBAR_HEIGHT (parent) |
| 1709 | - FRAME_PIXEL_HEIGHT (f) + f->top_pos; | 1705 | - FRAME_PIXEL_HEIGHT (f) + f->top_pos; |
| 1710 | } | 1706 | } |
| 1711 | 1707 | ||
| @@ -1768,7 +1764,6 @@ ns_set_window_size (struct frame *f, | |||
| 1768 | wr.size.height = pixelheight; | 1764 | wr.size.height = pixelheight; |
| 1769 | if (! [view isFullscreen]) | 1765 | if (! [view isFullscreen]) |
| 1770 | wr.size.height += FRAME_NS_TITLEBAR_HEIGHT (f) | 1766 | wr.size.height += FRAME_NS_TITLEBAR_HEIGHT (f) |
| 1771 | + FRAME_TABBAR_HEIGHT (f) | ||
| 1772 | + FRAME_TOOLBAR_HEIGHT (f); | 1767 | + FRAME_TOOLBAR_HEIGHT (f); |
| 1773 | 1768 | ||
| 1774 | /* Do not try to constrain to this screen. We may have multiple | 1769 | /* Do not try to constrain to this screen. We may have multiple |
| @@ -1785,7 +1780,7 @@ ns_set_window_size (struct frame *f, | |||
| 1785 | Fcons (make_fixnum (wr.size.width), make_fixnum (wr.size.height)), | 1780 | Fcons (make_fixnum (wr.size.width), make_fixnum (wr.size.height)), |
| 1786 | make_fixnum (f->border_width), | 1781 | make_fixnum (f->border_width), |
| 1787 | make_fixnum (FRAME_NS_TITLEBAR_HEIGHT (f)), | 1782 | make_fixnum (FRAME_NS_TITLEBAR_HEIGHT (f)), |
| 1788 | make_fixnum (FRAME_TABBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)))); | 1783 | make_fixnum (FRAME_TOOLBAR_HEIGHT (f)))); |
| 1789 | 1784 | ||
| 1790 | [window setFrame: wr display: YES]; | 1785 | [window setFrame: wr display: YES]; |
| 1791 | 1786 | ||
| @@ -1822,12 +1817,10 @@ ns_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu | |||
| 1822 | [window setStyleMask: ((window.styleMask | FRAME_DECORATED_FLAGS) | 1817 | [window setStyleMask: ((window.styleMask | FRAME_DECORATED_FLAGS) |
| 1823 | ^ FRAME_UNDECORATED_FLAGS)]; | 1818 | ^ FRAME_UNDECORATED_FLAGS)]; |
| 1824 | 1819 | ||
| 1825 | [view createTabbar: f]; | ||
| 1826 | [view createToolbar: f]; | 1820 | [view createToolbar: f]; |
| 1827 | } | 1821 | } |
| 1828 | else | 1822 | else |
| 1829 | { | 1823 | { |
| 1830 | [window setTabbar: nil]; | ||
| 1831 | [window setToolbar: nil]; | 1824 | [window setToolbar: nil]; |
| 1832 | /* Do I need to release the toolbar here? */ | 1825 | /* Do I need to release the toolbar here? */ |
| 1833 | 1826 | ||
| @@ -2412,7 +2405,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | |||
| 2412 | CGPoint mouse_pos = | 2405 | CGPoint mouse_pos = |
| 2413 | CGPointMake(f->left_pos + pix_x, | 2406 | CGPointMake(f->left_pos + pix_x, |
| 2414 | f->top_pos + pix_y + | 2407 | f->top_pos + pix_y + |
| 2415 | FRAME_NS_TITLEBAR_HEIGHT(f) + FRAME_TABBAR_HEIGHT(f) + FRAME_TOOLBAR_HEIGHT(f)); | 2408 | FRAME_NS_TITLEBAR_HEIGHT(f) + FRAME_TOOLBAR_HEIGHT(f)); |
| 2416 | CGWarpMouseCursorPosition (mouse_pos); | 2409 | CGWarpMouseCursorPosition (mouse_pos); |
| 2417 | #endif | 2410 | #endif |
| 2418 | } | 2411 | } |
| @@ -6107,7 +6100,6 @@ not_in_argv (NSString *arg) | |||
| 6107 | - (void)dealloc | 6100 | - (void)dealloc |
| 6108 | { | 6101 | { |
| 6109 | NSTRACE ("[EmacsView dealloc]"); | 6102 | NSTRACE ("[EmacsView dealloc]"); |
| 6110 | [tabbar release]; | ||
| 6111 | [toolbar release]; | 6103 | [toolbar release]; |
| 6112 | if (fs_state == FULLSCREEN_BOTH) | 6104 | if (fs_state == FULLSCREEN_BOTH) |
| 6113 | [nonfs_window release]; | 6105 | [nonfs_window release]; |
| @@ -6959,40 +6951,19 @@ not_in_argv (NSString *arg) | |||
| 6959 | 6951 | ||
| 6960 | if (! [self isFullscreen]) | 6952 | if (! [self isFullscreen]) |
| 6961 | { | 6953 | { |
| 6962 | int tabbar_height; | ||
| 6963 | int toolbar_height; | 6954 | int toolbar_height; |
| 6964 | #ifdef NS_IMPL_GNUSTEP | 6955 | #ifdef NS_IMPL_GNUSTEP |
| 6965 | // GNUstep does not always update the tool bar height. Force it. | 6956 | // GNUstep does not always update the tool bar height. Force it. |
| 6966 | if (toolbar && [toolbar isVisible]) | 6957 | if (toolbar && [toolbar isVisible]) |
| 6967 | update_frame_tool_bar (emacsframe); | 6958 | update_frame_tool_bar (emacsframe); |
| 6968 | if (tabbar && [tabbar isVisible]) | ||
| 6969 | update_frame_tab_bar (emacsframe); | ||
| 6970 | #endif | 6959 | #endif |
| 6971 | 6960 | ||
| 6972 | tabbar_height = FRAME_TABBAR_HEIGHT (emacsframe); | ||
| 6973 | if (tabbar_height < 0) | ||
| 6974 | tabbar_height = 35; | ||
| 6975 | |||
| 6976 | toolbar_height = FRAME_TOOLBAR_HEIGHT (emacsframe); | 6961 | toolbar_height = FRAME_TOOLBAR_HEIGHT (emacsframe); |
| 6977 | if (toolbar_height < 0) | 6962 | if (toolbar_height < 0) |
| 6978 | toolbar_height = 35; | 6963 | toolbar_height = 35; |
| 6979 | 6964 | ||
| 6980 | extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) | 6965 | extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) |
| 6981 | + tabbar_height + toolbar_height; | 6966 | + toolbar_height; |
| 6982 | } | ||
| 6983 | |||
| 6984 | if (wait_for_tab_bar) | ||
| 6985 | { | ||
| 6986 | /* The tabbar height is always 0 in fullscreen and undecorated | ||
| 6987 | frames, so don't wait for it to become available. */ | ||
| 6988 | if (FRAME_TABBAR_HEIGHT (emacsframe) == 0 | ||
| 6989 | && FRAME_UNDECORATED (emacsframe) == false | ||
| 6990 | && ! [self isFullscreen]) | ||
| 6991 | { | ||
| 6992 | NSTRACE_MSG ("Waiting for tabbar"); | ||
| 6993 | return; | ||
| 6994 | } | ||
| 6995 | wait_for_tab_bar = NO; | ||
| 6996 | } | 6967 | } |
| 6997 | 6968 | ||
| 6998 | if (wait_for_tool_bar) | 6969 | if (wait_for_tool_bar) |
| @@ -7013,7 +6984,6 @@ not_in_argv (NSString *arg) | |||
| 7013 | newh = (int)wr.size.height - extra; | 6984 | newh = (int)wr.size.height - extra; |
| 7014 | 6985 | ||
| 7015 | NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); | 6986 | NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); |
| 7016 | NSTRACE_MSG ("FRAME_TABBAR_HEIGHT: %d", FRAME_TABBAR_HEIGHT (emacsframe)); | ||
| 7017 | NSTRACE_MSG ("FRAME_TOOLBAR_HEIGHT: %d", FRAME_TOOLBAR_HEIGHT (emacsframe)); | 6987 | NSTRACE_MSG ("FRAME_TOOLBAR_HEIGHT: %d", FRAME_TOOLBAR_HEIGHT (emacsframe)); |
| 7018 | NSTRACE_MSG ("FRAME_NS_TITLEBAR_HEIGHT: %d", FRAME_NS_TITLEBAR_HEIGHT (emacsframe)); | 6988 | NSTRACE_MSG ("FRAME_NS_TITLEBAR_HEIGHT: %d", FRAME_NS_TITLEBAR_HEIGHT (emacsframe)); |
| 7019 | 6989 | ||
| @@ -7088,7 +7058,6 @@ not_in_argv (NSString *arg) | |||
| 7088 | if (! [self isFullscreen]) | 7058 | if (! [self isFullscreen]) |
| 7089 | { | 7059 | { |
| 7090 | extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) | 7060 | extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) |
| 7091 | + FRAME_TABBAR_HEIGHT (emacsframe) | ||
| 7092 | + FRAME_TOOLBAR_HEIGHT (emacsframe); | 7061 | + FRAME_TOOLBAR_HEIGHT (emacsframe); |
| 7093 | } | 7062 | } |
| 7094 | 7063 | ||
| @@ -7315,33 +7284,6 @@ not_in_argv (NSString *arg) | |||
| 7315 | } | 7284 | } |
| 7316 | 7285 | ||
| 7317 | 7286 | ||
| 7318 | - (void)createTabbar: (struct frame *)f | ||
| 7319 | { | ||
| 7320 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | ||
| 7321 | NSWindow *window = [view window]; | ||
| 7322 | |||
| 7323 | tabbar = [[EmacsTabbar alloc] initForView: self withIdentifier: | ||
| 7324 | [NSString stringWithFormat: @"Emacs Frame %d", | ||
| 7325 | ns_window_num]]; | ||
| 7326 | [tabbar setVisible: NO]; | ||
| 7327 | [window setTabbar: tabbar]; | ||
| 7328 | |||
| 7329 | /* Don't set frame garbaged until tab bar is up to date? | ||
| 7330 | This avoids an extra clear and redraw (flicker) at frame creation. */ | ||
| 7331 | wait_for_tab_bar = NO; | ||
| 7332 | |||
| 7333 | |||
| 7334 | #ifdef NS_IMPL_COCOA | ||
| 7335 | { | ||
| 7336 | NSButton *toggleButton; | ||
| 7337 | toggleButton = [window standardWindowButton: NSWindowToolbarButton]; | ||
| 7338 | [toggleButton setTarget: self]; | ||
| 7339 | [toggleButton setAction: @selector (toggleTabbar: )]; | ||
| 7340 | } | ||
| 7341 | #endif | ||
| 7342 | } | ||
| 7343 | |||
| 7344 | |||
| 7345 | - (void)createToolbar: (struct frame *)f | 7287 | - (void)createToolbar: (struct frame *)f |
| 7346 | { | 7288 | { |
| 7347 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | 7289 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); |
| @@ -7448,10 +7390,6 @@ not_in_argv (NSString *arg) | |||
| 7448 | NILP (tem) ? "Emacs" : SSDATA (tem)]; | 7390 | NILP (tem) ? "Emacs" : SSDATA (tem)]; |
| 7449 | [win setTitle: name]; | 7391 | [win setTitle: name]; |
| 7450 | 7392 | ||
| 7451 | /* tabbar support */ | ||
| 7452 | if (! FRAME_UNDECORATED (f)) | ||
| 7453 | [self createTabbar: f]; | ||
| 7454 | |||
| 7455 | /* toolbar support */ | 7393 | /* toolbar support */ |
| 7456 | if (! FRAME_UNDECORATED (f)) | 7394 | if (! FRAME_UNDECORATED (f)) |
| 7457 | [self createToolbar: f]; | 7395 | [self createToolbar: f]; |
| @@ -7787,8 +7725,7 @@ not_in_argv (NSString *arg) | |||
| 7787 | } | 7725 | } |
| 7788 | else | 7726 | else |
| 7789 | { | 7727 | { |
| 7790 | BOOL tarbar_visible = NO; | 7728 | BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO; |
| 7791 | BOOL toolbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO; | ||
| 7792 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 \ | 7729 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 \ |
| 7793 | && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 | 7730 | && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 |
| 7794 | unsigned val = (unsigned)[NSApp presentationOptions]; | 7731 | unsigned val = (unsigned)[NSApp presentationOptions]; |
| @@ -7801,14 +7738,12 @@ not_in_argv (NSString *arg) | |||
| 7801 | = NSApplicationPresentationAutoHideDock | 7738 | = NSApplicationPresentationAutoHideDock |
| 7802 | | NSApplicationPresentationAutoHideMenuBar | 7739 | | NSApplicationPresentationAutoHideMenuBar |
| 7803 | | NSApplicationPresentationFullScreen | 7740 | | NSApplicationPresentationFullScreen |
| 7804 | | NSApplicationPresentationAutoHideTabbar | ||
| 7805 | | NSApplicationPresentationAutoHideToolbar; | 7741 | | NSApplicationPresentationAutoHideToolbar; |
| 7806 | 7742 | ||
| 7807 | [NSApp setPresentationOptions: options]; | 7743 | [NSApp setPresentationOptions: options]; |
| 7808 | } | 7744 | } |
| 7809 | #endif | 7745 | #endif |
| 7810 | [tabbar setVisible:tarbar_visible]; | 7746 | [toolbar setVisible:tbar_visible]; |
| 7811 | [toolbar setVisible:toolbar_visible]; | ||
| 7812 | } | 7747 | } |
| 7813 | } | 7748 | } |
| 7814 | 7749 | ||
| @@ -7849,8 +7784,6 @@ not_in_argv (NSString *arg) | |||
| 7849 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 | 7784 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 |
| 7850 | [self updateCollectionBehavior]; | 7785 | [self updateCollectionBehavior]; |
| 7851 | #endif | 7786 | #endif |
| 7852 | [tabbar setVisible:NO]; | ||
| 7853 | |||
| 7854 | if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) | 7787 | if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) |
| 7855 | { | 7788 | { |
| 7856 | [toolbar setVisible:YES]; | 7789 | [toolbar setVisible:YES]; |
| @@ -8164,53 +8097,6 @@ not_in_argv (NSString *arg) | |||
| 8164 | } | 8097 | } |
| 8165 | 8098 | ||
| 8166 | 8099 | ||
| 8167 | - (EmacsTabbar *)tabbar | ||
| 8168 | { | ||
| 8169 | return tabbar; | ||
| 8170 | } | ||
| 8171 | |||
| 8172 | |||
| 8173 | /* This gets called on tabbar button click. */ | ||
| 8174 | - (instancetype)tabbarClicked: (id)item | ||
| 8175 | { | ||
| 8176 | NSEvent *theEvent; | ||
| 8177 | int idx = [item tag] * TAB_BAR_ITEM_NSLOTS; | ||
| 8178 | |||
| 8179 | NSTRACE ("[EmacsView tabbarClicked:]"); | ||
| 8180 | |||
| 8181 | if (!emacs_event) | ||
| 8182 | return self; | ||
| 8183 | |||
| 8184 | /* Send first event (for some reason two needed). */ | ||
| 8185 | theEvent = [[self window] currentEvent]; | ||
| 8186 | emacs_event->kind = TAB_BAR_EVENT; | ||
| 8187 | XSETFRAME (emacs_event->arg, emacsframe); | ||
| 8188 | EV_TRAILER (theEvent); | ||
| 8189 | |||
| 8190 | emacs_event->kind = TAB_BAR_EVENT; | ||
| 8191 | /* XSETINT (emacs_event->code, 0); */ | ||
| 8192 | emacs_event->arg = AREF (emacsframe->tab_bar_items, | ||
| 8193 | idx + TAB_BAR_ITEM_KEY); | ||
| 8194 | emacs_event->modifiers = EV_MODIFIERS (theEvent); | ||
| 8195 | EV_TRAILER (theEvent); | ||
| 8196 | return self; | ||
| 8197 | } | ||
| 8198 | |||
| 8199 | |||
| 8200 | - (instancetype)toggleTabbar: (id)sender | ||
| 8201 | { | ||
| 8202 | NSTRACE ("[EmacsView toggleTabbar:]"); | ||
| 8203 | |||
| 8204 | if (!emacs_event) | ||
| 8205 | return self; | ||
| 8206 | |||
| 8207 | emacs_event->kind = NS_NONKEY_EVENT; | ||
| 8208 | emacs_event->code = KEY_NS_TOGGLE_TABBAR; | ||
| 8209 | EV_TRAILER ((id)nil); | ||
| 8210 | return self; | ||
| 8211 | } | ||
| 8212 | |||
| 8213 | |||
| 8214 | - (EmacsToolbar *)toolbar | 8100 | - (EmacsToolbar *)toolbar |
| 8215 | { | 8101 | { |
| 8216 | return toolbar; | 8102 | return toolbar; |
diff --git a/src/xterm.c b/src/xterm.c index e98e590df71..428d970206e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -12085,7 +12085,6 @@ x_free_frame_resources (struct frame *f) | |||
| 12085 | XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); | 12085 | XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); |
| 12086 | 12086 | ||
| 12087 | free_frame_menubar (f); | 12087 | free_frame_menubar (f); |
| 12088 | free_frame_tab_bar (f); | ||
| 12089 | 12088 | ||
| 12090 | if (f->shell_position) | 12089 | if (f->shell_position) |
| 12091 | xfree (f->shell_position); | 12090 | xfree (f->shell_position); |