/[emacs]/emacs/src/xfns.c
ViewVC logotype

Diff of /emacs/src/xfns.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.549.2.1 by miles, Fri Apr 4 06:21:08 2003 UTC revision 1.549.2.2 by miles, Tue Oct 14 23:22:51 2003 UTC
# Line 125  static Lisp_Object Vmotif_version_string Line 125  static Lisp_Object Vmotif_version_string
125    
126  #endif /* USE_X_TOOLKIT */  #endif /* USE_X_TOOLKIT */
127    
128    #ifdef USE_GTK
129    
130    /* GTK+ version info */
131    
132    static Lisp_Object Vgtk_version_string;
133    
134    #endif /* USE_GTK */
135    
136  #ifdef HAVE_X11R4  #ifdef HAVE_X11R4
137  #define MAXREQUEST(dpy) (XMaxRequestSize (dpy))  #define MAXREQUEST(dpy) (XMaxRequestSize (dpy))
138  #else  #else
# Line 550  x_bitmap_pixmap (f, id) Line 558  x_bitmap_pixmap (f, id)
558    return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;    return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
559  }  }
560    
561    int
562    x_bitmap_mask (f, id)
563         FRAME_PTR f;
564         int id;
565    {
566      return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask;
567    }
568    
569    
570  /* Allocate a new bitmap record.  Returns index of new record.  */  /* Allocate a new bitmap record.  Returns index of new record.  */
571    
# Line 615  x_create_bitmap_from_data (f, bits, widt Line 631  x_create_bitmap_from_data (f, bits, widt
631    
632    id = x_allocate_bitmap_record (f);    id = x_allocate_bitmap_record (f);
633    dpyinfo->bitmaps[id - 1].pixmap = bitmap;    dpyinfo->bitmaps[id - 1].pixmap = bitmap;
634      dpyinfo->bitmaps[id - 1].have_mask = 0;
635    dpyinfo->bitmaps[id - 1].file = NULL;    dpyinfo->bitmaps[id - 1].file = NULL;
636    dpyinfo->bitmaps[id - 1].refcount = 1;    dpyinfo->bitmaps[id - 1].refcount = 1;
637    dpyinfo->bitmaps[id - 1].depth = 1;    dpyinfo->bitmaps[id - 1].depth = 1;
# Line 666  x_create_bitmap_from_file (f, file) Line 683  x_create_bitmap_from_file (f, file)
683    
684    id = x_allocate_bitmap_record (f);    id = x_allocate_bitmap_record (f);
685    dpyinfo->bitmaps[id - 1].pixmap = bitmap;    dpyinfo->bitmaps[id - 1].pixmap = bitmap;
686      dpyinfo->bitmaps[id - 1].have_mask = 0;
687    dpyinfo->bitmaps[id - 1].refcount = 1;    dpyinfo->bitmaps[id - 1].refcount = 1;
688    dpyinfo->bitmaps[id - 1].file    dpyinfo->bitmaps[id - 1].file
689      = (char *) xmalloc (SBYTES (file) + 1);      = (char *) xmalloc (SBYTES (file) + 1);
# Line 693  x_destroy_bitmap (f, id) Line 711  x_destroy_bitmap (f, id)
711          {          {
712            BLOCK_INPUT;            BLOCK_INPUT;
713            XFreePixmap (FRAME_X_DISPLAY (f), dpyinfo->bitmaps[id - 1].pixmap);            XFreePixmap (FRAME_X_DISPLAY (f), dpyinfo->bitmaps[id - 1].pixmap);
714              if (dpyinfo->bitmaps[id - 1].have_mask)
715                XFreePixmap (FRAME_X_DISPLAY (f), dpyinfo->bitmaps[id - 1].mask);
716            if (dpyinfo->bitmaps[id - 1].file)            if (dpyinfo->bitmaps[id - 1].file)
717              {              {
718                xfree (dpyinfo->bitmaps[id - 1].file);                xfree (dpyinfo->bitmaps[id - 1].file);
# Line 714  x_destroy_all_bitmaps (dpyinfo) Line 734  x_destroy_all_bitmaps (dpyinfo)
734      if (dpyinfo->bitmaps[i].refcount > 0)      if (dpyinfo->bitmaps[i].refcount > 0)
735        {        {
736          XFreePixmap (dpyinfo->display, dpyinfo->bitmaps[i].pixmap);          XFreePixmap (dpyinfo->display, dpyinfo->bitmaps[i].pixmap);
737            if (dpyinfo->bitmaps[i].have_mask)
738              XFreePixmap (dpyinfo->display, dpyinfo->bitmaps[i].mask);
739          if (dpyinfo->bitmaps[i].file)          if (dpyinfo->bitmaps[i].file)
740            xfree (dpyinfo->bitmaps[i].file);            xfree (dpyinfo->bitmaps[i].file);
741        }        }
# Line 721  x_destroy_all_bitmaps (dpyinfo) Line 743  x_destroy_all_bitmaps (dpyinfo)
743  }  }
744    
745    
746    
747    
748    /* Useful functions defined in the section
749       `Image type independent image structures' below. */
750    
751    static unsigned long four_corners_best P_ ((XImage *ximg, unsigned long width,
752                                                unsigned long height));
753    
754    static int x_create_x_image_and_pixmap P_ ((struct frame *f, int width, int height,
755                                                int depth, XImage **ximg,
756                                                Pixmap *pixmap));
757    
758    static void x_destroy_x_image P_ ((XImage *ximg));
759    
760    
761    /* Create a mask of a bitmap. Note is this not a perfect mask.
762       It's nicer with some borders in this context */
763    
764    int
765    x_create_bitmap_mask(f, id)
766         struct frame *f;
767         int id;
768    {
769      Pixmap pixmap, mask;
770      XImage *ximg, *mask_img;
771      unsigned long width, height;
772      int result;
773      unsigned long bg;
774      unsigned long x, y, xp, xm, yp, ym;
775      GC gc;
776    
777      int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f));
778      struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
779    
780      if (!(id > 0))
781        return -1;
782    
783      pixmap = x_bitmap_pixmap(f, id);
784      width = x_bitmap_width(f, id);
785      height = x_bitmap_height(f, id);
786    
787      BLOCK_INPUT;
788      ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height,
789                        ~0, ZPixmap);
790    
791      if (!ximg)
792        {
793          UNBLOCK_INPUT;
794          return -1;
795        }
796    
797      result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask);
798    
799      UNBLOCK_INPUT;
800      if (!result)
801        {
802          XDestroyImage(ximg);
803          return -1;
804        }
805    
806      bg = four_corners_best (ximg, width, height);
807    
808      for (y = 0; y < ximg->height; ++y)
809        {
810          for (x = 0; x < ximg->width; ++x)
811            {
812              xp = x != ximg->width - 1 ? x + 1 : 0;
813              xm = x != 0 ? x - 1 : ximg->width - 1;
814              yp = y != ximg->height - 1 ? y + 1 : 0;
815              ym = y != 0 ? y - 1 : ximg->height - 1;
816              if (XGetPixel (ximg, x, y) == bg
817                  && XGetPixel (ximg, x, yp) == bg
818                  && XGetPixel (ximg, x, ym) == bg
819                  && XGetPixel (ximg, xp, y) == bg
820                  && XGetPixel (ximg, xp, yp) == bg
821                  && XGetPixel (ximg, xp, ym) == bg
822                  && XGetPixel (ximg, xm, y) == bg
823                  && XGetPixel (ximg, xm, yp) == bg
824                  && XGetPixel (ximg, xm, ym) == bg)
825                XPutPixel (mask_img, x, y, 0);
826              else
827                XPutPixel (mask_img, x, y, 1);
828            }
829        }
830    
831      xassert (interrupt_input_blocked);
832      gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL);
833      XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0,
834                 width, height);
835      XFreeGC (FRAME_X_DISPLAY (f), gc);
836    
837      dpyinfo->bitmaps[id - 1].have_mask = 1;
838      dpyinfo->bitmaps[id - 1].mask = mask;
839    
840      XDestroyImage (ximg);
841      x_destroy_x_image(mask_img);
842    
843      return 0;
844    }
845    
846  static Lisp_Object unwind_create_frame P_ ((Lisp_Object));  static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
847  static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));  static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
848  static void x_disable_image P_ ((struct frame *, struct image *));  static void x_disable_image P_ ((struct frame *, struct image *));
# Line 859  x_real_positions (f, xptr, yptr) Line 981  x_real_positions (f, xptr, yptr)
981    
982                                   /* Child of win.  */                                   /* Child of win.  */
983                                   &child);                                   &child);
984      }          }
985    
986        had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));        had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
987      }      }
# Line 870  x_real_positions (f, xptr, yptr) Line 992  x_real_positions (f, xptr, yptr)
992    
993    if (had_errors) return;    if (had_errors) return;
994    
995    f->output_data.x->x_pixels_diff = -win_x;    f->x_pixels_diff = -win_x;
996    f->output_data.x->y_pixels_diff = -win_y;    f->y_pixels_diff = -win_y;
997    f->output_data.x->x_pixels_outer_diff = -outer_x;  
998    f->output_data.x->y_pixels_outer_diff = -outer_y;    FRAME_X_OUTPUT (f)->x_pixels_outer_diff = -outer_x;
999      FRAME_X_OUTPUT (f)->y_pixels_outer_diff = -outer_y;
1000    
1001    *xptr = real_x;    *xptr = real_x;
1002    *yptr = real_y;    *yptr = real_y;
# Line 975  x_set_wait_for_wm (f, new_value, old_val Line 1098  x_set_wait_for_wm (f, new_value, old_val
1098    f->output_data.x->wait_for_wm = !NILP (new_value);    f->output_data.x->wait_for_wm = !NILP (new_value);
1099  }  }
1100    
1101    #ifdef USE_GTK
1102    
1103    static Lisp_Object x_find_image_file P_ ((Lisp_Object file));
1104    
1105    /* Set icon from FILE for frame F.  By using GTK functions the icon
1106       may be any format that GdkPixbuf knows about, i.e. not just bitmaps.  */
1107    
1108    int
1109    xg_set_icon(f, file)
1110        FRAME_PTR f;
1111        Lisp_Object file;
1112    {
1113      struct gcpro gcpro1;
1114      int result = 0;
1115      Lisp_Object found;
1116    
1117      GCPRO1 (found);
1118    
1119      found = x_find_image_file (file);
1120    
1121      if (! NILP (found))
1122        {
1123          GdkPixbuf *pixbuf;
1124          GError *err = NULL;
1125          char *filename;
1126    
1127          filename = SDATA (found);
1128          BLOCK_INPUT;
1129    
1130          pixbuf = gdk_pixbuf_new_from_file (filename, &err);
1131    
1132          if (pixbuf)
1133            {
1134              gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1135                                   pixbuf);
1136              g_object_unref (pixbuf);
1137    
1138              result = 1;
1139            }
1140          else
1141            g_error_free (err);
1142    
1143          UNBLOCK_INPUT;
1144        }
1145    
1146      UNGCPRO;
1147      return result;
1148    }
1149    #endif /* USE_GTK */
1150    
1151    
1152  /* Functions called only from `x_set_frame_param'  /* Functions called only from `x_set_frame_param'
1153     to set individual parameters.     to set individual parameters.
# Line 1296  x_set_border_pixel (f, pix) Line 1469  x_set_border_pixel (f, pix)
1469    unload_color (f, f->output_data.x->border_pixel);    unload_color (f, f->output_data.x->border_pixel);
1470    f->output_data.x->border_pixel = pix;    f->output_data.x->border_pixel = pix;
1471    
1472    if (FRAME_X_WINDOW (f) != 0 && f->output_data.x->border_width > 0)    if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0)
1473      {      {
1474        BLOCK_INPUT;        BLOCK_INPUT;
1475        XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),        XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
# Line 1519  x_set_tool_bar_lines (f, value, oldval) Line 1692  x_set_tool_bar_lines (f, value, oldval)
1692    
1693    /* Don't resize the tool-bar to more than we have room for.  */    /* Don't resize the tool-bar to more than we have room for.  */
1694    root_window = FRAME_ROOT_WINDOW (f);    root_window = FRAME_ROOT_WINDOW (f);
1695    root_height = XINT (XWINDOW (root_window)->height);    root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window));
1696    if (root_height - delta < 1)    if (root_height - delta < 1)
1697      {      {
1698        delta = root_height - 1;        delta = root_height - 1;
# Line 1550  x_set_tool_bar_lines (f, value, oldval) Line 1723  x_set_tool_bar_lines (f, value, oldval)
1723    if (delta < 0)    if (delta < 0)
1724      {      {
1725        int height = FRAME_INTERNAL_BORDER_WIDTH (f);        int height = FRAME_INTERNAL_BORDER_WIDTH (f);
1726        int width = PIXEL_WIDTH (f);        int width = FRAME_PIXEL_WIDTH (f);
1727        int y = nlines * CANON_Y_UNIT (f);        int y = nlines * FRAME_LINE_HEIGHT (f);
1728    
1729        BLOCK_INPUT;        BLOCK_INPUT;
1730        x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),        x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
# Line 1790  x_set_name (f, name, explicit) Line 1963  x_set_name (f, name, explicit)
1963             managers which don't support that encoding.  So, if NAME             managers which don't support that encoding.  So, if NAME
1964             contains only ASCII and 8859-1 characters, encode it by             contains only ASCII and 8859-1 characters, encode it by
1965             iso-latin-1, and use "STRING" in text.encoding hoping that             iso-latin-1, and use "STRING" in text.encoding hoping that
1966             such window manager at least analize this format correctly,             such window managers at least analyze this format correctly,
1967             i.e. treat 8-bit bytes as 8859-1 characters.             i.e. treat 8-bit bytes as 8859-1 characters.
1968    
1969             We may also be able to use "UTF8_STRING" in text.encoding             We may also be able to use "UTF8_STRING" in text.encoding
1970             in the feature which can encode all Unicode characters.             in the future which can encode all Unicode characters.
1971             But, for the moment, there's no way to know that the             But, for the moment, there's no way to know that the
1972             current window manager supports it or not.  */             current window manager supports it or not.  */
1973          coding_system = Qcompound_text;          coding_system = Qcompound_text;
# Line 1956  void Line 2129  void
2129  x_set_scroll_bar_default_width (f)  x_set_scroll_bar_default_width (f)
2130       struct frame *f;       struct frame *f;
2131  {  {
2132    int wid = FONT_WIDTH (f->output_data.x->font);    int wid = FRAME_COLUMN_WIDTH (f);
2133    
2134  #ifdef USE_TOOLKIT_SCROLL_BARS  #ifdef USE_TOOLKIT_SCROLL_BARS
2135    /* A minimum width of 14 doesn't look good for toolkit scroll bars.  */    /* A minimum width of 14 doesn't look good for toolkit scroll bars.  */
2136    int width = 16 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM;    int width = 16 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM;
2137    FRAME_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid;    FRAME_CONFIG_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid;
2138    FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = width;    FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = width;
2139  #else  #else
2140    /* Make the actual width at least 14 pixels and a multiple of a    /* Make the actual width at least 14 pixels and a multiple of a
2141       character width.  */       character width.  */
2142    FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;    FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
2143    
2144    /* Use all of that space (aside from required margins) for the    /* Use all of that space (aside from required margins) for the
2145       scroll bar.  */       scroll bar.  */
2146    FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;    FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = 0;
2147  #endif  #endif
2148  }  }
2149    
# Line 2120  static XFontSet xic_create_xfontset P_ ( Line 2293  static XFontSet xic_create_xfontset P_ (
2293  static XIMStyle best_xim_style P_ ((XIMStyles *, XIMStyles *));  static XIMStyle best_xim_style P_ ((XIMStyles *, XIMStyles *));
2294    
2295    
2296  /* Supported XIM styles, ordered by preferenc.  */  /* Supported XIM styles, ordered by preference.  */
2297    
2298  static XIMStyle supported_xim_styles[] =  static XIMStyle supported_xim_styles[] =
2299  {  {
# Line 2330  xic_set_preeditarea (w, x, y) Line 2503  xic_set_preeditarea (w, x, y)
2503    XVaNestedList attr;    XVaNestedList attr;
2504    XPoint spot;    XPoint spot;
2505    
2506    spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x);    spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x) + WINDOW_LEFT_FRINGE_WIDTH (w);
2507    spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f));    spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f));
2508    attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL);    attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL);
2509    XSetICValues (FRAME_XIC (f), XNPreeditAttributes, attr, NULL);    XSetICValues (FRAME_XIC (f), XNPreeditAttributes, attr, NULL);
# Line 2369  xic_set_statusarea (f) Line 2542  xic_set_statusarea (f)
2542    
2543    area.width  = needed->width;    area.width  = needed->width;
2544    area.height = needed->height;    area.height = needed->height;
2545    area.x = PIXEL_WIDTH (f) - area.width - FRAME_INTERNAL_BORDER_WIDTH (f);    area.x = FRAME_PIXEL_WIDTH (f) - area.width - FRAME_INTERNAL_BORDER_WIDTH (f);
2546    area.y = (PIXEL_HEIGHT (f) - area.height    area.y = (FRAME_PIXEL_HEIGHT (f) - area.height
2547              - FRAME_MENUBAR_HEIGHT (f)              - FRAME_MENUBAR_HEIGHT (f)
2548              - FRAME_TOOLBAR_HEIGHT (f)              - FRAME_TOOLBAR_HEIGHT (f)
2549              - FRAME_INTERNAL_BORDER_WIDTH (f));              - FRAME_INTERNAL_BORDER_WIDTH (f));
# Line 2448  x_window (f, window_prompting, minibuffe Line 2621  x_window (f, window_prompting, minibuffe
2621    XtSetArg (al[ac], XtNallowShellResize, 1); ac++;    XtSetArg (al[ac], XtNallowShellResize, 1); ac++;
2622    XtSetArg (al[ac], XtNinput, 1); ac++;    XtSetArg (al[ac], XtNinput, 1); ac++;
2623    XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++;    XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++;
2624    XtSetArg (al[ac], XtNborderWidth, f->output_data.x->border_width); ac++;    XtSetArg (al[ac], XtNborderWidth, f->border_width); ac++;
2625    XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;    XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
2626    XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++;    XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++;
2627    XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;    XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
# Line 2533  x_window (f, window_prompting, minibuffe Line 2706  x_window (f, window_prompting, minibuffe
2706         is a user-specified or program-specified one.         is a user-specified or program-specified one.
2707         We pass that information later, in x_wm_set_size_hints.  */         We pass that information later, in x_wm_set_size_hints.  */
2708      {      {
2709        int left = f->output_data.x->left_pos;        int left = f->left_pos;
2710        int xneg = window_prompting & XNegative;        int xneg = window_prompting & XNegative;
2711        int top = f->output_data.x->top_pos;        int top = f->top_pos;
2712        int yneg = window_prompting & YNegative;        int yneg = window_prompting & YNegative;
2713        if (xneg)        if (xneg)
2714          left = -left;          left = -left;
# Line 2544  x_window (f, window_prompting, minibuffe Line 2717  x_window (f, window_prompting, minibuffe
2717    
2718        if (window_prompting & USPosition)        if (window_prompting & USPosition)
2719          sprintf (shell_position, "=%dx%d%c%d%c%d",          sprintf (shell_position, "=%dx%d%c%d%c%d",
2720                   PIXEL_WIDTH (f) + extra_borders,                   FRAME_PIXEL_WIDTH (f) + extra_borders,
2721                   PIXEL_HEIGHT (f) + menubar_size + extra_borders,                   FRAME_PIXEL_HEIGHT (f) + menubar_size + extra_borders,
2722                   (xneg ? '-' : '+'), left,                   (xneg ? '-' : '+'), left,
2723                   (yneg ? '-' : '+'), top);                   (yneg ? '-' : '+'), top);
2724        else        else
2725          sprintf (shell_position, "=%dx%d",          sprintf (shell_position, "=%dx%d",
2726                   PIXEL_WIDTH (f) + extra_borders,                   FRAME_PIXEL_WIDTH (f) + extra_borders,
2727                   PIXEL_HEIGHT (f) + menubar_size + extra_borders);                   FRAME_PIXEL_HEIGHT (f) + menubar_size + extra_borders);
2728      }      }
2729    
2730      len = strlen (shell_position) + 1;      len = strlen (shell_position) + 1;
# Line 2578  x_window (f, window_prompting, minibuffe Line 2751  x_window (f, window_prompting, minibuffe
2751    
2752  #ifdef HAVE_X_I18N  #ifdef HAVE_X_I18N
2753    FRAME_XIC (f) = NULL;    FRAME_XIC (f) = NULL;
2754  #ifdef USE_XIM    if (use_xim)
2755    create_frame_xic (f);      create_frame_xic (f);
 #endif  
