emacs-devel
[Top][All Lists]
Advanced

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

Re: More enhancements to fringe bitmaps.


From: Marco Munari
Subject: Re: More enhancements to fringe bitmaps.
Date: Fri, 19 Mar 2004 04:44:00 +0100
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

~\/~ "Kim" == Kim F Storm <address@hidden> writes:

Kim> I think use of fringe-inactive should as a minimum be customizable.
Kim~> mode_line_in_non_selected_windows, or better add a new
Kim~> fringe_in_non_selected_windows variable to control this.

Assumption: Window managers call "window" what emacs calls "frame" and
 emacs calls "window" the partitioned/split text area; is it allways so for
 emacs and you?
 moreover... Is there a difference between "selected" and "active" window?
 (sometime i have the impression that "active window" in emacs is used for
 "acrive frame"), if i whatch more the code i can find answare on my own,
 but apparently you prefere the short cut.

I can add fringe_in_non_selected_windows locally (i can't do elsewhere),
but how do you preferre to syncronize idea in the code? You know emacs
code more than me and you have write access to cvs, not all file
patched by me are in the best way and i know.


   > > M src/fringe.c
   > > partially disabled user left and right fringe configurable to
   > > set brutally to current basic fringe (should be discussed)
   > > maybe we need to define right_user_fringe_inactive_face_id
 ~ > > left_user_fringe_inactive_face_id (better if a delta compatible
   > > to CURRENT_DELTA_FRINGE_FACE_ID..
   > > it's just a possibility far to be the best)

Kim> This is definitely the wrong approach for face selection.

the patch sent even of that file was my try to stay tuned,
i made CURRENT_DELTA_FRINGE_FACE_ID macro (do you referre to that one?)
few minuts before send the patch (i was in dubt to comment it)

Kim> A simple approach would be to use fringe-inactive unconditionally
Kim> in non-selected windows, and the fringe face (or user defined
Kim> face) in selected window.

Yes, i didn't realize it is what i should do, now it's OK.
(it is the whole cvs diff, so following patch has even previous
fringe.c bitmaps redefinition, i will move that code later)

? mar_emacs_cvs.diff
? mar_emacs_cvs.patch
? lispintro/Makefile.in.cvs6modified
? lispref/display.dvi
Index: AUTHORS
===================================================================
RCS file: /cvsroot/emacs/emacs/AUTHORS,v
retrieving revision 1.21
diff -u -r1.21 AUTHORS
--- AUTHORS     15 Feb 2004 00:01:26 -0000      1.21
+++ AUTHORS     19 Mar 2004 03:35:00 -0000
@@ -1118,6 +1118,9 @@
 
 Marco Melgazzi: changed term.el
 
+Marco Munari: changed faces.el xfaces.c dispextern.h window.c fringe.el
+  fringe.c xfns.c
+
 Marco Walther: changed mips-siemens.h unexelfsni.c unexsni.c
 
 Marcus G. Daniels: changed xterm.c configure.in lwlib-Xm.c lwlib.c
Index: etc/TODO
===================================================================
RCS file: /cvsroot/emacs/emacs/etc/TODO,v
retrieving revision 1.61
diff -u -r1.61 TODO
--- etc/TODO    21 Nov 2003 18:23:27 -0000      1.61
+++ etc/TODO    19 Mar 2004 03:35:01 -0000
@@ -68,9 +68,6 @@
 
 * Set fringe widths per-window/per-buffer.
 
-* Make fringe bitmaps user configurable.  Maybe add ability to add
-  additional bitmaps to the fringe from lisp.
-
 Other features we would like:
 
 * Have a command suggestion help system that recognizes patterns
Index: lisp/faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.282
diff -u -r1.282 faces.el
--- lisp/faces.el       27 Feb 2004 17:30:23 -0000      1.282
+++ lisp/faces.el       19 Mar 2004 03:35:04 -0000
@@ -1923,6 +1923,19 @@
   :version "21.1"
   :group 'frames
   :group 'basic-faces)
+;(put 'fringe-active 'face-alias 'fringe) ;deprecated, just to be clare
+
+(defface fringe-inactive
+  '((((class color) (background light))
+     :background "grey75")
+    (((class color) (background dark))
+     :background "grey30")
+    (t
+     :background "light gray"))
+  "Basic face for the fringes of active input emacs windows."
+  :version "21.4"
+  :group 'frames
+  :group 'basic-faces)
 
 
 (defface scroll-bar '()
Index: lisp/ibuffer.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ibuffer.el,v
retrieving revision 1.57
diff -u -r1.57 ibuffer.el
--- lisp/ibuffer.el     1 Sep 2003 15:45:12 -0000       1.57
+++ lisp/ibuffer.el     19 Mar 2004 03:35:16 -0000
@@ -199,7 +199,7 @@
   :group 'ibuffer)
 
 (defcustom ibuffer-eliding-string "..."
-  "The string to use for eliding long columns."
+  "The string to use for eliding long lines."
   :type 'string
   :group 'ibuffer)
 
Index: src/dispextern.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v
retrieving revision 1.169
diff -u -r1.169 dispextern.h
--- src/dispextern.h    14 Mar 2004 00:28:01 -0000      1.169
+++ src/dispextern.h    19 Mar 2004 03:35:16 -0000
@@ -1172,6 +1172,20 @@
       ? MATRIX_HEADER_LINE_ROW (MATRIX)->height        \
       : 0)
 
+/* Return the fringe mode relative to selected/unselected window,
+   parameters  W the window,  AFFID Active Fringe Face ID          */
+
+#define CURRENT_FRINGE_FACE_ID_2(W,AFFID)                      \
+       (fringe_in_non_selected_windows                 \
+       || ((W) == XWINDOW (selected_window))           \
+       ? AFFID                                         \
+       : FRINGE_INACTIVE_FACE_ID)
+
+/* see above, FRINGE_FACE_ID is the default */
+
+#define CURRENT_FRINGE_FACE_ID(W)                      \
+       CURRENT_FRINGE_FACE_ID_2(W,FRINGE_FACE_ID)
+
 /* Return the desired face id for the mode line of a window, depending
    on whether the window is selected or not, or if the window is the
    scrolling window for the currently active minibuffer window.
@@ -1519,6 +1533,7 @@
   MODE_LINE_INACTIVE_FACE_ID,
   TOOL_BAR_FACE_ID,
   FRINGE_FACE_ID,
+  FRINGE_INACTIVE_FACE_ID,
   HEADER_LINE_FACE_ID,
   SCROLL_BAR_FACE_ID,
   BORDER_FACE_ID,
@@ -2522,6 +2537,7 @@
 extern Lisp_Object Qtool_bar;
 extern Lisp_Object Vshow_trailing_whitespace;
 extern int mode_line_in_non_selected_windows;
+extern int fringe_in_non_selected_windows;
 extern int redisplaying_p;
 extern Lisp_Object Vimage_types;
 extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
Index: src/fringe.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fringe.c,v
retrieving revision 1.10
diff -u -r1.10 fringe.c
--- src/fringe.c        1 Mar 2004 23:56:44 -0000       1.10
+++ src/fringe.c        19 Mar 2004 03:35:16 -0000
@@ -104,32 +104,32 @@
 
 /* An arrow like this: `<-'.  */
 /*
-  ...xx...
-  ..xx....
-  .xx.....
-  xxxxxx..
-  xxxxxx..
-  .xx.....
-  ..xx....
-  ...xx...
+- ..... ...
+  ..x.. ...
+  .x... ...
+  xxxxx ...
+  .x... ...
+  ..x.. ...
+- ..... ...
+- ..... ...
 */
 static unsigned short left_arrow_bits[] = {
-   0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18};
+  0x04, 0x08, 0x1f, 0x08, 0x04};
 
 
 /* Right truncation arrow bitmap `->'.  */
 /*
-  ...xx...
-  ....xx..
-  .....xx.
-  ..xxxxxx
-  ..xxxxxx
-  .....xx.
-  ....xx..
-  ...xx...
+- ........
+  ... ..x..
+  ... ...x.
+  ... xxxxx
+  ... ...x.
+  ... ..x..
+- ........
+- ........
 */
 static unsigned short right_arrow_bits[] = {
-   0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18};
+  0x04, 0x02, 0x1f, 0x02, 0x04};
 
 
 /* Up arrow bitmap.  */
@@ -163,31 +163,31 @@
 
 /* Marker for continued lines.  */
 /*
-  ..xxxx..
-  ..xxxxx.
-  ......xx
-  ..x..xxx
-  ..xxxxxx
-  ..xxxxx.
-  ..xxxx..
-  ..xxxxx.
+- ........
+- ........
+- ........
+  .... xx.
+  .... ..x
+  .... x.x
+  .... xx.
+  .... xxx
 */
 static unsigned short continued_bits[] = {
-   0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e};
+   0x06, 0x01, 0x05, 0x06, 0x07};
 
 /* Marker for continuation lines.  */
 /*
-  ..xxxx..
-  .xxxxx..
-  xx......
-  xxx..x..
-  xxxxxx..
-  .xxxxx..
-  ..xxxx..
-  .xxxxx..
+  .... .xx
+  .... x..
+  .... x.x
+  .... .xx
+  .... xxx
+- ........
+- ........
+- ........
 */
 static unsigned short continuation_bits[] = {
-   0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c};
+   0x03, 0x04, 0x05, 0x03, 0x07};
 
 /* Overlay arrow bitmap.  A triangular arrow.  */
 /*
@@ -413,13 +413,14 @@
 struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] =
 {
   { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */
+  /*      bits, height,           width,period,   align   , dynamic*/
   { FRBITS (unknown_bits),            8, 0, ALIGN_BITMAP_CENTER, 0 },
-  { FRBITS (left_arrow_bits),         8, 0, ALIGN_BITMAP_CENTER, 0 },
-  { FRBITS (right_arrow_bits),        8, 0, ALIGN_BITMAP_CENTER, 0 },
+  { FRBITS (left_arrow_bits),         5, 0, ALIGN_BITMAP_CENTER, 0 },
+  { FRBITS (right_arrow_bits),        5, 0, ALIGN_BITMAP_CENTER, 0 },
   { FRBITS (up_arrow_bits),           8, 0, ALIGN_BITMAP_TOP,    0 },
   { FRBITS (down_arrow_bits),         8, 0, ALIGN_BITMAP_BOTTOM, 0 },
-  { FRBITS (continued_bits),          8, 0, ALIGN_BITMAP_CENTER, 0 },
-  { FRBITS (continuation_bits),       8, 0, ALIGN_BITMAP_CENTER, 0 },
+  { FRBITS (continued_bits),          3, 0, ALIGN_BITMAP_BOTTOM, 0 },
+  { FRBITS (continuation_bits),       3, 0, ALIGN_BITMAP_TOP,    0 },
   { FRBITS (ov_bits),                 8, 0, ALIGN_BITMAP_CENTER, 0 },
   { FRBITS (top_left_angle_bits),     8, 0, ALIGN_BITMAP_TOP,    0 },
   { FRBITS (top_right_angle_bits),    8, 0, ALIGN_BITMAP_TOP,    0 },
