emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] adding maximize to fullscreen frame parameters


From: Ivan Kanis
Subject: [PATCH] adding maximize to fullscreen frame parameters
Date: Sat, 23 Aug 2008 10:03:14 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Tom Tromey <address@hidden> writes:

> I think it would be better to have 'fullboth mean "full screen", and
> then add a new parameter value, 'maximize, that means maximize.
> My reasoning is that really only one of these settings makes sense at
> a time, and both are useful.

This patch against CVS HEAD is based on Tom's proposition. Sorry if
it's repost, I am not sure the fist made it made it to the
newsgroup. I will gladly write the changelog if someone plans to
commit it.

Here is the bit of lisp code I used to test it:

(local-set-key (read-kbd-macro "C-j") 'eval-last-sexp)

(set-frame-parameter nil 'fullscreen 'fullheight)
(set-frame-parameter nil 'fullscreen 'fullwidth)
(set-frame-parameter nil 'fullscreen 'fullboth)
(set-frame-parameter nil 'fullscreen 'maximize)
(set-frame-parameter nil 'fullscreen 'nil)

(frame-parameter nil 'fullscreen)

diff -r 7a34490312a4 -r 1a456119134e doc/emacs/xresources.texi
--- a/doc/emacs/xresources.texi Thu Aug 21 08:23:02 2008 +0200
+++ b/doc/emacs/xresources.texi Thu Aug 21 14:51:16 2008 +0200
@@ -237,8 +237,8 @@
 @ifnottex
 @item @code{fullscreen} (class @code{Fullscreen})
 The desired fullscreen size.  The value can be one of @code{fullboth},
address@hidden or @code{fullheight}, which correspond to
-the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh}
address@hidden, @code{fullwidth} or @code{maximize} which correspond to
+the command-line options @samp{-fs}, @samp{-fh} , @samp{-fw} and @samp{-fm}
 (@pxref{Window Size X}).
 
 Note that this applies to the initial frame only.
diff -r 7a34490312a4 -r 1a456119134e doc/lispref/frames.texi
--- a/doc/lispref/frames.texi   Thu Aug 21 08:23:02 2008 +0200
+++ b/doc/lispref/frames.texi   Thu Aug 21 14:51:16 2008 +0200
@@ -481,8 +481,11 @@
 Specify that width, height or both shall be set to the size of the screen.
 The value @code{fullwidth} specifies that width shall be the size of the
 screen.  The value @code{fullheight} specifies that height shall be the
-size of the screen.  The value @code{fullboth} specifies that both the
-width and the height shall be set to the size of the screen.
+size of the screen.  The value @code{maximize} specifies that both the
+width and the height shall be set to the size of the screen. The value
address@hidden toggles fullscreen mode, all windows decoration are hidden
+such as title bar and border. The desktop taskbar is also hidden so it
+looks like emacs is running on a console.
 @end table
 
 @node Layout Parameters
diff -r 7a34490312a4 -r 1a456119134e doc/man/emacs.1
--- a/doc/man/emacs.1   Thu Aug 21 08:23:02 2008 +0200
+++ b/doc/man/emacs.1   Thu Aug 21 14:51:16 2008 +0200
@@ -443,11 +443,12 @@
 The desired fullscreen size.
 The value can be one of
 .IR fullboth ,
+.IR fullheight ,
 .IR fullwidth ,
 or
-.IR fullheight ,
-which correspond to the command-line options `\-fs', `\-fw', and
-`\-fh', respectively.
+.IR maximize ,
+which correspond to the command-line options `\-fs', `\-fh',
+`\-fw', and, `\-fm' respectively.
 Note that this applies to the initial frame only.
 .TP
 .BR geometry " (class " Geometry )
diff -r 7a34490312a4 -r 1a456119134e lisp/startup.el
--- a/lisp/startup.el   Thu Aug 21 08:23:02 2008 +0200
+++ b/lisp/startup.el   Thu Aug 21 14:51:16 2008 +0200
@@ -134,6 +134,7 @@
     ("-fs" 0 x-handle-initial-switch fullscreen fullboth)
     ("-fw" 0 x-handle-initial-switch fullscreen fullwidth)
     ("-fh" 0 x-handle-initial-switch fullscreen fullheight)
+    ("-fm" 0 x-handle-initial-switch fullscreen maximize)
     ("-ib" 1 x-handle-numeric-switch internal-border-width)
     ("-g" 1 x-handle-geometry)
     ("-lsp" 1 x-handle-numeric-switch line-spacing)
@@ -159,6 +160,7 @@
     ("--fullscreen" 0 x-handle-initial-switch fullscreen fullboth)
     ("--fullwidth" 0 x-handle-initial-switch fullscreen fullwidth)
     ("--fullheight" 0 x-handle-initial-switch fullscreen fullheight)
