comparison src/macfns.c @ 80388:2ae7357bc8f4

* macfns.c (mac_window): Replace WindowPtr with WindowRef. (mac_get_window_bounds): Move extern to macterm.h. (compute_tip_xy) [TARGET_API_MAC_CARBON]: Use GetGlobalMouse. (mac_window) [USE_MAC_TOOLBAR]: Set toolbar_win_gravity. (x_set_tool_bar_lines) [USE_MAC_TOOLBAR]: Set FRAME_EXTERNAL_TOOL_BAR.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sat, 29 Mar 2008 00:45:58 +0000
parents fc2bcd2a8aad
children 458a994205d2
comparison
equal deleted inserted replaced
80387:3fdc60eb4014 80388:2ae7357bc8f4
216 void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); 216 void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
217 void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); 217 void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
218 void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); 218 void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
219 void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object)); 219 void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
220 void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); 220 void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
221
222 extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *));
223
224 221
225 222
226 /* Store the screen positions of frame F into XPTR and YPTR. 223 /* Store the screen positions of frame F into XPTR and YPTR.
227 These are the positions of the containing window manager window, 224 These are the positions of the containing window manager window,
228 not Emacs's own window. */ 225 not Emacs's own window. */
1683 nlines = 0; 1680 nlines = 0;
1684 1681
1685 /* Make sure we redisplay all windows in this frame. */ 1682 /* Make sure we redisplay all windows in this frame. */
1686 ++windows_or_buffers_changed; 1683 ++windows_or_buffers_changed;
1687 1684
1685 #if USE_MAC_TOOLBAR
1686 FRAME_TOOL_BAR_LINES (f) = 0;
1687 if (nlines)
1688 {
1689 FRAME_EXTERNAL_TOOL_BAR (f) = 1;
1690 if (FRAME_MAC_P (f) && !IsWindowToolbarVisible (FRAME_MAC_WINDOW (f)))
1691 /* Make sure next redisplay shows the tool bar. */
1692 XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt;
1693 }
1694 else
1695 {
1696 if (FRAME_EXTERNAL_TOOL_BAR (f))
1697 free_frame_tool_bar (f);
1698 FRAME_EXTERNAL_TOOL_BAR (f) = 0;
1699 }
1700
1701 return;
1702 #endif
1703
1688 delta = nlines - FRAME_TOOL_BAR_LINES (f); 1704 delta = nlines - FRAME_TOOL_BAR_LINES (f);
1689 1705
1690 /* Don't resize the tool-bar to more than we have room for. */ 1706 /* Don't resize the tool-bar to more than we have room for. */
1691 root_window = FRAME_ROOT_WINDOW (f); 1707 root_window = FRAME_ROOT_WINDOW (f);
1692 root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window)); 1708 root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window));
2253 { 2269 {
2254 DisposeWindow (FRAME_MAC_WINDOW (f)); 2270 DisposeWindow (FRAME_MAC_WINDOW (f));
2255 FRAME_MAC_WINDOW (f) = NULL; 2271 FRAME_MAC_WINDOW (f) = NULL;
2256 } 2272 }
2257 } 2273 }
2258 #else 2274 #else /* !TARGET_API_MAC_CARBON */
2259 FRAME_MAC_WINDOW (f) 2275 FRAME_MAC_WINDOW (f)
2260 = NewCWindow (NULL, &r, "\p", false, zoomDocProc, 2276 = NewCWindow (NULL, &r, "\p", false, zoomDocProc,
2261 (WindowPtr) -1, 1, (long) f->output_data.mac); 2277 (WindowRef) -1, 1, (long) f->output_data.mac);
2262 #endif 2278 #endif /* !TARGET_API_MAC_CARBON */
2263 /* so that update events can find this mac_output struct */ 2279 /* so that update events can find this mac_output struct */
2264 f->output_data.mac->mFP = f; /* point back to emacs frame */ 2280 f->output_data.mac->mFP = f; /* point back to emacs frame */
2265 2281
2266 #ifndef MAC_OSX 2282 #ifndef MAC_OSX
2267 if (FRAME_MAC_WINDOW (f)) 2283 if (FRAME_MAC_WINDOW (f))
2276 } 2292 }
2277 #endif 2293 #endif
2278 if (FRAME_MAC_WINDOW (f)) 2294 if (FRAME_MAC_WINDOW (f))
2279 XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), 2295 XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f),
2280 FRAME_BACKGROUND_PIXEL (f)); 2296 FRAME_BACKGROUND_PIXEL (f));
2297
2298 #if USE_MAC_TOOLBAR
2299 /* At the moment, the size of the tool bar is not yet known. We
2300 record the gravity value of the newly created window and use it
2301 to adjust the position of the window (especially for a negative
2302 specification of its vertical position) when the tool bar is
2303 first redisplayed. */
2304 if (FRAME_EXTERNAL_TOOL_BAR (f))
2305 f->output_data.mac->toolbar_win_gravity = f->win_gravity;
2306 #endif
2281 2307
2282 validate_x_resource_name (); 2308 validate_x_resource_name ();
2283 2309
2284 /* x_set_name normally ignores requests to set the name if the 2310 /* x_set_name normally ignores requests to set the name if the
2285 requested name is the same as the current name. This is the one 2311 requested name is the same as the current name. This is the one
3110 size = CGDisplayScreenSize (kCGDirectMainDisplay); 3136 size = CGDisplayScreenSize (kCGDirectMainDisplay);
3111 mm_per_pixel = size.height / CGDisplayPixelsHigh (kCGDirectMainDisplay); 3137 mm_per_pixel = size.height / CGDisplayPixelsHigh (kCGDirectMainDisplay);
3112 UNBLOCK_INPUT; 3138 UNBLOCK_INPUT;
3113 } 3139 }
3114 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3140 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3115 else 3141 else /* CGDisplayScreenSize == NULL */
3116 #endif 3142 #endif
3117 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ 3143 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
3118 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3144 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3119 { 3145 {
3120 /* This is an approximation. */ 3146 /* This is an approximation. */
3147 size = CGDisplayScreenSize (kCGDirectMainDisplay); 3173 size = CGDisplayScreenSize (kCGDirectMainDisplay);
3148 mm_per_pixel = size.width / CGDisplayPixelsWide (kCGDirectMainDisplay); 3174 mm_per_pixel = size.width / CGDisplayPixelsWide (kCGDirectMainDisplay);
3149 UNBLOCK_INPUT; 3175 UNBLOCK_INPUT;
3150 } 3176 }
3151 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3177 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3152 else 3178 else /* CGDisplayScreenSize == NULL */
3153 #endif 3179 #endif
3154 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ 3180 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
3155 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3181 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3156 { 3182 {
3157 /* This is an approximation. */ 3183 /* This is an approximation. */
4066 if (!INTEGERP (left) || !INTEGERP (top)) 4092 if (!INTEGERP (left) || !INTEGERP (top))
4067 { 4093 {
4068 Point mouse_pos; 4094 Point mouse_pos;
4069 4095
4070 BLOCK_INPUT; 4096 BLOCK_INPUT;
4097 #if TARGET_API_MAC_CARBON
4098 GetGlobalMouse (&mouse_pos);
4099 #else
4071 GetMouse (&mouse_pos); 4100 GetMouse (&mouse_pos);
4072 LocalToGlobal (&mouse_pos); 4101 LocalToGlobal (&mouse_pos);
4102 #endif
4073 *root_x = mouse_pos.h; 4103 *root_x = mouse_pos.h;
4074 *root_y = mouse_pos.v; 4104 *root_y = mouse_pos.v;
4075 UNBLOCK_INPUT; 4105 UNBLOCK_INPUT;
4076 } 4106 }
4077 4107