@@ -478,20 +479,21 @@
 
   if (which != NO_FRINGE_BITMAP)
     {
+      face_id = CURRENT_FRINGE_FACE_ID(w);
     }
   else if (left_p)
     {
       which = row->left_fringe_bitmap;
-      face_id = row->left_fringe_face_id;
+      face_id = CURRENT_FRINGE_FACE_ID_2(w, row->left_fringe_face_id);
     }
   else
     {
       which = row->right_fringe_bitmap;
-      face_id = row->right_fringe_face_id;
+      face_id = CURRENT_FRINGE_FACE_ID_2(w, row->right_fringe_face_id);
     }
 
   if (face_id == DEFAULT_FACE_ID)
-    face_id = fringe_faces[which];
+    face_id = CURRENT_FRINGE_FACE_ID_2(w, fringe_faces[which]);
 
   fb = fringe_bitmaps[which];
   if (fb == NULL)
@@ -800,7 +802,8 @@
       else if (row->left_user_fringe_bitmap != NO_FRINGE_BITMAP)
        {
          left = row->left_user_fringe_bitmap;
-         left_face_id = row->left_user_fringe_face_id;
+         left_face_id =
+           CURRENT_FRINGE_FACE_ID_2(w,row->left_user_fringe_face_id);
        }
       else if (row->indicate_bob_p && boundary_pos <= 0)
        left = ((row->indicate_eob_p && boundary_pos < 0)
@@ -826,7 +829,8 @@
       else if (row->right_user_fringe_bitmap != NO_FRINGE_BITMAP)
        {
          right = row->right_user_fringe_bitmap;
-         right_face_id = row->right_user_fringe_face_id;
+         right_face_id =
+           CURRENT_FRINGE_FACE_ID_2(w,row->right_user_fringe_face_id);
        }
       else if (row->indicate_bob_p && boundary_pos > 0)
        right = ((row->indicate_eob_p && boundary_pos >= 0)
@@ -853,15 +857,15 @@
          || row->visible_height != cur->visible_height
          || left != cur->left_fringe_bitmap
          || right != cur->right_fringe_bitmap
-         || left_face_id != cur->left_fringe_face_id
+         || le22ft_face_id != cur->left_fringe_face_id
          || right_face_id != cur->right_fringe_face_id
          || cur->redraw_fringe_bitmaps_p)
        {
          redraw_p = row->redraw_fringe_bitmaps_p = 
cur->redraw_fringe_bitmaps_p = 1;
          cur->left_fringe_bitmap = left;
          cur->right_fringe_bitmap = right;
-         cur->left_fringe_face_id = left_face_id;
-         cur->right_fringe_face_id = right_face_id;
+         cur->left_fringe_face_id = CURRENT_FRINGE_FACE_ID_2(w,left_face_id);
+         cur->right_fringe_face_id = CURRENT_FRINGE_FACE_ID_2(w,right_face_id);
        }
 
       if (row->overlay_arrow_p != cur->overlay_arrow_p)
@@ -872,8 +876,8 @@
 
       row->left_fringe_bitmap = left;
       row->right_fringe_bitmap = right;
-      row->left_fringe_face_id = left_face_id;
-      row->right_fringe_face_id = right_face_id;
+      row->left_fringe_face_id = CURRENT_FRINGE_FACE_ID_2(w,left_face_id);
+      row->right_fringe_face_id = CURRENT_FRINGE_FACE_ID_2(w,right_face_id);
     }
 
   return redraw_p;
