.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" 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 >0, 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 .\" ======================================================================== .\" .IX Title "X11::Protocol::ChooseWindow 3pm" .TH X11::Protocol::ChooseWindow 3pm "2019-08-26" "perl v5.28.1" "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 choose is implemented in a similar way to the \f(CW\*(C`xwininfo\*(C'\fR etc programs. It consists of \f(CW\*(C`GrabPointer()\*(C'\fR on the root window, wait for a \&\f(CW\*(C`ButtonPress\*(C'\fR and \f(CW\*(C`ButtonRelease\*(C'\fR from the user, get the frame window from the \f(CW\*(C`ButtonPress\*(C'\fR event, then the client window under there from \&\f(CW\*(C`frame_window_to_client()\*(C'\fR of \f(CW\*(C`X11::Protocol::WM\*(C'\fR. .PP \&\f(CW\*(C`KeyPress\*(C'\fR events are not used and they 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 .Sp A \f(CW\*(C`cursor\*(C'\fR \s-1XID\s0 can be created by any client as usual. Don't forget to flush if creating a cursor from one connection, so it's ready for use from another. .SH "SEE ALSO" .IX Header "SEE ALSO" X11::Protocol, X11::Protocol::WM, X11::CursorFont .PP \&\fBxwininfo\fR\|(1), \fBxkill\fR\|(1), and their \fIdsimple.c\fR \f(CW\*(C`Select_Window()\*(C'\fR code .PP \&\*(L"Inter-Client Communication Conventions Manual\*(R" section \*(L"\s-1WM_STATE\s0 Property\*(R" for notes on using \f(CW\*(C`WM_STATE\*(C'\fR to identify client windows. .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019 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 .