[Glamor] XSetDashes
Pasqual Castellón
p.castellon at cadt.com
Thu Jan 11 16:23:59 UTC 2018
Dear Sirs,
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.
It used to work with CentOS but now the problem appeared after
installilng fedora 26. Any clue?
I think this problem is possibly related to glamor module using NOUVEAU.
This is a sample code:
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DOTOK_LIST_LEN 2
#define DOTERR_LIST_LEN 16
#define DASH_LIST_LEN 2
#define DASH_DOT_LIST_LEN 4
int main(void) {
Display *d;
Window w;
XEvent e;
GC gc;
int s;
static char dot_ok[]={1,1};
static char dot_err[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
static char dash[]={8,8};
static char dash_dot[]={13,1,1,1};
static char *dash_list[]={
dot_ok,dot_err,dash,dash_dot,NULL
};
static int dash_list_length[]={
DOTOK_LIST_LEN,
DOTERR_LIST_LEN,
DASH_LIST_LEN,
DASH_DOT_LIST_LEN
};
d = XOpenDisplay(NULL);
if (d == NULL) {
fprintf(stderr, "Cannot open display\n");
exit(1);
}
s = DefaultScreen(d);
w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 300, 300, 1,
BlackPixel(d, s), WhitePixel(d, s));
XSelectInput(d, w, ExposureMask | KeyPressMask);
XMapWindow(d, w);
gc = DefaultGC(d, s);
while (1) {
XNextEvent(d, &e);
if (e.type == Expose) {
XGCValues values;
int i=0;
values.line_style = LineOnOffDash;
XChangeGC(d,gc,GCLineStyle,&values);
while (dash_list[i]) {
int step = 10*i;
XSetDashes(d,gc,0,dash_list[i],dash_list_length[i]);
XDrawLine(d,w,gc,10+step,10,10+step,290);
i++;
}
}
if (e.type == KeyPress)
break;
}
XCloseDisplay(d);
return 0;
}
--
*Pasqual Castellón*
Vicepresident - Software Division
skype: pasqual.cadt
CADT Software & Drafting, S.L.
Sant Cugat del Vallès - Barcelona
http://www.cadt.com
Follow us on:
Facebook <http://www.facebook.com/cadtlacedesign>
Twitter <http://www.twitter.com/cadt_sd>
Instagram <http://www.instagram.com/cadt_sd>
--
*Pasqual Castellón*
Vicepresident - Software Division
skype: pasqual.cadt
CADT Software & Drafting, S.L.
Sant Cugat del Vallès - Barcelona
http://www.cadt.com
Follow us on:
Facebook <http://www.facebook.com/cadtlacedesign>
Twitter <http://www.twitter.com/cadt_sd>
Instagram <http://www.instagram.com/cadt_sd>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/glamor/attachments/20180111/a241c4e8/attachment.html>
More information about the Glamor
mailing list