Re: Scribble Example




On Jul 15, 2008, at 4:51 AM, Mario Kemper wrote:

The goal of our attempts is to recreate the behavior of ksnapshot, the
KDE Screenshot Tool. You select a window by its xid and while hovering
over it we want to draw a rectangle around the current subwindow to
indicate the size of it. In the end you should be able to take a
screenshot of the selected subwindow (that is currently not a problem
because it's a drawable and it's easy to save it).
(maybe someone is interested in the code:
http://websvn.kde.org/branches/KDE/4.1/kdegraphics/ksnapshot/)

These lines from regiongrabber.cpp:
setWindowFlags( Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
showFullScreen();

suggest to me that they put a new window over the whole screen, and draw their handles on that -- like zentara's suggestion.

The biggest benefit here is that you'll get your mouse events from anywhere on the screen, because your frameless, always-on-top window is above everything and accepting mouse input.


It looks like WindowGrabber does something similar, but effectively does a gdk_draw_drawable() with the other xid as the source.

QPixmap pm( grabWindow( child, x, y, w, h, border ) );


--
Doing a good job around here is like wetting your pants in a dark suit; you get a warm feeling, but no one notices.
  -- unknown





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]