Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-15-2010, 10:58 PM
|
#1
|
LQ Newbie
Registered: Mar 2010
Posts: 12
Rep:
|
X Error of failed request: BadMatch
I'm working on a old piece of code on linux, after compiling without porblem at the execution I have this response:
src/xproject/xproject: Ok, a color display! :-)
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 78 (X_CreateColormap)
Serial number of failed request: 7
Current serial number in output stream: 15
looking at the source code I think the problem is related at the depth of my system 24 bit and the depth of this old piece of code 8 bit.
Unfortunately also I don't have experience in programming the XVideo and if someone can give me some help in programming the XVideo interface
Thank you
Piccir
|
|
|
03-29-2010, 09:50 PM
|
#2
|
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Arch
Posts: 10,037
|
Without seeing any code it will be rather tough to help??
|
|
|
03-29-2010, 11:33 PM
|
#3
|
LQ Newbie
Registered: Mar 2010
Posts: 12
Original Poster
Rep:
|
Quote:
Originally Posted by grail
Without seeing any code it will be rather tough to help??
|
This is the part:
#ifdef X
static void projection_examine_visual(p)
Projection *p;
{
p->depth = DefaultDepth(p->display, p->screen);
if (p->depth < 8) {
/* It's monochrome display... to bad  */
p->color_count = 0;
p->visual = DefaultVisual(p->display, p->screen);
p->colormap = DefaultColormap(p->display, p->screen);
p->black = BlackPixel(p->display, p->screen);
p->white = WhitePixel(p->display, p->screen);
info("Tough luck: monochrome...\n");
} else {
int i;
XColor *xcolor = (XColor *)alloca(256 * sizeof(XColor));
p->visual = DefaultVisual(p->display, p->screen);
/* Ok, try to allocate a 256 colors palette... */
p->color_count = 256;
p->colormap = XCreateColormap(p->display, p->parent, p->visual, AllocAll);
for (i = 0; i < p->color_count; i++) {
xcolor[i].pixel = i;
xcolor[i].red =
xcolor[i].green =
xcolor[i].blue =
(unsigned) i * 256;
xcolor[i].flags = DoRed | DoGreen | DoBlue;
}
XStoreColors(p->display, p->colormap, xcolor, p->color_count);
p->black = 0;
p->white = p->color_count - 1;
info("Ok, a color display! :-)\n");
}
}
For now I forced to use the bw mode, but in color mode doesn't work, always the same error
piccir
|
|
|
03-30-2010, 04:43 AM
|
#4
|
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Arch
Posts: 10,037
|
Firstly, you found the QUOTE tags which is good, there are also CODE tags which will keep formatting and
make the code easier to read (above is very difficult)
Secondly, if I am reading the above correctly, your output:
Quote:
src/xproject/xproject: Ok, a color display! :-)
|
Says that it successfully got to the end of the code you have shown, ie
Code:
info("Ok, a color display! :-)\n")
This would lead me to think that whatever called:
Code:
static void projection_examine_visual(p)
Is where we need to see as the next line after this call would seem to be the issue
|
|
|
04-02-2010, 10:05 AM
|
#5
|
LQ Newbie
Registered: Mar 2010
Posts: 12
Original Poster
Rep:
|
I used gdb and I found where my program crash:
Quote:
531 projection_create_x_window(projection[0], display, screen, root);
532 projection_count = 1;
533
534 if (pgmfile) projection_set_background(projection[0], background[0]);
535 }
536
537 int main(argc, argv)
538 int argc;
539 char **argv;
540 {
|
and the function I think is projection_create_x_window
Quote:
void projection_create_x_window(p,dpy,scr,prnt)
Projection *p;
Display *dpy;
int scr;
Window prnt;
{
XSetWindowAttributes attributes;
long valuemask;
XSizeHints hints;
p->has_x_window = 1;
p->display = dpy;
p->screen = scr;
p->parent = prnt;
projection_examine_visual(p);
p->gc = DefaultGC(p->display, p->screen);
XSetBackground(p->display, p->gc, (ULONG) p->black);
attributes.event_mask = event_mask;
attributes.background_pixel = p->black;
attributes.colormap = p->colormap;
valuemask = CWEventMask | CWBackPixel | CWColormap;
p->window = XCreateWindow(p->display, p->parent, -1, -1,
(ULONG)p->width, (ULONG)p->height, 1, p->depth,
InputOutput, p->visual,
(ULONG)valuemask, &attributes);
hints.flags = PSize | PMinSize | PMaxSize;
hints.width = hints.min_width = hints.max_width = p->width;
hints.height = hints.min_height = hints.max_height = p->height;
XSetStandardProperties(p->display, p->window,
"Projection", "Projection",
None, NULL, 0, &hints);
p->pixmap = XCreatePixmap(p->display, p->window, (ULONG)p->width, (ULONG)p->height, (ULONG)p->depth);
if (p->background) {
int x = 0, y = 0, w, h, sx = 0, sy = 0;
p->background_pixmap = XCreatePixmap(p->display, p->window, (ULONG)p->width,
(ULONG)p->height, (ULONG)p->depth);
XSetForeground(p->display, p->gc, (ULONG)p->black);
XFillRectangle(p->display, p->background_pixmap, p->gc, 0, 0, (ULONG)p->width, (ULONG)p->height);
if (p->bg_x_ofs <= 0) sx = - p->bg_x_ofs;
else x = p->bg_x_ofs;
if (p->bg_y_ofs <= 0) sy = - p->bg_y_ofs;
else y = p->bg_y_ofs;
if (x + p->background->width - sx > p->width) w = p->width - x;
else w = p->background->width - sx;
if (y + p->background->height - sy > p->height) h = p->height - y;
else h = p->background->height - sy;
projection_x_put_image(p, p->background_pixmap, p->background, x, y, w, h, sx, sy);
}
XMapWindow(p->display, p->window);
projection_reset(p);
}
#endif
|
Do you think is here the problem??
Thank you
piccir
Where's the code tag button?
|
|
|
04-02-2010, 10:47 AM
|
#6
|
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Arch
Posts: 10,037
|
Ok ... so first, the CODE tags are right next to the QUOTE tags, its the one with a # on it.
Secondly, without pouring through your code line by line and based on the error message,
I would guess two of the culprits might be:
Quote:
valuemask = CWEventMask | CWBackPixel | CWColormap;
hints.flags = PSize | PMinSize | PMaxSize;
|
Both seem to be setting some attributes / flags so could be the issue.
If not I would suggest looking at each line that takes parameters into functions and confirming
they have a) the right number of arguments and b) the correct arguments.
|
|
|
All times are GMT -5. The time now is 10:21 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|