.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "X11::Protocol::ChooseWindow 3pm" .TH X11::Protocol::ChooseWindow 3pm "2013-11-04" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" X11::Protocol::ChooseWindow \-\- user click to choose window .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use X11::Protocol::ChooseWindow; \& my $client_window = X11::Protocol::ChooseWindow\->choose (X => $X); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This spot of code lets the user click on a toplevel window to choose it, in a similar style to the \f(CW\*(C`xwininfo\*(C'\fR or \f(CW\*(C`xkill\*(C'\fR programs. .SS "Implementation" .IX Subsection "Implementation" The method is similar to the \f(CW\*(C`xwininfo\*(C'\fR etc programs. It consists of a \&\f(CW\*(C`GrabPointer\*(C'\fR on the root window, waits for a \f(CW\*(C`ButtonPress\*(C'\fR and corresponding \f(CW\*(C`ButtonRelease\*(C'\fR from the user, get the frame window is from the Press event, then the client window under there from \&\f(CW\*(C`frame_window_to_client()\*(C'\fR in \f(CW\*(C`X11::Protocol::WM\*(C'\fR. .PP \&\f(CW\*(C`KeyPress\*(C'\fR events are not used and go to the focus window in the usual way. This can be good in a command line program since it lets the user press \&\f(CW\*(C`^C\*(C'\fR (\f(CW\*(C`SIGINT\*(C'\fR) in an \f(CW\*(C`xterm\*(C'\fR or similar. Perhaps in the future there could be an option to watch for \f(CW\*(C`Esc\*(C'\fR to cancel or some such. .PP A virtual root per \f(CW\*(C`root_to_virtual_root()\*(C'\fR in \f(CW\*(C`X11::Protocol::WM\*(C'\fR is used if present. This helps \f(CW\*(C`ChooseWindow\*(C'\fR work with \f(CW\*(C`amiwm\*(C'\fR and similar virtual root window managers. .SH "FUNCTIONS" .IX Header "FUNCTIONS" The following \f(CW\*(C`choose()\*(C'\fR is in class method style with the intention of perhaps in the future having objects of type \f(CW\*(C`X11::Protocol::ChooseWindow\*(C'\fR holding state and advanced by events supplied by an external main loop. .SS "Choosing" .IX Subsection "Choosing" .ie n .IP """$window = X11::Protocol::ChooseWindow\->choose (key=>value,...)""" 4 .el .IP "\f(CW$window = X11::Protocol::ChooseWindow\->choose (key=>value,...)\fR" 4 .IX Item "$window = X11::Protocol::ChooseWindow->choose (key=>value,...)" Read a user button press to choose a toplevel window. The key/value options are as follows, .Sp .Vb 2 \& X => X11::Protocol object \& display => string ":0:0" etc \& \& screen => integer, eg. 0 \& root => XID of root window \& \& time => integer server timestamp \& event => hashref of event initiating the choose \& \& cursor => XID of cursor \& cursor_glyph => integer glyph for cursor font \& cursor_name => string name from cursor font .Ve .Sp \&\f(CW\*(C`X\*(C'\fR or \f(CW\*(C`display\*(C'\fR gives the server, or the default is to open the \&\f(CW\*(C`DISPLAY\*(C'\fR environment variable. \f(CW\*(C`X\*(C'\fR for an \f(CW\*(C`X11::Protocol\*(C'\fR object is usual, but sometimes it can make sense to open a new connection just to choose. .Sp \&\f(CW\*(C`root\*(C'\fR or \f(CW\*(C`screen\*(C'\fR gives the root window to choose on, or the default is the current screen of \f(CW$X\fR, which in turn defaults to the screen part of the display name. If there's a window manager virtual root then that's automatically used as necessary. .Sp \&\f(CW\*(C`time\*(C'\fR or the time field in \f(CW\*(C`event\*(C'\fR is a server timestamp for the \&\f(CW\*(C`GrabPointer()\*(C'\fR. This guards against stealing a grab from another client if badly lagged. Omitted or \f(CW\*(C`undef\*(C'\fR means \f(CW\*(C`CurrentTime\*(C'\fR. In a command line program there might be no initiating event, making \f(CW\*(C`CurrentTime\*(C'\fR all that's possible. .Sp \&\f(CW\*(C`cursor\*(C'\fR etc is the mouse pointer cursor to show during the choose, as a visual indication to the user. The default is a \*(L"crosshair\*(R". \&\f(CW\*(C`cursor_name\*(C'\fR or \f(CW\*(C`cursor_glyph\*(C'\fR are from the usual cursor font. See X11::CursorFont for available names. For example perhaps the \*(L"exchange\*(R" cursor to choose a window for some sort of swap or flip, .Sp .Vb 3 \& $window = X11::Protocol::ChooseWindow\->choose \& (X => $X, \& cursor_name => "exchange"); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" X11::Protocol, X11::Protocol::WM, X11::CursorFont .PP \&\fIxwininfo\fR\|(1), \fIxkill\fR\|(1), and their \fIdsimple.c\fR \f(CW\*(C`Select_Window()\*(C'\fR code .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2010, 2011, 2012, 2013 Kevin Ryde .PP X11\-Protocol\-Other is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP X11\-Protocol\-Other is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with X11\-Protocol\-Other. If not, see .