Fix parallel "make install" on MS-Windows.
[bpt/emacs.git] / src / widget.c
index d4fb341..0cb1013 100644 (file)
@@ -1,6 +1,5 @@
 /* The emacs frame widget.
-   Copyright (C) 1992, 1993, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010, 2011  Free Software Foundation, Inc.
+   Copyright (C) 1992-1993, 2000-2012  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -79,7 +78,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 static void EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2);
 static void EmacsFrameDestroy (Widget widget);
 static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs);
-void EmacsFrameResize (Widget widget);
+static void EmacsFrameResize (Widget widget);
 static Boolean EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2);
 static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result);
 
@@ -87,12 +86,12 @@ static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry
 #undef XtOffset
 #define XtOffset(p_type,field) \
        ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0)))
-#define offset(field) XtOffset(EmacsFrame, emacs_frame.field)
+#define offset(field) XtOffset (EmacsFrame, emacs_frame.field)
 
 static XtResource resources[] = {
-  {XtNgeometry, XtCGeometry, XtRString, sizeof(String),
+  {XtNgeometry, XtCGeometry, XtRString, sizeof (String),
      offset (geometry), XtRString, (XtPointer) 0},
-  {XtNiconic, XtCIconic, XtRBoolean, sizeof(Boolean),
+  {XtNiconic, XtCIconic, XtRBoolean, sizeof (Boolean),
      offset (iconic), XtRImmediate, (XtPointer) False},
 
   {XtNemacsFrame, XtCEmacsFrame, XtRPointer, sizeof (XtPointer),
@@ -106,12 +105,12 @@ static XtResource resources[] = {
      offset (internal_border_width), XtRImmediate, (XtPointer)4},
   {XtNinterline, XtCInterline, XtRInt, sizeof (int),
      offset (interline), XtRImmediate, (XtPointer)0},
-  {XtNfont,  XtCFont, XtRFontStruct, sizeof(struct font *),
-     offset(font),XtRString, DEFAULT_FACE_FONT},
-  {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
-     offset(foreground_pixel), XtRString, "XtDefaultForeground"},
-  {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel),
-     offset(cursor_color), XtRString, "XtDefaultForeground"},
+  {XtNfont,  XtCFont, XtRFontStruct, sizeof (struct font *),
+     offset (font),XtRString, DEFAULT_FACE_FONT},
+  {XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel),
+     offset (foreground_pixel), XtRString, "XtDefaultForeground"},
+  {XtNcursorColor, XtCForeground, XtRPixel, sizeof (Pixel),
+     offset (cursor_color), XtRString, "XtDefaultForeground"},
   {XtNbarCursor, XtCBarCursor, XtRBoolean, sizeof (Boolean),
      offset (bar_cursor), XtRImmediate, (XtPointer)0},
   {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof (Boolean),
@@ -138,11 +137,11 @@ emacsFrameTranslations [] = "\
 ";
 */
 
