emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

frame sans decoration


From: Masatake YAMATO
Subject: frame sans decoration
Date: Fri, 27 May 2005 04:02:04 +0900 (JST)

I know well that we are in feature-freeze stage.
However, I think the feature provided by following patch is too 
good to be dropped from the next release.

As subject says, you can control(show or hide) window decorations 
attached to frames by a window manager on X11 window system.
(Currently my patch only support emacs built with gtk+.)

As you can see, the patch is very short. Actually I have not taken
much time for this patch. However, I think the impact of this patch 
is not small.

With this patch, you can use a frame as a tooltip window.
Advantages over the conventional tooltip window are:
(1) you can handle input to a tooltip window with elisp code,
(2) you can use text with faces and pixmap images, and
(3) you can contorol the text with faces and pixmap images with elisp code.
(4) scrollbar

Potential applications are:
- This patch may satisfy the request 2 in 
  http://lists.gnu.org/archive/html/emacs-devel/2004-03/msg00035.html
- Something like postit like application can be implemented with this patch.
- Better Kana->Kanji Conversion window can be implemented with this patch.
- Inline eldoc
- Inline descripbe-char
- you can get one more line for emacs from you display:-P
... People may write interesting elisp applications. 


To test, apply the patch, then evaluate the following sexp.

(progn (setq mode-line-format nil)
       (make-frame '((minibuffer . nil)
              (decoration . nil)
              (background-color . "#ffffBB")
              (width . 40)
              (height . 10)
              (internal-border-width . 10)
              (border-width . 0)
              (menu-bar-lines . 0)
              (tool-bar-lines . 0)
              (unsplittable . t)
              (has-modeline-p . nil)
              (left-fringe . 0)
              (vertical-scroll-bars . nil)
              (right-fringe . 0))))

If you need screenshots, talk to me.

Regards,
Masatake YAMATO
p.s. I'll write ChangeLog entry if this patch is still acceptable for 
the release.

Index: src/xterm.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.h,v
retrieving revision 1.172
diff -u -r1.172 xterm.h
--- src/xterm.h 8 Jan 2005 16:49:14 -0000       1.172
+++ src/xterm.h 26 May 2005 18:35:40 -0000
@@ -988,6 +988,7 @@
 extern void x_lower_frame P_ ((struct frame *));
 extern void x_make_frame_visible P_ ((struct frame *));
 extern void x_make_frame_invisible P_ ((struct frame *));
+extern void x_set_frame_decoration P_ ((struct frame *, int));
 extern void x_iconify_frame P_ ((struct frame *));
 extern void x_free_frame_resources P_ ((struct frame *));
 extern void x_destroy_window P_ ((struct frame *));
Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.864
diff -u -r1.864 xterm.c
--- src/xterm.c 10 May 2005 09:19:19 -0000      1.864
+++ src/xterm.c 26 May 2005 18:35:42 -0000
@@ -9271,6 +9271,23 @@
   XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints);
 }
 
+void
+x_set_frame_decoration (f, decoration)
+     struct frame *f;
+     int decoration;
+{
+#ifdef USE_GTK
+  if (FRAME_GTK_OUTER_WIDGET (f))
+    {
+      BLOCK_INPUT;
+      gtk_window_set_decorated(GTK_WINDOW(FRAME_GTK_OUTER_WIDGET (f)),
+                              (gboolean)decoration);
+      UNBLOCK_INPUT;
+    }
+#endif
+}
+
+
 
 /***********************************************************************
                                Fonts
Index: src/xfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfns.c,v
retrieving revision 1.639
diff -u -r1.639 xfns.c
--- src/xfns.c  10 May 2005 09:17:29 -0000      1.639
+++ src/xfns.c  26 May 2005 18:35:43 -0000
@@ -3269,6 +3269,10 @@
   x_window (f);
 #endif
 
+  /* (f)->output_data.x->widget is needed to control the decoration. */
+  x_default_parameter (f, parms, Qdecoration, Qt,
+                       "decoration", "Decoration", RES_TYPE_BOOLEAN);
+
   x_icon (f, parms);
   x_make_gc (f);
 
@@ -5623,6 +5627,7 @@
   x_set_fringe_width,
   x_set_wait_for_wm,
   x_set_fullscreen,
+  x_set_decoration,
 };
 
 void
Index: src/frame.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/frame.h,v
retrieving revision 1.108
diff -u -r1.108 frame.h
--- src/frame.h 30 Dec 2004 12:24:03 -0000      1.108
+++ src/frame.h 26 May 2005 18:35:43 -0000
@@ -319,6 +319,9 @@
   /* See FULLSCREEN_ enum below */
   int want_fullscreen;
 
+  /* Decoration added to a frame by a window manager*/
+  int decoration;
+
   /* Number of lines of menu bar.  */
   int menu_bar_lines;
 
@@ -1003,6 +1006,7 @@
 extern Lisp_Object Qline_spacing;
 extern Lisp_Object Qwait_for_wm;
 extern Lisp_Object Qfullscreen;
+extern Lisp_Object Qdecoration;
 
 extern Lisp_Object Qleft_fringe, Qright_fringe;
 extern Lisp_Object Qheight, Qwidth;
@@ -1059,6 +1063,7 @@
 extern void x_report_frame_params P_ ((struct frame *, Lisp_Object *));
 
 extern void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern void x_set_decoration P_ ((struct frame *, Lisp_Object, Lisp_Object));
 extern void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
 extern void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object));
 extern void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object));
Index: src/frame.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/frame.c,v
retrieving revision 1.315
diff -u -r1.315 frame.c
--- src/frame.c 24 Apr 2005 06:03:58 -0000      1.315
+++ src/frame.c 26 May 2005 18:35:45 -0000
@@ -108,6 +108,7 @@
 Lisp_Object Qtty_color_mode;
 
 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
+Lisp_Object Qdecoration;
 
 Lisp_Object Qface_set_after_frame_default;
 
@@ -297,6 +298,8 @@
 #ifdef HAVE_WINDOW_SYSTEM
   f->want_fullscreen = FULLSCREEN_NONE;
 #endif
+  f->decoration      = 1;
+
   f->size_hint_flags = 0;
   f->win_gravity = 0;
 
@@ -2575,6 +2578,7 @@
   {"right-fringe",             &Qright_fringe},
   {"wait-for-wm",              &Qwait_for_wm},
   {"fullscreen",                &Qfullscreen},
+  {"decoration",                &Qdecoration},
 };
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -3273,6 +3277,17 @@
   XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
 }
 
+void
+x_set_decoration (f, arg, oldval)
+     struct frame *f;
+     Lisp_Object arg, oldval;
+{
+  f->decoration = !EQ (Qnil, arg);
+#ifdef HAVE_WINDOW_SYSTEM  
+  x_set_frame_decoration(f, f->decoration);
+#endif
+}
+
 
 
 /* Return non-nil if frame F wants a bitmap icon.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]