unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 3074f829d75e5797b5189ffc364caa5d7900329c 26987 bytes (raw)
name: src/haiku_support.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
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
 
/* Haiku window system support.  Hey Emacs, this is -*- C++ -*-
   Copyright (C) 2021 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 _HAIKU_SUPPORT_H
#define _HAIKU_SUPPORT_H

#include <stdint.h>

#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include <fontconfig/fontconfig.h>
#include FT_FREETYPE_H
#include FT_SIZES_H
#endif

enum haiku_cursor
  {
    CURSOR_ID_NO_CURSOR = 12,
    CURSOR_ID_RESIZE_NORTH = 15,
    CURSOR_ID_RESIZE_EAST = 16,
    CURSOR_ID_RESIZE_SOUTH = 17,
    CURSOR_ID_RESIZE_WEST = 18,
    CURSOR_ID_RESIZE_NORTH_EAST = 19,
    CURSOR_ID_RESIZE_NORTH_WEST = 20,
    CURSOR_ID_RESIZE_SOUTH_EAST = 21,
    CURSOR_ID_RESIZE_SOUTH_WEST = 22,
    CURSOR_ID_RESIZE_NORTH_SOUTH = 23,
    CURSOR_ID_RESIZE_EAST_WEST = 24,
    CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST = 25,
    CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST = 26
  };

enum haiku_alert_type
  {
    HAIKU_EMPTY_ALERT = 0,
    HAIKU_INFO_ALERT,
    HAIKU_IDEA_ALERT,
    HAIKU_WARNING_ALERT,
    HAIKU_STOP_ALERT
  };

enum haiku_event_type
  {
    QUIT_REQUESTED,
    FRAME_RESIZED,
    FRAME_EXPOSED,
    KEY_DOWN,
    KEY_UP,
    ACTIVATION,
    MOUSE_MOTION,
    BUTTON_DOWN,
    BUTTON_UP,
    ICONIFICATION,
    MOVE_EVENT,
    SCROLL_BAR_VALUE_EVENT,
    SCROLL_BAR_DRAG_EVENT,
    WHEEL_MOVE_EVENT,
    MENU_BAR_RESIZE,
    MENU_BAR_OPEN,
    MENU_BAR_SELECT_EVENT,
    MENU_BAR_CLOSE,
    FILE_PANEL_EVENT,
    MENU_BAR_HELP_EVENT,
    ZOOM_EVENT
  };

struct haiku_quit_requested_event
{
  void *window;
};

struct haiku_resize_event
{
  void *window;
  float px_heightf;
  float px_widthf;
};

struct haiku_expose_event
{
  void *window;
  int x;
  int y;
  int width;
  int height;
};

#define HAIKU_MODIFIER_ALT (1)
#define HAIKU_MODIFIER_CTRL (1 << 1)
#define HAIKU_MODIFIER_SHIFT (1 << 2)

struct haiku_key_event
{
  void *window;
  int modifiers;
  uint32_t mb_char;
  uint32_t unraw_mb_char;
  short kc;
};

struct haiku_activation_event
{
  void *window;
  int activated_p;
};

struct haiku_mouse_motion_event
{
  void *window;
  bool just_exited_p;
  int x;
  int y;
  uint32_t be_code;
};

struct haiku_button_event
{
  void *window;
  int btn_no;
  int modifiers;
  int x;
  int y;
};

struct haiku_iconification_event
{
  void *window;
  int iconified_p;
};

struct haiku_move_event
{
  void *window;
  int x;
  int y;
};

struct haiku_wheel_move_event
{
  void *window;
  int modifiers;
  float delta_x;
  float delta_y;
};

struct haiku_menu_bar_select_event
{
  void *window;
  void *ptr;
};

struct haiku_file_panel_event
{
  void *ptr;
};

struct haiku_menu_bar_help_event
{
  void *window;
  int mb_idx;
};

struct haiku_zoom_event
{
  void *window;
  int x;
  int y;
  int width;
  int height;
};

#define FSPEC_FAMILY 1
#define FSPEC_STYLE (1 << 1)
#define FSPEC_SLANT (1 << 2)
#define FSPEC_WEIGHT (1 << 3)
#define FSPEC_SPACING (1 << 4)
#define FSPEC_WANTED (1 << 5)
#define FSPEC_NEED_ONE_OF (1 << 6)
#define FSPEC_WIDTH (1 << 7)
#define FSPEC_LANGUAGE (1 << 8)

typedef char haiku_font_family_or_style[64];

enum haiku_font_slant
  {
    NO_SLANT = -1,
    SLANT_OBLIQUE,
    SLANT_REGULAR,
    SLANT_ITALIC
  };

enum haiku_font_width
  {
    NO_WIDTH = -1,
    ULTRA_CONDENSED,
    EXTRA_CONDENSED,
    CONDENSED,
    SEMI_CONDENSED,
    NORMAL_WIDTH,
    SEMI_EXPANDED,
    EXPANDED,
    EXTRA_EXPANDED,
    ULTRA_EXPANDED
  };

enum haiku_font_language
  {
    LANGUAGE_CN,
    LANGUAGE_KO,
    LANGUAGE_JP,
    MAX_LANGUAGE /* This isn't a language. */
  };

