(Qforeground_color, Qbackground_color): Declare.
[bpt/emacs.git] / src / widget.c
index c96405e..b7d1754 100644 (file)
@@ -20,12 +20,23 @@ Boston, MA 02111-1307, USA.  */
 
 /* Emacs 19 face widget ported by Fred Pierresteguy */
 
+/* This file has been censored by the Communications Decency Act.
+   That law was passed under the guise of a ban on pornography, but
+   it bans far more than that.  This file did not contain pornography,
+   but it was censored nonetheless.
+
+   For information on US government censorship of the Internet, and
+   what you can do to bring back freedom of the press, see the web
+   site http://www.vtw.org/
+   */
+
 #include <config.h>
 #include <stdio.h>
 #include "lisp.h"
 #include "xterm.h"
 
 #include "frame.h"
+#include "window.h"
 
 #include "dispextern.h"
 #include "blockinput.h"
@@ -183,8 +194,8 @@ pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height)
      int* char_height;
 {
   struct frame* f = ew->emacs_frame.frame;
-  *char_width = PIXEL_TO_CHAR_WIDTH (f, pixel_width);
-  *char_height = PIXEL_TO_CHAR_HEIGHT (f, pixel_height);
+  *char_width = PIXEL_TO_CHAR_WIDTH (f, (int) pixel_width);
+  *char_height = PIXEL_TO_CHAR_HEIGHT (f, (int) pixel_height);
 }
 
 static void
@@ -632,7 +643,7 @@ update_various_frame_slots (ew)
      EmacsFrame ew;
 {
   struct x_output *x = ew->emacs_frame.frame->output_data.x;
-  x->pixel_height = ew->core.height;
+  x->pixel_height = ew->core.height + x->menubar_height;
   x->pixel_width = ew->core.width;
   x->internal_border_width = ew->emacs_frame.internal_border_width;
 
@@ -643,7 +654,7 @@ update_from_various_frame_slots (ew)
      EmacsFrame ew;
 {
   struct x_output *x = ew->emacs_frame.frame->output_data.x;
-  ew->core.height = x->pixel_height;
+  ew->core.height = x->pixel_height - x->menubar_height;
   ew->core.width = x->pixel_width;
   ew->core.background_pixel = x->background_pixel;
   ew->emacs_frame.internal_border_width = x->internal_border_width;
@@ -722,13 +733,8 @@ EmacsFrameRealize (widget, mask, attrs)
 {
   EmacsFrame ew = (EmacsFrame)widget;
 
-  attrs->event_mask = (KeyPressMask | ExposureMask | ButtonPressMask |
-                      ButtonReleaseMask | StructureNotifyMask |
-                      FocusChangeMask | PointerMotionHintMask |
-                      PointerMotionMask | LeaveWindowMask | EnterWindowMask |
-                      VisibilityChangeMask | PropertyChangeMask |
-                      StructureNotifyMask | SubstructureNotifyMask |
-                      SubstructureRedirectMask);
+  attrs->event_mask = (STANDARD_EVENT_SET | PropertyChangeMask
+                      | SubstructureNotifyMask | SubstructureRedirectMask);
   *mask |= CWEventMask;
   XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,
                  attrs);
@@ -771,9 +777,11 @@ EmacsFrameResize (widget)
   int rows;
 
   pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows);
-  change_frame_size (f, rows, columns, 1, 0);
+  change_frame_size (f, rows, columns, 0, 1);
   update_wm_hints (ew); 
   update_various_frame_slots (ew);
+
+  cancel_mouse_face (f);
 }
 
 static Boolean
@@ -839,9 +847,9 @@ EmacsFrameSetValues (cur_widget, req_widget, new_widget, dum1, dum2)
   /* #### This doesn't work, I haven't been able to find ANY kludge that
      will let (x-create-frame '((iconic . t))) work.  It seems that changes
      to wm_shell's iconic slot have no effect after it has been realized,
-     and calling XIconifyWindow doesn't work either (even thought the window
+     and calling XIconifyWindow doesn't work either (even though the window
      has been created.)  Perhaps there is some property we could smash
-     directly, but I'm sick of this for now.  Xt is a steaming pile of shit!
+     directly, but I'm sick of this for now.
    */
   if (cur->emacs_frame.iconic != new->emacs_frame.iconic)
     {
@@ -946,6 +954,8 @@ EmacsFrameSetCharSize (widget, columns, rows)
       update_hints_inhibit = 0;
       update_wm_hints (ew);
 
+      do_pending_window_change ();
+
       /* These seem to get clobbered.  I don't know why. - rms.  */
       f->output_data.x->widget->core.x = old_left;
       f->output_data.x->widget->core.y = old_top;
@@ -957,3 +967,14 @@ EmacsFrameSetCharSize (widget, columns, rows)
      we have to make sure to do it here.  */
   SET_FRAME_GARBAGED (f);
 }
+\f
+void
+widget_store_internal_border (widget)
+     Widget widget;
+{
+  EmacsFrame ew = (EmacsFrame) widget;
+  FRAME_PTR f = ew->emacs_frame.frame;
+
+  ew->emacs_frame.internal_border_width
+    = f->output_data.x->internal_border_width;
+}