Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Badges? We don't need no stinking badges.


devel / comp.windows.x / Re: XQueryColor() failing on dual monitor system

SubjectAuthor
* XQueryColor() failing on dual monitor systemMuttley
+* Re: XQueryColor() failing on dual monitor systemMarco Moock
|`* Re: XQueryColor() failing on dual monitor systemMuttley
| `* Re: XQueryColor() failing on dual monitor systemScott Lurndal
|  `- Re: XQueryColor() failing on dual monitor systemMuttley
+- Re: XQueryColor() failing on dual monitor systemScott Lurndal
+- Re: XQueryColor() failing on dual monitor systemcandycanearter07
`- Re: XQueryColor() failing on dual monitor systemSpiros Bousbouras

1
XQueryColor() failing on dual monitor system

<uhfv8f$26mne$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=83&group=comp.windows.x#83

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Mutt...@dastardlyhq.com
Newsgroups: comp.unix.programmer,comp.windows.x
Subject: XQueryColor() failing on dual monitor system
Date: Fri, 27 Oct 2023 09:18:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <uhfv8f$26mne$1@dont-email.me>
Injection-Date: Fri, 27 Oct 2023 09:18:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5388f2ed0c80ca26c7b9e925d552554e";
logging-data="2317038"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wNAf7OVfXfh4y6cyys159"
Cancel-Lock: sha1:hvNshjDzjM/XDT4R5E8iIls0Hos=
 by: Mutt...@dastardlyhq.com - Fri, 27 Oct 2023 09:18 UTC

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

Re: XQueryColor() failing on dual monitor system

<uhg1lj$26e1p$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=84&group=comp.windows.x#84

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mm+usene...@dorfdsl.de (Marco Moock)
Newsgroups: comp.unix.programmer,comp.windows.x
Subject: Re: XQueryColor() failing on dual monitor system
Date: Fri, 27 Oct 2023 11:59:15 +0200
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <uhg1lj$26e1p$2@dont-email.me>
References: <uhfv8f$26mne$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 27 Oct 2023 09:59:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c83fb755e22a2f19725156a74f5dfb35";
logging-data="2308153"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cmF1Na8clE6yj0O0hi3M1"
Cancel-Lock: sha1:C/TCCsOHKkqqEpzO+xlOUamv8VM=
 by: Marco Moock - Fri, 27 Oct 2023 09:59 UTC

Am 27.10.2023 um 09:18:08 Uhr schrieb Muttley@dastardlyhq.com:

> 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.

Why don't use xwd to save the image of a window?

Re: XQueryColor() failing on dual monitor system

<rgP_M.319903$w4ec.62009@fx14.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=85&group=comp.windows.x#85

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: XQueryColor() failing on dual monitor system
Newsgroups: comp.unix.programmer,comp.windows.x
References: <uhfv8f$26mne$1@dont-email.me>
Lines: 16
Message-ID: <rgP_M.319903$w4ec.62009@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 27 Oct 2023 13:52:23 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 27 Oct 2023 13:52:23 GMT
X-Received-Bytes: 1052
 by: Scott Lurndal - Fri, 27 Oct 2023 13:52 UTC

Muttley@dastardlyhq.com writes:
>Hi
>
>I'm hoping to write some code to save the contents of a window clicked on by
>the mouse to a file

$ man 1 xwd

> and my plan was to get its image, save the pixels then
>reload them into an image created by XCreateImage.

$ man 1 convert (from the ImageMagick package)

I'd look at the sources for xwd (part of the X11 distribution)
to see how they handled the colormaps and/or direct color.

Re: XQueryColor() failing on dual monitor system

<uhgiq6$2ao8j$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=86&group=comp.windows.x#86

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Mutt...@dastardlyhq.com
Newsgroups: comp.unix.programmer,comp.windows.x
Subject: Re: XQueryColor() failing on dual monitor system
Date: Fri, 27 Oct 2023 14:51:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uhgiq6$2ao8j$1@dont-email.me>
References: <uhfv8f$26mne$1@dont-email.me> <uhg1lj$26e1p$2@dont-email.me>
Injection-Date: Fri, 27 Oct 2023 14:51:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5388f2ed0c80ca26c7b9e925d552554e";
logging-data="2449683"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TbV0I4zT/g4xDWFpln4y+"
Cancel-Lock: sha1:qW7RAvihR0N1WRskhzRZQQRlySc=
 by: Mutt...@dastardlyhq.com - Fri, 27 Oct 2023 14:51 UTC

On Fri, 27 Oct 2023 11:59:15 +0200
Marco Moock <mm+usenet-es@dorfdsl.de> wrote:
>Am 27.10.2023 um 09:18:08 Uhr schrieb Muttley@dastardlyhq.com:
>
>> 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.
>
>Why don't use xwd to save the image of a window?

