emacs-devel
[Top][All Lists]
Advanced

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

Fullscreen patch.


From: Jan D.
Subject: Fullscreen patch.
Date: Wed, 02 Jan 2002 02:56:58 +0100

Hello

I've attached a patch to give emacs fullscreen abilities.  The patch is against
CVS latest.  I've only tested it on GNU/Linux, and with the window managers in
the table below.  If this is run on sawfish, you need to make sure that "save
window positions" is not set AND remove ~/.sawfish/window-history AND restart
sawfish.  That feature is not ICCCM compliant.

Here's the documentation for it:
----
   An Emacs frame can be made to start with a size covering the entire
screen.  There are three options that control this.

`-fs'
`--fullscreen'
     Specify that width and height shall be the size of the screen.

`-fh'
`--fullheight'
     Specify that the height shall be the height of the screen.

`-fw'
`--fullwidth'
     Specify that the width shall be the width of the screen.

   There may be some space around the frame even if you do use these
options.  That is because Emacs rounds the sizes so they are an even
number of character heights and widths.

   These options only affect the first frame created.

   Some window managers have options that can make them ignore both
program and user specified positions (sawfish is one).  If these are
set, Emacs fails to position the window correctly.

---

`fullscreen' (class `Fullscreen')
     Specify wanted fullscreen size.  The value can be one of
     `fullwidth', `fullwidth' or `fullheight', that each corresponds to
     the command line options `-fs', `-fw' and `-fh' *note Fullscreen
     X::.

     Note that this applies to all frames created, not just the initial
     one.

---

Even if the whole patch doesn't make it, I think the patch for x_real_position
should go in.  The current version gave very different results depending on
window manager:

emacs started as emacs -g +123+234

no WM   123  234
fvwm95  128  256
fvwm    127  256
fvwm2   130  264
twm     125  236
mwm     133  262
sawfish 123  234
icewm   129  260
kde1    123  234
kde2    127  254

I can send this separatly if wanted.

        Jan D.
Index: lisp/term/x-win.el
--- lisp/term/x-win.el.orig     Sat Dec 29 19:52:00 2001
+++ lisp/term/x-win.el  Wed Jan  2 01:55:47 2002
@@ -110,6 +110,22 @@
                x-invocation-args
                (cdr x-invocation-args))))))
 