+    ("--fullmax" 0 x-handle-initial-switch fullscreen maximize)
     ("--internal-border" 1 x-handle-numeric-switch internal-border-width)
     ("--geometry" 1 x-handle-geometry)
     ("--foreground-color" 1 x-handle-switch foreground-color)
diff -r 7a34490312a4 -r 1a456119134e src/frame.c
--- a/src/frame.c       Thu Aug 21 08:23:02 2008 +0200
+++ b/src/frame.c       Thu Aug 21 14:51:16 2008 +0200
@@ -120,7 +120,7 @@
 Lisp_Object Qtty_color_mode;
 Lisp_Object Qtty, Qtty_type;
 
-Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
+Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth, Qmaximize;
 Lisp_Object Qfont_backend;
 Lisp_Object Qalpha;
 
@@ -3262,6 +3262,8 @@
     f->want_fullscreen = FULLSCREEN_WIDTH;
   else if (EQ (new_value, Qfullheight))
     f->want_fullscreen = FULLSCREEN_HEIGHT;
+  else if (EQ (new_value, Qmaximize))
+    f->want_fullscreen = FULLSCREEN_MAXIMIZE;
 
   if (FRAME_TERMINAL (f)->fullscreen_hook != NULL)
     FRAME_TERMINAL (f)->fullscreen_hook (f);
@@ -4423,6 +4425,8 @@
   staticpro (&Qfullheight);
   Qfullboth = intern ("fullboth");
   staticpro (&Qfullboth);
+  Qmaximize = intern ("maximize");
+  staticpro (&Qmaximize);
   Qx_resource_name = intern ("x-resource-name");
   staticpro (&Qx_resource_name);
 
diff -r 7a34490312a4 -r 1a456119134e src/frame.h
--- a/src/frame.h       Thu Aug 21 08:23:02 2008 +0200
+++ b/src/frame.h       Thu Aug 21 14:51:16 2008 +0200
@@ -75,12 +75,12 @@
 
 enum fullscreen_type
 {
-  /* Values used as a bit mask, BOTH == WIDTH | HEIGHT.  */
-  FULLSCREEN_NONE       = 0,
-  FULLSCREEN_WIDTH      = 1,
-  FULLSCREEN_HEIGHT     = 2,
-  FULLSCREEN_BOTH       = 3,
-  FULLSCREEN_WAIT       = 4
+  FULLSCREEN_NONE       = 0x0,
+  FULLSCREEN_WIDTH      = 0x1,
+  FULLSCREEN_HEIGHT     = 0x2,
+  FULLSCREEN_BOTH       = 0x4,
+  FULLSCREEN_WAIT       = 0x8,
+  FULLSCREEN_MAXIMIZE   = 0x10
 };
 
 
diff -r 7a34490312a4 -r 1a456119134e src/xterm.c
--- a/src/xterm.c       Thu Aug 21 08:23:02 2008 +0200
+++ b/src/xterm.c       Thu Aug 21 14:51:16 2008 +0200
@@ -8580,9 +8580,10 @@
           break;
         }
 
-      if (what != NULL && !wm_supports (f, what)) return 0;
-
-
+      /* Only remove element when setting to none so that maxmize
+         works properley */
+      if (f->want_fullscreen == FULLSCREEN_NONE)
+        {
       Fx_send_client_event (frame, make_number (0), frame,
                             make_unibyte_string (atom, strlen (atom)),
                             make_number (32),
@@ -8607,6 +8608,10 @@
                                    (make_unibyte_string (fw,
                                                          strlen (fw)),
                                     Qnil)));
+        }
+
+      if (what != NULL && !wm_supports (f, what)) return 0;
+
       f->want_fullscreen = FULLSCREEN_NONE;
       if (what != NULL)
         Fx_send_client_event (frame, make_number (0), frame,
@@ -8626,7 +8631,15 @@
 XTfullscreen_hook (f)
      FRAME_PTR f;
 {
-  if (f->async_visible)
+  /* Maximise in X is full height plus full width */
+  if (f->want_fullscreen == FULLSCREEN_MAXIMIZE)
+    {
+      f->want_fullscreen = FULLSCREEN_HEIGHT;
+      XTfullscreen_hook(f);
+      f->want_fullscreen = FULLSCREEN_WIDTH;
+      XTfullscreen_hook(f);
+    }
+  else if (f->async_visible)
     {
       BLOCK_INPUT;
       do_ewmh_fullscreen (f);
Take care,
-- 
Ivan
http://kanis.fr

I often quote myself; it adds spice to my conversation.
    -- George Bernard Shaw 

reply via email to

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