aboutsummaryrefslogtreecommitdiffstats
path: root/src/pgtkterm.h
diff options
context:
space:
mode:
authorPo Lu2022-04-08 13:37:16 +0800
committerPo Lu2022-04-08 13:37:16 +0800
commitac2708bf6f83dfb965694381c4e9d0c71f61bd0c (patch)
tree93c26be2946195cd3380eef81401d33a440a27e8 /src/pgtkterm.h
parente9849939549010529e180ffb2509922f1bcc4843 (diff)
downloademacs-ac2708bf6f83dfb965694381c4e9d0c71f61bd0c.tar.gz
emacs-ac2708bf6f83dfb965694381c4e9d0c71f61bd0c.zip
Implement support for reporting device names on PGTK
* lisp/frame.el (device-class): Add new function. * lisp/term/pgtk-win.el (pgtk-device-class): New function. * src/pgtkterm.c (pgtk_device_added_or_removal_cb) (pgtk_seat_added_cb, pgtk_seat_removed_cb) (pgtk_enumerate_devices) (pgtk_free_devices, pgtk_regenerate_devices) (pgtk_get_device_for_event): New functions. (mark_pgtkterm): Mark device data. (pgtk_delete_terminal): Delete device data. (pgtk_handle_event, key_press_event, note_mouse_movement) (construct_mouse_click, button_event, scroll_event) (drag_data_received): Set device correctly. (pgtk_term_init): Initialize device data and seat tracking. (pgtk_delete_display): Delete device data. * src/pgtkterm.h (struct pgtk_device_t): New struct. (struct pgtk_display_info): New field `devices'. Delete lots of unused macros and reformat comments.
Diffstat (limited to 'src/pgtkterm.h')
-rw-r--r--src/pgtkterm.h77
1 files changed, 14 insertions, 63 deletions
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index b1165752aba..56c5d22e54e 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -40,8 +40,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
40#include <cairo-svg.h> 40#include <cairo-svg.h>
41#endif 41#endif
42 42
43/* could use list to store these, but rest of emacs has a big infrastructure
44 for managing a table of bitmap "records" */
45struct pgtk_bitmap_record 43struct pgtk_bitmap_record
46{ 44{
47 void *img; 45 void *img;
@@ -51,6 +49,15 @@ struct pgtk_bitmap_record
51 cairo_pattern_t *pattern; 49 cairo_pattern_t *pattern;
52}; 50};
53 51
52struct pgtk_device_t
53{
54 GdkSeat *seat;
55 GdkDevice *device;
56
57 Lisp_Object name;
58 struct pgtk_device_t *next;
59};
60
54#define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b)) 61#define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
55#define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) 62#define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
56 63
@@ -112,8 +119,6 @@ struct scroll_bar
112 bool horizontal; 119 bool horizontal;
113}; 120};
114 121
115
116/* init'd in pgtk_initialize_display_info () */
117struct pgtk_display_info 122struct pgtk_display_info
118{ 123{
119 /* Chain of all pgtk_display_info structures. */ 124 /* Chain of all pgtk_display_info structures. */
@@ -208,13 +213,14 @@ struct pgtk_display_info
208 /* The scroll bar in which the last motion event occurred. */ 213 /* The scroll bar in which the last motion event occurred. */
209 void *last_mouse_scroll_bar; 214 void *last_mouse_scroll_bar;
210 215
211 /* The invisible cursor used for pointer blanking. 216 /* The invisible cursor used for pointer blanking. */
212 Unused if this display supports Xfixes extension. */
213 Emacs_Cursor invisible_cursor; 217 Emacs_Cursor invisible_cursor;
214 218
215 /* The GDK cursor for scroll bars and popup menus. */ 219 /* The GDK cursor for scroll bars and popup menus. */
216 GdkCursor *xg_cursor; 220 GdkCursor *xg_cursor;
217 221
222 /* List of all devices for all seats on this display. */
223 struct pgtk_device_t *devices;
218 224
219 /* The frame where the mouse was last time we reported a mouse position. */ 225 /* The frame where the mouse was last time we reported a mouse position. */
220 struct frame *last_mouse_glyph_frame; 226 struct frame *last_mouse_glyph_frame;
@@ -225,7 +231,7 @@ struct pgtk_display_info
225 /* The last click event. */ 231 /* The last click event. */
226 GdkEvent *last_click_event; 232 GdkEvent *last_click_event;
227 233
228 /* input method */ 234 /* IM context data. */
229 struct 235 struct
230 { 236 {
231 GtkIMContext *context; 237 GtkIMContext *context;
@@ -246,10 +252,6 @@ extern struct pgtk_display_info *x_display_list;
246 252
247struct pgtk_output 253struct pgtk_output
248{ 254{
249#if 0
250 void *view;
251 void *miniimage;
252#endif
253 unsigned long foreground_color; 255 unsigned long foreground_color;
254 unsigned long background_color; 256 unsigned long background_color;
255 void *toolbar; 257 void *toolbar;
@@ -406,7 +408,7 @@ struct pgtk_output
406 struct atimer *scale_factor_atimer; 408 struct atimer *scale_factor_atimer;
407}; 409};
408 410
409/* this dummy decl needed to support TTYs */ 411/* Satisfy term.c. */
410struct x_output 412struct x_output
411{ 413{
412 int unused; 414 int unused;
@@ -452,59 +454,8 @@ enum
452/* Turning a lisp vector value into a pointer to a struct scroll_bar. */ 454/* Turning a lisp vector value into a pointer to a struct scroll_bar. */
453#define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) 455#define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
454 456
455#define PGTK_FACE_FOREGROUND(f) ((f)->foreground)
456#define PGTK_FACE_BACKGROUND(f) ((f)->background)
457#define FRAME_DEFAULT_FACE(f) FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID) 457#define FRAME_DEFAULT_FACE(f) FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID)
458
459/* Compute pixel height of the frame's titlebar. */
460#define FRAME_PGTK_TITLEBAR_HEIGHT(f) 0
461
462/* Compute pixel size for vertical scroll bars */
463#define PGTK_SCROLL_BAR_WIDTH(f) \
464 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
465 ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \
466 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
467 : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \
468 : 0)
469
470/* Compute pixel size for horizontal scroll bars */
471#define PGTK_SCROLL_BAR_HEIGHT(f) \
472 (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \
473 ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 \
474 ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) \
475 : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))) \
476 : 0)
477
478/* Difference btwn char-column-calculated and actual SB widths.
479 This is only a concern for rendering when SB on left. */
480#define PGTK_SCROLL_BAR_ADJUST(w, f) \
481 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) ? \
482 (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f) \
483 - PGTK_SCROLL_BAR_WIDTH (f)) : 0)
484
485/* Difference btwn char-line-calculated and actual SB heights.
486 This is only a concern for rendering when SB on top. */
487#define PGTK_SCROLL_BAR_ADJUST_HORIZONTALLY(w, f) \
488 (WINDOW_HAS_HORIZONTAL_SCROLL_BARS (w) ? \
489 (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f) \
490 - PGTK_SCROLL_BAR_HEIGHT (f)) : 0)
491
492#define FRAME_MENUBAR_HEIGHT(f) (FRAME_X_OUTPUT (f)->menubar_height) 458#define FRAME_MENUBAR_HEIGHT(f) (FRAME_X_OUTPUT (f)->menubar_height)
493
494/* Calculate system coordinates of the left and top of the parent
495 window or, if there is no parent window, the screen. */
496#define PGTK_PARENT_WINDOW_LEFT_POS(f) \
497 (FRAME_PARENT_FRAME (f) != NULL \
498 ? [[FRAME_PGTK_VIEW (f) window] parentWindow].frame.origin.x : 0)
499#define PGTK_PARENT_WINDOW_TOP_POS(f) \
500 (FRAME_PARENT_FRAME (f) != NULL \
501 ? ([[FRAME_PGTK_VIEW (f) window] parentWindow].frame.origin.y \
502 + [[FRAME_PGTK_VIEW (f) window] parentWindow].frame.size.height \
503 - FRAME_PGTK_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f))) \
504 : [[[PGTKScreen screepgtk] objectAtIndex: 0] frame].size.height)
505
506#define FRAME_PGTK_FONT_TABLE(f) (FRAME_DISPLAY_INFO (f)->font_table)
507
508#define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.pgtk->toolbar_top_height) 459#define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.pgtk->toolbar_top_height)
509#define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \ 460#define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \
510 ((f)->output_data.pgtk->toolbar_bottom_height) 461 ((f)->output_data.pgtk->toolbar_bottom_height)