diff options
| author | Paul Eggert | 2016-01-30 11:28:37 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-01-30 11:28:37 -0800 |
| commit | 2b41d6a979b0ea361e078891b8763b4ae7be8092 (patch) | |
| tree | aef17169e9bf8e59baa82ec7df5c1b64139d9c9f /src | |
| parent | fe9c8b687c5121a413342024b62824a86d2de2be (diff) | |
| parent | 71468e00735a44e19814a73e8f9013c0f272c342 (diff) | |
| download | emacs-2b41d6a979b0ea361e078891b8763b4ae7be8092.tar.gz emacs-2b41d6a979b0ea361e078891b8763b4ae7be8092.zip | |
-
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 8 | ||||
| -rw-r--r-- | src/dispextern.h | 28 | ||||
| -rw-r--r-- | src/dispnew.c | 7 | ||||
| -rw-r--r-- | src/emacs.c | 7 | ||||
| -rw-r--r-- | src/emacsgtkfixed.c | 40 | ||||
| -rw-r--r-- | src/emacsgtkfixed.h | 2 | ||||
| -rw-r--r-- | src/gtkutil.c | 28 | ||||
| -rw-r--r-- | src/image.c | 67 | ||||
| -rw-r--r-- | src/keyboard.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 3 | ||||
| -rw-r--r-- | src/print.c | 14 | ||||
| -rw-r--r-- | src/sysdep.c | 2 | ||||
| -rw-r--r-- | src/window.c | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 66 | ||||
| -rw-r--r-- | src/xterm.c | 16 | ||||
| -rw-r--r-- | src/xwidget.c | 554 | ||||
| -rw-r--r-- | src/xwidget.h | 115 |
17 files changed, 379 insertions, 588 deletions
diff --git a/src/buffer.c b/src/buffer.c index 51bbad78bbc..0c52eaf41ba 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -42,10 +42,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 42 | #include "blockinput.h" | 42 | #include "blockinput.h" |
| 43 | #include "keymap.h" | 43 | #include "keymap.h" |
| 44 | #include "frame.h" | 44 | #include "frame.h" |
| 45 | #include "xwidget.h" | ||
| 45 | 46 | ||
| 46 | #ifdef HAVE_XWIDGETS | ||
| 47 | # include "xwidget.h" | ||
| 48 | #endif | ||
| 49 | #ifdef WINDOWSNT | 47 | #ifdef WINDOWSNT |
| 50 | #include "w32heap.h" /* for mmap_* */ | 48 | #include "w32heap.h" /* for mmap_* */ |
| 51 | #endif | 49 | #endif |
| @@ -1749,10 +1747,8 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1749 | unlock_buffer (b); | 1747 | unlock_buffer (b); |
| 1750 | 1748 | ||
| 1751 | kill_buffer_processes (buffer); | 1749 | kill_buffer_processes (buffer); |
| 1752 | |||
| 1753 | #ifdef HAVE_XWIDGETS | ||
| 1754 | kill_buffer_xwidgets (buffer); | 1750 | kill_buffer_xwidgets (buffer); |
| 1755 | #endif | 1751 | |
| 1756 | /* Killing buffer processes may run sentinels which may have killed | 1752 | /* Killing buffer processes may run sentinels which may have killed |
| 1757 | our buffer. */ | 1753 | our buffer. */ |
| 1758 | if (!BUFFER_LIVE_P (b)) | 1754 | if (!BUFFER_LIVE_P (b)) |
diff --git a/src/dispextern.h b/src/dispextern.h index fad5bfd6f2f..7d7d7305b43 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -347,11 +347,10 @@ enum glyph_type | |||
| 347 | IMAGE_GLYPH, | 347 | IMAGE_GLYPH, |
| 348 | 348 | ||
| 349 | /* Glyph is a space of fractional width and/or height. */ | 349 | /* Glyph is a space of fractional width and/or height. */ |
| 350 | STRETCH_GLYPH | 350 | STRETCH_GLYPH, |
| 351 | #ifdef HAVE_XWIDGETS | 351 | |
| 352 | /* Glyph is an external widget drawn by the GUI toolkit. */ | 352 | /* Glyph is an external widget drawn by the GUI toolkit. */ |
| 353 | ,XWIDGET_GLYPH | 353 | XWIDGET_GLYPH |
| 354 | #endif | ||
| 355 | }; | 354 | }; |
| 356 | 355 | ||
| 357 | 356 | ||
| @@ -504,8 +503,10 @@ struct glyph | |||
| 504 | int img_id; | 503 | int img_id; |
| 505 | 504 | ||
| 506 | #ifdef HAVE_XWIDGETS | 505 | #ifdef HAVE_XWIDGETS |
| 506 | /* Xwidget reference (type == XWIDGET_GLYPH). */ | ||
| 507 | struct xwidget *xwidget; | 507 | struct xwidget *xwidget; |
| 508 | #endif | 508 | #endif |
| 509 | |||
| 509 | /* Sub-structure for type == STRETCH_GLYPH. */ | 510 | /* Sub-structure for type == STRETCH_GLYPH. */ |
| 510 | struct | 511 | struct |
| 511 | { | 512 | { |
| @@ -1357,9 +1358,9 @@ struct glyph_string | |||
| 1357 | /* Image, if any. */ | 1358 | /* Image, if any. */ |
| 1358 | struct image *img; | 1359 | struct image *img; |
| 1359 | 1360 | ||
| 1360 | #ifdef HAVE_XWIDGETS | 1361 | /* Xwidget. */ |
| 1361 | struct xwidget *xwidget; | 1362 | struct xwidget *xwidget; |
| 1362 | #endif | 1363 | |
| 1363 | /* Slice */ | 1364 | /* Slice */ |
| 1364 | struct glyph_slice slice; | 1365 | struct glyph_slice slice; |
| 1365 | 1366 | ||
| @@ -2111,11 +2112,10 @@ enum display_element_type | |||
| 2111 | IT_TRUNCATION, | 2112 | IT_TRUNCATION, |
| 2112 | 2113 | ||
| 2113 | /* Continuation glyphs. See the comment for IT_TRUNCATION. */ | 2114 | /* Continuation glyphs. See the comment for IT_TRUNCATION. */ |
| 2114 | IT_CONTINUATION | 2115 | IT_CONTINUATION, |
| 2115 | 2116 | ||
| 2116 | #ifdef HAVE_XWIDGETS | 2117 | /* Xwidget. */ |
| 2117 | ,IT_XWIDGET | 2118 | IT_XWIDGET |
| 2118 | #endif | ||
| 2119 | }; | 2119 | }; |
| 2120 | 2120 | ||
| 2121 | 2121 | ||
| @@ -2179,9 +2179,7 @@ enum it_method { | |||
| 2179 | GET_FROM_C_STRING, | 2179 | GET_FROM_C_STRING, |
| 2180 | GET_FROM_IMAGE, | 2180 | GET_FROM_IMAGE, |
| 2181 | GET_FROM_STRETCH, | 2181 | GET_FROM_STRETCH, |
| 2182 | #ifdef HAVE_XWIDGETS | ||
| 2183 | GET_FROM_XWIDGET, | 2182 | GET_FROM_XWIDGET, |
| 2184 | #endif | ||
| 2185 | NUM_IT_METHODS | 2183 | NUM_IT_METHODS |
| 2186 | }; | 2184 | }; |
| 2187 | 2185 | ||
| @@ -2399,12 +2397,10 @@ struct it | |||
| 2399 | struct { | 2397 | struct { |
| 2400 | Lisp_Object object; | 2398 | Lisp_Object object; |
| 2401 | } stretch; | 2399 | } stretch; |
| 2402 | #ifdef HAVE_XWIDGETS | ||
| 2403 | /* method == GET_FROM_XWIDGET */ | 2400 | /* method == GET_FROM_XWIDGET */ |
| 2404 | struct { | 2401 | struct { |
| 2405 | Lisp_Object object; | 2402 | Lisp_Object object; |
| 2406 | } xwidget; | 2403 | } xwidget; |
| 2407 | #endif | ||
| 2408 | } u; | 2404 | } u; |
| 2409 | 2405 | ||
| 2410 | /* Current text and display positions. */ | 2406 | /* Current text and display positions. */ |
| @@ -2529,10 +2525,8 @@ struct it | |||
| 2529 | /* If what == IT_IMAGE, the id of the image to display. */ | 2525 | /* If what == IT_IMAGE, the id of the image to display. */ |
| 2530 | ptrdiff_t image_id; | 2526 | ptrdiff_t image_id; |
| 2531 | 2527 | ||
| 2532 | #ifdef HAVE_XWIDGETS | ||
| 2533 | /* If what == IT_XWIDGET. */ | 2528 | /* If what == IT_XWIDGET. */ |
| 2534 | struct xwidget *xwidget; | 2529 | struct xwidget *xwidget; |
| 2535 | #endif | ||
| 2536 | 2530 | ||
| 2537 | /* Values from `slice' property. */ | 2531 | /* Values from `slice' property. */ |
| 2538 | struct it_slice slice; | 2532 | struct it_slice slice; |
diff --git a/src/dispnew.c b/src/dispnew.c index 32c0dff9b92..fe07f793cb5 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -39,15 +39,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | #include "syssignal.h" | 39 | #include "syssignal.h" |
| 40 | #include "systime.h" | 40 | #include "systime.h" |
| 41 | #include "tparam.h" | 41 | #include "tparam.h" |
| 42 | #include "xwidget.h" | ||
| 42 | 43 | ||
| 43 | #ifdef HAVE_WINDOW_SYSTEM | 44 | #ifdef HAVE_WINDOW_SYSTEM |
| 44 | #include TERM_HEADER | 45 | #include TERM_HEADER |
| 45 | #endif /* HAVE_WINDOW_SYSTEM */ | 46 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 46 | 47 | ||
| 47 | #ifdef HAVE_XWIDGETS | ||
| 48 | # include "xwidget.h" | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #include <errno.h> | 48 | #include <errno.h> |
| 52 | 49 | ||
| 53 | #include <fpending.h> | 50 | #include <fpending.h> |
| @@ -3547,9 +3544,7 @@ update_window (struct window *w, bool force_p) | |||
| 3547 | add_window_display_history (w, w->current_matrix->method, paused_p); | 3544 | add_window_display_history (w, w->current_matrix->method, paused_p); |
| 3548 | #endif | 3545 | #endif |
| 3549 | 3546 | ||
| 3550 | #ifdef HAVE_XWIDGETS | ||
| 3551 | xwidget_end_redisplay (w, w->current_matrix); | 3547 | xwidget_end_redisplay (w, w->current_matrix); |
| 3552 | #endif | ||
| 3553 | clear_glyph_matrix (desired_matrix); | 3548 | clear_glyph_matrix (desired_matrix); |
| 3554 | 3549 | ||
| 3555 | return paused_p; | 3550 | return paused_p; |
diff --git a/src/emacs.c b/src/emacs.c index fcf048ca84b..f661196313f 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -65,10 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 65 | #include "character.h" | 65 | #include "character.h" |
| 66 | #include "buffer.h" | 66 | #include "buffer.h" |
| 67 | #include "window.h" | 67 | #include "window.h" |
| 68 | 68 | #include "xwidget.h" | |
| 69 | #ifdef HAVE_XWIDGETS | ||
| 70 | # include "xwidget.h" | ||
| 71 | #endif | ||
| 72 | #include "atimer.h" | 69 | #include "atimer.h" |
| 73 | #include "blockinput.h" | 70 | #include "blockinput.h" |
| 74 | #include "syssignal.h" | 71 | #include "syssignal.h" |
| @@ -1495,9 +1492,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1495 | syms_of_xfns (); | 1492 | syms_of_xfns (); |
| 1496 | syms_of_xmenu (); | 1493 | syms_of_xmenu (); |
| 1497 | syms_of_fontset (); | 1494 | syms_of_fontset (); |
| 1498 | #ifdef HAVE_XWIDGETS | ||
| 1499 | syms_of_xwidget (); | 1495 | syms_of_xwidget (); |
| 1500 | #endif | ||
| 1501 | syms_of_xsettings (); | 1496 | syms_of_xsettings (); |
| 1502 | #ifdef HAVE_X_SM | 1497 | #ifdef HAVE_X_SM |
| 1503 | syms_of_xsmfns (); | 1498 | syms_of_xsmfns (); |
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index 08b840389c5..6795155831e 100644 --- a/src/emacsgtkfixed.c +++ b/src/emacsgtkfixed.c | |||
| @@ -23,9 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | #include "lisp.h" | 23 | #include "lisp.h" |
| 24 | #include "frame.h" | 24 | #include "frame.h" |
| 25 | #include "xterm.h" | 25 | #include "xterm.h" |
| 26 | #ifdef HAVE_XWIDGETS | 26 | #include "xwidget.h" |
| 27 | # include "xwidget.h" | ||
| 28 | #endif | ||
| 29 | #include "emacsgtkfixed.h" | 27 | #include "emacsgtkfixed.h" |
| 30 | 28 | ||
| 31 | /* Silence a bogus diagnostic; see GNOME bug 683906. */ | 29 | /* Silence a bogus diagnostic; see GNOME bug 683906. */ |
| @@ -50,7 +48,6 @@ static void emacs_fixed_get_preferred_width (GtkWidget *widget, | |||
| 50 | static void emacs_fixed_get_preferred_height (GtkWidget *widget, | 48 | static void emacs_fixed_get_preferred_height (GtkWidget *widget, |
| 51 | gint *minimum, | 49 | gint *minimum, |
| 52 | gint *natural); | 50 | gint *natural); |
| 53 | |||
| 54 | static GType emacs_fixed_get_type (void); | 51 | static GType emacs_fixed_get_type (void); |
| 55 | G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) | 52 | G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) |
| 56 | 53 | ||
| @@ -75,28 +72,28 @@ struct GtkFixedPrivateL | |||
| 75 | GList *children; | 72 | GList *children; |
| 76 | }; | 73 | }; |
| 77 | 74 | ||
| 78 | static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget, | 75 | static void |
| 79 | GtkAllocation *allocation) | 76 | emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget, |
| 77 | GtkAllocation *allocation) | ||
| 80 | { | 78 | { |
| 81 | // For xwidgets. | 79 | /* For xwidgets. |
| 82 | 80 | ||
| 83 | // This basically re-implements the base class method and adds an | 81 | This basically re-implements the base class method and adds an |
| 84 | // additional case for an xwidget view. | 82 | additional case for an xwidget view. |
| 85 | 83 | ||
| 86 | // It would be nicer if the bse class method could be called first, | 84 | It would be nicer if the bse class method could be called first, |
| 87 | // and the the xview modification only would remain here. It wasn't | 85 | and the the xview modification only would remain here. It wasn't |
| 88 | // possible to solve it that way yet. | 86 | possible to solve it that way yet. */ |
| 89 | EmacsFixedClass *klass; | 87 | EmacsFixedClass *klass; |
| 90 | GtkWidgetClass *parent_class; | 88 | GtkWidgetClass *parent_class; |
| 91 | struct GtkFixedPrivateL* priv; | 89 | struct GtkFixedPrivateL *priv; |
| 92 | 90 | ||
| 93 | klass = EMACS_FIXED_GET_CLASS (widget); | 91 | klass = EMACS_FIXED_GET_CLASS (widget); |
| 94 | parent_class = g_type_class_peek_parent (klass); | 92 | parent_class = g_type_class_peek_parent (klass); |
| 95 | parent_class->size_allocate (widget, allocation); | 93 | parent_class->size_allocate (widget, allocation); |
| 96 | 94 | ||
| 97 | priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, | 95 | priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, GTK_TYPE_FIXED, |
| 98 | GTK_TYPE_FIXED, | 96 | struct GtkFixedPrivateL); |
| 99 | struct GtkFixedPrivateL); | ||
| 100 | 97 | ||
| 101 | gtk_widget_set_allocation (widget, allocation); | 98 | gtk_widget_set_allocation (widget, allocation); |
| 102 | 99 | ||
| @@ -154,7 +151,6 @@ emacs_fixed_class_init (EmacsFixedClass *klass) | |||
| 154 | 151 | ||
| 155 | widget_class = (GtkWidgetClass*) klass; | 152 | widget_class = (GtkWidgetClass*) klass; |
| 156 | 153 | ||
| 157 | |||
| 158 | widget_class->get_preferred_width = emacs_fixed_get_preferred_width; | 154 | widget_class->get_preferred_width = emacs_fixed_get_preferred_width; |
| 159 | widget_class->get_preferred_height = emacs_fixed_get_preferred_height; | 155 | widget_class->get_preferred_height = emacs_fixed_get_preferred_height; |
| 160 | #ifdef HAVE_XWIDGETS | 156 | #ifdef HAVE_XWIDGETS |
| @@ -163,7 +159,6 @@ emacs_fixed_class_init (EmacsFixedClass *klass) | |||
| 163 | g_type_class_add_private (klass, sizeof (EmacsFixedPrivate)); | 159 | g_type_class_add_private (klass, sizeof (EmacsFixedPrivate)); |
| 164 | } | 160 | } |
| 165 | 161 | ||
| 166 | |||
| 167 | static void | 162 | static void |
| 168 | emacs_fixed_init (EmacsFixed *fixed) | 163 | emacs_fixed_init (EmacsFixed *fixed) |
| 169 | { | 164 | { |
| @@ -172,14 +167,7 @@ emacs_fixed_init (EmacsFixed *fixed) | |||
| 172 | fixed->priv->f = 0; | 167 | fixed->priv->f = 0; |
| 173 | } | 168 | } |
| 174 | 169 | ||
| 175 | /** | 170 | GtkWidget * |
| 176 | * emacs_fixed_new: | ||
| 177 | * | ||
| 178 | * Creates a new #EmacsFixed. | ||
| 179 | * | ||
| 180 | * Returns: a new #EmacsFixed. | ||
| 181 | */ | ||
| 182 | GtkWidget* | ||
| 183 | emacs_fixed_new (struct frame *f) | 171 | emacs_fixed_new (struct frame *f) |
| 184 | { | 172 | { |
| 185 | EmacsFixed *fixed = g_object_new (emacs_fixed_get_type (), NULL); | 173 | EmacsFixed *fixed = g_object_new (emacs_fixed_get_type (), NULL); |
diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h index 378bd2b828c..72652c53104 100644 --- a/src/emacsgtkfixed.h +++ b/src/emacsgtkfixed.h | |||
| @@ -29,7 +29,6 @@ G_BEGIN_DECLS | |||
| 29 | 29 | ||
| 30 | struct frame; | 30 | struct frame; |
| 31 | 31 | ||
| 32 | //typedef struct _EmacsFixed EmacsFixed; | ||
| 33 | typedef struct _EmacsFixedPrivate EmacsFixedPrivate; | 32 | typedef struct _EmacsFixedPrivate EmacsFixedPrivate; |
| 34 | typedef struct _EmacsFixedClass EmacsFixedClass; | 33 | typedef struct _EmacsFixedClass EmacsFixedClass; |
| 35 | 34 | ||
| @@ -41,7 +40,6 @@ struct _EmacsFixed | |||
| 41 | EmacsFixedPrivate *priv; | 40 | EmacsFixedPrivate *priv; |
| 42 | }; | 41 | }; |
| 43 | 42 | ||
| 44 | |||
| 45 | struct _EmacsFixedClass | 43 | struct _EmacsFixedClass |
| 46 | { | 44 | { |
| 47 | GtkFixedClass parent_class; | 45 | GtkFixedClass parent_class; |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 768df342983..14b76ce67ae 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -4084,20 +4084,28 @@ xg_page_setup_dialog (void) | |||
| 4084 | Lisp_Object | 4084 | Lisp_Object |
| 4085 | xg_get_page_setup (void) | 4085 | xg_get_page_setup (void) |
| 4086 | { | 4086 | { |
| 4087 | GtkPageOrientation orientation; | ||
| 4088 | Lisp_Object orientation_symbol; | 4087 | Lisp_Object orientation_symbol; |
| 4089 | 4088 | ||
| 4090 | if (page_setup == NULL) | 4089 | if (page_setup == NULL) |
| 4091 | page_setup = gtk_page_setup_new (); | 4090 | page_setup = gtk_page_setup_new (); |
| 4092 | orientation = gtk_page_setup_get_orientation (page_setup); | 4091 | |
| 4093 | if (orientation == GTK_PAGE_ORIENTATION_PORTRAIT) | 4092 | switch (gtk_page_setup_get_orientation (page_setup)) |
| 4094 | orientation_symbol = Qportrait; | 4093 | { |
| 4095 | else if (orientation == GTK_PAGE_ORIENTATION_LANDSCAPE) | 4094 | case GTK_PAGE_ORIENTATION_PORTRAIT: |
| 4096 | orientation_symbol = Qlandscape; | 4095 | orientation_symbol = Qportrait; |
| 4097 | else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT) | 4096 | break; |
| 4098 | orientation_symbol = Qreverse_portrait; | 4097 | case GTK_PAGE_ORIENTATION_LANDSCAPE: |
| 4099 | else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE) | 4098 | orientation_symbol = Qlandscape; |
| 4100 | orientation_symbol = Qreverse_landscape; | 4099 | break; |
| 4100 | case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT: | ||
| 4101 | orientation_symbol = Qreverse_portrait; | ||
| 4102 | break; | ||
| 4103 | case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE: | ||
| 4104 | orientation_symbol = Qreverse_landscape; | ||
| 4105 | break; | ||
| 4106 | default: | ||
| 4107 | eassume (false); | ||
| 4108 | } | ||
| 4101 | 4109 | ||
| 4102 | return listn (CONSTYPE_HEAP, 7, | 4110 | return listn (CONSTYPE_HEAP, 7, |
| 4103 | Fcons (Qorientation, orientation_symbol), | 4111 | Fcons (Qorientation, orientation_symbol), |
diff --git a/src/image.c b/src/image.c index 8bb5ff77b22..144fe30a746 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -57,8 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 57 | #endif /* HAVE_WINDOW_SYSTEM */ | 57 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 58 | 58 | ||
| 59 | #ifdef HAVE_X_WINDOWS | 59 | #ifdef HAVE_X_WINDOWS |
| 60 | #define COLOR_TABLE_SUPPORT 1 | ||
| 61 | |||
| 62 | typedef struct x_bitmap_record Bitmap_Record; | 60 | typedef struct x_bitmap_record Bitmap_Record; |
| 63 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) | 61 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) |
| 64 | #define NO_PIXMAP None | 62 | #define NO_PIXMAP None |
| @@ -74,9 +72,6 @@ typedef struct x_bitmap_record Bitmap_Record; | |||
| 74 | # include "w32.h" | 72 | # include "w32.h" |
| 75 | #endif | 73 | #endif |
| 76 | 74 | ||
| 77 | /* W32_TODO : Color tables on W32. */ | ||
| 78 | #undef COLOR_TABLE_SUPPORT | ||
| 79 | |||
| 80 | typedef struct w32_bitmap_record Bitmap_Record; | 75 | typedef struct w32_bitmap_record Bitmap_Record; |
| 81 | #define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y) | 76 | #define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y) |
| 82 | #define NO_PIXMAP 0 | 77 | #define NO_PIXMAP 0 |
| @@ -89,13 +84,7 @@ typedef struct w32_bitmap_record Bitmap_Record; | |||
| 89 | 84 | ||
| 90 | #endif /* HAVE_NTGUI */ | 85 | #endif /* HAVE_NTGUI */ |
| 91 | 86 | ||
| 92 | #ifdef USE_CAIRO | ||
| 93 | #undef COLOR_TABLE_SUPPORT | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #ifdef HAVE_NS | 87 | #ifdef HAVE_NS |
| 97 | #undef COLOR_TABLE_SUPPORT | ||
| 98 | |||
| 99 | typedef struct ns_bitmap_record Bitmap_Record; | 88 | typedef struct ns_bitmap_record Bitmap_Record; |
| 100 | 89 | ||
| 101 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) | 90 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) |
| @@ -109,6 +98,12 @@ typedef struct ns_bitmap_record Bitmap_Record; | |||
| 109 | #define DefaultDepthOfScreen(screen) x_display_list->n_planes | 98 | #define DefaultDepthOfScreen(screen) x_display_list->n_planes |
| 110 | #endif /* HAVE_NS */ | 99 | #endif /* HAVE_NS */ |
| 111 | 100 | ||
| 101 | #if (defined HAVE_X_WINDOWS \ | ||
| 102 | && ! (defined HAVE_NTGUI || defined USE_CAIRO || defined HAVE_NS)) | ||
| 103 | /* W32_TODO : Color tables on W32. */ | ||
| 104 | # define COLOR_TABLE_SUPPORT 1 | ||
| 105 | #endif | ||
| 106 | |||
| 112 | static void x_disable_image (struct frame *, struct image *); | 107 | static void x_disable_image (struct frame *, struct image *); |
| 113 | static void x_edge_detection (struct frame *, struct image *, Lisp_Object, | 108 | static void x_edge_detection (struct frame *, struct image *, Lisp_Object, |
| 114 | Lisp_Object); | 109 | Lisp_Object); |
| @@ -4615,16 +4610,14 @@ colors_in_color_table (int *n) | |||
| 4615 | static unsigned long | 4610 | static unsigned long |
| 4616 | lookup_rgb_color (struct frame *f, int r, int g, int b) | 4611 | lookup_rgb_color (struct frame *f, int r, int g, int b) |
| 4617 | { | 4612 | { |
| 4618 | unsigned long pixel; | ||
| 4619 | |||
| 4620 | #ifdef HAVE_NTGUI | 4613 | #ifdef HAVE_NTGUI |
| 4621 | pixel = PALETTERGB (r >> 8, g >> 8, b >> 8); | 4614 | return PALETTERGB (r >> 8, g >> 8, b >> 8); |
| 4622 | #endif /* HAVE_NTGUI */ | 4615 | #elif defined HAVE_NS |
| 4623 | 4616 | return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8); | |
| 4624 | #ifdef HAVE_NS | 4617 | #else |
| 4625 | pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8); | 4618 | xsignal1 (Qfile_error, |
| 4626 | #endif /* HAVE_NS */ | 4619 | build_string ("This Emacs mishandles this image file type")); |
| 4627 | return pixel; | 4620 | #endif |
| 4628 | } | 4621 | } |
| 4629 | 4622 | ||
| 4630 | static void | 4623 | static void |
| @@ -7320,7 +7313,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 7320 | { | 7313 | { |
| 7321 | unsigned char *data = (unsigned char *) xmalloc (width*height*4); | 7314 | unsigned char *data = (unsigned char *) xmalloc (width*height*4); |
| 7322 | uint32_t *dataptr = (uint32_t *) data; | 7315 | uint32_t *dataptr = (uint32_t *) data; |
| 7323 | int r, g, b, a; | ||
| 7324 | 7316 | ||
| 7325 | for (y = 0; y < height; ++y) | 7317 | for (y = 0; y < height; ++y) |
| 7326 | { | 7318 | { |
| @@ -7634,19 +7626,19 @@ gif_load (struct frame *f, struct image *img) | |||
| 7634 | { | 7626 | { |
| 7635 | int rc, width, height, x, y, i, j; | 7627 | int rc, width, height, x, y, i, j; |
| 7636 | ColorMapObject *gif_color_map; | 7628 | ColorMapObject *gif_color_map; |
| 7637 | unsigned long pixel_colors[256]; | ||
| 7638 | GifFileType *gif; | 7629 | GifFileType *gif; |
| 7639 | gif_memory_source memsrc; | 7630 | gif_memory_source memsrc; |
| 7640 | Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); | 7631 | Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); |
| 7641 | Lisp_Object specified_file = image_spec_value (img->spec, QCfile, NULL); | 7632 | Lisp_Object specified_file = image_spec_value (img->spec, QCfile, NULL); |
| 7642 | Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL); | 7633 | Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL); |
| 7643 | unsigned long bgcolor = 0; | ||
| 7644 | EMACS_INT idx; | 7634 | EMACS_INT idx; |
| 7645 | int gif_err; | 7635 | int gif_err; |
| 7646 | 7636 | ||
| 7647 | #ifdef USE_CAIRO | 7637 | #ifdef USE_CAIRO |
| 7648 | unsigned char *data = 0; | 7638 | unsigned char *data = 0; |
| 7649 | #else | 7639 | #else |
| 7640 | unsigned long pixel_colors[256]; | ||
| 7641 | unsigned long bgcolor = 0; | ||
| 7650 | XImagePtr ximg; | 7642 | XImagePtr ximg; |
| 7651 | #endif | 7643 | #endif |
| 7652 | 7644 | ||
| @@ -7833,9 +7825,13 @@ gif_load (struct frame *f, struct image *img) | |||
| 7833 | gif_load call to construct and save all animation frames. */ | 7825 | gif_load call to construct and save all animation frames. */ |
| 7834 | 7826 | ||
| 7835 | init_color_table (); | 7827 | init_color_table (); |
| 7828 | |||
| 7829 | #ifndef USE_CAIRO | ||
| 7836 | if (STRINGP (specified_bg)) | 7830 | if (STRINGP (specified_bg)) |
| 7837 | bgcolor = x_alloc_image_color (f, img, specified_bg, | 7831 | bgcolor = x_alloc_image_color (f, img, specified_bg, |
| 7838 | FRAME_BACKGROUND_PIXEL (f)); | 7832 | FRAME_BACKGROUND_PIXEL (f)); |
| 7833 | #endif | ||
| 7834 | |||
| 7839 | for (j = 0; j <= idx; ++j) | 7835 | for (j = 0; j <= idx; ++j) |
| 7840 | { | 7836 | { |
| 7841 | /* We use a local variable `raster' here because RasterBits is a | 7837 | /* We use a local variable `raster' here because RasterBits is a |
| @@ -9182,11 +9178,6 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 9182 | int height; | 9178 | int height; |
| 9183 | const guint8 *pixels; | 9179 | const guint8 *pixels; |
| 9184 | int rowstride; | 9180 | int rowstride; |
| 9185 | XImagePtr ximg; | ||
| 9186 | Lisp_Object specified_bg; | ||
| 9187 | XColor background; | ||
| 9188 | int x; | ||
| 9189 | int y; | ||
| 9190 | 9181 | ||
| 9191 | #if ! GLIB_CHECK_VERSION (2, 36, 0) | 9182 | #if ! GLIB_CHECK_VERSION (2, 36, 0) |
| 9192 | /* g_type_init is a glib function that must be called prior to | 9183 | /* g_type_init is a glib function that must be called prior to |
| @@ -9240,16 +9231,14 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 9240 | #ifdef USE_CAIRO | 9231 | #ifdef USE_CAIRO |
| 9241 | { | 9232 | { |
| 9242 | unsigned char *data = (unsigned char *) xmalloc (width*height*4); | 9233 | unsigned char *data = (unsigned char *) xmalloc (width*height*4); |
| 9243 | int y; | ||
| 9244 | uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f); | 9234 | uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f); |
| 9245 | 9235 | ||
| 9246 | for (y = 0; y < height; ++y) | 9236 | for (int y = 0; y < height; ++y) |
| 9247 | { | 9237 | { |
| 9248 | const guchar *iconptr = pixels + y * rowstride; | 9238 | const guchar *iconptr = pixels + y * rowstride; |
| 9249 | uint32_t *dataptr = (uint32_t *) (data + y * rowstride); | 9239 | uint32_t *dataptr = (uint32_t *) (data + y * rowstride); |
| 9250 | int x; | ||
| 9251 | 9240 | ||
| 9252 | for (x = 0; x < width; ++x) | 9241 | for (int x = 0; x < width; ++x) |
| 9253 | { | 9242 | { |
| 9254 | if (iconptr[3] == 0) | 9243 | if (iconptr[3] == 0) |
| 9255 | *dataptr = bgcolor; | 9244 | *dataptr = bgcolor; |
| @@ -9269,6 +9258,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 9269 | } | 9258 | } |
| 9270 | #else | 9259 | #else |
| 9271 | /* Try to create a x pixmap to hold the svg pixmap. */ | 9260 | /* Try to create a x pixmap to hold the svg pixmap. */ |
| 9261 | XImagePtr ximg; | ||
| 9272 | if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) | 9262 | if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) |
| 9273 | { | 9263 | { |
| 9274 | g_object_unref (pixbuf); | 9264 | g_object_unref (pixbuf); |
| @@ -9279,7 +9269,8 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 9279 | 9269 | ||
| 9280 | /* Handle alpha channel by combining the image with a background | 9270 | /* Handle alpha channel by combining the image with a background |
| 9281 | color. */ | 9271 | color. */ |
| 9282 | specified_bg = image_spec_value (img->spec, QCbackground, NULL); | 9272 | XColor background; |
| 9273 | Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); | ||
| 9283 | if (!STRINGP (specified_bg) | 9274 | if (!STRINGP (specified_bg) |
| 9284 | || !x_defined_color (f, SSDATA (specified_bg), &background, 0)) | 9275 | || !x_defined_color (f, SSDATA (specified_bg), &background, 0)) |
| 9285 | x_query_frame_background_color (f, &background); | 9276 | x_query_frame_background_color (f, &background); |
| @@ -9295,9 +9286,9 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 9295 | non-transparent images. Each pixel must be "flattened" by | 9286 | non-transparent images. Each pixel must be "flattened" by |
| 9296 | calculating the resulting color, given the transparency of the | 9287 | calculating the resulting color, given the transparency of the |
| 9297 | pixel, and the image background color. */ | 9288 | pixel, and the image background color. */ |
| 9298 | for (y = 0; y < height; ++y) | 9289 | for (int y = 0; y < height; ++y) |
| 9299 | { | 9290 | { |
| 9300 | for (x = 0; x < width; ++x) | 9291 | for (int x = 0; x < width; ++x) |
| 9301 | { | 9292 | { |
| 9302 | int red; | 9293 | int red; |
| 9303 | int green; | 9294 | int green; |
| @@ -9597,8 +9588,6 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) | |||
| 9597 | 0, 0, img->width, img->height, ~0, ZPixmap); | 9588 | 0, 0, img->width, img->height, ~0, ZPixmap); |
| 9598 | if (ximg) | 9589 | if (ximg) |
| 9599 | { | 9590 | { |
| 9600 | int x, y; | ||
| 9601 | |||
| 9602 | /* Initialize the color table. */ | 9591 | /* Initialize the color table. */ |
| 9603 | init_color_table (); | 9592 | init_color_table (); |
| 9604 | 9593 | ||
| @@ -9606,8 +9595,8 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) | |||
| 9606 | color table. After having done so, the color table will | 9595 | color table. After having done so, the color table will |
| 9607 | contain an entry for each color used by the image. */ | 9596 | contain an entry for each color used by the image. */ |
| 9608 | #ifdef COLOR_TABLE_SUPPORT | 9597 | #ifdef COLOR_TABLE_SUPPORT |
| 9609 | for (y = 0; y < img->height; ++y) | 9598 | for (int y = 0; y < img->height; ++y) |
| 9610 | for (x = 0; x < img->width; ++x) | 9599 | for (int x = 0; x < img->width; ++x) |
| 9611 | { | 9600 | { |
| 9612 | unsigned long pixel = XGetPixel (ximg, x, y); | 9601 | unsigned long pixel = XGetPixel (ximg, x, y); |
| 9613 | 9602 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index fe503b8ce56..b26cee24673 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5960,7 +5960,7 @@ make_lispy_event (struct input_event *event) | |||
| 5960 | #ifdef HAVE_XWIDGETS | 5960 | #ifdef HAVE_XWIDGETS |
| 5961 | case XWIDGET_EVENT: | 5961 | case XWIDGET_EVENT: |
| 5962 | { | 5962 | { |
| 5963 | return Fcons (Qxwidget_event,event->arg); | 5963 | return Fcons (Qxwidget_event, event->arg); |
| 5964 | } | 5964 | } |
| 5965 | #endif | 5965 | #endif |
| 5966 | 5966 | ||
| @@ -10971,7 +10971,7 @@ syms_of_keyboard (void) | |||
| 10971 | #endif | 10971 | #endif |
| 10972 | 10972 | ||
| 10973 | #ifdef HAVE_XWIDGETS | 10973 | #ifdef HAVE_XWIDGETS |
| 10974 | DEFSYM (Qxwidget_event,"xwidget-event"); | 10974 | DEFSYM (Qxwidget_event, "xwidget-event"); |
| 10975 | #endif | 10975 | #endif |
| 10976 | 10976 | ||
| 10977 | #ifdef USE_FILE_NOTIFY | 10977 | #ifdef USE_FILE_NOTIFY |
diff --git a/src/lisp.h b/src/lisp.h index 8aa034e9e57..ee055e90699 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -799,11 +799,8 @@ enum pvec_type | |||
| 799 | PVEC_WINDOW_CONFIGURATION, | 799 | PVEC_WINDOW_CONFIGURATION, |
| 800 | PVEC_SUBR, | 800 | PVEC_SUBR, |
| 801 | PVEC_OTHER, | 801 | PVEC_OTHER, |
| 802 | |||
| 803 | #ifdef HAVE_XWIDGETS | ||
| 804 | PVEC_XWIDGET, | 802 | PVEC_XWIDGET, |
| 805 | PVEC_XWIDGET_VIEW, | 803 | PVEC_XWIDGET_VIEW, |
| 806 | #endif | ||
| 807 | 804 | ||
| 808 | /* These should be last, check internal_equal to see why. */ | 805 | /* These should be last, check internal_equal to see why. */ |
| 809 | PVEC_COMPILED, | 806 | PVEC_COMPILED, |
diff --git a/src/print.c b/src/print.c index 4dd4e963093..2ecc0f52b47 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -32,10 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | #include "disptab.h" | 32 | #include "disptab.h" |
| 33 | #include "intervals.h" | 33 | #include "intervals.h" |
| 34 | #include "blockinput.h" | 34 | #include "blockinput.h" |
| 35 | 35 | #include "xwidget.h" | |
| 36 | #ifdef HAVE_XWIDGETS | ||
| 37 | # include "xwidget.h" | ||
| 38 | #endif | ||
| 39 | 36 | ||
| 40 | #include <c-ctype.h> | 37 | #include <c-ctype.h> |
| 41 | #include <float.h> | 38 | #include <float.h> |
| @@ -1740,18 +1737,11 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1740 | print_c_string (XSUBR (obj)->symbol_name, printcharfun); | 1737 | print_c_string (XSUBR (obj)->symbol_name, printcharfun); |
| 1741 | printchar ('>', printcharfun); | 1738 | printchar ('>', printcharfun); |
| 1742 | } | 1739 | } |
| 1743 | #ifdef HAVE_XWIDGETS | 1740 | else if (XWIDGETP (obj) || XWIDGET_VIEW_P (obj)) |
| 1744 | else if (XWIDGETP (obj)) | ||
| 1745 | { | 1741 | { |
| 1746 | print_c_string ("#<xwidget ", printcharfun); | 1742 | print_c_string ("#<xwidget ", printcharfun); |
| 1747 | printchar ('>', printcharfun); | 1743 | printchar ('>', printcharfun); |
| 1748 | } | 1744 | } |
| 1749 | else if (XWIDGET_VIEW_P (obj)) | ||
| 1750 | { | ||
| 1751 | print_c_string ("#<xwidget ", printcharfun); | ||
| 1752 | printchar ('>', printcharfun); | ||
| 1753 | } | ||
| 1754 | #endif | ||
| 1755 | else if (WINDOWP (obj)) | 1745 | else if (WINDOWP (obj)) |
| 1756 | { | 1746 | { |
| 1757 | int len = sprintf (buf, "#<window %"pI"d", | 1747 | int len = sprintf (buf, "#<window %"pI"d", |
diff --git a/src/sysdep.c b/src/sysdep.c index a86b53642f2..19a7212f7e2 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -100,6 +100,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 100 | #include "cm.h" | 100 | #include "cm.h" |
| 101 | 101 | ||
| 102 | #include "gnutls.h" | 102 | #include "gnutls.h" |
| 103 | /* MS-Windows loads GnuTLS at run time, if available; we don't want to | ||
| 104 | do that during startup just to call gnutls_rnd. */ | ||
| 103 | #if 0x020c00 <= GNUTLS_VERSION_NUMBER && !defined WINDOWSNT | 105 | #if 0x020c00 <= GNUTLS_VERSION_NUMBER && !defined WINDOWSNT |
| 104 | # include <gnutls/crypto.h> | 106 | # include <gnutls/crypto.h> |
| 105 | #else | 107 | #else |
diff --git a/src/window.c b/src/window.c index add2de38d18..70b7e58feb5 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -35,15 +35,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | #include "dispextern.h" | 35 | #include "dispextern.h" |
| 36 | #include "blockinput.h" | 36 | #include "blockinput.h" |
| 37 | #include "termhooks.h" /* For FRAME_TERMINAL. */ | 37 | #include "termhooks.h" /* For FRAME_TERMINAL. */ |
| 38 | #include "xwidget.h" | ||
| 38 | #ifdef HAVE_WINDOW_SYSTEM | 39 | #ifdef HAVE_WINDOW_SYSTEM |
| 39 | #include TERM_HEADER | 40 | #include TERM_HEADER |
| 40 | #endif /* HAVE_WINDOW_SYSTEM */ | 41 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 41 | #ifdef MSDOS | 42 | #ifdef MSDOS |
| 42 | #include "msdos.h" | 43 | #include "msdos.h" |
| 43 | #endif | 44 | #endif |
| 44 | #ifdef HAVE_XWIDGETS | ||
| 45 | # include "xwidget.h" | ||
| 46 | #endif | ||
| 47 | 45 | ||
| 48 | static ptrdiff_t count_windows (struct window *); | 46 | static ptrdiff_t count_windows (struct window *); |
| 49 | static ptrdiff_t get_leaf_windows (struct window *, struct window **, | 47 | static ptrdiff_t get_leaf_windows (struct window *, struct window **, |
| @@ -4371,9 +4369,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4371 | 4369 | ||
| 4372 | /* Block input. */ | 4370 | /* Block input. */ |
| 4373 | block_input (); | 4371 | block_input (); |
| 4374 | #ifdef HAVE_XWIDGETS | ||
| 4375 | xwidget_view_delete_all_in_window (w); | 4372 | xwidget_view_delete_all_in_window (w); |
| 4376 | #endif | ||
| 4377 | window_resize_apply (p, horflag); | 4373 | window_resize_apply (p, horflag); |
| 4378 | /* If this window is referred to by the dpyinfo's mouse | 4374 | /* If this window is referred to by the dpyinfo's mouse |
| 4379 | highlight, invalidate that slot to be safe (Bug#9904). */ | 4375 | highlight, invalidate that slot to be safe (Bug#9904). */ |
diff --git a/src/xdisp.c b/src/xdisp.c index 89385c0e172..5185e777324 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -314,13 +314,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 314 | #include "font.h" | 314 | #include "font.h" |
| 315 | #include "fontset.h" | 315 | #include "fontset.h" |
| 316 | #include "blockinput.h" | 316 | #include "blockinput.h" |
| 317 | #include "xwidget.h" | ||
| 317 | #ifdef HAVE_WINDOW_SYSTEM | 318 | #ifdef HAVE_WINDOW_SYSTEM |
| 318 | #include TERM_HEADER | 319 | #include TERM_HEADER |
| 319 | #endif /* HAVE_WINDOW_SYSTEM */ | 320 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 320 | 321 | ||
| 321 | #ifdef HAVE_XWIDGETS | ||
| 322 | # include "xwidget.h" | ||
| 323 | #endif | ||
| 324 | #ifndef FRAME_X_OUTPUT | 322 | #ifndef FRAME_X_OUTPUT |
| 325 | #define FRAME_X_OUTPUT(f) ((f)->output_data.x) | 323 | #define FRAME_X_OUTPUT(f) ((f)->output_data.x) |
| 326 | #endif | 324 | #endif |
| @@ -857,9 +855,7 @@ static bool next_element_from_buffer (struct it *); | |||
| 857 | static bool next_element_from_composition (struct it *); | 855 | static bool next_element_from_composition (struct it *); |
| 858 | static bool next_element_from_image (struct it *); | 856 | static bool next_element_from_image (struct it *); |
| 859 | static bool next_element_from_stretch (struct it *); | 857 | static bool next_element_from_stretch (struct it *); |
| 860 | #ifdef HAVE_XWIDGETS | ||
| 861 | static bool next_element_from_xwidget (struct it *); | 858 | static bool next_element_from_xwidget (struct it *); |
| 862 | #endif | ||
| 863 | static void load_overlay_strings (struct it *, ptrdiff_t); | 859 | static void load_overlay_strings (struct it *, ptrdiff_t); |
| 864 | static bool get_next_display_element (struct it *); | 860 | static bool get_next_display_element (struct it *); |
| 865 | static enum move_it_result | 861 | static enum move_it_result |
| @@ -5147,11 +5143,8 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 5147 | && valid_image_p (value)) | 5143 | && valid_image_p (value)) |
| 5148 | #endif /* not HAVE_WINDOW_SYSTEM */ | 5144 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 5149 | || (CONSP (value) && EQ (XCAR (value), Qspace)) | 5145 | || (CONSP (value) && EQ (XCAR (value), Qspace)) |
| 5150 | #ifdef HAVE_XWIDGETS | ||
| 5151 | || ((it ? FRAME_WINDOW_P (it->f) : frame_window_p) | 5146 | || ((it ? FRAME_WINDOW_P (it->f) : frame_window_p) |
| 5152 | && valid_xwidget_spec_p (value)) | 5147 | && valid_xwidget_spec_p (value))); |
| 5153 | #endif | ||
| 5154 | ); | ||
| 5155 | 5148 | ||
| 5156 | if (valid_p && display_replaced == 0) | 5149 | if (valid_p && display_replaced == 0) |
| 5157 | { | 5150 | { |
| @@ -5226,17 +5219,15 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 5226 | *position = it->position = start_pos; | 5219 | *position = it->position = start_pos; |
| 5227 | retval = 1 + (it->area == TEXT_AREA); | 5220 | retval = 1 + (it->area == TEXT_AREA); |
| 5228 | } | 5221 | } |
| 5229 | #ifdef HAVE_XWIDGETS | 5222 | else if (valid_xwidget_spec_p (value)) |
| 5230 | else if (valid_xwidget_spec_p(value)) | ||
| 5231 | { | 5223 | { |
| 5232 | it->what = IT_XWIDGET; | 5224 | it->what = IT_XWIDGET; |
| 5233 | it->method = GET_FROM_XWIDGET; | 5225 | it->method = GET_FROM_XWIDGET; |
| 5234 | it->position = start_pos; | 5226 | it->position = start_pos; |
| 5235 | it->object = NILP (object) ? it->w->contents : object; | 5227 | it->object = NILP (object) ? it->w->contents : object; |
| 5236 | *position = start_pos; | 5228 | *position = start_pos; |
| 5237 | it->xwidget = lookup_xwidget(value); | 5229 | it->xwidget = lookup_xwidget (value); |
| 5238 | } | 5230 | } |
| 5239 | #endif | ||
| 5240 | #ifdef HAVE_WINDOW_SYSTEM | 5231 | #ifdef HAVE_WINDOW_SYSTEM |
| 5241 | else | 5232 | else |
| 5242 | { | 5233 | { |
| @@ -5989,11 +5980,9 @@ push_it (struct it *it, struct text_pos *position) | |||
| 5989 | case GET_FROM_STRETCH: | 5980 | case GET_FROM_STRETCH: |
| 5990 | p->u.stretch.object = it->object; | 5981 | p->u.stretch.object = it->object; |
| 5991 | break; | 5982 | break; |
| 5992 | #ifdef HAVE_XWIDGETS | ||
| 5993 | case GET_FROM_XWIDGET: | 5983 | case GET_FROM_XWIDGET: |
| 5994 | p->u.xwidget.object = it->object; | 5984 | p->u.xwidget.object = it->object; |
| 5995 | break; | 5985 | break; |
| 5996 | #endif | ||
| 5997 | case GET_FROM_BUFFER: | 5986 | case GET_FROM_BUFFER: |
| 5998 | case GET_FROM_DISPLAY_VECTOR: | 5987 | case GET_FROM_DISPLAY_VECTOR: |
| 5999 | case GET_FROM_STRING: | 5988 | case GET_FROM_STRING: |
| @@ -6095,11 +6084,9 @@ pop_it (struct it *it) | |||
| 6095 | it->object = p->u.image.object; | 6084 | it->object = p->u.image.object; |
| 6096 | it->slice = p->u.image.slice; | 6085 | it->slice = p->u.image.slice; |
| 6097 | break; | 6086 | break; |
| 6098 | #ifdef HAVE_XWIDGETS | ||
| 6099 | case GET_FROM_XWIDGET: | 6087 | case GET_FROM_XWIDGET: |
| 6100 | it->object = p->u.xwidget.object; | 6088 | it->object = p->u.xwidget.object; |
| 6101 | break; | 6089 | break; |
| 6102 | #endif | ||
| 6103 | case GET_FROM_STRETCH: | 6090 | case GET_FROM_STRETCH: |
| 6104 | it->object = p->u.stretch.object; | 6091 | it->object = p->u.stretch.object; |
| 6105 | break; | 6092 | break; |
| @@ -6775,9 +6762,7 @@ static next_element_function const get_next_element[NUM_IT_METHODS] = | |||
| 6775 | next_element_from_c_string, | 6762 | next_element_from_c_string, |
| 6776 | next_element_from_image, | 6763 | next_element_from_image, |
| 6777 | next_element_from_stretch, | 6764 | next_element_from_stretch, |
| 6778 | #ifdef HAVE_XWIDGETS | ||
| 6779 | next_element_from_xwidget, | 6765 | next_element_from_xwidget, |
| 6780 | #endif | ||
| 6781 | }; | 6766 | }; |
| 6782 | 6767 | ||
| 6783 | #define GET_NEXT_DISPLAY_ELEMENT(it) (*get_next_element[(it)->method]) (it) | 6768 | #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) | |||
| 7638 | 7623 | ||
| 7639 | case GET_FROM_IMAGE: | 7624 | case GET_FROM_IMAGE: |
| 7640 | case GET_FROM_STRETCH: | 7625 | case GET_FROM_STRETCH: |
| 7641 | #ifdef HAVE_XWIDGETS | ||
| 7642 | case GET_FROM_XWIDGET: | 7626 | case GET_FROM_XWIDGET: |
| 7643 | #endif | ||
| 7644 | 7627 | ||
| 7645 | /* The position etc with which we have to proceed are on | 7628 | /* The position etc with which we have to proceed are on |
| 7646 | the stack. The position may be at the end of a string, | 7629 | the stack. The position may be at the end of a string, |
| @@ -8103,14 +8086,12 @@ next_element_from_image (struct it *it) | |||
| 8103 | return true; | 8086 | return true; |
| 8104 | } | 8087 | } |
| 8105 | 8088 | ||
| 8106 | #ifdef HAVE_XWIDGETS | ||
| 8107 | static bool | 8089 | static bool |
| 8108 | next_element_from_xwidget (struct it *it) | 8090 | next_element_from_xwidget (struct it *it) |
| 8109 | { | 8091 | { |
| 8110 | it->what = IT_XWIDGET; | 8092 | it->what = IT_XWIDGET; |
| 8111 | return true; | 8093 | return true; |
| 8112 | } | 8094 | } |
| 8113 | #endif | ||
| 8114 | 8095 | ||
| 8115 | 8096 | ||
| 8116 | /* Fill iterator IT with next display element from a stretch glyph | 8097 | /* Fill iterator IT with next display element from a stretch glyph |
| @@ -18844,9 +18825,11 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) | |||
| 18844 | glyph->left_box_line_p, | 18825 | glyph->left_box_line_p, |
| 18845 | glyph->right_box_line_p); | 18826 | glyph->right_box_line_p); |
| 18846 | } | 18827 | } |
| 18847 | #ifdef HAVE_XWIDGETS | ||
| 18848 | else if (glyph->type == XWIDGET_GLYPH) | 18828 | else if (glyph->type == XWIDGET_GLYPH) |
| 18849 | { | 18829 | { |
| 18830 | #ifndef HAVE_XWIDGETS | ||
| 18831 | eassume (false); | ||
| 18832 | #else | ||
| 18850 | fprintf (stderr, | 18833 | fprintf (stderr, |
| 18851 | " %5d %4c %6d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", | 18834 | " %5d %4c %6d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", |
| 18852 | glyph - row->glyphs[TEXT_AREA], | 18835 | glyph - row->glyphs[TEXT_AREA], |
| @@ -18863,9 +18846,8 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) | |||
| 18863 | glyph->face_id, | 18846 | glyph->face_id, |
| 18864 | glyph->left_box_line_p, | 18847 | glyph->left_box_line_p, |
| 18865 | glyph->right_box_line_p); | 18848 | glyph->right_box_line_p); |
| 18866 | |||
| 18867 | } | ||
| 18868 | #endif | 18849 | #endif |
| 18850 | } | ||
| 18869 | } | 18851 | } |
| 18870 | 18852 | ||
| 18871 | 18853 | ||
| @@ -24364,13 +24346,11 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, | |||
| 24364 | 24346 | ||
| 24365 | return OK_PIXELS (width_p ? img->width : img->height); | 24347 | return OK_PIXELS (width_p ? img->width : img->height); |
| 24366 | } | 24348 | } |
| 24367 | # ifdef HAVE_XWIDGETS | ||
| 24368 | if (FRAME_WINDOW_P (it->f) && valid_xwidget_spec_p (prop)) | 24349 | if (FRAME_WINDOW_P (it->f) && valid_xwidget_spec_p (prop)) |
| 24369 | { | 24350 | { |
| 24370 | // TODO: Don't return dummy size. | 24351 | // TODO: Don't return dummy size. |
| 24371 | return OK_PIXELS (100); | 24352 | return OK_PIXELS (100); |
| 24372 | } | 24353 | } |
| 24373 | # endif | ||
| 24374 | #endif | 24354 | #endif |
| 24375 | if (EQ (car, Qplus) || EQ (car, Qminus)) | 24355 | if (EQ (car, Qplus) || EQ (car, Qminus)) |
| 24376 | { | 24356 | { |
| @@ -25273,8 +25253,11 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p) | |||
| 25273 | } \ | 25253 | } \ |
| 25274 | while (false) | 25254 | while (false) |
| 25275 | 25255 | ||
| 25276 | #ifdef HAVE_XWIDGETS | 25256 | #ifndef HAVE_XWIDGETS |
| 25277 | #define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \ | 25257 | # define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \ |
| 25258 | eassume (false) | ||
| 25259 | #else | ||
| 25260 | # define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \ | ||
| 25278 | do \ | 25261 | do \ |
| 25279 | { \ | 25262 | { \ |
| 25280 | s = alloca (sizeof *s); \ | 25263 | s = alloca (sizeof *s); \ |
| @@ -25287,7 +25270,6 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p) | |||
| 25287 | while (false) | 25270 | while (false) |
| 25288 | #endif | 25271 | #endif |
| 25289 | 25272 | ||
| 25290 | |||
| 25291 | /* Add a glyph string for a sequence of character glyphs to the list | 25273 | /* Add a glyph string for a sequence of character glyphs to the list |
| 25292 | of strings between HEAD and TAIL. START is the index of the first | 25274 | of strings between HEAD and TAIL. START is the index of the first |
| 25293 | glyph in row area AREA of glyph row ROW that is part of the new | 25275 | glyph in row area AREA of glyph row ROW that is part of the new |
| @@ -25441,13 +25423,11 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p) | |||
| 25441 | HL, X, LAST_X); \ | 25423 | HL, X, LAST_X); \ |
| 25442 | break; | 25424 | break; |
| 25443 | 25425 | ||
| 25444 | #ifdef HAVE_XWIDGETS | 25426 | #define BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \ |
| 25445 | # define BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \ | ||
| 25446 | case XWIDGET_GLYPH: \ | 25427 | case XWIDGET_GLYPH: \ |
| 25447 | BUILD_XWIDGET_GLYPH_STRING (START, END, HEAD, TAIL, \ | 25428 | BUILD_XWIDGET_GLYPH_STRING (START, END, HEAD, TAIL, \ |
| 25448 | HL, X, LAST_X); \ | 25429 | HL, X, LAST_X); \ |
| 25449 | break; | 25430 | break; |
| 25450 | #endif | ||
| 25451 | 25431 | ||
| 25452 | #define BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X) \ | 25432 | #define BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X) \ |
| 25453 | case GLYPHLESS_GLYPH: \ | 25433 | case GLYPHLESS_GLYPH: \ |
| @@ -25456,7 +25436,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p) | |||
| 25456 | break; \ | 25436 | break; \ |
| 25457 | \ | 25437 | \ |
| 25458 | default: \ | 25438 | default: \ |
| 25459 | emacs_abort (); \ | 25439 | emacs_abort (); \ |
| 25460 | } \ | 25440 | } \ |
| 25461 | \ | 25441 | \ |
| 25462 | if (s) \ | 25442 | if (s) \ |
| @@ -25468,16 +25448,10 @@ compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p) | |||
| 25468 | } while (false) | 25448 | } while (false) |
| 25469 | 25449 | ||
| 25470 | 25450 | ||
| 25471 | #ifdef HAVE_XWIDGETS | 25451 | #define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X) \ |
| 25472 | # define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X) \ | ||
| 25473 | BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X) \ | 25452 | BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X) \ |
| 25474 | BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \ | 25453 | BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \ |
| 25475 | BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X) | 25454 | BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X) |
| 25476 | #else | ||
| 25477 | # define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X) \ | ||
| 25478 | BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X) \ | ||
| 25479 | BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X) | ||
| 25480 | #endif | ||
| 25481 | 25455 | ||
| 25482 | 25456 | ||
| 25483 | /* Draw glyphs between START and END in AREA of ROW on window W, | 25457 | /* Draw glyphs between START and END in AREA of ROW on window W, |
| @@ -26118,10 +26092,10 @@ produce_image_glyph (struct it *it) | |||
| 26118 | } | 26092 | } |
| 26119 | } | 26093 | } |
| 26120 | 26094 | ||
| 26121 | #ifdef HAVE_XWIDGETS | ||
| 26122 | static void | 26095 | static void |
| 26123 | produce_xwidget_glyph (struct it *it) | 26096 | produce_xwidget_glyph (struct it *it) |
| 26124 | { | 26097 | { |
| 26098 | #ifdef HAVE_XWIDGETS | ||
| 26125 | struct xwidget *xw; | 26099 | struct xwidget *xw; |
| 26126 | int glyph_ascent, crop; | 26100 | int glyph_ascent, crop; |
| 26127 | eassert (it->what == IT_XWIDGET); | 26101 | eassert (it->what == IT_XWIDGET); |
| @@ -26219,8 +26193,8 @@ produce_xwidget_glyph (struct it *it) | |||
| 26219 | else | 26193 | else |
| 26220 | IT_EXPAND_MATRIX_WIDTH (it, area); | 26194 | IT_EXPAND_MATRIX_WIDTH (it, area); |
| 26221 | } | 26195 | } |
| 26222 | } | ||
| 26223 | #endif | 26196 | #endif |
| 26197 | } | ||
| 26224 | 26198 | ||
| 26225 | /* Append a stretch glyph to IT->glyph_row. OBJECT is the source | 26199 | /* Append a stretch glyph to IT->glyph_row. OBJECT is the source |
| 26226 | of the glyph, WIDTH and HEIGHT are the width and height of the | 26200 | of the glyph, WIDTH and HEIGHT are the width and height of the |
| @@ -27631,10 +27605,8 @@ x_produce_glyphs (struct it *it) | |||
| 27631 | produce_image_glyph (it); | 27605 | produce_image_glyph (it); |
| 27632 | else if (it->what == IT_STRETCH) | 27606 | else if (it->what == IT_STRETCH) |
| 27633 | produce_stretch_glyph (it); | 27607 | produce_stretch_glyph (it); |
| 27634 | #ifdef HAVE_XWIDGETS | ||
| 27635 | else if (it->what == IT_XWIDGET) | 27608 | else if (it->what == IT_XWIDGET) |
| 27636 | produce_xwidget_glyph (it); | 27609 | produce_xwidget_glyph (it); |
| 27637 | #endif | ||
| 27638 | 27610 | ||
| 27639 | done: | 27611 | done: |
| 27640 | /* Accumulate dimensions. Note: can't assume that it->descent > 0 | 27612 | /* Accumulate dimensions. Note: can't assume that it->descent > 0 |
| @@ -28004,10 +27976,8 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, | |||
| 28004 | /* Use normal cursor if not blinked off. */ | 27976 | /* Use normal cursor if not blinked off. */ |
| 28005 | if (!w->cursor_off_p) | 27977 | if (!w->cursor_off_p) |
| 28006 | { | 27978 | { |
| 28007 | #ifdef HAVE_XWIDGETS | ||
| 28008 | if (glyph != NULL && glyph->type == XWIDGET_GLYPH) | 27979 | if (glyph != NULL && glyph->type == XWIDGET_GLYPH) |
| 28009 | return NO_CURSOR; | 27980 | return NO_CURSOR; |
| 28010 | #endif | ||
| 28011 | if (glyph != NULL && glyph->type == IMAGE_GLYPH) | 27981 | if (glyph != NULL && glyph->type == IMAGE_GLYPH) |
| 28012 | { | 27982 | { |
| 28013 | if (cursor_type == FILLED_BOX_CURSOR) | 27983 | if (cursor_type == FILLED_BOX_CURSOR) |
diff --git a/src/xterm.c b/src/xterm.c index 44eed22d2ec..1f71afd7f70 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -62,9 +62,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 62 | #include "composite.h" | 62 | #include "composite.h" |
| 63 | #include "frame.h" | 63 | #include "frame.h" |
| 64 | #include "dispextern.h" | 64 | #include "dispextern.h" |
| 65 | #ifdef HAVE_XWIDGETS | 65 | #include "xwidget.h" |
| 66 | # include "xwidget.h" | ||
| 67 | #endif | ||
| 68 | #include "fontset.h" | 66 | #include "fontset.h" |
| 69 | #include "termhooks.h" | 67 | #include "termhooks.h" |
| 70 | #include "termopts.h" | 68 | #include "termopts.h" |
| @@ -1315,7 +1313,6 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring | |||
| 1315 | { | 1313 | { |
| 1316 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 1314 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 1317 | Display *display = FRAME_X_DISPLAY (f); | 1315 | Display *display = FRAME_X_DISPLAY (f); |
| 1318 | Window window = FRAME_X_WINDOW (f); | ||
| 1319 | GC gc = f->output_data.x->normal_gc; | 1316 | GC gc = f->output_data.x->normal_gc; |
| 1320 | struct face *face = p->face; | 1317 | struct face *face = p->face; |
| 1321 | 1318 | ||
| @@ -1358,6 +1355,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring | |||
| 1358 | #else /* not USE_CAIRO */ | 1355 | #else /* not USE_CAIRO */ |
| 1359 | if (p->which) | 1356 | if (p->which) |
| 1360 | { | 1357 | { |
| 1358 | Window window = FRAME_X_WINDOW (f); | ||
| 1361 | char *bits; | 1359 | char *bits; |
| 1362 | Pixmap pixmap, clipmask = (Pixmap) 0; | 1360 | Pixmap pixmap, clipmask = (Pixmap) 0; |
| 1363 | int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); | 1361 | int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); |
| @@ -3514,11 +3512,9 @@ x_draw_glyph_string (struct glyph_string *s) | |||
| 3514 | x_draw_image_glyph_string (s); | 3512 | x_draw_image_glyph_string (s); |
| 3515 | break; | 3513 | break; |
| 3516 | 3514 | ||
| 3517 | #ifdef HAVE_XWIDGETS | ||
| 3518 | case XWIDGET_GLYPH: | 3515 | case XWIDGET_GLYPH: |
| 3519 | x_draw_xwidget_glyph_string (s); | 3516 | x_draw_xwidget_glyph_string (s); |
| 3520 | break; | 3517 | break; |
| 3521 | #endif | ||
| 3522 | 3518 | ||
| 3523 | case STRETCH_GLYPH: | 3519 | case STRETCH_GLYPH: |
| 3524 | x_draw_stretch_glyph_string (s); | 3520 | x_draw_stretch_glyph_string (s); |
| @@ -3762,7 +3758,7 @@ x_delete_glyphs (struct frame *f, register int n) | |||
| 3762 | /* Like XClearArea, but check that WIDTH and HEIGHT are reasonable. | 3758 | /* Like XClearArea, but check that WIDTH and HEIGHT are reasonable. |
| 3763 | If they are <= 0, this is probably an error. */ | 3759 | If they are <= 0, this is probably an error. */ |
| 3764 | 3760 | ||
| 3765 | static void | 3761 | static ATTRIBUTE_UNUSED void |
| 3766 | x_clear_area1 (Display *dpy, Window window, | 3762 | x_clear_area1 (Display *dpy, Window window, |
| 3767 | int x, int y, int width, int height, int exposures) | 3763 | int x, int y, int width, int height, int exposures) |
| 3768 | { | 3764 | { |
| @@ -3770,7 +3766,6 @@ x_clear_area1 (Display *dpy, Window window, | |||
| 3770 | XClearArea (dpy, window, x, y, width, height, exposures); | 3766 | XClearArea (dpy, window, x, y, width, height, exposures); |
| 3771 | } | 3767 | } |
| 3772 | 3768 | ||
| 3773 | |||
| 3774 | void | 3769 | void |
| 3775 | x_clear_area (struct frame *f, int x, int y, int width, int height) | 3770 | x_clear_area (struct frame *f, int x, int y, int width, int height) |
| 3776 | { | 3771 | { |
| @@ -8929,10 +8924,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text | |||
| 8929 | if (cursor_glyph == NULL) | 8924 | if (cursor_glyph == NULL) |
| 8930 | return; | 8925 | return; |
| 8931 | 8926 | ||
| 8932 | #ifdef HAVE_XWIDGETS | 8927 | /* Experimental avoidance of cursor on xwidget. */ |
| 8933 | if (cursor_glyph->type == XWIDGET_GLYPH) | 8928 | if (cursor_glyph->type == XWIDGET_GLYPH) |
| 8934 | return; // Experimental avoidance of cursor on xwidget. | 8929 | return; |
| 8935 | #endif | ||
| 8936 | 8930 | ||
| 8937 | /* If on an image, draw like a normal cursor. That's usually better | 8931 | /* If on an image, draw like a normal cursor. That's usually better |
| 8938 | visible than drawing a bar, esp. if the image is large so that | 8932 | visible than drawing a bar, esp. if the image is large so that |
diff --git a/src/xwidget.c b/src/xwidget.c index ea5dea0f9fe..be3e4ca5732 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | #include "xwidget.h" | ||
| 22 | 23 | ||
| 23 | #include <signal.h> | 24 | #include <signal.h> |
| 24 | 25 | ||
| @@ -105,8 +106,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 105 | #include <webkit/webkitdownload.h> | 106 | #include <webkit/webkitdownload.h> |
| 106 | #include <webkit/webkitwebpolicydecision.h> | 107 | #include <webkit/webkitwebpolicydecision.h> |
| 107 | 108 | ||
| 108 | #include "xwidget.h" | ||
| 109 | |||
| 110 | static struct xwidget * | 109 | static struct xwidget * |
| 111 | allocate_xwidget (void) | 110 | allocate_xwidget (void) |
| 112 | { | 111 | { |
| @@ -120,8 +119,8 @@ allocate_xwidget_view (void) | |||
| 120 | PVEC_XWIDGET_VIEW); | 119 | PVEC_XWIDGET_VIEW); |
| 121 | } | 120 | } |
| 122 | 121 | ||
| 123 | #define XSETXWIDGET(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET)) | 122 | #define XSETXWIDGET(a, b) XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET) |
| 124 | #define XSETXWIDGET_VIEW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET_VIEW)) | 123 | #define XSETXWIDGET_VIEW(a, b) XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET_VIEW) |
| 125 | 124 | ||
| 126 | static struct xwidget_view *xwidget_view_lookup (struct xwidget *, | 125 | static struct xwidget_view *xwidget_view_lookup (struct xwidget *, |
| 127 | struct window *); | 126 | struct window *); |
| @@ -163,67 +162,57 @@ If BUFFER is nil, use the current buffer. | |||
| 163 | If BUFFER is a string and no such buffer exists, create it. | 162 | If BUFFER is a string and no such buffer exists, create it. |
| 164 | TYPE is a symbol which can take one of the following values: | 163 | TYPE is a symbol which can take one of the following values: |
| 165 | 164 | ||
| 166 | - webkit_osr | 165 | - webkit-osr |
| 167 | 166 | ||
| 168 | Returns the newly constructed xwidget, or nil if construction fails. */) | 167 | Returns the newly constructed xwidget, or nil if construction fails. */) |
| 169 | (Lisp_Object beg, Lisp_Object end, | 168 | (Lisp_Object beg, Lisp_Object end, Lisp_Object type, |
| 170 | Lisp_Object type, | 169 | Lisp_Object title, Lisp_Object width, Lisp_Object height, |
| 171 | Lisp_Object title, | 170 | Lisp_Object arguments, Lisp_Object buffer) |
| 172 | Lisp_Object width, Lisp_Object height, | ||
| 173 | Lisp_Object arguments, Lisp_Object buffer) | ||
| 174 | { | 171 | { |
| 175 | //should work a bit like "make-button"(make-button BEG END &rest PROPERTIES) | 172 | CHECK_SYMBOL (type); |
| 176 | // arg "type" and fwd should be keyword args eventually | 173 | CHECK_NATNUM (width); |
| 177 | //(make-xwidget 3 3 'button "oei" 31 31 nil) | 174 | CHECK_NATNUM (height); |
| 178 | //(xwidget-info (car xwidget-list)) | 175 | /* This should work a bit like "make-button" |
| 176 | (make-button BEG END &rest PROPERTIES) | ||
| 177 | TYPE etc. should be keyword args eventually. | ||
| 178 | (make-xwidget 3 3 'button "oei" 31 31 nil) | ||
| 179 | (xwidget-info (car xwidget-list)) */ | ||
| 179 | struct xwidget *xw = allocate_xwidget (); | 180 | struct xwidget *xw = allocate_xwidget (); |
| 180 | Lisp_Object val; | 181 | Lisp_Object val; |
| 181 | xw->type = type; | 182 | xw->type = type; |
| 182 | xw->title = title; | 183 | xw->title = title; |
| 183 | if (NILP (buffer)) | 184 | xw->buffer = NILP (buffer) ? Fcurrent_buffer () : Fget_buffer_create (buffer); |
| 184 | buffer = Fcurrent_buffer (); // no need to gcpro because | ||
| 185 | // Fcurrent_buffer doesn't | ||
| 186 | // call Feval/eval_sub. | ||
| 187 | else | ||
| 188 | buffer = Fget_buffer_create (buffer); | ||
| 189 | xw->buffer = buffer; | ||
| 190 | |||
| 191 | xw->height = XFASTINT (height); | 185 | xw->height = XFASTINT (height); |
| 192 | xw->width = XFASTINT (width); | 186 | xw->width = XFASTINT (width); |
| 193 | xw->kill_without_query = 0; | 187 | xw->kill_without_query = false; |
| 194 | XSETXWIDGET (val, xw); // set the vectorlike_header of VAL | 188 | XSETXWIDGET (val, xw); |
| 195 | // with the correct value | ||
| 196 | Vxwidget_list = Fcons (val, Vxwidget_list); | 189 | Vxwidget_list = Fcons (val, Vxwidget_list); |
| 197 | xw->widgetwindow_osr = NULL; | 190 | xw->widgetwindow_osr = NULL; |
| 198 | xw->widget_osr = NULL; | 191 | xw->widget_osr = NULL; |
| 199 | xw->plist = Qnil; | 192 | xw->plist = Qnil; |
| 200 | 193 | ||
| 201 | |||
| 202 | if (EQ (xw->type, Qwebkit_osr)) | 194 | if (EQ (xw->type, Qwebkit_osr)) |
| 203 | { | 195 | { |
| 204 | block_input (); | 196 | block_input (); |
| 205 | xw->widgetwindow_osr = gtk_offscreen_window_new (); | 197 | xw->widgetwindow_osr = gtk_offscreen_window_new (); |
| 206 | gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width, | 198 | gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width, |
| 207 | xw->height); | 199 | xw->height); |
| 208 | xw->widgetscrolledwindow_osr = NULL; //webkit osr is the | 200 | |
| 209 | //only scrolled | 201 | /* WebKit OSR is the only scrolled component at the moment. */ |
| 210 | //component atm | 202 | xw->widgetscrolledwindow_osr = NULL; |
| 211 | 203 | ||
| 212 | if (EQ (xw->type, Qwebkit_osr)) | 204 | if (EQ (xw->type, Qwebkit_osr)) |
| 213 | { | 205 | { |
| 214 | xw->widgetscrolledwindow_osr = gtk_scrolled_window_new (NULL, NULL); | 206 | xw->widgetscrolledwindow_osr = gtk_scrolled_window_new (NULL, NULL); |
| 215 | gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW | 207 | gtk_scrolled_window_set_min_content_height |
| 216 | (xw-> | 208 | (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr), |
| 217 | widgetscrolledwindow_osr), | 209 | xw->height); |
| 218 | xw->height); | 210 | gtk_scrolled_window_set_min_content_width |
| 219 | gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW | 211 | (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr), |
| 220 | (xw-> | 212 | xw->width); |
| 221 | widgetscrolledwindow_osr), | 213 | gtk_scrolled_window_set_policy |
| 222 | xw->width); | 214 | (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr), |
| 223 | gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW | 215 | GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS); |
| 224 | (xw->widgetscrolledwindow_osr), | ||
| 225 | GTK_POLICY_ALWAYS, | ||
| 226 | GTK_POLICY_ALWAYS); | ||
| 227 | 216 | ||
| 228 | xw->widget_osr = webkit_web_view_new (); | 217 | xw->widget_osr = webkit_web_view_new (); |
| 229 | gtk_container_add (GTK_CONTAINER (xw->widgetscrolledwindow_osr), | 218 | gtk_container_add (GTK_CONTAINER (xw->widgetscrolledwindow_osr), |
| @@ -248,12 +237,10 @@ Returns the newly constructed xwidget, or nil if construction fails. */) | |||
| 248 | gtk_widget_show (xw->widgetwindow_osr); | 237 | gtk_widget_show (xw->widgetwindow_osr); |
| 249 | gtk_widget_show (xw->widgetscrolledwindow_osr); | 238 | gtk_widget_show (xw->widgetscrolledwindow_osr); |
| 250 | 239 | ||
| 251 | /* store some xwidget data in the gtk widgets for convenient | 240 | /* Store some xwidget data in the gtk widgets for convenient |
| 252 | retrieval in the event handlers. */ | 241 | retrieval in the event handlers. */ |
| 253 | g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, | 242 | g_object_set_data (G_OBJECT (xw->widget_osr), XG_XWIDGET, xw); |
| 254 | (gpointer) (xw)); | 243 | g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, xw); |
| 255 | g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, | ||
| 256 | (gpointer) (xw)); | ||
| 257 | 244 | ||
| 258 | /* signals */ | 245 | /* signals */ |
| 259 | if (EQ (xw->type, Qwebkit_osr)) | 246 | if (EQ (xw->type, Qwebkit_osr)) |
| @@ -286,7 +273,6 @@ Returns the newly constructed xwidget, or nil if construction fails. */) | |||
| 286 | } | 273 | } |
| 287 | 274 | ||
| 288 | unblock_input (); | 275 | unblock_input (); |
| 289 | |||
| 290 | } | 276 | } |
| 291 | 277 | ||
| 292 | return val; | 278 | return val; |
| @@ -317,18 +303,16 @@ BUFFER may be a buffer or the name of one. */) | |||
| 317 | return xw_list; | 303 | return xw_list; |
| 318 | } | 304 | } |
| 319 | 305 | ||
| 320 | static int | 306 | static bool |
| 321 | xwidget_hidden (struct xwidget_view *xv) | 307 | xwidget_hidden (struct xwidget_view *xv) |
| 322 | { | 308 | { |
| 323 | return xv->hidden; | 309 | return xv->hidden; |
| 324 | } | 310 | } |
| 325 | 311 | ||
| 326 | |||
| 327 | |||
| 328 | static void | 312 | static void |
| 329 | xwidget_show_view (struct xwidget_view *xv) | 313 | xwidget_show_view (struct xwidget_view *xv) |
| 330 | { | 314 | { |
| 331 | xv->hidden = 0; | 315 | xv->hidden = false; |
| 332 | gtk_widget_show (xv->widgetwindow); | 316 | gtk_widget_show (xv->widgetwindow); |
| 333 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), | 317 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), |
| 334 | xv->widgetwindow, | 318 | xv->widgetwindow, |
| @@ -336,33 +320,30 @@ xwidget_show_view (struct xwidget_view *xv) | |||
| 336 | xv->y + xv->clip_top); | 320 | xv->y + xv->clip_top); |
| 337 | } | 321 | } |
| 338 | 322 | ||
| 339 | |||
| 340 | /* Hide an xvidget view. */ | 323 | /* Hide an xvidget view. */ |
| 341 | static void | 324 | static void |
| 342 | xwidget_hide_view (struct xwidget_view *xv) | 325 | xwidget_hide_view (struct xwidget_view *xv) |
| 343 | { | 326 | { |
| 344 | xv->hidden = 1; | 327 | xv->hidden = true; |
| 345 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), xv->widgetwindow, | 328 | gtk_fixed_move (GTK_FIXED (xv->emacswindow), xv->widgetwindow, |
| 346 | 10000, 10000); | 329 | 10000, 10000); |
| 347 | } | 330 | } |
| 348 | 331 | ||
| 349 | |||
| 350 | |||
| 351 | /* When the off-screen webkit master view changes this signal is called. | 332 | /* When the off-screen webkit master view changes this signal is called. |
| 352 | It copies the bitmap from the off-screen instance. */ | 333 | It copies the bitmap from the off-screen instance. */ |
| 353 | static gboolean | 334 | static gboolean |
| 354 | offscreen_damage_event (GtkWidget * widget, GdkEvent * event, | 335 | offscreen_damage_event (GtkWidget *widget, GdkEvent *event, |
| 355 | gpointer xv_widget) | 336 | gpointer xv_widget) |
| 356 | { | 337 | { |
| 357 | // Queue a redraw of onscreen widget. | 338 | /* Queue a redraw of onscreen widget. |
| 358 | // There is a guard against receiving an invalid widget, | 339 | There is a guard against receiving an invalid widget, |
| 359 | // which should only happen if we failed to remove the | 340 | which should only happen if we failed to remove the |
| 360 | // specific signal handler for the damage event. | 341 | specific signal handler for the damage event. */ |
| 361 | if (GTK_IS_WIDGET (xv_widget)) | 342 | if (GTK_IS_WIDGET (xv_widget)) |
| 362 | gtk_widget_queue_draw (GTK_WIDGET (xv_widget)); | 343 | gtk_widget_queue_draw (GTK_WIDGET (xv_widget)); |
| 363 | else | 344 | else |
| 364 | printf ("Warning, offscreen_damage_event received invalid xv pointer:%p\n", | 345 | printf ("Warning, offscreen_damage_event received invalid xv pointer:%p\n", |
| 365 | (void *) xv_widget); | 346 | xv_widget); |
| 366 | 347 | ||
| 367 | return FALSE; | 348 | return FALSE; |
| 368 | } | 349 | } |
| @@ -377,75 +358,58 @@ store_xwidget_event_string (struct xwidget *xw, const char *eventname, | |||
| 377 | EVENT_INIT (event); | 358 | EVENT_INIT (event); |
| 378 | event.kind = XWIDGET_EVENT; | 359 | event.kind = XWIDGET_EVENT; |
| 379 | event.frame_or_window = Qnil; | 360 | event.frame_or_window = Qnil; |
| 380 | 361 | event.arg = list3 (intern (eventname), xwl, build_string (eventstr)); | |
| 381 | event.arg = Qnil; | ||
| 382 | event.arg = Fcons (build_string (eventstr), event.arg); | ||
| 383 | event.arg = Fcons (xwl, event.arg); | ||
| 384 | event.arg = Fcons (intern (eventname), event.arg); | ||
| 385 | kbd_buffer_store_event (&event); | 362 | kbd_buffer_store_event (&event); |
| 386 | |||
| 387 | } | 363 | } |
| 388 | 364 | ||
| 389 | //TODO deprecated, use load-status | 365 | /* TODO deprecated, use load-status. */ |
| 390 | void | 366 | void |
| 391 | webkit_document_load_finished_cb (WebKitWebView * webkitwebview, | 367 | webkit_document_load_finished_cb (WebKitWebView *webkitwebview, |
| 392 | WebKitWebFrame * arg1, | 368 | WebKitWebFrame *arg1, |
| 393 | gpointer data) | 369 | gpointer data) |
| 394 | { | 370 | { |
| 395 | struct xwidget *xw = | 371 | struct xwidget *xw = g_object_get_data (G_OBJECT (webkitwebview), |
| 396 | (struct xwidget *) g_object_get_data (G_OBJECT (webkitwebview), | ||
| 397 | XG_XWIDGET); | 372 | XG_XWIDGET); |
| 398 | 373 | ||
| 399 | store_xwidget_event_string (xw, "document-load-finished", ""); | 374 | store_xwidget_event_string (xw, "document-load-finished", ""); |
| 400 | } | 375 | } |
| 401 | 376 | ||
| 402 | gboolean | 377 | gboolean |
| 403 | webkit_download_cb (WebKitWebView * webkitwebview, | 378 | webkit_download_cb (WebKitWebView *webkitwebview, |
| 404 | WebKitDownload * arg1, | 379 | WebKitDownload *arg1, |
| 405 | gpointer data) | 380 | gpointer data) |
| 406 | { | 381 | { |
| 407 | struct xwidget *xw = | 382 | struct xwidget *xw = g_object_get_data (G_OBJECT (webkitwebview), |
| 408 | (struct xwidget *) g_object_get_data (G_OBJECT (webkitwebview), | ||
| 409 | XG_XWIDGET); | 383 | XG_XWIDGET); |
| 410 | store_xwidget_event_string (xw, "download-requested", | 384 | store_xwidget_event_string (xw, "download-requested", |
| 411 | webkit_download_get_uri (arg1)); | 385 | webkit_download_get_uri (arg1)); |
| 412 | |||
| 413 | return FALSE; | 386 | return FALSE; |
| 414 | } | 387 | } |
| 415 | 388 | ||
| 416 | static gboolean | 389 | static gboolean |
| 417 | webkit_mime_type_policy_typedecision_requested_cb (WebKitWebView *webView, | 390 | webkit_mime_type_policy_typedecision_requested_cb |
| 418 | WebKitWebFrame *frame, | 391 | (WebKitWebView *webView, WebKitWebFrame *frame, WebKitNetworkRequest *request, |
| 419 | WebKitNetworkRequest * request, | 392 | gchar *mimetype, WebKitWebPolicyDecision *policy_decision, gpointer user_data) |
| 420 | gchar * mimetype, | ||
| 421 | WebKitWebPolicyDecision *policy_decision, | ||
| 422 | gpointer user_data) | ||
| 423 | { | 393 | { |
| 424 | // This function makes webkit send a download signal for all unknown | 394 | /* This function makes webkit send a download signal for all unknown |
| 425 | // mime types. TODO Defer the decision to lisp, so that its possible | 395 | mime types. TODO: Defer the decision to Lisp, so that it's |
| 426 | // to make Emacs handle teext mime for instance.xs | 396 | possible to make Emacs handle teext mime for instance.xs. */ |
| 427 | if (!webkit_web_view_can_show_mime_type (webView, mimetype)) | 397 | if (!webkit_web_view_can_show_mime_type (webView, mimetype)) |
| 428 | { | 398 | { |
| 429 | webkit_web_policy_decision_download (policy_decision); | 399 | webkit_web_policy_decision_download (policy_decision); |
| 430 | return TRUE; | 400 | return TRUE; |
| 431 | } | 401 | } |
| 432 | else | 402 | else |
| 433 | { | 403 | return FALSE; |
| 434 | return FALSE; | ||
| 435 | } | ||
| 436 | } | 404 | } |
| 437 | 405 | ||
| 438 | |||
| 439 | static gboolean | 406 | static gboolean |
| 440 | webkit_new_window_policy_decision_requested_cb (WebKitWebView *webView, | 407 | webkit_new_window_policy_decision_requested_cb |
| 441 | WebKitWebFrame *frame, | 408 | (WebKitWebView *webView, WebKitWebFrame *frame, WebKitNetworkRequest *request, |
| 442 | WebKitNetworkRequest *request, | 409 | WebKitWebNavigationAction *navigation_action, |
| 443 | WebKitWebNavigationAction *navigation_action, | 410 | WebKitWebPolicyDecision *policy_decision, gpointer user_data) |
| 444 | WebKitWebPolicyDecision *policy_decision, | ||
| 445 | gpointer user_data) | ||
| 446 | { | 411 | { |
| 447 | struct xwidget *xw = | 412 | struct xwidget *xw = g_object_get_data (G_OBJECT (webView), XG_XWIDGET); |
| 448 | (struct xwidget *) g_object_get_data (G_OBJECT (webView), XG_XWIDGET); | ||
| 449 | webkit_web_navigation_action_get_original_uri (navigation_action); | 413 | webkit_web_navigation_action_get_original_uri (navigation_action); |
| 450 | 414 | ||
| 451 | store_xwidget_event_string (xw, "new-window-policy-decision-requested", | 415 | store_xwidget_event_string (xw, "new-window-policy-decision-requested", |
| @@ -455,29 +419,24 @@ webkit_new_window_policy_decision_requested_cb (WebKitWebView *webView, | |||
| 455 | } | 419 | } |
| 456 | 420 | ||
| 457 | static gboolean | 421 | static gboolean |
| 458 | webkit_navigation_policy_decision_requested_cb (WebKitWebView *webView, | 422 | webkit_navigation_policy_decision_requested_cb |
| 459 | WebKitWebFrame *frame, | 423 | (WebKitWebView *webView, WebKitWebFrame *frame, WebKitNetworkRequest *request, |
| 460 | WebKitNetworkRequest *request, | 424 | WebKitWebNavigationAction *navigation_action, |
| 461 | WebKitWebNavigationAction *navigation_action, | 425 | WebKitWebPolicyDecision *policy_decision, gpointer user_data) |
| 462 | WebKitWebPolicyDecision * policy_decision, | ||
| 463 | gpointer user_data) | ||
| 464 | { | 426 | { |
| 465 | struct xwidget *xw = | 427 | struct xwidget *xw = g_object_get_data (G_OBJECT (webView), XG_XWIDGET); |
| 466 | (struct xwidget *) g_object_get_data (G_OBJECT (webView), XG_XWIDGET); | ||
| 467 | store_xwidget_event_string (xw, "navigation-policy-decision-requested", | 428 | store_xwidget_event_string (xw, "navigation-policy-decision-requested", |
| 468 | webkit_web_navigation_action_get_original_uri | 429 | webkit_web_navigation_action_get_original_uri |
| 469 | (navigation_action)); | 430 | (navigation_action)); |
| 470 | return FALSE; | 431 | return FALSE; |
| 471 | } | 432 | } |
| 472 | 433 | ||
| 473 | // For gtk3 offscreen rendered widgets. | 434 | /* For gtk3 offscreen rendered widgets. */ |
| 474 | static gboolean | 435 | static gboolean |
| 475 | xwidget_osr_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data) | 436 | xwidget_osr_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data) |
| 476 | { | 437 | { |
| 477 | struct xwidget *xw = | 438 | struct xwidget *xw = g_object_get_data (G_OBJECT (widget), XG_XWIDGET); |
| 478 | (struct xwidget *) g_object_get_data (G_OBJECT (widget), XG_XWIDGET); | 439 | struct xwidget_view *xv = g_object_get_data (G_OBJECT (widget), |
| 479 | struct xwidget_view *xv = | ||
| 480 | (struct xwidget_view *) g_object_get_data (G_OBJECT (widget), | ||
| 481 | XG_XWIDGET_VIEW); | 440 | XG_XWIDGET_VIEW); |
| 482 | 441 | ||
| 483 | cairo_rectangle (cr, 0, 0, xv->clip_right, xv->clip_bottom); | 442 | cairo_rectangle (cr, 0, 0, xv->clip_right, xv->clip_bottom); |
| @@ -491,31 +450,30 @@ xwidget_osr_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data) | |||
| 491 | } | 450 | } |
| 492 | 451 | ||
| 493 | static gboolean | 452 | static gboolean |
| 494 | xwidget_osr_event_forward (GtkWidget * widget, | 453 | xwidget_osr_event_forward (GtkWidget *widget, GdkEvent *event, |
| 495 | GdkEvent * event, | 454 | gpointer user_data) |
| 496 | gpointer user_data) | ||
| 497 | { | 455 | { |
| 498 | /* Copy events that arrive at the outer widget to the offscreen widget. */ | 456 | /* Copy events that arrive at the outer widget to the offscreen widget. */ |
| 499 | struct xwidget *xw = | 457 | struct xwidget *xw = g_object_get_data (G_OBJECT (widget), XG_XWIDGET); |
| 500 | (struct xwidget *) g_object_get_data (G_OBJECT (widget), XG_XWIDGET); | ||
| 501 | GdkEvent *eventcopy = gdk_event_copy (event); | 458 | GdkEvent *eventcopy = gdk_event_copy (event); |
| 502 | eventcopy->any.window = gtk_widget_get_window (xw->widget_osr); | 459 | eventcopy->any.window = gtk_widget_get_window (xw->widget_osr); |
| 503 | 460 | ||
| 504 | //TODO This might leak events. They should be deallocated later, | 461 | /* TODO: This might leak events. They should be deallocated later, |
| 505 | //perhaps in xwgir_event_cb | 462 | perhaps in xwgir_event_cb. */ |
| 506 | gtk_main_do_event (eventcopy); | 463 | gtk_main_do_event (eventcopy); |
| 507 | return TRUE; //dont propagate this event furter | ||
| 508 | } | ||
| 509 | 464 | ||
| 465 | /* Don't propagate this event further. */ | ||
| 466 | return TRUE; | ||
| 467 | } | ||
| 510 | 468 | ||
| 511 | static gboolean | 469 | static gboolean |
| 512 | xwidget_osr_event_set_embedder (GtkWidget * widget, | 470 | xwidget_osr_event_set_embedder (GtkWidget *widget, GdkEvent *event, |
| 513 | GdkEvent * event, gpointer data) | 471 | gpointer data) |
| 514 | { | 472 | { |
| 515 | struct xwidget_view *xv = (struct xwidget_view *) data; | 473 | struct xwidget_view *xv = data; |
| 516 | struct xwidget *xww = XXWIDGET (xv->model); | 474 | struct xwidget *xww = XXWIDGET (xv->model); |
| 517 | gdk_offscreen_window_set_embedder (gtk_widget_get_window | 475 | gdk_offscreen_window_set_embedder (gtk_widget_get_window |
| 518 | (xww->widgetwindow_osr), | 476 | (xww->widgetwindow_osr), |
| 519 | gtk_widget_get_window (xv->widget)); | 477 | gtk_widget_get_window (xv->widget)); |
| 520 | return FALSE; | 478 | return FALSE; |
| 521 | } | 479 | } |
| @@ -539,11 +497,11 @@ xwidget_init_view (struct xwidget *xww, | |||
| 539 | if (EQ (xww->type, Qwebkit_osr)) | 497 | if (EQ (xww->type, Qwebkit_osr)) |
| 540 | { | 498 | { |
| 541 | xv->widget = gtk_drawing_area_new (); | 499 | xv->widget = gtk_drawing_area_new (); |
| 542 | // Expose event handling. | 500 | /* Expose event handling. */ |
| 543 | gtk_widget_set_app_paintable (xv->widget, TRUE); | 501 | gtk_widget_set_app_paintable (xv->widget, TRUE); |
| 544 | gtk_widget_add_events (xv->widget, GDK_ALL_EVENTS_MASK); | 502 | gtk_widget_add_events (xv->widget, GDK_ALL_EVENTS_MASK); |
| 545 | 503 | ||
| 546 | /* Draw the view on damage-event */ | 504 | /* Draw the view on damage-event. */ |
| 547 | g_signal_connect (G_OBJECT (xww->widgetwindow_osr), "damage-event", | 505 | g_signal_connect (G_OBJECT (xww->widgetwindow_osr), "damage-event", |
| 548 | G_CALLBACK (offscreen_damage_event), xv->widget); | 506 | G_CALLBACK (offscreen_damage_event), xv->widget); |
| 549 | 507 | ||
| @@ -558,38 +516,33 @@ xwidget_init_view (struct xwidget *xww, | |||
| 558 | } | 516 | } |
| 559 | else | 517 | else |
| 560 | { | 518 | { |
| 561 | // xwgir debug , orthogonal to forwarding | 519 | /* xwgir debug, orthogonal to forwarding. */ |
| 562 | g_signal_connect (G_OBJECT (xv->widget), "enter-notify-event", | 520 | g_signal_connect (G_OBJECT (xv->widget), "enter-notify-event", |
| 563 | G_CALLBACK (xwidget_osr_event_set_embedder), xv); | 521 | G_CALLBACK (xwidget_osr_event_set_embedder), xv); |
| 564 | } | 522 | } |
| 565 | g_signal_connect (G_OBJECT (xv->widget), "draw", | 523 | g_signal_connect (G_OBJECT (xv->widget), "draw", |
| 566 | G_CALLBACK (xwidget_osr_draw_cb), NULL); | 524 | G_CALLBACK (xwidget_osr_draw_cb), NULL); |
| 567 | } | 525 | } |
| 568 | // Widget realization. | ||
| 569 | 526 | ||
| 570 | // Make container widget 1st, and put the actual widget inside the | 527 | /* Widget realization. |
| 571 | // container later. Drawing should crop container window if necessary | 528 | |
| 572 | // to handle case where xwidget is partially obscured by other Emacs | 529 | Make container widget first, and put the actual widget inside the |
| 573 | // windows. Other containers than gtk_fixed where explored, but | 530 | container later. Drawing should crop container window if necessary |
| 574 | // gtk_fixed had the most predictable behaviour so far. | 531 | to handle case where xwidget is partially obscured by other Emacs |
| 532 | windows. Other containers than gtk_fixed where explored, but | ||
| 533 | gtk_fixed had the most predictable behaviour so far. */ | ||
| 534 | |||
| 575 | xv->emacswindow = FRAME_GTK_WIDGET (s->f); | 535 | xv->emacswindow = FRAME_GTK_WIDGET (s->f); |
| 576 | xv->widgetwindow = gtk_fixed_new (); | 536 | xv->widgetwindow = gtk_fixed_new (); |
| 577 | gtk_widget_set_has_window (xv->widgetwindow, TRUE); | 537 | gtk_widget_set_has_window (xv->widgetwindow, TRUE); |
| 578 | gtk_container_add (GTK_CONTAINER (xv->widgetwindow), xv->widget); | 538 | gtk_container_add (GTK_CONTAINER (xv->widgetwindow), xv->widget); |
| 579 | 539 | ||
| 580 | // Store some xwidget data in the gtk widgets. | 540 | /* Store some xwidget data in the gtk widgets. */ |
| 581 | // The emacs frame. | 541 | g_object_set_data (G_OBJECT (xv->widget), XG_FRAME_DATA, s->f); |
| 582 | g_object_set_data (G_OBJECT (xv->widget), XG_FRAME_DATA, (gpointer) (s->f)); | 542 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET, xww); |
| 583 | // The xwidget. | 543 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET_VIEW, xv); |
| 584 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET, (gpointer) (xww)); | 544 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET, xww); |
| 585 | // The xwidget. | 545 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET_VIEW, xv); |
| 586 | g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET_VIEW, (gpointer) (xv)); | ||
| 587 | // The xwidget window. | ||
| 588 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET, (gpointer) (xww)); | ||
| 589 | // the xwidget view. | ||
| 590 | g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET_VIEW, | ||
| 591 | (gpointer) (xv)); | ||
| 592 | |||
| 593 | 546 | ||
| 594 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xww->width, | 547 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xww->width, |
| 595 | xww->height); | 548 | xww->height); |
| @@ -599,18 +552,15 @@ xwidget_init_view (struct xwidget *xww, | |||
| 599 | xv->y = y; | 552 | xv->y = y; |
| 600 | gtk_widget_show_all (xv->widgetwindow); | 553 | gtk_widget_show_all (xv->widgetwindow); |
| 601 | 554 | ||
| 602 | |||
| 603 | return xv; | 555 | return xv; |
| 604 | } | 556 | } |
| 605 | 557 | ||
| 606 | |||
| 607 | void | 558 | void |
| 608 | x_draw_xwidget_glyph_string (struct glyph_string *s) | 559 | x_draw_xwidget_glyph_string (struct glyph_string *s) |
| 609 | { | 560 | { |
| 610 | /* This method is called by the redisplay engine and places the | 561 | /* This method is called by the redisplay engine and places the |
| 611 | xwidget on screen. Moving and clipping is done here. Also view | 562 | xwidget on screen. Moving and clipping is done here. Also view |
| 612 | initialization. | 563 | initialization. */ |
| 613 | */ | ||
| 614 | struct xwidget *xww = s->xwidget; | 564 | struct xwidget *xww = s->xwidget; |
| 615 | struct xwidget_view *xv = xwidget_view_lookup (xww, s->w); | 565 | struct xwidget_view *xv = xwidget_view_lookup (xww, s->w); |
| 616 | int clip_right; | 566 | int clip_right; |
| @@ -620,16 +570,14 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 620 | 570 | ||
| 621 | int x = s->x; | 571 | int x = s->x; |
| 622 | int y = s->y + (s->height / 2) - (xww->height / 2); | 572 | int y = s->y + (s->height / 2) - (xww->height / 2); |
| 623 | int moved = 0; | ||
| 624 | 573 | ||
| 625 | /* We do initialization here in the display loop because there is no | 574 | /* Do initialization here in the display loop because there is no |
| 626 | other time to know things like window placement etc. | 575 | other time to know things like window placement etc. */ |
| 627 | */ | ||
| 628 | xv = xwidget_init_view (xww, s, x, y); | 576 | xv = xwidget_init_view (xww, s, x, y); |
| 629 | 577 | ||
| 630 | // Calculate clipping, which is used for all manner of onscreen | 578 | /* Calculate clipping, which is used for all manner of onscreen |
| 631 | // xwidget views. Each widget border can get clipped by other emacs | 579 | xwidget views. Each widget border can get clipped by other emacs |
| 632 | // objects so there are four clipping variables. | 580 | objects so there are four clipping variables. */ |
| 633 | clip_right = | 581 | clip_right = |
| 634 | min (xww->width, | 582 | min (xww->width, |
| 635 | WINDOW_RIGHT_EDGE_X (s->w) - x - | 583 | WINDOW_RIGHT_EDGE_X (s->w) - x - |
| @@ -646,31 +594,32 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 646 | WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y); | 594 | WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y); |
| 647 | clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y); | 595 | clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y); |
| 648 | 596 | ||
| 649 | // We are conserned with movement of the onscreen area. The area | 597 | /* We are conserned with movement of the onscreen area. The area |
| 650 | // might sit still when the widget actually moves. This happens | 598 | might sit still when the widget actually moves. This happens |
| 651 | // when an Emacs window border moves across a widget window. So, if | 599 | when an Emacs window border moves across a widget window. So, if |
| 652 | // any corner of the outer widget clipping window moves, that counts | 600 | any corner of the outer widget clipping window moves, that counts |
| 653 | // as movement here, even if it looks like no movement happens | 601 | as movement here, even if it looks like no movement happens |
| 654 | // because the widget sits still inside the clipping area. The | 602 | because the widget sits still inside the clipping area. The |
| 655 | // widget can also move inside the clipping area, which happens | 603 | widget can also move inside the clipping area, which happens |
| 656 | // later | 604 | later. */ |
| 657 | moved = (xv->x + xv->clip_left != x + clip_left) | 605 | bool moved = (xv->x + xv->clip_left != x + clip_left |
| 658 | || ((xv->y + xv->clip_top) != (y + clip_top)); | 606 | || xv->y + xv->clip_top != y + clip_top); |
| 659 | xv->x = x; | 607 | xv->x = x; |
| 660 | xv->y = y; | 608 | xv->y = y; |
| 661 | if (moved) // Has it moved? | 609 | |
| 662 | { | 610 | /* Has it moved? */ |
| 663 | gtk_fixed_move (GTK_FIXED (FRAME_GTK_WIDGET (s->f)), | 611 | if (moved) |
| 664 | xv->widgetwindow, x + clip_left, y + clip_top); | 612 | gtk_fixed_move (GTK_FIXED (FRAME_GTK_WIDGET (s->f)), |
| 665 | } | 613 | xv->widgetwindow, x + clip_left, y + clip_top); |
| 666 | // Clip the widget window if some parts happen to be outside | 614 | |
| 667 | // drawable area. An Emacs window is not a gtk window. A gtk window | 615 | /* Clip the widget window if some parts happen to be outside |
| 668 | // covers the entire frame. Clipping might have changed even if we | 616 | drawable area. An Emacs window is not a gtk window. A gtk window |
| 669 | // havent actualy moved, we try figure out when we need to reclip | 617 | covers the entire frame. Clipping might have changed even if we |
| 670 | // for real. | 618 | havent actualy moved, we try figure out when we need to reclip |
| 671 | if ((xv->clip_right != clip_right) | 619 | for real. */ |
| 672 | || (xv->clip_bottom != clip_bottom) | 620 | if (xv->clip_right != clip_right |
| 673 | || (xv->clip_top != clip_top) || (xv->clip_left != clip_left)) | 621 | || xv->clip_bottom != clip_bottom |
| 622 | || xv->clip_top != clip_top || xv->clip_left != clip_left) | ||
| 674 | { | 623 | { |
| 675 | gtk_widget_set_size_request (xv->widgetwindow, clip_right + clip_left, | 624 | gtk_widget_set_size_request (xv->widgetwindow, clip_right + clip_left, |
| 676 | clip_bottom + clip_top); | 625 | clip_bottom + clip_top); |
| @@ -682,10 +631,11 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 682 | xv->clip_top = clip_top; | 631 | xv->clip_top = clip_top; |
| 683 | xv->clip_left = clip_left; | 632 | xv->clip_left = clip_left; |
| 684 | } | 633 | } |
| 685 | // If emacs wants to repaint the area where the widget lives, queue | 634 | |
| 686 | // a redraw. It seems its possible to get out of sync with emacs | 635 | /* If emacs wants to repaint the area where the widget lives, queue |
| 687 | // redraws so emacs background sometimes shows up instead of the | 636 | a redraw. It seems its possible to get out of sync with emacs |
| 688 | // xwidgets background. It's just a visual glitch though. | 637 | redraws so emacs background sometimes shows up instead of the |
| 638 | xwidgets background. It's just a visual glitch though. */ | ||
| 689 | if (!xwidget_hidden (xv)) | 639 | if (!xwidget_hidden (xv)) |
| 690 | { | 640 | { |
| 691 | gtk_widget_queue_draw (xv->widgetwindow); | 641 | gtk_widget_queue_draw (xv->widgetwindow); |
| @@ -693,19 +643,15 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 693 | } | 643 | } |
| 694 | } | 644 | } |
| 695 | 645 | ||
| 696 | 646 | /* Macro that checks WEBKIT_IS_WEB_VIEW (xw->widget_osr) first. */ | |
| 697 | // Macro that checks WEBKIT_IS_WEB_VIEW(xw->widget_osr) first | 647 | #define WEBKIT_FN_INIT() \ |
| 698 | #define WEBKIT_FN_INIT() \ | 648 | CHECK_XWIDGET (xwidget); \ |
| 699 | struct xwidget* xw; \ | 649 | struct xwidget *xw = XXWIDGET (xwidget); \ |
| 700 | CHECK_XWIDGET (xwidget); \ | 650 | if (!xw->widget_osr || !WEBKIT_IS_WEB_VIEW (xw->widget_osr)) \ |
| 701 | if (NILP (xwidget)) {printf("ERROR xwidget nil\n"); return Qnil;}; \ | 651 | { \ |
| 702 | xw = XXWIDGET (xwidget); \ | 652 | printf ("ERROR xw->widget_osr does not hold a webkit instance\n"); \ |
| 703 | if (NULL == xw) printf("ERROR xw is 0\n"); \ | 653 | return Qnil; \ |
| 704 | if ((NULL == xw->widget_osr) || !WEBKIT_IS_WEB_VIEW(xw->widget_osr)){ \ | 654 | } |
| 705 | printf ("ERROR xw->widget_osr does not hold a webkit instance\n");\ | ||
| 706 | return Qnil;\ | ||
| 707 | }; | ||
| 708 | |||
| 709 | 655 | ||
| 710 | DEFUN ("xwidget-webkit-goto-uri", | 656 | DEFUN ("xwidget-webkit-goto-uri", |
| 711 | Fxwidget_webkit_goto_uri, Sxwidget_webkit_goto_uri, | 657 | Fxwidget_webkit_goto_uri, Sxwidget_webkit_goto_uri, |
| @@ -723,7 +669,7 @@ DEFUN ("xwidget-webkit-goto-uri", | |||
| 723 | DEFUN ("xwidget-webkit-execute-script", | 669 | DEFUN ("xwidget-webkit-execute-script", |
| 724 | Fxwidget_webkit_execute_script, Sxwidget_webkit_execute_script, | 670 | Fxwidget_webkit_execute_script, Sxwidget_webkit_execute_script, |
| 725 | 2, 2, 0, | 671 | 2, 2, 0, |
| 726 | doc: /* Make the Webkit XWIDGET execute javascript SCRIPT. */) | 672 | doc: /* Make the Webkit XWIDGET execute JavaScript SCRIPT. */) |
| 727 | (Lisp_Object xwidget, Lisp_Object script) | 673 | (Lisp_Object xwidget, Lisp_Object script) |
| 728 | { | 674 | { |
| 729 | WEBKIT_FN_INIT (); | 675 | WEBKIT_FN_INIT (); |
| @@ -741,14 +687,14 @@ This can be used to work around the lack of a return value from the | |||
| 741 | exec method. */ ) | 687 | exec method. */ ) |
| 742 | (Lisp_Object xwidget) | 688 | (Lisp_Object xwidget) |
| 743 | { | 689 | { |
| 744 | // TODO support multibyte strings | 690 | /* TODO support multibyte strings. */ |
| 745 | WEBKIT_FN_INIT (); | 691 | WEBKIT_FN_INIT (); |
| 746 | const gchar *str = | 692 | const gchar *str = |
| 747 | webkit_web_view_get_title (WEBKIT_WEB_VIEW (xw->widget_osr)); | 693 | webkit_web_view_get_title (WEBKIT_WEB_VIEW (xw->widget_osr)); |
| 748 | if (str == 0) | 694 | if (str == 0) |
| 749 | { | 695 | { |
| 750 | // TODO maybe return Qnil instead. I suppose webkit returns | 696 | /* TODO maybe return Qnil instead. I suppose webkit returns |
| 751 | // nullpointer when doc is not properly loaded or something | 697 | null pointer when doc is not properly loaded or something. */ |
| 752 | return build_string (""); | 698 | return build_string (""); |
| 753 | } | 699 | } |
| 754 | return build_string (str); | 700 | return build_string (str); |
| @@ -759,32 +705,30 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0, | |||
| 759 | (Lisp_Object xwidget, Lisp_Object new_width, Lisp_Object new_height) | 705 | (Lisp_Object xwidget, Lisp_Object new_width, Lisp_Object new_height) |
| 760 | { | 706 | { |
| 761 | CHECK_XWIDGET (xwidget); | 707 | CHECK_XWIDGET (xwidget); |
| 708 | CHECK_NATNUM (new_width); | ||
| 709 | CHECK_NATNUM (new_height); | ||
| 762 | struct xwidget *xw = XXWIDGET (xwidget); | 710 | struct xwidget *xw = XXWIDGET (xwidget); |
| 763 | struct xwidget_view *xv; | 711 | int w = XFASTINT (new_width); |
| 764 | int w, h; | 712 | int h = XFASTINT (new_height); |
| 765 | |||
| 766 | CHECK_NUMBER (new_width); | ||
| 767 | CHECK_NUMBER (new_height); | ||
| 768 | w = XFASTINT (new_width); | ||
| 769 | h = XFASTINT (new_height); | ||
| 770 | 713 | ||
| 771 | xw->width = w; | 714 | xw->width = w; |
| 772 | xw->height = h; | 715 | xw->height = h; |
| 773 | // If there is a offscreen widget resize it 1st. | 716 | |
| 717 | /* If there is an offscreen widget resize it first. */ | ||
| 774 | if (xw->widget_osr) | 718 | if (xw->widget_osr) |
| 775 | { | 719 | { |
| 720 | /* Use minimum size. */ | ||
| 776 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), | 721 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), |
| 777 | xw->width, xw->height); //minimum size | 722 | xw->width, xw->height); |
| 723 | |||
| 778 | gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width, | 724 | gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width, |
| 779 | xw->height); | 725 | xw->height); |
| 780 | gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW | 726 | gtk_scrolled_window_set_min_content_height |
| 781 | (xw-> | 727 | (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr), |
| 782 | widgetscrolledwindow_osr), | 728 | xw->height); |
| 783 | xw->height); | 729 | gtk_scrolled_window_set_min_content_width |
| 784 | gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW | 730 | (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr), |
| 785 | (xw-> | 731 | xw->width); |
| 786 | widgetscrolledwindow_osr), | ||
| 787 | xw->width); | ||
| 788 | 732 | ||
| 789 | gtk_container_resize_children (GTK_CONTAINER (xw->widgetwindow_osr)); | 733 | gtk_container_resize_children (GTK_CONTAINER (xw->widgetwindow_osr)); |
| 790 | 734 | ||
| @@ -794,7 +738,7 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0, | |||
| 794 | { | 738 | { |
| 795 | if (XWIDGET_VIEW_P (XCAR (tail))) | 739 | if (XWIDGET_VIEW_P (XCAR (tail))) |
| 796 | { | 740 | { |
| 797 | xv = XXWIDGET_VIEW (XCAR (tail)); | 741 | struct xwidget_view *xv = XXWIDGET_VIEW (XCAR (tail)); |
| 798 | if (XXWIDGET (xv->model) == xw) | 742 | if (XXWIDGET (xv->model) == xw) |
| 799 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xw->width, | 743 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xw->width, |
| 800 | xw->height); | 744 | xw->height); |
| @@ -816,37 +760,17 @@ VALUE is the amount to scroll, either relatively or absolutely. */) | |||
| 816 | Lisp_Object value) | 760 | Lisp_Object value) |
| 817 | { | 761 | { |
| 818 | CHECK_XWIDGET (xwidget); | 762 | CHECK_XWIDGET (xwidget); |
| 763 | CHECK_NATNUM (value); | ||
| 819 | struct xwidget *xw = XXWIDGET (xwidget); | 764 | struct xwidget *xw = XXWIDGET (xwidget); |
| 820 | GtkAdjustment *adjustment; | 765 | GtkAdjustment *adjustment |
| 821 | float final_value = 0.0; | 766 | = ((EQ (Qhorizontal, axis) |
| 822 | 767 | ? gtk_scrolled_window_get_hadjustment | |
| 823 | adjustment = | 768 | : gtk_scrolled_window_get_vadjustment) |
| 824 | gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW | 769 | (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr))); |
| 825 | (xw->widgetscrolledwindow_osr)); | 770 | double final_value = XFASTINT (value); |
| 826 | if (EQ (Qvertical, axis)) | ||
| 827 | { | ||
| 828 | adjustment = | ||
| 829 | gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW | ||
| 830 | (xw->widgetscrolledwindow_osr)); | ||
| 831 | } | ||
| 832 | if (EQ (Qhorizontal, axis)) | ||
| 833 | { | ||
| 834 | adjustment = | ||
| 835 | gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW | ||
| 836 | (xw->widgetscrolledwindow_osr)); | ||
| 837 | } | ||
| 838 | |||
| 839 | if (EQ (Qt, relative)) | 771 | if (EQ (Qt, relative)) |
| 840 | { | 772 | final_value += gtk_adjustment_get_value (adjustment); |
| 841 | final_value = gtk_adjustment_get_value (adjustment) + XFASTINT (value); | ||
| 842 | } | ||
| 843 | else | ||
| 844 | { | ||
| 845 | final_value = 0.0 + XFASTINT (value); | ||
| 846 | } | ||
| 847 | |||
| 848 | gtk_adjustment_set_value (adjustment, final_value); | 773 | gtk_adjustment_set_value (adjustment, final_value); |
| 849 | |||
| 850 | return Qnil; | 774 | return Qnil; |
| 851 | } | 775 | } |
| 852 | 776 | ||
| @@ -861,13 +785,9 @@ Emacs allocated area accordingly. */) | |||
| 861 | { | 785 | { |
| 862 | CHECK_XWIDGET (xwidget); | 786 | CHECK_XWIDGET (xwidget); |
| 863 | GtkRequisition requisition; | 787 | GtkRequisition requisition; |
| 864 | Lisp_Object rv; | ||
| 865 | gtk_widget_size_request (XXWIDGET (xwidget)->widget_osr, &requisition); | 788 | gtk_widget_size_request (XXWIDGET (xwidget)->widget_osr, &requisition); |
| 866 | rv = Qnil; | 789 | return list2 (make_number (requisition.width), |
| 867 | rv = Fcons (make_number (requisition.height), rv); | 790 | make_number (requisition.height)); |
| 868 | rv = Fcons (make_number (requisition.width), rv); | ||
| 869 | return rv; | ||
| 870 | |||
| 871 | } | 791 | } |
| 872 | 792 | ||
| 873 | DEFUN ("xwidgetp", | 793 | DEFUN ("xwidgetp", |
| @@ -896,18 +816,9 @@ Currently [TYPE TITLE WIDTH HEIGHT]. */) | |||
| 896 | (Lisp_Object xwidget) | 816 | (Lisp_Object xwidget) |
| 897 | { | 817 | { |
| 898 | CHECK_XWIDGET (xwidget); | 818 | CHECK_XWIDGET (xwidget); |
| 899 | Lisp_Object info, n; | ||
| 900 | struct xwidget *xw = XXWIDGET (xwidget); | 819 | struct xwidget *xw = XXWIDGET (xwidget); |
| 901 | 820 | return CALLN (Fvector, xw->type, xw->title, | |
| 902 | info = Fmake_vector (make_number (4), Qnil); | 821 | make_natnum (xw->width), make_natnum (xw->height)); |
| 903 | ASET (info, 0, xw->type); | ||
| 904 | ASET (info, 1, xw->title); | ||
| 905 | XSETFASTINT (n, xw->width); | ||
| 906 | ASET (info, 2, n); | ||
| 907 | XSETFASTINT (n, xw->height); | ||
| 908 | ASET (info, 3, n); | ||
| 909 | |||
| 910 | return info; | ||
| 911 | } | 822 | } |
| 912 | 823 | ||
| 913 | DEFUN ("xwidget-view-info", | 824 | DEFUN ("xwidget-view-info", |
| @@ -919,17 +830,9 @@ Currently [X Y CLIP_RIGHT CLIP_BOTTOM CLIP_TOP CLIP_LEFT]. */) | |||
| 919 | { | 830 | { |
| 920 | CHECK_XWIDGET_VIEW (xwidget_view); | 831 | CHECK_XWIDGET_VIEW (xwidget_view); |
| 921 | struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view); | 832 | struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view); |
| 922 | Lisp_Object info; | 833 | return CALLN (Fvector, make_number (xv->x), make_number (xv->y), |
| 923 | 834 | make_number (xv->clip_right), make_number (xv->clip_bottom), | |
| 924 | info = Fmake_vector (make_number (6), Qnil); | 835 | make_number (xv->clip_top), make_number (xv->clip_left)); |
| 925 | ASET (info, 0, make_number (xv->x)); | ||
| 926 | ASET (info, 1, make_number (xv->y)); | ||
| 927 | ASET (info, 2, make_number (xv->clip_right)); | ||
| 928 | ASET (info, 3, make_number (xv->clip_bottom)); | ||
| 929 | ASET (info, 4, make_number (xv->clip_top)); | ||
| 930 | ASET (info, 5, make_number (xv->clip_left)); | ||
| 931 | |||
| 932 | return info; | ||
| 933 | } | 836 | } |
| 934 | 837 | ||
| 935 | DEFUN ("xwidget-view-model", | 838 | DEFUN ("xwidget-view-model", |
| @@ -963,8 +866,8 @@ DEFUN ("delete-xwidget-view", | |||
| 963 | struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view); | 866 | struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view); |
| 964 | gtk_widget_destroy (xv->widgetwindow); | 867 | gtk_widget_destroy (xv->widgetwindow); |
| 965 | Vxwidget_view_list = Fdelq (xwidget_view, Vxwidget_view_list); | 868 | Vxwidget_view_list = Fdelq (xwidget_view, Vxwidget_view_list); |
| 966 | // xv->model still has signals pointing to the view. There can be | 869 | /* xv->model still has signals pointing to the view. There can be |
| 967 | // several views. Find the matching signals and delete them all. | 870 | several views. Find the matching signals and delete them all. */ |
| 968 | g_signal_handlers_disconnect_matched (XXWIDGET (xv->model)->widgetwindow_osr, | 871 | g_signal_handlers_disconnect_matched (XXWIDGET (xv->model)->widgetwindow_osr, |
| 969 | G_SIGNAL_MATCH_DATA, | 872 | G_SIGNAL_MATCH_DATA, |
| 970 | 0, 0, 0, 0, | 873 | 0, 0, 0, 0, |
| @@ -1002,7 +905,7 @@ DEFUN ("xwidget-plist", | |||
| 1002 | Fxwidget_plist, Sxwidget_plist, | 905 | Fxwidget_plist, Sxwidget_plist, |
| 1003 | 1, 1, 0, | 906 | 1, 1, 0, |
| 1004 | doc: /* Return the plist of XWIDGET. */) | 907 | doc: /* Return the plist of XWIDGET. */) |
| 1005 | (register Lisp_Object xwidget) | 908 | (Lisp_Object xwidget) |
| 1006 | { | 909 | { |
| 1007 | CHECK_XWIDGET (xwidget); | 910 | CHECK_XWIDGET (xwidget); |
| 1008 | return XXWIDGET (xwidget)->plist; | 911 | return XXWIDGET (xwidget)->plist; |
| @@ -1012,7 +915,7 @@ DEFUN ("xwidget-buffer", | |||
| 1012 | Fxwidget_buffer, Sxwidget_buffer, | 915 | Fxwidget_buffer, Sxwidget_buffer, |
| 1013 | 1, 1, 0, | 916 | 1, 1, 0, |
| 1014 | doc: /* Return the buffer of XWIDGET. */) | 917 | doc: /* Return the buffer of XWIDGET. */) |
| 1015 | (register Lisp_Object xwidget) | 918 | (Lisp_Object xwidget) |
| 1016 | { | 919 | { |
| 1017 | CHECK_XWIDGET (xwidget); | 920 | CHECK_XWIDGET (xwidget); |
| 1018 | return XXWIDGET (xwidget)->buffer; | 921 | return XXWIDGET (xwidget)->buffer; |
| @@ -1023,7 +926,7 @@ DEFUN ("set-xwidget-plist", | |||
| 1023 | 2, 2, 0, | 926 | 2, 2, 0, |
| 1024 | doc: /* Replace the plist of XWIDGET with PLIST. | 927 | doc: /* Replace the plist of XWIDGET with PLIST. |
| 1025 | Returns PLIST. */) | 928 | Returns PLIST. */) |
| 1026 | (register Lisp_Object xwidget, Lisp_Object plist) | 929 | (Lisp_Object xwidget, Lisp_Object plist) |
| 1027 | { | 930 | { |
| 1028 | CHECK_XWIDGET (xwidget); | 931 | CHECK_XWIDGET (xwidget); |
| 1029 | CHECK_LIST (plist); | 932 | CHECK_LIST (plist); |
| @@ -1059,7 +962,6 @@ DEFUN ("xwidget-query-on-exit-flag", | |||
| 1059 | void | 962 | void |
| 1060 | syms_of_xwidget (void) | 963 | syms_of_xwidget (void) |
| 1061 | { | 964 | { |
| 1062 | |||
| 1063 | defsubr (&Smake_xwidget); | 965 | defsubr (&Smake_xwidget); |
| 1064 | defsubr (&Sxwidgetp); | 966 | defsubr (&Sxwidgetp); |
| 1065 | DEFSYM (Qxwidgetp, "xwidgetp"); | 967 | DEFSYM (Qxwidgetp, "xwidgetp"); |
| @@ -1111,7 +1013,6 @@ syms_of_xwidget (void) | |||
| 1111 | Vxwidget_view_list = Qnil; | 1013 | Vxwidget_view_list = Qnil; |
| 1112 | 1014 | ||
| 1113 | Fprovide (intern ("xwidget-internal"), Qnil); | 1015 | Fprovide (intern ("xwidget-internal"), Qnil); |
| 1114 | |||
| 1115 | } | 1016 | } |
| 1116 | 1017 | ||
| 1117 | 1018 | ||
| @@ -1125,19 +1026,13 @@ syms_of_xwidget (void) | |||
| 1125 | bool | 1026 | bool |
| 1126 | valid_xwidget_spec_p (Lisp_Object object) | 1027 | valid_xwidget_spec_p (Lisp_Object object) |
| 1127 | { | 1028 | { |
| 1128 | int valid_p = false; | 1029 | return CONSP (object) && EQ (XCAR (object), Qxwidget); |
| 1129 | |||
| 1130 | if (CONSP (object) && EQ (XCAR (object), Qxwidget)) | ||
| 1131 | valid_p = true; | ||
| 1132 | |||
| 1133 | return valid_p; | ||
| 1134 | } | 1030 | } |
| 1135 | 1031 | ||
| 1136 | 1032 | ||
| 1137 | |||
| 1138 | /* Find a value associated with key in spec. */ | 1033 | /* Find a value associated with key in spec. */ |
| 1139 | static Lisp_Object | 1034 | static Lisp_Object |
| 1140 | xwidget_spec_value (Lisp_Object spec, Lisp_Object key, int *found) | 1035 | xwidget_spec_value (Lisp_Object spec, Lisp_Object key) |
| 1141 | { | 1036 | { |
| 1142 | Lisp_Object tail; | 1037 | Lisp_Object tail; |
| 1143 | 1038 | ||
| @@ -1147,15 +1042,9 @@ xwidget_spec_value (Lisp_Object spec, Lisp_Object key, int *found) | |||
| 1147 | CONSP (tail) && CONSP (XCDR (tail)); tail = XCDR (XCDR (tail))) | 1042 | CONSP (tail) && CONSP (XCDR (tail)); tail = XCDR (XCDR (tail))) |
| 1148 | { | 1043 | { |
| 1149 | if (EQ (XCAR (tail), key)) | 1044 | if (EQ (XCAR (tail), key)) |
| 1150 | { | 1045 | return XCAR (XCDR (tail)); |
| 1151 | if (found) | ||
| 1152 | *found = 1; | ||
| 1153 | return XCAR (XCDR (tail)); | ||
| 1154 | } | ||
| 1155 | } | 1046 | } |
| 1156 | 1047 | ||
| 1157 | if (found) | ||
| 1158 | *found = 0; | ||
| 1159 | return Qnil; | 1048 | return Qnil; |
| 1160 | } | 1049 | } |
| 1161 | 1050 | ||
| @@ -1195,19 +1084,17 @@ lookup_xwidget (Lisp_Object spec) | |||
| 1195 | { | 1084 | { |
| 1196 | /* When a xwidget lisp spec is found initialize the C struct that is | 1085 | /* When a xwidget lisp spec is found initialize the C struct that is |
| 1197 | used in the C code. This is done by redisplay so values change | 1086 | used in the C code. This is done by redisplay so values change |
| 1198 | if the spec changes. So, take special care of one-shot events. | 1087 | if the spec changes. So, take special care of one-shot events. */ |
| 1199 | */ | ||
| 1200 | int found = 0; | ||
| 1201 | Lisp_Object value; | 1088 | Lisp_Object value; |
| 1202 | struct xwidget *xw; | 1089 | struct xwidget *xw; |
| 1203 | 1090 | ||
| 1204 | value = xwidget_spec_value (spec, QCxwidget, &found); | 1091 | value = xwidget_spec_value (spec, QCxwidget); |
| 1205 | xw = XXWIDGET (value); | 1092 | xw = XXWIDGET (value); |
| 1206 | 1093 | ||
| 1207 | return xw; | 1094 | return xw; |
| 1208 | } | 1095 | } |
| 1209 | 1096 | ||
| 1210 | /* Set up detection of touched xwidget */ | 1097 | /* Set up detection of touched xwidget. */ |
| 1211 | static void | 1098 | static void |
| 1212 | xwidget_start_redisplay (void) | 1099 | xwidget_start_redisplay (void) |
| 1213 | { | 1100 | { |
| @@ -1215,7 +1102,7 @@ xwidget_start_redisplay (void) | |||
| 1215 | tail = XCDR (tail)) | 1102 | tail = XCDR (tail)) |
| 1216 | { | 1103 | { |
| 1217 | if (XWIDGET_VIEW_P (XCAR (tail))) | 1104 | if (XWIDGET_VIEW_P (XCAR (tail))) |
| 1218 | XXWIDGET_VIEW (XCAR (tail))->redisplayed = 0; | 1105 | XXWIDGET_VIEW (XCAR (tail))->redisplayed = false; |
| 1219 | } | 1106 | } |
| 1220 | } | 1107 | } |
| 1221 | 1108 | ||
| @@ -1224,57 +1111,48 @@ xwidget_start_redisplay (void) | |||
| 1224 | static void | 1111 | static void |
| 1225 | xwidget_touch (struct xwidget_view *xv) | 1112 | xwidget_touch (struct xwidget_view *xv) |
| 1226 | { | 1113 | { |
| 1227 | xv->redisplayed = 1; | 1114 | xv->redisplayed = true; |
| 1228 | } | 1115 | } |
| 1229 | 1116 | ||
| 1230 | static int | 1117 | static bool |
| 1231 | xwidget_touched (struct xwidget_view *xv) | 1118 | xwidget_touched (struct xwidget_view *xv) |
| 1232 | { | 1119 | { |
| 1233 | return xv->redisplayed; | 1120 | return xv->redisplayed; |
| 1234 | } | 1121 | } |
| 1235 | 1122 | ||
| 1236 | /* Redisplay has ended, now we should hide untouched xwidgets | 1123 | /* Redisplay has ended, now we should hide untouched xwidgets. */ |
| 1237 | */ | ||
| 1238 | void | 1124 | void |
| 1239 | xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix) | 1125 | xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix) |
| 1240 | { | 1126 | { |
| 1241 | |||
| 1242 | int i; | 1127 | int i; |
| 1243 | int area; | 1128 | int area; |
| 1244 | 1129 | ||
| 1245 | xwidget_start_redisplay (); | 1130 | xwidget_start_redisplay (); |
| 1246 | // Iterate desired glyph matrix of window here, hide gtk widgets | 1131 | /* Iterate desired glyph matrix of window here, hide gtk widgets |
| 1247 | // not in the desired matrix. | 1132 | not in the desired matrix. |
| 1248 | 1133 | ||
| 1249 | // This only takes care of xwidgets in active windows. If a window | 1134 | This only takes care of xwidgets in active windows. If a window |
| 1250 | // goes away from screen xwidget views wust be deleted | 1135 | goes away from screen xwidget views wust be deleted. |
| 1251 | 1136 | ||
| 1252 | // dump_glyph_matrix (matrix, 2); | 1137 | dump_glyph_matrix (matrix, 2); */ |
| 1253 | for (i = 0; i < matrix->nrows; ++i) | 1138 | for (i = 0; i < matrix->nrows; ++i) |
| 1254 | { | 1139 | { |
| 1255 | // dump_glyph_row (MATRIX_ROW (matrix, i), i, glyphs); | 1140 | /* dump_glyph_row (MATRIX_ROW (matrix, i), i, glyphs); */ |
| 1256 | struct glyph_row *row; | 1141 | struct glyph_row *row; |
| 1257 | row = MATRIX_ROW (matrix, i); | 1142 | row = MATRIX_ROW (matrix, i); |
| 1258 | if (row->enabled_p != 0) | 1143 | if (row->enabled_p) |
| 1259 | { | 1144 | for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) |
| 1260 | for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) | 1145 | { |
| 1261 | { | 1146 | struct glyph *glyph = row->glyphs[area]; |
| 1262 | struct glyph *glyph = row->glyphs[area]; | 1147 | struct glyph *glyph_end = glyph + row->used[area]; |
| 1263 | struct glyph *glyph_end = glyph + row->used[area]; | 1148 | for (; glyph < glyph_end; ++glyph) |
| 1264 | for (; glyph < glyph_end; ++glyph) | 1149 | if (glyph->type == XWIDGET_GLYPH) |
| 1265 | { | 1150 | { |
| 1266 | if (glyph->type == XWIDGET_GLYPH) | 1151 | /* The only call to xwidget_end_redisplay is in dispnew. |
| 1267 | { | 1152 | xwidget_end_redisplay (w->current_matrix); */ |
| 1268 | /* | 1153 | xwidget_touch (xwidget_view_lookup (glyph->u.xwidget, w)); |
| 1269 | The only call to xwidget_end_redisplay is in dispnew | 1154 | } |
| 1270 | xwidget_end_redisplay (w->current_matrix); | 1155 | } |
| 1271 | */ | ||
| 1272 | xwidget_touch (xwidget_view_lookup (glyph->u.xwidget, | ||
| 1273 | w)); | ||
| 1274 | } | ||
| 1275 | } | ||
| 1276 | } | ||
| 1277 | } | ||
| 1278 | } | 1156 | } |
| 1279 | 1157 | ||
| 1280 | for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); | 1158 | for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); |
| @@ -1284,8 +1162,8 @@ xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix) | |||
| 1284 | { | 1162 | { |
| 1285 | struct xwidget_view *xv = XXWIDGET_VIEW (XCAR (tail)); | 1163 | struct xwidget_view *xv = XXWIDGET_VIEW (XCAR (tail)); |
| 1286 | 1164 | ||
| 1287 | // "touched" is only meaningful for the current window, so | 1165 | /* "touched" is only meaningful for the current window, so |
| 1288 | // disregard other views. | 1166 | disregard other views. */ |
| 1289 | if (XWINDOW (xv->w) == w) | 1167 | if (XWINDOW (xv->w) == w) |
| 1290 | { | 1168 | { |
| 1291 | if (xwidget_touched (xv)) | 1169 | if (xwidget_touched (xv)) |
| @@ -1306,7 +1184,7 @@ kill_buffer_xwidgets (Lisp_Object buffer) | |||
| 1306 | { | 1184 | { |
| 1307 | xwidget = XCAR (tail); | 1185 | xwidget = XCAR (tail); |
| 1308 | Vxwidget_list = Fdelq (xwidget, Vxwidget_list); | 1186 | Vxwidget_list = Fdelq (xwidget, Vxwidget_list); |
| 1309 | /* TODO free the GTK things in xw */ | 1187 | /* TODO free the GTK things in xw. */ |
| 1310 | { | 1188 | { |
| 1311 | CHECK_XWIDGET (xwidget); | 1189 | CHECK_XWIDGET (xwidget); |
| 1312 | struct xwidget *xw = XXWIDGET (xwidget); | 1190 | struct xwidget *xw = XXWIDGET (xwidget); |
diff --git a/src/xwidget.h b/src/xwidget.h index fdcf40d8cbb..1e11f110379 100644 --- a/src/xwidget.h +++ b/src/xwidget.h | |||
| @@ -20,60 +20,62 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | #ifndef XWIDGET_H_INCLUDED | 20 | #ifndef XWIDGET_H_INCLUDED |
| 21 | #define XWIDGET_H_INCLUDED | 21 | #define XWIDGET_H_INCLUDED |
| 22 | 22 | ||
| 23 | void x_draw_xwidget_glyph_string (struct glyph_string *s); | 23 | #include "lisp.h" |
| 24 | void syms_of_xwidget (void); | ||
| 25 | |||
| 26 | //extern Lisp_Object Qxwidget; | ||
| 27 | 24 | ||
| 25 | struct glyph_matrix; | ||
| 26 | struct glyph_string; | ||
| 27 | struct xwidget; | ||
| 28 | struct xwidget_view; | ||
| 29 | struct window; | ||
| 28 | 30 | ||
| 29 | bool valid_xwidget_spec_p (Lisp_Object object); | 31 | #ifdef HAVE_XWIDGETS |
| 32 | # include <gtk/gtk.h> | ||
| 30 | 33 | ||
| 31 | #include <gtk/gtk.h> | 34 | struct xwidget |
| 35 | { | ||
| 36 | struct vectorlike_header header; | ||
| 32 | 37 | ||
| 38 | /* Auxiliary data. */ | ||
| 39 | Lisp_Object plist; | ||
| 33 | 40 | ||
| 34 | /* | 41 | /* The widget type. */ |
| 35 | each xwidget instance/model is described by this struct. | 42 | Lisp_Object type; |
| 36 | 43 | ||
| 37 | lisp pseudovector. | 44 | /* The buffer where the xwidget lives. */ |
| 45 | Lisp_Object buffer; | ||
| 38 | 46 | ||
| 47 | /* A title used for button labels, for instance. */ | ||
| 48 | Lisp_Object title; | ||
| 39 | 49 | ||
| 40 | */ | 50 | /* Here ends the Lisp part. "height" is the marker field. */ |
| 41 | struct xwidget | ||
| 42 | { | ||
| 43 | struct vectorlike_header header; | ||
| 44 | Lisp_Object plist; //auxilliary data | ||
| 45 | Lisp_Object type; //the widget type | ||
| 46 | Lisp_Object buffer; //buffer where xwidget lives | ||
| 47 | Lisp_Object title; //a title that is used for button labels for instance | ||
| 48 | 51 | ||
| 49 | //here ends the lisp part. | ||
| 50 | //"height" is the marker field | ||
| 51 | int height; | 52 | int height; |
| 52 | int width; | 53 | int width; |
| 53 | 54 | ||
| 54 | //for offscreen widgets, unused if not osr | 55 | /* For offscreen widgets, unused if not osr. */ |
| 55 | GtkWidget *widget_osr; | 56 | GtkWidget *widget_osr; |
| 56 | GtkWidget *widgetwindow_osr; | 57 | GtkWidget *widgetwindow_osr; |
| 57 | //this is used if the widget (webkit) is to be wrapped in a scrolled window, | 58 | |
| 59 | /* Used if the widget (webkit) is to be wrapped in a scrolled window. */ | ||
| 58 | GtkWidget *widgetscrolledwindow_osr; | 60 | GtkWidget *widgetscrolledwindow_osr; |
| 59 | /* Non-nil means kill silently if Emacs is exited. */ | ||
| 60 | unsigned int kill_without_query:1; | ||
| 61 | 61 | ||
| 62 | /* Kill silently if Emacs is exited. */ | ||
| 63 | bool_bf kill_without_query : 1; | ||
| 62 | }; | 64 | }; |
| 63 | 65 | ||
| 64 | |||
| 65 | //struct for each xwidget view | ||
| 66 | struct xwidget_view | 66 | struct xwidget_view |
| 67 | { | 67 | { |
| 68 | struct vectorlike_header header; | 68 | struct vectorlike_header header; |
| 69 | Lisp_Object model; | 69 | Lisp_Object model; |
| 70 | Lisp_Object w; | 70 | Lisp_Object w; |
| 71 | 71 | ||
| 72 | //here ends the lisp part. | 72 | /* Here ends the lisp part. "redisplayed" is the marker field. */ |
| 73 | //"redisplayed" is the marker field | 73 | |
| 74 | int redisplayed; //if touched by redisplay | 74 | /* If touched by redisplay. */ |
| 75 | bool redisplayed; | ||
| 75 | 76 | ||
| 76 | int hidden; //if the "live" instance isnt drawn | 77 | /* The "live" instance isn't drawn. */ |
| 78 | bool hidden; | ||
| 77 | 79 | ||
| 78 | GtkWidget *widget; | 80 | GtkWidget *widget; |
| 79 | GtkWidget *widgetwindow; | 81 | GtkWidget *widgetwindow; |
| @@ -85,48 +87,47 @@ struct xwidget_view | |||
| 85 | int clip_top; | 87 | int clip_top; |
| 86 | int clip_left; | 88 | int clip_left; |
| 87 | 89 | ||
| 88 | |||
| 89 | long handler_id; | 90 | long handler_id; |
| 90 | }; | 91 | }; |
| 92 | #endif | ||
| 91 | 93 | ||
| 92 | /* Test for xwidget pseudovector*/ | 94 | /* Test for xwidget pseudovector. */ |
| 93 | #define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET) | 95 | #define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET) |
| 94 | #define XXWIDGET(a) (eassert (XWIDGETP(a)), \ | 96 | #define XXWIDGET(a) (eassert (XWIDGETP (a)), \ |
| 95 | (struct xwidget *) XUNTAG(a, Lisp_Vectorlike)) | 97 | (struct xwidget *) XUNTAG (a, Lisp_Vectorlike)) |
| 96 | 98 | ||
| 97 | #define CHECK_XWIDGET(x) \ | 99 | #define CHECK_XWIDGET(x) \ |
| 98 | CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x) | 100 | CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x) |
| 99 | 101 | ||
| 100 | /* Test for xwidget_view pseudovector */ | 102 | /* Test for xwidget_view pseudovector. */ |
| 101 | #define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW) | 103 | #define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW) |
| 102 | #define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P(a)), \ | 104 | #define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P (a)), \ |
| 103 | (struct xwidget_view *) XUNTAG(a, Lisp_Vectorlike)) | 105 | (struct xwidget_view *) XUNTAG (a, Lisp_Vectorlike)) |
| 104 | 106 | ||
| 105 | #define CHECK_XWIDGET_VIEW(x) \ | 107 | #define CHECK_XWIDGET_VIEW(x) \ |
| 106 | CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x) | 108 | CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x) |
| 107 | 109 | ||
| 108 | struct xwidget_type | ||
| 109 | { | ||
| 110 | /* A symbol uniquely identifying the xwidget type, */ | ||
| 111 | Lisp_Object *type; | ||
| 112 | |||
| 113 | /* Check that SPEC is a valid image specification for the given | ||
| 114 | image type. Value is non-zero if SPEC is valid. */ | ||
| 115 | int (*valid_p) (Lisp_Object spec); | ||
| 116 | |||
| 117 | /* Next in list of all supported image types. */ | ||
| 118 | struct xwidget_type *next; | ||
| 119 | }; | ||
| 120 | |||
| 121 | |||
| 122 | struct xwidget *xwidget_from_id (int id); | ||
| 123 | |||
| 124 | void xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix); | ||
| 125 | |||
| 126 | struct xwidget *lookup_xwidget (Lisp_Object spec); | ||
| 127 | #define XG_XWIDGET "emacs_xwidget" | 110 | #define XG_XWIDGET "emacs_xwidget" |
| 128 | #define XG_XWIDGET_VIEW "emacs_xwidget_view" | 111 | #define XG_XWIDGET_VIEW "emacs_xwidget_view" |
| 129 | void xwidget_view_delete_all_in_window (struct window *w); | ||
| 130 | 112 | ||
| 131 | void kill_buffer_xwidgets (Lisp_Object buffer); | 113 | #ifdef HAVE_XWIDGETS |
| 114 | void syms_of_xwidget (void); | ||
| 115 | bool valid_xwidget_spec_p (Lisp_Object); | ||
| 116 | void xwidget_view_delete_all_in_window (struct window *); | ||
| 117 | void x_draw_xwidget_glyph_string (struct glyph_string *); | ||
| 118 | struct xwidget *lookup_xwidget (Lisp_Object spec); | ||
| 119 | void xwidget_end_redisplay (struct window *, struct glyph_matrix *); | ||
| 120 | void kill_buffer_xwidgets (Lisp_Object); | ||
| 121 | #else | ||
| 122 | INLINE_HEADER_BEGIN | ||
| 123 | INLINE void syms_of_xwidget (void) {} | ||
| 124 | INLINE bool valid_xwidget_spec_p (Lisp_Object obj) { return false; } | ||
| 125 | INLINE void xwidget_view_delete_all_in_window (struct window *w) {} | ||
| 126 | INLINE void x_draw_xwidget_glyph_string (struct glyph_string *s) { eassume (0); } | ||
| 127 | INLINE struct xwidget *lookup_xwidget (Lisp_Object obj) { eassume (0); } | ||
| 128 | INLINE void xwidget_end_redisplay (struct window *w, struct glyph_matrix *m) {} | ||
| 129 | INLINE void kill_buffer_xwidgets (Lisp_Object buf) {} | ||
| 130 | INLINE_HEADER_END | ||
| 131 | #endif | ||
| 132 | |||
| 132 | #endif /* XWIDGET_H_INCLUDED */ | 133 | #endif /* XWIDGET_H_INCLUDED */ |