emacs-devel
[Top][All Lists]
Advanced

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

Re: Fullscreen patch.


From: Jan D.
Subject: Re: Fullscreen patch.
Date: Sun, 06 Jan 2002 22:48:25 +0100

Hello.

Here is the second version of the fullscreen patch.  I've reworked it to
address the comments on the previous version, and changed how a move is done
after a window has been mapped.

        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  Sun Jan  6 12:55:03 2002
***************
*** 110,115 ****
--- 110,131 ----
                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     Sun Jan  6 12:55:03 2002
***************
*** 196,201 ****
--- 196,204 ----
      ("-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,224 ****
--- 222,230 ----
      ("--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    Sun Jan  6 17:26:36 2002
***************
*** 64,69 ****
--- 64,70 ----
  * 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,856 ****
--- 852,897 ----
    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.
+ 
+ @node Fullscreen X
+ @appendixsec Options for Fullsize Window
+ @cindex 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.
+ 
+ @table @samp
+ @item -fs
+ @opindex -fs
+ @itemx --fullscreen
+ @opindex --fullscreen
+ @cindex fullscreen, command-line argument
+ Specify that width and height shall be the size of the screen.
+ 
+ @item -fh
+ @opindex -fh
+ @itemx --fullheight
+ @opindex --fullheight
+ @cindex fullheight, command-line argument
+ Specify that the height shall be the height of the screen.
+ 
+ @item -fw
+ @opindex -fw
+ @itemx --fullwidth
+ @opindex --fullwidth
+ @cindex fullwidth, command-line argument
+ Specify that the width shall be the width of the screen.
+ @end 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-specified 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 Sun Jan  6 12:55:03 2002
***************
*** 172,177 ****
--- 172,186 ----
  name, only that frame).  However, the size, if specified here, applies to
  all frames.
  
+ @item @code{fullscreen} (class @code{Fullscreen})
+ Specify wanted fullscreen size.  The value can be one of @code{fullboth},
+ @code{fullwidth} or @code{fullheight}, that each corresponds to
+ the command line options @code{-fs}, @code{-fw} and @code{-fh}
+ @pxref{Fullscreen 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 Sun Jan  6 22:09:31 2002
***************
*** 490,495 ****
--- 490,497 ----
                                            enum scroll_bar_part *,
                                            Lisp_Object *, Lisp_Object *,
                                            unsigned long *));
+ static void x_check_fullscreen P_ ((struct frame *));
+ static void x_check_fullscreen_move P_ ((struct frame *));
  
  /* Flush display of frame F, or of all frames if F is null.  */
  
***************
*** 10243,10248 ****
--- 10245,10252 ----
              f = x_window_to_frame (dpyinfo, event.xexpose.window);
              if (f)
                {
+                   x_check_fullscreen (f);
+ 
                  if (f->async_visible == 0)
                    {
                      f->async_visible = 1;
***************
*** 10844,10852 ****
--- 10848,10865 ----
              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
***************
*** 10874,10879 ****
--- 10887,10896 ----
                  x_real_positions (f, &f->output_data.x->left_pos,
                                    &f->output_data.x->top_pos);
  
+                   x_check_fullscreen_move(f);
+                   if (f->output_data.x->want_fullscreen & FULLSCREEN_WAIT)
+                     f->output_data.x->want_fullscreen &=
+                       ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
  #ifdef HAVE_X_I18N
                  if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea))
                    xic_set_statusarea (f);
***************
*** 12641,12646 ****
--- 12658,12771 ----
               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.
+          If the frame is visible already, the position is checked by
+          x_check_fullscreen_move. */
+       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;
+           
+         }
+     }
+ }
+ 
+ /* If frame parameters are set after the frame is mapped, we need to move
+    the window.  This is done in xfns.c.
+    Some window managers moves the window to the right position, some
+    moves the outer window manager window to the specified position.
+    Here we check that we are in the right spot.  If not, make a second
+    move, assuming we are dealing with the second kind of window manager. */
+ static void
+ x_check_fullscreen_move (f)
+      struct frame *f;
+ {
+   if (f->output_data.x->want_fullscreen & FULLSCREEN_MOVE_WAIT)
+   {
+     int expect_top = f->output_data.x->top_pos;
+     int expect_left = f->output_data.x->left_pos;
+ 
+     if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT)
+       expect_top = 0;
+     if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH)
+       expect_left = 0;
+     
+     if (expect_top != f->output_data.x->top_pos
+         || expect_left != f->output_data.x->left_pos)
+       x_set_offset (f, expect_left, expect_top, 1);
+ 
+     /* Just do this once */
+     f->output_data.x->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
+   }
+ }
+ 
+ 
+ /* 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  Sun Jan  6 21:30:52 2002
***************
*** 219,224 ****
--- 219,228 ----
  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,738 ****
--- 737,743 ----
  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,811 ****
    {"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}
  };
  
  /* Attach the `x-frame-parameter' properties to
--- 810,818 ----
    {"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},
!   {"fullscreen",                x_set_fullscreen},
!   
  };
  
  /* Attach the `x-frame-parameter' properties to
***************
*** 821,826 ****
--- 828,855 ----
          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 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;
+ 
+       f->output_data.x->want_fullscreen |= FULLSCREEN_MOVE_WAIT;
+       x_set_offset (f, move_x, move_y, 1);
+     }
+ }
+ 
  /* 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.
***************
*** 900,905 ****
--- 929,935 ----
       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,914 ****
        val = values[p];
        if (EQ (prop, Qforeground_color)
          || EQ (prop, Qbackground_color)
!         || EQ (prop, Qfont))
        {
          register Lisp_Object param_index, old_value;
  
--- 938,945 ----
        val = values[p];
        if (EQ (prop, Qforeground_color)
          || EQ (prop, Qbackground_color)
!         || EQ (prop, Qfont)
!           || EQ (prop, Qfullscreen))
        {
          register Lisp_Object param_index, old_value;
  
***************
*** 949,955 ****
        icon_left = val;
        else if (EQ (prop, Qforeground_color)
               || EQ (prop, Qbackground_color)
!              || EQ (prop, Qfont))
        /* Processed above.  */
        continue;
        else
