unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Adding parameters to windows
@ 2008-05-15 17:51 Stefan Monnier
  2008-05-23 14:10 ` joakim
  0 siblings, 1 reply; 26+ messages in thread
From: Stefan Monnier @ 2008-05-15 17:51 UTC (permalink / raw)
  To: Joakim Verona; +Cc: emacs-devel

Now that your copyright papers are on file, could you send us a patch
together with a corresponding ChangeLog entry?


        Stefan




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
@ 2008-05-16 23:37 Seiji Zenitani
  2008-05-20  1:17 ` Stefan Monnier
  0 siblings, 1 reply; 26+ messages in thread
From: Seiji Zenitani @ 2008-05-16 23:37 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

Hi,

> Now that your copyright papers are on file, could you send us
> a patch together with a corresponding ChangeLog entry?
>
> Stefan

Here's a patch & ChangeLog lines for a new frame parameter.

Seiji


2008-05-14 Seiji Zenitani <zenitani@mac.com>, Ryo Yoshitake <ryo@shiftmode.net 
 >
	
	* frame.c (Qalpha): add a new frame parameter `alpha'.
	(Vframe_alpha_lower_limit) : new variable.
	(x_set_alpha): Add function.

	* frame.h (Qalpha, Vframe_parameter_lower_limit): export them.

	* xfns.c (x-create-frame, Qalpha):
	Initialize the frame parameter `alpha'.
	* xterm.c (x_set_frame_alpha): Add function.

	* macfns.c (mac_frame_parm_handlers): A null handler for x_set_alpha.
	* w32fns.c (w32_frame_parm_handlers): Likewise.


[-- Attachment #2: transparency4-x23.patch --]
[-- Type: application/octet-stream, Size: 8051 bytes --]

diff -Naur ../emacs.orig/src/frame.c ../emacs/src/frame.c
--- ../emacs.orig/src/frame.c	2008-05-14 03:49:31.000000000 -0400
+++ ../emacs/src/frame.c	2008-05-14 23:14:44.000000000 -0400
@@ -62,6 +62,10 @@
 
 Lisp_Object Vx_resource_class;
 
+/* Lower limit value of the frame opacity (alpha transparency).  */
+
+Lisp_Object Vframe_alpha_lower_limit;
+
 #endif
 
 Lisp_Object Qframep, Qframe_live_p;
@@ -113,6 +117,7 @@
 
 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
 Lisp_Object Qfont_backend;
+Lisp_Object Qalpha;
 
 Lisp_Object Qinhibit_face_set_after_frame_default;
 Lisp_Object Qface_set_after_frame_default;
@@ -2824,7 +2829,8 @@
   {"right-fringe",		&Qright_fringe},
   {"wait-for-wm",		&Qwait_for_wm},
   {"fullscreen",                &Qfullscreen},
-  {"font-backend",		&Qfont_backend}
+  {"font-backend",		&Qfont_backend},
+  {"alpha",			&Qalpha}
 };
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -3634,6 +3640,61 @@
     return Qnil;
 }
 
+void
+x_set_alpha (f, arg, oldval)
+     struct frame *f;
+     Lisp_Object arg, oldval;
+{
+  double alpha = 1.0;
+  double newval[2];
+  int i, ialpha;
+  Lisp_Object item;
+
+  for (i=0;i<2;i++)
+    {
+      newval[i] = 1.0;
+      if (CONSP (arg))
+        {
+          item = CAR (arg);
+          arg  = CDR (arg);
+        }
+      else
+        item=arg;
+
+      if (!NILP (item))
+        {
+          if (FLOATP (item))
+            {
+              alpha = XFLOAT_DATA (item);
+              if (alpha < 0.0 || 1.0 < alpha)
+                args_out_of_range (make_float (0.0), make_float (1.0));
+            }
+          else if (INTEGERP (item))
+            {
+              ialpha = XINT (item);
+              if (ialpha < 0 || 100 < ialpha)
+                args_out_of_range (make_number (0), make_number (100));
+              else
+                alpha = ialpha / 100.0;
+            }
+          else
+            wrong_type_argument (Qnumberp, item);
+        }
+      newval[i] = alpha;
+    }
+
+  for (i=0;i<2;i++)
+    f->alpha[i] = newval[i];
+
+#ifdef HAVE_X_WINDOWS
+  BLOCK_INPUT;
+  x_set_frame_alpha (f);
+  UNBLOCK_INPUT;
+#endif
+
+  return;
+}
+
 \f
 /* Subroutines of creating an X frame.  */
 
@@ -4403,6 +4464,13 @@
 but binding this variable locally around a call to `x-get-resource'
 is a reasonable practice.  See also the variable `x-resource-name'.  */);
   Vx_resource_class = build_string (EMACS_CLASS);
+
+  DEFVAR_LISP ("frame-alpha-lower-limit", &Vframe_alpha_lower_limit,
+    doc: /* The lower limit of the frame opacity (alpha transparency).
+The value should range from 0 (invisible) to 100 (completely opaque).
+The user can also use a floating number between 0.0 and 1.0.
+The default is 20.  */);
+  Vframe_alpha_lower_limit = make_number (20);
 #endif
 
   DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,
diff -Naur ../emacs.orig/src/frame.h ../emacs/src/frame.h
--- ../emacs.orig/src/frame.h	2008-05-13 21:27:45.000000000 -0400
+++ ../emacs/src/frame.h	2008-05-14 23:19:16.000000000 -0400
@@ -215,6 +215,11 @@
      be used for output.  */
   unsigned glyphs_initialized_p : 1;
 
+  /* frame opacity
+     alpha[0]: alpha transparency of the active frame
+     alpha[1]: alpha transparency of inactive frames   */
+  double alpha[2];
+
   /* Set to non-zero in change_frame_size when size of frame changed
      Clear the frame in clear_garbaged_frames if set.  */
   unsigned resized_p : 1;
@@ -1035,6 +1040,7 @@
 extern Lisp_Object Qwait_for_wm;
 extern Lisp_Object Qfullscreen;
 extern Lisp_Object Qfont_backend;
+extern Lisp_Object Qalpha;
 
 extern Lisp_Object Qleft_fringe, Qright_fringe;
 extern Lisp_Object Qheight, Qwidth;
@@ -1099,6 +1105,8 @@
 
 extern int x_figure_window_size P_ ((struct frame *, Lisp_Object, int));
 
+extern Lisp_Object Vframe_alpha_lower_limit;
+extern void x_set_alpha P_ ((struct frame *, Lisp_Object, Lisp_Object));
 
 extern void validate_x_resource_name P_ ((void));
 
diff -Naur ../emacs.orig/src/macfns.c ../emacs/src/macfns.c
--- ../emacs.orig/src/macfns.c	2008-05-14 03:49:40.000000000 -0400
+++ ../emacs/src/macfns.c	2008-05-14 23:12:20.000000000 -0400
@@ -4321,6 +4321,8 @@
   x_set_fringe_width,
   0, /* x_set_wait_for_wm, */
   x_set_fullscreen,