2756  #endif  #endif
2757    
2758    f->output_data.x->wm_hints.input = True;    f->output_data.x->wm_hints.input = True;
# Line 2657  x_window (f) Line 2829  x_window (f)
2829    
2830  #ifdef HAVE_X_I18N  #ifdef HAVE_X_I18N
2831    FRAME_XIC (f) = NULL;    FRAME_XIC (f) = NULL;
2832  #ifdef USE_XIM  if (use_xim)
2833    BLOCK_INPUT;    {
2834    create_frame_xic (f);      BLOCK_INPUT;
2835    if (FRAME_XIC (f))      create_frame_xic (f);
2836      {      if (FRAME_XIC (f))
2837        /* XIM server might require some X events. */        {
2838        unsigned long fevent = NoEventMask;          /* XIM server might require some X events. */
2839        XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL);          unsigned long fevent = NoEventMask;
2840            XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL);
2841    
2842        if (fevent != NoEventMask)          if (fevent != NoEventMask)
2843          {            {
2844            XSetWindowAttributes attributes;              XSetWindowAttributes attributes;
2845            XWindowAttributes wattr;              XWindowAttributes wattr;
2846            unsigned long attribute_mask;              unsigned long attribute_mask;
2847    
2848            XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),              XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
2849                                  &wattr);                                    &wattr);
2850            attributes.event_mask = wattr.your_event_mask | fevent;              attributes.event_mask = wattr.your_event_mask | fevent;
2851            attribute_mask = CWEventMask;              attribute_mask = CWEventMask;
2852            XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),              XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
2853                                     attribute_mask, &attributes);                                       attribute_mask, &attributes);
2854          }            }
2855      }        }
2856    UNBLOCK_INPUT;      UNBLOCK_INPUT;
2857  #endif    }
2858  #endif  #endif
2859  }  }
2860    
# Line 2711  x_window (f) Line 2884  x_window (f)
2884    FRAME_X_WINDOW (f)    FRAME_X_WINDOW (f)
2885      = XCreateWindow (FRAME_X_DISPLAY (f),      = XCreateWindow (FRAME_X_DISPLAY (f),
2886                       f->output_data.x->parent_desc,                       f->output_data.x->parent_desc,
2887                       f->output_data.x->left_pos,                       f->left_pos,
2888                       f->output_data.x->top_pos,                       f->top_pos,
2889                       PIXEL_WIDTH (f), PIXEL_HEIGHT (f),                       FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f),
2890                       f->output_data.x->border_width,                       f->border_width,
2891                       CopyFromParent, /* depth */                       CopyFromParent, /* depth */
2892                       InputOutput, /* class */                       InputOutput, /* class */
2893                       FRAME_X_VISUAL (f),                       FRAME_X_VISUAL (f),
2894                       attribute_mask, &attributes);                       attribute_mask, &attributes);
2895    
2896  #ifdef HAVE_X_I18N  #ifdef HAVE_X_I18N
2897  #ifdef USE_XIM    if (use_xim)
   create_frame_xic (f);  
   if (FRAME_XIC (f))  
