A Simple X Image Viewer
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

110 wiersze
2.1 KiB

  1. /* Copyright 2011 Bert Muennich
  2. *
  3. * This file is part of sxiv.
  4. *
  5. * sxiv is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published
  7. * by the Free Software Foundation; either version 2 of the License,
  8. * or (at your option) any later version.
  9. *
  10. * sxiv is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with sxiv. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef WINDOW_H
  19. #define WINDOW_H
  20. #include <X11/Xlib.h>
  21. #include <X11/Xutil.h>
  22. #include "types.h"
  23. enum {
  24. BAR_L_LEN = 512,
  25. BAR_R_LEN = 64
  26. };
  27. enum {
  28. ATOM_WM_DELETE_WINDOW,
  29. ATOM__NET_WM_NAME,
  30. ATOM__NET_WM_ICON_NAME,
  31. ATOM__NET_WM_ICON,
  32. ATOM__NET_WM_STATE,
  33. ATOM__NET_WM_STATE_FULLSCREEN,
  34. ATOM__NET_SUPPORTED,
  35. ATOM_COUNT
  36. };
  37. typedef struct {
  38. Display *dpy;
  39. int scr;
  40. int scrw, scrh;
  41. Visual *vis;
  42. Colormap cmap;
  43. int depth;
  44. } win_env_t;
  45. typedef struct {
  46. size_t size;
  47. char *p;
  48. char *buf;
  49. } win_bar_t;
  50. typedef struct {
  51. Window xwin;
  52. win_env_t env;
  53. unsigned long bgcol;
  54. unsigned long fscol;
  55. unsigned long selcol;
  56. int x;
  57. int y;
  58. unsigned int w;
  59. unsigned int h; /* = win height - bar height */
  60. unsigned int bw;
  61. bool fullscreen;
  62. struct {
  63. int w;
  64. int h;
  65. Pixmap pm;
  66. } buf;
  67. struct {
  68. unsigned int h;
  69. win_bar_t l;
  70. win_bar_t r;
  71. unsigned long bgcol;
  72. unsigned long fgcol;
  73. } bar;
  74. } win_t;
  75. extern Atom atoms[ATOM_COUNT];
  76. void win_init(win_t*);
  77. void win_open(win_t*);
  78. void win_close(win_t*);
  79. bool win_configure(win_t*, XConfigureEvent*);
  80. void win_toggle_fullscreen(win_t*);
  81. void win_toggle_bar(win_t*);
  82. void win_clear(win_t*);
  83. void win_draw(win_t*);
  84. void win_draw_rect(win_t*, int, int, int, int, bool, int, unsigned long);
  85. int win_textwidth(const char*, unsigned int, bool);
  86. void win_set_title(win_t*, const char*);
  87. void win_set_cursor(win_t*, cursor_t);
  88. #endif /* WINDOW_H */