extern void free_frame_menubar ();
extern double atof ();
+#ifdef USE_MOTIF
+
+/* LessTif/Motif version info. */
+
+static Lisp_Object Vmotif_version_string;
+
+#endif /* USE_MOTIF */
+
#endif /* USE_X_TOOLKIT */
#define min(a,b) ((a) < (b) ? (a) : (b))
gray_bits, gray_width, gray_height,
f->output_data.x->foreground_pixel,
f->output_data.x->background_pixel,
- DefaultDepth (FRAME_X_DISPLAY (f),
- XScreenNumberOfScreen (FRAME_X_SCREEN (f)))));
+ DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))));
UNBLOCK_INPUT;
}
}
UNGCPRO;
+
+ /* Make sure windows on this frame appear in calls to next-window
+ and similar functions. */
+ Vwindow_list = Qnil;
+
return unbind_to (count, frame);
}
***********************************************************************/
static void cache_image P_ ((struct frame *f, struct image *img));
+static void postprocess_image P_ ((struct frame *, struct image *));
/* Return a new, initialized image cache that is allocated from the
}
+/* Compute masks and transform image IMG on frame F, as specified
+ by the image's specification, */
+
+static void
+postprocess_image (f, img)
+ struct frame *f;
+ struct image *img;
+{
+ /* Manipulation of the image's mask. */
+ if (img->pixmap)
+ {
+ Lisp_Object conversion, spec;
+ Lisp_Object mask;
+
+ spec = img->spec;
+
+ /* `:heuristic-mask t'
+ `:mask heuristic'
+ means build a mask heuristically.
+ `:heuristic-mask (R G B)'
+ `:mask (heuristic (R G B))'
+ means build a mask from color (R G B) in the
+ image.
+ `:mask nil'
+ means remove a mask, if any. */
+
+ mask = image_spec_value (spec, QCheuristic_mask, NULL);
+ if (!NILP (mask))
+ x_build_heuristic_mask (f, img, mask);
+ else
+ {
+ int found_p;
+
+ mask = image_spec_value (spec, QCmask, &found_p);
+
+ if (EQ (mask, Qheuristic))
+ x_build_heuristic_mask (f, img, Qt);
+ else if (CONSP (mask)
+ && EQ (XCAR (mask), Qheuristic))
+ {
+ if (CONSP (XCDR (mask)))
+ x_build_heuristic_mask (f, img, XCAR (XCDR (mask)));
+ else
+ x_build_heuristic_mask (f, img, XCDR (mask));
+ }
+ else if (NILP (mask) && found_p && img->mask)
+ {
+ XFreePixmap (FRAME_X_DISPLAY (f), img->mask);
+ img->mask = None;
+ }
+ }
+
+
+ /* Should we apply an image transformation algorithm? */
+ conversion = image_spec_value (spec, QCconversion, NULL);
+ if (EQ (conversion, Qdisabled))
+ x_disable_image (f, img);
+ else if (EQ (conversion, Qlaplace))
+ x_laplace (f, img);
+ else if (EQ (conversion, Qemboss))
+ x_emboss (f, img);
+ else if (CONSP (conversion)
+ && EQ (XCAR (conversion), Qedge_detection))
+ {
+ Lisp_Object tem;
+ tem = XCDR (conversion);
+ if (CONSP (tem))
+ x_edge_detection (f, img,
+ Fplist_get (tem, QCmatrix),
+ Fplist_get (tem, QCcolor_adjustment));
+ }
+ }
+}
+
+
/* Return the id of image with Lisp specification SPEC on frame F.
SPEC must be a valid Lisp image specification (see valid_image_p). */
/* If not found, create a new image and cache it. */
if (img == NULL)
{
+ extern Lisp_Object Qpostscript;
+
BLOCK_INPUT;
img = make_image (spec, hash);
cache_image (f, img);
img->vmargin += abs (img->relief);
}
- /* Manipulation of the image's mask. */
- if (img->pixmap)
- {
- /* `:heuristic-mask t'
- `:mask heuristic'
- means build a mask heuristically.
- `:heuristic-mask (R G B)'
- `:mask (heuristic (R G B))'
- means build a mask from color (R G B) in the
- image.
- `:mask nil'
- means remove a mask, if any. */
-
- Lisp_Object mask;
-
- mask = image_spec_value (spec, QCheuristic_mask, NULL);
- if (!NILP (mask))
- x_build_heuristic_mask (f, img, mask);
- else
- {
- int found_p;
-
- mask = image_spec_value (spec, QCmask, &found_p);
-
- if (EQ (mask, Qheuristic))
- x_build_heuristic_mask (f, img, Qt);
- else if (CONSP (mask)
- && EQ (XCAR (mask), Qheuristic))
- {
- if (CONSP (XCDR (mask)))
- x_build_heuristic_mask (f, img, XCAR (XCDR (mask)));
- else
- x_build_heuristic_mask (f, img, XCDR (mask));
- }
- else if (NILP (mask) && found_p && img->mask)
- {
- XFreePixmap (FRAME_X_DISPLAY (f), img->mask);
- img->mask = None;
- }
- }
- }
-
- /* Should we apply an image transformation algorithm? */
- if (img->pixmap)
- {
- Lisp_Object conversion;
-
- conversion = image_spec_value (spec, QCconversion, NULL);
- if (EQ (conversion, Qdisabled))
- x_disable_image (f, img);
- else if (EQ (conversion, Qlaplace))
- x_laplace (f, img);
- else if (EQ (conversion, Qemboss))
- x_emboss (f, img);
- else if (CONSP (conversion)
- && EQ (XCAR (conversion), Qedge_detection))
- {
- Lisp_Object tem;
- tem = XCDR (conversion);
- if (CONSP (tem))
- x_edge_detection (f, img,
- Fplist_get (tem, QCmatrix),
- Fplist_get (tem, QCcolor_adjustment));
- }
- }
+ /* Do image transformations and compute masks, unless we
+ don't have the image yet. */
+ if (!EQ (*img->type->type, Qpostscript))
+ postprocess_image (f, img);
}
UNBLOCK_INPUT;
UNBLOCK_INPUT;
}
+
+ /* Now that we have the pixmap, compute mask and transform the
+ image if requested. */
+ BLOCK_INPUT;
+ postprocess_image (f, img);
+ UNBLOCK_INPUT;
}
***********************************************************************/
static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *,
- Lisp_Object));
+ Lisp_Object, Lisp_Object));
static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
- Lisp_Object, int *, int *));
+ Lisp_Object, int, int, int *, int *));
/* The frame of a currently visible tooltip. */
/* Create a frame for a tooltip on the display described by DPYINFO.
- PARMS is a list of frame parameters. Value is the frame.
+ PARMS is a list of frame parameters. TEXT is the string to
+ display in the tip frame. Value is the frame.
Note that functions called here, esp. x_default_parameter can
signal errors, for instance when a specified color name is
when this happens. */
static Lisp_Object
-x_create_tip_frame (dpyinfo, parms)
+x_create_tip_frame (dpyinfo, parms, text)
struct x_display_info *dpyinfo;
- Lisp_Object parms;
+ Lisp_Object parms, text;
{
struct frame *f;
Lisp_Object frame, tem;
struct gcpro gcpro1, gcpro2, gcpro3;
struct kboard *kb;
int face_change_count_before = face_change_count;
+ Lisp_Object buffer;
+ struct buffer *old_buffer;
check_x ();
GCPRO3 (parms, name, frame);
f = make_frame (1);
XSETFRAME (frame, f);
+
+ buffer = Fget_buffer_create (build_string (" *tip*"));
+ Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer);
+ old_buffer = current_buffer;
+ set_buffer_internal_1 (XBUFFER (buffer));
+ Ferase_buffer ();
+ Finsert (1, &text);
+ set_buffer_internal_1 (old_buffer);
+
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
record_unwind_protect (unwind_create_tip_frame, frame);
/* Compute where to display tip frame F. PARMS is the list of frame
parameters for F. DX and DY are specified offsets from the current
- location of the mouse. Return coordinates relative to the root
- window of the display in *ROOT_X, and *ROOT_Y. */
+ location of the mouse. WIDTH and HEIGHT are the width and height
+ of the tooltip. Return coordinates relative to the root window of
+ the display in *ROOT_X, and *ROOT_Y. */
static void
-compute_tip_xy (f, parms, dx, dy, root_x, root_y)
+compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
struct frame *f;
Lisp_Object parms, dx, dy;
+ int width, height;
int *root_x, *root_y;
{
Lisp_Object left, top;
/* Move the tooltip window where the mouse pointer is. Resize and
show it. */
- BLOCK_INPUT;
- XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
- &root, &child, root_x, root_y, &win_x, &win_y, &pmask);
- UNBLOCK_INPUT;
+ if (!INTEGERP (left) && !INTEGERP (top))
+ {
+ BLOCK_INPUT;
+ XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
+ &root, &child, root_x, root_y, &win_x, &win_y, &pmask);
+ UNBLOCK_INPUT;
+ }
- *root_x += XINT (dx);
- *root_y += XINT (dy);
-
- if (INTEGERP (left))
- *root_x = XINT (left);
if (INTEGERP (top))
*root_y = XINT (top);
+ else if (*root_y + XINT (dy) - height < 0)
+ *root_y -= XINT (dy);
+ else
+ {
+ *root_y -= height;
+ *root_y += XINT (dy);
+ }
+
+ if (INTEGERP (left))
+ *root_x = XINT (left);
+ else if (*root_x + XINT (dx) + width > FRAME_X_DISPLAY_INFO (f)->width)
+ *root_x -= width + XINT (dx);
+ else
+ *root_x += XINT (dx);
}
}
BLOCK_INPUT;
- compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
+ compute_tip_xy (f, parms, dx, dy, PIXEL_WIDTH (f),
+ PIXEL_HEIGHT (f), &root_x, &root_y);
XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- root_x, root_y - PIXEL_HEIGHT (f));
+ root_x, root_y);
UNBLOCK_INPUT;
goto start_timer;
}
/* Create a frame for the tooltip, and record it in the global
variable tip_frame. */
- frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms);
+ frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms, string);
f = XFRAME (frame);
/* Set up the frame's root window. Currently we use a size of 80
w->pseudo_window_p = 1;
/* Display the tooltip text in a temporary buffer. */
- buffer = Fget_buffer_create (build_string (" *tip*"));
- Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer);
old_buffer = current_buffer;
- set_buffer_internal_1 (XBUFFER (buffer));
- Ferase_buffer ();
- Finsert (1, &string);
+ set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
/* Move the tooltip window where the mouse pointer is. Resize and
show it. */
- compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
+ compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
BLOCK_INPUT;
XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- root_x, root_y - height, width, height);
+ root_x, root_y, width, height);
XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
UNBLOCK_INPUT;
#ifdef USE_X_TOOLKIT
Fprovide (intern ("x-toolkit"));
-#endif
+
#ifdef USE_MOTIF
Fprovide (intern ("motif"));
-#endif
+
+ DEFVAR_LISP ("motif-version-string", &Vmotif_version_string,
+ "Version info for LessTif/Motif.");
+ Vmotif_version_string = build_string (XmVERSION_STRING);
+#endif /* USE_MOTIF */
+#endif /* USE_X_TOOLKIT */
defsubr (&Sx_get_resource);