2898      {      {
2899        /* XIM server might require some X events. */        create_frame_xic (f);
2900        unsigned long fevent = NoEventMask;        if (FRAME_XIC (f))
2901        XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL);          {
2902        attributes.event_mask |= fevent;            /* XIM server might require some X events. */
2903        attribute_mask = CWEventMask;            unsigned long fevent = NoEventMask;
2904        XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),            XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL);
2905                                 attribute_mask, &attributes);            attributes.event_mask |= fevent;
2906              attribute_mask = CWEventMask;
2907              XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
2908                                       attribute_mask, &attributes);
2909            }
2910      }      }
 #endif  
2911  #endif /* HAVE_X_I18N */  #endif /* HAVE_X_I18N */
2912    
2913    validate_x_resource_name ();    validate_x_resource_name ();
# Line 2858  x_make_gc (f) Line 3032  x_make_gc (f)
3032       Note that many default values are used.  */       Note that many default values are used.  */
3033    
3034    /* Normal video */    /* Normal video */
3035    gc_values.font = f->output_data.x->font->fid;    gc_values.font = FRAME_FONT (f)->fid;
3036    gc_values.foreground = f->output_data.x->foreground_pixel;    gc_values.foreground = f->output_data.x->foreground_pixel;
3037    gc_values.background = f->output_data.x->background_pixel;    gc_values.background = f->output_data.x->background_pixel;
3038    gc_values.line_width = 0;     /* Means 1 using fast algorithm.  */    gc_values.line_width = 0;     /* Means 1 using fast algorithm.  */
# Line 3064  This function is an internal primitive-- Line 3238  This function is an internal primitive--
3238    f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));    f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
3239    bzero (f->output_data.x, sizeof (struct x_output));    bzero (f->output_data.x, sizeof (struct x_output));
3240    f->output_data.x->icon_bitmap = -1;    f->output_data.x->icon_bitmap = -1;
3241    f->output_data.x->fontset = -1;    FRAME_FONTSET (f) = -1;
3242    f->output_data.x->scroll_bar_foreground_pixel = -1;    f->output_data.x->scroll_bar_foreground_pixel = -1;
3243    f->output_data.x->scroll_bar_background_pixel = -1;    f->output_data.x->scroll_bar_background_pixel = -1;
3244  #ifdef USE_TOOLKIT_SCROLL_BARS  #ifdef USE_TOOLKIT_SCROLL_BARS
# Line 3192  This function is an internal primitive-- Line 3366  This function is an internal primitive--
3366  #ifdef USE_LUCID  #ifdef USE_LUCID
3367    /* Prevent lwlib/xlwmenu.c from crashing because of a bug    /* Prevent lwlib/xlwmenu.c from crashing because of a bug
3368       whereby it fails to get any font.  */       whereby it fails to get any font.  */
3369    xlwmenu_default_font = f->output_data.x->font;    xlwmenu_default_font = FRAME_FONT (f);
3370  #endif  #endif
3371    
3372    x_default_parameter (f, parms, Qborder_width, make_number (2),    x_default_parameter (f, parms, Qborder_width, make_number (2),
# Line 3304  This function is an internal primitive-- Line 3478  This function is an internal primitive--
3478                         "scrollBarWidth", "ScrollBarWidth",                         "scrollBarWidth", "ScrollBarWidth",
3479                         RES_TYPE_NUMBER);                         RES_TYPE_NUMBER);
3480    
3481    /* Dimensions, especially f->height, must be done via change_frame_size.    /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
3482       Change will not be effected unless different from the current       Change will not be effected unless different from the current
3483       f->height.  */       FRAME_LINES (f).  */
3484    width = f->width;    width = FRAME_COLS (f);
3485    height = f->height;    height = FRAME_LINES (f);
3486    
3487    f->height = 0;    SET_FRAME_COLS (f, 0);
3488    SET_FRAME_WIDTH (f, 0);    FRAME_LINES (f) = 0;
3489    change_frame_size (f, height, width, 1, 0, 0);    change_frame_size (f, height, width, 1, 0, 0);
3490    
   /* Set up faces after all frame parameters are known.  This call  
      also merges in face attributes specified for new frames.  If we  
      don't do this, the `menu' face for instance won't have the right  
      colors, and the menu bar won't appear in the specified colors for  
      new frames.  */  
   call1 (Qface_set_after_frame_default, frame);  
   