+  0, /* x_set_font_backend, */
+  0 /* x_set_alpha, */
 };
 
 void
diff -Naur ../emacs.orig/src/w32fns.c ../emacs/src/w32fns.c
--- ../emacs.orig/src/w32fns.c	2008-05-14 03:50:03.000000000 -0400
+++ ../emacs/src/w32fns.c	2008-05-14 23:14:22.000000000 -0400
@@ -8922,7 +8922,8 @@
   x_set_fringe_width,
   0, /* x_set_wait_for_wm, */
   x_set_fullscreen,
-  x_set_font_backend
+  x_set_font_backend,
+  0 /* x_set_alpha, */
 };
 
 void
diff -Naur ../emacs.orig/src/xfns.c ../emacs/src/xfns.c
--- ../emacs.orig/src/xfns.c	2008-05-14 03:50:22.000000000 -0400
+++ ../emacs/src/xfns.c	2008-05-14 23:15:26.000000000 -0400
@@ -3405,6 +3405,8 @@
   x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
 		       "scrollBarWidth", "ScrollBarWidth",
 		       RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qalpha, Qnil,
+		       "alpha", "Alpha", RES_TYPE_NUMBER);
 
   /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
      Change will not be effected unless different from the current
@@ -5771,7 +5773,8 @@
   x_set_fringe_width,
   x_set_wait_for_wm,
   x_set_fullscreen,
-  x_set_font_backend
+  x_set_font_backend,
+  x_set_alpha
 };
 
 void
diff -Naur ../emacs.orig/src/xterm.c ../emacs/src/xterm.c
--- ../emacs.orig/src/xterm.c	2008-05-14 03:50:26.000000000 -0400
+++ ../emacs/src/xterm.c	2008-05-14 23:12:20.000000000 -0400
@@ -457,6 +457,67 @@
   return 0;
 }
 
+#define OPAQUE  0xffffffff
+#define OPACITY "_NET_WM_WINDOW_OPACITY"
+
+void
+x_set_frame_alpha (f)
+     struct frame *f;
+{
+  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  Display *dpy = FRAME_X_DISPLAY (f);
+  Window win = FRAME_OUTER_WINDOW (f);
+  if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc)
+    /* Since the WM decoration lies under the FRAME_OUTER_WINDOW,
+       we must treat the former instead of the latter. */
+    win = FRAME_X_OUTPUT(f)->parent_desc;
+
+  double alpha = 1.0, alpha_min = 1.0;
+
+  if (dpyinfo->x_highlight_frame == f)
+    alpha = f->alpha[0];
+  else
+    alpha = f->alpha[1];
+
+  if (FLOATP (Vframe_alpha_lower_limit))
+    alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit);
+  else if (INTEGERP (Vframe_alpha_lower_limit))
+    alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;
+
+  if (alpha < 0.0 || 1.0 < alpha)
+    alpha = 1.0;
+  else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
+    alpha = alpha_min;
+
+  unsigned int opac = (unsigned int)(alpha * OPAQUE);
+
+  /* return unless necessary */
+  {
+    unsigned char *data;
+    Atom actual;
+    int format;
+    unsigned long n, left;
+
+    XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False),
+		       0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left,
+		       (unsigned char **) &data);
+    if (data != None)
+      if (*(unsigned int *)data == opac)
+	{
+	  XFree ((void *) data);
+	  return;
+	}
+      else
+       {
+	  XFree ((void *) data);
+       }
+  }
+
+  XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False),
+		   XA_CARDINAL, 32, PropModeReplace,
+		   (unsigned char *) &opac, 1L);
+  XSync (dpy, False);
+}
 
 \f
 /***********************************************************************
@@ -3171,6 +3232,7 @@
 		    f->output_data.x->border_pixel);
   UNBLOCK_INPUT;
   x_update_cursor (f, 1);
+  x_set_frame_alpha (f);
 }
 
 static void
@@ -3186,6 +3248,7 @@
 			  f->output_data.x->border_tile);
   UNBLOCK_INPUT;
   x_update_cursor (f, 1);
+  x_set_frame_alpha (f);
 }
 
 /* The focus has changed.  Update the frames as necessary to reflect

[-- Attachment #3: Type: text/plain, Size: 3 bytes --]





^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-05-16 23:37 Adding parameters to windows Seiji Zenitani
@ 2008-05-20  1:17 ` Stefan Monnier
  2008-06-03  9:04   ` Seiji Zenitani
  0 siblings, 1 reply; 26+ messages in thread
From: Stefan Monnier @ 2008-05-20  1:17 UTC (permalink / raw)
  To: Seiji Zenitani; +Cc: emacs-devel

>> Now that your copyright papers are on file, could you send us
>> a patch together with a corresponding ChangeLog entry?

> Here's a patch & ChangeLog lines for a new frame parameter.

It looks OK.  Whoever decides to instll it just needs to make the
following adjustments:
1 - follow coding conventions (a space after ";" and ",", a space
    around binary operators).
2 - add a NEWS entry and a ChangeLog entry.


        Stefan




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-05-15 17:51 Stefan Monnier
@ 2008-05-23 14:10 ` joakim
  2008-05-23 19:47   ` Stefan Monnier
  0 siblings, 1 reply; 26+ messages in thread
From: joakim @ 2008-05-23 14:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Now that your copyright papers are on file, could you send us a patch
> together with a corresponding ChangeLog entry?
>
>
>         Stefan

Changelog entry:

2008-05-23  Joakim Verona  <joakim@verona.se>

	* window.h (window):Added window_parameters.

	* window.c (syms_of_window): Add new symbols.

	* window.c (DEFUN): New defun set-window-parameter.

	* window.c (make_window): Initialize window_parameters to nil.

I edited out the parts of the patch for "pinning" and "grouping"
windows. Please find it attached.

        

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: winpropp-1st.diff --]
[-- Type: text/x-patch, Size: 2306 bytes --]

=== modified file 'src/window.c'
--- src/window.c	2008-04-03 02:15:43 +0000
+++ src/window.c	2008-04-29 09:40:34 +0000
@@ -275,6 +278,7 @@
   p->frame = Qnil;
   p->display_table = Qnil;
   p->dedicated = Qnil;
+  p->window_parameters = Qnil;
   p->pseudo_window_p = 0;
   bzero (&p->cursor, sizeof (p->cursor));
   bzero (&p->last_cursor, sizeof (p->last_cursor));
@@ -1325,6 +1329,38 @@
   return w->dedicated;
 }
 
+DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
+       1, 1, 0,
+       doc: /* Return WINDOW's window-parameters.
+               returns nil or an alist where values affect window operations.  */)
+     (window)
+     Lisp_Object window;
+{
+  return decode_window (window)->window_parameters;
+}
+
+
+DEFUN ("set-window-parameter", Fset_window_parameter,
+       Sset_window_parameter, 3, 3, 0,
+       doc: /* set window parameters */)
+     (window, prop, val)
+     Lisp_Object window, prop, val;
+{
+  register struct window *w = decode_window (window);
+  register Lisp_Object old_alist_elt;
+  
+  old_alist_elt = Fassq (prop, w->window_parameters);
+  if (EQ (old_alist_elt, Qnil))
+    w->window_parameters = Fcons (Fcons (prop, val), w->window_parameters);
+  else
+    Fsetcdr (old_alist_elt, val);
+
+  //Fplist_put(w->window_parameters,key,value);
+
+  return w->window_parameters;
+}
+
+
 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
        0, 1, 0,
        doc: /* Return the display-table that WINDOW is using.
@@ -7714,6 +7771,9 @@
   defsubr (&Sset_window_vscroll);
   defsubr (&Scompare_window_configurations);
   defsubr (&Swindow_list);
+  defsubr (&Swindow_parameters);
+  defsubr (&Sset_window_parameter);           
+           
 }
 
 void

=== modified file 'src/window.h'
--- src/window.h	2008-01-29 02:05:10 +0000
+++ src/window.h	2008-04-29 10:04:07 +0000
@@ -229,6 +229,11 @@
        enlarged. */
     Lisp_Object orig_total_lines, orig_top_line;
 
