diff options
author | Adam Endrodi <adam.endrodi@blumsoft.eu> | 2009-12-15 14:35:36 +0200 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2009-12-15 14:35:36 +0200 |
commit | 923269beacf573d30193254d66dcb0616e2f38ef (patch) | |
tree | 86bdf683501e3bd4de37f0312933476b374e72f1 /hildon | |
parent | f107ea16442d463e37531a6d4d67e9ee9d6ef917 (diff) |
hildon_gtk_window_take_screenshot_then_wait()
Enhance the horrible take screenshot interface to block the client until
it's complete. The test program may not build out of the box. Requires
modified hildon-desktop from http://maemo.gitorious.org/fremantle-hildon-desktop/hildon-desktop/commits/screenshot.
Signed-off-by: Claudio Saavedra <csaavedra@igalia.com>
Diffstat (limited to 'hildon')
-rw-r--r-- | hildon/hildon-gtk.c | 35 | ||||
-rw-r--r-- | hildon/hildon-gtk.h | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/hildon/hildon-gtk.c b/hildon/hildon-gtk.c index 5b2f8cc..0bcb635 100644 --- a/hildon/hildon-gtk.c +++ b/hildon/hildon-gtk.c @@ -503,6 +503,41 @@ hildon_gtk_window_take_screenshot (GtkWindow *window, XSync (xev.xclient.display, False); } +/* XIfEvent() predicate to check for a reply to a + * _HILDON_LOADING_SCREENSHOT command. */ +static Bool +screenshot_done (Display *dpy, const XEvent *event, GtkWindow *window) +{ + return event->type == ClientMessage + && event->xclient.message_type == XInternAtom (dpy, + "_HILDON_LOADING_SCREENSHOT", + False) + && event->xclient.window == GDK_WINDOW_XID (GTK_WIDGET (window)->window); +} + +/** + * hildon_gtk_window_take_screenshot_and_wait: + * @window: a #GtkWindow + * @take: %TRUE to take a screenshot, %FALSE to destroy the existing one. + * + * Like hildon_gtk_window_take_screenshot_and_wait() but blocks until the + * operation is complete. + * + * Since: 2.2 + * + **/ +void +hildon_gtk_window_take_screenshot_then_wait (GtkWindow *window, + gboolean take) +{ + XEvent foo; + GdkWindow *win; + + win = GTK_WIDGET (window)->window; + hildon_gtk_window_take_screenshot (window, take); + XIfEvent (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (window))), + &foo, (void *)screenshot_done, (XPointer)window); +} /** * hildon_gtk_hscale_new: diff --git a/hildon/hildon-gtk.h b/hildon/hildon-gtk.h index 37efe4d..9108282 100644 --- a/hildon/hildon-gtk.h +++ b/hildon/hildon-gtk.h @@ -102,6 +102,9 @@ hildon_gtk_window_set_portrait_flags (GtkWindow *window, void hildon_gtk_window_take_screenshot (GtkWindow *window, gboolean take); +void +hildon_gtk_window_take_screenshot_then_wait (GtkWindow *window, + gboolean take); void hildon_gtk_window_enable_zoom_keys (GtkWindow *window, |