forked from 42Paris/minilibx-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mlx_int.h
140 lines (115 loc) · 2.52 KB
/
mlx_int.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
** mlx_int.h for mlx in
**
** Made by Charlie Root
** Login <[email protected]>
**
** Started on Mon Jul 31 16:45:48 2000 Charlie Root
** Last update Wed May 25 16:44:16 2011 Olivier Crouzet
*/
/*
** Internal settings for MiniLibX
*/
#ifndef MLX_INT_H
# define MLX_INT_H
# include <stdlib.h>
# include <stdio.h>
# include <string.h>
# include <unistd.h>
# include <fcntl.h>
# include <sys/mman.h>
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# include <sys/ipc.h>
# include <sys/shm.h>
# include <X11/extensions/XShm.h>
# include <X11/XKBlib.h>
/* #include <X11/xpm.h> */
# define MLX_TYPE_SHM_PIXMAP 3
# define MLX_TYPE_SHM 2
# define MLX_TYPE_XIMAGE 1
# define MLX_MAX_EVENT LASTEvent
# define ENV_DISPLAY "DISPLAY"
# define LOCALHOST "localhost"
# define ERR_NO_TRUECOLOR "MinilibX Error : No TrueColor Visual available.\n"
# define WARN_SHM_ATTACH "MinilibX Warning : X server can't attach shared memory.\n"
typedef struct s_xpm_col
{
int name;
int col;
} t_xpm_col;
struct s_col_name
{
char *name;
int color;
};
typedef struct s_event_list
{
int mask;
int (*hook)();
void *param;
} t_event_list;
typedef struct s_win_list
{
Window window;
GC gc;
struct s_win_list *next;
int (*mouse_hook)();
int (*key_hook)();
int (*expose_hook)();
void *mouse_param;
void *key_param;
void *expose_param;
t_event_list hooks[MLX_MAX_EVENT];
} t_win_list;
typedef struct s_img
{
XImage *image;
Pixmap pix;
GC gc;
int size_line;
int bpp;
int width;
int height;
int type;
int format;
char *data;
XShmSegmentInfo shm;
} t_img;
typedef struct s_xvar
{
Display *display;
Window root;
int screen;
int depth;
Visual *visual;
Colormap cmap;
int private_cmap;
t_win_list *win_list;
int (*loop_hook)();
void *loop_param;
int use_xshm;
int pshm_format;
int do_flush;
int decrgb[6];
Atom wm_delete_window;
Atom wm_protocols;
int end_loop;
} t_xvar;
int mlx_int_do_nothing();
int mlx_get_color_value();
int mlx_int_get_good_color();
int mlx_int_find_in_pcm();
int mlx_int_anti_resize_win();
int mlx_int_wait_first_expose();
int mlx_int_rgb_conversion();
int mlx_int_deal_shm();
void *mlx_int_new_xshm_image();
char **mlx_int_str_to_wordtab();
void *mlx_new_image();
int shm_att_pb();
int mlx_int_get_visual(t_xvar *xvar);
int mlx_int_set_win_event_mask(t_xvar *xvar);
int mlx_int_str_str_cote(char *str,char *find,int len);
int mlx_int_str_str(char *str,char *find,int len);
#endif