+    /* an alist with flags that modifies behaviour of certain window operations.
+       currently "pin" and "group" are special
+     */
+    Lisp_Object window_parameters;
+    
     /* No Lisp data may follow below this point without changing
        mark_object in alloc.c.  The member current_matrix must be the
        first non-Lisp member.  */

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]



-- 
Joakim Verona

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-05-23 14:10 ` joakim
@ 2008-05-23 19:47   ` Stefan Monnier
  2008-05-23 20:28     ` joakim
  2008-06-04 11:01     ` joakim
  0 siblings, 2 replies; 26+ messages in thread
From: Stefan Monnier @ 2008-05-23 19:47 UTC (permalink / raw)
  To: joakim; +Cc: emacs-devel

Your patch needs a few tweaks, e.g. to adjust it to the coding
conventions:
- The docstring of window-parameters is poor.
  E.g. the first line doesn't say anything.  The second line is indented
  in the source, which looks bad when you do C-h f window-parameters.
  nil is an aliast as well, so there's no need to mention it explicitly.
- I'd prefer to have `window-parameter' rather than `window-parameters'.
- The docstring of set-window-parameter needs to start with a capital
  letter and end with a "." and should mention its arguments.
  Feel free to plagiarize set-frame-parameter.
- The comment for window_parameters refers to `pin' and `group'.
- See http://www.gnu.org/prep/standards/standards.html#Change-Logs for
  the format to use in ChangeLogs:
  - put together changes to a file.
  - your changelog seems to say you've changed `DEFUN'.
  - there's a missing space after colon in "(window:Added".
  - And the "Added" should be "Add" of course.

Thank you very much for your help.  BTW, could you point me to your
latest version of the pin&group patch?


        Stefan




> === modified file 'src/window.c'
> --- src/window.c	2008-04-03 02:15:43 +0000
> +++ src/window.c	2008-04-29 09:40:34 +0000
> @@ -275,6 +278,7 @@
p-> frame = Qnil;
p-> display_table = Qnil;
p-> dedicated = Qnil;
> +  p->window_parameters = Qnil;
p-> pseudo_window_p = 0;
>    bzero (&p->cursor, sizeof (p->cursor));
>    bzero (&p->last_cursor, sizeof (p->last_cursor));
> @@ -1325,6 +1329,38 @@
>    return w->dedicated;
>  }
 
> +DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
> +       1, 1, 0,
> +       doc: /* Return WINDOW's window-parameters.
> +               returns nil or an alist where values affect window operations.  */)
> +     (window)
> +     Lisp_Object window;
> +{
> +  return decode_window (window)->window_parameters;
> +}
> +
> +
> +DEFUN ("set-window-parameter", Fset_window_parameter,
> +       Sset_window_parameter, 3, 3, 0,
> +       doc: /* set window parameters */)
> +     (window, prop, val)
> +     Lisp_Object window, prop, val;
> +{
> +  register struct window *w = decode_window (window);
> +  register Lisp_Object old_alist_elt;
> +  
> +  old_alist_elt = Fassq (prop, w->window_parameters);
> +  if (EQ (old_alist_elt, Qnil))
> +    w->window_parameters = Fcons (Fcons (prop, val), w->window_parameters);
> +  else
> +    Fsetcdr (old_alist_elt, val);
> +
> +  //Fplist_put(w->window_parameters,key,value);
> +
> +  return w->window_parameters;
> +}
> +
> +
>  DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
>         0, 1, 0,
>         doc: /* Return the display-table that WINDOW is using.
> @@ -7714,6 +7771,9 @@
>    defsubr (&Sset_window_vscroll);
>    defsubr (&Scompare_window_configurations);
>    defsubr (&Swindow_list);
> +  defsubr (&Swindow_parameters);
> +  defsubr (&Sset_window_parameter);           
> +           
>  }
 
>  void

> === modified file 'src/window.h'
> --- src/window.h	2008-01-29 02:05:10 +0000
> +++ src/window.h	2008-04-29 10:04:07 +0000
> @@ -229,6 +229,11 @@
>         enlarged. */
>      Lisp_Object orig_total_lines, orig_top_line;
 
> +    /* an alist with flags that modifies behaviour of certain window operations.
> +       currently "pin" and "group" are special
> +     */
> +    Lisp_Object window_parameters;
> +    
>      /* No Lisp data may follow below this point without changing
>         mark_object in alloc.c.  The member current_matrix must be the
>         first non-Lisp member.  */



> -- 
> Joakim Verona




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-05-23 19:47   ` Stefan Monnier
@ 2008-05-23 20:28     ` joakim
  2008-06-04 11:01     ` joakim
  1 sibling, 0 replies; 26+ messages in thread
From: joakim @ 2008-05-23 20:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: klaus.berndl, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2018 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Your patch needs a few tweaks, e.g. to adjust it to the coding
> conventions:
> - The docstring of window-parameters is poor.
>   E.g. the first line doesn't say anything.  The second line is indented
>   in the source, which looks bad when you do C-h f window-parameters.
>   nil is an aliast as well, so there's no need to mention it explicitly.
> - I'd prefer to have `window-parameter' rather than `window-parameters'.
> - The docstring of set-window-parameter needs to start with a capital
>   letter and end with a "." and should mention its arguments.
>   Feel free to plagiarize set-frame-parameter.
> - The comment for window_parameters refers to `pin' and `group'.
> - See http://www.gnu.org/prep/standards/standards.html#Change-Logs for
>   the format to use in ChangeLogs:
>   - put together changes to a file.
>   - your changelog seems to say you've changed `DEFUN'.
>   - there's a missing space after colon in "(window:Added".
>   - And the "Added" should be "Add" of course.

