… | |
… | |
25 | #include <rxvtcolor.h> |
25 | #include <rxvtcolor.h> |
26 | |
26 | |
27 | #include <unistd.h> |
27 | #include <unistd.h> |
28 | #include <fcntl.h> |
28 | #include <fcntl.h> |
29 | |
29 | |
|
|
30 | #ifndef NO_SLOW_LINK_SUPPORT |
|
|
31 | # include <sys/socket.h> |
|
|
32 | # include <sys/un.h> |
|
|
33 | #endif |
|
|
34 | |
30 | class byteorder byteorder; |
35 | class byteorder byteorder; |
31 | |
36 | |
32 | byteorder::byteorder () |
37 | byteorder::byteorder () |
33 | { |
38 | { |
34 | union { |
39 | union { |
… | |
… | |
164 | screen = DefaultScreen (display); |
169 | screen = DefaultScreen (display); |
165 | root = DefaultRootWindow (display); |
170 | root = DefaultRootWindow (display); |
166 | visual = DefaultVisual (display, screen); |
171 | visual = DefaultVisual (display, screen); |
167 | cmap = DefaultColormap (display, screen); |
172 | cmap = DefaultColormap (display, screen); |
168 | depth = DefaultDepth (display, screen); |
173 | depth = DefaultDepth (display, screen); |
|
|
174 | |
|
|
175 | int fd = XConnectionNumber (display); |
|
|
176 | |
|
|
177 | #ifndef NO_SLOW_LINK_SUPPORT |
|
|
178 | // try to detetc wether we have a local connection. |
|
|
179 | // assume unix domains socket == local, everything else not |
|
|
180 | // TODO: might want to check for inet/127.0.0.1 |
|
|
181 | is_local = 0; |
|
|
182 | sockaddr_un sa; |
|
|
183 | socklen_t sl = sizeof (sa); |
|
|
184 | |
|
|
185 | if (!getsockname (fd, (sockaddr *)&sa, &sl)) |
|
|
186 | is_local = sa.sun_family == AF_LOCAL; |
|
|
187 | #endif |
169 | |
188 | |
170 | #ifdef PREFER_24BIT |
189 | #ifdef PREFER_24BIT |
171 | /* |
190 | /* |
172 | * If depth is not 24, look for a 24bit visual. |
191 | * If depth is not 24, look for a 24bit visual. |
173 | */ |
192 | */ |
… | |
… | |
184 | visual, AllocNone); |
203 | visual, AllocNone); |
185 | } |
204 | } |
186 | } |
205 | } |
187 | #endif |
206 | #endif |
188 | |
207 | |
189 | int fd = XConnectionNumber (display); |
|
|
190 | x_ev.start (fd, EVENT_READ); |
208 | x_ev.start (fd, EVENT_READ); |
191 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
209 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
192 | |
210 | |
193 | XSelectInput (display, root, PropertyChangeMask); |
211 | XSelectInput (display, root, PropertyChangeMask); |
194 | #ifdef USE_XIM |
212 | #ifdef USE_XIM |