Groups | Search | Server Info | Login | Register
Groups > comp.unix.programmer > #14498
| Path | csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | candycanearter07 <no@thanks.net> |
| Newsgroups | comp.unix.programmer, comp.windows.x |
| Subject | Re: XQueryColor() failing on dual monitor system |
| Date | Sat, 28 Oct 2023 19:17:37 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 67 |
| Message-ID | <uhk8b1$3hk6g$3@dont-email.me> (permalink) |
| References | <uhfv8f$26mne$1@dont-email.me> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sun, 29 Oct 2023 00:17:37 -0000 (UTC) |
| Injection-Info | dont-email.me; posting-host="ecbe00351a658e60aa7b29426e5f293d"; logging-data="3723472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8Q4QTVLbhhHo1abadZM0W6pQQYtZ7UCtdT1mZW0Kn1A==" |
| User-Agent | Betterbird (Linux) |
| Cancel-Lock | sha1:Y6zRI+c6dJUkpFxoherhs8/zcyc= |
| In-Reply-To | <uhfv8f$26mne$1@dont-email.me> |
| Content-Language | en-US |
| Xref | csiph.com comp.unix.programmer:14498 comp.windows.x:445 |
Cross-posted to 2 groups.
Show key headers only | View raw
On 10/27/23 04:18, Muttley@dastardlyhq.com wrote:
> Hi
>
> I'm hoping to write some code to save the contents of a window clicked on by
> the mouse to a file and my plan was to get its image, save the pixels then
> reload them into an image created by XCreateImage. However on one of the 3
> systems I'm using the XQueryColor() call fails in the following code (but never
> fails on the other 2). The only difference is the one it crashes on is a dual
> monitor system:
>
> :
> :
> screen = DefaultScreen(display);
> cmap = DefaultColormap(display,screen);
> :
> :
> win = event.xbutton.subwindow ?
> event.xbutton.subwindow : event.xbutton.window;
>
> XGetWindowAttributes(display,win,&att);
> printf("Window %ld, width = %d, height = %d\n",
> win,att.width,att.height);
>
> puts("Grabbing image...");
> oldimg = XGetImage(
> display,win,
> 0,0,att.width,att.height,AllPlanes,XYPixmap);
>
> puts("Pixels...");
> for(x=0;x < att.width;++x)
> {
> for(y=0;y < att.height;++y)
> {
> printf("X,Y = %d,%d\n",x,y);
> pixel = XGetPixel(oldimg,x,y);
> col.pixel = pixel;
> XQueryColor(display,cmap,&col);
>
>
> $ ./a.out
> Window 54532344, width = 786, height = 1037
> Grabbing image...
> Pixels...
> :
> :
> X,Y = 12,26
> X,Y = 12,27
> X,Y = 12,28
> X,Y = 12,29
> X,Y = 12,30
> X Error of failed request: BadValue (integer parameter out of range for operati
> on)
> Major opcode of failed request: 91 (X_QueryColors)
> Value in failed request: 0x1000000
> Serial number of failed request: 11
> Current serial number in output stream: 11
>
>
> Is there some obvious mistake I'm making?
>
> Thanks for any help
>
You could always try looking at the source code for xcolor and copy that.
--
user <candycane> is generated from /dev/urandom
Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
XQueryColor() failing on dual monitor system Muttley@dastardlyhq.com - 2023-10-27 09:18 +0000
Re: XQueryColor() failing on dual monitor system Marco Moock <mm+usenet-es@dorfdsl.de> - 2023-10-27 11:59 +0200
Re: XQueryColor() failing on dual monitor system Muttley@dastardlyhq.com - 2023-10-27 14:51 +0000
Re: XQueryColor() failing on dual monitor system scott@slp53.sl.home (Scott Lurndal) - 2023-10-27 15:57 +0000
Re: XQueryColor() failing on dual monitor system Muttley@dastardlyhq.com - 2023-10-27 16:07 +0000
Re: XQueryColor() failing on dual monitor system scott@slp53.sl.home (Scott Lurndal) - 2023-10-27 13:52 +0000
Re: XQueryColor() failing on dual monitor system candycanearter07 <no@thanks.net> - 2023-10-28 19:17 -0500
Re: XQueryColor() failing on dual monitor system Spiros Bousbouras <spibou@gmail.com> - 2023-10-29 13:28 +0000
csiph-web