I will address your concerns shortly. I'm slowed down a bit because I
havent got a pleasing SCM setup yet for working on different parts of
the patch. I should probably have two bzr branches to work in, one for
the basic winprop part, one for the pin/group feature.

The Changelog entry was basically generated by the Emacs diff mode, I'll
fix it.

>
> Thank you very much for your help.  BTW, could you point me to your
> latest version of the pin&group patch?
>

Please find it attached. Some notes:

- Richard prefered some other wording than "pin" which I cant remember, but I
will change that.

- I lazily removed a caching of the full window list. I could presumably
bring it back for the case when iterating all windows. Comments?

- If I understood Klaus correctly It appears one might need some kind of
"buffer group" concept when switching buffers inside a "window
group". Should that be implemented in a similar way as
window-properties, or at the elisp level?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: winpropp.diff --]
[-- Type: text/x-patch, Size: 7130 bytes --]

=== modified file 'src/window.c'
--- src/window.c	2008-04-03 02:15:43 +0000
+++ src/window.c	2008-04-29 09:40:34 +0000
@@ -55,6 +55,8 @@
 
 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
 Lisp_Object Qscroll_up, Qscroll_down;
+Lisp_Object Qpin;
+Lisp_Object Qgroup;
 Lisp_Object Qwindow_size_fixed;
 extern Lisp_Object Qleft_margin, Qright_margin;
 
@@ -82,7 +84,8 @@
 					 Lisp_Object *));
 static int foreach_window_1 P_ ((struct window *,
 				 int (* fn) (struct window *, void *),
-				 void *));
+				 void *,
+                                 int));
 static Lisp_Object window_list_1 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
 
 /* This is the window in which the terminal's cursor should
@@ -275,6 +278,7 @@
   p->frame = Qnil;
   p->display_table = Qnil;
   p->dedicated = Qnil;
+  p->window_parameters = Qnil;
   p->pseudo_window_p = 0;
   bzero (&p->cursor, sizeof (p->cursor));
   bzero (&p->last_cursor, sizeof (p->last_cursor));
@@ -1082,7 +1086,7 @@
 
   window = Qnil;
   cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part;
-  foreach_window (f, check_window_containing, &cw);
+  foreach_window (f, check_window_containing, &cw, 1);
 
   /* If not found above, see if it's in the tool bar window, if a tool
      bar exists.  */
@@ -1325,6 +1329,38 @@
   return w->dedicated;
 }
 
+DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
+       1, 1, 0,
+       doc: /* Return WINDOW's window-parameters.
+               returns nil or an alist where values affect window operations.  */)
+     (window)
+     Lisp_Object window;
+{
+  return decode_window (window)->window_parameters;
+}
+
+
+DEFUN ("set-window-parameter", Fset_window_parameter,
+       Sset_window_parameter, 3, 3, 0,
+       doc: /* set window parameters */)
+     (window, prop, val)
+     Lisp_Object window, prop, val;
+{
+  register struct window *w = decode_window (window);
+  register Lisp_Object old_alist_elt;
+  
+  old_alist_elt = Fassq (prop, w->window_parameters);
+  if (EQ (old_alist_elt, Qnil))
+    w->window_parameters = Fcons (Fcons (prop, val), w->window_parameters);
+  else
+    Fsetcdr (old_alist_elt, val);
+
+  //Fplist_put(w->window_parameters,key,value);
+
+  return w->window_parameters;
+}
+
+
 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
        0, 1, 0,
        doc: /* Return the display-table that WINDOW is using.
@@ -1729,7 +1765,8 @@
 static Lisp_Object
 window_list ()
 {
-  if (!CONSP (Vwindow_list))
+  //if(!CONSP (Vwindow_list))
+  if (1) //never cache the window list for now FIXME
     {
       Lisp_Object tail;
 
@@ -1742,7 +1779,7 @@
 	     new windows at the front of args[1], which means we
 	     have to reverse this list at the end.  */
 	  args[1] = Qnil;
-	  foreach_window (XFRAME (XCAR (tail)), add_window_to_list, &args[1]);
+	  foreach_window (XFRAME (XCAR (tail)), add_window_to_list, &args[1], 0);
 	  args[0] = Vwindow_list;
 	  args[1] = Fnreverse (args[1]);
 	  Vwindow_list = Fnconc (2, args);
@@ -2209,7 +2246,10 @@
 	    break;
 
 	  case DELETE_OTHER_WINDOWS:
-	    if (!EQ (window, obj))
+            //
+	    if ((!EQ (window, obj)) && //obj is not the current window
+                //current window doesnt have "pin" prop set
+                (NILP(Fassq (Qpin, w->window_parameters))))
 	      Fdelete_window (window);
 	    break;
 
@@ -7159,17 +7199,20 @@
 \f
 /* Call FN for all leaf windows on frame F.  FN is called with the
    first argument being a pointer to the leaf window, and with
-   additional argument USER_DATA.  Stops when FN returns 0.  */
+   additional argument USER_DATA.  Stops when FN returns 0.
+   ALLWINDOWS 1 means iterate every window, else only the group of the selected window
+*/
 
 void
-foreach_window (f, fn, user_data)
+foreach_window (f, fn, user_data, allwindows)
      struct frame *f;
      int (* fn) P_ ((struct window *, void *));
      void *user_data;
+     int allwindows;
 {
   /* Fdelete_frame may set FRAME_ROOT_WINDOW (f) to Qnil.  */
   if (WINDOWP (FRAME_ROOT_WINDOW (f)))
-    foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data);
+    foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data,allwindows);
 }
 
 
@@ -7179,22 +7222,29 @@
    Stop when FN returns 0.  Value is 0 if stopped by FN.  */
 
 static int
-foreach_window_1 (w, fn, user_data)
+foreach_window_1 (w, fn, user_data, allwindows)
      struct window *w;
      int (* fn) P_ ((struct window *, void *));
      void *user_data;
+     int allwindows;
 {
   int cont;
-
+  struct window *current_window=XWINDOW(selected_window);
+  register Lisp_Object group = Fcdr(Fassq(Qgroup, current_window->window_parameters));
+  Lisp_Object group2;
   for (cont = 1; w && cont;)
     {
       if (!NILP (w->hchild))
- 	cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data);
+ 	cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data,allwindows);
       else if (!NILP (w->vchild))
- 	cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data);
-      else
-	cont = fn (w, user_data);
-
+ 	cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data,allwindows);
+      else{
+        //only call fn if the group of the frames selected window 
+        //is the same as the group of the current window in the loop.
+        group2=Fcdr(Fassq(Qgroup,w->window_parameters));
+        if (allwindows || EQ(group ,  group2  ))
+          cont = fn (w, user_data);
+      }
       w = NILP (w->next) ? 0 : XWINDOW (w->next);
     }
 
@@ -7233,7 +7283,7 @@
      struct frame *f;
      int freeze_p;
 {
-  foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0));
+  foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0),1);
 }
 
 \f