+;; Handle options that apply to initial frame only
+(defun x-handle-initial-switch (switch)
+  (let ((aelt (assoc switch command-line-x-option-alist)))
+    (if aelt
+       (let ((param (nth 3 aelt))
+             (value (nth 4 aelt)))
+         (if value
+             (setq initial-frame-alist
+                   (cons (cons param value)
+                         initial-frame-alist))
+           (setq initial-frame-alist
+                 (cons (cons param
+                             (car x-invocation-args))
+                       initial-frame-alist)
+                 x-invocation-args (cdr x-invocation-args)))))))
+
 ;; Make -iconic apply only to the initial frame!
 (defun x-handle-iconic (switch)
   (setq initial-frame-alist
Index: lisp/startup.el
--- lisp/startup.el.orig        Sat Dec 29 19:51:42 2001
+++ lisp/startup.el     Wed Jan  2 01:55:47 2002
@@ -196,6 +196,9 @@
     ("-reverse-video" 0 x-handle-switch reverse t)
     ("-fn" 1 x-handle-switch font)
     ("-font" 1 x-handle-switch font)
+    ("-fs" 0 x-handle-initial-switch fullscreen fullboth)
+    ("-fw" 0 x-handle-initial-switch fullscreen fullwidth)
+    ("-fh" 0 x-handle-initial-switch fullscreen fullheight)
     ("-ib" 1 x-handle-numeric-switch internal-border-width)
     ("-g" 1 x-handle-geometry)
     ("-lsp" 1 x-handle-numeric-switch line-spacing)
@@ -219,6 +222,9 @@
     ("--title" 1 x-handle-switch title)
     ("--reverse-video" 0 x-handle-switch reverse t)
     ("--font" 1 x-handle-switch font)
+    ("--fullscreen" 0 x-handle-initial-switch fullscreen fullboth)
+    ("--fullwidth" 0 x-handle-initial-switch fullscreen fullwidth)
+    ("--fullheight" 0 x-handle-initial-switch fullscreen fullheight)
     ("--internal-border" 1 x-handle-numeric-switch internal-border-width)
     ("--geometry" 1 x-handle-geometry)
     ("--foreground-color" 1 x-handle-switch foreground-color)
Index: man/cmdargs.texi
--- man/cmdargs.texi.orig       Thu Nov 22 20:36:36 2001
+++ man/cmdargs.texi    Wed Jan  2 01:55:47 2002
@@ -64,6 +64,7 @@
 * Font X::             Choosing a font for text, under X.
 * Colors X::           Choosing colors, under X.
 * Window Size X::       Start-up window size, under X.
+* Fullscreen X::        Choosing fullscreen start-up window size, under X.
 * Borders X::          Internal and external borders, under X.
 * Title X::             Specifying the initial frame's title.
 * Icons X::             Choosing what sort of icon to use, under X.
@@ -851,6 +852,46 @@
   You can specify a default for any or all of the fields in
 @file{.Xdefaults} file, and then override selected fields with a
 @samp{--geometry} option.
+
address@hidden Fullscreen X
address@hidden Options for Fullsize Window
address@hidden specifying fullscreen for Emacs frame
+
+ An Emacs frame can be made to start with a size covering the entire
+screen.  There are three options that control this.
+
address@hidden @samp
address@hidden -fs
address@hidden -fs
address@hidden --fullscreen
address@hidden --fullscreen
address@hidden fullscreen, command-line argument
+Specify that width and height shall be the size of the screen.
+
address@hidden -fh
address@hidden -fh
address@hidden --fullheight
address@hidden --fullheight
address@hidden fullheight, command-line argument
+Specify that the height shall be the height of the screen.
+
address@hidden -fw
address@hidden -fw
address@hidden --fullwidth
address@hidden --fullwidth
address@hidden fullwidth, command-line argument
+Specify that the width shall be the width of the screen.
address@hidden table
+
+ There may be some space around the frame even if you do use these
+options.  That is because Emacs rounds the sizes so they are an
+even number of character heights and widths.
+
+ These options only affect the first frame created.
+
+ Some window managers have options that can make them ignore both
+program and user specified positions (sawfish is one).  If these
+are set, Emacs fails to position the window correctly.
 
 @node Borders X
 @appendixsec Internal and External Borders
Index: man/xresources.texi
--- man/xresources.texi.orig    Wed Jan  2 02:00:24 2002
+++ man/xresources.texi Wed Jan  2 02:00:51 2002
@@ -172,6 +172,15 @@
 name, only that frame).  However, the size, if specified here, applies to
 all frames.
 
address@hidden @code{fullscreen} (class @code{Fullscreen})
+Specify wanted fullscreen size.  The value can be one of @code{fullwidth},
address@hidden or @code{fullheight}, that each corresponds to
+the command line options @code{-fs}, @code{-fw} and @code{-fh}
address@hidden X}.
+
+Note that this applies to all frames created, not just the initial
+one.
+
 @item @code{iconName} (class @code{Title})
 Name to display in the icon.
 
Index: src/xterm.c
--- src/xterm.c.orig    Sat Dec 29 19:52:07 2001
+++ src/xterm.c Wed Jan  2 01:55:47 2002
@@ -490,6 +490,7 @@
                                            enum scroll_bar_part *,
                                            Lisp_Object *, Lisp_Object *,
                                            unsigned long *));
+static void x_check_fullscreen P_ ((struct frame *));
 
 /* Flush display of frame F, or of all frames if F is null.  */
 