Because I'm saving more than just the image of a window and I don't like
using system() or popen() to fork a utility that may or may not be available.

Re: XQueryColor() failing on dual monitor system

<a6R_M.125515$tnmf.74110@fx09.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=87&group=comp.windows.x#87

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: XQueryColor() failing on dual monitor system
Newsgroups: comp.unix.programmer,comp.windows.x
References: <uhfv8f$26mne$1@dont-email.me> <uhg1lj$26e1p$2@dont-email.me> <uhgiq6$2ao8j$1@dont-email.me>
Lines: 17
Message-ID: <a6R_M.125515$tnmf.74110@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 27 Oct 2023 15:57:58 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 27 Oct 2023 15:57:58 GMT
X-Received-Bytes: 1402
 by: Scott Lurndal - Fri, 27 Oct 2023 15:57 UTC

Muttley@dastardlyhq.com writes:
>On Fri, 27 Oct 2023 11:59:15 +0200
>Marco Moock <mm+usenet-es@dorfdsl.de> wrote:
>>Am 27.10.2023 um 09:18:08 Uhr schrieb Muttley@dastardlyhq.com:
>>
>>> 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.
>>
>>Why don't use xwd to save the image of a window?
>
>Because I'm saving more than just the image of a window and I don't like
>using system() or popen() to fork a utility that may or may not be available.
>

Use the source, luke.

Re: XQueryColor() failing on dual monitor system

<uhgn82$2bla9$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=88&group=comp.windows.x#88

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.hispagatos.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Mutt...@dastardlyhq.com
Newsgroups: comp.unix.programmer,comp.windows.x
Subject: Re: XQueryColor() failing on dual monitor system
Date: Fri, 27 Oct 2023 16:07:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uhgn82$2bla9$1@dont-email.me>
References: <uhfv8f$26mne$1@dont-email.me> <uhg1lj$26e1p$2@dont-email.me> <uhgiq6$2ao8j$1@dont-email.me> <a6R_M.125515$tnmf.74110@fx09.iad>
Injection-Date: Fri, 27 Oct 2023 16:07:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5388f2ed0c80ca26c7b9e925d552554e";
logging-data="2479433"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9z09lA3Mr48dkVlXUZ0MV"
Cancel-Lock: sha1:W/umQaw/ciSZ3TiBM4nus56wBMM=
 by: Mutt...@dastardlyhq.com - Fri, 27 Oct 2023 16:07 UTC

On Fri, 27 Oct 2023 15:57:58 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:
>Muttley@dastardlyhq.com writes:
>>On Fri, 27 Oct 2023 11:59:15 +0200
>>Marco Moock <mm+usenet-es@dorfdsl.de> wrote:
>>>Am 27.10.2023 um 09:18:08 Uhr schrieb Muttley@dastardlyhq.com:
>>>
>>>> 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.
>>>
>>>Why don't use xwd to save the image of a window?
>>
>>Because I'm saving more than just the image of a window and I don't like
>>using system() or popen() to fork a utility that may or may not be available.
>>
>
>Use the source, luke.

Yes, I did. Looks complicated but I still don't know what I'm doing wrong.
Given I'm working with 24 bit colour I might just bypass XQueryColor() and
get the RGB values direct from the pixel.

Re: XQueryColor() failing on dual monitor system

<uhk8b1$3hk6g$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=89&group=comp.windows.x#89

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no...@thanks.net (candycanearter07)
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>
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
 by: candycanearter07 - Sun, 29 Oct 2023 00:17 UTC

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

Re: XQueryColor() failing on dual monitor system

<eu1KFD4Rzn00iqb7p@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=90&group=comp.windows.x#90

  copy link   Newsgroups: comp.unix.programmer comp.windows.x
Path: i2pn2.org!i2pn.org!paganini.bofh.team!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.unix.programmer,comp.windows.x
Subject: Re: XQueryColor() failing on dual monitor system
Date: Sun, 29 Oct 2023 13:28:54 -0000 (UTC)
Organization: To protect and to server
Message-ID: <eu1KFD4Rzn00iqb7p@bongo-ra.co>
References: <uhfv8f$26mne$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 29 Oct 2023 13:28:54 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3043688"; posting-host="9H7U5kayiTdk7VIdYU44Rw.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
Cancel-Lock: sha256:E8QE1oW0TB4rNMMubxwJE1jS8gVkfZSvLXzilyyiL5I=
X-Organisation: Weyland-Yutani
X-Notice: Filtered by postfilter v. 0.9.3
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Sun, 29 Oct 2023 13:28 UTC

On Fri, 27 Oct 2023 09:18:08 -0000 (UTC)
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:

[...]

> Is there some obvious mistake I'm making?

The standard advice in such cases is to post full compilable code which
reproduces the problem and take it from there. If you are making an obvious
mistake , the effort to create such code may reveal the mistake.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor