#include "msdos.h"
#include "dosfns.h"
#endif
+#ifdef USE_X_TOOLKIT
+#include "widget.h"
+#endif
#ifdef HAVE_NS
Lisp_Object Qns_parse_geometry;
return XFRAME (frame);
}
+#ifdef HAVE_WINDOW_SYSTEM
+
bool
window_system_available (struct frame *f)
{
- if (f)
- return FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f);
- else
-#ifdef HAVE_WINDOW_SYSTEM
- return x_display_list != NULL;
-#else
- return 0;
-#endif
+ return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : x_display_list != NULL;
}
+#endif /* HAVE_WINDOW_SYSTEM */
+
struct frame *
decode_window_system_frame (Lisp_Object frame)
{
f->line_height = 1; /* !FRAME_WINDOW_P value. */
#ifdef HAVE_WINDOW_SYSTEM
f->want_fullscreen = FULLSCREEN_NONE;
+#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+ f->last_tool_bar_item = -1;
+#endif
#endif
root_window = make_window ();
GCPRO1 (retval);
if (!NILP (Vmouse_position_function))
retval = call1 (Vmouse_position_function, retval);
- RETURN_UNGCPRO (retval);
+ return retval;
}
DEFUN ("mouse-pixel-position", Fmouse_pixel_position,
return Fcons (lispy_dummy, Fcons (x, y));
}
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* On frame F, convert character coordinates X and Y to pixel
+ coordinates *PIX_X and *PIX_Y. */
+
+static void
+frame_char_to_pixel_position (struct frame *f, int x, int y,
+ int *pix_x, int *pix_y)
+{
+ *pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2;
+ *pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2;
+
+ if (*pix_x < 0)
+ *pix_x = 0;
+ if (*pix_x > FRAME_PIXEL_WIDTH (f))
+ *pix_x = FRAME_PIXEL_WIDTH (f);
+
+ if (*pix_y < 0)
+ *pix_y = 0;
+ if (*pix_y > FRAME_PIXEL_HEIGHT (f))
+ *pix_y = FRAME_PIXEL_HEIGHT (f);
+}
+
+/* On frame F, reposition mouse pointer to character coordinates X and Y. */
+
+static void
+frame_set_mouse_position (struct frame *f, int x, int y)
+{
+ int pix_x, pix_y;
+
+ frame_char_to_pixel_position (f, x, y, &pix_x, &pix_y);
+ frame_set_mouse_pixel_position (f, pix_x, pix_y);
+}
+
+#endif /* HAVE_WINDOW_SYSTEM */
+
DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
doc: /* Move the mouse pointer to the center of character cell (X,Y) in FRAME.
Coordinates are relative to the frame, not a window,
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (XFRAME (frame)))
/* Warping the mouse will cause enternotify and focus events. */
- x_set_mouse_position (XFRAME (frame), XINT (x), XINT (y));
+ frame_set_mouse_position (XFRAME (frame), XINT (x), XINT (y));
#else
#if defined (MSDOS)
if (FRAME_MSDOS_P (XFRAME (frame)))
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (XFRAME (frame)))
/* Warping the mouse will cause enternotify and focus events. */
- x_set_mouse_pixel_position (XFRAME (frame), XINT (x), XINT (y));
+ frame_set_mouse_pixel_position (XFRAME (frame), XINT (x), XINT (y));
#else
#if defined (MSDOS)
if (FRAME_MSDOS_P (XFRAME (frame)))
/* Return the value of frame parameter PROP in frame FRAME. */
#ifdef HAVE_WINDOW_SYSTEM
-#if !HAVE_NS && !HAVE_NTGUI
-static
-#endif
Lisp_Object
get_frame_param (register struct frame *frame, Lisp_Object prop)
{
without messing up the symbol's status. */
if (SYMBOLP (prop))
{
- struct Lisp_Symbol *sym = XSYMBOL (prop);
+ sym_t sym = XSYMBOL (prop);
start:
- switch (sym->redirect)
+ switch (SYMBOL_REDIRECT (sym))
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break;
case SYMBOL_LOCALIZED:
- { struct Lisp_Buffer_Local_Value *blv = sym->val.blv;
+ { struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
if (blv->frame_local && blv_found (blv) && XFRAME (blv->where) == f)
swap_in_global_binding (sym);
break;
/* If both of these parameters are present, it's more efficient to
set them both at once. So we wait until we've looked at the
entire list before we set them. */
- int width, height;
+ int width = 0, height = 0;
bool width_change = 0, height_change = 0;
/* Same here. */
#endif /* HAVE_WINDOW_SYSTEM */
void
-frame_make_pointer_invisible (void)
+frame_make_pointer_invisible (struct frame *f)
{
if (! NILP (Vmake_pointer_invisible))
{
- struct frame *f;
- if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame)))
- return;
-
- f = SELECTED_FRAME ();
- if (f && !f->pointer_invisible
+ if (f && FRAME_LIVE_P (f) && !f->pointer_invisible
&& FRAME_TERMINAL (f)->toggle_invisible_pointer_hook)
{
f->mouse_moved = 0;
}
void
-frame_make_pointer_visible (void)
+frame_make_pointer_visible (struct frame *f)
{
/* We don't check Vmake_pointer_invisible here in case the
pointer was invisible when Vmake_pointer_invisible was set to nil. */
- struct frame *f;
-
- if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame)))
- return;
-
- f = SELECTED_FRAME ();
- if (f && f->pointer_invisible && f->mouse_moved
+ if (f && FRAME_LIVE_P (f) && f->pointer_invisible && f->mouse_moved
&& FRAME_TERMINAL (f)->toggle_invisible_pointer_hook)
{
FRAME_TERMINAL (f)->toggle_invisible_pointer_hook (f, 0);
void
syms_of_frame (void)
{
+#include "frame.x"
+
DEFSYM (Qframep, "framep");
DEFSYM (Qframe_live_p, "frame-live-p");
DEFSYM (Qexplicit_name, "explicit-name");
frame_resize_pixelwise = 0;
staticpro (&Vframe_list);
-
- defsubr (&Sframep);
- defsubr (&Sframe_live_p);
- defsubr (&Swindow_system);
- defsubr (&Smake_terminal_frame);
- defsubr (&Shandle_switch_frame);
- defsubr (&Sselect_frame);
- defsubr (&Sselected_frame);
- defsubr (&Sframe_list);
- defsubr (&Snext_frame);
- defsubr (&Sprevious_frame);
- defsubr (&Slast_nonminibuf_frame);
- defsubr (&Sdelete_frame);
- defsubr (&Smouse_position);
- defsubr (&Smouse_pixel_position);
- defsubr (&Sset_mouse_position);
- defsubr (&Sset_mouse_pixel_position);
-#if 0
- defsubr (&Sframe_configuration);
- defsubr (&Srestore_frame_configuration);
-#endif
- defsubr (&Smake_frame_visible);
- defsubr (&Smake_frame_invisible);
- defsubr (&Siconify_frame);
- defsubr (&Sframe_visible_p);
- defsubr (&Svisible_frame_list);
- defsubr (&Sraise_frame);
- defsubr (&Slower_frame);
- defsubr (&Sx_focus_frame);
- defsubr (&Sredirect_frame_focus);
- defsubr (&Sframe_focus);
- defsubr (&Sframe_parameters);
- defsubr (&Sframe_parameter);
- defsubr (&Smodify_frame_parameters);
- defsubr (&Sframe_char_height);
- defsubr (&Sframe_char_width);
- defsubr (&Sframe_pixel_height);
- defsubr (&Sframe_pixel_width);
- defsubr (&Sframe_text_cols);
- defsubr (&Sframe_text_lines);
- defsubr (&Sframe_total_cols);
- defsubr (&Sframe_text_width);
- defsubr (&Sframe_text_height);
- defsubr (&Sscroll_bar_width);
- defsubr (&Sfringe_width);
- defsubr (&Sborder_width);
- defsubr (&Sright_divider_width);
- defsubr (&Sbottom_divider_width);
- defsubr (&Stool_bar_pixel_width);
- defsubr (&Sset_frame_height);
- defsubr (&Sset_frame_width);
- defsubr (&Sset_frame_size);
- defsubr (&Sset_frame_position);
- defsubr (&Sframe_pointer_visible_p);
-
-#ifdef HAVE_WINDOW_SYSTEM
- defsubr (&Sx_get_resource);
- defsubr (&Sx_parse_geometry);
-#endif
-
}