Commit c8937ab9 authored by Joakim Verona's avatar Joakim Verona

ifdef guarding of xwidget code. not complete

parent e9a96749
......@@ -291,9 +291,10 @@ enum glyph_type
/* 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
};
......@@ -436,7 +437,9 @@ struct glyph
/* Image ID for image glyphs (type == IMAGE_GLYPH). */
int img_id;
#ifdef HAVE_XWIDGETS
struct xwidget* xwidget;
#endif
/* Sub-structure for type == STRETCH_GLYPH. */
struct
{
......@@ -1303,8 +1306,9 @@ struct glyph_string
/* Image, if any. */
struct image *img;
#ifdef HAVE_XWIDGETS
struct xwidget* xwidget;
#endif
/* Slice */
struct glyph_slice slice;
......@@ -1987,7 +1991,9 @@ enum display_element_type
/* Continuation glyphs. See the comment for IT_TRUNCATION. */
IT_CONTINUATION,
#ifdef HAVE_XWIDGETS
IT_XWIDGET
#endif
};
......@@ -2051,7 +2057,9 @@ enum it_method {
GET_FROM_C_STRING,
GET_FROM_IMAGE,
GET_FROM_STRETCH,
#ifdef HAVE_XWIDGETS
GET_FROM_XWIDGET,
#endif
NUM_IT_METHODS
};
......@@ -2265,12 +2273,13 @@ struct it
struct {
Lisp_Object object;
} stretch;
#ifdef HAVE_XWIDGETS
/* method == GET_FROM_XWIDGET */
struct {
Lisp_Object object;
struct xwidget* xwidget;
} xwidget;
#endif
} u;
/* current text and display positions. */
......@@ -2393,9 +2402,10 @@ struct it
/* If what == IT_IMAGE, the id of the image to display. */
int image_id;
#ifdef HAVE_XWIDGETS
/* If what == IT_XWIDGET*/
struct xwidget* xwidget;
#endif
/* Values from `slice' property. */
struct it_slice slice;
......
......@@ -3702,9 +3702,9 @@ update_window (struct window *w, int force_p)
add_window_display_history (w, w->current_matrix->method, paused_p);
#endif
// if ((XWINDOW(FRAME_SELECTED_WINDOW (SELECTED_FRAME()))) == (w))
#ifdef HAVE_XWIDGETS
xwidget_end_redisplay(w, w->current_matrix);
#endif
clear_glyph_matrix (desired_matrix);
return paused_p;
......
......@@ -48,7 +48,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "buffer.h"
#include "window.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
#include "systty.h"
#include "blockinput.h"
#include "syssignal.h"
......@@ -1529,7 +1531,9 @@ 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 ();
......
......@@ -27,7 +27,9 @@ 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
struct _EmacsFixedPrivate
{
struct frame *f;
......@@ -42,6 +44,7 @@ static void emacs_fixed_get_preferred_height (GtkWidget *widget,
gint *natural);
G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED)
#ifdef HAVE_XWIDGETS
/* void aloc_callback(GtkWidget* child, GtkWidget* fixed){ */
/* GtkAllocation child_allocation; */
/* GtkRequisition child_requisition; */
......@@ -154,7 +157,7 @@ static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget,
}
#endif
static void
emacs_fixed_class_init (EmacsFixedClass *klass)
......@@ -167,7 +170,9 @@ emacs_fixed_class_init (EmacsFixedClass *klass)
widget_class->get_preferred_width = emacs_fixed_get_preferred_width;
widget_class->get_preferred_height = emacs_fixed_get_preferred_height;
#ifdef HAVE_XWIDGETS
widget_class->size_allocate = emacs_fixed_gtk_widget_size_allocate;
#endif
g_type_class_add_private (klass, sizeof (EmacsFixedPrivate));
}
......
......@@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "window.h"
#include "blockinput.h"
#include "region-cache.h"
#include "xwidget.h"
#ifndef NULL
#define NULL 0
......
......@@ -329,7 +329,9 @@ static Lisp_Object Qsave_session;
#ifdef HAVE_DBUS
static Lisp_Object Qdbus_event;
#endif
#ifdef HAVE_XWIDGETS
Lisp_Object Qxwidget_event;
#endif
static Lisp_Object Qconfig_changed_event;
/* Lisp_Object Qmouse_movement; - also an event header */
......@@ -4029,7 +4031,14 @@ kbd_buffer_get_event (KBOARD **kbp,
kbd_fetch_ptr = event + 1;
}
#endif
else if (event->kind == CONFIG_CHANGED_EVENT || event->kind == XWIDGET_EVENT)
#ifdef HAVE_XWIDGETS
else if (event->kind == XWIDGET_EVENT)
{
obj = make_lispy_event (event);
kbd_fetch_ptr = event + 1;
}
#endif
else if (event->kind == CONFIG_CHANGED_EVENT)
{
obj = make_lispy_event (event);
kbd_fetch_ptr = event + 1;
......@@ -5924,12 +5933,13 @@ make_lispy_event (struct input_event *event)
return Fcons (Qdbus_event, event->arg);
}
#endif /* HAVE_DBUS */
#ifdef HAVE_XWIDGETS
case XWIDGET_EVENT:
{
printf("cool, an xwidget event arrived in make_lispy_event!\n");
return Fcons (Qxwidget_event,event->arg);
}
#endif
case CONFIG_CHANGED_EVENT:
return Fcons (Qconfig_changed_event,
Fcons (event->arg,
......@@ -11542,10 +11552,10 @@ syms_of_keyboard (void)
DEFSYM (Qdbus_event, "dbus-event");
#endif
#ifdef HAVE_XWIDGETS
Qxwidget_event = intern ("xwidget-event");
staticpro (&Qxwidget_event);
#endif
DEFSYM (QCenable, ":enable");
DEFSYM (QCvisible, ":visible");
DEFSYM (QChelp, ":help");
......
......@@ -405,8 +405,10 @@ enum pvec_type
PVEC_SUB_CHAR_TABLE = 0x100000,
PVEC_FONT = 0x200000,
PVEC_OTHER = 0x400000,
#ifdef HAVE_XWIDGETS
PVEC_XWIDGET = 0x800000,
PVEC_XWIDGET_VIEW = 0x1000000,
#endif
PVEC_TYPE_MASK = 0x3fffe00
#if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to
......
......@@ -36,8 +36,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "blockinput.h"
#include "termhooks.h" /* For struct terminal. */
#include "font.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
Lisp_Object Qstandard_output;
static Lisp_Object Qtemp_buffer_setup_hook;
......@@ -1759,11 +1760,13 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun);
PRINTCHAR ('>');
}
#ifdef HAVE_XWIDGETS
else if (XXWIDGETP (obj))
{
strout ("#<xwidget ", -1, -1, printcharfun);
PRINTCHAR ('>');
}
#endif
else if (WINDOWP (obj))
{
strout ("#<window ", -1, -1, printcharfun);
......
......@@ -205,9 +205,10 @@ enum event_kind
/* Non-key system events (e.g. application menu events) */
, NS_NONKEY_EVENT
#endif
/* events generated by xwidgets*/
#ifdef HAVE_XWIDGETS
/* events generated by xwidgets*/
, XWIDGET_EVENT
#endif
};
/* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
......
......@@ -49,8 +49,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_NS
#include "nsterm.h"
#endif
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
Lisp_Object Qwindowp, Qwindow_live_p;
static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer;
static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
......@@ -3934,7 +3935,9 @@ 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);
windows_or_buffers_changed++;
......
......@@ -313,8 +313,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#include "font.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
#ifndef FRAME_X_OUTPUT
#define FRAME_X_OUTPUT(f) ((f)->output_data.x)
#endif
......@@ -884,7 +885,9 @@ static int next_element_from_c_string (struct it *);
static int next_element_from_buffer (struct it *);
static int next_element_from_composition (struct it *);
static int next_element_from_image (struct it *);
#ifdef HAVE_XWIDGETS
static int next_element_from_xwidget(struct it *);
#endif
static int next_element_from_stretch (struct it *);
static void load_overlay_strings (struct it *, EMACS_INT);
static int init_from_display_pos (struct it *, struct window *,
......@@ -4129,7 +4132,9 @@ handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
if (CONSP (spec)
/* Simple specerties. */
&& !EQ (XCAR (spec), Qimage)
#ifdef HAVE_XWIDGETS
&& !EQ (XCAR (spec), Qxwidget)
#endif
&& !EQ (XCAR (spec), Qspace)
&& !EQ (XCAR (spec), Qwhen)
&& !EQ (XCAR (spec), Qslice)
......@@ -4548,7 +4553,10 @@ 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))
|| XWIDGETP(value));
#ifdef HAVE_XWIDGETS
|| XWIDGETP(value)
#endif
);
if (valid_p && !display_replaced_p)
{
......@@ -4612,6 +4620,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
it->object = value;
*position = it->position = start_pos;
}
#ifdef HAVE_XWIDGETS
else if (XWIDGETP(value))
{
//printf("handle_single_display_spec: im an xwidget!!\n");
......@@ -4623,8 +4632,9 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
it->xwidget = lookup_xwidget(value);
}
#endif
#ifdef HAVE_WINDOW_SYSTEM
else //if nothing else, its an image
else
{
it->what = IT_IMAGE;
it->image_id = lookup_image (it->f, value);
......@@ -5338,9 +5348,11 @@ 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
}
p->position = position ? *position : it->position;
p->current = it->current;
......@@ -5433,9 +5445,11 @@ 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;
......@@ -6031,8 +6045,10 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) =
next_element_from_string,
next_element_from_c_string,
next_element_from_image,
next_element_from_stretch,
next_element_from_xwidget
next_element_from_stretch
#ifdef HAVE_XWIDGETS
,next_element_from_xwidget
#endif
};
#define GET_NEXT_DISPLAY_ELEMENT(it) (*get_next_element[(it)->method]) (it)
......@@ -6832,7 +6848,9 @@ set_iterator_to_next (struct it *it, int 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,
if the `display' property takes up the whole string. */
......@@ -7259,6 +7277,7 @@ next_element_from_image (struct it *it)
return 1;
}
#ifdef HAVE_XWIDGETS
/* im not sure about this FIXME JAVE*/
static int
next_element_from_xwidget (struct it *it)
......@@ -7269,7 +7288,7 @@ next_element_from_xwidget (struct it *it)
//printf("xwidget_id %d: in next_element_from_xwidget: FIXME \n", it->xwidget_id);
return 1;
}
#endif
/* Fill iterator IT with next display element from a stretch glyph
......@@ -17206,6 +17225,7 @@ 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,
......@@ -17227,6 +17247,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
// printf("dump xwidget glyph\n");
}
#endif
}
......@@ -17600,10 +17621,7 @@ static void
compute_line_metrics (struct it *it)
{
struct glyph_row *row = it->glyph_row;
if(row->used[TEXT_AREA] > 1000){
printf("compute_line_metrics %d %d %d\n", row->used[TEXT_AREA], it->f->text_cols, row->end.pos.charpos);
printf("row->used[TEXT_AREA] seems weirdly big! emacs will crash soon\n");
}
if (FRAME_WINDOW_P (it->f))
{
int i, min_y, max_y;
......@@ -21332,12 +21350,13 @@ 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_p (prop))
{
printf("calc_pixel_width_or_height: return dummy size FIXME\n");
return OK_PIXELS (width_p ? 100 : 100);
}
#endif
#endif
if (EQ (car, Qplus) || EQ (car, Qminus))
{
......@@ -21832,6 +21851,7 @@ fill_image_glyph_string (struct glyph_string *s)
s->ybase += s->first_glyph->voffset;
}
#ifdef HAVE_XWIDGETS
static void
fill_xwidget_glyph_string (struct glyph_string *s)
{
......@@ -21844,7 +21864,7 @@ fill_xwidget_glyph_string (struct glyph_string *s)
s->xwidget = s->first_glyph->u.xwidget;
//assert_valid_xwidget_id ( s->xwidget, "fill_xwidget_glyph_string");
}
#endif
/* Fill glyph string S from a sequence of stretch glyphs.
START is the index of the first glyph to consider,
......@@ -22176,6 +22196,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
} \
while (0)
#ifdef HAVE_XWIDGETS
#define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
do \
{ \
......@@ -22188,7 +22209,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
s->x = (X); \
} \
while (0)
#endif
/* Add a glyph string for a sequence of character glyphs to the list
......@@ -22348,7 +22369,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
BUILD_XWIDGET_GLYPH_STRING (START, END, HEAD, TAIL, \
HL, X, LAST_X); \
break; \
\
\
\
case GLYPHLESS_GLYPH: \
BUILD_GLYPHLESS_GLYPH_STRING (START, END, HEAD, TAIL, \
......@@ -22960,6 +22981,7 @@ produce_image_glyph (struct it *it)
}
}
#ifdef HAVE_XWIDGETS
static void
produce_xwidget_glyph (struct it *it)
{
......@@ -23041,7 +23063,7 @@ produce_xwidget_glyph (struct it *it)
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
......@@ -24215,9 +24237,10 @@ 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
because this isn't true for images with `:ascent 100'. */
......@@ -24579,10 +24602,12 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
if (!w->cursor_off_p)
{
#ifdef HAVE_XWIDGETS
if (glyph != NULL && glyph->type == XWIDGET_GLYPH){
printf("attempt xwidget cursor avoidance in get_window_cursor_type\n");
return NO_CURSOR;
}
#endif
if (glyph != NULL && glyph->type == IMAGE_GLYPH)
{
if (cursor_type == FILLED_BOX_CURSOR)
......
......@@ -62,7 +62,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "coding.h"
#include "frame.h"
#include "dispextern.h"
#ifdef HAVE_XWIDGETS
#include "xwidget.h"
#endif
#include "fontset.h"
#include "termhooks.h"
#include "termopts.h"
......@@ -2680,13 +2682,13 @@ x_draw_glyph_string (struct glyph_string *s)
case IMAGE_GLYPH:
x_draw_image_glyph_string (s);
break;
#ifdef HAVE_XWIDGETS
case XWIDGET_GLYPH:
//erase xwidget background
x_draw_glyph_string_background (s, 0);
x_draw_xwidget_glyph_string (s);
break;
#endif
case STRETCH_GLYPH:
x_draw_stretch_glyph_string (s);
break;
......@@ -7255,10 +7257,12 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
cursor_glyph = get_phys_cursor_glyph (w);
if (cursor_glyph == NULL)
return;
#ifdef HAVE_XWIDGETS
if (cursor_glyph->type == XWIDGET_GLYPH){
printf("tried avoiding xwidget cursor\n");
return; //experimental avoidance of cursor on xwidget
}
#endif
/* 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
the bar might not be in the window. */
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment