win-gui-seat.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * Main state structure for an instance of the Windows PuTTY front
  3. * end, containing all the PuTTY objects and all the Windows API
  4. * resources like the window handle.
  5. */
  6. typedef struct WinGuiSeat WinGuiSeat;
  7. struct PopupMenu {
  8. HMENU menu;
  9. };
  10. enum { SYSMENU, CTXMENU }; /* indices into popup_menus field */
  11. #define FONT_NORMAL 0
  12. #define FONT_BOLD 1
  13. #define FONT_UNDERLINE 2
  14. #define FONT_BOLDUND 3
  15. #define FONT_WIDE 0x04
  16. #define FONT_HIGH 0x08
  17. #define FONT_NARROW 0x10
  18. #define FONT_OEM 0x20
  19. #define FONT_OEMBOLD 0x21
  20. #define FONT_OEMUND 0x22
  21. #define FONT_OEMBOLDUND 0x23
  22. #define FONT_MAXNO 0x40
  23. #define FONT_SHIFT 5
  24. enum BoldMode {
  25. BOLD_NONE, BOLD_SHADOW, BOLD_FONT
  26. };
  27. enum UnderlineMode {
  28. UND_LINE, UND_FONT
  29. };
  30. struct _dpi_info {
  31. POINT cur_dpi;
  32. RECT new_wnd_rect;
  33. };
  34. /*
  35. * Against the future possibility of having more than one of these
  36. * in a process (and the current possibility of having zero), we
  37. * keep a linked list of all live WinGuiSeats, so that cleanups
  38. * can be done to any that exist.
  39. */
  40. struct WinGuiSeatListNode {
  41. struct WinGuiSeatListNode *next, *prev;
  42. };
  43. extern struct WinGuiSeatListNode wgslisthead; /* static end pointer */
  44. struct WinGuiSeat {
  45. struct WinGuiSeatListNode wgslistnode;
  46. Seat seat;
  47. TermWin termwin;
  48. LogPolicy logpolicy;
  49. HWND term_hwnd;
  50. int extra_width, extra_height;
  51. int font_width, font_height;
  52. bool font_dualwidth, font_varpitch;
  53. int offset_width, offset_height;
  54. bool was_zoomed;
  55. int prev_rows, prev_cols; // FIXME I don't think these are even used
  56. HBITMAP caretbm;
  57. int caret_x, caret_y;
  58. int kbd_codepage;
  59. Ldisc *ldisc;
  60. Backend *backend;
  61. cmdline_get_passwd_input_state cmdline_get_passwd_state;
  62. struct unicode_data ucsdata;
  63. bool session_closed;
  64. bool reconfiguring;
  65. const SessionSpecial *specials;
  66. HMENU specials_menu;
  67. int n_specials;
  68. struct PopupMenu popup_menus[2];
  69. HMENU savedsess_menu;
  70. Conf *conf;
  71. LogContext *logctx;
  72. Terminal *term;
  73. int cursor_type;
  74. int vtmode;
  75. HFONT fonts[FONT_MAXNO];
  76. LOGFONT lfont;
  77. bool fontflag[FONT_MAXNO];
  78. enum BoldMode bold_font_mode;
  79. bool bold_colours;
  80. enum UnderlineMode und_mode;
  81. int descent, font_strikethrough_y;
  82. COLORREF colours[OSC4_NCOLOURS];
  83. HPALETTE pal;
  84. LPLOGPALETTE logpal;
  85. bool tried_pal;
  86. COLORREF colorref_modifier;
  87. struct _dpi_info dpi_info;
  88. int dbltime, lasttime, lastact;
  89. Mouse_Button lastbtn;
  90. bool send_raw_mouse;
  91. int wheel_accumulator;
  92. bool pointer_indicates_raw_mouse;
  93. BusyStatus busy_status;
  94. wchar_t *window_name, *icon_name;
  95. int alt_numberpad_accumulator;
  96. int compose_state;
  97. int compose_char;
  98. WPARAM compose_keycode;
  99. HDC wintw_hdc;
  100. bool resizing;
  101. bool need_backend_resize;
  102. long next_flash;
  103. bool flashing;
  104. long last_beep_time;
  105. bool ignore_clip;
  106. bool fullscr_on_max;
  107. bool processed_resize;
  108. bool in_scrollbar_loop;
  109. UINT last_mousemove;
  110. WPARAM last_wm_mousemove_wParam, last_wm_ncmousemove_wParam;
  111. LPARAM last_wm_mousemove_lParam, last_wm_ncmousemove_lParam;
  112. wchar_t pending_surrogate;
  113. };
  114. extern const LogPolicyVtable win_gui_logpolicy_vt; /* in dialog.c */
  115. static inline void wgs_link(WinGuiSeat *wgs)
  116. {
  117. wgs->wgslistnode.prev = wgslisthead.prev;
  118. wgs->wgslistnode.next = &wgslisthead;
  119. wgs->wgslistnode.prev->next = &wgs->wgslistnode;
  120. wgs->wgslistnode.next->prev = &wgs->wgslistnode;
  121. }
  122. static inline void wgs_unlink(WinGuiSeat *wgs)
  123. {
  124. wgs->wgslistnode.prev->next = wgs->wgslistnode.next;
  125. wgs->wgslistnode.next->prev = wgs->wgslistnode.prev;
  126. }