3491  #if defined (USE_X_TOOLKIT) || defined (USE_GTK)  #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
3492    /* Create the menu bar.  */    /* Create the menu bar.  */
3493    if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))    if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
# Line 3367  This function is an internal primitive-- Line 3534  This function is an internal primitive--
3534          ;          ;
3535      }      }
3536    
3537      /* Set the WM leader property.  GTK does this itself, so this is not
3538         needed when using GTK.  */
3539      if (dpyinfo->client_leader_window != 0)
3540        {
3541          BLOCK_INPUT;
3542          XChangeProperty (FRAME_X_DISPLAY (f),
3543                           FRAME_OUTER_WINDOW (f),
3544                           dpyinfo->Xatom_wm_client_leader,
3545                           XA_WINDOW, 32, PropModeReplace,
3546                           (char *) &dpyinfo->client_leader_window, 1);
3547          UNBLOCK_INPUT;
3548        }
3549    
3550    UNGCPRO;    UNGCPRO;
3551    
3552    /* Make sure windows on this frame appear in calls to next-window    /* Make sure windows on this frame appear in calls to next-window
# Line 3762  int Line 3942  int
3942  x_pixel_width (f)  x_pixel_width (f)
3943       register struct frame *f;       register struct frame *f;
3944  {  {
3945    return PIXEL_WIDTH (f);    return FRAME_PIXEL_WIDTH (f);
3946  }  }
3947    
3948  int  int
3949  x_pixel_height (f)  x_pixel_height (f)
3950       register struct frame *f;       register struct frame *f;
3951  {  {
3952    return PIXEL_HEIGHT (f);    return FRAME_PIXEL_HEIGHT (f);
3953  }  }
3954    
3955  int  int
3956  x_char_width (f)  x_char_width (f)
3957       register struct frame *f;       register struct frame *f;
3958  {  {
3959    return FONT_WIDTH (f->output_data.x->font);    return FRAME_COLUMN_WIDTH (f);
3960  }  }
3961    
3962  int  int
3963  x_char_height (f)  x_char_height (f)
3964       register struct frame *f;       register struct frame *f;
3965  {  {
3966    return f->output_data.x->line_height;    return FRAME_LINE_HEIGHT (f);
3967  }  }
3968    
3969  int  int
# Line 4032  If DISPLAY is nil, that stands for the s Line 4212  If DISPLAY is nil, that stands for the s
4212    for (i = 0; i < dpyinfo->n_fonts; i++)    for (i = 0; i < dpyinfo->n_fonts; i++)
4213      if (dpyinfo->font_table[i].name)      if (dpyinfo->font_table[i].name)
4214        {        {
         if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)  
           xfree (dpyinfo->font_table[i].full_name);  
         xfree (dpyinfo->font_table[i].name);  
4215          XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font);          XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font);
4216        }        }
4217    
# Line 4098  x_sync (f) Line 4275  x_sync (f)
4275    
4276    
4277  /***********************************************************************  /***********************************************************************
4278                    General X functions exposed to Elisp.
4279     ***********************************************************************/
4280    
4281    DEFUN ("x-send-client-message", Fx_send_client_event,
4282           Sx_send_client_message, 6, 6, 0,
4283           doc: /* Send a client message of MESSAGE-TYPE to window DEST on DISPLAY.
4284    
4285    For DISPLAY, specify either a frame or a display name (a string).
4286    If DISPLAY is nil, that stands for the selected frame's display.
4287    DEST may be an integer, in which case it is a Window id.  The value 0 may
4288    be used to send to the root window of the DISPLAY.
4289    If DEST is a frame the event is sent to the outer window of that frame.
4290    Nil means the currently selected frame.
4291    If DEST is the string "PointerWindow" the event is sent to the window that
4292    contains the pointer.  If DEST is the string "InputFocus" the event is
4293    sent to the window that has the input focus.
4294    FROM is the frame sending the event.  Use nil for currently selected frame.
4295    MESSAGE-TYPE is the name of an Atom as a string.
4296    FORMAT must be one of 8, 16 or 32 and determines the size of the values in
4297    bits.  VALUES is a list of integer and/or strings containing the values to
4298    send.  If a value is a string, it is converted to an Atom and the value of
4299    the Atom is sent.  If more values than fits into the event is given,
4300    the excessive values are ignored.  */)
4301         (display, dest, from, message_type, format, values)
4302         Lisp_Object display, dest, from, message_type, format, values;
4303    {
4304      struct x_display_info *dpyinfo = check_x_display_info (display);
4305      Window wdest;
4306      XEvent event;
4307      Lisp_Object cons;
4308      int i;
4309      int max_nr_values = (int) sizeof (event.xclient.data.b);
4310      struct frame *f = check_x_frame (from);
4311      
4312      CHECK_STRING (message_type);
4313      CHECK_NUMBER (format);
4314      CHECK_CONS (values);
4315    
4316      for (cons = values; CONSP (cons); cons = XCDR (cons))
4317        {
4318          Lisp_Object o = XCAR (cons);
4319    
4320          if (! INTEGERP (o) && ! STRINGP (o))
4321            error ("Bad data in VALUES, must be integer or string");
4322        }
4323    
4324      event.xclient.type = ClientMessage;
4325      event.xclient.format = XFASTINT (format);
4326    
4327      if (event.xclient.format != 8 && event.xclient.format != 16
4328          && event.xclient.format != 32)
4329        error ("FORMAT must be one of 8, 16 or 32");
4330      if (event.xclient.format == 16) max_nr_values /= 2;
4331      if (event.xclient.format == 32) max_nr_values /= 4;
4332      
4333      if (FRAMEP (dest) || NILP (dest))
4334        {
4335          struct frame *fdest = check_x_frame (dest);
4336          wdest = FRAME_OUTER_WINDOW (fdest);
4337        }
4338      else if (STRINGP (dest))
4339        {
4340          if (strcmp (SDATA (dest), "PointerWindow") == 0)
4341            wdest = PointerWindow;
4342          else if (strcmp (SDATA (dest), "InputFocus") == 0)
4343            wdest = InputFocus;
4344          else
4345            error ("DEST as a string must be one of PointerWindow or InputFocus");
4346        }
4347      else
4348        {
4349          CHECK_NUMBER (dest);
4350          wdest = (Window) XFASTINT (dest);
4351          if (wdest == 0) wdest = dpyinfo->root_window;
4352        }
4353    
4354      BLOCK_INPUT;
4355      for (cons = values, i = 0;
4356           CONSP (cons) && i < max_nr_values;
4357           cons = XCDR (cons), ++i)
4358        {
4359          Lisp_Object o = XCAR (cons);
4360          long val;
4361    
4362          if (INTEGERP (o))
4363            val = XINT (o);
4364          else if (STRINGP (o))
4365              val = XInternAtom (dpyinfo->display, SDATA (o), False);
4366    
4367          if (event.xclient.format == 8)
4368            event.xclient.data.b[i] = (char) val;
4369          else if (event.xclient.format == 16)
4370            event.xclient.data.s[i] = (short) val;
4371          else
4372            event.xclient.data.l[i] = val;
4373        }
4374    
4375      for ( ; i < max_nr_values; ++i)
4376        if (event.xclient.format == 8)
4377          event.xclient.data.b[i] = 0;
4378        else if (event.xclient.format == 16)
4379          event.xclient.data.s[i] = 0;
4380        else
4381          event.xclient.data.l[i] = 0;
4382    
4383      event.xclient.message_type
4384        = XInternAtom (dpyinfo->display, SDATA (message_type), False);
4385      event.xclient.display = dpyinfo->display;
4386      event.xclient.window = FRAME_OUTER_WINDOW (f);
4387    
4388      XSendEvent (dpyinfo->display, wdest, False, 0xffff, &event);
4389    
4390      XFlush (dpyinfo->display);
4391      UNBLOCK_INPUT;
4392    
4393      return Qnil;
4394    }
4395    
4396    /***********************************************************************
4397                              Image types                              Image types
4398   ***********************************************************************/   ***********************************************************************/
4399    
# Line 4474  or omitted means use the selected frame. Line 4770  or omitted means use the selected frame.
4770        int height = img->height + 2 * img->vmargin;        int height = img->height + 2 * img->vmargin;
4771    
4772        if (NILP (pixels))        if (NILP (pixels))
4773          size = Fcons (make_float ((double) width / CANON_X_UNIT (f)),          size = Fcons (make_float ((double) width / FRAME_COLUMN_WIDTH (f)),
4774                        make_float ((double) height / CANON_Y_UNIT (f)));                        make_float ((double) height / FRAME_LINE_HEIGHT (f)));
4775        else        else
4776          size = Fcons (make_number (width), make_number (height));          size = Fcons (make_number (width), make_number (height));
4777      }      }
# Line 6575  lookup_rgb_color (f, r, g, b) Line 6871  lookup_rgb_color (f, r, g, b)
6871    unsigned hash = CT_HASH_RGB (r, g, b);    unsigned hash = CT_HASH_RGB (r, g, b);
6872    int i = hash % CT_SIZE;    int i = hash % CT_SIZE;
6873    struct ct_color *p;    struct ct_color *p;
6874      struct x_display_info *dpyinfo;
6875    
6876      /* Handle TrueColor visuals specially, which improves performance by
6877         two orders of magnitude.  Freeing colors on TrueColor visuals is
6878         a nop, and pixel colors specify RGB values directly.  See also
6879         the Xlib spec, chapter 3.1.  */
6880      dpyinfo = FRAME_X_DISPLAY_INFO (f);
6881      if (dpyinfo->red_bits > 0)
6882        {
6883          unsigned long pr, pg, pb;
6884    
6885          /* Apply gamma-correction like normal color allocation does.  */
6886          if (f->gamma)
6887            {
6888              XColor color;
6889              color.red = r, color.green = g, color.blue = b;
6890              gamma_correct (f, &color);
6891              r = color.red, g = color.green, b = color.blue;
6892            }
6893    
6894          /* Scale down RGB values to the visual's bits per RGB, and shift
6895             them to the right position in the pixel color.  Note that the
6896             original RGB values are 16-bit values, as usual in X.  */
6897          pr = (r >> (16 - dpyinfo->red_bits))   << dpyinfo->red_offset;
6898          pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
6899          pb = (b >> (16 - dpyinfo->blue_bits))  << dpyinfo->blue_offset;
6900    
6901          /* Assemble the pixel color.  */
6902          return pr | pg | pb;
6903        }
6904      
6905    for (p = ct_table[i]; p; p = p->next)    for (p = ct_table[i]; p; p = p->next)
6906      if (p->r == r && p->g == g && p->b == b)      if (p->r == r && p->g == g && p->b == b)
6907        break;        break;
# Line 7426  pbm_load (f, img) Line 7752  pbm_load (f, img)
7752    
7753  #if HAVE_PNG  #if HAVE_PNG
7754    
7755  #include <png.h>  #if defined HAVE_LIBPNG_PNG_H
7756    # include <libpng/png.h>
7757    #else
7758    # include <png.h>
7759    #endif
7760    
7761  /* Function prototypes.  */  /* Function prototypes.  */
7762    
# Line 7577  png_load (f, img) Line 7907  png_load (f, img)
7907    png_byte channels;    png_byte channels;
7908    png_uint_32 row_bytes;    png_uint_32 row_bytes;
7909    int transparent_p;    int transparent_p;
7910    double screen_gamma, image_gamma;    double screen_gamma;
   int intent;  