struct haiku_font_pattern
{
  int specified;
  struct haiku_font_pattern *next;
  /* The next two fields are only temporarily used during the font
     discovery process! Do not rely on it being correct outside
     BFont_find. */
  struct haiku_font_pattern *last;
  struct haiku_font_pattern *next_family;
  haiku_font_family_or_style family;
  haiku_font_family_or_style style;
  int weight;
  int mono_spacing_p;
  int want_chars_len;
  int need_one_of_len;
  enum haiku_font_slant slant;
  enum haiku_font_width width;
  enum haiku_font_language language;
  uint32_t *wanted_chars;
  uint32_t *need_one_of;

  int oblique_seen_p;
};

struct haiku_scroll_bar_value_event
{
  void *scroll_bar;
  int position;
};

struct haiku_scroll_bar_drag_event
{
  void *scroll_bar;
  int dragging_p;
};

struct haiku_menu_bar_resize_event
{
  void *window;
  int width;
  int height;
};

struct haiku_menu_bar_state_event
{
  void *window;
};

#define HAIKU_THIN 0
#define HAIKU_ULTRALIGHT 20
#define HAIKU_EXTRALIGHT 40
#define HAIKU_LIGHT 50
#define HAIKU_SEMI_LIGHT 75
#define HAIKU_REGULAR 100
#define HAIKU_SEMI_BOLD 180
#define HAIKU_BOLD 200
#define HAIKU_EXTRA_BOLD 205
#define HAIKU_ULTRA_BOLD 210

