aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/w32fns.c106
1 files changed, 86 insertions, 20 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index b65be25262f..37aaf4238f1 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -333,6 +333,11 @@ extern Lisp_Object Vwindow_system_version;
333 333
334Lisp_Object Qface_set_after_frame_default; 334Lisp_Object Qface_set_after_frame_default;
335 335
336#ifdef GLYPH_DEBUG
337int image_cache_refcount, dpyinfo_refcount;
338#endif
339
340
336/* From w32term.c. */ 341/* From w32term.c. */
337extern Lisp_Object Vw32_num_mouse_buttons; 342extern Lisp_Object Vw32_num_mouse_buttons;
338extern Lisp_Object Vw32_recognize_altgr; 343extern Lisp_Object Vw32_recognize_altgr;
@@ -688,6 +693,9 @@ struct x_frame_parm_table
688 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); 693 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object));
689}; 694};
690 695
696static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
697static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
698static void x_change_window_heights P_ ((Lisp_Object, int));
691/* TODO: Native Input Method support; see x_create_im. */ 699/* TODO: Native Input Method support; see x_create_im. */
692void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 700void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
693static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); 701static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -5109,6 +5117,37 @@ x_make_gc (f)
5109} 5117}
5110 5118
5111 5119
5120/* Handler for signals raised during x_create_frame and
5121 x_create_top_frame. FRAME is the frame which is partially
5122 constructed. */
5123
5124static Lisp_Object
5125unwind_create_frame (frame)
5126 Lisp_Object frame;
5127{
5128 struct frame *f = XFRAME (frame);
5129
5130 /* If frame is ``official'', nothing to do. */
5131 if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame))
5132 {
5133#ifdef GLYPH_DEBUG
5134 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5135#endif
5136
5137 x_free_frame_resources (f);
5138
5139 /* Check that reference counts are indeed correct. */
5140 xassert (dpyinfo->reference_count == dpyinfo_refcount);
5141 xassert (dpyinfo->image_cache->refcount == image_cache_refcount);
5142
5143 tip_window = NULL;
5144 tip_frame = Qnil;
5145 }
5146
5147 return Qnil;
5148}
5149
5150
5112DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 5151DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
5113 1, 1, 0, 5152 1, 1, 0,
5114 "Make a new window, which is called a \"frame\" in Emacs terms.\n\ 5153 "Make a new window, which is called a \"frame\" in Emacs terms.\n\
@@ -5198,8 +5237,8 @@ This function is an internal primitive--use `make-frame' instead.")
5198 f->output_data.w32 = 5237 f->output_data.w32 =
5199 (struct w32_output *) xmalloc (sizeof (struct w32_output)); 5238 (struct w32_output *) xmalloc (sizeof (struct w32_output));
5200 bzero (f->output_data.w32, sizeof (struct w32_output)); 5239 bzero (f->output_data.w32, sizeof (struct w32_output));
5201
5202 FRAME_FONTSET (f) = -1; 5240 FRAME_FONTSET (f) = -1;
5241 record_unwind_protect (unwind_create_frame, frame);
5203 5242
5204 f->icon_name 5243 f->icon_name
5205 = w32_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING); 5244 = w32_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING);
@@ -12176,7 +12215,7 @@ static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *,
12176 12215
12177/* The frame of a currently visible tooltip, or null. */ 12216/* The frame of a currently visible tooltip, or null. */
12178 12217
12179struct frame *tip_frame; 12218Lisp_Object tip_frame;
12180 12219
12181/* If non-nil, a timer started that hides the last tooltip when it 12220/* If non-nil, a timer started that hides the last tooltip when it
12182 fires. */ 12221 fires. */
@@ -12184,8 +12223,23 @@ struct frame *tip_frame;
12184Lisp_Object tip_timer; 12223Lisp_Object tip_timer;
12185Window tip_window; 12224Window tip_window;
12186 12225
12226static Lisp_Object
12227unwind_create_tip_frame (frame)
12228 Lisp_Object frame;
12229{
12230 tip_window = NULL;
12231 tip_frame = Qnil;
12232 return unwind_create_frame (frame);
12233}
12234
12235
12187/* Create a frame for a tooltip on the display described by DPYINFO. 12236/* Create a frame for a tooltip on the display described by DPYINFO.
12188 PARMS is a list of frame parameters. Value is the frame. */ 12237 PARMS is a list of frame parameters. Value is the frame.
12238
12239 Note that functions called here, esp. x_default_parameter can
12240 signal errors, for instance when a specified color name is
12241 undefined. We have to make sure that we're in a consistent state
12242 when this happens. */
12189 12243
12190static Lisp_Object 12244static Lisp_Object
12191x_create_tip_frame (dpyinfo, parms) 12245x_create_tip_frame (dpyinfo, parms)
@@ -12224,9 +12278,10 @@ x_create_tip_frame (dpyinfo, parms)
12224 12278
12225 frame = Qnil; 12279 frame = Qnil;
12226 GCPRO3 (parms, name, frame); 12280 GCPRO3 (parms, name, frame);
12227 tip_frame = f = make_frame (1); 12281 f = make_frame (1);
12228 XSETFRAME (frame, f); 12282 XSETFRAME (frame, f);
12229 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 12283 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
12284 record_unwind_protect (unwind_create_tip_frame, frame);
12230 12285
12231 f->output_method = output_w32; 12286 f->output_method = output_w32;
12232 f->output_data.w32 = 12287 f->output_data.w32 =
@@ -12238,6 +12293,10 @@ x_create_tip_frame (dpyinfo, parms)
12238 f->output_data.w32->fontset = -1; 12293 f->output_data.w32->fontset = -1;
12239 f->icon_name = Qnil; 12294 f->icon_name = Qnil;
12240 12295
12296#ifdef GLYPH_DEBUG
12297 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
12298 dpyinfo_refcount = dpyinfo->reference_count;
12299#endif /* GLYPH_DEBUG */
12241#ifdef MULTI_KBOARD 12300#ifdef MULTI_KBOARD
12242 FRAME_KBOARD (f) = kb; 12301 FRAME_KBOARD (f) = kb;
12243#endif 12302#endif
@@ -12412,6 +12471,7 @@ x_create_tip_frame (dpyinfo, parms)
12412 below. And the frame needs to be on Vframe_list or making it 12471 below. And the frame needs to be on Vframe_list or making it
12413 visible won't work. */ 12472 visible won't work. */
12414 Vframe_list = Fcons (frame, Vframe_list); 12473 Vframe_list = Fcons (frame, Vframe_list);
12474 tip_frame = frame;
12415 12475
12416 /* Now that the frame is official, it counts as a reference to 12476 /* Now that the frame is official, it counts as a reference to
12417 its display. */ 12477 its display. */
@@ -12498,7 +12558,7 @@ DY added (default is -5).")
12498 /* Create a frame for the tooltip, and record it in the global 12558 /* Create a frame for the tooltip, and record it in the global
12499 variable tip_frame. */ 12559 variable tip_frame. */
12500 frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms); 12560 frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms);
12501 tip_frame = f = XFRAME (frame); 12561 f = XFRAME (frame);
12502 12562
12503 /* Set up the frame's root window. Currently we use a size of 80 12563 /* Set up the frame's root window. Currently we use a size of 80
12504 columns x 40 lines. If someone wants to show a larger tip, he 12564 columns x 40 lines. If someone wants to show a larger tip, he
@@ -12605,28 +12665,34 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
12605Value is t is tooltip was open, nil otherwise.") 12665Value is t is tooltip was open, nil otherwise.")
12606 () 12666 ()
12607{ 12667{
12608 int count = specpdl_ptr - specpdl; 12668 int count;
12609 int deleted_p = 0; 12669 Lisp_Object deleted, frame, timer;
12670 struct gcpro gcpro1, gcpro2;
12671
12672 /* Return quickly if nothing to do. */
12673 if (NILP (tip_timer) && NILP (tip_frame))
12674 return Qnil;
12675
12676 frame = tip_frame;
12677 timer = tip_timer;
12678 GCPRO2 (frame, timer);
12679 tip_frame = tip_timer = deleted = Qnil;
12610 12680
12681 count = BINDING_STACK_SIZE ();
12611 specbind (Qinhibit_redisplay, Qt); 12682 specbind (Qinhibit_redisplay, Qt);
12683 specbind (Qinhibit_quit, Qt);
12612 12684
12613 if (!NILP (tip_timer)) 12685 if (!NILP (timer))
12614 { 12686 call1 (intern ("cancel-timer"), timer);
12615 call1 (intern ("cancel-timer"), tip_timer);
12616 tip_timer = Qnil;
12617 }
12618 12687
12619 if (tip_frame) 12688 if (FRAMEP (frame))
12620 { 12689 {
12621 Lisp_Object frame; 12690 Fdelete_frame (frame, Qnil);
12622 12691 deleted = Qt;
12623 XSETFRAME (frame, tip_frame);
12624 Fdelete_frame (frame, Qt);
12625 tip_frame = NULL;
12626 deleted_p = 1;
12627 } 12692 }
12628 12693
12629 return unbind_to (count, deleted_p ? Qt : Qnil); 12694 UNGCPRO;
12695 return unbind_to (count, deleted);
12630} 12696}
12631#endif 12697#endif
12632 12698