Mercurial > emacs
comparison src/w32fns.c @ 41380:aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
(w32_wnd_proc) <WM_MENUSELECT>: Show help echo directly.
(my_create_tip_window): New function.
(x_create_tip_frame, compute_tip_xy): Adapt for Windows.
(Fx_show_tip, Fx_hide_tip) [TEST_TOOLTIPS]: Adapt for Windows.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Thu, 22 Nov 2001 20:40:03 +0000 |
parents | 482c520b29ba |
children | 96beda35d0fa |
comparison
equal
deleted
inserted
replaced
41379:e9893118406c | 41380:aff1b15f295b |
---|---|
398 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) | 398 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) |
399 continue; | 399 continue; |
400 if (f->output_data.w32->hourglass_window == wdesc) | 400 if (f->output_data.w32->hourglass_window == wdesc) |
401 return f; | 401 return f; |
402 | 402 |
403 /* TODO: Check tooltips when supported. */ | |
404 if (FRAME_W32_WINDOW (f) == wdesc) | 403 if (FRAME_W32_WINDOW (f) == wdesc) |
405 return f; | 404 return f; |
406 } | 405 } |
407 return 0; | 406 return 0; |
408 } | 407 } |
658 { | 657 { |
659 char *name; | 658 char *name; |
660 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 659 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
661 }; | 660 }; |
662 | 661 |
662 BOOL my_show_window P_ ((struct frame *, HWND, int)); | |
663 void my_set_window_pos P_ ((HWND, HWND, int, int, int, int, UINT)); | |
663 static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); | 664 static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); |
664 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); | 665 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); |
665 static void x_change_window_heights P_ ((Lisp_Object, int)); | 666 static void x_change_window_heights P_ ((Lisp_Object, int)); |
666 /* TODO: Native Input Method support; see x_create_im. */ | 667 /* TODO: Native Input Method support; see x_create_im. */ |
667 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 668 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
4683 if (f) | 4684 if (f) |
4684 f->output_data.w32->menubar_active = 0; | 4685 f->output_data.w32->menubar_active = 0; |
4685 goto dflt; | 4686 goto dflt; |
4686 | 4687 |
4687 case WM_MENUSELECT: | 4688 case WM_MENUSELECT: |
4689 #if OLD_MENU_HELP | |
4688 wmsg.dwModifiers = w32_get_modifiers (); | 4690 wmsg.dwModifiers = w32_get_modifiers (); |
4689 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | 4691 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
4692 #else | |
4693 { | |
4694 /* Try to process these directly: the relevant parts of redisplay | |
4695 are supposed to be re-entrant now. This should allow tooltips | |
4696 to be shown for menus. */ | |
4697 HMENU menu = (HMENU) lParam; | |
4698 UINT menu_item = (UINT) LOWORD (wParam); | |
4699 UINT flags = (UINT) HIWORD (wParam); | |
4700 | |
4701 BLOCK_INPUT; | |
4702 w32_menu_display_help (menu, menu_item, flags); | |
4703 UNBLOCK_INPUT; | |
4704 } | |
4705 #endif | |
4690 return 0; | 4706 return 0; |
4691 | 4707 |
4692 case WM_MEASUREITEM: | 4708 case WM_MEASUREITEM: |
4693 f = x_window_to_frame (dpyinfo, hwnd); | 4709 f = x_window_to_frame (dpyinfo, hwnd); |
4694 if (f) | 4710 if (f) |
5034 | 5050 |
5035 if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0)) | 5051 if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0)) |
5036 abort (); | 5052 abort (); |
5037 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); | 5053 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
5038 } | 5054 } |
5055 | |
5056 | |
5057 /* Create a tooltip window. Unlike my_create_window, we do not do this | |
5058 indirectly via the Window thread, as we do not need to process Window | |
5059 messages for the tooltip. Creating tooltips indirectly also creates | |
5060 deadlocks when tooltips are created for menu items. */ | |
5061 void | |
5062 my_create_tip_window (f) | |
5063 struct frame *f; | |
5064 { | |
5065 HWND hwnd; | |
5066 | |
5067 FRAME_W32_WINDOW (f) = hwnd | |
5068 = CreateWindow (EMACS_CLASS, | |
5069 f->namebuf, | |
5070 f->output_data.w32->dwStyle, | |
5071 f->output_data.w32->left_pos, | |
5072 f->output_data.w32->top_pos, | |
5073 PIXEL_WIDTH (f), | |
5074 PIXEL_HEIGHT (f), | |
5075 FRAME_W32_WINDOW (SELECTED_FRAME ()), /* owner */ | |
5076 NULL, | |
5077 hinst, | |
5078 NULL); | |
5079 | |
5080 if (hwnd) | |
5081 { | |
5082 SetWindowLong (hwnd, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font)); | |
5083 SetWindowLong (hwnd, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height); | |
5084 SetWindowLong (hwnd, WND_BORDER_INDEX, f->output_data.w32->internal_border_width); | |
5085 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, FRAME_BACKGROUND_PIXEL (f)); | |
5086 | |
5087 /* Do this to discard the default setting specified by our parent. */ | |
5088 ShowWindow (hwnd, SW_HIDE); | |
5089 } | |
5090 } | |
5091 | |
5039 | 5092 |
5040 /* Create and set up the w32 window for frame F. */ | 5093 /* Create and set up the w32 window for frame F. */ |
5041 | 5094 |
5042 static void | 5095 static void |
5043 w32_window (f, window_prompting, minibuffer_only) | 5096 w32_window (f, window_prompting, minibuffer_only) |
13012 static Lisp_Object | 13065 static Lisp_Object |
13013 x_create_tip_frame (dpyinfo, parms, text) | 13066 x_create_tip_frame (dpyinfo, parms, text) |
13014 struct w32_display_info *dpyinfo; | 13067 struct w32_display_info *dpyinfo; |
13015 Lisp_Object parms, text; | 13068 Lisp_Object parms, text; |
13016 { | 13069 { |
13017 #if 0 /* TODO : w32 version */ | |
13018 struct frame *f; | 13070 struct frame *f; |
13019 Lisp_Object frame, tem; | 13071 Lisp_Object frame, tem; |
13020 Lisp_Object name; | 13072 Lisp_Object name; |
13021 long window_prompting = 0; | 13073 long window_prompting = 0; |
13022 int width, height; | 13074 int width, height; |
13025 struct kboard *kb; | 13077 struct kboard *kb; |
13026 int face_change_count_before = face_change_count; | 13078 int face_change_count_before = face_change_count; |
13027 Lisp_Object buffer; | 13079 Lisp_Object buffer; |
13028 struct buffer *old_buffer; | 13080 struct buffer *old_buffer; |
13029 | 13081 |
13030 check_x (); | 13082 check_w32 (); |
13031 | 13083 |
13032 /* Use this general default value to start with until we know if | 13084 /* Use this general default value to start with until we know if |
13033 this frame has a specified name. */ | 13085 this frame has a specified name. */ |
13034 Vx_resource_name = Vinvocation_name; | 13086 Vx_resource_name = Vinvocation_name; |
13035 | 13087 |
13070 counts etc. */ | 13122 counts etc. */ |
13071 f->output_method = output_w32; | 13123 f->output_method = output_w32; |
13072 f->output_data.w32 = | 13124 f->output_data.w32 = |
13073 (struct w32_output *) xmalloc (sizeof (struct w32_output)); | 13125 (struct w32_output *) xmalloc (sizeof (struct w32_output)); |
13074 bzero (f->output_data.w32, sizeof (struct w32_output)); | 13126 bzero (f->output_data.w32, sizeof (struct w32_output)); |
13075 #if 0 | 13127 |
13076 f->output_data.w32->icon_bitmap = -1; | 13128 FRAME_FONTSET (f) = -1; |
13077 #endif | |
13078 f->output_data.w32->fontset = -1; | |
13079 f->icon_name = Qnil; | 13129 f->icon_name = Qnil; |
13080 | 13130 |
13081 #ifdef GLYPH_DEBUG | 13131 #if 0 /* GLYPH_DEBUG TODO: image support. */ |
13082 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; | 13132 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; |
13083 dpyinfo_refcount = dpyinfo->reference_count; | 13133 dpyinfo_refcount = dpyinfo->reference_count; |
13084 #endif /* GLYPH_DEBUG */ | 13134 #endif /* GLYPH_DEBUG */ |
13085 #ifdef MULTI_KBOARD | 13135 #ifdef MULTI_KBOARD |
13086 FRAME_KBOARD (f) = kb; | 13136 FRAME_KBOARD (f) = kb; |
13090 | 13140 |
13091 /* Set the name; the functions to which we pass f expect the name to | 13141 /* Set the name; the functions to which we pass f expect the name to |
13092 be set. */ | 13142 be set. */ |
13093 if (EQ (name, Qunbound) || NILP (name)) | 13143 if (EQ (name, Qunbound) || NILP (name)) |
13094 { | 13144 { |
13095 f->name = build_string (dpyinfo->x_id_name); | 13145 f->name = build_string (dpyinfo->w32_id_name); |
13096 f->explicit_name = 0; | 13146 f->explicit_name = 0; |
13097 } | 13147 } |
13098 else | 13148 else |
13099 { | 13149 { |
13100 f->name = name; | 13150 f->name = name; |
13121 font = x_new_font (f, XSTRING (font)->data); | 13171 font = x_new_font (f, XSTRING (font)->data); |
13122 } | 13172 } |
13123 | 13173 |
13124 /* Try out a font which we hope has bold and italic variations. */ | 13174 /* Try out a font which we hope has bold and italic variations. */ |
13125 if (!STRINGP (font)) | 13175 if (!STRINGP (font)) |
13126 font = x_new_font (f, "-*-courier new-normal-r-*-*-*-100-*-*-*-*-iso8859-1"); | 13176 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); |
13127 if (!STRINGP (font)) | |
13128 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); | |
13129 if (! STRINGP (font)) | 13177 if (! STRINGP (font)) |
13130 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); | 13178 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); |
13131 if (! STRINGP (font)) | |
13132 /* This was formerly the first thing tried, but it finds too many fonts | |
13133 and takes too long. */ | |
13134 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1"); | |
13135 /* If those didn't work, look for something which will at least work. */ | 13179 /* If those didn't work, look for something which will at least work. */ |
13136 if (! STRINGP (font)) | 13180 if (! STRINGP (font)) |
13137 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1"); | 13181 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1"); |
13138 UNBLOCK_INPUT; | 13182 UNBLOCK_INPUT; |
13139 if (! STRINGP (font)) | 13183 if (! STRINGP (font)) |
13140 font = build_string ("fixed"); | 13184 font = build_string ("Fixedsys"); |
13141 | 13185 |
13142 x_default_parameter (f, parms, Qfont, font, | 13186 x_default_parameter (f, parms, Qfont, font, |
13143 "font", "Font", RES_TYPE_STRING); | 13187 "font", "Font", RES_TYPE_STRING); |
13144 } | 13188 } |
13145 | 13189 |
13146 x_default_parameter (f, parms, Qborder_width, make_number (2), | 13190 x_default_parameter (f, parms, Qborder_width, make_number (2), |
13147 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); | 13191 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
13148 | |
13149 /* This defaults to 2 in order to match xterm. We recognize either | 13192 /* This defaults to 2 in order to match xterm. We recognize either |
13150 internalBorderWidth or internalBorder (which is what xterm calls | 13193 internalBorderWidth or internalBorder (which is what xterm calls |
13151 it). */ | 13194 it). */ |
13152 if (NILP (Fassq (Qinternal_border_width, parms))) | 13195 if (NILP (Fassq (Qinternal_border_width, parms))) |
13153 { | 13196 { |
13157 "internalBorder", "internalBorder", RES_TYPE_NUMBER); | 13200 "internalBorder", "internalBorder", RES_TYPE_NUMBER); |
13158 if (! EQ (value, Qunbound)) | 13201 if (! EQ (value, Qunbound)) |
13159 parms = Fcons (Fcons (Qinternal_border_width, value), | 13202 parms = Fcons (Fcons (Qinternal_border_width, value), |
13160 parms); | 13203 parms); |
13161 } | 13204 } |
13162 | 13205 /* Default internalBorderWidth for tooltips to 2 on Windows to match |
13163 x_default_parameter (f, parms, Qinternal_border_width, make_number (1), | 13206 other programs. */ |
13207 x_default_parameter (f, parms, Qinternal_border_width, make_number (2), | |
13164 "internalBorderWidth", "internalBorderWidth", | 13208 "internalBorderWidth", "internalBorderWidth", |
13165 RES_TYPE_NUMBER); | 13209 RES_TYPE_NUMBER); |
13166 | 13210 |
13167 /* Also do the stuff which must be set before the window exists. */ | 13211 /* Also do the stuff which must be set before the window exists. */ |
13168 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), | 13212 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), |
13181 which calls change_frame_size, which calls Fset_window_buffer, | 13225 which calls change_frame_size, which calls Fset_window_buffer, |
13182 which runs hooks, which call Fvertical_motion. At the end, we | 13226 which runs hooks, which call Fvertical_motion. At the end, we |
13183 end up in init_iterator with a null face cache, which should not | 13227 end up in init_iterator with a null face cache, which should not |
13184 happen. */ | 13228 happen. */ |
13185 init_frame_faces (f); | 13229 init_frame_faces (f); |
13186 | 13230 |
13231 f->output_data.w32->dwStyle = WS_BORDER | WS_POPUP | WS_DISABLED; | |
13187 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; | 13232 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
13188 window_prompting = x_figure_window_size (f, parms); | 13233 window_prompting = x_figure_window_size (f, parms); |
13189 | 13234 |
13190 if (window_prompting & XNegative) | 13235 if (window_prompting & XNegative) |
13191 { | 13236 { |
13201 else | 13246 else |
13202 f->output_data.w32->win_gravity = NorthWestGravity; | 13247 f->output_data.w32->win_gravity = NorthWestGravity; |
13203 } | 13248 } |
13204 | 13249 |
13205 f->output_data.w32->size_hint_flags = window_prompting; | 13250 f->output_data.w32->size_hint_flags = window_prompting; |
13206 { | 13251 |
13207 XSetWindowAttributes attrs; | 13252 BLOCK_INPUT; |
13208 unsigned long mask; | 13253 my_create_tip_window (f); |
13209 | 13254 UNBLOCK_INPUT; |
13210 BLOCK_INPUT; | |
13211 mask = CWBackPixel | CWOverrideRedirect | CWEventMask; | |
13212 if (DoesSaveUnders (dpyinfo->screen)) | |
13213 mask |= CWSaveUnder; | |
13214 | |
13215 /* Window managers looks at the override-redirect flag to | |
13216 determine whether or net to give windows a decoration (Xlib | |
13217 3.2.8). */ | |
13218 attrs.override_redirect = True; | |
13219 attrs.save_under = True; | |
13220 attrs.background_pixel = FRAME_BACKGROUND_PIXEL (f); | |
13221 /* Arrange for getting MapNotify and UnmapNotify events. */ | |
13222 attrs.event_mask = StructureNotifyMask; | |
13223 tip_window | |
13224 = FRAME_W32_WINDOW (f) | |
13225 = XCreateWindow (FRAME_W32_DISPLAY (f), | |
13226 FRAME_W32_DISPLAY_INFO (f)->root_window, | |
13227 /* x, y, width, height */ | |
13228 0, 0, 1, 1, | |
13229 /* Border. */ | |
13230 1, | |
13231 CopyFromParent, InputOutput, CopyFromParent, | |
13232 mask, &attrs); | |
13233 UNBLOCK_INPUT; | |
13234 } | |
13235 | 13255 |
13236 x_make_gc (f); | 13256 x_make_gc (f); |
13237 | 13257 |
13238 x_default_parameter (f, parms, Qauto_raise, Qnil, | 13258 x_default_parameter (f, parms, Qauto_raise, Qnil, |
13239 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); | 13259 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
13291 had before we created the tip frame. */ | 13311 had before we created the tip frame. */ |
13292 face_change_count = face_change_count_before; | 13312 face_change_count = face_change_count_before; |
13293 | 13313 |
13294 /* Discard the unwind_protect. */ | 13314 /* Discard the unwind_protect. */ |
13295 return unbind_to (count, frame); | 13315 return unbind_to (count, frame); |
13296 #endif /* TODO */ | |
13297 return Qnil; | |
13298 } | 13316 } |
13299 | 13317 |
13300 | 13318 |
13301 /* Compute where to display tip frame F. PARMS is the list of frame | 13319 /* Compute where to display tip frame F. PARMS is the list of frame |
13302 parameters for F. DX and DY are specified offsets from the current | 13320 parameters for F. DX and DY are specified offsets from the current |
13309 struct frame *f; | 13327 struct frame *f; |
13310 Lisp_Object parms, dx, dy; | 13328 Lisp_Object parms, dx, dy; |
13311 int width, height; | 13329 int width, height; |
13312 int *root_x, *root_y; | 13330 int *root_x, *root_y; |
13313 { | 13331 { |
13314 #ifdef TODO /* Tool tips not supported. */ | |
13315 Lisp_Object left, top; | 13332 Lisp_Object left, top; |
13316 int win_x, win_y; | |
13317 Window root, child; | |
13318 unsigned pmask; | 13333 unsigned pmask; |
13319 | 13334 |
13320 /* User-specified position? */ | 13335 /* User-specified position? */ |
13321 left = Fcdr (Fassq (Qleft, parms)); | 13336 left = Fcdr (Fassq (Qleft, parms)); |
13322 top = Fcdr (Fassq (Qtop, parms)); | 13337 top = Fcdr (Fassq (Qtop, parms)); |
13323 | 13338 |
13324 /* Move the tooltip window where the mouse pointer is. Resize and | 13339 /* Move the tooltip window where the mouse pointer is. Resize and |
13325 show it. */ | 13340 show it. */ |
13326 if (!INTEGERP (left) && !INTEGERP (top)) | 13341 if (!INTEGERP (left) || !INTEGERP (top)) |
13327 { | 13342 { |
13343 POINT pt; | |
13344 | |
13328 BLOCK_INPUT; | 13345 BLOCK_INPUT; |
13329 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, | 13346 GetCursorPos (&pt); |
13330 &root, &child, root_x, root_y, &win_x, &win_y, &pmask); | 13347 *root_x = pt.x; |
13348 *root_y = pt.y; | |
13331 UNBLOCK_INPUT; | 13349 UNBLOCK_INPUT; |
13332 } | 13350 } |
13333 | 13351 |
13334 if (INTEGERP (top)) | 13352 if (INTEGERP (top)) |
13335 *root_y = XINT (top); | 13353 *root_y = XINT (top); |
13341 *root_y += XINT (dy); | 13359 *root_y += XINT (dy); |
13342 } | 13360 } |
13343 | 13361 |
13344 if (INTEGERP (left)) | 13362 if (INTEGERP (left)) |
13345 *root_x = XINT (left); | 13363 *root_x = XINT (left); |
13346 else if (*root_x + XINT (dx) + width > FRAME_X_DISPLAY_INFO (f)->width) | 13364 else if (*root_x + XINT (dx) + width > FRAME_WIDTH (f)) |
13347 *root_x -= width + XINT (dx); | 13365 *root_x -= width + XINT (dx); |
13348 else | 13366 else |
13349 *root_x += XINT (dx); | 13367 *root_x += XINT (dx); |
13350 | 13368 } |
13351 #endif /* Tooltip support. */ | 13369 |
13352 } | 13370 |
13353 | 13371 #ifdef TEST_TOOLTIPS /* Tooltip support in progress. */ |
13354 | |
13355 #ifdef TODO /* Tooltip support not complete. */ | |
13356 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | 13372 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, |
13357 doc: /* Show STRING in a \"tooltip\" window on frame FRAME. | 13373 doc: /* Show STRING in a \"tooltip\" window on frame FRAME. |
13358 A tooltip window is a small window displaying a string. | 13374 A tooltip window is a small window displaying a string. |
13359 | 13375 |
13360 FRAME nil or omitted means use the selected frame. | 13376 FRAME nil or omitted means use the selected frame. |
13361 | 13377 |
13362 PARMS is an optional list of frame parameters which can be | 13378 PARMS is an optional list of frame parameters which can be |
13363 used to change the tooltip's appearance. | 13379 used to change the tooltip's appearance. |
13364 | 13380 |
13365 Automatically hide the tooltip after TIMEOUT seconds. | 13381 Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil |
13366 TIMEOUT nil means use the default timeout of 5 seconds. | 13382 means use the default timeout of 5 seconds. |
13367 | 13383 |
13368 If the list of frame parameters PARAMS contains a `left' parameters, | 13384 If the list of frame parameters PARAMS contains a `left' parameter, |
13369 the tooltip is displayed at that x-position. Otherwise it is | 13385 the tooltip is displayed at that x-position. Otherwise it is |
13370 displayed at the mouse position, with offset DX added (default is 5 if | 13386 displayed at the mouse position, with offset DX added (default is 5 if |
13371 DX isn't specified). Likewise for the y-position; if a `top' frame | 13387 DX isn't specified). Likewise for the y-position; if a `top' frame |
13372 parameter is specified, it determines the y-position of the tooltip | 13388 parameter is specified, it determines the y-position of the tooltip |
13373 window, otherwise it is displayed at the mouse position, with offset | 13389 window, otherwise it is displayed at the mouse position, with offset |
13384 struct buffer *old_buffer; | 13400 struct buffer *old_buffer; |
13385 struct text_pos pos; | 13401 struct text_pos pos; |
13386 int i, width, height; | 13402 int i, width, height; |
13387 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 13403 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
13388 int old_windows_or_buffers_changed = windows_or_buffers_changed; | 13404 int old_windows_or_buffers_changed = windows_or_buffers_changed; |
13389 int count = specpdl_ptr - specpdl; | 13405 int count = BINDING_STACK_SIZE (); |
13390 | 13406 |
13391 specbind (Qinhibit_redisplay, Qt); | 13407 specbind (Qinhibit_redisplay, Qt); |
13392 | 13408 |
13393 GCPRO4 (string, parms, frame, timeout); | 13409 GCPRO4 (string, parms, frame, timeout); |
13394 | 13410 |
13431 tip_timer = Qnil; | 13447 tip_timer = Qnil; |
13432 call1 (Qcancel_timer, timer); | 13448 call1 (Qcancel_timer, timer); |
13433 } | 13449 } |
13434 | 13450 |
13435 BLOCK_INPUT; | 13451 BLOCK_INPUT; |
13436 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y); | 13452 compute_tip_xy (f, parms, dx, dy, PIXEL_WIDTH (f), |
13437 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 13453 PIXEL_HEIGHT (f), &root_x, &root_y); |
13438 root_x, root_y - PIXEL_HEIGHT (f)); | 13454 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, |
13455 root_x, root_y, 0, 0, | |
13456 SWP_NOSIZE | SWP_NOACTIVATE); | |
13439 UNBLOCK_INPUT; | 13457 UNBLOCK_INPUT; |
13440 goto start_timer; | 13458 goto start_timer; |
13441 } | 13459 } |
13442 } | 13460 } |
13443 | 13461 |
13461 parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), | 13479 parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), |
13462 parms); | 13480 parms); |
13463 | 13481 |
13464 /* Create a frame for the tooltip, and record it in the global | 13482 /* Create a frame for the tooltip, and record it in the global |
13465 variable tip_frame. */ | 13483 variable tip_frame. */ |
13466 frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms); | 13484 frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms, string); |
13467 f = XFRAME (frame); | 13485 f = XFRAME (frame); |
13468 | 13486 |
13469 /* Set up the frame's root window. */ | 13487 /* Set up the frame's root window. */ |
13470 w = XWINDOW (FRAME_ROOT_WINDOW (f)); | 13488 w = XWINDOW (FRAME_ROOT_WINDOW (f)); |
13471 w->left = w->top = make_number (0); | 13489 w->left = w->top = make_number (0); |
13521 row_width = row->pixel_width - last->pixel_width; | 13539 row_width = row->pixel_width - last->pixel_width; |
13522 } | 13540 } |
13523 else | 13541 else |
13524 row_width = row->pixel_width; | 13542 row_width = row->pixel_width; |
13525 | 13543 |
13526 height += row->height; | 13544 /* TODO: find why tips do not draw along baseline as instructed. */ |
13545 height += row->height * 2; | |
13527 width = max (width, row_width); | 13546 width = max (width, row_width); |
13528 } | 13547 } |
13529 | 13548 |
13530 /* Add the frame's internal border to the width and height the X | 13549 /* Add the frame's internal border to the width and height the X |
13531 window should have. */ | 13550 window should have. */ |
13535 /* Move the tooltip window where the mouse pointer is. Resize and | 13554 /* Move the tooltip window where the mouse pointer is. Resize and |
13536 show it. */ | 13555 show it. */ |
13537 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); | 13556 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
13538 | 13557 |
13539 BLOCK_INPUT; | 13558 BLOCK_INPUT; |
13540 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 13559 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, |
13541 root_x, root_y - height, width, height); | 13560 root_x, root_y - height, width, height, |
13542 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); | 13561 SWP_NOACTIVATE); |
13562 my_show_window (f, FRAME_W32_WINDOW (f), SW_SHOWNORMAL); | |
13543 UNBLOCK_INPUT; | 13563 UNBLOCK_INPUT; |
13544 | 13564 |
13545 /* Draw into the window. */ | 13565 /* Draw into the window. */ |
13546 w->must_be_updated_p = 1; | 13566 w->must_be_updated_p = 1; |
13547 update_single_window (w, 1); | 13567 update_single_window (w, 1); |
14704 #endif | 14724 #endif |
14705 #endif /* TODO */ | 14725 #endif /* TODO */ |
14706 | 14726 |
14707 hourglass_atimer = NULL; | 14727 hourglass_atimer = NULL; |
14708 hourglass_shown_p = 0; | 14728 hourglass_shown_p = 0; |
14709 #ifdef TODO /* Tooltip support not complete. */ | 14729 #if TEST_TOOLTIPS /* Tooltip support in progress. */ |
14710 defsubr (&Sx_show_tip); | 14730 defsubr (&Sx_show_tip); |
14711 defsubr (&Sx_hide_tip); | 14731 defsubr (&Sx_hide_tip); |
14712 #endif | 14732 #endif |
14713 tip_timer = Qnil; | 14733 tip_timer = Qnil; |
14714 staticpro (&tip_timer); | 14734 staticpro (&tip_timer); |
14715 tip_frame = Qnil; | 14735 tip_frame = Qnil; |
14716 staticpro (&tip_frame); | 14736 staticpro (&tip_frame); |
14737 | |
14738 last_show_tip_args = Qnil; | |
14739 staticpro (&last_show_tip_args); | |
14717 | 14740 |
14718 defsubr (&Sx_file_dialog); | 14741 defsubr (&Sx_file_dialog); |
14719 } | 14742 } |
14720 | 14743 |
14721 | 14744 |