@@ -10243,12 +10244,15 @@
              f = x_window_to_frame (dpyinfo, event.xexpose.window);
              if (f)
                {
+                  x_check_fullscreen (f);
+
                  if (f->async_visible == 0)
                    {
                      f->async_visible = 1;
                      f->async_iconified = 0;
                      f->output_data.x->has_been_visible = 1;
                      SET_FRAME_GARBAGED (f);
+
                    }
                  else
                    expose_frame (x_window_to_frame (dpyinfo,
@@ -10844,14 +10848,24 @@
              f = x_top_window_to_frame (dpyinfo, event.xconfigure.window);
              if (f)
                {
+                  /* If there is a pending resize for fullscreen, don't
+                     do this one, the right one will come later.
+                    The toolkit version doesn't seem to need this, but we
+                    need to reset it below. */
+                  int dont_resize =
+                    (f->output_data.x->want_fullscreen == FULLSCREEN_WAIT &&
+                     FRAME_NEW_WIDTH (f) != 0);
 #ifndef USE_X_TOOLKIT
                  int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height);
                  int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width);
+                  if (dont_resize)
+                    goto OTHER;
                  
                  /* In the toolkit version, change_frame_size
                     is called by the code that handles resizing
                     of the EmacsFrame widget.  */
 
+                  
                  /* Even if the number of character rows and columns has
                     not changed, the font size may have changed, so we need
                     to check the pixel dimensions as well.  */
@@ -10866,6 +10880,9 @@
                    }
 #endif
 
+                  if (f->output_data.x->want_fullscreen == FULLSCREEN_WAIT)
+                    f->output_data.x->want_fullscreen = FULLSCREEN_NONE;
+
                  f->output_data.x->pixel_width = event.xconfigure.width;
                  f->output_data.x->pixel_height = event.xconfigure.height;
 
@@ -12641,6 +12658,85 @@
               modified_left, modified_top);
 #endif /* not USE_X_TOOLKIT */
   UNBLOCK_INPUT;
+}
+
+/* Check if we need to resize the frame due to a fullscreen request.
+   If so needed, resize the frame */
+static void
+x_check_fullscreen (f)
+     struct frame *f;
+{
+  if (f->output_data.x->want_fullscreen & FULLSCREEN_BOTH)
+    {
+      int width, height, ign;
+                      
+      x_real_positions (f, &f->output_data.x->left_pos,
+                        &f->output_data.x->top_pos);
+
+      x_fullscreen_adjust (f, &width, &height, &ign, &ign);
+                  
+      /* We do not need to move the window, it shall be taken care of
+         when setting WM manager hints.
+         This is just checked when the window is first mapped.
+      */
+      if (f->width != width || f->height != height)
+        {
+          change_frame_size (f, height, width, 0, 1, 0);
+          SET_FRAME_GARBAGED (f);
+          cancel_mouse_face (f);
+
+          /* Wait for the change of frame size to occur */
+          f->output_data.x->want_fullscreen = FULLSCREEN_WAIT;
+        }
+      else
+        f->output_data.x->want_fullscreen = FULLSCREEN_NONE;
+    }
+}
+
+/* Calculate fullscreen size. Return in *top_pos and *left_pos the
+   wanted positions of the WM window (not emacs window).
+   Return in *width and *height the wanted width and height of Emacs
+   window (FRAME_X_WINDOW).
+ */
+void
+x_fullscreen_adjust (f, width, height, top_pos, left_pos)
+     struct frame *f;
+     int *width;
+     int *height;
+     int *top_pos;
+     int *left_pos;
+{
+  int newwidth = f->width, newheight = f->height;
+
+  *top_pos = f->output_data.x->top_pos;
+  *left_pos = f->output_data.x->left_pos;
+  
+  if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT)
+    {
+      int ph;
+      
+      ph = FRAME_X_DISPLAY_INFO (f)->height;
+      newheight = PIXEL_TO_CHAR_HEIGHT (f, ph);
+      ph = CHAR_TO_PIXEL_HEIGHT (f, newheight) -
+        f->output_data.x->y_pixels_diff;
+      newheight = PIXEL_TO_CHAR_HEIGHT (f, ph);
+      *top_pos = 0;
+    }
+
+  if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH)
+    {
+      int pw;
+      
+      pw = FRAME_X_DISPLAY_INFO (f)->width;
+      newwidth = PIXEL_TO_CHAR_WIDTH (f, pw);
+      pw = CHAR_TO_PIXEL_WIDTH (f, newwidth) -
+        f->output_data.x->x_pixels_diff;
+      newwidth = PIXEL_TO_CHAR_WIDTH (f, pw);
+      *left_pos = 0;
+    }
+
+  *width = newwidth;
+  *height = newheight;
 }
 
 
