unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 8c0cd19635a7531626cb95e9d6c4ebff6fe552a1 6975 bytes (raw)
name: src/xwidget.h 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
 
/* Support for embedding graphical components in a buffer.

Copyright (C) 2011-2022 Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */

#ifndef XWIDGET_H_INCLUDED
#define XWIDGET_H_INCLUDED

#include "lisp.h"

struct glyph_matrix;
struct glyph_string;
struct xwidget;
struct xwidget_view;
struct window;

#ifdef HAVE_XWIDGETS

#if defined (USE_GTK)
#include <gtk/gtk.h>
#ifndef HAVE_PGTK
#include <X11/Xlib.h>
#include "xterm.h"
#else
#include "pgtkterm.h"
#endif
#elif defined (NS_IMPL_COCOA) && defined (__OBJC__)
#import <AppKit/NSView.h>
#import "nsxwidget.h"
#endif

#ifdef HAVE_XINPUT2
#include <X11/extensions/XInput2.h>
#endif

struct xwidget
{
  union vectorlike_header header;

  /* Auxiliary data.  */
  Lisp_Object plist;

  /* The widget type.  */
  Lisp_Object type;

  /* The buffer where the xwidget lives.  */
  Lisp_Object buffer;

  /* A title used for button labels, for instance.  */
  Lisp_Object title;

  /* Vector of currently executing scripts with callbacks.  */
  Lisp_Object script_callbacks;
  /* Here ends the Lisp part.  script_callbacks is the marker field.  */

  int height;
  int width;
  uint32_t xwidget_id;
  char *find_text;

#if defined (USE_GTK)
  /* For offscreen widgets, unused if not osr.  */
  GtkWidget *widget_osr;
  GtkWidget *widgetwindow_osr;
  struct frame *embedder;
  struct xwidget_view *embedder_view;
  guint hit_result;
#elif defined (NS_IMPL_COCOA)
# ifdef __OBJC__
  /* For offscreen widgets, unused if not osr.  */
  NSView *xwWidget;
  XwWindow *xwWindow;

  /* Used only for xwidget types (such as webkit2) enforcing 1 to 1
     relationship between model and view.  */
  struct xwidget_view *xv;
# else
  void *xwWidget;
  void *xwWindow;
  struct xwidget_view *xv;
# endif
#endif

  /* Kill silently if Emacs is exited.  */
  bool_bf kill_without_query : 1;
} GCALIGNED_STRUCT;

struct xwidget_view
{
  union vectorlike_header header;
  Lisp_Object model;
  Lisp_Object w;
  /* Here ends the lisp part.  "w" is the marker field.  */

  /* If touched by redisplay.  */
  bool redisplayed;

  /* The "live" instance isn't drawn.  */
  bool hidden;

  enum glyph_row_area area;

#if defined (USE_GTK)
#ifndef HAVE_PGTK
  Display *dpy;
  Window wdesc;

  GdkWindow *last_crossing_window;
  guint last_crossing_cursor_signal;
  GtkWidget *passive_grab;
  guint passive_grab_destruction_signal;
  guint passive_grab_drag_signal;
#else
  struct pgtk_display_info *dpyinfo;
  GtkWidget *widget;
#endif
  Emacs_Cursor cursor;
  struct frame *frame;

  cairo_surface_t *cr_surface;
  cairo_t *cr_context;
  int just_resized;
#elif defined (NS_IMPL_COCOA)
# ifdef __OBJC__
  XvWindow *xvWindow;
  NSView *emacswindow;
# else
  void *xvWindow;
  void *emacswindow;
# endif
#endif

  int x;
  int y;
  int clip_right;
  int clip_bottom;
  int clip_top;
  int clip_left;

  long handler_id;
} GCALIGNED_STRUCT;
#endif

/* Test for xwidget pseudovector.  */
#define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET)
#define XXWIDGET(a) (eassert (XWIDGETP (a)), \
		     XUNTAG (a, Lisp_Vectorlike, struct xwidget))

#define XWIDGET_LIVE_P(w) (!NILP ((w)->buffer))

#define CHECK_XWIDGET(x) \
  CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x)

#define CHECK_LIVE_XWIDGET(x)				\
  CHECK_TYPE ((XWIDGETP (x)				\
	       && XWIDGET_LIVE_P (XXWIDGET (x))),	\
	      Qxwidget_live_p, x)

/* Test for xwidget_view pseudovector.  */
#define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW)
#define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P (a)), \
			  XUNTAG (a, Lisp_Vectorlike, struct xwidget_view))

