… | |
… | |
143 | { |
143 | { |
144 | } |
144 | } |
145 | |
145 | |
146 | bool rxvt_display::init () |
146 | bool rxvt_display::init () |
147 | { |
147 | { |
|
|
148 | #ifdef LOCAL_X_IS_UNIX |
|
|
149 | if (id[0] == ':') |
|
|
150 | { |
|
|
151 | val = rxvt_malloc (5 + strlen (id) + 1); |
|
|
152 | strcpy (val, "unix/"); |
|
|
153 | strcat (val, id); |
|
|
154 | display = XOpenDisplay (val); |
|
|
155 | free (val); |
|
|
156 | } |
|
|
157 | else |
|
|
158 | #endif |
|
|
159 | display = 0; |
|
|
160 | |
|
|
161 | if (!display) |
148 | display = XOpenDisplay (id); |
162 | display = XOpenDisplay (id); |
149 | |
163 | |
150 | if (!display) |
164 | if (!display) |
151 | return false; |
165 | return false; |
152 | |
166 | |
153 | screen = DefaultScreen (display); |
167 | screen = DefaultScreen (display); |
… | |
… | |
157 | depth = DefaultDepth (display, screen); |
171 | depth = DefaultDepth (display, screen); |
158 | |
172 | |
159 | int fd = XConnectionNumber (display); |
173 | int fd = XConnectionNumber (display); |
160 | |
174 | |
161 | #ifndef NO_SLOW_LINK_SUPPORT |
175 | #ifndef NO_SLOW_LINK_SUPPORT |
162 | // try to detetc wether we have a local connection. |
176 | // try to detect wether we have a local connection. |
163 | // assume unix domains socket == local, everything else not |
177 | // assume unix domains socket == local, everything else not |
164 | // TODO: might want to check for inet/127.0.0.1 |
178 | // TODO: might want to check for inet/127.0.0.1 |
165 | is_local = 0; |
179 | is_local = 0; |
166 | sockaddr_un sa; |
180 | sockaddr_un sa; |
167 | socklen_t sl = sizeof (sa); |
181 | socklen_t sl = sizeof (sa); |