Index: src/xfns.c
--- src/xfns.c.orig     Tue Jan  1 17:42:03 2002
+++ src/xfns.c  Wed Jan  2 01:59:09 2002
@@ -219,6 +219,10 @@
 Lisp_Object Qscreen_gamma, Qline_spacing, Qcenter;
 Lisp_Object Qcompound_text, Qcancel_timer;
 Lisp_Object Qwait_for_wm;
+Lisp_Object Qfullscreen;
+Lisp_Object Qfullwidth;
+Lisp_Object Qfullheight;
+Lisp_Object Qfullboth;
 
 /* The below are defined in frame.c.  */
 
@@ -733,6 +737,7 @@
 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
 static void x_set_wait_for_wm P_ ((struct frame *, Lisp_Object, Lisp_Object));
+static void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -805,7 +810,9 @@
   {"line-spacing",             x_set_line_spacing},
   {"left-fringe",              x_set_fringe_width},
   {"right-fringe",             x_set_fringe_width},
-  {"wait-for-wm",              x_set_wait_for_wm}
+  {"wait-for-wm",              x_set_wait_for_wm},
+  {"fullscreen",                x_set_fullscreen},
+  
 };
 
 /* Attach the `x-frame-parameter' properties to
@@ -821,6 +828,48 @@
          make_number (i));
 }
 
+
+/* Really try to move where we want to be in case of fullscreen.  Some WMs
+   moves the window where we tell them.  Some (mwm, twm) moves the outer
+   window manager window there instead.
+   Try to compensate for those WM here. */
+static void
+x_fullscreen_move (f, new_top, new_left)
+     struct frame *f;
+     int new_top;
+     int new_left;
+{
+  if (new_top != f->output_data.x->top_pos ||
+      new_left != f->output_data.x->left_pos)
+    {
+      int got_x, got_y;
+      int move_x = new_left + f->output_data.x->x_pixels_outer_diff;
+      int move_y = new_top + f->output_data.x->y_pixels_outer_diff;
+      int expect_x = new_left;
+      int expect_y = new_top;
+
+      if (new_top != f->output_data.x->top_pos) expect_y = 0;
+      if (new_left != f->output_data.x->left_pos) expect_x = 0;
+
+      BLOCK_INPUT;
+      
+      x_set_offset (f, move_x, move_y, 1);
+
+      XSync (FRAME_X_DISPLAY (f), False);
+
+      x_real_positions (f, &got_x, &got_y);
+
+      /* 5 is arbitrary.  There are some pixels lost to borders, a diff
+         of 2 pixels is common
+      */
+      if ((expect_x == 0 && abs (got_x-expect_x) > 5) ||
+          (expect_y == 0 && abs (got_y-expect_y) > 5))
+          x_set_offset (f, expect_x, expect_y, 1);
+
+      UNBLOCK_INPUT;
+    }
+}
+
 /* Change the parameters of frame F as specified by ALIST.
    If a parameter is not specially recognized, do nothing special;
    otherwise call the `x_set_...' function for that parameter.
@@ -851,6 +900,7 @@
   int i, p;
   int left_no_change = 0, top_no_change = 0;
   int icon_left_no_change = 0, icon_top_no_change = 0;
+  int old_fullscreen = f->output_data.x->want_fullscreen;
 
   struct gcpro gcpro1, gcpro2;
 
@@ -900,6 +950,7 @@
      They are independent of other properties, but other properties (e.g.,
      cursor_color) are dependent upon them.  */
   /* Process default font as well, since fringe widths depends on it.  */
