💾 Archived View for gemini.rmf-dev.com › repo › Vaati › Menkar › files › 65e41f67ad02229713521a9d112… captured on 2023-04-19 at 23:17:51. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-03-20)

➡️ Next capture (2023-09-08)

-=-=-=-=-=-=-

0 #if !defined(LIB_H)

1 #define LIB_H

2

3 /*

4 * Copyright 2006 Johan Veenhuizen

5 *

6 * Permission is hereby granted, free of charge, to any person obtaining a

7 * copy of this software and associated documentation files (the "Software"),

8 * to deal in the Software without restriction, including without limitation

9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,

10 * and/or sell copies of the Software, and to permit persons to whom the

11 * Software is furnished to do so, subject to the following conditions:

12 *

13 * The above copyright notice and this permission notice shall be included

14 * in all copies or substantial portions of the Software.

15 *

16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

22 * DEALINGS IN THE SOFTWARE.

23 */

24

25 #include <X11/Xlib.h>

26

27 #define MAX(a, b) ((a) > (b) ? (a) : (b))

28 #define MIN(a, b) ((a) < (b) ? (a) : (b))

29

30 #define ABS(x) ((x) < 0 ? -(x) : (x))

31

32 #define NELEM(v) (sizeof v / sizeof v[0])

33

34 #define LARGER(i) ((i) + 128)

35

36 typedef struct {

37 unsigned char *data;

38 int width;

39 int height;

40 Pixmap pixmap;

41 } IMAGE;

42

43 #define DEFINE_IMAGE(name, xbm) \

44 IMAGE name = { xbm##_bits, xbm##_width, xbm##_height, None }

45

46 struct color {

47 unsigned long bright2;

48 unsigned long bright1;

49 unsigned long normal;

50 unsigned long shadow1;

51 unsigned long shadow2;

52 };

53

54 void *MALLOC(size_t);

55 void *REALLOC(void *, size_t);

56 void FREE(void *);

57

58 char *STRDUP(const char *);

59

60 void clerr(void);

61 void sterr(void);

62

63 void grabkey(Display *display, int keycode, unsigned modifiers,

64 Window grab_window, Bool owner_events, int pointer_mode,

65 int keyboard_mode);

66 void ungrabkey(Display *display, int keycode, unsigned modifiers,

67 Window grab_window);

68 void grabbutton(Display *display, unsigned button, unsigned modifiers,

69 Window grab_window, Bool owner_events, unsigned event_mask,

70 int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor);

71 void ungrabbutton(Display *display, unsigned button, unsigned modifiers,

72 Window grab_window);

73

74 void putimage(Display *display, Drawable d, GC gc, IMAGE *image,

75 int x, int y);

76 void drawraised(Drawable, GC, struct color *, int, int, int, int);

77 void drawlowered(Drawable, GC, struct color *, int, int, int, int);

78 void drawdepressed(Drawable, GC, struct color *, int, int, int, int);

79 int stringwidth(const char *);

80 char *stringfit(char *str, int width);

81

82 extern Window fastmovewin_current;

83 void beginfastmove(Window);

84 void endfastmove(void);

85

86 void error(const char *, ...);

87 void debug(const char *, ...);

88 const char *eventname(int);

89

90 int spawn(char*);

91 int spawn_argv(char**);

92

93 #define idebug printf ("%s:%d: In function \"%s\"\n", __FILE__, __LINE__, __func__)

94

95 #endif /* !defined(LIB_H) */

96