@@ -992,7 +996,7 @@
   if (n = XINT (which), n >= max_used_fringe_bitmap)
     return Qnil;
 
-  fringe_faces[n] = FRINGE_FACE_ID;
+  fringe_faces[n] = FRINGE_INACTIVE_FACE_ID;
 
   fbp = &fringe_bitmaps[n];
   if (*fbp && (*fbp)->dynamic)
Index: src/window.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/window.c,v
retrieving revision 1.462
diff -u -r1.462 window.c
--- src/window.c        4 Mar 2004 17:16:23 -0000       1.462
+++ src/window.c        19 Mar 2004 03:35:21 -0000
@@ -129,6 +129,10 @@
    minibuffer is active.  */
 int mode_line_in_non_selected_windows;
 
+/* Non-zero means to use fringe-inactive face in all windows but the
+   selected-window.  */
+int fringe_in_non_selected_windows;
+
 /* If a window gets smaller than either of these, it is removed. */
 
 EMACS_INT window_min_height;
@@ -1775,8 +1779,10 @@
     window = Fnext_window (window, Qnil, all_frames);
   for (; i < 0; ++i)
     window = Fprevious_window (window, Qnil, all_frames);
-
-  Fselect_window (window, Qnil);
+  if (window != selected_window) {
+    //selected_window->circa row->redraw_fringe_bitmaps_p = 1;
+    Fselect_window (window, Qnil);
+  }
   return Qnil;
 }
 
@@ -6474,6 +6480,10 @@
               doc: /* Non-nil means to use `mode-line-inactive' face in 
non-selected windows.
 If the minibuffer is active, the `minibuffer-scroll-window' mode line
 is displayed in the `mode-line' face.  */);
+  mode_line_in_non_selected_windows = 1;
+
+  DEFVAR_BOOL ("fringe-in-non-selected-windows", 
&fringe_in_non_selected_windows,
+              doc: /* Non-nil means to use `fringe-inactive' face in 
non-selected windows.  */);
   mode_line_in_non_selected_windows = 1;
 
   DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer,
Index: src/xfaces.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfaces.c,v
retrieving revision 1.289
diff -u -r1.289 xfaces.c
--- src/xfaces.c        9 Feb 2004 15:39:49 -0000       1.289
+++ src/xfaces.c        19 Mar 2004 03:35:25 -0000
@@ -322,7 +322,7 @@
 
 /* Names of basic faces.  */
 
-Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe;
+Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe, Qfringe_inactive;
 Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse, Qmenu;
 Lisp_Object Qmode_line_inactive;
 extern Lisp_Object Qmode_line;
