.\" 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::Ext::DAMAGE 3pm" .TH X11::Protocol::Ext::DAMAGE 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::Ext::DAMAGE \- drawing notifications .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use X11::Protocol; \& my $X = X11::Protocol\->new; \& $X\->init_extension(\*(AqDAMAGE\*(Aq) \& or print "DAMAGE extension not available"; \& \& my $damage = $X\->new_rsrc; \& $X\->DamageCreate ($damage, $drawable, \*(AqNonEmpty\*(Aq); \& \& sub my_event_handler { \& my %h = @_; \& if ($h{\*(Aqname\*(Aq} eq \*(AqDamageNotify\*(Aq) { \& my $drawable = $h{\*(Aqdrawable\*(Aq}; \& $X\->DamageSubtract ($damage, \*(AqNone\*(Aq, $parts_region); \& # do something for $parts_region changed in $drawable \& } \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \s-1DAMAGE\s0 extension lets a client listen for changes to drawables (windows, pixmaps, etc) due to drawing operations, including drawing into sub-windows which appears in the parent. .PP This can be used for various kinds of efficient copying or replicating of window contents, such as cloning to another screen, showing a magnified view, etc. The root window can be monitored to get changes on the whole screen. .PP Content changes due to drawing are conceived as \*(L"damage\*(R". A server-side damage object accumulates areas as rectangles to make a server-side \*(L"region\*(R" per the \s-1XFIXES 2.0\s0 extension (see X11::Protocol::Ext::XFIXES) .PP A DamageNotify event is sent from a damage object. A reporting level controls the level of detail, ranging from just one event on becoming non-empty, up to an event for every drawing operation affecting the relevant drawable. .PP Fetching an accumulated damage region (or part of it) is reckoned as a \&\*(L"repair\*(R". It doesn't change any drawables in any way, just fetches the region from the damage object. This fetch is atomic, so nothing is lost if the listening client is a bit lagged etc. .PP See \fIexamples/damage\-duplicate.pl\fR for one way to use damage to duplicate a window in real-time. .SH "REQUESTS" .IX Header "REQUESTS" The following requests are made available with an \f(CW\*(C`init_extension()\*(C'\fR, as per \*(L"\s-1EXTENSIONS\*(R"\s0 in X11::Protocol. .PP .Vb 1 \& my $is_available = $X\->init_extension(\*(AqDAMAGE\*(Aq); .Ve .SS "\s-1DAMAGE 1.0\s0" .IX Subsection "DAMAGE 1.0" .ie n .IP """($server_major, $server_minor) = $X\->DamageQueryVersion ($client_major, $client_minor)""" 4 .el .IP "\f(CW($server_major, $server_minor) = $X\->DamageQueryVersion ($client_major, $client_minor)\fR" 4 .IX Item "($server_major, $server_minor) = $X->DamageQueryVersion ($client_major, $client_minor)" Negotiate a protocol version with the server. \f(CW$client_major\fR and \&\f(CW$client_minor\fR is what the client would like, the returned \&\f(CW$server_major\fR and \f(CW$server_minor\fR is what the server will do, which might be less than requested (but not more). .Sp The current code supports up to 1.1. If asking for higher then be careful that it's upwardly compatible. The module code negotiates a version in \&\f(CW\*(C`init_extension()\*(C'\fR so explicit \f(CW\*(C`DamageQueryVersion()\*(C'\fR is normally not needed. .ie n .IP """$X\->DamageCreate ($damage, $drawable, $level)""" 4 .el .IP "\f(CW$X\->DamageCreate ($damage, $drawable, $level)\fR" 4 .IX Item "$X->DamageCreate ($damage, $drawable, $level)" Create a new damage object in \f(CW$damage\fR (a new \s-1XID\s0) which monitors changes to \f(CW$drawable\fR. If \f(CW$drawable\fR is a window then changes to its subwindows are included too. .Sp .Vb 3 \& # listening to every change on the whole screen \& my $damage = $X\->new_rsrc; \& $X\->DamageCreate ($damage, $X\->root, \*(AqRawRectangles\*(Aq); .Ve .Sp \&\f(CW$level\fR is an enum string controlling how often \f(CW\*(C`DamageNotify\*(C'\fR events are emitted (see \*(L"\s-1EVENTS\*(R"\s0 below). .Sp .Vb 4 \& RawRectangles every change \& DeltaRectangles when damage region expands \& BoundingBox when damage bounding box expands \& NonEmpty when damage first becomes non\-empty .Ve .ie n .IP """$X\->DamageDestroy ($damage)""" 4 .el .IP "\f(CW$X\->DamageDestroy ($damage)\fR" 4 .IX Item "$X->DamageDestroy ($damage)" Destroy \f(CW$damage\fR. .ie n .IP """$X\->DamageSubtract ($damage, $repair_region, $parts_region)""" 4 .el .IP "\f(CW$X\->DamageSubtract ($damage, $repair_region, $parts_region)\fR" 4 .IX Item "$X->DamageSubtract ($damage, $repair_region, $parts_region)" Move the accumulated region in \f(CW$damage\fR to \f(CW$parts_region\fR (a region \&\s-1XID\s0), and clear it from \f(CW$damage\fR. .Sp If \f(CW$parts_region\fR is \*(L"None\*(R" then \f(CW$damage\fR is cleared and the region discarded. This can be used if for example the entire \f(CW$drawable\fR will be copied or re-examined, so the exact parts are not needed. .Sp \&\f(CW$repair_region\fR is what portion of \f(CW$damage\fR to consider. \*(L"None\*(R" means move and clear everything in \f(CW$damage\fR. Otherwise \f(CW$repair_region\fR is a region \s-1XID\s0 and the portion of the damage region within \f(CW$repair_region\fR is moved and cleared. Anything outside is left in \f(CW$damage\fR. .Sp If anything is left in \f(CW$damage\fR then a new \f(CW\*(C`DamageNotify\*(C'\fR event is immediately sent. This can be good for instance if you picked out a \&\f(CW$repair_region\fR corresponding to what you thought was the window size (perhaps from the \f(CW\*(C`geometry\*(C'\fR field of a \f(CW\*(C`DamageNotify\*(C'\fR event), but it has grown in the interim. .Sp Region objects here can be created with the \s-1XFIXES 2.0\s0 extension (see X11::Protocol::Ext::XFIXES). It should be available whenever \s-1DAMAGE\s0 is available. If using \*(L"None\*(R" and \*(L"None\*(R" to clear and discard then region objects are not required and there's no need for an \&\f(CW\*(C`init_extension(\*(AqXFIXES\*(Aq)\*(C'\fR. .SS "\s-1DAMAGE 1.1\s0" .IX Subsection "DAMAGE 1.1" .ie n .IP """$X\->DamageAdd ($drawable, $region)""" 4 .el .IP "\f(CW$X\->DamageAdd ($drawable, $region)\fR" 4 .IX Item "$X->DamageAdd ($drawable, $region)" Report to any interested damage objects that changes have occurred in \&\f(CW$region\fR (a region \s-1XID\s0) of \f(CW$drawable\fR. .Sp This is used by clients which modify a drawable in ways not seen by the normal protocol drawing operations. For example an MIT-SHM shared memory pixmap modified by writing to the memory (see X11::Protocol::Ext::MIT_SHM), or the various \*(L"direct rendering\*(R" to graphics hardware or \s-1GL\s0 etc. .SH "EVENTS" .IX Header "EVENTS" \&\f(CW\*(C`DamageNotify\*(C'\fR events are sent to the client which created the damage object. These events are always generated, there's nothing to select or deselect them. The event has the usual fields .PP .Vb 4 \& name "DamageNotify" \& synthetic true if from a SendEvent \& code integer opcode \& sequence_number integer .Ve .PP and event-specific fields .PP .Vb 7 \& damage XID, damage object \& drawable XID, as from DamageCreate \& level enum, as from DamageCreate \& more boolean, if more DamageNotify on the way \& time integer, server timestamp \& area arrayref [$x,$y,$width,$height] \& geometry arrayref [$rootx,$rooty,$width,$height] .Ve .PP \&\f(CW\*(C`drawable\*(C'\fR and \f(CW\*(C`level\*(C'\fR are as from the \f(CW\*(C`DamageCreate()\*(C'\fR which made the \&\f(CW\*(C`damage\*(C'\fR object. .PP \&\f(CW\*(C`more\*(C'\fR is true if there's further \f(CW\*(C`DamageNotify\*(C'\fR events on the way for this damage object. This can happen when the \*(L"level\*(R" means there's a set of \&\f(CW\*(C`area\*(C'\fR rectangles to report. .PP \&\f(CW\*(C`area\*(C'\fR is a rectangle within \f(CW\*(C`drawable\*(C'\fR, as a 4\-element arrayref, .PP .Vb 1 \& [ $x, $y, $width, $height ] .Ve .PP What it covers depends on the reporting level requested, .IP "\(bu" 4 \&\f(CW\*(C`RawRectangles\*(C'\fR \*(-- a rectangle around an arc, line, etc, drawing operation which changed \f(CW\*(C`drawable\*(C'\fR. .IP "\(bu" 4 \&\f(CW\*(C`DeltaRectangles\*(C'\fR \*(-- an additional rectangle extending the damage region. Only new rectangles are reported, not any of the existing damage region. Reporting a region addition may require multiple \f(CW\*(C`DamageNotify\*(C'\fR events. .IP "\(bu" 4 \&\f(CW\*(C`BoundingBox\*(C'\fR \*(-- a bounding box around the damage region accumulated, bigger than previously reported. .IP "\(bu" 4 \&\f(CW\*(C`NonEmpty\*(C'\fR \*(-- umm, something, maybe the entire drawable. .PP \&\f(CW\*(C`geometry\*(C'\fR is the current size and position of the drawable as a 4\-element arrayref in root window coordinates. For a pixmap \f(CW$root_x\fR and \f(CW$root_y\fR are 0. .PP .Vb 1 \& [ $root_x, $root_y, $width, $height ] .Ve .SH "ENUM TYPES" .IX Header "ENUM TYPES" The reporting level above is type \*(L"DamageReportLevel\*(R". So for example (after a successful \f(CW\*(C`$X\->init_extension(\*(AqDAMAGE\*(Aq)\*(C'\fR), .PP .Vb 1 \& $number = $X\->num(\*(AqDamageReportLevel\*(Aq, \*(AqRawRectangles\*(Aq); \& \& $string = $X\->interp(\*(AqDamageReportLevel\*(Aq, 3); .Ve .PP See \*(L"\s-1SYMBOLIC CONSTANTS\*(R"\s0 in X11::Protocol. .SH "ERRORS" .IX Header "ERRORS" Error type \*(L"Damage\*(R" is a bad \f(CW$damage\fR resource \s-1XID\s0 in a request. .SH "BUGS" .IX Header "BUGS" The server extension version number is queried in the \f(CW\*(C`init_extension()\*(C'\fR, but not yet made available as such. The version determines whether \&\f(CW\*(C`DamageAdd()\*(C'\fR ought to work. Currently that request is always setup, but presumably generates an Opcode error if the server doesn't have it. .SH "SEE ALSO" .IX Header "SEE ALSO" X11::Protocol, X11::Protocol::Ext::XFIXES .PP \&\fI/usr/share/doc/x11proto\-damage\-dev/damageproto.txt.gz\fR, .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014, 2017 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 .