#ifdef __cplusplus
extern "C"
{
#endif
#include <pthread.h>
#include <OS.h>

#ifdef __cplusplus
  typedef void *haiku;

  extern void
  haiku_put_pixel (haiku bitmap, int x, int y, unsigned long pixel);

  extern unsigned long
  haiku_get_pixel (haiku bitmap, int x, int y);
#endif

  /* The port used to send messages from the application thread to
     Emacs. */
  extern port_id port_application_to_emacs;

  extern void haiku_io_init (void);
  extern void haiku_io_init_in_app_thread (void);

  /* Read the size of the next message into len, returning -1 if the
     query fails or there is no next message */
  extern void
  haiku_read_size (ssize_t *len);

  /* Read the next message into buf, putting its type into type,
     assuming the message is len long.  Return 0 if successful and
     -1 if the read fails. */
  extern int
  haiku_read (enum haiku_event_type *type, void *buf, ssize_t len);

  /* The same as haiku_read, but time out after TIMEOUT microseconds.
     Input is blocked when an attempt to read is in progress. */
  extern int
  haiku_read_with_timeout (enum haiku_event_type *type, void *buf, ssize_t len,
			   time_t timeout);

  /* Write a message with type type into buf. */
  extern int
  haiku_write (enum haiku_event_type type, void *buf);

  /* Ditto, but without signalling the Emacs thread. */
  extern int
  haiku_write_without_signal (enum haiku_event_type type, void *buf);

  /* Convert RGB32 color color from RGB color space to its
     HSL components pointed to by h, s and l. */
  extern void
  rgb_color_hsl (uint32_t rgb, double *h, double *s, double *l);

  /* Ditto, but the other way round */
  extern void
  hsl_color_rgb (double h, double s, double l, uint32_t *rgb);

  /* Create new bitmap in RGB32 format */
  extern void *
  BBitmap_new (int width, int height, int mono_p);

  /* Take bitmap, a reference to a BBitmap, and return a pointer to
     its data, in RGB32 format */
  extern void *
  BBitmap_data (void *bitmap);

  /* Convert bitmap if required, placing the new bitmap in new_bitmap,
     and return non-null if bitmap was successfully converted.
     Bitmaps should be freed with `BBitmap_free' */
  extern int
  BBitmap_convert (void *bitmap, void **new_bitmap);

  /* Delete bitmap */
  extern void
  BBitmap_free (void *bitmap);

  /* Retrieve the dimensions of bitmap */
  extern void
  BBitmap_dimensions (void *bitmap, int *left, int *top,
		      int *right, int *bottom, int32_t *bytes_per_row,
		      int *mono_p);

  /* Set up an application and return it.  If starting the application
     thread fails, abort Emacs */
  extern void *
  BApplication_setup (void);

  /* Set up and return a window with its view put in VIEW */
  extern void *
  BWindow_new (void *view);

  /* Delete a window */
  extern void
  BWindow_quit (void *window);

  /* Set window offset to X, Y */
  extern void
  BWindow_set_offset (void *window, int x, int y);

  /* Iconify window */
  extern void
  BWindow_iconify (void *window);

  /* Show or hide window */
  extern void
  BWindow_set_visible (void *window, int visible_p);

  /* Open the default monospace font */
  extern void *
  BFont_open_default (double size, int plain_or_bold_or_fixed);

  /* Close a font */
  extern void
  BFont_close (void *font);

  /* Compute font data */
  extern void
  BFont_dat (void *font, int *px_size, int *min_width, int *max_width,
	     int *avg_width, int *height, int *space_width, int *ascent,
	     int *descent, int *underline_position, int *underline_thickness);

  /* Return non-null if font contains chr, a Unicode code-point */
  extern int
  BFont_have_char_p (void *font, int32_t chr);

  /* Compute bounds for mb_str, a character in multibyte encoding,
     used with font.  The width (in pixels) is returned in advance,
     the left bearing in lb, and the right bearing in rb */
  extern void
  BFont_char_bounds (void *font, const char *mb_str, int *advance,
		     int *lb, int *rb);

  /* The same, but for a variable amount of chars. */
  extern void
  BFont_nchar_bounds (void *font, const char *mb_str, int *advance,
		      int *lb, int *rb, int32_t n);

  /* Change the title of window to the multibyte string title */
  extern void
  BWindow_retitle (void *window, const char *title);

  /* Resize window to width by height */
  extern void
  BWindow_resize (void *window, int width, int height);

  /* Activate window */
  extern void
  BWindow_activate (void *window);

  /* Drawing functions */
  extern void
  BView_StartClip (void *view);

  extern void
  BView_EndClip (void *view);

  extern void
  BView_SetHighColor (void *view, uint32_t color);

  extern void
  BView_SetHighColorForVisibleBell (void *view, uint32_t color);

  extern void
  BView_FillRectangleForVisibleBell (void *view, int x, int y, int width, int height);

  extern void
  BView_SetLowColor (void *view, uint32_t color);

  extern void
  BView_SetPenSize (void *view, int u);

  extern void
  BView_SetFont (void *view, void *font);

  extern void
  BView_MovePenTo (void *view, int x, int y);

  extern void
  BView_DrawString (void *view, const char *chr, ptrdiff_t len);

  extern void
  BView_DrawChar (void *view, char chr);

  extern void
  BView_Draw (void *view, int x, int y, int width, int height);

  extern void
  BView_FillRectangle (void *view, int x, int y, int width, int height);

  extern void
  BView_FillRectangleAbs (void *view, int x, int y, int x1, int y1);

  extern void
  BView_StrokeRectangle (void *view, int x, int y, int width, int height);

  extern void
  BView_SetViewColor (void *view, uint32_t color);

  extern void
  BView_ClipToRect (void *view, int x, int y, int width, int height);

  extern void
  BView_ClipToInverseRect (void *view, int x, int y, int width, int height);

  extern void
  BView_StrokeLine (void *view, int sx, int sy, int tx, int ty);

  extern void
  BView_CopyBits (void *view, int x, int y, int width, int height,
		  int tox, int toy, int towidth, int toheight);

  extern void
  BView_DrawBitmap (void *view, void *bitmap, int x, int y,
		    int width, int height, int vx, int vy, int vwidth,
		    int vheight);

  extern void
  BView_DrawBitmapWithEraseOpAbs (void *view, void *bitmap, int x, int y,
				  int width, int height, int vx, int vy, int vwidth,
				  int vheight);

  extern void
  BView_DrawBitmapWithEraseOp (void *view, void *bitmap, int x,
			       int y, int width, int height);

  /* Potential Haiku bug: the Be Book says B_OP_ERASE ought to treat
     monochrome BBitmaps as patterns, but that isn't the case here, so
     we have to do everything manually. */
  extern void
  BView_DrawFringeBitmap (void *src, void *view,
			  int x, int y, int width, int height,
			  uint32_t color);

  extern void
  BView_DrawMask (void *src, void *view,
		  int x, int y, int width, int height,
		  int vx, int vy, int vwidth, int vheight,
		  uint32_t color);

  extern void *
  BBitmap_transform_bitmap (void *bitmap, void *mask, uint32_t m_color,
			    double rot, int desw, int desh);

  extern void
  BView_EnableWindowUpdates (void *view);

  extern void
  BView_DisableWindowUpdates (void *view);

  extern void
  BView_BeginLayer (void *view, float opacity);

  extern void
  BView_EndLayer (void *view);

  /* Return the pixel dimensions of the main screen in width and height */
  extern void
  BScreen_px_dim (int *width, int *height);

  /* Resize view to width, height */
  extern void
  BView_resize_to (void *view, int width, int height);

  /* Functions for creating and freeing cursors */
  extern void *
  BCursor_create_default (void);

  extern void *
  BCursor_from_id (enum haiku_cursor cursor);

  extern void *
  BCursor_create_i_beam (void);

  extern void *
  BCursor_create_progress_cursor (void);

  extern void *
  BCursor_create_grab (void);

  /* Delete cursor */
  extern void
  BCursor_delete (void *cursor);

  /* Set view's cursor to cursor */
  extern void
  BView_set_view_cursor (void *view, void *cursor);

  /* Flush window's connection to the App Server */
  extern void
  BWindow_Flush (void *window);

  /* Map the keycode kc, storing the result in code and 1 in
     non_ascii_p if it should be used */
  extern void
  BMapKey (uint32_t kc, int *non_ascii_p, unsigned *code);

  /* Make a scrollbar, attach it to view's window, and return it */
  extern void *
  BScrollBar_make_for_view (void *view, int horizontal_p,
			    int x, int y, int x1, int y1,
			    void *scroll_bar_ptr);

  /* Delete sb, a scrollbar */
  extern void
  BScrollBar_delete (void *sb);

  /* Move view's frame to x, y, x1, y1 */
  extern void
  BView_move_frame (void *view, int x, int y, int x1, int y1);

  /* Update sb with portion, whole and position */
  extern void
  BView_scroll_bar_update (void *sb, int portion, int whole, int position);

  /* Return the default scrollbar size  */
  extern int
  BScrollBar_default_size (int horizontal_p);

  /* Make view invisible */
  extern void
  BView_hide (void *view);

  /* Make view visible */
  extern void
  BView_show (void *view);

  /* Invalidate view */
  extern void
  BView_invalidate (void *view);

  /* Lock view.  This is usually faster than calling LockLooper
     directly. */
  extern void
  BView_draw_lock (void *view);

  /* Ditto, but unlock instead. */
  extern void
  BView_draw_unlock (void *view);

  /* Center window on its screen */
  extern void
  BWindow_center_on_screen (void *window);

  /* Tell view that the mouse has moved to x by y */
  extern void
  BView_mouse_moved (void *view, int x, int y, uint32_t transit);

  /* Tell view it has been clicked at x by y */
  extern void
  BView_mouse_down (void *view, int x, int y);

  /* Tell view it has been released at x by y */
  extern void
  BView_mouse_up (void *view, int x, int y);

  /* Import bits into bitmap using the B_GRAY1 colorspace */
  extern void
  BBitmap_import_mono_bits (void *bitmap, void *bits, int wd, int h);

  /* Return the amount of font families */
  extern int
  BFont_family_count (void);

  /* Query the font family at IDX, returning non-0 on failure */
  extern int
  BFont_family (int idx, char *f, int *fixed_p);

  /* Return non-0 if the family contains style */
  extern int
  BFont_family_has_style_p (haiku_font_family_or_style family,
			    haiku_font_family_or_style style);

  /* Create a font */
  extern void *
  BFont_new (void);

  /* Set font's family and style to FAMILY and STYLE respectively,
     returning non-0 on failure.  */
  extern int
  BFont_set_family_and_style (void *font, haiku_font_family_or_style family,
			      haiku_font_family_or_style style);

  /* Set FONT's family along with its ITALIC and BOLD faces */
  extern int
  BFont_set_family_face (void *font, haiku_font_family_or_style family,
			 int italic_p, int bold_p);

  /* Delete every element of the font pattern PT */
  extern void
  haiku_font_pattern_free (struct haiku_font_pattern *pt);

  /* Find all fonts matching the font pattern PT */
  extern struct haiku_font_pattern *
  BFont_find (struct haiku_font_pattern *pt);

  /* Find and open a font matching the pattern PAT, which must have
     its family set */
  extern int
  BFont_open_pattern (struct haiku_font_pattern *pat, void **font, float size);

  /* Query the family of the default fixed font */
  extern void
  BFont_populate_fixed_family (struct haiku_font_pattern *ptn);

  /* Ditto, but with the plain family */
  extern void
  BFont_populate_plain_family (struct haiku_font_pattern *ptn);

  /* Make a scrollbar at x, y known to the view */
  extern void
  BView_publish_scroll_bar (void *view, int x, int y, int width, int height);

  /* Forget the scrollbar at x, y by width, height */
  extern void
  BView_forget_scroll_bar (void *view, int x, int y, int width, int height);

  /* Place the current coordinates of the mouse, relative to view, at x and y */
  extern void
  BView_get_mouse (void *view, int *x, int *y);

  /* Perform an in-place conversion of x and y from view's coordinate
     system to its screen's coordinate system */
  extern void
  BView_convert_to_screen (void *view, int *x, int *y);

  /* Do the same, but from the screen coordinate system to the view's. */
  extern void
  BView_convert_from_screen (void *view, int *x, int *y);

  /* Decorate or undecorate window depending on decorate_p */
  extern void
  BWindow_change_decoration (void *window, int decorate_p);

  /* Decorate window appropriately for use as a tooltip */
  extern void
  BWindow_set_tooltip_decoration (void *window);

  /* Set B_AVOID_FOCUS on window if avoid_focus_p is non-nil, or clear
     it otherwise */
  extern void
  BWindow_set_avoid_focus (void *window, int avoid_focus_p);

  /* Delete the frame view view */
  extern void
  BView_emacs_delete (void *view);

  /* Begin a view transaction, during which drawing operations will
     not be displayed */
  extern void
  BView_BeginTransaction (void *view);

  /* End a view transaction and flush the view */
  extern void
  BView_EndTransaction (void *view);

  /* Return the current workspace */
  extern uint32_t
  haiku_current_workspace (void);

  /* Return a bitmask consisting of workspaces window is on */
  extern uint32_t
  BWindow_workspaces (void *window);

  /* Create a popup menu */
  extern void *
  BPopUpMenu_new (const char *name);

  /* Add an item to the menu */
  extern void
  BMenu_add_item (void *menu, const char *label, void *ptr, bool enabled_p,
		  bool marked_p, bool mbar_p, void *mbw_ptr, const char *key);

  /* Add a separator to the menu */
  extern void
  BMenu_add_separator (void *menu);

  /* Create a submenu and attach it to menu */
  extern void *
  BMenu_new_submenu (void *menu, const char *label, bool enabled_p);

  /* Create a submenu that notifies Emacs upon opening */
  extern void *
  BMenu_new_menu_bar_submenu (void *menu, const char *label);

  /* Count items in menu */
  extern int
  BMenu_count_items (void *menu);

  /* Find the menu item at idx */
  extern void *
  BMenu_item_at (void *menu, int idx);

  /* Run menu, waiting for it to close, and returning a pointer to the
     data of the selected item (if one exists), or nil.  X, Y should
     be in the screen coordinate system */
  extern void *
  BMenu_run (void *menu, int x, int y);

  /* Delete the entire menu hierarchy of menu, and then delete menu
     itself */
  extern void
  BPopUpMenu_delete (void *menu);

  /* Create a menubar, attach it to view, and return it */
  extern void *
  BMenuBar_new (void *view);

  /* Delete all items from menu */
  extern void
  BMenu_delete_all (void *menu);

  /* Delete menubar along with all subitems */
  extern void
  BMenuBar_delete (void *menubar);

  /* Set item's label to label */
  extern void
  BMenu_item_set_label (void *item, const char *label);

  /* Get item's menu */
  extern void *
  BMenu_item_get_menu (void *item);

  /* Delete count items from menu starting from start */
  extern void
  BMenu_delete_from (void *menu, int start, int count);

  /* Emit a beep noise */
  extern void
  haiku_ring_bell (void);

  /* Create a BAlert with text */
  extern void *
  BAlert_new (const char *text, enum haiku_alert_type type);

  /* Add a button to alert and return the button */
  extern void *
  BAlert_add_button (void *alert, const char *text);

  /* Run the alert, returning the number of the button that was
     selected, or -1 if no button was selected before the alert was
     closed */
  extern int32_t
  BAlert_go (void *alert);

  /* Enable or disable button depending on enabled_p */
  extern void
  BButton_set_enabled (void *button, int enabled_p);

  /* Set view's tooltip to tooltip */
  extern void
  BView_set_tooltip (void *view, const char *tooltip);

  /* Delete alert */
  extern void
  BAlert_delete (void *alert);

#ifdef HAVE_FREETYPE
  /* Render GLYPHS in FACE */
  extern void
  BView_FT_render_glyphs (FT_Face face, unsigned int *codes,
			  int len, uint32_t color, int x, int y,
			  void *view, void *ft_shape_cache);

  /* Create and free shape caches. */
  extern void
  be_free_ft_shape_cache (void *c);

  extern void *
  be_make_ft_shape_cache (void);
#endif

  /* Place the resolution of the monitor in DPI in RSSX and RSSY. */
  extern void
  BScreen_res (double *rrsx, double *rrsy);

  /* Add WINDOW to OTHER_WINDOW's subset and parent it to OTHER_WINDOW. */
  extern void
  EmacsWindow_parent_to (void *window, void *other_window);

  /* Unparent WINDOW. */
  extern void
  EmacsWindow_unparent (void *window);

  extern int
  BFont_string_width (void *font, const char *utf8);

  /* Place text describing the current version of Haiku in VERSION,
     which should be a buffer LEN bytes wide. */
  extern void
  be_get_version_string (char *version, int len);

  /* Return the amount of color planes in the current display. */
  extern int
  be_get_display_planes (void);

  /* Return the amount of colors the display can handle. */
  extern int
  be_get_display_color_cells (void);

  /* Warp the pointer to X by Y. */
  extern void
  be_warp_pointer (int x, int y);

  /* Update the position of CHILD in WINDOW without actually moving it. */
  extern void
  EmacsWindow_move_weak_child (void *window, void *child, int xoff, int yoff);

  /* Set up double buffering for VW. */
  extern void
  EmacsView_set_up_double_buffering (void *vw);

  /* Disable double buffering for VW. */
  extern void
  EmacsView_disable_double_buffering (void *vw);

  /* Flip and invalidate the view VW. */
  extern void
  EmacsView_flip_and_blit (void *vw);

  /* Return non-0 if VW is double-buffered. */
  extern int
  EmacsView_double_buffered_p (void *vw);

  /* Popup a file dialog. */
  extern char *
  be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int dir_only_p,
			void *window, const char *save_text, const char *prompt,
			void (*block_input_function) (void),
			void (*unblock_input_function) (void));

  /* Record an unwind protect from C++ code. */
  extern void
  record_c_unwind_protect_from_cxx (void (*) (void *), void *);

  /* SPECPDL_IDX that is safe from C++ code. */
  extern ptrdiff_t
  c_specpdl_idx_from_cxx (void);

  /* unbind_to (idx, Qnil), but safe from C++ code. */
  extern void
  c_unbind_to_nil_from_cxx (ptrdiff_t idx);

  /* Temporarily fill VIEW with COLOR. */
  extern void
  EmacsView_do_visible_bell (void *view, uint32_t color);

  /* Zoom WINDOW. */
  extern void
  BWindow_zoom (void *window);

  /* Make WINDOW fullscreen if FULLSCREEN_P. */
  extern void
  EmacsWindow_make_fullscreen (void *window, int fullscreen_p);

  /* Unzoom (maximize) WINDOW. */
  extern void
  EmacsWindow_unzoom (void *window);

