#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h> /* CoreP.h needs this */
#include <X11/CoreP.h> /* foul, but we need this to use our own
- window inside a widget instead of one
+ window inside a widget instead of one
that Xt creates... */
#include <X11/StringDefs.h>
+
+typedef Widget xt_or_gtk_widget;
#endif
+#ifdef USE_GTK
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+/* Some definitions to reduce conditionals. */
+typedef GtkWidget *xt_or_gtk_widget;
+#define XtParent(x) (gtk_widget_get_parent (x))
+#undef XSync
+#define XSync(d, b) gdk_window_process_all_updates ()
+
+#endif /* USE_GTK */
+
/* The class of this X application. */
#define EMACS_CLASS "Emacs"
\f
#ifdef PBaseSize
/* AIX 3.1's X is somewhere between X11R3 and X11R4. It has
PBaseSize, but not XWithdrawWindow, XSetWMName, XSetWMNormalHints,
- XSetWMIconName.
+ XSetWMIconName.
AIX 3.2 is at least X11R4. */
#if (!defined AIX) || (defined AIX3_2)
#define HAVE_X11R4
| EnterWindowMask \
| VisibilityChangeMask)
-enum text_cursor_kinds
-{
- NO_CURSOR = -1,
- FILLED_BOX_CURSOR,
- HOLLOW_BOX_CURSOR,
- BAR_CURSOR,
- HBAR_CURSOR
-};
-
/* Structure recording X pixmap and reference count.
If REFCOUNT is 0 then this record is free to be reused. */
{
/* Chain of all x_display_info structures. */
struct x_display_info *next;
-
+
/* Connection number (normally a file descriptor number). */
int connection;
-
+
/* This says how to access this display in Xlib. */
Display *display;
-
+
/* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
The same cons cell also appears in x_display_name_list. */
Lisp_Object name_list_element;
-
+
/* Number of frames that are on this display. */
int reference_count;
-
+
/* The Screen this connection is connected to. */
Screen *screen;
/* Dots per inch of the screen. */
double resx, resy;
-
+
/* The Visual being used for this display. */
Visual *visual;
/* The colormap being used. */
Colormap cmap;
-
+
/* Number of panes on this screen. */
int n_planes;
-
+
/* Dimensions of this screen. */
int height, width;
-
+
/* Mask of things that cause the mouse to be grabbed. */
int grabbed;
-
+
/* Emacs bitmap-id of the default icon bitmap for this frame.
Or -1 if none has been allocated yet. */
int icon_bitmap_id;
-
+
/* The root window of this screen. */
Window root_window;
-
+
/* The cursor to use for vertical scroll bars. */
Cursor vertical_scroll_bar_cursor;
-
+
/* X Resource data base */
XrmDatabase xrdb;
/* Communication with window managers. */
Atom Xatom_wm_protocols;
-
+
/* Kinds of protocol things we may receive. */
Atom Xatom_wm_take_focus;
Atom Xatom_wm_save_yourself;
Atom Xatom_wm_delete_window;
-
+
/* Atom for indicating window state to the window manager. */
Atom Xatom_wm_change_state;
-
+
/* Other WM communication */
Atom Xatom_wm_configure_denied; /* When our config request is denied */
Atom Xatom_wm_window_moved; /* When the WM moves us. */
-
+
/* EditRes protocol */
Atom Xatom_editres;
/* More atoms, which are selection types. */
Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
- Xatom_COMPOUND_TEXT,
+ Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING,
Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
Xatom_ATOM_PAIR;
extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int));
-#ifdef USE_X_TOOLKIT
+#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int));
extern struct frame *x_non_menubar_window_to_frame P_ ((struct x_display_info *, int));
extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int));
if the menubar is turned off. */
int menubar_height;
+ /* Height of tool bar widget, in pixels.
+ Zero if not using an external tool bar. */
+ int toolbar_height;
+
/* Height of a line, in pixels. */
int line_height;
Widget menubar_widget;
#endif
+#ifdef USE_GTK
+ /* The widget of this screen. This is the window of a top widget. */
+ GtkWidget *widget;
+ /* The widget of the edit portion of this screen; the window in
+ "window_desc" is inside of this. */
+ GtkWidget *edit_widget;
+ /* The widget used for laying out widgets vertically. */
+ GtkWidget *vbox_widget;
+ /* The menubar in this frame. */
+ GtkWidget *menubar_widget;
+ /* The tool bar in this frame */
+ GtkWidget *toolbar_widget;
+ /* The handle box that makes the tool bar detachable. */
+ GtkWidget *handlebox_widget;
+
+ /* The last size hints set. */
+ GdkGeometry size_hints;
+ long hint_flags;
+#endif
+
/* If >=0, a bitmap index. The indicated bitmap is used for the
icon. */
int icon_bitmap;
/* Foreground color for scroll bars. A value of -1 means use the
default (black for non-toolkit scroll bars). */
unsigned long scroll_bar_foreground_pixel;
-
+
/* Background color for scroll bars. A value of -1 means use the
default (background color of the frame for non-toolkit scroll
bars). */
/* Window whose cursor is hourglass_cursor. This window is temporarily
mapped to display an hourglass cursor. */
Window hourglass_window;
-
+
/* Non-zero means hourglass cursor is currently displayed. */
unsigned hourglass_p : 1;
/* Flag to set when the X window needs to be completely repainted. */
int needs_exposure;
- /* What kind of text cursor is drawn in this window right now?
- (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */
- enum text_cursor_kinds current_cursor;
-
- /* What kind of text cursor should we draw in the future?
- This should always be filled_box_cursor or bar_cursor. */
- enum text_cursor_kinds desired_cursor;
-
- /* Width of bar cursor (if we are using that). */
- int cursor_width;
-
/* These are the current window manager hints. It seems that
XSetWMHints, when presented with an unset bit in the `flags'
member of the hints structure, does not leave the corresponding
/* As x_pixels_diff, but to FRAME_OUTER_WINDOW. For some reason the
two might differ by a pixel, depending on WM */
int x_pixels_outer_diff;
-
+
/* As y_pixels_diff, but to FRAME_OUTER_WINDOW. In the toolkit version,
these may differ because this does not take into account possible
menubar. y_pixels_diff is with menubar height included */
int y_pixels_outer_diff;
+
+ /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this
+ frame, or IMPLICIT if we received an EnterNotify.
+ FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
+ int focus_state;
};
enum
FULLSCREEN_MOVE_WAIT = 8,
};
+enum
+{
+ /* Values for focus_state, used as bit mask.
+ EXPLICIT means we received a FocusIn for the frame and know it has
+ the focus. IMPLICIT means we recevied an EnterNotify and the frame
+ may have the focus if no window manager is running.
+ FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
+ FOCUS_NONE = 0,
+ FOCUS_IMPLICIT = 1,
+ FOCUS_EXPLICIT = 2
+};
+
+
/* Return the X window used for displaying data in frame F. */
#define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc)
XtWindow ((f)->output_data.x->widget) : \
FRAME_X_WINDOW (f))
#else
+#ifdef USE_GTK
+#define GTK_WIDGET_TO_X_WIN(w) \
+ ((w) && (w)->window ? GDK_WINDOW_XWINDOW ((w)->window) : 0)
+
+#define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget)
+#define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget)
+#define FRAME_OUTER_WINDOW(f) \
+ (FRAME_GTK_OUTER_WIDGET (f) ? \
+ GTK_WIDGET_TO_X_WIN (FRAME_GTK_OUTER_WIDGET (f)) : \
+ FRAME_X_WINDOW (f))
+
+#else /* !USE_GTK */
#define FRAME_OUTER_WINDOW(f) (FRAME_X_WINDOW (f))
+#endif /* !USE_GTK */
#endif
+
#define FRAME_FONT(f) ((f)->output_data.x->font)
#define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
#define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.x->internal_border_width)
#define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
+#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.x->toolbar_height)
#define FRAME_LINE_HEIGHT(f) ((f)->output_data.x->line_height)
/* Width of the default font of frame F. Must be defined by each
#define PIXEL_WIDTH(f) ((f)->output_data.x->pixel_width)
#define PIXEL_HEIGHT(f) ((f)->output_data.x->pixel_height)
-#define FRAME_DESIRED_CURSOR(f) ((f)->output_data.x->desired_cursor)
+/* The difference in pixels between the top left corner of the
+ Emacs window (including possible window manager decorations)
+ and FRAME_X_WINDOW (f). */
+#define FRAME_OUTER_TO_INNER_DIFF_X(f) \
+ ((f)->output_data.x->x_pixels_outer_diff)
+#define FRAME_OUTER_TO_INNER_DIFF_Y(f) \
+ ((f)->output_data.x->y_pixels_outer_diff \
+ + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f))
+
#define FRAME_XIC(f) ((f)->output_data.x->xic)
#define FRAME_X_XIM(f) (FRAME_X_DISPLAY_INFO (f)->xim)
/* Return the length of the rectangle within which the top of the
handle must stay. This isn't equivalent to the inside height,
- because the scroll bar handle has a minimum height.
+ because the scroll bar handle has a minimum height.
This is the real range of motion for the scroll bar, so when we're
scaling buffer positions to scroll bar positions, we use this, not
+ (f)->output_data.x->internal_border_width)
-/* Return the row/column (zero-based) of the character cell containing
+/* Return the row/column (zero-based) of the character cell containing
the pixel on FRAME at ROW/COL. */
#define PIXEL_TO_CHAR_ROW(f, row) \
(((row) - (f)->output_data.x->internal_border_width) \
extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *,
int *, int *));
+extern int x_dispatch_event P_ ((XEvent *, Display *));
/* Defined in xselect.c */
extern int x_char_height P_ ((struct frame *));
extern int x_screen_planes P_ ((struct frame *));
extern void x_sync P_ ((struct frame *));
-extern enum text_cursor_kinds x_specified_cursor_type P_ ((Lisp_Object, int *));
extern int x_defined_color P_ ((struct frame *, char *, XColor *, int));
#ifdef HAVE_X_I18N
extern void free_frame_xic P_ ((struct frame *));