[Goodies-commits] r6272 - in xfce4-screenshooter-plugin/trunk: . lib src
Jerome Guelfucci
jeromeg at xfce.org
Thu Dec 4 18:42:25 CET 2008
Author: jeromeg
Date: 2008-12-04 17:42:25 +0000 (Thu, 04 Dec 2008)
New Revision: 6272
Modified:
xfce4-screenshooter-plugin/trunk/ChangeLog
xfce4-screenshooter-plugin/trunk/NEWS
xfce4-screenshooter-plugin/trunk/configure.ac.in
xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c
xfce4-screenshooter-plugin/trunk/src/main.c
Log:
* lib/screenshooter-utils.c:
- remove all X code, in particular find_toplevel_window. Instead,
use a combination of gdk_window_get_toplevel and
gdk_window_get_frame_extents. This should fix some remaining
crashes with "BadWindow" error.
- detect the area to screenshot after the delay, rather than before.
* src/main.c: add a comment.
* configure.ac.in: remove x11proto-core build dependency.
* NEWS: updated.
Modified: xfce4-screenshooter-plugin/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter-plugin/trunk/ChangeLog 2008-12-04 17:33:12 UTC (rev 6271)
+++ xfce4-screenshooter-plugin/trunk/ChangeLog 2008-12-04 17:42:25 UTC (rev 6272)
@@ -1,3 +1,15 @@
+2008-12-04 jeromeg
+
+ * lib/screenshooter-utils.c:
+ - remove all X code, in particular find_toplevel_window. Instead,
+ use a combination of gdk_window_get_toplevel and
+ gdk_window_get_frame_extents. This should fix some remaining
+ crashes with "BadWindow" error.
+ - detect the area to screenshot after the delay, rather than before.
+ * src/main.c: add a comment.
+ * configure.ac.in: remove x11proto-core build dependency.
+ * NEWS: updated.
+
2008-12-03 jeromeg
* lib/screenshooter-dialogs.c: ifdef the tooltips stuff, because it's
Modified: xfce4-screenshooter-plugin/trunk/NEWS
===================================================================
--- xfce4-screenshooter-plugin/trunk/NEWS 2008-12-04 17:33:12 UTC (rev 6271)
+++ xfce4-screenshooter-plugin/trunk/NEWS 2008-12-04 17:42:25 UTC (rev 6272)
@@ -7,6 +7,8 @@
not exist. Thanks to Nick Schermer for the explanations.
- when saving the screenshot fails, show an error dialog
explaning why it failed.
+ - fix some remaining crashes when taking a screenshot of the active
+ window.
* Enhancements:
- Use -V for the version CLI option.
@@ -16,6 +18,8 @@
totally rewritten to improve the user interface: it should look
cleaner and tooltips have been added. Work started by David
Collins.
+ - when using delay, detect the area to screenshot after the delay,
+ and not before, as it caused weird results in some cases.
=== Version 1.4.0 ===
Modified: xfce4-screenshooter-plugin/trunk/configure.ac.in
===================================================================
--- xfce4-screenshooter-plugin/trunk/configure.ac.in 2008-12-04 17:33:12 UTC (rev 6271)
+++ xfce4-screenshooter-plugin/trunk/configure.ac.in 2008-12-04 17:42:25 UTC (rev 6272)
@@ -41,9 +41,6 @@
dnl Check for xfcegui4
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.4])
-dnl Check for x11proto
-XDT_CHECK_PACKAGE([X11PROTO_CORE], [xproto], [7])
-
dnl Check for gtk
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c 2008-12-04 17:33:12 UTC (rev 6271)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-utils.c 2008-12-04 17:42:25 UTC (rev 6272)
@@ -23,9 +23,6 @@
-static
-Window find_toplevel_window (Window xid);
-
static GdkWindow
*get_active_window (GdkScreen *screen,
gboolean *needs_unref);
@@ -35,38 +32,6 @@
-/* Borrowed from gnome-screenshot */
-
-/* This function returns the toplevel window containing Window, for most
- * window managers this will enable you to get the decorations around
- * the window. Does not work with Compiz.
- * Window: the X identifier of the window
- * Returns: the X identifier of the toplevel window containing Window.*/
-static Window
-find_toplevel_window (Window xid)
-{
- Window root, parent, *children;
- unsigned int nchildren;
-
- do
- {
- if (XQueryTree (GDK_DISPLAY (), xid, &root,
- &parent, &children, &nchildren) == 0)
- {
- g_warning ( _("Couldn't find window manager window") );
- return None;
- }
-
- if (root == parent)
- return xid;
-
- xid = parent;
- }
- while (TRUE);
-}
-
-
-
static GdkWindow
*get_active_window (GdkScreen *screen, gboolean *needs_unref)
{
@@ -116,8 +81,6 @@
/* Get the root window */
root = gdk_get_default_root_window ();
- /* Based on gnome-screenshot code */
-
gdk_window_get_frame_extents (window, rectangle);
/* Don't grab thing offscreen. */
@@ -144,6 +107,8 @@
if (y_orig + height > gdk_screen_height ())
height = gdk_screen_height () - y_orig;
+
+ g_free (rectangle);
/* Take the screenshot from the root GdkWindow, to grab things such as
* menus. */
@@ -177,6 +142,9 @@
/* Get the screen on which the screenshot should be taken */
screen = gdk_screen_get_default ();
+
+ /* wait for n=delay seconds */
+ sleep (delay);
/* Get the window/desktop we want to screenshot*/
if (mode == FULLSCREEN)
@@ -188,10 +156,7 @@
{
window = get_active_window (screen, &needs_unref);
}
-
- /* wait for n=delay seconds */
- sleep (delay);
-
+
if (mode == FULLSCREEN || mode == ACTIVE_WINDOW)
{
screenshot = get_window_screenshot (window);
Modified: xfce4-screenshooter-plugin/trunk/src/main.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/src/main.c 2008-12-04 17:33:12 UTC (rev 6271)
+++ xfce4-screenshooter-plugin/trunk/src/main.c 2008-12-04 17:42:25 UTC (rev 6272)
@@ -209,6 +209,8 @@
gdk_display_sync (display);
+ /* Make sure the window manager had time to set the new active
+ * window.*/
sleep (1);
if (response == GTK_RESPONSE_OK)
More information about the Goodies-commits
mailing list