From df1cc88424520f77a2f7ebcd94722cb14b33e0cd Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 17 May 2005 17:35:22 +0000 Subject: [PATCH] Update to changed cairo interface. 2005-05-17 Owen Taylor * gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface): Update to changed cairo interface. * gdk/x11/gdkdrawable-x11.[ch]: Add _gdk_x11_drawable_update_size() * gdk/x11/gdkwindow-x11.c (gdk_window_resize) (gdk_window_move_resize) * gdk/x11/gdkevents-x11.c (gdk_event_translate): Call _gdk_x11_drawable_update_size(). --- ChangeLog | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ ChangeLog.pre-2-8 | 13 +++++++++++++ gdk/x11/gdkdrawable-x11.c | 41 ++++++++++++++++++++++++++++----------- gdk/x11/gdkdrawable-x11.h | 1 + gdk/x11/gdkevents-x11.c | 3 +++ gdk/x11/gdkwindow-x11.c | 7 +++++++ 7 files changed, 80 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88de90d388..1b068adb8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-05-17 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface): + Update to changed cairo interface. + + * gdk/x11/gdkdrawable-x11.[ch]: + Add _gdk_x11_drawable_update_size() + + * gdk/x11/gdkwindow-x11.c (gdk_window_resize) + (gdk_window_move_resize) + * gdk/x11/gdkevents-x11.c (gdk_event_translate): + Call _gdk_x11_drawable_update_size(). + 2005-05-17 Matthias Clasen * gtk/gtktextview.c (cursor_blinks): Don't blink the cursor diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 88de90d388..1b068adb8a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2005-05-17 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface): + Update to changed cairo interface. + + * gdk/x11/gdkdrawable-x11.[ch]: + Add _gdk_x11_drawable_update_size() + + * gdk/x11/gdkwindow-x11.c (gdk_window_resize) + (gdk_window_move_resize) + * gdk/x11/gdkevents-x11.c (gdk_event_translate): + Call _gdk_x11_drawable_update_size(). + 2005-05-17 Matthias Clasen * gtk/gtktextview.c (cursor_blinks): Don't blink the cursor diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 88de90d388..1b068adb8a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +2005-05-17 Owen Taylor + + * gdk/x11/gdkdrawable-x11.c (gdk_x11_ref_cairo_surface): + Update to changed cairo interface. + + * gdk/x11/gdkdrawable-x11.[ch]: + Add _gdk_x11_drawable_update_size() + + * gdk/x11/gdkwindow-x11.c (gdk_window_resize) + (gdk_window_move_resize) + * gdk/x11/gdkevents-x11.c (gdk_event_translate): + Call _gdk_x11_drawable_update_size(). + 2005-05-17 Matthias Clasen * gtk/gtktextview.c (cursor_blinks): Don't blink the cursor diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index a2cc383484..15a41c4372 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -246,6 +246,27 @@ _gdk_x11_drawable_finish (GdkDrawable *drawable) } } +/** + * _gdk_x11_drawable_update_size: + * @drawable: a #GdkDrawableImplX11. + * + * Updates the state of the drawable (in particular the drawable's + * cairo surface) when its size has changed. + **/ +void +_gdk_x11_drawable_update_size (GdkDrawable *drawable) +{ + GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable); + + if (impl->cairo_surface) + { + int width, height; + + gdk_drawable_get_size (drawable, &width, &height); + cairo_xlib_surface_set_size (impl->cairo_surface, width, height); + } +} + static void try_pixmap (Display *xdisplay, int screen, @@ -1450,17 +1471,21 @@ gdk_x11_ref_cairo_surface (GdkDrawable *drawable) if (!impl->cairo_surface) { GdkVisual *visual = NULL; + int width, height; visual = gdk_drawable_get_visual (drawable); + gdk_drawable_get_size (drawable, &width, &height); + if (visual) - impl->cairo_surface = cairo_xlib_surface_create_with_visual (GDK_SCREEN_XDISPLAY (impl->screen), - impl->xid, - GDK_VISUAL_XVISUAL (visual)); - else if (gdk_drawable_get_depth (drawable) == 1) impl->cairo_surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid, - CAIRO_FORMAT_A1); + GDK_VISUAL_XVISUAL (visual), + width, height); + else if (gdk_drawable_get_depth (drawable) == 1) + impl->cairo_surface = cairo_xlib_surface_create_for_bitmap (GDK_SCREEN_XDISPLAY (impl->screen), + impl->xid, + width, height); else { g_warning ("Using Cairo rendering requires the drawable argument to\n" @@ -1471,12 +1496,6 @@ gdk_x11_ref_cairo_surface (GdkDrawable *drawable) return NULL; } - if (GDK_IS_PIXMAP_IMPL_X11 (drawable)) - { - GdkPixmapImplX11 *pix_impl = GDK_PIXMAP_IMPL_X11 (drawable); - cairo_xlib_surface_set_size (impl->cairo_surface, pix_impl->width, pix_impl->height); - } - cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key, drawable, gdk_x11_cairo_surface_destroy); } diff --git a/gdk/x11/gdkdrawable-x11.h b/gdk/x11/gdkdrawable-x11.h index 4b3d13c69d..e4b8a61fcf 100644 --- a/gdk/x11/gdkdrawable-x11.h +++ b/gdk/x11/gdkdrawable-x11.h @@ -93,6 +93,7 @@ void _gdk_x11_convert_to_format (guchar *src_buf, /* Note that the following take GdkDrawableImplX11, not the wrapper drawable */ void _gdk_x11_drawable_finish (GdkDrawable *drawable); +void _gdk_x11_drawable_update_size (GdkDrawable *drawable); #ifdef __cplusplus } diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 7cc35187ca..6897775d8b 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -1828,6 +1828,9 @@ gdk_event_translate (GdkDisplay *display, window_private->y = event->configure.y; window_impl->width = xevent->xconfigure.width; window_impl->height = xevent->xconfigure.height; + + _gdk_x11_drawable_update_size (window_private->impl); + if (window_private->resize_count >= 1) { window_private->resize_count -= 1; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index bd86efdb83..8d9216993e 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -1735,6 +1735,7 @@ gdk_window_resize (GdkWindow *window, { _gdk_window_move_resize_child (window, private->x, private->y, width, height); + _gdk_x11_drawable_update_size (private->impl); } else { @@ -1748,6 +1749,7 @@ gdk_window_resize (GdkWindow *window, { impl->width = width; impl->height = height; + _gdk_x11_drawable_update_size (private->impl); } else { @@ -1755,6 +1757,8 @@ gdk_window_resize (GdkWindow *window, private->resize_count += 1; } } + + _gdk_x11_drawable_update_size (private->impl); } } @@ -1795,6 +1799,7 @@ gdk_window_move_resize (GdkWindow *window, if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD) { _gdk_window_move_resize_child (window, x, y, width, height); + _gdk_x11_drawable_update_size (private->impl); } else { @@ -1809,6 +1814,8 @@ gdk_window_move_resize (GdkWindow *window, private->y = y; impl->width = width; impl->height = height; + + _gdk_x11_drawable_update_size (private->impl); } else {