@@ -7398,6 +7448,13 @@
 void
 syms_of_window ()
 {
+
+  Qpin = intern ("pin");
+  Qgroup = intern ("group");
+  
+  staticpro (&Qpin);
+  staticpro (&Qgroup);
+
   Qscroll_up = intern ("scroll-up");
   staticpro (&Qscroll_up);
 
@@ -7714,6 +7771,9 @@
   defsubr (&Sset_window_vscroll);
   defsubr (&Scompare_window_configurations);
   defsubr (&Swindow_list);
+  defsubr (&Swindow_parameters);
+  defsubr (&Sset_window_parameter);           
+           
 }
 
 void

=== modified file 'src/window.h'
--- src/window.h	2008-01-29 02:05:10 +0000
+++ src/window.h	2008-04-29 10:04:07 +0000
@@ -229,6 +229,11 @@
        enlarged. */
     Lisp_Object orig_total_lines, orig_top_line;
 
+    /* an alist with flags that modifies behaviour of certain window operations.
+       currently "pin" and "group" are special
+     */
+    Lisp_Object window_parameters;
+    
     /* No Lisp data may follow below this point without changing
        mark_object in alloc.c.  The member current_matrix must be the
        first non-Lisp member.  */
@@ -786,7 +791,8 @@
 extern void freeze_window_starts P_ ((struct frame *, int));
 extern void foreach_window P_ ((struct frame *,
 				int (* fn) (struct window *, void *),
-				void *));
+				void *,
+                                int allwindows));
 extern void grow_mini_window P_ ((struct window *, int));
 extern void shrink_mini_window P_ ((struct window *));
 

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]



-- 
Joakim Verona

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-05-20  1:17 ` Stefan Monnier
@ 2008-06-03  9:04   ` Seiji Zenitani
  2008-06-03 17:38     ` Glenn Morris
  0 siblings, 1 reply; 26+ messages in thread
From: Seiji Zenitani @ 2008-06-03  9:04 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

Hi,

I noticed that the transparency code was already installed.
Here is a NEWS entry for it.

Thanks,
Seiji

** Frame operations:

*** Controlling the frame opacity.
The opacity of a frame can now be controlled by setting
the `alpha' frame parameter, on X Window system with composite  
extension.
The alpha parameter should be an integer between 0 (transparent) and
100 (opaque) or a float number between 0.0 and 1.0.
Optionally, the opacity can be set by a cons cell;
the first item controlls the opacity of an active frame,
and the second item controlls that of non-active frames.

  (set-frame-parameter nil 'alpha 80)
  (set-frame-parameter nil 'alpha 0.8)
  (set-frame-parameter nil 'alpha '(100 70)) ;; (<active> [<inactive>])
  (set-frame-parameter nil 'alpha nil)

Note that the threshold opacity of a frame is defined
by the variable `frame-alpha-lower-limit',
so that the user may not lose control of the frame.
The default value is 20.  Similarly, an integer (0-100) or
a float number (0.0-1.0) can be set.


On 2008/05/19, at 21:17, Stefan Monnier wrote:

>>> Now that your copyright papers are on file, could you send us
>>> a patch together with a corresponding ChangeLog entry?
>
>> Here's a patch & ChangeLog lines for a new frame parameter.
>
> It looks OK.  Whoever decides to instll it just needs to make the
> following adjustments:
> 1 - follow coding conventions (a space after ";" and ",", a space
>    around binary operators).
> 2 - add a NEWS entry and a ChangeLog entry.
>
>
>        Stefan





^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-03  9:04   ` Seiji Zenitani
@ 2008-06-03 17:38     ` Glenn Morris
  2008-06-04  6:46       ` Jan Djärv
  0 siblings, 1 reply; 26+ messages in thread
From: Glenn Morris @ 2008-06-03 17:38 UTC (permalink / raw)
  To: Seiji Zenitani; +Cc: Stefan Monnier, emacs-devel

Seiji Zenitani wrote:

> I noticed that the transparency code was already installed.
> Here is a NEWS entry for it.

Thanks; I'll be happy to install that later on today.

>  (set-frame-parameter nil 'alpha 80)

None of these commands do anything for me. AFAIK I am using X with a
composite extension:

xdpyinfo
number of extensions:    32
    BIG-REQUESTS
    Composite
    ...

What am I doing wrong?

This is a build --with-x-toolkit=athena, if that matters.




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-03 17:38     ` Glenn Morris
@ 2008-06-04  6:46       ` Jan Djärv
  2008-06-04  7:08         ` Glenn Morris
  2008-06-05  1:45         ` Seiji Zenitani
  0 siblings, 2 replies; 26+ messages in thread
From: Jan Djärv @ 2008-06-04  6:46 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Seiji Zenitani, Stefan Monnier, emacs-devel



Glenn Morris skrev:
> Seiji Zenitani wrote:
> 
>> I noticed that the transparency code was already installed.
>> Here is a NEWS entry for it.
> 
> Thanks; I'll be happy to install that later on today.
> 
>>  (set-frame-parameter nil 'alpha 80)
> 
> None of these commands do anything for me. AFAIK I am using X with a
> composite extension:
> 
> xdpyinfo
> number of extensions:    32
>     BIG-REQUESTS
>     Composite
>     ...
> 
> What am I doing wrong?

Not running a compositing window manager?  The transparency stuff is all done 
by the window manager.  And it must be a window manager that knows how to do 
that.  I.e. compiz, beryl or some such.

> 
> This is a build --with-x-toolkit=athena, if that matters.
> 

It doesn't.

	Jan D.




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04  6:46       ` Jan Djärv
@ 2008-06-04  7:08         ` Glenn Morris
  2008-06-04  9:10           ` Miles Bader
  2008-06-05  1:45         ` Seiji Zenitani
  1 sibling, 1 reply; 26+ messages in thread
From: Glenn Morris @ 2008-06-04  7:08 UTC (permalink / raw)
  To: Jan Djärv; +Cc: Seiji Zenitani, Stefan Monnier, emacs-devel

Jan Djärv wrote:

> Not running a compositing window manager? 

Window Maker. :)

> The transparency stuff is all done by the window manager. And it
> must be a window manager that knows how to do that. I.e. compiz,
> beryl or some such.

I imagine someone should add these kind of details to the NEWS entry.




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04  7:08         ` Glenn Morris
@ 2008-06-04  9:10           ` Miles Bader
  0 siblings, 0 replies; 26+ messages in thread
From: Miles Bader @ 2008-06-04  9:10 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Seiji Zenitani, Jan Djärv, Stefan Monnier, emacs-devel

Glenn Morris <rgm@gnu.org> writes:
>> The transparency stuff is all done by the window manager. And it
>> must be a window manager that knows how to do that. I.e. compiz,
>> beryl or some such.
>
> I imagine someone should add these kind of details to the NEWS entry.

Note that it's not really the most useful sort of transparency anyway:
it makes _everything_ transparent -- text, modelines, etc. -- not just
the background.

-miles

-- 
If you can't beat them, arrange to have them beaten.  [George Carlin]




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-05-23 19:47   ` Stefan Monnier
  2008-05-23 20:28     ` joakim
@ 2008-06-04 11:01     ` joakim
  2008-06-04 11:18       ` David Kastrup
  2008-06-04 15:10       ` Stefan Monnier
  1 sibling, 2 replies; 26+ messages in thread
From: joakim @ 2008-06-04 11:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Your patch needs a few tweaks, e.g. to adjust it to the coding
> conventions:
> - The docstring of window-parameters is poor.
>   E.g. the first line doesn't say anything.  The second line is indented
>   in the source, which looks bad when you do C-h f window-parameters.
>   nil is an aliast as well, so there's no need to mention it explicitly.
> - I'd prefer to have `window-parameter' rather than `window-parameters'.
> - The docstring of set-window-parameter needs to start with a capital
>   letter and end with a "." and should mention its arguments.
>   Feel free to plagiarize set-frame-parameter.
> - The comment for window_parameters refers to `pin' and `group'.
> - See http://www.gnu.org/prep/standards/standards.html#Change-Logs for
>   the format to use in ChangeLogs:
>   - put together changes to a file.
>   - your changelog seems to say you've changed `DEFUN'.
>   - there's a missing space after colon in "(window:Added".
>   - And the "Added" should be "Add" of course.

I've tried to adress your concerns in the attached patch.

A reworked ChangeLog entry:

2008-06-03  Joakim Verona  <joakim@verona.se>

	* window.h (window_parameters): Declare

	* window.c: (Fwindow_parameters): New defun.
	(Fwindow_parameter): New defun.
	(Fset_window_parameter): New defun.
	(syms_of_window): Defsubr the new defuns.
	(make_window): 	initialize window_parameters to nil


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: winprop.diff --]
[-- Type: text/x-patch, Size: 2847 bytes --]

=== modified file 'src/window.c'
--- src/window.c	2008-06-02 12:09:12 +0000
+++ src/window.c	2008-06-03 14:08:13 +0000
@@ -273,6 +273,7 @@
   p->frame = Qnil;
   p->display_table = Qnil;
   p->dedicated = Qnil;
+  p->window_parameters = Qnil;
   p->pseudo_window_p = 0;
   bzero (&p->cursor, sizeof (p->cursor));
   bzero (&p->last_cursor, sizeof (p->last_cursor));
@@ -1324,6 +1325,51 @@
   return w->dedicated;
 }
 
+DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
+       1, 1, 0,
+       doc: /*  Return the parameters-alist of window WINDOW.
+It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
+The meaningful PARMs depend on the kind of window.
+If WINDOW is omitted, return information on the currently selected window.   */)
+     (window)
+     Lisp_Object window;
+{
+  if (NILP (window))
+    window = selected_window;
+  return decode_window (window)->window_parameters;
+}
+
+DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
+       2, 2, 0,
+       doc:  /* Return WINDOW's value for parameter PARAMETER.
+If WINDOW is nil, describe the currently selected window.  */)
+     (window,parameter)
+     Lisp_Object window,parameter;
+{
+  if (NILP (window))
+    window = selected_window;
+  return  Fassq (parameter, decode_window (window)->window_parameters);
+}
+
+
+DEFUN ("set-window-parameter", Fset_window_parameter,
+       Sset_window_parameter, 3, 3, 0,
+       doc: /* set window parameters */)
+     (window, prop, val)
+     Lisp_Object window, prop, val;
+{
+  register struct window *w = decode_window (window);
+  register Lisp_Object old_alist_elt;
+  
+  old_alist_elt = Fassq (prop, w->window_parameters);
+  if (EQ (old_alist_elt, Qnil))
+    w->window_parameters = Fcons (Fcons (prop, val), w->window_parameters);
+  else
+    Fsetcdr (old_alist_elt, val);
+  return w->window_parameters;
+}
+
+
 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
        0, 1, 0,
        doc: /* Return the display-table that WINDOW is using.
@@ -7687,6 +7733,10 @@
   defsubr (&Sset_window_vscroll);
   defsubr (&Scompare_window_configurations);
   defsubr (&Swindow_list);
+  defsubr (&Swindow_parameters);
+  defsubr (&Swindow_parameter);  
+  defsubr (&Sset_window_parameter);           
+           
 }
 
 void

=== modified file 'src/window.h'
--- src/window.h	2008-05-15 09:24:57 +0000
+++ src/window.h	2008-06-03 13:35:47 +0000
@@ -228,6 +228,10 @@
        enlarged. */
     Lisp_Object orig_total_lines, orig_top_line;
 
+    /* an alist with parameteres that modifies behaviour of certain window operations.
+     */
+    Lisp_Object window_parameters;
+    
     /* No Lisp data may follow below this point without changing
        mark_object in alloc.c.  The member current_matrix must be the
        first non-Lisp member.  */


[-- Attachment #3: Type: text/plain, Size: 19 bytes --]


-- 
Joakim Verona

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 11:01     ` joakim
@ 2008-06-04 11:18       ` David Kastrup
  2008-06-04 11:24         ` joakim
  2008-06-04 15:10       ` Stefan Monnier
  1 sibling, 1 reply; 26+ messages in thread
From: David Kastrup @ 2008-06-04 11:18 UTC (permalink / raw)
  To: joakim; +Cc: Stefan Monnier, emacs-devel

joakim@verona.se writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> Your patch needs a few tweaks, e.g. to adjust it to the coding
>> conventions:
>> - The docstring of window-parameters is poor.
>>   E.g. the first line doesn't say anything.  The second line is indented
>>   in the source, which looks bad when you do C-h f window-parameters.
>>   nil is an aliast as well, so there's no need to mention it explicitly.
>> - I'd prefer to have `window-parameter' rather than `window-parameters'.
>> - The docstring of set-window-parameter needs to start with a capital
>>   letter and end with a "." and should mention its arguments.
>>   Feel free to plagiarize set-frame-parameter.
>> - The comment for window_parameters refers to `pin' and `group'.
>
> I've tried to adress your concerns in the attached patch.

M-x checkdoc RET

should help with getting stuff more coding convention compliant.

-- 
David Kastrup




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 11:18       ` David Kastrup
@ 2008-06-04 11:24         ` joakim
  2008-06-04 11:46           ` David Kastrup
  0 siblings, 1 reply; 26+ messages in thread
From: joakim @ 2008-06-04 11:24 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

David Kastrup <dak@gnu.org> writes:

> M-x checkdoc RET
>
> should help with getting stuff more coding convention compliant.

Thanks. This was a patch at the C level. Can checkdoc be coerced to
handle Emacs C code?

-- 
Joakim Verona




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 11:24         ` joakim
@ 2008-06-04 11:46           ` David Kastrup
  0 siblings, 0 replies; 26+ messages in thread
From: David Kastrup @ 2008-06-04 11:46 UTC (permalink / raw)
  To: joakim; +Cc: emacs-devel

joakim@verona.se writes:

> David Kastrup <dak@gnu.org> writes:
>
>> M-x checkdoc RET
>>
>> should help with getting stuff more coding convention compliant.
>
> Thanks. This was a patch at the C level. Can checkdoc be coerced to
> handle Emacs C code?

Not that I know of.  Sorry for the noise.  Maybe one could convert into
a pseudo-Lisp buffer and check that, but it is not really the same
thing, I guess.

It would likely help if one used overlays with modification-hooks on the
corresponding passages from Lisp and C that transferred changes in one
buffer over to the other.  That could be useful for some other
applications as well.  But the difference between C and Lisp strings is
not going to make things easier.

-- 
David Kastrup




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 11:01     ` joakim
  2008-06-04 11:18       ` David Kastrup
@ 2008-06-04 15:10       ` Stefan Monnier
  2008-06-04 15:58         ` joakim
  2008-06-04 21:13         ` Juanma Barranquero
  1 sibling, 2 replies; 26+ messages in thread
From: Stefan Monnier @ 2008-06-04 15:10 UTC (permalink / raw)
  To: joakim; +Cc: emacs-devel

>> - I'd prefer to have `window-parameter' rather than `window-parameters'.

I see you kept window-parameters around.  That's fine, but I'm curious
if there's a particular reason for it.  Has it proved more useful than
window-parameter in some circumtance?

>> - The docstring of set-window-parameter needs to start with a capital
>> letter and end with a "." and should mention its arguments.

You forgot about that one.

> 	(make_window): 	initialize window_parameters to nil

Extra space after colon, lack of capital afterwards and lack of closing ".".

> +It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.

Actually, nowhere is it enforced or even necessary for PARM to be
a symbol (which is a good thing).
Also better say PARAM than PARM.  We can afford the extra chars after
removing the comment about it being a symbol ;-)

> +  register struct window *w = decode_window (window);
> +  register Lisp_Object old_alist_elt;
     ^^^^^^^^
;-)

> +    /* an alist with parameteres that modifies behaviour of certain window operations.

Lack capitalization.  Don't bother saying "that modifies behaviour of
certain window operations": all the data in "struct window" has this
property, by its very nature.  This also has the added benefit of making
it fit within 80 columns.

> +     */

We usually put this at the end of the last line of the comment rather
than on its own line.

Can someone fix up those things and commit this patch, please?
And add a note to etc/NEWS about it?


        Stefan




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 15:10       ` Stefan Monnier
@ 2008-06-04 15:58         ` joakim
  2008-06-04 17:24           ` Stefan Monnier
  2008-06-04 21:13         ` Juanma Barranquero
  1 sibling, 1 reply; 26+ messages in thread
From: joakim @ 2008-06-04 15:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> - I'd prefer to have `window-parameter' rather than `window-parameters'.
>
> I see you kept window-parameters around.  That's fine, but I'm curious
> if there's a particular reason for it.  Has it proved more useful than
> window-parameter in some circumtance?

No, I just tried to follow the "frame" api. It can be removed.

> Can someone fix up those things and commit this patch, please?
> And add a note to etc/NEWS about it?

Nice!

>         Stefan
-- 
Joakim Verona




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 15:58         ` joakim
@ 2008-06-04 17:24           ` Stefan Monnier
  0 siblings, 0 replies; 26+ messages in thread
From: Stefan Monnier @ 2008-06-04 17:24 UTC (permalink / raw)
  To: joakim; +Cc: emacs-devel

>>>> - I'd prefer to have `window-parameter' rather than `window-parameters'.
>> 
>> I see you kept window-parameters around.  That's fine, but I'm curious
>> if there's a particular reason for it.  Has it proved more useful than
>> window-parameter in some circumtance?

> No, I just tried to follow the "frame" api.

Makes sense.

> It can be removed.

That's not necessary.


        Stefan




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 15:10       ` Stefan Monnier
  2008-06-04 15:58         ` joakim
@ 2008-06-04 21:13         ` Juanma Barranquero
  2008-06-04 21:25           ` joakim
                             ` (2 more replies)
  1 sibling, 3 replies; 26+ messages in thread
From: Juanma Barranquero @ 2008-06-04 21:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: joakim, emacs-devel

On Wed, Jun 4, 2008 at 5:10 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Can someone fix up those things and commit this patch, please?

I commited it.

I've done a few trivial changes:

 - making the argument of `window-parameters' optional, as the
docstring suggests
 - args are consistently called WINDOW, PARAMETER and VALUE.
 - I've documented the return value of `set-window-parameter' (seems
silly to return it and not document it).