@@ -6626,6 +6626,7 @@
       realize_named_face (f, Qmode_line_inactive, MODE_LINE_INACTIVE_FACE_ID);
       realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID);
       realize_named_face (f, Qfringe, FRINGE_FACE_ID);
+      realize_named_face (f, Qfringe_inactive, FRINGE_INACTIVE_FACE_ID);
       realize_named_face (f, Qheader_line, HEADER_LINE_FACE_ID);
       realize_named_face (f, Qscroll_bar, SCROLL_BAR_FACE_ID);
       realize_named_face (f, Qborder, BORDER_FACE_ID);
@@ -7701,6 +7702,8 @@
   staticpro (&Qregion);
   Qfringe = intern ("fringe");
   staticpro (&Qfringe);
+  Qfringe_inactive = intern ("fringe-inactive");
+  staticpro (&Qfringe_inactive);
   Qheader_line = intern ("header-line");
   staticpro (&Qheader_line);
   Qscroll_bar = intern ("scroll-bar");
Index: src/xfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfns.c,v
retrieving revision 1.608
diff -u -r1.608 xfns.c
--- src/xfns.c  14 Mar 2004 00:28:46 -0000      1.608
+++ src/xfns.c  19 Mar 2004 03:35:30 -0000
@@ -1791,13 +1791,13 @@
 
 #ifdef USE_TOOLKIT_SCROLL_BARS
   /* A minimum width of 14 doesn't look good for toolkit scroll bars.  */
-  int width = 16 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM;
+  int width = 8 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM;
   FRAME_CONFIG_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid;
   FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = width;
 #else
   /* Make the actual width at least 14 pixels and a multiple of a
      character width.  */
-  FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
+  FRAME_CONFIG_SCROLL_BAR_COLS (f) = (6 + wid - 1) / wid;
 
   /* Use all of that space (aside from required margins) for the
      scroll bar.  */

PS: the rest of the mail is draft AS IS during composition, i go now.

Saluti,
MARco

Kim> A more flexible approach would be for the code which does the
Kim> actual fg/bg color selection to look at fringe-inactive face
Kim> colors if current window is non-selected and actual face's colors
Kim> match the fringe face colors.

It appare you like very much fixed color customization (insted i
prefere to think the passage from monocrome to generic color image
(a newline-arrow bitmap for example could have 3D aspect if it's
a color image)

i think there are some more interesting customization to think on...
minibuffer positioning
 bottom(default) and top, than absolute or relative to selected window

Kim> Your new tiny arrows are your personal preferences.  Since you
Kim> can now define your own alternative bitmaps, I don't see a need
Kim> to change the defaults.

as in the comments of my first post, i use those bitmap since the
code was in xdisp.c, when you move the bitmap to fringe.c i changed
the bitmap there, when you introduce the costomization capability

notice i resize and position the bitmaps

Kim> You could write code to (e.g. a use-tiny-fringe-arrows defcustom)
Kim> which installs (and removes) your custom bitmaps via suitable
Kim> calls to define-fringe-bitmap. We could then installed it in
Kim> fringe.el.

Kim> > 
Kim> > M src/window.c
Kim> > other-window call Fselect_window only if selected_window is
Kim> > effectively a new one (this modify enlight task when only 1 window is
Kim> > in the farme for either mode-line-fringe/mode-line-inactive
Kim> > and fringe/fringe_inactive)

Kim> That seems like a good idea.

it's just an optimization.

Kim> > 
Kim> > M src/xfaces.c > added lisp object Qfringe_inactive


Kim> > M src/xfns.c > personal preference (narrow scroll bar)

Kim> This is supposed to be customizable via the scroll-bar-width
Kim> frame parameter.

i compiled with  --with-x-toolkit=yes --without-toolkit-scroll-bars
but setting scroll-bar-width don't change the width of scroll bar
it works after long time

-- 
x(t),y(t) = th(3t-34.5)*e^[-(3t-34.5)^2]/2-4.3+e^(-1.8/t^2)/(.8*atg(t-
3)+2)(t-1.8)-.3th(5t-42.5),(1.4e^[-(3t-34.5)^2]+1-sgn[|t-8.5|-.5]*1.5*
|sin(pi*t)|^[2e^(-(t-11.5)^2)+.5+e^(-(.6t-3.3)^2)])/(.5+t)+1  ; 0<t<14

reply via email to

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