-EmacsFrameClassRec emacsFrameClassRec = {
+static EmacsFrameClassRec emacsFrameClassRec = {
     { /* core fields */
     /* superclass              */      &widgetClassRec,
     /* class_name              */      "EmacsFrame",
-    /* widget_size             */      sizeof(EmacsFrameRec),
+    /* widget_size             */      sizeof (EmacsFrameRec),
     /* class_initialize                */      0,
     /* class_part_initialize   */      0,
     /* class_inited            */      FALSE,
@@ -152,7 +151,7 @@ EmacsFrameClassRec emacsFrameClassRec = {
     /* actions                 */      0, /*emacsFrameActionsTable*/
     /* num_actions             */      0, /*XtNumber (emacsFrameActionsTable)*/
     /* resources               */      resources,
-    /* resource_count          */      XtNumber(resources),
+    /* resource_count          */      XtNumber (resources),
     /* xrm_class               */      NULLQUARK,
     /* compress_motion         */      TRUE,
     /* compress_exposure       */      TRUE,
@@ -225,8 +224,7 @@ get_wm_shell (Widget w)
 #if 0 /* Currently not used.  */
 
 static void
-mark_shell_size_user_specified (wmshell)
-     Widget wmshell;
+mark_shell_size_user_specified (Widget wmshell)
 {
   if (! XtIsWMShell (wmshell)) abort ();
   /* This is kind of sleazy, but I can't see how else to tell it to make it
@@ -464,10 +462,6 @@ set_frame_size (EmacsFrame ew)
   }
 }
 
-/* Nonzero tells update_wm_hints not to do anything
-   (the caller should call update_wm_hints explicitly later.)  */
-int update_hints_inhibit;
-
 static void
 update_wm_hints (EmacsFrame ew)
 {
@@ -482,8 +476,8 @@ update_wm_hints (EmacsFrame ew)
   int base_height;
   int min_rows = 0, min_cols = 0;
 
-  if (update_hints_inhibit)
-    return;
+  /* This happens when the frame is just created.  */
+  if (! wmshell) return;
 
 #if 0
   check_frame_size (ew->emacs_frame.frame, &min_rows, &min_cols);
@@ -515,23 +509,27 @@ update_wm_hints (EmacsFrame ew)
                 NULL);
 }
 
+void
+widget_update_wm_size_hints (Widget widget)
+{
+  EmacsFrame ew = (EmacsFrame)widget;
+  update_wm_hints (ew);
+}
+
+
 #if 0
 
 static void
-create_frame_gcs (ew)
-     EmacsFrame ew;
+create_frame_gcs (EmacsFrame ew)
 {
   struct frame *s = ew->emacs_frame.frame;
 
   s->output_data.x->normal_gc
-    = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)),
-                (unsigned long)0, (XGCValues *)0);
+    = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
   s->output_data.x->reverse_gc
-    = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)),
-                (unsigned long)0, (XGCValues *)0);
+    = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
   s->output_data.x->cursor_gc
-    = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)),
-                (unsigned long)0, (XGCValues *)0);
+    = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
   s->output_data.x->black_relief.gc = 0;
   s->output_data.x->white_relief.gc = 0;
 }
@@ -561,7 +559,7 @@ setup_frame_gcs (EmacsFrame ew)
   if (STRINGP (font))
     {
       XFontStruct *xfont = XLoadQueryFont (FRAME_X_DISPLAY_INFO (s)->display,
-                                          SDATA (font));
+                                          SSDATA (font));
       if (xfont)
        {
          gc_values.font = xfont->fid;
@@ -587,11 +585,10 @@ setup_frame_gcs (EmacsFrame ew)
      never actually get used as a background tile!
    */
   blank_tile
-    = XCreatePixmapFromBitmapData (XtDisplay(ew),
+    = XCreatePixmapFromBitmapData (XtDisplay (ew),
                                   RootWindowOfScreen (XtScreen (ew)),
                                   setup_frame_cursor_bits, 2, 2,
-                                  (unsigned long)0, (unsigned long)1,
-                                  ew->core.depth);
+                                  0, 1, ew->core.depth);
 
   /* Normal video */
   gc_values.foreground = ew->emacs_frame.foreground_pixel;
@@ -704,7 +701,7 @@ EmacsFrameDestroy (Widget widget)
   UNBLOCK_INPUT;
 }
 
-void
+static void
 EmacsFrameResize (Widget widget)
 {
   EmacsFrame ew = (EmacsFrame)widget;
@@ -822,7 +819,7 @@ EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeome
   return result->request_mode ? XtGeometryAlmost : XtGeometryYes;
 }
 
-/* Special entrypoints */
+/* Special entry points */
 void
 EmacsFrameSetCharSize (Widget widget, int columns, int rows)
 {
@@ -841,6 +838,3 @@ widget_store_internal_border (Widget widget)
 
   ew->emacs_frame.internal_border_width = f->internal_border_width;
 }
-
-/* arch-tag: 931d28e5-0d59-405a-8325-7d475d0a13d9
-   (do not change this comment) */