+  /* Also, process fullscreen, width and height depend upon that */
   for (p = 0; p < i; p++) 
     {
       Lisp_Object prop, val;
@@ -908,7 +959,8 @@
       val = values[p];
       if (EQ (prop, Qforeground_color)
          || EQ (prop, Qbackground_color)
-         || EQ (prop, Qfont))
+         || EQ (prop, Qfont)
+          || EQ (prop, Qfullscreen))
        {
          register Lisp_Object param_index, old_value;
 
@@ -949,7 +1001,8 @@
        icon_left = val;
       else if (EQ (prop, Qforeground_color)
               || EQ (prop, Qbackground_color)
-              || EQ (prop, Qfont))
+              || EQ (prop, Qfont)
+               || EQ (prop, Qfullscreen))
        /* Processed above.  */
        continue;
       else
@@ -1002,6 +1055,16 @@
        XSETINT (icon_top, 0);
     }
 
+  /* Adjust for fullscreen */
+  if (FRAME_VISIBLE_P (f) &&
+      ! (f->output_data.x->want_fullscreen & old_fullscreen))
+    {
+      int new_left, new_top;
+      
+      x_fullscreen_adjust (f, &width, &height, &new_top, &new_left);
+      x_fullscreen_move (f, new_top, new_left);
+    }
+  
   /* Don't set these parameters unless they've been explicitly
      specified.  The window might be mapped or resized while we're in
      this function, and we don't want to override that unless the lisp
@@ -1104,70 +1167,94 @@
      FRAME_PTR f;
      int *xptr, *yptr;
 {
-  int win_x, win_y;
-  Window child;
+  int win_x, win_y, outer_x, outer_y;
+  int real_x = 0, real_y = 0;
+  int had_errors = 0;
+  Window win = f->output_data.x->parent_desc;
 
-  /* This is pretty gross, but seems to be the easiest way out of
-     the problem that arises when restarting window-managers.  */
+  int count;
 
-#ifdef USE_X_TOOLKIT
-  Window outer = (f->output_data.x->widget
-                 ? XtWindow (f->output_data.x->widget)
-                 : FRAME_X_WINDOW (f));
-#else
-  Window outer = f->output_data.x->window_desc;
-#endif
-  Window tmp_root_window;
-  Window *tmp_children;
-  unsigned int tmp_nchildren;
+  BLOCK_INPUT;
+
+  count = x_catch_errors (FRAME_X_DISPLAY (f));
+  
+  if (win == FRAME_X_DISPLAY_INFO (f)->root_window)
+    win = FRAME_OUTER_WINDOW (f);
 
