400 |
if (f->output_data.w32->hourglass_window == wdesc) |
if (f->output_data.w32->hourglass_window == wdesc) |
401 |
return f; |
return f; |
402 |
|
|
|
/* TODO: Check tooltips when supported. */ |
|
403 |
if (FRAME_W32_WINDOW (f) == wdesc) |
if (FRAME_W32_WINDOW (f) == wdesc) |
404 |
return f; |
return f; |
405 |
} |
} |
659 |
void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
660 |
}; |
}; |
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)); |
664 |
static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); |
static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); |
665 |
static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); |
static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); |
666 |
static void x_change_window_heights P_ ((Lisp_Object, int)); |
static void x_change_window_heights P_ ((Lisp_Object, int)); |
4686 |
goto dflt; |
goto dflt; |
4687 |
|
|
4688 |
case WM_MENUSELECT: |
case WM_MENUSELECT: |
4689 |
|
#if OLD_MENU_HELP |
4690 |
wmsg.dwModifiers = w32_get_modifiers (); |
wmsg.dwModifiers = w32_get_modifiers (); |
4691 |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
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 |
4706 |
return 0; |
return 0; |
4707 |
|
|
4708 |
case WM_MEASUREITEM: |
case WM_MEASUREITEM: |
5053 |
GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
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 |
|
|
5092 |
|
|
5093 |
/* Create and set up the w32 window for frame F. */ |
/* Create and set up the w32 window for frame F. */ |
5094 |
|
|
5095 |
static void |
static void |
13067 |
struct w32_display_info *dpyinfo; |
struct w32_display_info *dpyinfo; |
13068 |
Lisp_Object parms, text; |
Lisp_Object parms, text; |
13069 |
{ |
{ |
|
#if 0 /* TODO : w32 version */ |
|
13070 |
struct frame *f; |
struct frame *f; |
13071 |
Lisp_Object frame, tem; |
Lisp_Object frame, tem; |
13072 |
Lisp_Object name; |
Lisp_Object name; |
13079 |
Lisp_Object buffer; |
Lisp_Object buffer; |
13080 |
struct buffer *old_buffer; |
struct buffer *old_buffer; |
13081 |
|
|
13082 |
check_x (); |
check_w32 (); |
13083 |
|
|
13084 |
/* Use this general default value to start with until we know if |
/* Use this general default value to start with until we know if |
13085 |
this frame has a specified name. */ |
this frame has a specified name. */ |
13124 |
f->output_data.w32 = |
f->output_data.w32 = |
13125 |
(struct w32_output *) xmalloc (sizeof (struct w32_output)); |
(struct w32_output *) xmalloc (sizeof (struct w32_output)); |
13126 |
bzero (f->output_data.w32, sizeof (struct w32_output)); |
bzero (f->output_data.w32, sizeof (struct w32_output)); |
13127 |
#if 0 |
|
13128 |
f->output_data.w32->icon_bitmap = -1; |
FRAME_FONTSET (f) = -1; |
|
#endif |
|
|
f->output_data.w32->fontset = -1; |
|
13129 |
f->icon_name = Qnil; |
f->icon_name = Qnil; |
13130 |
|
|
13131 |
#ifdef GLYPH_DEBUG |
#if 0 /* GLYPH_DEBUG TODO: image support. */ |
13132 |
image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; |
image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; |
13133 |
dpyinfo_refcount = dpyinfo->reference_count; |
dpyinfo_refcount = dpyinfo->reference_count; |
13134 |
#endif /* GLYPH_DEBUG */ |
#endif /* GLYPH_DEBUG */ |
13142 |
be set. */ |
be set. */ |
13143 |
if (EQ (name, Qunbound) || NILP (name)) |
if (EQ (name, Qunbound) || NILP (name)) |
13144 |
{ |
{ |
13145 |
f->name = build_string (dpyinfo->x_id_name); |
f->name = build_string (dpyinfo->w32_id_name); |
13146 |
f->explicit_name = 0; |
f->explicit_name = 0; |
13147 |
} |
} |
13148 |
else |
else |
13173 |
|
|
13174 |
/* Try out a font which we hope has bold and italic variations. */ |
/* Try out a font which we hope has bold and italic variations. */ |
13175 |
if (!STRINGP (font)) |
if (!STRINGP (font)) |
13176 |
font = x_new_font (f, "-*-courier new-normal-r-*-*-*-100-*-*-*-*-iso8859-1"); |
font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); |
|
if (!STRINGP (font)) |
|
|
font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); |
|
|
if (! STRINGP (font)) |
|
|
font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); |
|
13177 |
if (! STRINGP (font)) |
if (! STRINGP (font)) |
13178 |
/* This was formerly the first thing tried, but it finds too many fonts |
font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); |
|
and takes too long. */ |
|
|
font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1"); |
|
13179 |
/* If those didn't work, look for something which will at least work. */ |
/* If those didn't work, look for something which will at least work. */ |
13180 |
if (! STRINGP (font)) |
if (! STRINGP (font)) |
13181 |
font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1"); |
font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1"); |
13182 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
13183 |
if (! STRINGP (font)) |
if (! STRINGP (font)) |
13184 |
font = build_string ("fixed"); |
font = build_string ("Fixedsys"); |
13185 |
|
|
13186 |
x_default_parameter (f, parms, Qfont, font, |
x_default_parameter (f, parms, Qfont, font, |
13187 |
"font", "Font", RES_TYPE_STRING); |
"font", "Font", RES_TYPE_STRING); |
13189 |
|
|
13190 |
x_default_parameter (f, parms, Qborder_width, make_number (2), |
x_default_parameter (f, parms, Qborder_width, make_number (2), |
13191 |
"borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
"borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
|
|
|
13192 |
/* This defaults to 2 in order to match xterm. We recognize either |
/* This defaults to 2 in order to match xterm. We recognize either |
13193 |
internalBorderWidth or internalBorder (which is what xterm calls |
internalBorderWidth or internalBorder (which is what xterm calls |
13194 |
it). */ |
it). */ |
13202 |
parms = Fcons (Fcons (Qinternal_border_width, value), |
parms = Fcons (Fcons (Qinternal_border_width, value), |
13203 |
parms); |
parms); |
13204 |
} |
} |
13205 |
|
/* Default internalBorderWidth for tooltips to 2 on Windows to match |
13206 |
x_default_parameter (f, parms, Qinternal_border_width, make_number (1), |
other programs. */ |
13207 |
|
x_default_parameter (f, parms, Qinternal_border_width, make_number (2), |
13208 |
"internalBorderWidth", "internalBorderWidth", |
"internalBorderWidth", "internalBorderWidth", |
13209 |
RES_TYPE_NUMBER); |
RES_TYPE_NUMBER); |
13210 |
|
|
13227 |
end up in init_iterator with a null face cache, which should not |
end up in init_iterator with a null face cache, which should not |
13228 |
happen. */ |
happen. */ |
13229 |
init_frame_faces (f); |
init_frame_faces (f); |
13230 |
|
|
13231 |
|
f->output_data.w32->dwStyle = WS_BORDER | WS_POPUP | WS_DISABLED; |
13232 |
f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
13233 |
window_prompting = x_figure_window_size (f, parms); |
window_prompting = x_figure_window_size (f, parms); |
13234 |
|
|
13248 |
} |
} |
13249 |
|
|
13250 |
f->output_data.w32->size_hint_flags = window_prompting; |
f->output_data.w32->size_hint_flags = window_prompting; |
13251 |
{ |
|
13252 |
XSetWindowAttributes attrs; |
BLOCK_INPUT; |
13253 |
unsigned long mask; |
my_create_tip_window (f); |
13254 |
|
UNBLOCK_INPUT; |
|
BLOCK_INPUT; |
|
|
mask = CWBackPixel | CWOverrideRedirect | CWEventMask; |
|
|
if (DoesSaveUnders (dpyinfo->screen)) |
|
|
mask |= CWSaveUnder; |
|
|
|
|
|
/* Window managers looks at the override-redirect flag to |
|
|
determine whether or net to give windows a decoration (Xlib |
|
|
3.2.8). */ |
|
|
attrs.override_redirect = True; |
|
|
attrs.save_under = True; |
|
|
attrs.background_pixel = FRAME_BACKGROUND_PIXEL (f); |
|
|
/* Arrange for getting MapNotify and UnmapNotify events. */ |
|
|
attrs.event_mask = StructureNotifyMask; |
|
|
tip_window |
|
|
= FRAME_W32_WINDOW (f) |
|
|
= XCreateWindow (FRAME_W32_DISPLAY (f), |
|
|
FRAME_W32_DISPLAY_INFO (f)->root_window, |
|
|
/* x, y, width, height */ |
|
|
0, 0, 1, 1, |
|
|
/* Border. */ |
|
|
1, |
|
|
CopyFromParent, InputOutput, CopyFromParent, |
|
|
mask, &attrs); |
|
|
UNBLOCK_INPUT; |
|
|
} |
|
13255 |
|
|
13256 |
x_make_gc (f); |
x_make_gc (f); |
13257 |
|
|
13313 |
|
|
13314 |
/* Discard the unwind_protect. */ |
/* Discard the unwind_protect. */ |
13315 |
return unbind_to (count, frame); |
return unbind_to (count, frame); |
|
#endif /* TODO */ |
|
|
return Qnil; |
|
13316 |
} |
} |
13317 |
|
|
13318 |
|
|
13329 |
int width, height; |
int width, height; |
13330 |
int *root_x, *root_y; |
int *root_x, *root_y; |
13331 |
{ |
{ |
|
#ifdef TODO /* Tool tips not supported. */ |
|
13332 |
Lisp_Object left, top; |
Lisp_Object left, top; |
|
int win_x, win_y; |
|
|
Window root, child; |
|
13333 |
unsigned pmask; |
unsigned pmask; |
13334 |
|
|
13335 |
/* User-specified position? */ |
/* User-specified position? */ |
13338 |
|
|
13339 |
/* Move the tooltip window where the mouse pointer is. Resize and |
/* Move the tooltip window where the mouse pointer is. Resize and |
13340 |
show it. */ |
show it. */ |
13341 |
if (!INTEGERP (left) && !INTEGERP (top)) |
if (!INTEGERP (left) || !INTEGERP (top)) |
13342 |
{ |
{ |
13343 |
|
POINT pt; |
13344 |
|
|
13345 |
BLOCK_INPUT; |
BLOCK_INPUT; |
13346 |
XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, |
GetCursorPos (&pt); |
13347 |
&root, &child, root_x, root_y, &win_x, &win_y, &pmask); |
*root_x = pt.x; |
13348 |
|
*root_y = pt.y; |
13349 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
13350 |
} |
} |
13351 |
|
|
13361 |
|
|
13362 |
if (INTEGERP (left)) |
if (INTEGERP (left)) |
13363 |
*root_x = XINT (left); |
*root_x = XINT (left); |
13364 |
else if (*root_x + XINT (dx) + width > FRAME_X_DISPLAY_INFO (f)->width) |
else if (*root_x + XINT (dx) + width > FRAME_WIDTH (f)) |
13365 |
*root_x -= width + XINT (dx); |
*root_x -= width + XINT (dx); |
13366 |
else |
else |
13367 |
*root_x += XINT (dx); |
*root_x += XINT (dx); |
|
|
|
|
#endif /* Tooltip support. */ |
|
13368 |
} |
} |
13369 |
|
|
13370 |
|
|
13371 |
#ifdef TODO /* Tooltip support not complete. */ |
#ifdef TEST_TOOLTIPS /* Tooltip support in progress. */ |
13372 |
DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, |
DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, |
13373 |
doc: /* Show STRING in a \"tooltip\" window on frame FRAME. |
doc: /* Show STRING in a \"tooltip\" window on frame FRAME. |
13374 |
A tooltip window is a small window displaying a string. |
A tooltip window is a small window displaying a string. |
13378 |
PARMS is an optional list of frame parameters which can be |
PARMS is an optional list of frame parameters which can be |
13379 |
used to change the tooltip's appearance. |
used to change the tooltip's appearance. |
13380 |
|
|
13381 |
Automatically hide the tooltip after TIMEOUT seconds. |
Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil |
13382 |
TIMEOUT nil means use the default timeout of 5 seconds. |
means use the default timeout of 5 seconds. |
13383 |
|
|
13384 |
If the list of frame parameters PARAMS contains a `left' parameters, |
If the list of frame parameters PARAMS contains a `left' parameter, |
13385 |
the tooltip is displayed at that x-position. Otherwise it is |
the tooltip is displayed at that x-position. Otherwise it is |
13386 |
displayed at the mouse position, with offset DX added (default is 5 if |
displayed at the mouse position, with offset DX added (default is 5 if |
13387 |
DX isn't specified). Likewise for the y-position; if a `top' frame |
DX isn't specified). Likewise for the y-position; if a `top' frame |
13402 |
int i, width, height; |
int i, width, height; |
13403 |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
13404 |
int old_windows_or_buffers_changed = windows_or_buffers_changed; |
int old_windows_or_buffers_changed = windows_or_buffers_changed; |
13405 |
int count = specpdl_ptr - specpdl; |
int count = BINDING_STACK_SIZE (); |
13406 |
|
|
13407 |
specbind (Qinhibit_redisplay, Qt); |
specbind (Qinhibit_redisplay, Qt); |
13408 |
|
|
13449 |
} |
} |
13450 |
|
|
13451 |
BLOCK_INPUT; |
BLOCK_INPUT; |
13452 |
compute_tip_xy (f, parms, dx, dy, &root_x, &root_y); |
compute_tip_xy (f, parms, dx, dy, PIXEL_WIDTH (f), |
13453 |
XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
PIXEL_HEIGHT (f), &root_x, &root_y); |
13454 |
root_x, root_y - PIXEL_HEIGHT (f)); |
SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, |
13455 |
|
root_x, root_y, 0, 0, |
13456 |
|
SWP_NOSIZE | SWP_NOACTIVATE); |
13457 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
13458 |
goto start_timer; |
goto start_timer; |
13459 |
} |
} |
13481 |
|
|
13482 |
/* Create a frame for the tooltip, and record it in the global |
/* Create a frame for the tooltip, and record it in the global |
13483 |
variable tip_frame. */ |
variable tip_frame. */ |
13484 |
frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms); |
frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms, string); |
13485 |
f = XFRAME (frame); |
f = XFRAME (frame); |
13486 |
|
|
13487 |
/* Set up the frame's root window. */ |
/* Set up the frame's root window. */ |
13541 |
else |
else |
13542 |
row_width = row->pixel_width; |
row_width = row->pixel_width; |
13543 |
|
|
13544 |
height += row->height; |
/* TODO: find why tips do not draw along baseline as instructed. */ |
13545 |
|
height += row->height * 2; |
13546 |
width = max (width, row_width); |
width = max (width, row_width); |
13547 |
} |
} |
13548 |
|
|
13556 |
compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
13557 |
|
|
13558 |
BLOCK_INPUT; |
BLOCK_INPUT; |
13559 |
XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, |
13560 |
root_x, root_y - height, width, height); |
root_x, root_y - height, width, height, |
13561 |
XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); |
SWP_NOACTIVATE); |
13562 |
|
my_show_window (f, FRAME_W32_WINDOW (f), SW_SHOWNORMAL); |
13563 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
13564 |
|
|
13565 |
/* Draw into the window. */ |
/* Draw into the window. */ |
14726 |
|
|
14727 |
hourglass_atimer = NULL; |
hourglass_atimer = NULL; |
14728 |
hourglass_shown_p = 0; |
hourglass_shown_p = 0; |
14729 |
#ifdef TODO /* Tooltip support not complete. */ |
#if TEST_TOOLTIPS /* Tooltip support in progress. */ |
14730 |
defsubr (&Sx_show_tip); |
defsubr (&Sx_show_tip); |
14731 |
defsubr (&Sx_hide_tip); |
defsubr (&Sx_hide_tip); |
14732 |
#endif |
#endif |
14735 |
tip_frame = Qnil; |
tip_frame = Qnil; |
14736 |
staticpro (&tip_frame); |
staticpro (&tip_frame); |
14737 |
|
|
14738 |
|
last_show_tip_args = Qnil; |
14739 |
|
staticpro (&last_show_tip_args); |
14740 |
|
|
14741 |
defsubr (&Sx_file_dialog); |
defsubr (&Sx_file_dialog); |
14742 |
} |
} |
14743 |
|
|