A Simple X Image Viewer
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

103 lines
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. Window xwin;
  47. win_env_t env;
  48. unsigned long bgcol;
  49. unsigned long fscol;
  50. unsigned long selcol;
  51. Pixmap pm;
  52. int x;
  53. int y;
  54. unsigned int w;
  55. unsigned int h; /* = win height - bar height */
  56. unsigned int bw;
  57. bool fullscreen;
  58. struct {
  59. unsigned int h;
  60. char l[BAR_L_LEN];
  61. char r[BAR_R_LEN];
  62. unsigned long bgcol;
  63. unsigned long fgcol;
  64. } bar;
  65. } win_t;
  66. extern Atom atoms[ATOM_COUNT];
  67. void win_init(win_t*);
  68. void win_open(win_t*);
  69. void win_close(win_t*);
  70. bool win_configure(win_t*, XConfigureEvent*);
  71. void win_expose(win_t*, XExposeEvent*);
  72. void win_toggle_fullscreen(win_t*);
  73. void win_toggle_bar(win_t*);
  74. void win_clear(win_t*);
  75. void win_draw(win_t*);
  76. void win_draw_rect(win_t*, Pixmap, int, int, int, int, bool, int,
  77. unsigned long);
  78. void win_update_bar(win_t*);
  79. int win_textwidth(const char*, unsigned int, bool);
  80. void win_set_title(win_t*, const char*);
  81. void win_set_cursor(win_t*, cursor_t);
  82. #endif /* WINDOW_H */