cspctec:
At first, I was going to suggest that you add the RaiseWindow function to X11::Protocol, but it turns out that the function doesn't exist. (The stuff below the line shows what I was going to suggest.
It seems that to raise a window to the top of the stack, you call the ConfigureRequest function, giving it the stack mode "Above" to bring it to the top. Since ConfigureRequest is in the X11::Protocol package, you should be able to call that to take care of it.
I did a brief review of the X11::Protocol code, and it looks like it wouldn't be too difficult to add XRaiseWindow. The code appears to simply format binary packets according to the X11 protocol, and it seems to do so in a straightforward manner. So it may be an easy matter to simply add the function(s) you want. If you do so, be sure to submit a patch to the author for inclusion.
For example, here's the bit of code that packs up the "CreateWindow" message:
['CreateWindow', sub {
my $self = shift;
my($wid, $parent, $class, $depth, $visual, $x, $y, $width,
$height, $border_width, %values) = @_;
my($mask, $i, @values);
$mask = 0;
for $i (0 .. 14) {
if (exists $values{$Attributes_ValueMask[$i][0]}) {
$mask |= (1 << $i);
push @values,
&{$Attributes_ValueMask[$i][1]}
($self, $values{$Attributes_ValueMask[$i][0]});
}
}
$visual = 0 if $visual eq 'CopyFromParent';
$class = $self->num('Class', $class);
return pack("LLssSSSSLL", $wid, $parent, $x, $y, $width, $height,
$border_width, $class, $visual, $mask) .
join("", @values), $depth;
}],
Notice how similar the parameter list is to the X11 specification:
CreateWindow
wid, parent: WINDOW
class: { InputOutput, InputOnly, CopyFromParent}
depth: CARD8
visual: VISUALID or CopyFromParent
x, y: INT16
width, height, border-width: CARD16
value-mask: BITMASK
value-list: LISTofVALUE
Errors: Alloc, Colormap, Cursor, IDChoice, Match, Pixmap, Value, Window
So all we need to do is find the interface for the raise window function, and create a similar packing routine to do the job.
Hmmm ... let me see ... RaiseWindow ... doesn't seem to exist....
...roboticus
When your only tool is a hammer, all problems look like your thumb. | [reply] [d/l] |
Are the C functions from the X11 library available to perl scripts? It would be awesome to have a simple perl script that raised a window instead of having to bother with compiling a C program. Are you averse to using Tk or Prima? Tk compiles well on most systems with few difficulties, and requires no extra base libraries. It makes opening a window a breeze.
| [reply] |
Thanks guys, I'll probably just try both of those modules and see how it goes. It will take me a while to get the modules on these systems, unfortunately. I'll try to post back and let you guys know if it works out. | [reply] |