#define CHECK_XWIDGET_VIEW(x) \
  CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x)

#define XG_XWIDGET "emacs_xwidget"
#define XG_XWIDGET_VIEW "emacs_xwidget_view"

#ifdef HAVE_XWIDGETS
void syms_of_xwidget (void);
bool valid_xwidget_spec_p (Lisp_Object);
void xwidget_view_delete_all_in_window (struct window *);
void x_draw_xwidget_glyph_string (struct glyph_string *);
struct xwidget *lookup_xwidget (Lisp_Object spec);
void xwidget_end_redisplay (struct window *, struct glyph_matrix *);
void kill_buffer_xwidgets (Lisp_Object);
/* Defined in 'xwidget.c'.  */
void store_xwidget_event_string (struct xwidget *xw,
                                 const char *eventname,
                                 const char *eventstr);

void store_xwidget_download_callback_event (struct xwidget *xw,
                                            const char *url,
                                            const char *mimetype,
                                            const char *filename);

void store_xwidget_js_callback_event (struct xwidget *xw,
                                      Lisp_Object proc,
                                      Lisp_Object argument);

void store_xwidget_script_message_event (struct xwidget *xw,
                                         const char *name,
                                         Lisp_Object value);

extern struct xwidget *xwidget_from_id (uint32_t id);

#ifdef HAVE_X_WINDOWS
struct xwidget_view *xwidget_view_from_window (Window wdesc);
void xwidget_expose (struct xwidget_view *xv);
extern void lower_frame_xwidget_views (struct frame *f);
#endif
#ifndef NS_IMPL_COCOA
extern void kill_frame_xwidget_views (struct frame *f);
#endif
#ifdef HAVE_X_WINDOWS
extern void xwidget_button (struct xwidget_view *, bool, int,
			    int, int, int, Time);
extern void xwidget_motion_or_crossing (struct xwidget_view *,
					const XEvent *);
#ifdef HAVE_XINPUT2
extern void xwidget_motion_notify (struct xwidget_view *, double,
				   double, double, double, uint, Time);
extern void xwidget_scroll (struct xwidget_view *, double, double,
                            double, double, uint, Time, bool);
#ifdef HAVE_XINPUT2_4
extern void xwidget_pinch (struct xwidget_view *, XIGesturePinchEvent *);
#endif
#endif
#endif
#else
INLINE_HEADER_BEGIN
INLINE void syms_of_xwidget (void) {}
INLINE bool valid_xwidget_spec_p (Lisp_Object obj) { return false; }
INLINE void xwidget_view_delete_all_in_window (struct window *w) {}
INLINE void x_draw_xwidget_glyph_string (struct glyph_string *s) { eassume (0); }
INLINE struct xwidget *lookup_xwidget (Lisp_Object obj) { eassume (0); }
INLINE void xwidget_end_redisplay (struct window *w, struct glyph_matrix *m) {}
INLINE void kill_buffer_xwidgets (Lisp_Object buf) {}
INLINE_HEADER_END
#endif

#endif /* XWIDGET_H_INCLUDED */

debug log:

solving e835f700bc ...
found e835f700bc in https://yhetil.org/emacs-devel/63F00459-018C-4634-9B52-A89A3ED1AA36@stanford.edu/ ||
	https://yhetil.org/emacs-devel/0F1442C8-45E2-408C-B310-448B4A26496E@stanford.edu/ ||
	https://yhetil.org/emacs-devel/B9632193-A02B-41C9-9443-C6B390A025AA@stanford.edu/
found 502beb6765 in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100644 502beb6765094c3691911569ce44669209388461	src/xwidget.h

applying [1/1] https://yhetil.org/emacs-devel/63F00459-018C-4634-9B52-A89A3ED1AA36@stanford.edu/
diff --git a/src/xwidget.h b/src/xwidget.h\r
index 502beb6765..e835f700bc 100644\r

Checking patch src/xwidget.h...
Applied patch src/xwidget.h cleanly.

skipping https://yhetil.org/emacs-devel/0F1442C8-45E2-408C-B310-448B4A26496E@stanford.edu/ for e835f700bc
skipping https://yhetil.org/emacs-devel/B9632193-A02B-41C9-9443-C6B390A025AA@stanford.edu/ for e835f700bc
index at:
100644 8c0cd19635a7531626cb95e9d6c4ebff6fe552a1	src/xwidget.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).