--- 980,987 ----
        icon_left = val;
        else if (EQ (prop, Qforeground_color)
               || EQ (prop, Qbackground_color)
!              || EQ (prop, Qfont)
!                || EQ (prop, Qfullscreen))
        /* Processed above.  */
        continue;
        else
***************
*** 1002,1007 ****
--- 1034,1048 ----
        XSETINT (icon_top, 0);
      }
  
+   /* Adjust for fullscreen */
+   if (FRAME_VISIBLE_P (f))
+     {
+       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,1173 ****
       FRAME_PTR f;
       int *xptr, *yptr;
  {
!   int win_x, win_y;
!   Window child;
  
!   /* This is pretty gross, but seems to be the easiest way out of
!      the problem that arises when restarting window-managers.  */
  
! #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;
  
!   while (1)
      {
!       int count = x_catch_errors (FRAME_X_DISPLAY (f));
!       Window outer_window;
  
!       XQueryTree (FRAME_X_DISPLAY (f), outer, &tmp_root_window,
!                 &f->output_data.x->parent_desc,
!                 &tmp_children, &tmp_nchildren);
        XFree ((char *) tmp_children);
  
!       win_x = win_y = 0;
  
!       /* 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;
  
        XTranslateCoordinates (FRAME_X_DISPLAY (f),
  
                             /* From-window, to-window.  */
-                            outer_window,
                             FRAME_X_DISPLAY_INFO (f)->root_window,
  
                             /* From-position, to-position.  */
!                            0, 0, &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)))
        {
!         x_uncatch_errors (FRAME_X_DISPLAY (f), count);
!         break;
        }
  
!       x_uncatch_errors (FRAME_X_DISPLAY (f), count);
      }
  
!   *xptr = win_x;
!   *yptr = win_y;
  }
  
  /* Insert a description of internally-recorded parameters of frame X
--- 1145,1253 ----
       FRAME_PTR f;
       int *xptr, *yptr;
  {
!   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;
  
!   int count;
  
!   BLOCK_INPUT;
! 
!   count = x_catch_errors (FRAME_X_DISPLAY (f));
    
!   if (win == FRAME_X_DISPLAY_INFO (f)->root_window)
!     win = FRAME_OUTER_WINDOW (f);
! 
!   /* This loop traverses up the containment tree until we hit the root
!      window.  Window managers may intersect many windows between our window
!      and the root window.  The window we find just before the root window
!      should be the outer WM window. */
!   for (;;)
      {
!       Window wm_window, rootw;
!       Window *tmp_children;
!       unsigned int tmp_nchildren;
  
!       XQueryTree (FRAME_X_DISPLAY (f), win, &rootw,
!                   &wm_window, &tmp_children, &tmp_nchildren);
        XFree ((char *) tmp_children);
  
!       had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
  
!       if (wm_window == rootw || had_errors)
!         break;
  
+       win = wm_window;
+     }
+     
+   if (! had_errors)
+     {
+       int ign;
+       Window child, rootw;
+           
+       /* Get the real coordinates for the WM window upper left corner */
+       XGetGeometry (FRAME_X_DISPLAY (f), win,
+                     &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
+ 
+       /* Translate real coordinates to coordinates relative to our
+          window.  For our window, the upper left corner is 0, 0.
+          Since the upper left corner of the WM window is outside
+          our window, win_x and win_y will be negative:
+ 
+          ------------------          ---> x
+          |      title                |
+          | -----------------         v y
+          | |  our window
+       */
        XTranslateCoordinates (FRAME_X_DISPLAY (f),
  
                             /* From-window, to-window.  */
                             FRAME_X_DISPLAY_INFO (f)->root_window,
+                              FRAME_X_WINDOW (f),
  
                             /* From-position, to-position.  */
!                              real_x, real_y, &win_x, &win_y,
  
                             /* Child of win.  */
                             &child);
  
!       if (FRAME_X_WINDOW (f) == FRAME_OUTER_WINDOW (f))
        {
!           outer_x = win_x;
!           outer_y = win_y;
        }
+       else
+         {
+           XTranslateCoordinates (FRAME_X_DISPLAY (f),
  
!                                  /* 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);
      }
  
!       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,1356 ****
--- 1431,1455 ----
  }
  
  
+ /* 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,3222 ****
--- 3316,3337 ----
        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,4418 ****
--- 4528,4535 ----
                       "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,11765 ****
--- 11877,11890 ----
    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 Sun Jan  6 21:00:21 2002
***************
*** 267,272 ****
--- 267,275 ----
  --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 wide as the screen\n\
+ --fullheight, -fh             make the first frame 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,1665 ****
--- 1663,1671 ----
    { "-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 Sun Jan  6 18:17:58 2002
***************
*** 594,599 ****
--- 594,630 ----
       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,
+   FULLSCREEN_MOVE_WAIT  = 8,
  };
  
  /* Return the X window used for displaying data in frame F.  */
***************
*** 601,607 ****
  
  /* 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))
  #else
  #define FRAME_OUTER_WINDOW(f) (FRAME_X_WINDOW (f))
  #endif
--- 632,640 ----
  
  /* Return the outermost X window associated with the frame F.  */
  #ifdef USE_X_TOOLKIT
! #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,997 ****
--- 1025,1034 ----
  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]