<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Dear Sirs,</p>
<p>I have a problem with xlib output refering to XSetDashes. The
dotted lines using 2 array length is working (eg 1,1) but when I
use a longer array length it does not work (eg
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1). Then the line is showed as
dash-dot and not as dot.<br>
</p>
<p>It used to work with CentOS but now the problem appeared after
installilng fedora 26. Any clue?</p>
<p>I think this problem is possibly related to glamor module using
NOUVEAU. <br>
</p>
<p>This is a sample code:</p>
<p><font size="-1"><tt>#include <X11/Xlib.h></tt><tt><br>
</tt><tt>#include <stdio.h></tt><tt><br>
</tt><tt>#include <stdlib.h></tt><tt><br>
</tt><tt>#include <string.h></tt><tt><br>
</tt><tt><br>
</tt><tt>#define DOTOK_LIST_LEN 2</tt><tt><br>
</tt><tt>#define DOTERR_LIST_LEN 16</tt><tt><br>
</tt><tt>#define DASH_LIST_LEN 2</tt><tt><br>
</tt><tt>#define DASH_DOT_LIST_LEN 4</tt><tt><br>
</tt><tt><br>
</tt><tt>int main(void) {</tt><tt><br>
</tt><tt> Display *d;</tt><tt><br>
</tt><tt> Window w;</tt><tt><br>
</tt><tt> XEvent e;</tt><tt><br>
</tt><tt> GC gc;</tt><tt><br>
</tt><tt> int s;</tt><tt><br>
</tt><tt><br>
</tt><tt> static char dot_ok[]={1,1};</tt><tt><br>
</tt><tt> static char
dot_err[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};</tt><tt><br>
</tt><tt> static char dash[]={8,8};</tt><tt><br>
</tt><tt> static char dash_dot[]={13,1,1,1};</tt><tt><br>
</tt><tt> static char *dash_list[]={</tt><tt><br>
</tt><tt> dot_ok,dot_err,dash,dash_dot,NULL</tt><tt><br>
</tt><tt> };</tt><tt><br>
</tt><tt> static int dash_list_length[]={</tt><tt><br>
</tt><tt> DOTOK_LIST_LEN,</tt><tt><br>
</tt><tt> DOTERR_LIST_LEN,</tt><tt><br>
</tt><tt> DASH_LIST_LEN,</tt><tt><br>
</tt><tt> DASH_DOT_LIST_LEN</tt><tt><br>
</tt><tt> };</tt><tt><br>
</tt><tt><br>
</tt><tt> d = XOpenDisplay(NULL);</tt><tt><br>
</tt><tt> if (d == NULL) {</tt><tt><br>
</tt><tt> fprintf(stderr, "Cannot open display\n");</tt><tt><br>
</tt><tt> exit(1);</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt><br>
</tt><tt> s = DefaultScreen(d);</tt><tt><br>
</tt><tt> w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10,
300, 300, 1,</tt><tt><br>
</tt><tt> BlackPixel(d, s),
WhitePixel(d, s));</tt><tt><br>
</tt><tt> XSelectInput(d, w, ExposureMask | KeyPressMask);</tt><tt><br>
</tt><tt> XMapWindow(d, w);</tt><tt><br>
</tt><tt><br>
</tt><tt> gc = DefaultGC(d, s);</tt></font></p>
<p><font size="-1"><tt> while (1) {</tt><tt><br>
</tt><tt> XNextEvent(d, &e);</tt><tt><br>
</tt><tt> if (e.type == Expose) {</tt><tt><br>
</tt><tt> XGCValues values;</tt><tt><br>
</tt><tt> int i=0;</tt><tt><br>
</tt><tt><br>
</tt><tt> values.line_style = LineOnOffDash;</tt><tt><br>
</tt><tt> XChangeGC(d,gc,GCLineStyle,&values);</tt><tt><br>
</tt><tt><br>
</tt><tt> while (dash_list[i]) {</tt><tt><br>
</tt><tt> int step = 10*i;</tt><tt><br>
</tt><tt><br>
</tt><tt>
XSetDashes(d,gc,0,dash_list[i],dash_list_length[i]);</tt><tt><br>
</tt><tt><br>
</tt><tt> XDrawLine(d,w,gc,10+step,10,10+step,290);</tt><tt><br>
</tt><tt><br>
</tt><tt> i++;</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> if (e.type == KeyPress)</tt><tt><br>
</tt><tt> break;</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt><br>
</tt><tt> XCloseDisplay(d);</tt><tt><br>
</tt><tt> return 0;</tt><tt><br>
</tt><tt>}</tt></font><br>
<br>
</p>
<div class="moz-signature">-- <br>
<b><font size="4">Pasqual Castellón</font></b><br>
Vicepresident - Software Division<br>
skype: pasqual.cadt<br>
<br>
CADT Software & Drafting, S.L.<br>
Sant Cugat del Vallès - Barcelona<br>
<a href="http://www.cadt.com">http://www.cadt.com</a><br>
<br>
Follow us on:<br>
<a href="http://www.facebook.com/cadtlacedesign">Facebook</a><br>
<a href="http://www.twitter.com/cadt_sd">Twitter</a><br>
<a href="http://www.instagram.com/cadt_sd">Instagram</a><br>
</div>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="GENERATOR" content="GtkHTML/4.8.5">
<b><font size="4">Pasqual Castellón</font></b><br>
Vicepresident - Software Division<br>
skype: pasqual.cadt<br>
<br>
CADT Software & Drafting, S.L.<br>
Sant Cugat del Vallès - Barcelona<br>
<a href="http://www.cadt.com">http://www.cadt.com</a><br>
<br>
Follow us on:<br>
<a href="http://www.facebook.com/cadtlacedesign">Facebook</a><br>
<a href="http://www.twitter.com/cadt_sd">Twitter</a><br>
<a href="http://www.instagram.com/cadt_sd">Instagram</a><br>
<br>
</div>
</body>
</html>