A Simple X Image Viewer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 line
1.9 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 "types.h"
  22. typedef struct {
  23. Display *dpy;
  24. int scr;
  25. int scrw, scrh;
  26. Visual *vis;
  27. Colormap cmap;
  28. int depth;
  29. } win_env_t;
  30. typedef struct {
  31. Window xwin;
  32. win_env_t env;
  33. unsigned long white;
  34. unsigned long bgcol;
  35. unsigned long fscol;
  36. unsigned long selcol;
  37. Pixmap pm;
  38. int x;
  39. int y;
  40. unsigned int w;
  41. unsigned int h; /* = win height - bar height */
  42. unsigned int bw;
  43. bool fullscreen;
  44. struct {
  45. unsigned int h;
  46. char *l;
  47. char *r;
  48. unsigned long bgcol;
  49. unsigned long fgcol;
  50. } bar;
  51. } win_t;
  52. extern Atom wm_delete_win;
  53. void win_init(win_t*);
  54. void win_open(win_t*);
  55. void win_close(win_t*);
  56. bool win_configure(win_t*, XConfigureEvent*);
  57. void win_expose(win_t*, XExposeEvent*);
  58. bool win_moveresize(win_t*, int, int, unsigned int, unsigned int);
  59. void win_toggle_fullscreen(win_t*);
  60. void win_toggle_bar(win_t*);
  61. void win_clear(win_t*);
  62. void win_draw(win_t*);
  63. void win_draw_rect(win_t*, Pixmap, int, int, int, int, bool, int,
  64. unsigned long);
  65. int win_textwidth(const char*, unsigned int, bool);
  66. void win_set_title(win_t*, const char*);
  67. void win_set_bar_info(win_t*, char*, char*);
  68. void win_set_cursor(win_t*, cursor_t);
  69. #endif /* WINDOW_H */