#ifdef HAVE_NATIVE_IMAGE_API
  extern int
  be_can_translate_type_to_bitmap_p (const char *mime);

  extern void *
  be_translate_bitmap_from_file_name (const char *filename);

  extern void *
  be_translate_bitmap_from_memory (const void *buf, size_t bytes);
#endif
  /* Move the pointer into MBAR and start tracking. */
  extern void
  BMenuBar_start_tracking (void *mbar);

  /* Return the size of BITMAP's data, in bytes. */
  extern size_t
  BBitmap_bytes_length (void *bitmap);

  /* Show VIEW's tooltip at the current mouse position. */
  extern void
  BView_show_tooltip (void *view);
#ifdef __cplusplus
  /* Find an appropriate view to draw onto. */
  extern void *
  find_appropriate_view_for_draw (void *vw);
}
#endif /* _cplusplus */

/* Borrowed from X.Org keysymdef.h */
#define XK_BackSpace                     0xff08  /* Back space, back char */
#define XK_Tab                           0xff09
#define XK_Linefeed                      0xff0a  /* Linefeed, LF */
#define XK_Clear                         0xff0b
#define XK_Return                        0xff0d  /* Return, enter */
#define XK_Pause                         0xff13  /* Pause, hold */
#define XK_Scroll_Lock                   0xff14
#define XK_Sys_Req                       0xff15
#define XK_Escape                        0xff1b
#define XK_Delete                        0xffff  /* Delete, rubout */
#define XK_Home                          0xff50
#define XK_Left                          0xff51  /* Move left, left arrow */
#define XK_Up                            0xff52  /* Move up, up arrow */
#define XK_Right                         0xff53  /* Move right, right arrow */
#define XK_Down                          0xff54  /* Move down, down arrow */
#define XK_Prior                         0xff55  /* Prior, previous */
#define XK_Page_Up                       0xff55
#define XK_Next                          0xff56  /* Next */
#define XK_Page_Down                     0xff56
#define XK_End                           0xff57  /* EOL */
#define XK_Begin                         0xff58  /* BOL */
#define XK_Select                        0xff60  /* Select, mark */
#define XK_Print                         0xff61
#define XK_Execute                       0xff62  /* Execute, run, do */
#define XK_Insert                        0xff63  /* Insert, insert here */
#define XK_Undo                          0xff65
#define XK_Redo                          0xff66  /* Redo, again */
#define XK_Menu                          0xff67
#define XK_Find                          0xff68  /* Find, search */
#define XK_Cancel                        0xff69  /* Cancel, stop, abort, exit */
#define XK_Help                          0xff6a  /* Help */
#define XK_Break                         0xff6b
#define XK_Mode_switch                   0xff7e  /* Character set switch */
#define XK_script_switch                 0xff7e  /* Alias for mode_switch */
#define XK_Num_Lock                      0xff7f
#define XK_F1                            0xffbe

#endif /* _HAIKU_SUPPORT_H_ */

debug log:

solving 3074f829d7 ...
found 3074f829d7 in https://yhetil.org/emacs-devel/87ee9tjjmt.fsf@yahoo.com/

applying [1/1] https://yhetil.org/emacs-devel/87ee9tjjmt.fsf@yahoo.com/
diff --git a/src/haiku_support.h b/src/haiku_support.h
new file mode 100644
index 0000000000..3074f829d7

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

index at:
100644 3074f829d75e5797b5189ffc364caa5d7900329c	src/haiku_support.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).