-  while (1)
+  for (;;)
     {
-      int count = x_catch_errors (FRAME_X_DISPLAY (f));
-      Window outer_window;
+      Window wm_window, rootw;
+      Window *tmp_children;
+      unsigned int tmp_nchildren;
 
-      XQueryTree (FRAME_X_DISPLAY (f), outer, &tmp_root_window,
-                 &f->output_data.x->parent_desc,
-                 &tmp_children, &tmp_nchildren);
+      XQueryTree (FRAME_X_DISPLAY (f), win, &rootw,
+                  &wm_window, &tmp_children, &tmp_nchildren);
       XFree ((char *) tmp_children);
 
-      win_x = win_y = 0;
+      had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
 
-      /* Find the position of the outside upper-left corner of
-        the inner window, with respect to the outer window.  */
-      if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO 
(f)->root_window)
-       outer_window = f->output_data.x->parent_desc;
-      else
-       outer_window = outer;
+      if (wm_window == rootw || had_errors)
+        break;
+
+      win = wm_window;
+    }
+    
+  if (! had_errors)
+    {
+      int ign;
+      Window child, rootw;
+          
+      XGetGeometry (FRAME_X_DISPLAY (f), win,
+                    &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
 
       XTranslateCoordinates (FRAME_X_DISPLAY (f),
 
                             /* From-window, to-window.  */
-                            outer_window,
                             FRAME_X_DISPLAY_INFO (f)->root_window,
+                             FRAME_X_WINDOW (f),
 
                             /* From-position, to-position.  */
-                            0, 0, &win_x, &win_y,
+                             real_x, real_y, &win_x, &win_y,
 
                             /* Child of win.  */
                             &child);
 
-      /* It is possible for the window returned by the XQueryNotify
-        to become invalid by the time we call XTranslateCoordinates.
-        That can happen when you restart some window managers.
-        If so, we get an error in XTranslateCoordinates.
-        Detect that and try the whole thing over.  */
-      if (! x_had_errors_p (FRAME_X_DISPLAY (f)))
+      if (FRAME_X_WINDOW (f) == FRAME_OUTER_WINDOW (f))
        {
-         x_uncatch_errors (FRAME_X_DISPLAY (f), count);
-         break;
+          outer_x = win_x;
+          outer_y = win_y;
        }
+      else
+        {
+          XTranslateCoordinates (FRAME_X_DISPLAY (f),
 
-      x_uncatch_errors (FRAME_X_DISPLAY (f), count);
+                                 /* From-window, to-window.  */
+                                 FRAME_X_DISPLAY_INFO (f)->root_window,
+                                 FRAME_OUTER_WINDOW (f),
+                                     
+                                 /* From-position, to-position.  */
+                                 real_x, real_y, &outer_x, &outer_y,
+                         
+                                 /* Child of win.  */
+                                 &child);
     }
 
-  *xptr = win_x;
-  *yptr = win_y;
+      had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
+    }
+      
+  x_uncatch_errors (FRAME_X_DISPLAY (f), count);
+      
+  UNBLOCK_INPUT;
+
+  if (had_errors) return;
+      
+  f->output_data.x->x_pixels_diff = -win_x;
+  f->output_data.x->y_pixels_diff = -win_y;
+  f->output_data.x->x_pixels_outer_diff = -outer_x;
+  f->output_data.x->y_pixels_outer_diff = -outer_y;
+
+  *xptr = real_x;
+  *yptr = real_y;
 }
 
 /* Insert a description of internally-recorded parameters of frame X
@@ -1351,6 +1438,25 @@
 }
 
 
+/* Change the `fullscreen' frame parameter of frame F.  OLD_VALUE is
+   the previous value of that parameter, NEW_VALUE is the new value. */
+
+static void
+x_set_fullscreen (f, new_value, old_value)
+     struct frame *f;
+     Lisp_Object new_value, old_value;
+{
+  if (NILP (new_value))
+    f->output_data.x->want_fullscreen = FULLSCREEN_NONE;
+  else if (EQ (new_value, Qfullboth))
+    f->output_data.x->want_fullscreen = FULLSCREEN_BOTH;
+  else if (EQ (new_value, Qfullwidth))
+    f->output_data.x->want_fullscreen = FULLSCREEN_WIDTH;
+  else if (EQ (new_value, Qfullheight))
+    f->output_data.x->want_fullscreen = FULLSCREEN_HEIGHT;
+}
+
+
 /* Change the `screen-gamma' frame parameter of frame F.  OLD_VALUE is
    the previous value of that parameter, NEW_VALUE is the new
    value.  */
@@ -3217,6 +3323,22 @@
        window_prompting |= PPosition;
     }
 
+  if (f->output_data.x->want_fullscreen != FULLSCREEN_NONE)
+    {
+      int left, top;
+      int width, height;
+      
+      /* It takes both for some WM:s to place it where we want */
+      window_prompting = USPosition | PPosition;
+      x_fullscreen_adjust (f, &width, &height, &top, &left);
+      f->width = width;
+      f->height = height;
+      f->output_data.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
+      f->output_data.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
+      f->output_data.x->left_pos = left;
+      f->output_data.x->top_pos = top;
+    }
+  
   return window_prompting;
 }
 