7911    struct png_memory_storage tbr;  /* Data to be read */    struct png_memory_storage tbr;  /* Data to be read */
7912    
7913    /* Find out what file to load.  */    /* Find out what file to load.  */
# Line 7717  png_load (f, img) Line 8046  png_load (f, img)
8046    screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);    screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);
8047    
8048  #if 0 /* Avoid double gamma correction for PNG images. */  #if 0 /* Avoid double gamma correction for PNG images. */
8049    /* Tell the PNG lib to handle gamma correction for us.  */    { /* Tell the PNG lib to handle gamma correction for us.  */
8050        int intent;
8051        double image_gamma;
8052  #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)  #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
8053    if (png_get_sRGB (png_ptr, info_ptr, &intent))      if (png_get_sRGB (png_ptr, info_ptr, &intent))
8054      /* The libpng documentation says this is right in this case.  */        /* The libpng documentation says this is right in this case.  */
8055      png_set_gamma (png_ptr, screen_gamma, 0.45455);        png_set_gamma (png_ptr, screen_gamma, 0.45455);
8056    else      else
8057  #endif  #endif
8058    if (png_get_gAMA (png_ptr, info_ptr, &image_gamma))        if (png_get_gAMA (png_ptr, info_ptr, &image_gamma))
8059      /* Image contains gamma information.  */          /* Image contains gamma information.  */
8060      png_set_gamma (png_ptr, screen_gamma, image_gamma);          png_set_gamma (png_ptr, screen_gamma, image_gamma);
8061    else        else
8062      /* Use the standard default for the image gamma.  */          /* Use the standard default for the image gamma.  */
8063      png_set_gamma (png_ptr, screen_gamma, 0.45455);          png_set_gamma (png_ptr, screen_gamma, 0.45455);
8064      }
8065  #endif /* if 0 */  #endif /* if 0 */
8066    
8067    /* Handle alpha channel by combining the image with a background    /* Handle alpha channel by combining the image with a background
# Line 9631  x_create_tip_frame (dpyinfo, parms, text Line 9963  x_create_tip_frame (dpyinfo, parms, text
9963    XSETFRAME (frame, f);    XSETFRAME (frame, f);
9964    
9965    buffer = Fget_buffer_create (build_string (" *tip*"));    buffer = Fget_buffer_create (build_string (" *tip*"));
9966    Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer);    Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
9967    old_buffer = current_buffer;    old_buffer = current_buffer;
9968    set_buffer_internal_1 (XBUFFER (buffer));    set_buffer_internal_1 (XBUFFER (buffer));
9969    current_buffer->truncate_lines = Qnil;    current_buffer->truncate_lines = Qnil;
# Line 9650  x_create_tip_frame (dpyinfo, parms, text Line 9982  x_create_tip_frame (dpyinfo, parms, text
9982    f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));    f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
9983    bzero (f->output_data.x, sizeof (struct x_output));    bzero (f->output_data.x, sizeof (struct x_output));
9984    f->output_data.x->icon_bitmap = -1;    f->output_data.x->icon_bitmap = -1;
9985    f->output_data.x->fontset = -1;    FRAME_FONTSET (f) = -1;
9986    f->output_data.x->scroll_bar_foreground_pixel = -1;    f->output_data.x->scroll_bar_foreground_pixel = -1;
9987    f->output_data.x->scroll_bar_background_pixel = -1;    f->output_data.x->scroll_bar_background_pixel = -1;
9988  #ifdef USE_TOOLKIT_SCROLL_BARS  #ifdef USE_TOOLKIT_SCROLL_BARS
# Line 9831  x_create_tip_frame (dpyinfo, parms, text Line 10163  x_create_tip_frame (dpyinfo, parms, text
10163    x_default_parameter (f, parms, Qcursor_type, Qbox,    x_default_parameter (f, parms, Qcursor_type, Qbox,
10164                         "cursorType", "CursorType", RES_TYPE_SYMBOL);                         "cursorType", "CursorType", RES_TYPE_SYMBOL);
10165    
10166    /* Dimensions, especially f->height, must be done via change_frame_size.    /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
10167       Change will not be effected unless different from the current       Change will not be effected unless different from the current
10168       f->height.  */       FRAME_LINES (f).  */
10169    width = f->width;    width = FRAME_COLS (f);
10170    height = f->height;    height = FRAME_LINES (f);
10171    f->height = 0;    SET_FRAME_COLS (f, 0);
10172    SET_FRAME_WIDTH (f, 0);    FRAME_LINES (f) = 0;
10173    change_frame_size (f, height, width, 1, 0, 0);    change_frame_size (f, height, width, 1, 0, 0);
10174    
10175    /* Add `tooltip' frame parameter's default value. */    /* Add `tooltip' frame parameter's default value. */
# Line 10026  Text larger than the specified size is c Line 10358  Text larger than the specified size is c
10358              }              }
10359    
10360            BLOCK_INPUT;            BLOCK_INPUT;
10361            compute_tip_xy (f, parms, dx, dy, PIXEL_WIDTH (f),            compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f),
10362                            PIXEL_HEIGHT (f), &root_x, &root_y);                            FRAME_PIXEL_HEIGHT (f), &root_x, &root_y);
10363            XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),            XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
10364                         root_x, root_y);                         root_x, root_y);
10365            UNBLOCK_INPUT;            UNBLOCK_INPUT;
# Line 10062  Text larger than the specified size is c Line 10394  Text larger than the specified size is c
10394    
10395    /* Set up the frame's root window.  */    /* Set up the frame's root window.  */
10396    w = XWINDOW (FRAME_ROOT_WINDOW (f));    w = XWINDOW (FRAME_ROOT_WINDOW (f));
10397    w->left = w->top = make_number (0);    w->left_col = w->top_line = make_number (0);
10398    
10399    if (CONSP (Vx_max_tooltip_size)    if (CONSP (Vx_max_tooltip_size)
10400        && INTEGERP (XCAR (Vx_max_tooltip_size))        && INTEGERP (XCAR (Vx_max_tooltip_size))
# Line 10070  Text larger than the specified size is c Line 10402  Text larger than the specified size is c
10402        && INTEGERP (XCDR (Vx_max_tooltip_size))        && INTEGERP (XCDR (Vx_max_tooltip_size))
10403        && XINT (XCDR (Vx_max_tooltip_size)) > 0)        && XINT (XCDR (Vx_max_tooltip_size)) > 0)
10404      {      {
10405        w->width = XCAR (Vx_max_tooltip_size);        w->total_cols = XCAR (Vx_max_tooltip_size);
10406        w->height = XCDR (Vx_max_tooltip_size);        w->total_lines = XCDR (Vx_max_tooltip_size);
10407      }      }
10408    else    else
10409      {      {
10410        w->width = make_number (80);        w->total_cols = make_number (80);
10411        w->height = make_number (40);        w->total_lines = make_number (40);
10412      }      }
10413    
10414    f->window_width = XINT (w->width);    FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
10415    adjust_glyphs (f);    adjust_glyphs (f);
10416    w->pseudo_window_p = 1;    w->pseudo_window_p = 1;
10417    
# Line 10531  usual X keysyms.  */) Line 10863  usual X keysyms.  */)
10863                              Initialization                              Initialization
10864   ***********************************************************************/   ***********************************************************************/
10865    
10866  /* Keep this list in the same order as frame_parms in frame.c.  /* Keep this list in the same order as frame_parms in frame.c.
10867     Use 0 for unsupported frame parameters.  */     Use 0 for unsupported frame parameters.  */
10868    
10869  frame_parm_handler x_frame_parm_handlers[] =  frame_parm_handler x_frame_parm_handlers[] =
# Line 10721  meaning don't clear the cache.  */); Line 11053  meaning don't clear the cache.  */);
11053  #endif /* USE_MOTIF */  #endif /* USE_MOTIF */
11054  #endif /* USE_X_TOOLKIT */  #endif /* USE_X_TOOLKIT */
11055    
11056    #ifdef USE_GTK
11057      Fprovide (intern ("gtk"), Qnil);
11058    
11059      DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
11060                   doc: /* Version info for GTK+.  */);
11061      {
11062        char gtk_version[40];
11063        g_snprintf (gtk_version, sizeof (gtk_version), "%u.%u.%u",
11064                    GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
11065        Vgtk_version_string = build_string (gtk_version);
11066      }
11067    #endif /* USE_GTK */
11068    
11069    /* X window properties.  */    /* X window properties.  */
11070    defsubr (&Sx_change_window_property);    defsubr (&Sx_change_window_property);
11071    defsubr (&Sx_delete_window_property);    defsubr (&Sx_delete_window_property);
# Line 10748  meaning don't clear the cache.  */); Line 11093  meaning don't clear the cache.  */);
11093    defsubr (&Sx_close_connection);    defsubr (&Sx_close_connection);
11094    defsubr (&Sx_display_list);    defsubr (&Sx_display_list);
11095    defsubr (&Sx_synchronize);    defsubr (&Sx_synchronize);
11096      defsubr (&Sx_send_client_message);
11097    defsubr (&Sx_focus_frame);    defsubr (&Sx_focus_frame);
11098    defsubr (&Sx_backspace_delete_keys_p);    defsubr (&Sx_backspace_delete_keys_p);
11099    
# Line 10875  init_xfns () Line 11221  init_xfns ()
11221  }  }
11222    
11223  #endif /* HAVE_X_WINDOWS */  #endif /* HAVE_X_WINDOWS */
11224    
11225    /* arch-tag: 55040d02-5485-4d58-8b22-95a7a05f3288
11226       (do not change this comment) */

Legend:
Removed from v.1.549.2.1  
changed lines
  Added in v.1.549.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26