Questions:

 - What does mean "The meaningful PARAMETERs depend on the kind of
window." Which parameters are meaningul, and for which windows?

 - It is wise to return (in `window-parameter' and
`set-window-parameter') directly the parameter alist, instead of a
copy of it?

> And add a note to etc/NEWS about it?

Sorry, I'm *horrible* at deciding what to write in NEWS...

 Juanma




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 21:13         ` Juanma Barranquero
@ 2008-06-04 21:25           ` joakim
  2008-06-04 21:56             ` Juanma Barranquero
  2008-06-04 21:27           ` Juanma Barranquero
  2008-06-05  2:07           ` Stefan Monnier
  2 siblings, 1 reply; 26+ messages in thread
From: joakim @ 2008-06-04 21:25 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Stefan Monnier, emacs-devel

"Juanma Barranquero" <lekktu@gmail.com> writes:

> Questions:
>
>  - What does mean "The meaningful PARAMETERs depend on the kind of
> window." Which parameters are meaningul, and for which windows?

Well, none, at present. This patch is only one half of the
"window nodelete/group" patch. The meaningful parameters are defined in
the other half. So, its probably better to remove this comment for now.

>  - It is wise to return (in `window-parameter' and
> `set-window-parameter') directly the parameter alist, instead of a
> copy of it?

Ok, maybe not. Is there any rule of thumb to decide to do the one or the other?

>> And add a note to etc/NEWS about it?
>
> Sorry, I'm *horrible* at deciding what to write in NEWS...

Maybe:

** Functions to handle window paramters were added, similar to the
   functions for frame parameters.

ok, that might at least inspire better efforts from others :)   


>  Juanma
-- 
Joakim Verona




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 21:13         ` Juanma Barranquero
  2008-06-04 21:25           ` joakim
@ 2008-06-04 21:27           ` Juanma Barranquero
  2008-06-05  2:07           ` Stefan Monnier
  2 siblings, 0 replies; 26+ messages in thread
From: Juanma Barranquero @ 2008-06-04 21:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: joakim, emacs-devel

> I've done a few trivial changes:

I've also removed the checks to default to the selected window. All
three functions call decode_window, which already takes care of it.

 Juanma




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 21:25           ` joakim
@ 2008-06-04 21:56             ` Juanma Barranquero
  2008-06-04 22:05               ` joakim
  0 siblings, 1 reply; 26+ messages in thread
From: Juanma Barranquero @ 2008-06-04 21:56 UTC (permalink / raw)
  To: joakim; +Cc: Stefan Monnier, emacs-devel

On Wed, Jun 4, 2008 at 11:25 PM,  <joakim@verona.se> wrote:

> Well, none, at present. This patch is only one half of the
> "window nodelete/group" patch. The meaningful parameters are defined in
> the other half. So, its probably better to remove this comment for now.

That depends on whether the other half is going to be installed or not...

> Ok, maybe not. Is there any rule of thumb to decide to do the one or the other?

Not sure, but it is a bit strange to let the lisp level directly
manipulate an alist that is part of the window structure, even if it
is not unsafe at this moment. AFAICS, frame-parameters returns a copy.

> ** Functions to handle window parameters were added, similar to the
>   functions for frame parameters.

BTW, there is no function to remove a parameter (though, truth be
told, there's no remove-frame-parameter either).

   Juanma




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 21:56             ` Juanma Barranquero
@ 2008-06-04 22:05               ` joakim
  0 siblings, 0 replies; 26+ messages in thread
From: joakim @ 2008-06-04 22:05 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Stefan Monnier, emacs-devel

"Juanma Barranquero" <lekktu@gmail.com> writes:

> On Wed, Jun 4, 2008 at 11:25 PM,  <joakim@verona.se> wrote:
>
>> Well, none, at present. This patch is only one half of the
>> "window nodelete/group" patch. The meaningful parameters are defined in
>> the other half. So, its probably better to remove this comment for now.
>
> That depends on whether the other half is going to be installed or not...

Not soon-ish I would think. There is also another window-group proposal,
that appears to work differently.

>> Ok, maybe not. Is there any rule of thumb to decide to do the one or the other?
>
> Not sure, but it is a bit strange to let the lisp level directly
> manipulate an alist that is part of the window structure, even if it
> is not unsafe at this moment. AFAICS, frame-parameters returns a copy.

Ok, should be copy here as well then.

>> ** Functions to handle window parameters were added, similar to the
>>   functions for frame parameters.
>
> BTW, there is no function to remove a parameter (though, truth be
> told, there's no remove-frame-parameter either).

Ok.

>    Juanma
-- 
Joakim Verona




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04  6:46       ` Jan Djärv
  2008-06-04  7:08         ` Glenn Morris
@ 2008-06-05  1:45         ` Seiji Zenitani
  1 sibling, 0 replies; 26+ messages in thread
From: Seiji Zenitani @ 2008-06-05  1:45 UTC (permalink / raw)
  To: Jan Djärv; +Cc: Glenn Morris, Stefan Monnier, emacs-devel

On 2008/06/04, at 2:46, Jan Djärv wrote:
>
> Glenn Morris skrev:
>> Seiji Zenitani wrote:
>>> I noticed that the transparency code was already installed.
>>> Here is a NEWS entry for it.
>> Thanks; I'll be happy to install that later on today.
>>> (set-frame-parameter nil 'alpha 80)
>> None of these commands do anything for me. AFAIK I am using X with a
>> composite extension:
>> xdpyinfo
>> number of extensions:    32
>>    BIG-REQUESTS
>>    Composite
>>    ...
>> What am I doing wrong?
>
> Not running a compositing window manager?  The transparency stuff is  
> all done by the window manager.  And it must be a window manager  
> that knows how to do that.  I.e. compiz, beryl or some such.


Please fix the NEWS accordingly.


*** Controlling the frame opacity.
The opacity of a frame can now be controlled by setting
the `alpha' frame parameter, on a compositing window manager
(e.g. Compiz, Beryl and Compiz Fusion) for the X Window System.
The alpha parameter ...


Seiji





^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-04 21:13         ` Juanma Barranquero
  2008-06-04 21:25           ` joakim
  2008-06-04 21:27           ` Juanma Barranquero
@ 2008-06-05  2:07           ` Stefan Monnier
  2008-06-05  3:25             ` Juanma Barranquero
  2 siblings, 1 reply; 26+ messages in thread
From: Stefan Monnier @ 2008-06-05  2:07 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: joakim, emacs-devel

>  - What does mean "The meaningful PARAMETERs depend on the kind of
> window." Which parameters are meaningul, and for which windows?

Just remove that.  We do not document those things at those places.
E.g. we do not document the list of special text-properties in the
set-text-property functions.

>  - It is wise to return (in `window-parameter' and
> `set-window-parameter') directly the parameter alist, instead of a
> copy of it?

It's probably OK for window-parameters to return the alist itself, tho
a copy-alist wouldn't hurt.

OTOH I did miss the fact that window-parameter returns the cons-cell
rather than just the value of the parameter.  This is an error.

Also I think that set-window-parameter should not return the alist, but
the value just set (i.e. `val').


        Stefan




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Adding parameters to windows
  2008-06-05  2:07           ` Stefan Monnier
@ 2008-06-05  3:25             ` Juanma Barranquero
  0 siblings, 0 replies; 26+ messages in thread
From: Juanma Barranquero @ 2008-06-05  3:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: joakim, emacs-devel

> Just remove that.

OK.

> It's probably OK for window-parameters to return the alist itself, tho
> a copy-alist wouldn't hurt.

I've done that.

> OTOH I did miss the fact that window-parameter returns the cons-cell
> rather than just the value of the parameter.  This is an error.

Oops. Fixed.

> Also I think that set-window-parameter should not return the alist, but
> the value just set (i.e. `val').

OK, done too.

   Juanma




^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2008-06-05  3:25 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-16 23:37 Adding parameters to windows Seiji Zenitani
2008-05-20  1:17 ` Stefan Monnier
2008-06-03  9:04   ` Seiji Zenitani
2008-06-03 17:38     ` Glenn Morris
2008-06-04  6:46       ` Jan Djärv
2008-06-04  7:08         ` Glenn Morris
2008-06-04  9:10           ` Miles Bader
2008-06-05  1:45         ` Seiji Zenitani
  -- strict thread matches above, loose matches on Subject: below --
2008-05-15 17:51 Stefan Monnier
2008-05-23 14:10 ` joakim
2008-05-23 19:47   ` Stefan Monnier
2008-05-23 20:28     ` joakim
2008-06-04 11:01     ` joakim
2008-06-04 11:18       ` David Kastrup
2008-06-04 11:24         ` joakim
2008-06-04 11:46           ` David Kastrup
2008-06-04 15:10       ` Stefan Monnier
2008-06-04 15:58         ` joakim
2008-06-04 17:24           ` Stefan Monnier
2008-06-04 21:13         ` Juanma Barranquero
2008-06-04 21:25           ` joakim
2008-06-04 21:56             ` Juanma Barranquero
2008-06-04 22:05               ` joakim
2008-06-04 21:27           ` Juanma Barranquero
2008-06-05  2:07           ` Stefan Monnier
2008-06-05  3:25             ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).