Subject: bug#25408: Remove Decorations Around Emacs Frame (Windows OS)

From: martin rudalics <[email-masked]>
Date: Sun, 07 May 2017 10:40:50 +0200

>>> Please try the attached patch (I only checked whether it compiles and
>>> builds on Windows).  You have to add a non-nil 'no-special-glyphs' frame
>>> parameter to suppress such glyphs.
>>
>> Sorry, that patch was complete scrap.  Hopefully, I'll come up with a
>> better one later.
>>
>> What do those glyphs look like - "\" for continuation and "$" for
>> truncation?
>
> Yup, exactly :) Thanks for your help!

Please try the revised patch I attached.

Thanks, martin

diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 367114b..c011f1b 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -119,7 +119,8 @@ tooltip-y-offset
 (defcustom tooltip-frame-parameters
   '((name . "tooltip")
     (internal-border-width . 2)
-    (border-width . 1))
+    (border-width . 1)
+    (no-special-glyphs . t))
   "Frame parameters used for tooltips.

 If `left' or `top' parameters are included, they specify the absolute
@@ -130,7 +131,8 @@ tooltip-frame-parameters
   :type '(repeat (cons :format "%v"
 		       (symbol :tag "Parameter")
 		       (sexp :tag "Value")))
-  :group 'tooltip)
+  :group 'tooltip
+  :version "26.1")

 (defface tooltip
   '((((class color))
diff --git a/src/frame.c b/src/frame.c
index 4d17a07..6442c3b 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -684,6 +684,7 @@ struct frame *
   f->horizontal_scroll_bars = false;
   f->want_fullscreen = FULLSCREEN_NONE;
   f->undecorated = false;
+  f->no_special_glyphs = false;
 #ifndef HAVE_NTGUI
   f->override_redirect = false;
 #endif
@@ -3289,6 +3290,7 @@ struct frame_parm_table {
   {"no-accept-focus",		SYMBOL_INDEX (Qno_accept_focus)},
   {"z-group",			SYMBOL_INDEX (Qz_group)},
   {"override-redirect",		SYMBOL_INDEX (Qoverride_redirect)},
+  {"no-special-glyphs",		SYMBOL_INDEX (Qno_special_glyphs)},
 };

 #ifdef HAVE_WINDOW_SYSTEM
@@ -4204,12 +4206,29 @@ struct frame_parm_table {
   return;
 }

+
+/**
+ * x_set_no_special_glyphs:
+ *
+ * Set frame F's `no-special-glyphs' parameter which, if non-nil,
+ * suppresses the display of truncation and continuation glyphs
+ * outside fringes.
+ */
+void
+x_set_no_special_glyphs (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
+{
+  if (!EQ (new_value, old_value))
+    FRAME_NO_SPECIAL_GLYPHS (f) = !NILP (new_value);
+}
+
+
 #ifndef HAVE_NS

 /* Non-zero if mouse is grabbed on DPYINFO
    and we know the frame where it is.  */

-bool x_mouse_grabbed (Display_Info *dpyinfo)
+bool
+x_mouse_grabbed (Display_Info *dpyinfo)
 {
   return (dpyinfo->grabbed
 	  && dpyinfo->last_mouse_frame
@@ -5077,6 +5096,7 @@ or a list (- N) meaning -N pixels relative to bottom/right corner.
   DEFSYM (Qicon, "icon");
   DEFSYM (Qminibuffer, "minibuffer");
   DEFSYM (Qundecorated, "undecorated");
+  DEFSYM (Qno_special_glyphs, "no-special-glyphs");
   DEFSYM (Qparent_frame, "parent-frame");
   DEFSYM (Qskip_taskbar, "skip-taskbar");
   DEFSYM (Qno_focus_on_map, "no-focus-on-map");
diff --git a/src/frame.h b/src/frame.h
index 4aa7c34..dbb3675 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -354,7 +354,11 @@ struct frame

   /* The z-group this frame's window belongs to. */
   ENUM_BF (z_group) z_group : 2;
-#endif /* HAVE_WINDOW_SYSTEM and not HAVE_NS */
+
+  /* Non-zero if display of truncation and continuation glyphs outside
+     the fringes is suppressed.  */
+  bool_bf no_special_glyphs : 1;
+#endif /* HAVE_WINDOW_SYSTEM */

   /* Whether new_height and new_width shall be interpreted
      in pixels.  */
@@ -928,6 +932,7 @@ struct frame
 #define FRAME_SKIP_TASKBAR(f) ((f)->skip_taskbar)
 #define FRAME_NO_FOCUS_ON_MAP(f) ((f)->no_focus_on_map)
 #define FRAME_NO_ACCEPT_FOCUS(f) ((f)->no_accept_focus)
+#define FRAME_NO_SPECIAL_GLYPHS(f) ((f)->no_special_glyphs)
 #define FRAME_Z_GROUP(f) ((f)->z_group)
 #define FRAME_Z_GROUP_NONE(f) ((f)->z_group == z_group_none)
 #define FRAME_Z_GROUP_ABOVE(f) ((f)->z_group == z_group_above)
@@ -941,6 +946,7 @@ struct frame
 #define FRAME_SKIP_TASKBAR(f) ((void) f, 0)
 #define FRAME_NO_FOCUS_ON_MAP(f) ((void) f, 0)
 #define FRAME_NO_ACCEPT_FOCUS(f) ((void) f, 0)
+#define FRAME_NO_SPECIAL_GLYPHS(f) ((void) f, 0)
 #define FRAME_Z_GROUP(f) ((void) f, z_group_none)
 #define FRAME_Z_GROUP_NONE(f) ((void) f, true)
 #define FRAME_Z_GROUP_ABOVE(f) ((void) f, false)
@@ -1498,6 +1504,7 @@ extern void x_set_bottom_divider_width (struct frame *, Lisp_Object,
 extern long x_figure_window_size (struct frame *, Lisp_Object, bool, int *, int *);

 extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_no_special_glyphs (struct frame *, Lisp_Object, Lisp_Object);

 extern void validate_x_resource_name (void);

diff --git a/src/nsfns.m b/src/nsfns.m
index cbe0ffb..38945b8 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -983,6 +983,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
   x_set_no_accept_focus,
   x_set_z_group, /* x_set_z_group */
   0, /* x_set_override_redirect */
+  x_set_no_special_glyphs,
 };

@@ -1255,6 +1256,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
 		       "leftFringe", "LeftFringe", RES_TYPE_NUMBER);
   x_default_parameter (f, parms, Qright_fringe, Qnil,
 		       "rightFringe", "RightFringe", RES_TYPE_NUMBER);
+  x_default_parameter (f, parameters, Qno_special_glyphs, Qnil,
+		       NULL, NULL, RES_TYPE_BOOLEAN);

   init_frame_faces (f);

diff --git a/src/w32fns.c b/src/w32fns.c
index e490588..bb73253 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5889,6 +5889,8 @@ struct frame *
 		       NULL, NULL, RES_TYPE_BOOLEAN);
   x_default_parameter (f, parameters, Qno_accept_focus, Qnil,
 		       NULL, NULL, RES_TYPE_BOOLEAN);
+  x_default_parameter (f, parameters, Qno_special_glyphs, Qnil,
+		       NULL, NULL, RES_TYPE_BOOLEAN);

   /* Process alpha here (Bug#16619).  On XP this fails with child
      frames.  For `no-focus-on-map' frames delay processing of alpha
@@ -10330,6 +10332,7 @@ enum NI_Severity {
   x_set_no_accept_focus,
   x_set_z_group,
   0, /* x_set_override_redirect */
+  x_set_no_special_glyphs,
 };

 void
diff --git a/src/xdisp.c b/src/xdisp.c
index 41458c3..c546198 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2834,13 +2834,12 @@ static Lisp_Object calc_line_height_property (struct it *, Lisp_Object,

   /* Get dimensions of truncation and continuation glyphs.  These are
      displayed as fringe bitmaps under X, but we need them for such
-     frames when the fringes are turned off.  But leave the dimensions
-     zero for tooltip frames, as these glyphs look ugly there and also
-     sabotage calculations of tooltip dimensions in x-show-tip.  */
+     frames when the fringes are turned off.  The no_special_glyphs slot
+     of the iterator's frame, when set, suppresses their display - by
+     default for tooltip frames and when set via the 'no-special-glyphs'
+     frame parameter.  */
 #ifdef HAVE_WINDOW_SYSTEM
-  if (!(FRAME_WINDOW_P (it->f)
-	&& FRAMEP (tip_frame)
-	&& it->f == XFRAME (tip_frame)))
+  if (!(FRAME_WINDOW_P (it->f) && it->f->no_special_glyphs))
 #endif
     {
       if (it->line_wrap == TRUNCATE)
diff --git a/src/xfns.c b/src/xfns.c
index e463391..3f2a499 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3814,6 +3814,8 @@ struct mouse_cursor_data {
 		       "leftFringe", "LeftFringe", RES_TYPE_NUMBER);
   x_default_parameter (f, parms, Qright_fringe, Qnil,
 		       "rightFringe", "RightFringe", RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qno_special_glyphs, Qnil,
+		       NULL, NULL, RES_TYPE_BOOLEAN);

   x_default_scroll_bar_color_parameter (f, parms, Qscroll_bar_foreground,
 					"scrollBarForeground",
@@ -7486,6 +7488,7 @@ FRAMES should be nil (the selected frame), a frame, or a list of
   x_set_no_accept_focus,
   x_set_z_group,
   x_set_override_redirect,
+  x_set_no_special_glyphs,
 };

 void