[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: Review Request: Make the Screenshots effect capable to take pictures of a random window provided
From:       Thomas_Lübking <thomas.luebking () web ! de>
Date:       2012-03-27 19:52:46
Message-ID: 20120327195246.2005.29374 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On March 24, 2012, 1:26 p.m., Martin Gr=C3=A4=C3=9Flin wrote:
> > May I ask for the rational behind making it possible to screenshot any =
window? :-)
> > =

> > That is just to remind you that the d-bus interface is only available i=
f compositing is enabled (and the effect is activated) and we don't provide=
 any API guarantee on the effects.
> =

> Aleix Pol Gonzalez wrote:
>     Well, the idea is that I have a program that runs an application and =
takes a screenshot of it.
> =

> Thomas L=C3=BCbking wrote:
>     In how far is that different from window()->render(&img)?
>     Is this somehow about shooting flash?
> =

> Aleix Pol Gonzalez wrote:
>     I'm sorry, but I don't understand the question. What's window()?
> =

> Thomas L=C3=BCbking wrote:
>     QWidget::window() - ie. why don't you "shoot" the window in-process (=
gtk+ certainly has similar calls)
> =

> Martin Gr=C3=A4=C3=9Flin wrote:
>     I'd guess because it does not provide decorations
> =

> Aleix Pol Gonzalez wrote:
>     Well, my application takes screenshots, but not screenshots of itself=
 but a random host application, such as ksnapshot.
>     If this is really a blocker, maybe you can wait until it's ready.
>     =

>     This "taking screenshots" could be done with QPixmap::grabWindow but =
it doesn't provide decorations so the result looks close to useless.
>     =

>     I think it kind of makes sense to have such an API. The code is simpl=
e and straightforward and the use-case is clear. I think it's even more cle=
ar than the "take a picture of the currently active window", but I'm not go=
ing to discuss this.
> =

> Thomas L=C3=BCbking wrote:
>     KSnapshot does actually involve the screenshot effect if available.
>     To take a screenshot by id, you'll either need an id programmatically=
 or ask the user to provide one.
>     Latter is what ksnapshot does and the use case for the other one is s=
till not clear (at least not to me) and at least i mostly wonder whether yo=
u actually want this or in fact want sth. entirely different but don't yet =
know about ;-)
>     =

>     -> You could just point your interested client to such interface.
>     =

>     This is unrelated, but QPixmap::grabWindow btw. can shoot decorations=
, but copies from the screenbuffer (ie. it cannot shoot obscured regions)
>     Also there's no "take a picture of the currently active window" in th=
e screenshot dbus interface (unless you of course use "focus strictly under=
 mouse") what makes me more wonder if the current interface isn't what you =
actually want *shrug*
> =

> Aleix Pol Gonzalez wrote:
>     Well, I think you're getting a bit confused, here's my code: http://p=
aste.kde.org/446540/
>     =

>     The interfaces are prefixed with "Aleix" because I needed to create m=
y fork of the effect locally because here I'm running the distro's KWin.

I don't feel confused.

So, your tool runs another application and allows to screencast it at rando=
m times (by the user pushing a button)
To do so, you rely on an external "xdotool" process to obtain *the* WId for=
 the pid.

1. a process can hold more than one WId's
2. the pid -> WId connection is weak through an optional NETWM property

Therefore I assume this is tailored for a rather specific usage?
Considered to connect a keyboard shortcut to automatically shoot the window=
 under the mouse instead (what is more reliable)

Aside the mentioned flaws of that approach (you could btw. XQueryTree and c=
heck for the _NET_WM_PID property, then shoot all found windows - won't fix=
 the weak pid/wid relation, though - ie. it won't work with eg. random TCL/=
TK applications like eg. xmaxima) I however don't know a better approach to=
 shoot random applications this way.


---
ftr:
QPixmap::grabWindow() can be used to shoot windows including the decoration=
 by shooting the root window and calculating the optional geometry paramete=
rs from the windows frame struts


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104388/#review11806
-----------------------------------------------------------


On March 24, 2012, 12:51 a.m., Aleix Pol Gonzalez wrote:
> =

> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104388/
> -----------------------------------------------------------
> =

> (Updated March 24, 2012, 12:51 a.m.)
> =

> =

> Review request for kwin.
> =

> =

> Description
> -------
> =

> Make it possible to create a screenshot given a winid
> =

> =

> Diffs
> -----
> =

>   kwin/effects/screenshot/screenshot.h f05d0ec =

>   kwin/effects/screenshot/screenshot.cpp f75a179 =

> =

> Diff: http://git.reviewboard.kde.org/r/104388/diff/
> =

> =

> Testing
> -------
> =

> screenshot attached
> =

> =

> Screenshots
> -----------
> =

> screenshot taken with this
>   http://git.reviewboard.kde.org/r/104388/s/489/
> =

> =

> Thanks,
> =

> Aleix Pol Gonzalez
> =

>


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/104388/">http://git.reviewboard.kde.org/r/104388/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 24th, 2012, 1:26 p.m., <b>Martin \
Gräßlin</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">May I ask for the rational behind making it possible to screenshot any \
window? :-)

That is just to remind you that the d-bus interface is only available if compositing \
is enabled (and the effect is activated) and we don&#39;t provide any API guarantee \
on the effects.</pre>  </blockquote>




 <p>On March 24th, 2012, 2:58 p.m., <b>Aleix Pol Gonzalez</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well, the idea is that I \
have a program that runs an application and takes a screenshot of it.</pre>  \
</blockquote>





 <p>On March 24th, 2012, 5:12 p.m., <b>Thomas Lübking</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">In how far is that \
different from window()-&gt;render(&amp;img)? Is this somehow about shooting \
flash?</pre>  </blockquote>





 <p>On March 24th, 2012, 8:03 p.m., <b>Aleix Pol Gonzalez</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I&#39;m sorry, but I \
don&#39;t understand the question. What&#39;s window()?</pre>  </blockquote>





 <p>On March 24th, 2012, 8:59 p.m., <b>Thomas Lübking</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">QWidget::window() - ie. \
why don&#39;t you &quot;shoot&quot; the window in-process (gtk+ certainly has similar \
calls)</pre>  </blockquote>





 <p>On March 24th, 2012, 9 p.m., <b>Martin Gräßlin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I&#39;d guess because it \
does not provide decorations</pre>  </blockquote>





 <p>On March 25th, 2012, 11:56 p.m., <b>Aleix Pol Gonzalez</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well, my application \
takes screenshots, but not screenshots of itself but a random host application, such \
as ksnapshot. If this is really a blocker, maybe you can wait until it&#39;s ready.

This &quot;taking screenshots&quot; could be done with QPixmap::grabWindow but it \
doesn&#39;t provide decorations so the result looks close to useless.

I think it kind of makes sense to have such an API. The code is simple and \
straightforward and the use-case is clear. I think it&#39;s even more clear than the \
&quot;take a picture of the currently active window&quot;, but I&#39;m not going to \
discuss this.</pre>  </blockquote>





 <p>On March 26th, 2012, 12:16 a.m., <b>Thomas Lübking</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">KSnapshot does actually \
involve the screenshot effect if available. To take a screenshot by id, you&#39;ll \
either need an id programmatically or ask the user to provide one. Latter is what \
ksnapshot does and the use case for the other one is still not clear (at least not to \
me) and at least i mostly wonder whether you actually want this or in fact want sth. \
entirely different but don&#39;t yet know about ;-)

-&gt; You could just point your interested client to such interface.

This is unrelated, but QPixmap::grabWindow btw. can shoot decorations, but copies \
from the screenbuffer (ie. it cannot shoot obscured regions) Also there&#39;s no \
&quot;take a picture of the currently active window&quot; in the screenshot dbus \
interface (unless you of course use &quot;focus strictly under mouse&quot;) what \
makes me more wonder if the current interface isn&#39;t what you actually want \
*shrug*</pre>  </blockquote>





 <p>On March 26th, 2012, 12:43 p.m., <b>Aleix Pol Gonzalez</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well, I think you&#39;re \
getting a bit confused, here&#39;s my code: http://paste.kde.org/446540/

The interfaces are prefixed with &quot;Aleix&quot; because I needed to create my fork \
of the effect locally because here I&#39;m running the distro&#39;s KWin.</pre>  \
</blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I don&#39;t feel \
confused.

So, your tool runs another application and allows to screencast it at random times \
(by the user pushing a button) To do so, you rely on an external &quot;xdotool&quot; \
process to obtain *the* WId for the pid.

1. a process can hold more than one WId&#39;s
2. the pid -&gt; WId connection is weak through an optional NETWM property

Therefore I assume this is tailored for a rather specific usage?
Considered to connect a keyboard shortcut to automatically shoot the window under the \
mouse instead (what is more reliable)

Aside the mentioned flaws of that approach (you could btw. XQueryTree and check for \
the _NET_WM_PID property, then shoot all found windows - won&#39;t fix the weak \
pid/wid relation, though - ie. it won&#39;t work with eg. random TCL/TK applications \
like eg. xmaxima) I however don&#39;t know a better approach to shoot random \
applications this way.


---
ftr:
QPixmap::grabWindow() can be used to shoot windows including the decoration by \
shooting the root window and calculating the optional geometry parameters from the \
windows frame struts</pre> <br />








<p>- Thomas</p>


<br />
<p>On March 24th, 2012, 12:51 a.m., Aleix Pol Gonzalez wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kwin.</div>
<div>By Aleix Pol Gonzalez.</div>


<p style="color: grey;"><i>Updated March 24, 2012, 12:51 a.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Make it possible to create a screenshot given a winid</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">screenshot attached</pre>  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kwin/effects/screenshot/screenshot.h <span style="color: \
grey">(f05d0ec)</span></li>

 <li>kwin/effects/screenshot/screenshot.cpp <span style="color: \
grey">(f75a179)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/104388/diff/" style="margin-left: \
3em;">View Diff</a></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Screenshots </h1>

<div>

 <a href="http://git.reviewboard.kde.org/r/104388/s/489/"><img \
src="http://git.reviewboard.kde.org/media/uploaded/images/2012/03/24/kalgebra_400x100.png" \
style="border: 1px black solid;" alt="screenshot taken with this" /></a>

</div>


  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic