Commit 7c3d742c authored by Paul Eggert's avatar Paul Eggert

xwidgets style cleanup

Adjust the newly-added Xwidgets code so that it uses a more-typical
Emacs style.  This should not affect behavior, except that in
a few places it adds runtime checks that Lisp arguments are of
the proper type, and in one place it uses more-precise arithmetic.
* src/buffer.c, src/dispnew.c, src/emacs.c, src/emacsgtkfixed.c:
* src/emacs.c, src/print.c, src/window.c, src/xdisp.c, src/xterm.c:
Include xwidget.h unconditionally.
* src/buffer.c (Fkill_buffer):
* src/dispnew.c (update_window):
* src/emacs.c (main):
* src/print.c (print_object):
* src/window.c (Fdelete_window_internal):
* src/xdisp.c (handle_single_display_spec, push_it, pop_it)
(get_next_element, set_iterator_to_next, next_element_from_xwidget)
(dump_glyph, calc_pixel_width_or_height, BUILD_GLYPH_STRINGS_XW)
(BUILD_GLYPH_STRINGS, x_produce_glyphs, get_window_cursor_type):
* src/xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
Call xwidget functions and macros without worrying about
HAVE_XWIDGETS when the code is a no-op on non-xwidget
platforms.
* src/dispextern.h (XWIDGET_GLYPH, struct glyph_string.xwidget)
(IT_XWIDGET, GET_FROM_XWIDGET, struct it.u.xwidget)
(struct it.xwidget):
* src/lisp.h (PVEC_XWIDGET, PVEC_XWIDGET_VIEW):
Always define.
* src/emacsgtkfixed.h: Omit unnecessary comment.
* src/keyboard.c: Fix spacing.
* src/xdisp.c (BUILD_XWIDGET_GLYPH_STRING, produce_xwidget_glyph):
Define to be a no-op if not HAVE_XWIDGETS.
* src/xwidget.c: Include xwidget.h first (after config.h)
to make sure that it can stand by itself.
(Fmake_xwidget, Fxwidget_webkit_execute_script):
Fix typo in doc string.
(Fmake_xwidget): Check type of args.
(Fmake_xwidget, offscreen_damage_event)
(webkit_document_load_finished_cb, webkit_download_cb)
(webkit_new_window_policy_decision_requested_cb)
(webkit_navigation_policy_decision_requested_cb)
(xwidget_osr_draw_cb, xwidget_osr_event_forward)
(xwidget_osr_event_set_embedder, xwidget_init_view):
Omit unnecessary casts.
* src/xwidget.c (Fmake_xwidget, xwidget_hidden)
(xwidget_show_view, xwidget_hide_view)
(x_draw_xwidget_glyph_string, xwidget_start_redisplay, xwidget_touch)
(xwidget_touched):
* src/xwidget.h (struct xwidget.kill_without_query)
(struct xwidget_view.redisplayed, struct xwidget_view.hidden):
Use bool for boolean.
* src/xwidget.c (store_xwidget_event_string, Fxwidget_size_request):
Simplify by using list functions.
(WEBKIT_FN_INIT): Omit unnecessary test for nil.
(Fxwidget_resize): Check type of integer args
before doing any work.  Check that they are nonnegative.
(Fxwidget_set_adjustment): Check type of integer arg.
Avoid redundant call to gtk_scrolled_window_get_vadjustment.
Simplify.  Use double, not float.
(Fxwidget_info, Fxwidget_view_info): Simplify by using CALLN.
(valid_xwidget_spec_p): Simplify.
(xwidget_spec_value): Omit unused arg FOUND.  All callers changed.
* src/xwidget.h: Include lisp.h first, so that includers do
not need to worry about doing that before including this file.
Make this .h file safe to include even on non-HAVE_XWIDGETS
configurations, to simplify the includers.
(x_draw_xwidget_glyph_string, syms_of_xwidget, valid_xwidget_spec_p)
(xwidget_end_redisplay, lookup_xwidget)
(xwidget_view_delete_all_in_window, kill_buffer_xwidgets):
Now a no-op if !HAVE_XWIDGETS, to simplify callers.
(struct glyph_matrix, struct glyph_string, struct xwidget)
(struct xwidget_view, struct window):
New forward or incomplete decls, so that includers need not
assume the corresponding .h files are already included, or that
HAVE_XWIDGETS is defined.
(struct xwidget_type, xwidget_from_id): Remove; unused.
parent 7bf54d01
......@@ -42,10 +42,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "blockinput.h"
#include "keymap.h"
#include "frame.h"
#include "xwidget.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#ifdef WINDOWSNT
#include "w32heap.h" /* for mmap_* */
#endif
......@@ -1749,10 +1747,8 @@ cleaning up all windows currently displaying the buffer to be killed. */)
unlock_buffer (b);
kill_buffer_processes (buffer);
#ifdef HAVE_XWIDGETS
kill_buffer_xwidgets (buffer);
#endif
/* Killing buffer processes may run sentinels which may have killed
our buffer. */
if (!BUFFER_LIVE_P (b))
......
......@@ -347,11 +347,10 @@ enum glyph_type
IMAGE_GLYPH,
/* Glyph is a space of fractional width and/or height. */
STRETCH_GLYPH
#ifdef HAVE_XWIDGETS
/* Glyph is an external widget drawn by the GUI toolkit. */
,XWIDGET_GLYPH
#endif
STRETCH_GLYPH,
/* Glyph is an external widget drawn by the GUI toolkit. */
XWIDGET_GLYPH
};
......@@ -504,8 +503,10 @@ struct glyph
int img_id;
#ifdef HAVE_XWIDGETS
/* Xwidget reference (type == XWIDGET_GLYPH). */
struct xwidget *xwidget;
#endif
/* Sub-structure for type == STRETCH_GLYPH. */
struct
{
......@@ -1357,9 +1358,9 @@ struct glyph_string
/* Image, if any. */
struct image *img;
#ifdef HAVE_XWIDGETS
/* Xwidget. */
struct xwidget *xwidget;
#endif
/* Slice */
struct glyph_slice slice;
......@@ -2111,11 +2112,10 @@ enum display_element_type
IT_TRUNCATION,
/* Continuation glyphs. See the comment for IT_TRUNCATION. */
IT_CONTINUATION
IT_CONTINUATION,
#ifdef HAVE_XWIDGETS
,IT_XWIDGET
#endif
/* Xwidget. */
IT_XWIDGET
};
......@@ -2179,9 +2179,7 @@ enum it_method {
GET_FROM_C_STRING,
GET_FROM_IMAGE,
GET_FROM_STRETCH,
#ifdef HAVE_XWIDGETS
GET_FROM_XWIDGET,
#endif
NUM_IT_METHODS
};
......@@ -2399,12 +2397,10 @@ struct it
struct {
Lisp_Object object;
} stretch;
#ifdef HAVE_XWIDGETS
/* method == GET_FROM_XWIDGET */
struct {
Lisp_Object object;
} xwidget;
#endif
} u;
/* Current text and display positions. */
......@@ -2529,10 +2525,8 @@ struct it
/* If what == IT_IMAGE, the id of the image to display. */
ptrdiff_t image_id;
#ifdef HAVE_XWIDGETS
/* If what == IT_XWIDGET. */
struct xwidget *xwidget;
#endif
/* Values from `slice' property. */
struct it_slice slice;
......
......@@ -39,15 +39,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "syssignal.h"
#include "systime.h"
#include "tparam.h"
#include "xwidget.h"
#ifdef HAVE_WINDOW_SYSTEM
#include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include <errno.h>
#include <fpending.h>
......@@ -3549,9 +3546,7 @@ update_window (struct window *w, bool force_p)
add_window_display_history (w, w->current_matrix->method, paused_p);
#endif
#ifdef HAVE_XWIDGETS
xwidget_end_redisplay (w, w->current_matrix);
#endif
clear_glyph_matrix (desired_matrix);
return paused_p;
......
......@@ -65,10 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "character.h"
#include "buffer.h"
#include "window.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include "xwidget.h"
#include "atimer.h"
#include "blockinput.h"
#include "syssignal.h"
......@@ -1492,9 +1489,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
syms_of_xfns ();
syms_of_xmenu ();
syms_of_fontset ();
#ifdef HAVE_XWIDGETS
syms_of_xwidget ();
#endif
syms_of_xsettings ();
#ifdef HAVE_X_SM
syms_of_xsmfns ();
......
......@@ -23,9 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
#include "frame.h"
#include "xterm.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include "xwidget.h"
#include "emacsgtkfixed.h"
/* Silence a bogus diagnostic; see GNOME bug 683906. */
......@@ -50,7 +48,6 @@ static void emacs_fixed_get_preferred_width (GtkWidget *widget,
static void emacs_fixed_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
static GType emacs_fixed_get_type (void);
G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED)
......@@ -75,28 +72,28 @@ struct GtkFixedPrivateL
GList *children;
};
static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
static void
emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
// For xwidgets.
/* For xwidgets.
// This basically re-implements the base class method and adds an
// additional case for an xwidget view.
This basically re-implements the base class method and adds an
additional case for an xwidget view.
// It would be nicer if the bse class method could be called first,
// and the the xview modification only would remain here. It wasn't
// possible to solve it that way yet.
It would be nicer if the bse class method could be called first,
and the the xview modification only would remain here. It wasn't
possible to solve it that way yet. */
EmacsFixedClass *klass;
GtkWidgetClass *parent_class;
struct GtkFixedPrivateL* priv;
struct GtkFixedPrivateL *priv;
klass = EMACS_FIXED_GET_CLASS (widget);
parent_class = g_type_class_peek_parent (klass);
parent_class->size_allocate (widget, allocation);
priv = G_TYPE_INSTANCE_GET_PRIVATE (widget,
GTK_TYPE_FIXED,
struct GtkFixedPrivateL);
priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, GTK_TYPE_FIXED,
struct GtkFixedPrivateL);
gtk_widget_set_allocation (widget, allocation);
......@@ -154,7 +151,6 @@ emacs_fixed_class_init (EmacsFixedClass *klass)
widget_class = (GtkWidgetClass*) klass;
widget_class->get_preferred_width = emacs_fixed_get_preferred_width;
widget_class->get_preferred_height = emacs_fixed_get_preferred_height;
#ifdef HAVE_XWIDGETS
......@@ -163,7 +159,6 @@ emacs_fixed_class_init (EmacsFixedClass *klass)
g_type_class_add_private (klass, sizeof (EmacsFixedPrivate));
}
static void
emacs_fixed_init (EmacsFixed *fixed)
{
......@@ -172,14 +167,7 @@ emacs_fixed_init (EmacsFixed *fixed)
fixed->priv->f = 0;
}
/**
* emacs_fixed_new:
*
* Creates a new #EmacsFixed.
*
* Returns: a new #EmacsFixed.
*/
GtkWidget*
GtkWidget *
emacs_fixed_new (struct frame *f)
{
EmacsFixed *fixed = g_object_new (emacs_fixed_get_type (), NULL);
......
......@@ -29,7 +29,6 @@ G_BEGIN_DECLS
struct frame;
//typedef struct _EmacsFixed EmacsFixed;
typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
typedef struct _EmacsFixedClass EmacsFixedClass;
......@@ -41,7 +40,6 @@ struct _EmacsFixed
EmacsFixedPrivate *priv;
};
struct _EmacsFixedClass
{
GtkFixedClass parent_class;
......
......@@ -5960,7 +5960,7 @@ make_lispy_event (struct input_event *event)
#ifdef HAVE_XWIDGETS
case XWIDGET_EVENT:
{
return Fcons (Qxwidget_event,event->arg);
return Fcons (Qxwidget_event, event->arg);
}
#endif
......@@ -10972,7 +10972,7 @@ syms_of_keyboard (void)
#endif
#ifdef HAVE_XWIDGETS
DEFSYM (Qxwidget_event,"xwidget-event");
DEFSYM (Qxwidget_event, "xwidget-event");
#endif
#ifdef USE_FILE_NOTIFY
......
......@@ -799,11 +799,8 @@ enum pvec_type
PVEC_WINDOW_CONFIGURATION,
PVEC_SUBR,
PVEC_OTHER,
#ifdef HAVE_XWIDGETS
PVEC_XWIDGET,
PVEC_XWIDGET_VIEW,
#endif
/* These should be last, check internal_equal to see why. */
PVEC_COMPILED,
......
......@@ -32,10 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "disptab.h"
#include "intervals.h"
#include "blockinput.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include "xwidget.h"
#include <c-ctype.h>
#include <float.h>
......@@ -1740,18 +1737,11 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
print_c_string (XSUBR (obj)->symbol_name, printcharfun);
printchar ('>', printcharfun);
}
#ifdef HAVE_XWIDGETS
else if (XWIDGETP (obj))
else if (XWIDGETP (obj) || XWIDGET_VIEW_P (obj))
{
print_c_string ("#<xwidget ", printcharfun);
printchar ('>', printcharfun);
}
else if (XWIDGET_VIEW_P (obj))
{
print_c_string ("#<xwidget ", printcharfun);
printchar ('>', printcharfun);
}
#endif
else if (WINDOWP (obj))
{
int len = sprintf (buf, "#<window %"pI"d",
......
......@@ -35,15 +35,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "dispextern.h"
#include "blockinput.h"
#include "termhooks.h" /* For FRAME_TERMINAL. */
#include "xwidget.h"
#ifdef HAVE_WINDOW_SYSTEM
#include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */
#ifdef MSDOS
#include "msdos.h"
#endif
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
static ptrdiff_t count_windows (struct window *);
static ptrdiff_t get_leaf_windows (struct window *, struct window **,
......@@ -4373,9 +4371,7 @@ Signal an error when WINDOW is the only window on its frame. */)
/* Block input. */
block_input ();
#ifdef HAVE_XWIDGETS
xwidget_view_delete_all_in_window (w);
#endif
window_resize_apply (p, horflag);
/* If this window is referred to by the dpyinfo's mouse
highlight, invalidate that slot to be safe (Bug#9904). */
......
......@@ -314,13 +314,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "font.h"
#include "fontset.h"
#include "blockinput.h"
#include "xwidget.h"
#ifdef HAVE_WINDOW_SYSTEM
#include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#ifndef FRAME_X_OUTPUT
#define FRAME_X_OUTPUT(f) ((f)->output_data.x)
#endif
......@@ -857,9 +855,7 @@ static bool next_element_from_buffer (struct it *);
static bool next_element_from_composition (struct it *);
static bool next_element_from_image (struct it *);
static bool next_element_from_stretch (struct it *);
#ifdef HAVE_XWIDGETS
static bool next_element_from_xwidget (struct it *);
#endif
static void load_overlay_strings (struct it *, ptrdiff_t);
static bool get_next_display_element (struct it *);
static enum move_it_result
......@@ -5147,11 +5143,8 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
&& valid_image_p (value))
#endif /* not HAVE_WINDOW_SYSTEM */
|| (CONSP (value) && EQ (XCAR (value), Qspace))
#ifdef HAVE_XWIDGETS
|| ((it ? FRAME_WINDOW_P (it->f) : frame_window_p)
&& valid_xwidget_spec_p (value))
#endif
);
&& valid_xwidget_spec_p (value)));
if (valid_p && display_replaced == 0)
{
......@@ -5226,17 +5219,15 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
*position = it->position = start_pos;
retval = 1 + (it->area == TEXT_AREA);
}
#ifdef HAVE_XWIDGETS
else if (valid_xwidget_spec_p(value))
else if (valid_xwidget_spec_p (value))
{
it->what = IT_XWIDGET;
it->method = GET_FROM_XWIDGET;
it->position = start_pos;
it->object = NILP (object) ? it->w->contents : object;
*position = start_pos;
it->xwidget = lookup_xwidget(value);
it->xwidget = lookup_xwidget (value);
}
#endif
#ifdef HAVE_WINDOW_SYSTEM
else
{
......@@ -5989,11 +5980,9 @@ push_it (struct it *it, struct text_pos *position)
case GET_FROM_STRETCH:
p->u.stretch.object = it->object;
break;
#ifdef HAVE_XWIDGETS
case GET_FROM_XWIDGET:
p->u.xwidget.object = it->object;
break;
#endif
case GET_FROM_BUFFER:
case GET_FROM_DISPLAY_VECTOR:
case GET_FROM_STRING:
......@@ -6095,11 +6084,9 @@ pop_it (struct it *it)
it->object = p->u.image.object;
it->slice = p->u.image.slice;
break;
#ifdef HAVE_XWIDGETS
case GET_FROM_XWIDGET:
it->object = p->u.xwidget.object;
break;
#endif
case GET_FROM_STRETCH:
it->object = p->u.stretch.object;
break;
......@@ -6775,9 +6762,7 @@ static next_element_function const get_next_element[NUM_IT_METHODS] =
next_element_from_c_string,
next_element_from_image,
next_element_from_stretch,
#ifdef HAVE_XWIDGETS
next_element_from_xwidget,
#endif
};
#define GET_NEXT_DISPLAY_ELEMENT(it) (*get_next_element[(it)->method]) (it)
......@@ -7638,9 +7623,7 @@ set_iterator_to_next (struct it *it, bool reseat_p)
case GET_FROM_IMAGE:
case GET_FROM_STRETCH:
#ifdef HAVE_XWIDGETS
case GET_FROM_XWIDGET:
#endif
/* The position etc with which we have to proceed are on
the stack. The position may be at the end of a string,
......@@ -8103,14 +8086,12 @@ next_element_from_image (struct it *it)
return true;
}
#ifdef HAVE_XWIDGETS
static bool
next_element_from_xwidget (struct it *it)
{
it->what = IT_XWIDGET;
return true;
}
#endif
/* Fill iterator IT with next display element from a stretch glyph
......@@ -18844,7 +18825,6 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
glyph->left_box_line_p,
glyph->right_box_line_p);
}
#ifdef HAVE_XWIDGETS
else if (glyph->type == XWIDGET_GLYPH)
{
fprintf (stderr,
......@@ -18865,7 +18845,6 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
glyph->right_box_line_p);
}
#endif
}
......@@ -24364,13 +24343,11 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
return OK_PIXELS (width_p ? img->width : img->height);
}
# ifdef HAVE_XWIDGETS
if (FRAME_WINDOW_P (it->f) && valid_xwidget_spec_p (prop))
{
// TODO: Don't return dummy size.
return OK_PIXELS (100);
}
# endif
#endif
if (EQ (car, Qplus) || EQ (car, Qminus))
{
......@@ -25273,8 +25250,11 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
} \
while (false)
#ifdef HAVE_XWIDGETS
#define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
#ifndef HAVE_XWIDGETS
# define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
eassume (false)
#else
# define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
do \
{ \
s = alloca (sizeof *s); \
......@@ -25287,7 +25267,6 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
while (false)
#endif
/* Add a glyph string for a sequence of character glyphs to the list
of strings between HEAD and TAIL. START is the index of the first
glyph in row area AREA of glyph row ROW that is part of the new
......@@ -25441,13 +25420,11 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
HL, X, LAST_X); \
break;
#ifdef HAVE_XWIDGETS
# define BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \
#define BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \
case XWIDGET_GLYPH: \
BUILD_XWIDGET_GLYPH_STRING (START, END, HEAD, TAIL, \
HL, X, LAST_X); \
break;
#endif
#define BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X) \
case GLYPHLESS_GLYPH: \
......@@ -25456,7 +25433,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
break; \
\
default: \
emacs_abort (); \
emacs_abort (); \
} \
\
if (s) \
......@@ -25468,16 +25445,10 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
} while (false)
#ifdef HAVE_XWIDGETS
# define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X) \
#define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X) \
BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X) \
BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \
BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X)
#else
# define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X) \
BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X) \
BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X)
#endif
/* Draw glyphs between START and END in AREA of ROW on window W,
......@@ -26118,10 +26089,10 @@ produce_image_glyph (struct it *it)
}
}
#ifdef HAVE_XWIDGETS
static void
produce_xwidget_glyph (struct it *it)
{
#ifdef HAVE_XWIDGETS
struct xwidget *xw;
int glyph_ascent, crop;
eassert (it->what == IT_XWIDGET);
......@@ -26219,8 +26190,8 @@ produce_xwidget_glyph (struct it *it)
else
IT_EXPAND_MATRIX_WIDTH (it, area);
}
}
#endif
}
/* Append a stretch glyph to IT->glyph_row. OBJECT is the source
of the glyph, WIDTH and HEIGHT are the width and height of the
......@@ -27631,10 +27602,8 @@ x_produce_glyphs (struct it *it)
produce_image_glyph (it);
else if (it->what == IT_STRETCH)
produce_stretch_glyph (it);
#ifdef HAVE_XWIDGETS
else if (it->what == IT_XWIDGET)
produce_xwidget_glyph (it);
#endif
done:
/* Accumulate dimensions. Note: can't assume that it->descent > 0
......@@ -28004,10 +27973,8 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
/* Use normal cursor if not blinked off. */
if (!w->cursor_off_p)
{
#ifdef HAVE_XWIDGETS
if (glyph != NULL && glyph->type == XWIDGET_GLYPH)
return NO_CURSOR;
#endif
if (glyph != NULL && glyph->type == IMAGE_GLYPH)
{
if (cursor_type == FILLED_BOX_CURSOR)
......
......@@ -62,9 +62,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "composite.h"
#include "frame.h"
#include "dispextern.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include "xwidget.h"
#include "fontset.h"
#include "termhooks.h"
#include "termopts.h"
......@@ -3514,11 +3512,9 @@ x_draw_glyph_string (struct glyph_string *s)
x_draw_image_glyph_string (s);
break;
#ifdef HAVE_XWIDGETS
case XWIDGET_GLYPH:
x_draw_xwidget_glyph_string (s);
break;
#endif
case STRETCH_GLYPH:
x_draw_stretch_glyph_string (s);
......@@ -8929,10 +8925,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
if (cursor_glyph == NULL)
return;
#ifdef HAVE_XWIDGETS
/* Experimental avoidance of cursor on xwidget. */
if (cursor_glyph->type == XWIDGET_GLYPH)
return; // Experimental avoidance of cursor on xwidget.
#endif
return;
/* If on an image, draw like a normal cursor. That's usually better
visible than drawing a bar, esp. if the image is large so that
......
This diff is collapsed.
......@@ -20,60 +20,62 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef XWIDGET_H_INCLUDED
#define XWIDGET_H_INCLUDED
void x_draw_xwidget_glyph_string (struct glyph_string *s);
void syms_of_xwidget (void);
//extern Lisp_Object Qxwidget;
#include "lisp.h"
struct glyph_matrix;
struct glyph_string;
struct xwidget;
struct xwidget_view;
struct window;
bool valid_xwidget_spec_p (Lisp_Object object);
#ifdef HAVE_XWIDGETS
# include <gtk/gtk.h>
#include <gtk/gtk.h>
struct xwidget
{
struct vectorlike_header header;
/* Auxiliary data. */
Lisp_Object plist;
/*
each xwidget instance/model is described by this struct.
/* The widget type. */
Lisp_Object type;
lisp pseudovector.
/* The buffer where the xwidget lives. */
Lisp_Object buffer;
/* A title used for button labels, for instance. */
Lisp_Object title;
*/
struct xwidget
{
struct vectorlike_header header;
Lisp_Object plist; //auxilliary data
Lisp_Object type; //the widget type
Lisp_Object buffer; //buffer where xwidget lives
Lisp_Object title; //a title that is used for button labels for instance
/* Here ends the Lisp part. "height" is the marker field. */
//here ends the lisp part.
//"height" is the marker field
int height;
int width;
//for offscreen widgets, unused if not osr
/* For offscreen widgets, unused if not osr. */
GtkWidget *widget_osr;
GtkWidget *widgetwindow_osr;
//this is used if the widget (webkit) is to be wrapped in a scrolled window,
/* Used if the widget (webkit) is to be wrapped in a scrolled window. */
GtkWidget *widgetscrolledwindow_osr;
/* Non-nil means kill silently if Emacs is exited. */
unsigned int kill_without_query:1;
/* Kill silently if Emacs is exited. */
bool_bf kill_without_query : 1;
};
//struct for each xwidget view
struct xwidget_view
{
struct vectorlike_header header;
Lisp_Object model;
Lisp_Object w;
//here ends the lisp part.
//"redisplayed" is the marker field
int redisplayed; //if touched by redisplay
/* Here ends the lisp part. "redisplayed" is the marker field. */
/* If touched by redisplay. */
bool redisplayed;
int hidden; //if the "live" instance isnt drawn
/* The "live" instance isn't drawn. */
bool hidden;
GtkWidget *widget;
GtkWidget *widgetwindow;
......@@ -85,48 +87,47 @@ struct xwidget_view
int clip_top;
int clip_left;
long handler_id;
};
#endif
/* Test for xwidget pseudovector*/
/* Test for xwidget pseudovector. */
#define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET)
#define XXWIDGET(a) (eassert (XWIDGETP(a)), \
(struct xwidget *) XUNTAG(a, Lisp_Vectorlike))
#define XXWIDGET(a) (eassert (XWIDGETP (a)), \
(struct xwidget *) XUNTAG (a, Lisp_Vectorlike))
#define CHECK_XWIDGET(x) \
CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x)
/* Test for xwidget_view pseudovector */
/* Test for xwidget_view pseudovector. */
#define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW)
#define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P(a)), \
(struct xwidget_view *) XUNTAG(a, Lisp_Vectorlike))
#define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P (a)), \
(struct xwidget_view *) XUNTAG (a, Lisp_Vectorlike))
#define CHECK_XWIDGET_VIEW(x) \
CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x)
struct xwidget_type
{
/* A symbol uniquely identifying the xwidget type, */
Lisp_Object *type;
/* Check that SPEC is a valid image specification for the given
image type. Value is non-zero if SPEC is valid. */
int (*valid_p) (Lisp_Object spec);
/* Next in list of all supported image types. */
struct xwidget_type *next;
};
struct xwidget *xwidget_from_id (int id);
void xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix);
struct xwidget *lookup_xwidget (Lisp_Object spec);
#define XG_XWIDGET "emacs_xwidget"
#define XG_XWIDGET_VIEW "emacs_xwidget_view"
void xwidget_view_delete_all_in_window (struct window *w);
void kill_buffer_xwidgets (Lisp_Object buffer);
#ifdef HAVE_XWIDGETS
void syms_of_xwidget (void);
bool valid_xwidget_spec_p (Lisp_Object);
void xwidget_view_delete_all_in_window (struct window *);
void x_draw_xwidget_glyph_string (struct glyph_string *);
struct xwidget *lookup_xwidget (Lisp_Object spec);
void xwidget_end_redisplay (struct window *, struct glyph_matrix *);
void kill_buffer_xwidgets (Lisp_Object);