@@ -4413,6 +4535,8 @@
                       "title", "Title", RES_TYPE_STRING);
   x_default_parameter (f, parms, Qwait_for_wm, Qt,
                       "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN);
+  x_default_parameter (f, parms, Qfullscreen, Qnil,
+                       "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
 
   f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
 
@@ -11760,6 +11884,14 @@
   staticpro (&Qcancel_timer);
   Qwait_for_wm = intern ("wait-for-wm");
   staticpro (&Qwait_for_wm);
+  Qfullscreen = intern ("fullscreen");
+  staticpro (&Qfullscreen);
+  Qfullwidth = intern ("fullwidth");
+  staticpro (&Qfullwidth);
+  Qfullheight = intern ("fullheight");
+  staticpro (&Qfullheight);
+  Qfullboth = intern ("fullboth");
+  staticpro (&Qfullboth);
   /* This is the end of symbol initialization.  */
 
   /* Text property `display' should be nonsticky by default.  */
Index: src/emacs.c
--- src/emacs.c.orig    Sat Dec 29 19:52:04 2001
+++ src/emacs.c Wed Jan  2 01:55:47 2002
@@ -267,6 +267,9 @@
 --display, -d DISPLAY          use X server DISPLAY\n\
 --font, -fn FONT               default font; must be fixed-width\n\
 --foreground-color, -fg COLOR  window foreground color\n\
+--fullscreen, -fs              make first frame fullscreen\n\
+--fullwidth, -fw               make the first frame be wide as the screen\n\
+--fullheight, -fh              make the first frame be high as the screen\n\
 --geometry, -g GEOMETRY                window geometry\n\
 --iconic                       start Emacs in iconified state\n\
 --icon-type, -i                        use picture of gnu for Emacs icon\n\
@@ -1660,6 +1663,9 @@
   { "-cr", "--cursor-color", 10, 1 },
   { "-fn", "--font", 10, 1 },
   { "-font", 0, 10, 1 },
+  { "-fs", "--fullscreen", 10, 0 },
+  { "-fw", "--fullwidth", 10, 0 },
+  { "-fh", "--fullheight", 10, 0 },
   { "-g", "--geometry", 10, 1 },
   { "-geometry", 0, 10, 1 },
   { "-T", "--title", 10, 1 },
Index: src/xterm.h
--- src/xterm.h.orig    Sat Dec  1 02:16:32 2001
+++ src/xterm.h Wed Jan  2 02:03:50 2002
@@ -594,6 +594,36 @@
      arrive for an unknown reason and Emacs hangs in Xt.  If this is
      zero, tell Xt not to wait.  */
   int wait_for_wm;
+
+  /* See enum below */
+  int want_fullscreen;
+
+  /* This many pixels are the difference between the outer window (i.e. the
+     left of the window manager decoration) and FRAME_X_WINDOW. */
+  int x_pixels_diff;
+
+  /* This many pixels are the difference between the outer window (i.e. the
+     top of the window manager titlebar) and FRAME_X_WINDOW. */
+  int y_pixels_diff;
+
+  /* As x_pixels_diff, but to FRAME_OUTER_WINDOW.  For some reason the
+   * two might differ by a pixel, depending on WM */
+  int x_pixels_outer_diff;
+  
+  /* As y_pixels_diff, but to FRAME_OUTER_WINDOW. In the toolkit version,
+     these may differ because this does not take into account possible
+     menubar.  y_pixels_diff is with menubar height included */
+  int y_pixels_outer_diff;
+};
+
+enum
+{
+  /* Values used as a bit mask, BOTH == WIDTH | HEIGH */
+  FULLSCREEN_NONE       = 0,
+  FULLSCREEN_WIDTH      = 1,
+  FULLSCREEN_HEIGHT     = 2,
+  FULLSCREEN_BOTH       = 3,
+  FULLSCREEN_WAIT       = 4
 };
 
 /* Return the X window used for displaying data in frame F.  */
@@ -601,7 +631,9 @@
 
 /* Return the outermost X window associated with the frame F.  */
 #ifdef USE_X_TOOLKIT
-#define FRAME_OUTER_WINDOW(f) (XtWindow ((f)->output_data.x->widget))
+#define FRAME_OUTER_WINDOW(f) ((f)->output_data.x->widget ?             \
+                               XtWindow ((f)->output_data.x->widget) :  \
+                               FRAME_X_WINDOW (f))
 #else
 #define FRAME_OUTER_WINDOW(f) (FRAME_X_WINDOW (f))
 #endif
@@ -992,6 +1024,10 @@
 extern void x_query_colors P_ ((struct frame *f, XColor *, int));
 extern void x_query_color P_ ((struct frame *f, XColor *));
 extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int));
+
+extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *,
+                                     int *, int *));
+
 
 /* Defined in xselect.c */
 

reply via email to

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